@tutti-os/agent-gui 0.0.94 → 0.0.96

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 (163) hide show
  1. package/README.md +86 -38
  2. package/dist/AgentGUI-DWdvUV4x.d.ts +1038 -0
  3. package/dist/agent-conversation/index.d.ts +6 -7
  4. package/dist/agent-conversation/index.js +15 -10
  5. package/dist/agent-conversation/index.js.map +1 -1
  6. package/dist/agent-env/index.d.ts +10 -36
  7. package/dist/agent-env/index.js +2 -57
  8. package/dist/agent-env/index.js.map +1 -1
  9. package/dist/agent-gui.d.ts +21 -0
  10. package/dist/agent-gui.js +39 -0
  11. package/dist/agent-message-center/index.d.ts +156 -124
  12. package/dist/agent-message-center/index.js +1656 -1463
  13. package/dist/agent-message-center/index.js.map +1 -1
  14. package/dist/{agentConversationVM-Cl4G0Lln.d.ts → agentConversationVM-C335TR6S.d.ts} +112 -7
  15. package/dist/agentFileMentionContracts-58IjMU-u.d.ts +108 -0
  16. package/dist/{agentGuiNodeTypes-CAioPXK9.d.ts → agentGuiNodeTypes-B9X4aWfv.d.ts} +123 -163
  17. package/dist/agentPlanPromptDispatch-C7cCMjve.d.ts +37 -0
  18. package/dist/agents.d.ts +13 -0
  19. package/dist/agents.js +13 -0
  20. package/dist/app/renderer/agentactivity.css +276 -83
  21. package/dist/app/renderer/assets/icons/agent-vinyls/tutti-vinyl.png +0 -0
  22. package/dist/app/renderer/assets/icons/open-link-lined.svg +4 -0
  23. package/dist/{chunk-7BUYFVRI.js → chunk-2HJEOO7W.js} +2931 -2946
  24. package/dist/chunk-2HJEOO7W.js.map +1 -0
  25. package/dist/{chunk-E5FOXRUM.js → chunk-3XXBDYAI.js} +293 -258
  26. package/dist/chunk-3XXBDYAI.js.map +1 -0
  27. package/dist/{chunk-ZUW4B5AT.js → chunk-3Y3F7CS5.js} +21 -32
  28. package/dist/chunk-3Y3F7CS5.js.map +1 -0
  29. package/dist/{chunk-SCLLP5DO.js → chunk-4PQPJ5OY.js} +50 -155
  30. package/dist/chunk-4PQPJ5OY.js.map +1 -0
  31. package/dist/chunk-4YG7YK7S.js +23 -0
  32. package/dist/chunk-4YG7YK7S.js.map +1 -0
  33. package/dist/chunk-5X7YDOC6.js +42 -0
  34. package/dist/chunk-5X7YDOC6.js.map +1 -0
  35. package/dist/{chunk-R2EWECUP.js → chunk-7BXWPI4F.js} +17 -2
  36. package/dist/{chunk-R2EWECUP.js.map → chunk-7BXWPI4F.js.map} +1 -1
  37. package/dist/chunk-AGT7MUTV.js +491 -0
  38. package/dist/chunk-AGT7MUTV.js.map +1 -0
  39. package/dist/chunk-C35SNDVZ.js +96 -0
  40. package/dist/chunk-C35SNDVZ.js.map +1 -0
  41. package/dist/{chunk-5FE7M42A.js → chunk-E4HQUTM3.js} +2 -2
  42. package/dist/chunk-FGLQZ6I4.js +9 -0
  43. package/dist/chunk-FGLQZ6I4.js.map +1 -0
  44. package/dist/chunk-H5F3QSCF.js +25 -0
  45. package/dist/chunk-H5F3QSCF.js.map +1 -0
  46. package/dist/chunk-H6IQ63DQ.js +14 -0
  47. package/dist/chunk-H6IQ63DQ.js.map +1 -0
  48. package/dist/{chunk-45FF4DQU.js → chunk-IYEXLOUE.js} +22 -27
  49. package/dist/chunk-IYEXLOUE.js.map +1 -0
  50. package/dist/{chunk-P72YLKC6.js → chunk-JKIZA7EJ.js} +3573 -3755
  51. package/dist/chunk-JKIZA7EJ.js.map +1 -0
  52. package/dist/chunk-KJQERFKX.js +259 -0
  53. package/dist/chunk-KJQERFKX.js.map +1 -0
  54. package/dist/{chunk-XW4CVBUH.js → chunk-L3GMMGRS.js} +25 -16
  55. package/dist/chunk-L3GMMGRS.js.map +1 -0
  56. package/dist/chunk-MASXZENX.js +231 -0
  57. package/dist/chunk-MASXZENX.js.map +1 -0
  58. package/dist/{chunk-BXVPOGYK.js → chunk-O3Q5SIJH.js} +505 -504
  59. package/dist/chunk-O3Q5SIJH.js.map +1 -0
  60. package/dist/{chunk-554VG7ZW.js → chunk-QVBF5BN5.js} +2 -2
  61. package/dist/{chunk-AWAIUYG4.js → chunk-RE4AXS27.js} +532 -565
  62. package/dist/chunk-RE4AXS27.js.map +1 -0
  63. package/dist/{chunk-7LMJXF4R.js → chunk-TVIGLNNI.js} +20 -16
  64. package/dist/chunk-TVIGLNNI.js.map +1 -0
  65. package/dist/{chunk-XDV4ZRVK.js → chunk-UGVI47X6.js} +98 -37
  66. package/dist/chunk-UGVI47X6.js.map +1 -0
  67. package/dist/{chunk-GAPTLVII.js → chunk-UHBCM6RO.js} +1 -1
  68. package/dist/chunk-UHBCM6RO.js.map +1 -0
  69. package/dist/{chunk-UBDPV34P.js → chunk-W6WAGPMD.js} +1385 -1305
  70. package/dist/chunk-W6WAGPMD.js.map +1 -0
  71. package/dist/chunk-WKSFPJHZ.js +33054 -0
  72. package/dist/chunk-WKSFPJHZ.js.map +1 -0
  73. package/dist/{chunk-IGY4ASUF.js → chunk-WMNS4MAQ.js} +1288 -1696
  74. package/dist/chunk-WMNS4MAQ.js.map +1 -0
  75. package/dist/{chunk-MATIJPGF.js → chunk-XPFHJMZP.js} +541 -401
  76. package/dist/chunk-XPFHJMZP.js.map +1 -0
  77. package/dist/chunk-YMXYBG7U.js +12 -0
  78. package/dist/chunk-YMXYBG7U.js.map +1 -0
  79. package/dist/context-mention-palette/index.d.ts +3 -2
  80. package/dist/context-mention-palette/index.js +17 -12
  81. package/dist/custom-mention.d.ts +42 -0
  82. package/dist/custom-mention.js +17 -0
  83. package/dist/custom-mention.js.map +1 -0
  84. package/dist/dock-icons.d.ts +4 -0
  85. package/dist/dock-icons.js +11 -0
  86. package/dist/dock-icons.js.map +1 -0
  87. package/dist/i18n/index.d.ts +880 -841
  88. package/dist/i18n/index.js +2 -2
  89. package/dist/index.d.ts +56 -1063
  90. package/dist/index.js +78 -35532
  91. package/dist/index.js.map +1 -1
  92. package/dist/mention-search.d.ts +226 -0
  93. package/dist/mention-search.js +29 -0
  94. package/dist/mention-search.js.map +1 -0
  95. package/dist/open-link-lined-JWEKUKME.svg +4 -0
  96. package/dist/pastedTextKinds-D-XuInaS.d.ts +4 -0
  97. package/dist/provider-icons.d.ts +6 -0
  98. package/dist/provider-icons.js +12 -0
  99. package/dist/provider-icons.js.map +1 -0
  100. package/dist/provider-identity.d.ts +9 -0
  101. package/dist/provider-identity.js +21 -0
  102. package/dist/provider-identity.js.map +1 -0
  103. package/dist/runtime-BBNdWgDU.d.ts +10 -0
  104. package/dist/startup-shell.d.ts +8 -0
  105. package/dist/startup-shell.js +184 -0
  106. package/dist/startup-shell.js.map +1 -0
  107. package/dist/{types-PLFZ8SBX.d.ts → types-CnT8rNUI.d.ts} +43 -87
  108. package/dist/workbench/contribution.d.ts +34 -41
  109. package/dist/workbench/contribution.js +10 -6
  110. package/dist/workbench/index.d.ts +5 -4
  111. package/dist/workbench/index.js +27 -25
  112. package/dist/workbench/launch.d.ts +4 -7
  113. package/dist/workbench/launch.js +4 -3
  114. package/dist/workbench/providerCatalog.d.ts +2 -2
  115. package/dist/workbench/providerCatalog.js +2 -1
  116. package/dist/workbench/sessionTitle.d.ts +11 -14
  117. package/dist/workbench/sessionTitle.js +6 -7
  118. package/dist/workbench/state.d.ts +1 -1
  119. package/dist/workbench/state.js +3 -2
  120. package/dist/workbench/types.d.ts +2 -4
  121. package/dist/workbench/types.js +1 -1
  122. package/dist/workspace-agent-generated-files.d.ts +20 -2
  123. package/dist/workspace-agent-generated-files.js +6 -5
  124. package/dist/workspaceAgentActivityListTypes-C7gPWYiA.d.ts +71 -0
  125. package/package.json +70 -26
  126. package/dist/AgentMentionSearchController-DD_WOred.d.ts +0 -241
  127. package/dist/AgentMessageMarkdown-DeYPURtF.d.ts +0 -7
  128. package/dist/chunk-45FF4DQU.js.map +0 -1
  129. package/dist/chunk-4HP6V2YA.js +0 -207
  130. package/dist/chunk-4HP6V2YA.js.map +0 -1
  131. package/dist/chunk-7BUYFVRI.js.map +0 -1
  132. package/dist/chunk-7LMJXF4R.js.map +0 -1
  133. package/dist/chunk-AWAIUYG4.js.map +0 -1
  134. package/dist/chunk-BXVPOGYK.js.map +0 -1
  135. package/dist/chunk-E5FOXRUM.js.map +0 -1
  136. package/dist/chunk-GAPTLVII.js.map +0 -1
  137. package/dist/chunk-IBIMGLCD.js +0 -66
  138. package/dist/chunk-IBIMGLCD.js.map +0 -1
  139. package/dist/chunk-IGY4ASUF.js.map +0 -1
  140. package/dist/chunk-LR4FA5X6.js +0 -368
  141. package/dist/chunk-LR4FA5X6.js.map +0 -1
  142. package/dist/chunk-MATIJPGF.js.map +0 -1
  143. package/dist/chunk-MKHDRIGN.js +0 -71
  144. package/dist/chunk-MKHDRIGN.js.map +0 -1
  145. package/dist/chunk-P72YLKC6.js.map +0 -1
  146. package/dist/chunk-SCLLP5DO.js.map +0 -1
  147. package/dist/chunk-UBDPV34P.js.map +0 -1
  148. package/dist/chunk-VAKFNNKT.js +0 -410
  149. package/dist/chunk-VAKFNNKT.js.map +0 -1
  150. package/dist/chunk-XDV4ZRVK.js.map +0 -1
  151. package/dist/chunk-XW4CVBUH.js.map +0 -1
  152. package/dist/chunk-ZUW4B5AT.js.map +0 -1
  153. package/dist/plan-decision-ops.d.ts +0 -70
  154. package/dist/plan-decision-ops.js +0 -19
  155. package/dist/queued-prompt-runtime.d.ts +0 -115
  156. package/dist/queued-prompt-runtime.js +0 -9
  157. package/dist/uiSettings-BQS9r2eo.d.ts +0 -6
  158. package/dist/workspaceAgentActivityListViewModel-BzV-cf0D.d.ts +0 -340
  159. package/dist/workspaceLinkActions-DS9LWqzI.d.ts +0 -74
  160. /package/dist/{plan-decision-ops.js.map → agent-gui.js.map} +0 -0
  161. /package/dist/{queued-prompt-runtime.js.map → agents.js.map} +0 -0
  162. /package/dist/{chunk-5FE7M42A.js.map → chunk-E4HQUTM3.js.map} +0 -0
  163. /package/dist/{chunk-554VG7ZW.js.map → chunk-QVBF5BN5.js.map} +0 -0
