@alexkroman1/aai 1.5.0 → 1.5.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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +6 -0
- package/dist/{_internal-types-3p3OJZPb.js → _internal-types-DFL07G3f.js} +2 -0
- package/dist/host/runtime-barrel.js +2 -1
- package/dist/sdk/_internal-types.d.ts +2 -0
- package/dist/sdk/manifest-barrel.js +1 -1
- package/host/builtin-tools.ts +1 -0
- package/host/runtime.test.ts +3 -1
- package/host/to-vercel-tools.test.ts +9 -1
- package/host/transports/pipeline-transport.test.ts +2 -0
- package/package.json +1 -1
- package/sdk/__snapshots__/schema-shapes.test.ts.snap +1 -0
- package/sdk/_internal-types.ts +3 -0
- package/sdk/schema-alignment.test.ts +18 -6
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @alexkroman1/aai@1.5.
|
|
2
|
+
> @alexkroman1/aai@1.5.1 build /home/runner/work/agent/agent/packages/aai
|
|
3
3
|
> tsdown && tsc -p tsconfig.build.json
|
|
4
4
|
|
|
5
5
|
[34mℹ[39m [34mtsdown v0.21.7[39m powered by [38;2;255;126;23mrolldown v1.0.0-rc.12[39m
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
[34mℹ[39m target: [34mnode22[39m
|
|
9
9
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
10
10
|
[34mℹ[39m Build start
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[1mhost/runtime-barrel.js[22m [2m87.
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mhost/runtime-barrel.js[22m [2m87.68 kB[22m [2m│ gzip: 25.35 kB[22m
|
|
12
12
|
[34mℹ[39m [2mdist/[22m[1msdk/protocol.js[22m [2m 4.75 kB[22m [2m│ gzip: 1.76 kB[22m
|
|
13
13
|
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m 2.88 kB[22m [2m│ gzip: 1.24 kB[22m
|
|
14
14
|
[34mℹ[39m [2mdist/[22m[1msdk/manifest-barrel.js[22m [2m 0.36 kB[22m [2m│ gzip: 0.20 kB[22m
|
|
15
15
|
[34mℹ[39m [2mdist/[22m[1msdk/providers/tts-barrel.js[22m [2m 0.26 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
16
16
|
[34mℹ[39m [2mdist/[22m[1msdk/providers/stt-barrel.js[22m [2m 0.19 kB[22m [2m│ gzip: 0.14 kB[22m
|
|
17
17
|
[34mℹ[39m [2mdist/[22m[1msdk/providers/llm-barrel.js[22m [2m 0.12 kB[22m [2m│ gzip: 0.11 kB[22m
|
|
18
|
+
[34mℹ[39m [2mdist/[22m_internal-types-DFL07G3f.js [2m 5.66 kB[22m [2m│ gzip: 2.10 kB[22m
|
|
18
19
|
[34mℹ[39m [2mdist/[22mtypes-KUgezM6u.js [2m 5.64 kB[22m [2m│ gzip: 2.39 kB[22m
|
|
19
|
-
[34mℹ[39m [2mdist/[22m_internal-types-3p3OJZPb.js [2m 5.61 kB[22m [2m│ gzip: 2.07 kB[22m
|
|
20
20
|
[34mℹ[39m [2mdist/[22mconstants-C2nirZUI.js [2m 3.10 kB[22m [2m│ gzip: 1.38 kB[22m
|
|
21
21
|
[34mℹ[39m [2mdist/[22mws-upgrade-BeOQ7fXL.js [2m 1.14 kB[22m [2m│ gzip: 0.54 kB[22m
|
|
22
22
|
[34mℹ[39m [2mdist/[22mcartesia-BfQPOQ7Y.js [2m 1.08 kB[22m [2m│ gzip: 0.50 kB[22m
|
|
23
23
|
[34mℹ[39m [2mdist/[22massemblyai-C969QGi4.js [2m 1.03 kB[22m [2m│ gzip: 0.42 kB[22m
|
|
24
24
|
[34mℹ[39m [2mdist/[22manthropic-CcLZygAr.js [2m 0.23 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
25
|
-
[34mℹ[39m 14 files, total: 114.
|
|
25
|
+
[34mℹ[39m 14 files, total: 114.11 kB
|
|
26
26
|
[32m✔[39m Build complete in [32m45ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -122,6 +122,7 @@ function toAgentConfig(src) {
|
|
|
122
122
|
* etc.) — the Vercel AI SDK wraps it via `jsonSchema()`.
|
|
123
123
|
*/
|
|
124
124
|
const ToolSchemaSchema = z.object({
|
|
125
|
+
type: z.literal("function"),
|
|
125
126
|
name: z.string().min(1),
|
|
126
127
|
description: z.string().min(1),
|
|
127
128
|
parameters: z.record(z.string(), z.unknown())
|
|
@@ -136,6 +137,7 @@ const EMPTY_PARAMS = z.object({});
|
|
|
136
137
|
*/
|
|
137
138
|
function agentToolsToSchemas(tools) {
|
|
138
139
|
return Object.entries(tools).map(([name, def]) => ({
|
|
140
|
+
type: "function",
|
|
139
141
|
name,
|
|
140
142
|
description: def.description,
|
|
141
143
|
parameters: z.toJSONSchema(def.parameters ?? EMPTY_PARAMS)
|
|
@@ -2,7 +2,7 @@ import { r as DEFAULT_SYSTEM_PROMPT } from "../types-KUgezM6u.js";
|
|
|
2
2
|
import { _ as TOOL_EXECUTION_TIMEOUT_MS, a as DEFAULT_SHUTDOWN_TIMEOUT_MS, c as FETCH_TIMEOUT_MS, d as MAX_PAGE_CHARS, g as RUN_CODE_TIMEOUT_MS, h as PIPELINE_FLUSH_TIMEOUT_MS, l as MAX_HTML_BYTES, m as MAX_WS_PAYLOAD_BYTES, o as DEFAULT_STT_SAMPLE_RATE, p as MAX_VALUE_SIZE, s as DEFAULT_TTS_SAMPLE_RATE, t as AGENT_CSP } from "../constants-C2nirZUI.js";
|
|
3
3
|
import { i as toolError, n as errorDetail, r as errorMessage, t as parseWsUpgradeParams } from "../ws-upgrade-BeOQ7fXL.js";
|
|
4
4
|
import { ClientMessageSchema, buildReadyConfig, lenientParse } from "../sdk/protocol.js";
|
|
5
|
-
import { a as toAgentConfig, c as makeSttError, i as agentToolsToSchemas, l as makeTtsError, n as EMPTY_PARAMS, s as assertProviderTriple } from "../_internal-types-
|
|
5
|
+
import { a as toAgentConfig, c as makeSttError, i as agentToolsToSchemas, l as makeTtsError, n as EMPTY_PARAMS, s as assertProviderTriple } from "../_internal-types-DFL07G3f.js";
|
|
6
6
|
import { r as DEEPGRAM_KIND, t as ASSEMBLYAI_KIND } from "../assemblyai-C969QGi4.js";
|
|
7
7
|
import { a as RIME_KIND, n as CARTESIA_KIND } from "../cartesia-BfQPOQ7Y.js";
|
|
8
8
|
import { t as ANTHROPIC_KIND } from "../anthropic-CcLZygAr.js";
|
|
@@ -334,6 +334,7 @@ function resolveAllBuiltins(names, opts) {
|
|
|
334
334
|
for (const name of names) for (const [toolName, def] of resolveBuiltin(name, opts)) {
|
|
335
335
|
defs[toolName] = def;
|
|
336
336
|
schemas.push({
|
|
337
|
+
type: "function",
|
|
337
338
|
name: toolName,
|
|
338
339
|
description: def.description,
|
|
339
340
|
parameters: z.toJSONSchema(def.parameters ?? EMPTY_PARAMS)
|
|
@@ -104,12 +104,14 @@ export declare function toAgentConfig(src: AgentConfigSource): AgentConfig;
|
|
|
104
104
|
* etc.) — the Vercel AI SDK wraps it via `jsonSchema()`.
|
|
105
105
|
*/
|
|
106
106
|
export declare const ToolSchemaSchema: z.ZodObject<{
|
|
107
|
+
type: z.ZodLiteral<"function">;
|
|
107
108
|
name: z.ZodString;
|
|
108
109
|
description: z.ZodString;
|
|
109
110
|
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
110
111
|
}, z.core.$strip>;
|
|
111
112
|
/** Serialized tool schema — derived from {@link ToolSchemaSchema}. */
|
|
112
113
|
export type ToolSchema = {
|
|
114
|
+
type: "function";
|
|
113
115
|
name: string;
|
|
114
116
|
description: string;
|
|
115
117
|
parameters: JSONSchema7;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as toAgentConfig, i as agentToolsToSchemas, n as EMPTY_PARAMS, o as ProviderDescriptorSchema, r as ToolSchemaSchema, s as assertProviderTriple, t as AgentConfigSchema } from "../_internal-types-
|
|
1
|
+
import { a as toAgentConfig, i as agentToolsToSchemas, n as EMPTY_PARAMS, o as ProviderDescriptorSchema, r as ToolSchemaSchema, s as assertProviderTriple, t as AgentConfigSchema } from "../_internal-types-DFL07G3f.js";
|
|
2
2
|
export { AgentConfigSchema, EMPTY_PARAMS, ProviderDescriptorSchema, ToolSchemaSchema, agentToolsToSchemas, assertProviderTriple, toAgentConfig };
|
package/host/builtin-tools.ts
CHANGED
|
@@ -242,6 +242,7 @@ export function resolveAllBuiltins(
|
|
|
242
242
|
for (const [toolName, def] of resolveBuiltin(name, opts)) {
|
|
243
243
|
defs[toolName] = def;
|
|
244
244
|
schemas.push({
|
|
245
|
+
type: "function",
|
|
245
246
|
name: toolName,
|
|
246
247
|
description: def.description,
|
|
247
248
|
parameters: z.toJSONSchema(def.parameters ?? EMPTY_PARAMS) as ToolSchema["parameters"],
|
package/host/runtime.test.ts
CHANGED
|
@@ -322,7 +322,9 @@ describe("executeToolCall", () => {
|
|
|
322
322
|
describe("createRuntime sandbox mode", () => {
|
|
323
323
|
test("uses provided executeTool and toolSchemas", async () => {
|
|
324
324
|
const mockExecuteTool = vi.fn(async () => "mocked-result");
|
|
325
|
-
const mockToolSchemas = [
|
|
325
|
+
const mockToolSchemas = [
|
|
326
|
+
{ type: "function" as const, name: "mock_tool", description: "A mock tool", parameters: {} },
|
|
327
|
+
];
|
|
326
328
|
|
|
327
329
|
const runtime = createRuntime({
|
|
328
330
|
agent: makeAgent(),
|
|
@@ -6,6 +6,7 @@ import { toVercelTools } from "./to-vercel-tools.ts";
|
|
|
6
6
|
|
|
7
7
|
const schemas: ToolSchema[] = [
|
|
8
8
|
{
|
|
9
|
+
type: "function",
|
|
9
10
|
name: "get_weather",
|
|
10
11
|
description: "Look up the weather.",
|
|
11
12
|
parameters: {
|
|
@@ -166,7 +167,14 @@ describe("toVercelTools — message snapshot isolation", () => {
|
|
|
166
167
|
};
|
|
167
168
|
|
|
168
169
|
const tools = toVercelTools(
|
|
169
|
-
[
|
|
170
|
+
[
|
|
171
|
+
{
|
|
172
|
+
type: "function",
|
|
173
|
+
name: "t",
|
|
174
|
+
description: "",
|
|
175
|
+
parameters: { type: "object", properties: {} },
|
|
176
|
+
},
|
|
177
|
+
],
|
|
170
178
|
{
|
|
171
179
|
executeTool,
|
|
172
180
|
sessionId: "s",
|
|
@@ -282,6 +282,7 @@ describe("PipelineTransport", () => {
|
|
|
282
282
|
describe("streamText config plumbing", () => {
|
|
283
283
|
const dummyToolSchemas = [
|
|
284
284
|
{
|
|
285
|
+
type: "function" as const,
|
|
285
286
|
name: "noop",
|
|
286
287
|
description: "No-op tool for plumbing tests.",
|
|
287
288
|
parameters: { type: "object" as const, properties: {}, additionalProperties: false },
|
|
@@ -526,6 +527,7 @@ describe("PipelineTransport", () => {
|
|
|
526
527
|
executeTool,
|
|
527
528
|
toolSchemas: [
|
|
528
529
|
{
|
|
530
|
+
type: "function" as const,
|
|
529
531
|
name: "get_weather",
|
|
530
532
|
description: "Look up the weather.",
|
|
531
533
|
parameters: {
|
package/package.json
CHANGED
package/sdk/_internal-types.ts
CHANGED
|
@@ -128,6 +128,7 @@ export function toAgentConfig(src: AgentConfigSource): AgentConfig {
|
|
|
128
128
|
* etc.) — the Vercel AI SDK wraps it via `jsonSchema()`.
|
|
129
129
|
*/
|
|
130
130
|
export const ToolSchemaSchema = z.object({
|
|
131
|
+
type: z.literal("function"),
|
|
131
132
|
name: z.string().min(1),
|
|
132
133
|
description: z.string().min(1),
|
|
133
134
|
parameters: z.record(z.string(), z.unknown()),
|
|
@@ -135,6 +136,7 @@ export const ToolSchemaSchema = z.object({
|
|
|
135
136
|
|
|
136
137
|
/** Serialized tool schema — derived from {@link ToolSchemaSchema}. */
|
|
137
138
|
export type ToolSchema = {
|
|
139
|
+
type: "function";
|
|
138
140
|
name: string;
|
|
139
141
|
description: string;
|
|
140
142
|
parameters: JSONSchema7;
|
|
@@ -151,6 +153,7 @@ export const EMPTY_PARAMS = z.object({});
|
|
|
151
153
|
*/
|
|
152
154
|
export function agentToolsToSchemas(tools: Readonly<Record<string, ToolDef>>): ToolSchema[] {
|
|
153
155
|
return Object.entries(tools).map(([name, def]) => ({
|
|
156
|
+
type: "function",
|
|
154
157
|
name,
|
|
155
158
|
description: def.description,
|
|
156
159
|
parameters: z.toJSONSchema(def.parameters ?? EMPTY_PARAMS) as JSONSchema7,
|
|
@@ -65,6 +65,7 @@ describe("AgentConfigSchema", () => {
|
|
|
65
65
|
describe("ToolSchemaSchema", () => {
|
|
66
66
|
test("accepts valid tool schema", () => {
|
|
67
67
|
const valid = {
|
|
68
|
+
type: "function" as const,
|
|
68
69
|
name: "get_weather",
|
|
69
70
|
description: "Get weather",
|
|
70
71
|
parameters: { type: "object", properties: { city: { type: "string" } } },
|
|
@@ -73,15 +74,25 @@ describe("ToolSchemaSchema", () => {
|
|
|
73
74
|
});
|
|
74
75
|
|
|
75
76
|
test("rejects empty name", () => {
|
|
76
|
-
expect(
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
expect(
|
|
78
|
+
ToolSchemaSchema.safeParse({
|
|
79
|
+
type: "function",
|
|
80
|
+
name: "",
|
|
81
|
+
description: "d",
|
|
82
|
+
parameters: {},
|
|
83
|
+
}).success,
|
|
84
|
+
).toBe(false);
|
|
79
85
|
});
|
|
80
86
|
|
|
81
87
|
test("rejects empty description", () => {
|
|
82
|
-
expect(
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
expect(
|
|
89
|
+
ToolSchemaSchema.safeParse({
|
|
90
|
+
type: "function",
|
|
91
|
+
name: "n",
|
|
92
|
+
description: "",
|
|
93
|
+
parameters: {},
|
|
94
|
+
}).success,
|
|
95
|
+
).toBe(false);
|
|
85
96
|
});
|
|
86
97
|
|
|
87
98
|
test("ToolSchema is assignable from schema inference", () => {
|
|
@@ -89,6 +100,7 @@ describe("ToolSchemaSchema", () => {
|
|
|
89
100
|
// the runtime schema's Record<string, unknown>. Verify the direction:
|
|
90
101
|
// a parsed result should be assignable to ToolSchema (narrow → wide).
|
|
91
102
|
const parsed = ToolSchemaSchema.parse({
|
|
103
|
+
type: "function",
|
|
92
104
|
name: "test",
|
|
93
105
|
description: "test",
|
|
94
106
|
parameters: { type: "object" },
|