@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.js","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":[],"mappings":";;;;;;;;;;;;;;;;;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;AAAA,IACF;AACA,cAAU,UAAU,UAAU,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC,EAAE,KAAK,MAAM;AACtE,gBAAU,IAAI;AACd,iBAAW,MAAM,UAAU,KAAK,GAAG,GAAI;AAAA,IACzC,CAAC;AAAA,EACH,GAAG,CAAC,UAAU,MAAM,UAAU,MAAM,CAAC;AAErC,6BACG,OAAA,EAAI,WAAW,GAAG,gCAAgC,SAAS,GAC1D,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAS;AAAA,MACT,WAAU;AAAA,MACV,OAAM;AAAA,MAEN,UAAA;AAAA,QAAA,oBAAC,mBAAA,EAAkB,WAAU,WAAA,CAAW;AAAA,QACvC,SAAS,YAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAE1B;AAEJ;AAEO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAIG;AACD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,WAAW;AAEpD,SACE,qBAAC,OAAA,EAAI,WAAU,6BACb,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAS,MAAM,YAAY,CAAC,QAAQ;AAAA,QACpC,WAAU;AAAA,QAEV,UAAA;AAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW;AAAA,gBACT;AAAA,gBACA,CAAC,YAAY;AAAA,cAAA;AAAA,YACf;AAAA,UAAA;AAAA,UAEF,oBAAC,QAAA,EAAM,UAAA,WAAW,iBAAkB,SAAS,eAAA,CAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAE9D,YACC,oBAAC,OAAA,EAAI,WAAU,4EACZ,SAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"primitives.js","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":[],"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,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BAAkB,SAAS,eAAA,CAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAE9D,YACC,oBAAC,OAAA,EAAI,WAAU,4EACZ,SAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const ToolAppearanceContext = react.createContext(null);
|
|
5
|
+
function useToolAppearance(explicit) {
|
|
6
|
+
const fromContext = react.useContext(ToolAppearanceContext);
|
|
7
|
+
return explicit ?? (fromContext == null ? void 0 : fromContext.appearance) ?? "card";
|
|
8
|
+
}
|
|
9
|
+
exports.ToolAppearanceContext = ToolAppearanceContext;
|
|
10
|
+
exports.useToolAppearance = useToolAppearance;
|
|
11
|
+
//# sourceMappingURL=tool-appearance.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-appearance.cjs","sources":["../../src/tools/tool-appearance.tsx"],"sourcesContent":["\"use client\";\n\n/**\n * Which anatomy a tool call renders with.\n *\n * - `card` — the boxed host card Olympus, the Chrome side panel and the Office\n * task pane render today (the default; its markup is snapshot-pinned).\n * - `thread` — the SDK thread's one-line row: status glyph, verb + target on\n * one line, a disclosure for arguments and result. Every tool call in the\n * thread uses it, dedicated tool UIs included, so a transcript reads as one\n * anatomy.\n *\n * The appearance is read from the nearest provider when a card is not given\n * one explicitly; with no provider the default stays `card`, so a host that\n * never mounts the provider renders exactly what it rendered before.\n */\nimport { createContext, useContext, type ComponentType } from \"react\";\nimport type { ToolCardProps } from \"./primitives\";\n\nexport type ToolAppearance = \"card\" | \"thread\";\n\nexport interface ToolAppearanceContextValue {\n appearance: ToolAppearance;\n /**\n * Renders a dedicated tool UI's `ToolCard` in this appearance. Set by the\n * thread provider (the renderer lives with `ToolFallback`, which this module\n * cannot import without a cycle); `undefined` keeps `ToolCard`'s own markup.\n */\n ToolCard?: ComponentType<ToolCardProps>;\n}\n\nexport const ToolAppearanceContext =\n createContext<ToolAppearanceContextValue | null>(null);\n\n/** The appearance in force: the explicit prop, else the provider's, else `card`. */\nexport function useToolAppearance(explicit?: ToolAppearance): ToolAppearance {\n const fromContext = useContext(ToolAppearanceContext);\n return explicit ?? fromContext?.appearance ?? \"card\";\n}\n"],"names":["createContext","useContext"],"mappings":";;;AA+BO,MAAM,wBACXA,MAAAA,cAAiD,IAAI;AAGhD,SAAS,kBAAkB,UAA2C;AAC3E,QAAM,cAAcC,MAAAA,WAAW,qBAAqB;AACpD,SAAO,aAAY,2CAAa,eAAc;AAChD;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which anatomy a tool call renders with.
|
|
3
|
+
*
|
|
4
|
+
* - `card` — the boxed host card Olympus, the Chrome side panel and the Office
|
|
5
|
+
* task pane render today (the default; its markup is snapshot-pinned).
|
|
6
|
+
* - `thread` — the SDK thread's one-line row: status glyph, verb + target on
|
|
7
|
+
* one line, a disclosure for arguments and result. Every tool call in the
|
|
8
|
+
* thread uses it, dedicated tool UIs included, so a transcript reads as one
|
|
9
|
+
* anatomy.
|
|
10
|
+
*
|
|
11
|
+
* The appearance is read from the nearest provider when a card is not given
|
|
12
|
+
* one explicitly; with no provider the default stays `card`, so a host that
|
|
13
|
+
* never mounts the provider renders exactly what it rendered before.
|
|
14
|
+
*/
|
|
15
|
+
import { type ComponentType } from "react";
|
|
16
|
+
import type { ToolCardProps } from "./primitives";
|
|
17
|
+
export type ToolAppearance = "card" | "thread";
|
|
18
|
+
export interface ToolAppearanceContextValue {
|
|
19
|
+
appearance: ToolAppearance;
|
|
20
|
+
/**
|
|
21
|
+
* Renders a dedicated tool UI's `ToolCard` in this appearance. Set by the
|
|
22
|
+
* thread provider (the renderer lives with `ToolFallback`, which this module
|
|
23
|
+
* cannot import without a cycle); `undefined` keeps `ToolCard`'s own markup.
|
|
24
|
+
*/
|
|
25
|
+
ToolCard?: ComponentType<ToolCardProps>;
|
|
26
|
+
}
|
|
27
|
+
export declare const ToolAppearanceContext: import("react").Context<ToolAppearanceContextValue | null>;
|
|
28
|
+
/** The appearance in force: the explicit prop, else the provider's, else `card`. */
|
|
29
|
+
export declare function useToolAppearance(explicit?: ToolAppearance): ToolAppearance;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext, createContext } from "react";
|
|
2
|
+
const ToolAppearanceContext = createContext(null);
|
|
3
|
+
function useToolAppearance(explicit) {
|
|
4
|
+
const fromContext = useContext(ToolAppearanceContext);
|
|
5
|
+
return explicit ?? (fromContext == null ? void 0 : fromContext.appearance) ?? "card";
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
ToolAppearanceContext,
|
|
9
|
+
useToolAppearance
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=tool-appearance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-appearance.js","sources":["../../src/tools/tool-appearance.tsx"],"sourcesContent":["\"use client\";\n\n/**\n * Which anatomy a tool call renders with.\n *\n * - `card` — the boxed host card Olympus, the Chrome side panel and the Office\n * task pane render today (the default; its markup is snapshot-pinned).\n * - `thread` — the SDK thread's one-line row: status glyph, verb + target on\n * one line, a disclosure for arguments and result. Every tool call in the\n * thread uses it, dedicated tool UIs included, so a transcript reads as one\n * anatomy.\n *\n * The appearance is read from the nearest provider when a card is not given\n * one explicitly; with no provider the default stays `card`, so a host that\n * never mounts the provider renders exactly what it rendered before.\n */\nimport { createContext, useContext, type ComponentType } from \"react\";\nimport type { ToolCardProps } from \"./primitives\";\n\nexport type ToolAppearance = \"card\" | \"thread\";\n\nexport interface ToolAppearanceContextValue {\n appearance: ToolAppearance;\n /**\n * Renders a dedicated tool UI's `ToolCard` in this appearance. Set by the\n * thread provider (the renderer lives with `ToolFallback`, which this module\n * cannot import without a cycle); `undefined` keeps `ToolCard`'s own markup.\n */\n ToolCard?: ComponentType<ToolCardProps>;\n}\n\nexport const ToolAppearanceContext =\n createContext<ToolAppearanceContextValue | null>(null);\n\n/** The appearance in force: the explicit prop, else the provider's, else `card`. */\nexport function useToolAppearance(explicit?: ToolAppearance): ToolAppearance {\n const fromContext = useContext(ToolAppearanceContext);\n return explicit ?? fromContext?.appearance ?? \"card\";\n}\n"],"names":[],"mappings":";AA+BO,MAAM,wBACX,cAAiD,IAAI;AAGhD,SAAS,kBAAkB,UAA2C;AAC3E,QAAM,cAAc,WAAW,qBAAqB;AACpD,SAAO,aAAY,2CAAa,eAAc;AAChD;"}
|
|
@@ -8,25 +8,46 @@ require("../packages/agent-runtime/src/generated/runconfig-contract.cjs");
|
|
|
8
8
|
require("@assistant-ui/tap");
|
|
9
9
|
require("statewire");
|
|
10
10
|
require("../packages/agent-runtime/src/statewire-suspended.cjs");
|
|
11
|
+
require("../packages/agent-runtime/src/conversation-list.cjs");
|
|
11
12
|
const toolMetadata = require("../packages/agent-runtime/src/tool-metadata.cjs");
|
|
12
13
|
const toolResult = require("../packages/agent-runtime/src/tool-result.cjs");
|
|
13
14
|
require("@tanstack/react-query");
|
|
14
15
|
require("../packages/agent-runtime/src/statewire-state.cjs");
|
|
15
16
|
require("../packages/agent-runtime/src/messages.cjs");
|
|
16
|
-
require("@assistant-ui/react-statewire");
|
|
17
17
|
require("@assistant-ui/store");
|
|
18
18
|
require("../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
|
|
19
19
|
require("../packages/agent-runtime/src/statewire-attach-observer.cjs");
|
|
20
20
|
require("../packages/agent-runtime/src/thread-status.cjs");
|
|
21
|
+
require("@assistant-ui/react-statewire");
|
|
21
22
|
require("@assistant-ui/core");
|
|
22
23
|
require("../packages/agent-runtime/src/thread-handoff.cjs");
|
|
23
24
|
const collapsible = require("../ui/collapsible.cjs");
|
|
24
25
|
const assetPanelStore = require("../assets/asset-panel-store.cjs");
|
|
25
26
|
const NestedPtcMessages = require("./NestedPtcMessages.cjs");
|
|
26
27
|
const primitives = require("./primitives.cjs");
|
|
28
|
+
const toolAppearance = require("./tool-appearance.cjs");
|
|
27
29
|
const toolIcons = require("./tool-icons.cjs");
|
|
30
|
+
const useElapsedSeconds = require("./use-elapsed-seconds.cjs");
|
|
28
31
|
const cnfast = require("cnfast");
|
|
29
32
|
const ANIMATION_DURATION = 200;
|
|
33
|
+
const THREAD_ROOT_CLASS = "aui-tool-fallback-root group/tool-fallback-root my-1.5 w-full rounded-lg border border-border/50 bg-background";
|
|
34
|
+
function ThreadStatusGlyph({
|
|
35
|
+
classification,
|
|
36
|
+
isCancelled
|
|
37
|
+
}) {
|
|
38
|
+
const state = classification.state;
|
|
39
|
+
const glyph = state === "running" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LoaderIcon, { className: "size-3.5 animate-spin text-muted-foreground motion-reduce:animate-none" }) : state === "rejected" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircleIcon, { className: "size-3.5 text-amber-600" }) : state === "error" ? isCancelled ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircleIcon, { className: "size-3.5 text-muted-foreground" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircleIcon, { className: "size-3.5 text-destructive" }) : state === "paused" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PauseIcon, { className: "size-3.5 text-amber-600" }) : state === "requires-action" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ShieldAlertIcon, { className: "size-3.5 text-amber-600" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-3.5 text-emerald-600" });
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
41
|
+
"span",
|
|
42
|
+
{
|
|
43
|
+
"data-slot": "tool-fallback-status",
|
|
44
|
+
"data-tool-outcome": state,
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
className: "flex size-4 shrink-0 items-center justify-center",
|
|
47
|
+
children: glyph
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
30
51
|
function rejectedOutcome(classification) {
|
|
31
52
|
return classification.state === "rejected" ? classification.rejection : null;
|
|
32
53
|
}
|
|
@@ -109,9 +130,11 @@ function ToolFallbackRoot({
|
|
|
109
130
|
open: controlledOpen,
|
|
110
131
|
onOpenChange: controlledOnOpenChange,
|
|
111
132
|
defaultOpen = false,
|
|
133
|
+
appearance: appearanceProp,
|
|
112
134
|
children,
|
|
113
135
|
...props
|
|
114
136
|
}) {
|
|
137
|
+
const appearance = toolAppearance.useToolAppearance(appearanceProp);
|
|
115
138
|
const collapsibleRef = react.useRef(null);
|
|
116
139
|
const [uncontrolledOpen, setUncontrolledOpen] = react.useState(defaultOpen);
|
|
117
140
|
const lockScroll = react$1.useScrollLock(collapsibleRef, ANIMATION_DURATION);
|
|
@@ -134,10 +157,11 @@ function ToolFallbackRoot({
|
|
|
134
157
|
{
|
|
135
158
|
ref: collapsibleRef,
|
|
136
159
|
"data-slot": "tool-fallback-root",
|
|
160
|
+
...appearance === "thread" ? { "data-appearance": "thread" } : {},
|
|
137
161
|
open: isOpen,
|
|
138
162
|
onOpenChange: handleOpenChange,
|
|
139
163
|
className: cnfast.cn(
|
|
140
|
-
"aui-tool-fallback-root group/tool-fallback-root my-3 w-full rounded-xl border border-border/60 bg-background py-2.5 shadow-sm",
|
|
164
|
+
appearance === "thread" ? THREAD_ROOT_CLASS : "aui-tool-fallback-root group/tool-fallback-root my-3 w-full rounded-xl border border-border/60 bg-background py-2.5 shadow-sm",
|
|
141
165
|
className
|
|
142
166
|
),
|
|
143
167
|
style: {
|
|
@@ -158,29 +182,101 @@ function ToolFallbackTrigger({
|
|
|
158
182
|
displayName,
|
|
159
183
|
activeLabel,
|
|
160
184
|
icon,
|
|
185
|
+
appearance: appearanceProp,
|
|
186
|
+
secondary: secondaryProp,
|
|
187
|
+
badge,
|
|
161
188
|
className,
|
|
162
189
|
...props
|
|
163
190
|
}) {
|
|
191
|
+
const appearance = toolAppearance.useToolAppearance(appearanceProp);
|
|
192
|
+
const isThread = appearance === "thread";
|
|
164
193
|
const classification = givenClassification ?? toolResult.classifyToolResult({ status, result, isError });
|
|
165
194
|
const state = classification.state;
|
|
166
195
|
const isRunning = state === "running";
|
|
167
196
|
const isCancelled = (status == null ? void 0 : status.type) === "incomplete" && status.reason === "cancelled";
|
|
197
|
+
const elapsed = useElapsedSeconds.elapsedSuffix(useElapsedSeconds.useElapsedSeconds(isThread && isRunning));
|
|
168
198
|
const meta = toolMetadata.getToolDisplayMeta(toolName);
|
|
169
199
|
const ToolIcon = icon ?? toolIcons.toolIcon(meta.icon);
|
|
170
200
|
const title = displayName ?? meta.displayName;
|
|
171
201
|
const running = activeLabel ?? meta.activeLabel;
|
|
172
202
|
const summary = react.useMemo(() => {
|
|
173
|
-
if (isRunning || !argsText) return null;
|
|
203
|
+
if (isRunning && !isThread || !argsText) return null;
|
|
174
204
|
const parsed = primitives.tryParseJson(argsText);
|
|
175
205
|
return parsed ? toolMetadata.describeToolArgs({ toolName, args: parsed }) ?? null : null;
|
|
176
|
-
}, [toolName, argsText, isRunning]);
|
|
206
|
+
}, [toolName, argsText, isRunning, isThread]);
|
|
177
207
|
const message = react.useMemo(
|
|
178
208
|
() => state === "complete" ? toolResult.resultMessage(result) : null,
|
|
179
209
|
[result, state]
|
|
180
210
|
);
|
|
181
211
|
const rejection = rejectedOutcome(classification);
|
|
182
212
|
const headline = rejection ? toolMetadata.toolStatusLabel(toolName, "rejected", displayName) : state === "error" ? `Failed: ${title}` : state === "paused" ? `Paused: ${title}` : title;
|
|
183
|
-
const secondary = rejection ? rejection.reason : message || summary;
|
|
213
|
+
const secondary = secondaryProp ?? (rejection ? rejection.reason : message || summary);
|
|
214
|
+
if (isThread) {
|
|
215
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
216
|
+
collapsible.CollapsibleTrigger,
|
|
217
|
+
{
|
|
218
|
+
"data-slot": "tool-fallback-trigger",
|
|
219
|
+
"data-tool-outcome": state,
|
|
220
|
+
"data-appearance": "thread",
|
|
221
|
+
className: cnfast.cn(
|
|
222
|
+
"aui-tool-fallback-trigger group/trigger flex w-full min-w-0 items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-[13px] leading-snug transition-colors hover:bg-muted/40",
|
|
223
|
+
className
|
|
224
|
+
),
|
|
225
|
+
...props,
|
|
226
|
+
children: [
|
|
227
|
+
/* @__PURE__ */ jsxRuntime.jsx(ThreadStatusGlyph, { classification, isCancelled }),
|
|
228
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 items-baseline gap-1.5", children: [
|
|
229
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
230
|
+
"span",
|
|
231
|
+
{
|
|
232
|
+
"data-slot": "tool-fallback-verb",
|
|
233
|
+
className: cnfast.cn(
|
|
234
|
+
"shrink-0 font-medium",
|
|
235
|
+
state === "error" && !isCancelled && "text-destructive",
|
|
236
|
+
isCancelled && "text-muted-foreground line-through"
|
|
237
|
+
),
|
|
238
|
+
children: isRunning ? running : headline
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
isRunning && elapsed ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
242
|
+
"span",
|
|
243
|
+
{
|
|
244
|
+
"data-slot": "tool-fallback-elapsed",
|
|
245
|
+
className: "shrink-0 tabular-nums text-muted-foreground",
|
|
246
|
+
children: [
|
|
247
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "· " }),
|
|
248
|
+
elapsed
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
) : null,
|
|
252
|
+
secondary ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
253
|
+
"span",
|
|
254
|
+
{
|
|
255
|
+
"data-slot": "tool-fallback-target",
|
|
256
|
+
className: "min-w-0 truncate text-muted-foreground",
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "· " }),
|
|
259
|
+
secondary
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
) : null,
|
|
263
|
+
badge ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 rounded-full bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground", children: badge }) : null
|
|
264
|
+
] }),
|
|
265
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
266
|
+
lucideReact.ChevronDownIcon,
|
|
267
|
+
{
|
|
268
|
+
className: cnfast.cn(
|
|
269
|
+
"size-3.5 shrink-0 text-muted-foreground/60",
|
|
270
|
+
"transition-transform duration-(--animation-duration) ease-out",
|
|
271
|
+
"group-data-[state=closed]/trigger:-rotate-90",
|
|
272
|
+
"group-data-[state=open]/trigger:rotate-0"
|
|
273
|
+
)
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
}
|
|
184
280
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
185
281
|
collapsible.CollapsibleTrigger,
|
|
186
282
|
{
|
|
@@ -250,8 +346,10 @@ function ToolFallbackTrigger({
|
|
|
250
346
|
function ToolFallbackContent({
|
|
251
347
|
className,
|
|
252
348
|
children,
|
|
349
|
+
appearance: appearanceProp,
|
|
253
350
|
...props
|
|
254
351
|
}) {
|
|
352
|
+
const appearance = toolAppearance.useToolAppearance(appearanceProp);
|
|
255
353
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
256
354
|
collapsible.CollapsibleContent,
|
|
257
355
|
{
|
|
@@ -268,7 +366,13 @@ function ToolFallbackContent({
|
|
|
268
366
|
className
|
|
269
367
|
),
|
|
270
368
|
...props,
|
|
271
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
369
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
370
|
+
"div",
|
|
371
|
+
{
|
|
372
|
+
className: appearance === "thread" ? "mt-1 flex flex-col gap-2 border-t border-border/40 pt-2 pb-1" : "mt-2.5 flex flex-col gap-2 border-t border-border/50 pt-2",
|
|
373
|
+
children
|
|
374
|
+
}
|
|
375
|
+
)
|
|
272
376
|
}
|
|
273
377
|
);
|
|
274
378
|
}
|
|
@@ -359,9 +463,11 @@ function ToolFallbackError({
|
|
|
359
463
|
}
|
|
360
464
|
function ToolFallbackNotice({
|
|
361
465
|
classification,
|
|
466
|
+
appearance: appearanceProp,
|
|
362
467
|
className,
|
|
363
468
|
...props
|
|
364
469
|
}) {
|
|
470
|
+
const isThread = toolAppearance.useToolAppearance(appearanceProp) === "thread";
|
|
365
471
|
if (classification.state === "error") {
|
|
366
472
|
const { failure } = classification;
|
|
367
473
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -369,7 +475,7 @@ function ToolFallbackNotice({
|
|
|
369
475
|
{
|
|
370
476
|
"data-slot": "tool-fallback-notice",
|
|
371
477
|
className: cnfast.cn(
|
|
372
|
-
"mt-2 border-t border-red-200/80 px-3 pt-1.5 text-[11px] text-red-700",
|
|
478
|
+
isThread ? "mt-1 border-t border-destructive/20 px-3 pt-1.5 pb-1 text-[11px] text-destructive" : "mt-2 border-t border-red-200/80 px-3 pt-1.5 text-[11px] text-red-700",
|
|
373
479
|
className
|
|
374
480
|
),
|
|
375
481
|
...props,
|
|
@@ -386,7 +492,7 @@ function ToolFallbackNotice({
|
|
|
386
492
|
{
|
|
387
493
|
"data-slot": "tool-fallback-notice",
|
|
388
494
|
className: cnfast.cn(
|
|
389
|
-
"mt-2 border-t border-amber-200/80 px-3 pt-1.5 text-[11px] text-amber-800",
|
|
495
|
+
isThread ? "mt-1 border-t border-amber-200/80 px-3 pt-1.5 pb-1 text-[11px] text-amber-800" : "mt-2 border-t border-amber-200/80 px-3 pt-1.5 text-[11px] text-amber-800",
|
|
390
496
|
className
|
|
391
497
|
),
|
|
392
498
|
...props,
|
|
@@ -545,8 +651,11 @@ const ToolFallbackImpl = ({
|
|
|
545
651
|
children,
|
|
546
652
|
defaultOpen,
|
|
547
653
|
className,
|
|
548
|
-
rootProps
|
|
654
|
+
rootProps,
|
|
655
|
+
appearance: appearanceProp
|
|
549
656
|
}) => {
|
|
657
|
+
const appearance = toolAppearance.useToolAppearance(appearanceProp);
|
|
658
|
+
const isThread = appearance === "thread";
|
|
550
659
|
const classification = toolResult.classifyToolResult({ status, result, isError });
|
|
551
660
|
const isCancelled = (status == null ? void 0 : status.type) === "incomplete" && status.reason === "cancelled";
|
|
552
661
|
const nestedComponents = NestedPtcMessages.useNestedPtcComponents(ToolFallback);
|
|
@@ -563,7 +672,7 @@ const ToolFallbackImpl = ({
|
|
|
563
672
|
assetId
|
|
564
673
|
};
|
|
565
674
|
const action = typeof extraAction === "function" ? extraAction(context) : extraAction;
|
|
566
|
-
if (isAssetTool(toolName, result)) {
|
|
675
|
+
if (!isThread && isAssetTool(toolName, result)) {
|
|
567
676
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
568
677
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
569
678
|
AssetToolCard,
|
|
@@ -592,17 +701,25 @@ const ToolFallbackImpl = ({
|
|
|
592
701
|
] });
|
|
593
702
|
}
|
|
594
703
|
const isComplete = classification.state === "complete";
|
|
704
|
+
const isFailure = classification.state === "error" && !isCancelled;
|
|
595
705
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
596
706
|
ToolFallbackRoot,
|
|
597
707
|
{
|
|
598
708
|
...rootProps,
|
|
709
|
+
...isThread ? { "data-tool-outcome": classification.state } : {},
|
|
710
|
+
appearance,
|
|
599
711
|
defaultOpen,
|
|
600
|
-
className: cnfast.cn(
|
|
712
|
+
className: cnfast.cn(
|
|
713
|
+
isThread && isFailure && "border-destructive/30 bg-destructive/5",
|
|
714
|
+
isCancelled && "border-muted-foreground/30 bg-muted/30",
|
|
715
|
+
className
|
|
716
|
+
),
|
|
601
717
|
children: [
|
|
602
718
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
|
|
603
719
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
604
720
|
ToolFallbackTrigger,
|
|
605
721
|
{
|
|
722
|
+
appearance,
|
|
606
723
|
toolName,
|
|
607
724
|
argsText,
|
|
608
725
|
result,
|
|
@@ -617,8 +734,8 @@ const ToolFallbackImpl = ({
|
|
|
617
734
|
assetId && isComplete && !action && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 pr-2", children: /* @__PURE__ */ jsxRuntime.jsx(AssetOpenLink, { assetId, toolName, onOpenAsset }) })
|
|
618
735
|
] }),
|
|
619
736
|
notice,
|
|
620
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToolFallbackNotice, { classification }),
|
|
621
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ToolFallbackContent, { children: [
|
|
737
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolFallbackNotice, { appearance, classification }),
|
|
738
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ToolFallbackContent, { appearance, children: [
|
|
622
739
|
children,
|
|
623
740
|
/* @__PURE__ */ jsxRuntime.jsx(ToolFallbackError, { status }),
|
|
624
741
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -645,6 +762,85 @@ const ToolFallbackImpl = ({
|
|
|
645
762
|
}
|
|
646
763
|
);
|
|
647
764
|
};
|
|
765
|
+
function stripTrailingEllipsis(title) {
|
|
766
|
+
return title.replace(/(\.{3}|…)\s*$/u, "");
|
|
767
|
+
}
|
|
768
|
+
function ThreadToolCard({
|
|
769
|
+
status,
|
|
770
|
+
title,
|
|
771
|
+
subtitle,
|
|
772
|
+
toolName,
|
|
773
|
+
badge,
|
|
774
|
+
error,
|
|
775
|
+
children,
|
|
776
|
+
args,
|
|
777
|
+
result
|
|
778
|
+
}) {
|
|
779
|
+
const isRunning = status === "running";
|
|
780
|
+
const isError = status === "incomplete";
|
|
781
|
+
const partStatus = status === "running" ? { type: "running" } : status === "requires-action" ? { type: "requires-action", reason: "interrupt" } : status === "incomplete" ? { type: "incomplete", reason: "error", ...error ? { error } : {} } : { type: "complete" };
|
|
782
|
+
const classification = toolResult.classifyToolResult({ status: partStatus, result: void 0, isError });
|
|
783
|
+
const argsText = react.useMemo(() => args ? JSON.stringify(args) : void 0, [args]);
|
|
784
|
+
const name = toolName ?? title;
|
|
785
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
786
|
+
ToolFallbackRoot,
|
|
787
|
+
{
|
|
788
|
+
appearance: "thread",
|
|
789
|
+
"data-tool-outcome": classification.state,
|
|
790
|
+
className: cnfast.cn(isError && "border-destructive/30 bg-destructive/5"),
|
|
791
|
+
children: [
|
|
792
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
793
|
+
ToolFallbackTrigger,
|
|
794
|
+
{
|
|
795
|
+
appearance: "thread",
|
|
796
|
+
toolName: name,
|
|
797
|
+
status: partStatus,
|
|
798
|
+
classification,
|
|
799
|
+
displayName: title,
|
|
800
|
+
activeLabel: isRunning ? stripTrailingEllipsis(title) : void 0,
|
|
801
|
+
secondary: subtitle,
|
|
802
|
+
badge
|
|
803
|
+
}
|
|
804
|
+
),
|
|
805
|
+
error ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
806
|
+
"div",
|
|
807
|
+
{
|
|
808
|
+
"data-slot": "tool-fallback-notice",
|
|
809
|
+
className: "mt-1 border-t border-destructive/20 px-3 pt-1.5 pb-1 text-[11px] text-destructive",
|
|
810
|
+
children: error
|
|
811
|
+
}
|
|
812
|
+
) : null,
|
|
813
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ToolFallbackContent, { appearance: "thread", children: [
|
|
814
|
+
children,
|
|
815
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolFallbackArgs, { argsText }),
|
|
816
|
+
children == null ? /* @__PURE__ */ jsxRuntime.jsx(ToolFallbackResult, { result, classification }) : null,
|
|
817
|
+
toolName && !isRunning ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end px-3 pt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
818
|
+
primitives.CopyToolSpecButton,
|
|
819
|
+
{
|
|
820
|
+
toolName,
|
|
821
|
+
args,
|
|
822
|
+
result,
|
|
823
|
+
className: "px-0 pb-0"
|
|
824
|
+
}
|
|
825
|
+
) }) : null
|
|
826
|
+
] })
|
|
827
|
+
]
|
|
828
|
+
}
|
|
829
|
+
);
|
|
830
|
+
}
|
|
831
|
+
function ToolFallbackAppearanceProvider({
|
|
832
|
+
appearance,
|
|
833
|
+
children
|
|
834
|
+
}) {
|
|
835
|
+
const value = react.useMemo(
|
|
836
|
+
() => ({
|
|
837
|
+
appearance,
|
|
838
|
+
ToolCard: appearance === "thread" ? ThreadToolCard : void 0
|
|
839
|
+
}),
|
|
840
|
+
[appearance]
|
|
841
|
+
);
|
|
842
|
+
return /* @__PURE__ */ jsxRuntime.jsx(toolAppearance.ToolAppearanceContext.Provider, { value, children });
|
|
843
|
+
}
|
|
648
844
|
const ToolFallback = react.memo(
|
|
649
845
|
ToolFallbackImpl
|
|
650
846
|
);
|
|
@@ -656,7 +852,9 @@ ToolFallback.Args = ToolFallbackArgs;
|
|
|
656
852
|
ToolFallback.Result = ToolFallbackResult;
|
|
657
853
|
ToolFallback.Error = ToolFallbackError;
|
|
658
854
|
ToolFallback.Notice = ToolFallbackNotice;
|
|
855
|
+
exports.useToolAppearance = toolAppearance.useToolAppearance;
|
|
659
856
|
exports.ToolFallback = ToolFallback;
|
|
857
|
+
exports.ToolFallbackAppearanceProvider = ToolFallbackAppearanceProvider;
|
|
660
858
|
exports.ToolFallbackArgs = ToolFallbackArgs;
|
|
661
859
|
exports.ToolFallbackContent = ToolFallbackContent;
|
|
662
860
|
exports.ToolFallbackError = ToolFallbackError;
|