@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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @alexkroman1/aai@1.5.0 build /home/runner/work/agent/agent/packages/aai
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
  ℹ tsdown v0.21.7 powered by rolldown v1.0.0-rc.12
@@ -8,19 +8,19 @@
8
8
  ℹ target: node22
9
9
  ℹ tsconfig: tsconfig.json
10
10
  ℹ Build start
11
- ℹ dist/host/runtime-barrel.js 87.66 kB │ gzip: 25.35 kB
11
+ ℹ dist/host/runtime-barrel.js 87.68 kB │ gzip: 25.35 kB
12
12
  ℹ dist/sdk/protocol.js  4.75 kB │ gzip: 1.76 kB
13
13
  ℹ dist/index.js  2.88 kB │ gzip: 1.24 kB
14
14
  ℹ dist/sdk/manifest-barrel.js  0.36 kB │ gzip: 0.20 kB
15
15
  ℹ dist/sdk/providers/tts-barrel.js  0.26 kB │ gzip: 0.16 kB
16
16
  ℹ dist/sdk/providers/stt-barrel.js  0.19 kB │ gzip: 0.14 kB
17
17
  ℹ dist/sdk/providers/llm-barrel.js  0.12 kB │ gzip: 0.11 kB
18
+ ℹ dist/_internal-types-DFL07G3f.js  5.66 kB │ gzip: 2.10 kB
18
19
  ℹ dist/types-KUgezM6u.js  5.64 kB │ gzip: 2.39 kB
19
- ℹ dist/_internal-types-3p3OJZPb.js  5.61 kB │ gzip: 2.07 kB
20
20
  ℹ dist/constants-C2nirZUI.js  3.10 kB │ gzip: 1.38 kB
21
21
  ℹ dist/ws-upgrade-BeOQ7fXL.js  1.14 kB │ gzip: 0.54 kB
22
22
  ℹ dist/cartesia-BfQPOQ7Y.js  1.08 kB │ gzip: 0.50 kB
23
23
  ℹ dist/assemblyai-C969QGi4.js  1.03 kB │ gzip: 0.42 kB
24
24
  ℹ dist/anthropic-CcLZygAr.js  0.23 kB │ gzip: 0.18 kB
25
- ℹ 14 files, total: 114.04 kB
25
+ ℹ 14 files, total: 114.11 kB
26
26
  ✔ Build complete in 45ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @alexkroman1/aai
2
2
 
3
+ ## 1.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fbb3816: Add type: "function" to tool schemas in S2S session.update payload — AssemblyAI's S2S API rejects tool objects without it.
8
+
3
9
  ## 1.5.0
4
10
 
5
11
  ### Minor Changes
@@ -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-3p3OJZPb.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-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-3p3OJZPb.js";
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 };
@@ -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"],
@@ -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 = [{ name: "mock_tool", description: "A mock tool", parameters: {} }];
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
- [{ name: "t", description: "", parameters: { type: "object", properties: {} } }],
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexkroman1/aai",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -22,6 +22,7 @@ exports[`manifest schema shapes > ToolSchemaSchema shape 1`] = `
22
22
  "description",
23
23
  "name",
24
24
  "parameters",
25
+ "type",
25
26
  ]
26
27
  `;
27
28
 
@@ -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(ToolSchemaSchema.safeParse({ name: "", description: "d", parameters: {} }).success).toBe(
77
- false,
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(ToolSchemaSchema.safeParse({ name: "n", description: "", parameters: {} }).success).toBe(
83
- false,
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" },