@blazingagents/sdk 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,7 +16,7 @@ requires Node.js 24 or newer.
16
16
  ## Features
17
17
 
18
18
  - Typed clients for Agents, Workspaces, Skills, Providers, Prompts, Tasks,
19
- Sessions, Artifacts, usage, and Tenant settings.
19
+ Sessions, Artifacts, Slack and Telegram Chat Connections, usage, and Tenant settings.
20
20
  - Stateful chat and stateless text or structured-object generation.
21
21
  - Public Zod contracts for validating API requests and responses.
22
22
  - Cursor pagination and binary transfers.
@@ -232,3 +232,9 @@ ordinary-policy reference). Persisted approval decisions remain
232
232
  The root package exports `ApprovalDecision`, `ApprovalPolicy`, `ToolReference`,
233
233
  and `ToolApprovalState`; runtime policy schemas are exported from
234
234
  `@blazingagents/sdk/contracts`.
235
+
236
+ ## Slack and Telegram
237
+
238
+ Use the [connection example](https://github.com/blazingagents/typescript-sdk/blob/main/examples/chat-integrations.md) to connect an existing
239
+ Agent through REST. BA hosts the Chat SDK runtime, conversation history, and
240
+ approval cards; no additional SDK resource is required.
package/dist/client.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import type { AgentClient, AgentsResource, ArtifactsResource, BlazingAgentsOptions, BlazingAgentsRequestOptions, ChatInput, ChatResult, CompletionInput, CompletionResult, McpConnectionsResource, MemoriesResource, ObjectInput, ObjectResult, PromptsResource, ProvidersResource, SessionsResource, TasksResource, TenantResource, UsageResource, WorkspacesResource } from "./types.ts";
1
+ import type { AgentClient, AgentsResource, ArtifactsResource, BlazingAgentsOptions, BlazingAgentsRequestOptions, ChatConnectionsResource, ChatInput, ChatResult, CompletionInput, CompletionResult, McpConnectionsResource, MemoriesResource, ObjectInput, ObjectResult, PromptsResource, ProvidersResource, SessionsResource, TasksResource, TenantResource, UsageResource, WorkspacesResource } from "./types.ts";
2
2
  export declare class BlazingAgents {
3
3
  private readonly config;
4
+ readonly chatConnections: ChatConnectionsResource;
4
5
  readonly agents: AgentsResource;
5
6
  readonly sessions: SessionsResource;
6
7
  readonly providers: ProvidersResource;
package/dist/client.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { chat, completion, objectGeneration } from "./generation.js";
2
2
  import { createAgentsResource } from "./resources/agents.js";
3
3
  import { createArtifactsResource } from "./resources/artifacts.js";
4
+ import { createChatConnectionsResource } from "./resources/chat-connections.js";
4
5
  import { createMcpConnectionsResource } from "./resources/mcp-connections.js";
5
6
  import { createMemoriesResource } from "./resources/memories.js";
6
7
  import { createPromptsResource } from "./resources/prompts.js";
@@ -15,6 +16,7 @@ const DEFAULT_BASE_URL = "https://api.blazingagents.com";
15
16
  const TRAILING_SLASH_RE = /\/+$/;
16
17
  export class BlazingAgents {
17
18
  config;
19
+ chatConnections;
18
20
  agents;
19
21
  sessions;
20
22
  providers;
@@ -36,6 +38,7 @@ export class BlazingAgents {
36
38
  : { clientRequestId: options.clientRequestId }),
37
39
  onResponse: options.onResponse,
38
40
  };
41
+ this.chatConnections = createChatConnectionsResource(this.config);
39
42
  this.agents = createAgentsResource(this.config);
40
43
  this.sessions = createSessionsResource(this.config);
41
44
  this.providers = createProvidersResource(this.config);
@@ -0,0 +1,202 @@
1
+ import { z } from "zod";
2
+ export declare const chatCredentialsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ platform: z.ZodLiteral<"slack">;
4
+ botToken: z.ZodString;
5
+ signingSecret: z.ZodString;
6
+ }, z.core.$strict>, z.ZodObject<{
7
+ platform: z.ZodLiteral<"telegram">;
8
+ botToken: z.ZodString;
9
+ webhookSecret: z.ZodString;
10
+ }, z.core.$strict>], "platform">;
11
+ export declare const chatConfigurationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
12
+ teamId: z.ZodString;
13
+ appId: z.ZodString;
14
+ webhookUrl: z.ZodURL;
15
+ channelIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
16
+ platform: z.ZodLiteral<"slack">;
17
+ }, z.core.$strict>, z.ZodObject<{
18
+ botId: z.ZodString;
19
+ webhookUrl: z.ZodURL;
20
+ chatIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
21
+ platform: z.ZodLiteral<"telegram">;
22
+ }, z.core.$strict>], "platform">;
23
+ export declare const createChatConnectionBodySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
24
+ agentId: z.ZodString;
25
+ name: z.ZodString;
26
+ enabled: z.ZodDefault<z.ZodBoolean>;
27
+ platform: z.ZodLiteral<"slack">;
28
+ configuration: z.ZodObject<{
29
+ teamId: z.ZodString;
30
+ appId: z.ZodString;
31
+ webhookUrl: z.ZodURL;
32
+ channelIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
33
+ }, z.core.$strict>;
34
+ credentials: z.ZodObject<{
35
+ botToken: z.ZodString;
36
+ signingSecret: z.ZodString;
37
+ }, z.core.$strict>;
38
+ }, z.core.$strict>, z.ZodObject<{
39
+ agentId: z.ZodString;
40
+ name: z.ZodString;
41
+ enabled: z.ZodDefault<z.ZodBoolean>;
42
+ platform: z.ZodLiteral<"telegram">;
43
+ configuration: z.ZodObject<{
44
+ botId: z.ZodString;
45
+ webhookUrl: z.ZodURL;
46
+ chatIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
47
+ }, z.core.$strict>;
48
+ credentials: z.ZodObject<{
49
+ botToken: z.ZodString;
50
+ webhookSecret: z.ZodString;
51
+ }, z.core.$strict>;
52
+ }, z.core.$strict>], "platform">;
53
+ export declare const rotateChatConnectionBodySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
54
+ platform: z.ZodLiteral<"slack">;
55
+ botToken: z.ZodString;
56
+ signingSecret: z.ZodString;
57
+ }, z.core.$strict>, z.ZodObject<{
58
+ platform: z.ZodLiteral<"telegram">;
59
+ botToken: z.ZodString;
60
+ webhookSecret: z.ZodString;
61
+ }, z.core.$strict>], "platform">;
62
+ export declare const updateChatConnectionBodySchema: z.ZodObject<{
63
+ name: z.ZodOptional<z.ZodString>;
64
+ webhookUrl: z.ZodOptional<z.ZodURL>;
65
+ }, z.core.$strict>;
66
+ export declare const chatConnectionParamsSchema: z.ZodObject<{
67
+ id: z.ZodString;
68
+ }, z.core.$strip>;
69
+ export declare const chatHealthCheckSchema: z.ZodObject<{
70
+ code: z.ZodString;
71
+ status: z.ZodEnum<{
72
+ fail: "fail";
73
+ pass: "pass";
74
+ unknown: "unknown";
75
+ }>;
76
+ subject: z.ZodOptional<z.ZodString>;
77
+ }, z.core.$strip>;
78
+ export declare const chatHealthSchema: z.ZodObject<{
79
+ checkedAt: z.ZodString;
80
+ tokenValid: z.ZodBoolean;
81
+ identityVerified: z.ZodBoolean;
82
+ checks: z.ZodArray<z.ZodObject<{
83
+ code: z.ZodString;
84
+ status: z.ZodEnum<{
85
+ fail: "fail";
86
+ pass: "pass";
87
+ unknown: "unknown";
88
+ }>;
89
+ subject: z.ZodOptional<z.ZodString>;
90
+ }, z.core.$strip>>;
91
+ }, z.core.$strip>;
92
+ export declare const chatIdentitySchema: z.ZodObject<{
93
+ botId: z.ZodString;
94
+ botUserId: z.ZodString;
95
+ teamId: z.ZodNullable<z.ZodString>;
96
+ appId: z.ZodNullable<z.ZodString>;
97
+ }, z.core.$strip>;
98
+ export declare const chatConnectionSchema: z.ZodObject<{
99
+ id: z.ZodString;
100
+ tenantId: z.ZodString;
101
+ agentId: z.ZodString;
102
+ name: z.ZodString;
103
+ platform: z.ZodEnum<{
104
+ slack: "slack";
105
+ telegram: "telegram";
106
+ }>;
107
+ enabled: z.ZodBoolean;
108
+ configuration: z.ZodDiscriminatedUnion<[z.ZodObject<{
109
+ teamId: z.ZodString;
110
+ appId: z.ZodString;
111
+ webhookUrl: z.ZodURL;
112
+ channelIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
113
+ platform: z.ZodLiteral<"slack">;
114
+ }, z.core.$strip>, z.ZodObject<{
115
+ botId: z.ZodString;
116
+ webhookUrl: z.ZodURL;
117
+ chatIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
118
+ platform: z.ZodLiteral<"telegram">;
119
+ }, z.core.$strip>], "platform">;
120
+ identity: z.ZodObject<{
121
+ botId: z.ZodString;
122
+ botUserId: z.ZodString;
123
+ teamId: z.ZodNullable<z.ZodString>;
124
+ appId: z.ZodNullable<z.ZodString>;
125
+ }, z.core.$strip>;
126
+ health: z.ZodObject<{
127
+ checkedAt: z.ZodString;
128
+ tokenValid: z.ZodBoolean;
129
+ identityVerified: z.ZodBoolean;
130
+ checks: z.ZodArray<z.ZodObject<{
131
+ code: z.ZodString;
132
+ status: z.ZodEnum<{
133
+ fail: "fail";
134
+ pass: "pass";
135
+ unknown: "unknown";
136
+ }>;
137
+ subject: z.ZodOptional<z.ZodString>;
138
+ }, z.core.$strip>>;
139
+ }, z.core.$strip>;
140
+ credentialFragment: z.ZodString;
141
+ credentialVersion: z.ZodNumber;
142
+ createdAt: z.ZodString;
143
+ updatedAt: z.ZodString;
144
+ }, z.core.$strip>;
145
+ export type CreateChatConnectionBody = z.input<typeof createChatConnectionBodySchema>;
146
+ export type ChatCredentials = z.output<typeof chatCredentialsSchema>;
147
+ export type ChatConfiguration = z.output<typeof chatConfigurationSchema>;
148
+ export type ChatHealth = z.output<typeof chatHealthSchema>;
149
+ export type ChatIdentity = z.output<typeof chatIdentitySchema>;
150
+ export type ChatConnection = z.output<typeof chatConnectionSchema>;
151
+ export type UpdateChatConnectionBody = z.output<typeof updateChatConnectionBodySchema>;
152
+ export declare const chatConnectionsResponseSchema: z.ZodObject<{
153
+ chatConnections: z.ZodArray<z.ZodObject<{
154
+ id: z.ZodString;
155
+ tenantId: z.ZodString;
156
+ agentId: z.ZodString;
157
+ name: z.ZodString;
158
+ platform: z.ZodEnum<{
159
+ slack: "slack";
160
+ telegram: "telegram";
161
+ }>;
162
+ enabled: z.ZodBoolean;
163
+ configuration: z.ZodDiscriminatedUnion<[z.ZodObject<{
164
+ teamId: z.ZodString;
165
+ appId: z.ZodString;
166
+ webhookUrl: z.ZodURL;
167
+ channelIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
168
+ platform: z.ZodLiteral<"slack">;
169
+ }, z.core.$strip>, z.ZodObject<{
170
+ botId: z.ZodString;
171
+ webhookUrl: z.ZodURL;
172
+ chatIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
173
+ platform: z.ZodLiteral<"telegram">;
174
+ }, z.core.$strip>], "platform">;
175
+ identity: z.ZodObject<{
176
+ botId: z.ZodString;
177
+ botUserId: z.ZodString;
178
+ teamId: z.ZodNullable<z.ZodString>;
179
+ appId: z.ZodNullable<z.ZodString>;
180
+ }, z.core.$strip>;
181
+ health: z.ZodObject<{
182
+ checkedAt: z.ZodString;
183
+ tokenValid: z.ZodBoolean;
184
+ identityVerified: z.ZodBoolean;
185
+ checks: z.ZodArray<z.ZodObject<{
186
+ code: z.ZodString;
187
+ status: z.ZodEnum<{
188
+ fail: "fail";
189
+ pass: "pass";
190
+ unknown: "unknown";
191
+ }>;
192
+ subject: z.ZodOptional<z.ZodString>;
193
+ }, z.core.$strip>>;
194
+ }, z.core.$strip>;
195
+ credentialFragment: z.ZodString;
196
+ credentialVersion: z.ZodNumber;
197
+ createdAt: z.ZodString;
198
+ updatedAt: z.ZodString;
199
+ }, z.core.$strip>>;
200
+ }, z.core.$strip>;
201
+ export type ChatConnectionsResponse = z.output<typeof chatConnectionsResponseSchema>;
202
+ export type RotateChatConnectionBody = z.input<typeof rotateChatConnectionBodySchema>;
@@ -0,0 +1,142 @@
1
+ import { z } from "zod";
2
+ import { agentIdSchema, chatConnectionIdSchema, tenantIdSchema, } from "../ids.js";
3
+ const webhookUrl = z
4
+ .url()
5
+ .max(2048)
6
+ .refine((value) => {
7
+ const url = new URL(value);
8
+ return (url.protocol === "https:" &&
9
+ !url.username &&
10
+ !url.password &&
11
+ !url.search &&
12
+ !url.hash);
13
+ }, "Use an HTTPS callback URL without credentials, query or fragment");
14
+ const secret = z
15
+ .string()
16
+ .min(8)
17
+ .max(8192)
18
+ .regex(/^[!-~]+$/);
19
+ export const chatCredentialsSchema = z.discriminatedUnion("platform", [
20
+ z
21
+ .object({
22
+ platform: z.literal("slack"),
23
+ botToken: secret,
24
+ signingSecret: z.string().regex(/^[0-9a-f]{32}$/),
25
+ })
26
+ .strict(),
27
+ z
28
+ .object({
29
+ platform: z.literal("telegram"),
30
+ botToken: z.string().regex(/^\d+:[A-Za-z0-9_-]+$/),
31
+ webhookSecret: z
32
+ .string()
33
+ .min(1)
34
+ .max(256)
35
+ .regex(/^[A-Za-z0-9_-]+$/),
36
+ })
37
+ .strict(),
38
+ ]);
39
+ const slackConfiguration = z
40
+ .object({
41
+ teamId: z.string().regex(/^T[A-Z0-9]+$/),
42
+ appId: z.string().regex(/^A[A-Z0-9]+$/),
43
+ webhookUrl,
44
+ channelIds: z
45
+ .array(z.string().regex(/^[CG][A-Z0-9]+$/))
46
+ .max(20)
47
+ .default([]),
48
+ })
49
+ .strict();
50
+ const telegramConfiguration = z
51
+ .object({
52
+ botId: z.string().regex(/^\d+$/),
53
+ webhookUrl,
54
+ chatIds: z
55
+ .array(z.string().regex(/^-?\d+$/))
56
+ .max(20)
57
+ .default([]),
58
+ })
59
+ .strict();
60
+ export const chatConfigurationSchema = z.discriminatedUnion("platform", [
61
+ slackConfiguration.extend({ platform: z.literal("slack") }),
62
+ telegramConfiguration.extend({ platform: z.literal("telegram") }),
63
+ ]);
64
+ const common = {
65
+ agentId: agentIdSchema,
66
+ name: z.string().trim().min(1).max(80),
67
+ enabled: z.boolean().default(true),
68
+ };
69
+ export const createChatConnectionBodySchema = z.discriminatedUnion("platform", [
70
+ z
71
+ .object({
72
+ ...common,
73
+ platform: z.literal("slack"),
74
+ configuration: slackConfiguration,
75
+ credentials: chatCredentialsSchema.options[0].omit({ platform: true }),
76
+ })
77
+ .strict(),
78
+ z
79
+ .object({
80
+ ...common,
81
+ platform: z.literal("telegram"),
82
+ configuration: telegramConfiguration,
83
+ credentials: chatCredentialsSchema.options[1].omit({ platform: true }),
84
+ })
85
+ .strict(),
86
+ ]);
87
+ export const rotateChatConnectionBodySchema = chatCredentialsSchema;
88
+ export const updateChatConnectionBodySchema = z
89
+ .object({ name: common.name.optional(), webhookUrl: webhookUrl.optional() })
90
+ .strict()
91
+ .refine((body) => body.name !== undefined || body.webhookUrl !== undefined, {
92
+ message: "Provide a name or webhook URL",
93
+ });
94
+ export const chatConnectionParamsSchema = z.object({
95
+ id: chatConnectionIdSchema,
96
+ });
97
+ export const chatHealthCheckSchema = z
98
+ .object({
99
+ code: z.string(),
100
+ status: z.enum(["pass", "fail", "unknown"]),
101
+ subject: z.string().optional(),
102
+ })
103
+ .strip();
104
+ export const chatHealthSchema = z
105
+ .object({
106
+ checkedAt: z.string(),
107
+ tokenValid: z.boolean(),
108
+ identityVerified: z.boolean(),
109
+ checks: z.array(chatHealthCheckSchema),
110
+ })
111
+ .strip();
112
+ export const chatIdentitySchema = z
113
+ .object({
114
+ botId: z.string(),
115
+ botUserId: z.string(),
116
+ teamId: z.string().nullable(),
117
+ appId: z.string().nullable(),
118
+ })
119
+ .strip();
120
+ export const chatConnectionSchema = z
121
+ .object({
122
+ id: chatConnectionIdSchema,
123
+ tenantId: tenantIdSchema,
124
+ agentId: agentIdSchema,
125
+ name: common.name,
126
+ platform: z.enum(["slack", "telegram"]),
127
+ enabled: z.boolean(),
128
+ configuration: z.discriminatedUnion("platform", [
129
+ chatConfigurationSchema.options[0].strip(),
130
+ chatConfigurationSchema.options[1].strip(),
131
+ ]),
132
+ identity: chatIdentitySchema,
133
+ health: chatHealthSchema,
134
+ credentialFragment: z.string().max(4),
135
+ credentialVersion: z.number().int().nonnegative(),
136
+ createdAt: z.string(),
137
+ updatedAt: z.string(),
138
+ })
139
+ .strip();
140
+ export const chatConnectionsResponseSchema = z
141
+ .object({ chatConnections: z.array(chatConnectionSchema) })
142
+ .strip();
@@ -55,3 +55,4 @@ export declare const apiKeyDigestSchema: z.ZodString;
55
55
  export declare const apiKeyFragmentSchema: z.ZodString;
