@athenaintel/react 0.26.3 → 0.26.6

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 (123) hide show
  1. package/README.md +22 -0
  2. package/dist/auth/AthenaAuthProvider.d.ts +1 -1
  3. package/dist/auth/AthenaSSOProvider.d.ts +1 -1
  4. package/dist/chat/AthenaChat.cjs +1 -1
  5. package/dist/chat/AthenaChat.cjs.map +1 -1
  6. package/dist/chat/AthenaChat.js +1 -1
  7. package/dist/chat/AthenaChat.js.map +1 -1
  8. package/dist/chat/StatewireApprovalCard.cjs +68 -9
  9. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  10. package/dist/chat/StatewireApprovalCard.d.ts +0 -31
  11. package/dist/chat/StatewireApprovalCard.js +70 -11
  12. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  13. package/dist/chat/StatewireQueuedMessages.cjs +44 -1
  14. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  15. package/dist/chat/StatewireQueuedMessages.js +45 -2
  16. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  17. package/dist/chat/super-grouping/CollapsibleGroup.d.ts +1 -1
  18. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +2 -2
  19. package/dist/chat/super-grouping/ToolTimeline.d.ts +1 -1
  20. package/dist/chat/use-statewire-approval-request.cjs +6 -1
  21. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  22. package/dist/chat/use-statewire-approval-request.d.ts +20 -0
  23. package/dist/chat/use-statewire-approval-request.js +6 -1
  24. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  25. package/dist/chat-ui/header/chat-header.cjs +4 -4
  26. package/dist/chat-ui/header/chat-header.cjs.map +1 -1
  27. package/dist/chat-ui/header/chat-header.d.ts +3 -3
  28. package/dist/chat-ui/header/chat-header.js +1 -1
  29. package/dist/chat-ui/header/chat-header.js.map +1 -1
  30. package/dist/chat-ui/header/conversation-history-panel.d.ts +1 -1
  31. package/dist/chat-ui/index.cjs +8 -7
  32. package/dist/chat-ui/index.cjs.map +1 -1
  33. package/dist/chat-ui/index.d.ts +2 -1
  34. package/dist/chat-ui/index.js +2 -1
  35. package/dist/chat-ui/index.js.map +1 -1
  36. package/dist/chat-ui/markdown-storage.cjs +2 -1
  37. package/dist/chat-ui/markdown-storage.cjs.map +1 -1
  38. package/dist/chat-ui/markdown-storage.d.ts +3 -0
  39. package/dist/chat-ui/markdown-storage.js +2 -1
  40. package/dist/chat-ui/markdown-storage.js.map +1 -1
  41. package/dist/chat-ui/mentions/mention-chip.cjs +6 -0
  42. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  43. package/dist/chat-ui/mentions/mention-chip.d.ts +2 -0
  44. package/dist/chat-ui/mentions/mention-chip.js +6 -0
  45. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  46. package/dist/chat-ui/mentions/suggestions/components/mention-icon.d.ts +1 -1
  47. package/dist/chat-ui/mentions/suggestions/components/menu-breadcrumbs.d.ts +1 -1
  48. package/dist/chat-ui/mentions/suggestions/components/menu-item.d.ts +1 -1
  49. package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +1 -1
  50. package/dist/chat-ui/mentions/suggestions/components/menu-skeleton.d.ts +1 -1
  51. package/dist/chat-ui/mentions/suggestions/components/menu-summary.d.ts +1 -1
  52. package/dist/chat-ui/mentions/suggestions/shims.d.ts +1 -1
  53. package/dist/chat-ui/messages/message-components.cjs +13 -59
  54. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  55. package/dist/chat-ui/messages/message-components.d.ts +2 -14
  56. package/dist/chat-ui/messages/message-components.js +2 -47
  57. package/dist/chat-ui/messages/message-components.js.map +1 -1
  58. package/dist/chat-ui/messages/runtime-message.cjs +1 -1
  59. package/dist/chat-ui/messages/runtime-message.cjs.map +1 -1
  60. package/dist/chat-ui/messages/runtime-message.js +1 -1
  61. package/dist/chat-ui/messages/runtime-message.js.map +1 -1
  62. package/dist/chat-ui/messages/thread-chrome.cjs +59 -0
  63. package/dist/chat-ui/messages/thread-chrome.cjs.map +1 -0
  64. package/dist/chat-ui/messages/thread-chrome.d.ts +14 -0
  65. package/dist/chat-ui/messages/thread-chrome.js +59 -0
  66. package/dist/chat-ui/messages/thread-chrome.js.map +1 -0
  67. package/dist/chat-ui/messages/wake-marker.cjs +1 -1
  68. package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
  69. package/dist/chat-ui/messages/wake-marker.js +1 -1
  70. package/dist/chat-ui/messages/wake-marker.js.map +1 -1
  71. package/dist/chat-ui/rich-text/chat-link.d.ts +2 -2
  72. package/dist/chat-ui/rich-text/chat-message-body.d.ts +1 -1
  73. package/dist/chat-ui/rich-text/chat-node-views.d.ts +5 -5
  74. package/dist/chat-ui/rich-text/chat-text-schema.cjs +9 -1
  75. package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
  76. package/dist/chat-ui/rich-text/chat-text-schema.d.ts +7 -0
  77. package/dist/chat-ui/rich-text/chat-text-schema.js +9 -1
  78. package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
  79. package/dist/chat-ui/thread/chat-composer-dock.d.ts +1 -1
  80. package/dist/chat-ui/thread/chat-thread-shell.cjs +4 -3
  81. package/dist/chat-ui/thread/chat-thread-shell.cjs.map +1 -1
  82. package/dist/chat-ui/thread/chat-thread-shell.d.ts +1 -1
  83. package/dist/chat-ui/thread/chat-thread-shell.js +2 -1
  84. package/dist/chat-ui/thread/chat-thread-shell.js.map +1 -1
  85. package/dist/composer/AttachmentContext.d.ts +1 -1
  86. package/dist/composer/QuoteContext.d.ts +1 -1
  87. package/dist/lib/posthog/before-send.cjs +12 -0
  88. package/dist/lib/posthog/before-send.cjs.map +1 -1
  89. package/dist/lib/posthog/before-send.js +12 -0
  90. package/dist/lib/posthog/before-send.js.map +1 -1
  91. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +2 -0
  92. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  93. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +2 -0
  94. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  95. package/dist/packages/agent-runtime/src/messages.cjs +15 -1
  96. package/dist/packages/agent-runtime/src/messages.cjs.map +1 -1
  97. package/dist/packages/agent-runtime/src/messages.js +15 -1
  98. package/dist/packages/agent-runtime/src/messages.js.map +1 -1
  99. package/dist/packages/agent-runtime/src/tool-metadata.cjs +15 -0
  100. package/dist/packages/agent-runtime/src/tool-metadata.cjs.map +1 -1
  101. package/dist/packages/agent-runtime/src/tool-metadata.js +15 -0
  102. package/dist/packages/agent-runtime/src/tool-metadata.js.map +1 -1
  103. package/dist/packages/react/package.json.cjs +1 -1
  104. package/dist/packages/react/package.json.js +1 -1
  105. package/dist/packages/tiptap-markdown-table/src/markdown-table-serializer.cjs +114 -0
  106. package/dist/packages/tiptap-markdown-table/src/markdown-table-serializer.cjs.map +1 -0
  107. package/dist/packages/tiptap-markdown-table/src/markdown-table-serializer.js +114 -0
  108. package/dist/packages/tiptap-markdown-table/src/markdown-table-serializer.js.map +1 -0
  109. package/dist/provider/AthenaProvider.d.ts +1 -1
  110. package/dist/provider/PostHogProvider.d.ts +1 -1
  111. package/dist/threads/SessionList.d.ts +1 -1
  112. package/dist/threads/ThreadList.d.ts +1 -1
  113. package/dist/threads/statewire-thread-list.d.ts +1 -1
  114. package/dist/tools/primitives.d.ts +3 -3
  115. package/dist/tools/tool-fallback.d.ts +8 -8
  116. package/dist/ui/button.d.ts +1 -1
  117. package/dist/ui/collapsible.d.ts +3 -3
  118. package/dist/ui/popover.d.ts +3 -3
  119. package/dist/ui/tooltip.d.ts +4 -4
  120. package/dist/voice/use-athena-voice-session.cjs.map +1 -1
  121. package/dist/voice/use-athena-voice-session.d.ts +5 -0
  122. package/dist/voice/use-athena-voice-session.js.map +1 -1
  123. package/package.json +3 -2
