@blazingagents/sdk 0.27.0 → 0.28.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.
@@ -65,6 +65,7 @@ export declare const apiErrorCodeSchema: z.ZodEnum<{
65
65
  session_busy: "session_busy";
66
66
  session_fork_deleted: "session_fork_deleted";
67
67
  session_fork_unavailable: "session_fork_unavailable";
68
+ session_turn_unresponsive: "session_turn_unresponsive";
68
69
  session_version_mismatch: "session_version_mismatch";
69
70
  skill_invalid_archive: "skill_invalid_archive";
70
71
  skill_invalid_markdown: "skill_invalid_markdown";
@@ -57,6 +57,7 @@ export const apiErrorCodeSchema = z.enum([
57
57
  "workspace_in_use",
58
58
  "workspace_busy",
59
59
  "session_busy",
60
+ "session_turn_unresponsive",
60
61
  "session_version_mismatch",
61
62
  "tool_approval_continuation_settled",
62
63
  "tool_approval_decision_conflict",
@@ -1,100 +1,137 @@
1
1
  import { z } from "zod";
2
2
  /**
3
- * Agent tools are toggled one by one. A category only groups tools for
4
- * display; it never enables anything on its own.
3
+ * Agent tools are toggled one by one. A tag describes a tool; it never enables
4
+ * anything on its own.
5
+ *
6
+ * Every tool has exactly one group tag, which display code groups tools by.
5
7
  */
6
- export declare const AGENT_TOOL_CATEGORIES: readonly [{
7
- readonly id: "files";
8
+ export declare const AGENT_TOOL_GROUPS: readonly [{
9
+ readonly tag: "files";
8
10
  readonly name: "File operations";
9
11
  readonly description: "Read, write, edit, search, and run shell commands in the attached Workspace.";
10
12
  }, {
11
- readonly id: "planning";
13
+ readonly tag: "planning";
12
14
  readonly name: "Task planning";
13
15
  readonly description: "Create and manage a structured todo list to plan and track multi-step work.";
14
16
  }, {
15
- readonly id: "memory";
17
+ readonly tag: "memory";
16
18
  readonly name: "Memory";
17
19
  readonly description: "Save, recall, search, update, and delete durable notes owned by this Agent.";
18
20
  }, {
19
- readonly id: "web";
21
+ readonly tag: "web";
20
22
  readonly name: "Web";
21
23
  readonly description: "Search the public web for current information.";
22
24
  }];
23
- export type AgentToolCategoryId = (typeof AGENT_TOOL_CATEGORIES)[number]["id"];
25
+ export type AgentToolGroupTag = (typeof AGENT_TOOL_GROUPS)[number]["tag"];
26
+ /**
27
+ * What a file operation tool may do to the Workspace. `file_read` tools never
28
+ * change Workspace files, so an Agent limited to them is read-only.
29
+ * `execute` runs arbitrary commands, which can change files and more.
30
+ */
31
+ export declare const AGENT_TOOL_FILE_ACCESS_TAGS: readonly ["file_read", "file_write", "execute"];
32
+ export type AgentToolFileAccessTag = (typeof AGENT_TOOL_FILE_ACCESS_TAGS)[number];
33
+ export declare const AGENT_TOOL_TAGS: readonly [...("files" | "memory" | "planning" | "web")[], "file_read", "file_write", "execute"];
34
+ export type AgentToolTag = AgentToolGroupTag | AgentToolFileAccessTag;
35
+ /** The group tag comes first; only a file operation tool adds a file access tag. */
36
+ export type AgentToolTags = readonly ["files"] | readonly ["files", AgentToolFileAccessTag] | readonly [Exclude<AgentToolGroupTag, "files">];
37
+ /** @deprecated Use `AgentToolGroupTag`. */
38
+ export type AgentToolCategoryId = AgentToolGroupTag;
39
+ /** @deprecated Use `AGENT_TOOL_GROUPS`, keyed by `tag`. */
40
+ export declare const AGENT_TOOL_CATEGORIES: readonly {
41
+ description: string;
42
+ id: AgentToolGroupTag;
43
+ name: string;
44
+ }[];
24
45
  export interface AgentToolDefinition {
25
- category: AgentToolCategoryId;
46
+ /** @deprecated Use the group tag in `tags`. */
47
+ category: AgentToolGroupTag;
26
48
  description: string;
27
49
  name: string;
28
50
  /** The tool runs in the Agent's attached Workspace. */
29
51
  requiresWorkspace: boolean;
52
+ tags: AgentToolTags;
30
53
  }
31
54
  export declare const AGENT_TOOLS: readonly [{
32
55
  readonly name: "read";
56
+ readonly tags: readonly ["files", "file_read"];
33
57
  readonly category: "files";
34
58
  readonly requiresWorkspace: true;
35
59
  readonly description: "Read a file from the Workspace.";
36
60
  }, {
37
61
  readonly name: "write";
62
+ readonly tags: readonly ["files", "file_write"];
38
63
  readonly category: "files";
39
64
  readonly requiresWorkspace: true;
40
65
  readonly description: "Create or overwrite a file in the Workspace.";
41
66
  }, {
42
67
  readonly name: "edit";
68
+ readonly tags: readonly ["files", "file_write"];
43
69
  readonly category: "files";
44
70
  readonly requiresWorkspace: true;
45
71
  readonly description: "Replace exact text in a Workspace file.";
46
72
  }, {
47
73
  readonly name: "grep";
74
+ readonly tags: readonly ["files", "file_read"];
48
75
  readonly category: "files";
49
76
  readonly requiresWorkspace: true;
50
77
  readonly description: "Search Workspace file contents with a regular expression.";
51
78
  }, {
52
79
  readonly name: "glob";
80
+ readonly tags: readonly ["files", "file_read"];
53
81
  readonly category: "files";
54
82
  readonly requiresWorkspace: true;
55
83
  readonly description: "Find Workspace files by path pattern.";
56
84
  }, {
57
85
  readonly name: "bash";
86
+ readonly tags: readonly ["files", "execute"];
58
87
  readonly category: "files";
59
88
  readonly requiresWorkspace: true;
60
89
  readonly description: "Run shell commands in the Workspace.";
61
90
  }, {
62
91
  readonly name: "publish_artifacts";
92
+ readonly tags: readonly ["files"];
63
93
  readonly category: "files";
64
94
  readonly requiresWorkspace: true;
65
95
  readonly description: "Publish Workspace files as downloadable Artifacts.";
66
96
  }, {
67
97
  readonly name: "write_todos";
98
+ readonly tags: readonly ["planning"];
68
99
  readonly category: "planning";
69
100
  readonly requiresWorkspace: false;
70
101
  readonly description: "Plan and track multi-step work with a todo list.";
71
102
  }, {
72
103
  readonly name: "save_memory";
104
+ readonly tags: readonly ["memory"];
73
105
  readonly category: "memory";
74
106
  readonly requiresWorkspace: false;
75
107
  readonly description: "Save a durable note.";
76
108
  }, {
77
109
  readonly name: "get_memory";
110
+ readonly tags: readonly ["memory"];
78
111
  readonly category: "memory";
79
112
  readonly requiresWorkspace: false;
80
113
  readonly description: "Read one saved note.";
81
114
  }, {
82
115
  readonly name: "search_memories";
116
+ readonly tags: readonly ["memory"];
83
117
  readonly category: "memory";
84
118
  readonly requiresWorkspace: false;
85
119
  readonly description: "Search saved notes.";
86
120
  }, {
87
121
  readonly name: "update_memory";
122
+ readonly tags: readonly ["memory"];
88
123
  readonly category: "memory";
89
124
  readonly requiresWorkspace: false;
90
125
  readonly description: "Update a saved note.";
91
126
  }, {
92
127
  readonly name: "delete_memory";
128
+ readonly tags: readonly ["memory"];
93
129
  readonly category: "memory";
94
130
  readonly requiresWorkspace: false;
95
131
  readonly description: "Delete a saved note.";
96
132
  }, {
97
133
  readonly name: "web_search";
134
+ readonly tags: readonly ["web"];
98
135
  readonly category: "web";
99
136
  readonly requiresWorkspace: false;
100
137
  readonly description: "Search the public web for current results. Each search consumes Usage credit.";
@@ -1,111 +1,143 @@
1
1
  import { z } from "zod";
2
2
  /**
3
- * Agent tools are toggled one by one. A category only groups tools for
4
- * display; it never enables anything on its own.
3
+ * Agent tools are toggled one by one. A tag describes a tool; it never enables
4
+ * anything on its own.
5
+ *
6
+ * Every tool has exactly one group tag, which display code groups tools by.
5
7
  */
6
- export const AGENT_TOOL_CATEGORIES = [
8
+ export const AGENT_TOOL_GROUPS = [
7
9
  {
8
- id: "files",
10
+ tag: "files",
9
11
  name: "File operations",
10
12
  description: "Read, write, edit, search, and run shell commands in the attached Workspace.",
11
13
  },
12
14
  {
13
- id: "planning",
15
+ tag: "planning",
14
16
  name: "Task planning",
15
17
  description: "Create and manage a structured todo list to plan and track multi-step work.",
16
18
  },
17
19
  {
18
- id: "memory",
20
+ tag: "memory",
19
21
  name: "Memory",
20
22
  description: "Save, recall, search, update, and delete durable notes owned by this Agent.",
21
23
  },
22
24
  {
23
- id: "web",
25
+ tag: "web",
24
26
  name: "Web",
25
27
  description: "Search the public web for current information.",
26
28
  },
27
29
  ];
30
+ /**
31
+ * What a file operation tool may do to the Workspace. `file_read` tools never
32
+ * change Workspace files, so an Agent limited to them is read-only.
33
+ * `execute` runs arbitrary commands, which can change files and more.
34
+ */
35
+ export const AGENT_TOOL_FILE_ACCESS_TAGS = [
36
+ "file_read",
37
+ "file_write",
38
+ "execute",
39
+ ];
40
+ export const AGENT_TOOL_TAGS = [
41
+ ...AGENT_TOOL_GROUPS.map((group) => group.tag),
42
+ ...AGENT_TOOL_FILE_ACCESS_TAGS,
43
+ ];
44
+ /** @deprecated Use `AGENT_TOOL_GROUPS`, keyed by `tag`. */
45
+ export const AGENT_TOOL_CATEGORIES = AGENT_TOOL_GROUPS.map(({ tag, ...group }) => ({ id: tag, ...group }));
28
46
  export const AGENT_TOOLS = [
29
47
  {
30
48
  name: "read",
49
+ tags: ["files", "file_read"],
31
50
  category: "files",
32
51
  requiresWorkspace: true,
33
52
  description: "Read a file from the Workspace.",
34
53
  },
35
54
  {
36
55
  name: "write",
56
+ tags: ["files", "file_write"],
37
57
  category: "files",
38
58
  requiresWorkspace: true,
39
59
  description: "Create or overwrite a file in the Workspace.",
40
60
  },
41
61
  {
42
62
  name: "edit",
63
+ tags: ["files", "file_write"],
43
64
  category: "files",
44
65
  requiresWorkspace: true,
45
66
  description: "Replace exact text in a Workspace file.",
46
67
  },
47
68
  {
48
69
  name: "grep",
70
+ tags: ["files", "file_read"],
49
71
  category: "files",
50
72
  requiresWorkspace: true,
51
73
  description: "Search Workspace file contents with a regular expression.",
52
74
  },
53
75
  {
54
76
  name: "glob",
77
+ tags: ["files", "file_read"],
55
78
  category: "files",
56
79
  requiresWorkspace: true,
57
80
  description: "Find Workspace files by path pattern.",
58
81
  },
59
82
  {
60
83
  name: "bash",
84
+ tags: ["files", "execute"],
61
85
  category: "files",
62
86
  requiresWorkspace: true,
63
87
  description: "Run shell commands in the Workspace.",
64
88
  },
65
89
  {
66
90
  name: "publish_artifacts",
91
+ tags: ["files"],
67
92
  category: "files",
68
93
  requiresWorkspace: true,
69
94
  description: "Publish Workspace files as downloadable Artifacts.",
70
95
  },
71
96
  {
72
97
  name: "write_todos",
98
+ tags: ["planning"],
73
99
  category: "planning",
74
100
  requiresWorkspace: false,
75
101
  description: "Plan and track multi-step work with a todo list.",
76
102
  },
77
103
  {
78
104
  name: "save_memory",
105
+ tags: ["memory"],
79
106
  category: "memory",
80
107
  requiresWorkspace: false,
81
108
  description: "Save a durable note.",
82
109
  },
83
110
  {
84
111
  name: "get_memory",
112
+ tags: ["memory"],
85
113
  category: "memory",
86
114
  requiresWorkspace: false,
87
115
  description: "Read one saved note.",
88
116
  },
89
117
  {
90
118
  name: "search_memories",
119
+ tags: ["memory"],
91
120
  category: "memory",
92
121
  requiresWorkspace: false,
93
122
  description: "Search saved notes.",
94
123
  },
95
124
  {
96
125
  name: "update_memory",
126
+ tags: ["memory"],
97
127
  category: "memory",
98
128
  requiresWorkspace: false,
99
129
  description: "Update a saved note.",
100
130
  },
101
131
  {
102
132
  name: "delete_memory",
133
+ tags: ["memory"],
103
134
  category: "memory",
104
135
  requiresWorkspace: false,
105
136
  description: "Delete a saved note.",
106
137
  },
107
138
  {
108
139
  name: "web_search",
140
+ tags: ["web"],
109
141
  category: "web",
110
142
  requiresWorkspace: false,
111
143
  description: "Search the public web for current results. Each search consumes Usage credit.",
@@ -361,6 +361,20 @@ export declare const continueToolApprovalsBodySchema: z.ZodObject<{
361
361
  inputSchema: z.ZodCustom<z.core.JSONSchema.JSONSchema, z.core.JSONSchema.JSONSchema>;
362
362
  }, z.core.$strict>>>;
363
363
  }, z.core.$strict>;
364
+ /**
365
+ * Transient event that precedes the `error` chunk when a Turn stream is cut
366
+ * after it started. The `error` chunk has no field for a code, so the code
367
+ * rides here. `turn_interrupted` is never an HTTP error code. The Turn may
368
+ * have saved its work before the cut, so read the Session's messages.
369
+ */
370
+ export declare const turnInterruptedEventSchema: z.ZodObject<{
371
+ type: z.ZodLiteral<"data-turn-interrupted">;
372
+ data: z.ZodObject<{
373
+ code: z.ZodLiteral<"turn_interrupted">;
374
+ }, z.core.$strict>;
375
+ transient: z.ZodLiteral<true>;
376
+ }, z.core.$strict>;
377
+ export type TurnInterruptedEvent = z.infer<typeof turnInterruptedEventSchema>;
364
378
  export type SessionForkedFrom = z.infer<typeof sessionForkedFromSchema>;
365
379
  export type SessionResponse = z.infer<typeof sessionResponseSchema>;
366
380
  export type SessionsListResponse = z.infer<typeof sessionsListResponseSchema>;
@@ -134,3 +134,16 @@ export const continueToolApprovalsBodySchema = z
134
134
  functions: chatFunctionDefinitionsSchema.optional(),
135
135
  })
136
136
  .strict();
137
+ /**
138
+ * Transient event that precedes the `error` chunk when a Turn stream is cut
139
+ * after it started. The `error` chunk has no field for a code, so the code
140
+ * rides here. `turn_interrupted` is never an HTTP error code. The Turn may
141
+ * have saved its work before the cut, so read the Session's messages.
142
+ */
143
+ export const turnInterruptedEventSchema = z
144
+ .object({
145
+ type: z.literal("data-turn-interrupted"),
146
+ data: z.object({ code: z.literal("turn_interrupted") }).strict(),
147
+ transient: z.literal(true),
148
+ })
149
+ .strict();
@@ -1,50 +1,7 @@
1
1
  import { z } from "zod";
2
- /**
3
- * `GET /v1/usage` groupBy — `day|agent|model|session|user`. `session` is
4
- * top-N by tokens; the others are exhaustive and bounded. `user` is the
5
- * end-user attribution dimension (ADR-0001) — one bucket per `userId`, with
6
- * `''` emitted verbatim as the tenant-level bucket.
7
- */
8
- export declare const usageGroupBySchema: z.ZodDefault<z.ZodEnum<{
9
- agent: "agent";
10
- day: "day";
11
- model: "model";
12
- session: "session";
13
- user: "user";
14
- }>>;
15
- /**
16
- * A `sessionId` filter value — either a real platform session id (`ss_…`)
17
- * or the `''` sentinel for stateless `completion`/`object` turns. The daily
18
- * table stores `''` for stateless turns; the bucket wire shape maps `''`
19
- * back to `null` on read (see `usageBucketSchema.sessionId`).
20
- */
21
- export declare const usageSessionFilterSchema: z.ZodString;
22
- /**
23
- * `?from=&to=&agentId=&sessionId=&userId=&groupBy=&limit=` — `from`/`to` are
24
- * date strings (`YYYY-MM-DD`) since the daily table is keyed by `day date`.
25
- * Range capped at 31 days; default is the last 30 days ending today (UTC).
26
- * The `sessionId` filter accepts `''` to drill into stateless turns only.
27
- * The `userId` filter accepts any opaque string (including `''` for
28
- * tenant-level usage only) — see ADR-0001 for the three filter modes.
29
- */
30
- export declare const usageQuerySchema: z.ZodObject<{
31
- from: z.ZodOptional<z.ZodISODate>;
32
- to: z.ZodOptional<z.ZodISODate>;
33
- agentId: z.ZodOptional<z.ZodString>;
34
- sessionId: z.ZodOptional<z.ZodString>;
35
- userId: z.ZodOptional<z.ZodString>;
36
- groupBy: z.ZodDefault<z.ZodEnum<{
37
- agent: "agent";
38
- day: "day";
39
- model: "model";
40
- session: "session";
41
- user: "user";
42
- }>>;
43
- limit: z.ZodDefault<z.ZodNumber>;
44
- }, z.core.$strict>;
45
2
  /**
46
3
  * Query for the bounded dashboard-oriented usage overview. The date range has
47
- * the same semantics as `usageQuerySchema`; `limit` bounds each ranking.
4
+ * the same semantics as `UsageQuery`; `limit` bounds each ranking.
48
5
  */
49
6
  export declare const usageOverviewQuerySchema: z.ZodObject<{
50
7
  from: z.ZodOptional<z.ZodISODate>;
@@ -236,7 +193,26 @@ export declare function usageOverviewResponseSchemaForQuery(query?: Partial<Usag
236
193
  }, z.core.$strip>>;
237
194
  activeAgentCount: z.ZodNumber;
238
195
  }, z.core.$strip>;
239
- export type UsageQuery = z.infer<typeof usageQuerySchema>;
196
+ /**
197
+ * `?from=&to=&agentId=&sessionId=&userId=&groupBy=&limit=` for `GET /v1/usage`.
198
+ * `from`/`to` are `YYYY-MM-DD` dates, both present or both absent and at most
199
+ * 31 days apart; the default is the last 30 days ending today (UTC). `groupBy`
200
+ * defaults to `day`; `session` is top-N by tokens, bounded by `limit` (default
201
+ * 50, at most 200), and `user` is the end-user attribution dimension
202
+ * (ADR-0001) with `''` emitted verbatim as the tenant-level bucket. The
203
+ * `sessionId` filter accepts `''` to drill into stateless `completion`/`object`
204
+ * turns; `userId` accepts any opaque string, including `''` for tenant-level
205
+ * usage only. The server enforces these rules; the SDK passes the query through.
206
+ */
207
+ export interface UsageQuery {
208
+ agentId?: string;
209
+ from?: string;
210
+ groupBy?: "day" | "agent" | "model" | "session" | "user";
211
+ limit?: number;
212
+ sessionId?: string;
213
+ to?: string;
214
+ userId?: string;
215
+ }
240
216
  export type UsageBucket = z.infer<typeof usageBucketSchema>;
241
217
  export type UsageTotals = z.infer<typeof usageTotalsSchema>;
242
218
  export type UsageResponse = z.infer<typeof usageResponseSchema>;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { agentIdSchema, sessionIdSchema } from "../ids.js";
3
- import { DEFAULT_USAGE_OVERVIEW_TOP_N, DEFAULT_USAGE_RANGE_DAYS, DEFAULT_USAGE_SESSION_TOP_N, MAX_USAGE_OVERVIEW_TOP_N, MAX_USAGE_RANGE_DAYS, MAX_USAGE_SESSION_TOP_N, } from "../limitations.js";
3
+ import { DEFAULT_USAGE_OVERVIEW_TOP_N, DEFAULT_USAGE_RANGE_DAYS, MAX_USAGE_OVERVIEW_TOP_N, MAX_USAGE_RANGE_DAYS, } from "../limitations.js";
4
4
  import { hasUniqueValues } from "../utils.js";
5
5
  import { userIdSchema } from "./attribution.js";
6
6
  /**
@@ -34,54 +34,9 @@ function validateUsageRange(value, ctx) {
34
34
  }
35
35
  }
36
36
  }
37
- /**
38
- * `GET /v1/usage` groupBy — `day|agent|model|session|user`. `session` is
39
- * top-N by tokens; the others are exhaustive and bounded. `user` is the
40
- * end-user attribution dimension (ADR-0001) — one bucket per `userId`, with
41
- * `''` emitted verbatim as the tenant-level bucket.
42
- */
43
- export const usageGroupBySchema = z
44
- .enum(["day", "agent", "model", "session", "user"])
45
- .default("day");
46
- /**
47
- * A `sessionId` filter value — either a real platform session id (`ss_…`)
48
- * or the `''` sentinel for stateless `completion`/`object` turns. The daily
49
- * table stores `''` for stateless turns; the bucket wire shape maps `''`
50
- * back to `null` on read (see `usageBucketSchema.sessionId`).
51
- */
52
- export const usageSessionFilterSchema = z
53
- .string()
54
- .refine((v) => v === "" || z.validate(sessionIdSchema, v), {
55
- message: "Must be a session id or '' for stateless turns.",
56
- });
57
- /**
58
- * `?from=&to=&agentId=&sessionId=&userId=&groupBy=&limit=` — `from`/`to` are
59
- * date strings (`YYYY-MM-DD`) since the daily table is keyed by `day date`.
60
- * Range capped at 31 days; default is the last 30 days ending today (UTC).
61
- * The `sessionId` filter accepts `''` to drill into stateless turns only.
62
- * The `userId` filter accepts any opaque string (including `''` for
63
- * tenant-level usage only) — see ADR-0001 for the three filter modes.
64
- */
65
- export const usageQuerySchema = z
66
- .object({
67
- from: z.iso.date().optional(),
68
- to: z.iso.date().optional(),
69
- agentId: agentIdSchema.optional(),
70
- sessionId: usageSessionFilterSchema.optional(),
71
- userId: userIdSchema.optional(),
72
- groupBy: usageGroupBySchema,
73
- limit: z
74
- .number()
75
- .int()
76
- .min(1)
77
- .max(MAX_USAGE_SESSION_TOP_N)
78
- .default(DEFAULT_USAGE_SESSION_TOP_N),
79
- })
80
- .strict()
81
- .superRefine(validateUsageRange);
82
37
  /**
83
38
  * Query for the bounded dashboard-oriented usage overview. The date range has
84
- * the same semantics as `usageQuerySchema`; `limit` bounds each ranking.
39
+ * the same semantics as `UsageQuery`; `limit` bounds each ranking.
85
40
  */
86
41
  export const usageOverviewQuerySchema = z
87
42
  .object({
@@ -2,8 +2,8 @@
2
2
  export { receivedApiErrorResponseSchema } from "./api.ts";
3
3
  export type { ApprovalDecision, ApprovalPolicy, ToolExecutionReference, ToolReference, } from "./entities/agent-approval.ts";
4
4
  export { approvalDecisionSchema, approvalPolicySchema, toolExecutionReferenceSchema, toolReferenceSchema, } from "./entities/agent-approval.ts";
5
- export type { AgentToolCategoryId, AgentToolDefinition, AgentToolName, } from "./entities/agent-tools.ts";
6
- export { AGENT_TOOL_CATEGORIES, AGENT_TOOLS, agentToolNames, chatFunctionNameSchema, } from "./entities/agent-tools.ts";
5
+ export type { AgentToolCategoryId, AgentToolDefinition, AgentToolFileAccessTag, AgentToolGroupTag, AgentToolName, AgentToolTag, AgentToolTags, } from "./entities/agent-tools.ts";
6
+ export { AGENT_TOOL_CATEGORIES, AGENT_TOOL_FILE_ACCESS_TAGS, AGENT_TOOL_GROUPS, AGENT_TOOL_TAGS, AGENT_TOOLS, agentToolNames, chatFunctionNameSchema, } from "./entities/agent-tools.ts";
7
7
  export { agentConfigSchema, agentResponseSchema, agentStatusSchema, agentsListQuerySchema, agentsResponseSchema, createAgentBodySchema, updateAgentBodySchema, } from "./entities/agents.ts";
8
8
  export { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsListResponseSchema, } from "./entities/artifacts.ts";
9
9
  export { attributionCreateInputSchema, metadataSchema, } from "./entities/attribution.ts";
@@ -17,8 +17,8 @@ export { createPromptBodySchema, parsePromptVariables, promptResponseSchema, pro
17
17
  export { createProviderBodySchema, providerListItemSchema, providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, providerTypeSchema, thinkingLevelsResponseSchema, updateProviderBodySchema, } from "./entities/providers.ts";
18
18
  export type { ChatSteerConsumedEvent, SessionActivity, SessionInput, SessionInputResponse, SessionInputState, SessionInputsQuery, SessionInputsResponse, StopSessionBody, StopSessionResponse, SubmitSessionInputBody, } from "./entities/session-inputs.ts";
19
19
  export { chatSteerConsumedEventSchema, sessionActivitySchema, sessionInputRequestIdSchema, sessionInputResponseSchema, sessionInputSchema, sessionInputStateSchema, sessionInputsQuerySchema, sessionInputsResponseSchema, stopSessionBodySchema, stopSessionResponseSchema, submitSessionInputBodySchema, } from "./entities/session-inputs.ts";
20
- export type { ContinueToolApprovalsBody, SessionForkedFrom, ToolApprovalContinuationState, ToolApprovalDecision, ToolApprovalsResponse, } from "./entities/sessions.ts";
21
- export { continueToolApprovalsBodySchema, latestSessionListItemSchema, latestSessionsListResponseSchema, sessionForkedFromSchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.ts";
20
+ export type { ContinueToolApprovalsBody, SessionForkedFrom, ToolApprovalContinuationState, ToolApprovalDecision, ToolApprovalsResponse, TurnInterruptedEvent, } from "./entities/sessions.ts";
21
+ export { continueToolApprovalsBodySchema, latestSessionListItemSchema, latestSessionsListResponseSchema, sessionForkedFromSchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, turnInterruptedEventSchema, } from "./entities/sessions.ts";
22
22
  export { copySkillBodySchema, createSkillBodySchema, skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "./entities/skills.ts";
23
23
  export type { SpendingLimit, SpendingLimitResponse, SpendingLimitStopDetails, SpendingLimitStopEvent, UpdateSpendingLimitBody, } from "./entities/spending-limits.ts";
24
24
  export { nextSpendingLimitReset, spendingLimitPeriodSchema, spendingLimitResetIntervalSchema, spendingLimitResponseSchema, spendingLimitSchema, spendingLimitStopDetailsSchema, spendingLimitStopEventSchema, updateSpendingLimitBodySchema, } from "./entities/spending-limits.ts";
@@ -2,7 +2,7 @@
2
2
  // biome-ignore lint/performance/noBarrelFile: public contract entry point
3
3
  export { receivedApiErrorResponseSchema } from "./api.js";
4
4
  export { approvalDecisionSchema, approvalPolicySchema, toolExecutionReferenceSchema, toolReferenceSchema, } from "./entities/agent-approval.js";
5
- export { AGENT_TOOL_CATEGORIES, AGENT_TOOLS, agentToolNames, chatFunctionNameSchema, } from "./entities/agent-tools.js";
5
+ export { AGENT_TOOL_CATEGORIES, AGENT_TOOL_FILE_ACCESS_TAGS, AGENT_TOOL_GROUPS, AGENT_TOOL_TAGS, AGENT_TOOLS, agentToolNames, chatFunctionNameSchema, } from "./entities/agent-tools.js";
6
6
  export { agentConfigSchema, agentResponseSchema, agentStatusSchema, agentsListQuerySchema, agentsResponseSchema, createAgentBodySchema, updateAgentBodySchema, } from "./entities/agents.js";
7
7
  export { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsListResponseSchema, } from "./entities/artifacts.js";
8
8
  export { attributionCreateInputSchema, metadataSchema, } from "./entities/attribution.js";
@@ -14,7 +14,7 @@ export { createMerchantConnectionBodySchema, merchantBindingResponseSchema, merc
14
14
  export { createPromptBodySchema, parsePromptVariables, promptResponseSchema, promptsListQuerySchema, promptsResponseSchema, promptTemplateSchema, renderPromptTemplate, updatePromptBodySchema, } from "./entities/prompts.js";
15
15
  export { createProviderBodySchema, providerListItemSchema, providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, providerTypeSchema, thinkingLevelsResponseSchema, updateProviderBodySchema, } from "./entities/providers.js";
16
16
  export { chatSteerConsumedEventSchema, sessionActivitySchema, sessionInputRequestIdSchema, sessionInputResponseSchema, sessionInputSchema, sessionInputStateSchema, sessionInputsQuerySchema, sessionInputsResponseSchema, stopSessionBodySchema, stopSessionResponseSchema, submitSessionInputBodySchema, } from "./entities/session-inputs.js";
17
- export { continueToolApprovalsBodySchema, latestSessionListItemSchema, latestSessionsListResponseSchema, sessionForkedFromSchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.js";
17
+ export { continueToolApprovalsBodySchema, latestSessionListItemSchema, latestSessionsListResponseSchema, sessionForkedFromSchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, turnInterruptedEventSchema, } from "./entities/sessions.js";
18
18
  export { copySkillBodySchema, createSkillBodySchema, skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "./entities/skills.js";
19
19
  export { nextSpendingLimitReset, spendingLimitPeriodSchema, spendingLimitResetIntervalSchema, spendingLimitResponseSchema, spendingLimitSchema, spendingLimitStopDetailsSchema, spendingLimitStopEventSchema, updateSpendingLimitBodySchema, } from "./entities/spending-limits.js";
20
20
  export { createTaskBodySchema, createTaskResponseSchema, createTaskRunBodySchema, createTaskRunResponseSchema, taskCronConfigSchema, taskIntervalConfigSchema, taskListItemSchema, taskOnceConfigSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunStatusSchema, taskRunsListResponseSchema, taskScheduleInputSchema, taskScheduleKindSchema, tasksListResponseSchema, updateTaskBodySchema, } from "./entities/tasks.js";
@@ -45,13 +45,8 @@ export declare const MAX_AGENT_INSTRUCTIONS_LENGTH = 3000;
45
45
  export declare const MAX_ARTIFACT_BYTES: number;
46
46
  /** Memories — 10 KiB of text per memory. */
47
47
  export declare const MAX_MEMORY_TEXT_BYTES: number;
48
- /**
49
- * Usage — range cap 31 days, default 30 days; top-N sessions default 50, max 200.
50
- */
51
48
  export declare const MAX_USAGE_RANGE_DAYS = 31;
52
49
  export declare const DEFAULT_USAGE_RANGE_DAYS = 30;
53
- export declare const DEFAULT_USAGE_SESSION_TOP_N = 50;
54
- export declare const MAX_USAGE_SESSION_TOP_N = 200;
55
50
  export declare const DEFAULT_USAGE_OVERVIEW_TOP_N = 5;
56
51
  export declare const MAX_USAGE_OVERVIEW_TOP_N = 20;
57
52
  export declare const MIN_QUOTA_RESET_DAY = 1;
@@ -45,13 +45,9 @@ export const MAX_AGENT_INSTRUCTIONS_LENGTH = 3000;
45
45
  export const MAX_ARTIFACT_BYTES = 10 * 1024 * 1024;
46
46
  /** Memories — 10 KiB of text per memory. */
47
47
  export const MAX_MEMORY_TEXT_BYTES = 10 * 1024;
48
- /**
49
- * Usage — range cap 31 days, default 30 days; top-N sessions default 50, max 200.
50
- */
48
+ // Usage — range cap 31 days, default 30 days; overview rankings default 5, max 20.
51
49
  export const MAX_USAGE_RANGE_DAYS = 31;
52
50
  export const DEFAULT_USAGE_RANGE_DAYS = 30;
53
- export const DEFAULT_USAGE_SESSION_TOP_N = 50;
54
- export const MAX_USAGE_SESSION_TOP_N = 200;
55
51
  export const DEFAULT_USAGE_OVERVIEW_TOP_N = 5;
56
52
  export const MAX_USAGE_OVERVIEW_TOP_N = 20;
57
53
  // Quota — reset day between 1 and 28.
package/dist/http.d.ts CHANGED
@@ -46,4 +46,4 @@ export declare function requestAbortedError(cause: unknown): BlazingAgentsError;
46
46
  * @param headers - Response headers to preserve or inspect.
47
47
  * @returns The server error, or invalid_response when the envelope is malformed.
48
48
  */
49
- export declare function parseErrorEnvelope(bodyText: string, status: number, headers?: Headers): BlazingAgentsError;
49
+ export declare function parseErrorEnvelope(bodyText: string, status: number, headers: Headers): BlazingAgentsError;
package/dist/http.js CHANGED
@@ -305,7 +305,7 @@ function decodeChunks(chunks, byteLength, truncated) {
305
305
  * @param headers - Response headers to preserve or inspect.
306
306
  * @returns The server error, or invalid_response when the envelope is malformed.
307
307
  */
308
- export function parseErrorEnvelope(bodyText, status, headers = new Headers()) {
308
+ export function parseErrorEnvelope(bodyText, status, headers) {
309
309
  let parsed;
310
310
  if (bodyText.length === 0) {
311
311
  parsed = null;
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export type { UIMessage } from "ai";
7
7
  export { BlazingAgentsChatTransport, type BlazingAgentsChatTransportOptions, } from "./chat-transport.ts";
8
8
  export { BlazingAgents } from "./client.ts";
9
9
  export type { ApprovalDecision, ApprovalPolicy, ToolExecutionReference, ToolReference, } from "./contracts/entities/agent-approval.ts";
10
- export { AGENT_TOOL_CATEGORIES, AGENT_TOOLS, type AgentToolCategoryId, type AgentToolDefinition, type AgentToolName, } from "./contracts/entities/agent-tools.ts";
10
+ export { AGENT_TOOL_CATEGORIES, AGENT_TOOL_FILE_ACCESS_TAGS, AGENT_TOOL_GROUPS, AGENT_TOOL_TAGS, AGENT_TOOLS, type AgentToolCategoryId, type AgentToolDefinition, type AgentToolFileAccessTag, type AgentToolGroupTag, type AgentToolName, type AgentToolTag, type AgentToolTags, } from "./contracts/entities/agent-tools.ts";
11
11
  export type { Agent, AgentConfig, AgentResponse, AgentsListQuery, AgentsResponse, CreateAgentBody, UpdateAgentBody, } from "./contracts/entities/agents.ts";
12
12
  export { agentConfigSchema } from "./contracts/entities/agents.ts";
13
13
  export type { ArtifactDownloadUrlResponse, ArtifactListItem, ArtifactsListResponse, } from "./contracts/entities/artifacts.ts";
@@ -17,7 +17,7 @@ export type { CreateMerchantConnectionBody, MerchantBindingResponse, MerchantBin
17
17
  export type { CreatePromptBody, PromptResponse, PromptsListQuery, PromptsResponse, UpdatePromptBody, } from "./contracts/entities/prompts.ts";
18
18
  export type { CreateProviderBody, ProviderListItem, ProviderModel, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ProviderType, ThinkingLevelsResponse, UpdateProviderBody, } from "./contracts/entities/providers.ts";
19
19
  export type { ChatSteerConsumedEvent, SessionActivity, SessionInput, SessionInputResponse, SessionInputState, SessionInputsQuery, SessionInputsResponse, StopSessionBody, StopSessionResponse, SubmitSessionInputBody, } from "./contracts/entities/session-inputs.ts";
20
- export type { ContinueToolApprovalsBody, SessionForkedFrom, SessionResponse, ToolApprovalDecision, ToolApprovalState, ToolApprovalsResponse, } from "./contracts/entities/sessions.ts";
20
+ export type { ContinueToolApprovalsBody, SessionForkedFrom, SessionResponse, ToolApprovalDecision, ToolApprovalState, ToolApprovalsResponse, TurnInterruptedEvent, } from "./contracts/entities/sessions.ts";
21
21
  export { sessionResponseSchema } from "./contracts/entities/sessions.ts";
22
22
  export type { CreateSkillBody, Skill, SkillArchiveType, SkillCopyResult, SkillCopyResults, SkillDetail, SkillFile, SkillsListResponse, } from "./contracts/entities/skills.ts";
23
23
  export type { SpendingLimit, SpendingLimitResponse, SpendingLimitStopDetails, SpendingLimitStopEvent, UpdateSpendingLimitBody, } from "./contracts/entities/spending-limits.ts";
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  // biome-ignore lint/performance/noBarrelFile: package entry point
7
7
  export { BlazingAgentsChatTransport, } from "./chat-transport.js";
8
8
  export { BlazingAgents } from "./client.js";
9
- export { AGENT_TOOL_CATEGORIES, AGENT_TOOLS, } from "./contracts/entities/agent-tools.js";
9
+ export { AGENT_TOOL_CATEGORIES, AGENT_TOOL_FILE_ACCESS_TAGS, AGENT_TOOL_GROUPS, AGENT_TOOL_TAGS, AGENT_TOOLS, } from "./contracts/entities/agent-tools.js";
10
10
  export { agentConfigSchema } from "./contracts/entities/agents.js";
11
11
  export { sessionResponseSchema } from "./contracts/entities/sessions.js";
12
12
  export { nextSpendingLimitReset } from "./contracts/entities/spending-limits.js";
@@ -1,8 +1,8 @@
1
1
  import type { HttpConfig, UsageResource } from "../types.ts";
2
2
  /**
3
3
  * `client.usage` — get over `/v1/usage` (tenant-wide) and
4
- * `/v1/agents/:agentId/usage` (per-agent). The query shape is the core
5
- * `usageQuerySchema`; the SDK passes it through as query params.
4
+ * `/v1/agents/:agentId/usage` (per-agent). The query shape is `UsageQuery`;
5
+ * the SDK passes it through as query params.
6
6
  * @param config - Shared authentication and transport configuration.
7
7
  * @returns The configured resource client.
8
8
  */
@@ -2,8 +2,8 @@ import { sessionUsageQuerySchema, sessionUsageResponseSchema, usageOverviewRespo
2
2
  import { requestJson } from "../http.js";
3
3
  /**
4
4
  * `client.usage` — get over `/v1/usage` (tenant-wide) and
5
- * `/v1/agents/:agentId/usage` (per-agent). The query shape is the core
6
- * `usageQuerySchema`; the SDK passes it through as query params.
5
+ * `/v1/agents/:agentId/usage` (per-agent). The query shape is `UsageQuery`;
6
+ * the SDK passes it through as query params.
7
7
  * @param config - Shared authentication and transport configuration.
8
8
  * @returns The configured resource client.
9
9
  */
package/dist/types.d.ts CHANGED
@@ -10,7 +10,7 @@ import type { CreateMerchantConnectionBody, MerchantBindingResponse, MerchantBin
10
10
  import type { CreatePromptBody, PromptResponse, PromptsResponse, UpdatePromptBody } from "./contracts/entities/prompts.ts";
11
11
  import type { CreateProviderBody, DeleteProviderOptions, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ThinkingLevelsResponse, UpdateProviderBody } from "./contracts/entities/providers.ts";
12
12
  import type { ChatSteerConsumedEvent, SessionInputResponse, SessionInputsQuery, SessionInputsResponse, StopSessionBody, StopSessionResponse, SubmitSessionInputBody } from "./contracts/entities/session-inputs.ts";
13
- import type { LatestSessionsListResponse, SessionMessagesResponse, SessionResponse, SessionsListResponse, ToolApprovalDecision, ToolApprovalsResponse } from "./contracts/entities/sessions.ts";
13
+ import type { LatestSessionsListResponse, SessionMessagesResponse, SessionResponse, SessionsListResponse, ToolApprovalDecision, ToolApprovalsResponse, TurnInterruptedEvent } from "./contracts/entities/sessions.ts";
14
14
  import type { CreateSkillBody, SkillArchiveType, SkillCopyResults, SkillDetail, SkillsListResponse } from "./contracts/entities/skills.ts";
15
15
  import type { SpendingLimitResponse, SpendingLimitStopEvent, UpdateSpendingLimitBody } from "./contracts/entities/spending-limits.ts";
16
16
  import type { CreateTaskBody, CreateTaskResponse, CreateTaskRunBody, CreateTaskRunResponse, TaskResponse, TaskRunMessagesResponse, TaskRunResponse, TaskRunsListResponse, TasksListResponse, UpdateTaskBody } from "./contracts/entities/tasks.ts";
@@ -118,7 +118,7 @@ export interface ResponseObservation {
118
118
  status: number;
119
119
  }
120
120
  export type ChatTrigger = "submit-message" | "regenerate-message";
121
- export type BlazingAgentsUIMessageData = Record<"ba-steer-consumed", ChatSteerConsumedEvent["data"]> & Record<"model-spending-limit", SpendingLimitStopEvent["data"]>;
121
+ export type BlazingAgentsUIMessageData = Record<"ba-steer-consumed", ChatSteerConsumedEvent["data"]> & Record<"model-spending-limit", SpendingLimitStopEvent["data"]> & Record<"turn-interrupted", TurnInterruptedEvent["data"]>;
122
122
  export type BlazingAgentsUIMessage = UIMessage<BlazingAgentsChatMessageMetadata, BlazingAgentsUIMessageData>;
123
123
  export type BlazingAgentsUIMessageChunk = UIMessageChunk<BlazingAgentsChatMessageMetadata, BlazingAgentsUIMessageData>;
124
124
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazingagents/sdk",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "TypeScript SDK for the Blazing Agents API",
5
5
  "homepage": "https://docs.blazingagents.com",
6
6
  "bugs": {
@@ -29,6 +29,7 @@
29
29
  "README.md"
30
30
  ],
31
31
  "scripts": {
32
+ "agent-tools:json": "node scripts/write-agent-tools-json.ts",
32
33
  "build": "rm -rf dist && tsc -p tsconfig.build.json",
33
34
  "check": "npm run typecheck && npm run test && npm run lint && npm run unused",
34
35
  "fix": "ultracite fix",