@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
package/dist/http.js
CHANGED
|
@@ -4,6 +4,9 @@ const DIAGNOSTIC_BODY_LIMIT_BYTES = 64 * 1024;
|
|
|
4
4
|
const INVALID_RESPONSE_MESSAGE = "The server returned an invalid response.";
|
|
5
5
|
const NETWORK_ERROR_MESSAGE = "Network request failed (fetch threw before any HTTP exchange).";
|
|
6
6
|
const REQUEST_ABORTED_MESSAGE = "The request was aborted before any HTTP response.";
|
|
7
|
+
/**
|
|
8
|
+
* Appends query values while omitting null and undefined entries.
|
|
9
|
+
*/
|
|
7
10
|
function buildUrl(baseUrl, path, query) {
|
|
8
11
|
const url = `${baseUrl}${path}`;
|
|
9
12
|
if (!query) {
|
|
@@ -23,6 +26,10 @@ function buildUrl(baseUrl, path, query) {
|
|
|
23
26
|
* Performs a request and returns the parsed JSON body for success (status
|
|
24
27
|
* 2xx). API errors preserve the tolerant wire envelope; malformed responses
|
|
25
28
|
* become `invalid_response`.
|
|
29
|
+
* @param config - Authentication, base URL, and transport configuration.
|
|
30
|
+
* @param path - Endpoint path relative to the base URL.
|
|
31
|
+
* @param options - Configuration for this operation.
|
|
32
|
+
* @param schema - Schema used to validate the value.
|
|
26
33
|
*/
|
|
27
34
|
export async function requestJson(config, path, options = {}, schema) {
|
|
28
35
|
const response = await rawRequest(config, path, options);
|
|
@@ -56,6 +63,9 @@ export async function requestJson(config, path, options = {}, schema) {
|
|
|
56
63
|
/**
|
|
57
64
|
* Performs a request and returns the raw `Response` for streaming paths.
|
|
58
65
|
* Non-2xx bodies are decoded before a caller can observe a streaming body.
|
|
66
|
+
* @param config - Authentication, base URL, and transport configuration.
|
|
67
|
+
* @param path - Endpoint path relative to the base URL.
|
|
68
|
+
* @param options - Configuration for this operation.
|
|
59
69
|
*/
|
|
60
70
|
export async function requestStream(config, path, options = {}) {
|
|
61
71
|
const response = await rawRequest(config, path, options);
|
|
@@ -64,6 +74,9 @@ export async function requestStream(config, path, options = {}) {
|
|
|
64
74
|
}
|
|
65
75
|
throw await errorFromResponse(response, options.signal);
|
|
66
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Sends an authenticated request and reports response metadata to the observer.
|
|
79
|
+
*/
|
|
67
80
|
async function rawRequest(config, path, options) {
|
|
68
81
|
const fetchImpl = config.fetch ?? globalThis.fetch;
|
|
69
82
|
const url = buildUrl(config.baseUrl, path, options.query);
|
|
@@ -122,6 +135,9 @@ async function rawRequest(config, path, options) {
|
|
|
122
135
|
}, { cause });
|
|
123
136
|
}
|
|
124
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Reads bounded diagnostics and decodes a failed HTTP response.
|
|
140
|
+
*/
|
|
125
141
|
async function errorFromResponse(response, signal) {
|
|
126
142
|
const read = await readResponseBody(response, true);
|
|
127
143
|
if (read.readFailed && isRequestAborted(read.cause, signal)) {
|
|
@@ -133,6 +149,12 @@ async function errorFromResponse(response, signal) {
|
|
|
133
149
|
}
|
|
134
150
|
return parseErrorEnvelope(read.diagnosticBody, response.status, headers);
|
|
135
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Checks whether the signal aborted or the cause names an AbortError.
|
|
154
|
+
* @param cause - Original failure to retain.
|
|
155
|
+
* @param signal - Signal that cancels the operation.
|
|
156
|
+
* @returns Whether the request signal or cause indicates cancellation.
|
|
157
|
+
*/
|
|
136
158
|
export function isRequestAborted(cause, signal) {
|
|
137
159
|
return (signal?.aborted === true ||
|
|
138
160
|
(cause !== null &&
|
|
@@ -140,6 +162,11 @@ export function isRequestAborted(cause, signal) {
|
|
|
140
162
|
"name" in cause &&
|
|
141
163
|
cause.name === "AbortError"));
|
|
142
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Wraps an abort cause as a request_aborted SDK error.
|
|
167
|
+
* @param cause - Original failure to retain.
|
|
168
|
+
* @returns A request_aborted error retaining the cause.
|
|
169
|
+
*/
|
|
143
170
|
export function requestAbortedError(cause) {
|
|
144
171
|
return new BlazingAgentsError({
|
|
145
172
|
code: "request_aborted",
|
|
@@ -215,6 +242,9 @@ async function readResponseBody(response, stopAtDiagnosticLimit) {
|
|
|
215
242
|
byteLength += chunk.byteLength;
|
|
216
243
|
}
|
|
217
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Cancels an oversized error body and retains its bounded diagnostic prefix.
|
|
247
|
+
*/
|
|
218
248
|
async function cancelTruncatedBody(reader, chunks, byteLength) {
|
|
219
249
|
const diagnosticBody = decodeDiagnosticChunks(chunks, byteLength, true).body;
|
|
220
250
|
try {
|
|
@@ -236,6 +266,9 @@ async function cancelTruncatedBody(reader, chunks, byteLength) {
|
|
|
236
266
|
};
|
|
237
267
|
}
|
|
238
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* Decodes diagnostics without exceeding the UTF-8 byte limit.
|
|
271
|
+
*/
|
|
239
272
|
function decodeDiagnosticChunks(chunks, byteLength, sourceTruncated) {
|
|
240
273
|
const body = decodeChunks(chunks, byteLength, sourceTruncated);
|
|
241
274
|
const encoded = new TextEncoder().encode(body);
|
|
@@ -247,6 +280,9 @@ function decodeDiagnosticChunks(chunks, byteLength, sourceTruncated) {
|
|
|
247
280
|
truncated: true,
|
|
248
281
|
};
|
|
249
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* Joins retained bytes and omits an incomplete trailing character when truncated.
|
|
285
|
+
*/
|
|
250
286
|
function decodeChunks(chunks, byteLength, truncated) {
|
|
251
287
|
const bytes = new Uint8Array(byteLength);
|
|
252
288
|
let offset = 0;
|
|
@@ -264,6 +300,10 @@ function decodeChunks(chunks, byteLength, truncated) {
|
|
|
264
300
|
* Decodes a response body with the tolerant consumer schema. Unknown future
|
|
265
301
|
* codes and fields remain valid; malformed responses never infer a domain
|
|
266
302
|
* code from HTTP status.
|
|
303
|
+
* @param bodyText - Response body as text.
|
|
304
|
+
* @param status - HTTP response status.
|
|
305
|
+
* @param headers - Response headers to preserve or inspect.
|
|
306
|
+
* @returns The server error, or invalid_response when the envelope is malformed.
|
|
267
307
|
*/
|
|
268
308
|
export function parseErrorEnvelope(bodyText, status, headers = new Headers()) {
|
|
269
309
|
let parsed;
|
|
@@ -292,6 +332,9 @@ export function parseErrorEnvelope(bodyText, status, headers = new Headers()) {
|
|
|
292
332
|
}
|
|
293
333
|
return invalidResponseError(headers, status, bodyText, false);
|
|
294
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Builds an invalid_response error with bounded diagnostics and request correlation.
|
|
337
|
+
*/
|
|
295
338
|
function invalidResponseError(headers, status, responseBody, responseBodyTruncated, cause) {
|
|
296
339
|
return new BlazingAgentsError({
|
|
297
340
|
code: "invalid_response",
|
package/dist/index.d.ts
CHANGED
|
@@ -16,11 +16,11 @@ export type { CreateMerchantConnectionBody, MerchantBindingResponse, MerchantBin
|
|
|
16
16
|
export type { CreatePromptBody, PromptResponse, PromptsListQuery, PromptsResponse, UpdatePromptBody, } from "./contracts/entities/prompts.ts";
|
|
17
17
|
export type { CreateProviderBody, ProviderListItem, ProviderModel, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ProviderType, ThinkingLevelsResponse, UpdateProviderBody, } from "./contracts/entities/providers.ts";
|
|
18
18
|
export type { ChatSteerConsumedEvent, SessionActivity, SessionInput, SessionInputResponse, SessionInputState, SessionInputsQuery, SessionInputsResponse, StopSessionBody, StopSessionResponse, SubmitSessionInputBody, } from "./contracts/entities/session-inputs.ts";
|
|
19
|
-
export type { ContinueToolApprovalsBody, SessionResponse, ToolApprovalDecision, ToolApprovalState, ToolApprovalsResponse, } from "./contracts/entities/sessions.ts";
|
|
19
|
+
export type { ContinueToolApprovalsBody, SessionForkedFrom, SessionResponse, ToolApprovalDecision, ToolApprovalState, ToolApprovalsResponse, } from "./contracts/entities/sessions.ts";
|
|
20
20
|
export { sessionResponseSchema } from "./contracts/entities/sessions.ts";
|
|
21
21
|
export type { CreateSkillBody, Skill, SkillArchiveType, SkillCopyResult, SkillCopyResults, SkillDetail, SkillFile, SkillsListResponse, } from "./contracts/entities/skills.ts";
|
|
22
22
|
export type { SessionUsageQuery, SessionUsageResponse, UsageBucket, UsageOverviewQuery, UsageOverviewResponse, UsageTotals, } from "./contracts/entities/usage.ts";
|
|
23
|
-
export type { CreateWorkspaceBody, UpdateWorkspaceBody, Workspace, WorkspaceNetworkPolicy, WorkspacesListResponse, } from "./contracts/entities/workspaces.ts";
|
|
23
|
+
export type { CreateWorkspaceBody, UpdateWorkspaceBody, Workspace, WorkspaceNetworkPolicy, WorkspacesListResponse, WorkspaceTier, } from "./contracts/entities/workspaces.ts";
|
|
24
24
|
export { BlazingAgentsDirectChatTransport, type BlazingAgentsDirectChatTransportOptions, } from "./direct-chat-transport.ts";
|
|
25
25
|
export { BlazingAgentsError } from "./errors.ts";
|
|
26
26
|
export { type ChatFunction, type ChatFunctionContext, type ChatFunctions, defineFunction, } from "./functions.ts";
|
package/dist/relay.d.ts
CHANGED
|
@@ -8,19 +8,42 @@ export interface RelayContext {
|
|
|
8
8
|
userId: string;
|
|
9
9
|
}
|
|
10
10
|
export interface SessionOwnershipStore {
|
|
11
|
+
/**
|
|
12
|
+
* Looks up the end user who owns the Session.
|
|
13
|
+
* @param sessionId - Session to look up or record.
|
|
14
|
+
* @returns The owner ID, or undefined when no owner is recorded.
|
|
15
|
+
*/
|
|
11
16
|
ownerOf(sessionId: string): Promise<string | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Records ownership of a newly created Session.
|
|
19
|
+
* @param sessionId - Session to look up or record.
|
|
20
|
+
* @param userId - End-user ID for request scope.
|
|
21
|
+
* @returns Resolves after ownership is stored.
|
|
22
|
+
*/
|
|
12
23
|
recordOwner(sessionId: string, userId: string): Promise<void>;
|
|
13
24
|
}
|
|
14
25
|
interface RelayOptions<Method extends keyof BlazingAgents> {
|
|
15
26
|
client: Pick<BlazingAgents, Method>;
|
|
27
|
+
/**
|
|
28
|
+
* Resolves authenticated Agent and end-user context, or null for an unauthenticated request.
|
|
29
|
+
* @param request - Incoming HTTP request.
|
|
30
|
+
* @returns Authenticated context, or null when authentication fails.
|
|
31
|
+
*/
|
|
16
32
|
resolveContext(request: Request): Promise<RelayContext | null>;
|
|
17
33
|
}
|
|
18
34
|
/**
|
|
19
35
|
* Relays useChat submissions. An assistant message carrying approval
|
|
20
36
|
* responses submits the complete round and streams the continuation.
|
|
37
|
+
* @param options - Configuration for this operation.
|
|
38
|
+
* @returns An HTTP handler that checks Session ownership before resuming.
|
|
21
39
|
*/
|
|
22
40
|
export declare function createChatRelay(options: RelayOptions<"chat" | "continueChat"> & {
|
|
23
41
|
sessions: SessionOwnershipStore;
|
|
24
42
|
}): (request: Request) => Promise<Response>;
|
|
43
|
+
/**
|
|
44
|
+
* Creates an authenticated HTTP handler that validates prompts and relays text generation.
|
|
45
|
+
* @param options - Configuration for this operation.
|
|
46
|
+
* @returns An HTTP handler that validates prompts and relays text generation.
|
|
47
|
+
*/
|
|
25
48
|
export declare function createCompletionRelay(options: RelayOptions<"completion">): (request: Request) => Promise<Response>;
|
|
26
49
|
export {};
|
package/dist/relay.js
CHANGED
|
@@ -15,6 +15,8 @@ const completionBodySchema = z.object({ prompt: z.string().trim().min(1) });
|
|
|
15
15
|
/**
|
|
16
16
|
* Relays useChat submissions. An assistant message carrying approval
|
|
17
17
|
* responses submits the complete round and streams the continuation.
|
|
18
|
+
* @param options - Configuration for this operation.
|
|
19
|
+
* @returns An HTTP handler that checks Session ownership before resuming.
|
|
18
20
|
*/
|
|
19
21
|
export function createChatRelay(options) {
|
|
20
22
|
return async (request) => {
|
|
@@ -86,6 +88,9 @@ export function createChatRelay(options) {
|
|
|
86
88
|
}
|
|
87
89
|
};
|
|
88
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Validates the Session and forwards the last assistant approval round.
|
|
93
|
+
*/
|
|
89
94
|
async function relayApprovalResponses(client, { functions, message, request, ...input }) {
|
|
90
95
|
if (input.sessionId === undefined) {
|
|
91
96
|
return errorResponse(400, "invalid_request", "Tool approval requires an existing Session.");
|
|
@@ -106,6 +111,11 @@ async function relayApprovalResponses(client, { functions, message, request, ...
|
|
|
106
111
|
});
|
|
107
112
|
return continuation.toResponse();
|
|
108
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Creates an authenticated HTTP handler that validates prompts and relays text generation.
|
|
116
|
+
* @param options - Configuration for this operation.
|
|
117
|
+
* @returns An HTTP handler that validates prompts and relays text generation.
|
|
118
|
+
*/
|
|
109
119
|
export function createCompletionRelay(options) {
|
|
110
120
|
return async (request) => {
|
|
111
121
|
try {
|
|
@@ -128,6 +138,9 @@ export function createCompletionRelay(options) {
|
|
|
128
138
|
}
|
|
129
139
|
};
|
|
130
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Maps validation and SDK failures to safe public error responses.
|
|
143
|
+
*/
|
|
131
144
|
function safeErrorResponse(error) {
|
|
132
145
|
if (error instanceof z.ZodError || error instanceof SyntaxError) {
|
|
133
146
|
return errorResponse(400, "invalid_request", "Invalid request body.");
|
|
@@ -143,6 +156,9 @@ function safeErrorResponse(error) {
|
|
|
143
156
|
}
|
|
144
157
|
return errorResponse(500, "internal_error", "Request failed.");
|
|
145
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Builds a JSON error envelope with the selected HTTP status.
|
|
161
|
+
*/
|
|
146
162
|
function errorResponse(status, code, message, headers) {
|
|
147
163
|
const responseHeaders = new Headers(headers);
|
|
148
164
|
responseHeaders.set("content-type", "application/json");
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { AgentsResource, HttpConfig } from "../types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Builds the Agents 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 createAgentsResource(config: HttpConfig): AgentsResource;
|
package/dist/resources/agents.js
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import { agentResponseSchema, agentsResponseSchema, } from "../contracts/entities/agents.js";
|
|
2
2
|
import { mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, } from "../contracts/entities/mcp-connections.js";
|
|
3
3
|
import { requestJson } from "../http.js";
|
|
4
|
+
/**
|
|
5
|
+
* Builds the Agents operations using the shared HTTP configuration.
|
|
6
|
+
* @param config - Shared authentication and transport configuration.
|
|
7
|
+
* @returns The configured resource client.
|
|
8
|
+
*/
|
|
4
9
|
export function createAgentsResource(config) {
|
|
10
|
+
/**
|
|
11
|
+
* Updates agents.
|
|
12
|
+
*/
|
|
5
13
|
const update = async ({ agentId, abortSignal, ...body }) => requestJson(config, `/v1/agents/${agentId}`, {
|
|
6
14
|
json: body,
|
|
7
15
|
signal: abortSignal,
|
|
8
16
|
method: "PUT",
|
|
9
17
|
}, agentResponseSchema);
|
|
10
18
|
return {
|
|
19
|
+
/**
|
|
20
|
+
* Creates agents.
|
|
21
|
+
*/
|
|
11
22
|
async create({ abortSignal, ...body }) {
|
|
12
23
|
return await requestJson(config, "/v1/agents", {
|
|
13
24
|
json: body,
|
|
@@ -15,6 +26,9 @@ export function createAgentsResource(config) {
|
|
|
15
26
|
method: "POST",
|
|
16
27
|
}, agentResponseSchema);
|
|
17
28
|
},
|
|
29
|
+
/**
|
|
30
|
+
* Lists one page of agents.
|
|
31
|
+
*/
|
|
18
32
|
async list(options = {}) {
|
|
19
33
|
return await requestJson(config, "/v1/agents", {
|
|
20
34
|
signal: options.abortSignal,
|
|
@@ -26,22 +40,40 @@ export function createAgentsResource(config) {
|
|
|
26
40
|
},
|
|
27
41
|
}, agentsResponseSchema);
|
|
28
42
|
},
|
|
43
|
+
/**
|
|
44
|
+
* Retrieves agents.
|
|
45
|
+
*/
|
|
29
46
|
async get({ agentId, abortSignal }) {
|
|
30
47
|
return await requestJson(config, `/v1/agents/${agentId}`, { signal: abortSignal }, agentResponseSchema);
|
|
31
48
|
},
|
|
49
|
+
/**
|
|
50
|
+
* Disables agents.
|
|
51
|
+
*/
|
|
32
52
|
async disable({ agentId, abortSignal }) {
|
|
33
53
|
return await requestJson(config, `/v1/agents/${agentId}/disable`, { method: "POST", signal: abortSignal }, agentResponseSchema);
|
|
34
54
|
},
|
|
55
|
+
/**
|
|
56
|
+
* Enables agents.
|
|
57
|
+
*/
|
|
35
58
|
async enable({ agentId, abortSignal }) {
|
|
36
59
|
return await requestJson(config, `/v1/agents/${agentId}/enable`, { method: "POST", signal: abortSignal }, agentResponseSchema);
|
|
37
60
|
},
|
|
61
|
+
/**
|
|
62
|
+
* Lists the Agent MCP attachments.
|
|
63
|
+
*/
|
|
38
64
|
async listMcpAttachments({ agentId, abortSignal }) {
|
|
39
65
|
return await requestJson(config, `/v1/agents/${agentId}/mcp-attachments`, { signal: abortSignal }, mcpAttachmentsResponseSchema);
|
|
40
66
|
},
|
|
41
67
|
update,
|
|
68
|
+
/**
|
|
69
|
+
* Updates one Agent MCP attachment.
|
|
70
|
+
*/
|
|
42
71
|
async updateMcpAttachment({ agentId, mcpConnectionId, abortSignal, ...body }) {
|
|
43
72
|
return await requestJson(config, `/v1/agents/${agentId}/mcp-attachments/${mcpConnectionId}`, { json: body, method: "PATCH", signal: abortSignal }, mcpAttachmentResponseSchema);
|
|
44
73
|
},
|
|
74
|
+
/**
|
|
75
|
+
* Deletes agents.
|
|
76
|
+
*/
|
|
45
77
|
async delete({ agentId, includeArtifacts, abortSignal }) {
|
|
46
78
|
await requestJson(config, `/v1/agents/${agentId}`, {
|
|
47
79
|
method: "DELETE",
|
|
@@ -49,6 +81,9 @@ export function createAgentsResource(config) {
|
|
|
49
81
|
signal: abortSignal,
|
|
50
82
|
});
|
|
51
83
|
},
|
|
84
|
+
/**
|
|
85
|
+
* Uploads an Agent avatar as multipart form data.
|
|
86
|
+
*/
|
|
52
87
|
async uploadAvatar({ agentId, file, abortSignal }) {
|
|
53
88
|
const form = new FormData();
|
|
54
89
|
form.append("file", file);
|
|
@@ -58,6 +93,9 @@ export function createAgentsResource(config) {
|
|
|
58
93
|
method: "POST",
|
|
59
94
|
}, agentResponseSchema);
|
|
60
95
|
},
|
|
96
|
+
/**
|
|
97
|
+
* Removes the Agent avatar.
|
|
98
|
+
*/
|
|
61
99
|
async removeAvatar({ agentId, abortSignal }) {
|
|
62
100
|
return await requestJson(config, `/v1/agents/${agentId}/avatar`, { method: "DELETE", signal: abortSignal }, agentResponseSchema);
|
|
63
101
|
},
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ArtifactsResource, HttpConfig } from "../types.ts";
|
|
2
2
|
/**
|
|
3
3
|
* `client.artifacts` — Tenant-level metadata and direct download URLs.
|
|
4
|
+
* @param config - Shared authentication and transport configuration.
|
|
5
|
+
* @returns The configured resource client.
|
|
4
6
|
*/
|
|
5
7
|
export declare function createArtifactsResource(config: HttpConfig): ArtifactsResource;
|
|
@@ -2,15 +2,26 @@ import { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsLis
|
|
|
2
2
|
import { requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.artifacts` — Tenant-level metadata and direct download URLs.
|
|
5
|
+
* @param config - Shared authentication and transport configuration.
|
|
6
|
+
* @returns The configured resource client.
|
|
5
7
|
*/
|
|
6
8
|
export function createArtifactsResource(config) {
|
|
7
9
|
return {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a temporary Artifact download URL.
|
|
12
|
+
*/
|
|
8
13
|
async createDownloadUrl({ artifactId, abortSignal }) {
|
|
9
14
|
return await requestJson(config, `/v1/artifacts/${artifactId}/download-url`, { method: "POST", signal: abortSignal }, artifactDownloadUrlResponseSchema);
|
|
10
15
|
},
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves artifacts.
|
|
18
|
+
*/
|
|
11
19
|
async get({ artifactId, abortSignal }) {
|
|
12
20
|
return await requestJson(config, `/v1/artifacts/${artifactId}`, { signal: abortSignal }, artifactListItemSchema);
|
|
13
21
|
},
|
|
22
|
+
/**
|
|
23
|
+
* Lists one page of artifacts.
|
|
24
|
+
*/
|
|
14
25
|
async list({ abortSignal, ...options } = {}) {
|
|
15
26
|
return await requestJson(config, "/v1/artifacts", {
|
|
16
27
|
signal: abortSignal,
|
|
@@ -21,6 +32,9 @@ export function createArtifactsResource(config) {
|
|
|
21
32
|
},
|
|
22
33
|
}, artifactsListResponseSchema);
|
|
23
34
|
},
|
|
35
|
+
/**
|
|
36
|
+
* Deletes artifacts.
|
|
37
|
+
*/
|
|
24
38
|
async delete({ artifactId, abortSignal }) {
|
|
25
39
|
await requestJson(config, `/v1/artifacts/${artifactId}`, {
|
|
26
40
|
method: "DELETE",
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { ChatConnectionsResource, HttpConfig } from "../types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Builds the Chat Connections 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 createChatConnectionsResource(config: HttpConfig): ChatConnectionsResource;
|
|
@@ -1,31 +1,63 @@
|
|
|
1
1
|
import { chatConnectionSchema, chatConnectionsResponseSchema, } from "../contracts/entities/chat-connections.js";
|
|
2
2
|
import { requestJson } from "../http.js";
|
|
3
|
+
/**
|
|
4
|
+
* Builds the Chat Connections 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 createChatConnectionsResource(config) {
|
|
4
9
|
return {
|
|
10
|
+
/**
|
|
11
|
+
* Lists one page of chat connections.
|
|
12
|
+
*/
|
|
5
13
|
async list({ abortSignal } = {}) {
|
|
6
14
|
return await requestJson(config, "/v1/chat-connections", { signal: abortSignal }, chatConnectionsResponseSchema);
|
|
7
15
|
},
|
|
16
|
+
/**
|
|
17
|
+
* Creates chat connections.
|
|
18
|
+
*/
|
|
8
19
|
async create({ abortSignal, ...body }) {
|
|
9
20
|
return await requestJson(config, "/v1/chat-connections", { signal: abortSignal, method: "POST", json: body }, chatConnectionSchema);
|
|
10
21
|
},
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves chat connections.
|
|
24
|
+
*/
|
|
11
25
|
async get({ chatConnectionId, abortSignal }) {
|
|
12
26
|
return await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}`, { signal: abortSignal, method: "GET" }, chatConnectionSchema);
|
|
13
27
|
},
|
|
28
|
+
/**
|
|
29
|
+
* Updates chat connections.
|
|
30
|
+
*/
|
|
14
31
|
async update({ chatConnectionId, abortSignal, ...body }) {
|
|
15
32
|
return await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}`, { signal: abortSignal, method: "PATCH", json: body }, chatConnectionSchema);
|
|
16
33
|
},
|
|
34
|
+
/**
|
|
35
|
+
* Replaces the Chat Connection credentials.
|
|
36
|
+
*/
|
|
17
37
|
async rotateCredentials({ chatConnectionId, abortSignal, ...body }) {
|
|
18
38
|
return await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}/credentials`, { signal: abortSignal, method: "POST", json: body }, chatConnectionSchema);
|
|
19
39
|
},
|
|
40
|
+
/**
|
|
41
|
+
* Checks the Chat Connection health.
|
|
42
|
+
*/
|
|
20
43
|
async checkHealth({ chatConnectionId, abortSignal }) {
|
|
21
44
|
return await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}/health`, { signal: abortSignal, method: "POST" }, chatConnectionSchema);
|
|
22
45
|
},
|
|
46
|
+
/**
|
|
47
|
+
* Enables chat connections.
|
|
48
|
+
*/
|
|
23
49
|
async enable({ chatConnectionId, abortSignal }) {
|
|
24
50
|
return await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}/enable`, { signal: abortSignal, method: "POST" }, chatConnectionSchema);
|
|
25
51
|
},
|
|
52
|
+
/**
|
|
53
|
+
* Disables chat connections.
|
|
54
|
+
*/
|
|
26
55
|
async disable({ chatConnectionId, abortSignal }) {
|
|
27
56
|
return await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}/disable`, { signal: abortSignal, method: "POST" }, chatConnectionSchema);
|
|
28
57
|
},
|
|
58
|
+
/**
|
|
59
|
+
* Deletes chat connections.
|
|
60
|
+
*/
|
|
29
61
|
async delete({ chatConnectionId, abortSignal }) {
|
|
30
62
|
await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}`, { signal: abortSignal, method: "DELETE" });
|
|
31
63
|
},
|
|
@@ -2,5 +2,7 @@ import type { ChatDeliveriesResource, HttpConfig } from "../types.ts";
|
|
|
2
2
|
/**
|
|
3
3
|
* `client.chatDeliveries` — `GET /v1/chat-deliveries`, the Tenant-wide
|
|
4
4
|
* delivery feed across all Chat Connections, newest first.
|
|
5
|
+
* @param config - Shared authentication and transport configuration.
|
|
6
|
+
* @returns The configured resource client.
|
|
5
7
|
*/
|
|
6
8
|
export declare function createChatDeliveriesResource(config: HttpConfig): ChatDeliveriesResource;
|
|
@@ -3,9 +3,14 @@ import { requestJson } from "../http.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* `client.chatDeliveries` — `GET /v1/chat-deliveries`, the Tenant-wide
|
|
5
5
|
* delivery feed across all Chat Connections, newest first.
|
|
6
|
+
* @param config - Shared authentication and transport configuration.
|
|
7
|
+
* @returns The configured resource client.
|
|
6
8
|
*/
|
|
7
9
|
export function createChatDeliveriesResource(config) {
|
|
8
10
|
return {
|
|
11
|
+
/**
|
|
12
|
+
* Lists one page of chat deliveries.
|
|
13
|
+
*/
|
|
9
14
|
async list({ abortSignal, status, ...query } = {}) {
|
|
10
15
|
return await requestJson(config, "/v1/chat-deliveries", {
|
|
11
16
|
query: {
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { HttpConfig, McpConnectionsResource } from "../types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Builds the Mcp Connections 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 createMcpConnectionsResource(config: HttpConfig): McpConnectionsResource;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { mcpConnectionOauthConnectResponseSchema, mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionsResponseSchema, mcpConnectionTestResponseSchema, reconnectMcpConnectionBodySchema, updateMcpConnectionBodySchema, } from "../contracts/entities/mcp-connections.js";
|
|
2
2
|
import { requestJson } from "../http.js";
|
|
3
|
+
/**
|
|
4
|
+
* Builds the Mcp Connections 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 createMcpConnectionsResource(config) {
|
|
4
9
|
const create = (async ({ abortSignal, ...body }) => requestJson(config, "/v1/mcp-connections", {
|
|
5
10
|
json: body,
|
|
@@ -7,16 +12,28 @@ export function createMcpConnectionsResource(config) {
|
|
|
7
12
|
method: "POST",
|
|
8
13
|
}, mcpConnectionResponseSchema));
|
|
9
14
|
return {
|
|
15
|
+
/**
|
|
16
|
+
* Starts OAuth authorization for mcp connections.
|
|
17
|
+
*/
|
|
10
18
|
async connect({ mcpConnectionId, abortSignal }) {
|
|
11
19
|
return await requestJson(config, `/v1/mcp-connections/${mcpConnectionId}/connect`, { method: "POST", signal: abortSignal }, mcpConnectionOauthConnectResponseSchema);
|
|
12
20
|
},
|
|
13
21
|
create,
|
|
22
|
+
/**
|
|
23
|
+
* Lists one page of mcp connections.
|
|
24
|
+
*/
|
|
14
25
|
async list({ abortSignal } = {}) {
|
|
15
26
|
return await requestJson(config, "/v1/mcp-connections", { signal: abortSignal }, mcpConnectionsResponseSchema);
|
|
16
27
|
},
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves mcp connections.
|
|
30
|
+
*/
|
|
17
31
|
async get({ mcpConnectionId, abortSignal }) {
|
|
18
32
|
return await requestJson(config, `/v1/mcp-connections/${mcpConnectionId}`, { signal: abortSignal }, mcpConnectionResponseSchema);
|
|
19
33
|
},
|
|
34
|
+
/**
|
|
35
|
+
* Updates mcp connections.
|
|
36
|
+
*/
|
|
20
37
|
async update({ mcpConnectionId, abortSignal, ...body }) {
|
|
21
38
|
return await requestJson(config, `/v1/mcp-connections/${mcpConnectionId}`, {
|
|
22
39
|
json: updateMcpConnectionBodySchema.parse(body),
|
|
@@ -24,15 +41,24 @@ export function createMcpConnectionsResource(config) {
|
|
|
24
41
|
method: "PATCH",
|
|
25
42
|
}, mcpConnectionResponseSchema);
|
|
26
43
|
},
|
|
44
|
+
/**
|
|
45
|
+
* Deletes mcp connections.
|
|
46
|
+
*/
|
|
27
47
|
async delete({ mcpConnectionId, abortSignal }) {
|
|
28
48
|
await requestJson(config, `/v1/mcp-connections/${mcpConnectionId}`, {
|
|
29
49
|
method: "DELETE",
|
|
30
50
|
signal: abortSignal,
|
|
31
51
|
});
|
|
32
52
|
},
|
|
53
|
+
/**
|
|
54
|
+
* Tests mcp connections.
|
|
55
|
+
*/
|
|
33
56
|
async test({ mcpConnectionId, abortSignal }) {
|
|
34
57
|
return await requestJson(config, `/v1/mcp-connections/${mcpConnectionId}/test`, { method: "POST", signal: abortSignal }, mcpConnectionTestResponseSchema);
|
|
35
58
|
},
|
|
59
|
+
/**
|
|
60
|
+
* Reconnects mcp connections.
|
|
61
|
+
*/
|
|
36
62
|
async reconnect({ mcpConnectionId, abortSignal, ...body }) {
|
|
37
63
|
return await requestJson(config, `/v1/mcp-connections/${mcpConnectionId}/reconnect`, {
|
|
38
64
|
json: reconnectMcpConnectionBodySchema.parse(body),
|
|
@@ -3,5 +3,7 @@ import type { HttpConfig, MemoriesResource } from "../types.ts";
|
|
|
3
3
|
* `client.memories` — CRUD and query over `/v1/agents/:agentId/memories`.
|
|
4
4
|
* Memories are Agent-nested; `userId` is stamped at creation and immutable,
|
|
5
5
|
* while list can filter it (including explicit `''`) or full-text search.
|
|
6
|
+
* @param config - Shared authentication and transport configuration.
|
|
7
|
+
* @returns The configured resource client.
|
|
6
8
|
*/
|
|
7
9
|
export declare function createMemoriesResource(config: HttpConfig): MemoriesResource;
|
|
@@ -4,9 +4,14 @@ import { requestJson } from "../http.js";
|
|
|
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,
|
|
6
6
|
* while list can filter it (including explicit `''`) or full-text search.
|
|
7
|
+
* @param config - Shared authentication and transport configuration.
|
|
8
|
+
* @returns The configured resource client.
|
|
7
9
|
*/
|
|
8
10
|
export function createMemoriesResource(config) {
|
|
9
11
|
return {
|
|
12
|
+
/**
|
|
13
|
+
* Lists one page of memories.
|
|
14
|
+
*/
|
|
10
15
|
async list({ agentId, abortSignal, ...options }) {
|
|
11
16
|
return await requestJson(config, `/v1/agents/${agentId}/memories`, {
|
|
12
17
|
signal: abortSignal,
|
|
@@ -18,15 +23,27 @@ export function createMemoriesResource(config) {
|
|
|
18
23
|
},
|
|
19
24
|
}, memoriesListResponseSchema);
|
|
20
25
|
},
|
|
26
|
+
/**
|
|
27
|
+
* Creates memories.
|
|
28
|
+
*/
|
|
21
29
|
async create({ agentId, abortSignal, ...body }) {
|
|
22
30
|
return await requestJson(config, `/v1/agents/${agentId}/memories`, { json: body, signal: abortSignal, method: "POST" }, memoryResponseSchema);
|
|
23
31
|
},
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves memories.
|
|
34
|
+
*/
|
|
24
35
|
async get({ agentId, memoryId, abortSignal }) {
|
|
25
36
|
return await requestJson(config, `/v1/agents/${agentId}/memories/${memoryId}`, { signal: abortSignal }, memoryResponseSchema);
|
|
26
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* Updates memories.
|
|
40
|
+
*/
|
|
27
41
|
async update({ agentId, memoryId, abortSignal, ...body }) {
|
|
28
42
|
return await requestJson(config, `/v1/agents/${agentId}/memories/${memoryId}`, { json: body, signal: abortSignal, method: "PATCH" }, memoryResponseSchema);
|
|
29
43
|
},
|
|
44
|
+
/**
|
|
45
|
+
* Deletes memories.
|
|
46
|
+
*/
|
|
30
47
|
async delete({ agentId, memoryId, abortSignal }) {
|
|
31
48
|
await requestJson(config, `/v1/agents/${agentId}/memories/${memoryId}`, { method: "DELETE", signal: abortSignal });
|
|
32
49
|
},
|
|
@@ -4,5 +4,7 @@ import type { HttpConfig, MerchantBindingsResource } from "../types.ts";
|
|
|
4
4
|
* `/v1/merchant-connection/bindings`. `put` upserts the end user's provider
|
|
5
5
|
* customer; the server validates the customer with the provider before
|
|
6
6
|
* storing.
|
|
7
|
+
* @param config - Shared authentication and transport configuration.
|
|
8
|
+
* @returns The configured resource client.
|
|
7
9
|
*/
|
|
8
10
|
export declare function createMerchantBindingsResource(config: HttpConfig): MerchantBindingsResource;
|
|
@@ -5,15 +5,26 @@ import { requestJson } from "../http.js";
|
|
|
5
5
|
* `/v1/merchant-connection/bindings`. `put` upserts the end user's provider
|
|
6
6
|
* customer; the server validates the customer with the provider before
|
|
7
7
|
* storing.
|
|
8
|
+
* @param config - Shared authentication and transport configuration.
|
|
9
|
+
* @returns The configured resource client.
|
|
8
10
|
*/
|
|
9
11
|
export function createMerchantBindingsResource(config) {
|
|
10
12
|
return {
|
|
13
|
+
/**
|
|
14
|
+
* Lists one page of merchant bindings.
|
|
15
|
+
*/
|
|
11
16
|
async list({ abortSignal, ...query } = {}) {
|
|
12
17
|
return await requestJson(config, "/v1/merchant-connection/bindings", { query, signal: abortSignal }, merchantBindingsResponseSchema);
|
|
13
18
|
},
|
|
19
|
+
/**
|
|
20
|
+
* Validates and saves merchant bindings.
|
|
21
|
+
*/
|
|
14
22
|
async put({ userId, abortSignal, ...body }) {
|
|
15
23
|
return await requestJson(config, `/v1/merchant-connection/bindings/${encodeURIComponent(userId)}`, { json: body, method: "PUT", signal: abortSignal }, merchantBindingResponseSchema);
|
|
16
24
|
},
|
|
25
|
+
/**
|
|
26
|
+
* Deletes merchant bindings.
|
|
27
|
+
*/
|
|
17
28
|
async delete({ userId, abortSignal }) {
|
|
18
29
|
await requestJson(config, `/v1/merchant-connection/bindings/${encodeURIComponent(userId)}`, { method: "DELETE", signal: abortSignal });
|
|
19
30
|
},
|
|
@@ -3,5 +3,7 @@ import type { HttpConfig, MerchantConnectionResource } from "../types.ts";
|
|
|
3
3
|
* `client.merchantConnection` — get/create/update/retire over
|
|
4
4
|
* `/v1/merchant-connection`. One connection per tenant; `credential` is
|
|
5
5
|
* write-only and never returned.
|
|
6
|
+
* @param config - Shared authentication and transport configuration.
|
|
7
|
+
* @returns The configured resource client.
|
|
6
8
|
*/
|
|
7
9
|
export declare function createMerchantConnectionResource(config: HttpConfig): MerchantConnectionResource;
|