@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.js
CHANGED
|
@@ -1360,7 +1360,7 @@ const createStoreImpl = (createState) => {
|
|
|
1360
1360
|
};
|
|
1361
1361
|
const createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
1362
1362
|
const identity = (arg) => arg;
|
|
1363
|
-
function useStore(api, selector = identity) {
|
|
1363
|
+
function useStore$1(api, selector = identity) {
|
|
1364
1364
|
const slice2 = React__default.useSyncExternalStore(
|
|
1365
1365
|
api.subscribe,
|
|
1366
1366
|
React__default.useCallback(() => selector(api.getState()), [api, selector]),
|
|
@@ -1371,7 +1371,7 @@ function useStore(api, selector = identity) {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
const createImpl = (createState) => {
|
|
1373
1373
|
const api = createStore(createState);
|
|
1374
|
-
const useBoundStore = (selector) => useStore(api, selector);
|
|
1374
|
+
const useBoundStore = (selector) => useStore$1(api, selector);
|
|
1375
1375
|
Object.assign(useBoundStore, api);
|
|
1376
1376
|
return useBoundStore;
|
|
1377
1377
|
};
|
|
@@ -16417,16 +16417,37 @@ function useParentAuth() {
|
|
|
16417
16417
|
const [authToken, setAuthToken] = useState(null);
|
|
16418
16418
|
const readySignalSent = useRef(false);
|
|
16419
16419
|
useEffect(() => {
|
|
16420
|
+
const isInIframe = window.parent !== window;
|
|
16421
|
+
console.log("[AthenaAuth] useParentAuth mounted", {
|
|
16422
|
+
isInIframe,
|
|
16423
|
+
currentOrigin: window.location.origin,
|
|
16424
|
+
currentUrl: window.location.href
|
|
16425
|
+
});
|
|
16420
16426
|
const handler = (event) => {
|
|
16421
|
-
|
|
16427
|
+
var _a2, _b, _c;
|
|
16428
|
+
console.log("[AthenaAuth] Received PostMessage", {
|
|
16429
|
+
type: (_a2 = event.data) == null ? void 0 : _a2.type,
|
|
16430
|
+
origin: event.origin,
|
|
16431
|
+
isTrusted: isTrustedOrigin(event.origin),
|
|
16432
|
+
hasToken: !!((_b = event.data) == null ? void 0 : _b.token),
|
|
16433
|
+
tokenPrefix: typeof ((_c = event.data) == null ? void 0 : _c.token) === "string" ? event.data.token.substring(0, 20) + "..." : void 0
|
|
16434
|
+
});
|
|
16435
|
+
if (!isTrustedOrigin(event.origin)) {
|
|
16436
|
+
console.warn("[AthenaAuth] Rejected PostMessage — untrusted origin:", event.origin);
|
|
16437
|
+
return;
|
|
16438
|
+
}
|
|
16422
16439
|
if (event.data && typeof event.data === "object" && event.data.type === "athena-auth" && typeof event.data.token === "string") {
|
|
16440
|
+
console.log("[AthenaAuth] PropelAuth token received via PostMessage, length:", event.data.token.length);
|
|
16423
16441
|
setAuthToken(event.data.token);
|
|
16424
16442
|
}
|
|
16425
16443
|
};
|
|
16426
16444
|
window.addEventListener("message", handler);
|
|
16427
|
-
if (!readySignalSent.current &&
|
|
16445
|
+
if (!readySignalSent.current && isInIframe) {
|
|
16446
|
+
console.log("[AthenaAuth] Sending athena-auth-ready signal to parent");
|
|
16428
16447
|
window.parent.postMessage({ type: "athena-auth-ready" }, "*");
|
|
16429
16448
|
readySignalSent.current = true;
|
|
16449
|
+
} else if (!isInIframe) {
|
|
16450
|
+
console.log("[AthenaAuth] Not in iframe — skipping parent auth (standalone mode)");
|
|
16430
16451
|
}
|
|
16431
16452
|
return () => window.removeEventListener("message", handler);
|
|
16432
16453
|
}, []);
|
|
@@ -20731,7 +20752,11 @@ const useAthenaRuntime = (config2) => {
|
|
|
20731
20752
|
systemPrompt,
|
|
20732
20753
|
threadId: threadIdProp
|
|
20733
20754
|
} = config2;
|
|
20734
|
-
const
|
|
20755
|
+
const generatedIdRef = useRef(null);
|
|
20756
|
+
if (generatedIdRef.current === null) {
|
|
20757
|
+
generatedIdRef.current = crypto.randomUUID();
|
|
20758
|
+
}
|
|
20759
|
+
const threadId = threadIdProp ?? generatedIdRef.current;
|
|
20735
20760
|
const enabledTools = useMemo(
|
|
20736
20761
|
() => Array.from(/* @__PURE__ */ new Set([...tools, ...frontendToolIds])),
|
|
20737
20762
|
[tools, frontendToolIds]
|
|
@@ -20746,12 +20771,22 @@ const useAthenaRuntime = (config2) => {
|
|
|
20746
20771
|
initialState: { messages: [] },
|
|
20747
20772
|
converter,
|
|
20748
20773
|
api: apiUrl,
|
|
20749
|
-
headers: async () =>
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20774
|
+
headers: async () => {
|
|
20775
|
+
const authHeaders = tokenRef.current ? { Authorization: `Bearer ${tokenRef.current}` } : apiKeyRef.current ? { "X-API-KEY": apiKeyRef.current } : {};
|
|
20776
|
+
console.log("[AthenaAuth] Request headers", {
|
|
20777
|
+
authMethod: tokenRef.current ? "Bearer token" : apiKeyRef.current ? "X-API-KEY" : "NONE",
|
|
20778
|
+
hasToken: !!tokenRef.current,
|
|
20779
|
+
tokenPrefix: tokenRef.current ? tokenRef.current.substring(0, 20) + "..." : void 0,
|
|
20780
|
+
apiKeyPrefix: apiKeyRef.current ? apiKeyRef.current.substring(0, 10) + "..." : void 0,
|
|
20781
|
+
apiUrl
|
|
20782
|
+
});
|
|
20783
|
+
return {
|
|
20784
|
+
// Prefer parent-injected PropelAuth token over hardcoded API key
|
|
20785
|
+
...authHeaders,
|
|
20786
|
+
"Accept-Encoding": "identity",
|
|
20787
|
+
Accept: "text/event-stream"
|
|
20788
|
+
};
|
|
20789
|
+
},
|
|
20755
20790
|
onResponse: () => {
|
|
20756
20791
|
if (process.env.NODE_ENV !== "production") {
|
|
20757
20792
|
console.log("[AthenaSDK] Stream connected");
|
|
@@ -24084,48 +24119,200 @@ function useAthenaConfig() {
|
|
|
24084
24119
|
}
|
|
24085
24120
|
return ctx;
|
|
24086
24121
|
}
|
|
24087
|
-
|
|
24122
|
+
const ThreadListContext = createContext(null);
|
|
24123
|
+
function useThreadListStore() {
|
|
24124
|
+
const store = useContext(ThreadListContext);
|
|
24125
|
+
if (!store) {
|
|
24126
|
+
throw new Error(
|
|
24127
|
+
"[AthenaSDK] useThreadList must be used within an <AthenaProvider> that has thread management enabled."
|
|
24128
|
+
);
|
|
24129
|
+
}
|
|
24130
|
+
return store;
|
|
24131
|
+
}
|
|
24132
|
+
function getAuthHeaders(auth) {
|
|
24133
|
+
if (auth.token) {
|
|
24134
|
+
return { Authorization: `Bearer ${auth.token}` };
|
|
24135
|
+
}
|
|
24136
|
+
if (auth.apiKey) {
|
|
24137
|
+
return { "X-API-KEY": auth.apiKey };
|
|
24138
|
+
}
|
|
24139
|
+
return {};
|
|
24140
|
+
}
|
|
24141
|
+
function getAgoraBaseUrl(backendUrl) {
|
|
24142
|
+
return backendUrl.replace(/\/api\/assistant-ui\/?$/, "");
|
|
24143
|
+
}
|
|
24144
|
+
async function listThreads(backendUrl, auth, opts = {}) {
|
|
24145
|
+
const base2 = getAgoraBaseUrl(backendUrl);
|
|
24146
|
+
const res = await fetch(`${base2}/api/conversation/threads/list`, {
|
|
24147
|
+
method: "POST",
|
|
24148
|
+
headers: { "Content-Type": "application/json", ...getAuthHeaders(auth) },
|
|
24149
|
+
body: JSON.stringify({ limit: opts.limit ?? 50, offset: opts.offset ?? 0 })
|
|
24150
|
+
});
|
|
24151
|
+
if (!res.ok) {
|
|
24152
|
+
throw new Error(`[AthenaSDK] Failed to list threads: ${res.status}`);
|
|
24153
|
+
}
|
|
24154
|
+
return res.json();
|
|
24155
|
+
}
|
|
24156
|
+
async function archiveThread(backendUrl, auth, threadId) {
|
|
24157
|
+
const base2 = getAgoraBaseUrl(backendUrl);
|
|
24158
|
+
const res = await fetch(`${base2}/api/conversation/threads/archive`, {
|
|
24159
|
+
method: "POST",
|
|
24160
|
+
headers: { "Content-Type": "application/json", ...getAuthHeaders(auth) },
|
|
24161
|
+
body: JSON.stringify({ thread_id: threadId })
|
|
24162
|
+
});
|
|
24163
|
+
if (!res.ok) {
|
|
24164
|
+
throw new Error(`[AthenaSDK] Failed to archive thread: ${res.status}`);
|
|
24165
|
+
}
|
|
24166
|
+
}
|
|
24167
|
+
function createThreadListStore(config2) {
|
|
24168
|
+
const auth = { apiKey: config2.apiKey, token: config2.token };
|
|
24169
|
+
return create((set2, get2) => ({
|
|
24170
|
+
threads: [],
|
|
24171
|
+
activeThreadId: null,
|
|
24172
|
+
isLoading: false,
|
|
24173
|
+
error: null,
|
|
24174
|
+
fetchThreads: async () => {
|
|
24175
|
+
set2({ isLoading: true, error: null });
|
|
24176
|
+
try {
|
|
24177
|
+
const { threads } = await listThreads(config2.backendUrl, auth);
|
|
24178
|
+
const sorted = [...threads].sort(
|
|
24179
|
+
(a, b) => new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime()
|
|
24180
|
+
);
|
|
24181
|
+
set2({ threads: sorted, isLoading: false });
|
|
24182
|
+
} catch (e) {
|
|
24183
|
+
set2({ error: e.message, isLoading: false });
|
|
24184
|
+
}
|
|
24185
|
+
},
|
|
24186
|
+
switchThread: (threadId) => {
|
|
24187
|
+
set2({ activeThreadId: threadId });
|
|
24188
|
+
},
|
|
24189
|
+
newThread: async () => {
|
|
24190
|
+
const localThreadId = `thread_${crypto.randomUUID()}`;
|
|
24191
|
+
set2({ activeThreadId: localThreadId });
|
|
24192
|
+
return localThreadId;
|
|
24193
|
+
},
|
|
24194
|
+
archiveThread: async (threadId) => {
|
|
24195
|
+
var _a2;
|
|
24196
|
+
try {
|
|
24197
|
+
await archiveThread(config2.backendUrl, auth, threadId);
|
|
24198
|
+
const { threads, activeThreadId } = get2();
|
|
24199
|
+
const remaining = threads.filter((t) => t.thread_id !== threadId);
|
|
24200
|
+
set2({
|
|
24201
|
+
threads: remaining,
|
|
24202
|
+
activeThreadId: activeThreadId === threadId ? ((_a2 = remaining[0]) == null ? void 0 : _a2.thread_id) ?? null : activeThreadId
|
|
24203
|
+
});
|
|
24204
|
+
} catch (e) {
|
|
24205
|
+
set2({ error: e.message });
|
|
24206
|
+
}
|
|
24207
|
+
}
|
|
24208
|
+
}));
|
|
24209
|
+
}
|
|
24210
|
+
function AthenaRuntimeInner({
|
|
24088
24211
|
children,
|
|
24089
|
-
apiKey,
|
|
24090
|
-
token: tokenProp,
|
|
24091
|
-
agent: agent2,
|
|
24092
|
-
model,
|
|
24093
|
-
tools = [],
|
|
24094
|
-
frontendTools = {},
|
|
24095
24212
|
apiUrl,
|
|
24096
24213
|
backendUrl,
|
|
24214
|
+
apiKey,
|
|
24215
|
+
token,
|
|
24216
|
+
model,
|
|
24217
|
+
agent: agent2,
|
|
24218
|
+
tools,
|
|
24219
|
+
frontendToolIds,
|
|
24220
|
+
frontendTools,
|
|
24097
24221
|
workbench,
|
|
24098
24222
|
knowledgeBase,
|
|
24099
24223
|
systemPrompt,
|
|
24100
24224
|
threadId
|
|
24101
24225
|
}) {
|
|
24102
|
-
const
|
|
24103
|
-
const aui = useAui({
|
|
24104
|
-
tools: Tools({ toolkit: frontendTools })
|
|
24105
|
-
});
|
|
24106
|
-
const parentAuthToken = useParentAuth();
|
|
24107
|
-
const effectiveToken = tokenProp ?? parentAuthToken;
|
|
24108
|
-
const effectiveBackendUrl = backendUrl ?? DEFAULT_BACKEND_URL;
|
|
24226
|
+
const auiTools = useMemo(() => Tools({ toolkit: frontendTools }), [frontendTools]);
|
|
24227
|
+
const aui = useAui({ tools: auiTools });
|
|
24109
24228
|
const runtime = useAthenaRuntime({
|
|
24110
24229
|
apiUrl,
|
|
24111
|
-
backendUrl
|
|
24230
|
+
backendUrl,
|
|
24112
24231
|
apiKey,
|
|
24113
|
-
token
|
|
24232
|
+
token,
|
|
24114
24233
|
model,
|
|
24115
24234
|
agent: agent2,
|
|
24116
24235
|
tools,
|
|
24117
|
-
frontendToolIds
|
|
24236
|
+
frontendToolIds,
|
|
24118
24237
|
workbench,
|
|
24119
24238
|
knowledgeBase,
|
|
24120
24239
|
systemPrompt,
|
|
24121
24240
|
threadId
|
|
24122
24241
|
});
|
|
24123
24242
|
const athenaConfig = useMemo(
|
|
24124
|
-
() => ({ backendUrl
|
|
24125
|
-
[
|
|
24243
|
+
() => ({ backendUrl, apiKey, token }),
|
|
24244
|
+
[backendUrl, apiKey, token]
|
|
24126
24245
|
);
|
|
24127
24246
|
return /* @__PURE__ */ jsx(AssistantRuntimeProvider, { aui, runtime, children: /* @__PURE__ */ jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsx(TooltipProvider, { children }) }) });
|
|
24128
24247
|
}
|
|
24248
|
+
function useActiveThreadFromStore(store) {
|
|
24249
|
+
return useSyncExternalStore(
|
|
24250
|
+
(cb) => {
|
|
24251
|
+
if (!store) return () => {
|
|
24252
|
+
};
|
|
24253
|
+
return store.subscribe(cb);
|
|
24254
|
+
},
|
|
24255
|
+
() => (store == null ? void 0 : store.getState().activeThreadId) ?? null,
|
|
24256
|
+
() => null
|
|
24257
|
+
);
|
|
24258
|
+
}
|
|
24259
|
+
function AthenaProvider({
|
|
24260
|
+
children,
|
|
24261
|
+
apiKey,
|
|
24262
|
+
token: tokenProp,
|
|
24263
|
+
agent: agent2,
|
|
24264
|
+
model,
|
|
24265
|
+
tools = [],
|
|
24266
|
+
frontendTools = {},
|
|
24267
|
+
apiUrl,
|
|
24268
|
+
backendUrl,
|
|
24269
|
+
workbench,
|
|
24270
|
+
knowledgeBase,
|
|
24271
|
+
systemPrompt,
|
|
24272
|
+
threadId: threadIdProp,
|
|
24273
|
+
enableThreadList = false
|
|
24274
|
+
}) {
|
|
24275
|
+
const frontendToolNames = useMemo(() => Object.keys(frontendTools), [frontendTools]);
|
|
24276
|
+
const parentAuthToken = useParentAuth();
|
|
24277
|
+
const effectiveToken = tokenProp ?? parentAuthToken;
|
|
24278
|
+
const effectiveBackendUrl = backendUrl ?? DEFAULT_BACKEND_URL;
|
|
24279
|
+
const threadListStoreRef = useRef(null);
|
|
24280
|
+
if (enableThreadList && !threadListStoreRef.current) {
|
|
24281
|
+
threadListStoreRef.current = createThreadListStore({
|
|
24282
|
+
backendUrl: effectiveBackendUrl,
|
|
24283
|
+
apiKey,
|
|
24284
|
+
token: effectiveToken
|
|
24285
|
+
});
|
|
24286
|
+
}
|
|
24287
|
+
const activeThreadId = useActiveThreadFromStore(
|
|
24288
|
+
enableThreadList ? threadListStoreRef.current : null
|
|
24289
|
+
);
|
|
24290
|
+
const resolvedThreadId = threadIdProp ?? activeThreadId ?? void 0;
|
|
24291
|
+
const inner = /* @__PURE__ */ jsx(
|
|
24292
|
+
AthenaRuntimeInner,
|
|
24293
|
+
{
|
|
24294
|
+
apiUrl,
|
|
24295
|
+
backendUrl: effectiveBackendUrl,
|
|
24296
|
+
apiKey,
|
|
24297
|
+
token: effectiveToken,
|
|
24298
|
+
model,
|
|
24299
|
+
agent: agent2,
|
|
24300
|
+
tools,
|
|
24301
|
+
frontendToolIds: frontendToolNames,
|
|
24302
|
+
frontendTools,
|
|
24303
|
+
workbench,
|
|
24304
|
+
knowledgeBase,
|
|
24305
|
+
systemPrompt,
|
|
24306
|
+
threadId: resolvedThreadId,
|
|
24307
|
+
children
|
|
24308
|
+
},
|
|
24309
|
+
resolvedThreadId ?? "__new__"
|
|
24310
|
+
);
|
|
24311
|
+
if (enableThreadList && threadListStoreRef.current) {
|
|
24312
|
+
return /* @__PURE__ */ jsx(ThreadListContext.Provider, { value: threadListStoreRef.current, children: inner });
|
|
24313
|
+
}
|
|
24314
|
+
return inner;
|
|
24315
|
+
}
|
|
24129
24316
|
function OrderedMap(content) {
|
|
24130
24317
|
this.content = content;
|
|
24131
24318
|
}
|
|
@@ -59508,6 +59695,31 @@ class Store {
|
|
|
59508
59695
|
return this.atom.subscribe(toObserver(observerOrFn));
|
|
59509
59696
|
}
|
|
59510
59697
|
}
|
|
59698
|
+
function defaultCompare(a, b) {
|
|
59699
|
+
return a === b;
|
|
59700
|
+
}
|
|
59701
|
+
function useStore(atom, selector, compare = defaultCompare) {
|
|
59702
|
+
const subscribe = useCallback(
|
|
59703
|
+
(handleStoreChange) => {
|
|
59704
|
+
if (!atom) {
|
|
59705
|
+
return () => {
|
|
59706
|
+
};
|
|
59707
|
+
}
|
|
59708
|
+
const { unsubscribe } = atom.subscribe(handleStoreChange);
|
|
59709
|
+
return unsubscribe;
|
|
59710
|
+
},
|
|
59711
|
+
[atom]
|
|
59712
|
+
);
|
|
59713
|
+
const boundGetSnapshot = useCallback(() => atom == null ? void 0 : atom.get(), [atom]);
|
|
59714
|
+
const selectedSnapshot = withSelectorExports.useSyncExternalStoreWithSelector(
|
|
59715
|
+
subscribe,
|
|
59716
|
+
boundGetSnapshot,
|
|
59717
|
+
boundGetSnapshot,
|
|
59718
|
+
selector,
|
|
59719
|
+
compare
|
|
59720
|
+
);
|
|
59721
|
+
return selectedSnapshot;
|
|
59722
|
+
}
|
|
59511
59723
|
function createScopeRegistry() {
|
|
59512
59724
|
return { entries: /* @__PURE__ */ new Map() };
|
|
59513
59725
|
}
|
|
@@ -59543,52 +59755,13 @@ function getFilteredItems(cache, scope, query) {
|
|
|
59543
59755
|
}
|
|
59544
59756
|
return results;
|
|
59545
59757
|
}
|
|
59546
|
-
function toolsToMenuItems(tools) {
|
|
59547
|
-
return tools.map((t) => ({
|
|
59548
|
-
id: t.id,
|
|
59549
|
-
name: t.name,
|
|
59550
|
-
type: t.type,
|
|
59551
|
-
fallbackIcon: t.icon ?? (t.type === "toolkit" ? "🧰" : "🔧"),
|
|
59552
|
-
description: t.description,
|
|
59553
|
-
visibleInScopes: /* @__PURE__ */ new Set(["root"])
|
|
59554
|
-
}));
|
|
59555
|
-
}
|
|
59556
|
-
function useMentionSuggestions(tools) {
|
|
59557
|
-
const store = useMemo(() => {
|
|
59558
|
-
const registry = createScopeRegistry();
|
|
59559
|
-
const cache = createItemCache();
|
|
59560
|
-
registerSource(registry, "root", async () => ({
|
|
59561
|
-
items: [],
|
|
59562
|
-
pagination: { hasMore: false }
|
|
59563
|
-
}));
|
|
59564
|
-
const items = toolsToMenuItems(tools);
|
|
59565
|
-
addItems(cache, items, "root");
|
|
59566
|
-
return new Store({ registry, cache });
|
|
59567
|
-
}, []);
|
|
59568
|
-
useEffect(() => {
|
|
59569
|
-
const { cache } = store.state;
|
|
59570
|
-
for (const item of cache.items.values()) {
|
|
59571
|
-
item.visibleInScopes.delete("root");
|
|
59572
|
-
}
|
|
59573
|
-
for (const [id, item] of cache.items) {
|
|
59574
|
-
if (item.visibleInScopes.size === 0) {
|
|
59575
|
-
cache.items.delete(id);
|
|
59576
|
-
}
|
|
59577
|
-
}
|
|
59578
|
-
const items = toolsToMenuItems(tools);
|
|
59579
|
-
addItems(cache, items, "root");
|
|
59580
|
-
}, [tools, store]);
|
|
59581
|
-
return store;
|
|
59582
|
-
}
|
|
59583
|
-
function selectItems(store, scope, query) {
|
|
59584
|
-
const { cache } = store.state;
|
|
59585
|
-
const items = getFilteredItems(cache, scope, query);
|
|
59586
|
-
return { items, isFetching: false, hasMore: false };
|
|
59587
|
-
}
|
|
59588
59758
|
const MentionSuggestionList = forwardRef(({ store, query, command: command2, closeMenu }, ref) => {
|
|
59589
59759
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
59590
59760
|
const scrollContainerRef = useRef(null);
|
|
59591
|
-
const { items, isFetching } =
|
|
59761
|
+
const { items, isFetching } = useStore(store, (state) => ({
|
|
59762
|
+
items: getFilteredItems(state.cache, "root", query),
|
|
59763
|
+
isFetching: false
|
|
59764
|
+
}));
|
|
59592
59765
|
useEffect(() => {
|
|
59593
59766
|
setSelectedIndex(0);
|
|
59594
59767
|
}, [query]);
|
|
@@ -59651,7 +59824,10 @@ const MentionSuggestionList = forwardRef(({ store, query, command: command2, clo
|
|
|
59651
59824
|
},
|
|
59652
59825
|
item.id
|
|
59653
59826
|
)),
|
|
59654
|
-
isFetching
|
|
59827
|
+
isFetching && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-2 py-1.5 text-sm text-muted-foreground", children: [
|
|
59828
|
+
/* @__PURE__ */ jsx("span", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
59829
|
+
"Loading..."
|
|
59830
|
+
] })
|
|
59655
59831
|
] }) });
|
|
59656
59832
|
});
|
|
59657
59833
|
MentionSuggestionList.displayName = "MentionSuggestionList";
|
|
@@ -59841,6 +60017,45 @@ const MentionSuggestionsExtension = Extension.create({
|
|
|
59841
60017
|
];
|
|
59842
60018
|
}
|
|
59843
60019
|
});
|
|
60020
|
+
function toolsToMenuItems(tools) {
|
|
60021
|
+
return tools.map((t) => ({
|
|
60022
|
+
id: t.id,
|
|
60023
|
+
name: t.name,
|
|
60024
|
+
type: t.type,
|
|
60025
|
+
fallbackIcon: t.icon ?? (t.type === "toolkit" ? "🧰" : "🔧"),
|
|
60026
|
+
description: t.description,
|
|
60027
|
+
visibleInScopes: /* @__PURE__ */ new Set(["root"])
|
|
60028
|
+
}));
|
|
60029
|
+
}
|
|
60030
|
+
function useMentionSuggestions(tools) {
|
|
60031
|
+
const storeRef = useRef(null);
|
|
60032
|
+
if (!storeRef.current) {
|
|
60033
|
+
const registry = createScopeRegistry();
|
|
60034
|
+
const cache = createItemCache();
|
|
60035
|
+
registerSource(registry, "root", async () => ({
|
|
60036
|
+
items: [],
|
|
60037
|
+
pagination: { hasMore: false }
|
|
60038
|
+
}));
|
|
60039
|
+
const items = toolsToMenuItems(tools);
|
|
60040
|
+
addItems(cache, items, "root");
|
|
60041
|
+
storeRef.current = new Store({ registry, cache });
|
|
60042
|
+
}
|
|
60043
|
+
const store = storeRef.current;
|
|
60044
|
+
useEffect(() => {
|
|
60045
|
+
store.setState((prev) => {
|
|
60046
|
+
const newCache = createItemCache();
|
|
60047
|
+
for (const [id, item] of prev.cache.items) {
|
|
60048
|
+
if (item.visibleInScopes.size > 0 && !item.visibleInScopes.has("root")) {
|
|
60049
|
+
newCache.items.set(id, { ...item, visibleInScopes: new Set(item.visibleInScopes) });
|
|
60050
|
+
}
|
|
60051
|
+
}
|
|
60052
|
+
const items = toolsToMenuItems(tools);
|
|
60053
|
+
addItems(newCache, items, "root");
|
|
60054
|
+
return { ...prev, cache: newCache };
|
|
60055
|
+
});
|
|
60056
|
+
}, [tools, store]);
|
|
60057
|
+
return store;
|
|
60058
|
+
}
|
|
59844
60059
|
const TiptapComposer = ({ tools = [] }) => {
|
|
59845
60060
|
const composerRuntime = useComposerRuntime();
|
|
59846
60061
|
const editorRef = useRef(null);
|
|
@@ -60029,29 +60244,41 @@ const createLucideIcon = (iconName, iconNode) => {
|
|
|
60029
60244
|
* This source code is licensed under the ISC license.
|
|
60030
60245
|
* See the LICENSE file in the root directory of this source tree.
|
|
60031
60246
|
*/
|
|
60032
|
-
const __iconNode$
|
|
60247
|
+
const __iconNode$E = [
|
|
60248
|
+
["rect", { width: "20", height: "5", x: "2", y: "3", rx: "1", key: "1wp1u1" }],
|
|
60249
|
+
["path", { d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8", key: "1s80jp" }],
|
|
60250
|
+
["path", { d: "M10 12h4", key: "a56b0p" }]
|
|
60251
|
+
];
|
|
60252
|
+
const Archive = createLucideIcon("archive", __iconNode$E);
|
|
60253
|
+
/**
|
|
60254
|
+
* @license lucide-react v0.575.0 - ISC
|
|
60255
|
+
*
|
|
60256
|
+
* This source code is licensed under the ISC license.
|
|
60257
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
60258
|
+
*/
|
|
60259
|
+
const __iconNode$D = [
|
|
60033
60260
|
["path", { d: "M12 5v14", key: "s699le" }],
|
|
60034
60261
|
["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
|
|
60035
60262
|
];
|
|
60036
|
-
const ArrowDown = createLucideIcon("arrow-down", __iconNode$
|
|
60263
|
+
const ArrowDown = createLucideIcon("arrow-down", __iconNode$D);
|
|
60037
60264
|
/**
|
|
60038
60265
|
* @license lucide-react v0.575.0 - ISC
|
|
60039
60266
|
*
|
|
60040
60267
|
* This source code is licensed under the ISC license.
|
|
60041
60268
|
* See the LICENSE file in the root directory of this source tree.
|
|
60042
60269
|
*/
|
|
60043
|
-
const __iconNode$
|
|
60270
|
+
const __iconNode$C = [
|
|
60044
60271
|
["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
|
|
60045
60272
|
["path", { d: "M12 19V5", key: "x0mq9r" }]
|
|
60046
60273
|
];
|
|
60047
|
-
const ArrowUp = createLucideIcon("arrow-up", __iconNode$
|
|
60274
|
+
const ArrowUp = createLucideIcon("arrow-up", __iconNode$C);
|
|
60048
60275
|
/**
|
|
60049
60276
|
* @license lucide-react v0.575.0 - ISC
|
|
60050
60277
|
*
|
|
60051
60278
|
* This source code is licensed under the ISC license.
|
|
60052
60279
|
* See the LICENSE file in the root directory of this source tree.
|
|
60053
60280
|
*/
|
|
60054
|
-
const __iconNode$
|
|
60281
|
+
const __iconNode$B = [
|
|
60055
60282
|
["path", { d: "M12 7v14", key: "1akyts" }],
|
|
60056
60283
|
[
|
|
60057
60284
|
"path",
|
|
@@ -60061,14 +60288,14 @@ const __iconNode$z = [
|
|
|
60061
60288
|
}
|
|
60062
60289
|
]
|
|
60063
60290
|
];
|
|
60064
|
-
const BookOpen = createLucideIcon("book-open", __iconNode$
|
|
60291
|
+
const BookOpen = createLucideIcon("book-open", __iconNode$B);
|
|
60065
60292
|
/**
|
|
60066
60293
|
* @license lucide-react v0.575.0 - ISC
|
|
60067
60294
|
*
|
|
60068
60295
|
* This source code is licensed under the ISC license.
|
|
60069
60296
|
* See the LICENSE file in the root directory of this source tree.
|
|
60070
60297
|
*/
|
|
60071
|
-
const __iconNode$
|
|
60298
|
+
const __iconNode$A = [
|
|
60072
60299
|
["path", { d: "M12 18V5", key: "adv99a" }],
|
|
60073
60300
|
["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
|
|
60074
60301
|
["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
|
|
@@ -60078,148 +60305,148 @@ const __iconNode$y = [
|
|
|
60078
60305
|
["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
|
|
60079
60306
|
["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
|
|
60080
60307
|
];
|
|
60081
|
-
const Brain = createLucideIcon("brain", __iconNode$
|
|
60308
|
+
const Brain = createLucideIcon("brain", __iconNode$A);
|
|
60082
60309
|
/**
|
|
60083
60310
|
* @license lucide-react v0.575.0 - ISC
|
|
60084
60311
|
*
|
|
60085
60312
|
* This source code is licensed under the ISC license.
|
|
60086
60313
|
* See the LICENSE file in the root directory of this source tree.
|
|
60087
60314
|
*/
|
|
60088
|
-
const __iconNode$
|
|
60315
|
+
const __iconNode$z = [
|
|
60089
60316
|
["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
|
|
60090
60317
|
["path", { d: "M18 17V9", key: "2bz60n" }],
|
|
60091
60318
|
["path", { d: "M13 17V5", key: "1frdt8" }],
|
|
60092
60319
|
["path", { d: "M8 17v-3", key: "17ska0" }]
|
|
60093
60320
|
];
|
|
60094
|
-
const ChartColumn = createLucideIcon("chart-column", __iconNode$
|
|
60321
|
+
const ChartColumn = createLucideIcon("chart-column", __iconNode$z);
|
|
60095
60322
|
/**
|
|
60096
60323
|
* @license lucide-react v0.575.0 - ISC
|
|
60097
60324
|
*
|
|
60098
60325
|
* This source code is licensed under the ISC license.
|
|
60099
60326
|
* See the LICENSE file in the root directory of this source tree.
|
|
60100
60327
|
*/
|
|
60101
|
-
const __iconNode$
|
|
60102
|
-
const Check = createLucideIcon("check", __iconNode$
|
|
60328
|
+
const __iconNode$y = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
60329
|
+
const Check = createLucideIcon("check", __iconNode$y);
|
|
60103
60330
|
/**
|
|
60104
60331
|
* @license lucide-react v0.575.0 - ISC
|
|
60105
60332
|
*
|
|
60106
60333
|
* This source code is licensed under the ISC license.
|
|
60107
60334
|
* See the LICENSE file in the root directory of this source tree.
|
|
60108
60335
|
*/
|
|
60109
|
-
const __iconNode$
|
|
60110
|
-
const ChevronDown = createLucideIcon("chevron-down", __iconNode$
|
|
60336
|
+
const __iconNode$x = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
60337
|
+
const ChevronDown = createLucideIcon("chevron-down", __iconNode$x);
|
|
60111
60338
|
/**
|
|
60112
60339
|
* @license lucide-react v0.575.0 - ISC
|
|
60113
60340
|
*
|
|
60114
60341
|
* This source code is licensed under the ISC license.
|
|
60115
60342
|
* See the LICENSE file in the root directory of this source tree.
|
|
60116
60343
|
*/
|
|
60117
|
-
const __iconNode$
|
|
60344
|
+
const __iconNode$w = [
|
|
60118
60345
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
60119
60346
|
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
60120
60347
|
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
60121
60348
|
];
|
|
60122
|
-
const CircleAlert = createLucideIcon("circle-alert", __iconNode$
|
|
60349
|
+
const CircleAlert = createLucideIcon("circle-alert", __iconNode$w);
|
|
60123
60350
|
/**
|
|
60124
60351
|
* @license lucide-react v0.575.0 - ISC
|
|
60125
60352
|
*
|
|
60126
60353
|
* This source code is licensed under the ISC license.
|
|
60127
60354
|
* See the LICENSE file in the root directory of this source tree.
|
|
60128
60355
|
*/
|
|
60129
|
-
const __iconNode$
|
|
60356
|
+
const __iconNode$v = [
|
|
60130
60357
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
60131
60358
|
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
60132
60359
|
];
|
|
60133
|
-
const CircleCheck = createLucideIcon("circle-check", __iconNode$
|
|
60360
|
+
const CircleCheck = createLucideIcon("circle-check", __iconNode$v);
|
|
60134
60361
|
/**
|
|
60135
60362
|
* @license lucide-react v0.575.0 - ISC
|
|
60136
60363
|
*
|
|
60137
60364
|
* This source code is licensed under the ISC license.
|
|
60138
60365
|
* See the LICENSE file in the root directory of this source tree.
|
|
60139
60366
|
*/
|
|
60140
|
-
const __iconNode$
|
|
60367
|
+
const __iconNode$u = [
|
|
60141
60368
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
60142
60369
|
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
|
|
60143
60370
|
["path", { d: "m9 9 6 6", key: "z0biqf" }]
|
|
60144
60371
|
];
|
|
60145
|
-
const CircleX = createLucideIcon("circle-x", __iconNode$
|
|
60372
|
+
const CircleX = createLucideIcon("circle-x", __iconNode$u);
|
|
60146
60373
|
/**
|
|
60147
60374
|
* @license lucide-react v0.575.0 - ISC
|
|
60148
60375
|
*
|
|
60149
60376
|
* This source code is licensed under the ISC license.
|
|
60150
60377
|
* See the LICENSE file in the root directory of this source tree.
|
|
60151
60378
|
*/
|
|
60152
|
-
const __iconNode$
|
|
60379
|
+
const __iconNode$t = [
|
|
60153
60380
|
["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
|
|
60154
60381
|
["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
|
|
60155
60382
|
];
|
|
60156
|
-
const Code = createLucideIcon("code", __iconNode$
|
|
60383
|
+
const Code = createLucideIcon("code", __iconNode$t);
|
|
60157
60384
|
/**
|
|
60158
60385
|
* @license lucide-react v0.575.0 - ISC
|
|
60159
60386
|
*
|
|
60160
60387
|
* This source code is licensed under the ISC license.
|
|
60161
60388
|
* See the LICENSE file in the root directory of this source tree.
|
|
60162
60389
|
*/
|
|
60163
|
-
const __iconNode$
|
|
60390
|
+
const __iconNode$s = [
|
|
60164
60391
|
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
60165
60392
|
["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" }]
|
|
60166
60393
|
];
|
|
60167
|
-
const Copy = createLucideIcon("copy", __iconNode$
|
|
60394
|
+
const Copy = createLucideIcon("copy", __iconNode$s);
|
|
60168
60395
|
/**
|
|
60169
60396
|
* @license lucide-react v0.575.0 - ISC
|
|
60170
60397
|
*
|
|
60171
60398
|
* This source code is licensed under the ISC license.
|
|
60172
60399
|
* See the LICENSE file in the root directory of this source tree.
|
|
60173
60400
|
*/
|
|
60174
|
-
const __iconNode$
|
|
60401
|
+
const __iconNode$r = [
|
|
60175
60402
|
["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
|
|
60176
60403
|
["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
|
|
60177
60404
|
["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
|
|
60178
60405
|
];
|
|
60179
|
-
const Database = createLucideIcon("database", __iconNode$
|
|
60406
|
+
const Database = createLucideIcon("database", __iconNode$r);
|
|
60180
60407
|
/**
|
|
60181
60408
|
* @license lucide-react v0.575.0 - ISC
|
|
60182
60409
|
*
|
|
60183
60410
|
* This source code is licensed under the ISC license.
|
|
60184
60411
|
* See the LICENSE file in the root directory of this source tree.
|
|
60185
60412
|
*/
|
|
60186
|
-
const __iconNode$
|
|
60413
|
+
const __iconNode$q = [
|
|
60187
60414
|
["path", { d: "M12 15V3", key: "m9g1x1" }],
|
|
60188
60415
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
60189
60416
|
["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
|
|
60190
60417
|
];
|
|
60191
|
-
const Download = createLucideIcon("download", __iconNode$
|
|
60418
|
+
const Download = createLucideIcon("download", __iconNode$q);
|
|
60192
60419
|
/**
|
|
60193
60420
|
* @license lucide-react v0.575.0 - ISC
|
|
60194
60421
|
*
|
|
60195
60422
|
* This source code is licensed under the ISC license.
|
|
60196
60423
|
* See the LICENSE file in the root directory of this source tree.
|
|
60197
60424
|
*/
|
|
60198
|
-
const __iconNode$
|
|
60425
|
+
const __iconNode$p = [
|
|
60199
60426
|
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
60200
60427
|
["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
|
|
60201
60428
|
["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
|
|
60202
60429
|
];
|
|
60203
|
-
const Ellipsis = createLucideIcon("ellipsis", __iconNode$
|
|
60430
|
+
const Ellipsis = createLucideIcon("ellipsis", __iconNode$p);
|
|
60204
60431
|
/**
|
|
60205
60432
|
* @license lucide-react v0.575.0 - ISC
|
|
60206
60433
|
*
|
|
60207
60434
|
* This source code is licensed under the ISC license.
|
|
60208
60435
|
* See the LICENSE file in the root directory of this source tree.
|
|
60209
60436
|
*/
|
|
60210
|
-
const __iconNode$
|
|
60437
|
+
const __iconNode$o = [
|
|
60211
60438
|
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
60212
60439
|
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
60213
60440
|
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
60214
60441
|
];
|
|
60215
|
-
const ExternalLink = createLucideIcon("external-link", __iconNode$
|
|
60442
|
+
const ExternalLink = createLucideIcon("external-link", __iconNode$o);
|
|
60216
60443
|
/**
|
|
60217
60444
|
* @license lucide-react v0.575.0 - ISC
|
|
60218
60445
|
*
|
|
60219
60446
|
* This source code is licensed under the ISC license.
|
|
60220
60447
|
* See the LICENSE file in the root directory of this source tree.
|
|
60221
60448
|
*/
|
|
60222
|
-
const __iconNode$
|
|
60449
|
+
const __iconNode$n = [
|
|
60223
60450
|
[
|
|
60224
60451
|
"path",
|
|
60225
60452
|
{
|
|
@@ -60231,14 +60458,14 @@ const __iconNode$l = [
|
|
|
60231
60458
|
["path", { d: "M9 15h6", key: "cctwl0" }],
|
|
60232
60459
|
["path", { d: "M12 18v-6", key: "17g6i2" }]
|
|
60233
60460
|
];
|
|
60234
|
-
const FilePlus = createLucideIcon("file-plus", __iconNode$
|
|
60461
|
+
const FilePlus = createLucideIcon("file-plus", __iconNode$n);
|
|
60235
60462
|
/**
|
|
60236
60463
|
* @license lucide-react v0.575.0 - ISC
|
|
60237
60464
|
*
|
|
60238
60465
|
* This source code is licensed under the ISC license.
|
|
60239
60466
|
* See the LICENSE file in the root directory of this source tree.
|
|
60240
60467
|
*/
|
|
60241
|
-
const __iconNode$
|
|
60468
|
+
const __iconNode$m = [
|
|
60242
60469
|
[
|
|
60243
60470
|
"path",
|
|
60244
60471
|
{
|
|
@@ -60252,14 +60479,14 @@ const __iconNode$k = [
|
|
|
60252
60479
|
["path", { d: "M8 17h2", key: "2yhykz" }],
|
|
60253
60480
|
["path", { d: "M14 17h2", key: "10kma7" }]
|
|
60254
60481
|
];
|
|
60255
|
-
const FileSpreadsheet = createLucideIcon("file-spreadsheet", __iconNode$
|
|
60482
|
+
const FileSpreadsheet = createLucideIcon("file-spreadsheet", __iconNode$m);
|
|
60256
60483
|
/**
|
|
60257
60484
|
* @license lucide-react v0.575.0 - ISC
|
|
60258
60485
|
*
|
|
60259
60486
|
* This source code is licensed under the ISC license.
|
|
60260
60487
|
* See the LICENSE file in the root directory of this source tree.
|
|
60261
60488
|
*/
|
|
60262
|
-
const __iconNode$
|
|
60489
|
+
const __iconNode$l = [
|
|
60263
60490
|
[
|
|
60264
60491
|
"path",
|
|
60265
60492
|
{
|
|
@@ -60272,14 +60499,14 @@ const __iconNode$j = [
|
|
|
60272
60499
|
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
60273
60500
|
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
60274
60501
|
];
|
|
60275
|
-
const FileText = createLucideIcon("file-text", __iconNode$
|
|
60502
|
+
const FileText = createLucideIcon("file-text", __iconNode$l);
|
|
60276
60503
|
/**
|
|
60277
60504
|
* @license lucide-react v0.575.0 - ISC
|
|
60278
60505
|
*
|
|
60279
60506
|
* This source code is licensed under the ISC license.
|
|
60280
60507
|
* See the LICENSE file in the root directory of this source tree.
|
|
60281
60508
|
*/
|
|
60282
|
-
const __iconNode$
|
|
60509
|
+
const __iconNode$k = [
|
|
60283
60510
|
[
|
|
60284
60511
|
"path",
|
|
60285
60512
|
{
|
|
@@ -60289,26 +60516,26 @@ const __iconNode$i = [
|
|
|
60289
60516
|
],
|
|
60290
60517
|
["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
|
|
60291
60518
|
];
|
|
60292
|
-
const File$1 = createLucideIcon("file", __iconNode$
|
|
60519
|
+
const File$1 = createLucideIcon("file", __iconNode$k);
|
|
60293
60520
|
/**
|
|
60294
60521
|
* @license lucide-react v0.575.0 - ISC
|
|
60295
60522
|
*
|
|
60296
60523
|
* This source code is licensed under the ISC license.
|
|
60297
60524
|
* See the LICENSE file in the root directory of this source tree.
|
|
60298
60525
|
*/
|
|
60299
|
-
const __iconNode$
|
|
60526
|
+
const __iconNode$j = [
|
|
60300
60527
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
60301
60528
|
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
|
|
60302
60529
|
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
60303
60530
|
];
|
|
60304
|
-
const Globe = createLucideIcon("globe", __iconNode$
|
|
60531
|
+
const Globe = createLucideIcon("globe", __iconNode$j);
|
|
60305
60532
|
/**
|
|
60306
60533
|
* @license lucide-react v0.575.0 - ISC
|
|
60307
60534
|
*
|
|
60308
60535
|
* This source code is licensed under the ISC license.
|
|
60309
60536
|
* See the LICENSE file in the root directory of this source tree.
|
|
60310
60537
|
*/
|
|
60311
|
-
const __iconNode$
|
|
60538
|
+
const __iconNode$i = [
|
|
60312
60539
|
[
|
|
60313
60540
|
"path",
|
|
60314
60541
|
{
|
|
@@ -60331,35 +60558,35 @@ const __iconNode$g = [
|
|
|
60331
60558
|
}
|
|
60332
60559
|
]
|
|
60333
60560
|
];
|
|
60334
|
-
const Layers = createLucideIcon("layers", __iconNode$
|
|
60561
|
+
const Layers = createLucideIcon("layers", __iconNode$i);
|
|
60335
60562
|
/**
|
|
60336
60563
|
* @license lucide-react v0.575.0 - ISC
|
|
60337
60564
|
*
|
|
60338
60565
|
* This source code is licensed under the ISC license.
|
|
60339
60566
|
* See the LICENSE file in the root directory of this source tree.
|
|
60340
60567
|
*/
|
|
60341
|
-
const __iconNode$
|
|
60568
|
+
const __iconNode$h = [
|
|
60342
60569
|
["rect", { width: "7", height: "7", x: "3", y: "3", rx: "1", key: "1g98yp" }],
|
|
60343
60570
|
["rect", { width: "7", height: "7", x: "14", y: "3", rx: "1", key: "6d4xhi" }],
|
|
60344
60571
|
["rect", { width: "7", height: "7", x: "14", y: "14", rx: "1", key: "nxv5o0" }],
|
|
60345
60572
|
["rect", { width: "7", height: "7", x: "3", y: "14", rx: "1", key: "1bb6yr" }]
|
|
60346
60573
|
];
|
|
60347
|
-
const LayoutGrid = createLucideIcon("layout-grid", __iconNode$
|
|
60574
|
+
const LayoutGrid = createLucideIcon("layout-grid", __iconNode$h);
|
|
60348
60575
|
/**
|
|
60349
60576
|
* @license lucide-react v0.575.0 - ISC
|
|
60350
60577
|
*
|
|
60351
60578
|
* This source code is licensed under the ISC license.
|
|
60352
60579
|
* See the LICENSE file in the root directory of this source tree.
|
|
60353
60580
|
*/
|
|
60354
|
-
const __iconNode$
|
|
60355
|
-
const LoaderCircle = createLucideIcon("loader-circle", __iconNode$
|
|
60581
|
+
const __iconNode$g = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
|
|
60582
|
+
const LoaderCircle = createLucideIcon("loader-circle", __iconNode$g);
|
|
60356
60583
|
/**
|
|
60357
60584
|
* @license lucide-react v0.575.0 - ISC
|
|
60358
60585
|
*
|
|
60359
60586
|
* This source code is licensed under the ISC license.
|
|
60360
60587
|
* See the LICENSE file in the root directory of this source tree.
|
|
60361
60588
|
*/
|
|
60362
|
-
const __iconNode$
|
|
60589
|
+
const __iconNode$f = [
|
|
60363
60590
|
["path", { d: "M12 2v4", key: "3427ic" }],
|
|
60364
60591
|
["path", { d: "m16.2 7.8 2.9-2.9", key: "r700ao" }],
|
|
60365
60592
|
["path", { d: "M18 12h4", key: "wj9ykh" }],
|
|
@@ -60369,63 +60596,79 @@ const __iconNode$d = [
|
|
|
60369
60596
|
["path", { d: "M2 12h4", key: "j09sii" }],
|
|
60370
60597
|
["path", { d: "m4.9 4.9 2.9 2.9", key: "giyufr" }]
|
|
60371
60598
|
];
|
|
60372
|
-
const Loader = createLucideIcon("loader", __iconNode$
|
|
60599
|
+
const Loader = createLucideIcon("loader", __iconNode$f);
|
|
60373
60600
|
/**
|
|
60374
60601
|
* @license lucide-react v0.575.0 - ISC
|
|
60375
60602
|
*
|
|
60376
60603
|
* This source code is licensed under the ISC license.
|
|
60377
60604
|
* See the LICENSE file in the root directory of this source tree.
|
|
60378
60605
|
*/
|
|
60379
|
-
const __iconNode$
|
|
60606
|
+
const __iconNode$e = [
|
|
60380
60607
|
["path", { d: "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7", key: "132q7q" }],
|
|
60381
60608
|
["rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", key: "izxlao" }]
|
|
60382
60609
|
];
|
|
60383
|
-
const Mail = createLucideIcon("mail", __iconNode$
|
|
60610
|
+
const Mail = createLucideIcon("mail", __iconNode$e);
|
|
60384
60611
|
/**
|
|
60385
60612
|
* @license lucide-react v0.575.0 - ISC
|
|
60386
60613
|
*
|
|
60387
60614
|
* This source code is licensed under the ISC license.
|
|
60388
60615
|
* See the LICENSE file in the root directory of this source tree.
|
|
60389
60616
|
*/
|
|
60390
|
-
const __iconNode$
|
|
60617
|
+
const __iconNode$d = [
|
|
60391
60618
|
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
60392
60619
|
["path", { d: "m21 3-7 7", key: "1l2asr" }],
|
|
60393
60620
|
["path", { d: "m3 21 7-7", key: "tjx5ai" }],
|
|
60394
60621
|
["path", { d: "M9 21H3v-6", key: "wtvkvv" }]
|
|
60395
60622
|
];
|
|
60396
|
-
const Maximize2 = createLucideIcon("maximize-2", __iconNode$
|
|
60623
|
+
const Maximize2 = createLucideIcon("maximize-2", __iconNode$d);
|
|
60397
60624
|
/**
|
|
60398
60625
|
* @license lucide-react v0.575.0 - ISC
|
|
60399
60626
|
*
|
|
60400
60627
|
* This source code is licensed under the ISC license.
|
|
60401
60628
|
* See the LICENSE file in the root directory of this source tree.
|
|
60402
60629
|
*/
|
|
60403
|
-
const __iconNode$
|
|
60630
|
+
const __iconNode$c = [
|
|
60631
|
+
[
|
|
60632
|
+
"path",
|
|
60633
|
+
{
|
|
60634
|
+
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",
|
|
60635
|
+
key: "18887p"
|
|
60636
|
+
}
|
|
60637
|
+
]
|
|
60638
|
+
];
|
|
60639
|
+
const MessageSquare = createLucideIcon("message-square", __iconNode$c);
|
|
60640
|
+
/**
|
|
60641
|
+
* @license lucide-react v0.575.0 - ISC
|
|
60642
|
+
*
|
|
60643
|
+
* This source code is licensed under the ISC license.
|
|
60644
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
60645
|
+
*/
|
|
60646
|
+
const __iconNode$b = [
|
|
60404
60647
|
["path", { d: "m14 10 7-7", key: "oa77jy" }],
|
|
60405
60648
|
["path", { d: "M20 10h-6V4", key: "mjg0md" }],
|
|
60406
60649
|
["path", { d: "m3 21 7-7", key: "tjx5ai" }],
|
|
60407
60650
|
["path", { d: "M4 14h6v6", key: "rmj7iw" }]
|
|
60408
60651
|
];
|
|
60409
|
-
const Minimize2 = createLucideIcon("minimize-2", __iconNode$
|
|
60652
|
+
const Minimize2 = createLucideIcon("minimize-2", __iconNode$b);
|
|
60410
60653
|
/**
|
|
60411
60654
|
* @license lucide-react v0.575.0 - ISC
|
|
60412
60655
|
*
|
|
60413
60656
|
* This source code is licensed under the ISC license.
|
|
60414
60657
|
* See the LICENSE file in the root directory of this source tree.
|
|
60415
60658
|
*/
|
|
60416
|
-
const __iconNode$
|
|
60659
|
+
const __iconNode$a = [
|
|
60417
60660
|
["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
|
|
60418
60661
|
["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
|
|
60419
60662
|
["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
|
|
60420
60663
|
];
|
|
60421
|
-
const Monitor = createLucideIcon("monitor", __iconNode$
|
|
60664
|
+
const Monitor = createLucideIcon("monitor", __iconNode$a);
|
|
60422
60665
|
/**
|
|
60423
60666
|
* @license lucide-react v0.575.0 - ISC
|
|
60424
60667
|
*
|
|
60425
60668
|
* This source code is licensed under the ISC license.
|
|
60426
60669
|
* See the LICENSE file in the root directory of this source tree.
|
|
60427
60670
|
*/
|
|
60428
|
-
const __iconNode$
|
|
60671
|
+
const __iconNode$9 = [
|
|
60429
60672
|
["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" }],
|
|
60430
60673
|
["path", { d: "M2 6h4", key: "aawbzj" }],
|
|
60431
60674
|
["path", { d: "M2 10h4", key: "l0bgd4" }],
|
|
@@ -60439,14 +60682,14 @@ const __iconNode$8 = [
|
|
|
60439
60682
|
}
|
|
60440
60683
|
]
|
|
60441
60684
|
];
|
|
60442
|
-
const NotebookPen = createLucideIcon("notebook-pen", __iconNode$
|
|
60685
|
+
const NotebookPen = createLucideIcon("notebook-pen", __iconNode$9);
|
|
60443
60686
|
/**
|
|
60444
60687
|
* @license lucide-react v0.575.0 - ISC
|
|
60445
60688
|
*
|
|
60446
60689
|
* This source code is licensed under the ISC license.
|
|
60447
60690
|
* See the LICENSE file in the root directory of this source tree.
|
|
60448
60691
|
*/
|
|
60449
|
-
const __iconNode$
|
|
60692
|
+
const __iconNode$8 = [
|
|
60450
60693
|
["path", { d: "M13 21h8", key: "1jsn5i" }],
|
|
60451
60694
|
[
|
|
60452
60695
|
"path",
|
|
@@ -60456,7 +60699,18 @@ const __iconNode$7 = [
|
|
|
60456
60699
|
}
|
|
60457
60700
|
]
|
|
60458
60701
|
];
|
|
60459
|
-
const PenLine = createLucideIcon("pen-line", __iconNode$
|
|
60702
|
+
const PenLine = createLucideIcon("pen-line", __iconNode$8);
|
|
60703
|
+
/**
|
|
60704
|
+
* @license lucide-react v0.575.0 - ISC
|
|
60705
|
+
*
|
|
60706
|
+
* This source code is licensed under the ISC license.
|
|
60707
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
60708
|
+
*/
|
|
60709
|
+
const __iconNode$7 = [
|
|
60710
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
60711
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
60712
|
+
];
|
|
60713
|
+
const Plus = createLucideIcon("plus", __iconNode$7);
|
|
60460
60714
|
/**
|
|
60461
60715
|
* @license lucide-react v0.575.0 - ISC
|
|
60462
60716
|
*
|
|
@@ -60556,12 +60810,14 @@ function CollapsibleTrigger({ ...props }) {
|
|
|
60556
60810
|
function CollapsibleContent({ ...props }) {
|
|
60557
60811
|
return /* @__PURE__ */ jsx(CollapsibleContent$1, { "data-slot": "collapsible-content", ...props });
|
|
60558
60812
|
}
|
|
60559
|
-
const useAssetPanelStore = create((set2) => ({
|
|
60813
|
+
const useAssetPanelStore = create((set2, get2) => ({
|
|
60560
60814
|
isOpen: false,
|
|
60561
60815
|
tabs: [],
|
|
60562
60816
|
activeTabId: null,
|
|
60563
60817
|
viewMode: "tabs",
|
|
60564
60818
|
isFullscreen: false,
|
|
60819
|
+
autoOpenGeneration: 0,
|
|
60820
|
+
autoOpenedAssets: /* @__PURE__ */ new Map(),
|
|
60565
60821
|
openAsset: (assetId, meta) => set2((s) => {
|
|
60566
60822
|
const existing = s.tabs.find((t) => t.id === assetId);
|
|
60567
60823
|
if (existing) {
|
|
@@ -60589,39 +60845,59 @@ const useAssetPanelStore = create((set2) => ({
|
|
|
60589
60845
|
setActiveTab: (assetId) => set2({ activeTabId: assetId, viewMode: "tabs" }),
|
|
60590
60846
|
setViewMode: (mode) => set2({ viewMode: mode }),
|
|
60591
60847
|
closePanel: () => set2({ isOpen: false, tabs: [], activeTabId: null, viewMode: "tabs", isFullscreen: false }),
|
|
60592
|
-
toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen }))
|
|
60848
|
+
toggleFullscreen: () => set2((s) => ({ isFullscreen: !s.isFullscreen })),
|
|
60849
|
+
resetAutoOpen: () => set2((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
|
|
60850
|
+
markAutoOpened: (assetId) => {
|
|
60851
|
+
const state = get2();
|
|
60852
|
+
if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
|
|
60853
|
+
return false;
|
|
60854
|
+
}
|
|
60855
|
+
state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
|
|
60856
|
+
return true;
|
|
60857
|
+
}
|
|
60593
60858
|
}));
|
|
60594
60859
|
const ANIMATION_DURATION = 200;
|
|
60595
60860
|
const TOOL_META = {
|
|
60596
|
-
|
|
60597
|
-
|
|
60598
|
-
|
|
60599
|
-
|
|
60600
|
-
|
|
60601
|
-
|
|
60602
|
-
|
|
60603
|
-
|
|
60604
|
-
|
|
60605
|
-
|
|
60606
|
-
|
|
60607
|
-
|
|
60608
|
-
|
|
60609
|
-
|
|
60610
|
-
|
|
60611
|
-
|
|
60612
|
-
|
|
60613
|
-
|
|
60614
|
-
|
|
60615
|
-
|
|
60616
|
-
|
|
60617
|
-
|
|
60618
|
-
|
|
60619
|
-
|
|
60620
|
-
|
|
60621
|
-
|
|
60622
|
-
|
|
60623
|
-
|
|
60624
|
-
|
|
60861
|
+
// Search & Browse
|
|
60862
|
+
search: { displayName: "Searching the web", icon: Search, describer: (a) => a.query ? `"${a.query}"` : "" },
|
|
60863
|
+
browse: { displayName: "Reading webpage", icon: Globe, describer: (a) => a.url ?? "" },
|
|
60864
|
+
search_email: { displayName: "Searching emails", icon: Mail, describer: (a) => a.query ? `"${a.query}"` : "" },
|
|
60865
|
+
unified_email_search: { displayName: "Searching emails", icon: Mail, describer: (a) => a.query ? `"${a.query}"` : "" },
|
|
60866
|
+
search_contacts: { displayName: "Looking up contacts", icon: Search },
|
|
60867
|
+
search_calendar_events: { displayName: "Checking calendar", icon: Search },
|
|
60868
|
+
search_assets: { displayName: "Searching files", icon: Search },
|
|
60869
|
+
list_contents: { displayName: "Browsing files", icon: Search },
|
|
60870
|
+
// Email
|
|
60871
|
+
create_email_draft: { displayName: "Drafting email", icon: Mail },
|
|
60872
|
+
unified_email_create_draft: { displayName: "Drafting email", icon: Mail },
|
|
60873
|
+
edit_email_draft: { displayName: "Editing email draft", icon: Mail },
|
|
60874
|
+
unified_edit_email_draft: { displayName: "Editing email draft", icon: Mail },
|
|
60875
|
+
// Documents
|
|
60876
|
+
read_full_asset: { displayName: "Reading document", icon: BookOpen },
|
|
60877
|
+
create_new_document: { displayName: "Creating document", icon: FileText },
|
|
60878
|
+
create_document_from_markdown: { displayName: "Creating document", icon: FileText },
|
|
60879
|
+
append_markdown_to_athena_document: { displayName: "Updating document", icon: PenLine },
|
|
60880
|
+
replace_markdown_in_athena_document: { displayName: "Updating document", icon: PenLine },
|
|
60881
|
+
// Spreadsheets
|
|
60882
|
+
create_new_sheet: { displayName: "Creating spreadsheet", icon: ChartColumn },
|
|
60883
|
+
update_sheet_range: { displayName: "Updating spreadsheet", icon: ChartColumn },
|
|
60884
|
+
// Presentations
|
|
60885
|
+
create_powerpoint_deck: { displayName: "Building presentation", icon: Monitor },
|
|
60886
|
+
execute_presentation_code: { displayName: "Generating slides", icon: Monitor },
|
|
60887
|
+
// Code & Data
|
|
60888
|
+
run_python_code: { displayName: "Running analysis", icon: Code },
|
|
60889
|
+
run_sql_query_tool: { displayName: "Querying data", icon: Database },
|
|
60890
|
+
create_database: { displayName: "Setting up database", icon: Database },
|
|
60891
|
+
run_database_sql: { displayName: "Querying database", icon: Database },
|
|
60892
|
+
computer_asset_exec: { displayName: "Running command", icon: Monitor },
|
|
60893
|
+
// Notebooks
|
|
60894
|
+
create_new_notebook: { displayName: "Creating notebook", icon: BookOpen },
|
|
60895
|
+
execute_cell: { displayName: "Running notebook cell", icon: Code },
|
|
60896
|
+
// Workflows
|
|
60897
|
+
create_new_aop: { displayName: "Creating workflow", icon: Brain },
|
|
60898
|
+
execute_aop: { displayName: "Running workflow", icon: Brain },
|
|
60899
|
+
// Preferences
|
|
60900
|
+
save_preference_as_memory: { displayName: "Saving preference", icon: Settings }
|
|
60625
60901
|
};
|
|
60626
60902
|
function getToolMeta(toolName) {
|
|
60627
60903
|
if (TOOL_META[toolName]) return TOOL_META[toolName];
|
|
@@ -60708,10 +60984,8 @@ function extractTitle(argsText, result) {
|
|
|
60708
60984
|
}
|
|
60709
60985
|
return null;
|
|
60710
60986
|
}
|
|
60711
|
-
let assetGeneration$1 = 0;
|
|
60712
|
-
const autoOpenedAssets$1 = /* @__PURE__ */ new Map();
|
|
60713
60987
|
function clearAutoOpenedAssets() {
|
|
60714
|
-
|
|
60988
|
+
useAssetPanelStore.getState().resetAutoOpen();
|
|
60715
60989
|
}
|
|
60716
60990
|
function ToolFallbackRoot({
|
|
60717
60991
|
className,
|
|
@@ -60746,7 +61020,7 @@ function ToolFallbackRoot({
|
|
|
60746
61020
|
open: isOpen,
|
|
60747
61021
|
onOpenChange: handleOpenChange,
|
|
60748
61022
|
className: cn(
|
|
60749
|
-
"aui-tool-fallback-root group/tool-fallback-root w-full rounded-xl border border-border/60 bg-background py-2.5 shadow-sm",
|
|
61023
|
+
"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",
|
|
60750
61024
|
className
|
|
60751
61025
|
),
|
|
60752
61026
|
style: {
|
|
@@ -60817,16 +61091,16 @@ function ToolFallbackTrigger({
|
|
|
60817
61091
|
),
|
|
60818
61092
|
children: [
|
|
60819
61093
|
/* @__PURE__ */ jsx("span", { children: isRunning ? /* @__PURE__ */ jsxs(Fragment$2, { children: [
|
|
60820
|
-
|
|
61094
|
+
meta.displayName,
|
|
60821
61095
|
"..."
|
|
60822
|
-
] }) :
|
|
61096
|
+
] }) : meta.displayName }),
|
|
60823
61097
|
isRunning && /* @__PURE__ */ jsxs(
|
|
60824
61098
|
"span",
|
|
60825
61099
|
{
|
|
60826
61100
|
"aria-hidden": true,
|
|
60827
61101
|
className: "shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none",
|
|
60828
61102
|
children: [
|
|
60829
|
-
|
|
61103
|
+
meta.displayName,
|
|
60830
61104
|
"..."
|
|
60831
61105
|
]
|
|
60832
61106
|
}
|
|
@@ -60960,17 +61234,19 @@ function AssetToolCard({
|
|
|
60960
61234
|
const assetType = toolMetaToAssetType(toolName);
|
|
60961
61235
|
const wasCompleteAtMount = useRef(isComplete);
|
|
60962
61236
|
useEffect(() => {
|
|
60963
|
-
if (isComplete && !isCancelled && assetId && !wasCompleteAtMount.current
|
|
60964
|
-
|
|
60965
|
-
|
|
60966
|
-
|
|
60967
|
-
|
|
60968
|
-
|
|
61237
|
+
if (isComplete && !isCancelled && assetId && !wasCompleteAtMount.current) {
|
|
61238
|
+
const store = useAssetPanelStore.getState();
|
|
61239
|
+
if (store.markAutoOpened(assetId)) {
|
|
61240
|
+
store.openAsset(assetId, {
|
|
61241
|
+
name: title ?? void 0,
|
|
61242
|
+
type: assetType
|
|
61243
|
+
});
|
|
61244
|
+
}
|
|
60969
61245
|
}
|
|
60970
61246
|
}, [isComplete, isCancelled, assetId, title, assetType]);
|
|
60971
61247
|
const success = isComplete && isResultSuccess(result);
|
|
60972
61248
|
return /* @__PURE__ */ jsxs("div", { className: cn(
|
|
60973
|
-
"aui-tool-fallback-root w-full rounded-xl border border-border/60 bg-background py-2.5 shadow-sm",
|
|
61249
|
+
"aui-tool-fallback-root my-3 w-full rounded-xl border border-border/60 bg-background py-2.5 shadow-sm",
|
|
60974
61250
|
isCancelled && "border-muted-foreground/30 bg-muted/30"
|
|
60975
61251
|
), children: [
|
|
60976
61252
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5 px-3 text-sm", children: [
|
|
@@ -60987,13 +61263,13 @@ function AssetToolCard({
|
|
|
60987
61263
|
}
|
|
60988
61264
|
),
|
|
60989
61265
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 grow flex-col items-start gap-0.5 text-left", children: [
|
|
60990
|
-
/* @__PURE__ */ jsxs("span", { className: "leading-tight", children: [
|
|
60991
|
-
|
|
61266
|
+
/* @__PURE__ */ jsxs("span", { className: "leading-tight font-medium", children: [
|
|
61267
|
+
meta.displayName,
|
|
60992
61268
|
isRunning && "..."
|
|
60993
61269
|
] }),
|
|
60994
61270
|
!isRunning && title && /* @__PURE__ */ jsx("span", { className: "max-w-full truncate text-xs leading-snug text-muted-foreground", children: title })
|
|
60995
61271
|
] }),
|
|
60996
|
-
assetId && isComplete && !isCancelled && /* @__PURE__ */ jsxs(
|
|
61272
|
+
assetId && isComplete && !isCancelled && CREATE_ASSET_TOOLS.includes(toolName.toLowerCase()) && /* @__PURE__ */ jsxs(
|
|
60997
61273
|
"button",
|
|
60998
61274
|
{
|
|
60999
61275
|
onClick: () => openAsset(assetId, { name: title ?? void 0, type: assetType }),
|
|
@@ -61415,11 +61691,15 @@ function normalizeResult(result) {
|
|
|
61415
61691
|
function truncate(text2, max2) {
|
|
61416
61692
|
return text2.length > max2 ? `${text2.slice(0, max2)}...` : text2;
|
|
61417
61693
|
}
|
|
61694
|
+
function formatToolName(name) {
|
|
61695
|
+
return name.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
61696
|
+
}
|
|
61418
61697
|
function ToolCard({
|
|
61419
61698
|
icon: Icon2,
|
|
61420
61699
|
status,
|
|
61421
61700
|
title,
|
|
61422
61701
|
subtitle,
|
|
61702
|
+
toolName,
|
|
61423
61703
|
badge,
|
|
61424
61704
|
error: error2,
|
|
61425
61705
|
children
|
|
@@ -61427,7 +61707,7 @@ function ToolCard({
|
|
|
61427
61707
|
const isRunning = status === "running";
|
|
61428
61708
|
const isComplete = status === "complete";
|
|
61429
61709
|
const isError = status === "incomplete";
|
|
61430
|
-
return /* @__PURE__ */ jsxs("div", { className: "my-
|
|
61710
|
+
return /* @__PURE__ */ jsxs("div", { className: "my-3 w-full overflow-hidden rounded-xl border border-border/60 bg-background shadow-sm", children: [
|
|
61431
61711
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-3", children: [
|
|
61432
61712
|
/* @__PURE__ */ jsx(
|
|
61433
61713
|
"div",
|
|
@@ -61443,11 +61723,12 @@ function ToolCard({
|
|
|
61443
61723
|
),
|
|
61444
61724
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
61445
61725
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
61446
|
-
/* @__PURE__ */ jsx("span", { className: "text-[13px] font-
|
|
61726
|
+
/* @__PURE__ */ jsx("span", { className: "text-[13px] font-medium text-foreground", children: title }),
|
|
61447
61727
|
isComplete && !error2 && /* @__PURE__ */ jsx(CircleCheck, { className: "size-3.5 text-emerald-500" })
|
|
61448
61728
|
] }),
|
|
61449
61729
|
subtitle && /* @__PURE__ */ jsx("p", { className: "truncate text-[12px] text-muted-foreground", children: subtitle })
|
|
61450
61730
|
] }),
|
|
61731
|
+
toolName && /* @__PURE__ */ 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) }),
|
|
61451
61732
|
badge && /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground", children: badge }),
|
|
61452
61733
|
isRunning && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
61453
61734
|
/* @__PURE__ */ jsx("div", { className: "h-1.5 w-10 animate-pulse rounded-full bg-blue-100" }),
|
|
@@ -61501,6 +61782,7 @@ function parseSearchResults(data) {
|
|
|
61501
61782
|
});
|
|
61502
61783
|
}
|
|
61503
61784
|
const WebSearchToolUIImpl = ({
|
|
61785
|
+
toolName,
|
|
61504
61786
|
args,
|
|
61505
61787
|
result,
|
|
61506
61788
|
status
|
|
@@ -61519,11 +61801,12 @@ const WebSearchToolUIImpl = ({
|
|
|
61519
61801
|
status: (status == null ? void 0 : status.type) ?? "complete",
|
|
61520
61802
|
title: isRunning ? "Searching the web..." : "Web search",
|
|
61521
61803
|
subtitle: query ? truncate(query, 80) : void 0,
|
|
61804
|
+
toolName,
|
|
61522
61805
|
badge: isComplete && results.length > 0 ? `${results.length} results` : void 0,
|
|
61523
61806
|
error: errorMsg,
|
|
61524
61807
|
children: isComplete && results.length > 0 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show search results", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2.5", children: results.map((r2, i) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
61525
61808
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
61526
|
-
r2.url ? /* @__PURE__ */ jsx(
|
|
61809
|
+
r2.url && /^https?:\/\//i.test(r2.url) ? /* @__PURE__ */ jsx(
|
|
61527
61810
|
"a",
|
|
61528
61811
|
{
|
|
61529
61812
|
href: r2.url,
|
|
@@ -61532,7 +61815,7 @@ const WebSearchToolUIImpl = ({
|
|
|
61532
61815
|
className: "text-[12px] font-medium text-blue-600 hover:underline",
|
|
61533
61816
|
children: r2.title || r2.url
|
|
61534
61817
|
}
|
|
61535
|
-
) : /* @__PURE__ */ jsx("span", { className: "text-[12px] font-medium text-foreground", children: r2.title || "Result" }),
|
|
61818
|
+
) : /* @__PURE__ */ jsx("span", { className: "text-[12px] font-medium text-foreground", children: r2.title || r2.url || "Result" }),
|
|
61536
61819
|
r2.url && /* @__PURE__ */ jsx(ExternalLink, { className: "size-3 shrink-0 text-muted-foreground" })
|
|
61537
61820
|
] }),
|
|
61538
61821
|
r2.url && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: truncate(r2.url, 60) }),
|
|
@@ -61546,6 +61829,7 @@ const WebSearchToolUI = memo(
|
|
|
61546
61829
|
);
|
|
61547
61830
|
WebSearchToolUI.displayName = "WebSearchToolUI";
|
|
61548
61831
|
const BrowseToolUIImpl = ({
|
|
61832
|
+
toolName,
|
|
61549
61833
|
args,
|
|
61550
61834
|
result,
|
|
61551
61835
|
status
|
|
@@ -61574,6 +61858,7 @@ const BrowseToolUIImpl = ({
|
|
|
61574
61858
|
status: (status == null ? void 0 : status.type) ?? "complete",
|
|
61575
61859
|
title: isRunning ? "Browsing page..." : pageTitle ? truncate(pageTitle, 50) : "Browsed page",
|
|
61576
61860
|
subtitle: displayUrl,
|
|
61861
|
+
toolName,
|
|
61577
61862
|
error: errorMsg,
|
|
61578
61863
|
children: isComplete && pageContent && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show page content", children: /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap break-words text-[11px] leading-relaxed text-muted-foreground", children: truncate(pageContent, 3e3) }) })
|
|
61579
61864
|
}
|
|
@@ -61597,6 +61882,7 @@ function parseEmailResults(data) {
|
|
|
61597
61882
|
});
|
|
61598
61883
|
}
|
|
61599
61884
|
const EmailSearchToolUIImpl = ({
|
|
61885
|
+
toolName,
|
|
61600
61886
|
args,
|
|
61601
61887
|
result,
|
|
61602
61888
|
status
|
|
@@ -61615,6 +61901,7 @@ const EmailSearchToolUIImpl = ({
|
|
|
61615
61901
|
status: (status == null ? void 0 : status.type) ?? "complete",
|
|
61616
61902
|
title: isRunning ? "Searching emails..." : "Email search",
|
|
61617
61903
|
subtitle: query ? truncate(query, 80) : void 0,
|
|
61904
|
+
toolName,
|
|
61618
61905
|
badge: isComplete && emails.length > 0 ? `${emails.length} emails` : void 0,
|
|
61619
61906
|
error: errorMsg,
|
|
61620
61907
|
children: isComplete && emails.length > 0 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show email results", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col divide-y divide-border/30", children: emails.map((email, i) => /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-0.5 py-2", i === 0 && "pt-0"), children: [
|
|
@@ -61639,16 +61926,15 @@ function extractAssetId(result) {
|
|
|
61639
61926
|
if (typeof id === "string" && id.startsWith("asset_")) return id;
|
|
61640
61927
|
return null;
|
|
61641
61928
|
}
|
|
61642
|
-
let assetGeneration = 0;
|
|
61643
|
-
const autoOpenedAssets = /* @__PURE__ */ new Map();
|
|
61644
61929
|
function resetAssetAutoOpen() {
|
|
61645
|
-
|
|
61930
|
+
useAssetPanelStore.getState().resetAutoOpen();
|
|
61646
61931
|
}
|
|
61647
61932
|
function CreateAssetToolUIImpl({
|
|
61648
61933
|
icon: Icon2,
|
|
61649
61934
|
assetType,
|
|
61650
61935
|
runningLabel,
|
|
61651
61936
|
doneLabel,
|
|
61937
|
+
toolName,
|
|
61652
61938
|
args,
|
|
61653
61939
|
result,
|
|
61654
61940
|
status
|
|
@@ -61665,12 +61951,14 @@ function CreateAssetToolUIImpl({
|
|
|
61665
61951
|
const openAsset = useAssetPanelStore((s) => s.openAsset);
|
|
61666
61952
|
const wasCompleteAtMount = useRef(isComplete);
|
|
61667
61953
|
useEffect(() => {
|
|
61668
|
-
if (isComplete && !isCancelled && assetId && !wasCompleteAtMount.current
|
|
61669
|
-
|
|
61670
|
-
|
|
61671
|
-
|
|
61672
|
-
|
|
61673
|
-
|
|
61954
|
+
if (isComplete && !isCancelled && assetId && !wasCompleteAtMount.current) {
|
|
61955
|
+
const store = useAssetPanelStore.getState();
|
|
61956
|
+
if (store.markAutoOpened(assetId)) {
|
|
61957
|
+
store.openAsset(assetId, {
|
|
61958
|
+
name: createdName || name || void 0,
|
|
61959
|
+
type: assetType
|
|
61960
|
+
});
|
|
61961
|
+
}
|
|
61674
61962
|
}
|
|
61675
61963
|
}, [isComplete, isCancelled, assetId, createdName, name, assetType]);
|
|
61676
61964
|
const handleOpen = () => {
|
|
@@ -61688,6 +61976,7 @@ function CreateAssetToolUIImpl({
|
|
|
61688
61976
|
status: (status == null ? void 0 : status.type) ?? "complete",
|
|
61689
61977
|
title: isRunning ? runningLabel : doneLabel,
|
|
61690
61978
|
subtitle: createdName || name || void 0,
|
|
61979
|
+
toolName,
|
|
61691
61980
|
error: errorMsg,
|
|
61692
61981
|
children: assetId && isComplete && !isCancelled && /* @__PURE__ */ jsx("div", { className: "border-t border-border/40 px-4 py-2", children: /* @__PURE__ */ jsxs(
|
|
61693
61982
|
"button",
|
|
@@ -61747,6 +62036,7 @@ const CreatePresentationToolUI = memo(
|
|
|
61747
62036
|
);
|
|
61748
62037
|
CreatePresentationToolUI.displayName = "CreatePresentationToolUI";
|
|
61749
62038
|
const CreateEmailDraftToolUIImpl = ({
|
|
62039
|
+
toolName,
|
|
61750
62040
|
args,
|
|
61751
62041
|
result,
|
|
61752
62042
|
status
|
|
@@ -61762,6 +62052,7 @@ const CreateEmailDraftToolUIImpl = ({
|
|
|
61762
62052
|
icon: Mail,
|
|
61763
62053
|
status: (status == null ? void 0 : status.type) ?? "complete",
|
|
61764
62054
|
title: isRunning ? "Creating email draft..." : "Email draft created",
|
|
62055
|
+
toolName,
|
|
61765
62056
|
subtitle: subject ? truncate(subject, 60) : to ? `To: ${truncate(to, 40)}` : void 0,
|
|
61766
62057
|
error: errorMsg
|
|
61767
62058
|
}
|
|
@@ -61781,7 +62072,6 @@ const TOOL_UI_REGISTRY = {
|
|
|
61781
62072
|
create_new_document: CreateDocumentToolUI,
|
|
61782
62073
|
create_document_from_markdown: CreateDocumentToolUI,
|
|
61783
62074
|
create_new_sheet: CreateSheetToolUI,
|
|
61784
|
-
update_sheet_range: CreateSheetToolUI,
|
|
61785
62075
|
create_powerpoint_deck: CreatePresentationToolUI
|
|
61786
62076
|
};
|
|
61787
62077
|
const falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
@@ -62080,7 +62370,8 @@ function useAssetEmbed(assetId, options = {
|
|
|
62080
62370
|
setError(null);
|
|
62081
62371
|
return;
|
|
62082
62372
|
}
|
|
62083
|
-
const
|
|
62373
|
+
const cacheKey = `${assetId}:${readOnly}:${token ?? apiKey ?? "anon"}`;
|
|
62374
|
+
const cached = embedCache.get(cacheKey);
|
|
62084
62375
|
if (cached && cached.expiresAt > Date.now() / 1e3) {
|
|
62085
62376
|
setEmbedUrl(cached.url);
|
|
62086
62377
|
setIsLoading(false);
|
|
@@ -62116,7 +62407,7 @@ function useAssetEmbed(assetId, options = {
|
|
|
62116
62407
|
}
|
|
62117
62408
|
return res.json();
|
|
62118
62409
|
}).then((data) => {
|
|
62119
|
-
embedCache.set(assetId
|
|
62410
|
+
embedCache.set(`${assetId}:${readOnly}:${token ?? apiKey ?? "anon"}`, { url: data.embed_url, expiresAt: data.expires_at });
|
|
62120
62411
|
setEmbedUrl(data.embed_url);
|
|
62121
62412
|
setIsLoading(false);
|
|
62122
62413
|
}).catch((err) => {
|
|
@@ -62368,6 +62659,103 @@ const AthenaLayout = ({
|
|
|
62368
62659
|
/* @__PURE__ */ jsx("div", { className: "flex h-full flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx(AssetPanel, {}) })
|
|
62369
62660
|
] });
|
|
62370
62661
|
};
|
|
62662
|
+
function useThreadList() {
|
|
62663
|
+
const store = useThreadListStore();
|
|
62664
|
+
return useStore$1(store);
|
|
62665
|
+
}
|
|
62666
|
+
function useActiveThreadId() {
|
|
62667
|
+
const store = useThreadListStore();
|
|
62668
|
+
return useStore$1(store, (s) => s.activeThreadId);
|
|
62669
|
+
}
|
|
62670
|
+
function ThreadList({ className }) {
|
|
62671
|
+
const {
|
|
62672
|
+
threads,
|
|
62673
|
+
activeThreadId,
|
|
62674
|
+
isLoading,
|
|
62675
|
+
fetchThreads,
|
|
62676
|
+
switchThread,
|
|
62677
|
+
newThread,
|
|
62678
|
+
archiveThread: archiveThread2
|
|
62679
|
+
} = useThreadList();
|
|
62680
|
+
useEffect(() => {
|
|
62681
|
+
fetchThreads();
|
|
62682
|
+
}, [fetchThreads]);
|
|
62683
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
62684
|
+
/* @__PURE__ */ jsxs(
|
|
62685
|
+
"button",
|
|
62686
|
+
{
|
|
62687
|
+
onClick: () => newThread(),
|
|
62688
|
+
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",
|
|
62689
|
+
children: [
|
|
62690
|
+
/* @__PURE__ */ jsx(Plus, { className: "size-4" }),
|
|
62691
|
+
"New Chat"
|
|
62692
|
+
]
|
|
62693
|
+
}
|
|
62694
|
+
),
|
|
62695
|
+
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(
|
|
62696
|
+
"div",
|
|
62697
|
+
{
|
|
62698
|
+
className: cn(
|
|
62699
|
+
"group flex items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors cursor-pointer",
|
|
62700
|
+
activeThreadId === thread.thread_id ? "bg-muted/50 text-foreground" : "text-muted-foreground hover:bg-muted/30 hover:text-foreground"
|
|
62701
|
+
),
|
|
62702
|
+
onClick: () => switchThread(thread.thread_id),
|
|
62703
|
+
children: [
|
|
62704
|
+
/* @__PURE__ */ jsx(MessageSquare, { className: "size-3.5 shrink-0" }),
|
|
62705
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: thread.title || "Untitled" }),
|
|
62706
|
+
/* @__PURE__ */ jsx(
|
|
62707
|
+
"button",
|
|
62708
|
+
{
|
|
62709
|
+
onClick: (e) => {
|
|
62710
|
+
e.stopPropagation();
|
|
62711
|
+
archiveThread2(thread.thread_id);
|
|
62712
|
+
},
|
|
62713
|
+
className: "hidden size-5 items-center justify-center rounded text-muted-foreground/60 transition-colors hover:bg-muted hover:text-foreground group-hover:flex",
|
|
62714
|
+
title: "Archive",
|
|
62715
|
+
children: /* @__PURE__ */ jsx(Archive, { className: "size-3" })
|
|
62716
|
+
}
|
|
62717
|
+
)
|
|
62718
|
+
]
|
|
62719
|
+
},
|
|
62720
|
+
thread.thread_id
|
|
62721
|
+
)) })
|
|
62722
|
+
] });
|
|
62723
|
+
}
|
|
62724
|
+
function useAppendToComposer() {
|
|
62725
|
+
const aui = useAui();
|
|
62726
|
+
return useCallback(
|
|
62727
|
+
(text2, opts) => {
|
|
62728
|
+
const composer = aui.composer();
|
|
62729
|
+
if (opts == null ? void 0 : opts.replace) {
|
|
62730
|
+
composer.setText(text2);
|
|
62731
|
+
} else {
|
|
62732
|
+
const current = composer.getState().text;
|
|
62733
|
+
composer.setText(current ? `${current}
|
|
62734
|
+
${text2}` : text2);
|
|
62735
|
+
}
|
|
62736
|
+
},
|
|
62737
|
+
[aui]
|
|
62738
|
+
);
|
|
62739
|
+
}
|
|
62740
|
+
function useComposerAttachment() {
|
|
62741
|
+
const aui = useAui();
|
|
62742
|
+
const addFile = useCallback(
|
|
62743
|
+
(file) => {
|
|
62744
|
+
aui.composer().addAttachment(file);
|
|
62745
|
+
},
|
|
62746
|
+
[aui]
|
|
62747
|
+
);
|
|
62748
|
+
const addContent = useCallback(
|
|
62749
|
+
(name, content) => {
|
|
62750
|
+
aui.composer().addAttachment({ name, content });
|
|
62751
|
+
},
|
|
62752
|
+
[aui]
|
|
62753
|
+
);
|
|
62754
|
+
const clear = useCallback(() => {
|
|
62755
|
+
aui.composer().clearAttachments();
|
|
62756
|
+
}, [aui]);
|
|
62757
|
+
return { addFile, addContent, clear };
|
|
62758
|
+
}
|
|
62371
62759
|
export {
|
|
62372
62760
|
AppendDocumentToolUI,
|
|
62373
62761
|
AssetPanel,
|
|
@@ -62387,6 +62775,7 @@ export {
|
|
|
62387
62775
|
EmailSearchToolUI,
|
|
62388
62776
|
ReadAssetToolUI,
|
|
62389
62777
|
TOOL_UI_REGISTRY,
|
|
62778
|
+
ThreadList,
|
|
62390
62779
|
TiptapComposer,
|
|
62391
62780
|
TiptapText,
|
|
62392
62781
|
ToolFallback,
|
|
@@ -62405,14 +62794,19 @@ export {
|
|
|
62405
62794
|
buttonVariants,
|
|
62406
62795
|
clearAutoOpenedAssets,
|
|
62407
62796
|
cn,
|
|
62797
|
+
createThreadListStore,
|
|
62408
62798
|
getAssetInfo,
|
|
62409
62799
|
resetAssetAutoOpen,
|
|
62410
62800
|
tryParseJson$1 as tryParseJson,
|
|
62801
|
+
useActiveThreadId,
|
|
62802
|
+
useAppendToComposer,
|
|
62411
62803
|
useAssetEmbed,
|
|
62412
62804
|
useAssetPanelStore,
|
|
62413
62805
|
useAthenaConfig,
|
|
62414
62806
|
useAthenaRuntime,
|
|
62807
|
+
useComposerAttachment,
|
|
62415
62808
|
useMentionSuggestions,
|
|
62416
|
-
useParentAuth
|
|
62809
|
+
useParentAuth,
|
|
62810
|
+
useThreadList
|
|
62417
62811
|
};
|
|
62418
62812
|
//# sourceMappingURL=index.js.map
|