@blazingagents/sdk 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +5 -231
  2. package/dist/approvals.d.ts +15 -0
  3. package/dist/approvals.js +20 -0
  4. package/dist/chat-transport.js +9 -2
  5. package/dist/client.d.ts +8 -1
  6. package/dist/client.js +41 -1
  7. package/dist/contracts/api.d.ts +9 -9
  8. package/dist/contracts/api.js +3 -3
  9. package/dist/contracts/entities/agent-approval.d.ts +32 -0
  10. package/dist/contracts/entities/agent-approval.js +12 -1
  11. package/dist/contracts/entities/agent-tools.d.ts +6 -0
  12. package/dist/contracts/entities/agent-tools.js +13 -0
  13. package/dist/contracts/entities/agents.d.ts +4 -1
  14. package/dist/contracts/entities/agents.js +9 -6
  15. package/dist/contracts/entities/chat.d.ts +95 -12
  16. package/dist/contracts/entities/chat.js +105 -36
  17. package/dist/contracts/entities/prompts.d.ts +9 -1
  18. package/dist/contracts/entities/prompts.js +14 -4
  19. package/dist/contracts/entities/sessions.d.ts +6 -0
  20. package/dist/contracts/entities/sessions.js +2 -2
  21. package/dist/contracts/entities/tasks.d.ts +4 -6
  22. package/dist/contracts/entities/tasks.js +4 -6
  23. package/dist/contracts/entities/usage.d.ts +18 -0
  24. package/dist/contracts/entities/usage.js +28 -0
  25. package/dist/contracts/ids.d.ts +1 -0
  26. package/dist/contracts/ids.js +1 -0
  27. package/dist/contracts/index.d.ts +11 -10
  28. package/dist/contracts/index.js +8 -7
  29. package/dist/contracts/limitations.d.ts +4 -4
  30. package/dist/contracts/limitations.js +4 -4
  31. package/dist/direct-chat-transport.d.ts +3 -0
  32. package/dist/direct-chat-transport.js +20 -22
  33. package/dist/functions.d.ts +38 -0
  34. package/dist/functions.js +299 -0
  35. package/dist/generation.d.ts +7 -1
  36. package/dist/generation.js +64 -12
  37. package/dist/http.js +3 -0
  38. package/dist/index.d.ts +6 -4
  39. package/dist/index.js +1 -0
  40. package/dist/relay.d.ts +11 -4
  41. package/dist/relay.js +41 -1
  42. package/dist/resources/agents.d.ts +0 -6
  43. package/dist/resources/agents.js +2 -6
  44. package/dist/resources/prompts.d.ts +0 -4
  45. package/dist/resources/prompts.js +2 -6
  46. package/dist/resources/sessions.js +4 -2
  47. package/dist/resources/usage.js +9 -1
  48. package/dist/types.d.ts +39 -1
  49. package/package.json +8 -6
package/dist/index.d.ts CHANGED
@@ -6,18 +6,20 @@
6
6
  export type { UIMessage } from "ai";
7
7
  export { BlazingAgentsChatTransport, type BlazingAgentsChatTransportOptions, } from "./chat-transport.ts";
8
8
  export { BlazingAgents } from "./client.ts";
9
- export type { ApprovalDecision, ApprovalPolicy, ToolReference, } from "./contracts/entities/agent-approval.ts";
10
- export type { Agent, AgentResponse, AgentsResponse, AgentVersion, AgentVersionsListQuery, AgentVersionsResponse, CreateAgentBody, UpdateAgentBody, } from "./contracts/entities/agents.ts";
9
+ export type { ApprovalDecision, ApprovalPolicy, ToolExecutionReference, ToolReference, } from "./contracts/entities/agent-approval.ts";
10
+ export type { Agent, AgentResponse, AgentsListQuery, AgentsResponse, AgentVersion, AgentVersionsListQuery, AgentVersionsResponse, CreateAgentBody, UpdateAgentBody, } from "./contracts/entities/agents.ts";
11
11
  export type { ArtifactDownloadUrlResponse, ArtifactListItem, ArtifactsListResponse, } from "./contracts/entities/artifacts.ts";
12
12
  export type { ChatConfiguration, ChatConnection, ChatConnectionsResponse, ChatCredentials, ChatDeliveriesResponse, ChatDelivery, ChatDeliveryListStatus, ChatDeliveryStatus, ChatHealth, ChatIdentity, CreateChatConnectionBody, RotateChatConnectionBody, TenantChatDelivery, UpdateChatConnectionBody, } from "./contracts/entities/chat-connections.ts";
