@athenaintel/react 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -39
- package/dist/AthenaContext-B1QMhIP-.cjs.map +1 -1
- package/dist/AthenaContext-MOslgOmE.js.map +1 -1
- package/dist/chat/statewire-banners.d.ts +5 -9
- package/dist/chat-ui/index.d.ts +3 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +24 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +5 -0
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +1 -1
- package/dist/chat-ui/messages/continue-pill.d.ts +13 -0
- package/dist/chat-ui/messages/message-components.d.ts +7 -2
- package/dist/chat-ui/messages/runtime-message.d.ts +22 -0
- package/dist/chat-ui/messages/statewire-continue-run.d.ts +41 -0
- package/dist/chat-ui/thread/chat-composer-dock.d.ts +1 -1
- package/dist/chat-ui.cjs +279 -56
- package/dist/chat-ui.cjs.map +1 -1
- package/dist/chat-ui.js +312 -89
- package/dist/chat-ui.js.map +1 -1
- package/dist/diagnostics/athena-diagnostics.d.ts +1 -1
- package/dist/diagnostics/errors.d.ts +0 -4
- package/dist/index.cjs +18834 -21869
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -8
- package/dist/index.js +18849 -21884
- package/dist/index.js.map +1 -1
- package/dist/lib/athena-urls.d.ts +0 -2
- package/dist/lib/posthog/wrap-posthog-client.d.ts +3 -1
- package/dist/provider/AthenaContext.d.ts +0 -7
- package/dist/provider/AthenaProvider.d.ts +25 -51
- package/dist/provider/config.d.ts +11 -14
- package/dist/provider/statewire-lifecycle-context.d.ts +3 -4
- package/dist/provider/types.d.ts +0 -1
- package/dist/runtime/statewire-lifecycle.d.ts +0 -1
- package/dist/runtime/statewire-run-config.d.ts +18 -5
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +6 -11
- package/dist/styles.css +1 -1
- package/dist/threads/ThreadList.d.ts +6 -1
- package/dist/threads/statewire-thread-list.d.ts +6 -5
- package/dist/threads/thread-id-context.d.ts +9 -0
- package/dist/threads/use-statewire-conversation-history.d.ts +2 -0
- package/dist/threads/useAthenaThreadManager.d.ts +24 -12
- package/dist/{use-rest-conversation-history-DpEswBqQ.js → use-rest-conversation-history-Bs5qn5G3.js} +7500 -6959
- package/dist/use-rest-conversation-history-Bs5qn5G3.js.map +1 -0
- package/dist/{use-rest-conversation-history-BdnG8jEP.cjs → use-rest-conversation-history-Dm0rdQgT.cjs} +7311 -6770
- package/dist/use-rest-conversation-history-Dm0rdQgT.cjs.map +1 -0
- package/package.json +3 -3
- package/dist/runtime/converter.d.ts +0 -5
- package/dist/runtime/external-message-converter.d.ts +0 -21
- package/dist/runtime/schemas.d.ts +0 -24
- package/dist/runtime/transport.d.ts +0 -39
- package/dist/runtime/useAthenaRuntime.d.ts +0 -47
- package/dist/threads/adapter.d.ts +0 -42
- package/dist/threads/useActiveThreadStateHydration.d.ts +0 -12
- package/dist/threads/useThreadTitlePolling.d.ts +0 -14
- package/dist/use-rest-conversation-history-BdnG8jEP.cjs.map +0 -1
- package/dist/use-rest-conversation-history-DpEswBqQ.js.map +0 -1
package/dist/chat-ui.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { as as createLucideIcon, O as cn, bO as THREAD_HEADER_ACTIONS_CLASS, bP as THREAD_HEADER_PILL_CLASS, bQ as THREAD_HEADER_CLASS, b2 as RefreshCw, bo as Plus, ba as Search, bf as LoaderCircle, bA as conversationDisplayTitle, bR as assetTypeToThumb, ay as MessageSquare, ai as Node, a0 as mergeAttributes, ao as Extension, aU as Suggestion, aS as useFloating, aT as FloatingPortal, N as autoUpdate, F as offset, I as flip, G as shift, aQ as getFilteredItems, bS as getFetchState, bT as getEntry, bU as updateFetchState, aY as addItems, aX as registerSource, bV as bindScopes, aP as useStore, bn as File$1, aF as FileText, au as Workflow, aI as BookOpen, bd as Sheet, bb as Table, aG as Database, aH as Calendar, az as Mail, bc as Image, ax as Monitor, b9 as Code, be as Camera, aA as LayoutGrid, aB as HardDrive, aw as Package, at as Wrench, av as Users, aC as Globe, aD as FolderKanban, aE as Folder, aW as Store, bW as getSearchScope, bX as fetchGraphQL, bY as PAGINATED_ASSETS_QUERY, bZ as WORKSPACE_MEMBERS_QUERY, b_ as SIMPLE_SEARCH_QUERY, b$ as assetTypeToIcon, c0 as TOOL_CATALOG_QUERY, c1 as useMentionAuth, a_ as createScopeRegistry, aZ as createItemCache, aM as useEditor, aO as StarterKit, b1 as Placeholder, aN as EditorContent, b8 as Play, c2 as readRunMarkerFromSourceMessages, b3 as hasStatewireThreadExtras, b6 as useDeepAgentThreadStatus, c3 as ATHENA_RUN_MARKER_CANCELLED, c4 as ATHENA_RUN_MARKER_FAILED, c5 as readRuntimeMessageFromSourceMessages, c6 as RuntimeMessageCard } from "./use-rest-conversation-history-Bs5qn5G3.js";
|
|
5
|
+
import { c7, c8, c9, ca, cb, bi, bh, cc, bj, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm, cn as cn2, co, cp, cq, cr, cs, ct, cu, cv, cw, cx, cy, cz } from "./use-rest-conversation-history-Bs5qn5G3.js";
|
|
6
6
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
7
7
|
import { useMemo, useEffect, useState, useRef, Fragment, useImperativeHandle, forwardRef, useCallback, useId } from "react";
|
|
8
|
-
import { useAui, unstable_useComposerInput } from "@assistant-ui/react";
|
|
8
|
+
import { useAui, unstable_useComposerInput, useAuiState } from "@assistant-ui/react";
|
|
9
9
|
import "@assistant-ui/tap";
|
|
10
10
|
import "statewire";
|
|
11
11
|
import "@assistant-ui/store";
|
|
12
|
-
import "@assistant-ui/react-statewire";
|
|
12
|
+
import { useStatewireRuns, useStatewireSendCommand } from "@assistant-ui/react-statewire";
|
|
13
|
+
import "@assistant-ui/core";
|
|
13
14
|
const mentionHandlersByThread = /* @__PURE__ */ new Map();
|
|
14
15
|
function registerChatAssetMentionHandler(threadId, handler) {
|
|
15
16
|
mentionHandlersByThread.set(threadId, handler);
|
|
@@ -19,6 +20,18 @@ function registerChatAssetMentionHandler(threadId, handler) {
|
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* @license lucide-react v0.575.0 - ISC
|
|
25
|
+
*
|
|
26
|
+
* This source code is licensed under the ISC license.
|
|
27
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
28
|
+
*/
|
|
29
|
+
const __iconNode$m = [
|
|
30
|
+
["rect", { width: "20", height: "5", x: "2", y: "3", rx: "1", key: "1wp1u1" }],
|
|
31
|
+
["path", { d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8", key: "1s80jp" }],
|
|
32
|
+
["path", { d: "M10 12h4", key: "a56b0p" }]
|
|
33
|
+
];
|
|
34
|
+
const Archive = createLucideIcon("archive", __iconNode$m);
|
|
22
35
|
/**
|
|
23
36
|
* @license lucide-react v0.575.0 - ISC
|
|
24
37
|
*
|
|
@@ -689,8 +702,8 @@ function ConversationHistoryPanel({
|
|
|
689
702
|
);
|
|
690
703
|
}
|
|
691
704
|
function makeMentionUrl(attrs) {
|
|
692
|
-
if (attrs.type === "tool") {
|
|
693
|
-
return `mention
|
|
705
|
+
if (attrs.type === "tool" || attrs.type === "toolkit") {
|
|
706
|
+
return `mention://${attrs.type}?name=${encodeURIComponent(attrs.id)}&description=${encodeURIComponent(attrs.description ?? "")}`;
|
|
694
707
|
}
|
|
695
708
|
if (attrs.type === "asset") {
|
|
696
709
|
const params2 = new URLSearchParams({ asset_ids: attrs.id });
|
|
@@ -1147,6 +1160,13 @@ const ICON_MAP = {
|
|
|
1147
1160
|
presentation: FileText
|
|
1148
1161
|
// Fallback for presentation type
|
|
1149
1162
|
};
|
|
1163
|
+
function toKebabIconName(name) {
|
|
1164
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").toLowerCase();
|
|
1165
|
+
}
|
|
1166
|
+
function resolveIcon(name) {
|
|
1167
|
+
return ICON_MAP[name] ?? ICON_MAP[toKebabIconName(name)];
|
|
1168
|
+
}
|
|
1169
|
+
const ICON_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9-]*$/;
|
|
1150
1170
|
function MentionIcon({
|
|
1151
1171
|
fallbackIcon,
|
|
1152
1172
|
thumbnailUrl,
|
|
@@ -1156,9 +1176,11 @@ function MentionIcon({
|
|
|
1156
1176
|
if (thumbnailUrl) {
|
|
1157
1177
|
return /* @__PURE__ */ jsx("img", { src: thumbnailUrl, alt: alt ?? "", className });
|
|
1158
1178
|
}
|
|
1159
|
-
const Icon = fallbackIcon ?
|
|
1179
|
+
const Icon = fallbackIcon ? resolveIcon(fallbackIcon) : void 0;
|
|
1160
1180
|
if (Icon) return /* @__PURE__ */ jsx(Icon, { className });
|
|
1161
|
-
if (fallbackIcon
|
|
1181
|
+
if (fallbackIcon && !ICON_NAME_PATTERN.test(fallbackIcon)) {
|
|
1182
|
+
return /* @__PURE__ */ jsx("span", { className: "text-sm flex-shrink-0", children: fallbackIcon });
|
|
1183
|
+
}
|
|
1162
1184
|
return /* @__PURE__ */ jsx(File$1, { className });
|
|
1163
1185
|
}
|
|
1164
1186
|
function MenuItemRow({
|
|
@@ -1168,7 +1190,7 @@ function MenuItemRow({
|
|
|
1168
1190
|
onClick,
|
|
1169
1191
|
showArrow
|
|
1170
1192
|
}) {
|
|
1171
|
-
var _a, _b;
|
|
1193
|
+
var _a, _b, _c, _d;
|
|
1172
1194
|
const hasTwoLines = item.type === "tool" && item.description || item.type === "user" && item.email || item.type === "workspace_item" && item.description || item.type === "tab" && item.description;
|
|
1173
1195
|
return /* @__PURE__ */ jsxs(
|
|
1174
1196
|
"div",
|
|
@@ -1184,23 +1206,31 @@ function MenuItemRow({
|
|
|
1184
1206
|
isSelected && "bg-gray-100 is-selected"
|
|
1185
1207
|
),
|
|
1186
1208
|
children: [
|
|
1187
|
-
/* @__PURE__ */ jsx(
|
|
1188
|
-
|
|
1209
|
+
/* @__PURE__ */ jsx(
|
|
1210
|
+
"span",
|
|
1189
1211
|
{
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1212
|
+
className: `flex items-center flex-shrink-0 ${hasTwoLines ? "self-start mt-0.5" : ""}`,
|
|
1213
|
+
children: /* @__PURE__ */ jsx(
|
|
1214
|
+
MentionIcon,
|
|
1215
|
+
{
|
|
1216
|
+
fallbackIcon: item.fallbackIcon,
|
|
1217
|
+
thumbnailUrl: item.thumbnailUrl,
|
|
1218
|
+
alt: item.name
|
|
1219
|
+
}
|
|
1220
|
+
)
|
|
1193
1221
|
}
|
|
1194
|
-
)
|
|
1222
|
+
),
|
|
1195
1223
|
hasTwoLines ? /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-0 min-w-0 -mt-0.5", children: [
|
|
1196
1224
|
/* @__PURE__ */ jsxs("span", { className: "text-sm leading-tight flex items-center gap-1.5", children: [
|
|
1197
1225
|
item.name,
|
|
1198
|
-
((_a = item.extra) == null ? void 0 : _a.isAdminOnly) && /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-purple-400 flex-shrink-0" })
|
|
1226
|
+
((_a = item.extra) == null ? void 0 : _a.isAdminOnly) && /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-purple-400 flex-shrink-0" }),
|
|
1227
|
+
((_b = item.extra) == null ? void 0 : _b.isExperimental) && /* @__PURE__ */ jsx("span", { className: "rounded-full bg-blue-50 px-1.5 py-0.5 text-[9px] font-medium text-blue-700", children: "Experimental" })
|
|
1199
1228
|
] }),
|
|
1200
1229
|
/* @__PURE__ */ jsx("span", { className: "text-xs text-gray-500 leading-tight mt-0.5 truncate", children: item.type === "user" ? item.email : item.description })
|
|
1201
1230
|
] }) : /* @__PURE__ */ jsxs("span", { className: "flex-1 text-sm truncate min-w-0 flex items-center gap-1.5", children: [
|
|
1202
1231
|
item.name,
|
|
1203
|
-
((
|
|
1232
|
+
((_c = item.extra) == null ? void 0 : _c.isAdminOnly) && /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-purple-400 flex-shrink-0" }),
|
|
1233
|
+
((_d = item.extra) == null ? void 0 : _d.isExperimental) && /* @__PURE__ */ jsx("span", { className: "rounded-full bg-blue-50 px-1.5 py-0.5 text-[9px] font-medium text-blue-700", children: "Experimental" })
|
|
1204
1234
|
] }),
|
|
1205
1235
|
showArrow && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 flex-shrink-0", children: /* @__PURE__ */ jsx("span", { className: "text-gray-400 text-sm px-1 rounded transition-all cursor-pointer hover:text-gray-600 hover:bg-gray-200", children: "→" }) })
|
|
1206
1236
|
]
|
|
@@ -1559,17 +1589,19 @@ const MentionSuggestionList = forwardRef(({ store, editor, query, command, close
|
|
|
1559
1589
|
MentionSuggestionList.displayName = "MentionSuggestionList";
|
|
1560
1590
|
function assetToMenuItem(asset) {
|
|
1561
1591
|
const isFolder = asset.athenaOriginalType === "folder";
|
|
1592
|
+
const displayType = asset.athenaConvertedType || asset.athenaOriginalType;
|
|
1562
1593
|
return {
|
|
1563
1594
|
id: asset.id,
|
|
1564
1595
|
name: asset.title || "Untitled",
|
|
1565
1596
|
type: isFolder ? "folder" : "asset",
|
|
1566
|
-
thumbnailUrl: assetTypeToThumb(
|
|
1567
|
-
fallbackIcon: assetTypeToIcon(
|
|
1597
|
+
thumbnailUrl: assetTypeToThumb(displayType),
|
|
1598
|
+
fallbackIcon: assetTypeToIcon(displayType),
|
|
1568
1599
|
navigatesToScope: isFolder ? asset.id : void 0,
|
|
1569
1600
|
visibleInScopes: /* @__PURE__ */ new Set(),
|
|
1570
1601
|
updatedAt: asset.updatedAt ?? void 0,
|
|
1571
1602
|
extra: {
|
|
1572
1603
|
athenaOriginalType: asset.athenaOriginalType,
|
|
1604
|
+
athenaConvertedType: asset.athenaConvertedType,
|
|
1573
1605
|
parentFolderId: asset.parentFolderId
|
|
1574
1606
|
}
|
|
1575
1607
|
};
|
|
@@ -1590,11 +1622,7 @@ async function querySimpleSearch(auth, opts) {
|
|
|
1590
1622
|
sort: { field: "UPDATED_AT", direction: "DESC" },
|
|
1591
1623
|
filterColumns: { isArchived: false, isHidden: false }
|
|
1592
1624
|
};
|
|
1593
|
-
const data = await fetchGraphQL(
|
|
1594
|
-
auth,
|
|
1595
|
-
SIMPLE_SEARCH_QUERY,
|
|
1596
|
-
{ input }
|
|
1597
|
-
);
|
|
1625
|
+
const data = await fetchGraphQL(auth, SIMPLE_SEARCH_QUERY, { input });
|
|
1598
1626
|
const assets = ((_b = data.simpleSearch) == null ? void 0 : _b.assets) || [];
|
|
1599
1627
|
return {
|
|
1600
1628
|
items: assets.map(assetToMenuItem),
|
|
@@ -1604,9 +1632,19 @@ async function querySimpleSearch(auth, opts) {
|
|
|
1604
1632
|
const CATEGORY_DEFS = {
|
|
1605
1633
|
favorites: { name: "Favorites", icon: "star", scope: "favorites" },
|
|
1606
1634
|
assets: { name: "Assets", icon: "file-text", scope: "athena_assets" },
|
|
1607
|
-
projects: {
|
|
1608
|
-
|
|
1635
|
+
projects: {
|
|
1636
|
+
name: "Projects",
|
|
1637
|
+
icon: "folder-kanban",
|
|
1638
|
+
scope: "athena_projects"
|
|
1639
|
+
},
|
|
1640
|
+
browse_profiles: {
|
|
1641
|
+
name: "Browse Profiles",
|
|
1642
|
+
icon: "globe",
|
|
1643
|
+
scope: "athena_browse_profiles"
|
|
1644
|
+
},
|
|
1609
1645
|
folders: { name: "Folders", icon: "folder", scope: "athena_folders" },
|
|
1646
|
+
tools: { name: "Tools", icon: "wrench", scope: "tools" },
|
|
1647
|
+
toolkits: { name: "Toolkits", icon: "package", scope: "toolkits" },
|
|
1610
1648
|
team: { name: "Team", icon: "users", scope: "team" },
|
|
1611
1649
|
drives: { name: "Drives", icon: "hard-drive", scope: "drive_catalogs" }
|
|
1612
1650
|
};
|
|
@@ -1673,7 +1711,14 @@ const fetchAssets = async (context) => {
|
|
|
1673
1711
|
query,
|
|
1674
1712
|
limit,
|
|
1675
1713
|
offset: offset2,
|
|
1676
|
-
excludeTypes: [
|
|
1714
|
+
excludeTypes: [
|
|
1715
|
+
"folder",
|
|
1716
|
+
"catalog",
|
|
1717
|
+
"spaces",
|
|
1718
|
+
"session",
|
|
1719
|
+
"table",
|
|
1720
|
+
"task_item"
|
|
1721
|
+
]
|
|
1677
1722
|
});
|
|
1678
1723
|
return {
|
|
1679
1724
|
items: result.items,
|
|
@@ -1685,21 +1730,17 @@ const fetchFavorites = async (context) => {
|
|
|
1685
1730
|
const limit = sourceConfig.limit ?? 50;
|
|
1686
1731
|
const meta = fetchState.meta || {};
|
|
1687
1732
|
const offset2 = meta.validatedCount || 0;
|
|
1688
|
-
const data = await fetchGraphQL(
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
isFavorited: true,
|
|
1698
|
-
isArchived: false,
|
|
1699
|
-
isHidden: false
|
|
1700
|
-
}
|
|
1733
|
+
const data = await fetchGraphQL(sourceConfig.auth, PAGINATED_ASSETS_QUERY, {
|
|
1734
|
+
limit,
|
|
1735
|
+
offset: offset2,
|
|
1736
|
+
parentFolderId: null,
|
|
1737
|
+
filterTypes: null,
|
|
1738
|
+
filterColumns: {
|
|
1739
|
+
isFavorited: true,
|
|
1740
|
+
isArchived: false,
|
|
1741
|
+
isHidden: false
|
|
1701
1742
|
}
|
|
1702
|
-
);
|
|
1743
|
+
});
|
|
1703
1744
|
const assets = data.getPaginatedAssetsForWorkspace || [];
|
|
1704
1745
|
const items = assets.map(assetToMenuItem);
|
|
1705
1746
|
return {
|
|
@@ -1729,21 +1770,17 @@ const fetchFolderContents = async (context) => {
|
|
|
1729
1770
|
const meta = fetchState.meta || {};
|
|
1730
1771
|
const offset2 = meta.validatedCount || 0;
|
|
1731
1772
|
const parentFolderId = scope === "internal_drive" ? null : scope;
|
|
1732
|
-
const data = await fetchGraphQL(
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
isArchived: false,
|
|
1742
|
-
isHidden: false,
|
|
1743
|
-
...query ? { title: [{ op: "LIKE", value: `%${query}%` }] } : {}
|
|
1744
|
-
}
|
|
1773
|
+
const data = await fetchGraphQL(sourceConfig.auth, PAGINATED_ASSETS_QUERY, {
|
|
1774
|
+
limit,
|
|
1775
|
+
offset: offset2,
|
|
1776
|
+
parentFolderId,
|
|
1777
|
+
filterTypes: null,
|
|
1778
|
+
filterColumns: {
|
|
1779
|
+
isArchived: false,
|
|
1780
|
+
isHidden: false,
|
|
1781
|
+
...query ? { title: [{ op: "LIKE", value: `%${query}%` }] } : {}
|
|
1745
1782
|
}
|
|
1746
|
-
);
|
|
1783
|
+
});
|
|
1747
1784
|
const rawAssets = data.getPaginatedAssetsForWorkspace || [];
|
|
1748
1785
|
const assets = rawAssets.filter(
|
|
1749
1786
|
(a) => a.athenaConvertedType !== "catalog" && a.athenaOriginalType !== "catalog"
|
|
@@ -1799,6 +1836,36 @@ const fetchTeam = async (context) => {
|
|
|
1799
1836
|
});
|
|
1800
1837
|
return { items, pagination: { hasMore: false } };
|
|
1801
1838
|
};
|
|
1839
|
+
async function queryToolCatalog(auth) {
|
|
1840
|
+
const data = await fetchGraphQL(auth, TOOL_CATALOG_QUERY);
|
|
1841
|
+
return data.getToolkitToToolsMapping;
|
|
1842
|
+
}
|
|
1843
|
+
const fetchTools = async (context) => {
|
|
1844
|
+
const catalog = await queryToolCatalog(context.sourceConfig.auth);
|
|
1845
|
+
const items = catalog.tools.filter((tool) => tool.isMentionable).map((tool) => ({
|
|
1846
|
+
id: tool.id,
|
|
1847
|
+
name: tool.name,
|
|
1848
|
+
type: "tool",
|
|
1849
|
+
fallbackIcon: tool.icon,
|
|
1850
|
+
description: tool.description ?? void 0,
|
|
1851
|
+
visibleInScopes: /* @__PURE__ */ new Set(),
|
|
1852
|
+
...tool.adminOnly ? { extra: { isAdminOnly: true } } : {}
|
|
1853
|
+
}));
|
|
1854
|
+
return { items, pagination: { hasMore: false } };
|
|
1855
|
+
};
|
|
1856
|
+
const fetchToolkits = async (context) => {
|
|
1857
|
+
const catalog = await queryToolCatalog(context.sourceConfig.auth);
|
|
1858
|
+
const items = catalog.toolkits.filter((toolkit) => toolkit.isMentionable && !toolkit.hideFromMenu).map((toolkit) => ({
|
|
1859
|
+
id: toolkit.name,
|
|
1860
|
+
name: toolkit.displayName,
|
|
1861
|
+
type: "toolkit",
|
|
1862
|
+
fallbackIcon: toolkit.icon,
|
|
1863
|
+
description: toolkit.description || void 0,
|
|
1864
|
+
visibleInScopes: /* @__PURE__ */ new Set(),
|
|
1865
|
+
...toolkit.onlyAdmin ? { extra: { isAdminOnly: true } } : {}
|
|
1866
|
+
}));
|
|
1867
|
+
return { items, pagination: { hasMore: false } };
|
|
1868
|
+
};
|
|
1802
1869
|
const fetchDrives = async (context) => {
|
|
1803
1870
|
const { fetchState, sourceConfig } = context;
|
|
1804
1871
|
const meta = fetchState.meta || {};
|
|
@@ -1858,6 +1925,8 @@ const ROOT_MENTION_CATEGORIES = [
|
|
|
1858
1925
|
"projects",
|
|
1859
1926
|
"browse_profiles",
|
|
1860
1927
|
"folders",
|
|
1928
|
+
"tools",
|
|
1929
|
+
"toolkits",
|
|
1861
1930
|
"team",
|
|
1862
1931
|
"drives"
|
|
1863
1932
|
];
|
|
@@ -1882,9 +1951,11 @@ function buildStore({
|
|
|
1882
1951
|
fetchFolders,
|
|
1883
1952
|
{ auth, limit: 50 },
|
|
1884
1953
|
true
|
|
1885
|
-
/* isFlat */
|
|
1886
1954
|
);
|
|
1887
|
-
registerSource(registry, "internal_drive", fetchFolderContents, {
|
|
1955
|
+
registerSource(registry, "internal_drive", fetchFolderContents, {
|
|
1956
|
+
auth,
|
|
1957
|
+
limit: 50
|
|
1958
|
+
});
|
|
1888
1959
|
registerSource(registry, "athena_projects", fetchTypedAssets, {
|
|
1889
1960
|
auth,
|
|
1890
1961
|
includeOnlyTypes: ["project"],
|
|
@@ -1895,6 +1966,8 @@ function buildStore({
|
|
|
1895
1966
|
includeOnlyTypes: ["browse_profile"],
|
|
1896
1967
|
limit: 50
|
|
1897
1968
|
});
|
|
1969
|
+
registerSource(registry, "tools", fetchTools, { auth });
|
|
1970
|
+
registerSource(registry, "toolkits", fetchToolkits, { auth });
|
|
1898
1971
|
registerSource(registry, "team", fetchTeam, { auth });
|
|
1899
1972
|
registerSource(registry, "drive_catalogs", fetchDrives, { auth });
|
|
1900
1973
|
return new Store({ registry, cache });
|
|
@@ -2373,37 +2446,184 @@ const SignInConsent = ({ checked, onChange, children }) => /* @__PURE__ */ jsxs(
|
|
|
2373
2446
|
),
|
|
2374
2447
|
/* @__PURE__ */ jsx("span", { children })
|
|
2375
2448
|
] });
|
|
2449
|
+
const EXIT_ANIMATION_MS = 200;
|
|
2450
|
+
const EXIT_RESET_MS = 2500;
|
|
2451
|
+
const ContinuePill = ({ onClick, ariaLabel, dataTestId }) => {
|
|
2452
|
+
const [isExiting, setIsExiting] = useState(false);
|
|
2453
|
+
const onClickRef = useRef(onClick);
|
|
2454
|
+
const pendingOnClickRef = useRef(onClick);
|
|
2455
|
+
onClickRef.current = onClick;
|
|
2456
|
+
useEffect(() => {
|
|
2457
|
+
if (!isExiting) return;
|
|
2458
|
+
const dispatchTimer = setTimeout(
|
|
2459
|
+
() => pendingOnClickRef.current(),
|
|
2460
|
+
EXIT_ANIMATION_MS
|
|
2461
|
+
);
|
|
2462
|
+
const resetTimer = setTimeout(() => setIsExiting(false), EXIT_RESET_MS);
|
|
2463
|
+
return () => {
|
|
2464
|
+
clearTimeout(dispatchTimer);
|
|
2465
|
+
clearTimeout(resetTimer);
|
|
2466
|
+
};
|
|
2467
|
+
}, [isExiting]);
|
|
2468
|
+
const handleClick = () => {
|
|
2469
|
+
if (isExiting) return;
|
|
2470
|
+
pendingOnClickRef.current = onClickRef.current;
|
|
2471
|
+
setIsExiting(true);
|
|
2472
|
+
};
|
|
2473
|
+
return /* @__PURE__ */ jsxs(
|
|
2474
|
+
"button",
|
|
2475
|
+
{
|
|
2476
|
+
type: "button",
|
|
2477
|
+
onClick: handleClick,
|
|
2478
|
+
disabled: isExiting,
|
|
2479
|
+
className: cn(
|
|
2480
|
+
"group inline-flex items-center gap-1.5 rounded-full bg-primary px-3.5 py-1 text-xs font-medium text-primary-foreground shadow-sm",
|
|
2481
|
+
"transition-all duration-200 ease-out",
|
|
2482
|
+
"hover:bg-primary/90 hover:shadow-md active:scale-95",
|
|
2483
|
+
"animate-in fade-in slide-in-from-bottom-1",
|
|
2484
|
+
isExiting && "pointer-events-none scale-90 opacity-0"
|
|
2485
|
+
),
|
|
2486
|
+
"aria-label": ariaLabel,
|
|
2487
|
+
"data-testid": dataTestId,
|
|
2488
|
+
children: [
|
|
2489
|
+
/* @__PURE__ */ jsx(Play, { className: "size-3 fill-current transition-transform duration-200 ease-out group-hover:translate-x-0.5" }),
|
|
2490
|
+
/* @__PURE__ */ jsx("span", { children: "Continue" })
|
|
2491
|
+
]
|
|
2492
|
+
}
|
|
2493
|
+
);
|
|
2494
|
+
};
|
|
2495
|
+
function StatewireContinueRunButton({
|
|
2496
|
+
allowReadyFallback = false
|
|
2497
|
+
} = {}) {
|
|
2498
|
+
const status = useDeepAgentThreadStatus();
|
|
2499
|
+
const { runId } = useStatewireRuns();
|
|
2500
|
+
const sendCommand = useStatewireSendCommand();
|
|
2501
|
+
const isSettled = status === "stopped" || status === "error";
|
|
2502
|
+
if (!isSettled && !(allowReadyFallback && status === "ready")) return null;
|
|
2503
|
+
return /* @__PURE__ */ jsx(
|
|
2504
|
+
ContinuePill,
|
|
2505
|
+
{
|
|
2506
|
+
ariaLabel: "Continue this run from where it stopped",
|
|
2507
|
+
dataTestId: "statewire-continue-run",
|
|
2508
|
+
onClick: () => {
|
|
2509
|
+
sendCommand({
|
|
2510
|
+
type: "run/continue",
|
|
2511
|
+
...runId !== null && { runId }
|
|
2512
|
+
});
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
);
|
|
2516
|
+
}
|
|
2517
|
+
function StatewireContinueRunAffordance() {
|
|
2518
|
+
const messageId = useAuiState((state) => state.message.id);
|
|
2519
|
+
const lastMessageId = useAuiState(
|
|
2520
|
+
(state) => {
|
|
2521
|
+
var _a;
|
|
2522
|
+
return (_a = state.thread.messages.at(-1)) == null ? void 0 : _a.id;
|
|
2523
|
+
}
|
|
2524
|
+
);
|
|
2525
|
+
const runMarker = useAuiState(
|
|
2526
|
+
(state) => {
|
|
2527
|
+
var _a;
|
|
2528
|
+
return (_a = readRunMarkerFromSourceMessages(state.message)) == null ? void 0 : _a.marker;
|
|
2529
|
+
}
|
|
2530
|
+
);
|
|
2531
|
+
const threadExtras = useAuiState((state) => state.thread.extras);
|
|
2532
|
+
const isContinuableMarker = runMarker === ATHENA_RUN_MARKER_CANCELLED || runMarker === ATHENA_RUN_MARKER_FAILED;
|
|
2533
|
+
if (messageId !== lastMessageId || !isContinuableMarker) return null;
|
|
2534
|
+
if (!hasStatewireThreadExtras(threadExtras)) return null;
|
|
2535
|
+
return /* @__PURE__ */ jsx("div", { className: "flex w-full justify-center py-1", children: /* @__PURE__ */ jsx(StatewireContinueRunButton, { allowReadyFallback: true }) });
|
|
2536
|
+
}
|
|
2537
|
+
function StatewireRunEndedFooter({
|
|
2538
|
+
className
|
|
2539
|
+
} = {}) {
|
|
2540
|
+
const threadExtras = useAuiState((state) => state.thread.extras);
|
|
2541
|
+
if (!hasStatewireThreadExtras(threadExtras)) return null;
|
|
2542
|
+
return /* @__PURE__ */ jsx(StatewireRunEndedFooterContent, { className });
|
|
2543
|
+
}
|
|
2544
|
+
function StatewireRunEndedFooterContent({
|
|
2545
|
+
className
|
|
2546
|
+
}) {
|
|
2547
|
+
const status = useDeepAgentThreadStatus();
|
|
2548
|
+
const { error } = useStatewireRuns();
|
|
2549
|
+
const tailEndingKind = useAuiState((state) => {
|
|
2550
|
+
var _a;
|
|
2551
|
+
const last = state.thread.messages.at(-1);
|
|
2552
|
+
return last ? ((_a = readRuntimeMessageFromSourceMessages(last)) == null ? void 0 : _a.kind) ?? null : null;
|
|
2553
|
+
});
|
|
2554
|
+
const tailEndingSilent = useAuiState((state) => {
|
|
2555
|
+
var _a;
|
|
2556
|
+
const last = state.thread.messages.at(-1);
|
|
2557
|
+
return last ? ((_a = readRuntimeMessageFromSourceMessages(last)) == null ? void 0 : _a.silent) ?? false : false;
|
|
2558
|
+
});
|
|
2559
|
+
if (status !== "stopped" && status !== "error") return null;
|
|
2560
|
+
if (status === "stopped" && tailEndingSilent) return null;
|
|
2561
|
+
const tailRendersEnding = tailEndingKind !== null && !tailEndingSilent;
|
|
2562
|
+
const tailMatchesStatus = status === "error" ? tailEndingKind === "failed" : tailEndingKind === "stopped" || tailEndingKind === "paused";
|
|
2563
|
+
if (tailRendersEnding && tailMatchesStatus) return null;
|
|
2564
|
+
const tailOwnsContinue = tailRendersEnding && (tailEndingKind === "stopped" || tailEndingKind === "paused" || tailEndingKind === "failed");
|
|
2565
|
+
const action = tailOwnsContinue ? void 0 : /* @__PURE__ */ jsx(StatewireContinueRunButton, {});
|
|
2566
|
+
const message = status === "error" ? {
|
|
2567
|
+
kind: "failed",
|
|
2568
|
+
reason: "error",
|
|
2569
|
+
severity: "error",
|
|
2570
|
+
title: "Run failed",
|
|
2571
|
+
detail: void 0,
|
|
2572
|
+
text: (error == null ? void 0 : error.message) ? `⚠️ The run failed: ${error.message}` : void 0,
|
|
2573
|
+
silent: false,
|
|
2574
|
+
isSoleSourceMessage: true
|
|
2575
|
+
} : {
|
|
2576
|
+
kind: "stopped",
|
|
2577
|
+
reason: void 0,
|
|
2578
|
+
severity: "info",
|
|
2579
|
+
title: "Conversation stopped",
|
|
2580
|
+
detail: void 0,
|
|
2581
|
+
text: void 0,
|
|
2582
|
+
silent: false,
|
|
2583
|
+
isSoleSourceMessage: true
|
|
2584
|
+
};
|
|
2585
|
+
return /* @__PURE__ */ jsx(
|
|
2586
|
+
RuntimeMessageCard,
|
|
2587
|
+
{
|
|
2588
|
+
message,
|
|
2589
|
+
action,
|
|
2590
|
+
className: cn("mx-auto max-w-[95%]", className)
|
|
2591
|
+
}
|
|
2592
|
+
);
|
|
2593
|
+
}
|
|
2376
2594
|
export {
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2595
|
+
c7 as BranchPicker,
|
|
2596
|
+
c8 as COMPOSER_DOCK_CLASS,
|
|
2597
|
+
c9 as COMPOSER_EDITOR_ROW_CLASS,
|
|
2598
|
+
ca as COMPOSER_SURFACE_CLASS,
|
|
2599
|
+
cb as COMPOSER_TOOLBAR_CLASS,
|
|
2600
|
+
bi as ChatComposerDock,
|
|
2383
2601
|
ChatHeader,
|
|
2384
2602
|
ChatHeaderActions,
|
|
2385
2603
|
ChatHeaderIdentity,
|
|
2386
2604
|
ChatHeaderRoot,
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2605
|
+
bh as ChatThreadShell,
|
|
2606
|
+
cc as ComposerSendButton,
|
|
2607
|
+
bj as ComposerSendOrStop,
|
|
2608
|
+
cd as ComposerStopButton,
|
|
2609
|
+
ContinuePill,
|
|
2391
2610
|
ConversationHistoryPanel,
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2611
|
+
ce as IconButton,
|
|
2612
|
+
cf as MarkdownText,
|
|
2613
|
+
cg as MentionAuthCtx,
|
|
2614
|
+
ch as MentionChip,
|
|
2396
2615
|
MentionExtension,
|
|
2397
2616
|
MentionIcon,
|
|
2398
|
-
|
|
2617
|
+
ci as MentionLink,
|
|
2399
2618
|
MentionMenuSection,
|
|
2400
2619
|
MentionSuggestionList,
|
|
2401
2620
|
MentionSuggestionPopup,
|
|
2402
2621
|
MentionSuggestionsExtension,
|
|
2403
2622
|
MenuList,
|
|
2404
|
-
|
|
2623
|
+
cj as MessageActionsReadOnlyProvider,
|
|
2405
2624
|
PendingAttachmentUploads,
|
|
2406
2625
|
ROOT_MENTION_CATEGORIES,
|
|
2626
|
+
RuntimeMessageCard,
|
|
2407
2627
|
SIMPLE_SEARCH_QUERY,
|
|
2408
2628
|
SignInCard,
|
|
2409
2629
|
SignInConsent,
|
|
@@ -2411,35 +2631,38 @@ export {
|
|
|
2411
2631
|
SignInSecondaryButton,
|
|
2412
2632
|
SignInSelect,
|
|
2413
2633
|
SignInTextField,
|
|
2414
|
-
|
|
2634
|
+
ck as SmallIconButton,
|
|
2635
|
+
StatewireContinueRunAffordance,
|
|
2636
|
+
StatewireContinueRunButton,
|
|
2637
|
+
StatewireRunEndedFooter,
|
|
2415
2638
|
THREAD_HEADER_ACTIONS_CLASS,
|
|
2416
2639
|
THREAD_HEADER_CLASS,
|
|
2417
|
-
|
|
2640
|
+
cl as THREAD_HEADER_ICON_CLASS,
|
|
2418
2641
|
THREAD_HEADER_PILL_CLASS,
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2642
|
+
cm as THREAD_PANEL_CLASS,
|
|
2643
|
+
cn2 as THREAD_SCROLL_TO_BOTTOM_CLASS,
|
|
2644
|
+
co as TextShimmerLoader,
|
|
2645
|
+
cp as ThreadRunningIndicator,
|
|
2423
2646
|
TiptapComposer,
|
|
2424
|
-
|
|
2425
|
-
|
|
2647
|
+
cq as UserEditComposer,
|
|
2648
|
+
cr as UserMessage,
|
|
2426
2649
|
assetTypeToIcon,
|
|
2427
2650
|
assetTypeToThumb,
|
|
2428
2651
|
buildRootMenuItems,
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2652
|
+
cs as configureAssetIconBasePath,
|
|
2653
|
+
ct as createAssistantMessage,
|
|
2654
|
+
cu as createOlympusAssetUrl,
|
|
2432
2655
|
fetchGraphQL,
|
|
2433
2656
|
makeMentionUrl,
|
|
2434
|
-
|
|
2657
|
+
cv as normalizeAthenaMentionHtml,
|
|
2435
2658
|
parseMentionAnchorAttributes,
|
|
2436
|
-
|
|
2437
|
-
|
|
2659
|
+
cw as parseMentionUrl,
|
|
2660
|
+
cx as parseMentionsInText,
|
|
2438
2661
|
plainTextToTiptapContent,
|
|
2439
|
-
|
|
2662
|
+
cy as resolveComposerAction,
|
|
2440
2663
|
useMentionAuth,
|
|
2441
2664
|
useMentionSuggestions,
|
|
2442
|
-
|
|
2665
|
+
cz as useMessageActionsReadOnly,
|
|
2443
2666
|
webpageMentionFingerprint
|
|
2444
2667
|
};
|
|
2445
2668
|
//# sourceMappingURL=chat-ui.js.map
|