@athenaintel/react 0.57.2 → 0.59.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 +759 -9
- package/dist/agent-runtime/src/addressed-agents.cjs +16 -0
- package/dist/agent-runtime/src/addressed-agents.cjs.map +1 -0
- package/dist/agent-runtime/src/addressed-agents.d.ts +30 -0
- package/dist/agent-runtime/src/addressed-agents.js +16 -0
- package/dist/agent-runtime/src/addressed-agents.js.map +1 -0
- package/dist/agent-runtime/src/answer-label.cjs +4 -3
- package/dist/agent-runtime/src/answer-label.cjs.map +1 -1
- package/dist/agent-runtime/src/answer-label.d.ts +13 -6
- package/dist/agent-runtime/src/answer-label.js +4 -3
- package/dist/agent-runtime/src/answer-label.js.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +1 -1
- package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-entry.cjs +101 -0
- package/dist/agent-runtime/src/chat-outbox-entry.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-entry.d.ts +99 -0
- package/dist/agent-runtime/src/chat-outbox-entry.js +101 -0
- package/dist/agent-runtime/src/chat-outbox-entry.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.cjs +252 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.d.ts +96 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.js +252 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-policy.cjs +30 -0
- package/dist/agent-runtime/src/chat-outbox-policy.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-policy.d.ts +42 -0
- package/dist/agent-runtime/src/chat-outbox-policy.js +30 -0
- package/dist/agent-runtime/src/chat-outbox-policy.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-storage.cjs +306 -0
- package/dist/agent-runtime/src/chat-outbox-storage.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-storage.d.ts +194 -0
- package/dist/agent-runtime/src/chat-outbox-storage.js +306 -0
- package/dist/agent-runtime/src/chat-outbox-storage.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-thread.cjs +21 -94
- package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-thread.d.ts +22 -18
- package/dist/agent-runtime/src/chat-outbox-thread.js +21 -94
- package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -1
- package/dist/agent-runtime/src/chat-outbox.cjs +492 -547
- package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox.d.ts +110 -142
- package/dist/agent-runtime/src/chat-outbox.js +492 -547
- package/dist/agent-runtime/src/chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
- package/dist/agent-runtime/src/composer-markdown.d.ts +1 -1
- package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +8 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
- package/dist/agent-runtime/src/dictation-preferences.d.ts +356 -0
- package/dist/agent-runtime/src/dictation-record.d.ts +279 -0
- package/dist/agent-runtime/src/dictation-session.d.ts +106 -7
- package/dist/agent-runtime/src/dictation-snippets.d.ts +9 -0
- package/dist/agent-runtime/src/dictation-transfer.d.ts +142 -0
- package/dist/agent-runtime/src/edit-command.cjs.map +1 -1
- package/dist/agent-runtime/src/edit-command.d.ts +1 -1
- package/dist/agent-runtime/src/edit-command.js.map +1 -1
- package/dist/agent-runtime/src/errors.cjs +1 -0
- package/dist/agent-runtime/src/errors.cjs.map +1 -1
- package/dist/agent-runtime/src/errors.js +1 -0
- package/dist/agent-runtime/src/errors.js.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs +24 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +3 -3
- package/dist/agent-runtime/src/generated/runconfig-contract.js +24 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/agent-runtime/src/index.d.ts +14 -8
- package/dist/agent-runtime/src/lane-follow.cjs +289 -0
- package/dist/agent-runtime/src/lane-follow.cjs.map +1 -0
- package/dist/agent-runtime/src/lane-follow.js +289 -0
- package/dist/agent-runtime/src/lane-follow.js.map +1 -0
- package/dist/agent-runtime/src/lane-images.cjs +387 -0
- package/dist/agent-runtime/src/lane-images.cjs.map +1 -0
- package/dist/agent-runtime/src/lane-images.js +387 -0
- package/dist/agent-runtime/src/lane-images.js.map +1 -0
- package/dist/agent-runtime/src/message-window.js +1 -1
- package/dist/agent-runtime/src/messages.cjs +19 -1
- package/dist/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.d.ts +8 -0
- package/dist/agent-runtime/src/messages.js +21 -3
- package/dist/agent-runtime/src/messages.js.map +1 -1
- package/dist/agent-runtime/src/named-agents.cjs +301 -0
- package/dist/agent-runtime/src/named-agents.cjs.map +1 -0
- package/dist/agent-runtime/src/named-agents.d.ts +246 -0
- package/dist/agent-runtime/src/named-agents.js +301 -0
- package/dist/agent-runtime/src/named-agents.js.map +1 -0
- package/dist/agent-runtime/src/offline-status.cjs.map +1 -1
- package/dist/agent-runtime/src/offline-status.d.ts +66 -2
- package/dist/agent-runtime/src/offline-status.js.map +1 -1
- package/dist/agent-runtime/src/ptc-subcalls.cjs +41 -0
- package/dist/agent-runtime/src/ptc-subcalls.cjs.map +1 -0
- package/dist/agent-runtime/src/ptc-subcalls.js +41 -0
- package/dist/agent-runtime/src/ptc-subcalls.js.map +1 -0
- package/dist/agent-runtime/src/queue.cjs +2 -2
- package/dist/agent-runtime/src/queue.cjs.map +1 -1
- package/dist/agent-runtime/src/queue.d.ts +20 -25
- package/dist/agent-runtime/src/queue.js +2 -2
- package/dist/agent-runtime/src/queue.js.map +1 -1
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +314 -84
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
- package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +137 -40
- package/dist/agent-runtime/src/quota-safe-local-storage-session.js +318 -88
- package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
- package/dist/agent-runtime/src/run-send.cjs +54 -0
- package/dist/agent-runtime/src/run-send.cjs.map +1 -0
- package/dist/agent-runtime/src/run-send.d.ts +51 -0
- package/dist/agent-runtime/src/run-send.js +54 -0
- package/dist/agent-runtime/src/run-send.js.map +1 -0
- package/dist/agent-runtime/src/running-tool-placeholder.cjs +6 -0
- package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -1
- package/dist/agent-runtime/src/running-tool-placeholder.js +6 -0
- package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -1
- package/dist/agent-runtime/src/runtime.d.ts +9 -5
- package/dist/agent-runtime/src/sealed-idb.cjs +64 -0
- package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -1
- package/dist/agent-runtime/src/sealed-idb.d.ts +16 -0
- package/dist/agent-runtime/src/sealed-idb.js +64 -0
- package/dist/agent-runtime/src/sealed-idb.js.map +1 -1
- package/dist/agent-runtime/src/send-recovery.cjs +90 -118
- package/dist/agent-runtime/src/send-recovery.cjs.map +1 -1
- package/dist/agent-runtime/src/send-recovery.d.ts +25 -29
- package/dist/agent-runtime/src/send-recovery.js +90 -118
- package/dist/agent-runtime/src/send-recovery.js.map +1 -1
- package/dist/agent-runtime/src/statewire-diagnostics.d.ts +4 -1
- package/dist/agent-runtime/src/statewire-held-sends.cjs +191 -0
- package/dist/agent-runtime/src/statewire-held-sends.cjs.map +1 -0
- package/dist/agent-runtime/src/statewire-held-sends.d.ts +119 -0
- package/dist/agent-runtime/src/statewire-held-sends.js +191 -0
- package/dist/agent-runtime/src/statewire-held-sends.js.map +1 -0
- package/dist/agent-runtime/src/statewire-state.cjs +4 -0
- package/dist/agent-runtime/src/statewire-state.cjs.map +1 -1
- package/dist/agent-runtime/src/statewire-state.js +4 -0
- package/dist/agent-runtime/src/statewire-state.js.map +1 -1
- package/dist/agent-runtime/src/statewire-transport.cjs +8 -2
- package/dist/agent-runtime/src/statewire-transport.cjs.map +1 -1
- package/dist/agent-runtime/src/statewire-transport.d.ts +14 -5
- package/dist/agent-runtime/src/statewire-transport.js +8 -2
- package/dist/agent-runtime/src/statewire-transport.js.map +1 -1
- package/dist/agent-runtime/src/subagent-transcripts.cjs +1 -23
- package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -1
- package/dist/agent-runtime/src/subagent-transcripts.js +3 -25
- package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -1
- package/dist/agent-runtime/src/subagents.cjs +22 -29
- package/dist/agent-runtime/src/subagents.cjs.map +1 -1
- package/dist/agent-runtime/src/subagents.js +23 -30
- package/dist/agent-runtime/src/subagents.js.map +1 -1
- package/dist/agent-runtime/src/thread-extras.cjs +27 -19
- package/dist/agent-runtime/src/thread-extras.cjs.map +1 -1
- package/dist/agent-runtime/src/thread-extras.d.ts +19 -6
- package/dist/agent-runtime/src/thread-extras.js +27 -19
- package/dist/agent-runtime/src/thread-extras.js.map +1 -1
- package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +8 -8
- package/dist/agent-runtime/src/tool-metadata.cjs +12 -0
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.js +12 -0
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/agent-runtime/src/tool-names.cjs +21 -0
- package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-names.d.ts +8 -0
- package/dist/agent-runtime/src/tool-names.js +21 -0
- package/dist/agent-runtime/src/tool-names.js.map +1 -1
- package/dist/agent-runtime/src/typed-interrupt-kinds.cjs +247 -0
- package/dist/agent-runtime/src/typed-interrupt-kinds.cjs.map +1 -0
- package/dist/agent-runtime/src/typed-interrupt-kinds.d.ts +173 -0
- package/dist/agent-runtime/src/typed-interrupt-kinds.js +247 -0
- package/dist/agent-runtime/src/typed-interrupt-kinds.js.map +1 -0
- package/dist/agent-runtime/src/typed-interrupts.cjs +48 -0
- package/dist/agent-runtime/src/typed-interrupts.cjs.map +1 -0
- package/dist/agent-runtime/src/typed-interrupts.d.ts +75 -0
- package/dist/agent-runtime/src/typed-interrupts.js +48 -0
- package/dist/agent-runtime/src/typed-interrupts.js.map +1 -0
- package/dist/agent-runtime/src/types.d.ts +1 -1
- package/dist/agent-runtime/src/use-conversation-list.cjs +1 -0
- package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
- package/dist/agent-runtime/src/use-conversation-list.d.ts +7 -0
- package/dist/agent-runtime/src/use-conversation-list.js +1 -0
- package/dist/agent-runtime/src/use-conversation-list.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +46 -29
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +14 -22
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +46 -29
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +78 -14
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +34 -7
- package/dist/agent-runtime/src/use-deep-agent-runtime.js +79 -15
- package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs +16 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +7 -2
- package/dist/agent-runtime/src/use-deep-agent-thread.js +16 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs +30 -4
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +22 -4
- package/dist/agent-runtime/src/use-deep-agent-voice.js +30 -4
- package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
- package/dist/agent-runtime/src/withdrawn-turns.d.ts +5 -4
- package/dist/agent-runtime/src/word-device-fit.d.ts +174 -0
- package/dist/agent-runtime/src/work-in.d.ts +127 -0
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.d.ts +6 -1
- package/dist/assets/AthenaAssetEmbed.js.map +1 -1
- package/dist/assets/asset-panel-store.cjs +13 -5
- package/dist/assets/asset-panel-store.cjs.map +1 -1
- package/dist/assets/asset-panel-store.d.ts +33 -2
- package/dist/assets/asset-panel-store.js +13 -5
- package/dist/assets/asset-panel-store.js.map +1 -1
- package/dist/auth/AthenaCredentialSourceContext.cjs +11 -0
- package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
- package/dist/auth/AthenaCredentialSourceContext.d.ts +6 -0
- package/dist/auth/AthenaCredentialSourceContext.js +11 -0
- package/dist/auth/AthenaCredentialSourceContext.js.map +1 -1
- package/dist/auth/account-identity.cjs +13 -2
- package/dist/auth/account-identity.cjs.map +1 -1
- package/dist/auth/account-identity.d.ts +9 -0
- package/dist/auth/account-identity.js +13 -2
- package/dist/auth/account-identity.js.map +1 -1
- package/dist/auth/credential-source.cjs +20 -4
- package/dist/auth/credential-source.cjs.map +1 -1
- package/dist/auth/credential-source.d.ts +9 -0
- package/dist/auth/credential-source.js +20 -4
- package/dist/auth/credential-source.js.map +1 -1
- package/dist/catalog/chat-pickers.cjs +31 -0
- package/dist/catalog/chat-pickers.cjs.map +1 -1
- package/dist/catalog/chat-pickers.d.ts +17 -0
- package/dist/catalog/chat-pickers.js +33 -2
- package/dist/catalog/chat-pickers.js.map +1 -1
- package/dist/catalog/runtime-catalog.cjs +63 -3
- package/dist/catalog/runtime-catalog.cjs.map +1 -1
- package/dist/catalog/runtime-catalog.d.ts +63 -3
- package/dist/catalog/runtime-catalog.js +64 -4
- package/dist/catalog/runtime-catalog.js.map +1 -1
- package/dist/chat/AthenaChat.cjs +290 -97
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +80 -4
- package/dist/chat/AthenaChat.js +290 -97
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireApprovalCard.cjs +35 -5
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +55 -2
- package/dist/chat/StatewireApprovalCard.js +37 -7
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +17 -2
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +8 -45
- package/dist/chat/StatewireQueuedMessages.js +18 -3
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/chat-agent-mentions.cjs +70 -0
- package/dist/chat/chat-agent-mentions.cjs.map +1 -0
- package/dist/chat/chat-agent-mentions.d.ts +13 -0
- package/dist/chat/chat-agent-mentions.js +70 -0
- package/dist/chat/chat-agent-mentions.js.map +1 -0
- package/dist/chat/composer-actions.cjs +12 -0
- package/dist/chat/composer-actions.cjs.map +1 -0
- package/dist/chat/composer-actions.d.ts +22 -0
- package/dist/chat/composer-actions.js +12 -0
- package/dist/chat/composer-actions.js.map +1 -0
- package/dist/chat/follow-up-suggestions.cjs +185 -0
- package/dist/chat/follow-up-suggestions.cjs.map +1 -0
- package/dist/chat/follow-up-suggestions.d.ts +64 -0
- package/dist/chat/follow-up-suggestions.js +185 -0
- package/dist/chat/follow-up-suggestions.js.map +1 -0
- package/dist/chat/super-grouping/ToolTimeline.cjs +4 -3
- package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.d.ts +7 -3
- package/dist/chat/super-grouping/ToolTimeline.js +4 -3
- package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
- package/dist/chat/turn-changes.cjs +284 -0
- package/dist/chat/turn-changes.cjs.map +1 -0
- package/dist/chat/turn-changes.d.ts +130 -0
- package/dist/chat/turn-changes.js +284 -0
- package/dist/chat/turn-changes.js.map +1 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs +31 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs.map +1 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.d.ts +31 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js +31 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js.map +1 -0
- package/dist/chat/typed-interrupts/approval-cards.cjs +250 -0
- package/dist/chat/typed-interrupts/approval-cards.cjs.map +1 -0
- package/dist/chat/typed-interrupts/approval-cards.d.ts +22 -0
- package/dist/chat/typed-interrupts/approval-cards.js +250 -0
- package/dist/chat/typed-interrupts/approval-cards.js.map +1 -0
- package/dist/chat/typed-interrupts/form-cards.cjs +289 -0
- package/dist/chat/typed-interrupts/form-cards.cjs.map +1 -0
- package/dist/chat/typed-interrupts/form-cards.d.ts +6 -0
- package/dist/chat/typed-interrupts/form-cards.js +289 -0
- package/dist/chat/typed-interrupts/form-cards.js.map +1 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.cjs +182 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.cjs.map +1 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.d.ts +47 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.js +182 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.js.map +1 -0
- package/dist/chat/typed-interrupts/json-schema-form.cjs +388 -0
- package/dist/chat/typed-interrupts/json-schema-form.cjs.map +1 -0
- package/dist/chat/typed-interrupts/json-schema-form.d.ts +33 -0
- package/dist/chat/typed-interrupts/json-schema-form.js +388 -0
- package/dist/chat/typed-interrupts/json-schema-form.js.map +1 -0
- package/dist/chat/typed-interrupts/questionnaire-card.cjs +449 -0
- package/dist/chat/typed-interrupts/questionnaire-card.cjs.map +1 -0
- package/dist/chat/typed-interrupts/questionnaire-card.d.ts +20 -0
- package/dist/chat/typed-interrupts/questionnaire-card.js +449 -0
- package/dist/chat/typed-interrupts/questionnaire-card.js.map +1 -0
- package/dist/chat/typed-interrupts/request-file-card.cjs +159 -0
- package/dist/chat/typed-interrupts/request-file-card.cjs.map +1 -0
- package/dist/chat/typed-interrupts/request-file-card.d.ts +2 -0
- package/dist/chat/typed-interrupts/request-file-card.js +159 -0
- package/dist/chat/typed-interrupts/request-file-card.js.map +1 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.cjs +189 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.cjs.map +1 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.d.ts +23 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.js +189 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.cjs +26 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.cjs.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.d.ts +3 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.js +26 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs +105 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.d.ts +29 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.js +105 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs +70 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.d.ts +45 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.js +70 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs +76 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.d.ts +11 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.js +76 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-types.d.ts +46 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.cjs +106 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.cjs.map +1 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.d.ts +29 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.js +106 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.js.map +1 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs +231 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs.map +1 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.d.ts +66 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js +231 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js.map +1 -0
- package/dist/chat-ui/composer/composer-named-agents.cjs +13 -0
- package/dist/chat-ui/composer/composer-named-agents.cjs.map +1 -0
- package/dist/chat-ui/composer/composer-named-agents.d.ts +20 -0
- package/dist/chat-ui/composer/composer-named-agents.js +13 -0
- package/dist/chat-ui/composer/composer-named-agents.js.map +1 -0
- package/dist/chat-ui/composer/slash-command-menu.cjs +143 -0
- package/dist/chat-ui/composer/slash-command-menu.cjs.map +1 -0
- package/dist/chat-ui/composer/slash-command-menu.d.ts +19 -0
- package/dist/chat-ui/composer/slash-command-menu.js +143 -0
- package/dist/chat-ui/composer/slash-command-menu.js.map +1 -0
- package/dist/chat-ui/composer/slash-commands-extension.cjs +51 -0
- package/dist/chat-ui/composer/slash-commands-extension.cjs.map +1 -0
- package/dist/chat-ui/composer/slash-commands-extension.d.ts +39 -0
- package/dist/chat-ui/composer/slash-commands-extension.js +51 -0
- package/dist/chat-ui/composer/slash-commands-extension.js.map +1 -0
- package/dist/chat-ui/composer/slash-commands.cjs +74 -0
- package/dist/chat-ui/composer/slash-commands.cjs.map +1 -0
- package/dist/chat-ui/composer/slash-commands.d.ts +82 -0
- package/dist/chat-ui/composer/slash-commands.js +74 -0
- package/dist/chat-ui/composer/slash-commands.js.map +1 -0
- package/dist/chat-ui/composer/tiptap-composer.cjs +135 -9
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +61 -2
- package/dist/chat-ui/composer/tiptap-composer.js +135 -9
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/index.cjs +3 -0
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +3 -2
- package/dist/chat-ui/index.js +3 -0
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.js +2 -2
- package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.cjs +8 -1
- package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.js +8 -1
- package/dist/chat-ui/mentions/mention-extension.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs +1 -0
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js +1 -0
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs +2 -0
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.js +3 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.js +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +36 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +42 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.js +36 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +235 -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 +88 -10
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js +236 -20
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/types.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/types.d.ts +27 -1
- package/dist/chat-ui/mentions/suggestions/data/types.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +56 -5
- 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 +26 -6
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +57 -6
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs +34 -17
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.d.ts +19 -1
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js +35 -18
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js.map +1 -1
- package/dist/chat-ui/statewire.d.ts +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +15 -0
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.d.ts +4 -1
- package/dist/chat-ui/thread/statewire-history-edge.js +15 -0
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/collab/client.cjs +17 -5
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +22 -7
- package/dist/collab/client.js +17 -5
- package/dist/collab/client.js.map +1 -1
- package/dist/composer/ComposerAttachedReferences.cjs +119 -0
- package/dist/composer/ComposerAttachedReferences.cjs.map +1 -0
- package/dist/composer/ComposerAttachedReferences.d.ts +26 -0
- package/dist/composer/ComposerAttachedReferences.js +119 -0
- package/dist/composer/ComposerAttachedReferences.js.map +1 -0
- package/dist/composer/ComposerNamedAgents.cjs +63 -0
- package/dist/composer/ComposerNamedAgents.cjs.map +1 -0
- package/dist/composer/ComposerNamedAgents.d.ts +16 -0
- package/dist/composer/ComposerNamedAgents.js +63 -0
- package/dist/composer/ComposerNamedAgents.js.map +1 -0
- package/dist/composer/attached-references.cjs +159 -0
- package/dist/composer/attached-references.cjs.map +1 -0
- package/dist/composer/attached-references.d.ts +86 -0
- package/dist/composer/attached-references.js +159 -0
- package/dist/composer/attached-references.js.map +1 -0
- package/dist/composer/build-composed-message.cjs +14 -7
- package/dist/composer/build-composed-message.cjs.map +1 -1
- package/dist/composer/build-composed-message.d.ts +6 -1
- package/dist/composer/build-composed-message.js +14 -7
- package/dist/composer/build-composed-message.js.map +1 -1
- package/dist/composer/composer-handoff.cjs +6 -2
- package/dist/composer/composer-handoff.cjs.map +1 -1
- package/dist/composer/composer-handoff.d.ts +7 -1
- package/dist/composer/composer-handoff.js +6 -2
- package/dist/composer/composer-handoff.js.map +1 -1
- package/dist/composer/folder-upload.cjs +149 -0
- package/dist/composer/folder-upload.cjs.map +1 -0
- package/dist/composer/folder-upload.d.ts +79 -0
- package/dist/composer/folder-upload.js +149 -0
- package/dist/composer/folder-upload.js.map +1 -0
- package/dist/composer/index.d.ts +1 -1
- package/dist/composer/useAttachToChat.cjs +35 -0
- package/dist/composer/useAttachToChat.cjs.map +1 -0
- package/dist/composer/useAttachToChat.d.ts +54 -0
- package/dist/composer/useAttachToChat.js +35 -0
- package/dist/composer/useAttachToChat.js.map +1 -0
- package/dist/composer/useAttachedReferencesComposerProps.cjs +19 -0
- package/dist/composer/useAttachedReferencesComposerProps.cjs.map +1 -0
- package/dist/composer/useAttachedReferencesComposerProps.d.ts +12 -0
- package/dist/composer/useAttachedReferencesComposerProps.js +19 -0
- package/dist/composer/useAttachedReferencesComposerProps.js.map +1 -0
- package/dist/composer/useFileUpload.cjs +95 -7
- package/dist/composer/useFileUpload.cjs.map +1 -1
- package/dist/composer/useFileUpload.d.ts +21 -2
- package/dist/composer/useFileUpload.js +95 -7
- package/dist/composer/useFileUpload.js.map +1 -1
- package/dist/data/athena-api-error.cjs +125 -0
- package/dist/data/athena-api-error.cjs.map +1 -0
- package/dist/data/athena-api-error.d.ts +96 -0
- package/dist/data/athena-api-error.js +125 -0
- package/dist/data/athena-api-error.js.map +1 -0
- package/dist/data/athena-data-client.cjs +106 -0
- package/dist/data/athena-data-client.cjs.map +1 -0
- package/dist/data/athena-data-client.d.ts +74 -0
- package/dist/data/athena-data-client.js +106 -0
- package/dist/data/athena-data-client.js.map +1 -0
- package/dist/data/athena-member.cjs +93 -0
- package/dist/data/athena-member.cjs.map +1 -0
- package/dist/data/athena-member.d.ts +125 -0
- package/dist/data/athena-member.js +93 -0
- package/dist/data/athena-member.js.map +1 -0
- package/dist/data/athena-request.cjs +458 -0
- package/dist/data/athena-request.cjs.map +1 -0
- package/dist/data/athena-request.d.ts +120 -0
- package/dist/data/athena-request.js +458 -0
- package/dist/data/athena-request.js.map +1 -0
- package/dist/data/use-athena-fetch.cjs +14 -0
- package/dist/data/use-athena-fetch.cjs.map +1 -0
- package/dist/data/use-athena-fetch.d.ts +19 -0
- package/dist/data/use-athena-fetch.js +14 -0
- package/dist/data/use-athena-fetch.js.map +1 -0
- package/dist/data/use-athena-graphql.cjs +66 -0
- package/dist/data/use-athena-graphql.cjs.map +1 -0
- package/dist/data/use-athena-graphql.d.ts +56 -0
- package/dist/data/use-athena-graphql.js +66 -0
- package/dist/data/use-athena-graphql.js.map +1 -0
- package/dist/data/use-athena-rest.cjs +33 -0
- package/dist/data/use-athena-rest.cjs.map +1 -0
- package/dist/data/use-athena-rest.d.ts +21 -0
- package/dist/data/use-athena-rest.js +33 -0
- package/dist/data/use-athena-rest.js.map +1 -0
- package/dist/data/use-semantic-query.cjs +44 -0
- package/dist/data/use-semantic-query.cjs.map +1 -0
- package/dist/data/use-semantic-query.d.ts +92 -0
- package/dist/data/use-semantic-query.js +44 -0
- package/dist/data/use-semantic-query.js.map +1 -0
- package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
- package/dist/diagnostics/athena-diagnostics.d.ts +5 -1
- package/dist/diagnostics/athena-diagnostics.js.map +1 -1
- package/dist/diagnostics/errors.cjs +7 -0
- package/dist/diagnostics/errors.cjs.map +1 -1
- package/dist/diagnostics/errors.d.ts +7 -0
- package/dist/diagnostics/errors.js +7 -0
- package/dist/diagnostics/errors.js.map +1 -1
- package/dist/index.cjs +155 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +72 -13
- package/dist/index.js +148 -4
- package/dist/index.js.map +1 -1
- package/dist/keryx-http/src/initial-sync.cjs +64 -16
- package/dist/keryx-http/src/initial-sync.cjs.map +1 -1
- package/dist/keryx-http/src/initial-sync.d.ts +31 -1
- package/dist/keryx-http/src/initial-sync.js +64 -16
- package/dist/keryx-http/src/initial-sync.js.map +1 -1
- package/dist/keryx-http/src/own-awareness.cjs +20 -0
- package/dist/keryx-http/src/own-awareness.cjs.map +1 -0
- package/dist/keryx-http/src/own-awareness.d.ts +50 -0
- package/dist/keryx-http/src/own-awareness.js +20 -0
- package/dist/keryx-http/src/own-awareness.js.map +1 -0
- package/dist/keryx-http/src/update-attributions.cjs +26 -1
- package/dist/keryx-http/src/update-attributions.cjs.map +1 -1
- package/dist/keryx-http/src/update-attributions.d.ts +10 -1
- package/dist/keryx-http/src/update-attributions.js +26 -1
- package/dist/keryx-http/src/update-attributions.js.map +1 -1
- package/dist/offline/chat-outbox.cjs +262 -26
- package/dist/offline/chat-outbox.cjs.map +1 -1
- package/dist/offline/chat-outbox.d.ts +90 -12
- package/dist/offline/chat-outbox.js +263 -27
- package/dist/offline/chat-outbox.js.map +1 -1
- package/dist/provider/AthenaProvider.cjs +56 -19
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +24 -8
- package/dist/provider/AthenaProvider.js +57 -20
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/references/src/anchors/types.cjs +5 -0
- package/dist/references/src/anchors/types.cjs.map +1 -1
- package/dist/references/src/anchors/types.js +5 -0
- package/dist/references/src/anchors/types.js.map +1 -1
- package/dist/references/src/attachable.cjs +149 -0
- package/dist/references/src/attachable.cjs.map +1 -0
- package/dist/references/src/attachable.d.ts +87 -0
- package/dist/references/src/attachable.js +149 -0
- package/dist/references/src/attachable.js.map +1 -0
- package/dist/runtime/StatewirePlanModeLaneSync.cjs +93 -0
- package/dist/runtime/StatewirePlanModeLaneSync.cjs.map +1 -0
- package/dist/runtime/StatewirePlanModeLaneSync.d.ts +34 -0
- package/dist/runtime/StatewirePlanModeLaneSync.js +93 -0
- package/dist/runtime/StatewirePlanModeLaneSync.js.map +1 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs +2 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
- package/dist/runtime/StatewireThreadConfigLaneSync.d.ts +4 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.js +2 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.js.map +1 -1
- package/dist/runtime/statewire-plan-mode.cjs +71 -0
- package/dist/runtime/statewire-plan-mode.cjs.map +1 -0
- package/dist/runtime/statewire-plan-mode.d.ts +88 -0
- package/dist/runtime/statewire-plan-mode.js +71 -0
- package/dist/runtime/statewire-plan-mode.js.map +1 -0
- package/dist/runtime/statewire-run-config.cjs +3 -1
- package/dist/runtime/statewire-run-config.cjs.map +1 -1
- package/dist/runtime/statewire-run-config.d.ts +7 -0
- package/dist/runtime/statewire-run-config.js +3 -1
- package/dist/runtime/statewire-run-config.js.map +1 -1
- package/dist/runtime/statewire-session-key.cjs +11 -5
- package/dist/runtime/statewire-session-key.cjs.map +1 -1
- package/dist/runtime/statewire-session-key.d.ts +22 -10
- package/dist/runtime/statewire-session-key.js +11 -5
- package/dist/runtime/statewire-session-key.js.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +65 -8
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +26 -10
- package/dist/runtime/useAthenaStatewireRuntime.js +67 -10
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/search/useAthenaAssets.cjs +394 -0
- package/dist/search/useAthenaAssets.cjs.map +1 -0
- package/dist/search/useAthenaAssets.d.ts +186 -0
- package/dist/search/useAthenaAssets.js +394 -0
- package/dist/search/useAthenaAssets.js.map +1 -0
- package/dist/sheet-range/index.cjs +4 -0
- package/dist/sheet-range/index.cjs.map +1 -1
- package/dist/sheet-range/index.d.ts +4 -2
- package/dist/sheet-range/index.js +4 -0
- package/dist/sheet-range/index.js.map +1 -1
- package/dist/sheet-range/query-range.cjs +102 -0
- package/dist/sheet-range/query-range.cjs.map +1 -0
- package/dist/sheet-range/query-range.d.ts +46 -0
- package/dist/sheet-range/query-range.js +102 -0
- package/dist/sheet-range/query-range.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/subagents/index.cjs +49 -0
- package/dist/subagents/index.cjs.map +1 -0
- package/dist/subagents/index.d.ts +16 -0
- package/dist/subagents/index.js +49 -0
- package/dist/subagents/index.js.map +1 -0
- package/dist/subagents/lane-follow.cjs +19 -0
- package/dist/subagents/lane-follow.cjs.map +1 -0
- package/dist/subagents/lane-follow.d.ts +9 -0
- package/dist/subagents/lane-follow.js +19 -0
- package/dist/subagents/lane-follow.js.map +1 -0
- package/dist/subagents/lane-model.cjs +178 -0
- package/dist/subagents/lane-model.cjs.map +1 -0
- package/dist/subagents/lane-model.d.ts +140 -0
- package/dist/subagents/lane-model.js +178 -0
- package/dist/subagents/lane-model.js.map +1 -0
- package/dist/subagents/lane-parts.cjs +517 -0
- package/dist/subagents/lane-parts.cjs.map +1 -0
- package/dist/subagents/lane-parts.d.ts +130 -0
- package/dist/subagents/lane-parts.js +517 -0
- package/dist/subagents/lane-parts.js.map +1 -0
- package/dist/subagents/subagent-lane-group.cjs +215 -0
- package/dist/subagents/subagent-lane-group.cjs.map +1 -0
- package/dist/subagents/subagent-lane-group.d.ts +67 -0
- package/dist/subagents/subagent-lane-group.js +215 -0
- package/dist/subagents/subagent-lane-group.js.map +1 -0
- package/dist/subagents/subagent-transcript-drawer.cjs +431 -0
- package/dist/subagents/subagent-transcript-drawer.cjs.map +1 -0
- package/dist/subagents/subagent-transcript-drawer.d.ts +78 -0
- package/dist/subagents/subagent-transcript-drawer.js +431 -0
- package/dist/subagents/subagent-transcript-drawer.js.map +1 -0
- package/dist/subagents/task-subagent-group.cjs +115 -0
- package/dist/subagents/task-subagent-group.cjs.map +1 -0
- package/dist/subagents/task-subagent-group.d.ts +36 -0
- package/dist/subagents/task-subagent-group.js +115 -0
- package/dist/subagents/task-subagent-group.js.map +1 -0
- package/dist/subagents/use-omitted-images-in-view.cjs +68 -0
- package/dist/subagents/use-omitted-images-in-view.cjs.map +1 -0
- package/dist/subagents/use-omitted-images-in-view.d.ts +21 -0
- package/dist/subagents/use-omitted-images-in-view.js +68 -0
- package/dist/subagents/use-omitted-images-in-view.js.map +1 -0
- package/dist/threads/Inbox.cjs +2 -2
- package/dist/threads/Inbox.cjs.map +1 -1
- package/dist/threads/SessionList.cjs +6 -6
- package/dist/threads/SessionList.cjs.map +1 -1
- package/dist/threads/SessionsPage.cjs +13 -7
- package/dist/threads/SessionsPage.cjs.map +1 -1
- package/dist/threads/SessionsPage.d.ts +10 -1
- package/dist/threads/SessionsPage.js +9 -3
- package/dist/threads/SessionsPage.js.map +1 -1
- package/dist/threads/session-list-model.cjs.map +1 -1
- package/dist/threads/session-list-model.d.ts +2 -1
- package/dist/threads/session-list-model.js.map +1 -1
- package/dist/threads/session-row-parts.cjs +3 -3
- package/dist/threads/session-row-parts.cjs.map +1 -1
- package/dist/threads/sessions-page-model.cjs +13 -5
- package/dist/threads/sessions-page-model.cjs.map +1 -1
- package/dist/threads/sessions-page-model.d.ts +7 -0
- package/dist/threads/sessions-page-model.js +11 -3
- package/dist/threads/sessions-page-model.js.map +1 -1
- package/dist/threads/sessions-page-storage.cjs +8 -8
- package/dist/threads/sessions-page-storage.cjs.map +1 -1
- package/dist/threads/sessions-page-storage.d.ts +5 -1
- package/dist/threads/sessions-page-storage.js +8 -8
- package/dist/threads/sessions-page-storage.js.map +1 -1
- package/dist/threads/use-athena-sessions.cjs +1 -0
- package/dist/threads/use-athena-sessions.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.d.ts +7 -0
- package/dist/threads/use-athena-sessions.js +1 -0
- package/dist/threads/use-athena-sessions.js.map +1 -1
- package/dist/threads/use-athena-thread-agent.cjs +31 -0
- package/dist/threads/use-athena-thread-agent.cjs.map +1 -0
- package/dist/threads/use-athena-thread-agent.d.ts +38 -0
- package/dist/threads/use-athena-thread-agent.js +31 -0
- package/dist/threads/use-athena-thread-agent.js.map +1 -0
- package/dist/threads/use-athena-thread-plan-mode.cjs +18 -0
- package/dist/threads/use-athena-thread-plan-mode.cjs.map +1 -0
- package/dist/threads/use-athena-thread-plan-mode.d.ts +18 -0
- package/dist/threads/use-athena-thread-plan-mode.js +18 -0
- package/dist/threads/use-athena-thread-plan-mode.js.map +1 -0
- package/dist/threads/use-rest-conversation-history.d.ts +1 -0
- package/dist/tools/agent-creations.cjs +97 -0
- package/dist/tools/agent-creations.cjs.map +1 -0
- package/dist/tools/agent-creations.d.ts +38 -0
- package/dist/tools/agent-creations.js +97 -0
- package/dist/tools/agent-creations.js.map +1 -0
- package/dist/tools/agent-highlights.cjs +100 -0
- package/dist/tools/agent-highlights.cjs.map +1 -0
- package/dist/tools/agent-highlights.d.ts +57 -0
- package/dist/tools/agent-highlights.js +100 -0
- package/dist/tools/agent-highlights.js.map +1 -0
- package/dist/tools/append-document-tool-ui.cjs +1 -0
- package/dist/tools/append-document-tool-ui.cjs.map +1 -1
- package/dist/tools/append-document-tool-ui.d.ts +7 -0
- package/dist/tools/append-document-tool-ui.js +2 -1
- package/dist/tools/append-document-tool-ui.js.map +1 -1
- package/dist/tools/auto-open-tools.cjs +144 -71
- package/dist/tools/auto-open-tools.cjs.map +1 -1
- package/dist/tools/auto-open-tools.d.ts +131 -1
- package/dist/tools/auto-open-tools.js +145 -72
- package/dist/tools/auto-open-tools.js.map +1 -1
- package/dist/tools/browser-tool-uis.cjs +594 -0
- package/dist/tools/browser-tool-uis.cjs.map +1 -0
- package/dist/tools/browser-tool-uis.d.ts +8 -0
- package/dist/tools/browser-tool-uis.js +594 -0
- package/dist/tools/browser-tool-uis.js.map +1 -0
- package/dist/tools/computer-asset-tool-uis.cjs +313 -0
- package/dist/tools/computer-asset-tool-uis.cjs.map +1 -0
- package/dist/tools/computer-asset-tool-uis.d.ts +5 -0
- package/dist/tools/computer-asset-tool-uis.js +313 -0
- package/dist/tools/computer-asset-tool-uis.js.map +1 -0
- package/dist/tools/document-edit-tool-uis.cjs +218 -0
- package/dist/tools/document-edit-tool-uis.cjs.map +1 -0
- package/dist/tools/document-edit-tool-uis.d.ts +40 -0
- package/dist/tools/document-edit-tool-uis.js +218 -0
- package/dist/tools/document-edit-tool-uis.js.map +1 -0
- package/dist/tools/drive-tool-uis.cjs +425 -0
- package/dist/tools/drive-tool-uis.cjs.map +1 -0
- package/dist/tools/drive-tool-uis.d.ts +120 -0
- package/dist/tools/drive-tool-uis.js +425 -0
- package/dist/tools/drive-tool-uis.js.map +1 -0
- package/dist/tools/email-calendar-tool-uis.cjs +789 -0
- package/dist/tools/email-calendar-tool-uis.cjs.map +1 -0
- package/dist/tools/email-calendar-tool-uis.d.ts +129 -0
- package/dist/tools/email-calendar-tool-uis.js +789 -0
- package/dist/tools/email-calendar-tool-uis.js.map +1 -0
- package/dist/tools/ontology-tool-uis.cjs +83 -0
- package/dist/tools/ontology-tool-uis.cjs.map +1 -0
- package/dist/tools/ontology-tool-uis.d.ts +9 -0
- package/dist/tools/ontology-tool-uis.js +83 -0
- package/dist/tools/ontology-tool-uis.js.map +1 -0
- package/dist/tools/orchestration-tool-uis.cjs +586 -0
- package/dist/tools/orchestration-tool-uis.cjs.map +1 -0
- package/dist/tools/orchestration-tool-uis.d.ts +141 -0
- package/dist/tools/orchestration-tool-uis.js +586 -0
- package/dist/tools/orchestration-tool-uis.js.map +1 -0
- package/dist/tools/presentation-edit-tool-uis.cjs +516 -0
- package/dist/tools/presentation-edit-tool-uis.cjs.map +1 -0
- package/dist/tools/presentation-edit-tool-uis.d.ts +73 -0
- package/dist/tools/presentation-edit-tool-uis.js +516 -0
- package/dist/tools/presentation-edit-tool-uis.js.map +1 -0
- package/dist/tools/project-tool-uis.cjs +213 -0
- package/dist/tools/project-tool-uis.cjs.map +1 -0
- package/dist/tools/project-tool-uis.d.ts +14 -0
- package/dist/tools/project-tool-uis.js +213 -0
- package/dist/tools/project-tool-uis.js.map +1 -0
- package/dist/tools/sandbox-tool-uis.cjs +491 -0
- package/dist/tools/sandbox-tool-uis.cjs.map +1 -0
- package/dist/tools/sandbox-tool-uis.d.ts +116 -0
- package/dist/tools/sandbox-tool-uis.js +491 -0
- package/dist/tools/sandbox-tool-uis.js.map +1 -0
- package/dist/tools/sheet-query-tool-ui.cjs +138 -0
- package/dist/tools/sheet-query-tool-ui.cjs.map +1 -0
- package/dist/tools/sheet-query-tool-ui.d.ts +15 -0
- package/dist/tools/sheet-query-tool-ui.js +138 -0
- package/dist/tools/sheet-query-tool-ui.js.map +1 -0
- package/dist/tools/studio-screenshot-tool-uis.cjs +262 -0
- package/dist/tools/studio-screenshot-tool-uis.cjs.map +1 -0
- package/dist/tools/studio-screenshot-tool-uis.d.ts +52 -0
- package/dist/tools/studio-screenshot-tool-uis.js +262 -0
- package/dist/tools/studio-screenshot-tool-uis.js.map +1 -0
- package/dist/tools/subagent-task-tool-ui.cjs +24 -475
- package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
- package/dist/tools/subagent-task-tool-ui.d.ts +19 -103
- package/dist/tools/subagent-task-tool-ui.js +28 -479
- package/dist/tools/subagent-task-tool-ui.js.map +1 -1
- package/dist/tools/tool-summary.cjs +36 -0
- package/dist/tools/tool-summary.cjs.map +1 -1
- package/dist/tools/tool-summary.js +36 -0
- package/dist/tools/tool-summary.js.map +1 -1
- package/dist/tools/tool-uis.cjs +181 -53
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/tool-uis.d.ts +40 -0
- package/dist/tools/tool-uis.js +183 -55
- package/dist/tools/tool-uis.js.map +1 -1
- package/dist/typed-interrupts/index.cjs +15 -0
- package/dist/typed-interrupts/index.cjs.map +1 -0
- package/dist/typed-interrupts/index.d.ts +20 -0
- package/dist/typed-interrupts/index.js +15 -0
- package/dist/typed-interrupts/index.js.map +1 -0
- package/dist/workbench/session-workbench-panes.cjs +6 -6
- package/dist/workbench/session-workbench-panes.cjs.map +1 -1
- package/package.json +28 -6
- package/dist/agent-runtime/src/chat-outbox-store.cjs +0 -510
- package/dist/agent-runtime/src/chat-outbox-store.cjs.map +0 -1
- package/dist/agent-runtime/src/chat-outbox-store.d.ts +0 -210
- package/dist/agent-runtime/src/chat-outbox-store.js +0 -510
- package/dist/agent-runtime/src/chat-outbox-store.js.map +0 -1
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { withAddressedAgents } from "./addressed-agents.js";
|
|
2
|
+
import { withoutTransientLocalMeta, readChatOutboxLocalMeta, CHAT_OUTBOX_LOCAL_META_KIND, chatOutboxEntryOf } from "./chat-outbox-entry.js";
|
|
3
|
+
import { migrateLegacyChatOutbox } from "./chat-outbox-legacy.js";
|
|
4
|
+
import { chatOutboxWireAnchorId } from "./chat-outbox-thread.js";
|
|
5
|
+
import { reanchorRunSend } from "./statewire-held-sends.js";
|
|
6
|
+
import { DEEP_AGENT_STATEWIRE_PROTOCOL } from "./statewire-transport.js";
|
|
1
7
|
const CHAT_OUTBOX_COUNTDOWN_MS = 5e3;
|
|
2
8
|
const CHAT_OUTBOX_ASK_AFTER_MS = 24 * 60 * 60 * 1e3;
|
|
3
|
-
const CHAT_OUTBOX_CLAIM_LEASE_MS = 3e4;
|
|
4
9
|
const CHAT_OUTBOX_ATTACHMENT_CHECK_TIMEOUT_MS = 15e3;
|
|
10
|
+
const CHAT_OUTBOX_ATTACHMENT_REFUSED_CODE = "attachment-unavailable";
|
|
11
|
+
const CHAT_OUTBOX_ATTACHMENT_UNKNOWN_CODE = "attachment-check-failed";
|
|
5
12
|
const CHAT_EDIT_UNREACHABLE_LABEL = "Can't edit while Athena can't be reached";
|
|
6
13
|
const CHAT_EDIT_KEPT_MESSAGE = "Can't reach Athena right now. Your edit stays here — submit it once Athena is back.";
|
|
7
14
|
class ChatEditUnreachableError extends Error {
|
|
@@ -11,51 +18,59 @@ class ChatEditUnreachableError extends Error {
|
|
|
11
18
|
}
|
|
12
19
|
}
|
|
13
20
|
function chatOutboxFailureMessage(reason) {
|
|
14
|
-
|
|
15
|
-
case "refused":
|
|
16
|
-
return "This conversation can't be reached right now.";
|
|
17
|
-
case "prepare":
|
|
18
|
-
return "Couldn't prepare this message to send.";
|
|
19
|
-
case "attachment":
|
|
20
|
-
return "An attachment is no longer available to you.";
|
|
21
|
-
default:
|
|
22
|
-
return "Couldn't send this message.";
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const AWAY_CAUSES = /* @__PURE__ */ new Set(["unmount", "stream-gone"]);
|
|
26
|
-
function chatOutboxCommandMessageId(params) {
|
|
27
|
-
var _a;
|
|
28
|
-
const first = params == null ? void 0 : params[0];
|
|
29
|
-
const id = (_a = first == null ? void 0 : first.message) == null ? void 0 : _a.id;
|
|
30
|
-
return typeof id === "string" ? id : null;
|
|
21
|
+
return reason === "attachment" ? "An attachment is no longer available to you." : "Couldn't send this message.";
|
|
31
22
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const cause = typeof (failure == null ? void 0 : failure.cause) === "string" ? failure.cause : void 0;
|
|
36
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
37
|
-
return { fate, cause, message };
|
|
38
|
-
}
|
|
39
|
-
function defaultMessageId() {
|
|
23
|
+
const MIGRATION_CONFIRM_ATTEMPTS = 20;
|
|
24
|
+
const MIGRATION_CONFIRM_DELAY_MS = 250;
|
|
25
|
+
function randomId() {
|
|
40
26
|
var _a;
|
|
41
27
|
const host = globalThis;
|
|
42
28
|
if (typeof ((_a = host.crypto) == null ? void 0 : _a.randomUUID) === "function") return host.crypto.randomUUID();
|
|
43
29
|
const hex = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
44
30
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-4${hex.slice(13, 16)}-a${hex.slice(17, 20)}-${hex.slice(20, 32)}`;
|
|
45
31
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
32
|
+
function isRecord(value) {
|
|
33
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
34
|
+
}
|
|
35
|
+
function reanchorHeldSendParams(command, view) {
|
|
36
|
+
const params = command.params[0];
|
|
37
|
+
if (!isRecord(params)) return null;
|
|
38
|
+
const rest = command.params.slice(1);
|
|
39
|
+
if (command.method === "run/edit") {
|
|
40
|
+
const next = reanchorRunSend(command, { wireMessages: view.wireMessages, runId: view.runId });
|
|
41
|
+
return (next == null ? void 0 : next.method) === "run/edit" ? next.params : null;
|
|
55
42
|
}
|
|
43
|
+
if (command.method !== "run/send") return null;
|
|
44
|
+
if (view.runId !== null && params.runId === view.runId) return null;
|
|
45
|
+
const { runAnchorMessageId: _anchor, ...unanchored } = params;
|
|
46
|
+
if (view.runId !== null) return [{ ...unanchored, runId: view.runId }, ...rest];
|
|
47
|
+
const wire = view.wireMessages ?? [];
|
|
48
|
+
return [
|
|
49
|
+
{ ...unanchored, runId: randomId(), runAnchorMessageId: wire.length > 0 ? chatOutboxWireAnchorId(wire) : null },
|
|
50
|
+
...rest
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
function failureReason(error) {
|
|
54
|
+
return "code" in error && error.code === CHAT_OUTBOX_ATTACHMENT_REFUSED_CODE ? "attachment" : "error";
|
|
56
55
|
}
|
|
57
|
-
function
|
|
58
|
-
return a === b
|
|
56
|
+
function sameEntry(a, b) {
|
|
57
|
+
return a.id === b.id && a.outboxId === b.outboxId && a.threadId === b.threadId && a.text === b.text && a.queuedAt === b.queuedAt && a.newChat === b.newChat && a.durable === b.durable && a.composerMarkdown === b.composerMarkdown && a.composerHtml === b.composerHtml && sameJson(a.metadata, b.metadata) && sameJson(a.files, b.files) && sameJson(a.attachments, b.attachments);
|
|
58
|
+
}
|
|
59
|
+
function sameJson(a, b) {
|
|
60
|
+
if (Object.is(a, b)) return true;
|
|
61
|
+
if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
|
|
62
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
63
|
+
return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((item, index) => sameJson(item, b[index]));
|
|
64
|
+
}
|
|
65
|
+
const ka = Object.keys(a);
|
|
66
|
+
const kb = Object.keys(b);
|
|
67
|
+
return ka.length === kb.length && ka.every((key) => Object.hasOwn(b, key) && sameJson(Reflect.get(a, key), Reflect.get(b, key)));
|
|
68
|
+
}
|
|
69
|
+
function sameState(a, b) {
|
|
70
|
+
if (a.kind !== b.kind) return false;
|
|
71
|
+
if (a.kind === "countdown") return a.endsAt === b.endsAt;
|
|
72
|
+
if (a.kind === "failed") return a.reason === b.reason && a.message === b.message;
|
|
73
|
+
return true;
|
|
59
74
|
}
|
|
60
75
|
function sameChatOutboxSnapshot(a, b) {
|
|
61
76
|
if (a === b) return true;
|
|
@@ -64,12 +79,12 @@ function sameChatOutboxSnapshot(a, b) {
|
|
|
64
79
|
for (let index = 0; index < a.rows.length; index += 1) {
|
|
65
80
|
const x = a.rows[index];
|
|
66
81
|
const y = b.rows[index];
|
|
67
|
-
if (!x || !y || x.entry !== y.entry || !
|
|
82
|
+
if (!x || !y || x.entry !== y.entry || !sameState(x.state, y.state)) return false;
|
|
68
83
|
}
|
|
69
84
|
for (let index = 0; index < a.elsewhere.length; index += 1) {
|
|
70
85
|
const x = a.elsewhere[index];
|
|
71
86
|
const y = b.elsewhere[index];
|
|
72
|
-
if (!x || !y || x.threadId !== y.threadId || x.count !== y.count || x.newChat !== y.newChat ||
|
|
87
|
+
if (!x || !y || x.threadId !== y.threadId || x.count !== y.count || x.newChat !== y.newChat || x.first !== y.first) {
|
|
73
88
|
return false;
|
|
74
89
|
}
|
|
75
90
|
}
|
|
@@ -79,7 +94,6 @@ function createChatOutbox(options) {
|
|
|
79
94
|
const {
|
|
80
95
|
threadId,
|
|
81
96
|
isNewChat,
|
|
82
|
-
store,
|
|
83
97
|
reachability,
|
|
84
98
|
foreground,
|
|
85
99
|
thread,
|
|
@@ -87,117 +101,128 @@ function createChatOutbox(options) {
|
|
|
87
101
|
openThread,
|
|
88
102
|
onEvent,
|
|
89
103
|
checkAttachments,
|
|
90
|
-
|
|
104
|
+
directory,
|
|
105
|
+
legacy,
|
|
91
106
|
now = () => Date.now(),
|
|
92
107
|
countdownMs = CHAT_OUTBOX_COUNTDOWN_MS,
|
|
93
108
|
askAfterMs = CHAT_OUTBOX_ASK_AFTER_MS,
|
|
94
|
-
claimLeaseMs = CHAT_OUTBOX_CLAIM_LEASE_MS,
|
|
95
109
|
attachmentCheckTimeoutMs = CHAT_OUTBOX_ATTACHMENT_CHECK_TIMEOUT_MS,
|
|
96
|
-
newMessageId =
|
|
110
|
+
newMessageId = randomId,
|
|
97
111
|
setTimer = (task, ms) => {
|
|
98
|
-
const
|
|
99
|
-
return () => clearTimeout(
|
|
112
|
+
const timer2 = setTimeout(task, ms);
|
|
113
|
+
return () => clearTimeout(timer2);
|
|
100
114
|
}
|
|
101
115
|
} = options;
|
|
102
|
-
const claimant = newMessageId();
|
|
103
116
|
let disposed = false;
|
|
104
|
-
let
|
|
105
|
-
let
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
const handedInRegain = /* @__PURE__ */ new Map();
|
|
114
|
-
let regain = 0;
|
|
115
|
-
let wasReachable = reachability.get();
|
|
116
|
-
let countdown = null;
|
|
117
|
-
let leaseTimer = null;
|
|
118
|
-
const checkTimers = /* @__PURE__ */ new Set();
|
|
119
|
-
const readyToGo = /* @__PURE__ */ new Map();
|
|
120
|
-
let releasing = false;
|
|
117
|
+
let openSince = null;
|
|
118
|
+
let pending = [];
|
|
119
|
+
const landing = /* @__PURE__ */ new Map();
|
|
120
|
+
const dropOnLanding = /* @__PURE__ */ new Set();
|
|
121
|
+
const countdownRequested = /* @__PURE__ */ new Set();
|
|
122
|
+
const released = /* @__PURE__ */ new Set();
|
|
123
|
+
const legacyAwaitingDelivery = /* @__PURE__ */ new Map();
|
|
124
|
+
const checking = /* @__PURE__ */ new Set();
|
|
125
|
+
const failing = /* @__PURE__ */ new Set();
|
|
121
126
|
const asked = /* @__PURE__ */ new Set();
|
|
127
|
+
const checkTimers = /* @__PURE__ */ new Set();
|
|
128
|
+
let timer = null;
|
|
129
|
+
let migration = legacy ? "idle" : "done";
|
|
130
|
+
let migrationAttempts = 0;
|
|
131
|
+
const entryCache = /* @__PURE__ */ new Map();
|
|
122
132
|
const listeners = /* @__PURE__ */ new Set();
|
|
123
|
-
let
|
|
124
|
-
|
|
125
|
-
countdownEndsAt: null,
|
|
126
|
-
durable: true,
|
|
127
|
-
loaded,
|
|
128
|
-
elsewhere
|
|
129
|
-
};
|
|
133
|
+
let rows = [];
|
|
134
|
+
let snapshot = { rows: [], countdownEndsAt: null, durable: true, loaded: false, elsewhere: [] };
|
|
130
135
|
const emit = (event) => {
|
|
131
136
|
try {
|
|
132
137
|
onEvent == null ? void 0 : onEvent(event);
|
|
133
138
|
} catch {
|
|
134
139
|
}
|
|
135
140
|
};
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
+
const gateOpen = () => reachability.get() && foreground.get() && thread.outbox() !== null;
|
|
142
|
+
const stable = (entry) => {
|
|
143
|
+
const key = entry.outboxId ?? `pending:${entry.id}`;
|
|
144
|
+
const cached = entryCache.get(key);
|
|
145
|
+
if (cached && sameEntry(cached, entry)) return cached;
|
|
146
|
+
entryCache.set(key, entry);
|
|
147
|
+
return entry;
|
|
141
148
|
};
|
|
142
|
-
const
|
|
143
|
-
if (!
|
|
144
|
-
const
|
|
145
|
-
|
|
149
|
+
const readRows = (outbox) => {
|
|
150
|
+
if (!outbox) return [];
|
|
151
|
+
const result = [];
|
|
152
|
+
for (const stored of outbox.entries) {
|
|
153
|
+
if (stored.state !== "held") continue;
|
|
154
|
+
const entry = chatOutboxEntryOf(stored, threadId);
|
|
155
|
+
if (!entry) continue;
|
|
156
|
+
result.push({ stored, entry: stable(entry), meta: readChatOutboxLocalMeta(stored.localMeta) });
|
|
157
|
+
}
|
|
158
|
+
return result;
|
|
146
159
|
};
|
|
147
|
-
const
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
160
|
+
const isAsk = (row) => now() - row.entry.queuedAt > askAfterMs;
|
|
161
|
+
const lineOf = (current) => {
|
|
162
|
+
const line = [];
|
|
163
|
+
for (const row of current) {
|
|
164
|
+
if (row.meta.error || failing.has(row.stored.id) || isAsk(row)) break;
|
|
165
|
+
if (checking.has(row.stored.id) || released.has(row.stored.id)) continue;
|
|
166
|
+
line.push(row);
|
|
167
|
+
}
|
|
168
|
+
return line;
|
|
156
169
|
};
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
if (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
170
|
+
const countdownCurrent = (meta, since) => meta.countdownEndsAt !== void 0 && meta.countdownFrom !== void 0 && meta.countdownFrom >= since;
|
|
171
|
+
const lineEndsAt = (line) => {
|
|
172
|
+
if (openSince === null || line.length === 0) return null;
|
|
173
|
+
let endsAt = 0;
|
|
174
|
+
for (const row of line) {
|
|
175
|
+
if (!countdownCurrent(row.meta, openSince)) return null;
|
|
176
|
+
endsAt = Math.max(endsAt, row.meta.countdownEndsAt ?? 0);
|
|
177
|
+
}
|
|
178
|
+
return endsAt;
|
|
179
|
+
};
|
|
180
|
+
const rowState = (row, line, endsAt, blocked) => {
|
|
181
|
+
if (row.meta.error) {
|
|
182
|
+
const reason = failureReason(row.meta.error);
|
|
183
|
+
return { kind: "failed", reason, message: chatOutboxFailureMessage(reason) };
|
|
184
|
+
}
|
|
185
|
+
if (checking.has(row.stored.id) || released.has(row.stored.id)) return { kind: "sending" };
|
|
186
|
+
if (blocked) return { kind: "waiting" };
|
|
187
|
+
if (isAsk(row)) return { kind: "ask" };
|
|
188
|
+
if (endsAt !== null && line.includes(row)) return { kind: "countdown", endsAt };
|
|
167
189
|
return { kind: "waiting" };
|
|
168
190
|
};
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
191
|
+
const publish = (current, line, endsAt) => {
|
|
192
|
+
const outbox = thread.outbox();
|
|
193
|
+
const built = [];
|
|
194
|
+
let blocked = false;
|
|
195
|
+
for (const row of current) {
|
|
196
|
+
const state = rowState(row, line, endsAt, blocked);
|
|
197
|
+
built.push({ entry: row.entry, state });
|
|
198
|
+
if (state.kind === "failed" || state.kind === "ask") blocked = true;
|
|
199
|
+
}
|
|
200
|
+
for (const entry of landing.values()) built.push({ entry, state: { kind: "waiting" } });
|
|
201
|
+
for (const waiting of pending) built.push({ entry: waiting.entry, state: { kind: "waiting" } });
|
|
202
|
+
const elsewhere = [];
|
|
203
|
+
for (const other of (directory == null ? void 0 : directory.getSnapshot().threads) ?? []) {
|
|
204
|
+
const first = other.entries[0];
|
|
205
|
+
if (other.threadId === threadId || !first) continue;
|
|
206
|
+
elsewhere.push({
|
|
207
|
+
threadId: other.threadId,
|
|
208
|
+
count: other.entries.length,
|
|
209
|
+
first,
|
|
210
|
+
newChat: other.entries.every((entry) => entry.newChat)
|
|
211
|
+
});
|
|
186
212
|
}
|
|
187
|
-
const head = run[0];
|
|
188
|
-
if (head !== void 0 && !mayHandOff(head)) return { run: [], askId: null };
|
|
189
|
-
return { run, askId: null };
|
|
190
|
-
};
|
|
191
|
-
const gateOpen = () => reachability.get() && foreground.get();
|
|
192
|
-
const publish = () => {
|
|
193
|
-
const line = gateOpen() ? computeLine() : { run: [], askId: null };
|
|
194
213
|
const next = {
|
|
195
|
-
rows:
|
|
196
|
-
countdownEndsAt:
|
|
197
|
-
durable:
|
|
198
|
-
loaded,
|
|
214
|
+
rows: built,
|
|
215
|
+
countdownEndsAt: endsAt,
|
|
216
|
+
durable: built.every((row) => row.entry.durable),
|
|
217
|
+
loaded: outbox !== null,
|
|
199
218
|
elsewhere
|
|
200
219
|
};
|
|
220
|
+
if (elsewhere.length === snapshot.elsewhere.length) {
|
|
221
|
+
next.elsewhere = elsewhere.map((item, index) => {
|
|
222
|
+
const previous = snapshot.elsewhere[index];
|
|
223
|
+
return previous && previous.threadId === item.threadId && previous.count === item.count && previous.newChat === item.newChat && sameEntry(previous.first, item.first) ? previous : item;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
201
226
|
if (sameChatOutboxSnapshot(snapshot, next)) return;
|
|
202
227
|
snapshot = next;
|
|
203
228
|
for (const listener of listeners) {
|
|
@@ -207,110 +232,55 @@ function createChatOutbox(options) {
|
|
|
207
232
|
}
|
|
208
233
|
}
|
|
209
234
|
};
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
emit(event);
|
|
229
|
-
if (store) void store.remove(threadId, id).catch(() => void 0);
|
|
230
|
-
};
|
|
231
|
-
const fail = (id, reason) => {
|
|
232
|
-
phases.set(id, { kind: "failed", reason });
|
|
233
|
-
sendNow.delete(id);
|
|
234
|
-
emit({ type: "failed", threadId, messageId: id, message: chatOutboxFailureMessage(reason), reason });
|
|
235
|
-
if (store) {
|
|
236
|
-
void store.markFailed({ threadId, id, claimant, failure: { reason, at: now() } }).catch(() => void 0);
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
const releaseClaim = (id) => {
|
|
240
|
-
if (store) void store.release({ threadId, id, claimant }).catch(() => void 0);
|
|
241
|
-
};
|
|
242
|
-
const handOff = (entry, auto) => {
|
|
243
|
-
if (thread.heldIds().has(entry.id)) {
|
|
244
|
-
letGo(entry.id, { type: "adopted", threadId, messageId: entry.id });
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
const readiness = thread.readiness();
|
|
248
|
-
if (readiness === "refused") {
|
|
249
|
-
fail(entry.id, "refused");
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
if (readiness === "connecting") {
|
|
253
|
-
phases.set(entry.id, { kind: "awaiting-thread" });
|
|
254
|
-
return;
|
|
235
|
+
const releaseNow = (row, auto) => {
|
|
236
|
+
var _a;
|
|
237
|
+
const outbox = thread.outbox();
|
|
238
|
+
if (!outbox) return;
|
|
239
|
+
const view = thread.view();
|
|
240
|
+
released.add(row.stored.id);
|
|
241
|
+
emit({ type: "handed", threadId, messageId: row.entry.id, auto, ageMs: now() - row.entry.queuedAt });
|
|
242
|
+
try {
|
|
243
|
+
outbox.update(row.stored.id, (current) => {
|
|
244
|
+
if (current.state !== "held") return {};
|
|
245
|
+
const params = reanchorHeldSendParams(current.command, view);
|
|
246
|
+
return {
|
|
247
|
+
held: false,
|
|
248
|
+
localMeta: withoutTransientLocalMeta(current.localMeta),
|
|
249
|
+
...params !== null && { command: { params } }
|
|
250
|
+
};
|
|
251
|
+
});
|
|
252
|
+
} catch {
|
|
255
253
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
254
|
+
(_a = thread.wake) == null ? void 0 : _a.call(thread);
|
|
255
|
+
if (legacy && row.meta.legacyId !== void 0 && !row.entry.durable) {
|
|
256
|
+
legacyAwaitingDelivery.set(row.entry.id, row.meta.legacyId);
|
|
259
257
|
}
|
|
260
|
-
sendNow.delete(entry.id);
|
|
261
|
-
phases.set(entry.id, { kind: "claiming" });
|
|
262
|
-
const claim = store ? store.claim({ threadId, id: entry.id, claimant, now: now(), leaseMs: claimLeaseMs }) : Promise.resolve("claimed");
|
|
263
|
-
void claim.then(
|
|
264
|
-
(result) => {
|
|
265
|
-
if (disposed || phaseOf(entry.id).kind !== "claiming") return;
|
|
266
|
-
if (result === "gone") {
|
|
267
|
-
dropEntry(entry.id);
|
|
268
|
-
evaluate();
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
if (result === "taken") {
|
|
272
|
-
phases.set(entry.id, { kind: "idle" });
|
|
273
|
-
claims.set(entry.id, { by: "elsewhere", at: now() });
|
|
274
|
-
evaluate();
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
if (!stillGoes(entry)) return;
|
|
278
|
-
checkThenDispatch(entry, auto);
|
|
279
|
-
},
|
|
280
|
-
() => {
|
|
281
|
-
if (disposed || phaseOf(entry.id).kind !== "claiming") return;
|
|
282
|
-
fail(entry.id, "prepare");
|
|
283
|
-
evaluate();
|
|
284
|
-
}
|
|
285
|
-
);
|
|
286
258
|
};
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
phases.set(entry.id, gateOpen() ? { kind: "awaiting-thread" } : { kind: "idle" });
|
|
301
|
-
releaseClaim(entry.id);
|
|
302
|
-
evaluate();
|
|
303
|
-
return false;
|
|
259
|
+
const markFailed = (row, code) => {
|
|
260
|
+
const outbox = thread.outbox();
|
|
261
|
+
checking.delete(row.stored.id);
|
|
262
|
+
if (!outbox) return;
|
|
263
|
+
failing.add(row.stored.id);
|
|
264
|
+
const error = { fate: "rejected", cause: "server", code };
|
|
265
|
+
try {
|
|
266
|
+
outbox.update(row.stored.id, (current) => {
|
|
267
|
+
if (current.state !== "held") return {};
|
|
268
|
+
const base = withoutTransientLocalMeta(current.localMeta);
|
|
269
|
+
return { localMeta: { ...isRecord(base) ? base : {}, error } };
|
|
270
|
+
});
|
|
271
|
+
} catch {
|
|
304
272
|
}
|
|
305
|
-
|
|
273
|
+
const reason = failureReason(error);
|
|
274
|
+
emit({ type: "failed", threadId, messageId: row.entry.id, message: chatOutboxFailureMessage(reason), reason });
|
|
306
275
|
};
|
|
307
|
-
const
|
|
308
|
-
const attachments = entry.attachments ?? [];
|
|
276
|
+
const release = (row, auto) => {
|
|
277
|
+
const attachments = row.entry.attachments ?? [];
|
|
309
278
|
if (attachments.length === 0 || !checkAttachments) {
|
|
310
|
-
|
|
311
|
-
releaseReady();
|
|
279
|
+
releaseNow(row, auto);
|
|
312
280
|
return;
|
|
313
281
|
}
|
|
282
|
+
if (checking.has(row.stored.id)) return;
|
|
283
|
+
checking.add(row.stored.id);
|
|
314
284
|
let answered = false;
|
|
315
285
|
let stopTimer = () => void 0;
|
|
316
286
|
const answer = (verdict) => {
|
|
@@ -318,284 +288,255 @@ function createChatOutbox(options) {
|
|
|
318
288
|
answered = true;
|
|
319
289
|
stopTimer();
|
|
320
290
|
checkTimers.delete(stopTimer);
|
|
321
|
-
if (disposed ||
|
|
322
|
-
if (!stillGoes(entry)) return;
|
|
291
|
+
if (disposed || !checking.has(row.stored.id)) return;
|
|
323
292
|
if (verdict === "ok") {
|
|
324
|
-
|
|
325
|
-
|
|
293
|
+
checking.delete(row.stored.id);
|
|
294
|
+
if (!auto || gateOpen()) releaseNow(row, auto);
|
|
295
|
+
evaluate();
|
|
326
296
|
return;
|
|
327
297
|
}
|
|
328
|
-
|
|
298
|
+
markFailed(row, verdict === "refused" ? CHAT_OUTBOX_ATTACHMENT_REFUSED_CODE : CHAT_OUTBOX_ATTACHMENT_UNKNOWN_CODE);
|
|
329
299
|
evaluate();
|
|
330
300
|
};
|
|
331
301
|
stopTimer = setTimer(() => answer("unknown"), attachmentCheckTimeoutMs);
|
|
332
302
|
checkTimers.add(stopTimer);
|
|
333
|
-
let
|
|
303
|
+
let checked;
|
|
334
304
|
try {
|
|
335
|
-
|
|
305
|
+
checked = checkAttachments(attachments);
|
|
336
306
|
} catch (error) {
|
|
337
|
-
|
|
307
|
+
checked = Promise.reject(error);
|
|
338
308
|
}
|
|
339
|
-
void
|
|
309
|
+
void checked.then(answer, () => answer("unknown"));
|
|
340
310
|
};
|
|
341
|
-
|
|
342
|
-
if (
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
heldBack = true;
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
readyToGo.delete(entry.id);
|
|
356
|
-
if (stillGoes(entry)) dispatch(entry, auto);
|
|
357
|
-
}
|
|
358
|
-
} finally {
|
|
359
|
-
releasing = false;
|
|
360
|
-
if (heldBack) evaluateLine();
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
function holdBackFrom(first) {
|
|
364
|
-
let behind = false;
|
|
365
|
-
for (const entry of entries) {
|
|
366
|
-
if (entry.id === first.id) behind = true;
|
|
367
|
-
if (!behind || phaseOf(entry.id).kind !== "claiming") continue;
|
|
368
|
-
readyToGo.delete(entry.id);
|
|
369
|
-
phases.set(entry.id, { kind: "idle" });
|
|
370
|
-
releaseClaim(entry.id);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
const dispatch = (entry, auto) => {
|
|
374
|
-
handedInRegain.set(entry.id, regain);
|
|
375
|
-
phases.set(entry.id, { kind: "handed", journaled: false });
|
|
376
|
-
emit({
|
|
377
|
-
type: "handed",
|
|
311
|
+
const startMigration = (outbox) => {
|
|
312
|
+
if (!legacy || migration !== "idle") return;
|
|
313
|
+
migration = "running";
|
|
314
|
+
const isKept = legacy.isKept === void 0 ? async (messageId) => {
|
|
315
|
+
var _a;
|
|
316
|
+
return ((_a = thread.outbox()) == null ? void 0 : _a.entries.some((entry) => {
|
|
317
|
+
var _a2;
|
|
318
|
+
return entry.durable && ((_a2 = chatOutboxEntryOf(entry, threadId)) == null ? void 0 : _a2.id) === messageId;
|
|
319
|
+
})) ?? false;
|
|
320
|
+
} : (messageId) => legacy.isKept(threadId, messageId);
|
|
321
|
+
void migrateLegacyChatOutbox({
|
|
378
322
|
threadId,
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
})
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
const phase = phaseOf(entry.id);
|
|
399
|
-
if (phase.kind === "handed" && phase.journaled) return;
|
|
400
|
-
if (phase.kind !== "handed") return;
|
|
401
|
-
const failure = failureOf(error);
|
|
402
|
-
if (failure.cause !== void 0 && AWAY_CAUSES.has(failure.cause)) {
|
|
403
|
-
phases.set(entry.id, { kind: "idle" });
|
|
404
|
-
handedInRegain.delete(entry.id);
|
|
405
|
-
releaseClaim(entry.id);
|
|
406
|
-
evaluate();
|
|
407
|
-
return;
|
|
323
|
+
reader: legacy.reader,
|
|
324
|
+
outbox,
|
|
325
|
+
isKept,
|
|
326
|
+
messageIdsShown: () => thread.view().messageIds
|
|
327
|
+
}).then(
|
|
328
|
+
(result) => {
|
|
329
|
+
var _a;
|
|
330
|
+
migration = "done";
|
|
331
|
+
if (result.inserted + result.removed + result.kept > 0) emit({ type: "migrated", threadId, ...result });
|
|
332
|
+
directory == null ? void 0 : directory.refresh();
|
|
333
|
+
const inMemory = ((_a = thread.outbox()) == null ? void 0 : _a.entries.some((entry) => !entry.durable)) ?? false;
|
|
334
|
+
if (result.kept > 0 && !inMemory && migrationAttempts < MIGRATION_CONFIRM_ATTEMPTS && !disposed) {
|
|
335
|
+
migrationAttempts += 1;
|
|
336
|
+
const stop = setTimer(() => {
|
|
337
|
+
checkTimers.delete(stop);
|
|
338
|
+
migration = "idle";
|
|
339
|
+
evaluate();
|
|
340
|
+
}, MIGRATION_CONFIRM_DELAY_MS);
|
|
341
|
+
checkTimers.add(stop);
|
|
408
342
|
}
|
|
409
|
-
|
|
410
|
-
|
|
343
|
+
},
|
|
344
|
+
() => {
|
|
345
|
+
migration = "idle";
|
|
411
346
|
}
|
|
412
347
|
);
|
|
413
348
|
};
|
|
414
|
-
const startCountdown = (run) => {
|
|
415
|
-
stopCountdown();
|
|
416
|
-
const ids = run.map((entry) => entry.id);
|
|
417
|
-
const endsAt = now() + countdownMs;
|
|
418
|
-
const cancel = setTimer(() => {
|
|
419
|
-
if (disposed || (countdown == null ? void 0 : countdown.endsAt) !== endsAt) return;
|
|
420
|
-
countdown = null;
|
|
421
|
-
if (!gateOpen()) {
|
|
422
|
-
evaluate();
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
for (const id of ids) {
|
|
426
|
-
const entry = entries.find((candidate) => candidate.id === id);
|
|
427
|
-
if (!entry) continue;
|
|
428
|
-
const phase = phaseOf(id);
|
|
429
|
-
if (phase.kind !== "idle" || claimedElsewhere(id)) continue;
|
|
430
|
-
if (!mayHandOff(entry)) break;
|
|
431
|
-
handOff(entry, true);
|
|
432
|
-
}
|
|
433
|
-
evaluate();
|
|
434
|
-
}, countdownMs);
|
|
435
|
-
countdown = { endsAt, ids, cancel };
|
|
436
|
-
emit({ type: "countdown-started", threadId, count: ids.length });
|
|
437
|
-
};
|
|
438
|
-
const scheduleLeaseCheck = () => {
|
|
439
|
-
leaseTimer == null ? void 0 : leaseTimer();
|
|
440
|
-
leaseTimer = null;
|
|
441
|
-
let soonest = Number.POSITIVE_INFINITY;
|
|
442
|
-
for (const [id, claim] of claims) {
|
|
443
|
-
if (claim.by === claimant || !entries.some((entry) => entry.id === id)) continue;
|
|
444
|
-
const expires = claim.at + claimLeaseMs - now();
|
|
445
|
-
if (expires > 0) soonest = Math.min(soonest, expires);
|
|
446
|
-
}
|
|
447
|
-
if (Number.isFinite(soonest)) leaseTimer = setTimer(() => evaluate(), soonest + 1);
|
|
448
|
-
};
|
|
449
349
|
function evaluate() {
|
|
450
|
-
evaluateLine();
|
|
451
|
-
releaseReady();
|
|
452
|
-
}
|
|
453
|
-
function evaluateLine() {
|
|
454
350
|
if (disposed) return;
|
|
455
|
-
const
|
|
456
|
-
if (
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
351
|
+
const outbox = thread.outbox();
|
|
352
|
+
if (outbox && pending.length > 0) {
|
|
353
|
+
const waiting = pending;
|
|
354
|
+
pending = [];
|
|
355
|
+
for (let index = 0; index < waiting.length; index += 1) {
|
|
356
|
+
const item = waiting[index];
|
|
357
|
+
try {
|
|
358
|
+
outbox.insert(item.insert);
|
|
359
|
+
landing.set(item.entry.id, item.entry);
|
|
360
|
+
emit({ type: "held", threadId, messageId: item.entry.id, durable: true });
|
|
361
|
+
} catch {
|
|
362
|
+
pending = waiting.slice(index);
|
|
363
|
+
break;
|
|
465
364
|
}
|
|
466
|
-
if (phase.kind === "claiming") continue;
|
|
467
|
-
if (held.has(entry.id)) letGo(entry.id, { type: "adopted", threadId, messageId: entry.id });
|
|
468
365
|
}
|
|
469
|
-
if (!gateOpen()) {
|
|
470
|
-
for (const entry of entries) {
|
|
471
|
-
if (phaseOf(entry.id).kind === "awaiting-thread") phases.set(entry.id, { kind: "idle" });
|
|
472
|
-
}
|
|
473
|
-
} else if (thread.readiness() !== "connecting") {
|
|
474
|
-
let held2 = false;
|
|
475
|
-
let handedKey = null;
|
|
476
|
-
for (const entry of entries) {
|
|
477
|
-
if (phaseOf(entry.id).kind !== "awaiting-thread") continue;
|
|
478
|
-
phases.set(entry.id, { kind: "idle" });
|
|
479
|
-
const key = keyOf(entry);
|
|
480
|
-
held2 || (held2 = handedKey !== null && key !== handedKey || !mayHandOff(entry));
|
|
481
|
-
if (held2) continue;
|
|
482
|
-
handedKey = key;
|
|
483
|
-
handOff(entry, true);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
if (!loaded || !gateOpen()) {
|
|
488
|
-
stopCountdown();
|
|
489
|
-
publish();
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
const line = computeLine();
|
|
493
|
-
if (line.askId !== null && !asked.has(line.askId)) {
|
|
494
|
-
asked.add(line.askId);
|
|
495
|
-
const entry = entries.find((candidate) => candidate.id === line.askId);
|
|
496
|
-
if (entry) emit({ type: "asked", threadId, messageId: entry.id, ageMs: now() - entry.queuedAt });
|
|
497
366
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
stopCountdown();
|
|
507
|
-
} else if (countdown === null || countdown.ids.length !== run.length || run.some((entry, index) => (countdown == null ? void 0 : countdown.ids[index]) !== entry.id)) {
|
|
508
|
-
startCountdown(run);
|
|
367
|
+
if (outbox) startMigration(outbox);
|
|
368
|
+
if (legacy && legacyAwaitingDelivery.size > 0) {
|
|
369
|
+
const delivered = thread.view().messageIds;
|
|
370
|
+
for (const [messageId, legacyId] of legacyAwaitingDelivery) {
|
|
371
|
+
if (!delivered.has(messageId)) continue;
|
|
372
|
+
legacyAwaitingDelivery.delete(messageId);
|
|
373
|
+
void legacy.reader.remove(threadId, legacyId).catch(() => void 0);
|
|
374
|
+
}
|
|
509
375
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
for (const record of mine) {
|
|
520
|
-
if (!settledFor(record.entry.id, listing)) continue;
|
|
521
|
-
if (record.memoryOnly) persisted.delete(record.entry.id);
|
|
522
|
-
else persisted.add(record.entry.id);
|
|
523
|
-
const phase = phaseOf(record.entry.id);
|
|
524
|
-
if (record.failure && phase.kind !== "failed" && !isBusy(phase)) {
|
|
525
|
-
phases.set(record.entry.id, { kind: "failed", reason: record.failure.reason });
|
|
376
|
+
let current = readRows(outbox);
|
|
377
|
+
const dropped = /* @__PURE__ */ new Set();
|
|
378
|
+
for (const row of current) {
|
|
379
|
+
landing.delete(row.entry.id);
|
|
380
|
+
if (!dropOnLanding.delete(row.entry.id) || !outbox) continue;
|
|
381
|
+
dropped.add(row.stored.id);
|
|
382
|
+
try {
|
|
383
|
+
outbox.remove(row.stored.id);
|
|
384
|
+
} catch {
|
|
526
385
|
}
|
|
527
386
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
)
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
387
|
+
current = current.filter((row) => !dropped.has(row.stored.id));
|
|
388
|
+
const shown = current.length > 0 ? thread.view().messageIds : /* @__PURE__ */ new Set();
|
|
389
|
+
for (const row of current) {
|
|
390
|
+
if (!shown.has(row.entry.id) || !outbox) continue;
|
|
391
|
+
try {
|
|
392
|
+
outbox.remove(row.stored.id);
|
|
393
|
+
} catch {
|
|
394
|
+
}
|
|
395
|
+
emit({ type: "adopted", threadId, messageId: row.entry.id });
|
|
396
|
+
}
|
|
397
|
+
current = current.filter((row) => !shown.has(row.entry.id));
|
|
398
|
+
const heldIds = new Set(current.map((row) => row.stored.id));
|
|
399
|
+
for (const id of released) if (!heldIds.has(id)) released.delete(id);
|
|
400
|
+
for (const id of checking) if (!heldIds.has(id)) checking.delete(id);
|
|
401
|
+
for (const row of current) if (row.meta.error) failing.delete(row.stored.id);
|
|
402
|
+
for (const id of failing) if (!heldIds.has(id)) failing.delete(id);
|
|
403
|
+
for (const key of entryCache.keys()) if (!key.startsWith("pending:") && !heldIds.has(key)) entryCache.delete(key);
|
|
404
|
+
rows = current;
|
|
405
|
+
const open = gateOpen();
|
|
406
|
+
if (open && openSince === null) openSince = now();
|
|
407
|
+
if (!open) openSince = null;
|
|
408
|
+
let line = [];
|
|
409
|
+
let endsAt = null;
|
|
410
|
+
if (open && openSince !== null) {
|
|
411
|
+
line = lineOf(current);
|
|
412
|
+
const head = current.find(
|
|
413
|
+
(row) => !row.meta.error && !failing.has(row.stored.id) && !checking.has(row.stored.id) && !released.has(row.stored.id)
|
|
414
|
+
);
|
|
415
|
+
if (head && isAsk(head) && !asked.has(head.stored.id)) {
|
|
416
|
+
asked.add(head.stored.id);
|
|
417
|
+
emit({ type: "asked", threadId, messageId: head.entry.id, ageMs: now() - head.entry.queuedAt });
|
|
418
|
+
}
|
|
419
|
+
const since = openSince;
|
|
420
|
+
const starting = line.filter((row) => !countdownCurrent(row.meta, since));
|
|
421
|
+
for (const row of line) if (countdownCurrent(row.meta, since)) countdownRequested.delete(row.stored.id);
|
|
422
|
+
const toRequest = starting.filter((row) => !countdownRequested.has(row.stored.id));
|
|
423
|
+
if (toRequest.length > 0 && outbox) {
|
|
424
|
+
const from = now();
|
|
425
|
+
for (const row of toRequest) {
|
|
426
|
+
countdownRequested.add(row.stored.id);
|
|
427
|
+
try {
|
|
428
|
+
outbox.update(row.stored.id, (stored) => {
|
|
429
|
+
const meta = readChatOutboxLocalMeta(stored.localMeta);
|
|
430
|
+
if (stored.state !== "held" || countdownCurrent(meta, since)) return {};
|
|
431
|
+
const base = isRecord(stored.localMeta) ? stored.localMeta : {};
|
|
432
|
+
return { localMeta: { ...base, countdownFrom: from, countdownEndsAt: from + countdownMs } };
|
|
433
|
+
});
|
|
434
|
+
} catch {
|
|
435
|
+
countdownRequested.delete(row.stored.id);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
emit({ type: "countdown-started", threadId, count: line.length });
|
|
439
|
+
}
|
|
440
|
+
endsAt = lineEndsAt(line);
|
|
441
|
+
}
|
|
442
|
+
if (endsAt !== null && endsAt <= now()) {
|
|
443
|
+
timer == null ? void 0 : timer.cancel();
|
|
444
|
+
timer = null;
|
|
445
|
+
for (const row of line) release(row, true);
|
|
446
|
+
queueMicrotask(evaluate);
|
|
447
|
+
publish(current, [], null);
|
|
448
|
+
return;
|
|
537
449
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
450
|
+
if (endsAt === null) {
|
|
451
|
+
timer == null ? void 0 : timer.cancel();
|
|
452
|
+
timer = null;
|
|
453
|
+
} else if ((timer == null ? void 0 : timer.at) !== endsAt) {
|
|
454
|
+
timer == null ? void 0 : timer.cancel();
|
|
455
|
+
const at = endsAt;
|
|
456
|
+
timer = {
|
|
457
|
+
at,
|
|
458
|
+
cancel: setTimer(
|
|
459
|
+
() => {
|
|
460
|
+
if ((timer == null ? void 0 : timer.at) === at) timer = null;
|
|
461
|
+
evaluate();
|
|
462
|
+
},
|
|
463
|
+
Math.max(0, at - now())
|
|
464
|
+
)
|
|
465
|
+
};
|
|
543
466
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
} else {
|
|
552
|
-
byThread.set(record.entry.threadId, {
|
|
553
|
-
count: 1,
|
|
554
|
-
first: record.entry,
|
|
555
|
-
newChat: record.entry.newChat
|
|
556
|
-
});
|
|
557
|
-
}
|
|
467
|
+
publish(current, line, endsAt);
|
|
468
|
+
}
|
|
469
|
+
const findRow = (id) => rows.find((row) => row.entry.id === id);
|
|
470
|
+
const forgetLegacy = (row) => {
|
|
471
|
+
legacyAwaitingDelivery.delete(row.entry.id);
|
|
472
|
+
if (legacy && row.meta.legacyId !== void 0) {
|
|
473
|
+
void legacy.reader.remove(threadId, row.meta.legacyId).catch(() => void 0);
|
|
558
474
|
}
|
|
559
|
-
elsewhere = [...byThread].map(([otherThreadId, other]) => ({ threadId: otherThreadId, ...other })).sort((a, b) => a.first.queuedAt - b.first.queuedAt);
|
|
560
475
|
};
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
476
|
+
const buildInsert = (id, input) => {
|
|
477
|
+
const queuedAt = now();
|
|
478
|
+
const newChat = typeof isNewChat === "function" ? isNewChat() : isNewChat;
|
|
479
|
+
const files = input.files ?? [];
|
|
480
|
+
const metadata = withAddressedAgents(input.metadata, input.addressedAgents);
|
|
481
|
+
const parts = [
|
|
482
|
+
...files.map((file) => ({
|
|
483
|
+
type: "file",
|
|
484
|
+
mediaType: file.mediaType,
|
|
485
|
+
url: file.url,
|
|
486
|
+
...file.filename !== void 0 && { filename: file.filename }
|
|
487
|
+
})),
|
|
488
|
+
...input.text.length > 0 ? [{ type: "text", text: input.text }] : []
|
|
489
|
+
];
|
|
490
|
+
const view = thread.view();
|
|
491
|
+
const params = {
|
|
492
|
+
type: "run/send",
|
|
493
|
+
behavior: "auto",
|
|
494
|
+
runId: view.runId ?? randomId(),
|
|
495
|
+
message: { id, role: "user", parts, ...metadata !== void 0 && { metadata } },
|
|
496
|
+
...view.runId === null && {
|
|
497
|
+
runAnchorMessageId: view.wireMessages && view.wireMessages.length > 0 ? chatOutboxWireAnchorId(view.wireMessages) : null
|
|
579
498
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
499
|
+
};
|
|
500
|
+
const attachments = input.attachments && input.attachments.length > 0 ? input.attachments : void 0;
|
|
501
|
+
const localMeta = {
|
|
502
|
+
kind: CHAT_OUTBOX_LOCAL_META_KIND,
|
|
503
|
+
threadId,
|
|
504
|
+
queuedAt,
|
|
505
|
+
newChat,
|
|
506
|
+
...input.composerMarkdown !== void 0 && { composerMarkdown: input.composerMarkdown },
|
|
507
|
+
...input.composerHtml !== void 0 && { composerHtml: input.composerHtml },
|
|
508
|
+
...attachments && { attachments }
|
|
509
|
+
};
|
|
510
|
+
const entry = {
|
|
511
|
+
id,
|
|
512
|
+
threadId,
|
|
513
|
+
text: input.text,
|
|
514
|
+
queuedAt,
|
|
515
|
+
newChat,
|
|
516
|
+
durable: false,
|
|
517
|
+
...input.composerMarkdown !== void 0 && { composerMarkdown: input.composerMarkdown },
|
|
518
|
+
...input.composerHtml !== void 0 && { composerHtml: input.composerHtml },
|
|
519
|
+
...metadata !== void 0 && { metadata },
|
|
520
|
+
...files.length > 0 && { files },
|
|
521
|
+
...attachments && { attachments }
|
|
522
|
+
};
|
|
523
|
+
return {
|
|
524
|
+
entry,
|
|
525
|
+
insert: {
|
|
526
|
+
protocol: DEEP_AGENT_STATEWIRE_PROTOCOL,
|
|
527
|
+
command: { method: "run/send", params: [params] },
|
|
528
|
+
held: true,
|
|
529
|
+
localMeta
|
|
587
530
|
}
|
|
588
|
-
}
|
|
531
|
+
};
|
|
589
532
|
};
|
|
590
533
|
const unsubscribers = [
|
|
591
534
|
reachability.subscribe(evaluate),
|
|
592
535
|
foreground.subscribe(evaluate),
|
|
593
536
|
thread.subscribe(evaluate),
|
|
594
|
-
...
|
|
595
|
-
...store ? [store.subscribe(reload)] : []
|
|
537
|
+
...directory ? [directory.subscribe(evaluate)] : []
|
|
596
538
|
];
|
|
597
|
-
|
|
598
|
-
publish();
|
|
539
|
+
evaluate();
|
|
599
540
|
return {
|
|
600
541
|
threadId,
|
|
601
542
|
reachability,
|
|
@@ -607,117 +548,120 @@ function createChatOutbox(options) {
|
|
|
607
548
|
};
|
|
608
549
|
},
|
|
609
550
|
shouldHold() {
|
|
551
|
+
if (thread.outbox() === null && pending.length === 0) return false;
|
|
610
552
|
if (!reachability.get()) return true;
|
|
611
|
-
|
|
612
|
-
return entries.some((entry) => {
|
|
613
|
-
const phase = phaseOf(entry.id);
|
|
614
|
-
return phase.kind !== "failed" && !(phase.kind === "handed" && phase.journaled);
|
|
615
|
-
});
|
|
553
|
+
return pending.length > 0 || landing.size > 0 || readRows(thread.outbox()).length > 0;
|
|
616
554
|
},
|
|
617
555
|
hold(input) {
|
|
618
|
-
const
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
...input.attachments !== void 0 && input.attachments.length > 0 && { attachments: input.attachments }
|
|
630
|
-
};
|
|
631
|
-
if (!loaded && gateOpen()) sendNow.add(entry.id);
|
|
632
|
-
entries = [...entries, entry];
|
|
633
|
-
if (store) {
|
|
634
|
-
persisted.add(entry.id);
|
|
635
|
-
const write = store.put(entry);
|
|
636
|
-
markUnsettled(entry.id, write);
|
|
637
|
-
void write.then(
|
|
638
|
-
(kept) => {
|
|
639
|
-
if (!kept) persisted.delete(entry.id);
|
|
640
|
-
emit({ type: "held", threadId, messageId: entry.id, durable: kept });
|
|
641
|
-
publish();
|
|
642
|
-
},
|
|
643
|
-
() => {
|
|
644
|
-
persisted.delete(entry.id);
|
|
645
|
-
emit({ type: "held", threadId, messageId: entry.id, durable: false });
|
|
646
|
-
publish();
|
|
647
|
-
}
|
|
648
|
-
);
|
|
649
|
-
} else {
|
|
650
|
-
emit({ type: "held", threadId, messageId: entry.id, durable: false });
|
|
556
|
+
const built = buildInsert(newMessageId(), input);
|
|
557
|
+
const outbox = thread.outbox();
|
|
558
|
+
let inserted = false;
|
|
559
|
+
if (outbox && pending.length === 0) {
|
|
560
|
+
try {
|
|
561
|
+
outbox.insert(built.insert);
|
|
562
|
+
landing.set(built.entry.id, built.entry);
|
|
563
|
+
inserted = true;
|
|
564
|
+
} catch {
|
|
565
|
+
inserted = false;
|
|
566
|
+
}
|
|
651
567
|
}
|
|
568
|
+
if (!inserted) pending = [...pending, built];
|
|
569
|
+
else emit({ type: "held", threadId, messageId: built.entry.id, durable: true });
|
|
652
570
|
evaluate();
|
|
653
|
-
|
|
571
|
+
const row = findRow(built.entry.id);
|
|
572
|
+
return (row == null ? void 0 : row.entry) ?? built.entry;
|
|
654
573
|
},
|
|
655
574
|
cancel(id) {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
575
|
+
var _a, _b;
|
|
576
|
+
const row = findRow(id);
|
|
577
|
+
if (!row) {
|
|
578
|
+
const waiting = ((_a = pending.find((item) => item.entry.id === id)) == null ? void 0 : _a.entry) ?? landing.get(id);
|
|
579
|
+
if (!waiting) return;
|
|
580
|
+
pending = pending.filter((item) => item.entry !== waiting);
|
|
581
|
+
if (landing.delete(id)) dropOnLanding.add(id);
|
|
582
|
+
emit({ type: "cancelled", threadId, messageId: id });
|
|
583
|
+
try {
|
|
584
|
+
restore(waiting);
|
|
585
|
+
} finally {
|
|
586
|
+
evaluate();
|
|
587
|
+
}
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
try {
|
|
591
|
+
(_b = thread.outbox()) == null ? void 0 : _b.remove(row.stored.id);
|
|
592
|
+
} catch {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
forgetLegacy(row);
|
|
659
596
|
emit({ type: "cancelled", threadId, messageId: id });
|
|
660
|
-
if (store) void store.remove(threadId, id).catch(() => void 0);
|
|
661
597
|
try {
|
|
662
|
-
restore(entry);
|
|
598
|
+
restore(row.entry);
|
|
663
599
|
} finally {
|
|
664
600
|
evaluate();
|
|
665
601
|
}
|
|
666
602
|
},
|
|
667
603
|
send(id) {
|
|
668
|
-
const
|
|
669
|
-
if (!
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
handedInRegain.delete(id);
|
|
673
|
-
sendNow.add(id);
|
|
674
|
-
if (wasFailed && store) {
|
|
675
|
-
const write = store.clearFailure({ threadId, id });
|
|
676
|
-
markUnsettled(id, write);
|
|
677
|
-
void write.catch(() => void 0);
|
|
678
|
-
}
|
|
604
|
+
const row = findRow(id);
|
|
605
|
+
if (!row || released.has(row.stored.id)) return;
|
|
606
|
+
failing.delete(row.stored.id);
|
|
607
|
+
release(row, false);
|
|
679
608
|
evaluate();
|
|
680
609
|
},
|
|
681
|
-
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
610
|
+
edit(id, input) {
|
|
611
|
+
const row = findRow(id);
|
|
612
|
+
const outbox = thread.outbox();
|
|
613
|
+
if (!row || !outbox) return;
|
|
614
|
+
const rebuilt = buildInsert(id, input);
|
|
615
|
+
const message = rebuilt.insert.command.params[0].message;
|
|
616
|
+
try {
|
|
617
|
+
outbox.update(row.stored.id, (current) => {
|
|
618
|
+
if (current.state !== "held") return {};
|
|
619
|
+
const params = current.command.params[0];
|
|
620
|
+
const stripped = withoutTransientLocalMeta(current.localMeta);
|
|
621
|
+
const base = isRecord(stripped) ? stripped : {};
|
|
622
|
+
const { composerMarkdown: _md, composerHtml: _html, attachments: _attachments, ...kept } = base;
|
|
623
|
+
return {
|
|
624
|
+
localMeta: { ...kept, ...rebuilt.insert.localMeta, queuedAt: row.entry.queuedAt },
|
|
625
|
+
command: { params: [{ ...isRecord(params) ? params : {}, message }, ...current.command.params.slice(1)] }
|
|
626
|
+
};
|
|
627
|
+
});
|
|
628
|
+
} catch {
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
evaluate();
|
|
632
|
+
failing.delete(row.stored.id);
|
|
633
|
+
const edited = findRow(id);
|
|
634
|
+
if (edited) release(edited, false);
|
|
687
635
|
evaluate();
|
|
688
636
|
},
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
const
|
|
692
|
-
if (
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
if (
|
|
696
|
-
|
|
637
|
+
discard(id) {
|
|
638
|
+
var _a;
|
|
639
|
+
const row = findRow(id);
|
|
640
|
+
if (!row) {
|
|
641
|
+
if (!pending.some((item) => item.entry.id === id) && !landing.has(id)) return;
|
|
642
|
+
pending = pending.filter((item) => item.entry.id !== id);
|
|
643
|
+
if (landing.delete(id)) dropOnLanding.add(id);
|
|
644
|
+
} else {
|
|
645
|
+
try {
|
|
646
|
+
(_a = thread.outbox()) == null ? void 0 : _a.remove(row.stored.id);
|
|
647
|
+
} catch {
|
|
697
648
|
return;
|
|
698
649
|
}
|
|
699
|
-
|
|
700
|
-
evaluate();
|
|
701
|
-
return;
|
|
650
|
+
forgetLegacy(row);
|
|
702
651
|
}
|
|
703
|
-
|
|
652
|
+
emit({ type: "discarded", threadId, messageId: id });
|
|
653
|
+
evaluate();
|
|
704
654
|
},
|
|
705
655
|
openThread: openThread ?? null,
|
|
706
656
|
dispose() {
|
|
707
657
|
if (disposed) return;
|
|
708
658
|
disposed = true;
|
|
709
|
-
|
|
710
|
-
|
|
659
|
+
timer == null ? void 0 : timer.cancel();
|
|
660
|
+
timer = null;
|
|
711
661
|
for (const stop of checkTimers) stop();
|
|
712
662
|
checkTimers.clear();
|
|
713
|
-
readyToGo.clear();
|
|
714
663
|
for (const unsubscribe of unsubscribers) unsubscribe();
|
|
715
664
|
listeners.clear();
|
|
716
|
-
if (store) {
|
|
717
|
-
for (const [id, phase] of phases) {
|
|
718
|
-
if (phase.kind === "claiming") releaseClaim(id);
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
665
|
}
|
|
722
666
|
};
|
|
723
667
|
}
|
|
@@ -726,12 +670,13 @@ export {
|
|
|
726
670
|
CHAT_EDIT_UNREACHABLE_LABEL,
|
|
727
671
|
CHAT_OUTBOX_ASK_AFTER_MS,
|
|
728
672
|
CHAT_OUTBOX_ATTACHMENT_CHECK_TIMEOUT_MS,
|
|
729
|
-
|
|
673
|
+
CHAT_OUTBOX_ATTACHMENT_REFUSED_CODE,
|
|
674
|
+
CHAT_OUTBOX_ATTACHMENT_UNKNOWN_CODE,
|
|
730
675
|
CHAT_OUTBOX_COUNTDOWN_MS,
|
|
731
676
|
ChatEditUnreachableError,
|
|
732
|
-
chatOutboxCommandMessageId,
|
|
733
677
|
chatOutboxFailureMessage,
|
|
734
678
|
createChatOutbox,
|
|
679
|
+
reanchorHeldSendParams,
|
|
735
680
|
sameChatOutboxSnapshot
|
|
736
681
|
};
|
|
737
682
|
//# sourceMappingURL=chat-outbox.js.map
|