@blazingagents/sdk 0.2.0 → 0.2.2

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 (52) hide show
  1. package/README.md +99 -344
  2. package/dist/contracts/api.d.ts +1 -1
  3. package/dist/contracts/api.js +1 -1
  4. package/dist/contracts/entities/agents.d.ts +14 -7
  5. package/dist/contracts/entities/agents.js +7 -3
  6. package/dist/contracts/entities/artifacts.d.ts +9 -9
  7. package/dist/contracts/entities/artifacts.js +5 -5
  8. package/dist/contracts/entities/chat.d.ts +7 -7
  9. package/dist/contracts/entities/chat.js +5 -5
  10. package/dist/contracts/entities/mcp-connections.d.ts +18 -18
  11. package/dist/contracts/entities/mcp-connections.js +13 -13
  12. package/dist/contracts/entities/memories.d.ts +5 -5
  13. package/dist/contracts/entities/memories.js +2 -2
  14. package/dist/contracts/entities/prompts.d.ts +4 -4
  15. package/dist/contracts/entities/prompts.js +2 -2
  16. package/dist/contracts/entities/providers.d.ts +12 -7
  17. package/dist/contracts/entities/providers.js +12 -6
  18. package/dist/contracts/entities/sessions.d.ts +10 -10
  19. package/dist/contracts/entities/sessions.js +6 -6
  20. package/dist/contracts/entities/skills.d.ts +18 -18
  21. package/dist/contracts/entities/skills.js +6 -6
  22. package/dist/contracts/entities/tasks.d.ts +56 -46
  23. package/dist/contracts/entities/tasks.js +25 -16
  24. package/dist/contracts/entities/tenants.d.ts +6 -6
  25. package/dist/contracts/entities/tenants.js +4 -4
  26. package/dist/contracts/entities/usage.d.ts +5 -5
  27. package/dist/contracts/entities/usage.js +3 -3
  28. package/dist/contracts/entities/workspaces.d.ts +9 -9
  29. package/dist/contracts/entities/workspaces.js +7 -2
  30. package/dist/contracts/index.d.ts +6 -4
  31. package/dist/contracts/index.js +4 -4
  32. package/dist/direct-chat-transport.d.ts +16 -0
  33. package/dist/direct-chat-transport.js +49 -0
  34. package/dist/generation.js +1 -0
  35. package/dist/http.d.ts +2 -0
  36. package/dist/http.js +2 -2
  37. package/dist/index.d.ts +3 -2
  38. package/dist/index.js +1 -0
  39. package/dist/resources/agents.js +11 -6
  40. package/dist/resources/artifacts.js +3 -2
  41. package/dist/resources/mcp-connections.js +4 -4
  42. package/dist/resources/memories.js +3 -2
  43. package/dist/resources/prompts.js +4 -3
  44. package/dist/resources/providers.js +10 -7
  45. package/dist/resources/sessions.js +4 -2
  46. package/dist/resources/skills.js +18 -10
  47. package/dist/resources/tasks.js +10 -5
  48. package/dist/resources/tenant.js +2 -2
  49. package/dist/resources/usage.js +4 -3
  50. package/dist/resources/workspaces.js +3 -2
  51. package/dist/types.d.ts +39 -33
  52. package/package.json +2 -2
package/dist/types.d.ts CHANGED
@@ -6,7 +6,7 @@ import type { BlazingAgentsChatMessageMetadata } from "./contracts/entities/chat
6
6
  import type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResponse, McpConnectionOauthConnectResponse, McpConnectionReconnectResult, McpConnectionResponse, McpConnectionsResponse, McpConnectionTestResponse, ReconnectMcpConnectionBody, UpdateMcpAttachmentBody, UpdateMcpConnectionBody } from "./contracts/entities/mcp-connections.ts";
7
7
  import type { CreateMemoryBody, MemoriesListResponse, MemoryResponse, UpdateMemoryBody } from "./contracts/entities/memories.ts";
8
8
  import type { CreatePromptBody, PromptResponse, PromptsResponse, UpdatePromptBody } from "./contracts/entities/prompts.ts";
9
- import type { CreateProviderBody, DeleteProviderOptions, ProviderModelsResponse, ProviderResponse, ProvidersResponse, UpdateProviderBody } from "./contracts/entities/providers.ts";
9
+ import type { CreateProviderBody, DeleteProviderOptions, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ThinkingLevelsResponse, UpdateProviderBody } from "./contracts/entities/providers.ts";
10
10
  import type { DecideToolApprovalBody, SessionMessagesResponse, SessionsListResponse, ToolApprovalDecisionResponse, ToolApprovalsResponse } from "./contracts/entities/sessions.ts";
