@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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @astralbeam/sdk
2
2
 
3
- Embed an agent chat sidebar in your web app, or build your own UI with the headless core. The widget isolates its styles in a shadow root.
3
+ Embed an agent chat sidebar or read-only tenant directories in your web app, or build your own chat UI with the headless core. The widgets isolate their styles in shadow roots.
4
4
 
5
5
  ```sh
6
6
  npm install @astralbeam/sdk
@@ -41,48 +41,57 @@ import { createAstralBeamToken } from "@astralbeam/sdk/server"
41
41
  const apiKey = process.env.ASTRALBEAM_API_KEY // key_<organizationId>_<id>_abo_<secret>
42
42
 
43
43
  export async function POST(request: Request) {
44
- if (!apiKey) return Response.json({ error: "Not configured" }, { status: 503 })
44
+ const headers = { "Cache-Control": "no-store" }
45
+ if (!apiKey) return Response.json({ error: "Not configured" }, { status: 503, headers })
45
46
  const session = await getApplicationSession(request)
46
- if (!session) return Response.json({ error: "Unauthenticated" }, { status: 401 })
47
- const token = await createAstralBeamToken({
48
- apiKey,
49
- user: {
50
- id: session.user.id,
51
- name: session.user.name,
52
- metadata: { email: session.user.email },
53
- },
54
- tenant: {
55
- id: session.tenant.id,
56
- name: session.tenant.name,
57
- metadata: { plan: session.tenant.plan },
58
- },
59
- })
60
- return Response.json({ token }, { headers: { "cache-control": "no-store" } })
47
+ if (!session) return Response.json({ error: "Unauthenticated" }, { status: 401, headers })
48
+ try {
49
+ const token = await createAstralBeamToken({
50
+ apiKey,
51
+ user: {
52
+ id: session.user.id,
53
+ name: session.user.name,
54
+ metadata: { email: session.user.email },
55
+ },
56
+ tenant: {
57
+ id: session.tenant.id,
58
+ name: session.tenant.name,
59
+ metadata: { plan: session.tenant.plan },
60
+ },
61
+ })
62
+ return Response.json({ token }, { headers })
63
+ } catch {
64
+ return Response.json({ error: "Token could not be issued" }, { status: 500, headers })
65
+ }
61
66
  }
62
67
  ```
63
68
 
64
69
  - Authenticate once and derive stable `user.id` and `tenant.id` values from that trusted session.
65
70
  - Keep API keys server-only. Tokens are signed, not encrypted, so their claims must contain no secrets.
66
71
  - Return `Cache-Control: no-store` and fail closed when configuration or authentication is missing.
