@blazingagents/sdk 0.19.0 → 0.21.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 +17 -1
- package/dist/approvals.d.ts +4 -12
- package/dist/approvals.js +12 -13
- package/dist/chat-transport.d.ts +18 -1
- package/dist/chat-transport.js +16 -0
- package/dist/client.d.ts +28 -5
- package/dist/client.js +39 -7
- package/dist/contracts/api.d.ts +40 -6
- package/dist/contracts/api.js +30 -2
- package/dist/contracts/entities/agent-tools.d.ts +5 -2
- package/dist/contracts/entities/agent-tools.js +5 -2
- package/dist/contracts/entities/agents.d.ts +4 -0
- package/dist/contracts/entities/agents.js +9 -0
- package/dist/contracts/entities/chat.d.ts +11 -10
- package/dist/contracts/entities/chat.js +11 -7
- package/dist/contracts/entities/mcp-connections.d.ts +3 -1
- package/dist/contracts/entities/mcp-connections.js +3 -1
- package/dist/contracts/entities/prompts.d.ts +13 -0
- package/dist/contracts/entities/prompts.js +13 -0
- package/dist/contracts/entities/session-inputs.d.ts +29 -87
- package/dist/contracts/entities/session-inputs.js +21 -19
- package/dist/contracts/entities/sessions.d.ts +27 -17
- package/dist/contracts/entities/sessions.js +23 -8
- package/dist/contracts/entities/skills.d.ts +3 -0
- package/dist/contracts/entities/skills.js +3 -0
- package/dist/contracts/entities/tasks.d.ts +1 -0
- package/dist/contracts/entities/usage.d.ts +4 -1
- package/dist/contracts/entities/usage.js +7 -1
- package/dist/contracts/entities/workspaces.d.ts +17 -6
- package/dist/contracts/entities/workspaces.js +3 -7
- package/dist/contracts/ids.d.ts +31 -0
- package/dist/contracts/ids.js +34 -0
- package/dist/contracts/index.d.ts +7 -6
- package/dist/contracts/index.js +4 -4
- package/dist/contracts/utils.d.ts +10 -0
- package/dist/contracts/utils.js +10 -0
- package/dist/direct-chat-transport.d.ts +30 -3
- package/dist/direct-chat-transport.js +40 -35
- package/dist/errors.d.ts +9 -0
- package/dist/errors.js +9 -0
- package/dist/functions.d.ts +35 -2
- package/dist/functions.js +60 -4
- package/dist/generation.d.ts +34 -2
- package/dist/generation.js +97 -19
- package/dist/http.d.ts +26 -0
- package/dist/http.js +43 -0
- package/dist/index.d.ts +4 -4
- package/dist/relay.d.ts +26 -3
- package/dist/relay.js +25 -10
- package/dist/resources/agents.d.ts +5 -0
- package/dist/resources/agents.js +38 -0
- package/dist/resources/artifacts.d.ts +2 -0
- package/dist/resources/artifacts.js +14 -0
- package/dist/resources/chat-connections.d.ts +5 -0
- package/dist/resources/chat-connections.js +32 -0
- package/dist/resources/chat-deliveries.d.ts +2 -0
- package/dist/resources/chat-deliveries.js +5 -0
- package/dist/resources/mcp-connections.d.ts +5 -0
- package/dist/resources/mcp-connections.js +26 -0
- package/dist/resources/memories.d.ts +2 -0
- package/dist/resources/memories.js +17 -0
- package/dist/resources/merchant-bindings.d.ts +2 -0
- package/dist/resources/merchant-bindings.js +11 -0
- package/dist/resources/merchant-connection.d.ts +2 -0
- package/dist/resources/merchant-connection.js +14 -0
- package/dist/resources/merchant-usage-events.d.ts +2 -0
- package/dist/resources/merchant-usage-events.js +20 -0
- package/dist/resources/prompts.d.ts +5 -0
- package/dist/resources/prompts.js +20 -0
- package/dist/resources/providers.d.ts +2 -0
- package/dist/resources/providers.js +23 -0
- package/dist/resources/sessions.d.ts +2 -0
- package/dist/resources/sessions.js +42 -39
- package/dist/resources/skills.d.ts +5 -0
- package/dist/resources/skills.js +35 -0
- package/dist/resources/tasks.d.ts +2 -0
- package/dist/resources/tasks.js +32 -0
- package/dist/resources/tenant.d.ts +2 -0
- package/dist/resources/tenant.js +8 -0
- package/dist/resources/usage.d.ts +2 -0
- package/dist/resources/usage.js +14 -0
- package/dist/resources/workspaces.d.ts +5 -0
- package/dist/resources/workspaces.js +20 -0
- package/dist/types.d.ts +691 -48
- package/package.json +1 -1
|
@@ -1,43 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { latestSessionsListResponseSchema, sessionMessagesResponseSchema, sessionResponseSchema, sessionsListResponseSchema,
|
|
1
|
+
import { sessionInputResponseSchema, sessionInputsResponseSchema, stopSessionResponseSchema, } from "../contracts/entities/session-inputs.js";
|
|
2
|
+
import { latestSessionsListResponseSchema, sessionMessagesResponseSchema, sessionResponseSchema, sessionsListResponseSchema, toolApprovalsResponseSchema, } from "../contracts/entities/sessions.js";
|
|
3
3
|
import { agentIdSchema, sessionIdSchema, turnIdSchema, } from "../contracts/ids.js";
|
|
4
|
-
import {
|
|
5
|
-
import { buildTerminalStreamResult, withFilteredBody } from "../generation.js";
|
|
6
|
-
import { requestJson, requestStream } from "../http.js";
|
|
4
|
+
import { requestJson } from "../http.js";
|
|
7
5
|
/**
|
|
8
6
|
* `client.sessions` reads, paginates, and deletes Sessions under
|
|
9
7
|
* `/v1/agents/:agentId/sessions`. Pagination is manual: the SDK returns
|
|
10
8
|
* the page as-is (`{ data, nextCursor }` verbatim); the caller passes
|
|
11
9
|
* `nextCursor` back as `cursor` on the next call.
|
|
10
|
+
* @param config - Shared authentication and transport configuration.
|
|
11
|
+
* @returns The configured resource client.
|
|
12
12
|
*/
|
|
13
13
|
export function createSessionsResource(config) {
|
|
14
14
|
return {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
json: functions === undefined
|
|
19
|
-
? {}
|
|
20
|
-
: { functions: toChatFunctionDefinitions(functions) },
|
|
21
|
-
signal: abortSignal,
|
|
22
|
-
});
|
|
23
|
-
return buildTerminalStreamResult(response, "input Turn", (body) => functions
|
|
24
|
-
? dispatchChatFunctions(config, { agentId, sessionId, functions, abortSignal }, body)
|
|
25
|
-
: stripFunctionEvents(body));
|
|
26
|
-
},
|
|
15
|
+
/**
|
|
16
|
+
* Submits a Session input. Reuse the request ID and payload after an uncertain acknowledgement.
|
|
17
|
+
*/
|
|
27
18
|
async submitInput({ agentId, sessionId, abortSignal, ...body }) {
|
|
28
19
|
return await requestJson(config, `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/inputs`, { method: "POST", json: body, signal: abortSignal }, sessionInputResponseSchema);
|
|
29
20
|
},
|
|
21
|
+
/**
|
|
22
|
+
* Lists input receipts. Poll the first page to observe state changes.
|
|
23
|
+
*/
|
|
30
24
|
async inputs({ agentId, sessionId, abortSignal, ...query }) {
|
|
31
25
|
return await requestJson(config, `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/inputs`, { query, signal: abortSignal }, sessionInputsResponseSchema);
|
|
32
26
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
async deleteInput({ agentId, sessionId, requestId, abortSignal }) {
|
|
38
|
-
const inputId = sessionInputRequestIdSchema.parse(requestId);
|
|
39
|
-
return await requestJson(config, `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/inputs/${encodeURIComponent(inputId)}`, { method: "DELETE", signal: abortSignal }, sessionInputResponseSchema);
|
|
40
|
-
},
|
|
27
|
+
/**
|
|
28
|
+
* Records cancellation for the named Turn without waiting for settlement.
|
|
29
|
+
*/
|
|
41
30
|
async stop({ agentId, sessionId, turnId, abortSignal }) {
|
|
42
31
|
return await requestJson(config, `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/stop`, {
|
|
43
32
|
method: "POST",
|
|
@@ -45,19 +34,26 @@ export function createSessionsResource(config) {
|
|
|
45
34
|
signal: abortSignal,
|
|
46
35
|
}, stopSessionResponseSchema);
|
|
47
36
|
},
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Forks a Session at a message. Reuse the idempotency key after an uncertain acknowledgement.
|
|
39
|
+
*/
|
|
40
|
+
async fork({ agentId, sessionId, messageId, idempotencyKey, abortSignal }) {
|
|
41
|
+
return await requestJson(config, `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/fork`, {
|
|
42
|
+
method: "POST",
|
|
43
|
+
json: { messageId },
|
|
44
|
+
headers: { "Idempotency-Key": idempotencyKey },
|
|
45
|
+
signal: abortSignal,
|
|
46
|
+
}, sessionResponseSchema);
|
|
50
47
|
},
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves sessions.
|
|
50
|
+
*/
|
|
51
51
|
async get({ agentId, sessionId, abortSignal }) {
|
|
52
52
|
return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}`, { signal: abortSignal }, sessionResponseSchema);
|
|
53
53
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
method: "POST",
|
|
58
|
-
signal: abortSignal,
|
|
59
|
-
}, toolApprovalDecisionResponseSchema);
|
|
60
|
-
},
|
|
54
|
+
/**
|
|
55
|
+
* Lists one page of sessions.
|
|
56
|
+
*/
|
|
61
57
|
async list({ agentId, ...options }) {
|
|
62
58
|
return await requestJson(config, `/v1/agents/${agentId}/sessions`, {
|
|
63
59
|
signal: options.abortSignal,
|
|
@@ -69,6 +65,9 @@ export function createSessionsResource(config) {
|
|
|
69
65
|
},
|
|
70
66
|
}, sessionsListResponseSchema);
|
|
71
67
|
},
|
|
68
|
+
/**
|
|
69
|
+
* Lists recently updated Sessions, optionally limited to one per Agent.
|
|
70
|
+
*/
|
|
72
71
|
async listLatest(options = {}) {
|
|
73
72
|
return await requestJson(config, "/v1/sessions/latest", {
|
|
74
73
|
signal: options.abortSignal,
|
|
@@ -83,6 +82,9 @@ export function createSessionsResource(config) {
|
|
|
83
82
|
},
|
|
84
83
|
}, latestSessionsListResponseSchema);
|
|
85
84
|
},
|
|
85
|
+
/**
|
|
86
|
+
* Lists one page of Session messages.
|
|
87
|
+
*/
|
|
86
88
|
async messages({ agentId, sessionId, ...options }) {
|
|
87
89
|
return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}/messages`, {
|
|
88
90
|
signal: options.abortSignal,
|
|
@@ -93,14 +95,15 @@ export function createSessionsResource(config) {
|
|
|
93
95
|
},
|
|
94
96
|
}, sessionMessagesResponseSchema);
|
|
95
97
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return buildTerminalStreamResult(withFilteredBody(response, stripFunctionEvents), "continuation");
|
|
100
|
-
},
|
|
98
|
+
/**
|
|
99
|
+
* Retrieves the pending Tool approval round.
|
|
100
|
+
*/
|
|
101
101
|
async toolApprovals({ agentId, sessionId, abortSignal }) {
|
|
102
102
|
return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}/tool-approvals`, { signal: abortSignal }, toolApprovalsResponseSchema);
|
|
103
103
|
},
|
|
104
|
+
/**
|
|
105
|
+
* Deletes sessions.
|
|
106
|
+
*/
|
|
104
107
|
async delete({ agentId, sessionId, deleteArtifacts, abortSignal }) {
|
|
105
108
|
await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}`, { method: "DELETE", query: { deleteArtifacts }, signal: abortSignal });
|
|
106
109
|
},
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { AgentSkillsResource, HttpConfig } from "../types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Builds the Agent Skills operations using the shared HTTP configuration.
|
|
4
|
+
* @param config - Shared authentication and transport configuration.
|
|
5
|
+
* @returns The configured resource client.
|
|
6
|
+
*/
|
|
2
7
|
export declare function createAgentSkillsResource(config: HttpConfig, agentId: string): AgentSkillsResource;
|
package/dist/resources/skills.js
CHANGED
|
@@ -1,28 +1,54 @@
|
|
|
1
1
|
import { skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "../contracts/entities/skills.js";
|
|
2
2
|
import { isRequestAborted, requestAbortedError, requestJson, requestStream, } from "../http.js";
|
|
3
|
+
/**
|
|
4
|
+
* Builds a Skill file URL with encoded Agent, Skill, and file path values.
|
|
5
|
+
*/
|
|
3
6
|
function fileUrl(agentId, input) {
|
|
4
7
|
return `/v1/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(input.skillId)}/files?path=${encodeURIComponent(input.path)}`;
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Builds the Agent Skills operations using the shared HTTP configuration.
|
|
11
|
+
* @param config - Shared authentication and transport configuration.
|
|
12
|
+
* @returns The configured resource client.
|
|
13
|
+
*/
|
|
6
14
|
export function createAgentSkillsResource(config, agentId) {
|
|
7
15
|
return {
|
|
16
|
+
/**
|
|
17
|
+
* Copies skills.
|
|
18
|
+
*/
|
|
8
19
|
async copy({ skillId, to, abortSignal }) {
|
|
9
20
|
return await requestJson(config, `/v1/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(skillId)}/copies`, { json: to, method: "POST", signal: abortSignal }, skillCopyResultsSchema);
|
|
10
21
|
},
|
|
22
|
+
/**
|
|
23
|
+
* Creates skills.
|
|
24
|
+
*/
|
|
11
25
|
async create({ abortSignal, ...body }) {
|
|
12
26
|
return await requestJson(config, `/v1/agents/${encodeURIComponent(agentId)}/skills`, { json: body, method: "POST", signal: abortSignal }, skillDetailSchema);
|
|
13
27
|
},
|
|
28
|
+
/**
|
|
29
|
+
* Deletes skills.
|
|
30
|
+
*/
|
|
14
31
|
async delete({ skillId, abortSignal }) {
|
|
15
32
|
await requestJson(config, `/v1/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(skillId)}`, { method: "DELETE", signal: abortSignal });
|
|
16
33
|
},
|
|
34
|
+
/**
|
|
35
|
+
* Deletes a Skill file.
|
|
36
|
+
*/
|
|
17
37
|
async deleteFile({ abortSignal, ...input }) {
|
|
18
38
|
return await requestJson(config, fileUrl(agentId, input), {
|
|
19
39
|
method: "DELETE",
|
|
20
40
|
signal: abortSignal,
|
|
21
41
|
}, skillDetailSchema);
|
|
22
42
|
},
|
|
43
|
+
/**
|
|
44
|
+
* Retrieves skills.
|
|
45
|
+
*/
|
|
23
46
|
async get({ skillId, abortSignal }) {
|
|
24
47
|
return await requestJson(config, `/v1/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(skillId)}`, { signal: abortSignal }, skillDetailSchema);
|
|
25
48
|
},
|
|
49
|
+
/**
|
|
50
|
+
* Reads Skill file bytes.
|
|
51
|
+
*/
|
|
26
52
|
async getFile({ abortSignal, ...input }) {
|
|
27
53
|
const response = await requestStream(config, fileUrl(agentId, input), {
|
|
28
54
|
signal: abortSignal,
|
|
@@ -37,9 +63,15 @@ export function createAgentSkillsResource(config, agentId) {
|
|
|
37
63
|
throw cause;
|
|
38
64
|
}
|
|
39
65
|
},
|
|
66
|
+
/**
|
|
67
|
+
* Lists one page of skills.
|
|
68
|
+
*/
|
|
40
69
|
async list({ cursor, limit, abortSignal } = {}) {
|
|
41
70
|
return await requestJson(config, `/v1/agents/${encodeURIComponent(agentId)}/skills`, { signal: abortSignal, query: { cursor, limit } }, skillsListResponseSchema);
|
|
42
71
|
},
|
|
72
|
+
/**
|
|
73
|
+
* Replaces a Skill file with the supplied content.
|
|
74
|
+
*/
|
|
43
75
|
async putFile({ content, abortSignal, ...input }) {
|
|
44
76
|
return await requestJson(config, fileUrl(agentId, input), {
|
|
45
77
|
body: content,
|
|
@@ -47,6 +79,9 @@ export function createAgentSkillsResource(config, agentId) {
|
|
|
47
79
|
signal: abortSignal,
|
|
48
80
|
}, skillDetailSchema);
|
|
49
81
|
},
|
|
82
|
+
/**
|
|
83
|
+
* Uploads a Skill archive as multipart form data.
|
|
84
|
+
*/
|
|
50
85
|
async upload({ source, abortSignal }) {
|
|
51
86
|
const form = new FormData();
|
|
52
87
|
form.set("type", source.type);
|
|
@@ -3,5 +3,7 @@ import type { HttpConfig, TasksResource } from "../types.ts";
|
|
|
3
3
|
* `client.tasks` — CRUD + runs over `/v1/tasks`. Runs are listed/get/
|
|
4
4
|
* canceled/transcripted via `/v1/tasks/:taskId/runs/...`. All lists are
|
|
5
5
|
* keyset-cursored.
|
|
6
|
+
* @param config - Shared authentication and transport configuration.
|
|
7
|
+
* @returns The configured resource client.
|
|
6
8
|
*/
|
|
7
9
|
export declare function createTasksResource(config: HttpConfig): TasksResource;
|
package/dist/resources/tasks.js
CHANGED
|
@@ -4,9 +4,14 @@ import { requestJson } from "../http.js";
|
|
|
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
|
|
6
6
|
* keyset-cursored.
|
|
7
|
+
* @param config - Shared authentication and transport configuration.
|
|
8
|
+
* @returns The configured resource client.
|
|
7
9
|
*/
|
|
8
10
|
export function createTasksResource(config) {
|
|
9
11
|
return {
|
|
12
|
+
/**
|
|
13
|
+
* Creates tasks.
|
|
14
|
+
*/
|
|
10
15
|
async create({ abortSignal, ...body }) {
|
|
11
16
|
return await requestJson(config, "/v1/tasks", {
|
|
12
17
|
json: body,
|
|
@@ -14,6 +19,9 @@ export function createTasksResource(config) {
|
|
|
14
19
|
method: "POST",
|
|
15
20
|
}, createTaskResponseSchema);
|
|
16
21
|
},
|
|
22
|
+
/**
|
|
23
|
+
* Lists one page of tasks.
|
|
24
|
+
*/
|
|
17
25
|
async list(options = {}) {
|
|
18
26
|
return await requestJson(config, "/v1/tasks", {
|
|
19
27
|
signal: options.abortSignal,
|
|
@@ -26,9 +34,15 @@ export function createTasksResource(config) {
|
|
|
26
34
|
},
|
|
27
35
|
}, tasksListResponseSchema);
|
|
28
36
|
},
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves tasks.
|
|
39
|
+
*/
|
|
29
40
|
async get({ taskId, abortSignal }) {
|
|
30
41
|
return await requestJson(config, `/v1/tasks/${taskId}`, { signal: abortSignal }, taskResponseSchema);
|
|
31
42
|
},
|
|
43
|
+
/**
|
|
44
|
+
* Updates tasks.
|
|
45
|
+
*/
|
|
32
46
|
async update({ taskId, abortSignal, ...body }) {
|
|
33
47
|
return await requestJson(config, `/v1/tasks/${taskId}`, {
|
|
34
48
|
json: body,
|
|
@@ -36,24 +50,39 @@ export function createTasksResource(config) {
|
|
|
36
50
|
method: "PATCH",
|
|
37
51
|
}, taskResponseSchema);
|
|
38
52
|
},
|
|
53
|
+
/**
|
|
54
|
+
* Deletes tasks.
|
|
55
|
+
*/
|
|
39
56
|
async delete({ taskId, abortSignal }) {
|
|
40
57
|
await requestJson(config, `/v1/tasks/${taskId}`, {
|
|
41
58
|
method: "DELETE",
|
|
42
59
|
signal: abortSignal,
|
|
43
60
|
});
|
|
44
61
|
},
|
|
62
|
+
/**
|
|
63
|
+
* Creates a Task run.
|
|
64
|
+
*/
|
|
45
65
|
async createRun({ taskId, abortSignal, ...body }) {
|
|
46
66
|
return await requestJson(config, `/v1/tasks/${taskId}/runs`, { json: body, method: "POST", signal: abortSignal }, createTaskRunResponseSchema);
|
|
47
67
|
},
|
|
68
|
+
/**
|
|
69
|
+
* Lists one page of Task runs.
|
|
70
|
+
*/
|
|
48
71
|
async listRuns({ taskId, ...options }) {
|
|
49
72
|
return await requestJson(config, `/v1/tasks/${taskId}/runs`, {
|
|
50
73
|
signal: options.abortSignal,
|
|
51
74
|
query: { cursor: options.cursor, limit: options.limit },
|
|
52
75
|
}, taskRunsListResponseSchema);
|
|
53
76
|
},
|
|
77
|
+
/**
|
|
78
|
+
* Retrieves a Task run.
|
|
79
|
+
*/
|
|
54
80
|
async getRun({ taskId, runId, abortSignal }) {
|
|
55
81
|
return await requestJson(config, `/v1/tasks/${taskId}/runs/${runId}`, { signal: abortSignal }, taskRunResponseSchema);
|
|
56
82
|
},
|
|
83
|
+
/**
|
|
84
|
+
* Lists one page of Task run messages.
|
|
85
|
+
*/
|
|
57
86
|
async runMessages({ taskId, runId, ...options }) {
|
|
58
87
|
return await requestJson(config, `/v1/tasks/${taskId}/runs/${runId}/messages`, {
|
|
59
88
|
signal: options.abortSignal,
|
|
@@ -64,6 +93,9 @@ export function createTasksResource(config) {
|
|
|
64
93
|
},
|
|
65
94
|
}, taskRunMessagesResponseSchema);
|
|
66
95
|
},
|
|
96
|
+
/**
|
|
97
|
+
* Requests cancellation of a Task run.
|
|
98
|
+
*/
|
|
67
99
|
async cancelRun({ taskId, runId, abortSignal }) {
|
|
68
100
|
await requestJson(config, `/v1/tasks/${taskId}/runs/${runId}/cancel`, { method: "POST", signal: abortSignal });
|
|
69
101
|
},
|
|
@@ -2,5 +2,7 @@ import type { HttpConfig, TenantResource } from "../types.ts";
|
|
|
2
2
|
/**
|
|
3
3
|
* `client.tenant` — get/patch over `/v1/tenant` (the tenant's self-set
|
|
4
4
|
* quota row). `quota: null` means unlimited (no row).
|
|
5
|
+
* @param config - Shared authentication and transport configuration.
|
|
6
|
+
* @returns The configured resource client.
|
|
5
7
|
*/
|
|
6
8
|
export declare function createTenantResource(config: HttpConfig): TenantResource;
|
package/dist/resources/tenant.js
CHANGED
|
@@ -3,12 +3,20 @@ import { requestJson } from "../http.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* `client.tenant` — get/patch over `/v1/tenant` (the tenant's self-set
|
|
5
5
|
* quota row). `quota: null` means unlimited (no row).
|
|
6
|
+
* @param config - Shared authentication and transport configuration.
|
|
7
|
+
* @returns The configured resource client.
|
|
6
8
|
*/
|
|
7
9
|
export function createTenantResource(config) {
|
|
8
10
|
return {
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves tenant.
|
|
13
|
+
*/
|
|
9
14
|
async get({ abortSignal } = {}) {
|
|
10
15
|
return await requestJson(config, "/v1/tenant", { signal: abortSignal }, tenantSettingsResponseSchema);
|
|
11
16
|
},
|
|
17
|
+
/**
|
|
18
|
+
* Updates tenant.
|
|
19
|
+
*/
|
|
12
20
|
async patch({ abortSignal, ...body }) {
|
|
13
21
|
return await requestJson(config, "/v1/tenant", {
|
|
14
22
|
json: body,
|
|
@@ -3,5 +3,7 @@ import type { HttpConfig, UsageResource } from "../types.ts";
|
|
|
3
3
|
* `client.usage` — get over `/v1/usage` (tenant-wide) and
|
|
4
4
|
* `/v1/agents/:agentId/usage` (per-agent). The query shape is the core
|
|
5
5
|
* `usageQuerySchema`; the SDK passes it through as query params.
|
|
6
|
+
* @param config - Shared authentication and transport configuration.
|
|
7
|
+
* @returns The configured resource client.
|
|
6
8
|
*/
|
|
7
9
|
export declare function createUsageResource(config: HttpConfig): UsageResource;
|
package/dist/resources/usage.js
CHANGED
|
@@ -4,9 +4,14 @@ import { requestJson } from "../http.js";
|
|
|
4
4
|
* `client.usage` — get over `/v1/usage` (tenant-wide) and
|
|
5
5
|
* `/v1/agents/:agentId/usage` (per-agent). The query shape is the core
|
|
6
6
|
* `usageQuerySchema`; the SDK passes it through as query params.
|
|
7
|
+
* @param config - Shared authentication and transport configuration.
|
|
8
|
+
* @returns The configured resource client.
|
|
7
9
|
*/
|
|
8
10
|
export function createUsageResource(config) {
|
|
9
11
|
return {
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves usage grouped by Session.
|
|
14
|
+
*/
|
|
10
15
|
async sessions({ abortSignal, ...input }) {
|
|
11
16
|
const body = sessionUsageQuerySchema.parse(input);
|
|
12
17
|
return await requestJson(config, "/v1/usage/sessions", {
|
|
@@ -15,15 +20,24 @@ export function createUsageResource(config) {
|
|
|
15
20
|
signal: abortSignal,
|
|
16
21
|
}, sessionUsageResponseSchema);
|
|
17
22
|
},
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves usage.
|
|
25
|
+
*/
|
|
18
26
|
async get({ abortSignal, ...query } = {}) {
|
|
19
27
|
return await requestJson(config, "/v1/usage", {
|
|
20
28
|
query,
|
|
21
29
|
signal: abortSignal,
|
|
22
30
|
}, usageResponseSchema);
|
|
23
31
|
},
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves usage for one Agent.
|
|
34
|
+
*/
|
|
24
35
|
async getForAgent({ agentId, abortSignal, ...query }) {
|
|
25
36
|
return await requestJson(config, `/v1/agents/${agentId}/usage`, { query, signal: abortSignal }, usageResponseSchema);
|
|
26
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves usage totals, daily usage, and bounded rankings.
|
|
40
|
+
*/
|
|
27
41
|
async overview({ abortSignal, ...query } = {}) {
|
|
28
42
|
return await requestJson(config, "/v1/usage/overview", { query, signal: abortSignal }, usageOverviewResponseSchemaForQuery(query));
|
|
29
43
|
},
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { HttpConfig, WorkspacesResource } from "../types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Builds the Workspaces operations using the shared HTTP configuration.
|
|
4
|
+
* @param config - Shared authentication and transport configuration.
|
|
5
|
+
* @returns The configured resource client.
|
|
6
|
+
*/
|
|
2
7
|
export declare function createWorkspacesResource(config: HttpConfig): WorkspacesResource;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { workspaceSchema, workspacesListResponseSchema, } from "../contracts/entities/workspaces.js";
|
|
2
2
|
import { requestJson, requestStream } from "../http.js";
|
|
3
|
+
/**
|
|
4
|
+
* Builds the Workspaces operations using the shared HTTP configuration.
|
|
5
|
+
* @param config - Shared authentication and transport configuration.
|
|
6
|
+
* @returns The configured resource client.
|
|
7
|
+
*/
|
|
3
8
|
export function createWorkspacesResource(config) {
|
|
4
9
|
return {
|
|
10
|
+
/**
|
|
11
|
+
* Creates workspaces.
|
|
12
|
+
*/
|
|
5
13
|
async create({ abortSignal, ...body } = {}) {
|
|
6
14
|
return await requestJson(config, "/v1/workspaces", {
|
|
7
15
|
json: body,
|
|
@@ -9,13 +17,22 @@ export function createWorkspacesResource(config) {
|
|
|
9
17
|
method: "POST",
|
|
10
18
|
}, workspaceSchema);
|
|
11
19
|
},
|
|
20
|
+
/**
|
|
21
|
+
* Deletes workspaces.
|
|
22
|
+
*/
|
|
12
23
|
async delete({ workspaceId, abortSignal }) {
|
|
13
24
|
const response = await requestStream(config, `/v1/workspaces/${encodeURIComponent(workspaceId)}`, { method: "DELETE", signal: abortSignal });
|
|
14
25
|
return response.status === 202 ? "pending" : "completed";
|
|
15
26
|
},
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves workspaces.
|
|
29
|
+
*/
|
|
16
30
|
async get({ workspaceId, abortSignal }) {
|
|
17
31
|
return await requestJson(config, `/v1/workspaces/${encodeURIComponent(workspaceId)}`, { signal: abortSignal }, workspaceSchema);
|
|
18
32
|
},
|
|
33
|
+
/**
|
|
34
|
+
* Lists one page of workspaces.
|
|
35
|
+
*/
|
|
19
36
|
async list({ abortSignal, ...options } = {}) {
|
|
20
37
|
return await requestJson(config, "/v1/workspaces", {
|
|
21
38
|
signal: abortSignal,
|
|
@@ -26,6 +43,9 @@ export function createWorkspacesResource(config) {
|
|
|
26
43
|
},
|
|
27
44
|
}, workspacesListResponseSchema);
|
|
28
45
|
},
|
|
46
|
+
/**
|
|
47
|
+
* Updates workspaces.
|
|
48
|
+
*/
|
|
29
49
|
async update({ workspaceId, abortSignal, ...body }) {
|
|
30
50
|
return await requestJson(config, `/v1/workspaces/${encodeURIComponent(workspaceId)}`, { json: body, signal: abortSignal, method: "PUT" }, workspaceSchema);
|
|
31
51
|
},
|