Skip to content

Commit 2e38497

Browse files
committed
undo migration to zod 4
1 parent ae91f2c commit 2e38497

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+496
-169
lines changed

backend/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@
3131
"@codebuff/internal": "workspace:*",
3232
"@google-cloud/vertexai": "1.10.0",
3333
"@google/generative-ai": "0.24.1",
34-
"@jitl/quickjs-wasmfile-release-sync": "0.31.0",
3534
"ai": "4.3.16",
3635
"cors": "^2.8.5",
3736
"diff": "5.2.0",
3837
"dotenv": "16.4.5",
3938
"express": "4.19.2",
4039
"gpt-tokenizer": "2.8.1",
4140
"ignore": "5.3.2",
41+
"@jitl/quickjs-wasmfile-release-sync": "0.31.0",
42+
"quickjs-emscripten-core": "0.31.0",
4243
"lodash": "*",
4344
"openai": "^4.78.1",
4445
"pino": "9.4.0",
4546
"postgres": "3.4.4",
4647
"posthog-node": "^4.14.0",
47-
"quickjs-emscripten-core": "0.31.0",
4848
"ts-pattern": "5.3.1",
4949
"ws": "8.18.0",
50-
"zod": "4.0.0",
50+
"zod": "3.25.67",
5151
"zod-from-json-schema": "0.4.2"
5252
},
5353
"devDependencies": {

backend/src/api/org.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async function isRepoCoveredHandler(
5555
if (error instanceof z.ZodError) {
5656
return res
5757
.status(400)
58-
.json({ error: 'Invalid request body', issues: error.issues })
58+
.json({ error: 'Invalid request body', issues: error.errors })
5959
}
6060
next(error)
6161
return

backend/src/api/usage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ async function usageHandler(
9898
if (error instanceof z.ZodError) {
9999
return res
100100
.status(400)
101-
.json({ message: 'Invalid request body', issues: error.issues })
101+
.json({ message: 'Invalid request body', issues: error.errors })
102102
}
103103
next(error)
104104
return

backend/src/llm-apis/vercel-ai-sdk/ai-sdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export const promptAiSdk = async function (
270270
// Copied over exactly from promptAiSdk but with a schema
271271
export const promptAiSdkStructured = async function <T>(options: {
272272
messages: CodebuffMessage[]
273-
schema: z.ZodType<T>
273+
schema: z.ZodType<T, z.ZodTypeDef, any>
274274
clientSessionId: string
275275
fingerprintId: string
276276
userInputId: string

backend/src/system-prompt/prompts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import {
33
codebuffConfigFile,
44
CodebuffConfigSchema,
55
} from '@codebuff/common/json-config/constants'
6+
import { stringifySchema } from '@codebuff/common/json-config/stringify-schema'
67
import {
78
flattenTree,
89
getLastReadFilePaths,
910
} from '@codebuff/common/project-file-tree'
1011
import { createMarkdownFileBlock } from '@codebuff/common/util/file'
1112
import { truncateString } from '@codebuff/common/util/string'
1213
import { closeXml } from '@codebuff/common/util/xml'
13-
import { schemaToJsonStr } from '@codebuff/common/util/zod-schema'
1414

1515
import { truncateFileTreeBasedOnTokenBudget } from './truncate-file-tree'
1616

@@ -23,7 +23,7 @@ export const configSchemaPrompt = `
2323
2424
The following describes the structure of the \`./${codebuffConfigFile}\` configuration file that users might have in their project root. You can use this to understand user settings if they mention them.
2525
26-
${schemaToJsonStr(CodebuffConfigSchema)}
26+
${stringifySchema(CodebuffConfigSchema)}
2727
2828
## Background Processes
2929

backend/src/templates/agents/archive/dry-run.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AGENT_PERSONAS } from '@codebuff/common/constants/agents'
2-
import z from 'zod'
2+
import z from 'zod/v4'
33

44
import { PLACEHOLDER } from '../../types'
55

backend/src/templates/agents/ask.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AGENT_PERSONAS } from '@codebuff/common/constants/agents'
22
import { AgentTemplateTypes } from '@codebuff/common/types/session-state'
3-
import z from 'zod'
3+
import z from 'zod/v4'
44

55
import {
66
askAgentAgentStepPrompt,

backend/src/templates/agents/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AGENT_PERSONAS } from '@codebuff/common/constants/agents'
22
import { AgentTemplateTypes } from '@codebuff/common/types/session-state'
3-
import z from 'zod'
3+
import z from 'zod/v4'
44

55
import {
66
baseAgentAgentStepPrompt,

backend/src/templates/agents/file-explorer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AgentTemplateTypes } from '@codebuff/common/types/session-state'
2-
import { z } from 'zod'
2+
import { z } from 'zod/v4'
33

44
import type { AgentTemplate } from '../types'
55

backend/src/templates/agents/file-picker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AGENT_PERSONAS } from '@codebuff/common/constants/agents'
2-
import z from 'zod'
2+
import z from 'zod/v4'
33

44
import { PLACEHOLDER } from '../types'
55

0 commit comments

Comments
 (0)