56
56
  export declare const providerKeyFragmentSchema: z.ZodString;
57
57
  export type TurnId = z.infer<typeof turnIdSchema>;
58
+ export declare const chatConnectionIdSchema: z.ZodString;
@@ -77,3 +77,4 @@ export const apiKeyDigestSchema = z.string().regex(/^[0-9a-f]{64}$/);
77
77
  export const apiKeyFragmentSchema = z.string().regex(/^ba_[0-9A-Za-z]{2}$/);
78
78
  // Provider key fragment — last 4 chars of the secret, display-only.
79
79
  export const providerKeyFragmentSchema = z.string().min(1).max(4);
80
+ export const chatConnectionIdSchema = z.string().regex(/^cc_[0-9A-Za-z]{16}$/);
@@ -7,6 +7,7 @@ export { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsLis
7
7
  export { attributionCreateInputSchema, metadataSchema, } from "./entities/attribution.ts";
8
8
  export type { PromptVariables, UsageSummary } from "./entities/chat.ts";
9
9
  export { blazingAgentsChatMessageMetadataSchema, chatModeSchema, chatRequestBodySchema, chatTriggerSchema, generationRequestBodySchema, jsonSchemaShapeSchema, promptVariablesSchema, usageSummarySchema, } from "./entities/chat.ts";
10
+ export { chatConfigurationSchema, chatConnectionSchema, chatConnectionsResponseSchema, chatCredentialsSchema, chatHealthCheckSchema, chatHealthSchema, chatIdentitySchema, createChatConnectionBodySchema, rotateChatConnectionBodySchema, updateChatConnectionBodySchema, } from "./entities/chat-connections.ts";
10
11
  export { approveMcpOauthAuthorizationBodySchema, createMcpConnectionBodySchema, mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, mcpConnectionAuthTypeSchema, mcpConnectionOauthConnectResponseSchema, mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionStatusSchema, mcpConnectionsResponseSchema, mcpConnectionTestErrorCodeSchema, mcpConnectionTestResponseSchema, mcpOauthAuthorizationLaunchResponseSchema, reconnectMcpConnectionBodySchema, updateMcpAttachmentBodySchema, updateMcpConnectionBodySchema, } from "./entities/mcp-connections.ts";
11
12
  export { createMemoryBodySchema, memoriesListResponseSchema, memoryResponseSchema, memorySchema, updateMemoryBodySchema, } from "./entities/memories.ts";
12
13
  export { createPromptBodySchema, promptResponseSchema, promptSchema, promptsResponseSchema, updatePromptBodySchema, } from "./entities/prompts.ts";
@@ -6,6 +6,7 @@ export { agentResponseSchema, agentSchema, agentStatusSchema, agentsResponseSche
6
6
  export { artifactDownloadUrlResponseSchema, artifactListItemSchema, artifactsListResponseSchema, } from "./entities/artifacts.js";
7
7
  export { attributionCreateInputSchema, metadataSchema, } from "./entities/attribution.js";
8
8
  export { blazingAgentsChatMessageMetadataSchema, chatModeSchema, chatRequestBodySchema, chatTriggerSchema, generationRequestBodySchema, jsonSchemaShapeSchema, promptVariablesSchema, usageSummarySchema, } from "./entities/chat.js";
9
+ export { chatConfigurationSchema, chatConnectionSchema, chatConnectionsResponseSchema, chatCredentialsSchema, chatHealthCheckSchema, chatHealthSchema, chatIdentitySchema, createChatConnectionBodySchema, rotateChatConnectionBodySchema, updateChatConnectionBodySchema, } from "./entities/chat-connections.js";
9
10
  export { approveMcpOauthAuthorizationBodySchema, createMcpConnectionBodySchema, mcpAttachmentResponseSchema, mcpAttachmentsResponseSchema, mcpConnectionAuthTypeSchema, mcpConnectionOauthConnectResponseSchema, mcpConnectionReconnectResultSchema, mcpConnectionResponseSchema, mcpConnectionStatusSchema, mcpConnectionsResponseSchema, mcpConnectionTestErrorCodeSchema, mcpConnectionTestResponseSchema, mcpOauthAuthorizationLaunchResponseSchema, reconnectMcpConnectionBodySchema, updateMcpAttachmentBodySchema, updateMcpConnectionBodySchema, } from "./entities/mcp-connections.js";
10
11
  export { createMemoryBodySchema, memoriesListResponseSchema, memoryResponseSchema, memorySchema, updateMemoryBodySchema, } from "./entities/memories.js";
11
12
  export { createPromptBodySchema, promptResponseSchema, promptSchema, promptsResponseSchema, updatePromptBodySchema, } from "./entities/prompts.js";
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export { BlazingAgents } from "./client.ts";
12
12
  export type { ApprovalDecision, ApprovalPolicy, ToolReference, } from "./contracts/entities/agent-approval.ts";
13
13
  export type { Agent, AgentResponse, AgentsResponse, AgentVersion, AgentVersionsListQuery, AgentVersionsResponse, CreateAgentBody, UpdateAgentBody, } from "./contracts/entities/agents.ts";
14
14
  export type { ArtifactDownloadUrlResponse, ArtifactListItem, ArtifactsListResponse, } from "./contracts/entities/artifacts.ts";
15
+ export type { ChatConfiguration, ChatConnection, ChatConnectionsResponse, ChatCredentials, ChatHealth, ChatIdentity, CreateChatConnectionBody, RotateChatConnectionBody, UpdateChatConnectionBody, } from "./contracts/entities/chat-connections.ts";
15
16
  export type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResponse, McpConnectionAuthType, McpConnectionOauthConnectResponse, McpConnectionReconnectResult, McpConnectionResponse, McpConnectionStatus, McpConnectionTestResponse, ReconnectMcpConnectionBody, UpdateMcpAttachmentBody, UpdateMcpConnectionBody, } from "./contracts/entities/mcp-connections.ts";
16
17
  export type { CreateProviderBody, ProviderListItem, ProviderModel, ProviderModelsResponse, ProviderResponse, ProvidersResponse, ProviderType, ThinkingLevelsResponse, UpdateProviderBody, } from "./contracts/entities/providers.ts";
17
18
  export type { ToolApprovalDecisionResponse, ToolApprovalState, ToolApprovalsResponse, } from "./contracts/entities/sessions.ts";
@@ -20,4 +21,4 @@ export type { CreateWorkspaceBody, UpdateWorkspaceBody, Workspace, WorkspaceNetw
20
21
  export { BlazingAgentsDirectChatTransport, type BlazingAgentsDirectChatTransportOptions, } from "./direct-chat-transport.ts";
21
22
  export { BlazingAgentsError } from "./errors.ts";
22
23
  export { createChatRelay, createCompletionRelay, type RelayContext, type SessionOwnershipStore, } from "./relay.ts";
23
- export type { AgentClient, AgentSkillsResource, AgentsListOptions, AgentsResource, AgentVersionsListOptions, ArtifactsResource, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, ChatInput, ChatMessageInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, KnownBlazingAgentsErrorCode, LatestSessionsListOptions, McpConnectionsResource, MemoriesListOptions, MemoriesResource, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, PromptsResource, ProvidersResource, ResourceRequestOptions, ResponseObservation, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
24
+ export type { AgentClient, AgentSkillsResource, AgentsListOptions, AgentsResource, AgentVersionsListOptions, ArtifactsResource, AttributionInput, BlazingAgentsErrorCode, BlazingAgentsOptions, BlazingAgentsRequestOptions, BlazingAgentsUIMessage, BlazingAgentsUIMessageChunk, ChatConnectionsResource, ChatInput, ChatMessageInput, ChatPromptInput, ChatResult, ChatTrigger, CompletionInput, CompletionPromptIdInput, CompletionPromptInput, CompletionResult, KnownBlazingAgentsErrorCode, LatestSessionsListOptions, McpConnectionsResource, MemoriesListOptions, MemoriesResource, ObjectInput, ObjectPromptIdInput, ObjectPromptInput, ObjectResult, PromptsResource, ProvidersResource, ResourceRequestOptions, ResponseObservation, SessionsResource, SkillsListOptions, TasksResource, TenantResource, TerminalStreamResult, UsageResource, WorkspacesListOptions, WorkspacesResource, } from "./types.ts";
@@ -0,0 +1,2 @@
1
+ import type { ChatConnectionsResource, HttpConfig } from "../types.ts";
2
+ export declare function createChatConnectionsResource(config: HttpConfig): ChatConnectionsResource;
@@ -0,0 +1,33 @@
1
+ import { chatConnectionSchema, chatConnectionsResponseSchema, } from "../contracts/entities/chat-connections.js";
2
+ import { requestJson } from "../http.js";
3
+ export function createChatConnectionsResource(config) {
4
+ return {
5
+ async list({ abortSignal } = {}) {
6
+ return await requestJson(config, "/v1/chat-connections", { signal: abortSignal }, chatConnectionsResponseSchema);
7
+ },
8
+ async create({ abortSignal, ...body }) {
9
+ return await requestJson(config, "/v1/chat-connections", { signal: abortSignal, method: "POST", json: body }, chatConnectionSchema);
10
+ },
11
+ async get({ chatConnectionId, abortSignal }) {
12
+ return await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}`, { signal: abortSignal, method: "GET" }, chatConnectionSchema);
13
+ },
14
+ async update({ chatConnectionId, abortSignal, ...body }) {
15
+ return await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}`, { signal: abortSignal, method: "PATCH", json: body }, chatConnectionSchema);
16
+ },
17
+ async rotateCredentials({ chatConnectionId, abortSignal, ...body }) {
18
+ return await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}/credentials`, { signal: abortSignal, method: "POST", json: body }, chatConnectionSchema);
19
+ },
20
+ async checkHealth({ chatConnectionId, abortSignal }) {
21
+ return await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}/health`, { signal: abortSignal, method: "POST" }, chatConnectionSchema);
22
+ },
23
+ async enable({ chatConnectionId, abortSignal }) {
24
+ return await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}/enable`, { signal: abortSignal, method: "POST" }, chatConnectionSchema);
25
+ },
26
+ async disable({ chatConnectionId, abortSignal }) {
27
+ return await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}/disable`, { signal: abortSignal, method: "POST" }, chatConnectionSchema);
28
+ },
29
+ async delete({ chatConnectionId, abortSignal }) {
30
+ await requestJson(config, `/v1/chat-connections/${encodeURIComponent(chatConnectionId)}`, { signal: abortSignal, method: "DELETE" });
31
+ },
32
+ };
33
+ }
package/dist/types.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { ApiErrorCode } from "./contracts/api.ts";
3
3
  import type { Agent, AgentsResponse, AgentVersion, AgentVersionsResponse, CreateAgentBody, UpdateAgentBody } from "./contracts/entities/agents.ts";
