@athenaintel/react 0.2.0 → 0.4.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.cjs +594 -200
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +92 -1
- package/dist/index.js +595 -201
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1378,7 +1378,7 @@ const createStoreImpl = (createState) => {
|
|
|
1378
1378
|
};
|
|
1379
1379
|
const createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
1380
1380
|
const identity = (arg) => arg;
|
|
1381
|
-
function useStore(api, selector = identity) {
|
|
1381
|
+
function useStore$1(api, selector = identity) {
|
|
1382
1382
|
const slice2 = React.useSyncExternalStore(
|
|
1383
1383
|
api.subscribe,
|
|
1384
1384
|
React.useCallback(() => selector(api.getState()), [api, selector]),
|
|
@@ -1389,7 +1389,7 @@ function useStore(api, selector = identity) {
|
|
|
1389
1389
|
}
|
|
1390
1390
|
const createImpl = (createState) => {
|
|
1391
1391
|
const api = createStore(createState);
|
|
1392
|
-
const useBoundStore = (selector) => useStore(api, selector);
|
|
1392
|
+
const useBoundStore = (selector) => useStore$1(api, selector);
|
|
1393
1393
|
Object.assign(useBoundStore, api);
|
|
1394
1394
|
return useBoundStore;
|
|
1395
1395
|
};
|
|
@@ -16435,16 +16435,37 @@ function useParentAuth() {
|
|
|
16435
16435
|
const [authToken, setAuthToken] = React.useState(null);
|
|
16436
16436
|
const readySignalSent = React.useRef(false);
|
|
16437
16437
|
React.useEffect(() => {
|
|
16438
|
+
const isInIframe = window.parent !== window;
|
|
16439
|
+
console.log("[AthenaAuth] useParentAuth mounted", {
|
|
16440
|
+
isInIframe,
|
|
16441
|
+
currentOrigin: window.location.origin,
|
|
16442
|
+
currentUrl: window.location.href
|
|
16443
|
+
});
|
|
16438
16444
|
const handler = (event) => {
|
|
16439
|
-
|
|
16445
|
+
var _a2, _b, _c;
|
|
16446
|
+
console.log("[AthenaAuth] Received PostMessage", {
|
|
16447
|
+
type: (_a2 = event.data) == null ? void 0 : _a2.type,
|
|
16448
|
+
origin: event.origin,
|
|
16449
|
+
isTrusted: isTrustedOrigin(event.origin),
|
|
16450
|
+
hasToken: !!((_b = event.data) == null ? void 0 : _b.token),
|
|
16451
|
+
tokenPrefix: typeof ((_c = event.data) == null ? void 0 : _c.token) === "string" ? event.data.token.substring(0, 20) + "..." : void 0
|
|
16452
|
+
});
|
|
16453
|
+
if (!isTrustedOrigin(event.origin)) {
|
|
16454
|
+
console.warn("[AthenaAuth] Rejected PostMessage — untrusted origin:", event.origin);
|
|
16455
|
+
return;
|
|
16456
|
+
}
|
|
16440
16457
|
if (event.data && typeof event.data === "object" && event.data.type === "athena-auth" && typeof event.data.token === "string") {
|
|
16458
|
+
console.log("[AthenaAuth] PropelAuth token received via PostMessage, length:", event.data.token.length);
|
|
16441
16459
|
setAuthToken(event.data.token);
|
|
16442
16460
|
}
|
|
16443
16461
|
};
|
|
16444
16462
|
window.addEventListener("message", handler);
|
|
16445
|
-
if (!readySignalSent.current &&
|
|
16463
|
+
if (!readySignalSent.current && isInIframe) {
|
|
16464
|
+
console.log("[AthenaAuth] Sending athena-auth-ready signal to parent");
|
|
16446
16465
|
window.parent.postMessage({ type: "athena-auth-ready" }, "*");
|
|
16447
16466
|
readySignalSent.current = true;
|
|
16467
|
+
} else if (!isInIframe) {
|
|
16468
|
+
console.log("[AthenaAuth] Not in iframe — skipping parent auth (standalone mode)");
|
|
16448
16469
|
}
|
|
16449
16470
|
return () => window.removeEventListener("message", handler);
|
|
16450
16471
|
}, []);
|
|
@@ -20749,7 +20770,11 @@ const useAthenaRuntime = (config2) => {
|
|
|
20749
20770
|
systemPrompt,
|
|
20750
20771
|
threadId: threadIdProp
|
|
20751
20772
|
} = config2;
|
|
20752
|
-
const
|
|
20773
|
+
const generatedIdRef = React.useRef(null);
|
|
20774
|
+
if (generatedIdRef.current === null) {
|
|
20775
|
+
generatedIdRef.current = crypto.randomUUID();
|
|
20776
|
+
}
|
|
20777
|
+
const threadId = threadIdProp ?? generatedIdRef.current;
|
|
20753
20778
|
const enabledTools = React.useMemo(
|
|
20754
20779
|
() => Array.from(/* @__PURE__ */ new Set([...tools, ...frontendToolIds])),
|
|
20755
20780
|
[tools, frontendToolIds]
|
|
@@ -20764,12 +20789,22 @@ const useAthenaRuntime = (config2) => {
|
|
|
20764
20789
|
initialState: { messages: [] },
|
|
20765
20790
|
converter,
|
|
20766
20791
|
api: apiUrl,
|
|
20767
|
-
headers: async () =>
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
|
|
20771
|
-
|
|
20772
|
-
|
|
20792
|
+
headers: async () => {
|
|
20793
|
+
const authHeaders = tokenRef.current ? { Authorization: `Bearer ${tokenRef.current}` } : apiKeyRef.current ? { "X-API-KEY": apiKeyRef.current } : {};
|
|
20794
|
+
console.log("[AthenaAuth] Request headers", {
|
|
20795
|
+
authMethod: tokenRef.current ? "Bearer token" : apiKeyRef.current ? "X-API-KEY" : "NONE",
|
|
20796
|
+
hasToken: !!tokenRef.current,
|
|
20797
|
+
tokenPrefix: tokenRef.current ? tokenRef.current.substring(0, 20) + "..." : void 0,
|
|
20798
|
+
apiKeyPrefix: apiKeyRef.current ? apiKeyRef.current.substring(0, 10) + "..." : void 0,
|
|
20799
|
+
apiUrl
|
|
20800
|
+
});
|
|
20801
|
+
return {
|
|
20802
|
+
// Prefer parent-injected PropelAuth token over hardcoded API key
|
|
20803
|
+
...authHeaders,
|
|
20804
|
+
"Accept-Encoding": "identity",
|
|
20805
|
+
Accept: "text/event-stream"
|
|
20806
|
+
};
|
|
20807
|
+
},
|
|
20773
20808
|
onResponse: () => {
|
|
20774
20809
|
if (process.env.NODE_ENV !== "production") {
|
|
20775
20810
|
console.log("[AthenaSDK] Stream connected");
|
|
@@ -24102,48 +24137,200 @@ function useAthenaConfig() {
|
|
|
24102
24137
|
}
|
|
24103
24138
|
return ctx;
|
|
24104
24139
|
}
|
|
24105
|
-
|
|
24140
|
+
const ThreadListContext = React.createContext(null);
|
|
24141
|
+
function useThreadListStore() {
|
|
24142
|
+
const store = React.useContext(ThreadListContext);
|
|
24143
|
+
if (!store) {
|
|
24144
|
+
throw new Error(
|
|
24145
|
+
"[AthenaSDK] useThreadList must be used within an <AthenaProvider> that has thread management enabled."
|
|
24146
|
+
);
|
|
24147
|
+
}
|
|
24148
|
+
return store;
|
|
24149
|
+
}
|
|
24150
|
+
function getAuthHeaders(auth) {
|
|
24151
|
+
if (auth.token) {
|
|
24152
|
+
return { Authorization: `Bearer ${auth.token}` };
|
|
24153
|
+
}
|
|
24154
|
+
if (auth.apiKey) {
|
|
24155
|
+
return { "X-API-KEY": auth.apiKey };
|
|
24156
|
+
}
|
|
24157
|
+
return {};
|
|
24158
|
+
}
|
|
24159
|
+
function getAgoraBaseUrl(backendUrl) {
|
|
24160
|
+
return backendUrl.replace(/\/api\/assistant-ui\/?$/, "");
|
|
24161
|
+
}
|
|
24162
|
+
async function listThreads(backendUrl, auth, opts = {}) {
|
|
24163
|
+
const base2 = getAgoraBaseUrl(backendUrl);
|
|
24164
|
+
const res = await fetch(`${base2}/api/conversation/threads/list`, {
|
|
24165
|
+
method: "POST",
|
|
24166
|
+
headers: { "Content-Type": "application/json", ...getAuthHeaders(auth) },
|
|
24167
|
+
body: JSON.stringify({ limit: opts.limit ?? 50, offset: opts.offset ?? 0 })
|
|
24168
|
+
});
|
|
24169
|
+
if (!res.ok) {
|
|
24170
|
+
throw new Error(`[AthenaSDK] Failed to list threads: ${res.status}`);
|
|
24171
|
+
}
|
|
24172
|
+
return res.json();
|
|
24173
|
+
}
|
|
24174
|
+
async function archiveThread(backendUrl, auth, threadId) {
|
|
24175
|
+
const base2 = getAgoraBaseUrl(backendUrl);
|
|
24176
|
+
const res = await fetch(`${base2}/api/conversation/threads/archive`, {
|
|
24177
|
+
method: "POST",
|
|
24178
|
+
headers: { "Content-Type": "application/json", ...getAuthHeaders(auth) },
|
|
24179
|
+
body: JSON.stringify({ thread_id: threadId })
|
|
24180
|
+
});
|
|
24181
|
+
if (!res.ok) {
|
|
24182
|
+
throw new Error(`[AthenaSDK] Failed to archive thread: ${res.status}`);
|
|
24183
|
+
}
|
|
24184
|
+
}
|
|
24185
|
+
function createThreadListStore(config2) {
|
|
24186
|
+
const auth = { apiKey: config2.apiKey, token: config2.token };
|
|
24187
|
+
return create((set2, get2) => ({
|
|
24188
|
+
threads: [],
|
|
24189
|
+
activeThreadId: null,
|
|
24190
|
+
isLoading: false,
|
|
24191
|
+
error: null,
|
|
24192
|
+
fetchThreads: async () => {
|
|
24193
|
+
set2({ isLoading: true, error: null });
|
|
24194
|
+
try {
|
|
24195
|
+
const { threads } = await listThreads(config2.backendUrl, auth);
|
|
24196
|
+
const sorted = [...threads].sort(
|
|
24197
|
+
(a, b) => new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime()
|
|
24198
|
+
);
|
|
24199
|
+
set2({ threads: sorted, isLoading: false });
|
|
24200
|
+
} catch (e) {
|
|
24201
|
+
set2({ error: e.message, isLoading: false });
|
|
24202
|
+
}
|
|
24203
|
+
},
|
|
24204
|
+
switchThread: (threadId) => {
|
|
24205
|
+
set2({ activeThreadId: threadId });
|
|
24206
|
+
},
|
|
24207
|
+
newThread: async () => {
|
|
24208
|
+
const localThreadId = `thread_${crypto.randomUUID()}`;
|
|
24209
|
+
set2({ activeThreadId: localThreadId });
|
|
24210
|
+
return localThreadId;
|
|
24211
|
+
},
|
|
24212
|
+
archiveThread: async (threadId) => {
|
|
24213
|
+
var _a2;
|
|
24214
|
+
try {
|
|
24215
|
+
await archiveThread(config2.backendUrl, auth, threadId);
|
|
24216
|
+
const { threads, activeThreadId } = get2();
|
|
24217
|
+
const remaining = threads.filter((t) => t.thread_id !== threadId);
|
|
24218
|
+
set2({
|
|
24219
|
+
threads: remaining,
|
|
24220
|
+
activeThreadId: activeThreadId === threadId ? ((_a2 = remaining[0]) == null ? void 0 : _a2.thread_id) ?? null : activeThreadId
|
|
24221
|
+
});
|
|
24222
|
+
} catch (e) {
|
|
24223
|
+
set2({ error: e.message });
|
|
24224
|
+
}
|
|
24225
|
+
}
|
|
24226
|
+
}));
|
|
24227
|
+
}
|
|
24228
|
+
function AthenaRuntimeInner({
|
|
24106
24229
|
children,
|
|
24107
|
-
apiKey,
|
|
24108
|
-
token: tokenProp,
|
|
24109
|
-
agent: agent2,
|
|
24110
|
-
model,
|
|
24111
|
-
tools = [],
|
|
24112
|
-
frontendTools = {},
|
|
24113
24230
|
apiUrl,
|
|
24114
24231
|
backendUrl,
|
|
24232
|
+
apiKey,
|
|
24233
|
+
token,
|
|
24234
|
+
model,
|
|
24235
|
+
agent: agent2,
|
|
24236
|
+
tools,
|
|
24237
|
+
frontendToolIds,
|
|
24238
|
+
frontendTools,
|
|
24115
24239
|
workbench,
|
|
24116
24240
|
knowledgeBase,
|
|
24117
24241
|
systemPrompt,
|
|
24118
24242
|
threadId
|
|
24119
24243
|
}) {
|
|
24120
|
-
const
|
|
24121
|
-
const aui = useAui({
|
|
24122
|
-
tools: Tools({ toolkit: frontendTools })
|
|
24123
|
-
});
|
|
24124
|
-
const parentAuthToken = useParentAuth();
|
|
24125
|
-
const effectiveToken = tokenProp ?? parentAuthToken;
|
|
24126
|
-
const effectiveBackendUrl = backendUrl ?? DEFAULT_BACKEND_URL;
|
|
24244
|
+
const auiTools = React.useMemo(() => Tools({ toolkit: frontendTools }), [frontendTools]);
|
|
24245
|
+
const aui = useAui({ tools: auiTools });
|
|
24127
24246
|
const runtime = useAthenaRuntime({
|
|
24128
24247
|
apiUrl,
|
|
24129
|
-
backendUrl
|
|
24248
|
+
backendUrl,
|
|
24130
24249
|
apiKey,
|
|
24131
|
-
token
|
|
24250
|
+
token,
|
|
24132
24251
|
model,
|
|
24133
24252
|
agent: agent2,
|
|
24134
24253
|
tools,
|
|
24135
|
-
frontendToolIds
|
|
24254
|
+
frontendToolIds,
|
|
24136
24255
|
workbench,
|
|
24137
24256
|
knowledgeBase,
|
|
24138
24257
|
systemPrompt,
|
|
24139
24258
|
threadId
|
|
24140
24259
|
});
|
|
24141
24260
|
const athenaConfig = React.useMemo(
|
|
24142
|
-
() => ({ backendUrl
|
|
24143
|
-
[
|
|
24261
|
+
() => ({ backendUrl, apiKey, token }),
|
|
24262
|
+
[backendUrl, apiKey, token]
|
|
24144
24263
|
);
|
|
24145
24264
|
return /* @__PURE__ */ jsxRuntime.jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsxRuntime.jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children }) }) });
|
|
24146
24265
|
}
|
|
24266
|
+
function useActiveThreadFromStore(store) {
|
|
24267
|
+
return React.useSyncExternalStore(
|
|
24268
|
+
(cb) => {
|
|
24269
|
+
if (!store) return () => {
|
|
24270
|
+
};
|
|
24271
|
+
return store.subscribe(cb);
|
|
24272
|
+
},
|
|
24273
|
+
() => (store == null ? void 0 : store.getState().activeThreadId) ?? null,
|
|
24274
|
+
() => null
|
|
24275
|
+
);
|
|
24276
|
+
}
|
|
24277
|
+
function AthenaProvider({
|
|
24278
|
+
children,
|
|
24279
|
+
apiKey,
|
|
24280
|
+
token: tokenProp,
|
|
24281
|
+
agent: agent2,
|
|
24282
|
+
model,
|
|
24283
|
+
tools = [],
|
|
24284
|
+
frontendTools = {},
|
|
24285
|
+
apiUrl,
|
|
24286
|
+
backendUrl,
|
|
24287
|
+
workbench,
|
|
24288
|
+
knowledgeBase,
|
|
24289
|
+
systemPrompt,
|
|
24290
|
+
threadId: threadIdProp,
|
|
24291
|
+
enableThreadList = false
|
|
24292
|
+
}) {
|
|
24293
|
+
const frontendToolNames = React.useMemo(() => Object.keys(frontendTools), [frontendTools]);
|
|
24294
|
+
const parentAuthToken = useParentAuth();
|
|
24295
|
+
const effectiveToken = tokenProp ?? parentAuthToken;
|
|
24296
|
+
const effectiveBackendUrl = backendUrl ?? DEFAULT_BACKEND_URL;
|
|
24297
|
+
const threadListStoreRef = React.useRef(null);
|
|
24298
|
+
if (enableThreadList && !threadListStoreRef.current) {
|
|
24299
|
+
threadListStoreRef.current = createThreadListStore({
|
|
24300
|
+
backendUrl: effectiveBackendUrl,
|
|
24301
|
+
apiKey,
|
|
24302
|
+
token: effectiveToken
|
|
24303
|
+
});
|
|
24304
|
+
}
|
|
24305
|
+
const activeThreadId = useActiveThreadFromStore(
|
|
24306
|
+
enableThreadList ? threadListStoreRef.current : null
|
|
24307
|
+
);
|
|
24308
|
+
const resolvedThreadId = threadIdProp ?? activeThreadId ?? void 0;
|
|
24309
|
+
const inner = /* @__PURE__ */ jsxRuntime.jsx(
|
|
24310
|
+
AthenaRuntimeInner,
|
|
24311
|
+
{
|
|
24312
|
+
apiUrl,
|
|
24313
|
+
backendUrl: effectiveBackendUrl,
|
|
24314
|
+
apiKey,
|
|
24315
|
+
token: effectiveToken,
|
|
24316
|
+
model,
|
|
24317
|
+
agent: agent2,
|
|
24318
|
+
tools,
|
|
24319
|
+
frontendToolIds: frontendToolNames,
|
|
24320
|
+
frontendTools,
|
|
24321
|
+
workbench,
|
|
24322
|
+
knowledgeBase,
|
|
24323
|
+
systemPrompt,
|
|
24324
|
+
threadId: resolvedThreadId,
|
|
24325
|
+
children
|
|
24326
|
+
},
|
|
24327
|
+
resolvedThreadId ?? "__new__"
|
|
24328
|
+
);
|
|
24329
|
+
if (enableThreadList && threadListStoreRef.current) {
|
|
24330
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ThreadListContext.Provider, { value: threadListStoreRef.current, children: inner });
|
|
24331
|
+
}
|
|
24332
|
+
return inner;
|
|
24333
|
+
}
|
|
24147
24334
|
function OrderedMap(content) {
|
|
24148
24335
|
this.content = content;
|
|
24149
24336
|
}
|
|
@@ -59526,6 +59713,31 @@ class Store {
|
|
|
59526
59713
|
return this.atom.subscribe(toObserver(observerOrFn));
|
|
59527
59714
|
}
|
|
59528
59715
|
}
|
|
59716
|
+
function defaultCompare(a, b) {
|
|
59717
|
+
return a === b;
|
|
59718
|
+
}
|
|
59719
|
+
function useStore(atom, selector, compare = defaultCompare) {
|
|
59720
|
+
const subscribe = React.useCallback(
|
|
59721
|
+
(handleStoreChange) => {
|
|
59722
|
+
if (!atom) {
|
|
59723
|
+
return () => {
|
|
59724
|
+
};
|
|
59725
|
+
}
|
|
59726
|
+
const { unsubscribe } = atom.subscribe(handleStoreChange);
|
|
59727
|
+
return unsubscribe;
|
|
59728
|
+
},
|
|
59729
|
+
[atom]
|
|
59730
|
+
);
|
|
59731
|
+
const boundGetSnapshot = React.useCallback(() => atom == null ? void 0 : atom.get(), [atom]);
|
|
59732
|
+
const selectedSnapshot = withSelectorExports.useSyncExternalStoreWithSelector(
|
|
59733
|
+
subscribe,
|
|
59734
|
+
boundGetSnapshot,
|
|
59735
|
+
boundGetSnapshot,
|
|
59736
|
+
selector,
|
|
59737
|
+
compare
|
|
59738
|
+
);
|
|
59739
|
+
return selectedSnapshot;
|
|
59740
|
+
}
|
|
59529
59741
|
function createScopeRegistry() {
|
|
59530
59742
|
return { entries: /* @__PURE__ */ new Map() };
|
|
59531
59743
|
}
|
|
@@ -59561,52 +59773,13 @@ function getFilteredItems(cache, scope, query) {
|
|
|
59561
59773
|
}
|
|
59562
59774
|
return results;
|
|
59563
59775
|
}
|
|
59564
|
-
function toolsToMenuItems(tools) {
|
|
59565
|
-
return tools.map((t) => ({
|
|
59566
|
-
id: t.id,
|
|
59567
|
-
name: t.name,
|
|
59568
|
-
type: t.type,
|
|
59569
|
-
fallbackIcon: t.icon ?? (t.type === "toolkit" ? "🧰" : "🔧"),
|
|
59570
|
-
description: t.description,
|
|
59571
|
-
visibleInScopes: /* @__PURE__ */ new Set(["root"])
|
|
59572
|
-
}));
|
|
59573
|
-
}
|
|
59574
|
-
function useMentionSuggestions(tools) {
|
|
59575
|
-
const store = React.useMemo(() => {
|
|
59576
|
-
const registry = createScopeRegistry();
|
|
59577
|
-
const cache = createItemCache();
|
|
59578
|
-
registerSource(registry, "root", async () => ({
|
|
59579
|
-
items: [],
|
|
59580
|
-
pagination: { hasMore: false }
|
|
59581
|
-
}));
|
|
59582
|
-
const items = toolsToMenuItems(tools);
|
|
59583
|
-
addItems(cache, items, "root");
|
|
59584
|
-
return new Store({ registry, cache });
|
|
59585
|
-
}, []);
|
|
59586
|
-
React.useEffect(() => {
|
|
59587
|
-
const { cache } = store.state;
|
|
59588
|
-
for (const item of cache.items.values()) {
|
|
59589
|
-
item.visibleInScopes.delete("root");
|
|
59590
|
-
}
|
|
59591
|
-
for (const [id, item] of cache.items) {
|
|
59592
|
-
if (item.visibleInScopes.size === 0) {
|
|
59593
|
-
cache.items.delete(id);
|
|
59594
|
-
}
|
|
59595
|
-
}
|
|
59596
|
-
const items = toolsToMenuItems(tools);
|
|
59597
|
-
addItems(cache, items, "root");
|
|
59598
|
-
}, [tools, store]);
|
|
59599
|
-
return store;
|
|
59600
|
-
}
|
|
59601
|
-
function selectItems(store, scope, query) {
|
|
59602
|
-
const { cache } = store.state;
|
|
59603
|
-
const items = getFilteredItems(cache, scope, query);
|
|
59604
|
-
return { items, isFetching: false, hasMore: false };
|
|
59605
|
-
}
|
|
59606
59776
|
const MentionSuggestionList = React.forwardRef(({ store, query, command: command2, closeMenu }, ref) => {
|
|
59607
59777
|
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
59608
59778
|
const scrollContainerRef = React.useRef(null);
|
|
59609
|
-
const { items, isFetching } =
|
|
59779
|
+
const { items, isFetching } = useStore(store, (state) => ({
|
|
59780
|
+
items: getFilteredItems(state.cache, "root", query),
|
|
59781
|
+
isFetching: false
|
|
59782
|
+
}));
|
|
59610
59783
|
React.useEffect(() => {
|
|
59611
59784
|
setSelectedIndex(0);
|
|
59612
59785
|
}, [query]);
|
|
@@ -59669,7 +59842,10 @@ const MentionSuggestionList = React.forwardRef(({ store, query, command: command
|
|
|
59669
59842
|
},
|
|
59670
59843
|
item.id
|
|
59671
59844
|
)),
|
|
59672
|
-
isFetching
|
|
59845
|
+
isFetching && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-2 py-1.5 text-sm text-muted-foreground", children: [
|
|
59846
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
59847
|
+
"Loading..."
|
|
59848
|
+
] })
|
|
59673
59849
|
] }) });
|
|
59674
59850
|
});
|
|
59675
59851
|
MentionSuggestionList.displayName = "MentionSuggestionList";
|
|
@@ -59859,6 +60035,45 @@ const MentionSuggestionsExtension = Extension.create({
|
|
|
59859
60035
|
];
|
|
59860
60036
|
}
|
|
59861
60037
|
});
|
|
60038
|
+
function toolsToMenuItems(tools) {
|
|
60039
|
+
return tools.map((t) => ({
|
|
60040
|
+
id: t.id,
|
|
60041
|
+
name: t.name,
|
|
60042
|
+
type: t.type,
|
|
60043
|
+
fallbackIcon: t.icon ?? (t.type === "toolkit" ? "🧰" : "🔧"),
|
|
60044
|
+
description: t.description,
|
|
60045
|
+
visibleInScopes: /* @__PURE__ */ new Set(["root"])
|
|
60046
|
+
}));
|
|
60047
|
+
}
|
|
60048
|
+
function useMentionSuggestions(tools) {
|
|
60049
|
+
const storeRef = React.useRef(null);
|
|
60050
|
+
if (!storeRef.current) {
|
|
60051
|
+
const registry = createScopeRegistry();
|
|
60052
|
+
const cache = createItemCache();
|
|
60053
|
+
registerSource(registry, "root", async () => ({
|
|
60054
|
+
items: [],
|
|
60055
|
+
pagination: { hasMore: false }
|
|
60056
|
+
}));
|
|
60057
|
+
const items = toolsToMenuItems(tools);
|
|
60058
|
+
addItems(cache, items, "root");
|
|
60059
|
+
storeRef.current = new Store({ registry, cache });
|
|
60060
|
+
}
|
|
60061
|
+
const store = storeRef.current;
|
|
60062
|
+
React.useEffect(() => {
|
|
60063
|
+
store.setState((prev) => {
|
|
60064
|
+
const newCache = createItemCache();
|
|
60065
|
+
for (const [id, item] of prev.cache.items) {
|
|
60066
|
+
if (item.visibleInScopes.size > 0 && !item.visibleInScopes.has("root")) {
|
|
60067
|
+
newCache.items.set(id, { ...item, visibleInScopes: new Set(item.visibleInScopes) });
|
|
60068
|
+
}
|
|
60069
|
+
}
|
|
60070
|
+
const items = toolsToMenuItems(tools);
|
|
60071
|
+
addItems(newCache, items, "root");
|
|
60072
|
+
return { ...prev, cache: newCache };
|
|
60073
|
+
});
|
|
60074
|
+
}, [tools, store]);
|
|
60075
|
+
return store;
|
|
60076
|
+
}
|
|
59862
60077
|
const TiptapComposer = ({ tools = [] }) => {
|
|
59863
60078
|
const composerRuntime = useComposerRuntime();
|
|
59864
60079
|
const editorRef = React.useRef(null);
|
|
@@ -60047,29 +60262,41 @@ const createLucideIcon = (iconName, iconNode) => {
|
|
|
60047
60262
|
* This source code is licensed under the ISC license.
|
|
60048
60263
|
* See the LICENSE file in the root directory of this source tree.
|
|
60049
60264
|
*/
|
|
60050
|
-
const __iconNode$
|
|
60265
|
+
const __iconNode$E = [
|
|
60266
|
+
["rect", { width: "20", height: "5", x: "2", y: "3", rx: "1", key: "1wp1u1" }],
|
|
60267
|
+
["path", { d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8", key: "1s80jp" }],
|
|
60268
|
+
["path", { d: "M10 12h4", key: "a56b0p" }]
|
|
60269
|
+
];
|
|
60270
|
+
const Archive = createLucideIcon("archive", __iconNode$E);
|
|
60271
|
+
/**
|
|
60272
|
+
* @license lucide-react v0.575.0 - ISC
|
|
60273
|
+
*
|
|
60274
|
+
* This source code is licensed under the ISC license.
|
|
60275
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
60276
|
+
*/
|
|
60277
|
+
const __iconNode$D = [
|
|
60051
60278
|
["path", { d: "M12 5v14", key: "s699le" }],
|
|
60052
60279
|
["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
|
|
60053
60280
|
];
|
|
60054
|
-
const ArrowDown = createLucideIcon("arrow-down", __iconNode$
|
|
60281
|
+
const ArrowDown = createLucideIcon("arrow-down", __iconNode$D);
|
|
60055
60282
|
/**
|
|
60056
60283
|
* @license lucide-react v0.575.0 - ISC
|
|
60057
60284
|
*
|
|
60058
60285
|
* This source code is licensed under the ISC license.
|
|
60059
60286
|
* See the LICENSE file in the root directory of this source tree.
|
|
60060
60287
|
*/
|
|
60061
|
-
const __iconNode$
|
|
60288
|
+
const __iconNode$C = [
|
|
60062
60289
|
["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
|
|
60063
60290
|
["path", { d: "M12 19V5", key: "x0mq9r" }]
|
|
60064
60291
|
];
|
|
60065
|
-
const ArrowUp = createLucideIcon("arrow-up", __iconNode$
|
|
60292
|
+
const ArrowUp = createLucideIcon("arrow-up", __iconNode$C);
|
|
60066
60293
|
/**
|
|
60067
60294
|
* @license lucide-react v0.575.0 - ISC
|
|
60068
60295
|
*
|
|
60069
60296
|
* This source code is licensed under the ISC license.
|
|
60070
60297
|
* See the LICENSE file in the root directory of this source tree.
|
|
60071
60298
|
*/
|
|
60072
|
-
const __iconNode$
|
|
60299
|
+
const __iconNode$B = [
|
|
60073
60300
|
["path", { d: "M12 7v14", key: "1akyts" }],
|
|
60074
60301
|
[
|
|
60075
60302
|
"path",
|
|
@@ -60079,14 +60306,14 @@ const __iconNode$z = [
|
|
|
60079
60306
|
}
|
|
60080
60307
|
]
|
|
60081
60308
|
];
|
|
60082
|
-
const BookOpen = createLucideIcon("book-open", __iconNode$
|
|
60309
|
+
const BookOpen = createLucideIcon("book-open", __iconNode$B);
|
|
60083
60310
|
/**
|
|
60084
60311
|
* @license lucide-react v0.575.0 - ISC
|
|
60085
60312
|
*
|
|
60086
60313
|
* This source code is licensed under the ISC license.
|
|
60087
60314
|
* See the LICENSE file in the root directory of this source tree.
|
|
60088
60315
|
*/
|
|
60089
|
-
const __iconNode$
|
|
60316
|
+
const __iconNode$A = [
|
|
60090
60317
|
["path", { d: "M12 18V5", key: "adv99a" }],
|
|
60091
60318
|
["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
|
|
60092
60319
|
["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
|
|
@@ -60096,148 +60323,148 @@ const __iconNode$y = [
|
|
|
60096
60323
|
["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
|
|
60097
60324
|
["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
|
|
60098
60325
|
];
|
|
60099
|
-
const Brain = createLucideIcon("brain", __iconNode$
|
|
60326
|
+
const Brain = createLucideIcon("brain", __iconNode$A);
|
|
60100
60327
|
/**
|
|
60101
60328
|
* @license lucide-react v0.575.0 - ISC
|
|
60102
60329
|
*
|
|
60103
60330
|
* This source code is licensed under the ISC license.
|
|
60104
60331
|
* See the LICENSE file in the root directory of this source tree.
|
|
60105
60332
|
*/
|
|
60106
|
-
const __iconNode$
|
|
60333
|
+
const __iconNode$z = [
|
|
60107
60334
|
["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
|
|
60108
60335
|
["path", { d: "M18 17V9", key: "2bz60n" }],
|
|
60109
60336
|
["path", { d: "M13 17V5", key: "1frdt8" }],
|
|
60110
60337
|
["path", { d: "M8 17v-3", key: "17ska0" }]
|
|
60111
60338
|
];
|
|
60112
|
-
const ChartColumn = createLucideIcon("chart-column", __iconNode$
|
|
60339
|
+
const ChartColumn = createLucideIcon("chart-column", __iconNode$z);
|
|
60113
60340
|
/**
|
|
60114
60341
|
* @license lucide-react v0.575.0 - ISC
|
|
60115
60342
|
*
|
|
60116
60343
|
* This source code is licensed under the ISC license.
|
|
60117
60344
|
* See the LICENSE file in the root directory of this source tree.
|
|
60118
60345
|
*/
|
|
60119
|
-
const __iconNode$
|
|
60120
|
-
const Check = createLucideIcon("check", __iconNode$
|
|
60346
|
+
const __iconNode$y = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
60347
|
+
const Check = createLucideIcon("check", __iconNode$y);
|
|
60121
60348
|
/**
|
|
60122
60349
|
* @license lucide-react v0.575.0 - ISC
|
|
60123
60350
|
*
|
|
60124
60351
|
* This source code is licensed under the ISC license.
|
|
60125
60352
|
* See the LICENSE file in the root directory of this source tree.
|
|
60126
60353
|
*/
|
|
60127
|
-
const __iconNode$
|
|
60128
|
-
const ChevronDown = createLucideIcon("chevron-down", __iconNode$
|
|
60354
|
+
const __iconNode$x = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
60355
|
+
const ChevronDown = createLucideIcon("chevron-down", __iconNode$x);
|
|
60129
60356
|
/**
|
|
60130
60357
|
* @license lucide-react v0.575.0 - ISC
|
|
60131
60358
|
*
|
|
60132
60359
|
* This source code is licensed under the ISC license.
|
|
60133
60360
|
* See the LICENSE file in the root directory of this source tree.
|
|
60134
60361
|
*/
|
|
60135
|
-
const __iconNode$
|
|
60362
|
+
const __iconNode$w = [
|
|
60136
60363
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
60137
60364
|
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
60138
60365
|
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
60139
60366
|
];
|
|
60140
|
-
const CircleAlert = createLucideIcon("circle-alert", __iconNode$
|
|
60367
|
+
const CircleAlert = createLucideIcon("circle-alert", __iconNode$w);
|
|
60141
60368
|
/**
|
|
60142
60369
|
* @license lucide-react v0.575.0 - ISC
|
|
60143
60370
|
*
|
|
60144
60371
|
* This source code is licensed under the ISC license.
|
|
60145
60372
|
* See the LICENSE file in the root directory of this source tree.
|
|
60146
60373
|
*/
|
|
60147
|
-
const __iconNode$
|
|
60374
|
+
const __iconNode$v = [
|
|
60148
60375
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
60149
60376
|
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
60150
60377
|
];
|
|
60151
|
-
const CircleCheck = createLucideIcon("circle-check", __iconNode$
|
|
60378
|
+
const CircleCheck = createLucideIcon("circle-check", __iconNode$v);
|
|
60152
60379
|
/**
|
|
60153
60380
|
* @license lucide-react v0.575.0 - ISC
|
|
60154
60381
|
*
|
|
60155
60382
|
* This source code is licensed under the ISC license.
|
|
60156
60383
|
* See the LICENSE file in the root directory of this source tree.
|
|
60157
60384
|
*/
|
|
60158
|
-
const __iconNode$
|
|
60385
|
+
const __iconNode$u = [
|
|
60159
60386
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
60160
60387
|
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
|
|
60161
60388
|
["path", { d: "m9 9 6 6", key: "z0biqf" }]
|
|
60162
60389
|
];
|
|
60163
|
-
const CircleX = createLucideIcon("circle-x", __iconNode$
|
|
60390
|
+
const CircleX = createLucideIcon("circle-x", __iconNode$u);
|
|
60164
60391
|
/**
|
|
60165
60392
|
* @license lucide-react v0.575.0 - ISC
|
|
60166
60393
|
*
|
|
60167
60394
|
* This source code is licensed under the ISC license.
|
|
60168
60395
|
* See the LICENSE file in the root directory of this source tree.
|
|
60169
60396
|
*/
|
|
60170
|
-
const __iconNode$
|
|
60397
|
+
const __iconNode$t = [
|
|
60171
60398
|
["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
|
|
60172
60399
|
["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
|
|
60173
60400
|
];
|
|
60174
|
-
const Code = createLucideIcon("code", __iconNode$
|
|
60401
|
+
const Code = createLucideIcon("code", __iconNode$t);
|
|
60175
60402
|
/**
|
|
60176
60403
|
* @license lucide-react v0.575.0 - ISC
|
|
60177
60404
|
*
|
|
60178
60405
|
* This source code is licensed under the ISC license.
|
|
60179
60406
|
* See the LICENSE file in the root directory of this source tree.
|
|
60180
60407
|
*/
|
|
60181
|
-
const __iconNode$
|
|
60408
|
+
const __iconNode$s = [
|
|
60182
60409
|
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
60183
60410
|
["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" }]
|
|
60184
60411
|
];
|
|
60185
|
-
const Copy = createLucideIcon("copy", __iconNode$
|
|
60412
|
+
const Copy = createLucideIcon("copy", __iconNode$s);
|
|
60186
60413
|
/**
|
|
60187
60414
|
* @license lucide-react v0.575.0 - ISC
|
|
60188
60415
|
*
|
|
60189
60416
|
* This source code is licensed under the ISC license.
|
|
60190
60417
|
* See the LICENSE file in the root directory of this source tree.
|
|
60191
60418
|
*/
|
|
60192
|
-
const __iconNode$
|
|
60419
|
+
const __iconNode$r = [
|
|
60193
60420
|
["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
|
|
60194
60421
|
["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
|
|
60195
60422
|
["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
|
|
60196
60423
|
];
|
|
60197
|
-
const Database = createLucideIcon("database", __iconNode$
|
|
60424
|
+
const Database = createLucideIcon("database", __iconNode$r);
|
|
60198
60425
|
/**
|
|
60199
60426
|
* @license lucide-react v0.575.0 - ISC
|
|
60200
60427
|
*
|
|
60201
60428
|
* This source code is licensed under the ISC license.
|
|
60202
60429
|
* See the LICENSE file in the root directory of this source tree.
|
|
60203
60430
|
*/
|
|
60204
|
-
const __iconNode$
|
|
60431
|
+
const __iconNode$q = [
|
|
60205
60432
|
["path", { d: "M12 15V3", key: "m9g1x1" }],
|
|
60206
60433
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
60207
60434
|
["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
|
|
60208
60435
|
];
|
|
60209
|
-
const Download = createLucideIcon("download", __iconNode$
|
|
60436
|
+
const Download = createLucideIcon("download", __iconNode$q);
|
|
60210
60437
|
/**
|
|
60211
60438
|
* @license lucide-react v0.575.0 - ISC
|
|
60212
60439
|
*
|
|
60213
60440
|
* This source code is licensed under the ISC license.
|
|
60214
60441
|
* See the LICENSE file in the root directory of this source tree.
|
|
60215
60442
|
*/
|
|
60216
|
-
const __iconNode$
|
|
60443
|
+
const __iconNode$p = [
|
|
60217
60444
|
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
60218
60445
|
["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
|
|
60219
60446
|
["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
|
|
60220
60447
|
];
|
|
60221
|
-
const Ellipsis = createLucideIcon("ellipsis", __iconNode$
|
|
60448
|
+
const Ellipsis = createLucideIcon("ellipsis", __iconNode$p);
|
|
60222
60449
|
/**
|
|
60223
60450
|
* @license lucide-react v0.575.0 - ISC
|
|
60224
60451
|
*
|
|
60225
60452
|
* This source code is licensed under the ISC license.
|
|
60226
60453
|
* See the LICENSE file in the root directory of this source tree.
|
|
60227
60454
|
*/
|
|
60228
|
-
const __iconNode$
|
|
60455
|
+
const __iconNode$o = [
|
|
60229
60456
|
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
60230
60457
|
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
60231
60458
|
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
60232
60459
|
];
|
|
60233
|
-
const ExternalLink = createLucideIcon("external-link", __iconNode$
|
|
60460
|
+
const ExternalLink = createLucideIcon("external-link", __iconNode$o);
|
|
60234
60461
|
/**
|
|
60235
60462
|
* @license lucide-react v0.575.0 - ISC
|
|
60236
60463
|
*
|
|
60237
60464
|
* This source code is licensed under the ISC license.
|
|
60238
60465
|
* See the LICENSE file in the root directory of this source tree.
|
|
60239
60466
|
*/
|
|
60240
|
-
const __iconNode$
|
|
60467
|
+
const __iconNode$n = [
|
|
60241
60468
|
[
|
|
60242
60469
|
"path",
|
|
60243
60470
|
{
|
|
@@ -60249,14 +60476,14 @@ const __iconNode$l = [
|
|
|
60249
60476
|
["path", { d: "M9 15h6", key: "cctwl0" }],
|
|
60250
60477
|
["path", { d: "M12 18v-6", key: "17g6i2" }]
|
|
60251
60478
|
];
|
|
60252
|
-
const FilePlus = createLucideIcon("file-plus", __iconNode$
|
|
60479
|
+
const FilePlus = createLucideIcon("file-plus", __iconNode$n);
|
|
60253
60480
|
/**
|
|
60254
60481
|
* @license lucide-react v0.575.0 - ISC
|
|
60255
60482
|
*
|
|
60256
60483
|
* This source code is licensed under the ISC license.
|
|
60257
60484
|
* See the LICENSE file in the root directory of this source tree.
|
|
60258
60485
|
*/
|
|
60259
|
-
const __iconNode$
|
|
60486
|
+
const __iconNode$m = [
|
|
60260
60487
|
[
|
|
60261
60488
|
"path",
|
|
60262
60489
|
{
|
|
@@ -60270,14 +60497,14 @@ const __iconNode$k = [
|
|
|
60270
60497
|
["path", { d: "M8 17h2", key: "2yhykz" }],
|
|
60271
60498
|
["path", { d: "M14 17h2", key: "10kma7" }]
|
|
60272
60499
|
];
|
|
60273
|
-
const FileSpreadsheet = createLucideIcon("file-spreadsheet", __iconNode$
|
|
60500
|
+
const FileSpreadsheet = createLucideIcon("file-spreadsheet", __iconNode$m);
|
|
60274
60501
|
/**
|
|
60275
60502
|
* @license lucide-react v0.575.0 - ISC
|
|
60276
60503
|
*
|
|
60277
60504
|
* This source code is licensed under the ISC license.
|
|
60278
60505
|
* See the LICENSE file in the root directory of this source tree.
|
|
60279
60506
|
*/
|
|
60280
|
-
const __iconNode$
|
|
60507
|
+
const __iconNode$l = [
|
|
60281
60508
|
[
|
|
60282
60509
|
"path",
|
|
60283
60510
|
{
|
|
@@ -60290,14 +60517,14 @@ const __iconNode$j = [
|
|
|
60290
60517
|
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
60291
60518
|
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
60292
60519
|
];
|
|
60293
|
-
const FileText = createLucideIcon("file-text", __iconNode$
|
|
60520
|
+
const FileText = createLucideIcon("file-text", __iconNode$l);
|
|
60294
60521
|
/**
|
|
60295
60522
|
* @license lucide-react v0.575.0 - ISC
|
|
60296
60523
|
*
|
|
60297
60524
|
* This source code is licensed under the ISC license.
|
|
60298
60525
|
* See the LICENSE file in the root directory of this source tree.
|
|
60299
60526
|
*/
|
|
60300
|
-
const __iconNode$
|
|
60527
|
+
const __iconNode$k = [
|
|
60301
60528
|
[
|
|
60302
60529
|
"path",
|
|
60303
60530
|
{
|
|
@@ -60307,26 +60534,26 @@ const __iconNode$i = [
|
|
|
60307
60534
|
],
|
|
60308
60535
|
["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
|
|
60309
60536
|
];
|
|
60310
|
-
const File$1 = createLucideIcon("file", __iconNode$
|
|
60537
|
+
const File$1 = createLucideIcon("file", __iconNode$k);
|
|
60311
60538
|
/**
|
|
60312
60539
|
* @license lucide-react v0.575.0 - ISC
|
|
60313
60540
|
*
|
|
60314
60541
|
* This source code is licensed under the ISC license.
|
|
60315
60542
|
* See the LICENSE file in the root directory of this source tree.
|
|
60316
60543
|
*/
|
|
60317
|
-
const __iconNode$
|
|
60544
|
+
const __iconNode$j = [
|
|
60318
60545
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
60319
60546
|
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
|
|
60320
60547
|
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
60321
60548
|
];
|
|
60322
|
-
const Globe = createLucideIcon("globe", __iconNode$
|
|
60549
|
+
const Globe = createLucideIcon("globe", __iconNode$j);
|
|
60323
60550
|
/**
|
|
60324
60551
|
* @license lucide-react v0.575.0 - ISC
|
|
60325
60552
|
*
|
|
60326
60553
|
* This source code is licensed under the ISC license.
|
|
60327
60554
|
* See the LICENSE file in the root directory of this source tree.
|
|
60328
60555
|
*/
|
|
60329
|
-
const __iconNode$
|
|
60556
|
+
const __iconNode$i = [
|
|
60330
60557
|
[
|
|
60331
60558
|
"path",
|
|
60332
60559
|
{
|
|
@@ -60349,35 +60576,35 @@ const __iconNode$g = [
|
|
|
60349
60576
|
}
|
|
60350
60577
|
]
|
|
60351
60578
|
];
|
|
60352
|
-
const Layers = createLucideIcon("layers", __iconNode$
|
|
60579
|
+
const Layers = createLucideIcon("layers", __iconNode$i);
|
|
60353
60580
|
/**
|
|
60354
60581
|
* @license lucide-react v0.575.0 - ISC
|
|
60355
60582
|
*
|
|
60356
60583
|
* This source code is licensed under the ISC license.
|
|
60357
60584
|
* See the LICENSE file in the root directory of this source tree.
|
|
60358
60585
|
*/
|
|
60359
|
-
const __iconNode$
|
|
60586
|
+
const __iconNode$h = [
|
|
60360
60587
|
["rect", { width: "7", height: "7", x: "3", y: "3", rx: "1", key: "1g98yp" }],
|
|
60361
60588
|
["rect", { width: "7", height: "7", x: "14", y: "3", rx: "1", key: "6d4xhi" }],
|
|
60362
60589
|
["rect", { width: "7", height: "7", x: "14", y: "14", rx: "1", key: "nxv5o0" }],
|
|
60363
60590
|
["rect", { width: "7", height: "7", x: "3", y: "14", rx: "1", key: "1bb6yr" }]
|
|
60364
60591
|
];
|
|
60365
|
-
const LayoutGrid = createLucideIcon("layout-grid", __iconNode$
|
|
60592
|
+
const LayoutGrid = createLucideIcon("layout-grid", __iconNode$h);
|
|
60366
60593
|
/**
|
|
60367
60594
|
* @license lucide-react v0.575.0 - ISC
|
|
60368
60595
|
*
|
|
60369
60596
|
* This source code is licensed under the ISC license.
|
|
60370
60597
|
* See the LICENSE file in the root directory of this source tree.
|
|
60371
60598
|
*/
|
|
60372
|
-
const __iconNode$
|
|
60373
|
-
const LoaderCircle = createLucideIcon("loader-circle", __iconNode$
|
|
60599
|
+
const __iconNode$g = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
|
|
60600
|
+
const LoaderCircle = createLucideIcon("loader-circle", __iconNode$g);
|
|
60374
60601
|
/**
|
|
60375
60602
|
* @license lucide-react v0.575.0 - ISC
|
|
60376
60603
|
*
|
|
60377
60604
|
* This source code is licensed under the ISC license.
|
|
60378
60605
|
* See the LICENSE file in the root directory of this source tree.
|
|
60379
60606
|
*/
|
|
60380
|
-
const __iconNode$
|
|
60607
|
+
const __iconNode$f = [
|
|
60381
60608
|
["path", { d: "M12 2v4", key: "3427ic" }],
|
|
60382
60609
|
["path", { d: "m16.2 7.8 2.9-2.9", key: "r700ao" }],
|
|
60383
60610
|
["path", { d: "M18 12h4", key: "wj9ykh" }],
|
|
@@ -60387,63 +60614,79 @@ const __iconNode$d = [
|
|
|
60387
60614
|
["path", { d: "M2 12h4", key: "j09sii" }],
|
|
60388
60615
|
["path", { d: "m4.9 4.9 2.9 2.9", key: "giyufr" }]
|
|
60389
60616
|
];
|
|
60390
|
-
const Loader = createLucideIcon("loader", __iconNode$
|
|
60617
|
+
const Loader = createLucideIcon("loader", __iconNode$f);
|
|
60391
60618
|
/**
|
|
60392
60619
|
* @license lucide-react v0.575.0 - ISC
|
|
60393
60620
|
*
|
|
60394
60621
|
* This source code is licensed under the ISC license.
|
|
60395
60622
|
* See the LICENSE file in the root directory of this source tree.
|
|
60396
60623
|
*/
|
|
60397
|
-
const __iconNode$
|
|
60624
|
+
const __iconNode$e = [
|
|
60398
60625
|
["path", { d: "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7", key: "132q7q" }],
|
|
60399
60626
|
["rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", key: "izxlao" }]
|
|
60400
60627
|
];
|
|
60401
|
-
const Mail = createLucideIcon("mail", __iconNode$
|
|
60628
|
+
const Mail = createLucideIcon("mail", __iconNode$e);
|
|
60402
60629
|
/**
|
|
60403
60630
|
* @license lucide-react v0.575.0 - ISC
|
|
60404
60631
|
*
|
|
60405
60632
|
* This source code is licensed under the ISC license.
|
|
60406
60633
|
* See the LICENSE file in the root directory of this source tree.
|
|
60407
60634
|
*/
|
|
60408
|
-
const __iconNode$
|
|
60635
|
+
const __iconNode$d = [
|
|
60409
60636
|
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
60410
60637
|
["path", { d: "m21 3-7 7", key: "1l2asr" }],
|
|
60411
60638
|
["path", { d: "m3 21 7-7", key: "tjx5ai" }],
|
|
60412
60639
|
["path", { d: "M9 21H3v-6", key: "wtvkvv" }]
|
|
60413
60640
|
];
|
|
60414
|
-
const Maximize2 = createLucideIcon("maximize-2", __iconNode$
|
|
60641
|
+
const Maximize2 = createLucideIcon("maximize-2", __iconNode$d);
|
|
60415
60642
|
/**
|
|
60416
60643
|
* @license lucide-react v0.575.0 - ISC
|
|
60417
60644
|
*
|
|
60418
60645
|
* This source code is licensed under the ISC license.
|
|
60419
60646
|
* See the LICENSE file in the root directory of this source tree.
|
|
60420
60647
|
*/
|
|
60421
|
-
const __iconNode$
|
|
60648
|
+
const __iconNode$c = [
|
|
60649
|
+
[
|
|
60650
|
+
"path",
|
|
60651
|
+
{
|
|
60652
|
+
d: "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",
|
|
60653
|
+
key: "18887p"
|
|
60654
|
+
}
|
|
60655
|
+
]
|
|
60656
|
+
];
|
|
60657
|
+
const MessageSquare = createLucideIcon("message-square", __iconNode$c);
|
|
60658
|
+
/**
|
|
60659
|
+
* @license lucide-react v0.575.0 - ISC
|
|
60660
|
+
*
|
|
60661
|
+
* This source code is licensed under the ISC license.
|
|
60662
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
60663
|
+
*/
|
|
60664
|
+
const __iconNode$b = [
|
|
60422
60665
|
["path", { d: "m14 10 7-7", key: "oa77jy" }],
|
|
60423
60666
|
["path", { d: "M20 10h-6V4", key: "mjg0md" }],
|
|
60424
60667
|
["path", { d: "m3 21 7-7", key: "tjx5ai" }],
|
|
60425
60668
|
["path", { d: "M4 14h6v6", key: "rmj7iw" }]
|
|
60426
60669
|
];
|
|
60427
|
-
const Minimize2 = createLucideIcon("minimize-2", __iconNode$
|
|
60670
|
+
const Minimize2 = createLucideIcon("minimize-2", __iconNode$b);
|
|
60428
60671
|
/**
|
|
60429
60672
|
* @license lucide-react v0.575.0 - ISC
|
|
60430
60673
|
*
|
|
60431
60674
|
* This source code is licensed under the ISC license.
|
|
60432
60675
|
* See the LICENSE file in the root directory of this source tree.
|
|
60433
60676
|
*/
|
|
60434
|
-
const __iconNode$
|
|
60677
|
+
const __iconNode$a = [
|
|
60435
60678
|
["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
|
|
60436
60679
|
["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
|
|
60437
60680
|
["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
|
|
60438
60681
|
];
|
|
60439
|
-
const Monitor = createLucideIcon("monitor", __iconNode$
|
|
60682
|
+
const Monitor = createLucideIcon("monitor", __iconNode$a);
|
|
60440
60683
|
/**
|
|
60441
60684
|
* @license lucide-react v0.575.0 - ISC
|
|
60442
60685
|
*
|
|
60443
60686
|
* This source code is licensed under the ISC license.
|
|
60444
60687
|
* See the LICENSE file in the root directory of this source tree.
|
|
60445
60688
|
*/
|
|
60446
|
-
const __iconNode$
|
|
60689
|
+
const __iconNode$9 = [
|
|
60447
60690
|
["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" }],
|
|
60448
60691
|
["path", { d: "M2 6h4", key: "aawbzj" }],
|
|
60449
60692
|
["path", { d: "M2 10h4", key: "l0bgd4" }],
|
|
@@ -60457,14 +60700,14 @@ const __iconNode$8 = [
|
|
|
60457
60700
|
}
|
|
60458
60701
|
]
|
|
60459
60702
|
];
|
|
60460
|
-
const NotebookPen = createLucideIcon("notebook-pen", __iconNode$
|
|
60703
|
+
const NotebookPen = createLucideIcon("notebook-pen", __iconNode$9);
|
|
60461
60704
|
/**
|
|
60462
60705
|
* @license lucide-react v0.575.0 - ISC
|
|
60463
60706
|
*
|
|
60464
60707
|
* This source code is licensed under the ISC license.
|
|
60465
60708
|
* See the LICENSE file in the root directory of this source tree.
|
|
60466
60709
|
*/
|
|
60467
|
-
const __iconNode$
|
|
60710
|
+
const __iconNode$8 = [
|
|
60468
60711
|
["path", { d: "M13 21h8", key: "1jsn5i" }],
|
|
60469
60712
|
[
|
|
60470
60713
|
"path",
|
|
@@ -60474,7 +60717,18 @@ const __iconNode$7 = [
|
|
|
60474
60717
|
}
|
|
60475
60718
|
]
|
|
60476
60719
|
];
|
|
60477
|
-
const PenLine = createLucideIcon("pen-line", __iconNode$
|
|
60720
|
+
const PenLine = createLucideIcon("pen-line", __iconNode$8);
|
|
60721
|
+
/**
|
|
60722
|
+
* @license lucide-react v0.575.0 - ISC
|
|
60723
|
+
*
|
|
60724
|
+
* This source code is licensed under the ISC license.
|
|
60725
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
60726
|
+
*/
|
|
60727
|
+
const __iconNode$7 = [
|
|
60728
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
60729
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
60730
|
+
];
|
|
60731
|
+
const Plus = createLucideIcon("plus", __iconNode$7);
|
|
60478
60732
|
/**
|
|
60479
60733
|
* @license lucide-react v0.575.0 - ISC
|
|
60480
60734
|
*
|
|
@@ -60574,12 +60828,14 @@ function CollapsibleTrigger({ ...props }) {
|
|
|
60574
60828
|
function CollapsibleContent({ ...props }) {
|
|
60575
60829
|
return /* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent$1, { "data-slot": "collapsible-content", ...props });
|
|
60576
60830
|
}
|
|
60577
|
-
const useAssetPanelStore = create((set2) => ({
|
|
60831
|
+
const useAssetPanelStore = create((set2, get2) => ({
|
|
60578
60832
|
isOpen: false,
|
|
60579
60833
|
tabs: [],
|
|
60580
60834
|
activeTabId: null,
|
|
60581
60835
|
viewMode: "tabs",
|
|
60582
60836
|
isFullscreen: false,
|
|
60837
|
+
autoOpenGeneration: 0,
|
|
60838
|
+
autoOpenedAssets: /* @__PURE__ */ new Map(),
|
|
60583
60839
|
openAsset: (assetId, meta) => set2((s) => {
|
|
60584
60840
|
const existing = s.tabs.find((t) => t.id === assetId);
|
|
60585
60841
|
if (existing) {
|
|
@@ -60607,39 +60863,59 @@ const useAssetPanelStore = create((set2) => ({
|
|
|
60607
60863
|
setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
|
|
60608
60864
|
setViewMode: (mode) => set2({ viewMode: mode }),
|
|
60609
60865
|
closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
|
|
60610
|
-
toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen }))
|
|
60866
|
+
toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
|
|
60867
|
+
resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
|
|
60868
|
+
markAutoOpened: (assetId) => {
|
|
60869
|
+
const state = get2();
|
|
60870
|
+
if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
|
|
60871
|
+
return false;
|
|
60872
|
+
}
|
|
60873
|
+
state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
|
|
60874
|
+
return true;
|
|
60875
|
+
}
|
|
60611
60876
|
}));
|
|
60612
60877
|
const ANIMATION_DURATION = 200;
|
|
60613
60878
|
const TOOL_META = {
|
|
60614
|
-
|
|
60615
|
-
|
|
60616
|
-
|
|
60617
|
-
|
|
60618
|
-
|
|
60619
|
-
|
|
60620
|
-
|
|
60621
|
-
|
|
60622
|
-
|
|
60623
|
-
|
|
60624
|
-
|
|
60625
|
-
|
|
60626
|
-
|
|
60627
|
-
|
|
60628
|
-
|
|
60629
|
-
|
|
60630
|
-
|
|
60631
|
-
|
|
60632
|
-
|
|
60633
|
-
|
|
60634
|
-
|
|
60635
|
-
|
|
60636
|
-
|
|
60637
|
-
|
|
60638
|
-
|
|
60639
|
-
|
|
60640
|
-
|
|
60641
|
-
|
|
60642
|
-
|
|
60879
|
+
// Search & Browse
|
|
60880
|
+
search: { displayName: "Searching the web", icon: Search, describer: (a) => a.query ? `"${a.query}"` : "" },
|
|
60881
|
+
browse: { displayName: "Reading webpage", icon: Globe, describer: (a) => a.url ?? "" },
|
|
60882
|
+
search_email: { displayName: "Searching emails", icon: Mail, describer: (a) => a.query ? `"${a.query}"` : "" },
|
|
60883
|
+
unified_email_search: { displayName: "Searching emails", icon: Mail, describer: (a) => a.query ? `"${a.query}"` : "" },
|
|
60884
|
+
search_contacts: { displayName: "Looking up contacts", icon: Search },
|
|
60885
|
+
search_calendar_events: { displayName: "Checking calendar", icon: Search },
|
|
60886
|
+
search_assets: { displayName: "Searching files", icon: Search },
|
|
60887
|
+
list_contents: { displayName: "Browsing files", icon: Search },
|
|
60888
|
+
// Email
|
|
60889
|
+
create_email_draft: { displayName: "Drafting email", icon: Mail },
|
|
60890
|
+
unified_email_create_draft: { displayName: "Drafting email", icon: Mail },
|
|
60891
|
+
edit_email_draft: { displayName: "Editing email draft", icon: Mail },
|
|
60892
|
+
unified_edit_email_draft: { displayName: "Editing email draft", icon: Mail },
|
|
60893
|
+
// Documents
|
|
60894
|
+
read_full_asset: { displayName: "Reading document", icon: BookOpen },
|
|
60895
|
+
create_new_document: { displayName: "Creating document", icon: FileText },
|
|
60896
|
+
create_document_from_markdown: { displayName: "Creating document", icon: FileText },
|
|
60897
|
+
append_markdown_to_athena_document: { displayName: "Updating document", icon: PenLine },
|
|
60898
|
+
replace_markdown_in_athena_document: { displayName: "Updating document", icon: PenLine },
|
|
60899
|
+
// Spreadsheets
|
|
60900
|
+
create_new_sheet: { displayName: "Creating spreadsheet", icon: ChartColumn },
|
|
60901
|
+
update_sheet_range: { displayName: "Updating spreadsheet", icon: ChartColumn },
|
|
60902
|
+
// Presentations
|
|
60903
|
+
create_powerpoint_deck: { displayName: "Building presentation", icon: Monitor },
|
|
60904
|
+
execute_presentation_code: { displayName: "Generating slides", icon: Monitor },
|
|
60905
|
+
// Code & Data
|
|
60906
|
+
run_python_code: { displayName: "Running analysis", icon: Code },
|
|
60907
|
+
run_sql_query_tool: { displayName: "Querying data", icon: Database },
|
|
60908
|
+
create_database: { displayName: "Setting up database", icon: Database },
|
|
60909
|
+
run_database_sql: { displayName: "Querying database", icon: Database },
|
|
60910
|
+
computer_asset_exec: { displayName: "Running command", icon: Monitor },
|
|
60911
|
+
// Notebooks
|
|
60912
|
+
create_new_notebook: { displayName: "Creating notebook", icon: BookOpen },
|
|
60913
|
+
execute_cell: { displayName: "Running notebook cell", icon: Code },
|
|
60914
|
+
// Workflows
|
|
60915
|
+
create_new_aop: { displayName: "Creating workflow", icon: Brain },
|
|
60916
|
+
execute_aop: { displayName: "Running workflow", icon: Brain },
|
|
60917
|
+
// Preferences
|
|
60918
|
+
save_preference_as_memory: { displayName: "Saving preference", icon: Settings }
|
|
60643
60919
|
};
|
|
60644
60920
|
function getToolMeta(toolName) {
|
|
60645
60921
|
if (TOOL_META[toolName]) return TOOL_META[toolName];
|
|
@@ -60726,10 +61002,8 @@ function extractTitle(argsText, result) {
|
|
|
60726
61002
|
}
|
|
60727
61003
|
return null;
|
|
60728
61004
|
}
|
|
60729
|
-
let assetGeneration$1 = 0;
|
|
60730
|
-
const autoOpenedAssets$1 = /* @__PURE__ */ new Map();
|
|
60731
61005
|
function clearAutoOpenedAssets() {
|
|
60732
|
-
|
|
61006
|
+
useAssetPanelStore.getState().resetAutoOpen();
|
|
60733
61007
|
}
|
|
60734
61008
|
function ToolFallbackRoot({
|
|
60735
61009
|
className,
|
|
@@ -60764,7 +61038,7 @@ function ToolFallbackRoot({
|
|
|
60764
61038
|
open: isOpen,
|
|
60765
61039
|
onOpenChange: handleOpenChange,
|
|
60766
61040
|
className: cn(
|
|
60767
|
-
"aui-tool-fallback-root group/tool-fallback-root w-full rounded-xl border border-border/60 bg-background py-2.5 shadow-sm",
|
|
61041
|
+
"aui-tool-fallback-root group/tool-fallback-root my-3 w-full rounded-xl border border-border/60 bg-background py-2.5 shadow-sm",
|
|
60768
61042
|
className
|
|
60769
61043
|
),
|
|
60770
61044
|
style: {
|
|
@@ -60835,16 +61109,16 @@ function ToolFallbackTrigger({
|
|
|
60835
61109
|
),
|
|
60836
61110
|
children: [
|
|
60837
61111
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: isRunning ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
60838
|
-
|
|
61112
|
+
meta.displayName,
|
|
60839
61113
|
"..."
|
|
60840
|
-
] }) :
|
|
61114
|
+
] }) : meta.displayName }),
|
|
60841
61115
|
isRunning && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
60842
61116
|
"span",
|
|
60843
61117
|
{
|
|
60844
61118
|
"aria-hidden": true,
|
|
60845
61119
|
className: "shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none",
|
|
60846
61120
|
children: [
|
|
60847
|
-
|
|
61121
|
+
meta.displayName,
|
|
60848
61122
|
"..."
|
|
60849
61123
|
]
|
|
60850
61124
|
}
|
|
@@ -60978,17 +61252,19 @@ function AssetToolCard({
|
|
|
60978
61252
|
const assetType = toolMetaToAssetType(toolName);
|
|
60979
61253
|
const wasCompleteAtMount = React.useRef(isComplete);
|
|
60980
61254
|
React.useEffect(() => {
|
|
60981
|
-
if (isComplete && !isCancelled && assetId && !wasCompleteAtMount.current
|
|
60982
|
-
|
|
60983
|
-
|
|
60984
|
-
|
|
60985
|
-
|
|
60986
|
-
|
|
61255
|
+
if (isComplete && !isCancelled && assetId && !wasCompleteAtMount.current) {
|
|
61256
|
+
const store = useAssetPanelStore.getState();
|
|
61257
|
+
if (store.markAutoOpened(assetId)) {
|
|
61258
|
+
store.openAsset(assetId, {
|
|
61259
|
+
name: title ?? void 0,
|
|
61260
|
+
type: assetType
|
|
61261
|
+
});
|
|
61262
|
+
}
|
|
60987
61263
|
}
|
|
60988
61264
|
}, [isComplete, isCancelled, assetId, title, assetType]);
|
|
60989
61265
|
const success = isComplete && isResultSuccess(result);
|
|
60990
61266
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
|
|
60991
|
-
"aui-tool-fallback-root w-full rounded-xl border border-border/60 bg-background py-2.5 shadow-sm",
|
|
61267
|
+
"aui-tool-fallback-root my-3 w-full rounded-xl border border-border/60 bg-background py-2.5 shadow-sm",
|
|
60992
61268
|
isCancelled && "border-muted-foreground/30 bg-muted/30"
|
|
60993
61269
|
), children: [
|
|
60994
61270
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5 px-3 text-sm", children: [
|
|
@@ -61005,13 +61281,13 @@ function AssetToolCard({
|
|
|
61005
61281
|
}
|
|
61006
61282
|
),
|
|
61007
61283
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 grow flex-col items-start gap-0.5 text-left", children: [
|
|
61008
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "leading-tight", children: [
|
|
61009
|
-
|
|
61284
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "leading-tight font-medium", children: [
|
|
61285
|
+
meta.displayName,
|
|
61010
61286
|
isRunning && "..."
|
|
61011
61287
|
] }),
|
|
61012
61288
|
!isRunning && title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-w-full truncate text-xs leading-snug text-muted-foreground", children: title })
|
|
61013
61289
|
] }),
|
|
61014
|
-
assetId && isComplete && !isCancelled && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
61290
|
+
assetId && isComplete && !isCancelled && CREATE_ASSET_TOOLS.includes(toolName.toLowerCase()) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
61015
61291
|
"button",
|
|
61016
61292
|
{
|
|
61017
61293
|
onClick: () => openAsset(assetId, { name: title ?? void 0, type: assetType }),
|
|
@@ -61433,11 +61709,15 @@ function normalizeResult(result) {
|
|
|
61433
61709
|
function truncate(text2, max2) {
|
|
61434
61710
|
return text2.length > max2 ? `${text2.slice(0, max2)}...` : text2;
|
|
61435
61711
|
}
|
|
61712
|
+
function formatToolName(name) {
|
|
61713
|
+
return name.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
61714
|
+
}
|
|
61436
61715
|
function ToolCard({
|
|
61437
61716
|
icon: Icon2,
|
|
61438
61717
|
status,
|
|
61439
61718
|
title,
|
|
61440
61719
|
subtitle,
|
|
61720
|
+
toolName,
|
|
61441
61721
|
badge,
|
|
61442
61722
|
error: error2,
|
|
61443
61723
|
children
|
|
@@ -61445,7 +61725,7 @@ function ToolCard({
|
|
|
61445
61725
|
const isRunning = status === "running";
|
|
61446
61726
|
const isComplete = status === "complete";
|
|
61447
61727
|
const isError = status === "incomplete";
|
|
61448
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-
|
|
61728
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-3 w-full overflow-hidden rounded-xl border border-border/60 bg-background shadow-sm", children: [
|
|
61449
61729
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 px-4 py-3", children: [
|
|
61450
61730
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
61451
61731
|
"div",
|
|
@@ -61461,11 +61741,12 @@ function ToolCard({
|
|
|
61461
61741
|
),
|
|
61462
61742
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
61463
61743
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
61464
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-
|
|
61744
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-medium text-foreground", children: title }),
|
|
61465
61745
|
isComplete && !error2 && /* @__PURE__ */ jsxRuntime.jsx(CircleCheck, { className: "size-3.5 text-emerald-500" })
|
|
61466
61746
|
] }),
|
|
61467
61747
|
subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-[12px] text-muted-foreground", children: subtitle })
|
|
61468
61748
|
] }),
|
|
61749
|
+
toolName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 rounded-md bg-muted/60 px-1.5 py-0.5 text-[10px] font-mono text-muted-foreground", children: formatToolName(toolName) }),
|
|
61469
61750
|
badge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground", children: badge }),
|
|
61470
61751
|
isRunning && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
61471
61752
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1.5 w-10 animate-pulse rounded-full bg-blue-100" }),
|
|
@@ -61519,6 +61800,7 @@ function parseSearchResults(data) {
|
|
|
61519
61800
|
});
|
|
61520
61801
|
}
|
|
61521
61802
|
const WebSearchToolUIImpl = ({
|
|
61803
|
+
toolName,
|
|
61522
61804
|
args,
|
|
61523
61805
|
result,
|
|
61524
61806
|
status
|
|
@@ -61537,11 +61819,12 @@ const WebSearchToolUIImpl = ({
|
|
|
61537
61819
|
status: (status == null ? void 0 : status.type) ?? "complete",
|
|
61538
61820
|
title: isRunning ? "Searching the web..." : "Web search",
|
|
61539
61821
|
subtitle: query ? truncate(query, 80) : void 0,
|
|
61822
|
+
toolName,
|
|
61540
61823
|
badge: isComplete && results.length > 0 ? `${results.length} results` : void 0,
|
|
61541
61824
|
error: errorMsg,
|
|
61542
61825
|
children: isComplete && results.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show search results", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2.5", children: results.map((r2, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
61543
61826
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
61544
|
-
r2.url ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
61827
|
+
r2.url && /^https?:\/\//i.test(r2.url) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
61545
61828
|
"a",
|
|
61546
61829
|
{
|
|
61547
61830
|
href: r2.url,
|
|
@@ -61550,7 +61833,7 @@ const WebSearchToolUIImpl = ({
|
|
|
61550
61833
|
className: "text-[12px] font-medium text-blue-600 hover:underline",
|
|
61551
61834
|
children: r2.title || r2.url
|
|
61552
61835
|
}
|
|
61553
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[12px] font-medium text-foreground", children: r2.title || "Result" }),
|
|
61836
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[12px] font-medium text-foreground", children: r2.title || r2.url || "Result" }),
|
|
61554
61837
|
r2.url && /* @__PURE__ */ jsxRuntime.jsx(ExternalLink, { className: "size-3 shrink-0 text-muted-foreground" })
|
|
61555
61838
|
] }),
|
|
61556
61839
|
r2.url && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children: truncate(r2.url, 60) }),
|
|
@@ -61564,6 +61847,7 @@ const WebSearchToolUI = React.memo(
|
|
|
61564
61847
|
);
|
|
61565
61848
|
WebSearchToolUI.displayName = "WebSearchToolUI";
|
|
61566
61849
|
const BrowseToolUIImpl = ({
|
|
61850
|
+
toolName,
|
|
61567
61851
|
args,
|
|
61568
61852
|
result,
|
|
61569
61853
|
status
|
|
@@ -61592,6 +61876,7 @@ const BrowseToolUIImpl = ({
|
|
|
61592
61876
|
status: (status == null ? void 0 : status.type) ?? "complete",
|
|
61593
61877
|
title: isRunning ? "Browsing page..." : pageTitle ? truncate(pageTitle, 50) : "Browsed page",
|
|
61594
61878
|
subtitle: displayUrl,
|
|
61879
|
+
toolName,
|
|
61595
61880
|
error: errorMsg,
|
|
61596
61881
|
children: isComplete && pageContent && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show page content", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap break-words text-[11px] leading-relaxed text-muted-foreground", children: truncate(pageContent, 3e3) }) })
|
|
61597
61882
|
}
|
|
@@ -61615,6 +61900,7 @@ function parseEmailResults(data) {
|
|
|
61615
61900
|
});
|
|
61616
61901
|
}
|
|
61617
61902
|
const EmailSearchToolUIImpl = ({
|
|
61903
|
+
toolName,
|
|
61618
61904
|
args,
|
|
61619
61905
|
result,
|
|
61620
61906
|
status
|
|
@@ -61633,6 +61919,7 @@ const EmailSearchToolUIImpl = ({
|
|
|
61633
61919
|
status: (status == null ? void 0 : status.type) ?? "complete",
|
|
61634
61920
|
title: isRunning ? "Searching emails..." : "Email search",
|
|
61635
61921
|
subtitle: query ? truncate(query, 80) : void 0,
|
|
61922
|
+
toolName,
|
|
61636
61923
|
badge: isComplete && emails.length > 0 ? `${emails.length} emails` : void 0,
|
|
61637
61924
|
error: errorMsg,
|
|
61638
61925
|
children: isComplete && emails.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show email results", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col divide-y divide-border/30", children: emails.map((email, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-0.5 py-2", i === 0 && "pt-0"), children: [
|
|
@@ -61657,16 +61944,15 @@ function extractAssetId(result) {
|
|
|
61657
61944
|
if (typeof id === "string" && id.startsWith("asset_")) return id;
|
|
61658
61945
|
return null;
|
|
61659
61946
|
}
|
|
61660
|
-
let assetGeneration = 0;
|
|
61661
|
-
const autoOpenedAssets = /* @__PURE__ */ new Map();
|
|
61662
61947
|
function resetAssetAutoOpen() {
|
|
61663
|
-
|
|
61948
|
+
useAssetPanelStore.getState().resetAutoOpen();
|
|
61664
61949
|
}
|
|
61665
61950
|
function CreateAssetToolUIImpl({
|
|
61666
61951
|
icon: Icon2,
|
|
61667
61952
|
assetType,
|
|
61668
61953
|
runningLabel,
|
|
61669
61954
|
doneLabel,
|
|
61955
|
+
toolName,
|
|
61670
61956
|
args,
|
|
61671
61957
|
result,
|
|
61672
61958
|
status
|
|
@@ -61683,12 +61969,14 @@ function CreateAssetToolUIImpl({
|
|
|
61683
61969
|
const openAsset = useAssetPanelStore((s) => s.openAsset);
|
|
61684
61970
|
const wasCompleteAtMount = React.useRef(isComplete);
|
|
61685
61971
|
React.useEffect(() => {
|
|
61686
|
-
if (isComplete && !isCancelled && assetId && !wasCompleteAtMount.current
|
|
61687
|
-
|
|
61688
|
-
|
|
61689
|
-
|
|
61690
|
-
|
|
61691
|
-
|
|
61972
|
+
if (isComplete && !isCancelled && assetId && !wasCompleteAtMount.current) {
|
|
61973
|
+
const store = useAssetPanelStore.getState();
|
|
61974
|
+
if (store.markAutoOpened(assetId)) {
|
|
61975
|
+
store.openAsset(assetId, {
|
|
61976
|
+
name: createdName || name || void 0,
|
|
61977
|
+
type: assetType
|
|
61978
|
+
});
|
|
61979
|
+
}
|
|
61692
61980
|
}
|
|
61693
61981
|
}, [isComplete, isCancelled, assetId, createdName, name, assetType]);
|
|
61694
61982
|
const handleOpen = () => {
|
|
@@ -61706,6 +61994,7 @@ function CreateAssetToolUIImpl({
|
|
|
61706
61994
|
status: (status == null ? void 0 : status.type) ?? "complete",
|
|
61707
61995
|
title: isRunning ? runningLabel : doneLabel,
|
|
61708
61996
|
subtitle: createdName || name || void 0,
|
|
61997
|
+
toolName,
|
|
61709
61998
|
error: errorMsg,
|
|
61710
61999
|
children: assetId && isComplete && !isCancelled && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-border/40 px-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
61711
62000
|
"button",
|
|
@@ -61765,6 +62054,7 @@ const CreatePresentationToolUI = React.memo(
|
|
|
61765
62054
|
);
|
|
61766
62055
|
CreatePresentationToolUI.displayName = "CreatePresentationToolUI";
|
|
61767
62056
|
const CreateEmailDraftToolUIImpl = ({
|
|
62057
|
+
toolName,
|
|
61768
62058
|
args,
|
|
61769
62059
|
result,
|
|
61770
62060
|
status
|
|
@@ -61780,6 +62070,7 @@ const CreateEmailDraftToolUIImpl = ({
|
|
|
61780
62070
|
icon: Mail,
|
|
61781
62071
|
status: (status == null ? void 0 : status.type) ?? "complete",
|
|
61782
62072
|
title: isRunning ? "Creating email draft..." : "Email draft created",
|
|
62073
|
+
toolName,
|
|
61783
62074
|
subtitle: subject ? truncate(subject, 60) : to ? `To: ${truncate(to, 40)}` : void 0,
|
|
61784
62075
|
error: errorMsg
|
|
61785
62076
|
}
|
|
@@ -61799,7 +62090,6 @@ const TOOL_UI_REGISTRY = {
|
|
|
61799
62090
|
create_new_document: CreateDocumentToolUI,
|
|
61800
62091
|
create_document_from_markdown: CreateDocumentToolUI,
|
|
61801
62092
|
create_new_sheet: CreateSheetToolUI,
|
|
61802
|
-
update_sheet_range: CreateSheetToolUI,
|
|
61803
62093
|
create_powerpoint_deck: CreatePresentationToolUI
|
|
61804
62094
|
};
|
|
61805
62095
|
const falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
@@ -62098,7 +62388,8 @@ function useAssetEmbed(assetId, options = {
|
|
|
62098
62388
|
setError(null);
|
|
62099
62389
|
return;
|
|
62100
62390
|
}
|
|
62101
|
-
const
|
|
62391
|
+
const cacheKey = `${assetId}:${readOnly}:${token ?? apiKey ?? "anon"}`;
|
|
62392
|
+
const cached = embedCache.get(cacheKey);
|
|
62102
62393
|
if (cached && cached.expiresAt > Date.now() / 1e3) {
|
|
62103
62394
|
setEmbedUrl(cached.url);
|
|
62104
62395
|
setIsLoading(false);
|
|
@@ -62134,7 +62425,7 @@ function useAssetEmbed(assetId, options = {
|
|
|
62134
62425
|
}
|
|
62135
62426
|
return res.json();
|
|
62136
62427
|
}).then((data) => {
|
|
62137
|
-
embedCache.set(assetId
|
|
62428
|
+
embedCache.set(`${assetId}:${readOnly}:${token ?? apiKey ?? "anon"}`, { url: data.embed_url, expiresAt: data.expires_at });
|
|
62138
62429
|
setEmbedUrl(data.embed_url);
|
|
62139
62430
|
setIsLoading(false);
|
|
62140
62431
|
}).catch((err) => {
|
|
@@ -62386,6 +62677,103 @@ const AthenaLayout = ({
|
|
|
62386
62677
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(AssetPanel, {}) })
|
|
62387
62678
|
] });
|
|
62388
62679
|
};
|
|
62680
|
+
function useThreadList() {
|
|
62681
|
+
const store = useThreadListStore();
|
|
62682
|
+
return useStore$1(store);
|
|
62683
|
+
}
|
|
62684
|
+
function useActiveThreadId() {
|
|
62685
|
+
const store = useThreadListStore();
|
|
62686
|
+
return useStore$1(store, (s) => s.activeThreadId);
|
|
62687
|
+
}
|
|
62688
|
+
function ThreadList({ className }) {
|
|
62689
|
+
const {
|
|
62690
|
+
threads,
|
|
62691
|
+
activeThreadId,
|
|
62692
|
+
isLoading,
|
|
62693
|
+
fetchThreads,
|
|
62694
|
+
switchThread,
|
|
62695
|
+
newThread,
|
|
62696
|
+
archiveThread: archiveThread2
|
|
62697
|
+
} = useThreadList();
|
|
62698
|
+
React.useEffect(() => {
|
|
62699
|
+
fetchThreads();
|
|
62700
|
+
}, [fetchThreads]);
|
|
62701
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
62702
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
62703
|
+
"button",
|
|
62704
|
+
{
|
|
62705
|
+
onClick: () => newThread(),
|
|
62706
|
+
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",
|
|
62707
|
+
children: [
|
|
62708
|
+
/* @__PURE__ */ jsxRuntime.jsx(Plus, { className: "size-4" }),
|
|
62709
|
+
"New Chat"
|
|
62710
|
+
]
|
|
62711
|
+
}
|
|
62712
|
+
),
|
|
62713
|
+
isLoading && threads.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center py-4 text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(LoaderCircle, { className: "size-4 animate-spin" }) }) : threads.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 py-4 text-center text-xs text-muted-foreground/60", children: "No conversations yet" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-0.5", children: threads.map((thread) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
62714
|
+
"div",
|
|
62715
|
+
{
|
|
62716
|
+
className: cn(
|
|
62717
|
+
"group flex items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors cursor-pointer",
|
|
62718
|
+
activeThreadId === thread.thread_id ? "bg-muted/50 text-foreground" : "text-muted-foreground hover:bg-muted/30 hover:text-foreground"
|
|
62719
|
+
),
|
|
62720
|
+
onClick: () => switchThread(thread.thread_id),
|
|
62721
|
+
children: [
|
|
62722
|
+
/* @__PURE__ */ jsxRuntime.jsx(MessageSquare, { className: "size-3.5 shrink-0" }),
|
|
62723
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", children: thread.title || "Untitled" }),
|
|
62724
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
62725
|
+
"button",
|
|
62726
|
+
{
|
|
62727
|
+
onClick: (e) => {
|
|
62728
|
+
e.stopPropagation();
|
|
62729
|
+
archiveThread2(thread.thread_id);
|
|
62730
|
+
},
|
|
62731
|
+
className: "hidden size-5 items-center justify-center rounded text-muted-foreground/60 transition-colors hover:bg-muted hover:text-foreground group-hover:flex",
|
|
62732
|
+
title: "Archive",
|
|
62733
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Archive, { className: "size-3" })
|
|
62734
|
+
}
|
|
62735
|
+
)
|
|
62736
|
+
]
|
|
62737
|
+
},
|
|
62738
|
+
thread.thread_id
|
|
62739
|
+
)) })
|
|
62740
|
+
] });
|
|
62741
|
+
}
|
|
62742
|
+
function useAppendToComposer() {
|
|
62743
|
+
const aui = useAui();
|
|
62744
|
+
return React.useCallback(
|
|
62745
|
+
(text2, opts) => {
|
|
62746
|
+
const composer = aui.composer();
|
|
62747
|
+
if (opts == null ? void 0 : opts.replace) {
|
|
62748
|
+
composer.setText(text2);
|
|
62749
|
+
} else {
|
|
62750
|
+
const current = composer.getState().text;
|
|
62751
|
+
composer.setText(current ? `${current}
|
|
62752
|
+
${text2}` : text2);
|
|
62753
|
+
}
|
|
62754
|
+
},
|
|
62755
|
+
[aui]
|
|
62756
|
+
);
|
|
62757
|
+
}
|
|
62758
|
+
function useComposerAttachment() {
|
|
62759
|
+
const aui = useAui();
|
|
62760
|
+
const addFile = React.useCallback(
|
|
62761
|
+
(file) => {
|
|
62762
|
+
aui.composer().addAttachment(file);
|
|
62763
|
+
},
|
|
62764
|
+
[aui]
|
|
62765
|
+
);
|
|
62766
|
+
const addContent = React.useCallback(
|
|
62767
|
+
(name, content) => {
|
|
62768
|
+
aui.composer().addAttachment({ name, content });
|
|
62769
|
+
},
|
|
62770
|
+
[aui]
|
|
62771
|
+
);
|
|
62772
|
+
const clear = React.useCallback(() => {
|
|
62773
|
+
aui.composer().clearAttachments();
|
|
62774
|
+
}, [aui]);
|
|
62775
|
+
return { addFile, addContent, clear };
|
|
62776
|
+
}
|
|
62389
62777
|
exports.AppendDocumentToolUI = AppendDocumentToolUI;
|
|
62390
62778
|
exports.AssetPanel = AssetPanel;
|
|
62391
62779
|
exports.AthenaChat = AthenaChat;
|
|
@@ -62404,6 +62792,7 @@ exports.DEFAULT_BACKEND_URL = DEFAULT_BACKEND_URL;
|
|
|
62404
62792
|
exports.EmailSearchToolUI = EmailSearchToolUI;
|
|
62405
62793
|
exports.ReadAssetToolUI = ReadAssetToolUI;
|
|
62406
62794
|
exports.TOOL_UI_REGISTRY = TOOL_UI_REGISTRY;
|
|
62795
|
+
exports.ThreadList = ThreadList;
|
|
62407
62796
|
exports.TiptapComposer = TiptapComposer;
|
|
62408
62797
|
exports.TiptapText = TiptapText;
|
|
62409
62798
|
exports.ToolFallback = ToolFallback;
|
|
@@ -62422,13 +62811,18 @@ exports.WebSearchToolUI = WebSearchToolUI;
|
|
|
62422
62811
|
exports.buttonVariants = buttonVariants;
|
|
62423
62812
|
exports.clearAutoOpenedAssets = clearAutoOpenedAssets;
|
|
62424
62813
|
exports.cn = cn;
|
|
62814
|
+
exports.createThreadListStore = createThreadListStore;
|
|
62425
62815
|
exports.getAssetInfo = getAssetInfo;
|
|
62426
62816
|
exports.resetAssetAutoOpen = resetAssetAutoOpen;
|
|
62427
62817
|
exports.tryParseJson = tryParseJson$1;
|
|
62818
|
+
exports.useActiveThreadId = useActiveThreadId;
|
|
62819
|
+
exports.useAppendToComposer = useAppendToComposer;
|
|
62428
62820
|
exports.useAssetEmbed = useAssetEmbed;
|
|
62429
62821
|
exports.useAssetPanelStore = useAssetPanelStore;
|
|
62430
62822
|
exports.useAthenaConfig = useAthenaConfig;
|
|
62431
62823
|
exports.useAthenaRuntime = useAthenaRuntime;
|
|
62824
|
+
exports.useComposerAttachment = useComposerAttachment;
|
|
62432
62825
|
exports.useMentionSuggestions = useMentionSuggestions;
|
|
62433
62826
|
exports.useParentAuth = useParentAuth;
|
|
62827
|
+
exports.useThreadList = useThreadList;
|
|
62434
62828
|
//# sourceMappingURL=index.cjs.map
|