@tangle-network/agent-app 0.60.235 → 0.60.237

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 (85) hide show
  1. package/dist/{DesignCanvas-SNE3H3TH.js → DesignCanvas-OW3W2QXW.js} +2 -2
  2. package/dist/{DesignCanvasEditor-G5O75CUT.js → DesignCanvasEditor-TCHZF25W.js} +3 -3
  3. package/dist/VaultPane-RXL3WLA2.js +7 -0
  4. package/dist/assistant/index.js +7 -7
  5. package/dist/chat-react/index.js +4 -4
  6. package/dist/{chunk-BNFUJNPS.js → chunk-A77IBQ7S.js} +456 -431
  7. package/dist/chunk-A77IBQ7S.js.map +1 -0
  8. package/dist/{chunk-JYIMW5U5.js → chunk-BGDQ7245.js} +3571 -3546
  9. package/dist/chunk-BGDQ7245.js.map +1 -0
  10. package/dist/{chunk-232KA6MR.js → chunk-CI53V6DD.js} +3 -3
  11. package/dist/{chunk-4JAXSEYW.js → chunk-DLVMKDFX.js} +3 -3
  12. package/dist/{chunk-I57SNMX4.js → chunk-EWOJATDS.js} +3 -3
  13. package/dist/{chunk-JYVUFRRV.js → chunk-FUZETA6Z.js} +2 -2
  14. package/dist/{chunk-P2NJIDLE.js → chunk-JH3CKHF4.js} +380 -366
  15. package/dist/chunk-JH3CKHF4.js.map +1 -0
  16. package/dist/{chunk-XIN7DOAB.js → chunk-R4X5474U.js} +35 -33
  17. package/dist/chunk-R4X5474U.js.map +1 -0
  18. package/dist/{chunk-IDQU36M5.js → chunk-RL3Z747H.js} +708 -659
  19. package/dist/chunk-RL3Z747H.js.map +1 -0
  20. package/dist/{chunk-3KXYYAY4.js → chunk-VBWYH7UZ.js} +243 -232
  21. package/dist/chunk-VBWYH7UZ.js.map +1 -0
  22. package/dist/{chunk-5IZRAZEZ.js → chunk-ZDPUC6CM.js} +3 -3
  23. package/dist/design-canvas-react/components/Toolbar.d.ts +1 -2
  24. package/dist/design-canvas-react/components/toolbar-fields.d.ts +65 -0
  25. package/dist/design-canvas-react/components/toolbar-page-controls.d.ts +20 -0
  26. package/dist/design-canvas-react/components/toolbar-selection-controls.d.ts +22 -0
  27. package/dist/design-canvas-react/components/use-workspace-keyboard.d.ts +24 -0
  28. package/dist/design-canvas-react/components/use-workspace-viewport.d.ts +16 -0
  29. package/dist/design-canvas-react/components/workspace-gesture-state.d.ts +10 -0
  30. package/dist/design-canvas-react/index.js +3 -3
  31. package/dist/design-canvas-react/lazy.js +1 -1
  32. package/dist/{mention-editor-6FJ6HRSN.js → mention-editor-B23OMFT2.js} +2 -2
  33. package/dist/public-consultation/index.d.ts +1 -1
  34. package/dist/settings-react/index.js +1 -1
  35. package/dist/studio-react/index.js +1 -1
  36. package/dist/vault/SourceEditor.d.ts +8 -0
  37. package/dist/vault/VaultCreateDialog.d.ts +14 -0
  38. package/dist/vault/VaultDocumentToolbar.d.ts +29 -0
  39. package/dist/vault/VaultPaneNavigation.d.ts +10 -0
  40. package/dist/vault/VaultPaneStates.d.ts +59 -0
  41. package/dist/vault/VaultTreePanel.d.ts +19 -0
  42. package/dist/vault/index.js +1 -1
  43. package/dist/vault/lazy.js +1 -1
  44. package/dist/vault/useVaultDockPlacement.d.ts +5 -0
  45. package/dist/vault/useVaultSearch.d.ts +13 -0
  46. package/dist/vault/vault-tree-paths.d.ts +12 -0
  47. package/dist/web-react/agent-profile-editor.js +4 -4
  48. package/dist/web-react/chat-composer-types.d.ts +301 -0
  49. package/dist/web-react/chat-composer.d.ts +2 -300
  50. package/dist/web-react/chat-empty-state.d.ts +27 -0
  51. package/dist/web-react/chat-message-body.d.ts +23 -0
  52. package/dist/web-react/chat-message-metrics.d.ts +6 -0
  53. package/dist/web-react/chat-message-types.d.ts +158 -0
  54. package/dist/web-react/chat-messages.d.ts +17 -0
  55. package/dist/web-react/chat-tool-call.d.ts +31 -0
  56. package/dist/web-react/composer-glyphs.d.ts +28 -0
  57. package/dist/web-react/index.d.ts +6 -245
  58. package/dist/web-react/index.js +7 -7
  59. package/dist/web-react/record-grid-editors.d.ts +31 -0
  60. package/dist/web-react/record-grid-review-actions.d.ts +13 -0
  61. package/dist/web-react/record-grid-source-marker.d.ts +27 -0
  62. package/dist/web-react/record-grid-types.d.ts +86 -0
  63. package/dist/web-react/record-grid.d.ts +2 -85
  64. package/dist/web-react/run-drill-in.d.ts +28 -0
  65. package/dist/web-react/use-composer-commands.d.ts +25 -0
  66. package/dist/web-react/use-composer-file-intake.d.ts +20 -0
  67. package/dist/web-react/use-composer-send.d.ts +34 -0
  68. package/dist/workspace-react/index.js +3 -3
  69. package/package.json +1 -1
  70. package/dist/VaultPane-QEG35UAZ.js +0 -7
  71. package/dist/chunk-3KXYYAY4.js.map +0 -1
  72. package/dist/chunk-BNFUJNPS.js.map +0 -1
  73. package/dist/chunk-IDQU36M5.js.map +0 -1
  74. package/dist/chunk-JYIMW5U5.js.map +0 -1
  75. package/dist/chunk-P2NJIDLE.js.map +0 -1
  76. package/dist/chunk-XIN7DOAB.js.map +0 -1
  77. /package/dist/{DesignCanvas-SNE3H3TH.js.map → DesignCanvas-OW3W2QXW.js.map} +0 -0
  78. /package/dist/{DesignCanvasEditor-G5O75CUT.js.map → DesignCanvasEditor-TCHZF25W.js.map} +0 -0
  79. /package/dist/{VaultPane-QEG35UAZ.js.map → VaultPane-RXL3WLA2.js.map} +0 -0
  80. /package/dist/{chunk-232KA6MR.js.map → chunk-CI53V6DD.js.map} +0 -0
  81. /package/dist/{chunk-4JAXSEYW.js.map → chunk-DLVMKDFX.js.map} +0 -0
  82. /package/dist/{chunk-I57SNMX4.js.map → chunk-EWOJATDS.js.map} +0 -0
  83. /package/dist/{chunk-JYVUFRRV.js.map → chunk-FUZETA6Z.js.map} +0 -0
  84. /package/dist/{chunk-5IZRAZEZ.js.map → chunk-ZDPUC6CM.js.map} +0 -0
  85. /package/dist/{mention-editor-6FJ6HRSN.js.map → mention-editor-B23OMFT2.js.map} +0 -0