4
4
  import type { ArtifactDownloadUrlResponse, ArtifactListItem, ArtifactsListResponse } from "./contracts/entities/artifacts.ts";
5
5
  import type { BlazingAgentsChatMessageMetadata } from "./contracts/entities/chat.ts";
6
+ import type { ChatConnection, ChatConnectionsResponse, CreateChatConnectionBody, RotateChatConnectionBody, UpdateChatConnectionBody } from "./contracts/entities/chat-connections.ts";
6
7
  import type { CreateMcpConnectionBody, McpAttachmentResponse, McpAttachmentsResponse, McpConnectionOauthConnectResponse, McpConnectionReconnectResult, McpConnectionResponse, McpConnectionsResponse, McpConnectionTestResponse, ReconnectMcpConnectionBody, UpdateMcpAttachmentBody, UpdateMcpConnectionBody } from "./contracts/entities/mcp-connections.ts";
7
8
  import type { CreateMemoryBody, MemoriesListResponse, MemoryResponse, UpdateMemoryBody } from "./contracts/entities/memories.ts";
8
9
  import type { CreatePromptBody, PromptResponse, PromptsResponse, UpdatePromptBody } from "./contracts/entities/prompts.ts";
@@ -511,4 +512,29 @@ export interface UsageResource {
511
512
  agentId: string;
512
513
  } & ResourceRequestOptions): Promise<UsageResponse>;