13
13
  export type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResponse, McpConnectionAuthType, McpConnectionOauthConnectResponse, McpConnectionReconnectResult, McpConnectionResponse, McpConnectionStatus, McpConnectionTestResponse, ReconnectMcpConnectionBody, UpdateMcpAttachmentBody, UpdateMcpConnectionBody, } from "./contracts/entities/mcp-connections.ts";
14
14
  export type { CreateMerchantConnectionBody, MerchantBindingResponse, MerchantBindingsResponse, MerchantConnection, MerchantConnectionResponse, MerchantCustomerBinding, MerchantGuard, MerchantProviderKind, MerchantUsageEvent, MerchantUsageEventResponse, MerchantUsageEventStatus, MerchantUsageEventsResponse, MerchantUsageSummary, MerchantUsageSummaryResponse, UpdateMerchantConnectionBody, UpsertMerchantBindingBody, } from "./contracts/entities/merchant.ts";
15
+ export type { CreatePromptBody, PromptResponse, PromptsListQuery, PromptsResponse, UpdatePromptBody, } from "./contracts/entities/prompts.ts";
15
16
  export type { CreateProviderBody, ProviderListItem, ProviderModel, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ProviderType, ThinkingLevelsResponse, UpdateProviderBody, } from "./contracts/entities/providers.ts";
16
17
  export type { ToolApprovalDecisionResponse, ToolApprovalState, ToolApprovalsResponse, } from "./contracts/entities/sessions.ts";
17
18
  export type { CreateSkillBody, Skill, SkillArchiveType, SkillCopyResult, SkillCopyResults, SkillDetail, SkillFile, SkillsListResponse, } from "./contracts/entities/skills.ts";
18
- export type { UsageBucket, UsageOverviewQuery, UsageOverviewResponse, UsageTotals, } from "./contracts/entities/usage.ts";
19
+ export type { SessionUsageQuery, SessionUsageResponse, UsageBucket, UsageOverviewQuery, UsageOverviewResponse, UsageTotals, } from "./contracts/entities/usage.ts";
19
20
  export type { CreateWorkspaceBody, UpdateWorkspaceBody, Workspace, WorkspaceNetworkPolicy, WorkspacesListResponse, } from "./contracts/entities/workspaces.ts";
20
21
  export { BlazingAgentsDirectChatTransport, type BlazingAgentsDirectChatTransportOptions, } from "./direct-chat-transport.ts";
21
22
  export { BlazingAgentsError } from "./errors.ts";
23
+ export { type ChatFunction, type ChatFunctionContext, type ChatFunctions, defineFunction, } from "./functions.ts";
22
24
  export { createChatRelay, createCompletionRelay, type RelayContext, type SessionOwnershipStore, } from "./relay.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";
25
+ 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, ResumeChatInput, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, UserClient, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
package/dist/index.js CHANGED
@@ -8,4 +8,5 @@ export { BlazingAgentsChatTransport, } from "./chat-transport.js";
8
8
  export { BlazingAgents } from "./client.js";
9
9
  export { BlazingAgentsDirectChatTransport, } from "./direct-chat-transport.js";
10
10
  export { BlazingAgentsError } from "./errors.js";
11
+ export { defineFunction, } from "./functions.js";
11
12
  export { createChatRelay, createCompletionRelay, } from "./relay.js";