@@ -1 +1 @@
1
- {"version":3,"file":"use-statewire-approval-request.js","sources":["../../src/chat/use-statewire-approval-request.ts"],"sourcesContent":["import type { StatewireThread } from '@assistant-ui/react-statewire';\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n useStatewireState,\n} from '@assistant-ui/react-statewire';\nimport {\n type AbandonedInputRequest,\n asHitlApproval,\n findAbandonedInterrupt,\n HITL_PENDING_RESUME_GRACE_MS,\n type HitlApprovalPayload,\n interruptMirrorPayload,\n isApprovalCardInterrupt,\n type PendingActionRequest,\n pendingActionRequests,\n readAbandonedInputRequests,\n readInterruptMirror,\n readQueuedLaneDecisions,\n useApprovalResumeLock,\n} from '@athenaintel/agent-runtime';\nimport { useCallback, useMemo } from 'react';\nimport { useAthenaRunLive } from './use-athena-run-live';\n\ndeclare module '@assistant-ui/core' {\n namespace Assistant {\n interface Commands {\n /**\n * Decide per-dispatch subagent lanes while the parent run is still\n * streaming (`DeepAgentThread.run_lane_input`). Keys are the lanes'\n * langgraph interrupt ids; the host matches them against the lanes its\n * mirrored interrupt currently parks, answers at once when the run is\n * already parked, and otherwise holds them until it parks — stale or\n * unknown ids are ignored, never carried to a later interrupt.\n */\n runLaneInput: {\n readonly type: 'run/lane-input';\n readonly laneDecisions: Readonly<Record<string, StatewireThread.InputResponse>>;\n };\n }\n }\n}\n\nconst NO_QUEUED_LANE_DECISIONS: Readonly<Record<string, unknown>> = Object.freeze({});\n\n/** Selects which pending interrupt an approval surface answers. */\nexport type StatewireInterruptPredicate = (\n request: StatewireThread.InputRequestState,\n) => request is StatewireThread.CustomInputRequest;\n\nexport interface UseStatewireApprovalRequestOptions {\n /**\n * Which pending interrupt to answer. Defaults to `isApprovalCardInterrupt`\n * (client-tool parks excluded — the client-tool bridge owns those, and a\n * generic resume would corrupt the parked tool call).\n */\n interruptPredicate?: StatewireInterruptPredicate;\n /**\n * How long a sent decision keeps the actions locked when no resume run ever\n * starts. Defaults to {@link HITL_PENDING_RESUME_GRACE_MS}.\n */\n pendingResumeGraceMs?: number;\n /**\n * The host refused the `run/input` (or the transport lost it): the\n * optimistic fold rolls back, the request is on screen again with its\n * actions re-enabled, and this is the surface's one chance to say why.\n */\n onResumeRejected?: (error: unknown, requestId: string) => void;\n /** See {@link UseApprovalResumeLockOptions.onResumeRetry}. */\n onResumeRetry?: (error: unknown, requestId: string, attempt: number) => void;\n}\n\nexport interface StatewireApprovalRequest<TValue> {\n /** The pending interrupt this surface answers, if any. */\n request: StatewireThread.CustomInputRequest | undefined;\n requestId: string | undefined;\n /** The payload narrowed to the Athena HITL approval shape, or `null`. */\n hitl: HitlApprovalPayload | null;\n /** Every gated call the approval covers, in decision order (empty for non-HITL parks). */\n actionRequests: PendingActionRequest[];\n /** An interrupt a non-resume dispatch dropped — the \"approval was cancelled\" notice. */\n abandonedInterrupt: AbandonedInputRequest | undefined;\n /**\n * The mirrored interrupt's HITL payload while the run is still live and no\n * input request is answerable: per-dispatch `task` lanes parked on their\n * gates while sibling lanes stream. `null` once the run parks (the same\n * lanes are then `hitl` / `actionRequests`) and when nothing is parked.\n */\n liveHitl: HitlApprovalPayload | null;\n /** Every gated call `liveHitl` covers (empty when it is `null`). */\n liveActionRequests: PendingActionRequest[];\n /**\n * The decisions the host already holds from a `run/lane-input`, keyed by\n * langgraph interrupt id, to be answered when the run parks — a queued lane\n * reads as decided on every attached client, not just the one that sent it.\n */\n queuedLaneDecisions: Readonly<Record<string, unknown>>;\n /** True after a resume until the request identity changes (or recovery fires). */\n pending: boolean;\n /**\n * Answer the request with `{ type: 'run/input', requestId, response: { type: 'resume', value } }`.\n * Returns the dispatch promise (settles when the host accepts, rejects when\n * it refuses), or `undefined` when the lock dropped the send.\n */\n resume: (value: TValue) => Promise<unknown> | undefined;\n /**\n * Decide per-dispatch lanes by langgraph interrupt id. With a pending\n * request this is the native `lane_decisions` resume through the lock;\n * without one (the run is still streaming siblings) it is `run/lane-input`,\n * which the host queues and answers on the park. Returns the dispatch\n * promise, or `undefined` when the lock dropped a resume.\n */\n sendLaneDecisions: (\n lanes: Readonly<Record<string, StatewireThread.InputResponse>>,\n ) => Promise<unknown> | undefined;\n}\n\n/**\n * The headless half of every statewire approval surface: selects the pending\n * interrupt from the runs projection, narrows its payload, reads the\n * host-published abandoned interrupts, and wires the shared optimistic resume\n * lock to the thread's `run/input` command. `StatewireApprovalCard` renders\n * over it; hosts with their own decision UI (per-lane subagent cards) build\n * on it directly so the selection and lock semantics cannot drift.\n *\n * Requires a statewire aui scope (throws outside one, like every\n * `useStatewire*` hook) — gate the mount with `hasStatewireThreadExtras`.\n */\nexport function useStatewireApprovalRequest<\n TValue extends StatewireThread.InputResponse = Record<string, string>,\n>(options: UseStatewireApprovalRequestOptions = {}): StatewireApprovalRequest<TValue> {\n const {\n interruptPredicate = isApprovalCardInterrupt,\n pendingResumeGraceMs = HITL_PENDING_RESUME_GRACE_MS,\n onResumeRejected,\n onResumeRetry,\n } = options;\n const sendCommand = useStatewireSendCommand();\n // The runs projection is memoized by the lib, so this derivation is\n // reference-stable between state updates.\n const request = useStatewireRuns().inputRequests?.find(interruptPredicate);\n const requestId = request?.id;\n\n // The host publishes the interrupts a non-resume dispatch dropped. Select\n // the raw array reference (pre-stream-safe) and derive inline; a `.find`\n // selector would return a fresh object every update.\n const abandoned = useStatewireState(readAbandonedInputRequests);\n const abandonedInterrupt = findAbandonedInterrupt(abandoned);\n\n const hitl = asHitlApproval(request?.payload);\n const actionRequests = useMemo(() => pendingActionRequests(hitl), [hitl]);\n\n const isRunning = useAthenaRunLive();\n // The host mirrors the interrupt into state as soon as a lane parks — while\n // the run manager still reports `running` (siblings streaming) and has no\n // request to answer. Raw reference selectors; derive inline.\n const mirror = useStatewireState(readInterruptMirror);\n const liveHitl =\n request === undefined && isRunning ? asHitlApproval(interruptMirrorPayload(mirror)) : null;\n const liveActionRequests = useMemo(() => pendingActionRequests(liveHitl), [liveHitl]);\n const queuedLaneDecisions =\n useStatewireState(readQueuedLaneDecisions) ?? NO_QUEUED_LANE_DECISIONS;\n\n const { pending, resume } = useApprovalResumeLock<TValue>({\n requestId,\n isRunning,\n pendingResumeGraceMs,\n onResumeRejected,\n onResumeRetry,\n // The dispatch promise is handed to the lock: a refusal releases it and\n // reaches `onResumeRejected`.\n sendResume: (id, value) =>\n sendCommand({\n type: 'run/input',\n requestId: id,\n response: { type: 'resume', value },\n }),\n });\n\n const sendLaneDecisions = useCallback(\n (lanes: Readonly<Record<string, StatewireThread.InputResponse>>) =>\n requestId !== undefined\n ? resume({ lane_decisions: lanes } as unknown as TValue)\n : sendCommand({ type: 'run/lane-input', laneDecisions: lanes }),\n [requestId, resume, sendCommand],\n );\n\n return {\n request,\n requestId,\n hitl,\n actionRequests,\n liveHitl,\n liveActionRequests,\n queuedLaneDecisions,\n abandonedInterrupt,\n pending,\n resume,\n sendLaneDecisions,\n };\n}\n"],"names":[],"mappings":";;;;AA2CA,MAAM,2BAA8D,OAAO,OAAO,EAAE;AAqF7E,SAAS,4BAEd,UAA8C,IAAsC;;AACpF,QAAM;AAAA,IACJ,qBAAqB;AAAA,IACrB,uBAAuB;AAAA,IACvB;AAAA,IACA;AAAA,EAAA,IACE;AACJ,QAAM,cAAc,wBAAA;AAGpB,QAAM,WAAU,sBAAA,EAAmB,kBAAnB,mBAAkC,KAAK;AACvD,QAAM,YAAY,mCAAS;AAK3B,QAAM,YAAY,kBAAkB,0BAA0B;AAC9D,QAAM,qBAAqB,uBAAuB,SAAS;AAE3D,QAAM,OAAO,eAAe,mCAAS,OAAO;AAC5C,QAAM,iBAAiB,QAAQ,MAAM,sBAAsB,IAAI,GAAG,CAAC,IAAI,CAAC;AAExE,QAAM,YAAY,iBAAA;AAIlB,QAAM,SAAS,kBAAkB,mBAAmB;AACpD,QAAM,WACJ,YAAY,UAAa,YAAY,eAAe,uBAAuB,MAAM,CAAC,IAAI;AACxF,QAAM,qBAAqB,QAAQ,MAAM,sBAAsB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AACpF,QAAM,sBACJ,kBAAkB,uBAAuB,KAAK;AAEhD,QAAM,EAAE,SAAS,OAAA,IAAW,sBAA8B;AAAA,IACxD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA,IAGA,YAAY,CAAC,IAAI,UACf,YAAY;AAAA,MACV,MAAM;AAAA,MACN,WAAW;AAAA,MACX,UAAU,EAAE,MAAM,UAAU,MAAA;AAAA,IAAM,CACnC;AAAA,EAAA,CACJ;AAED,QAAM,oBAAoB;AAAA,IACxB,CAAC,UACC,cAAc,SACV,OAAO,EAAE,gBAAgB,MAAA,CAA4B,IACrD,YAAY,EAAE,MAAM,kBAAkB,eAAe,OAAO;AAAA,IAClE,CAAC,WAAW,QAAQ,WAAW;AAAA,EAAA;AAGjC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"use-statewire-approval-request.js","sources":["../../src/chat/use-statewire-approval-request.ts"],"sourcesContent":["import type { StatewireThread } from '@assistant-ui/react-statewire';\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n useStatewireState,\n} from '@assistant-ui/react-statewire';\nimport {\n type AbandonedInputRequest,\n asHitlApproval,\n findAbandonedInterrupt,\n HITL_PENDING_RESUME_GRACE_MS,\n type HitlApprovalPayload,\n interruptMirrorPayload,\n isApprovalCardInterrupt,\n type PendingActionRequest,\n pendingActionRequests,\n readAbandonedInputRequests,\n readInterruptMirror,\n readQueuedLaneDecisions,\n useApprovalResumeLock,\n} from '@athenaintel/agent-runtime';\nimport { useCallback, useMemo } from 'react';\nimport { useAthenaRunLive } from './use-athena-run-live';\n\ndeclare module '@assistant-ui/core' {\n namespace Assistant {\n interface Commands {\n /**\n * Decide per-dispatch subagent lanes while the parent run is still\n * streaming (`DeepAgentThread.run_lane_input`). Keys are the lanes'\n * langgraph interrupt ids; the host matches them against the lanes its\n * mirrored interrupt currently parks, answers at once when the run is\n * already parked, and otherwise holds them until it parks — stale or\n * unknown ids are ignored, never carried to a later interrupt.\n */\n runLaneInput: {\n readonly type: 'run/lane-input';\n readonly laneDecisions: Readonly<Record<string, StatewireThread.InputResponse>>;\n };\n /**\n * Re-send the lane decisions the host still holds queued as their\n * approver's resume of the parked request (`DeepAgentThread.run_lane_replay`).\n * The host resumes under the meta the approver's `run/lane-input`\n * recorded and refuses any other caller — every attached client reads\n * the same queue, and only the one that queued it may turn it into a\n * resume. Carries no decisions: the host replays what it recorded.\n */\n runLaneReplay: {\n readonly type: 'run/lane-replay';\n readonly requestId: string;\n };\n }\n }\n}\n\nconst NO_QUEUED_LANE_DECISIONS: Readonly<Record<string, unknown>> = Object.freeze({});\n\n/** Selects which pending interrupt an approval surface answers. */\nexport type StatewireInterruptPredicate = (\n request: StatewireThread.InputRequestState,\n) => request is StatewireThread.CustomInputRequest;\n\nexport interface UseStatewireApprovalRequestOptions {\n /**\n * Which pending interrupt to answer. Defaults to `isApprovalCardInterrupt`\n * (client-tool parks excluded — the client-tool bridge owns those, and a\n * generic resume would corrupt the parked tool call).\n */\n interruptPredicate?: StatewireInterruptPredicate;\n /**\n * How long a sent decision keeps the actions locked when no resume run ever\n * starts. Defaults to {@link HITL_PENDING_RESUME_GRACE_MS}.\n */\n pendingResumeGraceMs?: number;\n /**\n * The host refused the `run/input` (or the transport lost it): the\n * optimistic fold rolls back, the request is on screen again with its\n * actions re-enabled, and this is the surface's one chance to say why.\n */\n onResumeRejected?: (error: unknown, requestId: string) => void;\n /** See {@link UseApprovalResumeLockOptions.onResumeRetry}. */\n onResumeRetry?: (error: unknown, requestId: string, attempt: number) => void;\n}\n\nexport interface StatewireApprovalRequest<TValue> {\n /** The pending interrupt this surface answers, if any. */\n request: StatewireThread.CustomInputRequest | undefined;\n requestId: string | undefined;\n /** The payload narrowed to the Athena HITL approval shape, or `null`. */\n hitl: HitlApprovalPayload | null;\n /** Every gated call the approval covers, in decision order (empty for non-HITL parks). */\n actionRequests: PendingActionRequest[];\n /** An interrupt a non-resume dispatch dropped — the \"approval was cancelled\" notice. */\n abandonedInterrupt: AbandonedInputRequest | undefined;\n /**\n * The mirrored interrupt's HITL payload while the run is still live and no\n * input request is answerable: per-dispatch `task` lanes parked on their\n * gates while sibling lanes stream. `null` once the run parks (the same\n * lanes are then `hitl` / `actionRequests`) and when nothing is parked.\n */\n liveHitl: HitlApprovalPayload | null;\n /** Every gated call `liveHitl` covers (empty when it is `null`). */\n liveActionRequests: PendingActionRequest[];\n /**\n * The decisions the host already holds from a `run/lane-input`, keyed by\n * langgraph interrupt id, to be answered when the run parks — a queued lane\n * reads as decided on every attached client, not just the one that sent it.\n */\n queuedLaneDecisions: Readonly<Record<string, unknown>>;\n /** True after a resume until the request identity changes (or recovery fires). */\n pending: boolean;\n /**\n * Answer the request with `{ type: 'run/input', requestId, response: { type: 'resume', value } }`.\n * Returns the dispatch promise (settles when the host accepts, rejects when\n * it refuses), or `undefined` when the lock dropped the send.\n */\n resume: (value: TValue) => Promise<unknown> | undefined;\n /**\n * Decide per-dispatch lanes by langgraph interrupt id. With a pending\n * request this is the native `lane_decisions` resume through the lock;\n * without one (the run is still streaming siblings) it is `run/lane-input`,\n * which the host queues and answers on the park. Returns the dispatch\n * promise, or `undefined` when the lock dropped a resume.\n */\n sendLaneDecisions: (\n lanes: Readonly<Record<string, StatewireThread.InputResponse>>,\n ) => Promise<unknown> | undefined;\n /**\n * Ask the host to resume the parked `requestId` with the lane decisions it\n * still holds queued, as their approver (`run/lane-replay`). For the card\n * that queued them, after the host's own answerer has stayed silent past\n * its budget; the host refuses every other caller. Settles when the host\n * accepts, rejects when it refuses.\n */\n replayQueuedLanes: (requestId: string) => Promise<unknown>;\n}\n\n/**\n * The headless half of every statewire approval surface: selects the pending\n * interrupt from the runs projection, narrows its payload, reads the\n * host-published abandoned interrupts, and wires the shared optimistic resume\n * lock to the thread's `run/input` command. `StatewireApprovalCard` renders\n * over it; hosts with their own decision UI (per-lane subagent cards) build\n * on it directly so the selection and lock semantics cannot drift.\n *\n * Requires a statewire aui scope (throws outside one, like every\n * `useStatewire*` hook) — gate the mount with `hasStatewireThreadExtras`.\n */\nexport function useStatewireApprovalRequest<\n TValue extends StatewireThread.InputResponse = Record<string, string>,\n>(options: UseStatewireApprovalRequestOptions = {}): StatewireApprovalRequest<TValue> {\n const {\n interruptPredicate = isApprovalCardInterrupt,\n pendingResumeGraceMs = HITL_PENDING_RESUME_GRACE_MS,\n onResumeRejected,\n onResumeRetry,\n } = options;\n const sendCommand = useStatewireSendCommand();\n // The runs projection is memoized by the lib, so this derivation is\n // reference-stable between state updates.\n const request = useStatewireRuns().inputRequests?.find(interruptPredicate);\n const requestId = request?.id;\n\n // The host publishes the interrupts a non-resume dispatch dropped. Select\n // the raw array reference (pre-stream-safe) and derive inline; a `.find`\n // selector would return a fresh object every update.\n const abandoned = useStatewireState(readAbandonedInputRequests);\n const abandonedInterrupt = findAbandonedInterrupt(abandoned);\n\n const hitl = asHitlApproval(request?.payload);\n const actionRequests = useMemo(() => pendingActionRequests(hitl), [hitl]);\n\n const isRunning = useAthenaRunLive();\n // The host mirrors the interrupt into state as soon as a lane parks — while\n // the run manager still reports `running` (siblings streaming) and has no\n // request to answer. Raw reference selectors; derive inline.\n const mirror = useStatewireState(readInterruptMirror);\n const liveHitl =\n request === undefined && isRunning ? asHitlApproval(interruptMirrorPayload(mirror)) : null;\n const liveActionRequests = useMemo(() => pendingActionRequests(liveHitl), [liveHitl]);\n const queuedLaneDecisions =\n useStatewireState(readQueuedLaneDecisions) ?? NO_QUEUED_LANE_DECISIONS;\n\n const { pending, resume } = useApprovalResumeLock<TValue>({\n requestId,\n isRunning,\n pendingResumeGraceMs,\n onResumeRejected,\n onResumeRetry,\n // The dispatch promise is handed to the lock: a refusal releases it and\n // reaches `onResumeRejected`.\n sendResume: (id, value) =>\n sendCommand({\n type: 'run/input',\n requestId: id,\n response: { type: 'resume', value },\n }),\n });\n\n const sendLaneDecisions = useCallback(\n (lanes: Readonly<Record<string, StatewireThread.InputResponse>>) =>\n requestId !== undefined\n ? resume({ lane_decisions: lanes } as unknown as TValue)\n : sendCommand({ type: 'run/lane-input', laneDecisions: lanes }),\n [requestId, resume, sendCommand],\n );\n\n const replayQueuedLanes = useCallback(\n (id: string) => sendCommand({ type: 'run/lane-replay', requestId: id }),\n [sendCommand],\n );\n\n return {\n request,\n requestId,\n hitl,\n actionRequests,\n liveHitl,\n liveActionRequests,\n queuedLaneDecisions,\n abandonedInterrupt,\n pending,\n resume,\n sendLaneDecisions,\n replayQueuedLanes,\n };\n}\n"],"names":[],"mappings":";;;;AAuDA,MAAM,2BAA8D,OAAO,OAAO,EAAE;AA6F7E,SAAS,4BAEd,UAA8C,IAAsC;;AACpF,QAAM;AAAA,IACJ,qBAAqB;AAAA,IACrB,uBAAuB;AAAA,IACvB;AAAA,IACA;AAAA,EAAA,IACE;AACJ,QAAM,cAAc,wBAAA;AAGpB,QAAM,WAAU,sBAAA,EAAmB,kBAAnB,mBAAkC,KAAK;AACvD,QAAM,YAAY,mCAAS;AAK3B,QAAM,YAAY,kBAAkB,0BAA0B;AAC9D,QAAM,qBAAqB,uBAAuB,SAAS;AAE3D,QAAM,OAAO,eAAe,mCAAS,OAAO;AAC5C,QAAM,iBAAiB,QAAQ,MAAM,sBAAsB,IAAI,GAAG,CAAC,IAAI,CAAC;AAExE,QAAM,YAAY,iBAAA;AAIlB,QAAM,SAAS,kBAAkB,mBAAmB;AACpD,QAAM,WACJ,YAAY,UAAa,YAAY,eAAe,uBAAuB,MAAM,CAAC,IAAI;AACxF,QAAM,qBAAqB,QAAQ,MAAM,sBAAsB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AACpF,QAAM,sBACJ,kBAAkB,uBAAuB,KAAK;AAEhD,QAAM,EAAE,SAAS,OAAA,IAAW,sBAA8B;AAAA,IACxD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA,IAGA,YAAY,CAAC,IAAI,UACf,YAAY;AAAA,MACV,MAAM;AAAA,MACN,WAAW;AAAA,MACX,UAAU,EAAE,MAAM,UAAU,MAAA;AAAA,IAAM,CACnC;AAAA,EAAA,CACJ;AAED,QAAM,oBAAoB;AAAA,IACxB,CAAC,UACC,cAAc,SACV,OAAO,EAAE,gBAAgB,MAAA,CAA4B,IACrD,YAAY,EAAE,MAAM,kBAAkB,eAAe,OAAO;AAAA,IAClE,CAAC,WAAW,QAAQ,WAAW;AAAA,EAAA;AAGjC,QAAM,oBAAoB;AAAA,IACxB,CAAC,OAAe,YAAY,EAAE,MAAM,mBAAmB,WAAW,IAAI;AAAA,IACtE,CAAC,WAAW;AAAA,EAAA;AAGd,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
@@ -1,25 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const messageComponents = require("../messages/message-components.cjs");
4
+ const threadChrome = require("../messages/thread-chrome.cjs");
5
5
  const cnfast = require("cnfast");
6
6
  function ChatHeaderRoot({
7
7
  children,
8
8
  className
9
9
  }) {
10
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cnfast.cn(messageComponents.THREAD_HEADER_CLASS, className), children });
10
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cnfast.cn(threadChrome.THREAD_HEADER_CLASS, className), children });
11
11
  }
12
12
  function ChatHeaderIdentity({
13
13
  children,
14
14
  className
15
15
  }) {
16
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cnfast.cn(messageComponents.THREAD_HEADER_PILL_CLASS, className), children });
16
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cnfast.cn(threadChrome.THREAD_HEADER_PILL_CLASS, className), children });
17
17
  }
18
18
  function ChatHeaderActions({
19
19
  children,
20
20
  className
21
21
  }) {
22
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cnfast.cn(messageComponents.THREAD_HEADER_ACTIONS_CLASS, className), children });
22
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cnfast.cn(threadChrome.THREAD_HEADER_ACTIONS_CLASS, className), children });
23
23
  }