513
514
  }
515
+ export interface ChatConnectionsResource {
516
+ checkHealth(input: {
517
+ chatConnectionId: string;
518
+ } & ResourceRequestOptions): Promise<ChatConnection>;
519
+ create(input: CreateChatConnectionBody & ResourceRequestOptions): Promise<ChatConnection>;
520
+ delete(input: {
521
+ chatConnectionId: string;
522
+ } & ResourceRequestOptions): Promise<void>;
523
+ disable(input: {
524
+ chatConnectionId: string;
525
+ } & ResourceRequestOptions): Promise<ChatConnection>;
526
+ enable(input: {
527
+ chatConnectionId: string;
528
+ } & ResourceRequestOptions): Promise<ChatConnection>;
529
+ get(input: {
530
+ chatConnectionId: string;
531
+ } & ResourceRequestOptions): Promise<ChatConnection>;
532
+ list(input?: ResourceRequestOptions): Promise<ChatConnectionsResponse>;
533
+ rotateCredentials(input: RotateChatConnectionBody & {
534
+ chatConnectionId: string;
535
+ } & ResourceRequestOptions): Promise<ChatConnection>;
536
+ update(input: UpdateChatConnectionBody & {
537
+ chatConnectionId: string;
538
+ } & ResourceRequestOptions): Promise<ChatConnection>;
539
+ }
514
540
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazingagents/sdk",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "TypeScript SDK for the Blazing Agents API",
5
5
  "homepage": "https://docs.blazingagents.com",
6
6
  "bugs": {