@athenaintel/react 0.28.0 → 0.30.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 +418 -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/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/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 +12 -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 +12 -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 +23 -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 +24 -14
- 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 +365 -3
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/tool-metadata.js +365 -3
- 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.map +1 -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 +8 -2
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.d.ts +8 -0
- package/dist/assets/AthenaAssetEmbed.js +8 -2
- 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.map +1 -1
- package/dist/assets/asset-embed-messages.d.ts +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 +86 -46
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +21 -4
- package/dist/chat/AthenaChat.js +88 -48
- 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 +7 -5
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +8 -2
- package/dist/chat/super-grouping/SuperGroupingCard.js +7 -5
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +350 -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 +350 -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 +51 -26
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +40 -8
- package/dist/chat/super-grouping/activity-timeline.js +52 -27
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/super-grouping/index.cjs +12 -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 +14 -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/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 +57 -11
- 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 +57 -11
- 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 +3 -2
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.js +4 -3
- package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.cjs +8 -2
- package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.js +8 -2
- 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/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 +218 -13
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +105 -2
- package/dist/collab/client.js +221 -17
- 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/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 +159 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +53 -12
- package/dist/index.js +166 -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 +36 -6
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +20 -1
- package/dist/provider/AthenaProvider.js +38 -8
- 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/statewire-lifecycle.cjs +15 -3
- package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.d.ts +6 -0
- package/dist/runtime/statewire-lifecycle.js +15 -3
- package/dist/runtime/statewire-lifecycle.js.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +11 -7
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.js +11 -7
- 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 +21 -1
- package/dist/threads/api.cjs.map +1 -1
- package/dist/threads/api.d.ts +59 -0
- package/dist/threads/api.js +21 -1
- 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-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 +39 -97
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/tool-uis.js +39 -97
- 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 +20 -9
- 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.map +0 -1
- 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-config.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-config.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,252 @@
|
|
|
1
|
+
const SUBSCRIPTION_EVENT_KEY = "athena_subscription_event";
|
|
2
|
+
const MAX_SHOWN_PLACES = 3;
|
|
3
|
+
const MAX_VALUE_CHARS = 40;
|
|
4
|
+
const CONTENT_CHANGED = "asset.content.changed";
|
|
5
|
+
const COMMENT_CREATED = "asset.comment.created";
|
|
6
|
+
const COMMENT_REPLIED = "asset.comment.replied";
|
|
7
|
+
const COMMENT_RESOLVED = "asset.comment.resolved";
|
|
8
|
+
const PRESENCE_JOINED = "asset.presence.joined";
|
|
9
|
+
const SLACK_PREFIX = "user_slack.";
|
|
10
|
+
const COMMENT_EVENTS = /* @__PURE__ */ new Set([
|
|
11
|
+
COMMENT_CREATED,
|
|
12
|
+
COMMENT_REPLIED,
|
|
13
|
+
COMMENT_RESOLVED
|
|
14
|
+
]);
|
|
15
|
+
const SLACK_WORDS = {
|
|
16
|
+
"user_slack.dm.received": "sent you a Slack direct message",
|
|
17
|
+
"user_slack.mention.received": "mentioned you in Slack",
|
|
18
|
+
"user_slack.thread_reply.received": "replied in your Slack thread",
|
|
19
|
+
"user_slack.channel_message.posted": "posted in a Slack channel",
|
|
20
|
+
"user_slack.reaction.added": "reacted to a Slack message",
|
|
21
|
+
"user_slack.message.saved": "saved a Slack message",
|
|
22
|
+
"user_slack.pin.added": "pinned a Slack message"
|
|
23
|
+
};
|
|
24
|
+
function isRecord(value) {
|
|
25
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
function stringOf(value) {
|
|
28
|
+
return typeof value === "string" && value.trim().length > 0 ? value : null;
|
|
29
|
+
}
|
|
30
|
+
function numberOf(value) {
|
|
31
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
32
|
+
}
|
|
33
|
+
function sheetQualifier(sheet) {
|
|
34
|
+
return /^[A-Za-z_][A-Za-z0-9_.]*$/.test(sheet) ? sheet : `'${sheet.replaceAll("'", "''")}'`;
|
|
35
|
+
}
|
|
36
|
+
function subscriptionPlaceWords(anchor) {
|
|
37
|
+
if (!isRecord(anchor)) return null;
|
|
38
|
+
const sheet = stringOf(anchor.sheet) ?? stringOf(anchor.sheet_name);
|
|
39
|
+
const range = stringOf(anchor.range) ?? stringOf(anchor.cell);
|
|
40
|
+
if (range) return sheet ? `${sheetQualifier(sheet)}!${range}` : range;
|
|
41
|
+
const page = numberOf(anchor.page);
|
|
42
|
+
if (page !== null) return `page ${page}`;
|
|
43
|
+
const slide = numberOf(anchor.slide_index);
|
|
44
|
+
if (slide !== null) return `slide ${slide}`;
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
function actorWords(envelope) {
|
|
48
|
+
const actor = isRecord(envelope.actor) ? envelope.actor : {};
|
|
49
|
+
const name = stringOf(actor.name);
|
|
50
|
+
let who;
|
|
51
|
+
switch (actor.kind) {
|
|
52
|
+
case "self":
|
|
53
|
+
who = "You";
|
|
54
|
+
break;
|
|
55
|
+
case "agent":
|
|
56
|
+
who = name ?? "An agent";
|
|
57
|
+
break;
|
|
58
|
+
case "system":
|
|
59
|
+
who = name ?? "Athena";
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
who = name ?? "Someone";
|
|
63
|
+
}
|
|
64
|
+
const more = numberOf(envelope.more_actors) ?? 0;
|
|
65
|
+
if (more <= 0) return who;
|
|
66
|
+
return `${who} and ${more} ${more === 1 ? "other" : "others"}`;
|
|
67
|
+
}
|
|
68
|
+
function readChanges(value) {
|
|
69
|
+
if (!Array.isArray(value)) return [];
|
|
70
|
+
return value.flatMap((entry) => {
|
|
71
|
+
if (!isRecord(entry)) return [];
|
|
72
|
+
const raw = entry.value;
|
|
73
|
+
const scalar = typeof raw === "string" || typeof raw === "number" || typeof raw === "boolean" ? String(raw) : null;
|
|
74
|
+
return [{ place: subscriptionPlaceWords(entry.anchor), value: scalar }];
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function readSubscriptionWakeEvent(custom) {
|
|
78
|
+
const envelope = custom == null ? void 0 : custom[SUBSCRIPTION_EVENT_KEY];
|
|
79
|
+
if (!isRecord(envelope)) return void 0;
|
|
80
|
+
const subscriptionId = stringOf(envelope.subscription_id);
|
|
81
|
+
if (subscriptionId === null) return void 0;
|
|
82
|
+
const comment = isRecord(envelope.comment) ? envelope.comment : null;
|
|
83
|
+
const schedule = isRecord(envelope.schedule) ? envelope.schedule : null;
|
|
84
|
+
const eventTypes = Array.isArray(envelope.event_types) ? envelope.event_types.filter((type) => typeof type === "string") : [];
|
|
85
|
+
const subscribed = Array.isArray(envelope.subscribed) ? envelope.subscribed.flatMap((anchor) => {
|
|
86
|
+
const words = subscriptionPlaceWords(anchor);
|
|
87
|
+
return words ? [words] : [];
|
|
88
|
+
}) : [];
|
|
89
|
+
return {
|
|
90
|
+
subscriptionId,
|
|
91
|
+
kind: envelope.kind === "schedule" ? "schedule" : "event",
|
|
92
|
+
assetTitle: stringOf(envelope.asset_title),
|
|
93
|
+
eventTypes,
|
|
94
|
+
eventCount: numberOf(envelope.event_count),
|
|
95
|
+
actor: actorWords(envelope),
|
|
96
|
+
changes: readChanges(envelope.changes),
|
|
97
|
+
moreChanges: Math.max(0, numberOf(envelope.more_changes) ?? 0),
|
|
98
|
+
subscribed,
|
|
99
|
+
commentPlace: comment ? subscriptionPlaceWords(comment.anchor) : null,
|
|
100
|
+
commentResolved: typeof (comment == null ? void 0 : comment.resolved) === "boolean" ? comment.resolved : null,
|
|
101
|
+
scheduleSetAt: schedule ? stringOf(schedule.set_at) : null,
|
|
102
|
+
note: stringOf(envelope.note),
|
|
103
|
+
runsLeft: numberOf(envelope.runs_left),
|
|
104
|
+
deliveredAt: stringOf(envelope.delivered_at)
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function isSubscriptionWakeMessage(custom) {
|
|
108
|
+
return readSubscriptionWakeEvent(custom) !== void 0;
|
|
109
|
+
}
|
|
110
|
+
function valueWords(value) {
|
|
111
|
+
const folded = value.replace(/\s+/g, " ").trim();
|
|
112
|
+
if (folded === "") return "“ ”";
|
|
113
|
+
return folded.length > MAX_VALUE_CHARS ? `${folded.slice(0, MAX_VALUE_CHARS - 1).trimEnd()}…` : folded;
|
|
114
|
+
}
|
|
115
|
+
function joinList({ items, last }) {
|
|
116
|
+
if (items.length <= 1) return items.join("");
|
|
117
|
+
return `${items.slice(0, -1).join(", ")}${last}${items.at(-1)}`;
|
|
118
|
+
}
|
|
119
|
+
function joinClauses(clauses) {
|
|
120
|
+
const itemLast = clauses.length === 1 ? " and " : ", ";
|
|
121
|
+
return joinList({
|
|
122
|
+
items: clauses.map(({ lead, items }) => `${lead}${joinList({ items, last: itemLast })}`),
|
|
123
|
+
last: " and "
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function changeClauses({
|
|
127
|
+
changes,
|
|
128
|
+
moreChanges
|
|
129
|
+
}) {
|
|
130
|
+
const located = changes.filter(
|
|
131
|
+
(change) => change.place !== null
|
|
132
|
+
);
|
|
133
|
+
const shown = located.slice(0, MAX_SHOWN_PLACES);
|
|
134
|
+
if (shown.length === 0) return [];
|
|
135
|
+
const hidden = located.length - shown.length + moreChanges;
|
|
136
|
+
const set = shown.filter((change) => change.value !== null && change.value !== "");
|
|
137
|
+
const cleared = shown.filter((change) => change.value === "");
|
|
138
|
+
const changed = shown.filter((change) => change.value === null);
|
|
139
|
+
const clauses = [];
|
|
140
|
+
if (set.length > 0) {
|
|
141
|
+
clauses.push({
|
|
142
|
+
lead: "set ",
|
|
143
|
+
items: set.map((change) => `${change.place} to ${valueWords(change.value ?? "")}`)
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (cleared.length > 0) {
|
|
147
|
+
clauses.push({ lead: "cleared ", items: cleared.map((change) => change.place) });
|
|
148
|
+
}
|
|
149
|
+
if (changed.length > 0) {
|
|
150
|
+
clauses.push({ lead: "changed ", items: changed.map((change) => change.place) });
|
|
151
|
+
}
|
|
152
|
+
if (hidden > 0) clauses.push({ lead: `${hidden} more`, items: [] });
|
|
153
|
+
return clauses;
|
|
154
|
+
}
|
|
155
|
+
function commentLead({ type, resolved }) {
|
|
156
|
+
if (type === COMMENT_CREATED) return "commented on ";
|
|
157
|
+
if (type === COMMENT_REPLIED) return "replied to a comment on ";
|
|
158
|
+
const verb = resolved === true ? "resolved" : resolved === false ? "reopened" : "updated";
|
|
159
|
+
return `${verb} a comment on `;
|
|
160
|
+
}
|
|
161
|
+
function eventLabel(type) {
|
|
162
|
+
const words = type.replace(/^asset\./, "").replace(/[.\s_-]+/g, " ").trim().toLowerCase();
|
|
163
|
+
return words ? `${words.charAt(0).toUpperCase()}${words.slice(1)}` : "—";
|
|
164
|
+
}
|
|
165
|
+
function eventClauses(event) {
|
|
166
|
+
const asset = event.assetTitle ?? "the asset";
|
|
167
|
+
const changes = changeClauses({ changes: event.changes, moreChanges: event.moreChanges });
|
|
168
|
+
const listed = event.eventTypes;
|
|
169
|
+
const types = [
|
|
170
|
+
...new Set(
|
|
171
|
+
listed.length === 0 || changes.length > 0 && !listed.includes(CONTENT_CHANGED) ? [CONTENT_CHANGED, ...listed] : listed
|
|
172
|
+
)
|
|
173
|
+
];
|
|
174
|
+
const firstComment = types.find((type) => COMMENT_EVENTS.has(type));
|
|
175
|
+
const clauses = types.flatMap((type) => {
|
|
176
|
+
if (type === CONTENT_CHANGED) {
|
|
177
|
+
return changes.length > 0 ? changes : [{ lead: "edited ", items: [asset] }];
|
|
178
|
+
}
|
|
179
|
+
if (COMMENT_EVENTS.has(type)) {
|
|
180
|
+
const where = type === firstComment && event.commentPlace ? event.commentPlace : asset;
|
|
181
|
+
return [{ lead: commentLead({ type, resolved: event.commentResolved }), items: [where] }];
|
|
182
|
+
}
|
|
183
|
+
if (type === PRESENCE_JOINED) return [{ lead: "opened ", items: [asset] }];
|
|
184
|
+
if (type.startsWith(SLACK_PREFIX)) {
|
|
185
|
+
return [{ lead: SLACK_WORDS[type] ?? "had Slack activity", items: [] }];
|
|
186
|
+
}
|
|
187
|
+
return [{ lead: `triggered “${eventLabel(type)}” on `, items: [asset] }];
|
|
188
|
+
});
|
|
189
|
+
const said = /* @__PURE__ */ new Set();
|
|
190
|
+
return clauses.filter((clause) => {
|
|
191
|
+
if (clause.items.length > 0) return true;
|
|
192
|
+
if (said.has(clause.lead)) return false;
|
|
193
|
+
said.add(clause.lead);
|
|
194
|
+
return true;
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function setOnWords({ setAt, now }) {
|
|
198
|
+
const date = new Date(setAt);
|
|
199
|
+
if (Number.isNaN(date.getTime())) return null;
|
|
200
|
+
const midnight = (day) => new Date(day.getFullYear(), day.getMonth(), day.getDate()).getTime();
|
|
201
|
+
const days = Math.round((midnight(now) - midnight(date)) / (24 * 60 * 60 * 1e3));
|
|
202
|
+
if (days === 0) return "today";
|
|
203
|
+
if (days === 1) return "yesterday";
|
|
204
|
+
const sameYear = date.getFullYear() === now.getFullYear();
|
|
205
|
+
return `on ${date.toLocaleDateString("en-US", {
|
|
206
|
+
month: "short",
|
|
207
|
+
day: "numeric",
|
|
208
|
+
...sameYear ? {} : { year: "numeric" }
|
|
209
|
+
})}`;
|
|
210
|
+
}
|
|
211
|
+
function subscriptionWakeHeadline({
|
|
212
|
+
event,
|
|
213
|
+
now = /* @__PURE__ */ new Date()
|
|
214
|
+
}) {
|
|
215
|
+
if (event.kind === "schedule") {
|
|
216
|
+
const when = event.scheduleSetAt ? setOnWords({ setAt: event.scheduleSetAt, now }) : null;
|
|
217
|
+
return when ? `Scheduled check-in you set ${when}` : "Scheduled check-in";
|
|
218
|
+
}
|
|
219
|
+
return `${event.actor} ${joinClauses(eventClauses(event))}`;
|
|
220
|
+
}
|
|
221
|
+
function runsLeftWords(runsLeft) {
|
|
222
|
+
if (runsLeft <= 0) return "No runs left";
|
|
223
|
+
return `${runsLeft} ${runsLeft === 1 ? "run" : "runs"} left`;
|
|
224
|
+
}
|
|
225
|
+
function subscriptionWakeDetail(event) {
|
|
226
|
+
if (event.kind === "schedule") {
|
|
227
|
+
const parts2 = [
|
|
228
|
+
event.note,
|
|
229
|
+
event.runsLeft !== null && event.runsLeft > 0 ? runsLeftWords(event.runsLeft) : null
|
|
230
|
+
].filter((part) => part !== null);
|
|
231
|
+
return parts2.length > 0 ? parts2.join(" · ") : null;
|
|
232
|
+
}
|
|
233
|
+
const shown = event.subscribed.slice(0, MAX_SHOWN_PLACES);
|
|
234
|
+
const hidden = event.subscribed.length - shown.length;
|
|
235
|
+
const subscribed = shown.length > 0 ? `subscribed to ${shown.join(", ")}${hidden > 0 ? ` and ${hidden} more` : ""}` : null;
|
|
236
|
+
const parts = [
|
|
237
|
+
event.assetTitle,
|
|
238
|
+
subscribed,
|
|
239
|
+
event.runsLeft !== null ? runsLeftWords(event.runsLeft) : null,
|
|
240
|
+
event.eventCount !== null && event.eventCount > 1 ? `${event.eventCount} events` : null
|
|
241
|
+
].filter((part) => part !== null);
|
|
242
|
+
return parts.length > 0 ? parts.join(" · ") : null;
|
|
243
|
+
}
|
|
244
|
+
export {
|
|
245
|
+
SUBSCRIPTION_EVENT_KEY,
|
|
246
|
+
isSubscriptionWakeMessage,
|
|
247
|
+
readSubscriptionWakeEvent,
|
|
248
|
+
subscriptionPlaceWords,
|
|
249
|
+
subscriptionWakeDetail,
|
|
250
|
+
subscriptionWakeHeadline
|
|
251
|
+
};
|
|
252
|
+
//# sourceMappingURL=subscription-wake-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-wake-event.js","sources":["../../../../agent-runtime/src/subscription-wake-event.ts"],"sourcesContent":["/**\n * The asset-subscription delivery that woke a conversation, read from the user\n * turn the delivery started.\n *\n * When an asset subscription fires, agora starts a turn on its conversation\n * with the delivery text the model reads (`render_delivery`), and stamps the\n * facts a person needs beside it under `athena_subscription_event` in the\n * message metadata — server-authoritative like `author`, never sent to the\n * model. The shipped converter exposes that metadata as the thread message's\n * `metadata.custom`, so a surface renders the turn as a compact marker\n * (\"Brendon Geils set B4 to Target\") instead of a user bubble quoting the\n * delivery text. Olympus draws the same facts as its event card with citation\n * chips; this is the text every other surface shows. The envelope is for\n * RENDERING only: a surface that ignores it degrades to a plain bubble, never\n * to a lost instruction.\n */\n\n/** `metadata.custom` key agora stamps on a subscription's delivery turn. */\nexport const SUBSCRIPTION_EVENT_KEY = 'athena_subscription_event';\n\n/** A changed cell or range, and its value now when agora read it. */\nexport interface SubscriptionWakeChange {\n /** Where: \"B4\", \"Sheet1!B2:B11\", \"page 5\"; `null` for a place the marker has no words for. */\n place: string | null;\n /** The value now; `null` when agora read none (a busy run's tray, a failed or capped read). */\n value: string | null;\n}\n\nexport interface SubscriptionWakeEvent {\n subscriptionId: string;\n /** `event`: something happened on an asset. `schedule`: a check-in the person set. */\n kind: 'event' | 'schedule';\n assetTitle: string | null;\n eventTypes: string[];\n eventCount: number | null;\n /** Who did it, in words: their name, \"You\", \"An agent\", \"Athena\", \"Someone\", with others counted. */\n actor: string;\n changes: SubscriptionWakeChange[];\n /** Changed places past the ones `changes` lists (agora caps the list): counted, never named. */\n moreChanges: number;\n /** The ranges the subscription names (\"B2:B11\"); empty for the whole asset. */\n subscribed: string[];\n /** Where a comment event's thread sits, when its anchor names a place. */\n commentPlace: string | null;\n /** Whether a comment-resolved event resolved (true) or reopened (false); `null` when unsaid. */\n commentResolved: boolean | null;\n /** When the person set a scheduled check-in. */\n scheduleSetAt: string | null;\n /** A scheduled check-in's own words. */\n note: string | null;\n runsLeft: number | null;\n deliveredAt: string | null;\n}\n\n/** Changed places and subscribed ranges named in one line; the rest are counted. */\nconst MAX_SHOWN_PLACES = 3;\n/** A changed value longer than this is cut in the marker. */\nconst MAX_VALUE_CHARS = 40;\n\nconst CONTENT_CHANGED = 'asset.content.changed';\nconst COMMENT_CREATED = 'asset.comment.created';\nconst COMMENT_REPLIED = 'asset.comment.replied';\nconst COMMENT_RESOLVED = 'asset.comment.resolved';\nconst PRESENCE_JOINED = 'asset.presence.joined';\nconst SLACK_PREFIX = 'user_slack.';\nconst COMMENT_EVENTS: ReadonlySet<string> = new Set([\n COMMENT_CREATED,\n COMMENT_REPLIED,\n COMMENT_RESOLVED,\n]);\n\nconst SLACK_WORDS: Readonly<Record<string, string>> = {\n 'user_slack.dm.received': 'sent you a Slack direct message',\n 'user_slack.mention.received': 'mentioned you in Slack',\n 'user_slack.thread_reply.received': 'replied in your Slack thread',\n 'user_slack.channel_message.posted': 'posted in a Slack channel',\n 'user_slack.reaction.added': 'reacted to a Slack message',\n 'user_slack.message.saved': 'saved a Slack message',\n 'user_slack.pin.added': 'pinned a Slack message',\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** A string with something in it, else `null`. */\nfunction stringOf(value: unknown): string | null {\n return typeof value === 'string' && value.trim().length > 0 ? value : null;\n}\n\n/** A finite number, else `null`. */\nfunction numberOf(value: unknown): number | null {\n return typeof value === 'number' && Number.isFinite(value) ? value : null;\n}\n\n/** A sheet name as an A1 qualifier: quoted when it is not a bare word. */\nfunction sheetQualifier(sheet: string): string {\n return /^[A-Za-z_][A-Za-z0-9_.]*$/.test(sheet) ? sheet : `'${sheet.replaceAll(\"'\", \"''\")}'`;\n}\n\n/**\n * Where a reference-standard anchor in agora's wire form points, in words:\n * a range or cell (with its sheet when the anchor names one), a page, a\n * slide; `null` for any other place.\n */\nexport function subscriptionPlaceWords(anchor: unknown): string | null {\n if (!isRecord(anchor)) return null;\n const sheet = stringOf(anchor.sheet) ?? stringOf(anchor.sheet_name);\n const range = stringOf(anchor.range) ?? stringOf(anchor.cell);\n if (range) return sheet ? `${sheetQualifier(sheet)}!${range}` : range;\n const page = numberOf(anchor.page);\n if (page !== null) return `page ${page}`;\n const slide = numberOf(anchor.slide_index);\n if (slide !== null) return `slide ${slide}`;\n return null;\n}\n\nfunction actorWords(envelope: Record<string, unknown>): string {\n const actor = isRecord(envelope.actor) ? envelope.actor : {};\n const name = stringOf(actor.name);\n let who: string;\n switch (actor.kind) {\n case 'self':\n who = 'You';\n break;\n case 'agent':\n who = name ?? 'An agent';\n break;\n case 'system':\n who = name ?? 'Athena';\n break;\n default:\n who = name ?? 'Someone';\n }\n const more = numberOf(envelope.more_actors) ?? 0;\n if (more <= 0) return who;\n return `${who} and ${more} ${more === 1 ? 'other' : 'others'}`;\n}\n\nfunction readChanges(value: unknown): SubscriptionWakeChange[] {\n if (!Array.isArray(value)) return [];\n return value.flatMap((entry) => {\n if (!isRecord(entry)) return [];\n const raw = entry.value;\n const scalar =\n typeof raw === 'string' || typeof raw === 'number' || typeof raw === 'boolean'\n ? String(raw)\n : null;\n return [{ place: subscriptionPlaceWords(entry.anchor), value: scalar }];\n });\n}\n\n/**\n * The delivery behind a thread message's `metadata.custom`, or `undefined`\n * when the message is not a subscription's delivery (or carries no\n * subscription id). Every other field is read leniently: a field of the wrong\n * shape reads as absent.\n */\nexport function readSubscriptionWakeEvent(\n custom: Record<string, unknown> | null | undefined\n): SubscriptionWakeEvent | undefined {\n const envelope = custom?.[SUBSCRIPTION_EVENT_KEY];\n if (!isRecord(envelope)) return undefined;\n const subscriptionId = stringOf(envelope.subscription_id);\n if (subscriptionId === null) return undefined;\n const comment = isRecord(envelope.comment) ? envelope.comment : null;\n const schedule = isRecord(envelope.schedule) ? envelope.schedule : null;\n const eventTypes = Array.isArray(envelope.event_types)\n ? envelope.event_types.filter((type): type is string => typeof type === 'string')\n : [];\n const subscribed = Array.isArray(envelope.subscribed)\n ? envelope.subscribed.flatMap((anchor) => {\n const words = subscriptionPlaceWords(anchor);\n return words ? [words] : [];\n })\n : [];\n return {\n subscriptionId,\n kind: envelope.kind === 'schedule' ? 'schedule' : 'event',\n assetTitle: stringOf(envelope.asset_title),\n eventTypes,\n eventCount: numberOf(envelope.event_count),\n actor: actorWords(envelope),\n changes: readChanges(envelope.changes),\n moreChanges: Math.max(0, numberOf(envelope.more_changes) ?? 0),\n subscribed,\n commentPlace: comment ? subscriptionPlaceWords(comment.anchor) : null,\n commentResolved: typeof comment?.resolved === 'boolean' ? comment.resolved : null,\n scheduleSetAt: schedule ? stringOf(schedule.set_at) : null,\n note: stringOf(envelope.note),\n runsLeft: numberOf(envelope.runs_left),\n deliveredAt: stringOf(envelope.delivered_at),\n };\n}\n\n/**\n * Whether a thread message is a subscription's delivery. Returns a primitive,\n * so it is safe as a `useAuiState` selector.\n */\nexport function isSubscriptionWakeMessage(\n custom: Record<string, unknown> | null | undefined\n): boolean {\n return readSubscriptionWakeEvent(custom) !== undefined;\n}\n\n/**\n * A value as the marker shows it: whitespace folded, cut at\n * {@link MAX_VALUE_CHARS}. A value of only whitespace is not empty (an empty\n * one is \"cleared\"), so it reads as a quoted space rather than as nothing.\n */\nfunction valueWords(value: string): string {\n const folded = value.replace(/\\s+/g, ' ').trim();\n if (folded === '') return '“ ”';\n return folded.length > MAX_VALUE_CHARS\n ? `${folded.slice(0, MAX_VALUE_CHARS - 1).trimEnd()}…`\n : folded;\n}\n\n/** \"a, b and c\" — items joined the way a sentence lists them, `last` before the last. */\nfunction joinList({ items, last }: { items: string[]; last: string }): string {\n if (items.length <= 1) return items.join('');\n return `${items.slice(0, -1).join(', ')}${last}${items.at(-1)}`;\n}\n\n/** One clause of the marker's line: its leading words, then the places it lists. */\ninterface Clause {\n lead: string;\n items: string[];\n}\n\n/**\n * The clauses after who did it, as one predicate: \"set B4 to Target and\n * commented on B7\". The clauses are listed \"a, b and c\". A lone clause lists\n * its own items the same way (\"changed B4 and B7\"); with several, each lists\n * its items with commas only, so the clauses' \"and\" is the only one.\n */\nfunction joinClauses(clauses: Clause[]): string {\n const itemLast = clauses.length === 1 ? ' and ' : ', ';\n return joinList({\n items: clauses.map(({ lead, items }) => `${lead}${joinList({ items, last: itemLast })}`),\n last: ' and ',\n });\n}\n\n/**\n * The changed places as clauses: \"set B4 to Target\", \"cleared B9\", \"changed\n * B7\" (no value read). At most three places are named; the others — and the\n * ones agora counted past what it sent — are one more clause, \"2 more\".\n */\nfunction changeClauses({\n changes,\n moreChanges,\n}: {\n changes: SubscriptionWakeChange[];\n moreChanges: number;\n}): Clause[] {\n const located = changes.filter(\n (change): change is { place: string; value: string | null } => change.place !== null\n );\n const shown = located.slice(0, MAX_SHOWN_PLACES);\n if (shown.length === 0) return [];\n const hidden = located.length - shown.length + moreChanges;\n const set = shown.filter((change) => change.value !== null && change.value !== '');\n const cleared = shown.filter((change) => change.value === '');\n const changed = shown.filter((change) => change.value === null);\n const clauses: Clause[] = [];\n if (set.length > 0) {\n clauses.push({\n lead: 'set ',\n items: set.map((change) => `${change.place} to ${valueWords(change.value ?? '')}`),\n });\n }\n if (cleared.length > 0) {\n clauses.push({ lead: 'cleared ', items: cleared.map((change) => change.place) });\n }\n if (changed.length > 0) {\n clauses.push({ lead: 'changed ', items: changed.map((change) => change.place) });\n }\n if (hidden > 0) clauses.push({ lead: `${hidden} more`, items: [] });\n return clauses;\n}\n\nfunction commentLead({ type, resolved }: { type: string; resolved: boolean | null }): string {\n if (type === COMMENT_CREATED) return 'commented on ';\n if (type === COMMENT_REPLIED) return 'replied to a comment on ';\n const verb = resolved === true ? 'resolved' : resolved === false ? 'reopened' : 'updated';\n return `${verb} a comment on `;\n}\n\n/** An event type without words of its own, in words: `asset.version.created` → \"Version created\". */\nfunction eventLabel(type: string): string {\n const words = type\n .replace(/^asset\\./, '')\n .replace(/[.\\s_-]+/g, ' ')\n .trim()\n .toLowerCase();\n return words ? `${words.charAt(0).toUpperCase()}${words.slice(1)}` : '—';\n}\n\n/**\n * One clause per kind of event the delivery carries, in the order agora lists\n * them (first seen first), so a batch that both changed cells and brought a\n * comment says both. A content change is its changed places, or \"edited\n * <asset>\" when none were located; changes count as one even when the types\n * leave the content change out. The envelope's comment is the batch's first\n * comment event's, so only the first comment clause names its place.\n */\nfunction eventClauses(event: SubscriptionWakeEvent): Clause[] {\n const asset = event.assetTitle ?? 'the asset';\n const changes = changeClauses({ changes: event.changes, moreChanges: event.moreChanges });\n const listed = event.eventTypes;\n const types = [\n ...new Set(\n listed.length === 0 || (changes.length > 0 && !listed.includes(CONTENT_CHANGED))\n ? [CONTENT_CHANGED, ...listed]\n : listed\n ),\n ];\n const firstComment = types.find((type) => COMMENT_EVENTS.has(type));\n const clauses = types.flatMap((type): Clause[] => {\n if (type === CONTENT_CHANGED) {\n return changes.length > 0 ? changes : [{ lead: 'edited ', items: [asset] }];\n }\n if (COMMENT_EVENTS.has(type)) {\n const where = type === firstComment && event.commentPlace ? event.commentPlace : asset;\n return [{ lead: commentLead({ type, resolved: event.commentResolved }), items: [where] }];\n }\n if (type === PRESENCE_JOINED) return [{ lead: 'opened ', items: [asset] }];\n if (type.startsWith(SLACK_PREFIX)) {\n return [{ lead: SLACK_WORDS[type] ?? 'had Slack activity', items: [] }];\n }\n return [{ lead: `triggered “${eventLabel(type)}” on `, items: [asset] }];\n });\n // Two Slack events of kinds without words of their own say the same thing once.\n const said = new Set<string>();\n return clauses.filter((clause) => {\n if (clause.items.length > 0) return true;\n if (said.has(clause.lead)) return false;\n said.add(clause.lead);\n return true;\n });\n}\n\n/** The day a check-in was set, as a person says it: \"today\", \"yesterday\", \"on Oct 8\". */\nfunction setOnWords({ setAt, now }: { setAt: string; now: Date }): string | null {\n const date = new Date(setAt);\n if (Number.isNaN(date.getTime())) return null;\n const midnight = (day: Date) => new Date(day.getFullYear(), day.getMonth(), day.getDate()).getTime();\n const days = Math.round((midnight(now) - midnight(date)) / (24 * 60 * 60 * 1000));\n if (days === 0) return 'today';\n if (days === 1) return 'yesterday';\n const sameYear = date.getFullYear() === now.getFullYear();\n return `on ${date.toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n ...(sameYear ? {} : { year: 'numeric' as const }),\n })}`;\n}\n\n/**\n * The marker's line: who did what, where — \"Brendon Geils set B4 to Target\",\n * \"Brendon Geils changed B4\" when agora read no value, \"Ana Lopez commented\n * on B7\", \"Brendon Geils set B4 to Target and commented on B7\" for a batch\n * that carried both — or, for a schedule, \"Scheduled check-in you set on\n * Oct 8\" (`now` decides \"today\" and \"yesterday\").\n */\nexport function subscriptionWakeHeadline({\n event,\n now = new Date(),\n}: {\n event: SubscriptionWakeEvent;\n now?: Date;\n}): string {\n if (event.kind === 'schedule') {\n const when = event.scheduleSetAt ? setOnWords({ setAt: event.scheduleSetAt, now }) : null;\n return when ? `Scheduled check-in you set ${when}` : 'Scheduled check-in';\n }\n return `${event.actor} ${joinClauses(eventClauses(event))}`;\n}\n\n/** \"99 runs left\", \"1 run left\", \"No runs left\". */\nfunction runsLeftWords(runsLeft: number): string {\n if (runsLeft <= 0) return 'No runs left';\n return `${runsLeft} ${runsLeft === 1 ? 'run' : 'runs'} left`;\n}\n\n/**\n * The line under it: \"Series A Investors · subscribed to B2:B11 · 99 runs\n * left · 3 events\" for an asset event; a check-in's note for a schedule.\n * `null` when there is nothing to add.\n */\nexport function subscriptionWakeDetail(event: SubscriptionWakeEvent): string | null {\n if (event.kind === 'schedule') {\n const parts = [\n event.note,\n event.runsLeft !== null && event.runsLeft > 0 ? runsLeftWords(event.runsLeft) : null,\n ].filter((part): part is string => part !== null);\n return parts.length > 0 ? parts.join(' · ') : null;\n }\n const shown = event.subscribed.slice(0, MAX_SHOWN_PLACES);\n const hidden = event.subscribed.length - shown.length;\n const subscribed =\n shown.length > 0\n ? `subscribed to ${shown.join(', ')}${hidden > 0 ? ` and ${hidden} more` : ''}`\n : null;\n const parts = [\n event.assetTitle,\n subscribed,\n event.runsLeft !== null ? runsLeftWords(event.runsLeft) : null,\n event.eventCount !== null && event.eventCount > 1 ? `${event.eventCount} events` : null,\n ].filter((part): part is string => part !== null);\n return parts.length > 0 ? parts.join(' · ') : null;\n}\n"],"names":["parts"],"mappings":"AAkBO,MAAM,yBAAyB;AAqCtC,MAAM,mBAAmB;AAEzB,MAAM,kBAAkB;AAExB,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;AACxB,MAAM,mBAAmB;AACzB,MAAM,kBAAkB;AACxB,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A8B,IAAI,KAAK;AAAA,EACvD;AACA,SAAO,GAAG,MAAM,KAAK,IAAI,YAAY,aAAa,KAAK,CAAC,CAAC;AAC3D;AAGA,SAAS,cAAc,UAA0B;AAC/C,MAAI,YAAY,EAAG,QAAO;AAC1B,SAAO,GAAG,QAAQ,IAAI,aAAa,IAAI,QAAQ,MAAM;AACvD;AAOO,SAAS,uBAAuB,OAA6C;AAClF,MAAI,MAAM,SAAS,YAAY;AAC7B,UAAMA,SAAQ;AAAA,MACZ,MAAM;AAAA,MACN,MAAM,aAAa,QAAQ,MAAM,WAAW,IAAI,cAAc,MAAM,QAAQ,IAAI;AAAA,IAAA,EAChF,OAAO,CAAC,SAAyB,SAAS,IAAI;AAChD,WAAOA,OAAM,SAAS,IAAIA,OAAM,KAAK,KAAK,IAAI;AAAA,EAChD;AACA,QAAM,QAAQ,MAAM,WAAW,MAAM,GAAG,gBAAgB;AACxD,QAAM,SAAS,MAAM,WAAW,SAAS,MAAM;AAC/C,QAAM,aACJ,MAAM,SAAS,IACX,iBAAiB,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,IAAI,QAAQ,MAAM,UAAU,EAAE,KAC3E;AACN,QAAM,QAAQ;AAAA,IACZ,MAAM;AAAA,IACN;AAAA,IACA,MAAM,aAAa,OAAO,cAAc,MAAM,QAAQ,IAAI;AAAA,IAC1D,MAAM,eAAe,QAAQ,MAAM,aAAa,IAAI,GAAG,MAAM,UAAU,YAAY;AAAA,EAAA,EACnF,OAAO,CAAC,SAAyB,SAAS,IAAI;AAChD,SAAO,MAAM,SAAS,IAAI,MAAM,KAAK,KAAK,IAAI;AAChD;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-extras.cjs","sources":["../../../../agent-runtime/src/thread-extras.ts"],"sourcesContent":["/**\n * The statewire hooks read the NEAREST aui thread's extras and throw when those\n * aren't statewire extras — which is the case inside nested read-only runtimes\n * (e.g. a transcript drawer) and on legacy (non-statewire) threads. Duck-type\n * the pieces the statewire components actually consume; a wider shape check\n * would silently hide live affordances if the library ever drops an unrelated\n * field.\n */\nexport function hasStatewireThreadExtras(extras: unknown): boolean {\n if (!extras || typeof extras !== 'object') return false;\n const candidate = extras as Record<string, unknown>;\n return (\n typeof candidate.sendCommand === 'function' &&\n Array.isArray(candidate.inputRequests) &&\n typeof candidate.runs === 'object' &&\n candidate.runs !== null\n );\n}\n\nexport interface StatewireFailedActions {\n retryFailed: (messageId: string) => void;\n discardFailed: (messageId: string) => void;\n}\n\n/** One projected failed run send: the message id plus the failure that\n * retained it (`runs.failed` entry, structurally). */\nexport interface StatewireFailedSendEntry {\n id: string;\n sendFailure: {\n fate: string;\n /**\n * Set on an `aborted` send that was never attempted because an earlier\n * send in the same detach batch WAS attempted and settled `lost`: the\n * library cannot know whether that predecessor ran, so the successor\n * must not be re-dispatched ahead of it (`StatewireClient.SendFailure`).\n */\n predecessorLost?: boolean;\n };\n}\n\n/** The failed-send lane surface the send-recovery controller consumes. */\nexport interface StatewireFailedSendLane {\n failed: readonly StatewireFailedSendEntry[];\n /** Re-dispatches the entry against the current thread — same message id,\n * re-anchored — and removes it from the lane. Throws for unknown ids. */\n retryFailed: (messageId: string) => void;\n}\n\nfunction isFailedSendEntry(value: unknown): value is StatewireFailedSendEntry {\n if (!value || typeof value !== 'object') return false;\n const entry = value as { id?: unknown; sendFailure?: { fate?: unknown } };\n return typeof entry.id === 'string' && typeof entry.sendFailure?.fate === 'string';\n}\n\n/**\n * The failed-send lane off a statewire thread's extras, or `null` when the\n * extras are not a statewire thread's (nested read-only runtimes, legacy\n * threads) — same duck-typing posture as {@link hasStatewireThreadExtras}.\n */\nexport function readStatewireFailedSendLane(extras: unknown): StatewireFailedSendLane | null {\n if (!extras || typeof extras !== 'object') return null;\n const candidate = extras as {\n runs?: { failed?: unknown };\n retryFailed?: unknown;\n };\n const failed = candidate.runs?.failed;\n if (!Array.isArray(failed) || typeof candidate.retryFailed !== 'function') return null;\n return {\n failed: failed.filter(isFailedSendEntry),\n retryFailed: candidate.retryFailed as StatewireFailedSendLane['retryFailed'],\n };\n}\n\n/** The failed-send lane actions off a statewire thread's extras, or throw. */\nexport function requireStatewireFailedActions(extras: unknown): StatewireFailedActions {\n if (!extras || typeof extras !== 'object') {\n throw new Error('Failed-send actions require a Statewire thread');\n }\n const candidate = extras as Record<string, unknown>;\n if (\n typeof candidate.retryFailed !== 'function' ||\n typeof candidate.discardFailed !== 'function'\n ) {\n throw new Error('Failed-send actions require a Statewire thread');\n }\n return candidate as unknown as StatewireFailedActions;\n}\n"],"names":[],"mappings":";;AAQO,SAAS,yBAAyB,QAA0B;AACjE,MAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO;AAClD,QAAM,YAAY;AAClB,SACE,OAAO,UAAU,gBAAgB,cACjC,MAAM,QAAQ,UAAU,aAAa,KACrC,OAAO,UAAU,SAAS,YAC1B,UAAU,SAAS;AAEvB;AA+BA,SAAS,kBAAkB,OAAmD;;AAC5E,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO;AAChD,QAAM,QAAQ;AACd,SAAO,OAAO,MAAM,OAAO,YAAY,SAAO,WAAM,gBAAN,mBAAmB,UAAS;AAC5E;AAOO,SAAS,4BAA4B,QAAiD;;AAC3F,MAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO;AAClD,QAAM,YAAY;AAIlB,QAAM,UAAS,eAAU,SAAV,mBAAgB;AAC/B,MAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,UAAU,gBAAgB,WAAY,QAAO;AAClF,SAAO;AAAA,IACL,QAAQ,OAAO,OAAO,iBAAiB;AAAA,IACvC,aAAa,UAAU;AAAA,EAAA;AAE3B;AAGO,SAAS,8BAA8B,QAAyC;AACrF,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AACA,QAAM,YAAY;AAClB,MACE,OAAO,UAAU,gBAAgB,cACjC,OAAO,UAAU,kBAAkB,YACnC;AACA,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AACA,SAAO;AACT;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-extras.js","sources":["../../../../agent-runtime/src/thread-extras.ts"],"sourcesContent":["/**\n * The statewire hooks read the NEAREST aui thread's extras and throw when those\n * aren't statewire extras — which is the case inside nested read-only runtimes\n * (e.g. a transcript drawer) and on legacy (non-statewire) threads. Duck-type\n * the pieces the statewire components actually consume; a wider shape check\n * would silently hide live affordances if the library ever drops an unrelated\n * field.\n */\nexport function hasStatewireThreadExtras(extras: unknown): boolean {\n if (!extras || typeof extras !== 'object') return false;\n const candidate = extras as Record<string, unknown>;\n return (\n typeof candidate.sendCommand === 'function' &&\n Array.isArray(candidate.inputRequests) &&\n typeof candidate.runs === 'object' &&\n candidate.runs !== null\n );\n}\n\nexport interface StatewireFailedActions {\n retryFailed: (messageId: string) => void;\n discardFailed: (messageId: string) => void;\n}\n\n/** One projected failed run send: the message id plus the failure that\n * retained it (`runs.failed` entry, structurally). */\nexport interface StatewireFailedSendEntry {\n id: string;\n sendFailure: {\n fate: string;\n /**\n * Set on an `aborted` send that was never attempted because an earlier\n * send in the same detach batch WAS attempted and settled `lost`: the\n * library cannot know whether that predecessor ran, so the successor\n * must not be re-dispatched ahead of it (`StatewireClient.SendFailure`).\n */\n predecessorLost?: boolean;\n };\n}\n\n/** The failed-send lane surface the send-recovery controller consumes. */\nexport interface StatewireFailedSendLane {\n failed: readonly StatewireFailedSendEntry[];\n /** Re-dispatches the entry against the current thread — same message id,\n * re-anchored — and removes it from the lane. Throws for unknown ids. */\n retryFailed: (messageId: string) => void;\n}\n\nfunction isFailedSendEntry(value: unknown): value is StatewireFailedSendEntry {\n if (!value || typeof value !== 'object') return false;\n const entry = value as { id?: unknown; sendFailure?: { fate?: unknown } };\n return typeof entry.id === 'string' && typeof entry.sendFailure?.fate === 'string';\n}\n\n/**\n * The failed-send lane off a statewire thread's extras, or `null` when the\n * extras are not a statewire thread's (nested read-only runtimes, legacy\n * threads) — same duck-typing posture as {@link hasStatewireThreadExtras}.\n */\nexport function readStatewireFailedSendLane(extras: unknown): StatewireFailedSendLane | null {\n if (!extras || typeof extras !== 'object') return null;\n const candidate = extras as {\n runs?: { failed?: unknown };\n retryFailed?: unknown;\n };\n const failed = candidate.runs?.failed;\n if (!Array.isArray(failed) || typeof candidate.retryFailed !== 'function') return null;\n return {\n failed: failed.filter(isFailedSendEntry),\n retryFailed: candidate.retryFailed as StatewireFailedSendLane['retryFailed'],\n };\n}\n\n/** The failed-send lane actions off a statewire thread's extras, or throw. */\nexport function requireStatewireFailedActions(extras: unknown): StatewireFailedActions {\n if (!extras || typeof extras !== 'object') {\n throw new Error('Failed-send actions require a Statewire thread');\n }\n const candidate = extras as Record<string, unknown>;\n if (\n typeof candidate.retryFailed !== 'function' ||\n typeof candidate.discardFailed !== 'function'\n ) {\n throw new Error('Failed-send actions require a Statewire thread');\n }\n return candidate as unknown as StatewireFailedActions;\n}\n"],"names":[],"mappings":"AAQO,SAAS,yBAAyB,QAA0B;AACjE,MAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO;AAClD,QAAM,YAAY;AAClB,SACE,OAAO,UAAU,gBAAgB,cACjC,MAAM,QAAQ,UAAU,aAAa,KACrC,OAAO,UAAU,SAAS,YAC1B,UAAU,SAAS;AAEvB;AA+BA,SAAS,kBAAkB,OAAmD;AAxCvE;AAyCL,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO;AAChD,QAAM,QAAQ;AACd,SAAO,OAAO,MAAM,OAAO,YAAY,SAAO,WAAM,gBAAN,mBAAmB,UAAS;AAC5E;AAOO,SAAS,4BAA4B,QAAiD;AAnDtF;AAoDL,MAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO;AAClD,QAAM,YAAY;AAIlB,QAAM,UAAS,eAAU,SAAV,mBAAgB;AAC/B,MAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,UAAU,gBAAgB,WAAY,QAAO;AAClF,SAAO;AAAA,IACL,QAAQ,OAAO,OAAO,iBAAiB;AAAA,IACvC,aAAa,UAAU;AAAA,EAAA;AAE3B;AAGO,SAAS,8BAA8B,QAAyC;AACrF,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AACA,QAAM,YAAY;AAClB,MACE,OAAO,UAAU,gBAAgB,cACjC,OAAO,UAAU,kBAAkB,YACnC;AACA,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AACA,SAAO;AACT;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-snapshot-cache.cjs","sources":["../../../../agent-runtime/src/thread-snapshot-cache.ts"],"sourcesContent":["import type { DeepAgentStreamValues } from './types';\n\n/**\n * Per-tab LRU of the last wire state seen per thread, so a switch back to a\n * recently-visited thread can mount with that snapshot instead of an empty\n * \"loading\" state (see `UseDeepAgentThreadOptions.snapshotCache`). Entries are\n * references into states the wire already produced — remembering is O(1) and\n * copies nothing; the bound is `maxThreads` retained states.\n */\nexport interface DeepAgentThreadSnapshotCache {\n /** Record the latest hydrated wire state for a thread. */\n remember(threadId: string, state: DeepAgentStreamValues): void;\n /** The freshest remembered state for a thread, or `undefined` when none is\n * held or the entry aged out. */\n take(threadId: string): DeepAgentStreamValues | undefined;\n /**\n * Drop a single thread's entry. Called when the server refuses\n * authorization for the thread — a refused thread must not warm-paint on\n * its next mount.\n */\n forget(threadId: string): void;\n /**\n * Drop every entry. Called when the acting identity changes — a snapshot\n * captured under one account must never seed a mount under another.\n */\n clear(): void;\n /**\n * Whether a fresh entry is held for the thread, without consuming or\n * touching it. Hosts read it at selection time to decide whether the switch\n * can paint from a seed (no loading treatment) or must cover the attach\n * wait. Optional so hand-rolled caches keep type-checking; the built-in\n * cache implements it.\n */\n peek?(threadId: string): boolean;\n}\n\n/** A write observed on the cache — the durable-mirror seam (see `onChange`). */\nexport type DeepAgentThreadSnapshotCacheChange =\n | { type: 'remember'; threadId: string; state: DeepAgentStreamValues; at: number }\n | { type: 'forget'; threadId: string }\n | { type: 'clear' };\n\nexport interface DeepAgentThreadSnapshotCacheOptions {\n /** Threads retained; the least-recently written entry evicts beyond this. */\n maxThreads?: number;\n /**\n * Entries older than this are dropped at read time. The seed's value is\n * \"the thread you just left\" — a snapshot from long ago is more likely to\n * flash content the server has since rewritten than to save a paint.\n */\n maxAgeMs?: number;\n /**\n * Observer of every write (`remember`, `forget`, `clear`). Hosts mirror\n * entries into durable storage from here so a reload can seed too; the\n * observer is never invoked for `restore`, which re-admits mirrored entries.\n * Exceptions are swallowed — a mirror fault must not break the wire path.\n */\n onChange?: (change: DeepAgentThreadSnapshotCacheChange) => void;\n /** Injectable clock (tests). */\n now?: () => number;\n}\n\n/** The built-in cache: the host contract plus the durable-mirror re-admission. */\nexport interface CreatedDeepAgentThreadSnapshotCache extends DeepAgentThreadSnapshotCache {\n peek(threadId: string): boolean;\n /**\n * Re-admit an entry captured earlier — a mirrored snapshot after a reload —\n * under its ORIGINAL capture time, so the age bound still applies. Never\n * displaces a fresher in-memory entry and never notifies `onChange`.\n */\n restore(threadId: string, state: DeepAgentStreamValues, at: number): void;\n}\n\nconst DEFAULT_MAX_THREADS = 30;\nconst DEFAULT_MAX_AGE_MS = 60 * 60 * 1000;\n\nexport function createDeepAgentThreadSnapshotCache(\n options: DeepAgentThreadSnapshotCacheOptions = {}\n): CreatedDeepAgentThreadSnapshotCache {\n const maxThreads = options.maxThreads ?? DEFAULT_MAX_THREADS;\n const maxAgeMs = options.maxAgeMs ?? DEFAULT_MAX_AGE_MS;\n const now = options.now ?? (() => Date.now());\n const notify = (change: DeepAgentThreadSnapshotCacheChange): void => {\n try {\n options.onChange?.(change);\n } catch {\n // The mirror is best-effort; the in-memory cache stays authoritative.\n }\n };\n // Map iteration order is insertion order; delete-then-set on every write\n // keeps the first key the least-recently written.\n const entries = new Map<string, { state: DeepAgentStreamValues; at: number }>();\n const evict = (): void => {\n while (entries.size > maxThreads) {\n const oldest = entries.keys().next().value;\n if (oldest === undefined) break;\n entries.delete(oldest);\n }\n };\n const fresh = (threadId: string): { state: DeepAgentStreamValues; at: number } | undefined => {\n const entry = entries.get(threadId);\n if (!entry) return undefined;\n if (now() - entry.at > maxAgeMs) {\n entries.delete(threadId);\n return undefined;\n }\n return entry;\n };\n return {\n remember(threadId, state) {\n const at = now();\n entries.delete(threadId);\n entries.set(threadId, { state, at });\n evict();\n notify({ type: 'remember', threadId, state, at });\n },\n take(threadId) {\n return fresh(threadId)?.state;\n },\n peek(threadId) {\n return fresh(threadId) !== undefined;\n },\n restore(threadId, state, at) {\n if (now() - at > maxAgeMs) return;\n const existing = entries.get(threadId);\n if (existing && existing.at >= at) return;\n entries.delete(threadId);\n entries.set(threadId, { state, at });\n evict();\n },\n forget(threadId) {\n entries.delete(threadId);\n notify({ type: 'forget', threadId });\n },\n clear() {\n entries.clear();\n notify({ type: 'clear' });\n },\n };\n}\n\n/**\n * Shape a remembered wire state for use as a mount's `initialState`.\n *\n * Messages/todos and the other app-owned keys seed as captured. The run lane\n * seeds by what the user left: a thread whose run was `running` when the\n * snapshot was taken seeds a running entry (see {@link seedRunsLane}) so the\n * switch back reads Running with a Stop control on its first frame — the same\n * frame `runs: []` would render as \"ready\" with a Send button over a thread the\n * server is still mid-run on. Every other live-lifecycle lane normalizes to\n * resting: a seeded input request could collect a decision the server may have\n * already resolved, so an `input-required` entry seeds as no run at all.\n * `__interrupt__` is dropped for the same reason, and so are `ptc_subagents`\n * (the live in-eval dispatch lane — a seeded \"running\" dispatch card under a\n * resting thread would render active with no eval behind it) and\n * `outOfBandRunActive` (the host's out-of-band-run-in-progress flag — seeding a\n * finished run's `true` would hide the composer until the attach corrected\n * it). Durable thread properties (`runConfig`, `sessionPersisted`, …) seed as\n * captured; the attach snapshot then replaces the whole seed.\n */\nexport function toThreadSnapshotSeed(state: DeepAgentStreamValues): DeepAgentStreamValues {\n const {\n __interrupt__: _interrupt,\n ptc_subagents: _ptcSubagents,\n outOfBandRunActive: _outOfBandRunActive,\n ...rest\n } = state;\n return { ...rest, runs: seedRunsLane(state.runs) };\n}\n\n/**\n * The run entries a seed carries.\n *\n * Only a `running` entry survives, and only its replicated identity and its\n * durable lanes: `runId` (the target of a Stop sent during the attach\n * round-trip — the live run's id if it is still running, and a refused stop\n * if it finished meanwhile), `epoch` (rides that Stop so a replayed stop cannot\n * end a later leg) and the `queue`/`steerQueue` entries (server lanes the tray\n * renders). The in-flight records rest until the snapshot: `dispatching` and\n * `nextDispatch` are batches the materializer would re-apply onto messages\n * that already contain them, `stopping` is a rewind the host may have\n * finished, `inputRequests` is a parked decision, and `error` is a failure the\n * next user run clears. An entry in any other status — `stopped`, `error`,\n * `input-required` — seeds as no run.\n */\nfunction seedRunsLane(\n runs: DeepAgentStreamValues['runs']\n): NonNullable<DeepAgentStreamValues['runs']> {\n const live = runs?.[0];\n if (live === undefined || live.status !== 'running') return [];\n return [\n {\n runId: live.runId,\n status: 'running',\n queue: live.queue,\n steerQueue: live.steerQueue,\n ...(live.epoch !== undefined && { epoch: live.epoch }),\n },\n ];\n}\n"],"names":[],"mappings":";;AAyEA,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB,KAAK,KAAK;AAE9B,SAAS,mCACd,UAA+C,IACV;AACrC,QAAM,aAAa,QAAQ,cAAc;AACzC,QAAM,WAAW,QAAQ,YAAY;AACrC,QAAM,MAAM,QAAQ,QAAQ,MAAM,KAAK,IAAA;AACvC,QAAM,SAAS,CAAC,WAAqD;;AACnE,QAAI;AACF,oBAAQ,aAAR,iCAAmB;AAAA,IACrB,QAAQ;AAAA,IAER;AAAA,EACF;AAGA,QAAM,8BAAc,IAAA;AACpB,QAAM,QAAQ,MAAY;AACxB,WAAO,QAAQ,OAAO,YAAY;AAChC,YAAM,SAAS,QAAQ,KAAA,EAAO,OAAO;AACrC,UAAI,WAAW,OAAW;AAC1B,cAAQ,OAAO,MAAM;A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AAS,aACP,MAC4C;AAC5C,QAAM,OAAO,6BAAO;AACpB,MAAI,SAAS,UAAa,KAAK,WAAW,kBAAkB,CAAA;AAC5D,SAAO;AAAA,IACL;AAAA,MACE,OAAO,KAAK;AAAA,MACZ,QAAQ;AAAA,MACR,OAAO,KAAK;AAAA,MACZ,YAAY,KAAK;AAAA,MACjB,GAAI,KAAK,UAAU,UAAa,EAAE,OAAO,KAAK,MAAA;AAAA,IAAM;AAAA,EACtD;AAEJ;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-snapshot-cache.js","sources":["../../../../agent-runtime/src/thread-snapshot-cache.ts"],"sourcesContent":["import type { DeepAgentStreamValues } from './types';\n\n/**\n * Per-tab LRU of the last wire state seen per thread, so a switch back to a\n * recently-visited thread can mount with that snapshot instead of an empty\n * \"loading\" state (see `UseDeepAgentThreadOptions.snapshotCache`). Entries are\n * references into states the wire already produced — remembering is O(1) and\n * copies nothing; the bound is `maxThreads` retained states.\n */\nexport interface DeepAgentThreadSnapshotCache {\n /** Record the latest hydrated wire state for a thread. */\n remember(threadId: string, state: DeepAgentStreamValues): void;\n /** The freshest remembered state for a thread, or `undefined` when none is\n * held or the entry aged out. */\n take(threadId: string): DeepAgentStreamValues | undefined;\n /**\n * Drop a single thread's entry. Called when the server refuses\n * authorization for the thread — a refused thread must not warm-paint on\n * its next mount.\n */\n forget(threadId: string): void;\n /**\n * Drop every entry. Called when the acting identity changes — a snapshot\n * captured under one account must never seed a mount under another.\n */\n clear(): void;\n /**\n * Whether a fresh entry is held for the thread, without consuming or\n * touching it. Hosts read it at selection time to decide whether the switch\n * can paint from a seed (no loading treatment) or must cover the attach\n * wait. Optional so hand-rolled caches keep type-checking; the built-in\n * cache implements it.\n */\n peek?(threadId: string): boolean;\n}\n\n/** A write observed on the cache — the durable-mirror seam (see `onChange`). */\nexport type DeepAgentThreadSnapshotCacheChange =\n | { type: 'remember'; threadId: string; state: DeepAgentStreamValues; at: number }\n | { type: 'forget'; threadId: string }\n | { type: 'clear' };\n\nexport interface DeepAgentThreadSnapshotCacheOptions {\n /** Threads retained; the least-recently written entry evicts beyond this. */\n maxThreads?: number;\n /**\n * Entries older than this are dropped at read time. The seed's value is\n * \"the thread you just left\" — a snapshot from long ago is more likely to\n * flash content the server has since rewritten than to save a paint.\n */\n maxAgeMs?: number;\n /**\n * Observer of every write (`remember`, `forget`, `clear`). Hosts mirror\n * entries into durable storage from here so a reload can seed too; the\n * observer is never invoked for `restore`, which re-admits mirrored entries.\n * Exceptions are swallowed — a mirror fault must not break the wire path.\n */\n onChange?: (change: DeepAgentThreadSnapshotCacheChange) => void;\n /** Injectable clock (tests). */\n now?: () => number;\n}\n\n/** The built-in cache: the host contract plus the durable-mirror re-admission. */\nexport interface CreatedDeepAgentThreadSnapshotCache extends DeepAgentThreadSnapshotCache {\n peek(threadId: string): boolean;\n /**\n * Re-admit an entry captured earlier — a mirrored snapshot after a reload —\n * under its ORIGINAL capture time, so the age bound still applies. Never\n * displaces a fresher in-memory entry and never notifies `onChange`.\n */\n restore(threadId: string, state: DeepAgentStreamValues, at: number): void;\n}\n\nconst DEFAULT_MAX_THREADS = 30;\nconst DEFAULT_MAX_AGE_MS = 60 * 60 * 1000;\n\nexport function createDeepAgentThreadSnapshotCache(\n options: DeepAgentThreadSnapshotCacheOptions = {}\n): CreatedDeepAgentThreadSnapshotCache {\n const maxThreads = options.maxThreads ?? DEFAULT_MAX_THREADS;\n const maxAgeMs = options.maxAgeMs ?? DEFAULT_MAX_AGE_MS;\n const now = options.now ?? (() => Date.now());\n const notify = (change: DeepAgentThreadSnapshotCacheChange): void => {\n try {\n options.onChange?.(change);\n } catch {\n // The mirror is best-effort; the in-memory cache stays authoritative.\n }\n };\n // Map iteration order is insertion order; delete-then-set on every write\n // keeps the first key the least-recently written.\n const entries = new Map<string, { state: DeepAgentStreamValues; at: number }>();\n const evict = (): void => {\n while (entries.size > maxThreads) {\n const oldest = entries.keys().next().value;\n if (oldest === undefined) break;\n entries.delete(oldest);\n }\n };\n const fresh = (threadId: string): { state: DeepAgentStreamValues; at: number } | undefined => {\n const entry = entries.get(threadId);\n if (!entry) return undefined;\n if (now() - entry.at > maxAgeMs) {\n entries.delete(threadId);\n return undefined;\n }\n return entry;\n };\n return {\n remember(threadId, state) {\n const at = now();\n entries.delete(threadId);\n entries.set(threadId, { state, at });\n evict();\n notify({ type: 'remember', threadId, state, at });\n },\n take(threadId) {\n return fresh(threadId)?.state;\n },\n peek(threadId) {\n return fresh(threadId) !== undefined;\n },\n restore(threadId, state, at) {\n if (now() - at > maxAgeMs) return;\n const existing = entries.get(threadId);\n if (existing && existing.at >= at) return;\n entries.delete(threadId);\n entries.set(threadId, { state, at });\n evict();\n },\n forget(threadId) {\n entries.delete(threadId);\n notify({ type: 'forget', threadId });\n },\n clear() {\n entries.clear();\n notify({ type: 'clear' });\n },\n };\n}\n\n/**\n * Shape a remembered wire state for use as a mount's `initialState`.\n *\n * Messages/todos and the other app-owned keys seed as captured. The run lane\n * seeds by what the user left: a thread whose run was `running` when the\n * snapshot was taken seeds a running entry (see {@link seedRunsLane}) so the\n * switch back reads Running with a Stop control on its first frame — the same\n * frame `runs: []` would render as \"ready\" with a Send button over a thread the\n * server is still mid-run on. Every other live-lifecycle lane normalizes to\n * resting: a seeded input request could collect a decision the server may have\n * already resolved, so an `input-required` entry seeds as no run at all.\n * `__interrupt__` is dropped for the same reason, and so are `ptc_subagents`\n * (the live in-eval dispatch lane — a seeded \"running\" dispatch card under a\n * resting thread would render active with no eval behind it) and\n * `outOfBandRunActive` (the host's out-of-band-run-in-progress flag — seeding a\n * finished run's `true` would hide the composer until the attach corrected\n * it). Durable thread properties (`runConfig`, `sessionPersisted`, …) seed as\n * captured; the attach snapshot then replaces the whole seed.\n */\nexport function toThreadSnapshotSeed(state: DeepAgentStreamValues): DeepAgentStreamValues {\n const {\n __interrupt__: _interrupt,\n ptc_subagents: _ptcSubagents,\n outOfBandRunActive: _outOfBandRunActive,\n ...rest\n } = state;\n return { ...rest, runs: seedRunsLane(state.runs) };\n}\n\n/**\n * The run entries a seed carries.\n *\n * Only a `running` entry survives, and only its replicated identity and its\n * durable lanes: `runId` (the target of a Stop sent during the attach\n * round-trip — the live run's id if it is still running, and a refused stop\n * if it finished meanwhile), `epoch` (rides that Stop so a replayed stop cannot\n * end a later leg) and the `queue`/`steerQueue` entries (server lanes the tray\n * renders). The in-flight records rest until the snapshot: `dispatching` and\n * `nextDispatch` are batches the materializer would re-apply onto messages\n * that already contain them, `stopping` is a rewind the host may have\n * finished, `inputRequests` is a parked decision, and `error` is a failure the\n * next user run clears. An entry in any other status — `stopped`, `error`,\n * `input-required` — seeds as no run.\n */\nfunction seedRunsLane(\n runs: DeepAgentStreamValues['runs']\n): NonNullable<DeepAgentStreamValues['runs']> {\n const live = runs?.[0];\n if (live === undefined || live.status !== 'running') return [];\n return [\n {\n runId: live.runId,\n status: 'running',\n queue: live.queue,\n steerQueue: live.steerQueue,\n ...(live.epoch !== undefined && { epoch: live.epoch }),\n },\n ];\n}\n"],"names":[],"mappings":"AAyEA,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB,KAAK,KAAK;AAE9B,SAAS,mCACd,UAA+C,IACV;AACrC,QAAM,aAAa,QAAQ,cAAc;AACzC,QAAM,WAAW,QAAQ,YAAY;AACrC,QAAM,MAAM,QAAQ,QAAQ,MAAM,KAAK,IAAA;AACvC,QAAM,SAAS,CAAC,WAAqD;AATvE;AAUI,QAAI;AACF,oBAAQ,aAAR,iCAAmB;AAAA,IACrB,QAAQ;AAAA,IAER;AAAA,EACF;AAGA,QAAM,8BAAc,IAAA;AACpB,QAAM,QAAQ,MAAY;AACxB,WAAO,QAAQ,OAAO,YAAY;AAChC,YAAM,SAAS,QAAQ,KAAA,EAAO,OAAO;AACrC,UAAI,WAAW,OAAW;AAC1B,cAAQ,OAAO,MAAM;AAAA,IACvB;AAAA,EACF;AACA,QAAM,QAAQ,CAAC,aAA+E;AAC5F,UAAM,QAAQ,Q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a,KAAK,WAAW,kBAAkB,CAAA;AAC5D,SAAO;AAAA,IACL;AAAA,MACE,OAAO,KAAK;AAAA,MACZ,QAAQ;AAAA,MACR,OAAO,KAAK;AAAA,MACZ,YAAY,KAAK;AAAA,MACjB,GAAI,KAAK,UAAU,UAAa,EAAE,OAAO,KAAK,MAAA;AAAA,IAAM;AAAA,EACtD;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-status.cjs","sources":["../../../../agent-runtime/src/thread-status.ts"],"sourcesContent":["import type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { useAuiState } from '@assistant-ui/store';\nimport { createContext, useContext } from 'react';\nimport type { DeepAgentConnectionState } from './types';\n\nexport type DeepAgentThreadStatus = StatewireThread.ThreadStatus;\n\n/**\n * Runtime-scoped thread status, as the library presents it: `\"loading\"` /\n * `\"ready\"` / the run's status replicated by the host, with a mid-run\n * connection loss presented as `\"evicted\"` (server-update pod drain) or\n * `\"disconnected\"` instead of `\"running\"`. Throws outside a statewire aui\n * provider, matching react-statewire 0.13's removed `useStatewireThreadStatus`.\n */\nexport function useDeepAgentThreadStatus(): DeepAgentThreadStatus {\n return useAuiState((s) => {\n const status = (s.thread.extras as Partial<StatewireThread.Extras> | undefined)?.status;\n if (status === undefined) {\n throw new Error('useDeepAgentThreadStatus requires a statewire thread');\n }\n return status;\n });\n}\n\n/** The two presented statuses that hide a live run behind a channel problem. */\nexport type DeepAgentStaleRunReason = Extract<DeepAgentThreadStatus, 'disconnected' | 'evicted'>;\n\n/** A first connection attempt can present an optimistic run without a stale warning. */\nexport function resolveStaleRunReason({\n status,\n connection,\n}: {\n status: DeepAgentThreadStatus;\n connection?: DeepAgentConnectionState | null;\n}): DeepAgentStaleRunReason | null {\n if (status === 'evicted') return 'evicted';\n if (status !== 'disconnected') return null;\n if (connection?.status === 'connecting') {\n return null;\n }\n return 'disconnected';\n}\n\n/**\n * Whether the thread has a live run to present — the composer's Running bar\n * and its Stop/Queue slot.\n *\n * The library derives `thread.isRunning` from the PRESENTED status, so a run\n * that is live on the host but sits behind a channel that has not connected\n * yet reads as not running. Behind a first dial that is exactly the run the\n * client just seeded — switching back to a thread that was running when you\n * left, or a brand-new chat's optimistic first send — and nothing is stale:\n * the channel is still attaching. Hiding the run for that round-trip flashes\n * Ready and a Send button before Running comes back. A run behind a reconnect\n * or an eviction is presented by the stale treatment (`resolveStaleRunReason`),\n * never as live.\n */\nexport function resolveRunLive({\n status,\n connection,\n}: {\n status: DeepAgentThreadStatus;\n connection?: DeepAgentConnectionState | null;\n}): boolean {\n if (status === 'running') return true;\n if (status !== 'disconnected') return false;\n return resolveStaleRunReason({ status, connection }) === null;\n}\n\n/**\n * `thread.isRunning` for a `useAuiState` selector, folded through\n * `resolveRunLive` when the thread is a statewire thread. A thread without a\n * statewire status (another runtime, a test stub) keeps the library's answer.\n */\nexport function readRunLive(\n thread: { isRunning: boolean; extras?: unknown },\n connection: DeepAgentConnectionState | null,\n): boolean {\n const status = (thread.extras as Partial<StatewireThread.Extras> | undefined)?.status;\n return status === undefined ? thread.isRunning : resolveRunLive({ status, connection });\n}\n\n/**\n * The active thread's channel, for `readRunLive`'s first-dial verdict. Each\n * host provides it from its own lifecycle state (`AthenaProvider`, the\n * Chrome extension's lifecycle provider); `null` means \"no channel known\",\n * which folds a `disconnected` status as stale.\n */\nexport const DeepAgentConnectionContext = createContext<DeepAgentConnectionState | null>(null);\n\nexport function useDeepAgentConnection(): DeepAgentConnectionState | null {\n return useContext(DeepAgentConnectionContext);\n}\n"],"names":["useAuiState","createContext","useContext"],"mappings":";;;;AAcO,SAAS,2BAAkD;AAChE,SAAOA,MAAAA,YAAY,CAAC,MAAM;;AACxB,UAAM,UAAU,OAAE,OAAO,WAAT,mBAAiE;AACjF,QAAI,WAAW,QAAW;AACxB,YAAM,IAAI,MAAM,sDAAsD;AAAA,IACxE;AACA,WAAO;AAAA,EACT,CAAC;AACH;AAMO,SAAS,sBAAsB;AAAA,EACpC;AAAA,EACA;AACF,GAGmC;AACjC,MAAI,WAAW,UAAW,QAAO;AACjC,MAAI,WAAW,eAAgB,QAAO;AACtC,OAAI,yCAAY,YAAW,cAAc;AACvC,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAgBO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AACF,GAGY;AACV,MAAI,WAAW,UAAW,QAAO;AACjC,MAAI,WAAW,eAAgB,QAAO;AACtC,SAAO,sBAAsB,EAAE,QAAQ,WAAA,CAAY,MAAM;AAC3D;AAOO,SAAS,YACd,QACA,YACS;;AACT,QAAM,UAAU,YAAO,WAAP,mBAA+D;AAC/E,SAAO,WAAW,SAAY,OAAO,YAAY,eAAe,EAAE,QAAQ,YAAY;AACxF;AAQO,MAAM,6BAA6BC,MAAAA,cAA+C,IAAI;AAEtF,SAAS,yBAA0D;AACxE,SAAOC,MAAAA,WAAW,0BAA0B;AAC9C;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-status.js","sources":["../../../../agent-runtime/src/thread-status.ts"],"sourcesContent":["import type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { useAuiState } from '@assistant-ui/store';\nimport { createContext, useContext } from 'react';\nimport type { DeepAgentConnectionState } from './types';\n\nexport type DeepAgentThreadStatus = StatewireThread.ThreadStatus;\n\n/**\n * Runtime-scoped thread status, as the library presents it: `\"loading\"` /\n * `\"ready\"` / the run's status replicated by the host, with a mid-run\n * connection loss presented as `\"evicted\"` (server-update pod drain) or\n * `\"disconnected\"` instead of `\"running\"`. Throws outside a statewire aui\n * provider, matching react-statewire 0.13's removed `useStatewireThreadStatus`.\n */\nexport function useDeepAgentThreadStatus(): DeepAgentThreadStatus {\n return useAuiState((s) => {\n const status = (s.thread.extras as Partial<StatewireThread.Extras> | undefined)?.status;\n if (status === undefined) {\n throw new Error('useDeepAgentThreadStatus requires a statewire thread');\n }\n return status;\n });\n}\n\n/** The two presented statuses that hide a live run behind a channel problem. */\nexport type DeepAgentStaleRunReason = Extract<DeepAgentThreadStatus, 'disconnected' | 'evicted'>;\n\n/** A first connection attempt can present an optimistic run without a stale warning. */\nexport function resolveStaleRunReason({\n status,\n connection,\n}: {\n status: DeepAgentThreadStatus;\n connection?: DeepAgentConnectionState | null;\n}): DeepAgentStaleRunReason | null {\n if (status === 'evicted') return 'evicted';\n if (status !== 'disconnected') return null;\n if (connection?.status === 'connecting') {\n return null;\n }\n return 'disconnected';\n}\n\n/**\n * Whether the thread has a live run to present — the composer's Running bar\n * and its Stop/Queue slot.\n *\n * The library derives `thread.isRunning` from the PRESENTED status, so a run\n * that is live on the host but sits behind a channel that has not connected\n * yet reads as not running. Behind a first dial that is exactly the run the\n * client just seeded — switching back to a thread that was running when you\n * left, or a brand-new chat's optimistic first send — and nothing is stale:\n * the channel is still attaching. Hiding the run for that round-trip flashes\n * Ready and a Send button before Running comes back. A run behind a reconnect\n * or an eviction is presented by the stale treatment (`resolveStaleRunReason`),\n * never as live.\n */\nexport function resolveRunLive({\n status,\n connection,\n}: {\n status: DeepAgentThreadStatus;\n connection?: DeepAgentConnectionState | null;\n}): boolean {\n if (status === 'running') return true;\n if (status !== 'disconnected') return false;\n return resolveStaleRunReason({ status, connection }) === null;\n}\n\n/**\n * `thread.isRunning` for a `useAuiState` selector, folded through\n * `resolveRunLive` when the thread is a statewire thread. A thread without a\n * statewire status (another runtime, a test stub) keeps the library's answer.\n */\nexport function readRunLive(\n thread: { isRunning: boolean; extras?: unknown },\n connection: DeepAgentConnectionState | null,\n): boolean {\n const status = (thread.extras as Partial<StatewireThread.Extras> | undefined)?.status;\n return status === undefined ? thread.isRunning : resolveRunLive({ status, connection });\n}\n\n/**\n * The active thread's channel, for `readRunLive`'s first-dial verdict. Each\n * host provides it from its own lifecycle state (`AthenaProvider`, the\n * Chrome extension's lifecycle provider); `null` means \"no channel known\",\n * which folds a `disconnected` status as stale.\n */\nexport const DeepAgentConnectionContext = createContext<DeepAgentConnectionState | null>(null);\n\nexport function useDeepAgentConnection(): DeepAgentConnectionState | null {\n return useContext(DeepAgentConnectionContext);\n}\n"],"names":[],"mappings":";;AAcO,SAAS,2BAAkD;AAChE,SAAO,YAAY,CAAC,MAAM;;AACxB,UAAM,UAAU,OAAE,OAAO,WAAT,mBAAiE;AACjF,QAAI,WAAW,QAAW;AACxB,YAAM,IAAI,MAAM,sDAAsD;AAAA,IACxE;AACA,WAAO;AAAA,EACT,CAAC;AACH;AAMO,SAAS,sBAAsB;AAAA,EACpC;AAAA,EACA;AACF,GAGmC;AACjC,MAAI,WAAW,UAAW,QAAO;AACjC,MAAI,WAAW,eAAgB,QAAO;AACtC,OAAI,yCAAY,YAAW,cAAc;AACvC,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAgBO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AACF,GAGY;AACV,MAAI,WAAW,UAAW,QAAO;AACjC,MAAI,WAAW,eAAgB,QAAO;AACtC,SAAO,sBAAsB,EAAE,QAAQ,WAAA,CAAY,MAAM;AAC3D;AAOO,SAAS,YACd,QACA,YACS;;AACT,QAAM,UAAU,YAAO,WAAP,mBAA+D;AAC/E,SAAO,WAAW,SAAY,OAAO,YAAY,eAAe,EAAE,QAAQ,YAAY;AACxF;AAQO,MAAM,6BAA6B,cAA+C,IAAI;AAEtF,SAAS,yBAA0D;AACxE,SAAO,WAAW,0BAA0B;AAC9C;"}
|