@blazingagents/sdk 0.15.0 → 0.17.0

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.
Files changed (43) hide show
  1. package/dist/approvals.d.ts +15 -0
  2. package/dist/approvals.js +20 -0
  3. package/dist/chat-transport.js +9 -2
  4. package/dist/client.d.ts +6 -1
  5. package/dist/client.js +9 -1
  6. package/dist/contracts/api.d.ts +3 -3
  7. package/dist/contracts/api.js +1 -1
  8. package/dist/contracts/entities/agent-approval.d.ts +32 -0
  9. package/dist/contracts/entities/agent-approval.js +12 -1
  10. package/dist/contracts/entities/agent-tools.d.ts +6 -0
  11. package/dist/contracts/entities/agent-tools.js +13 -0
  12. package/dist/contracts/entities/agents.d.ts +2 -118
  13. package/dist/contracts/entities/agents.js +2 -24
  14. package/dist/contracts/entities/chat.d.ts +95 -24
  15. package/dist/contracts/entities/chat.js +105 -39
  16. package/dist/contracts/entities/providers.d.ts +2 -6
  17. package/dist/contracts/entities/providers.js +2 -9
  18. package/dist/contracts/entities/sessions.d.ts +112 -5
  19. package/dist/contracts/entities/sessions.js +7 -5
  20. package/dist/contracts/entities/tasks.d.ts +285 -10
  21. package/dist/contracts/entities/tasks.js +2 -5
  22. package/dist/contracts/ids.d.ts +1 -0
  23. package/dist/contracts/ids.js +1 -0
  24. package/dist/contracts/index.d.ts +8 -7
  25. package/dist/contracts/index.js +6 -5
  26. package/dist/contracts/limitations.d.ts +0 -2
  27. package/dist/contracts/limitations.js +0 -2
  28. package/dist/direct-chat-transport.d.ts +3 -1
  29. package/dist/direct-chat-transport.js +20 -23
  30. package/dist/functions.d.ts +38 -0
  31. package/dist/functions.js +299 -0
  32. package/dist/generation.d.ts +7 -1
  33. package/dist/generation.js +64 -20
  34. package/dist/index.d.ts +7 -4
  35. package/dist/index.js +3 -0
  36. package/dist/relay.d.ts +11 -5
  37. package/dist/relay.js +41 -3
  38. package/dist/resources/agents.js +1 -33
  39. package/dist/resources/providers.js +1 -1
  40. package/dist/resources/sessions.d.ts +1 -1
  41. package/dist/resources/sessions.js +9 -4
  42. package/dist/types.d.ts +22 -23
  43. package/package.json +1 -1
@@ -50,7 +50,6 @@ export type TaskScheduleInput = z.infer<typeof taskScheduleInputSchema>;
50
50
  */
