@astralbeam/sdk 0.13.6 → 0.13.8

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
@@ -29,7 +29,7 @@ Without npm or a bundler, import the same entry from jsDelivr in a module script
29
29
 
30
30
  ```html
31
31
  <script type="module">
32
- import { mountAstralBeamChat } from "https://cdn.jsdelivr.net/npm/@astralbeam/sdk@0.13.6/dist/client.js"
32
+ import { mountAstralBeamChat } from "https://cdn.jsdelivr.net/npm/@astralbeam/sdk@0.13.8/dist/client.js"
33
33
 
34
34
  mountAstralBeamChat(document.getElementById("sidebar"), {})
35
35
  </script>
@@ -29,34 +29,6 @@ declare function astralBeamChatFetch<_T>(path: string, options: JwtOptions): Pro
29
29
  declare function astralBeamFileFetch<_T>(path: string, options?: FileOptions): Promise<Response>;
30
30
  //#endregion
31
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
32
  type AstralBeamApiErrorIssuesItem = {
61
33
  path: string;
62
34
  message: string;
@@ -67,36 +39,26 @@ interface AstralBeamApiError {
67
39
  status: number;
68
40
  detail: string;
69
41
  issues?: AstralBeamApiErrorIssuesItem[];
42
+ /** Identifies the server log entry of an internal error. Quote it for support. */
43
+ reference?: string;
70
44
  }
71
45
  /**
72
- * Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object.
46
+ * Customer-defined JSON object; keys are preserved.
73
47
  */
74
- type CreateTenantInputMetadata = {
48
+ type TenantRecordEncodedMetadata = {
75
49
  [key: string]: unknown;
76
50
  };
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
51
  /**
90
- * Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object.
52
+ * Persisted Tenant; id is internal, external_id is the customer's exact identity.
91
53
  */
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;
54
+ interface TenantRecordEncoded {
55
+ id: string;
56
+ external_id: string;
57
+ name: string | null;
58
+ /** Customer-defined JSON object; keys are preserved. */
59
+ metadata: TenantRecordEncodedMetadata;
60
+ created_at: string;
61
+ updated_at: string;
100
62
  }
101
63
  /**
102
64
  * Customer-defined JSON object; keys are preserved.
@@ -118,15 +80,75 @@ interface TenantUserRecordEncoded {
118
80
  tenant_id: string;
119
81
  admin: boolean;
120
82
  }
83
+ type CurrentUser = {
84
+ scope: "tenant";
85
+ organization: {
86
+ id: string;
87
+ };
88
+ tenant: TenantRecordEncoded;
89
+ user: TenantUserRecordEncoded;
90
+ } | {
91
+ scope: "organization";
92
+ organization: {
93
+ id: string;
94
+ };
95
+ user: {
96
+ id: string;
97
+ name: string;
98
+ email: string;
99
+ role: string;
100
+ };
101
+ };
102
+ type ChatConfigurationCapabilities = {
103
+ attachments: boolean;
104
+ };
105
+ interface ChatConfiguration {
106
+ capabilities: ChatConfigurationCapabilities;
107
+ }
108
+ type ChatRunInputForwardedProps = {
109
+ [key: string]: unknown;
110
+ };
121
111
  /**
122
- * Live keyset page in ascending ID order within one Tenant. Pass either non-null continuation value as the same-named request parameter.
112
+ * Legacy mirror of forwardedProps sent by TanStack AI clients.
123
113
  */
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;
114
+ type ChatRunInputData = {
115
+ [key: string]: unknown;
116
+ };
117
+ /**
118
+ * 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.
119
+ */
120
+ interface ChatRunInput {
121
+ threadId: string;
122
+ runId: string;
123
+ messages: unknown[];
124
+ tools: unknown[];
125
+ context: unknown[];
126
+ forwardedProps?: ChatRunInputForwardedProps;
127
+ /** Legacy mirror of forwardedProps sent by TanStack AI clients. */
128
+ data?: ChatRunInputData;
129
+ state?: unknown;
130
+ parentRunId?: string;
131
+ resume?: unknown[];
132
+ }
133
+ interface Organization {
134
+ id: string;
135
+ name: string;
136
+ /** Editable dashboard URL segment. Use id, not slug, as the stable identity. */
137
+ slug: string;
138
+ }
139
+ /**
140
+ * Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object.
141
+ */
142
+ type UpdateTenantUserInputMetadata = {
143
+ [key: string]: unknown;
144
+ };
145
+ interface UpdateTenantUserInput {
146
+ /** Defaults to null on creation. Send null to clear the name. */
147
+ name?: string | null;
148
+ /** Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object. */
149
+ metadata?: UpdateTenantUserInputMetadata;
150
+ /** Defaults to false on creation. Stored admin does not change signed JWT authority. */
151
+ admin?: boolean;
130
152
  }
131
153
  /**
132
154
  * Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object.
@@ -148,76 +170,56 @@ interface CreateTenantUserInput {
148
170
  /** Defaults to false on creation. Stored admin does not change signed JWT authority. */
149
171
  admin?: boolean;
150
172
  }
173
+ /**
174
+ * Live keyset page in ascending ID order within one Tenant. Pass either non-null continuation value as the same-named request parameter.
175
+ */
176
+ interface TenantUserPage {
177
+ items: TenantUserRecordEncoded[];
178
+ /** Pass as page_after to fetch the next page; null means no next page. */
179
+ page_after: string | null;
180
+ /** Pass as page_before to fetch the previous page; null means no previous page. */
181
+ page_before: string | null;
182
+ }
151
183
  /**
152
184
  * Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object.
153
185
  */
154
- type UpdateTenantUserInputMetadata = {
186
+ type UpdateTenantInputMetadata = {
155
187
  [key: string]: unknown;
156
188
  };
157
- interface UpdateTenantUserInput {
189
+ interface UpdateTenantInput {
158
190
  /** Defaults to null on creation. Send null to clear the name. */
159
191
  name?: string | null;
160
192
  /** 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
- interface Organization {
166
- id: string;
167
- name: string;
168
- /** Editable dashboard URL segment. Use id, not slug, as the stable identity. */
169
- slug: string;
193
+ metadata?: UpdateTenantInputMetadata;
170
194
  }
171
- type ChatRunInputForwardedProps = {
172
- [key: string]: unknown;
173
- };
174
195
  /**
175
- * Legacy mirror of forwardedProps sent by TanStack AI clients.
196
+ * Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object.
176
197
  */
177
- type ChatRunInputData = {
198
+ type CreateTenantInputMetadata = {
178
199
  [key: string]: unknown;
179
200
  };
201
+ interface CreateTenantInput {
202
+ /**
203
+ * Your stable external identity. Exact and case-sensitive; whitespace is preserved. Immutable after creation.
204
+ * @minLength 1
205
+ * @maxLength 255
206
+ */
207
+ external_id: string;
208
+ /** Defaults to null on creation. Send null to clear the name. */
209
+ name?: string | null;
210
+ /** Customer-defined JSON object; keys are preserved. Defaults to {} on creation. Updates replace the entire object. */
211
+ metadata?: CreateTenantInputMetadata;
212
+ }
180
213
  /**
181
- * 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.
214
+ * Live keyset page. Pass either non-null continuation value as the same-named request parameter.
182
215
  */
183
- interface ChatRunInput {
184
- threadId: string;
185
- runId: string;
186
- messages: unknown[];
187
- tools: unknown[];
188
- context: unknown[];
189
- forwardedProps?: ChatRunInputForwardedProps;
190
- /** Legacy mirror of forwardedProps sent by TanStack AI clients. */
191
- data?: ChatRunInputData;
192
- state?: unknown;
193
- parentRunId?: string;
194
- resume?: unknown[];
195
- }
196
- type ChatConfigurationCapabilities = {
197
- attachments: boolean;
198
- };
199
- interface ChatConfiguration {
200
- capabilities: ChatConfigurationCapabilities;
216
+ interface TenantPage {
217
+ items: TenantRecordEncoded[];
218
+ /** Pass as page_after to fetch the next page; null means no next page. */
219
+ page_after: string | null;
220
+ /** Pass as page_before to fetch the previous page; null means no previous page. */
221
+ page_before: string | null;
201
222
  }
202
- type CurrentUser = {
203
- scope: "tenant";
204
- organization: {
205
- id: string;
206
- };
207
- tenant: TenantRecordEncoded;
208
- user: TenantUserRecordEncoded;
209
- } | {
210
- scope: "organization";
211
- organization: {
212
- id: string;
213
- };
214
- user: {
215
- id: string;
216
- name: string;
217
- email: string;
218
- role: string;
219
- };
220
- };
221
223
  type ListTenantsParams = {
222
224
  /**
223
225
  * Case-insensitive literal substring of name or external_id. Trimmed, blank means no search.
@@ -344,7 +346,7 @@ declare const getGetOrganizationUrl: () => string;
344
346
  declare const getOrganization: (options: Parameters<typeof astralBeamApiFetch>[1]) => Promise<Organization>;
345
347
  declare const getRunChatUrl: () => string;
346
348
  /**
347
- * 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.
349
+ * 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 200 requests per minute per organization, tenant, and user.
348
350
  * @summary Run chat
349
351
  */
350
352
  declare const runChat: (chatRunInput: ChatRunInput, options: Parameters<typeof astralBeamChatFetch>[1]) => Promise<Response>;
@@ -248,7 +248,7 @@ const getRunChatUrl = () => {
248
248
  return `/api/v1/chat`;
249
249
  };
250
250
  /**
251
- * 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.
251
+ * 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 200 requests per minute per organization, tenant, and user.
252
252
  * @summary Run chat
253
253
  */
254
254
  const runChat = (chatRunInput, options) => {
package/dist/api.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as updateTenant, A as createTenantUser, B as getGetTenantUrl, C as TenantUserRecordEncoded, D as UpdateTenantUserInput, E as UpdateTenantInputMetadata, F as getCurrentUser, G as getRunChatUrl, H as getListTenantsUrl, I as getGetChatConfigUrl, J as getUpdateTenantUrl, K as getTenant, L as getGetChatFileUrl, M as getChatFile, N as getCreateTenantUrl, O as UpdateTenantUserInputMetadata, P as getCreateTenantUserUrl, Q as runChat, R as getGetCurrentUserUrl, S as TenantUserPage, T as UpdateTenantInput, U as getListUsersForTenantUrl, V as getGetTenantUserUrl, W as getOrganization, X as listTenants, Y as getUpdateTenantUserUrl, Z as listUsersForTenant, _ as ListUsersForTenantParams, a as ChatRunInput, at as FileOptions, b as TenantRecordEncoded, c as CreateTenantInput, d as CreateTenantUserInputMetadata, et as updateTenantUser, f as CurrentUser, g as ListUsersForTenantFilterAdmin, h as ListTenantsParams, i as ChatConfigurationCapabilities, it as AstralBeamApiError, j as getChatConfig, k as createTenant, l as CreateTenantInputMetadata, m as GetChatFileParams, n as AstralBeamApiErrorIssuesItem, nt as ApiOptions, o as ChatRunInputData, ot as JwtOptions, p as GetChatConfigParams, q as getTenantUser, r as ChatConfiguration, rt as ApiRequestOptions, s as ChatRunInputForwardedProps, st as isAstralBeamApiError, t as AstralBeamApiError$1, tt as ApiKeyOptions, u as CreateTenantUserInput, v as Organization, w as TenantUserRecordEncodedMetadata, x as TenantRecordEncodedMetadata, y as TenantPage, z as getGetOrganizationUrl } from "./api-ImuMGEar.js";
1
+ import { $ as updateTenant, A as createTenantUser, B as getGetTenantUrl, C as TenantUserRecordEncoded, D as UpdateTenantUserInput, E as UpdateTenantInputMetadata, F as getCurrentUser, G as getRunChatUrl, H as getListTenantsUrl, I as getGetChatConfigUrl, J as getUpdateTenantUrl, K as getTenant, L as getGetChatFileUrl, M as getChatFile, N as getCreateTenantUrl, O as UpdateTenantUserInputMetadata, P as getCreateTenantUserUrl, Q as runChat, R as getGetCurrentUserUrl, S as TenantUserPage, T as UpdateTenantInput, U as getListUsersForTenantUrl, V as getGetTenantUserUrl, W as getOrganization, X as listTenants, Y as getUpdateTenantUserUrl, Z as listUsersForTenant, _ as ListUsersForTenantParams, a as ChatRunInput, at as FileOptions, b as TenantRecordEncoded, c as CreateTenantInput, d as CreateTenantUserInputMetadata, et as updateTenantUser, f as CurrentUser, g as ListUsersForTenantFilterAdmin, h as ListTenantsParams, i as ChatConfigurationCapabilities, it as AstralBeamApiError, j as getChatConfig, k as createTenant, l as CreateTenantInputMetadata, m as GetChatFileParams, n as AstralBeamApiErrorIssuesItem, nt as ApiOptions, o as ChatRunInputData, ot as JwtOptions, p as GetChatConfigParams, q as getTenantUser, r as ChatConfiguration, rt as ApiRequestOptions, s as ChatRunInputForwardedProps, st as isAstralBeamApiError, t as AstralBeamApiError$1, tt as ApiKeyOptions, u as CreateTenantUserInput, v as Organization, w as TenantUserRecordEncodedMetadata, x as TenantRecordEncodedMetadata, y as TenantPage, z as getGetOrganizationUrl } from "./api-BKUwOnRz.js";
2
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, Organization, TenantPage, TenantRecordEncoded, TenantRecordEncodedMetadata, TenantUserPage, TenantUserRecordEncoded, TenantUserRecordEncodedMetadata, UpdateTenantInput, UpdateTenantInputMetadata, UpdateTenantUserInput, UpdateTenantUserInputMetadata, createTenant, createTenantUser, getChatConfig, getChatFile, getCreateTenantUrl, getCreateTenantUserUrl, getCurrentUser, getGetChatConfigUrl, getGetChatFileUrl, getGetCurrentUserUrl, getGetOrganizationUrl, getGetTenantUrl, getGetTenantUserUrl, getListTenantsUrl, getListUsersForTenantUrl, getOrganization, getRunChatUrl, getTenant, getTenantUser, getUpdateTenantUrl, getUpdateTenantUserUrl, isAstralBeamApiError, listTenants, listUsersForTenant, runChat, updateTenant, updateTenantUser };
package/dist/api.js CHANGED
@@ -1,2 +1,2 @@
1
- import { C as listTenants, D as updateTenantUser, E as updateTenant, S as getUpdateTenantUserUrl, T as runChat, _ as getOrganization, a as getChatFile, b as getTenantUser, c as getCurrentUser, d as getGetCurrentUserUrl, f as getGetOrganizationUrl, g as getListUsersForTenantUrl, h as getListTenantsUrl, i as getChatConfig, k as isAstralBeamApiError, l as getGetChatConfigUrl, m as getGetTenantUserUrl, n as createTenant, o as getCreateTenantUrl, p as getGetTenantUrl, r as createTenantUser, s as getCreateTenantUserUrl, t as ListUsersForTenantFilterAdmin, u as getGetChatFileUrl, v as getRunChatUrl, w as listUsersForTenant, x as getUpdateTenantUrl, y as getTenant } from "./api-DiwSihrG.js";
1
+ import { C as listTenants, D as updateTenantUser, E as updateTenant, S as getUpdateTenantUserUrl, T as runChat, _ as getOrganization, a as getChatFile, b as getTenantUser, c as getCurrentUser, d as getGetCurrentUserUrl, f as getGetOrganizationUrl, g as getListUsersForTenantUrl, h as getListTenantsUrl, i as getChatConfig, k as isAstralBeamApiError, l as getGetChatConfigUrl, m as getGetTenantUserUrl, n as createTenant, o as getCreateTenantUrl, p as getGetTenantUrl, r as createTenantUser, s as getCreateTenantUserUrl, t as ListUsersForTenantFilterAdmin, u as getGetChatFileUrl, v as getRunChatUrl, w as listUsersForTenant, x as getUpdateTenantUrl, y as getTenant } from "./api-CsRaydMf.js";
2
2
  export { ListUsersForTenantFilterAdmin, createTenant, createTenantUser, getChatConfig, getChatFile, getCreateTenantUrl, getCreateTenantUserUrl, getCurrentUser, getGetChatConfigUrl, getGetChatFileUrl, getGetCurrentUserUrl, getGetOrganizationUrl, getGetTenantUrl, getGetTenantUserUrl, getListTenantsUrl, getListUsersForTenantUrl, getOrganization, getRunChatUrl, getTenant, getTenantUser, getUpdateTenantUrl, getUpdateTenantUserUrl, isAstralBeamApiError, listTenants, listUsersForTenant, runChat, updateTenant, updateTenantUser };
package/dist/client.js CHANGED
@@ -1 +1 @@
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-BQZUPClK.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-C31rEqSh.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};
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-BQZUPClK.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-DtcXZ3qb.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};