@athenaintel/react 0.41.3 → 0.42.2
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 +132 -10
- package/dist/agent-runtime/src/asset-attachment.d.ts +98 -0
- package/dist/agent-runtime/src/athena-asset-drag.d.ts +32 -0
- package/dist/agent-runtime/src/auth-denial.d.ts +29 -0
- package/dist/agent-runtime/src/chat-outbox-attachments.cjs +41 -0
- package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +38 -0
- package/dist/agent-runtime/src/chat-outbox-attachments.js +41 -0
- package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-signals.cjs +63 -0
- package/dist/agent-runtime/src/chat-outbox-signals.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-signals.d.ts +12 -0
- package/dist/agent-runtime/src/chat-outbox-signals.js +63 -0
- package/dist/agent-runtime/src/chat-outbox-signals.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.cjs +509 -0
- package/dist/agent-runtime/src/chat-outbox-store.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.d.ts +203 -0
- package/dist/agent-runtime/src/chat-outbox-store.js +509 -0
- package/dist/agent-runtime/src/chat-outbox-store.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-thread.cjs +136 -0
- package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-thread.d.ts +118 -0
- package/dist/agent-runtime/src/chat-outbox-thread.js +136 -0
- package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox.cjs +696 -0
- package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox.d.ts +285 -0
- package/dist/agent-runtime/src/chat-outbox.js +696 -0
- package/dist/agent-runtime/src/chat-outbox.js.map +1 -0
- package/dist/agent-runtime/src/chat-socket-reachability.d.ts +45 -0
- package/dist/agent-runtime/src/client-tool-bridge.d.ts +152 -0
- package/dist/agent-runtime/src/client-tools.d.ts +133 -0
- package/dist/agent-runtime/src/composer-markdown.cjs +10 -0
- package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
- package/dist/agent-runtime/src/composer-markdown.d.ts +108 -0
- package/dist/agent-runtime/src/composer-markdown.js +10 -0
- package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
- package/dist/agent-runtime/src/config-mutations.d.ts +51 -0
- package/dist/agent-runtime/src/conversation-index.d.ts +110 -0
- package/dist/agent-runtime/src/conversation-list.d.ts +343 -0
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -2
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +166 -0
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -2
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
- package/dist/agent-runtime/src/desktop-handoff.d.ts +139 -0
- package/dist/agent-runtime/src/durable-thread-snapshot-cache.d.ts +60 -0
- package/dist/agent-runtime/src/edit-command.d.ts +156 -0
- package/dist/agent-runtime/src/errors.d.ts +174 -0
- package/dist/agent-runtime/src/execute-output.d.ts +31 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs +16 -2
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +202 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js +16 -2
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/agent-runtime/src/github-wake-event.d.ts +77 -0
- package/dist/agent-runtime/src/index.d.ts +74 -0
- package/dist/agent-runtime/src/interrupts.cjs +17 -0
- package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
- package/dist/agent-runtime/src/interrupts.d.ts +348 -0
- package/dist/agent-runtime/src/interrupts.js +17 -0
- package/dist/agent-runtime/src/interrupts.js.map +1 -1
- package/dist/agent-runtime/src/lane-follow.d.ts +121 -0
- package/dist/agent-runtime/src/lane-history.cjs +209 -0
- package/dist/agent-runtime/src/lane-history.cjs.map +1 -0
- package/dist/agent-runtime/src/lane-history.d.ts +175 -0
- package/dist/agent-runtime/src/lane-history.js +209 -0
- package/dist/agent-runtime/src/lane-history.js.map +1 -0
- package/dist/agent-runtime/src/lane-images.d.ts +184 -0
- package/dist/agent-runtime/src/message-author.d.ts +43 -0
- package/dist/agent-runtime/src/message-text.cjs +15 -0
- package/dist/agent-runtime/src/message-text.cjs.map +1 -0
- package/dist/agent-runtime/src/message-text.d.ts +47 -0
- package/dist/agent-runtime/src/message-text.js +15 -0
- package/dist/agent-runtime/src/message-text.js.map +1 -0
- package/dist/agent-runtime/src/message-window.cjs +15 -1
- package/dist/agent-runtime/src/message-window.cjs.map +1 -1
- package/dist/agent-runtime/src/message-window.d.ts +159 -0
- package/dist/agent-runtime/src/message-window.js +16 -2
- package/dist/agent-runtime/src/message-window.js.map +1 -1
- package/dist/agent-runtime/src/messages.cjs +123 -8
- package/dist/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.d.ts +621 -0
- package/dist/agent-runtime/src/messages.js +123 -8
- package/dist/agent-runtime/src/messages.js.map +1 -1
- package/dist/agent-runtime/src/model-context.d.ts +22 -0
- package/dist/agent-runtime/src/offline-status.d.ts +157 -0
- package/dist/agent-runtime/src/optimistic-content.d.ts +21 -0
- package/dist/agent-runtime/src/protocol.cjs +12 -4
- package/dist/agent-runtime/src/protocol.cjs.map +1 -1
- package/dist/agent-runtime/src/protocol.d.ts +119 -0
- package/dist/agent-runtime/src/protocol.js +13 -5
- package/dist/agent-runtime/src/protocol.js.map +1 -1
- package/dist/agent-runtime/src/ptc-subcalls.d.ts +51 -0
- package/dist/agent-runtime/src/queue.d.ts +138 -0
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +10 -0
- 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 +161 -0
- package/dist/agent-runtime/src/quota-safe-local-storage-session.js +10 -0
- package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
- package/dist/agent-runtime/src/running-tool-placeholder.cjs +11 -0
- package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -0
- package/dist/agent-runtime/src/running-tool-placeholder.d.ts +25 -0
- package/dist/agent-runtime/src/running-tool-placeholder.js +11 -0
- package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -0
- package/dist/agent-runtime/src/runtime-messages.d.ts +104 -0
- package/dist/agent-runtime/src/screen-point.d.ts +151 -0
- package/dist/agent-runtime/src/sealed-idb.cjs +112 -0
- package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -0
- package/dist/agent-runtime/src/sealed-idb.d.ts +106 -0
- package/dist/agent-runtime/src/sealed-idb.js +112 -0
- package/dist/agent-runtime/src/sealed-idb.js.map +1 -0
- package/dist/agent-runtime/src/send-recovery.d.ts +40 -0
- package/dist/agent-runtime/src/session-lane-scope.cjs +25 -0
- package/dist/agent-runtime/src/session-lane-scope.cjs.map +1 -0
- package/dist/agent-runtime/src/session-lane-scope.d.ts +59 -0
- package/dist/agent-runtime/src/session-lane-scope.js +25 -0
- package/dist/agent-runtime/src/session-lane-scope.js.map +1 -0
- package/dist/agent-runtime/src/statewire-attach-observer.d.ts +194 -0
- package/dist/agent-runtime/src/statewire-diagnostics.d.ts +74 -0
- package/dist/agent-runtime/src/statewire-state.d.ts +29 -0
- package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
- package/dist/agent-runtime/src/statewire-suspended.d.ts +27 -0
- package/dist/agent-runtime/src/statewire-suspended.js.map +1 -1
- package/dist/agent-runtime/src/statewire-transport.d.ts +40 -0
- package/dist/agent-runtime/src/streaming-markdown.d.ts +46 -0
- package/dist/agent-runtime/src/subagent-transcripts.cjs +209 -0
- package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -0
- package/dist/agent-runtime/src/subagent-transcripts.d.ts +71 -0
- package/dist/agent-runtime/src/subagent-transcripts.js +209 -0
- package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -0
- package/dist/agent-runtime/src/subagents.cjs +253 -0
- package/dist/agent-runtime/src/subagents.cjs.map +1 -0
- package/dist/agent-runtime/src/subagents.d.ts +311 -0
- package/dist/agent-runtime/src/subagents.js +253 -0
- package/dist/agent-runtime/src/subagents.js.map +1 -0
- package/dist/agent-runtime/src/subscription-wake-event.d.ts +111 -0
- package/dist/agent-runtime/src/thread-extras.d.ts +43 -0
- package/dist/agent-runtime/src/thread-handoff.d.ts +364 -0
- package/dist/agent-runtime/src/thread-prewarm-controller.d.ts +76 -0
- package/dist/agent-runtime/src/thread-prewarm.d.ts +118 -0
- package/dist/agent-runtime/src/thread-snapshot-cache.d.ts +99 -0
- package/dist/agent-runtime/src/thread-snapshot-mirror.cjs +46 -117
- package/dist/agent-runtime/src/thread-snapshot-mirror.cjs.map +1 -1
- package/dist/agent-runtime/src/thread-snapshot-mirror.d.ts +101 -0
- package/dist/agent-runtime/src/thread-snapshot-mirror.js +17 -88
- package/dist/agent-runtime/src/thread-snapshot-mirror.js.map +1 -1
- package/dist/agent-runtime/src/thread-status.d.ts +53 -0
- package/dist/agent-runtime/src/tool-metadata.d.ts +146 -0
- package/dist/agent-runtime/src/tool-names.cjs +71 -0
- package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-names.d.ts +67 -0
- package/dist/agent-runtime/src/tool-names.js +72 -1
- package/dist/agent-runtime/src/tool-names.js.map +1 -1
- package/dist/agent-runtime/src/tool-outputs.d.ts +35 -0
- package/dist/agent-runtime/src/tool-result.cjs +1 -0
- package/dist/agent-runtime/src/tool-result.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-result.d.ts +126 -0
- package/dist/agent-runtime/src/tool-result.js +1 -0
- package/dist/agent-runtime/src/tool-result.js.map +1 -1
- package/dist/agent-runtime/src/types.d.ts +159 -0
- package/dist/agent-runtime/src/use-conversation-list.d.ts +76 -0
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +136 -0
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +64 -0
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +136 -0
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-config.d.ts +169 -0
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +13 -0
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.d.ts +22 -0
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.js +13 -0
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +37 -2
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +177 -0
- package/dist/agent-runtime/src/use-deep-agent-runtime.js +38 -3
- package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs +39 -13
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +352 -0
- package/dist/agent-runtime/src/use-deep-agent-thread.js +39 -13
- package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs +1019 -0
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +409 -0
- package/dist/agent-runtime/src/use-deep-agent-voice.js +1019 -0
- package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-window-sync.d.ts +102 -0
- package/dist/agent-runtime/src/use-historical-edit-attachments.d.ts +2 -0
- package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +84 -0
- package/dist/agent-runtime/src/voice-presentation.cjs +2 -0
- package/dist/agent-runtime/src/voice-presentation.cjs.map +1 -1
- package/dist/agent-runtime/src/voice-presentation.d.ts +80 -0
- package/dist/agent-runtime/src/voice-presentation.js +2 -0
- package/dist/agent-runtime/src/voice-presentation.js.map +1 -1
- package/dist/agent-runtime/src/voice-turn-grouping.d.ts +28 -0
- package/dist/agent-runtime/src/voice-wire-types.d.ts +15 -0
- package/dist/agent-runtime/src/withdrawn-turns.d.ts +97 -0
- package/dist/catalog/runtime-catalog.js +1 -1
- package/dist/chat/AthenaChat.cjs +192 -103
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +9 -0
- package/dist/chat/AthenaChat.js +194 -105
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +1 -1
- package/dist/chat/StatewireClientToolBridge.d.ts +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +11 -4
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +1 -1
- package/dist/chat/StatewireQueuedMessages.js +11 -4
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/chat-outbox-rows.cjs +223 -0
- package/dist/chat/chat-outbox-rows.cjs.map +1 -0
- package/dist/chat/chat-outbox-rows.d.ts +29 -0
- package/dist/chat/chat-outbox-rows.js +223 -0
- package/dist/chat/chat-outbox-rows.js.map +1 -0
- package/dist/chat/chat-voice-controls.cjs +128 -0
- package/dist/chat/chat-voice-controls.cjs.map +1 -0
- package/dist/chat/chat-voice-controls.d.ts +19 -0
- package/dist/chat/chat-voice-controls.js +128 -0
- package/dist/chat/chat-voice-controls.js.map +1 -0
- package/dist/chat/statewire-approval.d.ts +1 -1
- package/dist/chat/statewire-client-tools.d.ts +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs +3 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +7 -1
- package/dist/chat/super-grouping/SuperGroupingCard.js +3 -1
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +7 -2
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.d.ts +2 -2
- package/dist/chat/super-grouping/SuperGroupingTranscript.js +7 -2
- package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs +15 -8
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +18 -8
- package/dist/chat/super-grouping/activity-timeline.js +15 -8
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/use-statewire-approval-request.cjs +36 -0
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.d.ts +49 -1
- package/dist/chat/use-statewire-approval-request.js +39 -3
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.cjs +133 -14
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +33 -1
- package/dist/chat-ui/composer/tiptap-composer.js +135 -16
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/header/conversation-history-panel.d.ts +1 -1
- package/dist/chat-ui/index.d.ts +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +2 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +3 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.js +2 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs +29 -51
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs.map +1 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.d.ts +2 -2
- package/dist/chat-ui/mentions/use-account-workspace-id.js +30 -52
- package/dist/chat-ui/mentions/use-account-workspace-id.js.map +1 -1
- package/dist/chat-ui/messages/message-components.cjs +15 -0
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.js +15 -0
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/messages/runtime-message.d.ts +1 -1
- package/dist/chat-ui/messages/statewire-continue-run.d.ts +1 -1
- package/dist/chat-ui/messages/user-edit-composer.cjs +15 -2
- package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
- package/dist/chat-ui/messages/user-edit-composer.d.ts +4 -2
- package/dist/chat-ui/messages/user-edit-composer.js +15 -2
- package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
- package/dist/chat-ui/messages/wake-marker.d.ts +1 -1
- package/dist/chat-ui/rich-text/chat-text-schema.cjs +1 -0
- package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-text-schema.d.ts +3 -0
- package/dist/chat-ui/rich-text/chat-text-schema.js +1 -0
- package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
- package/dist/chat-ui/statewire.cjs +1 -0
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.d.ts +2 -2
- package/dist/chat-ui/statewire.js +2 -1
- package/dist/chat-ui/thread/composer-send-or-stop.cjs +2 -1
- package/dist/chat-ui/thread/composer-send-or-stop.cjs.map +1 -1
- package/dist/chat-ui/thread/composer-send-or-stop.d.ts +2 -0
- package/dist/chat-ui/thread/composer-send-or-stop.js +2 -1
- package/dist/chat-ui/thread/composer-send-or-stop.js.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.d.ts +1 -1
- package/dist/composer/AttachmentContext.cjs +8 -4
- package/dist/composer/AttachmentContext.cjs.map +1 -1
- package/dist/composer/AttachmentContext.d.ts +7 -0
- package/dist/composer/AttachmentContext.js +8 -4
- package/dist/composer/AttachmentContext.js.map +1 -1
- package/dist/composer/build-composed-message.cjs +34 -0
- package/dist/composer/build-composed-message.cjs.map +1 -1
- package/dist/composer/build-composed-message.d.ts +20 -0
- package/dist/composer/build-composed-message.js +35 -1
- package/dist/composer/build-composed-message.js.map +1 -1
- package/dist/composer/composer-handoff.cjs +39 -2
- package/dist/composer/composer-handoff.cjs.map +1 -1
- package/dist/composer/composer-handoff.d.ts +28 -3
- package/dist/composer/composer-handoff.js +39 -2
- package/dist/composer/composer-handoff.js.map +1 -1
- package/dist/composer/useAttachFiles.cjs +15 -2
- package/dist/composer/useAttachFiles.cjs.map +1 -1
- package/dist/composer/useAttachFiles.d.ts +11 -0
- package/dist/composer/useAttachFiles.js +15 -2
- package/dist/composer/useAttachFiles.js.map +1 -1
- package/dist/composer/useSendMessage.cjs.map +1 -1
- package/dist/composer/useSendMessage.d.ts +4 -3
- package/dist/composer/useSendMessage.js.map +1 -1
- package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
- package/dist/diagnostics/athena-diagnostics.d.ts +3 -1
- package/dist/diagnostics/athena-diagnostics.js.map +1 -1
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +14 -7
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/offline/chat-outbox.cjs +57 -0
- package/dist/offline/chat-outbox.cjs.map +1 -0
- package/dist/offline/chat-outbox.d.ts +80 -0
- package/dist/offline/chat-outbox.js +57 -0
- package/dist/offline/chat-outbox.js.map +1 -0
- package/dist/offline/offline-history.d.ts +1 -1
- package/dist/provider/AthenaProvider.cjs +162 -8
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +15 -1
- package/dist/provider/AthenaProvider.js +163 -9
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/provider/statewire-window-context.d.ts +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/references/src/anchors/file-line-range.d.ts +58 -0
- package/dist/references/src/anchors/format.d.ts +21 -0
- package/dist/references/src/anchors/message-anchors.d.ts +71 -0
- package/dist/references/src/anchors/parse.d.ts +8 -0
- package/dist/references/src/anchors/registry-contract.d.ts +24 -0
- package/dist/references/src/anchors/registry.d.ts +19 -0
- package/dist/references/src/anchors/schemas.d.ts +194 -0
- package/dist/references/src/anchors/serialize.d.ts +8 -0
- package/dist/references/src/anchors/time.d.ts +78 -0
- package/dist/references/src/anchors/types.d.ts +474 -0
- package/dist/references/src/asset-bounds.d.ts +27 -0
- package/dist/references/src/asset-links.d.ts +23 -0
- package/dist/references/src/asset-reference.d.ts +16 -0
- package/dist/references/src/formats/format-catalog.d.ts +79 -0
- package/dist/references/src/formats/markdown/parse-reference-markdown.d.ts +28 -0
- package/dist/references/src/formats/markdown/reference-display-name.d.ts +6 -0
- package/dist/references/src/formats/object/asset-object.d.ts +9 -0
- package/dist/references/src/formats/object/callable-object.d.ts +6 -0
- package/dist/references/src/formats/object/decode-reference-object-payload.d.ts +3 -0
- package/dist/references/src/formats/object/external-url-object.d.ts +9 -0
- package/dist/references/src/formats/object/group-object.d.ts +9 -0
- package/dist/references/src/formats/object/navigation-object.d.ts +9 -0
- package/dist/references/src/formats/object/parse-reference-object.d.ts +11 -0
- package/dist/references/src/formats/object/person-object.d.ts +9 -0
- package/dist/references/src/formats/uri/asset-mention-uri.d.ts +9 -0
- package/dist/references/src/formats/uri/asset-spaces-url.d.ts +9 -0
- package/dist/references/src/formats/uri/callable-mention-uris.d.ts +9 -0
- package/dist/references/src/formats/uri/detect-uri-wire.d.ts +9 -0
- package/dist/references/src/formats/uri/group-mention-uri.d.ts +12 -0
- package/dist/references/src/formats/uri/navigation-spaces-url.d.ts +14 -0
- package/dist/references/src/formats/uri/parse-reference-uri.d.ts +20 -0
- package/dist/references/src/formats/uri/person-mention-uri.d.ts +9 -0
- package/dist/references/src/formats/uri/template-placeholder.d.ts +12 -0
- package/dist/references/src/index.d.ts +47 -0
- package/dist/references/src/legacy/index.d.ts +14 -0
- package/dist/references/src/legacy/pre-reference-asset-url.d.ts +57 -0
- package/dist/references/src/legacy/pre-reference-citation-bridge.d.ts +22 -0
- package/dist/references/src/legacy/pre-reference-citation.d.ts +138 -0
- package/dist/references/src/legacy/pre-reference-external-url.d.ts +31 -0
- package/dist/references/src/legacy/pre-reference-format.d.ts +8 -0
- package/dist/references/src/legacy/pre-reference-mention.d.ts +27 -0
- package/dist/references/src/legacy/pre-reference-object.d.ts +8 -0
- package/dist/references/src/legacy/pre-reference-uri.d.ts +12 -0
- package/dist/references/src/legacy.d.ts +2 -0
- package/dist/references/src/mention-href-patterns.d.ts +19 -0
- package/dist/references/src/mention-node/index.d.ts +5 -0
- package/dist/references/src/mention-node/mention-node.d.ts +31 -0
- package/dist/references/src/mention-node/resolve-node-attrs.d.ts +27 -0
- package/dist/references/src/parse-reference.d.ts +23 -0
- package/dist/references/src/schemas.d.ts +463 -0
- package/dist/references/src/serialize-reference.d.ts +50 -0
- package/dist/references/src/sheet-name.d.ts +10 -0
- package/dist/references/src/tool-option-schemas.d.ts +597 -0
- package/dist/references/src/types.d.ts +125 -0
- package/dist/references/src/version-ref.d.ts +30 -0
- package/dist/runtime/statewire-lifecycle.d.ts +1 -1
- package/dist/runtime/statewire-model-lane.d.ts +1 -1
- package/dist/runtime/statewire-server-lane-context.d.ts +1 -1
- package/dist/runtime/statewire-session-key.cjs +7 -0
- package/dist/runtime/statewire-session-key.cjs.map +1 -1
- package/dist/runtime/statewire-session-key.d.ts +19 -0
- package/dist/runtime/statewire-session-key.js +8 -1
- package/dist/runtime/statewire-session-key.js.map +1 -1
- package/dist/runtime/statewire-session-lane.cjs +48 -0
- package/dist/runtime/statewire-session-lane.cjs.map +1 -0
- package/dist/runtime/statewire-session-lane.d.ts +29 -0
- package/dist/runtime/statewire-session-lane.js +48 -0
- package/dist/runtime/statewire-session-lane.js.map +1 -0
- package/dist/runtime/statewire-thread-config-lane.d.ts +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +19 -5
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +15 -1
- package/dist/runtime/useAthenaStatewireRuntime.js +20 -6
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/threads/api.d.ts +1 -1
- package/dist/threads/conversation-list-fetcher.d.ts +1 -1
- package/dist/threads/index-triggered-refresh.cjs +164 -0
- package/dist/threads/index-triggered-refresh.cjs.map +1 -0
- package/dist/threads/index-triggered-refresh.d.ts +70 -0
- package/dist/threads/index-triggered-refresh.js +164 -0
- package/dist/threads/index-triggered-refresh.js.map +1 -0
- package/dist/threads/offline-session-list.d.ts +1 -1
- package/dist/threads/pull-request-display.d.ts +1 -1
- package/dist/threads/session-list-model.d.ts +1 -1
- package/dist/threads/session-list-tab-share.cjs +150 -0
- package/dist/threads/session-list-tab-share.cjs.map +1 -0
- package/dist/threads/session-list-tab-share.d.ts +73 -0
- package/dist/threads/session-list-tab-share.js +150 -0
- package/dist/threads/session-list-tab-share.js.map +1 -0
- package/dist/threads/session-row-parts.d.ts +1 -1
- package/dist/threads/sessions-query.d.ts +1 -1
- package/dist/threads/statewire-thread-list.cjs +42 -16
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +11 -2
- package/dist/threads/statewire-thread-list.js +43 -17
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/thread-prefetcher.d.ts +1 -1
- package/dist/threads/use-athena-session-attention.d.ts +1 -1
- package/dist/threads/use-athena-sessions.cjs +32 -22
- package/dist/threads/use-athena-sessions.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.js +33 -23
- package/dist/threads/use-athena-sessions.js.map +1 -1
- package/dist/threads/use-rest-conversation-history.d.ts +1 -1
- package/dist/threads/use-statewire-conversation-history.d.ts +5 -5
- package/dist/tiptap-markdown-table/src/markdown-table-serializer.d.ts +56 -0
- package/dist/tools/NestedPtcMessages.cjs +14 -9
- package/dist/tools/NestedPtcMessages.cjs.map +1 -1
- package/dist/tools/NestedPtcMessages.d.ts +9 -0
- package/dist/tools/NestedPtcMessages.js +6 -1
- package/dist/tools/NestedPtcMessages.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/primitives.d.ts +1 -1
- package/dist/tools/subagent-task-tool-ui.cjs +494 -0
- package/dist/tools/subagent-task-tool-ui.cjs.map +1 -0
- package/dist/tools/subagent-task-tool-ui.d.ts +109 -0
- package/dist/tools/subagent-task-tool-ui.js +494 -0
- package/dist/tools/subagent-task-tool-ui.js.map +1 -0
- package/dist/tools/tool-fallback.d.ts +1 -1
- package/dist/tools/tool-icons.d.ts +1 -1
- package/dist/tools/tool-summary.d.ts +1 -1
- package/dist/tools/tool-uis.cjs +4 -0
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/tool-uis.js +4 -0
- package/dist/tools/tool-uis.js.map +1 -1
- package/dist/voice/chat.cjs +6 -0
- package/dist/voice/chat.cjs.map +1 -0
- package/dist/voice/chat.d.ts +2 -0
- package/dist/voice/chat.js +6 -0
- package/dist/voice/chat.js.map +1 -0
- package/dist/voice/livekit-join.cjs +119 -0
- package/dist/voice/livekit-join.cjs.map +1 -0
- package/dist/voice/livekit-join.d.ts +8 -0
- package/dist/voice/livekit-join.js +119 -0
- package/dist/voice/livekit-join.js.map +1 -0
- package/dist/voice/livekit.cjs +32 -0
- package/dist/voice/livekit.cjs.map +1 -0
- package/dist/voice/livekit.d.ts +80 -0
- package/dist/voice/livekit.js +32 -0
- package/dist/voice/livekit.js.map +1 -0
- package/dist/voice/use-chat-voice-enabled.cjs +43 -0
- package/dist/voice/use-chat-voice-enabled.cjs.map +1 -0
- package/dist/voice/use-chat-voice-enabled.d.ts +9 -0
- package/dist/voice/use-chat-voice-enabled.js +43 -0
- package/dist/voice/use-chat-voice-enabled.js.map +1 -0
- package/package.json +22 -16
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { DeepAgentMessageWindowDeclaration } from "./message-window";
|
|
2
|
+
import { type DeepAgentHeadersResolver, type DeepAgentWakeFetch } from "./deep-agent-transport-recipe";
|
|
3
|
+
import { type AttachRetryGate, type DeepAgentAttachTimingEvent } from "./statewire-attach-observer";
|
|
4
|
+
import { type DeepAgentPrewarmTransportFactory, type DeepAgentThreadPrewarmPool, type DeepAgentThreadPrewarmPoolOptions } from "./thread-prewarm";
|
|
5
|
+
/** What signalled the intent to open the thread. */
|
|
6
|
+
export type DeepAgentPrewarmReason = "hover" | "pointerdown" | "click" | "route";
|
|
7
|
+
export interface DeepAgentThreadPrewarmControllerOptions<TState> {
|
|
8
|
+
/** Base URL of the deep-agent statewire host (the `…/v2/threads` mount). */
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
/** The mounted thread's auth resolver — a pooled attach must be the attach the thread would open. */
|
|
11
|
+
headers: DeepAgentHeadersResolver;
|
|
12
|
+
/** The mounted thread's head window declaration (`useDeepAgentThread({ messageWindow })`); the pooled dial must ask for the same shape. */
|
|
13
|
+
messageWindow?: DeepAgentMessageWindowDeclaration | undefined;
|
|
14
|
+
/** The mounted thread's lane paging (`useDeepAgentThread({ laneHistory })`); the pooled dial and the wake must declare the same contract version. */
|
|
15
|
+
laneHistory?: boolean | undefined;
|
|
16
|
+
/** SSE when true, WebSocket otherwise; match the mounted thread. */
|
|
17
|
+
sse?: boolean;
|
|
18
|
+
/** Attach timing + retry hints for both the wake and the pooled dials. */
|
|
19
|
+
onAttachTiming?: (input: {
|
|
20
|
+
threadId: string;
|
|
21
|
+
event: DeepAgentAttachTimingEvent;
|
|
22
|
+
}) => void;
|
|
23
|
+
/** A pooled hello landed (hosts with a snapshot cache remember it here). */
|
|
24
|
+
onState?: DeepAgentThreadPrewarmPoolOptions<TState>["onState"];
|
|
25
|
+
onDiscard?: DeepAgentThreadPrewarmPoolOptions<TState>["onDiscard"];
|
|
26
|
+
/** Pool sizing; defaults are the pool's own. */
|
|
27
|
+
pool?: Pick<DeepAgentThreadPrewarmPoolOptions<TState>, "maxEntries" | "graceMs" | "ttlMs">;
|
|
28
|
+
/** One wake per thread per window: the route is idempotent, a flickering hover must not hammer it. */
|
|
29
|
+
wakeDedupeMs?: number;
|
|
30
|
+
maxWakeRecords?: number;
|
|
31
|
+
/** Test seams. */
|
|
32
|
+
fetch?: DeepAgentWakeFetch;
|
|
33
|
+
retryGate?: AttachRetryGate;
|
|
34
|
+
createTransport?: DeepAgentPrewarmTransportFactory<TState>;
|
|
35
|
+
now?: () => number;
|
|
36
|
+
}
|
|
37
|
+
export interface DeepAgentThreadPrewarmController<TState> {
|
|
38
|
+
/** Hand this to `useDeepAgentThread` / `useDeepAgentRuntime` as `prewarmPool`. */
|
|
39
|
+
readonly pool: DeepAgentThreadPrewarmPool<TState>;
|
|
40
|
+
/**
|
|
41
|
+
* Warm a thread the user is about to open. Every intent wakes the server
|
|
42
|
+
* instance (`POST …/prewarm`, deduped); only a hover dwell also dials a
|
|
43
|
+
* pooled attach — a pointer-down or click is followed by the thread's own
|
|
44
|
+
* attach within a frame or two, and a pooled dial started then is disposed
|
|
45
|
+
* before its handshake completes. Returns whether a pooled dial started.
|
|
46
|
+
*/
|
|
47
|
+
prewarm(threadId: string, input: {
|
|
48
|
+
reason: DeepAgentPrewarmReason;
|
|
49
|
+
}): boolean;
|
|
50
|
+
/** The intent lapsed (pointer left the row): keep the dial warm for the grace window. */
|
|
51
|
+
release(threadId: string): void;
|
|
52
|
+
/** Whether a switch to `threadId` can seed its first frame from a pooled hello. */
|
|
53
|
+
isWarm(threadId: string): boolean;
|
|
54
|
+
/** Logout / identity change: drop every pooled dial and wake record. */
|
|
55
|
+
clear(): void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The host-agnostic half of a surface's thread prewarm: the wake-then-dial
|
|
59
|
+
* policy Olympus runs from its sidebar, over the shared attach recipe, so a
|
|
60
|
+
* conversation list in any surface warms a thread the same way. A host binds
|
|
61
|
+
* one controller per (statewire host, principal) and clears it when either
|
|
62
|
+
* changes: a pooled attach dials with that principal's token.
|
|
63
|
+
*
|
|
64
|
+
* The wake's `Retry-After` (503/429) lands in the retry gate keyed by the
|
|
65
|
+
* thread URL, and the attach recipe waits that floor out before it dials —
|
|
66
|
+
* both the pooled attach and the thread's own attach after the click honour
|
|
67
|
+
* the server's hint without any host code. The one dial that can race the
|
|
68
|
+
* hint is the hover's own speculative attach, started alongside the wake; a
|
|
69
|
+
* floor that arrives while it is still handshaking discards it.
|
|
70
|
+
*/
|
|
71
|
+
export declare function createDeepAgentThreadPrewarmController<TState>({ baseUrl, headers, messageWindow, laneHistory, sse, onAttachTiming, onState, onDiscard, pool: poolOptions, wakeDedupeMs, maxWakeRecords, fetch: fetchOverride, retryGate, createTransport, now, }: DeepAgentThreadPrewarmControllerOptions<TState>): DeepAgentThreadPrewarmController<TState>;
|
|
72
|
+
/** The retry-gate key the wake and the attach share for a thread. */
|
|
73
|
+
export declare function deepAgentPrewarmGateKey({ baseUrl, threadId, }: {
|
|
74
|
+
baseUrl: string;
|
|
75
|
+
threadId: string;
|
|
76
|
+
}): string;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { type ResourceElement } from '@assistant-ui/tap';
|
|
2
|
+
import type { Statewire } from 'statewire';
|
|
3
|
+
/**
|
|
4
|
+
* Pre-dialed statewire attaches for threads the user is ABOUT to open.
|
|
5
|
+
*
|
|
6
|
+
* A thread switch today starts its network work only after React has torn
|
|
7
|
+
* down the previous thread and mounted the new one — the attach (socket open
|
|
8
|
+
* + server authorize + history load + hello) queues behind the heaviest part
|
|
9
|
+
* of the switch. The pool moves that attach ahead of the click: on sidebar
|
|
10
|
+
* hover (dwell-gated) or pointer-down the host asks the pool to `prewarm` a
|
|
11
|
+
* thread, and the pool mounts the thread's transport in a standalone tap root
|
|
12
|
+
* — built by the same recipe the thread uses — so it dials immediately. The
|
|
13
|
+
* server does its expensive work (authorize, `_load_history`, the hello) while
|
|
14
|
+
* the pointer is still on the row, and the instance it activates stays warm
|
|
15
|
+
* for the click.
|
|
16
|
+
*
|
|
17
|
+
* A pooled attach rides a process-local session lane, never the thread's
|
|
18
|
+
* persisted one: a persisted lane is single-consumer per tab (its Web Lock
|
|
19
|
+
* serializes every session mounted on it), and a pooled root sharing the
|
|
20
|
+
* lane with the thread's own session stalled the thread's dial behind the
|
|
21
|
+
* held lock and livelocked its teardown. The pool never hands its client over,
|
|
22
|
+
* so it has no use for the lane.
|
|
23
|
+
*
|
|
24
|
+
* Warm-and-seed, not a live handoff: when the thread mounts it `take`s the
|
|
25
|
+
* pooled hello as its seed — its first frame is the transcript, with no
|
|
26
|
+
* loading treatment — and dials its OWN attach against the now-warm instance;
|
|
27
|
+
* the pooled root is disposed in the same step, so one socket is live per
|
|
28
|
+
* thread after mount. A statewire session is a single-consumer object: handing
|
|
29
|
+
* a root one tap tree mounted to another tree's client left the client's
|
|
30
|
+
* change feed unreliable, and the outgoing thread's teardown redialed the
|
|
31
|
+
* shared root in a tight loop — so the pool never shares a live root.
|
|
32
|
+
*
|
|
33
|
+
* A take that arrives BEFORE the pooled hello does not close the socket. The
|
|
34
|
+
* server is still mid-`authorize`/activation on it, and pinned treats a client
|
|
35
|
+
* that leaves before it is served as grounds to discard the half-built
|
|
36
|
+
* instance record (`LocalDirectory.discard_unserved`) — with the wake and the
|
|
37
|
+
* thread's own attach still resolving on that same record, both then bounce
|
|
38
|
+
* off "instance closing; retry" (a 503 on the wake, a 1011 close on the
|
|
39
|
+
* attach) and the click pays a statewire backoff plus a cold re-activation
|
|
40
|
+
* instead of the warm instance the hover paid for (staging, 2026-09-04: every
|
|
41
|
+
* hover the pointer clicked through within a few hundred ms did this). The
|
|
42
|
+
* taken dial is kept as an orphan until its hello lands — remembered through
|
|
43
|
+
* `onState`, then disposed — or the grace window passes. `has` / `hasState` /
|
|
44
|
+
* `take` no longer see it, but it is still a live socket: it counts toward
|
|
45
|
+
* `maxEntries` (the oldest live root evicts first, orphan or not), and a
|
|
46
|
+
* renewed `prewarm` for the same thread re-adopts it instead of dialing a
|
|
47
|
+
* second socket.
|
|
48
|
+
*
|
|
49
|
+
* Bounds: at most `maxEntries` live roots (oldest evicts), each released
|
|
50
|
+
* entry disposed after `graceMs`, every entry disposed after `ttlMs`. A root
|
|
51
|
+
* that is refused (`gone`, or an `unauthorized` retry) or whose dial fails is
|
|
52
|
+
* discarded at once so the pool never retries a denial or a dead server the
|
|
53
|
+
* thread's own attach handles (and parks) with its full policy. Nothing here
|
|
54
|
+
* decides *what* to prewarm — hosts gate on their own rules (never the active
|
|
55
|
+
* thread, never a new chat, never under a view-as lens).
|
|
56
|
+
*/
|
|
57
|
+
type TransportValue<TState> = Statewire<TState | undefined>;
|
|
58
|
+
type TransportElement<TState> = ResourceElement<TransportValue<TState>>;
|
|
59
|
+
/** Builds the thread's transport element — once per prewarm. The transport must
|
|
60
|
+
* leave its session process-local (no `sessionStore`; see the module notes). */
|
|
61
|
+
export type DeepAgentPrewarmTransportFactory<TState> = (input: {
|
|
62
|
+
threadId: string;
|
|
63
|
+
}) => TransportElement<TState>;
|
|
64
|
+
export type DeepAgentPrewarmDiscardReason = 'released' | 'expired' | 'evicted' | 'refused' | 'failed' | 'taken' | 'cleared' | 'discarded';
|
|
65
|
+
export interface DeepAgentThreadPrewarmPoolOptions<TState> {
|
|
66
|
+
createTransport: DeepAgentPrewarmTransportFactory<TState>;
|
|
67
|
+
/** Live roots retained; the oldest evicts beyond this. */
|
|
68
|
+
maxEntries?: number;
|
|
69
|
+
/** How long a released (hover-left) entry stays warm before disposal. */
|
|
70
|
+
graceMs?: number;
|
|
71
|
+
/** Hard lifetime of any entry since its prewarm. */
|
|
72
|
+
ttlMs?: number;
|
|
73
|
+
/** The hello landed on a pooled root (state is the live wire state). */
|
|
74
|
+
onState?: (input: {
|
|
75
|
+
threadId: string;
|
|
76
|
+
state: TState;
|
|
77
|
+
}) => void;
|
|
78
|
+
onDiscard?: (input: {
|
|
79
|
+
threadId: string;
|
|
80
|
+
reason: DeepAgentPrewarmDiscardReason;
|
|
81
|
+
}) => void;
|
|
82
|
+
now?: () => number;
|
|
83
|
+
}
|
|
84
|
+
/** What a mounting thread takes from the pool: the hello, if it landed. */
|
|
85
|
+
export interface PrewarmedDeepAgentHello<TState> {
|
|
86
|
+
threadId: string;
|
|
87
|
+
/** The wire state the pooled attach replicated, or `undefined` before the hello. */
|
|
88
|
+
state: TState | undefined;
|
|
89
|
+
/** Whether the pooled attach had reached `connected` when taken. */
|
|
90
|
+
connected: boolean;
|
|
91
|
+
/** `now()` at prewarm — when the dial started. */
|
|
92
|
+
dialedAt: number;
|
|
93
|
+
}
|
|
94
|
+
export interface DeepAgentThreadPrewarmPool<TState> {
|
|
95
|
+
/** Start (or refresh) a warm root for the thread. Returns `true` when a dial was started. */
|
|
96
|
+
prewarm(threadId: string): boolean;
|
|
97
|
+
/** The intent lapsed (hover left): keep the root warm for `graceMs`, then dispose. */
|
|
98
|
+
release(threadId: string): void;
|
|
99
|
+
has(threadId: string): boolean;
|
|
100
|
+
/** The root has replicated a hello. */
|
|
101
|
+
hasState(threadId: string): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Hand the pooled hello to the mounting thread and dispose the root (its
|
|
104
|
+
* socket closes): the thread seeds its first frame from the state and dials
|
|
105
|
+
* its own attach against the instance the pool warmed. Before the hello the
|
|
106
|
+
* dial stays up alongside the thread's own attach until it lands (or the
|
|
107
|
+
* grace window passes) — see the module notes — and the entry leaves the
|
|
108
|
+
* pool's view either way (`has` is false, a second take is `null`) while
|
|
109
|
+
* still counting toward `maxEntries`.
|
|
110
|
+
*/
|
|
111
|
+
take(threadId: string): PrewarmedDeepAgentHello<TState> | null;
|
|
112
|
+
/** Dispose one entry immediately (e.g. the thread attaches on its own terms). */
|
|
113
|
+
discard(threadId: string): void;
|
|
114
|
+
clear(): void;
|
|
115
|
+
readonly size: number;
|
|
116
|
+
}
|
|
117
|
+
export declare function createDeepAgentThreadPrewarmPool<TState>({ createTransport, maxEntries, graceMs, ttlMs, onState, onDiscard, now, }: DeepAgentThreadPrewarmPoolOptions<TState>): DeepAgentThreadPrewarmPool<TState>;
|
|
118
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { DeepAgentStreamValues } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Per-tab LRU of the last wire state seen per thread, so a switch back to a
|
|
4
|
+
* recently-visited thread can mount with that snapshot instead of an empty
|
|
5
|
+
* "loading" state (see `UseDeepAgentThreadOptions.snapshotCache`). Entries are
|
|
6
|
+
* references into states the wire already produced — remembering is O(1) and
|
|
7
|
+
* copies nothing; the bound is `maxThreads` retained states.
|
|
8
|
+
*/
|
|
9
|
+
export interface DeepAgentThreadSnapshotCache {
|
|
10
|
+
/** Record the latest hydrated wire state for a thread. */
|
|
11
|
+
remember(threadId: string, state: DeepAgentStreamValues): void;
|
|
12
|
+
/** The freshest remembered state for a thread, or `undefined` when none is
|
|
13
|
+
* held or the entry aged out. */
|
|
14
|
+
take(threadId: string): DeepAgentStreamValues | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Drop a single thread's entry. Called when the server refuses
|
|
17
|
+
* authorization for the thread — a refused thread must not warm-paint on
|
|
18
|
+
* its next mount.
|
|
19
|
+
*/
|
|
20
|
+
forget(threadId: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Drop every entry. Called when the acting identity changes — a snapshot
|
|
23
|
+
* captured under one account must never seed a mount under another.
|
|
24
|
+
*/
|
|
25
|
+
clear(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Whether a fresh entry is held for the thread, without consuming or
|
|
28
|
+
* touching it. Hosts read it at selection time to decide whether the switch
|
|
29
|
+
* can paint from a seed (no loading treatment) or must cover the attach
|
|
30
|
+
* wait. Optional so hand-rolled caches keep type-checking; the built-in
|
|
31
|
+
* cache implements it.
|
|
32
|
+
*/
|
|
33
|
+
peek?(threadId: string): boolean;
|
|
34
|
+
}
|
|
35
|
+
/** A write observed on the cache — the durable-mirror seam (see `onChange`). */
|
|
36
|
+
export type DeepAgentThreadSnapshotCacheChange = {
|
|
37
|
+
type: 'remember';
|
|
38
|
+
threadId: string;
|
|
39
|
+
state: DeepAgentStreamValues;
|
|
40
|
+
at: number;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'forget';
|
|
43
|
+
threadId: string;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'clear';
|
|
46
|
+
};
|
|
47
|
+
export interface DeepAgentThreadSnapshotCacheOptions {
|
|
48
|
+
/** Threads retained; the least-recently written entry evicts beyond this. */
|
|
49
|
+
maxThreads?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Entries older than this are dropped at read time. The seed's value is
|
|
52
|
+
* "the thread you just left" — a snapshot from long ago is more likely to
|
|
53
|
+
* flash content the server has since rewritten than to save a paint.
|
|
54
|
+
*/
|
|
55
|
+
maxAgeMs?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Observer of every write (`remember`, `forget`, `clear`). Hosts mirror
|
|
58
|
+
* entries into durable storage from here so a reload can seed too; the
|
|
59
|
+
* observer is never invoked for `restore`, which re-admits mirrored entries.
|
|
60
|
+
* Exceptions are swallowed — a mirror fault must not break the wire path.
|
|
61
|
+
*/
|
|
62
|
+
onChange?: (change: DeepAgentThreadSnapshotCacheChange) => void;
|
|
63
|
+
/** Injectable clock (tests). */
|
|
64
|
+
now?: () => number;
|
|
65
|
+
}
|
|
66
|
+
/** The built-in cache: the host contract plus the durable-mirror re-admission. */
|
|
67
|
+
export interface CreatedDeepAgentThreadSnapshotCache extends DeepAgentThreadSnapshotCache {
|
|
68
|
+
peek(threadId: string): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Re-admit an entry captured earlier — a mirrored snapshot after a reload —
|
|
71
|
+
* under its ORIGINAL capture time, so the age bound still applies. Never
|
|
72
|
+
* displaces a fresher in-memory entry and never notifies `onChange`.
|
|
73
|
+
*/
|
|
74
|
+
restore(threadId: string, state: DeepAgentStreamValues, at: number): void;
|
|
75
|
+
}
|
|
76
|
+
export declare function createDeepAgentThreadSnapshotCache(options?: DeepAgentThreadSnapshotCacheOptions): CreatedDeepAgentThreadSnapshotCache;
|
|
77
|
+
/**
|
|
78
|
+
* Shape a remembered wire state for use as a mount's `initialState`.
|
|
79
|
+
*
|
|
80
|
+
* Messages/todos and the other app-owned keys seed as captured. The run lane
|
|
81
|
+
* seeds by what the user left: a thread whose run was `running` when the
|
|
82
|
+
* snapshot was taken seeds a running entry (see {@link seedRunsLane}) so the
|
|
83
|
+
* switch back reads Running with a Stop control on its first frame — the same
|
|
84
|
+
* frame `runs: []` would render as "ready" with a Send button over a thread the
|
|
85
|
+
* server is still mid-run on. Every other live-lifecycle lane normalizes to
|
|
86
|
+
* resting: a seeded input request could collect a decision the server may have
|
|
87
|
+
* already resolved, so an `input-required` entry seeds as no run at all.
|
|
88
|
+
* `__interrupt__` is dropped for the same reason, and so are `ptc_subagents`
|
|
89
|
+
* (the live in-eval dispatch lane — a seeded "running" dispatch card under a
|
|
90
|
+
* resting thread would render active with no eval behind it) and
|
|
91
|
+
* `outOfBandRunActive` (the host's out-of-band-run-in-progress flag — seeding a
|
|
92
|
+
* finished run's `true` would hide the composer until the attach corrected
|
|
93
|
+
* it). Durable thread properties (`runConfig`, `config`, `sessionPersisted`, …)
|
|
94
|
+
* seed as captured; the attach snapshot then replaces the whole seed. The
|
|
95
|
+
* protocol lane seeds as a seed's own copy (`withSeedProtocolLane`), so
|
|
96
|
+
* `isDeepAgentHostState` never reads the seed, or a state folded over it, as
|
|
97
|
+
* what the host holds now.
|
|
98
|
+
*/
|
|
99
|
+
export declare function toThreadSnapshotSeed(state: DeepAgentStreamValues): DeepAgentStreamValues;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const sealedIdb = require("./sealed-idb.cjs");
|
|
3
4
|
const THREAD_SNAPSHOT_MIRROR_DATABASE = "athena-thread-snapshots:v2";
|
|
4
5
|
const THREAD_SNAPSHOT_MIRROR_FORMAT = 1;
|
|
5
6
|
const MAX_MIRRORED_SNAPSHOTS_PER_OWNER = 30;
|
|
@@ -10,77 +11,16 @@ const SNAPSHOTS_STORE = "snapshots";
|
|
|
10
11
|
const LISTS_STORE = "lists";
|
|
11
12
|
const BY_OWNER = "byOwner";
|
|
12
13
|
const BY_OWNER_AT = "byOwnerAt";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const ciphertext = new Uint8Array(
|
|
24
|
-
await crypto.subtle.encrypt(
|
|
25
|
-
{ name: "AES-GCM", iv, additionalData: encoder.encode(aad) },
|
|
26
|
-
key,
|
|
27
|
-
encoder.encode(JSON.stringify(value))
|
|
28
|
-
)
|
|
29
|
-
);
|
|
30
|
-
const sealed = new Uint8Array(IV_BYTES + ciphertext.byteLength);
|
|
31
|
-
sealed.set(iv, 0);
|
|
32
|
-
sealed.set(ciphertext, IV_BYTES);
|
|
33
|
-
return sealed;
|
|
34
|
-
}
|
|
35
|
-
async function openJson({ key, sealed, aad }) {
|
|
36
|
-
const iv = sealed.subarray(0, IV_BYTES);
|
|
37
|
-
const plaintext = await crypto.subtle.decrypt(
|
|
38
|
-
{ name: "AES-GCM", iv, additionalData: encoder.encode(aad) },
|
|
39
|
-
key,
|
|
40
|
-
sealed.subarray(IV_BYTES)
|
|
41
|
-
);
|
|
42
|
-
return JSON.parse(decoder.decode(plaintext));
|
|
43
|
-
}
|
|
44
|
-
function requestToPromise(request) {
|
|
45
|
-
return new Promise((resolve, reject) => {
|
|
46
|
-
request.onsuccess = () => resolve(request.result);
|
|
47
|
-
request.onerror = () => reject(request.error ?? new Error("IndexedDB request failed"));
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function transactionDone(tx) {
|
|
51
|
-
return new Promise((resolve, reject) => {
|
|
52
|
-
tx.oncomplete = () => resolve();
|
|
53
|
-
tx.onabort = () => reject(tx.error ?? new Error("IndexedDB transaction aborted"));
|
|
54
|
-
tx.onerror = () => reject(tx.error ?? new Error("IndexedDB transaction failed"));
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function openDatabase(factory, name) {
|
|
58
|
-
return new Promise((resolve) => {
|
|
59
|
-
try {
|
|
60
|
-
const request = factory.open(name, DATABASE_VERSION);
|
|
61
|
-
request.onupgradeneeded = () => {
|
|
62
|
-
const db = request.result;
|
|
63
|
-
if (!db.objectStoreNames.contains(SNAPSHOTS_STORE)) {
|
|
64
|
-
const store = db.createObjectStore(SNAPSHOTS_STORE, { keyPath: "key" });
|
|
65
|
-
store.createIndex(BY_OWNER, "owner", { unique: false });
|
|
66
|
-
store.createIndex(BY_OWNER_AT, ["owner", "at"], { unique: false });
|
|
67
|
-
}
|
|
68
|
-
if (!db.objectStoreNames.contains(LISTS_STORE)) {
|
|
69
|
-
const lists = db.createObjectStore(LISTS_STORE, { keyPath: "key" });
|
|
70
|
-
lists.createIndex(BY_OWNER, "owner", { unique: false });
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
request.onsuccess = () => {
|
|
74
|
-
const db = request.result;
|
|
75
|
-
db.onversionchange = () => db.close();
|
|
76
|
-
resolve(db);
|
|
77
|
-
};
|
|
78
|
-
request.onerror = () => resolve(null);
|
|
79
|
-
request.onblocked = () => resolve(null);
|
|
80
|
-
} catch {
|
|
81
|
-
resolve(null);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
14
|
+
function upgradeMirrorDatabase(db) {
|
|
15
|
+
if (!db.objectStoreNames.contains(SNAPSHOTS_STORE)) {
|
|
16
|
+
const store = db.createObjectStore(SNAPSHOTS_STORE, { keyPath: "key" });
|
|
17
|
+
store.createIndex(BY_OWNER, "owner", { unique: false });
|
|
18
|
+
store.createIndex(BY_OWNER_AT, ["owner", "at"], { unique: false });
|
|
19
|
+
}
|
|
20
|
+
if (!db.objectStoreNames.contains(LISTS_STORE)) {
|
|
21
|
+
const lists = db.createObjectStore(LISTS_STORE, { keyPath: "key" });
|
|
22
|
+
lists.createIndex(BY_OWNER, "owner", { unique: false });
|
|
23
|
+
}
|
|
84
24
|
}
|
|
85
25
|
function isRestingThreadSnapshot(state) {
|
|
86
26
|
var _a;
|
|
@@ -104,29 +44,18 @@ function isRecord(value) {
|
|
|
104
44
|
}
|
|
105
45
|
function createThreadSnapshotMirror({
|
|
106
46
|
getKey,
|
|
107
|
-
factory = idbGlobals.indexedDB,
|
|
47
|
+
factory = sealedIdb.idbGlobals.indexedDB,
|
|
108
48
|
databaseName = THREAD_SNAPSHOT_MIRROR_DATABASE,
|
|
109
49
|
debounceMs = SNAPSHOT_MIRROR_DEBOUNCE_MS,
|
|
110
50
|
maxPerOwner = MAX_MIRRORED_SNAPSHOTS_PER_OWNER,
|
|
111
51
|
maxMessages = MAX_MIRRORED_SNAPSHOT_MESSAGES
|
|
112
52
|
}) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
databasePromise = null;
|
|
120
|
-
};
|
|
121
|
-
db.addEventListener("versionchange", forget);
|
|
122
|
-
db.addEventListener("close", forget);
|
|
123
|
-
} else {
|
|
124
|
-
databasePromise = null;
|
|
125
|
-
}
|
|
126
|
-
return db;
|
|
127
|
-
}));
|
|
128
|
-
return databasePromise;
|
|
129
|
-
};
|
|
53
|
+
const database = sealedIdb.lazySealedDatabase({
|
|
54
|
+
factory,
|
|
55
|
+
name: databaseName,
|
|
56
|
+
version: DATABASE_VERSION,
|
|
57
|
+
upgrade: upgradeMirrorDatabase
|
|
58
|
+
});
|
|
130
59
|
const keyOf = async (ownerId, purpose) => {
|
|
131
60
|
try {
|
|
132
61
|
return await getKey(ownerId, purpose);
|
|
@@ -144,7 +73,7 @@ function createThreadSnapshotMirror({
|
|
|
144
73
|
return queue;
|
|
145
74
|
};
|
|
146
75
|
const pruneOwner = async (db, owner) => {
|
|
147
|
-
const KeyRange = idbGlobals.IDBKeyRange;
|
|
76
|
+
const KeyRange = sealedIdb.idbGlobals.IDBKeyRange;
|
|
148
77
|
if (!KeyRange) return;
|
|
149
78
|
const tx = db.transaction(SNAPSHOTS_STORE, "readwrite");
|
|
150
79
|
const store = tx.objectStore(SNAPSHOTS_STORE);
|
|
@@ -167,25 +96,25 @@ function createThreadSnapshotMirror({
|
|
|
167
96
|
request.onerror = () => reject(request.error ?? new Error("IndexedDB cursor failed"));
|
|
168
97
|
});
|
|
169
98
|
for (const key of beyond) {
|
|
170
|
-
if (isOwnFormat(await requestToPromise(store.get(key)))) store.delete(key);
|
|
99
|
+
if (isOwnFormat(await sealedIdb.requestToPromise(store.get(key)))) store.delete(key);
|
|
171
100
|
}
|
|
172
|
-
await transactionDone(tx);
|
|
101
|
+
await sealedIdb.transactionDone(tx);
|
|
173
102
|
};
|
|
174
103
|
const put = (input) => enqueue(async () => {
|
|
175
104
|
const db = await database();
|
|
176
105
|
if (!db) return;
|
|
177
106
|
const cryptoKey = await keyOf(input.ownerId, "write");
|
|
178
107
|
if (!cryptoKey) return;
|
|
179
|
-
const owner = await sha256Hex(input.ownerId);
|
|
180
|
-
const key = await sha256Hex(`${input.ownerId}|${input.threadId}`);
|
|
181
|
-
const sealed = await sealJson({
|
|
108
|
+
const owner = await sealedIdb.sha256Hex(input.ownerId);
|
|
109
|
+
const key = await sealedIdb.sha256Hex(`${input.ownerId}|${input.threadId}`);
|
|
110
|
+
const sealed = await sealedIdb.sealJson({
|
|
182
111
|
key: cryptoKey,
|
|
183
112
|
value: { threadId: input.threadId, state: input.state },
|
|
184
113
|
aad: aadOf("snapshot", owner, key)
|
|
185
114
|
});
|
|
186
115
|
const tx = db.transaction(SNAPSHOTS_STORE, "readwrite");
|
|
187
116
|
const store = tx.objectStore(SNAPSHOTS_STORE);
|
|
188
|
-
if (isOwnFormat(await requestToPromise(store.get(key)))) {
|
|
117
|
+
if (isOwnFormat(await sealedIdb.requestToPromise(store.get(key)))) {
|
|
189
118
|
store.put({
|
|
190
119
|
key,
|
|
191
120
|
owner,
|
|
@@ -194,17 +123,17 @@ function createThreadSnapshotMirror({
|
|
|
194
123
|
sealed
|
|
195
124
|
});
|
|
196
125
|
}
|
|
197
|
-
await transactionDone(tx);
|
|
126
|
+
await sealedIdb.transactionDone(tx);
|
|
198
127
|
await pruneOwner(db, owner);
|
|
199
128
|
});
|
|
200
129
|
const deleteSnapshot = (input) => enqueue(async () => {
|
|
201
130
|
const db = await database();
|
|
202
131
|
if (!db) return;
|
|
203
|
-
const key = await sha256Hex(`${input.ownerId}|${input.threadId}`);
|
|
132
|
+
const key = await sealedIdb.sha256Hex(`${input.ownerId}|${input.threadId}`);
|
|
204
133
|
const tx = db.transaction(SNAPSHOTS_STORE, "readwrite");
|
|
205
134
|
const store = tx.objectStore(SNAPSHOTS_STORE);
|
|
206
|
-
if (isOwnFormat(await requestToPromise(store.get(key)))) store.delete(key);
|
|
207
|
-
await transactionDone(tx);
|
|
135
|
+
if (isOwnFormat(await sealedIdb.requestToPromise(store.get(key)))) store.delete(key);
|
|
136
|
+
await sealedIdb.transactionDone(tx);
|
|
208
137
|
});
|
|
209
138
|
const pendingKey = (ownerId, threadId) => `${ownerId}\0${threadId}`;
|
|
210
139
|
const flushPending = (key) => {
|
|
@@ -219,12 +148,12 @@ function createThreadSnapshotMirror({
|
|
|
219
148
|
if (!db) return;
|
|
220
149
|
const cryptoKey = await keyOf(input.ownerId, "write");
|
|
221
150
|
if (!cryptoKey) return;
|
|
222
|
-
const owner = await sha256Hex(input.ownerId);
|
|
223
|
-
const key = await sha256Hex(`${input.ownerId}|list|${input.listKey}`);
|
|
224
|
-
const sealed = await sealJson({ key: cryptoKey, value: input.value, aad: aadOf("list", owner, key) });
|
|
151
|
+
const owner = await sealedIdb.sha256Hex(input.ownerId);
|
|
152
|
+
const key = await sealedIdb.sha256Hex(`${input.ownerId}|list|${input.listKey}`);
|
|
153
|
+
const sealed = await sealedIdb.sealJson({ key: cryptoKey, value: input.value, aad: aadOf("list", owner, key) });
|
|
225
154
|
const tx = db.transaction(LISTS_STORE, "readwrite");
|
|
226
155
|
const store = tx.objectStore(LISTS_STORE);
|
|
227
|
-
if (isOwnFormat(await requestToPromise(store.get(key)))) {
|
|
156
|
+
if (isOwnFormat(await sealedIdb.requestToPromise(store.get(key)))) {
|
|
228
157
|
store.put({
|
|
229
158
|
key,
|
|
230
159
|
owner,
|
|
@@ -233,7 +162,7 @@ function createThreadSnapshotMirror({
|
|
|
233
162
|
sealed
|
|
234
163
|
});
|
|
235
164
|
}
|
|
236
|
-
await transactionDone(tx);
|
|
165
|
+
await sealedIdb.transactionDone(tx);
|
|
237
166
|
});
|
|
238
167
|
const flushList = (key) => {
|
|
239
168
|
const entry = pendingLists.get(key);
|
|
@@ -263,8 +192,8 @@ function createThreadSnapshotMirror({
|
|
|
263
192
|
if (!db) return [];
|
|
264
193
|
const cryptoKey = await keyOf(ownerId, "read");
|
|
265
194
|
if (!cryptoKey) return [];
|
|
266
|
-
const owner = await sha256Hex(ownerId);
|
|
267
|
-
const records = await requestToPromise(
|
|
195
|
+
const owner = await sealedIdb.sha256Hex(ownerId);
|
|
196
|
+
const records = await sealedIdb.requestToPromise(
|
|
268
197
|
db.transaction(SNAPSHOTS_STORE, "readonly").objectStore(SNAPSHOTS_STORE).index(BY_OWNER).getAll(owner)
|
|
269
198
|
);
|
|
270
199
|
const loaded = [];
|
|
@@ -272,7 +201,7 @@ function createThreadSnapshotMirror({
|
|
|
272
201
|
for (const record of records) {
|
|
273
202
|
if (!record || record.format > THREAD_SNAPSHOT_MIRROR_FORMAT) continue;
|
|
274
203
|
try {
|
|
275
|
-
const value = await openJson({
|
|
204
|
+
const value = await sealedIdb.openJson({
|
|
276
205
|
key: cryptoKey,
|
|
277
206
|
sealed: record.sealed,
|
|
278
207
|
aad: aadOf("snapshot", owner, record.key)
|
|
@@ -288,7 +217,7 @@ function createThreadSnapshotMirror({
|
|
|
288
217
|
void enqueue(async () => {
|
|
289
218
|
const tx = db.transaction(SNAPSHOTS_STORE, "readwrite");
|
|
290
219
|
for (const key of unreadable) tx.objectStore(SNAPSHOTS_STORE).delete(key);
|
|
291
|
-
await transactionDone(tx);
|
|
220
|
+
await sealedIdb.transactionDone(tx);
|
|
292
221
|
});
|
|
293
222
|
}
|
|
294
223
|
return loaded.sort((a, b) => a.at - b.at);
|
|
@@ -340,14 +269,14 @@ function createThreadSnapshotMirror({
|
|
|
340
269
|
if (!db) return null;
|
|
341
270
|
const cryptoKey = await keyOf(ownerId, "read");
|
|
342
271
|
if (!cryptoKey) return null;
|
|
343
|
-
const owner = await sha256Hex(ownerId);
|
|
344
|
-
const key = await sha256Hex(`${ownerId}|list|${listKey}`);
|
|
345
|
-
const record = await requestToPromise(
|
|
272
|
+
const owner = await sealedIdb.sha256Hex(ownerId);
|
|
273
|
+
const key = await sealedIdb.sha256Hex(`${ownerId}|list|${listKey}`);
|
|
274
|
+
const record = await sealedIdb.requestToPromise(
|
|
346
275
|
db.transaction(LISTS_STORE, "readonly").objectStore(LISTS_STORE).get(key)
|
|
347
276
|
);
|
|
348
277
|
if (!record || record.format > THREAD_SNAPSHOT_MIRROR_FORMAT || record.owner !== owner) return null;
|
|
349
278
|
try {
|
|
350
|
-
const value = await openJson({ key: cryptoKey, sealed: record.sealed, aad: aadOf("list", owner, key) });
|
|
279
|
+
const value = await sealedIdb.openJson({ key: cryptoKey, sealed: record.sealed, aad: aadOf("list", owner, key) });
|
|
351
280
|
return { value, at: record.at };
|
|
352
281
|
} catch {
|
|
353
282
|
return null;
|
|
@@ -361,14 +290,14 @@ function createThreadSnapshotMirror({
|
|
|
361
290
|
return enqueue(async () => {
|
|
362
291
|
const db = await database();
|
|
363
292
|
if (!db) return;
|
|
364
|
-
const owner = await sha256Hex(ownerId);
|
|
293
|
+
const owner = await sealedIdb.sha256Hex(ownerId);
|
|
365
294
|
const tx = db.transaction([SNAPSHOTS_STORE, LISTS_STORE], "readwrite");
|
|
366
295
|
for (const storeName of [SNAPSHOTS_STORE, LISTS_STORE]) {
|
|
367
296
|
const store = tx.objectStore(storeName);
|
|
368
|
-
const keys = await requestToPromise(store.index(BY_OWNER).getAllKeys(owner));
|
|
297
|
+
const keys = await sealedIdb.requestToPromise(store.index(BY_OWNER).getAllKeys(owner));
|
|
369
298
|
for (const key of keys) store.delete(key);
|
|
370
299
|
}
|
|
371
|
-
await transactionDone(tx);
|
|
300
|
+
await sealedIdb.transactionDone(tx);
|
|
372
301
|
});
|
|
373
302
|
},
|
|
374
303
|
clearAll() {
|
|
@@ -379,7 +308,7 @@ function createThreadSnapshotMirror({
|
|
|
379
308
|
const tx = db.transaction([SNAPSHOTS_STORE, LISTS_STORE], "readwrite");
|
|
380
309
|
tx.objectStore(SNAPSHOTS_STORE).clear();
|
|
381
310
|
tx.objectStore(LISTS_STORE).clear();
|
|
382
|
-
await transactionDone(tx);
|
|
311
|
+
await sealedIdb.transactionDone(tx);
|
|
383
312
|
});
|
|
384
313
|
},
|
|
385
314
|
async flush() {
|