@@ -3,13 +3,15 @@ import {
3
3
  resolveAgentMentionFileVisualKind
4
4
  } from "./chunk-LUGELG5V.js";
5
5
  import {
6
- getAgentCustomMentionKind,
7
6
  managedAgentRoundedIconUrl
8
- } from "./chunk-LR4FA5X6.js";
7
+ } from "./chunk-MASXZENX.js";
9
8
  import {
10
9
  translate,
11
10
  useTranslation
12
- } from "./chunk-5FE7M42A.js";
11
+ } from "./chunk-E4HQUTM3.js";
12
+ import {
13
+ getAgentCustomMentionKind
14
+ } from "./chunk-5X7YDOC6.js";
13
15
 
14
16
  // agent-gui/agentGuiNode/agentRichText/agentFileMentionExtension.ts
15
17
  import { mergeAttributes, Node } from "@tiptap/core";
@@ -17,14 +19,6 @@ import { PluginKey } from "@tiptap/pm/state";
17
19
  import { ReactNodeViewRenderer } from "@tiptap/react";
18
20
  import Suggestion, { exitSuggestion } from "@tiptap/suggestion";
19
21
  import { isRichTextTriggerPrefixBoundary } from "@tutti-os/ui-rich-text/editor";
20
- import {
21
- createRichTextLinkMarkdown,
22
- createRichTextMarkdownLink,
23
- createRichTextMentionHref,
24
- createRichTextMentionMarkdown,
25
- isRichTextMentionHref,
26
- parseRichTextMentionHref
27
- } from "@tutti-os/ui-rich-text/core";
28
22
 
