@athenaintel/react 0.28.1 → 0.32.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 +479 -10
- package/dist/agent-runtime/src/asset-attachment.cjs.map +1 -0
- package/dist/agent-runtime/src/asset-attachment.js.map +1 -0
- package/dist/agent-runtime/src/athena-asset-drag.cjs +44 -0
- package/dist/agent-runtime/src/athena-asset-drag.cjs.map +1 -0
- package/dist/agent-runtime/src/athena-asset-drag.js +44 -0
- package/dist/agent-runtime/src/athena-asset-drag.js.map +1 -0
- package/dist/agent-runtime/src/auth-denial.cjs.map +1 -0
- package/dist/agent-runtime/src/auth-denial.js.map +1 -0
- package/dist/agent-runtime/src/client-tool-bridge.cjs.map +1 -0
- package/dist/agent-runtime/src/client-tool-bridge.js.map +1 -0
- package/dist/agent-runtime/src/client-tools.cjs.map +1 -0
- package/dist/agent-runtime/src/client-tools.js.map +1 -0
- package/dist/agent-runtime/src/composer-markdown.cjs +124 -0
- package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -0
- package/dist/agent-runtime/src/composer-markdown.js +124 -0
- package/dist/agent-runtime/src/composer-markdown.js.map +1 -0
- package/dist/agent-runtime/src/config-mutations.cjs +59 -0
- package/dist/agent-runtime/src/config-mutations.cjs.map +1 -0
- package/dist/agent-runtime/src/config-mutations.js +59 -0
- package/dist/agent-runtime/src/config-mutations.js.map +1 -0
- package/dist/agent-runtime/src/conversation-index.cjs.map +1 -0
- package/dist/agent-runtime/src/conversation-index.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/conversation-list.cjs +36 -0
- package/dist/agent-runtime/src/conversation-list.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/conversation-list.js +36 -0
- package/dist/agent-runtime/src/conversation-list.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/deep-agent-transport-recipe.cjs +5 -3
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/deep-agent-transport-recipe.js +6 -4
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -0
- package/dist/agent-runtime/src/edit-command.cjs.map +1 -0
- package/dist/agent-runtime/src/edit-command.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/errors.cjs +23 -0
- package/dist/agent-runtime/src/errors.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/errors.js +23 -0
- package/dist/agent-runtime/src/errors.js.map +1 -0
- package/dist/agent-runtime/src/execute-output.cjs +41 -0
- package/dist/agent-runtime/src/execute-output.cjs.map +1 -0
- package/dist/agent-runtime/src/execute-output.js +41 -0
- package/dist/agent-runtime/src/execute-output.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/generated/runconfig-contract.cjs +16 -2
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/generated/runconfig-contract.js +16 -2
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -0
- package/dist/agent-runtime/src/github-wake-event.cjs.map +1 -0
- package/dist/agent-runtime/src/github-wake-event.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/interrupts.cjs +24 -1
- package/dist/agent-runtime/src/interrupts.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/interrupts.js +24 -1
- package/dist/agent-runtime/src/interrupts.js.map +1 -0
- package/dist/agent-runtime/src/message-author.cjs.map +1 -0
- package/dist/agent-runtime/src/message-author.js.map +1 -0
- package/dist/agent-runtime/src/message-window.cjs.map +1 -0
- package/dist/agent-runtime/src/message-window.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/messages.cjs +8 -4
- package/dist/agent-runtime/src/messages.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/messages.js +6 -2
- package/dist/agent-runtime/src/messages.js.map +1 -0
- package/dist/agent-runtime/src/model-context.cjs.map +1 -0
- package/dist/agent-runtime/src/model-context.js.map +1 -0
- package/dist/agent-runtime/src/optimistic-content.cjs.map +1 -0
- package/dist/agent-runtime/src/optimistic-content.js.map +1 -0
- package/dist/agent-runtime/src/protocol.cjs.map +1 -0
- package/dist/agent-runtime/src/protocol.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/queue.cjs +23 -2
- package/dist/agent-runtime/src/queue.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/queue.js +23 -2
- package/dist/agent-runtime/src/queue.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/quota-safe-local-storage-session.cjs +71 -13
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/quota-safe-local-storage-session.js +73 -15
- package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -0
- package/dist/agent-runtime/src/runtime-messages.cjs.map +1 -0
- package/dist/agent-runtime/src/runtime-messages.js.map +1 -0
- package/dist/agent-runtime/src/screen-point.cjs.map +1 -0
- package/dist/agent-runtime/src/screen-point.js.map +1 -0
- package/dist/agent-runtime/src/send-recovery.cjs.map +1 -0
- package/dist/agent-runtime/src/send-recovery.js.map +1 -0
- package/dist/agent-runtime/src/statewire-attach-observer.cjs.map +1 -0
- package/dist/agent-runtime/src/statewire-attach-observer.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/statewire-state.cjs +8 -0
- package/dist/agent-runtime/src/statewire-state.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/statewire-state.js +8 -0
- package/dist/agent-runtime/src/statewire-state.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/statewire-suspended.cjs +4 -0
- package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/statewire-suspended.js +4 -0
- package/dist/agent-runtime/src/statewire-suspended.js.map +1 -0
- package/dist/agent-runtime/src/statewire-transport.cjs +43 -0
- package/dist/agent-runtime/src/statewire-transport.cjs.map +1 -0
- package/dist/agent-runtime/src/statewire-transport.js +43 -0
- package/dist/agent-runtime/src/statewire-transport.js.map +1 -0
- package/dist/agent-runtime/src/streaming-markdown.cjs.map +1 -0
- package/dist/agent-runtime/src/streaming-markdown.js.map +1 -0
- package/dist/agent-runtime/src/subscription-wake-event.cjs +252 -0
- package/dist/agent-runtime/src/subscription-wake-event.cjs.map +1 -0
- package/dist/agent-runtime/src/subscription-wake-event.js +252 -0
- package/dist/agent-runtime/src/subscription-wake-event.js.map +1 -0
- package/dist/agent-runtime/src/thread-extras.cjs.map +1 -0
- package/dist/agent-runtime/src/thread-extras.js.map +1 -0
- package/dist/agent-runtime/src/thread-snapshot-cache.cjs.map +1 -0
- package/dist/agent-runtime/src/thread-snapshot-cache.js.map +1 -0
- package/dist/agent-runtime/src/thread-status.cjs.map +1 -0
- package/dist/agent-runtime/src/thread-status.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/tool-metadata.cjs +304 -9
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/tool-metadata.js +304 -9
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -0
- package/dist/agent-runtime/src/tool-names.cjs +5 -0
- package/dist/agent-runtime/src/tool-names.cjs.map +1 -0
- package/dist/agent-runtime/src/tool-names.js +5 -0
- package/dist/agent-runtime/src/tool-names.js.map +1 -0
- package/dist/agent-runtime/src/tool-outputs.cjs.map +1 -0
- package/dist/agent-runtime/src/tool-outputs.js.map +1 -0
- package/dist/agent-runtime/src/tool-result.cjs.map +1 -0
- package/dist/agent-runtime/src/tool-result.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/use-conversation-list.cjs +33 -22
- package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/use-conversation-list.js +34 -23
- package/dist/agent-runtime/src/use-conversation-list.js.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-config.cjs +129 -0
- package/dist/agent-runtime/src/use-deep-agent-config.cjs.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-config.js +129 -0
- package/dist/agent-runtime/src/use-deep-agent-config.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-edit-submit.cjs +2 -0
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-edit-submit.js +2 -0
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-thread.cjs +1 -0
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-thread.js +2 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-window-sync.js.map +1 -0
- package/dist/agent-runtime/src/use-historical-edit-attachments.cjs +52 -0
- package/dist/agent-runtime/src/use-historical-edit-attachments.cjs.map +1 -0
- package/dist/agent-runtime/src/use-historical-edit-attachments.js +52 -0
- package/dist/agent-runtime/src/use-historical-edit-attachments.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/voice-presentation.cjs +14 -0
- package/dist/agent-runtime/src/voice-presentation.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/voice-presentation.js +14 -0
- package/dist/agent-runtime/src/voice-presentation.js.map +1 -0
- package/dist/agent-runtime/src/voice-turn-grouping.cjs.map +1 -0
- package/dist/agent-runtime/src/voice-turn-grouping.js.map +1 -0
- package/dist/assets/AthenaAssetEmbed.cjs +13 -2
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.d.ts +10 -0
- package/dist/assets/AthenaAssetEmbed.js +14 -3
- package/dist/assets/AthenaAssetEmbed.js.map +1 -1
- package/dist/assets/AthenaLayout.cjs +97 -31
- package/dist/assets/AthenaLayout.cjs.map +1 -1
- package/dist/assets/AthenaLayout.d.ts +13 -0
- package/dist/assets/AthenaLayout.js +98 -32
- package/dist/assets/AthenaLayout.js.map +1 -1
- package/dist/assets/asset-embed-messages.cjs +6 -0
- package/dist/assets/asset-embed-messages.cjs.map +1 -1
- package/dist/assets/asset-embed-messages.d.ts +13 -0
- package/dist/assets/asset-embed-messages.js +6 -0
- package/dist/assets/asset-embed-messages.js.map +1 -1
- package/dist/assets/asset-panel-store.cjs +68 -32
- package/dist/assets/asset-panel-store.cjs.map +1 -1
- package/dist/assets/asset-panel-store.d.ts +47 -1
- package/dist/assets/asset-panel-store.js +68 -32
- package/dist/assets/asset-panel-store.js.map +1 -1
- package/dist/assets/use-asset-embed.cjs +29 -8
- package/dist/assets/use-asset-embed.cjs.map +1 -1
- package/dist/assets/use-asset-embed.d.ts +7 -0
- package/dist/assets/use-asset-embed.js +29 -8
- package/dist/assets/use-asset-embed.js.map +1 -1
- package/dist/catalog/chat-pickers.cjs +152 -0
- package/dist/catalog/chat-pickers.cjs.map +1 -0
- package/dist/catalog/chat-pickers.d.ts +22 -0
- package/dist/catalog/chat-pickers.js +152 -0
- package/dist/catalog/chat-pickers.js.map +1 -0
- package/dist/catalog/runtime-catalog.cjs +181 -0
- package/dist/catalog/runtime-catalog.cjs.map +1 -0
- package/dist/catalog/runtime-catalog.d.ts +100 -0
- package/dist/catalog/runtime-catalog.js +181 -0
- package/dist/catalog/runtime-catalog.js.map +1 -0
- package/dist/chat/AthenaChat.cjs +122 -67
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +21 -4
- package/dist/chat/AthenaChat.js +124 -69
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireApprovalCard.cjs +38 -37
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +2 -0
- package/dist/chat/StatewireApprovalCard.js +39 -38
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireClientToolBridge.cjs +2 -2
- package/dist/chat/StatewireClientToolBridge.js +2 -2
- package/dist/chat/StatewireQueuedMessages.cjs +15 -12
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +22 -2
- package/dist/chat/StatewireQueuedMessages.js +15 -12
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/StatewireRunRefusalNotice.cjs +48 -0
- package/dist/chat/StatewireRunRefusalNotice.cjs.map +1 -0
- package/dist/chat/StatewireRunRefusalNotice.d.ts +25 -0
- package/dist/chat/StatewireRunRefusalNotice.js +48 -0
- package/dist/chat/StatewireRunRefusalNotice.js.map +1 -0
- package/dist/chat/WaitingOnYouBanner.cjs +2 -2
- package/dist/chat/WaitingOnYouBanner.js +2 -2
- package/dist/chat/athena-citation-links.cjs +19 -15
- package/dist/chat/athena-citation-links.cjs.map +1 -1
- package/dist/chat/athena-citation-links.js +19 -15
- package/dist/chat/athena-citation-links.js.map +1 -1
- package/dist/chat/run-activity.cjs +9 -1
- package/dist/chat/run-activity.cjs.map +1 -1
- package/dist/chat/run-activity.d.ts +6 -0
- package/dist/chat/run-activity.js +10 -2
- package/dist/chat/run-activity.js.map +1 -1
- package/dist/chat/statewire-banners.cjs +30 -1
- package/dist/chat/statewire-banners.cjs.map +1 -1
- package/dist/chat/statewire-banners.d.ts +20 -1
- package/dist/chat/statewire-banners.js +32 -3
- package/dist/chat/statewire-banners.js.map +1 -1
- package/dist/chat/statewire-client-tools.cjs +1 -1
- package/dist/chat/statewire-client-tools.js +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.cjs +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.js +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs +38 -16
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +21 -4
- package/dist/chat/super-grouping/SuperGroupingCard.js +39 -17
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +377 -0
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -0
- package/dist/chat/super-grouping/SuperGroupingTranscript.d.ts +31 -0
- package/dist/chat/super-grouping/SuperGroupingTranscript.js +377 -0
- package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -0
- package/dist/chat/super-grouping/ToolTimeline.cjs +13 -2
- package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.d.ts +10 -3
- package/dist/chat/super-grouping/ToolTimeline.js +13 -2
- package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs +69 -29
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +60 -9
- package/dist/chat/super-grouping/activity-timeline.js +70 -30
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/super-grouping/index.cjs +14 -0
- package/dist/chat/super-grouping/index.cjs.map +1 -1
- package/dist/chat/super-grouping/index.d.ts +7 -2
- package/dist/chat/super-grouping/index.js +16 -2
- package/dist/chat/super-grouping/index.js.map +1 -1
- package/dist/chat/super-grouping/timeline-step.cjs +14 -5
- package/dist/chat/super-grouping/timeline-step.cjs.map +1 -1
- package/dist/chat/super-grouping/timeline-step.d.ts +10 -1
- package/dist/chat/super-grouping/timeline-step.js +15 -6
- package/dist/chat/super-grouping/timeline-step.js.map +1 -1
- package/dist/chat/super-grouping/toolkit-map.cjs +1 -0
- package/dist/chat/super-grouping/toolkit-map.cjs.map +1 -1
- package/dist/chat/super-grouping/toolkit-map.js +1 -0
- package/dist/chat/super-grouping/toolkit-map.js.map +1 -1
- package/dist/chat/super-grouping/turn-segments.cjs +82 -0
- package/dist/chat/super-grouping/turn-segments.cjs.map +1 -0
- package/dist/chat/super-grouping/turn-segments.d.ts +69 -0
- package/dist/chat/super-grouping/turn-segments.js +82 -0
- package/dist/chat/super-grouping/turn-segments.js.map +1 -0
- package/dist/chat/super-grouping/turn-timing.cjs +110 -0
- package/dist/chat/super-grouping/turn-timing.cjs.map +1 -0
- package/dist/chat/super-grouping/turn-timing.d.ts +52 -0
- package/dist/chat/super-grouping/turn-timing.js +110 -0
- package/dist/chat/super-grouping/turn-timing.js.map +1 -0
- package/dist/chat/tiptap-text.cjs +1 -1
- package/dist/chat/tiptap-text.js +1 -1
- package/dist/chat/use-athena-run-live.cjs +1 -1
- package/dist/chat/use-athena-run-live.js +1 -1
- package/dist/chat/use-statewire-approval-request.cjs +73 -4
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.js +74 -5
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/composer/composer-message.cjs +284 -0
- package/dist/chat-ui/composer/composer-message.cjs.map +1 -0
- package/dist/chat-ui/composer/composer-message.d.ts +152 -0
- package/dist/chat-ui/composer/composer-message.js +284 -0
- package/dist/chat-ui/composer/composer-message.js.map +1 -0
- package/dist/chat-ui/composer/tiptap-composer.cjs +97 -15
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +34 -6
- package/dist/chat-ui/composer/tiptap-composer.js +97 -15
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/index.cjs +4 -1
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +3 -2
- package/dist/chat-ui/index.js +5 -2
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +31 -3
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.d.ts +2 -5
- package/dist/chat-ui/mentions/mention-chip.js +33 -5
- package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.cjs +9 -3
- package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.js +9 -3
- package/dist/chat-ui/mentions/mention-extension.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs +3 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.js +3 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +65 -19
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +15 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js +67 -21
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +4 -2
- 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 +2 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +5 -3
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs +61 -0
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs.map +1 -0
- package/dist/chat-ui/mentions/use-account-workspace-id.d.ts +3 -0
- package/dist/chat-ui/mentions/use-account-workspace-id.js +61 -0
- package/dist/chat-ui/mentions/use-account-workspace-id.js.map +1 -0
- package/dist/chat-ui/mentions/use-member-avatar.cjs +75 -0
- package/dist/chat-ui/mentions/use-member-avatar.cjs.map +1 -0
- package/dist/chat-ui/mentions/use-member-avatar.d.ts +2 -0
- package/dist/chat-ui/mentions/use-member-avatar.js +75 -0
- package/dist/chat-ui/mentions/use-member-avatar.js.map +1 -0
- package/dist/chat-ui/messages/message-components.cjs +30 -10
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.d.ts +21 -1
- package/dist/chat-ui/messages/message-components.js +30 -10
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/messages/runtime-message.cjs +1 -1
- package/dist/chat-ui/messages/runtime-message.js +1 -1
- package/dist/chat-ui/messages/statewire-continue-run.cjs +5 -5
- package/dist/chat-ui/messages/statewire-continue-run.js +5 -5
- package/dist/chat-ui/messages/user-edit-composer.cjs +1 -1
- package/dist/chat-ui/messages/user-edit-composer.js +1 -1
- package/dist/chat-ui/messages/wake-marker.cjs +39 -4
- package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
- package/dist/chat-ui/messages/wake-marker.d.ts +16 -5
- package/dist/chat-ui/messages/wake-marker.js +40 -5
- package/dist/chat-ui/messages/wake-marker.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.cjs +12 -8
- package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.d.ts +6 -1
- package/dist/chat-ui/rich-text/chat-message-body.js +13 -9
- package/dist/chat-ui/rich-text/chat-message-body.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-text-schema.cjs +64 -6
- package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-text-schema.d.ts +5 -0
- package/dist/chat-ui/rich-text/chat-text-schema.js +66 -8
- package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
- package/dist/chat-ui/statewire.cjs +1 -1
- package/dist/chat-ui/statewire.d.ts +1 -1
- package/dist/chat-ui/statewire.js +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +2 -2
- package/dist/chat-ui/thread/statewire-history-edge.js +2 -2
- package/dist/collab/client.cjs +282 -16
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +127 -2
- package/dist/collab/client.js +285 -20
- package/dist/collab/client.js.map +1 -1
- package/dist/collab/index.cjs +2 -0
- package/dist/collab/index.cjs.map +1 -1
- package/dist/collab/index.d.ts +1 -1
- package/dist/collab/index.js +3 -1
- package/dist/composer/AttachmentContext.cjs +38 -12
- package/dist/composer/AttachmentContext.cjs.map +1 -1
- package/dist/composer/AttachmentContext.d.ts +22 -1
- package/dist/composer/AttachmentContext.js +40 -14
- package/dist/composer/AttachmentContext.js.map +1 -1
- package/dist/composer/QuoteContext.cjs +80 -28
- package/dist/composer/QuoteContext.cjs.map +1 -1
- package/dist/composer/QuoteContext.d.ts +35 -6
- package/dist/composer/QuoteContext.js +82 -30
- package/dist/composer/QuoteContext.js.map +1 -1
- package/dist/composer/build-composed-message.cjs +27 -0
- package/dist/composer/build-composed-message.cjs.map +1 -1
- package/dist/composer/build-composed-message.d.ts +21 -0
- package/dist/composer/build-composed-message.js +28 -1
- package/dist/composer/build-composed-message.js.map +1 -1
- package/dist/composer/composer-handoff.cjs +13 -1
- package/dist/composer/composer-handoff.cjs.map +1 -1
- package/dist/composer/composer-handoff.d.ts +12 -0
- package/dist/composer/composer-handoff.js +15 -3
- package/dist/composer/composer-handoff.js.map +1 -1
- package/dist/composer/index.d.ts +6 -3
- package/dist/composer/useReadComposerDraft.cjs +16 -0
- package/dist/composer/useReadComposerDraft.cjs.map +1 -0
- package/dist/composer/useReadComposerDraft.d.ts +6 -0
- package/dist/composer/useReadComposerDraft.js +16 -0
- package/dist/composer/useReadComposerDraft.js.map +1 -0
- package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
- package/dist/diagnostics/athena-diagnostics.d.ts +3 -1
- package/dist/diagnostics/athena-diagnostics.js.map +1 -1
- package/dist/diagnostics/errors.cjs +6 -0
- package/dist/diagnostics/errors.cjs.map +1 -1
- package/dist/diagnostics/errors.d.ts +6 -0
- package/dist/diagnostics/errors.js +6 -0
- package/dist/diagnostics/errors.js.map +1 -1
- package/dist/index.cjs +163 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +55 -12
- package/dist/index.js +170 -14
- package/dist/index.js.map +1 -1
- package/dist/lib/owner-document.cjs +32 -0
- package/dist/lib/owner-document.cjs.map +1 -0
- package/dist/lib/owner-document.d.ts +17 -0
- package/dist/lib/owner-document.js +32 -0
- package/dist/lib/owner-document.js.map +1 -0
- package/dist/lib/portal-surface.cjs +55 -0
- package/dist/lib/portal-surface.cjs.map +1 -0
- package/dist/lib/portal-surface.d.ts +37 -0
- package/dist/lib/portal-surface.js +55 -0
- package/dist/lib/portal-surface.js.map +1 -0
- package/dist/lib/use-athena-rest-query.cjs +34 -0
- package/dist/lib/use-athena-rest-query.cjs.map +1 -0
- package/dist/lib/use-athena-rest-query.d.ts +31 -0
- package/dist/lib/use-athena-rest-query.js +34 -0
- package/dist/lib/use-athena-rest-query.js.map +1 -0
- package/dist/provider/AthenaProvider.cjs +70 -10
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +27 -2
- package/dist/provider/AthenaProvider.js +74 -14
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/provider/citation-links.d.ts +10 -2
- package/dist/{packages/react → react}/package.json.cjs +1 -1
- package/dist/{packages/react → react}/package.json.js +1 -1
- package/dist/runtime/StatewireModelLaneSync.cjs +96 -0
- package/dist/runtime/StatewireModelLaneSync.cjs.map +1 -0
- package/dist/runtime/StatewireModelLaneSync.d.ts +45 -0
- package/dist/runtime/StatewireModelLaneSync.js +96 -0
- package/dist/runtime/StatewireModelLaneSync.js.map +1 -0
- package/dist/runtime/statewire-lifecycle.cjs +20 -5
- package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.d.ts +11 -0
- package/dist/runtime/statewire-lifecycle.js +20 -5
- package/dist/runtime/statewire-lifecycle.js.map +1 -1
- package/dist/runtime/statewire-model-lane.cjs +28 -0
- package/dist/runtime/statewire-model-lane.cjs.map +1 -0
- package/dist/runtime/statewire-model-lane.d.ts +64 -0
- package/dist/runtime/statewire-model-lane.js +28 -0
- package/dist/runtime/statewire-model-lane.js.map +1 -0
- package/dist/runtime/statewire-run-config.cjs +16 -2
- package/dist/runtime/statewire-run-config.cjs.map +1 -1
- package/dist/runtime/statewire-run-config.d.ts +10 -0
- package/dist/runtime/statewire-run-config.js +16 -2
- package/dist/runtime/statewire-run-config.js.map +1 -1
- package/dist/runtime/statewire-server-lane-context.cjs +24 -0
- package/dist/runtime/statewire-server-lane-context.cjs.map +1 -0
- package/dist/runtime/statewire-server-lane-context.d.ts +30 -0
- package/dist/runtime/statewire-server-lane-context.js +24 -0
- package/dist/runtime/statewire-server-lane-context.js.map +1 -0
- package/dist/runtime/useAthenaStatewireRuntime.cjs +47 -23
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +8 -1
- package/dist/runtime/useAthenaStatewireRuntime.js +48 -24
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/search/useAthenaRepoSearch.cjs +5 -13
- package/dist/search/useAthenaRepoSearch.cjs.map +1 -1
- package/dist/search/useAthenaRepoSearch.d.ts +3 -3
- package/dist/search/useAthenaRepoSearch.js +6 -14
- package/dist/search/useAthenaRepoSearch.js.map +1 -1
- package/dist/sheet-range/a1.cjs +162 -0
- package/dist/sheet-range/a1.cjs.map +1 -0
- package/dist/sheet-range/a1.d.ts +91 -0
- package/dist/sheet-range/a1.js +162 -0
- package/dist/sheet-range/a1.js.map +1 -0
- package/dist/sheet-range/index.cjs +22 -0
- package/dist/sheet-range/index.cjs.map +1 -0
- package/dist/sheet-range/index.d.ts +12 -0
- package/dist/sheet-range/index.js +22 -0
- package/dist/sheet-range/index.js.map +1 -0
- package/dist/sheet-range/range-preview-table.cjs +75 -0
- package/dist/sheet-range/range-preview-table.cjs.map +1 -0
- package/dist/sheet-range/range-preview-table.d.ts +20 -0
- package/dist/sheet-range/range-preview-table.js +75 -0
- package/dist/sheet-range/range-preview-table.js.map +1 -0
- package/dist/sheet-range/range-preview.cjs +116 -0
- package/dist/sheet-range/range-preview.cjs.map +1 -0
- package/dist/sheet-range/range-preview.d.ts +67 -0
- package/dist/sheet-range/range-preview.js +116 -0
- package/dist/sheet-range/range-preview.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/threads/Inbox.cjs +289 -0
- package/dist/threads/Inbox.cjs.map +1 -0
- package/dist/threads/Inbox.d.ts +46 -0
- package/dist/threads/Inbox.js +289 -0
- package/dist/threads/Inbox.js.map +1 -0
- package/dist/threads/SessionList.cjs +51 -126
- package/dist/threads/SessionList.cjs.map +1 -1
- package/dist/threads/SessionList.d.ts +26 -1
- package/dist/threads/SessionList.js +45 -120
- package/dist/threads/SessionList.js.map +1 -1
- package/dist/threads/SessionsPage.cjs +753 -0
- package/dist/threads/SessionsPage.cjs.map +1 -0
- package/dist/threads/SessionsPage.d.ts +35 -0
- package/dist/threads/SessionsPage.js +753 -0
- package/dist/threads/SessionsPage.js.map +1 -0
- package/dist/threads/api.cjs +23 -2
- package/dist/threads/api.cjs.map +1 -1
- package/dist/threads/api.d.ts +60 -0
- package/dist/threads/api.js +23 -2
- package/dist/threads/api.js.map +1 -1
- package/dist/threads/conversation-list-fetcher.cjs +9 -2
- package/dist/threads/conversation-list-fetcher.cjs.map +1 -1
- package/dist/threads/conversation-list-fetcher.d.ts +14 -1
- package/dist/threads/conversation-list-fetcher.js +9 -2
- package/dist/threads/conversation-list-fetcher.js.map +1 -1
- package/dist/threads/index.d.ts +2 -1
- package/dist/threads/pull-request-display.cjs +25 -0
- package/dist/threads/pull-request-display.cjs.map +1 -0
- package/dist/threads/pull-request-display.d.ts +15 -0
- package/dist/threads/pull-request-display.js +25 -0
- package/dist/threads/pull-request-display.js.map +1 -0
- package/dist/threads/session-list-model.cjs +16 -2
- package/dist/threads/session-list-model.cjs.map +1 -1
- package/dist/threads/session-list-model.d.ts +10 -0
- package/dist/threads/session-list-model.js +16 -2
- package/dist/threads/session-list-model.js.map +1 -1
- package/dist/threads/session-row-parts.cjs +152 -0
- package/dist/threads/session-row-parts.cjs.map +1 -0
- package/dist/threads/session-row-parts.d.ts +50 -0
- package/dist/threads/session-row-parts.js +152 -0
- package/dist/threads/session-row-parts.js.map +1 -0
- package/dist/threads/sessions-page-model.cjs +305 -0
- package/dist/threads/sessions-page-model.cjs.map +1 -0
- package/dist/threads/sessions-page-model.d.ts +86 -0
- package/dist/threads/sessions-page-model.js +305 -0
- package/dist/threads/sessions-page-model.js.map +1 -0
- package/dist/threads/sessions-page-storage.cjs +93 -0
- package/dist/threads/sessions-page-storage.cjs.map +1 -0
- package/dist/threads/sessions-page-storage.d.ts +23 -0
- package/dist/threads/sessions-page-storage.js +93 -0
- package/dist/threads/sessions-page-storage.js.map +1 -0
- package/dist/threads/sessions-query.cjs +235 -0
- package/dist/threads/sessions-query.cjs.map +1 -0
- package/dist/threads/sessions-query.d.ts +119 -0
- package/dist/threads/sessions-query.js +235 -0
- package/dist/threads/sessions-query.js.map +1 -0
- package/dist/threads/statewire-thread-list.cjs +133 -40
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +83 -2
- package/dist/threads/statewire-thread-list.js +134 -41
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/use-athena-sessions.cjs +198 -0
- package/dist/threads/use-athena-sessions.cjs.map +1 -0
- package/dist/threads/use-athena-sessions.d.ts +81 -0
- package/dist/threads/use-athena-sessions.js +198 -0
- package/dist/threads/use-athena-sessions.js.map +1 -0
- package/dist/threads/use-athena-thread-model.cjs +14 -0
- package/dist/threads/use-athena-thread-model.cjs.map +1 -0
- package/dist/threads/use-athena-thread-model.d.ts +22 -0
- package/dist/threads/use-athena-thread-model.js +14 -0
- package/dist/threads/use-athena-thread-model.js.map +1 -0
- package/dist/threads/use-rest-conversation-history.cjs +1 -1
- package/dist/threads/use-rest-conversation-history.js +1 -1
- package/dist/threads/use-statewire-conversation-history.cjs +1 -1
- package/dist/threads/use-statewire-conversation-history.d.ts +3 -0
- package/dist/threads/use-statewire-conversation-history.js +1 -1
- package/dist/threads/use-thread-read-state.cjs +73 -0
- package/dist/threads/use-thread-read-state.cjs.map +1 -0
- package/dist/threads/use-thread-read-state.d.ts +51 -0
- package/dist/threads/use-thread-read-state.js +73 -0
- package/dist/threads/use-thread-read-state.js.map +1 -0
- package/dist/tiptap-markdown-table/src/markdown-table-serializer.cjs.map +1 -0
- package/dist/tiptap-markdown-table/src/markdown-table-serializer.js.map +1 -0
- package/dist/tools/auto-open-tools.cjs +2 -0
- package/dist/tools/auto-open-tools.cjs.map +1 -1
- package/dist/tools/auto-open-tools.js +2 -0
- package/dist/tools/auto-open-tools.js.map +1 -1
- package/dist/tools/file-tool-uis.cjs +18 -43
- package/dist/tools/file-tool-uis.cjs.map +1 -1
- package/dist/tools/file-tool-uis.d.ts +1 -2
- package/dist/tools/file-tool-uis.js +18 -42
- package/dist/tools/file-tool-uis.js.map +1 -1
- package/dist/tools/index.cjs +6 -2
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +6 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/misc-tool-uis.cjs +2 -2
- package/dist/tools/misc-tool-uis.js +2 -2
- package/dist/tools/primitives.cjs +1 -1
- package/dist/tools/primitives.js +1 -1
- package/dist/tools/read-asset-tool-ui.cjs +21 -70
- package/dist/tools/read-asset-tool-ui.cjs.map +1 -1
- package/dist/tools/read-asset-tool-ui.js +21 -70
- package/dist/tools/read-asset-tool-ui.js.map +1 -1
- package/dist/tools/step-text.cjs +21 -0
- package/dist/tools/step-text.cjs.map +1 -0
- package/dist/tools/step-text.d.ts +10 -0
- package/dist/tools/step-text.js +21 -0
- package/dist/tools/step-text.js.map +1 -0
- package/dist/tools/tool-fallback.cjs +24 -5
- package/dist/tools/tool-fallback.cjs.map +1 -1
- package/dist/tools/tool-fallback.d.ts +3 -1
- package/dist/tools/tool-fallback.js +24 -5
- package/dist/tools/tool-fallback.js.map +1 -1
- package/dist/tools/tool-summary.cjs +661 -0
- package/dist/tools/tool-summary.cjs.map +1 -0
- package/dist/tools/tool-summary.d.ts +99 -0
- package/dist/tools/tool-summary.js +661 -0
- package/dist/tools/tool-summary.js.map +1 -0
- package/dist/tools/tool-uis.cjs +37 -95
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/tool-uis.js +37 -95
- package/dist/tools/tool-uis.js.map +1 -1
- package/dist/tools/voice-update-tool-ui.cjs +1 -1
- package/dist/tools/voice-update-tool-ui.js +1 -1
- package/dist/tools/write-todos-tool-ui.cjs +3 -2
- package/dist/tools/write-todos-tool-ui.cjs.map +1 -1
- package/dist/tools/write-todos-tool-ui.d.ts +5 -0
- package/dist/tools/write-todos-tool-ui.js +5 -4
- package/dist/tools/write-todos-tool-ui.js.map +1 -1
- package/dist/ui/popover.cjs +6 -6
- package/dist/ui/popover.cjs.map +1 -1
- package/dist/ui/popover.js +6 -6
- package/dist/ui/popover.js.map +1 -1
- package/dist/ui/tooltip.cjs +16 -2
- package/dist/ui/tooltip.cjs.map +1 -1
- package/dist/ui/tooltip.d.ts +1 -1
- package/dist/ui/tooltip.js +16 -2
- package/dist/ui/tooltip.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist/voice/use-athena-voice-session.cjs.map +1 -1
- package/dist/voice/use-athena-voice-session.d.ts +3 -3
- package/dist/voice/use-athena-voice-session.js.map +1 -1
- package/dist/workbench/SessionWorkbench.cjs +378 -0
- package/dist/workbench/SessionWorkbench.cjs.map +1 -0
- package/dist/workbench/SessionWorkbench.d.ts +30 -0
- package/dist/workbench/SessionWorkbench.js +378 -0
- package/dist/workbench/SessionWorkbench.js.map +1 -0
- package/dist/workbench/session-workbench-context.cjs +26 -0
- package/dist/workbench/session-workbench-context.cjs.map +1 -0
- package/dist/workbench/session-workbench-context.d.ts +55 -0
- package/dist/workbench/session-workbench-context.js +26 -0
- package/dist/workbench/session-workbench-context.js.map +1 -0
- package/dist/workbench/session-workbench-model.cjs +288 -0
- package/dist/workbench/session-workbench-model.cjs.map +1 -0
- package/dist/workbench/session-workbench-model.d.ts +168 -0
- package/dist/workbench/session-workbench-model.js +288 -0
- package/dist/workbench/session-workbench-model.js.map +1 -0
- package/dist/workbench/session-workbench-panes.cjs +580 -0
- package/dist/workbench/session-workbench-panes.cjs.map +1 -0
- package/dist/workbench/session-workbench-panes.d.ts +16 -0
- package/dist/workbench/session-workbench-panes.js +580 -0
- package/dist/workbench/session-workbench-panes.js.map +1 -0
- package/dist/workbench/session-workspace-api.cjs +157 -0
- package/dist/workbench/session-workspace-api.cjs.map +1 -0
- package/dist/workbench/session-workspace-api.d.ts +70 -0
- package/dist/workbench/session-workspace-api.js +157 -0
- package/dist/workbench/session-workspace-api.js.map +1 -0
- package/dist/workbench/use-session-workspace.cjs +100 -0
- package/dist/workbench/use-session-workspace.cjs.map +1 -0
- package/dist/workbench/use-session-workspace.d.ts +45 -0
- package/dist/workbench/use-session-workspace.js +100 -0
- package/dist/workbench/use-session-workspace.js.map +1 -0
- package/dist/workbench/workbench-layout-context.cjs +10 -0
- package/dist/workbench/workbench-layout-context.cjs.map +1 -0
- package/dist/workbench/workbench-layout-context.d.ts +17 -0
- package/dist/workbench/workbench-layout-context.js +10 -0
- package/dist/workbench/workbench-layout-context.js.map +1 -0
- package/package.json +21 -10
- package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.cjs +0 -77
- package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.cjs.map +0 -1
- package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.js +0 -77
- package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.js.map +0 -1
- package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.cjs +0 -181
- package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.cjs.map +0 -1
- package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.js +0 -181
- package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.js.map +0 -1
- package/dist/packages/agent-runtime/src/asset-attachment.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/asset-attachment.js.map +0 -1
- package/dist/packages/agent-runtime/src/auth-denial.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/auth-denial.js.map +0 -1
- package/dist/packages/agent-runtime/src/client-tool-bridge.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/client-tool-bridge.js.map +0 -1
- package/dist/packages/agent-runtime/src/client-tools.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/client-tools.js.map +0 -1
- package/dist/packages/agent-runtime/src/conversation-index.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/conversation-index.js.map +0 -1
- package/dist/packages/agent-runtime/src/conversation-list.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/conversation-list.js.map +0 -1
- package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.js.map +0 -1
- package/dist/packages/agent-runtime/src/edit-command.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/edit-command.js.map +0 -1
- package/dist/packages/agent-runtime/src/errors.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/errors.js.map +0 -1
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +0 -1
- package/dist/packages/agent-runtime/src/github-wake-event.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/github-wake-event.js.map +0 -1
- package/dist/packages/agent-runtime/src/interrupts.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/interrupts.js.map +0 -1
- package/dist/packages/agent-runtime/src/message-author.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/message-author.js.map +0 -1
- package/dist/packages/agent-runtime/src/message-window.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/message-window.js.map +0 -1
- package/dist/packages/agent-runtime/src/messages.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/messages.js.map +0 -1
- package/dist/packages/agent-runtime/src/model-context.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/model-context.js.map +0 -1
- package/dist/packages/agent-runtime/src/optimistic-content.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/optimistic-content.js.map +0 -1
- package/dist/packages/agent-runtime/src/protocol.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/protocol.js.map +0 -1
- package/dist/packages/agent-runtime/src/queue.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/queue.js.map +0 -1
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +0 -1
- package/dist/packages/agent-runtime/src/runtime-messages.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/runtime-messages.js.map +0 -1
- package/dist/packages/agent-runtime/src/screen-point.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/screen-point.js.map +0 -1
- package/dist/packages/agent-runtime/src/send-recovery.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/send-recovery.js.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-attach-observer.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-attach-observer.js.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-state.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-state.js.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-suspended.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-suspended.js.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-transport.cjs +0 -11
- package/dist/packages/agent-runtime/src/statewire-transport.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-transport.js +0 -11
- package/dist/packages/agent-runtime/src/statewire-transport.js.map +0 -1
- package/dist/packages/agent-runtime/src/streaming-markdown.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/streaming-markdown.js.map +0 -1
- package/dist/packages/agent-runtime/src/thread-extras.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/thread-extras.js.map +0 -1
- package/dist/packages/agent-runtime/src/thread-snapshot-cache.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/thread-snapshot-cache.js.map +0 -1
- package/dist/packages/agent-runtime/src/thread-status.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/thread-status.js.map +0 -1
- package/dist/packages/agent-runtime/src/tool-metadata.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/tool-metadata.js.map +0 -1
- package/dist/packages/agent-runtime/src/tool-outputs.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/tool-outputs.js.map +0 -1
- package/dist/packages/agent-runtime/src/tool-result.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/tool-result.js.map +0 -1
- package/dist/packages/agent-runtime/src/use-conversation-list.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/use-conversation-list.js.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs +0 -13
- package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-config.js +0 -13
- package/dist/packages/agent-runtime/src/use-deep-agent-config.js.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-runtime.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-runtime.js.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.js.map +0 -1
- package/dist/packages/agent-runtime/src/voice-presentation.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/voice-presentation.js.map +0 -1
- package/dist/packages/agent-runtime/src/voice-turn-grouping.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/voice-turn-grouping.js.map +0 -1
- package/dist/packages/tiptap-markdown-table/src/markdown-table-serializer.cjs.map +0 -1
- package/dist/packages/tiptap-markdown-table/src/markdown-table-serializer.js.map +0 -1
- /package/dist/{packages/agent-runtime → agent-runtime}/src/asset-attachment.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/asset-attachment.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/auth-denial.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/auth-denial.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/client-tool-bridge.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/client-tool-bridge.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/client-tools.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/client-tools.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/conversation-index.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/conversation-index.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/edit-command.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/edit-command.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/github-wake-event.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/github-wake-event.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/message-author.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/message-author.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/message-window.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/message-window.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/model-context.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/model-context.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/optimistic-content.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/optimistic-content.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/protocol.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/protocol.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/runtime-messages.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/runtime-messages.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/screen-point.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/screen-point.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/send-recovery.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/send-recovery.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/statewire-attach-observer.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/statewire-attach-observer.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/streaming-markdown.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/streaming-markdown.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/thread-extras.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/thread-extras.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/thread-snapshot-cache.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/thread-snapshot-cache.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/thread-status.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/thread-status.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/tool-outputs.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/tool-outputs.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/tool-result.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/tool-result.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-runtime.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-runtime.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-window-sync.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-window-sync.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/voice-turn-grouping.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/voice-turn-grouping.js +0 -0
- /package/dist/{packages/react → react}/package.json.cjs.map +0 -0
- /package/dist/{packages/react → react}/package.json.js.map +0 -0
- /package/dist/{packages/tiptap-markdown-table → tiptap-markdown-table}/src/markdown-table-serializer.cjs +0 -0
- /package/dist/{packages/tiptap-markdown-table → tiptap-markdown-table}/src/markdown-table-serializer.js +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The grouped transcript's layout of one assistant turn: the agent's own
|
|
3
|
+
* sentences in the order it wrote them, with the work between them (tool calls
|
|
4
|
+
* and reasoning) folded into collapsed activity segments. Pure functions over
|
|
5
|
+
* assistant-ui message parts; `SuperGroupingTranscript` renders them.
|
|
6
|
+
*
|
|
7
|
+
* Text is never folded away. The text after the final tool call is the turn's
|
|
8
|
+
* answer and renders below the transcript (`SuperGroupingFinalText`, the same
|
|
9
|
+
* read `getFinalText` makes), so it is left out of the segments here: every
|
|
10
|
+
* text part renders exactly once, either as prose here or as the answer there.
|
|
11
|
+
*/
|
|
12
|
+
import type { ActivityItem, ActivityPhase } from './activity-timeline';
|
|
13
|
+
import type { GroupingFunction } from './grouping-function';
|
|
14
|
+
import type { TimelineStep } from './timeline-step';
|
|
15
|
+
/** The part shape segmentation needs; assistant-ui's `ThreadAssistantMessagePart` satisfies it. */
|
|
16
|
+
export type SegmentablePart = {
|
|
17
|
+
readonly type: string;
|
|
18
|
+
readonly text?: string;
|
|
19
|
+
};
|
|
20
|
+
export type TurnSegment = {
|
|
21
|
+
kind: 'prose';
|
|
22
|
+
/** Stable across streaming: parts only ever append. */
|
|
23
|
+
key: string;
|
|
24
|
+
partIndex: number;
|
|
25
|
+
text: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'activity';
|
|
28
|
+
key: string;
|
|
29
|
+
/** The tool-call, reasoning and other non-text parts this segment folds, in order. */
|
|
30
|
+
partIndices: number[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Split a turn into prose and activity segments.
|
|
34
|
+
*
|
|
35
|
+
* - Before the last tool call, each non-blank text part is a prose segment and
|
|
36
|
+
* every run of other parts between them is one activity segment.
|
|
37
|
+
* - After the last tool call, text is the answer (left to the final-text
|
|
38
|
+
* renderer), and any other part — a thought streaming before the next
|
|
39
|
+
* sentence — joins the last activity segment, so it reads as part of the
|
|
40
|
+
* work that led to the answer.
|
|
41
|
+
*/
|
|
42
|
+
export declare function splitTurnSegments(content: readonly SegmentablePart[] | undefined): TurnSegment[];
|
|
43
|
+
/** The timeline items whose parts a segment folds, in stream order. */
|
|
44
|
+
export declare function segmentItems(segment: Extract<TurnSegment, {
|
|
45
|
+
kind: 'activity';
|
|
46
|
+
}>, timeline: readonly ActivityItem[]): ActivityItem[];
|
|
47
|
+
/**
|
|
48
|
+
* The details-panel grouping for one segment: the host's grouping restricted
|
|
49
|
+
* to the segment's parts, with every text part dropped (prose renders in the
|
|
50
|
+
* transcript, the answer below it) and any group left empty removed.
|
|
51
|
+
*/
|
|
52
|
+
export declare function scopeGroupingToSegment(grouping: GroupingFunction, partIndices: readonly number[]): GroupingFunction;
|
|
53
|
+
export interface SegmentSummary {
|
|
54
|
+
/** The collapsed row's line: the step in progress, else the segment's last tool step. */
|
|
55
|
+
step: TimelineStep | undefined;
|
|
56
|
+
/** "Waiting for your input" when a step waits on the person. */
|
|
57
|
+
label: string;
|
|
58
|
+
/** "+2 more" / "2 in progress" beside the line. */
|
|
59
|
+
meta: string | undefined;
|
|
60
|
+
phase: ActivityPhase;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* What a collapsed activity segment says: the step in progress while one runs
|
|
64
|
+
* ("Running git fetch", with "2 done" or "2 in progress" for parallel calls), the step
|
|
65
|
+
* waiting on the person, else the last tool step it took ("Ran git log -1",
|
|
66
|
+
* "+2 more", and how many earlier steps failed). The row reads as failed only
|
|
67
|
+
* when that last step did. A segment that only thought reads as its thought.
|
|
68
|
+
*/
|
|
69
|
+
export declare function summarizeSegment(steps: readonly TimelineStep[]): SegmentSummary;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
function lastToolCallIndex(content) {
|
|
2
|
+
var _a;
|
|
3
|
+
for (let index = content.length - 1; index >= 0; index -= 1) {
|
|
4
|
+
if (((_a = content[index]) == null ? void 0 : _a.type) === "tool-call") return index;
|
|
5
|
+
}
|
|
6
|
+
return -1;
|
|
7
|
+
}
|
|
8
|
+
function splitTurnSegments(content) {
|
|
9
|
+
if (!(content == null ? void 0 : content.length)) return [];
|
|
10
|
+
const answerStart = lastToolCallIndex(content) + 1;
|
|
11
|
+
const segments = [];
|
|
12
|
+
let lastActivity = null;
|
|
13
|
+
for (let index = 0; index < content.length; index += 1) {
|
|
14
|
+
const part = content[index];
|
|
15
|
+
if (!part) continue;
|
|
16
|
+
if (part.type === "text") {
|
|
17
|
+
if (index >= answerStart) continue;
|
|
18
|
+
const text = typeof part.text === "string" ? part.text : "";
|
|
19
|
+
if (text.trim() === "") continue;
|
|
20
|
+
segments.push({ kind: "prose", key: `prose-${index}`, partIndex: index, text });
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const previous = segments.at(-1);
|
|
24
|
+
if (index < answerStart && (previous == null ? void 0 : previous.kind) === "activity") {
|
|
25
|
+
previous.partIndices.push(index);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (index >= answerStart && lastActivity) {
|
|
29
|
+
lastActivity.partIndices.push(index);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
lastActivity = { kind: "activity", key: `activity-${index}`, partIndices: [index] };
|
|
33
|
+
segments.push(lastActivity);
|
|
34
|
+
}
|
|
35
|
+
return segments;
|
|
36
|
+
}
|
|
37
|
+
function scopeGroupingToSegment(grouping, partIndices) {
|
|
38
|
+
const indices = new Set(partIndices);
|
|
39
|
+
return (parts) => grouping(parts).map((group) => ({
|
|
40
|
+
...group,
|
|
41
|
+
indices: group.indices.filter((index) => {
|
|
42
|
+
var _a;
|
|
43
|
+
return indices.has(index) && ((_a = parts[index]) == null ? void 0 : _a.type) !== "text";
|
|
44
|
+
})
|
|
45
|
+
})).filter((group) => group.indices.length > 0);
|
|
46
|
+
}
|
|
47
|
+
function summarizeSegment(steps) {
|
|
48
|
+
const toolSteps = steps.filter((step) => step.kind === "tool");
|
|
49
|
+
const running = steps.filter((step) => step.state === "running");
|
|
50
|
+
const waiting = steps.find((step) => step.state === "waiting");
|
|
51
|
+
if (waiting) {
|
|
52
|
+
return { step: waiting, label: waiting.verb, meta: void 0, phase: "waiting" };
|
|
53
|
+
}
|
|
54
|
+
if (running.length > 0) {
|
|
55
|
+
const current = running.at(-1);
|
|
56
|
+
const doneTools = toolSteps.filter((step) => step.state !== "running").length;
|
|
57
|
+
return {
|
|
58
|
+
step: current,
|
|
59
|
+
label: (current == null ? void 0 : current.verb) ?? "Working",
|
|
60
|
+
meta: running.length > 1 ? `${running.length} in progress` : doneTools > 0 ? `${doneTools} done` : void 0,
|
|
61
|
+
phase: "running"
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const primary = toolSteps.at(-1) ?? steps.at(-1);
|
|
65
|
+
const earlierFailures = toolSteps.filter((step) => step !== primary && step.state === "error").length;
|
|
66
|
+
const meta = [
|
|
67
|
+
toolSteps.length > 1 ? `+${toolSteps.length - 1} more` : null,
|
|
68
|
+
earlierFailures > 0 ? `${earlierFailures} failed` : null
|
|
69
|
+
].filter(Boolean).join(" · ");
|
|
70
|
+
return {
|
|
71
|
+
step: primary,
|
|
72
|
+
label: (primary == null ? void 0 : primary.verb) ?? "Thought through the next step",
|
|
73
|
+
meta: meta || void 0,
|
|
74
|
+
phase: (primary == null ? void 0 : primary.state) === "error" ? "error" : "complete"
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
scopeGroupingToSegment,
|
|
79
|
+
splitTurnSegments,
|
|
80
|
+
summarizeSegment
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=turn-segments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-segments.js","sources":["../../../src/chat/super-grouping/turn-segments.ts"],"sourcesContent":["/**\n * The grouped transcript's layout of one assistant turn: the agent's own\n * sentences in the order it wrote them, with the work between them (tool calls\n * and reasoning) folded into collapsed activity segments. Pure functions over\n * assistant-ui message parts; `SuperGroupingTranscript` renders them.\n *\n * Text is never folded away. The text after the final tool call is the turn's\n * answer and renders below the transcript (`SuperGroupingFinalText`, the same\n * read `getFinalText` makes), so it is left out of the segments here: every\n * text part renders exactly once, either as prose here or as the answer there.\n */\nimport type { ActivityItem, ActivityPhase } from './activity-timeline';\nimport type { GroupingFunction } from './grouping-function';\nimport type { TimelineStep } from './timeline-step';\n\n/** The part shape segmentation needs; assistant-ui's `ThreadAssistantMessagePart` satisfies it. */\nexport type SegmentablePart = { readonly type: string; readonly text?: string };\n\nexport type TurnSegment =\n | {\n kind: 'prose';\n /** Stable across streaming: parts only ever append. */\n key: string;\n partIndex: number;\n text: string;\n }\n | {\n kind: 'activity';\n key: string;\n /** The tool-call, reasoning and other non-text parts this segment folds, in order. */\n partIndices: number[];\n };\n\nfunction lastToolCallIndex(content: readonly SegmentablePart[]): number {\n for (let index = content.length - 1; index >= 0; index -= 1) {\n if (content[index]?.type === 'tool-call') return index;\n }\n return -1;\n}\n\n/**\n * Split a turn into prose and activity segments.\n *\n * - Before the last tool call, each non-blank text part is a prose segment and\n * every run of other parts between them is one activity segment.\n * - After the last tool call, text is the answer (left to the final-text\n * renderer), and any other part — a thought streaming before the next\n * sentence — joins the last activity segment, so it reads as part of the\n * work that led to the answer.\n */\nexport function splitTurnSegments(content: readonly SegmentablePart[] | undefined): TurnSegment[] {\n if (!content?.length) return [];\n const answerStart = lastToolCallIndex(content) + 1;\n const segments: TurnSegment[] = [];\n let lastActivity: Extract<TurnSegment, { kind: 'activity' }> | null = null;\n\n for (let index = 0; index < content.length; index += 1) {\n const part = content[index];\n if (!part) continue;\n if (part.type === 'text') {\n if (index >= answerStart) continue;\n const text = typeof part.text === 'string' ? part.text : '';\n if (text.trim() === '') continue;\n segments.push({ kind: 'prose', key: `prose-${index}`, partIndex: index, text });\n continue;\n }\n const previous = segments.at(-1);\n if (index < answerStart && previous?.kind === 'activity') {\n previous.partIndices.push(index);\n continue;\n }\n if (index >= answerStart && lastActivity) {\n lastActivity.partIndices.push(index);\n continue;\n }\n lastActivity = { kind: 'activity', key: `activity-${index}`, partIndices: [index] };\n segments.push(lastActivity);\n }\n return segments;\n}\n\n/** The timeline items whose parts a segment folds, in stream order. */\nexport function segmentItems(\n segment: Extract<TurnSegment, { kind: 'activity' }>,\n timeline: readonly ActivityItem[],\n): ActivityItem[] {\n const indices = new Set(segment.partIndices);\n return timeline.filter((item) => item.partIndex !== undefined && indices.has(item.partIndex));\n}\n\n/**\n * The details-panel grouping for one segment: the host's grouping restricted\n * to the segment's parts, with every text part dropped (prose renders in the\n * transcript, the answer below it) and any group left empty removed.\n */\nexport function scopeGroupingToSegment(\n grouping: GroupingFunction,\n partIndices: readonly number[],\n): GroupingFunction {\n const indices = new Set(partIndices);\n return (parts) =>\n grouping(parts)\n .map((group) => ({\n ...group,\n indices: group.indices.filter((index) => indices.has(index) && parts[index]?.type !== 'text'),\n }))\n .filter((group) => group.indices.length > 0);\n}\n\nexport interface SegmentSummary {\n /** The collapsed row's line: the step in progress, else the segment's last tool step. */\n step: TimelineStep | undefined;\n /** \"Waiting for your input\" when a step waits on the person. */\n label: string;\n /** \"+2 more\" / \"2 in progress\" beside the line. */\n meta: string | undefined;\n phase: ActivityPhase;\n}\n\n/**\n * What a collapsed activity segment says: the step in progress while one runs\n * (\"Running git fetch\", with \"2 done\" or \"2 in progress\" for parallel calls), the step\n * waiting on the person, else the last tool step it took (\"Ran git log -1\",\n * \"+2 more\", and how many earlier steps failed). The row reads as failed only\n * when that last step did. A segment that only thought reads as its thought.\n */\nexport function summarizeSegment(steps: readonly TimelineStep[]): SegmentSummary {\n const toolSteps = steps.filter((step) => step.kind === 'tool');\n const running = steps.filter((step) => step.state === 'running');\n const waiting = steps.find((step) => step.state === 'waiting');\n\n if (waiting) {\n return { step: waiting, label: waiting.verb, meta: undefined, phase: 'waiting' };\n }\n if (running.length > 0) {\n const current = running.at(-1);\n const doneTools = toolSteps.filter((step) => step.state !== 'running').length;\n return {\n step: current,\n label: current?.verb ?? 'Working',\n meta:\n running.length > 1\n ? `${running.length} in progress`\n : doneTools > 0\n ? `${doneTools} done`\n : undefined,\n phase: 'running',\n };\n }\n const primary = toolSteps.at(-1) ?? steps.at(-1);\n const earlierFailures = toolSteps.filter((step) => step !== primary && step.state === 'error').length;\n const meta = [\n toolSteps.length > 1 ? `+${toolSteps.length - 1} more` : null,\n earlierFailures > 0 ? `${earlierFailures} failed` : null,\n ]\n .filter(Boolean)\n .join(' · ');\n return {\n step: primary,\n label: primary?.verb ?? 'Thought through the next step',\n meta: meta || undefined,\n phase: primary?.state === 'error' ? 'error' : 'complete',\n };\n}\n"],"names":[],"mappings":"AAiC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AU;AAAA,EAAA;AAElD;"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const messageTime = require("../message-time.cjs");
|
|
4
|
+
const messages = require("../../agent-runtime/src/messages.cjs");
|
|
5
|
+
function record(value) {
|
|
6
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
7
|
+
}
|
|
8
|
+
function readInstantMs(value) {
|
|
9
|
+
var _a;
|
|
10
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
11
|
+
return value > 1e12 ? value : value * 1e3;
|
|
12
|
+
}
|
|
13
|
+
return ((_a = messageTime.parseMessageTime(value)) == null ? void 0 : _a.getTime()) ?? null;
|
|
14
|
+
}
|
|
15
|
+
function sourceMetadata(message) {
|
|
16
|
+
var _a;
|
|
17
|
+
const kwargs = record((_a = record(message)) == null ? void 0 : _a.additional_kwargs);
|
|
18
|
+
return record(kwargs == null ? void 0 : kwargs.metadata) ?? kwargs;
|
|
19
|
+
}
|
|
20
|
+
function isRunMarker(message) {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
return typeof ((_b = record((_a = record(message)) == null ? void 0 : _a.additional_kwargs)) == null ? void 0 : _b[messages.ATHENA_RUN_MARKER_KEY]) === "string";
|
|
23
|
+
}
|
|
24
|
+
function readTurnTiming({ promptCreatedAt, custom, sourceMessages }) {
|
|
25
|
+
let endMs = null;
|
|
26
|
+
let firstStampMs = null;
|
|
27
|
+
let serverStartMs = null;
|
|
28
|
+
let serverDurationMs = null;
|
|
29
|
+
let afterMarker = false;
|
|
30
|
+
let continuedAtMs = null;
|
|
31
|
+
for (const message of sourceMessages) {
|
|
32
|
+
if (isRunMarker(message)) {
|
|
33
|
+
afterMarker = true;
|
|
34
|
+
continuedAtMs = null;
|
|
35
|
+
serverDurationMs = null;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const metadata = sourceMetadata(message);
|
|
39
|
+
const stamp = readInstantMs(metadata == null ? void 0 : metadata[messageTime.MESSAGE_CREATED_AT_KEY]);
|
|
40
|
+
if (stamp !== null) {
|
|
41
|
+
firstStampMs ?? (firstStampMs = stamp);
|
|
42
|
+
if (afterMarker) continuedAtMs ?? (continuedAtMs = stamp);
|
|
43
|
+
endMs = endMs === null ? stamp : Math.max(endMs, stamp);
|
|
44
|
+
}
|
|
45
|
+
const duration = metadata == null ? void 0 : metadata.agent_duration_seconds;
|
|
46
|
+
if (typeof duration === "number" && Number.isFinite(duration) && duration > 0) {
|
|
47
|
+
serverDurationMs = duration * 1e3;
|
|
48
|
+
serverStartMs = readInstantMs(metadata == null ? void 0 : metadata.agent_start_time) ?? serverStartMs;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (serverStartMs !== null && serverDurationMs !== null) {
|
|
52
|
+
const serverEnd = serverStartMs + serverDurationMs;
|
|
53
|
+
endMs = endMs === null ? serverEnd : Math.max(endMs, serverEnd);
|
|
54
|
+
}
|
|
55
|
+
const startMs = continuedAtMs ?? readInstantMs(promptCreatedAt) ?? serverStartMs ?? readInstantMs(custom == null ? void 0 : custom.agent_start_time) ?? readInstantMs(custom == null ? void 0 : custom.run_started_at) ?? readInstantMs(custom == null ? void 0 : custom[messageTime.MESSAGE_CREATED_AT_KEY]) ?? firstStampMs;
|
|
56
|
+
return { startMs, endMs, serverDurationMs };
|
|
57
|
+
}
|
|
58
|
+
function workedDurationMs({ startMs, endMs, serverDurationMs }, observedEndMs = null) {
|
|
59
|
+
const observed = observedEndMs !== null && (endMs === null || observedEndMs - endMs <= MAX_OBSERVED_END_LAG_MS) ? observedEndMs : null;
|
|
60
|
+
const end = serverDurationMs !== null || observed === null ? endMs : endMs === null ? observed : Math.max(endMs, observed);
|
|
61
|
+
if (startMs !== null && end !== null && end >= startMs) {
|
|
62
|
+
return Math.max(end - startMs, serverDurationMs ?? 0);
|
|
63
|
+
}
|
|
64
|
+
return serverDurationMs;
|
|
65
|
+
}
|
|
66
|
+
const MAX_OBSERVED_END_LAG_MS = 10 * 60 * 1e3;
|
|
67
|
+
function formatWorkDuration(ms) {
|
|
68
|
+
const totalSeconds = Math.max(0, Math.floor(ms / 1e3));
|
|
69
|
+
if (totalSeconds < 60) return `${totalSeconds}s`;
|
|
70
|
+
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
71
|
+
if (totalMinutes < 60) return `${totalMinutes}m ${String(totalSeconds % 60).padStart(2, "0")}s`;
|
|
72
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
73
|
+
return `${hours}h ${String(totalMinutes % 60).padStart(2, "0")}m`;
|
|
74
|
+
}
|
|
75
|
+
function workingLabel(elapsedMs) {
|
|
76
|
+
return elapsedMs < 1e3 ? "Working" : `Working for ${formatWorkDuration(elapsedMs)}`;
|
|
77
|
+
}
|
|
78
|
+
const MAX_FIRST_SEEN = 200;
|
|
79
|
+
const firstSeen = /* @__PURE__ */ new Map();
|
|
80
|
+
function firstSeenMs(key, now = Date.now()) {
|
|
81
|
+
const seen = firstSeen.get(key);
|
|
82
|
+
if (seen !== void 0) return seen;
|
|
83
|
+
firstSeen.set(key, now);
|
|
84
|
+
if (firstSeen.size > MAX_FIRST_SEEN) {
|
|
85
|
+
const oldest = firstSeen.keys().next().value;
|
|
86
|
+
if (oldest !== void 0) firstSeen.delete(oldest);
|
|
87
|
+
}
|
|
88
|
+
return now;
|
|
89
|
+
}
|
|
90
|
+
const observedEnds = /* @__PURE__ */ new Map();
|
|
91
|
+
function recordObservedTurnEnd(key, now = Date.now()) {
|
|
92
|
+
observedEnds.set(key, now);
|
|
93
|
+
if (observedEnds.size > MAX_FIRST_SEEN) {
|
|
94
|
+
const oldest = observedEnds.keys().next().value;
|
|
95
|
+
if (oldest !== void 0) observedEnds.delete(oldest);
|
|
96
|
+
}
|
|
97
|
+
return now;
|
|
98
|
+
}
|
|
99
|
+
function observedTurnEndMs(key) {
|
|
100
|
+
return observedEnds.get(key) ?? null;
|
|
101
|
+
}
|
|
102
|
+
exports.firstSeenMs = firstSeenMs;
|
|
103
|
+
exports.formatWorkDuration = formatWorkDuration;
|
|
104
|
+
exports.observedTurnEndMs = observedTurnEndMs;
|
|
105
|
+
exports.readInstantMs = readInstantMs;
|
|
106
|
+
exports.readTurnTiming = readTurnTiming;
|
|
107
|
+
exports.recordObservedTurnEnd = recordObservedTurnEnd;
|
|
108
|
+
exports.workedDurationMs = workedDurationMs;
|
|
109
|
+
exports.workingLabel = workingLabel;
|
|
110
|
+
//# sourceMappingURL=turn-timing.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-timing.cjs","sources":["../../../src/chat/super-grouping/turn-timing.ts"],"sourcesContent":["/**\n * How long an assistant turn has been working, or worked — the grouped\n * transcript's \"Working for 1m 12s\" / \"Worked for 2m 30s\" header.\n *\n * Every clock here is a server stamp the runtime already writes: `_created_at`\n * on each message (`additional_kwargs.metadata`, surfaced as\n * `metadata.custom`), and on the turn's final assistant message the\n * turn-timing middleware's `agent_start_time` / `agent_duration_seconds`\n * (epoch seconds). The converter joins only the first assistant message's\n * metadata into the turn, so the end of the turn is read off the raw messages\n * bound to it. assistant-ui's own `createdAt` is when this client first saw the\n * message, so it is never used.\n */\nimport { ATHENA_RUN_MARKER_KEY } from '@athenaintel/agent-runtime';\nimport { MESSAGE_CREATED_AT_KEY, parseMessageTime } from '../message-time';\n\nexport interface TurnTiming {\n /**\n * When the turn started: the prompt's stamp, else the run's own start\n * stamps. A turn that was stopped and then continued starts at its\n * continuation, so the clock never counts the time it sat stopped.\n */\n startMs: number | null;\n /** When the turn's last message was written, from the server's stamps. */\n endMs: number | null;\n /** The turn-timing middleware's duration, when the final message carries it. */\n serverDurationMs: number | null;\n}\n\nexport interface TurnTimingSources {\n /** `_created_at` of the user message this turn answers. */\n promptCreatedAt: string | null | undefined;\n /** The turn's joined `metadata.custom` (its first assistant message's). */\n custom: Record<string, unknown> | undefined;\n /** The raw messages bound to the turn (`getExternalStoreMessages`), oldest first. */\n sourceMessages: readonly unknown[];\n}\n\nfunction record(value: unknown): Record<string, unknown> | undefined {\n return value && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\n/** An instant from an ISO stamp or epoch seconds (milliseconds past 1e12), else `null`. */\nexport function readInstantMs(value: unknown): number | null {\n if (typeof value === 'number' && Number.isFinite(value) && value > 0) {\n return value > 1e12 ? value : value * 1000;\n }\n return parseMessageTime(value)?.getTime() ?? null;\n}\n\nfunction sourceMetadata(message: unknown): Record<string, unknown> | undefined {\n const kwargs = record(record(message)?.additional_kwargs);\n return record(kwargs?.metadata) ?? kwargs;\n}\n\nfunction isRunMarker(message: unknown): boolean {\n return typeof record(record(message)?.additional_kwargs)?.[ATHENA_RUN_MARKER_KEY] === 'string';\n}\n\n/** The turn's start, end and server-measured duration from the stamps it carries. */\nexport function readTurnTiming({ promptCreatedAt, custom, sourceMessages }: TurnTimingSources): TurnTiming {\n let endMs: number | null = null;\n let firstStampMs: number | null = null;\n let serverStartMs: number | null = null;\n let serverDurationMs: number | null = null;\n let afterMarker = false;\n let continuedAtMs: number | null = null;\n for (const message of sourceMessages) {\n if (isRunMarker(message)) {\n afterMarker = true;\n continuedAtMs = null;\n serverDurationMs = null;\n continue;\n }\n const metadata = sourceMetadata(message);\n const stamp = readInstantMs(metadata?.[MESSAGE_CREATED_AT_KEY]);\n if (stamp !== null) {\n firstStampMs ??= stamp;\n if (afterMarker) continuedAtMs ??= stamp;\n endMs = endMs === null ? stamp : Math.max(endMs, stamp);\n }\n const duration = metadata?.agent_duration_seconds;\n if (typeof duration === 'number' && Number.isFinite(duration) && duration > 0) {\n serverDurationMs = duration * 1000;\n serverStartMs = readInstantMs(metadata?.agent_start_time) ?? serverStartMs;\n }\n }\n if (serverStartMs !== null && serverDurationMs !== null) {\n const serverEnd = serverStartMs + serverDurationMs;\n endMs = endMs === null ? serverEnd : Math.max(endMs, serverEnd);\n }\n // Without a prompt stamp the run's own server clock comes before any\n // assistant stamp: the first assistant message is written after the turn\n // has already been working (thinking, the first tool), so starting there\n // would drop that time.\n const startMs =\n continuedAtMs ??\n readInstantMs(promptCreatedAt) ??\n serverStartMs ??\n readInstantMs(custom?.agent_start_time) ??\n readInstantMs(custom?.run_started_at) ??\n readInstantMs(custom?.[MESSAGE_CREATED_AT_KEY]) ??\n firstStampMs;\n return { startMs, endMs, serverDurationMs };\n}\n\n/**\n * How long a finished turn worked: from its start to its end, else the\n * server-measured duration, else `null` (nothing truthful to show).\n *\n * The end is the server's own turn clock when the final message carries it.\n * The turn-timing stamp lands on that message only after it has streamed, so a\n * turn watched live can settle before the stamp reaches this client; the last\n * message's `_created_at` is then the start of the final answer, not its end,\n * and `observedEndMs` (when this client saw the turn settle) stands in for it.\n */\nexport function workedDurationMs(\n { startMs, endMs, serverDurationMs }: TurnTiming,\n observedEndMs: number | null = null,\n): number | null {\n // A settle seen long after the last stamp is not this turn's end (a thread\n // opened while its status was still catching up), so it is ignored.\n const observed =\n observedEndMs !== null && (endMs === null || observedEndMs - endMs <= MAX_OBSERVED_END_LAG_MS)\n ? observedEndMs\n : null;\n const end =\n serverDurationMs !== null || observed === null\n ? endMs\n : endMs === null\n ? observed\n : Math.max(endMs, observed);\n // The server's own duration is a floor: a start read off a later stamp\n // never shortens the turn below what the server measured.\n if (startMs !== null && end !== null && end >= startMs) {\n return Math.max(end - startMs, serverDurationMs ?? 0);\n }\n return serverDurationMs;\n}\n\n/** How far past its last stamp a turn may be seen to settle and still count as its end. */\nconst MAX_OBSERVED_END_LAG_MS = 10 * 60 * 1000;\n\n/** \"45s\", \"1m 12s\", \"1h 03m\". */\nexport function formatWorkDuration(ms: number): string {\n const totalSeconds = Math.max(0, Math.floor(ms / 1000));\n if (totalSeconds < 60) return `${totalSeconds}s`;\n const totalMinutes = Math.floor(totalSeconds / 60);\n if (totalMinutes < 60) return `${totalMinutes}m ${String(totalSeconds % 60).padStart(2, '0')}s`;\n const hours = Math.floor(totalMinutes / 60);\n return `${hours}h ${String(totalMinutes % 60).padStart(2, '0')}m`;\n}\n\n/** The live header: \"Working\" for the first second, then \"Working for 1m 12s\". */\nexport function workingLabel(elapsedMs: number): string {\n return elapsedMs < 1000 ? 'Working' : `Working for ${formatWorkDuration(elapsedMs)}`;\n}\n\n/** The settled header: \"Worked for 2m 30s\", or `null` when the turn carries no usable stamps. */\nexport function workedLabel(timing: TurnTiming): string | null {\n const worked = workedDurationMs(timing);\n return worked === null ? null : `Worked for ${formatWorkDuration(worked)}`;\n}\n\nconst MAX_FIRST_SEEN = 200;\nconst firstSeen = new Map<string, number>();\n\n/**\n * The first time this client saw a turn, for a live clock with no server stamp\n * to anchor on yet (an optimistic prompt before the server echoes it). Keyed\n * per turn, so a later turn never inherits an earlier one's start; bounded.\n */\nexport function firstSeenMs(key: string, now = Date.now()): number {\n const seen = firstSeen.get(key);\n if (seen !== undefined) return seen;\n firstSeen.set(key, now);\n if (firstSeen.size > MAX_FIRST_SEEN) {\n const oldest = firstSeen.keys().next().value;\n if (oldest !== undefined) firstSeen.delete(oldest);\n }\n return now;\n}\n\nconst observedEnds = new Map<string, number>();\n\n/** Record that this client saw the turn `key` settle at `now`; returns the recorded instant. */\nexport function recordObservedTurnEnd(key: string, now = Date.now()): number {\n observedEnds.set(key, now);\n if (observedEnds.size > MAX_FIRST_SEEN) {\n const oldest = observedEnds.keys().next().value;\n if (oldest !== undefined) observedEnds.delete(oldest);\n }\n return now;\n}\n\n/** When this client saw the turn `key` settle, if it watched it do so. */\nexport function observedTurnEndMs(key: string): number | null {\n return observedEnds.get(key) ?? null;\n}\n\nexport function resetFirstSeenForTests(): void {\n firstSeen.clear();\n observedEnds.clear();\n}\n"],"names":["parseMessageTime","ATHENA_RUN_MARKER_KEY","MESSAGE_CREATED_AT_KEY"],"mappings":";;;;AAsCA,SAAS,OAAO,OAAqD;AACnE,SAAO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAC5D,QACD;AACN;A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;AAC9B,MAAI,SAAS,OAAW,QAAO;AAC/B,YAAU,IAAI,KAAK,GAAG;AACtB,MAAI,UAAU,OAAO,gBAAgB;AACnC,UAAM,SAAS,UAAU,KAAA,EAAO,OAAO;AACvC,QAAI,WAAW,OAAW,WAAU,OAAO,MAAM;AAAA,EACnD;AACA,SAAO;AACT;AAEA,MAAM,mCAAmB,IAAA;AAGlB,SAAS,sBAAsB,KAAa,MAAM,KAAK,OAAe;AAC3E,eAAa,IAAI,KAAK,GAAG;AACzB,MAAI,aAAa,OAAO,gBAAgB;AACtC,UAAM,SAAS,aAAa,KAAA,EAAO,OAAO;AAC1C,QAAI,WAAW,OAAW,cAAa,OAAO,MAAM;AAAA,EACtD;AACA,SAAO;AACT;AAGO,SAAS,kBAAkB,KAA4B;AAC5D,SAAO,aAAa,IAAI,GAAG,KAAK;AAClC;;;;;;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface TurnTiming {
|
|
2
|
+
/**
|
|
3
|
+
* When the turn started: the prompt's stamp, else the run's own start
|
|
4
|
+
* stamps. A turn that was stopped and then continued starts at its
|
|
5
|
+
* continuation, so the clock never counts the time it sat stopped.
|
|
6
|
+
*/
|
|
7
|
+
startMs: number | null;
|
|
8
|
+
/** When the turn's last message was written, from the server's stamps. */
|
|
9
|
+
endMs: number | null;
|
|
10
|
+
/** The turn-timing middleware's duration, when the final message carries it. */
|
|
11
|
+
serverDurationMs: number | null;
|
|
12
|
+
}
|
|
13
|
+
export interface TurnTimingSources {
|
|
14
|
+
/** `_created_at` of the user message this turn answers. */
|
|
15
|
+
promptCreatedAt: string | null | undefined;
|
|
16
|
+
/** The turn's joined `metadata.custom` (its first assistant message's). */
|
|
17
|
+
custom: Record<string, unknown> | undefined;
|
|
18
|
+
/** The raw messages bound to the turn (`getExternalStoreMessages`), oldest first. */
|
|
19
|
+
sourceMessages: readonly unknown[];
|
|
20
|
+
}
|
|
21
|
+
/** An instant from an ISO stamp or epoch seconds (milliseconds past 1e12), else `null`. */
|
|
22
|
+
export declare function readInstantMs(value: unknown): number | null;
|
|
23
|
+
/** The turn's start, end and server-measured duration from the stamps it carries. */
|
|
24
|
+
export declare function readTurnTiming({ promptCreatedAt, custom, sourceMessages }: TurnTimingSources): TurnTiming;
|
|
25
|
+
/**
|
|
26
|
+
* How long a finished turn worked: from its start to its end, else the
|
|
27
|
+
* server-measured duration, else `null` (nothing truthful to show).
|
|
28
|
+
*
|
|
29
|
+
* The end is the server's own turn clock when the final message carries it.
|
|
30
|
+
* The turn-timing stamp lands on that message only after it has streamed, so a
|
|
31
|
+
* turn watched live can settle before the stamp reaches this client; the last
|
|
32
|
+
* message's `_created_at` is then the start of the final answer, not its end,
|
|
33
|
+
* and `observedEndMs` (when this client saw the turn settle) stands in for it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function workedDurationMs({ startMs, endMs, serverDurationMs }: TurnTiming, observedEndMs?: number | null): number | null;
|
|
36
|
+
/** "45s", "1m 12s", "1h 03m". */
|
|
37
|
+
export declare function formatWorkDuration(ms: number): string;
|
|
38
|
+
/** The live header: "Working" for the first second, then "Working for 1m 12s". */
|
|
39
|
+
export declare function workingLabel(elapsedMs: number): string;
|
|
40
|
+
/** The settled header: "Worked for 2m 30s", or `null` when the turn carries no usable stamps. */
|
|
41
|
+
export declare function workedLabel(timing: TurnTiming): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* The first time this client saw a turn, for a live clock with no server stamp
|
|
44
|
+
* to anchor on yet (an optimistic prompt before the server echoes it). Keyed
|
|
45
|
+
* per turn, so a later turn never inherits an earlier one's start; bounded.
|
|
46
|
+
*/
|
|
47
|
+
export declare function firstSeenMs(key: string, now?: number): number;
|
|
48
|
+
/** Record that this client saw the turn `key` settle at `now`; returns the recorded instant. */
|
|
49
|
+
export declare function recordObservedTurnEnd(key: string, now?: number): number;
|
|
50
|
+
/** When this client saw the turn `key` settle, if it watched it do so. */
|
|
51
|
+
export declare function observedTurnEndMs(key: string): number | null;
|
|
52
|
+
export declare function resetFirstSeenForTests(): void;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { MESSAGE_CREATED_AT_KEY, parseMessageTime } from "../message-time.js";
|
|
2
|
+
import { ATHENA_RUN_MARKER_KEY } from "../../agent-runtime/src/messages.js";
|
|
3
|
+
function record(value) {
|
|
4
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
5
|
+
}
|
|
6
|
+
function readInstantMs(value) {
|
|
7
|
+
var _a;
|
|
8
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
9
|
+
return value > 1e12 ? value : value * 1e3;
|
|
10
|
+
}
|
|
11
|
+
return ((_a = parseMessageTime(value)) == null ? void 0 : _a.getTime()) ?? null;
|
|
12
|
+
}
|
|
13
|
+
function sourceMetadata(message) {
|
|
14
|
+
var _a;
|
|
15
|
+
const kwargs = record((_a = record(message)) == null ? void 0 : _a.additional_kwargs);
|
|
16
|
+
return record(kwargs == null ? void 0 : kwargs.metadata) ?? kwargs;
|
|
17
|
+
}
|
|
18
|
+
function isRunMarker(message) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return typeof ((_b = record((_a = record(message)) == null ? void 0 : _a.additional_kwargs)) == null ? void 0 : _b[ATHENA_RUN_MARKER_KEY]) === "string";
|
|
21
|
+
}
|
|
22
|
+
function readTurnTiming({ promptCreatedAt, custom, sourceMessages }) {
|
|
23
|
+
let endMs = null;
|
|
24
|
+
let firstStampMs = null;
|
|
25
|
+
let serverStartMs = null;
|
|
26
|
+
let serverDurationMs = null;
|
|
27
|
+
let afterMarker = false;
|
|
28
|
+
let continuedAtMs = null;
|
|
29
|
+
for (const message of sourceMessages) {
|
|
30
|
+
if (isRunMarker(message)) {
|
|
31
|
+
afterMarker = true;
|
|
32
|
+
continuedAtMs = null;
|
|
33
|
+
serverDurationMs = null;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const metadata = sourceMetadata(message);
|
|
37
|
+
const stamp = readInstantMs(metadata == null ? void 0 : metadata[MESSAGE_CREATED_AT_KEY]);
|
|
38
|
+
if (stamp !== null) {
|
|
39
|
+
firstStampMs ?? (firstStampMs = stamp);
|
|
40
|
+
if (afterMarker) continuedAtMs ?? (continuedAtMs = stamp);
|
|
41
|
+
endMs = endMs === null ? stamp : Math.max(endMs, stamp);
|
|
42
|
+
}
|
|
43
|
+
const duration = metadata == null ? void 0 : metadata.agent_duration_seconds;
|
|
44
|
+
if (typeof duration === "number" && Number.isFinite(duration) && duration > 0) {
|
|
45
|
+
serverDurationMs = duration * 1e3;
|
|
46
|
+
serverStartMs = readInstantMs(metadata == null ? void 0 : metadata.agent_start_time) ?? serverStartMs;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (serverStartMs !== null && serverDurationMs !== null) {
|
|
50
|
+
const serverEnd = serverStartMs + serverDurationMs;
|
|
51
|
+
endMs = endMs === null ? serverEnd : Math.max(endMs, serverEnd);
|
|
52
|
+
}
|
|
53
|
+
const startMs = continuedAtMs ?? readInstantMs(promptCreatedAt) ?? serverStartMs ?? readInstantMs(custom == null ? void 0 : custom.agent_start_time) ?? readInstantMs(custom == null ? void 0 : custom.run_started_at) ?? readInstantMs(custom == null ? void 0 : custom[MESSAGE_CREATED_AT_KEY]) ?? firstStampMs;
|
|
54
|
+
return { startMs, endMs, serverDurationMs };
|
|
55
|
+
}
|
|
56
|
+
function workedDurationMs({ startMs, endMs, serverDurationMs }, observedEndMs = null) {
|
|
57
|
+
const observed = observedEndMs !== null && (endMs === null || observedEndMs - endMs <= MAX_OBSERVED_END_LAG_MS) ? observedEndMs : null;
|
|
58
|
+
const end = serverDurationMs !== null || observed === null ? endMs : endMs === null ? observed : Math.max(endMs, observed);
|
|
59
|
+
if (startMs !== null && end !== null && end >= startMs) {
|
|
60
|
+
return Math.max(end - startMs, serverDurationMs ?? 0);
|
|
61
|
+
}
|
|
62
|
+
return serverDurationMs;
|
|
63
|
+
}
|
|
64
|
+
const MAX_OBSERVED_END_LAG_MS = 10 * 60 * 1e3;
|
|
65
|
+
function formatWorkDuration(ms) {
|
|
66
|
+
const totalSeconds = Math.max(0, Math.floor(ms / 1e3));
|
|
67
|
+
if (totalSeconds < 60) return `${totalSeconds}s`;
|
|
68
|
+
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
69
|
+
if (totalMinutes < 60) return `${totalMinutes}m ${String(totalSeconds % 60).padStart(2, "0")}s`;
|
|
70
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
71
|
+
return `${hours}h ${String(totalMinutes % 60).padStart(2, "0")}m`;
|
|
72
|
+
}
|
|
73
|
+
function workingLabel(elapsedMs) {
|
|
74
|
+
return elapsedMs < 1e3 ? "Working" : `Working for ${formatWorkDuration(elapsedMs)}`;
|
|
75
|
+
}
|
|
76
|
+
const MAX_FIRST_SEEN = 200;
|
|
77
|
+
const firstSeen = /* @__PURE__ */ new Map();
|
|
78
|
+
function firstSeenMs(key, now = Date.now()) {
|
|
79
|
+
const seen = firstSeen.get(key);
|
|
80
|
+
if (seen !== void 0) return seen;
|
|
81
|
+
firstSeen.set(key, now);
|
|
82
|
+
if (firstSeen.size > MAX_FIRST_SEEN) {
|
|
83
|
+
const oldest = firstSeen.keys().next().value;
|
|
84
|
+
if (oldest !== void 0) firstSeen.delete(oldest);
|
|
85
|
+
}
|
|
86
|
+
return now;
|
|
87
|
+
}
|
|
88
|
+
const observedEnds = /* @__PURE__ */ new Map();
|
|
89
|
+
function recordObservedTurnEnd(key, now = Date.now()) {
|
|
90
|
+
observedEnds.set(key, now);
|
|
91
|
+
if (observedEnds.size > MAX_FIRST_SEEN) {
|
|
92
|
+
const oldest = observedEnds.keys().next().value;
|
|
93
|
+
if (oldest !== void 0) observedEnds.delete(oldest);
|
|
94
|
+
}
|
|
95
|
+
return now;
|
|
96
|
+
}
|
|
97
|
+
function observedTurnEndMs(key) {
|
|
98
|
+
return observedEnds.get(key) ?? null;
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
firstSeenMs,
|
|
102
|
+
formatWorkDuration,
|
|
103
|
+
observedTurnEndMs,
|
|
104
|
+
readInstantMs,
|
|
105
|
+
readTurnTiming,
|
|
106
|
+
recordObservedTurnEnd,
|
|
107
|
+
workedDurationMs,
|
|
108
|
+
workingLabel
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=turn-timing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-timing.js","sources":["../../../src/chat/super-grouping/turn-timing.ts"],"sourcesContent":["/**\n * How long an assistant turn has been working, or worked — the grouped\n * transcript's \"Working for 1m 12s\" / \"Worked for 2m 30s\" header.\n *\n * Every clock here is a server stamp the runtime already writes: `_created_at`\n * on each message (`additional_kwargs.metadata`, surfaced as\n * `metadata.custom`), and on the turn's final assistant message the\n * turn-timing middleware's `agent_start_time` / `agent_duration_seconds`\n * (epoch seconds). The converter joins only the first assistant message's\n * metadata into the turn, so the end of the turn is read off the raw messages\n * bound to it. assistant-ui's own `createdAt` is when this client first saw the\n * message, so it is never used.\n */\nimport { ATHENA_RUN_MARKER_KEY } from '@athenaintel/agent-runtime';\nimport { MESSAGE_CREATED_AT_KEY, parseMessageTime } from '../message-time';\n\nexport interface TurnTiming {\n /**\n * When the turn started: the prompt's stamp, else the run's own start\n * stamps. A turn that was stopped and then continued starts at its\n * continuation, so the clock never counts the time it sat stopped.\n */\n startMs: number | null;\n /** When the turn's last message was written, from the server's stamps. */\n endMs: number | null;\n /** The turn-timing middleware's duration, when the final message carries it. */\n serverDurationMs: number | null;\n}\n\nexport interface TurnTimingSources {\n /** `_created_at` of the user message this turn answers. */\n promptCreatedAt: string | null | undefined;\n /** The turn's joined `metadata.custom` (its first assistant message's). */\n custom: Record<string, unknown> | undefined;\n /** The raw messages bound to the turn (`getExternalStoreMessages`), oldest first. */\n sourceMessages: readonly unknown[];\n}\n\nfunction record(value: unknown): Record<string, unknown> | undefined {\n return value && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\n/** An instant from an ISO stamp or epoch seconds (milliseconds past 1e12), else `null`. */\nexport function readInstantMs(value: unknown): number | null {\n if (typeof value === 'number' && Number.isFinite(value) && value > 0) {\n return value > 1e12 ? value : value * 1000;\n }\n return parseMessageTime(value)?.getTime() ?? null;\n}\n\nfunction sourceMetadata(message: unknown): Record<string, unknown> | undefined {\n const kwargs = record(record(message)?.additional_kwargs);\n return record(kwargs?.metadata) ?? kwargs;\n}\n\nfunction isRunMarker(message: unknown): boolean {\n return typeof record(record(message)?.additional_kwargs)?.[ATHENA_RUN_MARKER_KEY] === 'string';\n}\n\n/** The turn's start, end and server-measured duration from the stamps it carries. */\nexport function readTurnTiming({ promptCreatedAt, custom, sourceMessages }: TurnTimingSources): TurnTiming {\n let endMs: number | null = null;\n let firstStampMs: number | null = null;\n let serverStartMs: number | null = null;\n let serverDurationMs: number | null = null;\n let afterMarker = false;\n let continuedAtMs: number | null = null;\n for (const message of sourceMessages) {\n if (isRunMarker(message)) {\n afterMarker = true;\n continuedAtMs = null;\n serverDurationMs = null;\n continue;\n }\n const metadata = sourceMetadata(message);\n const stamp = readInstantMs(metadata?.[MESSAGE_CREATED_AT_KEY]);\n if (stamp !== null) {\n firstStampMs ??= stamp;\n if (afterMarker) continuedAtMs ??= stamp;\n endMs = endMs === null ? stamp : Math.max(endMs, stamp);\n }\n const duration = metadata?.agent_duration_seconds;\n if (typeof duration === 'number' && Number.isFinite(duration) && duration > 0) {\n serverDurationMs = duration * 1000;\n serverStartMs = readInstantMs(metadata?.agent_start_time) ?? serverStartMs;\n }\n }\n if (serverStartMs !== null && serverDurationMs !== null) {\n const serverEnd = serverStartMs + serverDurationMs;\n endMs = endMs === null ? serverEnd : Math.max(endMs, serverEnd);\n }\n // Without a prompt stamp the run's own server clock comes before any\n // assistant stamp: the first assistant message is written after the turn\n // has already been working (thinking, the first tool), so starting there\n // would drop that time.\n const startMs =\n continuedAtMs ??\n readInstantMs(promptCreatedAt) ??\n serverStartMs ??\n readInstantMs(custom?.agent_start_time) ??\n readInstantMs(custom?.run_started_at) ??\n readInstantMs(custom?.[MESSAGE_CREATED_AT_KEY]) ??\n firstStampMs;\n return { startMs, endMs, serverDurationMs };\n}\n\n/**\n * How long a finished turn worked: from its start to its end, else the\n * server-measured duration, else `null` (nothing truthful to show).\n *\n * The end is the server's own turn clock when the final message carries it.\n * The turn-timing stamp lands on that message only after it has streamed, so a\n * turn watched live can settle before the stamp reaches this client; the last\n * message's `_created_at` is then the start of the final answer, not its end,\n * and `observedEndMs` (when this client saw the turn settle) stands in for it.\n */\nexport function workedDurationMs(\n { startMs, endMs, serverDurationMs }: TurnTiming,\n observedEndMs: number | null = null,\n): number | null {\n // A settle seen long after the last stamp is not this turn's end (a thread\n // opened while its status was still catching up), so it is ignored.\n const observed =\n observedEndMs !== null && (endMs === null || observedEndMs - endMs <= MAX_OBSERVED_END_LAG_MS)\n ? observedEndMs\n : null;\n const end =\n serverDurationMs !== null || observed === null\n ? endMs\n : endMs === null\n ? observed\n : Math.max(endMs, observed);\n // The server's own duration is a floor: a start read off a later stamp\n // never shortens the turn below what the server measured.\n if (startMs !== null && end !== null && end >= startMs) {\n return Math.max(end - startMs, serverDurationMs ?? 0);\n }\n return serverDurationMs;\n}\n\n/** How far past its last stamp a turn may be seen to settle and still count as its end. */\nconst MAX_OBSERVED_END_LAG_MS = 10 * 60 * 1000;\n\n/** \"45s\", \"1m 12s\", \"1h 03m\". */\nexport function formatWorkDuration(ms: number): string {\n const totalSeconds = Math.max(0, Math.floor(ms / 1000));\n if (totalSeconds < 60) return `${totalSeconds}s`;\n const totalMinutes = Math.floor(totalSeconds / 60);\n if (totalMinutes < 60) return `${totalMinutes}m ${String(totalSeconds % 60).padStart(2, '0')}s`;\n const hours = Math.floor(totalMinutes / 60);\n return `${hours}h ${String(totalMinutes % 60).padStart(2, '0')}m`;\n}\n\n/** The live header: \"Working\" for the first second, then \"Working for 1m 12s\". */\nexport function workingLabel(elapsedMs: number): string {\n return elapsedMs < 1000 ? 'Working' : `Working for ${formatWorkDuration(elapsedMs)}`;\n}\n\n/** The settled header: \"Worked for 2m 30s\", or `null` when the turn carries no usable stamps. */\nexport function workedLabel(timing: TurnTiming): string | null {\n const worked = workedDurationMs(timing);\n return worked === null ? null : `Worked for ${formatWorkDuration(worked)}`;\n}\n\nconst MAX_FIRST_SEEN = 200;\nconst firstSeen = new Map<string, number>();\n\n/**\n * The first time this client saw a turn, for a live clock with no server stamp\n * to anchor on yet (an optimistic prompt before the server echoes it). Keyed\n * per turn, so a later turn never inherits an earlier one's start; bounded.\n */\nexport function firstSeenMs(key: string, now = Date.now()): number {\n const seen = firstSeen.get(key);\n if (seen !== undefined) return seen;\n firstSeen.set(key, now);\n if (firstSeen.size > MAX_FIRST_SEEN) {\n const oldest = firstSeen.keys().next().value;\n if (oldest !== undefined) firstSeen.delete(oldest);\n }\n return now;\n}\n\nconst observedEnds = new Map<string, number>();\n\n/** Record that this client saw the turn `key` settle at `now`; returns the recorded instant. */\nexport function recordObservedTurnEnd(key: string, now = Date.now()): number {\n observedEnds.set(key, now);\n if (observedEnds.size > MAX_FIRST_SEEN) {\n const oldest = observedEnds.keys().next().value;\n if (oldest !== undefined) observedEnds.delete(oldest);\n }\n return now;\n}\n\n/** When this client saw the turn `key` settle, if it watched it do so. */\nexport function observedTurnEndMs(key: string): number | null {\n return observedEnds.get(key) ?? null;\n}\n\nexport function resetFirstSeenForTests(): void {\n firstSeen.clear();\n observedEnds.clear();\n}\n"],"names":[],"mappings":";;AAsCA,SAAS,OAAO,OAAqD;AACnE,SAAO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAC5D,QACD;AACN;AAGO,SAAS,cAAc,OAA+B;;AAC3D,MAAI,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,QAAQ,GAAG;AACpE,WAAO,QAAQ,OAAO,QAAQ,QAAQ;AAAA,EACxC;AACA,WAAO,sBAAiB,KAAK,MAAtB,mBAAyB,cAAa;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,mCAAmB,IAAA;AAGlB,SAAS,sBAAsB,KAAa,MAAM,KAAK,OAAe;AAC3E,eAAa,IAAI,KAAK,GAAG;AACzB,MAAI,aAAa,OAAO,gBAAgB;AACtC,UAAM,SAAS,aAAa,KAAA,EAAO,OAAO;AAC1C,QAAI,WAAW,OAAW,cAAa,OAAO,MAAM;AAAA,EACtD;AACA,SAAO;AACT;AAGO,SAAS,kBAAkB,KAA4B;AAC5D,SAAO,aAAa,IAAI,GAAG,KAAK;AAClC;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const chatMessageBody = require("../chat-ui/rich-text/chat-message-body.cjs");
|
|
5
|
-
const streamingMarkdown = require("../
|
|
5
|
+
const streamingMarkdown = require("../agent-runtime/src/streaming-markdown.cjs");
|
|
6
6
|
const TiptapText = ({ text, status }) => {
|
|
7
7
|
const isRunning = (status == null ? void 0 : status.type) === "running";
|
|
8
8
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
package/dist/chat/tiptap-text.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ChatMessageBody } from "../chat-ui/rich-text/chat-message-body.js";
|
|
3
|
-
import { hideUnterminatedMarkdownLink } from "../
|
|
3
|
+
import { hideUnterminatedMarkdownLink } from "../agent-runtime/src/streaming-markdown.js";
|
|
4
4
|
const TiptapText = ({ text, status }) => {
|
|
5
5
|
const isRunning = (status == null ? void 0 : status.type) === "running";
|
|
6
6
|
return /* @__PURE__ */ jsx(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const react = require("@assistant-ui/react");
|
|
4
|
-
const threadStatus = require("../
|
|
4
|
+
const threadStatus = require("../agent-runtime/src/thread-status.cjs");
|
|
5
5
|
function useAthenaRunLive() {
|
|
6
6
|
const connection = threadStatus.useDeepAgentConnection();
|
|
7
7
|
return react.useAuiState((s) => threadStatus.readRunLive(s.thread, connection));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useAuiState } from "@assistant-ui/react";
|
|
2
|
-
import { useDeepAgentConnection, readRunLive } from "../
|
|
2
|
+
import { useDeepAgentConnection, readRunLive } from "../agent-runtime/src/thread-status.js";
|
|
3
3
|
function useAthenaRunLive() {
|
|
4
4
|
const connection = useDeepAgentConnection();
|
|
5
5
|
return useAuiState((s) => readRunLive(s.thread, connection));
|
|
@@ -3,8 +3,46 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const reactStatewire = require("@assistant-ui/react-statewire");
|
|
4
4
|
const react = require("react");
|
|
5
5
|
const useAthenaRunLive = require("./use-athena-run-live.cjs");
|
|
6
|
-
const interrupts = require("../
|
|
6
|
+
const interrupts = require("../agent-runtime/src/interrupts.cjs");
|
|
7
7
|
const NO_QUEUED_LANE_DECISIONS = Object.freeze({});
|
|
8
|
+
const NO_ACTION_REQUESTS = [];
|
|
9
|
+
const answeredRequests = /* @__PURE__ */ new Map();
|
|
10
|
+
const answeredListeners = /* @__PURE__ */ new Set();
|
|
11
|
+
let answeredVersion = 0;
|
|
12
|
+
function notifyAnswered() {
|
|
13
|
+
answeredVersion += 1;
|
|
14
|
+
for (const listener of answeredListeners) listener();
|
|
15
|
+
}
|
|
16
|
+
function recordAnswered(requestId, laneIds) {
|
|
17
|
+
answeredRequests.set(requestId, laneIds);
|
|
18
|
+
notifyAnswered();
|
|
19
|
+
}
|
|
20
|
+
function forgetAnswered(requestId) {
|
|
21
|
+
if (answeredRequests.delete(requestId)) notifyAnswered();
|
|
22
|
+
}
|
|
23
|
+
function subscribeAnswered(listener) {
|
|
24
|
+
answeredListeners.add(listener);
|
|
25
|
+
return () => {
|
|
26
|
+
answeredListeners.delete(listener);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const readAnsweredVersion = () => answeredVersion;
|
|
30
|
+
function answeredLaneIds(value, actionRequests) {
|
|
31
|
+
const ids = interrupts.laneInterruptIds(actionRequests) ?? [];
|
|
32
|
+
if (typeof value === "object" && value !== null && "lane_decisions" in value) {
|
|
33
|
+
const lanes = value.lane_decisions;
|
|
34
|
+
if (typeof lanes === "object" && lanes !== null) {
|
|
35
|
+
for (const id of Object.keys(lanes)) if (!ids.includes(id)) ids.push(id);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return ids;
|
|
39
|
+
}
|
|
40
|
+
function mirrorAlreadyAnswered(answeredLanes, liveActionRequests) {
|
|
41
|
+
if (answeredLanes === void 0) return false;
|
|
42
|
+
const ids = interrupts.laneInterruptIds(liveActionRequests);
|
|
43
|
+
if (ids === null) return false;
|
|
44
|
+
return ids.every((id) => answeredLanes.includes(id));
|
|
45
|
+
}
|
|
8
46
|
function useStatewireApprovalRequest(options = {}) {
|
|
9
47
|
var _a;
|
|
10
48
|
const {
|
|
@@ -22,10 +60,32 @@ function useStatewireApprovalRequest(options = {}) {
|
|
|
22
60
|
const actionRequests = react.useMemo(() => interrupts.pendingActionRequests(hitl), [hitl]);
|
|
23
61
|
const isRunning = useAthenaRunLive.useAthenaRunLive();
|
|
24
62
|
const mirror = reactStatewire.useStatewireState(interrupts.readInterruptMirror);
|
|
25
|
-
const
|
|
26
|
-
const
|
|
63
|
+
const mirrorHitl = request === void 0 && isRunning ? interrupts.asHitlApproval(interrupts.interruptMirrorPayload(mirror)) : null;
|
|
64
|
+
const mirrorActionRequests = react.useMemo(() => interrupts.pendingActionRequests(mirrorHitl), [mirrorHitl]);
|
|
65
|
+
const lastRequestIdRef = react.useRef(void 0);
|
|
66
|
+
if (requestId !== void 0) lastRequestIdRef.current = requestId;
|
|
67
|
+
react.useSyncExternalStore(subscribeAnswered, readAnsweredVersion, readAnsweredVersion);
|
|
68
|
+
const answeredLanes = lastRequestIdRef.current === void 0 ? void 0 : answeredRequests.get(lastRequestIdRef.current);
|
|
69
|
+
const mirrorCleared = interrupts.interruptMirrorPayload(mirror) === void 0;
|
|
70
|
+
react.useEffect(() => {
|
|
71
|
+
if (requestId === void 0) return;
|
|
72
|
+
return () => {
|
|
73
|
+
if (lastRequestIdRef.current !== requestId) forgetAnswered(requestId);
|
|
74
|
+
};
|
|
75
|
+
}, [requestId]);
|
|
76
|
+
react.useEffect(() => {
|
|
77
|
+
if (mirrorCleared && lastRequestIdRef.current !== void 0) forgetAnswered(lastRequestIdRef.current);
|
|
78
|
+
}, [mirrorCleared]);
|
|
79
|
+
react.useEffect(
|
|
80
|
+
() => () => {
|
|
81
|
+
if (lastRequestIdRef.current !== void 0) forgetAnswered(lastRequestIdRef.current);
|
|
82
|
+
},
|
|
83
|
+
[]
|
|
84
|
+
);
|
|
85
|
+
const liveHitl = mirrorAlreadyAnswered(answeredLanes, mirrorActionRequests) ? null : mirrorHitl;
|
|
86
|
+
const liveActionRequests = liveHitl === mirrorHitl ? mirrorActionRequests : NO_ACTION_REQUESTS;
|
|
27
87
|
const queuedLaneDecisions = reactStatewire.useStatewireState(interrupts.readQueuedLaneDecisions) ?? NO_QUEUED_LANE_DECISIONS;
|
|
28
|
-
const { pending, resume } = interrupts.useApprovalResumeLock({
|
|
88
|
+
const { pending, resume: resumeLocked } = interrupts.useApprovalResumeLock({
|
|
29
89
|
requestId,
|
|
30
90
|
isRunning,
|
|
31
91
|
pendingResumeGraceMs,
|
|
@@ -39,6 +99,15 @@ function useStatewireApprovalRequest(options = {}) {
|
|
|
39
99
|
response: { type: "resume", value }
|
|
40
100
|
})
|
|
41
101
|
});
|
|
102
|
+
const resume = react.useCallback(
|
|
103
|
+
(value) => {
|
|
104
|
+
if (requestId !== void 0) {
|
|
105
|
+
recordAnswered(requestId, answeredLaneIds(value, actionRequests));
|
|
106
|
+
}
|
|
107
|
+
return resumeLocked(value);
|
|
108
|
+
},
|
|
109
|
+
[requestId, actionRequests, resumeLocked]
|
|
110
|
+
);
|
|
42
111
|
const sendLaneDecisions = react.useCallback(
|
|
43
112
|
(lanes) => requestId !== void 0 ? resume({ lane_decisions: lanes }) : sendCommand({ type: "run/lane-input", laneDecisions: lanes }),
|
|
44
113
|
[requestId, resume, sendCommand]
|