@blazingagents/sdk 0.7.0 → 0.8.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.
package/README.md CHANGED
@@ -184,3 +184,51 @@ await client.agents.update({
184
184
  compactionReserveTokens: 32768,
185
185
  });
186
186
  ```
187
+
188
+ ### Tool approval policies (0.8.0)
189
+
190
+ Agents and immutable Agent Versions expose separate `approvalInChat` and
191
+ `approvalInTasks` policies. Create and update them through the ordinary Agent API:
192
+
193
+ ```ts
194
+ await client.agents.update({
195
+ agentId,
196
+ approvalInChat: {
197
+ default: "full",
198
+ overrides: [
199
+ { tool: { type: "builtin", name: "bash" }, decision: "manual" },
200
+ {
201
+ tool: { type: "mcp", connectionId: "mcp_0123456789abcdef", name: "send_mail" },
202
+ decision: "auto",
203
+ },
204
+ ],
205
+ },
206
+ approvalInTasks: { default: "deny", overrides: [] },
207
+ });
208
+ ```
209
+
210
+ An exact tool override wins over the default. Both policies default to `full`
211
+ with no overrides. `full` allows available tools, `deny` blocks execution,
212
+ `manual` requires human review, and `auto` uses backend LLM review. Review errors
213
+ block execution; escalation without an available human also blocks execution.
214
+ Policies do not grant tool access. MCP references use the original remote tool
215
+ name and connection ID; the backend validates attachment and discovery.
216
+
217
+ Omitting a policy from an update preserves it. Supplying one replaces that whole
218
+ policy; omitted or empty `overrides` clears its overrides. `restoreVersion`
219
+ restores both policies alongside the other versioned fields.
220
+
221
+ Interactive Sessions reuse `client.sessions.toolApprovals`,
222
+ `client.sessions.decideToolApproval`, and
223
+ `client.sessions.joinToolApprovalContinuation`. A configured backend human
224
+ reviewer path is required. Tasks and stateless generations have no human
225
+ continuation path and block manual or escalated calls; stateless generation uses
226
+ `approvalInChat`. The SDK does not run an approval reviewer.
227
+
228
+ Approval rows retain optional `tool`, `assistantMessageId`, `createdAt`, and
229
+ `decidedAt` metadata. `tool` and `decidedAt` may be null (admin tools have no
230
+ ordinary-policy reference). Persisted approval decisions remain
231
+ `pending | approved | denied`; policy modes are `full | deny | manual | auto`.
232
+ The root package exports `ApprovalDecision`, `ApprovalPolicy`, `ToolReference`,
233
+ and `ToolApprovalState`; runtime policy schemas are exported from
234
+ `@blazingagents/sdk/contracts`.
@@ -0,0 +1,72 @@
1
+ import { z } from "zod";
2
+ export declare const approvalDecisionSchema: z.ZodEnum<{
3
+ auto: "auto";
4
+ deny: "deny";
5
+ full: "full";
6
+ manual: "manual";
7
+ }>;
8
+ export declare const toolReferenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
9
+ type: z.ZodLiteral<"builtin">;
10
+ name: z.ZodEnum<{
11
+ activate_skill: "activate_skill";
12
+ bash: "bash";
13
+ delete_memory: "delete_memory";
14
+ edit: "edit";
15
+ get_memory: "get_memory";
16
+ glob: "glob";
17
+ grep: "grep";
18
+ publish_artifacts: "publish_artifacts";
19
+ read: "read";
20
+ save_memory: "save_memory";
21
+ search_memories: "search_memories";
22
+ update_memory: "update_memory";
23
+ write: "write";
24
+ write_todos: "write_todos";
25
+ }>;
26
+ }, z.core.$strict>, z.ZodObject<{
27
+ type: z.ZodLiteral<"mcp">;
28
+ connectionId: z.ZodString;
29
+ name: z.ZodString;
30
+ }, z.core.$strict>], "type">;
31
+ export declare const approvalPolicySchema: z.ZodObject<{
32
+ default: z.ZodEnum<{
33
+ auto: "auto";
34
+ deny: "deny";
35
+ full: "full";
36
+ manual: "manual";
37
+ }>;
38
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
39
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
40
+ type: z.ZodLiteral<"builtin">;
41
+ name: z.ZodEnum<{
42
+ activate_skill: "activate_skill";
43
+ bash: "bash";
44
+ delete_memory: "delete_memory";
45
+ edit: "edit";
46
+ get_memory: "get_memory";
47
+ glob: "glob";
48
+ grep: "grep";
49
+ publish_artifacts: "publish_artifacts";
50
+ read: "read";
51
+ save_memory: "save_memory";
52
+ search_memories: "search_memories";
53
+ update_memory: "update_memory";
54
+ write: "write";
55
+ write_todos: "write_todos";
56
+ }>;
57
+ }, z.core.$strict>, z.ZodObject<{
58
+ type: z.ZodLiteral<"mcp">;
59
+ connectionId: z.ZodString;
60
+ name: z.ZodString;
61
+ }, z.core.$strict>], "type">;
62
+ decision: z.ZodEnum<{
63
+ auto: "auto";
64
+ deny: "deny";
65
+ full: "full";
66
+ manual: "manual";
67
+ }>;
68
+ }, z.core.$strict>>>;
69
+ }, z.core.$strict>;
70
+ export type ApprovalPolicy = z.infer<typeof approvalPolicySchema>;
71
+ export type ToolReference = z.infer<typeof toolReferenceSchema>;
72
+ export type ApprovalDecision = z.infer<typeof approvalDecisionSchema>;
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ import { mcpConnectionIdSchema } from "../ids.js";
3
+ import { AGENT_TOOL_CATALOG } from "./agent-tools.js";
4
+ export const approvalDecisionSchema = z.enum([
5
+ "full",
6
+ "deny",
7
+ "manual",
8
+ "auto",
9
+ ]);
10
+ export const toolReferenceSchema = z.discriminatedUnion("type", [
11
+ z
12
+ .object({
13
+ type: z.literal("builtin"),
14
+ name: z.enum([
15
+ ...AGENT_TOOL_CATALOG.flatMap((group) => group.tools),
16
+ "activate_skill",
17
+ ]),
18
+ })
19
+ .strict(),
20
+ z
21
+ .object({
22
+ type: z.literal("mcp"),
23
+ connectionId: mcpConnectionIdSchema,
24
+ name: z.string().min(1),
25
+ })
26
+ .strict(),
27
+ ]);
28
+ export const approvalPolicySchema = z
29
+ .object({
30
+ default: approvalDecisionSchema,
31
+ overrides: z
32
+ .array(z
33
+ .object({
34
+ tool: toolReferenceSchema,
35
+ decision: approvalDecisionSchema,
36
+ })
37
+ .strict())
38
+ .default([]),
39
+ })
40
+ .strict()
41
+ .superRefine((policy, ctx) => {
42
+ const seen = new Set();
43
+ for (const [index, rule] of policy.overrides.entries()) {
44
+ const key = JSON.stringify(rule.tool);
45
+ if (seen.has(key)) {
46
+ ctx.addIssue({
47
+ code: "custom",
48
+ message: "Tool overrides must be unique within each policy.",
49
+ path: ["overrides", index, "tool"],
50
+ });
51
+ }
52
+ seen.add(key);
53
+ }
54
+ });
@@ -14,6 +14,84 @@ export declare const agentStatusSchema: z.ZodEnum<{
14
14
  disabled: "disabled";
15
15
  }>;
16
16
  export declare const agentSchema: z.ZodObject<{
17
+ approvalInChat: z.ZodDefault<z.ZodObject<{
18
+ default: z.ZodEnum<{
19
+ auto: "auto";
20
+ deny: "deny";
21
+ full: "full";
22
+ manual: "manual";
23
+ }>;
24
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
25
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
26
+ type: z.ZodLiteral<"builtin">;
27
+ name: z.ZodEnum<{
28
+ activate_skill: "activate_skill";
29
+ bash: "bash";
30
+ delete_memory: "delete_memory";
31
+ edit: "edit";
32
+ get_memory: "get_memory";
33
+ glob: "glob";
34
+ grep: "grep";
35
+ publish_artifacts: "publish_artifacts";
36
+ read: "read";
37
+ save_memory: "save_memory";
38
+ search_memories: "search_memories";
39
+ update_memory: "update_memory";
40
+ write: "write";
41
+ write_todos: "write_todos";
42
+ }>;
43
+ }, z.core.$strict>, z.ZodObject<{
44
+ type: z.ZodLiteral<"mcp">;
45
+ connectionId: z.ZodString;
46
+ name: z.ZodString;
47
+ }, z.core.$strict>], "type">;
48
+ decision: z.ZodEnum<{
49
+ auto: "auto";
50
+ deny: "deny";
51
+ full: "full";
52
+ manual: "manual";
53
+ }>;
54
+ }, z.core.$strict>>>;
55
+ }, z.core.$strict>>;
56
+ approvalInTasks: z.ZodDefault<z.ZodObject<{
57
+ default: z.ZodEnum<{
58
+ auto: "auto";
59
+ deny: "deny";
60
+ full: "full";
61
+ manual: "manual";
62
+ }>;
63
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
64
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
65
+ type: z.ZodLiteral<"builtin">;
66
+ name: z.ZodEnum<{
67
+ activate_skill: "activate_skill";
68
+ bash: "bash";
69
+ delete_memory: "delete_memory";
70
+ edit: "edit";
71
+ get_memory: "get_memory";
72
+ glob: "glob";
73
+ grep: "grep";
74
+ publish_artifacts: "publish_artifacts";
75
+ read: "read";
76
+ save_memory: "save_memory";
77
+ search_memories: "search_memories";
78
+ update_memory: "update_memory";
79
+ write: "write";
80
+ write_todos: "write_todos";
81
+ }>;
82
+ }, z.core.$strict>, z.ZodObject<{
83
+ type: z.ZodLiteral<"mcp">;
84
+ connectionId: z.ZodString;
85
+ name: z.ZodString;
86
+ }, z.core.$strict>], "type">;
87
+ decision: z.ZodEnum<{
88
+ auto: "auto";
89
+ deny: "deny";
90
+ full: "full";
91
+ manual: "manual";
92
+ }>;
93
+ }, z.core.$strict>>>;
94
+ }, z.core.$strict>>;
17
95
  id: z.ZodString;
18
96
  tenantId: z.ZodString;
19
97
  name: z.ZodString;
@@ -44,6 +122,84 @@ export declare const agentSchema: z.ZodObject<{
44
122
  }, z.core.$strip>;
45
123
  export declare const agentsResponseSchema: z.ZodObject<{
46
124
  agents: z.ZodArray<z.ZodObject<{
125
+ approvalInChat: z.ZodDefault<z.ZodObject<{
126
+ default: z.ZodEnum<{
127
+ auto: "auto";
128
+ deny: "deny";
129
+ full: "full";
130
+ manual: "manual";
131
+ }>;
132
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
133
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
134
+ type: z.ZodLiteral<"builtin">;
135
+ name: z.ZodEnum<{
136
+ activate_skill: "activate_skill";
137
+ bash: "bash";
138
+ delete_memory: "delete_memory";
139
+ edit: "edit";
140
+ get_memory: "get_memory";
141
+ glob: "glob";
142
+ grep: "grep";
143
+ publish_artifacts: "publish_artifacts";
144
+ read: "read";
145
+ save_memory: "save_memory";
146
+ search_memories: "search_memories";
147
+ update_memory: "update_memory";
148
+ write: "write";
149
+ write_todos: "write_todos";
150
+ }>;
151
+ }, z.core.$strict>, z.ZodObject<{
152
+ type: z.ZodLiteral<"mcp">;
153
+ connectionId: z.ZodString;
154
+ name: z.ZodString;
155
+ }, z.core.$strict>], "type">;
156
+ decision: z.ZodEnum<{
157
+ auto: "auto";
158
+ deny: "deny";
159
+ full: "full";
160
+ manual: "manual";
161
+ }>;
162
+ }, z.core.$strict>>>;
163
+ }, z.core.$strict>>;
164
+ approvalInTasks: z.ZodDefault<z.ZodObject<{
165
+ default: z.ZodEnum<{
166
+ auto: "auto";
167
+ deny: "deny";
168
+ full: "full";
169
+ manual: "manual";
170
+ }>;
171
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
172
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
173
+ type: z.ZodLiteral<"builtin">;
174
+ name: z.ZodEnum<{
175
+ activate_skill: "activate_skill";
176
+ bash: "bash";
177
+ delete_memory: "delete_memory";
178
+ edit: "edit";
179
+ get_memory: "get_memory";
180
+ glob: "glob";
181
+ grep: "grep";
182
+ publish_artifacts: "publish_artifacts";
183
+ read: "read";
184
+ save_memory: "save_memory";
185
+ search_memories: "search_memories";
186
+ update_memory: "update_memory";
187
+ write: "write";
188
+ write_todos: "write_todos";
189
+ }>;
190
+ }, z.core.$strict>, z.ZodObject<{
191
+ type: z.ZodLiteral<"mcp">;
192
+ connectionId: z.ZodString;
193
+ name: z.ZodString;
194
+ }, z.core.$strict>], "type">;
195
+ decision: z.ZodEnum<{
196
+ auto: "auto";
197
+ deny: "deny";
198
+ full: "full";
199
+ manual: "manual";
200
+ }>;
201
+ }, z.core.$strict>>>;
202
+ }, z.core.$strict>>;
47
203
  id: z.ZodString;
48
204
  tenantId: z.ZodString;
49
205
  name: z.ZodString;
@@ -74,6 +230,84 @@ export declare const agentsResponseSchema: z.ZodObject<{
74
230
  }, z.core.$strip>>;
75
231
  }, z.core.$strip>;
76
232
  export declare const agentResponseSchema: z.ZodObject<{
233
+ approvalInChat: z.ZodDefault<z.ZodObject<{
234
+ default: z.ZodEnum<{
235
+ auto: "auto";
236
+ deny: "deny";
237
+ full: "full";
238
+ manual: "manual";
239
+ }>;
240
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
241
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
242
+ type: z.ZodLiteral<"builtin">;
243
+ name: z.ZodEnum<{
244
+ activate_skill: "activate_skill";
245
+ bash: "bash";
246
+ delete_memory: "delete_memory";
247
+ edit: "edit";
248
+ get_memory: "get_memory";
249
+ glob: "glob";
250
+ grep: "grep";
251
+ publish_artifacts: "publish_artifacts";
252
+ read: "read";
253
+ save_memory: "save_memory";
254
+ search_memories: "search_memories";
255
+ update_memory: "update_memory";
256
+ write: "write";
257
+ write_todos: "write_todos";
258
+ }>;
259
+ }, z.core.$strict>, z.ZodObject<{
260
+ type: z.ZodLiteral<"mcp">;
261
+ connectionId: z.ZodString;
262
+ name: z.ZodString;
263
+ }, z.core.$strict>], "type">;
264
+ decision: z.ZodEnum<{
265
+ auto: "auto";
266
+ deny: "deny";
267
+ full: "full";
268
+ manual: "manual";
269
+ }>;
270
+ }, z.core.$strict>>>;
271
+ }, z.core.$strict>>;
272
+ approvalInTasks: z.ZodDefault<z.ZodObject<{
273
+ default: z.ZodEnum<{
274
+ auto: "auto";
275
+ deny: "deny";
276
+ full: "full";
277
+ manual: "manual";
278
+ }>;
279
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
280
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
281
+ type: z.ZodLiteral<"builtin">;
282
+ name: z.ZodEnum<{
283
+ activate_skill: "activate_skill";
284
+ bash: "bash";
285
+ delete_memory: "delete_memory";
286
+ edit: "edit";
287
+ get_memory: "get_memory";
288
+ glob: "glob";
289
+ grep: "grep";
290
+ publish_artifacts: "publish_artifacts";
291
+ read: "read";
292
+ save_memory: "save_memory";
293
+ search_memories: "search_memories";
294
+ update_memory: "update_memory";
295
+ write: "write";
296
+ write_todos: "write_todos";
297
+ }>;
298
+ }, z.core.$strict>, z.ZodObject<{
299
+ type: z.ZodLiteral<"mcp">;
300
+ connectionId: z.ZodString;
301
+ name: z.ZodString;
302
+ }, z.core.$strict>], "type">;
303
+ decision: z.ZodEnum<{
304
+ auto: "auto";
305
+ deny: "deny";
306
+ full: "full";
307
+ manual: "manual";
308
+ }>;
309
+ }, z.core.$strict>>>;
310
+ }, z.core.$strict>>;
77
311
  id: z.ZodString;
78
312
  tenantId: z.ZodString;
79
313
  name: z.ZodString;
@@ -107,6 +341,84 @@ export declare const agentsListQuerySchema: z.ZodObject<{
107
341
  workspaceId: z.ZodOptional<z.ZodString>;
108
342
  }, z.core.$strict>;
109
343
  export declare const agentVersionSchema: z.ZodObject<{
344
+ approvalInChat: z.ZodDefault<z.ZodObject<{
345
+ default: z.ZodEnum<{
346
+ auto: "auto";
347
+ deny: "deny";
348
+ full: "full";
349
+ manual: "manual";
350
+ }>;
351
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
352
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
353
+ type: z.ZodLiteral<"builtin">;
354
+ name: z.ZodEnum<{
355
+ activate_skill: "activate_skill";
356
+ bash: "bash";
357
+ delete_memory: "delete_memory";
358
+ edit: "edit";
359
+ get_memory: "get_memory";
360
+ glob: "glob";
361
+ grep: "grep";
362
+ publish_artifacts: "publish_artifacts";
363
+ read: "read";
364
+ save_memory: "save_memory";
365
+ search_memories: "search_memories";
366
+ update_memory: "update_memory";
367
+ write: "write";
368
+ write_todos: "write_todos";
369
+ }>;
370
+ }, z.core.$strict>, z.ZodObject<{
371
+ type: z.ZodLiteral<"mcp">;
372
+ connectionId: z.ZodString;
373
+ name: z.ZodString;
374
+ }, z.core.$strict>], "type">;
375
+ decision: z.ZodEnum<{
376
+ auto: "auto";
377
+ deny: "deny";
378
+ full: "full";
379
+ manual: "manual";
380
+ }>;
381
+ }, z.core.$strict>>>;
382
+ }, z.core.$strict>>;
383
+ approvalInTasks: z.ZodDefault<z.ZodObject<{
384
+ default: z.ZodEnum<{
385
+ auto: "auto";
386
+ deny: "deny";
387
+ full: "full";
388
+ manual: "manual";
389
+ }>;
390
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
391
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
392
+ type: z.ZodLiteral<"builtin">;
393
+ name: z.ZodEnum<{
394
+ activate_skill: "activate_skill";
395
+ bash: "bash";
396
+ delete_memory: "delete_memory";
397
+ edit: "edit";
398
+ get_memory: "get_memory";
399
+ glob: "glob";
400
+ grep: "grep";
401
+ publish_artifacts: "publish_artifacts";
402
+ read: "read";
403
+ save_memory: "save_memory";
404
+ search_memories: "search_memories";
405
+ update_memory: "update_memory";
406
+ write: "write";
407
+ write_todos: "write_todos";
408
+ }>;
409
+ }, z.core.$strict>, z.ZodObject<{
410
+ type: z.ZodLiteral<"mcp">;
411
+ connectionId: z.ZodString;
412
+ name: z.ZodString;
413
+ }, z.core.$strict>], "type">;
414
+ decision: z.ZodEnum<{
415
+ auto: "auto";
416
+ deny: "deny";
417
+ full: "full";
418
+ manual: "manual";
419
+ }>;
420
+ }, z.core.$strict>>>;
421
+ }, z.core.$strict>>;
110
422
  agentId: z.ZodString;
111
423
  tenantId: z.ZodString;
112
424
  version: z.ZodNumber;
@@ -133,6 +445,84 @@ export declare const agentVersionsListQuerySchema: z.ZodObject<{
133
445
  }, z.core.$strict>;
134
446
  export declare const agentVersionsResponseSchema: z.ZodObject<{
135
447
  data: z.ZodArray<z.ZodObject<{
448
+ approvalInChat: z.ZodDefault<z.ZodObject<{
449
+ default: z.ZodEnum<{
450
+ auto: "auto";
451
+ deny: "deny";
452
+ full: "full";
453
+ manual: "manual";
454
+ }>;
455
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
456
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
457
+ type: z.ZodLiteral<"builtin">;
458
+ name: z.ZodEnum<{
459
+ activate_skill: "activate_skill";
460
+ bash: "bash";
461
+ delete_memory: "delete_memory";
462
+ edit: "edit";
463
+ get_memory: "get_memory";
464
+ glob: "glob";
465
+ grep: "grep";
466
+ publish_artifacts: "publish_artifacts";
467
+ read: "read";
468
+ save_memory: "save_memory";
469
+ search_memories: "search_memories";
470
+ update_memory: "update_memory";
471
+ write: "write";
472
+ write_todos: "write_todos";
473
+ }>;
474
+ }, z.core.$strict>, z.ZodObject<{
475
+ type: z.ZodLiteral<"mcp">;
476
+ connectionId: z.ZodString;
477
+ name: z.ZodString;
478
+ }, z.core.$strict>], "type">;
479
+ decision: z.ZodEnum<{
480
+ auto: "auto";
481
+ deny: "deny";
482
+ full: "full";
483
+ manual: "manual";
484
+ }>;
485
+ }, z.core.$strict>>>;
486
+ }, z.core.$strict>>;
487
+ approvalInTasks: z.ZodDefault<z.ZodObject<{
488
+ default: z.ZodEnum<{
489
+ auto: "auto";
490
+ deny: "deny";
491
+ full: "full";
492
+ manual: "manual";
493
+ }>;
494
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
495
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
496
+ type: z.ZodLiteral<"builtin">;
497
+ name: z.ZodEnum<{
498
+ activate_skill: "activate_skill";
499
+ bash: "bash";
500
+ delete_memory: "delete_memory";
501
+ edit: "edit";
502
+ get_memory: "get_memory";
503
+ glob: "glob";
504
+ grep: "grep";
505
+ publish_artifacts: "publish_artifacts";
506
+ read: "read";
507
+ save_memory: "save_memory";
508
+ search_memories: "search_memories";
509
+ update_memory: "update_memory";
510
+ write: "write";
511
+ write_todos: "write_todos";
512
+ }>;
513
+ }, z.core.$strict>, z.ZodObject<{
514
+ type: z.ZodLiteral<"mcp">;
515
+ connectionId: z.ZodString;
516
+ name: z.ZodString;
517
+ }, z.core.$strict>], "type">;
518
+ decision: z.ZodEnum<{
519
+ auto: "auto";
520
+ deny: "deny";
521
+ full: "full";
522
+ manual: "manual";
523
+ }>;
524
+ }, z.core.$strict>>>;
525
+ }, z.core.$strict>>;
136
526
  agentId: z.ZodString;
137
527
  tenantId: z.ZodString;
138
528
  version: z.ZodNumber;
@@ -156,6 +546,84 @@ export declare const agentVersionsResponseSchema: z.ZodObject<{
156
546
  nextCursor: z.ZodNullable<z.ZodString>;
157
547
  }, z.core.$strip>;
158
548
  export declare const createAgentBodySchema: z.ZodObject<{
549
+ approvalInChat: z.ZodDefault<z.ZodObject<{
550
+ default: z.ZodEnum<{
551
+ auto: "auto";
552
+ deny: "deny";
553
+ full: "full";
554
+ manual: "manual";
555
+ }>;
556
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
557
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
558
+ type: z.ZodLiteral<"builtin">;
559
+ name: z.ZodEnum<{
560
+ activate_skill: "activate_skill";
561
+ bash: "bash";
562
+ delete_memory: "delete_memory";
563
+ edit: "edit";
564
+ get_memory: "get_memory";
565
+ glob: "glob";
566
+ grep: "grep";
567
+ publish_artifacts: "publish_artifacts";
568
+ read: "read";
569
+ save_memory: "save_memory";
570
+ search_memories: "search_memories";
571
+ update_memory: "update_memory";
572
+ write: "write";
573
+ write_todos: "write_todos";
574
+ }>;
575
+ }, z.core.$strict>, z.ZodObject<{
576
+ type: z.ZodLiteral<"mcp">;
577
+ connectionId: z.ZodString;
578
+ name: z.ZodString;
579
+ }, z.core.$strict>], "type">;
580
+ decision: z.ZodEnum<{
581
+ auto: "auto";
582
+ deny: "deny";
583
+ full: "full";
584
+ manual: "manual";
585
+ }>;
586
+ }, z.core.$strict>>>;
587
+ }, z.core.$strict>>;
588
+ approvalInTasks: z.ZodDefault<z.ZodObject<{
589
+ default: z.ZodEnum<{
590
+ auto: "auto";
591
+ deny: "deny";
592
+ full: "full";
593
+ manual: "manual";
594
+ }>;
595
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
596
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
597
+ type: z.ZodLiteral<"builtin">;
598
+ name: z.ZodEnum<{
599
+ activate_skill: "activate_skill";
600
+ bash: "bash";
601
+ delete_memory: "delete_memory";
602
+ edit: "edit";
603
+ get_memory: "get_memory";
604
+ glob: "glob";
605
+ grep: "grep";
606
+ publish_artifacts: "publish_artifacts";
607
+ read: "read";
608
+ save_memory: "save_memory";
609
+ search_memories: "search_memories";
610
+ update_memory: "update_memory";
611
+ write: "write";
612
+ write_todos: "write_todos";
613
+ }>;
614
+ }, z.core.$strict>, z.ZodObject<{
615
+ type: z.ZodLiteral<"mcp">;
616
+ connectionId: z.ZodString;
617
+ name: z.ZodString;
618
+ }, z.core.$strict>], "type">;
619
+ decision: z.ZodEnum<{
620
+ auto: "auto";
621
+ deny: "deny";
622
+ full: "full";
623
+ manual: "manual";
624
+ }>;
625
+ }, z.core.$strict>>>;
626
+ }, z.core.$strict>>;
159
627
  name: z.ZodString;
160
628
  model: z.ZodDefault<z.ZodNullable<z.ZodString>>;
161
629
  thinkingLevel: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -175,6 +643,84 @@ export declare const createAgentBodySchema: z.ZodObject<{
175
643
  mcpConnectionIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
176
644
  }, z.core.$strict>;
177
645
  export declare const updateAgentBodySchema: z.ZodObject<{
646
+ approvalInChat: z.ZodOptional<z.ZodObject<{
647
+ default: z.ZodEnum<{
648
+ auto: "auto";
649
+ deny: "deny";
650
+ full: "full";
651
+ manual: "manual";
652
+ }>;
653
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
654
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
655
+ type: z.ZodLiteral<"builtin">;
656
+ name: z.ZodEnum<{
657
+ activate_skill: "activate_skill";
658
+ bash: "bash";
659
+ delete_memory: "delete_memory";
660
+ edit: "edit";
661
+ get_memory: "get_memory";
662
+ glob: "glob";
663
+ grep: "grep";
664
+ publish_artifacts: "publish_artifacts";
665
+ read: "read";
666
+ save_memory: "save_memory";
667
+ search_memories: "search_memories";
668
+ update_memory: "update_memory";
669
+ write: "write";
670
+ write_todos: "write_todos";
671
+ }>;
672
+ }, z.core.$strict>, z.ZodObject<{
673
+ type: z.ZodLiteral<"mcp">;
674
+ connectionId: z.ZodString;
675
+ name: z.ZodString;
676
+ }, z.core.$strict>], "type">;
677
+ decision: z.ZodEnum<{
678
+ auto: "auto";
679
+ deny: "deny";
680
+ full: "full";
681
+ manual: "manual";
682
+ }>;
683
+ }, z.core.$strict>>>;
684
+ }, z.core.$strict>>;
685
+ approvalInTasks: z.ZodOptional<z.ZodObject<{
686
+ default: z.ZodEnum<{
687
+ auto: "auto";
688
+ deny: "deny";
689
+ full: "full";
690
+ manual: "manual";
691
+ }>;
692
+ overrides: z.ZodDefault<z.ZodArray<z.ZodObject<{
693
+ tool: z.ZodDiscriminatedUnion<[z.ZodObject<{
694
+ type: z.ZodLiteral<"builtin">;
695
+ name: z.ZodEnum<{
696
+ activate_skill: "activate_skill";
697
+ bash: "bash";
698
+ delete_memory: "delete_memory";
699
+ edit: "edit";
700
+ get_memory: "get_memory";
701
+ glob: "glob";
702
+ grep: "grep";
703
+ publish_artifacts: "publish_artifacts";
704
+ read: "read";
705
+ save_memory: "save_memory";
706
+ search_memories: "search_memories";
707
+ update_memory: "update_memory";
708
+ write: "write";
709
+ write_todos: "write_todos";
710
+ }>;
711
+ }, z.core.$strict>, z.ZodObject<{
712
+ type: z.ZodLiteral<"mcp">;
713
+ connectionId: z.ZodString;
714
+ name: z.ZodString;
715
+ }, z.core.$strict>], "type">;
716
+ decision: z.ZodEnum<{
717
+ auto: "auto";
718
+ deny: "deny";
719
+ full: "full";
720
+ manual: "manual";
721
+ }>;
722
+ }, z.core.$strict>>>;
723
+ }, z.core.$strict>>;
178
724
  name: z.ZodOptional<z.ZodString>;
179
725
  model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
180
726
  thinkingLevel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -201,4 +747,4 @@ export type AgentStatus = z.infer<typeof agentStatusSchema>;
201
747
  export type AgentVersionsListQuery = z.infer<typeof agentVersionsListQuerySchema>;
202
748
  export type AgentVersionsResponse = z.infer<typeof agentVersionsResponseSchema>;
203
749
  export type CreateAgentBody = z.input<typeof createAgentBodySchema>;
204
- export type UpdateAgentBody = z.infer<typeof updateAgentBodySchema>;
750
+ export type UpdateAgentBody = z.input<typeof updateAgentBodySchema>;
@@ -3,8 +3,19 @@ import { cursorSchema, paginatedResponseSchema } from "../api.js";
3
3
  import { agentIdSchema, mcpConnectionIdSchema, providerIdSchema, tenantIdSchema, workspaceIdSchema, } from "../ids.js";
4
4
  import { DEFAULT_AGENT_VERSIONS_LIST_LIMIT, MAX_AGENT_INSTRUCTIONS_LENGTH, MAX_AGENT_NAME_LENGTH, MAX_AGENT_VERSIONS_LIST_LIMIT, MAX_MCP_CONNECTIONS_PER_AGENT, } from "../limitations.js";
5
5
  import { atLeastOneFieldMessage, hasObjectKeys, hasUniqueValues, } from "../utils.js";
6
+ import { approvalPolicySchema } from "./agent-approval.js";
6
7
  import { agentToolGroupIds } from "./agent-tools.js";
7
8
  import { metadataSchema, userIdSchema } from "./attribution.js";
9
+ const approvalFields = {
10
+ approvalInChat: approvalPolicySchema.default({
11
+ default: "full",
12
+ overrides: [],
13
+ }),
14
+ approvalInTasks: approvalPolicySchema.default({
15
+ default: "full",
16
+ overrides: [],
17
+ }),
18
+ };
8
19
  const agentNameSchema = z.string().trim().min(1).max(MAX_AGENT_NAME_LENGTH);
9
20
  export const agentInstructionsSchema = z
10
21
  .string()
@@ -34,6 +45,7 @@ function hasProviderModelPair(input) {
34
45
  }
35
46
  export const agentSchema = z
36
47
  .object({
48
+ ...approvalFields,
37
49
  id: agentIdSchema,
38
50
  tenantId: tenantIdSchema,
39
51
  name: agentNameSchema,
@@ -79,6 +91,7 @@ export const agentsListQuerySchema = z
79
91
  .strict();
80
92
  export const agentVersionSchema = z
81
93
  .object({
94
+ ...approvalFields,
82
95
  agentId: agentIdSchema,
83
96
  tenantId: tenantIdSchema,
84
97
  version: agentVersionNumberSchema,
@@ -114,6 +127,7 @@ export const agentVersionsListQuerySchema = z
114
127
  export const agentVersionsResponseSchema = paginatedResponseSchema(agentVersionSchema);
115
128
  export const createAgentBodySchema = z
116
129
  .object({
130
+ ...approvalFields,
117
131
  name: agentNameSchema,
118
132
  model: agentModelIdSchema.nullable().default(null),
119
133
  thinkingLevel: z.string().min(1).nullable().default(null),
@@ -135,6 +149,8 @@ export const createAgentBodySchema = z
135
149
  });
136
150
  export const updateAgentBodySchema = z
137
151
  .object({
152
+ approvalInChat: approvalPolicySchema.optional(),
153
+ approvalInTasks: approvalPolicySchema.optional(),
138
154
  name: agentNameSchema.optional(),
139
155
  model: agentModelIdSchema.nullable().optional(),
140
156
  thinkingLevel: z.string().min(1).nullable().optional(),
@@ -132,6 +132,32 @@ export declare const toolApprovalContinuationStateSchema: z.ZodEnum<{
132
132
  waiting: "waiting";
133
133
  }>;
134
134
  export declare const toolApprovalStateSchema: z.ZodObject<{
135
+ tool: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
136
+ type: z.ZodLiteral<"builtin">;
137
+ name: z.ZodEnum<{
138
+ activate_skill: "activate_skill";
139
+ bash: "bash";
140
+ delete_memory: "delete_memory";
141
+ edit: "edit";
142
+ get_memory: "get_memory";
143
+ glob: "glob";
144
+ grep: "grep";
145
+ publish_artifacts: "publish_artifacts";
146
+ read: "read";
147
+ save_memory: "save_memory";
148
+ search_memories: "search_memories";
149
+ update_memory: "update_memory";
150
+ write: "write";
151
+ write_todos: "write_todos";
152
+ }>;
153
+ }, z.core.$strict>, z.ZodObject<{
154
+ type: z.ZodLiteral<"mcp">;
155
+ connectionId: z.ZodString;
156
+ name: z.ZodString;
157
+ }, z.core.$strict>], "type">>>;
158
+ assistantMessageId: z.ZodOptional<z.ZodString>;
159
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
160
+ decidedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
135
161
  approvalId: z.ZodString;
136
162
  decision: z.ZodEnum<{
137
163
  approved: "approved";
@@ -155,6 +181,32 @@ export declare const toolApprovalContinuationSchema: z.ZodObject<{
155
181
  }, z.core.$strip>;
156
182
  export declare const toolApprovalsResponseSchema: z.ZodObject<{
157
183
  data: z.ZodArray<z.ZodObject<{
184
+ tool: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
185
+ type: z.ZodLiteral<"builtin">;
186
+ name: z.ZodEnum<{
187
+ activate_skill: "activate_skill";
188
+ bash: "bash";
189
+ delete_memory: "delete_memory";
190
+ edit: "edit";
191
+ get_memory: "get_memory";
192
+ glob: "glob";
193
+ grep: "grep";
194
+ publish_artifacts: "publish_artifacts";
195
+ read: "read";
196
+ save_memory: "save_memory";
197
+ search_memories: "search_memories";
198
+ update_memory: "update_memory";
199
+ write: "write";
200
+ write_todos: "write_todos";
201
+ }>;
202
+ }, z.core.$strict>, z.ZodObject<{
203
+ type: z.ZodLiteral<"mcp">;
204
+ connectionId: z.ZodString;
205
+ name: z.ZodString;
206
+ }, z.core.$strict>], "type">>>;
207
+ assistantMessageId: z.ZodOptional<z.ZodString>;
208
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
209
+ decidedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
158
210
  approvalId: z.ZodString;
159
211
  decision: z.ZodEnum<{
160
212
  approved: "approved";
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { paginatedResponseSchema } from "../api.js";
3
3
  import { agentIdSchema, sessionIdSchema } from "../ids.js";
4
4
  import { DEFAULT_SESSION_MESSAGES_LIMIT, MAX_SESSION_MESSAGES_LIMIT, } from "../limitations.js";
5
+ import { toolReferenceSchema } from "./agent-approval.js";
5
6
  import { agentSchema, agentVersionNumberSchema } from "./agents.js";
6
7
  import { metadataSchema, userIdSchema } from "./attribution.js";
7
8
  /**
@@ -107,6 +108,10 @@ export const toolApprovalContinuationStateSchema = z.enum([
107
108
  ]);
108
109
  export const toolApprovalStateSchema = z
109
110
  .object({
111
+ tool: toolReferenceSchema.nullable().optional(),
112
+ assistantMessageId: z.string().min(1).optional(),
113
+ createdAt: z.iso.datetime({ offset: true }).optional(),
114
+ decidedAt: z.iso.datetime({ offset: true }).nullable().optional(),
110
115
  approvalId: z.string().min(1),
111
116
  decision: z.enum(["pending", "approved", "denied"]),
112
117
  input: z.json(),
@@ -1,5 +1,7 @@
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";
3
5
  export { agentResponseSchema, agentSchema, agentStatusSchema, agentsResponseSchema, agentVersionSchema, agentVersionsResponseSchema, createAgentBodySchema, updateAgentBodySchema, } from "./entities/agents.ts";
4
6
  export { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsListResponseSchema, } from "./entities/artifacts.ts";
5
7
  export { attributionCreateInputSchema, metadataSchema, } from "./entities/attribution.ts";
@@ -1,6 +1,7 @@
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";
4
5
  export { agentResponseSchema, agentSchema, agentStatusSchema, agentsResponseSchema, agentVersionSchema, agentVersionsResponseSchema, createAgentBodySchema, updateAgentBodySchema, } from "./entities/agents.js";
5
6
  export { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsListResponseSchema, } from "./entities/artifacts.js";
6
7
  export { attributionCreateInputSchema, metadataSchema, } from "./entities/attribution.js";
package/dist/index.d.ts CHANGED
@@ -9,10 +9,12 @@
9
9
  export type { UIMessage } from "ai";
10
10
  export { BlazingAgentsChatTransport, type BlazingAgentsChatTransportOptions, } from "./chat-transport.ts";
11
11
  export { BlazingAgents } from "./client.ts";
12
+ export type { ApprovalDecision, ApprovalPolicy, ToolReference, } from "./contracts/entities/agent-approval.ts";
12
13
  export type { Agent, AgentResponse, AgentsResponse, AgentVersion, AgentVersionsListQuery, AgentVersionsResponse, CreateAgentBody, UpdateAgentBody, } from "./contracts/entities/agents.ts";
13
14
  export type { ArtifactDownloadUrlResponse, ArtifactListItem, ArtifactsListResponse, } from "./contracts/entities/artifacts.ts";
14
15
  export type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResponse, McpConnectionAuthType, McpConnectionOauthConnectResponse, McpConnectionReconnectResult, McpConnectionResponse, McpConnectionStatus, McpConnectionTestResponse, ReconnectMcpConnectionBody, UpdateMcpAttachmentBody, UpdateMcpConnectionBody, } from "./contracts/entities/mcp-connections.ts";
15
16
  export type { CreateProviderBody, ProviderListItem, ProviderModel, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ProviderType, ThinkingLevelsResponse, UpdateProviderBody, } from "./contracts/entities/providers.ts";
17
+ export type { ToolApprovalDecisionResponse, ToolApprovalState, ToolApprovalsResponse, } from "./contracts/entities/sessions.ts";
16
18
  export type { CreateSkillBody, Skill, SkillArchiveType, SkillCopyResult, SkillCopyResults, SkillDetail, SkillFile, SkillsListResponse, } from "./contracts/entities/skills.ts";
17
19
  export type { CreateWorkspaceBody, UpdateWorkspaceBody, Workspace, WorkspaceNetworkPolicy, WorkspacesListResponse, } from "./contracts/entities/workspaces.ts";
18
20
  export { BlazingAgentsDirectChatTransport, type BlazingAgentsDirectChatTransportOptions, } from "./direct-chat-transport.ts";
@@ -59,6 +59,8 @@ export function createAgentsResource(config) {
59
59
  return update({
60
60
  agentId,
61
61
  abortSignal,
62
+ approvalInChat: version.approvalInChat,
63
+ approvalInTasks: version.approvalInTasks,
62
64
  name: version.name,
63
65
  model: version.model,
64
66
  thinkingLevel: version.thinkingLevel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazingagents/sdk",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "TypeScript SDK for the Blazing Agents API",
5
5
  "homepage": "https://docs.blazingagents.com",
6
6
  "bugs": {