Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@
"@types/react": "18.3.31",
"@types/react-dom": "18.3.7",
"csstype": "3.2.3",
"zod": "3.25.76",
"zod": "4.6.7",
"@lmstudio/sdk>zod": "3.25.76",
"knip>zod": "3.25.76",
"katex": "0.18.2"
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@roo-code/types": "workspace:^",
"jwt-decode": "^4.0.0",
"zod": "^3.25.76"
"zod": "^4.0.0"
},
"devDependencies": {
"@roo-code/config-eslint": "workspace:^",
Expand Down
4 changes: 2 additions & 2 deletions packages/cloud/src/WebAuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const clerkMeResponseSchema = z.object({
}),
)
.optional(),
public_metadata: z.record(z.any()).optional(),
public_metadata: z.record(z.string(), z.any()).optional(),
}),
})

Expand Down Expand Up @@ -233,7 +233,7 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
return credentials
} catch (error) {
if (error instanceof z.ZodError) {
this.log("[auth] Invalid credentials format:", error.errors)
this.log("[auth] Invalid credentials format:", error.issues)
} else {
this.log("[auth] Failed to parse stored credentials:", error)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"execa": "^9.5.2",
"ignore": "^7.0.3",
"openai": "^5.12.2",
"zod": "^3.25.61"
"zod": "^4.0.0"
},
"devDependencies": {
"@roo-code/config-eslint": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/telemetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@roo-code/types": "workspace:^",
"posthog-node": "^5.0.0",
"zod": "^3.25.61"
"zod": "^4.0.0"
},
"devDependencies": {
"@roo-code/config-eslint": "workspace:^",
Expand Down
5 changes: 2 additions & 3 deletions packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"dependencies": {
"ai-sdk-provider-poe": "2.0.18",
"zod": "3.25.76"
"zod": "4.6.7"
},
"devDependencies": {
"@roo-code/config-eslint": "workspace:^",
Expand All @@ -42,7 +42,6 @@
"globals": "16.5.0",
"tsup": "8.5.1",
"ajv": "8.20.0",
"vitest": "4.1.11",
"zod-to-json-schema": "3.25.2"
"vitest": "4.1.11"
}
}
2 changes: 1 addition & 1 deletion packages/types/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export type RooCliQueueItem = z.infer<typeof rooCliQueueItemSchema>

export const rooCliToolUseSchema = z.object({
name: z.string(),
input: z.record(z.unknown()).optional(),
input: z.record(z.string(), z.unknown()).optional(),
})

export type RooCliToolUse = z.infer<typeof rooCliToolUseSchema>
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export interface CloudOrganizationMembership {
export const organizationAllowListSchema = z.object({
allowAll: z.boolean(),
providers: z.record(
z.string(),
z.object({
allowAll: z.boolean(),
models: z.array(z.string()).optional(),
Expand Down
4 changes: 2 additions & 2 deletions packages/types/src/mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ const rawGroupEntryArraySchema = z.array(groupEntrySchema).refine(
* tool groups (e.g., "browser") before validation, ensuring backward compatibility
* with older user configs.
*
* The type assertion to `z.ZodType<GroupEntry[], z.ZodTypeDef, GroupEntry[]>` is
* The type assertion to `z.ZodType<GroupEntry[], GroupEntry[]>` is
* required because `z.preprocess` erases the input type to `unknown`, which
* propagates through `modeConfigSchema → rooCodeSettingsSchema → createRunSchema`
* and breaks `zodResolver` generic inference in downstream consumers.
*/
export const groupEntryArraySchema = z.preprocess((val) => {
if (!Array.isArray(val)) return val
return val.filter((entry) => !isDeprecatedGroupEntry(entry))
}, rawGroupEntryArraySchema) as z.ZodType<GroupEntry[], z.ZodTypeDef, GroupEntry[]>
}, rawGroupEntryArraySchema) as z.ZodType<GroupEntry[], GroupEntry[]>

export const modeConfigSchema = z.object({
slug: z.string().regex(/^[a-zA-Z0-9-]+$/, "Slug must contain only letters numbers and dashes"),
Expand Down
4 changes: 2 additions & 2 deletions packages/types/src/provider-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const indexProviderDefinitions = (
const providerDefinitions = indexProviderDefinitions(providerDefinitionList)

const defaultSchema = z.object({
[API_PROVIDER_FIELD]: z.undefined(),
[API_PROVIDER_FIELD]: z.undefined().optional(),
})

type ProviderDefinitionSchemas<D extends readonly ProviderDefinition[]> = {
Expand All @@ -266,7 +266,7 @@ export const providerSettingsSchemaDiscriminated = z.discriminatedUnion(API_PROV

type ProviderSettingsShape = UnionToIntersection<(typeof providerDefinitionList)[number][typeof SETTINGS_SHAPE_FIELD]>

const providerSettingsObjectSchema = providerDefinitionList.reduce<z.AnyZodObject>(
const providerSettingsObjectSchema = providerDefinitionList.reduce<z.ZodObject>(
(schema, definition) => schema.merge(z.object(definition[SETTINGS_SHAPE_FIELD])),
z.object({}),
)
Expand Down
8 changes: 3 additions & 5 deletions packages/types/src/provider-settings/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ export const API_MODEL_ID_FIELD = "apiModelId"
// map `null` to `undefined` before validation; the return type strips `null` from
// the output because it can never survive the preprocessing step.
const nullableOptional = <Schema extends z.ZodTypeAny>(schema: Schema) =>
z.preprocess((value) => (value === null ? undefined : value), schema) as unknown as z.ZodType<
Exclude<z.infer<Schema>, null>,
z.ZodTypeDef,
z.input<Schema>
z.preprocess((value) => (value === null ? undefined : value), schema) as unknown as z.ZodOptional<
z.ZodType<Exclude<z.infer<Schema>, null>, z.input<Schema>>
>

export const baseProviderSettingsShape = {
Expand Down Expand Up @@ -59,7 +57,7 @@ export type ProviderDefinition = {
apiProvider: ProviderIdentifier
settingsShape: z.ZodRawShape
modelIdKey?: string
schema: z.ZodDiscriminatedUnionOption<typeof API_PROVIDER_FIELD>
schema: z.ZodObject
getModelId: ProviderModelIdAccessor
}

Expand Down
7 changes: 3 additions & 4 deletions packages/types/src/roomodes-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import { z } from "zod"
import { zodToJsonSchema } from "zod-to-json-schema"

import { toolGroups, deprecatedToolGroups } from "./tool.js"
import { groupOptionsSchema, modeConfigSchema } from "./mode.js"
Expand Down Expand Up @@ -45,9 +44,9 @@ const roomodesZodSchema = z
* Includes metadata fields ($id, title, description).
*/
export function generateRoomodesJsonSchema(): Record<string, unknown> {
const jsonSchema = zodToJsonSchema(roomodesZodSchema, {
$refStrategy: "none",
target: "jsonSchema7",
const jsonSchema = z.toJSONSchema(roomodesZodSchema, {
target: "draft-7",
io: "output",
}) as Record<string, unknown>

jsonSchema["$id"] = "https://github.com/RooCodeInc/Roo-Code/blob/main/schemas/roomodes.json"
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export type ToolName = z.infer<typeof toolNamesSchema>
* ToolUsage
*/

export const toolUsageSchema = z.record(
export const toolUsageSchema = z.partialRecord(
toolNamesSchema,
z.object({
attempts: z.number(),
Expand Down
Loading
Loading