@@ -13,12 +13,12 @@ import {
13
13
  filterAcceptedFiles,
14
14
  isAcceptedFileType,
15
15
  renamePastedImages
16
- } from "./chunk-232KA6MR.js";
16
+ } from "./chunk-CI53V6DD.js";
17
17
  import {
18
18
  OVERLAY_SHADOW,
19
19
  POPOVER_OPTION_FOCUS,
20
20
  PopoverSurface
21
- } from "./chunk-XIN7DOAB.js";
21
+ } from "./chunk-R4X5474U.js";
22
22
  import {
23
23
  ALLOWED_ATTACHMENT_SNIFFED_MIMES,
24
24
  ATTACHMENT_ACCEPT,
@@ -261,19 +261,320 @@ function preloadWhenIdle(routes, timeoutMs = 3e3) {
261
261
  import {
262
262
  lazy as lazy2,
263
263
  Suspense,
264
- useCallback as useCallback2,
265
- useEffect as useEffect3,
266
- useMemo,
267
- useId,
268
- useRef as useRef2,
269
- useState as useState3
264
+ useCallback as useCallback5,
265
+ useEffect as useEffect5,
266
+ useMemo as useMemo2,
267
+ useRef as useRef5,
268
+ useState as useState6
270
269
  } from "react";
271
270
  import { focusFieldWithin } from "@tangle-network/ui/utils";
272
- import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
273
- function createLazyMentionEditor() {
274
- return lazy2(() => import("./mention-editor-6FJ6HRSN.js").then((m) => m.loadMentionEditor()));
271
+
272
+ // src/web-react/use-composer-commands.ts
273
+ import { useCallback as useCallback2, useEffect as useEffect3, useId, useMemo, useRef as useRef2, useState as useState3 } from "react";
274
+ function useComposerCommands({ text, textRef, setText, mention, slashCommands, eligibleSkills, onSelectedSkillChange }) {
275
+ const slashPanelRef = useRef2(null);
276
+ const cardRef = useRef2(null);
277
+ const slashListId = useId();
278
+ const [mentionSuggestionOpen, setMentionSuggestionOpen] = useState3(false);
279
+ const [slashActive, setSlashActive] = useState3(0);
280
+ const [slashDismissedFor, setSlashDismissedFor] = useState3(null);
281
+ const hasSkills = Boolean(onSelectedSkillChange && eligibleSkills.length > 0);
282
+ const commandToken = !mention && slashCommands?.length ? /^\/(\S*)$/.exec(text)?.[1] : void 0;
283
+ const skillToken = hasSkills ? /^\/(\S*)$/.exec(text)?.[1] : void 0;
284
+ const skillInvocation = hasSkills ? /^\/skill(?:\s+(.*))?$/i.exec(text) : null;
285
+ const skillQuery = skillInvocation ? skillInvocation[1] ?? "" : void 0;
286
+ const slashToken = skillQuery ?? skillToken ?? commandToken;
287
+ const slashOpen = slashToken !== void 0 && text !== slashDismissedFor && !mentionSuggestionOpen;
288
+ const slashItems = useMemo(
289
+ () => [
290
+ ...(!mention ? slashCommands ?? [] : []).map((command) => ({
291
+ id: `command:${command.name}`,
292
+ group: "Commands",
293
+ label: `/${command.name}`,
294
+ description: command.description,
295
+ keywords: [command.name, command.description]
296
+ })),
297
+ ...(onSelectedSkillChange ? eligibleSkills : []).map((skill) => ({
298
+ id: `skill:${skill.id}`,
299
+ group: "Skills",
300
+ label: `/skill ${skill.name}`,
301
+ description: skill.description,
302
+ keywords: [skill.id, skill.name, skill.description]
303
+ }))
304
+ ],
305
+ [slashCommands, mention, eligibleSkills, onSelectedSkillChange]
306
+ );
307
+ const slashFiltered = useMemo(
308
+ () => {
309
+ if (slashToken === void 0) return [];
310
+ const items = skillQuery !== void 0 ? slashItems.filter((item) => item.group === "Skills") : slashItems;
311
+ return filterCommandPaletteItems(items, slashToken);
312
+ },
313
+ [slashItems, slashToken, skillQuery]
314
+ );
315
+ const slashActiveIndex = slashFiltered.length === 0 ? 0 : Math.min(slashActive, slashFiltered.length - 1);
316
+ useEffect3(() => {
317
+ setSlashActive(0);
318
+ }, [slashToken]);
319
+ useEffect3(() => {
320
+ if (!slashOpen) return;
321
+ document.getElementById(`${slashListId}-${slashActiveIndex}`)?.scrollIntoView?.({ block: "nearest" });
322
+ }, [slashOpen, slashActiveIndex, slashListId]);
323
+ useEffect3(() => {
324
+ if (!slashOpen) return;
325
+ function onMouseDown(e) {
326
+ const target = e.target;
327
+ if (cardRef.current?.contains(target)) return;
328
+ if (slashPanelRef.current?.contains(target)) return;
329
+ setSlashDismissedFor(textRef.current);
330
+ }
331
+ document.addEventListener("mousedown", onMouseDown);
332
+ return () => document.removeEventListener("mousedown", onMouseDown);
333
+ }, [slashOpen]);
334
+ const pickSlash = useCallback2(
335
+ (id) => {
336
+ setText("");
337
+ setSlashDismissedFor(null);
338
+ if (id.startsWith("skill:")) {
339
+ const skill = eligibleSkills.find((item) => item.id === id.slice("skill:".length));
340
+ if (skill) onSelectedSkillChange?.(skill);
341
+ } else if (id.startsWith("command:")) {
342
+ slashCommands?.find((command) => command.name === id.slice("command:".length))?.run();
343
+ }
344
+ },
345
+ [slashCommands, eligibleSkills, onSelectedSkillChange, setText]
346
+ );
347
+ const handleSlashKeyDown = (e) => {
348
+ if (slashOpen) {
349
+ if (e.key === "ArrowDown") {
350
+ e.preventDefault();
351
+ if (slashFiltered.length > 0) setSlashActive((slashActiveIndex + 1) % slashFiltered.length);
352
+ return true;
353
+ }
354
+ if (e.key === "ArrowUp") {
355
+ e.preventDefault();
356
+ if (slashFiltered.length > 0)
357
+ setSlashActive((slashActiveIndex - 1 + slashFiltered.length) % slashFiltered.length);
358
+ return true;
359
+ }
360
+ if (e.key === "Enter" && !e.shiftKey || e.key === "Tab") {
361
+ const item = slashFiltered[slashActiveIndex];
362
+ if (item) {
363
+ e.preventDefault();
364
+ pickSlash(item.id);
365
+ return true;
366
+ }
367
+ }
368
+ if (e.key === "Escape") {
369
+ e.preventDefault();
370
+ setSlashDismissedFor(text);
371
+ return true;
372
+ }
373
+ }
374
+ return false;
375
+ };
376
+ return { cardRef, slashPanelRef, slashListId, setMentionSuggestionOpen, slashActiveIndex, slashOpen, slashFiltered, skillQuery, hasSkills, setSlashActive, pickSlash, handleSlashKeyDown };
275
377
  }
276
- var IS_APPLE_PLATFORM = typeof navigator !== "undefined" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform);
378
+
379
+ // src/web-react/use-composer-file-intake.ts
380
+ import { useCallback as useCallback3, useRef as useRef3, useState as useState4 } from "react";
381
+ function useComposerFileIntake({ onAttach, onAttachFolder, accept, onRejectFiles, pendingFiles }) {
382
+ const fileInputRef = useRef3(null);
383
+ const folderInputRef = useRef3(null);
384
+ const [dragOver, setDragOver] = useState4(false);
385
+ const dragDepth = useRef3(0);
386
+ const pastedImageCount = useRef3(0);
387
+ const deliverFiles = useCallback3(
388
+ (files, original) => {
389
+ if (!onAttach || files.length === 0) return;
390
+ const { accepted, rejected } = filterAcceptedFiles(files, accept);
391
+ if (rejected.length > 0) onRejectFiles?.(rejected);
392
+ if (accepted.length === 0) return;
393
+ const unchanged = accepted.length === original.length && accepted.every((file, i) => file === original[i]);
394
+ if (unchanged) {
395
+ onAttach(original);
396
+ return;
397
+ }
398
+ const transfer = new DataTransfer();
399
+ for (const file of accepted) transfer.items.add(file);
400
+ onAttach(transfer.files);
401
+ },
402
+ [onAttach, onRejectFiles, accept]
403
+ );
404
+ const handleFileChange = (e) => {
405
+ if (e.target.files?.length) deliverFiles(Array.from(e.target.files), e.target.files);
406
+ e.target.value = "";
407
+ };
408
+ const ingestPastedFiles = (clipboardFiles) => {
409
+ if (!onAttach || clipboardFiles.length === 0) return false;
410
+ const { files, nextIndex } = renamePastedImages(
411
+ Array.from(clipboardFiles),
412
+ pastedImageCount.current,
413
+ pendingFiles.map((f) => f.name)
414
+ );
415
+ pastedImageCount.current = nextIndex;
416
+ deliverFiles(files, clipboardFiles);
417
+ return true;
418
+ };
419
+ const handlePaste = (e) => {
420
+ const clipboardFiles = e.clipboardData?.files;
421
+ if (!clipboardFiles || clipboardFiles.length === 0) return;
422
+ if (ingestPastedFiles(clipboardFiles)) e.preventDefault();
423
+ };
424
+ const handleFolderChange = (e) => {
425
+ if (e.target.files?.length) (onAttachFolder ?? onAttach)?.(e.target.files);
426
+ e.target.value = "";
427
+ };
428
+ const handleDragEnter = useCallback3((e) => {
429
+ e.preventDefault();
430
+ e.stopPropagation();
431
+ dragDepth.current++;
432
+ if (e.dataTransfer?.types.includes("Files")) setDragOver(true);
433
+ }, []);
434
+ const handleDragLeave = useCallback3((e) => {
435
+ e.preventDefault();
436
+ e.stopPropagation();
437
+ dragDepth.current--;
438
+ if (dragDepth.current <= 0) {
439
+ dragDepth.current = 0;
440
+ setDragOver(false);
441
+ }
442
+ }, []);
443
+ const handleDragOver = useCallback3((e) => {
444
+ e.preventDefault();
445
+ e.stopPropagation();
446
+ if (e.dataTransfer) e.dataTransfer.dropEffect = "copy";
447
+ }, []);
448
+ const handleDrop = useCallback3(
449
+ (e) => {
450
+ e.preventDefault();
451
+ e.stopPropagation();
452
+ dragDepth.current = 0;
453
+ setDragOver(false);
454
+ const files = e.dataTransfer?.files;
455
+ if (files?.length) deliverFiles(Array.from(files), files);
456
+ },
457
+ [deliverFiles]
458
+ );
459
+ return { fileInputRef, folderInputRef, dragOver, handleFileChange, handleFolderChange, handlePaste, ingestPastedFiles, handleDragEnter, handleDragLeave, handleDragOver, handleDrop };
460
+ }
461
+
462
+ // src/web-react/use-composer-send.ts
463
+ import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef4, useState as useState5 } from "react";
464
+ function isRejectedOutcome(outcome) {
465
+ return typeof outcome === "object" && outcome !== null && outcome.ok === false;
466
+ }
467
+ function isPromise(value) {
468
+ return typeof value?.then === "function";
469
+ }
470
+ function sendFailureText(error, fallback) {
471
+ if (typeof error === "object" && error !== null && "ok" in error) {
472
+ const named = error.error;
473
+ if (typeof named === "string" && named.trim() !== "") return named;
474
+ return fallback;
475
+ }
476
+ if (typeof error === "string" && error.trim() !== "") return error;
477
+ if (error instanceof Error && error.message.trim() !== "") return error.message;
478
+ return fallback;
479
+ }
480
+ function useComposerSend({ text, textRef, textareaRef, setText, pendingFiles, sendFailureMessage, sendBlockedByStream, disabled, sendDisabled, canSubmitAttachmentsOnly, onSend, onSendParts, onSendFailed, attachmentsNotReadyMessage, selectedSkillId }) {
481
+ const restoreCaretRef = useRef4(null);
482
+ useEffect4(() => {
483
+ const pending = restoreCaretRef.current;
484
+ if (!pending || pending.text !== text) return;
485
+ restoreCaretRef.current = null;
486
+ const el = textareaRef.current;
487
+ if (!el) return;
488
+ el.focus();
489
+ const start = Math.min(pending.start, text.length);
490
+ const end = Math.min(pending.end, text.length);
491
+ el.setSelectionRange(start, end);
492
+ }, [text]);
493
+ const [failedSend, setFailedSend] = useState5(null);
494
+ const failSend = useCallback4(
495
+ (error, draft, trimmed, parts, caret) => {
496
+ const message = sendFailureText(error, sendFailureMessage);
497
+ const restored = textRef.current === "";
498
+ if (restored) {
499
+ const el = textareaRef.current;
500
+ setText(draft);
501
+ if (el && el.value === draft) {
502
+ el.focus();
503
+ el.setSelectionRange(Math.min(caret.start, draft.length), Math.min(caret.end, draft.length));
504
+ } else {
505
+ restoreCaretRef.current = { text: draft, start: caret.start, end: caret.end };
506
+ }
507
+ }
508
+ setFailedSend({ message, text: draft, trimmed, parts, restored });
509
+ onSendFailed?.({ message, text: draft, parts, error, restored });
510
+ },
511
+ [onSendFailed, sendFailureMessage, setText]
512
+ );
513
+ const dispatchSend = useCallback4(
514
+ (draft, trimmed, parts, caret) => {
515
+ let outcome;
516
+ try {
517
+ outcome = onSendParts ? onSendParts(trimmed, parts) : onSend?.(trimmed);
518
+ } catch (error) {
519
+ failSend(error, draft, trimmed, parts, caret);
520
+ return;
521
+ }
522
+ if (isPromise(outcome)) {
523
+ void outcome.then(
524
+ (settled) => {
525
+ if (isRejectedOutcome(settled)) failSend(settled, draft, trimmed, parts, caret);
526
+ },
527
+ (error) => failSend(error, draft, trimmed, parts, caret)
528
+ );
529
+ return;
530
+ }
531
+ if (isRejectedOutcome(outcome)) failSend(outcome, draft, trimmed, parts, caret);
532
+ },
533
+ [onSend, onSendParts, failSend]
534
+ );
535
+ const send = useCallback4(() => {
536
+ const trimmed = text.trim();
537
+ if (sendBlockedByStream || disabled || sendDisabled) return;
538
+ const readyFiles = pendingFiles.filter((f) => f.status === "ready");
539
+ const sendable = canSubmitAttachmentsOnly ? pendingFiles : readyFiles;
540
+ if (!trimmed && sendable.length === 0 && !selectedSkillId) return;
541
+ if (!trimmed && readyFiles.length === 0 && pendingFiles.length > 0) {
542
+ const message = attachmentsNotReadyMessage ?? (pendingFiles.some((f) => f.status === "error") ? "Retry or remove the failed attachment before sending." : "Wait for the attachment to finish uploading.");
543
+ setFailedSend({ message, text: "", trimmed: "", parts: [], restored: true });
544
+ return;
545
+ }
546
+ const parts = onSendParts ? readyFiles.filter((f) => f.part).map((f) => f.part) : [];
547
+ const el = textareaRef.current;
548
+ const caret = { start: el?.selectionStart ?? text.length, end: el?.selectionEnd ?? text.length };
549
+ setFailedSend(null);
550
+ setText("");
551
+ textRef.current = "";
552
+ dispatchSend(text, trimmed, parts, caret);
553
+ }, [
554
+ text,
555
+ sendBlockedByStream,
556
+ disabled,
557
+ sendDisabled,
558
+ canSubmitAttachmentsOnly,
559
+ attachmentsNotReadyMessage,
560
+ onSendParts,
561
+ pendingFiles,
562
+ selectedSkillId,
563
+ setText,
564
+ dispatchSend
565
+ ]);
566
+ const retryFailedSend = useCallback4(() => {
567
+ const failure = failedSend;
568
+ if (!failure || sendBlockedByStream || disabled || sendDisabled) return;
569
+ setFailedSend(null);
570
+ const caret = { start: failure.text.length, end: failure.text.length };
571
+ dispatchSend(failure.text, failure.trimmed, failure.parts, caret);
572
+ }, [failedSend, sendBlockedByStream, disabled, sendDisabled, dispatchSend]);
573
+ return { failedSend, setFailedSend, send, retryFailedSend };
574
+ }
575
+
576
+ // src/web-react/composer-glyphs.tsx
577
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
277
578
  function SendGlyph({ className }) {
278
579
  return /* @__PURE__ */ jsx2("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx2("path", { d: "M22 2 11 13M22 2l-7 20-4-9-9-4 20-7z" }) });
279
580
  }
@@ -310,26 +611,17 @@ function MicGlyph({ className }) {
310
611
  /* @__PURE__ */ jsx2("path", { d: "M5 10v1a7 7 0 0 0 14 0v-1M12 18v4" })
311
612
  ] });
