@flanksource/clicky-ui 0.3.25 → 0.3.27
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/NOTICE.md +1 -0
- package/dist/ai.cjs +4 -0
- package/dist/ai.cjs.map +1 -1
- package/dist/ai.js +6 -2
- package/dist/ai.js.map +1 -1
- package/dist/chat.cjs +8 -0
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.js +9 -1
- package/dist/chat.js.map +1 -1
- package/dist/comments/CommentCard.cjs +89 -14
- package/dist/comments/CommentCard.cjs.map +1 -1
- package/dist/comments/CommentCard.d.ts.map +1 -1
- package/dist/comments/CommentCard.js +90 -15
- package/dist/comments/CommentCard.js.map +1 -1
- package/dist/comments/CommentComposer.cjs +25 -2
- package/dist/comments/CommentComposer.cjs.map +1 -1
- package/dist/comments/CommentComposer.d.ts.map +1 -1
- package/dist/comments/CommentComposer.js +25 -2
- package/dist/comments/CommentComposer.js.map +1 -1
- package/dist/comments/CommentProvider.cjs +21 -14
- package/dist/comments/CommentProvider.cjs.map +1 -1
- package/dist/comments/CommentProvider.d.ts +1 -1
- package/dist/comments/CommentProvider.d.ts.map +1 -1
- package/dist/comments/CommentProvider.js +21 -14
- package/dist/comments/CommentProvider.js.map +1 -1
- package/dist/comments/CommentSidePanel.cjs +1 -1
- package/dist/comments/CommentSidePanel.cjs.map +1 -1
- package/dist/comments/CommentSidePanel.js +1 -1
- package/dist/comments/CommentSidePanel.js.map +1 -1
- package/dist/comments/comment-types.cjs.map +1 -1
- package/dist/comments/comment-types.d.ts +6 -0
- package/dist/comments/comment-types.d.ts.map +1 -1
- package/dist/comments/comment-types.js.map +1 -1
- package/dist/components/DimensionField.cjs +56 -0
- package/dist/components/DimensionField.cjs.map +1 -0
- package/dist/components/DimensionField.d.ts +17 -0
- package/dist/components/DimensionField.d.ts.map +1 -0
- package/dist/components/DimensionField.js +56 -0
- package/dist/components/DimensionField.js.map +1 -0
- package/dist/components.cjs +4 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.ts +2 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +4 -0
- package/dist/components.js.map +1 -1
- package/dist/data/Clicky.cjs +4 -5
- package/dist/data/Clicky.cjs.map +1 -1
- package/dist/data/Clicky.d.ts.map +1 -1
- package/dist/data/Clicky.js +4 -5
- package/dist/data/Clicky.js.map +1 -1
- package/dist/data/FixtureEditor/fixture-frontmatter.cjs +4 -0
- package/dist/data/FixtureEditor/fixture-frontmatter.cjs.map +1 -1
- package/dist/data/FixtureEditor/fixture-frontmatter.d.ts.map +1 -1
- package/dist/data/FixtureEditor/fixture-frontmatter.js +4 -0
- package/dist/data/FixtureEditor/fixture-frontmatter.js.map +1 -1
- package/dist/data/TaskExecDetails.cjs +8 -3
- package/dist/data/TaskExecDetails.cjs.map +1 -1
- package/dist/data/TaskExecDetails.d.ts +4 -0
- package/dist/data/TaskExecDetails.d.ts.map +1 -1
- package/dist/data/TaskExecDetails.js +9 -4
- package/dist/data/TaskExecDetails.js.map +1 -1
- package/dist/data/TaskManagerButton.cjs +101 -7
- package/dist/data/TaskManagerButton.cjs.map +1 -1
- package/dist/data/TaskManagerButton.d.ts +6 -1
- package/dist/data/TaskManagerButton.d.ts.map +1 -1
- package/dist/data/TaskManagerButton.js +103 -9
- package/dist/data/TaskManagerButton.js.map +1 -1
- package/dist/data/TaskProcessDetails.cjs +2 -0
- package/dist/data/TaskProcessDetails.cjs.map +1 -1
- package/dist/data/TaskProcessDetails.d.ts.map +1 -1
- package/dist/data/TaskProcessDetails.js +2 -0
- package/dist/data/TaskProcessDetails.js.map +1 -1
- package/dist/data/TaskProgress.cjs +14 -4
- package/dist/data/TaskProgress.cjs.map +1 -1
- package/dist/data/TaskProgress.js +14 -4
- package/dist/data/TaskProgress.js.map +1 -1
- package/dist/data/TaskSnapshot.cjs.map +1 -1
- package/dist/data/TaskSnapshot.d.ts +1 -0
- package/dist/data/TaskSnapshot.d.ts.map +1 -1
- package/dist/data/TaskSnapshot.js.map +1 -1
- package/dist/data/ai/ChatWindow.cjs +18 -23
- package/dist/data/ai/ChatWindow.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.d.ts +1 -1
- package/dist/data/ai/ChatWindow.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.js +19 -24
- package/dist/data/ai/ChatWindow.js.map +1 -1
- package/dist/data/ai/ChatWindow.preferences.cjs +12 -21
- package/dist/data/ai/ChatWindow.preferences.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.preferences.d.ts +3 -2
- package/dist/data/ai/ChatWindow.preferences.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.preferences.js +12 -21
- package/dist/data/ai/ChatWindow.preferences.js.map +1 -1
- package/dist/data/ai/ChatWindow.tool-catalog.cjs +21 -38
- package/dist/data/ai/ChatWindow.tool-catalog.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.tool-catalog.d.ts +5 -5
- package/dist/data/ai/ChatWindow.tool-catalog.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.tool-catalog.js +21 -38
- package/dist/data/ai/ChatWindow.tool-catalog.js.map +1 -1
- package/dist/data/ai/ChatWindow.types.d.ts +2 -2
- package/dist/data/ai/ChatWindow.types.d.ts.map +1 -1
- package/dist/data/ai/ChatWindowManager.cjs +2 -2
- package/dist/data/ai/ChatWindowManager.cjs.map +1 -1
- package/dist/data/ai/ChatWindowManager.js +2 -2
- package/dist/data/ai/ChatWindowManager.js.map +1 -1
- package/dist/data/ai/ChatWindowRequestBody.cjs +4 -2
- package/dist/data/ai/ChatWindowRequestBody.cjs.map +1 -1
- package/dist/data/ai/ChatWindowRequestBody.d.ts +15 -3
- package/dist/data/ai/ChatWindowRequestBody.d.ts.map +1 -1
- package/dist/data/ai/ChatWindowRequestBody.js +4 -2
- package/dist/data/ai/ChatWindowRequestBody.js.map +1 -1
- package/dist/data/ai/PromptRunEditor/index.cjs +2 -3
- package/dist/data/ai/PromptRunEditor/index.cjs.map +1 -1
- package/dist/data/ai/PromptRunEditor/index.d.ts.map +1 -1
- package/dist/data/ai/PromptRunEditor/index.js +2 -3
- package/dist/data/ai/PromptRunEditor/index.js.map +1 -1
- package/dist/data/ai/PromptRunEditor/model.cjs +1 -0
- package/dist/data/ai/PromptRunEditor/model.cjs.map +1 -1
- package/dist/data/ai/PromptRunEditor/model.d.ts +1 -1
- package/dist/data/ai/PromptRunEditor/model.d.ts.map +1 -1
- package/dist/data/ai/PromptRunEditor/model.js +1 -0
- package/dist/data/ai/PromptRunEditor/model.js.map +1 -1
- package/dist/data/ai/RuntimeModePicker.cjs +11 -9
- package/dist/data/ai/RuntimeModePicker.cjs.map +1 -1
- package/dist/data/ai/RuntimeModePicker.d.ts.map +1 -1
- package/dist/data/ai/RuntimeModePicker.js +12 -10
- package/dist/data/ai/RuntimeModePicker.js.map +1 -1
- package/dist/data/ai/SpecRuntimeEditor/ModelSection.cjs +5 -0
- package/dist/data/ai/SpecRuntimeEditor/ModelSection.cjs.map +1 -1
- package/dist/data/ai/SpecRuntimeEditor/ModelSection.d.ts.map +1 -1
- package/dist/data/ai/SpecRuntimeEditor/ModelSection.js +5 -0
- package/dist/data/ai/SpecRuntimeEditor/ModelSection.js.map +1 -1
- package/dist/data/ai/SpecRuntimeEditor.model.cjs +4 -0
- package/dist/data/ai/SpecRuntimeEditor.model.cjs.map +1 -1
- package/dist/data/ai/SpecRuntimeEditor.model.d.ts +2 -0
- package/dist/data/ai/SpecRuntimeEditor.model.d.ts.map +1 -1
- package/dist/data/ai/SpecRuntimeEditor.model.js +4 -0
- package/dist/data/ai/SpecRuntimeEditor.model.js.map +1 -1
- package/dist/data/ai/ToolPreferences.cjs +5 -5
- package/dist/data/ai/ToolPreferences.cjs.map +1 -1
- package/dist/data/ai/ToolPreferences.d.ts +6 -5
- package/dist/data/ai/ToolPreferences.d.ts.map +1 -1
- package/dist/data/ai/ToolPreferences.js +5 -5
- package/dist/data/ai/ToolPreferences.js.map +1 -1
- package/dist/data/ai/ToolPreferences.model.cjs +61 -37
- package/dist/data/ai/ToolPreferences.model.cjs.map +1 -1
- package/dist/data/ai/ToolPreferences.model.d.ts +32 -13
- package/dist/data/ai/ToolPreferences.model.d.ts.map +1 -1
- package/dist/data/ai/ToolPreferences.model.js +62 -38
- package/dist/data/ai/ToolPreferences.model.js.map +1 -1
- package/dist/data/ai/ToolPreferencesList.cjs +17 -20
- package/dist/data/ai/ToolPreferencesList.cjs.map +1 -1
- package/dist/data/ai/ToolPreferencesList.d.ts +16 -7
- package/dist/data/ai/ToolPreferencesList.d.ts.map +1 -1
- package/dist/data/ai/ToolPreferencesList.js +18 -21
- package/dist/data/ai/ToolPreferencesList.js.map +1 -1
- package/dist/data/ai/chat-window-context.cjs +1 -1
- package/dist/data/ai/chat-window-context.cjs.map +1 -1
- package/dist/data/ai/chat-window-context.d.ts +7 -7
- package/dist/data/ai/chat-window-context.d.ts.map +1 -1
- package/dist/data/ai/chat-window-context.js +1 -1
- package/dist/data/ai/chat-window-context.js.map +1 -1
- package/dist/data/ai/index.d.ts +3 -1
- package/dist/data/ai/index.d.ts.map +1 -1
- package/dist/data/chat/Chat.cjs +4 -2
- package/dist/data/chat/Chat.cjs.map +1 -1
- package/dist/data/chat/Chat.d.ts.map +1 -1
- package/dist/data/chat/Chat.js +4 -2
- package/dist/data/chat/Chat.js.map +1 -1
- package/dist/data/chat/Chat.runtime.cjs +14 -3
- package/dist/data/chat/Chat.runtime.cjs.map +1 -1
- package/dist/data/chat/Chat.runtime.d.ts.map +1 -1
- package/dist/data/chat/Chat.runtime.js +15 -4
- package/dist/data/chat/Chat.runtime.js.map +1 -1
- package/dist/data/chat/clickyOperationsToTools.cjs +2 -1
- package/dist/data/chat/clickyOperationsToTools.cjs.map +1 -1
- package/dist/data/chat/clickyOperationsToTools.d.ts.map +1 -1
- package/dist/data/chat/clickyOperationsToTools.js +2 -1
- package/dist/data/chat/clickyOperationsToTools.js.map +1 -1
- package/dist/data/chat/index.d.ts +2 -1
- package/dist/data/chat/index.d.ts.map +1 -1
- package/dist/data/chat/tool-policy.cjs +132 -0
- package/dist/data/chat/tool-policy.cjs.map +1 -0
- package/dist/data/chat/tool-policy.d.ts +81 -0
- package/dist/data/chat/tool-policy.d.ts.map +1 -0
- package/dist/data/chat/tool-policy.js +132 -0
- package/dist/data/chat/tool-policy.js.map +1 -0
- package/dist/data/chat/types.cjs +20 -0
- package/dist/data/chat/types.cjs.map +1 -1
- package/dist/data/chat/types.d.ts +22 -2
- package/dist/data/chat/types.d.ts.map +1 -1
- package/dist/data/chat/types.js +20 -0
- package/dist/data/chat/types.js.map +1 -1
- package/dist/data/debugConsoleSignal.cjs +64 -0
- package/dist/data/debugConsoleSignal.cjs.map +1 -0
- package/dist/data/debugConsoleSignal.d.ts +83 -0
- package/dist/data/debugConsoleSignal.d.ts.map +1 -0
- package/dist/data/debugConsoleSignal.js +64 -0
- package/dist/data/debugConsoleSignal.js.map +1 -0
- package/dist/data/har/HarPanel.cjs +20 -14
- package/dist/data/har/HarPanel.cjs.map +1 -1
- package/dist/data/har/HarPanel.d.ts.map +1 -1
- package/dist/data/har/HarPanel.js +20 -14
- package/dist/data/har/HarPanel.js.map +1 -1
- package/dist/data/har/types.d.ts +18 -0
- package/dist/data/har/types.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.cjs +4 -42
- package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.js +5 -43
- package/dist/data/query-browser/QueryBrowser.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.d.ts +0 -1
- package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.js.map +1 -1
- package/dist/data/runtime/RuntimeBar.cjs +26 -41
- package/dist/data/runtime/RuntimeBar.cjs.map +1 -1
- package/dist/data/runtime/RuntimeBar.d.ts.map +1 -1
- package/dist/data/runtime/RuntimeBar.js +28 -43
- package/dist/data/runtime/RuntimeBar.js.map +1 -1
- package/dist/data/runtime/RuntimeBar.model.cjs +65 -0
- package/dist/data/runtime/RuntimeBar.model.cjs.map +1 -1
- package/dist/data/runtime/RuntimeBar.model.d.ts +11 -3
- package/dist/data/runtime/RuntimeBar.model.d.ts.map +1 -1
- package/dist/data/runtime/RuntimeBar.model.js +65 -0
- package/dist/data/runtime/RuntimeBar.model.js.map +1 -1
- package/dist/data/runtime/model-capabilities.cjs +8 -5
- package/dist/data/runtime/model-capabilities.cjs.map +1 -1
- package/dist/data/runtime/model-capabilities.d.ts +6 -1
- package/dist/data/runtime/model-capabilities.d.ts.map +1 -1
- package/dist/data/runtime/model-capabilities.js +8 -5
- package/dist/data/runtime/model-capabilities.js.map +1 -1
- package/dist/data/runtime/runtime-mode.cjs +17 -0
- package/dist/data/runtime/runtime-mode.cjs.map +1 -1
- package/dist/data/runtime/runtime-mode.d.ts +6 -0
- package/dist/data/runtime/runtime-mode.d.ts.map +1 -1
- package/dist/data/runtime/runtime-mode.js +17 -0
- package/dist/data/runtime/runtime-mode.js.map +1 -1
- package/dist/data/useDebugAction.cjs +29 -0
- package/dist/data/useDebugAction.cjs.map +1 -0
- package/dist/data/useDebugAction.d.ts +16 -0
- package/dist/data/useDebugAction.d.ts.map +1 -0
- package/dist/data/useDebugAction.js +29 -0
- package/dist/data/useDebugAction.js.map +1 -0
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/data.cjs +16 -8
- package/dist/data.cjs.map +1 -1
- package/dist/data.d.ts +3 -2
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +16 -8
- package/dist/devtools/DebugConsole.cjs +138 -0
- package/dist/devtools/DebugConsole.cjs.map +1 -0
- package/dist/devtools/DebugConsole.d.ts +23 -0
- package/dist/devtools/DebugConsole.d.ts.map +1 -0
- package/dist/devtools/DebugConsole.js +138 -0
- package/dist/devtools/DebugConsole.js.map +1 -0
- package/dist/devtools/DebugConsoleButton.cjs +59 -0
- package/dist/devtools/DebugConsoleButton.cjs.map +1 -0
- package/dist/devtools/DebugConsoleButton.d.ts +20 -0
- package/dist/devtools/DebugConsoleButton.d.ts.map +1 -0
- package/dist/devtools/DebugConsoleButton.js +59 -0
- package/dist/devtools/DebugConsoleButton.js.map +1 -0
- package/dist/devtools/DebugConsoleDock.cjs +112 -0
- package/dist/devtools/DebugConsoleDock.cjs.map +1 -0
- package/dist/devtools/DebugConsoleDock.d.ts +26 -0
- package/dist/devtools/DebugConsoleDock.d.ts.map +1 -0
- package/dist/devtools/DebugConsoleDock.js +112 -0
- package/dist/devtools/DebugConsoleDock.js.map +1 -0
- package/dist/devtools/ExecutionDetail.cjs +135 -0
- package/dist/devtools/ExecutionDetail.cjs.map +1 -0
- package/dist/devtools/ExecutionDetail.d.ts +19 -0
- package/dist/devtools/ExecutionDetail.d.ts.map +1 -0
- package/dist/devtools/ExecutionDetail.js +135 -0
- package/dist/devtools/ExecutionDetail.js.map +1 -0
- package/dist/devtools/debugClient.cjs +172 -0
- package/dist/devtools/debugClient.cjs.map +1 -0
- package/dist/devtools/debugClient.d.ts +98 -0
- package/dist/devtools/debugClient.d.ts.map +1 -0
- package/dist/devtools/debugClient.js +172 -0
- package/dist/devtools/debugClient.js.map +1 -0
- package/dist/devtools/debugStore.cjs +115 -0
- package/dist/devtools/debugStore.cjs.map +1 -0
- package/dist/devtools/debugStore.d.ts +83 -0
- package/dist/devtools/debugStore.d.ts.map +1 -0
- package/dist/devtools/debugStore.js +115 -0
- package/dist/devtools/debugStore.js.map +1 -0
- package/dist/devtools/dockState.cjs +51 -0
- package/dist/devtools/dockState.cjs.map +1 -0
- package/dist/devtools/dockState.d.ts +31 -0
- package/dist/devtools/dockState.d.ts.map +1 -0
- package/dist/devtools/dockState.js +51 -0
- package/dist/devtools/dockState.js.map +1 -0
- package/dist/devtools/tabs/ConsoleTab.cjs +36 -0
- package/dist/devtools/tabs/ConsoleTab.cjs.map +1 -0
- package/dist/devtools/tabs/ConsoleTab.d.ts +19 -0
- package/dist/devtools/tabs/ConsoleTab.d.ts.map +1 -0
- package/dist/devtools/tabs/ConsoleTab.js +36 -0
- package/dist/devtools/tabs/ConsoleTab.js.map +1 -0
- package/dist/devtools/tabs/InspectionCaches.cjs +150 -0
- package/dist/devtools/tabs/InspectionCaches.cjs.map +1 -0
- package/dist/devtools/tabs/InspectionCaches.d.ts +23 -0
- package/dist/devtools/tabs/InspectionCaches.d.ts.map +1 -0
- package/dist/devtools/tabs/InspectionCaches.js +150 -0
- package/dist/devtools/tabs/InspectionCaches.js.map +1 -0
- package/dist/devtools/tabs/InspectionTab.cjs +316 -0
- package/dist/devtools/tabs/InspectionTab.cjs.map +1 -0
- package/dist/devtools/tabs/InspectionTab.d.ts +27 -0
- package/dist/devtools/tabs/InspectionTab.d.ts.map +1 -0
- package/dist/devtools/tabs/InspectionTab.js +316 -0
- package/dist/devtools/tabs/InspectionTab.js.map +1 -0
- package/dist/devtools/tabs/NetworkTab.cjs +91 -0
- package/dist/devtools/tabs/NetworkTab.cjs.map +1 -0
- package/dist/devtools/tabs/NetworkTab.d.ts +20 -0
- package/dist/devtools/tabs/NetworkTab.d.ts.map +1 -0
- package/dist/devtools/tabs/NetworkTab.js +91 -0
- package/dist/devtools/tabs/NetworkTab.js.map +1 -0
- package/dist/devtools/tabs/QueriesTab.cjs +85 -0
- package/dist/devtools/tabs/QueriesTab.cjs.map +1 -0
- package/dist/devtools/tabs/QueriesTab.d.ts +24 -0
- package/dist/devtools/tabs/QueriesTab.d.ts.map +1 -0
- package/dist/devtools/tabs/QueriesTab.js +85 -0
- package/dist/devtools/tabs/QueriesTab.js.map +1 -0
- package/dist/devtools/types.cjs +26 -0
- package/dist/devtools/types.cjs.map +1 -0
- package/dist/devtools/types.d.ts +235 -0
- package/dist/devtools/types.d.ts.map +1 -0
- package/dist/devtools/types.js +26 -0
- package/dist/devtools/types.js.map +1 -0
- package/dist/devtools/useDebugStream.cjs +46 -0
- package/dist/devtools/useDebugStream.cjs.map +1 -0
- package/dist/devtools/useDebugStream.d.ts +23 -0
- package/dist/devtools/useDebugStream.d.ts.map +1 -0
- package/dist/devtools/useDebugStream.js +46 -0
- package/dist/devtools/useDebugStream.js.map +1 -0
- package/dist/devtools.cjs +51 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.d.ts +37 -0
- package/dist/devtools.d.ts.map +1 -0
- package/dist/devtools.js +51 -0
- package/dist/devtools.js.map +1 -0
- package/dist/icons/components/UiOpenScad.cjs +10 -0
- package/dist/icons/components/UiOpenScad.cjs.map +1 -0
- package/dist/icons/components/UiOpenScad.d.ts +9 -0
- package/dist/icons/components/UiOpenScad.d.ts.map +1 -0
- package/dist/icons/components/UiOpenScad.js +10 -0
- package/dist/icons/components/UiOpenScad.js.map +1 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/registry.cjs +2 -0
- package/dist/icons/registry.cjs.map +1 -1
- package/dist/icons/registry.d.ts.map +1 -1
- package/dist/icons/registry.js +2 -0
- package/dist/icons/registry.js.map +1 -1
- package/dist/icons.cjs +2 -0
- package/dist/icons.cjs.map +1 -1
- package/dist/icons.js +2 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.cjs +20 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/layout/AppShell.cjs +15 -10
- package/dist/layout/AppShell.cjs.map +1 -1
- package/dist/layout/AppShell.d.ts +11 -0
- package/dist/layout/AppShell.d.ts.map +1 -1
- package/dist/layout/AppShell.js +15 -10
- package/dist/layout/AppShell.js.map +1 -1
- package/dist/layout/AppShell.nav.cjs +170 -49
- package/dist/layout/AppShell.nav.cjs.map +1 -1
- package/dist/layout/AppShell.nav.d.ts.map +1 -1
- package/dist/layout/AppShell.nav.js +170 -49
- package/dist/layout/AppShell.nav.js.map +1 -1
- package/dist/overlay/CellActions.cjs +18 -124
- package/dist/overlay/CellActions.cjs.map +1 -1
- package/dist/overlay/CellActions.d.ts +1 -1
- package/dist/overlay/CellActions.d.ts.map +1 -1
- package/dist/overlay/CellActions.js +18 -124
- package/dist/overlay/CellActions.js.map +1 -1
- package/dist/overlay/ContextMenu.cjs +144 -0
- package/dist/overlay/ContextMenu.cjs.map +1 -0
- package/dist/overlay/ContextMenu.d.ts +8 -0
- package/dist/overlay/ContextMenu.d.ts.map +1 -0
- package/dist/overlay/ContextMenu.js +144 -0
- package/dist/overlay/ContextMenu.js.map +1 -0
- package/dist/profiles/connections/connectionBrowserModel.cjs +14 -65
- package/dist/profiles/connections/connectionBrowserModel.cjs.map +1 -1
- package/dist/profiles/connections/connectionBrowserModel.d.ts +35 -35
- package/dist/profiles/connections/connectionBrowserModel.d.ts.map +1 -1
- package/dist/profiles/connections/connectionBrowserModel.js +14 -65
- package/dist/profiles/connections/connectionBrowserModel.js.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.cjs +29 -9
- package/dist/profiles/connections/connectionQueryWorkspace.cjs.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.d.ts +3 -2
- package/dist/profiles/connections/connectionQueryWorkspace.d.ts.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.js +30 -10
- package/dist/profiles/connections/connectionQueryWorkspace.js.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspaceModel.cjs +15 -0
- package/dist/profiles/connections/connectionQueryWorkspaceModel.cjs.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspaceModel.d.ts +22 -1
- package/dist/profiles/connections/connectionQueryWorkspaceModel.d.ts.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspaceModel.js +15 -0
- package/dist/profiles/connections/connectionQueryWorkspaceModel.js.map +1 -1
- package/dist/profiles/connections/index.d.ts +1 -0
- package/dist/profiles/connections/index.d.ts.map +1 -1
- package/dist/profiles/connections/inspectionStatus.cjs +44 -0
- package/dist/profiles/connections/inspectionStatus.cjs.map +1 -0
- package/dist/profiles/connections/inspectionStatus.d.ts +5 -0
- package/dist/profiles/connections/inspectionStatus.d.ts.map +1 -0
- package/dist/profiles/connections/inspectionStatus.js +44 -0
- package/dist/profiles/connections/inspectionStatus.js.map +1 -0
- package/dist/profiles/connections/useInspection.cjs +123 -0
- package/dist/profiles/connections/useInspection.cjs.map +1 -0
- package/dist/profiles/connections/useInspection.d.ts +35 -0
- package/dist/profiles/connections/useInspection.d.ts.map +1 -0
- package/dist/profiles/connections/useInspection.js +123 -0
- package/dist/profiles/connections/useInspection.js.map +1 -0
- package/dist/profiles/editor/profileBuilderWorkspace.cjs +55 -23
- package/dist/profiles/editor/profileBuilderWorkspace.cjs.map +1 -1
- package/dist/profiles/editor/profileBuilderWorkspace.d.ts.map +1 -1
- package/dist/profiles/editor/profileBuilderWorkspace.js +56 -24
- package/dist/profiles/editor/profileBuilderWorkspace.js.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilder.cjs +12 -3
- package/dist/profiles/elasticsearch/esQueryBuilder.cjs.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilder.d.ts +2 -2
- package/dist/profiles/elasticsearch/esQueryBuilder.d.ts.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilder.js +12 -3
- package/dist/profiles/elasticsearch/esQueryBuilder.js.map +1 -1
- package/dist/profiles/fields/profileFieldEditor.cjs +137 -22
- package/dist/profiles/fields/profileFieldEditor.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldEditor.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldEditor.js +137 -22
- package/dist/profiles/fields/profileFieldEditor.js.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.cjs +171 -82
- package/dist/profiles/fields/profileFieldFilterEditor.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.d.ts +0 -9
- package/dist/profiles/fields/profileFieldFilterEditor.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.js +174 -85
- package/dist/profiles/fields/profileFieldFilterEditor.js.map +1 -1
- package/dist/profiles/fields/profileFieldIcons.cjs +6 -3
- package/dist/profiles/fields/profileFieldIcons.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldIcons.js +6 -3
- package/dist/profiles/fields/profileFieldIcons.js.map +1 -1
- package/dist/profiles/query/profileSampleFilterLookup.cjs +34 -0
- package/dist/profiles/query/profileSampleFilterLookup.cjs.map +1 -0
- package/dist/profiles/query/profileSampleFilterLookup.d.ts +12 -0
- package/dist/profiles/query/profileSampleFilterLookup.d.ts.map +1 -0
- package/dist/profiles/query/profileSampleFilterLookup.js +34 -0
- package/dist/profiles/query/profileSampleFilterLookup.js.map +1 -0
- package/dist/profiles/query/profileSamplePayload.cjs +6 -4
- package/dist/profiles/query/profileSamplePayload.cjs.map +1 -1
- package/dist/profiles/query/profileSamplePayload.d.ts +11 -4
- package/dist/profiles/query/profileSamplePayload.d.ts.map +1 -1
- package/dist/profiles/query/profileSamplePayload.js +6 -4
- package/dist/profiles/query/profileSamplePayload.js.map +1 -1
- package/dist/profiles/query/profileSampleResult.cjs +26 -0
- package/dist/profiles/query/profileSampleResult.cjs.map +1 -0
- package/dist/profiles/query/profileSampleResult.d.ts +11 -0
- package/dist/profiles/query/profileSampleResult.d.ts.map +1 -0
- package/dist/profiles/query/profileSampleResult.js +26 -0
- package/dist/profiles/query/profileSampleResult.js.map +1 -0
- package/dist/profiles/query/queryTargetPicker.cjs +5 -3
- package/dist/profiles/query/queryTargetPicker.cjs.map +1 -1
- package/dist/profiles/query/queryTargetPicker.d.ts +3 -2
- package/dist/profiles/query/queryTargetPicker.d.ts.map +1 -1
- package/dist/profiles/query/queryTargetPicker.js +5 -3
- package/dist/profiles/query/queryTargetPicker.js.map +1 -1
- package/dist/profiles/wizard/profileWizard.cjs +14 -5
- package/dist/profiles/wizard/profileWizard.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizard.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizard.js +15 -6
- package/dist/profiles/wizard/profileWizard.js.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.cjs +35 -6
- package/dist/profiles/wizard/profileWizardModel.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.d.ts +29 -4
- package/dist/profiles/wizard/profileWizardModel.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.js +35 -6
- package/dist/profiles/wizard/profileWizardModel.js.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.cjs +44 -11
- package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.js +46 -13
- package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
- package/dist/profiles/wizard/profileWizardSteps.cjs +33 -2
- package/dist/profiles/wizard/profileWizardSteps.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardSteps.d.ts +11 -2
- package/dist/profiles/wizard/profileWizardSteps.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardSteps.js +33 -2
- package/dist/profiles/wizard/profileWizardSteps.js.map +1 -1
- package/dist/profiles.cjs +8 -2
- package/dist/profiles.cjs.map +1 -1
- package/dist/profiles.js +10 -4
- package/dist/profiles.js.map +1 -1
- package/dist/rpc/FilterForm.cjs +21 -237
- package/dist/rpc/FilterForm.cjs.map +1 -1
- package/dist/rpc/FilterForm.d.ts +3 -1
- package/dist/rpc/FilterForm.d.ts.map +1 -1
- package/dist/rpc/FilterForm.js +21 -237
- package/dist/rpc/FilterForm.js.map +1 -1
- package/dist/rpc/FilterFormFields.cjs +240 -0
- package/dist/rpc/FilterFormFields.cjs.map +1 -0
- package/dist/rpc/FilterFormFields.d.ts +12 -0
- package/dist/rpc/FilterFormFields.d.ts.map +1 -0
- package/dist/rpc/FilterFormFields.js +240 -0
- package/dist/rpc/FilterFormFields.js.map +1 -0
- package/dist/rpc/router.cjs +3 -2
- package/dist/rpc/router.cjs.map +1 -1
- package/dist/rpc/router.d.ts.map +1 -1
- package/dist/rpc/router.js +3 -2
- package/dist/rpc/router.js.map +1 -1
- package/dist/rpc/types.cjs.map +1 -1
- package/dist/rpc/types.d.ts +3 -1
- package/dist/rpc/types.d.ts.map +1 -1
- package/dist/rpc/types.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -1
- package/dist/data/query-info/QueryInfoDialog.cjs +0 -106
- package/dist/data/query-info/QueryInfoDialog.cjs.map +0 -1
- package/dist/data/query-info/QueryInfoDialog.d.ts +0 -16
- package/dist/data/query-info/QueryInfoDialog.d.ts.map +0 -1
- package/dist/data/query-info/QueryInfoDialog.js +0 -106
- package/dist/data/query-info/QueryInfoDialog.js.map +0 -1
- package/dist/data/query-info/index.d.ts +0 -4
- package/dist/data/query-info/index.d.ts.map +0 -1
- package/dist/data/query-info/queryInfo.cjs +0 -42
- package/dist/data/query-info/queryInfo.cjs.map +0 -1
- package/dist/data/query-info/queryInfo.d.ts +0 -45
- package/dist/data/query-info/queryInfo.d.ts.map +0 -1
- package/dist/data/query-info/queryInfo.js +0 -42
- package/dist/data/query-info/queryInfo.js.map +0 -1
- package/dist/data/query-info/useQueryInfo.cjs +0 -48
- package/dist/data/query-info/useQueryInfo.cjs.map +0 -1
- package/dist/data/query-info/useQueryInfo.d.ts +0 -26
- package/dist/data/query-info/useQueryInfo.d.ts.map +0 -1
- package/dist/data/query-info/useQueryInfo.js +0 -48
- package/dist/data/query-info/useQueryInfo.js.map +0 -1
package/dist/data/chat/types.cjs
CHANGED
|
@@ -52,6 +52,25 @@ const CLAUDE_PERMISSION_MODE_OPTIONS = [
|
|
|
52
52
|
description: "Bypass permission checks when explicitly allowed by the host."
|
|
53
53
|
}
|
|
54
54
|
];
|
|
55
|
+
function normalizeToolPolicy(value) {
|
|
56
|
+
if (typeof value !== "string") return void 0;
|
|
57
|
+
switch (value.trim().toLowerCase()) {
|
|
58
|
+
case "allow":
|
|
59
|
+
case "on":
|
|
60
|
+
case "enabled":
|
|
61
|
+
return "allow";
|
|
62
|
+
case "ask":
|
|
63
|
+
return "ask";
|
|
64
|
+
case "deny":
|
|
65
|
+
case "off":
|
|
66
|
+
case "disabled":
|
|
67
|
+
return "deny";
|
|
68
|
+
case "auto":
|
|
69
|
+
return "auto";
|
|
70
|
+
default:
|
|
71
|
+
return void 0;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
55
74
|
function isDynamicToolPart(part) {
|
|
56
75
|
return part.type === "dynamic-tool";
|
|
57
76
|
}
|
|
@@ -70,6 +89,7 @@ exports.isDynamicToolPart = isDynamicToolPart;
|
|
|
70
89
|
exports.isFilePart = isFilePart;
|
|
71
90
|
exports.isReasoningPart = isReasoningPart;
|
|
72
91
|
exports.isTypedToolPart = isTypedToolPart;
|
|
92
|
+
exports.normalizeToolPolicy = normalizeToolPolicy;
|
|
73
93
|
exports.suggestionLabel = suggestionLabel;
|
|
74
94
|
exports.suggestionPrompt = suggestionPrompt;
|
|
75
95
|
exports.toolPartName = toolPartName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sources":["../../../src/data/chat/types.ts"],"sourcesContent":["import type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n} from \"ai\";\nimport type { ReactNode } from \"react\";\nimport type {\n JsonSchemaObject,\n JsonSchemaProperty as FormJsonSchemaProperty,\n} from \"../../components/json-schema-form-types\";\n\nexport type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n};\n\n/** A selectable chat model, as served by the backend's GET /api/chat/models.\n * `configured` is false for catalogued models whose provider has no API key. */\nexport interface ChatModelRuntime {\n model?: string;\n id?: string;\n backend?: string;\n mode?: string;\n temperature?: number;\n effort?: string;\n noCache?: boolean;\n fallbacks?: ChatModelRuntime[];\n}\n\nexport type RuntimeAvailabilityState =\n | \"available\"\n | \"disabled\"\n | \"missing_credentials\"\n | \"not_authenticated\"\n | \"missing_executable\"\n | \"missing_dependency\"\n | \"unsupported\"\n | \"unavailable\";\n\nexport interface RuntimeAvailability {\n state: RuntimeAvailabilityState;\n reason?: string;\n remediation?: string;\n}\n\nexport interface ChatModel {\n id: string;\n provider: string;\n label: string;\n /** Exact Captain Model wire value submitted when this display row is selected. */\n runtime?: ChatModelRuntime;\n reasoning: boolean;\n /** True when backend metadata is authoritative, including explicit unsupported values. */\n capabilitiesKnown?: boolean;\n /** Ordered reasoning-effort tiers accepted by this exact model. */\n supportedEfforts?: string[];\n /** Backend-recommended effort used when the current selection is invalid. */\n defaultEffort?: string;\n /** Whether the model honours the temperature sampling control. */\n temperature?: boolean;\n configured?: boolean;\n availability?: RuntimeAvailability;\n /**\n * The catalog's own declared default — the row a picker seeds with when the\n * caller names no model. At most one row carries it, and a catalog that\n * declares none (or whose default is unconfigured) falls back to the first\n * configured row.\n */\n default?: boolean;\n /** Concrete runtime backends that advertised this model. Empty/omitted means provider-wide. */\n backends?: string[];\n /** Max context tokens — the denominator for a usage gauge. */\n contextWindow?: number;\n /** MIME patterns accepted as model inputs, e.g. image/* or application/pdf. */\n inputMediaTypes?: string[];\n}\n\n/** Per-message metadata the backend rides on the SSE `finish` part\n * (`messageMetadata`), applied by the AI SDK to the assistant `UIMessage`. */\nexport interface ChatMessageMetadata {\n backend?: string;\n executionMode?: string;\n model?: string;\n captainSessionId?: string;\n providerSessionId?: string;\n threadId?: string;\n turnId?: string;\n success?: boolean;\n interrupted?: boolean;\n usage?: ChatUsageBreakdown;\n costBreakdown?: ChatCostBreakdown;\n /** This turn's cost in USD. */\n cost?: number;\n /** Cumulative thread cost in USD (when the turn is persisted to a thread). */\n threadCostUsd?: number;\n /** This turn's input-token count, ≈ current context-window occupancy. */\n contextTokens?: number;\n}\n\n/** A flattened usage snapshot a chat surfaces for a gauge: tokens used out of the\n * model's context window, plus cumulative cost. */\nexport interface ChatUsageSummary {\n usedTokens: number;\n maxTokens: number;\n cost?: number;\n usage?: ChatUsageBreakdown;\n costBreakdown?: ChatCostBreakdown;\n messageCount: number;\n backend?: string;\n executionMode?: string;\n model?: string;\n captainSessionId?: string;\n providerSessionId?: string;\n threadId?: string;\n turnId?: string;\n success?: boolean;\n interrupted?: boolean;\n /** @deprecated Use `model`; retained for compatibility with existing consumers. */\n modelLabel?: string;\n}\n\nexport interface ChatBudgetConfig {\n /** Per-thread/request cost cap in USD. */\n cost?: number;\n /** Max output tokens for one model call. */\n maxTokens?: number;\n}\n\nexport interface ChatUsageBreakdown {\n inputTokens?: number;\n outputTokens?: number;\n reasoningTokens?: number;\n cacheReadTokens?: number;\n cacheWriteTokens?: number;\n totalTokens?: number;\n}\n\nexport interface ChatCostBreakdown {\n model?: string;\n inputUsd?: number;\n outputUsd?: number;\n reasoningUsd?: number;\n cacheReadUsd?: number;\n cacheWriteUsd?: number;\n totalUsd?: number;\n}\n\n/** A suggested prompt shown on the empty state. A bare string is both the label\n * and the submitted text; the object form separates them. */\nexport type Suggestion = string | { label: string; prompt: string };\n\n/** The label shown for a suggestion. */\nexport function suggestionLabel(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.label;\n}\n\n/** The text submitted when a suggestion is clicked. */\nexport function suggestionPrompt(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.prompt;\n}\n\n/** Returns true for an assistant reasoning (\"thinking\") part. */\nexport function isReasoningPart(part: {\n type: string;\n}): part is ReasoningUIPart {\n return part.type === \"reasoning\";\n}\n\n/** Returns true for a file/attachment part. */\nexport function isFilePart(part: { type: string }): part is FileUIPart {\n return part.type === \"file\";\n}\n\n/** A tool part as it appears in an assistant UIMessage — either a typed\n * `tool-<name>` part or the generic `dynamic-tool` part. clicky operations\n * surface as dynamic tools, so the chat UI renders both shapes. */\nexport type AnyToolPart = ToolUIPart | DynamicToolUIPart;\n\n/** Claude Agent SDK permission modes accepted by `permissionMode`. */\nexport const CLAUDE_PERMISSION_MODES = [\n \"default\",\n \"acceptEdits\",\n \"bypassPermissions\",\n \"plan\",\n \"dontAsk\",\n \"auto\",\n] as const;\n\nexport type ClaudePermissionMode = (typeof CLAUDE_PERMISSION_MODES)[number];\n\nexport type ClaudePermissionModeOption = {\n value: ClaudePermissionMode;\n label: string;\n description: string;\n};\n\nexport const CLAUDE_PERMISSION_MODE_OPTIONS: ClaudePermissionModeOption[] = [\n {\n value: \"default\",\n label: \"Default\",\n description:\n \"Prompt for dangerous operations using standard Claude behavior.\",\n },\n {\n value: \"auto\",\n label: \"Auto\",\n description:\n \"Use Claude's classifier to approve or deny permission prompts.\",\n },\n {\n value: \"acceptEdits\",\n label: \"Accept edits\",\n description: \"Automatically accept file edit operations.\",\n },\n {\n value: \"dontAsk\",\n label: \"Don't ask\",\n description: \"Do not prompt; deny actions that are not pre-approved.\",\n },\n {\n value: \"plan\",\n label: \"Plan\",\n description: \"Planning mode with no tool execution.\",\n },\n {\n value: \"bypassPermissions\",\n label: \"Bypass\",\n description:\n \"Bypass permission checks when explicitly allowed by the host.\",\n },\n];\n\n/** Tool metadata shared by the chat shell. It both configures the\n * tool-preferences popover (`name`/`label`/`group`) and carries the schema\n * derived from a clicky RPC operation (`description`/`inputSchema`). The Go\n * backend owns execution; the client uses this only for display and to scope\n * which tools a request may call (passed in the transport `body`). */\nexport type ToolMode = \"on\" | \"ask\" | \"off\" | \"auto\";\n\nexport interface ToolAnnotations {\n title?: string;\n readOnlyHint?: boolean;\n destructiveHint?: boolean;\n idempotentHint?: boolean;\n openWorldHint?: boolean;\n [key: string]: unknown;\n}\n\nexport interface ToolMeta {\n /** Stable tool name sent to the model (the operation id). */\n name: string;\n /** Human-readable label shown in the tool-preferences popover. */\n label: string;\n /** Bucket heading in the popover — the clicky surface for RPC operations. */\n group?: string;\n /** Display title of the tool's parent surface/entity (e.g. \"Xero Accounts\").\n * Used to nest tools under their entity within a group, and as the\n * disambiguating prefix in flat lists so sibling verbs (\"List\", \"Get\") stay\n * distinguishable. Resolved from the operation's `x-clicky.surface`. */\n parent?: string;\n /** Raw entity name of the tool's surface (e.g. \"accounts\"), when known. */\n entity?: string;\n /** Preference key sent to the backend. Defaults to `name`; group-backed\n * clicky tools set this to the backend tool group. */\n preferenceKey?: string;\n /** Initial backend-owned permission when the chat window first sees this tool. */\n defaultPermission?: ToolMode;\n /** Opaque icon name emitted by the backend, resolved by the host UI. */\n icon?: string;\n /** Description shown in tool pickers / tool-call headers. */\n description?: string;\n /** Short usage hints shown in the tool browser. */\n hints?: string[];\n source?: \"clicky\" | \"custom\" | \"mcp\" | string;\n server?: string;\n method?: string;\n path?: string;\n operationName?: string;\n title?: string;\n /** Whether the runtime should treat the tool input schema as strict/closed. */\n strict?: boolean;\n /** Runtime tool annotations/hints, e.g. MCP/Genkit well-known hints. */\n annotations?: ToolAnnotations;\n /** JSON-Schema for the tool's input, assembled from an operation's\n * parameters + request body. Omitted for hand-authored tools. */\n inputSchema?: ChatToolInputSchema;\n outputSchema?: ChatToolInputSchema;\n}\n\nexport type ChatToolInputSchema = JsonSchemaObject;\nexport type JsonSchemaProperty = FormJsonSchemaProperty;\nexport type JSONSchemaProperty = FormJsonSchemaProperty;\n\n/** Returns true for a `dynamic-tool` part (clicky operations surface this way). */\nexport function isDynamicToolPart(part: {\n type: string;\n}): part is DynamicToolUIPart {\n return part.type === \"dynamic-tool\";\n}\n\n/** Returns true for a typed `tool-<name>` part. */\nexport function isTypedToolPart(part: { type: string }): part is ToolUIPart {\n return part.type.startsWith(\"tool-\");\n}\n\n/** The display name of a tool part: the explicit `toolName` for dynamic tools,\n * otherwise the suffix after `tool-`. */\nexport function toolPartName(part: AnyToolPart): string {\n if (isDynamicToolPart(part)) {\n return part.toolName;\n }\n return part.type.slice(\"tool-\".length);\n}\n\nexport interface ToolResultRenderArgs {\n part: AnyToolPart;\n toolName: string;\n output: unknown;\n}\n\nexport type ToolResultRenderer = (args: ToolResultRenderArgs) => ReactNode;\n"],"names":[],"mappings":";;AA+JO,SAAS,gBAAgB,GAAuB;AACrD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,iBAAiB,GAAuB;AACtD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,gBAAgB,MAEJ;AAC1B,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,WAAW,MAA4C;AACrE,SAAO,KAAK,SAAS;AACvB;AAQO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAUO,MAAM,iCAA+D;AAAA,EAC1E;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAEN;AAgEO,SAAS,kBAAkB,MAEJ;AAC5B,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,gBAAgB,MAA4C;AAC1E,SAAO,KAAK,KAAK,WAAW,OAAO;AACrC;AAIO,SAAS,aAAa,MAA2B;AACtD,MAAI,kBAAkB,IAAI,GAAG;AAC3B,WAAO,KAAK;AAAA,EACd;AACA,SAAO,KAAK,KAAK,MAAM,QAAQ,MAAM;AACvC;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"types.cjs","sources":["../../../src/data/chat/types.ts"],"sourcesContent":["import type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n} from \"ai\";\nimport type { ReactNode } from \"react\";\nimport type {\n JsonSchemaObject,\n JsonSchemaProperty as FormJsonSchemaProperty,\n} from \"../../components/json-schema-form-types\";\n\nexport type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n};\n\n/** A selectable chat model, as served by the backend's GET /api/chat/models.\n * `configured` is false for catalogued models whose provider has no API key. */\nexport interface ChatModelRuntime {\n model?: string;\n id?: string;\n backend?: string;\n mode?: string;\n temperature?: number;\n effort?: string;\n noCache?: boolean;\n fallbacks?: ChatModelRuntime[];\n}\n\nexport type RuntimeAvailabilityState =\n | \"available\"\n | \"disabled\"\n | \"missing_credentials\"\n | \"not_authenticated\"\n | \"missing_executable\"\n | \"missing_dependency\"\n | \"unsupported\"\n | \"unavailable\";\n\nexport interface RuntimeAvailability {\n state: RuntimeAvailabilityState;\n reason?: string;\n remediation?: string;\n}\n\nexport interface ChatModel {\n id: string;\n provider: string;\n label: string;\n /** Exact Captain Model wire value submitted when this display row is selected. */\n runtime?: ChatModelRuntime;\n reasoning: boolean;\n /** True when backend metadata is authoritative, including explicit unsupported values. */\n capabilitiesKnown?: boolean;\n /** Ordered reasoning-effort tiers accepted by this exact model. */\n supportedEfforts?: string[];\n /** Backend-recommended effort used when the current selection is invalid. */\n defaultEffort?: string;\n /** Whether the model honours the temperature sampling control. */\n temperature?: boolean;\n configured?: boolean;\n availability?: RuntimeAvailability;\n /**\n * The catalog's own declared default — the row a picker seeds with when the\n * caller names no model. At most one row carries it, and a catalog that\n * declares none (or whose default is unconfigured) falls back to the first\n * configured row.\n */\n default?: boolean;\n /** Concrete runtime backends that advertised this model. Empty/omitted means provider-wide. */\n backends?: string[];\n /** Max context tokens — the denominator for a usage gauge. */\n contextWindow?: number;\n /** MIME patterns accepted as model inputs, e.g. image/* or application/pdf. */\n inputMediaTypes?: string[];\n}\n\n/** Per-message metadata the backend rides on the SSE `finish` part\n * (`messageMetadata`), applied by the AI SDK to the assistant `UIMessage`. */\nexport interface ChatMessageMetadata {\n backend?: string;\n executionMode?: string;\n model?: string;\n captainSessionId?: string;\n providerSessionId?: string;\n threadId?: string;\n turnId?: string;\n success?: boolean;\n interrupted?: boolean;\n usage?: ChatUsageBreakdown;\n costBreakdown?: ChatCostBreakdown;\n /** This turn's cost in USD. */\n cost?: number;\n /** Cumulative thread cost in USD (when the turn is persisted to a thread). */\n threadCostUsd?: number;\n /** This turn's input-token count, ≈ current context-window occupancy. */\n contextTokens?: number;\n}\n\n/** A flattened usage snapshot a chat surfaces for a gauge: tokens used out of the\n * model's context window, plus cumulative cost. */\nexport interface ChatUsageSummary {\n usedTokens: number;\n maxTokens: number;\n cost?: number;\n usage?: ChatUsageBreakdown;\n costBreakdown?: ChatCostBreakdown;\n messageCount: number;\n backend?: string;\n executionMode?: string;\n model?: string;\n captainSessionId?: string;\n providerSessionId?: string;\n threadId?: string;\n turnId?: string;\n success?: boolean;\n interrupted?: boolean;\n /** @deprecated Use `model`; retained for compatibility with existing consumers. */\n modelLabel?: string;\n}\n\nexport interface ChatBudgetConfig {\n /** Per-thread/request cost cap in USD. */\n cost?: number;\n /** Max output tokens for one model call. */\n maxTokens?: number;\n}\n\nexport interface ChatUsageBreakdown {\n inputTokens?: number;\n outputTokens?: number;\n reasoningTokens?: number;\n cacheReadTokens?: number;\n cacheWriteTokens?: number;\n totalTokens?: number;\n}\n\nexport interface ChatCostBreakdown {\n model?: string;\n inputUsd?: number;\n outputUsd?: number;\n reasoningUsd?: number;\n cacheReadUsd?: number;\n cacheWriteUsd?: number;\n totalUsd?: number;\n}\n\n/** A suggested prompt shown on the empty state. A bare string is both the label\n * and the submitted text; the object form separates them. */\nexport type Suggestion = string | { label: string; prompt: string };\n\n/** The label shown for a suggestion. */\nexport function suggestionLabel(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.label;\n}\n\n/** The text submitted when a suggestion is clicked. */\nexport function suggestionPrompt(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.prompt;\n}\n\n/** Returns true for an assistant reasoning (\"thinking\") part. */\nexport function isReasoningPart(part: {\n type: string;\n}): part is ReasoningUIPart {\n return part.type === \"reasoning\";\n}\n\n/** Returns true for a file/attachment part. */\nexport function isFilePart(part: { type: string }): part is FileUIPart {\n return part.type === \"file\";\n}\n\n/** A tool part as it appears in an assistant UIMessage — either a typed\n * `tool-<name>` part or the generic `dynamic-tool` part. clicky operations\n * surface as dynamic tools, so the chat UI renders both shapes. */\nexport type AnyToolPart = ToolUIPart | DynamicToolUIPart;\n\n/** Claude Agent SDK permission modes accepted by `permissionMode`. */\nexport const CLAUDE_PERMISSION_MODES = [\n \"default\",\n \"acceptEdits\",\n \"bypassPermissions\",\n \"plan\",\n \"dontAsk\",\n \"auto\",\n] as const;\n\nexport type ClaudePermissionMode = (typeof CLAUDE_PERMISSION_MODES)[number];\n\nexport type ClaudePermissionModeOption = {\n value: ClaudePermissionMode;\n label: string;\n description: string;\n};\n\nexport const CLAUDE_PERMISSION_MODE_OPTIONS: ClaudePermissionModeOption[] = [\n {\n value: \"default\",\n label: \"Default\",\n description:\n \"Prompt for dangerous operations using standard Claude behavior.\",\n },\n {\n value: \"auto\",\n label: \"Auto\",\n description:\n \"Use Claude's classifier to approve or deny permission prompts.\",\n },\n {\n value: \"acceptEdits\",\n label: \"Accept edits\",\n description: \"Automatically accept file edit operations.\",\n },\n {\n value: \"dontAsk\",\n label: \"Don't ask\",\n description: \"Do not prompt; deny actions that are not pre-approved.\",\n },\n {\n value: \"plan\",\n label: \"Plan\",\n description: \"Planning mode with no tool execution.\",\n },\n {\n value: \"bypassPermissions\",\n label: \"Bypass\",\n description:\n \"Bypass permission checks when explicitly allowed by the host.\",\n },\n];\n\n/** Tool metadata shared by the chat shell. It both configures the\n * tool-preferences popover (`name`/`label`/`group`) and carries the schema\n * derived from a clicky RPC operation (`description`/`inputSchema`). The Go\n * backend owns execution; the client uses this only for display and to scope\n * which tools a request may call (passed in the transport `body`). */\n/** Authority for one tool, in Captain's tool vocabulary. The legacy `on`/`off`\n * spellings are still accepted on the way in (see `normalizeToolPolicyValue`)\n * and mean `allow`/`deny`; they are never produced here. The UI still *labels*\n * these On and Off — see `POLICY_LABEL`. */\nexport type ToolPolicy = \"allow\" | \"ask\" | \"deny\" | \"auto\";\n\n/** Canonicalizes a tool policy from the wire, accepting the legacy `on`/`off`\n * spellings the backend still emits from older catalogs and MCP `_meta`.\n *\n * `on` means allow rather than auto: the catalog encoding has no separate allow\n * list, so `on` was always its way of saying auto-run. Keeping private copies of\n * this rule per call site is how the UI and the server drifted apart, so this is\n * the only one. */\nexport function normalizeToolPolicy(value: unknown): ToolPolicy | undefined {\n if (typeof value !== \"string\") return undefined;\n switch (value.trim().toLowerCase()) {\n case \"allow\":\n case \"on\":\n case \"enabled\":\n return \"allow\";\n case \"ask\":\n return \"ask\";\n case \"deny\":\n case \"off\":\n case \"disabled\":\n return \"deny\";\n case \"auto\":\n return \"auto\";\n default:\n return undefined;\n }\n}\n\nexport interface ToolAnnotations {\n title?: string;\n readOnlyHint?: boolean;\n destructiveHint?: boolean;\n idempotentHint?: boolean;\n openWorldHint?: boolean;\n [key: string]: unknown;\n}\n\nexport interface ToolMeta {\n /** Stable tool name sent to the model (the operation id). */\n name: string;\n /** Human-readable label shown in the tool-preferences popover. */\n label: string;\n /** Bucket heading in the popover — the clicky surface for RPC operations. */\n group?: string;\n /** Display title of the tool's parent surface/entity (e.g. \"Xero Accounts\").\n * Used to nest tools under their entity within a group, and as the\n * disambiguating prefix in flat lists so sibling verbs (\"List\", \"Get\") stay\n * distinguishable. Resolved from the operation's `x-clicky.surface`. */\n parent?: string;\n /** Raw entity name of the tool's surface (e.g. \"accounts\"), when known. */\n entity?: string;\n /** Preference key sent to the backend. Defaults to `name`; group-backed\n * clicky tools set this to the backend tool group. */\n preferenceKey?: string;\n /** Initial backend-owned permission when the chat window first sees this tool. */\n defaultPermission?: ToolPolicy;\n /** Opaque icon name emitted by the backend, resolved by the host UI. */\n icon?: string;\n /** Description shown in tool pickers / tool-call headers. */\n description?: string;\n /** Short usage hints shown in the tool browser. */\n hints?: string[];\n source?: \"clicky\" | \"custom\" | \"mcp\" | string;\n server?: string;\n method?: string;\n path?: string;\n operationName?: string;\n /** The entity verb (list/get/create/update/delete, or a custom action), the\n * custom action's name, and whether the operation addresses a collection or a\n * single entity. Carried so a permission rule resolves the same way here as\n * it does on the server; empty for a tool that projects no clicky operation.\n * @see resolveToolPolicy */\n verb?: string;\n action?: string;\n scope?: string;\n title?: string;\n /** Whether the runtime should treat the tool input schema as strict/closed. */\n strict?: boolean;\n /** Runtime tool annotations/hints, e.g. MCP/Genkit well-known hints. */\n annotations?: ToolAnnotations;\n /** JSON-Schema for the tool's input, assembled from an operation's\n * parameters + request body. Omitted for hand-authored tools. */\n inputSchema?: ChatToolInputSchema;\n outputSchema?: ChatToolInputSchema;\n}\n\nexport type ChatToolInputSchema = JsonSchemaObject;\nexport type JsonSchemaProperty = FormJsonSchemaProperty;\nexport type JSONSchemaProperty = FormJsonSchemaProperty;\n\n/** Returns true for a `dynamic-tool` part (clicky operations surface this way). */\nexport function isDynamicToolPart(part: {\n type: string;\n}): part is DynamicToolUIPart {\n return part.type === \"dynamic-tool\";\n}\n\n/** Returns true for a typed `tool-<name>` part. */\nexport function isTypedToolPart(part: { type: string }): part is ToolUIPart {\n return part.type.startsWith(\"tool-\");\n}\n\n/** The display name of a tool part: the explicit `toolName` for dynamic tools,\n * otherwise the suffix after `tool-`. */\nexport function toolPartName(part: AnyToolPart): string {\n if (isDynamicToolPart(part)) {\n return part.toolName;\n }\n return part.type.slice(\"tool-\".length);\n}\n\nexport interface ToolResultRenderArgs {\n part: AnyToolPart;\n toolName: string;\n output: unknown;\n}\n\nexport type ToolResultRenderer = (args: ToolResultRenderArgs) => ReactNode;\n"],"names":[],"mappings":";;AA+JO,SAAS,gBAAgB,GAAuB;AACrD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,iBAAiB,GAAuB;AACtD,SAAO,OAAO,MAAM,W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O,KAAK;AAAA,EACd;AACA,SAAO,KAAK,KAAK,MAAM,QAAQ,MAAM;AACvC;;;;;;;;;;;"}
|
|
@@ -152,7 +152,19 @@ export declare const CLAUDE_PERMISSION_MODE_OPTIONS: ClaudePermissionModeOption[
|
|
|
152
152
|
* derived from a clicky RPC operation (`description`/`inputSchema`). The Go
|
|
153
153
|
* backend owns execution; the client uses this only for display and to scope
|
|
154
154
|
* which tools a request may call (passed in the transport `body`). */
|
|
155
|
-
|
|
155
|
+
/** Authority for one tool, in Captain's tool vocabulary. The legacy `on`/`off`
|
|
156
|
+
* spellings are still accepted on the way in (see `normalizeToolPolicyValue`)
|
|
157
|
+
* and mean `allow`/`deny`; they are never produced here. The UI still *labels*
|
|
158
|
+
* these On and Off — see `POLICY_LABEL`. */
|
|
159
|
+
export type ToolPolicy = "allow" | "ask" | "deny" | "auto";
|
|
160
|
+
/** Canonicalizes a tool policy from the wire, accepting the legacy `on`/`off`
|
|
161
|
+
* spellings the backend still emits from older catalogs and MCP `_meta`.
|
|
162
|
+
*
|
|
163
|
+
* `on` means allow rather than auto: the catalog encoding has no separate allow
|
|
164
|
+
* list, so `on` was always its way of saying auto-run. Keeping private copies of
|
|
165
|
+
* this rule per call site is how the UI and the server drifted apart, so this is
|
|
166
|
+
* the only one. */
|
|
167
|
+
export declare function normalizeToolPolicy(value: unknown): ToolPolicy | undefined;
|
|
156
168
|
export interface ToolAnnotations {
|
|
157
169
|
title?: string;
|
|
158
170
|
readOnlyHint?: boolean;
|
|
@@ -179,7 +191,7 @@ export interface ToolMeta {
|
|
|
179
191
|
* clicky tools set this to the backend tool group. */
|
|
180
192
|
preferenceKey?: string;
|
|
181
193
|
/** Initial backend-owned permission when the chat window first sees this tool. */
|
|
182
|
-
defaultPermission?:
|
|
194
|
+
defaultPermission?: ToolPolicy;
|
|
183
195
|
/** Opaque icon name emitted by the backend, resolved by the host UI. */
|
|
184
196
|
icon?: string;
|
|
185
197
|
/** Description shown in tool pickers / tool-call headers. */
|
|
@@ -191,6 +203,14 @@ export interface ToolMeta {
|
|
|
191
203
|
method?: string;
|
|
192
204
|
path?: string;
|
|
193
205
|
operationName?: string;
|
|
206
|
+
/** The entity verb (list/get/create/update/delete, or a custom action), the
|
|
207
|
+
* custom action's name, and whether the operation addresses a collection or a
|
|
208
|
+
* single entity. Carried so a permission rule resolves the same way here as
|
|
209
|
+
* it does on the server; empty for a tool that projects no clicky operation.
|
|
210
|
+
* @see resolveToolPolicy */
|
|
211
|
+
verb?: string;
|
|
212
|
+
action?: string;
|
|
213
|
+
scope?: string;
|
|
194
214
|
title?: string;
|
|
195
215
|
/** Whether the runtime should treat the tool input schema as strict/closed. */
|
|
196
216
|
strict?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/data/chat/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,UAAU,EACX,MAAM,IAAI,CAAC;AACZ,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,IAAI,sBAAsB,EAC7C,MAAM,yCAAyC,CAAC;AAEjD,YAAY,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,UAAU,GACX,CAAC;AAEF;iFACiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAED,MA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5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,0BAA0B,EAkCtE,CAAC;AAEF;;;;uEAIuE;AACvE,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/data/chat/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,UAAU,EACX,MAAM,IAAI,CAAC;AACZ,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,IAAI,sBAAsB,EAC7C,MAAM,yCAAyC,CAAC;AAEjD,YAAY,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,UAAU,GACX,CAAC;AAEF;iFACiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAED,MAAM,MAAM,wBAAwB,GAChC,WAAW,GACX,UAAU,GACV,qBAAqB,GACrB,mBAAmB,GACnB,oBAAoB,GACpB,oBAAoB,GACpB,aAAa,GACb,aAAa,CAAC;AAElB,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,wBAAwB,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE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AM,CAAC,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;sEACkE;IAClE,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAED,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AACnD,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AACxD,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AAExD,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,IAAI,IAAI,iBAAiB,CAE5B;AAED,mDAAmD;AACnD,wBAAgB,eAAe,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,IAAI,UAAU,CAE1E;AAED;0CAC0C;AAC1C,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAKtD;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,oBAAoB,KAAK,SAAS,CAAC"}
|
package/dist/data/chat/types.js
CHANGED
|
@@ -50,6 +50,25 @@ const CLAUDE_PERMISSION_MODE_OPTIONS = [
|
|
|
50
50
|
description: "Bypass permission checks when explicitly allowed by the host."
|
|
51
51
|
}
|
|
52
52
|
];
|
|
53
|
+
function normalizeToolPolicy(value) {
|
|
54
|
+
if (typeof value !== "string") return void 0;
|
|
55
|
+
switch (value.trim().toLowerCase()) {
|
|
56
|
+
case "allow":
|
|
57
|
+
case "on":
|
|
58
|
+
case "enabled":
|
|
59
|
+
return "allow";
|
|
60
|
+
case "ask":
|
|
61
|
+
return "ask";
|
|
62
|
+
case "deny":
|
|
63
|
+
case "off":
|
|
64
|
+
case "disabled":
|
|
65
|
+
return "deny";
|
|
66
|
+
case "auto":
|
|
67
|
+
return "auto";
|
|
68
|
+
default:
|
|
69
|
+
return void 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
53
72
|
function isDynamicToolPart(part) {
|
|
54
73
|
return part.type === "dynamic-tool";
|
|
55
74
|
}
|
|
@@ -69,6 +88,7 @@ export {
|
|
|
69
88
|
isFilePart,
|
|
70
89
|
isReasoningPart,
|
|
71
90
|
isTypedToolPart,
|
|
91
|
+
normalizeToolPolicy,
|
|
72
92
|
suggestionLabel,
|
|
73
93
|
suggestionPrompt,
|
|
74
94
|
toolPartName
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/data/chat/types.ts"],"sourcesContent":["import type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n} from \"ai\";\nimport type { ReactNode } from \"react\";\nimport type {\n JsonSchemaObject,\n JsonSchemaProperty as FormJsonSchemaProperty,\n} from \"../../components/json-schema-form-types\";\n\nexport type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n};\n\n/** A selectable chat model, as served by the backend's GET /api/chat/models.\n * `configured` is false for catalogued models whose provider has no API key. */\nexport interface ChatModelRuntime {\n model?: string;\n id?: string;\n backend?: string;\n mode?: string;\n temperature?: number;\n effort?: string;\n noCache?: boolean;\n fallbacks?: ChatModelRuntime[];\n}\n\nexport type RuntimeAvailabilityState =\n | \"available\"\n | \"disabled\"\n | \"missing_credentials\"\n | \"not_authenticated\"\n | \"missing_executable\"\n | \"missing_dependency\"\n | \"unsupported\"\n | \"unavailable\";\n\nexport interface RuntimeAvailability {\n state: RuntimeAvailabilityState;\n reason?: string;\n remediation?: string;\n}\n\nexport interface ChatModel {\n id: string;\n provider: string;\n label: string;\n /** Exact Captain Model wire value submitted when this display row is selected. */\n runtime?: ChatModelRuntime;\n reasoning: boolean;\n /** True when backend metadata is authoritative, including explicit unsupported values. */\n capabilitiesKnown?: boolean;\n /** Ordered reasoning-effort tiers accepted by this exact model. */\n supportedEfforts?: string[];\n /** Backend-recommended effort used when the current selection is invalid. */\n defaultEffort?: string;\n /** Whether the model honours the temperature sampling control. */\n temperature?: boolean;\n configured?: boolean;\n availability?: RuntimeAvailability;\n /**\n * The catalog's own declared default — the row a picker seeds with when the\n * caller names no model. At most one row carries it, and a catalog that\n * declares none (or whose default is unconfigured) falls back to the first\n * configured row.\n */\n default?: boolean;\n /** Concrete runtime backends that advertised this model. Empty/omitted means provider-wide. */\n backends?: string[];\n /** Max context tokens — the denominator for a usage gauge. */\n contextWindow?: number;\n /** MIME patterns accepted as model inputs, e.g. image/* or application/pdf. */\n inputMediaTypes?: string[];\n}\n\n/** Per-message metadata the backend rides on the SSE `finish` part\n * (`messageMetadata`), applied by the AI SDK to the assistant `UIMessage`. */\nexport interface ChatMessageMetadata {\n backend?: string;\n executionMode?: string;\n model?: string;\n captainSessionId?: string;\n providerSessionId?: string;\n threadId?: string;\n turnId?: string;\n success?: boolean;\n interrupted?: boolean;\n usage?: ChatUsageBreakdown;\n costBreakdown?: ChatCostBreakdown;\n /** This turn's cost in USD. */\n cost?: number;\n /** Cumulative thread cost in USD (when the turn is persisted to a thread). */\n threadCostUsd?: number;\n /** This turn's input-token count, ≈ current context-window occupancy. */\n contextTokens?: number;\n}\n\n/** A flattened usage snapshot a chat surfaces for a gauge: tokens used out of the\n * model's context window, plus cumulative cost. */\nexport interface ChatUsageSummary {\n usedTokens: number;\n maxTokens: number;\n cost?: number;\n usage?: ChatUsageBreakdown;\n costBreakdown?: ChatCostBreakdown;\n messageCount: number;\n backend?: string;\n executionMode?: string;\n model?: string;\n captainSessionId?: string;\n providerSessionId?: string;\n threadId?: string;\n turnId?: string;\n success?: boolean;\n interrupted?: boolean;\n /** @deprecated Use `model`; retained for compatibility with existing consumers. */\n modelLabel?: string;\n}\n\nexport interface ChatBudgetConfig {\n /** Per-thread/request cost cap in USD. */\n cost?: number;\n /** Max output tokens for one model call. */\n maxTokens?: number;\n}\n\nexport interface ChatUsageBreakdown {\n inputTokens?: number;\n outputTokens?: number;\n reasoningTokens?: number;\n cacheReadTokens?: number;\n cacheWriteTokens?: number;\n totalTokens?: number;\n}\n\nexport interface ChatCostBreakdown {\n model?: string;\n inputUsd?: number;\n outputUsd?: number;\n reasoningUsd?: number;\n cacheReadUsd?: number;\n cacheWriteUsd?: number;\n totalUsd?: number;\n}\n\n/** A suggested prompt shown on the empty state. A bare string is both the label\n * and the submitted text; the object form separates them. */\nexport type Suggestion = string | { label: string; prompt: string };\n\n/** The label shown for a suggestion. */\nexport function suggestionLabel(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.label;\n}\n\n/** The text submitted when a suggestion is clicked. */\nexport function suggestionPrompt(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.prompt;\n}\n\n/** Returns true for an assistant reasoning (\"thinking\") part. */\nexport function isReasoningPart(part: {\n type: string;\n}): part is ReasoningUIPart {\n return part.type === \"reasoning\";\n}\n\n/** Returns true for a file/attachment part. */\nexport function isFilePart(part: { type: string }): part is FileUIPart {\n return part.type === \"file\";\n}\n\n/** A tool part as it appears in an assistant UIMessage — either a typed\n * `tool-<name>` part or the generic `dynamic-tool` part. clicky operations\n * surface as dynamic tools, so the chat UI renders both shapes. */\nexport type AnyToolPart = ToolUIPart | DynamicToolUIPart;\n\n/** Claude Agent SDK permission modes accepted by `permissionMode`. */\nexport const CLAUDE_PERMISSION_MODES = [\n \"default\",\n \"acceptEdits\",\n \"bypassPermissions\",\n \"plan\",\n \"dontAsk\",\n \"auto\",\n] as const;\n\nexport type ClaudePermissionMode = (typeof CLAUDE_PERMISSION_MODES)[number];\n\nexport type ClaudePermissionModeOption = {\n value: ClaudePermissionMode;\n label: string;\n description: string;\n};\n\nexport const CLAUDE_PERMISSION_MODE_OPTIONS: ClaudePermissionModeOption[] = [\n {\n value: \"default\",\n label: \"Default\",\n description:\n \"Prompt for dangerous operations using standard Claude behavior.\",\n },\n {\n value: \"auto\",\n label: \"Auto\",\n description:\n \"Use Claude's classifier to approve or deny permission prompts.\",\n },\n {\n value: \"acceptEdits\",\n label: \"Accept edits\",\n description: \"Automatically accept file edit operations.\",\n },\n {\n value: \"dontAsk\",\n label: \"Don't ask\",\n description: \"Do not prompt; deny actions that are not pre-approved.\",\n },\n {\n value: \"plan\",\n label: \"Plan\",\n description: \"Planning mode with no tool execution.\",\n },\n {\n value: \"bypassPermissions\",\n label: \"Bypass\",\n description:\n \"Bypass permission checks when explicitly allowed by the host.\",\n },\n];\n\n/** Tool metadata shared by the chat shell. It both configures the\n * tool-preferences popover (`name`/`label`/`group`) and carries the schema\n * derived from a clicky RPC operation (`description`/`inputSchema`). The Go\n * backend owns execution; the client uses this only for display and to scope\n * which tools a request may call (passed in the transport `body`). */\nexport type ToolMode = \"on\" | \"ask\" | \"off\" | \"auto\";\n\nexport interface ToolAnnotations {\n title?: string;\n readOnlyHint?: boolean;\n destructiveHint?: boolean;\n idempotentHint?: boolean;\n openWorldHint?: boolean;\n [key: string]: unknown;\n}\n\nexport interface ToolMeta {\n /** Stable tool name sent to the model (the operation id). */\n name: string;\n /** Human-readable label shown in the tool-preferences popover. */\n label: string;\n /** Bucket heading in the popover — the clicky surface for RPC operations. */\n group?: string;\n /** Display title of the tool's parent surface/entity (e.g. \"Xero Accounts\").\n * Used to nest tools under their entity within a group, and as the\n * disambiguating prefix in flat lists so sibling verbs (\"List\", \"Get\") stay\n * distinguishable. Resolved from the operation's `x-clicky.surface`. */\n parent?: string;\n /** Raw entity name of the tool's surface (e.g. \"accounts\"), when known. */\n entity?: string;\n /** Preference key sent to the backend. Defaults to `name`; group-backed\n * clicky tools set this to the backend tool group. */\n preferenceKey?: string;\n /** Initial backend-owned permission when the chat window first sees this tool. */\n defaultPermission?: ToolMode;\n /** Opaque icon name emitted by the backend, resolved by the host UI. */\n icon?: string;\n /** Description shown in tool pickers / tool-call headers. */\n description?: string;\n /** Short usage hints shown in the tool browser. */\n hints?: string[];\n source?: \"clicky\" | \"custom\" | \"mcp\" | string;\n server?: string;\n method?: string;\n path?: string;\n operationName?: string;\n title?: string;\n /** Whether the runtime should treat the tool input schema as strict/closed. */\n strict?: boolean;\n /** Runtime tool annotations/hints, e.g. MCP/Genkit well-known hints. */\n annotations?: ToolAnnotations;\n /** JSON-Schema for the tool's input, assembled from an operation's\n * parameters + request body. Omitted for hand-authored tools. */\n inputSchema?: ChatToolInputSchema;\n outputSchema?: ChatToolInputSchema;\n}\n\nexport type ChatToolInputSchema = JsonSchemaObject;\nexport type JsonSchemaProperty = FormJsonSchemaProperty;\nexport type JSONSchemaProperty = FormJsonSchemaProperty;\n\n/** Returns true for a `dynamic-tool` part (clicky operations surface this way). */\nexport function isDynamicToolPart(part: {\n type: string;\n}): part is DynamicToolUIPart {\n return part.type === \"dynamic-tool\";\n}\n\n/** Returns true for a typed `tool-<name>` part. */\nexport function isTypedToolPart(part: { type: string }): part is ToolUIPart {\n return part.type.startsWith(\"tool-\");\n}\n\n/** The display name of a tool part: the explicit `toolName` for dynamic tools,\n * otherwise the suffix after `tool-`. */\nexport function toolPartName(part: AnyToolPart): string {\n if (isDynamicToolPart(part)) {\n return part.toolName;\n }\n return part.type.slice(\"tool-\".length);\n}\n\nexport interface ToolResultRenderArgs {\n part: AnyToolPart;\n toolName: string;\n output: unknown;\n}\n\nexport type ToolResultRenderer = (args: ToolResultRenderArgs) => ReactNode;\n"],"names":[],"mappings":"AA+JO,SAAS,gBAAgB,GAAuB;AACrD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,iBAAiB,GAAuB;AACtD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,gBAAgB,MAEJ;AAC1B,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,WAAW,MAA4C;AACrE,SAAO,KAAK,SAAS;AACvB;AAQO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAUO,MAAM,iCAA+D;AAAA,EAC1E;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAEN;AAgEO,SAAS,kBAAkB,MAEJ;AAC5B,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,gBAAgB,MAA4C;AAC1E,SAAO,KAAK,KAAK,WAAW,OAAO;AACrC;AAIO,SAAS,aAAa,MAA2B;AACtD,MAAI,kBAAkB,IAAI,GAAG;AAC3B,WAAO,KAAK;AAAA,EACd;AACA,SAAO,KAAK,KAAK,MAAM,QAAQ,MAAM;AACvC;"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/data/chat/types.ts"],"sourcesContent":["import type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n} from \"ai\";\nimport type { ReactNode } from \"react\";\nimport type {\n JsonSchemaObject,\n JsonSchemaProperty as FormJsonSchemaProperty,\n} from \"../../components/json-schema-form-types\";\n\nexport type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n};\n\n/** A selectable chat model, as served by the backend's GET /api/chat/models.\n * `configured` is false for catalogued models whose provider has no API key. */\nexport interface ChatModelRuntime {\n model?: string;\n id?: string;\n backend?: string;\n mode?: string;\n temperature?: number;\n effort?: string;\n noCache?: boolean;\n fallbacks?: ChatModelRuntime[];\n}\n\nexport type RuntimeAvailabilityState =\n | \"available\"\n | \"disabled\"\n | \"missing_credentials\"\n | \"not_authenticated\"\n | \"missing_executable\"\n | \"missing_dependency\"\n | \"unsupported\"\n | \"unavailable\";\n\nexport interface RuntimeAvailability {\n state: RuntimeAvailabilityState;\n reason?: string;\n remediation?: string;\n}\n\nexport interface ChatModel {\n id: string;\n provider: string;\n label: string;\n /** Exact Captain Model wire value submitted when this display row is selected. */\n runtime?: ChatModelRuntime;\n reasoning: boolean;\n /** True when backend metadata is authoritative, including explicit unsupported values. */\n capabilitiesKnown?: boolean;\n /** Ordered reasoning-effort tiers accepted by this exact model. */\n supportedEfforts?: string[];\n /** Backend-recommended effort used when the current selection is invalid. */\n defaultEffort?: string;\n /** Whether the model honours the temperature sampling control. */\n temperature?: boolean;\n configured?: boolean;\n availability?: RuntimeAvailability;\n /**\n * The catalog's own declared default — the row a picker seeds with when the\n * caller names no model. At most one row carries it, and a catalog that\n * declares none (or whose default is unconfigured) falls back to the first\n * configured row.\n */\n default?: boolean;\n /** Concrete runtime backends that advertised this model. Empty/omitted means provider-wide. */\n backends?: string[];\n /** Max context tokens — the denominator for a usage gauge. */\n contextWindow?: number;\n /** MIME patterns accepted as model inputs, e.g. image/* or application/pdf. */\n inputMediaTypes?: string[];\n}\n\n/** Per-message metadata the backend rides on the SSE `finish` part\n * (`messageMetadata`), applied by the AI SDK to the assistant `UIMessage`. */\nexport interface ChatMessageMetadata {\n backend?: string;\n executionMode?: string;\n model?: string;\n captainSessionId?: string;\n providerSessionId?: string;\n threadId?: string;\n turnId?: string;\n success?: boolean;\n interrupted?: boolean;\n usage?: ChatUsageBreakdown;\n costBreakdown?: ChatCostBreakdown;\n /** This turn's cost in USD. */\n cost?: number;\n /** Cumulative thread cost in USD (when the turn is persisted to a thread). */\n threadCostUsd?: number;\n /** This turn's input-token count, ≈ current context-window occupancy. */\n contextTokens?: number;\n}\n\n/** A flattened usage snapshot a chat surfaces for a gauge: tokens used out of the\n * model's context window, plus cumulative cost. */\nexport interface ChatUsageSummary {\n usedTokens: number;\n maxTokens: number;\n cost?: number;\n usage?: ChatUsageBreakdown;\n costBreakdown?: ChatCostBreakdown;\n messageCount: number;\n backend?: string;\n executionMode?: string;\n model?: string;\n captainSessionId?: string;\n providerSessionId?: string;\n threadId?: string;\n turnId?: string;\n success?: boolean;\n interrupted?: boolean;\n /** @deprecated Use `model`; retained for compatibility with existing consumers. */\n modelLabel?: string;\n}\n\nexport interface ChatBudgetConfig {\n /** Per-thread/request cost cap in USD. */\n cost?: number;\n /** Max output tokens for one model call. */\n maxTokens?: number;\n}\n\nexport interface ChatUsageBreakdown {\n inputTokens?: number;\n outputTokens?: number;\n reasoningTokens?: number;\n cacheReadTokens?: number;\n cacheWriteTokens?: number;\n totalTokens?: number;\n}\n\nexport interface ChatCostBreakdown {\n model?: string;\n inputUsd?: number;\n outputUsd?: number;\n reasoningUsd?: number;\n cacheReadUsd?: number;\n cacheWriteUsd?: number;\n totalUsd?: number;\n}\n\n/** A suggested prompt shown on the empty state. A bare string is both the label\n * and the submitted text; the object form separates them. */\nexport type Suggestion = string | { label: string; prompt: string };\n\n/** The label shown for a suggestion. */\nexport function suggestionLabel(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.label;\n}\n\n/** The text submitted when a suggestion is clicked. */\nexport function suggestionPrompt(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.prompt;\n}\n\n/** Returns true for an assistant reasoning (\"thinking\") part. */\nexport function isReasoningPart(part: {\n type: string;\n}): part is ReasoningUIPart {\n return part.type === \"reasoning\";\n}\n\n/** Returns true for a file/attachment part. */\nexport function isFilePart(part: { type: string }): part is FileUIPart {\n return part.type === \"file\";\n}\n\n/** A tool part as it appears in an assistant UIMessage — either a typed\n * `tool-<name>` part or the generic `dynamic-tool` part. clicky operations\n * surface as dynamic tools, so the chat UI renders both shapes. */\nexport type AnyToolPart = ToolUIPart | DynamicToolUIPart;\n\n/** Claude Agent SDK permission modes accepted by `permissionMode`. */\nexport const CLAUDE_PERMISSION_MODES = [\n \"default\",\n \"acceptEdits\",\n \"bypassPermissions\",\n \"plan\",\n \"dontAsk\",\n \"auto\",\n] as const;\n\nexport type ClaudePermissionMode = (typeof CLAUDE_PERMISSION_MODES)[number];\n\nexport type ClaudePermissionModeOption = {\n value: ClaudePermissionMode;\n label: string;\n description: string;\n};\n\nexport const CLAUDE_PERMISSION_MODE_OPTIONS: ClaudePermissionModeOption[] = [\n {\n value: \"default\",\n label: \"Default\",\n description:\n \"Prompt for dangerous operations using standard Claude behavior.\",\n },\n {\n value: \"auto\",\n label: \"Auto\",\n description:\n \"Use Claude's classifier to approve or deny permission prompts.\",\n },\n {\n value: \"acceptEdits\",\n label: \"Accept edits\",\n description: \"Automatically accept file edit operations.\",\n },\n {\n value: \"dontAsk\",\n label: \"Don't ask\",\n description: \"Do not prompt; deny actions that are not pre-approved.\",\n },\n {\n value: \"plan\",\n label: \"Plan\",\n description: \"Planning mode with no tool execution.\",\n },\n {\n value: \"bypassPermissions\",\n label: \"Bypass\",\n description:\n \"Bypass permission checks when explicitly allowed by the host.\",\n },\n];\n\n/** Tool metadata shared by the chat shell. It both configures the\n * tool-preferences popover (`name`/`label`/`group`) and carries the schema\n * derived from a clicky RPC operation (`description`/`inputSchema`). The Go\n * backend owns execution; the client uses this only for display and to scope\n * which tools a request may call (passed in the transport `body`). */\n/** Authority for one tool, in Captain's tool vocabulary. The legacy `on`/`off`\n * spellings are still accepted on the way in (see `normalizeToolPolicyValue`)\n * and mean `allow`/`deny`; they are never produced here. The UI still *labels*\n * these On and Off — see `POLICY_LABEL`. */\nexport type ToolPolicy = \"allow\" | \"ask\" | \"deny\" | \"auto\";\n\n/** Canonicalizes a tool policy from the wire, accepting the legacy `on`/`off`\n * spellings the backend still emits from older catalogs and MCP `_meta`.\n *\n * `on` means allow rather than auto: the catalog encoding has no separate allow\n * list, so `on` was always its way of saying auto-run. Keeping private copies of\n * this rule per call site is how the UI and the server drifted apart, so this is\n * the only one. */\nexport function normalizeToolPolicy(value: unknown): ToolPolicy | undefined {\n if (typeof value !== \"string\") return undefined;\n switch (value.trim().toLowerCase()) {\n case \"allow\":\n case \"on\":\n case \"enabled\":\n return \"allow\";\n case \"ask\":\n return \"ask\";\n case \"deny\":\n case \"off\":\n case \"disabled\":\n return \"deny\";\n case \"auto\":\n return \"auto\";\n default:\n return undefined;\n }\n}\n\nexport interface ToolAnnotations {\n title?: string;\n readOnlyHint?: boolean;\n destructiveHint?: boolean;\n idempotentHint?: boolean;\n openWorldHint?: boolean;\n [key: string]: unknown;\n}\n\nexport interface ToolMeta {\n /** Stable tool name sent to the model (the operation id). */\n name: string;\n /** Human-readable label shown in the tool-preferences popover. */\n label: string;\n /** Bucket heading in the popover — the clicky surface for RPC operations. */\n group?: string;\n /** Display title of the tool's parent surface/entity (e.g. \"Xero Accounts\").\n * Used to nest tools under their entity within a group, and as the\n * disambiguating prefix in flat lists so sibling verbs (\"List\", \"Get\") stay\n * distinguishable. Resolved from the operation's `x-clicky.surface`. */\n parent?: string;\n /** Raw entity name of the tool's surface (e.g. \"accounts\"), when known. */\n entity?: string;\n /** Preference key sent to the backend. Defaults to `name`; group-backed\n * clicky tools set this to the backend tool group. */\n preferenceKey?: string;\n /** Initial backend-owned permission when the chat window first sees this tool. */\n defaultPermission?: ToolPolicy;\n /** Opaque icon name emitted by the backend, resolved by the host UI. */\n icon?: string;\n /** Description shown in tool pickers / tool-call headers. */\n description?: string;\n /** Short usage hints shown in the tool browser. */\n hints?: string[];\n source?: \"clicky\" | \"custom\" | \"mcp\" | string;\n server?: string;\n method?: string;\n path?: string;\n operationName?: string;\n /** The entity verb (list/get/create/update/delete, or a custom action), the\n * custom action's name, and whether the operation addresses a collection or a\n * single entity. Carried so a permission rule resolves the same way here as\n * it does on the server; empty for a tool that projects no clicky operation.\n * @see resolveToolPolicy */\n verb?: string;\n action?: string;\n scope?: string;\n title?: string;\n /** Whether the runtime should treat the tool input schema as strict/closed. */\n strict?: boolean;\n /** Runtime tool annotations/hints, e.g. MCP/Genkit well-known hints. */\n annotations?: ToolAnnotations;\n /** JSON-Schema for the tool's input, assembled from an operation's\n * parameters + request body. Omitted for hand-authored tools. */\n inputSchema?: ChatToolInputSchema;\n outputSchema?: ChatToolInputSchema;\n}\n\nexport type ChatToolInputSchema = JsonSchemaObject;\nexport type JsonSchemaProperty = FormJsonSchemaProperty;\nexport type JSONSchemaProperty = FormJsonSchemaProperty;\n\n/** Returns true for a `dynamic-tool` part (clicky operations surface this way). */\nexport function isDynamicToolPart(part: {\n type: string;\n}): part is DynamicToolUIPart {\n return part.type === \"dynamic-tool\";\n}\n\n/** Returns true for a typed `tool-<name>` part. */\nexport function isTypedToolPart(part: { type: string }): part is ToolUIPart {\n return part.type.startsWith(\"tool-\");\n}\n\n/** The display name of a tool part: the explicit `toolName` for dynamic tools,\n * otherwise the suffix after `tool-`. */\nexport function toolPartName(part: AnyToolPart): string {\n if (isDynamicToolPart(part)) {\n return part.toolName;\n }\n return part.type.slice(\"tool-\".length);\n}\n\nexport interface ToolResultRenderArgs {\n part: AnyToolPart;\n toolName: string;\n output: unknown;\n}\n\nexport type ToolResultRenderer = (args: ToolResultRenderArgs) => ReactNode;\n"],"names":[],"mappings":"AA+JO,SAAS,gBAAgB,GAAuB;AACrD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,iBAAiB,GAAuB;AACtD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,gBAAgB,MAEJ;AAC1B,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,WAAW,MAA4C;AACrE,SAAO,KAAK,SAAS;AACvB;AAQO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAUO,MAAM,iCAA+D;AAAA,EAC1E;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,EAAA;AAEN;AAoBO,SAAS,oBAAoB,OAAwC;AAC1E,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,UAAQ,MAAM,KAAA,EAAO,YAAA,GAAY;AAAA,IAC/B,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EAAA;AAEb;AAiEO,SAAS,kBAAkB,MAEJ;AAC5B,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,gBAAgB,MAA4C;AAC1E,SAAO,KAAK,KAAK,WAAW,OAAO;AACrC;AAIO,SAAS,aAAa,MAA2B;AACtD,MAAI,kBAAkB,IAAI,GAAG;AAC3B,WAAO,KAAK;AAAA,EACd;AACA,SAAO,KAAK,KAAK,MAAM,QAAQ,MAAM;AACvC;"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
4
|
+
const watchers = /* @__PURE__ */ new Set();
|
|
5
|
+
function registerDebugConsole(listener) {
|
|
6
|
+
listeners.add(listener);
|
|
7
|
+
notify();
|
|
8
|
+
return () => {
|
|
9
|
+
listeners.delete(listener);
|
|
10
|
+
notify();
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function subscribeToDebugConsole(onChange) {
|
|
14
|
+
watchers.add(onChange);
|
|
15
|
+
return () => {
|
|
16
|
+
watchers.delete(onChange);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function notify() {
|
|
20
|
+
for (const watcher of watchers) watcher();
|
|
21
|
+
}
|
|
22
|
+
function debugConsoleAvailable() {
|
|
23
|
+
return listeners.size > 0;
|
|
24
|
+
}
|
|
25
|
+
let consoleOpen = false;
|
|
26
|
+
function setDebugConsoleOpen(open) {
|
|
27
|
+
if (consoleOpen === open) return;
|
|
28
|
+
consoleOpen = open;
|
|
29
|
+
notify();
|
|
30
|
+
}
|
|
31
|
+
function debugConsoleOpen() {
|
|
32
|
+
return consoleOpen && listeners.size > 0;
|
|
33
|
+
}
|
|
34
|
+
function revealDebugConsole(request = {}) {
|
|
35
|
+
for (const listener of listeners) listener(request);
|
|
36
|
+
}
|
|
37
|
+
const DEBUG_CAPTURE_HEADER = "X-Debug-Level";
|
|
38
|
+
const DEBUG_REFRESH_INSPECTION_HEADER = "X-Debug-Refresh-Inspection";
|
|
39
|
+
let captureLevel = "off";
|
|
40
|
+
let refreshInspection = false;
|
|
41
|
+
function setDebugCaptureLevel(level) {
|
|
42
|
+
captureLevel = level;
|
|
43
|
+
}
|
|
44
|
+
function setDebugRefreshInspection(refresh) {
|
|
45
|
+
refreshInspection = refresh;
|
|
46
|
+
}
|
|
47
|
+
function debugCaptureHeaders() {
|
|
48
|
+
if (captureLevel === "off" || listeners.size === 0) return {};
|
|
49
|
+
const headers = { [DEBUG_CAPTURE_HEADER]: captureLevel };
|
|
50
|
+
if (refreshInspection) headers[DEBUG_REFRESH_INSPECTION_HEADER] = "true";
|
|
51
|
+
return headers;
|
|
52
|
+
}
|
|
53
|
+
exports.DEBUG_CAPTURE_HEADER = DEBUG_CAPTURE_HEADER;
|
|
54
|
+
exports.DEBUG_REFRESH_INSPECTION_HEADER = DEBUG_REFRESH_INSPECTION_HEADER;
|
|
55
|
+
exports.debugCaptureHeaders = debugCaptureHeaders;
|
|
56
|
+
exports.debugConsoleAvailable = debugConsoleAvailable;
|
|
57
|
+
exports.debugConsoleOpen = debugConsoleOpen;
|
|
58
|
+
exports.registerDebugConsole = registerDebugConsole;
|
|
59
|
+
exports.revealDebugConsole = revealDebugConsole;
|
|
60
|
+
exports.setDebugCaptureLevel = setDebugCaptureLevel;
|
|
61
|
+
exports.setDebugConsoleOpen = setDebugConsoleOpen;
|
|
62
|
+
exports.setDebugRefreshInspection = setDebugRefreshInspection;
|
|
63
|
+
exports.subscribeToDebugConsole = subscribeToDebugConsole;
|
|
64
|
+
//# sourceMappingURL=debugConsoleSignal.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugConsoleSignal.cjs","sources":["../../src/data/debugConsoleSignal.ts"],"sourcesContent":["/**\n * The one thing a result table and the debug console have to agree on: \"show me\n * this\".\n *\n * It is a bare emitter with no dependencies, and it lives here rather than in\n * `devtools/` on purpose. Tables ship in the `data` entry point and the console\n * ships in `devtools`; if the table imported the console to reveal it, every app\n * with a table would carry the console's tables, HAR panel and SSE client\n * whether or not it ever opens one. The dependency runs the other way instead:\n * the console imports this and registers itself.\n */\n\nexport type DebugConsoleRequest = {\n /** The capture to open, when the caller knows which one it produced. */\n recordId?: string | undefined;\n /** The tab to land on, e.g. \"queries\" or \"network\". */\n tab?: string | undefined;\n /**\n * Closes an already-open console instead of re-opening it.\n *\n * Only the console's own trigger sets this. A \"Debug\" action that toggled\n * would close the console for someone who clicked it while it was already\n * open — the opposite of what asking to see a query means.\n */\n toggle?: boolean | undefined;\n};\n\ntype Listener = (request: DebugConsoleRequest) => void;\n\nconst listeners = new Set<Listener>();\nconst watchers = new Set<() => void>();\n\n/**\n * Registers a console. The returned function unregisters it, so a dock that\n * unmounts stops claiming a console exists.\n */\nexport function registerDebugConsole(listener: Listener): () => void {\n listeners.add(listener);\n notify();\n return () => {\n listeners.delete(listener);\n notify();\n };\n}\n\n/**\n * Watches whether a console is mounted, so a menu built before the dock renders\n * gains its \"Debug\" item when the dock arrives rather than staying stale.\n */\nexport function subscribeToDebugConsole(onChange: () => void): () => void {\n watchers.add(onChange);\n return () => {\n watchers.delete(onChange);\n };\n}\n\nfunction notify(): void {\n for (const watcher of watchers) watcher();\n}\n\n/**\n * Whether a console is mounted to reveal.\n *\n * Callers use this to decide whether to offer the action at all: a \"Debug\" menu\n * item that does nothing is worse than no menu item, because it reads as broken\n * rather than as absent.\n */\nexport function debugConsoleAvailable(): boolean {\n return listeners.size > 0;\n}\n\nlet consoleOpen = false;\n\n/**\n * Published by the mounted console as it opens and closes.\n *\n * Its trigger lives in the app's navbar, outside the console's own tree, so\n * \"am I showing an open console\" is not state either side can read from the\n * other without this.\n */\nexport function setDebugConsoleOpen(open: boolean): void {\n if (consoleOpen === open) return;\n consoleOpen = open;\n notify();\n}\n\n/** Whether the mounted console is currently showing. */\nexport function debugConsoleOpen(): boolean {\n return consoleOpen && listeners.size > 0;\n}\n\n/** Asks the mounted console to open, optionally focused on one capture. */\nexport function revealDebugConsole(request: DebugConsoleRequest = {}): void {\n for (const listener of listeners) listener(request);\n}\n\n/** The headers a request arms the server with. Named once, here. */\nexport const DEBUG_CAPTURE_HEADER = \"X-Debug-Level\";\nexport const DEBUG_REFRESH_INSPECTION_HEADER = \"X-Debug-Refresh-Inspection\";\n\nlet captureLevel = \"off\";\nlet refreshInspection = false;\n\n/**\n * Published by the mounted console whenever its level picker changes.\n *\n * It lives beside the reveal signal for the same reason: a component that makes\n * a bare `fetch` — the profile builder's sample call, say — has to arm it, and\n * importing the console to read one string would drag the whole console into\n * that bundle.\n */\nexport function setDebugCaptureLevel(level: string): void {\n captureLevel = level;\n}\n\n/**\n * Published by the console alongside the level: whether requests should also\n * rebuild every metadata lookup instead of reading the cache.\n */\nexport function setDebugRefreshInspection(refresh: boolean): void {\n refreshInspection = refresh;\n}\n\n/**\n * Headers that arm a request at whatever the console is currently set to, and\n * nothing at all when no console is open.\n *\n * Spread into a bare `fetch`. Requests that go through a wrapped client are\n * armed by the wrapper instead and need not call this.\n */\nexport function debugCaptureHeaders(): Record<string, string> {\n if (captureLevel === \"off\" || listeners.size === 0) return {};\n const headers: Record<string, string> = { [DEBUG_CAPTURE_HEADER]: captureLevel };\n // Only present when on: a header carrying \"false\" would make every request\n // look like it had opted out of something.\n if (refreshInspection) headers[DEBUG_REFRESH_INSPECTION_HEADER] = \"true\";\n return headers;\n}\n"],"names":[],"mappings":";;AA6BA,MAAM,gCAAgB,IAAA;AACtB,MAAM,+BAAe,IAAA;AAMd,SAAS,qBAAqB,UAAgC;AACnE,YAAU,IAAI,QAAQ;AACtB,SAAA;AACA,SAAO,MAAM;AACX,cAAU,OAAO,QAAQ;AACzB,WAAA;AAAA,EACF;AACF;AAMO,SAAS,wBAAwB,UAAkC;AACxE,WAAS,IAAI,QAAQ;AACrB,SAAO,MAAM;AACX,aAAS,OAAO,QAAQ;AAAA,EAC1B;AACF;AAEA,SAAS,SAAe;AACtB,aAAW,WAAW,SAAU,SAAA;AAClC;AASO,SAAS,wBAAiC;AAC/C,SAAO,UAAU,OAAO;AAC1B;AAEA,IAAI,cAAc;AASX,SAAS,oBAAoB,MAAqB;AACvD,MAAI,gBAAgB,KAAM;AAC1B,gBAAc;AACd,SAAA;AACF;AAGO,SAAS,mBAA4B;AAC1C,SAAO,eAAe,UAAU,OAAO;AACzC;AAGO,SAAS,mBAAmB,UAA+B,IAAU;AAC1E,aAAW,YAAY,UAAW,UAAS,OAAO;AACpD;AAGO,MAAM,uBAAuB;AAC7B,MAAM,kCAAkC;AAE/C,IAAI,eAAe;AACnB,IAAI,oBAAoB;AAUjB,SAAS,qBAAqB,OAAqB;AACxD,iBAAe;AACjB;AAMO,SAAS,0BAA0B,SAAwB;AAChE,sBAAoB;AACtB;AASO,SAAS,sBAA8C;AAC5D,MAAI,iBAAiB,SAAS,UAAU,SAAS,UAAU,CAAA;AAC3D,QAAM,UAAkC,EAAE,CAAC,oBAAoB,GAAG,aAAA;AAGlE,MAAI,kBAAmB,SAAQ,+BAA+B,IAAI;AAClE,SAAO;AACT;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one thing a result table and the debug console have to agree on: "show me
|
|
3
|
+
* this".
|
|
4
|
+
*
|
|
5
|
+
* It is a bare emitter with no dependencies, and it lives here rather than in
|
|
6
|
+
* `devtools/` on purpose. Tables ship in the `data` entry point and the console
|
|
7
|
+
* ships in `devtools`; if the table imported the console to reveal it, every app
|
|
8
|
+
* with a table would carry the console's tables, HAR panel and SSE client
|
|
9
|
+
* whether or not it ever opens one. The dependency runs the other way instead:
|
|
10
|
+
* the console imports this and registers itself.
|
|
11
|
+
*/
|
|
12
|
+
export type DebugConsoleRequest = {
|
|
13
|
+
/** The capture to open, when the caller knows which one it produced. */
|
|
14
|
+
recordId?: string | undefined;
|
|
15
|
+
/** The tab to land on, e.g. "queries" or "network". */
|
|
16
|
+
tab?: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Closes an already-open console instead of re-opening it.
|
|
19
|
+
*
|
|
20
|
+
* Only the console's own trigger sets this. A "Debug" action that toggled
|
|
21
|
+
* would close the console for someone who clicked it while it was already
|
|
22
|
+
* open — the opposite of what asking to see a query means.
|
|
23
|
+
*/
|
|
24
|
+
toggle?: boolean | undefined;
|
|
25
|
+
};
|
|
26
|
+
type Listener = (request: DebugConsoleRequest) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Registers a console. The returned function unregisters it, so a dock that
|
|
29
|
+
* unmounts stops claiming a console exists.
|
|
30
|
+
*/
|
|
31
|
+
export declare function registerDebugConsole(listener: Listener): () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Watches whether a console is mounted, so a menu built before the dock renders
|
|
34
|
+
* gains its "Debug" item when the dock arrives rather than staying stale.
|
|
35
|
+
*/
|
|
36
|
+
export declare function subscribeToDebugConsole(onChange: () => void): () => void;
|
|
37
|
+
/**
|
|
38
|
+
* Whether a console is mounted to reveal.
|
|
39
|
+
*
|
|
40
|
+
* Callers use this to decide whether to offer the action at all: a "Debug" menu
|
|
41
|
+
* item that does nothing is worse than no menu item, because it reads as broken
|
|
42
|
+
* rather than as absent.
|
|
43
|
+
*/
|
|
44
|
+
export declare function debugConsoleAvailable(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Published by the mounted console as it opens and closes.
|
|
47
|
+
*
|
|
48
|
+
* Its trigger lives in the app's navbar, outside the console's own tree, so
|
|
49
|
+
* "am I showing an open console" is not state either side can read from the
|
|
50
|
+
* other without this.
|
|
51
|
+
*/
|
|
52
|
+
export declare function setDebugConsoleOpen(open: boolean): void;
|
|
53
|
+
/** Whether the mounted console is currently showing. */
|
|
54
|
+
export declare function debugConsoleOpen(): boolean;
|
|
55
|
+
/** Asks the mounted console to open, optionally focused on one capture. */
|
|
56
|
+
export declare function revealDebugConsole(request?: DebugConsoleRequest): void;
|
|
57
|
+
/** The headers a request arms the server with. Named once, here. */
|
|
58
|
+
export declare const DEBUG_CAPTURE_HEADER = "X-Debug-Level";
|
|
59
|
+
export declare const DEBUG_REFRESH_INSPECTION_HEADER = "X-Debug-Refresh-Inspection";
|
|
60
|
+
/**
|
|
61
|
+
* Published by the mounted console whenever its level picker changes.
|
|
62
|
+
*
|
|
63
|
+
* It lives beside the reveal signal for the same reason: a component that makes
|
|
64
|
+
* a bare `fetch` — the profile builder's sample call, say — has to arm it, and
|
|
65
|
+
* importing the console to read one string would drag the whole console into
|
|
66
|
+
* that bundle.
|
|
67
|
+
*/
|
|
68
|
+
export declare function setDebugCaptureLevel(level: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Published by the console alongside the level: whether requests should also
|
|
71
|
+
* rebuild every metadata lookup instead of reading the cache.
|
|
72
|
+
*/
|
|
73
|
+
export declare function setDebugRefreshInspection(refresh: boolean): void;
|
|
74
|
+
/**
|
|
75
|
+
* Headers that arm a request at whatever the console is currently set to, and
|
|
76
|
+
* nothing at all when no console is open.
|
|
77
|
+
*
|
|
78
|
+
* Spread into a bare `fetch`. Requests that go through a wrapped client are
|
|
79
|
+
* armed by the wrapper instead and need not call this.
|
|
80
|
+
*/
|
|
81
|
+
export declare function debugCaptureHeaders(): Record<string, string>;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=debugConsoleSignal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugConsoleSignal.d.ts","sourceRoot":"","sources":["../../src/data/debugConsoleSignal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,mBAAmB,GAAG;IAChC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;AAKvD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAOnE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAKxE;AAMD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C;AAID;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAIvD;AAED,wDAAwD;AACxD,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,IAAI,CAE1E;AAED,oEAAoE;AACpE,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AACpD,eAAO,MAAM,+BAA+B,+BAA+B,CAAC;AAK5E;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAExD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEhE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO5D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
2
|
+
const watchers = /* @__PURE__ */ new Set();
|
|
3
|
+
function registerDebugConsole(listener) {
|
|
4
|
+
listeners.add(listener);
|
|
5
|
+
notify();
|
|
6
|
+
return () => {
|
|
7
|
+
listeners.delete(listener);
|
|
8
|
+
notify();
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function subscribeToDebugConsole(onChange) {
|
|
12
|
+
watchers.add(onChange);
|
|
13
|
+
return () => {
|
|
14
|
+
watchers.delete(onChange);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function notify() {
|
|
18
|
+
for (const watcher of watchers) watcher();
|
|
19
|
+
}
|
|
20
|
+
function debugConsoleAvailable() {
|
|
21
|
+
return listeners.size > 0;
|
|
22
|
+
}
|
|
23
|
+
let consoleOpen = false;
|
|
24
|
+
function setDebugConsoleOpen(open) {
|
|
25
|
+
if (consoleOpen === open) return;
|
|
26
|
+
consoleOpen = open;
|
|
27
|
+
notify();
|
|
28
|
+
}
|
|
29
|
+
function debugConsoleOpen() {
|
|
30
|
+
return consoleOpen && listeners.size > 0;
|
|
31
|
+
}
|
|
32
|
+
function revealDebugConsole(request = {}) {
|
|
33
|
+
for (const listener of listeners) listener(request);
|
|
34
|
+
}
|
|
35
|
+
const DEBUG_CAPTURE_HEADER = "X-Debug-Level";
|
|
36
|
+
const DEBUG_REFRESH_INSPECTION_HEADER = "X-Debug-Refresh-Inspection";
|
|
37
|
+
let captureLevel = "off";
|
|
38
|
+
let refreshInspection = false;
|
|
39
|
+
function setDebugCaptureLevel(level) {
|
|
40
|
+
captureLevel = level;
|
|
41
|
+
}
|
|
42
|
+
function setDebugRefreshInspection(refresh) {
|
|
43
|
+
refreshInspection = refresh;
|
|
44
|
+
}
|
|
45
|
+
function debugCaptureHeaders() {
|
|
46
|
+
if (captureLevel === "off" || listeners.size === 0) return {};
|
|
47
|
+
const headers = { [DEBUG_CAPTURE_HEADER]: captureLevel };
|
|
48
|
+
if (refreshInspection) headers[DEBUG_REFRESH_INSPECTION_HEADER] = "true";
|
|
49
|
+
return headers;
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
DEBUG_CAPTURE_HEADER,
|
|
53
|
+
DEBUG_REFRESH_INSPECTION_HEADER,
|
|
54
|
+
debugCaptureHeaders,
|
|
55
|
+
debugConsoleAvailable,
|
|
56
|
+
debugConsoleOpen,
|
|
57
|
+
registerDebugConsole,
|
|
58
|
+
revealDebugConsole,
|
|
59
|
+
setDebugCaptureLevel,
|
|
60
|
+
setDebugConsoleOpen,
|
|
61
|
+
setDebugRefreshInspection,
|
|
62
|
+
subscribeToDebugConsole
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=debugConsoleSignal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugConsoleSignal.js","sources":["../../src/data/debugConsoleSignal.ts"],"sourcesContent":["/**\n * The one thing a result table and the debug console have to agree on: \"show me\n * this\".\n *\n * It is a bare emitter with no dependencies, and it lives here rather than in\n * `devtools/` on purpose. Tables ship in the `data` entry point and the console\n * ships in `devtools`; if the table imported the console to reveal it, every app\n * with a table would carry the console's tables, HAR panel and SSE client\n * whether or not it ever opens one. The dependency runs the other way instead:\n * the console imports this and registers itself.\n */\n\nexport type DebugConsoleRequest = {\n /** The capture to open, when the caller knows which one it produced. */\n recordId?: string | undefined;\n /** The tab to land on, e.g. \"queries\" or \"network\". */\n tab?: string | undefined;\n /**\n * Closes an already-open console instead of re-opening it.\n *\n * Only the console's own trigger sets this. A \"Debug\" action that toggled\n * would close the console for someone who clicked it while it was already\n * open — the opposite of what asking to see a query means.\n */\n toggle?: boolean | undefined;\n};\n\ntype Listener = (request: DebugConsoleRequest) => void;\n\nconst listeners = new Set<Listener>();\nconst watchers = new Set<() => void>();\n\n/**\n * Registers a console. The returned function unregisters it, so a dock that\n * unmounts stops claiming a console exists.\n */\nexport function registerDebugConsole(listener: Listener): () => void {\n listeners.add(listener);\n notify();\n return () => {\n listeners.delete(listener);\n notify();\n };\n}\n\n/**\n * Watches whether a console is mounted, so a menu built before the dock renders\n * gains its \"Debug\" item when the dock arrives rather than staying stale.\n */\nexport function subscribeToDebugConsole(onChange: () => void): () => void {\n watchers.add(onChange);\n return () => {\n watchers.delete(onChange);\n };\n}\n\nfunction notify(): void {\n for (const watcher of watchers) watcher();\n}\n\n/**\n * Whether a console is mounted to reveal.\n *\n * Callers use this to decide whether to offer the action at all: a \"Debug\" menu\n * item that does nothing is worse than no menu item, because it reads as broken\n * rather than as absent.\n */\nexport function debugConsoleAvailable(): boolean {\n return listeners.size > 0;\n}\n\nlet consoleOpen = false;\n\n/**\n * Published by the mounted console as it opens and closes.\n *\n * Its trigger lives in the app's navbar, outside the console's own tree, so\n * \"am I showing an open console\" is not state either side can read from the\n * other without this.\n */\nexport function setDebugConsoleOpen(open: boolean): void {\n if (consoleOpen === open) return;\n consoleOpen = open;\n notify();\n}\n\n/** Whether the mounted console is currently showing. */\nexport function debugConsoleOpen(): boolean {\n return consoleOpen && listeners.size > 0;\n}\n\n/** Asks the mounted console to open, optionally focused on one capture. */\nexport function revealDebugConsole(request: DebugConsoleRequest = {}): void {\n for (const listener of listeners) listener(request);\n}\n\n/** The headers a request arms the server with. Named once, here. */\nexport const DEBUG_CAPTURE_HEADER = \"X-Debug-Level\";\nexport const DEBUG_REFRESH_INSPECTION_HEADER = \"X-Debug-Refresh-Inspection\";\n\nlet captureLevel = \"off\";\nlet refreshInspection = false;\n\n/**\n * Published by the mounted console whenever its level picker changes.\n *\n * It lives beside the reveal signal for the same reason: a component that makes\n * a bare `fetch` — the profile builder's sample call, say — has to arm it, and\n * importing the console to read one string would drag the whole console into\n * that bundle.\n */\nexport function setDebugCaptureLevel(level: string): void {\n captureLevel = level;\n}\n\n/**\n * Published by the console alongside the level: whether requests should also\n * rebuild every metadata lookup instead of reading the cache.\n */\nexport function setDebugRefreshInspection(refresh: boolean): void {\n refreshInspection = refresh;\n}\n\n/**\n * Headers that arm a request at whatever the console is currently set to, and\n * nothing at all when no console is open.\n *\n * Spread into a bare `fetch`. Requests that go through a wrapped client are\n * armed by the wrapper instead and need not call this.\n */\nexport function debugCaptureHeaders(): Record<string, string> {\n if (captureLevel === \"off\" || listeners.size === 0) return {};\n const headers: Record<string, string> = { [DEBUG_CAPTURE_HEADER]: captureLevel };\n // Only present when on: a header carrying \"false\" would make every request\n // look like it had opted out of something.\n if (refreshInspection) headers[DEBUG_REFRESH_INSPECTION_HEADER] = \"true\";\n return headers;\n}\n"],"names":[],"mappings":"AA6BA,MAAM,gCAAgB,IAAA;AACtB,MAAM,+BAAe,IAAA;AAMd,SAAS,qBAAqB,UAAgC;AACnE,YAAU,IAAI,QAAQ;AACtB,SAAA;AACA,SAAO,MAAM;AACX,cAAU,OAAO,QAAQ;AACzB,WAAA;AAAA,EACF;AACF;AAMO,SAAS,wBAAwB,UAAkC;AACxE,WAAS,IAAI,QAAQ;AACrB,SAAO,MAAM;AACX,aAAS,OAAO,QAAQ;AAAA,EAC1B;AACF;AAEA,SAAS,SAAe;AACtB,aAAW,WAAW,SAAU,SAAA;AAClC;AASO,SAAS,wBAAiC;AAC/C,SAAO,UAAU,OAAO;AAC1B;AAEA,IAAI,cAAc;AASX,SAAS,oBAAoB,MAAqB;AACvD,MAAI,gBAAgB,KAAM;AAC1B,gBAAc;AACd,SAAA;AACF;AAGO,SAAS,mBAA4B;AAC1C,SAAO,eAAe,UAAU,OAAO;AACzC;AAGO,SAAS,mBAAmB,UAA+B,IAAU;AAC1E,aAAW,YAAY,UAAW,UAAS,OAAO;AACpD;AAGO,MAAM,uBAAuB;AAC7B,MAAM,kCAAkC;AAE/C,IAAI,eAAe;AACnB,IAAI,oBAAoB;AAUjB,SAAS,qBAAqB,OAAqB;AACxD,iBAAe;AACjB;AAMO,SAAS,0BAA0B,SAAwB;AAChE,sBAAoB;AACtB;AASO,SAAS,sBAA8C;AAC5D,MAAI,iBAAiB,SAAS,UAAU,SAAS,UAAU,CAAA;AAC3D,QAAM,UAAkC,EAAE,CAAC,oBAAoB,GAAG,aAAA;AAGlE,MAAI,kBAAmB,SAAQ,+BAA+B,IAAI;AAClE,SAAO;AACT;"}
|
|
@@ -58,20 +58,26 @@ function HarPanel({
|
|
|
58
58
|
if (!entries || entries.length === 0) {
|
|
59
59
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-density-6 text-center text-muted-foreground text-sm", children: emptyLabel });
|
|
60
60
|
}
|
|
61
|
-
return
|
|
62
|
-
DataTable
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
return (
|
|
62
|
+
// A flex column, not a plain block: DataTable sizes itself as `flex-1
|
|
63
|
+
// min-h-0` so its own scroll region can be bounded, and in a block parent
|
|
64
|
+
// that resolves to content height — the table grows past the panel and
|
|
65
|
+
// nothing scrolls.
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex h-full min-h-0 flex-col ${className ?? ""}`, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
+
DataTable.DataTable,
|
|
68
|
+
{
|
|
69
|
+
data: filteredEntries,
|
|
70
|
+
columns: COLS,
|
|
71
|
+
autoFilter: true,
|
|
72
|
+
showGlobalFilter: search === void 0,
|
|
73
|
+
globalFilterPlaceholder: "Filter URL, method, or body…",
|
|
74
|
+
defaultSort: { key: "time", dir: "asc" },
|
|
75
|
+
emptyMessage: emptyLabel,
|
|
76
|
+
getRowId: (entry, index) => `${entry.startedDateTime ?? index}-${entry.request.method}-${entry.request.url}-${entry.time}`,
|
|
77
|
+
renderExpandedRow: (entry) => /* @__PURE__ */ jsxRuntime.jsx(HarRowDetails, { entry })
|
|
78
|
+
}
|
|
79
|
+
) })
|
|
80
|
+
);
|
|
75
81
|
}
|
|
76
82
|
function HarRowDetails({ entry }) {
|
|
77
83
|
var _a, _b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HarPanel.cjs","sources":["../../../src/data/har/HarPanel.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { DataTable, type DataTableColumn } from \"../DataTable\";\nimport { JsonView } from \"../JsonView\";\nimport type { HAREntry } from \"./types\";\n\nexport type HarPanelProps = {\n /** HAR entries to render. */\n entries: HAREntry[];\n /** Optional external search term. When omitted, the internal DataTable search is shown. */\n search?: string;\n /** Empty-state label for no entries or no matches. */\n emptyLabel?: string;\n /** Classes applied to the panel root. */\n className?: string;\n};\n\nconst COLS: DataTableColumn<HAREntry>[] = [\n {\n key: \"request.method\",\n label: \"Method\",\n shrink: true,\n },\n {\n key: \"request.url\",\n label: \"URL\",\n grow: true,\n render: (value) => <span title={String(value ?? \"\")}>{String(value ?? \"\")}</span>,\n },\n {\n key: \"response.status\",\n label: \"Status\",\n shrink: true,\n render: (value) => (\n <span className={statusColor(Number(value ?? 0))}>{String(value ?? \"\")}</span>\n ),\n sortValue: (value) => Number(value ?? 0),\n },\n {\n key: \"time\",\n label: \"Time\",\n align: \"right\",\n shrink: true,\n render: (value) => `${Number(value ?? 0).toFixed(0)}ms`,\n sortValue: (value) => Number(value ?? 0),\n },\n {\n key: \"response.bodySize\",\n label: \"Size\",\n align: \"right\",\n shrink: true,\n render: (value) => formatBytes(Number(value ?? 0)),\n sortValue: (value) => Number(value ?? 0),\n },\n {\n key: \"response.content.mimeType\",\n label: \"Type\",\n shrink: true,\n },\n];\n\nexport function HarPanel({\n entries,\n search,\n emptyLabel = \"No HTTP traffic captured\",\n className,\n}: HarPanelProps) {\n const filteredEntries = useMemo(() => {\n if (search === undefined || search.trim() === \"\") return entries;\n return entries.filter((entry) => matchesSearch(search.trim().toLowerCase(), entry));\n }, [entries, search]);\n\n if (!entries || entries.length === 0) {\n return (\n <div className=\"p-density-6 text-center text-muted-foreground text-sm\">{emptyLabel}</div>\n );\n }\n\n return (\n <div className={`h-full ${className ?? \"\"}`}>\n <DataTable\n data={filteredEntries}\n columns={COLS}\n autoFilter\n showGlobalFilter={search === undefined}\n globalFilterPlaceholder=\"Filter URL, method, or body…\"\n defaultSort={{ key: \"time\", dir: \"asc\" }}\n emptyMessage={emptyLabel}\n getRowId={(entry, index) =>\n `${entry.startedDateTime ?? index}-${entry.request.method}-${entry.request.url}-${entry.time}`\n }\n renderExpandedRow={(entry) => <HarRowDetails entry={entry} />}\n />\n </div>\n );\n}\n\nfunction HarRowDetails({ entry }: { entry: HAREntry }) {\n return (\n <>\n <div className=\"grid grid-cols-2 gap-density-4\">\n <div>\n <HeaderList\n title=\"Request Headers\"\n {...(entry.request.headers ? { headers: entry.request.headers } : {})}\n />\n {entry.request.postData?.text && (\n <div className=\"mt-density-2\">\n <div className=\"font-semibold text-foreground mb-1\">Request Body</div>\n <div className=\"bg-background p-density-2 rounded border border-border overflow-auto max-h-48\">\n <BodyView\n text={entry.request.postData.text}\n {...(entry.request.postData.mimeType\n ? { mimeType: entry.request.postData.mimeType }\n : {})}\n />\n </div>\n </div>\n )}\n </div>\n <div>\n <HeaderList\n title=\"Response Headers\"\n {...(entry.response.headers ? { headers: entry.response.headers } : {})}\n />\n </div>\n </div>\n {entry.response.content?.text && (\n <div className=\"mt-density-3\">\n <div className=\"font-semibold text-foreground mb-1\">Response Body</div>\n <div className=\"bg-background p-density-2 rounded border border-border overflow-auto max-h-64\">\n <BodyView\n text={entry.response.content.text}\n {...(entry.response.content.mimeType\n ? { mimeType: entry.response.content.mimeType }\n : {})}\n />\n </div>\n </div>\n )}\n </>\n );\n}\n\nfunction HeaderList({\n title,\n headers,\n}: {\n title: string;\n headers?: { name: string; value: string }[];\n}) {\n return (\n <>\n <div className=\"font-semibold text-foreground mb-1\">{title}</div>\n <div className=\"space-y-0.5\">\n {headers?.map((h, i) => (\n <div key={i} className=\"whitespace-nowrap\">\n <span className=\"text-purple-600 dark:text-purple-400\">{h.name}:</span> {h.value}\n </div>\n ))}\n </div>\n </>\n );\n}\n\nfunction BodyView({ text, mimeType }: { text: string; mimeType?: string }) {\n if (isJsonType(mimeType)) {\n const parsed = tryParseJson(text);\n if (parsed !== null) return <JsonView data={parsed} />;\n }\n return <pre className=\"whitespace-pre-wrap break-all\">{text}</pre>;\n}\n\nfunction tryParseJson(text: string): unknown | null {\n try {\n return JSON.parse(text);\n } catch {\n return null;\n }\n}\n\nfunction isJsonType(mime?: string): boolean {\n return !!mime && (mime.includes(\"json\") || mime.includes(\"javascript\"));\n}\n\nfunction matchesSearch(needle: string, entry: HAREntry): boolean {\n return [\n entry.request.method,\n entry.request.url,\n entry.request.postData?.text,\n entry.response.content?.text,\n ].some((value) => !!value && value.toLowerCase().includes(needle));\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 0) return \"\";\n if (bytes < 1024) return `${bytes}B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;\n return `${(bytes / 1024 / 1024).toFixed(1)}MB`;\n}\n\nfunction statusColor(status: number): string {\n if (status >= 500) return \"text-red-600\";\n if (status >= 400) return \"text-amber-600\";\n if (status >= 300) return \"text-blue-600\";\n if (status >= 200) return \"text-green-600\";\n return \"text-muted-foreground\";\n}\n"],"names":["jsx","useMemo","DataTable","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AAC;AAC5C;AAEA,SAAS,YAAY,QAAwB;AAC3C,MAAI,UAAU,IAAK,QAAO;AAC1B,MAAI,UAAU,IAAK,QAAO;AAC1B,MAAI,UAAU,IAAK,QAAO;AAC1B,MAAI,UAAU,IAAK,QAAO;AAC1B,SAAO;AACT;;"}
|
|
1
|
+
{"version":3,"file":"HarPanel.cjs","sources":["../../../src/data/har/HarPanel.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { DataTable, type DataTableColumn } from \"../DataTable\";\nimport { JsonView } from \"../JsonView\";\nimport type { HAREntry } from \"./types\";\n\nexport type HarPanelProps = {\n /** HAR entries to render. */\n entries: HAREntry[];\n /** Optional external search term. When omitted, the internal DataTable search is shown. */\n search?: string;\n /** Empty-state label for no entries or no matches. */\n emptyLabel?: string;\n /** Classes applied to the panel root. */\n className?: string;\n};\n\nconst COLS: DataTableColumn<HAREntry>[] = [\n {\n key: \"request.method\",\n label: \"Method\",\n shrink: true,\n },\n {\n key: \"request.url\",\n label: \"URL\",\n grow: true,\n render: (value) => <span title={String(value ?? \"\")}>{String(value ?? \"\")}</span>,\n },\n {\n key: \"response.status\",\n label: \"Status\",\n shrink: true,\n render: (value) => (\n <span className={statusColor(Number(value ?? 0))}>{String(value ?? \"\")}</span>\n ),\n sortValue: (value) => Number(value ?? 0),\n },\n {\n key: \"time\",\n label: \"Time\",\n align: \"right\",\n shrink: true,\n render: (value) => `${Number(value ?? 0).toFixed(0)}ms`,\n sortValue: (value) => Number(value ?? 0),\n },\n {\n key: \"response.bodySize\",\n label: \"Size\",\n align: \"right\",\n shrink: true,\n render: (value) => formatBytes(Number(value ?? 0)),\n sortValue: (value) => Number(value ?? 0),\n },\n {\n key: \"response.content.mimeType\",\n label: \"Type\",\n shrink: true,\n },\n];\n\nexport function HarPanel({\n entries,\n search,\n emptyLabel = \"No HTTP traffic captured\",\n className,\n}: HarPanelProps) {\n const filteredEntries = useMemo(() => {\n if (search === undefined || search.trim() === \"\") return entries;\n return entries.filter((entry) => matchesSearch(search.trim().toLowerCase(), entry));\n }, [entries, search]);\n\n if (!entries || entries.length === 0) {\n return (\n <div className=\"p-density-6 text-center text-muted-foreground text-sm\">{emptyLabel}</div>\n );\n }\n\n return (\n // A flex column, not a plain block: DataTable sizes itself as `flex-1\n // min-h-0` so its own scroll region can be bounded, and in a block parent\n // that resolves to content height — the table grows past the panel and\n // nothing scrolls.\n <div className={`flex h-full min-h-0 flex-col ${className ?? \"\"}`}>\n <DataTable\n data={filteredEntries}\n columns={COLS}\n autoFilter\n showGlobalFilter={search === undefined}\n globalFilterPlaceholder=\"Filter URL, method, or body…\"\n defaultSort={{ key: \"time\", dir: \"asc\" }}\n emptyMessage={emptyLabel}\n getRowId={(entry, index) =>\n `${entry.startedDateTime ?? index}-${entry.request.method}-${entry.request.url}-${entry.time}`\n }\n renderExpandedRow={(entry) => <HarRowDetails entry={entry} />}\n />\n </div>\n );\n}\n\nfunction HarRowDetails({ entry }: { entry: HAREntry }) {\n return (\n <>\n <div className=\"grid grid-cols-2 gap-density-4\">\n <div>\n <HeaderList\n title=\"Request Headers\"\n {...(entry.request.headers ? { headers: entry.request.headers } : {})}\n />\n {entry.request.postData?.text && (\n <div className=\"mt-density-2\">\n <div className=\"font-semibold text-foreground mb-1\">Request Body</div>\n <div className=\"bg-background p-density-2 rounded border border-border overflow-auto max-h-48\">\n <BodyView\n text={entry.request.postData.text}\n {...(entry.request.postData.mimeType\n ? { mimeType: entry.request.postData.mimeType }\n : {})}\n />\n </div>\n </div>\n )}\n </div>\n <div>\n <HeaderList\n title=\"Response Headers\"\n {...(entry.response.headers ? { headers: entry.response.headers } : {})}\n />\n </div>\n </div>\n {entry.response.content?.text && (\n <div className=\"mt-density-3\">\n <div className=\"font-semibold text-foreground mb-1\">Response Body</div>\n <div className=\"bg-background p-density-2 rounded border border-border overflow-auto max-h-64\">\n <BodyView\n text={entry.response.content.text}\n {...(entry.response.content.mimeType\n ? { mimeType: entry.response.content.mimeType }\n : {})}\n />\n </div>\n </div>\n )}\n </>\n );\n}\n\nfunction HeaderList({\n title,\n headers,\n}: {\n title: string;\n headers?: { name: string; value: string }[];\n}) {\n return (\n <>\n <div className=\"font-semibold text-foreground mb-1\">{title}</div>\n <div className=\"space-y-0.5\">\n {headers?.map((h, i) => (\n <div key={i} className=\"whitespace-nowrap\">\n <span className=\"text-purple-600 dark:text-purple-400\">{h.name}:</span> {h.value}\n </div>\n ))}\n </div>\n </>\n );\n}\n\nfunction BodyView({ text, mimeType }: { text: string; mimeType?: string }) {\n if (isJsonType(mimeType)) {\n const parsed = tryParseJson(text);\n if (parsed !== null) return <JsonView data={parsed} />;\n }\n return <pre className=\"whitespace-pre-wrap break-all\">{text}</pre>;\n}\n\nfunction tryParseJson(text: string): unknown | null {\n try {\n return JSON.parse(text);\n } catch {\n return null;\n }\n}\n\nfunction isJsonType(mime?: string): boolean {\n return !!mime && (mime.includes(\"json\") || mime.includes(\"javascript\"));\n}\n\nfunction matchesSearch(needle: string, entry: HAREntry): boolean {\n return [\n entry.request.method,\n entry.request.url,\n entry.request.postData?.text,\n entry.response.content?.text,\n ].some((value) => !!value && value.toLowerCase().includes(needle));\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 0) return \"\";\n if (bytes < 1024) return `${bytes}B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;\n return `${(bytes / 1024 / 1024).toFixed(1)}MB`;\n}\n\nfunction statusColor(status: number): string {\n if (status >= 500) return \"text-red-600\";\n if (status >= 400) return \"text-amber-600\";\n if (status >= 300) return \"text-blue-600\";\n if (status >= 200) return \"text-green-600\";\n return \"text-muted-foreground\";\n}\n"],"names":["jsx","useMemo","DataTable","jsxs","Fragment","JsonView"],"mappings":";;;;;;AAgBA,MAAM,OAAoC;AAAA,EACxC;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,IACP,QAAQ;AAAA,EAAA;AAAA,EAEV;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM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