@blazingagents/sdk 0.2.0 → 0.2.2
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 +99 -344
- package/dist/contracts/api.d.ts +1 -1
- package/dist/contracts/api.js +1 -1
- package/dist/contracts/entities/agents.d.ts +14 -7
- package/dist/contracts/entities/agents.js +7 -3
- package/dist/contracts/entities/artifacts.d.ts +9 -9
- package/dist/contracts/entities/artifacts.js +5 -5
- package/dist/contracts/entities/chat.d.ts +7 -7
- package/dist/contracts/entities/chat.js +5 -5
- package/dist/contracts/entities/mcp-connections.d.ts +18 -18
- package/dist/contracts/entities/mcp-connections.js +13 -13
- package/dist/contracts/entities/memories.d.ts +5 -5
- package/dist/contracts/entities/memories.js +2 -2
- package/dist/contracts/entities/prompts.d.ts +4 -4
- package/dist/contracts/entities/prompts.js +2 -2
- package/dist/contracts/entities/providers.d.ts +12 -7
- package/dist/contracts/entities/providers.js +12 -6
- package/dist/contracts/entities/sessions.d.ts +10 -10
- package/dist/contracts/entities/sessions.js +6 -6
- package/dist/contracts/entities/skills.d.ts +18 -18
- package/dist/contracts/entities/skills.js +6 -6
- package/dist/contracts/entities/tasks.d.ts +56 -46
- package/dist/contracts/entities/tasks.js +25 -16
- package/dist/contracts/entities/tenants.d.ts +6 -6
- package/dist/contracts/entities/tenants.js +4 -4
- package/dist/contracts/entities/usage.d.ts +5 -5
- package/dist/contracts/entities/usage.js +3 -3
- package/dist/contracts/entities/workspaces.d.ts +9 -9
- package/dist/contracts/entities/workspaces.js +7 -2
- package/dist/contracts/index.d.ts +6 -4
- package/dist/contracts/index.js +4 -4
- package/dist/direct-chat-transport.d.ts +16 -0
- package/dist/direct-chat-transport.js +49 -0
- package/dist/generation.js +1 -0
- package/dist/http.d.ts +2 -0
- package/dist/http.js +2 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -0
- package/dist/resources/agents.js +11 -6
- package/dist/resources/artifacts.js +3 -2
- package/dist/resources/mcp-connections.js +4 -4
- package/dist/resources/memories.js +3 -2
- package/dist/resources/prompts.js +4 -3
- package/dist/resources/providers.js +10 -7
- package/dist/resources/sessions.js +4 -2
- package/dist/resources/skills.js +18 -10
- package/dist/resources/tasks.js +10 -5
- package/dist/resources/tenant.js +2 -2
- package/dist/resources/usage.js +4 -3
- package/dist/resources/workspaces.js +3 -2
- package/dist/types.d.ts +39 -33
- package/package.json +2 -2
|
@@ -21,15 +21,15 @@ export declare const workspaceSchema: z.ZodObject<{
|
|
|
21
21
|
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
22
22
|
networkPolicy: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
23
23
|
mode: z.ZodLiteral<"unrestricted">;
|
|
24
|
-
}, z.core.$
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
25
|
allowedHosts: z.ZodArray<z.ZodString>;
|
|
26
26
|
mode: z.ZodLiteral<"allowlist">;
|
|
27
|
-
}, z.core.$
|
|
27
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
28
28
|
mode: z.ZodLiteral<"offline">;
|
|
29
|
-
}, z.core.$
|
|
29
|
+
}, z.core.$strip>], "mode">;
|
|
30
30
|
createdAt: z.ZodISODateTime;
|
|
31
31
|
updatedAt: z.ZodISODateTime;
|
|
32
|
-
}, z.core.$
|
|
32
|
+
}, z.core.$strip>;
|
|
33
33
|
export declare const createWorkspaceBodySchema: z.ZodObject<{
|
|
34
34
|
name: z.ZodOptional<z.ZodString>;
|
|
35
35
|
userId: z.ZodDefault<z.ZodString>;
|
|
@@ -69,17 +69,17 @@ export declare const workspacesListResponseSchema: z.ZodObject<{
|
|
|
69
69
|
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
70
70
|
networkPolicy: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
71
71
|
mode: z.ZodLiteral<"unrestricted">;
|
|
72
|
-
}, z.core.$
|
|
72
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
73
73
|
allowedHosts: z.ZodArray<z.ZodString>;
|
|
74
74
|
mode: z.ZodLiteral<"allowlist">;
|
|
75
|
-
}, z.core.$
|
|
75
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
76
76
|
mode: z.ZodLiteral<"offline">;
|
|
77
|
-
}, z.core.$
|
|
77
|
+
}, z.core.$strip>], "mode">;
|
|
78
78
|
createdAt: z.ZodISODateTime;
|
|
79
79
|
updatedAt: z.ZodISODateTime;
|
|
80
|
-
}, z.core.$
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
81
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
82
|
-
}, z.core.$
|
|
82
|
+
}, z.core.$strip>;
|
|
83
83
|
export type Workspace = z.infer<typeof workspaceSchema>;
|
|
84
84
|
export type WorkspaceBackup = z.infer<typeof workspaceBackupSchema>;
|
|
85
85
|
export type WorkspaceNetworkPolicy = z.infer<typeof workspaceNetworkPolicySchema>;
|
|
@@ -26,6 +26,11 @@ export const workspaceNetworkPolicySchema = z.discriminatedUnion("mode", [
|
|
|
26
26
|
.strict(),
|
|
27
27
|
z.object({ mode: z.literal("offline") }).strict(),
|
|
28
28
|
]);
|
|
29
|
+
const workspaceNetworkPolicyResponseSchema = z.discriminatedUnion("mode", [
|
|
30
|
+
workspaceNetworkPolicySchema.options[0].strip(),
|
|
31
|
+
workspaceNetworkPolicySchema.options[1].strip(),
|
|
32
|
+
workspaceNetworkPolicySchema.options[2].strip(),
|
|
33
|
+
]);
|
|
29
34
|
export const workspaceSchema = z
|
|
30
35
|
.object({
|
|
31
36
|
id: workspaceIdSchema,
|
|
@@ -33,11 +38,11 @@ export const workspaceSchema = z
|
|
|
33
38
|
name: workspaceNameSchema.nullable(),
|
|
34
39
|
userId: userIdSchema,
|
|
35
40
|
metadata: metadataSchema,
|
|
36
|
-
networkPolicy:
|
|
41
|
+
networkPolicy: workspaceNetworkPolicyResponseSchema,
|
|
37
42
|
createdAt: z.iso.datetime({ offset: true }),
|
|
38
43
|
updatedAt: z.iso.datetime({ offset: true }),
|
|
39
44
|
})
|
|
40
|
-
.
|
|
45
|
+
.strip();
|
|
41
46
|
export const createWorkspaceBodySchema = z
|
|
42
47
|
.object({
|
|
43
48
|
name: workspaceNameSchema.optional(),
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
export { receivedApiErrorResponseSchema } from "./api.ts";
|
|
3
3
|
export { agentResponseSchema, agentSchema, agentStatusSchema, agentsResponseSchema, agentVersionSchema, agentVersionsResponseSchema, createAgentBodySchema, updateAgentBodySchema, } from "./entities/agents.ts";
|
|
4
4
|
export { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsListResponseSchema, } from "./entities/artifacts.ts";
|
|
5
|
-
export { attributionCreateInputSchema } from "./entities/attribution.ts";
|
|
6
|
-
export {
|
|
5
|
+
export { attributionCreateInputSchema, metadataSchema, } from "./entities/attribution.ts";
|
|
6
|
+
export type { PromptVariables, UsageSummary } from "./entities/chat.ts";
|
|
7
|
+
export { blazingAgentsChatMessageMetadataSchema, chatModeSchema, chatRequestBodySchema, chatTriggerSchema, generationRequestBodySchema, jsonSchemaShapeSchema, promptVariablesSchema, usageSummarySchema, } from "./entities/chat.ts";
|
|
7
8
|
export { approveMcpOauthAuthorizationBodySchema, createMcpConnectionBodySchema, mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, mcpConnectionAuthTypeSchema, mcpConnectionOauthConnectResponseSchema, mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionStatusSchema, mcpConnectionsResponseSchema, mcpConnectionTestErrorCodeSchema, mcpConnectionTestResponseSchema, mcpOauthAuthorizationLaunchResponseSchema, reconnectMcpConnectionBodySchema, updateMcpAttachmentBodySchema, updateMcpConnectionBodySchema, } from "./entities/mcp-connections.ts";
|
|
8
9
|
export { createMemoryBodySchema, memoriesListResponseSchema, memoryResponseSchema, memorySchema, updateMemoryBodySchema, } from "./entities/memories.ts";
|
|
9
10
|
export { createPromptBodySchema, promptResponseSchema, promptSchema, promptsResponseSchema, updatePromptBodySchema, } from "./entities/prompts.ts";
|
|
10
|
-
export { createProviderBodySchema, providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, providerTypeSchema, updateProviderBodySchema, } from "./entities/providers.ts";
|
|
11
|
+
export { createProviderBodySchema, providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, providerTypeSchema, thinkingLevelsResponseSchema, updateProviderBodySchema, } from "./entities/providers.ts";
|
|
12
|
+
export type { ToolApprovalDecisionResponse, ToolApprovalsResponse, } from "./entities/sessions.ts";
|
|
11
13
|
export { decideToolApprovalBodySchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionResponseSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.ts";
|
|
12
14
|
export { copySkillBodySchema, createSkillBodySchema, skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "./entities/skills.ts";
|
|
13
15
|
export { createTaskBodySchema, createTaskResponseSchema, createTaskRunBodySchema, createTaskRunResponseSchema, taskListItemSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunSchema, taskRunStatusSchema, taskRunsListResponseSchema, taskScheduleKindSchema, taskSchema, tasksListResponseSchema, updateTaskBodySchema, } from "./entities/tasks.ts";
|
|
14
16
|
export { quotaSchema, subscriptionStatusSchema, tenantResponseSchema, tenantSchema, tenantSettingsResponseSchema, updateTenantSettingsBodySchema, } from "./entities/tenants.ts";
|
|
15
17
|
export { usageResponseSchema } from "./entities/usage.ts";
|
|
16
18
|
export { createWorkspaceBodySchema, updateWorkspaceBodySchema, workspaceSchema, workspacesListResponseSchema, } from "./entities/workspaces.ts";
|
|
17
|
-
export { agentIdSchema, sessionIdSchema } from "./ids.ts";
|
|
19
|
+
export { agentIdSchema, apiKeyTokenSchema, isAdminAgentId, promptIdSchema, sessionIdSchema, } from "./ids.ts";
|
package/dist/contracts/index.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
export { receivedApiErrorResponseSchema } from "./api.js";
|
|
4
4
|
export { agentResponseSchema, agentSchema, agentStatusSchema, agentsResponseSchema, agentVersionSchema, agentVersionsResponseSchema, createAgentBodySchema, updateAgentBodySchema, } from "./entities/agents.js";
|
|
5
5
|
export { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsListResponseSchema, } from "./entities/artifacts.js";
|
|
6
|
-
export { attributionCreateInputSchema } from "./entities/attribution.js";
|
|
7
|
-
export { blazingAgentsChatMessageMetadataSchema, chatModeSchema, chatRequestBodySchema, chatTriggerSchema, generationRequestBodySchema, usageSummarySchema, } from "./entities/chat.js";
|
|
6
|
+
export { attributionCreateInputSchema, metadataSchema, } from "./entities/attribution.js";
|
|
7
|
+
export { blazingAgentsChatMessageMetadataSchema, chatModeSchema, chatRequestBodySchema, chatTriggerSchema, generationRequestBodySchema, jsonSchemaShapeSchema, promptVariablesSchema, usageSummarySchema, } from "./entities/chat.js";
|
|
8
8
|
export { approveMcpOauthAuthorizationBodySchema, createMcpConnectionBodySchema, mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, mcpConnectionAuthTypeSchema, mcpConnectionOauthConnectResponseSchema, mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionStatusSchema, mcpConnectionsResponseSchema, mcpConnectionTestErrorCodeSchema, mcpConnectionTestResponseSchema, mcpOauthAuthorizationLaunchResponseSchema, reconnectMcpConnectionBodySchema, updateMcpAttachmentBodySchema, updateMcpConnectionBodySchema, } from "./entities/mcp-connections.js";
|
|
9
9
|
export { createMemoryBodySchema, memoriesListResponseSchema, memoryResponseSchema, memorySchema, updateMemoryBodySchema, } from "./entities/memories.js";
|
|
10
10
|
export { createPromptBodySchema, promptResponseSchema, promptSchema, promptsResponseSchema, updatePromptBodySchema, } from "./entities/prompts.js";
|
|
11
|
-
export { createProviderBodySchema, providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, providerTypeSchema, updateProviderBodySchema, } from "./entities/providers.js";
|
|
11
|
+
export { createProviderBodySchema, providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, providerTypeSchema, thinkingLevelsResponseSchema, updateProviderBodySchema, } from "./entities/providers.js";
|
|
12
12
|
export { decideToolApprovalBodySchema, sessionListItemSchema, sessionMessageSchema, sessionMessagesResponseSchema, sessionsListResponseSchema, toolApprovalContinuationStateSchema, toolApprovalDecisionResponseSchema, toolApprovalStateSchema, toolApprovalsResponseSchema, } from "./entities/sessions.js";
|
|
13
13
|
export { copySkillBodySchema, createSkillBodySchema, skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "./entities/skills.js";
|
|
14
14
|
export { createTaskBodySchema, createTaskResponseSchema, createTaskRunBodySchema, createTaskRunResponseSchema, taskListItemSchema, taskResponseSchema, taskRunMessagesResponseSchema, taskRunResponseSchema, taskRunSchema, taskRunStatusSchema, taskRunsListResponseSchema, taskScheduleKindSchema, taskSchema, tasksListResponseSchema, updateTaskBodySchema, } from "./entities/tasks.js";
|
|
15
15
|
export { quotaSchema, subscriptionStatusSchema, tenantResponseSchema, tenantSchema, tenantSettingsResponseSchema, updateTenantSettingsBodySchema, } from "./entities/tenants.js";
|
|
16
16
|
export { usageResponseSchema } from "./entities/usage.js";
|
|
17
17
|
export { createWorkspaceBodySchema, updateWorkspaceBodySchema, workspaceSchema, workspacesListResponseSchema, } from "./entities/workspaces.js";
|
|
18
|
-
export { agentIdSchema, sessionIdSchema } from "./ids.js";
|
|
18
|
+
export { agentIdSchema, apiKeyTokenSchema, isAdminAgentId, promptIdSchema, sessionIdSchema, } from "./ids.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ChatTransport, DefaultChatTransport, type UIMessage } from "ai";
|
|
2
|
+
import type { BlazingAgents } from "./client.ts";
|
|
3
|
+
export interface BlazingAgentsDirectChatTransportOptions {
|
|
4
|
+
agentId: string;
|
|
5
|
+
client: BlazingAgents;
|
|
6
|
+
/** Receives the Session ID before the response stream is consumed. */
|
|
7
|
+
onSessionId?: (sessionId: string) => Promise<void> | void;
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Connects useChat directly to the SDK, including native streaming fetch clients. */
|
|
11
|
+
export declare class BlazingAgentsDirectChatTransport<UI_MESSAGE extends UIMessage = UIMessage> extends DefaultChatTransport<UI_MESSAGE> {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(options: BlazingAgentsDirectChatTransportOptions);
|
|
14
|
+
sendMessages(input: Parameters<ChatTransport<UI_MESSAGE>["sendMessages"]>[0]): Promise<ReadableStream<import("ai").UIMessageChunk<unknown, import("ai").UIDataTypes>>>;
|
|
15
|
+
reconnectToStream(_input: Parameters<ChatTransport<UI_MESSAGE>["reconnectToStream"]>[0]): Promise<null>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DefaultChatTransport } from "ai";
|
|
2
|
+
import { sessionIdSchema } from "./contracts/ids.js";
|
|
3
|
+
/** Connects useChat directly to the SDK, including native streaming fetch clients. */
|
|
4
|
+
export class BlazingAgentsDirectChatTransport extends DefaultChatTransport {
|
|
5
|
+
#options;
|
|
6
|
+
#sessionId;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
super();
|
|
9
|
+
this.#options = options;
|
|
10
|
+
this.#sessionId =
|
|
11
|
+
options.sessionId === undefined
|
|
12
|
+
? undefined
|
|
13
|
+
: sessionIdSchema.parse(options.sessionId);
|
|
14
|
+
}
|
|
15
|
+
async sendMessages(input) {
|
|
16
|
+
if (input.trigger === "regenerate-message" && !this.#sessionId) {
|
|
17
|
+
throw new Error("Regeneration requires an existing Session.");
|
|
18
|
+
}
|
|
19
|
+
const message = input.messages.findLast((item) => item.role === "user");
|
|
20
|
+
if (!message) {
|
|
21
|
+
throw new Error("Chat submission requires a user message.");
|
|
22
|
+
}
|
|
23
|
+
const result = await this.#options.client.chat({
|
|
24
|
+
agentId: this.#options.agentId,
|
|
25
|
+
message,
|
|
26
|
+
messageId: input.messageId,
|
|
27
|
+
...(this.#sessionId === undefined
|
|
28
|
+
? { trigger: "submit-message" }
|
|
29
|
+
: { sessionId: this.#sessionId, trigger: input.trigger }),
|
|
30
|
+
signal: input.abortSignal,
|
|
31
|
+
});
|
|
32
|
+
const stream = result.toStream();
|
|
33
|
+
try {
|
|
34
|
+
const sessionId = await result.sessionId;
|
|
35
|
+
if (this.#sessionId === undefined) {
|
|
36
|
+
this.#sessionId = sessionId;
|
|
37
|
+
await this.#options.onSessionId?.(sessionId);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
await stream.cancel(error).catch(() => undefined);
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
return this.processResponseStream(stream);
|
|
45
|
+
}
|
|
46
|
+
reconnectToStream(_input) {
|
|
47
|
+
return Promise.resolve(null);
|
|
48
|
+
}
|
|
49
|
+
}
|
package/dist/generation.js
CHANGED
|
@@ -131,6 +131,7 @@ export function buildTerminalStreamResult(response, resourceName) {
|
|
|
131
131
|
};
|
|
132
132
|
return {
|
|
133
133
|
requestId,
|
|
134
|
+
toStream: claimBody,
|
|
134
135
|
toResponse: () => {
|
|
135
136
|
const headers = replacementResponseHeaders(requestId, location);
|
|
136
137
|
headers.set("content-type", "text/event-stream");
|
package/dist/http.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export declare function requestJson<T>(config: HttpConfig, path: string, options
|
|
|
13
13
|
* Non-2xx bodies are decoded before a caller can observe a streaming body.
|
|
14
14
|
*/
|
|
15
15
|
export declare function requestStream(config: HttpConfig, path: string, options?: RequestOptions): Promise<Response>;
|
|
16
|
+
export declare function isRequestAborted(cause: unknown, signal?: AbortSignal): boolean;
|
|
17
|
+
export declare function requestAbortedError(cause: unknown): BlazingAgentsError;
|
|
16
18
|
/**
|
|
17
19
|
* Decodes a response body with the tolerant consumer schema. Unknown future
|
|
18
20
|
* codes and fields remain valid; malformed responses never infer a domain
|
package/dist/http.js
CHANGED
|
@@ -135,14 +135,14 @@ async function errorFromResponse(response, signal) {
|
|
|
135
135
|
}
|
|
136
136
|
return parseErrorEnvelope(read.diagnosticBody, response.status, headers);
|
|
137
137
|
}
|
|
138
|
-
function isRequestAborted(cause, signal) {
|
|
138
|
+
export function isRequestAborted(cause, signal) {
|
|
139
139
|
return (signal?.aborted === true ||
|
|
140
140
|
(cause !== null &&
|
|
141
141
|
typeof cause === "object" &&
|
|
142
142
|
"name" in cause &&
|
|
143
143
|
cause.name === "AbortError"));
|
|
144
144
|
}
|
|
145
|
-
function requestAbortedError(cause) {
|
|
145
|
+
export function requestAbortedError(cause) {
|
|
146
146
|
return new BlazingAgentsError({
|
|
147
147
|
code: "request_aborted",
|
|
148
148
|
message: cause instanceof Error ? cause.message : REQUEST_ABORTED_MESSAGE,
|
package/dist/index.d.ts
CHANGED
|
@@ -12,9 +12,10 @@ export { BlazingAgents } from "./client.ts";
|
|
|
12
12
|
export type { Agent, AgentResponse, AgentsResponse, AgentVersion, AgentVersionsListQuery, AgentVersionsResponse, CreateAgentBody, UpdateAgentBody, } from "./contracts/entities/agents.ts";
|
|
13
13
|
export type { ArtifactDownloadUrlResponse, ArtifactListItem, ArtifactsListResponse, } from "./contracts/entities/artifacts.ts";
|
|
14
14
|
export type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResponse, McpConnectionAuthType, McpConnectionOauthConnectResponse, McpConnectionReconnectResult, McpConnectionResponse, McpConnectionStatus, McpConnectionTestResponse, ReconnectMcpConnectionBody, UpdateMcpAttachmentBody, UpdateMcpConnectionBody, } from "./contracts/entities/mcp-connections.ts";
|
|
15
|
-
export type { CreateProviderBody, ProviderModel, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ProviderType, UpdateProviderBody, } from "./contracts/entities/providers.ts";
|
|
15
|
+
export type { CreateProviderBody, ProviderModel, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ProviderType, ThinkingLevelsResponse, UpdateProviderBody, } from "./contracts/entities/providers.ts";
|
|
16
16
|
export type { CreateSkillBody, Skill, SkillArchiveType, SkillCopyResult, SkillCopyResults, SkillDetail, SkillFile, SkillsListResponse, } from "./contracts/entities/skills.ts";
|
|
17
17
|
export type { CreateWorkspaceBody, UpdateWorkspaceBody, Workspace, WorkspaceNetworkPolicy, WorkspacesListResponse, } from "./contracts/entities/workspaces.ts";
|
|
18
|
+
export { BlazingAgentsDirectChatTransport, type BlazingAgentsDirectChatTransportOptions, } from "./direct-chat-transport.ts";
|
|
18
19
|
export { BlazingAgentsError } from "./errors.ts";
|
|
19
20
|
export { createChatRelay, createCompletionRelay, type RelayContext, type SessionOwnershipStore, } from "./relay.ts";
|
|
20
|
-
export type { AgentClient, AgentSkillsResource, AgentsListOptions, AgentsResource, AgentVersionsListOptions, ArtifactsResource, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, ChatInput, ChatMessageInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, KnownBlazingAgentsErrorCode, McpConnectionsResource, MemoriesListOptions, MemoriesResource, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, PromptsResource, ProvidersResource, ResponseObservation, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
|
|
21
|
+
export type { AgentClient, AgentSkillsResource, AgentsListOptions, AgentsResource, AgentVersionsListOptions, ArtifactsResource, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, ChatInput, ChatMessageInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, KnownBlazingAgentsErrorCode, McpConnectionsResource, MemoriesListOptions, MemoriesResource, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, PromptsResource, ProvidersResource, ResourceReadOptions, ResponseObservation, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
|
package/dist/index.js
CHANGED
|
@@ -9,5 +9,6 @@
|
|
|
9
9
|
// biome-ignore lint/performance/noBarrelFile: package entry point
|
|
10
10
|
export { BlazingAgentsChatTransport, } from "./chat-transport.js";
|
|
11
11
|
export { BlazingAgents } from "./client.js";
|
|
12
|
+
export { BlazingAgentsDirectChatTransport, } from "./direct-chat-transport.js";
|
|
12
13
|
export { BlazingAgentsError } from "./errors.js";
|
|
13
14
|
export { createChatRelay, createCompletionRelay, } from "./relay.js";
|
package/dist/resources/agents.js
CHANGED
|
@@ -8,7 +8,7 @@ import { requestJson } from "../http.js";
|
|
|
8
8
|
* core wire schemas (parse-on-read).
|
|
9
9
|
*/
|
|
10
10
|
export function createAgentsResource(config) {
|
|
11
|
-
const getVersion = async (agentId, version) => requestJson(config, `/v1/agents/${agentId}/versions/${version}`,
|
|
11
|
+
const getVersion = async (agentId, version, options = {}) => requestJson(config, `/v1/agents/${agentId}/versions/${version}`, options, agentVersionSchema);
|
|
12
12
|
const update = async (agentId, body) => requestJson(config, `/v1/agents/${agentId}`, {
|
|
13
13
|
json: body,
|
|
14
14
|
method: "PUT",
|
|
@@ -22,14 +22,15 @@ export function createAgentsResource(config) {
|
|
|
22
22
|
},
|
|
23
23
|
async list(options = {}) {
|
|
24
24
|
return await requestJson(config, "/v1/agents", {
|
|
25
|
+
signal: options.signal,
|
|
25
26
|
query: {
|
|
26
27
|
userId: options.userId,
|
|
27
28
|
workspaceId: options.workspaceId,
|
|
28
29
|
},
|
|
29
30
|
}, agentsResponseSchema);
|
|
30
31
|
},
|
|
31
|
-
async get(agentId) {
|
|
32
|
-
return await requestJson(config, `/v1/agents/${agentId}`,
|
|
32
|
+
async get(agentId, options = {}) {
|
|
33
|
+
return await requestJson(config, `/v1/agents/${agentId}`, options, agentResponseSchema);
|
|
33
34
|
},
|
|
34
35
|
async disable(agentId) {
|
|
35
36
|
return await requestJson(config, `/v1/agents/${agentId}/disable`, { method: "POST" }, agentResponseSchema);
|
|
@@ -39,16 +40,20 @@ export function createAgentsResource(config) {
|
|
|
39
40
|
},
|
|
40
41
|
getVersion,
|
|
41
42
|
async listVersions(agentId, options = {}) {
|
|
42
|
-
return await requestJson(config, `/v1/agents/${agentId}/versions`, {
|
|
43
|
+
return await requestJson(config, `/v1/agents/${agentId}/versions`, {
|
|
44
|
+
signal: options.signal,
|
|
45
|
+
query: { cursor: options.cursor, limit: options.limit },
|
|
46
|
+
}, agentVersionsResponseSchema);
|
|
43
47
|
},
|
|
44
|
-
async listMcpAttachments(agentId) {
|
|
45
|
-
return await requestJson(config, `/v1/agents/${agentId}/mcp-attachments`,
|
|
48
|
+
async listMcpAttachments(agentId, options = {}) {
|
|
49
|
+
return await requestJson(config, `/v1/agents/${agentId}/mcp-attachments`, options, mcpAttachmentsResponseSchema);
|
|
46
50
|
},
|
|
47
51
|
async restoreVersion(agentId, versionNumber) {
|
|
48
52
|
const version = await getVersion(agentId, versionNumber);
|
|
49
53
|
return update(agentId, {
|
|
50
54
|
name: version.name,
|
|
51
55
|
model: version.model,
|
|
56
|
+
thinkingLevel: version.thinkingLevel,
|
|
52
57
|
providerId: version.providerId,
|
|
53
58
|
memoryInjectionEnabled: version.memoryInjectionEnabled,
|
|
54
59
|
tools: version.tools,
|
|
@@ -8,11 +8,12 @@ export function createArtifactsResource(config) {
|
|
|
8
8
|
async createDownloadUrl(artifactId) {
|
|
9
9
|
return await requestJson(config, `/v1/artifacts/${artifactId}/download-url`, { method: "POST" }, artifactDownloadUrlResponseSchema);
|
|
10
10
|
},
|
|
11
|
-
async get(artifactId) {
|
|
12
|
-
return await requestJson(config, `/v1/artifacts/${artifactId}`,
|
|
11
|
+
async get(artifactId, options = {}) {
|
|
12
|
+
return await requestJson(config, `/v1/artifacts/${artifactId}`, options, artifactListItemSchema);
|
|
13
13
|
},
|
|
14
14
|
async list(options = {}) {
|
|
15
15
|
return await requestJson(config, "/v1/artifacts", {
|
|
16
|
+
signal: options.signal,
|
|
16
17
|
query: {
|
|
17
18
|
agentId: options.agentId,
|
|
18
19
|
sessionId: options.sessionId,
|
|
@@ -10,11 +10,11 @@ export function createMcpConnectionsResource(config) {
|
|
|
10
10
|
return await requestJson(config, `/v1/mcp-connections/${id}/connect`, { method: "POST" }, mcpConnectionOauthConnectResponseSchema);
|
|
11
11
|
},
|
|
12
12
|
create,
|
|
13
|
-
async list() {
|
|
14
|
-
return await requestJson(config, "/v1/mcp-connections",
|
|
13
|
+
async list(options = {}) {
|
|
14
|
+
return await requestJson(config, "/v1/mcp-connections", options, mcpConnectionsResponseSchema);
|
|
15
15
|
},
|
|
16
|
-
async get(id) {
|
|
17
|
-
return await requestJson(config, `/v1/mcp-connections/${id}`,
|
|
16
|
+
async get(id, options = {}) {
|
|
17
|
+
return await requestJson(config, `/v1/mcp-connections/${id}`, options, mcpConnectionResponseSchema);
|
|
18
18
|
},
|
|
19
19
|
async update(id, body) {
|
|
20
20
|
return await requestJson(config, `/v1/mcp-connections/${id}`, {
|
|
@@ -9,6 +9,7 @@ export function createMemoriesResource(config) {
|
|
|
9
9
|
return {
|
|
10
10
|
async list(agentId, options = {}) {
|
|
11
11
|
return await requestJson(config, `/v1/agents/${agentId}/memories`, {
|
|
12
|
+
signal: options.signal,
|
|
12
13
|
query: {
|
|
13
14
|
...(options.userId === undefined ? {} : { userId: options.userId }),
|
|
14
15
|
search: options.search,
|
|
@@ -20,8 +21,8 @@ export function createMemoriesResource(config) {
|
|
|
20
21
|
async create(agentId, body) {
|
|
21
22
|
return await requestJson(config, `/v1/agents/${agentId}/memories`, { json: body, method: "POST" }, memoryResponseSchema);
|
|
22
23
|
},
|
|
23
|
-
async get(agentId, memoryId) {
|
|
24
|
-
return await requestJson(config, `/v1/agents/${agentId}/memories/${memoryId}`,
|
|
24
|
+
async get(agentId, memoryId, options = {}) {
|
|
25
|
+
return await requestJson(config, `/v1/agents/${agentId}/memories/${memoryId}`, options, memoryResponseSchema);
|
|
25
26
|
},
|
|
26
27
|
async update(agentId, memoryId, body) {
|
|
27
28
|
return await requestJson(config, `/v1/agents/${agentId}/memories/${memoryId}`, { json: body, method: "PATCH" }, memoryResponseSchema);
|
|
@@ -12,14 +12,15 @@ export function createPromptsResource(config) {
|
|
|
12
12
|
method: "POST",
|
|
13
13
|
}, promptResponseSchema);
|
|
14
14
|
},
|
|
15
|
-
async list(userId) {
|
|
15
|
+
async list(userId, options = {}) {
|
|
16
16
|
return await requestJson(config, "/v1/prompts", {
|
|
17
|
+
...options,
|
|
17
18
|
// Stryker disable next-line ConditionalExpression: URL serialization omits an undefined query value.
|
|
18
19
|
...(userId === undefined ? {} : { query: { userId } }),
|
|
19
20
|
}, promptsResponseSchema);
|
|
20
21
|
},
|
|
21
|
-
async get(promptId) {
|
|
22
|
-
return await requestJson(config, `/v1/prompts/${promptId}`,
|
|
22
|
+
async get(promptId, options = {}) {
|
|
23
|
+
return await requestJson(config, `/v1/prompts/${promptId}`, options, promptResponseSchema);
|
|
23
24
|
},
|
|
24
25
|
async update(promptId, body) {
|
|
25
26
|
return await requestJson(config, `/v1/prompts/${promptId}`, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, } from "../contracts/entities/providers.js";
|
|
1
|
+
import { providerModelsResponseSchema, providerResponseSchema, providersResponseSchema, thinkingLevelsResponseSchema, } from "../contracts/entities/providers.js";
|
|
2
2
|
import { requestJson } from "../http.js";
|
|
3
3
|
/**
|
|
4
4
|
* `client.providers` — CRUD and cost-free model discovery.
|
|
@@ -11,14 +11,17 @@ export function createProvidersResource(config) {
|
|
|
11
11
|
method: "POST",
|
|
12
12
|
}, providerResponseSchema);
|
|
13
13
|
},
|
|
14
|
-
async list() {
|
|
15
|
-
return await requestJson(config, "/v1/providers",
|
|
14
|
+
async list(options = {}) {
|
|
15
|
+
return await requestJson(config, "/v1/providers", options, providersResponseSchema);
|
|
16
16
|
},
|
|
17
|
-
async get(id) {
|
|
18
|
-
return await requestJson(config, `/v1/providers/${id}`,
|
|
17
|
+
async get(id, options = {}) {
|
|
18
|
+
return await requestJson(config, `/v1/providers/${id}`, options, providerResponseSchema);
|
|
19
19
|
},
|
|
20
|
-
async listModels(id) {
|
|
21
|
-
return await requestJson(config, `/v1/providers/${id}/models`,
|
|
20
|
+
async listModels(id, options = {}) {
|
|
21
|
+
return await requestJson(config, `/v1/providers/${id}/models`, options, providerModelsResponseSchema);
|
|
22
|
+
},
|
|
23
|
+
async getThinkingLevels(id, model, options = {}) {
|
|
24
|
+
return await requestJson(config, `/v1/providers/${id}/thinking-levels`, { ...options, query: { model } }, thinkingLevelsResponseSchema);
|
|
22
25
|
},
|
|
23
26
|
async update(id, body) {
|
|
24
27
|
return await requestJson(config, `/v1/providers/${id}`, {
|
|
@@ -18,6 +18,7 @@ export function createSessionsResource(config) {
|
|
|
18
18
|
},
|
|
19
19
|
async list(agentId, options = {}) {
|
|
20
20
|
return await requestJson(config, `/v1/agents/${agentId}/sessions`, {
|
|
21
|
+
signal: options.signal,
|
|
21
22
|
query: {
|
|
22
23
|
cursor: options.cursor,
|
|
23
24
|
limit: options.limit,
|
|
@@ -28,6 +29,7 @@ export function createSessionsResource(config) {
|
|
|
28
29
|
},
|
|
29
30
|
async messages(agentId, sessionId, options = {}) {
|
|
30
31
|
return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}/messages`, {
|
|
32
|
+
signal: options.signal,
|
|
31
33
|
query: {
|
|
32
34
|
cursor: options.cursor,
|
|
33
35
|
after: options.after,
|
|
@@ -39,8 +41,8 @@ export function createSessionsResource(config) {
|
|
|
39
41
|
const response = await requestStream(config, `/v1/agents/${agentId}/sessions/${sessionId}/tool-approval-continuations/${continuationId}`, options.signal ? { signal: options.signal } : {});
|
|
40
42
|
return buildTerminalStreamResult(response, "continuation");
|
|
41
43
|
},
|
|
42
|
-
async toolApprovals(agentId, sessionId) {
|
|
43
|
-
return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}/tool-approvals`,
|
|
44
|
+
async toolApprovals(agentId, sessionId, options = {}) {
|
|
45
|
+
return await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}/tool-approvals`, options, toolApprovalsResponseSchema);
|
|
44
46
|
},
|
|
45
47
|
async delete(agentId, sessionId, deleteArtifacts) {
|
|
46
48
|
await requestJson(config, `/v1/agents/${agentId}/sessions/${sessionId}`, { method: "DELETE", query: { deleteArtifacts } });
|
package/dist/resources/skills.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { skillCopyResultsSchema, skillDetailSchema, skillsListResponseSchema, } from "../contracts/entities/skills.js";
|
|
2
|
-
import { requestJson, requestStream } from "../http.js";
|
|
2
|
+
import { isRequestAborted, requestAbortedError, requestJson, requestStream, } from "../http.js";
|
|
3
3
|
function fileUrl(agentId, input) {
|
|
4
4
|
const path = input.path.split("/").map(encodeURIComponent).join("/");
|
|
5
5
|
return `/v1/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(input.skillId)}/files/${path}`;
|
|
@@ -20,15 +20,23 @@ export function createAgentSkillsResource(config, agentId) {
|
|
|
20
20
|
method: "DELETE",
|
|
21
21
|
}, skillDetailSchema);
|
|
22
22
|
},
|
|
23
|
-
async get({ skillId }) {
|
|
24
|
-
return await requestJson(config, `/v1/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(skillId)}`,
|
|
25
|
-
},
|
|
26
|
-
async getFile(input) {
|
|
27
|
-
const response = await requestStream(config, fileUrl(agentId, input));
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
async get({ skillId }, options = {}) {
|
|
24
|
+
return await requestJson(config, `/v1/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(skillId)}`, options, skillDetailSchema);
|
|
25
|
+
},
|
|
26
|
+
async getFile(input, options = {}) {
|
|
27
|
+
const response = await requestStream(config, fileUrl(agentId, input), options);
|
|
28
|
+
try {
|
|
29
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
30
|
+
}
|
|
31
|
+
catch (cause) {
|
|
32
|
+
if (isRequestAborted(cause, options.signal)) {
|
|
33
|
+
throw requestAbortedError(cause);
|
|
34
|
+
}
|
|
35
|
+
throw cause;
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
async list({ cursor, limit, signal } = {}) {
|
|
39
|
+
return await requestJson(config, `/v1/agents/${encodeURIComponent(agentId)}/skills`, { signal, query: { cursor, limit } }, skillsListResponseSchema);
|
|
32
40
|
},
|
|
33
41
|
async putFile({ content, ...input }) {
|
|
34
42
|
return await requestJson(config, fileUrl(agentId, input), {
|
package/dist/resources/tasks.js
CHANGED
|
@@ -15,6 +15,7 @@ export function createTasksResource(config) {
|
|
|
15
15
|
},
|
|
16
16
|
async list(options = {}) {
|
|
17
17
|
return await requestJson(config, "/v1/tasks", {
|
|
18
|
+
signal: options.signal,
|
|
18
19
|
query: {
|
|
19
20
|
agentId: options.agentId,
|
|
20
21
|
cursor: options.cursor,
|
|
@@ -24,8 +25,8 @@ export function createTasksResource(config) {
|
|
|
24
25
|
},
|
|
25
26
|
}, tasksListResponseSchema);
|
|
26
27
|
},
|
|
27
|
-
async get(taskId) {
|
|
28
|
-
return await requestJson(config, `/v1/tasks/${taskId}`,
|
|
28
|
+
async get(taskId, options = {}) {
|
|
29
|
+
return await requestJson(config, `/v1/tasks/${taskId}`, options, taskResponseSchema);
|
|
29
30
|
},
|
|
30
31
|
async update(taskId, body) {
|
|
31
32
|
return await requestJson(config, `/v1/tasks/${taskId}`, {
|
|
@@ -42,13 +43,17 @@ export function createTasksResource(config) {
|
|
|
42
43
|
return await requestJson(config, `/v1/tasks/${taskId}/runs`, { json: body, method: "POST" }, createTaskRunResponseSchema);
|
|
43
44
|
},
|
|
44
45
|
async listRuns(taskId, options = {}) {
|
|
45
|
-
return await requestJson(config, `/v1/tasks/${taskId}/runs`, {
|
|
46
|
+
return await requestJson(config, `/v1/tasks/${taskId}/runs`, {
|
|
47
|
+
signal: options.signal,
|
|
48
|
+
query: { cursor: options.cursor, limit: options.limit },
|
|
49
|
+
}, taskRunsListResponseSchema);
|
|
46
50
|
},
|
|
47
|
-
async getRun(taskId, runId) {
|
|
48
|
-
return await requestJson(config, `/v1/tasks/${taskId}/runs/${runId}`,
|
|
51
|
+
async getRun(taskId, runId, options = {}) {
|
|
52
|
+
return await requestJson(config, `/v1/tasks/${taskId}/runs/${runId}`, options, taskRunResponseSchema);
|
|
49
53
|
},
|
|
50
54
|
async runMessages(taskId, runId, options = {}) {
|
|
51
55
|
return await requestJson(config, `/v1/tasks/${taskId}/runs/${runId}/messages`, {
|
|
56
|
+
signal: options.signal,
|
|
52
57
|
query: {
|
|
53
58
|
cursor: options.cursor,
|
|
54
59
|
after: options.after,
|
package/dist/resources/tenant.js
CHANGED
|
@@ -6,8 +6,8 @@ import { requestJson } from "../http.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export function createTenantResource(config) {
|
|
8
8
|
return {
|
|
9
|
-
async get() {
|
|
10
|
-
return await requestJson(config, "/v1/tenant",
|
|
9
|
+
async get(options = {}) {
|
|
10
|
+
return await requestJson(config, "/v1/tenant", options, tenantSettingsResponseSchema);
|
|
11
11
|
},
|
|
12
12
|
async patch(body) {
|
|
13
13
|
return await requestJson(config, "/v1/tenant", {
|
package/dist/resources/usage.js
CHANGED
|
@@ -7,13 +7,14 @@ import { requestJson } from "../http.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export function createUsageResource(config) {
|
|
9
9
|
return {
|
|
10
|
-
async get(query = {}) {
|
|
10
|
+
async get({ signal, ...query } = {}) {
|
|
11
11
|
return await requestJson(config, "/v1/usage", {
|
|
12
12
|
query,
|
|
13
|
+
signal,
|
|
13
14
|
}, usageResponseSchema);
|
|
14
15
|
},
|
|
15
|
-
async getForAgent(agentId, query = {}) {
|
|
16
|
-
return await requestJson(config, `/v1/agents/${agentId}/usage`, { query }, usageResponseSchema);
|
|
16
|
+
async getForAgent(agentId, { signal, ...query } = {}) {
|
|
17
|
+
return await requestJson(config, `/v1/agents/${agentId}/usage`, { query, signal }, usageResponseSchema);
|
|
17
18
|
},
|
|
18
19
|
};
|
|
19
20
|
}
|
|
@@ -12,11 +12,12 @@ export function createWorkspacesResource(config) {
|
|
|
12
12
|
const response = await requestStream(config, `/v1/workspaces/${encodeURIComponent(workspaceId)}`, { method: "DELETE" });
|
|
13
13
|
return response.status === 202 ? "pending" : "completed";
|
|
14
14
|
},
|
|
15
|
-
async get({ workspaceId }) {
|
|
16
|
-
return await requestJson(config, `/v1/workspaces/${encodeURIComponent(workspaceId)}`,
|
|
15
|
+
async get({ workspaceId }, options = {}) {
|
|
16
|
+
return await requestJson(config, `/v1/workspaces/${encodeURIComponent(workspaceId)}`, options, workspaceSchema);
|
|
17
17
|
},
|
|
18
18
|
async list(options = {}) {
|
|
19
19
|
return await requestJson(config, "/v1/workspaces", {
|
|
20
|
+
signal: options.signal,
|
|
20
21
|
query: {
|
|
21
22
|
cursor: options.cursor,
|
|
22
23
|
limit: options.limit,
|