29
23
  // agent-gui/agentGuiNode/agentRichText/AgentMentionNodeView.tsx
30
24
  import {
@@ -50,12 +44,6 @@ function parseFileCountAttr(value) {
50
44
  return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
51
45
  }
52
46
  var AgentMentionTooltipProviderContext = createContext(true);
53
- function AgentMentionTooltipProviderScope({
54
- children,
55
- withTooltipProvider
56
- }) {
57
- return /* @__PURE__ */ jsx(AgentMentionTooltipProviderContext, { value: withTooltipProvider, children });
58
- }
59
47
  function attrString(attrs, key) {
60
48
  const value = attrs[key];
61
49
  return typeof value === "string" ? value : "";
@@ -569,494 +557,190 @@ function AgentMentionNodeView(props) {
569
557
  );
570
558
  }
571
559
 
572
- // agent-gui/agentGuiNode/agentRichText/agentFileMentionExtension.ts
573
- var agentFileMentionPluginKey = new PluginKey(
574
- "agentFileMentionSuggestion"
575
- );
576
- function exitAgentFileMentionSuggestion(editor) {
577
- exitSuggestion(editor.view, agentFileMentionPluginKey);
560
+ // agent-gui/agentGuiNode/agentRichText/agentMentionMarkdown.ts
561
+ import {
562
+ createRichTextLinkMarkdown,
563
+ createRichTextMarkdownLink,
564
+ createRichTextMentionHref,
565
+ createRichTextMentionMarkdown,
566
+ isRichTextMentionHref,
567
+ parseRichTextMentionHref
568
+ } from "@tutti-os/ui-rich-text/core";
569
+ function dirnameFromPath2(path) {
570
+ const parts = path.split("/").filter(Boolean);
571
+ if (parts.length <= 1) {
572
+ return path.startsWith("/") ? "/" : "";
573
+ }
574
+ return `/${parts.slice(0, -1).join("/")}`;
578
575
  }
579
- var MENTION_PLACEHOLDER_LEAF_SENTINEL = "\uFFFC";
580
- var MENTION_PLACEHOLDER_MAX_LENGTH = 40;
581
- function expandRangeOverMentionPlaceholder(editor, range) {
582
- const { doc } = editor.state;
583
- const $from = doc.resolve(range.from);
584
- const blockStart = $from.start();
585
- const blockEnd = $from.end();
586
- const blockText = doc.textBetween(
587
- blockStart,
588
- blockEnd,
589
- "\n",
590
- MENTION_PLACEHOLDER_LEAF_SENTINEL
591
- );
592
- const fromOffset = range.from - blockStart;
593
- const toOffset = Math.min(range.to, blockEnd) - blockStart;
594
- let open = -1;
595
- for (let index = fromOffset - 1; index >= 0; index -= 1) {
596
- const char = blockText[index];
597
- if (char === "}") {
598
- return range;
576
+ function normalizeAgentSessionMentionTitle(value) {
577
+ const trimmed = value.trim();
578
+ const withoutMentionPrefix = trimmed.replace(/^@+/, "").trim();
579
+ return withoutMentionPrefix || trimmed;
580
+ }
581
+ function createAgentSessionMentionHref(input) {
582
+ const label = normalizeAgentSessionMarkdownLabel(input.label);
583
+ const agentTargetId = input.agentTargetId?.trim() ?? "";
584
+ return createRichTextMentionHref({
585
+ providerId: "agent-session",
586
+ entityId: input.agentSessionId,
587
+ label,
588
+ scope: {
589
+ ...agentTargetId ? { agentTargetId } : {},
590
+ workspaceId: input.workspaceId
599
591
  }
600
- if (char === "{") {
601
- open = index;
592
+ });
593
+ }
594
+ function createAgentSessionMarkdownLink(input) {
595
+ const label = normalizeAgentSessionMarkdownLabel(input.label);
596
+ const href = createAgentSessionMentionHref({
597
+ agentSessionId: input.agentSessionId,
598
+ agentTargetId: input.agentTargetId,
599
+ label,
600
+ workspaceId: input.workspaceId
601
+ });
602
+ return createRichTextMarkdownLink({
603
+ href,
604
+ label: input.withAtPrefix ? `@${label}` : label
605
+ });
606
+ }
607
+ function formatAgentMentionMarkdown(item) {
608
+ if (item.kind === "file") {
609
+ const label = item.name.trim().startsWith("@") ? item.name : `@${item.name}`;
610
+ return createRichTextLinkMarkdown({
611
+ kind: "file",
612
+ name: label,
613
+ path: item.href
614
+ });
615
+ }
616
+ if (item.kind === "workspace-reference") {
617
+ return createRichTextMentionMarkdown({
618
+ providerId: "workspace-reference",
619
+ entityId: item.targetId,
620
+ label: item.name,
621
+ scope: {
622
+ workspaceId: item.workspaceId,
623
+ source: item.source,
624
+ ...item.groupId?.trim() ? { groupId: item.groupId.trim() } : {},
625
+ ...item.fileCount > 0 ? { count: String(item.fileCount) } : {}
626
+ }
627
+ });
628
+ }
629
+ if (item.kind === "session") {
630
+ return createAgentSessionMarkdownLink({
631
+ agentSessionId: item.targetId,
632
+ agentTargetId: item.agentTargetId ?? agentSessionTargetIdFromHref(item.href),
633
+ label: item.name,
634
+ workspaceId: item.workspaceId,
635
+ withAtPrefix: true
636
+ });
637
+ }
638
+ if (item.kind === "agent-target") {
639
+ return createRichTextMentionMarkdown({
640
+ providerId: "agent-target",
641
+ entityId: item.targetId,
642
+ label: item.name,
643
+ scope: { workspaceId: item.workspaceId }
644
+ });
645
+ }
646
+ const identity = parseRichTextMentionHref(item.href, item.name);
647
+ return identity ? createRichTextMentionMarkdown(identity) : "";
648
+ }
649
+ function normalizeAgentSessionMarkdownLabel(value) {
650
+ return value.trim().replace(/^@+/, "").trim();
651
+ }
652
+ function agentSessionTargetIdFromHref(href) {
653
+ const mention = parseRichTextMentionHref(href, "");
654
+ const agentTargetId = mention?.scope?.agentTargetId?.trim() ?? "";
655
+ return agentTargetId || void 0;
656
+ }
657
+ function parseMentionFileCount(value) {
658
+ const parsed = typeof value === "number" ? value : typeof value === "string" ? Number.parseInt(value.trim(), 10) : Number.NaN;
659
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
660
+ }
661
+ function parseAgentMentionMarkdown(value, start = 0) {
662
+ if (!value.startsWith("[", start)) {
663
+ return null;
664
+ }
665
+ let index = start + 1;
666
+ const prefixedMention = value[index] === "@";
667
+ if (prefixedMention) {
668
+ index += 1;
669
+ }
670
+ let name = "";
671
+ while (index < value.length) {
672
+ const current = value[index];
673
+ if (current === "\\") {
674
+ const escaped = value[index + 1];
675
+ if (escaped === "\\" || escaped === "[" || escaped === "]") {
676
+ name += escaped;
677
+ index += 2;
678
+ continue;
679
+ }
680
+ name += current;
681
+ index += 1;
682
+ continue;
683
+ }
684
+ if (current === "]") {
602
685
  break;
603
686
  }
687
+ name += current;
688
+ index += 1;
604
689
  }
605
- if (open < 0) {
606
- return range;
690
+ if (value[index] !== "]" || value[index + 1] !== "(") {
691
+ return null;
607
692
  }
608
- let close = -1;
609
- for (let index = toOffset; index < blockText.length; index += 1) {
610
- const char = blockText[index];
611
- if (char === "{") {
612
- return range;
693
+ index += 2;
694
+ let href = "";
695
+ while (index < value.length) {
696
+ const current = value[index];
697
+ if (current === "\\") {
698
+ const escaped = value[index + 1];
699
+ if (escaped === "\\" || escaped === ")") {
700
+ href += escaped;
701
+ index += 2;
702
+ continue;
703
+ }
704
+ href += current;
705
+ index += 1;
706
+ continue;
613
707
  }
614
- if (char === "}") {
615
- close = index;
616
- break;
708
+ if (current === ")") {
709
+ const item = parseMentionItemFromHref({ name, href });
710
+ if (!item) {
711
+ return null;
712
+ }
713
+ if (item.kind !== "file" && !prefixedMention && !isRichTextMentionHref(href)) {
714
+ return null;
715
+ }
716
+ return {
717
+ item,
718
+ end: index + 1
719
+ };
617
720
  }
721
+ href += current;
722
+ index += 1;
618
723
  }
619
- if (close < 0) {
620
- return range;
724
+ return null;
725
+ }
726
+ function parseMentionItemFromHref(input) {
727
+ const href = input.href.trim();
728
+ if (!href) {
729
+ return null;
621
730
  }
622
- const group = blockText.slice(open, close + 1);
623
- if (close - open > MENTION_PLACEHOLDER_MAX_LENGTH || group.includes("\n") || group.includes(MENTION_PLACEHOLDER_LEAF_SENTINEL)) {
624
- return range;
731
+ const mention = parseRichTextMentionHref(href, input.name);
732
+ if (!mention && !isRichTextMentionHref(href)) {
733
+ return {
734
+ kind: "file",
735
+ href,
736
+ path: href,
737
+ name: input.name,
738
+ entryKind: isLocalDirectoryMentionHref(href) ? "directory" : "unknown",
739
+ directoryPath: dirnameFromPath2(href)
740
+ };
625
741
  }
626
- let end = close + 1;
627
- if (blockText[end] === " " || blockText[end] === " ") {
628
- end += 1;
629
- }
630
- return { from: blockStart + open, to: blockStart + end };
631
- }
632
- function createAgentFileMentionExtension(options = {}) {
633
- return Node.create({
634
- name: "agentFileMention",
635
- group: "inline",
636
- inline: true,
637
- atom: true,
638
- selectable: false,
639
- addOptions() {
640
- return options;
641
- },
642
- addAttributes() {
643
- return {
644
- name: { default: "" },
645
- kind: { default: "file" },
646
- href: { default: "" },
647
- path: { default: "" },
648
- entryKind: { default: "unknown" },
649
- directoryPath: { default: "" },
650
- workspaceId: { default: "" },
651
- targetId: { default: "" },
652
- agentTargetId: { default: "" },
653
- scope: { default: "" },
654
- title: { default: "" },
655
- initiatorName: { default: "" },
656
- agentName: { default: "" },
657
- status: { default: "" },
658
- inputPreview: { default: "" },
659
- summaryPreview: { default: "" },
660
- creatorName: { default: "" },
661
- topicId: { default: "" },
662
- appId: { default: "" },
663
- agentProviderId: { default: "" },
664
- jobId: { default: "" },
665
- action: { default: "" },
666
- contextPath: { default: "" },
667
- description: { default: "" },
668
- iconUrl: { default: "" },
669
- contentPreview: { default: "" },
670
- thumbnailUrl: { default: "" },
671
- source: { default: "" },
672
- groupId: { default: "" },
673
- fileCount: { default: "" },
674
- customKind: { default: "" },
675
- preview: { default: "" }
676
- };
677
- },
678
- parseHTML() {
679
- return [
680
- {
681
- tag: "span[data-agent-file-mention]",
682
- getAttrs: parseAgentMentionHTMLElementAttrs
683
- },
684
- {
685
- tag: "a[data-agent-file-mention]",
686
- getAttrs: parseAgentMentionHTMLElementAttrs
687
- }
688
- ];
689
- },
690
- renderHTML({ HTMLAttributes }) {
691
- const item = attrsToMentionItem(HTMLAttributes);
692
- const fileThumbnailUrl = item.kind === "file" ? resolveAgentMentionFileThumbnailUrl(item) : void 0;
693
- const href = item.href;
694
- const tagName = options.renderAsLink ? "a" : "span";
695
- const visual = mentionVisual(item);
696
- const sessionVisual = item.kind === "session" ? sessionMentionVisual(item) : null;
697
- const sharedAttributes = {
698
- "data-agent-file-mention": "true",
699
- "data-agent-mention-href": href,
700
- "data-agent-mention-kind": item.kind,
701
- "aria-label": item.kind === "file" ? visual.primary : `${visual.kindLabel} ${visual.primary}`.trim()
702
- };
703
- return [
704
- tagName,
705
- mergeAttributes(HTMLAttributes, {
706
- ...sharedAttributes,
707
- ...item.kind === "file" ? {
708
- "data-agent-file-entry-kind": item.entryKind,
709
- "data-agent-file-directory-path": item.directoryPath,
710
- "data-agent-file-visual-kind": resolveAgentMentionFileVisualKind(item)
711
- } : {},
712
- ...options.renderAsLink ? { href } : {},
713
- ...(item.kind === "workspace-app" || item.kind === "agent-target" || item.kind === "workspace-reference") && item.iconUrl ? { "data-agent-mention-icon-url": item.iconUrl } : {},
714
- ...item.kind === "workspace-reference" ? { "data-agent-mention-file-count": String(item.fileCount) } : {},
715
- ...fileThumbnailUrl ? { "data-agent-mention-thumbnail-url": fileThumbnailUrl } : {},
716
- class: item.kind === "file" ? "tsh-agent-object-token tsh-agent-object-token--file" : "tsh-agent-object-token tsh-agent-object-token--entity"
717
- }),
718
- ...item.kind === "file" ? [
719
- fileThumbnailUrl ? [
720
- "span",
721
- {
722
- class: "agent-gui-node__mention-file-thumb",
723
- "data-agent-mention-file-thumb": "true",
724
- "aria-hidden": "true"
725
- },
726
- [
727
- "img",
728
- {
729
- src: fileThumbnailUrl,
730
- alt: "",
731
- decoding: "async",
732
- loading: "lazy",
733
- draggable: "false"
734
- }
735
- ]
736
- ] : [
737
- "span",
738
- {
739
- class: "tsh-agent-object-token__icon",
740
- "aria-hidden": "true"
741
- },
742
- ""
743
- ],
744
- [
745
- "span",
746
- { class: "tsh-agent-object-token__main" },
747
- visual.primary
748
- ]
749
- ] : item.kind === "session" ? [
750
- [
751
- "span",
752
- {
753
- class: "tsh-agent-object-token__kind",
754
- "aria-hidden": "true"
755
- },
756
- [
757
- "span",
758
- {
759
- class: "tsh-agent-object-token__kind-icon",
760
- "aria-hidden": "true"
761
- },
762
- ""
763
- ]
764
- ],
765
- [
766
- "span",
767
- { class: "tsh-agent-object-token__main" },
768
- [
769
- "span",
770
- { class: "tsh-agent-object-token__participant" },
771
- sessionVisual?.participant ?? ""
772
- ],
773
- [
774
- "span",
775
- { class: "tsh-agent-object-token__summary" },
776
- sessionVisual?.summary ? ` ${sessionVisual.summary}` : ""
777
- ]
778
- ]
779
- ] : [
780
- [
781
- "span",
782
- {
783
- class: "tsh-agent-object-token__kind",
784
- "aria-hidden": "true"
785
- },
786
- [
787
- "span",
788
- {
789
- class: "tsh-agent-object-token__kind-icon",
790
- "aria-hidden": "true"
791
- },
792
- ""
793
- ]
794
- ],
795
- [
796
- "span",
797
- { class: "tsh-agent-object-token__main" },
798
- visual.primary
799
- ]
800
- ]
801
- ];
802
- },
803
- renderText({ node }) {
804
- return formatAgentMentionMarkdown(attrsToMentionItem(node.attrs ?? {}));
805
- },
806
- addNodeView() {
807
- return ReactNodeViewRenderer(AgentMentionNodeView);
808
- },
809
- addProseMirrorPlugins() {
810
- if (options.enableSuggestions === false) {
811
- return [];
812
- }
813
- return [
814
- Suggestion({
815
- editor: this.editor,
816
- pluginKey: agentFileMentionPluginKey,
817
- char: "@",
818
- allowedPrefixes: [" ", "\n", " "],
819
- allowSpaces: true,
820
- items: () => [],
821
- allow: ({ state, range }) => {
822
- if (options.shouldSuppressSuggestion?.()) {
823
- return false;
824
- }
825
- if (range.from <= 1) {
826
- return true;
827
- }
828
- const previous = state.doc.textBetween(
829
- range.from - 1,
830
- range.from,
831
- "\n",
832
- "\n"
833
- );
834
- return isRichTextTriggerPrefixBoundary(previous, "whitespace");
835
- },
836
- command: ({ editor, range, props }) => {
837
- const insertRange = expandRangeOverMentionPlaceholder(
838
- editor,
839
- range
840
- );
841
- const prefixCaretAnchor = insertRange.from <= 1 || editor.state.doc.textBetween(
842
- Math.max(1, insertRange.from - 1),
843
- insertRange.from,
844
- "\n",
845
- "\n"
846
- ) === "\n";
847
- editor.chain().focus().insertContentAt(insertRange, [
848
- ...prefixCaretAnchor ? [
849
- {
850
- type: "text",
851
- text: AGENT_RICH_TEXT_CARET_ANCHOR
852
- }
853
- ] : [],
854
- {
855
- type: this.name,
856
- attrs: mentionItemToAttrs(props)
857
- },
858
- { type: "text", text: " " }
859
- ]).run();
860
- },
861
- render: () => ({
862
- onStart: (props) => {
863
- options.onSuggestionChange?.({
864
- editor: props.editor,
865
- range: props.range,
866
- query: props.query,
867
- text: props.text,
868
- command: props.command,
869
- clientRect: props.clientRect
870
- });
871
- },
872
- onUpdate: (props) => {
873
- options.onSuggestionChange?.({
874
- editor: props.editor,
875
- range: props.range,
876
- query: props.query,
877
- text: props.text,
878
- command: props.command,
879
- clientRect: props.clientRect
880
- });
881
- },
882
- onExit: () => {
883
- options.onSuggestionChange?.(null);
884
- },
885
- onKeyDown: (props) => options.onSuggestionKeyDown?.(props.event) ?? false
886
- })
887
- })
888
- ];
889
- }
890
- });
891
- }
892
- function normalizeAgentSessionMentionTitle(value) {
893
- const trimmed = value.trim();
894
- const withoutMentionPrefix = trimmed.replace(/^@+/, "").trim();
895
- return withoutMentionPrefix || trimmed;
896
- }
897
- function createAgentSessionMentionHref(input) {
898
- const label = normalizeAgentSessionMarkdownLabel(input.label);
899
- const agentTargetId = input.agentTargetId?.trim() ?? "";
900
- return createRichTextMentionHref({
901
- providerId: "agent-session",
902
- entityId: input.agentSessionId,
903
- label,
904
- scope: {
905
- ...agentTargetId ? { agentTargetId } : {},
906
- workspaceId: input.workspaceId
907
- }
908
- });
909
- }
910
- function createAgentSessionMarkdownLink(input) {
911
- const label = normalizeAgentSessionMarkdownLabel(input.label);
912
- const href = createAgentSessionMentionHref({
913
- agentSessionId: input.agentSessionId,
914
- agentTargetId: input.agentTargetId,
915
- label,
916
- workspaceId: input.workspaceId
917
- });
918
- return createRichTextMarkdownLink({
919
- href,
920
- label: input.withAtPrefix ? `@${label}` : label
921
- });
922
- }
923
- function formatAgentMentionMarkdown(item) {
924
- if (item.kind === "file") {
925
- const label = item.name.trim().startsWith("@") ? item.name : `@${item.name}`;
926
- return createRichTextLinkMarkdown({
927
- kind: "file",
928
- name: label,
929
- path: item.href
930
- });
931
- }
932
- if (item.kind === "workspace-reference") {
933
- return createRichTextMentionMarkdown({
934
- providerId: "workspace-reference",
935
- entityId: item.targetId,
936
- label: item.name,
937
- scope: {
938
- workspaceId: item.workspaceId,
939
- source: item.source,
940
- ...item.groupId?.trim() ? { groupId: item.groupId.trim() } : {},
941
- ...item.fileCount > 0 ? { count: String(item.fileCount) } : {}
942
- }
943
- });
944
- }
945
- if (item.kind === "session") {
946
- return createAgentSessionMarkdownLink({
947
- agentSessionId: item.targetId,
948
- agentTargetId: item.agentTargetId ?? agentSessionTargetIdFromHref(item.href),
949
- label: item.name,
950
- workspaceId: item.workspaceId,
951
- withAtPrefix: true
952
- });
953
- }
954
- if (item.kind === "agent-target") {
955
- return createRichTextMentionMarkdown({
956
- providerId: "agent-target",
957
- entityId: item.targetId,
958
- label: item.name,
959
- scope: { workspaceId: item.workspaceId }
960
- });
961
- }
962
- const identity = parseRichTextMentionHref(item.href, item.name);
963
- return identity ? createRichTextMentionMarkdown(identity) : "";
964
- }
965
- function normalizeAgentSessionMarkdownLabel(value) {
966
- return value.trim().replace(/^@+/, "").trim();
967
- }
968
- function agentSessionTargetIdFromHref(href) {
969
- const mention = parseRichTextMentionHref(href, "");
970
- const agentTargetId = mention?.scope?.agentTargetId?.trim() ?? "";
971
- return agentTargetId || void 0;
972
- }
973
- function parseMentionFileCount(value) {
974
- const parsed = typeof value === "number" ? value : typeof value === "string" ? Number.parseInt(value.trim(), 10) : Number.NaN;
975
- return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
976
- }
977
- function parseAgentMentionMarkdown(value, start = 0) {
978
- if (!value.startsWith("[", start)) {
979
- return null;
980
- }
981
- let index = start + 1;
982
- const prefixedMention = value[index] === "@";
983
- if (prefixedMention) {
984
- index += 1;
985
- }
986
- let name = "";
987
- while (index < value.length) {
988
- const current = value[index];
989
- if (current === "\\") {
990
- const escaped = value[index + 1];
991
- if (escaped === "\\" || escaped === "[" || escaped === "]") {
992
- name += escaped;
993
- index += 2;
994
- continue;
995
- }
996
- name += current;
997
- index += 1;
998
- continue;
999
- }
1000
- if (current === "]") {
1001
- break;
1002
- }
1003
- name += current;
1004
- index += 1;
1005
- }
1006
- if (value[index] !== "]" || value[index + 1] !== "(") {
1007
- return null;
1008
- }
1009
- index += 2;
1010
- let href = "";
1011
- while (index < value.length) {
1012
- const current = value[index];
1013
- if (current === "\\") {
1014
- const escaped = value[index + 1];
1015
- if (escaped === "\\" || escaped === ")") {
1016
- href += escaped;
1017
- index += 2;
1018
- continue;
1019
- }
1020
- href += current;
1021
- index += 1;
1022
- continue;
1023
- }
1024
- if (current === ")") {
1025
- const item = parseMentionItemFromHref({ name, href });
1026
- if (!item) {
1027
- return null;
1028
- }
1029
- if (item.kind !== "file" && !prefixedMention && !isRichTextMentionHref(href)) {
1030
- return null;
1031
- }
1032
- return {
1033
- item,
1034
- end: index + 1
1035
- };
1036
- }
1037
- href += current;
1038
- index += 1;
1039
- }
1040
- return null;
1041
- }
1042
- function parseMentionItemFromHref(input) {
1043
- const href = input.href.trim();
1044
- if (!href) {
1045
- return null;
1046
- }
1047
- const mention = parseRichTextMentionHref(href, input.name);
1048
- if (!mention && !isRichTextMentionHref(href)) {
1049
- return {
1050
- kind: "file",
1051
- href,
1052
- path: href,
1053
- name: input.name,
1054
- entryKind: isLocalDirectoryMentionHref(href) ? "directory" : "unknown",
1055
- directoryPath: dirnameFromPath2(href)
1056
- };
1057
- }
1058
- if (!mention) {
1059
- return null;
742
+ if (!mention) {
743
+ return null;
1060
744
  }
1061
745
  const resource = mention.providerId.trim().toLowerCase();
1062
746
  const targetId = mention.entityId.trim();
@@ -1172,6 +856,8 @@ function parseMentionItemFromHref(input) {
1172
856
  function isLocalDirectoryMentionHref(href) {
1173
857
  return href.endsWith("/") && !/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(href);
1174
858
  }
859
+
860
+ // agent-gui/agentGuiNode/agentRichText/agentMentionAttrs.ts
1175
861
  function mentionItemToAttrs(item) {
1176
862
  if (item.kind === "file") {
1177
863
  return {
@@ -1464,6 +1150,8 @@ function normalizeMentionKind(value) {
1464
1150
  function normalizeEntryKind(value) {
1465
1151
  return value === "directory" || value === "file" ? value : "unknown";
1466
1152
  }
1153
+
1154
+ // agent-gui/agentGuiNode/agentRichText/agentMentionPresentation.ts
1467
1155
  function mentionVisual(item) {
1468
1156
  if (item.kind === "file") {
1469
1157
  return {
@@ -1546,19 +1234,330 @@ function parseDottedSessionMentionText(value) {
1546
1234
  summary: normalizeAgentSessionMentionTitle(parts.slice(2).join(" "))
1547
1235
  };
1548
1236
  }
1549
- function dirnameFromPath2(path) {
1550
- const parts = path.split("/").filter(Boolean);
1551
- if (parts.length <= 1) {
1552
- return path.startsWith("/") ? "/" : "";
1237
+
1238
+ // agent-gui/agentGuiNode/agentRichText/agentFileMentionExtension.ts
1239
+ var agentFileMentionPluginKey = new PluginKey(
1240
+ "agentFileMentionSuggestion"
1241
+ );
1242
+ function exitAgentFileMentionSuggestion(editor) {
1243
+ exitSuggestion(editor.view, agentFileMentionPluginKey);
1244
+ }
1245
+ var MENTION_PLACEHOLDER_LEAF_SENTINEL = "\uFFFC";
1246
+ var MENTION_PLACEHOLDER_MAX_LENGTH = 40;
1247
+ function expandRangeOverMentionPlaceholder(editor, range) {
1248
+ const { doc } = editor.state;
1249
+ const $from = doc.resolve(range.from);
1250
+ const blockStart = $from.start();
1251
+ const blockEnd = $from.end();
1252
+ const blockText = doc.textBetween(
1253
+ blockStart,
1254
+ blockEnd,
1255
+ "\n",
1256
+ MENTION_PLACEHOLDER_LEAF_SENTINEL
1257
+ );
1258
+ const fromOffset = range.from - blockStart;
1259
+ const toOffset = Math.min(range.to, blockEnd) - blockStart;
1260
+ let open = -1;
1261
+ for (let index = fromOffset - 1; index >= 0; index -= 1) {
1262
+ const char = blockText[index];
1263
+ if (char === "}") {
1264
+ return range;
1265
+ }
1266
+ if (char === "{") {
1267
+ open = index;
1268
+ break;
1269
+ }
1553
1270
  }
1554
- return `/${parts.slice(0, -1).join("/")}`;
1271
+ if (open < 0) {
1272
+ return range;
1273
+ }
1274
+ let close = -1;
1275
+ for (let index = toOffset; index < blockText.length; index += 1) {
1276
+ const char = blockText[index];
1277
+ if (char === "{") {
1278
+ return range;
1279
+ }
1280
+ if (char === "}") {
1281
+ close = index;
1282
+ break;
1283
+ }
1284
+ }
1285
+ if (close < 0) {
1286
+ return range;
1287
+ }
1288
+ const group = blockText.slice(open, close + 1);
1289
+ if (close - open > MENTION_PLACEHOLDER_MAX_LENGTH || group.includes("\n") || group.includes(MENTION_PLACEHOLDER_LEAF_SENTINEL)) {
1290
+ return range;
1291
+ }
1292
+ let end = close + 1;
1293
+ if (blockText[end] === " " || blockText[end] === " ") {
1294
+ end += 1;
1295
+ }
1296
+ return { from: blockStart + open, to: blockStart + end };
1297
+ }
1298
+ function createAgentFileMentionExtension(options = {}) {
1299
+ return Node.create({
1300
+ name: "agentFileMention",
1301
+ group: "inline",
1302
+ inline: true,
1303
+ atom: true,
1304
+ selectable: false,
1305
+ addOptions() {
1306
+ return options;
1307
+ },
1308
+ addAttributes() {
1309
+ return {
1310
+ name: { default: "" },
1311
+ kind: { default: "file" },
1312
+ href: { default: "" },
1313
+ path: { default: "" },
1314
+ entryKind: { default: "unknown" },
1315
+ directoryPath: { default: "" },
1316
+ workspaceId: { default: "" },
1317
+ targetId: { default: "" },
1318
+ agentTargetId: { default: "" },
1319
+ scope: { default: "" },
1320
+ title: { default: "" },
1321
+ initiatorName: { default: "" },
1322
+ agentName: { default: "" },
1323
+ status: { default: "" },
1324
+ inputPreview: { default: "" },
1325
+ summaryPreview: { default: "" },
1326
+ creatorName: { default: "" },
1327
+ topicId: { default: "" },
1328
+ appId: { default: "" },
1329
+ agentProviderId: { default: "" },
1330
+ jobId: { default: "" },
1331
+ action: { default: "" },
1332
+ contextPath: { default: "" },
1333
+ description: { default: "" },
1334
+ iconUrl: { default: "" },
1335
+ contentPreview: { default: "" },
1336
+ thumbnailUrl: { default: "" },
1337
+ source: { default: "" },
1338
+ groupId: { default: "" },
1339
+ fileCount: { default: "" },
1340
+ customKind: { default: "" },
1341
+ preview: { default: "" }
1342
+ };
1343
+ },
1344
+ parseHTML() {
1345
+ return [
1346
+ {
1347
+ tag: "span[data-agent-file-mention]",
1348
+ getAttrs: parseAgentMentionHTMLElementAttrs
1349
+ },
1350
+ {
1351
+ tag: "a[data-agent-file-mention]",
1352
+ getAttrs: parseAgentMentionHTMLElementAttrs
1353
+ }
1354
+ ];
1355
+ },
1356
+ renderHTML({ HTMLAttributes }) {
1357
+ const item = attrsToMentionItem(HTMLAttributes);
1358
+ const fileThumbnailUrl = item.kind === "file" ? resolveAgentMentionFileThumbnailUrl(item) : void 0;
1359
+ const href = item.href;
1360
+ const tagName = options.renderAsLink ? "a" : "span";
1361
+ const visual = mentionVisual(item);
1362
+ const sessionVisual = item.kind === "session" ? sessionMentionVisual(item) : null;
1363
+ const sharedAttributes = {
1364
+ "data-agent-file-mention": "true",
1365
+ "data-agent-mention-href": href,
1366
+ "data-agent-mention-kind": item.kind,
1367
+ "aria-label": item.kind === "file" ? visual.primary : `${visual.kindLabel} ${visual.primary}`.trim()
1368
+ };
1369
+ return [
1370
+ tagName,
1371
+ mergeAttributes(HTMLAttributes, {
1372
+ ...sharedAttributes,
1373
+ ...item.kind === "file" ? {
1374
+ "data-agent-file-entry-kind": item.entryKind,
1375
+ "data-agent-file-directory-path": item.directoryPath,
1376
+ "data-agent-file-visual-kind": resolveAgentMentionFileVisualKind(item)
1377
+ } : {},
1378
+ ...options.renderAsLink ? { href } : {},
1379
+ ...(item.kind === "workspace-app" || item.kind === "agent-target" || item.kind === "workspace-reference") && item.iconUrl ? { "data-agent-mention-icon-url": item.iconUrl } : {},
1380
+ ...item.kind === "workspace-reference" ? { "data-agent-mention-file-count": String(item.fileCount) } : {},
1381
+ ...fileThumbnailUrl ? { "data-agent-mention-thumbnail-url": fileThumbnailUrl } : {},
1382
+ class: item.kind === "file" ? "tsh-agent-object-token tsh-agent-object-token--file" : "tsh-agent-object-token tsh-agent-object-token--entity"
1383
+ }),
1384
+ ...item.kind === "file" ? [
1385
+ fileThumbnailUrl ? [
1386
+ "span",
1387
+ {
1388
+ class: "agent-gui-node__mention-file-thumb",
1389
+ "data-agent-mention-file-thumb": "true",
1390
+ "aria-hidden": "true"
1391
+ },
1392
+ [
1393
+ "img",
1394
+ {
1395
+ src: fileThumbnailUrl,
1396
+ alt: "",
1397
+ decoding: "async",
1398
+ loading: "lazy",
1399
+ draggable: "false"
1400
+ }
1401
+ ]
1402
+ ] : [
1403
+ "span",
1404
+ {
1405
+ class: "tsh-agent-object-token__icon",
1406
+ "aria-hidden": "true"
1407
+ },
1408
+ ""
1409
+ ],
1410
+ [
1411
+ "span",
1412
+ { class: "tsh-agent-object-token__main" },
1413
+ visual.primary
1414
+ ]
1415
+ ] : item.kind === "session" ? [
1416
+ [
1417
+ "span",
1418
+ {
1419
+ class: "tsh-agent-object-token__kind",
1420
+ "aria-hidden": "true"
1421
+ },
1422
+ [
1423
+ "span",
1424
+ {
1425
+ class: "tsh-agent-object-token__kind-icon",
1426
+ "aria-hidden": "true"
1427
+ },
1428
+ ""
1429
+ ]
1430
+ ],
1431
+ [
1432
+ "span",
1433
+ { class: "tsh-agent-object-token__main" },
1434
+ [
1435
+ "span",
1436
+ { class: "tsh-agent-object-token__participant" },
1437
+ sessionVisual?.participant ?? ""
1438
+ ],
1439
+ [
1440
+ "span",
1441
+ { class: "tsh-agent-object-token__summary" },
1442
+ sessionVisual?.summary ? ` ${sessionVisual.summary}` : ""
1443
+ ]
1444
+ ]
1445
+ ] : [
1446
+ [
1447
+ "span",
1448
+ {
1449
+ class: "tsh-agent-object-token__kind",
1450
+ "aria-hidden": "true"
1451
+ },
1452
+ [
1453
+ "span",
1454
+ {
1455
+ class: "tsh-agent-object-token__kind-icon",
1456
+ "aria-hidden": "true"
1457
+ },
1458
+ ""
1459
+ ]
1460
+ ],
1461
+ [
1462
+ "span",
1463
+ { class: "tsh-agent-object-token__main" },
1464
+ visual.primary
1465
+ ]
1466
+ ]
1467
+ ];
1468
+ },
1469
+ renderText({ node }) {
1470
+ return formatAgentMentionMarkdown(attrsToMentionItem(node.attrs ?? {}));
1471
+ },
1472
+ addNodeView() {
1473
+ return ReactNodeViewRenderer(AgentMentionNodeView);
1474
+ },
1475
+ addProseMirrorPlugins() {
1476
+ if (options.enableSuggestions === false) {
1477
+ return [];
1478
+ }
1479
+ return [
1480
+ Suggestion({
1481
+ editor: this.editor,
1482
+ pluginKey: agentFileMentionPluginKey,
1483
+ char: "@",
1484
+ allowedPrefixes: [" ", "\n", " "],
1485
+ allowSpaces: true,
1486
+ items: () => [],
1487
+ allow: ({ state, range }) => {
1488
+ if (options.shouldSuppressSuggestion?.()) {
1489
+ return false;
1490
+ }
1491
+ if (range.from <= 1) {
1492
+ return true;
1493
+ }
1494
+ const previous = state.doc.textBetween(
1495
+ range.from - 1,
1496
+ range.from,
1497
+ "\n",
1498
+ "\n"
1499
+ );
1500
+ return isRichTextTriggerPrefixBoundary(previous, "whitespace");
1501
+ },
1502
+ command: ({ editor, range, props }) => {
1503
+ const insertRange = expandRangeOverMentionPlaceholder(
1504
+ editor,
1505
+ range
1506
+ );
1507
+ const prefixCaretAnchor = insertRange.from <= 1 || editor.state.doc.textBetween(
1508
+ Math.max(1, insertRange.from - 1),
1509
+ insertRange.from,
1510
+ "\n",
1511
+ "\n"
1512
+ ) === "\n";
1513
+ editor.chain().focus().insertContentAt(insertRange, [
1514
+ ...prefixCaretAnchor ? [
1515
+ {
1516
+ type: "text",
1517
+ text: AGENT_RICH_TEXT_CARET_ANCHOR
1518
+ }
1519
+ ] : [],
1520
+ {
1521
+ type: this.name,
1522
+ attrs: mentionItemToAttrs(props)
1523
+ },
1524
+ { type: "text", text: " " }
1525
+ ]).run();
1526
+ },
1527
+ render: () => ({
1528
+ onStart: (props) => {
1529
+ options.onSuggestionChange?.({
1530
+ editor: props.editor,
1531
+ range: props.range,
1532
+ query: props.query,
1533
+ text: props.text,
1534
+ command: props.command,
1535
+ clientRect: props.clientRect
1536
+ });
1537
+ },
1538
+ onUpdate: (props) => {
1539
+ options.onSuggestionChange?.({
1540
+ editor: props.editor,
1541
+ range: props.range,
1542
+ query: props.query,
1543
+ text: props.text,
1544
+ command: props.command,
1545
+ clientRect: props.clientRect
1546
+ });
1547
+ },
1548
+ onExit: () => {
1549
+ options.onSuggestionChange?.(null);
1550
+ },
1551
+ onKeyDown: (props) => options.onSuggestionKeyDown?.(props.event) ?? false
1552
+ })
1553
+ })
1554
+ ];
1555
+ }
1556
+ });
1555
1557
  }
1556
1558
 
1557
1559
  export {
1558
1560
  AGENT_RICH_TEXT_CARET_ANCHOR,
1559
- AgentMentionTooltipProviderScope,
1560
- exitAgentFileMentionSuggestion,
1561
- createAgentFileMentionExtension,
1562
1561
  normalizeAgentSessionMentionTitle,
1563
1562
  createAgentSessionMentionHref,
1564
1563
  createAgentSessionMarkdownLink,
@@ -1566,6 +1565,8 @@ export {
1566
1565
  parseAgentMentionMarkdown,
1567
1566
  parseMentionItemFromHref,
1568
1567
  mentionItemToAttrs,
1569
- attrsToMentionItem
1568
+ attrsToMentionItem,
1569
+ exitAgentFileMentionSuggestion,
1570
+ createAgentFileMentionExtension
1570
1571
  };
1571
- //# sourceMappingURL=chunk-BXVPOGYK.js.map
1572
+ //# sourceMappingURL=chunk-O3Q5SIJH.js.map