@arbidocs/react 0.5.158 → 0.5.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/calls/livekit/index.cjs +50 -50
- package/dist/{chunk-IX4HOS5Z.cjs → chunk-5ECKSF6H.cjs} +13 -4
- package/dist/chunk-5ECKSF6H.cjs.map +1 -0
- package/dist/{chunk-6RRKO4ZK.cjs → chunk-6HJZCIND.cjs} +10 -10
- package/dist/{chunk-6RRKO4ZK.cjs.map → chunk-6HJZCIND.cjs.map} +1 -1
- package/dist/{chunk-QWKTQYGM.cjs → chunk-GVU3KYP3.cjs} +27 -15
- package/dist/chunk-GVU3KYP3.cjs.map +1 -0
- package/dist/conversation-list.js +18 -6
- package/dist/conversation-list.js.map +2 -2
- package/dist/index.cjs +526 -519
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-KbsNPTEN.d.ts → index.d-COC3NkxH.d.ts} +6 -0
- package/dist/index.d.ts +2 -2
- package/dist/notifications/notify-store.js +11 -2
- package/dist/notifications/notify-store.js.map +2 -2
- package/dist/shell/index.cjs +50 -50
- package/dist/shell/index.d.ts +1 -1
- package/dist/workspaces/switch.js +41 -34
- package/dist/workspaces/switch.js.map +2 -2
- package/package.json +3 -3
- package/dist/chunk-IX4HOS5Z.cjs.map +0 -1
- package/dist/chunk-QWKTQYGM.cjs.map +0 -1
|
@@ -522,6 +522,12 @@ declare const notify: {
|
|
|
522
522
|
error: (title: ReactNode, opts?: NotifyOptions) => string;
|
|
523
523
|
info: (title: ReactNode, opts?: NotifyOptions) => string;
|
|
524
524
|
warning: (title: ReactNode, opts?: NotifyOptions) => string;
|
|
525
|
+
/**
|
|
526
|
+
* Take a notification's toast down now (its entry stays in the history): a progress toast
|
|
527
|
+
* ("Opening…") once what it reports is over. Sonner holds a toast's timer while the pointer
|
|
528
|
+
* rests on it, so a progress toast that only times out can stay over the page indefinitely.
|
|
529
|
+
*/
|
|
530
|
+
dismiss: (id: string) => void;
|
|
525
531
|
};
|
|
526
532
|
/** Replace the history — inject a seed/initial set. */
|
|
527
533
|
declare function seedNotifications(items: AppNotification[]): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as ArbiHostConnection, H as HostConfigRecord, c as ArbiHostProps, T as ThreadBinding, g as MentionCandidate, i as MessageMentionRef, q as SearchStatus, o as SearchSession, n as NotifyVariant, A as AppNotification } from './index.d-
|
|
2
|
-
export { d as AssistantCopy, C as ChatArtifact, D as DEFAULT_ASSISTANT_NAME, e as DEFAULT_NOTIFY_TONE, L as LEGACY_THREAD_DOCUMENTS_KEY, M as MAX_SESSION_NOTIFICATIONS, f as MENTION_HREF_PREFIX, h as MentionKind, N as NotificationBell, j as NotificationBellProps, k as NotificationBellTriggerState, l as NotifyConfig, m as NotifyOptions, O as OpenDocumentRegistration, S as SavedDocumentInput, p as SearchSessionState, r as ThreadBindingRow, s as Toaster, t as TurnDocumentInput, U as UNBOUND, W as WordDocumentKind, u as assistantCopy, v as bindingOfRow, w as clearChatArtifacts, x as clearSearchSession, y as configureNotify, z as createSearchSession, B as extractMentions, E as filterMentionCandidates, F as findMentionQuery, G as forgetLegacyThreadDocuments, I as getChatArtifact, J as getChatArtifacts, K as hasMessageBody, P as insertMention, Q as isSlideDeck, R as latestThreadOfDocument, V as linkMentions, X as mentionFromHref, Y as notify, Z as openDocumentId, _ as opensInWord, $ as persistNotifyHistory, a0 as persistSearchSession, a1 as readLegacyThreadDocuments, a2 as recordChatArtifact, a3 as requestSearch, a4 as savedDocumentIdFor, a5 as seedNotifications, a6 as selectUnread, a7 as sharedSearchSession, a8 as takeDocumentForTurn, a9 as takePendingSearch, aa as toMessageMentions, ab as useAssistantCopy, ac as useAssistantName, ad as useChatArtifact, ae as useHostConfigRecord, af as useMessageChatArtifact, ag as useNotify, ah as useOpenDocumentId, ai as useRegisterOpenDocument, aj as useTurnDocumentId } from './index.d-
|
|
1
|
+
import { b as ArbiHostConnection, H as HostConfigRecord, c as ArbiHostProps, T as ThreadBinding, g as MentionCandidate, i as MessageMentionRef, q as SearchStatus, o as SearchSession, n as NotifyVariant, A as AppNotification } from './index.d-COC3NkxH.js';
|
|
2
|
+
export { d as AssistantCopy, C as ChatArtifact, D as DEFAULT_ASSISTANT_NAME, e as DEFAULT_NOTIFY_TONE, L as LEGACY_THREAD_DOCUMENTS_KEY, M as MAX_SESSION_NOTIFICATIONS, f as MENTION_HREF_PREFIX, h as MentionKind, N as NotificationBell, j as NotificationBellProps, k as NotificationBellTriggerState, l as NotifyConfig, m as NotifyOptions, O as OpenDocumentRegistration, S as SavedDocumentInput, p as SearchSessionState, r as ThreadBindingRow, s as Toaster, t as TurnDocumentInput, U as UNBOUND, W as WordDocumentKind, u as assistantCopy, v as bindingOfRow, w as clearChatArtifacts, x as clearSearchSession, y as configureNotify, z as createSearchSession, B as extractMentions, E as filterMentionCandidates, F as findMentionQuery, G as forgetLegacyThreadDocuments, I as getChatArtifact, J as getChatArtifacts, K as hasMessageBody, P as insertMention, Q as isSlideDeck, R as latestThreadOfDocument, V as linkMentions, X as mentionFromHref, Y as notify, Z as openDocumentId, _ as opensInWord, $ as persistNotifyHistory, a0 as persistSearchSession, a1 as readLegacyThreadDocuments, a2 as recordChatArtifact, a3 as requestSearch, a4 as savedDocumentIdFor, a5 as seedNotifications, a6 as selectUnread, a7 as sharedSearchSession, a8 as takeDocumentForTurn, a9 as takePendingSearch, aa as toMessageMentions, ab as useAssistantCopy, ac as useAssistantName, ad as useChatArtifact, ae as useHostConfigRecord, af as useMessageChatArtifact, ag as useNotify, ah as useOpenDocumentId, ai as useRegisterOpenDocument, aj as useTurnDocumentId } from './index.d-COC3NkxH.js';
|
|
3
3
|
import * as _arbidocs_sdk_browser from '@arbidocs/sdk/browser';
|
|
4
4
|
import { LoginProfile, Arbi, EventCreateBody, ScopedTarget, EventPatchBody, RespondParams, ArtifactEvent, MailDraftSSEEvent, QuotaExceeded, ProbeAnswerEvent, AskRequest, AgentStepEvent, ChatMessage, OutputItemDone, UserInputRequestEvent, MessageQueuedEvent, UserMessageEvent, SSEStreamStartData, MessageMetadataPayload, DeferredInterjectionEvent, AgentControlStateEvent, TokenBudgetContext, ConversationResponse, Thread, SSEStreamResult, AskHandlers, TagListQuery, workspaces, ListFactsOptions, UpdateFactRequest, FactSearchResponse, FactSearchRequest, StepActionRequest, UpdateConversationRequest, UpdateWorkflowRequest, TableViewFilter, DatabaseRow, TableViewSpec, TableViewRecord, WorkspaceAggregateQuery, WorkspaceAggregateResult, ListBlockConfig, CarouselBlockConfig, AgendaBlockConfig, StartBlockConfig, Page, TagResponse, tags, TagKind, TagKindSchema, TagChange, TagFieldDefinition, ProjectUpdateRequest, ProjectResponse, ProjectCreateOptions, ProjectAddonKind, ProjectPlanChangeRequest, ProjectCheckoutRequest, ProjectQuoteRequest, ProjectAddonSettingsRequest, ProjectNextPeriodAddonsRequest, contacts, PersonalConnectionInput, settings, account, ListEventsParams, CalendarWindow, OverlayLayerName, RoomCreateBody, CalendarEvent, FindTimeParams, RoomQuery, ShareRole, CalendarUpdate, OAuthAccountKind, CalendarAccount, CalDavConnectBody, calls, SearchChunk, chats, UploadDocumentsOptions, UploadResult, SupportRating } from '@arbidocs/sdk/browser';
|
|
5
5
|
export { ACCOUNT_VENDOR, AccountSyncResult, ActivityKind, ActivityResponse, AgendaBlockConfig, AgentStepEvent, Arbi, ArbiError, ArbiOptions, ArtifactEvent, AskHandlers, AskRequest, AssistantArrival, AssistantBrief, AssistantBriefInput, AttendeeRead, AuthMode, BookingConfirmation, BookingPage, BookingPageWriteBody, BookingRequestBody, BridgeTokensOptions, CalDavConnectBody, CalDavProfile, CalendarAccount, CalendarAccountKind, CalendarCreateBody, CalendarEvent, CalendarRead, CalendarSettings, CalendarSettingsBody, CalendarUpdate, CalendarWindow, CarouselBlockConfig, ConnectionModel, ConnectorCatalogEntry, ConnectorFolder, ConnectorSyncProgress, ConnectorSyncStatus, ConnectorVendorKey, ConnectorVisibilitySettings, ConversationResponse, CreateFactRequest, CreateWorkRequest, CreateWorkflowRequest, DEFAULT_AI_USD_PER_GBP, DOCUMENTS_VIEW_TARGET, DRIVE_SYNC_VENDORS, Database, DatabaseColumn, DatabaseColumnWrite, DatabaseImportResult, DatabaseRow, DatabaseRowPage, DateTimeSpec, DirectModelUsage, DriveSyncProgress, DriveSyncSummary, EditScope, EventCreateBody, EventPatchBody, FactResponse, FactSearchRequest, FactSearchResponse, FindTimeParams, FreeBusyEntry, GOOGLE_VENDORS, HolidayCountry, IMANAGE_VENDORS, ImportResult, InvitationRead, ListBlockConfig, ListEventsParams, LoginProfile, MAILBOX_SYNC_VENDORS, MAX_RETRIEVE_DOC_IDS, MICROSOFT_VENDORS, MessageMetadataPayload, ModelConnection, OAuthAccountKind, OutputTokensDetails, OverlayItem, OverlayLayerName, PendingAuthResponse, PersonKey, PersonalConnectionInput, PlanWorkRequest, ProductResponse, ProjectAddonKind, ProjectCheckoutRequest, ProjectInvoicesResponse, ProjectPlanChangeRequest, ProjectQuoteRequest, ProjectResponse, ProjectUsageResponse, PublicBookingError, PublicBookingPage, RespondParams, RespondPartstat, ResponseCompletedEvent, ResponseContentPartAddedEvent, ResponseCreatedEvent, ResponseFailedEvent, ResponseOutputItemAddedEvent, ResponseOutputItemDoneEvent, ResponseOutputTextDeltaEvent, ResponseOutputTextDoneEvent, ResponseUsage, RoomCreateBody, RoomQuery, RoomRead, SHAREPOINT_VENDORS, SSEStreamCallbacks, SSEStreamResult, SSEStreamStartData, ScopedTarget, SearchChunk, ShareRead, ShareRole, SkillSummary, SlackConnectionStatus, StartBlockConfig, SubscribeParams, SyncTriggerResult, TableViewFilter, TableViewRecord, TableViewRows, TableViewSpec, TaskPlan, TaxQuoteResponse, TimeSuggestion, UpdateConversationRequest, UpdateWorkflowRequest, UserConnectorEntry, UserDailyUsageResponse, UserInputRequestEvent, UserMessageEvent, WeeklyHoursSpec, WorkStatus, WorkflowAuthMode, WorkflowResponse, WorkflowRunResponse, WorkspaceAggregateQuery, WorkspaceAggregateResult, bookPublicSlot, cancelPublicBooking, connectErrorMessage, filterText, formatGbp, formatGbpPerMillionTokens, getPublicBookingPage, isConnectorVendorVisible, isDriveSyncVendor, isMailboxSyncVendor, isSharePointVendor, usdToGbp } from '@arbidocs/sdk/browser';
|
|
@@ -47,8 +47,10 @@ function make(variant) {
|
|
|
47
47
|
return (title, opts = {}) => {
|
|
48
48
|
const { workspaceId } = opts;
|
|
49
49
|
const ambient = opts.ambient ?? config.ambient ?? false;
|
|
50
|
+
const id = uid();
|
|
50
51
|
if (opts.toast !== false && !useNotify.getState().muted) {
|
|
51
52
|
toast[variant](title, {
|
|
53
|
+
id,
|
|
52
54
|
description: opts.description,
|
|
53
55
|
duration: opts.duration,
|
|
54
56
|
action: opts.action,
|
|
@@ -56,7 +58,6 @@ function make(variant) {
|
|
|
56
58
|
className: opts.className
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
|
-
const id = uid();
|
|
60
61
|
if (opts.record !== false) {
|
|
61
62
|
const html = opts.html ?? (typeof title === "string" || title == null ? void 0 : richMarkup(title));
|
|
62
63
|
useNotify.getState().record({
|
|
@@ -86,7 +87,15 @@ const notify = {
|
|
|
86
87
|
success: make("success"),
|
|
87
88
|
error: make("error"),
|
|
88
89
|
info: make("info"),
|
|
89
|
-
warning: make("warning")
|
|
90
|
+
warning: make("warning"),
|
|
91
|
+
/**
|
|
92
|
+
* Take a notification's toast down now (its entry stays in the history): a progress toast
|
|
93
|
+
* ("Opening…") once what it reports is over. Sonner holds a toast's timer while the pointer
|
|
94
|
+
* rests on it, so a progress toast that only times out can stay over the page indefinitely.
|
|
95
|
+
*/
|
|
96
|
+
dismiss: (id) => {
|
|
97
|
+
toast.dismiss(id);
|
|
98
|
+
}
|
|
90
99
|
};
|
|
91
100
|
function seedNotifications(items) {
|
|
92
101
|
useNotify.getState().seed(items);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/notifications/notify-store.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The one notification history: every `notify.*` call pops a transient toast (rendered by\n * <Toaster/>, on sonner) and, unless `{ record: false }`, records an entry. The same entries feed\n * the topbar bell (<NotificationBell/>), its unread badge and a host's notification page; backend\n * bridges reconcile their own slices into it with {@link syncSource}.\n *\n * notify.success('Saved') // toast + entry\n * notify.error('Upload failed', { record: false }) // toast only\n * notify.info('Opening workspace\u2026', { ambient: true }) // a log line: never badges\n *\n * sonner owns the transient toast lifecycle (stacking, timing, dismissal); this store owns the\n * history, the mute switch and what a host configures once (workspace glyph and link, see\n * {@link configureNotify}; persistence, see {@link persistNotifyHistory}). Brand-neutral: no seed\n * data, no app imports. For full sonner power the raw `toast` is re-exported.\n */\nimport { type ReactNode } from 'react'\nimport { renderToStaticMarkup } from 'react-dom/server'\n// This module IS the sanctioned toast engine home \u2014 the app-level rule that\n// steers callers to notify() doesn't apply here.\n// eslint-disable-next-line no-restricted-imports\nimport { toast } from 'sonner'\nimport { create } from 'zustand'\n\nexport { toast }\n\nexport type NotifyVariant = 'success' | 'error' | 'info' | 'warning'\n\nexport interface AppNotification {\n id: string\n title: string\n description?: string\n variant: NotifyVariant\n /** Epoch ms the entry was recorded. */\n ts: number\n read: boolean\n /** Optional in-app link the entry deep-links to (passed to the bell's onNavigate). */\n href?: string\n /** Optional click action \u2014 wins over `href` when both are present. Session\n * history only: never persisted, so a closure is safe here. */\n onSelect?: () => void\n /** The label of the action `onSelect` runs (\"Reply\", \"View\"). */\n actionLabel?: string\n /** Workspace the entry belongs to. */\n workspaceId?: string\n /** Markup of a rich (non-string) toast message, for a log that shows it as it was toasted. */\n html?: string\n /** Routine session activity (\"Opening workspace\u2026\", \"Saved\") \u2014 kept for the\n * log but not something that demands attention: excluded from the unread\n * badge and from the bell's list. */\n ambient?: boolean\n /** Where the entry comes from. Session entries (`notify.*`) have none; a\n * backend bridge stamps its own (e.g. 'server') so {@link syncSource} can\n * replace exactly its slice on every refetch without touching the rest. */\n source?: string\n}\n\nexport interface NotifyOptions {\n /** Shown under the title in the toast; a string description is also recorded. */\n description?: ReactNode\n /** Record an entry in the history (default true). False pops the toast only \u2014 for an event\n * whose entry arrives another way (a server-persisted notification synced by a bridge). */\n record?: boolean\n /** Pop the transient toast (default true unless muted). False records the entry only. */\n toast?: boolean\n /** Recorded title for a rich (non-string) toast title. Default: the string title, else the\n * rich title's text. */\n recordTitle?: string\n /** Recorded markup for a rich toast title (default: the title rendered to static markup). */\n html?: string\n href?: string\n /** Workspace the notification belongs to: its glyph shows in the toast and its link is the\n * entry's default `href` (both as configured with {@link configureNotify}). */\n workspaceId?: string\n duration?: number\n /** A toast action button (sonner). Clicking the entry runs it too. */\n action?: { label: ReactNode; onClick: () => void }\n /** Override the toast glyph (sonner). */\n icon?: ReactNode\n /** Extra class on the toast (sonner). */\n className?: string\n /** Record as routine session activity (see {@link AppNotification.ambient}): born read. */\n ambient?: boolean\n}\n\n/** Session entries kept (oldest dropped first) \u2014 a safety net against pathological growth; a\n * large upload can log many entries, so it is generous. Source slices are bounded by their source. */\nexport const MAX_SESSION_NOTIFICATIONS = 5000\n\ninterface NotifyState {\n notifications: AppNotification[]\n /** Toasts are muted: entries are still recorded \u2014 the history is what the user comes back to. */\n muted: boolean\n setMuted: (muted: boolean) => void\n markRead: (id: string) => void\n markAllRead: () => void\n removeNotification: (id: string) => void\n removeNotifications: (ids: readonly string[]) => void\n clearNotifications: () => void\n /** Replace the history (e.g. seed a demo/initial set). */\n seed: (items: AppNotification[]) => void\n /** Record an entry (used by `notify.*`; sonner renders the toast). */\n record: (note: AppNotification) => void\n /** Reconcile one source's slice with fresh truth (e.g. a backend list on\n * every refetch): entries stamped with `source` are replaced wholesale \u2014\n * including their read state, which the source owns \u2014 while entries from\n * other sources (session activity) stay untouched. Newest first. */\n syncSource: (source: string, items: AppNotification[]) => void\n}\n\nlet seq = 0\nconst uid = () => `n${Date.now().toString(36)}${(seq++).toString(36)}`\n\n/** Keep at most {@link MAX_SESSION_NOTIFICATIONS} session entries (newest first). */\nfunction capSession(items: AppNotification[]): AppNotification[] {\n let session = 0\n return items.filter((n) => n.source || ++session <= MAX_SESSION_NOTIFICATIONS)\n}\n\nexport const useNotify = create<NotifyState>((set) => ({\n notifications: [],\n muted: false,\n setMuted: (muted) => set({ muted }),\n markRead: (id) =>\n set((s) => ({\n notifications: s.notifications.map((n) => (n.id === id ? { ...n, read: true } : n)),\n })),\n markAllRead: () =>\n set((s) => ({ notifications: s.notifications.map((n) => ({ ...n, read: true })) })),\n removeNotification: (id) =>\n set((s) => ({ notifications: s.notifications.filter((n) => n.id !== id) })),\n removeNotifications: (ids) => {\n const drop = new Set(ids)\n set((s) => ({ notifications: s.notifications.filter((n) => !drop.has(n.id)) }))\n },\n clearNotifications: () => set({ notifications: [] }),\n seed: (items) => set({ notifications: items }),\n record: (note) => set((s) => ({ notifications: capSession([note, ...s.notifications]) })),\n syncSource: (source, items) =>\n set((s) => ({\n notifications: [\n ...items.map((n) => ({ ...n, source })),\n ...s.notifications.filter((n) => n.source !== source),\n ].sort((a, b) => b.ts - a.ts),\n })),\n}))\n\n/** What a host configures once for every `notify.*` call. */\nexport interface NotifyConfig {\n /** The toast glyph of a notification that names a workspace. */\n workspaceIcon?: (workspaceId: string) => ReactNode\n /** The default link of an entry that names a workspace. */\n workspaceHref?: (workspaceId: string) => string | undefined\n /** The default of {@link NotifyOptions.ambient} for calls that do not say: a host whose own\n * toasts are mostly confirmations (\"Saved\") records them as log lines, and passes\n * `ambient: false` for what should claim attention. Default false. */\n ambient?: boolean\n}\n\nlet config: NotifyConfig = {}\n\n/** Set the host's workspace glyph and link (merged into what is configured). */\nexport function configureNotify(next: NotifyConfig): void {\n config = { ...config, ...next }\n}\n\nfunction richMarkup(title: ReactNode): string | undefined {\n try {\n return renderToStaticMarkup(title)\n } catch {\n return undefined\n }\n}\n\nconst textOf = (html: string | undefined) =>\n (html ?? '')\n .replace(/<[^>]+>/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim()\n\n/** Ergonomic helper \u2014 `notify.success('Saved')` \u2014 toast (sonner) + optional entry. */\nfunction make(variant: NotifyVariant) {\n return (title: ReactNode, opts: NotifyOptions = {}): string => {\n const { workspaceId } = opts\n const ambient = opts.ambient ?? config.ambient ?? false\n if (opts.toast !== false && !useNotify.getState().muted) {\n toast[variant](title, {\n description: opts.description,\n duration: opts.duration,\n action: opts.action,\n icon: opts.icon ?? (workspaceId ? config.workspaceIcon?.(workspaceId) : undefined),\n className: opts.className,\n })\n }\n const id = uid()\n if (opts.record !== false) {\n const html =\n opts.html ?? (typeof title === 'string' || title == null ? undefined : richMarkup(title))\n useNotify.getState().record({\n id,\n // A rich toast still needs a READABLE title \u2014 \"Passage copied: gamma-services p.1\",\n // not \"Notification\" \u2014 so it comes from the rendered markup, tags stripped.\n title:\n opts.recordTitle ?? (typeof title === 'string' ? title : textOf(html) || 'Notification'),\n description: typeof opts.description === 'string' ? opts.description : undefined,\n variant,\n ts: Date.now(),\n // Ambient activity is a log line, not a claim on attention: it never wears an unread dot.\n read: ambient,\n // Clicking the entry goes where the notification points: its action (when it has one),\n // an explicit link, or the workspace it happened in.\n href: opts.href ?? (workspaceId ? config.workspaceHref?.(workspaceId) : undefined),\n onSelect: opts.action?.onClick,\n actionLabel: opts.action ? String(opts.action.label) : undefined,\n workspaceId,\n html,\n ambient,\n })\n }\n return id\n }\n}\nexport const notify = {\n success: make('success'),\n error: make('error'),\n info: make('info'),\n warning: make('warning'),\n}\n\n/** Replace the history \u2014 inject a seed/initial set. */\nexport function seedNotifications(items: AppNotification[]): void {\n useNotify.getState().seed(items)\n}\n\ninterface SavedHistory {\n muted?: boolean\n notifications?: AppNotification[]\n}\n\n/**\n * Keep the session history and the mute switch across reloads in `storage` under `key`: restores\n * them now and saves every change. Source slices are not saved (their source re-syncs them), and\n * neither are actions \u2014 a closure does not survive a reload. Returns the unsubscribe.\n */\nexport function persistNotifyHistory(\n key: string,\n storage: Pick<Storage, 'getItem' | 'setItem'> | undefined = globalThis.localStorage\n): () => void {\n if (!storage) return () => {}\n try {\n const saved = JSON.parse(storage.getItem(key) ?? 'null') as SavedHistory | null\n if (saved) {\n const known = new Set(useNotify.getState().notifications.map((n) => n.id))\n useNotify.setState((s) => ({\n muted: saved.muted ?? s.muted,\n notifications: capSession(\n [\n ...s.notifications,\n ...(saved.notifications ?? []).filter((n) => !n.source && !known.has(n.id)),\n ].sort((a, b) => b.ts - a.ts)\n ),\n }))\n }\n } catch {\n // Unreadable or blocked storage: start empty.\n }\n let saved: AppNotification[] = []\n let savedMuted: boolean | undefined\n return useNotify.subscribe((s) => {\n const session = s.notifications.filter((n) => !n.source)\n // A backend re-sync or a read change elsewhere leaves the session slice as it was.\n if (\n s.muted === savedMuted &&\n session.length === saved.length &&\n session.every((n, i) => n === saved[i])\n )\n return\n saved = session\n savedMuted = s.muted\n // JSON drops the undefined fields: an action's closure cannot be saved, nor its label alone.\n const notifications = session.map((n) => ({\n ...n,\n onSelect: undefined,\n actionLabel: undefined,\n }))\n try {\n storage.setItem(key, JSON.stringify({ muted: s.muted, notifications }))\n } catch {\n // Full or blocked storage: the in-memory history still works.\n }\n })\n}\n\n/** Unread count selector for the topbar bell \u2014 ambient session activity never\n * demands attention, so it never counts. */\nexport const selectUnread = (s: NotifyState): number =>\n s.notifications.filter((n) => !n.read && !n.ambient).length\n\n/** Default glyph colour per variant (raw palette, override via `toneClassNames`). */\nexport const DEFAULT_NOTIFY_TONE: Record<NotifyVariant, string> = {\n success: 'text-green-600',\n error: 'text-destructive',\n warning: 'text-amber-500',\n info: 'text-blue-500',\n}\n"],
|
|
5
|
-
"mappings": "AAgBA,SAAS,4BAA4B;AAIrC,SAAS,aAAa;AACtB,SAAS,cAAc;AAiEhB,MAAM,4BAA4B;AAuBzC,IAAI,MAAM;AACV,MAAM,MAAM,MAAM,IAAI,KAAK,IAAI,EAAE,SAAS,EAAE,CAAC,IAAI,OAAO,SAAS,EAAE,CAAC;AAGp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AG,GAAG,OAAO,EAAE;AAAA,MACtC,GAAG,EAAE,cAAc,OAAO,CAAC,MAAM,EAAE,WAAW,MAAM;AAAA,IACtD,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE;AAAA,EAC9B,EAAE;AACN,EAAE;AAcF,IAAI,SAAuB,CAAC;AAGrB,SAAS,gBAAgB,MAA0B;AACxD,WAAS,EAAE,GAAG,QAAQ,GAAG,KAAK;AAChC;AAEA,SAAS,WAAW,OAAsC;AACxD,MAAI;AACF,WAAO,qBAAqB,KAAK;AAAA,EACnC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,MAAM,SAAS,CAAC,UACb,QAAQ,IACN,QAAQ,YAAY,GAAG,EACvB,QAAQ,QAAQ,GAAG,EACnB,KAAK;
|
|
4
|
+
"sourcesContent": ["/**\n * The one notification history: every `notify.*` call pops a transient toast (rendered by\n * <Toaster/>, on sonner) and, unless `{ record: false }`, records an entry. The same entries feed\n * the topbar bell (<NotificationBell/>), its unread badge and a host's notification page; backend\n * bridges reconcile their own slices into it with {@link syncSource}.\n *\n * notify.success('Saved') // toast + entry\n * notify.error('Upload failed', { record: false }) // toast only\n * notify.info('Opening workspace\u2026', { ambient: true }) // a log line: never badges\n *\n * sonner owns the transient toast lifecycle (stacking, timing, dismissal); this store owns the\n * history, the mute switch and what a host configures once (workspace glyph and link, see\n * {@link configureNotify}; persistence, see {@link persistNotifyHistory}). Brand-neutral: no seed\n * data, no app imports. For full sonner power the raw `toast` is re-exported.\n */\nimport { type ReactNode } from 'react'\nimport { renderToStaticMarkup } from 'react-dom/server'\n// This module IS the sanctioned toast engine home \u2014 the app-level rule that\n// steers callers to notify() doesn't apply here.\n// eslint-disable-next-line no-restricted-imports\nimport { toast } from 'sonner'\nimport { create } from 'zustand'\n\nexport { toast }\n\nexport type NotifyVariant = 'success' | 'error' | 'info' | 'warning'\n\nexport interface AppNotification {\n id: string\n title: string\n description?: string\n variant: NotifyVariant\n /** Epoch ms the entry was recorded. */\n ts: number\n read: boolean\n /** Optional in-app link the entry deep-links to (passed to the bell's onNavigate). */\n href?: string\n /** Optional click action \u2014 wins over `href` when both are present. Session\n * history only: never persisted, so a closure is safe here. */\n onSelect?: () => void\n /** The label of the action `onSelect` runs (\"Reply\", \"View\"). */\n actionLabel?: string\n /** Workspace the entry belongs to. */\n workspaceId?: string\n /** Markup of a rich (non-string) toast message, for a log that shows it as it was toasted. */\n html?: string\n /** Routine session activity (\"Opening workspace\u2026\", \"Saved\") \u2014 kept for the\n * log but not something that demands attention: excluded from the unread\n * badge and from the bell's list. */\n ambient?: boolean\n /** Where the entry comes from. Session entries (`notify.*`) have none; a\n * backend bridge stamps its own (e.g. 'server') so {@link syncSource} can\n * replace exactly its slice on every refetch without touching the rest. */\n source?: string\n}\n\nexport interface NotifyOptions {\n /** Shown under the title in the toast; a string description is also recorded. */\n description?: ReactNode\n /** Record an entry in the history (default true). False pops the toast only \u2014 for an event\n * whose entry arrives another way (a server-persisted notification synced by a bridge). */\n record?: boolean\n /** Pop the transient toast (default true unless muted). False records the entry only. */\n toast?: boolean\n /** Recorded title for a rich (non-string) toast title. Default: the string title, else the\n * rich title's text. */\n recordTitle?: string\n /** Recorded markup for a rich toast title (default: the title rendered to static markup). */\n html?: string\n href?: string\n /** Workspace the notification belongs to: its glyph shows in the toast and its link is the\n * entry's default `href` (both as configured with {@link configureNotify}). */\n workspaceId?: string\n duration?: number\n /** A toast action button (sonner). Clicking the entry runs it too. */\n action?: { label: ReactNode; onClick: () => void }\n /** Override the toast glyph (sonner). */\n icon?: ReactNode\n /** Extra class on the toast (sonner). */\n className?: string\n /** Record as routine session activity (see {@link AppNotification.ambient}): born read. */\n ambient?: boolean\n}\n\n/** Session entries kept (oldest dropped first) \u2014 a safety net against pathological growth; a\n * large upload can log many entries, so it is generous. Source slices are bounded by their source. */\nexport const MAX_SESSION_NOTIFICATIONS = 5000\n\ninterface NotifyState {\n notifications: AppNotification[]\n /** Toasts are muted: entries are still recorded \u2014 the history is what the user comes back to. */\n muted: boolean\n setMuted: (muted: boolean) => void\n markRead: (id: string) => void\n markAllRead: () => void\n removeNotification: (id: string) => void\n removeNotifications: (ids: readonly string[]) => void\n clearNotifications: () => void\n /** Replace the history (e.g. seed a demo/initial set). */\n seed: (items: AppNotification[]) => void\n /** Record an entry (used by `notify.*`; sonner renders the toast). */\n record: (note: AppNotification) => void\n /** Reconcile one source's slice with fresh truth (e.g. a backend list on\n * every refetch): entries stamped with `source` are replaced wholesale \u2014\n * including their read state, which the source owns \u2014 while entries from\n * other sources (session activity) stay untouched. Newest first. */\n syncSource: (source: string, items: AppNotification[]) => void\n}\n\nlet seq = 0\nconst uid = () => `n${Date.now().toString(36)}${(seq++).toString(36)}`\n\n/** Keep at most {@link MAX_SESSION_NOTIFICATIONS} session entries (newest first). */\nfunction capSession(items: AppNotification[]): AppNotification[] {\n let session = 0\n return items.filter((n) => n.source || ++session <= MAX_SESSION_NOTIFICATIONS)\n}\n\nexport const useNotify = create<NotifyState>((set) => ({\n notifications: [],\n muted: false,\n setMuted: (muted) => set({ muted }),\n markRead: (id) =>\n set((s) => ({\n notifications: s.notifications.map((n) => (n.id === id ? { ...n, read: true } : n)),\n })),\n markAllRead: () =>\n set((s) => ({ notifications: s.notifications.map((n) => ({ ...n, read: true })) })),\n removeNotification: (id) =>\n set((s) => ({ notifications: s.notifications.filter((n) => n.id !== id) })),\n removeNotifications: (ids) => {\n const drop = new Set(ids)\n set((s) => ({ notifications: s.notifications.filter((n) => !drop.has(n.id)) }))\n },\n clearNotifications: () => set({ notifications: [] }),\n seed: (items) => set({ notifications: items }),\n record: (note) => set((s) => ({ notifications: capSession([note, ...s.notifications]) })),\n syncSource: (source, items) =>\n set((s) => ({\n notifications: [\n ...items.map((n) => ({ ...n, source })),\n ...s.notifications.filter((n) => n.source !== source),\n ].sort((a, b) => b.ts - a.ts),\n })),\n}))\n\n/** What a host configures once for every `notify.*` call. */\nexport interface NotifyConfig {\n /** The toast glyph of a notification that names a workspace. */\n workspaceIcon?: (workspaceId: string) => ReactNode\n /** The default link of an entry that names a workspace. */\n workspaceHref?: (workspaceId: string) => string | undefined\n /** The default of {@link NotifyOptions.ambient} for calls that do not say: a host whose own\n * toasts are mostly confirmations (\"Saved\") records them as log lines, and passes\n * `ambient: false` for what should claim attention. Default false. */\n ambient?: boolean\n}\n\nlet config: NotifyConfig = {}\n\n/** Set the host's workspace glyph and link (merged into what is configured). */\nexport function configureNotify(next: NotifyConfig): void {\n config = { ...config, ...next }\n}\n\nfunction richMarkup(title: ReactNode): string | undefined {\n try {\n return renderToStaticMarkup(title)\n } catch {\n return undefined\n }\n}\n\nconst textOf = (html: string | undefined) =>\n (html ?? '')\n .replace(/<[^>]+>/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim()\n\n/**\n * Ergonomic helper \u2014 `notify.success('Saved')` \u2014 toast (sonner) + optional entry. Returns the\n * notification's id: the entry's, and its toast's, which `notify.dismiss` takes down.\n */\nfunction make(variant: NotifyVariant) {\n return (title: ReactNode, opts: NotifyOptions = {}): string => {\n const { workspaceId } = opts\n const ambient = opts.ambient ?? config.ambient ?? false\n const id = uid()\n if (opts.toast !== false && !useNotify.getState().muted) {\n toast[variant](title, {\n id,\n description: opts.description,\n duration: opts.duration,\n action: opts.action,\n icon: opts.icon ?? (workspaceId ? config.workspaceIcon?.(workspaceId) : undefined),\n className: opts.className,\n })\n }\n if (opts.record !== false) {\n const html =\n opts.html ?? (typeof title === 'string' || title == null ? undefined : richMarkup(title))\n useNotify.getState().record({\n id,\n // A rich toast still needs a READABLE title \u2014 \"Passage copied: gamma-services p.1\",\n // not \"Notification\" \u2014 so it comes from the rendered markup, tags stripped.\n title:\n opts.recordTitle ?? (typeof title === 'string' ? title : textOf(html) || 'Notification'),\n description: typeof opts.description === 'string' ? opts.description : undefined,\n variant,\n ts: Date.now(),\n // Ambient activity is a log line, not a claim on attention: it never wears an unread dot.\n read: ambient,\n // Clicking the entry goes where the notification points: its action (when it has one),\n // an explicit link, or the workspace it happened in.\n href: opts.href ?? (workspaceId ? config.workspaceHref?.(workspaceId) : undefined),\n onSelect: opts.action?.onClick,\n actionLabel: opts.action ? String(opts.action.label) : undefined,\n workspaceId,\n html,\n ambient,\n })\n }\n return id\n }\n}\nexport const notify = {\n success: make('success'),\n error: make('error'),\n info: make('info'),\n warning: make('warning'),\n /**\n * Take a notification's toast down now (its entry stays in the history): a progress toast\n * (\"Opening\u2026\") once what it reports is over. Sonner holds a toast's timer while the pointer\n * rests on it, so a progress toast that only times out can stay over the page indefinitely.\n */\n dismiss: (id: string): void => {\n toast.dismiss(id)\n },\n}\n\n/** Replace the history \u2014 inject a seed/initial set. */\nexport function seedNotifications(items: AppNotification[]): void {\n useNotify.getState().seed(items)\n}\n\ninterface SavedHistory {\n muted?: boolean\n notifications?: AppNotification[]\n}\n\n/**\n * Keep the session history and the mute switch across reloads in `storage` under `key`: restores\n * them now and saves every change. Source slices are not saved (their source re-syncs them), and\n * neither are actions \u2014 a closure does not survive a reload. Returns the unsubscribe.\n */\nexport function persistNotifyHistory(\n key: string,\n storage: Pick<Storage, 'getItem' | 'setItem'> | undefined = globalThis.localStorage\n): () => void {\n if (!storage) return () => {}\n try {\n const saved = JSON.parse(storage.getItem(key) ?? 'null') as SavedHistory | null\n if (saved) {\n const known = new Set(useNotify.getState().notifications.map((n) => n.id))\n useNotify.setState((s) => ({\n muted: saved.muted ?? s.muted,\n notifications: capSession(\n [\n ...s.notifications,\n ...(saved.notifications ?? []).filter((n) => !n.source && !known.has(n.id)),\n ].sort((a, b) => b.ts - a.ts)\n ),\n }))\n }\n } catch {\n // Unreadable or blocked storage: start empty.\n }\n let saved: AppNotification[] = []\n let savedMuted: boolean | undefined\n return useNotify.subscribe((s) => {\n const session = s.notifications.filter((n) => !n.source)\n // A backend re-sync or a read change elsewhere leaves the session slice as it was.\n if (\n s.muted === savedMuted &&\n session.length === saved.length &&\n session.every((n, i) => n === saved[i])\n )\n return\n saved = session\n savedMuted = s.muted\n // JSON drops the undefined fields: an action's closure cannot be saved, nor its label alone.\n const notifications = session.map((n) => ({\n ...n,\n onSelect: undefined,\n actionLabel: undefined,\n }))\n try {\n storage.setItem(key, JSON.stringify({ muted: s.muted, notifications }))\n } catch {\n // Full or blocked storage: the in-memory history still works.\n }\n })\n}\n\n/** Unread count selector for the topbar bell \u2014 ambient session activity never\n * demands attention, so it never counts. */\nexport const selectUnread = (s: NotifyState): number =>\n s.notifications.filter((n) => !n.read && !n.ambient).length\n\n/** Default glyph colour per variant (raw palette, override via `toneClassNames`). */\nexport const DEFAULT_NOTIFY_TONE: Record<NotifyVariant, string> = {\n success: 'text-green-600',\n error: 'text-destructive',\n warning: 'text-amber-500',\n info: 'text-blue-500',\n}\n"],
|
|
5
|
+
"mappings": "AAgBA,SAAS,4BAA4B;AAIrC,SAAS,aAAa;AACtB,SAAS,cAAc;AAiEhB,MAAM,4BAA4B;AAuBzC,IAAI,MAAM;AACV,MAAM,MAAM,MAAM,IAAI,KAAK,IAAI,EAAE,SAAS,EAAE,CAAC,IAAI,OAAO,SAAS,EAAE,CAAC;AAGpE,SAAS,WAAW,OAA6C;AAC/D,MAAI,UAAU;AACd,SAAO,MAAM,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,yBAAyB;AAC/E;AAEO,MAAM,YAAY,OAAoB,CAAC,SAAS;AAAA,EACrD,eAAe,CAAC;AAAA,EAChB,OAAO;AAAA,EACP,UAAU,CAAC,UAAU,IAAI,EAAE,MAAM,CAAC;AAAA,EAClC,UAAU,CAAC,OACT,IAAI,CAAC,OAAO;AAAA,IACV,eAAe,EAAE,cAAc,IAAI,CAAC,MAAO,EAAE,OAAO,KAAK,EAAE,GAAG,GAAG,MAAM,KAAK,IAAI,CAAE;AAAA,EACpF,EAAE;AAAA,EACJ,aAAa,MACX,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,cAAc,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,KAAK,EAAE,EAAE,EAAE;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AAC;AAAA,IACxE,QAAQ;AAAA,IAER;AAAA,EACF,CAAC;AACH;AAIO,MAAM,eAAe,CAAC,MAC3B,EAAE,cAAc,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE;AAGhD,MAAM,sBAAqD;AAAA,EAChE,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AACR;",
|
|
6
6
|
"names": ["saved"]
|
|
7
7
|
}
|
package/dist/shell/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk6HJZCIND_cjs = require('../chunk-6HJZCIND.cjs');
|
|
4
|
+
var chunk5ECKSF6H_cjs = require('../chunk-5ECKSF6H.cjs');
|
|
5
5
|
require('../chunk-N73IMVFF.cjs');
|
|
6
6
|
require('../chunk-KULS4YWP.cjs');
|
|
7
7
|
require('../chunk-VOFNX4P6.cjs');
|
|
@@ -14,195 +14,195 @@ require('../chunk-S6A6FSG7.cjs');
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, "ArbiHost", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk6HJZCIND_cjs.ArbiHost; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "DEFAULT_ASSISTANT_NAME", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk6HJZCIND_cjs.DEFAULT_ASSISTANT_NAME; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "LEGACY_THREAD_DOCUMENTS_KEY", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk6HJZCIND_cjs.LEGACY_THREAD_DOCUMENTS_KEY; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "MENTION_HREF_PREFIX", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk6HJZCIND_cjs.MENTION_HREF_PREFIX; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "NotificationBell", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunk6HJZCIND_cjs.NotificationBell; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "Toaster", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunk6HJZCIND_cjs.Toaster; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "UNBOUND", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunk6HJZCIND_cjs.UNBOUND; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "assistantCopy", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunk6HJZCIND_cjs.assistantCopy; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "bindingOfRow", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunk6HJZCIND_cjs.bindingOfRow; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "clearSearchSession", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunk6HJZCIND_cjs.clearSearchSession; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "createSearchSession", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunk6HJZCIND_cjs.createSearchSession; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "extractMentions", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunk6HJZCIND_cjs.extractMentions; }
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(exports, "filterMentionCandidates", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunk6HJZCIND_cjs.filterMentionCandidates; }
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(exports, "findMentionQuery", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunk6HJZCIND_cjs.findMentionQuery; }
|
|
70
70
|
});
|
|
71
71
|
Object.defineProperty(exports, "forgetLegacyThreadDocuments", {
|
|
72
72
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunk6HJZCIND_cjs.forgetLegacyThreadDocuments; }
|
|
74
74
|
});
|
|
75
75
|
Object.defineProperty(exports, "hasMessageBody", {
|
|
76
76
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunk6HJZCIND_cjs.hasMessageBody; }
|
|
78
78
|
});
|
|
79
79
|
Object.defineProperty(exports, "insertMention", {
|
|
80
80
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunk6HJZCIND_cjs.insertMention; }
|
|
82
82
|
});
|
|
83
83
|
Object.defineProperty(exports, "isSlideDeck", {
|
|
84
84
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunk6HJZCIND_cjs.isSlideDeck; }
|
|
86
86
|
});
|
|
87
87
|
Object.defineProperty(exports, "latestThreadOfDocument", {
|
|
88
88
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunk6HJZCIND_cjs.latestThreadOfDocument; }
|
|
90
90
|
});
|
|
91
91
|
Object.defineProperty(exports, "linkMentions", {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunk6HJZCIND_cjs.linkMentions; }
|
|
94
94
|
});
|
|
95
95
|
Object.defineProperty(exports, "mentionFromHref", {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunk6HJZCIND_cjs.mentionFromHref; }
|
|
98
98
|
});
|
|
99
99
|
Object.defineProperty(exports, "openDocumentId", {
|
|
100
100
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunk6HJZCIND_cjs.openDocumentId; }
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(exports, "opensInWord", {
|
|
104
104
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunk6HJZCIND_cjs.opensInWord; }
|
|
106
106
|
});
|
|
107
107
|
Object.defineProperty(exports, "persistSearchSession", {
|
|
108
108
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunk6HJZCIND_cjs.persistSearchSession; }
|
|
110
110
|
});
|
|
111
111
|
Object.defineProperty(exports, "readLegacyThreadDocuments", {
|
|
112
112
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunk6HJZCIND_cjs.readLegacyThreadDocuments; }
|
|
114
114
|
});
|
|
115
115
|
Object.defineProperty(exports, "requestSearch", {
|
|
116
116
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunk6HJZCIND_cjs.requestSearch; }
|
|
118
118
|
});
|
|
119
119
|
Object.defineProperty(exports, "savedDocumentIdFor", {
|
|
120
120
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunk6HJZCIND_cjs.savedDocumentIdFor; }
|
|
122
122
|
});
|
|
123
123
|
Object.defineProperty(exports, "sharedSearchSession", {
|
|
124
124
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunk6HJZCIND_cjs.sharedSearchSession; }
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "takeDocumentForTurn", {
|
|
128
128
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunk6HJZCIND_cjs.takeDocumentForTurn; }
|
|
130
130
|
});
|
|
131
131
|
Object.defineProperty(exports, "takePendingSearch", {
|
|
132
132
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunk6HJZCIND_cjs.takePendingSearch; }
|
|
134
134
|
});
|
|
135
135
|
Object.defineProperty(exports, "toMessageMentions", {
|
|
136
136
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
137
|
+
get: function () { return chunk6HJZCIND_cjs.toMessageMentions; }
|
|
138
138
|
});
|
|
139
139
|
Object.defineProperty(exports, "useAssistantCopy", {
|
|
140
140
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunk6HJZCIND_cjs.useAssistantCopy; }
|
|
142
142
|
});
|
|
143
143
|
Object.defineProperty(exports, "useAssistantName", {
|
|
144
144
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunk6HJZCIND_cjs.useAssistantName; }
|
|
146
146
|
});
|
|
147
147
|
Object.defineProperty(exports, "useOpenDocumentId", {
|
|
148
148
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
149
|
+
get: function () { return chunk6HJZCIND_cjs.useOpenDocumentId; }
|
|
150
150
|
});
|
|
151
151
|
Object.defineProperty(exports, "useRegisterOpenDocument", {
|
|
152
152
|
enumerable: true,
|
|
153
|
-
get: function () { return
|
|
153
|
+
get: function () { return chunk6HJZCIND_cjs.useRegisterOpenDocument; }
|
|
154
154
|
});
|
|
155
155
|
Object.defineProperty(exports, "useTurnDocumentId", {
|
|
156
156
|
enumerable: true,
|
|
157
|
-
get: function () { return
|
|
157
|
+
get: function () { return chunk6HJZCIND_cjs.useTurnDocumentId; }
|
|
158
158
|
});
|
|
159
159
|
Object.defineProperty(exports, "clearChatArtifacts", {
|
|
160
160
|
enumerable: true,
|
|
161
|
-
get: function () { return
|
|
161
|
+
get: function () { return chunk5ECKSF6H_cjs.clearChatArtifacts; }
|
|
162
162
|
});
|
|
163
163
|
Object.defineProperty(exports, "configureNotify", {
|
|
164
164
|
enumerable: true,
|
|
165
|
-
get: function () { return
|
|
165
|
+
get: function () { return chunk5ECKSF6H_cjs.configureNotify; }
|
|
166
166
|
});
|
|
167
167
|
Object.defineProperty(exports, "getChatArtifact", {
|
|
168
168
|
enumerable: true,
|
|
169
|
-
get: function () { return
|
|
169
|
+
get: function () { return chunk5ECKSF6H_cjs.getChatArtifact; }
|
|
170
170
|
});
|
|
171
171
|
Object.defineProperty(exports, "getChatArtifacts", {
|
|
172
172
|
enumerable: true,
|
|
173
|
-
get: function () { return
|
|
173
|
+
get: function () { return chunk5ECKSF6H_cjs.getChatArtifacts; }
|
|
174
174
|
});
|
|
175
175
|
Object.defineProperty(exports, "notify", {
|
|
176
176
|
enumerable: true,
|
|
177
|
-
get: function () { return
|
|
177
|
+
get: function () { return chunk5ECKSF6H_cjs.notify; }
|
|
178
178
|
});
|
|
179
179
|
Object.defineProperty(exports, "persistNotifyHistory", {
|
|
180
180
|
enumerable: true,
|
|
181
|
-
get: function () { return
|
|
181
|
+
get: function () { return chunk5ECKSF6H_cjs.persistNotifyHistory; }
|
|
182
182
|
});
|
|
183
183
|
Object.defineProperty(exports, "recordChatArtifact", {
|
|
184
184
|
enumerable: true,
|
|
185
|
-
get: function () { return
|
|
185
|
+
get: function () { return chunk5ECKSF6H_cjs.recordChatArtifact; }
|
|
186
186
|
});
|
|
187
187
|
Object.defineProperty(exports, "selectUnread", {
|
|
188
188
|
enumerable: true,
|
|
189
|
-
get: function () { return
|
|
189
|
+
get: function () { return chunk5ECKSF6H_cjs.selectUnread; }
|
|
190
190
|
});
|
|
191
191
|
Object.defineProperty(exports, "toast", {
|
|
192
192
|
enumerable: true,
|
|
193
|
-
get: function () { return
|
|
193
|
+
get: function () { return chunk5ECKSF6H_cjs.toast; }
|
|
194
194
|
});
|
|
195
195
|
Object.defineProperty(exports, "useChatArtifact", {
|
|
196
196
|
enumerable: true,
|
|
197
|
-
get: function () { return
|
|
197
|
+
get: function () { return chunk5ECKSF6H_cjs.useChatArtifact; }
|
|
198
198
|
});
|
|
199
199
|
Object.defineProperty(exports, "useMessageChatArtifact", {
|
|
200
200
|
enumerable: true,
|
|
201
|
-
get: function () { return
|
|
201
|
+
get: function () { return chunk5ECKSF6H_cjs.useMessageChatArtifact; }
|
|
202
202
|
});
|
|
203
203
|
Object.defineProperty(exports, "useNotify", {
|
|
204
204
|
enumerable: true,
|
|
205
|
-
get: function () { return
|
|
205
|
+
get: function () { return chunk5ECKSF6H_cjs.useNotify; }
|
|
206
206
|
});
|
|
207
207
|
Object.defineProperty(exports, "useHostConfigRecord", {
|
|
208
208
|
enumerable: true,
|
package/dist/shell/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AppNotification, a as ArbiHost, b as ArbiHostConnection, c as ArbiHostProps, d as AssistantCopy, C as ChatArtifact, D as DEFAULT_ASSISTANT_NAME, H as HostConfigRecord, L as LEGACY_THREAD_DOCUMENTS_KEY, f as MENTION_HREF_PREFIX, g as MentionCandidate, h as MentionKind, i as MessageMentionRef, N as NotificationBell, j as NotificationBellProps, l as NotifyConfig, m as NotifyOptions, n as NotifyVariant, O as OpenDocumentRegistration, S as SavedDocumentInput, o as SearchSession, p as SearchSessionState, q as SearchStatus, T as ThreadBinding, r as ThreadBindingRow, s as Toaster, t as TurnDocumentInput, U as UNBOUND, W as WordDocumentKind, u as assistantCopy, v as bindingOfRow, w as clearChatArtifacts, x as clearSearchSession, y as configureNotify, z as createSearchSession, B as extractMentions, E as filterMentionCandidates, F as findMentionQuery, G as forgetLegacyThreadDocuments, I as getChatArtifact, J as getChatArtifacts, K as hasMessageBody, P as insertMention, Q as isSlideDeck, R as latestThreadOfDocument, V as linkMentions, X as mentionFromHref, Y as notify, Z as openDocumentId, _ as opensInWord, $ as persistNotifyHistory, a0 as persistSearchSession, a1 as readLegacyThreadDocuments, a2 as recordChatArtifact, a3 as requestSearch, a4 as savedDocumentIdFor, a6 as selectUnread, a7 as sharedSearchSession, a8 as takeDocumentForTurn, a9 as takePendingSearch, aa as toMessageMentions, ab as useAssistantCopy, ac as useAssistantName, ad as useChatArtifact, ae as useHostConfigRecord, af as useMessageChatArtifact, ag as useNotify, ah as useOpenDocumentId, ai as useRegisterOpenDocument, aj as useTurnDocumentId } from '../index.d-
|
|
1
|
+
export { A as AppNotification, a as ArbiHost, b as ArbiHostConnection, c as ArbiHostProps, d as AssistantCopy, C as ChatArtifact, D as DEFAULT_ASSISTANT_NAME, H as HostConfigRecord, L as LEGACY_THREAD_DOCUMENTS_KEY, f as MENTION_HREF_PREFIX, g as MentionCandidate, h as MentionKind, i as MessageMentionRef, N as NotificationBell, j as NotificationBellProps, l as NotifyConfig, m as NotifyOptions, n as NotifyVariant, O as OpenDocumentRegistration, S as SavedDocumentInput, o as SearchSession, p as SearchSessionState, q as SearchStatus, T as ThreadBinding, r as ThreadBindingRow, s as Toaster, t as TurnDocumentInput, U as UNBOUND, W as WordDocumentKind, u as assistantCopy, v as bindingOfRow, w as clearChatArtifacts, x as clearSearchSession, y as configureNotify, z as createSearchSession, B as extractMentions, E as filterMentionCandidates, F as findMentionQuery, G as forgetLegacyThreadDocuments, I as getChatArtifact, J as getChatArtifacts, K as hasMessageBody, P as insertMention, Q as isSlideDeck, R as latestThreadOfDocument, V as linkMentions, X as mentionFromHref, Y as notify, Z as openDocumentId, _ as opensInWord, $ as persistNotifyHistory, a0 as persistSearchSession, a1 as readLegacyThreadDocuments, a2 as recordChatArtifact, a3 as requestSearch, a4 as savedDocumentIdFor, a6 as selectUnread, a7 as sharedSearchSession, a8 as takeDocumentForTurn, a9 as takePendingSearch, aa as toMessageMentions, ab as useAssistantCopy, ac as useAssistantName, ad as useChatArtifact, ae as useHostConfigRecord, af as useMessageChatArtifact, ag as useNotify, ah as useOpenDocumentId, ai as useRegisterOpenDocument, aj as useTurnDocumentId } from '../index.d-COC3NkxH.js';
|
|
2
2
|
export { ToasterProps, toast } from 'sonner';
|
|
3
3
|
import 'zustand';
|
|
4
4
|
import 'react';
|
|
@@ -81,44 +81,51 @@ function createWorkspaceSwitch({
|
|
|
81
81
|
return false;
|
|
82
82
|
}
|
|
83
83
|
const epoch = ++switchEpoch;
|
|
84
|
-
notify.info(`Opening "${name}" ${noun}\u2026`, {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
session.leaveWorkspace();
|
|
89
|
-
drainWorkspaceQueries(queryClient);
|
|
90
|
-
session.setWorkspaceId(null);
|
|
91
|
-
}
|
|
92
|
-
session.setWorkspaceStatus("opening");
|
|
93
|
-
performance.mark("arbi:workspace-open:start");
|
|
94
|
-
let opened;
|
|
84
|
+
const opening = notify.info(`Opening "${name}" ${noun}\u2026`, {
|
|
85
|
+
workspaceId: target.id,
|
|
86
|
+
duration: 2e3
|
|
87
|
+
});
|
|
95
88
|
try {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
89
|
+
await signedIn(arbi);
|
|
90
|
+
if (epoch !== switchEpoch) return false;
|
|
91
|
+
if (!isSame) {
|
|
92
|
+
session.leaveWorkspace();
|
|
93
|
+
drainWorkspaceQueries(queryClient);
|
|
94
|
+
session.setWorkspaceId(null);
|
|
95
|
+
}
|
|
96
|
+
session.setWorkspaceStatus("opening");
|
|
97
|
+
performance.mark("arbi:workspace-open:start");
|
|
98
|
+
let opened;
|
|
99
|
+
try {
|
|
100
|
+
opened = await arbi().selectWorkspace(target.id);
|
|
101
|
+
} catch (error) {
|
|
102
|
+
if (isAbortError(error)) return false;
|
|
103
|
+
const superseded = error instanceof ArbiWorkspaceSupersededError;
|
|
104
|
+
if (!superseded) console.error("[switchWorkspace] /open failed:", error);
|
|
105
|
+
if (superseded && epoch === switchEpoch) {
|
|
106
|
+
if (previousId) session.setWorkspaceId(previousId);
|
|
107
|
+
session.setWorkspaceStatus("closed");
|
|
108
|
+
} else if (epoch === switchEpoch) {
|
|
109
|
+
if (previousId) session.setWorkspaceId(previousId);
|
|
110
|
+
session.setWorkspaceStatus("closed");
|
|
111
|
+
if (isWorkspaceArchivedError(error)) {
|
|
112
|
+
notify.info(archivedWorkspaceMessage(name));
|
|
113
|
+
void queryClient.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() });
|
|
114
|
+
} else {
|
|
115
|
+
notify.error(`Failed to open "${name}" ${noun}`);
|
|
116
|
+
}
|
|
112
117
|
}
|
|
118
|
+
return false;
|
|
113
119
|
}
|
|
114
|
-
return false;
|
|
120
|
+
if (epoch !== switchEpoch) return false;
|
|
121
|
+
seedOpenedWorkspace(queryClient, target.id, opened);
|
|
122
|
+
performance.mark("arbi:workspace-open:response");
|
|
123
|
+
session.setWorkspaceId(target.id);
|
|
124
|
+
session.setWorkspaceStatus("open");
|
|
125
|
+
return true;
|
|
126
|
+
} finally {
|
|
127
|
+
notify.dismiss(opening);
|
|
115
128
|
}
|
|
116
|
-
if (epoch !== switchEpoch) return false;
|
|
117
|
-
seedOpenedWorkspace(queryClient, target.id, opened);
|
|
118
|
-
performance.mark("arbi:workspace-open:response");
|
|
119
|
-
session.setWorkspaceId(target.id);
|
|
120
|
-
session.setWorkspaceStatus("open");
|
|
121
|
-
return true;
|
|
122
129
|
};
|
|
123
130
|
const clearWorkspace = () => {
|
|
124
131
|
++switchEpoch;
|