@blazingagents/sdk 0.31.0 → 0.32.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 +3 -0
- package/dist/chat-transport.js +1 -3
- package/dist/contracts/entities/chat-connections.d.ts +51 -0
- package/dist/contracts/entities/chat-connections.js +24 -0
- package/dist/contracts/entities/chat.d.ts +2 -0
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/index.js +1 -1
- package/dist/direct-chat-transport.js +28 -40
- package/dist/errors.js +0 -2
- package/dist/functions.js +2 -2
- package/dist/generation.d.ts +1 -2
- package/dist/generation.js +45 -79
- package/dist/http.d.ts +5 -10
- package/dist/http.js +8 -1
- package/dist/index.d.ts +1 -1
- package/dist/resources/agents.js +12 -12
- package/dist/resources/artifacts.js +4 -4
- package/dist/resources/chat-connections.js +21 -9
- package/dist/resources/mcp-connections.js +9 -8
- package/dist/resources/memories.js +6 -6
- package/dist/resources/merchant-bindings.js +3 -3
- package/dist/resources/merchant-usage-events.js +5 -5
- package/dist/resources/prompts.js +4 -4
- package/dist/resources/providers.js +6 -6
- package/dist/resources/sessions.js +13 -17
- package/dist/resources/skills.js +9 -8
- package/dist/resources/tasks.js +10 -11
- package/dist/resources/usage.js +2 -2
- package/dist/resources/workspaces.js +4 -4
- package/dist/types.d.ts +33 -2
- package/package.json +2 -2
package/dist/resources/tasks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createTaskResponseSchema, createTaskRunResponseSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunsListResponseSchema, tasksListResponseSchema, } from "../contracts/entities/tasks.js";
|
|
2
|
-
import { requestJson } from "../http.js";
|
|
2
|
+
import { apiPath, requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.tasks` — CRUD + runs over `/v1/tasks`. Runs are listed/get/
|
|
5
5
|
* canceled/transcripted via `/v1/tasks/:taskId/runs/...`. All lists are
|
|
@@ -29,8 +29,7 @@ export function createTasksResource(config) {
|
|
|
29
29
|
agentId: options.agentId,
|
|
30
30
|
cursor: options.cursor,
|
|
31
31
|
limit: options.limit,
|
|
32
|
-
|
|
33
|
-
...(options.userId === undefined ? {} : { userId: options.userId }),
|
|
32
|
+
userId: options.userId,
|
|
34
33
|
},
|
|
35
34
|
}, tasksListResponseSchema);
|
|
36
35
|
},
|
|
@@ -38,13 +37,13 @@ export function createTasksResource(config) {
|
|
|
38
37
|
* Retrieves tasks.
|
|
39
38
|
*/
|
|
40
39
|
async get({ taskId, abortSignal }) {
|
|
41
|
-
return await requestJson(config, `/v1/tasks/${taskId}`, { signal: abortSignal }, taskResponseSchema);
|
|
40
|
+
return await requestJson(config, apiPath `/v1/tasks/${taskId}`, { signal: abortSignal }, taskResponseSchema);
|
|
42
41
|
},
|
|
43
42
|
/**
|
|
44
43
|
* Updates tasks.
|
|
45
44
|
*/
|
|
46
45
|
async update({ taskId, abortSignal, ...body }) {
|
|
47
|
-
return await requestJson(config, `/v1/tasks/${taskId}`, {
|
|
46
|
+
return await requestJson(config, apiPath `/v1/tasks/${taskId}`, {
|
|
48
47
|
json: body,
|
|
49
48
|
signal: abortSignal,
|
|
50
49
|
method: "PATCH",
|
|
@@ -54,7 +53,7 @@ export function createTasksResource(config) {
|
|
|
54
53
|
* Deletes tasks.
|
|
55
54
|
*/
|
|
56
55
|
async delete({ taskId, abortSignal }) {
|
|
57
|
-
await requestJson(config, `/v1/tasks/${taskId}`, {
|
|
56
|
+
await requestJson(config, apiPath `/v1/tasks/${taskId}`, {
|
|
58
57
|
method: "DELETE",
|
|
59
58
|
signal: abortSignal,
|
|
60
59
|
});
|
|
@@ -63,13 +62,13 @@ export function createTasksResource(config) {
|
|
|
63
62
|
* Creates a Task run.
|
|
64
63
|
*/
|
|
65
64
|
async createRun({ taskId, abortSignal, ...body }) {
|
|
66
|
-
return await requestJson(config, `/v1/tasks/${taskId}/runs`, { json: body, method: "POST", signal: abortSignal }, createTaskRunResponseSchema);
|
|
65
|
+
return await requestJson(config, apiPath `/v1/tasks/${taskId}/runs`, { json: body, method: "POST", signal: abortSignal }, createTaskRunResponseSchema);
|
|
67
66
|
},
|
|
68
67
|
/**
|
|
69
68
|
* Lists one page of Task runs.
|
|
70
69
|
*/
|
|
71
70
|
async listRuns({ taskId, ...options }) {
|
|
72
|
-
return await requestJson(config, `/v1/tasks/${taskId}/runs`, {
|
|
71
|
+
return await requestJson(config, apiPath `/v1/tasks/${taskId}/runs`, {
|
|
73
72
|
signal: options.abortSignal,
|
|
74
73
|
query: { cursor: options.cursor, limit: options.limit },
|
|
75
74
|
}, taskRunsListResponseSchema);
|
|
@@ -78,13 +77,13 @@ export function createTasksResource(config) {
|
|
|
78
77
|
* Retrieves a Task run.
|
|
79
78
|
*/
|
|
80
79
|
async getRun({ taskId, runId, abortSignal }) {
|
|
81
|
-
return await requestJson(config, `/v1/tasks/${taskId}/runs/${runId}`, { signal: abortSignal }, taskRunResponseSchema);
|
|
80
|
+
return await requestJson(config, apiPath `/v1/tasks/${taskId}/runs/${runId}`, { signal: abortSignal }, taskRunResponseSchema);
|
|
82
81
|
},
|
|
83
82
|
/**
|
|
84
83
|
* Lists one page of Task run messages.
|
|
85
84
|
*/
|
|
86
85
|
async runMessages({ taskId, runId, ...options }) {
|
|
87
|
-
return await requestJson(config, `/v1/tasks/${taskId}/runs/${runId}/messages`, {
|
|
86
|
+
return await requestJson(config, apiPath `/v1/tasks/${taskId}/runs/${runId}/messages`, {
|
|
88
87
|
signal: options.abortSignal,
|
|
89
88
|
query: {
|
|
90
89
|
cursor: options.cursor,
|
|
@@ -97,7 +96,7 @@ export function createTasksResource(config) {
|
|
|
97
96
|
* Requests cancellation of a Task run.
|
|
98
97
|
*/
|
|
99
98
|
async cancelRun({ taskId, runId, abortSignal }) {
|
|
100
|
-
await requestJson(config, `/v1/tasks/${taskId}/runs/${runId}/cancel`, { method: "POST", signal: abortSignal });
|
|
99
|
+
await requestJson(config, apiPath `/v1/tasks/${taskId}/runs/${runId}/cancel`, { method: "POST", signal: abortSignal });
|
|
101
100
|
},
|
|
102
101
|
};
|
|
103
102
|
}
|
package/dist/resources/usage.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sessionUsageQuerySchema, sessionUsageResponseSchema, usageOverviewResponseSchemaForQuery, usageResponseSchema, } from "../contracts/entities/usage.js";
|
|
2
|
-
import { requestJson } from "../http.js";
|
|
2
|
+
import { apiPath, requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.usage` — get over `/v1/usage` (tenant-wide) and
|
|
5
5
|
* `/v1/agents/:agentId/usage` (per-agent). The query shape is `UsageQuery`;
|
|
@@ -33,7 +33,7 @@ export function createUsageResource(config) {
|
|
|
33
33
|
* Retrieves usage for one Agent.
|
|
34
34
|
*/
|
|
35
35
|
async getForAgent({ agentId, abortSignal, ...query }) {
|
|
36
|
-
return await requestJson(config, `/v1/agents/${agentId}/usage`, { query, signal: abortSignal }, usageResponseSchema);
|
|
36
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/usage`, { query, signal: abortSignal }, usageResponseSchema);
|
|
37
37
|
},
|
|
38
38
|
/**
|
|
39
39
|
* Retrieves usage totals, daily usage, and bounded rankings.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { workspaceSchema, workspacesListResponseSchema, } from "../contracts/entities/workspaces.js";
|
|
2
|
-
import { requestJson, requestStream } from "../http.js";
|
|
2
|
+
import { apiPath, requestJson, requestStream } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* Builds the Workspaces operations using the shared HTTP configuration.
|
|
5
5
|
* @param config - Shared authentication and transport configuration.
|
|
@@ -21,14 +21,14 @@ export function createWorkspacesResource(config) {
|
|
|
21
21
|
* Deletes workspaces.
|
|
22
22
|
*/
|
|
23
23
|
async delete({ workspaceId, abortSignal }) {
|
|
24
|
-
const response = await requestStream(config, `/v1/workspaces/${
|
|
24
|
+
const response = await requestStream(config, apiPath `/v1/workspaces/${workspaceId}`, { method: "DELETE", signal: abortSignal });
|
|
25
25
|
return response.status === 202 ? "pending" : "completed";
|
|
26
26
|
},
|
|
27
27
|
/**
|
|
28
28
|
* Retrieves workspaces.
|
|
29
29
|
*/
|
|
30
30
|
async get({ workspaceId, abortSignal }) {
|
|
31
|
-
return await requestJson(config, `/v1/workspaces/${
|
|
31
|
+
return await requestJson(config, apiPath `/v1/workspaces/${workspaceId}`, { signal: abortSignal }, workspaceSchema);
|
|
32
32
|
},
|
|
33
33
|
/**
|
|
34
34
|
* Lists one page of workspaces.
|
|
@@ -47,7 +47,7 @@ export function createWorkspacesResource(config) {
|
|
|
47
47
|
* Updates workspaces.
|
|
48
48
|
*/
|
|
49
49
|
async update({ workspaceId, abortSignal, ...body }) {
|
|
50
|
-
return await requestJson(config, `/v1/workspaces/${
|
|
50
|
+
return await requestJson(config, apiPath `/v1/workspaces/${workspaceId}`, { json: body, signal: abortSignal, method: "PUT" }, workspaceSchema);
|
|
51
51
|
},
|
|
52
52
|
};
|
|
53
53
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ApiErrorCode } from "./contracts/api.ts";
|
|
|
3
3
|
import type { Agent, AgentsResponse, 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, ChatDeliveriesResponse, ChatDeliveryListStatus, CreateChatConnectionBody, RotateChatConnectionBody, UpdateChatConnectionBody } from "./contracts/entities/chat-connections.ts";
|
|
6
|
+
import type { ChatConnection, ChatConnectionsResponse, ChatDeliveriesResponse, ChatDeliveryList, ChatDeliveryListStatus, ChatDeliveryResult, CreateChatConnectionBody, RepairChatDeliveryBody, 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";
|
|
@@ -657,7 +657,9 @@ export interface ProvidersResource {
|
|
|
657
657
|
}
|
|
658
658
|
export interface McpConnectionsResource {
|
|
659
659
|
/**
|
|
660
|
-
* Starts OAuth authorization for the MCP Connection.
|
|
660
|
+
* Starts OAuth authorization for the MCP Connection. The API serves this
|
|
661
|
+
* route only to a dashboard session (`DashboardJwt`) and refuses an API
|
|
662
|
+
* key, so a client built with an API key gets an error.
|
|
661
663
|
* @param input - `mcpConnectionId`; optional abortSignal.
|
|
662
664
|
* @returns The mcp connection oauth connect response.
|
|
663
665
|
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
@@ -1291,6 +1293,35 @@ export interface ChatConnectionsResource {
|
|
|
1291
1293
|
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
1292
1294
|
*/
|
|
1293
1295
|
list(input?: ResourceRequestOptions): Promise<ChatConnectionsResponse>;
|
|
1296
|
+
/**
|
|
1297
|
+
* Lists one page of the replies and approval cards the Chat Connection has
|
|
1298
|
+
* sent or tried to send, newest first, in every status. Pass `nextCursor`
|
|
1299
|
+
* as `cursor` to fetch older records.
|
|
1300
|
+
* @param input - `chatConnectionId`; optional `cursor`, `limit` (1 to 100, default 100), and abortSignal.
|
|
1301
|
+
* @returns The page of chat deliveries.
|
|
1302
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
1303
|
+
*/
|
|
1304
|
+
listDeliveries(input: {
|
|
1305
|
+
chatConnectionId: string;
|
|
1306
|
+
cursor?: string;
|
|
1307
|
+
limit?: number;
|
|
1308
|
+
} & ResourceRequestOptions): Promise<ChatDeliveryList>;
|
|
1309
|
+
/**
|
|
1310
|
+
* Sends a stuck reply or approval card again, without running a turn or
|
|
1311
|
+
* tool. Use it when the previous send stopped before its outcome was known.
|
|
1312
|
+
* Pass the delivery's current `attempt` as `expectedAttempt`; the repair is
|
|
1313
|
+
* refused if it has changed. `previousSenderStopped` and
|
|
1314
|
+
* `acceptDuplicateRisk` must be `true`: the message can appear twice. The
|
|
1315
|
+
* connection must be enabled. Check `status` in the result, because a
|
|
1316
|
+
* successful request does not by itself mean the message was delivered.
|
|
1317
|
+
* @param input - `chatConnectionId`, `deliveryId`, the repair confirmations, and optional abortSignal.
|
|
1318
|
+
* @returns The delivery outcome.
|
|
1319
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
1320
|
+
*/
|
|
1321
|
+
repairDelivery(input: RepairChatDeliveryBody & {
|
|
1322
|
+
chatConnectionId: string;
|
|
1323
|
+
deliveryId: string;
|
|
1324
|
+
} & ResourceRequestOptions): Promise<ChatDeliveryResult>;
|
|
1294
1325
|
/**
|
|
1295
1326
|
* Replaces the Chat Connection credentials.
|
|
1296
1327
|
* @param input - `chatConnectionId`; fields to change; optional abortSignal.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazingagents/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
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
|
"fix": "ultracite fix",
|
|
36
36
|
"lint": "ultracite check",
|
|
37
37
|
"prepack": "npm run build",
|
|
38
|
-
"test": "vitest run --coverage",
|
|
38
|
+
"test": "node scripts/check-test-imports.ts && vitest run --coverage",
|
|
39
39
|
"test:consumer": "node test-consumer.mjs",
|
|
40
40
|
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.tests.json",
|
|
41
41
|
"unused": "knip && knip --production --include exports,types,duplicates"
|