@athenaintel/react 0.41.2 → 0.42.1
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 +108 -9
- 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.cjs +158 -0
- package/dist/agent-runtime/src/durable-thread-snapshot-cache.cjs.map +1 -0
- package/dist/agent-runtime/src/durable-thread-snapshot-cache.d.ts +60 -0
- package/dist/agent-runtime/src/durable-thread-snapshot-cache.js +158 -0
- package/dist/agent-runtime/src/durable-thread-snapshot-cache.js.map +1 -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 +88 -4
- package/dist/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.d.ts +603 -0
- package/dist/agent-runtime/src/messages.js +88 -4
- 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.d.ts +154 -0
- 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/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 +329 -0
- package/dist/agent-runtime/src/thread-snapshot-mirror.cjs.map +1 -0
- package/dist/agent-runtime/src/thread-snapshot-mirror.d.ts +101 -0
- package/dist/agent-runtime/src/thread-snapshot-mirror.js +329 -0
- package/dist/agent-runtime/src/thread-snapshot-mirror.js.map +1 -0
- 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 +67 -0
- package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-names.d.ts +60 -0
- package/dist/agent-runtime/src/tool-names.js +68 -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 +20 -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 +168 -0
- package/dist/agent-runtime/src/use-deep-agent-runtime.js +20 -2
- package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs +12 -4
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +320 -0
- package/dist/agent-runtime/src/use-deep-agent-thread.js +12 -4
- package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs +999 -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 +999 -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.d.ts +80 -0
- 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/chat/AthenaChat.cjs +77 -6
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.js +78 -7
- 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/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 +19 -11
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +25 -9
- package/dist/chat/super-grouping/activity-timeline.js +19 -11
- 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 +102 -3
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +32 -1
- package/dist/chat-ui/composer/tiptap-composer.js +103 -4
- 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/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/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 +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -6
- package/dist/index.js +19 -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.cjs +77 -0
- package/dist/offline/offline-history.cjs.map +1 -0
- package/dist/offline/offline-history.d.ts +60 -0
- package/dist/offline/offline-history.js +77 -0
- package/dist/offline/offline-history.js.map +1 -0
- package/dist/provider/AthenaProvider.cjs +206 -9
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +22 -1
- package/dist/provider/AthenaProvider.js +207 -10
- 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 +16 -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 +16 -5
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +15 -1
- package/dist/runtime/useAthenaStatewireRuntime.js +17 -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.cjs +75 -0
- package/dist/threads/offline-session-list.cjs.map +1 -0
- package/dist/threads/offline-session-list.d.ts +27 -0
- package/dist/threads/offline-session-list.js +75 -0
- package/dist/threads/offline-session-list.js.map +1 -0
- 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 +105 -20
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +31 -3
- package/dist/threads/statewire-thread-list.js +107 -22
- 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/package.json +20 -10
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const host = globalThis;
|
|
2
|
+
function subscribeTo(targets, events, listener) {
|
|
3
|
+
const bound = targets.filter((target) => target !== void 0);
|
|
4
|
+
for (const target of bound) for (const event of events) target.addEventListener(event, listener);
|
|
5
|
+
return () => {
|
|
6
|
+
for (const target of bound) for (const event of events) target.removeEventListener(event, listener);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function browserOnlineSignal() {
|
|
10
|
+
return {
|
|
11
|
+
get: () => {
|
|
12
|
+
var _a;
|
|
13
|
+
return ((_a = host.navigator) == null ? void 0 : _a.onLine) !== false;
|
|
14
|
+
},
|
|
15
|
+
subscribe: (listener) => subscribeTo([typeof host.addEventListener === "function" ? host : void 0], ["online", "offline"], listener)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function documentVisibleSignal() {
|
|
19
|
+
return {
|
|
20
|
+
get: () => {
|
|
21
|
+
var _a;
|
|
22
|
+
return ((_a = host.document) == null ? void 0 : _a.visibilityState) !== "hidden";
|
|
23
|
+
},
|
|
24
|
+
subscribe: (listener) => subscribeTo([host.document], ["visibilitychange"], listener)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function windowInFrontSignal() {
|
|
28
|
+
const windowTarget = typeof host.addEventListener === "function" ? host : void 0;
|
|
29
|
+
return {
|
|
30
|
+
get: () => {
|
|
31
|
+
const document = host.document;
|
|
32
|
+
if (!document) return true;
|
|
33
|
+
if (document.visibilityState === "hidden") return false;
|
|
34
|
+
return typeof document.hasFocus === "function" ? document.hasFocus() : true;
|
|
35
|
+
},
|
|
36
|
+
subscribe: (listener) => {
|
|
37
|
+
const stopDocument = subscribeTo([host.document], ["visibilitychange"], listener);
|
|
38
|
+
const stopWindow = subscribeTo([windowTarget], ["focus", "blur"], listener);
|
|
39
|
+
return () => {
|
|
40
|
+
stopDocument();
|
|
41
|
+
stopWindow();
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function allChatOutboxSignals(...signals) {
|
|
47
|
+
return {
|
|
48
|
+
get: () => signals.every((signal) => signal.get()),
|
|
49
|
+
subscribe: (listener) => {
|
|
50
|
+
const stops = signals.map((signal) => signal.subscribe(listener));
|
|
51
|
+
return () => {
|
|
52
|
+
for (const stop of stops) stop();
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
allChatOutboxSignals,
|
|
59
|
+
browserOnlineSignal,
|
|
60
|
+
documentVisibleSignal,
|
|
61
|
+
windowInFrontSignal
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=chat-outbox-signals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-outbox-signals.js","sources":["../../../../agent-runtime/src/chat-outbox-signals.ts"],"sourcesContent":["import type { ChatOutboxSignal } from \"./chat-outbox\";\n\n/**\n * Default signals for the chat outbox on browser hosts. A host with its own reachability model\n * (Olympus's `athena-reachability`, the mobile app's `connectivity`) passes that instead: \"online\"\n * means the device is online AND agora answers, which the browser alone cannot tell.\n *\n * This package compiles without the DOM lib, so the browser globals are described structurally.\n */\n\ntype EventTargetLike = {\n addEventListener(type: string, listener: () => void): void;\n removeEventListener(type: string, listener: () => void): void;\n};\n\ntype BrowserHost = EventTargetLike & {\n navigator?: { onLine?: boolean };\n document?: EventTargetLike & { visibilityState?: string; hasFocus?: () => boolean };\n};\n\nconst host = globalThis as unknown as Partial<BrowserHost>;\n\nfunction subscribeTo(\n targets: readonly (EventTargetLike | undefined)[],\n events: readonly string[],\n listener: () => void,\n): () => void {\n const bound = targets.filter((target): target is EventTargetLike => target !== undefined);\n for (const target of bound) for (const event of events) target.addEventListener(event, listener);\n return () => {\n for (const target of bound) for (const event of events) target.removeEventListener(event, listener);\n };\n}\n\n/** The browser's own word on the network (`navigator.onLine`); true where there is no browser. */\nexport function browserOnlineSignal(): ChatOutboxSignal {\n return {\n get: () => host.navigator?.onLine !== false,\n subscribe: (listener) =>\n subscribeTo([typeof host.addEventListener === \"function\" ? (host as EventTargetLike) : undefined], [\"online\", \"offline\"], listener),\n };\n}\n\n/** A tab in front: the document is visible (a hidden tab never sends). */\nexport function documentVisibleSignal(): ChatOutboxSignal {\n return {\n get: () => host.document?.visibilityState !== \"hidden\",\n subscribe: (listener) => subscribeTo([host.document], [\"visibilitychange\"], listener),\n };\n}\n\n/**\n * A desktop window in front: visible and focused. An unfocused or minimized window waits until the\n * person comes back to it.\n */\nexport function windowInFrontSignal(): ChatOutboxSignal {\n const windowTarget = typeof host.addEventListener === \"function\" ? (host as EventTargetLike) : undefined;\n return {\n get: () => {\n const document = host.document;\n if (!document) return true;\n if (document.visibilityState === \"hidden\") return false;\n return typeof document.hasFocus === \"function\" ? document.hasFocus() : true;\n },\n subscribe: (listener) => {\n const stopDocument = subscribeTo([host.document], [\"visibilitychange\"], listener);\n const stopWindow = subscribeTo([windowTarget], [\"focus\", \"blur\"], listener);\n return () => {\n stopDocument();\n stopWindow();\n };\n },\n };\n}\n\n/** Both signals at once (e.g. a host's reachability AND the browser being online). */\nexport function allChatOutboxSignals(...signals: readonly ChatOutboxSignal[]): ChatOutboxSignal {\n return {\n get: () => signals.every((signal) => signal.get()),\n subscribe: (listener) => {\n const stops = signals.map((signal) => signal.subscribe(listener));\n return () => {\n for (const stop of stops) stop();\n };\n },\n };\n}\n"],"names":[],"mappings":"AAoBA,MAAM,OAAO;AAEb,SAAS,YACP,SACA,QACA,UACY;AACZ,QAAM,QAAQ,QAAQ,OAAO,CAAC,WAAsC,WAAW,MAAS;AACxF,aAAW,UAAU,MAAO,YAAW,SAAS,OAAQ,QAAO,iBAAiB,OAAO,QAAQ;AAC/F,SAAO,MAAM;AACX,eAAW,UAAU,MAAO,YAAW,SAAS,OAAQ,QAAO,oBAAoB,OAAO,QAAQ;AAAA,EACpG;AACF;AAGO,SAAS,sBAAwC;AACtD,SAAO;AAAA,IACL,KAAK,MAAA;AAjBT;AAiBe,yBAAK,cAAL,mBAAgB,YAAW;AAAA;AAAA,IACtC,WAAW,CAAC,aACV,YAAY,CAAC,OAAO,KAAK,qBAAqB,aAAc,OAA2B,MAAS,GAAG,CAAC,UAAU,SAAS,GAAG,QAAQ;AAAA,EAAA;AAExI;AAGO,SAAS,wBAA0C;AACxD,SAAO;AAAA,IACL,KAAK,MAAA;AA1BT;AA0Be,yBAAK,aAAL,mBAAe,qBAAoB;AAAA;AAAA,IAC9C,WAAW,CAAC,aAAa,YAAY,CAAC,KAAK,QAAQ,GAAG,CAAC,kBAAkB,GAAG,QAAQ;AAAA,EAAA;AAExF;AAMO,SAAS,sBAAwC;AACtD,QAAM,eAAe,OAAO,KAAK,qBAAqB,aAAc,OAA2B;AAC/F,SAAO;AAAA,IACL,KAAK,MAAM;AACT,YAAM,WAAW,KAAK;AACtB,UAAI,CAAC,SAAU,QAAO;AACtB,UAAI,SAAS,oBAAoB,SAAU,QAAO;AAClD,aAAO,OAAO,SAAS,aAAa,aAAa,SAAS,aAAa;AAAA,IACzE;AAAA,IACA,WAAW,CAAC,aAAa;AACvB,YAAM,eAAe,YAAY,CAAC,KAAK,QAAQ,GAAG,CAAC,kBAAkB,GAAG,QAAQ;AAChF,YAAM,aAAa,YAAY,CAAC,YAAY,GAAG,CAAC,SAAS,MAAM,GAAG,QAAQ;AAC1E,aAAO,MAAM;AACX,qBAAA;AACA,mBAAA;AAAA,MACF;AAAA,IACF;AAAA,EAAA;AAEJ;AAGO,SAAS,wBAAwB,SAAwD;AAC9F,SAAO;AAAA,IACL,KAAK,MAAM,QAAQ,MAAM,CAAC,WAAW,OAAO,KAAK;AAAA,IACjD,WAAW,CAAC,aAAa;AACvB,YAAM,QAAQ,QAAQ,IAAI,CAAC,WAAW,OAAO,UAAU,QAAQ,CAAC;AAChE,aAAO,MAAM;AACX,mBAAW,QAAQ,MAAO,MAAA;AAAA,MAC5B;AAAA,IACF;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const sealedIdb = require("./sealed-idb.cjs");
|
|
4
|
+
const CHAT_OUTBOX_DATABASE = "athena-chat-outbox:v1";
|
|
5
|
+
const CHAT_OUTBOX_FORMAT = 1;
|
|
6
|
+
const DATABASE_VERSION = 1;
|
|
7
|
+
const ENTRIES_STORE = "entries";
|
|
8
|
+
const BY_OWNER = "byOwner";
|
|
9
|
+
const BY_OWNER_THREAD = "byOwnerThread";
|
|
10
|
+
function upgradeOutboxDatabase(db) {
|
|
11
|
+
if (!db.objectStoreNames.contains(ENTRIES_STORE)) {
|
|
12
|
+
const store = db.createObjectStore(ENTRIES_STORE, { keyPath: "key" });
|
|
13
|
+
store.createIndex(BY_OWNER, "owner", { unique: false });
|
|
14
|
+
store.createIndex(BY_OWNER_THREAD, ["owner", "thread"], { unique: false });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function isRecord(value) {
|
|
18
|
+
return typeof value === "object" && value !== null;
|
|
19
|
+
}
|
|
20
|
+
function isOwnFormat(record) {
|
|
21
|
+
if (!isRecord(record)) return true;
|
|
22
|
+
const format = record.format;
|
|
23
|
+
return typeof format !== "number" || format <= CHAT_OUTBOX_FORMAT;
|
|
24
|
+
}
|
|
25
|
+
function readChatOutboxClaim(value) {
|
|
26
|
+
if (!isRecord(value) || typeof value.by !== "string" || typeof value.at !== "number") return void 0;
|
|
27
|
+
return { by: value.by, at: value.at };
|
|
28
|
+
}
|
|
29
|
+
const FAILURE_REASONS = /* @__PURE__ */ new Set([
|
|
30
|
+
"refused",
|
|
31
|
+
"error",
|
|
32
|
+
"prepare",
|
|
33
|
+
"attachment"
|
|
34
|
+
]);
|
|
35
|
+
function readChatOutboxFailure(value) {
|
|
36
|
+
if (!isRecord(value) || typeof value.at !== "number") return void 0;
|
|
37
|
+
const reason = typeof value.reason === "string" && FAILURE_REASONS.has(value.reason) ? value.reason : "error";
|
|
38
|
+
return { reason, at: value.at };
|
|
39
|
+
}
|
|
40
|
+
const readClaim = readChatOutboxClaim;
|
|
41
|
+
function readFiles(value) {
|
|
42
|
+
if (!Array.isArray(value)) return void 0;
|
|
43
|
+
const files = [];
|
|
44
|
+
for (const file of value) {
|
|
45
|
+
if (!isRecord(file) || typeof file.url !== "string" || typeof file.mediaType !== "string") continue;
|
|
46
|
+
files.push({
|
|
47
|
+
url: file.url,
|
|
48
|
+
mediaType: file.mediaType,
|
|
49
|
+
...typeof file.filename === "string" && { filename: file.filename }
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return files.length > 0 ? files : void 0;
|
|
53
|
+
}
|
|
54
|
+
function readAttachments(value) {
|
|
55
|
+
if (!Array.isArray(value)) return void 0;
|
|
56
|
+
const attachments = [];
|
|
57
|
+
for (const attachment of value) {
|
|
58
|
+
if (!isRecord(attachment) || typeof attachment.assetId !== "string" || attachment.assetId.length === 0) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
attachments.push({
|
|
62
|
+
assetId: attachment.assetId,
|
|
63
|
+
title: typeof attachment.title === "string" ? attachment.title : "",
|
|
64
|
+
...typeof attachment.mediaType === "string" && { mediaType: attachment.mediaType }
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return attachments.length > 0 ? attachments : void 0;
|
|
68
|
+
}
|
|
69
|
+
function parseChatOutboxEntry(value) {
|
|
70
|
+
if (!isRecord(value)) return null;
|
|
71
|
+
const { id, threadId, text, queuedAt } = value;
|
|
72
|
+
if (typeof id !== "string" || typeof threadId !== "string" || typeof text !== "string") return null;
|
|
73
|
+
if (typeof queuedAt !== "number" || !Number.isFinite(queuedAt)) return null;
|
|
74
|
+
const files = readFiles(value.files);
|
|
75
|
+
const attachments = readAttachments(value.attachments);
|
|
76
|
+
return {
|
|
77
|
+
id,
|
|
78
|
+
threadId,
|
|
79
|
+
text,
|
|
80
|
+
queuedAt,
|
|
81
|
+
newChat: value.newChat === true,
|
|
82
|
+
...typeof value.composerMarkdown === "string" && { composerMarkdown: value.composerMarkdown },
|
|
83
|
+
...typeof value.composerHtml === "string" && { composerHtml: value.composerHtml },
|
|
84
|
+
...isRecord(value.metadata) && { metadata: value.metadata },
|
|
85
|
+
...files && { files },
|
|
86
|
+
...attachments && { attachments }
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function byQueuedAt(a, b) {
|
|
90
|
+
return a.entry.queuedAt - b.entry.queuedAt;
|
|
91
|
+
}
|
|
92
|
+
function createChangeBus(channelName) {
|
|
93
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
94
|
+
const ChannelCtor = globalThis.BroadcastChannel;
|
|
95
|
+
let channel = null;
|
|
96
|
+
const emit = () => {
|
|
97
|
+
for (const listener of listeners) {
|
|
98
|
+
try {
|
|
99
|
+
listener();
|
|
100
|
+
} catch {
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
notify() {
|
|
106
|
+
emit();
|
|
107
|
+
try {
|
|
108
|
+
channel == null ? void 0 : channel.postMessage("changed");
|
|
109
|
+
} catch {
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
subscribe(listener) {
|
|
113
|
+
listeners.add(listener);
|
|
114
|
+
if (!channel && ChannelCtor) {
|
|
115
|
+
try {
|
|
116
|
+
channel = new ChannelCtor(channelName);
|
|
117
|
+
channel.onmessage = emit;
|
|
118
|
+
} catch {
|
|
119
|
+
channel = null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return () => {
|
|
123
|
+
listeners.delete(listener);
|
|
124
|
+
if (listeners.size === 0 && channel) {
|
|
125
|
+
channel.close();
|
|
126
|
+
channel = null;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function createIndexedDbChatOutboxStore(options) {
|
|
133
|
+
return withChatOutboxMemoryFallback(createSealedIndexedDbChatOutboxStore(options));
|
|
134
|
+
}
|
|
135
|
+
function createSealedIndexedDbChatOutboxStore({
|
|
136
|
+
ownerId,
|
|
137
|
+
getKey,
|
|
138
|
+
factory = sealedIdb.idbGlobals.indexedDB,
|
|
139
|
+
databaseName = CHAT_OUTBOX_DATABASE
|
|
140
|
+
}) {
|
|
141
|
+
const database = sealedIdb.lazySealedDatabase({
|
|
142
|
+
factory,
|
|
143
|
+
name: databaseName,
|
|
144
|
+
version: DATABASE_VERSION,
|
|
145
|
+
upgrade: upgradeOutboxDatabase
|
|
146
|
+
});
|
|
147
|
+
const bus = createChangeBus(`${databaseName}:changes`);
|
|
148
|
+
const keyOf = async (purpose) => {
|
|
149
|
+
try {
|
|
150
|
+
return await getKey(ownerId, purpose);
|
|
151
|
+
} catch {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const ownerHash = () => sealedIdb.sha256Hex(ownerId);
|
|
156
|
+
const threadHash = (threadId) => sealedIdb.sha256Hex(`${ownerId}|${threadId}`);
|
|
157
|
+
const recordKey = (threadId, id) => sealedIdb.sha256Hex(`${ownerId}|${threadId}|${id}`);
|
|
158
|
+
const aadOf = (owner, thread, key) => `athena-chat-outbox|${CHAT_OUTBOX_FORMAT}|${owner}|${thread}|${key}`;
|
|
159
|
+
let queue = Promise.resolve();
|
|
160
|
+
const enqueue = (task) => {
|
|
161
|
+
const run = queue.then(task, task);
|
|
162
|
+
queue = run.catch(() => void 0);
|
|
163
|
+
return run;
|
|
164
|
+
};
|
|
165
|
+
const openRecords = async (records) => {
|
|
166
|
+
if (records.length === 0) return [];
|
|
167
|
+
const cryptoKey = await keyOf("read");
|
|
168
|
+
if (!cryptoKey) return [];
|
|
169
|
+
const opened = [];
|
|
170
|
+
for (const record of records) {
|
|
171
|
+
if (!record || record.format > CHAT_OUTBOX_FORMAT) continue;
|
|
172
|
+
try {
|
|
173
|
+
const value = await sealedIdb.openJson({
|
|
174
|
+
key: cryptoKey,
|
|
175
|
+
sealed: record.sealed,
|
|
176
|
+
aad: aadOf(record.owner, record.thread, record.key)
|
|
177
|
+
});
|
|
178
|
+
const entry = parseChatOutboxEntry(value);
|
|
179
|
+
if (!entry) continue;
|
|
180
|
+
const claim = readClaim(record.claim);
|
|
181
|
+
const failure = readChatOutboxFailure(record.failure);
|
|
182
|
+
opened.push({ entry, ...claim && { claim }, ...failure && { failure } });
|
|
183
|
+
} catch {
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return opened.sort(byQueuedAt);
|
|
187
|
+
};
|
|
188
|
+
return {
|
|
189
|
+
async list(threadId) {
|
|
190
|
+
try {
|
|
191
|
+
const db = await database();
|
|
192
|
+
if (!db) return [];
|
|
193
|
+
const owner = await ownerHash();
|
|
194
|
+
const thread = await threadHash(threadId);
|
|
195
|
+
const records = await sealedIdb.requestToPromise(
|
|
196
|
+
db.transaction(ENTRIES_STORE, "readonly").objectStore(ENTRIES_STORE).index(BY_OWNER_THREAD).getAll([owner, thread])
|
|
197
|
+
);
|
|
198
|
+
return await openRecords(records);
|
|
199
|
+
} catch {
|
|
200
|
+
return [];
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
async listAll() {
|
|
204
|
+
try {
|
|
205
|
+
const db = await database();
|
|
206
|
+
if (!db) return [];
|
|
207
|
+
const owner = await ownerHash();
|
|
208
|
+
const records = await sealedIdb.requestToPromise(
|
|
209
|
+
db.transaction(ENTRIES_STORE, "readonly").objectStore(ENTRIES_STORE).index(BY_OWNER).getAll(owner)
|
|
210
|
+
);
|
|
211
|
+
return await openRecords(records);
|
|
212
|
+
} catch {
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
async count() {
|
|
217
|
+
const db = await database();
|
|
218
|
+
if (!db) return 0;
|
|
219
|
+
const owner = await ownerHash();
|
|
220
|
+
const keys = await sealedIdb.requestToPromise(
|
|
221
|
+
db.transaction(ENTRIES_STORE, "readonly").objectStore(ENTRIES_STORE).index(BY_OWNER).getAllKeys(owner)
|
|
222
|
+
);
|
|
223
|
+
return keys.length;
|
|
224
|
+
},
|
|
225
|
+
put(entry) {
|
|
226
|
+
return enqueue(async () => {
|
|
227
|
+
try {
|
|
228
|
+
const db = await database();
|
|
229
|
+
if (!db) return false;
|
|
230
|
+
const cryptoKey = await keyOf("write");
|
|
231
|
+
if (!cryptoKey) return false;
|
|
232
|
+
const owner = await ownerHash();
|
|
233
|
+
const thread = await threadHash(entry.threadId);
|
|
234
|
+
const key = await recordKey(entry.threadId, entry.id);
|
|
235
|
+
const sealed = await sealedIdb.sealJson({ key: cryptoKey, value: entry, aad: aadOf(owner, thread, key) });
|
|
236
|
+
const tx = db.transaction(ENTRIES_STORE, "readwrite");
|
|
237
|
+
const store = tx.objectStore(ENTRIES_STORE);
|
|
238
|
+
const existing = await sealedIdb.requestToPromise(store.get(key));
|
|
239
|
+
let kept = true;
|
|
240
|
+
if (isOwnFormat(existing)) {
|
|
241
|
+
store.put({
|
|
242
|
+
key,
|
|
243
|
+
owner,
|
|
244
|
+
thread,
|
|
245
|
+
at: entry.queuedAt,
|
|
246
|
+
format: CHAT_OUTBOX_FORMAT,
|
|
247
|
+
sealed
|
|
248
|
+
});
|
|
249
|
+
} else {
|
|
250
|
+
kept = false;
|
|
251
|
+
}
|
|
252
|
+
await sealedIdb.transactionDone(tx);
|
|
253
|
+
bus.notify();
|
|
254
|
+
return kept;
|
|
255
|
+
} catch {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
},
|
|
260
|
+
remove(threadId, id) {
|
|
261
|
+
return enqueue(async () => {
|
|
262
|
+
const db = await database();
|
|
263
|
+
if (!db) return;
|
|
264
|
+
const key = await recordKey(threadId, id);
|
|
265
|
+
const tx = db.transaction(ENTRIES_STORE, "readwrite");
|
|
266
|
+
const store = tx.objectStore(ENTRIES_STORE);
|
|
267
|
+
if (isOwnFormat(await sealedIdb.requestToPromise(store.get(key)))) store.delete(key);
|
|
268
|
+
await sealedIdb.transactionDone(tx);
|
|
269
|
+
bus.notify();
|
|
270
|
+
});
|
|
271
|
+
},
|
|
272
|
+
claim({ threadId, id, claimant, now, leaseMs }) {
|
|
273
|
+
return enqueue(async () => {
|
|
274
|
+
const db = await database();
|
|
275
|
+
if (!db) return "claimed";
|
|
276
|
+
const key = await recordKey(threadId, id);
|
|
277
|
+
const tx = db.transaction(ENTRIES_STORE, "readwrite");
|
|
278
|
+
const store = tx.objectStore(ENTRIES_STORE);
|
|
279
|
+
const existing = await sealedIdb.requestToPromise(store.get(key));
|
|
280
|
+
let result;
|
|
281
|
+
if (!existing) {
|
|
282
|
+
result = "gone";
|
|
283
|
+
} else {
|
|
284
|
+
const claim = readClaim(existing.claim);
|
|
285
|
+
if (claim && claim.by !== claimant && now - claim.at < leaseMs) {
|
|
286
|
+
result = "taken";
|
|
287
|
+
} else {
|
|
288
|
+
store.put({ ...existing, claim: { by: claimant, at: now } });
|
|
289
|
+
result = "claimed";
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
await sealedIdb.transactionDone(tx);
|
|
293
|
+
if (result === "claimed") bus.notify();
|
|
294
|
+
return result;
|
|
295
|
+
});
|
|
296
|
+
},
|
|
297
|
+
release({ threadId, id, claimant }) {
|
|
298
|
+
return enqueue(async () => {
|
|
299
|
+
var _a;
|
|
300
|
+
const db = await database();
|
|
301
|
+
if (!db) return;
|
|
302
|
+
const key = await recordKey(threadId, id);
|
|
303
|
+
const tx = db.transaction(ENTRIES_STORE, "readwrite");
|
|
304
|
+
const store = tx.objectStore(ENTRIES_STORE);
|
|
305
|
+
const existing = await sealedIdb.requestToPromise(store.get(key));
|
|
306
|
+
if (existing && ((_a = readClaim(existing.claim)) == null ? void 0 : _a.by) === claimant) {
|
|
307
|
+
const { claim: _claim, ...rest } = existing;
|
|
308
|
+
store.put(rest);
|
|
309
|
+
}
|
|
310
|
+
await sealedIdb.transactionDone(tx);
|
|
311
|
+
bus.notify();
|
|
312
|
+
});
|
|
313
|
+
},
|
|
314
|
+
markFailed({ threadId, id, claimant, failure }) {
|
|
315
|
+
return enqueue(async () => {
|
|
316
|
+
var _a;
|
|
317
|
+
const db = await database();
|
|
318
|
+
if (!db) return;
|
|
319
|
+
const key = await recordKey(threadId, id);
|
|
320
|
+
const tx = db.transaction(ENTRIES_STORE, "readwrite");
|
|
321
|
+
const store = tx.objectStore(ENTRIES_STORE);
|
|
322
|
+
const existing = await sealedIdb.requestToPromise(store.get(key));
|
|
323
|
+
if (existing && isOwnFormat(existing)) {
|
|
324
|
+
const { claim, ...rest } = existing;
|
|
325
|
+
const keepClaim = claim !== void 0 && ((_a = readClaim(claim)) == null ? void 0 : _a.by) !== claimant;
|
|
326
|
+
store.put({
|
|
327
|
+
...rest,
|
|
328
|
+
...keepClaim && { claim },
|
|
329
|
+
failure: { reason: failure.reason, at: failure.at }
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
await sealedIdb.transactionDone(tx);
|
|
333
|
+
bus.notify();
|
|
334
|
+
});
|
|
335
|
+
},
|
|
336
|
+
clearFailure({ threadId, id }) {
|
|
337
|
+
return enqueue(async () => {
|
|
338
|
+
const db = await database();
|
|
339
|
+
if (!db) return;
|
|
340
|
+
const key = await recordKey(threadId, id);
|
|
341
|
+
const tx = db.transaction(ENTRIES_STORE, "readwrite");
|
|
342
|
+
const store = tx.objectStore(ENTRIES_STORE);
|
|
343
|
+
const existing = await sealedIdb.requestToPromise(store.get(key));
|
|
344
|
+
if ((existing == null ? void 0 : existing.failure) !== void 0 && isOwnFormat(existing)) {
|
|
345
|
+
const { failure: _failure, ...rest } = existing;
|
|
346
|
+
store.put(rest);
|
|
347
|
+
}
|
|
348
|
+
await sealedIdb.transactionDone(tx);
|
|
349
|
+
bus.notify();
|
|
350
|
+
});
|
|
351
|
+
},
|
|
352
|
+
clear() {
|
|
353
|
+
return enqueue(async () => {
|
|
354
|
+
const db = await database();
|
|
355
|
+
if (!db) return;
|
|
356
|
+
const owner = await ownerHash();
|
|
357
|
+
const tx = db.transaction(ENTRIES_STORE, "readwrite");
|
|
358
|
+
const store = tx.objectStore(ENTRIES_STORE);
|
|
359
|
+
const keys = await sealedIdb.requestToPromise(store.index(BY_OWNER).getAllKeys(owner));
|
|
360
|
+
for (const key of keys) store.delete(key);
|
|
361
|
+
await sealedIdb.transactionDone(tx);
|
|
362
|
+
bus.notify();
|
|
363
|
+
});
|
|
364
|
+
},
|
|
365
|
+
subscribe: (listener) => bus.subscribe(listener)
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
function createRecordMap() {
|
|
369
|
+
const records = /* @__PURE__ */ new Map();
|
|
370
|
+
const keyOf = (threadId, id) => `${threadId}\0${id}`;
|
|
371
|
+
return {
|
|
372
|
+
records,
|
|
373
|
+
keyOf,
|
|
374
|
+
has: (threadId, id) => records.has(keyOf(threadId, id)),
|
|
375
|
+
sorted: (filter) => [...records.values()].filter(filter).map((record) => ({ ...record })).sort(byQueuedAt),
|
|
376
|
+
claim({ threadId, id, claimant, now, leaseMs }) {
|
|
377
|
+
const key = keyOf(threadId, id);
|
|
378
|
+
const record = records.get(key);
|
|
379
|
+
if (!record) return "gone";
|
|
380
|
+
if (record.claim && record.claim.by !== claimant && now - record.claim.at < leaseMs) return "taken";
|
|
381
|
+
records.set(key, { ...record, claim: { by: claimant, at: now } });
|
|
382
|
+
return "claimed";
|
|
383
|
+
},
|
|
384
|
+
release({ threadId, id, claimant }) {
|
|
385
|
+
var _a;
|
|
386
|
+
const key = keyOf(threadId, id);
|
|
387
|
+
const record = records.get(key);
|
|
388
|
+
if (((_a = record == null ? void 0 : record.claim) == null ? void 0 : _a.by) !== claimant) return;
|
|
389
|
+
const { claim: _claim, ...rest } = record;
|
|
390
|
+
records.set(key, rest);
|
|
391
|
+
},
|
|
392
|
+
markFailed({ threadId, id, claimant, failure }) {
|
|
393
|
+
const key = keyOf(threadId, id);
|
|
394
|
+
const record = records.get(key);
|
|
395
|
+
if (!record) return;
|
|
396
|
+
const { claim, ...rest } = record;
|
|
397
|
+
records.set(key, { ...rest, ...claim && claim.by !== claimant && { claim }, failure: { ...failure } });
|
|
398
|
+
},
|
|
399
|
+
clearFailure({ threadId, id }) {
|
|
400
|
+
const key = keyOf(threadId, id);
|
|
401
|
+
const record = records.get(key);
|
|
402
|
+
if (!(record == null ? void 0 : record.failure)) return;
|
|
403
|
+
const { failure: _failure, ...rest } = record;
|
|
404
|
+
records.set(key, rest);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
function createListenerSet() {
|
|
409
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
410
|
+
return {
|
|
411
|
+
notify() {
|
|
412
|
+
for (const listener of listeners) {
|
|
413
|
+
try {
|
|
414
|
+
listener();
|
|
415
|
+
} catch {
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
subscribe(listener) {
|
|
420
|
+
listeners.add(listener);
|
|
421
|
+
return () => {
|
|
422
|
+
listeners.delete(listener);
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
function withChatOutboxMemoryFallback(inner) {
|
|
428
|
+
const memory = createRecordMap();
|
|
429
|
+
const local = createListenerSet();
|
|
430
|
+
const remembered = (filter) => memory.sorted(filter).map((record) => ({ ...record, memoryOnly: true }));
|
|
431
|
+
const merged = (kept, extra) => {
|
|
432
|
+
const ids = new Set(kept.map((record) => record.entry.id));
|
|
433
|
+
return [...kept, ...extra.filter((record) => !ids.has(record.entry.id))].sort(byQueuedAt);
|
|
434
|
+
};
|
|
435
|
+
return {
|
|
436
|
+
async list(threadId) {
|
|
437
|
+
const kept = await inner.list(threadId).catch(() => []);
|
|
438
|
+
return merged(kept, remembered((record) => record.entry.threadId === threadId));
|
|
439
|
+
},
|
|
440
|
+
async listAll() {
|
|
441
|
+
const kept = await inner.listAll().catch(() => []);
|
|
442
|
+
return merged(kept, remembered(() => true));
|
|
443
|
+
},
|
|
444
|
+
async count() {
|
|
445
|
+
return await inner.count() + memory.records.size;
|
|
446
|
+
},
|
|
447
|
+
async put(entry) {
|
|
448
|
+
let kept = false;
|
|
449
|
+
try {
|
|
450
|
+
kept = await inner.put(entry);
|
|
451
|
+
} catch {
|
|
452
|
+
kept = false;
|
|
453
|
+
}
|
|
454
|
+
if (kept) return true;
|
|
455
|
+
memory.records.set(memory.keyOf(entry.threadId, entry.id), { entry });
|
|
456
|
+
local.notify();
|
|
457
|
+
return false;
|
|
458
|
+
},
|
|
459
|
+
async remove(threadId, id) {
|
|
460
|
+
if (memory.records.delete(memory.keyOf(threadId, id))) {
|
|
461
|
+
local.notify();
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
await inner.remove(threadId, id);
|
|
465
|
+
},
|
|
466
|
+
async claim(input) {
|
|
467
|
+
if (!memory.has(input.threadId, input.id)) return inner.claim(input);
|
|
468
|
+
const result = memory.claim(input);
|
|
469
|
+
local.notify();
|
|
470
|
+
return result;
|
|
471
|
+
},
|
|
472
|
+
async release(input) {
|
|
473
|
+
if (!memory.has(input.threadId, input.id)) return inner.release(input);
|
|
474
|
+
memory.release(input);
|
|
475
|
+
local.notify();
|
|
476
|
+
},
|
|
477
|
+
async markFailed(input) {
|
|
478
|
+
if (!memory.has(input.threadId, input.id)) return inner.markFailed(input);
|
|
479
|
+
memory.markFailed(input);
|
|
480
|
+
local.notify();
|
|
481
|
+
},
|
|
482
|
+
async clearFailure(input) {
|
|
483
|
+
if (!memory.has(input.threadId, input.id)) return inner.clearFailure(input);
|
|
484
|
+
memory.clearFailure(input);
|
|
485
|
+
local.notify();
|
|
486
|
+
},
|
|
487
|
+
async clear() {
|
|
488
|
+
memory.records.clear();
|
|
489
|
+
local.notify();
|
|
490
|
+
await inner.clear();
|
|
491
|
+
},
|
|
492
|
+
subscribe(listener) {
|
|
493
|
+
const stopLocal = local.subscribe(listener);
|
|
494
|
+
const stopInner = inner.subscribe(listener);
|
|
495
|
+
return () => {
|
|
496
|
+
stopLocal();
|
|
497
|
+
stopInner();
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
exports.CHAT_OUTBOX_DATABASE = CHAT_OUTBOX_DATABASE;
|
|
503
|
+
exports.CHAT_OUTBOX_FORMAT = CHAT_OUTBOX_FORMAT;
|
|
504
|
+
exports.createIndexedDbChatOutboxStore = createIndexedDbChatOutboxStore;
|
|
505
|
+
exports.parseChatOutboxEntry = parseChatOutboxEntry;
|
|
506
|
+
exports.readChatOutboxClaim = readChatOutboxClaim;
|
|
507
|
+
exports.readChatOutboxFailure = readChatOutboxFailure;
|
|
508
|
+
exports.withChatOutboxMemoryFallback = withChatOutboxMemoryFallback;
|
|
509
|
+
//# sourceMappingURL=chat-outbox-store.cjs.map
|