@athenaintel/react 0.22.4 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +394 -4
- package/dist/chat/AthenaChat.cjs +346 -244
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +19 -8
- package/dist/chat/AthenaChat.js +350 -248
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireApprovalCard.cjs +2 -1
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.js +2 -1
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireClientToolBridge.cjs +1 -0
- package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
- package/dist/chat/StatewireClientToolBridge.js +1 -0
- package/dist/chat/StatewireClientToolBridge.js.map +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +1 -0
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.js +1 -0
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/WaitingOnYouBanner.cjs +100 -0
- package/dist/chat/WaitingOnYouBanner.cjs.map +1 -0
- package/dist/chat/WaitingOnYouBanner.d.ts +29 -0
- package/dist/chat/WaitingOnYouBanner.js +100 -0
- package/dist/chat/WaitingOnYouBanner.js.map +1 -0
- package/dist/chat/athena-chat-welcome.cjs +148 -0
- package/dist/chat/athena-chat-welcome.cjs.map +1 -0
- package/dist/chat/athena-chat-welcome.d.ts +54 -0
- package/dist/chat/athena-chat-welcome.js +148 -0
- package/dist/chat/athena-chat-welcome.js.map +1 -0
- package/dist/chat/athena-composer-controls.cjs +76 -0
- package/dist/chat/athena-composer-controls.cjs.map +1 -0
- package/dist/chat/athena-composer-controls.d.ts +21 -0
- package/dist/chat/athena-composer-controls.js +76 -0
- package/dist/chat/athena-composer-controls.js.map +1 -0
- package/dist/chat/composer-keyboard-hint.cjs +61 -0
- package/dist/chat/composer-keyboard-hint.cjs.map +1 -0
- package/dist/chat/composer-keyboard-hint.d.ts +33 -0
- package/dist/chat/composer-keyboard-hint.js +61 -0
- package/dist/chat/composer-keyboard-hint.js.map +1 -0
- package/dist/chat/message-time.cjs +64 -0
- package/dist/chat/message-time.cjs.map +1 -0
- package/dist/chat/message-time.d.ts +45 -0
- package/dist/chat/message-time.js +64 -0
- package/dist/chat/message-time.js.map +1 -0
- package/dist/chat/run-activity.cjs +38 -7
- package/dist/chat/run-activity.cjs.map +1 -1
- package/dist/chat/run-activity.d.ts +14 -3
- package/dist/chat/run-activity.js +39 -8
- package/dist/chat/run-activity.js.map +1 -1
- package/dist/chat/statewire-client-tools.cjs +2 -1
- package/dist/chat/statewire-client-tools.cjs.map +1 -1
- package/dist/chat/statewire-client-tools.js +2 -1
- package/dist/chat/statewire-client-tools.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs +2 -1
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.js +2 -1
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/thread-scroll-to-bottom.cjs +24 -0
- package/dist/chat/thread-scroll-to-bottom.cjs.map +1 -0
- package/dist/chat/thread-scroll-to-bottom.d.ts +11 -0
- package/dist/chat/thread-scroll-to-bottom.js +24 -0
- package/dist/chat/thread-scroll-to-bottom.js.map +1 -0
- package/dist/chat/tiptap-text.cjs +26 -95
- package/dist/chat/tiptap-text.cjs.map +1 -1
- package/dist/chat/tiptap-text.d.ts +13 -0
- package/dist/chat/tiptap-text.js +26 -95
- package/dist/chat/tiptap-text.js.map +1 -1
- package/dist/chat/use-athena-run-live.cjs +2 -1
- package/dist/chat/use-athena-run-live.cjs.map +1 -1
- package/dist/chat/use-athena-run-live.js +2 -1
- package/dist/chat/use-athena-run-live.js.map +1 -1
- package/dist/chat/use-statewire-approval-request.cjs +1 -0
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.js +1 -0
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.cjs +39 -4
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +21 -0
- package/dist/chat-ui/composer/tiptap-composer.js +39 -4
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/index.cjs +15 -1
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +6 -3
- package/dist/chat-ui/index.js +16 -2
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +31 -4
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.js +31 -4
- package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
- package/dist/chat-ui/messages/message-components.cjs +19 -1
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.d.ts +13 -0
- package/dist/chat-ui/messages/message-components.js +19 -1
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/messages/runtime-message.cjs +2 -1
- package/dist/chat-ui/messages/runtime-message.cjs.map +1 -1
- package/dist/chat-ui/messages/runtime-message.js +2 -1
- package/dist/chat-ui/messages/runtime-message.js.map +1 -1
- package/dist/chat-ui/messages/statewire-continue-run.cjs +1 -0
- package/dist/chat-ui/messages/statewire-continue-run.cjs.map +1 -1
- package/dist/chat-ui/messages/statewire-continue-run.js +1 -0
- package/dist/chat-ui/messages/statewire-continue-run.js.map +1 -1
- package/dist/chat-ui/messages/user-edit-composer.cjs +3 -1
- package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
- package/dist/chat-ui/messages/user-edit-composer.js +3 -1
- package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
- package/dist/chat-ui/messages/wake-marker.cjs +84 -0
- package/dist/chat-ui/messages/wake-marker.cjs.map +1 -0
- package/dist/chat-ui/messages/wake-marker.d.ts +16 -0
- package/dist/chat-ui/messages/wake-marker.js +84 -0
- package/dist/chat-ui/messages/wake-marker.js.map +1 -0
- package/dist/chat-ui/rich-text/chat-blocks.cjs +177 -0
- package/dist/chat-ui/rich-text/chat-blocks.cjs.map +1 -0
- package/dist/chat-ui/rich-text/chat-blocks.d.ts +58 -0
- package/dist/chat-ui/rich-text/chat-blocks.js +177 -0
- package/dist/chat-ui/rich-text/chat-blocks.js.map +1 -0
- package/dist/chat-ui/rich-text/chat-link.cjs +69 -0
- package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -0
- package/dist/chat-ui/rich-text/chat-link.d.ts +24 -0
- package/dist/chat-ui/rich-text/chat-link.js +69 -0
- package/dist/chat-ui/rich-text/chat-link.js.map +1 -0
- package/dist/chat-ui/rich-text/chat-message-body.cjs +144 -18
- package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.d.ts +10 -1
- package/dist/chat-ui/rich-text/chat-message-body.js +149 -23
- package/dist/chat-ui/rich-text/chat-message-body.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-node-views.cjs +38 -5
- package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-node-views.d.ts +11 -0
- package/dist/chat-ui/rich-text/chat-node-views.js +39 -6
- package/dist/chat-ui/rich-text/chat-node-views.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-text-schema.cjs +20 -3
- package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-text-schema.d.ts +15 -2
- package/dist/chat-ui/rich-text/chat-text-schema.js +20 -3
- package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
- package/dist/chat-ui/rich-text/citation-anchors.cjs +139 -0
- package/dist/chat-ui/rich-text/citation-anchors.cjs.map +1 -0
- package/dist/chat-ui/rich-text/citation-anchors.d.ts +74 -0
- package/dist/chat-ui/rich-text/citation-anchors.js +139 -0
- package/dist/chat-ui/rich-text/citation-anchors.js.map +1 -0
- package/dist/chat-ui/statewire.cjs +8 -1
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.d.ts +2 -0
- package/dist/chat-ui/statewire.js +8 -1
- package/dist/chat-ui/statewire.js.map +1 -1
- package/dist/chat-ui/thread/chat-composer-dock.cjs +27 -6
- package/dist/chat-ui/thread/chat-composer-dock.cjs.map +1 -1
- package/dist/chat-ui/thread/chat-composer-dock.d.ts +21 -1
- package/dist/chat-ui/thread/chat-composer-dock.js +28 -7
- package/dist/chat-ui/thread/chat-composer-dock.js.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +12 -13
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.d.ts +11 -10
- package/dist/chat-ui/thread/statewire-history-edge.js +13 -14
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/chat-ui/thread/thread-loading-overlay.cjs +31 -0
- package/dist/chat-ui/thread/thread-loading-overlay.cjs.map +1 -0
- package/dist/chat-ui/thread/thread-loading-overlay.d.ts +14 -0
- package/dist/chat-ui/thread/thread-loading-overlay.js +31 -0
- package/dist/chat-ui/thread/thread-loading-overlay.js.map +1 -0
- package/dist/composer/ComposerDropZone.cjs +8 -1
- package/dist/composer/ComposerDropZone.cjs.map +1 -1
- package/dist/composer/ComposerDropZone.d.ts +6 -0
- package/dist/composer/ComposerDropZone.js +9 -2
- package/dist/composer/ComposerDropZone.js.map +1 -1
- package/dist/diagnostics/errors.cjs +20 -0
- package/dist/diagnostics/errors.cjs.map +1 -1
- package/dist/diagnostics/errors.d.ts +20 -0
- package/dist/diagnostics/errors.js +20 -0
- package/dist/diagnostics/errors.js.map +1 -1
- package/dist/index.cjs +47 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +26 -7
- package/dist/index.js +51 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/use-prefers-reduced-motion.cjs +29 -0
- package/dist/lib/use-prefers-reduced-motion.cjs.map +1 -0
- package/dist/lib/use-prefers-reduced-motion.d.ts +6 -0
- package/dist/lib/use-prefers-reduced-motion.js +29 -0
- package/dist/lib/use-prefers-reduced-motion.js.map +1 -0
- package/dist/packages/agent-runtime/src/conversation-index.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/conversation-index.js.map +1 -1
- package/dist/packages/agent-runtime/src/conversation-list.cjs +59 -0
- package/dist/packages/agent-runtime/src/conversation-list.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/conversation-list.js +60 -1
- package/dist/packages/agent-runtime/src/conversation-list.js.map +1 -1
- package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.cjs +5 -3
- package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.js +5 -3
- package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
- package/dist/packages/agent-runtime/src/edit-command.cjs +21 -17
- package/dist/packages/agent-runtime/src/edit-command.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/edit-command.js +22 -18
- package/dist/packages/agent-runtime/src/edit-command.js.map +1 -1
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +9 -11
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +9 -11
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/packages/agent-runtime/src/github-wake-event.cjs +86 -0
- package/dist/packages/agent-runtime/src/github-wake-event.cjs.map +1 -0
- package/dist/packages/agent-runtime/src/github-wake-event.js +86 -0
- package/dist/packages/agent-runtime/src/github-wake-event.js.map +1 -0
- package/dist/packages/agent-runtime/src/message-window.cjs +150 -42
- package/dist/packages/agent-runtime/src/message-window.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/message-window.js +151 -43
- package/dist/packages/agent-runtime/src/message-window.js.map +1 -1
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs +13 -9
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js +13 -9
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
- package/dist/packages/agent-runtime/src/statewire-suspended.cjs +1 -3
- package/dist/packages/agent-runtime/src/statewire-suspended.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/statewire-suspended.js +1 -3
- package/dist/packages/agent-runtime/src/statewire-suspended.js.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs +61 -30
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.js +59 -28
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.cjs +56 -36
- package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.js +59 -39
- package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.js.map +1 -1
- package/dist/packages/react/package.json.cjs +1 -1
- package/dist/packages/react/package.json.js +1 -1
- package/dist/provider/AthenaContext.cjs.map +1 -1
- package/dist/provider/AthenaContext.d.ts +3 -0
- package/dist/provider/AthenaContext.js.map +1 -1
- package/dist/provider/AthenaProvider.cjs +93 -45
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +6 -1
- package/dist/provider/AthenaProvider.js +97 -49
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/runtime/statewire-lifecycle.cjs +2 -1
- package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.js +2 -1
- package/dist/runtime/statewire-lifecycle.js.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +3 -2
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +8 -12
- package/dist/runtime/useAthenaStatewireRuntime.js +3 -2
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/search/useAthenaRepoSearch.cjs +94 -0
- package/dist/search/useAthenaRepoSearch.cjs.map +1 -0
- package/dist/search/useAthenaRepoSearch.d.ts +95 -0
- package/dist/search/useAthenaRepoSearch.js +94 -0
- package/dist/search/useAthenaRepoSearch.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/threads/SessionList.cjs +486 -0
- package/dist/threads/SessionList.cjs.map +1 -0
- package/dist/threads/SessionList.d.ts +60 -0
- package/dist/threads/SessionList.js +486 -0
- package/dist/threads/SessionList.js.map +1 -0
- package/dist/threads/api.cjs +112 -4
- package/dist/threads/api.cjs.map +1 -1
- package/dist/threads/api.d.ts +128 -1
- package/dist/threads/api.js +113 -5
- package/dist/threads/api.js.map +1 -1
- package/dist/threads/conversation-list-fetcher.cjs +27 -3
- package/dist/threads/conversation-list-fetcher.cjs.map +1 -1
- package/dist/threads/conversation-list-fetcher.d.ts +16 -3
- package/dist/threads/conversation-list-fetcher.js +27 -3
- package/dist/threads/conversation-list-fetcher.js.map +1 -1
- package/dist/threads/index.d.ts +5 -1
- package/dist/threads/session-list-model.cjs +130 -0
- package/dist/threads/session-list-model.cjs.map +1 -0
- package/dist/threads/session-list-model.d.ts +62 -0
- package/dist/threads/session-list-model.js +130 -0
- package/dist/threads/session-list-model.js.map +1 -0
- package/dist/threads/statewire-thread-list.cjs +220 -38
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +152 -2
- package/dist/threads/statewire-thread-list.js +222 -40
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/thread-prefetcher.cjs +63 -0
- package/dist/threads/thread-prefetcher.cjs.map +1 -0
- package/dist/threads/thread-prefetcher.d.ts +54 -0
- package/dist/threads/thread-prefetcher.js +63 -0
- package/dist/threads/thread-prefetcher.js.map +1 -0
- package/dist/threads/use-athena-session-attention.cjs +22 -0
- package/dist/threads/use-athena-session-attention.cjs.map +1 -0
- package/dist/threads/use-athena-session-attention.d.ts +24 -0
- package/dist/threads/use-athena-session-attention.js +22 -0
- package/dist/threads/use-athena-session-attention.js.map +1 -0
- package/dist/threads/use-rest-conversation-history.cjs +25 -2
- package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
- package/dist/threads/use-rest-conversation-history.d.ts +8 -1
- package/dist/threads/use-rest-conversation-history.js +25 -2
- package/dist/threads/use-rest-conversation-history.js.map +1 -1
- package/dist/threads/use-statewire-conversation-history.cjs +40 -16
- package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
- package/dist/threads/use-statewire-conversation-history.d.ts +13 -0
- package/dist/threads/use-statewire-conversation-history.js +40 -16
- package/dist/threads/use-statewire-conversation-history.js.map +1 -1
- package/dist/threads/use-thread-archive.cjs +128 -0
- package/dist/threads/use-thread-archive.cjs.map +1 -0
- package/dist/threads/use-thread-archive.d.ts +26 -0
- package/dist/threads/use-thread-archive.js +128 -0
- package/dist/threads/use-thread-archive.js.map +1 -0
- package/dist/threads/use-thread-favorite.cjs +53 -0
- package/dist/threads/use-thread-favorite.cjs.map +1 -0
- package/dist/threads/use-thread-favorite.d.ts +49 -0
- package/dist/threads/use-thread-favorite.js +53 -0
- package/dist/threads/use-thread-favorite.js.map +1 -0
- package/dist/threads/use-thread-field-override.cjs +184 -0
- package/dist/threads/use-thread-field-override.cjs.map +1 -0
- package/dist/threads/use-thread-field-override.d.ts +55 -0
- package/dist/threads/use-thread-field-override.js +184 -0
- package/dist/threads/use-thread-field-override.js.map +1 -0
- package/dist/threads/use-thread-rename.cjs +53 -0
- package/dist/threads/use-thread-rename.cjs.map +1 -0
- package/dist/threads/use-thread-rename.d.ts +48 -0
- package/dist/threads/use-thread-rename.js +53 -0
- package/dist/threads/use-thread-rename.js.map +1 -0
- package/dist/tools/index.cjs +5 -1
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +7 -3
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/misc-tool-uis.cjs +2 -1
- package/dist/tools/misc-tool-uis.cjs.map +1 -1
- package/dist/tools/misc-tool-uis.js +2 -1
- package/dist/tools/misc-tool-uis.js.map +1 -1
- package/dist/tools/primitives.cjs +25 -2
- package/dist/tools/primitives.cjs.map +1 -1
- package/dist/tools/primitives.d.ts +9 -2
- package/dist/tools/primitives.js +26 -3
- package/dist/tools/primitives.js.map +1 -1
- package/dist/tools/tool-appearance.cjs +11 -0
- package/dist/tools/tool-appearance.cjs.map +1 -0
- package/dist/tools/tool-appearance.d.ts +29 -0
- package/dist/tools/tool-appearance.js +11 -0
- package/dist/tools/tool-appearance.js.map +1 -0
- package/dist/tools/tool-fallback.cjs +211 -13
- package/dist/tools/tool-fallback.cjs.map +1 -1
- package/dist/tools/tool-fallback.d.ts +31 -4
- package/dist/tools/tool-fallback.js +214 -16
- package/dist/tools/tool-fallback.js.map +1 -1
- package/dist/tools/use-elapsed-seconds.cjs +24 -0
- package/dist/tools/use-elapsed-seconds.cjs.map +1 -0
- package/dist/tools/use-elapsed-seconds.d.ts +10 -0
- package/dist/tools/use-elapsed-seconds.js +24 -0
- package/dist/tools/use-elapsed-seconds.js.map +1 -0
- package/dist/tools/voice-update-tool-ui.cjs +2 -1
- package/dist/tools/voice-update-tool-ui.cjs.map +1 -1
- package/dist/tools/voice-update-tool-ui.js +2 -1
- package/dist/tools/voice-update-tool-ui.js.map +1 -1
- package/package.json +3 -3
- package/src/chat-ui/tailwind-preset.js +14 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const api = require("./api.cjs");
|
|
5
|
+
const useThreadFieldOverride = require("./use-thread-field-override.cjs");
|
|
6
|
+
const RENAME_UNAVAILABLE_WARNING = "[AthenaSDK] This backend has no POST /api/conversations/threads/rename route yet; sessions cannot be renamed from here until it deploys.";
|
|
7
|
+
const readTitle = (row) => row.title;
|
|
8
|
+
function useThreadRename({
|
|
9
|
+
backendUrl,
|
|
10
|
+
principalId,
|
|
11
|
+
getAuth,
|
|
12
|
+
rows,
|
|
13
|
+
onServerTruth
|
|
14
|
+
}) {
|
|
15
|
+
const field = useThreadFieldOverride.useThreadFieldOverride({
|
|
16
|
+
field: "rename",
|
|
17
|
+
backendUrl,
|
|
18
|
+
principalId,
|
|
19
|
+
getAuth,
|
|
20
|
+
rows,
|
|
21
|
+
readRow: readTitle,
|
|
22
|
+
write: async (auth, { threadId, value }) => {
|
|
23
|
+
const result = await api.renameThread(backendUrl, auth, { threadId, title: value });
|
|
24
|
+
return { threadId: result.thread_id, value: result.title };
|
|
25
|
+
},
|
|
26
|
+
isUnavailableError: api.isThreadRenameUnavailableError,
|
|
27
|
+
unavailableWarning: RENAME_UNAVAILABLE_WARNING,
|
|
28
|
+
onServerTruth: onServerTruth ? ({ threadId, value }) => onServerTruth({ threadId, title: value }) : void 0
|
|
29
|
+
});
|
|
30
|
+
const set = field.set;
|
|
31
|
+
const rename = react.useCallback(
|
|
32
|
+
({ threadId, title }) => set({ threadId, value: title }),
|
|
33
|
+
[set]
|
|
34
|
+
);
|
|
35
|
+
return {
|
|
36
|
+
overrides: field.overrides,
|
|
37
|
+
rename,
|
|
38
|
+
isPending: field.isPending,
|
|
39
|
+
pendingThreadIds: field.pendingThreadIds,
|
|
40
|
+
isAvailable: field.isAvailable
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function withTitleOverride(row, overrides) {
|
|
44
|
+
const override = overrides[row.threadId];
|
|
45
|
+
return override === void 0 || override === row.title ? row : { ...row, title: override };
|
|
46
|
+
}
|
|
47
|
+
function withTitleOverrides(rows, overrides) {
|
|
48
|
+
return rows.map((row) => withTitleOverride(row, overrides));
|
|
49
|
+
}
|
|
50
|
+
exports.useThreadRename = useThreadRename;
|
|
51
|
+
exports.withTitleOverride = withTitleOverride;
|
|
52
|
+
exports.withTitleOverrides = withTitleOverrides;
|
|
53
|
+
//# sourceMappingURL=use-thread-rename.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-thread-rename.cjs","sources":["../../src/threads/use-thread-rename.ts"],"sourcesContent":["/**\n * The inline rename behind `SessionList`: `useThreadFieldOverride` over\n * `POST /api/conversations/threads/rename` (see that module for the\n * optimistic-override, rollback, serialization and identity-scoping\n * contract). The row shows the new title on commit; the server's stored\n * title (trimmed) is written back, and a failure restores the previous one.\n * A 404 / 405 marks the rename unavailable — the backend predates the route\n * — so the list withdraws the action instead of failing on every commit.\n */\nimport { useCallback } from 'react';\nimport { isThreadRenameUnavailableError, renameThread } from './api';\nimport type { RestConversationAuth } from './use-rest-conversation-history';\nimport { type ThreadFieldTarget, useThreadFieldOverride } from './use-thread-field-override';\n\nexport interface ThreadRenameTarget {\n threadId: string;\n /** The new title; the caller trims it (the server trims again and bounds it to 1–200 characters). */\n title: string;\n}\n\n/** The two fields the override layer reads and writes on a list row. */\nexport interface TitleRow {\n threadId: string;\n title: string;\n}\n\nexport interface UseThreadRenameOptions {\n backendUrl: string;\n /** Non-secret identity in the mutation key (as the read-state mutation keys). */\n principalId: string;\n getAuth: () => RestConversationAuth | Promise<RestConversationAuth>;\n /**\n * The rows as the list sources currently report them, BEFORE overrides. An\n * override is dropped once its row reports the same title.\n */\n rows: readonly TitleRow[];\n /** Write the server's answer into the list caches (`patchConversation`). */\n onServerTruth?: (result: ThreadRenameTarget) => void;\n}\n\nexport interface ThreadRename {\n /** Optimistic, then server-confirmed, titles layered over the list sources, keyed by thread id. */\n overrides: Readonly<Record<string, string>>;\n /**\n * Rename a thread. The row shows the title at once; while that thread's\n * write is in flight the call only records the desired title (see the\n * field-override module doc).\n */\n rename: (target: ThreadRenameTarget) => void;\n /** True while any rename is in flight. */\n isPending: boolean;\n /** The threads whose rename is in flight — the row's editor stays closed for these. */\n pendingThreadIds: ReadonlySet<string>;\n /**\n * `false` once the backend answered 404 / 405: the route is not deployed\n * there, and the list offers no rename action.\n */\n isAvailable: boolean;\n}\n\nconst RENAME_UNAVAILABLE_WARNING =\n '[AthenaSDK] This backend has no POST /api/conversations/threads/rename route yet; sessions cannot be renamed from here until it deploys.';\n\nconst readTitle = (row: TitleRow): string => row.title;\n\nexport function useThreadRename({\n backendUrl,\n principalId,\n getAuth,\n rows,\n onServerTruth,\n}: UseThreadRenameOptions): ThreadRename {\n const field = useThreadFieldOverride<string, TitleRow>({\n field: 'rename',\n backendUrl,\n principalId,\n getAuth,\n rows,\n readRow: readTitle,\n write: async (auth, { threadId, value }) => {\n const result = await renameThread(backendUrl, auth, { threadId, title: value });\n return { threadId: result.thread_id, value: result.title };\n },\n isUnavailableError: isThreadRenameUnavailableError,\n unavailableWarning: RENAME_UNAVAILABLE_WARNING,\n onServerTruth: onServerTruth\n ? ({ threadId, value }: ThreadFieldTarget<string>) => onServerTruth({ threadId, title: value })\n : undefined,\n });\n const set = field.set;\n const rename = useCallback(\n ({ threadId, title }: ThreadRenameTarget) => set({ threadId, value: title }),\n [set],\n );\n return {\n overrides: field.overrides,\n rename,\n isPending: field.isPending,\n pendingThreadIds: field.pendingThreadIds,\n isAvailable: field.isAvailable,\n };\n}\n\n/** The row with its title override applied, or the row itself when it has none. */\nexport function withTitleOverride<T extends TitleRow>(\n row: T,\n overrides: Readonly<Record<string, string>>,\n): T {\n const override = overrides[row.threadId];\n return override === undefined || override === row.title ? row : { ...row, title: override };\n}\n\n/** Every row with its title override applied. */\nexport function withTitleOverrides<T extends TitleRow>(\n rows: readonly T[],\n overrides: Readonly<Record<string, string>>,\n): T[] {\n return rows.map((row) => withTitleOverride(row, overrides));\n}\n"],"names":["useThreadFieldOverride","renameThread","isThreadRenameUnavailableError","useCallback"],"mappings":";;;;;AA4DA,MAAM,6BACJ;AAEF,MAAM,YAAY,CAAC,QAA0B,IAAI;AAE1C,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyC;AACvC,QAAM,QAAQA,uBAAAA,uBAAyC;AAAA,IACrD,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,OAAO,OAAO,MAAM,EAAE,UAAU,YAAY;AAC1C,YAAM,SAAS,MAAMC,IAAAA,aAAa,YAAY,MAAM,EAAE,UAAU,OAAO,OAAO;AAC9E,aAAO,EAAE,UAAU,OAAO,WAAW,OAAO,OAAO,MAAA;AAAA,IACrD;AAAA,IACA,oBAAoBC,IAAAA;AAAAA,IACpB,oBAAoB;AAAA,IACpB,eAAe,gBACX,CAAC,EAAE,UAAU,MAAA,MAAuC,cAAc,EAAE,UAAU,OAAO,MAAA,CAAO,IAC5F;AAAA,EAAA,CACL;AACD,QAAM,MAAM,MAAM;AAClB,QAAM,SAASC,MAAAA;AAAAA,IACb,CAAC,EAAE,UAAU,YAAgC,IAAI,EAAE,UAAU,OAAO,OAAO;AAAA,IAC3E,CAAC,GAAG;AAAA,EAAA;AAEN,SAAO;AAAA,IACL,WAAW,MAAM;AAAA,IACjB;AAAA,IACA,WAAW,MAAM;AAAA,IACjB,kBAAkB,MAAM;AAAA,IACxB,aAAa,MAAM;AAAA,EAAA;AAEvB;AAGO,SAAS,kBACd,KACA,WACG;AACH,QAAM,WAAW,UAAU,IAAI,QAAQ;AACvC,SAAO,aAAa,UAAa,aAAa,IAAI,QAAQ,MAAM,EAAE,GAAG,KAAK,OAAO,SAAA;AACnF;AAGO,SAAS,mBACd,MACA,WACK;AACL,SAAO,KAAK,IAAI,CAAC,QAAQ,kBAAkB,KAAK,SAAS,CAAC;AAC5D;;;;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { RestConversationAuth } from './use-rest-conversation-history';
|
|
2
|
+
export interface ThreadRenameTarget {
|
|
3
|
+
threadId: string;
|
|
4
|
+
/** The new title; the caller trims it (the server trims again and bounds it to 1–200 characters). */
|
|
5
|
+
title: string;
|
|
6
|
+
}
|
|
7
|
+
/** The two fields the override layer reads and writes on a list row. */
|
|
8
|
+
export interface TitleRow {
|
|
9
|
+
threadId: string;
|
|
10
|
+
title: string;
|
|
11
|
+
}
|
|
12
|
+
export interface UseThreadRenameOptions {
|
|
13
|
+
backendUrl: string;
|
|
14
|
+
/** Non-secret identity in the mutation key (as the read-state mutation keys). */
|
|
15
|
+
principalId: string;
|
|
16
|
+
getAuth: () => RestConversationAuth | Promise<RestConversationAuth>;
|
|
17
|
+
/**
|
|
18
|
+
* The rows as the list sources currently report them, BEFORE overrides. An
|
|
19
|
+
* override is dropped once its row reports the same title.
|
|
20
|
+
*/
|
|
21
|
+
rows: readonly TitleRow[];
|
|
22
|
+
/** Write the server's answer into the list caches (`patchConversation`). */
|
|
23
|
+
onServerTruth?: (result: ThreadRenameTarget) => void;
|
|
24
|
+
}
|
|
25
|
+
export interface ThreadRename {
|
|
26
|
+
/** Optimistic, then server-confirmed, titles layered over the list sources, keyed by thread id. */
|
|
27
|
+
overrides: Readonly<Record<string, string>>;
|
|
28
|
+
/**
|
|
29
|
+
* Rename a thread. The row shows the title at once; while that thread's
|
|
30
|
+
* write is in flight the call only records the desired title (see the
|
|
31
|
+
* field-override module doc).
|
|
32
|
+
*/
|
|
33
|
+
rename: (target: ThreadRenameTarget) => void;
|
|
34
|
+
/** True while any rename is in flight. */
|
|
35
|
+
isPending: boolean;
|
|
36
|
+
/** The threads whose rename is in flight — the row's editor stays closed for these. */
|
|
37
|
+
pendingThreadIds: ReadonlySet<string>;
|
|
38
|
+
/**
|
|
39
|
+
* `false` once the backend answered 404 / 405: the route is not deployed
|
|
40
|
+
* there, and the list offers no rename action.
|
|
41
|
+
*/
|
|
42
|
+
isAvailable: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare function useThreadRename({ backendUrl, principalId, getAuth, rows, onServerTruth, }: UseThreadRenameOptions): ThreadRename;
|
|
45
|
+
/** The row with its title override applied, or the row itself when it has none. */
|
|
46
|
+
export declare function withTitleOverride<T extends TitleRow>(row: T, overrides: Readonly<Record<string, string>>): T;
|
|
47
|
+
/** Every row with its title override applied. */
|
|
48
|
+
export declare function withTitleOverrides<T extends TitleRow>(rows: readonly T[], overrides: Readonly<Record<string, string>>): T[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { renameThread, isThreadRenameUnavailableError } from "./api.js";
|
|
3
|
+
import { useThreadFieldOverride } from "./use-thread-field-override.js";
|
|
4
|
+
const RENAME_UNAVAILABLE_WARNING = "[AthenaSDK] This backend has no POST /api/conversations/threads/rename route yet; sessions cannot be renamed from here until it deploys.";
|
|
5
|
+
const readTitle = (row) => row.title;
|
|
6
|
+
function useThreadRename({
|
|
7
|
+
backendUrl,
|
|
8
|
+
principalId,
|
|
9
|
+
getAuth,
|
|
10
|
+
rows,
|
|
11
|
+
onServerTruth
|
|
12
|
+
}) {
|
|
13
|
+
const field = useThreadFieldOverride({
|
|
14
|
+
field: "rename",
|
|
15
|
+
backendUrl,
|
|
16
|
+
principalId,
|
|
17
|
+
getAuth,
|
|
18
|
+
rows,
|
|
19
|
+
readRow: readTitle,
|
|
20
|
+
write: async (auth, { threadId, value }) => {
|
|
21
|
+
const result = await renameThread(backendUrl, auth, { threadId, title: value });
|
|
22
|
+
return { threadId: result.thread_id, value: result.title };
|
|
23
|
+
},
|
|
24
|
+
isUnavailableError: isThreadRenameUnavailableError,
|
|
25
|
+
unavailableWarning: RENAME_UNAVAILABLE_WARNING,
|
|
26
|
+
onServerTruth: onServerTruth ? ({ threadId, value }) => onServerTruth({ threadId, title: value }) : void 0
|
|
27
|
+
});
|
|
28
|
+
const set = field.set;
|
|
29
|
+
const rename = useCallback(
|
|
30
|
+
({ threadId, title }) => set({ threadId, value: title }),
|
|
31
|
+
[set]
|
|
32
|
+
);
|
|
33
|
+
return {
|
|
34
|
+
overrides: field.overrides,
|
|
35
|
+
rename,
|
|
36
|
+
isPending: field.isPending,
|
|
37
|
+
pendingThreadIds: field.pendingThreadIds,
|
|
38
|
+
isAvailable: field.isAvailable
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function withTitleOverride(row, overrides) {
|
|
42
|
+
const override = overrides[row.threadId];
|
|
43
|
+
return override === void 0 || override === row.title ? row : { ...row, title: override };
|
|
44
|
+
}
|
|
45
|
+
function withTitleOverrides(rows, overrides) {
|
|
46
|
+
return rows.map((row) => withTitleOverride(row, overrides));
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
useThreadRename,
|
|
50
|
+
withTitleOverride,
|
|
51
|
+
withTitleOverrides
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=use-thread-rename.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-thread-rename.js","sources":["../../src/threads/use-thread-rename.ts"],"sourcesContent":["/**\n * The inline rename behind `SessionList`: `useThreadFieldOverride` over\n * `POST /api/conversations/threads/rename` (see that module for the\n * optimistic-override, rollback, serialization and identity-scoping\n * contract). The row shows the new title on commit; the server's stored\n * title (trimmed) is written back, and a failure restores the previous one.\n * A 404 / 405 marks the rename unavailable — the backend predates the route\n * — so the list withdraws the action instead of failing on every commit.\n */\nimport { useCallback } from 'react';\nimport { isThreadRenameUnavailableError, renameThread } from './api';\nimport type { RestConversationAuth } from './use-rest-conversation-history';\nimport { type ThreadFieldTarget, useThreadFieldOverride } from './use-thread-field-override';\n\nexport interface ThreadRenameTarget {\n threadId: string;\n /** The new title; the caller trims it (the server trims again and bounds it to 1–200 characters). */\n title: string;\n}\n\n/** The two fields the override layer reads and writes on a list row. */\nexport interface TitleRow {\n threadId: string;\n title: string;\n}\n\nexport interface UseThreadRenameOptions {\n backendUrl: string;\n /** Non-secret identity in the mutation key (as the read-state mutation keys). */\n principalId: string;\n getAuth: () => RestConversationAuth | Promise<RestConversationAuth>;\n /**\n * The rows as the list sources currently report them, BEFORE overrides. An\n * override is dropped once its row reports the same title.\n */\n rows: readonly TitleRow[];\n /** Write the server's answer into the list caches (`patchConversation`). */\n onServerTruth?: (result: ThreadRenameTarget) => void;\n}\n\nexport interface ThreadRename {\n /** Optimistic, then server-confirmed, titles layered over the list sources, keyed by thread id. */\n overrides: Readonly<Record<string, string>>;\n /**\n * Rename a thread. The row shows the title at once; while that thread's\n * write is in flight the call only records the desired title (see the\n * field-override module doc).\n */\n rename: (target: ThreadRenameTarget) => void;\n /** True while any rename is in flight. */\n isPending: boolean;\n /** The threads whose rename is in flight — the row's editor stays closed for these. */\n pendingThreadIds: ReadonlySet<string>;\n /**\n * `false` once the backend answered 404 / 405: the route is not deployed\n * there, and the list offers no rename action.\n */\n isAvailable: boolean;\n}\n\nconst RENAME_UNAVAILABLE_WARNING =\n '[AthenaSDK] This backend has no POST /api/conversations/threads/rename route yet; sessions cannot be renamed from here until it deploys.';\n\nconst readTitle = (row: TitleRow): string => row.title;\n\nexport function useThreadRename({\n backendUrl,\n principalId,\n getAuth,\n rows,\n onServerTruth,\n}: UseThreadRenameOptions): ThreadRename {\n const field = useThreadFieldOverride<string, TitleRow>({\n field: 'rename',\n backendUrl,\n principalId,\n getAuth,\n rows,\n readRow: readTitle,\n write: async (auth, { threadId, value }) => {\n const result = await renameThread(backendUrl, auth, { threadId, title: value });\n return { threadId: result.thread_id, value: result.title };\n },\n isUnavailableError: isThreadRenameUnavailableError,\n unavailableWarning: RENAME_UNAVAILABLE_WARNING,\n onServerTruth: onServerTruth\n ? ({ threadId, value }: ThreadFieldTarget<string>) => onServerTruth({ threadId, title: value })\n : undefined,\n });\n const set = field.set;\n const rename = useCallback(\n ({ threadId, title }: ThreadRenameTarget) => set({ threadId, value: title }),\n [set],\n );\n return {\n overrides: field.overrides,\n rename,\n isPending: field.isPending,\n pendingThreadIds: field.pendingThreadIds,\n isAvailable: field.isAvailable,\n };\n}\n\n/** The row with its title override applied, or the row itself when it has none. */\nexport function withTitleOverride<T extends TitleRow>(\n row: T,\n overrides: Readonly<Record<string, string>>,\n): T {\n const override = overrides[row.threadId];\n return override === undefined || override === row.title ? row : { ...row, title: override };\n}\n\n/** Every row with its title override applied. */\nexport function withTitleOverrides<T extends TitleRow>(\n rows: readonly T[],\n overrides: Readonly<Record<string, string>>,\n): T[] {\n return rows.map((row) => withTitleOverride(row, overrides));\n}\n"],"names":[],"mappings":";;;AA4DA,MAAM,6BACJ;AAEF,MAAM,YAAY,CAAC,QAA0B,IAAI;AAE1C,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyC;AACvC,QAAM,QAAQ,uBAAyC;AAAA,IACrD,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,OAAO,OAAO,MAAM,EAAE,UAAU,YAAY;AAC1C,YAAM,SAAS,MAAM,aAAa,YAAY,MAAM,EAAE,UAAU,OAAO,OAAO;AAC9E,aAAO,EAAE,UAAU,OAAO,WAAW,OAAO,OAAO,MAAA;AAAA,IACrD;AAAA,IACA,oBAAoB;AAAA,IACpB,oBAAoB;AAAA,IACpB,eAAe,gBACX,CAAC,EAAE,UAAU,MAAA,MAAuC,cAAc,EAAE,UAAU,OAAO,MAAA,CAAO,IAC5F;AAAA,EAAA,CACL;AACD,QAAM,MAAM,MAAM;AAClB,QAAM,SAAS;AAAA,IACb,CAAC,EAAE,UAAU,YAAgC,IAAI,EAAE,UAAU,OAAO,OAAO;AAAA,IAC3E,CAAC,GAAG;AAAA,EAAA;AAEN,SAAO;AAAA,IACL,WAAW,MAAM;AAAA,IACjB;AAAA,IACA,WAAW,MAAM;AAAA,IACjB,kBAAkB,MAAM;AAAA,IACxB,aAAa,MAAM;AAAA,EAAA;AAEvB;AAGO,SAAS,kBACd,KACA,WACG;AACH,QAAM,WAAW,UAAU,IAAI,QAAQ;AACvC,SAAO,aAAa,UAAa,aAAa,IAAI,QAAQ,MAAM,EAAE,GAAG,KAAK,OAAO,SAAA;AACnF;AAGO,SAAS,mBACd,MACA,WACK;AACL,SAAO,KAAK,IAAI,CAAC,QAAQ,kBAAkB,KAAK,SAAS,CAAC;AAC5D;"}
|
package/dist/tools/index.cjs
CHANGED
|
@@ -11,19 +11,22 @@ require("react");
|
|
|
11
11
|
require("@assistant-ui/tap");
|
|
12
12
|
require("statewire");
|
|
13
13
|
require("../packages/agent-runtime/src/statewire-suspended.cjs");
|
|
14
|
+
require("../packages/agent-runtime/src/conversation-list.cjs");
|
|
14
15
|
const toolMetadata = require("../packages/agent-runtime/src/tool-metadata.cjs");
|
|
15
16
|
const toolResult = require("../packages/agent-runtime/src/tool-result.cjs");
|
|
16
17
|
require("@tanstack/react-query");
|
|
17
18
|
require("../packages/agent-runtime/src/statewire-state.cjs");
|
|
18
19
|
require("../packages/agent-runtime/src/messages.cjs");
|
|
19
|
-
require("@assistant-ui/react-statewire");
|
|
20
20
|
require("@assistant-ui/store");
|
|
21
21
|
require("../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
|
|
22
22
|
require("../packages/agent-runtime/src/statewire-attach-observer.cjs");
|
|
23
23
|
require("../packages/agent-runtime/src/thread-status.cjs");
|
|
24
|
+
require("@assistant-ui/react-statewire");
|
|
24
25
|
require("@assistant-ui/core");
|
|
25
26
|
require("../packages/agent-runtime/src/thread-handoff.cjs");
|
|
27
|
+
const toolAppearance = require("./tool-appearance.cjs");
|
|
26
28
|
exports.ToolFallback = toolFallback.ToolFallback;
|
|
29
|
+
exports.ToolFallbackAppearanceProvider = toolFallback.ToolFallbackAppearanceProvider;
|
|
27
30
|
exports.ToolFallbackArgs = toolFallback.ToolFallbackArgs;
|
|
28
31
|
exports.ToolFallbackContent = toolFallback.ToolFallbackContent;
|
|
29
32
|
exports.ToolFallbackError = toolFallback.ToolFallbackError;
|
|
@@ -54,4 +57,5 @@ exports.toolCompletedLabel = toolMetadata.toolCompletedLabel;
|
|
|
54
57
|
exports.classifyToolResult = toolResult.classifyToolResult;
|
|
55
58
|
exports.isToolResultSuccess = toolResult.isToolResultSuccess;
|
|
56
59
|
exports.resultMessage = toolResult.resultMessage;
|
|
60
|
+
exports.useToolAppearance = toolAppearance.useToolAppearance;
|
|
57
61
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tools/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Published as the `@athenaintel/react/tools` sub-path.
|
|
8
8
|
*/
|
|
9
|
-
export { clearAutoOpenedAssets, ToolFallback, ToolFallbackArgs, ToolFallbackContent, type ToolFallbackContext, ToolFallbackError, ToolFallbackNotice, type ToolFallbackOptions, type ToolFallbackProps, ToolFallbackResult, ToolFallbackRoot, type ToolFallbackRootProps, ToolFallbackTrigger, type ToolFallbackTriggerProps, } from "./tool-fallback";
|
|
9
|
+
export { clearAutoOpenedAssets, type ToolAppearance, ToolFallback, ToolFallbackAppearanceProvider, ToolFallbackArgs, ToolFallbackContent, type ToolFallbackContext, ToolFallbackError, ToolFallbackNotice, type ToolFallbackOptions, type ToolFallbackProps, ToolFallbackResult, ToolFallbackRoot, type ToolFallbackRootProps, ToolFallbackTrigger, type ToolFallbackTriggerProps, useToolAppearance, } from "./tool-fallback";
|
|
10
10
|
export { CopyToolSpecButton, ExpandableSection, formatToolName, normalizeResult, ToolCard, type ToolStatus, truncate, tryParseJson, } from "./primitives";
|
|
11
11
|
export { TOOL_ICONS, toolIcon } from "./tool-icons";
|
|
12
12
|
export { NestedPtcComponentsProvider, NestedPtcMessages, type NestedPtcMessagesProps, useNestedPtcComponents, } from "./NestedPtcMessages";
|
package/dist/tools/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolFallback, ToolFallbackArgs, ToolFallbackContent, ToolFallbackError, ToolFallbackNotice, ToolFallbackResult, ToolFallbackRoot, ToolFallbackTrigger, clearAutoOpenedAssets } from "./tool-fallback.js";
|
|
1
|
+
import { ToolFallback, ToolFallbackAppearanceProvider, ToolFallbackArgs, ToolFallbackContent, ToolFallbackError, ToolFallbackNotice, ToolFallbackResult, ToolFallbackRoot, ToolFallbackTrigger, clearAutoOpenedAssets } from "./tool-fallback.js";
|
|
2
2
|
import { CopyToolSpecButton, ExpandableSection, ToolCard, normalizeResult, truncate, tryParseJson } from "./primitives.js";
|
|
3
3
|
import { TOOL_ICONS, toolIcon } from "./tool-icons.js";
|
|
4
4
|
import { NestedPtcComponentsProvider, NestedPtcMessages, useNestedPtcComponents } from "./NestedPtcMessages.js";
|
|
@@ -9,18 +9,20 @@ import "react";
|
|
|
9
9
|
import "@assistant-ui/tap";
|
|
10
10
|
import "statewire";
|
|
11
11
|
import "../packages/agent-runtime/src/statewire-suspended.js";
|
|
12
|
+
import "../packages/agent-runtime/src/conversation-list.js";
|
|
12
13
|
import { describeToolArgs, formatToolName, getToolDisplayMeta, toolActiveLabel, toolCompletedLabel } from "../packages/agent-runtime/src/tool-metadata.js";
|
|
13
14
|
import { classifyToolResult, isToolResultSuccess, resultMessage } from "../packages/agent-runtime/src/tool-result.js";
|
|
14
15
|
import "@tanstack/react-query";
|
|
15
16
|
import "../packages/agent-runtime/src/statewire-state.js";
|
|
16
17
|
import "../packages/agent-runtime/src/messages.js";
|
|
17
|
-
import "@assistant-ui/react-statewire";
|
|
18
18
|
import "@assistant-ui/store";
|
|
19
19
|
import "../packages/agent-runtime/src/quota-safe-local-storage-session.js";
|
|
20
20
|
import "../packages/agent-runtime/src/statewire-attach-observer.js";
|
|
21
21
|
import "../packages/agent-runtime/src/thread-status.js";
|
|
22
|
+
import "@assistant-ui/react-statewire";
|
|
22
23
|
import "@assistant-ui/core";
|
|
23
24
|
import "../packages/agent-runtime/src/thread-handoff.js";
|
|
25
|
+
import { useToolAppearance } from "./tool-appearance.js";
|
|
24
26
|
export {
|
|
25
27
|
CopyToolSpecButton,
|
|
26
28
|
ExpandableSection,
|
|
@@ -30,6 +32,7 @@ export {
|
|
|
30
32
|
TOOL_ICONS,
|
|
31
33
|
ToolCard,
|
|
32
34
|
ToolFallback,
|
|
35
|
+
ToolFallbackAppearanceProvider,
|
|
33
36
|
ToolFallbackArgs,
|
|
34
37
|
ToolFallbackContent,
|
|
35
38
|
ToolFallbackError,
|
|
@@ -52,6 +55,7 @@ export {
|
|
|
52
55
|
toolIcon,
|
|
53
56
|
truncate,
|
|
54
57
|
tryParseJson,
|
|
55
|
-
useNestedPtcComponents
|
|
58
|
+
useNestedPtcComponents,
|
|
59
|
+
useToolAppearance
|
|
56
60
|
};
|
|
57
61
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -7,16 +7,17 @@ require("../packages/agent-runtime/src/generated/runconfig-contract.cjs");
|
|
|
7
7
|
require("@assistant-ui/tap");
|
|
8
8
|
require("statewire");
|
|
9
9
|
require("../packages/agent-runtime/src/statewire-suspended.cjs");
|
|
10
|
+
require("../packages/agent-runtime/src/conversation-list.cjs");
|
|
10
11
|
const toolMetadata = require("../packages/agent-runtime/src/tool-metadata.cjs");
|
|
11
12
|
const toolResult = require("../packages/agent-runtime/src/tool-result.cjs");
|
|
12
13
|
require("@tanstack/react-query");
|
|
13
14
|
require("../packages/agent-runtime/src/statewire-state.cjs");
|
|
14
15
|
require("../packages/agent-runtime/src/messages.cjs");
|
|
15
|
-
require("@assistant-ui/react-statewire");
|
|
16
16
|
require("@assistant-ui/store");
|
|
17
17
|
require("../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
|
|
18
18
|
require("../packages/agent-runtime/src/statewire-attach-observer.cjs");
|
|
19
19
|
require("../packages/agent-runtime/src/thread-status.cjs");
|
|
20
|
+
require("@assistant-ui/react-statewire");
|
|
20
21
|
require("@assistant-ui/core");
|
|
21
22
|
require("../packages/agent-runtime/src/thread-handoff.cjs");
|
|
22
23
|
const primitives = require("./primitives.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc-tool-uis.cjs","sources":["../../src/tools/misc-tool-uis.tsx"],"sourcesContent":["/**\n * Small dedicated cards for tools whose generic fallback rendering read\n * poorly: currently the pip installer (Olympus registers it; the SDK's own\n * registry includes it).\n */\nimport { PackageIcon } from \"lucide-react\";\nimport { memo } from \"react\";\nimport type { ToolCallMessagePartComponent } from \"@assistant-ui/react\";\nimport {\n classifyToolResult,\n describePackage,\n isToolResultSuccess,\n} from \"@athenaintel/agent-runtime\";\nimport { ExpandableSection, normalizeResult, ToolCard } from \"./primitives\";\nimport { ToolFallback } from \"./tool-fallback\";\n\nconst InstallPackageToolUIImpl: ToolCallMessagePartComponent = (props) => {\n const { toolName, args, result, status } = props;\n // An install the user refused at the approval gate is neither installed\n // nor failed: the generic card owns the rejected treatment.\n if (classifyToolResult({ status, result }).state === \"rejected\") {\n return <ToolFallback {...props} icon={PackageIcon} />;\n }\n const typedArgs = (args ?? {}) as Record<string, unknown>;\n const packageName = describePackage(typedArgs);\n const isRunning = status?.type === \"running\";\n const isFailed =\n status?.type === \"incomplete\" || (status?.type === \"complete\" && !isToolResultSuccess(result));\n const data = normalizeResult(result);\n const detail =\n typeof result === \"string\" ? result : data ? JSON.stringify(data, null, 2) : null;\n\n return (\n <ToolCard\n icon={PackageIcon}\n status={isFailed && status?.type === \"complete\" ? \"incomplete\" : (status?.type ?? \"complete\")}\n title={\n isRunning\n ? \"Installing package...\"\n : isFailed\n ? \"Couldn't install package\"\n : \"Installed package\"\n }\n subtitle={packageName}\n toolName={toolName}\n error={status?.type === \"incomplete\" ? String(status.error ?? \"\") || undefined : undefined}\n args={typedArgs}\n result={result}\n >\n {!isRunning && detail ? (\n <ExpandableSection label=\"Show output\">\n <pre className=\"max-h-64 overflow-auto whitespace-pre-wrap break-all text-[11px] leading-snug text-muted-foreground\">\n {detail}\n </pre>\n </ExpandableSection>\n ) : null}\n </ToolCard>\n );\n};\n\nexport const InstallPackageToolUI = memo(\n InstallPackageToolUIImpl,\n) as unknown as ToolCallMessagePartComponent;\nInstallPackageToolUI.displayName = \"InstallPackageToolUI\";\n"],"names":["classifyToolResult","jsx","ToolFallback","PackageIcon","describePackage","isToolResultSuccess","normalizeResult","ToolCard","ExpandableSection","memo"],"mappings":"
|
|
1
|
+
{"version":3,"file":"misc-tool-uis.cjs","sources":["../../src/tools/misc-tool-uis.tsx"],"sourcesContent":["/**\n * Small dedicated cards for tools whose generic fallback rendering read\n * poorly: currently the pip installer (Olympus registers it; the SDK's own\n * registry includes it).\n */\nimport { PackageIcon } from \"lucide-react\";\nimport { memo } from \"react\";\nimport type { ToolCallMessagePartComponent } from \"@assistant-ui/react\";\nimport {\n classifyToolResult,\n describePackage,\n isToolResultSuccess,\n} from \"@athenaintel/agent-runtime\";\nimport { ExpandableSection, normalizeResult, ToolCard } from \"./primitives\";\nimport { ToolFallback } from \"./tool-fallback\";\n\nconst InstallPackageToolUIImpl: ToolCallMessagePartComponent = (props) => {\n const { toolName, args, result, status } = props;\n // An install the user refused at the approval gate is neither installed\n // nor failed: the generic card owns the rejected treatment.\n if (classifyToolResult({ status, result }).state === \"rejected\") {\n return <ToolFallback {...props} icon={PackageIcon} />;\n }\n const typedArgs = (args ?? {}) as Record<string, unknown>;\n const packageName = describePackage(typedArgs);\n const isRunning = status?.type === \"running\";\n const isFailed =\n status?.type === \"incomplete\" || (status?.type === \"complete\" && !isToolResultSuccess(result));\n const data = normalizeResult(result);\n const detail =\n typeof result === \"string\" ? result : data ? JSON.stringify(data, null, 2) : null;\n\n return (\n <ToolCard\n icon={PackageIcon}\n status={isFailed && status?.type === \"complete\" ? \"incomplete\" : (status?.type ?? \"complete\")}\n title={\n isRunning\n ? \"Installing package...\"\n : isFailed\n ? \"Couldn't install package\"\n : \"Installed package\"\n }\n subtitle={packageName}\n toolName={toolName}\n error={status?.type === \"incomplete\" ? String(status.error ?? \"\") || undefined : undefined}\n args={typedArgs}\n result={result}\n >\n {!isRunning && detail ? (\n <ExpandableSection label=\"Show output\">\n <pre className=\"max-h-64 overflow-auto whitespace-pre-wrap break-all text-[11px] leading-snug text-muted-foreground\">\n {detail}\n </pre>\n </ExpandableSection>\n ) : null}\n </ToolCard>\n );\n};\n\nexport const InstallPackageToolUI = memo(\n InstallPackageToolUIImpl,\n) as unknown as ToolCallMessagePartComponent;\nInstallPackageToolUI.displayName = \"InstallPackageToolUI\";\n"],"names":["classifyToolResult","jsx","ToolFallback","PackageIcon","describePackage","isToolResultSuccess","normalizeResult","ToolCard","ExpandableSection","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,2BAAyD,CAAC,UAAU;AACxE,QAAM,EAAE,UAAU,MAAM,QAAQ,WAAW;AAG3C,MAAIA,WAAAA,mBAAmB,EAAE,QAAQ,QAAQ,EAAE,UAAU,YAAY;AAC/D,WAAOC,2BAAAA,IAACC,aAAAA,cAAA,EAAc,GAAG,OAAO,MAAMC,YAAAA,aAAa;AAAA,EACrD;AACA,QAAM,YAAa,QAAQ,CAAA;AAC3B,QAAM,cAAcC,aAAAA,gBAAgB,SAAS;AAC7C,QAAM,aAAY,iCAAQ,UAAS;AACnC,QAAM,YACJ,iCAAQ,UAAS,iBAAiB,iCAAQ,UAAS,cAAc,CAACC,WAAAA,oBAAoB,MAAM;AAC9F,QAAM,OAAOC,WAAAA,gBAAgB,MAAM;AACnC,QAAM,SACJ,OAAO,WAAW,WAAW,SAAS,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI;AAE/E,SACEL,2BAAAA;AAAAA,IAACM,WAAAA;AAAAA,IAAA;AAAA,MACC,MAAMJ,YAAAA;AAAAA,MACN,QAAQ,aAAY,iCAAQ,UAAS,aAAa,gBAAgB,iCAAQ,SAAQ;AAAA,MAClF,OACE,YACI,0BACA,WACE,6BACA;AAAA,MAER,UAAU;AAAA,MACV;AAAA,MACA,QAAO,iCAAQ,UAAS,eAAe,OAAO,OAAO,SAAS,EAAE,KAAK,SAAY;AAAA,MACjF,MAAM;AAAA,MACN;AAAA,MAEC,UAAA,CAAC,aAAa,SACbF,2BAAAA,IAACO,8BAAA,EAAkB,OAAM,eACvB,UAAAP,2BAAAA,IAAC,OAAA,EAAI,WAAU,uGACZ,UAAA,OAAA,CACH,GACF,IACE;AAAA,IAAA;AAAA,EAAA;AAGV;AAEO,MAAM,uBAAuBQ,MAAAA;AAAAA,EAClC;AACF;AACA,qBAAqB,cAAc;;"}
|
|
@@ -5,16 +5,17 @@ import "../packages/agent-runtime/src/generated/runconfig-contract.js";
|
|
|
5
5
|
import "@assistant-ui/tap";
|
|
6
6
|
import "statewire";
|
|
7
7
|
import "../packages/agent-runtime/src/statewire-suspended.js";
|
|
8
|
+
import "../packages/agent-runtime/src/conversation-list.js";
|
|
8
9
|
import { describePackage } from "../packages/agent-runtime/src/tool-metadata.js";
|
|
9
10
|
import { classifyToolResult, isToolResultSuccess } from "../packages/agent-runtime/src/tool-result.js";
|
|
10
11
|
import "@tanstack/react-query";
|
|
11
12
|
import "../packages/agent-runtime/src/statewire-state.js";
|
|
12
13
|
import "../packages/agent-runtime/src/messages.js";
|
|
13
|
-
import "@assistant-ui/react-statewire";
|
|
14
14
|
import "@assistant-ui/store";
|
|
15
15
|
import "../packages/agent-runtime/src/quota-safe-local-storage-session.js";
|
|
16
16
|
import "../packages/agent-runtime/src/statewire-attach-observer.js";
|
|
17
17
|
import "../packages/agent-runtime/src/thread-status.js";
|
|
18
|
+
import "@assistant-ui/react-statewire";
|
|
18
19
|
import "@assistant-ui/core";
|
|
19
20
|
import "../packages/agent-runtime/src/thread-handoff.js";
|
|
20
21
|
import { normalizeResult, ToolCard, ExpandableSection } from "./primitives.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc-tool-uis.js","sources":["../../src/tools/misc-tool-uis.tsx"],"sourcesContent":["/**\n * Small dedicated cards for tools whose generic fallback rendering read\n * poorly: currently the pip installer (Olympus registers it; the SDK's own\n * registry includes it).\n */\nimport { PackageIcon } from \"lucide-react\";\nimport { memo } from \"react\";\nimport type { ToolCallMessagePartComponent } from \"@assistant-ui/react\";\nimport {\n classifyToolResult,\n describePackage,\n isToolResultSuccess,\n} from \"@athenaintel/agent-runtime\";\nimport { ExpandableSection, normalizeResult, ToolCard } from \"./primitives\";\nimport { ToolFallback } from \"./tool-fallback\";\n\nconst InstallPackageToolUIImpl: ToolCallMessagePartComponent = (props) => {\n const { toolName, args, result, status } = props;\n // An install the user refused at the approval gate is neither installed\n // nor failed: the generic card owns the rejected treatment.\n if (classifyToolResult({ status, result }).state === \"rejected\") {\n return <ToolFallback {...props} icon={PackageIcon} />;\n }\n const typedArgs = (args ?? {}) as Record<string, unknown>;\n const packageName = describePackage(typedArgs);\n const isRunning = status?.type === \"running\";\n const isFailed =\n status?.type === \"incomplete\" || (status?.type === \"complete\" && !isToolResultSuccess(result));\n const data = normalizeResult(result);\n const detail =\n typeof result === \"string\" ? result : data ? JSON.stringify(data, null, 2) : null;\n\n return (\n <ToolCard\n icon={PackageIcon}\n status={isFailed && status?.type === \"complete\" ? \"incomplete\" : (status?.type ?? \"complete\")}\n title={\n isRunning\n ? \"Installing package...\"\n : isFailed\n ? \"Couldn't install package\"\n : \"Installed package\"\n }\n subtitle={packageName}\n toolName={toolName}\n error={status?.type === \"incomplete\" ? String(status.error ?? \"\") || undefined : undefined}\n args={typedArgs}\n result={result}\n >\n {!isRunning && detail ? (\n <ExpandableSection label=\"Show output\">\n <pre className=\"max-h-64 overflow-auto whitespace-pre-wrap break-all text-[11px] leading-snug text-muted-foreground\">\n {detail}\n </pre>\n </ExpandableSection>\n ) : null}\n </ToolCard>\n );\n};\n\nexport const InstallPackageToolUI = memo(\n InstallPackageToolUIImpl,\n) as unknown as ToolCallMessagePartComponent;\nInstallPackageToolUI.displayName = \"InstallPackageToolUI\";\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"misc-tool-uis.js","sources":["../../src/tools/misc-tool-uis.tsx"],"sourcesContent":["/**\n * Small dedicated cards for tools whose generic fallback rendering read\n * poorly: currently the pip installer (Olympus registers it; the SDK's own\n * registry includes it).\n */\nimport { PackageIcon } from \"lucide-react\";\nimport { memo } from \"react\";\nimport type { ToolCallMessagePartComponent } from \"@assistant-ui/react\";\nimport {\n classifyToolResult,\n describePackage,\n isToolResultSuccess,\n} from \"@athenaintel/agent-runtime\";\nimport { ExpandableSection, normalizeResult, ToolCard } from \"./primitives\";\nimport { ToolFallback } from \"./tool-fallback\";\n\nconst InstallPackageToolUIImpl: ToolCallMessagePartComponent = (props) => {\n const { toolName, args, result, status } = props;\n // An install the user refused at the approval gate is neither installed\n // nor failed: the generic card owns the rejected treatment.\n if (classifyToolResult({ status, result }).state === \"rejected\") {\n return <ToolFallback {...props} icon={PackageIcon} />;\n }\n const typedArgs = (args ?? {}) as Record<string, unknown>;\n const packageName = describePackage(typedArgs);\n const isRunning = status?.type === \"running\";\n const isFailed =\n status?.type === \"incomplete\" || (status?.type === \"complete\" && !isToolResultSuccess(result));\n const data = normalizeResult(result);\n const detail =\n typeof result === \"string\" ? result : data ? JSON.stringify(data, null, 2) : null;\n\n return (\n <ToolCard\n icon={PackageIcon}\n status={isFailed && status?.type === \"complete\" ? \"incomplete\" : (status?.type ?? \"complete\")}\n title={\n isRunning\n ? \"Installing package...\"\n : isFailed\n ? \"Couldn't install package\"\n : \"Installed package\"\n }\n subtitle={packageName}\n toolName={toolName}\n error={status?.type === \"incomplete\" ? String(status.error ?? \"\") || undefined : undefined}\n args={typedArgs}\n result={result}\n >\n {!isRunning && detail ? (\n <ExpandableSection label=\"Show output\">\n <pre className=\"max-h-64 overflow-auto whitespace-pre-wrap break-all text-[11px] leading-snug text-muted-foreground\">\n {detail}\n </pre>\n </ExpandableSection>\n ) : null}\n </ToolCard>\n );\n};\n\nexport const InstallPackageToolUI = memo(\n InstallPackageToolUIImpl,\n) as unknown as ToolCallMessagePartComponent;\nInstallPackageToolUI.displayName = \"InstallPackageToolUI\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,2BAAyD,CAAC,UAAU;AACxE,QAAM,EAAE,UAAU,MAAM,QAAQ,WAAW;AAG3C,MAAI,mBAAmB,EAAE,QAAQ,QAAQ,EAAE,UAAU,YAAY;AAC/D,WAAO,oBAAC,cAAA,EAAc,GAAG,OAAO,MAAM,aAAa;AAAA,EACrD;AACA,QAAM,YAAa,QAAQ,CAAA;AAC3B,QAAM,cAAc,gBAAgB,SAAS;AAC7C,QAAM,aAAY,iCAAQ,UAAS;AACnC,QAAM,YACJ,iCAAQ,UAAS,iBAAiB,iCAAQ,UAAS,cAAc,CAAC,oBAAoB,MAAM;AAC9F,QAAM,OAAO,gBAAgB,MAAM;AACnC,QAAM,SACJ,OAAO,WAAW,WAAW,SAAS,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI;AAE/E,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,aAAY,iCAAQ,UAAS,aAAa,gBAAgB,iCAAQ,SAAQ;AAAA,MAClF,OACE,YACI,0BACA,WACE,6BACA;AAAA,MAER,UAAU;AAAA,MACV;AAAA,MACA,QAAO,iCAAQ,UAAS,eAAe,OAAO,OAAO,SAAS,EAAE,KAAK,SAAY;AAAA,MACjF,MAAM;AAAA,MACN;AAAA,MAEC,UAAA,CAAC,aAAa,SACb,oBAAC,mBAAA,EAAkB,OAAM,eACvB,UAAA,oBAAC,OAAA,EAAI,WAAU,uGACZ,UAAA,OAAA,CACH,GACF,IACE;AAAA,IAAA;AAAA,EAAA;AAGV;AAEO,MAAM,uBAAuB;AAAA,EAClC;AACF;AACA,qBAAqB,cAAc;"}
|
|
@@ -6,18 +6,20 @@ require("../packages/agent-runtime/src/generated/runconfig-contract.cjs");
|
|
|
6
6
|
require("@assistant-ui/tap");
|
|
7
7
|
require("statewire");
|
|
8
8
|
require("../packages/agent-runtime/src/statewire-suspended.cjs");
|
|
9
|
+
require("../packages/agent-runtime/src/conversation-list.cjs");
|
|
9
10
|
const toolMetadata = require("../packages/agent-runtime/src/tool-metadata.cjs");
|
|
10
11
|
require("@tanstack/react-query");
|
|
11
12
|
require("../packages/agent-runtime/src/statewire-state.cjs");
|
|
12
13
|
require("../packages/agent-runtime/src/messages.cjs");
|
|
13
|
-
require("@assistant-ui/react-statewire");
|
|
14
14
|
require("@assistant-ui/store");
|
|
15
15
|
require("../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
|
|
16
16
|
require("../packages/agent-runtime/src/statewire-attach-observer.cjs");
|
|
17
17
|
require("../packages/agent-runtime/src/thread-status.cjs");
|
|
18
|
+
require("@assistant-ui/react-statewire");
|
|
18
19
|
require("@assistant-ui/core");
|
|
19
20
|
require("../packages/agent-runtime/src/thread-handoff.cjs");
|
|
20
21
|
const lucideReact = require("lucide-react");
|
|
22
|
+
const toolAppearance = require("./tool-appearance.cjs");
|
|
21
23
|
const cnfast = require("cnfast");
|
|
22
24
|
function tryParseJson(text) {
|
|
23
25
|
try {
|
|
@@ -40,7 +42,13 @@ function normalizeResult(result) {
|
|
|
40
42
|
function truncate(text, max) {
|
|
41
43
|
return text.length > max ? `${text.slice(0, max)}...` : text;
|
|
42
44
|
}
|
|
43
|
-
function ToolCard({
|
|
45
|
+
function ToolCard(props) {
|
|
46
|
+
var _a;
|
|
47
|
+
const ThreadToolCard = (_a = react.useContext(toolAppearance.ToolAppearanceContext)) == null ? void 0 : _a.ToolCard;
|
|
48
|
+
if (ThreadToolCard) return /* @__PURE__ */ jsxRuntime.jsx(ThreadToolCard, { ...props });
|
|
49
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToolCardBox, { ...props });
|
|
50
|
+
}
|
|
51
|
+
function ToolCardBox({
|
|
44
52
|
icon: Icon,
|
|
45
53
|
status,
|
|
46
54
|
title,
|
|
@@ -127,12 +135,27 @@ function CopyToolSpecButton({
|
|
|
127
135
|
}
|
|
128
136
|
) });
|
|
129
137
|
}
|
|
138
|
+
function sectionHeading(label) {
|
|
139
|
+
if (!label) return null;
|
|
140
|
+
const heading = label.replace(/^show\s+/i, "").trim();
|
|
141
|
+
if (!heading) return null;
|
|
142
|
+
return heading.charAt(0).toUpperCase() + heading.slice(1);
|
|
143
|
+
}
|
|
130
144
|
function ExpandableSection({
|
|
131
145
|
label,
|
|
132
146
|
children,
|
|
133
147
|
defaultOpen = false
|
|
134
148
|
}) {
|
|
149
|
+
var _a;
|
|
135
150
|
const [expanded, setExpanded] = react.useState(defaultOpen);
|
|
151
|
+
const appearance = ((_a = react.useContext(toolAppearance.ToolAppearanceContext)) == null ? void 0 : _a.appearance) ?? "card";
|
|
152
|
+
if (appearance === "thread") {
|
|
153
|
+
const heading = sectionHeading(label);
|
|
154
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "tool-section", className: "flex flex-col gap-1.5 px-3", children: [
|
|
155
|
+
heading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: heading }) : null,
|
|
156
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-72 overflow-y-auto", children })
|
|
157
|
+
] });
|
|
158
|
+
}
|
|
136
159
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40", children: [
|
|
137
160
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
138
161
|
"button",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.cjs","sources":["../../src/tools/primitives.tsx"],"sourcesContent":["\"use client\";\n\n/**\n * The shared building blocks every SDK tool card is made of — the card shell\n * (`ToolCard`), the collapsible details section, and the result/text helpers.\n * Kept apart from the tool UI registry so a tool UI module can use them\n * without importing the registry that imports it back.\n */\nimport { useCallback, useState, type ElementType, type ReactNode } from \"react\";\nimport { formatToolName } from \"@athenaintel/agent-runtime\";\nimport {\n AlertCircleIcon,\n CheckCircle2Icon,\n ChevronDownIcon,\n ClipboardCopyIcon,\n LoaderIcon,\n} from \"lucide-react\";\nimport { cn } from \"../lib/utils\";\n\nexport { formatToolName };\n\n/** Parse JSON text into a record, or `null` when it is not one. */\nexport function tryParseJson(text: string): Record<string, unknown> | null {\n try {\n const parsed: unknown = JSON.parse(text);\n return typeof parsed === \"object\" && parsed !== null\n ? (parsed as Record<string, unknown>)\n : null;\n } catch {\n return null;\n }\n}\n\n/** Parse a tool result (handles nested `.result`, string-encoded JSON) into a record. */\nexport function normalizeResult(result: unknown): Record<string, unknown> | null {\n if (!result) return null;\n if (typeof result === \"string\") return tryParseJson(result);\n if (typeof result === \"object\") {\n const obj = result as Record<string, unknown>;\n if (typeof obj.result === \"string\") return tryParseJson(obj.result) ?? obj;\n return obj;\n }\n return null;\n}\n\n/** Truncate a string with an ellipsis. */\nexport function truncate(text: string, max: number): string {\n return text.length > max ? `${text.slice(0, max)}...` : text;\n}\n\nexport type ToolStatus = \"running\" | \"complete\" | \"incomplete\" | \"requires-action\";\n\nexport function ToolCard({\n icon: Icon,\n status,\n title,\n subtitle,\n toolName,\n badge,\n error,\n children,\n args,\n result,\n}: {\n icon: ElementType;\n status: ToolStatus;\n title: string;\n subtitle?: string;\n toolName?: string;\n badge?: string;\n error?: string | null;\n children?: ReactNode;\n args?: Record<string, unknown>;\n result?: unknown;\n}) {\n const isRunning = status === \"running\";\n const isComplete = status === \"complete\";\n const isError = status === \"incomplete\";\n\n return (\n <div className=\"my-3 w-full overflow-hidden rounded-xl border border-border/60 bg-background shadow-sm\">\n <div className=\"flex items-center gap-3 px-4 py-3\">\n <div\n className={cn(\n \"flex size-8 shrink-0 items-center justify-center rounded-lg\",\n isRunning && \"bg-blue-50 text-blue-600\",\n isComplete && \"bg-emerald-50 text-emerald-600\",\n isError && \"bg-destructive/10 text-destructive\",\n )}\n >\n {isRunning ? (\n <LoaderIcon className=\"size-4 animate-spin\" />\n ) : isError ? (\n <AlertCircleIcon className=\"size-4\" />\n ) : (\n <Icon className=\"size-4\" />\n )}\n </div>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-[13px] font-medium text-foreground\">\n {title}\n </span>\n {isComplete && !error && (\n <CheckCircle2Icon className=\"size-3.5 text-emerald-500\" />\n )}\n </div>\n {subtitle && (\n <p className=\"truncate text-[12px] text-muted-foreground\">\n {subtitle}\n </p>\n )}\n </div>\n {toolName && (\n <span className=\"shrink-0 rounded-md bg-muted/60 px-1.5 py-0.5 text-[10px] font-mono text-muted-foreground\">\n {formatToolName(toolName)}\n </span>\n )}\n {badge && (\n <span className=\"shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground\">\n {badge}\n </span>\n )}\n {isRunning && (\n <div className=\"flex items-center gap-1.5\">\n <div className=\"h-1.5 w-10 animate-pulse rounded-full bg-blue-100\" />\n <div className=\"h-1.5 w-6 animate-pulse rounded-full bg-blue-100\" />\n </div>\n )}\n </div>\n\n {error && (\n <div className=\"border-t border-border/40 bg-destructive/10 px-4 py-2.5\">\n <p className=\"text-[12px] leading-relaxed text-destructive\">\n {error}\n </p>\n </div>\n )}\n\n {children}\n\n {/* Copy tool spec — subtle button at the bottom of every tool card */}\n {toolName && isComplete && (\n <CopyToolSpecButton toolName={toolName} args={args} result={result} />\n )}\n </div>\n );\n}\n\n/** Copies `{ tool_name, arguments, result }` as JSON — the tool spec a support ticket needs. */\nexport function CopyToolSpecButton({\n toolName,\n args,\n argsText,\n result,\n className,\n}: {\n toolName: string;\n args?: Record<string, unknown>;\n argsText?: string;\n result?: unknown;\n className?: string;\n}) {\n const [copied, setCopied] = useState(false);\n\n const handleCopy = useCallback(() => {\n const spec: Record<string, unknown> = { tool_name: toolName };\n if (args) spec.arguments = args;\n else if (argsText) spec.arguments = tryParseJson(argsText) ?? argsText;\n if (result !== undefined) {\n if (typeof result === \"string\") {\n const parsed = tryParseJson(result);\n spec.result = parsed ?? result;\n } else {\n spec.result = result;\n }\n }\n navigator.clipboard.writeText(JSON.stringify(spec, null, 2)).then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n });\n }, [toolName, args, argsText, result]);\n\n return (\n <div className={cn(\"flex justify-end px-3 pb-1.5\", className)}>\n <button\n type=\"button\"\n onClick={handleCopy}\n className=\"flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground/40 transition-colors hover:bg-muted/50 hover:text-muted-foreground\"\n title=\"Copy tool name, arguments, and result as JSON\"\n >\n <ClipboardCopyIcon className=\"size-2.5\" />\n {copied ? \"Copied!\" : toolName}\n </button>\n </div>\n );\n}\n\nexport function ExpandableSection({\n label,\n children,\n defaultOpen = false,\n}: {\n label?: string;\n children: ReactNode;\n defaultOpen?: boolean;\n}) {\n const [expanded, setExpanded] = useState(defaultOpen);\n\n return (\n <div className=\"border-t border-border/40\">\n <button\n type=\"button\"\n onClick={() => setExpanded(!expanded)}\n className=\"flex w-full items-center gap-2 px-4 py-2 text-left text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/30\"\n >\n <ChevronDownIcon\n className={cn(\n \"size-3.5 shrink-0 transition-transform duration-200\",\n !expanded && \"-rotate-90\",\n )}\n />\n <span>{expanded ? \"Hide details\" : (label ?? \"Show details\")}</span>\n </button>\n {expanded && (\n <div className=\"max-h-72 overflow-y-auto border-t border-border/40 bg-muted/10 px-4 py-3\">\n {children}\n </div>\n )}\n </div>\n );\n}\n"],"names":["jsxs","jsx","cn","LoaderIcon","AlertCircleIcon","CheckCircle2Icon","formatToolName","useState","useCallback","ClipboardCopyIcon","ChevronDownIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBO,SAAS,aAAa,MAA8C;AACzE,MAAI;AACF,UAAM,SAAkB,KAAK,MAAM,IAAI;AACvC,WAAO,OAAO,WAAW,YAAY,WAAW,OAC3C,SACD;AAAA,EACN,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,gBAAgB,QAAiD;AAC/E,MAAI,CAAC,OAAQ,QAAO;AACpB,MAAI,OAAO,WAAW,SAAU,QAAO,aAAa,MAAM;AAC1D,MAAI,OAAO,WAAW,UAAU;AAC9B,UAAM,MAAM;AACZ,QAAI,OAAO,IAAI,WAAW,iBAAiB,aAAa,IAAI,MAAM,KAAK;AACvE,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAGO,SAAS,SAAS,MAAc,KAAqB;AAC1D,SAAO,KAAK,SAAS,MAAM,GAAG,KAAK,MAAM,GAAG,GAAG,CAAC,QAAQ;AAC1D;AAIO,SAAS,SAAS;AAAA,EACvB,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAWG;AACD,QAAM,YAAY,WAAW;AAC7B,QAAM,aAAa,WAAW;AAC9B,QAAM,UAAU,WAAW;AAE3B,SACEA,2BAAAA,KAAC,OAAA,EAAI,WAAU,0FACb,UAAA;AAAA,IAAAA,2BAAAA,KAAC,OAAA,EAAI,WAAU,qCACb,UAAA;AAAA,MAAAC,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWC,OAAAA;AAAAA,YACT;AAAA,YACA,aAAa;AAA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;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAS,MAAM,YAAY,CAAC,QAAQ;AAAA,QACpC,WAAU;AAAA,QAEV,UAAA;AAAA,UAAAC,2BAAAA;AAAAA,YAACS,YAAAA;AAAAA,YAAA;AAAA,cACC,WAAWR,OAAAA;AAAAA,gBACT;AAAA,gBACA,CAAC,YAAY;AAAA,cAAA;AAAA,YACf;AAAA,UAAA;AAAA,UAEFD,2BAAAA,IAAC,QAAA,EAAM,UAAA,WAAW,iBAAkB,SAAS,eAAA,CAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAE9D,YACCA,2BAAAA,IAAC,OAAA,EAAI,WAAU,4EACZ,SAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"primitives.cjs","sources":["../../src/tools/primitives.tsx"],"sourcesContent":["\"use client\";\n\n/**\n * The shared building blocks every SDK tool card is made of — the card shell\n * (`ToolCard`), the collapsible details section, and the result/text helpers.\n * Kept apart from the tool UI registry so a tool UI module can use them\n * without importing the registry that imports it back.\n */\nimport {\n useCallback,\n useContext,\n useState,\n type ElementType,\n type ReactNode,\n} from \"react\";\nimport { formatToolName } from \"@athenaintel/agent-runtime\";\nimport {\n AlertCircleIcon,\n CheckCircle2Icon,\n ChevronDownIcon,\n ClipboardCopyIcon,\n LoaderIcon,\n} from \"lucide-react\";\nimport { cn } from \"../lib/utils\";\nimport { ToolAppearanceContext } from \"./tool-appearance\";\n\nexport { formatToolName };\n\n/** Parse JSON text into a record, or `null` when it is not one. */\nexport function tryParseJson(text: string): Record<string, unknown> | null {\n try {\n const parsed: unknown = JSON.parse(text);\n return typeof parsed === \"object\" && parsed !== null\n ? (parsed as Record<string, unknown>)\n : null;\n } catch {\n return null;\n }\n}\n\n/** Parse a tool result (handles nested `.result`, string-encoded JSON) into a record. */\nexport function normalizeResult(result: unknown): Record<string, unknown> | null {\n if (!result) return null;\n if (typeof result === \"string\") return tryParseJson(result);\n if (typeof result === \"object\") {\n const obj = result as Record<string, unknown>;\n if (typeof obj.result === \"string\") return tryParseJson(obj.result) ?? obj;\n return obj;\n }\n return null;\n}\n\n/** Truncate a string with an ellipsis. */\nexport function truncate(text: string, max: number): string {\n return text.length > max ? `${text.slice(0, max)}...` : text;\n}\n\nexport type ToolStatus = \"running\" | \"complete\" | \"incomplete\" | \"requires-action\";\n\nexport interface ToolCardProps {\n icon: ElementType;\n status: ToolStatus;\n title: string;\n subtitle?: string;\n toolName?: string;\n badge?: string;\n error?: string | null;\n children?: ReactNode;\n args?: Record<string, unknown>;\n result?: unknown;\n}\n\n/**\n * The card shell every dedicated tool UI is built on. Under a thread\n * appearance provider it renders through the provider's row renderer (the\n * `ToolFallback` shell), so a dedicated UI and a generic fallback share one\n * anatomy there; with no provider it is the boxed card below, unchanged.\n */\nexport function ToolCard(props: ToolCardProps) {\n const ThreadToolCard = useContext(ToolAppearanceContext)?.ToolCard;\n if (ThreadToolCard) return <ThreadToolCard {...props} />;\n return <ToolCardBox {...props} />;\n}\n\nfunction ToolCardBox({\n icon: Icon,\n status,\n title,\n subtitle,\n toolName,\n badge,\n error,\n children,\n args,\n result,\n}: ToolCardProps) {\n const isRunning = status === \"running\";\n const isComplete = status === \"complete\";\n const isError = status === \"incomplete\";\n\n return (\n <div className=\"my-3 w-full overflow-hidden rounded-xl border border-border/60 bg-background shadow-sm\">\n <div className=\"flex items-center gap-3 px-4 py-3\">\n <div\n className={cn(\n \"flex size-8 shrink-0 items-center justify-center rounded-lg\",\n isRunning && \"bg-blue-50 text-blue-600\",\n isComplete && \"bg-emerald-50 text-emerald-600\",\n isError && \"bg-destructive/10 text-destructive\",\n )}\n >\n {isRunning ? (\n <LoaderIcon className=\"size-4 animate-spin\" />\n ) : isError ? (\n <AlertCircleIcon className=\"size-4\" />\n ) : (\n <Icon className=\"size-4\" />\n )}\n </div>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-[13px] font-medium text-foreground\">\n {title}\n </span>\n {isComplete && !error && (\n <CheckCircle2Icon className=\"size-3.5 text-emerald-500\" />\n )}\n </div>\n {subtitle && (\n <p className=\"truncate text-[12px] text-muted-foreground\">\n {subtitle}\n </p>\n )}\n </div>\n {toolName && (\n <span className=\"shrink-0 rounded-md bg-muted/60 px-1.5 py-0.5 text-[10px] font-mono text-muted-foreground\">\n {formatToolName(toolName)}\n </span>\n )}\n {badge && (\n <span className=\"shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground\">\n {badge}\n </span>\n )}\n {isRunning && (\n <div className=\"flex items-center gap-1.5\">\n <div className=\"h-1.5 w-10 animate-pulse rounded-full bg-blue-100\" />\n <div className=\"h-1.5 w-6 animate-pulse rounded-full bg-blue-100\" />\n </div>\n )}\n </div>\n\n {error && (\n <div className=\"border-t border-border/40 bg-destructive/10 px-4 py-2.5\">\n <p className=\"text-[12px] leading-relaxed text-destructive\">\n {error}\n </p>\n </div>\n )}\n\n {children}\n\n {/* Copy tool spec — subtle button at the bottom of every tool card */}\n {toolName && isComplete && (\n <CopyToolSpecButton toolName={toolName} args={args} result={result} />\n )}\n </div>\n );\n}\n\n/** Copies `{ tool_name, arguments, result }` as JSON — the tool spec a support ticket needs. */\nexport function CopyToolSpecButton({\n toolName,\n args,\n argsText,\n result,\n className,\n}: {\n toolName: string;\n args?: Record<string, unknown>;\n argsText?: string;\n result?: unknown;\n className?: string;\n}) {\n const [copied, setCopied] = useState(false);\n\n const handleCopy = useCallback(() => {\n const spec: Record<string, unknown> = { tool_name: toolName };\n if (args) spec.arguments = args;\n else if (argsText) spec.arguments = tryParseJson(argsText) ?? argsText;\n if (result !== undefined) {\n if (typeof result === \"string\") {\n const parsed = tryParseJson(result);\n spec.result = parsed ?? result;\n } else {\n spec.result = result;\n }\n }\n navigator.clipboard.writeText(JSON.stringify(spec, null, 2)).then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n });\n }, [toolName, args, argsText, result]);\n\n return (\n <div className={cn(\"flex justify-end px-3 pb-1.5\", className)}>\n <button\n type=\"button\"\n onClick={handleCopy}\n className=\"flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground/40 transition-colors hover:bg-muted/50 hover:text-muted-foreground\"\n title=\"Copy tool name, arguments, and result as JSON\"\n >\n <ClipboardCopyIcon className=\"size-2.5\" />\n {copied ? \"Copied!\" : toolName}\n </button>\n </div>\n );\n}\n\n/** \"Show search results\" → \"Search results\": the static heading a section gets once the row's disclosure is the only toggle. */\nfunction sectionHeading(label: string | undefined): string | null {\n if (!label) return null;\n const heading = label.replace(/^show\\s+/i, \"\").trim();\n if (!heading) return null;\n return heading.charAt(0).toUpperCase() + heading.slice(1);\n}\n\nexport function ExpandableSection({\n label,\n children,\n defaultOpen = false,\n}: {\n label?: string;\n children: ReactNode;\n defaultOpen?: boolean;\n}) {\n const [expanded, setExpanded] = useState(defaultOpen);\n const appearance = useContext(ToolAppearanceContext)?.appearance ?? \"card\";\n\n // Inside the thread row the card's own disclosure is the one toggle; a\n // second nested \"Show details\" would make a reader click twice.\n if (appearance === \"thread\") {\n const heading = sectionHeading(label);\n return (\n <div data-slot=\"tool-section\" className=\"flex flex-col gap-1.5 px-3\">\n {heading ? (\n <p className=\"text-xs font-medium text-muted-foreground\">{heading}</p>\n ) : null}\n <div className=\"max-h-72 overflow-y-auto\">{children}</div>\n </div>\n );\n }\n\n return (\n <div className=\"border-t border-border/40\">\n <button\n type=\"button\"\n onClick={() => setExpanded(!expanded)}\n className=\"flex w-full items-center gap-2 px-4 py-2 text-left text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/30\"\n >\n <ChevronDownIcon\n className={cn(\n \"size-3.5 shrink-0 transition-transform duration-200\",\n !expanded && \"-rotate-90\",\n )}\n />\n <span>{expanded ? \"Hide details\" : (label ?? \"Show details\")}</span>\n </button>\n {expanded && (\n <div className=\"max-h-72 overflow-y-auto border-t border-border/40 bg-muted/10 px-4 py-3\">\n {children}\n </div>\n )}\n </div>\n );\n}\n"],"names":["useContext","ToolAppearanceContext","jsx","jsxs","cn","LoaderIcon","AlertCircleIcon","CheckCircle2Icon","formatToolName","useState","useCallback","ClipboardCopyIcon","ChevronDownIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6BO,SAAS,aAAa,MAA8C;AACzE,MAAI;AACF,UAAM,SAAkB,KAAK,MAAM,IAAI;AACvC,WAAO,OAAO,WAAW,YAAY,WAAW,OAC3C,SACD;AAAA,EACN,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,gBAAgB,QAAiD;AAC/E,MAAI,CAAC,OAAQ,QAAO;AACpB,MAAI,OAAO,WAAW,SAAU,QAAO,aAAa,MAAM;AAC1D,MAAI,OAAO,WAAW,UAAU;AAC9B,UAAM,MAAM;AACZ,QAAI,OAAO,IAAI,WAAW,iBAAiB,aAAa,IAAI,MAAM,KAAK;AACvE,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAGO,SAAS,SAAS,MAAc,KAAqB;AAC1D,SAAO,KAAK,SAAS,MAAM,GAAG,KAAK,MAAM,GAAG,GAAG,CAAC,QAAQ;AAC1D;AAuBO,SAAS,SAAS,OAAsB;;AAC7C,QAAM,kBAAiBA,WAAAA,WAAWC,eAAAA,qBAAqB,MAAhCD,mBAAmC;AAC1D,MAAI,eAAgB,QAAOE,2BAAAA,IAAC,gBAAA,EAAgB,GAAG,MAAA,CAAO;AACtD,SAAOA,+BAAC,aAAA,EAAa,GAAG,MAAA,CAAO;AACjC;AAEA,SAAS,YAAY;AAAA,EACnB,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAkB;AAChB,QAAM,YAAY,WAAW;AAC7B,QAAM,aAAa,WAAW;AAC9B,QAAM,UAAU,WAAW;AAE3B,SACEC,2BAAAA,KAAC,OAAA,EAAI,WAAU,0FACb,UAA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 -14,7 +14,7 @@ export declare function normalizeResult(result: unknown): Record<string, unknown
|
|
|
14
14
|
/** Truncate a string with an ellipsis. */
|
|
15
15
|
export declare function truncate(text: string, max: number): string;
|
|
16
16
|
export type ToolStatus = "running" | "complete" | "incomplete" | "requires-action";
|
|
17
|
-
export
|
|
17
|
+
export interface ToolCardProps {
|
|
18
18
|
icon: ElementType;
|
|
19
19
|
status: ToolStatus;
|
|
20
20
|
title: string;
|
|
@@ -25,7 +25,14 @@ export declare function ToolCard({ icon: Icon, status, title, subtitle, toolName
|
|
|
25
25
|
children?: ReactNode;
|
|
26
26
|
args?: Record<string, unknown>;
|
|
27
27
|
result?: unknown;
|
|
28
|
-
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The card shell every dedicated tool UI is built on. Under a thread
|
|
31
|
+
* appearance provider it renders through the provider's row renderer (the
|
|
32
|
+
* `ToolFallback` shell), so a dedicated UI and a generic fallback share one
|
|
33
|
+
* anatomy there; with no provider it is the boxed card below, unchanged.
|
|
34
|
+
*/
|
|
35
|
+
export declare function ToolCard(props: ToolCardProps): import("react/jsx-runtime").JSX.Element;
|
|
29
36
|
/** Copies `{ tool_name, arguments, result }` as JSON — the tool spec a support ticket needs. */
|
|
30
37
|
export declare function CopyToolSpecButton({ toolName, args, argsText, result, className, }: {
|
|
31
38
|
toolName: string;
|
package/dist/tools/primitives.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback } from "react";
|
|
2
|
+
import { useState, useCallback, useContext } from "react";
|
|
3
3
|
import "../packages/agent-runtime/src/generated/runconfig-contract.js";
|
|
4
4
|
import "@assistant-ui/tap";
|
|
5
5
|
import "statewire";
|
|
6
6
|
import "../packages/agent-runtime/src/statewire-suspended.js";
|
|
7
|
+
import "../packages/agent-runtime/src/conversation-list.js";
|
|
7
8
|
import { formatToolName } from "../packages/agent-runtime/src/tool-metadata.js";
|
|
8
9
|
import "@tanstack/react-query";
|
|
9
10
|
import "../packages/agent-runtime/src/statewire-state.js";
|
|
10
11
|
import "../packages/agent-runtime/src/messages.js";
|
|
11
|
-
import "@assistant-ui/react-statewire";
|
|
12
12
|
import "@assistant-ui/store";
|
|
13
13
|
import "../packages/agent-runtime/src/quota-safe-local-storage-session.js";
|
|
14
14
|
import "../packages/agent-runtime/src/statewire-attach-observer.js";
|
|
15
15
|
import "../packages/agent-runtime/src/thread-status.js";
|
|
16
|
+
import "@assistant-ui/react-statewire";
|
|
16
17
|
import "@assistant-ui/core";
|
|
17
18
|
import "../packages/agent-runtime/src/thread-handoff.js";
|
|
18
19
|
import { ClipboardCopyIcon, ChevronDownIcon, LoaderIcon, AlertCircleIcon, CheckCircle2Icon } from "lucide-react";
|
|
20
|
+
import { ToolAppearanceContext } from "./tool-appearance.js";
|
|
19
21
|
import { cn } from "cnfast";
|
|
20
22
|
function tryParseJson(text) {
|
|
21
23
|
try {
|
|
@@ -38,7 +40,13 @@ function normalizeResult(result) {
|
|
|
38
40
|
function truncate(text, max) {
|
|
39
41
|
return text.length > max ? `${text.slice(0, max)}...` : text;
|
|
40
42
|
}
|
|
41
|
-
function ToolCard({
|
|
43
|
+
function ToolCard(props) {
|
|
44
|
+
var _a;
|
|
45
|
+
const ThreadToolCard = (_a = useContext(ToolAppearanceContext)) == null ? void 0 : _a.ToolCard;
|
|
46
|
+
if (ThreadToolCard) return /* @__PURE__ */ jsx(ThreadToolCard, { ...props });
|
|
47
|
+
return /* @__PURE__ */ jsx(ToolCardBox, { ...props });
|
|
48
|
+
}
|
|
49
|
+
function ToolCardBox({
|
|
42
50
|
icon: Icon,
|
|
43
51
|
status,
|
|
44
52
|
title,
|
|
@@ -125,12 +133,27 @@ function CopyToolSpecButton({
|
|
|
125
133
|
}
|
|
126
134
|
) });
|
|
127
135
|
}
|
|
136
|
+
function sectionHeading(label) {
|
|
137
|
+
if (!label) return null;
|
|
138
|
+
const heading = label.replace(/^show\s+/i, "").trim();
|
|
139
|
+
if (!heading) return null;
|
|
140
|
+
return heading.charAt(0).toUpperCase() + heading.slice(1);
|
|
141
|
+
}
|
|
128
142
|
function ExpandableSection({
|
|
129
143
|
label,
|
|
130
144
|
children,
|
|
131
145
|
defaultOpen = false
|
|
132
146
|
}) {
|
|
147
|
+
var _a;
|
|
133
148
|
const [expanded, setExpanded] = useState(defaultOpen);
|
|
149
|
+
const appearance = ((_a = useContext(ToolAppearanceContext)) == null ? void 0 : _a.appearance) ?? "card";
|
|
150
|
+
if (appearance === "thread") {
|
|
151
|
+
const heading = sectionHeading(label);
|
|
152
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "tool-section", className: "flex flex-col gap-1.5 px-3", children: [
|
|
153
|
+
heading ? /* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground", children: heading }) : null,
|
|
154
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-72 overflow-y-auto", children })
|
|
155
|
+
] });
|
|
156
|
+
}
|
|
134
157
|
return /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40", children: [
|
|
135
158
|
/* @__PURE__ */ jsxs(
|
|
136
159
|
"button",
|