11
11
  import type { CreateSkillBody, SkillArchiveType, SkillCopyResults, SkillDetail, SkillsListResponse } from "./contracts/entities/skills.ts";
12
12
  import type { CreateTaskBody, CreateTaskResponse, CreateTaskRunBody, CreateTaskRunResponse, TaskResponse, TaskRunMessagesResponse, TaskRunResponse, TaskRunsListResponse, TasksListResponse, UpdateTaskBody } from "./contracts/entities/tasks.ts";
@@ -127,10 +127,14 @@ export interface ChatResult {
127
127
  */
128
128
  sessionId: Promise<string>;
129
129
  toResponse: () => Response;
130
+ /** Claims the SSE bytes once, without constructing a Response. Shares ownership with toResponse(). */
131
+ toStream: () => ReadableStream<Uint8Array>;
130
132
  }
131
133
  export interface TerminalStreamResult {
132
134
  requestId?: string;
133
135
  toResponse: () => Response;
136
+ /** Claims the SSE bytes once, without constructing a Response. Shares ownership with toResponse(). */
137
+ toStream: () => ReadableStream<Uint8Array>;
134
138
  }
135
139
  interface StatelessGenerationInput extends AttributionInput, CorrelatedRequestInput {
136
140
  version?: number;
@@ -181,6 +185,7 @@ export interface ObjectResult {
181
185
  requestId?: string;
182
186
  toResponse: () => Response;
183
187
  }
188
+ export type ResourceReadOptions = Pick<RequestOptions, "signal">;
184
189
  export interface AgentsResource {
185
190
  /** Omitting `workspaceId` attaches a default Workspace with a lazy runtime. */
186
191
  create(body: CreateAgentBody): Promise<Agent>;
@@ -188,10 +193,10 @@ export interface AgentsResource {
188
193
  delete(agentId: string, includeArtifacts: boolean): Promise<void>;
189
194
  disable(agentId: string): Promise<Agent>;
190
195
  enable(agentId: string): Promise<Agent>;
191
- get(agentId: string): Promise<Agent>;
192
- getVersion(agentId: string, version: number): Promise<AgentVersion>;
196
+ get(agentId: string, options?: ResourceReadOptions): Promise<Agent>;
197
+ getVersion(agentId: string, version: number, options?: ResourceReadOptions): Promise<AgentVersion>;
193
198
  list(options?: AgentsListOptions): Promise<AgentsResponse>;
194
- listMcpAttachments(agentId: string): Promise<McpAttachmentsResponse>;
199
+ listMcpAttachments(agentId: string, options?: ResourceReadOptions): Promise<McpAttachmentsResponse>;
195
200
  listVersions(agentId: string, options?: AgentVersionsListOptions): Promise<AgentVersionsResponse>;
196
201
  removeAvatar(agentId: string): Promise<Agent>;
197
202
  /**
@@ -207,7 +212,7 @@ export interface AgentsResource {
207
212
  export interface AgentClient {
208
213
  readonly skills: AgentSkillsResource;
209
214
  }
210
- export interface AgentsListOptions {
215
+ export interface AgentsListOptions extends ResourceReadOptions {
211
216
  userId?: string;
212
217
  workspaceId?: string;
213
218
  }
@@ -218,22 +223,22 @@ export interface WorkspacesResource {
218
223
  }): Promise<"completed" | "pending">;
219
224
  get(input: {
220
225
  workspaceId: string;
221
- }): Promise<Workspace>;
226
+ }, options?: ResourceReadOptions): Promise<Workspace>;
222
227
  list(options?: WorkspacesListOptions): Promise<WorkspacesListResponse>;
223
228
  update(input: UpdateWorkspaceBody & {
224
229
  workspaceId: string;
225
230
  }): Promise<Workspace>;
226
231
  }
227
- export interface WorkspacesListOptions {
232
+ export interface WorkspacesListOptions extends ResourceReadOptions {
228
233
  cursor?: string;
229
234
  limit?: number;
230
235
  userId?: string;
231
236
  }
232
- export interface AgentVersionsListOptions {
237
+ export interface AgentVersionsListOptions extends ResourceReadOptions {
233
238
  cursor?: string;
234
239
  limit?: number;
235
240
  }
236
- export interface ArtifactsListOptions {
241
+ export interface ArtifactsListOptions extends ResourceReadOptions {
237
242
  agentId?: string;
238
243
  cursor?: string;
239
244
  sessionId?: string;
@@ -241,17 +246,17 @@ export interface ArtifactsListOptions {
241
246
  export interface ArtifactsResource {
242
247
  createDownloadUrl(artifactId: string): Promise<ArtifactDownloadUrlResponse>;
243
248
  delete(artifactId: string): Promise<void>;
244
- get(artifactId: string): Promise<ArtifactListItem>;
249
+ get(artifactId: string, options?: ResourceReadOptions): Promise<ArtifactListItem>;
245
250
  list(options?: ArtifactsListOptions): Promise<ArtifactsListResponse>;
246
251
  }
247
252
  export interface MemoriesResource {
248
253
  create(agentId: string, body: CreateMemoryBody): Promise<MemoryResponse>;
249
254
  delete(agentId: string, memoryId: string): Promise<void>;
250
- get(agentId: string, memoryId: string): Promise<MemoryResponse>;
255
+ get(agentId: string, memoryId: string, options?: ResourceReadOptions): Promise<MemoryResponse>;
251
256
  list(agentId: string, options?: MemoriesListOptions): Promise<MemoriesListResponse>;
252
257
  update(agentId: string, memoryId: string, body: UpdateMemoryBody): Promise<MemoryResponse>;
253
258
  }
254
- export interface MemoriesListOptions {
259
+ export interface MemoriesListOptions extends ResourceReadOptions {
255
260
  cursor?: string;
256
261
  limit?: number;
257
262
  search?: string;
@@ -260,34 +265,35 @@ export interface MemoriesListOptions {
260
265
  export interface PromptsResource {
261
266
  create(body: CreatePromptBody): Promise<PromptResponse>;
262
267
  delete(promptId: string): Promise<void>;
263
- get(promptId: string): Promise<PromptResponse>;
264
- list(userId?: string): Promise<PromptsResponse>;
268
+ get(promptId: string, options?: ResourceReadOptions): Promise<PromptResponse>;
269
+ list(userId?: string, options?: ResourceReadOptions): Promise<PromptsResponse>;
265
270
  update(promptId: string, body: UpdatePromptBody): Promise<PromptResponse>;
266
271
  }
267
272
  export interface ProvidersResource {
268
273
  create(body: CreateProviderBody): Promise<ProviderResponse>;
269
274
  delete(id: string, options?: DeleteProviderOptions): Promise<void>;
270
- get(id: string): Promise<ProviderResponse>;
271
- list(): Promise<ProvidersResponse>;
272
- listModels(id: string): Promise<ProviderModelsResponse>;
275
+ get(id: string, options?: ResourceReadOptions): Promise<ProviderResponse>;
276
+ getThinkingLevels(id: string, model: string, options?: ResourceReadOptions): Promise<ThinkingLevelsResponse>;
277
+ list(options?: ResourceReadOptions): Promise<ProvidersResponse>;
278
+ listModels(id: string, options?: ResourceReadOptions): Promise<ProviderModelsResponse>;
273
279
  update(id: string, body: UpdateProviderBody): Promise<ProviderResponse>;
274
280
  }
275
281
  export interface McpConnectionsResource {
276
282
  connect(id: string): Promise<McpConnectionOauthConnectResponse>;
277
283
  create(body: CreateMcpConnectionBody): Promise<McpConnectionResponse>;
278
284
  delete(id: string): Promise<void>;
279
- get(id: string): Promise<McpConnectionResponse>;
280
- list(): Promise<McpConnectionsResponse>;
285
+ get(id: string, options?: ResourceReadOptions): Promise<McpConnectionResponse>;
286
+ list(options?: ResourceReadOptions): Promise<McpConnectionsResponse>;
281
287
  reconnect(id: string, body: ReconnectMcpConnectionBody): Promise<McpConnectionReconnectResult>;
282
288
  test(id: string): Promise<McpConnectionTestResponse>;
283
289
  update(id: string, body: UpdateMcpConnectionBody): Promise<McpConnectionResponse>;
284
290
  }
285
- export interface SessionsListOptions {
291
+ export interface SessionsListOptions extends ResourceReadOptions {
286
292
  cursor?: string;
287
293
  limit?: number;
288
294
  userId?: string;
289
295
  }
290
- export interface SessionMessagesOptions {
296
+ export interface SessionMessagesOptions extends ResourceReadOptions {
291
297
  after?: string;
292
298
  cursor?: string;
293
299
  limit?: number;
@@ -302,7 +308,7 @@ export interface SessionsResource {
302
308
  }): Promise<TerminalStreamResult>;
303
309
  list(agentId: string, options?: SessionsListOptions): Promise<SessionsListResponse>;
304
310
  messages(agentId: string, sessionId: string, options?: SessionMessagesOptions): Promise<SessionMessagesResponse>;
305
- toolApprovals(agentId: string, sessionId: string): Promise<ToolApprovalsResponse>;
311
+ toolApprovals(agentId: string, sessionId: string, options?: ResourceReadOptions): Promise<ToolApprovalsResponse>;
306
312
  }
307
313
  export interface AgentSkillsResource {
308
314
  copy(input: {
@@ -321,11 +327,11 @@ export interface AgentSkillsResource {
321
327
  }): Promise<SkillDetail>;
322
328
  get(input: {
323
329
  skillId: string;
324
- }): Promise<SkillDetail>;
330
+ }, options?: ResourceReadOptions): Promise<SkillDetail>;
325
331
  getFile(input: {
326
332
  path: string;
327
333
  skillId: string;
328
- }): Promise<Uint8Array>;
334
+ }, options?: ResourceReadOptions): Promise<Uint8Array>;
329
335
  list(options?: SkillsListOptions): Promise<SkillsListResponse>;
330
336
  putFile(input: {
331
337
  content: Blob | string | Uint8Array;
@@ -339,21 +345,21 @@ export interface AgentSkillsResource {
339
345
  };
340
346
  }): Promise<SkillDetail>;
341
347
  }
342
- export interface SkillsListOptions {
348
+ export interface SkillsListOptions extends ResourceReadOptions {
343
349
  cursor?: string;
344
350
  limit?: number;
345
351
  }
346
- export interface TasksListOptions {
352
+ export interface TasksListOptions extends ResourceReadOptions {
347
353
  agentId?: string;
348
354
  cursor?: string;
349
355
  limit?: number;
350
356
  userId?: string;
351
357
  }
352
- export interface TaskRunsListOptions {
358
+ export interface TaskRunsListOptions extends ResourceReadOptions {
353
359
  cursor?: string;
354
360
  limit?: number;
355
361
  }
356
- export interface TaskRunMessagesOptions {
362
+ export interface TaskRunMessagesOptions extends ResourceReadOptions {
357
363
  after?: string;
358
364
  cursor?: string;
359
365
  limit?: number;
@@ -363,19 +369,19 @@ export interface TasksResource {
363
369
  create(body: CreateTaskBody): Promise<CreateTaskResponse>;
364
370
  createRun(taskId: string, body?: CreateTaskRunBody): Promise<CreateTaskRunResponse>;
365
371
  delete(taskId: string): Promise<void>;
366
- get(taskId: string): Promise<TaskResponse>;
367
- getRun(taskId: string, runId: string): Promise<TaskRunResponse>;
372
+ get(taskId: string, options?: ResourceReadOptions): Promise<TaskResponse>;
373
+ getRun(taskId: string, runId: string, options?: ResourceReadOptions): Promise<TaskRunResponse>;
368
374
  list(options?: TasksListOptions): Promise<TasksListResponse>;
369
375
  listRuns(taskId: string, options?: TaskRunsListOptions): Promise<TaskRunsListResponse>;
370
376
  runMessages(taskId: string, runId: string, options?: TaskRunMessagesOptions): Promise<TaskRunMessagesResponse>;
371
377
  update(taskId: string, body: UpdateTaskBody): Promise<TaskResponse>;
372
378
  }
373
379
  export interface TenantResource {
374
- get(): Promise<TenantSettingsResponse>;
380
+ get(options?: ResourceReadOptions): Promise<TenantSettingsResponse>;
375
381
  patch(body: UpdateTenantSettingsBody): Promise<TenantSettingsResponse>;
376
382
  }
377
383
  export interface UsageResource {
378
- get(query?: Partial<UsageQuery>): Promise<UsageResponse>;
379
- getForAgent(agentId: string, query?: Partial<UsageQuery>): Promise<UsageResponse>;
384
+ get(query?: Partial<UsageQuery> & ResourceReadOptions): Promise<UsageResponse>;
385
+ getForAgent(agentId: string, query?: Partial<UsageQuery> & ResourceReadOptions): Promise<UsageResponse>;
380
386
  }
381
387
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazingagents/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "TypeScript SDK for the Blazing Agents API",
5
5
  "homepage": "https://docs.blazingagents.com",
6
6
  "bugs": {
@@ -35,7 +35,7 @@
35
35
  "lint": "ultracite check",
36
36
  "prepack": "npm run build",
37
37
  "test": "vitest run --coverage",
38
- "test:consumer": "npm run build && vitest run -c vitest.consumer.config.mts",
38
+ "test:consumer": "npm run build && tsc -p tsconfig.consumer.json && vitest run -c vitest.consumer.config.mts",
39
39
  "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.tests.json"
40
40
  },
41
41
  "dependencies": {