@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
package/dist/index.cjs
CHANGED
|
@@ -38,10 +38,13 @@ const statewireLifecycle = require("./runtime/statewire-lifecycle.cjs");
|
|
|
38
38
|
const statewireThreadList = require("./threads/statewire-thread-list.cjs");
|
|
39
39
|
const WaitingOnYouBanner = require("./chat/WaitingOnYouBanner.cjs");
|
|
40
40
|
const wakeMarker = require("./chat-ui/messages/wake-marker.cjs");
|
|
41
|
+
const offlineHistory = require("./offline/offline-history.cjs");
|
|
42
|
+
const chatOutbox = require("./offline/chat-outbox.cjs");
|
|
41
43
|
const tiptapText = require("./chat/tiptap-text.cjs");
|
|
42
44
|
const athenaCitationLinks = require("./chat/athena-citation-links.cjs");
|
|
43
45
|
const tooltipIconButton = require("./chat/tooltip-icon-button.cjs");
|
|
44
46
|
const toolUis = require("./tools/tool-uis.cjs");
|
|
47
|
+
const subagentTaskToolUi = require("./tools/subagent-task-tool-ui.cjs");
|
|
45
48
|
const primitives = require("./tools/primitives.cjs");
|
|
46
49
|
const miscToolUis = require("./tools/misc-tool-uis.cjs");
|
|
47
50
|
const toolIcons = require("./tools/tool-icons.cjs");
|
|
@@ -133,6 +136,8 @@ const toolMetadata = require("./agent-runtime/src/tool-metadata.cjs");
|
|
|
133
136
|
const githubWakeEvent = require("./agent-runtime/src/github-wake-event.cjs");
|
|
134
137
|
const threadExtras = require("./agent-runtime/src/thread-extras.cjs");
|
|
135
138
|
const toolAppearance = require("./tools/tool-appearance.cjs");
|
|
139
|
+
const subagents = require("./agent-runtime/src/subagents.cjs");
|
|
140
|
+
const chatOutboxSignals = require("./agent-runtime/src/chat-outbox-signals.cjs");
|
|
136
141
|
exports.ATHENA_REACT_SDK_VERSION = version.ATHENA_REACT_SDK_VERSION;
|
|
137
142
|
exports.athenaDiagnostics = athenaDiagnostics.athenaDiagnostics;
|
|
138
143
|
exports.installAthenaDiagnosticsGlobal = athenaDiagnostics.installAthenaDiagnosticsGlobal;
|
|
@@ -196,6 +201,7 @@ exports.workedDurationMs = turnTiming.workedDurationMs;
|
|
|
196
201
|
exports.defaultGetToolGroupKey = toolkitMap.defaultGetToolGroupKey;
|
|
197
202
|
exports.StatewireApprovalCard = StatewireApprovalCard.StatewireApprovalCard;
|
|
198
203
|
exports.useStatewireApprovalRequest = useStatewireApprovalRequest.useStatewireApprovalRequest;
|
|
204
|
+
exports.useStatewireApprovalWait = useStatewireApprovalRequest.useStatewireApprovalWait;
|
|
199
205
|
exports.useAthenaRunLive = useAthenaRunLive.useAthenaRunLive;
|
|
200
206
|
exports.StatewireHistoryEdge = statewireHistoryEdge.StatewireHistoryEdge;
|
|
201
207
|
exports.ThreadLoadingOverlay = threadLoadingOverlay.ThreadLoadingOverlay;
|
|
@@ -219,6 +225,15 @@ exports.WaitingOnYouBanner = WaitingOnYouBanner.WaitingOnYouBanner;
|
|
|
219
225
|
exports.WaitingOnYouBannerView = WaitingOnYouBanner.WaitingOnYouBannerView;
|
|
220
226
|
exports.WakeMarkerCard = wakeMarker.WakeMarkerCard;
|
|
221
227
|
exports.WakeMarkerMessage = wakeMarker.WakeMarkerMessage;
|
|
228
|
+
exports.OFFLINE_SNAPSHOT_READ_WAIT_MS = offlineHistory.OFFLINE_SNAPSHOT_READ_WAIT_MS;
|
|
229
|
+
exports.OfflineSnapshotBanner = offlineHistory.OfflineSnapshotBanner;
|
|
230
|
+
exports.formatOfflineSnapshotTime = offlineHistory.formatOfflineSnapshotTime;
|
|
231
|
+
exports.useAthenaOfflineSnapshotAt = offlineHistory.useAthenaOfflineSnapshotAt;
|
|
232
|
+
exports.clearChatOutbox = chatOutbox.clearChatOutbox;
|
|
233
|
+
exports.clearUnopenableChatOutbox = chatOutbox.clearUnopenableChatOutbox;
|
|
234
|
+
exports.countChatOutboxMessages = chatOutbox.countChatOutboxMessages;
|
|
235
|
+
exports.listChatOutboxMessages = chatOutbox.listChatOutboxMessages;
|
|
236
|
+
exports.subscribeChatOutbox = chatOutbox.subscribeChatOutbox;
|
|
222
237
|
exports.TiptapText = tiptapText.TiptapText;
|
|
223
238
|
exports.isAthenaCitationUrl = athenaCitationLinks.isAthenaCitationUrl;
|
|
224
239
|
exports.parseAthenaCitationLink = athenaCitationLinks.parseAthenaCitationLink;
|
|
@@ -244,6 +259,7 @@ exports.UpdateSheetRangeToolUI = toolUis.UpdateSheetRangeToolUI;
|
|
|
244
259
|
exports.WebSearchToolUI = toolUis.WebSearchToolUI;
|
|
245
260
|
exports.createAssetToolUI = toolUis.createAssetToolUI;
|
|
246
261
|
exports.resetAssetAutoOpen = toolUis.resetAssetAutoOpen;
|
|
262
|
+
exports.SubagentTaskToolUI = subagentTaskToolUi.SubagentTaskToolUI;
|
|
247
263
|
exports.CopyToolSpecButton = primitives.CopyToolSpecButton;
|
|
248
264
|
exports.ExpandableSection = primitives.ExpandableSection;
|
|
249
265
|
exports.ToolCard = primitives.ToolCard;
|
|
@@ -534,4 +550,6 @@ exports.isGithubWakeMessage = githubWakeEvent.isGithubWakeMessage;
|
|
|
534
550
|
exports.readGithubWakeEvent = githubWakeEvent.readGithubWakeEvent;
|
|
535
551
|
exports.hasStatewireThreadExtras = threadExtras.hasStatewireThreadExtras;
|
|
536
552
|
exports.useToolAppearance = toolAppearance.useToolAppearance;
|
|
553
|
+
exports.useTurnToolCallsAwaitingApproval = subagents.useTurnToolCallsAwaitingApproval;
|
|
554
|
+
exports.windowInFrontSignal = chatOutboxSignals.windowInFrontSignal;
|
|
537
555
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,9 @@ export { StatewireApprovalCard } from './chat/StatewireApprovalCard';
|
|
|
25
25
|
export type { StatewireApprovalCardProps, StatewireApprovalEditorContext, StatewireApprovalRequestContext, } from './chat/StatewireApprovalCard';
|
|
26
26
|
export { useStatewireApprovalRequest } from './chat/use-statewire-approval-request';
|
|
27
27
|
export type { StatewireApprovalRequest, StatewireInterruptPredicate, UseStatewireApprovalRequestOptions, } from './chat/use-statewire-approval-request';
|
|
28
|
+
export { useStatewireApprovalWait } from './chat/use-statewire-approval-request';
|
|
29
|
+
export type { StatewireApprovalWait } from './chat/use-statewire-approval-request';
|
|
30
|
+
export { useTurnToolCallsAwaitingApproval } from './agent-runtime/src/index';
|
|
28
31
|
export { useAthenaRunLive } from './chat/use-athena-run-live';
|
|
29
32
|
export { StatewireHistoryEdge } from './chat-ui/thread/statewire-history-edge';
|
|
30
33
|
export type { StatewireHistoryEdgeProps } from './chat-ui/thread/statewire-history-edge';
|
|
@@ -37,8 +40,8 @@ export { StatewireConnectionBanner, StatewireErrorBanner, } from './chat/statewi
|
|
|
37
40
|
export type { StatewireErrorBannerProps } from './chat/statewire-banners';
|
|
38
41
|
export { RUN_START_REFUSAL_FALLBACK_MESSAGE, StatewireRunRefusalNotice, } from './chat/StatewireRunRefusalNotice';
|
|
39
42
|
export type { StatewireRunRefusalNoticeProps } from './chat/StatewireRunRefusalNotice';
|
|
40
|
-
export { COLLAB_AGENT_CHANNEL_SESSION_MISMATCH, readRunStartRefusal, } from '
|
|
41
|
-
export type { RunStartRefusal } from '
|
|
43
|
+
export { COLLAB_AGENT_CHANNEL_SESSION_MISMATCH, readRunStartRefusal, } from './agent-runtime/src/index';
|
|
44
|
+
export type { RunStartRefusal } from './agent-runtime/src/index';
|
|
42
45
|
export { StatewireClientToolBridge } from './chat/StatewireClientToolBridge';
|
|
43
46
|
export { collectStatewireClientTools, statewireClientToolWireEntries, } from './chat/statewire-client-tools';
|
|
44
47
|
export type { StatewireClientTool } from './chat/statewire-client-tools';
|
|
@@ -51,6 +54,11 @@ export { WaitingOnYouBanner, WaitingOnYouBannerView } from './chat/WaitingOnYouB
|
|
|
51
54
|
export type { WaitingOnYouBannerProps, WaitingOnYouBannerViewProps, } from './chat/WaitingOnYouBanner';
|
|
52
55
|
export { WakeMarkerCard, WakeMarkerMessage } from './chat-ui/messages/wake-marker';
|
|
53
56
|
export type { WakeMarkerCardProps } from './chat-ui/messages/wake-marker';
|
|
57
|
+
export { formatOfflineSnapshotTime, OFFLINE_SNAPSHOT_READ_WAIT_MS, OfflineSnapshotBanner, useAthenaOfflineSnapshotAt, } from './offline/offline-history';
|
|
58
|
+
export type { AthenaOfflineHistory, OfflineSnapshotBannerProps, } from './offline/offline-history';
|
|
59
|
+
export { type AthenaChatOutbox, clearChatOutbox, clearUnopenableChatOutbox, type ChatOutboxMessageSummary, countChatOutboxMessages, listChatOutboxMessages, subscribeChatOutbox, } from './offline/chat-outbox';
|
|
60
|
+
/** For an `AthenaChatOutbox` host: the key purposes, and the desktop's "window in front" signal. */
|
|
61
|
+
export { type ChatOutboxKeyPurpose, windowInFrontSignal } from './agent-runtime/src/index';
|
|
54
62
|
export { asHitlApproval, hasStatewireThreadExtras, HITL_PENDING_RESUME_GRACE_MS, isPendingInterrupt, readInterruptMessage, } from './chat/statewire-approval';
|
|
55
63
|
export type { HitlApprovalPayload } from './chat/statewire-approval';
|
|
56
64
|
export { TiptapText } from './chat/tiptap-text';
|
|
@@ -60,12 +68,13 @@ export { TooltipIconButton } from './chat/tooltip-icon-button';
|
|
|
60
68
|
export type { TooltipIconButtonProps } from './chat/tooltip-icon-button';
|
|
61
69
|
export { TOOL_UI_REGISTRY } from './tools/tool-uis';
|
|
62
70
|
export { WebSearchToolUI, BrowseToolUI, OpenBrowserToolUI, EmailSearchToolUI, CreateDocumentToolUI, CreateSheetToolUI, CreatePresentationToolUI, CreateNotebookToolUI, RunPythonCodeToolUI, OpenAssetToolUI, CreateEmailDraftToolUI, UpdateSheetRangeToolUI, DescribeDatabaseToolUI, ListDatabaseTablesToolUI, GetDatabaseTableSchemaToolUI, RunSqlToolUI, createAssetToolUI, resetAssetAutoOpen, } from './tools/tool-uis';
|
|
71
|
+
export { SubagentTaskToolUI } from './tools/subagent-task-tool-ui';
|
|
63
72
|
export { CopyToolSpecButton, ExpandableSection, formatToolName, normalizeResult, ToolCard, truncate, } from './tools/primitives';
|
|
64
73
|
export type { ToolStatus } from './tools/primitives';
|
|
65
74
|
export { InstallPackageToolUI } from './tools/misc-tool-uis';
|
|
66
75
|
export { TOOL_ICONS, toolIcon } from './tools/tool-icons';
|
|
67
|
-
export { classifyToolResult, describeToolArgs, getToolDisplayMeta, isToolResultSuccess, resultMessage, toolActiveLabel, toolCompletedLabel, } from '
|
|
68
|
-
export type { ToolDisplayMeta, ToolIconKey, ToolResultClassification, } from '
|
|
76
|
+
export { classifyToolResult, describeToolArgs, getToolDisplayMeta, isToolResultSuccess, resultMessage, toolActiveLabel, toolCompletedLabel, } from './agent-runtime/src/index';
|
|
77
|
+
export type { ToolDisplayMeta, ToolIconKey, ToolResultClassification, } from './agent-runtime/src/index';
|
|
69
78
|
export { HiddenWriteTodosToolUI, PlanStepMarker, WriteTodosToolUI, parseTodoPlan, } from './tools/write-todos-tool-ui';
|
|
70
79
|
export { useLatestTodoPlan } from './tools/todo-plan-store';
|
|
71
80
|
export type { LatestTodoPlan } from './tools/todo-plan-store';
|
|
@@ -143,8 +152,8 @@ export type { SessionStatusChip, SessionStatusTone, SessionsColumn, SessionsColu
|
|
|
143
152
|
export type { ThreadReadStateTarget } from './threads/use-thread-read-state';
|
|
144
153
|
export { groupSessions, orderedPullRequests, pullRequestChip, pullRequestChipState, sessionIndicator, sessionListGroupOf, sessionOriginBadge, sessionOriginLabel, sessionSecondaryLine, WEB_APP_ORIGIN_LABEL, } from './threads/session-list-model';
|
|
145
154
|
export type { PullRequestChip, PullRequestChipState, SessionIndicator, SessionLineTone, SessionListGroup, SessionListSection, SessionOriginBadges, SessionSecondaryLine, } from './threads/session-list-model';
|
|
146
|
-
export { deriveConversationAttention, githubWakeEventLabel, githubWakeMarkerText, isGithubWakeMessage, readGithubWakeEvent, } from '
|
|
147
|
-
export type { ConversationAttention, ConversationAttentionSource, ConversationPullRequest, ConversationSummary, ConversationWake, GithubWakeEvent, } from '
|
|
155
|
+
export { deriveConversationAttention, githubWakeEventLabel, githubWakeMarkerText, isGithubWakeMessage, readGithubWakeEvent, } from './agent-runtime/src/index';
|
|
156
|
+
export type { ConversationAttention, ConversationAttentionSource, ConversationPullRequest, ConversationSummary, ConversationWake, GithubWakeEvent, } from './agent-runtime/src/index';
|
|
148
157
|
export type { ThreadFavoriteResponse, ThreadInboxDismissResponse, ThreadListFilterBody, ThreadListResponse, ThreadPullRequest, ThreadRenameResponse, ThreadSummary, ThreadWake, } from './threads/api';
|
|
149
158
|
export { useRefreshThreadList } from './threads/statewire-thread-list';
|
|
150
159
|
export { useAthenaThreadId, AthenaThreadIdContext, useAthenaStatewireThreadId, } from './threads/thread-id-context';
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import { splitTurnSegments } from "./chat/super-grouping/turn-segments.js";
|
|
|
20
20
|
import { formatWorkDuration, readTurnTiming, workedDurationMs } from "./chat/super-grouping/turn-timing.js";
|
|
21
21
|
import { defaultGetToolGroupKey } from "./chat/super-grouping/toolkit-map.js";
|
|
22
22
|
import { StatewireApprovalCard } from "./chat/StatewireApprovalCard.js";
|
|
23
|
-
import { useStatewireApprovalRequest } from "./chat/use-statewire-approval-request.js";
|
|
23
|
+
import { useStatewireApprovalRequest, useStatewireApprovalWait } from "./chat/use-statewire-approval-request.js";
|
|
24
24
|
import { useAthenaRunLive } from "./chat/use-athena-run-live.js";
|
|
25
25
|
import { StatewireHistoryEdge } from "./chat-ui/thread/statewire-history-edge.js";
|
|
26
26
|
import { ThreadLoadingOverlay } from "./chat-ui/thread/thread-loading-overlay.js";
|
|
@@ -36,10 +36,13 @@ import { athenaStatewireErrorNotice } from "./runtime/statewire-lifecycle.js";
|
|
|
36
36
|
import { threadSummaryFromConversation, useAthenaStatewireThreadList, useRefreshThreadList } from "./threads/statewire-thread-list.js";
|
|
37
37
|
import { WaitingOnYouBanner, WaitingOnYouBannerView } from "./chat/WaitingOnYouBanner.js";
|
|
38
38
|
import { WakeMarkerCard, WakeMarkerMessage } from "./chat-ui/messages/wake-marker.js";
|
|
39
|
+
import { OFFLINE_SNAPSHOT_READ_WAIT_MS, OfflineSnapshotBanner, formatOfflineSnapshotTime, useAthenaOfflineSnapshotAt } from "./offline/offline-history.js";
|
|
40
|
+
import { clearChatOutbox, clearUnopenableChatOutbox, countChatOutboxMessages, listChatOutboxMessages, subscribeChatOutbox } from "./offline/chat-outbox.js";
|
|
39
41
|
import { TiptapText } from "./chat/tiptap-text.js";
|
|
40
42
|
import { isAthenaCitationUrl, parseAthenaCitationLink, useAthenaCitationLinkHandler, useAthenaLinkClickHandler } from "./chat/athena-citation-links.js";
|
|
41
43
|
import { TooltipIconButton } from "./chat/tooltip-icon-button.js";
|
|
42
44
|
import { BrowseToolUI, CreateDocumentToolUI, CreateEmailDraftToolUI, CreateNotebookToolUI, CreatePresentationToolUI, CreateSheetToolUI, DescribeDatabaseToolUI, EmailSearchToolUI, GetDatabaseTableSchemaToolUI, ListDatabaseTablesToolUI, OpenAssetToolUI, OpenBrowserToolUI, RunPythonCodeToolUI, RunSqlToolUI, TOOL_UI_REGISTRY, UpdateSheetRangeToolUI, WebSearchToolUI, createAssetToolUI, resetAssetAutoOpen } from "./tools/tool-uis.js";
|
|
45
|
+
import { SubagentTaskToolUI } from "./tools/subagent-task-tool-ui.js";
|
|
43
46
|
import { CopyToolSpecButton, ExpandableSection, ToolCard, normalizeResult, truncate } from "./tools/primitives.js";
|
|
44
47
|
import { InstallPackageToolUI } from "./tools/misc-tool-uis.js";
|
|
45
48
|
import { TOOL_ICONS, toolIcon } from "./tools/tool-icons.js";
|
|
@@ -131,6 +134,8 @@ import { describeToolArgs, formatToolName, getToolDisplayMeta, toolActiveLabel,
|
|
|
131
134
|
import { githubWakeEventLabel, githubWakeMarkerText, isGithubWakeMessage, readGithubWakeEvent } from "./agent-runtime/src/github-wake-event.js";
|
|
132
135
|
import { hasStatewireThreadExtras } from "./agent-runtime/src/thread-extras.js";
|
|
133
136
|
import { useToolAppearance } from "./tools/tool-appearance.js";
|
|
137
|
+
import { useTurnToolCallsAwaitingApproval } from "./agent-runtime/src/subagents.js";
|
|
138
|
+
import { windowInFrontSignal } from "./agent-runtime/src/chat-outbox-signals.js";
|
|
134
139
|
export {
|
|
135
140
|
ATHENA_REACT_SDK_VERSION,
|
|
136
141
|
ATHENA_REPO_SEARCH_PATH,
|
|
@@ -206,6 +211,8 @@ export {
|
|
|
206
211
|
MODEL_PROVIDER_LABELS,
|
|
207
212
|
NestedPtcComponentsProvider,
|
|
208
213
|
NestedPtcMessages,
|
|
214
|
+
OFFLINE_SNAPSHOT_READ_WAIT_MS,
|
|
215
|
+
OfflineSnapshotBanner,
|
|
209
216
|
OpenAssetToolUI,
|
|
210
217
|
OpenBrowserToolUI,
|
|
211
218
|
OwnerDocumentProvider,
|
|
@@ -249,6 +256,7 @@ export {
|
|
|
249
256
|
StatewireHistoryEdge,
|
|
250
257
|
StatewireQueuedMessages,
|
|
251
258
|
StatewireRunRefusalNotice,
|
|
259
|
+
SubagentTaskToolUI,
|
|
252
260
|
SuperGroupingCard,
|
|
253
261
|
SuperGroupingFinalText,
|
|
254
262
|
SuperGroupingProvider,
|
|
@@ -319,6 +327,8 @@ export {
|
|
|
319
327
|
channelLabel,
|
|
320
328
|
classifyToolResult,
|
|
321
329
|
clearAutoOpenedAssets,
|
|
330
|
+
clearChatOutbox,
|
|
331
|
+
clearUnopenableChatOutbox,
|
|
322
332
|
cn,
|
|
323
333
|
collectAssetTitles,
|
|
324
334
|
collectStatewireClientTools,
|
|
@@ -332,6 +342,7 @@ export {
|
|
|
332
342
|
conversationDisplayTitle,
|
|
333
343
|
conversationSummaryFromIndexEntry,
|
|
334
344
|
countActivityTools,
|
|
345
|
+
countChatOutboxMessages,
|
|
335
346
|
createAssetToolUI,
|
|
336
347
|
createAthenaSpacesUrl,
|
|
337
348
|
createAttachmentStore,
|
|
@@ -366,6 +377,7 @@ export {
|
|
|
366
377
|
finalLiveDesktopCloseNotice,
|
|
367
378
|
formatA1Cell,
|
|
368
379
|
formatA1Range,
|
|
380
|
+
formatOfflineSnapshotTime,
|
|
369
381
|
formatRecordingClock,
|
|
370
382
|
formatTestRecordingCounts,
|
|
371
383
|
formatToolName,
|
|
@@ -401,6 +413,7 @@ export {
|
|
|
401
413
|
isThreadFavoriteUnavailableError,
|
|
402
414
|
isThreadRenameUnavailableError,
|
|
403
415
|
isToolResultSuccess,
|
|
416
|
+
listChatOutboxMessages,
|
|
404
417
|
listThreads,
|
|
405
418
|
liveDesktopViewerUrl,
|
|
406
419
|
matchesSessionsQuery,
|
|
@@ -458,6 +471,7 @@ export {
|
|
|
458
471
|
splitSheetPrefix,
|
|
459
472
|
splitTurnSegments,
|
|
460
473
|
statewireClientToolWireEntries,
|
|
474
|
+
subscribeChatOutbox,
|
|
461
475
|
summarizeToolCall,
|
|
462
476
|
taskProgress,
|
|
463
477
|
themeToStyleVars,
|
|
@@ -488,6 +502,7 @@ export {
|
|
|
488
502
|
useAthenaInboxUnreadCount,
|
|
489
503
|
useAthenaLinkClickHandler,
|
|
490
504
|
useAthenaModelCatalog,
|
|
505
|
+
useAthenaOfflineSnapshotAt,
|
|
491
506
|
useAthenaRepoSearch,
|
|
492
507
|
useAthenaRunLive,
|
|
493
508
|
useAthenaSessionAttention,
|
|
@@ -522,10 +537,13 @@ export {
|
|
|
522
537
|
useSessionWorkbench,
|
|
523
538
|
useSessionWorkbenchWorkspace,
|
|
524
539
|
useStatewireApprovalRequest,
|
|
540
|
+
useStatewireApprovalWait,
|
|
525
541
|
useStatewireConversationHistory,
|
|
526
542
|
useStatewireHistory,
|
|
527
543
|
useStatewireToolOutputs,
|
|
528
544
|
useToolAppearance,
|
|
545
|
+
useTurnToolCallsAwaitingApproval,
|
|
546
|
+
windowInFrontSignal,
|
|
529
547
|
withCaptureGateBypass,
|
|
530
548
|
workedDurationMs,
|
|
531
549
|
workspaceComputers,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const chatOutboxStore = require("../agent-runtime/src/chat-outbox-store.cjs");
|
|
4
|
+
const chatOutbox = require("../agent-runtime/src/chat-outbox.cjs");
|
|
5
|
+
const ownerStores = /* @__PURE__ */ new Map();
|
|
6
|
+
function keylessHost(ownerId) {
|
|
7
|
+
return { ownerId, getKey: async () => null };
|
|
8
|
+
}
|
|
9
|
+
function ownerStore(ownerId, host) {
|
|
10
|
+
let owner = ownerStores.get(ownerId);
|
|
11
|
+
if (!owner) {
|
|
12
|
+
const current = { current: host ?? keylessHost(ownerId) };
|
|
13
|
+
owner = {
|
|
14
|
+
host: current,
|
|
15
|
+
store: chatOutboxStore.createIndexedDbChatOutboxStore({
|
|
16
|
+
ownerId,
|
|
17
|
+
getKey: (_ownerId, purpose) => current.current.getKey(purpose)
|
|
18
|
+
})
|
|
19
|
+
};
|
|
20
|
+
ownerStores.set(ownerId, owner);
|
|
21
|
+
}
|
|
22
|
+
if (host) owner.host.current = host;
|
|
23
|
+
return owner.store;
|
|
24
|
+
}
|
|
25
|
+
function chatOutboxStoreFor(host) {
|
|
26
|
+
return ownerStore(host.ownerId, host);
|
|
27
|
+
}
|
|
28
|
+
function countChatOutboxMessages(ownerId) {
|
|
29
|
+
return ownerStore(ownerId).count();
|
|
30
|
+
}
|
|
31
|
+
function subscribeChatOutbox(ownerId, listener) {
|
|
32
|
+
return ownerStore(ownerId).subscribe(listener);
|
|
33
|
+
}
|
|
34
|
+
async function listChatOutboxMessages(ownerId, now = Date.now()) {
|
|
35
|
+
const records = await ownerStore(ownerId).listAll();
|
|
36
|
+
return records.map(({ entry, claim, failure, memoryOnly }) => ({
|
|
37
|
+
id: entry.id,
|
|
38
|
+
threadId: entry.threadId,
|
|
39
|
+
text: entry.text,
|
|
40
|
+
newChat: entry.newChat,
|
|
41
|
+
status: failure ? "failed" : claim && now - claim.at < chatOutbox.CHAT_OUTBOX_CLAIM_LEASE_MS ? "sending" : now - entry.queuedAt > chatOutbox.CHAT_OUTBOX_ASK_AFTER_MS ? "ask" : "waiting",
|
|
42
|
+
inMemory: memoryOnly === true
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
function clearChatOutbox(ownerId) {
|
|
46
|
+
return ownerStore(ownerId).clear();
|
|
47
|
+
}
|
|
48
|
+
function clearUnopenableChatOutbox(ownerId) {
|
|
49
|
+
return chatOutboxStore.createIndexedDbChatOutboxStore({ ownerId, getKey: async () => null }).clear();
|
|
50
|
+
}
|
|
51
|
+
exports.chatOutboxStoreFor = chatOutboxStoreFor;
|
|
52
|
+
exports.clearChatOutbox = clearChatOutbox;
|
|
53
|
+
exports.clearUnopenableChatOutbox = clearUnopenableChatOutbox;
|
|
54
|
+
exports.countChatOutboxMessages = countChatOutboxMessages;
|
|
55
|
+
exports.listChatOutboxMessages = listChatOutboxMessages;
|
|
56
|
+
exports.subscribeChatOutbox = subscribeChatOutbox;
|
|
57
|
+
//# sourceMappingURL=chat-outbox.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-outbox.cjs","sources":["../../src/offline/chat-outbox.ts"],"sourcesContent":["import {\n CHAT_OUTBOX_ASK_AFTER_MS,\n CHAT_OUTBOX_CLAIM_LEASE_MS,\n type ChatOutboxKeyPurpose,\n type ChatOutboxSignal,\n type ChatOutboxStore,\n createIndexedDbChatOutboxStore,\n} from '@athenaintel/agent-runtime';\n\n/**\n * Opt-in: messages typed while Athena can't be reached wait on this device, sealed with the host's\n * key, and are sent once Athena is back while the app is in front, after a countdown the person\n * can cancel (`@athenaintel/agent-runtime`'s chat outbox, shown at the top of the queue tray).\n * Without it a send goes to the transport as before.\n *\n * - `ownerId` names whose they are (the signed-in person, with the environment). Another owner's\n * messages are never shown or sent: each owner's are sealed under their own key.\n * - `getKey(purpose)` returns the AES-GCM key: `read` opens what is kept (the key if one exists,\n * never made for this), `write` keeps a new message (only while the deployment lets devices keep\n * copies). `null` keeps a new message in memory only, for as long as the page stays open. Unlike\n * the chat history's, this key guards the only copy of what someone wrote: a host must never\n * replace or drop it except at a sign-out the person chose.\n * - `reachability` says Athena can be reached: the host's own model (the device online AND agora\n * answering a health read, as Midas's main process decides it), by default the browser being\n * online. Either way a conversation whose own channel keeps failing to connect counts as out of\n * reach too.\n * - `foreground` says the app is in front; by default a visible document. A desktop host passes\n * `windowInFrontSignal()` (visible and focused).\n * - `openThread` opens another of the person's conversations the tray lists as holding waiting\n * messages (`newChat`: one that never started). Without it, a provider with a thread list\n * switches to it; otherwise the tray names it without Open.\n */\nexport interface AthenaChatOutbox {\n ownerId: string;\n getKey: (purpose: ChatOutboxKeyPurpose) => Promise<CryptoKey | null>;\n reachability?: ChatOutboxSignal;\n foreground?: ChatOutboxSignal;\n openThread?: (target: { threadId: string; newChat: boolean }) => void;\n}\n\ninterface OwnerStore {\n store: ChatOutboxStore;\n /** The latest host for this owner: the store asks it for the key. */\n host: { current: AthenaChatOutbox };\n}\n\n// process-local: one store per owner in this page, so every provider of the person (a chat in a\n// tab, another in a pane) shares one change bus and one memory of the messages this device could\n// not keep: a thread switch or a closed tab never loses them, and a sign-out counts them.\nconst ownerStores = new Map<string, OwnerStore>();\n\n/** A host that has no key to give (counting and deleting never need one). */\nfunction keylessHost(ownerId: string): AthenaChatOutbox {\n return { ownerId, getKey: async () => null };\n}\n\nfunction ownerStore(ownerId: string, host?: AthenaChatOutbox): ChatOutboxStore {\n let owner = ownerStores.get(ownerId);\n if (!owner) {\n const current = { current: host ?? keylessHost(ownerId) };\n owner = {\n host: current,\n store: createIndexedDbChatOutboxStore({\n ownerId,\n getKey: (_ownerId, purpose) => current.current.getKey(purpose),\n }),\n };\n ownerStores.set(ownerId, owner);\n }\n if (host) owner.host.current = host;\n return owner.store;\n}\n\n/** The page's chat outbox store for `host`'s owner, made on first use. */\nexport function chatOutboxStoreFor(host: AthenaChatOutbox): ChatOutboxStore {\n return ownerStore(host.ownerId, host);\n}\n\n/**\n * How many messages wait for `ownerId` (kept on the device, including records this build cannot\n * open, and waiting in this page's memory), counted without opening them. Rejects when the\n * device's records cannot be counted at all.\n */\nexport function countChatOutboxMessages(ownerId: string): Promise<number> {\n return ownerStore(ownerId).count();\n}\n\n/**\n * Calls `listener` after any change to `ownerId`'s waiting messages, this window's or another's\n * (one kept, handed to its conversation, cancelled, failed or retried), so a host can show how many\n * wait (`countChatOutboxMessages`) without asking on a timer. Returns what stops it.\n */\nexport function subscribeChatOutbox(ownerId: string, listener: () => void): () => void {\n return ownerStore(ownerId).subscribe(listener);\n}\n\n/** A message waiting in an owner's outbox, as a host lists it (its \"Waiting to sync\" list). */\nexport interface ChatOutboxMessageSummary {\n id: string;\n threadId: string;\n /** The text as it will be sent. */\n text: string;\n /** Typed into a chat that had never started. */\n newChat: boolean;\n /**\n * Where it stands, as the queue tray shows it: waiting to be sent, being handed to its\n * conversation now (a window's claim on it still holds), waiting for the person (it waited more\n * than a day: Send, Edit or Discard), or failed (Retry or Discard; never retried on its own).\n */\n status: 'waiting' | 'sending' | 'ask' | 'failed';\n /** Kept only in this page's memory: this device could not keep it. */\n inMemory: boolean;\n}\n\n/**\n * The messages waiting for `ownerId` that this page can open (oldest first), each with where it\n * stands, for a host's list of what waits to sync; the tray in the conversation acts on them.\n * Records this page cannot open (no key here, a newer build's) are left out, so a host counts with\n * `countChatOutboxMessages`.\n */\nexport async function listChatOutboxMessages(\n ownerId: string,\n now: number = Date.now(),\n): Promise<ChatOutboxMessageSummary[]> {\n const records = await ownerStore(ownerId).listAll();\n return records.map(({ entry, claim, failure, memoryOnly }) => ({\n id: entry.id,\n threadId: entry.threadId,\n text: entry.text,\n newChat: entry.newChat,\n status: failure\n ? 'failed'\n : claim && now - claim.at < CHAT_OUTBOX_CLAIM_LEASE_MS\n ? 'sending'\n : now - entry.queuedAt > CHAT_OUTBOX_ASK_AFTER_MS\n ? 'ask'\n : 'waiting',\n inMemory: memoryOnly === true,\n }));\n}\n\n/** A sign-out the person chose: every message waiting for `ownerId` goes, on the device and in memory. */\nexport function clearChatOutbox(ownerId: string): Promise<void> {\n return ownerStore(ownerId).clear();\n}\n\n/**\n * Deletes the records kept on this device for `ownerId`, never the messages waiting in this page's\n * memory: for a host whose key for them no longer exists (a chosen sign-out deleted it before the\n * page could delete the records), so nothing can ever open them and they must not be counted.\n */\nexport function clearUnopenableChatOutbox(ownerId: string): Promise<void> {\n return createIndexedDbChatOutboxStore({ ownerId, getKey: async () => null }).clear();\n}\n"],"names":["createIndexedDbChatOutboxStore","CHAT_OUTBOX_CLAIM_LEASE_MS","CHAT_OUTBOX_ASK_AFTER_MS"],"mappings":";;;;AAiDA,MAAM,kCAAkB,IAAA;AAGxB,SAAS,YAAY,SAAmC;AACtD,SAAO,EAAE,SAAS,QAAQ,YAAY,KAAA;AACxC;AAEA,SAAS,WAAW,SAAiB,MAA0C;AAC7E,MAAI,QAAQ,YAAY,IAAI,OAAO;AACnC,MAAI,CAAC,OAAO;AACV,UAAM,UAAU,EAAE,SAAS,QAAQ,YAAY,OAAO,EAAA;AACtD,YAAQ;AAAA,MACN,MAAM;AAAA,MACN,OAAOA,gBAAAA,+BAA+B;AAAA,QACpC;AAAA,QACA,QAAQ,CAAC,UAAU,YAAY,QAAQ,QAAQ,OAAO,OAAO;AAAA,MAAA,CAC9D;AAAA,IAAA;AAEH,gBAAY,IAAI,SAAS,KAAK;AAAA,EAChC;AACA,MAAI,KAAM,OAAM,KAAK,UAAU;AAC/B,SAAO,MAAM;AACf;AAGO,SAAS,mBAAmB,MAAyC;AAC1E,SAAO,WAAW,KAAK,SAAS,IAAI;AACtC;AAOO,SAAS,wBAAwB,SAAkC;AACxE,SAAO,WAAW,OAAO,EAAE,MAAA;AAC7B;AAOO,SAAS,oBAAoB,SAAiB,UAAkC;AACrF,SAAO,WAAW,OAAO,EAAE,UAAU,QAAQ;AAC/C;AA0BA,eAAsB,uBACpB,SACA,MAAc,KAAK,OACkB;AACrC,QAAM,UAAU,MAAM,WAAW,OAAO,EAAE,QAAA;AAC1C,SAAO,QAAQ,IAAI,CAAC,EAAE,OAAO,OAAO,SAAS,kBAAkB;AAAA,IAC7D,IAAI,MAAM;AAAA,IACV,UAAU,MAAM;AAAA,IAChB,MAAM,MAAM;AAAA,IACZ,SAAS,MAAM;AAAA,IACf,QAAQ,UACJ,WACA,SAAS,MAAM,MAAM,KAAKC,WAAAA,6BACxB,YACA,MAAM,MAAM,WAAWC,WAAAA,2BACrB,QACA;AAAA,IACR,UAAU,eAAe;AAAA,EAAA,EACzB;AACJ;AAGO,SAAS,gBAAgB,SAAgC;AAC9D,SAAO,WAAW,OAAO,EAAE,MAAA;AAC7B;AAOO,SAAS,0BAA0B,SAAgC;AACxE,SAAOF,gBAAAA,+BAA+B,EAAE,SAAS,QAAQ,YAAY,KAAA,CAAM,EAAE,MAAA;AAC/E;;;;;;;"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type ChatOutboxKeyPurpose, type ChatOutboxSignal, type ChatOutboxStore } from '../agent-runtime/src/index';
|
|
2
|
+
/**
|
|
3
|
+
* Opt-in: messages typed while Athena can't be reached wait on this device, sealed with the host's
|
|
4
|
+
* key, and are sent once Athena is back while the app is in front, after a countdown the person
|
|
5
|
+
* can cancel (`@athenaintel/agent-runtime`'s chat outbox, shown at the top of the queue tray).
|
|
6
|
+
* Without it a send goes to the transport as before.
|
|
7
|
+
*
|
|
8
|
+
* - `ownerId` names whose they are (the signed-in person, with the environment). Another owner's
|
|
9
|
+
* messages are never shown or sent: each owner's are sealed under their own key.
|
|
10
|
+
* - `getKey(purpose)` returns the AES-GCM key: `read` opens what is kept (the key if one exists,
|
|
11
|
+
* never made for this), `write` keeps a new message (only while the deployment lets devices keep
|
|
12
|
+
* copies). `null` keeps a new message in memory only, for as long as the page stays open. Unlike
|
|
13
|
+
* the chat history's, this key guards the only copy of what someone wrote: a host must never
|
|
14
|
+
* replace or drop it except at a sign-out the person chose.
|
|
15
|
+
* - `reachability` says Athena can be reached: the host's own model (the device online AND agora
|
|
16
|
+
* answering a health read, as Midas's main process decides it), by default the browser being
|
|
17
|
+
* online. Either way a conversation whose own channel keeps failing to connect counts as out of
|
|
18
|
+
* reach too.
|
|
19
|
+
* - `foreground` says the app is in front; by default a visible document. A desktop host passes
|
|
20
|
+
* `windowInFrontSignal()` (visible and focused).
|
|
21
|
+
* - `openThread` opens another of the person's conversations the tray lists as holding waiting
|
|
22
|
+
* messages (`newChat`: one that never started). Without it, a provider with a thread list
|
|
23
|
+
* switches to it; otherwise the tray names it without Open.
|
|
24
|
+
*/
|
|
25
|
+
export interface AthenaChatOutbox {
|
|
26
|
+
ownerId: string;
|
|
27
|
+
getKey: (purpose: ChatOutboxKeyPurpose) => Promise<CryptoKey | null>;
|
|
28
|
+
reachability?: ChatOutboxSignal;
|
|
29
|
+
foreground?: ChatOutboxSignal;
|
|
30
|
+
openThread?: (target: {
|
|
31
|
+
threadId: string;
|
|
32
|
+
newChat: boolean;
|
|
33
|
+
}) => void;
|
|
34
|
+
}
|
|
35
|
+
/** The page's chat outbox store for `host`'s owner, made on first use. */
|
|
36
|
+
export declare function chatOutboxStoreFor(host: AthenaChatOutbox): ChatOutboxStore;
|
|
37
|
+
/**
|
|
38
|
+
* How many messages wait for `ownerId` (kept on the device, including records this build cannot
|
|
39
|
+
* open, and waiting in this page's memory), counted without opening them. Rejects when the
|
|
40
|
+
* device's records cannot be counted at all.
|
|
41
|
+
*/
|
|
42
|
+
export declare function countChatOutboxMessages(ownerId: string): Promise<number>;
|
|
43
|
+
/**
|
|
44
|
+
* Calls `listener` after any change to `ownerId`'s waiting messages, this window's or another's
|
|
45
|
+
* (one kept, handed to its conversation, cancelled, failed or retried), so a host can show how many
|
|
46
|
+
* wait (`countChatOutboxMessages`) without asking on a timer. Returns what stops it.
|
|
47
|
+
*/
|
|
48
|
+
export declare function subscribeChatOutbox(ownerId: string, listener: () => void): () => void;
|
|
49
|
+
/** A message waiting in an owner's outbox, as a host lists it (its "Waiting to sync" list). */
|
|
50
|
+
export interface ChatOutboxMessageSummary {
|
|
51
|
+
id: string;
|
|
52
|
+
threadId: string;
|
|
53
|
+
/** The text as it will be sent. */
|
|
54
|
+
text: string;
|
|
55
|
+
/** Typed into a chat that had never started. */
|
|
56
|
+
newChat: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Where it stands, as the queue tray shows it: waiting to be sent, being handed to its
|
|
59
|
+
* conversation now (a window's claim on it still holds), waiting for the person (it waited more
|
|
60
|
+
* than a day: Send, Edit or Discard), or failed (Retry or Discard; never retried on its own).
|
|
61
|
+
*/
|
|
62
|
+
status: 'waiting' | 'sending' | 'ask' | 'failed';
|
|
63
|
+
/** Kept only in this page's memory: this device could not keep it. */
|
|
64
|
+
inMemory: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The messages waiting for `ownerId` that this page can open (oldest first), each with where it
|
|
68
|
+
* stands, for a host's list of what waits to sync; the tray in the conversation acts on them.
|
|
69
|
+
* Records this page cannot open (no key here, a newer build's) are left out, so a host counts with
|
|
70
|
+
* `countChatOutboxMessages`.
|
|
71
|
+
*/
|
|
72
|
+
export declare function listChatOutboxMessages(ownerId: string, now?: number): Promise<ChatOutboxMessageSummary[]>;
|
|
73
|
+
/** A sign-out the person chose: every message waiting for `ownerId` goes, on the device and in memory. */
|
|
74
|
+
export declare function clearChatOutbox(ownerId: string): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Deletes the records kept on this device for `ownerId`, never the messages waiting in this page's
|
|
77
|
+
* memory: for a host whose key for them no longer exists (a chosen sign-out deleted it before the
|
|
78
|
+
* page could delete the records), so nothing can ever open them and they must not be counted.
|
|
79
|
+
*/
|
|
80
|
+
export declare function clearUnopenableChatOutbox(ownerId: string): Promise<void>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createIndexedDbChatOutboxStore } from "../agent-runtime/src/chat-outbox-store.js";
|
|
2
|
+
import { CHAT_OUTBOX_CLAIM_LEASE_MS, CHAT_OUTBOX_ASK_AFTER_MS } from "../agent-runtime/src/chat-outbox.js";
|
|
3
|
+
const ownerStores = /* @__PURE__ */ new Map();
|
|
4
|
+
function keylessHost(ownerId) {
|
|
5
|
+
return { ownerId, getKey: async () => null };
|
|
6
|
+
}
|
|
7
|
+
function ownerStore(ownerId, host) {
|
|
8
|
+
let owner = ownerStores.get(ownerId);
|
|
9
|
+
if (!owner) {
|
|
10
|
+
const current = { current: host ?? keylessHost(ownerId) };
|
|
11
|
+
owner = {
|
|
12
|
+
host: current,
|
|
13
|
+
store: createIndexedDbChatOutboxStore({
|
|
14
|
+
ownerId,
|
|
15
|
+
getKey: (_ownerId, purpose) => current.current.getKey(purpose)
|
|
16
|
+
})
|
|
17
|
+
};
|
|
18
|
+
ownerStores.set(ownerId, owner);
|
|
19
|
+
}
|
|
20
|
+
if (host) owner.host.current = host;
|
|
21
|
+
return owner.store;
|
|
22
|
+
}
|
|
23
|
+
function chatOutboxStoreFor(host) {
|
|
24
|
+
return ownerStore(host.ownerId, host);
|
|
25
|
+
}
|
|
26
|
+
function countChatOutboxMessages(ownerId) {
|
|
27
|
+
return ownerStore(ownerId).count();
|
|
28
|
+
}
|
|
29
|
+
function subscribeChatOutbox(ownerId, listener) {
|
|
30
|
+
return ownerStore(ownerId).subscribe(listener);
|
|
31
|
+
}
|
|
32
|
+
async function listChatOutboxMessages(ownerId, now = Date.now()) {
|
|
33
|
+
const records = await ownerStore(ownerId).listAll();
|
|
34
|
+
return records.map(({ entry, claim, failure, memoryOnly }) => ({
|
|
35
|
+
id: entry.id,
|
|
36
|
+
threadId: entry.threadId,
|
|
37
|
+
text: entry.text,
|
|
38
|
+
newChat: entry.newChat,
|
|
39
|
+
status: failure ? "failed" : claim && now - claim.at < CHAT_OUTBOX_CLAIM_LEASE_MS ? "sending" : now - entry.queuedAt > CHAT_OUTBOX_ASK_AFTER_MS ? "ask" : "waiting",
|
|
40
|
+
inMemory: memoryOnly === true
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
function clearChatOutbox(ownerId) {
|
|
44
|
+
return ownerStore(ownerId).clear();
|
|
45
|
+
}
|
|
46
|
+
function clearUnopenableChatOutbox(ownerId) {
|
|
47
|
+
return createIndexedDbChatOutboxStore({ ownerId, getKey: async () => null }).clear();
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
chatOutboxStoreFor,
|
|
51
|
+
clearChatOutbox,
|
|
52
|
+
clearUnopenableChatOutbox,
|
|
53
|
+
countChatOutboxMessages,
|
|
54
|
+
listChatOutboxMessages,
|
|
55
|
+
subscribeChatOutbox
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=chat-outbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-outbox.js","sources":["../../src/offline/chat-outbox.ts"],"sourcesContent":["import {\n CHAT_OUTBOX_ASK_AFTER_MS,\n CHAT_OUTBOX_CLAIM_LEASE_MS,\n type ChatOutboxKeyPurpose,\n type ChatOutboxSignal,\n type ChatOutboxStore,\n createIndexedDbChatOutboxStore,\n} from '@athenaintel/agent-runtime';\n\n/**\n * Opt-in: messages typed while Athena can't be reached wait on this device, sealed with the host's\n * key, and are sent once Athena is back while the app is in front, after a countdown the person\n * can cancel (`@athenaintel/agent-runtime`'s chat outbox, shown at the top of the queue tray).\n * Without it a send goes to the transport as before.\n *\n * - `ownerId` names whose they are (the signed-in person, with the environment). Another owner's\n * messages are never shown or sent: each owner's are sealed under their own key.\n * - `getKey(purpose)` returns the AES-GCM key: `read` opens what is kept (the key if one exists,\n * never made for this), `write` keeps a new message (only while the deployment lets devices keep\n * copies). `null` keeps a new message in memory only, for as long as the page stays open. Unlike\n * the chat history's, this key guards the only copy of what someone wrote: a host must never\n * replace or drop it except at a sign-out the person chose.\n * - `reachability` says Athena can be reached: the host's own model (the device online AND agora\n * answering a health read, as Midas's main process decides it), by default the browser being\n * online. Either way a conversation whose own channel keeps failing to connect counts as out of\n * reach too.\n * - `foreground` says the app is in front; by default a visible document. A desktop host passes\n * `windowInFrontSignal()` (visible and focused).\n * - `openThread` opens another of the person's conversations the tray lists as holding waiting\n * messages (`newChat`: one that never started). Without it, a provider with a thread list\n * switches to it; otherwise the tray names it without Open.\n */\nexport interface AthenaChatOutbox {\n ownerId: string;\n getKey: (purpose: ChatOutboxKeyPurpose) => Promise<CryptoKey | null>;\n reachability?: ChatOutboxSignal;\n foreground?: ChatOutboxSignal;\n openThread?: (target: { threadId: string; newChat: boolean }) => void;\n}\n\ninterface OwnerStore {\n store: ChatOutboxStore;\n /** The latest host for this owner: the store asks it for the key. */\n host: { current: AthenaChatOutbox };\n}\n\n// process-local: one store per owner in this page, so every provider of the person (a chat in a\n// tab, another in a pane) shares one change bus and one memory of the messages this device could\n// not keep: a thread switch or a closed tab never loses them, and a sign-out counts them.\nconst ownerStores = new Map<string, OwnerStore>();\n\n/** A host that has no key to give (counting and deleting never need one). */\nfunction keylessHost(ownerId: string): AthenaChatOutbox {\n return { ownerId, getKey: async () => null };\n}\n\nfunction ownerStore(ownerId: string, host?: AthenaChatOutbox): ChatOutboxStore {\n let owner = ownerStores.get(ownerId);\n if (!owner) {\n const current = { current: host ?? keylessHost(ownerId) };\n owner = {\n host: current,\n store: createIndexedDbChatOutboxStore({\n ownerId,\n getKey: (_ownerId, purpose) => current.current.getKey(purpose),\n }),\n };\n ownerStores.set(ownerId, owner);\n }\n if (host) owner.host.current = host;\n return owner.store;\n}\n\n/** The page's chat outbox store for `host`'s owner, made on first use. */\nexport function chatOutboxStoreFor(host: AthenaChatOutbox): ChatOutboxStore {\n return ownerStore(host.ownerId, host);\n}\n\n/**\n * How many messages wait for `ownerId` (kept on the device, including records this build cannot\n * open, and waiting in this page's memory), counted without opening them. Rejects when the\n * device's records cannot be counted at all.\n */\nexport function countChatOutboxMessages(ownerId: string): Promise<number> {\n return ownerStore(ownerId).count();\n}\n\n/**\n * Calls `listener` after any change to `ownerId`'s waiting messages, this window's or another's\n * (one kept, handed to its conversation, cancelled, failed or retried), so a host can show how many\n * wait (`countChatOutboxMessages`) without asking on a timer. Returns what stops it.\n */\nexport function subscribeChatOutbox(ownerId: string, listener: () => void): () => void {\n return ownerStore(ownerId).subscribe(listener);\n}\n\n/** A message waiting in an owner's outbox, as a host lists it (its \"Waiting to sync\" list). */\nexport interface ChatOutboxMessageSummary {\n id: string;\n threadId: string;\n /** The text as it will be sent. */\n text: string;\n /** Typed into a chat that had never started. */\n newChat: boolean;\n /**\n * Where it stands, as the queue tray shows it: waiting to be sent, being handed to its\n * conversation now (a window's claim on it still holds), waiting for the person (it waited more\n * than a day: Send, Edit or Discard), or failed (Retry or Discard; never retried on its own).\n */\n status: 'waiting' | 'sending' | 'ask' | 'failed';\n /** Kept only in this page's memory: this device could not keep it. */\n inMemory: boolean;\n}\n\n/**\n * The messages waiting for `ownerId` that this page can open (oldest first), each with where it\n * stands, for a host's list of what waits to sync; the tray in the conversation acts on them.\n * Records this page cannot open (no key here, a newer build's) are left out, so a host counts with\n * `countChatOutboxMessages`.\n */\nexport async function listChatOutboxMessages(\n ownerId: string,\n now: number = Date.now(),\n): Promise<ChatOutboxMessageSummary[]> {\n const records = await ownerStore(ownerId).listAll();\n return records.map(({ entry, claim, failure, memoryOnly }) => ({\n id: entry.id,\n threadId: entry.threadId,\n text: entry.text,\n newChat: entry.newChat,\n status: failure\n ? 'failed'\n : claim && now - claim.at < CHAT_OUTBOX_CLAIM_LEASE_MS\n ? 'sending'\n : now - entry.queuedAt > CHAT_OUTBOX_ASK_AFTER_MS\n ? 'ask'\n : 'waiting',\n inMemory: memoryOnly === true,\n }));\n}\n\n/** A sign-out the person chose: every message waiting for `ownerId` goes, on the device and in memory. */\nexport function clearChatOutbox(ownerId: string): Promise<void> {\n return ownerStore(ownerId).clear();\n}\n\n/**\n * Deletes the records kept on this device for `ownerId`, never the messages waiting in this page's\n * memory: for a host whose key for them no longer exists (a chosen sign-out deleted it before the\n * page could delete the records), so nothing can ever open them and they must not be counted.\n */\nexport function clearUnopenableChatOutbox(ownerId: string): Promise<void> {\n return createIndexedDbChatOutboxStore({ ownerId, getKey: async () => null }).clear();\n}\n"],"names":[],"mappings":";;AAiDA,MAAM,kCAAkB,IAAA;AAGxB,SAAS,YAAY,SAAmC;AACtD,SAAO,EAAE,SAAS,QAAQ,YAAY,KAAA;AACxC;AAEA,SAAS,WAAW,SAAiB,MAA0C;AAC7E,MAAI,QAAQ,YAAY,IAAI,OAAO;AACnC,MAAI,CAAC,OAAO;AACV,UAAM,UAAU,EAAE,SAAS,QAAQ,YAAY,OAAO,EAAA;AACtD,YAAQ;AAAA,MACN,MAAM;AAAA,MACN,OAAO,+BAA+B;AAAA,QACpC;AAAA,QACA,QAAQ,CAAC,UAAU,YAAY,QAAQ,QAAQ,OAAO,OAAO;AAAA,MAAA,CAC9D;AAAA,IAAA;AAEH,gBAAY,IAAI,SAAS,KAAK;AAAA,EAChC;AACA,MAAI,KAAM,OAAM,KAAK,UAAU;AAC/B,SAAO,MAAM;AACf;AAGO,SAAS,mBAAmB,MAAyC;AAC1E,SAAO,WAAW,KAAK,SAAS,IAAI;AACtC;AAOO,SAAS,wBAAwB,SAAkC;AACxE,SAAO,WAAW,OAAO,EAAE,MAAA;AAC7B;AAOO,SAAS,oBAAoB,SAAiB,UAAkC;AACrF,SAAO,WAAW,OAAO,EAAE,UAAU,QAAQ;AAC/C;AA0BA,eAAsB,uBACpB,SACA,MAAc,KAAK,OACkB;AACrC,QAAM,UAAU,MAAM,WAAW,OAAO,EAAE,QAAA;AAC1C,SAAO,QAAQ,IAAI,CAAC,EAAE,OAAO,OAAO,SAAS,kBAAkB;AAAA,IAC7D,IAAI,MAAM;AAAA,IACV,UAAU,MAAM;AAAA,IAChB,MAAM,MAAM;AAAA,IACZ,SAAS,MAAM;AAAA,IACf,QAAQ,UACJ,WACA,SAAS,MAAM,MAAM,KAAK,6BACxB,YACA,MAAM,MAAM,WAAW,2BACrB,QACA;AAAA,IACR,UAAU,eAAe;AAAA,EAAA,EACzB;AACJ;AAGO,SAAS,gBAAgB,SAAgC;AAC9D,SAAO,WAAW,OAAO,EAAE,MAAA;AAC7B;AAOO,SAAS,0BAA0B,SAAgC;AACxE,SAAO,+BAA+B,EAAE,SAAS,QAAQ,YAAY,KAAA,CAAM,EAAE,MAAA;AAC/E;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const lucideReact = require("lucide-react");
|
|
5
|
+
const react = require("react");
|
|
6
|
+
const threadIdContext = require("../threads/thread-id-context.cjs");
|
|
7
|
+
const cnfast = require("cnfast");
|
|
8
|
+
const OFFLINE_SNAPSHOT_READ_WAIT_MS = 1500;
|
|
9
|
+
function useKeptSnapshotsGate({
|
|
10
|
+
cache,
|
|
11
|
+
ownerId,
|
|
12
|
+
isOffline,
|
|
13
|
+
waitMs = OFFLINE_SNAPSHOT_READ_WAIT_MS
|
|
14
|
+
}) {
|
|
15
|
+
const [readFor, setReadFor] = react.useState(void 0);
|
|
16
|
+
react.useEffect(() => {
|
|
17
|
+
if (!cache) return;
|
|
18
|
+
let live = true;
|
|
19
|
+
const settle = () => {
|
|
20
|
+
if (live) setReadFor(ownerId);
|
|
21
|
+
};
|
|
22
|
+
const timer = setTimeout(settle, waitMs);
|
|
23
|
+
const done = () => {
|
|
24
|
+
clearTimeout(timer);
|
|
25
|
+
settle();
|
|
26
|
+
};
|
|
27
|
+
void cache.setOwner(ownerId).then(done, done);
|
|
28
|
+
return () => {
|
|
29
|
+
live = false;
|
|
30
|
+
clearTimeout(timer);
|
|
31
|
+
};
|
|
32
|
+
}, [cache, ownerId, waitMs]);
|
|
33
|
+
const [mountedOffline] = react.useState(() => cache !== null && isOffline());
|
|
34
|
+
return mountedOffline && ownerId !== null && readFor !== ownerId;
|
|
35
|
+
}
|
|
36
|
+
const AthenaOfflineSnapshotsContext = react.createContext(null);
|
|
37
|
+
const noSubscription = () => () => void 0;
|
|
38
|
+
const serverSnapshot = () => null;
|
|
39
|
+
function useAthenaOfflineSnapshotAt(threadId) {
|
|
40
|
+
const snapshots = react.useContext(AthenaOfflineSnapshotsContext);
|
|
41
|
+
return react.useSyncExternalStore(
|
|
42
|
+
snapshots ? (listener) => snapshots.subscribeOfflineSeeds(listener) : noSubscription,
|
|
43
|
+
() => snapshots && threadId ? snapshots.offlineSeedAt(threadId) : null,
|
|
44
|
+
serverSnapshot
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function formatOfflineSnapshotTime(at) {
|
|
48
|
+
return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(at);
|
|
49
|
+
}
|
|
50
|
+
const OfflineSnapshotBanner = ({ className }) => {
|
|
51
|
+
const at = useAthenaOfflineSnapshotAt(threadIdContext.useAthenaThreadId());
|
|
52
|
+
if (at === null) return null;
|
|
53
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
role: "status",
|
|
57
|
+
className: cnfast.cn(
|
|
58
|
+
"mx-auto flex w-full max-w-(--thread-max-width) items-center gap-2 rounded-md border px-3 py-2 text-xs",
|
|
59
|
+
"border-border bg-muted text-muted-foreground"
|
|
60
|
+
),
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CloudOffIcon, { className: "size-3.5 shrink-0", "aria-hidden": true }),
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
64
|
+
"Offline · this conversation as of ",
|
|
65
|
+
formatOfflineSnapshotTime(at)
|
|
66
|
+
] })
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
) });
|
|
70
|
+
};
|
|
71
|
+
exports.AthenaOfflineSnapshotsContext = AthenaOfflineSnapshotsContext;
|
|
72
|
+
exports.OFFLINE_SNAPSHOT_READ_WAIT_MS = OFFLINE_SNAPSHOT_READ_WAIT_MS;
|
|
73
|
+
exports.OfflineSnapshotBanner = OfflineSnapshotBanner;
|
|
74
|
+
exports.formatOfflineSnapshotTime = formatOfflineSnapshotTime;
|
|
75
|
+
exports.useAthenaOfflineSnapshotAt = useAthenaOfflineSnapshotAt;
|
|
76
|
+
exports.useKeptSnapshotsGate = useKeptSnapshotsGate;
|
|
77
|
+
//# sourceMappingURL=offline-history.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline-history.cjs","sources":["../../src/offline/offline-history.tsx"],"sourcesContent":["import type { DurableThreadSnapshotCache } from '@athenaintel/agent-runtime';\nimport { CloudOffIcon } from 'lucide-react';\nimport {\n createContext,\n type FC,\n useContext,\n useEffect,\n useState,\n useSyncExternalStore,\n} from 'react';\nimport { cn } from '../lib/utils';\nimport { useAthenaThreadId } from '../threads/thread-id-context';\n\n/**\n * Opt-in: keep the chat's recent conversations, and the session list, on this device, sealed with\n * the host's key, so a reload paints them at once and they can be read while Athena can't be\n * reached (`AthenaProvider`'s `offlineHistory`). Without it nothing is stored, as before.\n *\n * - `ownerId` names whose they are (the signed-in person). Changing it drops what the previous\n * owner kept, in memory and on the device (the session list's cached pages too); nothing kept\n * under one owner is ever shown to another. Passing no `offlineHistory` any more (a deployment\n * that now keeps nothing on devices) drops it all the same.\n * - `getKey` returns the AES-GCM key that seals them, for that owner, or `null` to keep nothing\n * (no key, a deployment that keeps nothing on devices). Midas's comes from its main process,\n * kept with the OS keychain and handed to the page only for the signed-in person.\n * - `isOffline` says Athena can't be reached (the browser's own offline when omitted): then a\n * conversation opens on its last resting transcript this device holds, up to 30 days old, marked\n * \"as of\" when it was captured; a chat that mounts offline waits (at most\n * {@link OFFLINE_SNAPSHOT_READ_WAIT_MS}) for what the device kept to be read.\n */\nexport interface AthenaOfflineHistory {\n ownerId: string;\n getKey: () => Promise<CryptoKey | null>;\n isOffline?: () => boolean;\n}\n\n/**\n * How long a chat that mounts offline waits for what this device kept before it mounts without:\n * the host's key and IndexedDB answer in milliseconds unless something is stuck.\n */\nexport const OFFLINE_SNAPSHOT_READ_WAIT_MS = 1_500;\n\n/**\n * Binds `cache` to `ownerId`, and says whether a chat that mounted offline still waits for what\n * this device kept for that owner to be read (at most `waitMs`). The runtime takes a thread's seed\n * once, as it mounts, and offline that seed is all a thread can show; online it never waits, the\n * attach delivers the thread.\n */\nexport function useKeptSnapshotsGate({\n cache,\n ownerId,\n isOffline,\n waitMs = OFFLINE_SNAPSHOT_READ_WAIT_MS,\n}: {\n cache: Pick<DurableThreadSnapshotCache, 'setOwner'> | null;\n ownerId: string | null;\n isOffline: () => boolean;\n waitMs?: number;\n}): boolean {\n const [readFor, setReadFor] = useState<string | null | undefined>(undefined);\n useEffect(() => {\n if (!cache) return;\n let live = true;\n const settle = () => {\n if (live) setReadFor(ownerId);\n };\n const timer = setTimeout(settle, waitMs);\n const done = () => {\n clearTimeout(timer);\n settle();\n };\n void cache.setOwner(ownerId).then(done, done);\n return () => {\n live = false;\n clearTimeout(timer);\n };\n }, [cache, ownerId, waitMs]);\n const [mountedOffline] = useState(() => cache !== null && isOffline());\n return mountedOffline && ownerId !== null && readFor !== ownerId;\n}\n\n/** The provider's offline snapshots: when a thread on screen was captured, if it opened offline. */\nexport type AthenaOfflineSnapshots = Pick<\n DurableThreadSnapshotCache,\n 'offlineSeedAt' | 'subscribeOfflineSeeds'\n>;\n\nexport const AthenaOfflineSnapshotsContext = createContext<AthenaOfflineSnapshots | null>(null);\n\nconst noSubscription = (): (() => void) => () => undefined;\nconst serverSnapshot = (): number | null => null;\n\n/**\n * When the transcript `threadId` shows was captured, if it opened from this device while Athena\n * could not be reached; `null` once the thread's own state arrives, outside an `offlineHistory`\n * provider, or for a new chat.\n */\nexport function useAthenaOfflineSnapshotAt(threadId: string | undefined): number | null {\n const snapshots = useContext(AthenaOfflineSnapshotsContext);\n return useSyncExternalStore(\n snapshots ? (listener) => snapshots.subscribeOfflineSeeds(listener) : noSubscription,\n () => (snapshots && threadId ? snapshots.offlineSeedAt(threadId) : null),\n serverSnapshot,\n );\n}\n\nexport function formatOfflineSnapshotTime(at: number): string {\n return new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: 'short' }).format(at);\n}\n\nexport interface OfflineSnapshotBannerProps {\n /** Applied to the outer wrapper (host padding); the banner itself is width-capped inside it. */\n className?: string;\n}\n\n/**\n * Above a conversation that opened from this device while Athena can't be reached: what is shown\n * is the conversation as it was then, not live. Renders nothing otherwise.\n */\nexport const OfflineSnapshotBanner: FC<OfflineSnapshotBannerProps> = ({ className }) => {\n const at = useAthenaOfflineSnapshotAt(useAthenaThreadId());\n if (at === null) return null;\n return (\n <div className={className}>\n <div\n role=\"status\"\n className={cn(\n 'mx-auto flex w-full max-w-(--thread-max-width) items-center gap-2 rounded-md border px-3 py-2 text-xs',\n 'border-border bg-muted text-muted-foreground',\n )}\n >\n <CloudOffIcon className=\"size-3.5 shrink-0\" aria-hidden />\n <span>Offline · this conversation as of {formatOfflineSnapshotTime(at)}</span>\n </div>\n </div>\n );\n};\n"],"names":["useState","useEffect","createContext","useContext","useSyncExternalStore","useAthenaThreadId","jsx","jsxs","cn","CloudOffIcon"],"mappings":";;;;;;;AAwCO,MAAM,gCAAgC;AAQtC,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AACX,GAKY;AACV,QAAM,CAAC,SAAS,UAAU,IAAIA,MAAAA,SAAoC,MAAS;AAC3EC,QAAAA,UAAU,MAAM;AACd,QAAI,CAAC,MAAO;AACZ,QAAI,OAAO;AACX,UAAM,SAAS,MAAM;AACnB,UAAI,iBAAiB,OAAO;AAAA,IAC9B;AACA,UAAM,QAAQ,WAAW,QAAQ,MAAM;AACvC,UAAM,OAAO,MAAM;AACjB,mBAAa,KAAK;AAClB,aAAA;AAAA,IACF;AACA,SAAK,MAAM,SAAS,OAAO,EAAE,KAAK,MAAM,IAAI;AAC5C,WAAO,MAAM;AACX,aAAO;AACP,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,OAAO,SAAS,MAAM,CAAC;AAC3B,QAAM,CAAC,cAAc,IAAID,MAAAA,SAAS,MAAM,UAAU,QAAQ,WAAW;AACrE,SAAO,kBAAkB,YAAY,QAAQ,YAAY;AAC3D;AAQO,MAAM,gCAAgCE,MAAAA,cAA6C,IAAI;AAE9F,MAAM,iBAAiB,MAAoB,MAAM;AACjD,MAAM,iBAAiB,MAAqB;AAOrC,SAAS,2BAA2B,UAA6C;AACtF,QAAM,YAAYC,MAAAA,WAAW,6BAA6B;AAC1D,SAAOC,MAAAA;AAAAA,IACL,YAAY,CAAC,aAAa,UAAU,sBAAsB,QAAQ,IAAI;AAAA,IACtE,MAAO,aAAa,WAAW,UAAU,cAAc,QAAQ,IAAI;AAAA,IACnE;AAAA,EAAA;AAEJ;AAEO,SAAS,0BAA0B,IAAoB;AAC5D,SAAO,IAAI,KAAK,eAAe,QAAW,EAAE,WAAW,UAAU,WAAW,QAAA,CAAS,EAAE,OAAO,EAAE;AAClG;AAWO,MAAM,wBAAwD,CAAC,EAAE,gBAAgB;AACtF,QAAM,KAAK,2BAA2BC,gBAAAA,mBAAmB;AACzD,MAAI,OAAO,KAAM,QAAO;AACxB,SACEC,2BAAAA,IAAC,SAAI,WACH,UAAAC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAWC,OAAAA;AAAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAGF,UAAA;AAAA,QAAAF,2BAAAA,IAACG,YAAAA,cAAA,EAAa,WAAU,qBAAoB,eAAW,MAAC;AAAA,wCACvD,QAAA,EAAK,UAAA;AAAA,UAAA;AAAA,UAAmC,0BAA0B,EAAE;AAAA,QAAA,EAAA,CAAE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAE3E;AAEJ;;;;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { DurableThreadSnapshotCache } from '../agent-runtime/src/index';
|
|
2
|
+
import { type FC } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Opt-in: keep the chat's recent conversations, and the session list, on this device, sealed with
|
|
5
|
+
* the host's key, so a reload paints them at once and they can be read while Athena can't be
|
|
6
|
+
* reached (`AthenaProvider`'s `offlineHistory`). Without it nothing is stored, as before.
|
|
7
|
+
*
|
|
8
|
+
* - `ownerId` names whose they are (the signed-in person). Changing it drops what the previous
|
|
9
|
+
* owner kept, in memory and on the device (the session list's cached pages too); nothing kept
|
|
10
|
+
* under one owner is ever shown to another. Passing no `offlineHistory` any more (a deployment
|
|
11
|
+
* that now keeps nothing on devices) drops it all the same.
|
|
12
|
+
* - `getKey` returns the AES-GCM key that seals them, for that owner, or `null` to keep nothing
|
|
13
|
+
* (no key, a deployment that keeps nothing on devices). Midas's comes from its main process,
|
|
14
|
+
* kept with the OS keychain and handed to the page only for the signed-in person.
|
|
15
|
+
* - `isOffline` says Athena can't be reached (the browser's own offline when omitted): then a
|
|
16
|
+
* conversation opens on its last resting transcript this device holds, up to 30 days old, marked
|
|
17
|
+
* "as of" when it was captured; a chat that mounts offline waits (at most
|
|
18
|
+
* {@link OFFLINE_SNAPSHOT_READ_WAIT_MS}) for what the device kept to be read.
|
|
19
|
+
*/
|
|
20
|
+
export interface AthenaOfflineHistory {
|
|
21
|
+
ownerId: string;
|
|
22
|
+
getKey: () => Promise<CryptoKey | null>;
|
|
23
|
+
isOffline?: () => boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* How long a chat that mounts offline waits for what this device kept before it mounts without:
|
|
27
|
+
* the host's key and IndexedDB answer in milliseconds unless something is stuck.
|
|
28
|
+
*/
|
|
29
|
+
export declare const OFFLINE_SNAPSHOT_READ_WAIT_MS = 1500;
|
|
30
|
+
/**
|
|
31
|
+
* Binds `cache` to `ownerId`, and says whether a chat that mounted offline still waits for what
|
|
32
|
+
* this device kept for that owner to be read (at most `waitMs`). The runtime takes a thread's seed
|
|
33
|
+
* once, as it mounts, and offline that seed is all a thread can show; online it never waits, the
|
|
34
|
+
* attach delivers the thread.
|
|
35
|
+
*/
|
|
36
|
+
export declare function useKeptSnapshotsGate({ cache, ownerId, isOffline, waitMs, }: {
|
|
37
|
+
cache: Pick<DurableThreadSnapshotCache, 'setOwner'> | null;
|
|
38
|
+
ownerId: string | null;
|
|
39
|
+
isOffline: () => boolean;
|
|
40
|
+
waitMs?: number;
|
|
41
|
+
}): boolean;
|
|
42
|
+
/** The provider's offline snapshots: when a thread on screen was captured, if it opened offline. */
|
|
43
|
+
export type AthenaOfflineSnapshots = Pick<DurableThreadSnapshotCache, 'offlineSeedAt' | 'subscribeOfflineSeeds'>;
|
|
44
|
+
export declare const AthenaOfflineSnapshotsContext: import("react").Context<AthenaOfflineSnapshots | null>;
|
|
45
|
+
/**
|
|
46
|
+
* When the transcript `threadId` shows was captured, if it opened from this device while Athena
|
|
47
|
+
* could not be reached; `null` once the thread's own state arrives, outside an `offlineHistory`
|
|
48
|
+
* provider, or for a new chat.
|
|
49
|
+
*/
|
|
50
|
+
export declare function useAthenaOfflineSnapshotAt(threadId: string | undefined): number | null;
|
|
51
|
+
export declare function formatOfflineSnapshotTime(at: number): string;
|
|
52
|
+
export interface OfflineSnapshotBannerProps {
|
|
53
|
+
/** Applied to the outer wrapper (host padding); the banner itself is width-capped inside it. */
|
|
54
|
+
className?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Above a conversation that opened from this device while Athena can't be reached: what is shown
|
|
58
|
+
* is the conversation as it was then, not live. Renders nothing otherwise.
|
|
59
|
+
*/
|
|
60
|
+
export declare const OfflineSnapshotBanner: FC<OfflineSnapshotBannerProps>;
|