51
51
  export declare const createTaskBodySchema: z.ZodObject<{
52
52
  agentId: z.ZodString;
53
- agentVersion: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
54
53
  name: z.ZodString;
55
54
  prompt: z.ZodString;
56
55
  schedule: z.ZodDefault<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -78,7 +77,6 @@ export declare const createTaskBodySchema: z.ZodObject<{
78
77
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
79
78
  }, z.core.$strict>;
80
79
  export declare const updateTaskBodySchema: z.ZodObject<{
81
- agentVersion: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
82
80
  name: z.ZodOptional<z.ZodString>;
83
81
  prompt: z.ZodOptional<z.ZodString>;
84
82
  schedule: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -123,7 +121,6 @@ export declare const taskSchema: z.ZodObject<{
123
121
  id: z.ZodString;
124
122
  tenantId: z.ZodString;
125
123
  agentId: z.ZodString;
126
- agentVersion: z.ZodNullable<z.ZodNumber>;
127
124
  name: z.ZodString;
128
125
  prompt: z.ZodString;
129
126
  schedule: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -170,7 +167,6 @@ export declare const taskListItemSchema: z.ZodObject<{
170
167
  id: z.ZodString;
171
168
  tenantId: z.ZodString;
172
169
  agentId: z.ZodString;
173
- agentVersion: z.ZodNullable<z.ZodNumber>;
174
170
  name: z.ZodString;
175
171
  prompt: z.ZodString;
176
172
  schedule: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -218,7 +214,6 @@ export declare const tasksListResponseSchema: z.ZodObject<{
218
214
  id: z.ZodString;
219
215
  tenantId: z.ZodString;
220
216
  agentId: z.ZodString;
221
- agentVersion: z.ZodNullable<z.ZodNumber>;
222
217
  name: z.ZodString;
223
218
  prompt: z.ZodString;
224
219
  schedule: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -272,7 +267,6 @@ export declare const taskResponseSchema: z.ZodObject<{
272
267
  id: z.ZodString;
273
268
  tenantId: z.ZodString;
274
269
  agentId: z.ZodString;
275
- agentVersion: z.ZodNullable<z.ZodNumber>;
276
270
  name: z.ZodString;
277
271
  prompt: z.ZodString;
278
272
  schedule: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -312,7 +306,101 @@ export declare const taskRunSchema: z.ZodObject<{
312
306
  taskId: z.ZodString;
313
307
  tenantId: z.ZodString;
314
308
  agentId: z.ZodString;
315
- agentVersion: z.ZodNumber;
309
+ agentConfig: z.ZodObject<{
310
+ approvalInChat: z.ZodDefault<z.ZodObject<{
311
+ default: z.ZodEnum<{
312
+ auto: "auto";
313
+ deny: "deny";
314
+ full: "full";
315
+ manual: "manual";
316
+ }>;
317
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
318
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
319
+ type: z.ZodLiteral<"builtin">;
320
+ name: z.ZodEnum<{
321
+ activate_skill: "activate_skill";
322
+ bash: "bash";
323
+ delete_memory: "delete_memory";
324
+ edit: "edit";
325
+ get_memory: "get_memory";
326
+ glob: "glob";
327
+ grep: "grep";
328
+ publish_artifacts: "publish_artifacts";
329
+ read: "read";
330
+ save_memory: "save_memory";
331
+ search_memories: "search_memories";
332
+ update_memory: "update_memory";
333
+ write: "write";
334
+ write_todos: "write_todos";
335
+ }>;
336
+ }, z.core.$strict>, z.ZodObject<{
337
+ type: z.ZodLiteral<"mcp">;
338
+ connectionId: z.ZodString;
339
+ name: z.ZodString;
340
+ }, z.core.$strict>], "type">;
341
+ decision: z.ZodEnum<{
342
+ auto: "auto";
343
+ deny: "deny";
344
+ full: "full";
345
+ manual: "manual";
346
+ }>;
347
+ }, z.core.$strict>>>;
348
+ }, z.core.$strict>>;
349
+ approvalInTasks: z.ZodDefault<z.ZodObject<{
350
+ default: z.ZodEnum<{
351
+ auto: "auto";
352
+ deny: "deny";
353
+ full: "full";
354
+ manual: "manual";
355
+ }>;
356
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
357
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
358
+ type: z.ZodLiteral<"builtin">;
359
+ name: z.ZodEnum<{
360
+ activate_skill: "activate_skill";
361
+ bash: "bash";
362
+ delete_memory: "delete_memory";
363
+ edit: "edit";
364
+ get_memory: "get_memory";
365
+ glob: "glob";
366
+ grep: "grep";
367
+ publish_artifacts: "publish_artifacts";
368
+ read: "read";
369
+ save_memory: "save_memory";
370
+ search_memories: "search_memories";
371
+ update_memory: "update_memory";
372
+ write: "write";
373
+ write_todos: "write_todos";
374
+ }>;
375
+ }, z.core.$strict>, z.ZodObject<{
376
+ type: z.ZodLiteral<"mcp">;
377
+ connectionId: z.ZodString;
378
+ name: z.ZodString;
379
+ }, z.core.$strict>], "type">;
380
+ decision: z.ZodEnum<{
381
+ auto: "auto";
382
+ deny: "deny";
383
+ full: "full";
384
+ manual: "manual";
385
+ }>;
386
+ }, z.core.$strict>>>;
387
+ }, z.core.$strict>>;
388
+ name: z.ZodString;
389
+ model: z.ZodNullable<z.ZodString>;
390
+ thinkingLevel: z.ZodNullable<z.ZodString>;
391
+ providerId: z.ZodNullable<z.ZodString>;
392
+ autoCompaction: z.ZodBoolean;
393
+ compactionReserveTokens: z.ZodNumber;
394
+ memoryInjectionEnabled: z.ZodBoolean;
395
+ tools: z.ZodArray<z.ZodEnum<{
396
+ memory: "memory";
397
+ workspace: "workspace";
398
+ write_todos: "write_todos";
399
+ }>>;
400
+ instructions: z.ZodString;
401
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
402
+ mcpConnectionIds: z.ZodArray<z.ZodString>;
403
+ }, z.core.$strip>;
316
404
  sessionId: z.ZodNullable<z.ZodString>;
317
405
  turnId: z.ZodNullable<z.ZodString>;
318
406
  status: z.ZodEnum<{
@@ -338,7 +426,101 @@ export declare const taskRunResponseSchema: z.ZodObject<{
338
426
  taskId: z.ZodString;
339
427
  tenantId: z.ZodString;
340
428
  agentId: z.ZodString;
341
- agentVersion: z.ZodNumber;
429
+ agentConfig: z.ZodObject<{
430
+ approvalInChat: z.ZodDefault<z.ZodObject<{
431
+ default: z.ZodEnum<{
432
+ auto: "auto";
433
+ deny: "deny";
434
+ full: "full";
435
+ manual: "manual";
436
+ }>;
437
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
438
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
439
+ type: z.ZodLiteral<"builtin">;
440
+ name: z.ZodEnum<{
441
+ activate_skill: "activate_skill";
442
+ bash: "bash";
443
+ delete_memory: "delete_memory";
444
+ edit: "edit";
445
+ get_memory: "get_memory";
446
+ glob: "glob";
447
+ grep: "grep";
448
+ publish_artifacts: "publish_artifacts";
449
+ read: "read";
450
+ save_memory: "save_memory";
451
+ search_memories: "search_memories";
452
+ update_memory: "update_memory";
453
+ write: "write";
454
+ write_todos: "write_todos";
455
+ }>;
456
+ }, z.core.$strict>, z.ZodObject<{
457
+ type: z.ZodLiteral<"mcp">;
458
+ connectionId: z.ZodString;
459
+ name: z.ZodString;
460
+ }, z.core.$strict>], "type">;
461
+ decision: z.ZodEnum<{
462
+ auto: "auto";
463
+ deny: "deny";
464
+ full: "full";
465
+ manual: "manual";
466
+ }>;
467
+ }, z.core.$strict>>>;
468
+ }, z.core.$strict>>;
469
+ approvalInTasks: z.ZodDefault<z.ZodObject<{
470
+ default: z.ZodEnum<{
471
+ auto: "auto";
472
+ deny: "deny";
473
+ full: "full";
474
+ manual: "manual";
475
+ }>;
476
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
477
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
478
+ type: z.ZodLiteral<"builtin">;
479
+ name: z.ZodEnum<{
480
+ activate_skill: "activate_skill";
481
+ bash: "bash";
482
+ delete_memory: "delete_memory";
483
+ edit: "edit";
484
+ get_memory: "get_memory";
485
+ glob: "glob";
486
+ grep: "grep";
487
+ publish_artifacts: "publish_artifacts";
488
+ read: "read";
489
+ save_memory: "save_memory";
490
+ search_memories: "search_memories";
491
+ update_memory: "update_memory";
492
+ write: "write";
493
+ write_todos: "write_todos";
494
+ }>;
495
+ }, z.core.$strict>, z.ZodObject<{
496
+ type: z.ZodLiteral<"mcp">;
497
+ connectionId: z.ZodString;
498
+ name: z.ZodString;
499
+ }, z.core.$strict>], "type">;
500
+ decision: z.ZodEnum<{
501
+ auto: "auto";
502
+ deny: "deny";
503
+ full: "full";
504
+ manual: "manual";
505
+ }>;
506
+ }, z.core.$strict>>>;
507
+ }, z.core.$strict>>;
508
+ name: z.ZodString;
509
+ model: z.ZodNullable<z.ZodString>;
510
+ thinkingLevel: z.ZodNullable<z.ZodString>;
511
+ providerId: z.ZodNullable<z.ZodString>;
512
+ autoCompaction: z.ZodBoolean;
513
+ compactionReserveTokens: z.ZodNumber;
514
+ memoryInjectionEnabled: z.ZodBoolean;
515
+ tools: z.ZodArray<z.ZodEnum<{
516
+ memory: "memory";
517
+ workspace: "workspace";
518
+ write_todos: "write_todos";
519
+ }>>;
520
+ instructions: z.ZodString;
521
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
522
+ mcpConnectionIds: z.ZodArray<z.ZodString>;
523
+ }, z.core.$strip>;
342
524
  sessionId: z.ZodNullable<z.ZodString>;
