@flanksource/clicky-ui 0.3.64 → 0.3.66
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 +4 -2
- package/dist/comments/CommentAuthor.cjs +6 -1
- package/dist/comments/CommentAuthor.cjs.map +1 -1
- package/dist/comments/CommentAuthor.d.ts.map +1 -1
- package/dist/comments/CommentAuthor.js +8 -3
- package/dist/comments/CommentAuthor.js.map +1 -1
- package/dist/comments/CommentComposer.cjs +4 -1
- package/dist/comments/CommentComposer.cjs.map +1 -1
- package/dist/comments/CommentComposer.d.ts.map +1 -1
- package/dist/comments/CommentComposer.js +4 -1
- package/dist/comments/CommentComposer.js.map +1 -1
- package/dist/comments/CommentEditor.cjs +3 -6
- package/dist/comments/CommentEditor.cjs.map +1 -1
- package/dist/comments/CommentEditor.d.ts.map +1 -1
- package/dist/comments/CommentEditor.js +3 -6
- package/dist/comments/CommentEditor.js.map +1 -1
- package/dist/comments/CommentProvider.cjs +3 -1
- package/dist/comments/CommentProvider.cjs.map +1 -1
- package/dist/comments/CommentProvider.d.ts +2 -0
- package/dist/comments/CommentProvider.d.ts.map +1 -1
- package/dist/comments/CommentProvider.js +3 -1
- package/dist/comments/CommentProvider.js.map +1 -1
- package/dist/comments/CommentRail.cjs +31 -18
- package/dist/comments/CommentRail.cjs.map +1 -1
- package/dist/comments/CommentRail.d.ts.map +1 -1
- package/dist/comments/CommentRail.js +31 -18
- package/dist/comments/CommentRail.js.map +1 -1
- package/dist/comments/agent-delivery.cjs +1 -2
- package/dist/comments/agent-delivery.cjs.map +1 -1
- package/dist/comments/agent-delivery.d.ts +1 -1
- package/dist/comments/agent-delivery.d.ts.map +1 -1
- package/dist/comments/agent-delivery.js +1 -2
- package/dist/comments/agent-delivery.js.map +1 -1
- package/dist/comments/annotation-types.d.ts +16 -0
- package/dist/comments/annotation-types.d.ts.map +1 -1
- package/dist/comments/comment-context.cjs.map +1 -1
- package/dist/comments/comment-context.d.ts +2 -1
- package/dist/comments/comment-context.d.ts.map +1 -1
- package/dist/comments/comment-context.js.map +1 -1
- package/dist/comments/comment-types.cjs.map +1 -1
- package/dist/comments/comment-types.d.ts +10 -1
- package/dist/comments/comment-types.d.ts.map +1 -1
- package/dist/comments/comment-types.js.map +1 -1
- package/dist/comments/gavel/CommentAgentSessions.cjs +55 -44
- package/dist/comments/gavel/CommentAgentSessions.cjs.map +1 -1
- package/dist/comments/gavel/CommentAgentSessions.d.ts +5 -2
- package/dist/comments/gavel/CommentAgentSessions.d.ts.map +1 -1
- package/dist/comments/gavel/CommentAgentSessions.js +55 -44
- package/dist/comments/gavel/CommentAgentSessions.js.map +1 -1
- package/dist/comments/gavel/client.cjs +3 -1
- package/dist/comments/gavel/client.cjs.map +1 -1
- package/dist/comments/gavel/client.d.ts.map +1 -1
- package/dist/comments/gavel/client.js +3 -1
- package/dist/comments/gavel/client.js.map +1 -1
- package/dist/comments/gavel/comment-agent-model.cjs +1 -1
- package/dist/comments/gavel/comment-agent-model.cjs.map +1 -1
- package/dist/comments/gavel/comment-agent-model.js +1 -1
- package/dist/comments/gavel/comment-agent-model.js.map +1 -1
- package/dist/comments/gavel/inbox-prompt.cjs +3 -1
- package/dist/comments/gavel/inbox-prompt.cjs.map +1 -1
- package/dist/comments/gavel/inbox-prompt.d.ts.map +1 -1
- package/dist/comments/gavel/inbox-prompt.js +3 -1
- package/dist/comments/gavel/inbox-prompt.js.map +1 -1
- package/dist/comments/gavel/index.d.ts +2 -1
- package/dist/comments/gavel/index.d.ts.map +1 -1
- package/dist/comments/gavel/useGavelComments.cjs +17 -9
- package/dist/comments/gavel/useGavelComments.cjs.map +1 -1
- package/dist/comments/gavel/useGavelComments.d.ts.map +1 -1
- package/dist/comments/gavel/useGavelComments.js +18 -10
- package/dist/comments/gavel/useGavelComments.js.map +1 -1
- package/dist/comments-gavel.cjs +4 -0
- package/dist/comments-gavel.js +3 -1
- package/dist/comments.d.ts +1 -1
- package/dist/comments.d.ts.map +1 -1
- package/dist/components/FilterBar.cjs +12 -5
- package/dist/components/FilterBar.cjs.map +1 -1
- package/dist/components/FilterBar.d.ts.map +1 -1
- package/dist/components/FilterBar.js +12 -5
- package/dist/components/FilterBar.js.map +1 -1
- package/dist/components/JsonSchemaForm.cjs +4 -1
- package/dist/components/JsonSchemaForm.cjs.map +1 -1
- package/dist/components/JsonSchemaForm.d.ts.map +1 -1
- package/dist/components/JsonSchemaForm.js +4 -1
- package/dist/components/JsonSchemaForm.js.map +1 -1
- package/dist/components/SecretFormField.cjs +3 -0
- package/dist/components/SecretFormField.cjs.map +1 -1
- package/dist/components/SecretFormField.d.ts.map +1 -1
- package/dist/components/SecretFormField.js +3 -0
- package/dist/components/SecretFormField.js.map +1 -1
- package/dist/components/SecretKeySelector.cjs +28 -2
- package/dist/components/SecretKeySelector.cjs.map +1 -1
- package/dist/components/SecretKeySelector.d.ts +7 -1
- package/dist/components/SecretKeySelector.d.ts.map +1 -1
- package/dist/components/SecretKeySelector.js +28 -2
- package/dist/components/SecretKeySelector.js.map +1 -1
- package/dist/components/SegmentedControl.cjs +4 -1
- package/dist/components/SegmentedControl.cjs.map +1 -1
- package/dist/components/SegmentedControl.d.ts +3 -3
- package/dist/components/SegmentedControl.d.ts.map +1 -1
- package/dist/components/SegmentedControl.js +5 -2
- package/dist/components/SegmentedControl.js.map +1 -1
- package/dist/components/WorkspaceAccessDialog.cjs +273 -99
- package/dist/components/WorkspaceAccessDialog.cjs.map +1 -1
- package/dist/components/WorkspaceAccessDialog.d.ts +4 -2
- package/dist/components/WorkspaceAccessDialog.d.ts.map +1 -1
- package/dist/components/WorkspaceAccessDialog.js +275 -101
- package/dist/components/WorkspaceAccessDialog.js.map +1 -1
- package/dist/components/json-schema-form-accordion-array.cjs +5 -3
- package/dist/components/json-schema-form-accordion-array.cjs.map +1 -1
- package/dist/components/json-schema-form-accordion-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-accordion-array.js +7 -5
- package/dist/components/json-schema-form-accordion-array.js.map +1 -1
- package/dist/components/json-schema-form-cards-array.cjs +1 -0
- package/dist/components/json-schema-form-cards-array.cjs.map +1 -1
- package/dist/components/json-schema-form-cards-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-cards-array.js +2 -1
- package/dist/components/json-schema-form-cards-array.js.map +1 -1
- package/dist/components/json-schema-form-conditionals.cjs +1 -4
- package/dist/components/json-schema-form-conditionals.cjs.map +1 -1
- package/dist/components/json-schema-form-conditionals.d.ts.map +1 -1
- package/dist/components/json-schema-form-conditionals.js +1 -4
- package/dist/components/json-schema-form-conditionals.js.map +1 -1
- package/dist/components/json-schema-form-enum-choice.cjs +4 -3
- package/dist/components/json-schema-form-enum-choice.cjs.map +1 -1
- package/dist/components/json-schema-form-enum-choice.d.ts.map +1 -1
- package/dist/components/json-schema-form-enum-choice.js +4 -3
- package/dist/components/json-schema-form-enum-choice.js.map +1 -1
- package/dist/components/json-schema-form-item-row.cjs +4 -0
- package/dist/components/json-schema-form-item-row.cjs.map +1 -1
- package/dist/components/json-schema-form-item-row.d.ts +3 -0
- package/dist/components/json-schema-form-item-row.d.ts.map +1 -1
- package/dist/components/json-schema-form-item-row.js +5 -2
- package/dist/components/json-schema-form-item-row.js.map +1 -1
- package/dist/components/json-schema-form-item-summary.cjs +10 -0
- package/dist/components/json-schema-form-item-summary.cjs.map +1 -1
- package/dist/components/json-schema-form-item-summary.d.ts +1 -0
- package/dist/components/json-schema-form-item-summary.d.ts.map +1 -1
- package/dist/components/json-schema-form-item-summary.js +10 -1
- package/dist/components/json-schema-form-item-summary.js.map +1 -1
- package/dist/components/json-schema-form-listeners.cjs +1 -5
- package/dist/components/json-schema-form-listeners.cjs.map +1 -1
- package/dist/components/json-schema-form-listeners.js +1 -5
- package/dist/components/json-schema-form-listeners.js.map +1 -1
- package/dist/components/json-schema-form-refs.cjs +29 -4
- package/dist/components/json-schema-form-refs.cjs.map +1 -1
- package/dist/components/json-schema-form-refs.js +29 -4
- package/dist/components/json-schema-form-refs.js.map +1 -1
- package/dist/components/json-schema-form-render.cjs +39 -16
- package/dist/components/json-schema-form-render.cjs.map +1 -1
- package/dist/components/json-schema-form-render.d.ts.map +1 -1
- package/dist/components/json-schema-form-render.js +40 -17
- package/dist/components/json-schema-form-render.js.map +1 -1
- package/dist/components/json-schema-form-resolve.cjs +3 -1
- package/dist/components/json-schema-form-resolve.cjs.map +1 -1
- package/dist/components/json-schema-form-resolve.d.ts.map +1 -1
- package/dist/components/json-schema-form-resolve.js +3 -1
- package/dist/components/json-schema-form-resolve.js.map +1 -1
- package/dist/components/json-schema-form-runtime-types.d.ts +8 -0
- package/dist/components/json-schema-form-runtime-types.d.ts.map +1 -1
- package/dist/components/json-schema-form-table-array.cjs +1 -1
- package/dist/components/json-schema-form-table-array.cjs.map +1 -1
- package/dist/components/json-schema-form-table-array.js +2 -2
- package/dist/components/json-schema-form-table-array.js.map +1 -1
- package/dist/components/json-schema-form-types.d.ts +6 -0
- package/dist/components/json-schema-form-types.d.ts.map +1 -1
- package/dist/components/json-schema-form-utils.cjs +12 -3
- package/dist/components/json-schema-form-utils.cjs.map +1 -1
- package/dist/components/json-schema-form-utils.d.ts +4 -1
- package/dist/components/json-schema-form-utils.d.ts.map +1 -1
- package/dist/components/json-schema-form-utils.js +12 -3
- package/dist/components/json-schema-form-utils.js.map +1 -1
- package/dist/components/secret-form-extension.cjs.map +1 -1
- package/dist/components/secret-form-extension.d.ts +2 -0
- package/dist/components/secret-form-extension.d.ts.map +1 -1
- package/dist/components/secret-form-extension.js.map +1 -1
- package/dist/components/useSingleRowTagCount.cjs +16 -13
- package/dist/components/useSingleRowTagCount.cjs.map +1 -1
- package/dist/components/useSingleRowTagCount.d.ts +0 -5
- package/dist/components/useSingleRowTagCount.d.ts.map +1 -1
- package/dist/components/useSingleRowTagCount.js +16 -13
- package/dist/components/useSingleRowTagCount.js.map +1 -1
- package/dist/components.cjs +4 -0
- package/dist/components.d.ts +2 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +3 -1
- package/dist/connections/connectionSchemaFormExtensions.cjs +13 -2
- package/dist/connections/connectionSchemaFormExtensions.cjs.map +1 -1
- package/dist/connections/connectionSchemaFormExtensions.d.ts.map +1 -1
- package/dist/connections/connectionSchemaFormExtensions.js +13 -2
- package/dist/connections/connectionSchemaFormExtensions.js.map +1 -1
- package/dist/data/DataTable.cjs +128 -82
- package/dist/data/DataTable.cjs.map +1 -1
- package/dist/data/DataTable.d.ts +29 -0
- package/dist/data/DataTable.d.ts.map +1 -1
- package/dist/data/DataTable.js +129 -83
- package/dist/data/DataTable.js.map +1 -1
- package/dist/data/DataTableList.cjs +43 -0
- package/dist/data/DataTableList.cjs.map +1 -0
- package/dist/data/DataTableList.d.ts +13 -0
- package/dist/data/DataTableList.d.ts.map +1 -0
- package/dist/data/DataTableList.js +43 -0
- package/dist/data/DataTableList.js.map +1 -0
- package/dist/data/DataTableOverflowCue.cjs +18 -8
- package/dist/data/DataTableOverflowCue.cjs.map +1 -1
- package/dist/data/DataTableOverflowCue.d.ts.map +1 -1
- package/dist/data/DataTableOverflowCue.js +18 -8
- package/dist/data/DataTableOverflowCue.js.map +1 -1
- package/dist/data/Markdown.cjs +11 -1
- package/dist/data/Markdown.cjs.map +1 -1
- package/dist/data/Markdown.d.ts.map +1 -1
- package/dist/data/Markdown.js +11 -1
- package/dist/data/Markdown.js.map +1 -1
- package/dist/data/PromptBanner.cjs +13 -4
- package/dist/data/PromptBanner.cjs.map +1 -1
- package/dist/data/PromptBanner.d.ts.map +1 -1
- package/dist/data/PromptBanner.js +13 -4
- package/dist/data/PromptBanner.js.map +1 -1
- package/dist/data/SelectionActionBar.cjs +20 -5
- package/dist/data/SelectionActionBar.cjs.map +1 -1
- package/dist/data/SelectionActionBar.d.ts +6 -1
- package/dist/data/SelectionActionBar.d.ts.map +1 -1
- package/dist/data/SelectionActionBar.js +20 -5
- package/dist/data/SelectionActionBar.js.map +1 -1
- package/dist/data/StatStrip.cjs +12 -4
- package/dist/data/StatStrip.cjs.map +1 -1
- package/dist/data/StatStrip.d.ts +0 -8
- package/dist/data/StatStrip.d.ts.map +1 -1
- package/dist/data/StatStrip.js +12 -4
- package/dist/data/StatStrip.js.map +1 -1
- package/dist/data/TaskManager.cjs +173 -53
- package/dist/data/TaskManager.cjs.map +1 -1
- package/dist/data/TaskManager.d.ts +9 -1
- package/dist/data/TaskManager.d.ts.map +1 -1
- package/dist/data/TaskManager.js +175 -55
- package/dist/data/TaskManager.js.map +1 -1
- package/dist/data/TaskPoolUsage.cjs +65 -1
- package/dist/data/TaskPoolUsage.cjs.map +1 -1
- package/dist/data/TaskPoolUsage.d.ts +19 -1
- package/dist/data/TaskPoolUsage.d.ts.map +1 -1
- package/dist/data/TaskPoolUsage.js +65 -2
- package/dist/data/TaskPoolUsage.js.map +1 -1
- package/dist/data/ai/SessionInspector.cjs +24 -14
- package/dist/data/ai/SessionInspector.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.collection.cjs +9 -7
- package/dist/data/ai/SessionInspector.collection.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.collection.d.ts +1 -1
- package/dist/data/ai/SessionInspector.collection.d.ts.map +1 -1
- package/dist/data/ai/SessionInspector.collection.js +9 -7
- package/dist/data/ai/SessionInspector.collection.js.map +1 -1
- package/dist/data/ai/SessionInspector.d.ts +8 -3
- package/dist/data/ai/SessionInspector.d.ts.map +1 -1
- package/dist/data/ai/SessionInspector.hierarchy-state.cjs +5 -4
- package/dist/data/ai/SessionInspector.hierarchy-state.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.hierarchy-state.js +6 -5
- package/dist/data/ai/SessionInspector.hierarchy-state.js.map +1 -1
- package/dist/data/ai/SessionInspector.host-tabs.cjs +28 -0
- package/dist/data/ai/SessionInspector.host-tabs.cjs.map +1 -0
- package/dist/data/ai/SessionInspector.host-tabs.d.ts +17 -0
- package/dist/data/ai/SessionInspector.host-tabs.d.ts.map +1 -0
- package/dist/data/ai/SessionInspector.host-tabs.js +28 -0
- package/dist/data/ai/SessionInspector.host-tabs.js.map +1 -0
- package/dist/data/ai/SessionInspector.js +24 -14
- package/dist/data/ai/SessionInspector.js.map +1 -1
- package/dist/data/ai/SessionInspector.legacy.cjs +13 -6
- package/dist/data/ai/SessionInspector.legacy.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.legacy.d.ts +3 -1
- package/dist/data/ai/SessionInspector.legacy.d.ts.map +1 -1
- package/dist/data/ai/SessionInspector.legacy.js +13 -6
- package/dist/data/ai/SessionInspector.legacy.js.map +1 -1
- package/dist/data/ai/SessionInspector.remote.cjs +7 -3
- package/dist/data/ai/SessionInspector.remote.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.remote.d.ts +1 -1
- package/dist/data/ai/SessionInspector.remote.d.ts.map +1 -1
- package/dist/data/ai/SessionInspector.remote.js +8 -4
- package/dist/data/ai/SessionInspector.remote.js.map +1 -1
- package/dist/data/ai/SessionViewer.input.cjs +78 -1
- package/dist/data/ai/SessionViewer.input.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.input.d.ts +9 -0
- package/dist/data/ai/SessionViewer.input.d.ts.map +1 -1
- package/dist/data/ai/SessionViewer.input.js +77 -2
- package/dist/data/ai/SessionViewer.input.js.map +1 -1
- package/dist/data/ai/SessionViewer.tool-details.cjs +44 -13
- package/dist/data/ai/SessionViewer.tool-details.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.tool-details.d.ts +7 -1
- package/dist/data/ai/SessionViewer.tool-details.d.ts.map +1 -1
- package/dist/data/ai/SessionViewer.tool-details.js +44 -13
- package/dist/data/ai/SessionViewer.tool-details.js.map +1 -1
- package/dist/data/ai/SessionViewer.tool-row.cjs +7 -3
- package/dist/data/ai/SessionViewer.tool-row.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.tool-row.d.ts.map +1 -1
- package/dist/data/ai/SessionViewer.tool-row.js +8 -4
- package/dist/data/ai/SessionViewer.tool-row.js.map +1 -1
- package/dist/data/ai/index.d.ts +1 -1
- package/dist/data/ai/index.d.ts.map +1 -1
- package/dist/data/ai/runtime-preset-menu/use-runtime-preset-menu.cjs +5 -2
- package/dist/data/ai/runtime-preset-menu/use-runtime-preset-menu.cjs.map +1 -1
- package/dist/data/ai/runtime-preset-menu/use-runtime-preset-menu.d.ts.map +1 -1
- package/dist/data/ai/runtime-preset-menu/use-runtime-preset-menu.js +6 -3
- package/dist/data/ai/runtime-preset-menu/use-runtime-preset-menu.js.map +1 -1
- package/dist/data/ai/runtime-profiles/RuntimeProfilesWorkspace.cjs +2 -1
- package/dist/data/ai/runtime-profiles/RuntimeProfilesWorkspace.cjs.map +1 -1
- package/dist/data/ai/runtime-profiles/RuntimeProfilesWorkspace.d.ts.map +1 -1
- package/dist/data/ai/runtime-profiles/RuntimeProfilesWorkspace.js +2 -1
- package/dist/data/ai/runtime-profiles/RuntimeProfilesWorkspace.js.map +1 -1
- package/dist/data/ai/runtime-profiles/use-runtime-profile-picker.cjs +2 -1
- package/dist/data/ai/runtime-profiles/use-runtime-profile-picker.cjs.map +1 -1
- package/dist/data/ai/runtime-profiles/use-runtime-profile-picker.d.ts.map +1 -1
- package/dist/data/ai/runtime-profiles/use-runtime-profile-picker.js +2 -1
- package/dist/data/ai/runtime-profiles/use-runtime-profile-picker.js.map +1 -1
- package/dist/data/ai/use-session-scroll.cjs +120 -41
- package/dist/data/ai/use-session-scroll.cjs.map +1 -1
- package/dist/data/ai/use-session-scroll.d.ts +3 -3
- package/dist/data/ai/use-session-scroll.d.ts.map +1 -1
- package/dist/data/ai/use-session-scroll.js +120 -41
- package/dist/data/ai/use-session-scroll.js.map +1 -1
- package/dist/data/cells/timestamp-format.cjs +57 -2
- package/dist/data/cells/timestamp-format.cjs.map +1 -1
- package/dist/data/cells/timestamp-format.d.ts +16 -2
- package/dist/data/cells/timestamp-format.d.ts.map +1 -1
- package/dist/data/cells/timestamp-format.js +56 -3
- package/dist/data/cells/timestamp-format.js.map +1 -1
- package/dist/data/chat/AgentIdentity.cjs +10 -3
- package/dist/data/chat/AgentIdentity.cjs.map +1 -1
- package/dist/data/chat/AgentIdentity.d.ts +2 -1
- package/dist/data/chat/AgentIdentity.d.ts.map +1 -1
- package/dist/data/chat/AgentIdentity.js +10 -3
- package/dist/data/chat/AgentIdentity.js.map +1 -1
- package/dist/data/chat/Conversation.cjs +14 -5
- package/dist/data/chat/Conversation.cjs.map +1 -1
- package/dist/data/chat/Conversation.d.ts.map +1 -1
- package/dist/data/chat/Conversation.js +14 -5
- package/dist/data/chat/Conversation.js.map +1 -1
- package/dist/data/data-table-list.cjs +24 -0
- package/dist/data/data-table-list.cjs.map +1 -0
- package/dist/data/data-table-list.d.ts +31 -0
- package/dist/data/data-table-list.d.ts.map +1 -0
- package/dist/data/data-table-list.js +24 -0
- package/dist/data/data-table-list.js.map +1 -0
- package/dist/data/delimited.cjs +48 -0
- package/dist/data/delimited.cjs.map +1 -0
- package/dist/data/delimited.d.ts +10 -0
- package/dist/data/delimited.d.ts.map +1 -0
- package/dist/data/delimited.js +47 -0
- package/dist/data/delimited.js.map +1 -0
- package/dist/data/git/index.d.ts +1 -0
- package/dist/data/git/index.d.ts.map +1 -1
- package/dist/data/git/pickers/GitPickers.cjs +2 -0
- package/dist/data/git/pickers/GitPickers.cjs.map +1 -1
- package/dist/data/git/pickers/GitPickers.d.ts.map +1 -1
- package/dist/data/git/pickers/GitPickers.js +2 -0
- package/dist/data/git/pickers/GitPickers.js.map +1 -1
- package/dist/data/git/pickers/GitSourcePicker.cjs +9 -2
- package/dist/data/git/pickers/GitSourcePicker.cjs.map +1 -1
- package/dist/data/git/pickers/GitSourcePicker.d.ts.map +1 -1
- package/dist/data/git/pickers/GitSourcePicker.js +9 -2
- package/dist/data/git/pickers/GitSourcePicker.js.map +1 -1
- package/dist/data/git/pickers/ReferencePicker.cjs +60 -6
- package/dist/data/git/pickers/ReferencePicker.cjs.map +1 -1
- package/dist/data/git/pickers/ReferencePicker.d.ts +9 -1
- package/dist/data/git/pickers/ReferencePicker.d.ts.map +1 -1
- package/dist/data/git/pickers/ReferencePicker.js +61 -7
- package/dist/data/git/pickers/ReferencePicker.js.map +1 -1
- package/dist/data/git/pickers/git-ref-group-limits.cjs +14 -0
- package/dist/data/git/pickers/git-ref-group-limits.cjs.map +1 -0
- package/dist/data/git/pickers/git-ref-group-limits.d.ts +11 -0
- package/dist/data/git/pickers/git-ref-group-limits.d.ts.map +1 -0
- package/dist/data/git/pickers/git-ref-group-limits.js +14 -0
- package/dist/data/git/pickers/git-ref-group-limits.js.map +1 -0
- package/dist/data/git/pickers/types.d.ts +2 -0
- package/dist/data/git/pickers/types.d.ts.map +1 -1
- package/dist/data/lint/LintList.cjs +154 -0
- package/dist/data/lint/LintList.cjs.map +1 -0
- package/dist/data/lint/LintList.d.ts +14 -0
- package/dist/data/lint/LintList.d.ts.map +1 -0
- package/dist/data/lint/LintList.js +154 -0
- package/dist/data/lint/LintList.js.map +1 -0
- package/dist/data/lint/LintResults.cjs +31 -10
- package/dist/data/lint/LintResults.cjs.map +1 -1
- package/dist/data/lint/LintResults.d.ts +5 -3
- package/dist/data/lint/LintResults.d.ts.map +1 -1
- package/dist/data/lint/LintResults.js +31 -10
- package/dist/data/lint/LintResults.js.map +1 -1
- package/dist/data/lint/actions.cjs +3 -1
- package/dist/data/lint/actions.cjs.map +1 -1
- package/dist/data/lint/actions.d.ts.map +1 -1
- package/dist/data/lint/actions.js +3 -1
- package/dist/data/lint/actions.js.map +1 -1
- package/dist/data/lint/index.d.ts +2 -0
- package/dist/data/lint/index.d.ts.map +1 -1
- package/dist/data/lint/list-grouping.cjs +39 -0
- package/dist/data/lint/list-grouping.cjs.map +1 -0
- package/dist/data/lint/list-grouping.d.ts +20 -0
- package/dist/data/lint/list-grouping.d.ts.map +1 -0
- package/dist/data/lint/list-grouping.js +39 -0
- package/dist/data/lint/list-grouping.js.map +1 -0
- package/dist/data/task-run-format.cjs +20 -0
- package/dist/data/task-run-format.cjs.map +1 -0
- package/dist/data/task-run-format.d.ts +6 -0
- package/dist/data/task-run-format.d.ts.map +1 -0
- package/dist/data/task-run-format.js +20 -0
- package/dist/data/task-run-format.js.map +1 -0
- package/dist/data/test-runner/TestDetailPanel.cjs +15 -4
- package/dist/data/test-runner/TestDetailPanel.cjs.map +1 -1
- package/dist/data/test-runner/TestDetailPanel.d.ts.map +1 -1
- package/dist/data/test-runner/TestDetailPanel.js +16 -5
- package/dist/data/test-runner/TestDetailPanel.js.map +1 -1
- package/dist/data/test-runner/TestList.cjs +87 -0
- package/dist/data/test-runner/TestList.cjs.map +1 -0
- package/dist/data/test-runner/TestList.d.ts +9 -0
- package/dist/data/test-runner/TestList.d.ts.map +1 -0
- package/dist/data/test-runner/TestList.js +87 -0
- package/dist/data/test-runner/TestList.js.map +1 -0
- package/dist/data/test-runner/TestRunner.cjs +21 -2
- package/dist/data/test-runner/TestRunner.cjs.map +1 -1
- package/dist/data/test-runner/TestRunner.d.ts +9 -1
- package/dist/data/test-runner/TestRunner.d.ts.map +1 -1
- package/dist/data/test-runner/TestRunner.js +21 -2
- package/dist/data/test-runner/TestRunner.js.map +1 -1
- package/dist/data/test-runner/TestTreeNode.cjs +1 -1
- package/dist/data/test-runner/TestTreeNode.cjs.map +1 -1
- package/dist/data/test-runner/TestTreeNode.js +1 -1
- package/dist/data/test-runner/TestTreeNode.js.map +1 -1
- package/dist/data/test-runner/TestViewToggle.cjs +32 -0
- package/dist/data/test-runner/TestViewToggle.cjs.map +1 -0
- package/dist/data/test-runner/TestViewToggle.d.ts +5 -0
- package/dist/data/test-runner/TestViewToggle.d.ts.map +1 -0
- package/dist/data/test-runner/TestViewToggle.js +32 -0
- package/dist/data/test-runner/TestViewToggle.js.map +1 -0
- package/dist/data/test-runner/adapter.cjs +14 -0
- package/dist/data/test-runner/adapter.cjs.map +1 -1
- package/dist/data/test-runner/adapter.d.ts +15 -0
- package/dist/data/test-runner/adapter.d.ts.map +1 -1
- package/dist/data/test-runner/adapter.js +14 -0
- package/dist/data/test-runner/adapter.js.map +1 -1
- package/dist/data/test-runner/context.cjs.map +1 -1
- package/dist/data/test-runner/context.d.ts +5 -0
- package/dist/data/test-runner/context.d.ts.map +1 -1
- package/dist/data/test-runner/context.js.map +1 -1
- package/dist/data/test-runner/index.d.ts +3 -0
- package/dist/data/test-runner/index.d.ts.map +1 -1
- package/dist/data/test-runner/status.cjs +5 -0
- package/dist/data/test-runner/status.cjs.map +1 -1
- package/dist/data/test-runner/status.d.ts +2 -0
- package/dist/data/test-runner/status.d.ts.map +1 -1
- package/dist/data/test-runner/status.js +5 -1
- package/dist/data/test-runner/status.js.map +1 -1
- package/dist/data/traces/index.d.ts +2 -1
- package/dist/data/traces/index.d.ts.map +1 -1
- package/dist/data/traces/otel/OtelTraceBrowser.cjs +173 -0
- package/dist/data/traces/otel/OtelTraceBrowser.cjs.map +1 -0
- package/dist/data/traces/otel/OtelTraceBrowser.d.ts +31 -0
- package/dist/data/traces/otel/OtelTraceBrowser.d.ts.map +1 -0
- package/dist/data/traces/otel/OtelTraceBrowser.js +173 -0
- package/dist/data/traces/otel/OtelTraceBrowser.js.map +1 -0
- package/dist/data/traces/otel/OtelTraceDetail.cjs +6 -4
- package/dist/data/traces/otel/OtelTraceDetail.cjs.map +1 -1
- package/dist/data/traces/otel/OtelTraceDetail.d.ts +5 -1
- package/dist/data/traces/otel/OtelTraceDetail.d.ts.map +1 -1
- package/dist/data/traces/otel/OtelTraceDetail.js +6 -4
- package/dist/data/traces/otel/OtelTraceDetail.js.map +1 -1
- package/dist/data/traces/otel/OtelTraceSearch.cjs +2 -1
- package/dist/data/traces/otel/OtelTraceSearch.cjs.map +1 -1
- package/dist/data/traces/otel/OtelTraceSearch.d.ts +3 -1
- package/dist/data/traces/otel/OtelTraceSearch.d.ts.map +1 -1
- package/dist/data/traces/otel/OtelTraceSearch.js +2 -1
- package/dist/data/traces/otel/OtelTraceSearch.js.map +1 -1
- package/dist/data/traces/otel/OtelTraceTable.cjs +62 -6
- package/dist/data/traces/otel/OtelTraceTable.cjs.map +1 -1
- package/dist/data/traces/otel/OtelTraceTable.d.ts +22 -1
- package/dist/data/traces/otel/OtelTraceTable.d.ts.map +1 -1
- package/dist/data/traces/otel/OtelTraceTable.js +62 -6
- package/dist/data/traces/otel/OtelTraceTable.js.map +1 -1
- package/dist/data/traces/otel/QueryBar.cjs +23 -10
- package/dist/data/traces/otel/QueryBar.cjs.map +1 -1
- package/dist/data/traces/otel/QueryBar.d.ts +3 -1
- package/dist/data/traces/otel/QueryBar.d.ts.map +1 -1
- package/dist/data/traces/otel/QueryBar.js +23 -10
- package/dist/data/traces/otel/QueryBar.js.map +1 -1
- package/dist/data/traces/otel/browser-state.cjs +86 -0
- package/dist/data/traces/otel/browser-state.cjs.map +1 -0
- package/dist/data/traces/otel/browser-state.d.ts +22 -0
- package/dist/data/traces/otel/browser-state.d.ts.map +1 -0
- package/dist/data/traces/otel/browser-state.js +83 -0
- package/dist/data/traces/otel/browser-state.js.map +1 -0
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/data.cjs +17 -0
- package/dist/data.d.ts +3 -3
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +10 -3
- package/dist/file-findings/file-review/FileReview.cjs +38 -11
- package/dist/file-findings/file-review/FileReview.cjs.map +1 -1
- package/dist/file-findings/file-review/FileReview.d.ts.map +1 -1
- package/dist/file-findings/file-review/FileReview.js +39 -12
- package/dist/file-findings/file-review/FileReview.js.map +1 -1
- package/dist/file-findings/file-review/geometry.cjs +20 -15
- package/dist/file-findings/file-review/geometry.cjs.map +1 -1
- package/dist/file-findings/file-review/geometry.d.ts +5 -3
- package/dist/file-findings/file-review/geometry.d.ts.map +1 -1
- package/dist/file-findings/file-review/geometry.js +21 -16
- package/dist/file-findings/file-review/geometry.js.map +1 -1
- package/dist/file-findings/file-review/patch-comments.cjs +23 -16
- package/dist/file-findings/file-review/patch-comments.cjs.map +1 -1
- package/dist/file-findings/file-review/patch-comments.d.ts +22 -12
- package/dist/file-findings/file-review/patch-comments.d.ts.map +1 -1
- package/dist/file-findings/file-review/patch-comments.js +23 -17
- package/dist/file-findings/file-review/patch-comments.js.map +1 -1
- package/dist/file-findings/file-review/quote-anchor.cjs +23 -9
- package/dist/file-findings/file-review/quote-anchor.cjs.map +1 -1
- package/dist/file-findings/file-review/quote-anchor.d.ts +12 -2
- package/dist/file-findings/file-review/quote-anchor.d.ts.map +1 -1
- package/dist/file-findings/file-review/quote-anchor.js +22 -9
- package/dist/file-findings/file-review/quote-anchor.js.map +1 -1
- package/dist/file-findings/file-review/selection-lines.cjs +17 -8
- package/dist/file-findings/file-review/selection-lines.cjs.map +1 -1
- package/dist/file-findings/file-review/selection-lines.d.ts +3 -2
- package/dist/file-findings/file-review/selection-lines.d.ts.map +1 -1
- package/dist/file-findings/file-review/selection-lines.js +17 -8
- package/dist/file-findings/file-review/selection-lines.js.map +1 -1
- package/dist/file-findings/file-review/table-cell.cjs +95 -0
- package/dist/file-findings/file-review/table-cell.cjs.map +1 -0
- package/dist/file-findings/file-review/table-cell.d.ts +31 -0
- package/dist/file-findings/file-review/table-cell.d.ts.map +1 -0
- package/dist/file-findings/file-review/table-cell.js +92 -0
- package/dist/file-findings/file-review/table-cell.js.map +1 -0
- package/dist/file-findings.cjs +2 -0
- package/dist/file-findings.d.ts +1 -0
- package/dist/file-findings.d.ts.map +1 -1
- package/dist/file-findings.js +2 -1
- package/dist/icons/components/UiFolderGit.cjs +8 -8
- package/dist/icons/components/UiFolderGit.cjs.map +1 -1
- package/dist/icons/components/UiFolderGit.js +8 -8
- package/dist/icons/components/UiFolderGit.js.map +1 -1
- package/dist/icons/components/UiUserSwitch.cjs +51 -0
- package/dist/icons/components/UiUserSwitch.cjs.map +1 -0
- package/dist/icons/components/UiUserSwitch.d.ts +15 -0
- package/dist/icons/components/UiUserSwitch.d.ts.map +1 -0
- package/dist/icons/components/UiUserSwitch.js +48 -0
- package/dist/icons/components/UiUserSwitch.js.map +1 -0
- package/dist/icons/index.d.ts +2 -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 +3 -0
- package/dist/icons.js +2 -1
- package/dist/index.cjs +23 -0
- package/dist/index.js +13 -3
- package/dist/jvm/model/threads.cjs +1 -1
- package/dist/jvm/model/threads.cjs.map +1 -1
- package/dist/jvm/model/threads.js +1 -1
- package/dist/jvm/model/threads.js.map +1 -1
- package/dist/lib/random-uuid.cjs +12 -0
- package/dist/lib/random-uuid.cjs.map +1 -0
- package/dist/lib/random-uuid.d.ts +2 -0
- package/dist/lib/random-uuid.d.ts.map +1 -0
- package/dist/lib/random-uuid.js +12 -0
- package/dist/lib/random-uuid.js.map +1 -0
- package/dist/overlay/Modal.cjs +22 -11
- package/dist/overlay/Modal.cjs.map +1 -1
- package/dist/overlay/Modal.d.ts +5 -1
- package/dist/overlay/Modal.d.ts.map +1 -1
- package/dist/overlay/Modal.js +22 -11
- package/dist/overlay/Modal.js.map +1 -1
- package/dist/overlay/ModalProvider.cjs +238 -0
- package/dist/overlay/ModalProvider.cjs.map +1 -0
- package/dist/overlay/ModalProvider.d.ts +10 -0
- package/dist/overlay/ModalProvider.d.ts.map +1 -0
- package/dist/overlay/ModalProvider.js +238 -0
- package/dist/overlay/ModalProvider.js.map +1 -0
- package/dist/overlay/modal-context.cjs +12 -0
- package/dist/overlay/modal-context.cjs.map +1 -0
- package/dist/overlay/modal-context.d.ts +46 -0
- package/dist/overlay/modal-context.d.ts.map +1 -0
- package/dist/overlay/modal-context.js +11 -0
- package/dist/overlay/modal-context.js.map +1 -0
- package/dist/overlay/modal-draft-storage.cjs +51 -0
- package/dist/overlay/modal-draft-storage.cjs.map +1 -0
- package/dist/overlay/modal-draft-storage.d.ts +19 -0
- package/dist/overlay/modal-draft-storage.d.ts.map +1 -0
- package/dist/overlay/modal-draft-storage.js +47 -0
- package/dist/overlay/modal-draft-storage.js.map +1 -0
- package/dist/runtime/barrels.json +8696 -8652
- package/dist/runtime/importmap.json +2116 -2103
- package/dist/styles.css +1 -1
- package/dist/utils.cjs +2 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -1
- package/package.json +2 -2
|
@@ -57,8 +57,35 @@ var CONSUMED_INPUT_KEYS = {
|
|
|
57
57
|
"context",
|
|
58
58
|
"description",
|
|
59
59
|
"options"
|
|
60
|
+
],
|
|
61
|
+
ApplyPatch: [
|
|
62
|
+
"input",
|
|
63
|
+
"patch",
|
|
64
|
+
"arguments",
|
|
65
|
+
"files",
|
|
66
|
+
"file_path",
|
|
67
|
+
"operation",
|
|
68
|
+
"to"
|
|
60
69
|
]
|
|
61
70
|
};
|
|
71
|
+
function applyPatchFiles(input) {
|
|
72
|
+
const files = input["files"];
|
|
73
|
+
if (!Array.isArray(files)) return [];
|
|
74
|
+
return files.filter((file) => typeof file === "object" && file !== null);
|
|
75
|
+
}
|
|
76
|
+
function summarizeApplyPatch(input, cwd) {
|
|
77
|
+
const files = applyPatchFiles(input);
|
|
78
|
+
if (files.length > 1) {
|
|
79
|
+
const paths = files.map((file) => relativizePath(file.path ?? "", cwd));
|
|
80
|
+
return `${files.length} files: ${paths.join(", ")}`;
|
|
81
|
+
}
|
|
82
|
+
const path = typeof input["file_path"] === "string" ? input["file_path"] : files[0]?.path;
|
|
83
|
+
if (!path) return "";
|
|
84
|
+
const operation = typeof input["operation"] === "string" ? input["operation"] : files[0]?.op;
|
|
85
|
+
const to = typeof input["to"] === "string" ? input["to"] : files[0]?.move_to;
|
|
86
|
+
const target = to ? ` → ${relativizePath(to, cwd)}` : "";
|
|
87
|
+
return `${operation ? `${operation} ` : ""}${relativizePath(path, cwd)}${target}`;
|
|
88
|
+
}
|
|
62
89
|
/** Flatten a tool's input into JetBrains-style `name: value` inline params:
|
|
63
90
|
* single-line values, cwd-relativized and truncated so the row never wraps. */
|
|
64
91
|
function toolInputParams(tool, input, cwd) {
|
|
@@ -91,7 +118,7 @@ function toolDiff(tool, input) {
|
|
|
91
118
|
if (!segments || segments.length === 0) return void 0;
|
|
92
119
|
const counts = diffCounts(segments);
|
|
93
120
|
if (counts.added === 0 && counts.removed === 0) return void 0;
|
|
94
|
-
const language = require_code_highlight.languageFromPath(str("file_path") || str("notebook_path") || str("path"));
|
|
121
|
+
const language = require_code_highlight.languageFromPath(str("file_path") || str("notebook_path") || str("path") || (applyPatchFiles(input)[0]?.path ?? ""));
|
|
95
122
|
return {
|
|
96
123
|
...counts,
|
|
97
124
|
segments,
|
|
@@ -114,6 +141,10 @@ function toolDiffSegments(tool, input, str) {
|
|
|
114
141
|
modified
|
|
115
142
|
}] : void 0;
|
|
116
143
|
}
|
|
144
|
+
if (tool === "ApplyPatch") return applyPatchFiles(input).map((file) => ({
|
|
145
|
+
original: file.old ?? "",
|
|
146
|
+
modified: file.new ?? file.content ?? ""
|
|
147
|
+
})).filter((segment) => segment.original !== "" || segment.modified !== "");
|
|
117
148
|
if (tool === "MultiEdit") {
|
|
118
149
|
const edits = input["edits"];
|
|
119
150
|
if (!Array.isArray(edits)) return void 0;
|
|
@@ -145,6 +176,7 @@ function summarizeToolInput(tool, input, cwd) {
|
|
|
145
176
|
case "Edit":
|
|
146
177
|
case "MultiEdit":
|
|
147
178
|
case "NotebookEdit": return relativizePath(first("file_path", "notebook_path", "path"), cwd);
|
|
179
|
+
case "ApplyPatch": return summarizeApplyPatch(input, cwd);
|
|
148
180
|
case "Grep": return [str("pattern"), str("path")].filter(Boolean).join(" ");
|
|
149
181
|
case "Glob": return str("pattern");
|
|
150
182
|
case "Task":
|
|
@@ -262,9 +294,54 @@ function stringField(input, key) {
|
|
|
262
294
|
function booleanField(input, key) {
|
|
263
295
|
return input[key] === true;
|
|
264
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* What each question was answered with, read from the question tool's response:
|
|
299
|
+
* Codex's `{"answers":{id:{"answers":[…]}}}`, a plain `{"answers":{id|text: value}}`
|
|
300
|
+
* map, or Claude's `"question"="answer"` text. A question the response does not
|
|
301
|
+
* answer is absent, so the caller can still show the raw response.
|
|
302
|
+
*/
|
|
303
|
+
function answersFromToolResponse(response, questions) {
|
|
304
|
+
const found = /* @__PURE__ */ new Map();
|
|
305
|
+
if (!response) return found;
|
|
306
|
+
const byKey = answerMapFromJson(response) ?? answerMapFromText(response);
|
|
307
|
+
for (const question of questions) {
|
|
308
|
+
const values = byKey.get(question.id) ?? byKey.get(question.text);
|
|
309
|
+
if (values?.length) found.set(question.id, values);
|
|
310
|
+
}
|
|
311
|
+
return found;
|
|
312
|
+
}
|
|
313
|
+
function answerValues(value) {
|
|
314
|
+
if (typeof value === "string") return [value];
|
|
315
|
+
if (Array.isArray(value)) return value.filter((item) => typeof item === "string");
|
|
316
|
+
if (isRecord(value)) return answerValues(value.answers ?? value.answer);
|
|
317
|
+
return [];
|
|
318
|
+
}
|
|
319
|
+
/** The `answers` map of a JSON response, or null when the response is not one. */
|
|
320
|
+
function answerMapFromJson(response) {
|
|
321
|
+
const trimmed = response.trim();
|
|
322
|
+
if (!trimmed.startsWith("{")) return null;
|
|
323
|
+
let parsed;
|
|
324
|
+
try {
|
|
325
|
+
parsed = JSON.parse(trimmed);
|
|
326
|
+
} catch {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
if (!isRecord(parsed) || !isRecord(parsed.answers)) return null;
|
|
330
|
+
return new Map(Object.entries(parsed.answers).map(([key, value]) => [key, answerValues(value)]));
|
|
331
|
+
}
|
|
332
|
+
var QUOTED_ANSWER = /"((?:[^"\\]|\\.)*)"="((?:[^"\\]|\\.)*)"/g;
|
|
333
|
+
function answerMapFromText(response) {
|
|
334
|
+
return new Map([...response.matchAll(QUOTED_ANSWER)].map((match) => [match[1], [match[2]]]));
|
|
335
|
+
}
|
|
336
|
+
/** Whether an answer picked this option; a Claude multi-select answer joins its picks with ", ". */
|
|
337
|
+
function optionAnswered(option, answers) {
|
|
338
|
+
return answers.some((answer) => answer === option.value || answer === option.label || answer.split(", ").includes(option.label));
|
|
339
|
+
}
|
|
265
340
|
function isRecord(value) {
|
|
266
341
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
267
342
|
}
|
|
343
|
+
exports.answersFromToolResponse = answersFromToolResponse;
|
|
344
|
+
exports.optionAnswered = optionAnswered;
|
|
268
345
|
exports.questionsFromApproval = questionsFromApproval;
|
|
269
346
|
exports.questionsFromToolInput = questionsFromToolInput;
|
|
270
347
|
exports.relativizePath = relativizePath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionViewer.input.cjs","names":["stripTrailingSlashes","truncate","computeLineDiff","languageFromPath","splitMcpTool"],"sources":["../../../src/data/ai/SessionViewer.input.ts"],"sourcesContent":["// Presentation helpers for a tool call's input: the one-line summary, the\n// JetBrains-style inline params, the inline shell command, and the line diff\n// for file-writing tools. Pure functions — the viewer renders their output.\n\nimport { computeLineDiff } from \"../code-diff\";\nimport { languageFromPath } from \"../code-highlight\";\nimport { stripTrailingSlashes } from \"../../lib/string\";\nimport { splitMcpTool, truncate } from \"./SessionViewer.model\";\nimport type { ApprovalQuestion } from \"./approval-request\";\n\n/** Strip the event's working directory from an absolute file path. */\nexport function relativizePath(path: string, cwd?: string): string {\n if (!cwd) return path;\n const base = stripTrailingSlashes(cwd);\n return path.startsWith(`${base}/`) ? path.slice(base.length + 1) : path;\n}\n\n/** The raw shell command of a shell-execution tool call, if present. Shell rows\n * render this inline as a bash code block instead of the generic label +\n * tool-input JSON. */\nexport function shellCommand(\n tool: string,\n input?: Record<string, unknown>,\n): string | undefined {\n if (tool !== \"Bash\") return undefined;\n const command = input?.[\"command\"];\n return typeof command === \"string\" && command ? command : undefined;\n}\n\nexport interface ToolParam {\n name: string;\n value: string;\n}\n\nexport interface SessionQuestionOption {\n value: string;\n label: string;\n description?: string;\n}\n\nexport interface SessionQuestion {\n id: string;\n text: string;\n context?: string;\n multiSelect?: boolean;\n isOther?: boolean;\n options: SessionQuestionOption[];\n}\n\n// Keys already rendered elsewhere in the row — the file-path heading, the\n// inline shell command, or the diff — so they don't repeat as inline params.\nconst CONSUMED_INPUT_KEYS: Record<string, readonly string[]> = {\n Bash: [\"command\"],\n Read: [\"file_path\", \"notebook_path\", \"path\"],\n Write: [\"file_path\", \"notebook_path\", \"path\", \"content\"],\n Edit: [\"file_path\", \"notebook_path\", \"path\", \"old_string\", \"new_string\"],\n MultiEdit: [\"file_path\", \"notebook_path\", \"path\", \"edits\"],\n NotebookEdit: [\"file_path\", \"notebook_path\", \"path\"],\n AskUserQuestion: [\"questions\", \"question\", \"prompt\", \"text\", \"header\", \"context\", \"description\", \"options\"],\n};\n\n/** Flatten a tool's input into JetBrains-style `name: value` inline params:\n * single-line values, cwd-relativized and truncated so the row never wraps. */\nexport function toolInputParams(\n tool: string,\n input?: Record<string, unknown>,\n cwd?: string,\n): ToolParam[] {\n const consumed = CONSUMED_INPUT_KEYS[tool] ?? [];\n return Object.entries(input ?? {})\n .filter(\n ([name, value]) =>\n !consumed.includes(name) &&\n value !== undefined &&\n value !== null &&\n value !== \"\",\n )\n .map(([name, value]) => ({ name, value: paramValue(value, cwd) }));\n}\n\nfunction paramValue(value: unknown, cwd?: string): string {\n const text =\n typeof value === \"string\"\n ? relativizePath(value, cwd)\n : JSON.stringify(value);\n return truncate(text.replace(/\\s+/g, \" \").trim(), 60);\n}\n\n/** One before/after edit, rendered as a language-aware diff. */\nexport interface DiffSegment {\n original: string;\n modified: string;\n}\n\nexport interface ToolDiff {\n added: number;\n removed: number;\n /** Edits as original→modified pairs (Write has one; MultiEdit has several). */\n segments: DiffSegment[];\n /** Highlighter hint from the file extension, when known. */\n language?: string;\n}\n\n// Added/removed line counts from a real LCS diff — context lines don't count,\n// so a no-op edit reports 0/0 (and yields no diff).\nfunction diffCounts(segments: DiffSegment[]): {\n added: number;\n removed: number;\n} {\n let added = 0;\n let removed = 0;\n for (const { original, modified } of segments) {\n for (const hunk of computeLineDiff(original, modified)) {\n for (const line of hunk.lines) {\n if (line.type === \"add\") added += 1;\n else if (line.type === \"remove\") removed += 1;\n }\n }\n }\n return { added, removed };\n}\n\n/** The content change of a file-writing tool call as before/after segments —\n * Write is one all-additions segment; Edit/MultiEdit pair old and new text. */\nexport function toolDiff(\n tool: string,\n input?: Record<string, unknown>,\n): ToolDiff | undefined {\n if (!input) return undefined;\n const str = (key: string): string =>\n typeof input[key] === \"string\" ? (input[key] as string) : \"\";\n\n const segments = toolDiffSegments(tool, input, str);\n if (!segments || segments.length === 0) return undefined;\n const counts = diffCounts(segments);\n if (counts.added === 0 && counts.removed === 0) return undefined;\n\n const language = languageFromPath(\n str(\"file_path\") || str(\"notebook_path\") || str(\"path\"),\n );\n return { ...counts, segments, ...(language ? { language } : {}) };\n}\n\nfunction toolDiffSegments(\n tool: string,\n input: Record<string, unknown>,\n str: (key: string) => string,\n): DiffSegment[] | undefined {\n if (tool === \"Write\") {\n const content = str(\"content\");\n return content ? [{ original: \"\", modified: content }] : undefined;\n }\n if (tool === \"Edit\" || tool === \"NotebookEdit\") {\n const original = str(\"old_string\");\n const modified = str(\"new_string\") || str(\"new_source\");\n return original || modified ? [{ original, modified }] : undefined;\n }\n if (tool === \"MultiEdit\") {\n const edits = input[\"edits\"];\n if (!Array.isArray(edits)) return undefined;\n return edits\n .filter(\n (edit): edit is Record<string, unknown> =>\n typeof edit === \"object\" && edit !== null,\n )\n .map((edit) => ({\n original:\n typeof edit[\"old_string\"] === \"string\"\n ? (edit[\"old_string\"] as string)\n : \"\",\n modified:\n typeof edit[\"new_string\"] === \"string\"\n ? (edit[\"new_string\"] as string)\n : \"\",\n }))\n .filter((segment) => segment.original !== \"\" || segment.modified !== \"\");\n }\n return undefined;\n}\n\n// summarizeToolInput condenses a tool's input into a one-line preview, ported\n// from captain's history.FormatToolUseSummary so the viewer reads like the CLI.\nexport function summarizeToolInput(\n tool: string,\n input?: Record<string, unknown>,\n cwd?: string,\n): string {\n if (!input) return \"\";\n const str = (key: string): string =>\n typeof input[key] === \"string\" ? (input[key] as string) : \"\";\n const first = (...keys: string[]): string => {\n for (const key of keys) {\n const value = str(key);\n if (value) return value;\n }\n return \"\";\n };\n\n const mcp = splitMcpTool(tool);\n if (mcp) {\n const arg = first(\"url\", \"sql\", \"query\", \"element\", \"method\");\n return arg ? truncate(arg, 80) : \"\";\n }\n\n switch (tool) {\n case \"Bash\":\n case \"browser_type\":\n return str(\"command\") || str(\"text\");\n case \"Read\":\n case \"Write\":\n case \"Edit\":\n case \"MultiEdit\":\n case \"NotebookEdit\":\n return relativizePath(first(\"file_path\", \"notebook_path\", \"path\"), cwd);\n case \"Grep\":\n return [str(\"pattern\"), str(\"path\")].filter(Boolean).join(\" \");\n case \"Glob\":\n return str(\"pattern\");\n case \"Task\":\n case \"Agent\":\n return first(\"description\", \"prompt\");\n case \"Skill\":\n return first(\"skill\", \"command\", \"name\");\n case \"TaskCreate\":\n return first(\"subject\", \"description\");\n case \"TaskUpdate\": {\n const id = first(\"taskId\", \"task_id\", \"id\");\n const status = str(\"status\");\n return status ? `${id} ${status}`.trim() : id;\n }\n case \"TaskGet\":\n case \"TaskOutput\":\n case \"TaskStop\":\n return first(\"task_id\", \"taskId\", \"id\");\n case \"ToolSearch\":\n case \"WebSearch\":\n return str(\"query\");\n case \"WebFetch\":\n case \"browser_navigate\":\n return str(\"url\");\n case \"AskUserQuestion\": {\n const questions = questionsFromToolInput(input);\n const rawQuestions = input[\"questions\"];\n if (questions.length > 1) return `${questions.length} questions`;\n if (questions[0]?.text) return truncate(questions[0].text, 80);\n if (Array.isArray(rawQuestions) && rawQuestions.length > 0) return `${rawQuestions.length} questions`;\n return \"\";\n }\n case \"ExitPlanMode\":\n return str(\"planFilePath\");\n default:\n return \"\";\n }\n}\n\n/** Maps a typed approval's questions (captain `TerminalQuestion`) to the\n * viewer's question shape. Answers are keyed by `id`, or by the question text\n * when the provider gives none, which is how captain reads them back. */\nexport function questionsFromApproval(questions: readonly ApprovalQuestion[]): SessionQuestion[] {\n return questions.map((question) => ({\n id: question.id || question.text,\n text: question.text,\n ...(question.context ? { context: question.context } : {}),\n ...(question.multiSelect ? { multiSelect: true } : {}),\n options: (question.options ?? []).map((option) => {\n const description = question.optionDescriptions?.[option];\n return { value: option, label: option, ...(description ? { description } : {}) };\n }),\n }));\n}\n\nexport function questionsFromToolInput(input?: Record<string, unknown>): SessionQuestion[] {\n if (!input) return [];\n const rawQuestions = input.questions;\n if (Array.isArray(rawQuestions)) {\n return rawQuestions\n .map((question, index) => questionFromValue(question, index))\n .filter((question): question is SessionQuestion => question !== null);\n }\n\n const text = stringField(input, \"question\") || stringField(input, \"prompt\") || stringField(input, \"text\");\n if (!text) return [];\n return [{\n id: stringField(input, \"id\") || \"1\",\n text,\n ...optionalContext(input),\n multiSelect: booleanField(input, \"multiSelect\") || booleanField(input, \"multi_select\"),\n options: optionList(input.options),\n }];\n}\n\nfunction questionFromValue(value: unknown, index: number): SessionQuestion | null {\n if (typeof value === \"string\") {\n const text = value.trim();\n return text ? { id: String(index + 1), text, options: [] } : null;\n }\n if (!isRecord(value)) return null;\n const text =\n stringField(value, \"question\") ||\n stringField(value, \"text\") ||\n stringField(value, \"prompt\") ||\n stringField(value, \"label\");\n if (!text) return null;\n return {\n id: stringField(value, \"id\") || String(index + 1),\n text,\n ...optionalContext(value),\n multiSelect: booleanField(value, \"multiSelect\") || booleanField(value, \"multi_select\"),\n ...(booleanField(value, \"isOther\") || booleanField(value, \"is_other\") ? { isOther: true } : {}),\n options: optionList(value.options),\n };\n}\n\nfunction optionList(value: unknown): SessionQuestionOption[] {\n if (!Array.isArray(value)) return [];\n return value.flatMap((option, index) => {\n if (typeof option === \"string\") {\n const label = option.trim();\n return label ? [{ value: label, label }] : [];\n }\n if (!isRecord(option)) return [];\n const label =\n stringField(option, \"label\") ||\n stringField(option, \"value\") ||\n stringField(option, \"id\") ||\n stringField(option, \"description\");\n if (!label) return [];\n const value = stringField(option, \"value\") || stringField(option, \"id\") || label;\n const description = stringField(option, \"description\");\n return [{\n value: value || String(index + 1),\n label,\n ...(description && description !== label ? { description } : {}),\n }];\n });\n}\n\nfunction optionalContext(input: Record<string, unknown>): Pick<SessionQuestion, \"context\"> {\n const context = stringField(input, \"header\") || stringField(input, \"context\") || stringField(input, \"description\");\n return context ? { context } : {};\n}\n\nfunction stringField(input: Record<string, unknown>, key: string): string {\n const value = input[key];\n return typeof value === \"string\" ? value.trim() : \"\";\n}\n\nfunction booleanField(input: Record<string, unknown>, key: string): boolean {\n return input[key] === true;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === \"object\" && !Array.isArray(value);\n}\n"],"mappings":";;;;;;AAWA,SAAgB,eAAe,MAAc,KAAsB;CACjE,IAAI,CAAC,KAAK,OAAO;CACjB,MAAM,OAAOA,eAAAA,qBAAqB,GAAG;CACrC,OAAO,KAAK,WAAW,GAAG,KAAK,EAAE,IAAI,KAAK,MAAM,KAAK,SAAS,CAAC,IAAI;AACrE;;;;AAKA,SAAgB,aACd,MACA,OACoB;CACpB,IAAI,SAAS,QAAQ,OAAO,KAAA;CAC5B,MAAM,UAAU,QAAQ;CACxB,OAAO,OAAO,YAAY,YAAY,UAAU,UAAU,KAAA;AAC5D;AAwBA,IAAM,sBAAyD;CAC7D,MAAM,CAAC,SAAS;CAChB,MAAM;EAAC;EAAa;EAAiB;CAAM;CAC3C,OAAO;EAAC;EAAa;EAAiB;EAAQ;CAAS;CACvD,MAAM;EAAC;EAAa;EAAiB;EAAQ;EAAc;CAAY;CACvE,WAAW;EAAC;EAAa;EAAiB;EAAQ;CAAO;CACzD,cAAc;EAAC;EAAa;EAAiB;CAAM;CACnD,iBAAiB;EAAC;EAAa;EAAY;EAAU;EAAQ;EAAU;EAAW;EAAe;CAAS;AAC5G;;;AAIA,SAAgB,gBACd,MACA,OACA,KACa;CACb,MAAM,WAAW,oBAAoB,SAAS,CAAC;CAC/C,OAAO,OAAO,QAAQ,SAAS,CAAC,CAAC,C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,MAAM,SAAS;AACxB;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AACrE"}
|
|
1
|
+
{"version":3,"file":"SessionViewer.input.cjs","names":["stripTrailingSlashes","truncate","computeLineDiff","languageFromPath","splitMcpTool"],"sources":["../../../src/data/ai/SessionViewer.input.ts"],"sourcesContent":["// Presentation helpers for a tool call's input: the one-line summary, the\n// JetBrains-style inline params, the inline shell command, and the line diff\n// for file-writing tools. Pure functions — the viewer renders their output.\n\nimport { computeLineDiff } from \"../code-diff\";\nimport { languageFromPath } from \"../code-highlight\";\nimport { stripTrailingSlashes } from \"../../lib/string\";\nimport { splitMcpTool, truncate } from \"./SessionViewer.model\";\nimport type { ApprovalQuestion } from \"./approval-request\";\n\n/** Strip the event's working directory from an absolute file path. */\nexport function relativizePath(path: string, cwd?: string): string {\n if (!cwd) return path;\n const base = stripTrailingSlashes(cwd);\n return path.startsWith(`${base}/`) ? path.slice(base.length + 1) : path;\n}\n\n/** The raw shell command of a shell-execution tool call, if present. Shell rows\n * render this inline as a bash code block instead of the generic label +\n * tool-input JSON. */\nexport function shellCommand(\n tool: string,\n input?: Record<string, unknown>,\n): string | undefined {\n if (tool !== \"Bash\") return undefined;\n const command = input?.[\"command\"];\n return typeof command === \"string\" && command ? command : undefined;\n}\n\nexport interface ToolParam {\n name: string;\n value: string;\n}\n\nexport interface SessionQuestionOption {\n value: string;\n label: string;\n description?: string;\n}\n\nexport interface SessionQuestion {\n id: string;\n text: string;\n context?: string;\n multiSelect?: boolean;\n isOther?: boolean;\n options: SessionQuestionOption[];\n}\n\n// Keys already rendered elsewhere in the row — the file-path heading, the\n// inline shell command, or the diff — so they don't repeat as inline params.\nconst CONSUMED_INPUT_KEYS: Record<string, readonly string[]> = {\n Bash: [\"command\"],\n Read: [\"file_path\", \"notebook_path\", \"path\"],\n Write: [\"file_path\", \"notebook_path\", \"path\", \"content\"],\n Edit: [\"file_path\", \"notebook_path\", \"path\", \"old_string\", \"new_string\"],\n MultiEdit: [\"file_path\", \"notebook_path\", \"path\", \"edits\"],\n NotebookEdit: [\"file_path\", \"notebook_path\", \"path\"],\n AskUserQuestion: [\"questions\", \"question\", \"prompt\", \"text\", \"header\", \"context\", \"description\", \"options\"],\n ApplyPatch: [\"input\", \"patch\", \"arguments\", \"files\", \"file_path\", \"operation\", \"to\"],\n};\n\n/** One file of a Codex patch, as captain's ParseApplyPatch emits it. */\ninterface ApplyPatchFile {\n op?: string;\n path?: string;\n move_to?: string;\n content?: string;\n old?: string;\n new?: string;\n}\n\nfunction applyPatchFiles(input: Record<string, unknown>): ApplyPatchFile[] {\n const files = input[\"files\"];\n if (!Array.isArray(files)) return [];\n return files.filter(\n (file): file is ApplyPatchFile => typeof file === \"object\" && file !== null,\n );\n}\n\nfunction summarizeApplyPatch(\n input: Record<string, unknown>,\n cwd?: string,\n): string {\n const files = applyPatchFiles(input);\n if (files.length > 1) {\n const paths = files.map((file) => relativizePath(file.path ?? \"\", cwd));\n return `${files.length} files: ${paths.join(\", \")}`;\n }\n const path = typeof input[\"file_path\"] === \"string\" ? input[\"file_path\"] : files[0]?.path;\n if (!path) return \"\";\n const operation = typeof input[\"operation\"] === \"string\" ? input[\"operation\"] : files[0]?.op;\n const to = typeof input[\"to\"] === \"string\" ? input[\"to\"] : files[0]?.move_to;\n const target = to ? ` → ${relativizePath(to, cwd)}` : \"\";\n return `${operation ? `${operation} ` : \"\"}${relativizePath(path, cwd)}${target}`;\n}\n\n/** Flatten a tool's input into JetBrains-style `name: value` inline params:\n * single-line values, cwd-relativized and truncated so the row never wraps. */\nexport function toolInputParams(\n tool: string,\n input?: Record<string, unknown>,\n cwd?: string,\n): ToolParam[] {\n const consumed = CONSUMED_INPUT_KEYS[tool] ?? [];\n return Object.entries(input ?? {})\n .filter(\n ([name, value]) =>\n !consumed.includes(name) &&\n value !== undefined &&\n value !== null &&\n value !== \"\",\n )\n .map(([name, value]) => ({ name, value: paramValue(value, cwd) }));\n}\n\nfunction paramValue(value: unknown, cwd?: string): string {\n const text =\n typeof value === \"string\"\n ? relativizePath(value, cwd)\n : JSON.stringify(value);\n return truncate(text.replace(/\\s+/g, \" \").trim(), 60);\n}\n\n/** One before/after edit, rendered as a language-aware diff. */\nexport interface DiffSegment {\n original: string;\n modified: string;\n}\n\nexport interface ToolDiff {\n added: number;\n removed: number;\n /** Edits as original→modified pairs (Write has one; MultiEdit has several). */\n segments: DiffSegment[];\n /** Highlighter hint from the file extension, when known. */\n language?: string;\n}\n\n// Added/removed line counts from a real LCS diff — context lines don't count,\n// so a no-op edit reports 0/0 (and yields no diff).\nfunction diffCounts(segments: DiffSegment[]): {\n added: number;\n removed: number;\n} {\n let added = 0;\n let removed = 0;\n for (const { original, modified } of segments) {\n for (const hunk of computeLineDiff(original, modified)) {\n for (const line of hunk.lines) {\n if (line.type === \"add\") added += 1;\n else if (line.type === \"remove\") removed += 1;\n }\n }\n }\n return { added, removed };\n}\n\n/** The content change of a file-writing tool call as before/after segments —\n * Write is one all-additions segment; Edit/MultiEdit pair old and new text. */\nexport function toolDiff(\n tool: string,\n input?: Record<string, unknown>,\n): ToolDiff | undefined {\n if (!input) return undefined;\n const str = (key: string): string =>\n typeof input[key] === \"string\" ? (input[key] as string) : \"\";\n\n const segments = toolDiffSegments(tool, input, str);\n if (!segments || segments.length === 0) return undefined;\n const counts = diffCounts(segments);\n if (counts.added === 0 && counts.removed === 0) return undefined;\n\n const language = languageFromPath(\n str(\"file_path\") ||\n str(\"notebook_path\") ||\n str(\"path\") ||\n (applyPatchFiles(input)[0]?.path ?? \"\"),\n );\n return { ...counts, segments, ...(language ? { language } : {}) };\n}\n\nfunction toolDiffSegments(\n tool: string,\n input: Record<string, unknown>,\n str: (key: string) => string,\n): DiffSegment[] | undefined {\n if (tool === \"Write\") {\n const content = str(\"content\");\n return content ? [{ original: \"\", modified: content }] : undefined;\n }\n if (tool === \"Edit\" || tool === \"NotebookEdit\") {\n const original = str(\"old_string\");\n const modified = str(\"new_string\") || str(\"new_source\");\n return original || modified ? [{ original, modified }] : undefined;\n }\n if (tool === \"ApplyPatch\") {\n return applyPatchFiles(input)\n .map((file) => ({\n original: file.old ?? \"\",\n modified: file.new ?? file.content ?? \"\",\n }))\n .filter((segment) => segment.original !== \"\" || segment.modified !== \"\");\n }\n if (tool === \"MultiEdit\") {\n const edits = input[\"edits\"];\n if (!Array.isArray(edits)) return undefined;\n return edits\n .filter(\n (edit): edit is Record<string, unknown> =>\n typeof edit === \"object\" && edit !== null,\n )\n .map((edit) => ({\n original:\n typeof edit[\"old_string\"] === \"string\"\n ? (edit[\"old_string\"] as string)\n : \"\",\n modified:\n typeof edit[\"new_string\"] === \"string\"\n ? (edit[\"new_string\"] as string)\n : \"\",\n }))\n .filter((segment) => segment.original !== \"\" || segment.modified !== \"\");\n }\n return undefined;\n}\n\n// summarizeToolInput condenses a tool's input into a one-line preview, ported\n// from captain's history.FormatToolUseSummary so the viewer reads like the CLI.\nexport function summarizeToolInput(\n tool: string,\n input?: Record<string, unknown>,\n cwd?: string,\n): string {\n if (!input) return \"\";\n const str = (key: string): string =>\n typeof input[key] === \"string\" ? (input[key] as string) : \"\";\n const first = (...keys: string[]): string => {\n for (const key of keys) {\n const value = str(key);\n if (value) return value;\n }\n return \"\";\n };\n\n const mcp = splitMcpTool(tool);\n if (mcp) {\n const arg = first(\"url\", \"sql\", \"query\", \"element\", \"method\");\n return arg ? truncate(arg, 80) : \"\";\n }\n\n switch (tool) {\n case \"Bash\":\n case \"browser_type\":\n return str(\"command\") || str(\"text\");\n case \"Read\":\n case \"Write\":\n case \"Edit\":\n case \"MultiEdit\":\n case \"NotebookEdit\":\n return relativizePath(first(\"file_path\", \"notebook_path\", \"path\"), cwd);\n case \"ApplyPatch\":\n return summarizeApplyPatch(input, cwd);\n case \"Grep\":\n return [str(\"pattern\"), str(\"path\")].filter(Boolean).join(\" \");\n case \"Glob\":\n return str(\"pattern\");\n case \"Task\":\n case \"Agent\":\n return first(\"description\", \"prompt\");\n case \"Skill\":\n return first(\"skill\", \"command\", \"name\");\n case \"TaskCreate\":\n return first(\"subject\", \"description\");\n case \"TaskUpdate\": {\n const id = first(\"taskId\", \"task_id\", \"id\");\n const status = str(\"status\");\n return status ? `${id} ${status}`.trim() : id;\n }\n case \"TaskGet\":\n case \"TaskOutput\":\n case \"TaskStop\":\n return first(\"task_id\", \"taskId\", \"id\");\n case \"ToolSearch\":\n case \"WebSearch\":\n return str(\"query\");\n case \"WebFetch\":\n case \"browser_navigate\":\n return str(\"url\");\n case \"AskUserQuestion\": {\n const questions = questionsFromToolInput(input);\n const rawQuestions = input[\"questions\"];\n if (questions.length > 1) return `${questions.length} questions`;\n if (questions[0]?.text) return truncate(questions[0].text, 80);\n if (Array.isArray(rawQuestions) && rawQuestions.length > 0) return `${rawQuestions.length} questions`;\n return \"\";\n }\n case \"ExitPlanMode\":\n return str(\"planFilePath\");\n default:\n return \"\";\n }\n}\n\n/** Maps a typed approval's questions (captain `TerminalQuestion`) to the\n * viewer's question shape. Answers are keyed by `id`, or by the question text\n * when the provider gives none, which is how captain reads them back. */\nexport function questionsFromApproval(questions: readonly ApprovalQuestion[]): SessionQuestion[] {\n return questions.map((question) => ({\n id: question.id || question.text,\n text: question.text,\n ...(question.context ? { context: question.context } : {}),\n ...(question.multiSelect ? { multiSelect: true } : {}),\n options: (question.options ?? []).map((option) => {\n const description = question.optionDescriptions?.[option];\n return { value: option, label: option, ...(description ? { description } : {}) };\n }),\n }));\n}\n\nexport function questionsFromToolInput(input?: Record<string, unknown>): SessionQuestion[] {\n if (!input) return [];\n const rawQuestions = input.questions;\n if (Array.isArray(rawQuestions)) {\n return rawQuestions\n .map((question, index) => questionFromValue(question, index))\n .filter((question): question is SessionQuestion => question !== null);\n }\n\n const text = stringField(input, \"question\") || stringField(input, \"prompt\") || stringField(input, \"text\");\n if (!text) return [];\n return [{\n id: stringField(input, \"id\") || \"1\",\n text,\n ...optionalContext(input),\n multiSelect: booleanField(input, \"multiSelect\") || booleanField(input, \"multi_select\"),\n options: optionList(input.options),\n }];\n}\n\nfunction questionFromValue(value: unknown, index: number): SessionQuestion | null {\n if (typeof value === \"string\") {\n const text = value.trim();\n return text ? { id: String(index + 1), text, options: [] } : null;\n }\n if (!isRecord(value)) return null;\n const text =\n stringField(value, \"question\") ||\n stringField(value, \"text\") ||\n stringField(value, \"prompt\") ||\n stringField(value, \"label\");\n if (!text) return null;\n return {\n id: stringField(value, \"id\") || String(index + 1),\n text,\n ...optionalContext(value),\n multiSelect: booleanField(value, \"multiSelect\") || booleanField(value, \"multi_select\"),\n ...(booleanField(value, \"isOther\") || booleanField(value, \"is_other\") ? { isOther: true } : {}),\n options: optionList(value.options),\n };\n}\n\nfunction optionList(value: unknown): SessionQuestionOption[] {\n if (!Array.isArray(value)) return [];\n return value.flatMap((option, index) => {\n if (typeof option === \"string\") {\n const label = option.trim();\n return label ? [{ value: label, label }] : [];\n }\n if (!isRecord(option)) return [];\n const label =\n stringField(option, \"label\") ||\n stringField(option, \"value\") ||\n stringField(option, \"id\") ||\n stringField(option, \"description\");\n if (!label) return [];\n const value = stringField(option, \"value\") || stringField(option, \"id\") || label;\n const description = stringField(option, \"description\");\n return [{\n value: value || String(index + 1),\n label,\n ...(description && description !== label ? { description } : {}),\n }];\n });\n}\n\nfunction optionalContext(input: Record<string, unknown>): Pick<SessionQuestion, \"context\"> {\n const context = stringField(input, \"header\") || stringField(input, \"context\") || stringField(input, \"description\");\n return context ? { context } : {};\n}\n\nfunction stringField(input: Record<string, unknown>, key: string): string {\n const value = input[key];\n return typeof value === \"string\" ? value.trim() : \"\";\n}\n\nfunction booleanField(input: Record<string, unknown>, key: string): boolean {\n return input[key] === true;\n}\n\n/**\n * What each question was answered with, read from the question tool's response:\n * Codex's `{\"answers\":{id:{\"answers\":[…]}}}`, a plain `{\"answers\":{id|text: value}}`\n * map, or Claude's `\"question\"=\"answer\"` text. A question the response does not\n * answer is absent, so the caller can still show the raw response.\n */\nexport function answersFromToolResponse(\n response: string | undefined,\n questions: readonly SessionQuestion[],\n): Map<string, string[]> {\n const found = new Map<string, string[]>();\n if (!response) return found;\n const byKey = answerMapFromJson(response) ?? answerMapFromText(response);\n for (const question of questions) {\n const values = byKey.get(question.id) ?? byKey.get(question.text);\n if (values?.length) found.set(question.id, values);\n }\n return found;\n}\n\nfunction answerValues(value: unknown): string[] {\n if (typeof value === \"string\") return [value];\n if (Array.isArray(value)) return value.filter((item): item is string => typeof item === \"string\");\n if (isRecord(value)) return answerValues(value.answers ?? value.answer);\n return [];\n}\n\n/** The `answers` map of a JSON response, or null when the response is not one. */\nfunction answerMapFromJson(response: string): Map<string, string[]> | null {\n const trimmed = response.trim();\n if (!trimmed.startsWith(\"{\")) return null;\n let parsed: unknown;\n try {\n parsed = JSON.parse(trimmed);\n } catch {\n return null;\n }\n if (!isRecord(parsed) || !isRecord(parsed.answers)) return null;\n return new Map(Object.entries(parsed.answers).map(([key, value]) => [key, answerValues(value)]));\n}\n\nconst QUOTED_ANSWER = /\"((?:[^\"\\\\]|\\\\.)*)\"=\"((?:[^\"\\\\]|\\\\.)*)\"/g;\n\nfunction answerMapFromText(response: string): Map<string, string[]> {\n return new Map([...response.matchAll(QUOTED_ANSWER)].map((match) => [match[1]!, [match[2]!]]));\n}\n\n/** Whether an answer picked this option; a Claude multi-select answer joins its picks with \", \". */\nexport function optionAnswered(option: SessionQuestionOption, answers: readonly string[]): boolean {\n return answers.some((answer) =>\n answer === option.value || answer === option.label || answer.split(\", \").includes(option.label),\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === \"object\" && !Array.isArray(value);\n}\n"],"mappings":";;;;;;AAWA,SAAgB,eAAe,MAAc,KAAsB;CACjE,IAAI,CAAC,KAAK,OAAO;CACjB,MAAM,OAAOA,eAAAA,qBAAqB,GAAG;CACrC,OAAO,KAAK,WAAW,GAAG,KAAK,EAAE,IAAI,KAAK,MAAM,KAAK,SAAS,CAA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AAG,GAAG,OAAO;CACrC,IAAI;CACJ,IAAI;EACF,SAAS,KAAK,MAAM,OAAO;CAC7B,QAAQ;EACN,OAAO;CACT;CACA,IAAI,CAAC,SAAS,MAAM,KAAK,CAAC,SAAS,OAAO,OAAO,GAAG,OAAO;CAC3D,OAAO,IAAI,IAAI,OAAO,QAAQ,OAAO,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,aAAa,KAAK,CAAC,CAAC,CAAC;AACjG;AAEA,IAAM,gBAAgB;AAEtB,SAAS,kBAAkB,UAAyC;CAClE,OAAO,IAAI,IAAI,CAAC,GAAG,SAAS,SAAS,aAAa,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,MAAM,IAAK,CAAC,MAAM,EAAG,CAAC,CAAC,CAAC;AAC/F;;AAGA,SAAgB,eAAe,QAA+B,SAAqC;CACjG,OAAO,QAAQ,MAAM,WACnB,WAAW,OAAO,SAAS,WAAW,OAAO,SAAS,OAAO,MAAM,IAAI,CAAC,CAAC,SAAS,OAAO,KAAK,CAChG;AACF;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AACrE"}
|
|
@@ -47,4 +47,13 @@ export declare function summarizeToolInput(tool: string, input?: Record<string,
|
|
|
47
47
|
* when the provider gives none, which is how captain reads them back. */
|
|
48
48
|
export declare function questionsFromApproval(questions: readonly ApprovalQuestion[]): SessionQuestion[];
|
|
49
49
|
export declare function questionsFromToolInput(input?: Record<string, unknown>): SessionQuestion[];
|
|
50
|
+
/**
|
|
51
|
+
* What each question was answered with, read from the question tool's response:
|
|
52
|
+
* Codex's `{"answers":{id:{"answers":[…]}}}`, a plain `{"answers":{id|text: value}}`
|
|
53
|
+
* map, or Claude's `"question"="answer"` text. A question the response does not
|
|
54
|
+
* answer is absent, so the caller can still show the raw response.
|
|
55
|
+
*/
|
|
56
|
+
export declare function answersFromToolResponse(response: string | undefined, questions: readonly SessionQuestion[]): Map<string, string[]>;
|
|
57
|
+
/** Whether an answer picked this option; a Claude multi-select answer joins its picks with ", ". */
|
|
58
|
+
export declare function optionAnswered(option: SessionQuestionOption, answers: readonly string[]): boolean;
|
|
50
59
|
//# sourceMappingURL=SessionViewer.input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionViewer.input.d.ts","sourceRoot":"","sources":["../../../src/data/ai/SessionViewer.input.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAIjE;AAED;;uBAEuB;AACvB,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,GAAG,SAAS,CAIpB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,qBAAqB,EAAE,CAAC;CAClC;
|
|
1
|
+
{"version":3,"file":"SessionViewer.input.d.ts","sourceRoot":"","sources":["../../../src/data/ai/SessionViewer.input.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CA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IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,QAAQ,GAAG,SAAS,CAiBtB;AAiDD,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,GAAG,CAAC,EAAE,MAAM,GACX,MAAM,CAqER;AAED;;0EAE0E;AAC1E,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,GAAG,eAAe,EAAE,CAW/F;AAED,wBAAgB,sBAAsB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,EAAE,CAkBzF;AA8DD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,SAAS,EAAE,SAAS,eAAe,EAAE,GACpC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CASvB;AA6BD,oGAAoG;AACpG,wBAAgB,cAAc,CAAC,MAAM,EAAE,qBAAqB,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAIjG"}
|
|
@@ -57,8 +57,35 @@ var CONSUMED_INPUT_KEYS = {
|
|
|
57
57
|
"context",
|
|
58
58
|
"description",
|
|
59
59
|
"options"
|
|
60
|
+
],
|
|
61
|
+
ApplyPatch: [
|
|
62
|
+
"input",
|
|
63
|
+
"patch",
|
|
64
|
+
"arguments",
|
|
65
|
+
"files",
|
|
66
|
+
"file_path",
|
|
67
|
+
"operation",
|
|
68
|
+
"to"
|
|
60
69
|
]
|
|
61
70
|
};
|
|
71
|
+
function applyPatchFiles(input) {
|
|
72
|
+
const files = input["files"];
|
|
73
|
+
if (!Array.isArray(files)) return [];
|
|
74
|
+
return files.filter((file) => typeof file === "object" && file !== null);
|
|
75
|
+
}
|
|
76
|
+
function summarizeApplyPatch(input, cwd) {
|
|
77
|
+
const files = applyPatchFiles(input);
|
|
78
|
+
if (files.length > 1) {
|
|
79
|
+
const paths = files.map((file) => relativizePath(file.path ?? "", cwd));
|
|
80
|
+
return `${files.length} files: ${paths.join(", ")}`;
|
|
81
|
+
}
|
|
82
|
+
const path = typeof input["file_path"] === "string" ? input["file_path"] : files[0]?.path;
|
|
83
|
+
if (!path) return "";
|
|
84
|
+
const operation = typeof input["operation"] === "string" ? input["operation"] : files[0]?.op;
|
|
85
|
+
const to = typeof input["to"] === "string" ? input["to"] : files[0]?.move_to;
|
|
86
|
+
const target = to ? ` → ${relativizePath(to, cwd)}` : "";
|
|
87
|
+
return `${operation ? `${operation} ` : ""}${relativizePath(path, cwd)}${target}`;
|
|
88
|
+
}
|
|
62
89
|
/** Flatten a tool's input into JetBrains-style `name: value` inline params:
|
|
63
90
|
* single-line values, cwd-relativized and truncated so the row never wraps. */
|
|
64
91
|
function toolInputParams(tool, input, cwd) {
|
|
@@ -91,7 +118,7 @@ function toolDiff(tool, input) {
|
|
|
91
118
|
if (!segments || segments.length === 0) return void 0;
|
|
92
119
|
const counts = diffCounts(segments);
|
|
93
120
|
if (counts.added === 0 && counts.removed === 0) return void 0;
|
|
94
|
-
const language = languageFromPath(str("file_path") || str("notebook_path") || str("path"));
|
|
121
|
+
const language = languageFromPath(str("file_path") || str("notebook_path") || str("path") || (applyPatchFiles(input)[0]?.path ?? ""));
|
|
95
122
|
return {
|
|
96
123
|
...counts,
|
|
97
124
|
segments,
|
|
@@ -114,6 +141,10 @@ function toolDiffSegments(tool, input, str) {
|
|
|
114
141
|
modified
|
|
115
142
|
}] : void 0;
|
|
116
143
|
}
|
|
144
|
+
if (tool === "ApplyPatch") return applyPatchFiles(input).map((file) => ({
|
|
145
|
+
original: file.old ?? "",
|
|
146
|
+
modified: file.new ?? file.content ?? ""
|
|
147
|
+
})).filter((segment) => segment.original !== "" || segment.modified !== "");
|
|
117
148
|
if (tool === "MultiEdit") {
|
|
118
149
|
const edits = input["edits"];
|
|
119
150
|
if (!Array.isArray(edits)) return void 0;
|
|
@@ -145,6 +176,7 @@ function summarizeToolInput(tool, input, cwd) {
|
|
|
145
176
|
case "Edit":
|
|
146
177
|
case "MultiEdit":
|
|
147
178
|
case "NotebookEdit": return relativizePath(first("file_path", "notebook_path", "path"), cwd);
|
|
179
|
+
case "ApplyPatch": return summarizeApplyPatch(input, cwd);
|
|
148
180
|
case "Grep": return [str("pattern"), str("path")].filter(Boolean).join(" ");
|
|
149
181
|
case "Glob": return str("pattern");
|
|
150
182
|
case "Task":
|
|
@@ -262,9 +294,52 @@ function stringField(input, key) {
|
|
|
262
294
|
function booleanField(input, key) {
|
|
263
295
|
return input[key] === true;
|
|
264
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* What each question was answered with, read from the question tool's response:
|
|
299
|
+
* Codex's `{"answers":{id:{"answers":[…]}}}`, a plain `{"answers":{id|text: value}}`
|
|
300
|
+
* map, or Claude's `"question"="answer"` text. A question the response does not
|
|
301
|
+
* answer is absent, so the caller can still show the raw response.
|
|
302
|
+
*/
|
|
303
|
+
function answersFromToolResponse(response, questions) {
|
|
304
|
+
const found = /* @__PURE__ */ new Map();
|
|
305
|
+
if (!response) return found;
|
|
306
|
+
const byKey = answerMapFromJson(response) ?? answerMapFromText(response);
|
|
307
|
+
for (const question of questions) {
|
|
308
|
+
const values = byKey.get(question.id) ?? byKey.get(question.text);
|
|
309
|
+
if (values?.length) found.set(question.id, values);
|
|
310
|
+
}
|
|
311
|
+
return found;
|
|
312
|
+
}
|
|
313
|
+
function answerValues(value) {
|
|
314
|
+
if (typeof value === "string") return [value];
|
|
315
|
+
if (Array.isArray(value)) return value.filter((item) => typeof item === "string");
|
|
316
|
+
if (isRecord(value)) return answerValues(value.answers ?? value.answer);
|
|
317
|
+
return [];
|
|
318
|
+
}
|
|
319
|
+
/** The `answers` map of a JSON response, or null when the response is not one. */
|
|
320
|
+
function answerMapFromJson(response) {
|
|
321
|
+
const trimmed = response.trim();
|
|
322
|
+
if (!trimmed.startsWith("{")) return null;
|
|
323
|
+
let parsed;
|
|
324
|
+
try {
|
|
325
|
+
parsed = JSON.parse(trimmed);
|
|
326
|
+
} catch {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
if (!isRecord(parsed) || !isRecord(parsed.answers)) return null;
|
|
330
|
+
return new Map(Object.entries(parsed.answers).map(([key, value]) => [key, answerValues(value)]));
|
|
331
|
+
}
|
|
332
|
+
var QUOTED_ANSWER = /"((?:[^"\\]|\\.)*)"="((?:[^"\\]|\\.)*)"/g;
|
|
333
|
+
function answerMapFromText(response) {
|
|
334
|
+
return new Map([...response.matchAll(QUOTED_ANSWER)].map((match) => [match[1], [match[2]]]));
|
|
335
|
+
}
|
|
336
|
+
/** Whether an answer picked this option; a Claude multi-select answer joins its picks with ", ". */
|
|
337
|
+
function optionAnswered(option, answers) {
|
|
338
|
+
return answers.some((answer) => answer === option.value || answer === option.label || answer.split(", ").includes(option.label));
|
|
339
|
+
}
|
|
265
340
|
function isRecord(value) {
|
|
266
341
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
267
342
|
}
|
|
268
|
-
export { questionsFromApproval, questionsFromToolInput, relativizePath, shellCommand, summarizeToolInput, toolDiff, toolInputParams };
|
|
343
|
+
export { answersFromToolResponse, optionAnswered, questionsFromApproval, questionsFromToolInput, relativizePath, shellCommand, summarizeToolInput, toolDiff, toolInputParams };
|
|
269
344
|
|
|
270
345
|
//# sourceMappingURL=SessionViewer.input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionViewer.input.js","names":[],"sources":["../../../src/data/ai/SessionViewer.input.ts"],"sourcesContent":["// Presentation helpers for a tool call's input: the one-line summary, the\n// JetBrains-style inline params, the inline shell command, and the line diff\n// for file-writing tools. Pure functions — the viewer renders their output.\n\nimport { computeLineDiff } from \"../code-diff\";\nimport { languageFromPath } from \"../code-highlight\";\nimport { stripTrailingSlashes } from \"../../lib/string\";\nimport { splitMcpTool, truncate } from \"./SessionViewer.model\";\nimport type { ApprovalQuestion } from \"./approval-request\";\n\n/** Strip the event's working directory from an absolute file path. */\nexport function relativizePath(path: string, cwd?: string): string {\n if (!cwd) return path;\n const base = stripTrailingSlashes(cwd);\n return path.startsWith(`${base}/`) ? path.slice(base.length + 1) : path;\n}\n\n/** The raw shell command of a shell-execution tool call, if present. Shell rows\n * render this inline as a bash code block instead of the generic label +\n * tool-input JSON. */\nexport function shellCommand(\n tool: string,\n input?: Record<string, unknown>,\n): string | undefined {\n if (tool !== \"Bash\") return undefined;\n const command = input?.[\"command\"];\n return typeof command === \"string\" && command ? command : undefined;\n}\n\nexport interface ToolParam {\n name: string;\n value: string;\n}\n\nexport interface SessionQuestionOption {\n value: string;\n label: string;\n description?: string;\n}\n\nexport interface SessionQuestion {\n id: string;\n text: string;\n context?: string;\n multiSelect?: boolean;\n isOther?: boolean;\n options: SessionQuestionOption[];\n}\n\n// Keys already rendered elsewhere in the row — the file-path heading, the\n// inline shell command, or the diff — so they don't repeat as inline params.\nconst CONSUMED_INPUT_KEYS: Record<string, readonly string[]> = {\n Bash: [\"command\"],\n Read: [\"file_path\", \"notebook_path\", \"path\"],\n Write: [\"file_path\", \"notebook_path\", \"path\", \"content\"],\n Edit: [\"file_path\", \"notebook_path\", \"path\", \"old_string\", \"new_string\"],\n MultiEdit: [\"file_path\", \"notebook_path\", \"path\", \"edits\"],\n NotebookEdit: [\"file_path\", \"notebook_path\", \"path\"],\n AskUserQuestion: [\"questions\", \"question\", \"prompt\", \"text\", \"header\", \"context\", \"description\", \"options\"],\n};\n\n/** Flatten a tool's input into JetBrains-style `name: value` inline params:\n * single-line values, cwd-relativized and truncated so the row never wraps. */\nexport function toolInputParams(\n tool: string,\n input?: Record<string, unknown>,\n cwd?: string,\n): ToolParam[] {\n const consumed = CONSUMED_INPUT_KEYS[tool] ?? [];\n return Object.entries(input ?? {})\n .filter(\n ([name, value]) =>\n !consumed.includes(name) &&\n value !== undefined &&\n value !== null &&\n value !== \"\",\n )\n .map(([name, value]) => ({ name, value: paramValue(value, cwd) }));\n}\n\nfunction paramValue(value: unknown, cwd?: string): string {\n const text =\n typeof value === \"string\"\n ? relativizePath(value, cwd)\n : JSON.stringify(value);\n return truncate(text.replace(/\\s+/g, \" \").trim(), 60);\n}\n\n/** One before/after edit, rendered as a language-aware diff. */\nexport interface DiffSegment {\n original: string;\n modified: string;\n}\n\nexport interface ToolDiff {\n added: number;\n removed: number;\n /** Edits as original→modified pairs (Write has one; MultiEdit has several). */\n segments: DiffSegment[];\n /** Highlighter hint from the file extension, when known. */\n language?: string;\n}\n\n// Added/removed line counts from a real LCS diff — context lines don't count,\n// so a no-op edit reports 0/0 (and yields no diff).\nfunction diffCounts(segments: DiffSegment[]): {\n added: number;\n removed: number;\n} {\n let added = 0;\n let removed = 0;\n for (const { original, modified } of segments) {\n for (const hunk of computeLineDiff(original, modified)) {\n for (const line of hunk.lines) {\n if (line.type === \"add\") added += 1;\n else if (line.type === \"remove\") removed += 1;\n }\n }\n }\n return { added, removed };\n}\n\n/** The content change of a file-writing tool call as before/after segments —\n * Write is one all-additions segment; Edit/MultiEdit pair old and new text. */\nexport function toolDiff(\n tool: string,\n input?: Record<string, unknown>,\n): ToolDiff | undefined {\n if (!input) return undefined;\n const str = (key: string): string =>\n typeof input[key] === \"string\" ? (input[key] as string) : \"\";\n\n const segments = toolDiffSegments(tool, input, str);\n if (!segments || segments.length === 0) return undefined;\n const counts = diffCounts(segments);\n if (counts.added === 0 && counts.removed === 0) return undefined;\n\n const language = languageFromPath(\n str(\"file_path\") || str(\"notebook_path\") || str(\"path\"),\n );\n return { ...counts, segments, ...(language ? { language } : {}) };\n}\n\nfunction toolDiffSegments(\n tool: string,\n input: Record<string, unknown>,\n str: (key: string) => string,\n): DiffSegment[] | undefined {\n if (tool === \"Write\") {\n const content = str(\"content\");\n return content ? [{ original: \"\", modified: content }] : undefined;\n }\n if (tool === \"Edit\" || tool === \"NotebookEdit\") {\n const original = str(\"old_string\");\n const modified = str(\"new_string\") || str(\"new_source\");\n return original || modified ? [{ original, modified }] : undefined;\n }\n if (tool === \"MultiEdit\") {\n const edits = input[\"edits\"];\n if (!Array.isArray(edits)) return undefined;\n return edits\n .filter(\n (edit): edit is Record<string, unknown> =>\n typeof edit === \"object\" && edit !== null,\n )\n .map((edit) => ({\n original:\n typeof edit[\"old_string\"] === \"string\"\n ? (edit[\"old_string\"] as string)\n : \"\",\n modified:\n typeof edit[\"new_string\"] === \"string\"\n ? (edit[\"new_string\"] as string)\n : \"\",\n }))\n .filter((segment) => segment.original !== \"\" || segment.modified !== \"\");\n }\n return undefined;\n}\n\n// summarizeToolInput condenses a tool's input into a one-line preview, ported\n// from captain's history.FormatToolUseSummary so the viewer reads like the CLI.\nexport function summarizeToolInput(\n tool: string,\n input?: Record<string, unknown>,\n cwd?: string,\n): string {\n if (!input) return \"\";\n const str = (key: string): string =>\n typeof input[key] === \"string\" ? (input[key] as string) : \"\";\n const first = (...keys: string[]): string => {\n for (const key of keys) {\n const value = str(key);\n if (value) return value;\n }\n return \"\";\n };\n\n const mcp = splitMcpTool(tool);\n if (mcp) {\n const arg = first(\"url\", \"sql\", \"query\", \"element\", \"method\");\n return arg ? truncate(arg, 80) : \"\";\n }\n\n switch (tool) {\n case \"Bash\":\n case \"browser_type\":\n return str(\"command\") || str(\"text\");\n case \"Read\":\n case \"Write\":\n case \"Edit\":\n case \"MultiEdit\":\n case \"NotebookEdit\":\n return relativizePath(first(\"file_path\", \"notebook_path\", \"path\"), cwd);\n case \"Grep\":\n return [str(\"pattern\"), str(\"path\")].filter(Boolean).join(\" \");\n case \"Glob\":\n return str(\"pattern\");\n case \"Task\":\n case \"Agent\":\n return first(\"description\", \"prompt\");\n case \"Skill\":\n return first(\"skill\", \"command\", \"name\");\n case \"TaskCreate\":\n return first(\"subject\", \"description\");\n case \"TaskUpdate\": {\n const id = first(\"taskId\", \"task_id\", \"id\");\n const status = str(\"status\");\n return status ? `${id} ${status}`.trim() : id;\n }\n case \"TaskGet\":\n case \"TaskOutput\":\n case \"TaskStop\":\n return first(\"task_id\", \"taskId\", \"id\");\n case \"ToolSearch\":\n case \"WebSearch\":\n return str(\"query\");\n case \"WebFetch\":\n case \"browser_navigate\":\n return str(\"url\");\n case \"AskUserQuestion\": {\n const questions = questionsFromToolInput(input);\n const rawQuestions = input[\"questions\"];\n if (questions.length > 1) return `${questions.length} questions`;\n if (questions[0]?.text) return truncate(questions[0].text, 80);\n if (Array.isArray(rawQuestions) && rawQuestions.length > 0) return `${rawQuestions.length} questions`;\n return \"\";\n }\n case \"ExitPlanMode\":\n return str(\"planFilePath\");\n default:\n return \"\";\n }\n}\n\n/** Maps a typed approval's questions (captain `TerminalQuestion`) to the\n * viewer's question shape. Answers are keyed by `id`, or by the question text\n * when the provider gives none, which is how captain reads them back. */\nexport function questionsFromApproval(questions: readonly ApprovalQuestion[]): SessionQuestion[] {\n return questions.map((question) => ({\n id: question.id || question.text,\n text: question.text,\n ...(question.context ? { context: question.context } : {}),\n ...(question.multiSelect ? { multiSelect: true } : {}),\n options: (question.options ?? []).map((option) => {\n const description = question.optionDescriptions?.[option];\n return { value: option, label: option, ...(description ? { description } : {}) };\n }),\n }));\n}\n\nexport function questionsFromToolInput(input?: Record<string, unknown>): SessionQuestion[] {\n if (!input) return [];\n const rawQuestions = input.questions;\n if (Array.isArray(rawQuestions)) {\n return rawQuestions\n .map((question, index) => questionFromValue(question, index))\n .filter((question): question is SessionQuestion => question !== null);\n }\n\n const text = stringField(input, \"question\") || stringField(input, \"prompt\") || stringField(input, \"text\");\n if (!text) return [];\n return [{\n id: stringField(input, \"id\") || \"1\",\n text,\n ...optionalContext(input),\n multiSelect: booleanField(input, \"multiSelect\") || booleanField(input, \"multi_select\"),\n options: optionList(input.options),\n }];\n}\n\nfunction questionFromValue(value: unknown, index: number): SessionQuestion | null {\n if (typeof value === \"string\") {\n const text = value.trim();\n return text ? { id: String(index + 1), text, options: [] } : null;\n }\n if (!isRecord(value)) return null;\n const text =\n stringField(value, \"question\") ||\n stringField(value, \"text\") ||\n stringField(value, \"prompt\") ||\n stringField(value, \"label\");\n if (!text) return null;\n return {\n id: stringField(value, \"id\") || String(index + 1),\n text,\n ...optionalContext(value),\n multiSelect: booleanField(value, \"multiSelect\") || booleanField(value, \"multi_select\"),\n ...(booleanField(value, \"isOther\") || booleanField(value, \"is_other\") ? { isOther: true } : {}),\n options: optionList(value.options),\n };\n}\n\nfunction optionList(value: unknown): SessionQuestionOption[] {\n if (!Array.isArray(value)) return [];\n return value.flatMap((option, index) => {\n if (typeof option === \"string\") {\n const label = option.trim();\n return label ? [{ value: label, label }] : [];\n }\n if (!isRecord(option)) return [];\n const label =\n stringField(option, \"label\") ||\n stringField(option, \"value\") ||\n stringField(option, \"id\") ||\n stringField(option, \"description\");\n if (!label) return [];\n const value = stringField(option, \"value\") || stringField(option, \"id\") || label;\n const description = stringField(option, \"description\");\n return [{\n value: value || String(index + 1),\n label,\n ...(description && description !== label ? { description } : {}),\n }];\n });\n}\n\nfunction optionalContext(input: Record<string, unknown>): Pick<SessionQuestion, \"context\"> {\n const context = stringField(input, \"header\") || stringField(input, \"context\") || stringField(input, \"description\");\n return context ? { context } : {};\n}\n\nfunction stringField(input: Record<string, unknown>, key: string): string {\n const value = input[key];\n return typeof value === \"string\" ? value.trim() : \"\";\n}\n\nfunction booleanField(input: Record<string, unknown>, key: string): boolean {\n return input[key] === true;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === \"object\" && !Array.isArray(value);\n}\n"],"mappings":";;;;;;AAWA,SAAgB,eAAe,MAAc,KAAsB;CACjE,IAAI,CAAC,KAAK,OAAO;CACjB,MAAM,OAAO,qBAAqB,GAAG;CACrC,OAAO,KAAK,WAAW,GAAG,KAAK,EAAE,IAAI,KAAK,MAAM,KAAK,SAAS,CAAC,IAAI;AACrE;;;;AAKA,SAAgB,aACd,MACA,OACoB;CACpB,IAAI,SAAS,QAAQ,OAAO,KAAA;CAC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AY,QAAQ,aAAa;EACrD,OAAO,CAAC;GACN,OAAO,SAAS,OAAO,QAAQ,CAAC;GAChC;GACA,GAAI,eAAe,gBAAgB,QAAQ,EAAE,YAAY,IAAI,CAAC;EAChE,CAAC;CACH,CAAC;AACH;AAEA,SAAS,gBAAgB,OAAkE;CACzF,MAAM,UAAU,YAAY,OAAO,QAAQ,KAAK,YAAY,OAAO,SAAS,KAAK,YAAY,OAAO,aAAa;CACjH,OAAO,UAAU,EAAE,QAAQ,IAAI,CAAC;AAClC;AAEA,SAAS,YAAY,OAAgC,KAAqB;CACxE,MAAM,QAAQ,MAAM;CACpB,OAAO,OAAO,UAAU,WAAW,MAAM,KAAK,IAAI;AACpD;AAEA,SAAS,aAAa,OAAgC,KAAsB;CAC1E,OAAO,MAAM,SAAS;AACxB;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AACrE"}
|
|
1
|
+
{"version":3,"file":"SessionViewer.input.js","names":[],"sources":["../../../src/data/ai/SessionViewer.input.ts"],"sourcesContent":["// Presentation helpers for a tool call's input: the one-line summary, the\n// JetBrains-style inline params, the inline shell command, and the line diff\n// for file-writing tools. Pure functions — the viewer renders their output.\n\nimport { computeLineDiff } from \"../code-diff\";\nimport { languageFromPath } from \"../code-highlight\";\nimport { stripTrailingSlashes } from \"../../lib/string\";\nimport { splitMcpTool, truncate } from \"./SessionViewer.model\";\nimport type { ApprovalQuestion } from \"./approval-request\";\n\n/** Strip the event's working directory from an absolute file path. */\nexport function relativizePath(path: string, cwd?: string): string {\n if (!cwd) return path;\n const base = stripTrailingSlashes(cwd);\n return path.startsWith(`${base}/`) ? path.slice(base.length + 1) : path;\n}\n\n/** The raw shell command of a shell-execution tool call, if present. Shell rows\n * render this inline as a bash code block instead of the generic label +\n * tool-input JSON. */\nexport function shellCommand(\n tool: string,\n input?: Record<string, unknown>,\n): string | undefined {\n if (tool !== \"Bash\") return undefined;\n const command = input?.[\"command\"];\n return typeof command === \"string\" && command ? command : undefined;\n}\n\nexport interface ToolParam {\n name: string;\n value: string;\n}\n\nexport interface SessionQuestionOption {\n value: string;\n label: string;\n description?: string;\n}\n\nexport interface SessionQuestion {\n id: string;\n text: string;\n context?: string;\n multiSelect?: boolean;\n isOther?: boolean;\n options: SessionQuestionOption[];\n}\n\n// Keys already rendered elsewhere in the row — the file-path heading, the\n// inline shell command, or the diff — so they don't repeat as inline params.\nconst CONSUMED_INPUT_KEYS: Record<string, readonly string[]> = {\n Bash: [\"command\"],\n Read: [\"file_path\", \"notebook_path\", \"path\"],\n Write: [\"file_path\", \"notebook_path\", \"path\", \"content\"],\n Edit: [\"file_path\", \"notebook_path\", \"path\", \"old_string\", \"new_string\"],\n MultiEdit: [\"file_path\", \"notebook_path\", \"path\", \"edits\"],\n NotebookEdit: [\"file_path\", \"notebook_path\", \"path\"],\n AskUserQuestion: [\"questions\", \"question\", \"prompt\", \"text\", \"header\", \"context\", \"description\", \"options\"],\n ApplyPatch: [\"input\", \"patch\", \"arguments\", \"files\", \"file_path\", \"operation\", \"to\"],\n};\n\n/** One file of a Codex patch, as captain's ParseApplyPatch emits it. */\ninterface ApplyPatchFile {\n op?: string;\n path?: string;\n move_to?: string;\n content?: string;\n old?: string;\n new?: string;\n}\n\nfunction applyPatchFiles(input: Record<string, unknown>): ApplyPatchFile[] {\n const files = input[\"files\"];\n if (!Array.isArray(files)) return [];\n return files.filter(\n (file): file is ApplyPatchFile => typeof file === \"object\" && file !== null,\n );\n}\n\nfunction summarizeApplyPatch(\n input: Record<string, unknown>,\n cwd?: string,\n): string {\n const files = applyPatchFiles(input);\n if (files.length > 1) {\n const paths = files.map((file) => relativizePath(file.path ?? \"\", cwd));\n return `${files.length} files: ${paths.join(\", \")}`;\n }\n const path = typeof input[\"file_path\"] === \"string\" ? input[\"file_path\"] : files[0]?.path;\n if (!path) return \"\";\n const operation = typeof input[\"operation\"] === \"string\" ? input[\"operation\"] : files[0]?.op;\n const to = typeof input[\"to\"] === \"string\" ? input[\"to\"] : files[0]?.move_to;\n const target = to ? ` → ${relativizePath(to, cwd)}` : \"\";\n return `${operation ? `${operation} ` : \"\"}${relativizePath(path, cwd)}${target}`;\n}\n\n/** Flatten a tool's input into JetBrains-style `name: value` inline params:\n * single-line values, cwd-relativized and truncated so the row never wraps. */\nexport function toolInputParams(\n tool: string,\n input?: Record<string, unknown>,\n cwd?: string,\n): ToolParam[] {\n const consumed = CONSUMED_INPUT_KEYS[tool] ?? [];\n return Object.entries(input ?? {})\n .filter(\n ([name, value]) =>\n !consumed.includes(name) &&\n value !== undefined &&\n value !== null &&\n value !== \"\",\n )\n .map(([name, value]) => ({ name, value: paramValue(value, cwd) }));\n}\n\nfunction paramValue(value: unknown, cwd?: string): string {\n const text =\n typeof value === \"string\"\n ? relativizePath(value, cwd)\n : JSON.stringify(value);\n return truncate(text.replace(/\\s+/g, \" \").trim(), 60);\n}\n\n/** One before/after edit, rendered as a language-aware diff. */\nexport interface DiffSegment {\n original: string;\n modified: string;\n}\n\nexport interface ToolDiff {\n added: number;\n removed: number;\n /** Edits as original→modified pairs (Write has one; MultiEdit has several). */\n segments: DiffSegment[];\n /** Highlighter hint from the file extension, when known. */\n language?: string;\n}\n\n// Added/removed line counts from a real LCS diff — context lines don't count,\n// so a no-op edit reports 0/0 (and yields no diff).\nfunction diffCounts(segments: DiffSegment[]): {\n added: number;\n removed: number;\n} {\n let added = 0;\n let removed = 0;\n for (const { original, modified } of segments) {\n for (const hunk of computeLineDiff(original, modified)) {\n for (const line of hunk.lines) {\n if (line.type === \"add\") added += 1;\n else if (line.type === \"remove\") removed += 1;\n }\n }\n }\n return { added, removed };\n}\n\n/** The content change of a file-writing tool call as before/after segments —\n * Write is one all-additions segment; Edit/MultiEdit pair old and new text. */\nexport function toolDiff(\n tool: string,\n input?: Record<string, unknown>,\n): ToolDiff | undefined {\n if (!input) return undefined;\n const str = (key: string): string =>\n typeof input[key] === \"string\" ? (input[key] as string) : \"\";\n\n const segments = toolDiffSegments(tool, input, str);\n if (!segments || segments.length === 0) return undefined;\n const counts = diffCounts(segments);\n if (counts.added === 0 && counts.removed === 0) return undefined;\n\n const language = languageFromPath(\n str(\"file_path\") ||\n str(\"notebook_path\") ||\n str(\"path\") ||\n (applyPatchFiles(input)[0]?.path ?? \"\"),\n );\n return { ...counts, segments, ...(language ? { language } : {}) };\n}\n\nfunction toolDiffSegments(\n tool: string,\n input: Record<string, unknown>,\n str: (key: string) => string,\n): DiffSegment[] | undefined {\n if (tool === \"Write\") {\n const content = str(\"content\");\n return content ? [{ original: \"\", modified: content }] : undefined;\n }\n if (tool === \"Edit\" || tool === \"NotebookEdit\") {\n const original = str(\"old_string\");\n const modified = str(\"new_string\") || str(\"new_source\");\n return original || modified ? [{ original, modified }] : undefined;\n }\n if (tool === \"ApplyPatch\") {\n return applyPatchFiles(input)\n .map((file) => ({\n original: file.old ?? \"\",\n modified: file.new ?? file.content ?? \"\",\n }))\n .filter((segment) => segment.original !== \"\" || segment.modified !== \"\");\n }\n if (tool === \"MultiEdit\") {\n const edits = input[\"edits\"];\n if (!Array.isArray(edits)) return undefined;\n return edits\n .filter(\n (edit): edit is Record<string, unknown> =>\n typeof edit === \"object\" && edit !== null,\n )\n .map((edit) => ({\n original:\n typeof edit[\"old_string\"] === \"string\"\n ? (edit[\"old_string\"] as string)\n : \"\",\n modified:\n typeof edit[\"new_string\"] === \"string\"\n ? (edit[\"new_string\"] as string)\n : \"\",\n }))\n .filter((segment) => segment.original !== \"\" || segment.modified !== \"\");\n }\n return undefined;\n}\n\n// summarizeToolInput condenses a tool's input into a one-line preview, ported\n// from captain's history.FormatToolUseSummary so the viewer reads like the CLI.\nexport function summarizeToolInput(\n tool: string,\n input?: Record<string, unknown>,\n cwd?: string,\n): string {\n if (!input) return \"\";\n const str = (key: string): string =>\n typeof input[key] === \"string\" ? (input[key] as string) : \"\";\n const first = (...keys: string[]): string => {\n for (const key of keys) {\n const value = str(key);\n if (value) return value;\n }\n return \"\";\n };\n\n const mcp = splitMcpTool(tool);\n if (mcp) {\n const arg = first(\"url\", \"sql\", \"query\", \"element\", \"method\");\n return arg ? truncate(arg, 80) : \"\";\n }\n\n switch (tool) {\n case \"Bash\":\n case \"browser_type\":\n return str(\"command\") || str(\"text\");\n case \"Read\":\n case \"Write\":\n case \"Edit\":\n case \"MultiEdit\":\n case \"NotebookEdit\":\n return relativizePath(first(\"file_path\", \"notebook_path\", \"path\"), cwd);\n case \"ApplyPatch\":\n return summarizeApplyPatch(input, cwd);\n case \"Grep\":\n return [str(\"pattern\"), str(\"path\")].filter(Boolean).join(\" \");\n case \"Glob\":\n return str(\"pattern\");\n case \"Task\":\n case \"Agent\":\n return first(\"description\", \"prompt\");\n case \"Skill\":\n return first(\"skill\", \"command\", \"name\");\n case \"TaskCreate\":\n return first(\"subject\", \"description\");\n case \"TaskUpdate\": {\n const id = first(\"taskId\", \"task_id\", \"id\");\n const status = str(\"status\");\n return status ? `${id} ${status}`.trim() : id;\n }\n case \"TaskGet\":\n case \"TaskOutput\":\n case \"TaskStop\":\n return first(\"task_id\", \"taskId\", \"id\");\n case \"ToolSearch\":\n case \"WebSearch\":\n return str(\"query\");\n case \"WebFetch\":\n case \"browser_navigate\":\n return str(\"url\");\n case \"AskUserQuestion\": {\n const questions = questionsFromToolInput(input);\n const rawQuestions = input[\"questions\"];\n if (questions.length > 1) return `${questions.length} questions`;\n if (questions[0]?.text) return truncate(questions[0].text, 80);\n if (Array.isArray(rawQuestions) && rawQuestions.length > 0) return `${rawQuestions.length} questions`;\n return \"\";\n }\n case \"ExitPlanMode\":\n return str(\"planFilePath\");\n default:\n return \"\";\n }\n}\n\n/** Maps a typed approval's questions (captain `TerminalQuestion`) to the\n * viewer's question shape. Answers are keyed by `id`, or by the question text\n * when the provider gives none, which is how captain reads them back. */\nexport function questionsFromApproval(questions: readonly ApprovalQuestion[]): SessionQuestion[] {\n return questions.map((question) => ({\n id: question.id || question.text,\n text: question.text,\n ...(question.context ? { context: question.context } : {}),\n ...(question.multiSelect ? { multiSelect: true } : {}),\n options: (question.options ?? []).map((option) => {\n const description = question.optionDescriptions?.[option];\n return { value: option, label: option, ...(description ? { description } : {}) };\n }),\n }));\n}\n\nexport function questionsFromToolInput(input?: Record<string, unknown>): SessionQuestion[] {\n if (!input) return [];\n const rawQuestions = input.questions;\n if (Array.isArray(rawQuestions)) {\n return rawQuestions\n .map((question, index) => questionFromValue(question, index))\n .filter((question): question is SessionQuestion => question !== null);\n }\n\n const text = stringField(input, \"question\") || stringField(input, \"prompt\") || stringField(input, \"text\");\n if (!text) return [];\n return [{\n id: stringField(input, \"id\") || \"1\",\n text,\n ...optionalContext(input),\n multiSelect: booleanField(input, \"multiSelect\") || booleanField(input, \"multi_select\"),\n options: optionList(input.options),\n }];\n}\n\nfunction questionFromValue(value: unknown, index: number): SessionQuestion | null {\n if (typeof value === \"string\") {\n const text = value.trim();\n return text ? { id: String(index + 1), text, options: [] } : null;\n }\n if (!isRecord(value)) return null;\n const text =\n stringField(value, \"question\") ||\n stringField(value, \"text\") ||\n stringField(value, \"prompt\") ||\n stringField(value, \"label\");\n if (!text) return null;\n return {\n id: stringField(value, \"id\") || String(index + 1),\n text,\n ...optionalContext(value),\n multiSelect: booleanField(value, \"multiSelect\") || booleanField(value, \"multi_select\"),\n ...(booleanField(value, \"isOther\") || booleanField(value, \"is_other\") ? { isOther: true } : {}),\n options: optionList(value.options),\n };\n}\n\nfunction optionList(value: unknown): SessionQuestionOption[] {\n if (!Array.isArray(value)) return [];\n return value.flatMap((option, index) => {\n if (typeof option === \"string\") {\n const label = option.trim();\n return label ? [{ value: label, label }] : [];\n }\n if (!isRecord(option)) return [];\n const label =\n stringField(option, \"label\") ||\n stringField(option, \"value\") ||\n stringField(option, \"id\") ||\n stringField(option, \"description\");\n if (!label) return [];\n const value = stringField(option, \"value\") || stringField(option, \"id\") || label;\n const description = stringField(option, \"description\");\n return [{\n value: value || String(index + 1),\n label,\n ...(description && description !== label ? { description } : {}),\n }];\n });\n}\n\nfunction optionalContext(input: Record<string, unknown>): Pick<SessionQuestion, \"context\"> {\n const context = stringField(input, \"header\") || stringField(input, \"context\") || stringField(input, \"description\");\n return context ? { context } : {};\n}\n\nfunction stringField(input: Record<string, unknown>, key: string): string {\n const value = input[key];\n return typeof value === \"string\" ? value.trim() : \"\";\n}\n\nfunction booleanField(input: Record<string, unknown>, key: string): boolean {\n return input[key] === true;\n}\n\n/**\n * What each question was answered with, read from the question tool's response:\n * Codex's `{\"answers\":{id:{\"answers\":[…]}}}`, a plain `{\"answers\":{id|text: value}}`\n * map, or Claude's `\"question\"=\"answer\"` text. A question the response does not\n * answer is absent, so the caller can still show the raw response.\n */\nexport function answersFromToolResponse(\n response: string | undefined,\n questions: readonly SessionQuestion[],\n): Map<string, string[]> {\n const found = new Map<string, string[]>();\n if (!response) return found;\n const byKey = answerMapFromJson(response) ?? answerMapFromText(response);\n for (const question of questions) {\n const values = byKey.get(question.id) ?? byKey.get(question.text);\n if (values?.length) found.set(question.id, values);\n }\n return found;\n}\n\nfunction answerValues(value: unknown): string[] {\n if (typeof value === \"string\") return [value];\n if (Array.isArray(value)) return value.filter((item): item is string => typeof item === \"string\");\n if (isRecord(value)) return answerValues(value.answers ?? value.answer);\n return [];\n}\n\n/** The `answers` map of a JSON response, or null when the response is not one. */\nfunction answerMapFromJson(response: string): Map<string, string[]> | null {\n const trimmed = response.trim();\n if (!trimmed.startsWith(\"{\")) return null;\n let parsed: unknown;\n try {\n parsed = JSON.parse(trimmed);\n } catch {\n return null;\n }\n if (!isRecord(parsed) || !isRecord(parsed.answers)) return null;\n return new Map(Object.entries(parsed.answers).map(([key, value]) => [key, answerValues(value)]));\n}\n\nconst QUOTED_ANSWER = /\"((?:[^\"\\\\]|\\\\.)*)\"=\"((?:[^\"\\\\]|\\\\.)*)\"/g;\n\nfunction answerMapFromText(response: string): Map<string, string[]> {\n return new Map([...response.matchAll(QUOTED_ANSWER)].map((match) => [match[1]!, [match[2]!]]));\n}\n\n/** Whether an answer picked this option; a Claude multi-select answer joins its picks with \", \". */\nexport function optionAnswered(option: SessionQuestionOption, answers: readonly string[]): boolean {\n return answers.some((answer) =>\n answer === option.value || answer === option.label || answer.split(\", \").includes(option.label),\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === \"object\" && !Array.isArray(value);\n}\n"],"mappings":";;;;;;AAWA,SAAgB,eAAe,MAAc,KAAsB;CACjE,IAAI,CAAC,KAAK,OAAO;CACjB,MAAM,OAAO,qBAAqB,GAAG;CACrC,OAAO,KAAK,WAAW,GAAG,KAAK,EAAE,IAAI,KAAK,MAAM,KAAK,SAAS,CAAC,IAAI;AACrE;;;;AAKA,SAAgB,aACd,MACA,OACoB;CACpB,IAAI,SAAS,QAAQ,OAAO,KAAA;CAC5B,MAAM,UAAU,QAAQ;CACxB,OAAO,OAAO,YAAY,YAAY,UAAU,UAAU,KAAA;AAC5D;AAwBA,IAAM,sBAAyD;CAC7D,MAAM,CAAC,SAAS;CAChB,MAAM;EAAC;EAAa;EAAiB;CAAM;CAC3C,OAAO;EAAC;EAAa;EAAiB;EAAQ;CAAS;CACvD,MAAM;EAAC;EAAa;EAAiB;EAAQ;EAAc;CAAY;CACvE,WAAW;EAAC;EAAa;EAAiB;EAAQ;CAAO;CACzD,cAAc;EAAC;EAAa;EAAiB;CAAM;CACnD,iBAAiB;EAAC;EAAa;EAAY;EAAU;EAAQ;EAAU;EAAW;EAAe;CAAS;CAC1G,YAAY;EAAC;EAAS;EAAS;EAAa;EAAS;EAAa;EAAa;CAAI;AACrF;AAYA,SAAS,gBAAgB,OAAkD;CACzE,MAAM,QAAQ,MAAM;CACpB,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO,CAAC;CACnC,OAAO,MAAM,QACV,SAAiC,OAAO,SAAS,YAAY,SAAS,IACzE;AACF;AAEA,SAAS,oBACP,OACA,KACQ;CACR,MAAM,QAAQ,gBAAgB,KAAK;CACnC,IA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../CodeBlock.cjs");
|
|
3
3
|
const require_CodeDiff = require("../CodeDiff.cjs");
|
|
4
|
+
const require_Icon = require("../Icon.cjs");
|
|
5
|
+
const require_utils = require("../../lib/utils.cjs");
|
|
6
|
+
const require_UiCheck = require("../../icons/components/UiCheck.cjs");
|
|
7
|
+
const require_UiCircleOutline = require("../../icons/components/UiCircleOutline.cjs");
|
|
8
|
+
const require_SessionViewer_input = require("./SessionViewer.input.cjs");
|
|
4
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
10
|
// src/data/ai/SessionViewer.tool-details.tsx
|
|
6
|
-
|
|
11
|
+
/**
|
|
12
|
+
* One question with its options listed one per line. Once `answer` is known the
|
|
13
|
+
* chosen options are marked and the rest muted; an answer that matches no
|
|
14
|
+
* option (a typed-in reply) is shown beneath them.
|
|
15
|
+
*/
|
|
16
|
+
function QuestionCard({ question, index, answer }) {
|
|
7
17
|
const label = question.context || (question.id ? `Question ${question.id}` : `Question ${index + 1}`);
|
|
18
|
+
const freeText = answer?.filter((value) => !question.options.some((option) => require_SessionViewer_input.optionAnswered(option, [value]))) ?? [];
|
|
8
19
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
9
20
|
className: "rounded-md border border-sky-500/20 bg-sky-500/5 px-density-3 py-density-2",
|
|
21
|
+
"data-question-card": "",
|
|
10
22
|
children: [
|
|
11
23
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12
24
|
className: "text-[11px] font-medium uppercase text-muted-foreground",
|
|
@@ -16,18 +28,37 @@ function QuestionCard({ question, index }) {
|
|
|
16
28
|
className: "mt-0.5 whitespace-pre-wrap break-words text-sm text-foreground",
|
|
17
29
|
children: question.text
|
|
18
30
|
}),
|
|
19
|
-
question.options.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
20
|
-
className: "mt-1.5 flex flex-
|
|
21
|
-
children: question.options.map((option) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
question.options.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
32
|
+
className: "mt-1.5 flex list-none flex-col gap-1 p-0",
|
|
33
|
+
children: question.options.map((option) => {
|
|
34
|
+
const chosen = !!answer && require_SessionViewer_input.optionAnswered(option, answer);
|
|
35
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
36
|
+
"data-chosen": answer ? String(chosen) : void 0,
|
|
37
|
+
className: require_utils.cn("flex items-start gap-1.5 rounded border bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground", chosen ? "border-sky-500/60" : "border-border", answer && !chosen && "opacity-50"),
|
|
38
|
+
children: [answer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
39
|
+
icon: chosen ? require_UiCheck.UiCheck : require_UiCircleOutline.UiCircleOutline,
|
|
40
|
+
className: require_utils.cn("mt-0.5 size-3 shrink-0", chosen ? "text-sky-600 dark:text-sky-400" : "text-muted-foreground"),
|
|
41
|
+
"aria-label": chosen ? "Chosen" : "Not chosen"
|
|
42
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
43
|
+
className: "min-w-0",
|
|
44
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
45
|
+
className: "font-medium text-foreground",
|
|
46
|
+
children: option.label
|
|
47
|
+
}), option.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
48
|
+
className: "ml-1",
|
|
49
|
+
children: option.description
|
|
50
|
+
})]
|
|
51
|
+
})]
|
|
52
|
+
}, option.value);
|
|
53
|
+
})
|
|
54
|
+
}),
|
|
55
|
+
freeText.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
56
|
+
className: "mt-1.5 whitespace-pre-wrap break-words text-xs text-foreground",
|
|
57
|
+
"data-question-free-answer": "",
|
|
58
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
59
|
+
className: "mr-1 text-[11px] font-medium uppercase text-muted-foreground",
|
|
60
|
+
children: "Answer"
|
|
61
|
+
}), freeText.join(", ")]
|
|
31
62
|
})
|
|
32
63
|
]
|
|
33
64
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionViewer.tool-details.cjs","names":["CodeDiff","DensityValueProvider","CodeBlock"],"sources":["../../../src/data/ai/SessionViewer.tool-details.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { DensityValueProvider } from \"../../hooks/density-provider\";\nimport { CodeBlock } from \"../CodeBlock\";\nimport { CodeDiff } from \"../CodeDiff\";\nimport
|
|
1
|
+
{"version":3,"file":"SessionViewer.tool-details.cjs","names":["optionAnswered","cn","Icon","UiCheck","UiCircleOutline","CodeDiff","DensityValueProvider","CodeBlock"],"sources":["../../../src/data/ai/SessionViewer.tool-details.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { DensityValueProvider } from \"../../hooks/density-provider\";\nimport { CodeBlock } from \"../CodeBlock\";\nimport { CodeDiff } from \"../CodeDiff\";\nimport { Icon } from \"../Icon\";\nimport { cn } from \"../../lib/utils\";\nimport { UiCheck, UiCircleOutline } from \"../../icons\";\nimport {\n optionAnswered,\n type SessionQuestion,\n type ToolDiff,\n type ToolParam,\n} from \"./SessionViewer.input\";\n\n/**\n * One question with its options listed one per line. Once `answer` is known the\n * chosen options are marked and the rest muted; an answer that matches no\n * option (a typed-in reply) is shown beneath them.\n */\nexport function QuestionCard({\n question,\n index,\n answer,\n}: {\n question: SessionQuestion;\n index: number;\n answer?: readonly string[] | undefined;\n}) {\n const label =\n question.context ||\n (question.id ? `Question ${question.id}` : `Question ${index + 1}`);\n const freeText = answer?.filter((value) => !question.options.some((option) => optionAnswered(option, [value]))) ?? [];\n return (\n <div className=\"rounded-md border border-sky-500/20 bg-sky-500/5 px-density-3 py-density-2\" data-question-card=\"\">\n <div className=\"text-[11px] font-medium uppercase text-muted-foreground\">\n {label}\n </div>\n <div className=\"mt-0.5 whitespace-pre-wrap break-words text-sm text-foreground\">\n {question.text}\n </div>\n {question.options.length > 0 && (\n <ul className=\"mt-1.5 flex list-none flex-col gap-1 p-0\">\n {question.options.map((option) => {\n const chosen = !!answer && optionAnswered(option, answer);\n return (\n <li\n key={option.value}\n data-chosen={answer ? String(chosen) : undefined}\n className={cn(\n \"flex items-start gap-1.5 rounded border bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground\",\n chosen ? \"border-sky-500/60\" : \"border-border\",\n answer && !chosen && \"opacity-50\",\n )}\n >\n {answer && (\n <Icon\n icon={chosen ? UiCheck : UiCircleOutline}\n className={cn(\"mt-0.5 size-3 shrink-0\", chosen ? \"text-sky-600 dark:text-sky-400\" : \"text-muted-foreground\")}\n aria-label={chosen ? \"Chosen\" : \"Not chosen\"}\n />\n )}\n <span className=\"min-w-0\">\n <span className=\"font-medium text-foreground\">{option.label}</span>\n {option.description && <span className=\"ml-1\">{option.description}</span>}\n </span>\n </li>\n );\n })}\n </ul>\n )}\n {freeText.length > 0 && (\n <div className=\"mt-1.5 whitespace-pre-wrap break-words text-xs text-foreground\" data-question-free-answer=\"\">\n <span className=\"mr-1 text-[11px] font-medium uppercase text-muted-foreground\">Answer</span>\n {freeText.join(\", \")}\n </div>\n )}\n </div>\n );\n}\n\nexport function InlineParams({ params }: { params: ToolParam[] }) {\n return (\n <span className=\"min-w-0 flex-1 truncate font-mono text-xs\">\n {params.map((param) => (\n <span key={param.name} className=\"[&:not(:first-child)]:ml-2\">\n <span className=\"text-muted-foreground/70\">{param.name}: </span>\n <span className=\"text-muted-foreground\">{param.value}</span>\n </span>\n ))}\n </span>\n );\n}\n\nexport function DiffBlock({ diff }: { diff: ToolDiff }) {\n return (\n <div className=\"space-y-1.5\">\n {diff.segments.map((segment, index) => (\n <CodeDiff\n key={index}\n bare\n showLineNumbers={false}\n original={segment.original}\n modified={segment.modified}\n {...(diff.language ? { language: diff.language } : {})}\n />\n ))}\n </div>\n );\n}\n\nexport function ResponseBlock({ response }: { response: string }) {\n const trimmed = response.trim();\n const isJson = trimmed.startsWith(\"{\") || trimmed.startsWith(\"[\");\n return <DetailBlock language={isJson ? \"json\" : \"text\"} source={response} />;\n}\n\nexport function DetailBlock({\n language,\n source,\n}: {\n language: string;\n source: string;\n}): ReactNode {\n return (\n <DensityValueProvider density=\"compact\">\n <div className=\"overflow-x-auto text-xs\">\n <CodeBlock bare language={language} source={source} jsonFormat=\"yaml\" />\n </div>\n </DensityValueProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,SAAgB,aAAa,EAC3B,UACA,OACA,UAKC;CACD,MAAM,QACJ,SAAS,YACR,SAAS,KAAK,YAAY,SAAS,OAAO,YAAY,QAAQ;CACjE,MAAM,WAAW,QAAQ,QAAQ,UAAU,CAAC,SAAS,QAAQ,MAAM,WAAWA,4BAAAA,eAAe,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;CACpH,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAA6E,sBAAmB;EAA/G,UAAA;GACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,WAAU;IACZ,UAAA;GACE,CAAA;GACL,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,WAAU;IACZ,UAAA,SAAS;GACP,CAAA;GACJ,SAAS,QAAQ,SAAS,KACzB,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;IAAI,WAAU;IACX,UAAA,SAAS,QAAQ,KAAK,WAAW;KAChC,MAAM,SAAS,CAAC,CAAC,UAAUA,4BAAAA,eAAe,QAAQ,MAAM;KACxD,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,MAAD;MAEE,eAAa,SAAS,OAAO,MAAM,IAAI,KAAA;MACvC,WAAWC,cAAAA,G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CACP;CACG,CAAA;AAEV;AAEA,SAAgB,UAAU,EAAE,QAA4B;CACtD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACZ,UAAA,KAAK,SAAS,KAAK,SAAS,UAC3B,iBAAA,GAAA,kBAAA,IAAA,CAACI,iBAAAA,UAAD;GAEE,MAAA;GACA,iBAAiB;GACjB,UAAU,QAAQ;GAClB,UAAU,QAAQ;GAClB,GAAK,KAAK,WAAW,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC;EACrD,GANM,KAMN,CACF;CACE,CAAA;AAET;AAEA,SAAgB,cAAc,EAAE,YAAkC;CAChE,MAAM,UAAU,SAAS,KAAK;CAC9B,MAAM,SAAS,QAAQ,WAAW,GAAG,KAAK,QAAQ,WAAW,GAAG;CAChE,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD;EAAa,UAAU,SAAS,SAAS;EAAQ,QAAQ;CAAW,CAAA;AAC7E;AAEA,SAAgB,YAAY,EAC1B,UACA,UAIY;CACZ,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,yBAAAA,sBAAD;EAAsB,SAAQ;EAC5B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAU;GACb,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,kBAAAA,WAAD;IAAW,MAAA;IAAe;IAAkB;IAAQ,YAAW;GAAQ,CAAA;EACpE,CAAA;CACe,CAAA;AAE1B"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { SessionQuestion, ToolDiff, ToolParam } from './SessionViewer.input.js';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* One question with its options listed one per line. Once `answer` is known the
|
|
5
|
+
* chosen options are marked and the rest muted; an answer that matches no
|
|
6
|
+
* option (a typed-in reply) is shown beneath them.
|
|
7
|
+
*/
|
|
8
|
+
export declare function QuestionCard({ question, index, answer, }: {
|
|
4
9
|
question: SessionQuestion;
|
|
5
10
|
index: number;
|
|
11
|
+
answer?: readonly string[] | undefined;
|
|
6
12
|
}): import("react").JSX.Element;
|
|
7
13
|
export declare function InlineParams({ params }: {
|
|
8
14
|
params: ToolParam[];
|