Skip to content

Commit 856e65d

Browse files
authored
Merge pull request #52 from agentage/copilot/fix-ci-failure-issue
Fix CI failure after Zod 4.2.1 upgrade
2 parents dbcc136 + ebdccae commit 856e65d

4 files changed

Lines changed: 6 additions & 29 deletions

File tree

package-lock.json

Lines changed: 1 addition & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"test:watch": "npm run test:watch --workspaces",
2121
"test:coverage": "npm run test:coverage --workspaces",
2222
"clean": "npm run clean --workspaces",
23-
"verify": "npm run type-check && npm run lint && npm run build && npm run test"
23+
"verify": "npm run build && npm run type-check && npm run lint && npm run test"
2424
},
2525
"keywords": [
2626
"agent",

packages/sdk/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
"dependencies": {
4242
"@agentage/core": "^0.1.0",
4343
"openai": "^6.15.0",
44-
"zod": "4.2.1",
45-
"zod-to-json-schema": "3.24.6"
44+
"zod": "4.2.1"
4645
},
4746
"devDependencies": {
4847
"@types/jest": "^30.0.0",

packages/sdk/src/agent.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type {
77
} from '@agentage/core';
88
import OpenAI from 'openai';
99
import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions';
10-
import { zodToJsonSchema } from 'zod-to-json-schema';
1110
import {
1211
MissingApiKeyError,
1312
NotImplementedError,
@@ -43,12 +42,10 @@ function convertSchemaToJsonSchema(schema: any): any {
4342
const required: string[] = [];
4443

4544
for (const [key, value] of Object.entries(schema)) {
46-
// Check if it's a Zod schema
47-
if (value && typeof value === 'object' && '_def' in value) {
45+
// Check if it's a Zod schema (has toJSONSchema method from Zod 4.x)
46+
if (value && typeof value === 'object' && 'toJSONSchema' in value) {
4847
// eslint-disable-next-line @typescript-eslint/no-explicit-any
49-
const jsonSchema = zodToJsonSchema(value as any, {
50-
$refStrategy: 'none',
51-
});
48+
const jsonSchema = (value as any).toJSONSchema();
5249

5350
// Extract the actual schema (remove top-level $schema if present)
5451
// eslint-disable-next-line @typescript-eslint/no-unused-vars

0 commit comments

Comments
 (0)