@astralbeam/sdk 0.20.3 → 0.22.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 +9 -1
- package/dist/abort-_ZeHSwUG.js +1 -0
- package/dist/{api-B3UxSTtl.js → api-SpkUzEv3.js} +24 -30
- package/dist/api.d.ts +2 -2
- package/dist/api.js +1 -1
- package/dist/{badge-sVUP8vL9.js → badge-DhXUFnRC.js} +1 -1
- package/dist/client.d.ts +7 -3
- package/dist/client.js +1 -1
- package/dist/{core-D53b-MKt.js → core-CWFT6Db_.js} +1594 -762
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/{highlighter-DvZ03STw.js → highlighter-DldDI8mb.js} +1 -1
- package/dist/{index-DFxtXIXy.d.ts → index-D8X2hDGe.d.ts} +39 -25
- package/dist/{index-BEH3ZhY5.d.ts → index-DatxwZpZ.d.ts} +397 -115
- package/dist/{item-CIByj-ZQ.js → item-Cv2zb7Kn.js} +1 -1
- package/dist/listings-CyliP2E5.js +1 -0
- package/dist/{mcp-servers-BvW_M9Uu.js → mcp-servers-DvCu1KuJ.js} +1 -1
- package/dist/react.d.ts +11 -56
- package/dist/react.js +17 -16
- package/dist/{styles.generated-C1BUZU5O.js → styles.generated-CwyGUg6r.js} +1 -1
- package/dist/threads-rrcqQzl8.js +25 -0
- package/dist/widget-BOdanf0E.js +27 -0
- package/package.json +4 -4
- package/dist/listings-CvKjdN1L.js +0 -1
- package/dist/threads-CAvJZkUj.js +0 -25
- package/dist/widget-Dh-sQrQw.js +0 -26
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.
|
|
32
|
+
import { mountAstralBeamChat } from "https://cdn.jsdelivr.net/npm/@astralbeam/sdk@0.22.0/dist/client.js"
|
|
33
33
|
|
|
34
34
|
mountAstralBeamChat(document.getElementById("sidebar"), {})
|
|
35
35
|
</script>
|
|
@@ -115,6 +115,8 @@ Conversations are saved automatically and start private. The widget searches sav
|
|
|
115
115
|
|
|
116
116
|
The headless session exposes conversation navigation, search, and pagination. With `useAstralBeamChat`, access these through `chat.core`, for example `chat.core.openThread(threadId)`. History loads a page at a time. `reset()` starts a new chat and keeps the saved one.
|
|
117
117
|
|
|
118
|
+
Download an attachment with `chat.core.getThreadAttachment({ threadId, fileId })`, which returns a `Blob`. Organization and participant tenant scope come from your credentials. Administrative downloads also pass `tenantId`. Use `{ preview: true }` as the second argument for a thumbnail. Only previews of your unsent uploads may omit `threadId`.
|
|
119
|
+
|
|
118
120
|
By default, `threadId: "auto"` restores this tab's selection after reload using session storage, scoped to the current account and API. A fresh, independently opened tab starts a new chat. Use `threadId: "new"` to bypass restoration, or pass a saved thread UUID. The widget keeps unsent text and uploaded file references in local storage per account, API, and conversation. Reopening restores the draft without sending it automatically. The host owns sidebar visibility and can persist it separately in session storage.
|
|
119
121
|
|
|
120
122
|
## Tools and widgets
|
|
@@ -171,6 +173,12 @@ Reuse the dashboard's server list and form with `AstralBeamMcpServers` from `/re
|
|
|
171
173
|
|
|
172
174
|
Read-only Tenant, TenantUser and conversation widgets are available from `/client` and `/react`. See [Tenant directories](https://astralbeam.ai/docs/sdk/listings) for setup and embedding examples.
|
|
173
175
|
|
|
176
|
+
Directory results stay fresh for 30 seconds, then refresh when the tab becomes visible or the network reconnects. Unused data expires after five minutes. The optional `cacheKey` is an opaque host-session object for remount reuse. Keep it stable during the session and replace it on sign-out or account changes. Changing it clears authentication and the view. Each mount owns its authentication, requests, cancellation, and refresh, independently of concurrent directories.
|
|
177
|
+
|
|
178
|
+
Directory `refresh()` and `reset()` return `Promise<void>` and wait for renderer loading, authentication, and the current directory rows or open conversation messages. Attachment previews load independently. Refresh may reuse the JWT. Reset clears this mount's state and retained data for its key, then reacquires authentication from a ready host session. Unmount during sign-out. See the <a href="https://astralbeam.ai/docs/sdk/listings#account-changes-and-lifecycle" target="_blank" rel="noopener noreferrer">lifecycle contract</a> for remount reuse, failure, and cancellation.
|
|
179
|
+
|
|
180
|
+
**Breaking migration**: React directory refs now expose only `refresh()` and `reset()`. Replace the removed `/react` `*ListHandle` exports with `AstralBeamTenantListRef`, `AstralBeamTenantUserListRef`, or `AstralBeamThreadListRef`. Use props for updates and conditional rendering to unmount. Vanilla `/client` handles retain `update()` and `unmount()`. Await or handle rejection from refresh/reset calls that previously returned `void`.
|
|
181
|
+
|
|
174
182
|
There is no root export.
|
|
175
183
|
|
|
176
184
|
| Entry point | Contents | Peer dependency |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function e(e,t){let n=Promise.withResolvers(),r=()=>n.reject(t.reason);t.addEventListener(`abort`,r,{once:!0}),t.aborted&&r();try{return await Promise.race([e,n.promise])}finally{t.removeEventListener(`abort`,r)}}export{e as t};
|
|
@@ -309,6 +309,24 @@ const updateTenantUser = (tenantId, id, updateTenantUserInput, options) => {
|
|
|
309
309
|
body: JSON.stringify(updateTenantUserInput)
|
|
310
310
|
});
|
|
311
311
|
};
|
|
312
|
+
const getGetTenantUserUsageUrl = (tenantId, params) => {
|
|
313
|
+
const normalizedParams = new URLSearchParams();
|
|
314
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
315
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
316
|
+
});
|
|
317
|
+
const stringifiedParams = normalizedParams.toString();
|
|
318
|
+
return stringifiedParams.length > 0 ? `/api/v1/tenants/${encodeURIComponent(String(tenantId))}/tenant_users/usage?${stringifiedParams}` : `/api/v1/tenants/${encodeURIComponent(String(tenantId))}/tenant_users/usage`;
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Read usage in USD for up to 100 users within one Tenant over a positive time range no longer than 93 days. start is inclusive and end is exclusive. Supply ISO 8601 timestamps with an explicit timezone and at most millisecond precision. Only Organization API keys and organization owners or developers may read usage. Missing and out-of-scope user IDs are omitted. Existing users with no settled replies in the range return zero. Results are computed at request time from retained settled replies. Drafts and deleted conversations are excluded, and older replies without saved costs use current rates.
|
|
322
|
+
* @summary Get TenantUser usage
|
|
323
|
+
*/
|
|
324
|
+
const getTenantUserUsage = (tenantId, params, options) => {
|
|
325
|
+
return astralBeamApiFetch(getGetTenantUserUsageUrl(tenantId, params), {
|
|
326
|
+
...options,
|
|
327
|
+
method: "GET"
|
|
328
|
+
});
|
|
329
|
+
};
|
|
312
330
|
const getGetOrganizationUrl = () => {
|
|
313
331
|
return `/api/v1/organization`;
|
|
314
332
|
};
|
|
@@ -357,18 +375,6 @@ const listThreadMessages = (tenantId, id, params, options) => {
|
|
|
357
375
|
method: "GET"
|
|
358
376
|
});
|
|
359
377
|
};
|
|
360
|
-
const getGetThreadAttachmentUrl = (tenantId, id, messageId, partId) => {
|
|
361
|
-
return `/api/v1/tenants/${encodeURIComponent(String(tenantId))}/threads/${encodeURIComponent(String(id))}/messages/${encodeURIComponent(String(messageId))}/attachments/${encodeURIComponent(String(partId))}`;
|
|
362
|
-
};
|
|
363
|
-
/**
|
|
364
|
-
* @summary Download a saved conversation upload for administration
|
|
365
|
-
*/
|
|
366
|
-
const getThreadAttachment = (tenantId, id, messageId, partId, options) => {
|
|
367
|
-
return astralBeamResourceFetch(getGetThreadAttachmentUrl(tenantId, id, messageId, partId), {
|
|
368
|
-
...options,
|
|
369
|
-
method: "GET"
|
|
370
|
-
});
|
|
371
|
-
};
|
|
372
378
|
const getUploadChatFileUrl = () => {
|
|
373
379
|
return `/api/v1/chat/files`;
|
|
374
380
|
};
|
|
@@ -395,7 +401,7 @@ const uploadChatFile = (uploadChatFileBody, options) => {
|
|
|
395
401
|
body: JSON.stringify(uploadChatFileBody)
|
|
396
402
|
});
|
|
397
403
|
};
|
|
398
|
-
const
|
|
404
|
+
const getGetThreadAttachmentUrl = (params) => {
|
|
399
405
|
const normalizedParams = new URLSearchParams();
|
|
400
406
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
401
407
|
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
@@ -404,11 +410,11 @@ const getGetChatFileUrl = (params) => {
|
|
|
404
410
|
return stringifiedParams.length > 0 ? `/api/v1/chat/files?${stringifiedParams}` : `/api/v1/chat/files`;
|
|
405
411
|
};
|
|
406
412
|
/**
|
|
407
|
-
*
|
|
408
|
-
* @summary Download a chat
|
|
413
|
+
* Pass the fileId from a saved message, its threadId, and an optional download filename. Tenant JWTs require current conversation membership. Administrative reads also pass tenantId and require directory-read permission through an Organization API key, Organization-management JWT, or signed Tenant admin JWT. Send X-File-Preview: true for a cached thumbnail, or 204 when unavailable. Only the uploader's unsent previews may omit threadId. Original downloads verify stored bytes.
|
|
414
|
+
* @summary Download a chat file
|
|
409
415
|
*/
|
|
410
|
-
const
|
|
411
|
-
return
|
|
416
|
+
const getThreadAttachment = (params, options) => {
|
|
417
|
+
return astralBeamResourceFetch(getGetThreadAttachmentUrl(params), {
|
|
412
418
|
...options,
|
|
413
419
|
method: "GET"
|
|
414
420
|
});
|
|
@@ -690,18 +696,6 @@ const resolveChatToolResult = (id, resolveChatToolResultInputEncoded, options) =
|
|
|
690
696
|
body: JSON.stringify(resolveChatToolResultInputEncoded)
|
|
691
697
|
});
|
|
692
698
|
};
|
|
693
|
-
const getGetChatAttachmentUrl = (id, messageId, partId) => {
|
|
694
|
-
return `/api/v1/chat/threads/${encodeURIComponent(String(id))}/messages/${encodeURIComponent(String(messageId))}/attachments/${encodeURIComponent(String(partId))}`;
|
|
695
|
-
};
|
|
696
|
-
/**
|
|
697
|
-
* @summary Download a saved attachment
|
|
698
|
-
*/
|
|
699
|
-
const getChatAttachment = (id, messageId, partId, options) => {
|
|
700
|
-
return astralBeamChatFetch(getGetChatAttachmentUrl(id, messageId, partId), {
|
|
701
|
-
...options,
|
|
702
|
-
method: "GET"
|
|
703
|
-
});
|
|
704
|
-
};
|
|
705
699
|
const getGetCurrentUserUrl = () => {
|
|
706
700
|
return `/api/v1/me`;
|
|
707
701
|
};
|
|
@@ -840,4 +834,4 @@ const personalMcpCompleteAuthorization = (id, personalMcpCompleteAuthorizationBo
|
|
|
840
834
|
});
|
|
841
835
|
};
|
|
842
836
|
//#endregion
|
|
843
|
-
export {
|
|
837
|
+
export { getPersonalMcpSetHeadersUrl as $, getGetChatConfigUrl as A, resolveChatToolResult as At, getListChatParticipantsUrl as B, resolveApiUrl as Bt, getChatThread as C, personalMcpCompleteAuthorization as Ct, getCreateTenantUserUrl as D, personalMcpSetHeaders as Dt, getCreateTenantUrl as E, personalMcpGetCatalog as Et, getGetTenantUrl as F, updateTenant as Ft, getListUsersForTenantUrl as G, getListTenantsUrl as H, DEFAULT_CHAT_AUTH_TOKEN_URL as Ht, getGetTenantUserUrl as I, updateTenantUser as It, getPersonalMcpBindBrowserUrl as J, getOrganization as K, getGetTenantUserUsageUrl as L, uploadChatFile as Lt, getGetChatUsageUrl as M, searchChatTenantUsers as Mt, getGetCurrentUserUrl as N, setChatParticipant as Nt, getCurrentUser as O, personalMcpTestConnection as Ot, getGetOrganizationUrl as P, updateChatThread as Pt, getPersonalMcpGetCatalogUrl as Q, getGetThreadAttachmentUrl as R, astralBeamChatFetch as Rt, getChatConfig as S, personalMcpBindBrowser as St, getCreateChatThreadUrl as T, personalMcpDisconnectConnection as Tt, getListThreadMessagesUrl as U, DEFAULT_COLOR_SCHEME as Ut, getListChatThreadsUrl as V, DEFAULT_API_URL as Vt, getListThreadsUrl as W, getPersonalMcpCreateConnectionUrl as X, getPersonalMcpCompleteAuthorizationUrl as Y, getPersonalMcpDisconnectConnectionUrl as Z, UploadChatFileBodyType as _, listTenants as _t, ChatMessageEncodedRole as a, getSetChatParticipantUrl as at, createTenantUser as b, listUsersForTenant as bt, ChatThreadEncodedRole as c, getTenantUserUsage as ct, ListUsersForTenantFilterAdmin as d, getUpdateTenantUrl as dt, getPersonalMcpTestConnectionUrl as et, McpConnectionEncodedAuthState as f, getUpdateTenantUserUrl as ft, UploadChatFileBodySourceType as g, listChatThreads as gt, SetChatParticipantInputEncodedRole as h, listChatParticipants as ht, ChatHistoryPageEncodedThreadRole as i, getSearchChatTenantUsersUrl as it, getGetChatThreadUrl as j, runChat as jt, getDeleteChatThreadUrl as k, removeChatParticipant as kt, ChatUsageUsageLimitsItemMetric as l, getThreadAttachment as lt, ResolveChatToolResultInputEncodedResultsItemOutcome as m, listChatMessages as mt, ChatHistoryPageEncodedMessagesItemState as n, getResolveChatToolResultUrl as nt, ChatMessageEncodedState as o, getTenant as ot, McpServerEncodedAuthKind as p, getUploadChatFileUrl as pt, getPersonalMcpAuthorizeConnectionUrl as q, ChatHistoryPageEncodedPendingInteractionsItemExecutionLocation as r, getRunChatUrl as rt, ChatParticipantEncodedRole as s, getTenantUser as st, ChatHistoryPageEncodedMessagesItemRole as t, getRemoveChatParticipantUrl as tt, ChatUsageUsageLimitsItemScope as u, getUpdateChatThreadUrl as ut, createChatThread as v, listThreadMessages as vt, getChatUsage as w, personalMcpCreateConnection as wt, deleteChatThread as x, personalMcpAuthorizeConnection as xt, createTenant as y, listThreads as yt, getListChatMessagesUrl as z, isAstralBeamApiError as zt };
|
package/dist/api.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as ListChatThreadsParams, $n as personalMcpGetCatalog, $t as getCreateTenantUrl, A as
|
|
2
|
-
export { type ApiKeyOptions, type ApiOptions, type ApiRequestOptions, AstralBeamApiError, type AstralBeamApiError$1 as AstralBeamApiErrorBody, AstralBeamApiErrorIssuesItem, AstralBeamApiErrorUsageLimit, ChatConfiguration, ChatConfigurationCapabilities, ChatHistoryPageEncoded, ChatHistoryPageEncodedMessagesItem, ChatHistoryPageEncodedMessagesItemPartsItem, ChatHistoryPageEncodedMessagesItemRole, ChatHistoryPageEncodedMessagesItemState, ChatHistoryPageEncodedPendingInteractionsItem, ChatHistoryPageEncodedPendingInteractionsItemExecutionLocation, ChatHistoryPageEncodedThread, ChatHistoryPageEncodedThreadRole, ChatMessageEncoded, ChatMessageEncodedPartsItem, ChatMessageEncodedRole, ChatMessageEncodedState, ChatParticipantEncoded, ChatParticipantEncodedRole, ChatParticipantPage, ChatRunInput,
|
|
1
|
+
import { $ as ListChatThreadsParams, $n as personalMcpGetCatalog, $t as getCreateTenantUrl, A as ChatToolResultReceiptEncoded, An as getRunChatUrl, At as TenantUserRecordEncoded, B as CreateTenantUserInputMetadata, Bn as getUploadChatFileUrl, Bt as UploadChatFileBodyMetadata, C as ChatRunInputForwardedProps, Cn as getPersonalMcpCreateConnectionUrl, Ct as SearchChatTenantUsersParams, D as ChatThreadEncoded, Dn as getPersonalMcpTestConnectionUrl, Dt as TenantRecordEncoded, E as ChatTenantUserPage, En as getPersonalMcpSetHeadersUrl, Et as TenantPage, F as ChatUsageUsageLimitsItemScope, Fn as getTenantUserUsage, Ft as UpdateTenantInput, G as DirectoryThreadHistoryPage, Gn as listThreadMessages, Gt as createChatThread, H as DeleteChatThreadParams, Hn as listChatParticipants, Ht as UploadChatFileBodySourceType, I as CreateChatThreadInputEncoded, In as getThreadAttachment, It as UpdateTenantInputMetadata, J as GetChatUsageParams, Jn as personalMcpAuthorizeConnection, Jt as deleteChatThread, K as DirectoryThreadPage, Kn as listThreads, Kt as createTenant, L as CreateTenantInput, Ln as getUpdateChatThreadUrl, Lt as UpdateTenantUserInput, M as ChatUsage, Mn as getSetChatParticipantUrl, Mt as TenantUserUsage, N as ChatUsageUsageLimitsItem, Nn as getTenant, Nt as TenantUserUsageItemsItem, O as ChatThreadEncodedRole, On as getRemoveChatParticipantUrl, Ot as TenantRecordEncodedMetadata, P as ChatUsageUsageLimitsItemMetric, Pn as getTenantUser, Pt as UpdateChatThreadInputEncoded, Q as ListChatParticipantsParams, Qn as personalMcpDisconnectConnection, Qt as getCreateChatThreadUrl, R as CreateTenantInputMetadata, Rn as getUpdateTenantUrl, Rt as UpdateTenantUserInputMetadata, S as ChatRunInput, Sn as getPersonalMcpCompleteAuthorizationUrl, St as ResolveChatToolResultInputEncodedResultsItemOutcome, T as ChatTenantUserEncoded, Tn as getPersonalMcpGetCatalogUrl, Tt as SetChatParticipantInputEncodedRole, U as DirectoryThreadEncoded, Un as listChatThreads, Ut as UploadChatFileBodyType, V as CurrentUser, Vn as listChatMessages, Vt as UploadChatFileBodySource, W as DirectoryThreadEncodedParticipantsItem, Wn as listTenants, Wt as UploadedChatFile, X as GetThreadAttachmentParams, Xn as personalMcpCompleteAuthorization, Xt as getChatThread, Y as GetTenantUserUsageParams, Yn as personalMcpBindBrowser, Yt as getChatConfig, Z as ListChatMessagesParams, Zn as personalMcpCreateConnection, Zt as getChatUsage, _ as ChatMessageEncodedRole, _n as getListThreadsUrl, _t as PersonalMcpSetHeadersBodyHeaders, a as ChatConfigurationCapabilities, an as getGetChatUsageUrl, ar as searchChatTenantUsers, at as McpConnectionEncoded, b as ChatParticipantEncodedRole, bn as getPersonalMcpAuthorizeConnectionUrl, bt as ResolveChatToolResultInputEncoded, c as ChatHistoryPageEncodedMessagesItemPartsItem, cn as getGetTenantUrl, cr as updateTenant, ct as McpServerEncodedAuthKind, d as ChatHistoryPageEncodedPendingInteractionsItem, dn as getGetThreadAttachmentUrl, dr as ApiKeyOptions, dt as PersonalMcpAuthorizeConnection200Attempt, en as getCreateTenantUserUrl, er as personalMcpSetHeaders, et as ListTenantsParams, f as ChatHistoryPageEncodedPendingInteractionsItemExecutionLocation, fn as getListChatMessagesUrl, fr as ApiOptions, ft as PersonalMcpBindBrowserBody, g as ChatMessageEncodedPartsItem, gn as getListThreadMessagesUrl, gr as isAstralBeamApiError, gt as PersonalMcpSetHeadersBody, h as ChatMessageEncoded, hn as getListTenantsUrl, hr as JwtOptions, ht as PersonalMcpGetCatalog200, i as ChatConfiguration, in as getGetChatThreadUrl, ir as runChat, it as ListUsersForTenantParams, j as ChatToolResultReceiptEncodedUsageLimit, jn as getSearchChatTenantUsersUrl, jt as TenantUserRecordEncodedMetadata, k as ChatThreadPage, kn as getResolveChatToolResultUrl, kt as TenantUserPage, l as ChatHistoryPageEncodedMessagesItemRole, ln as getGetTenantUserUrl, lr as updateTenantUser, lt as Organization, m as ChatHistoryPageEncodedThreadRole, mn as getListChatThreadsUrl, mr as AstralBeamApiError, mt as PersonalMcpCreateConnectionBody, n as AstralBeamApiErrorIssuesItem, nn as getDeleteChatThreadUrl, nr as removeChatParticipant, nt as ListThreadsParams, o as ChatHistoryPageEncoded, on as getGetCurrentUserUrl, or as setChatParticipant, ot as McpConnectionEncodedAuthState, p as ChatHistoryPageEncodedThread, pn as getListChatParticipantsUrl, pr as ApiRequestOptions, pt as PersonalMcpCompleteAuthorizationBody, q as GetChatConfigParams, qn as listUsersForTenant, qt as createTenantUser, r as AstralBeamApiErrorUsageLimit, rn as getGetChatConfigUrl, rr as resolveChatToolResult, rt as ListUsersForTenantFilterAdmin, s as ChatHistoryPageEncodedMessagesItem, sn as getGetOrganizationUrl, sr as updateChatThread, st as McpServerEncoded, t as AstralBeamApiError$1, tn as getCurrentUser, tr as personalMcpTestConnection, tt as ListThreadMessagesParams, u as ChatHistoryPageEncodedMessagesItemState, un as getGetTenantUserUsageUrl, ur as uploadChatFile, ut as PersonalMcpAuthorizeConnection200, v as ChatMessageEncodedState, vn as getListUsersForTenantUrl, vt as PersonalMcpTestConnection200, w as ChatSubmissionReceiptEncoded, wn as getPersonalMcpDisconnectConnectionUrl, wt as SetChatParticipantInputEncoded, x as ChatParticipantPage, xn as getPersonalMcpBindBrowserUrl, xt as ResolveChatToolResultInputEncodedResultsItem, y as ChatParticipantEncoded, yn as getOrganization, yt as RemoveChatParticipantParams, z as CreateTenantUserInput, zn as getUpdateTenantUserUrl, zt as UploadChatFileBody } from "./index-D8X2hDGe.js";
|
|
2
|
+
export { type ApiKeyOptions, type ApiOptions, type ApiRequestOptions, AstralBeamApiError, type AstralBeamApiError$1 as AstralBeamApiErrorBody, AstralBeamApiErrorIssuesItem, AstralBeamApiErrorUsageLimit, ChatConfiguration, ChatConfigurationCapabilities, ChatHistoryPageEncoded, ChatHistoryPageEncodedMessagesItem, ChatHistoryPageEncodedMessagesItemPartsItem, ChatHistoryPageEncodedMessagesItemRole, ChatHistoryPageEncodedMessagesItemState, ChatHistoryPageEncodedPendingInteractionsItem, ChatHistoryPageEncodedPendingInteractionsItemExecutionLocation, ChatHistoryPageEncodedThread, ChatHistoryPageEncodedThreadRole, ChatMessageEncoded, ChatMessageEncodedPartsItem, ChatMessageEncodedRole, ChatMessageEncodedState, ChatParticipantEncoded, ChatParticipantEncodedRole, ChatParticipantPage, ChatRunInput, ChatRunInputForwardedProps, ChatSubmissionReceiptEncoded, ChatTenantUserEncoded, ChatTenantUserPage, ChatThreadEncoded, ChatThreadEncodedRole, ChatThreadPage, ChatToolResultReceiptEncoded, ChatToolResultReceiptEncodedUsageLimit, ChatUsage, ChatUsageUsageLimitsItem, ChatUsageUsageLimitsItemMetric, ChatUsageUsageLimitsItemScope, CreateChatThreadInputEncoded, CreateTenantInput, CreateTenantInputMetadata, CreateTenantUserInput, CreateTenantUserInputMetadata, CurrentUser, DeleteChatThreadParams, DirectoryThreadEncoded, DirectoryThreadEncodedParticipantsItem, DirectoryThreadHistoryPage, DirectoryThreadPage, GetChatConfigParams, GetChatUsageParams, GetTenantUserUsageParams, GetThreadAttachmentParams, type JwtOptions, ListChatMessagesParams, ListChatParticipantsParams, ListChatThreadsParams, ListTenantsParams, ListThreadMessagesParams, ListThreadsParams, ListUsersForTenantFilterAdmin, ListUsersForTenantParams, McpConnectionEncoded, McpConnectionEncodedAuthState, McpServerEncoded, McpServerEncodedAuthKind, Organization, PersonalMcpAuthorizeConnection200, PersonalMcpAuthorizeConnection200Attempt, PersonalMcpBindBrowserBody, PersonalMcpCompleteAuthorizationBody, PersonalMcpCreateConnectionBody, PersonalMcpGetCatalog200, PersonalMcpSetHeadersBody, PersonalMcpSetHeadersBodyHeaders, PersonalMcpTestConnection200, RemoveChatParticipantParams, ResolveChatToolResultInputEncoded, ResolveChatToolResultInputEncodedResultsItem, ResolveChatToolResultInputEncodedResultsItemOutcome, SearchChatTenantUsersParams, SetChatParticipantInputEncoded, SetChatParticipantInputEncodedRole, TenantPage, TenantRecordEncoded, TenantRecordEncodedMetadata, TenantUserPage, TenantUserRecordEncoded, TenantUserRecordEncodedMetadata, TenantUserUsage, TenantUserUsageItemsItem, UpdateChatThreadInputEncoded, UpdateTenantInput, UpdateTenantInputMetadata, UpdateTenantUserInput, UpdateTenantUserInputMetadata, UploadChatFileBody, UploadChatFileBodyMetadata, UploadChatFileBodySource, UploadChatFileBodySourceType, UploadChatFileBodyType, UploadedChatFile, createChatThread, createTenant, createTenantUser, deleteChatThread, getChatConfig, getChatThread, getChatUsage, getCreateChatThreadUrl, getCreateTenantUrl, getCreateTenantUserUrl, getCurrentUser, getDeleteChatThreadUrl, getGetChatConfigUrl, getGetChatThreadUrl, getGetChatUsageUrl, getGetCurrentUserUrl, getGetOrganizationUrl, getGetTenantUrl, getGetTenantUserUrl, getGetTenantUserUsageUrl, getGetThreadAttachmentUrl, getListChatMessagesUrl, getListChatParticipantsUrl, getListChatThreadsUrl, getListTenantsUrl, getListThreadMessagesUrl, getListThreadsUrl, getListUsersForTenantUrl, getOrganization, getPersonalMcpAuthorizeConnectionUrl, getPersonalMcpBindBrowserUrl, getPersonalMcpCompleteAuthorizationUrl, getPersonalMcpCreateConnectionUrl, getPersonalMcpDisconnectConnectionUrl, getPersonalMcpGetCatalogUrl, getPersonalMcpSetHeadersUrl, getPersonalMcpTestConnectionUrl, getRemoveChatParticipantUrl, getResolveChatToolResultUrl, getRunChatUrl, getSearchChatTenantUsersUrl, getSetChatParticipantUrl, getTenant, getTenantUser, getTenantUserUsage, getThreadAttachment, getUpdateChatThreadUrl, getUpdateTenantUrl, getUpdateTenantUserUrl, getUploadChatFileUrl, isAstralBeamApiError, listChatMessages, listChatParticipants, listChatThreads, listTenants, listThreadMessages, listThreads, listUsersForTenant, personalMcpAuthorizeConnection, personalMcpBindBrowser, personalMcpCompleteAuthorization, personalMcpCreateConnection, personalMcpDisconnectConnection, personalMcpGetCatalog, personalMcpSetHeaders, personalMcpTestConnection, removeChatParticipant, resolveChatToolResult, runChat, searchChatTenantUsers, setChatParticipant, updateChatThread, updateTenant, updateTenantUser, uploadChatFile };
|
package/dist/api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ChatHistoryPageEncodedMessagesItemRole, n as ChatHistoryPageEncodedMessagesItemState, r as ChatHistoryPageEncodedPendingInteractionsItemExecutionLocation, i as ChatHistoryPageEncodedThreadRole, a as ChatMessageEncodedRole, o as ChatMessageEncodedState, s as ChatParticipantEncodedRole, c as ChatThreadEncodedRole, l as ChatUsageUsageLimitsItemMetric, u as ChatUsageUsageLimitsItemScope, d as ListUsersForTenantFilterAdmin, f as McpConnectionEncodedAuthState, p as McpServerEncodedAuthKind, m as ResolveChatToolResultInputEncodedResultsItemOutcome, h as SetChatParticipantInputEncodedRole, g as UploadChatFileBodySourceType, _ as UploadChatFileBodyType, v as createChatThread, y as createTenant, b as createTenantUser, x as deleteChatThread, S as
|
|
1
|
+
export { t as ChatHistoryPageEncodedMessagesItemRole, n as ChatHistoryPageEncodedMessagesItemState, r as ChatHistoryPageEncodedPendingInteractionsItemExecutionLocation, i as ChatHistoryPageEncodedThreadRole, a as ChatMessageEncodedRole, o as ChatMessageEncodedState, s as ChatParticipantEncodedRole, c as ChatThreadEncodedRole, l as ChatUsageUsageLimitsItemMetric, u as ChatUsageUsageLimitsItemScope, d as ListUsersForTenantFilterAdmin, f as McpConnectionEncodedAuthState, p as McpServerEncodedAuthKind, m as ResolveChatToolResultInputEncodedResultsItemOutcome, h as SetChatParticipantInputEncodedRole, g as UploadChatFileBodySourceType, _ as UploadChatFileBodyType, v as createChatThread, y as createTenant, b as createTenantUser, x as deleteChatThread, S as getChatConfig, C as getChatThread, w as getChatUsage, T as getCreateChatThreadUrl, E as getCreateTenantUrl, D as getCreateTenantUserUrl, O as getCurrentUser, k as getDeleteChatThreadUrl, A as getGetChatConfigUrl, j as getGetChatThreadUrl, M as getGetChatUsageUrl, N as getGetCurrentUserUrl, P as getGetOrganizationUrl, F as getGetTenantUrl, I as getGetTenantUserUrl, L as getGetTenantUserUsageUrl, R as getGetThreadAttachmentUrl, z as getListChatMessagesUrl, B as getListChatParticipantsUrl, V as getListChatThreadsUrl, H as getListTenantsUrl, U as getListThreadMessagesUrl, W as getListThreadsUrl, G as getListUsersForTenantUrl, K as getOrganization, q as getPersonalMcpAuthorizeConnectionUrl, J as getPersonalMcpBindBrowserUrl, Y as getPersonalMcpCompleteAuthorizationUrl, X as getPersonalMcpCreateConnectionUrl, Z as getPersonalMcpDisconnectConnectionUrl, Q as getPersonalMcpGetCatalogUrl, $ as getPersonalMcpSetHeadersUrl, et as getPersonalMcpTestConnectionUrl, tt as getRemoveChatParticipantUrl, nt as getResolveChatToolResultUrl, rt as getRunChatUrl, it as getSearchChatTenantUsersUrl, at as getSetChatParticipantUrl, ot as getTenant, st as getTenantUser, ct as getTenantUserUsage, lt as getThreadAttachment, ut as getUpdateChatThreadUrl, dt as getUpdateTenantUrl, ft as getUpdateTenantUserUrl, pt as getUploadChatFileUrl, zt as isAstralBeamApiError, mt as listChatMessages, ht as listChatParticipants, gt as listChatThreads, _t as listTenants, vt as listThreadMessages, yt as listThreads, bt as listUsersForTenant, xt as personalMcpAuthorizeConnection, St as personalMcpBindBrowser, Ct as personalMcpCompleteAuthorization, wt as personalMcpCreateConnection, Tt as personalMcpDisconnectConnection, Et as personalMcpGetCatalog, Dt as personalMcpSetHeaders, Ot as personalMcpTestConnection, kt as removeChatParticipant, At as resolveChatToolResult, jt as runChat, Mt as searchChatTenantUsers, Nt as setChatParticipant, Pt as updateChatThread, Ft as updateTenant, It as updateTenantUser, Lt as uploadChatFile } from "./api-SpkUzEv3.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Jn as e,Or as t,Yn as n,qn as r,tt as i,ur as a,wr as o}from"./styles.generated-
|
|
1
|
+
import{Jn as e,Or as t,Yn as n,qn as r,tt as i,ur as a,wr as o}from"./styles.generated-CwyGUg6r.js";t();var s=r();function c({className:t,size:n=`default`,...r}){return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:e(`group/native-select relative w-fit has-[select:disabled]:opacity-50`,t),"data-slot":`native-select-wrapper`,"data-size":n,children:[/* @__PURE__ */ (0,s.jsx)(`select`,{"data-slot":`native-select`,"data-size":n,className:`h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pe-8 ps-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,...r}),/* @__PURE__ */ (0,s.jsx)(o,{className:`pointer-events-none absolute top-1/2 end-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none`,"aria-hidden":`true`,"data-slot":`native-select-icon`})]})}function l({className:t,...n}){return/* @__PURE__ */ (0,s.jsx)(`option`,{"data-slot":`native-select-option`,className:e(`bg-[Canvas] text-[CanvasText]`,t),...n})}const u=n(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function d({className:t,variant:n=`default`,render:r,...o}){return i({defaultTagName:`span`,props:a({className:e(u({variant:n}),t)},o),render:r,state:{slot:`badge`,variant:n}})}export{c as n,l as r,d as t};
|
package/dist/client.d.ts
CHANGED
|
@@ -306,6 +306,8 @@ interface AstralBeamListingCoreOptions {
|
|
|
306
306
|
//#region src/client/listings.d.ts
|
|
307
307
|
interface AstralBeamListingOptions extends AstralBeamListingCoreOptions {
|
|
308
308
|
fetchAstralBeamToken: NonNullable<AstralBeamListingCoreOptions["fetchAstralBeamToken"]>;
|
|
309
|
+
/** Host-session boundary for remount reuse. Replacing it resets authentication and view state. */
|
|
310
|
+
cacheKey?: object | undefined;
|
|
309
311
|
pageSize?: 20 | 50 | 100 | undefined;
|
|
310
312
|
title?: string | undefined;
|
|
311
313
|
showHeader?: boolean | undefined;
|
|
@@ -330,9 +332,10 @@ interface MountAstralBeamThreadListOptions extends AstralBeamListingOptions {
|
|
|
330
332
|
type AstralBeamThreadListHandle = AstralBeamListingHandle<MountAstralBeamThreadListOptions>;
|
|
331
333
|
interface AstralBeamListingHandle<T extends AstralBeamListingOptions = AstralBeamListingOptions> {
|
|
332
334
|
update(options: Partial<T>): void;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
335
|
+
/** Waits for this mount's refreshed view, including lazy loading. May reuse valid authentication. */
|
|
336
|
+
refresh(): Promise<void>;
|
|
337
|
+
/** Clears state, reacquires authentication, and waits for the initial view. Requires a ready host session. */
|
|
338
|
+
reset(): Promise<void>;
|
|
336
339
|
unmount(): void;
|
|
337
340
|
}
|
|
338
341
|
type AstralBeamTenantListHandle = AstralBeamListingHandle<MountAstralBeamTenantListOptions>;
|
|
@@ -355,6 +358,7 @@ interface McpServerInput {
|
|
|
355
358
|
applicationOrigin?: string;
|
|
356
359
|
requestedScopes: readonly string[];
|
|
357
360
|
client?: {
|
|
361
|
+
issuer: string;
|
|
358
362
|
clientId: string;
|
|
359
363
|
clientSecret?: string;
|
|
360
364
|
};
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./constants-C-Yp0Vhg.js";import{t}from"./debug-DLDY8CZb.js";function
|
|
1
|
+
import{s as e}from"./constants-C-Yp0Vhg.js";import{t}from"./debug-DLDY8CZb.js";import{t as n}from"./abort-_ZeHSwUG.js";function r(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 i(e){return e}function a(e){return e}function o(e,t){return l(e,t,`tenants`)}function s(e,t){return l(e,t,`users`)}function c(e,t){return l(e,t,`threads`)}function l(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:/* @__PURE__ */ new Set,disposed:!1},c=()=>u(s);return c(),o.addEventListener(`change`,c),d(s).catch(()=>{}),{update:e=>m(s,e),refresh:()=>p(s,!1),reset:()=>p(s,!0),unmount:()=>h(s,c)}}function u({options:e,media:t,container:n,variables:i}){r(n,i,e,t.matches)}function d(e){return e.loading??=f(e)}async function f(e){e.retryLoad?.remove();try{if(e.runtime=await import(`./listings-CyliP2E5.js`),e.disposed)return;e.renderer=e.runtime.renderListing(e.shadow,e.container,e.options,e.kind,()=>p(e,!1))}catch(t){throw e.loading=void 0,e.disposed||(e.retryLoad=document.createElement(`button`),e.retryLoad.textContent=`Could not load directory. Retry`,e.retryLoad.onclick=()=>void d(e).catch(()=>{}),e.container.append(e.retryLoad)),t}}async function p(e,t){if(e.disposed)throw new DOMException(`Directory unmounted`,`AbortError`);e.action?.abort();let r=new AbortController;e.action=r;try{e.renderer||await n(d(e),r.signal),r.signal.throwIfAborted(),await e.runtime.refreshListing(e.renderer,r.signal,t)}finally{e.action===r&&(e.action=void 0)}}function m(e,t){if(e.disposed)return;let n={...e.options,...t};(n.apiUrl!==e.options.apiUrl||n.cacheKey!==e.options.cacheKey||n.scope!==e.options.scope||n.tenantId!==e.options.tenantId||n.tenantExternalId!==e.options.tenantExternalId)&&e.action?.abort(),e.options=n,u(e),e.renderer&&e.runtime.updateListing(e.renderer,e.options)}function h(e,t){e.disposed||(e.disposed=!0,e.action?.abort(),e.media.removeEventListener(`change`,t),e.renderer&&e.runtime.disposeListing(e.renderer),e.container.remove())}function g(t,n){let i=t.shadowRoot??t.attachShadow({mode:`open`}),a=document.createElement(`div`);a.className=e,i.append(a);let o=matchMedia(`(prefers-color-scheme: dark)`),s=/* @__PURE__ */ new Set,c=n,l=!1,u,d=()=>r(a,s,c,o.matches);d(),o.addEventListener(`change`,d);let f=async()=>{a.replaceChildren();try{let{renderMcpServers:e}=await import(`./mcp-servers-DvCu1KuJ.js`);l||(u=e(a,c))}catch{if(l)return;let e=document.createElement(`button`);e.textContent=`Could not load MCP servers. Retry`,e.onclick=()=>void f(),a.replaceChildren(e)}};return f(),{update(e){l||(c={...c,...e},d(),u?.update(c))},unmount(){l=!0,o.removeEventListener(`change`,d),u?.unmount(),a.remove()}}}function _(n,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,emptyHeadline:a.emptyHeadline??`Ask the assistant`,emptyDescription:a.emptyDescription??`Ask a question or describe what you want to do in this app.`,apiUrl:a.apiUrl??`https://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=n.shadowRoot??n.attachShadow({mode:`open`}),c=document.createElement(`div`);c.className=e,c.style.height=`100%`,s.append(c);let l=document.createElement(`div`);l.style.cssText=`display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px;font:14px system-ui`;let u=document.createElement(`span`);u.setAttribute(`role`,`status`),u.textContent=`Loading chat…`;let d=document.createElement(`button`);d.type=`button`,d.textContent=`Close chat`,d.style.cssText=`min-width:44px;min-height:44px;padding:8px;font:inherit;cursor:pointer`,d.hidden=!a.onClose,d.onclick=e=>{e.detail<2&&a.onClose?.()},l.append(u,d),c.append(l);let f=matchMedia(`(prefers-color-scheme: dark)`),p=/* @__PURE__ */ new Set,m=()=>{let{colorScheme:e,dark:t}=r(c,p,a,f.matches);o?.(`theme`,`color scheme "${e}" resolved to ${t?`dark`:`light`}`,{themeVariables:[...p]})};m(),f.addEventListener(`change`,m);let h=!1,g;return import(`./widget-BOdanf0E.js`).then(({renderChat:e})=>{o?.(`mount`,`chat chunk loaded`),h||(g=e(s,c,a))}).catch(()=>{h||(u.textContent=`Could not load chat. Reload this page to try again.`)}),{update:e=>{a={...a,...e},o=t(a.debug),o?.(`mount`,`options updated`,{changed:Object.keys(e)}),m(),d.hidden=!a.onClose,g?.update(a)},reset:()=>g?.reset(),stop:()=>g?.stop(),unmount:()=>{o?.(`mount`,`unmounting chat widget`),h=!0,f.removeEventListener(`change`,m),g?.dispose(),g=void 0,c.remove()}}}export{i as defineTool,a as defineWidget,_ as mountAstralBeamChat,g as mountAstralBeamMcpServers,o as mountAstralBeamTenantList,s as mountAstralBeamTenantUserList,c as mountAstralBeamThreadList};
|