343
525
  turnId: z.ZodNullable<z.ZodString>;
344
526
  status: z.ZodEnum<{
@@ -365,7 +547,101 @@ export declare const taskRunsListResponseSchema: z.ZodObject<{
365
547
  taskId: z.ZodString;
366
548
  tenantId: z.ZodString;
367
549
  agentId: z.ZodString;
368
- agentVersion: z.ZodNumber;
550
+ agentConfig: z.ZodObject<{
551
+ approvalInChat: z.ZodDefault<z.ZodObject<{
552
+ default: z.ZodEnum<{
553
+ auto: "auto";
554
+ deny: "deny";
555
+ full: "full";
556
+ manual: "manual";
557
+ }>;
558
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
559
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
560
+ type: z.ZodLiteral<"builtin">;
561
+ name: z.ZodEnum<{
562
+ activate_skill: "activate_skill";
563
+ bash: "bash";
564
+ delete_memory: "delete_memory";
565
+ edit: "edit";
566
+ get_memory: "get_memory";
567
+ glob: "glob";
568
+ grep: "grep";
569
+ publish_artifacts: "publish_artifacts";
570
+ read: "read";
571
+ save_memory: "save_memory";
572
+ search_memories: "search_memories";
573
+ update_memory: "update_memory";
574
+ write: "write";
575
+ write_todos: "write_todos";
576
+ }>;
577
+ }, z.core.$strict>, z.ZodObject<{
578
+ type: z.ZodLiteral<"mcp">;
579
+ connectionId: z.ZodString;
580
+ name: z.ZodString;
581
+ }, z.core.$strict>], "type">;
582
+ decision: z.ZodEnum<{
583
+ auto: "auto";
584
+ deny: "deny";
585
+ full: "full";
586
+ manual: "manual";
587
+ }>;
588
+ }, z.core.$strict>>>;
589
+ }, z.core.$strict>>;
590
+ approvalInTasks: z.ZodDefault<z.ZodObject<{
591
+ default: z.ZodEnum<{
592
+ auto: "auto";
593
+ deny: "deny";
594
+ full: "full";
595
+ manual: "manual";
596
+ }>;
597
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
598
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
599
+ type: z.ZodLiteral<"builtin">;
600
+ name: z.ZodEnum<{
601
+ activate_skill: "activate_skill";
602
+ bash: "bash";
603
+ delete_memory: "delete_memory";
604
+ edit: "edit";
605
+ get_memory: "get_memory";
606
+ glob: "glob";
607
+ grep: "grep";
608
+ publish_artifacts: "publish_artifacts";
609
+ read: "read";
610
+ save_memory: "save_memory";
611
+ search_memories: "search_memories";
612
+ update_memory: "update_memory";
613
+ write: "write";
614
+ write_todos: "write_todos";
615
+ }>;
616
+ }, z.core.$strict>, z.ZodObject<{
617
+ type: z.ZodLiteral<"mcp">;
618
+ connectionId: z.ZodString;
619
+ name: z.ZodString;
620
+ }, z.core.$strict>], "type">;
621
+ decision: z.ZodEnum<{
622
+ auto: "auto";
623
+ deny: "deny";
624
+ full: "full";
625
+ manual: "manual";
626
+ }>;
627
+ }, z.core.$strict>>>;
628
+ }, z.core.$strict>>;
629
+ name: z.ZodString;
630
+ model: z.ZodNullable<z.ZodString>;
631
+ thinkingLevel: z.ZodNullable<z.ZodString>;
632
+ providerId: z.ZodNullable<z.ZodString>;
633
+ autoCompaction: z.ZodBoolean;
634
+ compactionReserveTokens: z.ZodNumber;
635
+ memoryInjectionEnabled: z.ZodBoolean;
636
+ tools: z.ZodArray<z.ZodEnum<{
637
+ memory: "memory";
638
+ workspace: "workspace";
639
+ write_todos: "write_todos";
640
+ }>>;
641
+ instructions: z.ZodString;
642
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
643
+ mcpConnectionIds: z.ZodArray<z.ZodString>;
644
+ }, z.core.$strip>;
369
645
  sessionId: z.ZodNullable<z.ZodString>;