72
+ - Directory access additionally requires signed `user.admin: true`, derived from trusted tenant permissions, and persisted records. Follow [Tenant directories](https://app.astralbeam.ai/docs/sdk/listings).
67
73
  - For employee-facing Tenant management, use `createAstralBeamOrganizationToken`. The [API client guide](https://app.astralbeam.ai/docs/sdk/api) covers database-backed roles and browser integration.
68
74
 
75
+ Existing token props and the default chat endpoint keep working. After acquiring a token, components call `POST /api/v1/me` and renew before expiry. See [authentication and refresh behavior](https://app.astralbeam.ai/docs/sdk/authentication).
76
+
69
77
  ## Options
70
78
 
71
79
  Every option is also a prop on `<AstralBeamChat>`. `handle.update(options)` applies any subset in place, and no option is fixed at mount. Details in [Configuration](https://app.astralbeam.ai/docs/sdk/configuration).
72
80
 
73
- | Option | Default | Meaning |
74
- | ------------------------------------ | ---------------------------------- | -------------------------------------------------------------------- |
75
- | `agentId` | organization's default | `agent_<orgId>_<id>`, copied from the dashboard |
76
- | `apiUrl` | `https://app.astralbeam.ai/api` | Base URL of the AstralBeam API. The widget calls `/v1/chat` there |
77
- | `fetchAstralBeamToken` | `{ url: "/api/astralbeam/token" }` | Chat auth token endpoint as `{ url, ...RequestInit }`, or a minter |
78
- | `title`, `showHeader` | `"AstralBeam"`, `true` | Header text, and whether the header and reset button show |
79
- | `emptyTitle`, `emptyDescription` | generic copy | Headline and subtitle of the empty transcript |
80
- | `colorScheme`, `theme` | `"system"`, built-in palette | Light/dark/system, and shadcn token overrides |
81
- | `attachments` | `true` | `false` hides the feature, or pass limits |
82
- | `tools`, `widgets` | none | What the agent can do and draw in your app |
83
- | `sandboxPanel` | `false` | Collected sandbox panel: files with downloads, command log |
84
- | `header`, `empty`, `composerActions` | widget's own chrome | Host-rendered replacements (React props. `slots` on the handle) |
85
- | `debug` | `false` | Log SDK actions in the browser, with server logs in development only |
81
+ | Option | Default | Meaning |
82
+ | --- | --- | --- |
83
+ | `agentId` | organization's default | `agent_<orgId>_<id>`, copied from the dashboard |
84
+ | `apiUrl` | `https://app.astralbeam.ai/api` | Base URL of the AstralBeam API. The widget calls `/v1/chat` there |
85
+ | `fetchAstralBeamToken` | `{ url: "/api/astralbeam/token" }` | Chat auth token endpoint as `{ url, ...RequestInit }`, or a minter |
86
+ | `title`, `showHeader` | `"AstralBeam"`, `true` | Header text, and whether the header and reset button show |
87
+ | `emptyTitle`, `emptyDescription` | generic copy | Headline and subtitle of the empty transcript |
88
+ | `colorScheme`, `theme` | `"system"`, built-in palette | Light/dark/system, and shadcn token overrides |
89
+ | `customCss` | None | Trusted CSS inside the widget's Shadow DOM |
90
+ | `attachments` | `true` | `false` hides the feature, or pass limits |
91
+ | `tools`, `widgets` | none | What the agent can do and draw in your app |
92
+ | `sandboxPanel` | `false` | Collected sandbox panel: files with downloads, command log |
93
+ | `header`, `empty`, `composerActions` | widget's own chrome | Host-rendered replacements (React props. `slots` on the handle) |
94
+ | `debug` | `false` | Log SDK actions in the browser, with server logs in development only |
86
95
 
87
96
  A `ref` on `<AstralBeamChat>` (and the vanilla handle) exposes `reset()` and `stop()` for hosts that draw their own controls.
88
97
 
@@ -113,29 +122,32 @@ widgets: {
113
122
 
114
123
  ## Documentation
115
124
 
116
- | Guide | Covers |
117
- | ------------------------------------------------------------------------- | ------------------------------------------------------- |
118
- | [API client](https://app.astralbeam.ai/docs/sdk/api) | Typed resource and chat requests with API keys or JWTs. |
119
- | [Getting started](https://app.astralbeam.ai/docs/sdk/getting-started) | install, mount, layout requirements. |
120
- | [Authentication](https://app.astralbeam.ai/docs/sdk/authentication) | the token endpoint and its security rules. |
121
- | [Configuration](https://app.astralbeam.ai/docs/sdk/configuration) | every option, and what `update` can change. |
122
- | [Theming](https://app.astralbeam.ai/docs/sdk/theming) | color schemes, CSS tokens, the shadow-root boundary. |
123
- | [Tools and widgets](https://app.astralbeam.ai/docs/sdk/tools-and-widgets) | schemas, live state, rendering into the transcript. |
124
- | [Attachments](https://app.astralbeam.ai/docs/sdk/attachments) | file kinds, limits, what the endpoint enforces. |
125
- | [Limits](https://app.astralbeam.ai/docs/sdk/limits) | request, attachment, and sandbox limits. |
126
- | [Sandbox](https://app.astralbeam.ai/docs/sdk/sandbox) | steps, the opt-in panel, downloads, inline images. |
127
- | [Headless](https://app.astralbeam.ai/docs/sdk/headless) | own the whole chat UI on the same session. |
128
- | [Security model](https://app.astralbeam.ai/docs/sdk/security) | who grants, who enforces, what the client can change. |
125
+ | Guide | Covers |
126
+ | --- | --- |
127
+ | [API client](https://app.astralbeam.ai/docs/sdk/api) | Typed resource and chat requests with API keys or JWTs. |
128
+ | [Getting started](https://app.astralbeam.ai/docs/sdk/getting-started) | install, mount, layout requirements. |
129
+ | [Authentication](https://app.astralbeam.ai/docs/sdk/authentication) | the token endpoint and its security rules. |
130
+ | [Tenant directories](https://app.astralbeam.ai/docs/sdk/listings) | provisioning, tenant-user and Tenant listings, lifecycle, and options. |
131
+ | [Configuration](https://app.astralbeam.ai/docs/sdk/configuration) | every option, and what `update` can change. |
132
+ | [Theming](https://app.astralbeam.ai/docs/sdk/theming) | color schemes, CSS tokens, the shadow-root boundary. |
133
+ | [Tools and widgets](https://app.astralbeam.ai/docs/sdk/tools-and-widgets) | schemas, live state, rendering into the transcript. |
134
+ | [Attachments](https://app.astralbeam.ai/docs/sdk/attachments) | file kinds, limits, what the endpoint enforces. |
135
+ | [Limits](https://app.astralbeam.ai/docs/sdk/limits) | request, attachment, and sandbox limits. |
136
+ | [Sandbox](https://app.astralbeam.ai/docs/sdk/sandbox) | steps, the opt-in panel, downloads, inline images. |
137
+ | [Headless](https://app.astralbeam.ai/docs/sdk/headless) | own the whole chat UI on the same session. |
138
+ | [Security model](https://app.astralbeam.ai/docs/sdk/security) | who grants, who enforces, what the client can change. |
129
139
 
130
140
  ## Entry points
131
141
 
142
+ Read-only Tenant and TenantUser widgets are available from `/client` and `/react`. See [Tenant directories](https://app.astralbeam.ai/docs/sdk/listings) for setup and embedding examples.
143
+
132
144
  There is no root export. Conversation history is not built yet.
133
145
 
134
146
  | Entry point | Contents | Peer dependency |
135
147
  | ------------------------ | -------------------------------------------- | -------------------- |
136
- | `@astralbeam/sdk/client` | `mountAstralBeamChat`, the vanilla loader | none |
148
+ | `@astralbeam/sdk/client` | Chat and Tenant directory mounts | none |
137
149
  | `@astralbeam/sdk/core` | `createAstralBeamChat`, the headless session | none |
138
- | `@astralbeam/sdk/react` | `<AstralBeamChat>`, `useAstralBeamChat` | `react`, `react-dom` |
150
+ | `@astralbeam/sdk/react` | Chat hooks and isolated UI wrappers | `react`, `react-dom` |
139
151
  | `@astralbeam/sdk/server` | Tenant and organization token minters | none |
140
152
  | `@astralbeam/sdk/api` | Resource and chat HTTP helpers | none |
141
153
 
@@ -143,7 +155,7 @@ Types resolve under every TypeScript module resolution mode, including classic `
143
155
 
144
156
  ## Example
145
157
 
146
- [`examples/todos`](../examples/todos) embeds the sidebar in a minimal TanStack Start app: a demo token route, host tools over live React state, and a `todoCard` widget. It uses no Tailwind or shadcn/ui of its own, to show the shadow-root boundary.
158
+ [`examples/todos`](../examples/todos) embeds the sidebar and a tenant-scoped user listing in a minimal TanStack Start app. Both use the same demo token route. The app also demonstrates host tools over live React state and a `todoCard` widget, with no Tailwind or shadcn/ui of its own.
147
159
 
148
160
  ## License
149
161
 
@@ -0,0 +1,358 @@
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$1 extends Error {
20
+ name: "AstralBeamApiError";
21
+ status: number;
22
+ headers: Headers;
23
+ body?: AstralBeamApiError;
24
+ }
25
+ declare function isAstralBeamApiError(error: unknown): error is AstralBeamApiError$1;
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 {
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 CurrentUser = {
197
+ scope: "tenant";
198
+ organization: {
199
+ id: string;
200
+ };
201
+ tenant: TenantRecordEncoded;
202
+ user: TenantUserRecordEncoded;
203
+ } | {
204
+ scope: "organization";
205
+ organization: {
206
+ id: string;
207
+ };
208
+ user: {
209
+ id: string;
210
+ name: string;
211
+ email: string;
212
+ role: string;
213
+ };
214
+ };
215
+ type ListTenantsParams = {
216
+ /**
217
+ * Case-insensitive literal substring of name or external_id. Trimmed, blank means no search.
218
+ * @maxLength 255
219
+ * @pattern ^[^\u0000]*$
220
+ */
221
+ q?: string;
222
+ /**
223
+ * Exact, case-sensitive external ID; whitespace is preserved. Returns zero or one item.
224
+ * @minLength 1
225
+ * @maxLength 255
226
+ */
227
+ "filter[external_id]"?: string;
228
+ /**
229
+ * Positive integer, default 20. Values above 100 are accepted and capped. page_after and page_before are mutually exclusive.
230
+ * @minimum 1
231
+ */
232
+ page_size?: number;
233
+ /**
234
+ * @minLength 1
235
+ * @maxLength 2048
236
+ */
237
+ page_after?: string;
238
+ /**
239
+ * @minLength 1
240
+ * @maxLength 2048
241
+ */
242
+ page_before?: string;
243
+ };
244
+ type ListUsersForTenantParams = {
245
+ /**
246
+ * Case-insensitive literal substring of name or external_id. Trimmed, blank means no search.
247
+ * @maxLength 255
248
+ * @pattern ^[^\u0000]*$
249
+ */
250
+ q?: string;
251
+ /**
252
+ * Exact, case-sensitive external ID; whitespace is preserved. Returns zero or one item.
253
+ * @minLength 1
254
+ * @maxLength 255
255
+ */
256
+ "filter[external_id]"?: string;
257
+ /**
258
+ * Positive integer, default 20. Values above 100 are accepted and capped. page_after and page_before are mutually exclusive.
259
+ * @minimum 1
260
+ */
261
+ page_size?: number;
262
+ /**
263
+ * @minLength 1
264
+ * @maxLength 2048
265
+ */
266
+ page_after?: string;
267
+ /**
268
+ * @minLength 1
269
+ * @maxLength 2048
270
+ */
271
+ page_before?: string;
272
+ "filter[admin]"?: ListUsersForTenantFilterAdmin;
273
+ };
274
+ type ListUsersForTenantFilterAdmin = (typeof ListUsersForTenantFilterAdmin)[keyof typeof ListUsersForTenantFilterAdmin];
275
+ declare const ListUsersForTenantFilterAdmin: {
276
+ readonly true: "true";
277
+ readonly false: "false";
278
+ };
279
+ type GetChatConfigParams = {
280
+ agentId?: string;
281
+ };
282
+ type GetChatFileParams = {
283
+ ticket: string;
284
+ };
285
+ declare const getListTenantsUrl: (params: ListTenantsParams) => string;
286
+ /**
287
+ * 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.
288
+ * @summary List Tenants
289
+ */
290
+ declare const listTenants: (params: ListTenantsParams, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantPage>;
291
+ declare const getCreateTenantUrl: () => string;
292
+ /**
293
+ * 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.
294
+ * @summary Create a Tenant
295
+ */
296
+ declare const createTenant: (createTenantInput: CreateTenantInput, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantRecordEncoded>;
297
+ declare const getGetTenantUrl: (id: string) => string;
298
+ /**
299
+ * Get a Tenant by internal UUID, not external_id.
300
+ * @summary Get a Tenant
301
+ */
302
+ declare const getTenant: (id: string, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantRecordEncoded>;
303
+ declare const getUpdateTenantUrl: (id: string) => string;
304
+ /**
305
+ * 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.
306
+ * @summary Update a Tenant
307
+ */
308
+ declare const updateTenant: (id: string, updateTenantInput: UpdateTenantInput, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantRecordEncoded>;
309
+ declare const getListUsersForTenantUrl: (tenantId: string, params: ListUsersForTenantParams) => string;
310
+ /**
311
+ * 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.
312
+ * @summary List TenantUsers
313
+ */
314
+ declare const listUsersForTenant: (tenantId: string, params: ListUsersForTenantParams, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantUserPage>;
315
+ declare const getCreateTenantUserUrl: (tenantId: string) => string;
316
+ /**
317
+ * 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.
318
+ * @summary Create a TenantUser
319
+ */
320
+ declare const createTenantUser: (tenantId: string, createTenantUserInput: CreateTenantUserInput, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantUserRecordEncoded>;
321
+ declare const getGetTenantUserUrl: (tenantId: string, id: string) => string;
322
+ /**
323
+ * Get a TenantUser by the internal tenant_id and id pair within the authorized scope. No identity upsert.
324
+ * @summary Get a TenantUser
325
+ */
326
+ declare const getTenantUser: (tenantId: string, id: string, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantUserRecordEncoded>;
327
+ declare const getUpdateTenantUserUrl: (tenantId: string, id: string) => string;
328
+ /**
329
+ * 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.
330
+ * @summary Update a TenantUser
331
+ */
332
+ declare const updateTenantUser: (tenantId: string, id: string, updateTenantUserInput: UpdateTenantUserInput, options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<TenantUserRecordEncoded>;
333
+ declare const getRunChatUrl: () => string;
334
+ /**
335
+ * 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.
336
+ * @summary Run chat
337
+ */
338
+ declare const runChat: (chatRunInput: ChatRunInput, options: Parameters<typeof astralBeamChatFetch>[1]) => Promise<Response>;
339
+ declare const getGetChatConfigUrl: (params: GetChatConfigParams) => string;
340
+ /**
341
+ * 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.
342
+ * @summary Get chat capabilities
343
+ */
344
+ declare const getChatConfig: (params: GetChatConfigParams, options: Parameters<typeof astralBeamJwtFetch>[1]) => Promise<ChatConfiguration>;
345
+ declare const getGetChatFileUrl: (params: GetChatFileParams) => string;
346
+ /**
347
+ * 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.
348
+ * @summary Download a chat artifact
349
+ */
350
+ declare const getChatFile: (params: GetChatFileParams, options?: Parameters<typeof astralBeamFileFetch>[1]) => Promise<Response>;
351
+ declare const getGetCurrentUserUrl: () => string;
352
+ /**
353
+ * Use a tenant JWT to upsert its own Tenant and TenantUser atomically, without requiring admin authority. Supplied names and metadata replace stored values, omitted profile fields and admin are preserved, and an explicit admin claim updates stored admin. An organization JWT returns existing user membership and the current database role without provisioning identities. API keys and cookies are not accepted. Limited to 100 requests per five minutes per identity.
354
+ * @summary Get the current user
355
+ */
356
+ declare const getCurrentUser: (options: Parameters<typeof astralBeamJwtFetch>[1]) => Promise<CurrentUser>;
357
+ //#endregion
358
+ export { ApiOptions as $, getChatConfig as A, getListTenantsUrl as B, TenantUserRecordEncodedMetadata as C, UpdateTenantUserInputMetadata as D, UpdateTenantUserInput as E, getGetChatConfigUrl as F, getUpdateTenantUrl as G, getRunChatUrl as H, getGetChatFileUrl as I, listUsersForTenant as J, getUpdateTenantUserUrl as K, getGetCurrentUserUrl as L, getCreateTenantUrl as M, getCreateTenantUserUrl as N, createTenant as O, getCurrentUser as P, ApiKeyOptions as Q, getGetTenantUrl as R, TenantUserRecordEncoded as S, UpdateTenantInputMetadata as T, getTenant as U, getListUsersForTenantUrl as V, getTenantUser as W, updateTenant as X, runChat as Y, updateTenantUser as Z, ListUsersForTenantParams as _, ChatRunInput as a, TenantRecordEncodedMetadata as b, CreateTenantInput as c, CreateTenantUserInputMetadata as d, ApiRequestOptions as et, CurrentUser as f, ListUsersForTenantFilterAdmin as g, ListTenantsParams as h, ChatConfigurationCapabilities as i, isAstralBeamApiError as it, getChatFile as j, createTenantUser as k, CreateTenantInputMetadata as l, GetChatFileParams as m, AstralBeamApiErrorIssuesItem as n, FileOptions as nt, ChatRunInputData as o, GetChatConfigParams as p, listTenants as q, ChatConfiguration as r, JwtOptions as rt, ChatRunInputForwardedProps as s, AstralBeamApiError as t, AstralBeamApiError$1 as tt, CreateTenantUserInput as u, TenantPage as v, UpdateTenantInput as w, TenantUserPage as x, TenantRecordEncoded as y, getGetTenantUserUrl as z };
@@ -292,5 +292,18 @@ const getChatFile = (params, options) => {
292
292
  method: "GET"
293
293
  });
294
294
  };
295
+ const getGetCurrentUserUrl = () => {
296
+ return `/api/v1/me`;
297
+ };
298
+ /**
299
+ * Use a tenant JWT to upsert its own Tenant and TenantUser atomically, without requiring admin authority. Supplied names and metadata replace stored values, omitted profile fields and admin are preserved, and an explicit admin claim updates stored admin. An organization JWT returns existing user membership and the current database role without provisioning identities. API keys and cookies are not accepted. Limited to 100 requests per five minutes per identity.
300
+ * @summary Get the current user
301
+ */
302
+ const getCurrentUser = (options) => {
303
+ return astralBeamJwtFetch(getGetCurrentUserUrl(), {
304
+ ...options,
305
+ method: "POST"
306
+ });
307
+ };
295
308
  //#endregion
296
- export { updateTenantUser as C, DEFAULT_CHAT_AUTH_TOKEN_URL as D, resolveApiUrl as E, DEFAULT_COLOR_SCHEME as O, updateTenant as S, isAstralBeamApiError as T, getUpdateTenantUrl as _, getChatFile as a, listUsersForTenant as b, getGetChatConfigUrl as c, getGetTenantUserUrl as d, getListTenantsUrl as f, getTenantUser as g, getTenant as h, getChatConfig as i, getGetChatFileUrl as l, getRunChatUrl as m, createTenant as n, getCreateTenantUrl as o, getListUsersForTenantUrl as p, createTenantUser as r, getCreateTenantUserUrl as s, ListUsersForTenantFilterAdmin as t, getGetTenantUrl as u, getUpdateTenantUserUrl as v, astralBeamChatFetch as w, runChat as x, listTenants as y };
309
+ export { DEFAULT_COLOR_SCHEME as A, runChat as C, isAstralBeamApiError as D, astralBeamChatFetch as E, resolveApiUrl as O, listUsersForTenant as S, updateTenantUser as T, getTenant as _, getChatFile as a, getUpdateTenantUserUrl as b, getCurrentUser as c, getGetCurrentUserUrl as d, getGetTenantUrl as f, getRunChatUrl as g, getListUsersForTenantUrl as h, getChatConfig as i, DEFAULT_CHAT_AUTH_TOKEN_URL as k, getGetChatConfigUrl as l, getListTenantsUrl as m, createTenant as n, getCreateTenantUrl as o, getGetTenantUserUrl as p, createTenantUser as r, getCreateTenantUserUrl as s, ListUsersForTenantFilterAdmin as t, getGetChatFileUrl as u, getTenantUser as v, updateTenant as w, listTenants as x, getUpdateTenantUrl as y };