24
24
  const ChatHeader = {
25
25
  Root: ChatHeaderRoot,
@@ -1 +1 @@
1
- {"version":3,"file":"chat-header.cjs","sources":["../../../src/chat-ui/header/chat-header.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { cn } from '../../lib/utils';\nimport {\n THREAD_HEADER_ACTIONS_CLASS,\n THREAD_HEADER_CLASS,\n THREAD_HEADER_PILL_CLASS,\n} from '../messages/message-components';\n\nexport function ChatHeaderRoot({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return <div className={cn(THREAD_HEADER_CLASS, className)}>{children}</div>;\n}\n\nexport function ChatHeaderIdentity({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return <div className={cn(THREAD_HEADER_PILL_CLASS, className)}>{children}</div>;\n}\n\nexport function ChatHeaderActions({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return <div className={cn(THREAD_HEADER_ACTIONS_CLASS, className)}>{children}</div>;\n}\n\n/** Composition API keeps each host's exact action order visible at call sites. */\nexport const ChatHeader = {\n Root: ChatHeaderRoot,\n Identity: ChatHeaderIdentity,\n Actions: ChatHeaderActions,\n};\n"],"names":["cn","THREAD_HEADER_CLASS","THREAD_HEADER_PILL_CLASS","THREAD_HEADER_ACTIONS_CLASS"],"mappings":";;;;;AAQO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AACF,GAGG;AACD,wCAAQ,OAAA,EAAI,WAAWA,OAAAA,GAAGC,uCAAqB,SAAS,GAAI,UAAS;AACvE;AAEO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAGG;AACD,wCAAQ,OAAA,EAAI,WAAWD,OAAAA,GAAGE,4CAA0B,SAAS,GAAI,UAAS;AAC5E;AAEO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AACF,GAGG;AACD,wCAAQ,OAAA,EAAI,WAAWF,OAAAA,GAAGG,+CAA6B,SAAS,GAAI,UAAS;AAC/E;AAGO,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AACX;;;;;"}
1
+ {"version":3,"file":"chat-header.cjs","sources":["../../../src/chat-ui/header/chat-header.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { cn } from '../../lib/utils';\nimport {\n THREAD_HEADER_ACTIONS_CLASS,\n THREAD_HEADER_CLASS,\n THREAD_HEADER_PILL_CLASS,\n} from '../messages/thread-chrome';\n\nexport function ChatHeaderRoot({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return <div className={cn(THREAD_HEADER_CLASS, className)}>{children}</div>;\n}\n\nexport function ChatHeaderIdentity({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return <div className={cn(THREAD_HEADER_PILL_CLASS, className)}>{children}</div>;\n}\n\nexport function ChatHeaderActions({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return <div className={cn(THREAD_HEADER_ACTIONS_CLASS, className)}>{children}</div>;\n}\n\n/** Composition API keeps each host's exact action order visible at call sites. */\nexport const ChatHeader = {\n Root: ChatHeaderRoot,\n Identity: ChatHeaderIdentity,\n Actions: ChatHeaderActions,\n};\n"],"names":["cn","THREAD_HEADER_CLASS","THREAD_HEADER_PILL_CLASS","THREAD_HEADER_ACTIONS_CLASS"],"mappings":";;;;;AAQO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AACF,GAGG;AACD,wCAAQ,OAAA,EAAI,WAAWA,OAAAA,GAAGC,kCAAqB,SAAS,GAAI,UAAS;AACvE;AAEO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAGG;AACD,wCAAQ,OAAA,EAAI,WAAWD,OAAAA,GAAGE,uCAA0B,SAAS,GAAI,UAAS;AAC5E;AAEO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AACF,GAGG;AACD,wCAAQ,OAAA,EAAI,WAAWF,OAAAA,GAAGG,0CAA6B,SAAS,GAAI,UAAS;AAC/E;AAGO,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AACX;;;;;"}
@@ -2,15 +2,15 @@ import type { ReactNode } from 'react';
2
2
  export declare function ChatHeaderRoot({ children, className, }: {
3
3
  children: ReactNode;
4
4
  className?: string;
5
- }): import("react/jsx-runtime").JSX.Element;
5
+ }): import("react").JSX.Element;
6
6
  export declare function ChatHeaderIdentity({ children, className, }: {
7
7
  children: ReactNode;
8
8
  className?: string;
9
- }): import("react/jsx-runtime").JSX.Element;
9
+ }): import("react").JSX.Element;
10
10
  export declare function ChatHeaderActions({ children, className, }: {
11
11
  children: ReactNode;
12
12
  className?: string;
13
- }): import("react/jsx-runtime").JSX.Element;
13
+ }): import("react").JSX.Element;
14
14
  /** Composition API keeps each host's exact action order visible at call sites. */
