@athenaintel/react 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4543,6 +4543,16 @@ const ChainOfThoughtByIndicesProvider = ({ startIndex, endIndex, children }) =>
4543
4543
  });
4544
4544
  return jsx(AuiProvider, { value: aui, children });
4545
4545
  };
4546
+ const ThreadListItemByIndexProvider = ({ index: index2, archived, children }) => {
4547
+ const aui = useAui({
4548
+ threadListItem: Derived({
4549
+ source: "threads",
4550
+ query: { type: "index", index: index2, archived },
4551
+ get: (aui2) => aui2.threads().item({ index: index2, archived })
4552
+ })
4553
+ });
4554
+ return jsx(AuiProvider, { value: aui, children });
4555
+ };
4546
4556
  const RuntimeAdapter = resource((runtime) => tapResource(RuntimeAdapterResource(runtime)));
4547
4557
  attachTransformScopes(RuntimeAdapter, (scopes, parent) => {
4548
4558
  const result = baseRuntimeAdapterTransformScopes(scopes, parent);
@@ -7622,7 +7632,7 @@ const toAppendMessage = (messages, message) => {
7622
7632
  startRun: message.startRun
7623
7633
  };
7624
7634
  };
7625
- const getThreadState$1 = (runtime, threadListItemState) => {
7635
+ const getThreadState = (runtime, threadListItemState) => {
7626
7636
  const lastMessage = runtime.messages.at(-1);
7627
7637
  return Object.freeze({
7628
7638
  threadId: threadListItemState.id,
@@ -7645,7 +7655,7 @@ class ThreadRuntimeImpl {
7645
7655
  __publicField(this, "_eventSubscriptionSubjects", /* @__PURE__ */ new Map());
7646
7656
  const stateBinding = new ShallowMemoizeSubject({
7647
7657
  path: threadBinding.path,
7648
- getState: () => getThreadState$1(threadBinding.getState(), threadListItemBinding.getState()),
7658
+ getState: () => getThreadState(threadBinding.getState(), threadListItemBinding.getState()),
7649
7659
  subscribe: (callback) => {
7650
7660
  const sub1 = threadBinding.subscribe(callback);
7651
7661
  const sub2 = threadListItemBinding.subscribe(callback);
@@ -8912,6 +8922,24 @@ const MessagePrimitiveParts$1 = ({ components, unstable_showEmptyOnNonTextEnd =
8912
8922
  return jsxs(Fragment$2, { children: [partsElements, jsx(ConditionalEmpty, { components, enabled: unstable_showEmptyOnNonTextEnd })] });
8913
8923
  };
8914
8924
  MessagePrimitiveParts$1.displayName = "MessagePrimitive.Parts";
8925
+ const ThreadListPrimitiveItemByIndex = memo(({ index: index2, archived = false, components }) => {
8926
+ const ThreadListItemComponent = components.ThreadListItem;
8927
+ return jsx(ThreadListItemByIndexProvider, { index: index2, archived, children: jsx(ThreadListItemComponent, {}) });
8928
+ }, (prev, next) => prev.index === next.index && prev.archived === next.archived && prev.components.ThreadListItem === next.components.ThreadListItem);
8929
+ ThreadListPrimitiveItemByIndex.displayName = "ThreadListPrimitive.ItemByIndex";
8930
+ const ThreadListPrimitiveItems = ({ archived = false, components }) => {
8931
+ const contentLength = useAuiState((s) => archived ? s.threads.archivedThreadIds.length : s.threads.threadIds.length);
8932
+ const listElements = useMemo(() => {
8933
+ return Array.from({ length: contentLength }, (_, index2) => jsx(ThreadListPrimitiveItemByIndex, { index: index2, archived, components }, index2));
8934
+ }, [contentLength, archived, components]);
8935
+ return listElements;
8936
+ };
8937
+ ThreadListPrimitiveItems.displayName = "ThreadListPrimitive.Items";
8938
+ const ThreadListItemPrimitiveTitle = ({ fallback }) => {
8939
+ const title = useAuiState((s) => s.threadListItem.title);
8940
+ return jsx(Fragment$2, { children: title || fallback });
8941
+ };
8942
+ ThreadListItemPrimitiveTitle.displayName = "ThreadListItemPrimitive.Title";
8915
8943
  const useComposerSend$1 = () => {
8916
8944
  const aui = useAui();
8917
8945
  const disabled = useAuiState((s) => s.thread.isRunning || !s.composer.isEditing || s.composer.isEmpty);
@@ -16344,6 +16372,37 @@ const useThreadScrollToBottom = ({ behavior } = {}) => {
16344
16372
  return handleScrollToBottom;
16345
16373
  };
16346
16374
  const ThreadPrimitiveScrollToBottom = createActionButton("ThreadPrimitive.ScrollToBottom", useThreadScrollToBottom, ["behavior"]);
16375
+ const ThreadListPrimitiveNew = forwardRef(({ onClick, disabled, ...props }, forwardedRef) => {
16376
+ const isMain = useAuiState((s) => s.threads.newThreadId === s.threads.mainThreadId);
16377
+ const aui = useAui();
16378
+ return jsx(Primitive$1.button, { type: "button", ...isMain ? { "data-active": "true", "aria-current": "true" } : null, ...props, ref: forwardedRef, disabled, onClick: composeEventHandlers(onClick, () => {
16379
+ aui.threads().switchToNewThread();
16380
+ }) });
16381
+ });
16382
+ ThreadListPrimitiveNew.displayName = "ThreadListPrimitive.New";
16383
+ const ThreadListPrimitiveRoot = forwardRef((props, ref) => {
16384
+ return jsx(Primitive$1.div, { ...props, ref });
16385
+ });
16386
+ ThreadListPrimitiveRoot.displayName = "ThreadListPrimitive.Root";
16387
+ const ThreadListItemPrimitiveRoot = forwardRef((props, ref) => {
16388
+ const isMain = useAuiState((s) => s.threads.mainThreadId === s.threadListItem.id);
16389
+ return jsx(Primitive$1.div, { ...isMain ? { "data-active": "true", "aria-current": "true" } : null, ...props, ref });
16390
+ });
16391
+ ThreadListItemPrimitiveRoot.displayName = "ThreadListItemPrimitive.Root";
16392
+ const useThreadListItemArchive = () => {
16393
+ const aui = useAui();
16394
+ return useCallback(() => {
16395
+ aui.threadListItem().archive();
16396
+ }, [aui]);
16397
+ };
16398
+ const ThreadListItemPrimitiveArchive = createActionButton("ThreadListItemPrimitive.Archive", useThreadListItemArchive);
16399
+ const useThreadListItemTrigger = () => {
16400
+ const aui = useAui();
16401
+ return useCallback(() => {
16402
+ aui.threadListItem().switchTo();
16403
+ }, [aui]);
16404
+ };
16405
+ const ThreadListItemPrimitiveTrigger = createActionButton("ThreadListItemPrimitive.Trigger", useThreadListItemTrigger);
16347
16406
  const useScrollLock = (animatedElementRef, animationDuration) => {
16348
16407
  const scrollContainerRef = useRef(null);
16349
16408
  const cleanupRef = useRef(null);
@@ -20719,6 +20778,7 @@ const createConverter = (optimisticMessageCache) => (state, connectionMetadata)
20719
20778
  const useAthenaRuntime = (config2) => {
20720
20779
  const {
20721
20780
  apiUrl = DEFAULT_API_URL,
20781
+ resumeApiUrl,
20722
20782
  backendUrl = DEFAULT_BACKEND_URL,
20723
20783
  apiKey,
20724
20784
  token,
@@ -20729,9 +20789,9 @@ const useAthenaRuntime = (config2) => {
20729
20789
  workbench = [],
20730
20790
  knowledgeBase = [],
20731
20791
  systemPrompt,
20732
- threadId: threadIdProp,
20733
- initialMessages
20792
+ threadId: threadIdProp
20734
20793
  } = config2;
20794
+ const resolvedResumeApiUrl = resumeApiUrl ?? apiUrl.replace(/\/api\/chat$/, "/api/resume");
20735
20795
  const generatedIdRef = useRef(null);
20736
20796
  if (generatedIdRef.current === null) {
20737
20797
  generatedIdRef.current = crypto.randomUUID();
@@ -20747,10 +20807,12 @@ const useAthenaRuntime = (config2) => {
20747
20807
  tokenRef.current = token;
20748
20808
  const apiKeyRef = useRef(apiKey);
20749
20809
  apiKeyRef.current = apiKey;
20810
+ const isExistingThread = !!threadIdProp;
20750
20811
  const runtime = useAssistantTransportRuntime({
20751
- initialState: { messages: initialMessages ?? [] },
20812
+ initialState: { messages: [] },
20752
20813
  converter,
20753
20814
  api: apiUrl,
20815
+ resumeApi: resolvedResumeApiUrl,
20754
20816
  headers: async () => ({
20755
20817
  // Prefer parent-injected PropelAuth token over hardcoded API key
20756
20818
  ...tokenRef.current ? { Authorization: `Bearer ${tokenRef.current}` } : apiKeyRef.current ? { "X-API-KEY": apiKeyRef.current } : {},
@@ -20856,6 +20918,16 @@ const useAthenaRuntime = (config2) => {
20856
20918
  }
20857
20919
  }
20858
20920
  });
20921
+ const hasResumedRef = useRef(false);
20922
+ useEffect(() => {
20923
+ if (isExistingThread && !hasResumedRef.current) {
20924
+ hasResumedRef.current = true;
20925
+ try {
20926
+ runtime.thread.unstable_resumeRun({ parentId: null });
20927
+ } catch {
20928
+ }
20929
+ }
20930
+ }, [isExistingThread, runtime]);
20859
20931
  return runtime;
20860
20932
  };
20861
20933
  function r(e) {
@@ -24089,20 +24161,6 @@ function useAthenaConfig() {
24089
24161
  }
24090
24162
  return ctx;
24091
24163
  }
24092
- const ThreadLoadingContext = createContext(false);
24093
- function useThreadLoading() {
24094
- return useContext(ThreadLoadingContext);
24095
- }
24096
- const ThreadListContext = createContext(null);
24097
- function useThreadListStore() {
24098
- const store = useContext(ThreadListContext);
24099
- if (!store) {
24100
- throw new Error(
24101
- "[AthenaSDK] useThreadList must be used within an <AthenaProvider> that has thread management enabled."
24102
- );
24103
- }
24104
- return store;
24105
- }
24106
24164
  function getAuthHeaders(auth) {
24107
24165
  if (auth.token) {
24108
24166
  return { Authorization: `Bearer ${auth.token}` };
@@ -24127,36 +24185,6 @@ async function listThreads(backendUrl, auth, opts = {}) {
24127
24185
  }
24128
24186
  return res.json();
24129
24187
  }
24130
- function deserializeMessage(msg) {
24131
- if (msg && typeof msg === "object" && "lc" in msg && "kwargs" in msg && msg.type === "constructor") {
24132
- const kwargs = msg.kwargs;
24133
- if (Array.isArray(kwargs.tool_calls)) {
24134
- kwargs.tool_calls = kwargs.tool_calls.map((tc) => {
24135
- if (tc && typeof tc === "object" && "lc" in tc && "kwargs" in tc) {
24136
- return tc.kwargs;
24137
- }
24138
- return tc;
24139
- });
24140
- }
24141
- return kwargs;
24142
- }
24143
- return msg;
24144
- }
24145
- async function getThreadState(backendUrl, auth, threadId) {
24146
- const base2 = getAgoraBaseUrl(backendUrl);
24147
- const res = await fetch(`${base2}/api/unstable/threads/${threadId}`, {
24148
- method: "GET",
24149
- headers: { ...getAuthHeaders(auth) }
24150
- });
24151
- if (!res.ok) {
24152
- throw new Error(`[AthenaSDK] Failed to get thread state: ${res.status}`);
24153
- }
24154
- const data = await res.json();
24155
- if (Array.isArray(data.messages)) {
24156
- data.messages = data.messages.map(deserializeMessage);
24157
- }
24158
- return data;
24159
- }
24160
24188
  async function archiveThread(backendUrl, auth, threadId) {
24161
24189
  const base2 = getAgoraBaseUrl(backendUrl);
24162
24190
  const res = await fetch(`${base2}/api/conversations/threads/archive`, {
@@ -24168,53 +24196,67 @@ async function archiveThread(backendUrl, auth, threadId) {
24168
24196
  throw new Error(`[AthenaSDK] Failed to archive thread: ${res.status}`);
24169
24197
  }
24170
24198
  }
24171
- function createThreadListStore(config2) {
24172
- const auth = { apiKey: config2.apiKey, token: config2.token };
24173
- const store = create((set2, get2) => ({
24174
- threads: [],
24175
- activeThreadId: null,
24176
- isLoading: false,
24177
- error: null,
24178
- fetchThreads: async () => {
24179
- set2({ isLoading: true, error: null });
24199
+ const AthenaThreadIdContext = createContext(void 0);
24200
+ function useAthenaThreadId() {
24201
+ return useContext(AthenaThreadIdContext);
24202
+ }
24203
+ function useAthenaThreadListAdapter(config2) {
24204
+ const configRef = useRef(config2);
24205
+ useEffect(() => {
24206
+ configRef.current = config2;
24207
+ }, [config2]);
24208
+ const auth = useMemo(
24209
+ () => ({ apiKey: config2.apiKey, token: config2.token }),
24210
+ [config2.apiKey, config2.token]
24211
+ );
24212
+ const unstable_Provider = useCallback(
24213
+ function AthenaThreadProvider({ children }) {
24214
+ const aui = useAui();
24215
+ const remoteId = aui.threadListItem().getState().remoteId;
24216
+ return /* @__PURE__ */ jsx(AthenaThreadIdContext.Provider, { value: remoteId, children });
24217
+ },
24218
+ []
24219
+ );
24220
+ return useMemo(() => ({
24221
+ async list() {
24180
24222
  try {
24181
- const { threads } = await listThreads(config2.backendUrl, auth);
24182
- const sorted = [...threads].sort(
24183
- (a, b) => new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime()
24184
- );
24185
- set2({ threads: sorted, isLoading: false });
24186
- } catch (e) {
24187
- set2({ error: e.message, isLoading: false });
24223
+ const { threads } = await listThreads(configRef.current.backendUrl, auth);
24224
+ return {
24225
+ threads: threads.map((t) => ({
24226
+ status: "regular",
24227
+ remoteId: t.thread_id,
24228
+ title: t.title || void 0
24229
+ }))
24230
+ };
24231
+ } catch (err) {
24232
+ console.error("[AthenaSDK] adapter.list() failed:", err);
24233
+ return { threads: [] };
24188
24234
  }
24189
24235
  },
24190
- switchThread: (threadId) => {
24191
- if (process.env.NODE_ENV !== "production") {
24192
- console.log("[AthenaThreads] switchThread called", { threadId, prev: get2().activeThreadId });
24193
- }
24194
- set2({ activeThreadId: threadId });
24236
+ async initialize(threadId) {
24237
+ return { remoteId: threadId, externalId: void 0 };
24195
24238
  },
24196
- newThread: async () => {
24197
- const localThreadId = `thread_${crypto.randomUUID()}`;
24198
- set2({ activeThreadId: localThreadId });
24199
- return localThreadId;
24239
+ async rename(_remoteId, _newTitle) {
24200
24240
  },
24201
- archiveThread: async (threadId) => {
24202
- var _a2;
24203
- try {
24204
- await archiveThread(config2.backendUrl, auth, threadId);
24205
- const { threads, activeThreadId } = get2();
24206
- const remaining = threads.filter((t) => t.thread_id !== threadId);
24207
- set2({
24208
- threads: remaining,
24209
- activeThreadId: activeThreadId === threadId ? ((_a2 = remaining[0]) == null ? void 0 : _a2.thread_id) ?? null : activeThreadId
24210
- });
24211
- } catch (e) {
24212
- set2({ error: e.message });
24213
- }
24214
- }
24215
- }));
24216
- store.getState().fetchThreads();
24217
- return store;
24241
+ async archive(remoteId) {
24242
+ await archiveThread(configRef.current.backendUrl, auth, remoteId);
24243
+ },
24244
+ async unarchive(_remoteId) {
24245
+ },
24246
+ async delete(remoteId) {
24247
+ await archiveThread(configRef.current.backendUrl, auth, remoteId);
24248
+ },
24249
+ async generateTitle(_remoteId, _messages) {
24250
+ return new Response("").body;
24251
+ },
24252
+ async fetch(remoteId) {
24253
+ return {
24254
+ status: "regular",
24255
+ remoteId
24256
+ };
24257
+ },
24258
+ unstable_Provider
24259
+ }), [auth, unstable_Provider]);
24218
24260
  }
24219
24261
  const THEME_TO_CSS = {
24220
24262
  primary: "--primary",
@@ -24388,7 +24430,7 @@ const themes = {
24388
24430
  radius: "0.625rem"
24389
24431
  }
24390
24432
  };
24391
- function AthenaRuntimeInner({
24433
+ function AthenaStandalone({
24392
24434
  children,
24393
24435
  apiUrl,
24394
24436
  backendUrl,
@@ -24402,13 +24444,10 @@ function AthenaRuntimeInner({
24402
24444
  workbench,
24403
24445
  knowledgeBase,
24404
24446
  systemPrompt,
24405
- threadId,
24406
- initialMessages
24447
+ threadId
24407
24448
  }) {
24408
24449
  const auiTools = useMemo(() => Tools({ toolkit: frontendTools }), [frontendTools]);
24409
- const aui = useAui({
24410
- tools: auiTools
24411
- });
24450
+ const aui = useAui({ tools: auiTools });
24412
24451
  const runtime = useAthenaRuntime({
24413
24452
  apiUrl,
24414
24453
  backendUrl,
@@ -24421,8 +24460,7 @@ function AthenaRuntimeInner({
24421
24460
  workbench,
24422
24461
  knowledgeBase,
24423
24462
  systemPrompt,
24424
- threadId,
24425
- initialMessages
24463
+ threadId
24426
24464
  });
24427
24465
  const athenaConfig = useMemo(
24428
24466
  () => ({ backendUrl, apiKey, token }),
@@ -24430,6 +24468,72 @@ function AthenaRuntimeInner({
24430
24468
  );
24431
24469
  return /* @__PURE__ */ jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsx(TooltipProvider, { children }) }) });
24432
24470
  }
24471
+ function useAthenaRuntimeHook(config2) {
24472
+ const remoteId = useAthenaThreadId();
24473
+ return useAthenaRuntime({
24474
+ apiUrl: config2.apiUrl,
24475
+ backendUrl: config2.backendUrl,
24476
+ apiKey: config2.apiKey,
24477
+ token: config2.token,
24478
+ model: config2.model,
24479
+ agent: config2.agent,
24480
+ tools: config2.tools,
24481
+ frontendToolIds: config2.frontendToolIds,
24482
+ workbench: config2.workbench,
24483
+ knowledgeBase: config2.knowledgeBase,
24484
+ systemPrompt: config2.systemPrompt,
24485
+ threadId: remoteId
24486
+ });
24487
+ }
24488
+ function AthenaWithThreadList({
24489
+ children,
24490
+ apiUrl,
24491
+ backendUrl,
24492
+ apiKey,
24493
+ token,
24494
+ model,
24495
+ agent: agent2,
24496
+ tools,
24497
+ frontendToolIds,
24498
+ frontendTools,
24499
+ workbench,
24500
+ knowledgeBase,
24501
+ systemPrompt
24502
+ }) {
24503
+ const adapter = useAthenaThreadListAdapter({
24504
+ backendUrl,
24505
+ apiKey,
24506
+ token
24507
+ });
24508
+ const runtimeConfig = useMemo(() => ({
24509
+ apiUrl,
24510
+ backendUrl,
24511
+ apiKey,
24512
+ token,
24513
+ model,
24514
+ agent: agent2,
24515
+ tools,
24516
+ frontendToolIds,
24517
+ workbench,
24518
+ knowledgeBase,
24519
+ systemPrompt
24520
+ }), [apiUrl, backendUrl, apiKey, token, model, agent2, tools, frontendToolIds, workbench, knowledgeBase, systemPrompt]);
24521
+ const runtimeHook = useCallback(
24522
+ () => useAthenaRuntimeHook(runtimeConfig),
24523
+ [runtimeConfig]
24524
+ );
24525
+ const runtime = useRemoteThreadListRuntime({
24526
+ runtimeHook,
24527
+ adapter
24528
+ });
24529
+ const auiTools = useMemo(() => Tools({ toolkit: frontendTools }), [frontendTools]);
24530
+ const aui = useAui({ tools: auiTools });
24531
+ const athenaConfig = useMemo(
24532
+ () => ({ backendUrl, apiKey, token }),
24533
+ [backendUrl, apiKey, token]
24534
+ );
24535
+ return /* @__PURE__ */ jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsx(TooltipProvider, { children }) }) });
24536
+ }
24433
24537
  function AthenaProvider({
24434
24538
  children,
24435
24539
  apiKey,
@@ -24452,75 +24556,46 @@ function AthenaProvider({
24452
24556
  const parentAuthToken = useParentAuth();
24453
24557
  const effectiveToken = tokenProp ?? parentAuthToken;
24454
24558
  const effectiveBackendUrl = backendUrl ?? DEFAULT_BACKEND_URL;
24455
- const threadListStoreRef = useRef(null);
24456
- if (enableThreadList && !threadListStoreRef.current) {
24457
- threadListStoreRef.current = createThreadListStore({
24458
- backendUrl: effectiveBackendUrl,
24459
- apiKey,
24460
- token: effectiveToken
24461
- });
24462
- }
24463
- const activeThreadId = threadListStoreRef.current ? useStore$1(threadListStoreRef.current, (s) => s.activeThreadId) : null;
24464
- const [displayedThreadId, setDisplayedThreadId] = useState(null);
24465
- const [loadedMessages, setLoadedMessages] = useState(void 0);
24466
- const [isLoadingThread, setIsLoadingThread] = useState(false);
24467
- useEffect(() => {
24468
- var _a2;
24469
- if (!enableThreadList) return;
24470
- if (activeThreadId === displayedThreadId) return;
24471
- const threads = ((_a2 = threadListStoreRef.current) == null ? void 0 : _a2.getState().threads) ?? [];
24472
- const isExistingThread = threads.some((t) => t.thread_id === activeThreadId);
24473
- if (!isExistingThread) {
24474
- setLoadedMessages(void 0);
24475
- setDisplayedThreadId(activeThreadId);
24476
- setIsLoadingThread(false);
24477
- return;
24478
- }
24479
- let cancelled = false;
24480
- setIsLoadingThread(true);
24481
- getThreadState(effectiveBackendUrl, { apiKey, token: effectiveToken }, activeThreadId).then((state) => {
24482
- if (cancelled) return;
24483
- setLoadedMessages(state.messages ?? []);
24484
- setDisplayedThreadId(activeThreadId);
24485
- setIsLoadingThread(false);
24486
- }).catch((err) => {
24487
- if (cancelled) return;
24488
- if (process.env.NODE_ENV !== "production") {
24489
- console.error("[AthenaSDK] Failed to load thread state:", err);
24559
+ let inner;
24560
+ if (enableThreadList) {
24561
+ inner = /* @__PURE__ */ jsx(
24562
+ AthenaWithThreadList,
24563
+ {
24564
+ apiUrl,
24565
+ backendUrl: effectiveBackendUrl,
24566
+ apiKey,
24567
+ token: effectiveToken,
24568
+ model,
24569
+ agent: agent2,
24570
+ tools,
24571
+ frontendToolIds: frontendToolNames,
24572
+ frontendTools,
24573
+ workbench,
24574
+ knowledgeBase,
24575
+ systemPrompt,
24576
+ children
24490
24577
  }
24491
- setLoadedMessages(void 0);
24492
- setDisplayedThreadId(activeThreadId);
24493
- setIsLoadingThread(false);
24494
- });
24495
- return () => {
24496
- cancelled = true;
24497
- };
24498
- }, [activeThreadId, displayedThreadId, enableThreadList, effectiveBackendUrl, apiKey, effectiveToken]);
24499
- const resolvedThreadId = threadIdProp ?? displayedThreadId ?? void 0;
24500
- const runtimeContent = /* @__PURE__ */ jsx(ThreadLoadingContext.Provider, { value: isLoadingThread, children: /* @__PURE__ */ jsx(
24501
- AthenaRuntimeInner,
24502
- {
24503
- apiUrl,
24504
- backendUrl: effectiveBackendUrl,
24505
- apiKey,
24506
- token: effectiveToken,
24507
- model,
24508
- agent: agent2,
24509
- tools,
24510
- frontendToolIds: frontendToolNames,
24511
- frontendTools,
24512
- workbench,
24513
- knowledgeBase,
24514
- systemPrompt,
24515
- threadId: resolvedThreadId,
24516
- initialMessages: loadedMessages,
24517
- children
24518
- },
24519
- resolvedThreadId ?? "__new__"
24520
- ) });
24521
- let inner = runtimeContent;
24522
- if (enableThreadList && threadListStoreRef.current) {
24523
- inner = /* @__PURE__ */ jsx(ThreadListContext.Provider, { value: threadListStoreRef.current, children: inner });
24578
+ );
24579
+ } else {
24580
+ inner = /* @__PURE__ */ jsx(
24581
+ AthenaStandalone,
24582
+ {
24583
+ apiUrl,
24584
+ backendUrl: effectiveBackendUrl,
24585
+ apiKey,
24586
+ token: effectiveToken,
24587
+ model,
24588
+ agent: agent2,
24589
+ tools,
24590
+ frontendToolIds: frontendToolNames,
24591
+ frontendTools,
24592
+ workbench,
24593
+ knowledgeBase,
24594
+ systemPrompt,
24595
+ threadId: threadIdProp,
24596
+ children
24597
+ }
24598
+ );
24524
24599
  }
24525
24600
  if (themeStyleVars) {
24526
24601
  return /* @__PURE__ */ jsx("div", { className: "athena-themed", style: themeStyleVars, children: inner });
@@ -57318,10 +57393,10 @@ const HorizontalRule$1 = HorizontalRule.extend({
57318
57393
  };
57319
57394
  }
57320
57395
  });
57321
- const Image = Node3.create({
57396
+ const Image$1 = Node3.create({
57322
57397
  name: "image"
57323
57398
  });
57324
- const Image$1 = Image.extend({
57399
+ const Image$1$1 = Image$1.extend({
57325
57400
  /**
57326
57401
  * @return {{markdown: MarkdownNodeSpec}}
57327
57402
  */
@@ -57605,10 +57680,10 @@ const Italic$1 = Italic.extend({
57605
57680
  };
57606
57681
  }
57607
57682
  });
57608
- const Link = Mark2.create({
57683
+ const Link$1 = Mark2.create({
57609
57684
  name: "link"
57610
57685
  });
57611
- const Link$1 = Link.extend({
57686
+ const Link$1$1 = Link$1.extend({
57612
57687
  /**
57613
57688
  * @return {{markdown: MarkdownMarkSpec}}
57614
57689
  */
@@ -57645,7 +57720,7 @@ const Strike$1 = Strike.extend({
57645
57720
  };
57646
57721
  }
57647
57722
  });
57648
- const markdownExtensions = [Blockquote$1, BulletList$1, CodeBlock$1, HardBreak$1, Heading$1, HorizontalRule$1, HTMLNode, Image$1, ListItem$1, OrderedList$1, Paragraph$1, Table$1, TaskItem$1, TaskList$1, Text$1, Bold$1, Code$1$1, HTMLMark, Italic$1, Link$1, Strike$1];
57723
+ const markdownExtensions = [Blockquote$1, BulletList$1, CodeBlock$1, HardBreak$1, Heading$1, HorizontalRule$1, HTMLNode, Image$1$1, ListItem$1, OrderedList$1, Paragraph$1, Table$1, TaskItem$1, TaskList$1, Text$1, Bold$1, Code$1$1, HTMLMark, Italic$1, Link$1$1, Strike$1];
57649
57724
  function getMarkdownSpec(extension) {
57650
57725
  var _extension$storage, _markdownExtensions$f;
57651
57726
  const markdownSpec = (_extension$storage = extension.storage) === null || _extension$storage === void 0 ? void 0 : _extension$storage.markdown;
@@ -60458,41 +60533,41 @@ const createLucideIcon = (iconName, iconNode) => {
60458
60533
  * This source code is licensed under the ISC license.
60459
60534
  * See the LICENSE file in the root directory of this source tree.
60460
60535
  */
60461
- const __iconNode$E = [
60536
+ const __iconNode$J = [
60462
60537
  ["rect", { width: "20", height: "5", x: "2", y: "3", rx: "1", key: "1wp1u1" }],
60463
60538
  ["path", { d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8", key: "1s80jp" }],
60464
60539
  ["path", { d: "M10 12h4", key: "a56b0p" }]
60465
60540
  ];
60466
- const Archive = createLucideIcon("archive", __iconNode$E);
60541
+ const Archive = createLucideIcon("archive", __iconNode$J);
60467
60542
  /**
60468
60543
  * @license lucide-react v0.575.0 - ISC
60469
60544
  *
60470
60545
  * This source code is licensed under the ISC license.
60471
60546
  * See the LICENSE file in the root directory of this source tree.
60472
60547
  */
60473
- const __iconNode$D = [
60548
+ const __iconNode$I = [
60474
60549
  ["path", { d: "M12 5v14", key: "s699le" }],
60475
60550
  ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
60476
60551
  ];
60477
- const ArrowDown = createLucideIcon("arrow-down", __iconNode$D);
60552
+ const ArrowDown = createLucideIcon("arrow-down", __iconNode$I);
60478
60553
  /**
60479
60554
  * @license lucide-react v0.575.0 - ISC
60480
60555
  *
60481
60556
  * This source code is licensed under the ISC license.
60482
60557
  * See the LICENSE file in the root directory of this source tree.
60483
60558
  */
60484
- const __iconNode$C = [
60559
+ const __iconNode$H = [
60485
60560
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
60486
60561
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
60487
60562
  ];
60488
- const ArrowUp = createLucideIcon("arrow-up", __iconNode$C);
60563
+ const ArrowUp = createLucideIcon("arrow-up", __iconNode$H);
60489
60564
  /**
60490
60565
  * @license lucide-react v0.575.0 - ISC
60491
60566
  *
60492
60567
  * This source code is licensed under the ISC license.
60493
60568
  * See the LICENSE file in the root directory of this source tree.
60494
60569
  */
60495
- const __iconNode$B = [
60570
+ const __iconNode$G = [
60496
60571
  ["path", { d: "M12 7v14", key: "1akyts" }],
60497
60572
  [
60498
60573
  "path",
@@ -60502,14 +60577,14 @@ const __iconNode$B = [
60502
60577
  }
60503
60578
  ]
60504
60579
  ];
60505
- const BookOpen = createLucideIcon("book-open", __iconNode$B);
60580
+ const BookOpen = createLucideIcon("book-open", __iconNode$G);
60506
60581
  /**
60507
60582
  * @license lucide-react v0.575.0 - ISC
60508
60583
  *
60509
60584
  * This source code is licensed under the ISC license.
60510
60585
  * See the LICENSE file in the root directory of this source tree.
60511
60586
  */
60512
- const __iconNode$A = [
60587
+ const __iconNode$F = [
60513
60588
  ["path", { d: "M12 18V5", key: "adv99a" }],
60514
60589
  ["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
60515
60590
  ["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
@@ -60519,148 +60594,148 @@ const __iconNode$A = [
60519
60594
  ["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
60520
60595
  ["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
60521
60596
  ];
60522
- const Brain = createLucideIcon("brain", __iconNode$A);
60597
+ const Brain = createLucideIcon("brain", __iconNode$F);
60523
60598
  /**
60524
60599
  * @license lucide-react v0.575.0 - ISC
60525
60600
  *
60526
60601
  * This source code is licensed under the ISC license.
60527
60602
  * See the LICENSE file in the root directory of this source tree.
60528
60603
  */
60529
- const __iconNode$z = [
60604
+ const __iconNode$E = [
60530
60605
  ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
60531
60606
  ["path", { d: "M18 17V9", key: "2bz60n" }],
60532
60607
  ["path", { d: "M13 17V5", key: "1frdt8" }],
60533
60608
  ["path", { d: "M8 17v-3", key: "17ska0" }]
60534
60609
  ];
60535
- const ChartColumn = createLucideIcon("chart-column", __iconNode$z);
60610
+ const ChartColumn = createLucideIcon("chart-column", __iconNode$E);
60536
60611
  /**
60537
60612
  * @license lucide-react v0.575.0 - ISC
60538
60613
  *
60539
60614
  * This source code is licensed under the ISC license.
60540
60615
  * See the LICENSE file in the root directory of this source tree.
60541
60616
  */
60542
- const __iconNode$y = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
60543
- const Check = createLucideIcon("check", __iconNode$y);
60617
+ const __iconNode$D = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
60618
+ const Check = createLucideIcon("check", __iconNode$D);
60544
60619
  /**
60545
60620
  * @license lucide-react v0.575.0 - ISC
60546
60621
  *
60547
60622
  * This source code is licensed under the ISC license.
60548
60623
  * See the LICENSE file in the root directory of this source tree.
60549
60624
  */
60550
- const __iconNode$x = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
60551
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$x);
60625
+ const __iconNode$C = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
60626
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$C);
60552
60627
  /**
60553
60628
  * @license lucide-react v0.575.0 - ISC
60554
60629
  *
60555
60630
  * This source code is licensed under the ISC license.
60556
60631
  * See the LICENSE file in the root directory of this source tree.
60557
60632
  */
60558
- const __iconNode$w = [
60633
+ const __iconNode$B = [
60559
60634
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
60560
60635
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
60561
60636
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
60562
60637
  ];
60563
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$w);
60638
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$B);
60564
60639
  /**
60565
60640
  * @license lucide-react v0.575.0 - ISC
60566
60641
  *
60567
60642
  * This source code is licensed under the ISC license.
60568
60643
  * See the LICENSE file in the root directory of this source tree.
60569
60644
  */
60570
- const __iconNode$v = [
60645
+ const __iconNode$A = [
60571
60646
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
60572
60647
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
60573
60648
  ];
60574
- const CircleCheck = createLucideIcon("circle-check", __iconNode$v);
60649
+ const CircleCheck = createLucideIcon("circle-check", __iconNode$A);
60575
60650
  /**
60576
60651
  * @license lucide-react v0.575.0 - ISC
60577
60652
  *
60578
60653
  * This source code is licensed under the ISC license.
60579
60654
  * See the LICENSE file in the root directory of this source tree.
60580
60655
  */
60581
- const __iconNode$u = [
60656
+ const __iconNode$z = [
60582
60657
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
60583
60658
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
60584
60659
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
60585
60660
  ];
60586
- const CircleX = createLucideIcon("circle-x", __iconNode$u);
60661
+ const CircleX = createLucideIcon("circle-x", __iconNode$z);
60587
60662
  /**
60588
60663
  * @license lucide-react v0.575.0 - ISC
60589
60664
  *
60590
60665
  * This source code is licensed under the ISC license.
60591
60666
  * See the LICENSE file in the root directory of this source tree.
60592
60667
  */
60593
- const __iconNode$t = [
60668
+ const __iconNode$y = [
60594
60669
  ["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
60595
60670
  ["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
60596
60671
  ];
60597
- const Code = createLucideIcon("code", __iconNode$t);
60672
+ const Code = createLucideIcon("code", __iconNode$y);
60598
60673
  /**
60599
60674
  * @license lucide-react v0.575.0 - ISC
60600
60675
  *
60601
60676
  * This source code is licensed under the ISC license.
60602
60677
  * See the LICENSE file in the root directory of this source tree.
60603
60678
  */
60604
- const __iconNode$s = [
60679
+ const __iconNode$x = [
60605
60680
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
60606
60681
  ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
60607
60682
  ];
60608
- const Copy = createLucideIcon("copy", __iconNode$s);
60683
+ const Copy = createLucideIcon("copy", __iconNode$x);
60609
60684
  /**
60610
60685
  * @license lucide-react v0.575.0 - ISC
60611
60686
  *
60612
60687
  * This source code is licensed under the ISC license.
60613
60688
  * See the LICENSE file in the root directory of this source tree.
60614
60689
  */
60615
- const __iconNode$r = [
60690
+ const __iconNode$w = [
60616
60691
  ["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
60617
60692
  ["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
60618
60693
  ["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
60619
60694
  ];
60620
- const Database = createLucideIcon("database", __iconNode$r);
60695
+ const Database = createLucideIcon("database", __iconNode$w);
60621
60696
  /**
60622
60697
  * @license lucide-react v0.575.0 - ISC
60623
60698
  *
60624
60699
  * This source code is licensed under the ISC license.
60625
60700
  * See the LICENSE file in the root directory of this source tree.
60626
60701
  */
60627
- const __iconNode$q = [
60702
+ const __iconNode$v = [
60628
60703
  ["path", { d: "M12 15V3", key: "m9g1x1" }],
60629
60704
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
60630
60705
  ["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
60631
60706
  ];
60632
- const Download = createLucideIcon("download", __iconNode$q);
60707
+ const Download = createLucideIcon("download", __iconNode$v);
60633
60708
  /**
60634
60709
  * @license lucide-react v0.575.0 - ISC
60635
60710
  *
60636
60711
  * This source code is licensed under the ISC license.
60637
60712
  * See the LICENSE file in the root directory of this source tree.
60638
60713
  */
60639
- const __iconNode$p = [
60714
+ const __iconNode$u = [
60640
60715
  ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
60641
60716
  ["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
60642
60717
  ["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
60643
60718
  ];
60644
- const Ellipsis = createLucideIcon("ellipsis", __iconNode$p);
60719
+ const Ellipsis = createLucideIcon("ellipsis", __iconNode$u);
60645
60720
  /**
60646
60721
  * @license lucide-react v0.575.0 - ISC
60647
60722
  *
60648
60723
  * This source code is licensed under the ISC license.
60649
60724
  * See the LICENSE file in the root directory of this source tree.
60650
60725
  */
60651
- const __iconNode$o = [
60726
+ const __iconNode$t = [
60652
60727
  ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
60653
60728
  ["path", { d: "M10 14 21 3", key: "gplh6r" }],
60654
60729
  ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
60655
60730
  ];
60656
- const ExternalLink = createLucideIcon("external-link", __iconNode$o);
60731
+ const ExternalLink = createLucideIcon("external-link", __iconNode$t);
60657
60732
  /**
60658
60733
  * @license lucide-react v0.575.0 - ISC
60659
60734
  *
60660
60735
  * This source code is licensed under the ISC license.
60661
60736
  * See the LICENSE file in the root directory of this source tree.
60662
60737
  */
60663
- const __iconNode$n = [
60738
+ const __iconNode$s = [
60664
60739
  [
60665
60740
  "path",
60666
60741
  {
@@ -60672,14 +60747,14 @@ const __iconNode$n = [
60672
60747
  ["path", { d: "M9 15h6", key: "cctwl0" }],
60673
60748
  ["path", { d: "M12 18v-6", key: "17g6i2" }]
60674
60749
  ];
60675
- const FilePlus = createLucideIcon("file-plus", __iconNode$n);
60750
+ const FilePlus = createLucideIcon("file-plus", __iconNode$s);
60676
60751
  /**
60677
60752
  * @license lucide-react v0.575.0 - ISC
60678
60753
  *
60679
60754
  * This source code is licensed under the ISC license.
60680
60755
  * See the LICENSE file in the root directory of this source tree.
60681
60756
  */
60682
- const __iconNode$m = [
60757
+ const __iconNode$r = [
60683
60758
  [
60684
60759
  "path",
60685
60760
  {
@@ -60693,14 +60768,14 @@ const __iconNode$m = [
60693
60768
  ["path", { d: "M8 17h2", key: "2yhykz" }],
60694
60769
  ["path", { d: "M14 17h2", key: "10kma7" }]
60695
60770
  ];
60696
- const FileSpreadsheet = createLucideIcon("file-spreadsheet", __iconNode$m);
60771
+ const FileSpreadsheet = createLucideIcon("file-spreadsheet", __iconNode$r);
60697
60772
  /**
60698
60773
  * @license lucide-react v0.575.0 - ISC
60699
60774
  *
60700
60775
  * This source code is licensed under the ISC license.
60701
60776
  * See the LICENSE file in the root directory of this source tree.
60702
60777
  */
60703
- const __iconNode$l = [
60778
+ const __iconNode$q = [
60704
60779
  [
60705
60780
  "path",
60706
60781
  {
@@ -60713,14 +60788,14 @@ const __iconNode$l = [
60713
60788
  ["path", { d: "M16 13H8", key: "t4e002" }],
60714
60789
  ["path", { d: "M16 17H8", key: "z1uh3a" }]
60715
60790
  ];
60716
- const FileText = createLucideIcon("file-text", __iconNode$l);
60791
+ const FileText = createLucideIcon("file-text", __iconNode$q);
60717
60792
  /**
60718
60793
  * @license lucide-react v0.575.0 - ISC
60719
60794
  *
60720
60795
  * This source code is licensed under the ISC license.
60721
60796
  * See the LICENSE file in the root directory of this source tree.
60722
60797
  */
60723
- const __iconNode$k = [
60798
+ const __iconNode$p = [
60724
60799
  [
60725
60800
  "path",
60726
60801
  {
@@ -60730,26 +60805,54 @@ const __iconNode$k = [
60730
60805
  ],
60731
60806
  ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
60732
60807
  ];
60733
- const File$1 = createLucideIcon("file", __iconNode$k);
60808
+ const File$1 = createLucideIcon("file", __iconNode$p);
60734
60809
  /**
60735
60810
  * @license lucide-react v0.575.0 - ISC
60736
60811
  *
60737
60812
  * This source code is licensed under the ISC license.
60738
60813
  * See the LICENSE file in the root directory of this source tree.
60739
60814
  */
60740
- const __iconNode$j = [
60815
+ const __iconNode$o = [
60816
+ [
60817
+ "path",
60818
+ {
60819
+ d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
60820
+ key: "usdka0"
60821
+ }
60822
+ ]
60823
+ ];
60824
+ const FolderOpen = createLucideIcon("folder-open", __iconNode$o);
60825
+ /**
60826
+ * @license lucide-react v0.575.0 - ISC
60827
+ *
60828
+ * This source code is licensed under the ISC license.
60829
+ * See the LICENSE file in the root directory of this source tree.
60830
+ */
60831
+ const __iconNode$n = [
60741
60832
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
60742
60833
  ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
60743
60834
  ["path", { d: "M2 12h20", key: "9i4pu4" }]
60744
60835
  ];
60745
- const Globe = createLucideIcon("globe", __iconNode$j);
60836
+ const Globe = createLucideIcon("globe", __iconNode$n);
60746
60837
  /**
60747
60838
  * @license lucide-react v0.575.0 - ISC
60748
60839
  *
60749
60840
  * This source code is licensed under the ISC license.
60750
60841
  * See the LICENSE file in the root directory of this source tree.
60751
60842
  */
60752
- const __iconNode$i = [
60843
+ const __iconNode$m = [
60844
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
60845
+ ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
60846
+ ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
60847
+ ];
60848
+ const Image = createLucideIcon("image", __iconNode$m);
60849
+ /**
60850
+ * @license lucide-react v0.575.0 - ISC
60851
+ *
60852
+ * This source code is licensed under the ISC license.
60853
+ * See the LICENSE file in the root directory of this source tree.
60854
+ */
60855
+ const __iconNode$l = [
60753
60856
  [
60754
60857
  "path",
60755
60858
  {
@@ -60772,35 +60875,46 @@ const __iconNode$i = [
60772
60875
  }
60773
60876
  ]
60774
60877
  ];
60775
- const Layers = createLucideIcon("layers", __iconNode$i);
60878
+ const Layers = createLucideIcon("layers", __iconNode$l);
60776
60879
  /**
60777
60880
  * @license lucide-react v0.575.0 - ISC
60778
60881
  *
60779
60882
  * This source code is licensed under the ISC license.
60780
60883
  * See the LICENSE file in the root directory of this source tree.
60781
60884
  */
60782
- const __iconNode$h = [
60885
+ const __iconNode$k = [
60783
60886
  ["rect", { width: "7", height: "7", x: "3", y: "3", rx: "1", key: "1g98yp" }],
60784
60887
  ["rect", { width: "7", height: "7", x: "14", y: "3", rx: "1", key: "6d4xhi" }],
60785
60888
  ["rect", { width: "7", height: "7", x: "14", y: "14", rx: "1", key: "nxv5o0" }],
60786
60889
  ["rect", { width: "7", height: "7", x: "3", y: "14", rx: "1", key: "1bb6yr" }]
60787
60890
  ];
60788
- const LayoutGrid = createLucideIcon("layout-grid", __iconNode$h);
60891
+ const LayoutGrid = createLucideIcon("layout-grid", __iconNode$k);
60789
60892
  /**
60790
60893
  * @license lucide-react v0.575.0 - ISC
60791
60894
  *
60792
60895
  * This source code is licensed under the ISC license.
60793
60896
  * See the LICENSE file in the root directory of this source tree.
60794
60897
  */
60795
- const __iconNode$g = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
60796
- const LoaderCircle = createLucideIcon("loader-circle", __iconNode$g);
60898
+ const __iconNode$j = [
60899
+ ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
60900
+ ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
60901
+ ];
60902
+ const Link = createLucideIcon("link", __iconNode$j);
60797
60903
  /**
60798
60904
  * @license lucide-react v0.575.0 - ISC
60799
60905
  *
60800
60906
  * This source code is licensed under the ISC license.
60801
60907
  * See the LICENSE file in the root directory of this source tree.
60802
60908
  */
60803
- const __iconNode$f = [
60909
+ const __iconNode$i = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
60910
+ const LoaderCircle = createLucideIcon("loader-circle", __iconNode$i);
60911
+ /**
60912
+ * @license lucide-react v0.575.0 - ISC
60913
+ *
60914
+ * This source code is licensed under the ISC license.
60915
+ * See the LICENSE file in the root directory of this source tree.
60916
+ */
60917
+ const __iconNode$h = [
60804
60918
  ["path", { d: "M12 2v4", key: "3427ic" }],
60805
60919
  ["path", { d: "m16.2 7.8 2.9-2.9", key: "r700ao" }],
60806
60920
  ["path", { d: "M18 12h4", key: "wj9ykh" }],
@@ -60810,38 +60924,38 @@ const __iconNode$f = [
60810
60924
  ["path", { d: "M2 12h4", key: "j09sii" }],
60811
60925
  ["path", { d: "m4.9 4.9 2.9 2.9", key: "giyufr" }]
60812
60926
  ];
60813
- const Loader = createLucideIcon("loader", __iconNode$f);
60927
+ const Loader = createLucideIcon("loader", __iconNode$h);
60814
60928
  /**
60815
60929
  * @license lucide-react v0.575.0 - ISC
60816
60930
  *
60817
60931
  * This source code is licensed under the ISC license.
60818
60932
  * See the LICENSE file in the root directory of this source tree.
60819
60933
  */
60820
- const __iconNode$e = [
60934
+ const __iconNode$g = [
60821
60935
  ["path", { d: "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7", key: "132q7q" }],
60822
60936
  ["rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", key: "izxlao" }]
60823
60937
  ];
60824
- const Mail = createLucideIcon("mail", __iconNode$e);
60938
+ const Mail = createLucideIcon("mail", __iconNode$g);
60825
60939
  /**
60826
60940
  * @license lucide-react v0.575.0 - ISC
60827
60941
  *
60828
60942
  * This source code is licensed under the ISC license.
60829
60943
  * See the LICENSE file in the root directory of this source tree.
60830
60944
  */
60831
- const __iconNode$d = [
60945
+ const __iconNode$f = [
60832
60946
  ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
60833
60947
  ["path", { d: "m21 3-7 7", key: "1l2asr" }],
60834
60948
  ["path", { d: "m3 21 7-7", key: "tjx5ai" }],
60835
60949
  ["path", { d: "M9 21H3v-6", key: "wtvkvv" }]
60836
60950
  ];
60837
- const Maximize2 = createLucideIcon("maximize-2", __iconNode$d);
60951
+ const Maximize2 = createLucideIcon("maximize-2", __iconNode$f);
60838
60952
  /**
60839
60953
  * @license lucide-react v0.575.0 - ISC
60840
60954
  *
60841
60955
  * This source code is licensed under the ISC license.
60842
60956
  * See the LICENSE file in the root directory of this source tree.
60843
60957
  */
60844
- const __iconNode$c = [
60958
+ const __iconNode$e = [
60845
60959
  [
60846
60960
  "path",
60847
60961
  {
@@ -60850,39 +60964,39 @@ const __iconNode$c = [
60850
60964
  }
60851
60965
  ]
60852
60966
  ];
60853
- const MessageSquare = createLucideIcon("message-square", __iconNode$c);
60967
+ const MessageSquare = createLucideIcon("message-square", __iconNode$e);
60854
60968
  /**
60855
60969
  * @license lucide-react v0.575.0 - ISC
60856
60970
  *
60857
60971
  * This source code is licensed under the ISC license.
60858
60972
  * See the LICENSE file in the root directory of this source tree.
60859
60973
  */
60860
- const __iconNode$b = [
60974
+ const __iconNode$d = [
60861
60975
  ["path", { d: "m14 10 7-7", key: "oa77jy" }],
60862
60976
  ["path", { d: "M20 10h-6V4", key: "mjg0md" }],
60863
60977
  ["path", { d: "m3 21 7-7", key: "tjx5ai" }],
60864
60978
  ["path", { d: "M4 14h6v6", key: "rmj7iw" }]
60865
60979
  ];
60866
- const Minimize2 = createLucideIcon("minimize-2", __iconNode$b);
60980
+ const Minimize2 = createLucideIcon("minimize-2", __iconNode$d);
60867
60981
  /**
60868
60982
  * @license lucide-react v0.575.0 - ISC
60869
60983
  *
60870
60984
  * This source code is licensed under the ISC license.
60871
60985
  * See the LICENSE file in the root directory of this source tree.
60872
60986
  */
60873
- const __iconNode$a = [
60987
+ const __iconNode$c = [
60874
60988
  ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
60875
60989
  ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
60876
60990
  ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
60877
60991
  ];
60878
- const Monitor = createLucideIcon("monitor", __iconNode$a);
60992
+ const Monitor = createLucideIcon("monitor", __iconNode$c);
60879
60993
  /**
60880
60994
  * @license lucide-react v0.575.0 - ISC
60881
60995
  *
60882
60996
  * This source code is licensed under the ISC license.
60883
60997
  * See the LICENSE file in the root directory of this source tree.
60884
60998
  */
60885
- const __iconNode$9 = [
60999
+ const __iconNode$b = [
60886
61000
  ["path", { d: "M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4", key: "re6nr2" }],
60887
61001
  ["path", { d: "M2 6h4", key: "aawbzj" }],
60888
61002
  ["path", { d: "M2 10h4", key: "l0bgd4" }],
@@ -60896,14 +61010,14 @@ const __iconNode$9 = [
60896
61010
  }
60897
61011
  ]
60898
61012
  ];
60899
- const NotebookPen = createLucideIcon("notebook-pen", __iconNode$9);
61013
+ const NotebookPen = createLucideIcon("notebook-pen", __iconNode$b);
60900
61014
  /**
60901
61015
  * @license lucide-react v0.575.0 - ISC
60902
61016
  *
60903
61017
  * This source code is licensed under the ISC license.
60904
61018
  * See the LICENSE file in the root directory of this source tree.
60905
61019
  */
60906
- const __iconNode$8 = [
61020
+ const __iconNode$a = [
60907
61021
  ["path", { d: "M13 21h8", key: "1jsn5i" }],
60908
61022
  [
60909
61023
  "path",
@@ -60913,61 +61027,61 @@ const __iconNode$8 = [
60913
61027
  }
60914
61028
  ]
60915
61029
  ];
60916
- const PenLine = createLucideIcon("pen-line", __iconNode$8);
61030
+ const PenLine = createLucideIcon("pen-line", __iconNode$a);
60917
61031
  /**
60918
61032
  * @license lucide-react v0.575.0 - ISC
60919
61033
  *
60920
61034
  * This source code is licensed under the ISC license.
60921
61035
  * See the LICENSE file in the root directory of this source tree.
60922
61036
  */
60923
- const __iconNode$7 = [
61037
+ const __iconNode$9 = [
60924
61038
  ["path", { d: "M5 12h14", key: "1ays0h" }],
60925
61039
  ["path", { d: "M12 5v14", key: "s699le" }]
60926
61040
  ];
60927
- const Plus = createLucideIcon("plus", __iconNode$7);
61041
+ const Plus = createLucideIcon("plus", __iconNode$9);
60928
61042
  /**
60929
61043
  * @license lucide-react v0.575.0 - ISC
60930
61044
  *
60931
61045
  * This source code is licensed under the ISC license.
60932
61046
  * See the LICENSE file in the root directory of this source tree.
60933
61047
  */
60934
- const __iconNode$6 = [
61048
+ const __iconNode$8 = [
60935
61049
  ["path", { d: "M2 3h20", key: "91anmk" }],
60936
61050
  ["path", { d: "M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3", key: "2k9sn8" }],
60937
61051
  ["path", { d: "m7 21 5-5 5 5", key: "bip4we" }]
60938
61052
  ];
60939
- const Presentation = createLucideIcon("presentation", __iconNode$6);
61053
+ const Presentation = createLucideIcon("presentation", __iconNode$8);
60940
61054
  /**
60941
61055
  * @license lucide-react v0.575.0 - ISC
60942
61056
  *
60943
61057
  * This source code is licensed under the ISC license.
60944
61058
  * See the LICENSE file in the root directory of this source tree.
60945
61059
  */
60946
- const __iconNode$5 = [
61060
+ const __iconNode$7 = [
60947
61061
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
60948
61062
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
60949
61063
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
60950
61064
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
60951
61065
  ];
60952
- const RefreshCw = createLucideIcon("refresh-cw", __iconNode$5);
61066
+ const RefreshCw = createLucideIcon("refresh-cw", __iconNode$7);
60953
61067
  /**
60954
61068
  * @license lucide-react v0.575.0 - ISC
60955
61069
  *
60956
61070
  * This source code is licensed under the ISC license.
60957
61071
  * See the LICENSE file in the root directory of this source tree.
60958
61072
  */
60959
- const __iconNode$4 = [
61073
+ const __iconNode$6 = [
60960
61074
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
60961
61075
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
60962
61076
  ];
60963
- const Search = createLucideIcon("search", __iconNode$4);
61077
+ const Search = createLucideIcon("search", __iconNode$6);
60964
61078
  /**
60965
61079
  * @license lucide-react v0.575.0 - ISC
60966
61080
  *
60967
61081
  * This source code is licensed under the ISC license.
60968
61082
  * See the LICENSE file in the root directory of this source tree.
60969
61083
  */
60970
- const __iconNode$3 = [
61084
+ const __iconNode$5 = [
60971
61085
  [
60972
61086
  "path",
60973
61087
  {
@@ -60977,17 +61091,46 @@ const __iconNode$3 = [
60977
61091
  ],
60978
61092
  ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
60979
61093
  ];
60980
- const Settings = createLucideIcon("settings", __iconNode$3);
61094
+ const Settings = createLucideIcon("settings", __iconNode$5);
60981
61095
  /**
60982
61096
  * @license lucide-react v0.575.0 - ISC
60983
61097
  *
60984
61098
  * This source code is licensed under the ISC license.
60985
61099
  * See the LICENSE file in the root directory of this source tree.
60986
61100
  */
60987
- const __iconNode$2 = [
61101
+ const __iconNode$4 = [
60988
61102
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
60989
61103
  ];
60990
- const Square = createLucideIcon("square", __iconNode$2);
61104
+ const Square = createLucideIcon("square", __iconNode$4);
61105
+ /**
61106
+ * @license lucide-react v0.575.0 - ISC
61107
+ *
61108
+ * This source code is licensed under the ISC license.
61109
+ * See the LICENSE file in the root directory of this source tree.
61110
+ */
61111
+ const __iconNode$3 = [
61112
+ ["path", { d: "M12 19h8", key: "baeox8" }],
61113
+ ["path", { d: "m4 17 6-6-6-6", key: "1yngyt" }]
61114
+ ];
61115
+ const Terminal = createLucideIcon("terminal", __iconNode$3);
61116
+ /**
61117
+ * @license lucide-react v0.575.0 - ISC
61118
+ *
61119
+ * This source code is licensed under the ISC license.
61120
+ * See the LICENSE file in the root directory of this source tree.
61121
+ */
61122
+ const __iconNode$2 = [
61123
+ [
61124
+ "path",
61125
+ {
61126
+ d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
61127
+ key: "wmoenq"
61128
+ }
61129
+ ],
61130
+ ["path", { d: "M12 9v4", key: "juzpu7" }],
61131
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
61132
+ ];
61133
+ const TriangleAlert = createLucideIcon("triangle-alert", __iconNode$2);
60991
61134
  /**
60992
61135
  * @license lucide-react v0.575.0 - ISC
60993
61136
  *
@@ -61110,6 +61253,8 @@ const TOOL_META = {
61110
61253
  // Workflows
61111
61254
  create_new_aop: { displayName: "Creating workflow", icon: Brain },
61112
61255
  execute_aop: { displayName: "Running workflow", icon: Brain },
61256
+ // Drive / Assets
61257
+ open_asset_in_workspace: { displayName: "Opening asset", icon: FolderOpen },
61113
61258
  // Preferences
61114
61259
  save_preference_as_memory: { displayName: "Saving preference", icon: Settings }
61115
61260
  };
@@ -61160,6 +61305,14 @@ function extractAssetId$1(result) {
61160
61305
  }
61161
61306
  return null;
61162
61307
  }
61308
+ function extractAssetIdFromArgs(argsText) {
61309
+ if (!argsText) return null;
61310
+ const parsed = tryParseJson$2(argsText);
61311
+ if (!parsed) return null;
61312
+ const id = parsed.asset_id ?? parsed.assetId;
61313
+ if (typeof id === "string" && id.startsWith("asset_")) return id;
61314
+ return null;
61315
+ }
61163
61316
  function toolMetaToAssetType(toolName) {
61164
61317
  const lower = toolName.toLowerCase();
61165
61318
  if (lower.includes("presentation") || lower.includes("pptx") || lower.includes("slide") || lower.includes("powerpoint"))
@@ -61168,13 +61321,16 @@ function toolMetaToAssetType(toolName) {
61168
61321
  return "spreadsheet";
61169
61322
  if (lower.includes("document") || lower.includes("doc") || lower.includes("markdown"))
61170
61323
  return "document";
61324
+ if (lower.includes("notebook"))
61325
+ return "notebook";
61171
61326
  return "unknown";
61172
61327
  }
61173
61328
  const CREATE_ASSET_TOOLS = [
61174
61329
  "create_powerpoint_deck",
61175
61330
  "create_document_from_markdown",
61176
61331
  "create_new_document",
61177
- "create_new_sheet"
61332
+ "create_new_sheet",
61333
+ "create_new_notebook"
61178
61334
  ];
61179
61335
  function isAssetTool(toolName, result) {
61180
61336
  return CREATE_ASSET_TOOLS.includes(toolName.toLowerCase()) || extractAssetId$1(result) !== null;
@@ -61523,6 +61679,22 @@ function AssetToolCard({
61523
61679
  ] })
61524
61680
  ] });
61525
61681
  }
61682
+ function AssetOpenLink({ assetId, toolName }) {
61683
+ const openAsset = useAssetPanelStore((s) => s.openAsset);
61684
+ const assetType = toolMetaToAssetType(toolName);
61685
+ return /* @__PURE__ */ jsx(
61686
+ "button",
61687
+ {
61688
+ onClick: (e) => {
61689
+ e.stopPropagation();
61690
+ openAsset(assetId, { type: assetType });
61691
+ },
61692
+ className: "flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground/50 transition-colors hover:bg-muted/50 hover:text-foreground",
61693
+ title: "Open asset",
61694
+ children: /* @__PURE__ */ jsx(Link, { className: "size-3" })
61695
+ }
61696
+ );
61697
+ }
61526
61698
  const ToolFallbackImpl = ({
61527
61699
  toolName,
61528
61700
  argsText,
@@ -61541,12 +61713,19 @@ const ToolFallbackImpl = ({
61541
61713
  }
61542
61714
  );
61543
61715
  }
61716
+ const isComplete = (status == null ? void 0 : status.type) === "complete" || !status;
61717
+ const resultAssetId = extractAssetId$1(result);
61718
+ const argsAssetId = extractAssetIdFromArgs(argsText);
61719
+ const fallbackAssetId = resultAssetId ?? argsAssetId;
61544
61720
  return /* @__PURE__ */ jsxs(
61545
61721
  ToolFallbackRoot,
61546
61722
  {
61547
61723
  className: cn(isCancelled && "border-muted-foreground/30 bg-muted/30"),
61548
61724
  children: [
61549
- /* @__PURE__ */ jsx(ToolFallbackTrigger, { toolName, argsText, result, status }),
61725
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
61726
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx(ToolFallbackTrigger, { toolName, argsText, result, status }) }),
61727
+ fallbackAssetId && isComplete && !isCancelled && /* @__PURE__ */ jsx("div", { className: "shrink-0 pr-2", children: /* @__PURE__ */ jsx(AssetOpenLink, { assetId: fallbackAssetId, toolName }) })
61728
+ ] }),
61550
61729
  /* @__PURE__ */ jsxs(ToolFallbackContent, { children: [
61551
61730
  /* @__PURE__ */ jsx(ToolFallbackError, { status }),
61552
61731
  /* @__PURE__ */ jsx(
@@ -62276,6 +62455,190 @@ const CreateEmailDraftToolUI = memo(
62276
62455
  CreateEmailDraftToolUIImpl
62277
62456
  );
62278
62457
  CreateEmailDraftToolUI.displayName = "CreateEmailDraftToolUI";
62458
+ const CreateNotebookToolUIImpl = (props) => /* @__PURE__ */ jsx(
62459
+ CreateAssetToolUIImpl,
62460
+ {
62461
+ icon: BookOpen,
62462
+ assetType: "notebook",
62463
+ runningLabel: "Creating notebook...",
62464
+ doneLabel: "Created notebook",
62465
+ ...props
62466
+ }
62467
+ );
62468
+ const CreateNotebookToolUI = memo(
62469
+ CreateNotebookToolUIImpl
62470
+ );
62471
+ CreateNotebookToolUI.displayName = "CreateNotebookToolUI";
62472
+ function parsePythonResult(result) {
62473
+ const data = normalizeResult(result);
62474
+ if (!data) return { stdout: null, stderr: null, value: null, error: null, exception: null, imagePng: null, createdAssets: [] };
62475
+ const inner = typeof data.result === "object" && data.result !== null ? data.result : data;
62476
+ const stdout = inner.stdout ?? null;
62477
+ const stderr = inner.stderr ?? null;
62478
+ const value = inner.value ?? null;
62479
+ const error2 = inner.error ?? null;
62480
+ let exception = null;
62481
+ if (inner.exception && typeof inner.exception === "object") {
62482
+ const exc = inner.exception;
62483
+ exception = {
62484
+ name: exc.name ?? "Error",
62485
+ value: exc.value ?? "",
62486
+ traceback: exc.traceback ?? ""
62487
+ };
62488
+ }
62489
+ let imagePng = null;
62490
+ if (inner.data && typeof inner.data === "object") {
62491
+ imagePng = inner.data.png ?? null;
62492
+ }
62493
+ const createdAssets = Array.isArray(data.created_assets) ? data.created_assets : [];
62494
+ return { stdout, stderr, value, error: error2, exception, imagePng, createdAssets };
62495
+ }
62496
+ const RunPythonCodeToolUIImpl = ({
62497
+ toolName,
62498
+ args,
62499
+ result,
62500
+ status
62501
+ }) => {
62502
+ var _a2;
62503
+ const typedArgs = args;
62504
+ const code2 = (typedArgs == null ? void 0 : typedArgs.code) ?? "";
62505
+ const summary = (typedArgs == null ? void 0 : typedArgs.summary) ?? null;
62506
+ const lines = code2 ? code2.split("\n").length : 0;
62507
+ const isRunning = (status == null ? void 0 : status.type) === "running";
62508
+ const isComplete = (status == null ? void 0 : status.type) === "complete";
62509
+ const errorMsg = (status == null ? void 0 : status.type) === "incomplete" ? status.error : null;
62510
+ const parsed = useMemo(() => isComplete ? parsePythonResult(result) : null, [result, isComplete]);
62511
+ const openAsset = useAssetPanelStore((s) => s.openAsset);
62512
+ const hasOutput = parsed && (parsed.stdout || parsed.stderr || parsed.value);
62513
+ const hasError = parsed && (parsed.error || parsed.exception);
62514
+ const hasImage = parsed == null ? void 0 : parsed.imagePng;
62515
+ return /* @__PURE__ */ jsxs(
62516
+ ToolCard,
62517
+ {
62518
+ icon: Code,
62519
+ status: (status == null ? void 0 : status.type) ?? "complete",
62520
+ title: isRunning ? "Running code..." : summary || `Executed ${lines} ${lines !== 1 ? "lines" : "line"}`,
62521
+ toolName,
62522
+ error: errorMsg,
62523
+ children: [
62524
+ code2 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap break-words text-[11px] leading-relaxed font-mono text-foreground/80", children: code2 }) }),
62525
+ isComplete && hasOutput && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
62526
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-1", children: [
62527
+ /* @__PURE__ */ jsx(Terminal, { className: "size-3 text-muted-foreground" }),
62528
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Output" })
62529
+ ] }),
62530
+ /* @__PURE__ */ jsx("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/30 p-2 text-[11px] leading-relaxed font-mono text-foreground/80", children: [parsed.value, parsed.stdout, parsed.stderr].filter(Boolean).join("\n") })
62531
+ ] }),
62532
+ isComplete && hasError && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 bg-red-50/50 px-4 py-2.5", children: [
62533
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-1", children: [
62534
+ /* @__PURE__ */ jsx(TriangleAlert, { className: "size-3 text-red-500" }),
62535
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-red-600", children: parsed.exception ? `${parsed.exception.name}: ${parsed.exception.value}` : "Error" })
62536
+ ] }),
62537
+ /* @__PURE__ */ jsx("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap break-words rounded-md bg-red-50 p-2 text-[11px] leading-relaxed font-mono text-red-600/80", children: ((_a2 = parsed.exception) == null ? void 0 : _a2.traceback) ?? parsed.error })
62538
+ ] }),
62539
+ isComplete && hasImage && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
62540
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-1.5", children: [
62541
+ /* @__PURE__ */ jsx(Image, { className: "size-3 text-muted-foreground" }),
62542
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Generated image" })
62543
+ ] }),
62544
+ /* @__PURE__ */ jsx(
62545
+ "img",
62546
+ {
62547
+ src: `data:image/png;base64,${parsed.imagePng}`,
62548
+ alt: "Python output",
62549
+ className: "max-w-full rounded-md border border-border/40"
62550
+ }
62551
+ )
62552
+ ] }),
62553
+ isComplete && parsed && parsed.createdAssets.length > 0 && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2", children: [
62554
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Created assets" }),
62555
+ /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-wrap gap-1.5", children: parsed.createdAssets.map((a) => /* @__PURE__ */ jsxs(
62556
+ "button",
62557
+ {
62558
+ onClick: () => openAsset(a.asset_id),
62559
+ className: "flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
62560
+ children: [
62561
+ /* @__PURE__ */ jsx(ExternalLink, { className: "size-2.5" }),
62562
+ truncate(a.asset_id, 20)
62563
+ ]
62564
+ },
62565
+ a.asset_id
62566
+ )) })
62567
+ ] })
62568
+ ]
62569
+ }
62570
+ );
62571
+ };
62572
+ const RunPythonCodeToolUI = memo(
62573
+ RunPythonCodeToolUIImpl
62574
+ );
62575
+ RunPythonCodeToolUI.displayName = "RunPythonCodeToolUI";
62576
+ const OpenAssetToolUIImpl = ({
62577
+ toolName,
62578
+ args,
62579
+ result,
62580
+ status
62581
+ }) => {
62582
+ const typedArgs = args;
62583
+ const argsAssetId = (typedArgs == null ? void 0 : typedArgs.asset_id) ?? (typedArgs == null ? void 0 : typedArgs.assetId) ?? "";
62584
+ const resultAssetId = extractAssetId(result);
62585
+ const assetId = resultAssetId ?? (argsAssetId.startsWith("asset_") ? argsAssetId : null);
62586
+ const isRunning = (status == null ? void 0 : status.type) === "running";
62587
+ const isComplete = (status == null ? void 0 : status.type) === "complete" || !status;
62588
+ const isCancelled = (status == null ? void 0 : status.type) === "incomplete" && status.reason === "cancelled";
62589
+ const errorMsg = (status == null ? void 0 : status.type) === "incomplete" ? status.error : null;
62590
+ const openAsset = useAssetPanelStore((s) => s.openAsset);
62591
+ const wasCompleteAtMount = useRef(isComplete);
62592
+ useEffect(() => {
62593
+ if (isComplete && !isCancelled && assetId && !wasCompleteAtMount.current) {
62594
+ const store = useAssetPanelStore.getState();
62595
+ if (store.markAutoOpened(assetId)) {
62596
+ store.openAsset(assetId);
62597
+ }
62598
+ }
62599
+ }, [isComplete, isCancelled, assetId]);
62600
+ return /* @__PURE__ */ jsx(
62601
+ ToolCard,
62602
+ {
62603
+ icon: FolderOpen,
62604
+ status: (status == null ? void 0 : status.type) ?? "complete",
62605
+ title: isRunning ? "Opening asset..." : "Asset opened",
62606
+ subtitle: assetId ? truncate(assetId, 30) : void 0,
62607
+ toolName,
62608
+ error: errorMsg,
62609
+ children: assetId && isComplete && !isCancelled && /* @__PURE__ */ jsx("div", { className: "border-t border-border/40 px-4 py-2", children: /* @__PURE__ */ jsxs(
62610
+ "button",
62611
+ {
62612
+ onClick: () => openAsset(assetId),
62613
+ className: "flex items-center gap-1.5 rounded-md border border-border/60 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
62614
+ children: [
62615
+ /* @__PURE__ */ jsx(ExternalLink, { className: "size-3" }),
62616
+ "Open asset"
62617
+ ]
62618
+ }
62619
+ ) })
62620
+ }
62621
+ );
62622
+ };
62623
+ const OpenAssetToolUI = memo(
62624
+ OpenAssetToolUIImpl
62625
+ );
62626
+ OpenAssetToolUI.displayName = "OpenAssetToolUI";
62627
+ function createAssetToolUI(config2) {
62628
+ const Component = (props) => /* @__PURE__ */ jsx(
62629
+ CreateAssetToolUIImpl,
62630
+ {
62631
+ icon: config2.icon,
62632
+ assetType: config2.assetType,
62633
+ runningLabel: config2.runningLabel,
62634
+ doneLabel: config2.doneLabel,
62635
+ ...props
62636
+ }
62637
+ );
62638
+ const Memoized = memo(Component);
62639
+ Memoized.displayName = `CreateAssetToolUI(${config2.assetType})`;
62640
+ return Memoized;
62641
+ }
62279
62642
  const TOOL_UI_REGISTRY = {
62280
62643
  search: WebSearchToolUI,
62281
62644
  browse: BrowseToolUI,
@@ -62286,7 +62649,10 @@ const TOOL_UI_REGISTRY = {
62286
62649
  create_new_document: CreateDocumentToolUI,
62287
62650
  create_document_from_markdown: CreateDocumentToolUI,
62288
62651
  create_new_sheet: CreateSheetToolUI,
62289
- create_powerpoint_deck: CreatePresentationToolUI
62652
+ create_powerpoint_deck: CreatePresentationToolUI,
62653
+ create_new_notebook: CreateNotebookToolUI,
62654
+ run_python_code: RunPythonCodeToolUI,
62655
+ open_asset_in_workspace: OpenAssetToolUI
62290
62656
  };
62291
62657
  const falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
62292
62658
  const cx = clsx;
@@ -62407,7 +62773,6 @@ const AthenaChat = ({
62407
62773
  toolUIs,
62408
62774
  mentionTools
62409
62775
  }) => {
62410
- const isLoadingThread = useThreadLoading();
62411
62776
  const tools = mentionTools ?? EMPTY_MENTION_TOOLS;
62412
62777
  const mergedToolUIs = useMemo(() => ({
62413
62778
  append_markdown_to_athena_document: AppendDocumentToolUI,
@@ -62419,43 +62784,40 @@ const AthenaChat = ({
62419
62784
  () => () => /* @__PURE__ */ jsx(AssistantMessage, { toolUIs: mergedToolUIs }),
62420
62785
  [mergedToolUIs]
62421
62786
  );
62422
- return /* @__PURE__ */ jsxs(
62787
+ return /* @__PURE__ */ jsx(
62423
62788
  ThreadPrimitiveRoot,
62424
62789
  {
62425
62790
  className: `aui-root aui-thread-root @container flex h-full flex-col bg-background ${className ?? ""}`,
62426
62791
  style: { ["--thread-max-width"]: maxWidth, position: "relative" },
62427
- children: [
62428
- isLoadingThread && /* @__PURE__ */ jsx(ThreadLoadingOverlay, {}),
62429
- /* @__PURE__ */ jsxs(
62430
- ThreadPrimitiveViewport,
62431
- {
62432
- turnAnchor: "top",
62433
- className: "aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",
62434
- children: [
62435
- /* @__PURE__ */ jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsx("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ jsx("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "aui-thread-welcome-message flex size-full flex-col justify-center px-4", children: [
62436
- /* @__PURE__ */ jsx("h1", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200", children: welcomeMessage }),
62437
- /* @__PURE__ */ jsx("p", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-xl delay-75 duration-200", children: welcomeSubtext })
62438
- ] }) }) }) }),
62439
- /* @__PURE__ */ jsx(
62440
- ThreadPrimitiveMessages,
62441
- {
62442
- components: {
62443
- UserMessage,
62444
- AssistantMessage: AssistantMessageComponent
62445
- }
62792
+ children: /* @__PURE__ */ jsxs(
62793
+ ThreadPrimitiveViewport,
62794
+ {
62795
+ turnAnchor: "top",
62796
+ className: "aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",
62797
+ children: [
62798
+ /* @__PURE__ */ jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsx("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ jsx("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "aui-thread-welcome-message flex size-full flex-col justify-center px-4", children: [
62799
+ /* @__PURE__ */ jsx("h1", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200", children: welcomeMessage }),
62800
+ /* @__PURE__ */ jsx("p", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-xl delay-75 duration-200", children: welcomeSubtext })
62801
+ ] }) }) }) }),
62802
+ /* @__PURE__ */ jsx(
62803
+ ThreadPrimitiveMessages,
62804
+ {
62805
+ components: {
62806
+ UserMessage,
62807
+ AssistantMessage: AssistantMessageComponent
62446
62808
  }
62447
- ),
62448
- /* @__PURE__ */ jsxs(ThreadPrimitiveViewportFooter, { className: "aui-thread-viewport-footer sticky bottom-0 mx-auto mt-auto flex w-full max-w-(--thread-max-width) flex-col gap-4 overflow-visible rounded-t-3xl bg-background pb-4 md:pb-6", children: [
62449
- /* @__PURE__ */ jsx(ThreadScrollToBottom, {}),
62450
- /* @__PURE__ */ jsxs(ComposerPrimitiveRoot, { className: "aui-composer-root relative flex w-full flex-col rounded-2xl border border-input bg-background px-1 pt-2 outline-none transition-shadow focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20", children: [
62451
- /* @__PURE__ */ jsx(TiptapComposer, { tools }),
62452
- /* @__PURE__ */ jsx(ComposerAction, {})
62453
- ] })
62809
+ }
62810
+ ),
62811
+ /* @__PURE__ */ jsxs(ThreadPrimitiveViewportFooter, { className: "aui-thread-viewport-footer sticky bottom-0 mx-auto mt-auto flex w-full max-w-(--thread-max-width) flex-col gap-4 overflow-visible rounded-t-3xl bg-background pb-4 md:pb-6", children: [
62812
+ /* @__PURE__ */ jsx(ThreadScrollToBottom, {}),
62813
+ /* @__PURE__ */ jsxs(ComposerPrimitiveRoot, { className: "aui-composer-root relative flex w-full flex-col rounded-2xl border border-input bg-background px-1 pt-2 outline-none transition-shadow focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20", children: [
62814
+ /* @__PURE__ */ jsx(TiptapComposer, { tools }),
62815
+ /* @__PURE__ */ jsx(ComposerAction, {})
62454
62816
  ] })
62455
- ]
62456
- }
62457
- )
62458
- ]
62817
+ ] })
62818
+ ]
62819
+ }
62820
+ )
62459
62821
  }
62460
62822
  );
62461
62823
  };
@@ -62571,53 +62933,6 @@ const UserMessage = () => /* @__PURE__ */ jsx(
62571
62933
  children: /* @__PURE__ */ jsx("div", { className: "aui-user-message-content wrap-break-word rounded-2xl bg-muted px-4 py-2.5 text-foreground", children: /* @__PURE__ */ jsx(MessagePrimitiveParts, { components: { Text: TiptapText } }) })
62572
62934
  }
62573
62935
  );
62574
- const ThreadLoadingOverlay = () => /* @__PURE__ */ jsxs(
62575
- "div",
62576
- {
62577
- className: "aui-thread-loading-overlay",
62578
- style: {
62579
- position: "absolute",
62580
- inset: 0,
62581
- zIndex: 50,
62582
- display: "flex",
62583
- flexDirection: "column",
62584
- alignItems: "center",
62585
- justifyContent: "center",
62586
- gap: 12,
62587
- background: "color-mix(in srgb, var(--background, #fff) 80%, transparent)",
62588
- backdropFilter: "blur(4px)",
62589
- WebkitBackdropFilter: "blur(4px)",
62590
- animation: "aui-overlay-in 0.2s ease-out"
62591
- },
62592
- children: [
62593
- /* @__PURE__ */ jsx(
62594
- "div",
62595
- {
62596
- style: {
62597
- width: 28,
62598
- height: 28,
62599
- border: "2.5px solid var(--border, #e5e5e5)",
62600
- borderTopColor: "var(--primary, #2563eb)",
62601
- borderRadius: "50%",
62602
- animation: "aui-spin 0.7s linear infinite"
62603
- }
62604
- }
62605
- ),
62606
- /* @__PURE__ */ jsx(
62607
- "span",
62608
- {
62609
- style: {
62610
- fontSize: 13,
62611
- fontWeight: 500,
62612
- color: "var(--muted-foreground, #888)"
62613
- },
62614
- children: "Loading conversation…"
62615
- }
62616
- ),
62617
- /* @__PURE__ */ jsx("style", { children: `@keyframes aui-spin { to { transform: rotate(360deg); } } @keyframes aui-overlay-in { from { opacity: 0; } to { opacity: 1; } }` })
62618
- ]
62619
- }
62620
- );
62621
62936
  const embedCache = /* @__PURE__ */ new Map();
62622
62937
  function useAssetEmbed(assetId, options = {
62623
62938
  backendUrl: ""
@@ -62688,6 +63003,7 @@ const ASSET_TYPE_CONFIG = {
62688
63003
  presentation: { icon: Presentation, label: "Presentation" },
62689
63004
  spreadsheet: { icon: FileSpreadsheet, label: "Spreadsheet" },
62690
63005
  document: { icon: FileText, label: "Document" },
63006
+ notebook: { icon: BookOpen, label: "Notebook" },
62691
63007
  unknown: { icon: File$1, label: "Asset" }
62692
63008
  };
62693
63009
  const AssetIframe = memo(
@@ -62924,66 +63240,29 @@ const AthenaLayout = ({
62924
63240
  /* @__PURE__ */ jsx("div", { className: "flex h-full flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx(AssetPanel, {}) })
62925
63241
  ] });
62926
63242
  };
62927
- function useThreadList() {
62928
- const store = useThreadListStore();
62929
- return useStore$1(store);
62930
- }
62931
- function useActiveThreadId() {
62932
- const store = useThreadListStore();
62933
- return useStore$1(store, (s) => s.activeThreadId);
62934
- }
62935
63243
  function ThreadList({ className }) {
62936
- const {
62937
- threads,
62938
- activeThreadId,
62939
- isLoading,
62940
- fetchThreads,
62941
- switchThread,
62942
- newThread,
62943
- archiveThread: archiveThread2
62944
- } = useThreadList();
62945
- useEffect(() => {
62946
- fetchThreads();
62947
- }, [fetchThreads]);
62948
- return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
62949
- /* @__PURE__ */ jsxs(
62950
- "button",
63244
+ return /* @__PURE__ */ jsxs(ThreadListPrimitiveRoot, { className: cn("flex flex-col gap-1", className), children: [
63245
+ /* @__PURE__ */ jsxs(ThreadListPrimitiveNew, { className: "flex items-center gap-2 rounded-lg border border-border/60 px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground", children: [
63246
+ /* @__PURE__ */ jsx(Plus, { className: "size-4" }),
63247
+ "New Chat"
63248
+ ] }),
63249
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5", children: /* @__PURE__ */ jsx(
63250
+ ThreadListPrimitiveItems,
62951
63251
  {
62952
- onClick: () => newThread(),
62953
- className: "flex items-center gap-2 rounded-lg border border-border/60 px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
62954
- children: [
62955
- /* @__PURE__ */ jsx(Plus, { className: "size-4" }),
62956
- "New Chat"
62957
- ]
63252
+ components: {
63253
+ ThreadListItem
63254
+ }
62958
63255
  }
62959
- ),
62960
- isLoading && threads.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-4 text-muted-foreground", children: /* @__PURE__ */ jsx(LoaderCircle, { className: "size-4 animate-spin" }) }) : threads.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-2 py-4 text-center text-xs text-muted-foreground/60", children: "No conversations yet" }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5", children: threads.map((thread) => /* @__PURE__ */ jsxs(
62961
- "div",
62962
- {
62963
- className: cn(
62964
- "group flex items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors cursor-pointer",
62965
- activeThreadId === thread.thread_id ? "bg-muted/50 text-foreground" : "text-muted-foreground hover:bg-muted/30 hover:text-foreground"
62966
- ),
62967
- onClick: () => switchThread(thread.thread_id),
62968
- children: [
62969
- /* @__PURE__ */ jsx(MessageSquare, { className: "size-3.5 shrink-0" }),
62970
- /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: thread.title || "Untitled" }),
62971
- /* @__PURE__ */ jsx(
62972
- "button",
62973
- {
62974
- onClick: (e) => {
62975
- e.stopPropagation();
62976
- archiveThread2(thread.thread_id);
62977
- },
62978
- className: "hidden size-5 items-center justify-center rounded text-muted-foreground/60 transition-colors hover:bg-muted hover:text-foreground group-hover:flex",
62979
- title: "Archive",
62980
- children: /* @__PURE__ */ jsx(Archive, { className: "size-3" })
62981
- }
62982
- )
62983
- ]
62984
- },
62985
- thread.thread_id
62986
- )) })
63256
+ ) })
63257
+ ] });
63258
+ }
63259
+ function ThreadListItem() {
63260
+ return /* @__PURE__ */ jsxs(ThreadListItemPrimitiveRoot, { className: "group", children: [
63261
+ /* @__PURE__ */ jsxs(ThreadListItemPrimitiveTrigger, { className: "flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors cursor-pointer text-muted-foreground hover:bg-muted/30 hover:text-foreground data-[active]:bg-muted/50 data-[active]:text-foreground", children: [
63262
+ /* @__PURE__ */ jsx(MessageSquare, { className: "size-3.5 shrink-0" }),
63263
+ /* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-left", children: /* @__PURE__ */ jsx(ThreadListItemPrimitiveTitle, { fallback: "Untitled" }) })
63264
+ ] }),
63265
+ /* @__PURE__ */ jsx(ThreadListItemPrimitiveArchive, { className: "hidden size-5 items-center justify-center rounded text-muted-foreground/60 transition-colors hover:bg-muted hover:text-foreground group-hover:flex", children: /* @__PURE__ */ jsx(Archive, { className: "size-3" }) })
62987
63266
  ] });
62988
63267
  }
62989
63268
  function useAppendToComposer() {
@@ -63102,11 +63381,14 @@ export {
63102
63381
  CollapsibleTrigger,
63103
63382
  CreateDocumentToolUI,
63104
63383
  CreateEmailDraftToolUI,
63384
+ CreateNotebookToolUI,
63105
63385
  CreatePresentationToolUI,
63106
63386
  CreateSheetToolUI,
63107
63387
  DEFAULT_BACKEND_URL,
63108
63388
  EmailSearchToolUI,
63389
+ OpenAssetToolUI,
63109
63390
  ReadAssetToolUI,
63391
+ RunPythonCodeToolUI,
63110
63392
  TOOL_UI_REGISTRY,
63111
63393
  ThreadList,
63112
63394
  TiptapComposer,
@@ -63128,13 +63410,12 @@ export {
63128
63410
  buttonVariants,
63129
63411
  clearAutoOpenedAssets,
63130
63412
  cn,
63131
- createThreadListStore,
63413
+ createAssetToolUI,
63132
63414
  getAssetInfo,
63133
63415
  resetAssetAutoOpen,
63134
63416
  themeToStyleVars,
63135
63417
  themes,
63136
63418
  tryParseJson$1 as tryParseJson,
63137
- useActiveThreadId,
63138
63419
  useAppendToComposer,
63139
63420
  useAssetEmbed,
63140
63421
  useAssetPanelStore,
@@ -63142,8 +63423,6 @@ export {
63142
63423
  useAthenaRuntime,
63143
63424
  useComposerAttachment,
63144
63425
  useMentionSuggestions,
63145
- useParentAuth,
63146
- useThreadList,
63147
- useThreadLoading
63426
+ useParentAuth
63148
63427
  };
63149
63428
  //# sourceMappingURL=index.js.map