@athenaintel/react 0.57.2 → 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 +759 -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 +290 -97
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +80 -4
- package/dist/chat/AthenaChat.js +290 -97
- 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 +56 -19
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +24 -8
- package/dist/provider/AthenaProvider.js +57 -20
- 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 +3 -1
- package/dist/runtime/statewire-run-config.cjs.map +1 -1
- package/dist/runtime/statewire-run-config.d.ts +7 -0
- package/dist/runtime/statewire-run-config.js +3 -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 +6 -6
- package/dist/threads/SessionList.cjs.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/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/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
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const namedAgents = require("../agent-runtime/src/named-agents.cjs");
|
|
5
|
+
const lucideReact = require("lucide-react");
|
|
6
|
+
const require$$0 = require("react");
|
|
7
|
+
const cnfast = require("cnfast");
|
|
8
|
+
const ComposerNamedAgents = ({
|
|
9
|
+
threadId,
|
|
10
|
+
onEmptied,
|
|
11
|
+
className
|
|
12
|
+
}) => {
|
|
13
|
+
const agents = namedAgents.useDeepAgentNamedAgents(threadId);
|
|
14
|
+
const listRef = require$$0.useRef(null);
|
|
15
|
+
if (agents.length === 0) return null;
|
|
16
|
+
const remove = (agent, index) => {
|
|
17
|
+
namedAgents.removeDeepAgentNamedAgent({ threadId, ref: agent.ref });
|
|
18
|
+
requestAnimationFrame(() => {
|
|
19
|
+
var _a;
|
|
20
|
+
const buttons = (_a = listRef.current) == null ? void 0 : _a.querySelectorAll(
|
|
21
|
+
"button[data-named-agent-remove]"
|
|
22
|
+
);
|
|
23
|
+
const next = (buttons == null ? void 0 : buttons.length) ? buttons[Math.min(index, buttons.length - 1)] : void 0;
|
|
24
|
+
if (next) next.focus();
|
|
25
|
+
else onEmptied == null ? void 0 : onEmptied();
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
className: cnfast.cn("aui-composer-named-agents mx-3 mt-2 flex items-start gap-2", className),
|
|
32
|
+
"data-testid": "athena-named-agents",
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "py-0.5 text-muted-foreground text-xs", children: "To" }),
|
|
35
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36
|
+
"ul",
|
|
37
|
+
{
|
|
38
|
+
ref: listRef,
|
|
39
|
+
"aria-label": "Agents this message goes to",
|
|
40
|
+
className: "flex min-w-0 flex-1 flex-wrap gap-1.5",
|
|
41
|
+
children: agents.map((agent, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "min-w-0", "data-named-agent": agent.ref, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex max-w-full items-center gap-1 rounded-md border border-border bg-muted/60 py-0 pr-0.5 pl-1.5 font-medium text-foreground text-xs", children: [
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.BotIcon, { "aria-hidden": "true", className: "size-3 shrink-0 text-muted-foreground" }),
|
|
43
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-w-48 truncate", children: agent.name }),
|
|
44
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
className: "inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
49
|
+
"aria-label": `Remove ${agent.name}`,
|
|
50
|
+
"data-named-agent-remove": "",
|
|
51
|
+
onClick: () => remove(agent, index),
|
|
52
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { "aria-hidden": "true", className: "size-3" })
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] }) }, agent.ref))
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
exports.ComposerNamedAgents = ComposerNamedAgents;
|
|
63
|
+
//# sourceMappingURL=ComposerNamedAgents.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComposerNamedAgents.cjs","sources":["../../src/composer/ComposerNamedAgents.tsx"],"sourcesContent":["import {\n type DeepAgentNamedAgent,\n removeDeepAgentNamedAgent,\n useDeepAgentNamedAgents,\n} from '@athenaintel/agent-runtime/named-agents';\nimport { BotIcon, XIcon } from 'lucide-react';\nimport { type FC, useRef } from 'react';\nimport { cn } from '../lib/utils';\n\nexport interface ComposerNamedAgentsProps {\n /** The conversation whose next message the chips name agents for. */\n threadId: string;\n /** The last named agent was removed: where focus goes next (the editor). */\n onEmptied?: () => void;\n className?: string;\n}\n\n/**\n * The composer's To line (identity v7 D13), as Olympus's composer shows it: the agents the person\n * named from the `@` menu's Agents section, in the order named, each answering the message in its\n * own turn and each with a labelled remove button. They stay for every message until the person\n * changes them. Renders nothing while none are named. Removing an agent hands focus to the chip that\n * took its place, else the one before it, else back to the editor (`onEmptied`).\n */\nexport const ComposerNamedAgents: FC<ComposerNamedAgentsProps> = ({\n threadId,\n onEmptied,\n className,\n}) => {\n const agents = useDeepAgentNamedAgents(threadId);\n const listRef = useRef<HTMLUListElement>(null);\n if (agents.length === 0) return null;\n\n const remove = (agent: DeepAgentNamedAgent, index: number): void => {\n removeDeepAgentNamedAgent({ threadId, ref: agent.ref });\n // After React has painted the row without the chip (or unmounted it).\n requestAnimationFrame(() => {\n const buttons = listRef.current?.querySelectorAll<HTMLButtonElement>(\n 'button[data-named-agent-remove]',\n );\n const next = buttons?.length ? buttons[Math.min(index, buttons.length - 1)] : undefined;\n if (next) next.focus();\n else onEmptied?.();\n });\n };\n\n return (\n <div\n className={cn('aui-composer-named-agents mx-3 mt-2 flex items-start gap-2', className)}\n data-testid=\"athena-named-agents\"\n >\n <span aria-hidden=\"true\" className=\"py-0.5 text-muted-foreground text-xs\">\n To\n </span>\n <ul\n ref={listRef}\n aria-label=\"Agents this message goes to\"\n className=\"flex min-w-0 flex-1 flex-wrap gap-1.5\"\n >\n {agents.map((agent, index) => (\n <li key={agent.ref} className=\"min-w-0\" data-named-agent={agent.ref}>\n <span className=\"inline-flex max-w-full items-center gap-1 rounded-md border border-border bg-muted/60 py-0 pr-0.5 pl-1.5 font-medium text-foreground text-xs\">\n <BotIcon aria-hidden=\"true\" className=\"size-3 shrink-0 text-muted-foreground\" />\n <span className=\"max-w-48 truncate\">{agent.name}</span>\n <button\n type=\"button\"\n className=\"inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n aria-label={`Remove ${agent.name}`}\n data-named-agent-remove=\"\"\n onClick={() => remove(agent, index)}\n >\n <XIcon aria-hidden=\"true\" className=\"size-3\" />\n </button>\n </span>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"],"names":["useDeepAgentNamedAgents","useRef","removeDeepAgentNamedAgent","jsxs","cn","jsx","BotIcon","XIcon"],"mappings":";;;;;;;AAwBO,MAAM,sBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAASA,YAAAA,wBAAwB,QAAQ;AAC/C,QAAM,UAAUC,WAAAA,OAAyB,IAAI;AAC7C,MAAI,OAAO,WAAW,EAAG,QAAO;AAEhC,QAAM,SAAS,CAAC,OAA4B,UAAwB;AAClEC,gBAAAA,0BAA0B,EAAE,UAAU,KAAK,MAAM,KAAK;AAEtD,0BAAsB,MAAM;;AAC1B,YAAM,WAAU,aAAQ,YAAR,mBAAiB;AAAA,QAC/B;AAAA;AA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amedAgentsProps {
|
|
3
|
+
/** The conversation whose next message the chips name agents for. */
|
|
4
|
+
threadId: string;
|
|
5
|
+
/** The last named agent was removed: where focus goes next (the editor). */
|
|
6
|
+
onEmptied?: () => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The composer's To line (identity v7 D13), as Olympus's composer shows it: the agents the person
|
|
11
|
+
* named from the `@` menu's Agents section, in the order named, each answering the message in its
|
|
12
|
+
* own turn and each with a labelled remove button. They stay for every message until the person
|
|
13
|
+
* changes them. Renders nothing while none are named. Removing an agent hands focus to the chip that
|
|
14
|
+
* took its place, else the one before it, else back to the editor (`onEmptied`).
|
|
15
|
+
*/
|
|
16
|
+
export declare const ComposerNamedAgents: FC<ComposerNamedAgentsProps>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useDeepAgentNamedAgents, removeDeepAgentNamedAgent } from "../agent-runtime/src/named-agents.js";
|
|
3
|
+
import { BotIcon, XIcon } from "lucide-react";
|
|
4
|
+
import { useRef } from "react";
|
|
5
|
+
import { cn } from "cnfast";
|
|
6
|
+
const ComposerNamedAgents = ({
|
|
7
|
+
threadId,
|
|
8
|
+
onEmptied,
|
|
9
|
+
className
|
|
10
|
+
}) => {
|
|
11
|
+
const agents = useDeepAgentNamedAgents(threadId);
|
|
12
|
+
const listRef = useRef(null);
|
|
13
|
+
if (agents.length === 0) return null;
|
|
14
|
+
const remove = (agent, index) => {
|
|
15
|
+
removeDeepAgentNamedAgent({ threadId, ref: agent.ref });
|
|
16
|
+
requestAnimationFrame(() => {
|
|
17
|
+
var _a;
|
|
18
|
+
const buttons = (_a = listRef.current) == null ? void 0 : _a.querySelectorAll(
|
|
19
|
+
"button[data-named-agent-remove]"
|
|
20
|
+
);
|
|
21
|
+
const next = (buttons == null ? void 0 : buttons.length) ? buttons[Math.min(index, buttons.length - 1)] : void 0;
|
|
22
|
+
if (next) next.focus();
|
|
23
|
+
else onEmptied == null ? void 0 : onEmptied();
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsxs(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: cn("aui-composer-named-agents mx-3 mt-2 flex items-start gap-2", className),
|
|
30
|
+
"data-testid": "athena-named-agents",
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "py-0.5 text-muted-foreground text-xs", children: "To" }),
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
"ul",
|
|
35
|
+
{
|
|
36
|
+
ref: listRef,
|
|
37
|
+
"aria-label": "Agents this message goes to",
|
|
38
|
+
className: "flex min-w-0 flex-1 flex-wrap gap-1.5",
|
|
39
|
+
children: agents.map((agent, index) => /* @__PURE__ */ jsx("li", { className: "min-w-0", "data-named-agent": agent.ref, children: /* @__PURE__ */ jsxs("span", { className: "inline-flex max-w-full items-center gap-1 rounded-md border border-border bg-muted/60 py-0 pr-0.5 pl-1.5 font-medium text-foreground text-xs", children: [
|
|
40
|
+
/* @__PURE__ */ jsx(BotIcon, { "aria-hidden": "true", className: "size-3 shrink-0 text-muted-foreground" }),
|
|
41
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-48 truncate", children: agent.name }),
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
"button",
|
|
44
|
+
{
|
|
45
|
+
type: "button",
|
|
46
|
+
className: "inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
47
|
+
"aria-label": `Remove ${agent.name}`,
|
|
48
|
+
"data-named-agent-remove": "",
|
|
49
|
+
onClick: () => remove(agent, index),
|
|
50
|
+
children: /* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true", className: "size-3" })
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] }) }, agent.ref))
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
ComposerNamedAgents
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=ComposerNamedAgents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComposerNamedAgents.js","sources":["../../src/composer/ComposerNamedAgents.tsx"],"sourcesContent":["import {\n type DeepAgentNamedAgent,\n removeDeepAgentNamedAgent,\n useDeepAgentNamedAgents,\n} from '@athenaintel/agent-runtime/named-agents';\nimport { BotIcon, XIcon } from 'lucide-react';\nimport { type FC, useRef } from 'react';\nimport { cn } from '../lib/utils';\n\nexport interface ComposerNamedAgentsProps {\n /** The conversation whose next message the chips name agents for. */\n threadId: string;\n /** The last named agent was removed: where focus goes next (the editor). */\n onEmptied?: () => void;\n className?: string;\n}\n\n/**\n * The composer's To line (identity v7 D13), as Olympus's composer shows it: the agents the person\n * named from the `@` menu's Agents section, in the order named, each answering the message in its\n * own turn and each with a labelled remove button. They stay for every message until the person\n * changes them. Renders nothing while none are named. Removing an agent hands focus to the chip that\n * took its place, else the one before it, else back to the editor (`onEmptied`).\n */\nexport const ComposerNamedAgents: FC<ComposerNamedAgentsProps> = ({\n threadId,\n onEmptied,\n className,\n}) => {\n const agents = useDeepAgentNamedAgents(threadId);\n const listRef = useRef<HTMLUListElement>(null);\n if (agents.length === 0) return null;\n\n const remove = (agent: DeepAgentNamedAgent, index: number): void => {\n removeDeepAgentNamedAgent({ threadId, ref: agent.ref });\n // After React has painted the row without the chip (or unmounted it).\n requestAnimationFrame(() => {\n const buttons = listRef.current?.querySelectorAll<HTMLButtonElement>(\n 'button[data-named-agent-remove]',\n );\n const next = buttons?.length ? buttons[Math.min(index, buttons.length - 1)] : undefined;\n if (next) next.focus();\n else onEmptied?.();\n });\n };\n\n return (\n <div\n className={cn('aui-composer-named-agents mx-3 mt-2 flex items-start gap-2', className)}\n data-testid=\"athena-named-agents\"\n >\n <span aria-hidden=\"true\" className=\"py-0.5 text-muted-foreground text-xs\">\n To\n </span>\n <ul\n ref={listRef}\n aria-label=\"Agents this message goes to\"\n className=\"flex min-w-0 flex-1 flex-wrap gap-1.5\"\n >\n {agents.map((agent, index) => (\n <li key={agent.ref} className=\"min-w-0\" data-named-agent={agent.ref}>\n <span className=\"inline-flex max-w-full items-center gap-1 rounded-md border border-border bg-muted/60 py-0 pr-0.5 pl-1.5 font-medium text-foreground text-xs\">\n <BotIcon aria-hidden=\"true\" className=\"size-3 shrink-0 text-muted-foreground\" />\n <span className=\"max-w-48 truncate\">{agent.name}</span>\n <button\n type=\"button\"\n className=\"inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n aria-label={`Remove ${agent.name}`}\n data-named-agent-remove=\"\"\n onClick={() => remove(agent, index)}\n >\n <XIcon aria-hidden=\"true\" className=\"size-3\" />\n </button>\n </span>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AAwBO,MAAM,sBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAAS,wBAAwB,QAAQ;AAC/C,QAAM,UAAU,OAAyB,IAAI;AAC7C,MAAI,OAAO,WAAW,EAAG,QAAO;AAEhC,QAAM,SAAS,CAAC,OAA4B,UAAwB;AAClE,8BAA0B,EAAE,UAAU,KAAK,MAAM,KAAK;AAEtD,0BAAsB,MAAM;;AAC1B,YAAM,WAAU,aAAQ,YAAR,mBAAiB;AAAA,QAC/B;AAAA;AAEF,YAAM,QAAO,mCAAS,UAAS,QAAQ,KAAK,IAAI,OAAO,QAAQ,SAAS,CAAC,CAAC,IAAI;AAC9E,UAAI,WAAW,MAAA;AAAA,UACV;AAAA,IACP,CAAC;AAAA,EACH;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,GAAG,8DAA8D,SAAS;AAAA,MACrF,eAAY;AAAA,MAEZ,UAAA;AAAA,QAAA,oBAAC,QAAA,EAAK,eAAY,QAAO,WAAU,wCAAuC,UAAA,MAE1E;AAAA,QACA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAK;AAAA,YACL,cAAW;AAAA,YACX,WAAU;AAAA,YAET,UAAA,OAAO,IAAI,CAAC,OAAO,UAClB,oBAAC,MAAA,EAAmB,WAAU,WAAU,oBAAkB,MAAM,KAC9D,UAAA,qBAAC,QAAA,EAAK,WAAU,gJACd,UAAA;AAAA,cAAA,oBAAC,SAAA,EAAQ,eAAY,QAAO,WAAU,yCAAwC;AAAA,cAC9E,oBAAC,QAAA,EAAK,WAAU,qBAAqB,gBAAM,MAAK;AAAA,cAChD;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,MAAK;AAAA,kBACL,WAAU;AAAA,kBACV,cAAY,UAAU,MAAM,IAAI;AAAA,kBAChC,2BAAwB;AAAA,kBACxB,SAAS,MAAM,OAAO,OAAO,KAAK;AAAA,kBAElC,UAAA,oBAAC,OAAA,EAAM,eAAY,QAAO,WAAU,SAAA,CAAS;AAAA,gBAAA;AAAA,cAAA;AAAA,YAC/C,GACF,EAAA,GAbO,MAAM,GAcf,CACD;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const attachable = require("../references/src/attachable.cjs");
|
|
4
|
+
const require$$0 = require("react");
|
|
5
|
+
const EMPTY = Object.freeze([]);
|
|
6
|
+
const pending = /* @__PURE__ */ new Map();
|
|
7
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
8
|
+
let attachedForIdentity = null;
|
|
9
|
+
function notify() {
|
|
10
|
+
for (const listener of [...listeners]) listener();
|
|
11
|
+
}
|
|
12
|
+
function subscribe(listener) {
|
|
13
|
+
listeners.add(listener);
|
|
14
|
+
return () => {
|
|
15
|
+
listeners.delete(listener);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function setPending(threadId, references) {
|
|
19
|
+
if (references.length === 0) pending.delete(threadId);
|
|
20
|
+
else pending.set(threadId, Object.freeze([...references]));
|
|
21
|
+
notify();
|
|
22
|
+
}
|
|
23
|
+
function attachReferenceToThread({
|
|
24
|
+
threadId,
|
|
25
|
+
reference
|
|
26
|
+
}) {
|
|
27
|
+
if (!threadId) return { attached: false, reason: "no_thread" };
|
|
28
|
+
const normalized = attachable.normalizeAttachableReference(reference);
|
|
29
|
+
if (normalized === null) return { attached: false, reason: "invalid_reference" };
|
|
30
|
+
const key = attachable.attachableReferenceKey(normalized);
|
|
31
|
+
const current = pending.get(threadId) ?? EMPTY;
|
|
32
|
+
const index = current.findIndex((entry) => attachable.attachableReferenceKey(entry) === key);
|
|
33
|
+
if (index >= 0) {
|
|
34
|
+
setPending(
|
|
35
|
+
threadId,
|
|
36
|
+
current.map((entry, position) => position === index ? normalized : entry)
|
|
37
|
+
);
|
|
38
|
+
return { attached: true, reference: normalized, duplicate: true };
|
|
39
|
+
}
|
|
40
|
+
if (current.length >= attachable.MAX_ATTACHED_REFERENCES) return { attached: false, reason: "too_many" };
|
|
41
|
+
setPending(threadId, [...current, normalized]);
|
|
42
|
+
return { attached: true, reference: normalized, duplicate: false };
|
|
43
|
+
}
|
|
44
|
+
function detachReferenceFromThread({
|
|
45
|
+
threadId,
|
|
46
|
+
reference
|
|
47
|
+
}) {
|
|
48
|
+
if (!threadId) return;
|
|
49
|
+
const current = pending.get(threadId);
|
|
50
|
+
if (!current) return;
|
|
51
|
+
const key = attachable.attachableReferenceKey(reference);
|
|
52
|
+
const kept = current.filter((entry) => attachable.attachableReferenceKey(entry) !== key);
|
|
53
|
+
if (kept.length !== current.length) setPending(threadId, kept);
|
|
54
|
+
}
|
|
55
|
+
function clearAttachedReferences(threadId) {
|
|
56
|
+
if (!threadId || !pending.has(threadId)) return;
|
|
57
|
+
setPending(threadId, EMPTY);
|
|
58
|
+
}
|
|
59
|
+
function readPendingAttachedReferences(threadId) {
|
|
60
|
+
return (threadId ? pending.get(threadId) : void 0) ?? EMPTY;
|
|
61
|
+
}
|
|
62
|
+
function usePendingAttachedReferences(threadId) {
|
|
63
|
+
const read = require$$0.useCallback(() => readPendingAttachedReferences(threadId), [threadId]);
|
|
64
|
+
return require$$0.useSyncExternalStore(subscribe, read, read);
|
|
65
|
+
}
|
|
66
|
+
function forgetAllAttachedReferences() {
|
|
67
|
+
pending.clear();
|
|
68
|
+
stagedForSend.clear();
|
|
69
|
+
sentWithText.clear();
|
|
70
|
+
notify();
|
|
71
|
+
}
|
|
72
|
+
function keepAttachedReferencesForIdentity(identity) {
|
|
73
|
+
if (attachedForIdentity !== null && attachedForIdentity !== identity) {
|
|
74
|
+
forgetAllAttachedReferences();
|
|
75
|
+
}
|
|
76
|
+
attachedForIdentity = identity;
|
|
77
|
+
}
|
|
78
|
+
const ATTACHED_REFERENCES_STAGED_TTL_MS = 1e4;
|
|
79
|
+
const stagedForSend = /* @__PURE__ */ new Map();
|
|
80
|
+
function stageAttachedReferencesForSend({
|
|
81
|
+
threadId,
|
|
82
|
+
references
|
|
83
|
+
}) {
|
|
84
|
+
if (!threadId) return;
|
|
85
|
+
if (references.length === 0) {
|
|
86
|
+
stagedForSend.delete(threadId);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
stagedForSend.set(threadId, { references, stagedAt: Date.now() });
|
|
90
|
+
}
|
|
91
|
+
function takeStagedAttachedReferences(threadId) {
|
|
92
|
+
const staged = stagedForSend.get(threadId);
|
|
93
|
+
stagedForSend.delete(threadId);
|
|
94
|
+
if (!staged || Date.now() - staged.stagedAt > ATTACHED_REFERENCES_STAGED_TTL_MS) return EMPTY;
|
|
95
|
+
return staged.references;
|
|
96
|
+
}
|
|
97
|
+
function withStagedAttachedReferences(threadId, metadata) {
|
|
98
|
+
const references = takeStagedAttachedReferences(threadId);
|
|
99
|
+
return references.length === 0 ? metadata : attachable.withAttachedReferences(metadata, references);
|
|
100
|
+
}
|
|
101
|
+
const SENT_TEXTS_KEPT_PER_THREAD = 20;
|
|
102
|
+
const THREADS_WITH_SENT_TEXTS_KEPT = 50;
|
|
103
|
+
const sentWithText = /* @__PURE__ */ new Map();
|
|
104
|
+
function setBounded(map, key, value, limit) {
|
|
105
|
+
map.delete(key);
|
|
106
|
+
map.set(key, value);
|
|
107
|
+
while (map.size > limit) {
|
|
108
|
+
const oldest = map.keys().next();
|
|
109
|
+
if (oldest.done) break;
|
|
110
|
+
map.delete(oldest.value);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function stageThreadAttachedReferencesForSend({
|
|
114
|
+
threadId,
|
|
115
|
+
text
|
|
116
|
+
}) {
|
|
117
|
+
const references = readPendingAttachedReferences(threadId);
|
|
118
|
+
stageAttachedReferencesForSend({ threadId, references });
|
|
119
|
+
if (!threadId) return references;
|
|
120
|
+
const texts = sentWithText.get(threadId);
|
|
121
|
+
if (references.length === 0) {
|
|
122
|
+
texts == null ? void 0 : texts.delete(text);
|
|
123
|
+
return references;
|
|
124
|
+
}
|
|
125
|
+
const kept = texts ?? /* @__PURE__ */ new Map();
|
|
126
|
+
setBounded(kept, text, references, SENT_TEXTS_KEPT_PER_THREAD);
|
|
127
|
+
setBounded(sentWithText, threadId, kept, THREADS_WITH_SENT_TEXTS_KEPT);
|
|
128
|
+
clearAttachedReferences(threadId);
|
|
129
|
+
return references;
|
|
130
|
+
}
|
|
131
|
+
function reattach(threadId, references) {
|
|
132
|
+
for (const reference of references) attachReferenceToThread({ threadId, reference });
|
|
133
|
+
}
|
|
134
|
+
function restoreSentAttachedReferences({
|
|
135
|
+
threadId,
|
|
136
|
+
text
|
|
137
|
+
}) {
|
|
138
|
+
var _a;
|
|
139
|
+
const references = (_a = sentWithText.get(threadId)) == null ? void 0 : _a.get(text);
|
|
140
|
+
if (references) reattach(threadId, references);
|
|
141
|
+
}
|
|
142
|
+
function giveBackHeldAttachedReferences(entry) {
|
|
143
|
+
reattach(entry.threadId, attachable.readAttachedReferences(entry.metadata));
|
|
144
|
+
}
|
|
145
|
+
exports.ATTACHED_REFERENCES_STAGED_TTL_MS = ATTACHED_REFERENCES_STAGED_TTL_MS;
|
|
146
|
+
exports.attachReferenceToThread = attachReferenceToThread;
|
|
147
|
+
exports.clearAttachedReferences = clearAttachedReferences;
|
|
148
|
+
exports.detachReferenceFromThread = detachReferenceFromThread;
|
|
149
|
+
exports.forgetAllAttachedReferences = forgetAllAttachedReferences;
|
|
150
|
+
exports.giveBackHeldAttachedReferences = giveBackHeldAttachedReferences;
|
|
151
|
+
exports.keepAttachedReferencesForIdentity = keepAttachedReferencesForIdentity;
|
|
152
|
+
exports.readPendingAttachedReferences = readPendingAttachedReferences;
|
|
153
|
+
exports.restoreSentAttachedReferences = restoreSentAttachedReferences;
|
|
154
|
+
exports.stageAttachedReferencesForSend = stageAttachedReferencesForSend;
|
|
155
|
+
exports.stageThreadAttachedReferencesForSend = stageThreadAttachedReferencesForSend;
|
|
156
|
+
exports.takeStagedAttachedReferences = takeStagedAttachedReferences;
|
|
157
|
+
exports.usePendingAttachedReferences = usePendingAttachedReferences;
|
|
158
|
+
exports.withStagedAttachedReferences = withStagedAttachedReferences;
|
|
159
|
+
//# sourceMappingURL=attached-references.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attached-references.cjs","sources":["../../src/composer/attached-references.ts"],"sourcesContent":["import {\n type AttachableReference,\n attachableReferenceKey,\n MAX_ATTACHED_REFERENCES,\n normalizeAttachableReference,\n readAttachedReferences as readMessageAttachedReferences,\n withAttachedReferences,\n} from '@athenaintel/references/attachable';\nimport { useCallback, useSyncExternalStore } from 'react';\n\n/**\n * What each conversation's next message carries as attached references (`useAttachToChat`), and\n * the hand-off of that list to the message that leaves.\n *\n * - **The pending list.** Per thread, in the order attached, each reference once (by kind and\n * pointer, an asset's anchor included), at most {@link MAX_ATTACHED_REFERENCES}. The composer\n * shows it as removable chips (`ComposerAttachedReferences`). It is kept in memory for the page\n * and dropped when the signed-in identity changes ({@link keepAttachedReferencesForIdentity}):\n * what one person attached is never sent as someone else's.\n * - **The send.** statewire captures a new message's metadata once, as it journals it\n * (`getMessageMetadata`), without saying which message it is for. So the composer stages the\n * list right before `aui.composer.send` ({@link stageAttachedReferencesForSend}) and the runtime's\n * getter takes it for the message that follows ({@link withStagedAttachedReferences}).\n * The references then ride the message's own metadata (`attachedReferences`), never its text, so\n * a send that waits, is retried or is posted again after a reload keeps its own attachments. A\n * slot nobody takes expires. Both send paths stage them ({@link stageThreadAttachedReferencesForSend}):\n * `AthenaChat`'s composed send, and `TiptapComposer`'s own through its host's `prepareSend`\n * (`useAttachedReferencesComposerProps`). A composer whose host doesn't opt in sends none and\n * never loads this module (the Office pane's budget counts on it).\n * - **The way back.** Sending takes the chips off the composer, and they come back with the send:\n * a send statewire refuses and hands back ({@link restoreSentAttachedReferences}, by its text),\n * or a message held in the chat outbox that is cancelled or edited\n * ({@link giveBackHeldAttachedReferences}, from its metadata).\n *\n * agora reads the list off the message, refuses whatever it can't read, and resolves each one with\n * the person's own permission before the agent is told about it; the client never gates.\n */\n\nconst EMPTY: readonly AttachableReference[] = Object.freeze([]);\n\n// process-local: client-only — the references each thread's composer sends with its next message.\nconst pending = new Map<string, readonly AttachableReference[]>();\nconst listeners = new Set<() => void>();\nlet attachedForIdentity: string | null = null;\n\nfunction notify(): void {\n for (const listener of [...listeners]) listener();\n}\n\nfunction subscribe(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nfunction setPending(threadId: string, references: readonly AttachableReference[]): void {\n if (references.length === 0) pending.delete(threadId);\n else pending.set(threadId, Object.freeze([...references]));\n notify();\n}\n\n/** Why a reference was not attached. */\nexport type AttachRefusalReason =\n /** Not a reference an app may attach (an unknown kind, a malformed id, URL or anchor). */\n | 'invalid_reference'\n /** The next message already carries {@link MAX_ATTACHED_REFERENCES}. */\n | 'too_many'\n /** No conversation to attach it to (outside `<AthenaProvider>`'s chat). */\n | 'no_thread';\n\n/** What `attach` did. */\nexport type AttachReferenceResult =\n | {\n attached: true;\n /** The reference as it will be sent (normalized: unknown fields dropped, label cut). */\n reference: AttachableReference;\n /** It was attached already; its label is updated and it keeps its place. */\n duplicate: boolean;\n }\n | { attached: false; reason: AttachRefusalReason };\n\n/** Attach `reference` to `threadId`'s next message. */\nexport function attachReferenceToThread({\n threadId,\n reference,\n}: {\n threadId: string | null;\n reference: unknown;\n}): AttachReferenceResult {\n if (!threadId) return { attached: false, reason: 'no_thread' };\n const normalized = normalizeAttachableReference(reference);\n if (normalized === null) return { attached: false, reason: 'invalid_reference' };\n const key = attachableReferenceKey(normalized);\n const current = pending.get(threadId) ?? EMPTY;\n const index = current.findIndex((entry) => attachableReferenceKey(entry) === key);\n if (index >= 0) {\n setPending(\n threadId,\n current.map((entry, position) => (position === index ? normalized : entry)),\n );\n return { attached: true, reference: normalized, duplicate: true };\n }\n if (current.length >= MAX_ATTACHED_REFERENCES) return { attached: false, reason: 'too_many' };\n setPending(threadId, [...current, normalized]);\n return { attached: true, reference: normalized, duplicate: false };\n}\n\n/** Take `reference` (matched by kind and pointer) off `threadId`'s next message. */\nexport function detachReferenceFromThread({\n threadId,\n reference,\n}: {\n threadId: string | null;\n reference: AttachableReference;\n}): void {\n if (!threadId) return;\n const current = pending.get(threadId);\n if (!current) return;\n const key = attachableReferenceKey(reference);\n const kept = current.filter((entry) => attachableReferenceKey(entry) !== key);\n if (kept.length !== current.length) setPending(threadId, kept);\n}\n\n/** Take every reference off `threadId`'s next message. */\nexport function clearAttachedReferences(threadId: string | null): void {\n if (!threadId || !pending.has(threadId)) return;\n setPending(threadId, EMPTY);\n}\n\n/** The references `threadId`'s next message carries, in the order attached. */\nexport function readPendingAttachedReferences(threadId: string | null): readonly AttachableReference[] {\n return (threadId ? pending.get(threadId) : undefined) ?? EMPTY;\n}\n\n/** {@link readPendingAttachedReferences}, re-rendering when the list changes. */\nexport function usePendingAttachedReferences(threadId: string | null): readonly AttachableReference[] {\n const read = useCallback(() => readPendingAttachedReferences(threadId), [threadId]);\n return useSyncExternalStore(subscribe, read, read);\n}\n\n/** Forget every pending, staged and sent reference (tests, and a change of identity). */\nexport function forgetAllAttachedReferences(): void {\n pending.clear();\n stagedForSend.clear();\n sentWithText.clear();\n notify();\n}\n\n/**\n * Keep the pending references only while `identity` (the signed-in person) stays the same: a\n * change forgets every one, so nothing attached under one identity is sent under another.\n */\nexport function keepAttachedReferencesForIdentity(identity: string): void {\n if (attachedForIdentity !== null && attachedForIdentity !== identity) {\n forgetAllAttachedReferences();\n }\n attachedForIdentity = identity;\n}\n\n// ── The send ────────────────────────────────────────────────────────────────\n\n/** How long staged references wait for the message they were staged for before they expire. */\nexport const ATTACHED_REFERENCES_STAGED_TTL_MS = 10_000;\n\n// process-local: client-only — the references each thread's composer staged for the message it\n// submits next, taken once by the runtime's `getMessageMetadata`.\nconst stagedForSend = new Map<\n string,\n { references: readonly AttachableReference[]; stagedAt: number }\n>();\n\n/**\n * Stage `references` for the message `threadId`'s composer submits next. Call right before the send\n * (`aui.composer.send`). A send attaching nothing stages nothing and lets an earlier slot go.\n */\nexport function stageAttachedReferencesForSend({\n threadId,\n references,\n}: {\n threadId: string;\n references: readonly AttachableReference[];\n}): void {\n if (!threadId) return;\n if (references.length === 0) {\n stagedForSend.delete(threadId);\n return;\n }\n stagedForSend.set(threadId, { references, stagedAt: Date.now() });\n}\n\n/** The references staged for the message `threadId` journals now, taking the slot. */\nexport function takeStagedAttachedReferences(threadId: string): readonly AttachableReference[] {\n const staged = stagedForSend.get(threadId);\n stagedForSend.delete(threadId);\n if (!staged || Date.now() - staged.stagedAt > ATTACHED_REFERENCES_STAGED_TTL_MS) return EMPTY;\n return staged.references;\n}\n\n/**\n * The metadata a runtime's `getMessageMetadata` adds for the message `threadId` journals now: the\n * references staged for it under `attachedReferences`, taking the slot, over `metadata` (what the\n * rest of the getter produced). `metadata` unchanged when none are staged.\n */\nexport function withStagedAttachedReferences(\n threadId: string,\n metadata: Record<string, unknown> | undefined,\n): Record<string, unknown> | undefined {\n const references = takeStagedAttachedReferences(threadId);\n return references.length === 0 ? metadata : withAttachedReferences(metadata, references);\n}\n\n/** How many sent texts each thread remembers the references of, and how many threads. */\nconst SENT_TEXTS_KEPT_PER_THREAD = 20;\nconst THREADS_WITH_SENT_TEXTS_KEPT = 50;\n\n// process-local: client-only — the references each recent send carried, by its text, so a send\n// handed back (statewire refused it during a reconnect) brings its chips back.\nconst sentWithText = new Map<string, Map<string, readonly AttachableReference[]>>();\n\nfunction setBounded<K, V>(map: Map<K, V>, key: K, value: V, limit: number): void {\n map.delete(key);\n map.set(key, value);\n while (map.size > limit) {\n const oldest = map.keys().next();\n if (oldest.done) break;\n map.delete(oldest.value);\n }\n}\n\n/**\n * Right before `threadId`'s composer sends `text`: stage the references pending for it, remember\n * them with the text (so the text coming back brings them back) and take them off the composer.\n * Returns what the message carries, `[]` when nothing was attached.\n */\nexport function stageThreadAttachedReferencesForSend({\n threadId,\n text,\n}: {\n threadId: string;\n text: string;\n}): readonly AttachableReference[] {\n const references = readPendingAttachedReferences(threadId);\n stageAttachedReferencesForSend({ threadId, references });\n if (!threadId) return references;\n const texts = sentWithText.get(threadId);\n if (references.length === 0) {\n texts?.delete(text);\n return references;\n }\n const kept = texts ?? new Map<string, readonly AttachableReference[]>();\n setBounded(kept, text, references, SENT_TEXTS_KEPT_PER_THREAD);\n setBounded(sentWithText, threadId, kept, THREADS_WITH_SENT_TEXTS_KEPT);\n clearAttachedReferences(threadId);\n return references;\n}\n\nfunction reattach(threadId: string, references: readonly AttachableReference[]): void {\n for (const reference of references) attachReferenceToThread({ threadId, reference });\n}\n\n/**\n * Text a send carried came back to `threadId`'s composer (statewire handed a refused send back):\n * the references it carried come back as chips, after any attached since.\n */\nexport function restoreSentAttachedReferences({\n threadId,\n text,\n}: {\n threadId: string;\n text: string;\n}): void {\n const references = sentWithText.get(threadId)?.get(text);\n if (references) reattach(threadId, references);\n}\n\n/**\n * A message held in the chat outbox was given back to the composer (Cancel, Edit): the references\n * its metadata carries come back as chips.\n */\nexport function giveBackHeldAttachedReferences(entry: {\n threadId: string;\n metadata?: unknown;\n}): void {\n reattach(entry.threadId, readMessageAttachedReferences(entry.metadata));\n}\n"],"names":["normalizeAttachableReference","attachableReferenceKey","MAX_ATTACHED_REFERENCES","useCallback","useSyncExternalStore","withAttachedReferences","readMessageAttachedReferences"],"mappings":";;;;AAsCA,MAAM,QAAwC,OAAO,OAAO,EAAE;AAG9D,MAAM,8BAAc,IAAA;AACpB,MAAM,gCAAgB,IAAA;AACtB,IAAI,sBAAqC;AAEzC,SAAS,SAAe;AACtB,aAAW,YAAY,CAAC,GAAG,SAAS,EAAG,UAAA;AACzC;AAEA,SAAS,UAAU,UAAkC;AACnD,YAAU,IAAI,QAAQ;AACtB,SAAO,MAAM;AACX,cAAU,OAAO,QAAQ;AAAA,EAC3B;AACF;AAEA,SAAS,WAAW,UAAkB,YAAkD;AACtF,MAAI,WAAW,WAAW,EAAG,SAAQ,OAAO,QAAQ;AAAA,MAC/C,SAAQ,IAAI,UAAU,OAAO,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC;AACzD,SAAA;AACF;AAuBO,SAAS,wBAAwB;AAAA,EACtC;AAAA,EACA;AACF,GAG0B;AACxB,MAAI,CAAC,SAAU,QAAO,EAAE,UAAU,OAAO,QAAQ,YAAA;AACjD,QAAM,aAAaA,WAAAA,6BAA6B,SAAS;AACzD,MAAI,eAAe,KAAM,QAAO,EAAE,UAAU,OAAO,QAAQ,oBAAA;AAC3D,QAAM,MAAMC,WAAAA,uBAAuB,UAAU;AAC7C,QAAM,UAAU,QAAQ,IAAI,QAAQ,KAAK;AACzC,QAAM,QAAQ,QAAQ,UAAU,CAAC,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,oBAAI,IAAA;AAC1B,aAAW,MAAM,MAAM,YAAY,0BAA0B;AAC7D,aAAW,cAAc,UAAU,MAAM,4BAA4B;AACrE,0BAAwB,QAAQ;AAChC,SAAO;AACT;AAEA,SAAS,SAAS,UAAkB,YAAkD;AACpF,aAAW,aAAa,WAAY,yBAAwB,EAAE,UAAU,WAAW;AACrF;AAMO,SAAS,8BAA8B;AAAA,EAC5C;AAAA,EACA;AACF,GAGS;;AACP,QAAM,cAAa,kBAAa,IAAI,QAAQ,MAAzB,mBAA4B,IAAI;AACnD,MAAI,WAAY,UAAS,UAAU,UAAU;AAC/C;AAMO,SAAS,+BAA+B,OAGtC;AACP,WAAS,MAAM,UAAUC,WAAAA,uBAA8B,MAAM,QAAQ,CAAC;AACxE;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type AttachableReference } from '../references/src/attachable';
|
|
2
|
+
/** Why a reference was not attached. */
|
|
3
|
+
export type AttachRefusalReason =
|
|
4
|
+
/** Not a reference an app may attach (an unknown kind, a malformed id, URL or anchor). */
|
|
5
|
+
'invalid_reference'
|
|
6
|
+
/** The next message already carries {@link MAX_ATTACHED_REFERENCES}. */
|
|
7
|
+
| 'too_many'
|
|
8
|
+
/** No conversation to attach it to (outside `<AthenaProvider>`'s chat). */
|
|
9
|
+
| 'no_thread';
|
|
10
|
+
/** What `attach` did. */
|
|
11
|
+
export type AttachReferenceResult = {
|
|
12
|
+
attached: true;
|
|
13
|
+
/** The reference as it will be sent (normalized: unknown fields dropped, label cut). */
|
|
14
|
+
reference: AttachableReference;
|
|
15
|
+
/** It was attached already; its label is updated and it keeps its place. */
|
|
16
|
+
duplicate: boolean;
|
|
17
|
+
} | {
|
|
18
|
+
attached: false;
|
|
19
|
+
reason: AttachRefusalReason;
|
|
20
|
+
};
|
|
21
|
+
/** Attach `reference` to `threadId`'s next message. */
|
|
22
|
+
export declare function attachReferenceToThread({ threadId, reference, }: {
|
|
23
|
+
threadId: string | null;
|
|
24
|
+
reference: unknown;
|
|
25
|
+
}): AttachReferenceResult;
|
|
26
|
+
/** Take `reference` (matched by kind and pointer) off `threadId`'s next message. */
|
|
27
|
+
export declare function detachReferenceFromThread({ threadId, reference, }: {
|
|
28
|
+
threadId: string | null;
|
|
29
|
+
reference: AttachableReference;
|
|
30
|
+
}): void;
|
|
31
|
+
/** Take every reference off `threadId`'s next message. */
|
|
32
|
+
export declare function clearAttachedReferences(threadId: string | null): void;
|
|
33
|
+
/** The references `threadId`'s next message carries, in the order attached. */
|
|
34
|
+
export declare function readPendingAttachedReferences(threadId: string | null): readonly AttachableReference[];
|
|
35
|
+
/** {@link readPendingAttachedReferences}, re-rendering when the list changes. */
|
|
36
|
+
export declare function usePendingAttachedReferences(threadId: string | null): readonly AttachableReference[];
|
|
37
|
+
/** Forget every pending, staged and sent reference (tests, and a change of identity). */
|
|
38
|
+
export declare function forgetAllAttachedReferences(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Keep the pending references only while `identity` (the signed-in person) stays the same: a
|
|
41
|
+
* change forgets every one, so nothing attached under one identity is sent under another.
|
|
42
|
+
*/
|
|
43
|
+
export declare function keepAttachedReferencesForIdentity(identity: string): void;
|
|
44
|
+
/** How long staged references wait for the message they were staged for before they expire. */
|
|
45
|
+
export declare const ATTACHED_REFERENCES_STAGED_TTL_MS = 10000;
|
|
46
|
+
/**
|
|
47
|
+
* Stage `references` for the message `threadId`'s composer submits next. Call right before the send
|
|
48
|
+
* (`aui.composer.send`). A send attaching nothing stages nothing and lets an earlier slot go.
|
|
49
|
+
*/
|
|
50
|
+
export declare function stageAttachedReferencesForSend({ threadId, references, }: {
|
|
51
|
+
threadId: string;
|
|
52
|
+
references: readonly AttachableReference[];
|
|
53
|
+
}): void;
|
|
54
|
+
/** The references staged for the message `threadId` journals now, taking the slot. */
|
|
55
|
+
export declare function takeStagedAttachedReferences(threadId: string): readonly AttachableReference[];
|
|
56
|
+
/**
|
|
57
|
+
* The metadata a runtime's `getMessageMetadata` adds for the message `threadId` journals now: the
|
|
58
|
+
* references staged for it under `attachedReferences`, taking the slot, over `metadata` (what the
|
|
59
|
+
* rest of the getter produced). `metadata` unchanged when none are staged.
|
|
60
|
+
*/
|
|
61
|
+
export declare function withStagedAttachedReferences(threadId: string, metadata: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Right before `threadId`'s composer sends `text`: stage the references pending for it, remember
|
|
64
|
+
* them with the text (so the text coming back brings them back) and take them off the composer.
|
|
65
|
+
* Returns what the message carries, `[]` when nothing was attached.
|
|
66
|
+
*/
|
|
67
|
+
export declare function stageThreadAttachedReferencesForSend({ threadId, text, }: {
|
|
68
|
+
threadId: string;
|
|
69
|
+
text: string;
|
|
70
|
+
}): readonly AttachableReference[];
|
|
71
|
+
/**
|
|
72
|
+
* Text a send carried came back to `threadId`'s composer (statewire handed a refused send back):
|
|
73
|
+
* the references it carried come back as chips, after any attached since.
|
|
74
|
+
*/
|
|
75
|
+
export declare function restoreSentAttachedReferences({ threadId, text, }: {
|
|
76
|
+
threadId: string;
|
|
77
|
+
text: string;
|
|
78
|
+
}): void;
|
|
79
|
+
/**
|
|
80
|
+
* A message held in the chat outbox was given back to the composer (Cancel, Edit): the references
|
|
81
|
+
* its metadata carries come back as chips.
|
|
82
|
+
*/
|
|
83
|
+
export declare function giveBackHeldAttachedReferences(entry: {
|
|
84
|
+
threadId: string;
|
|
85
|
+
metadata?: unknown;
|
|
86
|
+
}): void;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { normalizeAttachableReference, attachableReferenceKey, MAX_ATTACHED_REFERENCES, readAttachedReferences, withAttachedReferences } from "../references/src/attachable.js";
|
|
2
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
3
|
+
const EMPTY = Object.freeze([]);
|
|
4
|
+
const pending = /* @__PURE__ */ new Map();
|
|
5
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
6
|
+
let attachedForIdentity = null;
|
|
7
|
+
function notify() {
|
|
8
|
+
for (const listener of [...listeners]) listener();
|
|
9
|
+
}
|
|
10
|
+
function subscribe(listener) {
|
|
11
|
+
listeners.add(listener);
|
|
12
|
+
return () => {
|
|
13
|
+
listeners.delete(listener);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function setPending(threadId, references) {
|
|
17
|
+
if (references.length === 0) pending.delete(threadId);
|
|
18
|
+
else pending.set(threadId, Object.freeze([...references]));
|
|
19
|
+
notify();
|
|
20
|
+
}
|
|
21
|
+
function attachReferenceToThread({
|
|
22
|
+
threadId,
|
|
23
|
+
reference
|
|
24
|
+
}) {
|
|
25
|
+
if (!threadId) return { attached: false, reason: "no_thread" };
|
|
26
|
+
const normalized = normalizeAttachableReference(reference);
|
|
27
|
+
if (normalized === null) return { attached: false, reason: "invalid_reference" };
|
|
28
|
+
const key = attachableReferenceKey(normalized);
|
|
29
|
+
const current = pending.get(threadId) ?? EMPTY;
|
|
30
|
+
const index = current.findIndex((entry) => attachableReferenceKey(entry) === key);
|
|
31
|
+
if (index >= 0) {
|
|
32
|
+
setPending(
|
|
33
|
+
threadId,
|
|
34
|
+
current.map((entry, position) => position === index ? normalized : entry)
|
|
35
|
+
);
|
|
36
|
+
return { attached: true, reference: normalized, duplicate: true };
|
|
37
|
+
}
|
|
38
|
+
if (current.length >= MAX_ATTACHED_REFERENCES) return { attached: false, reason: "too_many" };
|
|
39
|
+
setPending(threadId, [...current, normalized]);
|
|
40
|
+
return { attached: true, reference: normalized, duplicate: false };
|
|
41
|
+
}
|
|
42
|
+
function detachReferenceFromThread({
|
|
43
|
+
threadId,
|
|
44
|
+
reference
|
|
45
|
+
}) {
|
|
46
|
+
if (!threadId) return;
|
|
47
|
+
const current = pending.get(threadId);
|
|
48
|
+
if (!current) return;
|
|
49
|
+
const key = attachableReferenceKey(reference);
|
|
50
|
+
const kept = current.filter((entry) => attachableReferenceKey(entry) !== key);
|
|
51
|
+
if (kept.length !== current.length) setPending(threadId, kept);
|
|
52
|
+
}
|
|
53
|
+
function clearAttachedReferences(threadId) {
|
|
54
|
+
if (!threadId || !pending.has(threadId)) return;
|
|
55
|
+
setPending(threadId, EMPTY);
|
|
56
|
+
}
|
|
57
|
+
function readPendingAttachedReferences(threadId) {
|
|
58
|
+
return (threadId ? pending.get(threadId) : void 0) ?? EMPTY;
|
|
59
|
+
}
|
|
60
|
+
function usePendingAttachedReferences(threadId) {
|
|
61
|
+
const read = useCallback(() => readPendingAttachedReferences(threadId), [threadId]);
|
|
62
|
+
return useSyncExternalStore(subscribe, read, read);
|
|
63
|
+
}
|
|
64
|
+
function forgetAllAttachedReferences() {
|
|
65
|
+
pending.clear();
|
|
66
|
+
stagedForSend.clear();
|
|
67
|
+
sentWithText.clear();
|
|
68
|
+
notify();
|
|
69
|
+
}
|
|
70
|
+
function keepAttachedReferencesForIdentity(identity) {
|
|
71
|
+
if (attachedForIdentity !== null && attachedForIdentity !== identity) {
|
|
72
|
+
forgetAllAttachedReferences();
|
|
73
|
+
}
|
|
74
|
+
attachedForIdentity = identity;
|
|
75
|
+
}
|
|
76
|
+
const ATTACHED_REFERENCES_STAGED_TTL_MS = 1e4;
|
|
77
|
+
const stagedForSend = /* @__PURE__ */ new Map();
|
|
78
|
+
function stageAttachedReferencesForSend({
|
|
79
|
+
threadId,
|
|
80
|
+
references
|
|
81
|
+
}) {
|
|
82
|
+
if (!threadId) return;
|
|
83
|
+
if (references.length === 0) {
|
|
84
|
+
stagedForSend.delete(threadId);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
stagedForSend.set(threadId, { references, stagedAt: Date.now() });
|
|
88
|
+
}
|
|
89
|
+
function takeStagedAttachedReferences(threadId) {
|
|
90
|
+
const staged = stagedForSend.get(threadId);
|
|
91
|
+
stagedForSend.delete(threadId);
|
|
92
|
+
if (!staged || Date.now() - staged.stagedAt > ATTACHED_REFERENCES_STAGED_TTL_MS) return EMPTY;
|
|
93
|
+
return staged.references;
|
|
94
|
+
}
|
|
95
|
+
function withStagedAttachedReferences(threadId, metadata) {
|
|
96
|
+
const references = takeStagedAttachedReferences(threadId);
|
|
97
|
+
return references.length === 0 ? metadata : withAttachedReferences(metadata, references);
|
|
98
|
+
}
|
|
99
|
+
const SENT_TEXTS_KEPT_PER_THREAD = 20;
|
|
100
|
+
const THREADS_WITH_SENT_TEXTS_KEPT = 50;
|
|
101
|
+
const sentWithText = /* @__PURE__ */ new Map();
|
|
102
|
+
function setBounded(map, key, value, limit) {
|
|
103
|
+
map.delete(key);
|
|
104
|
+
map.set(key, value);
|
|
105
|
+
while (map.size > limit) {
|
|
106
|
+
const oldest = map.keys().next();
|
|
107
|
+
if (oldest.done) break;
|
|
108
|
+
map.delete(oldest.value);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function stageThreadAttachedReferencesForSend({
|
|
112
|
+
threadId,
|
|
113
|
+
text
|
|
114
|
+
}) {
|
|
115
|
+
const references = readPendingAttachedReferences(threadId);
|
|
116
|
+
stageAttachedReferencesForSend({ threadId, references });
|
|
117
|
+
if (!threadId) return references;
|
|
118
|
+
const texts = sentWithText.get(threadId);
|
|
119
|
+
if (references.length === 0) {
|
|
120
|
+
texts == null ? void 0 : texts.delete(text);
|
|
121
|
+
return references;
|
|
122
|
+
}
|
|
123
|
+
const kept = texts ?? /* @__PURE__ */ new Map();
|
|
124
|
+
setBounded(kept, text, references, SENT_TEXTS_KEPT_PER_THREAD);
|
|
125
|
+
setBounded(sentWithText, threadId, kept, THREADS_WITH_SENT_TEXTS_KEPT);
|
|
126
|
+
clearAttachedReferences(threadId);
|
|
127
|
+
return references;
|
|
128
|
+
}
|
|
129
|
+
function reattach(threadId, references) {
|
|
130
|
+
for (const reference of references) attachReferenceToThread({ threadId, reference });
|
|
131
|
+
}
|
|
132
|
+
function restoreSentAttachedReferences({
|
|
133
|
+
threadId,
|
|
134
|
+
text
|
|
135
|
+
}) {
|
|
136
|
+
var _a;
|
|
137
|
+
const references = (_a = sentWithText.get(threadId)) == null ? void 0 : _a.get(text);
|
|
138
|
+
if (references) reattach(threadId, references);
|
|
139
|
+
}
|
|
140
|
+
function giveBackHeldAttachedReferences(entry) {
|
|
141
|
+
reattach(entry.threadId, readAttachedReferences(entry.metadata));
|
|
142
|
+
}
|
|
143
|
+
export {
|
|
144
|
+
ATTACHED_REFERENCES_STAGED_TTL_MS,
|
|
145
|
+
attachReferenceToThread,
|
|
146
|
+
clearAttachedReferences,
|
|
147
|
+
detachReferenceFromThread,
|
|
148
|
+
forgetAllAttachedReferences,
|
|
149
|
+
giveBackHeldAttachedReferences,
|
|
150
|
+
keepAttachedReferencesForIdentity,
|
|
151
|
+
readPendingAttachedReferences,
|
|
152
|
+
restoreSentAttachedReferences,
|
|
153
|
+
stageAttachedReferencesForSend,
|
|
154
|
+
stageThreadAttachedReferencesForSend,
|
|
155
|
+
takeStagedAttachedReferences,
|
|
156
|
+
usePendingAttachedReferences,
|
|
157
|
+
withStagedAttachedReferences
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=attached-references.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attached-references.js","sources":["../../src/composer/attached-references.ts"],"sourcesContent":["import {\n type AttachableReference,\n attachableReferenceKey,\n MAX_ATTACHED_REFERENCES,\n normalizeAttachableReference,\n readAttachedReferences as readMessageAttachedReferences,\n withAttachedReferences,\n} from '@athenaintel/references/attachable';\nimport { useCallback, useSyncExternalStore } from 'react';\n\n/**\n * What each conversation's next message carries as attached references (`useAttachToChat`), and\n * the hand-off of that list to the message that leaves.\n *\n * - **The pending list.** Per thread, in the order attached, each reference once (by kind and\n * pointer, an asset's anchor included), at most {@link MAX_ATTACHED_REFERENCES}. The composer\n * shows it as removable chips (`ComposerAttachedReferences`). It is kept in memory for the page\n * and dropped when the signed-in identity changes ({@link keepAttachedReferencesForIdentity}):\n * what one person attached is never sent as someone else's.\n * - **The send.** statewire captures a new message's metadata once, as it journals it\n * (`getMessageMetadata`), without saying which message it is for. So the composer stages the\n * list right before `aui.composer.send` ({@link stageAttachedReferencesForSend}) and the runtime's\n * getter takes it for the message that follows ({@link withStagedAttachedReferences}).\n * The references then ride the message's own metadata (`attachedReferences`), never its text, so\n * a send that waits, is retried or is posted again after a reload keeps its own attachments. A\n * slot nobody takes expires. Both send paths stage them ({@link stageThreadAttachedReferencesForSend}):\n * `AthenaChat`'s composed send, and `TiptapComposer`'s own through its host's `prepareSend`\n * (`useAttachedReferencesComposerProps`). A composer whose host doesn't opt in sends none and\n * never loads this module (the Office pane's budget counts on it).\n * - **The way back.** Sending takes the chips off the composer, and they come back with the send:\n * a send statewire refuses and hands back ({@link restoreSentAttachedReferences}, by its text),\n * or a message held in the chat outbox that is cancelled or edited\n * ({@link giveBackHeldAttachedReferences}, from its metadata).\n *\n * agora reads the list off the message, refuses whatever it can't read, and resolves each one with\n * the person's own permission before the agent is told about it; the client never gates.\n */\n\nconst EMPTY: readonly AttachableReference[] = Object.freeze([]);\n\n// process-local: client-only — the references each thread's composer sends with its next message.\nconst pending = new Map<string, readonly AttachableReference[]>();\nconst listeners = new Set<() => void>();\nlet attachedForIdentity: string | null = null;\n\nfunction notify(): void {\n for (const listener of [...listeners]) listener();\n}\n\nfunction subscribe(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nfunction setPending(threadId: string, references: readonly AttachableReference[]): void {\n if (references.length === 0) pending.delete(threadId);\n else pending.set(threadId, Object.freeze([...references]));\n notify();\n}\n\n/** Why a reference was not attached. */\nexport type AttachRefusalReason =\n /** Not a reference an app may attach (an unknown kind, a malformed id, URL or anchor). */\n | 'invalid_reference'\n /** The next message already carries {@link MAX_ATTACHED_REFERENCES}. */\n | 'too_many'\n /** No conversation to attach it to (outside `<AthenaProvider>`'s chat). */\n | 'no_thread';\n\n/** What `attach` did. */\nexport type AttachReferenceResult =\n | {\n attached: true;\n /** The reference as it will be sent (normalized: unknown fields dropped, label cut). */\n reference: AttachableReference;\n /** It was attached already; its label is updated and it keeps its place. */\n duplicate: boolean;\n }\n | { attached: false; reason: AttachRefusalReason };\n\n/** Attach `reference` to `threadId`'s next message. */\nexport function attachReferenceToThread({\n threadId,\n reference,\n}: {\n threadId: string | null;\n reference: unknown;\n}): AttachReferenceResult {\n if (!threadId) return { attached: false, reason: 'no_thread' };\n const normalized = normalizeAttachableReference(reference);\n if (normalized === null) return { attached: false, reason: 'invalid_reference' };\n const key = attachableReferenceKey(normalized);\n const current = pending.get(threadId) ?? EMPTY;\n const index = current.findIndex((entry) => attachableReferenceKey(entry) === key);\n if (index >= 0) {\n setPending(\n threadId,\n current.map((entry, position) => (position === index ? normalized : entry)),\n );\n return { attached: true, reference: normalized, duplicate: true };\n }\n if (current.length >= MAX_ATTACHED_REFERENCES) return { attached: false, reason: 'too_many' };\n setPending(threadId, [...current, normalized]);\n return { attached: true, reference: normalized, duplicate: false };\n}\n\n/** Take `reference` (matched by kind and pointer) off `threadId`'s next message. */\nexport function detachReferenceFromThread({\n threadId,\n reference,\n}: {\n threadId: string | null;\n reference: AttachableReference;\n}): void {\n if (!threadId) return;\n const current = pending.get(threadId);\n if (!current) return;\n const key = attachableReferenceKey(reference);\n const kept = current.filter((entry) => attachableReferenceKey(entry) !== key);\n if (kept.length !== current.length) setPending(threadId, kept);\n}\n\n/** Take every reference off `threadId`'s next message. */\nexport function clearAttachedReferences(threadId: string | null): void {\n if (!threadId || !pending.has(threadId)) return;\n setPending(threadId, EMPTY);\n}\n\n/** The references `threadId`'s next message carries, in the order attached. */\nexport function readPendingAttachedReferences(threadId: string | null): readonly AttachableReference[] {\n return (threadId ? pending.get(threadId) : undefined) ?? EMPTY;\n}\n\n/** {@link readPendingAttachedReferences}, re-rendering when the list changes. */\nexport function usePendingAttachedReferences(threadId: string | null): readonly AttachableReference[] {\n const read = useCallback(() => readPendingAttachedReferences(threadId), [threadId]);\n return useSyncExternalStore(subscribe, read, read);\n}\n\n/** Forget every pending, staged and sent reference (tests, and a change of identity). */\nexport function forgetAllAttachedReferences(): void {\n pending.clear();\n stagedForSend.clear();\n sentWithText.clear();\n notify();\n}\n\n/**\n * Keep the pending references only while `identity` (the signed-in person) stays the same: a\n * change forgets every one, so nothing attached under one identity is sent under another.\n */\nexport function keepAttachedReferencesForIdentity(identity: string): void {\n if (attachedForIdentity !== null && attachedForIdentity !== identity) {\n forgetAllAttachedReferences();\n }\n attachedForIdentity = identity;\n}\n\n// ── The send ────────────────────────────────────────────────────────────────\n\n/** How long staged references wait for the message they were staged for before they expire. */\nexport const ATTACHED_REFERENCES_STAGED_TTL_MS = 10_000;\n\n// process-local: client-only — the references each thread's composer staged for the message it\n// submits next, taken once by the runtime's `getMessageMetadata`.\nconst stagedForSend = new Map<\n string,\n { references: readonly AttachableReference[]; stagedAt: number }\n>();\n\n/**\n * Stage `references` for the message `threadId`'s composer submits next. Call right before the send\n * (`aui.composer.send`). A send attaching nothing stages nothing and lets an earlier slot go.\n */\nexport function stageAttachedReferencesForSend({\n threadId,\n references,\n}: {\n threadId: string;\n references: readonly AttachableReference[];\n}): void {\n if (!threadId) return;\n if (references.length === 0) {\n stagedForSend.delete(threadId);\n return;\n }\n stagedForSend.set(threadId, { references, stagedAt: Date.now() });\n}\n\n/** The references staged for the message `threadId` journals now, taking the slot. */\nexport function takeStagedAttachedReferences(threadId: string): readonly AttachableReference[] {\n const staged = stagedForSend.get(threadId);\n stagedForSend.delete(threadId);\n if (!staged || Date.now() - staged.stagedAt > ATTACHED_REFERENCES_STAGED_TTL_MS) return EMPTY;\n return staged.references;\n}\n\n/**\n * The metadata a runtime's `getMessageMetadata` adds for the message `threadId` journals now: the\n * references staged for it under `attachedReferences`, taking the slot, over `metadata` (what the\n * rest of the getter produced). `metadata` unchanged when none are staged.\n */\nexport function withStagedAttachedReferences(\n threadId: string,\n metadata: Record<string, unknown> | undefined,\n): Record<string, unknown> | undefined {\n const references = takeStagedAttachedReferences(threadId);\n return references.length === 0 ? metadata : withAttachedReferences(metadata, references);\n}\n\n/** How many sent texts each thread remembers the references of, and how many threads. */\nconst SENT_TEXTS_KEPT_PER_THREAD = 20;\nconst THREADS_WITH_SENT_TEXTS_KEPT = 50;\n\n// process-local: client-only — the references each recent send carried, by its text, so a send\n// handed back (statewire refused it during a reconnect) brings its chips back.\nconst sentWithText = new Map<string, Map<string, readonly AttachableReference[]>>();\n\nfunction setBounded<K, V>(map: Map<K, V>, key: K, value: V, limit: number): void {\n map.delete(key);\n map.set(key, value);\n while (map.size > limit) {\n const oldest = map.keys().next();\n if (oldest.done) break;\n map.delete(oldest.value);\n }\n}\n\n/**\n * Right before `threadId`'s composer sends `text`: stage the references pending for it, remember\n * them with the text (so the text coming back brings them back) and take them off the composer.\n * Returns what the message carries, `[]` when nothing was attached.\n */\nexport function stageThreadAttachedReferencesForSend({\n threadId,\n text,\n}: {\n threadId: string;\n text: string;\n}): readonly AttachableReference[] {\n const references = readPendingAttachedReferences(threadId);\n stageAttachedReferencesForSend({ threadId, references });\n if (!threadId) return references;\n const texts = sentWithText.get(threadId);\n if (references.length === 0) {\n texts?.delete(text);\n return references;\n }\n const kept = texts ?? new Map<string, readonly AttachableReference[]>();\n setBounded(kept, text, references, SENT_TEXTS_KEPT_PER_THREAD);\n setBounded(sentWithText, threadId, kept, THREADS_WITH_SENT_TEXTS_KEPT);\n clearAttachedReferences(threadId);\n return references;\n}\n\nfunction reattach(threadId: string, references: readonly AttachableReference[]): void {\n for (const reference of references) attachReferenceToThread({ threadId, reference });\n}\n\n/**\n * Text a send carried came back to `threadId`'s composer (statewire handed a refused send back):\n * the references it carried come back as chips, after any attached since.\n */\nexport function restoreSentAttachedReferences({\n threadId,\n text,\n}: {\n threadId: string;\n text: string;\n}): void {\n const references = sentWithText.get(threadId)?.get(text);\n if (references) reattach(threadId, references);\n}\n\n/**\n * A message held in the chat outbox was given back to the composer (Cancel, Edit): the references\n * its metadata carries come back as chips.\n */\nexport function giveBackHeldAttachedReferences(entry: {\n threadId: string;\n metadata?: unknown;\n}): void {\n reattach(entry.threadId, readMessageAttachedReferences(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