@athenaintel/react 0.57.1 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +778 -9
- package/dist/agent-runtime/src/addressed-agents.cjs +16 -0
- package/dist/agent-runtime/src/addressed-agents.cjs.map +1 -0
- package/dist/agent-runtime/src/addressed-agents.d.ts +30 -0
- package/dist/agent-runtime/src/addressed-agents.js +16 -0
- package/dist/agent-runtime/src/addressed-agents.js.map +1 -0
- package/dist/agent-runtime/src/answer-label.cjs +4 -3
- package/dist/agent-runtime/src/answer-label.cjs.map +1 -1
- package/dist/agent-runtime/src/answer-label.d.ts +13 -6
- package/dist/agent-runtime/src/answer-label.js +4 -3
- package/dist/agent-runtime/src/answer-label.js.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +1 -1
- package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-entry.cjs +101 -0
- package/dist/agent-runtime/src/chat-outbox-entry.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-entry.d.ts +99 -0
- package/dist/agent-runtime/src/chat-outbox-entry.js +101 -0
- package/dist/agent-runtime/src/chat-outbox-entry.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.cjs +252 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.d.ts +96 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.js +252 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-policy.cjs +30 -0
- package/dist/agent-runtime/src/chat-outbox-policy.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-policy.d.ts +42 -0
- package/dist/agent-runtime/src/chat-outbox-policy.js +30 -0
- package/dist/agent-runtime/src/chat-outbox-policy.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-storage.cjs +306 -0
- package/dist/agent-runtime/src/chat-outbox-storage.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-storage.d.ts +194 -0
- package/dist/agent-runtime/src/chat-outbox-storage.js +306 -0
- package/dist/agent-runtime/src/chat-outbox-storage.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-thread.cjs +21 -94
- package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-thread.d.ts +22 -18
- package/dist/agent-runtime/src/chat-outbox-thread.js +21 -94
- package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -1
- package/dist/agent-runtime/src/chat-outbox.cjs +492 -547
- package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox.d.ts +110 -142
- package/dist/agent-runtime/src/chat-outbox.js +492 -547
- package/dist/agent-runtime/src/chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
- package/dist/agent-runtime/src/composer-markdown.d.ts +1 -1
- package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +8 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
- package/dist/agent-runtime/src/dictation-preferences.d.ts +356 -0
- package/dist/agent-runtime/src/dictation-record.d.ts +279 -0
- package/dist/agent-runtime/src/dictation-session.d.ts +106 -7
- package/dist/agent-runtime/src/dictation-snippets.d.ts +9 -0
- package/dist/agent-runtime/src/dictation-transfer.d.ts +142 -0
- package/dist/agent-runtime/src/edit-command.cjs.map +1 -1
- package/dist/agent-runtime/src/edit-command.d.ts +1 -1
- package/dist/agent-runtime/src/edit-command.js.map +1 -1
- package/dist/agent-runtime/src/errors.cjs +1 -0
- package/dist/agent-runtime/src/errors.cjs.map +1 -1
- package/dist/agent-runtime/src/errors.js +1 -0
- package/dist/agent-runtime/src/errors.js.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs +24 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +3 -3
- package/dist/agent-runtime/src/generated/runconfig-contract.js +24 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/agent-runtime/src/index.d.ts +14 -8
- package/dist/agent-runtime/src/lane-follow.cjs +289 -0
- package/dist/agent-runtime/src/lane-follow.cjs.map +1 -0
- package/dist/agent-runtime/src/lane-follow.js +289 -0
- package/dist/agent-runtime/src/lane-follow.js.map +1 -0
- package/dist/agent-runtime/src/lane-images.cjs +387 -0
- package/dist/agent-runtime/src/lane-images.cjs.map +1 -0
- package/dist/agent-runtime/src/lane-images.js +387 -0
- package/dist/agent-runtime/src/lane-images.js.map +1 -0
- package/dist/agent-runtime/src/message-window.js +1 -1
- package/dist/agent-runtime/src/messages.cjs +19 -1
- package/dist/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.d.ts +8 -0
- package/dist/agent-runtime/src/messages.js +21 -3
- package/dist/agent-runtime/src/messages.js.map +1 -1
- package/dist/agent-runtime/src/named-agents.cjs +301 -0
- package/dist/agent-runtime/src/named-agents.cjs.map +1 -0
- package/dist/agent-runtime/src/named-agents.d.ts +246 -0
- package/dist/agent-runtime/src/named-agents.js +301 -0
- package/dist/agent-runtime/src/named-agents.js.map +1 -0
- package/dist/agent-runtime/src/offline-status.cjs.map +1 -1
- package/dist/agent-runtime/src/offline-status.d.ts +66 -2
- package/dist/agent-runtime/src/offline-status.js.map +1 -1
- package/dist/agent-runtime/src/ptc-subcalls.cjs +41 -0
- package/dist/agent-runtime/src/ptc-subcalls.cjs.map +1 -0
- package/dist/agent-runtime/src/ptc-subcalls.js +41 -0
- package/dist/agent-runtime/src/ptc-subcalls.js.map +1 -0
- package/dist/agent-runtime/src/queue.cjs +2 -2
- package/dist/agent-runtime/src/queue.cjs.map +1 -1
- package/dist/agent-runtime/src/queue.d.ts +20 -25
- package/dist/agent-runtime/src/queue.js +2 -2
- package/dist/agent-runtime/src/queue.js.map +1 -1
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +314 -84
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
- package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +137 -40
- package/dist/agent-runtime/src/quota-safe-local-storage-session.js +318 -88
- package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
- package/dist/agent-runtime/src/run-send.cjs +54 -0
- package/dist/agent-runtime/src/run-send.cjs.map +1 -0
- package/dist/agent-runtime/src/run-send.d.ts +51 -0
- package/dist/agent-runtime/src/run-send.js +54 -0
- package/dist/agent-runtime/src/run-send.js.map +1 -0
- package/dist/agent-runtime/src/running-tool-placeholder.cjs +6 -0
- package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -1
- package/dist/agent-runtime/src/running-tool-placeholder.js +6 -0
- package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -1
- package/dist/agent-runtime/src/runtime.d.ts +9 -5
- package/dist/agent-runtime/src/sealed-idb.cjs +64 -0
- package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -1
- package/dist/agent-runtime/src/sealed-idb.d.ts +16 -0
- package/dist/agent-runtime/src/sealed-idb.js +64 -0
- package/dist/agent-runtime/src/sealed-idb.js.map +1 -1
- package/dist/agent-runtime/src/send-recovery.cjs +90 -118
- package/dist/agent-runtime/src/send-recovery.cjs.map +1 -1
- package/dist/agent-runtime/src/send-recovery.d.ts +25 -29
- package/dist/agent-runtime/src/send-recovery.js +90 -118
- package/dist/agent-runtime/src/send-recovery.js.map +1 -1
- package/dist/agent-runtime/src/statewire-diagnostics.d.ts +4 -1
- package/dist/agent-runtime/src/statewire-held-sends.cjs +191 -0
- package/dist/agent-runtime/src/statewire-held-sends.cjs.map +1 -0
- package/dist/agent-runtime/src/statewire-held-sends.d.ts +119 -0
- package/dist/agent-runtime/src/statewire-held-sends.js +191 -0
- package/dist/agent-runtime/src/statewire-held-sends.js.map +1 -0
- package/dist/agent-runtime/src/statewire-state.cjs +4 -0
- package/dist/agent-runtime/src/statewire-state.cjs.map +1 -1
- package/dist/agent-runtime/src/statewire-state.js +4 -0
- package/dist/agent-runtime/src/statewire-state.js.map +1 -1
- package/dist/agent-runtime/src/statewire-transport.cjs +8 -2
- package/dist/agent-runtime/src/statewire-transport.cjs.map +1 -1
- package/dist/agent-runtime/src/statewire-transport.d.ts +14 -5
- package/dist/agent-runtime/src/statewire-transport.js +8 -2
- package/dist/agent-runtime/src/statewire-transport.js.map +1 -1
- package/dist/agent-runtime/src/subagent-transcripts.cjs +1 -23
- package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -1
- package/dist/agent-runtime/src/subagent-transcripts.js +3 -25
- package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -1
- package/dist/agent-runtime/src/subagents.cjs +22 -29
- package/dist/agent-runtime/src/subagents.cjs.map +1 -1
- package/dist/agent-runtime/src/subagents.js +23 -30
- package/dist/agent-runtime/src/subagents.js.map +1 -1
- package/dist/agent-runtime/src/thread-extras.cjs +27 -19
- package/dist/agent-runtime/src/thread-extras.cjs.map +1 -1
- package/dist/agent-runtime/src/thread-extras.d.ts +19 -6
- package/dist/agent-runtime/src/thread-extras.js +27 -19
- package/dist/agent-runtime/src/thread-extras.js.map +1 -1
- package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +8 -8
- package/dist/agent-runtime/src/tool-metadata.cjs +12 -0
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.js +12 -0
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/agent-runtime/src/tool-names.cjs +21 -0
- package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-names.d.ts +8 -0
- package/dist/agent-runtime/src/tool-names.js +21 -0
- package/dist/agent-runtime/src/tool-names.js.map +1 -1
- package/dist/agent-runtime/src/typed-interrupt-kinds.cjs +247 -0
- package/dist/agent-runtime/src/typed-interrupt-kinds.cjs.map +1 -0
- package/dist/agent-runtime/src/typed-interrupt-kinds.d.ts +173 -0
- package/dist/agent-runtime/src/typed-interrupt-kinds.js +247 -0
- package/dist/agent-runtime/src/typed-interrupt-kinds.js.map +1 -0
- package/dist/agent-runtime/src/typed-interrupts.cjs +48 -0
- package/dist/agent-runtime/src/typed-interrupts.cjs.map +1 -0
- package/dist/agent-runtime/src/typed-interrupts.d.ts +75 -0
- package/dist/agent-runtime/src/typed-interrupts.js +48 -0
- package/dist/agent-runtime/src/typed-interrupts.js.map +1 -0
- package/dist/agent-runtime/src/types.d.ts +1 -1
- package/dist/agent-runtime/src/use-conversation-list.cjs +1 -0
- package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
- package/dist/agent-runtime/src/use-conversation-list.d.ts +7 -0
- package/dist/agent-runtime/src/use-conversation-list.js +1 -0
- package/dist/agent-runtime/src/use-conversation-list.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +46 -29
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +14 -22
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +46 -29
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +78 -14
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +34 -7
- package/dist/agent-runtime/src/use-deep-agent-runtime.js +79 -15
- package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs +16 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +7 -2
- package/dist/agent-runtime/src/use-deep-agent-thread.js +16 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs +30 -4
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +22 -4
- package/dist/agent-runtime/src/use-deep-agent-voice.js +30 -4
- package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
- package/dist/agent-runtime/src/withdrawn-turns.d.ts +5 -4
- package/dist/agent-runtime/src/word-device-fit.d.ts +174 -0
- package/dist/agent-runtime/src/work-in.d.ts +127 -0
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.d.ts +6 -1
- package/dist/assets/AthenaAssetEmbed.js.map +1 -1
- package/dist/assets/asset-panel-store.cjs +13 -5
- package/dist/assets/asset-panel-store.cjs.map +1 -1
- package/dist/assets/asset-panel-store.d.ts +33 -2
- package/dist/assets/asset-panel-store.js +13 -5
- package/dist/assets/asset-panel-store.js.map +1 -1
- package/dist/auth/AthenaCredentialSourceContext.cjs +11 -0
- package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
- package/dist/auth/AthenaCredentialSourceContext.d.ts +6 -0
- package/dist/auth/AthenaCredentialSourceContext.js +11 -0
- package/dist/auth/AthenaCredentialSourceContext.js.map +1 -1
- package/dist/auth/account-identity.cjs +13 -2
- package/dist/auth/account-identity.cjs.map +1 -1
- package/dist/auth/account-identity.d.ts +9 -0
- package/dist/auth/account-identity.js +13 -2
- package/dist/auth/account-identity.js.map +1 -1
- package/dist/auth/credential-source.cjs +20 -4
- package/dist/auth/credential-source.cjs.map +1 -1
- package/dist/auth/credential-source.d.ts +9 -0
- package/dist/auth/credential-source.js +20 -4
- package/dist/auth/credential-source.js.map +1 -1
- package/dist/catalog/chat-pickers.cjs +31 -0
- package/dist/catalog/chat-pickers.cjs.map +1 -1
- package/dist/catalog/chat-pickers.d.ts +17 -0
- package/dist/catalog/chat-pickers.js +33 -2
- package/dist/catalog/chat-pickers.js.map +1 -1
- package/dist/catalog/runtime-catalog.cjs +63 -3
- package/dist/catalog/runtime-catalog.cjs.map +1 -1
- package/dist/catalog/runtime-catalog.d.ts +63 -3
- package/dist/catalog/runtime-catalog.js +64 -4
- package/dist/catalog/runtime-catalog.js.map +1 -1
- package/dist/chat/AthenaChat.cjs +337 -99
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +80 -4
- package/dist/chat/AthenaChat.js +337 -99
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireApprovalCard.cjs +35 -5
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +55 -2
- package/dist/chat/StatewireApprovalCard.js +37 -7
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +17 -2
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +8 -45
- package/dist/chat/StatewireQueuedMessages.js +18 -3
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/chat-agent-mentions.cjs +70 -0
- package/dist/chat/chat-agent-mentions.cjs.map +1 -0
- package/dist/chat/chat-agent-mentions.d.ts +13 -0
- package/dist/chat/chat-agent-mentions.js +70 -0
- package/dist/chat/chat-agent-mentions.js.map +1 -0
- package/dist/chat/composer-actions.cjs +12 -0
- package/dist/chat/composer-actions.cjs.map +1 -0
- package/dist/chat/composer-actions.d.ts +22 -0
- package/dist/chat/composer-actions.js +12 -0
- package/dist/chat/composer-actions.js.map +1 -0
- package/dist/chat/follow-up-suggestions.cjs +185 -0
- package/dist/chat/follow-up-suggestions.cjs.map +1 -0
- package/dist/chat/follow-up-suggestions.d.ts +64 -0
- package/dist/chat/follow-up-suggestions.js +185 -0
- package/dist/chat/follow-up-suggestions.js.map +1 -0
- package/dist/chat/super-grouping/ToolTimeline.cjs +4 -3
- package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.d.ts +7 -3
- package/dist/chat/super-grouping/ToolTimeline.js +4 -3
- package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
- package/dist/chat/turn-changes.cjs +284 -0
- package/dist/chat/turn-changes.cjs.map +1 -0
- package/dist/chat/turn-changes.d.ts +130 -0
- package/dist/chat/turn-changes.js +284 -0
- package/dist/chat/turn-changes.js.map +1 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs +31 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs.map +1 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.d.ts +31 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js +31 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js.map +1 -0
- package/dist/chat/typed-interrupts/approval-cards.cjs +250 -0
- package/dist/chat/typed-interrupts/approval-cards.cjs.map +1 -0
- package/dist/chat/typed-interrupts/approval-cards.d.ts +22 -0
- package/dist/chat/typed-interrupts/approval-cards.js +250 -0
- package/dist/chat/typed-interrupts/approval-cards.js.map +1 -0
- package/dist/chat/typed-interrupts/form-cards.cjs +289 -0
- package/dist/chat/typed-interrupts/form-cards.cjs.map +1 -0
- package/dist/chat/typed-interrupts/form-cards.d.ts +6 -0
- package/dist/chat/typed-interrupts/form-cards.js +289 -0
- package/dist/chat/typed-interrupts/form-cards.js.map +1 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.cjs +182 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.cjs.map +1 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.d.ts +47 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.js +182 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.js.map +1 -0
- package/dist/chat/typed-interrupts/json-schema-form.cjs +388 -0
- package/dist/chat/typed-interrupts/json-schema-form.cjs.map +1 -0
- package/dist/chat/typed-interrupts/json-schema-form.d.ts +33 -0
- package/dist/chat/typed-interrupts/json-schema-form.js +388 -0
- package/dist/chat/typed-interrupts/json-schema-form.js.map +1 -0
- package/dist/chat/typed-interrupts/questionnaire-card.cjs +449 -0
- package/dist/chat/typed-interrupts/questionnaire-card.cjs.map +1 -0
- package/dist/chat/typed-interrupts/questionnaire-card.d.ts +20 -0
- package/dist/chat/typed-interrupts/questionnaire-card.js +449 -0
- package/dist/chat/typed-interrupts/questionnaire-card.js.map +1 -0
- package/dist/chat/typed-interrupts/request-file-card.cjs +159 -0
- package/dist/chat/typed-interrupts/request-file-card.cjs.map +1 -0
- package/dist/chat/typed-interrupts/request-file-card.d.ts +2 -0
- package/dist/chat/typed-interrupts/request-file-card.js +159 -0
- package/dist/chat/typed-interrupts/request-file-card.js.map +1 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.cjs +189 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.cjs.map +1 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.d.ts +23 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.js +189 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.cjs +26 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.cjs.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.d.ts +3 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.js +26 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs +105 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.d.ts +29 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.js +105 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs +70 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.d.ts +45 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.js +70 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs +76 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.d.ts +11 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.js +76 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-types.d.ts +46 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.cjs +106 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.cjs.map +1 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.d.ts +29 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.js +106 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.js.map +1 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs +231 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs.map +1 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.d.ts +66 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js +231 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js.map +1 -0
- package/dist/chat-ui/composer/composer-named-agents.cjs +13 -0
- package/dist/chat-ui/composer/composer-named-agents.cjs.map +1 -0
- package/dist/chat-ui/composer/composer-named-agents.d.ts +20 -0
- package/dist/chat-ui/composer/composer-named-agents.js +13 -0
- package/dist/chat-ui/composer/composer-named-agents.js.map +1 -0
- package/dist/chat-ui/composer/slash-command-menu.cjs +143 -0
- package/dist/chat-ui/composer/slash-command-menu.cjs.map +1 -0
- package/dist/chat-ui/composer/slash-command-menu.d.ts +19 -0
- package/dist/chat-ui/composer/slash-command-menu.js +143 -0
- package/dist/chat-ui/composer/slash-command-menu.js.map +1 -0
- package/dist/chat-ui/composer/slash-commands-extension.cjs +51 -0
- package/dist/chat-ui/composer/slash-commands-extension.cjs.map +1 -0
- package/dist/chat-ui/composer/slash-commands-extension.d.ts +39 -0
- package/dist/chat-ui/composer/slash-commands-extension.js +51 -0
- package/dist/chat-ui/composer/slash-commands-extension.js.map +1 -0
- package/dist/chat-ui/composer/slash-commands.cjs +74 -0
- package/dist/chat-ui/composer/slash-commands.cjs.map +1 -0
- package/dist/chat-ui/composer/slash-commands.d.ts +82 -0
- package/dist/chat-ui/composer/slash-commands.js +74 -0
- package/dist/chat-ui/composer/slash-commands.js.map +1 -0
- package/dist/chat-ui/composer/tiptap-composer.cjs +135 -9
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +61 -2
- package/dist/chat-ui/composer/tiptap-composer.js +135 -9
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/index.cjs +3 -0
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +3 -2
- package/dist/chat-ui/index.js +3 -0
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.js +2 -2
- package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.cjs +8 -1
- package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.js +8 -1
- package/dist/chat-ui/mentions/mention-extension.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs +1 -0
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js +1 -0
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs +2 -0
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.js +3 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.js +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +36 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +42 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.js +36 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +235 -19
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +88 -10
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js +236 -20
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/types.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/types.d.ts +27 -1
- package/dist/chat-ui/mentions/suggestions/data/types.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +56 -5
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +26 -6
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +57 -6
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs +34 -17
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.d.ts +19 -1
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js +35 -18
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js.map +1 -1
- package/dist/chat-ui/statewire.d.ts +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +15 -0
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.d.ts +4 -1
- package/dist/chat-ui/thread/statewire-history-edge.js +15 -0
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/collab/client.cjs +17 -5
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +22 -7
- package/dist/collab/client.js +17 -5
- package/dist/collab/client.js.map +1 -1
- package/dist/composer/ComposerAttachedReferences.cjs +119 -0
- package/dist/composer/ComposerAttachedReferences.cjs.map +1 -0
- package/dist/composer/ComposerAttachedReferences.d.ts +26 -0
- package/dist/composer/ComposerAttachedReferences.js +119 -0
- package/dist/composer/ComposerAttachedReferences.js.map +1 -0
- package/dist/composer/ComposerNamedAgents.cjs +63 -0
- package/dist/composer/ComposerNamedAgents.cjs.map +1 -0
- package/dist/composer/ComposerNamedAgents.d.ts +16 -0
- package/dist/composer/ComposerNamedAgents.js +63 -0
- package/dist/composer/ComposerNamedAgents.js.map +1 -0
- package/dist/composer/attached-references.cjs +159 -0
- package/dist/composer/attached-references.cjs.map +1 -0
- package/dist/composer/attached-references.d.ts +86 -0
- package/dist/composer/attached-references.js +159 -0
- package/dist/composer/attached-references.js.map +1 -0
- package/dist/composer/build-composed-message.cjs +14 -7
- package/dist/composer/build-composed-message.cjs.map +1 -1
- package/dist/composer/build-composed-message.d.ts +6 -1
- package/dist/composer/build-composed-message.js +14 -7
- package/dist/composer/build-composed-message.js.map +1 -1
- package/dist/composer/composer-handoff.cjs +6 -2
- package/dist/composer/composer-handoff.cjs.map +1 -1
- package/dist/composer/composer-handoff.d.ts +7 -1
- package/dist/composer/composer-handoff.js +6 -2
- package/dist/composer/composer-handoff.js.map +1 -1
- package/dist/composer/folder-upload.cjs +149 -0
- package/dist/composer/folder-upload.cjs.map +1 -0
- package/dist/composer/folder-upload.d.ts +79 -0
- package/dist/composer/folder-upload.js +149 -0
- package/dist/composer/folder-upload.js.map +1 -0
- package/dist/composer/index.d.ts +1 -1
- package/dist/composer/useAttachToChat.cjs +35 -0
- package/dist/composer/useAttachToChat.cjs.map +1 -0
- package/dist/composer/useAttachToChat.d.ts +54 -0
- package/dist/composer/useAttachToChat.js +35 -0
- package/dist/composer/useAttachToChat.js.map +1 -0
- package/dist/composer/useAttachedReferencesComposerProps.cjs +19 -0
- package/dist/composer/useAttachedReferencesComposerProps.cjs.map +1 -0
- package/dist/composer/useAttachedReferencesComposerProps.d.ts +12 -0
- package/dist/composer/useAttachedReferencesComposerProps.js +19 -0
- package/dist/composer/useAttachedReferencesComposerProps.js.map +1 -0
- package/dist/composer/useFileUpload.cjs +95 -7
- package/dist/composer/useFileUpload.cjs.map +1 -1
- package/dist/composer/useFileUpload.d.ts +21 -2
- package/dist/composer/useFileUpload.js +95 -7
- package/dist/composer/useFileUpload.js.map +1 -1
- package/dist/data/athena-api-error.cjs +125 -0
- package/dist/data/athena-api-error.cjs.map +1 -0
- package/dist/data/athena-api-error.d.ts +96 -0
- package/dist/data/athena-api-error.js +125 -0
- package/dist/data/athena-api-error.js.map +1 -0
- package/dist/data/athena-data-client.cjs +106 -0
- package/dist/data/athena-data-client.cjs.map +1 -0
- package/dist/data/athena-data-client.d.ts +74 -0
- package/dist/data/athena-data-client.js +106 -0
- package/dist/data/athena-data-client.js.map +1 -0
- package/dist/data/athena-member.cjs +93 -0
- package/dist/data/athena-member.cjs.map +1 -0
- package/dist/data/athena-member.d.ts +125 -0
- package/dist/data/athena-member.js +93 -0
- package/dist/data/athena-member.js.map +1 -0
- package/dist/data/athena-request.cjs +458 -0
- package/dist/data/athena-request.cjs.map +1 -0
- package/dist/data/athena-request.d.ts +120 -0
- package/dist/data/athena-request.js +458 -0
- package/dist/data/athena-request.js.map +1 -0
- package/dist/data/use-athena-fetch.cjs +14 -0
- package/dist/data/use-athena-fetch.cjs.map +1 -0
- package/dist/data/use-athena-fetch.d.ts +19 -0
- package/dist/data/use-athena-fetch.js +14 -0
- package/dist/data/use-athena-fetch.js.map +1 -0
- package/dist/data/use-athena-graphql.cjs +66 -0
- package/dist/data/use-athena-graphql.cjs.map +1 -0
- package/dist/data/use-athena-graphql.d.ts +56 -0
- package/dist/data/use-athena-graphql.js +66 -0
- package/dist/data/use-athena-graphql.js.map +1 -0
- package/dist/data/use-athena-rest.cjs +33 -0
- package/dist/data/use-athena-rest.cjs.map +1 -0
- package/dist/data/use-athena-rest.d.ts +21 -0
- package/dist/data/use-athena-rest.js +33 -0
- package/dist/data/use-athena-rest.js.map +1 -0
- package/dist/data/use-semantic-query.cjs +44 -0
- package/dist/data/use-semantic-query.cjs.map +1 -0
- package/dist/data/use-semantic-query.d.ts +92 -0
- package/dist/data/use-semantic-query.js +44 -0
- package/dist/data/use-semantic-query.js.map +1 -0
- package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
- package/dist/diagnostics/athena-diagnostics.d.ts +5 -1
- package/dist/diagnostics/athena-diagnostics.js.map +1 -1
- package/dist/diagnostics/errors.cjs +7 -0
- package/dist/diagnostics/errors.cjs.map +1 -1
- package/dist/diagnostics/errors.d.ts +7 -0
- package/dist/diagnostics/errors.js +7 -0
- package/dist/diagnostics/errors.js.map +1 -1
- package/dist/index.cjs +155 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +72 -13
- package/dist/index.js +148 -4
- package/dist/index.js.map +1 -1
- package/dist/keryx-http/src/initial-sync.cjs +64 -16
- package/dist/keryx-http/src/initial-sync.cjs.map +1 -1
- package/dist/keryx-http/src/initial-sync.d.ts +31 -1
- package/dist/keryx-http/src/initial-sync.js +64 -16
- package/dist/keryx-http/src/initial-sync.js.map +1 -1
- package/dist/keryx-http/src/own-awareness.cjs +20 -0
- package/dist/keryx-http/src/own-awareness.cjs.map +1 -0
- package/dist/keryx-http/src/own-awareness.d.ts +50 -0
- package/dist/keryx-http/src/own-awareness.js +20 -0
- package/dist/keryx-http/src/own-awareness.js.map +1 -0
- package/dist/keryx-http/src/update-attributions.cjs +26 -1
- package/dist/keryx-http/src/update-attributions.cjs.map +1 -1
- package/dist/keryx-http/src/update-attributions.d.ts +10 -1
- package/dist/keryx-http/src/update-attributions.js +26 -1
- package/dist/keryx-http/src/update-attributions.js.map +1 -1
- package/dist/offline/chat-outbox.cjs +262 -26
- package/dist/offline/chat-outbox.cjs.map +1 -1
- package/dist/offline/chat-outbox.d.ts +90 -12
- package/dist/offline/chat-outbox.js +263 -27
- package/dist/offline/chat-outbox.js.map +1 -1
- package/dist/provider/AthenaProvider.cjs +63 -19
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +24 -8
- package/dist/provider/AthenaProvider.js +66 -22
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/references/src/anchors/types.cjs +5 -0
- package/dist/references/src/anchors/types.cjs.map +1 -1
- package/dist/references/src/anchors/types.js +5 -0
- package/dist/references/src/anchors/types.js.map +1 -1
- package/dist/references/src/attachable.cjs +149 -0
- package/dist/references/src/attachable.cjs.map +1 -0
- package/dist/references/src/attachable.d.ts +87 -0
- package/dist/references/src/attachable.js +149 -0
- package/dist/references/src/attachable.js.map +1 -0
- package/dist/runtime/StatewirePlanModeLaneSync.cjs +93 -0
- package/dist/runtime/StatewirePlanModeLaneSync.cjs.map +1 -0
- package/dist/runtime/StatewirePlanModeLaneSync.d.ts +34 -0
- package/dist/runtime/StatewirePlanModeLaneSync.js +93 -0
- package/dist/runtime/StatewirePlanModeLaneSync.js.map +1 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs +2 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
- package/dist/runtime/StatewireThreadConfigLaneSync.d.ts +4 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.js +2 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.js.map +1 -1
- package/dist/runtime/statewire-plan-mode.cjs +71 -0
- package/dist/runtime/statewire-plan-mode.cjs.map +1 -0
- package/dist/runtime/statewire-plan-mode.d.ts +88 -0
- package/dist/runtime/statewire-plan-mode.js +71 -0
- package/dist/runtime/statewire-plan-mode.js.map +1 -0
- package/dist/runtime/statewire-run-config.cjs +18 -1
- package/dist/runtime/statewire-run-config.cjs.map +1 -1
- package/dist/runtime/statewire-run-config.d.ts +20 -0
- package/dist/runtime/statewire-run-config.js +18 -1
- package/dist/runtime/statewire-run-config.js.map +1 -1
- package/dist/runtime/statewire-session-key.cjs +11 -5
- package/dist/runtime/statewire-session-key.cjs.map +1 -1
- package/dist/runtime/statewire-session-key.d.ts +22 -10
- package/dist/runtime/statewire-session-key.js +11 -5
- package/dist/runtime/statewire-session-key.js.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +65 -8
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +26 -10
- package/dist/runtime/useAthenaStatewireRuntime.js +67 -10
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/search/useAthenaAssets.cjs +394 -0
- package/dist/search/useAthenaAssets.cjs.map +1 -0
- package/dist/search/useAthenaAssets.d.ts +186 -0
- package/dist/search/useAthenaAssets.js +394 -0
- package/dist/search/useAthenaAssets.js.map +1 -0
- package/dist/sheet-range/index.cjs +4 -0
- package/dist/sheet-range/index.cjs.map +1 -1
- package/dist/sheet-range/index.d.ts +4 -2
- package/dist/sheet-range/index.js +4 -0
- package/dist/sheet-range/index.js.map +1 -1
- package/dist/sheet-range/query-range.cjs +102 -0
- package/dist/sheet-range/query-range.cjs.map +1 -0
- package/dist/sheet-range/query-range.d.ts +46 -0
- package/dist/sheet-range/query-range.js +102 -0
- package/dist/sheet-range/query-range.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/subagents/index.cjs +49 -0
- package/dist/subagents/index.cjs.map +1 -0
- package/dist/subagents/index.d.ts +16 -0
- package/dist/subagents/index.js +49 -0
- package/dist/subagents/index.js.map +1 -0
- package/dist/subagents/lane-follow.cjs +19 -0
- package/dist/subagents/lane-follow.cjs.map +1 -0
- package/dist/subagents/lane-follow.d.ts +9 -0
- package/dist/subagents/lane-follow.js +19 -0
- package/dist/subagents/lane-follow.js.map +1 -0
- package/dist/subagents/lane-model.cjs +178 -0
- package/dist/subagents/lane-model.cjs.map +1 -0
- package/dist/subagents/lane-model.d.ts +140 -0
- package/dist/subagents/lane-model.js +178 -0
- package/dist/subagents/lane-model.js.map +1 -0
- package/dist/subagents/lane-parts.cjs +517 -0
- package/dist/subagents/lane-parts.cjs.map +1 -0
- package/dist/subagents/lane-parts.d.ts +130 -0
- package/dist/subagents/lane-parts.js +517 -0
- package/dist/subagents/lane-parts.js.map +1 -0
- package/dist/subagents/subagent-lane-group.cjs +215 -0
- package/dist/subagents/subagent-lane-group.cjs.map +1 -0
- package/dist/subagents/subagent-lane-group.d.ts +67 -0
- package/dist/subagents/subagent-lane-group.js +215 -0
- package/dist/subagents/subagent-lane-group.js.map +1 -0
- package/dist/subagents/subagent-transcript-drawer.cjs +431 -0
- package/dist/subagents/subagent-transcript-drawer.cjs.map +1 -0
- package/dist/subagents/subagent-transcript-drawer.d.ts +78 -0
- package/dist/subagents/subagent-transcript-drawer.js +431 -0
- package/dist/subagents/subagent-transcript-drawer.js.map +1 -0
- package/dist/subagents/task-subagent-group.cjs +115 -0
- package/dist/subagents/task-subagent-group.cjs.map +1 -0
- package/dist/subagents/task-subagent-group.d.ts +36 -0
- package/dist/subagents/task-subagent-group.js +115 -0
- package/dist/subagents/task-subagent-group.js.map +1 -0
- package/dist/subagents/use-omitted-images-in-view.cjs +68 -0
- package/dist/subagents/use-omitted-images-in-view.cjs.map +1 -0
- package/dist/subagents/use-omitted-images-in-view.d.ts +21 -0
- package/dist/subagents/use-omitted-images-in-view.js +68 -0
- package/dist/subagents/use-omitted-images-in-view.js.map +1 -0
- package/dist/threads/Inbox.cjs +2 -2
- package/dist/threads/Inbox.cjs.map +1 -1
- package/dist/threads/SessionList.cjs +27 -24
- package/dist/threads/SessionList.cjs.map +1 -1
- package/dist/threads/SessionList.js +22 -19
- package/dist/threads/SessionList.js.map +1 -1
- package/dist/threads/SessionsPage.cjs +13 -7
- package/dist/threads/SessionsPage.cjs.map +1 -1
- package/dist/threads/SessionsPage.d.ts +10 -1
- package/dist/threads/SessionsPage.js +9 -3
- package/dist/threads/SessionsPage.js.map +1 -1
- package/dist/threads/live-session-rows.cjs +207 -0
- package/dist/threads/live-session-rows.cjs.map +1 -0
- package/dist/threads/live-session-rows.d.ts +175 -0
- package/dist/threads/live-session-rows.js +207 -0
- package/dist/threads/live-session-rows.js.map +1 -0
- package/dist/threads/session-list-model.cjs.map +1 -1
- package/dist/threads/session-list-model.d.ts +2 -1
- package/dist/threads/session-list-model.js.map +1 -1
- package/dist/threads/session-row-parts.cjs +3 -3
- package/dist/threads/session-row-parts.cjs.map +1 -1
- package/dist/threads/sessions-page-model.cjs +13 -5
- package/dist/threads/sessions-page-model.cjs.map +1 -1
- package/dist/threads/sessions-page-model.d.ts +7 -0
- package/dist/threads/sessions-page-model.js +11 -3
- package/dist/threads/sessions-page-model.js.map +1 -1
- package/dist/threads/sessions-page-storage.cjs +8 -8
- package/dist/threads/sessions-page-storage.cjs.map +1 -1
- package/dist/threads/sessions-page-storage.d.ts +5 -1
- package/dist/threads/sessions-page-storage.js +8 -8
- package/dist/threads/sessions-page-storage.js.map +1 -1
- package/dist/threads/statewire-thread-list.cjs +173 -20
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +44 -1
- package/dist/threads/statewire-thread-list.js +174 -21
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/use-athena-sessions.cjs +1 -0
- package/dist/threads/use-athena-sessions.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.d.ts +7 -0
- package/dist/threads/use-athena-sessions.js +1 -0
- package/dist/threads/use-athena-sessions.js.map +1 -1
- package/dist/threads/use-athena-thread-agent.cjs +31 -0
- package/dist/threads/use-athena-thread-agent.cjs.map +1 -0
- package/dist/threads/use-athena-thread-agent.d.ts +38 -0
- package/dist/threads/use-athena-thread-agent.js +31 -0
- package/dist/threads/use-athena-thread-agent.js.map +1 -0
- package/dist/threads/use-athena-thread-plan-mode.cjs +18 -0
- package/dist/threads/use-athena-thread-plan-mode.cjs.map +1 -0
- package/dist/threads/use-athena-thread-plan-mode.d.ts +18 -0
- package/dist/threads/use-athena-thread-plan-mode.js +18 -0
- package/dist/threads/use-athena-thread-plan-mode.js.map +1 -0
- package/dist/threads/use-rest-conversation-history.d.ts +1 -0
- package/dist/tools/agent-creations.cjs +97 -0
- package/dist/tools/agent-creations.cjs.map +1 -0
- package/dist/tools/agent-creations.d.ts +38 -0
- package/dist/tools/agent-creations.js +97 -0
- package/dist/tools/agent-creations.js.map +1 -0
- package/dist/tools/agent-highlights.cjs +100 -0
- package/dist/tools/agent-highlights.cjs.map +1 -0
- package/dist/tools/agent-highlights.d.ts +57 -0
- package/dist/tools/agent-highlights.js +100 -0
- package/dist/tools/agent-highlights.js.map +1 -0
- package/dist/tools/append-document-tool-ui.cjs +1 -0
- package/dist/tools/append-document-tool-ui.cjs.map +1 -1
- package/dist/tools/append-document-tool-ui.d.ts +7 -0
- package/dist/tools/append-document-tool-ui.js +2 -1
- package/dist/tools/append-document-tool-ui.js.map +1 -1
- package/dist/tools/auto-open-tools.cjs +144 -71
- package/dist/tools/auto-open-tools.cjs.map +1 -1
- package/dist/tools/auto-open-tools.d.ts +131 -1
- package/dist/tools/auto-open-tools.js +145 -72
- package/dist/tools/auto-open-tools.js.map +1 -1
- package/dist/tools/browser-tool-uis.cjs +594 -0
- package/dist/tools/browser-tool-uis.cjs.map +1 -0
- package/dist/tools/browser-tool-uis.d.ts +8 -0
- package/dist/tools/browser-tool-uis.js +594 -0
- package/dist/tools/browser-tool-uis.js.map +1 -0
- package/dist/tools/computer-asset-tool-uis.cjs +313 -0
- package/dist/tools/computer-asset-tool-uis.cjs.map +1 -0
- package/dist/tools/computer-asset-tool-uis.d.ts +5 -0
- package/dist/tools/computer-asset-tool-uis.js +313 -0
- package/dist/tools/computer-asset-tool-uis.js.map +1 -0
- package/dist/tools/document-edit-tool-uis.cjs +218 -0
- package/dist/tools/document-edit-tool-uis.cjs.map +1 -0
- package/dist/tools/document-edit-tool-uis.d.ts +40 -0
- package/dist/tools/document-edit-tool-uis.js +218 -0
- package/dist/tools/document-edit-tool-uis.js.map +1 -0
- package/dist/tools/drive-tool-uis.cjs +425 -0
- package/dist/tools/drive-tool-uis.cjs.map +1 -0
- package/dist/tools/drive-tool-uis.d.ts +120 -0
- package/dist/tools/drive-tool-uis.js +425 -0
- package/dist/tools/drive-tool-uis.js.map +1 -0
- package/dist/tools/email-calendar-tool-uis.cjs +789 -0
- package/dist/tools/email-calendar-tool-uis.cjs.map +1 -0
- package/dist/tools/email-calendar-tool-uis.d.ts +129 -0
- package/dist/tools/email-calendar-tool-uis.js +789 -0
- package/dist/tools/email-calendar-tool-uis.js.map +1 -0
- package/dist/tools/ontology-tool-uis.cjs +83 -0
- package/dist/tools/ontology-tool-uis.cjs.map +1 -0
- package/dist/tools/ontology-tool-uis.d.ts +9 -0
- package/dist/tools/ontology-tool-uis.js +83 -0
- package/dist/tools/ontology-tool-uis.js.map +1 -0
- package/dist/tools/orchestration-tool-uis.cjs +586 -0
- package/dist/tools/orchestration-tool-uis.cjs.map +1 -0
- package/dist/tools/orchestration-tool-uis.d.ts +141 -0
- package/dist/tools/orchestration-tool-uis.js +586 -0
- package/dist/tools/orchestration-tool-uis.js.map +1 -0
- package/dist/tools/presentation-edit-tool-uis.cjs +516 -0
- package/dist/tools/presentation-edit-tool-uis.cjs.map +1 -0
- package/dist/tools/presentation-edit-tool-uis.d.ts +73 -0
- package/dist/tools/presentation-edit-tool-uis.js +516 -0
- package/dist/tools/presentation-edit-tool-uis.js.map +1 -0
- package/dist/tools/project-tool-uis.cjs +213 -0
- package/dist/tools/project-tool-uis.cjs.map +1 -0
- package/dist/tools/project-tool-uis.d.ts +14 -0
- package/dist/tools/project-tool-uis.js +213 -0
- package/dist/tools/project-tool-uis.js.map +1 -0
- package/dist/tools/sandbox-tool-uis.cjs +491 -0
- package/dist/tools/sandbox-tool-uis.cjs.map +1 -0
- package/dist/tools/sandbox-tool-uis.d.ts +116 -0
- package/dist/tools/sandbox-tool-uis.js +491 -0
- package/dist/tools/sandbox-tool-uis.js.map +1 -0
- package/dist/tools/sheet-query-tool-ui.cjs +138 -0
- package/dist/tools/sheet-query-tool-ui.cjs.map +1 -0
- package/dist/tools/sheet-query-tool-ui.d.ts +15 -0
- package/dist/tools/sheet-query-tool-ui.js +138 -0
- package/dist/tools/sheet-query-tool-ui.js.map +1 -0
- package/dist/tools/studio-screenshot-tool-uis.cjs +262 -0
- package/dist/tools/studio-screenshot-tool-uis.cjs.map +1 -0
- package/dist/tools/studio-screenshot-tool-uis.d.ts +52 -0
- package/dist/tools/studio-screenshot-tool-uis.js +262 -0
- package/dist/tools/studio-screenshot-tool-uis.js.map +1 -0
- package/dist/tools/subagent-task-tool-ui.cjs +24 -475
- package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
- package/dist/tools/subagent-task-tool-ui.d.ts +19 -103
- package/dist/tools/subagent-task-tool-ui.js +28 -479
- package/dist/tools/subagent-task-tool-ui.js.map +1 -1
- package/dist/tools/tool-summary.cjs +36 -0
- package/dist/tools/tool-summary.cjs.map +1 -1
- package/dist/tools/tool-summary.js +36 -0
- package/dist/tools/tool-summary.js.map +1 -1
- package/dist/tools/tool-uis.cjs +181 -53
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/tool-uis.d.ts +40 -0
- package/dist/tools/tool-uis.js +183 -55
- package/dist/tools/tool-uis.js.map +1 -1
- package/dist/typed-interrupts/index.cjs +15 -0
- package/dist/typed-interrupts/index.cjs.map +1 -0
- package/dist/typed-interrupts/index.d.ts +20 -0
- package/dist/typed-interrupts/index.js +15 -0
- package/dist/typed-interrupts/index.js.map +1 -0
- package/dist/workbench/session-workbench-panes.cjs +6 -6
- package/dist/workbench/session-workbench-panes.cjs.map +1 -1
- package/package.json +28 -6
- package/dist/agent-runtime/src/chat-outbox-store.cjs +0 -510
- package/dist/agent-runtime/src/chat-outbox-store.cjs.map +0 -1
- package/dist/agent-runtime/src/chat-outbox-store.d.ts +0 -210
- package/dist/agent-runtime/src/chat-outbox-store.js +0 -510
- package/dist/agent-runtime/src/chat-outbox-store.js.map +0 -1
|
@@ -42,9 +42,14 @@ const LEGACY_ANCHOR_TYPES = {
|
|
|
42
42
|
function isAnchorType(value) {
|
|
43
43
|
return typeof value === "string" && Object.values(AnchorType).includes(value);
|
|
44
44
|
}
|
|
45
|
+
function isAnchor(value) {
|
|
46
|
+
if (typeof value !== "object" || value === null) return false;
|
|
47
|
+
return isAnchorType(value.type);
|
|
48
|
+
}
|
|
45
49
|
export {
|
|
46
50
|
AnchorType,
|
|
47
51
|
LEGACY_ANCHOR_TYPES,
|
|
52
|
+
isAnchor,
|
|
48
53
|
isAnchorType
|
|
49
54
|
};
|
|
50
55
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../../references/src/anchors/types.ts"],"sourcesContent":["/**\n * Anchor types — Level 2 of the reference system.\n *\n * Each anchor describes a specific location within an asset.\n * Discriminated union on `type`. Ordered alphabetically.\n *\n * Property names use camelCase; the `type` discriminator string stays snake_case\n * (it's a version identifier, not a property name).\n */\n\n// ---------------------------------------------------------------------------\n// Individual anchor types (alphabetical by `type` discriminator)\n// ---------------------------------------------------------------------------\n\nexport type CellAnchor = { type: 'cell'; cellId: string };\nexport type CellRangeAnchor = {\n type: 'cell_range';\n startCellId: string;\n endCellId: string;\n};\nexport type CommentAnchor = {\n type: 'comment';\n threadId: string;\n commentId: string;\n};\nexport type CommentThreadAnchor = { type: 'comment_thread'; threadId: string };\n/**\n * An inclusive, 1-based line range of one file of a repository source — a\n * GitHub `catalog` asset whose files Clio indexes\n * (`docs/clio/21-repository-source.md`). `path` is the repo-relative,\n * `/`-separated file path: structure, not content. Distinct from the\n * path-less `line_range` so a reader that does not know the kind fails closed\n * instead of dropping the file. Bounds, path grammar and the byte cap are\n * shared with Clio's `LineRangeLocator` (`./file-line-range.ts`).\n *\n * Wire form (canonical — parameters sorted, as Clio writes it):\n * `anchor=file_line_range&end_line=<m>&path=<path>&start_line=<n>`.\n */\nexport type FileLineRangeAnchor = {\n type: 'file_line_range';\n path: string;\n startLine: number;\n endLine: number;\n};\nexport type LineAnchor = { type: 'line'; line: number };\nexport type LineRangeAnchor = {\n type: 'line_range';\n startLine: number;\n endLine: number;\n};\n/**\n * A single chat message in a session transcript.\n *\n * `messageId` is the **Athena message tracking id** — the same uuid4 that\n * appears as `user_message_tracking_id` / `ai_message_tracking_id` in Keryx\n * activity attributions (built by `build_agent_attributions`,\n * agora/services/keryx/client.py), as `trackingId` on session Y.Doc\n * liveMessages, as the `data-message-tracking-id` DOM attribute, and as the\n * existing `scroll_to_message` URL param in Olympus. It is NOT the LangChain\n * checkpoint `message.id`.\n *\n * Wire form: `anchor=msg&msg_id=…` (the pre-rename spellings\n * `anchor=message&message_id=…` are still parsed).\n */\nexport type MessageAnchor = { type: 'msg'; messageId: string };\n/**\n * Inclusive span of session messages in transcript order. Both ids are\n * Athena message tracking ids (see `MessageAnchor`).\n */\nexport type MessageRangeAnchor = {\n type: 'msg_range';\n startMessageId: string;\n endMessageId: string;\n};\n/**\n * One top-level block (paragraph, heading, list, table, code fence, …) of a\n * session message's markdown body. `messageId` is the Athena message tracking\n * id (see `MessageAnchor`); `block` is the 1-based position among the\n * message's top-level blocks. `hash` is an optional short fingerprint of the\n * block's normalized text (see `messageBlockHash`) so consumers can detect\n * that the block at that position no longer holds the linked content.\n *\n * URL params: `msg_id`, `block`, `hash`.\n */\nexport type MessageBlockAnchor = {\n type: 'msg_block';\n messageId: string;\n block: number;\n hash?: string;\n};\n/**\n * A heading-delimited section of a session message: the heading whose slug\n * (see `messageHeadingSlug`) equals `heading`, through the block before the\n * next heading of the same or a higher level. `nth` (1-based) disambiguates\n * repeated headings; absent ⇒ first.\n *\n * URL params: `msg_id`, `heading`, `nth`.\n */\nexport type MessageSectionAnchor = {\n type: 'msg_section';\n messageId: string;\n heading: string;\n nth?: number;\n};\n/**\n * An exact text span inside a session message. `text` is the quoted excerpt,\n * matched against the message's whitespace-normalized plain text (see\n * `normalizeMessageText`). Optional `block` narrows the search to one\n * top-level block (1-based); optional `prefix` / `suffix` are the normalized\n * text immediately before / after the span, used to pick between repeated\n * occurrences. Consumers fall back to the block, then the whole message, when\n * the span can't be found.\n *\n * URL params: `msg_id`, `text`, `block`, `prefix`, `suffix`.\n */\nexport type MessageTextAnchor = {\n type: 'msg_text';\n messageId: string;\n text: string;\n block?: number;\n prefix?: string;\n suffix?: string;\n};\nexport type PageAnchor = { type: 'page'; page: number };\n/**\n * A file path inside an asset, optionally narrowed to a 1-based source\n * location. `column` is only meaningful when `line` is present.\n */\nexport type PathAnchor = {\n type: 'path';\n path: string;\n line?: number;\n column?: number;\n};\nexport type PageRangeAnchor = {\n type: 'page_range';\n startPage: number;\n endPage: number;\n};\n/** Coordinate unit for a `page_rect` anchor. Absent ⇒ `percent`. */\nexport const PageRectUnit = {\n /** Percentages of the page dimensions (0-100). Resolution-independent. */\n Percent: 'percent',\n /**\n * PDF points (1/72\"), the unit of the legacy `bbox_left/bbox_top/...`\n * citation-URL params and of PDF viewer page coordinates.\n */\n Point: 'point',\n} as const;\n\nexport type PageRectUnit = (typeof PageRectUnit)[keyof typeof PageRectUnit];\n\n/**\n * Rectangular region on a specific page. `x`/`y`/`width`/`height` are in\n * `unit` coordinates — percentages of the page dimensions (0-100) when\n * `unit` is absent or `percent`, PDF points when `unit` is `point`.\n */\nexport type PageRectAnchor = {\n type: 'page_rect';\n page: number;\n x: number;\n y: number;\n width: number;\n height: number;\n unit?: PageRectUnit;\n};\n/**\n * A quoted text span on a specific page. `text` is the selected excerpt,\n * re-located by text search when the anchor is resolved. Optional `prefix` /\n * `suffix` are the normalized text immediately before / after the span, used\n * to pick between repeated occurrences of `text` on the page (the same\n * contract as `MessageTextAnchor`). Optional `hash` is a short fingerprint of\n * the cited unit's normalized text (the `MessageBlockAnchor` pattern:\n * `messageBlockHash`, 32-bit FNV-1a as 8 hex chars) so a consumer can tell a\n * stale citation from a live one and fall back to text search. The anchor\n * never stores geometry; rectangles are derived when it is resolved.\n *\n * URL params: `page`, `text`, `prefix`, `suffix`, `hash`.\n */\nexport type PageTextAnchor = {\n type: 'page_text';\n page: number;\n text: string;\n prefix?: string;\n suffix?: string;\n hash?: string;\n};\nexport type PmNodeAnchor = { type: 'pm_node'; nodeId: string };\nexport type PmNodeRangeAnchor = {\n type: 'pm_node_range';\n startNodeId: string;\n endNodeId: string;\n};\n/** Pixel-based region anchor for images. Coordinates relative to natural image dimensions. */\nexport type PixelRangeAnchor = {\n type: 'pixel_range';\n x: number;\n y: number;\n width: number;\n height: number;\n};\n/** ProseMirror mark pointer; composite `markType:instanceId` (e.g. CommentsKit `thread` + thread id). */\nexport type PmMarkAnchor = { type: 'pm_mark'; markId: string };\n/** Percentage-based region (0-100). Resolution-independent. */\nexport type RectAnchor = {\n type: 'rect';\n x: number;\n y: number;\n width: number;\n height: number;\n};\n/**\n * Named slice of an asset's persisted metadata (e.g. a computer asset's `status` / `ports`\n * section), or a section of a recording's generated notes (`decisions`, `action_items`,\n * `open_questions`, `notes`). `topic` is the 1-based `### topic` under a recording's Notes\n * (`section=notes&topic=2`), as Clio's notes hits name it; absent for every other section.\n */\nexport type SectionAnchor = { type: 'section'; section: string; topic?: number };\n/**\n * How a cited value relates to a generative (query) anchor's result.\n *\n * Absent ⇒ consumers MUST treat it as `supporting`. The (de)serializer never\n * defaults it, so round-trips stay exact.\n */\nexport const QueryResultRelationship = {\n /** The cell value IS (a cell of) the query result — a 1:1 extraction. */\n Exact: 'exact',\n /**\n * The cell value is authored (e.g. a narrative claim); the query result is\n * supporting evidence / justification, not the value itself. Re-running the\n * query is read-only verification and never replaces the cell value.\n */\n Supporting: 'supporting',\n} as const;\n\nexport type QueryResultRelationship =\n (typeof QueryResultRelationship)[keyof typeof QueryResultRelationship];\n\n/**\n * Generative anchor — a value derived from a semantic-model (Cube.js) query.\n *\n * Unlike positional anchors (page/cell/line), the \"location\" is the\n * transformation itself: the full Cube.js query spec that was run. Re-running\n * it is read-only verification; it never overwrites the cited value.\n */\nexport type SemanticQueryAnchor = {\n type: 'semantic_query';\n /** The full Cube.js query spec that produced the result (the codified transformation). */\n query: Record<string, unknown>;\n /** Cited measure/dimension id, e.g. `orders.total_revenue`. Omit ⇒ the whole result is the evidence. */\n field?: string;\n /** Dimension/key values identifying the cited row. Robust to re-ordering, unlike `rowIndex`. */\n rowKey?: Record<string, string>;\n /** Positional fallback row selector. */\n rowIndex?: number;\n /** Whether the cell value equals the result (`exact`) or is authored evidence (`supporting`). */\n relationship?: QueryResultRelationship;\n /** Provenance: semantic-model schema version at run time. */\n schemaVersion?: number;\n /** Provenance: sha256 of the deployed YAML at run time, for drift detection. */\n schemaHash?: string;\n /**\n * Provenance for lakehouse-backed models: each source table's Iceberg identity\n * and snapshot when the value was computed (`\"<namespace>.<table>\"` →\n * `\"<table_uuid>:<snapshot_id>\"`, the snapshot empty for a table never written).\n * Compared with the live tables by the freshness check.\n */\n sourceSnapshots?: Record<string, string>;\n /** Provenance: the result's \"data as of\" instant (ISO-8601 UTC) at capture. */\n dataAsOf?: string;\n};\n/**\n * One or more shapes on a presentation slide. `shapeIds` are stable Yjs\n * ElementIds (the SDK's `shape.shape_id`) and resolve the anchor on their\n * own; `slideId` / `slideIndex` (1-based) are optional refinements.\n */\nexport type ShapeAnchor = {\n type: 'shape';\n slideId?: string;\n slideIndex?: number;\n shapeIds: string[];\n};\n/**\n * A single cell. `chartId` (`chart=`) names the chart anchored at the cell\n * when the place is that chart, not the cell's value: a chart sits right of\n * and below its anchor cell, so a reader reveals it from that corner.\n */\nexport type SheetCellAnchor = {\n type: 'sheet_cell';\n sheetId: number;\n cell: string;\n chartId?: string;\n};\nexport type SheetRangeAnchor = {\n type: 'sheet_range';\n sheetId: number;\n range: string;\n /**\n * The spreadsheet engine's shift-log frontier (writer id → seq, `RncEngine.shiftLogFrontier`) the\n * moment `range` was taken, so a reader with the live engine can resolve the range to its current\n * coordinates after rows/columns were inserted or deleted since (`RncEngine.transformRange`).\n * Absent on an anchor taken without an engine, which resolves to `range` as stored.\n */\n frontier?: Record<string, number>;\n};\n/** A whole worksheet / sheet tab in a spreadsheet. */\nexport type SheetTabAnchor = {\n type: 'sheet_tab';\n sheetId: number;\n};\n/**\n * A named Excel table (ListObject) within a worksheet. Stable identity:\n * the table's name survives sorts, inserts, and row additions that would\n * break a raw `sheet_range`. Use this anchor in preference to\n * `sheet_range` whenever the user is binding to a structured table.\n *\n * `fallbackRange` is an optional A1-style range used by resolvers when\n * the table has been deleted or renamed — best-effort recovery.\n */\nexport type SheetTableAnchor = {\n type: 'sheet_table';\n sheetId: number;\n tableName: string;\n fallbackRange?: string;\n};\n/**\n * One table of an Orion lakehouse namespace, addressed on the namespace asset\n * (tables have no asset rows). `table` is the name within the namespace;\n * `tableUuid` is the Iceberg table UUID, the stable identity that detects a\n * drop-and-recreate or rename; `snapshotId` pins a read to one Iceberg\n * snapshot (an unsupported pinned read is rejected, never served from current\n * data).\n */\nexport type LakehouseTableAnchor = {\n type: 'lakehouse_table';\n table: string;\n tableUuid?: string;\n snapshotId?: string;\n};\n/**\n * A whole slide of a PPTX deck. `slideId` is the stable Yjs SlideId (the\n * SDK's `slide.slide_id`); `slideIndex` is the 1-based display position.\n * At least one must be present; producers should emit both when known.\n */\nexport type SlideAnchor = {\n type: 'slide';\n slideId?: string;\n slideIndex?: number;\n};\n/**\n * Generative anchor — a value derived from a SQL query.\n *\n * The transformation is the SQL text, carried inline or (preferred) as a\n * governed, re-runnable `query_snippet` asset. Re-running it is read-only\n * verification; it never overwrites the cited value.\n */\nexport type SqlQueryAnchor = {\n type: 'sql_query';\n /** The SQL that produced the result. Optional when `querySnippetAssetId` is set. */\n sql?: string;\n /** A re-runnable `query_snippet` asset that holds the SQL (preferred over inline `sql`). */\n querySnippetAssetId?: string;\n /** SQL dialect, e.g. `postgres`, `snowflake`. */\n dialect?: string;\n /** Cited result column name. Omit ⇒ the whole result is the evidence. */\n field?: string;\n /** Identifying column values for the cited row. Robust to re-ordering, unlike `rowIndex`. */\n rowKey?: Record<string, string>;\n /** Positional fallback row selector. */\n rowIndex?: number;\n /** Whether the cell value equals the result (`exact`) or is authored evidence (`supporting`). */\n relationship?: QueryResultRelationship;\n};\n/** Time string in \"H:MM:SS\" / \"MM:SS\" / \"M:SS\" format. No plain seconds. */\nexport type TimeAnchor = { type: 'time'; time: string };\nexport type TimeRangeAnchor = {\n type: 'time_range';\n startTime: string;\n endTime: string;\n};\n/**\n * A tool invocation in a session transcript. `toolCallId` is the\n * LangChain-native tool call id (the key used by session Y.Doc\n * liveToolCalls), NOT an Athena message tracking id. `messageId` is the\n * tracking id of the assistant message that issued the call, when the\n * producer knows it (Keryx activity carries both as `tool_call_id` and\n * `ai_message_tracking_id`); it lets a consumer still land on the owning\n * message when the call itself is not in view (e.g. an abandoned branch).\n */\nexport type ToolCallAnchor = { type: 'tool_call'; toolCallId: string; messageId?: string };\n\n// ---------------------------------------------------------------------------\n// Union\n// ---------------------------------------------------------------------------\n\nexport type Anchor =\n | CellAnchor\n | CellRangeAnchor\n | CommentAnchor\n | CommentThreadAnchor\n | FileLineRangeAnchor\n | LineAnchor\n | LineRangeAnchor\n | MessageAnchor\n | MessageRangeAnchor\n | MessageBlockAnchor\n | MessageSectionAnchor\n | MessageTextAnchor\n | PageAnchor\n | PageRangeAnchor\n | PathAnchor\n | PageRectAnchor\n | PageTextAnchor\n | PixelRangeAnchor\n | PmNodeAnchor\n | PmNodeRangeAnchor\n | PmMarkAnchor\n | RectAnchor\n | SectionAnchor\n | SemanticQueryAnchor\n | ShapeAnchor\n | SheetCellAnchor\n | SheetRangeAnchor\n | SheetTabAnchor\n | SheetTableAnchor\n | LakehouseTableAnchor\n | SlideAnchor\n | SqlQueryAnchor\n | TimeAnchor\n | TimeRangeAnchor\n | ToolCallAnchor;\n\n// ---------------------------------------------------------------------------\n// AnchorType — string literal union of all `type` discriminators\n// ---------------------------------------------------------------------------\n\nexport type AnchorType = Anchor['type'];\n\nexport const AnchorType = {\n Cell: 'cell',\n CellRange: 'cell_range',\n Comment: 'comment',\n CommentThread: 'comment_thread',\n FileLineRange: 'file_line_range',\n Line: 'line',\n LineRange: 'line_range',\n Message: 'msg',\n MessageRange: 'msg_range',\n MessageBlock: 'msg_block',\n MessageSection: 'msg_section',\n MessageText: 'msg_text',\n Page: 'page',\n PageRange: 'page_range',\n Path: 'path',\n PageRect: 'page_rect',\n PageText: 'page_text',\n PixelRange: 'pixel_range',\n PmMark: 'pm_mark',\n PmNode: 'pm_node',\n PmNodeRange: 'pm_node_range',\n Rect: 'rect',\n Section: 'section',\n SemanticQuery: 'semantic_query',\n Shape: 'shape',\n SheetCell: 'sheet_cell',\n SheetRange: 'sheet_range',\n SheetTab: 'sheet_tab',\n SheetTable: 'sheet_table',\n LakehouseTable: 'lakehouse_table',\n Slide: 'slide',\n SqlQuery: 'sql_query',\n Time: 'time',\n TimeRange: 'time_range',\n ToolCall: 'tool_call',\n} as const satisfies Record<string, AnchorType>;\n\n// ---------------------------------------------------------------------------\n// Type guards\n// ---------------------------------------------------------------------------\n\n/**\n * Pre-rename session anchor spellings that are still accepted on input so\n * links shared before the `msg*` rename keep resolving. Output always uses\n * the current names (see `serialize.ts`).\n */\nexport const LEGACY_ANCHOR_TYPES: Readonly<Record<string, AnchorType>> = {\n message: 'msg',\n message_range: 'msg_range',\n};\n\nexport function isAnchorType(value: unknown): value is AnchorType {\n return typeof value === 'string' && Object.values(AnchorType).includes(value as AnchorType);\n}\n\n/**\n * Quick check: validates only the `type` discriminator string.\n * For full structural validation, use `parseAnchor` from `./schemas`.\n */\nexport function isAnchor(value: unknown): value is Anchor {\n if (typeof value !== 'object' || value === null) return false;\n return isAnchorType((value as Record<string, unknown>).type);\n}\n\n// ---------------------------------------------------------------------------\n// Runtime-only types (not stored, produced by accessors)\n// ---------------------------------------------------------------------------\n\n/** Runtime form of TimeAnchor with pre-computed seconds. */\nexport type TimeAnchorSeconds = { type: 'time_seconds'; timeSeconds: number };\n/** Runtime form of TimeRangeAnchor with pre-computed seconds. */\nexport type TimeRangeAnchorSeconds = {\n type: 'time_range_seconds';\n startTimeSeconds: number;\n endTimeSeconds: number;\n};\n"],"names":[],"mappings":"AAsbO,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AAAA,EACT,eAAe;AAAA,EACf,eAAe;AAAA,EACf,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AAAA,EACT,cAAc;AAAA,EACd,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,MAAM;AAAA,EACN,WAAW;AAAA,EACX,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,MAAM;AAAA,EACN,SAAS;AAAA,EACT,eAAe;AAAA,EACf,OAAO;AAAA,EACP,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA,EACN,WAAW;AAAA,EACX,UAAU;AACZ;AAWO,MAAM,sBAA4D;AAAA,EACvE,SAAS;AAAA,EACT,eAAe;AACjB;AAEO,SAAS,aAAa,OAAqC;AAChE,SAAO,OAAO,UAAU,YAAY,OAAO,OAAO,UAAU,EAAE,SAAS,KAAmB;AAC5F;"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../../references/src/anchors/types.ts"],"sourcesContent":["/**\n * Anchor types — Level 2 of the reference system.\n *\n * Each anchor describes a specific location within an asset.\n * Discriminated union on `type`. Ordered alphabetically.\n *\n * Property names use camelCase; the `type` discriminator string stays snake_case\n * (it's a version identifier, not a property name).\n */\n\n// ---------------------------------------------------------------------------\n// Individual anchor types (alphabetical by `type` discriminator)\n// ---------------------------------------------------------------------------\n\nexport type CellAnchor = { type: 'cell'; cellId: string };\nexport type CellRangeAnchor = {\n type: 'cell_range';\n startCellId: string;\n endCellId: string;\n};\nexport type CommentAnchor = {\n type: 'comment';\n threadId: string;\n commentId: string;\n};\nexport type CommentThreadAnchor = { type: 'comment_thread'; threadId: string };\n/**\n * An inclusive, 1-based line range of one file of a repository source — a\n * GitHub `catalog` asset whose files Clio indexes\n * (`docs/clio/21-repository-source.md`). `path` is the repo-relative,\n * `/`-separated file path: structure, not content. Distinct from the\n * path-less `line_range` so a reader that does not know the kind fails closed\n * instead of dropping the file. Bounds, path grammar and the byte cap are\n * shared with Clio's `LineRangeLocator` (`./file-line-range.ts`).\n *\n * Wire form (canonical — parameters sorted, as Clio writes it):\n * `anchor=file_line_range&end_line=<m>&path=<path>&start_line=<n>`.\n */\nexport type FileLineRangeAnchor = {\n type: 'file_line_range';\n path: string;\n startLine: number;\n endLine: number;\n};\nexport type LineAnchor = { type: 'line'; line: number };\nexport type LineRangeAnchor = {\n type: 'line_range';\n startLine: number;\n endLine: number;\n};\n/**\n * A single chat message in a session transcript.\n *\n * `messageId` is the **Athena message tracking id** — the same uuid4 that\n * appears as `user_message_tracking_id` / `ai_message_tracking_id` in Keryx\n * activity attributions (built by `build_agent_attributions`,\n * agora/services/keryx/client.py), as `trackingId` on session Y.Doc\n * liveMessages, as the `data-message-tracking-id` DOM attribute, and as the\n * existing `scroll_to_message` URL param in Olympus. It is NOT the LangChain\n * checkpoint `message.id`.\n *\n * Wire form: `anchor=msg&msg_id=…` (the pre-rename spellings\n * `anchor=message&message_id=…` are still parsed).\n */\nexport type MessageAnchor = { type: 'msg'; messageId: string };\n/**\n * Inclusive span of session messages in transcript order. Both ids are\n * Athena message tracking ids (see `MessageAnchor`).\n */\nexport type MessageRangeAnchor = {\n type: 'msg_range';\n startMessageId: string;\n endMessageId: string;\n};\n/**\n * One top-level block (paragraph, heading, list, table, code fence, …) of a\n * session message's markdown body. `messageId` is the Athena message tracking\n * id (see `MessageAnchor`); `block` is the 1-based position among the\n * message's top-level blocks. `hash` is an optional short fingerprint of the\n * block's normalized text (see `messageBlockHash`) so consumers can detect\n * that the block at that position no longer holds the linked content.\n *\n * URL params: `msg_id`, `block`, `hash`.\n */\nexport type MessageBlockAnchor = {\n type: 'msg_block';\n messageId: string;\n block: number;\n hash?: string;\n};\n/**\n * A heading-delimited section of a session message: the heading whose slug\n * (see `messageHeadingSlug`) equals `heading`, through the block before the\n * next heading of the same or a higher level. `nth` (1-based) disambiguates\n * repeated headings; absent ⇒ first.\n *\n * URL params: `msg_id`, `heading`, `nth`.\n */\nexport type MessageSectionAnchor = {\n type: 'msg_section';\n messageId: string;\n heading: string;\n nth?: number;\n};\n/**\n * An exact text span inside a session message. `text` is the quoted excerpt,\n * matched against the message's whitespace-normalized plain text (see\n * `normalizeMessageText`). Optional `block` narrows the search to one\n * top-level block (1-based); optional `prefix` / `suffix` are the normalized\n * text immediately before / after the span, used to pick between repeated\n * occurrences. Consumers fall back to the block, then the whole message, when\n * the span can't be found.\n *\n * URL params: `msg_id`, `text`, `block`, `prefix`, `suffix`.\n */\nexport type MessageTextAnchor = {\n type: 'msg_text';\n messageId: string;\n text: string;\n block?: number;\n prefix?: string;\n suffix?: string;\n};\nexport type PageAnchor = { type: 'page'; page: number };\n/**\n * A file path inside an asset, optionally narrowed to a 1-based source\n * location. `column` is only meaningful when `line` is present.\n */\nexport type PathAnchor = {\n type: 'path';\n path: string;\n line?: number;\n column?: number;\n};\nexport type PageRangeAnchor = {\n type: 'page_range';\n startPage: number;\n endPage: number;\n};\n/** Coordinate unit for a `page_rect` anchor. Absent ⇒ `percent`. */\nexport const PageRectUnit = {\n /** Percentages of the page dimensions (0-100). Resolution-independent. */\n Percent: 'percent',\n /**\n * PDF points (1/72\"), the unit of the legacy `bbox_left/bbox_top/...`\n * citation-URL params and of PDF viewer page coordinates.\n */\n Point: 'point',\n} as const;\n\nexport type PageRectUnit = (typeof PageRectUnit)[keyof typeof PageRectUnit];\n\n/**\n * Rectangular region on a specific page. `x`/`y`/`width`/`height` are in\n * `unit` coordinates — percentages of the page dimensions (0-100) when\n * `unit` is absent or `percent`, PDF points when `unit` is `point`.\n */\nexport type PageRectAnchor = {\n type: 'page_rect';\n page: number;\n x: number;\n y: number;\n width: number;\n height: number;\n unit?: PageRectUnit;\n};\n/**\n * A quoted text span on a specific page. `text` is the selected excerpt,\n * re-located by text search when the anchor is resolved. Optional `prefix` /\n * `suffix` are the normalized text immediately before / after the span, used\n * to pick between repeated occurrences of `text` on the page (the same\n * contract as `MessageTextAnchor`). Optional `hash` is a short fingerprint of\n * the cited unit's normalized text (the `MessageBlockAnchor` pattern:\n * `messageBlockHash`, 32-bit FNV-1a as 8 hex chars) so a consumer can tell a\n * stale citation from a live one and fall back to text search. The anchor\n * never stores geometry; rectangles are derived when it is resolved.\n *\n * URL params: `page`, `text`, `prefix`, `suffix`, `hash`.\n */\nexport type PageTextAnchor = {\n type: 'page_text';\n page: number;\n text: string;\n prefix?: string;\n suffix?: string;\n hash?: string;\n};\nexport type PmNodeAnchor = { type: 'pm_node'; nodeId: string };\nexport type PmNodeRangeAnchor = {\n type: 'pm_node_range';\n startNodeId: string;\n endNodeId: string;\n};\n/** Pixel-based region anchor for images. Coordinates relative to natural image dimensions. */\nexport type PixelRangeAnchor = {\n type: 'pixel_range';\n x: number;\n y: number;\n width: number;\n height: number;\n};\n/** ProseMirror mark pointer; composite `markType:instanceId` (e.g. CommentsKit `thread` + thread id). */\nexport type PmMarkAnchor = { type: 'pm_mark'; markId: string };\n/** Percentage-based region (0-100). Resolution-independent. */\nexport type RectAnchor = {\n type: 'rect';\n x: number;\n y: number;\n width: number;\n height: number;\n};\n/**\n * Named slice of an asset's persisted metadata (e.g. a computer asset's `status` / `ports`\n * section), or a section of a recording's generated notes (`decisions`, `action_items`,\n * `open_questions`, `notes`). `topic` is the 1-based `### topic` under a recording's Notes\n * (`section=notes&topic=2`), as Clio's notes hits name it; absent for every other section.\n */\nexport type SectionAnchor = { type: 'section'; section: string; topic?: number };\n/**\n * How a cited value relates to a generative (query) anchor's result.\n *\n * Absent ⇒ consumers MUST treat it as `supporting`. The (de)serializer never\n * defaults it, so round-trips stay exact.\n */\nexport const QueryResultRelationship = {\n /** The cell value IS (a cell of) the query result — a 1:1 extraction. */\n Exact: 'exact',\n /**\n * The cell value is authored (e.g. a narrative claim); the query result is\n * supporting evidence / justification, not the value itself. Re-running the\n * query is read-only verification and never replaces the cell value.\n */\n Supporting: 'supporting',\n} as const;\n\nexport type QueryResultRelationship =\n (typeof QueryResultRelationship)[keyof typeof QueryResultRelationship];\n\n/**\n * Generative anchor — a value derived from a semantic-model (Cube.js) query.\n *\n * Unlike positional anchors (page/cell/line), the \"location\" is the\n * transformation itself: the full Cube.js query spec that was run. Re-running\n * it is read-only verification; it never overwrites the cited value.\n */\nexport type SemanticQueryAnchor = {\n type: 'semantic_query';\n /** The full Cube.js query spec that produced the result (the codified transformation). */\n query: Record<string, unknown>;\n /** Cited measure/dimension id, e.g. `orders.total_revenue`. Omit ⇒ the whole result is the evidence. */\n field?: string;\n /** Dimension/key values identifying the cited row. Robust to re-ordering, unlike `rowIndex`. */\n rowKey?: Record<string, string>;\n /** Positional fallback row selector. */\n rowIndex?: number;\n /** Whether the cell value equals the result (`exact`) or is authored evidence (`supporting`). */\n relationship?: QueryResultRelationship;\n /** Provenance: semantic-model schema version at run time. */\n schemaVersion?: number;\n /** Provenance: sha256 of the deployed YAML at run time, for drift detection. */\n schemaHash?: string;\n /**\n * Provenance for lakehouse-backed models: each source table's Iceberg identity\n * and snapshot when the value was computed (`\"<namespace>.<table>\"` →\n * `\"<table_uuid>:<snapshot_id>\"`, the snapshot empty for a table never written).\n * Compared with the live tables by the freshness check.\n */\n sourceSnapshots?: Record<string, string>;\n /** Provenance: the result's \"data as of\" instant (ISO-8601 UTC) at capture. */\n dataAsOf?: string;\n};\n/**\n * One or more shapes on a presentation slide. `shapeIds` are stable Yjs\n * ElementIds (the SDK's `shape.shape_id`) and resolve the anchor on their\n * own; `slideId` / `slideIndex` (1-based) are optional refinements.\n */\nexport type ShapeAnchor = {\n type: 'shape';\n slideId?: string;\n slideIndex?: number;\n shapeIds: string[];\n};\n/**\n * A single cell. `chartId` (`chart=`) names the chart anchored at the cell\n * when the place is that chart, not the cell's value: a chart sits right of\n * and below its anchor cell, so a reader reveals it from that corner.\n */\nexport type SheetCellAnchor = {\n type: 'sheet_cell';\n sheetId: number;\n cell: string;\n chartId?: string;\n};\nexport type SheetRangeAnchor = {\n type: 'sheet_range';\n sheetId: number;\n range: string;\n /**\n * The spreadsheet engine's shift-log frontier (writer id → seq, `RncEngine.shiftLogFrontier`) the\n * moment `range` was taken, so a reader with the live engine can resolve the range to its current\n * coordinates after rows/columns were inserted or deleted since (`RncEngine.transformRange`).\n * Absent on an anchor taken without an engine, which resolves to `range` as stored.\n */\n frontier?: Record<string, number>;\n};\n/** A whole worksheet / sheet tab in a spreadsheet. */\nexport type SheetTabAnchor = {\n type: 'sheet_tab';\n sheetId: number;\n};\n/**\n * A named Excel table (ListObject) within a worksheet. Stable identity:\n * the table's name survives sorts, inserts, and row additions that would\n * break a raw `sheet_range`. Use this anchor in preference to\n * `sheet_range` whenever the user is binding to a structured table.\n *\n * `fallbackRange` is an optional A1-style range used by resolvers when\n * the table has been deleted or renamed — best-effort recovery.\n */\nexport type SheetTableAnchor = {\n type: 'sheet_table';\n sheetId: number;\n tableName: string;\n fallbackRange?: string;\n};\n/**\n * One table of an Orion lakehouse namespace, addressed on the namespace asset\n * (tables have no asset rows). `table` is the name within the namespace;\n * `tableUuid` is the Iceberg table UUID, the stable identity that detects a\n * drop-and-recreate or rename; `snapshotId` pins a read to one Iceberg\n * snapshot (an unsupported pinned read is rejected, never served from current\n * data).\n */\nexport type LakehouseTableAnchor = {\n type: 'lakehouse_table';\n table: string;\n tableUuid?: string;\n snapshotId?: string;\n};\n/**\n * A whole slide of a PPTX deck. `slideId` is the stable Yjs SlideId (the\n * SDK's `slide.slide_id`); `slideIndex` is the 1-based display position.\n * At least one must be present; producers should emit both when known.\n */\nexport type SlideAnchor = {\n type: 'slide';\n slideId?: string;\n slideIndex?: number;\n};\n/**\n * Generative anchor — a value derived from a SQL query.\n *\n * The transformation is the SQL text, carried inline or (preferred) as a\n * governed, re-runnable `query_snippet` asset. Re-running it is read-only\n * verification; it never overwrites the cited value.\n */\nexport type SqlQueryAnchor = {\n type: 'sql_query';\n /** The SQL that produced the result. Optional when `querySnippetAssetId` is set. */\n sql?: string;\n /** A re-runnable `query_snippet` asset that holds the SQL (preferred over inline `sql`). */\n querySnippetAssetId?: string;\n /** SQL dialect, e.g. `postgres`, `snowflake`. */\n dialect?: string;\n /** Cited result column name. Omit ⇒ the whole result is the evidence. */\n field?: string;\n /** Identifying column values for the cited row. Robust to re-ordering, unlike `rowIndex`. */\n rowKey?: Record<string, string>;\n /** Positional fallback row selector. */\n rowIndex?: number;\n /** Whether the cell value equals the result (`exact`) or is authored evidence (`supporting`). */\n relationship?: QueryResultRelationship;\n};\n/** Time string in \"H:MM:SS\" / \"MM:SS\" / \"M:SS\" format. No plain seconds. */\nexport type TimeAnchor = { type: 'time'; time: string };\nexport type TimeRangeAnchor = {\n type: 'time_range';\n startTime: string;\n endTime: string;\n};\n/**\n * A tool invocation in a session transcript. `toolCallId` is the\n * LangChain-native tool call id (the key used by session Y.Doc\n * liveToolCalls), NOT an Athena message tracking id. `messageId` is the\n * tracking id of the assistant message that issued the call, when the\n * producer knows it (Keryx activity carries both as `tool_call_id` and\n * `ai_message_tracking_id`); it lets a consumer still land on the owning\n * message when the call itself is not in view (e.g. an abandoned branch).\n */\nexport type ToolCallAnchor = { type: 'tool_call'; toolCallId: string; messageId?: string };\n\n// ---------------------------------------------------------------------------\n// Union\n// ---------------------------------------------------------------------------\n\nexport type Anchor =\n | CellAnchor\n | CellRangeAnchor\n | CommentAnchor\n | CommentThreadAnchor\n | FileLineRangeAnchor\n | LineAnchor\n | LineRangeAnchor\n | MessageAnchor\n | MessageRangeAnchor\n | MessageBlockAnchor\n | MessageSectionAnchor\n | MessageTextAnchor\n | PageAnchor\n | PageRangeAnchor\n | PathAnchor\n | PageRectAnchor\n | PageTextAnchor\n | PixelRangeAnchor\n | PmNodeAnchor\n | PmNodeRangeAnchor\n | PmMarkAnchor\n | RectAnchor\n | SectionAnchor\n | SemanticQueryAnchor\n | ShapeAnchor\n | SheetCellAnchor\n | SheetRangeAnchor\n | SheetTabAnchor\n | SheetTableAnchor\n | LakehouseTableAnchor\n | SlideAnchor\n | SqlQueryAnchor\n | TimeAnchor\n | TimeRangeAnchor\n | ToolCallAnchor;\n\n// ---------------------------------------------------------------------------\n// AnchorType — string literal union of all `type` discriminators\n// ---------------------------------------------------------------------------\n\nexport type AnchorType = Anchor['type'];\n\nexport const AnchorType = {\n Cell: 'cell',\n CellRange: 'cell_range',\n Comment: 'comment',\n CommentThread: 'comment_thread',\n FileLineRange: 'file_line_range',\n Line: 'line',\n LineRange: 'line_range',\n Message: 'msg',\n MessageRange: 'msg_range',\n MessageBlock: 'msg_block',\n MessageSection: 'msg_section',\n MessageText: 'msg_text',\n Page: 'page',\n PageRange: 'page_range',\n Path: 'path',\n PageRect: 'page_rect',\n PageText: 'page_text',\n PixelRange: 'pixel_range',\n PmMark: 'pm_mark',\n PmNode: 'pm_node',\n PmNodeRange: 'pm_node_range',\n Rect: 'rect',\n Section: 'section',\n SemanticQuery: 'semantic_query',\n Shape: 'shape',\n SheetCell: 'sheet_cell',\n SheetRange: 'sheet_range',\n SheetTab: 'sheet_tab',\n SheetTable: 'sheet_table',\n LakehouseTable: 'lakehouse_table',\n Slide: 'slide',\n SqlQuery: 'sql_query',\n Time: 'time',\n TimeRange: 'time_range',\n ToolCall: 'tool_call',\n} as const satisfies Record<string, AnchorType>;\n\n// ---------------------------------------------------------------------------\n// Type guards\n// ---------------------------------------------------------------------------\n\n/**\n * Pre-rename session anchor spellings that are still accepted on input so\n * links shared before the `msg*` rename keep resolving. Output always uses\n * the current names (see `serialize.ts`).\n */\nexport const LEGACY_ANCHOR_TYPES: Readonly<Record<string, AnchorType>> = {\n message: 'msg',\n message_range: 'msg_range',\n};\n\nexport function isAnchorType(value: unknown): value is AnchorType {\n return typeof value === 'string' && Object.values(AnchorType).includes(value as AnchorType);\n}\n\n/**\n * Quick check: validates only the `type` discriminator string.\n * For full structural validation, use `parseAnchor` from `./schemas`.\n */\nexport function isAnchor(value: unknown): value is Anchor {\n if (typeof value !== 'object' || value === null) return false;\n return isAnchorType((value as Record<string, unknown>).type);\n}\n\n// ---------------------------------------------------------------------------\n// Runtime-only types (not stored, produced by accessors)\n// ---------------------------------------------------------------------------\n\n/** Runtime form of TimeAnchor with pre-computed seconds. */\nexport type TimeAnchorSeconds = { type: 'time_seconds'; timeSeconds: number };\n/** Runtime form of TimeRangeAnchor with pre-computed seconds. */\nexport type TimeRangeAnchorSeconds = {\n type: 'time_range_seconds';\n startTimeSeconds: number;\n endTimeSeconds: number;\n};\n"],"names":[],"mappings":"AAsbO,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AAAA,EACT,eAAe;AAAA,EACf,eAAe;AAAA,EACf,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AAAA,EACT,cAAc;AAAA,EACd,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,MAAM;AAAA,EACN,WAAW;AAAA,EACX,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,MAAM;AAAA,EACN,SAAS;AAAA,EACT,eAAe;AAAA,EACf,OAAO;AAAA,EACP,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA,EACN,WAAW;AAAA,EACX,UAAU;AACZ;AAWO,MAAM,sBAA4D;AAAA,EACvE,SAAS;AAAA,EACT,eAAe;AACjB;AAEO,SAAS,aAAa,OAAqC;AAChE,SAAO,OAAO,UAAU,YAAY,OAAO,OAAO,UAAU,EAAE,SAAS,KAAmB;AAC5F;AAMO,SAAS,SAAS,OAAiC;AACxD,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,SAAO,aAAc,MAAkC,IAAI;AAC7D;"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const parse = require("./anchors/parse.cjs");
|
|
4
|
+
const serialize = require("./anchors/serialize.cjs");
|
|
5
|
+
const types = require("./anchors/types.cjs");
|
|
6
|
+
const ATTACHED_REFERENCES_METADATA_KEY = "attachedReferences";
|
|
7
|
+
const MAX_ATTACHED_REFERENCES = 10;
|
|
8
|
+
const MAX_ATTACHED_REFERENCE_LABEL_CHARS = 200;
|
|
9
|
+
const MAX_ATTACHED_URL_CHARS = 2048;
|
|
10
|
+
const ASSET_ID = /^asset_[A-Za-z0-9_-]{1,200}$/;
|
|
11
|
+
function isRecord(value) {
|
|
12
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13
|
+
}
|
|
14
|
+
function displayText(value, limit) {
|
|
15
|
+
if (typeof value !== "string") return void 0;
|
|
16
|
+
const oneLine = value.replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim();
|
|
17
|
+
if (!oneLine) return void 0;
|
|
18
|
+
return oneLine.length > limit ? `${oneLine.slice(0, limit - 1).trimEnd()}…` : oneLine;
|
|
19
|
+
}
|
|
20
|
+
function assetId(value) {
|
|
21
|
+
return typeof value === "string" && ASSET_ID.test(value) ? value : null;
|
|
22
|
+
}
|
|
23
|
+
function canonicalAnchor(value) {
|
|
24
|
+
if (!types.isAnchor(value)) return null;
|
|
25
|
+
try {
|
|
26
|
+
const params = serialize.serializeAnchorToParams(value);
|
|
27
|
+
for (const param of params.values()) {
|
|
28
|
+
if (param === "undefined" || param === "NaN" || param === "null") return null;
|
|
29
|
+
}
|
|
30
|
+
return parse.parseAnchorFromParams(params) ?? null;
|
|
31
|
+
} catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const NON_URL_CHARACTERS = /[^A-Za-z0-9\-._~:/?#[\]@!$&'()*+,;=%]/g;
|
|
36
|
+
function webUrl(value) {
|
|
37
|
+
if (typeof value !== "string" || value.length > MAX_ATTACHED_URL_CHARS) return null;
|
|
38
|
+
let parsed;
|
|
39
|
+
try {
|
|
40
|
+
parsed = new URL(value.trim());
|
|
41
|
+
} catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return null;
|
|
45
|
+
if (!parsed.hostname || parsed.username || parsed.password) return null;
|
|
46
|
+
const href = parsed.href.replace(NON_URL_CHARACTERS, (character) => encodeURIComponent(character));
|
|
47
|
+
return href.length > MAX_ATTACHED_URL_CHARS ? null : href;
|
|
48
|
+
}
|
|
49
|
+
function normalizeAttachableReference(value) {
|
|
50
|
+
if (!isRecord(value)) return null;
|
|
51
|
+
const meta = isRecord(value.meta) ? value.meta : {};
|
|
52
|
+
const title = displayText(meta.title, MAX_ATTACHED_REFERENCE_LABEL_CHARS);
|
|
53
|
+
switch (value.referenced) {
|
|
54
|
+
case "asset": {
|
|
55
|
+
const id = assetId(value.id);
|
|
56
|
+
if (id === null) return null;
|
|
57
|
+
const reference = { referenced: "asset", id };
|
|
58
|
+
if (value.anchor !== void 0 && value.anchor !== null) {
|
|
59
|
+
const anchor = canonicalAnchor(value.anchor);
|
|
60
|
+
if (anchor === null) return null;
|
|
61
|
+
reference.anchor = anchor;
|
|
62
|
+
}
|
|
63
|
+
const assetType = displayText(meta.assetType, 100);
|
|
64
|
+
if (title !== void 0 || assetType !== void 0) {
|
|
65
|
+
reference.meta = {
|
|
66
|
+
...title !== void 0 && { title },
|
|
67
|
+
...assetType !== void 0 && { assetType }
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return reference;
|
|
71
|
+
}
|
|
72
|
+
case "ontology_object": {
|
|
73
|
+
const id = assetId(value.id);
|
|
74
|
+
if (id === null) return null;
|
|
75
|
+
const reference = { referenced: "ontology_object", id };
|
|
76
|
+
const objectType = displayText(meta.objectType, 100);
|
|
77
|
+
if (title !== void 0 || objectType !== void 0) {
|
|
78
|
+
reference.meta = {
|
|
79
|
+
...title !== void 0 && { title },
|
|
80
|
+
...objectType !== void 0 && { objectType }
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return reference;
|
|
84
|
+
}
|
|
85
|
+
case "external_url": {
|
|
86
|
+
const url = webUrl(value.url);
|
|
87
|
+
if (url === null) return null;
|
|
88
|
+
const reference = { referenced: "external_url", url };
|
|
89
|
+
if (title !== void 0) reference.meta = { title };
|
|
90
|
+
return reference;
|
|
91
|
+
}
|
|
92
|
+
default:
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function attachableReferenceKey(reference) {
|
|
97
|
+
switch (reference.referenced) {
|
|
98
|
+
case "asset":
|
|
99
|
+
return reference.anchor ? `asset:${reference.id}?${serialize.serializeAnchorToParams(reference.anchor).toString()}` : `asset:${reference.id}`;
|
|
100
|
+
case "ontology_object":
|
|
101
|
+
return `ontology_object:${reference.id}`;
|
|
102
|
+
case "external_url":
|
|
103
|
+
return `external_url:${reference.url}`;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function attachableReferenceLabel(reference) {
|
|
107
|
+
var _a;
|
|
108
|
+
const title = (_a = reference.meta) == null ? void 0 : _a.title;
|
|
109
|
+
if (title) return title;
|
|
110
|
+
if (reference.referenced !== "external_url") return reference.id;
|
|
111
|
+
try {
|
|
112
|
+
const url = new URL(reference.url);
|
|
113
|
+
const path = url.pathname === "/" ? "" : url.pathname;
|
|
114
|
+
return `${url.hostname}${path}`;
|
|
115
|
+
} catch {
|
|
116
|
+
return reference.url;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function readAttachedReferences(metadata) {
|
|
120
|
+
if (!isRecord(metadata)) return [];
|
|
121
|
+
const raw = metadata[ATTACHED_REFERENCES_METADATA_KEY];
|
|
122
|
+
if (!Array.isArray(raw)) return [];
|
|
123
|
+
const seen = /* @__PURE__ */ new Set();
|
|
124
|
+
const references = [];
|
|
125
|
+
for (const entry of raw) {
|
|
126
|
+
if (references.length >= MAX_ATTACHED_REFERENCES) break;
|
|
127
|
+
const reference = normalizeAttachableReference(entry);
|
|
128
|
+
if (reference === null) continue;
|
|
129
|
+
const key = attachableReferenceKey(reference);
|
|
130
|
+
if (seen.has(key)) continue;
|
|
131
|
+
seen.add(key);
|
|
132
|
+
references.push(reference);
|
|
133
|
+
}
|
|
134
|
+
return references;
|
|
135
|
+
}
|
|
136
|
+
function withAttachedReferences(metadata, references) {
|
|
137
|
+
if (references.length === 0) return metadata === void 0 ? void 0 : { ...metadata };
|
|
138
|
+
return { ...metadata, [ATTACHED_REFERENCES_METADATA_KEY]: references.map((reference) => ({ ...reference })) };
|
|
139
|
+
}
|
|
140
|
+
exports.ATTACHED_REFERENCES_METADATA_KEY = ATTACHED_REFERENCES_METADATA_KEY;
|
|
141
|
+
exports.MAX_ATTACHED_REFERENCES = MAX_ATTACHED_REFERENCES;
|
|
142
|
+
exports.MAX_ATTACHED_REFERENCE_LABEL_CHARS = MAX_ATTACHED_REFERENCE_LABEL_CHARS;
|
|
143
|
+
exports.MAX_ATTACHED_URL_CHARS = MAX_ATTACHED_URL_CHARS;
|
|
144
|
+
exports.attachableReferenceKey = attachableReferenceKey;
|
|
145
|
+
exports.attachableReferenceLabel = attachableReferenceLabel;
|
|
146
|
+
exports.normalizeAttachableReference = normalizeAttachableReference;
|
|
147
|
+
exports.readAttachedReferences = readAttachedReferences;
|
|
148
|
+
exports.withAttachedReferences = withAttachedReferences;
|
|
149
|
+
//# sourceMappingURL=attachable.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachable.cjs","sources":["../../../../references/src/attachable.ts"],"sourcesContent":["/**\n * `@athenaintel/references/attachable` — what an app can attach to a chat message.\n *\n * An app hands the agent the object on screen (\"Discuss this with the agent\"): the person's next\n * message carries a list of references as structured data, in its own metadata\n * (`message.metadata.attachedReferences`), never as text. agora tells the agent what was attached\n * (kind, id, label) and the agent resolves each one on the server, through the canonical gates and\n * with the viewer's own permission; something the viewer can't open reaches the agent as a refusal,\n * never as content (`agora/agora/graphs/athena_deep_agent/attached_references.py`).\n *\n * Every kind is a member of the reference standard's family, discriminated by `referenced`:\n *\n * - `asset`: the standard's {@link AssetReference}, optionally with an `anchor` (its L2: a page,\n * a cell range, a node, …), without a pinned `version`;\n * - `ontology_object`: an ontology object, named by its `asset_<uuid>` id: a v1 object (an\n * `ontology_object` asset) or a Platform 2.0 object row;\n * - `external_url`: the standard's {@link ExternalUrlReference}.\n *\n * TODO(#54759): `table_row` (a row of a lakehouse or Kronos table, by key) waits for a\n * permission-checked row reader on the server; until it exists an app cannot attach one.\n *\n * `meta` is display only (the standard's L3): the label a chip shows, which the server never\n * trusts as content. The same rules hold on both sides; agora's copy is\n * `attached_references.py`, and `agora/tests/unit/deep_agent/test_attached_references.py` holds\n * the two to the same key and cap.\n *\n * The `@athenaintel/react` SDK bundles this entry, so it stays free of `zod`: `attachable.test.ts`\n * walks its import graph.\n */\n\nimport { parseAnchorFromParams } from './anchors/parse';\nimport { serializeAnchorToParams } from './anchors/serialize';\nimport type { Anchor } from './anchors/types';\nimport { isAnchor } from './anchors/types';\nimport type { AssetMeta, AssetReference, ExternalUrlMeta, ExternalUrlReference } from './types';\n\n/** The message metadata key a message's attached references ride under. */\nexport const ATTACHED_REFERENCES_METADATA_KEY = 'attachedReferences';\n\n/** The most references one message may carry (agora's `MAX_ATTACHED_REFERENCES`). */\nexport const MAX_ATTACHED_REFERENCES = 10;\n\n/** The longest label (`meta.title`) a reference keeps; a longer one is cut. */\nexport const MAX_ATTACHED_REFERENCE_LABEL_CHARS = 200;\n\n/** The longest URL an `external_url` reference may name. */\nexport const MAX_ATTACHED_URL_CHARS = 2048;\n\n/** An asset (or a Platform 2.0 object) id: `asset_` and up to 200 id characters, nothing else. */\nconst ASSET_ID = /^asset_[A-Za-z0-9_-]{1,200}$/;\n\n/** Display metadata of an ontology object: its title and the name of its type. */\nexport type OntologyObjectMeta = {\n title?: string;\n objectType?: string;\n};\n\n/**\n * An ontology object: a v1 object (an `ontology_object` asset) or a Platform 2.0 object row, both\n * named by their `asset_<uuid>` id. agora decides which it is and gates it accordingly.\n */\nexport type OntologyObjectReference = {\n referenced: 'ontology_object';\n id: string;\n meta?: OntologyObjectMeta;\n};\n\n/** An asset, optionally narrowed to a place inside it (`anchor`). */\nexport type AttachableAssetReference = Pick<AssetReference, 'referenced' | 'id' | 'anchor'> & {\n meta?: Pick<AssetMeta, 'title' | 'assetType'>;\n};\n\n/** A web page. */\nexport type AttachableUrlReference = Pick<ExternalUrlReference, 'referenced' | 'url'> & {\n meta?: Pick<ExternalUrlMeta, 'title'>;\n};\n\n/** Anything an app may attach to a message. */\nexport type AttachableReference =\n | AttachableAssetReference\n | OntologyObjectReference\n | AttachableUrlReference;\n\n/** The kinds an app may attach (`referenced`). */\nexport type AttachableReferenceKind = AttachableReference['referenced'];\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** A display string: trimmed, one line, cut to `limit`; `undefined` when nothing is left. */\nfunction displayText(value: unknown, limit: number): string | undefined {\n if (typeof value !== 'string') return undefined;\n // Control characters (newlines included) never reach a chip or the agent's note.\n const oneLine = value.replace(/[\\u0000-\\u001f\\u007f]+/g, ' ').replace(/\\s+/g, ' ').trim();\n if (!oneLine) return undefined;\n return oneLine.length > limit ? `${oneLine.slice(0, limit - 1).trimEnd()}…` : oneLine;\n}\n\nfunction assetId(value: unknown): string | null {\n return typeof value === 'string' && ASSET_ID.test(value) ? value : null;\n}\n\n/**\n * The anchor as the reference standard writes it, or `null` when it is not one: round-tripped\n * through its canonical query form, so what goes out is exactly what agora's `read_asset` parses.\n */\nfunction canonicalAnchor(value: unknown): Anchor | null {\n if (!isAnchor(value)) return null;\n try {\n const params = serializeAnchorToParams(value);\n // A missing field serializes as the string \"undefined\" (or \"NaN\"): not an anchor.\n for (const param of params.values()) {\n if (param === 'undefined' || param === 'NaN' || param === 'null') return null;\n }\n return parseAnchorFromParams(params) ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * Characters outside RFC 3986's set. `URL.href` percent-encodes most of them but leaves a few in a\n * query (`{`, `}`, `|`, `^`, …); agora accepts RFC 3986 characters only.\n */\nconst NON_URL_CHARACTERS = /[^A-Za-z0-9\\-._~:/?#[\\]@!$&'()*+,;=%]/g;\n\n/** The URL, normalized, when it is an `http(s)` URL with a host and no embedded credentials. */\nfunction webUrl(value: unknown): string | null {\n if (typeof value !== 'string' || value.length > MAX_ATTACHED_URL_CHARS) return null;\n let parsed: URL;\n try {\n parsed = new URL(value.trim());\n } catch {\n return null;\n }\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return null;\n if (!parsed.hostname || parsed.username || parsed.password) return null;\n const href = parsed.href.replace(NON_URL_CHARACTERS, (character) => encodeURIComponent(character));\n return href.length > MAX_ATTACHED_URL_CHARS ? null : href;\n}\n\n/**\n * `value` as an attachable reference in its canonical shape, or `null` when it is not one: an\n * unknown kind, a malformed id or URL, or an anchor the standard can't read. Unknown fields are\n * dropped and labels are cut to {@link MAX_ATTACHED_REFERENCE_LABEL_CHARS}.\n */\nexport function normalizeAttachableReference(value: unknown): AttachableReference | null {\n if (!isRecord(value)) return null;\n const meta = isRecord(value.meta) ? value.meta : {};\n const title = displayText(meta.title, MAX_ATTACHED_REFERENCE_LABEL_CHARS);\n switch (value.referenced) {\n case 'asset': {\n const id = assetId(value.id);\n if (id === null) return null;\n const reference: AttachableAssetReference = { referenced: 'asset', id };\n if (value.anchor !== undefined && value.anchor !== null) {\n const anchor = canonicalAnchor(value.anchor);\n if (anchor === null) return null;\n reference.anchor = anchor;\n }\n const assetType = displayText(meta.assetType, 100);\n if (title !== undefined || assetType !== undefined) {\n reference.meta = {\n ...(title !== undefined && { title }),\n ...(assetType !== undefined && { assetType }),\n };\n }\n return reference;\n }\n case 'ontology_object': {\n const id = assetId(value.id);\n if (id === null) return null;\n const reference: OntologyObjectReference = { referenced: 'ontology_object', id };\n const objectType = displayText(meta.objectType, 100);\n if (title !== undefined || objectType !== undefined) {\n reference.meta = {\n ...(title !== undefined && { title }),\n ...(objectType !== undefined && { objectType }),\n };\n }\n return reference;\n }\n case 'external_url': {\n const url = webUrl(value.url);\n if (url === null) return null;\n const reference: AttachableUrlReference = { referenced: 'external_url', url };\n if (title !== undefined) reference.meta = { title };\n return reference;\n }\n default:\n return null;\n }\n}\n\n/**\n * What makes two attachments the same one: the kind and its pointer (an asset's anchor included),\n * never its label. A message carries each at most once.\n */\nexport function attachableReferenceKey(reference: AttachableReference): string {\n switch (reference.referenced) {\n case 'asset':\n return reference.anchor\n ? `asset:${reference.id}?${serializeAnchorToParams(reference.anchor).toString()}`\n : `asset:${reference.id}`;\n case 'ontology_object':\n return `ontology_object:${reference.id}`;\n case 'external_url':\n return `external_url:${reference.url}`;\n }\n}\n\n/** What a chip calls the reference: its label, else its id or the URL's host and path. */\nexport function attachableReferenceLabel(reference: AttachableReference): string {\n const title = reference.meta?.title;\n if (title) return title;\n if (reference.referenced !== 'external_url') return reference.id;\n try {\n const url = new URL(reference.url);\n const path = url.pathname === '/' ? '' : url.pathname;\n return `${url.hostname}${path}`;\n } catch {\n return reference.url;\n }\n}\n\n/**\n * The references a message's metadata carries, normalized: each valid one once, in order, at most\n * {@link MAX_ATTACHED_REFERENCES}; anything malformed is left out. `[]` when it carries none.\n */\nexport function readAttachedReferences(metadata: unknown): AttachableReference[] {\n if (!isRecord(metadata)) return [];\n const raw = metadata[ATTACHED_REFERENCES_METADATA_KEY];\n if (!Array.isArray(raw)) return [];\n const seen = new Set<string>();\n const references: AttachableReference[] = [];\n for (const entry of raw) {\n if (references.length >= MAX_ATTACHED_REFERENCES) break;\n const reference = normalizeAttachableReference(entry);\n if (reference === null) continue;\n const key = attachableReferenceKey(reference);\n if (seen.has(key)) continue;\n seen.add(key);\n references.push(reference);\n }\n return references;\n}\n\n/**\n * `metadata` carrying `references` under {@link ATTACHED_REFERENCES_METADATA_KEY}; an empty list\n * leaves the key out (a message attaching nothing says nothing about attachments).\n */\nexport function withAttachedReferences(\n metadata: Readonly<Record<string, unknown>> | undefined,\n references: readonly AttachableReference[]\n): Record<string, unknown> | undefined {\n if (references.length === 0) return metadata === undefined ? undefined : { ...metadata };\n return { ...metadata, [ATTACHED_REFERENCES_METADATA_KEY]: references.map((reference) => ({ ...reference })) };\n}\n"],"names":["isAnchor","serializeAnchorToParams","parseAnchorFromParams"],"mappings":"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"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@athenaintel/references/attachable` — what an app can attach to a chat message.
|
|
3
|
+
*
|
|
4
|
+
* An app hands the agent the object on screen ("Discuss this with the agent"): the person's next
|
|
5
|
+
* message carries a list of references as structured data, in its own metadata
|
|
6
|
+
* (`message.metadata.attachedReferences`), never as text. agora tells the agent what was attached
|
|
7
|
+
* (kind, id, label) and the agent resolves each one on the server, through the canonical gates and
|
|
8
|
+
* with the viewer's own permission; something the viewer can't open reaches the agent as a refusal,
|
|
9
|
+
* never as content (`agora/agora/graphs/athena_deep_agent/attached_references.py`).
|
|
10
|
+
*
|
|
11
|
+
* Every kind is a member of the reference standard's family, discriminated by `referenced`:
|
|
12
|
+
*
|
|
13
|
+
* - `asset`: the standard's {@link AssetReference}, optionally with an `anchor` (its L2: a page,
|
|
14
|
+
* a cell range, a node, …), without a pinned `version`;
|
|
15
|
+
* - `ontology_object`: an ontology object, named by its `asset_<uuid>` id: a v1 object (an
|
|
16
|
+
* `ontology_object` asset) or a Platform 2.0 object row;
|
|
17
|
+
* - `external_url`: the standard's {@link ExternalUrlReference}.
|
|
18
|
+
*
|
|
19
|
+
* TODO(#54759): `table_row` (a row of a lakehouse or Kronos table, by key) waits for a
|
|
20
|
+
* permission-checked row reader on the server; until it exists an app cannot attach one.
|
|
21
|
+
*
|
|
22
|
+
* `meta` is display only (the standard's L3): the label a chip shows, which the server never
|
|
23
|
+
* trusts as content. The same rules hold on both sides; agora's copy is
|
|
24
|
+
* `attached_references.py`, and `agora/tests/unit/deep_agent/test_attached_references.py` holds
|
|
25
|
+
* the two to the same key and cap.
|
|
26
|
+
*
|
|
27
|
+
* The `@athenaintel/react` SDK bundles this entry, so it stays free of `zod`: `attachable.test.ts`
|
|
28
|
+
* walks its import graph.
|
|
29
|
+
*/
|
|
30
|
+
import type { AssetMeta, AssetReference, ExternalUrlMeta, ExternalUrlReference } from './types';
|
|
31
|
+
/** The message metadata key a message's attached references ride under. */
|
|
32
|
+
export declare const ATTACHED_REFERENCES_METADATA_KEY = "attachedReferences";
|
|
33
|
+
/** The most references one message may carry (agora's `MAX_ATTACHED_REFERENCES`). */
|
|
34
|
+
export declare const MAX_ATTACHED_REFERENCES = 10;
|
|
35
|
+
/** The longest label (`meta.title`) a reference keeps; a longer one is cut. */
|
|
36
|
+
export declare const MAX_ATTACHED_REFERENCE_LABEL_CHARS = 200;
|
|
37
|
+
/** The longest URL an `external_url` reference may name. */
|
|
38
|
+
export declare const MAX_ATTACHED_URL_CHARS = 2048;
|
|
39
|
+
/** Display metadata of an ontology object: its title and the name of its type. */
|
|
40
|
+
export type OntologyObjectMeta = {
|
|
41
|
+
title?: string;
|
|
42
|
+
objectType?: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* An ontology object: a v1 object (an `ontology_object` asset) or a Platform 2.0 object row, both
|
|
46
|
+
* named by their `asset_<uuid>` id. agora decides which it is and gates it accordingly.
|
|
47
|
+
*/
|
|
48
|
+
export type OntologyObjectReference = {
|
|
49
|
+
referenced: 'ontology_object';
|
|
50
|
+
id: string;
|
|
51
|
+
meta?: OntologyObjectMeta;
|
|
52
|
+
};
|
|
53
|
+
/** An asset, optionally narrowed to a place inside it (`anchor`). */
|
|
54
|
+
export type AttachableAssetReference = Pick<AssetReference, 'referenced' | 'id' | 'anchor'> & {
|
|
55
|
+
meta?: Pick<AssetMeta, 'title' | 'assetType'>;
|
|
56
|
+
};
|
|
57
|
+
/** A web page. */
|
|
58
|
+
export type AttachableUrlReference = Pick<ExternalUrlReference, 'referenced' | 'url'> & {
|
|
59
|
+
meta?: Pick<ExternalUrlMeta, 'title'>;
|
|
60
|
+
};
|
|
61
|
+
/** Anything an app may attach to a message. */
|
|
62
|
+
export type AttachableReference = AttachableAssetReference | OntologyObjectReference | AttachableUrlReference;
|
|
63
|
+
/** The kinds an app may attach (`referenced`). */
|
|
64
|
+
export type AttachableReferenceKind = AttachableReference['referenced'];
|
|
65
|
+
/**
|
|
66
|
+
* `value` as an attachable reference in its canonical shape, or `null` when it is not one: an
|
|
67
|
+
* unknown kind, a malformed id or URL, or an anchor the standard can't read. Unknown fields are
|
|
68
|
+
* dropped and labels are cut to {@link MAX_ATTACHED_REFERENCE_LABEL_CHARS}.
|
|
69
|
+
*/
|
|
70
|
+
export declare function normalizeAttachableReference(value: unknown): AttachableReference | null;
|
|
71
|
+
/**
|
|
72
|
+
* What makes two attachments the same one: the kind and its pointer (an asset's anchor included),
|
|
73
|
+
* never its label. A message carries each at most once.
|
|
74
|
+
*/
|
|
75
|
+
export declare function attachableReferenceKey(reference: AttachableReference): string;
|
|
76
|
+
/** What a chip calls the reference: its label, else its id or the URL's host and path. */
|
|
77
|
+
export declare function attachableReferenceLabel(reference: AttachableReference): string;
|
|
78
|
+
/**
|
|
79
|
+
* The references a message's metadata carries, normalized: each valid one once, in order, at most
|
|
80
|
+
* {@link MAX_ATTACHED_REFERENCES}; anything malformed is left out. `[]` when it carries none.
|
|
81
|
+
*/
|
|
82
|
+
export declare function readAttachedReferences(metadata: unknown): AttachableReference[];
|
|
83
|
+
/**
|
|
84
|
+
* `metadata` carrying `references` under {@link ATTACHED_REFERENCES_METADATA_KEY}; an empty list
|
|
85
|
+
* leaves the key out (a message attaching nothing says nothing about attachments).
|
|
86
|
+
*/
|
|
87
|
+
export declare function withAttachedReferences(metadata: Readonly<Record<string, unknown>> | undefined, references: readonly AttachableReference[]): Record<string, unknown> | undefined;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { parseAnchorFromParams } from "./anchors/parse.js";
|
|
2
|
+
import { serializeAnchorToParams } from "./anchors/serialize.js";
|
|
3
|
+
import { isAnchor } from "./anchors/types.js";
|
|
4
|
+
const ATTACHED_REFERENCES_METADATA_KEY = "attachedReferences";
|
|
5
|
+
const MAX_ATTACHED_REFERENCES = 10;
|
|
6
|
+
const MAX_ATTACHED_REFERENCE_LABEL_CHARS = 200;
|
|
7
|
+
const MAX_ATTACHED_URL_CHARS = 2048;
|
|
8
|
+
const ASSET_ID = /^asset_[A-Za-z0-9_-]{1,200}$/;
|
|
9
|
+
function isRecord(value) {
|
|
10
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11
|
+
}
|
|
12
|
+
function displayText(value, limit) {
|
|
13
|
+
if (typeof value !== "string") return void 0;
|
|
14
|
+
const oneLine = value.replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim();
|
|
15
|
+
if (!oneLine) return void 0;
|
|
16
|
+
return oneLine.length > limit ? `${oneLine.slice(0, limit - 1).trimEnd()}…` : oneLine;
|
|
17
|
+
}
|
|
18
|
+
function assetId(value) {
|
|
19
|
+
return typeof value === "string" && ASSET_ID.test(value) ? value : null;
|
|
20
|
+
}
|
|
21
|
+
function canonicalAnchor(value) {
|
|
22
|
+
if (!isAnchor(value)) return null;
|
|
23
|
+
try {
|
|
24
|
+
const params = serializeAnchorToParams(value);
|
|
25
|
+
for (const param of params.values()) {
|
|
26
|
+
if (param === "undefined" || param === "NaN" || param === "null") return null;
|
|
27
|
+
}
|
|
28
|
+
return parseAnchorFromParams(params) ?? null;
|
|
29
|
+
} catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const NON_URL_CHARACTERS = /[^A-Za-z0-9\-._~:/?#[\]@!$&'()*+,;=%]/g;
|
|
34
|
+
function webUrl(value) {
|
|
35
|
+
if (typeof value !== "string" || value.length > MAX_ATTACHED_URL_CHARS) return null;
|
|
36
|
+
let parsed;
|
|
37
|
+
try {
|
|
38
|
+
parsed = new URL(value.trim());
|
|
39
|
+
} catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return null;
|
|
43
|
+
if (!parsed.hostname || parsed.username || parsed.password) return null;
|
|
44
|
+
const href = parsed.href.replace(NON_URL_CHARACTERS, (character) => encodeURIComponent(character));
|
|
45
|
+
return href.length > MAX_ATTACHED_URL_CHARS ? null : href;
|
|
46
|
+
}
|
|
47
|
+
function normalizeAttachableReference(value) {
|
|
48
|
+
if (!isRecord(value)) return null;
|
|
49
|
+
const meta = isRecord(value.meta) ? value.meta : {};
|
|
50
|
+
const title = displayText(meta.title, MAX_ATTACHED_REFERENCE_LABEL_CHARS);
|
|
51
|
+
switch (value.referenced) {
|
|
52
|
+
case "asset": {
|
|
53
|
+
const id = assetId(value.id);
|
|
54
|
+
if (id === null) return null;
|
|
55
|
+
const reference = { referenced: "asset", id };
|
|
56
|
+
if (value.anchor !== void 0 && value.anchor !== null) {
|
|
57
|
+
const anchor = canonicalAnchor(value.anchor);
|
|
58
|
+
if (anchor === null) return null;
|
|
59
|
+
reference.anchor = anchor;
|
|
60
|
+
}
|
|
61
|
+
const assetType = displayText(meta.assetType, 100);
|
|
62
|
+
if (title !== void 0 || assetType !== void 0) {
|
|
63
|
+
reference.meta = {
|
|
64
|
+
...title !== void 0 && { title },
|
|
65
|
+
...assetType !== void 0 && { assetType }
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return reference;
|
|
69
|
+
}
|
|
70
|
+
case "ontology_object": {
|
|
71
|
+
const id = assetId(value.id);
|
|
72
|
+
if (id === null) return null;
|
|
73
|
+
const reference = { referenced: "ontology_object", id };
|
|
74
|
+
const objectType = displayText(meta.objectType, 100);
|
|
75
|
+
if (title !== void 0 || objectType !== void 0) {
|
|
76
|
+
reference.meta = {
|
|
77
|
+
...title !== void 0 && { title },
|
|
78
|
+
...objectType !== void 0 && { objectType }
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return reference;
|
|
82
|
+
}
|
|
83
|
+
case "external_url": {
|
|
84
|
+
const url = webUrl(value.url);
|
|
85
|
+
if (url === null) return null;
|
|
86
|
+
const reference = { referenced: "external_url", url };
|
|
87
|
+
if (title !== void 0) reference.meta = { title };
|
|
88
|
+
return reference;
|
|
89
|
+
}
|
|
90
|
+
default:
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function attachableReferenceKey(reference) {
|
|
95
|
+
switch (reference.referenced) {
|
|
96
|
+
case "asset":
|
|
97
|
+
return reference.anchor ? `asset:${reference.id}?${serializeAnchorToParams(reference.anchor).toString()}` : `asset:${reference.id}`;
|
|
98
|
+
case "ontology_object":
|
|
99
|
+
return `ontology_object:${reference.id}`;
|
|
100
|
+
case "external_url":
|
|
101
|
+
return `external_url:${reference.url}`;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function attachableReferenceLabel(reference) {
|
|
105
|
+
var _a;
|
|
106
|
+
const title = (_a = reference.meta) == null ? void 0 : _a.title;
|
|
107
|
+
if (title) return title;
|
|
108
|
+
if (reference.referenced !== "external_url") return reference.id;
|
|
109
|
+
try {
|
|
110
|
+
const url = new URL(reference.url);
|
|
111
|
+
const path = url.pathname === "/" ? "" : url.pathname;
|
|
112
|
+
return `${url.hostname}${path}`;
|
|
113
|
+
} catch {
|
|
114
|
+
return reference.url;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function readAttachedReferences(metadata) {
|
|
118
|
+
if (!isRecord(metadata)) return [];
|
|
119
|
+
const raw = metadata[ATTACHED_REFERENCES_METADATA_KEY];
|
|
120
|
+
if (!Array.isArray(raw)) return [];
|
|
121
|
+
const seen = /* @__PURE__ */ new Set();
|
|
122
|
+
const references = [];
|
|
123
|
+
for (const entry of raw) {
|
|
124
|
+
if (references.length >= MAX_ATTACHED_REFERENCES) break;
|
|
125
|
+
const reference = normalizeAttachableReference(entry);
|
|
126
|
+
if (reference === null) continue;
|
|
127
|
+
const key = attachableReferenceKey(reference);
|
|
128
|
+
if (seen.has(key)) continue;
|
|
129
|
+
seen.add(key);
|
|
130
|
+
references.push(reference);
|
|
131
|
+
}
|
|
132
|
+
return references;
|
|
133
|
+
}
|
|
134
|
+
function withAttachedReferences(metadata, references) {
|
|
135
|
+
if (references.length === 0) return metadata === void 0 ? void 0 : { ...metadata };
|
|
136
|
+
return { ...metadata, [ATTACHED_REFERENCES_METADATA_KEY]: references.map((reference) => ({ ...reference })) };
|
|
137
|
+
}
|
|
138
|
+
export {
|
|
139
|
+
ATTACHED_REFERENCES_METADATA_KEY,
|
|
140
|
+
MAX_ATTACHED_REFERENCES,
|
|
141
|
+
MAX_ATTACHED_REFERENCE_LABEL_CHARS,
|
|
142
|
+
MAX_ATTACHED_URL_CHARS,
|
|
143
|
+
attachableReferenceKey,
|
|
144
|
+
attachableReferenceLabel,
|
|
145
|
+
normalizeAttachableReference,
|
|
146
|
+
readAttachedReferences,
|
|
147
|
+
withAttachedReferences
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=attachable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachable.js","sources":["../../../../references/src/attachable.ts"],"sourcesContent":["/**\n * `@athenaintel/references/attachable` — what an app can attach to a chat message.\n *\n * An app hands the agent the object on screen (\"Discuss this with the agent\"): the person's next\n * message carries a list of references as structured data, in its own metadata\n * (`message.metadata.attachedReferences`), never as text. agora tells the agent what was attached\n * (kind, id, label) and the agent resolves each one on the server, through the canonical gates and\n * with the viewer's own permission; something the viewer can't open reaches the agent as a refusal,\n * never as content (`agora/agora/graphs/athena_deep_agent/attached_references.py`).\n *\n * Every kind is a member of the reference standard's family, discriminated by `referenced`:\n *\n * - `asset`: the standard's {@link AssetReference}, optionally with an `anchor` (its L2: a page,\n * a cell range, a node, …), without a pinned `version`;\n * - `ontology_object`: an ontology object, named by its `asset_<uuid>` id: a v1 object (an\n * `ontology_object` asset) or a Platform 2.0 object row;\n * - `external_url`: the standard's {@link ExternalUrlReference}.\n *\n * TODO(#54759): `table_row` (a row of a lakehouse or Kronos table, by key) waits for a\n * permission-checked row reader on the server; until it exists an app cannot attach one.\n *\n * `meta` is display only (the standard's L3): the label a chip shows, which the server never\n * trusts as content. The same rules hold on both sides; agora's copy is\n * `attached_references.py`, and `agora/tests/unit/deep_agent/test_attached_references.py` holds\n * the two to the same key and cap.\n *\n * The `@athenaintel/react` SDK bundles this entry, so it stays free of `zod`: `attachable.test.ts`\n * walks its import graph.\n */\n\nimport { parseAnchorFromParams } from './anchors/parse';\nimport { serializeAnchorToParams } from './anchors/serialize';\nimport type { Anchor } from './anchors/types';\nimport { isAnchor } from './anchors/types';\nimport type { AssetMeta, AssetReference, ExternalUrlMeta, ExternalUrlReference } from './types';\n\n/** The message metadata key a message's attached references ride under. */\nexport const ATTACHED_REFERENCES_METADATA_KEY = 'attachedReferences';\n\n/** The most references one message may carry (agora's `MAX_ATTACHED_REFERENCES`). */\nexport const MAX_ATTACHED_REFERENCES = 10;\n\n/** The longest label (`meta.title`) a reference keeps; a longer one is cut. */\nexport const MAX_ATTACHED_REFERENCE_LABEL_CHARS = 200;\n\n/** The longest URL an `external_url` reference may name. */\nexport const MAX_ATTACHED_URL_CHARS = 2048;\n\n/** An asset (or a Platform 2.0 object) id: `asset_` and up to 200 id characters, nothing else. */\nconst ASSET_ID = /^asset_[A-Za-z0-9_-]{1,200}$/;\n\n/** Display metadata of an ontology object: its title and the name of its type. */\nexport type OntologyObjectMeta = {\n title?: string;\n objectType?: string;\n};\n\n/**\n * An ontology object: a v1 object (an `ontology_object` asset) or a Platform 2.0 object row, both\n * named by their `asset_<uuid>` id. agora decides which it is and gates it accordingly.\n */\nexport type OntologyObjectReference = {\n referenced: 'ontology_object';\n id: string;\n meta?: OntologyObjectMeta;\n};\n\n/** An asset, optionally narrowed to a place inside it (`anchor`). */\nexport type AttachableAssetReference = Pick<AssetReference, 'referenced' | 'id' | 'anchor'> & {\n meta?: Pick<AssetMeta, 'title' | 'assetType'>;\n};\n\n/** A web page. */\nexport type AttachableUrlReference = Pick<ExternalUrlReference, 'referenced' | 'url'> & {\n meta?: Pick<ExternalUrlMeta, 'title'>;\n};\n\n/** Anything an app may attach to a message. */\nexport type AttachableReference =\n | AttachableAssetReference\n | OntologyObjectReference\n | AttachableUrlReference;\n\n/** The kinds an app may attach (`referenced`). */\nexport type AttachableReferenceKind = AttachableReference['referenced'];\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** A display string: trimmed, one line, cut to `limit`; `undefined` when nothing is left. */\nfunction displayText(value: unknown, limit: number): string | undefined {\n if (typeof value !== 'string') return undefined;\n // Control characters (newlines included) never reach a chip or the agent's note.\n const oneLine = value.replace(/[\\u0000-\\u001f\\u007f]+/g, ' ').replace(/\\s+/g, ' ').trim();\n if (!oneLine) return undefined;\n return oneLine.length > limit ? `${oneLine.slice(0, limit - 1).trimEnd()}…` : oneLine;\n}\n\nfunction assetId(value: unknown): string | null {\n return typeof value === 'string' && ASSET_ID.test(value) ? value : null;\n}\n\n/**\n * The anchor as the reference standard writes it, or `null` when it is not one: round-tripped\n * through its canonical query form, so what goes out is exactly what agora's `read_asset` parses.\n */\nfunction canonicalAnchor(value: unknown): Anchor | null {\n if (!isAnchor(value)) return null;\n try {\n const params = serializeAnchorToParams(value);\n // A missing field serializes as the string \"undefined\" (or \"NaN\"): not an anchor.\n for (const param of params.values()) {\n if (param === 'undefined' || param === 'NaN' || param === 'null') return null;\n }\n return parseAnchorFromParams(params) ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * Characters outside RFC 3986's set. `URL.href` percent-encodes most of them but leaves a few in a\n * query (`{`, `}`, `|`, `^`, …); agora accepts RFC 3986 characters only.\n */\nconst NON_URL_CHARACTERS = /[^A-Za-z0-9\\-._~:/?#[\\]@!$&'()*+,;=%]/g;\n\n/** The URL, normalized, when it is an `http(s)` URL with a host and no embedded credentials. */\nfunction webUrl(value: unknown): string | null {\n if (typeof value !== 'string' || value.length > MAX_ATTACHED_URL_CHARS) return null;\n let parsed: URL;\n try {\n parsed = new URL(value.trim());\n } catch {\n return null;\n }\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return null;\n if (!parsed.hostname || parsed.username || parsed.password) return null;\n const href = parsed.href.replace(NON_URL_CHARACTERS, (character) => encodeURIComponent(character));\n return href.length > MAX_ATTACHED_URL_CHARS ? null : href;\n}\n\n/**\n * `value` as an attachable reference in its canonical shape, or `null` when it is not one: an\n * unknown kind, a malformed id or URL, or an anchor the standard can't read. Unknown fields are\n * dropped and labels are cut to {@link MAX_ATTACHED_REFERENCE_LABEL_CHARS}.\n */\nexport function normalizeAttachableReference(value: unknown): AttachableReference | null {\n if (!isRecord(value)) return null;\n const meta = isRecord(value.meta) ? value.meta : {};\n const title = displayText(meta.title, MAX_ATTACHED_REFERENCE_LABEL_CHARS);\n switch (value.referenced) {\n case 'asset': {\n const id = assetId(value.id);\n if (id === null) return null;\n const reference: AttachableAssetReference = { referenced: 'asset', id };\n if (value.anchor !== undefined && value.anchor !== null) {\n const anchor = canonicalAnchor(value.anchor);\n if (anchor === null) return null;\n reference.anchor = anchor;\n }\n const assetType = displayText(meta.assetType, 100);\n if (title !== undefined || assetType !== undefined) {\n reference.meta = {\n ...(title !== undefined && { title }),\n ...(assetType !== undefined && { assetType }),\n };\n }\n return reference;\n }\n case 'ontology_object': {\n const id = assetId(value.id);\n if (id === null) return null;\n const reference: OntologyObjectReference = { referenced: 'ontology_object', id };\n const objectType = displayText(meta.objectType, 100);\n if (title !== undefined || objectType !== undefined) {\n reference.meta = {\n ...(title !== undefined && { title }),\n ...(objectType !== undefined && { objectType }),\n };\n }\n return reference;\n }\n case 'external_url': {\n const url = webUrl(value.url);\n if (url === null) return null;\n const reference: AttachableUrlReference = { referenced: 'external_url', url };\n if (title !== undefined) reference.meta = { title };\n return reference;\n }\n default:\n return null;\n }\n}\n\n/**\n * What makes two attachments the same one: the kind and its pointer (an asset's anchor included),\n * never its label. A message carries each at most once.\n */\nexport function attachableReferenceKey(reference: AttachableReference): string {\n switch (reference.referenced) {\n case 'asset':\n return reference.anchor\n ? `asset:${reference.id}?${serializeAnchorToParams(reference.anchor).toString()}`\n : `asset:${reference.id}`;\n case 'ontology_object':\n return `ontology_object:${reference.id}`;\n case 'external_url':\n return `external_url:${reference.url}`;\n }\n}\n\n/** What a chip calls the reference: its label, else its id or the URL's host and path. */\nexport function attachableReferenceLabel(reference: AttachableReference): string {\n const title = reference.meta?.title;\n if (title) return title;\n if (reference.referenced !== 'external_url') return reference.id;\n try {\n const url = new URL(reference.url);\n const path = url.pathname === '/' ? '' : url.pathname;\n return `${url.hostname}${path}`;\n } catch {\n return reference.url;\n }\n}\n\n/**\n * The references a message's metadata carries, normalized: each valid one once, in order, at most\n * {@link MAX_ATTACHED_REFERENCES}; anything malformed is left out. `[]` when it carries none.\n */\nexport function readAttachedReferences(metadata: unknown): AttachableReference[] {\n if (!isRecord(metadata)) return [];\n const raw = metadata[ATTACHED_REFERENCES_METADATA_KEY];\n if (!Array.isArray(raw)) return [];\n const seen = new Set<string>();\n const references: AttachableReference[] = [];\n for (const entry of raw) {\n if (references.length >= MAX_ATTACHED_REFERENCES) break;\n const reference = normalizeAttachableReference(entry);\n if (reference === null) continue;\n const key = attachableReferenceKey(reference);\n if (seen.has(key)) continue;\n seen.add(key);\n references.push(reference);\n }\n return references;\n}\n\n/**\n * `metadata` carrying `references` under {@link ATTACHED_REFERENCES_METADATA_KEY}; an empty list\n * leaves the key out (a message attaching nothing says nothing about attachments).\n */\nexport function withAttachedReferences(\n metadata: Readonly<Record<string, unknown>> | undefined,\n references: readonly AttachableReference[]\n): Record<string, unknown> | undefined {\n if (references.length === 0) return metadata === undefined ? undefined : { ...metadata };\n return { ...metadata, [ATTACHED_REFERENCES_METADATA_KEY]: references.map((reference) => ({ ...reference })) };\n}\n"],"names":[],"mappings":"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"}
|