package/dist/relay.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import type { BlazingAgents } from "./client.ts";
2
+ import type { ChatFunctions } from "./functions.ts";
2
3
  export interface RelayContext {
3
4
  agentId: string;
5
+ /** Handlers for this authenticated request; they also resume approved continuations. */
6
+ functions?: ChatFunctions;
4
7
  metadata?: Record<string, unknown>;
5
8
  userId: string;
6
9
  version?: number;
@@ -9,12 +12,16 @@ export interface SessionOwnershipStore {
9
12
  ownerOf(sessionId: string): Promise<string | undefined>;
10
13
  recordOwner(sessionId: string, userId: string): Promise<void>;
11
14
  }
12
- interface RelayOptions {
13
- client: Pick<BlazingAgents, "chat" | "completion">;
15
+ interface RelayOptions<Method extends keyof BlazingAgents> {
16
+ client: Pick<BlazingAgents, Method>;
14
17
  resolveContext(request: Request): Promise<RelayContext | null>;
15
18
  }
16
- export declare function createChatRelay(options: RelayOptions & {
19
+ /**
20
+ * Relays useChat submissions. An assistant message carrying approval
21
+ * responses records each decision and then streams the continuation.
22
+ */
23
+ export declare function createChatRelay(options: RelayOptions<"chat" | "resumeChat" | "sessions"> & {
17
24
  sessions: SessionOwnershipStore;
18
25
  }): (request: Request) => Promise<Response>;
19
- export declare function createCompletionRelay(options: RelayOptions): (request: Request) => Promise<Response>;
26
+ export declare function createCompletionRelay(options: RelayOptions<"completion">): (request: Request) => Promise<Response>;
20
27
  export {};
package/dist/relay.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { safeValidateUIMessages } from "ai";
2
2
  import { z } from "zod";
3
+ import { decideApprovalResponses } from "./approvals.js";
3
4
  import { sessionIdSchema } from "./contracts/ids.js";
4
5
  import { BlazingAgentsError } from "./errors.js";
5
6
  const chatBodySchema = z.object({
@@ -11,6 +12,10 @@ const chatBodySchema = z.object({
11
12
  .default("submit-message"),
12
13
  });
13
14
  const completionBodySchema = z.object({ prompt: z.string().trim().min(1) });
15
+ /**
16
+ * Relays useChat submissions. An assistant message carrying approval
17
+ * responses records each decision and then streams the continuation.
18
+ */
14
19
  export function createChatRelay(options) {
15
20
  return async (request) => {
16
21
  try {
@@ -29,9 +34,20 @@ export function createChatRelay(options) {
29
34
  (await options.sessions.ownerOf(body.sessionId)) !== context.userId) {
30
35
  return errorResponse(403, "forbidden", "Session is not available.");
31
36
  }
37
+ const message = validated.data[0];
38
+ if (message.role === "assistant") {
39
+ return await relayApprovalResponses(options.client, {
40
+ agentId: context.agentId,
41
+ functions: context.functions,
42
+ message,
43
+ request,
44
+ sessionId: body.sessionId,
45
+ });
46
+ }
32
47
  const chatInput = {
33
48
  agentId: context.agentId,
34
- message: validated.data[0],
49
+ functions: context.functions,
50
+ message,
35
51
  messageId: body.messageId,
36
52
  metadata: context.metadata,
37
53
  abortSignal: request.signal,
@@ -68,6 +84,30 @@ export function createChatRelay(options) {
68
84
  }
69
85
  };
70
86
  }
87
+ async function relayApprovalResponses(client, { functions, message, request, ...input }) {
88
+ if (input.sessionId === undefined) {
89
+ return errorResponse(400, "invalid_request", "Tool approval requires an existing Session.");
90
+ }
91
+ const target = {
92
+ agentId: input.agentId,
93
+ sessionId: input.sessionId,
94
+ abortSignal: request.signal,
95
+ };
96
+ const continuationId = await decideApprovalResponses(client, {
97
+ ...target,
98
+ message,
99
+ });
100
+ if (continuationId === undefined) {
101
+ return errorResponse(400, "invalid_request", "The message has no tool approval responses.");
102
+ }
103
+ /** An absent registry still resumes, so missing handlers become tool errors instead of a stalled observer. */
104
+ const continuation = await client.resumeChat({
105
+ ...target,
106
+ continuationId,
107
+ functions: functions ?? {},
108
+ });
109
+ return continuation.toResponse();
110
+ }
71
111
  export function createCompletionRelay(options) {
72
112
  return async (request) => {
73
113
  try {
@@ -1,8 +1,2 @@
1
1
  import type { AgentsResource, HttpConfig } from "../types.ts";
2
- /**
3
- * `client.agents` — full CRUD over `/v1/agents`. The list endpoint is
4
- * unpaginated (bounded by the 100/tenant cap); create/update bodies are
5
- * the core zod contracts' input shapes. Responses are parsed against the
6
- * core wire schemas (parse-on-read).
7
- */
8
2
  export declare function createAgentsResource(config: HttpConfig): AgentsResource;
@@ -1,12 +1,6 @@
1
1
  import { agentResponseSchema, agentsResponseSchema, agentVersionSchema, agentVersionsResponseSchema, } from "../contracts/entities/agents.js";
2
2
  import { mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, } from "../contracts/entities/mcp-connections.js";
3
3
  import { requestJson } from "../http.js";
4
- /**
5
- * `client.agents` — full CRUD over `/v1/agents`. The list endpoint is
6
- * unpaginated (bounded by the 100/tenant cap); create/update bodies are
7
- * the core zod contracts' input shapes. Responses are parsed against the
8
- * core wire schemas (parse-on-read).
9
- */
10
4
  export function createAgentsResource(config) {
11
5
  const getVersion = async ({ agentId, version, abortSignal, }) => requestJson(config, `/v1/agents/${agentId}/versions/${version}`, { signal: abortSignal }, agentVersionSchema);
12
6
  const update = async ({ agentId, abortSignal, ...body }) => requestJson(config, `/v1/agents/${agentId}`, {
@@ -26,6 +20,8 @@ export function createAgentsResource(config) {
26
20
  return await requestJson(config, "/v1/agents", {
27
21
  signal: options.abortSignal,
28
22
  query: {
23
+ cursor: options.cursor,
24
+ limit: options.limit,
29
25
  userId: options.userId,
30
26
  workspaceId: options.workspaceId,
31
27
  },
@@ -1,6 +1,2 @@
1
1
  import type { HttpConfig, PromptsResource } from "../types.ts";
2
- /**
3
- * `client.prompts` — CRUD over `/v1/prompts`. The list endpoint is
4
- * unpaginated (bounded by the 100/tenant cap).
5
- */
6
2
  export declare function createPromptsResource(config: HttpConfig): PromptsResource;
@@ -1,9 +1,5 @@
1
1
  import { promptResponseSchema, promptsResponseSchema, } from "../contracts/entities/prompts.js";
2
2
  import { requestJson } from "../http.js";
3
- /**
4
- * `client.prompts` — CRUD over `/v1/prompts`. The list endpoint is
5
- * unpaginated (bounded by the 100/tenant cap).
6
- */
7
3
  export function createPromptsResource(config) {
8
4
  return {
9
5
  async create({ abortSignal, ...body }) {
@@ -13,10 +9,10 @@ export function createPromptsResource(config) {
13
9
  method: "POST",
14
10
  }, promptResponseSchema);
15
11
  },
16
- async list({ userId, agentId, abortSignal } = {}) {
12
+ async list({ userId, agentId, cursor, limit, abortSignal } = {}) {
17
13
  return await requestJson(config, "/v1/prompts", {
18
14
  signal: abortSignal,
19
- query: { userId, agentId },
15
+ query: { userId, agentId, cursor, limit },
20
16
  }, promptsResponseSchema);
21
17
  },
22
18
  async get({ promptId, abortSignal }) {
@@ -1,5 +1,6 @@
1
1
  import { latestSessionsListResponseSchema, sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalDecisionResponseSchema, toolApprovalsResponseSchema, } from "../contracts/entities/sessions.js";
2
- import { buildTerminalStreamResult } from "../generation.js";
2
+ import { stripFunctionEvents } from "../functions.js";
3
+ import { buildTerminalStreamResult, withFilteredBody } from "../generation.js";
3
4
  import { requestJson, requestStream } from "../http.js";
4
5
  /**
5
6
  * `client.sessions` — list/get-messages/delete over
@@ -53,7 +54,8 @@ export function createSessionsResource(config) {
53
54
  },
54
55
  async joinToolApprovalContinuation({ agentId, sessionId, continuationId, abortSignal, }) {
55
56
  const response = await requestStream(config, `/v1/agents/${agentId}/sessions/${sessionId}/tool-approval-continuations/${continuationId}`, { signal: abortSignal });
56
- return buildTerminalStreamResult(response, "continuation");
57
+ /** Observers never execute calls; private events are removed unclaimed. */
58
+ return buildTerminalStreamResult(withFilteredBody(response, stripFunctionEvents), "continuation");
57
59
  },
58
60
  async toolApprovals({ agentId, sessionId, abortSignal }) {
59
61
  return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}/tool-approvals`, { signal: abortSignal }, toolApprovalsResponseSchema);
@@ -1,4 +1,4 @@
1
- import { usageOverviewResponseSchemaForQuery, usageResponseSchema, } from "../contracts/entities/usage.js";
1
+ import { sessionUsageQuerySchema, sessionUsageResponseSchema, usageOverviewResponseSchemaForQuery, usageResponseSchema, } from "../contracts/entities/usage.js";
2
2
  import { requestJson } from "../http.js";
3
3
  /**
4
4
  * `client.usage` — get over `/v1/usage` (tenant-wide) and
@@ -7,6 +7,14 @@ import { requestJson } from "../http.js";
7
7
  */
8
8
  export function createUsageResource(config) {
9
9
  return {
10
+ async sessions({ abortSignal, ...input }) {
11
+ const body = sessionUsageQuerySchema.parse(input);
12
+ return await requestJson(config, "/v1/usage/sessions", {
13
+ method: "POST",
14
+ json: body,
15
+ signal: abortSignal,
16
+ }, sessionUsageResponseSchema);
17
+ },
10
18
  async get({ abortSignal, ...query } = {}) {
11
19
  return await requestJson(config, "/v1/usage", {
12
20
  query,
package/dist/types.d.ts CHANGED
@@ -13,8 +13,9 @@ import type { DecideToolApprovalBody, LatestSessionsListResponse, SessionMessage
13
13
  import type { CreateSkillBody, SkillArchiveType, SkillCopyResults, SkillDetail, SkillsListResponse } from "./contracts/entities/skills.ts";
14
14
  import type { CreateTaskBody, CreateTaskResponse, CreateTaskRunBody, CreateTaskRunResponse, TaskResponse, TaskRunMessagesResponse, TaskRunResponse, TaskRunsListResponse, TasksListResponse, UpdateTaskBody } from "./contracts/entities/tasks.ts";
15
15
  import type { TenantSettingsResponse, UpdateTenantSettingsBody } from "./contracts/entities/tenants.ts";
16
- import type { UsageOverviewQuery, UsageOverviewResponse, UsageQuery, UsageResponse } from "./contracts/entities/usage.ts";
16
+ import type { SessionUsageQuery, SessionUsageResponse, UsageOverviewQuery, UsageOverviewResponse, UsageQuery, UsageResponse } from "./contracts/entities/usage.ts";
17
17
  import type { CreateWorkspaceBody, UpdateWorkspaceBody, Workspace, WorkspacesListResponse } from "./contracts/entities/workspaces.ts";
18
+ import type { ChatFunctions } from "./functions.ts";
18
19
  export type KnownBlazingAgentsErrorCode = ApiErrorCode | "invalid_response" | "network_error" | "request_aborted" | "stream_error";
19
20
  export type BlazingAgentsErrorCode = KnownBlazingAgentsErrorCode | (string & {});
20
21
  export type BlazingAgentsFetch = (input: string, init?: BlazingAgentsRequestInit) => Promise<Response>;
@@ -46,6 +47,7 @@ export interface HttpConfig {
46
47
  clientRequestId?: string;
47
48
  fetch?: BlazingAgentsFetch;
48
49
  onResponse?: ((response: ResponseObservation) => void) | undefined;
50
+ scopeUserId?: string;
49
51
  }
50
52
  export interface BlazingAgentsOptions {
51
53
  apiKey: string;
@@ -57,6 +59,24 @@ export interface BlazingAgentsOptions {
57
59
  export interface BlazingAgentsRequestOptions {
58
60
  clientRequestId: string;
59
61
  }
62
+ export interface UserClient {
63
+ agent(input: {
64
+ agentId: string;
65
+ }): AgentClient;
66
+ readonly agents: AgentsResource;
67
+ readonly artifacts: ArtifactsResource;
68
+ chat(input: ChatInput): Promise<ChatResult>;
69
+ completion(input: CompletionInput): Promise<CompletionResult>;
70
+ readonly memories: MemoriesResource;
71
+ object(input: ObjectInput): Promise<ObjectResult>;
72
+ readonly prompts: PromptsResource;
73
+ resumeChat(input: ResumeChatInput): Promise<ChatResult>;
74
+ readonly sessions: SessionsResource;
75
+ readonly tasks: TasksResource;
76
+ readonly usage: Pick<UsageResource, "get" | "sessions">;
77
+ withOptions(options: BlazingAgentsRequestOptions): UserClient;
78
+ readonly workspaces: WorkspacesResource;
79
+ }
60
80
  export interface ResponseObservation {
61
81
  clientRequestId?: string;
62
82
  durationMs: number;
@@ -94,6 +114,8 @@ type ChatSessionInput = NewSessionInput | ExistingSessionInput;
94
114
  interface ChatMessageContentInput extends AttributionInput, CorrelatedRequestInput {
95
115
  abortSignal?: AbortSignal;
96
116
  agentId: string;
117
+ /** Caller-local functions for this invocation; handlers run in this process. */
118
+ functions?: ChatFunctions;
97
119
  message: UIMessage;
98
120
  messageId?: string;
99
121
  promptId?: never;
@@ -102,6 +124,8 @@ interface ChatMessageContentInput extends AttributionInput, CorrelatedRequestInp
102
124
  interface ChatPromptContentInput extends AttributionInput, CorrelatedRequestInput {
103
125
  abortSignal?: AbortSignal;
104
126
  agentId: string;
127
+ /** Caller-local functions for this invocation; handlers run in this process. */
128
+ functions?: ChatFunctions;
105
129
  message?: never;
106
130
  messageId?: string;
107
131
  promptId: string;
@@ -110,6 +134,15 @@ interface ChatPromptContentInput extends AttributionInput, CorrelatedRequestInpu
110
134
  export type ChatMessageInput = ChatMessageContentInput & ChatSessionInput;
111
135
  export type ChatPromptInput = ChatPromptContentInput & ChatSessionInput;
112
136
  export type ChatInput = ChatMessageInput | ChatPromptInput;
137
+ /** Reattaches handlers to a Session's tool-approval continuation. */
138
+ export interface ResumeChatInput extends CorrelatedRequestInput {
139
+ abortSignal?: AbortSignal;
140
+ agentId: string;
141
+ /** The decided continuation; omitted, the Session's queued or running one is resumed. */
142
+ continuationId?: string;
143
+ functions: ChatFunctions;
144
+ sessionId: string;
145
+ }
113
146
  export interface ChatResult {
114
147
  requestId?: string;
115
148
  /**
@@ -234,6 +267,8 @@ export interface AgentClient {
234
267
  readonly skills: AgentSkillsResource;
235
268
  }
236
269
  export interface AgentsListOptions extends ResourceRequestOptions {
270
+ cursor?: string;
271
+ limit?: number;
237
272
  userId?: string;
238
273
  workspaceId?: string;
239
274
  }
@@ -313,6 +348,8 @@ export interface PromptsResource {
313
348
  list(input?: {
314
349
  userId?: string;
315
350
  agentId?: string;
351
+ cursor?: string;
352
+ limit?: number;
316
353
  } & ResourceRequestOptions): Promise<PromptsResponse>;
317
354
  update(input: UpdatePromptBody & {
318
355
  promptId: string;
@@ -506,6 +543,7 @@ export interface UsageResource {
506
543
  } & ResourceRequestOptions): Promise<UsageResponse>;
507
544
  /** Returns totals, daily usage, and bounded Agent, user, and model rankings. */
508
545
  overview(input?: Partial<UsageOverviewQuery> & ResourceRequestOptions): Promise<UsageOverviewResponse>;
546
+ sessions(input: SessionUsageQuery & ResourceRequestOptions): Promise<SessionUsageResponse>;
509
547
  }
510
548
  /**
511
549
  * `client.merchantConnection` — the tenant's own Polar/Dodo merchant
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazingagents/sdk",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "TypeScript SDK for the Blazing Agents API",
5
5
  "homepage": "https://docs.blazingagents.com",
6
6
  "bugs": {
@@ -35,26 +35,28 @@
35
35
  "lint": "ultracite check",
36
36
  "prepack": "npm run build",
37
37
  "test": "vitest run --coverage",
38
- "test:consumer": "npm run build && tsc -p tsconfig.consumer.json && vitest run -c vitest.consumer.config.mts",
38
+ "test:consumer": "node test-consumer.mjs",
39
39
  "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.tests.json"
40
40
  },
41
41
  "dependencies": {
42
42
  "croner": "10.0.1",
43
43
  "nanoid": "6.0.1",
44
- "yaml": "2.9.0",
45
- "zod": "4.5.4"
44
+ "yaml": "2.9.0"
46
45
  },
47
46
  "devDependencies": {
48
47
  "@biomejs/biome": "^2.5.8",
48
+ "@types/json-schema": "7.0.15",
49
49
  "@types/node": "^26.4.0",
50
50
  "@vitest/coverage-v8": "^4.1.10",
51
51
  "ai": "^7.0.84",
52
52
  "typescript": "^7.0.2",
53
53
  "ultracite": "^7.10.2",
54
- "vitest": "^4.1.10"
54
+ "vitest": "^4.1.10",
55
+ "zod": "4.5.4"
55
56
  },
56
57
  "peerDependencies": {
57
- "ai": "^7.0.84"
58
+ "ai": "^7.0.84",
59
+ "zod": "^4.5.4"
58
60
  },
59
61
  "engines": {
60
62
  "node": ">=24"