@blazingagents/sdk 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/chat-transport.js +1 -3
- package/dist/client.js +2 -2
- package/dist/contracts/entities/chat-connections.d.ts +51 -0
- package/dist/contracts/entities/chat-connections.js +24 -0
- package/dist/contracts/entities/chat.d.ts +2 -0
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/index.js +1 -1
- package/dist/direct-chat-transport.js +28 -40
- package/dist/errors.js +0 -2
- package/dist/functions.js +2 -2
- package/dist/generation.d.ts +1 -2
- package/dist/generation.js +45 -79
- package/dist/http.d.ts +5 -10
- package/dist/http.js +8 -1
- package/dist/index.d.ts +1 -1
- package/dist/resources/agents.d.ts +8 -2
- package/dist/resources/agents.js +29 -19
- package/dist/resources/artifacts.js +4 -4
- package/dist/resources/chat-connections.js +21 -9
- package/dist/resources/mcp-connections.js +9 -8
- package/dist/resources/memories.js +6 -6
- package/dist/resources/merchant-bindings.js +3 -3
- package/dist/resources/merchant-usage-events.js +5 -5
- package/dist/resources/prompts.js +4 -4
- package/dist/resources/providers.js +6 -6
- package/dist/resources/sessions.js +13 -17
- package/dist/resources/skills.js +9 -8
- package/dist/resources/tasks.js +10 -11
- package/dist/resources/usage.js +2 -2
- package/dist/resources/workspaces.js +4 -4
- package/dist/types.d.ts +35 -20
- package/package.json +2 -2
package/dist/resources/agents.js
CHANGED
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
import { agentResponseSchema, agentsResponseSchema, } from "../contracts/entities/agents.js";
|
|
2
2
|
import { mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, } from "../contracts/entities/mcp-connections.js";
|
|
3
3
|
import { spendingLimitResponseSchema } from "../contracts/entities/spending-limits.js";
|
|
4
|
-
import { requestJson } from "../http.js";
|
|
4
|
+
import { apiPath, requestJson } from "../http.js";
|
|
5
5
|
/**
|
|
6
|
-
* Builds the Agents operations
|
|
6
|
+
* Builds the Agents operations, including the spending limits that need tenant authority.
|
|
7
7
|
* @param config - Shared authentication and transport configuration.
|
|
8
8
|
* @returns The configured resource client.
|
|
9
9
|
*/
|
|
10
10
|
export function createAgentsResource(config) {
|
|
11
|
+
return {
|
|
12
|
+
...createUserAgentsResource(config),
|
|
13
|
+
/** Retrieves the model spending limit using tenant authority. */
|
|
14
|
+
async getSpendingLimit({ agentId, abortSignal }) {
|
|
15
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/spending-limit`, { signal: abortSignal }, spendingLimitResponseSchema);
|
|
16
|
+
},
|
|
17
|
+
/** Sets the model spending limit. Null disables it. Requires tenant authority. */
|
|
18
|
+
async updateSpendingLimit({ agentId, abortSignal, ...body }) {
|
|
19
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/spending-limit`, { method: "PUT", json: body, signal: abortSignal }, spendingLimitResponseSchema);
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Builds the Agents operations a user-scoped client may call.
|
|
25
|
+
* @param config - Shared authentication and transport configuration.
|
|
26
|
+
* @returns The configured resource client.
|
|
27
|
+
*/
|
|
28
|
+
export function createUserAgentsResource(config) {
|
|
11
29
|
/**
|
|
12
30
|
* Updates agents.
|
|
13
31
|
*/
|
|
14
|
-
const update = async ({ agentId, abortSignal, ...body }) => requestJson(config, `/v1/agents/${agentId}`, {
|
|
32
|
+
const update = async ({ agentId, abortSignal, ...body }) => requestJson(config, apiPath `/v1/agents/${agentId}`, {
|
|
15
33
|
json: body,
|
|
16
34
|
signal: abortSignal,
|
|
17
35
|
method: "PUT",
|
|
18
36
|
}, agentResponseSchema);
|
|
19
37
|
return {
|
|
20
|
-
/** Retrieves the model spending limit using tenant authority. */
|
|
21
|
-
async getSpendingLimit({ agentId, abortSignal }) {
|
|
22
|
-
return await requestJson(config, `/v1/agents/${agentId}/spending-limit`, { signal: abortSignal }, spendingLimitResponseSchema);
|
|
23
|
-
},
|
|
24
|
-
/** Sets the model spending limit. Null disables it. Requires tenant authority. */
|
|
25
|
-
async updateSpendingLimit({ agentId, abortSignal, ...body }) {
|
|
26
|
-
return await requestJson(config, `/v1/agents/${agentId}/spending-limit`, { method: "PUT", json: body, signal: abortSignal }, spendingLimitResponseSchema);
|
|
27
|
-
},
|
|
28
38
|
/**
|
|
29
39
|
* Creates agents.
|
|
30
40
|
*/
|
|
@@ -53,38 +63,38 @@ export function createAgentsResource(config) {
|
|
|
53
63
|
* Retrieves agents.
|
|
54
64
|
*/
|
|
55
65
|
async get({ agentId, abortSignal }) {
|
|
56
|
-
return await requestJson(config, `/v1/agents/${agentId}`, { signal: abortSignal }, agentResponseSchema);
|
|
66
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}`, { signal: abortSignal }, agentResponseSchema);
|
|
57
67
|
},
|
|
58
68
|
/**
|
|
59
69
|
* Disables agents.
|
|
60
70
|
*/
|
|
61
71
|
async disable({ agentId, abortSignal }) {
|
|
62
|
-
return await requestJson(config, `/v1/agents/${agentId}/disable`, { method: "POST", signal: abortSignal }, agentResponseSchema);
|
|
72
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/disable`, { method: "POST", signal: abortSignal }, agentResponseSchema);
|
|
63
73
|
},
|
|
64
74
|
/**
|
|
65
75
|
* Enables agents.
|
|
66
76
|
*/
|
|
67
77
|
async enable({ agentId, abortSignal }) {
|
|
68
|
-
return await requestJson(config, `/v1/agents/${agentId}/enable`, { method: "POST", signal: abortSignal }, agentResponseSchema);
|
|
78
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/enable`, { method: "POST", signal: abortSignal }, agentResponseSchema);
|
|
69
79
|
},
|
|
70
80
|
/**
|
|
71
81
|
* Lists the Agent MCP attachments.
|
|
72
82
|
*/
|
|
73
83
|
async listMcpAttachments({ agentId, abortSignal }) {
|
|
74
|
-
return await requestJson(config, `/v1/agents/${agentId}/mcp-attachments`, { signal: abortSignal }, mcpAttachmentsResponseSchema);
|
|
84
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/mcp-attachments`, { signal: abortSignal }, mcpAttachmentsResponseSchema);
|
|
75
85
|
},
|
|
76
86
|
update,
|
|
77
87
|
/**
|
|
78
88
|
* Updates one Agent MCP attachment.
|
|
79
89
|
*/
|
|
80
90
|
async updateMcpAttachment({ agentId, mcpConnectionId, abortSignal, ...body }) {
|
|
81
|
-
return await requestJson(config, `/v1/agents/${agentId}/mcp-attachments/${mcpConnectionId}`, { json: body, method: "PATCH", signal: abortSignal }, mcpAttachmentResponseSchema);
|
|
91
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/mcp-attachments/${mcpConnectionId}`, { json: body, method: "PATCH", signal: abortSignal }, mcpAttachmentResponseSchema);
|
|
82
92
|
},
|
|
83
93
|
/**
|
|
84
94
|
* Deletes agents.
|
|
85
95
|
*/
|
|
86
96
|
async delete({ agentId, includeArtifacts, abortSignal }) {
|
|
87
|
-
await requestJson(config, `/v1/agents/${agentId}`, {
|
|
97
|
+
await requestJson(config, apiPath `/v1/agents/${agentId}`, {
|
|
88
98
|
method: "DELETE",
|
|
89
99
|
query: { includeArtifacts },
|
|
90
100
|
signal: abortSignal,
|
|
@@ -96,7 +106,7 @@ export function createAgentsResource(config) {
|
|
|
96
106
|
async uploadAvatar({ agentId, file, abortSignal }) {
|
|
97
107
|
const form = new FormData();
|
|
98
108
|
form.append("file", file);
|
|
99
|
-
return await requestJson(config, `/v1/agents/${agentId}/avatar`, {
|
|
109
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/avatar`, {
|
|
100
110
|
body: form,
|
|
101
111
|
signal: abortSignal,
|
|
102
112
|
method: "POST",
|
|
@@ -106,7 +116,7 @@ export function createAgentsResource(config) {
|
|
|
106
116
|
* Removes the Agent avatar.
|
|
107
117
|
*/
|
|
108
118
|
async removeAvatar({ agentId, abortSignal }) {
|
|
109
|
-
return await requestJson(config, `/v1/agents/${agentId}/avatar`, { method: "DELETE", signal: abortSignal }, agentResponseSchema);
|
|
119
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/avatar`, { method: "DELETE", signal: abortSignal }, agentResponseSchema);
|
|
110
120
|
},
|
|
111
121
|
};
|
|
112
122
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsListResponseSchema, } from "../contracts/entities/artifacts.js";
|
|
2
|
-
import { requestJson } from "../http.js";
|
|
2
|
+
import { apiPath, requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.artifacts` — Tenant-level metadata and direct download URLs.
|
|
5
5
|
* @param config - Shared authentication and transport configuration.
|
|
@@ -11,13 +11,13 @@ export function createArtifactsResource(config) {
|
|
|
11
11
|
* Creates a temporary Artifact download URL.
|
|
12
12
|
*/
|
|
13
13
|
async createDownloadUrl({ artifactId, abortSignal }) {
|
|
14
|
-
return await requestJson(config, `/v1/artifacts/${artifactId}/download-url`, { method: "POST", signal: abortSignal }, artifactDownloadUrlResponseSchema);
|
|
14
|
+
return await requestJson(config, apiPath `/v1/artifacts/${artifactId}/download-url`, { method: "POST", signal: abortSignal }, artifactDownloadUrlResponseSchema);
|
|
15
15
|
},
|
|
16
16
|
/**
|
|
17
17
|
* Retrieves artifacts.
|
|
18
18
|
*/
|
|
19
19
|
async get({ artifactId, abortSignal }) {
|
|
20
|
-
return await requestJson(config, `/v1/artifacts/${artifactId}`, { signal: abortSignal }, artifactListItemSchema);
|
|
20
|
+
return await requestJson(config, apiPath `/v1/artifacts/${artifactId}`, { signal: abortSignal }, artifactListItemSchema);
|
|
21
21
|
},
|
|
22
22
|
/**
|
|
23
23
|
* Lists one page of artifacts.
|
|
@@ -36,7 +36,7 @@ export function createArtifactsResource(config) {
|
|
|
36
36
|
* Deletes artifacts.
|
|
37
37
|
*/
|
|
38
38
|
async delete({ artifactId, abortSignal }) {
|
|
39
|
-
await requestJson(config, `/v1/artifacts/${artifactId}`, {
|
|
39
|
+
await requestJson(config, apiPath `/v1/artifacts/${artifactId}`, {
|
|
40
40
|
method: "DELETE",
|
|
41
41
|
signal: abortSignal,
|
|
42
42
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { chatConnectionSchema, chatConnectionsResponseSchema, } from "../contracts/entities/chat-connections.js";
|
|
2
|
-
import { requestJson } from "../http.js";
|
|
1
|
+
import { chatConnectionSchema, chatConnectionsResponseSchema, chatDeliveryListSchema, chatDeliveryResultSchema, } from "../contracts/entities/chat-connections.js";
|
|
2
|
+
import { apiPath, requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* Builds the Chat Connections operations using the shared HTTP configuration.
|
|
5
5
|
* @param config - Shared authentication and transport configuration.
|
|
@@ -23,43 +23,55 @@ export function createChatConnectionsResource(config) {
|
|
|
23
23
|
* Retrieves chat connections.
|
|
24
24
|
*/
|
|
25
25
|
async get({ chatConnectionId, abortSignal }) {
|
|
26
|
-
return await requestJson(config, `/v1/chat-connections/${
|
|
26
|
+
return await requestJson(config, apiPath `/v1/chat-connections/${chatConnectionId}`, { signal: abortSignal, method: "GET" }, chatConnectionSchema);
|
|
27
27
|
},
|
|
28
28
|
/**
|
|
29
29
|
* Updates chat connections.
|
|
30
30
|
*/
|
|
31
31
|
async update({ chatConnectionId, abortSignal, ...body }) {
|
|
32
|
-
return await requestJson(config, `/v1/chat-connections/${
|
|
32
|
+
return await requestJson(config, apiPath `/v1/chat-connections/${chatConnectionId}`, { signal: abortSignal, method: "PATCH", json: body }, chatConnectionSchema);
|
|
33
33
|
},
|
|
34
34
|
/**
|
|
35
35
|
* Replaces the Chat Connection credentials.
|
|
36
36
|
*/
|
|
37
37
|
async rotateCredentials({ chatConnectionId, abortSignal, ...body }) {
|
|
38
|
-
return await requestJson(config, `/v1/chat-connections/${
|
|
38
|
+
return await requestJson(config, apiPath `/v1/chat-connections/${chatConnectionId}/credentials`, { signal: abortSignal, method: "POST", json: body }, chatConnectionSchema);
|
|
39
39
|
},
|
|
40
40
|
/**
|
|
41
41
|
* Checks the Chat Connection health.
|
|
42
42
|
*/
|
|
43
43
|
async checkHealth({ chatConnectionId, abortSignal }) {
|
|
44
|
-
return await requestJson(config, `/v1/chat-connections/${
|
|
44
|
+
return await requestJson(config, apiPath `/v1/chat-connections/${chatConnectionId}/health`, { signal: abortSignal, method: "POST" }, chatConnectionSchema);
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Lists one page of the Chat Connection's deliveries.
|
|
48
|
+
*/
|
|
49
|
+
async listDeliveries({ chatConnectionId, abortSignal, ...query }) {
|
|
50
|
+
return await requestJson(config, apiPath `/v1/chat-connections/${chatConnectionId}/deliveries`, { signal: abortSignal, query }, chatDeliveryListSchema);
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Sends a stuck Chat delivery again.
|
|
54
|
+
*/
|
|
55
|
+
async repairDelivery({ chatConnectionId, deliveryId, abortSignal, ...body }) {
|
|
56
|
+
return await requestJson(config, apiPath `/v1/chat-connections/${chatConnectionId}/deliveries/${deliveryId}/repair`, { signal: abortSignal, method: "POST", json: body }, chatDeliveryResultSchema);
|
|
45
57
|
},
|
|
46
58
|
/**
|
|
47
59
|
* Enables chat connections.
|
|
48
60
|
*/
|
|
49
61
|
async enable({ chatConnectionId, abortSignal }) {
|
|
50
|
-
return await requestJson(config, `/v1/chat-connections/${
|
|
62
|
+
return await requestJson(config, apiPath `/v1/chat-connections/${chatConnectionId}/enable`, { signal: abortSignal, method: "POST" }, chatConnectionSchema);
|
|
51
63
|
},
|
|
52
64
|
/**
|
|
53
65
|
* Disables chat connections.
|
|
54
66
|
*/
|
|
55
67
|
async disable({ chatConnectionId, abortSignal }) {
|
|
56
|
-
return await requestJson(config, `/v1/chat-connections/${
|
|
68
|
+
return await requestJson(config, apiPath `/v1/chat-connections/${chatConnectionId}/disable`, { signal: abortSignal, method: "POST" }, chatConnectionSchema);
|
|
57
69
|
},
|
|
58
70
|
/**
|
|
59
71
|
* Deletes chat connections.
|
|
60
72
|
*/
|
|
61
73
|
async delete({ chatConnectionId, abortSignal }) {
|
|
62
|
-
await requestJson(config, `/v1/chat-connections/${
|
|
74
|
+
await requestJson(config, apiPath `/v1/chat-connections/${chatConnectionId}`, { signal: abortSignal, method: "DELETE" });
|
|
63
75
|
},
|
|
64
76
|
};
|
|
65
77
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mcpConnectionOauthConnectResponseSchema, mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionsResponseSchema, mcpConnectionTestResponseSchema, reconnectMcpConnectionBodySchema, updateMcpConnectionBodySchema, } from "../contracts/entities/mcp-connections.js";
|
|
2
|
-
import { requestJson } from "../http.js";
|
|
2
|
+
import { apiPath, requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* Builds the Mcp Connections operations using the shared HTTP configuration.
|
|
5
5
|
* @param config - Shared authentication and transport configuration.
|
|
@@ -13,10 +13,11 @@ export function createMcpConnectionsResource(config) {
|
|
|
13
13
|
}, mcpConnectionResponseSchema));
|
|
14
14
|
return {
|
|
15
15
|
/**
|
|
16
|
-
* Starts OAuth authorization for mcp connections.
|
|
16
|
+
* Starts OAuth authorization for mcp connections. The API serves this
|
|
17
|
+
* route only to a dashboard session and refuses an API key.
|
|
17
18
|
*/
|
|
18
19
|
async connect({ mcpConnectionId, abortSignal }) {
|
|
19
|
-
return await requestJson(config, `/v1/mcp-connections/${mcpConnectionId}/connect`, { method: "POST", signal: abortSignal }, mcpConnectionOauthConnectResponseSchema);
|
|
20
|
+
return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}/connect`, { method: "POST", signal: abortSignal }, mcpConnectionOauthConnectResponseSchema);
|
|
20
21
|
},
|
|
21
22
|
create,
|
|
22
23
|
/**
|
|
@@ -29,13 +30,13 @@ export function createMcpConnectionsResource(config) {
|
|
|
29
30
|
* Retrieves mcp connections.
|
|
30
31
|
*/
|
|
31
32
|
async get({ mcpConnectionId, abortSignal }) {
|
|
32
|
-
return await requestJson(config, `/v1/mcp-connections/${mcpConnectionId}`, { signal: abortSignal }, mcpConnectionResponseSchema);
|
|
33
|
+
return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}`, { signal: abortSignal }, mcpConnectionResponseSchema);
|
|
33
34
|
},
|
|
34
35
|
/**
|
|
35
36
|
* Updates mcp connections.
|
|
36
37
|
*/
|
|
37
38
|
async update({ mcpConnectionId, abortSignal, ...body }) {
|
|
38
|
-
return await requestJson(config, `/v1/mcp-connections/${mcpConnectionId}`, {
|
|
39
|
+
return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}`, {
|
|
39
40
|
json: updateMcpConnectionBodySchema.parse(body),
|
|
40
41
|
signal: abortSignal,
|
|
41
42
|
method: "PATCH",
|
|
@@ -45,7 +46,7 @@ export function createMcpConnectionsResource(config) {
|
|
|
45
46
|
* Deletes mcp connections.
|
|
46
47
|
*/
|
|
47
48
|
async delete({ mcpConnectionId, abortSignal }) {
|
|
48
|
-
await requestJson(config, `/v1/mcp-connections/${mcpConnectionId}`, {
|
|
49
|
+
await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}`, {
|
|
49
50
|
method: "DELETE",
|
|
50
51
|
signal: abortSignal,
|
|
51
52
|
});
|
|
@@ -54,13 +55,13 @@ export function createMcpConnectionsResource(config) {
|
|
|
54
55
|
* Tests mcp connections.
|
|
55
56
|
*/
|
|
56
57
|
async test({ mcpConnectionId, abortSignal }) {
|
|
57
|
-
return await requestJson(config, `/v1/mcp-connections/${mcpConnectionId}/test`, { method: "POST", signal: abortSignal }, mcpConnectionTestResponseSchema);
|
|
58
|
+
return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}/test`, { method: "POST", signal: abortSignal }, mcpConnectionTestResponseSchema);
|
|
58
59
|
},
|
|
59
60
|
/**
|
|
60
61
|
* Reconnects mcp connections.
|
|
61
62
|
*/
|
|
62
63
|
async reconnect({ mcpConnectionId, abortSignal, ...body }) {
|
|
63
|
-
return await requestJson(config, `/v1/mcp-connections/${mcpConnectionId}/reconnect`, {
|
|
64
|
+
return await requestJson(config, apiPath `/v1/mcp-connections/${mcpConnectionId}/reconnect`, {
|
|
64
65
|
json: reconnectMcpConnectionBodySchema.parse(body),
|
|
65
66
|
signal: abortSignal,
|
|
66
67
|
method: "POST",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memoriesListResponseSchema, memoryResponseSchema, } from "../contracts/entities/memories.js";
|
|
2
|
-
import { requestJson } from "../http.js";
|
|
2
|
+
import { apiPath, requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.memories` — CRUD and query over `/v1/agents/:agentId/memories`.
|
|
5
5
|
* Memories are Agent-nested; `userId` is stamped at creation and immutable,
|
|
@@ -13,7 +13,7 @@ export function createMemoriesResource(config) {
|
|
|
13
13
|
* Lists one page of memories.
|
|
14
14
|
*/
|
|
15
15
|
async list({ agentId, abortSignal, ...options }) {
|
|
16
|
-
return await requestJson(config, `/v1/agents/${agentId}/memories`, {
|
|
16
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/memories`, {
|
|
17
17
|
signal: abortSignal,
|
|
18
18
|
query: {
|
|
19
19
|
...(options.userId === undefined ? {} : { userId: options.userId }),
|
|
@@ -27,25 +27,25 @@ export function createMemoriesResource(config) {
|
|
|
27
27
|
* Creates memories.
|
|
28
28
|
*/
|
|
29
29
|
async create({ agentId, abortSignal, ...body }) {
|
|
30
|
-
return await requestJson(config, `/v1/agents/${agentId}/memories`, { json: body, signal: abortSignal, method: "POST" }, memoryResponseSchema);
|
|
30
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/memories`, { json: body, signal: abortSignal, method: "POST" }, memoryResponseSchema);
|
|
31
31
|
},
|
|
32
32
|
/**
|
|
33
33
|
* Retrieves memories.
|
|
34
34
|
*/
|
|
35
35
|
async get({ agentId, memoryId, abortSignal }) {
|
|
36
|
-
return await requestJson(config, `/v1/agents/${agentId}/memories/${memoryId}`, { signal: abortSignal }, memoryResponseSchema);
|
|
36
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/memories/${memoryId}`, { signal: abortSignal }, memoryResponseSchema);
|
|
37
37
|
},
|
|
38
38
|
/**
|
|
39
39
|
* Updates memories.
|
|
40
40
|
*/
|
|
41
41
|
async update({ agentId, memoryId, abortSignal, ...body }) {
|
|
42
|
-
return await requestJson(config, `/v1/agents/${agentId}/memories/${memoryId}`, { json: body, signal: abortSignal, method: "PATCH" }, memoryResponseSchema);
|
|
42
|
+
return await requestJson(config, apiPath `/v1/agents/${agentId}/memories/${memoryId}`, { json: body, signal: abortSignal, method: "PATCH" }, memoryResponseSchema);
|
|
43
43
|
},
|
|
44
44
|
/**
|
|
45
45
|
* Deletes memories.
|
|
46
46
|
*/
|
|
47
47
|
async delete({ agentId, memoryId, abortSignal }) {
|
|
48
|
-
await requestJson(config, `/v1/agents/${agentId}/memories/${memoryId}`, { method: "DELETE", signal: abortSignal });
|
|
48
|
+
await requestJson(config, apiPath `/v1/agents/${agentId}/memories/${memoryId}`, { method: "DELETE", signal: abortSignal });
|
|
49
49
|
},
|
|
50
50
|
};
|
|
51
51
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { merchantBindingResponseSchema, merchantBindingsResponseSchema, } from "../contracts/entities/merchant.js";
|
|
2
|
-
import { requestJson } from "../http.js";
|
|
2
|
+
import { apiPath, requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.merchantBindings` — list/put/delete over
|
|
5
5
|
* `/v1/merchant-connection/bindings`. `put` upserts the end user's provider
|
|
@@ -20,13 +20,13 @@ export function createMerchantBindingsResource(config) {
|
|
|
20
20
|
* Validates and saves merchant bindings.
|
|
21
21
|
*/
|
|
22
22
|
async put({ userId, abortSignal, ...body }) {
|
|
23
|
-
return await requestJson(config, `/v1/merchant-connection/bindings/${
|
|
23
|
+
return await requestJson(config, apiPath `/v1/merchant-connection/bindings/${userId}`, { json: body, method: "PUT", signal: abortSignal }, merchantBindingResponseSchema);
|
|
24
24
|
},
|
|
25
25
|
/**
|
|
26
26
|
* Deletes merchant bindings.
|
|
27
27
|
*/
|
|
28
28
|
async delete({ userId, abortSignal }) {
|
|
29
|
-
await requestJson(config, `/v1/merchant-connection/bindings/${
|
|
29
|
+
await requestJson(config, apiPath `/v1/merchant-connection/bindings/${userId}`, { method: "DELETE", signal: abortSignal });
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
}
|
|
@@ -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
|
}
|