@omnixhq/ucp-client 0.3.0 → 1.0.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.
- package/dist/adapters/vercel-ai.cjs +12 -1
- package/dist/adapters/vercel-ai.cjs.map +1 -1
- package/dist/adapters/vercel-ai.d.cts +21 -5
- package/dist/adapters/vercel-ai.d.cts.map +1 -1
- package/dist/adapters/vercel-ai.d.ts +21 -5
- package/dist/adapters/vercel-ai.d.ts.map +1 -1
- package/dist/adapters/vercel-ai.js +12 -1
- package/dist/adapters/vercel-ai.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,10 +3,21 @@ require('../errors-C1XqxNmZ.cjs');
|
|
|
3
3
|
const require_catch_errors = require('../catch-errors-BZP237w4.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/vercel-ai.ts
|
|
6
|
+
function wrapSchema(schema) {
|
|
7
|
+
return { "~standard": {
|
|
8
|
+
version: 1,
|
|
9
|
+
vendor: "ucp-client",
|
|
10
|
+
validate: (value) => ({ value }),
|
|
11
|
+
jsonSchema: {
|
|
12
|
+
input: () => schema,
|
|
13
|
+
output: () => schema
|
|
14
|
+
}
|
|
15
|
+
} };
|
|
16
|
+
}
|
|
6
17
|
function toVercelAITools(agentTools, options) {
|
|
7
18
|
return Object.fromEntries(agentTools.map((tool) => [tool.name, {
|
|
8
19
|
description: tool.description,
|
|
9
|
-
|
|
20
|
+
inputSchema: wrapSchema(tool.parameters),
|
|
10
21
|
execute: async (args) => {
|
|
11
22
|
const result = await require_catch_errors.safeExecute(() => tool.execute(args), options?.catchErrors ?? false);
|
|
12
23
|
return JSON.stringify(result);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-ai.cjs","names":["agentTools: readonly AgentTool[]","options?: AdapterOptions","args: Record<string, unknown>"],"sources":["../../src/adapters/vercel-ai.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\nimport { type AdapterOptions, safeExecute } from './catch-errors.js';\n\nexport type { AgentTool, JsonSchema };\n\nexport interface VercelAIToolDefinition {\n readonly description: string;\n readonly
|
|
1
|
+
{"version":3,"file":"vercel-ai.cjs","names":["schema: JsonSchema","agentTools: readonly AgentTool[]","options?: AdapterOptions","args: Record<string, unknown>"],"sources":["../../src/adapters/vercel-ai.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\nimport { type AdapterOptions, safeExecute } from './catch-errors.js';\n\nexport type { AgentTool, JsonSchema };\n\n// Minimal Standard Schema v1 + JSON Schema v1 interfaces (https://standardschema.dev).\n// Vercel AI SDK's FlexibleSchema requires both StandardSchemaV1 (validate) and\n// StandardJSONSchemaV1 (jsonSchema converter) — no external deps needed.\nexport interface VercelAISchema {\n readonly '~standard': {\n readonly version: 1;\n readonly vendor: string;\n readonly validate: (value: unknown) => { readonly value: unknown; readonly issues?: undefined };\n readonly jsonSchema: {\n readonly input: (options: { readonly target: string }) => Record<string, unknown>;\n readonly output: (options: { readonly target: string }) => Record<string, unknown>;\n };\n };\n}\n\nexport interface VercelAIToolDefinition {\n readonly description: string;\n readonly inputSchema: VercelAISchema;\n readonly execute: (args: Record<string, unknown>) => Promise<string>;\n}\n\nexport type VercelAIToolMap = Record<string, VercelAIToolDefinition>;\n\nfunction wrapSchema(schema: JsonSchema): VercelAISchema {\n return {\n '~standard': {\n version: 1,\n vendor: 'ucp-client',\n validate: (value) => ({ value }),\n jsonSchema: {\n input: () => schema as unknown as Record<string, unknown>,\n output: () => schema as unknown as Record<string, unknown>,\n },\n },\n };\n}\n\nexport function toVercelAITools(\n agentTools: readonly AgentTool[],\n options?: AdapterOptions,\n): VercelAIToolMap {\n return Object.fromEntries(\n agentTools.map((tool) => [\n tool.name,\n {\n description: tool.description,\n inputSchema: wrapSchema(tool.parameters),\n execute: async (args: Record<string, unknown>): Promise<string> => {\n const result = await safeExecute(() => tool.execute(args), options?.catchErrors ?? false);\n return JSON.stringify(result);\n },\n },\n ]),\n );\n}\n"],"mappings":";;;;;AA4BA,SAAS,WAAWA,QAAoC;AACtD,QAAO,EACL,aAAa;EACX,SAAS;EACT,QAAQ;EACR,UAAU,CAAC,WAAW,EAAE,MAAO;EAC/B,YAAY;GACV,OAAO,MAAM;GACb,QAAQ,MAAM;EACf;CACF,EACF;AACF;AAED,SAAgB,gBACdC,YACAC,SACiB;AACjB,QAAO,OAAO,YACZ,WAAW,IAAI,CAAC,SAAS,CACvB,KAAK,MACL;EACE,aAAa,KAAK;EAClB,aAAa,WAAW,KAAK,WAAW;EACxC,SAAS,OAAOC,SAAmD;GACjE,MAAM,SAAS,MAAM,iCAAY,MAAM,KAAK,QAAQ,KAAK,EAAE,SAAS,eAAe,MAAM;AACzF,UAAO,KAAK,UAAU,OAAO;EAC9B;CACF,CACF,EAAC,CACH;AACF"}
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import { AdapterOptions, AgentTool, JsonSchema } from "../catch-errors-CbIHeFvF.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/adapters/vercel-ai.d.ts
|
|
4
|
+
interface VercelAISchema {
|
|
5
|
+
readonly '~standard': {
|
|
6
|
+
readonly version: 1;
|
|
7
|
+
readonly vendor: string;
|
|
8
|
+
readonly validate: (value: unknown) => {
|
|
9
|
+
readonly value: unknown;
|
|
10
|
+
readonly issues?: undefined;
|
|
11
|
+
};
|
|
12
|
+
readonly jsonSchema: {
|
|
13
|
+
readonly input: (options: {
|
|
14
|
+
readonly target: string;
|
|
15
|
+
}) => Record<string, unknown>;
|
|
16
|
+
readonly output: (options: {
|
|
17
|
+
readonly target: string;
|
|
18
|
+
}) => Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
4
22
|
interface VercelAIToolDefinition {
|
|
5
23
|
readonly description: string;
|
|
6
|
-
readonly
|
|
24
|
+
readonly inputSchema: VercelAISchema;
|
|
7
25
|
readonly execute: (args: Record<string, unknown>) => Promise<string>;
|
|
8
26
|
}
|
|
9
27
|
type VercelAIToolMap = Record<string, VercelAIToolDefinition>;
|
|
10
|
-
declare function toVercelAITools(agentTools: readonly AgentTool[], options?: AdapterOptions): VercelAIToolMap;
|
|
28
|
+
declare function toVercelAITools(agentTools: readonly AgentTool[], options?: AdapterOptions): VercelAIToolMap; //#endregion
|
|
11
29
|
|
|
12
|
-
//#endregion
|
|
13
30
|
//# sourceMappingURL=vercel-ai.d.ts.map
|
|
14
|
-
|
|
15
|
-
export { AgentTool, JsonSchema, VercelAIToolDefinition, VercelAIToolMap, toVercelAITools };
|
|
31
|
+
export { AgentTool, JsonSchema, VercelAISchema, VercelAIToolDefinition, VercelAIToolMap, toVercelAITools };
|
|
16
32
|
//# sourceMappingURL=vercel-ai.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-ai.d.cts","names":[],"sources":["../../src/adapters/vercel-ai.ts"],"sourcesContent":null,"mappings":";;;
|
|
1
|
+
{"version":3,"file":"vercel-ai.d.cts","names":[],"sources":["../../src/adapters/vercel-ai.ts"],"sourcesContent":null,"mappings":";;;AAQiB,UAAA,cAAA,CAAc;EAAA,SAAA,WAAA,EAAA;IAMiC,SAAA,OAAA,EAAA,CAAA;IACC,SAAA,MAAA,EAAA,MAAA;IAAM,SAAA,QAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,GAAA;MAKtD,SAAA,KAAA,EAAA,OAAsB;MAAA,SAAA,MAAA,CAAA,EAAA,SAAA;IAEf,CAAA;IACG,SAAA,UAAA,EAAA;MAA4B,SAAA,KAAA,EAAA,CAAA,OAAA,EAAA;QAAO,SAAA,MAAA,EAAA,MAAA;MAGlD,CAAA,EAAA,GAZoD,MAYrC,CAAA,MAAA,EAAA,OAAA,CAAA;MAAA,SAAA,MAAA,EAAA,CAAA,OAAA,EAAA;QAAkB,SAAA,MAAA,EAAA,MAAA;MAAf,CAAA,EAAA,GAXmC,MAWnC,CAAA,MAAA,EAAA,OAAA,CAAA;IAAM,CAAA;EAgBpB,CAAA;;AACO,UAvBN,sBAAA,CAuBM;EAAS,SACpB,WAAA,EAAA,MAAA;EAAc,SACvB,WAAA,EAvBqB,cAuBrB;EAAe,SAAA,OAAA,EAAA,CAAA,IAAA,EAtBS,MAsBT,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAtBqC,OAsBrC,CAAA,MAAA,CAAA;;KAnBN,eAAA,GAAkB,eAAe;iBAgB7B,eAAA,sBACO,uBACX,iBACT"}
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import { AdapterOptions, AgentTool, JsonSchema } from "../catch-errors-H8gObrht.js";
|
|
2
2
|
|
|
3
3
|
//#region src/adapters/vercel-ai.d.ts
|
|
4
|
+
interface VercelAISchema {
|
|
5
|
+
readonly '~standard': {
|
|
6
|
+
readonly version: 1;
|
|
7
|
+
readonly vendor: string;
|
|
8
|
+
readonly validate: (value: unknown) => {
|
|
9
|
+
readonly value: unknown;
|
|
10
|
+
readonly issues?: undefined;
|
|
11
|
+
};
|
|
12
|
+
readonly jsonSchema: {
|
|
13
|
+
readonly input: (options: {
|
|
14
|
+
readonly target: string;
|
|
15
|
+
}) => Record<string, unknown>;
|
|
16
|
+
readonly output: (options: {
|
|
17
|
+
readonly target: string;
|
|
18
|
+
}) => Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
4
22
|
interface VercelAIToolDefinition {
|
|
5
23
|
readonly description: string;
|
|
6
|
-
readonly
|
|
24
|
+
readonly inputSchema: VercelAISchema;
|
|
7
25
|
readonly execute: (args: Record<string, unknown>) => Promise<string>;
|
|
8
26
|
}
|
|
9
27
|
type VercelAIToolMap = Record<string, VercelAIToolDefinition>;
|
|
10
|
-
declare function toVercelAITools(agentTools: readonly AgentTool[], options?: AdapterOptions): VercelAIToolMap;
|
|
28
|
+
declare function toVercelAITools(agentTools: readonly AgentTool[], options?: AdapterOptions): VercelAIToolMap; //#endregion
|
|
11
29
|
|
|
12
|
-
//#endregion
|
|
13
30
|
//# sourceMappingURL=vercel-ai.d.ts.map
|
|
14
|
-
|
|
15
|
-
export { AgentTool, JsonSchema, VercelAIToolDefinition, VercelAIToolMap, toVercelAITools };
|
|
31
|
+
export { AgentTool, JsonSchema, VercelAISchema, VercelAIToolDefinition, VercelAIToolMap, toVercelAITools };
|
|
16
32
|
//# sourceMappingURL=vercel-ai.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-ai.d.ts","names":[],"sources":["../../src/adapters/vercel-ai.ts"],"sourcesContent":null,"mappings":";;;
|
|
1
|
+
{"version":3,"file":"vercel-ai.d.ts","names":[],"sources":["../../src/adapters/vercel-ai.ts"],"sourcesContent":null,"mappings":";;;AAQiB,UAAA,cAAA,CAAc;EAAA,SAAA,WAAA,EAAA;IAMiC,SAAA,OAAA,EAAA,CAAA;IACC,SAAA,MAAA,EAAA,MAAA;IAAM,SAAA,QAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,GAAA;MAKtD,SAAA,KAAA,EAAA,OAAsB;MAAA,SAAA,MAAA,CAAA,EAAA,SAAA;IAEf,CAAA;IACG,SAAA,UAAA,EAAA;MAA4B,SAAA,KAAA,EAAA,CAAA,OAAA,EAAA;QAAO,SAAA,MAAA,EAAA,MAAA;MAGlD,CAAA,EAAA,GAZoD,MAYrC,CAAA,MAAA,EAAA,OAAA,CAAA;MAAA,SAAA,MAAA,EAAA,CAAA,OAAA,EAAA;QAAkB,SAAA,MAAA,EAAA,MAAA;MAAf,CAAA,EAAA,GAXmC,MAWnC,CAAA,MAAA,EAAA,OAAA,CAAA;IAAM,CAAA;EAgBpB,CAAA;;AACO,UAvBN,sBAAA,CAuBM;EAAS,SACpB,WAAA,EAAA,MAAA;EAAc,SACvB,WAAA,EAvBqB,cAuBrB;EAAe,SAAA,OAAA,EAAA,CAAA,IAAA,EAtBS,MAsBT,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAtBqC,OAsBrC,CAAA,MAAA,CAAA;;KAnBN,eAAA,GAAkB,eAAe;iBAgB7B,eAAA,sBACO,uBACX,iBACT"}
|
|
@@ -2,10 +2,21 @@ import "../errors-DX7yw6Gl.js";
|
|
|
2
2
|
import { safeExecute } from "../catch-errors-Cpn2vHir.js";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/vercel-ai.ts
|
|
5
|
+
function wrapSchema(schema) {
|
|
6
|
+
return { "~standard": {
|
|
7
|
+
version: 1,
|
|
8
|
+
vendor: "ucp-client",
|
|
9
|
+
validate: (value) => ({ value }),
|
|
10
|
+
jsonSchema: {
|
|
11
|
+
input: () => schema,
|
|
12
|
+
output: () => schema
|
|
13
|
+
}
|
|
14
|
+
} };
|
|
15
|
+
}
|
|
5
16
|
function toVercelAITools(agentTools, options) {
|
|
6
17
|
return Object.fromEntries(agentTools.map((tool) => [tool.name, {
|
|
7
18
|
description: tool.description,
|
|
8
|
-
|
|
19
|
+
inputSchema: wrapSchema(tool.parameters),
|
|
9
20
|
execute: async (args) => {
|
|
10
21
|
const result = await safeExecute(() => tool.execute(args), options?.catchErrors ?? false);
|
|
11
22
|
return JSON.stringify(result);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-ai.js","names":["agentTools: readonly AgentTool[]","options?: AdapterOptions","args: Record<string, unknown>"],"sources":["../../src/adapters/vercel-ai.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\nimport { type AdapterOptions, safeExecute } from './catch-errors.js';\n\nexport type { AgentTool, JsonSchema };\n\nexport interface VercelAIToolDefinition {\n readonly description: string;\n readonly
|
|
1
|
+
{"version":3,"file":"vercel-ai.js","names":["schema: JsonSchema","agentTools: readonly AgentTool[]","options?: AdapterOptions","args: Record<string, unknown>"],"sources":["../../src/adapters/vercel-ai.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\nimport { type AdapterOptions, safeExecute } from './catch-errors.js';\n\nexport type { AgentTool, JsonSchema };\n\n// Minimal Standard Schema v1 + JSON Schema v1 interfaces (https://standardschema.dev).\n// Vercel AI SDK's FlexibleSchema requires both StandardSchemaV1 (validate) and\n// StandardJSONSchemaV1 (jsonSchema converter) — no external deps needed.\nexport interface VercelAISchema {\n readonly '~standard': {\n readonly version: 1;\n readonly vendor: string;\n readonly validate: (value: unknown) => { readonly value: unknown; readonly issues?: undefined };\n readonly jsonSchema: {\n readonly input: (options: { readonly target: string }) => Record<string, unknown>;\n readonly output: (options: { readonly target: string }) => Record<string, unknown>;\n };\n };\n}\n\nexport interface VercelAIToolDefinition {\n readonly description: string;\n readonly inputSchema: VercelAISchema;\n readonly execute: (args: Record<string, unknown>) => Promise<string>;\n}\n\nexport type VercelAIToolMap = Record<string, VercelAIToolDefinition>;\n\nfunction wrapSchema(schema: JsonSchema): VercelAISchema {\n return {\n '~standard': {\n version: 1,\n vendor: 'ucp-client',\n validate: (value) => ({ value }),\n jsonSchema: {\n input: () => schema as unknown as Record<string, unknown>,\n output: () => schema as unknown as Record<string, unknown>,\n },\n },\n };\n}\n\nexport function toVercelAITools(\n agentTools: readonly AgentTool[],\n options?: AdapterOptions,\n): VercelAIToolMap {\n return Object.fromEntries(\n agentTools.map((tool) => [\n tool.name,\n {\n description: tool.description,\n inputSchema: wrapSchema(tool.parameters),\n execute: async (args: Record<string, unknown>): Promise<string> => {\n const result = await safeExecute(() => tool.execute(args), options?.catchErrors ?? false);\n return JSON.stringify(result);\n },\n },\n ]),\n );\n}\n"],"mappings":";;;;AA4BA,SAAS,WAAWA,QAAoC;AACtD,QAAO,EACL,aAAa;EACX,SAAS;EACT,QAAQ;EACR,UAAU,CAAC,WAAW,EAAE,MAAO;EAC/B,YAAY;GACV,OAAO,MAAM;GACb,QAAQ,MAAM;EACf;CACF,EACF;AACF;AAED,SAAgB,gBACdC,YACAC,SACiB;AACjB,QAAO,OAAO,YACZ,WAAW,IAAI,CAAC,SAAS,CACvB,KAAK,MACL;EACE,aAAa,KAAK;EAClB,aAAa,WAAW,KAAK,WAAW;EACxC,SAAS,OAAOC,SAAmD;GACjE,MAAM,SAAS,MAAM,YAAY,MAAM,KAAK,QAAQ,KAAK,EAAE,SAAS,eAAe,MAAM;AACzF,UAAO,KAAK,UAAU,OAAO;EAC9B;CACF,CACF,EAAC,CACH;AACF"}
|
package/package.json
CHANGED