@athenaintel/react 0.15.0 → 0.16.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.
Files changed (35) hide show
  1. package/dist/chat/super-grouping/toolkit-map.d.ts +8 -3
  2. package/dist/chat-ui/composer/tiptap-composer.d.ts +7 -0
  3. package/dist/chat-ui/header/chat-header.d.ts +19 -0
  4. package/dist/chat-ui/header/conversation-history-panel.d.ts +27 -0
  5. package/dist/chat-ui/index.d.ts +4 -0
  6. package/dist/chat-ui/messages/message-actions-config.d.ts +12 -0
  7. package/dist/chat-ui/messages/user-edit-composer.d.ts +8 -0
  8. package/dist/chat-ui/thread/chat-thread-shell.d.ts +13 -1
  9. package/dist/chat-ui.cjs +504 -144
  10. package/dist/chat-ui.cjs.map +1 -1
  11. package/dist/chat-ui.js +398 -38
  12. package/dist/chat-ui.js.map +1 -1
  13. package/dist/index.cjs +1451 -4295
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +6 -1
  16. package/dist/index.js +1015 -3838
  17. package/dist/index.js.map +1 -1
  18. package/dist/provider/AthenaProvider.d.ts +4 -1
  19. package/dist/runtime/statewire-run-config.d.ts +0 -2
  20. package/dist/runtime/useAthenaStatewireRuntime.d.ts +3 -1
  21. package/dist/styles.css +1 -1
  22. package/dist/threads/api.d.ts +7 -0
  23. package/dist/threads/conversation-list-fetcher.d.ts +5 -1
  24. package/dist/threads/use-rest-conversation-history.d.ts +43 -0
  25. package/dist/threads/use-statewire-conversation-history.d.ts +71 -0
  26. package/dist/tools/file-tool-uis.d.ts +8 -0
  27. package/dist/tools/todo-plan-store.d.ts +29 -0
  28. package/dist/tools/write-todos-tool-ui.d.ts +1 -0
  29. package/dist/{composer-send-or-stop-C5AVmcwO.js → use-rest-conversation-history-BZ9Pl9kF.js} +4459 -424
  30. package/dist/use-rest-conversation-history-BZ9Pl9kF.js.map +1 -0
  31. package/dist/{composer-send-or-stop-RPudYkWR.cjs → use-rest-conversation-history-DqpE-QGK.cjs} +4327 -271
  32. package/dist/use-rest-conversation-history-DqpE-QGK.cjs.map +1 -0
  33. package/package.json +1 -1
  34. package/dist/composer-send-or-stop-C5AVmcwO.js.map +0 -1
  35. package/dist/composer-send-or-stop-RPudYkWR.cjs.map +0 -1
package/dist/chat-ui.cjs CHANGED
@@ -3,7 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
- const composerSendOrStop = require("./composer-send-or-stop-RPudYkWR.cjs");
6
+ const useRestConversationHistory = require("./use-rest-conversation-history-DqpE-QGK.cjs");
7
7
  const jsxRuntime = require("react/jsx-runtime");
8
8
  const React = require("react");
9
9
  const react = require("@assistant-ui/react");
@@ -20,6 +20,21 @@ function registerChatAssetMentionHandler(threadId, handler) {
20
20
  }
21
21
  };