370
646
  turnId: z.ZodNullable<z.ZodString>;
371
647
  status: z.ZodEnum<{
@@ -393,7 +669,6 @@ export declare const createTaskResponseSchema: z.ZodObject<{
393
669
  id: z.ZodString;
394
670
  tenantId: z.ZodString;
395
671
  agentId: z.ZodString;
396
- agentVersion: z.ZodNullable<z.ZodNumber>;
397
672
  name: z.ZodString;
398
673
  prompt: z.ZodString;
399
674
  schedule: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -4,7 +4,7 @@ import { paginatedResponseSchema } from "../api.js";
4
4
  import { agentIdSchema, sessionIdSchema, taskIdSchema, taskRunIdSchema, tenantIdSchema, turnIdSchema, } from "../ids.js";
5
5
  import { MAX_TASK_NAME_LENGTH, MAX_TASK_PROMPT_LENGTH, MIN_TASK_INTERVAL_MS, } from "../limitations.js";
6
6
  import { atLeastOneFieldMessage, hasObjectKeys } from "../utils.js";
7
- import { agentVersionNumberSchema } from "./agents.js";
7
+ import { agentConfigSchema } from "./agents.js";
8
8
  import { metadataSchema, userIdSchema } from "./attribution.js";
9
9
  import { sessionMessagesResponseSchema } from "./sessions.js";
10
10
  /**
@@ -113,7 +113,6 @@ const taskPromptSchema = z.string().trim().min(1).max(MAX_TASK_PROMPT_LENGTH);
113
113
  export const createTaskBodySchema = z
114
114
  .object({
115
115
  agentId: agentIdSchema,
116
- agentVersion: agentVersionNumberSchema.nullable().default(null),
117
116
  name: taskNameSchema,
118
117
  prompt: taskPromptSchema,
119
118
  schedule: taskScheduleInputSchema.nullable().default(null),
@@ -127,7 +126,6 @@ export const createTaskBodySchema = z
127
126
  // `PATCH /v1/tasks/{taskId}` — `agentId` and `userId` are immutable.
128
127
  export const updateTaskBodySchema = z
129
128
  .object({
130
- agentVersion: agentVersionNumberSchema.nullable().optional(),
131
129
  name: taskNameSchema.optional(),
132
130
  prompt: taskPromptSchema.optional(),
133
131
  schedule: taskScheduleInputSchema.nullable().optional(),
@@ -173,7 +171,6 @@ export const taskSchema = z
173
171
  id: taskIdSchema,
174
172
  tenantId: tenantIdSchema,
175
173
  agentId: agentIdSchema,
176
- agentVersion: agentVersionNumberSchema.nullable(),
177
174
  name: taskNameSchema,
178
175
  prompt: taskPromptSchema,
179
176
  schedule: taskScheduleResponseSchema.nullable(),
@@ -218,7 +215,7 @@ export const taskRunSchema = z
218
215
  taskId: taskIdSchema,
219
216
  tenantId: tenantIdSchema,
220
217
  agentId: agentIdSchema,
221
- agentVersion: agentVersionNumberSchema,
218
+ agentConfig: agentConfigSchema,
222
219
  sessionId: sessionIdSchema.nullable(),
223
220
  turnId: turnIdSchema.nullable(),
224
221
  status: taskRunStatusSchema,
@@ -46,6 +46,7 @@ export declare const promptIdSchema: z.ZodString;
46
46
  export declare const requestIdSchema: z.ZodString;
47
47
  export declare const checkoutAttemptIdSchema: z.ZodString;
48
48
  export declare const turnIdSchema: z.ZodString;
49
+ export declare const functionCallIdSchema: z.ZodString;
49
50
  export declare const skillIdSchema: z.ZodString;
50
51
  /**
51
52
  * API key token + digest helpers. The digest is sha256 hex (64 chars); the
@@ -72,6 +72,7 @@ export const promptIdSchema = z.string().regex(/^prompt_[0-9A-Za-z]{16}$/);
72
72
  export const requestIdSchema = z.string().regex(/^req_[0-9A-Za-z]{16}$/);
73
73
  export const checkoutAttemptIdSchema = z.string().regex(/^ca_[0-9A-Za-z]{16}$/);
74
74
  export const turnIdSchema = z.string().regex(/^turn_[0-9A-Za-z]{16}$/);
75
+ export const functionCallIdSchema = z.string().regex(/^fc_[0-9A-Za-z]{16}$/);
75
76
  export const skillIdSchema = z.string().regex(/^skill_[0-9A-Za-z]{16}$/);
76
77
  /**
77
78
  * API key token + digest helpers. The digest is sha256 hex (64 chars); the
@@ -1,12 +1,13 @@
1
1
  /** Public runtime schemas for the Blazing Agents HTTP API. */
2
2
  export { receivedApiErrorResponseSchema } from "./api.ts";
3
- export type { ApprovalDecision, ApprovalPolicy, ToolReference, } from "./entities/agent-approval.ts";
4
- export { approvalDecisionSchema, approvalPolicySchema, toolReferenceSchema, } from "./entities/agent-approval.ts";
5
- export { agentResponseSchema, agentSchema, agentStatusSchema, agentsListQuerySchema, agentsResponseSchema, agentVersionSchema, agentVersionsResponseSchema, createAgentBodySchema, updateAgentBodySchema, } from "./entities/agents.ts";
3
+ export type { ApprovalDecision, ApprovalPolicy, ToolExecutionReference, ToolReference, } from "./entities/agent-approval.ts";
4
+ export { approvalDecisionSchema, approvalPolicySchema, toolExecutionReferenceSchema, toolReferenceSchema, } from "./entities/agent-approval.ts";
5
+ export { chatFunctionNameSchema } from "./entities/agent-tools.ts";
6
+ export { agentConfigSchema, agentResponseSchema, agentSchema, agentStatusSchema, agentsListQuerySchema, agentsResponseSchema, createAgentBodySchema, updateAgentBodySchema, } from "./entities/agents.ts";
6
7
  export { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsListResponseSchema, } from "./entities/artifacts.ts";
7
8
  export { attributionCreateInputSchema, metadataSchema, } from "./entities/attribution.ts";
8
- export type { PromptVariables, UsageSummary } from "./entities/chat.ts";
9
- export { blazingAgentsChatMessageMetadataSchema, chatModeSchema, chatRequestBodySchema, chatTriggerSchema, generationRequestBodySchema, jsonSchemaShapeSchema, promptVariablesSchema, usageSummarySchema, } from "./entities/chat.ts";
9
+ export type { ChatFunctionCallEvent, ChatFunctionDefinition, ChatFunctionDefinitions, ChatFunctionOutcome, ClaimChatFunctionBody, PromptVariables, ResolveChatFunctionBody, UsageSummary, } from "./entities/chat.ts";
10
+ export { blazingAgentsChatMessageMetadataSchema, chatFunctionCallEventSchema, chatFunctionDefinitionSchema, chatFunctionDefinitionsSchema, chatFunctionOutcomeSchema, chatModeSchema, chatRequestBodySchema, chatTriggerSchema, claimChatFunctionBodySchema, claimChatFunctionResponseSchema, generationRequestBodySchema, jsonSchemaShapeSchema, MAX_CHAT_FUNCTION_DEFINITIONS_BYTES, MAX_CHAT_FUNCTION_PAYLOAD_BYTES, MAX_CHAT_FUNCTIONS, promptVariablesSchema, resolveChatFunctionBodySchema, resolveChatFunctionResponseSchema, resumeToolApprovalContinuationBodySchema, usageSummarySchema, } from "./entities/chat.ts";
10
11
  export { chatConfigurationSchema, chatConnectionSchema, chatConnectionsResponseSchema, chatCredentialsSchema, chatDeliveriesResponseSchema, chatDeliveryListStatusSchema, chatDeliverySchema, chatDeliveryStatusSchema, chatHealthCheckSchema, chatHealthSchema, chatIdentitySchema, createChatConnectionBodySchema, rotateChatConnectionBodySchema, tenantChatDeliverySchema, updateChatConnectionBodySchema, } from "./entities/chat-connections.ts";
11
12
  export { approveMcpOauthAuthorizationBodySchema, createMcpConnectionBodySchema, mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, mcpConnectionAuthTypeSchema, mcpConnectionOauthConnectResponseSchema, mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionStatusSchema, mcpConnectionsResponseSchema, mcpConnectionTestErrorCodeSchema, mcpConnectionTestResponseSchema, mcpOauthAuthorizationLaunchResponseSchema, reconnectMcpConnectionBodySchema, updateMcpAttachmentBodySchema, updateMcpConnectionBodySchema, } from "./entities/mcp-connections.ts";
12
13
  export { createMemoryBodySchema, memoriesListResponseSchema, memoryResponseSchema, memorySchema, updateMemoryBodySchema, } from "./entities/memories.ts";
@@ -14,11 +15,11 @@ export { createMerchantConnectionBodySchema, merchantBindingResponseSchema, merc
14
15
  export { createPromptBodySchema, parsePromptVariables, promptResponseSchema, promptSchema, promptsListQuerySchema, promptsResponseSchema, promptTemplateSchema, renderPromptTemplate, updatePromptBodySchema, } from "./entities/prompts.ts";
15
16
  export { createProviderBodySchema, providerListItemSchema, providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, providerTypeSchema, thinkingLevelsResponseSchema, updateProviderBodySchema, } from "./entities/providers.ts";
16
17
  export type { ToolApprovalDecisionResponse, ToolApprovalsResponse, } from "./entities/sessions.ts";
17
- export { decideToolApprovalBodySchema, latestSessionListItemSchema, latestSessionsListResponseSchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionResponseSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.ts";
18
+ export { decideToolApprovalBodySchema, latestSessionListItemSchema, latestSessionsListResponseSchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionResponseSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.ts";
18
19
  export { copySkillBodySchema, createSkillBodySchema, skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "./entities/skills.ts";
19
20
  export { createTaskBodySchema, createTaskResponseSchema, createTaskRunBodySchema, createTaskRunResponseSchema, taskCronConfigSchema, taskIntervalConfigSchema, taskListItemSchema, taskOnceConfigSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunSchema, taskRunStatusSchema, taskRunsListResponseSchema, taskScheduleInputSchema, taskScheduleKindSchema, taskSchema, tasksListResponseSchema, updateTaskBodySchema, } from "./entities/tasks.ts";
20
21
  export { quotaSchema, subscriptionStatusSchema, tenantDeletionSchema, tenantResponseSchema, tenantSchema, tenantSettingsResponseSchema, updateTenantSettingsBodySchema, } from "./entities/tenants.ts";
21
22
  export type { SessionUsageQuery, SessionUsageResponse, UsageBucket, UsageOverviewQuery, UsageOverviewResponse, UsageResponse, UsageTotals, } from "./entities/usage.ts";
22
23
  export { sessionUsageQuerySchema, sessionUsageResponseSchema, usageOverviewQuerySchema, usageOverviewResponseSchema, usageResponseSchema, } from "./entities/usage.ts";
23
24
  export { createWorkspaceBodySchema, updateWorkspaceBodySchema, workspaceSchema, workspacesListResponseSchema, } from "./entities/workspaces.ts";
24
- export { agentIdSchema, apiKeyTokenSchema, isAdminAgentId, promptIdSchema, sessionIdSchema, } from "./ids.ts";
25
+ export { agentIdSchema, apiKeyTokenSchema, functionCallIdSchema, isAdminAgentId, promptIdSchema, sessionIdSchema, } from "./ids.ts";
@@ -1,21 +1,22 @@
1
1
  /** Public runtime schemas for the Blazing Agents HTTP API. */
2
2
  // biome-ignore lint/performance/noBarrelFile: public contract entry point
3
3
  export { receivedApiErrorResponseSchema } from "./api.js";
4
- export { approvalDecisionSchema, approvalPolicySchema, toolReferenceSchema, } from "./entities/agent-approval.js";
5
- export { agentResponseSchema, agentSchema, agentStatusSchema, agentsListQuerySchema, agentsResponseSchema, agentVersionSchema, agentVersionsResponseSchema, createAgentBodySchema, updateAgentBodySchema, } from "./entities/agents.js";
4
+ export { approvalDecisionSchema, approvalPolicySchema, toolExecutionReferenceSchema, toolReferenceSchema, } from "./entities/agent-approval.js";
5
+ export { chatFunctionNameSchema } from "./entities/agent-tools.js";
6
+ export { agentConfigSchema, agentResponseSchema, agentSchema, agentStatusSchema, agentsListQuerySchema, agentsResponseSchema, createAgentBodySchema, updateAgentBodySchema, } from "./entities/agents.js";
6
7
  export { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsListResponseSchema, } from "./entities/artifacts.js";
7
8
  export { attributionCreateInputSchema, metadataSchema, } from "./entities/attribution.js";
8
- export { blazingAgentsChatMessageMetadataSchema, chatModeSchema, chatRequestBodySchema, chatTriggerSchema, generationRequestBodySchema, jsonSchemaShapeSchema, promptVariablesSchema, usageSummarySchema, } from "./entities/chat.js";
9
+ export { blazingAgentsChatMessageMetadataSchema, chatFunctionCallEventSchema, chatFunctionDefinitionSchema, chatFunctionDefinitionsSchema, chatFunctionOutcomeSchema, chatModeSchema, chatRequestBodySchema, chatTriggerSchema, claimChatFunctionBodySchema, claimChatFunctionResponseSchema, generationRequestBodySchema, jsonSchemaShapeSchema, MAX_CHAT_FUNCTION_DEFINITIONS_BYTES, MAX_CHAT_FUNCTION_PAYLOAD_BYTES, MAX_CHAT_FUNCTIONS, promptVariablesSchema, resolveChatFunctionBodySchema, resolveChatFunctionResponseSchema, resumeToolApprovalContinuationBodySchema, usageSummarySchema, } from "./entities/chat.js";
9
10
  export { chatConfigurationSchema, chatConnectionSchema, chatConnectionsResponseSchema, chatCredentialsSchema, chatDeliveriesResponseSchema, chatDeliveryListStatusSchema, chatDeliverySchema, chatDeliveryStatusSchema, chatHealthCheckSchema, chatHealthSchema, chatIdentitySchema, createChatConnectionBodySchema, rotateChatConnectionBodySchema, tenantChatDeliverySchema, updateChatConnectionBodySchema, } from "./entities/chat-connections.js";
10
11
  export { approveMcpOauthAuthorizationBodySchema, createMcpConnectionBodySchema, mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, mcpConnectionAuthTypeSchema, mcpConnectionOauthConnectResponseSchema, mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionStatusSchema, mcpConnectionsResponseSchema, mcpConnectionTestErrorCodeSchema, mcpConnectionTestResponseSchema, mcpOauthAuthorizationLaunchResponseSchema, reconnectMcpConnectionBodySchema, updateMcpAttachmentBodySchema, updateMcpConnectionBodySchema, } from "./entities/mcp-connections.js";
11
12
  export { createMemoryBodySchema, memoriesListResponseSchema, memoryResponseSchema, memorySchema, updateMemoryBodySchema, } from "./entities/memories.js";
12
13
  export { createMerchantConnectionBodySchema, merchantBindingResponseSchema, merchantBindingsResponseSchema, merchantConnectionResponseSchema, merchantConnectionSchema, merchantConnectionStatusSchema, merchantCustomerBindingSchema, merchantEnvironmentSchema, merchantGuardSchema, merchantProviderSchema, merchantUsageEventNextAction, merchantUsageEventNextActionSchema, merchantUsageEventSchema, merchantUsageEventStatusSchema, merchantUsageEventsResponseSchema, merchantUsageSummaryQuerySchema, merchantUsageSummaryResponseSchema, merchantUsageSummarySchema, merchantWorkflowIssueSchema, updateMerchantConnectionBodySchema, upsertMerchantBindingBodySchema, } from "./entities/merchant.js";
13
14
  export { createPromptBodySchema, parsePromptVariables, promptResponseSchema, promptSchema, promptsListQuerySchema, promptsResponseSchema, promptTemplateSchema, renderPromptTemplate, updatePromptBodySchema, } from "./entities/prompts.js";
14
15
  export { createProviderBodySchema, providerListItemSchema, providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, providerTypeSchema, thinkingLevelsResponseSchema, updateProviderBodySchema, } from "./entities/providers.js";
15
- export { decideToolApprovalBodySchema, latestSessionListItemSchema, latestSessionsListResponseSchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionResponseSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.js";
16
+ export { decideToolApprovalBodySchema, latestSessionListItemSchema, latestSessionsListResponseSchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionResponseSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.js";
16
17
  export { copySkillBodySchema, createSkillBodySchema, skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "./entities/skills.js";
17
18
  export { createTaskBodySchema, createTaskResponseSchema, createTaskRunBodySchema, createTaskRunResponseSchema, taskCronConfigSchema, taskIntervalConfigSchema, taskListItemSchema, taskOnceConfigSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunSchema, taskRunStatusSchema, taskRunsListResponseSchema, taskScheduleInputSchema, taskScheduleKindSchema, taskSchema, tasksListResponseSchema, updateTaskBodySchema, } from "./entities/tasks.js";
18
19
  export { quotaSchema, subscriptionStatusSchema, tenantDeletionSchema, tenantResponseSchema, tenantSchema, tenantSettingsResponseSchema, updateTenantSettingsBodySchema, } from "./entities/tenants.js";
19
20
  export { sessionUsageQuerySchema, sessionUsageResponseSchema, usageOverviewQuerySchema, usageOverviewResponseSchema, usageResponseSchema, } from "./entities/usage.js";
20
21
  export { createWorkspaceBodySchema, updateWorkspaceBodySchema, workspaceSchema, workspacesListResponseSchema, } from "./entities/workspaces.js";
21
- export { agentIdSchema, apiKeyTokenSchema, isAdminAgentId, promptIdSchema, sessionIdSchema, } from "./ids.js";
22
+ export { agentIdSchema, apiKeyTokenSchema, functionCallIdSchema, isAdminAgentId, promptIdSchema, sessionIdSchema, } from "./ids.js";
@@ -74,8 +74,6 @@ export declare const MAX_AGENT_NAME_LENGTH = 80;
74
74
  export declare const DEFAULT_AGENTS_LIST_LIMIT = 50;
75
75
  export declare const MAX_AGENTS_LIST_LIMIT = 100;
76
76
  export declare const MAX_AGENT_INSTRUCTIONS_LENGTH = 3000;
77
- export declare const DEFAULT_AGENT_VERSIONS_LIST_LIMIT = 50;
78
- export declare const MAX_AGENT_VERSIONS_LIST_LIMIT = 200;
79
77
  /**
80
78
  * Artifacts — 10 MiB per file, 10 publications per Tool call, and 100
81
79
  * Artifacts per Session.
@@ -75,8 +75,6 @@ export const MAX_AGENT_NAME_LENGTH = 80;
75
75
  export const DEFAULT_AGENTS_LIST_LIMIT = 50;
76
76
  export const MAX_AGENTS_LIST_LIMIT = 100;
77
77
  export const MAX_AGENT_INSTRUCTIONS_LENGTH = 3000;
78
- export const DEFAULT_AGENT_VERSIONS_LIST_LIMIT = 50;
79
- export const MAX_AGENT_VERSIONS_LIST_LIMIT = 200;
80
78
  /**
81
79
  * Artifacts — 10 MiB per file, 10 publications per Tool call, and 100
82
80
  * Artifacts per Session.
@@ -1,14 +1,16 @@
1
1
  import { type ChatTransport, DefaultChatTransport, type UIMessage } from "ai";
2
2
  import type { BlazingAgents } from "./client.ts";
3
+ import type { ChatFunctions } from "./functions.ts";
3
4
  export type BlazingAgentsDirectChatTransportOptions = {
4
5
  agentId: string;
6
+ /** Caller-local functions for every Turn and approved continuation of this chat. */
7
+ functions?: ChatFunctions;
5
8
  getClient: () => BlazingAgents | Promise<BlazingAgents>;
6
9
  metadata?: Record<string, unknown>;
7
10
  /** Receives the Session ID before the response stream is consumed. */
8
11
  onSessionId?: (sessionId: string) => Promise<void> | void;
9
12
  sessionId?: string;
10
13
  userId?: string;
11
- version?: number;
12
14
  } & ({
13
15
  promptId: string;
14
16
  variables?: Record<string, string>;
@@ -1,4 +1,5 @@
1
- import { DefaultChatTransport, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, } from "ai";
1
+ import { DefaultChatTransport, lastAssistantMessageIsCompleteWithApprovalResponses, } from "ai";
2
+ import { decideApprovalResponses } from "./approvals.js";
2
3
  import { sessionIdSchema } from "./contracts/ids.js";
3
4
  /** Connects useChat directly to the SDK, including native streaming fetch clients. */
4
5
  export class BlazingAgentsDirectChatTransport extends DefaultChatTransport {
@@ -26,6 +27,7 @@ export class BlazingAgentsDirectChatTransport extends DefaultChatTransport {
26
27
  const client = await this.#options.getClient();
27
28
  const common = {
28
29
  agentId: this.#options.agentId,
30
+ functions: this.#options.functions,
29
31
  messageId: input.messageId,
30
32
  abortSignal: input.abortSignal,
31
33
  };
@@ -34,7 +36,6 @@ export class BlazingAgentsDirectChatTransport extends DefaultChatTransport {
34
36
  const create = {
35
37
  ...common,
36
38
  trigger: "submit-message",
37
- version: this.#options.version,
38
39
  userId: this.#options.userId,
39
40
  metadata: this.#options.metadata,
40
41
  };
@@ -83,17 +84,19 @@ export class BlazingAgentsDirectChatTransport extends DefaultChatTransport {
83
84
  if (this.#sessionId === undefined) {
84
85
  return null;
85
86
  }
86
- const { continuation } = await (await this.#options.getClient()).sessions.toolApprovals({
87
+ const client = await this.#options.getClient();
88
+ const { continuation } = await client.sessions.toolApprovals({
87
89
  agentId: this.#options.agentId,
88
90
  sessionId: this.#sessionId,
89
91
  });
90
92
  if (continuation?.state !== "queued" && continuation?.state !== "running") {
91
93
  return null;
92
94
  }
93
- const result = await (await this.#options.getClient()).sessions.joinToolApprovalContinuation({
95
+ const result = await client.resumeChat({
94
96
  agentId: this.#options.agentId,
95
97
  sessionId: this.#sessionId,
96
98
  continuationId: continuation.id,
99
+ functions: this.#options.functions ?? {},
97
100
  });
98
101
  return this.processResponseStream(result.toStream());
99
102
  }
@@ -101,29 +104,23 @@ export class BlazingAgentsDirectChatTransport extends DefaultChatTransport {
101
104
  if (this.#sessionId === undefined) {
102
105
  throw new Error("Tool approval requires an existing Session.");
103
106
  }
104
- const lastStep = last.parts.findLastIndex((part) => part.type === "step-start");
105
- let continuationId;
106
- for (const part of last.parts.slice(lastStep + 1)) {
107
- if (isToolUIPart(part) && part.state === "approval-responded") {
108
- const decision = await (await this.#options.getClient()).sessions.decideToolApproval({
109
- agentId: this.#options.agentId,
110
- sessionId: this.#sessionId,
111
- approvalId: part.approval.id,
112
- approved: part.approval.approved,
113
- reason: part.approval.reason,
114
- abortSignal: input.abortSignal,
115
- });
116
- continuationId = decision.continuationId;
117
- }
118
- }
107
+ const client = await this.#options.getClient();
108
+ const target = {
109
+ agentId: this.#options.agentId,
110
+ sessionId: this.#sessionId,
111
+ abortSignal: input.abortSignal,
112
+ };
113
+ const continuationId = await decideApprovalResponses(client, {
114
+ ...target,
115
+ message: last,
116
+ });
119
117
  if (continuationId === undefined) {
120
118
  throw new Error("Tool approval response is missing an approval.");
121
119
  }
122
- const continuation = await (await this.#options.getClient()).sessions.joinToolApprovalContinuation({
123
- agentId: this.#options.agentId,
124
- sessionId: this.#sessionId,
120
+ const continuation = await client.resumeChat({
121
+ ...target,
125
122
  continuationId,
126
- abortSignal: input.abortSignal,
123
+ functions: this.#options.functions ?? {},
127
124
  });
128
125
  return this.processResponseStream(continuation.toStream());
129
126
  }