312
613
  }
614
+
615
+ // src/web-react/chat-composer.tsx
616
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
617
+ function createLazyMentionEditor() {
618
+ return lazy2(() => import("./mention-editor-B23OMFT2.js").then((m) => m.loadMentionEditor()));
619
+ }
620
+ var IS_APPLE_PLATFORM = typeof navigator !== "undefined" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform);
313
621
  var DEFAULT_MAX_HEIGHT = 168;
314
622
  var LINE_HEIGHT = 24;
315
623
  var TEXTAREA_PADDING_Y = 8;
316
624
  var DEFAULT_SEND_FAILURE = "Message not sent. Your draft is still here \u2014 try again.";
317
- function isRejectedOutcome(outcome) {
318
- return typeof outcome === "object" && outcome !== null && outcome.ok === false;
319
- }
320
- function isPromise(value) {
321
- return typeof value?.then === "function";
322
- }
323
- function sendFailureText(error, fallback) {
324
- if (typeof error === "object" && error !== null && "ok" in error) {
325
- const named = error.error;
326
- if (typeof named === "string" && named.trim() !== "") return named;
327
- return fallback;
328
- }
329
- if (typeof error === "string" && error.trim() !== "") return error;
330
- if (error instanceof Error && error.message.trim() !== "") return error.message;
331
- return fallback;
332
- }
333
625
  function ChatComposer({
334
626
  onSend,
335
627
  onSendParts,
@@ -382,37 +674,33 @@ function ChatComposer({
382
674
  const shellPrewarm = useWorkspacePrewarmHandle();
383
675
  const focusWithin = onFocusWithin ?? shellPrewarm?.reassert;
384
676
  const isControlled = value !== void 0;
385
- const [internal, setInternal] = useState3(initialValue ?? "");
677
+ const [internal, setInternal] = useState6(initialValue ?? "");
386
678
  const text = isControlled ? value : internal;
387
- const MentionEditor = useMemo(createLazyMentionEditor, []);
388
- const textRef = useRef2(text);
679
+ const MentionEditor = useMemo2(createLazyMentionEditor, []);
680
+ const textRef = useRef5(text);
389
681
  textRef.current = text;
390
- const textareaRef = useRef2(null);
391
- const richFocusRef = useRef2(null);
392
- const registerRichFocus = useCallback2((focus) => {
682
+ const textareaRef = useRef5(null);
683
+ const richFocusRef = useRef5(null);
684
+ const registerRichFocus = useCallback5((focus) => {
393
685
  richFocusRef.current = focus;
394
686
  }, []);
395
- const fileInputRef = useRef2(null);
396
- const folderInputRef = useRef2(null);
397
- const [dragOver, setDragOver] = useState3(false);
398
- const dragDepth = useRef2(0);
399
- const pastedImageCount = useRef2(0);
400
- const setText = useCallback2(
687
+ const { fileInputRef, folderInputRef, dragOver, handleFileChange, handleFolderChange, handlePaste, ingestPastedFiles, handleDragEnter, handleDragLeave, handleDragOver, handleDrop } = useComposerFileIntake({ onAttach, onAttachFolder, accept, onRejectFiles, pendingFiles });
688
+ const setText = useCallback5(
401
689
  (next) => {
402
690
  if (!isControlled) setInternal(next);
403
691
  onValueChange?.(next);
404
692
  },
405
693
  [isControlled, onValueChange]
406
694
  );
407
- const [dictateError, setDictateError] = useState3(null);
408
- const handleDictated = useCallback2(
695
+ const [dictateError, setDictateError] = useState6(null);
696
+ const handleDictated = useCallback5(
409
697
  (audio) => {
410
698
  setDictateError(null);
411
699
  onDictate?.(audio);
412
700
  },
413
701
  [onDictate]
414
702
  );
415
- const handleDictateError = useCallback2(
703
+ const handleDictateError = useCallback5(
416
704
  (message) => {
417
705
  setDictateError(message);
418
706
  onDictateError?.(message);
@@ -420,15 +708,15 @@ function ChatComposer({
420
708
  [onDictateError]
421
709
  );
422
710
  const dictation = useDictation({ onDictate: handleDictated, onError: handleDictateError });
423
- useEffect3(() => {
711
+ useEffect5(() => {
424
712
  const el = textareaRef.current;
425
713
  if (!el) return;
426
714
  el.style.height = "auto";
427
715
  el.style.height = `${Math.min(el.scrollHeight, maxHeight)}px`;
428
716
  }, [text, maxHeight, minRows]);
429
- const prevSeedRef = useRef2(null);
430
- const pendingCaretRef = useRef2(null);
431
- useEffect3(() => {
717
+ const prevSeedRef = useRef5(null);
718
+ const pendingCaretRef = useRef5(null);
719
+ useEffect5(() => {
432
720
  const prev = prevSeedRef.current;
433
721
  prevSeedRef.current = seed ?? null;
434
722
  if (seed == null || seed === prev || isControlled) return;
@@ -442,7 +730,7 @@ function ChatComposer({
442
730
  pendingCaretRef.current = seed;
443
731
  }
444
732
  }, [seed, setText, onSeedApplied, isControlled]);
445
- useEffect3(() => {
733
+ useEffect5(() => {
446
734
  if (pendingCaretRef.current == null || pendingCaretRef.current !== text)
447
735
  return;
448
736
  pendingCaretRef.current = null;
@@ -451,20 +739,13 @@ function ChatComposer({
451
739
  el.focus();
452
740
  el.setSelectionRange(text.length, text.length);
453
741
  }, [text]);
454
- const restoreCaretRef = useRef2(null);
455
- useEffect3(() => {
456
- const pending = restoreCaretRef.current;
457
- if (!pending || pending.text !== text) return;
458
- restoreCaretRef.current = null;
459
- const el = textareaRef.current;
460
- if (!el) return;
461
- el.focus();
462
- const start = Math.min(pending.start, text.length);
463
- const end = Math.min(pending.end, text.length);
464
- el.setSelectionRange(start, end);
465
- }, [text]);
742
+ const sendableFiles = canSubmitAttachmentsOnly ? pendingFiles : pendingFiles.filter((f) => f.status === "ready");
743
+ const hasSendable = text.trim().length > 0 || sendableFiles.length > 0 || Boolean(selectedSkillId);
744
+ const sendBlockedByStream = isStreaming && !canSubmitWhileBusy;
745
+ const canSend = hasSendable && !sendBlockedByStream && !disabled && !sendDisabled;
746
+ const { failedSend, setFailedSend, send, retryFailedSend } = useComposerSend({ text, textRef, textareaRef, setText, pendingFiles, sendFailureMessage, sendBlockedByStream, disabled, sendDisabled, canSubmitAttachmentsOnly, onSend, onSendParts, onSendFailed, attachmentsNotReadyMessage, selectedSkillId });
466
747
  const mentionEnabled = mention != null;
467
- useEffect3(() => {
748
+ useEffect5(() => {
468
749
  if (!focusShortcut || disabled) return;
469
750
  function onKeyDown(e) {
470
751
  if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "l") {
@@ -482,191 +763,7 @@ function ChatComposer({
482
763
  document.addEventListener("keydown", onKeyDown);
483
764
  return () => document.removeEventListener("keydown", onKeyDown);
484
765
  }, [focusShortcut, disabled, mentionEnabled]);
485
- const sendableFiles = canSubmitAttachmentsOnly ? pendingFiles : pendingFiles.filter((f) => f.status === "ready");
486
- const hasSendable = text.trim().length > 0 || sendableFiles.length > 0 || Boolean(selectedSkillId);
487
- const sendBlockedByStream = isStreaming && !canSubmitWhileBusy;
488
- const canSend = hasSendable && !sendBlockedByStream && !disabled && !sendDisabled;
489
- const [failedSend, setFailedSend] = useState3(null);
490
- const failSend = useCallback2(
491
- (error, draft, trimmed, parts, caret) => {
492
- const message = sendFailureText(error, sendFailureMessage);
493
- const restored = textRef.current === "";
494
- if (restored) {
495
- const el = textareaRef.current;
496
- setText(draft);
497
- if (el && el.value === draft) {
498
- el.focus();
499
- el.setSelectionRange(Math.min(caret.start, draft.length), Math.min(caret.end, draft.length));
500
- } else {
501
- restoreCaretRef.current = { text: draft, start: caret.start, end: caret.end };
502
- }
503
- }
504
- setFailedSend({ message, text: draft, trimmed, parts, restored });
505
- onSendFailed?.({ message, text: draft, parts, error, restored });
506
- },
507
- [onSendFailed, sendFailureMessage, setText]
508
- );
509
- const dispatchSend = useCallback2(
510
- (draft, trimmed, parts, caret) => {
511
- let outcome;
512
- try {
513
- outcome = onSendParts ? onSendParts(trimmed, parts) : onSend?.(trimmed);
514
- } catch (error) {
515
- failSend(error, draft, trimmed, parts, caret);
516
- return;
517
- }
518
- if (isPromise(outcome)) {
519
- void outcome.then(
520
- (settled) => {
521
- if (isRejectedOutcome(settled)) failSend(settled, draft, trimmed, parts, caret);
522
- },
523
- (error) => failSend(error, draft, trimmed, parts, caret)
524
- );
525
- return;
526
- }
527
- if (isRejectedOutcome(outcome)) failSend(outcome, draft, trimmed, parts, caret);
528
- },
529
- [onSend, onSendParts, failSend]
530
- );
531
- const send = useCallback2(() => {
532
- const trimmed = text.trim();
533
- if (sendBlockedByStream || disabled || sendDisabled) return;
534
- const readyFiles = pendingFiles.filter((f) => f.status === "ready");
535
- const sendable = canSubmitAttachmentsOnly ? pendingFiles : readyFiles;
536
- if (!trimmed && sendable.length === 0 && !selectedSkillId) return;
537
- if (!trimmed && readyFiles.length === 0 && pendingFiles.length > 0) {
538
- const message = attachmentsNotReadyMessage ?? (pendingFiles.some((f) => f.status === "error") ? "Retry or remove the failed attachment before sending." : "Wait for the attachment to finish uploading.");
539
- setFailedSend({ message, text: "", trimmed: "", parts: [], restored: true });
540
- return;
541
- }
542
- const parts = onSendParts ? readyFiles.filter((f) => f.part).map((f) => f.part) : [];
543
- const el = textareaRef.current;
544
- const caret = { start: el?.selectionStart ?? text.length, end: el?.selectionEnd ?? text.length };
545
- setFailedSend(null);
546
- setText("");
547
- textRef.current = "";
548
- dispatchSend(text, trimmed, parts, caret);
549
- }, [
550
- text,
551
- sendBlockedByStream,
552
- disabled,
553
- sendDisabled,
554
- canSubmitAttachmentsOnly,
555
- attachmentsNotReadyMessage,
556
- onSendParts,
557
- pendingFiles,
558
- selectedSkillId,
559
- setText,
560
- dispatchSend
561
- ]);
562
- const retryFailedSend = useCallback2(() => {
563
- const failure = failedSend;
564
- if (!failure || sendBlockedByStream || disabled || sendDisabled) return;
565
- setFailedSend(null);
566
- const caret = { start: failure.text.length, end: failure.text.length };
567
- dispatchSend(failure.text, failure.trimmed, failure.parts, caret);
568
- }, [failedSend, sendBlockedByStream, disabled, sendDisabled, dispatchSend]);
569
- const slashPanelRef = useRef2(null);
570
- const cardRef = useRef2(null);
571
- const slashListId = useId();
572
- const [mentionSuggestionOpen, setMentionSuggestionOpen] = useState3(false);
573
- const [slashActive, setSlashActive] = useState3(0);
574
- const [slashDismissedFor, setSlashDismissedFor] = useState3(null);
575
- const hasSkills = Boolean(onSelectedSkillChange && eligibleSkills.length > 0);
576
- const commandToken = !mention && slashCommands?.length ? /^\/(\S*)$/.exec(text)?.[1] : void 0;
577
- const skillToken = hasSkills ? /^\/(\S*)$/.exec(text)?.[1] : void 0;
578
- const skillInvocation = hasSkills ? /^\/skill(?:\s+(.*))?$/i.exec(text) : null;
579
- const skillQuery = skillInvocation ? skillInvocation[1] ?? "" : void 0;
580
- const slashToken = skillQuery ?? skillToken ?? commandToken;
581
- const slashOpen = slashToken !== void 0 && text !== slashDismissedFor && !mentionSuggestionOpen;
582
- const slashItems = useMemo(
583
- () => [
584
- ...(!mention ? slashCommands ?? [] : []).map((command) => ({
585
- id: `command:${command.name}`,
586
- group: "Commands",
587
- label: `/${command.name}`,
588
- description: command.description,
589
- keywords: [command.name, command.description]
590
- })),
591
- ...(onSelectedSkillChange ? eligibleSkills : []).map((skill) => ({
592
- id: `skill:${skill.id}`,
593
- group: "Skills",
594
- label: `/skill ${skill.name}`,
595
- description: skill.description,
596
- keywords: [skill.id, skill.name, skill.description]
597
- }))
598
- ],
599
- [slashCommands, mention, eligibleSkills, onSelectedSkillChange]
600
- );
601
- const slashFiltered = useMemo(
602
- () => {
603
- if (slashToken === void 0) return [];
604
- const items = skillQuery !== void 0 ? slashItems.filter((item) => item.group === "Skills") : slashItems;
605
- return filterCommandPaletteItems(items, slashToken);
606
- },
607
- [slashItems, slashToken, skillQuery]
608
- );
609
- const slashActiveIndex = slashFiltered.length === 0 ? 0 : Math.min(slashActive, slashFiltered.length - 1);
610
- useEffect3(() => {
611
- setSlashActive(0);
612
- }, [slashToken]);
613
- useEffect3(() => {
614
- if (!slashOpen) return;
615
- document.getElementById(`${slashListId}-${slashActiveIndex}`)?.scrollIntoView?.({ block: "nearest" });
616
- }, [slashOpen, slashActiveIndex, slashListId]);
617
- useEffect3(() => {
618
- if (!slashOpen) return;
619
- function onMouseDown(e) {
620
- const target = e.target;
621
- if (cardRef.current?.contains(target)) return;
622
- if (slashPanelRef.current?.contains(target)) return;
623
- setSlashDismissedFor(textRef.current);
624
- }
625
- document.addEventListener("mousedown", onMouseDown);
626
- return () => document.removeEventListener("mousedown", onMouseDown);
627
- }, [slashOpen]);
628
- const pickSlash = useCallback2(
629
- (id) => {
630
- setText("");
631
- setSlashDismissedFor(null);
632
- if (id.startsWith("skill:")) {
633
- const skill = eligibleSkills.find((item) => item.id === id.slice("skill:".length));
634
- if (skill) onSelectedSkillChange?.(skill);
635
- } else if (id.startsWith("command:")) {
636
- slashCommands?.find((command) => command.name === id.slice("command:".length))?.run();
637
- }
638
- },
639
- [slashCommands, eligibleSkills, onSelectedSkillChange, setText]
640
- );
641
- const handleSlashKeyDown = (e) => {
642
- if (slashOpen) {
643
- if (e.key === "ArrowDown") {
644
- e.preventDefault();
645
- if (slashFiltered.length > 0) setSlashActive((slashActiveIndex + 1) % slashFiltered.length);
646
- return true;
647
- }
648
- if (e.key === "ArrowUp") {
649
- e.preventDefault();
650
- if (slashFiltered.length > 0)
651
- setSlashActive((slashActiveIndex - 1 + slashFiltered.length) % slashFiltered.length);
652
- return true;
653
- }
654
- if (e.key === "Enter" && !e.shiftKey || e.key === "Tab") {
655
- const item = slashFiltered[slashActiveIndex];
656
- if (item) {
657
- e.preventDefault();
658
- pickSlash(item.id);
659
- return true;
660
- }
661
- }
662
- if (e.key === "Escape") {
663
- e.preventDefault();
664
- setSlashDismissedFor(text);
665
- return true;
666
- }
667
- }
668
- return false;
669
- };
766
+ const { cardRef, slashPanelRef, slashListId, setMentionSuggestionOpen, slashActiveIndex, slashOpen, slashFiltered, skillQuery, hasSkills, setSlashActive, pickSlash, handleSlashKeyDown } = useComposerCommands({ text, textRef, setText, mention, slashCommands, eligibleSkills, onSelectedSkillChange });
670
767
  const handleKeyDown = (e) => {
671
768
  if (e.nativeEvent.isComposing) return;
672
769
  if (handleSlashKeyDown(e)) return;
@@ -675,84 +772,12 @@ function ChatComposer({
675
772
  send();
676
773
  }
677
774
  };
678
- const deliverFiles = useCallback2(
679
- (files, original) => {
680
- if (!onAttach || files.length === 0) return;
681
- const { accepted, rejected } = filterAcceptedFiles(files, accept);
682
- if (rejected.length > 0) onRejectFiles?.(rejected);
683
- if (accepted.length === 0) return;
684
- const unchanged = accepted.length === original.length && accepted.every((file, i) => file === original[i]);
685
- if (unchanged) {
686
- onAttach(original);
687
- return;
688
- }
689
- const transfer = new DataTransfer();
690
- for (const file of accepted) transfer.items.add(file);
691
- onAttach(transfer.files);
692
- },
693
- [onAttach, onRejectFiles, accept]
694
- );
695
- const handleFileChange = (e) => {
696
- if (e.target.files?.length) deliverFiles(Array.from(e.target.files), e.target.files);
697
- e.target.value = "";
698
- };
699
- const ingestPastedFiles = (clipboardFiles) => {
700
- if (!onAttach || clipboardFiles.length === 0) return false;
701
- const { files, nextIndex } = renamePastedImages(
702
- Array.from(clipboardFiles),
703
- pastedImageCount.current,
704
- pendingFiles.map((f) => f.name)
705
- );
706
- pastedImageCount.current = nextIndex;
707
- deliverFiles(files, clipboardFiles);
708
- return true;
709
- };
710
- const handlePaste = (e) => {
711
- const clipboardFiles = e.clipboardData?.files;
712
- if (!clipboardFiles || clipboardFiles.length === 0) return;
713
- if (ingestPastedFiles(clipboardFiles)) e.preventDefault();
714
- };
715
- const handleFolderChange = (e) => {
716
- if (e.target.files?.length) (onAttachFolder ?? onAttach)?.(e.target.files);
717
- e.target.value = "";
718
- };
719
- const handleDragEnter = useCallback2((e) => {
720
- e.preventDefault();
721
- e.stopPropagation();
722
- dragDepth.current++;
723
- if (e.dataTransfer?.types.includes("Files")) setDragOver(true);
724
- }, []);
725
- const handleDragLeave = useCallback2((e) => {
726
- e.preventDefault();
727
- e.stopPropagation();
728
- dragDepth.current--;
729
- if (dragDepth.current <= 0) {
730
- dragDepth.current = 0;
731
- setDragOver(false);
732
- }
733
- }, []);
734
- const handleDragOver = useCallback2((e) => {
735
- e.preventDefault();
736
- e.stopPropagation();
737
- if (e.dataTransfer) e.dataTransfer.dropEffect = "copy";
738
- }, []);
739
- const handleDrop = useCallback2(
740
- (e) => {
741
- e.preventDefault();
742
- e.stopPropagation();
743
- dragDepth.current = 0;
744
- setDragOver(false);
745
- const files = e.dataTransfer?.files;
746
- if (files?.length) deliverFiles(Array.from(files), files);
747
- },
748
- [deliverFiles]
749
- );
750
775
  const folderChips = pendingFiles.filter((f) => f.kind === "folder");
751
776
  const fileChips = pendingFiles.filter((f) => f.kind !== "folder");
752
777
  const showAbove = controls != null && controlsPlacement === "above";
753
778
  const showInline = controls != null && !showAbove;
754
779
  const inputMinHeight = minRows * LINE_HEIGHT + TEXTAREA_PADDING_Y;
755
- const textareaInput = /* @__PURE__ */ jsx2(
780
+ const textareaInput = /* @__PURE__ */ jsx3(
756
781
  "textarea",
757
782
  {
758
783
  ref: textareaRef,
@@ -770,7 +795,7 @@ function ChatComposer({
770
795
  className: "w-full resize-none bg-transparent px-1.5 py-1 text-base leading-6 text-foreground placeholder:text-muted-foreground disabled:opacity-50"
771
796
  }
772
797
  );
773
- return /* @__PURE__ */ jsxs2(
798
+ return /* @__PURE__ */ jsxs3(
774
799
  "div",
775
800
  {
776
801
  className: `relative ${className ?? ""}`,
@@ -780,21 +805,21 @@ function ChatComposer({
780
805
  onDragOver: onAttach ? handleDragOver : void 0,
781
806
  onDrop: onAttach ? handleDrop : void 0,
782
807
  children: [
783
- dragOver && /* @__PURE__ */ jsx2("div", { className: "pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-2xl border-2 border-dashed border-primary/50 bg-card", children: /* @__PURE__ */ jsxs2("div", { className: "text-center", children: [
784
- /* @__PURE__ */ jsx2("span", { className: "mx-auto mb-2 flex h-11 w-11 items-center justify-center rounded-xl bg-primary/10 text-primary", children: /* @__PURE__ */ jsx2(UploadGlyph, { className: "h-5 w-5" }) }),
785
- /* @__PURE__ */ jsx2("p", { className: "text-sm font-semibold text-foreground", children: dropTitle }),
786
- /* @__PURE__ */ jsx2("p", { className: "mt-0.5 text-xs text-muted-foreground", children: dropDescription })
808
+ dragOver && /* @__PURE__ */ jsx3("div", { className: "pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-2xl border-2 border-dashed border-primary/50 bg-card", children: /* @__PURE__ */ jsxs3("div", { className: "text-center", children: [
809
+ /* @__PURE__ */ jsx3("span", { className: "mx-auto mb-2 flex h-11 w-11 items-center justify-center rounded-xl bg-primary/10 text-primary", children: /* @__PURE__ */ jsx3(UploadGlyph, { className: "h-5 w-5" }) }),
810
+ /* @__PURE__ */ jsx3("p", { className: "text-sm font-semibold text-foreground", children: dropTitle }),
811
+ /* @__PURE__ */ jsx3("p", { className: "mt-0.5 text-xs text-muted-foreground", children: dropDescription })
787
812
  ] }) }),
788
- showAbove && /* @__PURE__ */ jsx2("div", { className: "mb-1.5 flex flex-wrap items-center gap-1.5 px-1", children: controls }),
789
- dictateError && /* @__PURE__ */ jsxs2(
813
+ showAbove && /* @__PURE__ */ jsx3("div", { className: "mb-1.5 flex flex-wrap items-center gap-1.5 px-1", children: controls }),
814
+ dictateError && /* @__PURE__ */ jsxs3(
790
815
  "div",
791
816
  {
792
817
  role: "alert",
793
818
  "data-testid": "composer-dictate-error",
794
819
  className: "mb-2 flex items-start gap-2 rounded-xl border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
795
820
  children: [
796
- /* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1", children: dictateError }),
797
- /* @__PURE__ */ jsx2(
821
+ /* @__PURE__ */ jsx3("span", { className: "min-w-0 flex-1", children: dictateError }),
822
+ /* @__PURE__ */ jsx3(
798
823
  "button",
799
824
  {
800
825
  type: "button",
@@ -807,16 +832,16 @@ function ChatComposer({
807
832
  ]
808
833
  }
809
834
  ),
810
- failedSend && /* @__PURE__ */ jsxs2(
835
+ failedSend && /* @__PURE__ */ jsxs3(
811
836
  "div",
812
837
  {
813
838
  role: "alert",
814
839
  "data-testid": "composer-send-error",
815
840
  className: "mb-2 rounded-xl border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
816
841
  children: [
817
- /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-2", children: [
818
- /* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1", children: failedSend.message }),
819
- /* @__PURE__ */ jsx2(
842
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-start gap-2", children: [
843
+ /* @__PURE__ */ jsx3("span", { className: "min-w-0 flex-1", children: failedSend.message }),
844
+ /* @__PURE__ */ jsx3(
820
845
  "button",
821
846
  {
822
847
  type: "button",
@@ -827,8 +852,8 @@ function ChatComposer({
827
852
  }
828
853
  )
829
854
  ] }),
830
- !failedSend.restored && /* @__PURE__ */ jsxs2("div", { className: "mt-1.5", children: [
831
- /* @__PURE__ */ jsx2(
855
+ !failedSend.restored && /* @__PURE__ */ jsxs3("div", { className: "mt-1.5", children: [
856
+ /* @__PURE__ */ jsx3(
832
857
  "p",
833
858
  {
834
859
  "data-testid": "composer-unsent-draft",
@@ -836,7 +861,7 @@ function ChatComposer({
836
861
  children: failedSend.text
837
862
  }
838
863
  ),
839
- /* @__PURE__ */ jsx2(
864
+ /* @__PURE__ */ jsx3(
840
865
  "button",
841
866
  {
842
867
  type: "button",
@@ -851,78 +876,78 @@ function ChatComposer({
851
876
  ]
852
877
  }
853
878
  ),
854
- selectedSkillId && /* @__PURE__ */ jsx2("div", { "aria-label": "Selected skill", className: "mb-2 flex min-w-0 flex-wrap gap-1.5", children: /* @__PURE__ */ jsxs2("span", { className: "inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border border-primary/30 bg-primary/10 px-2.5 py-1 text-xs text-primary", children: [
855
- /* @__PURE__ */ jsxs2("span", { className: "min-w-0 truncate", children: [
879
+ selectedSkillId && /* @__PURE__ */ jsx3("div", { "aria-label": "Selected skill", className: "mb-2 flex min-w-0 flex-wrap gap-1.5", children: /* @__PURE__ */ jsxs3("span", { className: "inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border border-primary/30 bg-primary/10 px-2.5 py-1 text-xs text-primary", children: [
880
+ /* @__PURE__ */ jsxs3("span", { className: "min-w-0 truncate", children: [
856
881
  "Skill: ",
857
882
  eligibleSkills.find((skill) => skill.id === selectedSkillId)?.name ?? selectedSkillId
858
883
  ] }),
859
- onSelectedSkillChange && /* @__PURE__ */ jsx2(
884
+ onSelectedSkillChange && /* @__PURE__ */ jsx3(
860
885
  "button",
861
886
  {
862
887
  type: "button",
863
888
  "aria-label": "Remove selected skill",
864
889
  onClick: () => onSelectedSkillChange(null),
865
890
  className: "shrink-0 rounded p-0.5 text-primary/70 transition hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
866
- children: /* @__PURE__ */ jsx2(CloseGlyph, { className: "h-3 w-3" })
891
+ children: /* @__PURE__ */ jsx3(CloseGlyph, { className: "h-3 w-3" })
867
892
  }
868
893
  )
869
894
  ] }) }),
870
- contextItems.length > 0 && /* @__PURE__ */ jsx2("div", { "aria-label": "Message context", className: "mb-2 flex min-w-0 flex-wrap gap-1.5", children: contextItems.map((item) => /* @__PURE__ */ jsxs2(
895
+ contextItems.length > 0 && /* @__PURE__ */ jsx3("div", { "aria-label": "Message context", className: "mb-2 flex min-w-0 flex-wrap gap-1.5", children: contextItems.map((item) => /* @__PURE__ */ jsxs3(
871
896
  "span",
872
897
  {
873
898
  className: "inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border border-primary/30 bg-primary/10 px-2.5 py-1 text-xs text-primary",
874
899
  children: [
875
- item.icon && /* @__PURE__ */ jsx2("span", { className: "shrink-0", "aria-hidden": true, children: item.icon }),
876
- /* @__PURE__ */ jsx2("span", { className: "min-w-0 truncate", children: item.label }),
877
- item.onRemove && /* @__PURE__ */ jsx2(
900
+ item.icon && /* @__PURE__ */ jsx3("span", { className: "shrink-0", "aria-hidden": true, children: item.icon }),
901
+ /* @__PURE__ */ jsx3("span", { className: "min-w-0 truncate", children: item.label }),
902
+ item.onRemove && /* @__PURE__ */ jsx3(
878
903
  "button",
879
904
  {
880
905
  type: "button",
881
906
  "aria-label": `Remove context ${item.label}`,
882
907
  onClick: item.onRemove,
883
908
  className: "shrink-0 rounded p-0.5 text-primary/70 transition hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
884
- children: /* @__PURE__ */ jsx2(CloseGlyph, { className: "h-3 w-3" })
909
+ children: /* @__PURE__ */ jsx3(CloseGlyph, { className: "h-3 w-3" })
885
910
  }
886
911
  )
887
912
  ]
888
913
  },
889
914
  item.id
890
915
  )) }),
891
- pendingFiles.length > 0 && /* @__PURE__ */ jsx2("div", { className: "mb-2 flex flex-wrap gap-1.5", children: [...folderChips, ...fileChips].map((f) => {
916
+ pendingFiles.length > 0 && /* @__PURE__ */ jsx3("div", { className: "mb-2 flex flex-wrap gap-1.5", children: [...folderChips, ...fileChips].map((f) => {
892
917
  const isError = f.status === "error";
893
- return /* @__PURE__ */ jsxs2(
918
+ return /* @__PURE__ */ jsxs3(
894
919
  "span",
895
920
  {
896
921
  title: isError ? f.errorMessage : void 0,
897
922
  className: `inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs ${isError ? "border-destructive/40 text-destructive" : "border-border bg-secondary text-foreground"} ${f.status === "pending" ? "opacity-60" : ""}`,
898
923
  children: [
899
- f.kind !== "folder" && f.previewUrl ? /* @__PURE__ */ jsx2("img", { src: f.previewUrl, alt: "", className: "h-8 w-8 shrink-0 rounded object-cover" }) : f.kind === "folder" ? /* @__PURE__ */ jsx2(FolderGlyph, { className: "h-3 w-3 shrink-0" }) : /* @__PURE__ */ jsx2(PaperclipGlyph, { className: "h-3 w-3 shrink-0" }),
900
- /* @__PURE__ */ jsx2("span", { className: "max-w-[150px] truncate", children: f.name }),
901
- f.fileCount !== void 0 && /* @__PURE__ */ jsxs2("span", { className: "text-muted-foreground", children: [
924
+ f.kind !== "folder" && f.previewUrl ? /* @__PURE__ */ jsx3("img", { src: f.previewUrl, alt: "", className: "h-8 w-8 shrink-0 rounded object-cover" }) : f.kind === "folder" ? /* @__PURE__ */ jsx3(FolderGlyph, { className: "h-3 w-3 shrink-0" }) : /* @__PURE__ */ jsx3(PaperclipGlyph, { className: "h-3 w-3 shrink-0" }),
925
+ /* @__PURE__ */ jsx3("span", { className: "max-w-[150px] truncate", children: f.name }),
926
+ f.fileCount !== void 0 && /* @__PURE__ */ jsxs3("span", { className: "text-muted-foreground", children: [
902
927
  "(",
903
928
  f.fileCount,
904
929
  ")"
905
930
  ] }),
906
- f.status === "uploading" && /* @__PURE__ */ jsx2("span", { className: "h-3 w-3 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
907
- isError && f.errorMessage && /* @__PURE__ */ jsx2("span", { className: "max-w-[150px] truncate text-destructive/80", children: f.errorMessage }),
908
- isError && onRetryFile && /* @__PURE__ */ jsx2(
931
+ f.status === "uploading" && /* @__PURE__ */ jsx3("span", { className: "h-3 w-3 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
932
+ isError && f.errorMessage && /* @__PURE__ */ jsx3("span", { className: "max-w-[150px] truncate text-destructive/80", children: f.errorMessage }),
933
+ isError && onRetryFile && /* @__PURE__ */ jsx3(
909
934
  "button",
910
935
  {
911
936
  type: "button",
912
937
  "aria-label": `Retry upload ${f.name}`,
913
938
  onClick: () => onRetryFile(f.id),
914
939
  className: "rounded p-0.5 text-muted-foreground transition hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
915
- children: /* @__PURE__ */ jsx2(RetryGlyph, { className: "h-3 w-3" })
940
+ children: /* @__PURE__ */ jsx3(RetryGlyph, { className: "h-3 w-3" })
916
941
  }
917
942
  ),
918
- onRemoveFile && /* @__PURE__ */ jsx2(
943
+ onRemoveFile && /* @__PURE__ */ jsx3(
919
944
  "button",
920
945
  {
921
946
  type: "button",
922
947
  "aria-label": `Remove ${f.name}`,
923
948
  onClick: () => onRemoveFile(f.id),
924
949
  className: "rounded p-0.5 text-muted-foreground transition hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
925
- children: /* @__PURE__ */ jsx2(CloseGlyph, { className: "h-3 w-3" })
950
+ children: /* @__PURE__ */ jsx3(CloseGlyph, { className: "h-3 w-3" })
926
951
  }
927
952
  )
928
953
  ]
@@ -930,7 +955,7 @@ function ChatComposer({
930
955
  f.id
931
956
  );
932
957
  }) }),
933
- /* @__PURE__ */ jsxs2(
958
+ /* @__PURE__ */ jsxs3(
934
959
  "div",
935
960
  {
936
961
  ref: cardRef,
@@ -940,9 +965,9 @@ function ChatComposer({
940
965
  mention ? (
941
966
  // The basic textarea stays usable through download, initialization,
942
967
  // and failure.
943
- /* @__PURE__ */ jsx2(LazyLoadBoundary, { renderFailure: () => /* @__PURE__ */ jsxs2(Fragment, { children: [
968
+ /* @__PURE__ */ jsx3(LazyLoadBoundary, { renderFailure: () => /* @__PURE__ */ jsxs3(Fragment, { children: [
944
969
  textareaInput,
945
- /* @__PURE__ */ jsx2(
970
+ /* @__PURE__ */ jsx3(
946
971
  "div",
947
972
  {
948
973
  role: "alert",
@@ -950,7 +975,7 @@ function ChatComposer({
950
975
  children: "Mentions are unavailable. You can still send."
951
976
  }
952
977
  )
953
- ] }), children: /* @__PURE__ */ jsx2(Suspense, { fallback: textareaInput, children: /* @__PURE__ */ jsx2(
978
+ ] }), children: /* @__PURE__ */ jsx3(Suspense, { fallback: textareaInput, children: /* @__PURE__ */ jsx3(
954
979
  MentionEditor,
955
980
  {
956
981
  value: text,
@@ -977,9 +1002,9 @@ function ChatComposer({
977
1002
  // input's own outline (`[data-composer-input]:focus-visible`).
978
1003
  textareaInput
979
1004
  ),
980
- /* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-end gap-2", children: [
981
- onAttach && /* @__PURE__ */ jsxs2(Fragment, { children: [
982
- /* @__PURE__ */ jsx2(
1005
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-end gap-2", children: [
1006
+ onAttach && /* @__PURE__ */ jsxs3(Fragment, { children: [
1007
+ /* @__PURE__ */ jsx3(
983
1008
  "button",
984
1009
  {
985
1010
  type: "button",
@@ -988,13 +1013,13 @@ function ChatComposer({
988
1013
  "aria-label": "Attach files",
989
1014
  title: "Attach files",
990
1015
  className: "shrink-0 rounded-lg p-2 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
991
- children: /* @__PURE__ */ jsx2(PaperclipGlyph, { className: "h-4 w-4" })
1016
+ children: /* @__PURE__ */ jsx3(PaperclipGlyph, { className: "h-4 w-4" })
992
1017
  }
993
1018
  ),
994
- /* @__PURE__ */ jsx2("input", { ref: fileInputRef, type: "file", multiple: true, className: "hidden", accept, onChange: handleFileChange })
1019
+ /* @__PURE__ */ jsx3("input", { ref: fileInputRef, type: "file", multiple: true, className: "hidden", accept, onChange: handleFileChange })
995
1020
  ] }),
996
- onAttachFolder && /* @__PURE__ */ jsxs2(Fragment, { children: [
997
- /* @__PURE__ */ jsx2(
1021
+ onAttachFolder && /* @__PURE__ */ jsxs3(Fragment, { children: [
1022
+ /* @__PURE__ */ jsx3(
998
1023
  "button",
999
1024
  {
1000
1025
  type: "button",
@@ -1003,10 +1028,10 @@ function ChatComposer({
1003
1028
  "aria-label": "Attach folder",
1004
1029
  title: "Attach folder",
1005
1030
  className: "shrink-0 rounded-lg p-2 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1006
- children: /* @__PURE__ */ jsx2(FolderGlyph, { className: "h-4 w-4" })
1031
+ children: /* @__PURE__ */ jsx3(FolderGlyph, { className: "h-4 w-4" })
1007
1032
  }
1008
1033
  ),
1009
- /* @__PURE__ */ jsx2(
1034
+ /* @__PURE__ */ jsx3(
1010
1035
  "input",
1011
1036
  {
1012
1037
  ref: folderInputRef,
@@ -1018,7 +1043,7 @@ function ChatComposer({
1018
1043
  }
1019
1044
  )
1020
1045
  ] }),
1021
- /* @__PURE__ */ jsx2(
1046
+ /* @__PURE__ */ jsx3(
1022
1047
  "div",
1023
1048
  {
1024
1049
  "data-testid": "composer-controls",
@@ -1026,11 +1051,11 @@ function ChatComposer({
1026
1051
  children: showInline && controls
1027
1052
  }
1028
1053
  ),
1029
- /* @__PURE__ */ jsxs2("div", { "data-testid": "composer-actions", className: "ml-auto flex min-w-0 max-w-full flex-wrap items-end justify-end gap-2", children: [
1030
- trailing && /* @__PURE__ */ jsx2("div", { "data-testid": "composer-trailing", className: "flex min-w-0 flex-wrap items-center justify-end gap-1.5", children: trailing }),
1031
- onDictate && dictation.supported ? dictation.recording ? /* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center gap-1.5", children: [
1032
- /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", className: "h-2 w-2 animate-pulse rounded-full bg-destructive" }),
1033
- /* @__PURE__ */ jsx2(
1054
+ /* @__PURE__ */ jsxs3("div", { "data-testid": "composer-actions", className: "ml-auto flex min-w-0 max-w-full flex-wrap items-end justify-end gap-2", children: [
1055
+ trailing && /* @__PURE__ */ jsx3("div", { "data-testid": "composer-trailing", className: "flex min-w-0 flex-wrap items-center justify-end gap-1.5", children: trailing }),
1056
+ onDictate && dictation.supported ? dictation.recording ? /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-1.5", children: [
1057
+ /* @__PURE__ */ jsx3("span", { "aria-hidden": "true", className: "h-2 w-2 animate-pulse rounded-full bg-destructive" }),
1058
+ /* @__PURE__ */ jsx3(
1034
1059
  "span",
1035
1060
  {
1036
1061
  "aria-hidden": "true",
@@ -1039,8 +1064,8 @@ function ChatComposer({
1039
1064
  children: formatDictationElapsed(dictation.elapsedSeconds)
1040
1065
  }
1041
1066
  ),
1042
- /* @__PURE__ */ jsx2("span", { role: "status", className: "sr-only", children: "Recording" }),
1043
- /* @__PURE__ */ jsx2(
1067
+ /* @__PURE__ */ jsx3("span", { role: "status", className: "sr-only", children: "Recording" }),
1068
+ /* @__PURE__ */ jsx3(
1044
1069
  "button",
1045
1070
  {
1046
1071
  type: "button",
@@ -1048,10 +1073,10 @@ function ChatComposer({
1048
1073
  "aria-label": "Stop dictation",
1049
1074
  title: "Stop dictation",
1050
1075
  className: "shrink-0 rounded-lg p-2 text-destructive transition hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1051
- children: /* @__PURE__ */ jsx2(StopGlyph, { className: "h-4 w-4" })
1076
+ children: /* @__PURE__ */ jsx3(StopGlyph, { className: "h-4 w-4" })
1052
1077
  }
1053
1078
  )
1054
- ] }) : /* @__PURE__ */ jsx2(
1079
+ ] }) : /* @__PURE__ */ jsx3(
1055
1080
  "button",
1056
1081
  {
1057
1082
  type: "button",
@@ -1060,10 +1085,10 @@ function ChatComposer({
1060
1085
  "aria-label": "Dictate message",
1061
1086
  title: "Dictate message",
1062
1087
  className: "shrink-0 rounded-lg p-2 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1063
- children: /* @__PURE__ */ jsx2(MicGlyph, { className: "h-4 w-4" })
1088
+ children: /* @__PURE__ */ jsx3(MicGlyph, { className: "h-4 w-4" })
1064
1089
  }
1065
1090
  ) : null,
1066
- isStreaming ? sendVariant === "icon" ? /* @__PURE__ */ jsx2(
1091
+ isStreaming ? sendVariant === "icon" ? /* @__PURE__ */ jsx3(
1067
1092
  "button",
1068
1093
  {
1069
1094
  type: "button",
@@ -1071,9 +1096,9 @@ function ChatComposer({
1071
1096
  "aria-label": "Stop response",
1072
1097
  title: "Stop",
1073
1098
  className: "inline-flex size-[var(--control-height-sm,2rem)] shrink-0 items-center justify-center rounded-full border border-border bg-transparent text-foreground transition hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1074
- children: /* @__PURE__ */ jsx2(StopGlyph, { className: "h-3 w-3" })
1099
+ children: /* @__PURE__ */ jsx3(StopGlyph, { className: "h-3 w-3" })
1075
1100
  }
1076
- ) : /* @__PURE__ */ jsxs2(
1101
+ ) : /* @__PURE__ */ jsxs3(
1077
1102
  "button",
1078
1103
  {
1079
1104
  type: "button",
@@ -1081,11 +1106,11 @@ function ChatComposer({
1081
1106
  "aria-label": "Stop response",
1082
1107
  className: "inline-flex h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 rounded-full bg-destructive/15 px-3.5 text-sm font-medium text-destructive transition hover:bg-destructive/25 focus:outline-none focus-visible:ring-2 focus-visible:ring-destructive/50",
1083
1108
  children: [
1084
- /* @__PURE__ */ jsx2(StopGlyph, { className: "h-3.5 w-3.5" }),
1085
- /* @__PURE__ */ jsx2("span", { children: "Stop" })
1109
+ /* @__PURE__ */ jsx3(StopGlyph, { className: "h-3.5 w-3.5" }),
1110
+ /* @__PURE__ */ jsx3("span", { children: "Stop" })
1086
1111
  ]
1087
1112
  }
1088
- ) : sendVariant === "icon" ? /* @__PURE__ */ jsx2(
1113
+ ) : sendVariant === "icon" ? /* @__PURE__ */ jsx3(
1089
1114
  "button",
1090
1115
  {
1091
1116
  type: "button",
@@ -1094,9 +1119,9 @@ function ChatComposer({
1094
1119
  "aria-label": sendLabel,
1095
1120
  title: sendLabel,
1096
1121
  className: `inline-flex size-[var(--control-height-sm,2rem)] shrink-0 items-center justify-center rounded-full ${sendTone === "primary" ? "bg-primary text-primary-foreground" : "bg-foreground text-background"} transition ${sendTone === "primary" ? "hover:bg-primary/90" : "hover:opacity-90"} disabled:cursor-not-allowed disabled:opacity-40 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-card`,
1097
- children: /* @__PURE__ */ jsx2(ArrowUpGlyph, { className: "h-4 w-4" })
1122
+ children: /* @__PURE__ */ jsx3(ArrowUpGlyph, { className: "h-4 w-4" })
1098
1123
  }
1099
- ) : /* @__PURE__ */ jsxs2(
1124
+ ) : /* @__PURE__ */ jsxs3(
1100
1125
  "button",
1101
1126
  {
1102
1127
  type: "button",
@@ -1105,8 +1130,8 @@ function ChatComposer({
1105
1130
  "aria-label": sendLabel,
1106
1131
  className: "inline-flex h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 rounded-full bg-primary px-3.5 text-sm font-medium text-primary-foreground shadow-sm transition hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-40 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-card",
1107
1132
  children: [
1108
- /* @__PURE__ */ jsx2(SendGlyph, { className: "h-3.5 w-3.5" }),
1109
- /* @__PURE__ */ jsx2("span", { children: sendLabel })
1133
+ /* @__PURE__ */ jsx3(SendGlyph, { className: "h-3.5 w-3.5" }),
1134
+ /* @__PURE__ */ jsx3("span", { children: sendLabel })
1110
1135
  ]
1111
1136
  }
1112
1137
  )
@@ -1115,7 +1140,7 @@ function ChatComposer({
1115
1140
  ]
1116
1141
  }
1117
1142
  ),
1118
- /* @__PURE__ */ jsx2(
1143
+ /* @__PURE__ */ jsx3(
1119
1144
  PopoverSurface,
1120
1145
  {
1121
1146
  open: slashOpen,
@@ -1124,9 +1149,9 @@ function ChatComposer({
1124
1149
  triggerRef: mention ? cardRef : textareaRef,
1125
1150
  panelRef: slashPanelRef,
1126
1151
  className: `w-80 overflow-y-auto rounded-xl border border-card-edge bg-popover p-1 ${OVERLAY_SHADOW}`,
1127
- children: /* @__PURE__ */ jsxs2("div", { className: "max-h-80 overflow-y-auto overscroll-contain", children: [
1128
- slashFiltered.length === 0 && /* @__PURE__ */ jsx2("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: skillQuery !== void 0 ? "No matching skills" : hasSkills ? "No matching commands or skills" : "No matching commands" }),
1129
- slashFiltered.map((item, index) => /* @__PURE__ */ jsxs2(
1152
+ children: /* @__PURE__ */ jsxs3("div", { className: "max-h-80 overflow-y-auto overscroll-contain", children: [
1153
+ slashFiltered.length === 0 && /* @__PURE__ */ jsx3("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: skillQuery !== void 0 ? "No matching skills" : hasSkills ? "No matching commands or skills" : "No matching commands" }),
1154
+ slashFiltered.map((item, index) => /* @__PURE__ */ jsxs3(
1130
1155
  "button",
1131
1156
  {
1132
1157
  type: "button",
@@ -1138,8 +1163,8 @@ function ChatComposer({
1138
1163
  onClick: () => pickSlash(item.id),
1139
1164
  className: `flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm transition ${POPOVER_OPTION_FOCUS} ${index === slashActiveIndex ? "bg-accent" : "hover:bg-accent"}`,
1140
1165
  children: [
1141
- /* @__PURE__ */ jsx2("span", { className: "shrink-0 font-medium text-foreground", children: item.label }),
1142
- /* @__PURE__ */ jsx2("span", { className: "truncate text-xs text-muted-foreground", children: item.description })
1166
+ /* @__PURE__ */ jsx3("span", { className: "shrink-0 font-medium text-foreground", children: item.label }),
1167
+ /* @__PURE__ */ jsx3("span", { className: "truncate text-xs text-muted-foreground", children: item.description })
1143
1168
  ]
1144
1169
  },
1145
1170
  item.id
@@ -1148,10 +1173,10 @@ function ChatComposer({
1148
1173
  }
1149
1174
  ),
1150
1175
  focusShortcut && // A touch screen has no keyboard to press the shortcut on.
1151
- /* @__PURE__ */ jsx2("div", { className: "mt-1.5 flex justify-end px-1 [@media(pointer:coarse)]:hidden", children: /* @__PURE__ */ jsxs2("span", { className: "text-xs text-muted-foreground", children: [
1152
- /* @__PURE__ */ jsx2("kbd", { className: "rounded border border-border bg-background px-1 py-0.5 text-xs", children: IS_APPLE_PLATFORM ? "Cmd" : "Ctrl" }),
1153
- /* @__PURE__ */ jsx2("kbd", { className: "ml-0.5 rounded border border-border bg-background px-1 py-0.5 text-xs", children: "L" }),
1154
- /* @__PURE__ */ jsx2("span", { className: "ml-1", children: "to focus" })
1176
+ /* @__PURE__ */ jsx3("div", { className: "mt-1.5 flex justify-end px-1 [@media(pointer:coarse)]:hidden", children: /* @__PURE__ */ jsxs3("span", { className: "text-xs text-muted-foreground", children: [
1177
+ /* @__PURE__ */ jsx3("kbd", { className: "rounded border border-border bg-background px-1 py-0.5 text-xs", children: IS_APPLE_PLATFORM ? "Cmd" : "Ctrl" }),
1178
+ /* @__PURE__ */ jsx3("kbd", { className: "ml-0.5 rounded border border-border bg-background px-1 py-0.5 text-xs", children: "L" }),
1179
+ /* @__PURE__ */ jsx3("span", { className: "ml-1", children: "to focus" })
1155
1180
  ] }) })
1156
1181
  ]
1157
1182
  }
@@ -1159,7 +1184,7 @@ function ChatComposer({
1159
1184
  }
1160
1185
 
1161
1186
  // src/web-react/use-composer-attachments.ts
1162
- import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
1187
+ import { useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo3, useRef as useRef6, useState as useState7 } from "react";
1163
1188
  function newId() {
1164
1189
  const cryptoObject = globalThis.crypto;
1165
1190
  if (typeof cryptoObject?.randomUUID === "function") return cryptoObject.randomUUID();
@@ -1206,12 +1231,12 @@ function rawUploadHeaders(init, size) {
1206
1231
  return headers;
1207
1232
  }
1208
1233
  function useComposerAttachments(options) {
1209
- const optionsRef = useRef3(options);
1234
+ const optionsRef = useRef6(options);
1210
1235
  optionsRef.current = options;
1211
- const [staged, setStagedState] = useState4([]);
1212
- const stagedRef = useRef3([]);
1213
- const controllersRef = useRef3(/* @__PURE__ */ new Map());
1214
- const setStaged = useCallback3(
1236
+ const [staged, setStagedState] = useState7([]);
1237
+ const stagedRef = useRef6([]);
1238
+ const controllersRef = useRef6(/* @__PURE__ */ new Map());
1239
+ const setStaged = useCallback6(
1215
1240
  (updater) => {
1216
1241
  const next = typeof updater === "function" ? updater(stagedRef.current) : updater;
1217
1242
  stagedRef.current = next;
@@ -1219,7 +1244,7 @@ function useComposerAttachments(options) {
1219
1244
  },
1220
1245
  []
1221
1246
  );
1222
- const upload = useCallback3(
1247
+ const upload = useCallback6(
1223
1248
  async (id, file, name) => {
1224
1249
  const opts = optionsRef.current;
1225
1250
  setStaged(
@@ -1289,7 +1314,7 @@ function useComposerAttachments(options) {
1289
1314
  },
1290
1315
  [setStaged]
1291
1316
  );
1292
- const addFiles = useCallback3(
1317
+ const addFiles = useCallback6(
1293
1318
  async (files) => {
1294
1319
  const opts = optionsRef.current;
1295
1320
  const enabled2 = opts.enabled ?? true;
@@ -1371,7 +1396,7 @@ function useComposerAttachments(options) {
1371
1396
  },
1372
1397
  [setStaged, upload]
1373
1398
  );
1374
- const retry = useCallback3(
1399
+ const retry = useCallback6(
1375
1400
  (id) => {
1376
1401
  const entry = stagedRef.current.find((s) => s.id === id);
1377
1402
  if (!entry) return;
@@ -1379,7 +1404,7 @@ function useComposerAttachments(options) {
1379
1404
  },
1380
1405
  [upload]
1381
1406
  );
1382
- const removeAttachment = useCallback3(
1407
+ const removeAttachment = useCallback6(
1383
1408
  (id) => {
1384
1409
  controllersRef.current.get(id)?.abort();
1385
1410
  controllersRef.current.delete(id);
@@ -1389,7 +1414,7 @@ function useComposerAttachments(options) {
1389
1414
  },
1390
1415
  [setStaged]
1391
1416
  );
1392
- const clear = useCallback3(() => {
1417
+ const clear = useCallback6(() => {
1393
1418
  for (const controller of controllersRef.current.values()) controller.abort();
1394
1419
  controllersRef.current.clear();
1395
1420
  for (const entry of stagedRef.current) {
@@ -1397,7 +1422,7 @@ function useComposerAttachments(options) {
1397
1422
  }
1398
1423
  setStaged([]);
1399
1424
  }, [setStaged]);
1400
- useEffect4(
1425
+ useEffect6(
1401
1426
  () => () => {
1402
1427
  for (const controller of controllersRef.current.values()) controller.abort();
1403
1428
  controllersRef.current.clear();
@@ -1407,7 +1432,7 @@ function useComposerAttachments(options) {
1407
1432
  },
1408
1433
  []
1409
1434
  );
1410
- const composerFiles = useMemo2(
1435
+ const composerFiles = useMemo3(
1411
1436
  () => staged.map((s) => ({
1412
1437
  id: s.id,
1413
1438
  name: s.name,
@@ -1419,15 +1444,15 @@ function useComposerAttachments(options) {
1419
1444
  })),
1420
1445
  [staged]
1421
1446
  );
1422
- const references = useMemo2(
1447
+ const references = useMemo3(
1423
1448
  () => staged.filter((s) => s.status === "ready" && !!s.reference).map((s) => s.reference),
1424
1449
  [staged]
1425
1450
  );
1426
- const hasPending = useMemo2(
1451
+ const hasPending = useMemo3(
1427
1452
  () => staged.some((s) => s.status === "pending" || s.status === "uploading"),
1428
1453
  [staged]
1429
1454
  );
1430
- const hasError = useMemo2(() => staged.some((s) => s.status === "error"), [staged]);
1455
+ const hasError = useMemo3(() => staged.some((s) => s.status === "error"), [staged]);
1431
1456
  const enabled = options.enabled ?? true;
1432
1457
  const blockReason = !enabled ? "Attachments are disabled" : hasPending ? "Attachments are still uploading" : hasError ? "Remove failed attachments to send" : null;
1433
1458
  return {
@@ -1444,13 +1469,13 @@ function useComposerAttachments(options) {
1444
1469
  }
1445
1470
 
1446
1471
  // src/web-react/composer-mode-controls.tsx
1447
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1472
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1448
1473
  function ListChecksGlyph({ className }) {
1449
- return /* @__PURE__ */ jsx3("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx3("path", { d: "m3 17 2 2 4-4M3 7l2 2 4-4M13 6h8M13 12h8M13 18h8" }) });
1474
+ return /* @__PURE__ */ jsx4("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx4("path", { d: "m3 17 2 2 4-4M3 7l2 2 4-4M13 6h8M13 12h8M13 18h8" }) });
1450
1475
  }
1451
1476
  function ComposerModeControls({ planMode }) {
1452
1477
  if (!planMode) return null;
1453
- return /* @__PURE__ */ jsxs3(
1478
+ return /* @__PURE__ */ jsxs4(
1454
1479
  "button",
1455
1480
  {
1456
1481
  type: "button",
@@ -1467,7 +1492,7 @@ function ComposerModeControls({ planMode }) {
1467
1492
  planMode.saving && "opacity-60"
1468
1493
  ),
1469
1494
  children: [
1470
- /* @__PURE__ */ jsx3(ListChecksGlyph, { className: "h-3.5 w-3.5" }),
1495
+ /* @__PURE__ */ jsx4(ListChecksGlyph, { className: "h-3.5 w-3.5" }),
1471
1496
  "Plan"
1472
1497
  ]
1473
1498
  }
@@ -1475,8 +1500,8 @@ function ComposerModeControls({ planMode }) {
1475
1500
  }
1476
1501
 
1477
1502
  // src/web-react/entry-composer.tsx
1478
- import { useState as useState5 } from "react";
1479
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1503
+ import { useState as useState8 } from "react";
1504
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1480
1505
  function EntryComposer({
1481
1506
  heading,
1482
1507
  subheading,
@@ -1500,7 +1525,7 @@ function EntryComposer({
1500
1525
  composerClassName,
1501
1526
  maxWidth = 820
1502
1527
  }) {
1503
- const [value, setValue] = useState5(initialValue);
1528
+ const [value, setValue] = useState8(initialValue);
1504
1529
  const attachments = useComposerAttachments({
1505
1530
  uploadUrl,
1506
1531
  enabled: !!uploadUrl,
@@ -1520,14 +1545,14 @@ function EntryComposer({
1520
1545
  attachments.clear();
1521
1546
  mentions?.clearMentions();
1522
1547
  }
1523
- return /* @__PURE__ */ jsx4(
1548
+ return /* @__PURE__ */ jsx5(
1524
1549
  "div",
1525
1550
  {
1526
1551
  className: className ?? "relative flex min-h-0 flex-1 flex-col items-center overflow-y-auto bg-background px-5 py-8",
1527
- children: /* @__PURE__ */ jsxs4("div", { className: "my-auto w-full shrink-0", style: { maxWidth }, children: [
1528
- heading ? /* @__PURE__ */ jsx4("h2", { className: "mb-4 text-center text-[1.75rem] font-medium tracking-tight text-foreground", children: heading }) : null,
1529
- subheading ? /* @__PURE__ */ jsx4("p", { className: "mx-auto mb-9 max-w-md text-center text-sm leading-relaxed text-muted-foreground", children: subheading }) : heading ? /* @__PURE__ */ jsx4("div", { className: "mb-7" }) : null,
1530
- /* @__PURE__ */ jsx4(
1552
+ children: /* @__PURE__ */ jsxs5("div", { className: "my-auto w-full shrink-0", style: { maxWidth }, children: [
1553
+ heading ? /* @__PURE__ */ jsx5("h2", { className: "mb-4 text-center text-[1.75rem] font-medium tracking-tight text-foreground", children: heading }) : null,
1554
+ subheading ? /* @__PURE__ */ jsx5("p", { className: "mx-auto mb-9 max-w-md text-center text-sm leading-relaxed text-muted-foreground", children: subheading }) : heading ? /* @__PURE__ */ jsx5("div", { className: "mb-7" }) : null,
1555
+ /* @__PURE__ */ jsx5(
1531
1556
  ChatComposer,
1532
1557
  {
1533
1558
  className: composerClassName ?? "vt-composer",
@@ -1555,11 +1580,11 @@ function EntryComposer({
1555
1580
  // brighter overlay tone the component defaults to.
1556
1581
  popoverClassName: mentionPopoverClassName ?? "bg-surface-container-low border-[var(--md3-outline-variant)]"
1557
1582
  } : void 0,
1558
- controls: modes ?? /* @__PURE__ */ jsx4(ComposerModeControls, { planMode }),
1559
- trailing: agent ? /* @__PURE__ */ jsx4(AgentSessionControls, { ...agent }) : void 0
1583
+ controls: modes ?? /* @__PURE__ */ jsx5(ComposerModeControls, { planMode }),
1584
+ trailing: agent ? /* @__PURE__ */ jsx5(AgentSessionControls, { ...agent }) : void 0
1560
1585
  }
1561
1586
  ),
1562
- footer ? /* @__PURE__ */ jsx4("div", { className: "mt-7", children: footer }) : null
1587
+ footer ? /* @__PURE__ */ jsx5("div", { className: "mt-7", children: footer }) : null
1563
1588
  ] })
1564
1589
  }
1565
1590
  );
@@ -1578,4 +1603,4 @@ export {
1578
1603
  ComposerModeControls,
1579
1604
  EntryComposer
1580
1605
  };
1581
- //# sourceMappingURL=chunk-BNFUJNPS.js.map
1606
+ //# sourceMappingURL=chunk-A77IBQ7S.js.map