@blazingagents/sdk 0.31.0 → 0.33.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/client.d.ts +1 -1
- package/dist/client.js +25 -25
- 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/entities/mcp-connections.d.ts +0 -4
- package/dist/contracts/entities/mcp-connections.js +0 -16
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.js +2 -2
- 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 +2 -2
- 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 +7 -13
- 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 +31 -11
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { merchantUsageEventResponseSchema, merchantUsageEventsResponseSchema, merchantUsageSummaryResponseSchema, } from "../contracts/entities/merchant.js";
|
|
2
|
-
import { requestJson } from "../http.js";
|
|
2
|
+
import { apiPath, requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.merchantUsageEvents` — the immutable usage-event ledger over
|
|
5
5
|
* `/v1/merchant-usage-events`, plus the delivery-health `summary` aggregate
|
|
@@ -19,7 +19,7 @@ export function createMerchantUsageEventsResource(config) {
|
|
|
19
19
|
* Retrieves merchant usage events.
|
|
20
20
|
*/
|
|
21
21
|
async get({ eventId, abortSignal }) {
|
|
22
|
-
return await requestJson(config, `/v1/merchant-usage-events/${
|
|
22
|
+
return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}`, { signal: abortSignal }, merchantUsageEventResponseSchema);
|
|
23
23
|
},
|
|
24
24
|
/**
|
|
25
25
|
* Retrieves merchant usage delivery totals for the selected day range.
|
|
@@ -31,19 +31,19 @@ export function createMerchantUsageEventsResource(config) {
|
|
|
31
31
|
* Retries delivery of merchant usage events.
|
|
32
32
|
*/
|
|
33
33
|
async retry({ eventId, abortSignal }) {
|
|
34
|
-
return await requestJson(config, `/v1/merchant-usage-events/${
|
|
34
|
+
return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}/retry`, { method: "POST", signal: abortSignal }, merchantUsageEventResponseSchema);
|
|
35
35
|
},
|
|
36
36
|
/**
|
|
37
37
|
* Releases merchant usage events.
|
|
38
38
|
*/
|
|
39
39
|
async release({ eventId, abortSignal }) {
|
|
40
|
-
return await requestJson(config, `/v1/merchant-usage-events/${
|
|
40
|
+
return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}/release`, { method: "POST", signal: abortSignal }, merchantUsageEventResponseSchema);
|
|
41
41
|
},
|
|
42
42
|
/**
|
|
43
43
|
* Discards merchant usage events.
|
|
44
44
|
*/
|
|
45
45
|
async discard({ eventId, abortSignal }) {
|
|
46
|
-
return await requestJson(config, `/v1/merchant-usage-events/${
|
|
46
|
+
return await requestJson(config, apiPath `/v1/merchant-usage-events/${eventId}/discard`, { method: "POST", signal: abortSignal }, merchantUsageEventResponseSchema);
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
49
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promptResponseSchema, promptsResponseSchema, } from "../contracts/entities/prompts.js";
|
|
2
|
-
import { requestJson } from "../http.js";
|
|
2
|
+
import { apiPath, requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* Builds the Prompts operations using the shared HTTP configuration.
|
|
5
5
|
* @param config - Shared authentication and transport configuration.
|
|
@@ -30,13 +30,13 @@ export function createPromptsResource(config) {
|
|
|
30
30
|
* Retrieves prompts.
|
|
31
31
|
*/
|
|
32
32
|
async get({ promptId, abortSignal }) {
|
|
33
|
-
return await requestJson(config, `/v1/prompts/${promptId}`, { signal: abortSignal }, promptResponseSchema);
|
|
33
|
+
return await requestJson(config, apiPath `/v1/prompts/${promptId}`, { signal: abortSignal }, promptResponseSchema);
|
|
34
34
|
},
|
|
35
35
|
/**
|
|
36
36
|
* Updates prompts.
|
|
37
37
|
*/
|
|
38
38
|
async update({ promptId, abortSignal, ...body }) {
|
|
39
|
-
return await requestJson(config, `/v1/prompts/${promptId}`, {
|
|
39
|
+
return await requestJson(config, apiPath `/v1/prompts/${promptId}`, {
|
|
40
40
|
json: body,
|
|
41
41
|
signal: abortSignal,
|
|
42
42
|
method: "PATCH",
|
|
@@ -46,7 +46,7 @@ export function createPromptsResource(config) {
|
|
|
46
46
|
* Deletes prompts.
|
|
47
47
|
*/
|
|
48
48
|
async delete({ promptId, abortSignal }) {
|
|
49
|
-
await requestJson(config, `/v1/prompts/${promptId}`, {
|
|
49
|
+
await requestJson(config, apiPath `/v1/prompts/${promptId}`, {
|
|
50
50
|
method: "DELETE",
|
|
51
51
|
signal: abortSignal,
|
|
52
52
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, thinkingLevelsResponseSchema, } from "../contracts/entities/providers.js";
|
|
2
|
-
import { requestJson } from "../http.js";
|
|
2
|
+
import { apiPath, requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.providers` — CRUD and cost-free model discovery.
|
|
5
5
|
* @param config - Shared authentication and transport configuration.
|
|
@@ -27,25 +27,25 @@ export function createProvidersResource(config) {
|
|
|
27
27
|
* Retrieves providers.
|
|
28
28
|
*/
|
|
29
29
|
async get({ providerId, abortSignal }) {
|
|
30
|
-
return await requestJson(config, `/v1/providers/${providerId}`, { signal: abortSignal }, providerResponseSchema);
|
|
30
|
+
return await requestJson(config, apiPath `/v1/providers/${providerId}`, { signal: abortSignal }, providerResponseSchema);
|
|
31
31
|
},
|
|
32
32
|
/**
|
|
33
33
|
* Lists models exposed by the Provider.
|
|
34
34
|
*/
|
|
35
35
|
async listModels({ providerId, abortSignal }) {
|
|
36
|
-
return await requestJson(config, `/v1/providers/${providerId}/models`, { signal: abortSignal }, providerModelsResponseSchema);
|
|
36
|
+
return await requestJson(config, apiPath `/v1/providers/${providerId}/models`, { signal: abortSignal }, providerModelsResponseSchema);
|
|
37
37
|
},
|
|
38
38
|
/**
|
|
39
39
|
* Retrieves supported thinking levels for a Provider model.
|
|
40
40
|
*/
|
|
41
41
|
async getThinkingLevels({ providerId, model, abortSignal }) {
|
|
42
|
-
return await requestJson(config, `/v1/providers/${providerId}/thinking-levels`, { signal: abortSignal, query: { model } }, thinkingLevelsResponseSchema);
|
|
42
|
+
return await requestJson(config, apiPath `/v1/providers/${providerId}/thinking-levels`, { signal: abortSignal, query: { model } }, thinkingLevelsResponseSchema);
|
|
43
43
|
},
|
|
44
44
|
/**
|
|
45
45
|
* Updates providers.
|
|
46
46
|
*/
|
|
47
47
|
async update({ providerId, abortSignal, ...body }) {
|
|
48
|
-
return await requestJson(config, `/v1/providers/${providerId}`, {
|
|
48
|
+
return await requestJson(config, apiPath `/v1/providers/${providerId}`, {
|
|
49
49
|
json: body,
|
|
50
50
|
signal: abortSignal,
|
|
51
51
|
method: "PATCH",
|
|
@@ -55,7 +55,7 @@ export function createProvidersResource(config) {
|
|
|
55
55
|
* Deletes providers.
|
|
56
56
|
*/
|
|
57
57
|
async delete({ providerId, abortSignal, ...options }) {
|
|
58
|
-
await requestJson(config, `/v1/providers/${providerId}`, {
|
|
58
|
+
await requestJson(config, apiPath `/v1/providers/${providerId}`, {
|
|
59
59
|
method: "DELETE",
|
|
60
60
|
signal: abortSignal,
|
|
61
61
|
query: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { sessionInputResponseSchema, sessionInputsResponseSchema, stopSessionResponseSchema, } from "../contracts/entities/session-inputs.js";
|
|
2
2
|
import { latestSessionsListResponseSchema, sessionMessagesResponseSchema, sessionResponseSchema, sessionsListResponseSchema, toolApprovalsResponseSchema, } from "../contracts/entities/sessions.js";
|
|
3
3
|
import { agentIdSchema, sessionIdSchema, turnIdSchema, } from "../contracts/ids.js";
|
|
4
|
-
import { requestJson } from "../http.js";
|
|
4
|
+
import { apiPath, requestJson } from "../http.js";
|
|
5
5
|
/**
|
|
6
6
|
* `client.sessions` reads, paginates, and deletes Sessions under
|
|
7
7
|
* `/v1/agents/:agentId/sessions`. Pagination is manual: the SDK returns
|
|
@@ -16,19 +16,19 @@ export function createSessionsResource(config) {
|
|
|
16
16
|
* Submits a Session input. Reuse the request ID and payload after an uncertain acknowledgement.
|
|
17
17
|
*/
|
|
18
18
|
async submitInput({ agentId, sessionId, abortSignal, ...body }) {
|
|
19
|
-
return await requestJson(config, `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/inputs`, { method: "POST", json: body, signal: abortSignal }, sessionInputResponseSchema);
|
|
19
|
+
return await requestJson(config, apiPath `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/inputs`, { method: "POST", json: body, signal: abortSignal }, sessionInputResponseSchema);
|
|
20
20
|
},
|
|
21
21
|
/**
|
|
22
22
|
* Lists input receipts. Poll the first page to observe state changes.
|
|
23
23
|
*/
|
|
24
24
|
async inputs({ agentId, sessionId, abortSignal, ...query }) {
|
|
25
|
-
return await requestJson(config, `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/inputs`, { query, signal: abortSignal }, sessionInputsResponseSchema);
|
|
25
|
+
return await requestJson(config, apiPath `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/inputs`, { query, signal: abortSignal }, sessionInputsResponseSchema);
|
|
26
26
|
},
|
|
27
27
|
/**
|
|
28
28
|
* Records cancellation for the named Turn without waiting for settlement.
|
|
29
29
|
*/
|
|
30
30
|
async stop({ agentId, sessionId, turnId, abortSignal }) {
|
|
31
|
-
return await requestJson(config, `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/stop`, {
|
|
31
|
+
return await requestJson(config, apiPath `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/stop`, {
|
|
32
32
|
method: "POST",
|
|
33
33
|
json: { turnId: turnIdSchema.parse(turnId) },
|
|
34
34
|
signal: abortSignal,
|
|
@@ -38,7 +38,7 @@ export function createSessionsResource(config) {
|
|
|
38
38
|
* Forks a Session at a message. Reuse the idempotency key after an uncertain acknowledgement.
|
|
39
39
|
*/
|
|
40
40
|
async fork({ agentId, sessionId, messageId, idempotencyKey, abortSignal }) {
|
|
41
|
-
return await requestJson(config, `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/fork`, {
|
|
41
|
+
return await requestJson(config, apiPath `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/fork`, {
|
|
42
42
|
method: "POST",
|
|
43
43
|
json: { messageId },
|
|
44
44
|
headers: { "Idempotency-Key": idempotencyKey },
|
|
@@ -49,19 +49,18 @@ export function createSessionsResource(config) {
|
|
|
49
49
|
* Retrieves sessions.
|
|
50
50
|
*/
|
|
51
51
|
async get({ agentId, sessionId, abortSignal }) {
|
|
52
|
-
return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}`, { signal: abortSignal }, sessionResponseSchema);
|
|
52
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/sessions/${sessionId}`, { signal: abortSignal }, sessionResponseSchema);
|
|
53
53
|
},
|
|
54
54
|
/**
|
|
55
55
|
* Lists one page of sessions.
|
|
56
56
|
*/
|
|
57
57
|
async list({ agentId, ...options }) {
|
|
58
|
-
return await requestJson(config, `/v1/agents/${agentId}/sessions`, {
|
|
58
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/sessions`, {
|
|
59
59
|
signal: options.abortSignal,
|
|
60
60
|
query: {
|
|
61
61
|
cursor: options.cursor,
|
|
62
62
|
limit: options.limit,
|
|
63
|
-
|
|
64
|
-
...(options.userId === undefined ? {} : { userId: options.userId }),
|
|
63
|
+
userId: options.userId,
|
|
65
64
|
},
|
|
66
65
|
}, sessionsListResponseSchema);
|
|
67
66
|
},
|
|
@@ -74,11 +73,8 @@ export function createSessionsResource(config) {
|
|
|
74
73
|
query: {
|
|
75
74
|
cursor: options.cursor,
|
|
76
75
|
limit: options.limit,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
...(options.byAgent === undefined
|
|
80
|
-
? {}
|
|
81
|
-
: { byAgent: options.byAgent }),
|
|
76
|
+
userId: options.userId,
|
|
77
|
+
byAgent: options.byAgent,
|
|
82
78
|
},
|
|
83
79
|
}, latestSessionsListResponseSchema);
|
|
84
80
|
},
|
|
@@ -86,7 +82,7 @@ export function createSessionsResource(config) {
|
|
|
86
82
|
* Lists one page of Session messages.
|
|
87
83
|
*/
|
|
88
84
|
async messages({ agentId, sessionId, ...options }) {
|
|
89
|
-
return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}/messages`, {
|
|
85
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/sessions/${sessionId}/messages`, {
|
|
90
86
|
signal: options.abortSignal,
|
|
91
87
|
query: {
|
|
92
88
|
cursor: options.cursor,
|
|
@@ -99,13 +95,13 @@ export function createSessionsResource(config) {
|
|
|
99
95
|
* Retrieves the pending Tool approval round.
|
|
100
96
|
*/
|
|
101
97
|
async toolApprovals({ agentId, sessionId, abortSignal }) {
|
|
102
|
-
return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}/tool-approvals`, { signal: abortSignal }, toolApprovalsResponseSchema);
|
|
98
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/sessions/${sessionId}/tool-approvals`, { signal: abortSignal }, toolApprovalsResponseSchema);
|
|
103
99
|
},
|
|
104
100
|
/**
|
|
105
101
|
* Deletes sessions.
|
|
106
102
|
*/
|
|
107
103
|
async delete({ agentId, sessionId, deleteArtifacts, abortSignal }) {
|
|
108
|
-
await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}`, { method: "DELETE", query: { deleteArtifacts }, signal: abortSignal });
|
|
104
|
+
await requestJson(config, apiPath `/v1/agents/${agentId}/sessions/${sessionId}`, { method: "DELETE", query: { deleteArtifacts }, signal: abortSignal });
|
|
109
105
|
},
|
|
110
106
|
};
|
|
111
107
|
}
|
package/dist/resources/skills.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "../contracts/entities/skills.js";
|
|
2
|
-
import { isRequestAborted, requestAbortedError, requestJson, requestStream, } from "../http.js";
|
|
2
|
+
import { apiPath, isRequestAborted, requestAbortedError, requestJson, requestStream, } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* Builds a Skill file URL with encoded Agent, Skill, and file path values.
|
|
5
5
|
*/
|
|
6
6
|
function fileUrl(agentId, input) {
|
|
7
|
-
return `/v1/agents/${
|
|
7
|
+
return apiPath `/v1/agents/${agentId}/skills/${input.skillId}/files?path=${input.path}`;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Builds the Agent Skills operations using the shared HTTP configuration.
|
|
@@ -17,19 +17,19 @@ export function createAgentSkillsResource(config, agentId) {
|
|
|
17
17
|
* Copies skills.
|
|
18
18
|
*/
|
|
19
19
|
async copy({ skillId, to, abortSignal }) {
|
|
20
|
-
return await requestJson(config, `/v1/agents/${
|
|
20
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/skills/${skillId}/copies`, { json: to, method: "POST", signal: abortSignal }, skillCopyResultsSchema);
|
|
21
21
|
},
|
|
22
22
|
/**
|
|
23
23
|
* Creates skills.
|
|
24
24
|
*/
|
|
25
25
|
async create({ abortSignal, ...body }) {
|
|
26
|
-
return await requestJson(config, `/v1/agents/${
|
|
26
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/skills`, { json: body, method: "POST", signal: abortSignal }, skillDetailSchema);
|
|
27
27
|
},
|
|
28
28
|
/**
|
|
29
29
|
* Deletes skills.
|
|
30
30
|
*/
|
|
31
31
|
async delete({ skillId, abortSignal }) {
|
|
32
|
-
await requestJson(config, `/v1/agents/${
|
|
32
|
+
await requestJson(config, apiPath `/v1/agents/${agentId}/skills/${skillId}`, { method: "DELETE", signal: abortSignal });
|
|
33
33
|
},
|
|
34
34
|
/**
|
|
35
35
|
* Deletes a Skill file.
|
|
@@ -44,7 +44,7 @@ export function createAgentSkillsResource(config, agentId) {
|
|
|
44
44
|
* Retrieves skills.
|
|
45
45
|
*/
|
|
46
46
|
async get({ skillId, abortSignal }) {
|
|
47
|
-
return await requestJson(config, `/v1/agents/${
|
|
47
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/skills/${skillId}`, { signal: abortSignal }, skillDetailSchema);
|
|
48
48
|
},
|
|
49
49
|
/**
|
|
50
50
|
* Reads Skill file bytes.
|
|
@@ -67,7 +67,7 @@ export function createAgentSkillsResource(config, agentId) {
|
|
|
67
67
|
* Lists one page of skills.
|
|
68
68
|
*/
|
|
69
69
|
async list({ cursor, limit, abortSignal } = {}) {
|
|
70
|
-
return await requestJson(config, `/v1/agents/${
|
|
70
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/skills`, { signal: abortSignal, query: { cursor, limit } }, skillsListResponseSchema);
|
|
71
71
|
},
|
|
72
72
|
/**
|
|
73
73
|
* Replaces a Skill file with the supplied content.
|
|
@@ -75,6 +75,7 @@ export function createAgentSkillsResource(config, agentId) {
|
|
|
75
75
|
async putFile({ content, abortSignal, ...input }) {
|
|
76
76
|
return await requestJson(config, fileUrl(agentId, input), {
|
|
77
77
|
body: content,
|
|
78
|
+
headers: { "content-type": "application/octet-stream" },
|
|
78
79
|
method: "PUT",
|
|
79
80
|
signal: abortSignal,
|
|
80
81
|
}, skillDetailSchema);
|
|
@@ -89,7 +90,7 @@ export function createAgentSkillsResource(config, agentId) {
|
|
|
89
90
|
? source.file
|
|
90
91
|
: new Blob([source.file]);
|
|
91
92
|
form.set("file", file, `skill.${source.type}`);
|
|
92
|
-
return await requestJson(config, `/v1/agents/${
|
|
93
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/skills/upload`, { body: form, method: "POST", signal: abortSignal }, skillDetailSchema);
|
|
93
94
|
},
|
|
94
95
|
};
|
|
95
96
|
}
|
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,8 +3,8 @@ 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";
|
|
7
|
-
import type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResponse,
|
|
6
|
+
import type { ChatConnection, ChatConnectionsResponse, ChatDeliveriesResponse, ChatDeliveryList, ChatDeliveryListStatus, ChatDeliveryResult, CreateChatConnectionBody, RepairChatDeliveryBody, RotateChatConnectionBody, UpdateChatConnectionBody } from "./contracts/entities/chat-connections.ts";
|
|
7
|
+
import type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResponse, 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";
|
|
10
10
|
import type { CreatePromptBody, PromptResponse, PromptsResponse, UpdatePromptBody } from "./contracts/entities/prompts.ts";
|
|
@@ -656,15 +656,6 @@ export interface ProvidersResource {
|
|
|
656
656
|
} & ResourceRequestOptions): Promise<ProviderResponse>;
|
|
657
657
|
}
|
|
658
658
|
export interface McpConnectionsResource {
|
|
659
|
-
/**
|
|
660
|
-
* Starts OAuth authorization for the MCP Connection.
|
|
661
|
-
* @param input - `mcpConnectionId`; optional abortSignal.
|
|
662
|
-
* @returns The mcp connection oauth connect response.
|
|
663
|
-
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
664
|
-
*/
|
|
665
|
-
connect(input: {
|
|
666
|
-
mcpConnectionId: string;
|
|
667
|
-
} & ResourceRequestOptions): Promise<McpConnectionOauthConnectResponse>;
|
|
668
659
|
/**
|
|
669
660
|
* Creates the MCP Connection.
|
|
670
661
|
* @param input - creation fields; optional abortSignal.
|
|
@@ -1291,6 +1282,35 @@ export interface ChatConnectionsResource {
|
|
|
1291
1282
|
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
1292
1283
|
*/
|
|
1293
1284
|
list(input?: ResourceRequestOptions): Promise<ChatConnectionsResponse>;
|
|
1285
|
+
/**
|
|
1286
|
+
* Lists one page of the replies and approval cards the Chat Connection has
|
|
1287
|
+
* sent or tried to send, newest first, in every status. Pass `nextCursor`
|
|
1288
|
+
* as `cursor` to fetch older records.
|
|
1289
|
+
* @param input - `chatConnectionId`; optional `cursor`, `limit` (1 to 100, default 100), and abortSignal.
|
|
1290
|
+
* @returns The page of chat deliveries.
|
|
1291
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
1292
|
+
*/
|
|
1293
|
+
listDeliveries(input: {
|
|
1294
|
+
chatConnectionId: string;
|
|
1295
|
+
cursor?: string;
|
|
1296
|
+
limit?: number;
|
|
1297
|
+
} & ResourceRequestOptions): Promise<ChatDeliveryList>;
|
|
1298
|
+
/**
|
|
1299
|
+
* Sends a stuck reply or approval card again, without running a turn or
|
|
1300
|
+
* tool. Use it when the previous send stopped before its outcome was known.
|
|
1301
|
+
* Pass the delivery's current `attempt` as `expectedAttempt`; the repair is
|
|
1302
|
+
* refused if it has changed. `previousSenderStopped` and
|
|
1303
|
+
* `acceptDuplicateRisk` must be `true`: the message can appear twice. The
|
|
1304
|
+
* connection must be enabled. Check `status` in the result, because a
|
|
1305
|
+
* successful request does not by itself mean the message was delivered.
|
|
1306
|
+
* @param input - `chatConnectionId`, `deliveryId`, the repair confirmations, and optional abortSignal.
|
|
1307
|
+
* @returns The delivery outcome.
|
|
1308
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
1309
|
+
*/
|
|
1310
|
+
repairDelivery(input: RepairChatDeliveryBody & {
|
|
1311
|
+
chatConnectionId: string;
|
|
1312
|
+
deliveryId: string;
|
|
1313
|
+
} & ResourceRequestOptions): Promise<ChatDeliveryResult>;
|
|
1294
1314
|
/**
|
|
1295
1315
|
* Replaces the Chat Connection credentials.
|
|
1296
1316
|
* @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.33.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"
|