@blazingagents/sdk 0.10.0 → 0.12.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
@@ -239,6 +239,18 @@ Use the [connection example](https://github.com/blazingagents/typescript-sdk/blo
239
239
  Agent through REST. BA hosts the Chat SDK runtime, conversation history, and
240
240
  approval cards; no additional SDK resource is required.
241
241
 
242
+ `client.chatDeliveries.list` reads the Tenant-wide delivery feed across all
243
+ Chat Connections, newest first. `status` accepts `failed` and/or `ambiguous`;
244
+ omitting it returns both. For example, the failed and ambiguous deliveries
245
+ since a timestamp:
246
+
247
+ ```ts
248
+ const page = await client.chatDeliveries.list({
249
+ status: ["failed", "ambiguous"],
250
+ since: "2026-09-01T00:00:00.000Z",
251
+ });
252
+ ```
253
+
242
254
  ## Merchant monetization
243
255
 
244
256
  Bill your own customers for model-token usage through your Polar or Dodo
package/dist/client.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import type { AgentClient, AgentsResource, ArtifactsResource, BlazingAgentsOptions, BlazingAgentsRequestOptions, ChatConnectionsResource, ChatInput, ChatResult, CompletionInput, CompletionResult, McpConnectionsResource, MemoriesResource, MerchantBindingsResource, MerchantConnectionResource, MerchantUsageEventsResource, ObjectInput, ObjectResult, PromptsResource, ProvidersResource, SessionsResource, TasksResource, TenantResource, UsageResource, WorkspacesResource } from "./types.ts";
1
+ import type { AgentClient, AgentsResource, ArtifactsResource, BlazingAgentsOptions, BlazingAgentsRequestOptions, ChatConnectionsResource, ChatDeliveriesResource, ChatInput, ChatResult, CompletionInput, CompletionResult, McpConnectionsResource, MemoriesResource, MerchantBindingsResource, MerchantConnectionResource, MerchantUsageEventsResource, ObjectInput, ObjectResult, PromptsResource, ProvidersResource, SessionsResource, TasksResource, TenantResource, UsageResource, WorkspacesResource } from "./types.ts";
2
2
  export declare class BlazingAgents {
3
3
  private readonly config;
4
4
  readonly chatConnections: ChatConnectionsResource;
5
+ readonly chatDeliveries: ChatDeliveriesResource;
5
6
  readonly agents: AgentsResource;
6
7
  readonly sessions: SessionsResource;
7
8
  readonly providers: ProvidersResource;
package/dist/client.js CHANGED
@@ -2,6 +2,7 @@ import { chat, completion, objectGeneration } from "./generation.js";
2
2
  import { createAgentsResource } from "./resources/agents.js";
3
3
  import { createArtifactsResource } from "./resources/artifacts.js";
4
4
  import { createChatConnectionsResource } from "./resources/chat-connections.js";
5
+ import { createChatDeliveriesResource } from "./resources/chat-deliveries.js";
5
6
  import { createMcpConnectionsResource } from "./resources/mcp-connections.js";
6
7
  import { createMemoriesResource } from "./resources/memories.js";
7
8
  import { createMerchantBindingsResource } from "./resources/merchant-bindings.js";
@@ -20,6 +21,7 @@ const TRAILING_SLASH_RE = /\/+$/;
20
21
  export class BlazingAgents {
21
22
  config;
22
23
  chatConnections;
24
+ chatDeliveries;
23
25
  agents;
24
26
  sessions;
25
27
  providers;
@@ -45,6 +47,7 @@ export class BlazingAgents {
45
47
  onResponse: options.onResponse,
46
48
  };
47
49
  this.chatConnections = createChatConnectionsResource(this.config);
50
+ this.chatDeliveries = createChatDeliveriesResource(this.config);
48
51
  this.agents = createAgentsResource(this.config);
49
52
  this.sessions = createSessionsResource(this.config);
50
53
  this.providers = createProvidersResource(this.config);
@@ -187,3 +187,105 @@ export declare const chatConnectionsResponseSchema: z.ZodObject<{
187
187
  }, z.core.$strip>;
188
188
  export type ChatConnectionsResponse = z.output<typeof chatConnectionsResponseSchema>;
189
189
  export type RotateChatConnectionBody = z.input<typeof rotateChatConnectionBodySchema>;
190
+ export declare const chatDeliveryStatusSchema: z.ZodEnum<{
191
+ ambiguous: "ambiguous";
192
+ confirmed: "confirmed";
193
+ failed: "failed";
194
+ pending: "pending";
195
+ }>;
196
+ export type ChatDeliveryStatus = z.infer<typeof chatDeliveryStatusSchema>;
197
+ export declare const chatDeliveryListStatusSchema: z.ZodEnum<{
198
+ ambiguous: "ambiguous";
199
+ failed: "failed";
200
+ }>;
201
+ export type ChatDeliveryListStatus = z.infer<typeof chatDeliveryListStatusSchema>;
202
+ export declare const chatDeliverySchema: z.ZodObject<{
203
+ id: z.ZodString;
204
+ kind: z.ZodEnum<{
205
+ card: "card";
206
+ reply: "reply";
207
+ }>;
208
+ status: z.ZodEnum<{
209
+ ambiguous: "ambiguous";
210
+ confirmed: "confirmed";
211
+ failed: "failed";
212
+ pending: "pending";
213
+ }>;
214
+ attempt: z.ZodNumber;
215
+ credentialVersion: z.ZodNumber;
216
+ representation: z.ZodString;
217
+ diagnostic: z.ZodNullable<z.ZodString>;
218
+ receipts: z.ZodOptional<z.ZodUnknown>;
219
+ sessionId: z.ZodString;
220
+ messageId: z.ZodNullable<z.ZodString>;
221
+ approvalId: z.ZodNullable<z.ZodString>;
222
+ threadId: z.ZodString;
223
+ createdAt: z.ZodString;
224
+ updatedAt: z.ZodString;
225
+ }, z.core.$strip>;
226
+ export type ChatDelivery = z.infer<typeof chatDeliverySchema>;
227
+ export declare const tenantChatDeliverySchema: z.ZodObject<{
228
+ id: z.ZodString;
229
+ kind: z.ZodEnum<{
230
+ card: "card";
231
+ reply: "reply";
232
+ }>;
233
+ status: z.ZodEnum<{
234
+ ambiguous: "ambiguous";
235
+ confirmed: "confirmed";
236
+ failed: "failed";
237
+ pending: "pending";
238
+ }>;
239
+ attempt: z.ZodNumber;
240
+ credentialVersion: z.ZodNumber;
241
+ representation: z.ZodString;
242
+ diagnostic: z.ZodNullable<z.ZodString>;
243
+ receipts: z.ZodOptional<z.ZodUnknown>;
244
+ sessionId: z.ZodString;
245
+ messageId: z.ZodNullable<z.ZodString>;
246
+ approvalId: z.ZodNullable<z.ZodString>;
247
+ threadId: z.ZodString;
248
+ createdAt: z.ZodString;
249
+ updatedAt: z.ZodString;
250
+ connectionId: z.ZodString;
251
+ agentId: z.ZodString;
252
+ platform: z.ZodEnum<{
253
+ slack: "slack";
254
+ telegram: "telegram";
255
+ }>;
256
+ }, z.core.$strip>;
257
+ export type TenantChatDelivery = z.infer<typeof tenantChatDeliverySchema>;
258
+ export declare const chatDeliveriesResponseSchema: z.ZodObject<{
259
+ data: z.ZodArray<z.ZodObject<{
260
+ id: z.ZodString;
261
+ kind: z.ZodEnum<{
262
+ card: "card";
263
+ reply: "reply";
264
+ }>;
265
+ status: z.ZodEnum<{
266
+ ambiguous: "ambiguous";
267
+ confirmed: "confirmed";
268
+ failed: "failed";
269
+ pending: "pending";
270
+ }>;
271
+ attempt: z.ZodNumber;
272
+ credentialVersion: z.ZodNumber;
273
+ representation: z.ZodString;
274
+ diagnostic: z.ZodNullable<z.ZodString>;
275
+ receipts: z.ZodOptional<z.ZodUnknown>;
276
+ sessionId: z.ZodString;
277
+ messageId: z.ZodNullable<z.ZodString>;
278
+ approvalId: z.ZodNullable<z.ZodString>;
279
+ threadId: z.ZodString;
280
+ createdAt: z.ZodString;
281
+ updatedAt: z.ZodString;
282
+ connectionId: z.ZodString;
283
+ agentId: z.ZodString;
284
+ platform: z.ZodEnum<{
285
+ slack: "slack";
286
+ telegram: "telegram";
287
+ }>;
288
+ }, z.core.$strip>>;
289
+ nextCursor: z.ZodNullable<z.ZodString>;
290
+ }, z.core.$strip>;
291
+ export type ChatDeliveriesResponse = z.infer<typeof chatDeliveriesResponseSchema>;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { agentIdSchema, chatConnectionIdSchema, tenantIdSchema, } from "../ids.js";
2
+ import { agentIdSchema, chatConnectionIdSchema, chatDeliveryIdSchema, tenantIdSchema, } from "../ids.js";
3
3
  const secret = z
4
4
  .string()
5
5
  .min(8)
@@ -140,3 +140,39 @@ export const chatConnectionSchema = z
140
140
  export const chatConnectionsResponseSchema = z
141
141
  .object({ chatConnections: z.array(chatConnectionSchema) })
142
142
  .strip();
143
+ export const chatDeliveryStatusSchema = z.enum([
144
+ "pending",
145
+ "confirmed",
146
+ "failed",
147
+ "ambiguous",
148
+ ]);
149
+ export const chatDeliveryListStatusSchema = z.enum(["failed", "ambiguous"]);
150
+ export const chatDeliverySchema = z
151
+ .object({
152
+ id: chatDeliveryIdSchema,
153
+ kind: z.enum(["reply", "card"]),
154
+ status: chatDeliveryStatusSchema,
155
+ attempt: z.number().int().nonnegative(),
156
+ credentialVersion: z.number().int().nonnegative(),
157
+ representation: z.string(),
158
+ diagnostic: z.string().nullable(),
159
+ receipts: z.unknown().optional(),
160
+ sessionId: z.string(),
161
+ messageId: z.string().nullable(),
162
+ approvalId: z.string().nullable(),
163
+ threadId: z.string(),
164
+ createdAt: z.string(),
165
+ updatedAt: z.string(),
166
+ })
167
+ .strip();
168
+ export const tenantChatDeliverySchema = chatDeliverySchema.extend({
169
+ connectionId: chatConnectionIdSchema,
170
+ agentId: agentIdSchema,
171
+ platform: z.enum(["slack", "telegram"]),
172
+ });
173
+ export const chatDeliveriesResponseSchema = z
174
+ .object({
175
+ data: z.array(tenantChatDeliverySchema),
176
+ nextCursor: z.string().nullable(),
177
+ })
178
+ .strip();
@@ -96,19 +96,10 @@ type ExclusivePromptInput<Literal extends object> = (Literal & {
96
96
  /**
97
97
  * `POST /v1/agents/{agentId}/sessions` (create) and
98
98
  * `POST /v1/agents/{agentId}/sessions/{sessionId}` (resume) request body.
99
- * The platform mints the `ss_` session id on the create path and returns
100
- * it via the `Location` header; the URL presence (no id → create, id
101
- * present → resume) is the mode — there is no `id` or `mode` field here.
102
- * `message` is the literal input; the prompt-invocation alternative
103
- * (`promptId` + `variables`) is mutually exclusive with `message` — both
104
- * present or neither → 400 invalid_request. `variables` is only allowed
105
- * on the prompt-invocation path: a request carrying both `message` and
106
- * `variables` (without `promptId`) is a mixed shape and is rejected
107
- * (strict both ways). The route layer resolves the prompt template,
108
- * renders, and substitutes a server-constructed user `UIMessage` with a
109
- * single text part carrying the rendered string. `trigger` /
110
- * `messageId` are turn-level concerns (regenerate rides on the resume
111
- * route only — enforced by the route layer, not the schema).
99
+ * The URL selects the mode; on create the platform mints the `ss_` id and
100
+ * returns it in `Location`. Exactly one of `message` or `promptId` is
101
+ * required, and `variables` requires `promptId`. Regenerate is resume-only,
102
+ * enforced by the route layer rather than this schema.
112
103
  */
113
104
  export declare const chatRequestBodySchema: z.ZodObject<{
114
105
  message: z.ZodOptional<z.ZodUnknown>;
@@ -61,19 +61,10 @@ export const promptVariablesSchema = z.record(z.string(), z.string());
61
61
  /**
62
62
  * `POST /v1/agents/{agentId}/sessions` (create) and
63
63
  * `POST /v1/agents/{agentId}/sessions/{sessionId}` (resume) request body.
64
- * The platform mints the `ss_` session id on the create path and returns
65
- * it via the `Location` header; the URL presence (no id → create, id
66
- * present → resume) is the mode — there is no `id` or `mode` field here.
67
- * `message` is the literal input; the prompt-invocation alternative
68
- * (`promptId` + `variables`) is mutually exclusive with `message` — both
69
- * present or neither → 400 invalid_request. `variables` is only allowed
70
- * on the prompt-invocation path: a request carrying both `message` and
71
- * `variables` (without `promptId`) is a mixed shape and is rejected
72
- * (strict both ways). The route layer resolves the prompt template,
73
- * renders, and substitutes a server-constructed user `UIMessage` with a
74
- * single text part carrying the rendered string. `trigger` /
75
- * `messageId` are turn-level concerns (regenerate rides on the resume
76
- * route only — enforced by the route layer, not the schema).
64
+ * The URL selects the mode; on create the platform mints the `ss_` id and
65
+ * returns it in `Location`. Exactly one of `message` or `promptId` is
66
+ * required, and `variables` requires `promptId`. Regenerate is resume-only,
67
+ * enforced by the route layer rather than this schema.
77
68
  */
78
69
  export const chatRequestBodySchema = z
79
70
  .object({
@@ -89,11 +80,8 @@ export const chatRequestBodySchema = z
89
80
  messageId: z.string().min(1).optional(),
90
81
  version: agentVersionNumberSchema.optional(),
91
82
  /**
92
- * End-user attribution for the session + this turn's usage
93
- * (ADR-0001). `userId` is opaque text (`''` = tenant-level); it stamps
94
- * the session row at lazy materialization (create path) and every
95
- * `token_usage_*` row this turn records. `metadata` is a mutable jsonb
96
- * object carried onto the same rows. Both default to tenant-level.
83
+ * End-user attribution (ADR-0001), stamped on the Session at lazy
84
+ * materialization and on every usage row this Turn records.
97
85
  */
98
86
  userId: userIdSchema.default(""),
99
87
  metadata: metadataSchema.default({}),
@@ -36,9 +36,8 @@ export declare const providerSchema: z.ZodObject<{
36
36
  updatedAt: z.ZodISODateTime;
37
37
  }, z.core.$strict>;
38
38
  /**
39
- * Wire response — `GET /v1/providers/{id}` shape per
40
- * ticket 12: `{ id, name, providerType, baseUrl, keyFragment, createdAt,
41
- * updatedAt }`. The Vault pointer and tenant id are write-only/internal.
39
+ * `GET /v1/providers/{id}` wire response. The Vault pointer and tenant id
40
+ * stay internal.
42
41
  */
43
42
  export declare const providerResponseSchema: z.ZodObject<{
44
43
  id: z.ZodString;
@@ -39,9 +39,8 @@ export const providerSchema = z
39
39
  })
40
40
  .strict();
41
41
  /**
42
- * Wire response — `GET /v1/providers/{id}` shape per
43
- * ticket 12: `{ id, name, providerType, baseUrl, keyFragment, createdAt,
44
- * updatedAt }`. The Vault pointer and tenant id are write-only/internal.
42
+ * `GET /v1/providers/{id}` wire response. The Vault pointer and tenant id
43
+ * stay internal.
45
44
  */
46
45
  export const providerResponseSchema = z
47
46
  .object({
@@ -1,10 +1,7 @@
1
1
  import { z } from "zod";
2
2
  /**
3
- * `GET /v1/agents/{agentId}/sessions` list item — the public wire shape:
4
- * `{ id, agentVersion, createdAt, updatedAt, messageCount,
5
- * lastMessagePreview, userId, metadata }`. `agentId`/`tenantId` are internal
6
- * (used for filtering) and never leak to the wire. `userId`/`metadata` are
7
- * stamped at lazy materialization (the first successful turn's attribution).
3
+ * `GET /v1/agents/{agentId}/sessions` list item. `agentId`/`tenantId` never
4
+ * leak to the wire; `userId`/`metadata` come from the first successful Turn.
8
5
  */
9
6
  export declare const sessionListItemSchema: z.ZodObject<{
10
7
  agentVersion: z.ZodNullable<z.ZodNumber>;
@@ -6,11 +6,8 @@ import { toolReferenceSchema } from "./agent-approval.js";
6
6
  import { agentSchema, agentVersionNumberSchema } from "./agents.js";
7
7
  import { metadataSchema, userIdSchema } from "./attribution.js";
8
8
  /**
9
- * `GET /v1/agents/{agentId}/sessions` list item — the public wire shape:
10
- * `{ id, agentVersion, createdAt, updatedAt, messageCount,
11
- * lastMessagePreview, userId, metadata }`. `agentId`/`tenantId` are internal
12
- * (used for filtering) and never leak to the wire. `userId`/`metadata` are
13
- * stamped at lazy materialization (the first successful turn's attribution).
9
+ * `GET /v1/agents/{agentId}/sessions` list item. `agentId`/`tenantId` never
10
+ * leak to the wire; `userId`/`metadata` come from the first successful Turn.
14
11
  */
15
12
  export const sessionListItemSchema = z
16
13
  .object({
@@ -75,7 +72,6 @@ export const sessionMessagesResponseSchema = z
75
72
  latestCursor: z.string().nullable(),
76
73
  })
77
74
  .strip();
78
- // Query params for the messages endpoint.
79
75
  export const sessionMessagesQuerySchema = z
80
76
  .object({
81
77
  limit: z
@@ -301,6 +301,10 @@ export declare const taskResponseSchema: z.ZodObject<{
301
301
  createdAt: z.ZodISODateTime;
302
302
  updatedAt: z.ZodISODateTime;
303
303
  }, z.core.$strip>;
304
+ /**
305
+ * Task run record. `userId`/`metadata` are copied from the task at enqueue
306
+ * and carried onto the run's Session and usage facts.
307
+ */
304
308
  export declare const taskRunSchema: z.ZodObject<{
305
309
  id: z.ZodString;
306
310
  taskId: z.ZodString;
@@ -422,6 +426,10 @@ export declare const createTaskResponseSchema: z.ZodObject<{
422
426
  export declare const createTaskRunResponseSchema: z.ZodObject<{
423
427
  runId: z.ZodString;
424
428
  }, z.core.$strip>;
429
+ /**
430
+ * `GET .../runs/{runId}/messages` — the run transcript plus `status`,
431
+ * `error`, and `finishedAt`, so one poll loop can follow the run.
432
+ */
425
433
  export declare const taskRunMessagesResponseSchema: z.ZodObject<{
426
434
  data: z.ZodArray<z.ZodObject<{
427
435
  id: z.ZodString;
@@ -126,8 +126,7 @@ export const createTaskBodySchema = z
126
126
  metadata: metadataSchema.default({}),
127
127
  })
128
128
  .strict();
129
- // `PATCH /v1/tasks/{taskId}` — name/prompt/schedule/enabled/metadata;
130
- // agentId + userId immutable.
129
+ // `PATCH /v1/tasks/{taskId}` — `agentId` and `userId` are immutable.
131
130
  export const updateTaskBodySchema = z
132
131
  .object({
133
132
  agentVersion: agentVersionNumberSchema.nullable().optional(),
@@ -210,9 +209,10 @@ export const tasksListQuerySchema = z
210
209
  })
211
210
  .strict();
212
211
  export const taskResponseSchema = taskSchema;
213
- // Task run record. `userId`/`metadata` are inherited from the task at
214
- // enqueue (immutable thereafter); the run's session and usage facts carry
215
- // the same attribution.
212
+ /**
213
+ * Task run record. `userId`/`metadata` are copied from the task at enqueue
214
+ * and carried onto the run's Session and usage facts.
215
+ */
216
216
  export const taskRunSchema = z
217
217
  .object({
218
218
  id: taskRunIdSchema,
@@ -249,9 +249,10 @@ export const createTaskRunResponseSchema = z
249
249
  runId: taskRunIdSchema,
250
250
  })
251
251
  .strip();
252
- // `GET .../runs/{runId}/messages` — task-run session transcript, paginated,
253
- // plus `status`, `error`, and `finishedAt` for a single client poll loop.
254
- // `latestCursor` remains the tail position for the next `?after=` request.
252
+ /**
253
+ * `GET .../runs/{runId}/messages` — the run transcript plus `status`,
254
+ * `error`, and `finishedAt`, so one poll loop can follow the run.
255
+ */
255
256
  export const taskRunMessagesResponseSchema = sessionMessagesResponseSchema
256
257
  .extend({
257
258
  error: z.string().nullable(),
@@ -58,3 +58,4 @@ export declare const apiKeyFragmentSchema: z.ZodString;
58
58
  export declare const providerKeyFragmentSchema: z.ZodString;
59
59
  export type TurnId = z.infer<typeof turnIdSchema>;
60
60
  export declare const chatConnectionIdSchema: z.ZodString;
61
+ export declare const chatDeliveryIdSchema: z.ZodString;
@@ -84,3 +84,4 @@ export const apiKeyFragmentSchema = z.string().regex(/^ba_[0-9A-Za-z]{2}$/);
84
84
  // Provider key fragment — last 4 chars of the secret, display-only.
85
85
  export const providerKeyFragmentSchema = z.string().min(1).max(4);
86
86
  export const chatConnectionIdSchema = z.string().regex(/^cc_[0-9A-Za-z]{16}$/);
87
+ export const chatDeliveryIdSchema = z.string().regex(/^cd_[0-9A-Za-z]{16}$/);
@@ -7,7 +7,7 @@ export { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsLis
7
7
  export { attributionCreateInputSchema, metadataSchema, } from "./entities/attribution.ts";
8
8
  export type { PromptVariables, UsageSummary } from "./entities/chat.ts";
9
9
  export { blazingAgentsChatMessageMetadataSchema, chatModeSchema, chatRequestBodySchema, chatTriggerSchema, generationRequestBodySchema, jsonSchemaShapeSchema, promptVariablesSchema, usageSummarySchema, } from "./entities/chat.ts";
10
- export { chatConfigurationSchema, chatConnectionSchema, chatConnectionsResponseSchema, chatCredentialsSchema, chatHealthCheckSchema, chatHealthSchema, chatIdentitySchema, createChatConnectionBodySchema, rotateChatConnectionBodySchema, updateChatConnectionBodySchema, } from "./entities/chat-connections.ts";
10
+ export { chatConfigurationSchema, chatConnectionSchema, chatConnectionsResponseSchema, chatCredentialsSchema, chatDeliveriesResponseSchema, chatDeliveryListStatusSchema, chatDeliverySchema, chatDeliveryStatusSchema, chatHealthCheckSchema, chatHealthSchema, chatIdentitySchema, createChatConnectionBodySchema, rotateChatConnectionBodySchema, tenantChatDeliverySchema, updateChatConnectionBodySchema, } from "./entities/chat-connections.ts";
11
11
  export { approveMcpOauthAuthorizationBodySchema, createMcpConnectionBodySchema, mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, mcpConnectionAuthTypeSchema, mcpConnectionOauthConnectResponseSchema, mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionStatusSchema, mcpConnectionsResponseSchema, mcpConnectionTestErrorCodeSchema, mcpConnectionTestResponseSchema, mcpOauthAuthorizationLaunchResponseSchema, reconnectMcpConnectionBodySchema, updateMcpAttachmentBodySchema, updateMcpConnectionBodySchema, } from "./entities/mcp-connections.ts";
12
12
  export { createMemoryBodySchema, memoriesListResponseSchema, memoryResponseSchema, memorySchema, updateMemoryBodySchema, } from "./entities/memories.ts";
13
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.ts";
@@ -6,7 +6,7 @@ export { agentResponseSchema, agentSchema, agentStatusSchema, agentsResponseSche
6
6
  export { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsListResponseSchema, } from "./entities/artifacts.js";
7
7
  export { attributionCreateInputSchema, metadataSchema, } from "./entities/attribution.js";
8
8
  export { blazingAgentsChatMessageMetadataSchema, chatModeSchema, chatRequestBodySchema, chatTriggerSchema, generationRequestBodySchema, jsonSchemaShapeSchema, promptVariablesSchema, usageSummarySchema, } from "./entities/chat.js";
9
- export { chatConfigurationSchema, chatConnectionSchema, chatConnectionsResponseSchema, chatCredentialsSchema, chatHealthCheckSchema, chatHealthSchema, chatIdentitySchema, createChatConnectionBodySchema, rotateChatConnectionBodySchema, updateChatConnectionBodySchema, } from "./entities/chat-connections.js";
9
+ export { chatConfigurationSchema, chatConnectionSchema, chatConnectionsResponseSchema, chatCredentialsSchema, chatDeliveriesResponseSchema, chatDeliveryListStatusSchema, chatDeliverySchema, chatDeliveryStatusSchema, chatHealthCheckSchema, chatHealthSchema, chatIdentitySchema, createChatConnectionBodySchema, rotateChatConnectionBodySchema, tenantChatDeliverySchema, updateChatConnectionBodySchema, } from "./entities/chat-connections.js";
10
10
  export { approveMcpOauthAuthorizationBodySchema, createMcpConnectionBodySchema, mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, mcpConnectionAuthTypeSchema, mcpConnectionOauthConnectResponseSchema, mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionStatusSchema, mcpConnectionsResponseSchema, mcpConnectionTestErrorCodeSchema, mcpConnectionTestResponseSchema, mcpOauthAuthorizationLaunchResponseSchema, reconnectMcpConnectionBodySchema, updateMcpAttachmentBodySchema, updateMcpConnectionBodySchema, } from "./entities/mcp-connections.js";
11
11
  export { createMemoryBodySchema, memoriesListResponseSchema, memoryResponseSchema, memorySchema, updateMemoryBodySchema, } from "./entities/memories.js";
12
12
  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";
@@ -7,14 +7,9 @@
7
7
  */
8
8
  export declare const MAX_API_KEYS_PER_TENANT = 5;
9
9
  export declare const MAX_API_KEY_NAME_LENGTH = 80;
10
- /**
11
- * API key token shape — `ba_` + 40 base62 chars (~230 bits entropy).
12
- * The prefix and body/fragment lengths live in `ids.ts` alongside the
13
- * generators and schemas.
14
- */
10
+ /** API key token shape — `ba_` + 40 base62 chars (~230 bits entropy). */
15
11
  export declare const API_KEY_BODY_LENGTH = 40;
16
12
  export declare const API_KEY_FRAGMENT_BODY_LENGTH = 2;
17
- /** Workspaces. */
18
13
  export declare const MAX_WORKSPACE_NAME_LENGTH = 80;
19
14
  export declare const MAX_WORKSPACE_ARCHIVE_ENTRIES = 16384;
20
15
  export declare const DEFAULT_WORKSPACES_LIST_LIMIT = 50;
@@ -7,15 +7,10 @@
7
7
  */
8
8
  export const MAX_API_KEYS_PER_TENANT = 5;
9
9
  export const MAX_API_KEY_NAME_LENGTH = 80;
10
- /**
11
- * API key token shape — `ba_` + 40 base62 chars (~230 bits entropy).
12
- * The prefix and body/fragment lengths live in `ids.ts` alongside the
13
- * generators and schemas.
14
- */
10
+ /** API key token shape — `ba_` + 40 base62 chars (~230 bits entropy). */
15
11
  export const API_KEY_BODY_LENGTH = 40;
16
12
  // Display fragment — `ba_` + first 2 chars of the random body.
17
13
  export const API_KEY_FRAGMENT_BODY_LENGTH = 2;
18
- /** Workspaces. */
19
14
  export const MAX_WORKSPACE_NAME_LENGTH = 80;
20
15
  export const MAX_WORKSPACE_ARCHIVE_ENTRIES = 16_384;
21
16
  export const DEFAULT_WORKSPACES_LIST_LIMIT = 50;
package/dist/errors.js CHANGED
@@ -28,7 +28,7 @@ export class BlazingAgentsError extends Error {
28
28
  [BLAZING_AGENTS_ERROR_SYMBOL] = true;
29
29
  // Stryker restore BooleanLiteral
30
30
  constructor({ code, details, headers, message, param, requestId, responseBody, responseBodyTruncated, status, }, options) {
31
- super(message, options);
31
+ super(`[${code}] ${message}`, options);
32
32
  this.name = BLAZING_AGENTS_ERROR_NAME;
33
33
  this.code = code;
34
34
  this.details = details;
@@ -2,7 +2,6 @@ import { createTextStreamResponse, parsePartialJson } from "ai";
2
2
  import { sessionIdSchema } from "./contracts/ids.js";
3
3
  import { BlazingAgentsError } from "./errors.js";
4
4
  import { requestStream } from "./http.js";
5
- // --- chat ---
6
5
  export async function chat(config, input) {
7
6
  const body = buildChatBody(input);
8
7
  /**
@@ -259,7 +258,6 @@ function buildStatelessGenerationBody(input, output) {
259
258
  }
260
259
  return body;
261
260
  }
262
- // --- completion ---
263
261
  export async function completion(config, input) {
264
262
  const body = buildStatelessGenerationBody(input, { type: "text" });
265
263
  const path = `/v1/agents/${input.agentId}/generation`;
@@ -280,11 +278,6 @@ function buildCompletionResult(response) {
280
278
  }
281
279
  return text;
282
280
  })();
283
- /**
284
- * Attach a no-op rejection handler so the promise doesn't trigger an
285
- * unhandled-rejection warning if the caller only uses `textStream` or
286
- * `toResponse()` without awaiting `text`.
287
- */
288
281
  textPromise.catch(() => {
289
282
  /* no-op — prevents unhandled rejection if the caller never awaits */
290
283
  });
@@ -295,7 +288,6 @@ function buildCompletionResult(response) {
295
288
  toResponse,
296
289
  };
297
290
  }
298
- // --- object ---
299
291
  export async function objectGeneration(config, input) {
300
292
  const body = buildStatelessGenerationBody(input, {
301
293
  type: "object",
@@ -360,7 +352,6 @@ function buildObjectResult(response) {
360
352
  toResponse,
361
353
  };
362
354
  }
363
- // --- helpers ---
364
355
  function buildStatelessGenerationStreams(response, resourceName) {
365
356
  const requestId = response.headers.get("x-request-id") ?? undefined;
366
357
  const location = response.headers.get("location");
package/dist/http.js CHANGED
@@ -4,11 +4,6 @@ const DIAGNOSTIC_BODY_LIMIT_BYTES = 64 * 1024;
4
4
  const INVALID_RESPONSE_MESSAGE = "The server returned an invalid response.";
5
5
  const NETWORK_ERROR_MESSAGE = "Network request failed (fetch threw before any HTTP exchange).";
6
6
  const REQUEST_ABORTED_MESSAGE = "The request was aborted before any HTTP response.";
7
- /**
8
- * The fetch client — a thin wrapper in the stripe/openai-node shape.
9
- * `apiKey` rides the `Authorization: Bearer ${apiKey}` header; `baseUrl`
10
- * defaults to the local api dev port. No OpenAI wire compatibility.
11
- */
12
7
  function buildUrl(baseUrl, path, query) {
13
8
  const url = `${baseUrl}${path}`;
14
9
  if (!query) {
package/dist/index.d.ts CHANGED
@@ -2,9 +2,6 @@
2
2
  * `@blazingagents/sdk` — the resource-style client SDK for the
3
3
  * Blazing Agents `/v1` API. `ai` is a peer dependency (`^7`);
4
4
  * `UIMessage` is re-exported from `ai`, never redeclared.
5
- *
6
- * This is the package's entry point — a barrel file that re-exports the
7
- * public surface from the internal modules.
8
5
  */
9
6
  export type { UIMessage } from "ai";
10
7
  export { BlazingAgentsChatTransport, type BlazingAgentsChatTransportOptions, } from "./chat-transport.ts";
@@ -12,7 +9,7 @@ export { BlazingAgents } from "./client.ts";
12
9
  export type { ApprovalDecision, ApprovalPolicy, ToolReference, } from "./contracts/entities/agent-approval.ts";
13
10
  export type { Agent, AgentResponse, AgentsResponse, AgentVersion, AgentVersionsListQuery, AgentVersionsResponse, CreateAgentBody, UpdateAgentBody, } from "./contracts/entities/agents.ts";
14
11
  export type { ArtifactDownloadUrlResponse, ArtifactListItem, ArtifactsListResponse, } from "./contracts/entities/artifacts.ts";
15
- export type { ChatConfiguration, ChatConnection, ChatConnectionsResponse, ChatCredentials, ChatHealth, ChatIdentity, CreateChatConnectionBody, RotateChatConnectionBody, UpdateChatConnectionBody, } from "./contracts/entities/chat-connections.ts";
12
+ export type { ChatConfiguration, ChatConnection, ChatConnectionsResponse, ChatCredentials, ChatDeliveriesResponse, ChatDelivery, ChatDeliveryListStatus, ChatDeliveryStatus, ChatHealth, ChatIdentity, CreateChatConnectionBody, RotateChatConnectionBody, TenantChatDelivery, UpdateChatConnectionBody, } from "./contracts/entities/chat-connections.ts";
16
13
  export type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResponse, McpConnectionAuthType, McpConnectionOauthConnectResponse, McpConnectionReconnectResult, McpConnectionResponse, McpConnectionStatus, McpConnectionTestResponse, ReconnectMcpConnectionBody, UpdateMcpAttachmentBody, UpdateMcpConnectionBody, } from "./contracts/entities/mcp-connections.ts";
17
14
  export type { CreateMerchantConnectionBody, MerchantBindingResponse, MerchantBindingsResponse, MerchantConnection, MerchantConnectionResponse, MerchantCustomerBinding, MerchantGuard, MerchantProviderKind, MerchantUsageEvent, MerchantUsageEventResponse, MerchantUsageEventStatus, MerchantUsageEventsResponse, MerchantUsageSummary, MerchantUsageSummaryResponse, UpdateMerchantConnectionBody, UpsertMerchantBindingBody, } from "./contracts/entities/merchant.ts";
18
15
  export type { CreateProviderBody, ProviderListItem, ProviderModel, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ProviderType, ThinkingLevelsResponse, UpdateProviderBody, } from "./contracts/entities/providers.ts";
@@ -23,4 +20,4 @@ export type { CreateWorkspaceBody, UpdateWorkspaceBody, Workspace, WorkspaceNetw
23
20
  export { BlazingAgentsDirectChatTransport, type BlazingAgentsDirectChatTransportOptions, } from "./direct-chat-transport.ts";
24
21
  export { BlazingAgentsError } from "./errors.ts";
25
22
  export { createChatRelay, createCompletionRelay, type RelayContext, type SessionOwnershipStore, } from "./relay.ts";
26
- export type { AgentClient, AgentSkillsResource, AgentsListOptions, AgentsResource, AgentVersionsListOptions, ArtifactsResource, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, ChatConnectionsResource, ChatInput, ChatMessageInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, KnownBlazingAgentsErrorCode, LatestSessionsListOptions, McpConnectionsResource, MemoriesListOptions, MemoriesResource, MerchantBindingsListOptions, MerchantBindingsResource, MerchantConnectionResource, MerchantUsageEventsListOptions, MerchantUsageEventsResource, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, PromptsResource, ProvidersResource, ResourceRequestOptions, ResponseObservation, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
23
+ export type { AgentClient, AgentSkillsResource, AgentsListOptions, AgentsResource, AgentVersionsListOptions, ArtifactsResource, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, ChatConnectionsResource, ChatDeliveriesListOptions, ChatDeliveriesResource, ChatInput, ChatMessageInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, KnownBlazingAgentsErrorCode, LatestSessionsListOptions, McpConnectionsResource, MemoriesListOptions, MemoriesResource, MerchantBindingsListOptions, MerchantBindingsResource, MerchantConnectionResource, MerchantUsageEventsListOptions, MerchantUsageEventsResource, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, PromptsResource, ProvidersResource, ResourceRequestOptions, ResponseObservation, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
package/dist/index.js CHANGED
@@ -2,9 +2,6 @@
2
2
  * `@blazingagents/sdk` — the resource-style client SDK for the
3
3
  * Blazing Agents `/v1` API. `ai` is a peer dependency (`^7`);
4
4
  * `UIMessage` is re-exported from `ai`, never redeclared.
5
- *
6
- * This is the package's entry point — a barrel file that re-exports the
7
- * public surface from the internal modules.
8
5
  */
9
6
  // biome-ignore lint/performance/noBarrelFile: package entry point
10
7
  export { BlazingAgentsChatTransport, } from "./chat-transport.js";
package/dist/relay.js CHANGED
@@ -102,7 +102,7 @@ function safeErrorResponse(error) {
102
102
  if (requestId) {
103
103
  headers.set("x-request-id", requestId);
104
104
  }
105
- return errorResponse(status, error.code, error.message, headers);
105
+ return errorResponse(status, error.code, error.message.slice(`[${error.code}] `.length), headers);
106
106
  }
107
107
  return errorResponse(500, "internal_error", "Request failed.");
108
108
  }
@@ -0,0 +1,6 @@
1
+ import type { ChatDeliveriesResource, HttpConfig } from "../types.ts";
2
+ /**
3
+ * `client.chatDeliveries` — `GET /v1/chat-deliveries`, the Tenant-wide
4
+ * delivery feed across all Chat Connections, newest first.
5
+ */
6
+ export declare function createChatDeliveriesResource(config: HttpConfig): ChatDeliveriesResource;
@@ -0,0 +1,20 @@
1
+ import { chatDeliveriesResponseSchema } from "../contracts/entities/chat-connections.js";
2
+ import { requestJson } from "../http.js";
3
+ /**
4
+ * `client.chatDeliveries` — `GET /v1/chat-deliveries`, the Tenant-wide
5
+ * delivery feed across all Chat Connections, newest first.
6
+ */
7
+ export function createChatDeliveriesResource(config) {
8
+ return {
9
+ async list({ abortSignal, status, ...query } = {}) {
10
+ return await requestJson(config, "/v1/chat-deliveries", {
11
+ query: {
12
+ ...query,
13
+ // Multi-value filters serialize as one comma-separated parameter.
14
+ status: status?.length ? status.join(",") : undefined,
15
+ },
16
+ signal: abortSignal,
17
+ }, chatDeliveriesResponseSchema);
18
+ },
19
+ };
20
+ }
package/dist/types.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { ApiErrorCode } from "./contracts/api.ts";
3
3
  import type { Agent, AgentsResponse, AgentVersion, AgentVersionsResponse, CreateAgentBody, UpdateAgentBody } from "./contracts/entities/agents.ts";
4
4
  import type { ArtifactDownloadUrlResponse, ArtifactListItem, ArtifactsListResponse } from "./contracts/entities/artifacts.ts";
5
5
  import type { BlazingAgentsChatMessageMetadata } from "./contracts/entities/chat.ts";
6
- import type { ChatConnection, ChatConnectionsResponse, CreateChatConnectionBody, RotateChatConnectionBody, UpdateChatConnectionBody } from "./contracts/entities/chat-connections.ts";
6
+ import type { ChatConnection, ChatConnectionsResponse, ChatDeliveriesResponse, ChatDeliveryListStatus, CreateChatConnectionBody, RotateChatConnectionBody, UpdateChatConnectionBody } from "./contracts/entities/chat-connections.ts";
7
7
  import type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResponse, McpConnectionOauthConnectResponse, McpConnectionReconnectResult, McpConnectionResponse, McpConnectionsResponse, McpConnectionTestResponse, ReconnectMcpConnectionBody, UpdateMcpAttachmentBody, UpdateMcpConnectionBody } from "./contracts/entities/mcp-connections.ts";
8
8
  import type { CreateMemoryBody, MemoriesListResponse, MemoryResponse, UpdateMemoryBody } from "./contracts/entities/memories.ts";
9
9
  import type { CreateMerchantConnectionBody, MerchantBindingResponse, MerchantBindingsResponse, MerchantConnectionResponse, MerchantUsageEventResponse, MerchantUsageEventStatus, MerchantUsageEventsResponse, MerchantUsageSummaryResponse, UpdateMerchantConnectionBody, UpsertMerchantBindingBody } from "./contracts/entities/merchant.ts";
@@ -19,11 +19,7 @@ export type KnownBlazingAgentsErrorCode = ApiErrorCode | "invalid_response" | "n
19
19
  export type BlazingAgentsErrorCode = KnownBlazingAgentsErrorCode | (string & {});
20
20
  export type BlazingAgentsFetch = (input: string, init?: BlazingAgentsRequestInit) => Promise<Response>;
21
21
  export interface BlazingAgentsRequestInit extends RequestInit {
22
- /**
23
- * The SDK never sends multipart bodies via the global `FormData`; the
24
- * skill upload path passes a `FormData` instance directly. This slot
25
- * exists only so the type carries the union cleanly.
26
- */
22
+ /** Widened so multipart uploads can pass a `FormData` body. */
27
23
  body?: BodyInit | FormData | null;
28
24
  }
29
25
  export interface RequestOptions {
@@ -34,11 +30,6 @@ export interface RequestOptions {
34
30
  * automatically by `fetch` when given a `FormData` body).
35
31
  */
36
32
  headers?: Record<string, string>;
37
- /**
38
- * JSON body (object — serialized by the helper) or `undefined` for
39
- * GET/DELETE. Multipart uploads bypass this and pass `FormData` via
40
- * `extra.body`.
41
- */
42
33
  json?: unknown;
43
34
  method?: string;
44
35
  /**
@@ -600,4 +591,19 @@ export interface ChatConnectionsResource {
600
591
  chatConnectionId: string;
601
592
  } & ResourceRequestOptions): Promise<ChatConnection>;
602
593
  }
594
+ export interface ChatDeliveriesListOptions extends ResourceRequestOptions {
595
+ cursor?: string;
596
+ limit?: number;
597
+ /** ISO 8601 date-time; inclusive lower bound on `createdAt`. */
598
+ since?: string;
599
+ /** `failed` and/or `ambiguous`; omitted means both. */
600
+ status?: readonly ChatDeliveryListStatus[];
601
+ }
602
+ /**
603
+ * `client.chatDeliveries` — the Tenant's deliveries across all Chat
604
+ * Connections behind `GET /v1/chat-deliveries`, newest first.
605
+ */
606
+ export interface ChatDeliveriesResource {
607
+ list(input?: ChatDeliveriesListOptions): Promise<ChatDeliveriesResponse>;
608
+ }
603
609
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazingagents/sdk",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "TypeScript SDK for the Blazing Agents API",
5
5
  "homepage": "https://docs.blazingagents.com",
6
6
  "bugs": {