@blazingagents/sdk 0.33.0 → 0.35.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/chat-transport.js +4 -1
- package/dist/client.d.ts +18 -2
- package/dist/client.js +16 -15
- package/dist/contracts/entities/agents.d.ts +7 -6
- package/dist/contracts/entities/agents.js +129 -36
- package/dist/contracts/entities/chat-connections.d.ts +9 -8
- package/dist/contracts/entities/chat-connections.js +70 -40
- package/dist/contracts/entities/chat.d.ts +8 -4
- package/dist/contracts/entities/chat.js +102 -28
- package/dist/contracts/entities/mcp-connections.d.ts +2 -0
- package/dist/contracts/entities/mcp-connections.js +36 -23
- package/dist/contracts/entities/memories.d.ts +1 -0
- package/dist/contracts/entities/memories.js +5 -3
- package/dist/contracts/entities/merchant.js +28 -9
- package/dist/contracts/entities/prompts.d.ts +2 -2
- package/dist/contracts/entities/prompts.js +42 -15
- package/dist/contracts/entities/providers.js +14 -6
- package/dist/contracts/entities/sessions.d.ts +17 -15
- package/dist/contracts/entities/sessions.js +23 -10
- package/dist/contracts/entities/skills.js +6 -3
- package/dist/contracts/entities/spending-limits.d.ts +0 -23
- package/dist/contracts/entities/spending-limits.js +0 -9
- package/dist/contracts/entities/tasks.d.ts +4 -7
- package/dist/contracts/entities/tasks.js +45 -15
- package/dist/contracts/entities/tenants.d.ts +2 -28
- package/dist/contracts/entities/tenants.js +15 -22
- package/dist/contracts/entities/usage.d.ts +1 -1
- package/dist/contracts/entities/usage.js +16 -6
- package/dist/contracts/entities/workspaces.d.ts +1 -1
- package/dist/contracts/entities/workspaces.js +26 -10
- package/dist/contracts/index.d.ts +20 -15
- package/dist/contracts/index.js +13 -13
- package/dist/contracts/limitations.d.ts +2 -4
- package/dist/contracts/limitations.js +2 -4
- package/dist/direct-chat-transport.js +2 -1
- package/dist/errors.d.ts +11 -0
- package/dist/errors.js +21 -0
- package/dist/http.d.ts +3 -1
- package/dist/http.js +12 -1
- package/dist/index.d.ts +20 -3
- package/dist/resources/agents.d.ts +120 -1
- package/dist/resources/agents.js +1 -33
- package/dist/resources/artifacts.d.ts +42 -1
- package/dist/resources/artifacts.js +0 -12
- package/dist/resources/chat-connections.d.ts +110 -1
- package/dist/resources/chat-connections.js +0 -33
- package/dist/resources/chat-deliveries.d.ts +23 -1
- package/dist/resources/chat-deliveries.js +1 -4
- package/dist/resources/mcp-connections.d.ts +63 -1
- package/dist/resources/mcp-connections.js +3 -21
- package/dist/resources/memories.d.ts +58 -1
- package/dist/resources/memories.js +0 -15
- package/dist/resources/merchant-bindings.d.ts +39 -1
- package/dist/resources/merchant-bindings.js +0 -9
- package/dist/resources/merchant-connection.d.ts +37 -1
- package/dist/resources/merchant-connection.js +1 -13
- package/dist/resources/merchant-usage-events.d.ts +66 -1
- package/dist/resources/merchant-usage-events.js +0 -18
- package/dist/resources/prompts.d.ts +50 -1
- package/dist/resources/prompts.js +0 -15
- package/dist/resources/providers.d.ts +64 -1
- package/dist/resources/providers.js +0 -21
- package/dist/resources/sessions.d.ts +124 -1
- package/dist/resources/sessions.js +5 -36
- package/dist/resources/skills.d.ts +95 -1
- package/dist/resources/skills.js +0 -27
- package/dist/resources/tasks.d.ts +107 -1
- package/dist/resources/tasks.js +0 -30
- package/dist/resources/tenant.d.ts +23 -1
- package/dist/resources/tenant.js +2 -10
- package/dist/resources/usage.d.ts +34 -1
- package/dist/resources/usage.js +2 -15
- package/dist/resources/workspaces.d.ts +50 -1
- package/dist/resources/workspaces.js +0 -15
- package/dist/types.d.ts +12 -1083
- package/package.json +1 -1
|
@@ -10,8 +10,8 @@ export declare const MAX_WORKSPACE_NAME_LENGTH = 80;
|
|
|
10
10
|
export declare const MAX_SKILL_NAME_LENGTH = 64;
|
|
11
11
|
export declare const MAX_SKILL_DESCRIPTION_LENGTH = 1024;
|
|
12
12
|
export declare const MAX_SKILL_COPY_DESTINATIONS = 30;
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
13
|
+
export declare const DEFAULT_RESOURCES_LIST_LIMIT = 50;
|
|
14
|
+
export declare const MAX_RESOURCES_LIST_LIMIT = 100;
|
|
15
15
|
export declare const MAX_PROMPT_TEMPLATE_BYTES: number;
|
|
16
16
|
export declare const MAX_PROMPT_VARIABLES = 10;
|
|
17
17
|
export declare const MAX_PROMPT_NAME_LENGTH = 80;
|
|
@@ -38,8 +38,6 @@ export declare const MAX_MCP_ATTACHMENT_METADATA_KEYS = 32;
|
|
|
38
38
|
export declare const MAX_MCP_ATTACHMENT_METADATA_KEY_LENGTH = 64;
|
|
39
39
|
/** Agents — name ≤ 80, instructions ≤ 3000. */
|
|
40
40
|
export declare const MAX_AGENT_NAME_LENGTH = 80;
|
|
41
|
-
export declare const DEFAULT_AGENTS_LIST_LIMIT = 50;
|
|
42
|
-
export declare const MAX_AGENTS_LIST_LIMIT = 100;
|
|
43
41
|
export declare const MAX_AGENT_INSTRUCTIONS_LENGTH = 3000;
|
|
44
42
|
/** Artifacts — 10 MiB per file. */
|
|
45
43
|
export declare const MAX_ARTIFACT_BYTES: number;
|
|
@@ -10,8 +10,8 @@ export const MAX_WORKSPACE_NAME_LENGTH = 80;
|
|
|
10
10
|
export const MAX_SKILL_NAME_LENGTH = 64;
|
|
11
11
|
export const MAX_SKILL_DESCRIPTION_LENGTH = 1024;
|
|
12
12
|
export const MAX_SKILL_COPY_DESTINATIONS = 30;
|
|
13
|
-
export const
|
|
14
|
-
export const
|
|
13
|
+
export const DEFAULT_RESOURCES_LIST_LIMIT = 50;
|
|
14
|
+
export const MAX_RESOURCES_LIST_LIMIT = 100;
|
|
15
15
|
export const MAX_PROMPT_TEMPLATE_BYTES = 10 * 1024;
|
|
16
16
|
export const MAX_PROMPT_VARIABLES = 10;
|
|
17
17
|
export const MAX_PROMPT_NAME_LENGTH = 80;
|
|
@@ -38,8 +38,6 @@ export const MAX_MCP_ATTACHMENT_METADATA_KEYS = 32;
|
|
|
38
38
|
export const MAX_MCP_ATTACHMENT_METADATA_KEY_LENGTH = 64;
|
|
39
39
|
/** Agents — name ≤ 80, instructions ≤ 3000. */
|
|
40
40
|
export const MAX_AGENT_NAME_LENGTH = 80;
|
|
41
|
-
export const DEFAULT_AGENTS_LIST_LIMIT = 50;
|
|
42
|
-
export const MAX_AGENTS_LIST_LIMIT = 100;
|
|
43
41
|
export const MAX_AGENT_INSTRUCTIONS_LENGTH = 3000;
|
|
44
42
|
/** Artifacts — 10 MiB per file. */
|
|
45
43
|
export const MAX_ARTIFACT_BYTES = 10 * 1024 * 1024;
|
|
@@ -2,6 +2,7 @@ import { lastAssistantMessageIsCompleteWithApprovalResponses, } from "ai";
|
|
|
2
2
|
import { extractApprovalDecisions } from "./approvals.js";
|
|
3
3
|
import { ChatStreamTransport } from "./chat-stream-transport.js";
|
|
4
4
|
import { sessionIdSchema } from "./contracts/ids.js";
|
|
5
|
+
import { parseClientInput } from "./errors.js";
|
|
5
6
|
/** Connects useChat directly to the SDK, including native streaming fetch clients. */
|
|
6
7
|
export class BlazingAgentsDirectChatTransport extends ChatStreamTransport {
|
|
7
8
|
#options;
|
|
@@ -16,7 +17,7 @@ export class BlazingAgentsDirectChatTransport extends ChatStreamTransport {
|
|
|
16
17
|
this.#sessionId =
|
|
17
18
|
options.sessionId === undefined
|
|
18
19
|
? undefined
|
|
19
|
-
: sessionIdSchema
|
|
20
|
+
: parseClientInput(sessionIdSchema, options.sessionId, "sessionId");
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* Submits the supplied user messages directly to the SDK chat endpoint.
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import type { BlazingAgentsErrorCode } from "./types.ts";
|
|
2
3
|
declare const BLAZING_AGENTS_ERROR_SYMBOL: unique symbol;
|
|
3
4
|
export declare class BlazingAgentsError extends Error {
|
|
@@ -39,4 +40,14 @@ export declare class BlazingAgentsError extends Error {
|
|
|
39
40
|
*/
|
|
40
41
|
static isInstance(error: unknown): error is BlazingAgentsError;
|
|
41
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Parses caller input the SDK must check before any request, such as a value
|
|
45
|
+
* that becomes a header or transport state.
|
|
46
|
+
* @param schema - Schema the value must satisfy.
|
|
47
|
+
* @param value - Caller-supplied value.
|
|
48
|
+
* @param param - Name of the caller parameter, reported on the error.
|
|
49
|
+
* @returns The parsed value.
|
|
50
|
+
* @throws BlazingAgentsError - With code `invalid_request` if the value is invalid.
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseClientInput<Schema extends z.ZodType>(schema: Schema, value: unknown, param: string): z.output<Schema>;
|
|
42
53
|
export {};
|
package/dist/errors.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
/**
|
|
2
3
|
* The SDK's single error class. Server codes remain open for forward
|
|
3
4
|
* compatibility; SDK-local codes distinguish transport, response, abort, and
|
|
@@ -53,3 +54,23 @@ export class BlazingAgentsError extends Error {
|
|
|
53
54
|
return BLAZING_AGENTS_ERROR_SYMBOL in error;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Parses caller input the SDK must check before any request, such as a value
|
|
59
|
+
* that becomes a header or transport state.
|
|
60
|
+
* @param schema - Schema the value must satisfy.
|
|
61
|
+
* @param value - Caller-supplied value.
|
|
62
|
+
* @param param - Name of the caller parameter, reported on the error.
|
|
63
|
+
* @returns The parsed value.
|
|
64
|
+
* @throws BlazingAgentsError - With code `invalid_request` if the value is invalid.
|
|
65
|
+
*/
|
|
66
|
+
export function parseClientInput(schema, value, param) {
|
|
67
|
+
const parsed = schema.safeParse(value);
|
|
68
|
+
if (!parsed.success) {
|
|
69
|
+
throw new BlazingAgentsError({
|
|
70
|
+
code: "invalid_request",
|
|
71
|
+
message: `Invalid ${param}: ${z.prettifyError(parsed.error)}`,
|
|
72
|
+
param,
|
|
73
|
+
}, { cause: parsed.error });
|
|
74
|
+
}
|
|
75
|
+
return parsed.data;
|
|
76
|
+
}
|
package/dist/http.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { BlazingAgentsError } from "./errors.ts";
|
|
|
2
2
|
import type { HttpConfig, RequestOptions } from "./types.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Builds an endpoint path, encoding each interpolated value so it stays inside
|
|
5
|
-
* one path segment
|
|
5
|
+
* one path segment. `encodeURIComponent` leaves `.` and `..` unchanged, and
|
|
6
|
+
* URL normalization would resolve them against the parent path, so those and
|
|
7
|
+
* the empty segment are rejected.
|
|
6
8
|
*/
|
|
7
9
|
export declare function apiPath(template: TemplateStringsArray, ...values: string[]): string;
|
|
8
10
|
/**
|
package/dist/http.js
CHANGED
|
@@ -4,11 +4,22 @@ 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
|
+
const DOT_OR_EMPTY_SEGMENTS = new Set(["", ".", ".."]);
|
|
7
8
|
/**
|
|
8
9
|
* Builds an endpoint path, encoding each interpolated value so it stays inside
|
|
9
|
-
* one path segment
|
|
10
|
+
* one path segment. `encodeURIComponent` leaves `.` and `..` unchanged, and
|
|
11
|
+
* URL normalization would resolve them against the parent path, so those and
|
|
12
|
+
* the empty segment are rejected.
|
|
10
13
|
*/
|
|
11
14
|
export function apiPath(template, ...values) {
|
|
15
|
+
for (const value of values) {
|
|
16
|
+
if (DOT_OR_EMPTY_SEGMENTS.has(value)) {
|
|
17
|
+
throw new BlazingAgentsError({
|
|
18
|
+
code: "invalid_request",
|
|
19
|
+
message: `Invalid path segment ${JSON.stringify(value)}.`,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
12
23
|
return String.raw({ raw: template }, ...values.map(encodeURIComponent));
|
|
13
24
|
}
|
|
14
25
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -17,10 +17,10 @@ export type { CreateMerchantConnectionBody, MerchantBindingResponse, MerchantBin
|
|
|
17
17
|
export type { CreatePromptBody, PromptResponse, PromptsListQuery, PromptsResponse, UpdatePromptBody, } from "./contracts/entities/prompts.ts";
|
|
18
18
|
export type { CreateProviderBody, ProviderListItem, ProviderModel, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ProviderType, ThinkingLevelsResponse, UpdateProviderBody, } from "./contracts/entities/providers.ts";
|
|
19
19
|
export type { ChatSteerConsumedEvent, SessionActivity, SessionInput, SessionInputResponse, SessionInputState, SessionInputsQuery, SessionInputsResponse, StopSessionBody, StopSessionResponse, SubmitSessionInputBody, } from "./contracts/entities/session-inputs.ts";
|
|
20
|
-
export type { ContinueToolApprovalsBody, SessionForkedFrom, SessionResponse, ToolApprovalDecision, ToolApprovalState, ToolApprovalsResponse,
|
|
20
|
+
export type { ContinueToolApprovalsBody, SessionForkedFrom, SessionResponse, ToolApprovalDecision, ToolApprovalState, ToolApprovalsResponse, TurnStreamErrorEvent, } from "./contracts/entities/sessions.ts";
|
|
21
21
|
export { sessionResponseSchema } from "./contracts/entities/sessions.ts";
|
|
22
22
|
export type { CreateSkillBody, Skill, SkillArchiveType, SkillCopyResult, SkillCopyResults, SkillDetail, SkillFile, SkillsListResponse, } from "./contracts/entities/skills.ts";
|
|
23
|
-
export type { SpendingLimit, SpendingLimitResponse, SpendingLimitStopDetails,
|
|
23
|
+
export type { SpendingLimit, SpendingLimitResponse, SpendingLimitStopDetails, UpdateSpendingLimitBody, } from "./contracts/entities/spending-limits.ts";
|
|
24
24
|
export { nextSpendingLimitReset } from "./contracts/entities/spending-limits.ts";
|
|
25
25
|
export type { SessionUsageQuery, SessionUsageResponse, UsageBucket, UsageOverviewQuery, UsageOverviewResponse, UsageTotals, } from "./contracts/entities/usage.ts";
|
|
26
26
|
export type { CreateWorkspaceBody, UpdateWorkspaceBody, Workspace, WorkspaceNetworkPolicy, WorkspacesListResponse, WorkspaceTier, } from "./contracts/entities/workspaces.ts";
|
|
@@ -28,4 +28,21 @@ export { BlazingAgentsDirectChatTransport, type BlazingAgentsDirectChatTransport
|
|
|
28
28
|
export { BlazingAgentsError } from "./errors.ts";
|
|
29
29
|
export { type ChatFunction, type ChatFunctionContext, type ChatFunctions, defineFunction, } from "./functions.ts";
|
|
30
30
|
export { createChatRelay, createCompletionRelay, type RelayContext, type SessionOwnershipStore, } from "./relay.ts";
|
|
31
|
-
export type {
|
|
31
|
+
export type { AgentsListOptions, AgentsResource, UserAgentsResource, } from "./resources/agents.ts";
|
|
32
|
+
export type { ArtifactsResource } from "./resources/artifacts.ts";
|
|
33
|
+
export type { ChatConnectionsResource } from "./resources/chat-connections.ts";
|
|
34
|
+
export type { ChatDeliveriesListOptions, ChatDeliveriesResource, } from "./resources/chat-deliveries.ts";
|
|
35
|
+
export type { McpConnectionsResource } from "./resources/mcp-connections.ts";
|
|
36
|
+
export type { MemoriesListOptions, MemoriesResource, } from "./resources/memories.ts";
|
|
37
|
+
export type { MerchantBindingsListOptions, MerchantBindingsResource, } from "./resources/merchant-bindings.ts";
|
|
38
|
+
export type { MerchantConnectionResource } from "./resources/merchant-connection.ts";
|
|
39
|
+
export type { MerchantUsageEventsListOptions, MerchantUsageEventsResource, } from "./resources/merchant-usage-events.ts";
|
|
40
|
+
export type { PromptsResource } from "./resources/prompts.ts";
|
|
41
|
+
export type { ProvidersResource } from "./resources/providers.ts";
|
|
42
|
+
export type { LatestSessionsListOptions, SessionsResource, } from "./resources/sessions.ts";
|
|
43
|
+
export type { AgentSkillsResource, SkillsListOptions, } from "./resources/skills.ts";
|
|
44
|
+
export type { TasksResource } from "./resources/tasks.ts";
|
|
45
|
+
export type { TenantResource } from "./resources/tenant.ts";
|
|
46
|
+
export type { UsageResource } from "./resources/usage.ts";
|
|
47
|
+
export type { WorkspacesListOptions, WorkspacesResource, } from "./resources/workspaces.ts";
|
|
48
|
+
export type { AgentClient, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, BlazingAgentsUIMessageData, ChatInput, ChatMessageInput, ChatMessagesInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, ContinueChatInput, KnownBlazingAgentsErrorCode, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, ResourceRequestOptions, ResponseObservation, TerminalStreamResult, UserClient, } from "./types.ts";
|
|
@@ -1,4 +1,123 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Agent, type AgentsResponse, type CreateAgentBody, type UpdateAgentBody } from "../contracts/entities/agents.ts";
|
|
2
|
+
import { type McpAttachmentResponse, type McpAttachmentsResponse, type UpdateMcpAttachmentBody } from "../contracts/entities/mcp-connections.ts";
|
|
3
|
+
import { type SpendingLimitResponse, type UpdateSpendingLimitBody } from "../contracts/entities/spending-limits.ts";
|
|
4
|
+
import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
|
|
5
|
+
/** Agent operations on a user-scoped client, which has no spending limits. */
|
|
6
|
+
export type UserAgentsResource = Omit<AgentsResource, "getSpendingLimit" | "updateSpendingLimit">;
|
|
7
|
+
export interface AgentsResource {
|
|
8
|
+
/**
|
|
9
|
+
* Creates the Agent. Omitting `workspaceId` creates a Core Workspace by default. `workspaceTier` selects its immutable tier and conflicts with `workspaceId`.
|
|
10
|
+
* @param input - creation fields; optional abortSignal.
|
|
11
|
+
* @returns The agent.
|
|
12
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
13
|
+
*/
|
|
14
|
+
create(input: CreateAgentBody & ResourceRequestOptions): Promise<Agent>;
|
|
15
|
+
/**
|
|
16
|
+
* Deletes the Agent while preserving its attached Workspace.
|
|
17
|
+
* @param input - `agentId`; optional abortSignal; includeArtifacts controls Artifact deletion.
|
|
18
|
+
* @returns Resolves when the operation completes.
|
|
19
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
20
|
+
*/
|
|
21
|
+
delete(input: {
|
|
22
|
+
agentId: string;
|
|
23
|
+
includeArtifacts: boolean;
|
|
24
|
+
} & ResourceRequestOptions): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Disables the Agent.
|
|
27
|
+
* @param input - `agentId`; optional abortSignal.
|
|
28
|
+
* @returns The agent.
|
|
29
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
30
|
+
*/
|
|
31
|
+
disable(input: {
|
|
32
|
+
agentId: string;
|
|
33
|
+
} & ResourceRequestOptions): Promise<Agent>;
|
|
34
|
+
/**
|
|
35
|
+
* Enables the Agent.
|
|
36
|
+
* @param input - `agentId`; optional abortSignal.
|
|
37
|
+
* @returns The agent.
|
|
38
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
39
|
+
*/
|
|
40
|
+
enable(input: {
|
|
41
|
+
agentId: string;
|
|
42
|
+
} & ResourceRequestOptions): Promise<Agent>;
|
|
43
|
+
/**
|
|
44
|
+
* Retrieves the Agent.
|
|
45
|
+
* @param input - `agentId`; optional abortSignal.
|
|
46
|
+
* @returns The agent.
|
|
47
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
48
|
+
*/
|
|
49
|
+
get(input: {
|
|
50
|
+
agentId: string;
|
|
51
|
+
} & ResourceRequestOptions): Promise<Agent>;
|
|
52
|
+
/** Retrieves the Agent model spending limit. Requires tenant authority. */
|
|
53
|
+
getSpendingLimit(input: {
|
|
54
|
+
agentId: string;
|
|
55
|
+
} & ResourceRequestOptions): Promise<SpendingLimitResponse>;
|
|
56
|
+
/**
|
|
57
|
+
* Lists available Agent records.
|
|
58
|
+
* @param input - filters and pagination options.
|
|
59
|
+
* @returns Matching Agents. This response has no pagination cursor.
|
|
60
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
61
|
+
*/
|
|
62
|
+
list(input?: AgentsListOptions): Promise<AgentsResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* Lists the Agent MCP attachments.
|
|
65
|
+
* @param input - `agentId`; optional abortSignal.
|
|
66
|
+
* @returns The mcp attachments response.
|
|
67
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
68
|
+
*/
|
|
69
|
+
listMcpAttachments(input: {
|
|
70
|
+
agentId: string;
|
|
71
|
+
} & ResourceRequestOptions): Promise<McpAttachmentsResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* Removes the Agent avatar.
|
|
74
|
+
* @param input - `agentId`; optional abortSignal.
|
|
75
|
+
* @returns The agent.
|
|
76
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
77
|
+
*/
|
|
78
|
+
removeAvatar(input: {
|
|
79
|
+
agentId: string;
|
|
80
|
+
} & ResourceRequestOptions): Promise<Agent>;
|
|
81
|
+
/**
|
|
82
|
+
* Updates the Agent. A concrete `workspaceId` switches the Agent; detachment is unsupported.
|
|
83
|
+
* @param input - `agentId`; fields to change; optional abortSignal.
|
|
84
|
+
* @returns The agent.
|
|
85
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
86
|
+
*/
|
|
87
|
+
update(input: UpdateAgentBody & {
|
|
88
|
+
agentId: string;
|
|
89
|
+
} & ResourceRequestOptions): Promise<Agent>;
|
|
90
|
+
/**
|
|
91
|
+
* Updates one Agent MCP attachment.
|
|
92
|
+
* @param input - `agentId`, `mcpConnectionId`; fields to change; optional abortSignal.
|
|
93
|
+
* @returns The mcp attachment response.
|
|
94
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
95
|
+
*/
|
|
96
|
+
updateMcpAttachment(input: UpdateMcpAttachmentBody & {
|
|
97
|
+
agentId: string;
|
|
98
|
+
mcpConnectionId: string;
|
|
99
|
+
} & ResourceRequestOptions): Promise<McpAttachmentResponse>;
|
|
100
|
+
/** Sets the Agent model spending limit. Pass null to disable it. Requires tenant authority. */
|
|
101
|
+
updateSpendingLimit(input: UpdateSpendingLimitBody & {
|
|
102
|
+
agentId: string;
|
|
103
|
+
} & ResourceRequestOptions): Promise<SpendingLimitResponse>;
|
|
104
|
+
/**
|
|
105
|
+
* Uploads an Agent avatar as multipart form data.
|
|
106
|
+
* @param input - Target `agentId`, image `file`, and optional abortSignal.
|
|
107
|
+
* @returns The agent.
|
|
108
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
109
|
+
*/
|
|
110
|
+
uploadAvatar(input: {
|
|
111
|
+
agentId: string;
|
|
112
|
+
file: File;
|
|
113
|
+
} & ResourceRequestOptions): Promise<Agent>;
|
|
114
|
+
}
|
|
115
|
+
export interface AgentsListOptions extends ResourceRequestOptions {
|
|
116
|
+
cursor?: string;
|
|
117
|
+
limit?: number;
|
|
118
|
+
userId?: string;
|
|
119
|
+
workspaceId?: string;
|
|
120
|
+
}
|
|
2
121
|
/**
|
|
3
122
|
* Builds the Agents operations, including the spending limits that need tenant authority.
|
|
4
123
|
* @param config - Shared authentication and transport configuration.
|
package/dist/resources/agents.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { agentResponseSchema, agentsResponseSchema, } from "../contracts/entities/agents.js";
|
|
2
2
|
import { mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, } from "../contracts/entities/mcp-connections.js";
|
|
3
|
-
import { spendingLimitResponseSchema } from "../contracts/entities/spending-limits.js";
|
|
3
|
+
import { spendingLimitResponseSchema, } from "../contracts/entities/spending-limits.js";
|
|
4
4
|
import { apiPath, requestJson } from "../http.js";
|
|
5
5
|
/**
|
|
6
6
|
* Builds the Agents operations, including the spending limits that need tenant authority.
|
|
@@ -10,11 +10,9 @@ import { apiPath, requestJson } from "../http.js";
|
|
|
10
10
|
export function createAgentsResource(config) {
|
|
11
11
|
return {
|
|
12
12
|
...createUserAgentsResource(config),
|
|
13
|
-
/** Retrieves the model spending limit using tenant authority. */
|
|
14
13
|
async getSpendingLimit({ agentId, abortSignal }) {
|
|
15
14
|
return await requestJson(config, apiPath `/v1/agents/${agentId}/spending-limit`, { signal: abortSignal }, spendingLimitResponseSchema);
|
|
16
15
|
},
|
|
17
|
-
/** Sets the model spending limit. Null disables it. Requires tenant authority. */
|
|
18
16
|
async updateSpendingLimit({ agentId, abortSignal, ...body }) {
|
|
19
17
|
return await requestJson(config, apiPath `/v1/agents/${agentId}/spending-limit`, { method: "PUT", json: body, signal: abortSignal }, spendingLimitResponseSchema);
|
|
20
18
|
},
|
|
@@ -35,9 +33,6 @@ export function createUserAgentsResource(config) {
|
|
|
35
33
|
method: "PUT",
|
|
36
34
|
}, agentResponseSchema);
|
|
37
35
|
return {
|
|
38
|
-
/**
|
|
39
|
-
* Creates agents.
|
|
40
|
-
*/
|
|
41
36
|
async create({ abortSignal, ...body }) {
|
|
42
37
|
return await requestJson(config, "/v1/agents", {
|
|
43
38
|
json: body,
|
|
@@ -45,9 +40,6 @@ export function createUserAgentsResource(config) {
|
|
|
45
40
|
method: "POST",
|
|
46
41
|
}, agentResponseSchema);
|
|
47
42
|
},
|
|
48
|
-
/**
|
|
49
|
-
* Lists one page of agents.
|
|
50
|
-
*/
|
|
51
43
|
async list(options = {}) {
|
|
52
44
|
return await requestJson(config, "/v1/agents", {
|
|
53
45
|
signal: options.abortSignal,
|
|
@@ -59,40 +51,22 @@ export function createUserAgentsResource(config) {
|
|
|
59
51
|
},
|
|
60
52
|
}, agentsResponseSchema);
|
|
61
53
|
},
|
|
62
|
-
/**
|
|
63
|
-
* Retrieves agents.
|
|
64
|
-
*/
|
|
65
54
|
async get({ agentId, abortSignal }) {
|
|
66
55
|
return await requestJson(config, apiPath `/v1/agents/${agentId}`, { signal: abortSignal }, agentResponseSchema);
|
|
67
56
|
},
|
|
68
|
-
/**
|
|
69
|
-
* Disables agents.
|
|
70
|
-
*/
|
|
71
57
|
async disable({ agentId, abortSignal }) {
|
|
72
58
|
return await requestJson(config, apiPath `/v1/agents/${agentId}/disable`, { method: "POST", signal: abortSignal }, agentResponseSchema);
|
|
73
59
|
},
|
|
74
|
-
/**
|
|
75
|
-
* Enables agents.
|
|
76
|
-
*/
|
|
77
60
|
async enable({ agentId, abortSignal }) {
|
|
78
61
|
return await requestJson(config, apiPath `/v1/agents/${agentId}/enable`, { method: "POST", signal: abortSignal }, agentResponseSchema);
|
|
79
62
|
},
|
|
80
|
-
/**
|
|
81
|
-
* Lists the Agent MCP attachments.
|
|
82
|
-
*/
|
|
83
63
|
async listMcpAttachments({ agentId, abortSignal }) {
|
|
84
64
|
return await requestJson(config, apiPath `/v1/agents/${agentId}/mcp-attachments`, { signal: abortSignal }, mcpAttachmentsResponseSchema);
|
|
85
65
|
},
|
|
86
66
|
update,
|
|
87
|
-
/**
|
|
88
|
-
* Updates one Agent MCP attachment.
|
|
89
|
-
*/
|
|
90
67
|
async updateMcpAttachment({ agentId, mcpConnectionId, abortSignal, ...body }) {
|
|
91
68
|
return await requestJson(config, apiPath `/v1/agents/${agentId}/mcp-attachments/${mcpConnectionId}`, { json: body, method: "PATCH", signal: abortSignal }, mcpAttachmentResponseSchema);
|
|
92
69
|
},
|
|
93
|
-
/**
|
|
94
|
-
* Deletes agents.
|
|
95
|
-
*/
|
|
96
70
|
async delete({ agentId, includeArtifacts, abortSignal }) {
|
|
97
71
|
await requestJson(config, apiPath `/v1/agents/${agentId}`, {
|
|
98
72
|
method: "DELETE",
|
|
@@ -100,9 +74,6 @@ export function createUserAgentsResource(config) {
|
|
|
100
74
|
signal: abortSignal,
|
|
101
75
|
});
|
|
102
76
|
},
|
|
103
|
-
/**
|
|
104
|
-
* Uploads an Agent avatar as multipart form data.
|
|
105
|
-
*/
|
|
106
77
|
async uploadAvatar({ agentId, file, abortSignal }) {
|
|
107
78
|
const form = new FormData();
|
|
108
79
|
form.append("file", file);
|
|
@@ -112,9 +83,6 @@ export function createUserAgentsResource(config) {
|
|
|
112
83
|
method: "POST",
|
|
113
84
|
}, agentResponseSchema);
|
|
114
85
|
},
|
|
115
|
-
/**
|
|
116
|
-
* Removes the Agent avatar.
|
|
117
|
-
*/
|
|
118
86
|
async removeAvatar({ agentId, abortSignal }) {
|
|
119
87
|
return await requestJson(config, apiPath `/v1/agents/${agentId}/avatar`, { method: "DELETE", signal: abortSignal }, agentResponseSchema);
|
|
120
88
|
},
|
|
@@ -1,4 +1,45 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ArtifactDownloadUrlResponse, type ArtifactListItem, type ArtifactsListResponse } from "../contracts/entities/artifacts.ts";
|
|
2
|
+
import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
|
|
3
|
+
export interface ArtifactsListOptions extends ResourceRequestOptions {
|
|
4
|
+
agentId?: string;
|
|
5
|
+
cursor?: string;
|
|
6
|
+
sessionId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ArtifactsResource {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a temporary Artifact download URL.
|
|
11
|
+
* @param input - `artifactId`; optional abortSignal.
|
|
12
|
+
* @returns The artifact download url response.
|
|
13
|
+
*/
|
|
14
|
+
createDownloadUrl(input: {
|
|
15
|
+
artifactId: string;
|
|
16
|
+
} & ResourceRequestOptions): Promise<ArtifactDownloadUrlResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Deletes the Artifact.
|
|
19
|
+
* @param input - `artifactId`; optional abortSignal.
|
|
20
|
+
* @returns Resolves when the operation completes.
|
|
21
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
22
|
+
*/
|
|
23
|
+
delete(input: {
|
|
24
|
+
artifactId: string;
|
|
25
|
+
} & ResourceRequestOptions): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves the Artifact.
|
|
28
|
+
* @param input - `artifactId`; optional abortSignal.
|
|
29
|
+
* @returns The artifact list item.
|
|
30
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
31
|
+
*/
|
|
32
|
+
get(input: {
|
|
33
|
+
artifactId: string;
|
|
34
|
+
} & ResourceRequestOptions): Promise<ArtifactListItem>;
|
|
35
|
+
/**
|
|
36
|
+
* Lists one page of Artifact records.
|
|
37
|
+
* @param input - filters and pagination options.
|
|
38
|
+
* @returns The artifacts list response.
|
|
39
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
40
|
+
*/
|
|
41
|
+
list(input?: ArtifactsListOptions): Promise<ArtifactsListResponse>;
|
|
42
|
+
}
|
|
2
43
|
/**
|
|
3
44
|
* `client.artifacts` — Tenant-level metadata and direct download URLs.
|
|
4
45
|
* @param config - Shared authentication and transport configuration.
|
|
@@ -7,21 +7,12 @@ import { apiPath, requestJson } from "../http.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export function createArtifactsResource(config) {
|
|
9
9
|
return {
|
|
10
|
-
/**
|
|
11
|
-
* Creates a temporary Artifact download URL.
|
|
12
|
-
*/
|
|
13
10
|
async createDownloadUrl({ artifactId, abortSignal }) {
|
|
14
11
|
return await requestJson(config, apiPath `/v1/artifacts/${artifactId}/download-url`, { method: "POST", signal: abortSignal }, artifactDownloadUrlResponseSchema);
|
|
15
12
|
},
|
|
16
|
-
/**
|
|
17
|
-
* Retrieves artifacts.
|
|
18
|
-
*/
|
|
19
13
|
async get({ artifactId, abortSignal }) {
|
|
20
14
|
return await requestJson(config, apiPath `/v1/artifacts/${artifactId}`, { signal: abortSignal }, artifactListItemSchema);
|
|
21
15
|
},
|
|
22
|
-
/**
|
|
23
|
-
* Lists one page of artifacts.
|
|
24
|
-
*/
|
|
25
16
|
async list({ abortSignal, ...options } = {}) {
|
|
26
17
|
return await requestJson(config, "/v1/artifacts", {
|
|
27
18
|
signal: abortSignal,
|
|
@@ -32,9 +23,6 @@ export function createArtifactsResource(config) {
|
|
|
32
23
|
},
|
|
33
24
|
}, artifactsListResponseSchema);
|
|
34
25
|
},
|
|
35
|
-
/**
|
|
36
|
-
* Deletes artifacts.
|
|
37
|
-
*/
|
|
38
26
|
async delete({ artifactId, abortSignal }) {
|
|
39
27
|
await requestJson(config, apiPath `/v1/artifacts/${artifactId}`, {
|
|
40
28
|
method: "DELETE",
|
|
@@ -1,4 +1,113 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ChatConnection, type ChatConnectionsResponse, type ChatDeliveryList, type ChatDeliveryResult, type CreateChatConnectionBody, type RepairChatDeliveryBody, type RotateChatConnectionBody, type UpdateChatConnectionBody } from "../contracts/entities/chat-connections.ts";
|
|
2
|
+
import type { HttpConfig, ResourceRequestOptions } from "../types.ts";
|
|
3
|
+
export interface ChatConnectionsResource {
|
|
4
|
+
/**
|
|
5
|
+
* Checks the Chat Connection health.
|
|
6
|
+
* @param input - `chatConnectionId`; optional abortSignal.
|
|
7
|
+
* @returns The chat connection.
|
|
8
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
9
|
+
*/
|
|
10
|
+
checkHealth(input: {
|
|
11
|
+
chatConnectionId: string;
|
|
12
|
+
} & ResourceRequestOptions): Promise<ChatConnection>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates the Chat Connection.
|
|
15
|
+
* @param input - creation fields; optional abortSignal.
|
|
16
|
+
* @returns The chat connection.
|
|
17
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
18
|
+
*/
|
|
19
|
+
create(input: CreateChatConnectionBody & ResourceRequestOptions): Promise<ChatConnection>;
|
|
20
|
+
/**
|
|
21
|
+
* Deletes the Chat Connection.
|
|
22
|
+
* @param input - `chatConnectionId`; optional abortSignal.
|
|
23
|
+
* @returns Resolves when the operation completes.
|
|
24
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
25
|
+
*/
|
|
26
|
+
delete(input: {
|
|
27
|
+
chatConnectionId: string;
|
|
28
|
+
} & ResourceRequestOptions): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Disables the Chat Connection.
|
|
31
|
+
* @param input - `chatConnectionId`; optional abortSignal.
|
|
32
|
+
* @returns The chat connection.
|
|
33
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
34
|
+
*/
|
|
35
|
+
disable(input: {
|
|
36
|
+
chatConnectionId: string;
|
|
37
|
+
} & ResourceRequestOptions): Promise<ChatConnection>;
|
|
38
|
+
/**
|
|
39
|
+
* Enables the Chat Connection.
|
|
40
|
+
* @param input - `chatConnectionId`; optional abortSignal.
|
|
41
|
+
* @returns The chat connection.
|
|
42
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
43
|
+
*/
|
|
44
|
+
enable(input: {
|
|
45
|
+
chatConnectionId: string;
|
|
46
|
+
} & ResourceRequestOptions): Promise<ChatConnection>;
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves the Chat Connection.
|
|
49
|
+
* @param input - `chatConnectionId`; optional abortSignal.
|
|
50
|
+
* @returns The chat connection.
|
|
51
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
52
|
+
*/
|
|
53
|
+
get(input: {
|
|
54
|
+
chatConnectionId: string;
|
|
55
|
+
} & ResourceRequestOptions): Promise<ChatConnection>;
|
|
56
|
+
/**
|
|
57
|
+
* Lists available Chat Connection records.
|
|
58
|
+
* @param input - optional abortSignal.
|
|
59
|
+
* @returns The chat connections response.
|
|
60
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
61
|
+
*/
|
|
62
|
+
list(input?: ResourceRequestOptions): Promise<ChatConnectionsResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* Lists one page of the replies and approval cards the Chat Connection has
|
|
65
|
+
* sent or tried to send, newest first, in every status. Pass `nextCursor`
|
|
66
|
+
* as `cursor` to fetch older records.
|
|
67
|
+
* @param input - `chatConnectionId`; optional `cursor`, `limit` (1 to 100, default 100), and abortSignal.
|
|
68
|
+
* @returns The page of chat deliveries.
|
|
69
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
70
|
+
*/
|
|
71
|
+
listDeliveries(input: {
|
|
72
|
+
chatConnectionId: string;
|
|
73
|
+
cursor?: string;
|
|
74
|
+
limit?: number;
|
|
75
|
+
} & ResourceRequestOptions): Promise<ChatDeliveryList>;
|
|
76
|
+
/**
|
|
77
|
+
* Sends a stuck reply or approval card again, without running a turn or
|
|
78
|
+
* tool. Use it when the previous send stopped before its outcome was known.
|
|
79
|
+
* Pass the delivery's current `attempt` as `expectedAttempt`; the repair is
|
|
80
|
+
* refused if it has changed. `previousSenderStopped` and
|
|
81
|
+
* `acceptDuplicateRisk` must be `true`: the message can appear twice. The
|
|
82
|
+
* connection must be enabled. Check `status` in the result, because a
|
|
83
|
+
* successful request does not by itself mean the message was delivered.
|
|
84
|
+
* @param input - `chatConnectionId`, `deliveryId`, the repair confirmations, and optional abortSignal.
|
|
85
|
+
* @returns The delivery outcome.
|
|
86
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
87
|
+
*/
|
|
88
|
+
repairDelivery(input: RepairChatDeliveryBody & {
|
|
89
|
+
chatConnectionId: string;
|
|
90
|
+
deliveryId: string;
|
|
91
|
+
} & ResourceRequestOptions): Promise<ChatDeliveryResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Replaces the Chat Connection credentials.
|
|
94
|
+
* @param input - `chatConnectionId`; fields to change; optional abortSignal.
|
|
95
|
+
* @returns The chat connection.
|
|
96
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
97
|
+
*/
|
|
98
|
+
rotateCredentials(input: RotateChatConnectionBody & {
|
|
99
|
+
chatConnectionId: string;
|
|
100
|
+
} & ResourceRequestOptions): Promise<ChatConnection>;
|
|
101
|
+
/**
|
|
102
|
+
* Updates the Chat Connection.
|
|
103
|
+
* @param input - `chatConnectionId`; fields to change; optional abortSignal.
|
|
104
|
+
* @returns The chat connection.
|
|
105
|
+
* @throws BlazingAgentsError - If the request fails, is aborted, or returns an invalid response.
|
|
106
|
+
*/
|
|
107
|
+
update(input: UpdateChatConnectionBody & {
|
|
108
|
+
chatConnectionId: string;
|
|
109
|
+
} & ResourceRequestOptions): Promise<ChatConnection>;
|
|
110
|
+
}
|
|
2
111
|
/**
|
|
3
112
|
* Builds the Chat Connections operations using the shared HTTP configuration.
|
|
4
113
|
* @param config - Shared authentication and transport configuration.
|