@athenaintel/react 0.57.1 → 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 +778 -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 +337 -99
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +80 -4
- package/dist/chat/AthenaChat.js +337 -99
- 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 +63 -19
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +24 -8
- package/dist/provider/AthenaProvider.js +66 -22
- 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 +18 -1
- package/dist/runtime/statewire-run-config.cjs.map +1 -1
- package/dist/runtime/statewire-run-config.d.ts +20 -0
- package/dist/runtime/statewire-run-config.js +18 -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 +27 -24
- package/dist/threads/SessionList.cjs.map +1 -1
- package/dist/threads/SessionList.js +22 -19
- package/dist/threads/SessionList.js.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/live-session-rows.cjs +207 -0
- package/dist/threads/live-session-rows.cjs.map +1 -0
- package/dist/threads/live-session-rows.d.ts +175 -0
- package/dist/threads/live-session-rows.js +207 -0
- package/dist/threads/live-session-rows.js.map +1 -0
- 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/statewire-thread-list.cjs +173 -20
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +44 -1
- package/dist/threads/statewire-thread-list.js +174 -21
- package/dist/threads/statewire-thread-list.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,54 +1,50 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
1
|
+
import { type DeepAgentOutbox, type DeepAgentSettledUpdate } from './statewire-held-sends';
|
|
2
|
+
import type { StatewireDiagnosticsRecorder } from './statewire-diagnostics';
|
|
3
3
|
/** How many times a host may hold one message's retry (`beforeRetry`
|
|
4
|
-
* returning a promise) before the
|
|
5
|
-
* host's own bounded wait, never a reason to keep a message back for good. */
|
|
4
|
+
* returning a promise) before the controller re-queues it regardless: a hold
|
|
5
|
+
* is the host's own bounded wait, never a reason to keep a message back for good. */
|
|
6
6
|
export declare const MAX_BEFORE_RETRY_HOLDS = 10;
|
|
7
7
|
export interface DeepAgentSendRecoveryOptions {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* the controller stays armed and retries on the next state change.
|
|
9
|
+
* The thread's outbox (`extras.outbox`). `null` while it is unavailable;
|
|
10
|
+
* the update is then left for the next delivery.
|
|
12
11
|
*/
|
|
13
|
-
|
|
12
|
+
outbox: () => Pick<DeepAgentOutbox, 'insert'> | null;
|
|
14
13
|
/**
|
|
15
14
|
* Persisted failure stamps (message id → epoch ms of the original send) for
|
|
16
15
|
* the freshness gate. `null`/absent means no persistence is readable — every
|
|
17
|
-
*
|
|
18
|
-
* failures from this page session).
|
|
16
|
+
* failure then counts as fresh.
|
|
19
17
|
*/
|
|
20
18
|
failureStamps?: (() => ReadonlyMap<string, number> | null) | undefined;
|
|
21
19
|
/** Transport lifecycle recorder; read per event so a late-mounted recorder still sees retries. */
|
|
22
20
|
diagnostics?: (() => StatewireDiagnosticsRecorder | undefined) | undefined;
|
|
23
21
|
/** Injectable clock (tests). */
|
|
24
22
|
now?: () => number;
|
|
25
|
-
/** Sweep scheduler; defaults to `queueMicrotask` so a sweep never dispatches
|
|
26
|
-
* from inside a statewire flush or a React render. */
|
|
27
|
-
schedule?: (task: () => void) => void;
|
|
28
23
|
/**
|
|
29
|
-
* Called right before a failed send is
|
|
30
|
-
*
|
|
31
|
-
*
|
|
24
|
+
* Called right before a failed send is re-queued, with its message id, so a
|
|
25
|
+
* host can put back the per-send context that message was sent with
|
|
26
|
+
* (Olympus stages the agents it named) before its command leaves.
|
|
32
27
|
*
|
|
33
28
|
* Returning a promise holds the retry: the host can't put that context back
|
|
34
29
|
* yet (every send of the conversation rides one ambient context, and a send
|
|
35
|
-
* with another context is still on its way).
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
30
|
+
* with another context is still on its way). Delivery then waits, so nothing
|
|
31
|
+
* behind it overtakes it, and asks again once the promise settles; past
|
|
32
|
+
* {@link MAX_BEFORE_RETRY_HOLDS} holds it re-queues the message regardless.
|
|
33
|
+
* A hook that throws never holds a retry back. A function returned is
|
|
34
|
+
* called when the message does not go after all, so the host lets go of
|
|
35
|
+
* what it put back.
|
|
41
36
|
*/
|
|
42
37
|
beforeRetry?: ((messageId: string) => void | PromiseLike<void> | (() => void)) | undefined;
|
|
43
38
|
}
|
|
44
39
|
export interface DeepAgentSendRecovery {
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Handles one command update (`onCommandChange`): returns a promise for a
|
|
42
|
+
* failed run send it acts on — a durable `settled` update is acked once it
|
|
43
|
+
* resolves — and `undefined` otherwise.
|
|
44
|
+
*/
|
|
45
|
+
onCommandChange(update: DeepAgentSettledUpdate, ctx?: {
|
|
46
|
+
state?: unknown;
|
|
47
|
+
}): Promise<void> | undefined;
|
|
52
48
|
dispose(): void;
|
|
53
49
|
}
|
|
54
50
|
/** Whether a settle failure is a client-side death the recovery re-dispatches
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { runSendMessageId, requeueFailedRunSend, runSendThreadOfState } from "./statewire-held-sends.js";
|
|
2
2
|
const AUTO_RETRY_FATES = /* @__PURE__ */ new Set(["lost", "aborted"]);
|
|
3
3
|
const MAX_AUTO_RETRIES_PER_MESSAGE = 3;
|
|
4
4
|
const MAX_AUTO_RETRY_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -6,148 +6,120 @@ const MAX_BEFORE_RETRY_HOLDS = 10;
|
|
|
6
6
|
function shouldAutoRetryFailedSend(failure) {
|
|
7
7
|
return failure !== void 0 && AUTO_RETRY_FATES.has(failure.fate);
|
|
8
8
|
}
|
|
9
|
-
function awaitsLostPredecessor(entry) {
|
|
10
|
-
return entry.sendFailure.fate === "aborted" && entry.sendFailure.predecessorLost === true;
|
|
11
|
-
}
|
|
12
9
|
function isThenable(value) {
|
|
13
10
|
return typeof value === "object" && value !== null && typeof value.then === "function";
|
|
14
11
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
function idsOf(list, into) {
|
|
13
|
+
if (!Array.isArray(list)) return;
|
|
14
|
+
for (const item of list) {
|
|
15
|
+
const id = item == null ? void 0 : item.id;
|
|
16
|
+
if (typeof id === "string") into.add(id);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function stateHoldsMessage(state, messageId) {
|
|
20
|
+
var _a;
|
|
21
|
+
if (!state || typeof state !== "object") return false;
|
|
22
|
+
const value = state;
|
|
23
|
+
const ids = /* @__PURE__ */ new Set();
|
|
24
|
+
idsOf(value.messages, ids);
|
|
25
|
+
if (Array.isArray(value.runs)) {
|
|
26
|
+
for (const run of value.runs) {
|
|
27
|
+
const entry = run;
|
|
28
|
+
idsOf(entry == null ? void 0 : entry.queue, ids);
|
|
29
|
+
idsOf(entry == null ? void 0 : entry.steerQueue, ids);
|
|
30
|
+
idsOf((_a = entry == null ? void 0 : entry.dispatching) == null ? void 0 : _a.messages, ids);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return ids.has(messageId);
|
|
20
34
|
}
|
|
21
35
|
function createDeepAgentSendRecovery(options) {
|
|
22
36
|
const now = options.now ?? Date.now;
|
|
23
|
-
const schedule = options.schedule ?? ((task) => queueMicrotask(task));
|
|
24
37
|
let disposed = false;
|
|
25
|
-
let hydrated = false;
|
|
26
|
-
let armed = false;
|
|
27
|
-
let sweepScheduled = false;
|
|
28
38
|
const attempts = /* @__PURE__ */ new Map();
|
|
29
|
-
|
|
30
|
-
const surfacedDeferrals = /* @__PURE__ */ new Set();
|
|
31
|
-
const inFlight = /* @__PURE__ */ new Set();
|
|
32
|
-
const deferred = /* @__PURE__ */ new Set();
|
|
33
|
-
const holds = /* @__PURE__ */ new Map();
|
|
34
|
-
let holding = false;
|
|
39
|
+
let lostPredecessorHeld = false;
|
|
35
40
|
const record = (event, data) => {
|
|
36
41
|
var _a, _b;
|
|
37
42
|
(_b = (_a = options.diagnostics) == null ? void 0 : _a.call(options)) == null ? void 0 : _b.record(event, data);
|
|
38
43
|
};
|
|
39
|
-
const
|
|
40
|
-
var _a
|
|
41
|
-
|
|
42
|
-
if (disposed || holding || !hydrated || !armed) return;
|
|
43
|
-
const lane = options.lane();
|
|
44
|
-
if (lane === null) return;
|
|
45
|
-
armed = false;
|
|
46
|
-
deferred.clear();
|
|
47
|
-
const stamps = ((_a = options.failureStamps) == null ? void 0 : _a.call(options)) ?? null;
|
|
48
|
-
let lostPredecessorPending = false;
|
|
49
|
-
for (const entry of lane.failed) {
|
|
50
|
-
if (!shouldAutoRetryFailedSend(entry.sendFailure)) continue;
|
|
51
|
-
if (inFlight.has(entry.id)) {
|
|
52
|
-
if (entry.sendFailure.fate === "lost") lostPredecessorPending = true;
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
if (awaitsLostPredecessor(entry) && (lostPredecessorPending || inFlight.size > 0)) {
|
|
56
|
-
deferred.add(entry.id);
|
|
57
|
-
if (!surfacedDeferrals.has(entry.id)) {
|
|
58
|
-
surfacedDeferrals.add(entry.id);
|
|
59
|
-
record("send-recovery/deferred", { messageId: entry.id });
|
|
60
|
-
}
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
const isLost = entry.sendFailure.fate === "lost";
|
|
64
|
-
const stamp = stamps == null ? void 0 : stamps.get(entry.id);
|
|
65
|
-
if (stamp !== void 0 && now() - stamp > MAX_AUTO_RETRY_AGE_MS) {
|
|
66
|
-
if (!surfacedSkips.has(entry.id)) {
|
|
67
|
-
surfacedSkips.add(entry.id);
|
|
68
|
-
record("send-recovery/stale", { messageId: entry.id, ageMs: Math.round(now() - stamp) });
|
|
69
|
-
}
|
|
70
|
-
if (isLost) lostPredecessorPending = true;
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
const attempt = (attempts.get(entry.id) ?? 0) + 1;
|
|
74
|
-
if (attempt > MAX_AUTO_RETRIES_PER_MESSAGE) {
|
|
75
|
-
if (!surfacedSkips.has(entry.id)) {
|
|
76
|
-
surfacedSkips.add(entry.id);
|
|
77
|
-
record("send-recovery/exhausted", { messageId: entry.id });
|
|
78
|
-
}
|
|
79
|
-
if (isLost) lostPredecessorPending = true;
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
44
|
+
const prepareRetry = async (messageId) => {
|
|
45
|
+
var _a;
|
|
46
|
+
for (let held = 1; ; held++) {
|
|
82
47
|
let before;
|
|
83
48
|
try {
|
|
84
|
-
before = (
|
|
49
|
+
before = (_a = options.beforeRetry) == null ? void 0 : _a.call(options, messageId);
|
|
85
50
|
} catch {
|
|
86
|
-
record("send-recovery/before-retry-failed", { messageId
|
|
51
|
+
record("send-recovery/before-retry-failed", { messageId });
|
|
52
|
+
return void 0;
|
|
87
53
|
}
|
|
88
|
-
if (isThenable(before))
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
armed = true;
|
|
94
|
-
record("send-recovery/held", { messageId: entry.id, holds: held });
|
|
95
|
-
const resume = () => {
|
|
96
|
-
holding = false;
|
|
97
|
-
armed = true;
|
|
98
|
-
scheduleSweep();
|
|
99
|
-
};
|
|
100
|
-
before.then(resume, resume);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
record("send-recovery/held-too-long", { messageId: entry.id });
|
|
54
|
+
if (!isThenable(before)) return typeof before === "function" ? before : void 0;
|
|
55
|
+
if (held > MAX_BEFORE_RETRY_HOLDS) {
|
|
56
|
+
Promise.resolve(before).catch(() => void 0);
|
|
57
|
+
record("send-recovery/held-too-long", { messageId });
|
|
58
|
+
return void 0;
|
|
104
59
|
}
|
|
60
|
+
record("send-recovery/held", { messageId, holds: held });
|
|
105
61
|
try {
|
|
106
|
-
|
|
107
|
-
attempts.set(entry.id, attempt);
|
|
108
|
-
inFlight.add(entry.id);
|
|
109
|
-
if (isLost) lostPredecessorPending = true;
|
|
110
|
-
record("send-recovery/retry", {
|
|
111
|
-
messageId: entry.id,
|
|
112
|
-
fate: entry.sendFailure.fate,
|
|
113
|
-
attempt
|
|
114
|
-
});
|
|
62
|
+
await before;
|
|
115
63
|
} catch {
|
|
116
|
-
record("send-recovery/raced", { messageId: entry.id });
|
|
117
|
-
try {
|
|
118
|
-
if (typeof before === "function") before();
|
|
119
|
-
} catch {
|
|
120
|
-
}
|
|
121
64
|
}
|
|
65
|
+
if (disposed) return void 0;
|
|
122
66
|
}
|
|
123
|
-
if (deferred.size > 0) armed = true;
|
|
124
67
|
};
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
68
|
+
const handle = async (update, messageId, state) => {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
const failure = update.failure;
|
|
71
|
+
const outbox = options.outbox();
|
|
72
|
+
if (outbox === null) throw new Error("send recovery: the thread has no outbox yet");
|
|
73
|
+
const hold = (reason) => {
|
|
74
|
+
if (failure.fate === "lost") lostPredecessorHeld = true;
|
|
75
|
+
requeueFailedRunSend({ outbox, update, held: true });
|
|
76
|
+
record(`send-recovery/${reason}`, { messageId, fate: failure.fate });
|
|
77
|
+
};
|
|
78
|
+
if (!shouldAutoRetryFailedSend(failure)) return hold("held");
|
|
79
|
+
if (failure.fate === "aborted" && "predecessorLost" in failure && failure.predecessorLost === true && lostPredecessorHeld)
|
|
80
|
+
return hold("deferred");
|
|
81
|
+
const stamp = (_b = (_a = options.failureStamps) == null ? void 0 : _a.call(options)) == null ? void 0 : _b.get(messageId);
|
|
82
|
+
if (stamp !== void 0 && now() - stamp > MAX_AUTO_RETRY_AGE_MS) {
|
|
83
|
+
record("send-recovery/stale", { messageId, ageMs: Math.round(now() - stamp) });
|
|
84
|
+
return hold("held");
|
|
85
|
+
}
|
|
86
|
+
const attempt = (attempts.get(messageId) ?? 0) + 1;
|
|
87
|
+
if (attempt > MAX_AUTO_RETRIES_PER_MESSAGE) {
|
|
88
|
+
record("send-recovery/exhausted", { messageId });
|
|
89
|
+
return hold("held");
|
|
90
|
+
}
|
|
91
|
+
const release = await prepareRetry(messageId);
|
|
92
|
+
if (disposed) {
|
|
93
|
+
release == null ? void 0 : release();
|
|
94
|
+
throw new Error("send recovery: disposed before the retry");
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
requeueFailedRunSend({ outbox, update, held: false, thread: runSendThreadOfState(state) });
|
|
98
|
+
} catch (error) {
|
|
99
|
+
record("send-recovery/raced", { messageId });
|
|
100
|
+
try {
|
|
101
|
+
release == null ? void 0 : release();
|
|
102
|
+
} catch {
|
|
103
|
+
}
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
attempts.set(messageId, attempt);
|
|
107
|
+
record("send-recovery/retry", { messageId, fate: failure.fate, attempt });
|
|
129
108
|
};
|
|
130
109
|
return {
|
|
131
|
-
|
|
132
|
-
if (disposed) return;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
110
|
+
onCommandChange(update, ctx) {
|
|
111
|
+
if (disposed || update.status !== "settled" || update.failure === void 0) return void 0;
|
|
112
|
+
const messageId = runSendMessageId(update);
|
|
113
|
+
if (messageId === null) return void 0;
|
|
114
|
+
const { failure } = update;
|
|
115
|
+
if (failure.cause === "removed" || failure.cause === "unmount") return void 0;
|
|
116
|
+
if (stateHoldsMessage(ctx == null ? void 0 : ctx.state, messageId) || failure.fate === "rejected" && failure.code === "duplicate-id") {
|
|
117
|
+
record("send-recovery/covered", { messageId, fate: failure.fate });
|
|
118
|
+
return void 0;
|
|
136
119
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (disposed || update.status !== "settled") return;
|
|
141
|
-
const messageId = commandMessageId(update);
|
|
142
|
-
if (messageId !== null) inFlight.delete(messageId);
|
|
143
|
-
if (!shouldAutoRetryFailedSend(update.failure) && deferred.size === 0) return;
|
|
144
|
-
armed = true;
|
|
145
|
-
scheduleSweep();
|
|
146
|
-
},
|
|
147
|
-
observeFailedLaneChange() {
|
|
148
|
-
if (disposed) return;
|
|
149
|
-
armed = true;
|
|
150
|
-
scheduleSweep();
|
|
120
|
+
const handled = handle(update, messageId, ctx == null ? void 0 : ctx.state);
|
|
121
|
+
handled.catch(() => void 0);
|
|
122
|
+
return handled;
|
|
151
123
|
},
|
|
152
124
|
dispose() {
|
|
153
125
|
disposed = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-recovery.js","sources":["../../../../agent-runtime/src/send-recovery.ts"],"sourcesContent":["import type {\n StatewireDiagnosticsCommandUpdate,\n StatewireDiagnosticsRecorder,\n} from './statewire-diagnostics';\nimport { isDeepAgentStateHydrated } from './statewire-state';\nimport type { StatewireFailedSendEntry, StatewireFailedSendLane } from './thread-extras';\n\n/**\n * Transport-level send durability for the deep-agent thread (the successor to\n * Olympus' localStorage outbox, #29368 → #31504).\n *\n * The durable journal itself is the statewire session record: every command is\n * persisted through the mounted session storage from `send()` until the server\n * durably admits or judges it, and a reload resends survivors on the SAME lane\n * seq (exactly-once — the server absorbs replayed seqs at or below its\n * watermark). What the record cannot recover on its own is a send the client\n * had to settle without a server verdict — a proven session loss or a record\n * reset settles it `lost`/`aborted` and RETAINS it in the record's failed lane\n * (message-carrying sends only), where the vendor drops it as soon as a\n * canonical snapshot shows the message landed (`failureCovered`).\n *\n * This controller turns that persisted failed lane back into live sends: once\n * the thread snapshot has hydrated (so covered entries are already gone), every\n * failed send the server NEVER judged is re-dispatched through the thread's own\n * `retryFailed` — same client-minted message id, re-anchored against the\n * current thread — which the host dedupes by id (a still-queued id re-places,\n * a durable one rejects `duplicate-id`). Server-judged fates (`rejected`,\n * `failed`, `crashed`, `expired`) are the user's decision and stay in the\n * manual retry/discard affordance.\n *\n * Ordering: an `aborted` send stamped `predecessorLost` was never attempted\n * because an earlier send of the same batch WAS attempted and settled `lost`\n * — it may or may not have run. Re-dispatching the successor first could land\n * it ahead of a predecessor that later turns out to have landed too, so the\n * successor is held until every preceding `lost` predecessor has settled: it\n * was covered by a snapshot, its retry was judged by the server, or the user\n * discarded it.\n */\n\n/** Fates the server never saw: the send died client-side (unmount, stream\n * gone, session lost) and is safe to re-dispatch under its original message\n * id. The complement — rejected/failed/crashed/expired — is server-judged. */\nconst AUTO_RETRY_FATES: ReadonlySet<string> = new Set(['lost', 'aborted']);\n\n/** A failed send is re-dispatched at most this many times per attach; a\n * persistent failure (repeated session losses) stays in the manual lane. */\nconst MAX_AUTO_RETRIES_PER_MESSAGE = 3;\n\n/** Persisted failures older than this stay manual: auto-sending a message the\n * user abandoned a day ago is worse than surfacing it for a decision. Mirrors\n * the retired outbox's retention window. */\nconst MAX_AUTO_RETRY_AGE_MS = 24 * 60 * 60 * 1000;\n\n/** How many times a host may hold one message's retry (`beforeRetry`\n * returning a promise) before the sweep sends it regardless: a hold is the\n * host's own bounded wait, never a reason to keep a message back for good. */\nexport const MAX_BEFORE_RETRY_HOLDS = 10;\n\nexport interface DeepAgentSendRecoveryOptions {\n /**\n * Reads the thread's failed-send lane. `null` while it is unavailable (the\n * client has not mounted yet, or its extras are not a statewire thread) —\n * the controller stays armed and retries on the next state change.\n */\n lane: () => StatewireFailedSendLane | null;\n /**\n * Persisted failure stamps (message id → epoch ms of the original send) for\n * the freshness gate. `null`/absent means no persistence is readable — every\n * lane entry then counts as fresh (an in-memory failed lane can only hold\n * failures from this page session).\n */\n failureStamps?: (() => ReadonlyMap<string, number> | null) | undefined;\n /** Transport lifecycle recorder; read per event so a late-mounted recorder still sees retries. */\n diagnostics?: (() => StatewireDiagnosticsRecorder | undefined) | undefined;\n /** Injectable clock (tests). */\n now?: () => number;\n /** Sweep scheduler; defaults to `queueMicrotask` so a sweep never dispatches\n * from inside a statewire flush or a React render. */\n schedule?: (task: () => void) => void;\n /**\n * Called right before a failed send is dispatched again, with its message\n * id, so a host can put back the per-send context that message was sent\n * with (Olympus stages the agents it named) before its command leaves.\n *\n * Returning a promise holds the retry: the host can't put that context back\n * yet (every send of the conversation rides one ambient context, and a send\n * with another context is still on its way). The sweep then stops at this\n * message, so nothing behind it overtakes it, and asks again once the\n * promise settles; past {@link MAX_BEFORE_RETRY_HOLDS} holds it sends the\n * message regardless. A hook that throws never holds a retry back. A\n * function returned is called when the message does not go after all (the\n * retry raced its leaving the lane), so the host lets go of what it put back.\n */\n beforeRetry?: ((messageId: string) => void | PromiseLike<void> | (() => void)) | undefined;\n}\n\nexport interface DeepAgentSendRecovery {\n /** Feed every (normalized) statewire state change; hydration arms the mount sweep. */\n observeStateChange(state: unknown): void;\n /** Feed every command-lifecycle update; a never-server-judged settle arms a sweep. */\n observeCommand(update: StatewireDiagnosticsCommandUpdate): void;\n /** Feed client notifications too: failed history can publish after the\n * command settles, without any change to the canonical thread snapshot. */\n observeFailedLaneChange(): void;\n dispose(): void;\n}\n\n/** Whether a settle failure is a client-side death the recovery re-dispatches\n * (the server never judged the command). Exported for host-side telemetry. */\nexport function shouldAutoRetryFailedSend(failure: { fate: string } | undefined): boolean {\n return failure !== undefined && AUTO_RETRY_FATES.has(failure.fate);\n}\n\n/** Whether a failed entry must wait for a lost predecessor to settle first. */\nfunction awaitsLostPredecessor(entry: StatewireFailedSendEntry): boolean {\n return entry.sendFailure.fate === 'aborted' && entry.sendFailure.predecessorLost === true;\n}\n\nfunction isThenable(value: unknown): value is PromiseLike<unknown> {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as { then?: unknown }).then === 'function'\n );\n}\n\n/** The client-minted message id a run send carries, off a command update's params. */\nfunction commandMessageId(update: StatewireDiagnosticsCommandUpdate): string | null {\n const first = update.params?.[0] as { message?: { id?: unknown } } | undefined;\n const id = first?.message?.id;\n return typeof id === 'string' ? id : null;\n}\n\nexport function createDeepAgentSendRecovery(\n options: DeepAgentSendRecoveryOptions\n): DeepAgentSendRecovery {\n const now = options.now ?? Date.now;\n const schedule = options.schedule ?? ((task: () => void) => queueMicrotask(task));\n\n let disposed = false;\n let hydrated = false;\n /** Work may exist: set at hydration and on retryable settles, cleared by a\n * sweep that could actually read the lane. */\n let armed = false;\n let sweepScheduled = false;\n /** Retry budget per message id, for this controller's attach lifetime. */\n const attempts = new Map<string, number>();\n /** Message ids already diagnosed as stale/exhausted, so the lane re-scan\n * stays quiet about them. */\n const surfacedSkips = new Set<string>();\n /** Message ids whose deferral behind a lost predecessor was diagnosed once. */\n const surfacedDeferrals = new Set<string>();\n /** Re-dispatched sends still awaiting the server's verdict: a successor\n * stamped `predecessorLost` waits while any of these is pending. */\n const inFlight = new Set<string>();\n /** Successors held back by the last sweep; a non-empty set keeps the\n * controller armed so the next settle or state change re-sweeps. */\n const deferred = new Set<string>();\n /** How many times the host held each message's retry (`beforeRetry`'s promise). */\n const holds = new Map<string, number>();\n /** A host's hold in progress: no sweep runs until it settles. */\n let holding = false;\n\n const record = (event: string, data?: Record<string, unknown>): void => {\n options.diagnostics?.()?.record(event, data);\n };\n\n const sweep = (): void => {\n sweepScheduled = false;\n // A host's hold re-sweeps once it settles; until then nothing is retried.\n if (disposed || holding || !hydrated || !armed) return;\n const lane = options.lane();\n // No readable lane yet: stay armed so the next state change re-sweeps.\n if (lane === null) return;\n armed = false;\n deferred.clear();\n const stamps = options.failureStamps?.() ?? null;\n // A `lost` entry earlier in lane order that this sweep leaves unsettled\n // (skipped as stale/exhausted, or re-dispatched and now in flight).\n let lostPredecessorPending = false;\n for (const entry of lane.failed) {\n if (!shouldAutoRetryFailedSend(entry.sendFailure)) continue;\n // Shared retry/discard may still be waiting for the storage lock. The\n // visible lane can keep this entry until then; do not spend another\n // attempt on a send whose previous retry is still awaiting a verdict.\n if (inFlight.has(entry.id)) {\n if (entry.sendFailure.fate === 'lost') lostPredecessorPending = true;\n continue;\n }\n if (awaitsLostPredecessor(entry) && (lostPredecessorPending || inFlight.size > 0)) {\n deferred.add(entry.id);\n if (!surfacedDeferrals.has(entry.id)) {\n surfacedDeferrals.add(entry.id);\n record('send-recovery/deferred', { messageId: entry.id });\n }\n continue;\n }\n const isLost = entry.sendFailure.fate === 'lost';\n const stamp = stamps?.get(entry.id);\n if (stamp !== undefined && now() - stamp > MAX_AUTO_RETRY_AGE_MS) {\n if (!surfacedSkips.has(entry.id)) {\n surfacedSkips.add(entry.id);\n record('send-recovery/stale', { messageId: entry.id, ageMs: Math.round(now() - stamp) });\n }\n if (isLost) lostPredecessorPending = true;\n continue;\n }\n const attempt = (attempts.get(entry.id) ?? 0) + 1;\n if (attempt > MAX_AUTO_RETRIES_PER_MESSAGE) {\n if (!surfacedSkips.has(entry.id)) {\n surfacedSkips.add(entry.id);\n record('send-recovery/exhausted', { messageId: entry.id });\n }\n if (isLost) lostPredecessorPending = true;\n continue;\n }\n let before: ReturnType<NonNullable<DeepAgentSendRecoveryOptions['beforeRetry']>> | undefined;\n try {\n before = options.beforeRetry?.(entry.id);\n } catch {\n // A host's own context step failing never holds the retry back.\n record('send-recovery/before-retry-failed', { messageId: entry.id });\n }\n if (isThenable(before)) {\n const held = (holds.get(entry.id) ?? 0) + 1;\n if (held <= MAX_BEFORE_RETRY_HOLDS) {\n // The host can't put this message's context back yet: it waits, and\n // so does everything behind it (nothing overtakes it); the sweep asks\n // again once the hold settles.\n holds.set(entry.id, held);\n holding = true;\n armed = true;\n record('send-recovery/held', { messageId: entry.id, holds: held });\n const resume = (): void => {\n holding = false;\n armed = true;\n scheduleSweep();\n };\n before.then(resume, resume);\n return;\n }\n record('send-recovery/held-too-long', { messageId: entry.id });\n }\n try {\n lane.retryFailed(entry.id);\n attempts.set(entry.id, attempt);\n inFlight.add(entry.id);\n if (isLost) lostPredecessorPending = true;\n record('send-recovery/retry', {\n messageId: entry.id,\n fate: entry.sendFailure.fate,\n attempt,\n });\n } catch {\n // The entry settled or was covered between the lane read and the\n // retry (the vendor drops covered failures against every snapshot);\n // nothing was dispatched, so the host lets go of what it put back.\n record('send-recovery/raced', { messageId: entry.id });\n try {\n if (typeof before === 'function') before();\n } catch {\n // The host's own step failing never stops the sweep.\n }\n }\n }\n // Held successors must be revisited once their predecessors settle.\n if (deferred.size > 0) armed = true;\n };\n\n const scheduleSweep = (): void => {\n if (disposed || sweepScheduled || holding || !hydrated || !armed) return;\n sweepScheduled = true;\n schedule(sweep);\n };\n\n return {\n observeStateChange(state) {\n if (disposed) return;\n if (!hydrated && isDeepAgentStateHydrated(state)) {\n // First real snapshot: the vendor's failureCovered pass has had its\n // chance to drop entries whose message actually landed, so whatever\n // remains provably never reached the thread.\n hydrated = true;\n armed = true;\n }\n scheduleSweep();\n },\n observeCommand(update) {\n if (disposed || update.status !== 'settled') return;\n const messageId = commandMessageId(update);\n if (messageId !== null) inFlight.delete(messageId);\n // A never-server-judged settle means new work; any settle while\n // successors are held may be the predecessor they wait on.\n if (!shouldAutoRetryFailedSend(update.failure) && deferred.size === 0) return;\n armed = true;\n scheduleSweep();\n },\n observeFailedLaneChange() {\n if (disposed) return;\n armed = true;\n scheduleSweep();\n },\n dispose() {\n disposed = true;\n },\n };\n}\n"],"names":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"send-recovery.js","sources":["../../../../agent-runtime/src/send-recovery.ts"],"sourcesContent":["import {\n type DeepAgentOutbox,\n type DeepAgentSettledUpdate,\n requeueFailedRunSend,\n runSendMessageId,\n runSendThreadOfState,\n} from './statewire-held-sends';\nimport type { StatewireDiagnosticsRecorder } from './statewire-diagnostics';\n\n/**\n * Transport-level send durability for the deep-agent thread (the successor to\n * Olympus' localStorage outbox, #29368 → #31504).\n *\n * The durable journal itself is the statewire session record: a command waits\n * in the outbox until a flush stamps it, and a stamped command stays in the\n * record until the server judges it. Reconnects never re-send a seq — answers\n * ride the hello — and a reload resends what never arrived. What the record\n * cannot recover on its own is a send the client had to settle without a\n * server verdict (a proven session loss, a stream gone mid-flight): statewire\n * 0.24 turns that into a durable `settled` update with a `lost`/`aborted`\n * failure, delivered once through `onCommandChange` and acked when the\n * handler's promise resolves.\n *\n * This controller is that handler. A failed message-carrying run send the\n * server NEVER judged goes back into the outbox queued (`insert({ from })`\n * consumes the update in the same write, so a redelivery never inserts twice),\n * same client-minted message id, re-anchored against the attached state —\n * which the host dedupes by id. Everything else that failed — a server-judged\n * fate (`rejected`, `failed`, `crashed`, `expired`), a stale send, one that\n * exhausted its retries — is re-held for the user with the failure in\n * `localMeta.error` (`statewire-held-sends.ts`), where the queue tray offers\n * retry and discard.\n *\n * Dropped, not re-queued: a send whose message already landed (the attached\n * state shows it, or the host refused it as a `duplicate-id`), one the user\n * removed, and the in-memory `unmount` settles (the record still holds those\n * for the next mount).\n *\n * Ordering: updates arrive one at a time in settle order, and a re-queued send\n * goes to the lane's tail in that order, so successors stay behind their\n * predecessors. An `aborted` send stamped `predecessorLost` was never attempted\n * because an earlier send of the same batch WAS attempted and settled `lost`;\n * once such a predecessor has been held for the user rather than re-queued,\n * its successors are held too, so none can land ahead of it.\n */\n\n/** Fates the server never saw: the send died client-side (unmount, stream\n * gone, session lost) and is safe to re-dispatch under its original message\n * id. The complement — rejected/failed/crashed/expired — is server-judged. */\nconst AUTO_RETRY_FATES: ReadonlySet<string> = new Set(['lost', 'aborted']);\n\n/** A failed send is re-queued at most this many times per attach; a\n * persistent failure (repeated session losses) is held for the user. */\nconst MAX_AUTO_RETRIES_PER_MESSAGE = 3;\n\n/** Persisted failures older than this are held for the user: auto-sending a\n * message the user abandoned a day ago is worse than surfacing it for a\n * decision. Mirrors the retired outbox's retention window. */\nconst MAX_AUTO_RETRY_AGE_MS = 24 * 60 * 60 * 1000;\n\n/** How many times a host may hold one message's retry (`beforeRetry`\n * returning a promise) before the controller re-queues it regardless: a hold\n * is the host's own bounded wait, never a reason to keep a message back for good. */\nexport const MAX_BEFORE_RETRY_HOLDS = 10;\n\nexport interface DeepAgentSendRecoveryOptions {\n /**\n * The thread's outbox (`extras.outbox`). `null` while it is unavailable;\n * the update is then left for the next delivery.\n */\n outbox: () => Pick<DeepAgentOutbox, 'insert'> | null;\n /**\n * Persisted failure stamps (message id → epoch ms of the original send) for\n * the freshness gate. `null`/absent means no persistence is readable — every\n * failure then counts as fresh.\n */\n failureStamps?: (() => ReadonlyMap<string, number> | null) | undefined;\n /** Transport lifecycle recorder; read per event so a late-mounted recorder still sees retries. */\n diagnostics?: (() => StatewireDiagnosticsRecorder | undefined) | undefined;\n /** Injectable clock (tests). */\n now?: () => number;\n /**\n * Called right before a failed send is re-queued, with its message id, so a\n * host can put back the per-send context that message was sent with\n * (Olympus stages the agents it named) before its command leaves.\n *\n * Returning a promise holds the retry: the host can't put that context back\n * yet (every send of the conversation rides one ambient context, and a send\n * with another context is still on its way). Delivery then waits, so nothing\n * behind it overtakes it, and asks again once the promise settles; past\n * {@link MAX_BEFORE_RETRY_HOLDS} holds it re-queues the message regardless.\n * A hook that throws never holds a retry back. A function returned is\n * called when the message does not go after all, so the host lets go of\n * what it put back.\n */\n beforeRetry?: ((messageId: string) => void | PromiseLike<void> | (() => void)) | undefined;\n}\n\nexport interface DeepAgentSendRecovery {\n /**\n * Handles one command update (`onCommandChange`): returns a promise for a\n * failed run send it acts on — a durable `settled` update is acked once it\n * resolves — and `undefined` otherwise.\n */\n onCommandChange(update: DeepAgentSettledUpdate, ctx?: { state?: unknown }): Promise<void> | undefined;\n dispose(): void;\n}\n\n/** Whether a settle failure is a client-side death the recovery re-dispatches\n * (the server never judged the command). Exported for host-side telemetry. */\nexport function shouldAutoRetryFailedSend(failure: { fate: string } | undefined): boolean {\n return failure !== undefined && AUTO_RETRY_FATES.has(failure.fate);\n}\n\nfunction isThenable(value: unknown): value is PromiseLike<unknown> {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as { then?: unknown }).then === 'function'\n );\n}\n\nfunction idsOf(list: unknown, into: Set<string>): void {\n if (!Array.isArray(list)) return;\n for (const item of list) {\n const id = (item as { id?: unknown } | null)?.id;\n if (typeof id === 'string') into.add(id);\n }\n}\n\n/** Whether the attached deep-agent state already shows `messageId`: in the\n * transcript, a run's queues, or the batch being dispatched. */\nfunction stateHoldsMessage(state: unknown, messageId: string): boolean {\n if (!state || typeof state !== 'object') return false;\n const value = state as { messages?: unknown; runs?: unknown };\n const ids = new Set<string>();\n idsOf(value.messages, ids);\n if (Array.isArray(value.runs)) {\n for (const run of value.runs) {\n const entry = run as {\n queue?: unknown;\n steerQueue?: unknown;\n dispatching?: { messages?: unknown } | null;\n } | null;\n idsOf(entry?.queue, ids);\n idsOf(entry?.steerQueue, ids);\n idsOf(entry?.dispatching?.messages, ids);\n }\n }\n return ids.has(messageId);\n}\n\nexport function createDeepAgentSendRecovery(\n options: DeepAgentSendRecoveryOptions\n): DeepAgentSendRecovery {\n const now = options.now ?? Date.now;\n let disposed = false;\n /** Re-queue budget per message id, for this controller's attach lifetime. */\n const attempts = new Map<string, number>();\n /** A `lost` send was held for the user: `predecessorLost` successors wait behind it. */\n let lostPredecessorHeld = false;\n\n const record = (event: string, data?: Record<string, unknown>): void => {\n options.diagnostics?.()?.record(event, data);\n };\n\n /** Asks the host to stage the message's context; resolves to its release hook. */\n const prepareRetry = async (messageId: string): Promise<(() => void) | undefined> => {\n for (let held = 1; ; held++) {\n let before: ReturnType<NonNullable<DeepAgentSendRecoveryOptions['beforeRetry']>> | undefined;\n try {\n before = options.beforeRetry?.(messageId);\n } catch {\n // A host's own context step failing never holds the retry back.\n record('send-recovery/before-retry-failed', { messageId });\n return undefined;\n }\n if (!isThenable(before)) return typeof before === 'function' ? before : undefined;\n if (held > MAX_BEFORE_RETRY_HOLDS) {\n // Not waited on: a hold that later fails must not go unhandled.\n Promise.resolve(before).catch(() => undefined);\n record('send-recovery/held-too-long', { messageId });\n return undefined;\n }\n record('send-recovery/held', { messageId, holds: held });\n try {\n await before;\n } catch {\n // A hold that fails still ends; the host is asked again.\n }\n if (disposed) return undefined;\n }\n };\n\n const handle = async (\n update: DeepAgentSettledUpdate,\n messageId: string,\n state: unknown\n ): Promise<void> => {\n const failure = update.failure!;\n const outbox = options.outbox();\n // No outbox yet: throwing leaves the update for the next delivery.\n if (outbox === null) throw new Error('send recovery: the thread has no outbox yet');\n const hold = (reason: string): void => {\n if (failure.fate === 'lost') lostPredecessorHeld = true;\n requeueFailedRunSend({ outbox, update, held: true });\n record(`send-recovery/${reason}`, { messageId, fate: failure.fate });\n };\n\n if (!shouldAutoRetryFailedSend(failure)) return hold('held');\n if (\n failure.fate === 'aborted' &&\n 'predecessorLost' in failure &&\n failure.predecessorLost === true &&\n lostPredecessorHeld\n )\n return hold('deferred');\n const stamp = options.failureStamps?.()?.get(messageId);\n if (stamp !== undefined && now() - stamp > MAX_AUTO_RETRY_AGE_MS) {\n record('send-recovery/stale', { messageId, ageMs: Math.round(now() - stamp) });\n return hold('held');\n }\n const attempt = (attempts.get(messageId) ?? 0) + 1;\n if (attempt > MAX_AUTO_RETRIES_PER_MESSAGE) {\n record('send-recovery/exhausted', { messageId });\n return hold('held');\n }\n\n const release = await prepareRetry(messageId);\n if (disposed) {\n release?.();\n throw new Error('send recovery: disposed before the retry');\n }\n try {\n requeueFailedRunSend({ outbox, update, held: false, thread: runSendThreadOfState(state) });\n } catch (error) {\n // Nothing was queued (the outbox refused the insert); the host lets go\n // of what it put back and the update stays for the next delivery.\n record('send-recovery/raced', { messageId });\n try {\n release?.();\n } catch {\n // The host's own step failing never masks the refusal.\n }\n throw error;\n }\n attempts.set(messageId, attempt);\n record('send-recovery/retry', { messageId, fate: failure.fate, attempt });\n };\n\n return {\n onCommandChange(update, ctx) {\n if (disposed || update.status !== 'settled' || update.failure === undefined) return undefined;\n const messageId = runSendMessageId(update);\n if (messageId === null) return undefined;\n const { failure } = update;\n // The user removed it, or the record still holds it for the next mount.\n if (failure.cause === 'removed' || failure.cause === 'unmount') return undefined;\n if (\n stateHoldsMessage(ctx?.state, messageId) ||\n (failure.fate === 'rejected' && failure.code === 'duplicate-id')\n ) {\n record('send-recovery/covered', { messageId, fate: failure.fate });\n return undefined;\n }\n const handled = handle(update, messageId, ctx?.state);\n // statewire awaits a durable update's promise; an in-memory one's is\n // dropped, and its rejection must not surface as unhandled.\n handled.catch(() => undefined);\n return handled;\n },\n dispose() {\n disposed = true;\n },\n };\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -32,7 +32,10 @@ export interface StatewireDiagnosticsCommandUpdate {
|
|
|
32
32
|
method: string;
|
|
33
33
|
/** The wire statement's params (a run send carries its message first). */
|
|
34
34
|
params?: readonly unknown[];
|
|
35
|
-
|
|
35
|
+
/** The client command id, kept from enqueue to verdict. */
|
|
36
|
+
id?: string;
|
|
37
|
+
/** The lane seq; absent while the command waits in the outbox. */
|
|
38
|
+
seq?: number;
|
|
36
39
|
status: 'queued' | 'posted' | 'applied' | 'settled';
|
|
37
40
|
failure?: {
|
|
38
41
|
fate: string;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const chatOutboxThread = require("./chat-outbox-thread.cjs");
|
|
4
|
+
const runSend = require("./run-send.cjs");
|
|
5
|
+
const statewireTransport = require("./statewire-transport.cjs");
|
|
6
|
+
function readStatewireOutbox(extras) {
|
|
7
|
+
const outbox = extras == null ? void 0 : extras.outbox;
|
|
8
|
+
if (!outbox || !Array.isArray(outbox.entries) || typeof outbox.update !== "function" || typeof outbox.insert !== "function" || typeof outbox.remove !== "function")
|
|
9
|
+
return null;
|
|
10
|
+
return outbox;
|
|
11
|
+
}
|
|
12
|
+
function isRecord(value) {
|
|
13
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
function isSendFailure(value) {
|
|
16
|
+
return isRecord(value) && typeof value.fate === "string" && typeof value.cause === "string";
|
|
17
|
+
}
|
|
18
|
+
function heldSendFailure(localMeta) {
|
|
19
|
+
return isRecord(localMeta) && isSendFailure(localMeta.error) ? localMeta.error : void 0;
|
|
20
|
+
}
|
|
21
|
+
function withSendFailure(localMeta, error) {
|
|
22
|
+
return { ...isRecord(localMeta) ? localMeta : {}, error };
|
|
23
|
+
}
|
|
24
|
+
function withoutSendFailure(localMeta) {
|
|
25
|
+
if (!isRecord(localMeta) || !("error" in localMeta)) return localMeta;
|
|
26
|
+
const { error: _error, ...rest } = localMeta;
|
|
27
|
+
return Object.keys(rest).length > 0 ? rest : void 0;
|
|
28
|
+
}
|
|
29
|
+
function currentRunCommand(command) {
|
|
30
|
+
return runSend.upgradeLegacyRunCommand(command) ?? command;
|
|
31
|
+
}
|
|
32
|
+
function runSendMessageId(command) {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const current = currentRunCommand({ method: command.method, params: command.params ?? [] });
|
|
35
|
+
if (!runSend.MESSAGE_RUN_METHODS.has(current.method)) return null;
|
|
36
|
+
const id = (_b = (_a = current.params[0]) == null ? void 0 : _a.message) == null ? void 0 : _b.id;
|
|
37
|
+
return typeof id === "string" ? id : null;
|
|
38
|
+
}
|
|
39
|
+
function runSendThreadOfState(state) {
|
|
40
|
+
var _a;
|
|
41
|
+
const value = isRecord(state) ? state : {};
|
|
42
|
+
const runs = Array.isArray(value.runs) ? value.runs : [];
|
|
43
|
+
const runId = (_a = runs[0]) == null ? void 0 : _a.runId;
|
|
44
|
+
return {
|
|
45
|
+
wireMessages: Array.isArray(value.messages) ? value.messages : null,
|
|
46
|
+
runId: typeof runId === "string" ? runId : null
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function runSendThreadOfExtras(extras) {
|
|
50
|
+
const value = isRecord(extras) ? extras : {};
|
|
51
|
+
const state = isRecord(value.state) ? value.state : {};
|
|
52
|
+
const runId = isRecord(value.runs) ? value.runs.runId : void 0;
|
|
53
|
+
return {
|
|
54
|
+
wireMessages: Array.isArray(state.messages) ? state.messages : null,
|
|
55
|
+
runId: typeof runId === "string" ? runId : null
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function mintRunId() {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
const host = globalThis;
|
|
61
|
+
return ((_b = (_a = host.crypto) == null ? void 0 : _a.randomUUID) == null ? void 0 : _b.call(_a)) ?? `run-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
62
|
+
}
|
|
63
|
+
function reanchorRunSend(command, thread) {
|
|
64
|
+
var _a;
|
|
65
|
+
if (!runSend.MESSAGE_RUN_METHODS.has(command.method)) return null;
|
|
66
|
+
const params = command.params[0];
|
|
67
|
+
if (!isRecord(params) || !isRecord(params.message)) return null;
|
|
68
|
+
const rest = command.params.slice(1);
|
|
69
|
+
if (command.method === "run/edit") {
|
|
70
|
+
if (typeof params.sourceId !== "string") return null;
|
|
71
|
+
const wire = thread.wireMessages ?? [];
|
|
72
|
+
const index = wire.findIndex((message) => (message == null ? void 0 : message.id) === params.sourceId);
|
|
73
|
+
const runAnchorMessageId = index > 0 ? (_a = wire[index - 1]) == null ? void 0 : _a.id : void 0;
|
|
74
|
+
if (typeof runAnchorMessageId !== "string") return null;
|
|
75
|
+
return {
|
|
76
|
+
method: "run/edit",
|
|
77
|
+
params: [{ ...params, runId: thread.runId ?? mintRunId(), runAnchorMessageId }, ...rest]
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (thread.runId !== null && params.runId === thread.runId) {
|
|
81
|
+
return { method: command.method, params: [params, ...rest] };
|
|
82
|
+
}
|
|
83
|
+
const { runAnchorMessageId: _anchor, ...unanchored } = params;
|
|
84
|
+
const fields = thread.runId !== null ? { runId: thread.runId } : {
|
|
85
|
+
runId: mintRunId(),
|
|
86
|
+
runAnchorMessageId: thread.wireMessages && thread.wireMessages.length > 0 ? chatOutboxThread.chatOutboxWireAnchorId(thread.wireMessages) : null
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
method: runSend.RUN_SEND_METHOD,
|
|
90
|
+
params: [
|
|
91
|
+
{
|
|
92
|
+
...unanchored,
|
|
93
|
+
type: runSend.RUN_SEND_METHOD,
|
|
94
|
+
behavior: thread.runId !== null ? "queue" : "auto",
|
|
95
|
+
...fields
|
|
96
|
+
},
|
|
97
|
+
...rest
|
|
98
|
+
]
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function requeueFailedRunSend({
|
|
102
|
+
outbox,
|
|
103
|
+
update,
|
|
104
|
+
held,
|
|
105
|
+
thread
|
|
106
|
+
}) {
|
|
107
|
+
if (update.status !== "settled" || update.failure === void 0) return null;
|
|
108
|
+
if (runSendMessageId(update) === null) return null;
|
|
109
|
+
const sent = currentRunCommand({ method: update.method, params: update.params });
|
|
110
|
+
const command = (thread && reanchorRunSend(sent, thread)) ?? {
|
|
111
|
+
method: sent.method,
|
|
112
|
+
params: [...sent.params]
|
|
113
|
+
};
|
|
114
|
+
const localMeta = held ? withSendFailure(update.localMeta, update.failure) : withoutSendFailure(update.localMeta);
|
|
115
|
+
return outbox.insert({
|
|
116
|
+
...update.id !== void 0 && { from: update.id },
|
|
117
|
+
protocol: update.protocol ?? statewireTransport.DEEP_AGENT_STATEWIRE_PROTOCOL,
|
|
118
|
+
command,
|
|
119
|
+
held,
|
|
120
|
+
...localMeta !== void 0 && { localMeta }
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function findHeldRunSend(outbox, messageId) {
|
|
124
|
+
return outbox.entries.find(
|
|
125
|
+
(entry) => entry.state === "held" && runSendMessageId(entry.command) === messageId
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function unknownHeldSend(messageId) {
|
|
129
|
+
return new Error(`statewire: unknown failed entry "${messageId}"`);
|
|
130
|
+
}
|
|
131
|
+
const claimedHeldSends = /* @__PURE__ */ new Set();
|
|
132
|
+
function claimHeldSend(entryId) {
|
|
133
|
+
if (claimedHeldSends.has(entryId)) return false;
|
|
134
|
+
claimedHeldSends.add(entryId);
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
function retryHeldRunSend({
|
|
138
|
+
outbox,
|
|
139
|
+
messageId,
|
|
140
|
+
thread
|
|
141
|
+
}) {
|
|
142
|
+
const entry = findHeldRunSend(outbox, messageId);
|
|
143
|
+
if (entry === void 0 || !claimHeldSend(entry.id)) throw unknownHeldSend(messageId);
|
|
144
|
+
const next = reanchorRunSend(entry.command, thread) ?? {
|
|
145
|
+
method: entry.command.method,
|
|
146
|
+
params: [...entry.command.params]
|
|
147
|
+
};
|
|
148
|
+
const localMeta = withoutSendFailure(entry.localMeta);
|
|
149
|
+
try {
|
|
150
|
+
if (next.method === entry.command.method) {
|
|
151
|
+
outbox.update(entry.id, () => ({ held: false, localMeta, command: { params: next.params } }));
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
outbox.insert({
|
|
155
|
+
protocol: entry.protocol,
|
|
156
|
+
command: next,
|
|
157
|
+
before: entry.id,
|
|
158
|
+
...localMeta !== void 0 && { localMeta }
|
|
159
|
+
});
|
|
160
|
+
outbox.remove(entry.id);
|
|
161
|
+
} catch (error) {
|
|
162
|
+
claimedHeldSends.delete(entry.id);
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function discardHeldRunSend({
|
|
167
|
+
outbox,
|
|
168
|
+
messageId
|
|
169
|
+
}) {
|
|
170
|
+
const entry = findHeldRunSend(outbox, messageId);
|
|
171
|
+
if (entry === void 0 || !claimHeldSend(entry.id)) throw unknownHeldSend(messageId);
|
|
172
|
+
try {
|
|
173
|
+
outbox.remove(entry.id);
|
|
174
|
+
} catch (error) {
|
|
175
|
+
claimedHeldSends.delete(entry.id);
|
|
176
|
+
throw error;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.discardHeldRunSend = discardHeldRunSend;
|
|
180
|
+
exports.findHeldRunSend = findHeldRunSend;
|
|
181
|
+
exports.heldSendFailure = heldSendFailure;
|
|
182
|
+
exports.readStatewireOutbox = readStatewireOutbox;
|
|
183
|
+
exports.reanchorRunSend = reanchorRunSend;
|
|
184
|
+
exports.requeueFailedRunSend = requeueFailedRunSend;
|
|
185
|
+
exports.retryHeldRunSend = retryHeldRunSend;
|
|
186
|
+
exports.runSendMessageId = runSendMessageId;
|
|
187
|
+
exports.runSendThreadOfExtras = runSendThreadOfExtras;
|
|
188
|
+
exports.runSendThreadOfState = runSendThreadOfState;
|
|
189
|
+
exports.withSendFailure = withSendFailure;
|
|
190
|
+
exports.withoutSendFailure = withoutSendFailure;
|
|
191
|
+
//# sourceMappingURL=statewire-held-sends.cjs.map
|