@athenaintel/react 0.57.1 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +778 -9
- package/dist/agent-runtime/src/addressed-agents.cjs +16 -0
- package/dist/agent-runtime/src/addressed-agents.cjs.map +1 -0
- package/dist/agent-runtime/src/addressed-agents.d.ts +30 -0
- package/dist/agent-runtime/src/addressed-agents.js +16 -0
- package/dist/agent-runtime/src/addressed-agents.js.map +1 -0
- package/dist/agent-runtime/src/answer-label.cjs +4 -3
- package/dist/agent-runtime/src/answer-label.cjs.map +1 -1
- package/dist/agent-runtime/src/answer-label.d.ts +13 -6
- package/dist/agent-runtime/src/answer-label.js +4 -3
- package/dist/agent-runtime/src/answer-label.js.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +1 -1
- package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-entry.cjs +101 -0
- package/dist/agent-runtime/src/chat-outbox-entry.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-entry.d.ts +99 -0
- package/dist/agent-runtime/src/chat-outbox-entry.js +101 -0
- package/dist/agent-runtime/src/chat-outbox-entry.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.cjs +252 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.d.ts +96 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.js +252 -0
- package/dist/agent-runtime/src/chat-outbox-legacy.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-policy.cjs +30 -0
- package/dist/agent-runtime/src/chat-outbox-policy.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-policy.d.ts +42 -0
- package/dist/agent-runtime/src/chat-outbox-policy.js +30 -0
- package/dist/agent-runtime/src/chat-outbox-policy.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-storage.cjs +306 -0
- package/dist/agent-runtime/src/chat-outbox-storage.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-storage.d.ts +194 -0
- package/dist/agent-runtime/src/chat-outbox-storage.js +306 -0
- package/dist/agent-runtime/src/chat-outbox-storage.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-thread.cjs +21 -94
- package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-thread.d.ts +22 -18
- package/dist/agent-runtime/src/chat-outbox-thread.js +21 -94
- package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -1
- package/dist/agent-runtime/src/chat-outbox.cjs +492 -547
- package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox.d.ts +110 -142
- package/dist/agent-runtime/src/chat-outbox.js +492 -547
- package/dist/agent-runtime/src/chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
- package/dist/agent-runtime/src/composer-markdown.d.ts +1 -1
- package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +8 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
- package/dist/agent-runtime/src/dictation-preferences.d.ts +356 -0
- package/dist/agent-runtime/src/dictation-record.d.ts +279 -0
- package/dist/agent-runtime/src/dictation-session.d.ts +106 -7
- package/dist/agent-runtime/src/dictation-snippets.d.ts +9 -0
- package/dist/agent-runtime/src/dictation-transfer.d.ts +142 -0
- package/dist/agent-runtime/src/edit-command.cjs.map +1 -1
- package/dist/agent-runtime/src/edit-command.d.ts +1 -1
- package/dist/agent-runtime/src/edit-command.js.map +1 -1
- package/dist/agent-runtime/src/errors.cjs +1 -0
- package/dist/agent-runtime/src/errors.cjs.map +1 -1
- package/dist/agent-runtime/src/errors.js +1 -0
- package/dist/agent-runtime/src/errors.js.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs +24 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +3 -3
- package/dist/agent-runtime/src/generated/runconfig-contract.js +24 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/agent-runtime/src/index.d.ts +14 -8
- package/dist/agent-runtime/src/lane-follow.cjs +289 -0
- package/dist/agent-runtime/src/lane-follow.cjs.map +1 -0
- package/dist/agent-runtime/src/lane-follow.js +289 -0
- package/dist/agent-runtime/src/lane-follow.js.map +1 -0
- package/dist/agent-runtime/src/lane-images.cjs +387 -0
- package/dist/agent-runtime/src/lane-images.cjs.map +1 -0
- package/dist/agent-runtime/src/lane-images.js +387 -0
- package/dist/agent-runtime/src/lane-images.js.map +1 -0
- package/dist/agent-runtime/src/message-window.js +1 -1
- package/dist/agent-runtime/src/messages.cjs +19 -1
- package/dist/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.d.ts +8 -0
- package/dist/agent-runtime/src/messages.js +21 -3
- package/dist/agent-runtime/src/messages.js.map +1 -1
- package/dist/agent-runtime/src/named-agents.cjs +301 -0
- package/dist/agent-runtime/src/named-agents.cjs.map +1 -0
- package/dist/agent-runtime/src/named-agents.d.ts +246 -0
- package/dist/agent-runtime/src/named-agents.js +301 -0
- package/dist/agent-runtime/src/named-agents.js.map +1 -0
- package/dist/agent-runtime/src/offline-status.cjs.map +1 -1
- package/dist/agent-runtime/src/offline-status.d.ts +66 -2
- package/dist/agent-runtime/src/offline-status.js.map +1 -1
- package/dist/agent-runtime/src/ptc-subcalls.cjs +41 -0
- package/dist/agent-runtime/src/ptc-subcalls.cjs.map +1 -0
- package/dist/agent-runtime/src/ptc-subcalls.js +41 -0
- package/dist/agent-runtime/src/ptc-subcalls.js.map +1 -0
- package/dist/agent-runtime/src/queue.cjs +2 -2
- package/dist/agent-runtime/src/queue.cjs.map +1 -1
- package/dist/agent-runtime/src/queue.d.ts +20 -25
- package/dist/agent-runtime/src/queue.js +2 -2
- package/dist/agent-runtime/src/queue.js.map +1 -1
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +314 -84
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
- package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +137 -40
- package/dist/agent-runtime/src/quota-safe-local-storage-session.js +318 -88
- package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
- package/dist/agent-runtime/src/run-send.cjs +54 -0
- package/dist/agent-runtime/src/run-send.cjs.map +1 -0
- package/dist/agent-runtime/src/run-send.d.ts +51 -0
- package/dist/agent-runtime/src/run-send.js +54 -0
- package/dist/agent-runtime/src/run-send.js.map +1 -0
- package/dist/agent-runtime/src/running-tool-placeholder.cjs +6 -0
- package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -1
- package/dist/agent-runtime/src/running-tool-placeholder.js +6 -0
- package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -1
- package/dist/agent-runtime/src/runtime.d.ts +9 -5
- package/dist/agent-runtime/src/sealed-idb.cjs +64 -0
- package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -1
- package/dist/agent-runtime/src/sealed-idb.d.ts +16 -0
- package/dist/agent-runtime/src/sealed-idb.js +64 -0
- package/dist/agent-runtime/src/sealed-idb.js.map +1 -1
- package/dist/agent-runtime/src/send-recovery.cjs +90 -118
- package/dist/agent-runtime/src/send-recovery.cjs.map +1 -1
- package/dist/agent-runtime/src/send-recovery.d.ts +25 -29
- package/dist/agent-runtime/src/send-recovery.js +90 -118
- package/dist/agent-runtime/src/send-recovery.js.map +1 -1
- package/dist/agent-runtime/src/statewire-diagnostics.d.ts +4 -1
- package/dist/agent-runtime/src/statewire-held-sends.cjs +191 -0
- package/dist/agent-runtime/src/statewire-held-sends.cjs.map +1 -0
- package/dist/agent-runtime/src/statewire-held-sends.d.ts +119 -0
- package/dist/agent-runtime/src/statewire-held-sends.js +191 -0
- package/dist/agent-runtime/src/statewire-held-sends.js.map +1 -0
- package/dist/agent-runtime/src/statewire-state.cjs +4 -0
- package/dist/agent-runtime/src/statewire-state.cjs.map +1 -1
- package/dist/agent-runtime/src/statewire-state.js +4 -0
- package/dist/agent-runtime/src/statewire-state.js.map +1 -1
- package/dist/agent-runtime/src/statewire-transport.cjs +8 -2
- package/dist/agent-runtime/src/statewire-transport.cjs.map +1 -1
- package/dist/agent-runtime/src/statewire-transport.d.ts +14 -5
- package/dist/agent-runtime/src/statewire-transport.js +8 -2
- package/dist/agent-runtime/src/statewire-transport.js.map +1 -1
- package/dist/agent-runtime/src/subagent-transcripts.cjs +1 -23
- package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -1
- package/dist/agent-runtime/src/subagent-transcripts.js +3 -25
- package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -1
- package/dist/agent-runtime/src/subagents.cjs +22 -29
- package/dist/agent-runtime/src/subagents.cjs.map +1 -1
- package/dist/agent-runtime/src/subagents.js +23 -30
- package/dist/agent-runtime/src/subagents.js.map +1 -1
- package/dist/agent-runtime/src/thread-extras.cjs +27 -19
- package/dist/agent-runtime/src/thread-extras.cjs.map +1 -1
- package/dist/agent-runtime/src/thread-extras.d.ts +19 -6
- package/dist/agent-runtime/src/thread-extras.js +27 -19
- package/dist/agent-runtime/src/thread-extras.js.map +1 -1
- package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +8 -8
- package/dist/agent-runtime/src/tool-metadata.cjs +12 -0
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.js +12 -0
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/agent-runtime/src/tool-names.cjs +21 -0
- package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-names.d.ts +8 -0
- package/dist/agent-runtime/src/tool-names.js +21 -0
- package/dist/agent-runtime/src/tool-names.js.map +1 -1
- package/dist/agent-runtime/src/typed-interrupt-kinds.cjs +247 -0
- package/dist/agent-runtime/src/typed-interrupt-kinds.cjs.map +1 -0
- package/dist/agent-runtime/src/typed-interrupt-kinds.d.ts +173 -0
- package/dist/agent-runtime/src/typed-interrupt-kinds.js +247 -0
- package/dist/agent-runtime/src/typed-interrupt-kinds.js.map +1 -0
- package/dist/agent-runtime/src/typed-interrupts.cjs +48 -0
- package/dist/agent-runtime/src/typed-interrupts.cjs.map +1 -0
- package/dist/agent-runtime/src/typed-interrupts.d.ts +75 -0
- package/dist/agent-runtime/src/typed-interrupts.js +48 -0
- package/dist/agent-runtime/src/typed-interrupts.js.map +1 -0
- package/dist/agent-runtime/src/types.d.ts +1 -1
- package/dist/agent-runtime/src/use-conversation-list.cjs +1 -0
- package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
- package/dist/agent-runtime/src/use-conversation-list.d.ts +7 -0
- package/dist/agent-runtime/src/use-conversation-list.js +1 -0
- package/dist/agent-runtime/src/use-conversation-list.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +46 -29
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +14 -22
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +46 -29
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +78 -14
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +34 -7
- package/dist/agent-runtime/src/use-deep-agent-runtime.js +79 -15
- package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs +16 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +7 -2
- package/dist/agent-runtime/src/use-deep-agent-thread.js +16 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs +30 -4
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +22 -4
- package/dist/agent-runtime/src/use-deep-agent-voice.js +30 -4
- package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
- package/dist/agent-runtime/src/withdrawn-turns.d.ts +5 -4
- package/dist/agent-runtime/src/word-device-fit.d.ts +174 -0
- package/dist/agent-runtime/src/work-in.d.ts +127 -0
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.d.ts +6 -1
- package/dist/assets/AthenaAssetEmbed.js.map +1 -1
- package/dist/assets/asset-panel-store.cjs +13 -5
- package/dist/assets/asset-panel-store.cjs.map +1 -1
- package/dist/assets/asset-panel-store.d.ts +33 -2
- package/dist/assets/asset-panel-store.js +13 -5
- package/dist/assets/asset-panel-store.js.map +1 -1
- package/dist/auth/AthenaCredentialSourceContext.cjs +11 -0
- package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
- package/dist/auth/AthenaCredentialSourceContext.d.ts +6 -0
- package/dist/auth/AthenaCredentialSourceContext.js +11 -0
- package/dist/auth/AthenaCredentialSourceContext.js.map +1 -1
- package/dist/auth/account-identity.cjs +13 -2
- package/dist/auth/account-identity.cjs.map +1 -1
- package/dist/auth/account-identity.d.ts +9 -0
- package/dist/auth/account-identity.js +13 -2
- package/dist/auth/account-identity.js.map +1 -1
- package/dist/auth/credential-source.cjs +20 -4
- package/dist/auth/credential-source.cjs.map +1 -1
- package/dist/auth/credential-source.d.ts +9 -0
- package/dist/auth/credential-source.js +20 -4
- package/dist/auth/credential-source.js.map +1 -1
- package/dist/catalog/chat-pickers.cjs +31 -0
- package/dist/catalog/chat-pickers.cjs.map +1 -1
- package/dist/catalog/chat-pickers.d.ts +17 -0
- package/dist/catalog/chat-pickers.js +33 -2
- package/dist/catalog/chat-pickers.js.map +1 -1
- package/dist/catalog/runtime-catalog.cjs +63 -3
- package/dist/catalog/runtime-catalog.cjs.map +1 -1
- package/dist/catalog/runtime-catalog.d.ts +63 -3
- package/dist/catalog/runtime-catalog.js +64 -4
- package/dist/catalog/runtime-catalog.js.map +1 -1
- package/dist/chat/AthenaChat.cjs +337 -99
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +80 -4
- package/dist/chat/AthenaChat.js +337 -99
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireApprovalCard.cjs +35 -5
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +55 -2
- package/dist/chat/StatewireApprovalCard.js +37 -7
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +17 -2
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +8 -45
- package/dist/chat/StatewireQueuedMessages.js +18 -3
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/chat-agent-mentions.cjs +70 -0
- package/dist/chat/chat-agent-mentions.cjs.map +1 -0
- package/dist/chat/chat-agent-mentions.d.ts +13 -0
- package/dist/chat/chat-agent-mentions.js +70 -0
- package/dist/chat/chat-agent-mentions.js.map +1 -0
- package/dist/chat/composer-actions.cjs +12 -0
- package/dist/chat/composer-actions.cjs.map +1 -0
- package/dist/chat/composer-actions.d.ts +22 -0
- package/dist/chat/composer-actions.js +12 -0
- package/dist/chat/composer-actions.js.map +1 -0
- package/dist/chat/follow-up-suggestions.cjs +185 -0
- package/dist/chat/follow-up-suggestions.cjs.map +1 -0
- package/dist/chat/follow-up-suggestions.d.ts +64 -0
- package/dist/chat/follow-up-suggestions.js +185 -0
- package/dist/chat/follow-up-suggestions.js.map +1 -0
- package/dist/chat/super-grouping/ToolTimeline.cjs +4 -3
- package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.d.ts +7 -3
- package/dist/chat/super-grouping/ToolTimeline.js +4 -3
- package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
- package/dist/chat/turn-changes.cjs +284 -0
- package/dist/chat/turn-changes.cjs.map +1 -0
- package/dist/chat/turn-changes.d.ts +130 -0
- package/dist/chat/turn-changes.js +284 -0
- package/dist/chat/turn-changes.js.map +1 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs +31 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs.map +1 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.d.ts +31 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js +31 -0
- package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js.map +1 -0
- package/dist/chat/typed-interrupts/approval-cards.cjs +250 -0
- package/dist/chat/typed-interrupts/approval-cards.cjs.map +1 -0
- package/dist/chat/typed-interrupts/approval-cards.d.ts +22 -0
- package/dist/chat/typed-interrupts/approval-cards.js +250 -0
- package/dist/chat/typed-interrupts/approval-cards.js.map +1 -0
- package/dist/chat/typed-interrupts/form-cards.cjs +289 -0
- package/dist/chat/typed-interrupts/form-cards.cjs.map +1 -0
- package/dist/chat/typed-interrupts/form-cards.d.ts +6 -0
- package/dist/chat/typed-interrupts/form-cards.js +289 -0
- package/dist/chat/typed-interrupts/form-cards.js.map +1 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.cjs +182 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.cjs.map +1 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.d.ts +47 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.js +182 -0
- package/dist/chat/typed-interrupts/interrupt-card-shell.js.map +1 -0
- package/dist/chat/typed-interrupts/json-schema-form.cjs +388 -0
- package/dist/chat/typed-interrupts/json-schema-form.cjs.map +1 -0
- package/dist/chat/typed-interrupts/json-schema-form.d.ts +33 -0
- package/dist/chat/typed-interrupts/json-schema-form.js +388 -0
- package/dist/chat/typed-interrupts/json-schema-form.js.map +1 -0
- package/dist/chat/typed-interrupts/questionnaire-card.cjs +449 -0
- package/dist/chat/typed-interrupts/questionnaire-card.cjs.map +1 -0
- package/dist/chat/typed-interrupts/questionnaire-card.d.ts +20 -0
- package/dist/chat/typed-interrupts/questionnaire-card.js +449 -0
- package/dist/chat/typed-interrupts/questionnaire-card.js.map +1 -0
- package/dist/chat/typed-interrupts/request-file-card.cjs +159 -0
- package/dist/chat/typed-interrupts/request-file-card.cjs.map +1 -0
- package/dist/chat/typed-interrupts/request-file-card.d.ts +2 -0
- package/dist/chat/typed-interrupts/request-file-card.js +159 -0
- package/dist/chat/typed-interrupts/request-file-card.js.map +1 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.cjs +189 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.cjs.map +1 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.d.ts +23 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.js +189 -0
- package/dist/chat/typed-interrupts/toolkit-selection-card.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.cjs +26 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.cjs.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.d.ts +3 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.js +26 -0
- package/dist/chat/typed-interrupts/typed-interrupt-body.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs +105 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.d.ts +29 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.js +105 -0
- package/dist/chat/typed-interrupts/typed-interrupt-graphql.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs +70 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.d.ts +45 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.js +70 -0
- package/dist/chat/typed-interrupts/typed-interrupt-notice.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs +76 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.d.ts +11 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.js +76 -0
- package/dist/chat/typed-interrupts/typed-interrupt-panel.js.map +1 -0
- package/dist/chat/typed-interrupts/typed-interrupt-types.d.ts +46 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.cjs +106 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.cjs.map +1 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.d.ts +29 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.js +106 -0
- package/dist/chat/typed-interrupts/use-interrupt-draft.js.map +1 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs +231 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs.map +1 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.d.ts +66 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js +231 -0
- package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js.map +1 -0
- package/dist/chat-ui/composer/composer-named-agents.cjs +13 -0
- package/dist/chat-ui/composer/composer-named-agents.cjs.map +1 -0
- package/dist/chat-ui/composer/composer-named-agents.d.ts +20 -0
- package/dist/chat-ui/composer/composer-named-agents.js +13 -0
- package/dist/chat-ui/composer/composer-named-agents.js.map +1 -0
- package/dist/chat-ui/composer/slash-command-menu.cjs +143 -0
- package/dist/chat-ui/composer/slash-command-menu.cjs.map +1 -0
- package/dist/chat-ui/composer/slash-command-menu.d.ts +19 -0
- package/dist/chat-ui/composer/slash-command-menu.js +143 -0
- package/dist/chat-ui/composer/slash-command-menu.js.map +1 -0
- package/dist/chat-ui/composer/slash-commands-extension.cjs +51 -0
- package/dist/chat-ui/composer/slash-commands-extension.cjs.map +1 -0
- package/dist/chat-ui/composer/slash-commands-extension.d.ts +39 -0
- package/dist/chat-ui/composer/slash-commands-extension.js +51 -0
- package/dist/chat-ui/composer/slash-commands-extension.js.map +1 -0
- package/dist/chat-ui/composer/slash-commands.cjs +74 -0
- package/dist/chat-ui/composer/slash-commands.cjs.map +1 -0
- package/dist/chat-ui/composer/slash-commands.d.ts +82 -0
- package/dist/chat-ui/composer/slash-commands.js +74 -0
- package/dist/chat-ui/composer/slash-commands.js.map +1 -0
- package/dist/chat-ui/composer/tiptap-composer.cjs +135 -9
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +61 -2
- package/dist/chat-ui/composer/tiptap-composer.js +135 -9
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/index.cjs +3 -0
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +3 -2
- package/dist/chat-ui/index.js +3 -0
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.js +2 -2
- package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.cjs +8 -1
- package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.js +8 -1
- package/dist/chat-ui/mentions/mention-extension.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs +1 -0
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js +1 -0
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs +2 -0
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.js +3 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.js +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +36 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +42 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.js +36 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +235 -19
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +88 -10
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js +236 -20
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/types.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/types.d.ts +27 -1
- package/dist/chat-ui/mentions/suggestions/data/types.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +56 -5
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +26 -6
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +57 -6
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs +34 -17
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.d.ts +19 -1
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js +35 -18
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js.map +1 -1
- package/dist/chat-ui/statewire.d.ts +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +15 -0
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.d.ts +4 -1
- package/dist/chat-ui/thread/statewire-history-edge.js +15 -0
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/collab/client.cjs +17 -5
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +22 -7
- package/dist/collab/client.js +17 -5
- package/dist/collab/client.js.map +1 -1
- package/dist/composer/ComposerAttachedReferences.cjs +119 -0
- package/dist/composer/ComposerAttachedReferences.cjs.map +1 -0
- package/dist/composer/ComposerAttachedReferences.d.ts +26 -0
- package/dist/composer/ComposerAttachedReferences.js +119 -0
- package/dist/composer/ComposerAttachedReferences.js.map +1 -0
- package/dist/composer/ComposerNamedAgents.cjs +63 -0
- package/dist/composer/ComposerNamedAgents.cjs.map +1 -0
- package/dist/composer/ComposerNamedAgents.d.ts +16 -0
- package/dist/composer/ComposerNamedAgents.js +63 -0
- package/dist/composer/ComposerNamedAgents.js.map +1 -0
- package/dist/composer/attached-references.cjs +159 -0
- package/dist/composer/attached-references.cjs.map +1 -0
- package/dist/composer/attached-references.d.ts +86 -0
- package/dist/composer/attached-references.js +159 -0
- package/dist/composer/attached-references.js.map +1 -0
- package/dist/composer/build-composed-message.cjs +14 -7
- package/dist/composer/build-composed-message.cjs.map +1 -1
- package/dist/composer/build-composed-message.d.ts +6 -1
- package/dist/composer/build-composed-message.js +14 -7
- package/dist/composer/build-composed-message.js.map +1 -1
- package/dist/composer/composer-handoff.cjs +6 -2
- package/dist/composer/composer-handoff.cjs.map +1 -1
- package/dist/composer/composer-handoff.d.ts +7 -1
- package/dist/composer/composer-handoff.js +6 -2
- package/dist/composer/composer-handoff.js.map +1 -1
- package/dist/composer/folder-upload.cjs +149 -0
- package/dist/composer/folder-upload.cjs.map +1 -0
- package/dist/composer/folder-upload.d.ts +79 -0
- package/dist/composer/folder-upload.js +149 -0
- package/dist/composer/folder-upload.js.map +1 -0
- package/dist/composer/index.d.ts +1 -1
- package/dist/composer/useAttachToChat.cjs +35 -0
- package/dist/composer/useAttachToChat.cjs.map +1 -0
- package/dist/composer/useAttachToChat.d.ts +54 -0
- package/dist/composer/useAttachToChat.js +35 -0
- package/dist/composer/useAttachToChat.js.map +1 -0
- package/dist/composer/useAttachedReferencesComposerProps.cjs +19 -0
- package/dist/composer/useAttachedReferencesComposerProps.cjs.map +1 -0
- package/dist/composer/useAttachedReferencesComposerProps.d.ts +12 -0
- package/dist/composer/useAttachedReferencesComposerProps.js +19 -0
- package/dist/composer/useAttachedReferencesComposerProps.js.map +1 -0
- package/dist/composer/useFileUpload.cjs +95 -7
- package/dist/composer/useFileUpload.cjs.map +1 -1
- package/dist/composer/useFileUpload.d.ts +21 -2
- package/dist/composer/useFileUpload.js +95 -7
- package/dist/composer/useFileUpload.js.map +1 -1
- package/dist/data/athena-api-error.cjs +125 -0
- package/dist/data/athena-api-error.cjs.map +1 -0
- package/dist/data/athena-api-error.d.ts +96 -0
- package/dist/data/athena-api-error.js +125 -0
- package/dist/data/athena-api-error.js.map +1 -0
- package/dist/data/athena-data-client.cjs +106 -0
- package/dist/data/athena-data-client.cjs.map +1 -0
- package/dist/data/athena-data-client.d.ts +74 -0
- package/dist/data/athena-data-client.js +106 -0
- package/dist/data/athena-data-client.js.map +1 -0
- package/dist/data/athena-member.cjs +93 -0
- package/dist/data/athena-member.cjs.map +1 -0
- package/dist/data/athena-member.d.ts +125 -0
- package/dist/data/athena-member.js +93 -0
- package/dist/data/athena-member.js.map +1 -0
- package/dist/data/athena-request.cjs +458 -0
- package/dist/data/athena-request.cjs.map +1 -0
- package/dist/data/athena-request.d.ts +120 -0
- package/dist/data/athena-request.js +458 -0
- package/dist/data/athena-request.js.map +1 -0
- package/dist/data/use-athena-fetch.cjs +14 -0
- package/dist/data/use-athena-fetch.cjs.map +1 -0
- package/dist/data/use-athena-fetch.d.ts +19 -0
- package/dist/data/use-athena-fetch.js +14 -0
- package/dist/data/use-athena-fetch.js.map +1 -0
- package/dist/data/use-athena-graphql.cjs +66 -0
- package/dist/data/use-athena-graphql.cjs.map +1 -0
- package/dist/data/use-athena-graphql.d.ts +56 -0
- package/dist/data/use-athena-graphql.js +66 -0
- package/dist/data/use-athena-graphql.js.map +1 -0
- package/dist/data/use-athena-rest.cjs +33 -0
- package/dist/data/use-athena-rest.cjs.map +1 -0
- package/dist/data/use-athena-rest.d.ts +21 -0
- package/dist/data/use-athena-rest.js +33 -0
- package/dist/data/use-athena-rest.js.map +1 -0
- package/dist/data/use-semantic-query.cjs +44 -0
- package/dist/data/use-semantic-query.cjs.map +1 -0
- package/dist/data/use-semantic-query.d.ts +92 -0
- package/dist/data/use-semantic-query.js +44 -0
- package/dist/data/use-semantic-query.js.map +1 -0
- package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
- package/dist/diagnostics/athena-diagnostics.d.ts +5 -1
- package/dist/diagnostics/athena-diagnostics.js.map +1 -1
- package/dist/diagnostics/errors.cjs +7 -0
- package/dist/diagnostics/errors.cjs.map +1 -1
- package/dist/diagnostics/errors.d.ts +7 -0
- package/dist/diagnostics/errors.js +7 -0
- package/dist/diagnostics/errors.js.map +1 -1
- package/dist/index.cjs +155 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +72 -13
- package/dist/index.js +148 -4
- package/dist/index.js.map +1 -1
- package/dist/keryx-http/src/initial-sync.cjs +64 -16
- package/dist/keryx-http/src/initial-sync.cjs.map +1 -1
- package/dist/keryx-http/src/initial-sync.d.ts +31 -1
- package/dist/keryx-http/src/initial-sync.js +64 -16
- package/dist/keryx-http/src/initial-sync.js.map +1 -1
- package/dist/keryx-http/src/own-awareness.cjs +20 -0
- package/dist/keryx-http/src/own-awareness.cjs.map +1 -0
- package/dist/keryx-http/src/own-awareness.d.ts +50 -0
- package/dist/keryx-http/src/own-awareness.js +20 -0
- package/dist/keryx-http/src/own-awareness.js.map +1 -0
- package/dist/keryx-http/src/update-attributions.cjs +26 -1
- package/dist/keryx-http/src/update-attributions.cjs.map +1 -1
- package/dist/keryx-http/src/update-attributions.d.ts +10 -1
- package/dist/keryx-http/src/update-attributions.js +26 -1
- package/dist/keryx-http/src/update-attributions.js.map +1 -1
- package/dist/offline/chat-outbox.cjs +262 -26
- package/dist/offline/chat-outbox.cjs.map +1 -1
- package/dist/offline/chat-outbox.d.ts +90 -12
- package/dist/offline/chat-outbox.js +263 -27
- package/dist/offline/chat-outbox.js.map +1 -1
- package/dist/provider/AthenaProvider.cjs +63 -19
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +24 -8
- package/dist/provider/AthenaProvider.js +66 -22
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/references/src/anchors/types.cjs +5 -0
- package/dist/references/src/anchors/types.cjs.map +1 -1
- package/dist/references/src/anchors/types.js +5 -0
- package/dist/references/src/anchors/types.js.map +1 -1
- package/dist/references/src/attachable.cjs +149 -0
- package/dist/references/src/attachable.cjs.map +1 -0
- package/dist/references/src/attachable.d.ts +87 -0
- package/dist/references/src/attachable.js +149 -0
- package/dist/references/src/attachable.js.map +1 -0
- package/dist/runtime/StatewirePlanModeLaneSync.cjs +93 -0
- package/dist/runtime/StatewirePlanModeLaneSync.cjs.map +1 -0
- package/dist/runtime/StatewirePlanModeLaneSync.d.ts +34 -0
- package/dist/runtime/StatewirePlanModeLaneSync.js +93 -0
- package/dist/runtime/StatewirePlanModeLaneSync.js.map +1 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs +2 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
- package/dist/runtime/StatewireThreadConfigLaneSync.d.ts +4 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.js +2 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.js.map +1 -1
- package/dist/runtime/statewire-plan-mode.cjs +71 -0
- package/dist/runtime/statewire-plan-mode.cjs.map +1 -0
- package/dist/runtime/statewire-plan-mode.d.ts +88 -0
- package/dist/runtime/statewire-plan-mode.js +71 -0
- package/dist/runtime/statewire-plan-mode.js.map +1 -0
- package/dist/runtime/statewire-run-config.cjs +18 -1
- package/dist/runtime/statewire-run-config.cjs.map +1 -1
- package/dist/runtime/statewire-run-config.d.ts +20 -0
- package/dist/runtime/statewire-run-config.js +18 -1
- package/dist/runtime/statewire-run-config.js.map +1 -1
- package/dist/runtime/statewire-session-key.cjs +11 -5
- package/dist/runtime/statewire-session-key.cjs.map +1 -1
- package/dist/runtime/statewire-session-key.d.ts +22 -10
- package/dist/runtime/statewire-session-key.js +11 -5
- package/dist/runtime/statewire-session-key.js.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +65 -8
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +26 -10
- package/dist/runtime/useAthenaStatewireRuntime.js +67 -10
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/search/useAthenaAssets.cjs +394 -0
- package/dist/search/useAthenaAssets.cjs.map +1 -0
- package/dist/search/useAthenaAssets.d.ts +186 -0
- package/dist/search/useAthenaAssets.js +394 -0
- package/dist/search/useAthenaAssets.js.map +1 -0
- package/dist/sheet-range/index.cjs +4 -0
- package/dist/sheet-range/index.cjs.map +1 -1
- package/dist/sheet-range/index.d.ts +4 -2
- package/dist/sheet-range/index.js +4 -0
- package/dist/sheet-range/index.js.map +1 -1
- package/dist/sheet-range/query-range.cjs +102 -0
- package/dist/sheet-range/query-range.cjs.map +1 -0
- package/dist/sheet-range/query-range.d.ts +46 -0
- package/dist/sheet-range/query-range.js +102 -0
- package/dist/sheet-range/query-range.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/subagents/index.cjs +49 -0
- package/dist/subagents/index.cjs.map +1 -0
- package/dist/subagents/index.d.ts +16 -0
- package/dist/subagents/index.js +49 -0
- package/dist/subagents/index.js.map +1 -0
- package/dist/subagents/lane-follow.cjs +19 -0
- package/dist/subagents/lane-follow.cjs.map +1 -0
- package/dist/subagents/lane-follow.d.ts +9 -0
- package/dist/subagents/lane-follow.js +19 -0
- package/dist/subagents/lane-follow.js.map +1 -0
- package/dist/subagents/lane-model.cjs +178 -0
- package/dist/subagents/lane-model.cjs.map +1 -0
- package/dist/subagents/lane-model.d.ts +140 -0
- package/dist/subagents/lane-model.js +178 -0
- package/dist/subagents/lane-model.js.map +1 -0
- package/dist/subagents/lane-parts.cjs +517 -0
- package/dist/subagents/lane-parts.cjs.map +1 -0
- package/dist/subagents/lane-parts.d.ts +130 -0
- package/dist/subagents/lane-parts.js +517 -0
- package/dist/subagents/lane-parts.js.map +1 -0
- package/dist/subagents/subagent-lane-group.cjs +215 -0
- package/dist/subagents/subagent-lane-group.cjs.map +1 -0
- package/dist/subagents/subagent-lane-group.d.ts +67 -0
- package/dist/subagents/subagent-lane-group.js +215 -0
- package/dist/subagents/subagent-lane-group.js.map +1 -0
- package/dist/subagents/subagent-transcript-drawer.cjs +431 -0
- package/dist/subagents/subagent-transcript-drawer.cjs.map +1 -0
- package/dist/subagents/subagent-transcript-drawer.d.ts +78 -0
- package/dist/subagents/subagent-transcript-drawer.js +431 -0
- package/dist/subagents/subagent-transcript-drawer.js.map +1 -0
- package/dist/subagents/task-subagent-group.cjs +115 -0
- package/dist/subagents/task-subagent-group.cjs.map +1 -0
- package/dist/subagents/task-subagent-group.d.ts +36 -0
- package/dist/subagents/task-subagent-group.js +115 -0
- package/dist/subagents/task-subagent-group.js.map +1 -0
- package/dist/subagents/use-omitted-images-in-view.cjs +68 -0
- package/dist/subagents/use-omitted-images-in-view.cjs.map +1 -0
- package/dist/subagents/use-omitted-images-in-view.d.ts +21 -0
- package/dist/subagents/use-omitted-images-in-view.js +68 -0
- package/dist/subagents/use-omitted-images-in-view.js.map +1 -0
- package/dist/threads/Inbox.cjs +2 -2
- package/dist/threads/Inbox.cjs.map +1 -1
- package/dist/threads/SessionList.cjs +27 -24
- package/dist/threads/SessionList.cjs.map +1 -1
- package/dist/threads/SessionList.js +22 -19
- package/dist/threads/SessionList.js.map +1 -1
- package/dist/threads/SessionsPage.cjs +13 -7
- package/dist/threads/SessionsPage.cjs.map +1 -1
- package/dist/threads/SessionsPage.d.ts +10 -1
- package/dist/threads/SessionsPage.js +9 -3
- package/dist/threads/SessionsPage.js.map +1 -1
- package/dist/threads/live-session-rows.cjs +207 -0
- package/dist/threads/live-session-rows.cjs.map +1 -0
- package/dist/threads/live-session-rows.d.ts +175 -0
- package/dist/threads/live-session-rows.js +207 -0
- package/dist/threads/live-session-rows.js.map +1 -0
- package/dist/threads/session-list-model.cjs.map +1 -1
- package/dist/threads/session-list-model.d.ts +2 -1
- package/dist/threads/session-list-model.js.map +1 -1
- package/dist/threads/session-row-parts.cjs +3 -3
- package/dist/threads/session-row-parts.cjs.map +1 -1
- package/dist/threads/sessions-page-model.cjs +13 -5
- package/dist/threads/sessions-page-model.cjs.map +1 -1
- package/dist/threads/sessions-page-model.d.ts +7 -0
- package/dist/threads/sessions-page-model.js +11 -3
- package/dist/threads/sessions-page-model.js.map +1 -1
- package/dist/threads/sessions-page-storage.cjs +8 -8
- package/dist/threads/sessions-page-storage.cjs.map +1 -1
- package/dist/threads/sessions-page-storage.d.ts +5 -1
- package/dist/threads/sessions-page-storage.js +8 -8
- package/dist/threads/sessions-page-storage.js.map +1 -1
- package/dist/threads/statewire-thread-list.cjs +173 -20
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +44 -1
- package/dist/threads/statewire-thread-list.js +174 -21
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/use-athena-sessions.cjs +1 -0
- package/dist/threads/use-athena-sessions.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.d.ts +7 -0
- package/dist/threads/use-athena-sessions.js +1 -0
- package/dist/threads/use-athena-sessions.js.map +1 -1
- package/dist/threads/use-athena-thread-agent.cjs +31 -0
- package/dist/threads/use-athena-thread-agent.cjs.map +1 -0
- package/dist/threads/use-athena-thread-agent.d.ts +38 -0
- package/dist/threads/use-athena-thread-agent.js +31 -0
- package/dist/threads/use-athena-thread-agent.js.map +1 -0
- package/dist/threads/use-athena-thread-plan-mode.cjs +18 -0
- package/dist/threads/use-athena-thread-plan-mode.cjs.map +1 -0
- package/dist/threads/use-athena-thread-plan-mode.d.ts +18 -0
- package/dist/threads/use-athena-thread-plan-mode.js +18 -0
- package/dist/threads/use-athena-thread-plan-mode.js.map +1 -0
- package/dist/threads/use-rest-conversation-history.d.ts +1 -0
- package/dist/tools/agent-creations.cjs +97 -0
- package/dist/tools/agent-creations.cjs.map +1 -0
- package/dist/tools/agent-creations.d.ts +38 -0
- package/dist/tools/agent-creations.js +97 -0
- package/dist/tools/agent-creations.js.map +1 -0
- package/dist/tools/agent-highlights.cjs +100 -0
- package/dist/tools/agent-highlights.cjs.map +1 -0
- package/dist/tools/agent-highlights.d.ts +57 -0
- package/dist/tools/agent-highlights.js +100 -0
- package/dist/tools/agent-highlights.js.map +1 -0
- package/dist/tools/append-document-tool-ui.cjs +1 -0
- package/dist/tools/append-document-tool-ui.cjs.map +1 -1
- package/dist/tools/append-document-tool-ui.d.ts +7 -0
- package/dist/tools/append-document-tool-ui.js +2 -1
- package/dist/tools/append-document-tool-ui.js.map +1 -1
- package/dist/tools/auto-open-tools.cjs +144 -71
- package/dist/tools/auto-open-tools.cjs.map +1 -1
- package/dist/tools/auto-open-tools.d.ts +131 -1
- package/dist/tools/auto-open-tools.js +145 -72
- package/dist/tools/auto-open-tools.js.map +1 -1
- package/dist/tools/browser-tool-uis.cjs +594 -0
- package/dist/tools/browser-tool-uis.cjs.map +1 -0
- package/dist/tools/browser-tool-uis.d.ts +8 -0
- package/dist/tools/browser-tool-uis.js +594 -0
- package/dist/tools/browser-tool-uis.js.map +1 -0
- package/dist/tools/computer-asset-tool-uis.cjs +313 -0
- package/dist/tools/computer-asset-tool-uis.cjs.map +1 -0
- package/dist/tools/computer-asset-tool-uis.d.ts +5 -0
- package/dist/tools/computer-asset-tool-uis.js +313 -0
- package/dist/tools/computer-asset-tool-uis.js.map +1 -0
- package/dist/tools/document-edit-tool-uis.cjs +218 -0
- package/dist/tools/document-edit-tool-uis.cjs.map +1 -0
- package/dist/tools/document-edit-tool-uis.d.ts +40 -0
- package/dist/tools/document-edit-tool-uis.js +218 -0
- package/dist/tools/document-edit-tool-uis.js.map +1 -0
- package/dist/tools/drive-tool-uis.cjs +425 -0
- package/dist/tools/drive-tool-uis.cjs.map +1 -0
- package/dist/tools/drive-tool-uis.d.ts +120 -0
- package/dist/tools/drive-tool-uis.js +425 -0
- package/dist/tools/drive-tool-uis.js.map +1 -0
- package/dist/tools/email-calendar-tool-uis.cjs +789 -0
- package/dist/tools/email-calendar-tool-uis.cjs.map +1 -0
- package/dist/tools/email-calendar-tool-uis.d.ts +129 -0
- package/dist/tools/email-calendar-tool-uis.js +789 -0
- package/dist/tools/email-calendar-tool-uis.js.map +1 -0
- package/dist/tools/ontology-tool-uis.cjs +83 -0
- package/dist/tools/ontology-tool-uis.cjs.map +1 -0
- package/dist/tools/ontology-tool-uis.d.ts +9 -0
- package/dist/tools/ontology-tool-uis.js +83 -0
- package/dist/tools/ontology-tool-uis.js.map +1 -0
- package/dist/tools/orchestration-tool-uis.cjs +586 -0
- package/dist/tools/orchestration-tool-uis.cjs.map +1 -0
- package/dist/tools/orchestration-tool-uis.d.ts +141 -0
- package/dist/tools/orchestration-tool-uis.js +586 -0
- package/dist/tools/orchestration-tool-uis.js.map +1 -0
- package/dist/tools/presentation-edit-tool-uis.cjs +516 -0
- package/dist/tools/presentation-edit-tool-uis.cjs.map +1 -0
- package/dist/tools/presentation-edit-tool-uis.d.ts +73 -0
- package/dist/tools/presentation-edit-tool-uis.js +516 -0
- package/dist/tools/presentation-edit-tool-uis.js.map +1 -0
- package/dist/tools/project-tool-uis.cjs +213 -0
- package/dist/tools/project-tool-uis.cjs.map +1 -0
- package/dist/tools/project-tool-uis.d.ts +14 -0
- package/dist/tools/project-tool-uis.js +213 -0
- package/dist/tools/project-tool-uis.js.map +1 -0
- package/dist/tools/sandbox-tool-uis.cjs +491 -0
- package/dist/tools/sandbox-tool-uis.cjs.map +1 -0
- package/dist/tools/sandbox-tool-uis.d.ts +116 -0
- package/dist/tools/sandbox-tool-uis.js +491 -0
- package/dist/tools/sandbox-tool-uis.js.map +1 -0
- package/dist/tools/sheet-query-tool-ui.cjs +138 -0
- package/dist/tools/sheet-query-tool-ui.cjs.map +1 -0
- package/dist/tools/sheet-query-tool-ui.d.ts +15 -0
- package/dist/tools/sheet-query-tool-ui.js +138 -0
- package/dist/tools/sheet-query-tool-ui.js.map +1 -0
- package/dist/tools/studio-screenshot-tool-uis.cjs +262 -0
- package/dist/tools/studio-screenshot-tool-uis.cjs.map +1 -0
- package/dist/tools/studio-screenshot-tool-uis.d.ts +52 -0
- package/dist/tools/studio-screenshot-tool-uis.js +262 -0
- package/dist/tools/studio-screenshot-tool-uis.js.map +1 -0
- package/dist/tools/subagent-task-tool-ui.cjs +24 -475
- package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
- package/dist/tools/subagent-task-tool-ui.d.ts +19 -103
- package/dist/tools/subagent-task-tool-ui.js +28 -479
- package/dist/tools/subagent-task-tool-ui.js.map +1 -1
- package/dist/tools/tool-summary.cjs +36 -0
- package/dist/tools/tool-summary.cjs.map +1 -1
- package/dist/tools/tool-summary.js +36 -0
- package/dist/tools/tool-summary.js.map +1 -1
- package/dist/tools/tool-uis.cjs +181 -53
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/tool-uis.d.ts +40 -0
- package/dist/tools/tool-uis.js +183 -55
- package/dist/tools/tool-uis.js.map +1 -1
- package/dist/typed-interrupts/index.cjs +15 -0
- package/dist/typed-interrupts/index.cjs.map +1 -0
- package/dist/typed-interrupts/index.d.ts +20 -0
- package/dist/typed-interrupts/index.js +15 -0
- package/dist/typed-interrupts/index.js.map +1 -0
- package/dist/workbench/session-workbench-panes.cjs +6 -6
- package/dist/workbench/session-workbench-panes.cjs.map +1 -1
- package/package.json +28 -6
- package/dist/agent-runtime/src/chat-outbox-store.cjs +0 -510
- package/dist/agent-runtime/src/chat-outbox-store.cjs.map +0 -1
- package/dist/agent-runtime/src/chat-outbox-store.d.ts +0 -210
- package/dist/agent-runtime/src/chat-outbox-store.js +0 -510
- package/dist/agent-runtime/src/chat-outbox-store.js.map +0 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rows the session list shows between one server answer and the next.
|
|
3
|
+
*
|
|
4
|
+
* The list's rows come from the fetched REST pages, and the signed-in user's
|
|
5
|
+
* live conversation index updates them in place. Two gaps are filled here, so
|
|
6
|
+
* the list follows what just happened without waiting for a re-read:
|
|
7
|
+
*
|
|
8
|
+
* - **Sessions the index pushed that the page does not list yet.** A session
|
|
9
|
+
* just started (in this tab or anywhere else) reaches the index in about a
|
|
10
|
+
* second; the re-read the list runs for it takes several more (measured on
|
|
11
|
+
* staging 2026-11-06: push at +1.8 s, row drawn at +5.5 s). The pushed entry
|
|
12
|
+
* is drawn at once, while the re-read still fills in what the index never
|
|
13
|
+
* carries (pull requests, who started it).
|
|
14
|
+
* - **A message this tab just sent.** The session moves to the top as working
|
|
15
|
+
* the moment it is sent (a chat the server does not know yet gets a pending
|
|
16
|
+
* row titled with the message), until the server reports the send.
|
|
17
|
+
*
|
|
18
|
+
* Rows are kept newest first by `updatedAt`, the server's own order, so a
|
|
19
|
+
* session that just became active moves up instead of staying where its last
|
|
20
|
+
* fetched copy was.
|
|
21
|
+
*
|
|
22
|
+
* Pure functions over the shared contract rows: the provider composes them,
|
|
23
|
+
* and they are tested on their own.
|
|
24
|
+
*/
|
|
25
|
+
import { type ConversationIndexEntry, type ConversationSummary } from '../agent-runtime/src/index';
|
|
26
|
+
/**
|
|
27
|
+
* Whether a pushed index entry is one of the conversations with `homeAgentId`'s agent that the
|
|
28
|
+
* server lists beside the app scope: the agent's, and not one of its tasks or orchestration
|
|
29
|
+
* sessions. An entry from a pod that predates `collab_agent_id` is not.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isAgentHomeIndexEntry(entry: {
|
|
32
|
+
collab_agent_id?: string | null;
|
|
33
|
+
start_channel?: string | null;
|
|
34
|
+
}, homeAgentId: string | undefined): boolean;
|
|
35
|
+
/** Which sessions a list shows: its app scope, as the server applies it to every read. */
|
|
36
|
+
export interface SessionListScope {
|
|
37
|
+
/** The provider's `appId`; the app's own sessions. */
|
|
38
|
+
appId: string | undefined;
|
|
39
|
+
/** Other apps whose sessions the list shows too (a union with `appId`). */
|
|
40
|
+
additionalAppIds: readonly string[];
|
|
41
|
+
/** The collab agent whose conversations the list also asks for (`home_agent_id`). */
|
|
42
|
+
homeAgentId: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the list's latest first page said the server widened it to the home agent's
|
|
45
|
+
* conversations. A server that did not never lists them.
|
|
46
|
+
*/
|
|
47
|
+
homeAgentApplied: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Whether the server lists a session with these stamps in a list of this scope — the app filter
|
|
51
|
+
* and the home-agent union exactly as `sdk_thread_list.py` applies them. With no app ids the list
|
|
52
|
+
* holds every app's sessions, unless it was widened to an agent, which then makes it that agent's.
|
|
53
|
+
*/
|
|
54
|
+
export declare function inSessionListScope(entry: {
|
|
55
|
+
app_id: string | null;
|
|
56
|
+
collab_agent_id?: string | null;
|
|
57
|
+
start_channel?: string | null;
|
|
58
|
+
}, scope: SessionListScope): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* The listed rows plus every session the index pushed that the list should show and does not
|
|
61
|
+
* list yet: in the list's scope, a listed asset type, and — while older pages remain unread — no
|
|
62
|
+
* older than the oldest loaded row, so a row is never drawn below sessions that are not loaded
|
|
63
|
+
* yet. Nothing is added while a search is active (the server matches it; the index cannot) or
|
|
64
|
+
* before the first page has answered (the page decides what the list starts with). Identity is
|
|
65
|
+
* kept when nothing is added. The rows are not re-sorted here ({@link sortNewestFirst}).
|
|
66
|
+
*/
|
|
67
|
+
export declare function withIndexedSessions({ conversations, loadedConversations, entries, scope, searching, hasResolvedFirstPage, hasNextPage, }: {
|
|
68
|
+
/** The rows the list shows (fetched pages, pinned rows, folded with the index). */
|
|
69
|
+
conversations: readonly ConversationSummary[];
|
|
70
|
+
/** The fetched pages' rows alone: the window older pages continue below. */
|
|
71
|
+
loadedConversations: readonly ConversationSummary[];
|
|
72
|
+
entries: readonly ConversationIndexEntry[] | null;
|
|
73
|
+
scope: SessionListScope;
|
|
74
|
+
searching: boolean;
|
|
75
|
+
hasResolvedFirstPage: boolean;
|
|
76
|
+
hasNextPage: boolean;
|
|
77
|
+
}): readonly ConversationSummary[];
|
|
78
|
+
/** How long a sent message holds its session's row before the server's own copy must take over. */
|
|
79
|
+
export declare const LOCAL_SEND_TTL_MS = 60000;
|
|
80
|
+
/**
|
|
81
|
+
* A message this tab sent that the server has not reported yet. Held by the provider; it
|
|
82
|
+
* shapes the session's row until the server's copy of the session reflects the send.
|
|
83
|
+
*/
|
|
84
|
+
export interface LocalSessionSend {
|
|
85
|
+
threadId: string;
|
|
86
|
+
/** When this tab sent it (the client's clock, ms since the epoch). */
|
|
87
|
+
sentAtMs: number;
|
|
88
|
+
/**
|
|
89
|
+
* The instant the row sorts at until the server reports the send: the send time, and never
|
|
90
|
+
* older than the newest row the list showed when it was sent, so the session leads the list
|
|
91
|
+
* even on a client whose clock runs behind the server's.
|
|
92
|
+
*/
|
|
93
|
+
sortAt: string;
|
|
94
|
+
/**
|
|
95
|
+
* The session's `updatedAt` as the list showed it when the message was sent; `null` when the
|
|
96
|
+
* list did not show the session (a new chat, or an older session the loaded pages do not
|
|
97
|
+
* reach). The send is reported once the server's row differs.
|
|
98
|
+
*/
|
|
99
|
+
baselineUpdatedAt: string | null;
|
|
100
|
+
/**
|
|
101
|
+
* Whether the session was a chat this tab started that the server had not listed yet. Only
|
|
102
|
+
* such a send gets a pending row: a session missing from the loaded pages may well exist.
|
|
103
|
+
*/
|
|
104
|
+
newChat: boolean;
|
|
105
|
+
/** The message as one line, the pending title of a chat the server does not know yet. */
|
|
106
|
+
title: string | null;
|
|
107
|
+
/**
|
|
108
|
+
* The provenance the session's first run stamps, when it is known here (the SDK's own `web`,
|
|
109
|
+
* or a host's `extraRunConfig.start_channel`); `null` when the backend decides it (a collab
|
|
110
|
+
* channel stamps its own kind). A new chat's pending row shows it as its origin.
|
|
111
|
+
*/
|
|
112
|
+
startChannel: string | null;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* A sent message as the one-line provisional title of its session: markdown links reduced to
|
|
116
|
+
* their text (a mention reads as its name), whitespace folded, and long messages cut. `null`
|
|
117
|
+
* when nothing is left (an attachment sent alone).
|
|
118
|
+
*/
|
|
119
|
+
export declare function pendingSessionTitle(text: string | null | undefined): string | null;
|
|
120
|
+
/**
|
|
121
|
+
* Record a send against the rows the server last reported: the baseline the server must move
|
|
122
|
+
* past, and the instant the row sorts at until it does.
|
|
123
|
+
*/
|
|
124
|
+
export declare function localSessionSend({ threadId, text, sentAtMs, newChat, startChannel, serverConversations, }: {
|
|
125
|
+
threadId: string;
|
|
126
|
+
text: string | null | undefined;
|
|
127
|
+
sentAtMs: number;
|
|
128
|
+
/** The session was a chat this tab started that the server had not listed yet. */
|
|
129
|
+
newChat: boolean;
|
|
130
|
+
/** The `start_channel` the send stamps (`effectiveStatewireStartChannel`); `null` if unknown. */
|
|
131
|
+
startChannel: string | null;
|
|
132
|
+
/** The server's rows as the list shows them (fetched pages and pushed index entries). */
|
|
133
|
+
serverConversations: readonly ConversationSummary[];
|
|
134
|
+
}): LocalSessionSend;
|
|
135
|
+
/**
|
|
136
|
+
* Whether the server's copy of the session reflects the send: a session the list did not show
|
|
137
|
+
* is reported once the server lists it at all; a listed session once its `updatedAt` moved.
|
|
138
|
+
*/
|
|
139
|
+
export declare function isLocalSendReported(send: LocalSessionSend, serverRow: ConversationSummary | undefined): boolean;
|
|
140
|
+
/** The sends without `threadIds`; the same map when it holds none of them. */
|
|
141
|
+
export declare function withoutLocalSends(sends: ReadonlyMap<string, LocalSessionSend>, threadIds: readonly string[]): ReadonlyMap<string, LocalSessionSend>;
|
|
142
|
+
/** The sends to forget: reported by the server, or older than {@link LOCAL_SEND_TTL_MS}. */
|
|
143
|
+
export declare function settledLocalSends({ sends, serverConversations, nowMs, ttlMs, }: {
|
|
144
|
+
sends: ReadonlyMap<string, LocalSessionSend>;
|
|
145
|
+
serverConversations: readonly ConversationSummary[];
|
|
146
|
+
nowMs: number;
|
|
147
|
+
ttlMs?: number;
|
|
148
|
+
}): string[];
|
|
149
|
+
/**
|
|
150
|
+
* The rows with this tab's unreported sends applied: a listed session the server has not
|
|
151
|
+
* reported the send for shows as working and sorts at the send; a new chat this tab started
|
|
152
|
+
* gets a pending row, if the list's scope holds this app's new sessions and no search is
|
|
153
|
+
* active. A session the loaded pages do not reach gets nothing here: it exists, and the
|
|
154
|
+
* server's push (or re-read) brings it to the top. Returns the rows and the ids of the pending
|
|
155
|
+
* rows (which the server does not know, so writes cannot be offered on them). Identity is kept
|
|
156
|
+
* when no send applies.
|
|
157
|
+
*/
|
|
158
|
+
export declare function withLocalSends({ conversations, sends, appId, showPendingSessions, }: {
|
|
159
|
+
conversations: readonly ConversationSummary[];
|
|
160
|
+
sends: ReadonlyMap<string, LocalSessionSend>;
|
|
161
|
+
/** The app new sessions are tagged with (the provider's `appId`). */
|
|
162
|
+
appId: string | undefined;
|
|
163
|
+
/** Whether a new chat's pending row belongs in this list (its scope and search allow it). */
|
|
164
|
+
showPendingSessions: boolean;
|
|
165
|
+
}): {
|
|
166
|
+
conversations: readonly ConversationSummary[];
|
|
167
|
+
pendingThreadIds: ReadonlySet<string>;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* The rows newest first by `updatedAt` (the order the server lists them in), keeping the given
|
|
171
|
+
* order between rows of the same instant. Identity is kept when the rows are already in order.
|
|
172
|
+
*/
|
|
173
|
+
export declare function sortNewestFirst<T extends {
|
|
174
|
+
updatedAt: string;
|
|
175
|
+
}>(rows: readonly T[]): readonly T[];
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { summaryFromConversationIndexEntry } from "../agent-runtime/src/conversation-list.js";
|
|
2
|
+
const AGENT_HOME_EXCLUDED_START_CHANNELS = /* @__PURE__ */ new Set([
|
|
3
|
+
"task",
|
|
4
|
+
"agent_orchestration"
|
|
5
|
+
]);
|
|
6
|
+
const LISTED_ASSET_TYPE = "session";
|
|
7
|
+
function isAgentHomeIndexEntry(entry, homeAgentId) {
|
|
8
|
+
if (!homeAgentId || entry.collab_agent_id !== homeAgentId) return false;
|
|
9
|
+
return !AGENT_HOME_EXCLUDED_START_CHANNELS.has(entry.start_channel ?? "");
|
|
10
|
+
}
|
|
11
|
+
function inSessionListScope(entry, scope) {
|
|
12
|
+
const appIds = [...scope.appId ? [scope.appId] : [], ...scope.additionalAppIds];
|
|
13
|
+
const agentId = scope.homeAgentApplied ? scope.homeAgentId : void 0;
|
|
14
|
+
if (appIds.length === 0) return agentId ? isAgentHomeIndexEntry(entry, agentId) : true;
|
|
15
|
+
return appIds.includes(entry.app_id ?? "") || isAgentHomeIndexEntry(entry, agentId);
|
|
16
|
+
}
|
|
17
|
+
function timestampMs(value) {
|
|
18
|
+
const parsed = Date.parse(value);
|
|
19
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
20
|
+
}
|
|
21
|
+
function withIndexedSessions({
|
|
22
|
+
conversations,
|
|
23
|
+
loadedConversations,
|
|
24
|
+
entries,
|
|
25
|
+
scope,
|
|
26
|
+
searching,
|
|
27
|
+
hasResolvedFirstPage,
|
|
28
|
+
hasNextPage
|
|
29
|
+
}) {
|
|
30
|
+
if (!entries || entries.length === 0 || searching || !hasResolvedFirstPage) return conversations;
|
|
31
|
+
const listed = new Set(conversations.map((conversation) => conversation.threadId));
|
|
32
|
+
let windowTailMs = null;
|
|
33
|
+
if (hasNextPage) {
|
|
34
|
+
for (const conversation of loadedConversations) {
|
|
35
|
+
const ms = timestampMs(conversation.updatedAt);
|
|
36
|
+
if (windowTailMs === null || ms < windowTailMs) windowTailMs = ms;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const added = [];
|
|
40
|
+
for (const entry of entries) {
|
|
41
|
+
if (listed.has(entry.thread_id)) continue;
|
|
42
|
+
if (entry.asset_type !== LISTED_ASSET_TYPE) continue;
|
|
43
|
+
if (!inSessionListScope(entry, scope)) continue;
|
|
44
|
+
if (windowTailMs !== null && timestampMs(entry.updated_at) < windowTailMs) continue;
|
|
45
|
+
listed.add(entry.thread_id);
|
|
46
|
+
added.push(summaryFromConversationIndexEntry(entry));
|
|
47
|
+
}
|
|
48
|
+
return added.length === 0 ? conversations : [...conversations, ...added];
|
|
49
|
+
}
|
|
50
|
+
const LOCAL_SEND_TTL_MS = 6e4;
|
|
51
|
+
const PENDING_TITLE_MAX_LENGTH = 200;
|
|
52
|
+
function pendingSessionTitle(text) {
|
|
53
|
+
const line = (text ?? "").replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\s+/g, " ").trim();
|
|
54
|
+
if (!line) return null;
|
|
55
|
+
return line.length <= PENDING_TITLE_MAX_LENGTH ? line : `${line.slice(0, PENDING_TITLE_MAX_LENGTH - 1).trimEnd()}…`;
|
|
56
|
+
}
|
|
57
|
+
function localSessionSend({
|
|
58
|
+
threadId,
|
|
59
|
+
text,
|
|
60
|
+
sentAtMs,
|
|
61
|
+
newChat,
|
|
62
|
+
startChannel,
|
|
63
|
+
serverConversations
|
|
64
|
+
}) {
|
|
65
|
+
let newestMs = 0;
|
|
66
|
+
let baselineUpdatedAt = null;
|
|
67
|
+
for (const conversation of serverConversations) {
|
|
68
|
+
const ms = timestampMs(conversation.updatedAt);
|
|
69
|
+
if (ms > newestMs) newestMs = ms;
|
|
70
|
+
if (conversation.threadId === threadId) baselineUpdatedAt = conversation.updatedAt;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
threadId,
|
|
74
|
+
sentAtMs,
|
|
75
|
+
sortAt: new Date(Math.max(sentAtMs, newestMs + 1)).toISOString(),
|
|
76
|
+
baselineUpdatedAt,
|
|
77
|
+
newChat: newChat && baselineUpdatedAt === null,
|
|
78
|
+
title: pendingSessionTitle(text),
|
|
79
|
+
startChannel
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function isLocalSendReported(send, serverRow) {
|
|
83
|
+
if (!serverRow) return false;
|
|
84
|
+
return send.baselineUpdatedAt === null || serverRow.updatedAt !== send.baselineUpdatedAt;
|
|
85
|
+
}
|
|
86
|
+
function withoutLocalSends(sends, threadIds) {
|
|
87
|
+
if (!threadIds.some((threadId) => sends.has(threadId))) return sends;
|
|
88
|
+
const next = new Map(sends);
|
|
89
|
+
for (const threadId of threadIds) next.delete(threadId);
|
|
90
|
+
return next;
|
|
91
|
+
}
|
|
92
|
+
function settledLocalSends({
|
|
93
|
+
sends,
|
|
94
|
+
serverConversations,
|
|
95
|
+
nowMs,
|
|
96
|
+
ttlMs = LOCAL_SEND_TTL_MS
|
|
97
|
+
}) {
|
|
98
|
+
if (sends.size === 0) return [];
|
|
99
|
+
const byThread = new Map(serverConversations.map((row) => [row.threadId, row]));
|
|
100
|
+
const settled = [];
|
|
101
|
+
for (const send of sends.values()) {
|
|
102
|
+
if (nowMs - send.sentAtMs >= ttlMs || isLocalSendReported(send, byThread.get(send.threadId))) {
|
|
103
|
+
settled.push(send.threadId);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return settled;
|
|
107
|
+
}
|
|
108
|
+
function withSentMessage(row, send) {
|
|
109
|
+
return {
|
|
110
|
+
...row,
|
|
111
|
+
updatedAt: timestampMs(row.updatedAt) >= timestampMs(send.sortAt) ? row.updatedAt : send.sortAt,
|
|
112
|
+
state: "running",
|
|
113
|
+
sessionStatus: "active",
|
|
114
|
+
runStatus: "running",
|
|
115
|
+
attention: "working",
|
|
116
|
+
nextAction: null,
|
|
117
|
+
attentionSource: null,
|
|
118
|
+
isUnread: false
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function pendingConversation(send, appId) {
|
|
122
|
+
const sentAt = new Date(send.sentAtMs).toISOString();
|
|
123
|
+
return {
|
|
124
|
+
threadId: send.threadId,
|
|
125
|
+
title: send.title ?? "",
|
|
126
|
+
updatedAt: send.sortAt,
|
|
127
|
+
createdAt: sentAt,
|
|
128
|
+
state: "running",
|
|
129
|
+
runtime: null,
|
|
130
|
+
// What the server stamps on the session's first run, when that is known here: the row's
|
|
131
|
+
// origin badge reads as the server's row will, never as a label made from the app id.
|
|
132
|
+
sourceChannel: send.startChannel,
|
|
133
|
+
assetType: LISTED_ASSET_TYPE,
|
|
134
|
+
assetId: null,
|
|
135
|
+
appId: appId ?? null,
|
|
136
|
+
triggerType: null,
|
|
137
|
+
preview: send.title,
|
|
138
|
+
messageCount: null,
|
|
139
|
+
isUnread: false,
|
|
140
|
+
sessionStatus: "active",
|
|
141
|
+
runStatus: "running",
|
|
142
|
+
attention: "working",
|
|
143
|
+
nextAction: null,
|
|
144
|
+
attentionSource: null,
|
|
145
|
+
isFavorited: false,
|
|
146
|
+
createdByMe: true
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function withLocalSends({
|
|
150
|
+
conversations,
|
|
151
|
+
sends,
|
|
152
|
+
appId,
|
|
153
|
+
showPendingSessions
|
|
154
|
+
}) {
|
|
155
|
+
if (sends.size === 0) return { conversations, pendingThreadIds: EMPTY_IDS };
|
|
156
|
+
const listed = /* @__PURE__ */ new Set();
|
|
157
|
+
let changed = false;
|
|
158
|
+
const rows = conversations.map((row) => {
|
|
159
|
+
listed.add(row.threadId);
|
|
160
|
+
const send = sends.get(row.threadId);
|
|
161
|
+
if (!send || isLocalSendReported(send, row)) return row;
|
|
162
|
+
changed = true;
|
|
163
|
+
return withSentMessage(row, send);
|
|
164
|
+
});
|
|
165
|
+
const pendingThreadIds = /* @__PURE__ */ new Set();
|
|
166
|
+
if (showPendingSessions) {
|
|
167
|
+
for (const send of sends.values()) {
|
|
168
|
+
if (!send.newChat || listed.has(send.threadId)) continue;
|
|
169
|
+
pendingThreadIds.add(send.threadId);
|
|
170
|
+
rows.push(pendingConversation(send, appId));
|
|
171
|
+
changed = true;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
conversations: changed ? rows : conversations,
|
|
176
|
+
pendingThreadIds: pendingThreadIds.size === 0 ? EMPTY_IDS : pendingThreadIds
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
const EMPTY_IDS = /* @__PURE__ */ new Set();
|
|
180
|
+
function sortNewestFirst(rows) {
|
|
181
|
+
var _a, _b;
|
|
182
|
+
const keyed = rows.map((row, index) => ({ row, index, ms: timestampMs(row.updatedAt) }));
|
|
183
|
+
let ordered = true;
|
|
184
|
+
for (let i = 1; i < keyed.length; i++) {
|
|
185
|
+
if ((((_a = keyed[i - 1]) == null ? void 0 : _a.ms) ?? 0) < (((_b = keyed[i]) == null ? void 0 : _b.ms) ?? 0)) {
|
|
186
|
+
ordered = false;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (ordered) return rows;
|
|
191
|
+
keyed.sort((a, b) => b.ms - a.ms || a.index - b.index);
|
|
192
|
+
return keyed.map(({ row }) => row);
|
|
193
|
+
}
|
|
194
|
+
export {
|
|
195
|
+
LOCAL_SEND_TTL_MS,
|
|
196
|
+
inSessionListScope,
|
|
197
|
+
isAgentHomeIndexEntry,
|
|
198
|
+
isLocalSendReported,
|
|
199
|
+
localSessionSend,
|
|
200
|
+
pendingSessionTitle,
|
|
201
|
+
settledLocalSends,
|
|
202
|
+
sortNewestFirst,
|
|
203
|
+
withIndexedSessions,
|
|
204
|
+
withLocalSends,
|
|
205
|
+
withoutLocalSends
|
|
206
|
+
};
|
|
207
|
+
//# sourceMappingURL=live-session-rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-session-rows.js","sources":["../../src/threads/live-session-rows.ts"],"sourcesContent":["/**\n * The rows the session list shows between one server answer and the next.\n *\n * The list's rows come from the fetched REST pages, and the signed-in user's\n * live conversation index updates them in place. Two gaps are filled here, so\n * the list follows what just happened without waiting for a re-read:\n *\n * - **Sessions the index pushed that the page does not list yet.** A session\n * just started (in this tab or anywhere else) reaches the index in about a\n * second; the re-read the list runs for it takes several more (measured on\n * staging 2026-11-06: push at +1.8 s, row drawn at +5.5 s). The pushed entry\n * is drawn at once, while the re-read still fills in what the index never\n * carries (pull requests, who started it).\n * - **A message this tab just sent.** The session moves to the top as working\n * the moment it is sent (a chat the server does not know yet gets a pending\n * row titled with the message), until the server reports the send.\n *\n * Rows are kept newest first by `updatedAt`, the server's own order, so a\n * session that just became active moves up instead of staying where its last\n * fetched copy was.\n *\n * Pure functions over the shared contract rows: the provider composes them,\n * and they are tested on their own.\n */\nimport {\n type ConversationIndexEntry,\n type ConversationSummary,\n summaryFromConversationIndexEntry,\n} from '@athenaintel/agent-runtime';\n\n/**\n * Start channels of an agent's sessions that the server leaves out when it lists the conversations\n * with a home agent (`home_agent_id`): the agent's tasks and the sessions an orchestrating agent\n * starts.\n */\nconst AGENT_HOME_EXCLUDED_START_CHANNELS: ReadonlySet<string> = new Set([\n 'task',\n 'agent_orchestration',\n]);\n\n/** The REST thread list only lists this asset type (`sdk_thread_list.py`); the index carries more. */\nconst LISTED_ASSET_TYPE = 'session';\n\n/**\n * Whether a pushed index entry is one of the conversations with `homeAgentId`'s agent that the\n * server lists beside the app scope: the agent's, and not one of its tasks or orchestration\n * sessions. An entry from a pod that predates `collab_agent_id` is not.\n */\nexport function isAgentHomeIndexEntry(\n entry: { collab_agent_id?: string | null; start_channel?: string | null },\n homeAgentId: string | undefined,\n): boolean {\n if (!homeAgentId || entry.collab_agent_id !== homeAgentId) return false;\n return !AGENT_HOME_EXCLUDED_START_CHANNELS.has(entry.start_channel ?? '');\n}\n\n/** Which sessions a list shows: its app scope, as the server applies it to every read. */\nexport interface SessionListScope {\n /** The provider's `appId`; the app's own sessions. */\n appId: string | undefined;\n /** Other apps whose sessions the list shows too (a union with `appId`). */\n additionalAppIds: readonly string[];\n /** The collab agent whose conversations the list also asks for (`home_agent_id`). */\n homeAgentId: string | undefined;\n /**\n * Whether the list's latest first page said the server widened it to the home agent's\n * conversations. A server that did not never lists them.\n */\n homeAgentApplied: boolean;\n}\n\n/**\n * Whether the server lists a session with these stamps in a list of this scope — the app filter\n * and the home-agent union exactly as `sdk_thread_list.py` applies them. With no app ids the list\n * holds every app's sessions, unless it was widened to an agent, which then makes it that agent's.\n */\nexport function inSessionListScope(\n entry: { app_id: string | null; collab_agent_id?: string | null; start_channel?: string | null },\n scope: SessionListScope,\n): boolean {\n const appIds = [...(scope.appId ? [scope.appId] : []), ...scope.additionalAppIds];\n const agentId = scope.homeAgentApplied ? scope.homeAgentId : undefined;\n if (appIds.length === 0) return agentId ? isAgentHomeIndexEntry(entry, agentId) : true;\n return appIds.includes(entry.app_id ?? '') || isAgentHomeIndexEntry(entry, agentId);\n}\n\nfunction timestampMs(value: string): number {\n const parsed = Date.parse(value);\n return Number.isNaN(parsed) ? 0 : parsed;\n}\n\n/**\n * The listed rows plus every session the index pushed that the list should show and does not\n * list yet: in the list's scope, a listed asset type, and — while older pages remain unread — no\n * older than the oldest loaded row, so a row is never drawn below sessions that are not loaded\n * yet. Nothing is added while a search is active (the server matches it; the index cannot) or\n * before the first page has answered (the page decides what the list starts with). Identity is\n * kept when nothing is added. The rows are not re-sorted here ({@link sortNewestFirst}).\n */\nexport function withIndexedSessions({\n conversations,\n loadedConversations,\n entries,\n scope,\n searching,\n hasResolvedFirstPage,\n hasNextPage,\n}: {\n /** The rows the list shows (fetched pages, pinned rows, folded with the index). */\n conversations: readonly ConversationSummary[];\n /** The fetched pages' rows alone: the window older pages continue below. */\n loadedConversations: readonly ConversationSummary[];\n entries: readonly ConversationIndexEntry[] | null;\n scope: SessionListScope;\n searching: boolean;\n hasResolvedFirstPage: boolean;\n hasNextPage: boolean;\n}): readonly ConversationSummary[] {\n if (!entries || entries.length === 0 || searching || !hasResolvedFirstPage) return conversations;\n const listed = new Set(conversations.map((conversation) => conversation.threadId));\n let windowTailMs: number | null = null;\n if (hasNextPage) {\n for (const conversation of loadedConversations) {\n const ms = timestampMs(conversation.updatedAt);\n if (windowTailMs === null || ms < windowTailMs) windowTailMs = ms;\n }\n }\n const added: ConversationSummary[] = [];\n for (const entry of entries) {\n if (listed.has(entry.thread_id)) continue;\n if (entry.asset_type !== LISTED_ASSET_TYPE) continue;\n if (!inSessionListScope(entry, scope)) continue;\n if (windowTailMs !== null && timestampMs(entry.updated_at) < windowTailMs) continue;\n listed.add(entry.thread_id);\n added.push(summaryFromConversationIndexEntry(entry));\n }\n return added.length === 0 ? conversations : [...conversations, ...added];\n}\n\n/** How long a sent message holds its session's row before the server's own copy must take over. */\nexport const LOCAL_SEND_TTL_MS = 60_000;\n\n/** The longest provisional title kept from a sent message; the server's own title replaces it. */\nconst PENDING_TITLE_MAX_LENGTH = 200;\n\n/**\n * A message this tab sent that the server has not reported yet. Held by the provider; it\n * shapes the session's row until the server's copy of the session reflects the send.\n */\nexport interface LocalSessionSend {\n threadId: string;\n /** When this tab sent it (the client's clock, ms since the epoch). */\n sentAtMs: number;\n /**\n * The instant the row sorts at until the server reports the send: the send time, and never\n * older than the newest row the list showed when it was sent, so the session leads the list\n * even on a client whose clock runs behind the server's.\n */\n sortAt: string;\n /**\n * The session's `updatedAt` as the list showed it when the message was sent; `null` when the\n * list did not show the session (a new chat, or an older session the loaded pages do not\n * reach). The send is reported once the server's row differs.\n */\n baselineUpdatedAt: string | null;\n /**\n * Whether the session was a chat this tab started that the server had not listed yet. Only\n * such a send gets a pending row: a session missing from the loaded pages may well exist.\n */\n newChat: boolean;\n /** The message as one line, the pending title of a chat the server does not know yet. */\n title: string | null;\n /**\n * The provenance the session's first run stamps, when it is known here (the SDK's own `web`,\n * or a host's `extraRunConfig.start_channel`); `null` when the backend decides it (a collab\n * channel stamps its own kind). A new chat's pending row shows it as its origin.\n */\n startChannel: string | null;\n}\n\n/**\n * A sent message as the one-line provisional title of its session: markdown links reduced to\n * their text (a mention reads as its name), whitespace folded, and long messages cut. `null`\n * when nothing is left (an attachment sent alone).\n */\nexport function pendingSessionTitle(text: string | null | undefined): string | null {\n const line = (text ?? '')\n .replace(/!?\\[([^\\]]*)\\]\\([^)]*\\)/g, '$1')\n .replace(/\\s+/g, ' ')\n .trim();\n if (!line) return null;\n return line.length <= PENDING_TITLE_MAX_LENGTH\n ? line\n : `${line.slice(0, PENDING_TITLE_MAX_LENGTH - 1).trimEnd()}…`;\n}\n\n/**\n * Record a send against the rows the server last reported: the baseline the server must move\n * past, and the instant the row sorts at until it does.\n */\nexport function localSessionSend({\n threadId,\n text,\n sentAtMs,\n newChat,\n startChannel,\n serverConversations,\n}: {\n threadId: string;\n text: string | null | undefined;\n sentAtMs: number;\n /** The session was a chat this tab started that the server had not listed yet. */\n newChat: boolean;\n /** The `start_channel` the send stamps (`effectiveStatewireStartChannel`); `null` if unknown. */\n startChannel: string | null;\n /** The server's rows as the list shows them (fetched pages and pushed index entries). */\n serverConversations: readonly ConversationSummary[];\n}): LocalSessionSend {\n let newestMs = 0;\n let baselineUpdatedAt: string | null = null;\n for (const conversation of serverConversations) {\n const ms = timestampMs(conversation.updatedAt);\n if (ms > newestMs) newestMs = ms;\n if (conversation.threadId === threadId) baselineUpdatedAt = conversation.updatedAt;\n }\n return {\n threadId,\n sentAtMs,\n sortAt: new Date(Math.max(sentAtMs, newestMs + 1)).toISOString(),\n baselineUpdatedAt,\n newChat: newChat && baselineUpdatedAt === null,\n title: pendingSessionTitle(text),\n startChannel,\n };\n}\n\n/**\n * Whether the server's copy of the session reflects the send: a session the list did not show\n * is reported once the server lists it at all; a listed session once its `updatedAt` moved.\n */\nexport function isLocalSendReported(\n send: LocalSessionSend,\n serverRow: ConversationSummary | undefined,\n): boolean {\n if (!serverRow) return false;\n return send.baselineUpdatedAt === null || serverRow.updatedAt !== send.baselineUpdatedAt;\n}\n\n/** The sends without `threadIds`; the same map when it holds none of them. */\nexport function withoutLocalSends(\n sends: ReadonlyMap<string, LocalSessionSend>,\n threadIds: readonly string[],\n): ReadonlyMap<string, LocalSessionSend> {\n if (!threadIds.some((threadId) => sends.has(threadId))) return sends;\n const next = new Map(sends);\n for (const threadId of threadIds) next.delete(threadId);\n return next;\n}\n\n/** The sends to forget: reported by the server, or older than {@link LOCAL_SEND_TTL_MS}. */\nexport function settledLocalSends({\n sends,\n serverConversations,\n nowMs,\n ttlMs = LOCAL_SEND_TTL_MS,\n}: {\n sends: ReadonlyMap<string, LocalSessionSend>;\n serverConversations: readonly ConversationSummary[];\n nowMs: number;\n ttlMs?: number;\n}): string[] {\n if (sends.size === 0) return [];\n const byThread = new Map(serverConversations.map((row) => [row.threadId, row]));\n const settled: string[] = [];\n for (const send of sends.values()) {\n if (nowMs - send.sentAtMs >= ttlMs || isLocalSendReported(send, byThread.get(send.threadId))) {\n settled.push(send.threadId);\n }\n }\n return settled;\n}\n\n/** The session as working, sorted at the send, until the server reports the send. */\nfunction withSentMessage(row: ConversationSummary, send: LocalSessionSend): ConversationSummary {\n return {\n ...row,\n updatedAt: timestampMs(row.updatedAt) >= timestampMs(send.sortAt) ? row.updatedAt : send.sortAt,\n state: 'running',\n sessionStatus: 'active',\n runStatus: 'running',\n attention: 'working',\n nextAction: null,\n attentionSource: null,\n isUnread: false,\n };\n}\n\n/** The pending row of a chat the server does not know yet, as the server will first list it. */\nfunction pendingConversation(send: LocalSessionSend, appId: string | undefined): ConversationSummary {\n const sentAt = new Date(send.sentAtMs).toISOString();\n return {\n threadId: send.threadId,\n title: send.title ?? '',\n updatedAt: send.sortAt,\n createdAt: sentAt,\n state: 'running',\n runtime: null,\n // What the server stamps on the session's first run, when that is known here: the row's\n // origin badge reads as the server's row will, never as a label made from the app id.\n sourceChannel: send.startChannel,\n assetType: LISTED_ASSET_TYPE,\n assetId: null,\n appId: appId ?? null,\n triggerType: null,\n preview: send.title,\n messageCount: null,\n isUnread: false,\n sessionStatus: 'active',\n runStatus: 'running',\n attention: 'working',\n nextAction: null,\n attentionSource: null,\n isFavorited: false,\n createdByMe: true,\n };\n}\n\n/**\n * The rows with this tab's unreported sends applied: a listed session the server has not\n * reported the send for shows as working and sorts at the send; a new chat this tab started\n * gets a pending row, if the list's scope holds this app's new sessions and no search is\n * active. A session the loaded pages do not reach gets nothing here: it exists, and the\n * server's push (or re-read) brings it to the top. Returns the rows and the ids of the pending\n * rows (which the server does not know, so writes cannot be offered on them). Identity is kept\n * when no send applies.\n */\nexport function withLocalSends({\n conversations,\n sends,\n appId,\n showPendingSessions,\n}: {\n conversations: readonly ConversationSummary[];\n sends: ReadonlyMap<string, LocalSessionSend>;\n /** The app new sessions are tagged with (the provider's `appId`). */\n appId: string | undefined;\n /** Whether a new chat's pending row belongs in this list (its scope and search allow it). */\n showPendingSessions: boolean;\n}): { conversations: readonly ConversationSummary[]; pendingThreadIds: ReadonlySet<string> } {\n if (sends.size === 0) return { conversations, pendingThreadIds: EMPTY_IDS };\n const listed = new Set<string>();\n let changed = false;\n const rows = conversations.map((row) => {\n listed.add(row.threadId);\n const send = sends.get(row.threadId);\n if (!send || isLocalSendReported(send, row)) return row;\n changed = true;\n return withSentMessage(row, send);\n });\n const pendingThreadIds = new Set<string>();\n if (showPendingSessions) {\n for (const send of sends.values()) {\n if (!send.newChat || listed.has(send.threadId)) continue;\n pendingThreadIds.add(send.threadId);\n rows.push(pendingConversation(send, appId));\n changed = true;\n }\n }\n return {\n conversations: changed ? rows : conversations,\n pendingThreadIds: pendingThreadIds.size === 0 ? EMPTY_IDS : pendingThreadIds,\n };\n}\n\nconst EMPTY_IDS: ReadonlySet<string> = new Set();\n\n/**\n * The rows newest first by `updatedAt` (the order the server lists them in), keeping the given\n * order between rows of the same instant. Identity is kept when the rows are already in order.\n */\nexport function sortNewestFirst<T extends { updatedAt: string }>(rows: readonly T[]): readonly T[] {\n const keyed = rows.map((row, index) => ({ row, index, ms: timestampMs(row.updatedAt) }));\n let ordered = true;\n for (let i = 1; i < keyed.length; i++) {\n if ((keyed[i - 1]?.ms ?? 0) < (keyed[i]?.ms ?? 0)) {\n ordered = false;\n break;\n }\n }\n if (ordered) return rows;\n keyed.sort((a, b) => b.ms - a.ms || a.index - b.index);\n return keyed.map(({ row }) => row);\n}\n"],"names":[],"mappings":";AAmCA,MAAM,yDAA8D,IAAI;AAAA,EACtE;AAAA,EACA;AACF,CAAC;AAGD,MAAM,oBAAoB;AAOnB,SAAS,sBACd,OACA,aACS;AACT,MAAI,CAAC,eAAe,MAAM,oBAAoB,YAAa,QAAO;AAClE,SAAO,CAAC,mCAAmC,IAAI,MAAM,iBAAiB,EAAE;AAC1E;AAsBO,SAAS,mBACd,OACA,OACS;AACT,QAAM,SAAS,CAAC,GAAI,MAAM,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAA,GAAK,GAAG,MAAM,gBAAgB;AAChF,QAAM,UAAU,MAAM,mBAAmB,MAAM,cAAc;AAC7D,MAAI,OAAO,WAAW,EAAG,QAAO,UAAU,sBAAsB,OAAO,OAAO,IAAI;AAClF,SAAO,OAA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AQ,oBAAoB,MAAM,GAAG,EAAG,QAAO;AACpD,cAAU;AACV,WAAO,gBAAgB,KAAK,IAAI;AAAA,EAClC,CAAC;AACD,QAAM,uCAAuB,IAAA;AAC7B,MAAI,qBAAqB;AACvB,eAAW,QAAQ,MAAM,UAAU;AACjC,UAAI,CAAC,KAAK,WAAW,OAAO,IAAI,KAAK,QAAQ,EAAG;AAChD,uBAAiB,IAAI,KAAK,QAAQ;AAClC,WAAK,KAAK,oBAAoB,MAAM,KAAK,CAAC;AAC1C,gBAAU;AAAA,IACZ;AAAA,EACF;AACA,SAAO;AAAA,IACL,eAAe,UAAU,OAAO;AAAA,IAChC,kBAAkB,iBAAiB,SAAS,IAAI,YAAY;AAAA,EAAA;AAEhE;AAEA,MAAM,gCAAqC,IAAA;AAMpC,SAAS,gBAAiD,MAAkC;;AACjG,QAAM,QAAQ,KAAK,IAAI,CAAC,KAAK,WAAW,EAAE,KAAK,OAAO,IAAI,YAAY,IAAI,SAAS,IAAI;AACvF,MAAI,UAAU;AACd,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,WAAK,WAAM,IAAI,CAAC,MAAX,mBAAc,OAAM,QAAM,WAAM,CAAC,MAAP,mBAAU,OAAM,IAAI;AACjD,gBAAU;AACV;AAAA,IACF;AAAA,EACF;AACA,MAAI,QAAS,QAAO;AACpB,QAAM,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK;AACrD,SAAO,MAAM,IAAI,CAAC,EAAE,IAAA,MAAU,GAAG;AACnC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-list-model.cjs","sources":["../../src/threads/session-list-model.ts"],"sourcesContent":["/**\n * Pure derivations behind `SessionList`: which group a session lands in,\n * which status indicator it shows, what its second line says, how its pull\n * requests collapse into one chip (and order in the list it opens), and how\n * its origin is labelled. Kept React-free so the render tests stay thin and\n * hosts that draw their own rows (`useAthenaSessionAttention`) can reuse the\n * same rules.\n */\nimport type { ConversationPullRequest } from '@athenaintel/agent-runtime';\nimport type { AthenaStatewireThreadSummary } from './statewire-thread-list';\n\nexport type SessionListGroup = 'Needs you' | 'Working' | 'Pinned' | 'Recent';\n\n/** Display order; a session appears once, in the FIRST group that applies. */\nexport const SESSION_LIST_GROUPS: readonly SessionListGroup[] = [\n 'Needs you',\n 'Working',\n 'Pinned',\n 'Recent',\n];\n\nexport function sessionListGroupOf(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'isFavorited'>,\n): SessionListGroup {\n if (thread.attention === 'needs_you') return 'Needs you';\n if (thread.attention === 'working') return 'Working';\n if (thread.isFavorited) return 'Pinned';\n return 'Recent';\n}\n\nexport interface SessionListSection {\n /** `null` for the single ungrouped section. */\n group: SessionListGroup | null;\n items: AthenaStatewireThreadSummary[];\n}\n\n/** Sections in display order; empty groups are omitted and row order is kept within a group. */\nexport function groupSessions(\n threads: readonly AthenaStatewireThreadSummary[],\n grouped: boolean,\n): SessionListSection[] {\n if (!grouped) return threads.length > 0 ? [{ group: null, items: [...threads] }] : [];\n const byGroup = new Map<SessionListGroup, AthenaStatewireThreadSummary[]>();\n for (const thread of threads) {\n const group = sessionListGroupOf(thread);\n const items = byGroup.get(group) ?? [];\n items.push(thread);\n byGroup.set(group, items);\n }\n return SESSION_LIST_GROUPS.flatMap((group) => {\n const items = byGroup.get(group);\n return items ? [{ group, items }] : [];\n });\n}\n\n/**\n * The status indicator at the head of a row: `needs_you` an orange dot,\n * `working` a spinner, `unread` (and not needs-you) a blue dot, `watching` a\n * clock, otherwise none. One indicator per row, in that precedence.\n */\nexport type SessionIndicator = 'needs_you' | 'working' | 'unread' | 'watching' | null;\n\nexport function sessionIndicator(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'isUnread'>,\n): SessionIndicator {\n if (thread.attention === 'needs_you') return 'needs_you';\n if (thread.attention === 'working') return 'working';\n if (thread.isUnread) return 'unread';\n if (thread.attention === 'watching') return 'watching';\n return null;\n}\n\nexport type SessionLineTone = 'needs_you' | 'ready' | 'error' | 'muted';\n\nexport interface SessionSecondaryLine {\n kind: 'next_action' | 'updated';\n text: string;\n tone: SessionLineTone;\n}\n\n/** \"5m ago\" / \"3h ago\" / \"2d ago\"; a locale date past a week; empty for an unparseable value. */\nexport function relativeTime(value: string, now: number = Date.now()): string {\n const timestamp = Date.parse(value);\n if (!Number.isFinite(timestamp)) return '';\n const minutes = Math.floor(Math.max(0, now - timestamp) / 60_000);\n if (minutes < 1) return 'just now';\n if (minutes < 60) return `${minutes}m ago`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h ago`;\n const days = Math.floor(hours / 24);\n return days < 7 ? `${days}d ago` : new Date(timestamp).toLocaleDateString();\n}\n\n/**\n * The row's second line: the server's next action coloured by attention\n * (needs-you orange, ready green, error red), else the muted relative time\n * of the last update.\n */\nexport function sessionSecondaryLine(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'nextAction' | 'updatedAt'>,\n now: number = Date.now(),\n): SessionSecondaryLine {\n const nextAction = thread.nextAction?.trim();\n if (nextAction) {\n const tone: SessionLineTone =\n thread.attention === 'needs_you'\n ? 'needs_you'\n : thread.attention === 'ready'\n ? 'ready'\n : thread.attention === 'error'\n ? 'error'\n : 'muted';\n return { kind: 'next_action', text: nextAction, tone };\n }\n return { kind: 'updated', text: relativeTime(thread.updatedAt, now), tone: 'muted' };\n}\n\nexport type PullRequestChipState = 'open' | 'draft' | 'merged' | 'closed';\n\nexport function pullRequestChipState(\n pullRequest: Pick<ConversationPullRequest, 'state' | 'isDraft'>,\n): PullRequestChipState {\n if (pullRequest.state === 'MERGED') return 'merged';\n if (pullRequest.state === 'CLOSED') return 'closed';\n return pullRequest.isDraft ? 'draft' : 'open';\n}\n\nexport interface PullRequestChip {\n /** State of the primary pull request (the one the chip links to). */\n state: PullRequestChipState;\n count: number;\n /** `#123` for one pull request, `3 PRs` for several. */\n label: string;\n url: string;\n title: string;\n checksState: ConversationPullRequest['checksState'];\n reviewDecision: string | null;\n}\n\nfunction pullRequestRank(pullRequest: ConversationPullRequest): number {\n return pullRequest.state === 'OPEN' ? (pullRequest.isDraft ? 1 : 0) : 2;\n}\n\nfunction updatedAtMs(pullRequest: ConversationPullRequest): number {\n const timestamp = Date.parse(pullRequest.updatedAt);\n return Number.isFinite(timestamp) ? timestamp : 0;\n}\n\n/**\n * A session's pull requests in the order its chip and its pull-request list\n * show them: the ones still in flight first (open before draft), then the\n * most recently updated. The first is the one the chip stands for.\n */\nexport function orderedPullRequests(\n pullRequests: readonly ConversationPullRequest[] | null | undefined,\n): ConversationPullRequest[] {\n if (!pullRequests) return [];\n return [...pullRequests].sort(\n (a, b) => pullRequestRank(a) - pullRequestRank(b) || updatedAtMs(b) - updatedAtMs(a),\n );\n}\n\n/** One chip per row, or `null` when the session opened no pull request (or none is known). */\nexport function pullRequestChip(\n pullRequests: readonly ConversationPullRequest[] | null | undefined,\n): PullRequestChip | null {\n if (!pullRequests || pullRequests.length === 0) return null;\n const primary = orderedPullRequests(pullRequests)[0];\n if (!primary) return null;\n return {\n state: pullRequestChipState(primary),\n count: pullRequests.length,\n label: pullRequests.length === 1 ? `#${primary.number}` : `${pullRequests.length} PRs`,\n url: primary.url,\n title: primary.title,\n checksState: primary.checksState,\n reviewDecision: primary.reviewDecision,\n };\n}\n\n/** The origin badge of a session started in the Athena web app (Olympus or an SDK app in a browser tab). */\nexport const WEB_APP_ORIGIN_LABEL = 'Athena';\n\n/**\n * Which rows `SessionList` badges with their origin: every one, only those\n * started somewhere other than the web app (Slack, GitHub, Chrome, an Office\n * host …), or none.\n */\nexport type SessionOriginBadges = 'all' | 'external' | 'none';\n\nconst CHANNEL_LABELS: Record<string, string> = {\n web: WEB_APP_ORIGIN_LABEL,\n olympus: WEB_APP_ORIGIN_LABEL,\n github: 'GitHub',\n api: 'API',\n email: 'Email',\n agent_email: 'Email',\n slack: 'Slack',\n sms: 'SMS',\n teams: 'Teams',\n task: 'Task',\n orchestration: 'Orchestration',\n computer: 'Computer',\n voice: 'Voice',\n mobile: 'Mobile',\n};\n\nfunction humanize(value: string): string {\n const words = value.replace(/^athena[-_]/, '').replace(/[-_.]+/g, ' ').trim();\n return words ? words.charAt(0).toUpperCase() + words.slice(1) : '';\n}\n\n/**\n * The origin badge: the client app when it is a recognizable surface\n * (Chrome, an Office host, mobile, a computer asset), else the start channel,\n * else a non-manual trigger; `null` when nothing is known.\n */\nexport function sessionOriginLabel(\n thread: Pick<AthenaStatewireThreadSummary, 'startChannel' | 'appId' | 'triggerType'>,\n): string | null {\n const appId = thread.appId?.trim().toLowerCase() ?? '';\n if (appId) {\n if (appId.includes('chrome')) return 'Chrome';\n if (appId.includes('powerpoint')) return 'PowerPoint';\n if (appId.includes('word')) return 'Word';\n if (appId.includes('excel')) return 'Excel';\n if (appId.includes('office')) return 'Office';\n if (appId.includes('mobile')) return 'Mobile';\n if (appId.startsWith('asset_')) return 'Computer';\n if (CHANNEL_LABELS[appId]) return CHANNEL_LABELS[appId];\n }\n const channel = thread.startChannel?.trim().toLowerCase() ?? '';\n if (channel) return CHANNEL_LABELS[channel] ?? humanize(channel);\n if (appId) return humanize(appId) || null;\n const trigger = thread.triggerType?.trim().toLowerCase() ?? '';\n if (trigger && trigger !== 'manual') return humanize(trigger) || null;\n return null;\n}\n\n/**\n * Client app ids that are the Athena web app itself: Olympus, and the\n * standalone app template, whose sessions carry no start channel when the\n * app does not report one (and would otherwise read as \"App\").\n */\nconst WEB_APP_IDS = new Set(['web', 'olympus', 'athena-app']);\n\n/** The origin badge a row shows under `badges` (`sessionOriginLabel`, filtered). */\nexport function sessionOriginBadge(\n thread: Pick<AthenaStatewireThreadSummary, 'startChannel' | 'appId' | 'triggerType'>,\n badges: SessionOriginBadges,\n): string | null {\n if (badges === 'none') return null;\n const origin = sessionOriginLabel(thread);\n if (badges === 'external') {\n const appId = thread.appId?.trim().toLowerCase() ?? '';\n if (origin === WEB_APP_ORIGIN_LABEL || WEB_APP_I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,iBAAP,mBAAqB,OAAO,kBAAiB;AAC7D,MAAI,QAAS,QAAO,eAAe,OAAO,KAAK,SAAS,OAAO;AAC/D,MAAI,MAAO,QAAO,SAAS,KAAK,KAAK;AACrC,QAAM,YAAU,YAAO,gBAAP,mBAAoB,OAAO,kBAAiB;AAC5D,MAAI,WAAW,YAAY,SAAU,QAAO,SAAS,OAAO,KAAK;AACjE,SAAO;AACT;AAOA,MAAM,cAAc,oBAAI,IAAI,CAAC,OAAO,WAAW,YAAY,CAAC;AAGrD,SAAS,mBACd,QACA,QACe;;AACf,MAAI,WAAW,OAAQ,QAAO;AAC9B,QAAM,SAAS,mBAAmB,MAAM;AACxC,MAAI,WAAW,YAAY;AACzB,UAAM,UAAQ,YAAO,UAAP,mBAAc,OAAO,kBAAiB;AACpD,QAAI,WAAW,wBAAwB,YAAY,IAAI,KAAK,EAAG,QAAO;AAAA,EACxE;AACA,SAAO;AACT;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"session-list-model.cjs","sources":["../../src/threads/session-list-model.ts"],"sourcesContent":["/**\n * Pure derivations behind `SessionList`: which group a session lands in,\n * which status indicator it shows, what its second line says, how its pull\n * requests collapse into one chip (and order in the list it opens), and how\n * its origin is labelled. Kept React-free so the render tests stay thin and\n * hosts that draw their own rows (`useAthenaSessionAttention`) can reuse the\n * same rules. Published alone as `@athenaintel/react/session-list-model`, so a\n * host's shell can draw a session's chips without loading the chat.\n */\nimport type { ConversationPullRequest } from '@athenaintel/agent-runtime';\nimport type { AthenaStatewireThreadSummary } from './statewire-thread-list';\n\nexport type SessionListGroup = 'Needs you' | 'Working' | 'Pinned' | 'Recent';\n\n/** Display order; a session appears once, in the FIRST group that applies. */\nexport const SESSION_LIST_GROUPS: readonly SessionListGroup[] = [\n 'Needs you',\n 'Working',\n 'Pinned',\n 'Recent',\n];\n\nexport function sessionListGroupOf(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'isFavorited'>,\n): SessionListGroup {\n if (thread.attention === 'needs_you') return 'Needs you';\n if (thread.attention === 'working') return 'Working';\n if (thread.isFavorited) return 'Pinned';\n return 'Recent';\n}\n\nexport interface SessionListSection {\n /** `null` for the single ungrouped section. */\n group: SessionListGroup | null;\n items: AthenaStatewireThreadSummary[];\n}\n\n/** Sections in display order; empty groups are omitted and row order is kept within a group. */\nexport function groupSessions(\n threads: readonly AthenaStatewireThreadSummary[],\n grouped: boolean,\n): SessionListSection[] {\n if (!grouped) return threads.length > 0 ? [{ group: null, items: [...threads] }] : [];\n const byGroup = new Map<SessionListGroup, AthenaStatewireThreadSummary[]>();\n for (const thread of threads) {\n const group = sessionListGroupOf(thread);\n const items = byGroup.get(group) ?? [];\n items.push(thread);\n byGroup.set(group, items);\n }\n return SESSION_LIST_GROUPS.flatMap((group) => {\n const items = byGroup.get(group);\n return items ? [{ group, items }] : [];\n });\n}\n\n/**\n * The status indicator at the head of a row: `needs_you` an orange dot,\n * `working` a spinner, `unread` (and not needs-you) a blue dot, `watching` a\n * clock, otherwise none. One indicator per row, in that precedence.\n */\nexport type SessionIndicator = 'needs_you' | 'working' | 'unread' | 'watching' | null;\n\nexport function sessionIndicator(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'isUnread'>,\n): SessionIndicator {\n if (thread.attention === 'needs_you') return 'needs_you';\n if (thread.attention === 'working') return 'working';\n if (thread.isUnread) return 'unread';\n if (thread.attention === 'watching') return 'watching';\n return null;\n}\n\nexport type SessionLineTone = 'needs_you' | 'ready' | 'error' | 'muted';\n\nexport interface SessionSecondaryLine {\n kind: 'next_action' | 'updated';\n text: string;\n tone: SessionLineTone;\n}\n\n/** \"5m ago\" / \"3h ago\" / \"2d ago\"; a locale date past a week; empty for an unparseable value. */\nexport function relativeTime(value: string, now: number = Date.now()): string {\n const timestamp = Date.parse(value);\n if (!Number.isFinite(timestamp)) return '';\n const minutes = Math.floor(Math.max(0, now - timestamp) / 60_000);\n if (minutes < 1) return 'just now';\n if (minutes < 60) return `${minutes}m ago`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h ago`;\n const days = Math.floor(hours / 24);\n return days < 7 ? `${days}d ago` : new Date(timestamp).toLocaleDateString();\n}\n\n/**\n * The row's second line: the server's next action coloured by attention\n * (needs-you orange, ready green, error red), else the muted relative time\n * of the last update.\n */\nexport function sessionSecondaryLine(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'nextAction' | 'updatedAt'>,\n now: number = Date.now(),\n): SessionSecondaryLine {\n const nextAction = thread.nextAction?.trim();\n if (nextAction) {\n const tone: SessionLineTone =\n thread.attention === 'needs_you'\n ? 'needs_you'\n : thread.attention === 'ready'\n ? 'ready'\n : thread.attention === 'error'\n ? 'error'\n : 'muted';\n return { kind: 'next_action', text: nextAction, tone };\n }\n return { kind: 'updated', text: relativeTime(thread.updatedAt, now), tone: 'muted' };\n}\n\nexport type PullRequestChipState = 'open' | 'draft' | 'merged' | 'closed';\n\nexport function pullRequestChipState(\n pullRequest: Pick<ConversationPullRequest, 'state' | 'isDraft'>,\n): PullRequestChipState {\n if (pullRequest.state === 'MERGED') return 'merged';\n if (pullRequest.state === 'CLOSED') return 'closed';\n return pullRequest.isDraft ? 'draft' : 'open';\n}\n\nexport interface PullRequestChip {\n /** State of the primary pull request (the one the chip links to). */\n state: PullRequestChipState;\n count: number;\n /** `#123` for one pull request, `3 PRs` for several. */\n label: string;\n url: string;\n title: string;\n checksState: ConversationPullRequest['checksState'];\n reviewDecision: string | null;\n}\n\nfunction pullRequestRank(pullRequest: ConversationPullRequest): number {\n return pullRequest.state === 'OPEN' ? (pullRequest.isDraft ? 1 : 0) : 2;\n}\n\nfunction updatedAtMs(pullRequest: ConversationPullRequest): number {\n const timestamp = Date.parse(pullRequest.updatedAt);\n return Number.isFinite(timestamp) ? timestamp : 0;\n}\n\n/**\n * A session's pull requests in the order its chip and its pull-request list\n * show them: the ones still in flight first (open before draft), then the\n * most recently updated. The first is the one the chip stands for.\n */\nexport function orderedPullRequests(\n pullRequests: readonly ConversationPullRequest[] | null | undefined,\n): ConversationPullRequest[] {\n if (!pullRequests) return [];\n return [...pullRequests].sort(\n (a, b) => pullRequestRank(a) - pullRequestRank(b) || updatedAtMs(b) - updatedAtMs(a),\n );\n}\n\n/** One chip per row, or `null` when the session opened no pull request (or none is known). */\nexport function pullRequestChip(\n pullRequests: readonly ConversationPullRequest[] | null | undefined,\n): PullRequestChip | null {\n if (!pullRequests || pullRequests.length === 0) return null;\n const primary = orderedPullRequests(pullRequests)[0];\n if (!primary) return null;\n return {\n state: pullRequestChipState(primary),\n count: pullRequests.length,\n label: pullRequests.length === 1 ? `#${primary.number}` : `${pullRequests.length} PRs`,\n url: primary.url,\n title: primary.title,\n checksState: primary.checksState,\n reviewDecision: primary.reviewDecision,\n };\n}\n\n/** The origin badge of a session started in the Athena web app (Olympus or an SDK app in a browser tab). */\nexport const WEB_APP_ORIGIN_LABEL = 'Athena';\n\n/**\n * Which rows `SessionList` badges with their origin: every one, only those\n * started somewhere other than the web app (Slack, GitHub, Chrome, an Office\n * host …), or none.\n */\nexport type SessionOriginBadges = 'all' | 'external' | 'none';\n\nconst CHANNEL_LABELS: Record<string, string> = {\n web: WEB_APP_ORIGIN_LABEL,\n olympus: WEB_APP_ORIGIN_LABEL,\n github: 'GitHub',\n api: 'API',\n email: 'Email',\n agent_email: 'Email',\n slack: 'Slack',\n sms: 'SMS',\n teams: 'Teams',\n task: 'Task',\n orchestration: 'Orchestration',\n computer: 'Computer',\n voice: 'Voice',\n mobile: 'Mobile',\n};\n\nfunction humanize(value: string): string {\n const words = value.replace(/^athena[-_]/, '').replace(/[-_.]+/g, ' ').trim();\n return words ? words.charAt(0).toUpperCase() + words.slice(1) : '';\n}\n\n/**\n * The origin badge: the client app when it is a recognizable surface\n * (Chrome, an Office host, mobile, a computer asset), else the start channel,\n * else a non-manual trigger; `null` when nothing is known.\n */\nexport function sessionOriginLabel(\n thread: Pick<AthenaStatewireThreadSummary, 'startChannel' | 'appId' | 'triggerType'>,\n): string | null {\n const appId = thread.appId?.trim().toLowerCase() ?? '';\n if (appId) {\n if (appId.includes('chrome')) return 'Chrome';\n if (appId.includes('powerpoint')) return 'PowerPoint';\n if (appId.includes('word')) return 'Word';\n if (appId.includes('excel')) return 'Excel';\n if (appId.includes('office')) return 'Office';\n if (appId.includes('mobile')) return 'Mobile';\n if (appId.startsWith('asset_')) return 'Computer';\n if (CHANNEL_LABELS[appId]) return CHANNEL_LABELS[appId];\n }\n const channel = thread.startChannel?.trim().toLowerCase() ?? '';\n if (channel) return CHANNEL_LABELS[channel] ?? humanize(channel);\n if (appId) return humanize(appId) || null;\n const trigger = thread.triggerType?.trim().toLowerCase() ?? '';\n if (trigger && trigger !== 'manual') return humanize(trigger) || null;\n return null;\n}\n\n/**\n * Client app ids that are the Athena web app itself: Olympus, and the\n * standalone app template, whose sessions carry no start channel when the\n * app does not report one (and would otherwise read as \"App\").\n */\nconst WEB_APP_IDS = new Set(['web', 'olympus', 'athena-app']);\n\n/** The origin badge a row shows under `badges` (`sessionOriginLabel`, filtered). */\nexport function sessionOriginBadge(\n thread: Pick<AthenaStatewireThreadSummary, 'startChannel' | 'appId' | 'triggerType'>,\n badges: SessionOriginBadges,\n): string | null {\n if (badges === 'none') return null;\n const origin = sessionOriginLabel(thread);\n if (badges === 'external') {\n const appId = thread.appId?.trim().toLowerCase() ?? '';\n if (origin === WEB_APP_ORIGIN_LABEL || WEB_APP_IDS.has(appId)) return null;\n }\n return origin;\n}\n"],"names":[],"mappings":";;AAeO,MAAM,sBAAmD;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,mBACd,QACkB;AAClB,MAAI,OAAO,cAAc,YAAa,QAAO;AAC7C,MAAI,OAAO,cAAc,UAAW,QAAO;AAC3C,MAAI,OAAO,YAAa,QAAO;AAC/B,SAAO;AACT;AASO,SAAS,cACd,SACA,SACsB;AACtB,MAAI,CAAC,QAAS,QAAO,QAAQ,SAAS,IAAI,CAAC,EAAE,OAAO,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AAW,OAAQ,QAAO;AAC9B,QAAM,SAAS,mBAAmB,MAAM;AACxC,MAAI,WAAW,YAAY;AACzB,UAAM,UAAQ,YAAO,UAAP,mBAAc,OAAO,kBAAiB;AACpD,QAAI,WAAW,wBAAwB,YAAY,IAAI,KAAK,EAAG,QAAO;AAAA,EACxE;AACA,SAAO;AACT;;;;;;;;;;;;;"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* requests collapse into one chip (and order in the list it opens), and how
|
|
5
5
|
* its origin is labelled. Kept React-free so the render tests stay thin and
|
|
6
6
|
* hosts that draw their own rows (`useAthenaSessionAttention`) can reuse the
|
|
7
|
-
* same rules.
|
|
7
|
+
* same rules. Published alone as `@athenaintel/react/session-list-model`, so a
|
|
8
|
+
* host's shell can draw a session's chips without loading the chat.
|
|
8
9
|
*/
|
|
9
10
|
import type { ConversationPullRequest } from '../agent-runtime/src/index';
|
|
10
11
|
import type { AthenaStatewireThreadSummary } from './statewire-thread-list';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-list-model.js","sources":["../../src/threads/session-list-model.ts"],"sourcesContent":["/**\n * Pure derivations behind `SessionList`: which group a session lands in,\n * which status indicator it shows, what its second line says, how its pull\n * requests collapse into one chip (and order in the list it opens), and how\n * its origin is labelled. Kept React-free so the render tests stay thin and\n * hosts that draw their own rows (`useAthenaSessionAttention`) can reuse the\n * same rules.\n */\nimport type { ConversationPullRequest } from '@athenaintel/agent-runtime';\nimport type { AthenaStatewireThreadSummary } from './statewire-thread-list';\n\nexport type SessionListGroup = 'Needs you' | 'Working' | 'Pinned' | 'Recent';\n\n/** Display order; a session appears once, in the FIRST group that applies. */\nexport const SESSION_LIST_GROUPS: readonly SessionListGroup[] = [\n 'Needs you',\n 'Working',\n 'Pinned',\n 'Recent',\n];\n\nexport function sessionListGroupOf(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'isFavorited'>,\n): SessionListGroup {\n if (thread.attention === 'needs_you') return 'Needs you';\n if (thread.attention === 'working') return 'Working';\n if (thread.isFavorited) return 'Pinned';\n return 'Recent';\n}\n\nexport interface SessionListSection {\n /** `null` for the single ungrouped section. */\n group: SessionListGroup | null;\n items: AthenaStatewireThreadSummary[];\n}\n\n/** Sections in display order; empty groups are omitted and row order is kept within a group. */\nexport function groupSessions(\n threads: readonly AthenaStatewireThreadSummary[],\n grouped: boolean,\n): SessionListSection[] {\n if (!grouped) return threads.length > 0 ? [{ group: null, items: [...threads] }] : [];\n const byGroup = new Map<SessionListGroup, AthenaStatewireThreadSummary[]>();\n for (const thread of threads) {\n const group = sessionListGroupOf(thread);\n const items = byGroup.get(group) ?? [];\n items.push(thread);\n byGroup.set(group, items);\n }\n return SESSION_LIST_GROUPS.flatMap((group) => {\n const items = byGroup.get(group);\n return items ? [{ group, items }] : [];\n });\n}\n\n/**\n * The status indicator at the head of a row: `needs_you` an orange dot,\n * `working` a spinner, `unread` (and not needs-you) a blue dot, `watching` a\n * clock, otherwise none. One indicator per row, in that precedence.\n */\nexport type SessionIndicator = 'needs_you' | 'working' | 'unread' | 'watching' | null;\n\nexport function sessionIndicator(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'isUnread'>,\n): SessionIndicator {\n if (thread.attention === 'needs_you') return 'needs_you';\n if (thread.attention === 'working') return 'working';\n if (thread.isUnread) return 'unread';\n if (thread.attention === 'watching') return 'watching';\n return null;\n}\n\nexport type SessionLineTone = 'needs_you' | 'ready' | 'error' | 'muted';\n\nexport interface SessionSecondaryLine {\n kind: 'next_action' | 'updated';\n text: string;\n tone: SessionLineTone;\n}\n\n/** \"5m ago\" / \"3h ago\" / \"2d ago\"; a locale date past a week; empty for an unparseable value. */\nexport function relativeTime(value: string, now: number = Date.now()): string {\n const timestamp = Date.parse(value);\n if (!Number.isFinite(timestamp)) return '';\n const minutes = Math.floor(Math.max(0, now - timestamp) / 60_000);\n if (minutes < 1) return 'just now';\n if (minutes < 60) return `${minutes}m ago`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h ago`;\n const days = Math.floor(hours / 24);\n return days < 7 ? `${days}d ago` : new Date(timestamp).toLocaleDateString();\n}\n\n/**\n * The row's second line: the server's next action coloured by attention\n * (needs-you orange, ready green, error red), else the muted relative time\n * of the last update.\n */\nexport function sessionSecondaryLine(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'nextAction' | 'updatedAt'>,\n now: number = Date.now(),\n): SessionSecondaryLine {\n const nextAction = thread.nextAction?.trim();\n if (nextAction) {\n const tone: SessionLineTone =\n thread.attention === 'needs_you'\n ? 'needs_you'\n : thread.attention === 'ready'\n ? 'ready'\n : thread.attention === 'error'\n ? 'error'\n : 'muted';\n return { kind: 'next_action', text: nextAction, tone };\n }\n return { kind: 'updated', text: relativeTime(thread.updatedAt, now), tone: 'muted' };\n}\n\nexport type PullRequestChipState = 'open' | 'draft' | 'merged' | 'closed';\n\nexport function pullRequestChipState(\n pullRequest: Pick<ConversationPullRequest, 'state' | 'isDraft'>,\n): PullRequestChipState {\n if (pullRequest.state === 'MERGED') return 'merged';\n if (pullRequest.state === 'CLOSED') return 'closed';\n return pullRequest.isDraft ? 'draft' : 'open';\n}\n\nexport interface PullRequestChip {\n /** State of the primary pull request (the one the chip links to). */\n state: PullRequestChipState;\n count: number;\n /** `#123` for one pull request, `3 PRs` for several. */\n label: string;\n url: string;\n title: string;\n checksState: ConversationPullRequest['checksState'];\n reviewDecision: string | null;\n}\n\nfunction pullRequestRank(pullRequest: ConversationPullRequest): number {\n return pullRequest.state === 'OPEN' ? (pullRequest.isDraft ? 1 : 0) : 2;\n}\n\nfunction updatedAtMs(pullRequest: ConversationPullRequest): number {\n const timestamp = Date.parse(pullRequest.updatedAt);\n return Number.isFinite(timestamp) ? timestamp : 0;\n}\n\n/**\n * A session's pull requests in the order its chip and its pull-request list\n * show them: the ones still in flight first (open before draft), then the\n * most recently updated. The first is the one the chip stands for.\n */\nexport function orderedPullRequests(\n pullRequests: readonly ConversationPullRequest[] | null | undefined,\n): ConversationPullRequest[] {\n if (!pullRequests) return [];\n return [...pullRequests].sort(\n (a, b) => pullRequestRank(a) - pullRequestRank(b) || updatedAtMs(b) - updatedAtMs(a),\n );\n}\n\n/** One chip per row, or `null` when the session opened no pull request (or none is known). */\nexport function pullRequestChip(\n pullRequests: readonly ConversationPullRequest[] | null | undefined,\n): PullRequestChip | null {\n if (!pullRequests || pullRequests.length === 0) return null;\n const primary = orderedPullRequests(pullRequests)[0];\n if (!primary) return null;\n return {\n state: pullRequestChipState(primary),\n count: pullRequests.length,\n label: pullRequests.length === 1 ? `#${primary.number}` : `${pullRequests.length} PRs`,\n url: primary.url,\n title: primary.title,\n checksState: primary.checksState,\n reviewDecision: primary.reviewDecision,\n };\n}\n\n/** The origin badge of a session started in the Athena web app (Olympus or an SDK app in a browser tab). */\nexport const WEB_APP_ORIGIN_LABEL = 'Athena';\n\n/**\n * Which rows `SessionList` badges with their origin: every one, only those\n * started somewhere other than the web app (Slack, GitHub, Chrome, an Office\n * host …), or none.\n */\nexport type SessionOriginBadges = 'all' | 'external' | 'none';\n\nconst CHANNEL_LABELS: Record<string, string> = {\n web: WEB_APP_ORIGIN_LABEL,\n olympus: WEB_APP_ORIGIN_LABEL,\n github: 'GitHub',\n api: 'API',\n email: 'Email',\n agent_email: 'Email',\n slack: 'Slack',\n sms: 'SMS',\n teams: 'Teams',\n task: 'Task',\n orchestration: 'Orchestration',\n computer: 'Computer',\n voice: 'Voice',\n mobile: 'Mobile',\n};\n\nfunction humanize(value: string): string {\n const words = value.replace(/^athena[-_]/, '').replace(/[-_.]+/g, ' ').trim();\n return words ? words.charAt(0).toUpperCase() + words.slice(1) : '';\n}\n\n/**\n * The origin badge: the client app when it is a recognizable surface\n * (Chrome, an Office host, mobile, a computer asset), else the start channel,\n * else a non-manual trigger; `null` when nothing is known.\n */\nexport function sessionOriginLabel(\n thread: Pick<AthenaStatewireThreadSummary, 'startChannel' | 'appId' | 'triggerType'>,\n): string | null {\n const appId = thread.appId?.trim().toLowerCase() ?? '';\n if (appId) {\n if (appId.includes('chrome')) return 'Chrome';\n if (appId.includes('powerpoint')) return 'PowerPoint';\n if (appId.includes('word')) return 'Word';\n if (appId.includes('excel')) return 'Excel';\n if (appId.includes('office')) return 'Office';\n if (appId.includes('mobile')) return 'Mobile';\n if (appId.startsWith('asset_')) return 'Computer';\n if (CHANNEL_LABELS[appId]) return CHANNEL_LABELS[appId];\n }\n const channel = thread.startChannel?.trim().toLowerCase() ?? '';\n if (channel) return CHANNEL_LABELS[channel] ?? humanize(channel);\n if (appId) return humanize(appId) || null;\n const trigger = thread.triggerType?.trim().toLowerCase() ?? '';\n if (trigger && trigger !== 'manual') return humanize(trigger) || null;\n return null;\n}\n\n/**\n * Client app ids that are the Athena web app itself: Olympus, and the\n * standalone app template, whose sessions carry no start channel when the\n * app does not report one (and would otherwise read as \"App\").\n */\nconst WEB_APP_IDS = new Set(['web', 'olympus', 'athena-app']);\n\n/** The origin badge a row shows under `badges` (`sessionOriginLabel`, filtered). */\nexport function sessionOriginBadge(\n thread: Pick<AthenaStatewireThreadSummary, 'startChannel' | 'appId' | 'triggerType'>,\n badges: SessionOriginBadges,\n): string | null {\n if (badges === 'none') return null;\n const origin = sessionOriginLabel(thread);\n if (badges === 'external') {\n const appId = thread.appId?.trim().toLowerCase() ?? '';\n if (origin === WEB_APP_ORIGIN_LABEL || WEB_APP_IDS.has(appId)) return null;\n }\n return origin;\n}\n"],"names":[],"mappings":"AAcO,MAAM,sBAAmD;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,mBACd,QACkB;AAClB,MAAI,OAAO,cAAc,YAAa,QAAO;AAC7C,MAAI,OAAO,cAAc,UAAW,QAAO;AAC3C,MAAI,OAAO,YAAa,QAAO;AAC/B,SAAO;AACT;AASO,SAAS,cACd,SACA,SACsB;AACtB,MAAI,CAAC,QAAS,QAAO,QAAQ,SAAS,IAAI,CAAC,EAAE,OAAO,MAAM,OAAO,CAAC,GAAG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,WAAW,OAAQ,QAAO;AAC9B,QAAM,SAAS,mBAAmB,MAAM;AACxC,MAAI,WAAW,YAAY;AACzB,UAAM,UAAQ,YAAO,UAAP,mBAAc,OAAO,kBAAiB;AACpD,QAAI,WAAW,wBAAwB,YAAY,IAAI,KAAK,EAAG,QAAO;AAAA,EACxE;AACA,SAAO;AACT;"}
|
|
1
|
+
{"version":3,"file":"session-list-model.js","sources":["../../src/threads/session-list-model.ts"],"sourcesContent":["/**\n * Pure derivations behind `SessionList`: which group a session lands in,\n * which status indicator it shows, what its second line says, how its pull\n * requests collapse into one chip (and order in the list it opens), and how\n * its origin is labelled. Kept React-free so the render tests stay thin and\n * hosts that draw their own rows (`useAthenaSessionAttention`) can reuse the\n * same rules. Published alone as `@athenaintel/react/session-list-model`, so a\n * host's shell can draw a session's chips without loading the chat.\n */\nimport type { ConversationPullRequest } from '@athenaintel/agent-runtime';\nimport type { AthenaStatewireThreadSummary } from './statewire-thread-list';\n\nexport type SessionListGroup = 'Needs you' | 'Working' | 'Pinned' | 'Recent';\n\n/** Display order; a session appears once, in the FIRST group that applies. */\nexport const SESSION_LIST_GROUPS: readonly SessionListGroup[] = [\n 'Needs you',\n 'Working',\n 'Pinned',\n 'Recent',\n];\n\nexport function sessionListGroupOf(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'isFavorited'>,\n): SessionListGroup {\n if (thread.attention === 'needs_you') return 'Needs you';\n if (thread.attention === 'working') return 'Working';\n if (thread.isFavorited) return 'Pinned';\n return 'Recent';\n}\n\nexport interface SessionListSection {\n /** `null` for the single ungrouped section. */\n group: SessionListGroup | null;\n items: AthenaStatewireThreadSummary[];\n}\n\n/** Sections in display order; empty groups are omitted and row order is kept within a group. */\nexport function groupSessions(\n threads: readonly AthenaStatewireThreadSummary[],\n grouped: boolean,\n): SessionListSection[] {\n if (!grouped) return threads.length > 0 ? [{ group: null, items: [...threads] }] : [];\n const byGroup = new Map<SessionListGroup, AthenaStatewireThreadSummary[]>();\n for (const thread of threads) {\n const group = sessionListGroupOf(thread);\n const items = byGroup.get(group) ?? [];\n items.push(thread);\n byGroup.set(group, items);\n }\n return SESSION_LIST_GROUPS.flatMap((group) => {\n const items = byGroup.get(group);\n return items ? [{ group, items }] : [];\n });\n}\n\n/**\n * The status indicator at the head of a row: `needs_you` an orange dot,\n * `working` a spinner, `unread` (and not needs-you) a blue dot, `watching` a\n * clock, otherwise none. One indicator per row, in that precedence.\n */\nexport type SessionIndicator = 'needs_you' | 'working' | 'unread' | 'watching' | null;\n\nexport function sessionIndicator(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'isUnread'>,\n): SessionIndicator {\n if (thread.attention === 'needs_you') return 'needs_you';\n if (thread.attention === 'working') return 'working';\n if (thread.isUnread) return 'unread';\n if (thread.attention === 'watching') return 'watching';\n return null;\n}\n\nexport type SessionLineTone = 'needs_you' | 'ready' | 'error' | 'muted';\n\nexport interface SessionSecondaryLine {\n kind: 'next_action' | 'updated';\n text: string;\n tone: SessionLineTone;\n}\n\n/** \"5m ago\" / \"3h ago\" / \"2d ago\"; a locale date past a week; empty for an unparseable value. */\nexport function relativeTime(value: string, now: number = Date.now()): string {\n const timestamp = Date.parse(value);\n if (!Number.isFinite(timestamp)) return '';\n const minutes = Math.floor(Math.max(0, now - timestamp) / 60_000);\n if (minutes < 1) return 'just now';\n if (minutes < 60) return `${minutes}m ago`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h ago`;\n const days = Math.floor(hours / 24);\n return days < 7 ? `${days}d ago` : new Date(timestamp).toLocaleDateString();\n}\n\n/**\n * The row's second line: the server's next action coloured by attention\n * (needs-you orange, ready green, error red), else the muted relative time\n * of the last update.\n */\nexport function sessionSecondaryLine(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'nextAction' | 'updatedAt'>,\n now: number = Date.now(),\n): SessionSecondaryLine {\n const nextAction = thread.nextAction?.trim();\n if (nextAction) {\n const tone: SessionLineTone =\n thread.attention === 'needs_you'\n ? 'needs_you'\n : thread.attention === 'ready'\n ? 'ready'\n : thread.attention === 'error'\n ? 'error'\n : 'muted';\n return { kind: 'next_action', text: nextAction, tone };\n }\n return { kind: 'updated', text: relativeTime(thread.updatedAt, now), tone: 'muted' };\n}\n\nexport type PullRequestChipState = 'open' | 'draft' | 'merged' | 'closed';\n\nexport function pullRequestChipState(\n pullRequest: Pick<ConversationPullRequest, 'state' | 'isDraft'>,\n): PullRequestChipState {\n if (pullRequest.state === 'MERGED') return 'merged';\n if (pullRequest.state === 'CLOSED') return 'closed';\n return pullRequest.isDraft ? 'draft' : 'open';\n}\n\nexport interface PullRequestChip {\n /** State of the primary pull request (the one the chip links to). */\n state: PullRequestChipState;\n count: number;\n /** `#123` for one pull request, `3 PRs` for several. */\n label: string;\n url: string;\n title: string;\n checksState: ConversationPullRequest['checksState'];\n reviewDecision: string | null;\n}\n\nfunction pullRequestRank(pullRequest: ConversationPullRequest): number {\n return pullRequest.state === 'OPEN' ? (pullRequest.isDraft ? 1 : 0) : 2;\n}\n\nfunction updatedAtMs(pullRequest: ConversationPullRequest): number {\n const timestamp = Date.parse(pullRequest.updatedAt);\n return Number.isFinite(timestamp) ? timestamp : 0;\n}\n\n/**\n * A session's pull requests in the order its chip and its pull-request list\n * show them: the ones still in flight first (open before draft), then the\n * most recently updated. The first is the one the chip stands for.\n */\nexport function orderedPullRequests(\n pullRequests: readonly ConversationPullRequest[] | null | undefined,\n): ConversationPullRequest[] {\n if (!pullRequests) return [];\n return [...pullRequests].sort(\n (a, b) => pullRequestRank(a) - pullRequestRank(b) || updatedAtMs(b) - updatedAtMs(a),\n );\n}\n\n/** One chip per row, or `null` when the session opened no pull request (or none is known). */\nexport function pullRequestChip(\n pullRequests: readonly ConversationPullRequest[] | null | undefined,\n): PullRequestChip | null {\n if (!pullRequests || pullRequests.length === 0) return null;\n const primary = orderedPullRequests(pullRequests)[0];\n if (!primary) return null;\n return {\n state: pullRequestChipState(primary),\n count: pullRequests.length,\n label: pullRequests.length === 1 ? `#${primary.number}` : `${pullRequests.length} PRs`,\n url: primary.url,\n title: primary.title,\n checksState: primary.checksState,\n reviewDecision: primary.reviewDecision,\n };\n}\n\n/** The origin badge of a session started in the Athena web app (Olympus or an SDK app in a browser tab). */\nexport const WEB_APP_ORIGIN_LABEL = 'Athena';\n\n/**\n * Which rows `SessionList` badges with their origin: every one, only those\n * started somewhere other than the web app (Slack, GitHub, Chrome, an Office\n * host …), or none.\n */\nexport type SessionOriginBadges = 'all' | 'external' | 'none';\n\nconst CHANNEL_LABELS: Record<string, string> = {\n web: WEB_APP_ORIGIN_LABEL,\n olympus: WEB_APP_ORIGIN_LABEL,\n github: 'GitHub',\n api: 'API',\n email: 'Email',\n agent_email: 'Email',\n slack: 'Slack',\n sms: 'SMS',\n teams: 'Teams',\n task: 'Task',\n orchestration: 'Orchestration',\n computer: 'Computer',\n voice: 'Voice',\n mobile: 'Mobile',\n};\n\nfunction humanize(value: string): string {\n const words = value.replace(/^athena[-_]/, '').replace(/[-_.]+/g, ' ').trim();\n return words ? words.charAt(0).toUpperCase() + words.slice(1) : '';\n}\n\n/**\n * The origin badge: the client app when it is a recognizable surface\n * (Chrome, an Office host, mobile, a computer asset), else the start channel,\n * else a non-manual trigger; `null` when nothing is known.\n */\nexport function sessionOriginLabel(\n thread: Pick<AthenaStatewireThreadSummary, 'startChannel' | 'appId' | 'triggerType'>,\n): string | null {\n const appId = thread.appId?.trim().toLowerCase() ?? '';\n if (appId) {\n if (appId.includes('chrome')) return 'Chrome';\n if (appId.includes('powerpoint')) return 'PowerPoint';\n if (appId.includes('word')) return 'Word';\n if (appId.includes('excel')) return 'Excel';\n if (appId.includes('office')) return 'Office';\n if (appId.includes('mobile')) return 'Mobile';\n if (appId.startsWith('asset_')) return 'Computer';\n if (CHANNEL_LABELS[appId]) return CHANNEL_LABELS[appId];\n }\n const channel = thread.startChannel?.trim().toLowerCase() ?? '';\n if (channel) return CHANNEL_LABELS[channel] ?? humanize(channel);\n if (appId) return humanize(appId) || null;\n const trigger = thread.triggerType?.trim().toLowerCase() ?? '';\n if (trigger && trigger !== 'manual') return humanize(trigger) || null;\n return null;\n}\n\n/**\n * Client app ids that are the Athena web app itself: Olympus, and the\n * standalone app template, whose sessions carry no start channel when the\n * app does not report one (and would otherwise read as \"App\").\n */\nconst WEB_APP_IDS = new Set(['web', 'olympus', 'athena-app']);\n\n/** The origin badge a row shows under `badges` (`sessionOriginLabel`, filtered). */\nexport function sessionOriginBadge(\n thread: Pick<AthenaStatewireThreadSummary, 'startChannel' | 'appId' | 'triggerType'>,\n badges: SessionOriginBadges,\n): string | null {\n if (badges === 'none') return null;\n const origin = sessionOriginLabel(thread);\n if (badges === 'external') {\n const appId = thread.appId?.trim().toLowerCase() ?? '';\n if (origin === WEB_APP_ORIGIN_LABEL || WEB_APP_IDS.has(appId)) return null;\n }\n return origin;\n}\n"],"names":[],"mappings":"AAeO,MAAM,sBAAmD;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,mBACd,QACkB;AAClB,MAAI,OAAO,cAAc,YAAa,QAAO;AAC7C,MAAI,OAAO,cAAc,UAAW,QAAO;AAC3C,MAAI,OAAO,YAAa,QAAO;AAC/B,SAAO;AACT;AASO,SAAS,cACd,SACA,SACsB;AACtB,MAAI,CAAC,QAAS,QAAO,QAAQ,SAAS,IAAI,CAAC,EAAE,OAAO,MAAM,OAAO,CAAC,GAAG,OAAO,EAAA,CAAG,IAAI,CAAA;AACnF,QAAM,8BAAc,IAAA;AACpB,aAAW,UAAU,SAAS;AAC5B,UAAM,QAAQ,mBAAmB,MAAM;AACvC,UAAM,QAAQ,QAAQ,IAAI,KAAK,KAAK,CAAA;AACpC,UAAM,KAAK,MAAM;AACjB,YAAQ,IAAI,OAAO,KAAK;AAAA,EAC1B;AACA,SAAO,oBAAoB,QAAQ,CAAC,UAAU;AAC5C,UAAM,QAAQ,QAAQ,IAAI,KAAK;AAC/B,WAAO,QAAQ,CAAC,EAAE,OAAO,M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,MAAM,MAAM,CAAC,IAAI;AAClE;AAOO,SAAS,mBACd,QACe;AA7MV;AA8ML,QAAM,UAAQ,YAAO,UAAP,mBAAc,OAAO,kBAAiB;AACpD,MAAI,OAAO;AACT,QAAI,MAAM,SAAS,QAAQ,EAAG,QAAO;AACrC,QAAI,MAAM,SAAS,YAAY,EAAG,QAAO;AACzC,QAAI,MAAM,SAAS,MAAM,EAAG,QAAO;AACnC,QAAI,MAAM,SAAS,OAAO,EAAG,QAAO;AACpC,QAAI,MAAM,SAAS,QAAQ,EAAG,QAAO;AACrC,QAAI,MAAM,SAAS,QAAQ,EAAG,QAAO;AACrC,QAAI,MAAM,WAAW,QAAQ,EAAG,QAAO;AACvC,QAAI,eAAe,KAAK,EAAG,QAAO,eAAe,KAAK;AAAA,EACxD;AACA,QAAM,YAAU,YAAO,iBAAP,mBAAqB,OAAO,kBAAiB;AAC7D,MAAI,QAAS,QAAO,eAAe,OAAO,KAAK,SAAS,OAAO;AAC/D,MAAI,MAAO,QAAO,SAAS,KAAK,KAAK;AACrC,QAAM,YAAU,YAAO,gBAAP,mBAAoB,OAAO,kBAAiB;AAC5D,MAAI,WAAW,YAAY,SAAU,QAAO,SAAS,OAAO,KAAK;AACjE,SAAO;AACT;AAOA,MAAM,cAAc,oBAAI,IAAI,CAAC,OAAO,WAAW,YAAY,CAAC;AAGrD,SAAS,mBACd,QACA,QACe;AA5OV;AA6OL,MAAI,WAAW,OAAQ,QAAO;AAC9B,QAAM,SAAS,mBAAmB,MAAM;AACxC,MAAI,WAAW,YAAY;AACzB,UAAM,UAAQ,YAAO,UAAP,mBAAc,OAAO,kBAAiB;AACpD,QAAI,WAAW,wBAAwB,YAAY,IAAI,KAAK,EAAG,QAAO;AAAA,EACxE;AACA,SAAO;AACT;"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const popover = require("../ui/popover.cjs");
|
|
5
5
|
const pullRequestDisplay = require("./pull-request-display.cjs");
|
|
6
|
-
const
|
|
6
|
+
const threads_sessionListModel = require("./session-list-model.cjs");
|
|
7
7
|
const cnfast = require("cnfast");
|
|
8
8
|
const FOCUS_RING_CLASS = "outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-0";
|
|
9
9
|
const stopPropagation = (event) => event.stopPropagation();
|
|
@@ -12,7 +12,7 @@ const PullRequestListRow = ({
|
|
|
12
12
|
pullRequest,
|
|
13
13
|
showRepo
|
|
14
14
|
}) => {
|
|
15
|
-
const state =
|
|
15
|
+
const state = threads_sessionListModel.pullRequestChipState(pullRequest);
|
|
16
16
|
const Icon = pullRequestDisplay.PR_STATE_ICON[state];
|
|
17
17
|
const meta = [
|
|
18
18
|
showRepo ? `${pullRequest.repoFullName} #${pullRequest.number}` : `#${pullRequest.number}`,
|
|
@@ -64,7 +64,7 @@ const PullRequestChip = ({ chip, pullRequests }) => {
|
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
const listLabel = `${chip.count} pull requests`;
|
|
67
|
-
const ordered =
|
|
67
|
+
const ordered = threads_sessionListModel.orderedPullRequests(pullRequests);
|
|
68
68
|
const repositories = new Set(ordered.map((pullRequest) => pullRequest.repoFullName));
|
|
69
69
|
const sharedRepository = repositories.size === 1 ? ((_a = ordered[0]) == null ? void 0 : _a.repoFullName) ?? null : null;
|
|
70
70
|
return /* @__PURE__ */ jsxRuntime.jsxs(popover.Popover, { children: [
|