@blazingagents/sdk 0.20.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/dist/approvals.d.ts +4 -0
- package/dist/approvals.js +4 -0
- package/dist/chat-transport.d.ts +18 -1
- package/dist/chat-transport.js +16 -0
- package/dist/client.d.ts +24 -1
- package/dist/client.js +33 -1
- package/dist/contracts/api.d.ts +34 -0
- package/dist/contracts/api.js +28 -0
- 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 +3 -0
- package/dist/contracts/entities/chat.js +6 -0
- 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.js +3 -1
- package/dist/contracts/entities/sessions.d.ts +11 -0
- package/dist/contracts/entities/sessions.js +11 -1
- 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 +4 -3
- package/dist/contracts/index.js +2 -2
- package/dist/contracts/utils.d.ts +10 -0
- package/dist/contracts/utils.js +10 -0
- package/dist/direct-chat-transport.d.ts +27 -1
- package/dist/direct-chat-transport.js +26 -0
- 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 +32 -0
- package/dist/generation.js +83 -0
- package/dist/http.d.ts +26 -0
- package/dist/http.js +43 -0
- package/dist/index.d.ts +2 -2
- package/dist/relay.d.ts +23 -0
- package/dist/relay.js +16 -0
- 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 +40 -0
- 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 +679 -10
- package/package.json +1 -1
|
@@ -4,18 +4,32 @@ import { requestJson } from "../http.js";
|
|
|
4
4
|
* `client.merchantConnection` — get/create/update/retire over
|
|
5
5
|
* `/v1/merchant-connection`. One connection per tenant; `credential` is
|
|
6
6
|
* write-only and never returned.
|
|
7
|
+
* @param config - Shared authentication and transport configuration.
|
|
8
|
+
* @returns The configured resource client.
|
|
7
9
|
*/
|
|
8
10
|
export function createMerchantConnectionResource(config) {
|
|
9
11
|
return {
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves merchant connection.
|
|
14
|
+
*/
|
|
10
15
|
async get({ abortSignal } = {}) {
|
|
11
16
|
return await requestJson(config, "/v1/merchant-connection", { signal: abortSignal }, merchantConnectionResponseSchema);
|
|
12
17
|
},
|
|
18
|
+
/**
|
|
19
|
+
* Creates merchant connection.
|
|
20
|
+
*/
|
|
13
21
|
async create({ abortSignal, ...body }) {
|
|
14
22
|
return await requestJson(config, "/v1/merchant-connection", { json: body, method: "POST", signal: abortSignal }, merchantConnectionResponseSchema);
|
|
15
23
|
},
|
|
24
|
+
/**
|
|
25
|
+
* Updates merchant connection.
|
|
26
|
+
*/
|
|
16
27
|
async update({ abortSignal, ...body }) {
|
|
17
28
|
return await requestJson(config, "/v1/merchant-connection", { json: body, method: "PATCH", signal: abortSignal }, merchantConnectionResponseSchema);
|
|
18
29
|
},
|
|
30
|
+
/**
|
|
31
|
+
* Retires merchant connection.
|
|
32
|
+
*/
|
|
19
33
|
async retire({ abortSignal } = {}) {
|
|
20
34
|
await requestJson(config, "/v1/merchant-connection", {
|
|
21
35
|
method: "DELETE",
|
|
@@ -3,5 +3,7 @@ import type { HttpConfig, MerchantUsageEventsResource } from "../types.ts";
|
|
|
3
3
|
* `client.merchantUsageEvents` — the immutable usage-event ledger over
|
|
4
4
|
* `/v1/merchant-usage-events`, plus the delivery-health `summary` aggregate
|
|
5
5
|
* and the per-event operator actions `retry`/`release`/`discard`.
|
|
6
|
+
* @param config - Shared authentication and transport configuration.
|
|
7
|
+
* @returns The configured resource client.
|
|
6
8
|
*/
|
|
7
9
|
export declare function createMerchantUsageEventsResource(config: HttpConfig): MerchantUsageEventsResource;
|
|
@@ -4,24 +4,44 @@ import { requestJson } from "../http.js";
|
|
|
4
4
|
* `client.merchantUsageEvents` — the immutable usage-event ledger over
|
|
5
5
|
* `/v1/merchant-usage-events`, plus the delivery-health `summary` aggregate
|
|
6
6
|
* and the per-event operator actions `retry`/`release`/`discard`.
|
|
7
|
+
* @param config - Shared authentication and transport configuration.
|
|
8
|
+
* @returns The configured resource client.
|
|
7
9
|
*/
|
|
8
10
|
export function createMerchantUsageEventsResource(config) {
|
|
9
11
|
return {
|
|
12
|
+
/**
|
|
13
|
+
* Lists one page of merchant usage events.
|
|
14
|
+
*/
|
|
10
15
|
async list({ abortSignal, ...query } = {}) {
|
|
11
16
|
return await requestJson(config, "/v1/merchant-usage-events", { query, signal: abortSignal }, merchantUsageEventsResponseSchema);
|
|
12
17
|
},
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves merchant usage events.
|
|
20
|
+
*/
|
|
13
21
|
async get({ eventId, abortSignal }) {
|
|
14
22
|
return await requestJson(config, `/v1/merchant-usage-events/${encodeURIComponent(eventId)}`, { signal: abortSignal }, merchantUsageEventResponseSchema);
|
|
15
23
|
},
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves merchant usage delivery totals for the selected day range.
|
|
26
|
+
*/
|
|
16
27
|
async summary({ abortSignal, ...query } = {}) {
|
|
17
28
|
return await requestJson(config, "/v1/merchant-usage-events/summary", { query, signal: abortSignal }, merchantUsageSummaryResponseSchema);
|
|
18
29
|
},
|
|
30
|
+
/**
|
|
31
|
+
* Retries delivery of merchant usage events.
|
|
32
|
+
*/
|
|
19
33
|
async retry({ eventId, abortSignal }) {
|
|
20
34
|
return await requestJson(config, `/v1/merchant-usage-events/${encodeURIComponent(eventId)}/retry`, { method: "POST", signal: abortSignal }, merchantUsageEventResponseSchema);
|
|
21
35
|
},
|
|
36
|
+
/**
|
|
37
|
+
* Releases merchant usage events.
|
|
38
|
+
*/
|
|
22
39
|
async release({ eventId, abortSignal }) {
|
|
23
40
|
return await requestJson(config, `/v1/merchant-usage-events/${encodeURIComponent(eventId)}/release`, { method: "POST", signal: abortSignal }, merchantUsageEventResponseSchema);
|
|
24
41
|
},
|
|
42
|
+
/**
|
|
43
|
+
* Discards merchant usage events.
|
|
44
|
+
*/
|
|
25
45
|
async discard({ eventId, abortSignal }) {
|
|
26
46
|
return await requestJson(config, `/v1/merchant-usage-events/${encodeURIComponent(eventId)}/discard`, { method: "POST", signal: abortSignal }, merchantUsageEventResponseSchema);
|
|
27
47
|
},
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { HttpConfig, PromptsResource } from "../types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Builds the Prompts 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 createPromptsResource(config: HttpConfig): PromptsResource;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { promptResponseSchema, promptsResponseSchema, } from "../contracts/entities/prompts.js";
|
|
2
2
|
import { requestJson } from "../http.js";
|
|
3
|
+
/**
|
|
4
|
+
* Builds the Prompts 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 createPromptsResource(config) {
|
|
4
9
|
return {
|
|
10
|
+
/**
|
|
11
|
+
* Creates prompts.
|
|
12
|
+
*/
|
|
5
13
|
async create({ abortSignal, ...body }) {
|
|
6
14
|
return await requestJson(config, "/v1/prompts", {
|
|
7
15
|
json: body,
|
|
@@ -9,15 +17,24 @@ export function createPromptsResource(config) {
|
|
|
9
17
|
method: "POST",
|
|
10
18
|
}, promptResponseSchema);
|
|
11
19
|
},
|
|
20
|
+
/**
|
|
21
|
+
* Lists one page of prompts.
|
|
22
|
+
*/
|
|
12
23
|
async list({ userId, agentId, cursor, limit, abortSignal } = {}) {
|
|
13
24
|
return await requestJson(config, "/v1/prompts", {
|
|
14
25
|
signal: abortSignal,
|
|
15
26
|
query: { userId, agentId, cursor, limit },
|
|
16
27
|
}, promptsResponseSchema);
|
|
17
28
|
},
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves prompts.
|
|
31
|
+
*/
|
|
18
32
|
async get({ promptId, abortSignal }) {
|
|
19
33
|
return await requestJson(config, `/v1/prompts/${promptId}`, { signal: abortSignal }, promptResponseSchema);
|
|
20
34
|
},
|
|
35
|
+
/**
|
|
36
|
+
* Updates prompts.
|
|
37
|
+
*/
|
|
21
38
|
async update({ promptId, abortSignal, ...body }) {
|
|
22
39
|
return await requestJson(config, `/v1/prompts/${promptId}`, {
|
|
23
40
|
json: body,
|
|
@@ -25,6 +42,9 @@ export function createPromptsResource(config) {
|
|
|
25
42
|
method: "PATCH",
|
|
26
43
|
}, promptResponseSchema);
|
|
27
44
|
},
|
|
45
|
+
/**
|
|
46
|
+
* Deletes prompts.
|
|
47
|
+
*/
|
|
28
48
|
async delete({ promptId, abortSignal }) {
|
|
29
49
|
await requestJson(config, `/v1/prompts/${promptId}`, {
|
|
30
50
|
method: "DELETE",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { HttpConfig, ProvidersResource } from "../types.ts";
|
|
2
2
|
/**
|
|
3
3
|
* `client.providers` — CRUD and cost-free model discovery.
|
|
4
|
+
* @param config - Shared authentication and transport configuration.
|
|
5
|
+
* @returns The configured resource client.
|
|
4
6
|
*/
|
|
5
7
|
export declare function createProvidersResource(config: HttpConfig): ProvidersResource;
|
|
@@ -2,9 +2,14 @@ import { providerModelsResponseSchema, providerResponseSchema, providersResponse
|
|
|
2
2
|
import { requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.providers` — CRUD and cost-free model discovery.
|
|
5
|
+
* @param config - Shared authentication and transport configuration.
|
|
6
|
+
* @returns The configured resource client.
|
|
5
7
|
*/
|
|
6
8
|
export function createProvidersResource(config) {
|
|
7
9
|
return {
|
|
10
|
+
/**
|
|
11
|
+
* Creates providers.
|
|
12
|
+
*/
|
|
8
13
|
async create({ abortSignal, ...body }) {
|
|
9
14
|
return await requestJson(config, "/v1/providers", {
|
|
10
15
|
json: body,
|
|
@@ -12,18 +17,33 @@ export function createProvidersResource(config) {
|
|
|
12
17
|
method: "POST",
|
|
13
18
|
}, providerResponseSchema);
|
|
14
19
|
},
|
|
20
|
+
/**
|
|
21
|
+
* Lists one page of providers.
|
|
22
|
+
*/
|
|
15
23
|
async list({ abortSignal } = {}) {
|
|
16
24
|
return await requestJson(config, "/v1/providers", { signal: abortSignal }, providersResponseSchema);
|
|
17
25
|
},
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves providers.
|
|
28
|
+
*/
|
|
18
29
|
async get({ providerId, abortSignal }) {
|
|
19
30
|
return await requestJson(config, `/v1/providers/${providerId}`, { signal: abortSignal }, providerResponseSchema);
|
|
20
31
|
},
|
|
32
|
+
/**
|
|
33
|
+
* Lists models exposed by the Provider.
|
|
34
|
+
*/
|
|
21
35
|
async listModels({ providerId, abortSignal }) {
|
|
22
36
|
return await requestJson(config, `/v1/providers/${providerId}/models`, { signal: abortSignal }, providerModelsResponseSchema);
|
|
23
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves supported thinking levels for a Provider model.
|
|
40
|
+
*/
|
|
24
41
|
async getThinkingLevels({ providerId, model, abortSignal }) {
|
|
25
42
|
return await requestJson(config, `/v1/providers/${providerId}/thinking-levels`, { signal: abortSignal, query: { model } }, thinkingLevelsResponseSchema);
|
|
26
43
|
},
|
|
44
|
+
/**
|
|
45
|
+
* Updates providers.
|
|
46
|
+
*/
|
|
27
47
|
async update({ providerId, abortSignal, ...body }) {
|
|
28
48
|
return await requestJson(config, `/v1/providers/${providerId}`, {
|
|
29
49
|
json: body,
|
|
@@ -31,6 +51,9 @@ export function createProvidersResource(config) {
|
|
|
31
51
|
method: "PATCH",
|
|
32
52
|
}, providerResponseSchema);
|
|
33
53
|
},
|
|
54
|
+
/**
|
|
55
|
+
* Deletes providers.
|
|
56
|
+
*/
|
|
34
57
|
async delete({ providerId, abortSignal, ...options }) {
|
|
35
58
|
await requestJson(config, `/v1/providers/${providerId}`, {
|
|
36
59
|
method: "DELETE",
|
|
@@ -4,5 +4,7 @@ import type { HttpConfig, SessionsResource } from "../types.ts";
|
|
|
4
4
|
* `/v1/agents/:agentId/sessions`. Pagination is manual: the SDK returns
|
|
5
5
|
* the page as-is (`{ data, nextCursor }` verbatim); the caller passes
|
|
6
6
|
* `nextCursor` back as `cursor` on the next call.
|
|
7
|
+
* @param config - Shared authentication and transport configuration.
|
|
8
|
+
* @returns The configured resource client.
|
|
7
9
|
*/
|
|
8
10
|
export declare function createSessionsResource(config: HttpConfig): SessionsResource;
|
|
@@ -7,15 +7,26 @@ import { requestJson } from "../http.js";
|
|
|
7
7
|
* `/v1/agents/:agentId/sessions`. Pagination is manual: the SDK returns
|
|
8
8
|
* the page as-is (`{ data, nextCursor }` verbatim); the caller passes
|
|
9
9
|
* `nextCursor` back as `cursor` on the next call.
|
|
10
|
+
* @param config - Shared authentication and transport configuration.
|
|
11
|
+
* @returns The configured resource client.
|
|
10
12
|
*/
|
|
11
13
|
export function createSessionsResource(config) {
|
|
12
14
|
return {
|
|
15
|
+
/**
|
|
16
|
+
* Submits a Session input. Reuse the request ID and payload after an uncertain acknowledgement.
|
|
17
|
+
*/
|
|
13
18
|
async submitInput({ agentId, sessionId, abortSignal, ...body }) {
|
|
14
19
|
return await requestJson(config, `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/inputs`, { method: "POST", json: body, signal: abortSignal }, sessionInputResponseSchema);
|
|
15
20
|
},
|
|
21
|
+
/**
|
|
22
|
+
* Lists input receipts. Poll the first page to observe state changes.
|
|
23
|
+
*/
|
|
16
24
|
async inputs({ agentId, sessionId, abortSignal, ...query }) {
|
|
17
25
|
return await requestJson(config, `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/inputs`, { query, signal: abortSignal }, sessionInputsResponseSchema);
|
|
18
26
|
},
|
|
27
|
+
/**
|
|
28
|
+
* Records cancellation for the named Turn without waiting for settlement.
|
|
29
|
+
*/
|
|
19
30
|
async stop({ agentId, sessionId, turnId, abortSignal }) {
|
|
20
31
|
return await requestJson(config, `/v1/agents/${agentIdSchema.parse(agentId)}/sessions/${sessionIdSchema.parse(sessionId)}/stop`, {
|
|
21
32
|
method: "POST",
|
|
@@ -23,9 +34,26 @@ export function createSessionsResource(config) {
|
|
|
23
34
|
signal: abortSignal,
|
|
24
35
|
}, stopSessionResponseSchema);
|
|
25
36
|
},
|
|
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);
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves sessions.
|
|
50
|
+
*/
|
|
26
51
|
async get({ agentId, sessionId, abortSignal }) {
|
|
27
52
|
return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}`, { signal: abortSignal }, sessionResponseSchema);
|
|
28
53
|
},
|
|
54
|
+
/**
|
|
55
|
+
* Lists one page of sessions.
|
|
56
|
+
*/
|
|
29
57
|
async list({ agentId, ...options }) {
|
|
30
58
|
return await requestJson(config, `/v1/agents/${agentId}/sessions`, {
|
|
31
59
|
signal: options.abortSignal,
|
|
@@ -37,6 +65,9 @@ export function createSessionsResource(config) {
|
|
|
37
65
|
},
|
|
38
66
|
}, sessionsListResponseSchema);
|
|
39
67
|
},
|
|
68
|
+
/**
|
|
69
|
+
* Lists recently updated Sessions, optionally limited to one per Agent.
|
|
70
|
+
*/
|
|
40
71
|
async listLatest(options = {}) {
|
|
41
72
|
return await requestJson(config, "/v1/sessions/latest", {
|
|
42
73
|
signal: options.abortSignal,
|
|
@@ -51,6 +82,9 @@ export function createSessionsResource(config) {
|
|
|
51
82
|
},
|
|
52
83
|
}, latestSessionsListResponseSchema);
|
|
53
84
|
},
|
|
85
|
+
/**
|
|
86
|
+
* Lists one page of Session messages.
|
|
87
|
+
*/
|
|
54
88
|
async messages({ agentId, sessionId, ...options }) {
|
|
55
89
|
return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}/messages`, {
|
|
56
90
|
signal: options.abortSignal,
|
|
@@ -61,9 +95,15 @@ export function createSessionsResource(config) {
|
|
|
61
95
|
},
|
|
62
96
|
}, sessionMessagesResponseSchema);
|
|
63
97
|
},
|
|
98
|
+
/**
|
|
99
|
+
* Retrieves the pending Tool approval round.
|
|
100
|
+
*/
|
|
64
101
|
async toolApprovals({ agentId, sessionId, abortSignal }) {
|
|
65
102
|
return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}/tool-approvals`, { signal: abortSignal }, toolApprovalsResponseSchema);
|
|
66
103
|
},
|
|
104
|
+
/**
|
|
105
|
+
* Deletes sessions.
|
|
106
|
+
*/
|
|
67
107
|
async delete({ agentId, sessionId, deleteArtifacts, abortSignal }) {
|
|
68
108
|
await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}`, { method: "DELETE", query: { deleteArtifacts }, signal: abortSignal });
|
|
69
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
|
},
|