@librechat/agents 4.1.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
let zod_to_json_schema = require("zod-to-json-schema");
|
|
2
|
+
let _langchain_core_utils_types = require("@langchain/core/utils/types");
|
|
3
|
+
let zod_v4_core = require("zod/v4/core");
|
|
4
|
+
let zod_v4 = require("zod-v4");
|
|
2
5
|
//#region src/utils/schema.ts
|
|
6
|
+
const earlyMetadata = zod_v4_core.globalRegistry;
|
|
7
|
+
const schemaMetadata = (0, zod_v4.registry)();
|
|
8
|
+
schemaMetadata.get = (schema) => {
|
|
9
|
+
const annotated = schema;
|
|
10
|
+
return typeof annotated.meta === "function" ? annotated.meta() : zod_v4.globalRegistry.get(schema) ?? earlyMetadata.get(schema);
|
|
11
|
+
};
|
|
3
12
|
function isZodSchema(schema) {
|
|
4
13
|
return schema != null && typeof schema === "object" && "_def" in schema;
|
|
5
14
|
}
|
|
6
15
|
function toJsonSchema(schema, name, description) {
|
|
16
|
+
if ((0, _langchain_core_utils_types.isZodSchemaV4)(schema)) return {
|
|
17
|
+
...(0, zod_v4.toJSONSchema)(schema, {
|
|
18
|
+
target: "draft-7",
|
|
19
|
+
io: "input",
|
|
20
|
+
unrepresentable: "any",
|
|
21
|
+
metadata: schemaMetadata
|
|
22
|
+
}),
|
|
23
|
+
...name != null && name !== "" ? { title: name } : {},
|
|
24
|
+
...description != null && description !== "" ? { description } : {}
|
|
25
|
+
};
|
|
7
26
|
if (isZodSchema(schema)) return (0, zod_to_json_schema.zodToJsonSchema)(description != null && description !== "" ? schema.describe(description) : schema, name ?? "");
|
|
8
27
|
return schema;
|
|
9
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.cjs","names":["zodSchema"],"sources":["../../../src/utils/schema.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.cjs","names":["earlyRegistry","globalRegistry","zodSchema"],"sources":["../../../src/utils/schema.ts"],"mappings":";;;;;AASA,MAAM,gBAAgBA,YAAAA;AAGtB,MAAM,kBAAA,GAAA,OAAA,SAAA,CAAsC;AAC5C,eAAe,OAAO,WAAmC;CACvD,MAAM,YAAY;CAClB,OAAO,OAAO,UAAU,SAAS,aAC7B,UAAU,KAAK,IACdC,OAAAA,eAAe,IAAI,MAAM,KAAK,cAAc,IAAI,MAAM;AAC7D;AAGA,SAAgB,YAAY,QAAuC;CACjE,OACE,UAAU,QAAQ,OAAO,WAAW,YAAY,UAAW;AAE/D;AAMA,SAAgB,aACd,QACA,MACA,aACyB;CACzB,KAAA,GAAA,4BAAA,cAAA,CAAkB,MAAM,GACtB,OAAO;EACL,IAAA,GAAA,OAAA,aAAA,CAAgB,QAAoB;GAClC,QAAQ;GACR,IAAI;GACJ,iBAAiB;GACjB,UAAU;EACZ,CAAC;EACD,GAAI,QAAQ,QAAQ,SAAS,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;EACrD,GAAI,eAAe,QAAQ,gBAAgB,KAAK,EAAE,YAAY,IAAI,CAAC;CACrE;CAEF,IAAI,YAAY,MAAM,GAQpB,QAAA,GAAA,mBAAA,gBAAA,CAHE,eAAe,QAAQ,gBAAgB,KACnCC,OAAU,SAAS,WAAW,IAC9B,QAGJ,QAAQ,EACV;CAEF,OAAO;AACT"}
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
2
|
+
import { isZodSchemaV4 } from "@langchain/core/utils/types";
|
|
3
|
+
import { globalRegistry } from "zod/v4/core";
|
|
4
|
+
import { globalRegistry as globalRegistry$1, registry, toJSONSchema } from "zod-v4";
|
|
2
5
|
//#region src/utils/schema.ts
|
|
6
|
+
const earlyMetadata = globalRegistry;
|
|
7
|
+
const schemaMetadata = registry();
|
|
8
|
+
schemaMetadata.get = (schema) => {
|
|
9
|
+
const annotated = schema;
|
|
10
|
+
return typeof annotated.meta === "function" ? annotated.meta() : globalRegistry$1.get(schema) ?? earlyMetadata.get(schema);
|
|
11
|
+
};
|
|
3
12
|
function isZodSchema(schema) {
|
|
4
13
|
return schema != null && typeof schema === "object" && "_def" in schema;
|
|
5
14
|
}
|
|
6
15
|
function toJsonSchema(schema, name, description) {
|
|
16
|
+
if (isZodSchemaV4(schema)) return {
|
|
17
|
+
...toJSONSchema(schema, {
|
|
18
|
+
target: "draft-7",
|
|
19
|
+
io: "input",
|
|
20
|
+
unrepresentable: "any",
|
|
21
|
+
metadata: schemaMetadata
|
|
22
|
+
}),
|
|
23
|
+
...name != null && name !== "" ? { title: name } : {},
|
|
24
|
+
...description != null && description !== "" ? { description } : {}
|
|
25
|
+
};
|
|
7
26
|
if (isZodSchema(schema)) return zodToJsonSchema(description != null && description !== "" ? schema.describe(description) : schema, name ?? "");
|
|
8
27
|
return schema;
|
|
9
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.mjs","names":["zodSchema"],"sources":["../../../src/utils/schema.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.mjs","names":["earlyRegistry","globalRegistry","zodSchema"],"sources":["../../../src/utils/schema.ts"],"mappings":";;;;;AASA,MAAM,gBAAgBA;AAGtB,MAAM,iBAAiB,SAAqB;AAC5C,eAAe,OAAO,WAAmC;CACvD,MAAM,YAAY;CAClB,OAAO,OAAO,UAAU,SAAS,aAC7B,UAAU,KAAK,IACdC,iBAAe,IAAI,MAAM,KAAK,cAAc,IAAI,MAAM;AAC7D;AAGA,SAAgB,YAAY,QAAuC;CACjE,OACE,UAAU,QAAQ,OAAO,WAAW,YAAY,UAAW;AAE/D;AAMA,SAAgB,aACd,QACA,MACA,aACyB;CACzB,IAAI,cAAc,MAAM,GACtB,OAAO;EACL,GAAG,aAAa,QAAoB;GAClC,QAAQ;GACR,IAAI;GACJ,iBAAiB;GACjB,UAAU;EACZ,CAAC;EACD,GAAI,QAAQ,QAAQ,SAAS,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;EACrD,GAAI,eAAe,QAAQ,gBAAgB,KAAK,EAAE,YAAY,IAAI,CAAC;CACrE;CAEF,IAAI,YAAY,MAAM,GAQpB,OAAO,gBAHL,eAAe,QAAQ,gBAAgB,KACnCC,OAAU,SAAS,WAAW,IAC9B,QAGJ,QAAQ,EACV;CAEF,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@librechat/agents",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"reova": {
|
|
5
5
|
"enabled": true,
|
|
6
6
|
"endpoint": "https://telemetry.reo.dev/data"
|
|
@@ -351,7 +351,10 @@
|
|
|
351
351
|
"openai": "^6.46.0",
|
|
352
352
|
"reova": "^0.4.1",
|
|
353
353
|
"socks-proxy-agent": "^8.0.5",
|
|
354
|
-
"uuid": "^11.1.1"
|
|
354
|
+
"uuid": "^11.1.1",
|
|
355
|
+
"zod": "3.25.67",
|
|
356
|
+
"zod-to-json-schema": "3.25.2",
|
|
357
|
+
"zod-v4": "npm:zod@4.6.7"
|
|
355
358
|
},
|
|
356
359
|
"peerDependencies": {
|
|
357
360
|
"@anthropic-ai/sandbox-runtime": "^0.0.78"
|
package/src/utils/schema.ts
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
// src/utils/schema.ts
|
|
2
1
|
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
2
|
+
import { isZodSchemaV4 } from '@langchain/core/utils/types';
|
|
3
|
+
import { globalRegistry as earlyRegistry } from 'zod/v4/core';
|
|
4
|
+
import { globalRegistry, registry, toJSONSchema } from 'zod-v4';
|
|
5
|
+
import type { $ZodType, GlobalMeta } from 'zod-v4/v4/core';
|
|
6
|
+
import type { ZodType as ZodV4Type } from 'zod-v4';
|
|
3
7
|
import type { ZodTypeAny } from 'zod';
|
|
4
8
|
|
|
9
|
+
/** Separate Zod installations may not share their global metadata registry. */
|
|
10
|
+
const earlyMetadata = earlyRegistry as {
|
|
11
|
+
get(schema: object): GlobalMeta | undefined;
|
|
12
|
+
};
|
|
13
|
+
const schemaMetadata = registry<GlobalMeta>();
|
|
14
|
+
schemaMetadata.get = (schema): GlobalMeta | undefined => {
|
|
15
|
+
const annotated = schema as $ZodType & Partial<Pick<ZodV4Type, 'meta'>>;
|
|
16
|
+
return typeof annotated.meta === 'function'
|
|
17
|
+
? annotated.meta()
|
|
18
|
+
: (globalRegistry.get(schema) ?? earlyMetadata.get(schema));
|
|
19
|
+
};
|
|
20
|
+
|
|
5
21
|
/** Checks if a schema is a Zod schema by looking for the _def property */
|
|
6
22
|
export function isZodSchema(schema: unknown): schema is ZodTypeAny {
|
|
7
23
|
return (
|
|
@@ -18,6 +34,18 @@ export function toJsonSchema(
|
|
|
18
34
|
name?: string,
|
|
19
35
|
description?: string
|
|
20
36
|
): Record<string, unknown> {
|
|
37
|
+
if (isZodSchemaV4(schema)) {
|
|
38
|
+
return {
|
|
39
|
+
...toJSONSchema(schema as $ZodType, {
|
|
40
|
+
target: 'draft-7',
|
|
41
|
+
io: 'input',
|
|
42
|
+
unrepresentable: 'any',
|
|
43
|
+
metadata: schemaMetadata,
|
|
44
|
+
}),
|
|
45
|
+
...(name != null && name !== '' ? { title: name } : {}),
|
|
46
|
+
...(description != null && description !== '' ? { description } : {}),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
21
49
|
if (isZodSchema(schema)) {
|
|
22
50
|
const zodSchema = schema as ZodTypeAny & {
|
|
23
51
|
describe: (desc: string) => ZodTypeAny;
|