22
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$l = [
30
+ ["path", { d: "M12 8V4H8", key: "hb8ula" }],
31
+ ["rect", { width: "16", height: "12", x: "4", y: "8", rx: "2", key: "enze0r" }],
32
+ ["path", { d: "M2 14h2", key: "vft8re" }],
33
+ ["path", { d: "M20 14h2", key: "4cs60a" }],
34
+ ["path", { d: "M15 13v2", key: "1xurst" }],
35
+ ["path", { d: "M9 13v2", key: "rq6x2g" }]
36
+ ];
37
+ const Bot = useRestConversationHistory.createLucideIcon("bot", __iconNode$l);
23
38
  /**
24
39
  * @license lucide-react v0.575.0 - ISC
25
40
  *
@@ -39,7 +54,7 @@ const __iconNode$k = [
39
54
  ],
40
55
  ["path", { d: "M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16", key: "16ra0t" }]
41
56
  ];
42
- const Building2 = composerSendOrStop.createLucideIcon("building-2", __iconNode$k);
57
+ const Building2 = useRestConversationHistory.createLucideIcon("building-2", __iconNode$k);
43
58
  /**
44
59
  * @license lucide-react v0.575.0 - ISC
45
60
  *
@@ -49,7 +64,7 @@ const Building2 = composerSendOrStop.createLucideIcon("building-2", __iconNode$k
49
64
  const __iconNode$j = [
50
65
  ["path", { d: "M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z", key: "p7xjir" }]
51
66
  ];
52
- const Cloud = composerSendOrStop.createLucideIcon("cloud", __iconNode$j);
67
+ const Cloud = useRestConversationHistory.createLucideIcon("cloud", __iconNode$j);
53
68
  /**
54
69
  * @license lucide-react v0.575.0 - ISC
55
70
  *
@@ -66,7 +81,7 @@ const __iconNode$i = [
66
81
  ],
67
82
  ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
68
83
  ];
69
- const Eye = composerSendOrStop.createLucideIcon("eye", __iconNode$i);
84
+ const Eye = useRestConversationHistory.createLucideIcon("eye", __iconNode$i);
70
85
  /**
71
86
  * @license lucide-react v0.575.0 - ISC
72
87
  *
@@ -85,7 +100,7 @@ const __iconNode$h = [
85
100
  ["path", { d: "M10 12.5 8 15l2 2.5", key: "1tg20x" }],
86
101
  ["path", { d: "m14 12.5 2 2.5-2 2.5", key: "yinavb" }]
87
102
  ];
88
- const FileCode = composerSendOrStop.createLucideIcon("file-code", __iconNode$h);
103
+ const FileCode = useRestConversationHistory.createLucideIcon("file-code", __iconNode$h);
89
104
  /**
90
105
  * @license lucide-react v0.575.0 - ISC
91
106
  *
@@ -101,7 +116,7 @@ const __iconNode$g = [
101
116
  }
102
117
  ]
103
118
  ];
104
- const Headphones = composerSendOrStop.createLucideIcon("headphones", __iconNode$g);
119
+ const Headphones = useRestConversationHistory.createLucideIcon("headphones", __iconNode$g);
105
120
  /**
106
121
  * @license lucide-react v0.575.0 - ISC
107
122
  *
@@ -113,7 +128,7 @@ const __iconNode$f = [
113
128
  ["path", { d: "m21 2-9.6 9.6", key: "1j0ho8" }],
114
129
  ["circle", { cx: "7.5", cy: "15.5", r: "5.5", key: "yqb3hr" }]
115
130
  ];
116
- const Key = composerSendOrStop.createLucideIcon("key", __iconNode$f);
131
+ const Key = useRestConversationHistory.createLucideIcon("key", __iconNode$f);
117
132
  /**
118
133
  * @license lucide-react v0.575.0 - ISC
119
134
  *
@@ -131,7 +146,7 @@ const __iconNode$e = [
131
146
  ["path", { d: "M8 12h.01", key: "czm47f" }],
132
147
  ["rect", { width: "20", height: "16", x: "2", y: "4", rx: "2", key: "18n3k1" }]
133
148
  ];
134
- const Keyboard = composerSendOrStop.createLucideIcon("keyboard", __iconNode$e);
149
+ const Keyboard = useRestConversationHistory.createLucideIcon("keyboard", __iconNode$e);
135
150
  /**
136
151
  * @license lucide-react v0.575.0 - ISC
137
152
  *
@@ -144,7 +159,7 @@ const __iconNode$d = [
144
159
  ["rect", { width: "7", height: "9", x: "14", y: "12", rx: "1", key: "1hutg5" }],
145
160
  ["rect", { width: "7", height: "5", x: "3", y: "16", rx: "1", key: "ldoo1y" }]
146
161
  ];
147
- const LayoutDashboard = composerSendOrStop.createLucideIcon("layout-dashboard", __iconNode$d);
162
+ const LayoutDashboard = useRestConversationHistory.createLucideIcon("layout-dashboard", __iconNode$d);
148
163
  /**
149
164
  * @license lucide-react v0.575.0 - ISC
150
165
  *
@@ -157,7 +172,7 @@ const __iconNode$c = [
157
172
  ["path", { d: "M8 8v12", key: "1gg7y9" }],
158
173
  ["path", { d: "M4 4v16", key: "6qkkli" }]
159
174
  ];
160
- const Library = composerSendOrStop.createLucideIcon("library", __iconNode$c);
175
+ const Library = useRestConversationHistory.createLucideIcon("library", __iconNode$c);
161
176
  /**
162
177
  * @license lucide-react v0.575.0 - ISC
163
178
  *
@@ -169,7 +184,7 @@ const __iconNode$b = [
169
184
  ["path", { d: "M19 10v2a7 7 0 0 1-14 0v-2", key: "1vc78b" }],
170
185
  ["rect", { x: "9", y: "2", width: "6", height: "13", rx: "3", key: "s6n7sd" }]
171
186
  ];
172
- const Mic = composerSendOrStop.createLucideIcon("mic", __iconNode$b);
187
+ const Mic = useRestConversationHistory.createLucideIcon("mic", __iconNode$b);
173
188
  /**
174
189
  * @license lucide-react v0.575.0 - ISC
175
190
  *
@@ -189,7 +204,7 @@ const __iconNode$a = [
189
204
  ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
190
205
  ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
191
206
  ];
192
- const Palette = composerSendOrStop.createLucideIcon("palette", __iconNode$a);
207
+ const Palette = useRestConversationHistory.createLucideIcon("palette", __iconNode$a);
193
208
  /**
194
209
  * @license lucide-react v0.575.0 - ISC
195
210
  *
@@ -201,7 +216,7 @@ const __iconNode$9 = [
201
216
  ["path", { d: "M3 9h18", key: "1pudct" }],
202
217
  ["path", { d: "M9 21V9", key: "1oto5p" }]
203
218
  ];
204
- const PanelsTopLeft = composerSendOrStop.createLucideIcon("panels-top-left", __iconNode$9);
219
+ const PanelsTopLeft = useRestConversationHistory.createLucideIcon("panels-top-left", __iconNode$9);
205
220
  /**
206
221
  * @license lucide-react v0.575.0 - ISC
207
222
  *
@@ -226,7 +241,7 @@ const __iconNode$8 = [
226
241
  ["path", { d: "m2.3 2.3 7.286 7.286", key: "1wuzzi" }],
227
242
  ["circle", { cx: "11", cy: "11", r: "2", key: "xmgehs" }]
228
243
  ];
229
- const PenTool = composerSendOrStop.createLucideIcon("pen-tool", __iconNode$8);
244
+ const PenTool = useRestConversationHistory.createLucideIcon("pen-tool", __iconNode$8);
230
245
  /**
231
246
  * @license lucide-react v0.575.0 - ISC
232
247
  *
@@ -242,7 +257,7 @@ const __iconNode$7 = [
242
257
  }
243
258
  ]
244
259
  ];
245
- const Phone = composerSendOrStop.createLucideIcon("phone", __iconNode$7);
260
+ const Phone = useRestConversationHistory.createLucideIcon("phone", __iconNode$7);
246
261
  /**
247
262
  * @license lucide-react v0.575.0 - ISC
248
263
  *
@@ -253,7 +268,7 @@ const __iconNode$6 = [
253
268
  ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
254
269
  ["path", { d: "M12 18h.01", key: "mhygvu" }]
255
270
  ];
256
- const Smartphone = composerSendOrStop.createLucideIcon("smartphone", __iconNode$6);
271
+ const Smartphone = useRestConversationHistory.createLucideIcon("smartphone", __iconNode$6);
257
272
  /**
258
273
  * @license lucide-react v0.575.0 - ISC
259
274
  *
@@ -272,7 +287,7 @@ const __iconNode$5 = [
272
287
  ["path", { d: "M22 4h-4", key: "gwowj6" }],
273
288
  ["circle", { cx: "4", cy: "20", r: "2", key: "6kqj1y" }]
274
289
  ];
275
- const Sparkles = composerSendOrStop.createLucideIcon("sparkles", __iconNode$5);
290
+ const Sparkles = useRestConversationHistory.createLucideIcon("sparkles", __iconNode$5);
276
291
  /**
277
292
  * @license lucide-react v0.575.0 - ISC
278
293
  *
@@ -286,7 +301,7 @@ const __iconNode$4 = [
286
301
  ],
287
302
  ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
288
303
  ];
289
- const SquareCheckBig = composerSendOrStop.createLucideIcon("square-check-big", __iconNode$4);
304
+ const SquareCheckBig = useRestConversationHistory.createLucideIcon("square-check-big", __iconNode$4);
290
305
  /**
291
306
  * @license lucide-react v0.575.0 - ISC
292
307
  *
@@ -302,7 +317,7 @@ const __iconNode$3 = [
302
317
  }
303
318
  ]
304
319
  ];
305
- const Star = composerSendOrStop.createLucideIcon("star", __iconNode$3);
320
+ const Star = useRestConversationHistory.createLucideIcon("star", __iconNode$3);
306
321
  /**
307
322
  * @license lucide-react v0.575.0 - ISC
308
323
  *
@@ -313,7 +328,7 @@ const __iconNode$2 = [
313
328
  ["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
314
329
  ["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
315
330
  ];
316
- const User = composerSendOrStop.createLucideIcon("user", __iconNode$2);
331
+ const User = useRestConversationHistory.createLucideIcon("user", __iconNode$2);
317
332
  /**
318
333
  * @license lucide-react v0.575.0 - ISC
319
334
  *
@@ -330,7 +345,7 @@ const __iconNode$1 = [
330
345
  ],
331
346
  ["rect", { x: "2", y: "6", width: "14", height: "12", rx: "2", key: "158x01" }]
332
347
  ];
333
- const Video = composerSendOrStop.createLucideIcon("video", __iconNode$1);
348
+ const Video = useRestConversationHistory.createLucideIcon("video", __iconNode$1);
334
349
  /**
335
350
  * @license lucide-react v0.575.0 - ISC
336
351
  *
@@ -346,7 +361,334 @@ const __iconNode = [
346
361
  }
347
362
  ]
348
363
  ];
349
- const Zap = composerSendOrStop.createLucideIcon("zap", __iconNode);
364
+ const Zap = useRestConversationHistory.createLucideIcon("zap", __iconNode);
365
+ function ChatHeaderRoot({
366
+ children,
367
+ className
368
+ }) {
369
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: useRestConversationHistory.cn(useRestConversationHistory.THREAD_HEADER_CLASS, className), children });
370
+ }
371
+ function ChatHeaderIdentity({
372
+ children,
373
+ className
374
+ }) {
375
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: useRestConversationHistory.cn(useRestConversationHistory.THREAD_HEADER_PILL_CLASS, className), children });
376
+ }
377
+ function ChatHeaderActions({
378
+ children,
379
+ className
380
+ }) {
381
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: useRestConversationHistory.cn(useRestConversationHistory.THREAD_HEADER_ACTIONS_CLASS, className), children });
382
+ }
383
+ const ChatHeader = {
384
+ Root: ChatHeaderRoot,
385
+ Identity: ChatHeaderIdentity,
386
+ Actions: ChatHeaderActions
387
+ };
388
+ const TIME_GROUPS = [
389
+ "Today",
390
+ "Yesterday",
391
+ "This Week",
392
+ "This Month",
393
+ "Older"
394
+ ];
395
+ const AUTOMATED_SOURCE_CHANNELS = /* @__PURE__ */ new Set([
396
+ "api",
397
+ "email",
398
+ "orchestration",
399
+ "slack",
400
+ "sms",
401
+ "task",
402
+ "teams"
403
+ ]);
404
+ function isAutomatedConversation(conversation) {
405
+ var _a, _b;
406
+ const sourceChannel = (_a = conversation.sourceChannel) == null ? void 0 : _a.trim().toLowerCase();
407
+ if (sourceChannel && AUTOMATED_SOURCE_CHANNELS.has(sourceChannel))
408
+ return true;
409
+ const triggerType = (_b = conversation.triggerType) == null ? void 0 : _b.trim().toLowerCase();
410
+ return Boolean(triggerType && triggerType !== "manual");
411
+ }
412
+ function conversationTimeGroup(value, now = /* @__PURE__ */ new Date()) {
413
+ const date = new Date(value);
414
+ if (Number.isNaN(date.getTime())) return "Older";
415
+ const startOfToday = new Date(
416
+ now.getFullYear(),
417
+ now.getMonth(),
418
+ now.getDate()
419
+ );
420
+ const startOfYesterday = new Date(startOfToday.getTime() - 864e5);
421
+ const startOfWeek = new Date(
422
+ startOfToday.getTime() - startOfToday.getDay() * 864e5
423
+ );
424
+ const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);
425
+ if (date >= startOfToday) return "Today";
426
+ if (date >= startOfYesterday) return "Yesterday";
427
+ if (date >= startOfWeek) return "This Week";
428
+ if (date >= startOfMonth) return "This Month";
429
+ return "Older";
430
+ }
431
+ function originKey(conversation) {
432
+ return conversation.appId ?? conversation.sourceChannel ?? "unknown";
433
+ }
434
+ function originLabel(value) {
435
+ const normalized = value.toLowerCase();
436
+ if (normalized.includes("chrome")) return "Chrome";
437
+ if (normalized.includes("powerpoint")) return "PowerPoint";
438
+ if (normalized.includes("word")) return "Word";
439
+ if (normalized.includes("excel")) return "Excel";
440
+ if (normalized.includes("office")) return "Office";
441
+ if (normalized === "web" || normalized.includes("olympus")) return "Athena";
442
+ if (normalized.includes("mobile")) return "Mobile";
443
+ if (value === "unknown") return "Legacy";
444
+ return value.replace(/^athena[-_]/, "").replaceAll("_", " ");
445
+ }
446
+ function relativeTime(value) {
447
+ const timestamp = Date.parse(value);
448
+ if (!Number.isFinite(timestamp)) return "";
449
+ const elapsed = Math.max(0, Date.now() - timestamp);
450
+ const minutes = Math.floor(elapsed / 6e4);
451
+ if (minutes < 1) return "<1m ago";
452
+ if (minutes < 60) return `${minutes}m ago`;
453
+ const hours = Math.floor(minutes / 60);
454
+ if (hours < 24) return `${hours}h ${minutes % 60}m ago`;
455
+ const days = Math.floor(hours / 24);
456
+ return days < 7 ? `${days}d ago` : new Date(timestamp).toLocaleDateString();
457
+ }
458
+ function ConversationTypeIcon({
459
+ conversation,
460
+ automated
461
+ }) {
462
+ if (conversation.state === "running") {
463
+ return /* @__PURE__ */ jsxRuntime.jsx(
464
+ useRestConversationHistory.LoaderCircle,
465
+ {
466
+ "aria-label": "Conversation running",
467
+ className: "mt-0.5 size-4 shrink-0 animate-spin text-primary"
468
+ }
469
+ );
470
+ }
471
+ const thumbnail = useRestConversationHistory.assetTypeToThumb(conversation.assetType ?? "session");
472
+ if (thumbnail) {
473
+ return /* @__PURE__ */ jsxRuntime.jsx("img", { src: thumbnail, alt: "", className: "mt-0.5 size-4 shrink-0" });
474
+ }
475
+ return automated ? /* @__PURE__ */ jsxRuntime.jsx(Bot, { className: "mt-0.5 size-4 shrink-0 text-primary" }) : /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.MessageSquare, { className: "mt-0.5 size-4 shrink-0 text-emerald-500" });
476
+ }
477
+ function ConversationHistoryPanel({
478
+ conversations,
479
+ activeThreadId,
480
+ search,
481
+ onSearchChange,
482
+ activityFilter,
483
+ onActivityFilterChange,
484
+ originFilter,
485
+ onOriginFilterChange,
486
+ onSelect,
487
+ onNewChat,
488
+ onRefresh,
489
+ onArchive,
490
+ onSetReadState,
491
+ isLoading = false,
492
+ isRefreshing = false,
493
+ hasNextPage = false,
494
+ isFetchingNextPage = false,
495
+ onLoadMore
496
+ }) {
497
+ const origins = React.useMemo(
498
+ () => [...new Set(conversations.map(originKey))].sort(),
499
+ [conversations]
500
+ );
501
+ const grouped = React.useMemo(() => {
502
+ const visible = conversations.filter((conversation) => {
503
+ const automated = isAutomatedConversation(conversation);
504
+ if (activityFilter === "chat" && automated) return false;
505
+ if (activityFilter === "automated" && !automated) return false;
506
+ return originFilter === "all" || originKey(conversation) === originFilter;
507
+ });
508
+ const byGroup = /* @__PURE__ */ new Map();
509
+ for (const conversation of visible) {
510
+ const group = conversationTimeGroup(conversation.updatedAt);
511
+ const items = byGroup.get(group) ?? [];
512
+ items.push(conversation);
513
+ byGroup.set(group, items);
514
+ }
515
+ return TIME_GROUPS.flatMap((group) => {
516
+ const items = byGroup.get(group);
517
+ return items ? [{ group, items }] : [];
518
+ });
519
+ }, [activityFilter, conversations, originFilter]);
520
+ const visibleCount = grouped.reduce(
521
+ (count, group) => count + group.items.length,
522
+ 0
523
+ );
524
+ const handleSearch = (event) => onSearchChange(event.target.value);
525
+ return /* @__PURE__ */ jsxRuntime.jsxs(
526
+ "section",
527
+ {
528
+ "aria-label": "Conversation history",
529
+ className: "border-b border-border bg-background px-2 pb-2",
530
+ "data-testid": "conversation-history-panel",
531
+ children: [
532
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-10 items-center gap-1.5 px-1", children: [
533
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground", children: "Sessions" }),
534
+ /* @__PURE__ */ jsxRuntime.jsx(
535
+ "button",
536
+ {
537
+ type: "button",
538
+ "aria-label": "Refresh sessions",
539
+ title: "Refresh sessions",
540
+ disabled: isRefreshing,
541
+ onClick: onRefresh,
542
+ className: "ml-auto rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-50",
543
+ children: /* @__PURE__ */ jsxRuntime.jsx(
544
+ useRestConversationHistory.RefreshCw,
545
+ {
546
+ className: useRestConversationHistory.cn("size-3.5", isRefreshing && "animate-spin")
547
+ }
548
+ )
549
+ }
550
+ ),
551
+ /* @__PURE__ */ jsxRuntime.jsxs(
552
+ "button",
553
+ {
554
+ type: "button",
555
+ onClick: onNewChat,
556
+ className: "flex h-7 shrink-0 items-center gap-1 rounded-md bg-primary px-2 text-[11px] font-medium text-primary-foreground",
557
+ children: [
558
+ /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.Plus, { className: "size-3" }),
559
+ " New"
560
+ ]
561
+ }
562
+ )
563
+ ] }),
564
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "relative block min-w-0 px-1 pb-2", children: [
565
+ /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.Search, { className: "pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-[calc(50%+0.25rem)] text-muted-foreground" }),
566
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Search sessions" }),
567
+ /* @__PURE__ */ jsxRuntime.jsx(
568
+ "input",
569
+ {
570
+ value: search,
571
+ onChange: handleSearch,
572
+ placeholder: "Search sessions...",
573
+ className: "h-8 w-full rounded-md border border-border bg-muted/40 pl-7 pr-2 text-xs outline-none focus:border-primary focus:bg-background"
574
+ }
575
+ )
576
+ ] }),
577
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 overflow-x-auto px-1 pb-2 text-[11px]", children: [
578
+ ["all", "chat", "automated"].map((filter) => /* @__PURE__ */ jsxRuntime.jsx(
579
+ "button",
580
+ {
581
+ type: "button",
582
+ onClick: () => onActivityFilterChange(filter),
583
+ className: useRestConversationHistory.cn(
584
+ "rounded-full border px-2 py-1 capitalize",
585
+ activityFilter === filter ? "border-primary bg-primary/10 text-primary" : "border-border text-muted-foreground"
586
+ ),
587
+ children: filter === "chat" ? "Chats" : filter === "automated" ? "Automations" : "All"
588
+ },
589
+ filter
590
+ )),
591
+ /* @__PURE__ */ jsxRuntime.jsxs(
592
+ "select",
593
+ {
594
+ "aria-label": "Filter by origin",
595
+ value: originFilter,
596
+ onChange: (event) => onOriginFilterChange(event.target.value),
597
+ className: "ml-auto rounded-full border border-border bg-background px-2 text-[11px] text-muted-foreground",
598
+ children: [
599
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All origins" }),
600
+ origins.map((origin) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: origin, children: originLabel(origin) }, origin))
601
+ ]
602
+ }
603
+ )
604
+ ] }),
605
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-h-[min(60vh,28rem)] overflow-y-auto px-0.5", children: [
606
+ isLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-2 py-4 text-xs text-muted-foreground", children: [
607
+ /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.LoaderCircle, { className: "size-3.5 animate-spin" }),
608
+ " Loading sessions…"
609
+ ] }) : visibleCount === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 py-4 text-xs text-muted-foreground", children: "No matching sessions." }) : grouped.map(({ group, items }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
610
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "px-2 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/75", children: group }),
611
+ items.map((conversation) => {
612
+ const automated = isAutomatedConversation(conversation);
613
+ return /* @__PURE__ */ jsxRuntime.jsxs(
614
+ "div",
615
+ {
616
+ className: useRestConversationHistory.cn(
617
+ "group flex items-start gap-2 rounded-md px-2 py-2 hover:bg-accent",
618
+ conversation.threadId === activeThreadId && "bg-primary/10 text-primary"
619
+ ),
620
+ children: [
621
+ /* @__PURE__ */ jsxRuntime.jsxs(
622
+ "button",
623
+ {
624
+ type: "button",
625
+ onClick: () => {
626
+ onSelect(conversation.threadId);
627
+ if (conversation.isUnread) {
628
+ onSetReadState(conversation.threadId, false);
629
+ }
630
+ },
631
+ className: "flex min-w-0 flex-1 items-start gap-2 text-left",
632
+ children: [
633
+ /* @__PURE__ */ jsxRuntime.jsx(
634
+ ConversationTypeIcon,
635
+ {
636
+ conversation,
637
+ automated
638
+ }
639
+ ),
640
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1", children: [
641
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-start gap-1", children: [
642
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "line-clamp-2 flex-1 text-xs font-medium leading-snug", children: useRestConversationHistory.conversationDisplayTitle(conversation) }),
643
+ conversation.isUnread ? /* @__PURE__ */ jsxRuntime.jsx(
644
+ "span",
645
+ {
646
+ "aria-label": "Unread",
647
+ className: "mt-1 size-1.5 shrink-0 rounded-full bg-primary"
648
+ }
649
+ ) : null
650
+ ] }),
651
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "mt-0.5 flex items-center gap-1.5 text-[10px] text-muted-foreground", children: [
652
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: relativeTime(conversation.updatedAt) }),
653
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "·" }),
654
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: originLabel(originKey(conversation)) })
655
+ ] })
656
+ ] })
657
+ ]
658
+ }
659
+ ),
660
+ /* @__PURE__ */ jsxRuntime.jsx(
661
+ "button",
662
+ {
663
+ type: "button",
664
+ "aria-label": `Archive ${useRestConversationHistory.conversationDisplayTitle(conversation)}`,
665
+ title: "Archive conversation",
666
+ onClick: () => onArchive(conversation.threadId),
667
+ className: "invisible rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground group-hover:visible focus:visible",
668
+ children: /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.Archive, { className: "size-3.5" })
669
+ }
670
+ )
671
+ ]
672
+ },
673
+ conversation.threadId
674
+ );
675
+ })
676
+ ] }, group)),
677
+ hasNextPage ? /* @__PURE__ */ jsxRuntime.jsx(
678
+ "button",
679
+ {
680
+ type: "button",
681
+ disabled: isFetchingNextPage,
682
+ onClick: onLoadMore,
683
+ className: "mt-1 w-full rounded-lg py-2 text-xs text-muted-foreground hover:bg-accent disabled:opacity-50",
684
+ children: isFetchingNextPage ? "Loading…" : "Load older sessions"
685
+ }
686
+ ) : visibleCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-2 text-center text-[10px] text-muted-foreground/70", children: "No more sessions" }) : null
687
+ ] })
688
+ ]
689
+ }
690
+ );
691
+ }
350
692
  function makeMentionUrl(attrs) {
351
693
  if (attrs.type === "tool") {
352
694
  return `mention://tool?name=${encodeURIComponent(attrs.id)}&description=${encodeURIComponent(attrs.description ?? "")}`;
@@ -388,7 +730,7 @@ function parseMentionAnchorAttributes({
388
730
  assetType: url.searchParams.get("assetType") || ""
389
731
  };
390
732
  }
391
- const MentionExtension = composerSendOrStop.Node.create({
733
+ const MentionExtension = useRestConversationHistory.Node.create({
392
734
  name: "mention",
393
735
  group: "inline",
394
736
  inline: true,
@@ -456,7 +798,7 @@ const MentionExtension = composerSendOrStop.Node.create({
456
798
  children.push(["span", { class: "mention-chip-text" }, node.attrs.name]);
457
799
  return [
458
800
  "span",
459
- composerSendOrStop.mergeAttributes(HTMLAttributes, {
801
+ useRestConversationHistory.mergeAttributes(HTMLAttributes, {
460
802
  "data-mention": "",
461
803
  "data-type": node.attrs.type,
462
804
  "data-name": node.attrs.name,
@@ -484,7 +826,7 @@ const MentionExtension = composerSendOrStop.Node.create({
484
826
  return `[@${node.attrs.name}](${url})`;
485
827
  }
486
828
  });
487
- const MentionSuggestionsExtension = composerSendOrStop.Extension.create({
829
+ const MentionSuggestionsExtension = useRestConversationHistory.Extension.create({
488
830
  name: "mentionSuggestions",
489
831
  addOptions() {
490
832
  return {
@@ -495,7 +837,7 @@ const MentionSuggestionsExtension = composerSendOrStop.Extension.create({
495
837
  addProseMirrorPlugins() {
496
838
  const callbacks = this.options.callbacks;
497
839
  return [
498
- composerSendOrStop.Suggestion({
840
+ useRestConversationHistory.Suggestion({
499
841
  editor: this.editor,
500
842
  char: "@",
501
843
  allowSpaces: false,
@@ -550,10 +892,10 @@ const MentionSuggestionsExtension = composerSendOrStop.Extension.create({
550
892
  }
551
893
  });
552
894
  const MentionSuggestionPopup = ({ clientRect, children }) => {
553
- const { refs, floatingStyles } = composerSendOrStop.useFloating$1({
895
+ const { refs, floatingStyles } = useRestConversationHistory.useFloating$1({
554
896
  placement: "bottom-start",
555
- middleware: [composerSendOrStop.offset(10), composerSendOrStop.flip(), composerSendOrStop.shift({ padding: 8 })],
556
- whileElementsMounted: composerSendOrStop.autoUpdate
897
+ middleware: [useRestConversationHistory.offset(10), useRestConversationHistory.flip(), useRestConversationHistory.shift({ padding: 8 })],
898
+ whileElementsMounted: useRestConversationHistory.autoUpdate
557
899
  });
558
900
  React.useEffect(() => {
559
901
  if (clientRect) {
@@ -562,7 +904,7 @@ const MentionSuggestionPopup = ({ clientRect, children }) => {
562
904
  });
563
905
  }
564
906
  }, [clientRect, refs]);
565
- return /* @__PURE__ */ jsxRuntime.jsx(composerSendOrStop.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
907
+ return /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
566
908
  "div",
567
909
  {
568
910
  ref: refs.setFloating,
@@ -578,11 +920,11 @@ function selectItems(store, scope, query, _targetCount, parentScope) {
578
920
  const state = store.state;
579
921
  const scopeId = typeof scope === "string" ? scope : scope.id;
580
922
  const parentScopeId = parentScope ? typeof parentScope === "string" ? parentScope : parentScope.id : void 0;
581
- const items = composerSendOrStop.getFilteredItems(state.cache, scopeId, query);
923
+ const items = useRestConversationHistory.getFilteredItems(state.cache, scopeId, query);
582
924
  let isFetching = false;
583
925
  let hasMore = true;
584
926
  try {
585
- const fetchState = composerSendOrStop.getFetchState(state.registry, scopeId, query, parentScopeId);
927
+ const fetchState = useRestConversationHistory.getFetchState(state.registry, scopeId, query, parentScopeId);
586
928
  isFetching = fetchState.isFetching;
587
929
  hasMore = fetchState.hasNextPage;
588
930
  } catch {
@@ -596,17 +938,17 @@ function triggerFetchIfNeeded(store, scope, query, _targetCount, parentScope) {
596
938
  const state = store.state;
597
939
  let entry;
598
940
  try {
599
- entry = composerSendOrStop.getEntry(state.registry, scopeId, parentScopeId);
941
+ entry = useRestConversationHistory.getEntry(state.registry, scopeId, parentScopeId);
600
942
  } catch {
601
943
  return;
602
944
  }
603
- const fetchState = composerSendOrStop.getFetchState(state.registry, scopeId, query, parentScopeId);
945
+ const fetchState = useRestConversationHistory.getFetchState(state.registry, scopeId, query, parentScopeId);
604
946
  if (fetchState.isFetching || !fetchState.hasNextPage || fetchState.error) {
605
947
  return;
606
948
  }
607
949
  const meta = fetchState.meta || {};
608
950
  if ((meta.fetchAttempts || 0) >= 10) return;
609
- composerSendOrStop.updateFetchState(state.registry, scopeId, query, { isFetching: true }, parentScopeId);
951
+ useRestConversationHistory.updateFetchState(state.registry, scopeId, query, { isFetching: true }, parentScopeId);
610
952
  store.setState((prev) => ({ ...prev }));
611
953
  const sourceFn = entry.sourceFn;
612
954
  const sourceConfig = entry.sourceConfig;
@@ -618,13 +960,13 @@ function triggerFetchIfNeeded(store, scope, query, _targetCount, parentScope) {
618
960
  }).then((result) => {
619
961
  var _a, _b;
620
962
  const currentState = store.state;
621
- composerSendOrStop.addItems(currentState.cache, result.items, scopeId);
963
+ useRestConversationHistory.addItems(currentState.cache, result.items, scopeId);
622
964
  if (result.sources) {
623
965
  for (const src of result.sources) {
624
966
  try {
625
- composerSendOrStop.getEntry(currentState.registry, src.scope);
967
+ useRestConversationHistory.getEntry(currentState.registry, src.scope);
626
968
  } catch {
627
- composerSendOrStop.registerSource(
969
+ useRestConversationHistory.registerSource(
628
970
  currentState.registry,
629
971
  src.scope,
630
972
  src.sourceFn,
@@ -636,13 +978,13 @@ function triggerFetchIfNeeded(store, scope, query, _targetCount, parentScope) {
636
978
  }
637
979
  if (result.bindings) {
638
980
  for (const binding of result.bindings) {
639
- composerSendOrStop.bindScopes(currentState.registry, binding.browseScope, binding.searchScope);
981
+ useRestConversationHistory.bindScopes(currentState.registry, binding.browseScope, binding.searchScope);
640
982
  }
641
983
  }
642
984
  const currentMeta = fetchState.meta || {};
643
985
  const consumed = ((_a = result.pagination) == null ? void 0 : _a.consumedCount) ?? result.items.length;
644
986
  const newValidated = (currentMeta.validatedCount || 0) + consumed;
645
- composerSendOrStop.updateFetchState(
987
+ useRestConversationHistory.updateFetchState(
646
988
  currentState.registry,
647
989
  scopeId,
648
990
  query,
@@ -667,7 +1009,7 @@ function triggerFetchIfNeeded(store, scope, query, _targetCount, parentScope) {
667
1009
  const currentMeta = fetchState.meta || {};
668
1010
  const errorAttempts = (currentMeta.errorAttempts || 0) + 1;
669
1011
  const retriable = errorAttempts < MAX_ERROR_RETRIES;
670
- composerSendOrStop.updateFetchState(
1012
+ useRestConversationHistory.updateFetchState(
671
1013
  currentState.registry,
672
1014
  scopeId,
673
1015
  query,
@@ -688,7 +1030,7 @@ function useMenuItems(store, options) {
688
1030
  React.useEffect(() => {
689
1031
  setTargetCount(minItems);
690
1032
  }, [scope, query, minItems]);
691
- const snapshot = composerSendOrStop.useStore(
1033
+ const snapshot = useRestConversationHistory.useStore(
692
1034
  store,
693
1035
  () => selectItems(store, scope, query, targetCount, parentScope)
694
1036
  );
@@ -758,52 +1100,52 @@ const MentionMenuSection = {
758
1100
  };
759
1101
  const ICON_MAP = {
760
1102
  // General
761
- file: composerSendOrStop.File,
762
- "file-text": composerSendOrStop.FileText,
1103
+ file: useRestConversationHistory.File,
1104
+ "file-text": useRestConversationHistory.FileText,
763
1105
  "file-code": FileCode,
764
- folder: composerSendOrStop.Folder,
765
- "folder-kanban": composerSendOrStop.FolderKanban,
766
- globe: composerSendOrStop.Globe,
767
- search: composerSendOrStop.Search,
1106
+ folder: useRestConversationHistory.Folder,
1107
+ "folder-kanban": useRestConversationHistory.FolderKanban,
1108
+ globe: useRestConversationHistory.Globe,
1109
+ search: useRestConversationHistory.Search,
768
1110
  star: Star,
769
- users: composerSendOrStop.Users,
1111
+ users: useRestConversationHistory.Users,
770
1112
  user: User,
771
- wrench: composerSendOrStop.Wrench,
772
- package: composerSendOrStop.Package,
1113
+ wrench: useRestConversationHistory.Wrench,
1114
+ package: useRestConversationHistory.Package,
773
1115
  "building-2": Building2,
774
- "hard-drive": composerSendOrStop.HardDrive,
775
- "layout-grid": composerSendOrStop.LayoutGrid,
1116
+ "hard-drive": useRestConversationHistory.HardDrive,
1117
+ "layout-grid": useRestConversationHistory.LayoutGrid,
776
1118
  zap: Zap,
777
1119
  eye: Eye,
778
1120
  // Chrome tools
779
- camera: composerSendOrStop.Camera,
1121
+ camera: useRestConversationHistory.Camera,
780
1122
  keyboard: Keyboard,
781
- code: composerSendOrStop.Code,
782
- monitor: composerSendOrStop.Monitor,
1123
+ code: useRestConversationHistory.Code,
1124
+ monitor: useRestConversationHistory.Monitor,
783
1125
  // Asset types
784
- image: composerSendOrStop.Image,
1126
+ image: useRestConversationHistory.Image,
785
1127
  video: Video,
786
1128
  headphones: Headphones,
787
1129
  mic: Mic,
788
- mail: composerSendOrStop.Mail,
789
- calendar: composerSendOrStop.Calendar,
1130
+ mail: useRestConversationHistory.Mail,
1131
+ calendar: useRestConversationHistory.Calendar,
790
1132
  phone: Phone,
791
- database: composerSendOrStop.Database,
792
- table: composerSendOrStop.Table,
793
- sheet: composerSendOrStop.Sheet,
1133
+ database: useRestConversationHistory.Database,
1134
+ table: useRestConversationHistory.Table,
1135
+ sheet: useRestConversationHistory.Sheet,
794
1136
  palette: Palette,
795
1137
  "pen-tool": PenTool,
796
1138
  layout: PanelsTopLeft,
797
1139
  "layout-dashboard": LayoutDashboard,
798
1140
  library: Library,
799
- "book-open": composerSendOrStop.BookOpen,
1141
+ "book-open": useRestConversationHistory.BookOpen,
800
1142
  sparkles: Sparkles,
801
1143
  "check-square": SquareCheckBig,
802
1144
  key: Key,
803
1145
  smartphone: Smartphone,
804
1146
  cloud: Cloud,
805
- workflow: composerSendOrStop.Workflow,
806
- presentation: composerSendOrStop.FileText
1147
+ workflow: useRestConversationHistory.Workflow,
1148
+ presentation: useRestConversationHistory.FileText
807
1149
  // Fallback for presentation type
808
1150
  };
809
1151
  function MentionIcon({
@@ -818,7 +1160,7 @@ function MentionIcon({
818
1160
  const Icon = fallbackIcon ? ICON_MAP[fallbackIcon] : void 0;
819
1161
  if (Icon) return /* @__PURE__ */ jsxRuntime.jsx(Icon, { className });
820
1162
  if (fallbackIcon) return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm flex-shrink-0", children: fallbackIcon });
821
- return /* @__PURE__ */ jsxRuntime.jsx(composerSendOrStop.File, { className });
1163
+ return /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.File, { className });
822
1164
  }
823
1165
  function MenuItemRow({
824
1166
  item,
@@ -836,7 +1178,7 @@ function MenuItemRow({
836
1178
  tabIndex: -1,
837
1179
  onClick,
838
1180
  onMouseEnter,
839
- className: composerSendOrStop.cn(
1181
+ className: useRestConversationHistory.cn(
840
1182
  "mention-item flex items-center justify-between gap-2 px-2 py-1.5 rounded cursor-pointer transition-colors",
841
1183
  "hover:bg-gray-100",
842
1184
  item.menuSection === MentionMenuSection.CURRENT_WEBPAGE && !isSelected && "bg-sky-50/70",
@@ -1038,7 +1380,7 @@ function getSelectedIndex(state) {
1038
1380
  }
1039
1381
  function useMenuNavigation() {
1040
1382
  const [store] = React.useState(() => {
1041
- const baseStore = new composerSendOrStop.Store({
1383
+ const baseStore = new useRestConversationHistory.Store({
1042
1384
  scopeStack: [{ scope: "root", selectedIndex: 0 }],
1043
1385
  query: "",
1044
1386
  isActive: false
@@ -1118,14 +1460,14 @@ function clearTextAfterTrigger(editor) {
1118
1460
  const MentionSuggestionList = React.forwardRef(({ store, editor, query, command, closeMenu }, ref) => {
1119
1461
  const [selectedIndexOverride, setSelectedIndexOverride] = React.useState(null);
1120
1462
  const navStore = useMenuNavigation();
1121
- const currentScopeId = composerSendOrStop.useStore(navStore, (s) => getCurrentScope(s));
1122
- const navSelectedIndex = composerSendOrStop.useStore(navStore, (s) => getSelectedIndex(s));
1463
+ const currentScopeId = useRestConversationHistory.useStore(navStore, (s) => getCurrentScope(s));
1464
+ const navSelectedIndex = useRestConversationHistory.useStore(navStore, (s) => getSelectedIndex(s));
1123
1465
  const selectedIndex = selectedIndexOverride ?? navSelectedIndex;
1124
- const scopeStack = composerSendOrStop.useStore(navStore, (s) => s.scopeStack);
1466
+ const scopeStack = useRestConversationHistory.useStore(navStore, (s) => s.scopeStack);
1125
1467
  let effectiveScopeId = currentScopeId;
1126
1468
  if (query) {
1127
1469
  try {
1128
- const searchScope = composerSendOrStop.getSearchScope(store.state.registry, currentScopeId);
1470
+ const searchScope = useRestConversationHistory.getSearchScope(store.state.registry, currentScopeId);
1129
1471
  if (searchScope) {
1130
1472
  effectiveScopeId = searchScope;
1131
1473
  }
@@ -1222,8 +1564,8 @@ function assetToMenuItem(asset) {
1222
1564
  id: asset.id,
1223
1565
  name: asset.title || "Untitled",
1224
1566
  type: isFolder ? "folder" : "asset",
1225
- thumbnailUrl: composerSendOrStop.assetTypeToThumb(asset.athenaOriginalType),
1226
- fallbackIcon: composerSendOrStop.assetTypeToIcon(asset.athenaOriginalType),
1567
+ thumbnailUrl: useRestConversationHistory.assetTypeToThumb(asset.athenaOriginalType),
1568
+ fallbackIcon: useRestConversationHistory.assetTypeToIcon(asset.athenaOriginalType),
1227
1569
  navigatesToScope: isFolder ? asset.id : void 0,
1228
1570
  visibleInScopes: /* @__PURE__ */ new Set(),
1229
1571
  updatedAt: asset.updatedAt ?? void 0,
@@ -1249,9 +1591,9 @@ async function querySimpleSearch(auth, opts) {
1249
1591
  sort: { field: "UPDATED_AT", direction: "DESC" },
1250
1592
  filterColumns: { isArchived: false, isHidden: false }
1251
1593
  };
1252
- const data = await composerSendOrStop.fetchGraphQL(
1594
+ const data = await useRestConversationHistory.fetchGraphQL(
1253
1595
  auth,
1254
- composerSendOrStop.SIMPLE_SEARCH_QUERY,
1596
+ useRestConversationHistory.SIMPLE_SEARCH_QUERY,
1255
1597
  { input }
1256
1598
  );
1257
1599
  const assets = ((_b = data.simpleSearch) == null ? void 0 : _b.assets) || [];
@@ -1282,7 +1624,7 @@ function webpageToMenuItem(webpage) {
1282
1624
  id: `webpage-tab-${webpage.tabId}`,
1283
1625
  name: webpage.isCurrent ? "This webpage" : webpage.title,
1284
1626
  type: "tab",
1285
- thumbnailUrl: composerSendOrStop.assetTypeToThumb("web_page"),
1627
+ thumbnailUrl: useRestConversationHistory.assetTypeToThumb("web_page"),
1286
1628
  fallbackIcon: "globe",
1287
1629
  visibleInScopes: /* @__PURE__ */ new Set(["root"]),
1288
1630
  description: webpageDescription(webpage),
@@ -1344,9 +1686,9 @@ const fetchFavorites = async (context) => {
1344
1686
  const limit = sourceConfig.limit ?? 50;
1345
1687
  const meta = fetchState.meta || {};
1346
1688
  const offset = meta.validatedCount || 0;
1347
- const data = await composerSendOrStop.fetchGraphQL(
1689
+ const data = await useRestConversationHistory.fetchGraphQL(
1348
1690
  sourceConfig.auth,
1349
- composerSendOrStop.PAGINATED_ASSETS_QUERY,
1691
+ useRestConversationHistory.PAGINATED_ASSETS_QUERY,
1350
1692
  {
1351
1693
  limit,
1352
1694
  offset,
@@ -1388,9 +1730,9 @@ const fetchFolderContents = async (context) => {
1388
1730
  const meta = fetchState.meta || {};
1389
1731
  const offset = meta.validatedCount || 0;
1390
1732
  const parentFolderId = scope === "internal_drive" ? null : scope;
1391
- const data = await composerSendOrStop.fetchGraphQL(
1733
+ const data = await useRestConversationHistory.fetchGraphQL(
1392
1734
  sourceConfig.auth,
1393
- composerSendOrStop.PAGINATED_ASSETS_QUERY,
1735
+ useRestConversationHistory.PAGINATED_ASSETS_QUERY,
1394
1736
  {
1395
1737
  limit,
1396
1738
  offset,
@@ -1438,9 +1780,9 @@ const fetchTeam = async (context) => {
1438
1780
  if (!auth.workspaceId) {
1439
1781
  return { items: [], pagination: { hasMore: false } };
1440
1782
  }
1441
- const data = await composerSendOrStop.fetchGraphQL(
1783
+ const data = await useRestConversationHistory.fetchGraphQL(
1442
1784
  auth,
1443
- composerSendOrStop.WORKSPACE_MEMBERS_QUERY,
1785
+ useRestConversationHistory.WORKSPACE_MEMBERS_QUERY,
1444
1786
  { workspaceId: auth.workspaceId }
1445
1787
  );
1446
1788
  const members = data.getUsersInWorkspace || [];
@@ -1525,17 +1867,17 @@ function buildStore({
1525
1867
  getWebpages,
1526
1868
  rootCategories
1527
1869
  }) {
1528
- const registry = composerSendOrStop.createScopeRegistry();
1529
- const cache = composerSendOrStop.createItemCache();
1530
- composerSendOrStop.registerSource(registry, "root", transformRootCategories, {
1870
+ const registry = useRestConversationHistory.createScopeRegistry();
1871
+ const cache = useRestConversationHistory.createItemCache();
1872
+ useRestConversationHistory.registerSource(registry, "root", transformRootCategories, {
1531
1873
  categories: [...rootCategories],
1532
1874
  getWebpages
1533
1875
  });
1534
- composerSendOrStop.registerSource(registry, "global_search", fetchGlobalSearch, { auth });
1535
- composerSendOrStop.bindScopes(registry, "root", "global_search");
1536
- composerSendOrStop.registerSource(registry, "athena_assets", fetchAssets, { auth, limit: 50 });
1537
- composerSendOrStop.registerSource(registry, "favorites", fetchFavorites, { auth, limit: 50 });
1538
- composerSendOrStop.registerSource(
1876
+ useRestConversationHistory.registerSource(registry, "global_search", fetchGlobalSearch, { auth });
1877
+ useRestConversationHistory.bindScopes(registry, "root", "global_search");
1878
+ useRestConversationHistory.registerSource(registry, "athena_assets", fetchAssets, { auth, limit: 50 });
1879
+ useRestConversationHistory.registerSource(registry, "favorites", fetchFavorites, { auth, limit: 50 });
1880
+ useRestConversationHistory.registerSource(
1539
1881
  registry,
1540
1882
  "athena_folders",
1541
1883
  fetchFolders,
@@ -1543,26 +1885,26 @@ function buildStore({
1543
1885
  true
1544
1886
  /* isFlat */
1545
1887
  );
1546
- composerSendOrStop.registerSource(registry, "internal_drive", fetchFolderContents, { auth, limit: 50 });
1547
- composerSendOrStop.registerSource(registry, "athena_projects", fetchTypedAssets, {
1888
+ useRestConversationHistory.registerSource(registry, "internal_drive", fetchFolderContents, { auth, limit: 50 });
1889
+ useRestConversationHistory.registerSource(registry, "athena_projects", fetchTypedAssets, {
1548
1890
  auth,
1549
1891
  includeOnlyTypes: ["project"],
1550
1892
  limit: 50
1551
1893
  });
1552
- composerSendOrStop.registerSource(registry, "athena_browse_profiles", fetchTypedAssets, {
1894
+ useRestConversationHistory.registerSource(registry, "athena_browse_profiles", fetchTypedAssets, {
1553
1895
  auth,
1554
1896
  includeOnlyTypes: ["browse_profile"],
1555
1897
  limit: 50
1556
1898
  });
1557
- composerSendOrStop.registerSource(registry, "team", fetchTeam, { auth });
1558
- composerSendOrStop.registerSource(registry, "drive_catalogs", fetchDrives, { auth });
1559
- return new composerSendOrStop.Store({ registry, cache });
1899
+ useRestConversationHistory.registerSource(registry, "team", fetchTeam, { auth });
1900
+ useRestConversationHistory.registerSource(registry, "drive_catalogs", fetchDrives, { auth });
1901
+ return new useRestConversationHistory.Store({ registry, cache });
1560
1902
  }
1561
1903
  function useMentionSuggestions({
1562
1904
  webpages,
1563
1905
  rootCategories = ROOT_MENTION_CATEGORIES
1564
1906
  }) {
1565
- const auth = composerSendOrStop.useMentionAuth();
1907
+ const auth = useRestConversationHistory.useMentionAuth();
1566
1908
  const webpagesRef = React.useRef(webpages);
1567
1909
  webpagesRef.current = webpages;
1568
1910
  const store = React.useMemo(
@@ -1629,7 +1971,7 @@ class PendingAttachmentUploads {
1629
1971
  }
1630
1972
  }
1631
1973
  }
1632
- const SubmitKeybind = composerSendOrStop.Extension.create({
1974
+ const SubmitKeybind = useRestConversationHistory.Extension.create({
1633
1975
  name: "submitKeybind",
1634
1976
  priority: 1e3,
1635
1977
  addOptions() {
@@ -1706,7 +2048,7 @@ function plainTextToTiptapContent(text) {
1706
2048
  };
1707
2049
  }
1708
2050
  const NO_WEBPAGES = [];
1709
- const TiptapComposer = React.forwardRef(({ placeholder = "Message Athena... (type @ to mention)", threadId, disabled = false, webpages = NO_WEBPAGES, rootCategories, onDraftStateChange }, outerRef) => {
2051
+ const TiptapComposer = React.forwardRef(({ placeholder = "Message Athena... (type @ to mention)", threadId, disabled = false, webpages = NO_WEBPAGES, rootCategories, onDraftStateChange, interceptSubmit }, outerRef) => {
1710
2052
  const aui = react.useAui();
1711
2053
  const composerInput = react.unstable_useComposerInput();
1712
2054
  const applyingRuntimeTextRef = React.useRef(false);
@@ -1738,6 +2080,7 @@ const TiptapComposer = React.forwardRef(({ placeholder = "Message Athena... (typ
1738
2080
  });
1739
2081
  const editorRef = React.useRef(null);
1740
2082
  const handleSubmit = React.useCallback(async () => {
2083
+ var _a;
1741
2084
  if (disabled) return;
1742
2085
  if (submitInFlightRef.current) return;
1743
2086
  submitInFlightRef.current = true;
@@ -1748,6 +2091,14 @@ const TiptapComposer = React.forwardRef(({ placeholder = "Message Athena... (typ
1748
2091
  const text = ed.getText({ blockSeparator: "\n" }).trim();
1749
2092
  if (!text) return;
1750
2093
  if (!composerInput.canSend) return;
2094
+ if (interceptSubmit) {
2095
+ const hasAttachments = (((_a = aui.composer.getState().attachments) == null ? void 0 : _a.length) ?? 0) > 0;
2096
+ if (!hasAttachments && await interceptSubmit(text)) {
2097
+ ed.commands.clearContent();
2098
+ onDraftStateChange == null ? void 0 : onDraftStateChange(false);
2099
+ return;
2100
+ }
2101
+ }
1751
2102
  composerInput.setText(text);
1752
2103
  composerInput.send({ steer: false });
1753
2104
  ed.commands.clearContent();
@@ -1755,7 +2106,7 @@ const TiptapComposer = React.forwardRef(({ placeholder = "Message Athena... (typ
1755
2106
  } finally {
1756
2107
  submitInFlightRef.current = false;
1757
2108
  }
1758
- }, [composerInput, disabled, onDraftStateChange]);
2109
+ }, [composerInput, disabled, interceptSubmit, onDraftStateChange]);
1759
2110
  const handleSubmitRef = React.useRef(handleSubmit);
1760
2111
  handleSubmitRef.current = handleSubmit;
1761
2112
  const addAttachment = React.useCallback(
@@ -1805,10 +2156,10 @@ const TiptapComposer = React.forwardRef(({ placeholder = "Message Athena... (typ
1805
2156
  },
1806
2157
  [addAttachment]
1807
2158
  );
1808
- const editor = composerSendOrStop.useEditor({
2159
+ const editor = useRestConversationHistory.useEditor({
1809
2160
  editable: !disabled,
1810
2161
  extensions: [
1811
- composerSendOrStop.StarterKit.configure({
2162
+ useRestConversationHistory.StarterKit.configure({
1812
2163
  heading: false,
1813
2164
  blockquote: false,
1814
2165
  bulletList: false,
@@ -1816,7 +2167,7 @@ const TiptapComposer = React.forwardRef(({ placeholder = "Message Athena... (typ
1816
2167
  codeBlock: false,
1817
2168
  horizontalRule: false
1818
2169
  }),
1819
- composerSendOrStop.Placeholder.configure({ placeholder }),
2170
+ useRestConversationHistory.Placeholder.configure({ placeholder }),
1820
2171
  MentionExtension,
1821
2172
  MentionSuggestionsExtension.configure({
1822
2173
  store,
@@ -1829,7 +2180,8 @@ const TiptapComposer = React.forwardRef(({ placeholder = "Message Athena... (typ
1829
2180
  ],
1830
2181
  editorProps: {
1831
2182
  attributes: {
1832
- class: "w-full resize-none bg-transparent px-1.5 py-2 text-sm leading-snug outline-none"
2183
+ class: "w-full resize-none bg-transparent px-1.5 py-2 text-sm leading-snug outline-none",
2184
+ "data-testid": "athena-chat-composer"
1833
2185
  },
1834
2186
  handlePaste,
1835
2187
  handleDrop
@@ -1886,7 +2238,7 @@ const TiptapComposer = React.forwardRef(({ placeholder = "Message Athena... (typ
1886
2238
  className: "flex-1 min-w-0",
1887
2239
  "aria-label": "Message composer",
1888
2240
  "aria-disabled": disabled,
1889
- children: /* @__PURE__ */ jsxRuntime.jsx(composerSendOrStop.EditorContent, { editor })
2241
+ children: /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.EditorContent, { editor })
1890
2242
  }
1891
2243
  ),
1892
2244
  popupOpen && popupProps && editor && /* @__PURE__ */ jsxRuntime.jsx(MentionSuggestionPopup, { clientRect: popupProps.clientRect, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -1968,7 +2320,7 @@ const SignInTextField = ({ label, placeholder, value, onChange, type = "text", c
1968
2320
  /* @__PURE__ */ jsxRuntime.jsx(
1969
2321
  "input",
1970
2322
  {
1971
- className: composerSendOrStop.cn(
2323
+ className: useRestConversationHistory.cn(
1972
2324
  "h-9 w-full rounded-md border bg-background px-2.5 text-xs outline-none focus:ring-2 focus:ring-ring/20",
1973
2325
  className
1974
2326
  ),
@@ -2022,43 +2374,51 @@ const SignInConsent = ({ checked, onChange, children }) => /* @__PURE__ */ jsxRu
2022
2374
  ),
2023
2375
  /* @__PURE__ */ jsxRuntime.jsx("span", { children })
2024
2376
  ] });
2025
- exports.BranchPicker = composerSendOrStop.BranchPicker;
2026
- exports.COMPOSER_DOCK_CLASS = composerSendOrStop.COMPOSER_DOCK_CLASS;
2027
- exports.COMPOSER_EDITOR_ROW_CLASS = composerSendOrStop.COMPOSER_EDITOR_ROW_CLASS;
2028
- exports.COMPOSER_SURFACE_CLASS = composerSendOrStop.COMPOSER_SURFACE_CLASS;
2029
- exports.COMPOSER_TOOLBAR_CLASS = composerSendOrStop.COMPOSER_TOOLBAR_CLASS;
2030
- exports.ChatComposerDock = composerSendOrStop.ChatComposerDock;
2031
- exports.ChatThreadShell = composerSendOrStop.ChatThreadShell;
2032
- exports.ComposerSendButton = composerSendOrStop.ComposerSendButton;
2033
- exports.ComposerSendOrStop = composerSendOrStop.ComposerSendOrStop;
2034
- exports.ComposerStopButton = composerSendOrStop.ComposerStopButton;
2035
- exports.IconButton = composerSendOrStop.IconButton;
2036
- exports.MarkdownText = composerSendOrStop.MarkdownText;
2037
- exports.MentionAuthCtx = composerSendOrStop.MentionAuthCtx;
2038
- exports.MentionChip = composerSendOrStop.MentionChip;
2039
- exports.MentionLink = composerSendOrStop.MentionLink;
2040
- exports.SIMPLE_SEARCH_QUERY = composerSendOrStop.SIMPLE_SEARCH_QUERY;
2041
- exports.SmallIconButton = composerSendOrStop.SmallIconButton;
2042
- exports.THREAD_HEADER_ACTIONS_CLASS = composerSendOrStop.THREAD_HEADER_ACTIONS_CLASS;
2043
- exports.THREAD_HEADER_CLASS = composerSendOrStop.THREAD_HEADER_CLASS;
2044
- exports.THREAD_HEADER_ICON_CLASS = composerSendOrStop.THREAD_HEADER_ICON_CLASS;
2045
- exports.THREAD_HEADER_PILL_CLASS = composerSendOrStop.THREAD_HEADER_PILL_CLASS;
2046
- exports.THREAD_PANEL_CLASS = composerSendOrStop.THREAD_PANEL_CLASS;
2047
- exports.THREAD_SCROLL_TO_BOTTOM_CLASS = composerSendOrStop.THREAD_SCROLL_TO_BOTTOM_CLASS;
2048
- exports.TextShimmerLoader = composerSendOrStop.TextShimmerLoader;
2049
- exports.ThreadRunningIndicator = composerSendOrStop.ThreadRunningIndicator;
2050
- exports.UserMessage = composerSendOrStop.UserMessage;
2051
- exports.assetTypeToIcon = composerSendOrStop.assetTypeToIcon;
2052
- exports.assetTypeToThumb = composerSendOrStop.assetTypeToThumb;
2053
- exports.configureAssetIconBasePath = composerSendOrStop.configureAssetIconBasePath;
2054
- exports.createAssistantMessage = composerSendOrStop.createAssistantMessage;
2055
- exports.createOlympusAssetUrl = composerSendOrStop.createOlympusAssetUrl;
2056
- exports.fetchGraphQL = composerSendOrStop.fetchGraphQL;
2057
- exports.normalizeAthenaMentionHtml = composerSendOrStop.normalizeAthenaMentionHtml;
2058
- exports.parseMentionUrl = composerSendOrStop.parseMentionUrl;
2059
- exports.parseMentionsInText = composerSendOrStop.parseMentionsInText;
2060
- exports.resolveComposerAction = composerSendOrStop.resolveComposerAction;
2061
- exports.useMentionAuth = composerSendOrStop.useMentionAuth;
2377
+ exports.BranchPicker = useRestConversationHistory.BranchPicker;
2378
+ exports.COMPOSER_DOCK_CLASS = useRestConversationHistory.COMPOSER_DOCK_CLASS;
2379
+ exports.COMPOSER_EDITOR_ROW_CLASS = useRestConversationHistory.COMPOSER_EDITOR_ROW_CLASS;
2380
+ exports.COMPOSER_SURFACE_CLASS = useRestConversationHistory.COMPOSER_SURFACE_CLASS;
2381
+ exports.COMPOSER_TOOLBAR_CLASS = useRestConversationHistory.COMPOSER_TOOLBAR_CLASS;
2382
+ exports.ChatComposerDock = useRestConversationHistory.ChatComposerDock;
2383
+ exports.ChatThreadShell = useRestConversationHistory.ChatThreadShell;
2384
+ exports.ComposerSendButton = useRestConversationHistory.ComposerSendButton;
2385
+ exports.ComposerSendOrStop = useRestConversationHistory.ComposerSendOrStop;
2386
+ exports.ComposerStopButton = useRestConversationHistory.ComposerStopButton;
2387
+ exports.IconButton = useRestConversationHistory.IconButton;
2388
+ exports.MarkdownText = useRestConversationHistory.MarkdownText;
2389
+ exports.MentionAuthCtx = useRestConversationHistory.MentionAuthCtx;
2390
+ exports.MentionChip = useRestConversationHistory.MentionChip;
2391
+ exports.MentionLink = useRestConversationHistory.MentionLink;
2392
+ exports.MessageActionsReadOnlyProvider = useRestConversationHistory.MessageActionsReadOnlyProvider;
2393
+ exports.SIMPLE_SEARCH_QUERY = useRestConversationHistory.SIMPLE_SEARCH_QUERY;
2394
+ exports.SmallIconButton = useRestConversationHistory.SmallIconButton;
2395
+ exports.THREAD_HEADER_ACTIONS_CLASS = useRestConversationHistory.THREAD_HEADER_ACTIONS_CLASS;
2396
+ exports.THREAD_HEADER_CLASS = useRestConversationHistory.THREAD_HEADER_CLASS;
2397
+ exports.THREAD_HEADER_ICON_CLASS = useRestConversationHistory.THREAD_HEADER_ICON_CLASS;
2398
+ exports.THREAD_HEADER_PILL_CLASS = useRestConversationHistory.THREAD_HEADER_PILL_CLASS;
2399
+ exports.THREAD_PANEL_CLASS = useRestConversationHistory.THREAD_PANEL_CLASS;
2400
+ exports.THREAD_SCROLL_TO_BOTTOM_CLASS = useRestConversationHistory.THREAD_SCROLL_TO_BOTTOM_CLASS;
2401
+ exports.TextShimmerLoader = useRestConversationHistory.TextShimmerLoader;
2402
+ exports.ThreadRunningIndicator = useRestConversationHistory.ThreadRunningIndicator;
2403
+ exports.UserEditComposer = useRestConversationHistory.UserEditComposer;
2404
+ exports.UserMessage = useRestConversationHistory.UserMessage;
2405
+ exports.assetTypeToIcon = useRestConversationHistory.assetTypeToIcon;
2406
+ exports.assetTypeToThumb = useRestConversationHistory.assetTypeToThumb;
2407
+ exports.configureAssetIconBasePath = useRestConversationHistory.configureAssetIconBasePath;
2408
+ exports.createAssistantMessage = useRestConversationHistory.createAssistantMessage;
2409
+ exports.createOlympusAssetUrl = useRestConversationHistory.createOlympusAssetUrl;
2410
+ exports.fetchGraphQL = useRestConversationHistory.fetchGraphQL;
2411
+ exports.normalizeAthenaMentionHtml = useRestConversationHistory.normalizeAthenaMentionHtml;
2412
+ exports.parseMentionUrl = useRestConversationHistory.parseMentionUrl;
2413
+ exports.parseMentionsInText = useRestConversationHistory.parseMentionsInText;
2414
+ exports.resolveComposerAction = useRestConversationHistory.resolveComposerAction;
2415
+ exports.useMentionAuth = useRestConversationHistory.useMentionAuth;
2416
+ exports.useMessageActionsReadOnly = useRestConversationHistory.useMessageActionsReadOnly;
2417
+ exports.ChatHeader = ChatHeader;
2418
+ exports.ChatHeaderActions = ChatHeaderActions;
2419
+ exports.ChatHeaderIdentity = ChatHeaderIdentity;
2420
+ exports.ChatHeaderRoot = ChatHeaderRoot;
2421
+ exports.ConversationHistoryPanel = ConversationHistoryPanel;
2062
2422
  exports.MentionExtension = MentionExtension;
2063
2423
  exports.MentionIcon = MentionIcon;
2064
2424
  exports.MentionMenuSection = MentionMenuSection;