Skip to content

Commit b8c4253

Browse files
authored
chore: upgrade zod to v4 (#298)
*Issue #, if available:* closes #280 *Description of changes:* * Remove zod-to-json-schema * Replace ZodSchema with ZodType colinhacks/zod#4877 * Upgrade @hookform/resolves to ^[5.1.0](https://github.com/react-hook-form/resolvers/releases/tag/v5.1.0) By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent e380a65 commit b8c4253

File tree

8 files changed

+63
-197
lines changed

8 files changed

+63
-197
lines changed

package-lock.json

Lines changed: 49 additions & 182 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/agent-core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
"@aws-sdk/client-sts": "^3.758.0",
4141
"@aws-sdk/credential-providers": "^3.750.0",
4242
"@aws-sdk/lib-dynamodb": "^3.744.0",
43+
"@modelcontextprotocol/sdk": "^1.7.0",
4344
"@octokit/rest": "^22.0.0",
4445
"@slack/bolt": "^4.2.0",
4546
"p-retry": "^6.2.1",
4647
"sharp": "^0.33.5",
47-
"zod": "^3.24.2",
48-
"zod-to-json-schema": "^3.24.3"
48+
"zod": "^4.0.0"
4949
},
5050
"devDependencies": {
5151
"@types/node": "^22.13.1",

packages/agent-core/src/private/common/lib.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
import { Tool, ToolResultContentBlock } from '@aws-sdk/client-bedrock-runtime';
2-
import { ZodSchema } from 'zod';
3-
import { zodToJsonSchema } from 'zod-to-json-schema';
2+
import z, { ZodType } from 'zod';
43

54
export type ToolDefinition<Input> = {
65
/**
76
* Name of the tool. This is the identifier of the tool for the agent.
87
*/
98
readonly name: string;
109
readonly handler: (input: Input, context: { toolUseId: string }) => Promise<string | ToolResultContentBlock[]>;
11-
readonly schema: ZodSchema;
10+
readonly schema: ZodType<Input>;
1211
readonly toolSpec: () => Promise<NonNullable<Tool['toolSpec']>>;
1312
};
1413

15-
export const zodToJsonSchemaBody = (schema: ZodSchema) => {
16-
const key = 'mySchema';
17-
const jsonSchema = zodToJsonSchema(schema, key);
18-
return jsonSchema.definitions?.[key] as any;
14+
export const zodToJsonSchemaBody = (schema: ZodType) => {
15+
return z.toJSONSchema(schema) as any;
1916
};
2017

2118
export const truncate = (str: string, maxLength: number = 10 * 1e3, headRatio = 0.2) => {

packages/slack-bolt-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@remote-swe-agents/agent-core": "file:../agent-core",
2525
"@slack/bolt": "^4.0.0",
2626
"@slack/web-api": "^7.8.0",
27-
"zod": "^3.24.3"
27+
"zod": "^4.0.0"
2828
},
2929
"devDependencies": {
3030
"@types/aws-lambda": "^8.10.147",

0 commit comments

Comments
 (0)