15
15
  export declare const ChatHeader: {
16
16
  Root: typeof ChatHeaderRoot;
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { THREAD_HEADER_ACTIONS_CLASS, THREAD_HEADER_PILL_CLASS, THREAD_HEADER_CLASS } from "../messages/message-components.js";
2
+ import { THREAD_HEADER_ACTIONS_CLASS, THREAD_HEADER_PILL_CLASS, THREAD_HEADER_CLASS } from "../messages/thread-chrome.js";
3
3
  import { cn } from "cnfast";
4
4
  function ChatHeaderRoot({
5
5
  children,
@@ -1 +1 @@
1
- {"version":3,"file":"chat-header.js","sources":["../../../src/chat-ui/header/chat-header.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { cn } from '../../lib/utils';\nimport {\n THREAD_HEADER_ACTIONS_CLASS,\n THREAD_HEADER_CLASS,\n THREAD_HEADER_PILL_CLASS,\n} from '../messages/message-components';\n\nexport function ChatHeaderRoot({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return <div className={cn(THREAD_HEADER_CLASS, className)}>{children}</div>;\n}\n\nexport function ChatHeaderIdentity({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return <div className={cn(THREAD_HEADER_PILL_CLASS, className)}>{children}</div>;\n}\n\nexport function ChatHeaderActions({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return <div className={cn(THREAD_HEADER_ACTIONS_CLASS, className)}>{children}</div>;\n}\n\n/** Composition API keeps each host's exact action order visible at call sites. */\nexport const ChatHeader = {\n Root: ChatHeaderRoot,\n Identity: ChatHeaderIdentity,\n Actions: ChatHeaderActions,\n};\n"],"names":[],"mappings":";;;AAQO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AACF,GAGG;AACD,6BAAQ,OAAA,EAAI,WAAW,GAAG,qBAAqB,SAAS,GAAI,UAAS;AACvE;AAEO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAGG;AACD,6BAAQ,OAAA,EAAI,WAAW,GAAG,0BAA0B,SAAS,GAAI,UAAS;AAC5E;AAEO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AACF,GAGG;AACD,6BAAQ,OAAA,EAAI,WAAW,GAAG,6BAA6B,SAAS,GAAI,UAAS;AAC/E;AAGO,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AACX;"}
1
+ {"version":3,"file":"chat-header.js","sources":["../../../src/chat-ui/header/chat-header.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { cn } from '../../lib/utils';\nimport {\n THREAD_HEADER_ACTIONS_CLASS,\n THREAD_HEADER_CLASS,\n THREAD_HEADER_PILL_CLASS,\n} from '../messages/thread-chrome';\n\nexport function ChatHeaderRoot({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return <div className={cn(THREAD_HEADER_CLASS, className)}>{children}</div>;\n}\n\nexport function ChatHeaderIdentity({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return <div className={cn(THREAD_HEADER_PILL_CLASS, className)}>{children}</div>;\n}\n\nexport function ChatHeaderActions({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return <div className={cn(THREAD_HEADER_ACTIONS_CLASS, className)}>{children}</div>;\n}\n\n/** Composition API keeps each host's exact action order visible at call sites. */\nexport const ChatHeader = {\n Root: ChatHeaderRoot,\n Identity: ChatHeaderIdentity,\n Actions: ChatHeaderActions,\n};\n"],"names":[],"mappings":";;;AAQO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AACF,GAGG;AACD,6BAAQ,OAAA,EAAI,WAAW,GAAG,qBAAqB,SAAS,GAAI,UAAS;AACvE;AAEO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAGG;AACD,6BAAQ,OAAA,EAAI,WAAW,GAAG,0BAA0B,SAAS,GAAI,UAAS;AAC5E;AAEO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AACF,GAGG;AACD,6BAAQ,OAAA,EAAI,WAAW,GAAG,6BAA6B,SAAS,GAAI,UAAS;AAC/E;AAGO,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AACX;"}
@@ -34,4 +34,4 @@ export interface ConversationHistoryPanelProps {
34
34
  /** Dwell before a hover counts as intent; a pass-through never fires. */
35
35
  hoverIntentDelayMs?: number;
36
36
  }
37
- export declare function ConversationHistoryPanel({ conversations, activeThreadId, search, onSearchChange, activityFilter, onActivityFilterChange, originFilter, onOriginFilterChange, onSelect, onNewChat, onRefresh, onArchive, onSetReadState, isLoading, isRefreshing, hasNextPage, isFetchingNextPage, onLoadMore, onHoverIntent, onHoverIntentEnd, hoverIntentDelayMs, }: ConversationHistoryPanelProps): import("react/jsx-runtime").JSX.Element;
37
+ export declare function ConversationHistoryPanel({ conversations, activeThreadId, search, onSearchChange, activityFilter, onActivityFilterChange, originFilter, onOriginFilterChange, onSelect, onNewChat, onRefresh, onArchive, onSetReadState, isLoading, isRefreshing, hasNextPage, isFetchingNextPage, onLoadMore, onHoverIntent, onHoverIntentEnd, hoverIntentDelayMs, }: ConversationHistoryPanelProps): import("react").JSX.Element;
@@ -25,6 +25,7 @@ const assetTypeIcons = require("./mentions/suggestions/data/sources/asset-type-i
25
25
  const types = require("./mentions/suggestions/data/types.cjs");
26
26
  const assetUrls = require("./lib/asset-urls.cjs");
27
27
  const messageComponents = require("./messages/message-components.cjs");
28
+ const threadChrome = require("./messages/thread-chrome.cjs");
28
29
  const userEditComposer = require("./messages/user-edit-composer.cjs");
29
30
  const messageActionsConfig = require("./messages/message-actions-config.cjs");
30
31
  const runningIndicator = require("./messages/running-indicator.cjs");
@@ -98,17 +99,17 @@ exports.COMPOSER_SURFACE_CLASS = messageComponents.COMPOSER_SURFACE_CLASS;
98
99
  exports.COMPOSER_TOOLBAR_CLASS = messageComponents.COMPOSER_TOOLBAR_CLASS;
99
100
  exports.ComposerSendButton = messageComponents.ComposerSendButton;
100
101
  exports.ComposerStopButton = messageComponents.ComposerStopButton;
101
- exports.IconButton = messageComponents.IconButton;
102
102
  exports.MarkdownText = messageComponents.MarkdownText;
103
- exports.SmallIconButton = messageComponents.SmallIconButton;
104
- exports.THREAD_HEADER_ACTIONS_CLASS = messageComponents.THREAD_HEADER_ACTIONS_CLASS;
105
- exports.THREAD_HEADER_CLASS = messageComponents.THREAD_HEADER_CLASS;
106
- exports.THREAD_HEADER_ICON_CLASS = messageComponents.THREAD_HEADER_ICON_CLASS;
107
- exports.THREAD_HEADER_PILL_CLASS = messageComponents.THREAD_HEADER_PILL_CLASS;
108
- exports.THREAD_PANEL_CLASS = messageComponents.THREAD_PANEL_CLASS;
109
103
  exports.THREAD_SCROLL_TO_BOTTOM_CLASS = messageComponents.THREAD_SCROLL_TO_BOTTOM_CLASS;
110
104
  exports.UserMessage = messageComponents.UserMessage;
111
105
  exports.createAssistantMessage = messageComponents.createAssistantMessage;
106
+ exports.IconButton = threadChrome.IconButton;
107
+ exports.SmallIconButton = threadChrome.SmallIconButton;
108
+ exports.THREAD_HEADER_ACTIONS_CLASS = threadChrome.THREAD_HEADER_ACTIONS_CLASS;
109
+ exports.THREAD_HEADER_CLASS = threadChrome.THREAD_HEADER_CLASS;
110
+ exports.THREAD_HEADER_ICON_CLASS = threadChrome.THREAD_HEADER_ICON_CLASS;
111
+ exports.THREAD_HEADER_PILL_CLASS = threadChrome.THREAD_HEADER_PILL_CLASS;
112
+ exports.THREAD_PANEL_CLASS = threadChrome.THREAD_PANEL_CLASS;
112
113
  exports.UserEditComposer = userEditComposer.UserEditComposer;
113
114
  exports.MessageActionsReadOnlyProvider = messageActionsConfig.MessageActionsReadOnlyProvider;
114
115
  exports.useMessageActionsReadOnly = messageActionsConfig.useMessageActionsReadOnly;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -34,7 +34,8 @@ export { buildRootMenuItems } from "./mentions/suggestions/data/sources";
34
34
  export { assetTypeToIcon, assetTypeToThumb, configureAssetIconBasePath, } from "./mentions/suggestions/data/sources/asset-type-icons";
35
35
  export { MentionMenuSection, type MentionTool, type MenuItem, type MenuScope, type WebpageMention, type WebpageMentionScope, } from "./mentions/suggestions/data/types";
36
36
  export { createOlympusAssetUrl } from "./lib/asset-urls";
37
- export { COMPOSER_DOCK_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_PAPER_DOCK_CLASS, COMPOSER_PAPER_EDITOR_ROW_CLASS, COMPOSER_PAPER_SURFACE_CLASS, COMPOSER_PAPER_TOOLBAR_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_TOOLBAR_CLASS, BranchPicker, ComposerSendButton, ComposerStopButton, type ComposerSendButtonProps, type ComposerStopButtonProps, IconButton, MarkdownText, SmallIconButton, THREAD_HEADER_ACTIONS_CLASS, THREAD_HEADER_CLASS, THREAD_HEADER_ICON_CLASS, THREAD_HEADER_PILL_CLASS, THREAD_PANEL_CLASS, THREAD_SCROLL_TO_BOTTOM_CLASS, UserMessage, createAssistantMessage, type CreateAssistantMessageOptions, } from "./messages/message-components";
37
+ export { COMPOSER_DOCK_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_PAPER_DOCK_CLASS, COMPOSER_PAPER_EDITOR_ROW_CLASS, COMPOSER_PAPER_SURFACE_CLASS, COMPOSER_PAPER_TOOLBAR_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_TOOLBAR_CLASS, BranchPicker, ComposerSendButton, ComposerStopButton, type ComposerSendButtonProps, type ComposerStopButtonProps, MarkdownText, THREAD_SCROLL_TO_BOTTOM_CLASS, UserMessage, createAssistantMessage, type CreateAssistantMessageOptions, } from "./messages/message-components";
38
+ export { IconButton, SmallIconButton, THREAD_HEADER_ACTIONS_CLASS, THREAD_HEADER_CLASS, THREAD_HEADER_ICON_CLASS, THREAD_HEADER_PILL_CLASS, THREAD_PANEL_CLASS, } from "./messages/thread-chrome";
38
39
  export { UserEditComposer } from "./messages/user-edit-composer";
39
40
  export { MessageActionsReadOnlyProvider, useMessageActionsReadOnly, } from "./messages/message-actions-config";
40
41
  export { TextShimmerLoader, ThreadRunningIndicator, } from "./messages/running-indicator";
@@ -22,7 +22,8 @@ import { buildRootMenuItems } from "./mentions/suggestions/data/sources/index.js
22
22
  import { assetTypeToIcon, assetTypeToThumb, configureAssetIconBasePath } from "./mentions/suggestions/data/sources/asset-type-icons.js";
23
23
  import { MentionMenuSection } from "./mentions/suggestions/data/types.js";
24
24
  import { createOlympusAssetUrl } from "./lib/asset-urls.js";
25
- import { BranchPicker, COMPOSER_DOCK_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_PAPER_DOCK_CLASS, COMPOSER_PAPER_EDITOR_ROW_CLASS, COMPOSER_PAPER_SURFACE_CLASS, COMPOSER_PAPER_TOOLBAR_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_TOOLBAR_CLASS, ComposerSendButton, ComposerStopButton, IconButton, MarkdownText, SmallIconButton, THREAD_HEADER_ACTIONS_CLASS, THREAD_HEADER_CLASS, THREAD_HEADER_ICON_CLASS, THREAD_HEADER_PILL_CLASS, THREAD_PANEL_CLASS, THREAD_SCROLL_TO_BOTTOM_CLASS, UserMessage, createAssistantMessage } from "./messages/message-components.js";
25
+ import { BranchPicker, COMPOSER_DOCK_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_PAPER_DOCK_CLASS, COMPOSER_PAPER_EDITOR_ROW_CLASS, COMPOSER_PAPER_SURFACE_CLASS, COMPOSER_PAPER_TOOLBAR_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_TOOLBAR_CLASS, ComposerSendButton, ComposerStopButton, MarkdownText, THREAD_SCROLL_TO_BOTTOM_CLASS, UserMessage, createAssistantMessage } from "./messages/message-components.js";
26
+ import { IconButton, SmallIconButton, THREAD_HEADER_ACTIONS_CLASS, THREAD_HEADER_CLASS, THREAD_HEADER_ICON_CLASS, THREAD_HEADER_PILL_CLASS, THREAD_PANEL_CLASS } from "./messages/thread-chrome.js";
26
27
  import { UserEditComposer } from "./messages/user-edit-composer.js";
27
28
  import { MessageActionsReadOnlyProvider, useMessageActionsReadOnly } from "./messages/message-actions-config.js";
28
29
  import { TextShimmerLoader, ThreadRunningIndicator } from "./messages/running-indicator.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  function isMarkdownStorage(value) {
4
4
  if (typeof value !== "object" || value === null) return false;
5
+ const options = Reflect.get(value, "options");
5
6
  const parser = Reflect.get(value, "parser");
6
- return typeof Reflect.get(value, "getMarkdown") === "function" && typeof parser === "object" && parser !== null && typeof Reflect.get(parser, "parse") === "function";
7
+ return typeof options === "object" && options !== null && typeof Reflect.get(options, "html") === "boolean" && typeof Reflect.get(value, "getMarkdown") === "function" && typeof parser === "object" && parser !== null && typeof Reflect.get(parser, "parse") === "function";
7
8
  }
8
9
  function getMarkdownStorage(editor) {
9
10
  const storage = Reflect.get(editor.storage, "markdown");
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-storage.cjs","sources":["../../src/chat-ui/markdown-storage.ts"],"sourcesContent":["import type { Editor } from \"@tiptap/core\";\nimport type { Node as ProseMirrorNode } from \"@tiptap/pm/model\";\n\n/**\n * What tiptap-markdown keeps in `editor.storage.markdown`. Its own typings only\n * declare `getMarkdown()`, and Tiptap 3 types `editor.storage` as an interface\n * that extensions must augment; the SDK reads the storage through this guard\n * instead of augmenting `@tiptap/core` for every consumer of the package.\n */\nexport interface MarkdownStorage {\n getMarkdown(): string;\n parser: { parse(markdown: string, options?: { inline?: boolean }): string };\n serializer: { serialize(content: ProseMirrorNode): string };\n}\n\nfunction isMarkdownStorage(value: unknown): value is MarkdownStorage {\n if (typeof value !== \"object\" || value === null) return false;\n const parser: unknown = Reflect.get(value, \"parser\");\n return (\n typeof Reflect.get(value, \"getMarkdown\") === \"function\" &&\n typeof parser === \"object\" &&\n parser !== null &&\n typeof Reflect.get(parser, \"parse\") === \"function\"\n );\n}\n\n/** The editor's tiptap-markdown storage; throws when the Markdown extension is not registered. */\nexport function getMarkdownStorage(editor: Editor): MarkdownStorage {\n const storage: unknown = Reflect.get(editor.storage, \"markdown\");\n if (!isMarkdownStorage(storage)) {\n throw new Error(\"tiptap-markdown is not registered on this editor\");\n }\n return storage;\n}\n"],"names":[],"mappings":";;AAeA,SAAS,kBAAkB,OAA0C;AACnE,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,SAAkB,QAAQ,IAAI,OAAO,QAAQ;AACnD,SACE,OAAO,QAAQ,IAAI,OAAO,aAAa,MAAM,cAC7C,OAAO,WAAW,YAClB,WAAW,QACX,OAAO,QAAQ,IAAI,QAAQ,OAAO,MAAM;AAE5C;AAGO,SAAS,mBAAmB,QAAiC;AAClE,QAAM,UAAmB,QAAQ,IAAI,OAAO,SAAS,UAAU;AAC/D,MAAI,CAAC,kBAAkB,OAAO,GAAG;AAC/B,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,SAAO;AACT;;"}
1
+ {"version":3,"file":"markdown-storage.cjs","sources":["../../src/chat-ui/markdown-storage.ts"],"sourcesContent":["import type { Editor } from \"@tiptap/core\";\nimport type { Node as ProseMirrorNode } from \"@tiptap/pm/model\";\n\n/**\n * What tiptap-markdown keeps in `editor.storage.markdown`. Its own typings only\n * declare `getMarkdown()`, and Tiptap 3 types `editor.storage` as an interface\n * that extensions must augment; the SDK reads the storage through this guard\n * instead of augmenting `@tiptap/core` for every consumer of the package.\n */\nexport interface MarkdownStorage {\n options: { html: boolean };\n getMarkdown(): string;\n parser: { parse(markdown: string, options?: { inline?: boolean }): string };\n serializer: { serialize(content: ProseMirrorNode): string };\n}\n\nfunction isMarkdownStorage(value: unknown): value is MarkdownStorage {\n if (typeof value !== \"object\" || value === null) return false;\n const options: unknown = Reflect.get(value, \"options\");\n const parser: unknown = Reflect.get(value, \"parser\");\n return (\n typeof options === \"object\" &&\n options !== null &&\n typeof Reflect.get(options, \"html\") === \"boolean\" &&\n typeof Reflect.get(value, \"getMarkdown\") === \"function\" &&\n typeof parser === \"object\" &&\n parser !== null &&\n typeof Reflect.get(parser, \"parse\") === \"function\"\n );\n}\n\n/** The editor's tiptap-markdown storage; throws when the Markdown extension is not registered. */\nexport function getMarkdownStorage(editor: Editor): MarkdownStorage {\n const storage: unknown = Reflect.get(editor.storage, \"markdown\");\n if (!isMarkdownStorage(storage)) {\n throw new Error(\"tiptap-markdown is not registered on this editor\");\n }\n return storage;\n}\n"],"names":[],"mappings":";;AAgBA,SAAS,kBAAkB,OAA0C;AACnE,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,UAAmB,QAAQ,IAAI,OAAO,SAAS;AACrD,QAAM,SAAkB,QAAQ,IAAI,OAAO,QAAQ;AACnD,SACE,OAAO,YAAY,YACnB,YAAY,QACZ,OAAO,QAAQ,IAAI,SAAS,MAAM,MAAM,aACxC,OAAO,QAAQ,IAAI,OAAO,aAAa,MAAM,cAC7C,OAAO,WAAW,YAClB,WAAW,QACX,OAAO,QAAQ,IAAI,QAAQ,OAAO,MAAM;AAE5C;AAGO,SAAS,mBAAmB,QAAiC;AAClE,QAAM,UAAmB,QAAQ,IAAI,OAAO,SAAS,UAAU;AAC/D,MAAI,CAAC,kBAAkB,OAAO,GAAG;AAC/B,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,SAAO;AACT;;"}
@@ -7,6 +7,9 @@ import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
7
7
  * instead of augmenting `@tiptap/core` for every consumer of the package.
8
8
  */
9
9
  export interface MarkdownStorage {
10
+ options: {
11
+ html: boolean;
12
+ };
10
13
  getMarkdown(): string;
11
14
  parser: {
12
15
  parse(markdown: string, options?: {
@@ -1,7 +1,8 @@
1
1
  function isMarkdownStorage(value) {
2
2
  if (typeof value !== "object" || value === null) return false;
3
+ const options = Reflect.get(value, "options");
3
4
  const parser = Reflect.get(value, "parser");
4
- return typeof Reflect.get(value, "getMarkdown") === "function" && typeof parser === "object" && parser !== null && typeof Reflect.get(parser, "parse") === "function";
5
+ return typeof options === "object" && options !== null && typeof Reflect.get(options, "html") === "boolean" && typeof Reflect.get(value, "getMarkdown") === "function" && typeof parser === "object" && parser !== null && typeof Reflect.get(parser, "parse") === "function";
5
6
  }
6
7
  function getMarkdownStorage(editor) {
7
8
  const storage = Reflect.get(editor.storage, "markdown");
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-storage.js","sources":["../../src/chat-ui/markdown-storage.ts"],"sourcesContent":["import type { Editor } from \"@tiptap/core\";\nimport type { Node as ProseMirrorNode } from \"@tiptap/pm/model\";\n\n/**\n * What tiptap-markdown keeps in `editor.storage.markdown`. Its own typings only\n * declare `getMarkdown()`, and Tiptap 3 types `editor.storage` as an interface\n * that extensions must augment; the SDK reads the storage through this guard\n * instead of augmenting `@tiptap/core` for every consumer of the package.\n */\nexport interface MarkdownStorage {\n getMarkdown(): string;\n parser: { parse(markdown: string, options?: { inline?: boolean }): string };\n serializer: { serialize(content: ProseMirrorNode): string };\n}\n\nfunction isMarkdownStorage(value: unknown): value is MarkdownStorage {\n if (typeof value !== \"object\" || value === null) return false;\n const parser: unknown = Reflect.get(value, \"parser\");\n return (\n typeof Reflect.get(value, \"getMarkdown\") === \"function\" &&\n typeof parser === \"object\" &&\n parser !== null &&\n typeof Reflect.get(parser, \"parse\") === \"function\"\n );\n}\n\n/** The editor's tiptap-markdown storage; throws when the Markdown extension is not registered. */\nexport function getMarkdownStorage(editor: Editor): MarkdownStorage {\n const storage: unknown = Reflect.get(editor.storage, \"markdown\");\n if (!isMarkdownStorage(storage)) {\n throw new Error(\"tiptap-markdown is not registered on this editor\");\n }\n return storage;\n}\n"],"names":[],"mappings":"AAeA,SAAS,kBAAkB,OAA0C;AACnE,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,SAAkB,QAAQ,IAAI,OAAO,QAAQ;AACnD,SACE,OAAO,QAAQ,IAAI,OAAO,aAAa,MAAM,cAC7C,OAAO,WAAW,YAClB,WAAW,QACX,OAAO,QAAQ,IAAI,QAAQ,OAAO,MAAM;AAE5C;AAGO,SAAS,mBAAmB,QAAiC;AAClE,QAAM,UAAmB,QAAQ,IAAI,OAAO,SAAS,UAAU;AAC/D,MAAI,CAAC,kBAAkB,OAAO,GAAG;AAC/B,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,SAAO;AACT;"}
1
+ {"version":3,"file":"markdown-storage.js","sources":["../../src/chat-ui/markdown-storage.ts"],"sourcesContent":["import type { Editor } from \"@tiptap/core\";\nimport type { Node as ProseMirrorNode } from \"@tiptap/pm/model\";\n\n/**\n * What tiptap-markdown keeps in `editor.storage.markdown`. Its own typings only\n * declare `getMarkdown()`, and Tiptap 3 types `editor.storage` as an interface\n * that extensions must augment; the SDK reads the storage through this guard\n * instead of augmenting `@tiptap/core` for every consumer of the package.\n */\nexport interface MarkdownStorage {\n options: { html: boolean };\n getMarkdown(): string;\n parser: { parse(markdown: string, options?: { inline?: boolean }): string };\n serializer: { serialize(content: ProseMirrorNode): string };\n}\n\nfunction isMarkdownStorage(value: unknown): value is MarkdownStorage {\n if (typeof value !== \"object\" || value === null) return false;\n const options: unknown = Reflect.get(value, \"options\");\n const parser: unknown = Reflect.get(value, \"parser\");\n return (\n typeof options === \"object\" &&\n options !== null &&\n typeof Reflect.get(options, \"html\") === \"boolean\" &&\n typeof Reflect.get(value, \"getMarkdown\") === \"function\" &&\n typeof parser === \"object\" &&\n parser !== null &&\n typeof Reflect.get(parser, \"parse\") === \"function\"\n );\n}\n\n/** The editor's tiptap-markdown storage; throws when the Markdown extension is not registered. */\nexport function getMarkdownStorage(editor: Editor): MarkdownStorage {\n const storage: unknown = Reflect.get(editor.storage, \"markdown\");\n if (!isMarkdownStorage(storage)) {\n throw new Error(\"tiptap-markdown is not registered on this editor\");\n }\n return storage;\n}\n"],"names":[],"mappings":"AAgBA,SAAS,kBAAkB,OAA0C;AACnE,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,UAAmB,QAAQ,IAAI,OAAO,SAAS;AACrD,QAAM,SAAkB,QAAQ,IAAI,OAAO,QAAQ;AACnD,SACE,OAAO,YAAY,YACnB,YAAY,QACZ,OAAO,QAAQ,IAAI,SAAS,MAAM,MAAM,aACxC,OAAO,QAAQ,IAAI,OAAO,aAAa,MAAM,cAC7C,OAAO,WAAW,YAClB,WAAW,QACX,OAAO,QAAQ,IAAI,QAAQ,OAAO,MAAM;AAE5C;AAGO,SAAS,mBAAmB,QAAiC;AAClE,QAAM,UAAmB,QAAQ,IAAI,OAAO,SAAS,UAAU;AAC/D,MAAI,CAAC,kBAAkB,OAAO,GAAG;AAC/B,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,SAAO;AACT;"}
@@ -256,9 +256,15 @@ function parseMentionsInText(text) {
256
256
  }
257
257
  return parts.length > 0 ? parts : [text];
258
258
  }
259
+ function mentionsToPlainText(text) {
260
+ return text.replace(MENTION_RE, (_match, name, url) => {
261
+ return `@${name || parseMentionUrl(url).name}`;
262
+ });
263
+ }
259
264
  exports.MentionChip = MentionChip;
260
265
  exports.MentionLink = MentionLink;
261
266
  exports.ScreenPointChip = ScreenPointChip;
267
+ exports.mentionsToPlainText = mentionsToPlainText;
262
268
  exports.normalizeAthenaMentionHtml = normalizeAthenaMentionHtml;
263
269
  exports.parseMentionUrl = parseMentionUrl;
264
270
  exports.parseMentionsInText = parseMentionsInText;
@@ -1 +1 @@
1
- {"version":3,"file":"mention-chip.cjs","sources":["../../../src/chat-ui/mentions/mention-chip.tsx"],"sourcesContent":["/**\n * Mention chip rendering for message display.\n *\n * Parses [@name](mention://type?...) markdown links and renders them\n * as styled inline chips matching the Olympus mention style.\n * Used in both user messages (inline text) and assistant messages (markdown links).\n */\n\nimport { useContext, type FC, type ReactElement, type ReactNode } from \"react\";\nimport {\n formatScreenPoint,\n isScreenPointHref,\n parseScreenPointHref,\n} from \"@athenaintel/agent-runtime\";\nimport { CrosshairIcon, Globe2Icon } from \"lucide-react\";\nimport { cn } from \"../../lib/utils\";\nimport { createOlympusAssetUrl } from \"../lib/asset-urls\";\nimport { MentionAuthCtx } from \"./suggestions/data/api-client\";\nimport { assetTypeToThumb } from \"./suggestions/data/sources/asset-type-icons\";\n\nconst SPACES_MENTION_PATH = /\\/dashboard\\/spaces\\/?\\?/;\n\nfunction isSpacesMentionUrl(url: string): boolean {\n return SPACES_MENTION_PATH.test(url);\n}\n\nfunction getSpacesAssetType(url: URL): string | null {\n const assetType =\n url.searchParams.get(\"assetType\") ||\n url.searchParams.get(\"asset_type\") ||\n url.searchParams.get(\"type\");\n return assetType === \"sheet\" ? \"spreadsheet\" : assetType;\n}\n\n// ── Mention link component for markdown renderer ──\n\n/**\n * Custom <a> renderer for MarkdownTextPrimitive.\n * Intercepts mention:// links and renders them as chips.\n * Falls through to a normal link for non-mention URLs.\n */\nexport const MentionLink: FC<{\n href?: string;\n children?: ReactNode;\n interactive?: boolean;\n}> = ({ href, children, interactive = true }) => {\n if (\n href &&\n (href.startsWith(\"mention://\") || isSpacesMentionUrl(href))\n ) {\n const name = typeof children === \"string\"\n ? children.replace(/^@/, \"\")\n : Array.isArray(children)\n ? String(children[0] ?? \"\").replace(/^@/, \"\")\n : \"\";\n\n const parsed = parseMentionUrl(href);\n\n return (\n <MentionChip\n name={name || parsed.name}\n type={parsed.type}\n assetIds={parsed.assetIds}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(href) ? href : undefined}\n interactive={interactive}\n />\n );\n }\n\n if (href?.startsWith(\"chrome-extension://\")) {\n return <span>{children}</span>;\n }\n\n if (isScreenPointHref(href)) {\n return <ScreenPointChip href={href}>{children}</ScreenPointChip>;\n }\n\n // Normal link — render as-is\n return (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n};\n\n// ── Inline screen-point chip ──\n\n/**\n * Renders an `athena-point://` link as a non-navigating coordinate chip.\n * Surfaces without screenshot context (extension side panel, SDK consumers)\n * get the label plus the coordinates; malformed points fall back to text.\n */\nexport const ScreenPointChip: FC<{\n href: string;\n children?: ReactNode;\n}> = ({ href, children }) => {\n const parsed = parseScreenPointHref(href);\n if (!parsed.ok) {\n return <span>{children}</span>;\n }\n const description = formatScreenPoint(parsed.point);\n return (\n <span\n className=\"not-prose inline-flex max-w-[260px] items-center gap-1 whitespace-nowrap rounded-md border border-slate-300 bg-white px-1.5 py-px align-middle text-[0.85em] font-medium leading-[1.4] text-slate-600\"\n title={description}\n aria-label={description}\n data-screen-point=\"valid\"\n >\n <CrosshairIcon className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n <span className=\"max-w-[180px] overflow-hidden text-ellipsis\">\n {children}\n </span>\n <span className=\"font-normal text-slate-400\">\n {parsed.point.x}, {parsed.point.y}\n </span>\n </span>\n );\n};\n\n// ── Inline mention chip ──\n\nexport const MentionChip: FC<{\n name: string;\n type?: string;\n assetIds?: string[];\n thumbnailUrl?: string;\n sourceHref?: string;\n interactive?: boolean;\n}> = ({ name, type, assetIds, thumbnailUrl, sourceHref, interactive = true }) => {\n const auth = useContext(MentionAuthCtx);\n // A citation's excerpt (the passage the chip points at) is the tooltip; the\n // accessible name stays the action.\n const excerpt = sourceHref ? readSourceExcerpt(sourceHref) : null;\n const assetRootHref =\n type === \"asset\" && assetIds?.length\n ? createOlympusAssetUrl({\n appUrl: auth?.appUrl,\n backendUrl: auth?.backendUrl,\n assetIds,\n })\n : null;\n const href = (() => {\n if (!assetRootHref || !sourceHref) return assetRootHref;\n try {\n const source = new URL(sourceHref, \"https://app.athenaintel.com\");\n const destination = new URL(assetRootHref);\n for (const [key, value] of source.searchParams) {\n destination.searchParams.set(key, value);\n }\n destination.searchParams.set(\"asset_ids\", assetIds?.join(\",\") ?? \"\");\n return destination.toString();\n } catch {\n return assetRootHref;\n }\n })();\n // `not-prose` matters: assistant messages render inside Tailwind\n // Typography's `prose`, whose zero-specificity `img` margins (~1.7em\n // top/bottom) would otherwise inflate the chip's icon into a tall card\n // that breaks the sentence flow around it.\n const className = cn(\n \"not-prose inline-flex max-w-[220px] items-center gap-1 whitespace-nowrap rounded-md border border-slate-300 bg-white px-1.5 py-px align-middle text-[0.85em] font-medium leading-[1.4] text-slate-600 no-underline\",\n href &&\n \"cursor-pointer transition-colors hover:border-slate-400 hover:bg-slate-50 hover:text-slate-800 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1\",\n );\n const contents = (\n <>\n {thumbnailUrl && (\n <img\n src={thumbnailUrl}\n alt=\"\"\n className=\"size-3.5 shrink-0\"\n draggable={false}\n />\n )}\n {!thumbnailUrl && type === \"webpage\" && (\n <Globe2Icon className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n )}\n <span className=\"max-w-[180px] overflow-hidden text-ellipsis\">\n {name}\n </span>\n </>\n );\n\n if (href && interactive) {\n return (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={className}\n aria-label={`Open ${name} in Spaces`}\n title={excerpt ?? `Open ${name} in Spaces`}\n data-excerpt={excerpt ?? undefined}\n >\n {contents}\n </a>\n );\n }\n\n return (\n <span\n className={className}\n title={excerpt ?? undefined}\n data-excerpt={excerpt ?? undefined}\n >\n {contents}\n </span>\n );\n};\n\n/** The `excerpt` a Spaces citation URL carries, or null. */\nfunction readSourceExcerpt(href: string): string | null {\n try {\n const excerpt = new URL(href, \"https://app.athenaintel.com\").searchParams\n .get(\"excerpt\")\n ?.trim();\n return excerpt ? excerpt : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The label an asset citation chip falls back to when the model wrote none\n * (`[](…/spaces/?asset_ids=…&page=5)`): the cited location, else \"Asset\" — a\n * chip must never render as an empty box.\n */\nfunction citationFallbackLabel(params: URLSearchParams): string {\n const start = params.get(\"start_page\") ?? params.get(\"page\");\n const end = params.get(\"end_page\");\n if (start && end && end !== start) return `Pages ${start}–${end}`;\n if (start) return `Page ${start}`;\n return \"Asset\";\n}\n\n// ── Parse mention:// URLs ──\n\nexport function parseMentionUrl(url: string): {\n type: string;\n name: string;\n id: string;\n assetIds?: string[];\n thumbnailUrl?: string;\n} {\n try {\n if (isSpacesMentionUrl(url)) {\n const parsed = new URL(url, \"https://app.athenaintel.com\");\n const assetIds = (parsed.searchParams.get(\"asset_ids\") ?? \"\")\n .split(\",\")\n .map((id) => id.trim())\n .filter(Boolean);\n const id = assetIds[0] ?? \"\";\n const assetType = getSpacesAssetType(parsed);\n return {\n type: \"asset\",\n name:\n assetIds.length > 1\n ? `${assetIds.length} assets`\n : citationFallbackLabel(parsed.searchParams),\n id,\n assetIds,\n thumbnailUrl: assetTypeToThumb(assetType),\n };\n }\n // mention://tool?name=...&description=...\n // mention://asset?id=...&assetType=project&thumb=../icons/files/ic-project.svg\n const u = new URL(url);\n const type = u.hostname || u.pathname.replace(/^\\/\\//, \"\").split(\"?\")[0];\n const isWebpage = type === \"webpage\";\n const id = isWebpage\n ? u.searchParams.get(\"tab_id\") || \"\"\n : u.searchParams.get(\"id\") || u.searchParams.get(\"name\") || \"\";\n const name = isWebpage\n ? u.searchParams.get(\"title\") || \"This webpage\"\n : u.searchParams.get(\"name\") || id;\n\n // Get thumbnail: prefer explicit thumb param, then derive from assetType\n let thumbnailUrl = u.searchParams.get(\"thumb\") || undefined;\n if (!thumbnailUrl) {\n const assetType = u.searchParams.get(\"assetType\");\n if (assetType) {\n thumbnailUrl = assetTypeToThumb(assetType);\n } else if (type === \"asset\" || type === \"folder\") {\n thumbnailUrl = assetTypeToThumb(type === \"folder\" ? \"folder\" : null);\n }\n }\n\n return {\n type,\n name,\n id,\n assetIds: type === \"asset\" && id ? [id] : undefined,\n thumbnailUrl,\n };\n } catch {\n return { type: \"unknown\", name: \"\", id: \"\" };\n }\n}\n\nfunction htmlAttribute(attributes: string, name: string): string | null {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const match = new RegExp(\n `(?:^|\\\\s)${escapedName}\\\\s*=\\\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\\\s>]+))`,\n \"i\",\n ).exec(attributes);\n return match?.[1] ?? match?.[2] ?? match?.[3] ?? null;\n}\n\nfunction decodeHtmlAttribute(value: string): string {\n return value\n .replace(/&amp;/gi, \"&\")\n .replace(/&quot;/gi, '\"')\n .replace(/&#39;|&apos;/gi, \"'\")\n .replace(/&lt;/gi, \"<\")\n .replace(/&gt;/gi, \">\");\n}\n\n/** Turn complete model-emitted URL citation anchors into safe Markdown links. */\nexport function normalizeAthenaMentionHtml(text: string): string {\n return text.replace(\n /<a\\b([^>]*)>([\\s\\S]*?)<\\/a>/gi,\n (original, attributes: string, rawLabel: string) => {\n const className = htmlAttribute(attributes, \"class\") ?? \"\";\n const type = htmlAttribute(attributes, \"data-type\") ?? \"\";\n if (!className.split(/\\s+/).includes(\"mention\") || type !== \"url\") {\n return original;\n }\n\n const rawUrl =\n htmlAttribute(attributes, \"data-url\") ??\n htmlAttribute(attributes, \"href\");\n if (!rawUrl) return original;\n const url = decodeHtmlAttribute(rawUrl);\n let normalizedUrl: string;\n try {\n const parsed = new URL(url);\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return original;\n }\n normalizedUrl = parsed.toString();\n } catch {\n return original;\n }\n\n const label = decodeHtmlAttribute(rawLabel.replace(/<[^>]*>/g, \"\"))\n .trim()\n .replace(/([\\\\[\\]])/g, \"\\\\$1\");\n return label ? `[${label}](<${normalizedUrl}>)` : original;\n },\n );\n}\n// ── Parse mention markdown in plain text ──\n\nconst MENTION_RE =\n /\\[@([^\\]]*)\\]\\(((?:mention:\\/\\/|(?:https?:\\/\\/[^)\\s]+)?\\/dashboard\\/spaces\\/?\\?)[^)]+)\\)/g;\n\n/**\n * Parse text containing [@name](mention://...) patterns into\n * an array of string segments and MentionChip elements.\n */\nexport function parseMentionsInText(text: string): (string | ReactElement)[] {\n const parts: (string | ReactElement)[] = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n MENTION_RE.lastIndex = 0;\n\n while ((match = MENTION_RE.exec(text)) !== null) {\n if (match.index > lastIndex) {\n parts.push(text.slice(lastIndex, match.index));\n }\n\n const name = match[1];\n const url = match[2];\n const parsed = parseMentionUrl(url);\n\n parts.push(\n <MentionChip\n key={`mention-${match.index}`}\n name={name || parsed.name}\n type={parsed.type}\n assetIds={parsed.assetIds}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(url) ? url : undefined}\n />\n );\n\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < text.length) {\n parts.push(text.slice(lastIndex));\n }\n\n return parts.length > 0 ? parts : [text];\n}\n"],"names":["jsx","isScreenPointHref","parseScreenPointHref","formatScreenPoint","jsxs","CrosshairIcon","useContext","MentionAuthCtx","createOlympusAssetUrl","cn","Fragment","Globe2Icon","id","assetTypeToThumb"],"mappings":";;;;;;;;;;AAoBA,MAAM,sBAAsB;AAE5B,SAAS,mBAAmB,KAAsB;AAChD,SAAO,oBAAoB,KAAK,GAAG;AACrC;AAEA,SAAS,mBAAmB,KAAyB;AACnD,QAAM,YACJ,IAAI,aAAa,IAAI,WAAW,KAChC,IAAI,aAAa,IAAI,YAAY,KACjC,IAAI,aAAa,IAAI,MAAM;AAC7B,SAAO,cAAc,UAAU,gBAAgB;AACjD;AASO,MAAM,cAIR,CAAC,EAAE,MAAM,UAAU,cAAc,WAAW;AAC/C,MACE,SACC,KAAK,WAAW,YAAY,KAAK,mBAAmB,IAAI,IACzD;AACA,UAAM,OAAO,OAAO,aAAa,WAC7B,SAAS,QAAQ,MAAM,EAAE,IACzB,MAAM,QAAQ,QAAQ,IACpB,OAAO,SAAS,CAAC,KAAK,EAAE,EAAE,QAAQ,MAAM,EAAE,IAC1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AA,MACJb,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UAEC,MAAM,QAAQ,OAAO;AAAA,UACrB,MAAM,OAAO;AAAA,UACb,UAAU,OAAO;AAAA,UACjB,cAAc,OAAO;AAAA,UACrB,YAAY,mBAAmB,GAAG,IAAI,MAAM;AAAA,QAAA;AAAA,QALvC,WAAW,MAAM,KAAK;AAAA,MAAA;AAAA,IAM7B;AAGF,gBAAY,MAAM,QAAQ,MAAM,CAAC,EAAE;AAAA,EACrC;AAEA,MAAI,YAAY,KAAK,QAAQ;AAC3B,UAAM,KAAK,KAAK,MAAM,SAAS,CAAC;AAAA,EAClC;AAEA,SAAO,MAAM,SAAS,IAAI,QAAQ,CAAC,IAAI;AACzC;;;;;;;"}
1
+ {"version":3,"file":"mention-chip.cjs","sources":["../../../src/chat-ui/mentions/mention-chip.tsx"],"sourcesContent":["/**\n * Mention chip rendering for message display.\n *\n * Parses [@name](mention://type?...) markdown links and renders them\n * as styled inline chips matching the Olympus mention style.\n * Used in both user messages (inline text) and assistant messages (markdown links).\n */\n\nimport { useContext, type FC, type ReactElement, type ReactNode } from \"react\";\nimport {\n formatScreenPoint,\n isScreenPointHref,\n parseScreenPointHref,\n} from \"@athenaintel/agent-runtime\";\nimport { CrosshairIcon, Globe2Icon } from \"lucide-react\";\nimport { cn } from \"../../lib/utils\";\nimport { createOlympusAssetUrl } from \"../lib/asset-urls\";\nimport { MentionAuthCtx } from \"./suggestions/data/api-client\";\nimport { assetTypeToThumb } from \"./suggestions/data/sources/asset-type-icons\";\n\nconst SPACES_MENTION_PATH = /\\/dashboard\\/spaces\\/?\\?/;\n\nfunction isSpacesMentionUrl(url: string): boolean {\n return SPACES_MENTION_PATH.test(url);\n}\n\nfunction getSpacesAssetType(url: URL): string | null {\n const assetType =\n url.searchParams.get(\"assetType\") ||\n url.searchParams.get(\"asset_type\") ||\n url.searchParams.get(\"type\");\n return assetType === \"sheet\" ? \"spreadsheet\" : assetType;\n}\n\n// ── Mention link component for markdown renderer ──\n\n/**\n * Custom <a> renderer for MarkdownTextPrimitive.\n * Intercepts mention:// links and renders them as chips.\n * Falls through to a normal link for non-mention URLs.\n */\nexport const MentionLink: FC<{\n href?: string;\n children?: ReactNode;\n interactive?: boolean;\n}> = ({ href, children, interactive = true }) => {\n if (\n href &&\n (href.startsWith(\"mention://\") || isSpacesMentionUrl(href))\n ) {\n const name = typeof children === \"string\"\n ? children.replace(/^@/, \"\")\n : Array.isArray(children)\n ? String(children[0] ?? \"\").replace(/^@/, \"\")\n : \"\";\n\n const parsed = parseMentionUrl(href);\n\n return (\n <MentionChip\n name={name || parsed.name}\n type={parsed.type}\n assetIds={parsed.assetIds}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(href) ? href : undefined}\n interactive={interactive}\n />\n );\n }\n\n if (href?.startsWith(\"chrome-extension://\")) {\n return <span>{children}</span>;\n }\n\n if (isScreenPointHref(href)) {\n return <ScreenPointChip href={href}>{children}</ScreenPointChip>;\n }\n\n // Normal link — render as-is\n return (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n};\n\n// ── Inline screen-point chip ──\n\n/**\n * Renders an `athena-point://` link as a non-navigating coordinate chip.\n * Surfaces without screenshot context (extension side panel, SDK consumers)\n * get the label plus the coordinates; malformed points fall back to text.\n */\nexport const ScreenPointChip: FC<{\n href: string;\n children?: ReactNode;\n}> = ({ href, children }) => {\n const parsed = parseScreenPointHref(href);\n if (!parsed.ok) {\n return <span>{children}</span>;\n }\n const description = formatScreenPoint(parsed.point);\n return (\n <span\n className=\"not-prose inline-flex max-w-[260px] items-center gap-1 whitespace-nowrap rounded-md border border-slate-300 bg-white px-1.5 py-px align-middle text-[0.85em] font-medium leading-[1.4] text-slate-600\"\n title={description}\n aria-label={description}\n data-screen-point=\"valid\"\n >\n <CrosshairIcon className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n <span className=\"max-w-[180px] overflow-hidden text-ellipsis\">\n {children}\n </span>\n <span className=\"font-normal text-slate-400\">\n {parsed.point.x}, {parsed.point.y}\n </span>\n </span>\n );\n};\n\n// ── Inline mention chip ──\n\nexport const MentionChip: FC<{\n name: string;\n type?: string;\n assetIds?: string[];\n thumbnailUrl?: string;\n sourceHref?: string;\n interactive?: boolean;\n}> = ({ name, type, assetIds, thumbnailUrl, sourceHref, interactive = true }) => {\n const auth = useContext(MentionAuthCtx);\n // A citation's excerpt (the passage the chip points at) is the tooltip; the\n // accessible name stays the action.\n const excerpt = sourceHref ? readSourceExcerpt(sourceHref) : null;\n const assetRootHref =\n type === \"asset\" && assetIds?.length\n ? createOlympusAssetUrl({\n appUrl: auth?.appUrl,\n backendUrl: auth?.backendUrl,\n assetIds,\n })\n : null;\n const href = (() => {\n if (!assetRootHref || !sourceHref) return assetRootHref;\n try {\n const source = new URL(sourceHref, \"https://app.athenaintel.com\");\n const destination = new URL(assetRootHref);\n for (const [key, value] of source.searchParams) {\n destination.searchParams.set(key, value);\n }\n destination.searchParams.set(\"asset_ids\", assetIds?.join(\",\") ?? \"\");\n return destination.toString();\n } catch {\n return assetRootHref;\n }\n })();\n // `not-prose` matters: assistant messages render inside Tailwind\n // Typography's `prose`, whose zero-specificity `img` margins (~1.7em\n // top/bottom) would otherwise inflate the chip's icon into a tall card\n // that breaks the sentence flow around it.\n const className = cn(\n \"not-prose inline-flex max-w-[220px] items-center gap-1 whitespace-nowrap rounded-md border border-slate-300 bg-white px-1.5 py-px align-middle text-[0.85em] font-medium leading-[1.4] text-slate-600 no-underline\",\n href &&\n \"cursor-pointer transition-colors hover:border-slate-400 hover:bg-slate-50 hover:text-slate-800 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1\",\n );\n const contents = (\n <>\n {thumbnailUrl && (\n <img\n src={thumbnailUrl}\n alt=\"\"\n className=\"size-3.5 shrink-0\"\n draggable={false}\n />\n )}\n {!thumbnailUrl && type === \"webpage\" && (\n <Globe2Icon className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n )}\n <span className=\"max-w-[180px] overflow-hidden text-ellipsis\">\n {name}\n </span>\n </>\n );\n\n if (href && interactive) {\n return (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={className}\n aria-label={`Open ${name} in Spaces`}\n title={excerpt ?? `Open ${name} in Spaces`}\n data-excerpt={excerpt ?? undefined}\n >\n {contents}\n </a>\n );\n }\n\n return (\n <span\n className={className}\n title={excerpt ?? undefined}\n data-excerpt={excerpt ?? undefined}\n >\n {contents}\n </span>\n );\n};\n\n/** The `excerpt` a Spaces citation URL carries, or null. */\nfunction readSourceExcerpt(href: string): string | null {\n try {\n const excerpt = new URL(href, \"https://app.athenaintel.com\").searchParams\n .get(\"excerpt\")\n ?.trim();\n return excerpt ? excerpt : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The label an asset citation chip falls back to when the model wrote none\n * (`[](…/spaces/?asset_ids=…&page=5)`): the cited location, else \"Asset\" — a\n * chip must never render as an empty box.\n */\nfunction citationFallbackLabel(params: URLSearchParams): string {\n const start = params.get(\"start_page\") ?? params.get(\"page\");\n const end = params.get(\"end_page\");\n if (start && end && end !== start) return `Pages ${start}–${end}`;\n if (start) return `Page ${start}`;\n return \"Asset\";\n}\n\n// ── Parse mention:// URLs ──\n\nexport function parseMentionUrl(url: string): {\n type: string;\n name: string;\n id: string;\n assetIds?: string[];\n thumbnailUrl?: string;\n} {\n try {\n if (isSpacesMentionUrl(url)) {\n const parsed = new URL(url, \"https://app.athenaintel.com\");\n const assetIds = (parsed.searchParams.get(\"asset_ids\") ?? \"\")\n .split(\",\")\n .map((id) => id.trim())\n .filter(Boolean);\n const id = assetIds[0] ?? \"\";\n const assetType = getSpacesAssetType(parsed);\n return {\n type: \"asset\",\n name:\n assetIds.length > 1\n ? `${assetIds.length} assets`\n : citationFallbackLabel(parsed.searchParams),\n id,\n assetIds,\n thumbnailUrl: assetTypeToThumb(assetType),\n };\n }\n // mention://tool?name=...&description=...\n // mention://asset?id=...&assetType=project&thumb=../icons/files/ic-project.svg\n const u = new URL(url);\n const type = u.hostname || u.pathname.replace(/^\\/\\//, \"\").split(\"?\")[0];\n const isWebpage = type === \"webpage\";\n const id = isWebpage\n ? u.searchParams.get(\"tab_id\") || \"\"\n : u.searchParams.get(\"id\") || u.searchParams.get(\"name\") || \"\";\n const name = isWebpage\n ? u.searchParams.get(\"title\") || \"This webpage\"\n : u.searchParams.get(\"name\") || id;\n\n // Get thumbnail: prefer explicit thumb param, then derive from assetType\n let thumbnailUrl = u.searchParams.get(\"thumb\") || undefined;\n if (!thumbnailUrl) {\n const assetType = u.searchParams.get(\"assetType\");\n if (assetType) {\n thumbnailUrl = assetTypeToThumb(assetType);\n } else if (type === \"asset\" || type === \"folder\") {\n thumbnailUrl = assetTypeToThumb(type === \"folder\" ? \"folder\" : null);\n }\n }\n\n return {\n type,\n name,\n id,\n assetIds: type === \"asset\" && id ? [id] : undefined,\n thumbnailUrl,\n };\n } catch {\n return { type: \"unknown\", name: \"\", id: \"\" };\n }\n}\n\nfunction htmlAttribute(attributes: string, name: string): string | null {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const match = new RegExp(\n `(?:^|\\\\s)${escapedName}\\\\s*=\\\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\\\s>]+))`,\n \"i\",\n ).exec(attributes);\n return match?.[1] ?? match?.[2] ?? match?.[3] ?? null;\n}\n\nfunction decodeHtmlAttribute(value: string): string {\n return value\n .replace(/&amp;/gi, \"&\")\n .replace(/&quot;/gi, '\"')\n .replace(/&#39;|&apos;/gi, \"'\")\n .replace(/&lt;/gi, \"<\")\n .replace(/&gt;/gi, \">\");\n}\n\n/** Turn complete model-emitted URL citation anchors into safe Markdown links. */\nexport function normalizeAthenaMentionHtml(text: string): string {\n return text.replace(\n /<a\\b([^>]*)>([\\s\\S]*?)<\\/a>/gi,\n (original, attributes: string, rawLabel: string) => {\n const className = htmlAttribute(attributes, \"class\") ?? \"\";\n const type = htmlAttribute(attributes, \"data-type\") ?? \"\";\n if (!className.split(/\\s+/).includes(\"mention\") || type !== \"url\") {\n return original;\n }\n\n const rawUrl =\n htmlAttribute(attributes, \"data-url\") ??\n htmlAttribute(attributes, \"href\");\n if (!rawUrl) return original;\n const url = decodeHtmlAttribute(rawUrl);\n let normalizedUrl: string;\n try {\n const parsed = new URL(url);\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return original;\n }\n normalizedUrl = parsed.toString();\n } catch {\n return original;\n }\n\n const label = decodeHtmlAttribute(rawLabel.replace(/<[^>]*>/g, \"\"))\n .trim()\n .replace(/([\\\\[\\]])/g, \"\\\\$1\");\n return label ? `[${label}](<${normalizedUrl}>)` : original;\n },\n );\n}\n// ── Parse mention markdown in plain text ──\n\nconst MENTION_RE =\n /\\[@([^\\]]*)\\]\\(((?:mention:\\/\\/|(?:https?:\\/\\/[^)\\s]+)?\\/dashboard\\/spaces\\/?\\?)[^)]+)\\)/g;\n\n/**\n * Parse text containing [@name](mention://...) patterns into\n * an array of string segments and MentionChip elements.\n */\nexport function parseMentionsInText(text: string): (string | ReactElement)[] {\n const parts: (string | ReactElement)[] = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n MENTION_RE.lastIndex = 0;\n\n while ((match = MENTION_RE.exec(text)) !== null) {\n if (match.index > lastIndex) {\n parts.push(text.slice(lastIndex, match.index));\n }\n\n const name = match[1];\n const url = match[2];\n const parsed = parseMentionUrl(url);\n\n parts.push(\n <MentionChip\n key={`mention-${match.index}`}\n name={name || parsed.name}\n type={parsed.type}\n assetIds={parsed.assetIds}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(url) ? url : undefined}\n />\n );\n\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < text.length) {\n parts.push(text.slice(lastIndex));\n }\n\n return parts.length > 0 ? parts : [text];\n}\n\n/** The text as a reader sees it: each `[@name](…)` mention becomes `@name`. */\nexport function mentionsToPlainText(text: string): string {\n return text.replace(MENTION_RE, (_match, name: string, url: string) => {\n return `@${name || parseMentionUrl(url).name}`;\n });\n}\n"],"names":["jsx","isScreenPointHref","parseScreenPointHref","formatScreenPoint","jsxs","CrosshairIcon","useContext","MentionAuthCtx","createOlympusAssetUrl","cn","Fragment","Globe2Icon","id","assetTypeToThumb"],"mappings":";;;;;;;;;;AAoBA,MAAM,sBAAsB;AAE5B,SAAS,mBAAmB,KAAsB;AAChD,SAAO,oBAAoB,KAAK,GAAG;AACrC;AAEA,SAAS,mBAAmB,KAAyB;AACnD,QAAM,YACJ,IAAI,aAAa,IAAI,WAAW,KAChC,IAAI,aAAa,IAAI,YAAY,KACjC,IAAI,aAAa,IAAI,MAAM;AAC7B,SAAO,cAAc,UAAU,gBAAgB;AACjD;AASO,MAAM,cAIR,CAAC,EAAE,MAAM,UAAU,cAAc,WAAW;AAC/C,MACE,SACC,KAAK,WAAW,YAAY,KAAK,mBAAmB,IAAI,IACzD;AACA,UAAM,OAAO,OAAO,aAAa,WAC7B,SAAS,QAAQ,MAAM,EAAE,IACzB,MAAM,QAAQ,QAAQ,IACpB,OAAO,SAAS,CAAC,KAAK,EAAE,EAAE,QAAQ,MAAM,EAAE,IAC1C;AAEN,UAAM,SAAS,gBAAgB,IAAI;AAEnC,WACEA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAM,QAAQ,OAAO;AAAA,QACrB,MAAM,OAAO;AAAA,QACb,UAAU,OAAO;AAAA,QACjB,cAAc,OAAO;AAAA,QACrB,YAAY,mBAAmB,IAAI,IAAI,OAAO;AAAA,QAC9C;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AAEA,MAAI,6BAAM,WAAW,wBAAwB;AAC3C,WAAOA,+BAAC,UAAM,UAAS;AAAA,EACzB;AAEA,MAAIC,YAAAA,kBAAkB,IAAI,GAAG;AAC3B,WAAOD,2BAAAA,IAAC,iBAAA,EAAgB,MAAa,SA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;AACzC;AAGO,SAAS,oBAAoB,MAAsB;AACxD,SAAO,KAAK,QAAQ,YAAY,CAAC,QAAQ,MAAc,QAAgB;AACrE,WAAO,IAAI,QAAQ,gBAAgB,GAAG,EAAE,IAAI;AAAA,EAC9C,CAAC;AACH;;;;;;;;"}
@@ -47,3 +47,5 @@ export declare function normalizeAthenaMentionHtml(text: string): string;
47
47
  * an array of string segments and MentionChip elements.
48
48
  */
49
49
  export declare function parseMentionsInText(text: string): (string | ReactElement)[];
50
+ /** The text as a reader sees it: each `[@name](…)` mention becomes `@name`. */
51
+ export declare function mentionsToPlainText(text: string): string;
@@ -254,10 +254,16 @@ function parseMentionsInText(text) {
254
254
  }
255
255
  return parts.length > 0 ? parts : [text];
256
256
  }
257
+ function mentionsToPlainText(text) {
258
+ return text.replace(MENTION_RE, (_match, name, url) => {
259
+ return `@${name || parseMentionUrl(url).name}`;
260
+ });
261
+ }
257
262
  export {
258
263
  MentionChip,
259
264
  MentionLink,
260
265
  ScreenPointChip,
266
+ mentionsToPlainText,
261
267
  normalizeAthenaMentionHtml,
262
268
  parseMentionUrl,
263
269
  parseMentionsInText
@@ -1 +1 @@
1
- {"version":3,"file":"mention-chip.js","sources":["../../../src/chat-ui/mentions/mention-chip.tsx"],"sourcesContent":["/**\n * Mention chip rendering for message display.\n *\n * Parses [@name](mention://type?...) markdown links and renders them\n * as styled inline chips matching the Olympus mention style.\n * Used in both user messages (inline text) and assistant messages (markdown links).\n */\n\nimport { useContext, type FC, type ReactElement, type ReactNode } from \"react\";\nimport {\n formatScreenPoint,\n isScreenPointHref,\n parseScreenPointHref,\n} from \"@athenaintel/agent-runtime\";\nimport { CrosshairIcon, Globe2Icon } from \"lucide-react\";\nimport { cn } from \"../../lib/utils\";\nimport { createOlympusAssetUrl } from \"../lib/asset-urls\";\nimport { MentionAuthCtx } from \"./suggestions/data/api-client\";\nimport { assetTypeToThumb } from \"./suggestions/data/sources/asset-type-icons\";\n\nconst SPACES_MENTION_PATH = /\\/dashboard\\/spaces\\/?\\?/;\n\nfunction isSpacesMentionUrl(url: string): boolean {\n return SPACES_MENTION_PATH.test(url);\n}\n\nfunction getSpacesAssetType(url: URL): string | null {\n const assetType =\n url.searchParams.get(\"assetType\") ||\n url.searchParams.get(\"asset_type\") ||\n url.searchParams.get(\"type\");\n return assetType === \"sheet\" ? \"spreadsheet\" : assetType;\n}\n\n// ── Mention link component for markdown renderer ──\n\n/**\n * Custom <a> renderer for MarkdownTextPrimitive.\n * Intercepts mention:// links and renders them as chips.\n * Falls through to a normal link for non-mention URLs.\n */\nexport const MentionLink: FC<{\n href?: string;\n children?: ReactNode;\n interactive?: boolean;\n}> = ({ href, children, interactive = true }) => {\n if (\n href &&\n (href.startsWith(\"mention://\") || isSpacesMentionUrl(href))\n ) {\n const name = typeof children === \"string\"\n ? children.replace(/^@/, \"\")\n : Array.isArray(children)\n ? String(children[0] ?? \"\").replace(/^@/, \"\")\n : \"\";\n\n const parsed = parseMentionUrl(href);\n\n return (\n <MentionChip\n name={name || parsed.name}\n type={parsed.type}\n assetIds={parsed.assetIds}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(href) ? href : undefined}\n interactive={interactive}\n />\n );\n }\n\n if (href?.startsWith(\"chrome-extension://\")) {\n return <span>{children}</span>;\n }\n\n if (isScreenPointHref(href)) {\n return <ScreenPointChip href={href}>{children}</ScreenPointChip>;\n }\n\n // Normal link — render as-is\n return (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n};\n\n// ── Inline screen-point chip ──\n\n/**\n * Renders an `athena-point://` link as a non-navigating coordinate chip.\n * Surfaces without screenshot context (extension side panel, SDK consumers)\n * get the label plus the coordinates; malformed points fall back to text.\n */\nexport const ScreenPointChip: FC<{\n href: string;\n children?: ReactNode;\n}> = ({ href, children }) => {\n const parsed = parseScreenPointHref(href);\n if (!parsed.ok) {\n return <span>{children}</span>;\n }\n const description = formatScreenPoint(parsed.point);\n return (\n <span\n className=\"not-prose inline-flex max-w-[260px] items-center gap-1 whitespace-nowrap rounded-md border border-slate-300 bg-white px-1.5 py-px align-middle text-[0.85em] font-medium leading-[1.4] text-slate-600\"\n title={description}\n aria-label={description}\n data-screen-point=\"valid\"\n >\n <CrosshairIcon className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n <span className=\"max-w-[180px] overflow-hidden text-ellipsis\">\n {children}\n </span>\n <span className=\"font-normal text-slate-400\">\n {parsed.point.x}, {parsed.point.y}\n </span>\n </span>\n );\n};\n\n// ── Inline mention chip ──\n\nexport const MentionChip: FC<{\n name: string;\n type?: string;\n assetIds?: string[];\n thumbnailUrl?: string;\n sourceHref?: string;\n interactive?: boolean;\n}> = ({ name, type, assetIds, thumbnailUrl, sourceHref, interactive = true }) => {\n const auth = useContext(MentionAuthCtx);\n // A citation's excerpt (the passage the chip points at) is the tooltip; the\n // accessible name stays the action.\n const excerpt = sourceHref ? readSourceExcerpt(sourceHref) : null;\n const assetRootHref =\n type === \"asset\" && assetIds?.length\n ? createOlympusAssetUrl({\n appUrl: auth?.appUrl,\n backendUrl: auth?.backendUrl,\n assetIds,\n })\n : null;\n const href = (() => {\n if (!assetRootHref || !sourceHref) return assetRootHref;\n try {\n const source = new URL(sourceHref, \"https://app.athenaintel.com\");\n const destination = new URL(assetRootHref);\n for (const [key, value] of source.searchParams) {\n destination.searchParams.set(key, value);\n }\n destination.searchParams.set(\"asset_ids\", assetIds?.join(\",\") ?? \"\");\n return destination.toString();\n } catch {\n return assetRootHref;\n }\n })();\n // `not-prose` matters: assistant messages render inside Tailwind\n // Typography's `prose`, whose zero-specificity `img` margins (~1.7em\n // top/bottom) would otherwise inflate the chip's icon into a tall card\n // that breaks the sentence flow around it.\n const className = cn(\n \"not-prose inline-flex max-w-[220px] items-center gap-1 whitespace-nowrap rounded-md border border-slate-300 bg-white px-1.5 py-px align-middle text-[0.85em] font-medium leading-[1.4] text-slate-600 no-underline\",\n href &&\n \"cursor-pointer transition-colors hover:border-slate-400 hover:bg-slate-50 hover:text-slate-800 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1\",\n );\n const contents = (\n <>\n {thumbnailUrl && (\n <img\n src={thumbnailUrl}\n alt=\"\"\n className=\"size-3.5 shrink-0\"\n draggable={false}\n />\n )}\n {!thumbnailUrl && type === \"webpage\" && (\n <Globe2Icon className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n )}\n <span className=\"max-w-[180px] overflow-hidden text-ellipsis\">\n {name}\n </span>\n </>\n );\n\n if (href && interactive) {\n return (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={className}\n aria-label={`Open ${name} in Spaces`}\n title={excerpt ?? `Open ${name} in Spaces`}\n data-excerpt={excerpt ?? undefined}\n >\n {contents}\n </a>\n );\n }\n\n return (\n <span\n className={className}\n title={excerpt ?? undefined}\n data-excerpt={excerpt ?? undefined}\n >\n {contents}\n </span>\n );\n};\n\n/** The `excerpt` a Spaces citation URL carries, or null. */\nfunction readSourceExcerpt(href: string): string | null {\n try {\n const excerpt = new URL(href, \"https://app.athenaintel.com\").searchParams\n .get(\"excerpt\")\n ?.trim();\n return excerpt ? excerpt : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The label an asset citation chip falls back to when the model wrote none\n * (`[](…/spaces/?asset_ids=…&page=5)`): the cited location, else \"Asset\" — a\n * chip must never render as an empty box.\n */\nfunction citationFallbackLabel(params: URLSearchParams): string {\n const start = params.get(\"start_page\") ?? params.get(\"page\");\n const end = params.get(\"end_page\");\n if (start && end && end !== start) return `Pages ${start}–${end}`;\n if (start) return `Page ${start}`;\n return \"Asset\";\n}\n\n// ── Parse mention:// URLs ──\n\nexport function parseMentionUrl(url: string): {\n type: string;\n name: string;\n id: string;\n assetIds?: string[];\n thumbnailUrl?: string;\n} {\n try {\n if (isSpacesMentionUrl(url)) {\n const parsed = new URL(url, \"https://app.athenaintel.com\");\n const assetIds = (parsed.searchParams.get(\"asset_ids\") ?? \"\")\n .split(\",\")\n .map((id) => id.trim())\n .filter(Boolean);\n const id = assetIds[0] ?? \"\";\n const assetType = getSpacesAssetType(parsed);\n return {\n type: \"asset\",\n name:\n assetIds.length > 1\n ? `${assetIds.length} assets`\n : citationFallbackLabel(parsed.searchParams),\n id,\n assetIds,\n thumbnailUrl: assetTypeToThumb(assetType),\n };\n }\n // mention://tool?name=...&description=...\n // mention://asset?id=...&assetType=project&thumb=../icons/files/ic-project.svg\n const u = new URL(url);\n const type = u.hostname || u.pathname.replace(/^\\/\\//, \"\").split(\"?\")[0];\n const isWebpage = type === \"webpage\";\n const id = isWebpage\n ? u.searchParams.get(\"tab_id\") || \"\"\n : u.searchParams.get(\"id\") || u.searchParams.get(\"name\") || \"\";\n const name = isWebpage\n ? u.searchParams.get(\"title\") || \"This webpage\"\n : u.searchParams.get(\"name\") || id;\n\n // Get thumbnail: prefer explicit thumb param, then derive from assetType\n let thumbnailUrl = u.searchParams.get(\"thumb\") || undefined;\n if (!thumbnailUrl) {\n const assetType = u.searchParams.get(\"assetType\");\n if (assetType) {\n thumbnailUrl = assetTypeToThumb(assetType);\n } else if (type === \"asset\" || type === \"folder\") {\n thumbnailUrl = assetTypeToThumb(type === \"folder\" ? \"folder\" : null);\n }\n }\n\n return {\n type,\n name,\n id,\n assetIds: type === \"asset\" && id ? [id] : undefined,\n thumbnailUrl,\n };\n } catch {\n return { type: \"unknown\", name: \"\", id: \"\" };\n }\n}\n\nfunction htmlAttribute(attributes: string, name: string): string | null {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const match = new RegExp(\n `(?:^|\\\\s)${escapedName}\\\\s*=\\\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\\\s>]+))`,\n \"i\",\n ).exec(attributes);\n return match?.[1] ?? match?.[2] ?? match?.[3] ?? null;\n}\n\nfunction decodeHtmlAttribute(value: string): string {\n return value\n .replace(/&amp;/gi, \"&\")\n .replace(/&quot;/gi, '\"')\n .replace(/&#39;|&apos;/gi, \"'\")\n .replace(/&lt;/gi, \"<\")\n .replace(/&gt;/gi, \">\");\n}\n\n/** Turn complete model-emitted URL citation anchors into safe Markdown links. */\nexport function normalizeAthenaMentionHtml(text: string): string {\n return text.replace(\n /<a\\b([^>]*)>([\\s\\S]*?)<\\/a>/gi,\n (original, attributes: string, rawLabel: string) => {\n const className = htmlAttribute(attributes, \"class\") ?? \"\";\n const type = htmlAttribute(attributes, \"data-type\") ?? \"\";\n if (!className.split(/\\s+/).includes(\"mention\") || type !== \"url\") {\n return original;\n }\n\n const rawUrl =\n htmlAttribute(attributes, \"data-url\") ??\n htmlAttribute(attributes, \"href\");\n if (!rawUrl) return original;\n const url = decodeHtmlAttribute(rawUrl);\n let normalizedUrl: string;\n try {\n const parsed = new URL(url);\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return original;\n }\n normalizedUrl = parsed.toString();\n } catch {\n return original;\n }\n\n const label = decodeHtmlAttribute(rawLabel.replace(/<[^>]*>/g, \"\"))\n .trim()\n .replace(/([\\\\[\\]])/g, \"\\\\$1\");\n return label ? `[${label}](<${normalizedUrl}>)` : original;\n },\n );\n}\n// ── Parse mention markdown in plain text ──\n\nconst MENTION_RE =\n /\\[@([^\\]]*)\\]\\(((?:mention:\\/\\/|(?:https?:\\/\\/[^)\\s]+)?\\/dashboard\\/spaces\\/?\\?)[^)]+)\\)/g;\n\n/**\n * Parse text containing [@name](mention://...) patterns into\n * an array of string segments and MentionChip elements.\n */\nexport function parseMentionsInText(text: string): (string | ReactElement)[] {\n const parts: (string | ReactElement)[] = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n MENTION_RE.lastIndex = 0;\n\n while ((match = MENTION_RE.exec(text)) !== null) {\n if (match.index > lastIndex) {\n parts.push(text.slice(lastIndex, match.index));\n }\n\n const name = match[1];\n const url = match[2];\n const parsed = parseMentionUrl(url);\n\n parts.push(\n <MentionChip\n key={`mention-${match.index}`}\n name={name || parsed.name}\n type={parsed.type}\n assetIds={parsed.assetIds}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(url) ? url : undefined}\n />\n );\n\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < text.length) {\n parts.push(text.slice(lastIndex));\n }\n\n return parts.length > 0 ? parts : [text];\n}\n"],"names":["id"],"mappings":";;;;;;;;AAoBA,MAAM,sBAAsB;AAE5B,SAAS,mBAAmB,KAAsB;AAChD,SAAO,oBAAoB,KAAK,GAAG;AACrC;AAEA,SAAS,mBAAmB,KAAyB;AACnD,QAAM,YACJ,IAAI,aAAa,IAAI,WAAW,KAChC,IAAI,aAAa,IAAI,YAAY,KACjC,IAAI,aAAa,IAAI,MAAM;AAC7B,SAAO,cAAc,UAAU,gBAAgB;AACjD;AASO,MAAM,cAIR,CAAC,EAAE,MAAM,UAAU,cAAc,WAAW;AAC/C,MACE,SACC,KAAK,WAAW,YAAY,KAAK,mBAAmB,IAAI,IACzD;AACA,UAAM,OAAO,OAAO,aAAa,WAC7B,SAAS,QAAQ,MAAM,EAAE,IACzB,MAAM,QAAQ,QAAQ,IACpB,OAAO,SAAS,CAAC,KAAK,EAAE,EAAE,QAAQ,MAAM,EAAE,IAC1C;AAEN,UAAM,SAAS,gBAAgB,IAAI;AAEnC,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAM,QAAQ,OAAO;AAAA,QACrB,MAAM,OAAO;AAAA,QACb,UAAU,OAAO;AAAA,QACjB,cAAc,OAAO;AAAA,QACrB,YAAY,mBAAmB,IAAI,IAAI,OAAO;AAAA,QAC9C;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AAEA,MAAI,6BAAM,WAAW,wBAAwB;AAC3C,WAAO,oBAAC,UAAM,UAAS;AAAA,EACzB;AAEA,MAAI,kBAAkB,IAAI,GAAG;AAC3B,WAAO,oBAAC,iBAAA,EAAgB,MAAa,SAAA,CAAS;AAAA,EAChD;AAGA,6BACG,KAAA,EAAE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AEA,YAAM,QAAQ,oBAAoB,SAAS,QAAQ,YAAY,EAAE,CAAC,EAC/D,KAAA,EACA,QAAQ,cAAc,MAAM;AAC/B,aAAO,QAAQ,IAAI,KAAK,MAAM,aAAa,OAAO;AAAA,IACpD;AAAA,EAAA;AAEJ;AAGA,MAAM,aACJ;AAMK,SAAS,oBAAoB,MAAyC;AAC3E,QAAM,QAAmC,CAAA;AACzC,MAAI,YAAY;AAChB,MAAI;AAEJ,aAAW,YAAY;AAEvB,UAAQ,QAAQ,WAAW,KAAK,IAAI,OAAO,MAAM;AAC/C,QAAI,MAAM,QAAQ,WAAW;AAC3B,YAAM,KAAK,KAAK,MAAM,WAAW,MAAM,KAAK,CAAC;AAAA,IAC/C;AAEA,UAAM,OAAO,MAAM,CAAC;AACpB,UAAM,MAAM,MAAM,CAAC;AACnB,UAAM,SAAS,gBAAgB,GAAG;AAElC,UAAM;AAAA,MACJ;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,MAAM,QAAQ,OAAO;AAAA,UACrB,MAAM,OAAO;AAAA,UACb,UAAU,OAAO;AAAA,UACjB,cAAc,OAAO;AAAA,UACrB,YAAY,mBAAmB,GAAG,IAAI,MAAM;AAAA,QAAA;AAAA,QALvC,WAAW,MAAM,KAAK;AAAA,MAAA;AAAA,IAM7B;AAGF,gBAAY,MAAM,QAAQ,MAAM,CAAC,EAAE;AAAA,EACrC;AAEA,MAAI,YAAY,KAAK,QAAQ;AAC3B,UAAM,KAAK,KAAK,MAAM,SAAS,CAAC;AAAA,EAClC;AAEA,SAAO,MAAM,SAAS,IAAI,QAAQ,CAAC,IAAI;AACzC;"}
1
+ {"version":3,"file":"mention-chip.js","sources":["../../../src/chat-ui/mentions/mention-chip.tsx"],"sourcesContent":["/**\n * Mention chip rendering for message display.\n *\n * Parses [@name](mention://type?...) markdown links and renders them\n * as styled inline chips matching the Olympus mention style.\n * Used in both user messages (inline text) and assistant messages (markdown links).\n */\n\nimport { useContext, type FC, type ReactElement, type ReactNode } from \"react\";\nimport {\n formatScreenPoint,\n isScreenPointHref,\n parseScreenPointHref,\n} from \"@athenaintel/agent-runtime\";\nimport { CrosshairIcon, Globe2Icon } from \"lucide-react\";\nimport { cn } from \"../../lib/utils\";\nimport { createOlympusAssetUrl } from \"../lib/asset-urls\";\nimport { MentionAuthCtx } from \"./suggestions/data/api-client\";\nimport { assetTypeToThumb } from \"./suggestions/data/sources/asset-type-icons\";\n\nconst SPACES_MENTION_PATH = /\\/dashboard\\/spaces\\/?\\?/;\n\nfunction isSpacesMentionUrl(url: string): boolean {\n return SPACES_MENTION_PATH.test(url);\n}\n\nfunction getSpacesAssetType(url: URL): string | null {\n const assetType =\n url.searchParams.get(\"assetType\") ||\n url.searchParams.get(\"asset_type\") ||\n url.searchParams.get(\"type\");\n return assetType === \"sheet\" ? \"spreadsheet\" : assetType;\n}\n\n// ── Mention link component for markdown renderer ──\n\n/**\n * Custom <a> renderer for MarkdownTextPrimitive.\n * Intercepts mention:// links and renders them as chips.\n * Falls through to a normal link for non-mention URLs.\n */\nexport const MentionLink: FC<{\n href?: string;\n children?: ReactNode;\n interactive?: boolean;\n}> = ({ href, children, interactive = true }) => {\n if (\n href &&\n (href.startsWith(\"mention://\") || isSpacesMentionUrl(href))\n ) {\n const name = typeof children === \"string\"\n ? children.replace(/^@/, \"\")\n : Array.isArray(children)\n ? String(children[0] ?? \"\").replace(/^@/, \"\")\n : \"\";\n\n const parsed = parseMentionUrl(href);\n\n return (\n <MentionChip\n name={name || parsed.name}\n type={parsed.type}\n assetIds={parsed.assetIds}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(href) ? href : undefined}\n interactive={interactive}\n />\n );\n }\n\n if (href?.startsWith(\"chrome-extension://\")) {\n return <span>{children}</span>;\n }\n\n if (isScreenPointHref(href)) {\n return <ScreenPointChip href={href}>{children}</ScreenPointChip>;\n }\n\n // Normal link — render as-is\n return (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n};\n\n// ── Inline screen-point chip ──\n\n/**\n * Renders an `athena-point://` link as a non-navigating coordinate chip.\n * Surfaces without screenshot context (extension side panel, SDK consumers)\n * get the label plus the coordinates; malformed points fall back to text.\n */\nexport const ScreenPointChip: FC<{\n href: string;\n children?: ReactNode;\n}> = ({ href, children }) => {\n const parsed = parseScreenPointHref(href);\n if (!parsed.ok) {\n return <span>{children}</span>;\n }\n const description = formatScreenPoint(parsed.point);\n return (\n <span\n className=\"not-prose inline-flex max-w-[260px] items-center gap-1 whitespace-nowrap rounded-md border border-slate-300 bg-white px-1.5 py-px align-middle text-[0.85em] font-medium leading-[1.4] text-slate-600\"\n title={description}\n aria-label={description}\n data-screen-point=\"valid\"\n >\n <CrosshairIcon className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n <span className=\"max-w-[180px] overflow-hidden text-ellipsis\">\n {children}\n </span>\n <span className=\"font-normal text-slate-400\">\n {parsed.point.x}, {parsed.point.y}\n </span>\n </span>\n );\n};\n\n// ── Inline mention chip ──\n\nexport const MentionChip: FC<{\n name: string;\n type?: string;\n assetIds?: string[];\n thumbnailUrl?: string;\n sourceHref?: string;\n interactive?: boolean;\n}> = ({ name, type, assetIds, thumbnailUrl, sourceHref, interactive = true }) => {\n const auth = useContext(MentionAuthCtx);\n // A citation's excerpt (the passage the chip points at) is the tooltip; the\n // accessible name stays the action.\n const excerpt = sourceHref ? readSourceExcerpt(sourceHref) : null;\n const assetRootHref =\n type === \"asset\" && assetIds?.length\n ? createOlympusAssetUrl({\n appUrl: auth?.appUrl,\n backendUrl: auth?.backendUrl,\n assetIds,\n })\n : null;\n const href = (() => {\n if (!assetRootHref || !sourceHref) return assetRootHref;\n try {\n const source = new URL(sourceHref, \"https://app.athenaintel.com\");\n const destination = new URL(assetRootHref);\n for (const [key, value] of source.searchParams) {\n destination.searchParams.set(key, value);\n }\n destination.searchParams.set(\"asset_ids\", assetIds?.join(\",\") ?? \"\");\n return destination.toString();\n } catch {\n return assetRootHref;\n }\n })();\n // `not-prose` matters: assistant messages render inside Tailwind\n // Typography's `prose`, whose zero-specificity `img` margins (~1.7em\n // top/bottom) would otherwise inflate the chip's icon into a tall card\n // that breaks the sentence flow around it.\n const className = cn(\n \"not-prose inline-flex max-w-[220px] items-center gap-1 whitespace-nowrap rounded-md border border-slate-300 bg-white px-1.5 py-px align-middle text-[0.85em] font-medium leading-[1.4] text-slate-600 no-underline\",\n href &&\n \"cursor-pointer transition-colors hover:border-slate-400 hover:bg-slate-50 hover:text-slate-800 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1\",\n );\n const contents = (\n <>\n {thumbnailUrl && (\n <img\n src={thumbnailUrl}\n alt=\"\"\n className=\"size-3.5 shrink-0\"\n draggable={false}\n />\n )}\n {!thumbnailUrl && type === \"webpage\" && (\n <Globe2Icon className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n )}\n <span className=\"max-w-[180px] overflow-hidden text-ellipsis\">\n {name}\n </span>\n </>\n );\n\n if (href && interactive) {\n return (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={className}\n aria-label={`Open ${name} in Spaces`}\n title={excerpt ?? `Open ${name} in Spaces`}\n data-excerpt={excerpt ?? undefined}\n >\n {contents}\n </a>\n );\n }\n\n return (\n <span\n className={className}\n title={excerpt ?? undefined}\n data-excerpt={excerpt ?? undefined}\n >\n {contents}\n </span>\n );\n};\n\n/** The `excerpt` a Spaces citation URL carries, or null. */\nfunction readSourceExcerpt(href: string): string | null {\n try {\n const excerpt = new URL(href, \"https://app.athenaintel.com\").searchParams\n .get(\"excerpt\")\n ?.trim();\n return excerpt ? excerpt : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The label an asset citation chip falls back to when the model wrote none\n * (`[](…/spaces/?asset_ids=…&page=5)`): the cited location, else \"Asset\" — a\n * chip must never render as an empty box.\n */\nfunction citationFallbackLabel(params: URLSearchParams): string {\n const start = params.get(\"start_page\") ?? params.get(\"page\");\n const end = params.get(\"end_page\");\n if (start && end && end !== start) return `Pages ${start}–${end}`;\n if (start) return `Page ${start}`;\n return \"Asset\";\n}\n\n// ── Parse mention:// URLs ──\n\nexport function parseMentionUrl(url: string): {\n type: string;\n name: string;\n id: string;\n assetIds?: string[];\n thumbnailUrl?: string;\n} {\n try {\n if (isSpacesMentionUrl(url)) {\n const parsed = new URL(url, \"https://app.athenaintel.com\");\n const assetIds = (parsed.searchParams.get(\"asset_ids\") ?? \"\")\n .split(\",\")\n .map((id) => id.trim())\n .filter(Boolean);\n const id = assetIds[0] ?? \"\";\n const assetType = getSpacesAssetType(parsed);\n return {\n type: \"asset\",\n name:\n assetIds.length > 1\n ? `${assetIds.length} assets`\n : citationFallbackLabel(parsed.searchParams),\n id,\n assetIds,\n thumbnailUrl: assetTypeToThumb(assetType),\n };\n }\n // mention://tool?name=...&description=...\n // mention://asset?id=...&assetType=project&thumb=../icons/files/ic-project.svg\n const u = new URL(url);\n const type = u.hostname || u.pathname.replace(/^\\/\\//, \"\").split(\"?\")[0];\n const isWebpage = type === \"webpage\";\n const id = isWebpage\n ? u.searchParams.get(\"tab_id\") || \"\"\n : u.searchParams.get(\"id\") || u.searchParams.get(\"name\") || \"\";\n const name = isWebpage\n ? u.searchParams.get(\"title\") || \"This webpage\"\n : u.searchParams.get(\"name\") || id;\n\n // Get thumbnail: prefer explicit thumb param, then derive from assetType\n let thumbnailUrl = u.searchParams.get(\"thumb\") || undefined;\n if (!thumbnailUrl) {\n const assetType = u.searchParams.get(\"assetType\");\n if (assetType) {\n thumbnailUrl = assetTypeToThumb(assetType);\n } else if (type === \"asset\" || type === \"folder\") {\n thumbnailUrl = assetTypeToThumb(type === \"folder\" ? \"folder\" : null);\n }\n }\n\n return {\n type,\n name,\n id,\n assetIds: type === \"asset\" && id ? [id] : undefined,\n thumbnailUrl,\n };\n } catch {\n return { type: \"unknown\", name: \"\", id: \"\" };\n }\n}\n\nfunction htmlAttribute(attributes: string, name: string): string | null {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const match = new RegExp(\n `(?:^|\\\\s)${escapedName}\\\\s*=\\\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\\\s>]+))`,\n \"i\",\n ).exec(attributes);\n return match?.[1] ?? match?.[2] ?? match?.[3] ?? null;\n}\n\nfunction decodeHtmlAttribute(value: string): string {\n return value\n .replace(/&amp;/gi, \"&\")\n .replace(/&quot;/gi, '\"')\n .replace(/&#39;|&apos;/gi, \"'\")\n .replace(/&lt;/gi, \"<\")\n .replace(/&gt;/gi, \">\");\n}\n\n/** Turn complete model-emitted URL citation anchors into safe Markdown links. */\nexport function normalizeAthenaMentionHtml(text: string): string {\n return text.replace(\n /<a\\b([^>]*)>([\\s\\S]*?)<\\/a>/gi,\n (original, attributes: string, rawLabel: string) => {\n const className = htmlAttribute(attributes, \"class\") ?? \"\";\n const type = htmlAttribute(attributes, \"data-type\") ?? \"\";\n if (!className.split(/\\s+/).includes(\"mention\") || type !== \"url\") {\n return original;\n }\n\n const rawUrl =\n htmlAttribute(attributes, \"data-url\") ??\n htmlAttribute(attributes, \"href\");\n if (!rawUrl) return original;\n const url = decodeHtmlAttribute(rawUrl);\n let normalizedUrl: string;\n try {\n const parsed = new URL(url);\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return original;\n }\n normalizedUrl = parsed.toString();\n } catch {\n return original;\n }\n\n const label = decodeHtmlAttribute(rawLabel.replace(/<[^>]*>/g, \"\"))\n .trim()\n .replace(/([\\\\[\\]])/g, \"\\\\$1\");\n return label ? `[${label}](<${normalizedUrl}>)` : original;\n },\n );\n}\n// ── Parse mention markdown in plain text ──\n\nconst MENTION_RE =\n /\\[@([^\\]]*)\\]\\(((?:mention:\\/\\/|(?:https?:\\/\\/[^)\\s]+)?\\/dashboard\\/spaces\\/?\\?)[^)]+)\\)/g;\n\n/**\n * Parse text containing [@name](mention://...) patterns into\n * an array of string segments and MentionChip elements.\n */\nexport function parseMentionsInText(text: string): (string | ReactElement)[] {\n const parts: (string | ReactElement)[] = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n MENTION_RE.lastIndex = 0;\n\n while ((match = MENTION_RE.exec(text)) !== null) {\n if (match.index > lastIndex) {\n parts.push(text.slice(lastIndex, match.index));\n }\n\n const name = match[1];\n const url = match[2];\n const parsed = parseMentionUrl(url);\n\n parts.push(\n <MentionChip\n key={`mention-${match.index}`}\n name={name || parsed.name}\n type={parsed.type}\n assetIds={parsed.assetIds}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(url) ? url : undefined}\n />\n );\n\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < text.length) {\n parts.push(text.slice(lastIndex));\n }\n\n return parts.length > 0 ? parts : [text];\n}\n\n/** The text as a reader sees it: each `[@name](…)` mention becomes `@name`. */\nexport function mentionsToPlainText(text: string): string {\n return text.replace(MENTION_RE, (_match, name: string, url: string) => {\n return `@${name || parseMentionUrl(url).name}`;\n });\n}\n"],"names":["id"],"mappings":";;;;;;;;AAoBA,MAAM,sBAAsB;AAE5B,SAAS,mBAAmB,KAAsB;AAChD,SAAO,oBAAoB,KAAK,GAAG;AACrC;AAEA,SAAS,mBAAmB,KAAyB;AACnD,QAAM,YACJ,IAAI,aAAa,IAAI,WAAW,KAChC,IAAI,aAAa,IAAI,YAAY,KACjC,IAAI,aAAa,IAAI,MAAM;AAC7B,SAAO,cAAc,UAAU,gBAAgB;AACjD;AASO,MAAM,cAIR,CAAC,EAAE,MAAM,UAAU,cAAc,WAAW;AAC/C,MACE,SACC,KAAK,WAAW,YAAY,KAAK,mBAAmB,IAAI,IACzD;AACA,UAAM,OAAO,OAAO,aAAa,WAC7B,SAAS,QAAQ,MAAM,EAAE,IACzB,MAAM,QAAQ,QAAQ,IACpB,OAAO,SAAS,CAAC,KAAK,EAAE,EAAE,QAAQ,MAAM,EAAE,IAC1C;AAEN,UAAM,SAAS,gBAAgB,I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,IAM7B;AAGF,gBAAY,MAAM,QAAQ,MAAM,CAAC,EAAE;AAAA,EACrC;AAEA,MAAI,YAAY,KAAK,QAAQ;AAC3B,UAAM,KAAK,KAAK,MAAM,SAAS,CAAC;AAAA,EAClC;AAEA,SAAO,MAAM,SAAS,IAAI,QAAQ,CAAC,IAAI;AACzC;AAGO,SAAS,oBAAoB,MAAsB;AACxD,SAAO,KAAK,QAAQ,YAAY,CAAC,QAAQ,MAAc,QAAgB;AACrE,WAAO,IAAI,QAAQ,gBAAgB,GAAG,EAAE,IAAI;AAAA,EAC9C,CAAC;AACH;"}
@@ -12,4 +12,4 @@ export declare function MentionIcon({ fallbackIcon, thumbnailUrl, alt, className
12
12
  thumbnailUrl?: string;
13
13
  alt?: string;
14
14
  className?: string;
15
- }): import("react/jsx-runtime").JSX.Element;
15
+ }): import("react").JSX.Element;
@@ -7,4 +7,4 @@ export declare function MenuBreadcrumbs({ scopePath, onNavigate, }: {
7
7
  name: string;
8
8
  }[];
9
9
  onNavigate: (scopeId: string) => void;
10
- }): import("react/jsx-runtime").JSX.Element;
10
+ }): import("react").JSX.Element;
@@ -9,4 +9,4 @@ export declare function MenuItemRow({ item, isSelected, onMouseMove, onClick, sh
9
9
  onMouseMove: () => void;
10
10
  onClick: () => void;
11
11
  showArrow?: boolean;
12
- }): import("react/jsx-runtime").JSX.Element;
12
+ }): import("react").JSX.Element;
@@ -10,4 +10,4 @@ export declare function MenuList({ items, selectedIndex, isLoading, hasMore, onS
10
10
  onSelect: (item: MenuItem) => void;
11
11
  onMouseMove: (index: number) => void;
12
12
  onLoadMore?: () => void;
13
- }): import("react/jsx-runtime").JSX.Element;
13
+ }): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Loading skeleton for the mention menu.
3
3
  */
4
- export declare function MenuSkeleton(): import("react/jsx-runtime").JSX.Element;
4
+ export declare function MenuSkeleton(): import("react").JSX.Element;
@@ -10,4 +10,4 @@ export declare function MenuSummary({ scopePath, onNavigate, onBackClick, isFetc
10
10
  onNavigate: (scopeId: string) => void;
11
11
  onBackClick?: () => void;
12
12
  isFetching?: boolean;
13
- }): import("react/jsx-runtime").JSX.Element | null;
13
+ }): import("react").JSX.Element | null;
@@ -12,4 +12,4 @@ export declare const useDebugMenuStore: () => {
12
12
  };
13
13
  export declare function Spinner({ className }: {
14
14
  className?: string;
15
- }): import("react/jsx-runtime").JSX.Element;
15
+ }): import("react").JSX.Element;