@astralbeam/sdk 0.7.0 → 0.10.1
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 +45 -53
- package/dist/api-CaNIR6Af.js +296 -0
- package/dist/api.d.ts +333 -0
- package/dist/api.js +2 -0
- package/dist/client.d.ts +5 -5
- package/dist/client.js +1 -1
- package/dist/{core-BF1G1dLe.js → core-Dr2IDA6j.js} +33 -33
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/debug-BSzSiibd.js +1 -0
- package/dist/{index-CudekMKM.d.ts → index-BQBdZKyB.d.ts} +5 -5
- package/dist/react.d.ts +3 -3
- package/dist/react.js +5 -4
- package/dist/server.d.ts +18 -4
- package/dist/server.js +24 -7
- package/dist/widget-B6YT3G1i.js +79 -0
- package/package.json +15 -4
- package/dist/debug-DyjRg3e0.js +0 -1
- package/dist/widget-PZ-6BF36.js +0 -79
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
//#region src/api/api.d.ts
|
|
2
|
+
interface ApiRequestOptions extends RequestInit {
|
|
3
|
+
apiUrl?: string | undefined;
|
|
4
|
+
fetchClient?: typeof globalThis.fetch;
|
|
5
|
+
}
|
|
6
|
+
type ApiKeyOptions = ApiRequestOptions & {
|
|
7
|
+
apiKey: string;
|
|
8
|
+
astralBeamToken?: never;
|
|
9
|
+
};
|
|
10
|
+
type JwtOptions = ApiRequestOptions & {
|
|
11
|
+
astralBeamToken: string;
|
|
12
|
+
apiKey?: never;
|
|
13
|
+
};
|
|
14
|
+
type ApiOptions = ApiKeyOptions | JwtOptions;
|
|
15
|
+
type FileOptions = ApiRequestOptions & {
|
|
16
|
+
apiKey?: never;
|
|
17
|
+
astralBeamToken?: never;
|
|
18
|
+
};
|
|
19
|
+
interface AstralBeamApiError extends Error {
|
|
20
|
+
name: "AstralBeamApiError";
|
|
21
|
+
status: number;
|
|
22
|
+
headers: Headers;
|
|
23
|
+
body?: AstralBeamApiError$1;
|
|
24
|
+
}
|
|
25
|
+
declare function isAstralBeamApiError(error: unknown): error is AstralBeamApiError;
|
|
26
|
+
declare function astralBeamApiFetch<T>(path: string, options: ApiOptions): Promise<T>;
|
|
27
|
+
declare function astralBeamJwtFetch<T>(path: string, options: JwtOptions): Promise<T>;
|
|
28
|
+
declare function astralBeamChatFetch<_T>(path: string, options: JwtOptions): Promise<Response>;
|
|
29
|
+
declare function astralBeamFileFetch<_T>(path: string, options?: FileOptions): Promise<Response>;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/api/generated/api.d.ts
|
|
32
|
+
/**
|
|
33
|
+
* Customer-defined JSON object; keys are preserved.
|
|
34
|
+
*/
|
|
35
|
+
type TenantRecordEncodedMetadata = {
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Persisted Tenant; id is internal, external_id is the customer's exact identity.
|
|
40
|
+
*/
|
|
41
|
+
interface TenantRecordEncoded {
|
|
42
|
+
id: string;
|
|
43
|
+
external_id: string;
|
|
44
|
+
name: string | null;
|
|
45
|
+
/** Customer-defined JSON object; keys are preserved. */
|
|
46
|
+
metadata: TenantRecordEncodedMetadata;
|
|
47
|
+
created_at: string;
|
|
48
|
+
updated_at: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Live keyset page. Pass either non-null continuation value as the same-named request parameter.
|
|
52
|
+
*/
|
|
53
|
+
interface TenantPage {
|
|
54
|
+
items: TenantRecordEncoded[];
|
|
55
|
+
/** Pass as page_after to fetch the next page; null means no next page. */
|
|
56
|
+
page_after: string | null;
|
|
57
|
+
/** Pass as page_before to fetch the previous page; null means no previous page. */
|
|
58
|
+
page_before: string | null;
|
|
59
|
+
}
|
|
60
|
+
type AstralBeamApiErrorIssuesItem = {
|
|
61
|
+
path: string;
|
|
62
|
+
message: string;
|
|
63
|
+
};
|
|
64
|
+
interface AstralBeamApiError$1 {
|
|
65
|
+
type: string;
|
|
66
|
+
title: string;
|
|
67
|
+
status: number;
|
|
68
|
+
detail: string;
|
|
69
|
+
issues?: AstralBeamApiErrorIssuesItem[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object.
|
|
73
|
+
*/
|
|
74
|
+
type CreateTenantInputMetadata = {
|
|
75
|
+
[key: string]: unknown;
|
|
76
|
+
};
|
|
77
|
+
interface CreateTenantInput {
|
|
78
|
+
/**
|
|
79
|
+
* Your stable external identity. Exact and case-sensitive; whitespace is preserved. Immutable after creation.
|
|
80
|
+
* @minLength 1
|
|
81
|
+
* @maxLength 255
|
|
82
|
+
*/
|
|
83
|
+
external_id: string;
|
|
84
|
+
/** Defaults to null on creation. Send null to clear the name. */
|
|
85
|
+
name?: string | null;
|
|
86
|
+
/** Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object. */
|
|
87
|
+
metadata?: CreateTenantInputMetadata;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object.
|
|
91
|
+
*/
|
|
92
|
+
type UpdateTenantInputMetadata = {
|
|
93
|
+
[key: string]: unknown;
|
|
94
|
+
};
|
|
95
|
+
interface UpdateTenantInput {
|
|
96
|
+
/** Defaults to null on creation. Send null to clear the name. */
|
|
97
|
+
name?: string | null;
|
|
98
|
+
/** Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object. */
|
|
99
|
+
metadata?: UpdateTenantInputMetadata;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Customer-defined JSON object; keys are preserved.
|
|
103
|
+
*/
|
|
104
|
+
type TenantUserRecordEncodedMetadata = {
|
|
105
|
+
[key: string]: unknown;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Persisted TenantUser. Stored admin does not grant or revoke signed JWT authority.
|
|
109
|
+
*/
|
|
110
|
+
interface TenantUserRecordEncoded {
|
|
111
|
+
id: string;
|
|
112
|
+
external_id: string;
|
|
113
|
+
name: string | null;
|
|
114
|
+
/** Customer-defined JSON object; keys are preserved. */
|
|
115
|
+
metadata: TenantUserRecordEncodedMetadata;
|
|
116
|
+
created_at: string;
|
|
117
|
+
updated_at: string;
|
|
118
|
+
tenant_id: string;
|
|
119
|
+
admin: boolean;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Live keyset page in ascending ID order within one Tenant. Pass either non-null continuation value as the same-named request parameter.
|
|
123
|
+
*/
|
|
124
|
+
interface TenantUserPage {
|
|
125
|
+
items: TenantUserRecordEncoded[];
|
|
126
|
+
/** Pass as page_after to fetch the next page; null means no next page. */
|
|
127
|
+
page_after: string | null;
|
|
128
|
+
/** Pass as page_before to fetch the previous page; null means no previous page. */
|
|
129
|
+
page_before: string | null;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object.
|
|
133
|
+
*/
|
|
134
|
+
type CreateTenantUserInputMetadata = {
|
|
135
|
+
[key: string]: unknown;
|
|
136
|
+
};
|
|
137
|
+
interface CreateTenantUserInput {
|
|
138
|
+
/**
|
|
139
|
+
* Your stable external identity. Exact and case-sensitive; whitespace is preserved. Immutable after creation.
|
|
140
|
+
* @minLength 1
|
|
141
|
+
* @maxLength 255
|
|
142
|
+
*/
|
|
143
|
+
external_id: string;
|
|
144
|
+
/** Defaults to null on creation. Send null to clear the name. */
|
|
145
|
+
name?: string | null;
|
|
146
|
+
/** Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object. */
|
|
147
|
+
metadata?: CreateTenantUserInputMetadata;
|
|
148
|
+
/** Defaults to false on creation. Stored admin does not change signed JWT authority. */
|
|
149
|
+
admin?: boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object.
|
|
153
|
+
*/
|
|
154
|
+
type UpdateTenantUserInputMetadata = {
|
|
155
|
+
[key: string]: unknown;
|
|
156
|
+
};
|
|
157
|
+
interface UpdateTenantUserInput {
|
|
158
|
+
/** Defaults to null on creation. Send null to clear the name. */
|
|
159
|
+
name?: string | null;
|
|
160
|
+
/** Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object. */
|
|
161
|
+
metadata?: UpdateTenantUserInputMetadata;
|
|
162
|
+
/** Defaults to false on creation. Stored admin does not change signed JWT authority. */
|
|
163
|
+
admin?: boolean;
|
|
164
|
+
}
|
|
165
|
+
type ChatRunInputForwardedProps = {
|
|
166
|
+
[key: string]: unknown;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Legacy mirror of forwardedProps sent by TanStack AI clients.
|
|
170
|
+
*/
|
|
171
|
+
type ChatRunInputData = {
|
|
172
|
+
[key: string]: unknown;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* AG-UI RunAgentInput, validated by TanStack AI. Messages, tools, context, and resume entries follow AG-UI. forwardedProps accepts agentId and development-only debug. systemPrompt is rejected. Maximum request size: 32 MiB.
|
|
176
|
+
*/
|
|
177
|
+
interface ChatRunInput {
|
|
178
|
+
threadId: string;
|
|
179
|
+
runId: string;
|
|
180
|
+
messages: unknown[];
|
|
181
|
+
tools: unknown[];
|
|
182
|
+
context: unknown[];
|
|
183
|
+
forwardedProps?: ChatRunInputForwardedProps;
|
|
184
|
+
/** Legacy mirror of forwardedProps sent by TanStack AI clients. */
|
|
185
|
+
data?: ChatRunInputData;
|
|
186
|
+
state?: unknown;
|
|
187
|
+
parentRunId?: string;
|
|
188
|
+
resume?: unknown[];
|
|
189
|
+
}
|
|
190
|
+
type ChatConfigurationCapabilities = {
|
|
191
|
+
attachments: boolean;
|
|
192
|
+
};
|
|
193
|
+
interface ChatConfiguration {
|
|
194
|
+
capabilities: ChatConfigurationCapabilities;
|
|
195
|
+
}
|
|
196
|
+
type ListTenantsParams = {
|
|
197
|
+
/**
|
|
198
|
+
* Case-insensitive literal substring of name or external_id. Trimmed, blank means no search.
|
|
199
|
+
* @maxLength 255
|
|
200
|
+
* @pattern ^[^\u0000]*$
|
|
201
|
+
*/
|
|
202
|
+
q?: string;
|
|
203
|
+
/**
|
|
204
|
+
* Exact, case-sensitive external ID; whitespace is preserved. Returns zero or one item.
|
|
205
|
+
* @minLength 1
|
|
206
|
+
* @maxLength 255
|
|
207
|
+
*/
|
|
208
|
+
"filter[external_id]"?: string;
|
|
209
|
+
/**
|
|
210
|
+
* Positive integer, default 20. Values above 100 are accepted and capped. page_after and page_before are mutually exclusive.
|
|
211
|
+
* @minimum 1
|
|
212
|
+
*/
|
|
213
|
+
page_size?: number;
|
|
214
|
+
/**
|
|
215
|
+
* @minLength 1
|
|
216
|
+
* @maxLength 2048
|
|
217
|
+
*/
|
|
218
|
+
page_after?: string;
|
|
219
|
+
/**
|
|
220
|
+
* @minLength 1
|
|
221
|
+
* @maxLength 2048
|
|
222
|
+
*/
|
|
223
|
+
page_before?: string;
|
|
224
|
+
};
|
|
225
|
+
type ListUsersForTenantParams = {
|
|
226
|
+
/**
|
|
227
|
+
* Case-insensitive literal substring of name or external_id. Trimmed, blank means no search.
|
|
228
|
+
* @maxLength 255
|
|
229
|
+
* @pattern ^[^\u0000]*$
|
|
230
|
+
*/
|
|
231
|
+
q?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Exact, case-sensitive external ID; whitespace is preserved. Returns zero or one item.
|
|
234
|
+
* @minLength 1
|
|
235
|
+
* @maxLength 255
|
|
236
|
+
*/
|
|
237
|
+
"filter[external_id]"?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Positive integer, default 20. Values above 100 are accepted and capped. page_after and page_before are mutually exclusive.
|
|
240
|
+
* @minimum 1
|
|
241
|
+
*/
|
|
242
|
+
page_size?: number;
|
|
243
|
+
/**
|
|
244
|
+
* @minLength 1
|
|
245
|
+
* @maxLength 2048
|
|
246
|
+
*/
|
|
247
|
+
page_after?: string;
|
|
248
|
+
/**
|
|
249
|
+
* @minLength 1
|
|
250
|
+
* @maxLength 2048
|
|
251
|
+
*/
|
|
252
|
+
page_before?: string;
|
|
253
|
+
"filter[admin]"?: ListUsersForTenantFilterAdmin;
|
|
254
|
+
};
|
|
255
|
+
type ListUsersForTenantFilterAdmin = typeof ListUsersForTenantFilterAdmin[keyof typeof ListUsersForTenantFilterAdmin];
|
|
256
|
+
declare const ListUsersForTenantFilterAdmin: {
|
|
257
|
+
readonly true: "true";
|
|
258
|
+
readonly false: "false";
|
|
259
|
+
};
|
|
260
|
+
type GetChatConfigParams = {
|
|
261
|
+
agentId?: string;
|
|
262
|
+
};
|
|
263
|
+
type GetChatFileParams = {
|
|
264
|
+
ticket: string;
|
|
265
|
+
};
|
|
266
|
+
declare const getListTenantsUrl: (params: ListTenantsParams) => string;
|
|
267
|
+
/**
|
|
268
|
+
* List Tenants in internal ID order. q searches name or external ID as a case-insensitive literal substring. filter[external_id] adds an exact match. Organization keys and organization-management JWTs see their organization; admin tenant JWTs see only their signed Tenant. Keep filters unchanged when reusing cursors. Live listing, not a snapshot.
|
|
269
|
+
* @summary List Tenants
|
|
270
|
+
*/
|
|
271
|
+
declare const listTenants: (params: ListTenantsParams, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantPage>;
|
|
272
|
+
declare const getCreateTenantUrl: () => string;
|
|
273
|
+
/**
|
|
274
|
+
* Create a Tenant with an exact customer-provided external_id. Requires an organization API key or organization-management JWT with a current owner/developer role. An external_id already used in this organization returns 409; creation never upserts.
|
|
275
|
+
* @summary Create a Tenant
|
|
276
|
+
*/
|
|
277
|
+
declare const createTenant: (createTenantInput: CreateTenantInput, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantRecordEncoded>;
|
|
278
|
+
declare const getGetTenantUrl: (id: string) => string;
|
|
279
|
+
/**
|
|
280
|
+
* Get a Tenant by internal UUID, not external_id.
|
|
281
|
+
* @summary Get a Tenant
|
|
282
|
+
*/
|
|
283
|
+
declare const getTenant: (id: string, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantRecordEncoded>;
|
|
284
|
+
declare const getUpdateTenantUrl: (id: string) => string;
|
|
285
|
+
/**
|
|
286
|
+
* Update supplied name/metadata fields only. Requires an organization API key or organization-management JWT with a current owner/developer role. name:null clears the name; metadata replaces the object. Last-write-wins; no upsert.
|
|
287
|
+
* @summary Update a Tenant
|
|
288
|
+
*/
|
|
289
|
+
declare const updateTenant: (id: string, updateTenantInput: UpdateTenantInput, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantRecordEncoded>;
|
|
290
|
+
declare const getListUsersForTenantUrl: (tenantId: string, params: ListUsersForTenantParams) => string;
|
|
291
|
+
/**
|
|
292
|
+
* List users of one Tenant in internal ID order. q searches name or external ID as a case-insensitive literal substring. Exact filter[external_id] and filter[admin] combine with AND. No matching user returns an empty page; missing and out-of-scope Tenants return 404. Cursors cannot be reused for another Tenant or filter. Live listing, not a snapshot.
|
|
293
|
+
* @summary List TenantUsers
|
|
294
|
+
*/
|
|
295
|
+
declare const listUsersForTenant: (tenantId: string, params: ListUsersForTenantParams, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantUserPage>;
|
|
296
|
+
declare const getCreateTenantUserUrl: (tenantId: string) => string;
|
|
297
|
+
/**
|
|
298
|
+
* Create a TenantUser under the internal tenant_id path identifier, with a customer-provided tenant-local external_id. An external_id already used in this Tenant returns 409; the same external_id in another Tenant is allowed. Stored admin does not change signed JWT authority.
|
|
299
|
+
* @summary Create a TenantUser
|
|
300
|
+
*/
|
|
301
|
+
declare const createTenantUser: (tenantId: string, createTenantUserInput: CreateTenantUserInput, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantUserRecordEncoded>;
|
|
302
|
+
declare const getGetTenantUserUrl: (tenantId: string, id: string) => string;
|
|
303
|
+
/**
|
|
304
|
+
* Get a TenantUser by the internal tenant_id and id pair within the authorized scope. No identity upsert.
|
|
305
|
+
* @summary Get a TenantUser
|
|
306
|
+
*/
|
|
307
|
+
declare const getTenantUser: (tenantId: string, id: string, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantUserRecordEncoded>;
|
|
308
|
+
declare const getUpdateTenantUserUrl: (tenantId: string, id: string) => string;
|
|
309
|
+
/**
|
|
310
|
+
* Update supplied name/metadata/admin fields only. Stored admin does not grant or revoke JWT authority. name:null clears the name; metadata replaces the object.
|
|
311
|
+
* @summary Update a TenantUser
|
|
312
|
+
*/
|
|
313
|
+
declare const updateTenantUser: (tenantId: string, id: string, updateTenantUserInput: UpdateTenantUserInput, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantUserRecordEncoded>;
|
|
314
|
+
declare const getRunChatUrl: () => string;
|
|
315
|
+
/**
|
|
316
|
+
* Stream an AG-UI agent run using a tenant user JWT. No admin claim required. HTTP failures before streaming use AstralBeamApiError. Once streaming starts, failures use RUN_ERROR events. Tool results continue in a subsequent request. Disconnecting cancels the run. Limited to 20 requests per minute per organization, tenant, and user.
|
|
317
|
+
* @summary Run chat
|
|
318
|
+
*/
|
|
319
|
+
declare const runChat: (chatRunInput: ChatRunInput, options: Parameters<typeof astralBeamChatFetch>[1]) => Promise<Response>;
|
|
320
|
+
declare const getGetChatConfigUrl: (params: GetChatConfigParams) => string;
|
|
321
|
+
/**
|
|
322
|
+
* Read the selected agent's attachment grant using a tenant user JWT. Omit agentId to use the organization's default agent. Client settings may narrow this grant, never widen it.
|
|
323
|
+
* @summary Get chat capabilities
|
|
324
|
+
*/
|
|
325
|
+
declare const getChatConfig: (params: GetChatConfigParams, options: Parameters<typeof astralBeamJwtFetch>[1]) => Promise<ChatConfiguration>;
|
|
326
|
+
declare const getGetChatFileUrl: (params: GetChatFileParams) => string;
|
|
327
|
+
/**
|
|
328
|
+
* Use the signed ticket returned when chat publishes an artifact. No bearer token is required. Returns the original bytes with a content-sniffed Content-Type and Content-Disposition filename. Invalid or expired tickets, a missing sandbox, and rejected artifact checks return 404. Provider or file-read failures return 500.
|
|
329
|
+
* @summary Download a chat artifact
|
|
330
|
+
*/
|
|
331
|
+
declare const getChatFile: (params: GetChatFileParams, options?: Parameters<typeof astralBeamFileFetch>[1]) => Promise<Response>;
|
|
332
|
+
//#endregion
|
|
333
|
+
export { type ApiKeyOptions, type ApiOptions, type ApiRequestOptions, AstralBeamApiError, type AstralBeamApiError$1 as AstralBeamApiErrorBody, AstralBeamApiErrorIssuesItem, ChatConfiguration, ChatConfigurationCapabilities, ChatRunInput, ChatRunInputData, ChatRunInputForwardedProps, CreateTenantInput, CreateTenantInputMetadata, CreateTenantUserInput, CreateTenantUserInputMetadata, type FileOptions, GetChatConfigParams, GetChatFileParams, type JwtOptions, ListTenantsParams, ListUsersForTenantFilterAdmin, ListUsersForTenantParams, TenantPage, TenantRecordEncoded, TenantRecordEncodedMetadata, TenantUserPage, TenantUserRecordEncoded, TenantUserRecordEncodedMetadata, UpdateTenantInput, UpdateTenantInputMetadata, UpdateTenantUserInput, UpdateTenantUserInputMetadata, createTenant, createTenantUser, getChatConfig, getChatFile, getCreateTenantUrl, getCreateTenantUserUrl, getGetChatConfigUrl, getGetChatFileUrl, getGetTenantUrl, getGetTenantUserUrl, getListTenantsUrl, getListUsersForTenantUrl, getRunChatUrl, getTenant, getTenantUser, getUpdateTenantUrl, getUpdateTenantUserUrl, isAstralBeamApiError, listTenants, listUsersForTenant, runChat, updateTenant, updateTenantUser };
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as updateTenantUser, S as updateTenant, T as isAstralBeamApiError, _ as getUpdateTenantUrl, a as getChatFile, b as listUsersForTenant, c as getGetChatConfigUrl, d as getGetTenantUserUrl, f as getListTenantsUrl, g as getTenantUser, h as getTenant, i as getChatConfig, l as getGetChatFileUrl, m as getRunChatUrl, n as createTenant, o as getCreateTenantUrl, p as getListUsersForTenantUrl, r as createTenantUser, s as getCreateTenantUserUrl, t as ListUsersForTenantFilterAdmin, u as getGetTenantUrl, v as getUpdateTenantUserUrl, x as runChat, y as listTenants } from "./api-CaNIR6Af.js";
|
|
2
|
+
export { ListUsersForTenantFilterAdmin, createTenant, createTenantUser, getChatConfig, getChatFile, getCreateTenantUrl, getCreateTenantUserUrl, getGetChatConfigUrl, getGetChatFileUrl, getGetTenantUrl, getGetTenantUserUrl, getListTenantsUrl, getListUsersForTenantUrl, getRunChatUrl, getTenant, getTenantUser, getUpdateTenantUrl, getUpdateTenantUserUrl, isAstralBeamApiError, listTenants, listUsersForTenant, runChat, updateTenant, updateTenantUser };
|
package/dist/client.d.ts
CHANGED
|
@@ -104,7 +104,7 @@ type AstralBeamChatThemeVariables = Record<`--${string}`, string>;
|
|
|
104
104
|
* `credentials: "include"`, `cache: "no-store"`, and an `accept: application/json` header, each
|
|
105
105
|
* overridable here, and the response is expected to carry `{ token }` as JSON.
|
|
106
106
|
*/
|
|
107
|
-
interface
|
|
107
|
+
interface AstralBeamTokenRequest extends RequestInit {
|
|
108
108
|
url: string;
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
@@ -115,7 +115,7 @@ interface AstralBeamChatAuthTokenRequest extends RequestInit {
|
|
|
115
115
|
* rotating credential stays current rather than being captured once. A function that returns
|
|
116
116
|
* `undefined`, or throws, fails authentication closed; the composer's retry link asks again.
|
|
117
117
|
*/
|
|
118
|
-
type
|
|
118
|
+
type AstralBeamTokenSource = AstralBeamTokenRequest | (() => {
|
|
119
119
|
token: string;
|
|
120
120
|
} | undefined | Promise<{
|
|
121
121
|
token: string;
|
|
@@ -154,7 +154,7 @@ interface MountAstralBeamChatOptions {
|
|
|
154
154
|
/** Subtitle shown under the empty transcript's headline. Default describes the app's tools and widgets. */
|
|
155
155
|
emptyDescription?: string | undefined;
|
|
156
156
|
/**
|
|
157
|
-
* Base URL of the AstralBeam API; the widget calls `/chat` and its subroutes under it. Read for
|
|
157
|
+
* Base URL of the AstralBeam API; the widget calls `/v1/chat` and its subroutes under it. Read for
|
|
158
158
|
* every request, so a change moves the next one. Default `"https://app.astralbeam.ai/api"`, the
|
|
159
159
|
* hosted cloud; self-hosted deployments must set their own origin.
|
|
160
160
|
*/
|
|
@@ -165,7 +165,7 @@ interface MountAstralBeamChatOptions {
|
|
|
165
165
|
* change applies to the next one, which is minted when the cached token nears expiry. Default
|
|
166
166
|
* `{ url: "/api/astralbeam/token" }`, posted with the page's cookies.
|
|
167
167
|
*/
|
|
168
|
-
|
|
168
|
+
fetchAstralBeamToken?: AstralBeamTokenSource | undefined;
|
|
169
169
|
/** Host-defined tools the agent can call, executed in the host page, keyed by tool name. */
|
|
170
170
|
tools?: Record<string, ToolDefinition> | undefined;
|
|
171
171
|
/** Host-defined widgets the agent can render inline in the conversation, keyed by identifier. */
|
|
@@ -232,4 +232,4 @@ declare function defineWidget<const S extends ParametersSchema = JsonSchemaObjec
|
|
|
232
232
|
//#region src/client/index.d.ts
|
|
233
233
|
declare function mountAstralBeamChat(target: HTMLElement, options: MountAstralBeamChatOptions): AstralBeamChatHandle;
|
|
234
234
|
//#endregion
|
|
235
|
-
export { type AstralBeamChatAttachmentOptions, type
|
|
235
|
+
export { type AstralBeamChatAttachmentOptions, type AstralBeamChatColorScheme, type AstralBeamChatHandle, type AstralBeamChatSlotRenderer, type AstralBeamChatSlots, type AstralBeamChatTheme, type AstralBeamChatThemeVariables, type AstralBeamChatUpdate, type AstralBeamTokenRequest, type AstralBeamTokenSource, type InferParameters, type JsonSchemaObject, type MountAstralBeamChatOptions, type ParametersSchema, type StandardSchemaV1, type ToolDefinition, type TypedToolDefinition, type TypedWidgetDefinition, type WidgetDefinition, defineTool, defineWidget, mountAstralBeamChat };
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,t}from"./debug-
|
|
1
|
+
import{c as e,t}from"./debug-BSzSiibd.js";function n(e){return e}function r(e){return e}function i(n,r){let i={...r},a=t(i.debug);a?.(`mount`,`mounting chat widget`,{agentId:i.agentId??`(organization default)`,title:i.title??`AstralBeam`,showHeader:i.showHeader??!0,emptyTitle:i.emptyTitle??`Ask the assistant`,emptyDescription:i.emptyDescription??`It can answer questions and act through this app's own tools and widgets.`,apiUrl:i.apiUrl??`https://app.astralbeam.ai/api`,authentication:`configured`,colorScheme:i.colorScheme??`system`,theme:i.theme,tools:Object.keys(i.tools??{}),widgets:Object.keys(i.widgets??{}),attachments:i.attachments??!0});let o=n.shadowRoot??n.attachShadow({mode:`open`}),s=document.createElement(`div`);s.className=e,s.style.height=`100%`,o.append(s);let c=matchMedia(`(prefers-color-scheme: dark)`),l=new Set,u=e=>{for(let e of l)s.style.removeProperty(e);l.clear();let t={...i.theme?.light,...e?i.theme?.dark:void 0};for(let[e,n]of Object.entries(t))e.startsWith(`--`)&&(s.style.setProperty(e,n),l.add(e))},d=()=>{let e=i.colorScheme??`system`,t=e===`dark`||e===`system`&&c.matches;s.classList.toggle(`dark`,t),u(t),a?.(`theme`,`color scheme "${e}" resolved to ${t?`dark`:`light`}`,{themeVariables:[...l]})};d(),c.addEventListener(`change`,d);let f=!1,p;return import(`./widget-B6YT3G1i.js`).then(({renderChat:e})=>{a?.(`mount`,`chat chunk loaded`),f||(p=e(o,s,i))}),{update:e=>{i={...i,...e},a=t(i.debug),a?.(`mount`,`options updated`,{changed:Object.keys(e)}),d(),p?.update(i)},reset:()=>p?.reset(),stop:()=>p?.stop(),unmount:()=>{a?.(`mount`,`unmounting chat widget`),f=!0,c.removeEventListener(`change`,d),p?.dispose(),p=void 0,s.remove()}}}export{n as defineTool,r as defineWidget,i as mountAstralBeamChat};
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
+
import { E as resolveApiUrl, T as isAstralBeamApiError, i as getChatConfig, m as getRunChatUrl, w as astralBeamChatFetch } from "./api-CaNIR6Af.js";
|
|
1
2
|
//#region \0rolldown/runtime.js
|
|
2
3
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
3
|
-
/**
|
|
4
|
-
* The chat API's URLs under an API base: the stream itself, the agent capability handshake,
|
|
5
|
-
* and artifact downloads. Chat is one API under the base; others will sit beside it.
|
|
6
|
-
*/
|
|
7
|
-
function chatApiUrls(apiUrl) {
|
|
8
|
-
const chat = `${(apiUrl ?? "https://app.astralbeam.ai/api").replace(/\/+$/, "")}/chat`;
|
|
9
|
-
return {
|
|
10
|
-
chat,
|
|
11
|
-
config: `${chat}/config`,
|
|
12
|
-
files: `${chat}/files`
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
/** Color scheme used when the mount options and the React prop give none. */
|
|
16
|
-
const DEFAULT_COLOR_SCHEME = "system";
|
|
17
4
|
//#endregion
|
|
18
5
|
//#region node_modules/.deno/@tanstack+ai-client@0.28.0/node_modules/@tanstack/ai-client/dist/esm/response-stream.js
|
|
19
6
|
var UnsupportedResponseStreamError = class extends Error {
|
|
@@ -7862,9 +7849,9 @@ function bearerToken(headers) {
|
|
|
7862
7849
|
return authorization?.startsWith("Bearer ") ? authorization.slice(7) : void 0;
|
|
7863
7850
|
}
|
|
7864
7851
|
async function requestChatAuthToken(options, signal) {
|
|
7865
|
-
const {
|
|
7866
|
-
if (typeof
|
|
7867
|
-
const { url, ...init } =
|
|
7852
|
+
const { fetchAstralBeamToken, fetchClient } = options;
|
|
7853
|
+
if (typeof fetchAstralBeamToken === "function") return (await fetchAstralBeamToken())?.token;
|
|
7854
|
+
const { url, ...init } = fetchAstralBeamToken;
|
|
7868
7855
|
const headers = new Headers(init.headers);
|
|
7869
7856
|
if (!headers.has("accept")) headers.set("accept", "application/json");
|
|
7870
7857
|
const response = await fetchClient(url, {
|
|
@@ -7881,7 +7868,7 @@ async function requestChatAuthToken(options, signal) {
|
|
|
7881
7868
|
async function loadChatAuthToken(options) {
|
|
7882
7869
|
const { session, onStateChange, debug } = options;
|
|
7883
7870
|
const { signal } = session.abortController;
|
|
7884
|
-
const source = typeof options.
|
|
7871
|
+
const source = typeof options.fetchAstralBeamToken === "function" ? "fetchAstralBeamToken" : "Authentication endpoint";
|
|
7885
7872
|
try {
|
|
7886
7873
|
const token = await requestChatAuthToken(options, signal);
|
|
7887
7874
|
if (typeof token !== "string" || !token) throw new Error(`${source} did not return a token`);
|
|
@@ -8079,7 +8066,7 @@ function describeSandboxCommandRun(run) {
|
|
|
8079
8066
|
const CORE_OPTION_KEYS = Object.keys({
|
|
8080
8067
|
agentId: true,
|
|
8081
8068
|
apiUrl: true,
|
|
8082
|
-
|
|
8069
|
+
fetchAstralBeamToken: true,
|
|
8083
8070
|
tools: true,
|
|
8084
8071
|
widgets: true,
|
|
8085
8072
|
onRenderWidget: true,
|
|
@@ -8119,7 +8106,7 @@ function createAstralBeamChat(options) {
|
|
|
8119
8106
|
for (const listener of listeners) listener();
|
|
8120
8107
|
};
|
|
8121
8108
|
const authentication = {
|
|
8122
|
-
|
|
8109
|
+
fetchAstralBeamToken: live.fetchAstralBeamToken ?? { url: "/api/astralbeam/token" },
|
|
8123
8110
|
session: {
|
|
8124
8111
|
cached: void 0,
|
|
8125
8112
|
refreshPromise: void 0,
|
|
@@ -8134,12 +8121,11 @@ function createAstralBeamChat(options) {
|
|
|
8134
8121
|
const resolveCapabilities = async () => {
|
|
8135
8122
|
const generation = ++capabilitiesGeneration;
|
|
8136
8123
|
try {
|
|
8137
|
-
const url = new URL(chatApiUrls(live.apiUrl).config, globalThis.location?.href);
|
|
8138
|
-
if (live.agentId) url.searchParams.set("agentId", live.agentId);
|
|
8139
8124
|
const token = await getValidChatAuthToken(authentication);
|
|
8140
|
-
const
|
|
8141
|
-
|
|
8142
|
-
|
|
8125
|
+
const body = await getChatConfig(live.agentId ? { agentId: live.agentId } : {}, {
|
|
8126
|
+
apiUrl: live.apiUrl,
|
|
8127
|
+
astralBeamToken: token
|
|
8128
|
+
});
|
|
8143
8129
|
if (generation !== capabilitiesGeneration) return;
|
|
8144
8130
|
const attachments = body.capabilities?.attachments !== false;
|
|
8145
8131
|
update({ capabilities: { attachments } });
|
|
@@ -8198,15 +8184,29 @@ function createAstralBeamChat(options) {
|
|
|
8198
8184
|
...live.agentId ? { agentId: live.agentId } : {},
|
|
8199
8185
|
...live.debug ? { debug: true } : {}
|
|
8200
8186
|
});
|
|
8201
|
-
const
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8187
|
+
const connection = fetchServerSentEvents(() => resolveApiUrl(getRunChatUrl(), live.apiUrl), async () => {
|
|
8188
|
+
const token = await getValidChatAuthToken(authentication);
|
|
8189
|
+
return { fetchClient: (_input, init) => astralBeamChatFetch(getRunChatUrl(), {
|
|
8190
|
+
...init,
|
|
8191
|
+
apiUrl: live.apiUrl,
|
|
8192
|
+
astralBeamToken: token,
|
|
8193
|
+
fetchClient: (input, request) => fetchAuthenticatedChat({
|
|
8205
8194
|
...authentication,
|
|
8206
8195
|
input,
|
|
8207
|
-
init
|
|
8196
|
+
init: request
|
|
8208
8197
|
})
|
|
8209
|
-
})
|
|
8198
|
+
}) };
|
|
8199
|
+
});
|
|
8200
|
+
const connect = connection.connect;
|
|
8201
|
+
connection.connect = async function* (...args) {
|
|
8202
|
+
try {
|
|
8203
|
+
yield* connect(...args);
|
|
8204
|
+
} catch (error) {
|
|
8205
|
+
throw error instanceof Error && isAstralBeamApiError(error.cause) ? error.cause : error;
|
|
8206
|
+
}
|
|
8207
|
+
};
|
|
8208
|
+
const client = new ChatClient({
|
|
8209
|
+
connection,
|
|
8210
8210
|
tools: declareTools(),
|
|
8211
8211
|
forwardedProps: forwardedProps(),
|
|
8212
8212
|
onMessagesChange: (messages) => {
|
|
@@ -8273,7 +8273,7 @@ function createAstralBeamChat(options) {
|
|
|
8273
8273
|
...next
|
|
8274
8274
|
};
|
|
8275
8275
|
debug = createDebugLogger(live.debug);
|
|
8276
|
-
authentication.
|
|
8276
|
+
authentication.fetchAstralBeamToken = live.fetchAstralBeamToken ?? { url: "/api/astralbeam/token" };
|
|
8277
8277
|
authentication.debug = debug;
|
|
8278
8278
|
client.updateOptions({
|
|
8279
8279
|
tools: declareTools(),
|
|
@@ -8323,4 +8323,4 @@ function defineTool(tool) {
|
|
|
8323
8323
|
return tool;
|
|
8324
8324
|
}
|
|
8325
8325
|
//#endregion
|
|
8326
|
-
export {
|
|
8326
|
+
export { SANDBOX_WRITE_FILE_TOOL as S, SANDBOX_LIST_FILES_TOOL as _, describeSandboxCommandRun as a, SANDBOX_RUN_COMMAND_TOOL as b, readSandboxCommandRun as c, hasPendingToolRun as d, isSettledToolCall as f, RENDER_WIDGET_TOOL as g, ASK_QUESTIONNAIRE_TOOL as h, collectSandboxActivity as i, readSandboxFileWrite as l, buildAgentTools as m, CORE_OPTION_KEYS as n, isSandboxTool as o, lastPartInProgress as p, createAstralBeamChat as r, readSandboxArtifact as s, defineTool as t, sandboxRefusal as u, SANDBOX_PUBLISH_ARTIFACT_TOOL as v, SANDBOX_STATUS_EVENT as x, SANDBOX_READ_FILE_TOOL as y };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as RenderWidgetInput, B as ToolDefinition, C as AstralBeamChatState, D as ChatAuthenticationState, E as createAstralBeamChat, F as SandboxStatus, I as InferParameters, L as JsonSchemaObject, M as SandboxArtifact, N as SandboxCommandRun, O as WidgetDeclaration, P as SandboxFileWrite, R as ParametersSchema, S as AstralBeamChatCoreOptions, T as WidgetRenderRequest, _ as hasPendingToolRun, a as SANDBOX_PUBLISH_ARTIFACT_TOOL, b as AgentToolInfo, c as SANDBOX_STATUS_EVENT, d as describeSandboxCommandRun, f as isSandboxTool, g as sandboxRefusal, h as readSandboxFileWrite, i as SANDBOX_LIST_FILES_TOOL, j as SandboxActivity, k as buildAgentTools, l as SANDBOX_WRITE_FILE_TOOL, m as readSandboxCommandRun, n as ASK_QUESTIONNAIRE_TOOL, o as SANDBOX_READ_FILE_TOOL, p as readSandboxArtifact, r as RENDER_WIDGET_TOOL, s as SANDBOX_RUN_COMMAND_TOOL, t as defineTool, u as collectSandboxActivity, v as isSettledToolCall, w as ChatStreamCallbacks, x as AstralBeamChatCore, y as lastPartInProgress, z as StandardSchemaV1 } from "./index-
|
|
1
|
+
import { A as RenderWidgetInput, B as ToolDefinition, C as AstralBeamChatState, D as ChatAuthenticationState, E as createAstralBeamChat, F as SandboxStatus, I as InferParameters, L as JsonSchemaObject, M as SandboxArtifact, N as SandboxCommandRun, O as WidgetDeclaration, P as SandboxFileWrite, R as ParametersSchema, S as AstralBeamChatCoreOptions, T as WidgetRenderRequest, _ as hasPendingToolRun, a as SANDBOX_PUBLISH_ARTIFACT_TOOL, b as AgentToolInfo, c as SANDBOX_STATUS_EVENT, d as describeSandboxCommandRun, f as isSandboxTool, g as sandboxRefusal, h as readSandboxFileWrite, i as SANDBOX_LIST_FILES_TOOL, j as SandboxActivity, k as buildAgentTools, l as SANDBOX_WRITE_FILE_TOOL, m as readSandboxCommandRun, n as ASK_QUESTIONNAIRE_TOOL, o as SANDBOX_READ_FILE_TOOL, p as readSandboxArtifact, r as RENDER_WIDGET_TOOL, s as SANDBOX_RUN_COMMAND_TOOL, t as defineTool, u as collectSandboxActivity, v as isSettledToolCall, w as ChatStreamCallbacks, x as AstralBeamChatCore, y as lastPartInProgress, z as StandardSchemaV1 } from "./index-BQBdZKyB.js";
|
|
2
2
|
export { ASK_QUESTIONNAIRE_TOOL, type AgentToolInfo, type AstralBeamChatCore, type AstralBeamChatCoreOptions, type AstralBeamChatState, type ChatAuthenticationState, type ChatStreamCallbacks, type InferParameters, type JsonSchemaObject, type ParametersSchema, RENDER_WIDGET_TOOL, type RenderWidgetInput, SANDBOX_LIST_FILES_TOOL, SANDBOX_PUBLISH_ARTIFACT_TOOL, SANDBOX_READ_FILE_TOOL, SANDBOX_RUN_COMMAND_TOOL, SANDBOX_STATUS_EVENT, SANDBOX_WRITE_FILE_TOOL, type SandboxActivity, type SandboxArtifact, type SandboxCommandRun, type SandboxFileWrite, type SandboxStatus, type StandardSchemaV1, type ToolDefinition, type WidgetDeclaration, type WidgetRenderRequest, buildAgentTools, collectSandboxActivity, createAstralBeamChat, defineTool, describeSandboxCommandRun, hasPendingToolRun, isSandboxTool, isSettledToolCall, lastPartInProgress, readSandboxArtifact, readSandboxCommandRun, readSandboxFileWrite, sandboxRefusal };
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { S as SANDBOX_WRITE_FILE_TOOL, _ as SANDBOX_LIST_FILES_TOOL, a as describeSandboxCommandRun, b as SANDBOX_RUN_COMMAND_TOOL, c as readSandboxCommandRun, d as hasPendingToolRun, f as isSettledToolCall, g as RENDER_WIDGET_TOOL, h as ASK_QUESTIONNAIRE_TOOL, i as collectSandboxActivity, l as readSandboxFileWrite, m as buildAgentTools, o as isSandboxTool, p as lastPartInProgress, r as createAstralBeamChat, s as readSandboxArtifact, t as defineTool, u as sandboxRefusal, v as SANDBOX_PUBLISH_ARTIFACT_TOOL, x as SANDBOX_STATUS_EVENT, y as SANDBOX_READ_FILE_TOOL } from "./core-
|
|
1
|
+
import { S as SANDBOX_WRITE_FILE_TOOL, _ as SANDBOX_LIST_FILES_TOOL, a as describeSandboxCommandRun, b as SANDBOX_RUN_COMMAND_TOOL, c as readSandboxCommandRun, d as hasPendingToolRun, f as isSettledToolCall, g as RENDER_WIDGET_TOOL, h as ASK_QUESTIONNAIRE_TOOL, i as collectSandboxActivity, l as readSandboxFileWrite, m as buildAgentTools, o as isSandboxTool, p as lastPartInProgress, r as createAstralBeamChat, s as readSandboxArtifact, t as defineTool, u as sandboxRefusal, v as SANDBOX_PUBLISH_ARTIFACT_TOOL, x as SANDBOX_STATUS_EVENT, y as SANDBOX_READ_FILE_TOOL } from "./core-Dr2IDA6j.js";
|
|
2
2
|
export { ASK_QUESTIONNAIRE_TOOL, RENDER_WIDGET_TOOL, SANDBOX_LIST_FILES_TOOL, SANDBOX_PUBLISH_ARTIFACT_TOOL, SANDBOX_READ_FILE_TOOL, SANDBOX_RUN_COMMAND_TOOL, SANDBOX_STATUS_EVENT, SANDBOX_WRITE_FILE_TOOL, buildAgentTools, collectSandboxActivity, createAstralBeamChat, defineTool, describeSandboxCommandRun, hasPendingToolRun, isSandboxTool, isSettledToolCall, lastPartInProgress, readSandboxArtifact, readSandboxCommandRun, readSandboxFileWrite, sandboxRefusal };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`AstralBeam`,t=`Ask the assistant`,n=`It can answer questions and act through this app's own tools and widgets.`,r=`https://app.astralbeam.ai/api`,i=`/api/astralbeam/token`,a=`system`,o=`astralbeam-root`,s=e=>`background:${e};color:#fff;border-radius:3px;padding:1px 5px`,c=`${s(`#7c3aed`)};font-weight:600`,l={mount:`#7c3aed`,auth:`#be185d`,theme:`#8b5cf6`,send:`#2563eb`,run:`#0891b2`,stream:`#0e7490`,text:`#16a34a`,reasoning:`#64748b`,tool:`#d97706`,widget:`#db2777`,attachment:`#0d9488`,sandbox:`#0369a1`,questionnaire:`#9333ea`,status:`#475569`,error:`#dc2626`};function u(e){if(e)return(e,t,n)=>{console.log(`%cAstralBeam%c ${new Date().toISOString().slice(11,19)} %c${e}%c ${t}`,c,`color:#94a3b8;font-weight:400`,s(l[e]),``,...n===void 0?[]:[n])}}export{n as a,o as c,a as i,r as n,t as o,i as r,e as s,u as t};
|
|
@@ -3352,7 +3352,7 @@ type AstralBeamChatThemeVariables = Record<`--${string}`, string>;
|
|
|
3352
3352
|
* `credentials: "include"`, `cache: "no-store"`, and an `accept: application/json` header, each
|
|
3353
3353
|
* overridable here, and the response is expected to carry `{ token }` as JSON.
|
|
3354
3354
|
*/
|
|
3355
|
-
interface
|
|
3355
|
+
interface AstralBeamTokenRequest extends RequestInit {
|
|
3356
3356
|
url: string;
|
|
3357
3357
|
}
|
|
3358
3358
|
/**
|
|
@@ -3363,7 +3363,7 @@ interface AstralBeamChatAuthTokenRequest extends RequestInit {
|
|
|
3363
3363
|
* rotating credential stays current rather than being captured once. A function that returns
|
|
3364
3364
|
* `undefined`, or throws, fails authentication closed; the composer's retry link asks again.
|
|
3365
3365
|
*/
|
|
3366
|
-
type
|
|
3366
|
+
type AstralBeamTokenSource = AstralBeamTokenRequest | (() => {
|
|
3367
3367
|
token: string;
|
|
3368
3368
|
} | undefined | Promise<{
|
|
3369
3369
|
token: string;
|
|
@@ -3402,7 +3402,7 @@ interface MountAstralBeamChatOptions {
|
|
|
3402
3402
|
/** Subtitle shown under the empty transcript's headline. Default describes the app's tools and widgets. */
|
|
3403
3403
|
emptyDescription?: string | undefined;
|
|
3404
3404
|
/**
|
|
3405
|
-
* Base URL of the AstralBeam API; the widget calls `/chat` and its subroutes under it. Read for
|
|
3405
|
+
* Base URL of the AstralBeam API; the widget calls `/v1/chat` and its subroutes under it. Read for
|
|
3406
3406
|
* every request, so a change moves the next one. Default `"https://app.astralbeam.ai/api"`, the
|
|
3407
3407
|
* hosted cloud; self-hosted deployments must set their own origin.
|
|
3408
3408
|
*/
|
|
@@ -3413,7 +3413,7 @@ interface MountAstralBeamChatOptions {
|
|
|
3413
3413
|
* change applies to the next one, which is minted when the cached token nears expiry. Default
|
|
3414
3414
|
* `{ url: "/api/astralbeam/token" }`, posted with the page's cookies.
|
|
3415
3415
|
*/
|
|
3416
|
-
|
|
3416
|
+
fetchAstralBeamToken?: AstralBeamTokenSource | undefined;
|
|
3417
3417
|
/** Host-defined tools the agent can call, executed in the host page, keyed by tool name. */
|
|
3418
3418
|
tools?: Record<string, ToolDefinition> | undefined;
|
|
3419
3419
|
/** Host-defined widgets the agent can render inline in the conversation, keyed by identifier. */
|
|
@@ -3742,7 +3742,7 @@ interface ChatStreamCallbacks {
|
|
|
3742
3742
|
* The transport and tool options of the drop-in widget, minus everything about its UI, plus this
|
|
3743
3743
|
* session's own rendering hooks. The shared options are documented on `MountAstralBeamChatOptions`.
|
|
3744
3744
|
*/
|
|
3745
|
-
interface AstralBeamChatCoreOptions extends Pick<MountAstralBeamChatOptions, "agentId" | "apiUrl" | "
|
|
3745
|
+
interface AstralBeamChatCoreOptions extends Pick<MountAstralBeamChatOptions, "agentId" | "apiUrl" | "fetchAstralBeamToken" | "tools" | "debug"> {
|
|
3746
3746
|
/** Widgets declared to the agent, without a `render`; `onRenderWidget` is asked to draw them. */
|
|
3747
3747
|
widgets?: Record<string, WidgetDeclaration> | undefined;
|
|
3748
3748
|
/** Draws an agent-requested widget however the host wants; may return a cleanup. */
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as AstralBeamChatState, S as AstralBeamChatCoreOptions, x as AstralBeamChatCore } from "./index-
|
|
1
|
+
import { C as AstralBeamChatState, S as AstralBeamChatCoreOptions, x as AstralBeamChatCore } from "./index-BQBdZKyB.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import { AstralBeamChatAttachmentOptions,
|
|
3
|
+
import { AstralBeamChatAttachmentOptions, AstralBeamChatColorScheme, AstralBeamChatTheme, AstralBeamTokenRequest, AstralBeamTokenSource, InferParameters, JsonSchemaObject, MountAstralBeamChatOptions, ParametersSchema, ToolDefinition, WidgetDefinition as WidgetDefinition$1, defineTool } from "@astralbeam/sdk/client";
|
|
4
4
|
|
|
5
5
|
//#region src/react/index.d.ts
|
|
6
6
|
interface WidgetDefinition extends Omit<WidgetDefinition$1, "render"> {
|
|
@@ -55,4 +55,4 @@ interface AstralBeamChatProps extends Omit<MountAstralBeamChatOptions, "widgets"
|
|
|
55
55
|
}
|
|
56
56
|
declare const AstralBeamChat: import("react").ForwardRefExoticComponent<AstralBeamChatProps & import("react").RefAttributes<AstralBeamChatRef>>;
|
|
57
57
|
//#endregion
|
|
58
|
-
export { AstralBeamChat, type AstralBeamChatAttachmentOptions, type
|
|
58
|
+
export { AstralBeamChat, type AstralBeamChatAttachmentOptions, type AstralBeamChatColorScheme, type AstralBeamChatCore, type AstralBeamChatCoreOptions, AstralBeamChatProps, AstralBeamChatRef, type AstralBeamChatState, type AstralBeamChatTheme, type AstralBeamTokenRequest, type AstralBeamTokenSource, type InferParameters, type ParametersSchema, type ToolDefinition, TypedReactWidgetDefinition, UseAstralBeamChatResult, WidgetDefinition, defineTool, defineWidget, useAstralBeamChat };
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as CORE_OPTION_KEYS, r as createAstralBeamChat } from "./core-Dr2IDA6j.js";
|
|
2
|
+
import { O as DEFAULT_COLOR_SCHEME } from "./api-CaNIR6Af.js";
|
|
2
3
|
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
4
|
import { createPortal } from "react-dom";
|
|
4
5
|
import { defineTool, mountAstralBeamChat } from "@astralbeam/sdk/client";
|
|
@@ -32,7 +33,7 @@ function useAstralBeamChat(options) {
|
|
|
32
33
|
core
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
|
-
const AstralBeamChat = forwardRef(function AstralBeamChat({ agentId, title, showHeader, header, empty, composerActions, emptyTitle, emptyDescription, apiUrl,
|
|
36
|
+
const AstralBeamChat = forwardRef(function AstralBeamChat({ agentId, title, showHeader, header, empty, composerActions, emptyTitle, emptyDescription, apiUrl, fetchAstralBeamToken, tools, widgets = {}, colorScheme = DEFAULT_COLOR_SCHEME, theme, attachments, sandboxPanel, debug }, ref) {
|
|
36
37
|
const targetRef = useRef(null);
|
|
37
38
|
const handleRef = useRef(null);
|
|
38
39
|
const [activeRenders, setActiveRenders] = useState(/* @__PURE__ */ new Map());
|
|
@@ -99,7 +100,7 @@ const AstralBeamChat = forwardRef(function AstralBeamChat({ agentId, title, show
|
|
|
99
100
|
const live = useMemo(() => ({
|
|
100
101
|
agentId,
|
|
101
102
|
apiUrl,
|
|
102
|
-
|
|
103
|
+
fetchAstralBeamToken,
|
|
103
104
|
title,
|
|
104
105
|
showHeader,
|
|
105
106
|
emptyTitle,
|
|
@@ -115,7 +116,7 @@ const AstralBeamChat = forwardRef(function AstralBeamChat({ agentId, title, show
|
|
|
115
116
|
}), [
|
|
116
117
|
agentId,
|
|
117
118
|
apiUrl,
|
|
118
|
-
|
|
119
|
+
fetchAstralBeamToken,
|
|
119
120
|
title,
|
|
120
121
|
showHeader,
|
|
121
122
|
emptyTitle,
|