@blazingagents/sdk 0.29.0 → 0.31.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/client.js +7 -3
- package/dist/index.d.ts +1 -1
- package/dist/resources/agents.d.ts +8 -2
- package/dist/resources/agents.js +19 -9
- package/dist/types.d.ts +4 -2
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { chat, completion, continueChat, objectGeneration, } from "./generation.js";
|
|
3
|
-
import { createAgentsResource } from "./resources/agents.js";
|
|
3
|
+
import { createAgentsResource, createUserAgentsResource, } from "./resources/agents.js";
|
|
4
4
|
import { createArtifactsResource } from "./resources/artifacts.js";
|
|
5
5
|
import { createChatConnectionsResource } from "./resources/chat-connections.js";
|
|
6
6
|
import { createChatDeliveriesResource } from "./resources/chat-deliveries.js";
|
|
@@ -29,14 +29,18 @@ const scopedUserIdSchema = z
|
|
|
29
29
|
function createUserClient(config) {
|
|
30
30
|
const usage = createUsageResource(config);
|
|
31
31
|
return {
|
|
32
|
-
agents:
|
|
32
|
+
agents: createUserAgentsResource(config),
|
|
33
33
|
sessions: createSessionsResource(config),
|
|
34
34
|
prompts: createPromptsResource(config),
|
|
35
35
|
tasks: createTasksResource(config),
|
|
36
36
|
artifacts: createArtifactsResource(config),
|
|
37
37
|
workspaces: createWorkspacesResource(config),
|
|
38
38
|
memories: createMemoriesResource(config),
|
|
39
|
-
usage: {
|
|
39
|
+
usage: {
|
|
40
|
+
get: usage.get,
|
|
41
|
+
getForAgent: usage.getForAgent,
|
|
42
|
+
sessions: usage.sessions,
|
|
43
|
+
},
|
|
40
44
|
/** Returns Skill operations for the selected Agent. */
|
|
41
45
|
agent: ({ agentId }) => ({
|
|
42
46
|
skills: createAgentSkillsResource(config, agentId),
|
package/dist/index.d.ts
CHANGED
|
@@ -28,4 +28,4 @@ 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 { AgentClient, AgentSkillsResource, AgentsListOptions, AgentsResource, ArtifactsResource, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, BlazingAgentsUIMessageData, ChatConnectionsResource, ChatDeliveriesListOptions, ChatDeliveriesResource, ChatInput, ChatMessageInput, ChatMessagesInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, ContinueChatInput, KnownBlazingAgentsErrorCode, LatestSessionsListOptions, McpConnectionsResource, MemoriesListOptions, MemoriesResource, MerchantBindingsListOptions, MerchantBindingsResource, MerchantConnectionResource, MerchantUsageEventsListOptions, MerchantUsageEventsResource, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, PromptsResource, ProvidersResource, ResourceRequestOptions, ResponseObservation, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, UserClient, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
|
|
31
|
+
export type { AgentClient, AgentSkillsResource, AgentsListOptions, AgentsResource, ArtifactsResource, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, BlazingAgentsUIMessageData, ChatConnectionsResource, ChatDeliveriesListOptions, ChatDeliveriesResource, ChatInput, ChatMessageInput, ChatMessagesInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, ContinueChatInput, KnownBlazingAgentsErrorCode, LatestSessionsListOptions, McpConnectionsResource, MemoriesListOptions, MemoriesResource, MerchantBindingsListOptions, MerchantBindingsResource, MerchantConnectionResource, MerchantUsageEventsListOptions, MerchantUsageEventsResource, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, PromptsResource, ProvidersResource, ResourceRequestOptions, ResponseObservation, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, UserAgentsResource, UserClient, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import type { AgentsResource, HttpConfig } from "../types.ts";
|
|
1
|
+
import type { AgentsResource, HttpConfig, UserAgentsResource } from "../types.ts";
|
|
2
2
|
/**
|
|
3
|
-
* Builds the Agents operations
|
|
3
|
+
* Builds the Agents operations, including the spending limits that need tenant authority.
|
|
4
4
|
* @param config - Shared authentication and transport configuration.
|
|
5
5
|
* @returns The configured resource client.
|
|
6
6
|
*/
|
|
7
7
|
export declare function createAgentsResource(config: HttpConfig): AgentsResource;
|
|
8
|
+
/**
|
|
9
|
+
* Builds the Agents operations a user-scoped client may call.
|
|
10
|
+
* @param config - Shared authentication and transport configuration.
|
|
11
|
+
* @returns The configured resource client.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createUserAgentsResource(config: HttpConfig): UserAgentsResource;
|
package/dist/resources/agents.js
CHANGED
|
@@ -3,20 +3,13 @@ import { mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, } from "../c
|
|
|
3
3
|
import { spendingLimitResponseSchema } from "../contracts/entities/spending-limits.js";
|
|
4
4
|
import { requestJson } from "../http.js";
|
|
5
5
|
/**
|
|
6
|
-
* Builds the Agents operations
|
|
6
|
+
* Builds the Agents operations, including the spending limits that need tenant authority.
|
|
7
7
|
* @param config - Shared authentication and transport configuration.
|
|
8
8
|
* @returns The configured resource client.
|
|
9
9
|
*/
|
|
10
10
|
export function createAgentsResource(config) {
|
|
11
|
-
/**
|
|
12
|
-
* Updates agents.
|
|
13
|
-
*/
|
|
14
|
-
const update = async ({ agentId, abortSignal, ...body }) => requestJson(config, `/v1/agents/${agentId}`, {
|
|
15
|
-
json: body,
|
|
16
|
-
signal: abortSignal,
|
|
17
|
-
method: "PUT",
|
|
18
|
-
}, agentResponseSchema);
|
|
19
11
|
return {
|
|
12
|
+
...createUserAgentsResource(config),
|
|
20
13
|
/** Retrieves the model spending limit using tenant authority. */
|
|
21
14
|
async getSpendingLimit({ agentId, abortSignal }) {
|
|
22
15
|
return await requestJson(config, `/v1/agents/${agentId}/spending-limit`, { signal: abortSignal }, spendingLimitResponseSchema);
|
|
@@ -25,6 +18,23 @@ export function createAgentsResource(config) {
|
|
|
25
18
|
async updateSpendingLimit({ agentId, abortSignal, ...body }) {
|
|
26
19
|
return await requestJson(config, `/v1/agents/${agentId}/spending-limit`, { method: "PUT", json: body, signal: abortSignal }, spendingLimitResponseSchema);
|
|
27
20
|
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Builds the Agents operations a user-scoped client may call.
|
|
25
|
+
* @param config - Shared authentication and transport configuration.
|
|
26
|
+
* @returns The configured resource client.
|
|
27
|
+
*/
|
|
28
|
+
export function createUserAgentsResource(config) {
|
|
29
|
+
/**
|
|
30
|
+
* Updates agents.
|
|
31
|
+
*/
|
|
32
|
+
const update = async ({ agentId, abortSignal, ...body }) => requestJson(config, `/v1/agents/${agentId}`, {
|
|
33
|
+
json: body,
|
|
34
|
+
signal: abortSignal,
|
|
35
|
+
method: "PUT",
|
|
36
|
+
}, agentResponseSchema);
|
|
37
|
+
return {
|
|
28
38
|
/**
|
|
29
39
|
* Creates agents.
|
|
30
40
|
*/
|
package/dist/types.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export interface BlazingAgentsOptions {
|
|
|
61
61
|
export interface BlazingAgentsRequestOptions {
|
|
62
62
|
clientRequestId: string;
|
|
63
63
|
}
|
|
64
|
+
/** Agent operations on a user-scoped client, which has no spending limits. */
|
|
65
|
+
export type UserAgentsResource = Omit<AgentsResource, "getSpendingLimit" | "updateSpendingLimit">;
|
|
64
66
|
export interface UserClient {
|
|
65
67
|
/**
|
|
66
68
|
* Returns the Skill operations for the selected Agent.
|
|
@@ -70,7 +72,7 @@ export interface UserClient {
|
|
|
70
72
|
agent(input: {
|
|
71
73
|
agentId: string;
|
|
72
74
|
}): AgentClient;
|
|
73
|
-
readonly agents:
|
|
75
|
+
readonly agents: UserAgentsResource;
|
|
74
76
|
readonly artifacts: ArtifactsResource;
|
|
75
77
|
/**
|
|
76
78
|
* Creates or resumes a Session and returns its SSE stream and Session ID.
|
|
@@ -100,7 +102,7 @@ export interface UserClient {
|
|
|
100
102
|
readonly prompts: PromptsResource;
|
|
101
103
|
readonly sessions: SessionsResource;
|
|
102
104
|
readonly tasks: TasksResource;
|
|
103
|
-
readonly usage: Pick<UsageResource, "get" | "sessions">;
|
|
105
|
+
readonly usage: Pick<UsageResource, "get" | "getForAgent" | "sessions">;
|
|
104
106
|
/**
|
|
105
107
|
* Creates a client view with the supplied request correlation ID.
|
|
106
108
|
* @param options - Caller-owned request correlation ID for subsequent calls.
|