@astralbeam/sdk 0.10.1 → 0.11.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/api.d.ts CHANGED
@@ -1,333 +1,2 @@
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 };
1
+ import { $ as ApiOptions, A as getChatConfig, B as getListTenantsUrl, C as TenantUserRecordEncodedMetadata, D as UpdateTenantUserInputMetadata, E as UpdateTenantUserInput, F as getGetChatConfigUrl, G as getUpdateTenantUrl, H as getRunChatUrl, I as getGetChatFileUrl, J as listUsersForTenant, K as getUpdateTenantUserUrl, L as getGetCurrentUserUrl, M as getCreateTenantUrl, N as getCreateTenantUserUrl, O as createTenant, P as getCurrentUser, Q as ApiKeyOptions, R as getGetTenantUrl, S as TenantUserRecordEncoded, T as UpdateTenantInputMetadata, U as getTenant, V as getListUsersForTenantUrl, W as getTenantUser, X as updateTenant, Y as runChat, Z as updateTenantUser, _ as ListUsersForTenantParams, a as ChatRunInput, b as TenantRecordEncodedMetadata, c as CreateTenantInput, d as CreateTenantUserInputMetadata, et as ApiRequestOptions, f as CurrentUser, g as ListUsersForTenantFilterAdmin, h as ListTenantsParams, i as ChatConfigurationCapabilities, it as isAstralBeamApiError, j as getChatFile, k as createTenantUser, l as CreateTenantInputMetadata, m as GetChatFileParams, n as AstralBeamApiErrorIssuesItem, nt as FileOptions, o as ChatRunInputData, p as GetChatConfigParams, q as listTenants, r as ChatConfiguration, rt as JwtOptions, s as ChatRunInputForwardedProps, t as AstralBeamApiError$1, tt as AstralBeamApiError, u as CreateTenantUserInput, v as TenantPage, w as UpdateTenantInput, x as TenantUserPage, y as TenantRecordEncoded, z as getGetTenantUserUrl } from "./api-CWgQSDaI.js";
2
+ export { type ApiKeyOptions, type ApiOptions, type ApiRequestOptions, AstralBeamApiError, type AstralBeamApiError$1 as AstralBeamApiErrorBody, AstralBeamApiErrorIssuesItem, ChatConfiguration, ChatConfigurationCapabilities, ChatRunInput, ChatRunInputData, ChatRunInputForwardedProps, CreateTenantInput, CreateTenantInputMetadata, CreateTenantUserInput, CreateTenantUserInputMetadata, CurrentUser, 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, getCurrentUser, getGetChatConfigUrl, getGetChatFileUrl, getGetCurrentUserUrl, getGetTenantUrl, getGetTenantUserUrl, getListTenantsUrl, getListUsersForTenantUrl, getRunChatUrl, getTenant, getTenantUser, getUpdateTenantUrl, getUpdateTenantUserUrl, isAstralBeamApiError, listTenants, listUsersForTenant, runChat, updateTenant, updateTenantUser };
package/dist/api.js CHANGED
@@ -1,2 +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 };
1
+ import { C as runChat, D as isAstralBeamApiError, S as listUsersForTenant, T as updateTenantUser, _ as getTenant, a as getChatFile, b as getUpdateTenantUserUrl, c as getCurrentUser, d as getGetCurrentUserUrl, f as getGetTenantUrl, g as getRunChatUrl, h as getListUsersForTenantUrl, i as getChatConfig, l as getGetChatConfigUrl, m as getListTenantsUrl, n as createTenant, o as getCreateTenantUrl, p as getGetTenantUserUrl, r as createTenantUser, s as getCreateTenantUserUrl, t as ListUsersForTenantFilterAdmin, u as getGetChatFileUrl, v as getTenantUser, w as updateTenant, x as listTenants, y as getUpdateTenantUrl } from "./api-DrKgAIBT.js";
2
+ export { ListUsersForTenantFilterAdmin, createTenant, createTenantUser, getChatConfig, getChatFile, getCreateTenantUrl, getCreateTenantUserUrl, getCurrentUser, getGetChatConfigUrl, getGetChatFileUrl, getGetCurrentUserUrl, getGetTenantUrl, getGetTenantUserUrl, getListTenantsUrl, getListUsersForTenantUrl, getRunChatUrl, getTenant, getTenantUser, getUpdateTenantUrl, getUpdateTenantUserUrl, isAstralBeamApiError, listTenants, listUsersForTenant, runChat, updateTenant, updateTenantUser };
package/dist/client.d.ts CHANGED
@@ -14,7 +14,7 @@ interface StandardSchemaV1<Input = unknown, Output = Input> {
14
14
  * Input type `defineTool`/`defineWidget` derive from a `parameters` schema: a Standard Schema's
15
15
  * validated output, or untyped props for a plain JSON Schema, which nothing validates in the browser.
16
16
  */
17
- type InferParameters<S extends ParametersSchema> = S extends StandardSchemaV1<any, infer O> ? O : Record<string, unknown>;
17
+ type InferParameters<S extends ParametersSchema> = S extends StandardSchemaV1<unknown, infer O> ? O : Record<string, unknown>;
18
18
  /** A plain JSON Schema object, the same shape tool definitions use for their parameters. */
19
19
  interface JsonSchemaObject {
20
20
  type: "object";
@@ -55,7 +55,7 @@ interface ToolDefinition {
55
55
  * Runs in the host page with the agent-chosen input. The resolved value is returned
56
56
  * to the agent as the tool result; a thrown error is returned as a tool error.
57
57
  */
58
- execute: (input: Record<string, unknown>) => unknown | Promise<unknown>;
58
+ execute: (input: Record<string, unknown>) => unknown;
59
59
  }
60
60
  /**
61
61
  * Limits and accepted types for the composer's file attachments. Every field is optional;
@@ -187,6 +187,8 @@ interface MountAstralBeamChatOptions {
187
187
  colorScheme?: AstralBeamChatColorScheme | undefined;
188
188
  /** Custom values for the widget's theming CSS variables, per color scheme. */
189
189
  theme?: AstralBeamChatTheme | undefined;
190
+ /** Trusted application CSS, scoped to this widget's shadow root. */
191
+ customCss?: string | undefined;
190
192
  /**
191
193
  * Logs every SDK action to the browser console with UTC timestamps and full payloads,
192
194
  * and asks the endpoint (via the forwarded props) to log its side of the run too.
@@ -217,7 +219,7 @@ interface TypedToolDefinition<S extends ParametersSchema = JsonSchemaObject> {
217
219
  description: string;
218
220
  metadata?: Record<string, unknown> | undefined;
219
221
  parameters?: S;
220
- execute: (input: InferParameters<S>) => unknown | Promise<unknown>;
222
+ execute: (input: InferParameters<S>) => unknown;
221
223
  }
222
224
  interface TypedWidgetDefinition<S extends ParametersSchema = JsonSchemaObject> {
223
225
  description: string;
@@ -229,7 +231,94 @@ declare function defineTool<const S extends ParametersSchema = JsonSchemaObject>
229
231
  /** Declares a host widget; a Standard Schema `parameters` types (and validates) `render`'s props. */
230
232
  declare function defineWidget<const S extends ParametersSchema = JsonSchemaObject>(widget: TypedWidgetDefinition<S>): WidgetDefinition;
231
233
  //#endregion
234
+ //#region src/api/generated/api.d.ts
235
+ /**
236
+ * Customer-defined JSON object; keys are preserved.
237
+ */
238
+ type TenantRecordEncodedMetadata = {
239
+ [key: string]: unknown;
240
+ };
241
+ /**
242
+ * Persisted Tenant; id is internal, external_id is the customer's exact identity.
243
+ */
244
+ interface TenantRecordEncoded {
245
+ id: string;
246
+ external_id: string;
247
+ name: string | null;
248
+ /** Customer-defined JSON object; keys are preserved. */
249
+ metadata: TenantRecordEncodedMetadata;
250
+ created_at: string;
251
+ updated_at: string;
252
+ }
253
+ /**
254
+ * Customer-defined JSON object; keys are preserved.
255
+ */
256
+ type TenantUserRecordEncodedMetadata = {
257
+ [key: string]: unknown;
258
+ };
259
+ /**
260
+ * Persisted TenantUser. Stored admin does not grant or revoke signed JWT authority.
261
+ */
262
+ interface TenantUserRecordEncoded {
263
+ id: string;
264
+ external_id: string;
265
+ name: string | null;
266
+ /** Customer-defined JSON object; keys are preserved. */
267
+ metadata: TenantUserRecordEncodedMetadata;
268
+ created_at: string;
269
+ updated_at: string;
270
+ tenant_id: string;
271
+ admin: boolean;
272
+ }
273
+ //#endregion
274
+ //#region src/core/listings.d.ts
275
+ interface AstralBeamListingCoreOptions {
276
+ apiUrl?: string | undefined;
277
+ fetchAstralBeamToken?: AstralBeamTokenSource | undefined;
278
+ /** Tenant is the safe default. Organization mode requires an organization-management JWT. */
279
+ scope?: "tenant" | "organization" | undefined;
280
+ /** Internal UUID. Supply this or tenantExternalId for tenant mode with an organization JWT. */
281
+ tenantId?: string | undefined;
282
+ /** Exact customer-owned Tenant ID. tenantId takes precedence when both are supplied. */
283
+ tenantExternalId?: string | undefined;
284
+ /** Final request failures, after authentication retry. Cancellations are not reported. */
285
+ onError?: ((error: Error) => void) | undefined;
286
+ }
287
+ //#endregion
288
+ //#region src/client/listings.d.ts
289
+ interface AstralBeamListingOptions extends AstralBeamListingCoreOptions {
290
+ fetchAstralBeamToken: NonNullable<AstralBeamListingCoreOptions["fetchAstralBeamToken"]>;
291
+ pageSize?: 20 | 50 | 100 | undefined;
292
+ title?: string | undefined;
293
+ showHeader?: boolean | undefined;
294
+ /** Trusted application CSS, scoped to this widget's shadow root. */
295
+ customCss?: string | undefined;
296
+ colorScheme?: AstralBeamChatColorScheme | undefined;
297
+ theme?: AstralBeamChatTheme | undefined;
298
+ }
299
+ interface MountAstralBeamTenantListOptions extends AstralBeamListingOptions {
300
+ onTenantSelect?: ((tenant: TenantRecordEncoded) => void) | undefined;
301
+ }
302
+ interface MountAstralBeamTenantUserListOptions extends AstralBeamListingOptions {
303
+ /** Called when the Tenant picker selection changes. null means cleared. */
304
+ onTenantChange?: ((tenant: TenantRecordEncoded | null) => void) | undefined;
305
+ /** Show the stored admin column and filter. Does not control authorization. Defaults to false. */
306
+ showAdmin?: boolean | undefined;
307
+ onTenantUserSelect?: ((user: TenantUserRecordEncoded) => void) | undefined;
308
+ }
309
+ interface AstralBeamListingHandle<T extends AstralBeamListingOptions = AstralBeamListingOptions> {
310
+ update(options: Partial<T>): void;
311
+ refresh(): void;
312
+ /** Clears state and reloads using the ready host session. Unmount during sign-out or account transitions. */
313
+ reset(): void;
314
+ unmount(): void;
315
+ }
316
+ type AstralBeamTenantListHandle = AstralBeamListingHandle<MountAstralBeamTenantListOptions>;
317
+ type AstralBeamTenantUserListHandle = AstralBeamListingHandle<MountAstralBeamTenantUserListOptions>;
318
+ declare function mountAstralBeamTenantList(target: HTMLElement, options: MountAstralBeamTenantListOptions): AstralBeamTenantListHandle;
319
+ declare function mountAstralBeamTenantUserList(target: HTMLElement, options: MountAstralBeamTenantUserListOptions): AstralBeamTenantUserListHandle;
320
+ //#endregion
232
321
  //#region src/client/index.d.ts
233
322
  declare function mountAstralBeamChat(target: HTMLElement, options: MountAstralBeamChatOptions): AstralBeamChatHandle;
234
323
  //#endregion
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 };
324
+ export { type AstralBeamChatAttachmentOptions, type AstralBeamChatColorScheme, type AstralBeamChatHandle, type AstralBeamChatSlotRenderer, type AstralBeamChatSlots, type AstralBeamChatTheme, type AstralBeamChatThemeVariables, type AstralBeamChatUpdate, type AstralBeamListingHandle, type AstralBeamListingOptions, type AstralBeamTenantListHandle, type AstralBeamTenantUserListHandle, type AstralBeamTokenRequest, type AstralBeamTokenSource, type InferParameters, type JsonSchemaObject, type MountAstralBeamChatOptions, type MountAstralBeamTenantListOptions, type MountAstralBeamTenantUserListOptions, type ParametersSchema, type StandardSchemaV1, type ToolDefinition, type TypedToolDefinition, type TypedWidgetDefinition, type WidgetDefinition, defineTool, defineWidget, mountAstralBeamChat, mountAstralBeamTenantList, mountAstralBeamTenantUserList };
package/dist/client.js CHANGED
@@ -1 +1 @@
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
+ import{s as e}from"./constants-CgaMxV3q.js";import{t}from"./debug-qLts7gEt.js";function n(e,t,n,r){let i=n.colorScheme??`system`,a=i===`dark`||i===`system`&&r;e.classList.toggle(`dark`,a);for(let n of t)e.style.removeProperty(n);t.clear();let o={...n.theme?.light,...a?n.theme?.dark:void 0};for(let[n,r]of Object.entries(o))n.startsWith(`--`)&&(e.style.setProperty(n,r),t.add(n));return{colorScheme:i,dark:a}}function r(e){return e}function i(e){return e}function a(e,t){return s(e,t,`tenants`)}function o(e,t){return s(e,t,`users`)}function s(t,n,r){let i=t.shadowRoot??t.attachShadow({mode:`open`}),a=document.createElement(`div`);a.className=`${e} bg-transparent`,a.style.height=`100%`,i.append(a);let o=matchMedia(`(prefers-color-scheme: dark)`),s={options:{...n},kind:r,shadow:i,container:a,media:o,variables:new Set,disposed:!1},f=()=>c(s);return f(),o.addEventListener(`change`,f),l(s),{update:e=>u(s,e),refresh:()=>{!s.disposed&&s.renderer&&s.runtime.refreshListing(s.renderer)},reset:()=>{!s.disposed&&s.renderer&&s.runtime.resetListing(s.renderer)},unmount:()=>d(s,f)}}function c({options:e,media:t,container:r,variables:i}){n(r,i,e,t.matches)}async function l(e){e.retryLoad?.remove();try{if(e.runtime=await import(`./listings-DVfsUaPv.js`),e.disposed)return;e.renderer=e.runtime.renderListing(e.shadow,e.container,e.options,e.kind)}catch{if(e.disposed)return;e.retryLoad=document.createElement(`button`),e.retryLoad.textContent=`Could not load directory. Retry`,e.retryLoad.onclick=()=>void l(e),e.container.append(e.retryLoad)}}function u(e,t){e.disposed||(e.options={...e.options,...t},c(e),e.renderer&&e.runtime.updateListing(e.renderer,e.options))}function d(e,t){e.disposed||(e.disposed=!0,e.media.removeEventListener(`change`,t),e.renderer&&e.runtime.disposeListing(e.renderer),e.container.remove())}function f(r,i){let a={...i},o=t(a.debug);o?.(`mount`,`mounting chat widget`,{agentId:a.agentId??`(organization default)`,title:a.title??`AstralBeam`,showHeader:a.showHeader??!0,emptyTitle:a.emptyTitle??`Ask the assistant`,emptyDescription:a.emptyDescription??`It can answer questions and act through this app's own tools and widgets.`,apiUrl:a.apiUrl??`https://app.astralbeam.ai/api`,authentication:`configured`,colorScheme:a.colorScheme??`system`,theme:a.theme,tools:Object.keys(a.tools??{}),widgets:Object.keys(a.widgets??{}),attachments:a.attachments??!0});let s=r.shadowRoot??r.attachShadow({mode:`open`}),c=document.createElement(`div`);c.className=e,c.style.height=`100%`,s.append(c);let l=matchMedia(`(prefers-color-scheme: dark)`),u=new Set,d=()=>{let{colorScheme:e,dark:t}=n(c,u,a,l.matches);o?.(`theme`,`color scheme "${e}" resolved to ${t?`dark`:`light`}`,{themeVariables:[...u]})};d(),l.addEventListener(`change`,d);let f=!1,p;return import(`./widget-CrC3teP8.js`).then(({renderChat:e})=>{o?.(`mount`,`chat chunk loaded`),f||(p=e(s,c,a))}),{update:e=>{a={...a,...e},o=t(a.debug),o?.(`mount`,`options updated`,{changed:Object.keys(e)}),d(),p?.update(a)},reset:()=>p?.reset(),stop:()=>p?.stop(),unmount:()=>{o?.(`mount`,`unmounting chat widget`),f=!0,l.removeEventListener(`change`,d),p?.dispose(),p=void 0,c.remove()}}}export{r as defineTool,i as defineWidget,f as mountAstralBeamChat,a as mountAstralBeamTenantList,o as mountAstralBeamTenantUserList};
@@ -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`;export{t as a,n as i,i as n,e as o,a as r,o as s,r as t};