@athenaintel/react 0.43.0 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +215 -3
- package/dist/agent-runtime/src/answer-label.cjs +137 -0
- package/dist/agent-runtime/src/answer-label.cjs.map +1 -0
- package/dist/agent-runtime/src/answer-label.d.ts +104 -0
- package/dist/agent-runtime/src/answer-label.js +137 -0
- package/dist/agent-runtime/src/answer-label.js.map +1 -0
- package/dist/agent-runtime/src/answer-rows.cjs +180 -0
- package/dist/agent-runtime/src/answer-rows.cjs.map +1 -0
- package/dist/agent-runtime/src/answer-rows.d.ts +86 -0
- package/dist/agent-runtime/src/answer-rows.js +180 -0
- package/dist/agent-runtime/src/answer-rows.js.map +1 -0
- package/dist/agent-runtime/src/client-tool-bridge.cjs +15 -15
- package/dist/agent-runtime/src/client-tool-bridge.cjs.map +1 -1
- package/dist/agent-runtime/src/conversation-index.cjs +8 -8
- package/dist/agent-runtime/src/conversation-index.cjs.map +1 -1
- package/dist/agent-runtime/src/decision-checks.cjs +207 -0
- package/dist/agent-runtime/src/decision-checks.cjs.map +1 -0
- package/dist/agent-runtime/src/decision-checks.d.ts +142 -0
- package/dist/agent-runtime/src/decision-checks.js +207 -0
- package/dist/agent-runtime/src/decision-checks.js.map +1 -0
- package/dist/agent-runtime/src/desktop-handoff.d.ts +12 -0
- package/dist/agent-runtime/src/errors.cjs +18 -0
- package/dist/agent-runtime/src/errors.cjs.map +1 -1
- package/dist/agent-runtime/src/errors.d.ts +7 -0
- package/dist/agent-runtime/src/errors.js +18 -0
- package/dist/agent-runtime/src/errors.js.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs +12 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +6 -6
- package/dist/agent-runtime/src/generated/runconfig-contract.js +12 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/agent-runtime/src/handoff-arrival.cjs +60 -0
- package/dist/agent-runtime/src/handoff-arrival.cjs.map +1 -0
- package/dist/agent-runtime/src/handoff-arrival.d.ts +46 -0
- package/dist/agent-runtime/src/handoff-arrival.js +60 -0
- package/dist/agent-runtime/src/handoff-arrival.js.map +1 -0
- package/dist/agent-runtime/src/index.d.ts +14 -8
- package/dist/agent-runtime/src/interrupts.cjs +43 -18
- package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
- package/dist/agent-runtime/src/interrupts.d.ts +19 -2
- package/dist/agent-runtime/src/interrupts.js +28 -3
- package/dist/agent-runtime/src/interrupts.js.map +1 -1
- package/dist/agent-runtime/src/lane-history.cjs +8 -8
- package/dist/agent-runtime/src/lane-history.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.cjs +43 -8
- package/dist/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.d.ts +25 -3
- package/dist/agent-runtime/src/messages.js +43 -8
- package/dist/agent-runtime/src/messages.js.map +1 -1
- package/dist/agent-runtime/src/offline-status.cjs +36 -0
- package/dist/agent-runtime/src/offline-status.cjs.map +1 -0
- package/dist/agent-runtime/src/offline-status.d.ts +118 -3
- package/dist/agent-runtime/src/offline-status.js +36 -0
- package/dist/agent-runtime/src/offline-status.js.map +1 -0
- package/dist/agent-runtime/src/queue.cjs +0 -9
- package/dist/agent-runtime/src/queue.cjs.map +1 -1
- package/dist/agent-runtime/src/queue.js +0 -9
- package/dist/agent-runtime/src/queue.js.map +1 -1
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +9 -9
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
- package/dist/agent-runtime/src/runtime-catalog.cjs +42 -0
- package/dist/agent-runtime/src/runtime-catalog.cjs.map +1 -0
- package/dist/agent-runtime/src/runtime-catalog.d.ts +35 -0
- package/dist/agent-runtime/src/runtime-catalog.js +42 -0
- package/dist/agent-runtime/src/runtime-catalog.js.map +1 -0
- package/dist/agent-runtime/src/runtime-messages.cjs.map +1 -1
- package/dist/agent-runtime/src/runtime-messages.d.ts +1 -1
- package/dist/agent-runtime/src/runtime-messages.js.map +1 -1
- package/dist/agent-runtime/src/runtime.d.ts +40 -0
- package/dist/agent-runtime/src/statewire-suspended.cjs +3 -3
- package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
- package/dist/agent-runtime/src/subagents.cjs +32 -2
- package/dist/agent-runtime/src/subagents.cjs.map +1 -1
- package/dist/agent-runtime/src/subagents.d.ts +9 -0
- package/dist/agent-runtime/src/subagents.js +30 -0
- package/dist/agent-runtime/src/subagents.js.map +1 -1
- package/dist/agent-runtime/src/thread-driver.cjs +67 -0
- package/dist/agent-runtime/src/thread-driver.cjs.map +1 -0
- package/dist/agent-runtime/src/thread-driver.d.ts +49 -0
- package/dist/agent-runtime/src/thread-driver.js +67 -0
- package/dist/agent-runtime/src/thread-driver.js.map +1 -0
- package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +172 -0
- package/dist/agent-runtime/src/thread-handoff-protocol.d.ts +756 -0
- package/dist/agent-runtime/src/thread-handoff-qr.d.ts +11 -0
- package/dist/agent-runtime/src/thread-handoff.d.ts +3 -364
- package/dist/agent-runtime/src/thread-status.cjs +3 -3
- package/dist/agent-runtime/src/thread-status.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.cjs +210 -25
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.d.ts +12 -0
- package/dist/agent-runtime/src/tool-metadata.js +210 -25
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/agent-runtime/src/tool-names.cjs +2 -0
- package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-names.d.ts +2 -0
- package/dist/agent-runtime/src/tool-names.js +2 -0
- package/dist/agent-runtime/src/tool-names.js.map +1 -1
- package/dist/agent-runtime/src/types.d.ts +10 -2
- package/dist/agent-runtime/src/use-conversation-list.cjs +11 -11
- package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +24 -19
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +2 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +6 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-config.cjs +14 -14
- package/dist/agent-runtime/src/use-deep-agent-config.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +6 -6
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +16 -16
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs +45 -45
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs +547 -124
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +129 -10
- package/dist/agent-runtime/src/use-deep-agent-voice.js +487 -64
- package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs +26 -26
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -1
- package/dist/agent-runtime/src/use-historical-edit-attachments.cjs +4 -4
- package/dist/agent-runtime/src/use-historical-edit-attachments.cjs.map +1 -1
- package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +28 -26
- package/dist/agent-runtime/src/voice-media.cjs +117 -0
- package/dist/agent-runtime/src/voice-media.cjs.map +1 -0
- package/dist/agent-runtime/src/voice-media.d.ts +49 -0
- package/dist/agent-runtime/src/voice-media.js +117 -0
- package/dist/agent-runtime/src/voice-media.js.map +1 -0
- package/dist/agent-runtime/src/voice-wire-types.d.ts +32 -0
- package/dist/assets/AssetPanel.cjs +11 -11
- package/dist/assets/AssetPanel.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.cjs +11 -9
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.d.ts +7 -0
- package/dist/assets/AthenaAssetEmbed.js +4 -2
- package/dist/assets/AthenaAssetEmbed.js.map +1 -1
- package/dist/assets/AthenaLayout.cjs +16 -16
- package/dist/assets/AthenaLayout.cjs.map +1 -1
- package/dist/assets/use-asset-content.cjs +4 -4
- package/dist/assets/use-asset-content.cjs.map +1 -1
- package/dist/assets/use-asset-embed.cjs +14 -7
- package/dist/assets/use-asset-embed.cjs.map +1 -1
- package/dist/assets/use-asset-embed.d.ts +11 -1
- package/dist/assets/use-asset-embed.js +10 -3
- package/dist/assets/use-asset-embed.js.map +1 -1
- package/dist/auth/AthenaAuthContext.cjs +3 -3
- package/dist/auth/AthenaAuthContext.cjs.map +1 -1
- package/dist/auth/AthenaAuthProvider.cjs +8 -8
- package/dist/auth/AthenaAuthProvider.cjs.map +1 -1
- package/dist/auth/AthenaCredentialSourceContext.cjs +5 -5
- package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
- package/dist/auth/AthenaSSOProvider.cjs +14 -14
- package/dist/auth/AthenaSSOProvider.cjs.map +1 -1
- package/dist/auth/credential-source.cjs +26 -13
- package/dist/auth/credential-source.cjs.map +1 -1
- package/dist/auth/credential-source.d.ts +8 -0
- package/dist/auth/credential-source.js +26 -13
- package/dist/auth/credential-source.js.map +1 -1
- package/dist/catalog/agent-model-options.cjs +25 -17
- package/dist/catalog/agent-model-options.cjs.map +1 -1
- package/dist/catalog/agent-model-options.d.ts +38 -5
- package/dist/catalog/agent-model-options.js +25 -17
- package/dist/catalog/agent-model-options.js.map +1 -1
- package/dist/catalog/channel-refusal.cjs +36 -0
- package/dist/catalog/channel-refusal.cjs.map +1 -0
- package/dist/catalog/channel-refusal.d.ts +29 -0
- package/dist/catalog/channel-refusal.js +36 -0
- package/dist/catalog/channel-refusal.js.map +1 -0
- package/dist/catalog/chat-pickers.cjs +60 -24
- package/dist/catalog/chat-pickers.cjs.map +1 -1
- package/dist/catalog/chat-pickers.d.ts +12 -2
- package/dist/catalog/chat-pickers.js +56 -20
- package/dist/catalog/chat-pickers.js.map +1 -1
- package/dist/catalog/runtime-catalog.cjs +89 -23
- package/dist/catalog/runtime-catalog.cjs.map +1 -1
- package/dist/catalog/runtime-catalog.d.ts +8 -2
- package/dist/catalog/runtime-catalog.js +83 -17
- package/dist/catalog/runtime-catalog.js.map +1 -1
- package/dist/catalog/use-athena-chat-mode.cjs +12 -12
- package/dist/catalog/use-athena-chat-mode.cjs.map +1 -1
- package/dist/chat/AthenaChat.cjs +155 -67
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +42 -2
- package/dist/chat/AthenaChat.js +106 -18
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/AthenaChatErrorBoundary.cjs +3 -3
- package/dist/chat/AthenaChatErrorBoundary.cjs.map +1 -1
- package/dist/chat/DrivingOnChip.cjs +23 -0
- package/dist/chat/DrivingOnChip.cjs.map +1 -0
- package/dist/chat/DrivingOnChip.d.ts +17 -0
- package/dist/chat/DrivingOnChip.js +23 -0
- package/dist/chat/DrivingOnChip.js.map +1 -0
- package/dist/chat/StatewireApprovalCard.cjs +125 -31
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +73 -1
- package/dist/chat/StatewireApprovalCard.js +115 -21
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireClientToolBridge.cjs +2 -2
- package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +25 -63
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +11 -13
- package/dist/chat/StatewireQueuedMessages.js +16 -54
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/WaitingOnYouBanner.cjs +3 -3
- package/dist/chat/WaitingOnYouBanner.cjs.map +1 -1
- package/dist/chat/athena-chat-welcome.cjs +2 -2
- package/dist/chat/athena-chat-welcome.cjs.map +1 -1
- package/dist/chat/athena-citation-links.cjs +5 -5
- package/dist/chat/athena-citation-links.cjs.map +1 -1
- package/dist/chat/athena-composer-controls.cjs +26 -16
- package/dist/chat/athena-composer-controls.cjs.map +1 -1
- package/dist/chat/athena-composer-controls.d.ts +6 -0
- package/dist/chat/athena-composer-controls.js +26 -16
- package/dist/chat/athena-composer-controls.js.map +1 -1
- package/dist/chat/athena-turn-end-status.cjs +42 -0
- package/dist/chat/athena-turn-end-status.cjs.map +1 -0
- package/dist/chat/athena-turn-end-status.d.ts +24 -0
- package/dist/chat/athena-turn-end-status.js +42 -0
- package/dist/chat/athena-turn-end-status.js.map +1 -0
- package/dist/chat/browser-decision-check.cjs +131 -0
- package/dist/chat/browser-decision-check.cjs.map +1 -0
- package/dist/chat/browser-decision-check.d.ts +61 -0
- package/dist/chat/browser-decision-check.js +131 -0
- package/dist/chat/browser-decision-check.js.map +1 -0
- package/dist/chat/chat-outbox-rows.cjs +3 -3
- package/dist/chat/chat-outbox-rows.cjs.map +1 -1
- package/dist/chat/chat-voice-controls.cjs +93 -28
- package/dist/chat/chat-voice-controls.cjs.map +1 -1
- package/dist/chat/chat-voice-controls.d.ts +36 -2
- package/dist/chat/chat-voice-controls.js +89 -24
- package/dist/chat/chat-voice-controls.js.map +1 -1
- package/dist/chat/composer-keyboard-hint.cjs +5 -5
- package/dist/chat/composer-keyboard-hint.cjs.map +1 -1
- package/dist/chat/device-operation.cjs +29 -0
- package/dist/chat/device-operation.cjs.map +1 -0
- package/dist/chat/device-operation.d.ts +34 -0
- package/dist/chat/device-operation.js +29 -0
- package/dist/chat/device-operation.js.map +1 -0
- package/dist/chat/super-grouping/CollapsibleGroup.cjs +14 -14
- package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -1
- package/dist/chat/super-grouping/GroupedMessageParts.cjs +4 -4
- package/dist/chat/super-grouping/GroupedMessageParts.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs +52 -36
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +19 -4
- package/dist/chat/super-grouping/SuperGroupingCard.js +29 -13
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +32 -32
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.js +3 -3
- package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.cjs +73 -40
- package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.d.ts +10 -2
- package/dist/chat/super-grouping/ToolTimeline.js +69 -36
- package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs +47 -12
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +21 -0
- package/dist/chat/super-grouping/activity-timeline.js +47 -12
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/super-grouping/grouping-function.cjs +4 -0
- package/dist/chat/super-grouping/grouping-function.cjs.map +1 -1
- package/dist/chat/super-grouping/grouping-function.d.ts +7 -0
- package/dist/chat/super-grouping/grouping-function.js +5 -1
- package/dist/chat/super-grouping/grouping-function.js.map +1 -1
- package/dist/chat/super-grouping/index.cjs +6 -0
- package/dist/chat/super-grouping/index.cjs.map +1 -1
- package/dist/chat/super-grouping/index.d.ts +5 -2
- package/dist/chat/super-grouping/index.js +7 -1
- package/dist/chat/super-grouping/index.js.map +1 -1
- package/dist/chat/super-grouping/tool-part-placement.cjs +17 -0
- package/dist/chat/super-grouping/tool-part-placement.cjs.map +1 -0
- package/dist/chat/super-grouping/tool-part-placement.d.ts +22 -0
- package/dist/chat/super-grouping/tool-part-placement.js +17 -0
- package/dist/chat/super-grouping/tool-part-placement.js.map +1 -0
- package/dist/chat/thread-scroll-to-bottom.cjs +2 -2
- package/dist/chat/thread-scroll-to-bottom.cjs.map +1 -1
- package/dist/chat/thread-scroll-to-bottom.d.ts +10 -7
- package/dist/chat/thread-scroll-to-bottom.js +2 -2
- package/dist/chat/thread-scroll-to-bottom.js.map +1 -1
- package/dist/chat/tooltip-icon-button.cjs +2 -2
- package/dist/chat/tooltip-icon-button.cjs.map +1 -1
- package/dist/chat/use-athena-voice-live.cjs +11 -0
- package/dist/chat/use-athena-voice-live.cjs.map +1 -0
- package/dist/chat/use-athena-voice-live.d.ts +11 -0
- package/dist/chat/use-athena-voice-live.js +11 -0
- package/dist/chat/use-athena-voice-live.js.map +1 -0
- package/dist/chat/use-statewire-approval-request.cjs +56 -24
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.d.ts +33 -4
- package/dist/chat/use-statewire-approval-request.js +41 -9
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/auth/sign-in-card.cjs +2 -2
- package/dist/chat-ui/auth/sign-in-card.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.cjs +138 -107
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +20 -4
- package/dist/chat-ui/composer/tiptap-composer.js +85 -54
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/header/conversation-history-panel.cjs +49 -23
- package/dist/chat-ui/header/conversation-history-panel.cjs.map +1 -1
- package/dist/chat-ui/header/conversation-history-panel.d.ts +12 -1
- package/dist/chat-ui/header/conversation-history-panel.js +38 -12
- package/dist/chat-ui/header/conversation-history-panel.js.map +1 -1
- package/dist/chat-ui/index.cjs +18 -0
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +7 -1
- package/dist/chat-ui/index.js +18 -0
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +4 -4
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs +10 -9
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js +3 -2
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs +29 -6
- package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +7 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.js +25 -2
- package/dist/chat-ui/mentions/suggestions/components/menu-list.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +3 -3
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs +56 -2
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.d.ts +12 -0
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.js +56 -2
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +24 -3
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +7 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js +24 -3
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +35 -13
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +15 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +28 -6
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs +9 -6
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.d.ts +3 -0
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js +5 -2
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js.map +1 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs +45 -10
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs.map +1 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.d.ts +24 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.js +46 -11
- package/dist/chat-ui/mentions/use-account-workspace-id.js.map +1 -1
- package/dist/chat-ui/mentions/use-member-avatar.cjs +4 -4
- package/dist/chat-ui/mentions/use-member-avatar.cjs.map +1 -1
- package/dist/chat-ui/mentions/use-mention-asset.cjs +3 -3
- package/dist/chat-ui/mentions/use-mention-asset.cjs.map +1 -1
- package/dist/chat-ui/messages/answer-label.cjs +42 -0
- package/dist/chat-ui/messages/answer-label.cjs.map +1 -0
- package/dist/chat-ui/messages/answer-label.d.ts +33 -0
- package/dist/chat-ui/messages/answer-label.js +42 -0
- package/dist/chat-ui/messages/answer-label.js.map +1 -0
- package/dist/chat-ui/messages/arrival-animation.cjs +13 -0
- package/dist/chat-ui/messages/arrival-animation.cjs.map +1 -0
- package/dist/chat-ui/messages/arrival-animation.d.ts +14 -0
- package/dist/chat-ui/messages/arrival-animation.js +13 -0
- package/dist/chat-ui/messages/arrival-animation.js.map +1 -0
- package/dist/chat-ui/messages/continue-pill.cjs +5 -5
- package/dist/chat-ui/messages/continue-pill.cjs.map +1 -1
- package/dist/chat-ui/messages/handoff-arrival-divider.cjs +44 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.cjs.map +1 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.d.ts +17 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.js +44 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.js.map +1 -0
- package/dist/chat-ui/messages/message-actions-config.cjs +3 -3
- package/dist/chat-ui/messages/message-actions-config.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.cjs +8 -4
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.js +5 -1
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/messages/message-images.cjs +66 -0
- package/dist/chat-ui/messages/message-images.cjs.map +1 -0
- package/dist/chat-ui/messages/message-images.d.ts +16 -0
- package/dist/chat-ui/messages/message-images.js +66 -0
- package/dist/chat-ui/messages/message-images.js.map +1 -0
- package/dist/chat-ui/messages/user-edit-composer.cjs +2 -2
- package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
- package/dist/chat-ui/messages/wake-marker.cjs +3 -3
- package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-link.cjs +2 -2
- package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.cjs +8 -8
- package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-node-views.cjs +6 -6
- package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -1
- package/dist/chat-ui/rich-text/dom-output-spec.cjs +2 -2
- package/dist/chat-ui/rich-text/dom-output-spec.cjs.map +1 -1
- package/dist/chat-ui/statewire.cjs +3 -0
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.d.ts +2 -1
- package/dist/chat-ui/statewire.js +3 -0
- package/dist/chat-ui/statewire.js.map +1 -1
- package/dist/chat-ui/thread/chat-thread-shell.cjs +43 -14
- package/dist/chat-ui/thread/chat-thread-shell.cjs.map +1 -1
- package/dist/chat-ui/thread/chat-thread-shell.d.ts +16 -2
- package/dist/chat-ui/thread/chat-thread-shell.js +35 -6
- package/dist/chat-ui/thread/chat-thread-shell.js.map +1 -1
- package/dist/chat-ui/thread/composer-send-or-stop.cjs +30 -20
- package/dist/chat-ui/thread/composer-send-or-stop.cjs.map +1 -1
- package/dist/chat-ui/thread/composer-send-or-stop.d.ts +8 -0
- package/dist/chat-ui/thread/composer-send-or-stop.js +29 -19
- package/dist/chat-ui/thread/composer-send-or-stop.js.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +20 -21
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.js +3 -4
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/chat-ui/thread/thread-loading-overlay.cjs +5 -5
- package/dist/chat-ui/thread/thread-loading-overlay.cjs.map +1 -1
- package/dist/collab/client.cjs +40 -3
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +25 -0
- package/dist/collab/client.js +40 -3
- package/dist/collab/client.js.map +1 -1
- package/dist/collab/document-status.cjs +150 -0
- package/dist/collab/document-status.cjs.map +1 -0
- package/dist/collab/document-status.d.ts +68 -0
- package/dist/collab/document-status.js +150 -0
- package/dist/collab/document-status.js.map +1 -0
- package/dist/collab/index.cjs +7 -0
- package/dist/collab/index.cjs.map +1 -1
- package/dist/collab/index.d.ts +6 -1
- package/dist/collab/index.js +7 -0
- package/dist/collab/index.js.map +1 -1
- package/dist/collab/presence-react.cjs +11 -11
- package/dist/collab/presence-react.cjs.map +1 -1
- package/dist/collab/react.cjs +6 -6
- package/dist/collab/react.cjs.map +1 -1
- package/dist/composer/AttachmentContext.cjs +24 -11
- package/dist/composer/AttachmentContext.cjs.map +1 -1
- package/dist/composer/AttachmentContext.js +18 -5
- package/dist/composer/AttachmentContext.js.map +1 -1
- package/dist/composer/ComposerAttachmentPreview.cjs +78 -23
- package/dist/composer/ComposerAttachmentPreview.cjs.map +1 -1
- package/dist/composer/ComposerAttachmentPreview.d.ts +5 -3
- package/dist/composer/ComposerAttachmentPreview.js +79 -24
- package/dist/composer/ComposerAttachmentPreview.js.map +1 -1
- package/dist/composer/ComposerDropZone.cjs +7 -7
- package/dist/composer/ComposerDropZone.cjs.map +1 -1
- package/dist/composer/FileUploadButton.cjs +37 -22
- package/dist/composer/FileUploadButton.cjs.map +1 -1
- package/dist/composer/FileUploadButton.d.ts +6 -0
- package/dist/composer/FileUploadButton.js +34 -19
- package/dist/composer/FileUploadButton.js.map +1 -1
- package/dist/composer/QuoteContext.cjs +8 -8
- package/dist/composer/QuoteContext.cjs.map +1 -1
- package/dist/composer/composer-handoff.cjs +4 -4
- package/dist/composer/composer-handoff.cjs.map +1 -1
- package/dist/composer/useAppendToComposer.cjs +4 -4
- package/dist/composer/useAppendToComposer.cjs.map +1 -1
- package/dist/composer/useAttachFiles.cjs +23 -6
- package/dist/composer/useAttachFiles.cjs.map +1 -1
- package/dist/composer/useAttachFiles.d.ts +15 -7
- package/dist/composer/useAttachFiles.js +22 -5
- package/dist/composer/useAttachFiles.js.map +1 -1
- package/dist/composer/useComposerAttachment.cjs +4 -4
- package/dist/composer/useComposerAttachment.cjs.map +1 -1
- package/dist/composer/useFileUpload.cjs +21 -16
- package/dist/composer/useFileUpload.cjs.map +1 -1
- package/dist/composer/useFileUpload.d.ts +12 -0
- package/dist/composer/useFileUpload.js +12 -7
- package/dist/composer/useFileUpload.js.map +1 -1
- package/dist/composer/useReadComposerDraft.cjs +2 -2
- package/dist/composer/useReadComposerDraft.cjs.map +1 -1
- package/dist/composer/useSendMessage.cjs +4 -4
- package/dist/composer/useSendMessage.cjs.map +1 -1
- package/dist/diagnostics/useAthenaDiagnostics.cjs +4 -4
- package/dist/diagnostics/useAthenaDiagnostics.cjs.map +1 -1
- package/dist/dictation/audio-level-history.cjs +3 -3
- package/dist/dictation/audio-level-history.cjs.map +1 -1
- package/dist/dictation/dictation-controls.cjs +24 -20
- package/dist/dictation/dictation-controls.cjs.map +1 -1
- package/dist/dictation/dictation-controls.d.ts +6 -1
- package/dist/dictation/dictation-controls.js +24 -20
- package/dist/dictation/dictation-controls.js.map +1 -1
- package/dist/dictation/use-athena-dictation-engine.cjs +3 -3
- package/dist/dictation/use-athena-dictation-engine.cjs.map +1 -1
- package/dist/dictation/use-dictation.cjs +22 -22
- package/dist/dictation/use-dictation.cjs.map +1 -1
- package/dist/index.cjs +26 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -3
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/dist/keryx-http/src/receive-only-socket.cjs +40 -0
- package/dist/keryx-http/src/receive-only-socket.cjs.map +1 -0
- package/dist/keryx-http/src/receive-only-socket.d.ts +27 -0
- package/dist/keryx-http/src/receive-only-socket.js +40 -0
- package/dist/keryx-http/src/receive-only-socket.js.map +1 -0
- package/dist/keryx-http/src/update-attributions.cjs +111 -0
- package/dist/keryx-http/src/update-attributions.cjs.map +1 -0
- package/dist/keryx-http/src/update-attributions.d.ts +75 -0
- package/dist/keryx-http/src/update-attributions.js +111 -0
- package/dist/keryx-http/src/update-attributions.js.map +1 -0
- package/dist/lib/owner-document.cjs +6 -6
- package/dist/lib/owner-document.cjs.map +1 -1
- package/dist/lib/use-athena-rest-query.cjs +4 -4
- package/dist/lib/use-athena-rest-query.cjs.map +1 -1
- package/dist/lib/use-document-active.cjs +4 -4
- package/dist/lib/use-document-active.cjs.map +1 -1
- package/dist/lib/use-prefers-reduced-motion.cjs +2 -2
- package/dist/lib/use-prefers-reduced-motion.cjs.map +1 -1
- package/dist/offline/offline-history.cjs +7 -7
- package/dist/offline/offline-history.cjs.map +1 -1
- package/dist/provider/AthenaContext.cjs +3 -3
- package/dist/provider/AthenaContext.cjs.map +1 -1
- package/dist/provider/AthenaProvider.cjs +116 -79
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.js +40 -3
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/provider/PostHogProvider.cjs +2 -2
- package/dist/provider/PostHogProvider.cjs.map +1 -1
- package/dist/provider/agent-selection-context.cjs +2 -2
- package/dist/provider/agent-selection-context.cjs.map +1 -1
- package/dist/provider/chat-mode-context.cjs +2 -2
- package/dist/provider/chat-mode-context.cjs.map +1 -1
- package/dist/provider/session-persistence-context.cjs +10 -0
- package/dist/provider/session-persistence-context.cjs.map +1 -0
- package/dist/provider/session-persistence-context.d.ts +15 -0
- package/dist/provider/session-persistence-context.js +10 -0
- package/dist/provider/session-persistence-context.js.map +1 -0
- package/dist/provider/statewire-history-context.cjs +4 -4
- package/dist/provider/statewire-history-context.cjs.map +1 -1
- package/dist/provider/statewire-lifecycle-context.cjs +3 -3
- package/dist/provider/statewire-lifecycle-context.cjs.map +1 -1
- package/dist/provider/statewire-window-context.cjs +3 -3
- package/dist/provider/statewire-window-context.cjs.map +1 -1
- package/dist/provider/theme-style-context.cjs +3 -3
- package/dist/provider/theme-style-context.cjs.map +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs +10 -10
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
- package/dist/runtime/auth-refusal-restart.cjs +7 -7
- package/dist/runtime/auth-refusal-restart.cjs.map +1 -1
- package/dist/runtime/auth.cjs +13 -13
- package/dist/runtime/auth.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.cjs +1 -0
- package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.d.ts +3 -1
- package/dist/runtime/statewire-lifecycle.js +2 -1
- package/dist/runtime/statewire-lifecycle.js.map +1 -1
- package/dist/runtime/statewire-server-lane-context.cjs +2 -2
- package/dist/runtime/statewire-server-lane-context.cjs.map +1 -1
- package/dist/runtime/statewire-session-lane.cjs +4 -4
- package/dist/runtime/statewire-session-lane.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +10 -8
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +2 -0
- package/dist/runtime/useAthenaStatewireRuntime.js +2 -0
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/threads/Inbox.cjs +8 -8
- package/dist/threads/Inbox.cjs.map +1 -1
- package/dist/threads/SessionList.cjs +9 -9
- package/dist/threads/SessionList.cjs.map +1 -1
- package/dist/threads/SessionsPage.cjs +11 -11
- package/dist/threads/SessionsPage.cjs.map +1 -1
- package/dist/threads/index-triggered-refresh.cjs +10 -10
- package/dist/threads/index-triggered-refresh.cjs.map +1 -1
- package/dist/threads/mark-viewed-thread-read.cjs +12 -12
- package/dist/threads/mark-viewed-thread-read.cjs.map +1 -1
- package/dist/threads/offline-session-list.cjs +3 -3
- package/dist/threads/offline-session-list.cjs.map +1 -1
- package/dist/threads/session-list-tab-share.cjs +5 -5
- package/dist/threads/session-list-tab-share.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.cjs +51 -51
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/thread-id-context.cjs +5 -5
- package/dist/threads/thread-id-context.cjs.map +1 -1
- package/dist/threads/use-athena-session-attention.cjs +2 -2
- package/dist/threads/use-athena-session-attention.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.cjs +10 -10
- package/dist/threads/use-athena-sessions.cjs.map +1 -1
- package/dist/threads/use-athena-thread-model.cjs +3 -3
- package/dist/threads/use-athena-thread-model.cjs.map +1 -1
- package/dist/threads/use-rest-conversation-history.cjs +3 -3
- package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
- package/dist/threads/use-statewire-conversation-history.cjs +8 -8
- package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
- package/dist/threads/use-thread-archive.cjs +9 -9
- package/dist/threads/use-thread-archive.cjs.map +1 -1
- package/dist/threads/use-thread-favorite.cjs +2 -2
- package/dist/threads/use-thread-favorite.cjs.map +1 -1
- package/dist/threads/use-thread-field-override.cjs +20 -20
- package/dist/threads/use-thread-field-override.cjs.map +1 -1
- package/dist/threads/use-thread-read-state.cjs +4 -4
- package/dist/threads/use-thread-read-state.cjs.map +1 -1
- package/dist/threads/use-thread-rename.cjs +2 -2
- package/dist/threads/use-thread-rename.cjs.map +1 -1
- package/dist/threads/useAthenaThreadManager.cjs +2 -2
- package/dist/threads/useAthenaThreadManager.cjs.map +1 -1
- package/dist/tools/NestedPtcMessages.cjs +6 -6
- package/dist/tools/NestedPtcMessages.cjs.map +1 -1
- package/dist/tools/append-document-tool-ui.cjs +7 -7
- package/dist/tools/append-document-tool-ui.cjs.map +1 -1
- package/dist/tools/file-tool-uis.cjs +2 -2
- package/dist/tools/file-tool-uis.cjs.map +1 -1
- package/dist/tools/misc-tool-uis.cjs +2 -2
- package/dist/tools/misc-tool-uis.cjs.map +1 -1
- package/dist/tools/primitives.cjs +6 -6
- package/dist/tools/primitives.cjs.map +1 -1
- package/dist/tools/read-asset-tool-ui.cjs +6 -6
- package/dist/tools/read-asset-tool-ui.cjs.map +1 -1
- package/dist/tools/subagent-task-tool-ui.cjs +21 -21
- package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
- package/dist/tools/test-recording-tool-uis.cjs +16 -16
- package/dist/tools/test-recording-tool-uis.cjs.map +1 -1
- package/dist/tools/todo-plan-store.cjs +4 -4
- package/dist/tools/todo-plan-store.cjs.map +1 -1
- package/dist/tools/tool-appearance.cjs +3 -3
- package/dist/tools/tool-appearance.cjs.map +1 -1
- package/dist/tools/tool-fallback.cjs +14 -14
- package/dist/tools/tool-fallback.cjs.map +1 -1
- package/dist/tools/tool-uis.cjs +74 -74
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/use-elapsed-seconds.cjs +3 -3
- package/dist/tools/use-elapsed-seconds.cjs.map +1 -1
- package/dist/tools/write-todos-tool-ui.cjs +9 -9
- package/dist/tools/write-todos-tool-ui.cjs.map +1 -1
- package/dist/ui/image-viewer.cjs +382 -0
- package/dist/ui/image-viewer.cjs.map +1 -0
- package/dist/ui/image-viewer.d.ts +50 -0
- package/dist/ui/image-viewer.js +382 -0
- package/dist/ui/image-viewer.js.map +1 -0
- package/dist/voice/chat.cjs +6 -0
- package/dist/voice/chat.cjs.map +1 -1
- package/dist/voice/chat.d.ts +1 -1
- package/dist/voice/chat.js +8 -2
- package/dist/voice/livekit-join.cjs +52 -101
- package/dist/voice/livekit-join.cjs.map +1 -1
- package/dist/voice/livekit-join.d.ts +1 -6
- package/dist/voice/livekit-join.js +52 -101
- package/dist/voice/livekit-join.js.map +1 -1
- package/dist/voice/livekit.cjs.map +1 -1
- package/dist/voice/livekit.d.ts +11 -1
- package/dist/voice/livekit.js.map +1 -1
- package/dist/voice/use-athena-voice-session.cjs +34 -34
- package/dist/voice/use-athena-voice-session.cjs.map +1 -1
- package/dist/workbench/ComputerLiveDesktop.cjs +13 -13
- package/dist/workbench/ComputerLiveDesktop.cjs.map +1 -1
- package/dist/workbench/SessionWorkbench.cjs +22 -22
- package/dist/workbench/SessionWorkbench.cjs.map +1 -1
- package/dist/workbench/session-workbench-context.cjs +3 -3
- package/dist/workbench/session-workbench-context.cjs.map +1 -1
- package/dist/workbench/session-workbench-panes.cjs +8 -8
- package/dist/workbench/session-workbench-panes.cjs.map +1 -1
- package/dist/workbench/workbench-layout-context.cjs +3 -3
- package/dist/workbench/workbench-layout-context.cjs.map +1 -1
- package/package.json +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const TASK_TOOL_NAME = "task";
|
|
4
|
+
const EVAL_TOOL_NAME = "eval";
|
|
4
5
|
const EXECUTE_TOOL_NAME = "execute";
|
|
5
6
|
const WRITE_FILE_TOOL_NAME = "write_file";
|
|
6
7
|
const EDIT_FILE_TOOL_NAME = "edit_file";
|
|
@@ -65,6 +66,7 @@ function salientToolCallDetail(toolCall) {
|
|
|
65
66
|
exports.CANCEL_ASYNC_TASK_TOOL_NAME = CANCEL_ASYNC_TASK_TOOL_NAME;
|
|
66
67
|
exports.CHECK_ASYNC_TASK_TOOL_NAME = CHECK_ASYNC_TASK_TOOL_NAME;
|
|
67
68
|
exports.EDIT_FILE_TOOL_NAME = EDIT_FILE_TOOL_NAME;
|
|
69
|
+
exports.EVAL_TOOL_NAME = EVAL_TOOL_NAME;
|
|
68
70
|
exports.EXECUTE_TOOL_NAME = EXECUTE_TOOL_NAME;
|
|
69
71
|
exports.QUIET_TOOL_NAMES = QUIET_TOOL_NAMES;
|
|
70
72
|
exports.START_ASYNC_TASK_TOOL_NAME = START_ASYNC_TASK_TOOL_NAME;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-names.cjs","sources":["../../../../agent-runtime/src/tool-names.ts"],"sourcesContent":["/**\n * Names of the deepagents built-in tools as they appear on the wire, plus the\n * shared arg shapes / display derivations keyed on those names. One home so\n * tool cards, activity panels, and transcript renderers on every surface agree\n * on which call is which.\n */\nimport type { LangChainToolCall } from \"@assistant-ui/react-langgraph\";\n\n/** The built-in deepagents delegation tool; a `task` call spawns a subagent. */\nexport const TASK_TOOL_NAME = \"task\";\n/** The QuickJS code-interpreter tool (langchain_quickjs middleware). */\nexport const EVAL_TOOL_NAME = \"eval\";\n/** The built-in deepagents sandbox shell tool. */\nexport const EXECUTE_TOOL_NAME = \"execute\";\n/**\n * The Athena studio code executors: sandboxed Python whose SDK calls the\n * backend records as PTC sub-calls, exactly like `execute` / `eval`.\n */\nexport const RUN_PYTHON_CODE_TOOL_NAME = \"run_python_code\";\nexport const EXECUTE_PRESENTATION_CODE_TOOL_NAME = \"execute_presentation_code\";\nexport const EXECUTE_SPREADSHEET_CODE_TOOL_NAME = \"execute_spreadsheet_code\";\nexport const EXECUTE_WORD_DOCUMENT_CODE_TOOL_NAME = \"execute_word_document_code\";\n/** Every tool whose ToolMessage artifact may carry promoted PTC sub-calls. */\nexport const PTC_PARENT_TOOL_NAMES: ReadonlySet<string> = new Set<string>([\n EXECUTE_TOOL_NAME,\n EVAL_TOOL_NAME,\n RUN_PYTHON_CODE_TOOL_NAME,\n EXECUTE_PRESENTATION_CODE_TOOL_NAME,\n EXECUTE_SPREADSHEET_CODE_TOOL_NAME,\n EXECUTE_WORD_DOCUMENT_CODE_TOOL_NAME,\n]);\n/** The built-in deepagents filesystem write/edit tools. */\nexport const WRITE_FILE_TOOL_NAME = \"write_file\";\nexport const EDIT_FILE_TOOL_NAME = \"edit_file\";\n\n/**\n * Tools whose calls render nothing in chat: no card, no status line. The call\n * and its result stay in the stored transcript and in exports; only the\n * conversation view leaves them out (see `convertDeepAgentMessage`).\n */\nexport const SUBMIT_FEEDBACK_TOOL_NAME = \"submit_feedback\";\nexport const QUIET_TOOL_NAMES: ReadonlySet<string> = new Set([SUBMIT_FEEDBACK_TOOL_NAME]);\n\n/**\n * The deepagents async-subagent tools (ADR 0006 coding workers ride these):\n * `start_async_task` launches a remote task, `check_async_task` polls it,\n * `update_async_task` sends a follow-up, `cancel_async_task` interrupts it.\n */\nexport const START_ASYNC_TASK_TOOL_NAME = \"start_async_task\";\nexport const CHECK_ASYNC_TASK_TOOL_NAME = \"check_async_task\";\nexport const UPDATE_ASYNC_TASK_TOOL_NAME = \"update_async_task\";\nexport const CANCEL_ASYNC_TASK_TOOL_NAME = \"cancel_async_task\";\nexport const LIST_ASYNC_TASKS_TOOL_NAME = \"list_async_tasks\";\nexport const ASYNC_TASK_TOOL_NAMES = [\n START_ASYNC_TASK_TOOL_NAME,\n CHECK_ASYNC_TASK_TOOL_NAME,\n UPDATE_ASYNC_TASK_TOOL_NAME,\n CANCEL_ASYNC_TASK_TOOL_NAME,\n LIST_ASYNC_TASKS_TOOL_NAME,\n] as const;\n\n/**\n * Args shape shared by `write_file` / `edit_file` (single source of truth for\n * both the tool card and the changed-files panel). `write_file` carries the\n * whole `content`; `edit_file` carries the `old_string` → `new_string`\n * replacement instead (deepagents `WriteFileSchema` / `EditFileSchema`).\n */\nexport type FileToolArgs = {\n file_path?: string;\n path?: string;\n content?: string;\n old_string?: string;\n new_string?: string;\n replace_all?: boolean;\n /** Cross-asset targeting: the sandbox-backed asset the tool acted on. */\n sandbox_asset_id?: string | null;\n};\n\n/**\n * Human-salient one-liner for a nested tool call — the argument a person would\n * glance at (`execute` → the command, file tools → the path, searches → the\n * query). Empty string when nothing salient exists; capped so the ticker line\n * can't blow out the card.\n */\nexport function salientToolCallDetail(toolCall: LangChainToolCall): string {\n const args = (toolCall.args ?? {}) as Record<string, unknown>;\n const firstString = (...keys: string[]): string => {\n for (const key of keys) {\n const value = args[key];\n if (typeof value === \"string\" && value) return value;\n }\n return \"\";\n };\n let detail: string;\n switch (toolCall.name) {\n case EXECUTE_TOOL_NAME:\n detail = firstString(\"command\");\n break;\n case WRITE_FILE_TOOL_NAME:\n case EDIT_FILE_TOOL_NAME:\n detail = firstString(\"file_path\", \"path\");\n break;\n case \"read_file\":\n case \"ls\":\n detail = firstString(\"file_path\", \"path\");\n break;\n case \"write_todos\": {\n const todos = args.todos;\n detail = Array.isArray(todos)\n ? `${todos.length} step${todos.length === 1 ? \"\" : \"s\"}`\n : \"\";\n break;\n }\n case TASK_TOOL_NAME:\n case START_ASYNC_TASK_TOOL_NAME:\n detail = firstString(\"description\", \"subagent_type\");\n break;\n case UPDATE_ASYNC_TASK_TOOL_NAME:\n detail = firstString(\"message\", \"task_id\");\n break;\n case CHECK_ASYNC_TASK_TOOL_NAME:\n case CANCEL_ASYNC_TASK_TOOL_NAME:\n detail = firstString(\"task_id\");\n break;\n default:\n detail = firstString(\n \"query\",\n \"pattern\",\n \"command\",\n \"path\",\n \"file_path\",\n \"url\",\n \"question\",\n );\n }\n const clean = detail.replace(/\\s+/g, \" \").trim();\n return clean.length > 80 ? `${clean.slice(0, 79)}…` : clean;\n}\n"],"names":[],"mappings":";;AASO,MAAM,iBAAiB;
|
|
1
|
+
{"version":3,"file":"tool-names.cjs","sources":["../../../../agent-runtime/src/tool-names.ts"],"sourcesContent":["/**\n * Names of the deepagents built-in tools as they appear on the wire, plus the\n * shared arg shapes / display derivations keyed on those names. One home so\n * tool cards, activity panels, and transcript renderers on every surface agree\n * on which call is which.\n */\nimport type { LangChainToolCall } from \"@assistant-ui/react-langgraph\";\n\n/** The built-in deepagents delegation tool; a `task` call spawns a subagent. */\nexport const TASK_TOOL_NAME = \"task\";\n/** The QuickJS code-interpreter tool (langchain_quickjs middleware). */\nexport const EVAL_TOOL_NAME = \"eval\";\n/** The built-in deepagents sandbox shell tool. */\nexport const EXECUTE_TOOL_NAME = \"execute\";\n/**\n * The Athena studio code executors: sandboxed Python whose SDK calls the\n * backend records as PTC sub-calls, exactly like `execute` / `eval`.\n */\nexport const RUN_PYTHON_CODE_TOOL_NAME = \"run_python_code\";\nexport const EXECUTE_PRESENTATION_CODE_TOOL_NAME = \"execute_presentation_code\";\nexport const EXECUTE_SPREADSHEET_CODE_TOOL_NAME = \"execute_spreadsheet_code\";\nexport const EXECUTE_WORD_DOCUMENT_CODE_TOOL_NAME = \"execute_word_document_code\";\n/** Every tool whose ToolMessage artifact may carry promoted PTC sub-calls. */\nexport const PTC_PARENT_TOOL_NAMES: ReadonlySet<string> = new Set<string>([\n EXECUTE_TOOL_NAME,\n EVAL_TOOL_NAME,\n RUN_PYTHON_CODE_TOOL_NAME,\n EXECUTE_PRESENTATION_CODE_TOOL_NAME,\n EXECUTE_SPREADSHEET_CODE_TOOL_NAME,\n EXECUTE_WORD_DOCUMENT_CODE_TOOL_NAME,\n]);\n/** The built-in deepagents filesystem write/edit tools. */\nexport const WRITE_FILE_TOOL_NAME = \"write_file\";\nexport const EDIT_FILE_TOOL_NAME = \"edit_file\";\n\n/**\n * Tools whose calls render nothing in chat: no card, no status line. The call\n * and its result stay in the stored transcript and in exports; only the\n * conversation view leaves them out (see `convertDeepAgentMessage`).\n */\nexport const SUBMIT_FEEDBACK_TOOL_NAME = \"submit_feedback\";\nexport const QUIET_TOOL_NAMES: ReadonlySet<string> = new Set([SUBMIT_FEEDBACK_TOOL_NAME]);\n\n/**\n * The deepagents async-subagent tools (ADR 0006 coding workers ride these):\n * `start_async_task` launches a remote task, `check_async_task` polls it,\n * `update_async_task` sends a follow-up, `cancel_async_task` interrupts it.\n */\nexport const START_ASYNC_TASK_TOOL_NAME = \"start_async_task\";\nexport const CHECK_ASYNC_TASK_TOOL_NAME = \"check_async_task\";\nexport const UPDATE_ASYNC_TASK_TOOL_NAME = \"update_async_task\";\nexport const CANCEL_ASYNC_TASK_TOOL_NAME = \"cancel_async_task\";\nexport const LIST_ASYNC_TASKS_TOOL_NAME = \"list_async_tasks\";\n/** The Agent Communication toolkit's synchronous ask of a listed collab agent. */\nexport const ASK_AGENT_TOOL_NAME = \"ask_agent\";\nexport const ASYNC_TASK_TOOL_NAMES = [\n START_ASYNC_TASK_TOOL_NAME,\n CHECK_ASYNC_TASK_TOOL_NAME,\n UPDATE_ASYNC_TASK_TOOL_NAME,\n CANCEL_ASYNC_TASK_TOOL_NAME,\n LIST_ASYNC_TASKS_TOOL_NAME,\n] as const;\n\n/**\n * Args shape shared by `write_file` / `edit_file` (single source of truth for\n * both the tool card and the changed-files panel). `write_file` carries the\n * whole `content`; `edit_file` carries the `old_string` → `new_string`\n * replacement instead (deepagents `WriteFileSchema` / `EditFileSchema`).\n */\nexport type FileToolArgs = {\n file_path?: string;\n path?: string;\n content?: string;\n old_string?: string;\n new_string?: string;\n replace_all?: boolean;\n /** Cross-asset targeting: the sandbox-backed asset the tool acted on. */\n sandbox_asset_id?: string | null;\n};\n\n/**\n * Human-salient one-liner for a nested tool call — the argument a person would\n * glance at (`execute` → the command, file tools → the path, searches → the\n * query). Empty string when nothing salient exists; capped so the ticker line\n * can't blow out the card.\n */\nexport function salientToolCallDetail(toolCall: LangChainToolCall): string {\n const args = (toolCall.args ?? {}) as Record<string, unknown>;\n const firstString = (...keys: string[]): string => {\n for (const key of keys) {\n const value = args[key];\n if (typeof value === \"string\" && value) return value;\n }\n return \"\";\n };\n let detail: string;\n switch (toolCall.name) {\n case EXECUTE_TOOL_NAME:\n detail = firstString(\"command\");\n break;\n case WRITE_FILE_TOOL_NAME:\n case EDIT_FILE_TOOL_NAME:\n detail = firstString(\"file_path\", \"path\");\n break;\n case \"read_file\":\n case \"ls\":\n detail = firstString(\"file_path\", \"path\");\n break;\n case \"write_todos\": {\n const todos = args.todos;\n detail = Array.isArray(todos)\n ? `${todos.length} step${todos.length === 1 ? \"\" : \"s\"}`\n : \"\";\n break;\n }\n case TASK_TOOL_NAME:\n case START_ASYNC_TASK_TOOL_NAME:\n detail = firstString(\"description\", \"subagent_type\");\n break;\n case UPDATE_ASYNC_TASK_TOOL_NAME:\n detail = firstString(\"message\", \"task_id\");\n break;\n case CHECK_ASYNC_TASK_TOOL_NAME:\n case CANCEL_ASYNC_TASK_TOOL_NAME:\n detail = firstString(\"task_id\");\n break;\n default:\n detail = firstString(\n \"query\",\n \"pattern\",\n \"command\",\n \"path\",\n \"file_path\",\n \"url\",\n \"question\",\n );\n }\n const clean = detail.replace(/\\s+/g, \" \").trim();\n return clean.length > 80 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F;AAEJ,QAAM,QAAQ,OAAO,QAAQ,QAAQ,GAAG,EAAE,KAAA;AAC1C,SAAO,MAAM,SAAS,KAAK,GAAG,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM;AACxD;;;;;;;;;;;;;"}
|
|
@@ -41,6 +41,8 @@ export declare const CHECK_ASYNC_TASK_TOOL_NAME = "check_async_task";
|
|
|
41
41
|
export declare const UPDATE_ASYNC_TASK_TOOL_NAME = "update_async_task";
|
|
42
42
|
export declare const CANCEL_ASYNC_TASK_TOOL_NAME = "cancel_async_task";
|
|
43
43
|
export declare const LIST_ASYNC_TASKS_TOOL_NAME = "list_async_tasks";
|
|
44
|
+
/** The Agent Communication toolkit's synchronous ask of a listed collab agent. */
|
|
45
|
+
export declare const ASK_AGENT_TOOL_NAME = "ask_agent";
|
|
44
46
|
export declare const ASYNC_TASK_TOOL_NAMES: readonly ["start_async_task", "check_async_task", "update_async_task", "cancel_async_task", "list_async_tasks"];
|
|
45
47
|
/**
|
|
46
48
|
* Args shape shared by `write_file` / `edit_file` (single source of truth for
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const TASK_TOOL_NAME = "task";
|
|
2
|
+
const EVAL_TOOL_NAME = "eval";
|
|
2
3
|
const EXECUTE_TOOL_NAME = "execute";
|
|
3
4
|
const WRITE_FILE_TOOL_NAME = "write_file";
|
|
4
5
|
const EDIT_FILE_TOOL_NAME = "edit_file";
|
|
@@ -64,6 +65,7 @@ export {
|
|
|
64
65
|
CANCEL_ASYNC_TASK_TOOL_NAME,
|
|
65
66
|
CHECK_ASYNC_TASK_TOOL_NAME,
|
|
66
67
|
EDIT_FILE_TOOL_NAME,
|
|
68
|
+
EVAL_TOOL_NAME,
|
|
67
69
|
EXECUTE_TOOL_NAME,
|
|
68
70
|
QUIET_TOOL_NAMES,
|
|
69
71
|
START_ASYNC_TASK_TOOL_NAME,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-names.js","sources":["../../../../agent-runtime/src/tool-names.ts"],"sourcesContent":["/**\n * Names of the deepagents built-in tools as they appear on the wire, plus the\n * shared arg shapes / display derivations keyed on those names. One home so\n * tool cards, activity panels, and transcript renderers on every surface agree\n * on which call is which.\n */\nimport type { LangChainToolCall } from \"@assistant-ui/react-langgraph\";\n\n/** The built-in deepagents delegation tool; a `task` call spawns a subagent. */\nexport const TASK_TOOL_NAME = \"task\";\n/** The QuickJS code-interpreter tool (langchain_quickjs middleware). */\nexport const EVAL_TOOL_NAME = \"eval\";\n/** The built-in deepagents sandbox shell tool. */\nexport const EXECUTE_TOOL_NAME = \"execute\";\n/**\n * The Athena studio code executors: sandboxed Python whose SDK calls the\n * backend records as PTC sub-calls, exactly like `execute` / `eval`.\n */\nexport const RUN_PYTHON_CODE_TOOL_NAME = \"run_python_code\";\nexport const EXECUTE_PRESENTATION_CODE_TOOL_NAME = \"execute_presentation_code\";\nexport const EXECUTE_SPREADSHEET_CODE_TOOL_NAME = \"execute_spreadsheet_code\";\nexport const EXECUTE_WORD_DOCUMENT_CODE_TOOL_NAME = \"execute_word_document_code\";\n/** Every tool whose ToolMessage artifact may carry promoted PTC sub-calls. */\nexport const PTC_PARENT_TOOL_NAMES: ReadonlySet<string> = new Set<string>([\n EXECUTE_TOOL_NAME,\n EVAL_TOOL_NAME,\n RUN_PYTHON_CODE_TOOL_NAME,\n EXECUTE_PRESENTATION_CODE_TOOL_NAME,\n EXECUTE_SPREADSHEET_CODE_TOOL_NAME,\n EXECUTE_WORD_DOCUMENT_CODE_TOOL_NAME,\n]);\n/** The built-in deepagents filesystem write/edit tools. */\nexport const WRITE_FILE_TOOL_NAME = \"write_file\";\nexport const EDIT_FILE_TOOL_NAME = \"edit_file\";\n\n/**\n * Tools whose calls render nothing in chat: no card, no status line. The call\n * and its result stay in the stored transcript and in exports; only the\n * conversation view leaves them out (see `convertDeepAgentMessage`).\n */\nexport const SUBMIT_FEEDBACK_TOOL_NAME = \"submit_feedback\";\nexport const QUIET_TOOL_NAMES: ReadonlySet<string> = new Set([SUBMIT_FEEDBACK_TOOL_NAME]);\n\n/**\n * The deepagents async-subagent tools (ADR 0006 coding workers ride these):\n * `start_async_task` launches a remote task, `check_async_task` polls it,\n * `update_async_task` sends a follow-up, `cancel_async_task` interrupts it.\n */\nexport const START_ASYNC_TASK_TOOL_NAME = \"start_async_task\";\nexport const CHECK_ASYNC_TASK_TOOL_NAME = \"check_async_task\";\nexport const UPDATE_ASYNC_TASK_TOOL_NAME = \"update_async_task\";\nexport const CANCEL_ASYNC_TASK_TOOL_NAME = \"cancel_async_task\";\nexport const LIST_ASYNC_TASKS_TOOL_NAME = \"list_async_tasks\";\nexport const ASYNC_TASK_TOOL_NAMES = [\n START_ASYNC_TASK_TOOL_NAME,\n CHECK_ASYNC_TASK_TOOL_NAME,\n UPDATE_ASYNC_TASK_TOOL_NAME,\n CANCEL_ASYNC_TASK_TOOL_NAME,\n LIST_ASYNC_TASKS_TOOL_NAME,\n] as const;\n\n/**\n * Args shape shared by `write_file` / `edit_file` (single source of truth for\n * both the tool card and the changed-files panel). `write_file` carries the\n * whole `content`; `edit_file` carries the `old_string` → `new_string`\n * replacement instead (deepagents `WriteFileSchema` / `EditFileSchema`).\n */\nexport type FileToolArgs = {\n file_path?: string;\n path?: string;\n content?: string;\n old_string?: string;\n new_string?: string;\n replace_all?: boolean;\n /** Cross-asset targeting: the sandbox-backed asset the tool acted on. */\n sandbox_asset_id?: string | null;\n};\n\n/**\n * Human-salient one-liner for a nested tool call — the argument a person would\n * glance at (`execute` → the command, file tools → the path, searches → the\n * query). Empty string when nothing salient exists; capped so the ticker line\n * can't blow out the card.\n */\nexport function salientToolCallDetail(toolCall: LangChainToolCall): string {\n const args = (toolCall.args ?? {}) as Record<string, unknown>;\n const firstString = (...keys: string[]): string => {\n for (const key of keys) {\n const value = args[key];\n if (typeof value === \"string\" && value) return value;\n }\n return \"\";\n };\n let detail: string;\n switch (toolCall.name) {\n case EXECUTE_TOOL_NAME:\n detail = firstString(\"command\");\n break;\n case WRITE_FILE_TOOL_NAME:\n case EDIT_FILE_TOOL_NAME:\n detail = firstString(\"file_path\", \"path\");\n break;\n case \"read_file\":\n case \"ls\":\n detail = firstString(\"file_path\", \"path\");\n break;\n case \"write_todos\": {\n const todos = args.todos;\n detail = Array.isArray(todos)\n ? `${todos.length} step${todos.length === 1 ? \"\" : \"s\"}`\n : \"\";\n break;\n }\n case TASK_TOOL_NAME:\n case START_ASYNC_TASK_TOOL_NAME:\n detail = firstString(\"description\", \"subagent_type\");\n break;\n case UPDATE_ASYNC_TASK_TOOL_NAME:\n detail = firstString(\"message\", \"task_id\");\n break;\n case CHECK_ASYNC_TASK_TOOL_NAME:\n case CANCEL_ASYNC_TASK_TOOL_NAME:\n detail = firstString(\"task_id\");\n break;\n default:\n detail = firstString(\n \"query\",\n \"pattern\",\n \"command\",\n \"path\",\n \"file_path\",\n \"url\",\n \"question\",\n );\n }\n const clean = detail.replace(/\\s+/g, \" \").trim();\n return clean.length > 80 ? `${clean.slice(0, 79)}…` : clean;\n}\n"],"names":[],"mappings":"AASO,MAAM,iBAAiB;
|
|
1
|
+
{"version":3,"file":"tool-names.js","sources":["../../../../agent-runtime/src/tool-names.ts"],"sourcesContent":["/**\n * Names of the deepagents built-in tools as they appear on the wire, plus the\n * shared arg shapes / display derivations keyed on those names. One home so\n * tool cards, activity panels, and transcript renderers on every surface agree\n * on which call is which.\n */\nimport type { LangChainToolCall } from \"@assistant-ui/react-langgraph\";\n\n/** The built-in deepagents delegation tool; a `task` call spawns a subagent. */\nexport const TASK_TOOL_NAME = \"task\";\n/** The QuickJS code-interpreter tool (langchain_quickjs middleware). */\nexport const EVAL_TOOL_NAME = \"eval\";\n/** The built-in deepagents sandbox shell tool. */\nexport const EXECUTE_TOOL_NAME = \"execute\";\n/**\n * The Athena studio code executors: sandboxed Python whose SDK calls the\n * backend records as PTC sub-calls, exactly like `execute` / `eval`.\n */\nexport const RUN_PYTHON_CODE_TOOL_NAME = \"run_python_code\";\nexport const EXECUTE_PRESENTATION_CODE_TOOL_NAME = \"execute_presentation_code\";\nexport const EXECUTE_SPREADSHEET_CODE_TOOL_NAME = \"execute_spreadsheet_code\";\nexport const EXECUTE_WORD_DOCUMENT_CODE_TOOL_NAME = \"execute_word_document_code\";\n/** Every tool whose ToolMessage artifact may carry promoted PTC sub-calls. */\nexport const PTC_PARENT_TOOL_NAMES: ReadonlySet<string> = new Set<string>([\n EXECUTE_TOOL_NAME,\n EVAL_TOOL_NAME,\n RUN_PYTHON_CODE_TOOL_NAME,\n EXECUTE_PRESENTATION_CODE_TOOL_NAME,\n EXECUTE_SPREADSHEET_CODE_TOOL_NAME,\n EXECUTE_WORD_DOCUMENT_CODE_TOOL_NAME,\n]);\n/** The built-in deepagents filesystem write/edit tools. */\nexport const WRITE_FILE_TOOL_NAME = \"write_file\";\nexport const EDIT_FILE_TOOL_NAME = \"edit_file\";\n\n/**\n * Tools whose calls render nothing in chat: no card, no status line. The call\n * and its result stay in the stored transcript and in exports; only the\n * conversation view leaves them out (see `convertDeepAgentMessage`).\n */\nexport const SUBMIT_FEEDBACK_TOOL_NAME = \"submit_feedback\";\nexport const QUIET_TOOL_NAMES: ReadonlySet<string> = new Set([SUBMIT_FEEDBACK_TOOL_NAME]);\n\n/**\n * The deepagents async-subagent tools (ADR 0006 coding workers ride these):\n * `start_async_task` launches a remote task, `check_async_task` polls it,\n * `update_async_task` sends a follow-up, `cancel_async_task` interrupts it.\n */\nexport const START_ASYNC_TASK_TOOL_NAME = \"start_async_task\";\nexport const CHECK_ASYNC_TASK_TOOL_NAME = \"check_async_task\";\nexport const UPDATE_ASYNC_TASK_TOOL_NAME = \"update_async_task\";\nexport const CANCEL_ASYNC_TASK_TOOL_NAME = \"cancel_async_task\";\nexport const LIST_ASYNC_TASKS_TOOL_NAME = \"list_async_tasks\";\n/** The Agent Communication toolkit's synchronous ask of a listed collab agent. */\nexport const ASK_AGENT_TOOL_NAME = \"ask_agent\";\nexport const ASYNC_TASK_TOOL_NAMES = [\n START_ASYNC_TASK_TOOL_NAME,\n CHECK_ASYNC_TASK_TOOL_NAME,\n UPDATE_ASYNC_TASK_TOOL_NAME,\n CANCEL_ASYNC_TASK_TOOL_NAME,\n LIST_ASYNC_TASKS_TOOL_NAME,\n] as const;\n\n/**\n * Args shape shared by `write_file` / `edit_file` (single source of truth for\n * both the tool card and the changed-files panel). `write_file` carries the\n * whole `content`; `edit_file` carries the `old_string` → `new_string`\n * replacement instead (deepagents `WriteFileSchema` / `EditFileSchema`).\n */\nexport type FileToolArgs = {\n file_path?: string;\n path?: string;\n content?: string;\n old_string?: string;\n new_string?: string;\n replace_all?: boolean;\n /** Cross-asset targeting: the sandbox-backed asset the tool acted on. */\n sandbox_asset_id?: string | null;\n};\n\n/**\n * Human-salient one-liner for a nested tool call — the argument a person would\n * glance at (`execute` → the command, file tools → the path, searches → the\n * query). Empty string when nothing salient exists; capped so the ticker line\n * can't blow out the card.\n */\nexport function salientToolCallDetail(toolCall: LangChainToolCall): string {\n const args = (toolCall.args ?? {}) as Record<string, unknown>;\n const firstString = (...keys: string[]): string => {\n for (const key of keys) {\n const value = args[key];\n if (typeof value === \"string\" && value) return value;\n }\n return \"\";\n };\n let detail: string;\n switch (toolCall.name) {\n case EXECUTE_TOOL_NAME:\n detail = firstString(\"command\");\n break;\n case WRITE_FILE_TOOL_NAME:\n case EDIT_FILE_TOOL_NAME:\n detail = firstString(\"file_path\", \"path\");\n break;\n case \"read_file\":\n case \"ls\":\n detail = firstString(\"file_path\", \"path\");\n break;\n case \"write_todos\": {\n const todos = args.todos;\n detail = Array.isArray(todos)\n ? `${todos.length} step${todos.length === 1 ? \"\" : \"s\"}`\n : \"\";\n break;\n }\n case TASK_TOOL_NAME:\n case START_ASYNC_TASK_TOOL_NAME:\n detail = firstString(\"description\", \"subagent_type\");\n break;\n case UPDATE_ASYNC_TASK_TOOL_NAME:\n detail = firstString(\"message\", \"task_id\");\n break;\n case CHECK_ASYNC_TASK_TOOL_NAME:\n case CANCEL_ASYNC_TASK_TOOL_NAME:\n detail = firstString(\"task_id\");\n break;\n default:\n detail = firstString(\n \"query\",\n \"pattern\",\n \"command\",\n \"path\",\n \"file_path\",\n \"url\",\n \"question\",\n );\n }\n const clean = detail.replace(/\\s+/g, \" \").trim();\n return clean.length > 80 ? `${clean.slice(0, 79)}…` : clean;\n}\n"],"names":[],"mappings":"AASO,MAAM,iBAAiB;AAEvB,MAAM,iBAAiB;AAEvB,MAAM,oBAAoB;AAmB1B,MAAM,uBAAuB;AAC7B,MAAM,sBAAsB;AAO5B,MAAM,4BAA4B;AAClC,MAAM,mBAAwC,oBAAI,IAAI,CAAC,yBAAyB,CAAC;AAOjF,MAAM,6BAA6B;AACnC,MAAM,6BAA6B;AACnC,MAAM,8BAA8B;AACpC,MAAM,8BAA8B;AAmCpC,SAAS,sBAAsB,UAAqC;AACzE,QAAM,OAAQ,SAAS,QAAQ,CAAA;AAC/B,QAAM,cAAc,IAAI,SAA2B;AACjD,eAAW,OAAO,MAAM;AACtB,YAAM,QAAQ,KAAK,GAAG;AACtB,UAAI,OAAO,UAAU,YAAY,MAAO,QAAO;AAAA,IACjD;AACA,WAAO;AAAA,EACT;AACA,MAAI;AACJ,UAAQ,SAAS,MAAA;AAAA,IACf,KAAK;AACH,eAAS,YAAY,SAAS;AAC9B;AAAA,IACF,KAAK;AAAA,IACL,KAAK;AACH,eAAS,YAAY,aAAa,MAAM;AACxC;AAAA,IACF,KAAK;AAAA,IACL,KAAK;AACH,eAAS,YAAY,aAAa,MAAM;AACxC;AAAA,IACF,KAAK,eAAe;AAClB,YAAM,QAAQ,KAAK;AACnB,eAAS,MAAM,QAAQ,KAAK,IACxB,GAAG,MAAM,MAAM,QAAQ,MAAM,WAAW,IAAI,KAAK,GAAG,KACpD;AACJ;AAAA,IACF;AAAA,IACA,KAAK;AAAA,IACL,KAAK;AACH,eAAS,YAAY,eAAe,eAAe;AACnD;AAAA,IACF,KAAK;AACH,eAAS,YAAY,WAAW,SAAS;AACzC;AAAA,IACF,KAAK;AAAA,IACL,KAAK;AACH,eAAS,YAAY,SAAS;AAC9B;AAAA,IACF;AACE,eAAS;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,EACF;AAEJ,QAAM,QAAQ,OAAO,QAAQ,QAAQ,GAAG,EAAE,KAAA;AAC1C,SAAO,MAAM,SAAS,KAAK,GAAG,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM;AACxD;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { LangChainMessage } from '@assistant-ui/react-langgraph';
|
|
2
2
|
import type { StatewireThread } from '@assistant-ui/react-statewire';
|
|
3
3
|
import type { StatewireClient } from 'statewire';
|
|
4
|
-
import type { DeepAgentVoiceWireError } from './voice-wire-types';
|
|
5
|
-
export type { DeepAgentVoiceWireError } from './voice-wire-types';
|
|
4
|
+
import type { DeepAgentVoiceOwnerWireState, DeepAgentVoiceTransferWireState, DeepAgentVoiceWireError } from './voice-wire-types';
|
|
5
|
+
export type { DeepAgentVoiceOwnerWireState, DeepAgentVoiceSurface, DeepAgentVoiceTransferWireState, DeepAgentVoiceWireError, } from './voice-wire-types';
|
|
6
6
|
/** The deepagents `write_todos` item shape (also the `todos` state-channel element). */
|
|
7
7
|
export interface Todo {
|
|
8
8
|
content: string;
|
|
@@ -87,6 +87,14 @@ export interface DeepAgentStreamValues {
|
|
|
87
87
|
* line; the session itself stays live.
|
|
88
88
|
*/
|
|
89
89
|
voiceLastError?: DeepAgentVoiceWireError | null;
|
|
90
|
+
/**
|
|
91
|
+
* The device holding the live voice session (`null` while none). Stamped at
|
|
92
|
+
* boot by hosts that can move a call between a person's devices, absent on
|
|
93
|
+
* older hosts; read through `useDeepAgentVoice` (`liveElsewhere`).
|
|
94
|
+
*/
|
|
95
|
+
voiceOwner?: DeepAgentVoiceOwnerWireState | null;
|
|
96
|
+
/** The pending move of the live call to another of the person's devices, if any. */
|
|
97
|
+
voiceTransfer?: DeepAgentVoiceTransferWireState | null;
|
|
90
98
|
/**
|
|
91
99
|
* Live in-eval subagent dispatch lifecycle, keyed by dispatch id (the
|
|
92
100
|
* backend's `ptc_subagents` channel). Read by `deriveEvalSubagents` — an in-eval
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const reactQuery = require("@tanstack/react-query");
|
|
4
|
-
const
|
|
4
|
+
const require$$0 = require("react");
|
|
5
5
|
const conversationList = require("./conversation-list.cjs");
|
|
6
6
|
const DEFAULT_PAGE_SIZE = 20;
|
|
7
7
|
const DEFAULT_STALE_TIME_MS = 3e4;
|
|
@@ -21,15 +21,15 @@ function useConversationList(options) {
|
|
|
21
21
|
retry
|
|
22
22
|
} = options;
|
|
23
23
|
const queryClient = reactQuery.useQueryClient(options.queryClient);
|
|
24
|
-
const fetchPageRef =
|
|
24
|
+
const fetchPageRef = require$$0.useRef(options.fetchPage);
|
|
25
25
|
fetchPageRef.current = options.fetchPage;
|
|
26
26
|
const normalizedFilter = conversationList.normalizeConversationListFilter(filter ?? {});
|
|
27
27
|
const filterKey = conversationList.conversationListFilterKey(normalizedFilter);
|
|
28
|
-
const firstPageKey =
|
|
28
|
+
const firstPageKey = require$$0.useMemo(
|
|
29
29
|
() => conversationList.conversationListQueryKeys.firstPage(scopeKey, filterKey, pageSize),
|
|
30
30
|
[scopeKey, filterKey, pageSize]
|
|
31
31
|
);
|
|
32
|
-
const historyKey =
|
|
32
|
+
const historyKey = require$$0.useMemo(
|
|
33
33
|
() => conversationList.conversationListQueryKeys.history(scopeKey, filterKey, pageSize),
|
|
34
34
|
[scopeKey, filterKey, pageSize]
|
|
35
35
|
);
|
|
@@ -73,7 +73,7 @@ function useConversationList(options) {
|
|
|
73
73
|
);
|
|
74
74
|
const historyPages = (_a = history.data) == null ? void 0 : _a.pages;
|
|
75
75
|
const hasLoadedHistory = ((historyPages == null ? void 0 : historyPages.length) ?? 0) > 0;
|
|
76
|
-
const conversations =
|
|
76
|
+
const conversations = require$$0.useMemo(
|
|
77
77
|
() => conversationList.mergeConversationPages([
|
|
78
78
|
...firstPage.data ? [firstPage.data] : [],
|
|
79
79
|
...historyPages ?? []
|
|
@@ -82,16 +82,16 @@ function useConversationList(options) {
|
|
|
82
82
|
);
|
|
83
83
|
const fetchNextHistoryPage = history.fetchNextPage;
|
|
84
84
|
const refetchHistoryFirstPage = history.refetch;
|
|
85
|
-
const fetchNextPage =
|
|
85
|
+
const fetchNextPage = require$$0.useCallback(
|
|
86
86
|
() => hasLoadedHistory ? fetchNextHistoryPage() : refetchHistoryFirstPage(),
|
|
87
87
|
[hasLoadedHistory, fetchNextHistoryPage, refetchHistoryFirstPage]
|
|
88
88
|
);
|
|
89
|
-
const refresh =
|
|
90
|
-
const invalidate =
|
|
89
|
+
const refresh = require$$0.useCallback(() => firstPage.refetch(), [firstPage.refetch]);
|
|
90
|
+
const invalidate = require$$0.useCallback(
|
|
91
91
|
() => conversationList.invalidateConversationListCaches(queryClient, { scopeKey }),
|
|
92
92
|
[queryClient, scopeKey]
|
|
93
93
|
);
|
|
94
|
-
const prependConversation =
|
|
94
|
+
const prependConversation = require$$0.useCallback(
|
|
95
95
|
(item) => {
|
|
96
96
|
queryClient.setQueryData(
|
|
97
97
|
firstPageKey,
|
|
@@ -100,7 +100,7 @@ function useConversationList(options) {
|
|
|
100
100
|
},
|
|
101
101
|
[queryClient, firstPageKey]
|
|
102
102
|
);
|
|
103
|
-
const removeConversation =
|
|
103
|
+
const removeConversation = require$$0.useCallback(
|
|
104
104
|
(threadId) => {
|
|
105
105
|
queryClient.setQueryData(
|
|
106
106
|
firstPageKey,
|
|
@@ -113,7 +113,7 @@ function useConversationList(options) {
|
|
|
113
113
|
},
|
|
114
114
|
[queryClient, firstPageKey, historyKey]
|
|
115
115
|
);
|
|
116
|
-
const patchConversation =
|
|
116
|
+
const patchConversation = require$$0.useCallback(
|
|
117
117
|
(threadId, patch) => {
|
|
118
118
|
const match = (item) => item.threadId === threadId;
|
|
119
119
|
queryClient.setQueryData(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-conversation-list.cjs","sources":["../../../../agent-runtime/src/use-conversation-list.ts"],"sourcesContent":["import {\n type InfiniteData,\n type QueryClient,\n useInfiniteQuery,\n useQuery,\n useQueryClient,\n} from '@tanstack/react-query';\nimport { useCallback, useMemo, useRef } from 'react';\nimport {\n CONVERSATION_LIST_DEFAULT_SCOPE_KEY,\n type ConversationListFetcher,\n type ConversationListFilter,\n type ConversationListPage,\n type ConversationSummary,\n conversationListFilterKey,\n conversationListQueryKeys,\n invalidateConversationListCaches,\n mergeConversationPages,\n normalizeConversationListFilter,\n patchConversationsInPage,\n prependConversationToPage,\n removeConversationFromPage,\n} from './conversation-list';\n\nconst DEFAULT_PAGE_SIZE = 20;\nconst DEFAULT_STALE_TIME_MS = 30_000;\nconst DEFAULT_GC_TIME_MS = 10 * 60 * 1000;\n\nexport interface UseConversationListOptions {\n /**\n * Transport adapter for one page (GraphQL `listConversations`, the REST\n * thread list, …). Captured in a ref — identity changes do not re-key the\n * cache, so pair a changing fetcher with a changing `scopeKey`.\n */\n fetchPage: ConversationListFetcher;\n filter?: ConversationListFilter;\n pageSize?: number;\n /**\n * Cache identity beyond the filter. MUST include everything that changes\n * whose list this is — principal/user id, backend base URL — so a\n * credential swap can never serve another identity's rows from the cache.\n */\n scopeKey?: string;\n enabled?: boolean;\n staleTime?: number;\n gcTime?: number;\n refetchOnMount?: boolean | 'always';\n refetchOnWindowFocus?: boolean;\n /**\n * Newest-page freshness is push-based by default (the conversation-index\n * statewire invalidates these caches), so no timer runs unless asked.\n */\n refetchInterval?: number | false;\n retry?: boolean | number | ((failureCount: number, error: Error) => boolean);\n /**\n * The client to cache in. Defaults to the one in context; a hook that may\n * render outside any `QueryClientProvider` (and stays disabled there)\n * passes its own.\n */\n queryClient?: QueryClient;\n}\n\nexport interface ConversationListController {\n /** Merged newest-first rows: live first page + retained history pages. */\n conversations: ConversationSummary[];\n /** Advisory total from the live first page, when the transport counts. */\n totalCount: number | null;\n isLoading: boolean;\n isFetching: boolean;\n /** True once the live first page has resolved at least once. */\n hasResolvedFirstPage: boolean;\n hasNextPage: boolean;\n isFetchingNextPage: boolean;\n /** True while the last next-page request failed (cleared by a successful one). */\n isFetchNextPageError: boolean;\n fetchNextPage: () => Promise<unknown>;\n /** Refetch the live first page (history pages stay frozen). */\n refresh: () => Promise<unknown>;\n /** Invalidate every conversation-list cache in this scope (all filters). */\n invalidate: () => Promise<void>;\n /** Optimistically show a new conversation at the top of THIS filter view. */\n prependConversation: (item: ConversationSummary) => void;\n /** Optimistically drop a conversation from THIS filter view. */\n removeConversation: (threadId: string) => void;\n /** Optimistically patch a conversation's row in THIS filter view. */\n patchConversation: (threadId: string, patch: Partial<ConversationSummary>) => void;\n}\n\n/**\n * The shared headless conversation-list pager (chat-stack unification —\n * thread-list-contract-convergence).\n *\n * Implements, once, the two-tier TanStack Query pattern Olympus and mobile\n * each hand-rolled:\n *\n * - a LIVE first-page query — the only observer that refetches on\n * invalidation/focus, so push-driven freshness costs one page, and\n * - a permanently-disabled infinite \"history\" query whose pages are fetched\n * only by explicit `fetchNextPage()` calls and retained without replay\n * (invalidation/polling never refetches every loaded page).\n *\n * Rows merge newest-first with the live page winning duplicate threads.\n */\nexport function useConversationList(options: UseConversationListOptions): ConversationListController {\n const {\n filter,\n pageSize = DEFAULT_PAGE_SIZE,\n scopeKey = CONVERSATION_LIST_DEFAULT_SCOPE_KEY,\n enabled,\n staleTime = DEFAULT_STALE_TIME_MS,\n gcTime = DEFAULT_GC_TIME_MS,\n refetchOnMount,\n refetchOnWindowFocus,\n refetchInterval = false,\n retry,\n } = options;\n const queryClient = useQueryClient(options.queryClient);\n\n const fetchPageRef = useRef(options.fetchPage);\n fetchPageRef.current = options.fetchPage;\n\n // The normalized filter is both the cache identity (via the key) and what\n // queryFn closures fetch, so a cache entry holds exactly what it claims —\n // fresh-but-equal filter objects from the caller never re-key or refetch.\n // (Plain per-render values: only the serialized key participates in\n // identity, so object freshness here is irrelevant.)\n const normalizedFilter = normalizeConversationListFilter(filter ?? {});\n const filterKey = conversationListFilterKey(normalizedFilter);\n\n const firstPageKey = useMemo(\n () => conversationListQueryKeys.firstPage(scopeKey, filterKey, pageSize),\n [scopeKey, filterKey, pageSize]\n );\n const historyKey = useMemo(\n () => conversationListQueryKeys.history(scopeKey, filterKey, pageSize),\n [scopeKey, filterKey, pageSize]\n );\n\n // React Query merges per-query options OVER the client's defaultOptions with\n // Object.assign, which copies explicitly-`undefined` keys — so passing\n // `refetchOnWindowFocus: undefined` CLOBBERS a consumer's\n // `refetchOnWindowFocus: false` default and silently re-enables focus\n // refetching. Options the caller did not set must therefore be omitted, not\n // forwarded as undefined, so they fall through to the consuming app's client.\n const passthrough = {\n ...(enabled !== undefined ? { enabled } : {}),\n ...(refetchOnMount !== undefined ? { refetchOnMount } : {}),\n ...(refetchOnWindowFocus !== undefined ? { refetchOnWindowFocus } : {}),\n ...(retry !== undefined ? { retry } : {}),\n };\n\n const firstPage = useQuery(\n {\n queryKey: firstPageKey,\n queryFn: ({ signal }) =>\n fetchPageRef.current({ limit: pageSize, offset: 0, filter: normalizedFilter, signal }),\n staleTime,\n gcTime,\n refetchInterval,\n ...passthrough,\n },\n queryClient\n );\n\n const history = useInfiniteQuery(\n {\n queryKey: historyKey,\n initialPageParam: pageSize,\n gcTime,\n queryFn: ({ pageParam, signal }) =>\n fetchPageRef.current({\n limit: pageSize,\n offset: pageParam,\n filter: normalizedFilter,\n signal,\n }),\n getNextPageParam: (lastPage, _allPages, lastOffset) =>\n lastPage.hasMore ? lastOffset + pageSize : undefined,\n ...passthrough,\n // fetchNextPage/refetch still perform explicit fetches for disabled\n // queries. Keeping this observer disabled prevents focus, invalidation,\n // and polling from replaying every retained historical page. This must\n // win over `passthrough.enabled`, so it is spread last.\n enabled: false,\n },\n queryClient\n );\n\n const historyPages = history.data?.pages;\n const hasLoadedHistory = (historyPages?.length ?? 0) > 0;\n\n const conversations = useMemo(\n () =>\n mergeConversationPages([\n ...(firstPage.data ? [firstPage.data] : []),\n ...(historyPages ?? []),\n ]),\n [firstPage.data, historyPages]\n );\n\n const fetchNextHistoryPage = history.fetchNextPage;\n const refetchHistoryFirstPage = history.refetch;\n const fetchNextPage = useCallback(\n () => (hasLoadedHistory ? fetchNextHistoryPage() : refetchHistoryFirstPage()),\n [hasLoadedHistory, fetchNextHistoryPage, refetchHistoryFirstPage]\n );\n\n const refresh = useCallback(() => firstPage.refetch(), [firstPage.refetch]);\n\n const invalidate = useCallback(\n () => invalidateConversationListCaches(queryClient, { scopeKey }),\n [queryClient, scopeKey]\n );\n\n const prependConversation = useCallback(\n (item: ConversationSummary) => {\n queryClient.setQueryData<ConversationListPage>(firstPageKey, (page) =>\n page ? prependConversationToPage(page, item) : page\n );\n },\n [queryClient, firstPageKey]\n );\n\n const removeConversation = useCallback(\n (threadId: string) => {\n queryClient.setQueryData<ConversationListPage>(firstPageKey, (page) =>\n page ? removeConversationFromPage(page, threadId) : page\n );\n queryClient.setQueryData<InfiniteData<ConversationListPage, number>>(historyKey, (data) =>\n data\n ? { ...data, pages: data.pages.map((page) => removeConversationFromPage(page, threadId)) }\n : data\n );\n },\n [queryClient, firstPageKey, historyKey]\n );\n\n const patchConversation = useCallback(\n (threadId: string, patch: Partial<ConversationSummary>) => {\n const match = (item: ConversationSummary) => item.threadId === threadId;\n queryClient.setQueryData<ConversationListPage>(firstPageKey, (page) =>\n page ? patchConversationsInPage(page, match, patch) : page\n );\n queryClient.setQueryData<InfiniteData<ConversationListPage, number>>(historyKey, (data) =>\n data\n ? {\n ...data,\n pages: data.pages.map((page) => patchConversationsInPage(page, match, patch)),\n }\n : data\n );\n },\n [queryClient, firstPageKey, historyKey]\n );\n\n return {\n conversations,\n totalCount: firstPage.data?.totalCount ?? null,\n isLoading: firstPage.isLoading,\n isFetching: firstPage.isFetching || history.isFetching,\n hasResolvedFirstPage: firstPage.data !== undefined,\n hasNextPage: hasLoadedHistory\n ? (history.hasNextPage ?? false)\n : (firstPage.data?.hasMore ?? false),\n isFetchingNextPage: history.isFetchingNextPage || (!hasLoadedHistory && history.isFetching),\n isFetchNextPageError: history.isError,\n fetchNextPage,\n refresh,\n invalidate,\n prependConversation,\n removeConversation,\n patchConversation,\n };\n}\n"],"names":["CONVERSATION_LIST_DEFAULT_SCOPE_KEY","useQueryClient","useRef","normalizeConversationListFilter","conversationListFilterKey","useMemo","conversationListQueryKeys","useQuery","useInfiniteQuery","mergeConversationPages","useCallback","invalidateConversationListCaches","prependConversationToPage","removeConversationFromPage","patchConversationsInPage"],"mappings":";;;;;AAwBA,MAAM,oBAAoB;AAC1B,MAAM,wBAAwB;AAC9B,MAAM,qBAAqB,KAAK,KAAK;AA6E9B,SAAS,oBAAoB,SAAiE;;AACnG,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX,WAAWA,iBAAAA;AAAAA,IACX;AAAA,IACA,YAAY;AAAA,IACZ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,EAAA,IACE;AACJ,QAAM,cAAcC,WAAAA,eAAe,QAAQ,WAAW;AAEtD,QAAM,eAAeC,MAAAA,OAAO,QAAQ,SAAS;AAC7C,eAAa,UAAU,QAAQ;AAO/B,QAAM,mBAAmBC,iBAAAA,gCAAgC,UAAU,EAAE;AACrE,QAAM,YAAYC,iBAAAA,0BAA0B,gBAAgB;AAE5D,QAAM,eAAeC,MAAAA;AAAAA,IACnB,MAAMC,iBAAAA,0BAA0B,UAAU,UAAU,WAAW,QAAQ;AAAA,IACvE,CAAC,UAAU,WAAW,QAAQ;AAAA,EAAA;AAEhC,QAAM,aAAaD,MAAAA;AAAAA,IACjB,MAAMC,iBAAAA,0BAA0B,QAAQ,UAAU,WAAW,QAAQ;AAAA,IACrE,CAAC,UAAU,WAAW,QAAQ;AAAA,EAA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UACE,GAAG;AAAA,UACH,OAAO,KAAK,MAAM,IAAI,CAAC,SAASA,0CAAyB,MAAM,OAAO,KAAK,CAAC;AAAA,QAAA,IAE9E;AAAA,MAAA;AAAA,IAER;AAAA,IACA,CAAC,aAAa,cAAc,UAAU;AAAA,EAAA;AAGxC,SAAO;AAAA,IACL;AAAA,IACA,cAAY,eAAU,SAAV,mBAAgB,eAAc;AAAA,IAC1C,WAAW,UAAU;AAAA,IACrB,YAAY,UAAU,cAAc,QAAQ;AAAA,IAC5C,sBAAsB,UAAU,SAAS;AAAA,IACzC,aAAa,mBACR,QAAQ,eAAe,UACvB,eAAU,SAAV,mBAAgB,YAAW;AAAA,IAChC,oBAAoB,QAAQ,sBAAuB,CAAC,oBAAoB,QAAQ;AAAA,IAChF,sBAAsB,QAAQ;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;;"}
|
|
1
|
+
{"version":3,"file":"use-conversation-list.cjs","sources":["../../../../agent-runtime/src/use-conversation-list.ts"],"sourcesContent":["import {\n type InfiniteData,\n type QueryClient,\n useInfiniteQuery,\n useQuery,\n useQueryClient,\n} from '@tanstack/react-query';\nimport { useCallback, useMemo, useRef } from 'react';\nimport {\n CONVERSATION_LIST_DEFAULT_SCOPE_KEY,\n type ConversationListFetcher,\n type ConversationListFilter,\n type ConversationListPage,\n type ConversationSummary,\n conversationListFilterKey,\n conversationListQueryKeys,\n invalidateConversationListCaches,\n mergeConversationPages,\n normalizeConversationListFilter,\n patchConversationsInPage,\n prependConversationToPage,\n removeConversationFromPage,\n} from './conversation-list';\n\nconst DEFAULT_PAGE_SIZE = 20;\nconst DEFAULT_STALE_TIME_MS = 30_000;\nconst DEFAULT_GC_TIME_MS = 10 * 60 * 1000;\n\nexport interface UseConversationListOptions {\n /**\n * Transport adapter for one page (GraphQL `listConversations`, the REST\n * thread list, …). Captured in a ref — identity changes do not re-key the\n * cache, so pair a changing fetcher with a changing `scopeKey`.\n */\n fetchPage: ConversationListFetcher;\n filter?: ConversationListFilter;\n pageSize?: number;\n /**\n * Cache identity beyond the filter. MUST include everything that changes\n * whose list this is — principal/user id, backend base URL — so a\n * credential swap can never serve another identity's rows from the cache.\n */\n scopeKey?: string;\n enabled?: boolean;\n staleTime?: number;\n gcTime?: number;\n refetchOnMount?: boolean | 'always';\n refetchOnWindowFocus?: boolean;\n /**\n * Newest-page freshness is push-based by default (the conversation-index\n * statewire invalidates these caches), so no timer runs unless asked.\n */\n refetchInterval?: number | false;\n retry?: boolean | number | ((failureCount: number, error: Error) => boolean);\n /**\n * The client to cache in. Defaults to the one in context; a hook that may\n * render outside any `QueryClientProvider` (and stays disabled there)\n * passes its own.\n */\n queryClient?: QueryClient;\n}\n\nexport interface ConversationListController {\n /** Merged newest-first rows: live first page + retained history pages. */\n conversations: ConversationSummary[];\n /** Advisory total from the live first page, when the transport counts. */\n totalCount: number | null;\n isLoading: boolean;\n isFetching: boolean;\n /** True once the live first page has resolved at least once. */\n hasResolvedFirstPage: boolean;\n hasNextPage: boolean;\n isFetchingNextPage: boolean;\n /** True while the last next-page request failed (cleared by a successful one). */\n isFetchNextPageError: boolean;\n fetchNextPage: () => Promise<unknown>;\n /** Refetch the live first page (history pages stay frozen). */\n refresh: () => Promise<unknown>;\n /** Invalidate every conversation-list cache in this scope (all filters). */\n invalidate: () => Promise<void>;\n /** Optimistically show a new conversation at the top of THIS filter view. */\n prependConversation: (item: ConversationSummary) => void;\n /** Optimistically drop a conversation from THIS filter view. */\n removeConversation: (threadId: string) => void;\n /** Optimistically patch a conversation's row in THIS filter view. */\n patchConversation: (threadId: string, patch: Partial<ConversationSummary>) => void;\n}\n\n/**\n * The shared headless conversation-list pager (chat-stack unification —\n * thread-list-contract-convergence).\n *\n * Implements, once, the two-tier TanStack Query pattern Olympus and mobile\n * each hand-rolled:\n *\n * - a LIVE first-page query — the only observer that refetches on\n * invalidation/focus, so push-driven freshness costs one page, and\n * - a permanently-disabled infinite \"history\" query whose pages are fetched\n * only by explicit `fetchNextPage()` calls and retained without replay\n * (invalidation/polling never refetches every loaded page).\n *\n * Rows merge newest-first with the live page winning duplicate threads.\n */\nexport function useConversationList(options: UseConversationListOptions): ConversationListController {\n const {\n filter,\n pageSize = DEFAULT_PAGE_SIZE,\n scopeKey = CONVERSATION_LIST_DEFAULT_SCOPE_KEY,\n enabled,\n staleTime = DEFAULT_STALE_TIME_MS,\n gcTime = DEFAULT_GC_TIME_MS,\n refetchOnMount,\n refetchOnWindowFocus,\n refetchInterval = false,\n retry,\n } = options;\n const queryClient = useQueryClient(options.queryClient);\n\n const fetchPageRef = useRef(options.fetchPage);\n fetchPageRef.current = options.fetchPage;\n\n // The normalized filter is both the cache identity (via the key) and what\n // queryFn closures fetch, so a cache entry holds exactly what it claims —\n // fresh-but-equal filter objects from the caller never re-key or refetch.\n // (Plain per-render values: only the serialized key participates in\n // identity, so object freshness here is irrelevant.)\n const normalizedFilter = normalizeConversationListFilter(filter ?? {});\n const filterKey = conversationListFilterKey(normalizedFilter);\n\n const firstPageKey = useMemo(\n () => conversationListQueryKeys.firstPage(scopeKey, filterKey, pageSize),\n [scopeKey, filterKey, pageSize]\n );\n const historyKey = useMemo(\n () => conversationListQueryKeys.history(scopeKey, filterKey, pageSize),\n [scopeKey, filterKey, pageSize]\n );\n\n // React Query merges per-query options OVER the client's defaultOptions with\n // Object.assign, which copies explicitly-`undefined` keys — so passing\n // `refetchOnWindowFocus: undefined` CLOBBERS a consumer's\n // `refetchOnWindowFocus: false` default and silently re-enables focus\n // refetching. Options the caller did not set must therefore be omitted, not\n // forwarded as undefined, so they fall through to the consuming app's client.\n const passthrough = {\n ...(enabled !== undefined ? { enabled } : {}),\n ...(refetchOnMount !== undefined ? { refetchOnMount } : {}),\n ...(refetchOnWindowFocus !== undefined ? { refetchOnWindowFocus } : {}),\n ...(retry !== undefined ? { retry } : {}),\n };\n\n const firstPage = useQuery(\n {\n queryKey: firstPageKey,\n queryFn: ({ signal }) =>\n fetchPageRef.current({ limit: pageSize, offset: 0, filter: normalizedFilter, signal }),\n staleTime,\n gcTime,\n refetchInterval,\n ...passthrough,\n },\n queryClient\n );\n\n const history = useInfiniteQuery(\n {\n queryKey: historyKey,\n initialPageParam: pageSize,\n gcTime,\n queryFn: ({ pageParam, signal }) =>\n fetchPageRef.current({\n limit: pageSize,\n offset: pageParam,\n filter: normalizedFilter,\n signal,\n }),\n getNextPageParam: (lastPage, _allPages, lastOffset) =>\n lastPage.hasMore ? lastOffset + pageSize : undefined,\n ...passthrough,\n // fetchNextPage/refetch still perform explicit fetches for disabled\n // queries. Keeping this observer disabled prevents focus, invalidation,\n // and polling from replaying every retained historical page. This must\n // win over `passthrough.enabled`, so it is spread last.\n enabled: false,\n },\n queryClient\n );\n\n const historyPages = history.data?.pages;\n const hasLoadedHistory = (historyPages?.length ?? 0) > 0;\n\n const conversations = useMemo(\n () =>\n mergeConversationPages([\n ...(firstPage.data ? [firstPage.data] : []),\n ...(historyPages ?? []),\n ]),\n [firstPage.data, historyPages]\n );\n\n const fetchNextHistoryPage = history.fetchNextPage;\n const refetchHistoryFirstPage = history.refetch;\n const fetchNextPage = useCallback(\n () => (hasLoadedHistory ? fetchNextHistoryPage() : refetchHistoryFirstPage()),\n [hasLoadedHistory, fetchNextHistoryPage, refetchHistoryFirstPage]\n );\n\n const refresh = useCallback(() => firstPage.refetch(), [firstPage.refetch]);\n\n const invalidate = useCallback(\n () => invalidateConversationListCaches(queryClient, { scopeKey }),\n [queryClient, scopeKey]\n );\n\n const prependConversation = useCallback(\n (item: ConversationSummary) => {\n queryClient.setQueryData<ConversationListPage>(firstPageKey, (page) =>\n page ? prependConversationToPage(page, item) : page\n );\n },\n [queryClient, firstPageKey]\n );\n\n const removeConversation = useCallback(\n (threadId: string) => {\n queryClient.setQueryData<ConversationListPage>(firstPageKey, (page) =>\n page ? removeConversationFromPage(page, threadId) : page\n );\n queryClient.setQueryData<InfiniteData<ConversationListPage, number>>(historyKey, (data) =>\n data\n ? { ...data, pages: data.pages.map((page) => removeConversationFromPage(page, threadId)) }\n : data\n );\n },\n [queryClient, firstPageKey, historyKey]\n );\n\n const patchConversation = useCallback(\n (threadId: string, patch: Partial<ConversationSummary>) => {\n const match = (item: ConversationSummary) => item.threadId === threadId;\n queryClient.setQueryData<ConversationListPage>(firstPageKey, (page) =>\n page ? patchConversationsInPage(page, match, patch) : page\n );\n queryClient.setQueryData<InfiniteData<ConversationListPage, number>>(historyKey, (data) =>\n data\n ? {\n ...data,\n pages: data.pages.map((page) => patchConversationsInPage(page, match, patch)),\n }\n : data\n );\n },\n [queryClient, firstPageKey, historyKey]\n );\n\n return {\n conversations,\n totalCount: firstPage.data?.totalCount ?? null,\n isLoading: firstPage.isLoading,\n isFetching: firstPage.isFetching || history.isFetching,\n hasResolvedFirstPage: firstPage.data !== undefined,\n hasNextPage: hasLoadedHistory\n ? (history.hasNextPage ?? false)\n : (firstPage.data?.hasMore ?? false),\n isFetchingNextPage: history.isFetchingNextPage || (!hasLoadedHistory && history.isFetching),\n isFetchNextPageError: history.isError,\n fetchNextPage,\n refresh,\n invalidate,\n prependConversation,\n removeConversation,\n patchConversation,\n };\n}\n"],"names":["CONVERSATION_LIST_DEFAULT_SCOPE_KEY","useQueryClient","useRef","normalizeConversationListFilter","conversationListFilterKey","useMemo","conversationListQueryKeys","useQuery","useInfiniteQuery","mergeConversationPages","useCallback","invalidateConversationListCaches","prependConversationToPage","removeConversationFromPage","patchConversationsInPage"],"mappings":";;;;;AAwBA,MAAM,oBAAoB;AAC1B,MAAM,wBAAwB;AAC9B,MAAM,qBAAqB,KAAK,KAAK;AA6E9B,SAAS,oBAAoB,SAAiE;;AACnG,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX,WAAWA,iBAAAA;AAAAA,IACX;AAAA,IACA,YAAY;AAAA,IACZ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,EAAA,IACE;AACJ,QAA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AAyD;AAAA,QAAY,CAAC,SAChF,OACI,EAAE,GAAG,MAAM,OAAO,KAAK,MAAM,IAAI,CAAC,SAASA,iBAAAA,2BAA2B,MAAM,QAAQ,CAAC,MACrF;AAAA,MAAA;AAAA,IAER;AAAA,IACA,CAAC,aAAa,cAAc,UAAU;AAAA,EAAA;AAGxC,QAAM,oBAAoBH,WAAAA;AAAAA,IACxB,CAAC,UAAkB,UAAwC;AACzD,YAAM,QAAQ,CAAC,SAA8B,KAAK,aAAa;AAC/D,kBAAY;AAAA,QAAmC;AAAA,QAAc,CAAC,SAC5D,OAAOI,iBAAAA,yBAAyB,MAAM,OAAO,KAAK,IAAI;AAAA,MAAA;AAExD,kBAAY;AAAA,QAAyD;AAAA,QAAY,CAAC,SAChF,OACI;AAAA,UACE,GAAG;AAAA,UACH,OAAO,KAAK,MAAM,IAAI,CAAC,SAASA,0CAAyB,MAAM,OAAO,KAAK,CAAC;AAAA,QAAA,IAE9E;AAAA,MAAA;AAAA,IAER;AAAA,IACA,CAAC,aAAa,cAAc,UAAU;AAAA,EAAA;AAGxC,SAAO;AAAA,IACL;AAAA,IACA,cAAY,eAAU,SAAV,mBAAgB,eAAc;AAAA,IAC1C,WAAW,UAAU;AAAA,IACrB,YAAY,UAAU,cAAc,QAAQ;AAAA,IAC5C,sBAAsB,UAAU,SAAS;AAAA,IACzC,aAAa,mBACR,QAAQ,eAAe,UACvB,eAAU,SAAV,mBAAgB,YAAW;AAAA,IAChC,oBAAoB,QAAQ,sBAAuB,CAAC,oBAAoB,QAAQ;AAAA,IAChF,sBAAsB,QAAQ;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const require$$0 = require("react");
|
|
4
4
|
const chatOutbox = require("./chat-outbox.cjs");
|
|
5
5
|
const chatOutboxThread = require("./chat-outbox-thread.cjs");
|
|
6
6
|
function useDeepAgentChatOutbox({
|
|
@@ -17,30 +17,30 @@ function useDeepAgentChatOutbox({
|
|
|
17
17
|
enabled = true,
|
|
18
18
|
countdownMs
|
|
19
19
|
}) {
|
|
20
|
-
const clientRef =
|
|
20
|
+
const clientRef = require$$0.useRef(client);
|
|
21
21
|
clientRef.current = client;
|
|
22
|
-
const restoreRef =
|
|
22
|
+
const restoreRef = require$$0.useRef(restore);
|
|
23
23
|
restoreRef.current = restore;
|
|
24
|
-
const openThreadRef =
|
|
24
|
+
const openThreadRef = require$$0.useRef(openThread);
|
|
25
25
|
openThreadRef.current = openThread;
|
|
26
26
|
const canOpenThreads = openThread !== void 0;
|
|
27
|
-
const onEventRef =
|
|
27
|
+
const onEventRef = require$$0.useRef(onEvent);
|
|
28
28
|
onEventRef.current = onEvent;
|
|
29
|
-
const checkAttachmentsRef =
|
|
29
|
+
const checkAttachmentsRef = require$$0.useRef(checkAttachments);
|
|
30
30
|
checkAttachmentsRef.current = checkAttachments;
|
|
31
31
|
const checksAttachments = checkAttachments !== void 0;
|
|
32
|
-
const reachabilityRef =
|
|
32
|
+
const reachabilityRef = require$$0.useRef(reachability);
|
|
33
33
|
reachabilityRef.current = reachability;
|
|
34
|
-
const foregroundRef =
|
|
34
|
+
const foregroundRef = require$$0.useRef(foreground);
|
|
35
35
|
foregroundRef.current = foreground;
|
|
36
|
-
const [threadListeners] =
|
|
37
|
-
|
|
36
|
+
const [threadListeners] = require$$0.useState(() => /* @__PURE__ */ new Set());
|
|
37
|
+
require$$0.useEffect(() => {
|
|
38
38
|
if (!enabled) return void 0;
|
|
39
39
|
return client.subscribe(() => {
|
|
40
40
|
for (const listener of threadListeners) listener();
|
|
41
41
|
});
|
|
42
42
|
}, [client, threadListeners, enabled]);
|
|
43
|
-
const [stableSignals] =
|
|
43
|
+
const [stableSignals] = require$$0.useState(() => {
|
|
44
44
|
const forward = (pick) => ({
|
|
45
45
|
get: () => pick().get(),
|
|
46
46
|
subscribe: (listener) => pick().subscribe(listener)
|
|
@@ -50,10 +50,10 @@ function useDeepAgentChatOutbox({
|
|
|
50
50
|
foreground: forward(() => foregroundRef.current)
|
|
51
51
|
};
|
|
52
52
|
});
|
|
53
|
-
const isNewChatRef =
|
|
53
|
+
const isNewChatRef = require$$0.useRef(isNewChat);
|
|
54
54
|
isNewChatRef.current = isNewChat;
|
|
55
|
-
const [outbox, setOutbox] =
|
|
56
|
-
|
|
55
|
+
const [outbox, setOutbox] = require$$0.useState(null);
|
|
56
|
+
require$$0.useEffect(() => {
|
|
57
57
|
if (!enabled || !threadId) {
|
|
58
58
|
setOutbox(null);
|
|
59
59
|
return void 0;
|
|
@@ -110,23 +110,28 @@ const EMPTY_SNAPSHOT = {
|
|
|
110
110
|
};
|
|
111
111
|
const noopSubscribe = () => () => void 0;
|
|
112
112
|
function useChatOutboxSnapshot(outbox) {
|
|
113
|
-
return
|
|
113
|
+
return require$$0.useSyncExternalStore(
|
|
114
114
|
outbox ? outbox.subscribe : noopSubscribe,
|
|
115
115
|
() => (outbox == null ? void 0 : outbox.getSnapshot()) ?? EMPTY_SNAPSHOT,
|
|
116
116
|
() => (outbox == null ? void 0 : outbox.getSnapshot()) ?? EMPTY_SNAPSHOT
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
119
|
function useChatOutboxReachable(outbox) {
|
|
120
|
-
const subscribe =
|
|
120
|
+
const subscribe = require$$0.useCallback(
|
|
121
121
|
(listener) => outbox ? outbox.reachability.subscribe(listener) : () => void 0,
|
|
122
122
|
[outbox]
|
|
123
123
|
);
|
|
124
124
|
const reachable = () => (outbox == null ? void 0 : outbox.reachability.get()) ?? true;
|
|
125
|
-
return
|
|
125
|
+
return require$$0.useSyncExternalStore(subscribe, reachable, reachable);
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const CHAT_OUTBOX_CONTEXT = Symbol.for("@athenaintel/agent-runtime/deep-agent-chat-outbox-context");
|
|
128
|
+
function sharedChatOutboxContext() {
|
|
129
|
+
const host = globalThis;
|
|
130
|
+
return host[CHAT_OUTBOX_CONTEXT] ?? (host[CHAT_OUTBOX_CONTEXT] = require$$0.createContext(null));
|
|
131
|
+
}
|
|
132
|
+
const DeepAgentChatOutboxContext = sharedChatOutboxContext();
|
|
128
133
|
function useDeepAgentChatOutboxContext() {
|
|
129
|
-
return
|
|
134
|
+
return require$$0.useContext(DeepAgentChatOutboxContext);
|
|
130
135
|
}
|
|
131
136
|
exports.DeepAgentChatOutboxContext = DeepAgentChatOutboxContext;
|
|
132
137
|
exports.useChatOutboxReachable = useChatOutboxReachable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-deep-agent-chat-outbox.cjs","sources":["../../../../agent-runtime/src/use-deep-agent-chat-outbox.ts"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport type { ChatOutboxAttachmentCheck } from \"./chat-outbox-attachments\";\nimport {\n type ChatOutbox,\n type ChatOutboxCommandUpdate,\n type ChatOutboxEvent,\n type ChatOutboxSignal,\n type ChatOutboxSnapshot,\n createChatOutbox,\n} from \"./chat-outbox\";\nimport type { ChatOutboxEntry, ChatOutboxStore } from \"./chat-outbox-store\";\nimport { type ChatOutboxClientHost, createStatewireChatOutboxPort } from \"./chat-outbox-thread\";\n\nexport interface UseDeepAgentChatOutboxOptions {\n /** The thread's assistant-ui client (`useDeepAgentRuntime`'s result). */\n client: ChatOutboxClientHost;\n threadId: string;\n /** The conversation has never started (a new chat). */\n isNewChat: boolean;\n /**\n * This person's outbox store, one per person for the life of the page or app (a message the\n * device cannot keep waits in its memory, across thread switches); `null` keeps waiting messages\n * in this outbox alone.\n */\n store: ChatOutboxStore | null;\n /** Athena's reachability (the host's own model: the browser online AND agora answering). */\n reachability: ChatOutboxSignal;\n /** The app is in front (a visible tab, an active app, a focused desktop window). */\n foreground: ChatOutboxSignal;\n /** Give a cancelled message's text back to the composer. */\n restore: (entry: ChatOutboxEntry) => void;\n /**\n * Open another of the person's conversations holding waiting messages (the tray's Open); omit\n * it where the host cannot switch conversations.\n */\n openThread?: (target: { threadId: string; newChat: boolean }) => void;\n onEvent?: (event: ChatOutboxEvent) => void;\n /**\n * Asks Athena whether a waiting message's attachments can still be opened, right before it goes\n * (`createChatOutboxAttachmentCheck`); omitted, attachments go unchecked.\n */\n checkAttachments?: ChatOutboxAttachmentCheck;\n /** Off: no outbox (a read-only or suspended surface); sends behave as before. */\n enabled?: boolean;\n /** The countdown before a waiting message is sent (tests); defaults to `CHAT_OUTBOX_COUNTDOWN_MS`. */\n countdownMs?: number;\n}\n\n/**\n * The chat outbox for the mounted thread (`chat-outbox.ts`), one per thread and store: a thread\n * switch disposes it and makes the next thread's. The host forwards statewire's command lifecycle\n * to {@link ChatOutbox.observeCommand} (its `useDeepAgentRuntime` `onCommandChange`), shares the\n * instance through {@link DeepAgentChatOutboxContext}, and has its composer call\n * {@link ChatOutbox.shouldHold} / {@link ChatOutbox.hold} before sending.\n */\nexport function useDeepAgentChatOutbox({\n client,\n threadId,\n isNewChat,\n store,\n reachability,\n foreground,\n restore,\n openThread,\n onEvent,\n checkAttachments,\n enabled = true,\n countdownMs,\n}: UseDeepAgentChatOutboxOptions): ChatOutbox | null {\n const clientRef = useRef(client);\n clientRef.current = client;\n const restoreRef = useRef(restore);\n restoreRef.current = restore;\n const openThreadRef = useRef(openThread);\n openThreadRef.current = openThread;\n const canOpenThreads = openThread !== undefined;\n const onEventRef = useRef(onEvent);\n onEventRef.current = onEvent;\n const checkAttachmentsRef = useRef(checkAttachments);\n checkAttachmentsRef.current = checkAttachments;\n const checksAttachments = checkAttachments !== undefined;\n const reachabilityRef = useRef(reachability);\n reachabilityRef.current = reachability;\n const foregroundRef = useRef(foreground);\n foregroundRef.current = foreground;\n // The client's notifications reach the port through this set, so a client whose identity\n // changes mid-thread is followed without remaking the outbox (and losing its countdown).\n const [threadListeners] = useState(() => new Set<() => void>());\n // A host without an outbox (`enabled` false) is never subscribed to.\n useEffect(() => {\n if (!enabled) return undefined;\n return client.subscribe(() => {\n for (const listener of threadListeners) listener();\n });\n }, [client, threadListeners, enabled]);\n // Signals read through refs for the same reason: a host rebuilding its signal objects per render\n // never remakes the outbox.\n const [stableSignals] = useState(() => {\n const forward = (pick: () => ChatOutboxSignal): ChatOutboxSignal => ({\n get: () => pick().get(),\n subscribe: (listener) => pick().subscribe(listener),\n });\n return {\n reachability: forward(() => reachabilityRef.current),\n foreground: forward(() => foregroundRef.current),\n };\n });\n const isNewChatRef = useRef(isNewChat);\n isNewChatRef.current = isNewChat;\n\n const [outbox, setOutbox] = useState<ChatOutbox | null>(null);\n // Made in an effect, not during render: the outbox subscribes to its signals and reads its\n // store, and a render React throws away must not leave those behind.\n // biome-ignore lint/correctness/useExhaustiveDependencies: one outbox per thread and store; everything else is read through refs.\n useEffect(() => {\n if (!enabled || !threadId) {\n setOutbox(null);\n return undefined;\n }\n const created = createChatOutbox({\n threadId,\n // Read at each hold: a chat that starts while mounted stamps its later messages as started.\n isNewChat: () => isNewChatRef.current,\n store,\n reachability: stableSignals.reachability,\n foreground: stableSignals.foreground,\n thread: {\n ...createStatewireChatOutboxPort({ client: () => clientRef.current }),\n subscribe: (listener) => {\n threadListeners.add(listener);\n return () => {\n threadListeners.delete(listener);\n };\n },\n },\n restore: (entry) => restoreRef.current(entry),\n ...(canOpenThreads && {\n openThread: (target: { threadId: string; newChat: boolean }) => openThreadRef.current?.(target),\n }),\n onEvent: (event) => onEventRef.current?.(event),\n ...(checksAttachments && {\n checkAttachments: (attachments: Parameters<ChatOutboxAttachmentCheck>[0]) =>\n checkAttachmentsRef.current?.(attachments) ?? Promise.resolve(\"ok\" as const),\n }),\n ...(countdownMs !== undefined && { countdownMs }),\n });\n setOutbox(created);\n return () => {\n created.dispose();\n setOutbox((current) => (current === created ? null : current));\n };\n }, [enabled, threadId, store, countdownMs, canOpenThreads, checksAttachments]);\n // During a thread switch's first render the previous thread's outbox is still in state.\n return outbox !== null && outbox.threadId === threadId ? outbox : null;\n}\n\nconst EMPTY_SNAPSHOT: ChatOutboxSnapshot = {\n rows: [],\n countdownEndsAt: null,\n durable: true,\n loaded: true,\n elsewhere: [],\n};\nconst noopSubscribe = () => () => undefined;\n\n/** The outbox's rows and countdown, re-rendering on every change (`null` outbox: nothing waits). */\nexport function useChatOutboxSnapshot(outbox: ChatOutbox | null): ChatOutboxSnapshot {\n return useSyncExternalStore(\n outbox ? outbox.subscribe : noopSubscribe,\n () => outbox?.getSnapshot() ?? EMPTY_SNAPSHOT,\n () => outbox?.getSnapshot() ?? EMPTY_SNAPSHOT,\n );\n}\n\n/**\n * Whether Athena can be reached, as the thread's outbox reads it: `true` without an outbox (a host\n * that keeps none sends and edits as before). What a sent message's Edit is offered on; a boolean,\n * so a reader re-renders only when it flips.\n */\nexport function useChatOutboxReachable(outbox: ChatOutbox | null): boolean {\n const subscribe = useCallback(\n (listener: () => void) => (outbox ? outbox.reachability.subscribe(listener) : () => undefined),\n [outbox],\n );\n const reachable = () => outbox?.reachability.get() ?? true;\n return useSyncExternalStore(subscribe, reachable, reachable);\n}\n\n/** The mounted thread's chat outbox, shared from its runtime provider to its composer and tray. */\nexport const DeepAgentChatOutboxContext = createContext<ChatOutbox | null>(null);\n\nexport function useDeepAgentChatOutboxContext(): ChatOutbox | null {\n return useContext(DeepAgentChatOutboxContext);\n}\n\n/** Forward statewire's command lifecycle to an outbox held in a ref (the runtime is made first). */\nexport function forwardChatOutboxCommand(\n outbox: { current: ChatOutbox | null },\n update: ChatOutboxCommandUpdate,\n): void {\n outbox.current?.observeCommand(update);\n}\n"],"names":["useRef","useState","useEffect","createChatOutbox","createStatewireChatOutboxPort","useSyncExternalStore","useCallback","createContext","useContext"],"mappings":";;;;;AAuDO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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QAAQ;AAAA,EACR,WAAW,CAAA;AACb;AACA,MAAM,gBAAgB,MAAM,MAAM;AAG3B,SAAS,sBAAsB,QAA+C;AACnF,SAAOC,MAAAA;AAAAA,IACL,SAAS,OAAO,YAAY;AAAA,IAC5B,OAAM,iCAAQ,kBAAiB;AAAA,IAC/B,OAAM,iCAAQ,kBAAiB;AAAA,EAAA;AAEnC;AAOO,SAAS,uBAAuB,QAAoC;AACzE,QAAM,YAAYC,MAAAA;AAAAA,IAChB,CAAC,aAA0B,SAAS,OAAO,aAAa,UAAU,QAAQ,IAAI,MAAM;AAAA,IACpF,CAAC,MAAM;AAAA,EAAA;AAET,QAAM,YAAY,OAAM,iCAAQ,aAAa,UAAS;AACtD,SAAOD,2BAAqB,WAAW,WAAW,SAAS;AAC7D;AAGO,MAAM,6BAA6BE,MAAAA,cAAiC,IAAI;AAExE,SAAS,gCAAmD;AACjE,SAAOC,MAAAA,WAAW,0BAA0B;AAC9C;;;;;;"}
|
|
1
|
+
{"version":3,"file":"use-deep-agent-chat-outbox.cjs","sources":["../../../../agent-runtime/src/use-deep-agent-chat-outbox.ts"],"sourcesContent":["import {\n type Context,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport type { ChatOutboxAttachmentCheck } from \"./chat-outbox-attachments\";\nimport {\n type ChatOutbox,\n type ChatOutboxCommandUpdate,\n type ChatOutboxEvent,\n type ChatOutboxSignal,\n type ChatOutboxSnapshot,\n createChatOutbox,\n} from \"./chat-outbox\";\nimport type { ChatOutboxEntry, ChatOutboxStore } from \"./chat-outbox-store\";\nimport { type ChatOutboxClientHost, createStatewireChatOutboxPort } from \"./chat-outbox-thread\";\n\nexport interface UseDeepAgentChatOutboxOptions {\n /** The thread's assistant-ui client (`useDeepAgentRuntime`'s result). */\n client: ChatOutboxClientHost;\n threadId: string;\n /** The conversation has never started (a new chat). */\n isNewChat: boolean;\n /**\n * This person's outbox store, one per person for the life of the page or app (a message the\n * device cannot keep waits in its memory, across thread switches); `null` keeps waiting messages\n * in this outbox alone.\n */\n store: ChatOutboxStore | null;\n /** Athena's reachability (the host's own model: the browser online AND agora answering). */\n reachability: ChatOutboxSignal;\n /** The app is in front (a visible tab, an active app, a focused desktop window). */\n foreground: ChatOutboxSignal;\n /** Give a cancelled message's text back to the composer. */\n restore: (entry: ChatOutboxEntry) => void;\n /**\n * Open another of the person's conversations holding waiting messages (the tray's Open); omit\n * it where the host cannot switch conversations.\n */\n openThread?: (target: { threadId: string; newChat: boolean }) => void;\n onEvent?: (event: ChatOutboxEvent) => void;\n /**\n * Asks Athena whether a waiting message's attachments can still be opened, right before it goes\n * (`createChatOutboxAttachmentCheck`); omitted, attachments go unchecked.\n */\n checkAttachments?: ChatOutboxAttachmentCheck;\n /** Off: no outbox (a read-only or suspended surface); sends behave as before. */\n enabled?: boolean;\n /** The countdown before a waiting message is sent (tests); defaults to `CHAT_OUTBOX_COUNTDOWN_MS`. */\n countdownMs?: number;\n}\n\n/**\n * The chat outbox for the mounted thread (`chat-outbox.ts`), one per thread and store: a thread\n * switch disposes it and makes the next thread's. The host forwards statewire's command lifecycle\n * to {@link ChatOutbox.observeCommand} (its `useDeepAgentRuntime` `onCommandChange`), shares the\n * instance through {@link DeepAgentChatOutboxContext}, and has its composer call\n * {@link ChatOutbox.shouldHold} / {@link ChatOutbox.hold} before sending.\n */\nexport function useDeepAgentChatOutbox({\n client,\n threadId,\n isNewChat,\n store,\n reachability,\n foreground,\n restore,\n openThread,\n onEvent,\n checkAttachments,\n enabled = true,\n countdownMs,\n}: UseDeepAgentChatOutboxOptions): ChatOutbox | null {\n const clientRef = useRef(client);\n clientRef.current = client;\n const restoreRef = useRef(restore);\n restoreRef.current = restore;\n const openThreadRef = useRef(openThread);\n openThreadRef.current = openThread;\n const canOpenThreads = openThread !== undefined;\n const onEventRef = useRef(onEvent);\n onEventRef.current = onEvent;\n const checkAttachmentsRef = useRef(checkAttachments);\n checkAttachmentsRef.current = checkAttachments;\n const checksAttachments = checkAttachments !== undefined;\n const reachabilityRef = useRef(reachability);\n reachabilityRef.current = reachability;\n const foregroundRef = useRef(foreground);\n foregroundRef.current = foreground;\n // The client's notifications reach the port through this set, so a client whose identity\n // changes mid-thread is followed without remaking the outbox (and losing its countdown).\n const [threadListeners] = useState(() => new Set<() => void>());\n // A host without an outbox (`enabled` false) is never subscribed to.\n useEffect(() => {\n if (!enabled) return undefined;\n return client.subscribe(() => {\n for (const listener of threadListeners) listener();\n });\n }, [client, threadListeners, enabled]);\n // Signals read through refs for the same reason: a host rebuilding its signal objects per render\n // never remakes the outbox.\n const [stableSignals] = useState(() => {\n const forward = (pick: () => ChatOutboxSignal): ChatOutboxSignal => ({\n get: () => pick().get(),\n subscribe: (listener) => pick().subscribe(listener),\n });\n return {\n reachability: forward(() => reachabilityRef.current),\n foreground: forward(() => foregroundRef.current),\n };\n });\n const isNewChatRef = useRef(isNewChat);\n isNewChatRef.current = isNewChat;\n\n const [outbox, setOutbox] = useState<ChatOutbox | null>(null);\n // Made in an effect, not during render: the outbox subscribes to its signals and reads its\n // store, and a render React throws away must not leave those behind.\n // biome-ignore lint/correctness/useExhaustiveDependencies: one outbox per thread and store; everything else is read through refs.\n useEffect(() => {\n if (!enabled || !threadId) {\n setOutbox(null);\n return undefined;\n }\n const created = createChatOutbox({\n threadId,\n // Read at each hold: a chat that starts while mounted stamps its later messages as started.\n isNewChat: () => isNewChatRef.current,\n store,\n reachability: stableSignals.reachability,\n foreground: stableSignals.foreground,\n thread: {\n ...createStatewireChatOutboxPort({ client: () => clientRef.current }),\n subscribe: (listener) => {\n threadListeners.add(listener);\n return () => {\n threadListeners.delete(listener);\n };\n },\n },\n restore: (entry) => restoreRef.current(entry),\n ...(canOpenThreads && {\n openThread: (target: { threadId: string; newChat: boolean }) => openThreadRef.current?.(target),\n }),\n onEvent: (event) => onEventRef.current?.(event),\n ...(checksAttachments && {\n checkAttachments: (attachments: Parameters<ChatOutboxAttachmentCheck>[0]) =>\n checkAttachmentsRef.current?.(attachments) ?? Promise.resolve(\"ok\" as const),\n }),\n ...(countdownMs !== undefined && { countdownMs }),\n });\n setOutbox(created);\n return () => {\n created.dispose();\n setOutbox((current) => (current === created ? null : current));\n };\n }, [enabled, threadId, store, countdownMs, canOpenThreads, checksAttachments]);\n // During a thread switch's first render the previous thread's outbox is still in state.\n return outbox !== null && outbox.threadId === threadId ? outbox : null;\n}\n\nconst EMPTY_SNAPSHOT: ChatOutboxSnapshot = {\n rows: [],\n countdownEndsAt: null,\n durable: true,\n loaded: true,\n elsewhere: [],\n};\nconst noopSubscribe = () => () => undefined;\n\n/** The outbox's rows and countdown, re-rendering on every change (`null` outbox: nothing waits). */\nexport function useChatOutboxSnapshot(outbox: ChatOutbox | null): ChatOutboxSnapshot {\n return useSyncExternalStore(\n outbox ? outbox.subscribe : noopSubscribe,\n () => outbox?.getSnapshot() ?? EMPTY_SNAPSHOT,\n () => outbox?.getSnapshot() ?? EMPTY_SNAPSHOT,\n );\n}\n\n/**\n * Whether Athena can be reached, as the thread's outbox reads it: `true` without an outbox (a host\n * that keeps none sends and edits as before). What a sent message's Edit is offered on; a boolean,\n * so a reader re-renders only when it flips.\n */\nexport function useChatOutboxReachable(outbox: ChatOutbox | null): boolean {\n const subscribe = useCallback(\n (listener: () => void) => (outbox ? outbox.reachability.subscribe(listener) : () => undefined),\n [outbox],\n );\n const reachable = () => outbox?.reachability.get() ?? true;\n return useSyncExternalStore(subscribe, reachable, reachable);\n}\n\n/**\n * The context lives on `globalThis`, not in module scope, because two copies of this module can\n * run in one page: the SDK bundles agent-runtime into its dist while a host such as Olympus imports\n * agent-runtime directly. The host provides its thread's outbox through its own copy and mounts the\n * SDK's queue tray, which reads it through the SDK's copy: one context per copy, and the tray would\n * never see a waiting message (`asset-attachment.ts` shares its registry the same way).\n */\nconst CHAT_OUTBOX_CONTEXT = Symbol.for(\"@athenaintel/agent-runtime/deep-agent-chat-outbox-context\");\n\ntype ChatOutboxContextHost = typeof globalThis & {\n [CHAT_OUTBOX_CONTEXT]?: Context<ChatOutbox | null>;\n};\n\nfunction sharedChatOutboxContext(): Context<ChatOutbox | null> {\n const host = globalThis as ChatOutboxContextHost;\n return (host[CHAT_OUTBOX_CONTEXT] ??= createContext<ChatOutbox | null>(null));\n}\n\n/** The mounted thread's chat outbox, shared from its runtime provider to its composer and tray. */\nexport const DeepAgentChatOutboxContext: Context<ChatOutbox | null> = sharedChatOutboxContext();\n\nexport function useDeepAgentChatOutboxContext(): ChatOutbox | null {\n return useContext(DeepAgentChatOutboxContext);\n}\n\n/** Forward statewire's command lifecycle to an outbox held in a ref (the runtime is made first). */\nexport function forwardChatOutboxCommand(\n outbox: { current: ChatOutbox | null },\n update: ChatOutboxCommandUpdate,\n): void {\n outbox.current?.observeCommand(update);\n}\n"],"names":["useRef","useState","useEffect","createChatOutbox","createStatewireChatOutboxPort","useSyncExternalStore","useCallback","createContext","useContext"],"mappings":";;;;;AAgEO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AACF,GAAqD;AACnD,QAAM,YAAYA,WAAAA,OAAO,MAAM;AAC/B,YAAU,UAAU;AACpB,QAAM,aAAaA,WAAAA,OAAO,OAAO;AACjC,aAAW,UAAU;AACrB,QAAM,gBAAgBA,WAAAA,OAAO,UAAU;AACvC,gBAAc,UAAU;AACxB,QAAM,iBAAiB,eAAe;AACtC,QAAM,aAAaA,WAAAA,OAAO,OAAO;AACjC,aAAW,UAAU;AACrB,QAAM,sBAAsBA,WAAAA,OAAO,gBAAgB;AACnD,sBAAoB,UAAU;AAC9B,QAAM,oBAAoB,qBAAqB;AAC/C,QAAM,kBAAkBA,WAAAA,OAAO,YAAY;AAC3C,kBAAgB,UAAU;AAC1B,QAAM,gBAAgBA,WAAAA,OAAO,UAAU;AACvC,gBAAc,UAAU;A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AsD;AAC7D,QAAM,OAAO;AACb,SAAQ,0DAA8BE,WAAAA,cAAiC,IAAI;AAC7E;AAGO,MAAM,6BAAyD,wBAAA;AAE/D,SAAS,gCAAmD;AACjE,SAAOC,WAAAA,WAAW,0BAA0B;AAC9C;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Context } from "react";
|
|
1
2
|
import type { ChatOutboxAttachmentCheck } from "./chat-outbox-attachments";
|
|
2
3
|
import { type ChatOutbox, type ChatOutboxCommandUpdate, type ChatOutboxEvent, type ChatOutboxSignal, type ChatOutboxSnapshot } from "./chat-outbox";
|
|
3
4
|
import type { ChatOutboxEntry, ChatOutboxStore } from "./chat-outbox-store";
|
|
@@ -56,7 +57,7 @@ export declare function useChatOutboxSnapshot(outbox: ChatOutbox | null): ChatOu
|
|
|
56
57
|
*/
|
|
57
58
|
export declare function useChatOutboxReachable(outbox: ChatOutbox | null): boolean;
|
|
58
59
|
/** The mounted thread's chat outbox, shared from its runtime provider to its composer and tray. */
|
|
59
|
-
export declare const DeepAgentChatOutboxContext:
|
|
60
|
+
export declare const DeepAgentChatOutboxContext: Context<ChatOutbox | null>;
|
|
60
61
|
export declare function useDeepAgentChatOutboxContext(): ChatOutbox | null;
|
|
61
62
|
/** Forward statewire's command lifecycle to an outbox held in a ref (the runtime is made first). */
|
|
62
63
|
export declare function forwardChatOutboxCommand(outbox: {
|
|
@@ -122,7 +122,12 @@ function useChatOutboxReachable(outbox) {
|
|
|
122
122
|
const reachable = () => (outbox == null ? void 0 : outbox.reachability.get()) ?? true;
|
|
123
123
|
return useSyncExternalStore(subscribe, reachable, reachable);
|
|
124
124
|
}
|
|
125
|
-
const
|
|
125
|
+
const CHAT_OUTBOX_CONTEXT = Symbol.for("@athenaintel/agent-runtime/deep-agent-chat-outbox-context");
|
|
126
|
+
function sharedChatOutboxContext() {
|
|
127
|
+
const host = globalThis;
|
|
128
|
+
return host[CHAT_OUTBOX_CONTEXT] ?? (host[CHAT_OUTBOX_CONTEXT] = createContext(null));
|
|
129
|
+
}
|
|
130
|
+
const DeepAgentChatOutboxContext = sharedChatOutboxContext();
|
|
126
131
|
function useDeepAgentChatOutboxContext() {
|
|
127
132
|
return useContext(DeepAgentChatOutboxContext);
|
|
128
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-deep-agent-chat-outbox.js","sources":["../../../../agent-runtime/src/use-deep-agent-chat-outbox.ts"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport type { ChatOutboxAttachmentCheck } from \"./chat-outbox-attachments\";\nimport {\n type ChatOutbox,\n type ChatOutboxCommandUpdate,\n type ChatOutboxEvent,\n type ChatOutboxSignal,\n type ChatOutboxSnapshot,\n createChatOutbox,\n} from \"./chat-outbox\";\nimport type { ChatOutboxEntry, ChatOutboxStore } from \"./chat-outbox-store\";\nimport { type ChatOutboxClientHost, createStatewireChatOutboxPort } from \"./chat-outbox-thread\";\n\nexport interface UseDeepAgentChatOutboxOptions {\n /** The thread's assistant-ui client (`useDeepAgentRuntime`'s result). */\n client: ChatOutboxClientHost;\n threadId: string;\n /** The conversation has never started (a new chat). */\n isNewChat: boolean;\n /**\n * This person's outbox store, one per person for the life of the page or app (a message the\n * device cannot keep waits in its memory, across thread switches); `null` keeps waiting messages\n * in this outbox alone.\n */\n store: ChatOutboxStore | null;\n /** Athena's reachability (the host's own model: the browser online AND agora answering). */\n reachability: ChatOutboxSignal;\n /** The app is in front (a visible tab, an active app, a focused desktop window). */\n foreground: ChatOutboxSignal;\n /** Give a cancelled message's text back to the composer. */\n restore: (entry: ChatOutboxEntry) => void;\n /**\n * Open another of the person's conversations holding waiting messages (the tray's Open); omit\n * it where the host cannot switch conversations.\n */\n openThread?: (target: { threadId: string; newChat: boolean }) => void;\n onEvent?: (event: ChatOutboxEvent) => void;\n /**\n * Asks Athena whether a waiting message's attachments can still be opened, right before it goes\n * (`createChatOutboxAttachmentCheck`); omitted, attachments go unchecked.\n */\n checkAttachments?: ChatOutboxAttachmentCheck;\n /** Off: no outbox (a read-only or suspended surface); sends behave as before. */\n enabled?: boolean;\n /** The countdown before a waiting message is sent (tests); defaults to `CHAT_OUTBOX_COUNTDOWN_MS`. */\n countdownMs?: number;\n}\n\n/**\n * The chat outbox for the mounted thread (`chat-outbox.ts`), one per thread and store: a thread\n * switch disposes it and makes the next thread's. The host forwards statewire's command lifecycle\n * to {@link ChatOutbox.observeCommand} (its `useDeepAgentRuntime` `onCommandChange`), shares the\n * instance through {@link DeepAgentChatOutboxContext}, and has its composer call\n * {@link ChatOutbox.shouldHold} / {@link ChatOutbox.hold} before sending.\n */\nexport function useDeepAgentChatOutbox({\n client,\n threadId,\n isNewChat,\n store,\n reachability,\n foreground,\n restore,\n openThread,\n onEvent,\n checkAttachments,\n enabled = true,\n countdownMs,\n}: UseDeepAgentChatOutboxOptions): ChatOutbox | null {\n const clientRef = useRef(client);\n clientRef.current = client;\n const restoreRef = useRef(restore);\n restoreRef.current = restore;\n const openThreadRef = useRef(openThread);\n openThreadRef.current = openThread;\n const canOpenThreads = openThread !== undefined;\n const onEventRef = useRef(onEvent);\n onEventRef.current = onEvent;\n const checkAttachmentsRef = useRef(checkAttachments);\n checkAttachmentsRef.current = checkAttachments;\n const checksAttachments = checkAttachments !== undefined;\n const reachabilityRef = useRef(reachability);\n reachabilityRef.current = reachability;\n const foregroundRef = useRef(foreground);\n foregroundRef.current = foreground;\n // The client's notifications reach the port through this set, so a client whose identity\n // changes mid-thread is followed without remaking the outbox (and losing its countdown).\n const [threadListeners] = useState(() => new Set<() => void>());\n // A host without an outbox (`enabled` false) is never subscribed to.\n useEffect(() => {\n if (!enabled) return undefined;\n return client.subscribe(() => {\n for (const listener of threadListeners) listener();\n });\n }, [client, threadListeners, enabled]);\n // Signals read through refs for the same reason: a host rebuilding its signal objects per render\n // never remakes the outbox.\n const [stableSignals] = useState(() => {\n const forward = (pick: () => ChatOutboxSignal): ChatOutboxSignal => ({\n get: () => pick().get(),\n subscribe: (listener) => pick().subscribe(listener),\n });\n return {\n reachability: forward(() => reachabilityRef.current),\n foreground: forward(() => foregroundRef.current),\n };\n });\n const isNewChatRef = useRef(isNewChat);\n isNewChatRef.current = isNewChat;\n\n const [outbox, setOutbox] = useState<ChatOutbox | null>(null);\n // Made in an effect, not during render: the outbox subscribes to its signals and reads its\n // store, and a render React throws away must not leave those behind.\n // biome-ignore lint/correctness/useExhaustiveDependencies: one outbox per thread and store; everything else is read through refs.\n useEffect(() => {\n if (!enabled || !threadId) {\n setOutbox(null);\n return undefined;\n }\n const created = createChatOutbox({\n threadId,\n // Read at each hold: a chat that starts while mounted stamps its later messages as started.\n isNewChat: () => isNewChatRef.current,\n store,\n reachability: stableSignals.reachability,\n foreground: stableSignals.foreground,\n thread: {\n ...createStatewireChatOutboxPort({ client: () => clientRef.current }),\n subscribe: (listener) => {\n threadListeners.add(listener);\n return () => {\n threadListeners.delete(listener);\n };\n },\n },\n restore: (entry) => restoreRef.current(entry),\n ...(canOpenThreads && {\n openThread: (target: { threadId: string; newChat: boolean }) => openThreadRef.current?.(target),\n }),\n onEvent: (event) => onEventRef.current?.(event),\n ...(checksAttachments && {\n checkAttachments: (attachments: Parameters<ChatOutboxAttachmentCheck>[0]) =>\n checkAttachmentsRef.current?.(attachments) ?? Promise.resolve(\"ok\" as const),\n }),\n ...(countdownMs !== undefined && { countdownMs }),\n });\n setOutbox(created);\n return () => {\n created.dispose();\n setOutbox((current) => (current === created ? null : current));\n };\n }, [enabled, threadId, store, countdownMs, canOpenThreads, checksAttachments]);\n // During a thread switch's first render the previous thread's outbox is still in state.\n return outbox !== null && outbox.threadId === threadId ? outbox : null;\n}\n\nconst EMPTY_SNAPSHOT: ChatOutboxSnapshot = {\n rows: [],\n countdownEndsAt: null,\n durable: true,\n loaded: true,\n elsewhere: [],\n};\nconst noopSubscribe = () => () => undefined;\n\n/** The outbox's rows and countdown, re-rendering on every change (`null` outbox: nothing waits). */\nexport function useChatOutboxSnapshot(outbox: ChatOutbox | null): ChatOutboxSnapshot {\n return useSyncExternalStore(\n outbox ? outbox.subscribe : noopSubscribe,\n () => outbox?.getSnapshot() ?? EMPTY_SNAPSHOT,\n () => outbox?.getSnapshot() ?? EMPTY_SNAPSHOT,\n );\n}\n\n/**\n * Whether Athena can be reached, as the thread's outbox reads it: `true` without an outbox (a host\n * that keeps none sends and edits as before). What a sent message's Edit is offered on; a boolean,\n * so a reader re-renders only when it flips.\n */\nexport function useChatOutboxReachable(outbox: ChatOutbox | null): boolean {\n const subscribe = useCallback(\n (listener: () => void) => (outbox ? outbox.reachability.subscribe(listener) : () => undefined),\n [outbox],\n );\n const reachable = () => outbox?.reachability.get() ?? true;\n return useSyncExternalStore(subscribe, reachable, reachable);\n}\n\n/** The mounted thread's chat outbox, shared from its runtime provider to its composer and tray. */\nexport const DeepAgentChatOutboxContext = createContext<ChatOutbox | null>(null);\n\nexport function useDeepAgentChatOutboxContext(): ChatOutbox | null {\n return useContext(DeepAgentChatOutboxContext);\n}\n\n/** Forward statewire's command lifecycle to an outbox held in a ref (the runtime is made first). */\nexport function forwardChatOutboxCommand(\n outbox: { current: ChatOutbox | null },\n update: ChatOutboxCommandUpdate,\n): void {\n outbox.current?.observeCommand(update);\n}\n"],"names":[],"mappings":";;;AAuDO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AACF,GAAqD;AACnD,QAAM,YAAY,OAAO,MAAM;AAC/B,YAAU,UAAU;AACpB,QAAM,aAAa,OAAO,OAAO;AACjC,aAAW,UAAU;AACrB,QAAM,gBAAgB,OAAO,UAAU;AACvC,gBAAc,UAAU;AACxB,QAAM,iBAAiB,eAAe;AACtC,QAAM,aAAa,OAAO,OAAO;AACjC,aAAW,UAAU;AACrB,QAAM,sBAAsB,OAAO,gBAAgB;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W,SAAS;AAC7D;AAGO,MAAM,6BAA6B,cAAiC,IAAI;AAExE,SAAS,gCAAmD;AACjE,SAAO,WAAW,0BAA0B;AAC9C;"}
|
|
1
|
+
{"version":3,"file":"use-deep-agent-chat-outbox.js","sources":["../../../../agent-runtime/src/use-deep-agent-chat-outbox.ts"],"sourcesContent":["import {\n type Context,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport type { ChatOutboxAttachmentCheck } from \"./chat-outbox-attachments\";\nimport {\n type ChatOutbox,\n type ChatOutboxCommandUpdate,\n type ChatOutboxEvent,\n type ChatOutboxSignal,\n type ChatOutboxSnapshot,\n createChatOutbox,\n} from \"./chat-outbox\";\nimport type { ChatOutboxEntry, ChatOutboxStore } from \"./chat-outbox-store\";\nimport { type ChatOutboxClientHost, createStatewireChatOutboxPort } from \"./chat-outbox-thread\";\n\nexport interface UseDeepAgentChatOutboxOptions {\n /** The thread's assistant-ui client (`useDeepAgentRuntime`'s result). */\n client: ChatOutboxClientHost;\n threadId: string;\n /** The conversation has never started (a new chat). */\n isNewChat: boolean;\n /**\n * This person's outbox store, one per person for the life of the page or app (a message the\n * device cannot keep waits in its memory, across thread switches); `null` keeps waiting messages\n * in this outbox alone.\n */\n store: ChatOutboxStore | null;\n /** Athena's reachability (the host's own model: the browser online AND agora answering). */\n reachability: ChatOutboxSignal;\n /** The app is in front (a visible tab, an active app, a focused desktop window). */\n foreground: ChatOutboxSignal;\n /** Give a cancelled message's text back to the composer. */\n restore: (entry: ChatOutboxEntry) => void;\n /**\n * Open another of the person's conversations holding waiting messages (the tray's Open); omit\n * it where the host cannot switch conversations.\n */\n openThread?: (target: { threadId: string; newChat: boolean }) => void;\n onEvent?: (event: ChatOutboxEvent) => void;\n /**\n * Asks Athena whether a waiting message's attachments can still be opened, right before it goes\n * (`createChatOutboxAttachmentCheck`); omitted, attachments go unchecked.\n */\n checkAttachments?: ChatOutboxAttachmentCheck;\n /** Off: no outbox (a read-only or suspended surface); sends behave as before. */\n enabled?: boolean;\n /** The countdown before a waiting message is sent (tests); defaults to `CHAT_OUTBOX_COUNTDOWN_MS`. */\n countdownMs?: number;\n}\n\n/**\n * The chat outbox for the mounted thread (`chat-outbox.ts`), one per thread and store: a thread\n * switch disposes it and makes the next thread's. The host forwards statewire's command lifecycle\n * to {@link ChatOutbox.observeCommand} (its `useDeepAgentRuntime` `onCommandChange`), shares the\n * instance through {@link DeepAgentChatOutboxContext}, and has its composer call\n * {@link ChatOutbox.shouldHold} / {@link ChatOutbox.hold} before sending.\n */\nexport function useDeepAgentChatOutbox({\n client,\n threadId,\n isNewChat,\n store,\n reachability,\n foreground,\n restore,\n openThread,\n onEvent,\n checkAttachments,\n enabled = true,\n countdownMs,\n}: UseDeepAgentChatOutboxOptions): ChatOutbox | null {\n const clientRef = useRef(client);\n clientRef.current = client;\n const restoreRef = useRef(restore);\n restoreRef.current = restore;\n const openThreadRef = useRef(openThread);\n openThreadRef.current = openThread;\n const canOpenThreads = openThread !== undefined;\n const onEventRef = useRef(onEvent);\n onEventRef.current = onEvent;\n const checkAttachmentsRef = useRef(checkAttachments);\n checkAttachmentsRef.current = checkAttachments;\n const checksAttachments = checkAttachments !== undefined;\n const reachabilityRef = useRef(reachability);\n reachabilityRef.current = reachability;\n const foregroundRef = useRef(foreground);\n foregroundRef.current = foreground;\n // The client's notifications reach the port through this set, so a client whose identity\n // changes mid-thread is followed without remaking the outbox (and losing its countdown).\n const [threadListeners] = useState(() => new Set<() => void>());\n // A host without an outbox (`enabled` false) is never subscribed to.\n useEffect(() => {\n if (!enabled) return undefined;\n return client.subscribe(() => {\n for (const listener of threadListeners) listener();\n });\n }, [client, threadListeners, enabled]);\n // Signals read through refs for the same reason: a host rebuilding its signal objects per render\n // never remakes the outbox.\n const [stableSignals] = useState(() => {\n const forward = (pick: () => ChatOutboxSignal): ChatOutboxSignal => ({\n get: () => pick().get(),\n subscribe: (listener) => pick().subscribe(listener),\n });\n return {\n reachability: forward(() => reachabilityRef.current),\n foreground: forward(() => foregroundRef.current),\n };\n });\n const isNewChatRef = useRef(isNewChat);\n isNewChatRef.current = isNewChat;\n\n const [outbox, setOutbox] = useState<ChatOutbox | null>(null);\n // Made in an effect, not during render: the outbox subscribes to its signals and reads its\n // store, and a render React throws away must not leave those behind.\n // biome-ignore lint/correctness/useExhaustiveDependencies: one outbox per thread and store; everything else is read through refs.\n useEffect(() => {\n if (!enabled || !threadId) {\n setOutbox(null);\n return undefined;\n }\n const created = createChatOutbox({\n threadId,\n // Read at each hold: a chat that starts while mounted stamps its later messages as started.\n isNewChat: () => isNewChatRef.current,\n store,\n reachability: stableSignals.reachability,\n foreground: stableSignals.foreground,\n thread: {\n ...createStatewireChatOutboxPort({ client: () => clientRef.current }),\n subscribe: (listener) => {\n threadListeners.add(listener);\n return () => {\n threadListeners.delete(listener);\n };\n },\n },\n restore: (entry) => restoreRef.current(entry),\n ...(canOpenThreads && {\n openThread: (target: { threadId: string; newChat: boolean }) => openThreadRef.current?.(target),\n }),\n onEvent: (event) => onEventRef.current?.(event),\n ...(checksAttachments && {\n checkAttachments: (attachments: Parameters<ChatOutboxAttachmentCheck>[0]) =>\n checkAttachmentsRef.current?.(attachments) ?? Promise.resolve(\"ok\" as const),\n }),\n ...(countdownMs !== undefined && { countdownMs }),\n });\n setOutbox(created);\n return () => {\n created.dispose();\n setOutbox((current) => (current === created ? null : current));\n };\n }, [enabled, threadId, store, countdownMs, canOpenThreads, checksAttachments]);\n // During a thread switch's first render the previous thread's outbox is still in state.\n return outbox !== null && outbox.threadId === threadId ? outbox : null;\n}\n\nconst EMPTY_SNAPSHOT: ChatOutboxSnapshot = {\n rows: [],\n countdownEndsAt: null,\n durable: true,\n loaded: true,\n elsewhere: [],\n};\nconst noopSubscribe = () => () => undefined;\n\n/** The outbox's rows and countdown, re-rendering on every change (`null` outbox: nothing waits). */\nexport function useChatOutboxSnapshot(outbox: ChatOutbox | null): ChatOutboxSnapshot {\n return useSyncExternalStore(\n outbox ? outbox.subscribe : noopSubscribe,\n () => outbox?.getSnapshot() ?? EMPTY_SNAPSHOT,\n () => outbox?.getSnapshot() ?? EMPTY_SNAPSHOT,\n );\n}\n\n/**\n * Whether Athena can be reached, as the thread's outbox reads it: `true` without an outbox (a host\n * that keeps none sends and edits as before). What a sent message's Edit is offered on; a boolean,\n * so a reader re-renders only when it flips.\n */\nexport function useChatOutboxReachable(outbox: ChatOutbox | null): boolean {\n const subscribe = useCallback(\n (listener: () => void) => (outbox ? outbox.reachability.subscribe(listener) : () => undefined),\n [outbox],\n );\n const reachable = () => outbox?.reachability.get() ?? true;\n return useSyncExternalStore(subscribe, reachable, reachable);\n}\n\n/**\n * The context lives on `globalThis`, not in module scope, because two copies of this module can\n * run in one page: the SDK bundles agent-runtime into its dist while a host such as Olympus imports\n * agent-runtime directly. The host provides its thread's outbox through its own copy and mounts the\n * SDK's queue tray, which reads it through the SDK's copy: one context per copy, and the tray would\n * never see a waiting message (`asset-attachment.ts` shares its registry the same way).\n */\nconst CHAT_OUTBOX_CONTEXT = Symbol.for(\"@athenaintel/agent-runtime/deep-agent-chat-outbox-context\");\n\ntype ChatOutboxContextHost = typeof globalThis & {\n [CHAT_OUTBOX_CONTEXT]?: Context<ChatOutbox | null>;\n};\n\nfunction sharedChatOutboxContext(): Context<ChatOutbox | null> {\n const host = globalThis as ChatOutboxContextHost;\n return (host[CHAT_OUTBOX_CONTEXT] ??= createContext<ChatOutbox | null>(null));\n}\n\n/** The mounted thread's chat outbox, shared from its runtime provider to its composer and tray. */\nexport const DeepAgentChatOutboxContext: Context<ChatOutbox | null> = sharedChatOutboxContext();\n\nexport function useDeepAgentChatOutboxContext(): ChatOutbox | null {\n return useContext(DeepAgentChatOutboxContext);\n}\n\n/** Forward statewire's command lifecycle to an outbox held in a ref (the runtime is made first). */\nexport function forwardChatOutboxCommand(\n outbox: { current: ChatOutbox | null },\n update: ChatOutboxCommandUpdate,\n): void {\n outbox.current?.observeCommand(update);\n}\n"],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;AAAA,EACR,WAAW,CAAA;AACb;AACA,MAAM,gBAAgB,MAAM,MAAM;AAG3B,SAAS,sBAAsB,QAA+C;AACnF,SAAO;AAAA,IACL,SAAS,OAAO,YAAY;AAAA,IAC5B,OAAM,iCAAQ,kBAAiB;AAAA,IAC/B,OAAM,iCAAQ,kBAAiB;AAAA,EAAA;AAEnC;AAOO,SAAS,uBAAuB,QAAoC;AACzE,QAAM,YAAY;AAAA,IAChB,CAAC,aAA0B,SAAS,OAAO,aAAa,UAAU,QAAQ,IAAI,MAAM;AAAA,IACpF,CAAC,MAAM;AAAA,EAAA;AAET,QAAM,YAAY,OAAM,iCAAQ,aAAa,UAAS;AACtD,SAAO,qBAAqB,WAAW,WAAW,SAAS;AAC7D;AASA,MAAM,sBAAsB,OAAO,IAAI,2DAA2D;AAMlG,SAAS,0BAAsD;AAC7D,QAAM,OAAO;AACb,SAAQ,0DAA8B,cAAiC,IAAI;AAC7E;AAGO,MAAM,6BAAyD,wBAAA;AAE/D,SAAS,gCAAmD;AACjE,SAAO,WAAW,0BAA0B;AAC9C;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
require("@assistant-ui/react-statewire");
|
|
4
|
-
const
|
|
4
|
+
const require$$0 = require("react");
|
|
5
5
|
const configMutations = require("./config-mutations.cjs");
|
|
6
6
|
const errors = require("./errors.cjs");
|
|
7
7
|
const runconfigContract = require("./generated/runconfig-contract.cjs");
|
|
@@ -45,17 +45,17 @@ function useDeepAgentConfigController({
|
|
|
45
45
|
sendCommand,
|
|
46
46
|
onServerConfig
|
|
47
47
|
}) {
|
|
48
|
-
const [ops, setOps] =
|
|
49
|
-
const nextOpIdRef =
|
|
50
|
-
const sendCommandRef =
|
|
48
|
+
const [ops, setOps] = require$$0.useState([]);
|
|
49
|
+
const nextOpIdRef = require$$0.useRef(1);
|
|
50
|
+
const sendCommandRef = require$$0.useRef(sendCommand);
|
|
51
51
|
sendCommandRef.current = sendCommand;
|
|
52
|
-
const onServerConfigRef =
|
|
52
|
+
const onServerConfigRef = require$$0.useRef(onServerConfig);
|
|
53
53
|
onServerConfigRef.current = onServerConfig;
|
|
54
|
-
const custom =
|
|
54
|
+
const custom = require$$0.useMemo(() => foldPendingConfigOps(serverConfig, ops), [serverConfig, ops]);
|
|
55
55
|
const serverVersion = (serverConfig == null ? void 0 : serverConfig.version) ?? 0;
|
|
56
|
-
const serverVersionRef =
|
|
56
|
+
const serverVersionRef = require$$0.useRef(serverVersion);
|
|
57
57
|
serverVersionRef.current = serverVersion;
|
|
58
|
-
|
|
58
|
+
require$$0.useEffect(() => {
|
|
59
59
|
setOps((current) => {
|
|
60
60
|
const kept = current.filter(
|
|
61
61
|
(op) => op.settledVersion === null || op.settledVersion > serverVersion
|
|
@@ -63,14 +63,14 @@ function useDeepAgentConfigController({
|
|
|
63
63
|
return kept.length === current.length ? current : kept;
|
|
64
64
|
});
|
|
65
65
|
}, [serverVersion]);
|
|
66
|
-
const lastNotifiedRef =
|
|
67
|
-
|
|
66
|
+
const lastNotifiedRef = require$$0.useRef(null);
|
|
67
|
+
require$$0.useEffect(() => {
|
|
68
68
|
var _a;
|
|
69
69
|
if (serverConfig === null || serverConfig === lastNotifiedRef.current) return;
|
|
70
70
|
lastNotifiedRef.current = serverConfig;
|
|
71
71
|
(_a = onServerConfigRef.current) == null ? void 0 : _a.call(onServerConfigRef, { version: serverConfig.version, custom });
|
|
72
72
|
}, [serverConfig, custom]);
|
|
73
|
-
const run =
|
|
73
|
+
const run = require$$0.useCallback(
|
|
74
74
|
async (command, apply) => {
|
|
75
75
|
const id = nextOpIdRef.current++;
|
|
76
76
|
setOps((current) => [...current, { id, apply, settledVersion: null }]);
|
|
@@ -91,21 +91,21 @@ function useDeepAgentConfigController({
|
|
|
91
91
|
},
|
|
92
92
|
[]
|
|
93
93
|
);
|
|
94
|
-
const patchConfig =
|
|
94
|
+
const patchConfig = require$$0.useCallback(
|
|
95
95
|
(patch) => run(
|
|
96
96
|
{ type: runconfigContract.DEEP_AGENT_CONFIG_COMMANDS.patch, patch },
|
|
97
97
|
(base) => configMutations.applyConfigPatch(base, patch)
|
|
98
98
|
),
|
|
99
99
|
[run]
|
|
100
100
|
);
|
|
101
|
-
const enableTools =
|
|
101
|
+
const enableTools = require$$0.useCallback(
|
|
102
102
|
(toolIds) => run(
|
|
103
103
|
{ type: runconfigContract.DEEP_AGENT_CONFIG_COMMANDS.toolsEnable, toolIds: [...toolIds] },
|
|
104
104
|
(base) => configMutations.applyToolsEnable(base, toolIds)
|
|
105
105
|
),
|
|
106
106
|
[run]
|
|
107
107
|
);
|
|
108
|
-
const disableTools =
|
|
108
|
+
const disableTools = require$$0.useCallback(
|
|
109
109
|
(toolIds) => run(
|
|
110
110
|
{ type: runconfigContract.DEEP_AGENT_CONFIG_COMMANDS.toolsDisable, toolIds: [...toolIds] },
|
|
111
111
|
(base) => configMutations.applyToolsDisable(base, toolIds)
|