@athenaintel/react 0.41.3 → 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 +102 -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.d.ts +60 -0
- package/dist/agent-runtime/src/edit-command.d.ts +156 -0
- package/dist/agent-runtime/src/errors.d.ts +174 -0
- package/dist/agent-runtime/src/execute-output.d.ts +31 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs +16 -2
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +202 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js +16 -2
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/agent-runtime/src/github-wake-event.d.ts +77 -0
- package/dist/agent-runtime/src/index.d.ts +74 -0
- package/dist/agent-runtime/src/interrupts.cjs +17 -0
- package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
- package/dist/agent-runtime/src/interrupts.d.ts +348 -0
- package/dist/agent-runtime/src/interrupts.js +17 -0
- package/dist/agent-runtime/src/interrupts.js.map +1 -1
- package/dist/agent-runtime/src/lane-follow.d.ts +121 -0
- package/dist/agent-runtime/src/lane-history.cjs +209 -0
- package/dist/agent-runtime/src/lane-history.cjs.map +1 -0
- package/dist/agent-runtime/src/lane-history.d.ts +175 -0
- package/dist/agent-runtime/src/lane-history.js +209 -0
- package/dist/agent-runtime/src/lane-history.js.map +1 -0
- package/dist/agent-runtime/src/lane-images.d.ts +184 -0
- package/dist/agent-runtime/src/message-author.d.ts +43 -0
- package/dist/agent-runtime/src/message-text.cjs +15 -0
- package/dist/agent-runtime/src/message-text.cjs.map +1 -0
- package/dist/agent-runtime/src/message-text.d.ts +47 -0
- package/dist/agent-runtime/src/message-text.js +15 -0
- package/dist/agent-runtime/src/message-text.js.map +1 -0
- package/dist/agent-runtime/src/message-window.cjs +15 -1
- package/dist/agent-runtime/src/message-window.cjs.map +1 -1
- package/dist/agent-runtime/src/message-window.d.ts +159 -0
- package/dist/agent-runtime/src/message-window.js +16 -2
- package/dist/agent-runtime/src/message-window.js.map +1 -1
- package/dist/agent-runtime/src/messages.cjs +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 +46 -117
- package/dist/agent-runtime/src/thread-snapshot-mirror.cjs.map +1 -1
- package/dist/agent-runtime/src/thread-snapshot-mirror.d.ts +101 -0
- package/dist/agent-runtime/src/thread-snapshot-mirror.js +17 -88
- package/dist/agent-runtime/src/thread-snapshot-mirror.js.map +1 -1
- package/dist/agent-runtime/src/thread-status.d.ts +53 -0
- package/dist/agent-runtime/src/tool-metadata.d.ts +146 -0
- package/dist/agent-runtime/src/tool-names.cjs +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 +72 -5
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.js +73 -6
- 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 +15 -8
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +18 -8
- package/dist/chat/super-grouping/activity-timeline.js +15 -8
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/use-statewire-approval-request.cjs +36 -0
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.d.ts +49 -1
- package/dist/chat/use-statewire-approval-request.js +39 -3
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.cjs +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 +13 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -6
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/offline/chat-outbox.cjs +57 -0
- package/dist/offline/chat-outbox.cjs.map +1 -0
- package/dist/offline/chat-outbox.d.ts +80 -0
- package/dist/offline/chat-outbox.js +57 -0
- package/dist/offline/chat-outbox.js.map +1 -0
- package/dist/offline/offline-history.d.ts +1 -1
- package/dist/provider/AthenaProvider.cjs +162 -8
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +15 -1
- package/dist/provider/AthenaProvider.js +163 -9
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/provider/statewire-window-context.d.ts +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/references/src/anchors/file-line-range.d.ts +58 -0
- package/dist/references/src/anchors/format.d.ts +21 -0
- package/dist/references/src/anchors/message-anchors.d.ts +71 -0
- package/dist/references/src/anchors/parse.d.ts +8 -0
- package/dist/references/src/anchors/registry-contract.d.ts +24 -0
- package/dist/references/src/anchors/registry.d.ts +19 -0
- package/dist/references/src/anchors/schemas.d.ts +194 -0
- package/dist/references/src/anchors/serialize.d.ts +8 -0
- package/dist/references/src/anchors/time.d.ts +78 -0
- package/dist/references/src/anchors/types.d.ts +474 -0
- package/dist/references/src/asset-bounds.d.ts +27 -0
- package/dist/references/src/asset-links.d.ts +23 -0
- package/dist/references/src/asset-reference.d.ts +16 -0
- package/dist/references/src/formats/format-catalog.d.ts +79 -0
- package/dist/references/src/formats/markdown/parse-reference-markdown.d.ts +28 -0
- package/dist/references/src/formats/markdown/reference-display-name.d.ts +6 -0
- package/dist/references/src/formats/object/asset-object.d.ts +9 -0
- package/dist/references/src/formats/object/callable-object.d.ts +6 -0
- package/dist/references/src/formats/object/decode-reference-object-payload.d.ts +3 -0
- package/dist/references/src/formats/object/external-url-object.d.ts +9 -0
- package/dist/references/src/formats/object/group-object.d.ts +9 -0
- package/dist/references/src/formats/object/navigation-object.d.ts +9 -0
- package/dist/references/src/formats/object/parse-reference-object.d.ts +11 -0
- package/dist/references/src/formats/object/person-object.d.ts +9 -0
- package/dist/references/src/formats/uri/asset-mention-uri.d.ts +9 -0
- package/dist/references/src/formats/uri/asset-spaces-url.d.ts +9 -0
- package/dist/references/src/formats/uri/callable-mention-uris.d.ts +9 -0
- package/dist/references/src/formats/uri/detect-uri-wire.d.ts +9 -0
- package/dist/references/src/formats/uri/group-mention-uri.d.ts +12 -0
- package/dist/references/src/formats/uri/navigation-spaces-url.d.ts +14 -0
- package/dist/references/src/formats/uri/parse-reference-uri.d.ts +20 -0
- package/dist/references/src/formats/uri/person-mention-uri.d.ts +9 -0
- package/dist/references/src/formats/uri/template-placeholder.d.ts +12 -0
- package/dist/references/src/index.d.ts +47 -0
- package/dist/references/src/legacy/index.d.ts +14 -0
- package/dist/references/src/legacy/pre-reference-asset-url.d.ts +57 -0
- package/dist/references/src/legacy/pre-reference-citation-bridge.d.ts +22 -0
- package/dist/references/src/legacy/pre-reference-citation.d.ts +138 -0
- package/dist/references/src/legacy/pre-reference-external-url.d.ts +31 -0
- package/dist/references/src/legacy/pre-reference-format.d.ts +8 -0
- package/dist/references/src/legacy/pre-reference-mention.d.ts +27 -0
- package/dist/references/src/legacy/pre-reference-object.d.ts +8 -0
- package/dist/references/src/legacy/pre-reference-uri.d.ts +12 -0
- package/dist/references/src/legacy.d.ts +2 -0
- package/dist/references/src/mention-href-patterns.d.ts +19 -0
- package/dist/references/src/mention-node/index.d.ts +5 -0
- package/dist/references/src/mention-node/mention-node.d.ts +31 -0
- package/dist/references/src/mention-node/resolve-node-attrs.d.ts +27 -0
- package/dist/references/src/parse-reference.d.ts +23 -0
- package/dist/references/src/schemas.d.ts +463 -0
- package/dist/references/src/serialize-reference.d.ts +50 -0
- package/dist/references/src/sheet-name.d.ts +10 -0
- package/dist/references/src/tool-option-schemas.d.ts +597 -0
- package/dist/references/src/types.d.ts +125 -0
- package/dist/references/src/version-ref.d.ts +30 -0
- package/dist/runtime/statewire-lifecycle.d.ts +1 -1
- package/dist/runtime/statewire-model-lane.d.ts +1 -1
- package/dist/runtime/statewire-server-lane-context.d.ts +1 -1
- package/dist/runtime/statewire-session-key.cjs +7 -0
- package/dist/runtime/statewire-session-key.cjs.map +1 -1
- package/dist/runtime/statewire-session-key.d.ts +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.d.ts +1 -1
- package/dist/threads/pull-request-display.d.ts +1 -1
- package/dist/threads/session-list-model.d.ts +1 -1
- package/dist/threads/session-list-tab-share.cjs +150 -0
- package/dist/threads/session-list-tab-share.cjs.map +1 -0
- package/dist/threads/session-list-tab-share.d.ts +73 -0
- package/dist/threads/session-list-tab-share.js +150 -0
- package/dist/threads/session-list-tab-share.js.map +1 -0
- package/dist/threads/session-row-parts.d.ts +1 -1
- package/dist/threads/sessions-query.d.ts +1 -1
- package/dist/threads/statewire-thread-list.cjs +42 -16
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +11 -2
- package/dist/threads/statewire-thread-list.js +43 -17
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/thread-prefetcher.d.ts +1 -1
- package/dist/threads/use-athena-session-attention.d.ts +1 -1
- package/dist/threads/use-athena-sessions.cjs +32 -22
- package/dist/threads/use-athena-sessions.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.js +33 -23
- package/dist/threads/use-athena-sessions.js.map +1 -1
- package/dist/threads/use-rest-conversation-history.d.ts +1 -1
- package/dist/threads/use-statewire-conversation-history.d.ts +5 -5
- package/dist/tiptap-markdown-table/src/markdown-table-serializer.d.ts +56 -0
- package/dist/tools/NestedPtcMessages.cjs +14 -9
- package/dist/tools/NestedPtcMessages.cjs.map +1 -1
- package/dist/tools/NestedPtcMessages.d.ts +9 -0
- package/dist/tools/NestedPtcMessages.js +6 -1
- package/dist/tools/NestedPtcMessages.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/primitives.d.ts +1 -1
- package/dist/tools/subagent-task-tool-ui.cjs +494 -0
- package/dist/tools/subagent-task-tool-ui.cjs.map +1 -0
- package/dist/tools/subagent-task-tool-ui.d.ts +109 -0
- package/dist/tools/subagent-task-tool-ui.js +494 -0
- package/dist/tools/subagent-task-tool-ui.js.map +1 -0
- package/dist/tools/tool-fallback.d.ts +1 -1
- package/dist/tools/tool-icons.d.ts +1 -1
- package/dist/tools/tool-summary.d.ts +1 -1
- package/dist/tools/tool-uis.cjs +4 -0
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/tool-uis.js +4 -0
- package/dist/tools/tool-uis.js.map +1 -1
- package/dist/voice/chat.cjs +6 -0
- package/dist/voice/chat.cjs.map +1 -0
- package/dist/voice/chat.d.ts +2 -0
- package/dist/voice/chat.js +6 -0
- package/dist/voice/chat.js.map +1 -0
- package/dist/voice/livekit-join.cjs +119 -0
- package/dist/voice/livekit-join.cjs.map +1 -0
- package/dist/voice/livekit-join.d.ts +8 -0
- package/dist/voice/livekit-join.js +119 -0
- package/dist/voice/livekit-join.js.map +1 -0
- package/dist/voice/livekit.cjs +32 -0
- package/dist/voice/livekit.cjs.map +1 -0
- package/dist/voice/livekit.d.ts +80 -0
- package/dist/voice/livekit.js +32 -0
- package/dist/voice/livekit.js.map +1 -0
- package/package.json +20 -10
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Athena's offline language: the one set of states and words every app uses to
|
|
3
|
+
* say where the person stands when the network, or Athena, is out of reach —
|
|
4
|
+
* Olympus, the desktop app, the phone app, the Chrome extension and the Office
|
|
5
|
+
* add-in.
|
|
6
|
+
*
|
|
7
|
+
* The rule the words follow: say what still works before what doesn't. Work
|
|
8
|
+
* done while Athena can't be reached is kept on the device and syncs when
|
|
9
|
+
* Athena is back, so every message leads with that promise. Nothing here is
|
|
10
|
+
* shown while Athena answers and nothing waits; the "back" messages are brief.
|
|
11
|
+
*
|
|
12
|
+
* Pure strings and small functions, no UI library: each app draws them its own
|
|
13
|
+
* way (a banner, a header chip, a tooltip, a sheet). Reachability itself is
|
|
14
|
+
* each app's own (the browser's or OS's online flag AND agora answering its
|
|
15
|
+
* health read); this module only names the result.
|
|
16
|
+
*/
|
|
17
|
+
/** Where the app stands with Athena. */
|
|
18
|
+
export type ConnectionState =
|
|
19
|
+
/** Athena answers. Nothing is shown. */
|
|
20
|
+
'online'
|
|
21
|
+
/** The device has no network. */
|
|
22
|
+
| 'offline'
|
|
23
|
+
/** The network is up but Athena doesn't answer. */
|
|
24
|
+
| 'unreachable'
|
|
25
|
+
/** Athena answers again and what waited is being sent. */
|
|
26
|
+
| 'reconnecting'
|
|
27
|
+
/** Just back, and everything that waited was sent. Shown briefly. */
|
|
28
|
+
| 'synced';
|
|
29
|
+
/** Where one document's edits stand, for the chip in its header. */
|
|
30
|
+
export type DocumentSyncState =
|
|
31
|
+
/** In Athena. */
|
|
32
|
+
'saved'
|
|
33
|
+
/** Being sent to Athena. */
|
|
34
|
+
| 'saving'
|
|
35
|
+
/** Kept on this device while Athena can't be reached; syncs when it is back. */
|
|
36
|
+
| 'on-device'
|
|
37
|
+
/** Kept only while this tab or app stays open (no device storage); syncs when Athena is back. */
|
|
38
|
+
| 'in-memory'
|
|
39
|
+
/** Sending what was kept on this device. */
|
|
40
|
+
| 'syncing'
|
|
41
|
+
/** Some changes overlap with Athena's version: the person chooses. */
|
|
42
|
+
| 'needs-review'
|
|
43
|
+
/** The document can no longer take these edits (access or state changed): kept, not sent. */
|
|
44
|
+
| 'view-only';
|
|
45
|
+
/** How a sentence names the device the person is on. */
|
|
46
|
+
export type DeviceNoun = 'this browser' | 'this Mac' | 'this computer' | 'this phone' | 'this tablet' | 'this device';
|
|
47
|
+
/**
|
|
48
|
+
* What the app really keeps of work done while Athena can't be reached, so the
|
|
49
|
+
* words never promise more: `device` (stored on the device, survives closing),
|
|
50
|
+
* `memory` (kept only while this tab or app stays open: a tenant that turns
|
|
51
|
+
* device copies off, or storage the app can't open), `none` (a surface that
|
|
52
|
+
* keeps no work offline at all, like the Chrome side panel).
|
|
53
|
+
*/
|
|
54
|
+
export type OfflineKeeping = 'device' | 'memory' | 'none';
|
|
55
|
+
/** A title and the one line under it (a banner, a sheet, a tooltip's heading). */
|
|
56
|
+
export interface StatusCopy {
|
|
57
|
+
title: string;
|
|
58
|
+
detail: string;
|
|
59
|
+
}
|
|
60
|
+
/** A short label for a chip or a disabled control, and its one-line explanation. */
|
|
61
|
+
export interface LabelCopy {
|
|
62
|
+
label: string;
|
|
63
|
+
detail: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The app-wide status line, or `null` while Athena answers and nothing waits.
|
|
67
|
+
* `waiting` counts changes not in Athena yet: while `reconnecting` they are
|
|
68
|
+
* being sent; while `online` they wait for something else (a copy that sends
|
|
69
|
+
* when it is next opened), and the line stays until they are gone.
|
|
70
|
+
* `keeping` is what the app really keeps offline (default `device`). A surface
|
|
71
|
+
* that keeps nothing (`none`) has nothing to sync, so its way back is only
|
|
72
|
+
* "Back online", never "Syncing…" or "All changes synced".
|
|
73
|
+
*/
|
|
74
|
+
export declare function connectionCopy({ state, device, waiting, keeping, }: {
|
|
75
|
+
state: ConnectionState;
|
|
76
|
+
device: DeviceNoun;
|
|
77
|
+
waiting?: number;
|
|
78
|
+
keeping?: OfflineKeeping;
|
|
79
|
+
}): StatusCopy | null;
|
|
80
|
+
/** The chip in a document's header, and the line it explains itself with. */
|
|
81
|
+
export declare function documentSyncCopy({ state, device, }: {
|
|
82
|
+
state: DocumentSyncState;
|
|
83
|
+
device: DeviceNoun;
|
|
84
|
+
}): LabelCopy;
|
|
85
|
+
/**
|
|
86
|
+
* The reason on a control that needs Athena (share, run, upload, invite…),
|
|
87
|
+
* shown disabled while Athena can't be reached rather than failing when used.
|
|
88
|
+
*/
|
|
89
|
+
export declare const NEEDS_CONNECTION: LabelCopy;
|
|
90
|
+
/**
|
|
91
|
+
* Whether an item opens without a connection on this device, for lists.
|
|
92
|
+
* `canKeep` says whether opening it online would keep a copy here (the
|
|
93
|
+
* deployment allows device copies and the item's type is one that is kept):
|
|
94
|
+
* only then is the person told to open it once.
|
|
95
|
+
*/
|
|
96
|
+
export declare function offlineAvailabilityCopy({ available, canKeep, device, }: {
|
|
97
|
+
available: boolean;
|
|
98
|
+
canKeep: boolean;
|
|
99
|
+
device: DeviceNoun;
|
|
100
|
+
}): LabelCopy;
|
|
101
|
+
/**
|
|
102
|
+
* The one-time explainer shown the first time the person goes offline, on a
|
|
103
|
+
* surface that keeps work there (`keeping` `device`). A surface that keeps
|
|
104
|
+
* nothing (`none`: the Chrome side panel, the Office task pane) shows no
|
|
105
|
+
* explainer; its status line already says all that holds.
|
|
106
|
+
*/
|
|
107
|
+
export declare function firstOfflineExplainer({ device }: {
|
|
108
|
+
device: DeviceNoun;
|
|
109
|
+
}): StatusCopy & {
|
|
110
|
+
action: string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* The summary heading of the one "Waiting to sync" list, from what waits on
|
|
114
|
+
* the device; `null` when nothing does.
|
|
115
|
+
*/
|
|
116
|
+
export declare function waitingSummary({ changes, messages, recordings, }: {
|
|
117
|
+
changes?: number;
|
|
118
|
+
messages?: number;
|
|
119
|
+
recordings?: number;
|
|
120
|
+
}): string | null;
|
|
121
|
+
/**
|
|
122
|
+
* Where one item in the "Waiting to sync" list stands: a change, a message or a
|
|
123
|
+
* recording made while Athena couldn't be reached.
|
|
124
|
+
*/
|
|
125
|
+
export type WaitingItemState =
|
|
126
|
+
/** Saved on the device; it syncs when Athena is back. */
|
|
127
|
+
'waiting'
|
|
128
|
+
/** Being sent to Athena now. */
|
|
129
|
+
| 'syncing'
|
|
130
|
+
/**
|
|
131
|
+
* Kept only while this tab or app stays open: it couldn't be saved on the
|
|
132
|
+
* device (the organization keeps nothing on devices, or storage failed).
|
|
133
|
+
*/
|
|
134
|
+
| 'in-memory'
|
|
135
|
+
/**
|
|
136
|
+
* Saved on the device in something that isn't open (a document closed before
|
|
137
|
+
* its edits synced, one made offline): it syncs when it is next opened with a
|
|
138
|
+
* connection (opening it offline sends nothing).
|
|
139
|
+
*/
|
|
140
|
+
| 'when-opened'
|
|
141
|
+
/** Made in another workspace: it syncs once that workspace is open again, with a connection. */
|
|
142
|
+
| 'other-workspace'
|
|
143
|
+
/** It doesn't go on its own: the person chooses (a message that waited more than a day). */
|
|
144
|
+
| 'needs-you'
|
|
145
|
+
/** Athena didn't take it: the app adds why, and what the person can do about it. */
|
|
146
|
+
| 'not-synced';
|
|
147
|
+
/** The state of one item in the "Waiting to sync" list, and the line that explains it. */
|
|
148
|
+
export declare function waitingItemCopy({ state, device, }: {
|
|
149
|
+
state: WaitingItemState;
|
|
150
|
+
device: DeviceNoun;
|
|
151
|
+
}): LabelCopy;
|
|
152
|
+
/** The headings of the "Waiting to sync" list, one per kind of item. */
|
|
153
|
+
export declare const WAITING_SECTION_TITLES: {
|
|
154
|
+
readonly changes: 'Changes';
|
|
155
|
+
readonly messages: 'Messages';
|
|
156
|
+
readonly recordings: 'Recordings';
|
|
157
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LangChainMessage } from '@assistant-ui/react-langgraph';
|
|
2
|
+
/** Parts of a pending user message the optimistic bubble can render. */
|
|
3
|
+
export type OptimisticContentPart = {
|
|
4
|
+
type: 'text';
|
|
5
|
+
text: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'image';
|
|
8
|
+
image: string;
|
|
9
|
+
};
|
|
10
|
+
type HumanMessageContent = Extract<LangChainMessage, {
|
|
11
|
+
type: 'human';
|
|
12
|
+
}>['content'];
|
|
13
|
+
/**
|
|
14
|
+
* Content for the optimistic human bubble built from a pending send. Image
|
|
15
|
+
* attachment parts become LangChain `image_url` blocks so the just-sent
|
|
16
|
+
* message renders its images immediately instead of waiting for the backend
|
|
17
|
+
* echo (which only carries images after server-side mention extraction).
|
|
18
|
+
* Text-only sends keep the plain joined string.
|
|
19
|
+
*/
|
|
20
|
+
export declare const buildOptimisticHumanContent: (parts: readonly OptimisticContentPart[]) => HumanMessageContent;
|
|
21
|
+
export {};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const runconfigContract = require("./generated/runconfig-contract.cjs");
|
|
4
|
+
const DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION = runconfigContract.DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION - 1;
|
|
5
|
+
function declaredDeepAgentProtocolVersion({
|
|
6
|
+
laneHistory = false
|
|
7
|
+
} = {}) {
|
|
8
|
+
return laneHistory ? runconfigContract.DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION : DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION;
|
|
9
|
+
}
|
|
4
10
|
const isContractVersion = (value) => typeof value === "number" && Number.isInteger(value) && value >= 1;
|
|
5
11
|
function readDeepAgentProtocol(state) {
|
|
6
12
|
if (typeof state !== "object" || state === null) return null;
|
|
@@ -10,12 +16,12 @@ function readDeepAgentProtocol(state) {
|
|
|
10
16
|
if (!isContractVersion(version)) return null;
|
|
11
17
|
return { version };
|
|
12
18
|
}
|
|
13
|
-
function projectDeepAgentProtocol(state) {
|
|
19
|
+
function projectDeepAgentProtocol(state, declaration = {}) {
|
|
14
20
|
const lane = readDeepAgentProtocol(state);
|
|
15
21
|
if (lane === null) return null;
|
|
16
22
|
return {
|
|
17
23
|
protocolVersion: lane.version,
|
|
18
|
-
clientVersion:
|
|
24
|
+
clientVersion: declaredDeepAgentProtocolVersion(declaration)
|
|
19
25
|
};
|
|
20
26
|
}
|
|
21
27
|
const seedProtocolLanes = /* @__PURE__ */ new WeakSet();
|
|
@@ -31,13 +37,15 @@ function isDeepAgentHostState(state) {
|
|
|
31
37
|
const lane = state[runconfigContract.DEEP_AGENT_PROTOCOL_STATE_KEY];
|
|
32
38
|
return typeof lane === "object" && lane !== null && readDeepAgentProtocol(state) !== null && !seedProtocolLanes.has(lane);
|
|
33
39
|
}
|
|
34
|
-
function withDeclaredProtocolVersion(headers) {
|
|
40
|
+
function withDeclaredProtocolVersion(headers, declaration = {}) {
|
|
35
41
|
if (runconfigContract.DEEP_AGENT_PROTOCOL_VERSION_HEADER in headers) return headers;
|
|
36
42
|
return {
|
|
37
43
|
...headers,
|
|
38
|
-
[runconfigContract.DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(
|
|
44
|
+
[runconfigContract.DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(declaredDeepAgentProtocolVersion(declaration))
|
|
39
45
|
};
|
|
40
46
|
}
|
|
47
|
+
exports.DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION = DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION;
|
|
48
|
+
exports.declaredDeepAgentProtocolVersion = declaredDeepAgentProtocolVersion;
|
|
41
49
|
exports.isDeepAgentHostState = isDeepAgentHostState;
|
|
42
50
|
exports.projectDeepAgentProtocol = projectDeepAgentProtocol;
|
|
43
51
|
exports.readDeepAgentProtocol = readDeepAgentProtocol;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.cjs","sources":["../../../../agent-runtime/src/protocol.ts"],"sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"file":"protocol.cjs","sources":["../../../../agent-runtime/src/protocol.ts"],"sourcesContent":["import {\n DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION,\n DEEP_AGENT_PROTOCOL_STATE_KEY,\n DEEP_AGENT_PROTOCOL_VERSION_HEADER,\n} from './generated/runconfig-contract';\nimport type { DeepAgentStreamValues } from './types';\n\n/**\n * Wire-contract version declaration between the deep-agent statewire host and\n * a client surface (the client half of agora's\n * `agora/graphs/athena_deep_agent/protocol_version.py`; upstream ask\n * assistant-ui/statewire #31506 would make this a library concern).\n *\n * - Declaration: {@link withDeclaredProtocolVersion} stamps the version the\n * surface declares ({@link declaredDeepAgentProtocolVersion}) onto the\n * attach headers — they ride the first WS frame's mandatory `headers` field /\n * the SSE request headers, so no statewire change is needed. The host\n * records it for attach telemetry and selects per-version behaviour by it.\n * - Advertisement: the host publishes its own `version` under the `protocol`\n * state key in every attach snapshot; {@link readDeepAgentProtocol} /\n * {@link projectDeepAgentProtocol} read it.\n *\n * A declared version is a promise the host acts on, not the newest version\n * this build knows (`DEEP_AGENT_PROTOCOL_VERSION`): a host serves a client\n * declaring `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION` finished subagent lanes cut\n * to their newest steps, trusting it to page the rest. So a surface declares\n * what it implements ({@link DeepAgentProtocolDeclaration}), and a contract\n * bump never changes what a surface promises.\n *\n * There is no minimum client version: the host refuses no command for the\n * version its client declared (or for declaring none), so nothing here\n * compares versions or gates a send. Hosts still publish a `minClientVersion`\n * key (the constant 1) for installed clients whose lane reader required it;\n * this reader ignores it.\n *\n * Skew-tolerant on both sides: an old server advertises nothing (project\n * `null`, gate nothing), and a malformed lane reads as absent — the\n * declaration must never brick a client that could otherwise talk.\n */\nexport interface DeepAgentWireProtocol {\n /** The wire-contract version the server speaks. */\n version: number;\n}\n\n/**\n * What a surface implements of the contract, and so may declare on its\n * attaches ({@link declaredDeepAgentProtocolVersion}). Every field is off\n * until the surface ships the capability.\n */\nexport interface DeepAgentProtocolDeclaration {\n /**\n * The surface pages a cut lane's earlier steps (`useDeepAgentLaneHistory`\n * over `history/lane`) wherever it shows a lane's steps. Its attaches then\n * declare `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION`, and the host sends a\n * finished `task` card with a deep nested transcript cut to its newest\n * steps, as it sends a running one, under the key\n * `[threadId, \"main\", messageId, \"cut\"]`. Off, finished cards ride whole.\n */\n laneHistory?: boolean;\n}\n\n/**\n * The version a surface declares until it pages lanes: the one below the lane\n * cut, the newest contract under which the host sends every finished card\n * whole (the host's version gates are cumulative, `>=`).\n */\nexport const DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION: number =\n DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION - 1;\n\n/**\n * The contract version a surface's attaches declare: the lane-cut version\n * when it pages lanes, else {@link DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION}.\n * Every attach of one surface — its thread, its pooled prewarm dials, its\n * wakes — declares the same, so a pooled hello is the hello the thread's own\n * attach would get.\n */\nexport function declaredDeepAgentProtocolVersion({\n laneHistory = false,\n}: DeepAgentProtocolDeclaration = {}): number {\n return laneHistory\n ? DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION\n : DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION;\n}\n\n/** The advertised-lane projection a host surface reads. */\nexport interface DeepAgentProtocolStatus {\n /** Server-advertised current contract version. */\n protocolVersion: number;\n /** The contract version this surface's attach declares ({@link declaredDeepAgentProtocolVersion}). */\n clientVersion: number;\n}\n\nconst isContractVersion = (value: unknown): value is number =>\n typeof value === 'number' && Number.isInteger(value) && value >= 1;\n\n/**\n * The server-advertised version lane off a raw statewire state, or `null`\n * while it is unreadable — pre-attach, a pre-negotiation server's snapshot\n * (no lane), or a malformed lane (tolerated as absent, never thrown on).\n */\nexport function readDeepAgentProtocol(state: unknown): DeepAgentWireProtocol | null {\n if (typeof state !== 'object' || state === null) return null;\n const lane = (state as Record<string, unknown>)[DEEP_AGENT_PROTOCOL_STATE_KEY];\n if (typeof lane !== 'object' || lane === null) return null;\n const { version } = lane as Record<string, unknown>;\n if (!isContractVersion(version)) return null;\n return { version };\n}\n\n/**\n * Project the advertised version for a host surface, paired with what the\n * surface declares, or `null` while the server has not advertised (see\n * {@link readDeepAgentProtocol}). Pure and selector-safe, mirroring\n * `readSessionPersisted`.\n */\nexport function projectDeepAgentProtocol(\n state: unknown,\n declaration: DeepAgentProtocolDeclaration = {}\n): DeepAgentProtocolStatus | null {\n const lane = readDeepAgentProtocol(state);\n if (lane === null) return null;\n return {\n protocolVersion: lane.version,\n clientVersion: declaredDeepAgentProtocolVersion(declaration),\n };\n}\n\n/**\n * The protocol lanes seeds carry ({@link withSeedProtocolLane}), by identity.\n * Statewire's optimistic folds are copy-on-write, so every state folded over a\n * seed keeps its lane object, while a state the host sent never holds one\n * (each is parsed off the wire).\n */\nconst seedProtocolLanes = new WeakSet<object>();\n\n/**\n * `state` with a protocol lane of its own, remembered as a seed's — for the\n * remembered states a mount is seeded with (`toThreadSnapshotSeed`), whose\n * lanes are what the host sent an earlier attach. The lane is copied rather\n * than remembered in place, so a live attach still holding the original object\n * is never read as a seed.\n */\nexport function withSeedProtocolLane(state: DeepAgentStreamValues): DeepAgentStreamValues {\n const lane = state.protocol;\n if (typeof lane !== 'object' || lane === null) return state;\n const seeded = { ...lane };\n seedProtocolLanes.add(seeded);\n return { ...state, protocol: seeded };\n}\n\n/**\n * Whether `state` is one the host sent on this attach. The host advertises the\n * protocol lane in every attach snapshot and keeps it on every later frame;\n * the states a thread renders before its snapshot carry none (the placeholder\n * an existing thread loads with, and any optimistic fold over it) or a seed's\n * ({@link withSeedProtocolLane}).\n *\n * Decide anything about what the host holds — its config lane above all —\n * from these states only, never from the connection status: on a thread\n * mid-run the channel reports `connected` before the attach snapshot applies,\n * and a placeholder read as the host's says the thread has no config.\n *\n * A host predating the lane (2026-08-28) never answers true; the config lane\n * writes clients make (`config/patch`, 2026-09-05) came after it.\n */\nexport function isDeepAgentHostState(state: unknown): boolean {\n if (typeof state !== 'object' || state === null) return false;\n const lane = (state as Record<string, unknown>)[DEEP_AGENT_PROTOCOL_STATE_KEY];\n return (\n typeof lane === 'object' &&\n lane !== null &&\n readDeepAgentProtocol(state) !== null &&\n !seedProtocolLanes.has(lane)\n );\n}\n\n/**\n * Attach headers with the surface's contract version declared\n * ({@link declaredDeepAgentProtocolVersion}). Applied by the attach recipe\n * (`createDeepAgentAttachTransport`, `wakeDeepAgentThread`) to every resolved\n * header set, so every surface declares without per-host wiring; an explicit\n * entry (tests, forced overrides) wins.\n */\nexport function withDeclaredProtocolVersion(\n headers: Record<string, string>,\n declaration: DeepAgentProtocolDeclaration = {}\n): Record<string, string> {\n if (DEEP_AGENT_PROTOCOL_VERSION_HEADER in headers) return headers;\n return {\n ...headers,\n [DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(declaredDeepAgentProtocolVersion(declaration)),\n };\n}\n"],"names":["DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION","DEEP_AGENT_PROTOCOL_STATE_KEY","DEEP_AGENT_PROTOCOL_VERSION_HEADER"],"mappings":";;;AAkEO,MAAM,6CACXA,kBAAAA,uCAAuC;AASlC,SAAS,iCAAiC;AAAA,EAC/C,cAAc;AAChB,IAAkC,IAAY;AAC5C,SAAO,cACHA,kBAAAA,uCACA;AACN;AAUA,MAAM,oBAAoB,CAAC,UACzB,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,KAAK,SAAS;AAO5D,SAAS,sBAAsB,OAA8C;AAClF,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,OAAQ,MAAkCC,+CAA6B;AAC7E,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,EAAE,YAAY;AACpB,MAAI,CAAC,kBAAkB,OAAO,EAAG,QAAO;AACxC,SAAO,EAAE,QAAA;AACX;AAQO,SAAS,yBACd,OACA,cAA4C,IACZ;AAChC,QAAM,OAAO,sBAAsB,KAAK;AACxC,MAAI,SAAS,KAAM,QAAO;AAC1B,SAAO;AAAA,IACL,iBAAiB,KAAK;AAAA,IACtB,eAAe,iCAAiC,WAAW;AAAA,EAAA;AAE/D;AAQA,MAAM,wCAAwB,QAAA;AASvB,SAAS,qBAAqB,OAAqD;AACxF,QAAM,OAAO,MAAM;AACnB,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,SAAS,EAAE,GAAG,KAAA;AACpB,oBAAkB,IAAI,MAAM;AAC5B,SAAO,EAAE,GAAG,OAAO,UAAU,OAAA;AAC/B;AAiBO,SAAS,qBAAqB,OAAyB;AAC5D,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,OAAQ,MAAkCA,+CAA6B;AAC7E,SACE,OAAO,SAAS,YAChB,SAAS,QACT,sBAAsB,KAAK,MAAM,QACjC,CAAC,kBAAkB,IAAI,IAAI;AAE/B;AASO,SAAS,4BACd,SACA,cAA4C,IACpB;AACxB,MAAIC,kBAAAA,sCAAsC,QAAS,QAAO;AAC1D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,CAACA,oDAAkC,GAAG,OAAO,iCAAiC,WAAW,CAAC;AAAA,EAAA;AAE9F;;;;;;;;"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { DeepAgentStreamValues } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Wire-contract version declaration between the deep-agent statewire host and
|
|
4
|
+
* a client surface (the client half of agora's
|
|
5
|
+
* `agora/graphs/athena_deep_agent/protocol_version.py`; upstream ask
|
|
6
|
+
* assistant-ui/statewire #31506 would make this a library concern).
|
|
7
|
+
*
|
|
8
|
+
* - Declaration: {@link withDeclaredProtocolVersion} stamps the version the
|
|
9
|
+
* surface declares ({@link declaredDeepAgentProtocolVersion}) onto the
|
|
10
|
+
* attach headers — they ride the first WS frame's mandatory `headers` field /
|
|
11
|
+
* the SSE request headers, so no statewire change is needed. The host
|
|
12
|
+
* records it for attach telemetry and selects per-version behaviour by it.
|
|
13
|
+
* - Advertisement: the host publishes its own `version` under the `protocol`
|
|
14
|
+
* state key in every attach snapshot; {@link readDeepAgentProtocol} /
|
|
15
|
+
* {@link projectDeepAgentProtocol} read it.
|
|
16
|
+
*
|
|
17
|
+
* A declared version is a promise the host acts on, not the newest version
|
|
18
|
+
* this build knows (`DEEP_AGENT_PROTOCOL_VERSION`): a host serves a client
|
|
19
|
+
* declaring `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION` finished subagent lanes cut
|
|
20
|
+
* to their newest steps, trusting it to page the rest. So a surface declares
|
|
21
|
+
* what it implements ({@link DeepAgentProtocolDeclaration}), and a contract
|
|
22
|
+
* bump never changes what a surface promises.
|
|
23
|
+
*
|
|
24
|
+
* There is no minimum client version: the host refuses no command for the
|
|
25
|
+
* version its client declared (or for declaring none), so nothing here
|
|
26
|
+
* compares versions or gates a send. Hosts still publish a `minClientVersion`
|
|
27
|
+
* key (the constant 1) for installed clients whose lane reader required it;
|
|
28
|
+
* this reader ignores it.
|
|
29
|
+
*
|
|
30
|
+
* Skew-tolerant on both sides: an old server advertises nothing (project
|
|
31
|
+
* `null`, gate nothing), and a malformed lane reads as absent — the
|
|
32
|
+
* declaration must never brick a client that could otherwise talk.
|
|
33
|
+
*/
|
|
34
|
+
export interface DeepAgentWireProtocol {
|
|
35
|
+
/** The wire-contract version the server speaks. */
|
|
36
|
+
version: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* What a surface implements of the contract, and so may declare on its
|
|
40
|
+
* attaches ({@link declaredDeepAgentProtocolVersion}). Every field is off
|
|
41
|
+
* until the surface ships the capability.
|
|
42
|
+
*/
|
|
43
|
+
export interface DeepAgentProtocolDeclaration {
|
|
44
|
+
/**
|
|
45
|
+
* The surface pages a cut lane's earlier steps (`useDeepAgentLaneHistory`
|
|
46
|
+
* over `history/lane`) wherever it shows a lane's steps. Its attaches then
|
|
47
|
+
* declare `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION`, and the host sends a
|
|
48
|
+
* finished `task` card with a deep nested transcript cut to its newest
|
|
49
|
+
* steps, as it sends a running one, under the key
|
|
50
|
+
* `[threadId, "main", messageId, "cut"]`. Off, finished cards ride whole.
|
|
51
|
+
*/
|
|
52
|
+
laneHistory?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The version a surface declares until it pages lanes: the one below the lane
|
|
56
|
+
* cut, the newest contract under which the host sends every finished card
|
|
57
|
+
* whole (the host's version gates are cumulative, `>=`).
|
|
58
|
+
*/
|
|
59
|
+
export declare const DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION: number;
|
|
60
|
+
/**
|
|
61
|
+
* The contract version a surface's attaches declare: the lane-cut version
|
|
62
|
+
* when it pages lanes, else {@link DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION}.
|
|
63
|
+
* Every attach of one surface — its thread, its pooled prewarm dials, its
|
|
64
|
+
* wakes — declares the same, so a pooled hello is the hello the thread's own
|
|
65
|
+
* attach would get.
|
|
66
|
+
*/
|
|
67
|
+
export declare function declaredDeepAgentProtocolVersion({ laneHistory, }?: DeepAgentProtocolDeclaration): number;
|
|
68
|
+
/** The advertised-lane projection a host surface reads. */
|
|
69
|
+
export interface DeepAgentProtocolStatus {
|
|
70
|
+
/** Server-advertised current contract version. */
|
|
71
|
+
protocolVersion: number;
|
|
72
|
+
/** The contract version this surface's attach declares ({@link declaredDeepAgentProtocolVersion}). */
|
|
73
|
+
clientVersion: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The server-advertised version lane off a raw statewire state, or `null`
|
|
77
|
+
* while it is unreadable — pre-attach, a pre-negotiation server's snapshot
|
|
78
|
+
* (no lane), or a malformed lane (tolerated as absent, never thrown on).
|
|
79
|
+
*/
|
|
80
|
+
export declare function readDeepAgentProtocol(state: unknown): DeepAgentWireProtocol | null;
|
|
81
|
+
/**
|
|
82
|
+
* Project the advertised version for a host surface, paired with what the
|
|
83
|
+
* surface declares, or `null` while the server has not advertised (see
|
|
84
|
+
* {@link readDeepAgentProtocol}). Pure and selector-safe, mirroring
|
|
85
|
+
* `readSessionPersisted`.
|
|
86
|
+
*/
|
|
87
|
+
export declare function projectDeepAgentProtocol(state: unknown, declaration?: DeepAgentProtocolDeclaration): DeepAgentProtocolStatus | null;
|
|
88
|
+
/**
|
|
89
|
+
* `state` with a protocol lane of its own, remembered as a seed's — for the
|
|
90
|
+
* remembered states a mount is seeded with (`toThreadSnapshotSeed`), whose
|
|
91
|
+
* lanes are what the host sent an earlier attach. The lane is copied rather
|
|
92
|
+
* than remembered in place, so a live attach still holding the original object
|
|
93
|
+
* is never read as a seed.
|
|
94
|
+
*/
|
|
95
|
+
export declare function withSeedProtocolLane(state: DeepAgentStreamValues): DeepAgentStreamValues;
|
|
96
|
+
/**
|
|
97
|
+
* Whether `state` is one the host sent on this attach. The host advertises the
|
|
98
|
+
* protocol lane in every attach snapshot and keeps it on every later frame;
|
|
99
|
+
* the states a thread renders before its snapshot carry none (the placeholder
|
|
100
|
+
* an existing thread loads with, and any optimistic fold over it) or a seed's
|
|
101
|
+
* ({@link withSeedProtocolLane}).
|
|
102
|
+
*
|
|
103
|
+
* Decide anything about what the host holds — its config lane above all —
|
|
104
|
+
* from these states only, never from the connection status: on a thread
|
|
105
|
+
* mid-run the channel reports `connected` before the attach snapshot applies,
|
|
106
|
+
* and a placeholder read as the host's says the thread has no config.
|
|
107
|
+
*
|
|
108
|
+
* A host predating the lane (2026-08-28) never answers true; the config lane
|
|
109
|
+
* writes clients make (`config/patch`, 2026-09-05) came after it.
|
|
110
|
+
*/
|
|
111
|
+
export declare function isDeepAgentHostState(state: unknown): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Attach headers with the surface's contract version declared
|
|
114
|
+
* ({@link declaredDeepAgentProtocolVersion}). Applied by the attach recipe
|
|
115
|
+
* (`createDeepAgentAttachTransport`, `wakeDeepAgentThread`) to every resolved
|
|
116
|
+
* header set, so every surface declares without per-host wiring; an explicit
|
|
117
|
+
* entry (tests, forced overrides) wins.
|
|
118
|
+
*/
|
|
119
|
+
export declare function withDeclaredProtocolVersion(headers: Record<string, string>, declaration?: DeepAgentProtocolDeclaration): Record<string, string>;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DEEP_AGENT_PROTOCOL_STATE_KEY, DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION, DEEP_AGENT_PROTOCOL_VERSION_HEADER } from "./generated/runconfig-contract.js";
|
|
2
|
+
const DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION = DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION - 1;
|
|
3
|
+
function declaredDeepAgentProtocolVersion({
|
|
4
|
+
laneHistory = false
|
|
5
|
+
} = {}) {
|
|
6
|
+
return laneHistory ? DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION : DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION;
|
|
7
|
+
}
|
|
2
8
|
const isContractVersion = (value) => typeof value === "number" && Number.isInteger(value) && value >= 1;
|
|
3
9
|
function readDeepAgentProtocol(state) {
|
|
4
10
|
if (typeof state !== "object" || state === null) return null;
|
|
@@ -8,12 +14,12 @@ function readDeepAgentProtocol(state) {
|
|
|
8
14
|
if (!isContractVersion(version)) return null;
|
|
9
15
|
return { version };
|
|
10
16
|
}
|
|
11
|
-
function projectDeepAgentProtocol(state) {
|
|
17
|
+
function projectDeepAgentProtocol(state, declaration = {}) {
|
|
12
18
|
const lane = readDeepAgentProtocol(state);
|
|
13
19
|
if (lane === null) return null;
|
|
14
20
|
return {
|
|
15
21
|
protocolVersion: lane.version,
|
|
16
|
-
clientVersion:
|
|
22
|
+
clientVersion: declaredDeepAgentProtocolVersion(declaration)
|
|
17
23
|
};
|
|
18
24
|
}
|
|
19
25
|
const seedProtocolLanes = /* @__PURE__ */ new WeakSet();
|
|
@@ -29,14 +35,16 @@ function isDeepAgentHostState(state) {
|
|
|
29
35
|
const lane = state[DEEP_AGENT_PROTOCOL_STATE_KEY];
|
|
30
36
|
return typeof lane === "object" && lane !== null && readDeepAgentProtocol(state) !== null && !seedProtocolLanes.has(lane);
|
|
31
37
|
}
|
|
32
|
-
function withDeclaredProtocolVersion(headers) {
|
|
38
|
+
function withDeclaredProtocolVersion(headers, declaration = {}) {
|
|
33
39
|
if (DEEP_AGENT_PROTOCOL_VERSION_HEADER in headers) return headers;
|
|
34
40
|
return {
|
|
35
41
|
...headers,
|
|
36
|
-
[DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(
|
|
42
|
+
[DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(declaredDeepAgentProtocolVersion(declaration))
|
|
37
43
|
};
|
|
38
44
|
}
|
|
39
45
|
export {
|
|
46
|
+
DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION,
|
|
47
|
+
declaredDeepAgentProtocolVersion,
|
|
40
48
|
isDeepAgentHostState,
|
|
41
49
|
projectDeepAgentProtocol,
|
|
42
50
|
readDeepAgentProtocol,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sources":["../../../../agent-runtime/src/protocol.ts"],"sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"file":"protocol.js","sources":["../../../../agent-runtime/src/protocol.ts"],"sourcesContent":["import {\n DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION,\n DEEP_AGENT_PROTOCOL_STATE_KEY,\n DEEP_AGENT_PROTOCOL_VERSION_HEADER,\n} from './generated/runconfig-contract';\nimport type { DeepAgentStreamValues } from './types';\n\n/**\n * Wire-contract version declaration between the deep-agent statewire host and\n * a client surface (the client half of agora's\n * `agora/graphs/athena_deep_agent/protocol_version.py`; upstream ask\n * assistant-ui/statewire #31506 would make this a library concern).\n *\n * - Declaration: {@link withDeclaredProtocolVersion} stamps the version the\n * surface declares ({@link declaredDeepAgentProtocolVersion}) onto the\n * attach headers — they ride the first WS frame's mandatory `headers` field /\n * the SSE request headers, so no statewire change is needed. The host\n * records it for attach telemetry and selects per-version behaviour by it.\n * - Advertisement: the host publishes its own `version` under the `protocol`\n * state key in every attach snapshot; {@link readDeepAgentProtocol} /\n * {@link projectDeepAgentProtocol} read it.\n *\n * A declared version is a promise the host acts on, not the newest version\n * this build knows (`DEEP_AGENT_PROTOCOL_VERSION`): a host serves a client\n * declaring `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION` finished subagent lanes cut\n * to their newest steps, trusting it to page the rest. So a surface declares\n * what it implements ({@link DeepAgentProtocolDeclaration}), and a contract\n * bump never changes what a surface promises.\n *\n * There is no minimum client version: the host refuses no command for the\n * version its client declared (or for declaring none), so nothing here\n * compares versions or gates a send. Hosts still publish a `minClientVersion`\n * key (the constant 1) for installed clients whose lane reader required it;\n * this reader ignores it.\n *\n * Skew-tolerant on both sides: an old server advertises nothing (project\n * `null`, gate nothing), and a malformed lane reads as absent — the\n * declaration must never brick a client that could otherwise talk.\n */\nexport interface DeepAgentWireProtocol {\n /** The wire-contract version the server speaks. */\n version: number;\n}\n\n/**\n * What a surface implements of the contract, and so may declare on its\n * attaches ({@link declaredDeepAgentProtocolVersion}). Every field is off\n * until the surface ships the capability.\n */\nexport interface DeepAgentProtocolDeclaration {\n /**\n * The surface pages a cut lane's earlier steps (`useDeepAgentLaneHistory`\n * over `history/lane`) wherever it shows a lane's steps. Its attaches then\n * declare `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION`, and the host sends a\n * finished `task` card with a deep nested transcript cut to its newest\n * steps, as it sends a running one, under the key\n * `[threadId, \"main\", messageId, \"cut\"]`. Off, finished cards ride whole.\n */\n laneHistory?: boolean;\n}\n\n/**\n * The version a surface declares until it pages lanes: the one below the lane\n * cut, the newest contract under which the host sends every finished card\n * whole (the host's version gates are cumulative, `>=`).\n */\nexport const DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION: number =\n DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION - 1;\n\n/**\n * The contract version a surface's attaches declare: the lane-cut version\n * when it pages lanes, else {@link DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION}.\n * Every attach of one surface — its thread, its pooled prewarm dials, its\n * wakes — declares the same, so a pooled hello is the hello the thread's own\n * attach would get.\n */\nexport function declaredDeepAgentProtocolVersion({\n laneHistory = false,\n}: DeepAgentProtocolDeclaration = {}): number {\n return laneHistory\n ? DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION\n : DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION;\n}\n\n/** The advertised-lane projection a host surface reads. */\nexport interface DeepAgentProtocolStatus {\n /** Server-advertised current contract version. */\n protocolVersion: number;\n /** The contract version this surface's attach declares ({@link declaredDeepAgentProtocolVersion}). */\n clientVersion: number;\n}\n\nconst isContractVersion = (value: unknown): value is number =>\n typeof value === 'number' && Number.isInteger(value) && value >= 1;\n\n/**\n * The server-advertised version lane off a raw statewire state, or `null`\n * while it is unreadable — pre-attach, a pre-negotiation server's snapshot\n * (no lane), or a malformed lane (tolerated as absent, never thrown on).\n */\nexport function readDeepAgentProtocol(state: unknown): DeepAgentWireProtocol | null {\n if (typeof state !== 'object' || state === null) return null;\n const lane = (state as Record<string, unknown>)[DEEP_AGENT_PROTOCOL_STATE_KEY];\n if (typeof lane !== 'object' || lane === null) return null;\n const { version } = lane as Record<string, unknown>;\n if (!isContractVersion(version)) return null;\n return { version };\n}\n\n/**\n * Project the advertised version for a host surface, paired with what the\n * surface declares, or `null` while the server has not advertised (see\n * {@link readDeepAgentProtocol}). Pure and selector-safe, mirroring\n * `readSessionPersisted`.\n */\nexport function projectDeepAgentProtocol(\n state: unknown,\n declaration: DeepAgentProtocolDeclaration = {}\n): DeepAgentProtocolStatus | null {\n const lane = readDeepAgentProtocol(state);\n if (lane === null) return null;\n return {\n protocolVersion: lane.version,\n clientVersion: declaredDeepAgentProtocolVersion(declaration),\n };\n}\n\n/**\n * The protocol lanes seeds carry ({@link withSeedProtocolLane}), by identity.\n * Statewire's optimistic folds are copy-on-write, so every state folded over a\n * seed keeps its lane object, while a state the host sent never holds one\n * (each is parsed off the wire).\n */\nconst seedProtocolLanes = new WeakSet<object>();\n\n/**\n * `state` with a protocol lane of its own, remembered as a seed's — for the\n * remembered states a mount is seeded with (`toThreadSnapshotSeed`), whose\n * lanes are what the host sent an earlier attach. The lane is copied rather\n * than remembered in place, so a live attach still holding the original object\n * is never read as a seed.\n */\nexport function withSeedProtocolLane(state: DeepAgentStreamValues): DeepAgentStreamValues {\n const lane = state.protocol;\n if (typeof lane !== 'object' || lane === null) return state;\n const seeded = { ...lane };\n seedProtocolLanes.add(seeded);\n return { ...state, protocol: seeded };\n}\n\n/**\n * Whether `state` is one the host sent on this attach. The host advertises the\n * protocol lane in every attach snapshot and keeps it on every later frame;\n * the states a thread renders before its snapshot carry none (the placeholder\n * an existing thread loads with, and any optimistic fold over it) or a seed's\n * ({@link withSeedProtocolLane}).\n *\n * Decide anything about what the host holds — its config lane above all —\n * from these states only, never from the connection status: on a thread\n * mid-run the channel reports `connected` before the attach snapshot applies,\n * and a placeholder read as the host's says the thread has no config.\n *\n * A host predating the lane (2026-08-28) never answers true; the config lane\n * writes clients make (`config/patch`, 2026-09-05) came after it.\n */\nexport function isDeepAgentHostState(state: unknown): boolean {\n if (typeof state !== 'object' || state === null) return false;\n const lane = (state as Record<string, unknown>)[DEEP_AGENT_PROTOCOL_STATE_KEY];\n return (\n typeof lane === 'object' &&\n lane !== null &&\n readDeepAgentProtocol(state) !== null &&\n !seedProtocolLanes.has(lane)\n );\n}\n\n/**\n * Attach headers with the surface's contract version declared\n * ({@link declaredDeepAgentProtocolVersion}). Applied by the attach recipe\n * (`createDeepAgentAttachTransport`, `wakeDeepAgentThread`) to every resolved\n * header set, so every surface declares without per-host wiring; an explicit\n * entry (tests, forced overrides) wins.\n */\nexport function withDeclaredProtocolVersion(\n headers: Record<string, string>,\n declaration: DeepAgentProtocolDeclaration = {}\n): Record<string, string> {\n if (DEEP_AGENT_PROTOCOL_VERSION_HEADER in headers) return headers;\n return {\n ...headers,\n [DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(declaredDeepAgentProtocolVersion(declaration)),\n };\n}\n"],"names":[],"mappings":";AAkEO,MAAM,6CACX,uCAAuC;AASlC,SAAS,iCAAiC;AAAA,EAC/C,cAAc;AAChB,IAAkC,IAAY;AAC5C,SAAO,cACH,uCACA;AACN;AAUA,MAAM,oBAAoB,CAAC,UACzB,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,KAAK,SAAS;AAO5D,SAAS,sBAAsB,OAA8C;AAClF,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,OAAQ,MAAkC,6BAA6B;AAC7E,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,EAAE,YAAY;AACpB,MAAI,CAAC,kBAAkB,OAAO,EAAG,QAAO;AACxC,SAAO,EAAE,QAAA;AACX;AAQO,SAAS,yBACd,OACA,cAA4C,IACZ;AAChC,QAAM,OAAO,sBAAsB,KAAK;AACxC,MAAI,SAAS,KAAM,QAAO;AAC1B,SAAO;AAAA,IACL,iBAAiB,KAAK;AAAA,IACtB,eAAe,iCAAiC,WAAW;AAAA,EAAA;AAE/D;AAQA,MAAM,wCAAwB,QAAA;AASvB,SAAS,qBAAqB,OAAqD;AACxF,QAAM,OAAO,MAAM;AACnB,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,SAAS,EAAE,GAAG,KAAA;AACpB,oBAAkB,IAAI,MAAM;AAC5B,SAAO,EAAE,GAAG,OAAO,UAAU,OAAA;AAC/B;AAiBO,SAAS,qBAAqB,OAAyB;AAC5D,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,OAAQ,MAAkC,6BAA6B;AAC7E,SACE,OAAO,SAAS,YAChB,SAAS,QACT,sBAAsB,KAAK,MAAM,QACjC,CAAC,kBAAkB,IAAI,IAAI;AAE/B;AASO,SAAS,4BACd,SACA,cAA4C,IACpB;AACxB,MAAI,sCAAsC,QAAS,QAAO;AAC1D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,CAAC,kCAAkC,GAAG,OAAO,iCAAiC,WAAW,CAAC;AAAA,EAAA;AAE9F;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Programmatic-tool-calling (PTC) sub-call parsing — the SDK method calls a
|
|
3
|
+
* sandbox `execute` / interpreter `eval` recorded, promoted by the backend onto
|
|
4
|
+
* the parent ToolMessage's artifact (`promote_artifact_with_ptc_subcalls`
|
|
5
|
+
* shape: one AIMessage carrying every call, then one ToolMessage per settled
|
|
6
|
+
* call). Pure parsing shared by the nested tool cards and the studio
|
|
7
|
+
* follow-along; React selectors over these live with each runtime host.
|
|
8
|
+
*/
|
|
9
|
+
import type { LangChainMessage } from '@assistant-ui/react-langgraph';
|
|
10
|
+
/**
|
|
11
|
+
* One SDK sub-call recorded under a sandbox `execute` (or interpreter `eval`)
|
|
12
|
+
* tool call — an Athena SDK method call (e.g. `Presentation.create`) the
|
|
13
|
+
* backend's PTC display channel captured and promoted onto the parent
|
|
14
|
+
* ToolMessage's `artifact.subgraph_state.messages`.
|
|
15
|
+
*/
|
|
16
|
+
export interface PtcSubcall {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
args: Record<string, unknown>;
|
|
20
|
+
status: 'in_flight' | 'completed' | 'error';
|
|
21
|
+
/** The settled call's parsed result payload (`undefined` while in flight). */
|
|
22
|
+
result: unknown;
|
|
23
|
+
/** The settled call's result text ('' while in flight). */
|
|
24
|
+
resultText: string;
|
|
25
|
+
}
|
|
26
|
+
/** Parse the PTC sub-call list from a parent ToolMessage's promoted artifact. */
|
|
27
|
+
export declare function ptcSubcallsFromArtifact(artifact: unknown): PtcSubcall[];
|
|
28
|
+
/** One completed PTC parent (`execute`, `eval`, or a studio executor) carrying recorded sub-calls. */
|
|
29
|
+
export interface CompletedPtcParent {
|
|
30
|
+
toolCallId: string;
|
|
31
|
+
/** The parent tool's name, one of `PTC_PARENT_TOOL_NAMES`. */
|
|
32
|
+
toolName: string;
|
|
33
|
+
/**
|
|
34
|
+
* The executor source the call ran (`eval`'s `code` arg), read off the AI
|
|
35
|
+
* message that requested it. The studio SDKs emit no cell-level sub-calls,
|
|
36
|
+
* so the code string is the only carrier of the written spreadsheet cell.
|
|
37
|
+
*/
|
|
38
|
+
code: string | undefined;
|
|
39
|
+
/** Shape `computeStudioFollowTarget` expects: `{ artifact, result }`. */
|
|
40
|
+
rawResult: {
|
|
41
|
+
artifact: unknown;
|
|
42
|
+
result: unknown;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Every completed `execute`/`eval` ToolMessage carrying recorded PTC
|
|
47
|
+
* sub-calls, from the raw transport messages — including the ones a subagent
|
|
48
|
+
* ran inside a `task` call's nested transcript. Drives the deep-agent's studio
|
|
49
|
+
* follow-along (`DeepAgentPtcStudioFollowObserver`).
|
|
50
|
+
*/
|
|
51
|
+
export declare function extractCompletedPtcParents(messages: readonly LangChainMessage[]): CompletedPtcParent[];
|