@bastani/atomic 0.9.17-alpha.1 → 0.9.18-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/builtin/intercom/CHANGELOG.md +8 -0
- package/dist/builtin/intercom/index.bundle.mjs +349 -57517
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/index.bundle.mjs +28948 -58339
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/mcp/xdg-open +1267 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +7929 -78021
- package/dist/builtin/web-access/index.bundle.mjs +70791 -57707
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/builtin/adversarial-verification.js +0 -1
- package/dist/builtin/workflows/builtin/{chunk-3y1hmzw6.js → chunk-6v0yv8tj.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-w9c7rkrk.js → chunk-brerg33r.js} +5 -7
- package/dist/builtin/workflows/builtin/{chunk-bz1c9732.js → chunk-ngffz3y8.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-6rbajjf5.js → chunk-szz1ajz9.js} +1 -3
- package/dist/builtin/workflows/builtin/classify-and-act.js +0 -1
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +0 -1
- package/dist/builtin/workflows/builtin/generate-and-filter.js +0 -1
- package/dist/builtin/workflows/builtin/goal.js +2 -5
- package/dist/builtin/workflows/builtin/index.js +4 -7
- package/dist/builtin/workflows/builtin/loop-until-done.js +0 -1
- package/dist/builtin/workflows/builtin/open-claude-design.js +1 -4
- package/dist/builtin/workflows/builtin/ralph.js +2 -5
- package/dist/builtin/workflows/builtin/steering-context.js +0 -1
- package/dist/builtin/workflows/builtin/tournament.js +0 -1
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +39989 -81500
- package/dist/builtin/workflows/src/index.js +1253 -58524
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/split-loader.js +2 -0
- package/dist/bun/split-loader.js.map +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-command.js.map +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli.js +5 -2
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts +19 -2
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +253 -74
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +8 -3
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts +2 -7
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +1 -35
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +2 -0
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/auth-storage-backends.js.map +1 -1
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/builtin-packages.d.ts +8 -0
- package/dist/core/builtin-packages.d.ts.map +1 -1
- package/dist/core/builtin-packages.js +11 -5
- package/dist/core/builtin-packages.js.map +1 -1
- package/dist/core/event-bus.d.ts +11 -0
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js +96 -0
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/extensions/builtin-extension-entry-labels.d.ts +6 -0
- package/dist/core/extensions/builtin-extension-entry-labels.d.ts.map +1 -0
- package/dist/core/extensions/builtin-extension-entry-labels.js +22 -0
- package/dist/core/extensions/builtin-extension-entry-labels.js.map +1 -0
- package/dist/core/extensions/host-module-bridge.d.ts +22 -0
- package/dist/core/extensions/host-module-bridge.d.ts.map +1 -0
- package/dist/core/extensions/host-module-bridge.js +39 -0
- package/dist/core/extensions/host-module-bridge.js.map +1 -0
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +2 -2
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-core.js.map +1 -1
- package/dist/core/extensions/loader-discovery.js.map +1 -1
- package/dist/core/extensions/loader-host-modules.d.ts +10 -0
- package/dist/core/extensions/loader-host-modules.d.ts.map +1 -0
- package/dist/core/extensions/loader-host-modules.js +88 -0
- package/dist/core/extensions/loader-host-modules.js.map +1 -0
- package/dist/core/extensions/loader-runtime.d.ts.map +1 -1
- package/dist/core/extensions/loader-runtime.js +1 -0
- package/dist/core/extensions/loader-runtime.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts +5 -2
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +51 -71
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +1 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/native-builtin-entries.d.ts +6 -0
- package/dist/core/extensions/native-builtin-entries.d.ts.map +1 -0
- package/dist/core/extensions/native-builtin-entries.js +23 -0
- package/dist/core/extensions/native-builtin-entries.js.map +1 -0
- package/dist/core/extensions/runtime-types.d.ts +2 -0
- package/dist/core/extensions/runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/runtime-types.js.map +1 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/lifecycle-timings.d.ts +21 -0
- package/dist/core/lifecycle-timings.d.ts.map +1 -0
- package/dist/core/lifecycle-timings.js +57 -0
- package/dist/core/lifecycle-timings.js.map +1 -0
- package/dist/core/mandatory-resource-loader.d.ts.map +1 -1
- package/dist/core/mandatory-resource-loader.js +43 -0
- package/dist/core/mandatory-resource-loader.js.map +1 -1
- package/dist/core/model-runtime.d.ts +8 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +82 -0
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/package-manager-auto-resources.js.map +1 -1
- package/dist/core/package-manager-env.js.map +1 -1
- package/dist/core/package-manager-git.js.map +1 -1
- package/dist/core/package-manager-manifest.js.map +1 -1
- package/dist/core/package-manager-npm.js.map +1 -1
- package/dist/core/package-manager-paths.js.map +1 -1
- package/dist/core/package-manager-resolver.js.map +1 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/prompt-templates-async.js.map +1 -1
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader-assets.js.map +1 -1
- package/dist/core/resource-loader-context-files.js.map +1 -1
- package/dist/core/resource-loader-core.d.ts +5 -1
- package/dist/core/resource-loader-core.d.ts.map +1 -1
- package/dist/core/resource-loader-core.js +90 -1
- package/dist/core/resource-loader-core.js.map +1 -1
- package/dist/core/resource-loader-discovery.js.map +1 -1
- package/dist/core/resource-loader-paths.js.map +1 -1
- package/dist/core/resource-loader-source-info.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +16 -0
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +4 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-paths.js.map +1 -1
- package/dist/core/settings-manager-core.d.ts +6 -0
- package/dist/core/settings-manager-core.d.ts.map +1 -1
- package/dist/core/settings-manager-core.js +24 -0
- package/dist/core/settings-manager-core.js.map +1 -1
- package/dist/core/settings-manager-ui-accessors.js.map +1 -1
- package/dist/core/settings-storage.js.map +1 -1
- package/dist/core/skills-async.js.map +1 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +0 -6
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/telemetry.js.map +1 -1
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/powershell.js.map +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/session-temp-cleanup.js.map +1 -1
- package/dist/core/tools/session-temp-dir.js.map +1 -1
- package/dist/core/tools/todos-paths.js.map +1 -1
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main-deferred-startup.d.ts +16 -0
- package/dist/main-deferred-startup.d.ts.map +1 -1
- package/dist/main-deferred-startup.js +14 -0
- package/dist/main-deferred-startup.js.map +1 -1
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +41 -22
- package/dist/main.js.map +1 -1
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/chat-input-actions.js.map +1 -1
- package/dist/modes/interactive/components/config-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/config-selector-project-scope.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/startup-identity.d.ts.map +1 -1
- package/dist/modes/interactive/components/startup-identity.js +4 -0
- package/dist/modes/interactive/components/startup-identity.js.map +1 -1
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.js +13 -5
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +2 -5
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +8 -8
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-onboarding.js +1 -1
- package/dist/modes/interactive/interactive-onboarding.js.map +1 -1
- package/dist/modes/interactive/interactive-prompt-restore.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-prompt-restore.js +2 -1
- package/dist/modes/interactive/interactive-prompt-restore.js.map +1 -1
- package/dist/modes/interactive/interactive-prompt-turn.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +2 -0
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.js +21 -53
- package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-paths.js +29 -5
- package/dist/modes/interactive/interactive-resource-paths.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.js +66 -69
- package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
- package/dist/modes/interactive/interactive-startup-chat-container.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup-chat-container.js +2 -0
- package/dist/modes/interactive/interactive-startup-chat-container.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts +2 -0
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +30 -10
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-tui.js +12 -2
- package/dist/modes/interactive/interactive-tui.js.map +1 -1
- package/dist/modes/interactive/theme/global-theme.js.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.js.map +1 -1
- package/dist/modes/interactive-engine/create-isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/engine-child-liveness.d.ts +2 -0
- package/dist/modes/interactive-engine/engine-child-liveness.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-child-liveness.js +16 -2
- package/dist/modes/interactive-engine/engine-child-liveness.js.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
- package/dist/modes/interactive-engine/engine-monitor.d.ts +5 -0
- package/dist/modes/interactive-engine/engine-monitor.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-monitor.js +24 -0
- package/dist/modes/interactive-engine/engine-monitor.js.map +1 -1
- package/dist/modes/interactive-engine/engine-render-service.js.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +3 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.js +6 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +21 -2
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +160 -7
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +9 -4
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +8 -4
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/interactive-engine/resource-readiness-error.d.ts +6 -0
- package/dist/modes/interactive-engine/resource-readiness-error.d.ts.map +1 -0
- package/dist/modes/interactive-engine/resource-readiness-error.js +11 -0
- package/dist/modes/interactive-engine/resource-readiness-error.js.map +1 -0
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +3 -0
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +1 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +5 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts +4 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +59 -18
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +4 -13
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +31 -2
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-resource-readiness.d.ts +11 -0
- package/dist/modes/rpc/rpc-resource-readiness.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-resource-readiness.js +51 -0
- package/dist/modes/rpc/rpc-resource-readiness.js.map +1 -0
- package/dist/modes/rpc/rpc-session-binding.d.ts +2 -0
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +21 -0
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +7 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli-parser.js.map +1 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/rpc-entry.js.map +1 -1
- package/dist/self-update-plan.js.map +1 -1
- package/dist/utils/changelog.d.ts +1 -1
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/module-require.js.map +1 -1
- package/dist/utils/pi-user-agent.js.map +1 -1
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/windows-self-update.js.map +1 -1
- package/docs/development.md +28 -1
- package/docs/extensions.md +5 -3
- package/docs/quickstart.md +1 -3
- package/docs/sdk.md +2 -0
- package/docs/usage.md +3 -1
- package/docs/windows.md +8 -0
- package/npm-shrinkwrap.json +32 -32
- package/package.json +4 -4
- package/dist/builtin/workflows/builtin/chunk-4febxsv4.js +0 -264
- package/dist/builtin/workflows/builtin/chunk-5wgwscd0.js +0 -4
- package/dist/builtin/workflows/builtin/chunk-dattsgxg.js +0 -529
- package/dist/builtin/workflows/builtin/chunk-gdx0avpx.js +0 -70082
- package/dist/builtin/workflows/builtin/chunk-qx2ptjs3.js +0 -215
- package/dist/builtin/workflows/builtin/chunk-x2ghn0je.js +0 -4110
- package/dist/core/atomic-guide-command.d.ts +0 -41
- package/dist/core/atomic-guide-command.d.ts.map +0 -1
- package/dist/core/atomic-guide-command.js +0 -311
- package/dist/core/atomic-guide-command.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-prompt-turn.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-prompt-turn.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAA8B,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAElG,mBAAmB,CAAC,SAAS,CAAC,iBAAiB,GAAG,KAAK,WAEtD,KAAqC;IAErC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAClE,4EAA4E;IAC5E,wEAAwE;IACxE,sEAAsE;IACtE,IAAI,CAAC,6BAA6B,GAAG,IAAI,CAAC;IAC1C,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC5B,MAAM,8BAA8B,GAAG,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,sBAAsB,KAAK,SAAS,CAAC;IAChH,sEAAsE;IACtE,2CAA2C;IAC3C,MAAM,gBAAgB,EAAE,CAAC;IACzB,2EAA2E;IAC3E,0EAA0E;IAC1E,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;QAC7D,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa;YAAE,WAAW,GAAG,IAAI,CAAC;IACtD,CAAC,CAAC,CAAC;IACH,IAAI,CAAC;QACJ,IAAI,8BAA8B,EAAE,CAAC;YACpC,MAAM,IAAI,CAAC,6BAA6B,EAAE,CAAC;QAC5C,CAAC;QACD,uEAAuE;QACvE,wEAAwE;QACxE,MAAM,mBAAmB,GAAG,MAAM,6BAA6B,CAC9D,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"interactive-prompt-turn.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-prompt-turn.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAA8B,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAElG,mBAAmB,CAAC,SAAS,CAAC,iBAAiB,GAAG,KAAK,WAEtD,KAAqC;IAErC,MAAM,EAAE,IAAI,EAAE,SAAS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,CAAC,QAAQ,EAAE,CAAC;YACf,IAAI,CAAC,SAAS,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC;QACnF,CAAC;IACF,CAAC;YAAS,CAAC;QACV,oBAAoB,EAAE,CAAC;QACvB,IAAI,CAAC,6BAA6B,GAAG,KAAK,CAAC;QAC3C,oEAAoE;QACpE,yEAAyE;QACzE,yDAAyD;QACzD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAC/B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC1B,CAAC;IACF,CAAC;AACF,CAAC,CAAC","sourcesContent":["import type { AgentSessionInternalSurface } from \"../../core/agent-session-methods.ts\";\nimport { tryExecuteSessionSlashCommand } from \"../../core/agent-session-prompt.ts\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { restoreFailedSubmissionDraft } from \"./interactive-prompt-restore.ts\";\nimport { type InteractiveSubmission, toInteractiveSubmission } from \"./interactive-submission.ts\";\n\nInteractiveModeBase.prototype.runUserPromptTurn = async function (\n\tthis: InteractiveModeBase,\n\tinput: InteractiveSubmission | string,\n): Promise<void> {\n\tconst { text: userInput, draft } = toInteractiveSubmission(input);\n\t// Show the working spinner immediately on submit so there is no visible gap\n\t// while prompt preflight runs before the agent emits `agent_start`. The\n\t// ownership flag keeps deferred startup from tearing it down mid-way.\n\tthis.promptTurnWorkingLoaderActive = true;\n\tthis.showWorkingLoaderNow();\n\tconst deferredStartupNeedsPromptGate = this.deferredStartupPending || this.deferredStartupPromise !== undefined;\n\t// Yield once so the freshly-mounted spinner paints before synchronous\n\t// preflight work can block the event loop.\n\tawait yieldToEventLoop();\n\t// A submission that never reaches an agent turn stays user-owned, so track\n\t// whether the turn actually started before deciding to restore the draft.\n\tlet turnStarted = false;\n\tconst unsubscribeTurnStart = this.session.subscribe((event) => {\n\t\tif (event.type === \"agent_start\") turnStarted = true;\n\t});\n\ttry {\n\t\tif (deferredStartupNeedsPromptGate) {\n\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t}\n\t\t// The public facade omits prototype-installed command methods, but the\n\t\t// interactive runtime always owns the concrete AgentSession dispatcher.\n\t\tconst handledSlashCommand = await tryExecuteSessionSlashCommand(\n\t\t\tthis.session as typeof this.session & Pick<AgentSessionInternalSurface, \"_tryExecuteExtensionCommand\">,\n\t\t\tuserInput,\n\t\t);\n\t\tif (!handledSlashCommand) {\n\t\t\tawait this.session.resumeQueuedMessages();\n\t\t\tawait this.session.prompt(userInput);\n\t\t}\n\t} catch (error) {\n\t\tthis.discardDeferredRenderedUserInput(userInput);\n\t\tconst restored = restoreFailedSubmissionDraft(this, error, draft, { turnStarted });\n\t\t// A restored draft already tells the user the submission did not land, and\n\t\t// the recovery status explains why. A red transport error beside it is noise.\n\t\tif (!restored) {\n\t\t\tthis.showError(error instanceof Error ? error.message : \"Unknown error occurred\");\n\t\t}\n\t} finally {\n\t\tunsubscribeTurnStart();\n\t\tthis.promptTurnWorkingLoaderActive = false;\n\t\t// A submission that resolves without starting an agent turn (e.g. a\n\t\t// handled slash command) never emits `agent_end`, so clear the pre-shown\n\t\t// spinner here when idle to avoid a lingering indicator.\n\t\tif (!this.session.isStreaming) {\n\t\t\tthis.stopWorkingLoader();\n\t\t}\n\t}\n};\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CACHE_TTL_MS, collectCacheMisses } from "../../core/cache-stats.js";
|
|
2
|
+
import { markLifecycleTiming } from "../../core/lifecycle-timings.js";
|
|
2
3
|
import { VERBATIM_COMPACTION_PREFIX } from "../../core/messages.js";
|
|
3
4
|
import { buildContextEntries, sessionEntryToContextMessages } from "../../core/session-manager.js";
|
|
4
5
|
import { yieldToEventLoop } from "../../utils/event-loop.js";
|
|
@@ -356,6 +357,7 @@ InteractiveModeBase.prototype.getUserInput = async function () {
|
|
|
356
357
|
if (!this.inputHandlerReadyRecorded) {
|
|
357
358
|
this.inputHandlerReadyRecorded = true;
|
|
358
359
|
recordTimeSinceReset("interactive-input-handler-ready");
|
|
360
|
+
markLifecycleTiming("interactive-input-handler-ready");
|
|
359
361
|
void (async () => {
|
|
360
362
|
await yieldToEventLoop();
|
|
361
363
|
// pi parity: the changelog/first-run notices need nothing from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-render-chat.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAqB,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AACtH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACtH,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEN,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAG7B,kCAAkC,EAElC,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EAEtB,+BAA+B,EAC/B,MAAM,EACN,IAAI,EACJ,sBAAsB,EAEtB,KAAK,EACL,oBAAoB,GAEpB,MAAM,4BAA4B,CAAC;AAGpC,mBAAmB,CAAC,SAAS,CAAC,UAAU,GAAG,UAAqC,OAAe;IAC9F,MAAM,QAAQ,GAAG,IAAI,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AA0B,EAAE,CAAC,CAAC;AACxG,CAAC,CAAC;AAEF,SAAS,+BAA+B,CAAC,OAAiC,EAAE,MAAgC;IAC3G,IAAI,OAAO,EAAE,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,UAAU,KAAK,YAAY,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IACxG,MAAM,OAAO,GAAG,OAAO,CAAC,OAA4C,CAAC;IACrE,IAAI,OAAO,EAAE,QAAQ,KAAK,gBAAgB;QAAE,OAAO,KAAK,CAAC;IACzD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;QAC7C,CAAC,CAAC,OAAO,CAAC,OAAO;aACd,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC;aACxC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;aAC1B,IAAI,CAAC,IAAI,CAAC;QACb,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACnB,OAAO,OAAO,KAAK,0BAA0B,GAAG,MAAM,CAAC,aAAa,CAAC;AACtE,CAAC","sourcesContent":["import type { Usage } from \"@bastani/pi-ai/compat\";\nimport { CACHE_TTL_MS, collectCacheMisses } from \"../../core/cache-stats.ts\";\nimport { VERBATIM_COMPACTION_PREFIX } from \"../../core/messages.ts\";\nimport type { CustomEntry } from \"../../core/session-manager.ts\";\nimport { buildContextEntries, type SessionEntry, sessionEntryToContextMessages } from \"../../core/session-manager.ts\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.ts\";\nimport { RemoteCustomMessageComponent, RemoteToolExecutionComponent } from \"../interactive-engine/remote-renderer.ts\";\nimport { CustomEntryComponent } from \"./components/custom-entry.ts\";\nimport { createMermaidMarkdownTransformer } from \"./components/mermaid.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AgentMessage,\n\tAssistantMessageComponent,\n\taddChatTranscriptEntry,\n\tBashExecutionComponent,\n\tBranchSummaryMessageComponent,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tCompactionBoundaryMessageComponent,\n\ttype Component,\n\tCustomMessageComponent,\n\tchatEntriesFromAgentMessages,\n\tparseSkillBlock,\n\trecordTimeSinceReset,\n\trenderChatMessageEntry,\n\ttype SessionContext,\n\tSkillInvocationMessageComponent,\n\tSpacer,\n\tText,\n\tToolExecutionComponent,\n\ttype TruncationResult,\n\ttheme,\n\tUserMessageComponent,\n\ttype VerbatimCompactionResult,\n} from \"./interactive-mode-deps.ts\";\nimport type { InteractiveSubmission } from \"./interactive-submission.ts\";\n\nInteractiveModeBase.prototype.showStatus = function (this: InteractiveModeBase, message: string): void {\n\tconst children = this.chatContainer.children;\n\tconst last = children.length > 0 ? children[children.length - 1] : undefined;\n\tconst secondLast = children.length > 1 ? children[children.length - 2] : undefined;\n\n\tif (last && secondLast && last === this.lastStatusText && secondLast === this.lastStatusSpacer) {\n\t\tthis.lastStatusText.setText(theme.fg(\"dim\", message));\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\n\tconst spacer = new Spacer(1);\n\tconst text = new Text(theme.fg(\"dim\", message), 1, 0);\n\tthis.chatContainer.addChild(spacer);\n\tthis.chatContainer.addChild(text);\n\tthis.lastStatusSpacer = spacer;\n\tthis.lastStatusText = text;\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.renderDeferredUserInput = function (this: InteractiveModeBase, text: string): void {\n\tthis.deferredRenderedUserInputs.push(text);\n\tconst startIndex = this.chatContainer.children.length;\n\tthis.addMessageToChat({ role: \"user\", content: text } as AgentMessage);\n\tconst renderedComponents = this.chatContainer.children.slice(startIndex);\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text) ?? [];\n\ttrackedComponents.push(renderedComponents);\n\tthis.deferredRenderedUserInputComponents.set(text, trackedComponents);\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.consumeDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): boolean {\n\tconst index = this.deferredRenderedUserInputs.indexOf(text);\n\tif (index === -1) return false;\n\tthis.deferredRenderedUserInputs.splice(index, 1);\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n\ttrackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tthis.deferredRenderedUserInputComponents.delete(text);\n\t}\n\treturn true;\n};\n\nInteractiveModeBase.prototype.discardDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): void {\n\tconst index = this.deferredRenderedUserInputs.indexOf(text);\n\tif (index !== -1) this.deferredRenderedUserInputs.splice(index, 1);\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n\tconst componentsToRemove = trackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tthis.deferredRenderedUserInputComponents.delete(text);\n\t}\n\tif (!componentsToRemove) return;\n\tfor (const component of componentsToRemove) {\n\t\tthis.chatContainer.removeChild(component);\n\t}\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.getMarkdownTransformers = function (this: InteractiveModeBase) {\n\tconst mode = this.settingsManager.getMermaidRenderingMode();\n\tif (this.mermaidMarkdownTransformerMode !== mode) {\n\t\tthis.mermaidMarkdownTransformerMode = mode;\n\t\tthis.mermaidMarkdownTransformer = createMermaidMarkdownTransformer({\n\t\t\tgetMode: () => this.settingsManager.getMermaidRenderingMode(),\n\t\t\ttheme,\n\t\t});\n\t}\n\tconst extensionTransformers =\n\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t? []\n\t\t\t: this.session.extensionRunner.getMarkdownTransformers();\n\treturn [this.mermaidMarkdownTransformer, ...extensionTransformers];\n};\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function (\n\tthis: InteractiveModeBase,\n): ChatMessageRenderOptions {\n\tconst isolated = this.runtimeHost instanceof IsolatedInteractiveRuntime;\n\treturn {\n\t\tui: this.ui,\n\t\tcwd: this.sessionManager.getCwd(),\n\t\tmarkdownTheme: this.getMarkdownThemeWithSettings(),\n\t\thideThinkingBlock: this.hideThinkingBlock,\n\t\thiddenThinkingLabel: this.hiddenThinkingLabel,\n\t\ttoolOutputExpanded: this.toolOutputExpanded,\n\t\tshowImages: this.settingsManager.getShowImages(),\n\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\toutputPad: this.outputPad,\n\t\trenderLatex: this.settingsManager.getLatexRenderingEnabled(),\n\t\tmarkdownTransformers: this.getMarkdownTransformers(),\n\t\tgetToolDefinition: isolated ? undefined : (toolName) => this.getRegisteredToolDefinition(toolName),\n\t\tgetCustomMessageRenderer: isolated\n\t\t\t? undefined\n\t\t\t: (customType) => this.session.extensionRunner.getMessageRenderer(customType),\n\t\tcreateToolComponent: isolated\n\t\t\t? (entry) => {\n\t\t\t\t\tconst component = new RemoteToolExecutionComponent(\n\t\t\t\t\t\tentry.toolName,\n\t\t\t\t\t\tentry.toolCallId,\n\t\t\t\t\t\tentry.args,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tshowImages: this.settingsManager.getShowImages(),\n\t\t\t\t\t\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tif (entry.result) component.updateResult(entry.result, entry.isPartial ?? false);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tcreateCustomMessageComponent: isolated\n\t\t\t? (message) => {\n\t\t\t\t\tconst component = new RemoteCustomMessageComponent(\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n};\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function (\n\tthis: InteractiveModeBase,\n\tentry: ChatMessageEntry,\n): Component {\n\tconst component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n\taddChatTranscriptEntry(this.chatContainer, component, entry.role);\n\treturn component;\n};\n\nInteractiveModeBase.prototype.addCompactionBoundaryToChat = function (\n\tthis: InteractiveModeBase,\n\tresult: VerbatimCompactionResult,\n): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tconst component = new CompactionBoundaryMessageComponent(result);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tthis.chatContainer.addChild(component);\n};\n\nInteractiveModeBase.prototype.addCompactionCostNotice = function (\n\tthis: InteractiveModeBase,\n\tkind: \"compaction\" | \"branch_summary\",\n\tusage: Usage,\n): void {\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\tconst tokens = usage.input + usage.output + usage.cacheRead + usage.cacheWrite;\n\tconst cost = usage.cost.total >= 0.01 ? ` (~$${usage.cost.total.toFixed(2)})` : \"\";\n\tconst label = kind === \"compaction\" ? \"Compaction\" : \"Branch summary\";\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `${label}: ${tokens.toLocaleString()} tokens billed${cost}`), 1, 0),\n\t);\n};\n\nInteractiveModeBase.prototype.addCustomEntryToChat = function (this: InteractiveModeBase, entry: CustomEntry): void {\n\tconst renderer = this.session.extensionRunner.getEntryRenderer(entry.customType);\n\tif (!renderer) return;\n\tconst component = new CustomEntryComponent(entry, renderer);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tif (!component.hasContent()) return;\n\tconst streamingIndex = this.streamingComponent ? this.chatContainer.children.indexOf(this.streamingComponent) : -1;\n\tif (streamingIndex >= 0) this.chatContainer.children.splice(streamingIndex, 0, component);\n\telse this.chatContainer.addChild(component);\n};\n\nInteractiveModeBase.prototype.addMessageToChat = function (\n\tthis: InteractiveModeBase,\n\tmessage: AgentMessage,\n\toptions?: { populateHistory?: boolean },\n): void {\n\tconst markdownTransformers = this.getMarkdownTransformers();\n\tswitch (message.role) {\n\t\tcase \"bashExecution\": {\n\t\t\tconst component = new BashExecutionComponent(message.command, this.ui, message.excludeFromContext);\n\t\t\tif (message.output) {\n\t\t\t\tcomponent.appendOutput(message.output);\n\t\t\t}\n\t\t\tcomponent.setComplete(\n\t\t\t\tmessage.exitCode,\n\t\t\t\tmessage.cancelled,\n\t\t\t\tmessage.truncated ? ({ truncated: true } as TruncationResult) : undefined,\n\t\t\t\tmessage.fullOutputPath,\n\t\t\t);\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"custom\": {\n\t\t\tif (message.display) {\n\t\t\t\tconst component =\n\t\t\t\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t\t\t\t? new RemoteCustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.runtimeHost,\n\t\t\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: new CustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.session.extensionRunner.getMessageRenderer(message.customType),\n\t\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t\t);\n\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"branchSummary\": {\n\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\tconst component = new BranchSummaryMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t);\n\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"user\": {\n\t\t\tconst textContent = this.getUserMessageText(message);\n\t\t\tif (textContent) {\n\t\t\t\tif (this.chatContainer.children.length > 0) {\n\t\t\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\t\t}\n\t\t\t\tconst skillBlock = parseSkillBlock(textContent);\n\t\t\t\tif (skillBlock) {\n\t\t\t\t\t// Render skill block (collapsible)\n\t\t\t\t\tconst component = new SkillInvocationMessageComponent(\n\t\t\t\t\t\tskillBlock,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t\t\t// Render user message separately if present\n\t\t\t\t\tif (skillBlock.userMessage) {\n\t\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\t\tskillBlock.userMessage,\n\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\ttextContent,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t);\n\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t}\n\t\t\t\tif (options?.populateHistory) {\n\t\t\t\t\tthis.editor.addToHistory?.(textContent);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"assistant\": {\n\t\t\tconst assistantComponent = new AssistantMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.hideThinkingBlock,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.hiddenThinkingLabel,\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t\tfalse,\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t);\n\t\t\tthis.chatContainer.addChild(assistantComponent);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"toolResult\": {\n\t\t\t// Tool results are rendered inline with tool calls, handled separately\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tbreak;\n\t}\n};\n\nInteractiveModeBase.prototype.renderSessionContext = function (\n\tthis: InteractiveModeBase,\n\tsessionContext: SessionContext,\n\toptions: { updateFooter?: boolean; populateHistory?: boolean } = {},\n): void {\n\tthis.pendingTools.clear();\n\tconst pendingDeferredInputs = [...this.deferredRenderedUserInputs];\n\tthis.deferredRenderedUserInputs = [];\n\tthis.deferredRenderedUserInputComponents.clear();\n\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\n\tconst entries = chatEntriesFromAgentMessages(sessionContext.messages);\n\tfor (const entry of entries) {\n\t\tconst component = this.addRenderedChatEntry(entry);\n\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t}\n\t\tif (options.populateHistory && entry.kind === \"user\") {\n\t\t\tthis.editor.addToHistory?.(entry.text);\n\t\t}\n\t}\n\n\tfor (const input of pendingDeferredInputs) {\n\t\tthis.renderDeferredUserInput(input);\n\t}\n\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.renderSessionEntries = function (\n\tthis: InteractiveModeBase,\n\tsessionEntries: SessionEntry[],\n\toptions: {\n\t\tupdateFooter?: boolean;\n\t\tpopulateHistory?: boolean;\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t} = {},\n): void {\n\tthis.pendingTools.clear();\n\tconst deferredInputs = [...this.deferredRenderedUserInputs];\n\tthis.deferredRenderedUserInputs = [];\n\tthis.deferredRenderedUserInputComponents.clear();\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\tlet messageBuffer: AgentMessage[] = [];\n\tlet firstMessage = true;\n\tconst flushMessages = (): void => {\n\t\tif (\n\t\t\toptions.suppressCompactionBoundary &&\n\t\t\tfirstMessage &&\n\t\t\tisSynthesizedCompactionBoundary(messageBuffer[0], options.suppressCompactionBoundary)\n\t\t) {\n\t\t\tmessageBuffer = messageBuffer.slice(1);\n\t\t}\n\t\tfirstMessage = false;\n\t\tfor (const entry of chatEntriesFromAgentMessages(messageBuffer)) {\n\t\t\tconst component = this.addRenderedChatEntry(entry);\n\t\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t\t}\n\t\t\tif (options.populateHistory && entry.kind === \"user\") this.editor.addToHistory?.(entry.text);\n\t\t}\n\t\tmessageBuffer = [];\n\t};\n\tfor (const entry of sessionEntries) {\n\t\tif (entry.type === \"custom\") {\n\t\t\tflushMessages();\n\t\t\tthis.addCustomEntryToChat(entry);\n\t\t} else {\n\t\t\tmessageBuffer.push(...sessionEntryToContextMessages(entry));\n\t\t\tif ((entry.type === \"compaction\" || entry.type === \"branch_summary\") && entry.usage) {\n\t\t\t\tflushMessages();\n\t\t\t\tconst suppressedLiveBoundary =\n\t\t\t\t\tentry.type === \"compaction\" &&\n\t\t\t\t\toptions.suppressCompactionBoundary !== undefined &&\n\t\t\t\t\tentry.summary === options.suppressCompactionBoundary.compactedText &&\n\t\t\t\t\tentry.tokensBefore === options.suppressCompactionBoundary.tokensBefore;\n\t\t\t\tif (!suppressedLiveBoundary) this.addCompactionCostNotice(entry.type, entry.usage);\n\t\t\t}\n\t\t}\n\t}\n\tflushMessages();\n\tif (this.settingsManager.getShowCacheMissNotices()) {\n\t\tfor (const miss of collectCacheMisses(sessionEntries, {\n\t\t\tgetModel: (provider, model) => this.session.modelRuntime.getModel(provider, model),\n\t\t}).values()) {\n\t\t\tconst cause = miss.modelChanged\n\t\t\t\t? \" after model switch\"\n\t\t\t\t: miss.idleMs >= CACHE_TTL_MS\n\t\t\t\t\t? \" after cache TTL expiry\"\n\t\t\t\t\t: \"\";\n\t\t\tthis.chatContainer.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\t`Prompt cache miss${cause}: ${miss.missedTokens.toLocaleString()} tokens re-billed ($${miss.missedCost.toFixed(3)})`,\n\t\t\t\t\t),\n\t\t\t\t\t1,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\tfor (const input of deferredInputs) this.renderDeferredUserInput(input);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.attachStartupNoticesContainer = function (\n\tthis: InteractiveModeBase,\n\toptions: { resetDetached?: boolean } = {},\n): void {\n\tconst disclosureIndex = this.chatContainer.children.indexOf(this.resourceDisclosureContainer);\n\tconst noticesIndex = this.chatContainer.children.indexOf(this.startupNoticesContainer);\n\tif (disclosureIndex >= 0 && noticesIndex >= 0) return;\n\tif (disclosureIndex < 0) {\n\t\tif (options.resetDetached) this.resourceDisclosureContainer.clear();\n\t\tif (noticesIndex >= 0) this.chatContainer.children.splice(noticesIndex, 0, this.resourceDisclosureContainer);\n\t\telse this.chatContainer.addChild(this.resourceDisclosureContainer);\n\t}\n\tif (noticesIndex < 0) {\n\t\tif (options.resetDetached) this.startupNoticesContainer.clear();\n\t\tthis.chatContainer.addChild(this.startupNoticesContainer);\n\t}\n};\n\nInteractiveModeBase.prototype.renderInitialMessages = function (this: InteractiveModeBase): void {\n\tthis.attachStartupNoticesContainer({ resetDetached: true });\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { updateFooter: true, populateHistory: true });\n};\n\nInteractiveModeBase.prototype.getUserInput = async function (\n\tthis: InteractiveModeBase,\n): Promise<InteractiveSubmission> {\n\tfor (let attempt = 0; !this.startupCookedInputRecovered && attempt < 10; attempt += 1) {\n\t\tawait yieldToEventLoop();\n\t\tif (this.recoverCookedStartupInput?.()) break;\n\t}\n\twhile (true) {\n\t\tconst queuedInput = this.pendingUserInputs.shift();\n\t\tif (queuedInput !== undefined) {\n\t\t\treturn queuedInput;\n\t\t}\n\n\t\tif (this.startupReplayActiveInput) {\n\t\t\tawait this.drainStartupReplayCommands();\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.onInputCallback = (submission: InteractiveSubmission) => {\n\t\t\t\tthis.onInputCallback = undefined;\n\t\t\t\tresolve(submission);\n\t\t\t};\n\t\t\tif (!this.inputHandlerReadyRecorded) {\n\t\t\t\tthis.inputHandlerReadyRecorded = true;\n\t\t\t\trecordTimeSinceReset(\"interactive-input-handler-ready\");\n\t\t\t\tvoid (async () => {\n\t\t\t\t\tawait yieldToEventLoop();\n\t\t\t\t\t// pi parity: the changelog/first-run notices need nothing from\n\t\t\t\t\t// extensions — render them right after the input handler is ready\n\t\t\t\t\t// instead of gating them behind the deferred extension reload (or,\n\t\t\t\t\t// when the user types immediately, behind the whole agent turn).\n\t\t\t\t\tthis.showStartupNoticesIfNeeded(this.startupNoticesContainer);\n\t\t\t\t\tthis.footerDataProvider.startGitWatcher();\n\t\t\t\t\tif (this.deferredStartupPending) {\n\t\t\t\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t\t\t\t}\n\t\t\t\t})().catch((error) => {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tconsole.error(`Deferred input-readiness startup task failed: ${message}`);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n};\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function (\n\tthis: InteractiveModeBase,\n\toptions: {\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\tresetStartupDisclosure?: boolean;\n\t} = {},\n): void {\n\t// Generic rebuilds keep the same session: pending fd/rg callbacks still own\n\t// this transcript. Full session replacements invalidate their generation in\n\t// renderCurrentSessionState() before rebuilding the replacement transcript.\n\tthis.managedToolStatusStarted = false;\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tthis.chatContainer.clear();\n\tif (options.resetStartupDisclosure) this.resourceDisclosureContainer.clear();\n\tthis.attachStartupNoticesContainer();\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { suppressCompactionBoundary: options.suppressCompactionBoundary });\n};\n\nfunction isSynthesizedCompactionBoundary(message: AgentMessage | undefined, result: VerbatimCompactionResult): boolean {\n\tif (message?.role !== \"custom\" || message.customType !== \"compaction\" || !message.display) return false;\n\tconst details = message.details as { strategy?: string } | undefined;\n\tif (details?.strategy !== \"verbatim-lines\") return false;\n\tconst content = Array.isArray(message.content)\n\t\t? message.content\n\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t.map((block) => block.text)\n\t\t\t\t.join(\"\\n\")\n\t\t: message.content;\n\treturn content === VERBATIM_COMPACTION_PREFIX + result.compactedText;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-render-chat.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAqB,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AACtH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACtH,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEN,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAG7B,kCAAkC,EAElC,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EAEtB,+BAA+B,EAC/B,MAAM,EACN,IAAI,EACJ,sBAAsB,EAEtB,KAAK,EACL,oBAAoB,GAEpB,MAAM,4BAA4B,CAAC;AAGpC,mBAAmB,CAAC,SAAS,CAAC,UAAU,GAAG,UAAqC,OAAe;IAC9F,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC;IAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC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AC,UAAU,KAAK,YAAY,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IACxG,MAAM,OAAO,GAAG,OAAO,CAAC,OAA4C,CAAC;IACrE,IAAI,OAAO,EAAE,QAAQ,KAAK,gBAAgB;QAAE,OAAO,KAAK,CAAC;IACzD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;QAC7C,CAAC,CAAC,OAAO,CAAC,OAAO;aACd,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC;aACxC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;aAC1B,IAAI,CAAC,IAAI,CAAC;QACb,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACnB,OAAO,OAAO,KAAK,0BAA0B,GAAG,MAAM,CAAC,aAAa,CAAC;AACtE,CAAC","sourcesContent":["import type { Usage } from \"@bastani/pi-ai/compat\";\nimport { CACHE_TTL_MS, collectCacheMisses } from \"../../core/cache-stats.ts\";\nimport { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { VERBATIM_COMPACTION_PREFIX } from \"../../core/messages.ts\";\nimport type { CustomEntry } from \"../../core/session-manager.ts\";\nimport { buildContextEntries, type SessionEntry, sessionEntryToContextMessages } from \"../../core/session-manager.ts\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.ts\";\nimport { RemoteCustomMessageComponent, RemoteToolExecutionComponent } from \"../interactive-engine/remote-renderer.ts\";\nimport { CustomEntryComponent } from \"./components/custom-entry.ts\";\nimport { createMermaidMarkdownTransformer } from \"./components/mermaid.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AgentMessage,\n\tAssistantMessageComponent,\n\taddChatTranscriptEntry,\n\tBashExecutionComponent,\n\tBranchSummaryMessageComponent,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tCompactionBoundaryMessageComponent,\n\ttype Component,\n\tCustomMessageComponent,\n\tchatEntriesFromAgentMessages,\n\tparseSkillBlock,\n\trecordTimeSinceReset,\n\trenderChatMessageEntry,\n\ttype SessionContext,\n\tSkillInvocationMessageComponent,\n\tSpacer,\n\tText,\n\tToolExecutionComponent,\n\ttype TruncationResult,\n\ttheme,\n\tUserMessageComponent,\n\ttype VerbatimCompactionResult,\n} from \"./interactive-mode-deps.ts\";\nimport type { InteractiveSubmission } from \"./interactive-submission.ts\";\n\nInteractiveModeBase.prototype.showStatus = function (this: InteractiveModeBase, message: string): void {\n\tconst children = this.chatContainer.children;\n\tconst last = children.length > 0 ? children[children.length - 1] : undefined;\n\tconst secondLast = children.length > 1 ? children[children.length - 2] : undefined;\n\n\tif (last && secondLast && last === this.lastStatusText && secondLast === this.lastStatusSpacer) {\n\t\tthis.lastStatusText.setText(theme.fg(\"dim\", message));\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\n\tconst spacer = new Spacer(1);\n\tconst text = new Text(theme.fg(\"dim\", message), 1, 0);\n\tthis.chatContainer.addChild(spacer);\n\tthis.chatContainer.addChild(text);\n\tthis.lastStatusSpacer = spacer;\n\tthis.lastStatusText = text;\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.renderDeferredUserInput = function (this: InteractiveModeBase, text: string): void {\n\tthis.deferredRenderedUserInputs.push(text);\n\tconst startIndex = this.chatContainer.children.length;\n\tthis.addMessageToChat({ role: \"user\", content: text } as AgentMessage);\n\tconst renderedComponents = this.chatContainer.children.slice(startIndex);\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text) ?? [];\n\ttrackedComponents.push(renderedComponents);\n\tthis.deferredRenderedUserInputComponents.set(text, trackedComponents);\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.consumeDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): boolean {\n\tconst index = this.deferredRenderedUserInputs.indexOf(text);\n\tif (index === -1) return false;\n\tthis.deferredRenderedUserInputs.splice(index, 1);\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n\ttrackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tthis.deferredRenderedUserInputComponents.delete(text);\n\t}\n\treturn true;\n};\n\nInteractiveModeBase.prototype.discardDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): void {\n\tconst index = this.deferredRenderedUserInputs.indexOf(text);\n\tif (index !== -1) this.deferredRenderedUserInputs.splice(index, 1);\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n\tconst componentsToRemove = trackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tthis.deferredRenderedUserInputComponents.delete(text);\n\t}\n\tif (!componentsToRemove) return;\n\tfor (const component of componentsToRemove) {\n\t\tthis.chatContainer.removeChild(component);\n\t}\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.getMarkdownTransformers = function (this: InteractiveModeBase) {\n\tconst mode = this.settingsManager.getMermaidRenderingMode();\n\tif (this.mermaidMarkdownTransformerMode !== mode) {\n\t\tthis.mermaidMarkdownTransformerMode = mode;\n\t\tthis.mermaidMarkdownTransformer = createMermaidMarkdownTransformer({\n\t\t\tgetMode: () => this.settingsManager.getMermaidRenderingMode(),\n\t\t\ttheme,\n\t\t});\n\t}\n\tconst extensionTransformers =\n\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t? []\n\t\t\t: this.session.extensionRunner.getMarkdownTransformers();\n\treturn [this.mermaidMarkdownTransformer, ...extensionTransformers];\n};\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function (\n\tthis: InteractiveModeBase,\n): ChatMessageRenderOptions {\n\tconst isolated = this.runtimeHost instanceof IsolatedInteractiveRuntime;\n\treturn {\n\t\tui: this.ui,\n\t\tcwd: this.sessionManager.getCwd(),\n\t\tmarkdownTheme: this.getMarkdownThemeWithSettings(),\n\t\thideThinkingBlock: this.hideThinkingBlock,\n\t\thiddenThinkingLabel: this.hiddenThinkingLabel,\n\t\ttoolOutputExpanded: this.toolOutputExpanded,\n\t\tshowImages: this.settingsManager.getShowImages(),\n\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\toutputPad: this.outputPad,\n\t\trenderLatex: this.settingsManager.getLatexRenderingEnabled(),\n\t\tmarkdownTransformers: this.getMarkdownTransformers(),\n\t\tgetToolDefinition: isolated ? undefined : (toolName) => this.getRegisteredToolDefinition(toolName),\n\t\tgetCustomMessageRenderer: isolated\n\t\t\t? undefined\n\t\t\t: (customType) => this.session.extensionRunner.getMessageRenderer(customType),\n\t\tcreateToolComponent: isolated\n\t\t\t? (entry) => {\n\t\t\t\t\tconst component = new RemoteToolExecutionComponent(\n\t\t\t\t\t\tentry.toolName,\n\t\t\t\t\t\tentry.toolCallId,\n\t\t\t\t\t\tentry.args,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tshowImages: this.settingsManager.getShowImages(),\n\t\t\t\t\t\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tif (entry.result) component.updateResult(entry.result, entry.isPartial ?? false);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tcreateCustomMessageComponent: isolated\n\t\t\t? (message) => {\n\t\t\t\t\tconst component = new RemoteCustomMessageComponent(\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n};\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function (\n\tthis: InteractiveModeBase,\n\tentry: ChatMessageEntry,\n): Component {\n\tconst component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n\taddChatTranscriptEntry(this.chatContainer, component, entry.role);\n\treturn component;\n};\n\nInteractiveModeBase.prototype.addCompactionBoundaryToChat = function (\n\tthis: InteractiveModeBase,\n\tresult: VerbatimCompactionResult,\n): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tconst component = new CompactionBoundaryMessageComponent(result);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tthis.chatContainer.addChild(component);\n};\n\nInteractiveModeBase.prototype.addCompactionCostNotice = function (\n\tthis: InteractiveModeBase,\n\tkind: \"compaction\" | \"branch_summary\",\n\tusage: Usage,\n): void {\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\tconst tokens = usage.input + usage.output + usage.cacheRead + usage.cacheWrite;\n\tconst cost = usage.cost.total >= 0.01 ? ` (~$${usage.cost.total.toFixed(2)})` : \"\";\n\tconst label = kind === \"compaction\" ? \"Compaction\" : \"Branch summary\";\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `${label}: ${tokens.toLocaleString()} tokens billed${cost}`), 1, 0),\n\t);\n};\n\nInteractiveModeBase.prototype.addCustomEntryToChat = function (this: InteractiveModeBase, entry: CustomEntry): void {\n\tconst renderer = this.session.extensionRunner.getEntryRenderer(entry.customType);\n\tif (!renderer) return;\n\tconst component = new CustomEntryComponent(entry, renderer);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tif (!component.hasContent()) return;\n\tconst streamingIndex = this.streamingComponent ? this.chatContainer.children.indexOf(this.streamingComponent) : -1;\n\tif (streamingIndex >= 0) this.chatContainer.children.splice(streamingIndex, 0, component);\n\telse this.chatContainer.addChild(component);\n};\n\nInteractiveModeBase.prototype.addMessageToChat = function (\n\tthis: InteractiveModeBase,\n\tmessage: AgentMessage,\n\toptions?: { populateHistory?: boolean },\n): void {\n\tconst markdownTransformers = this.getMarkdownTransformers();\n\tswitch (message.role) {\n\t\tcase \"bashExecution\": {\n\t\t\tconst component = new BashExecutionComponent(message.command, this.ui, message.excludeFromContext);\n\t\t\tif (message.output) {\n\t\t\t\tcomponent.appendOutput(message.output);\n\t\t\t}\n\t\t\tcomponent.setComplete(\n\t\t\t\tmessage.exitCode,\n\t\t\t\tmessage.cancelled,\n\t\t\t\tmessage.truncated ? ({ truncated: true } as TruncationResult) : undefined,\n\t\t\t\tmessage.fullOutputPath,\n\t\t\t);\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"custom\": {\n\t\t\tif (message.display) {\n\t\t\t\tconst component =\n\t\t\t\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t\t\t\t? new RemoteCustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.runtimeHost,\n\t\t\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: new CustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.session.extensionRunner.getMessageRenderer(message.customType),\n\t\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t\t);\n\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"branchSummary\": {\n\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\tconst component = new BranchSummaryMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t);\n\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"user\": {\n\t\t\tconst textContent = this.getUserMessageText(message);\n\t\t\tif (textContent) {\n\t\t\t\tif (this.chatContainer.children.length > 0) {\n\t\t\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\t\t}\n\t\t\t\tconst skillBlock = parseSkillBlock(textContent);\n\t\t\t\tif (skillBlock) {\n\t\t\t\t\t// Render skill block (collapsible)\n\t\t\t\t\tconst component = new SkillInvocationMessageComponent(\n\t\t\t\t\t\tskillBlock,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t\t\t// Render user message separately if present\n\t\t\t\t\tif (skillBlock.userMessage) {\n\t\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\t\tskillBlock.userMessage,\n\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\ttextContent,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t);\n\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t}\n\t\t\t\tif (options?.populateHistory) {\n\t\t\t\t\tthis.editor.addToHistory?.(textContent);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"assistant\": {\n\t\t\tconst assistantComponent = new AssistantMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.hideThinkingBlock,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.hiddenThinkingLabel,\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t\tfalse,\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t);\n\t\t\tthis.chatContainer.addChild(assistantComponent);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"toolResult\": {\n\t\t\t// Tool results are rendered inline with tool calls, handled separately\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tbreak;\n\t}\n};\n\nInteractiveModeBase.prototype.renderSessionContext = function (\n\tthis: InteractiveModeBase,\n\tsessionContext: SessionContext,\n\toptions: { updateFooter?: boolean; populateHistory?: boolean } = {},\n): void {\n\tthis.pendingTools.clear();\n\tconst pendingDeferredInputs = [...this.deferredRenderedUserInputs];\n\tthis.deferredRenderedUserInputs = [];\n\tthis.deferredRenderedUserInputComponents.clear();\n\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\n\tconst entries = chatEntriesFromAgentMessages(sessionContext.messages);\n\tfor (const entry of entries) {\n\t\tconst component = this.addRenderedChatEntry(entry);\n\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t}\n\t\tif (options.populateHistory && entry.kind === \"user\") {\n\t\t\tthis.editor.addToHistory?.(entry.text);\n\t\t}\n\t}\n\n\tfor (const input of pendingDeferredInputs) {\n\t\tthis.renderDeferredUserInput(input);\n\t}\n\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.renderSessionEntries = function (\n\tthis: InteractiveModeBase,\n\tsessionEntries: SessionEntry[],\n\toptions: {\n\t\tupdateFooter?: boolean;\n\t\tpopulateHistory?: boolean;\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t} = {},\n): void {\n\tthis.pendingTools.clear();\n\tconst deferredInputs = [...this.deferredRenderedUserInputs];\n\tthis.deferredRenderedUserInputs = [];\n\tthis.deferredRenderedUserInputComponents.clear();\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\tlet messageBuffer: AgentMessage[] = [];\n\tlet firstMessage = true;\n\tconst flushMessages = (): void => {\n\t\tif (\n\t\t\toptions.suppressCompactionBoundary &&\n\t\t\tfirstMessage &&\n\t\t\tisSynthesizedCompactionBoundary(messageBuffer[0], options.suppressCompactionBoundary)\n\t\t) {\n\t\t\tmessageBuffer = messageBuffer.slice(1);\n\t\t}\n\t\tfirstMessage = false;\n\t\tfor (const entry of chatEntriesFromAgentMessages(messageBuffer)) {\n\t\t\tconst component = this.addRenderedChatEntry(entry);\n\t\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t\t}\n\t\t\tif (options.populateHistory && entry.kind === \"user\") this.editor.addToHistory?.(entry.text);\n\t\t}\n\t\tmessageBuffer = [];\n\t};\n\tfor (const entry of sessionEntries) {\n\t\tif (entry.type === \"custom\") {\n\t\t\tflushMessages();\n\t\t\tthis.addCustomEntryToChat(entry);\n\t\t} else {\n\t\t\tmessageBuffer.push(...sessionEntryToContextMessages(entry));\n\t\t\tif ((entry.type === \"compaction\" || entry.type === \"branch_summary\") && entry.usage) {\n\t\t\t\tflushMessages();\n\t\t\t\tconst suppressedLiveBoundary =\n\t\t\t\t\tentry.type === \"compaction\" &&\n\t\t\t\t\toptions.suppressCompactionBoundary !== undefined &&\n\t\t\t\t\tentry.summary === options.suppressCompactionBoundary.compactedText &&\n\t\t\t\t\tentry.tokensBefore === options.suppressCompactionBoundary.tokensBefore;\n\t\t\t\tif (!suppressedLiveBoundary) this.addCompactionCostNotice(entry.type, entry.usage);\n\t\t\t}\n\t\t}\n\t}\n\tflushMessages();\n\tif (this.settingsManager.getShowCacheMissNotices()) {\n\t\tfor (const miss of collectCacheMisses(sessionEntries, {\n\t\t\tgetModel: (provider, model) => this.session.modelRuntime.getModel(provider, model),\n\t\t}).values()) {\n\t\t\tconst cause = miss.modelChanged\n\t\t\t\t? \" after model switch\"\n\t\t\t\t: miss.idleMs >= CACHE_TTL_MS\n\t\t\t\t\t? \" after cache TTL expiry\"\n\t\t\t\t\t: \"\";\n\t\t\tthis.chatContainer.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\t`Prompt cache miss${cause}: ${miss.missedTokens.toLocaleString()} tokens re-billed ($${miss.missedCost.toFixed(3)})`,\n\t\t\t\t\t),\n\t\t\t\t\t1,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\tfor (const input of deferredInputs) this.renderDeferredUserInput(input);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.attachStartupNoticesContainer = function (\n\tthis: InteractiveModeBase,\n\toptions: { resetDetached?: boolean } = {},\n): void {\n\tconst disclosureIndex = this.chatContainer.children.indexOf(this.resourceDisclosureContainer);\n\tconst noticesIndex = this.chatContainer.children.indexOf(this.startupNoticesContainer);\n\tif (disclosureIndex >= 0 && noticesIndex >= 0) return;\n\tif (disclosureIndex < 0) {\n\t\tif (options.resetDetached) this.resourceDisclosureContainer.clear();\n\t\tif (noticesIndex >= 0) this.chatContainer.children.splice(noticesIndex, 0, this.resourceDisclosureContainer);\n\t\telse this.chatContainer.addChild(this.resourceDisclosureContainer);\n\t}\n\tif (noticesIndex < 0) {\n\t\tif (options.resetDetached) this.startupNoticesContainer.clear();\n\t\tthis.chatContainer.addChild(this.startupNoticesContainer);\n\t}\n};\n\nInteractiveModeBase.prototype.renderInitialMessages = function (this: InteractiveModeBase): void {\n\tthis.attachStartupNoticesContainer({ resetDetached: true });\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { updateFooter: true, populateHistory: true });\n};\n\nInteractiveModeBase.prototype.getUserInput = async function (\n\tthis: InteractiveModeBase,\n): Promise<InteractiveSubmission> {\n\tfor (let attempt = 0; !this.startupCookedInputRecovered && attempt < 10; attempt += 1) {\n\t\tawait yieldToEventLoop();\n\t\tif (this.recoverCookedStartupInput?.()) break;\n\t}\n\twhile (true) {\n\t\tconst queuedInput = this.pendingUserInputs.shift();\n\t\tif (queuedInput !== undefined) {\n\t\t\treturn queuedInput;\n\t\t}\n\n\t\tif (this.startupReplayActiveInput) {\n\t\t\tawait this.drainStartupReplayCommands();\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.onInputCallback = (submission: InteractiveSubmission) => {\n\t\t\t\tthis.onInputCallback = undefined;\n\t\t\t\tresolve(submission);\n\t\t\t};\n\t\t\tif (!this.inputHandlerReadyRecorded) {\n\t\t\t\tthis.inputHandlerReadyRecorded = true;\n\t\t\t\trecordTimeSinceReset(\"interactive-input-handler-ready\");\n\t\t\t\tmarkLifecycleTiming(\"interactive-input-handler-ready\");\n\t\t\t\tvoid (async () => {\n\t\t\t\t\tawait yieldToEventLoop();\n\t\t\t\t\t// pi parity: the changelog/first-run notices need nothing from\n\t\t\t\t\t// extensions — render them right after the input handler is ready\n\t\t\t\t\t// instead of gating them behind the deferred extension reload (or,\n\t\t\t\t\t// when the user types immediately, behind the whole agent turn).\n\t\t\t\t\tthis.showStartupNoticesIfNeeded(this.startupNoticesContainer);\n\t\t\t\t\tthis.footerDataProvider.startGitWatcher();\n\t\t\t\t\tif (this.deferredStartupPending) {\n\t\t\t\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t\t\t\t}\n\t\t\t\t})().catch((error) => {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tconsole.error(`Deferred input-readiness startup task failed: ${message}`);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n};\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function (\n\tthis: InteractiveModeBase,\n\toptions: {\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\tresetStartupDisclosure?: boolean;\n\t} = {},\n): void {\n\t// Generic rebuilds keep the same session: pending fd/rg callbacks still own\n\t// this transcript. Full session replacements invalidate their generation in\n\t// renderCurrentSessionState() before rebuilding the replacement transcript.\n\tthis.managedToolStatusStarted = false;\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tthis.chatContainer.clear();\n\tif (options.resetStartupDisclosure) this.resourceDisclosureContainer.clear();\n\tthis.attachStartupNoticesContainer();\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { suppressCompactionBoundary: options.suppressCompactionBoundary });\n};\n\nfunction isSynthesizedCompactionBoundary(message: AgentMessage | undefined, result: VerbatimCompactionResult): boolean {\n\tif (message?.role !== \"custom\" || message.customType !== \"compaction\" || !message.display) return false;\n\tconst details = message.details as { strategy?: string } | undefined;\n\tif (details?.strategy !== \"verbatim-lines\") return false;\n\tconst content = Array.isArray(message.content)\n\t\t? message.content\n\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t.map((block) => block.text)\n\t\t\t\t.join(\"\\n\")\n\t\t: message.content;\n\treturn content === VERBATIM_COMPACTION_PREFIX + result.compactedText;\n}\n"]}
|
|
@@ -41,60 +41,28 @@ InteractiveModeBase.prototype.formatDiagnostics = function (diagnostics, sourceI
|
|
|
41
41
|
}
|
|
42
42
|
return lines.join("\n");
|
|
43
43
|
};
|
|
44
|
-
InteractiveModeBase.prototype.getResourceDiagnosticsTotal = function (values) {
|
|
45
|
-
return values.reduce((total, diagnostics) => total + diagnostics.length, 0);
|
|
46
|
-
};
|
|
47
|
-
InteractiveModeBase.prototype.formatResourceCount = function (count, singular, plural = `${singular}s`) {
|
|
48
|
-
if (count <= 0) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
return `${count} ${count === 1 ? singular : plural}`;
|
|
52
|
-
};
|
|
53
44
|
InteractiveModeBase.prototype.addResourceDisclosure = function (options) {
|
|
54
|
-
const contextLabels = options.contextFiles.map((contextFile) => this.formatContextPath(contextFile.path));
|
|
55
|
-
const promptCount = options.prompts.length + options.templates.length;
|
|
56
|
-
const summaryParts = [
|
|
57
|
-
contextLabels.length > 0 ? contextLabels.join(", ") : "context ready",
|
|
58
|
-
this.formatResourceCount(options.skills.length, "skill"),
|
|
59
|
-
this.formatResourceCount(promptCount, "prompt"),
|
|
60
|
-
this.formatResourceCount(options.extensions.length, "extension"),
|
|
61
|
-
this.formatResourceCount(options.themes.length, "theme"),
|
|
62
|
-
this.formatResourceCount(options.diagnosticsTotal, "issue"),
|
|
63
|
-
].filter((part) => part !== undefined && part.length > 0);
|
|
64
|
-
const collapsed = `${theme.bold(theme.fg("muted", "RESOURCES"))} ${theme.fg("muted", summaryParts.join(" · "))}`;
|
|
65
|
-
const ok = theme.fg("success", "✓");
|
|
66
|
-
const pending = theme.fg("dim", "○");
|
|
67
|
-
const sep = theme.fg("dim", " · ");
|
|
68
|
-
const label = (value) => theme.bold(theme.fg("text", value.padEnd(10)));
|
|
69
|
-
const mutedList = (values, maxItems = 4) => {
|
|
70
|
-
if (values.length === 0) {
|
|
71
|
-
return theme.fg("dim", "none");
|
|
72
|
-
}
|
|
73
|
-
const shown = values.slice(0, maxItems).join(", ");
|
|
74
|
-
const suffix = values.length > maxItems ? `, +${values.length - maxItems}` : "";
|
|
75
|
-
return theme.fg("dim", `${shown}${suffix}`);
|
|
76
|
-
};
|
|
77
|
-
const extensionLabels = this.getCompactExtensionLabels([...options.extensions]);
|
|
78
|
-
const themeLabels = options.themes.map((loadedTheme) => loadedTheme.name ??
|
|
79
|
-
(loadedTheme.sourcePath ? this.getCompactPathLabel(loadedTheme.sourcePath, undefined) : "theme"));
|
|
80
|
-
const expandedSummary = [
|
|
81
|
-
`${ok} ${label("Ready")} ${contextLabels.length > 0 ? contextLabels.join(", ") : "context loaded"}`,
|
|
82
|
-
`${ok} ${label("Skills")} ${options.skills.length} available${sep}${mutedList(options.skills.map((skill) => skill.name))}`,
|
|
83
|
-
`${ok} ${label("Prompts")} ${promptCount} available${sep}${mutedList([
|
|
84
|
-
...options.templates.map((template) => `/${template.name}`),
|
|
85
|
-
...options.prompts.map((prompt) => prompt.name),
|
|
86
|
-
])}`,
|
|
87
|
-
`${ok} ${label("Extensions")} ${options.extensions.length} available${sep}${mutedList(extensionLabels)}`,
|
|
88
|
-
];
|
|
89
|
-
if (themeLabels.length > 0) {
|
|
90
|
-
expandedSummary.push(`${ok} ${label("Themes")} ${themeLabels.length} loaded${sep}${mutedList(themeLabels)}`);
|
|
91
|
-
}
|
|
92
|
-
if (options.diagnosticsTotal > 0) {
|
|
93
|
-
expandedSummary.push(`${pending} ${label("Issues")} ${options.diagnosticsTotal} noted${sep}${theme.fg("dim", "details below")}`);
|
|
94
|
-
}
|
|
95
|
-
const expanded = `${collapsed}\n${expandedSummary.join("\n")}${options.expandedBody.length > 0 ? `\n\n${options.expandedBody}` : ""}`;
|
|
96
45
|
const targetContainer = options.targetContainer ?? this.chatContainer;
|
|
97
|
-
|
|
98
|
-
|
|
46
|
+
const compactList = (values, sort = true) => {
|
|
47
|
+
const labels = values.map((value) => value.trim()).filter((value) => value.length > 0);
|
|
48
|
+
if (sort)
|
|
49
|
+
labels.sort((left, right) => left.localeCompare(right));
|
|
50
|
+
return theme.fg("dim", ` ${labels.join(", ")}`);
|
|
51
|
+
};
|
|
52
|
+
const addSection = (name, labels, expandedBody, sort = true) => {
|
|
53
|
+
if (labels.length === 0)
|
|
54
|
+
return;
|
|
55
|
+
const collapsedBody = compactList(labels, sort);
|
|
56
|
+
targetContainer.addChild(new ExpandableText(() => `${theme.fg("mdHeading", `[${name}]`)}\n${collapsedBody}`, () => `${theme.fg("mdHeading", `[${name}]`)}\n${expandedBody ?? collapsedBody}`, this.getStartupExpansionState(), 0, 0));
|
|
57
|
+
targetContainer.addChild(new Spacer(1));
|
|
58
|
+
};
|
|
59
|
+
addSection("Context", options.contextFiles.map((contextFile) => this.formatContextPath(contextFile.path)), options.expandedSections.context, false);
|
|
60
|
+
addSection("Skills", options.skills.map((skill) => skill.name), options.expandedSections.skills);
|
|
61
|
+
addSection("Prompts", options.prompts.map((prompt) => `/${prompt.name}`), options.expandedSections.prompts);
|
|
62
|
+
addSection("Extensions", this.getCompactExtensionLabels([...options.extensions]), options.expandedSections.extensions);
|
|
63
|
+
addSection("Themes", options.themes.map((loadedTheme) => loadedTheme.name ??
|
|
64
|
+
(loadedTheme.sourcePath
|
|
65
|
+
? this.getCompactPathLabel(loadedTheme.sourcePath, loadedTheme.sourceInfo)
|
|
66
|
+
: "theme")), options.expandedSections.themes);
|
|
99
67
|
};
|
|
100
68
|
//# sourceMappingURL=interactive-resource-disclosure.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-resource-disclosure.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-resource-disclosure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAA4D,MAAM,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,mBAAmB,CAAC,SAAS,CAAC,iBAAiB,GAAG,UAEjD,WAA0C,EAC1C,WAAoC;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,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,aAAa,CAAC;IACtE,eAAe,CAAC,QAAQ,CACvB,IAAI,cAAc,CACjB,GAAG,EAAE,CAAC,SAAS,EACf,GAAG,EAAE,CAAC,QAAQ,EACd,IAAI,CAAC,wBAAwB,EAAE,EAC/B,CAAC,EACD,CAAC,CACD,CACD,CAAC;IACF,eAAe,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Container, type ResourceDiagnostic, type SourceInfo, Spacer, theme } from \"./interactive-mode-deps.ts\";\nimport { ExpandableText } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.formatDiagnostics = function (\n\tthis: InteractiveModeBase,\n\tdiagnostics: readonly ResourceDiagnostic[],\n\tsourceInfos: Map<string, SourceInfo>,\n): string {\n\tconst lines: string[] = [];\n\n\t// Group collision diagnostics by name\n\tconst collisions = new Map<string, ResourceDiagnostic[]>();\n\tconst otherDiagnostics: ResourceDiagnostic[] = [];\n\n\tfor (const d of diagnostics) {\n\t\tif (d.type === \"collision\" && d.collision) {\n\t\t\tconst list = collisions.get(d.collision.name) ?? [];\n\t\t\tlist.push(d);\n\t\t\tcollisions.set(d.collision.name, list);\n\t\t} else {\n\t\t\totherDiagnostics.push(d);\n\t\t}\n\t}\n\n\t// Format collision diagnostics grouped by name\n\tfor (const [name, collisionList] of collisions) {\n\t\tconst first = collisionList[0]?.collision;\n\t\tif (!first) continue;\n\t\tlines.push(theme.fg(\"warning\", ` \"${name}\" collision:`));\n\t\tlines.push(\n\t\t\ttheme.fg(\n\t\t\t\t\"dim\",\n\t\t\t\t` ${theme.fg(\"success\", \"✓\")} ${this.formatPathWithSource(first.winnerPath, this.findSourceInfoForPath(first.winnerPath, sourceInfos))}${\n\t\t\t\t\tfirst.winnerSelector ? ` (default /skill:${name}; exact /skill:${first.winnerSelector})` : \"\"\n\t\t\t\t}`,\n\t\t\t),\n\t\t);\n\t\tfor (const d of collisionList) {\n\t\t\tif (d.collision) {\n\t\t\t\tlines.push(\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"dim\",\n\t\t\t\t\t\t` ${theme.fg(\"warning\", d.collision.loserSelector ? \"•\" : \"✗\")} ${this.formatPathWithSource(d.collision.loserPath, this.findSourceInfoForPath(d.collision.loserPath, sourceInfos))}${\n\t\t\t\t\t\t\td.collision.loserSelector ? ` (/skill:${d.collision.loserSelector})` : \" (skipped)\"\n\t\t\t\t\t\t}`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const d of otherDiagnostics) {\n\t\tif (d.path) {\n\t\t\tconst formattedPath = this.formatPathWithSource(d.path, this.findSourceInfoForPath(d.path, sourceInfos));\n\t\t\tlines.push(theme.fg(d.type === \"error\" ? \"error\" : \"warning\", ` ${formattedPath}`));\n\t\t\tlines.push(theme.fg(d.type === \"error\" ? \"error\" : \"warning\", ` ${d.message}`));\n\t\t} else {\n\t\t\tlines.push(theme.fg(d.type === \"error\" ? \"error\" : \"warning\", ` ${d.message}`));\n\t\t}\n\t}\n\n\treturn lines.join(\"\\n\");\n};\n\nInteractiveModeBase.prototype.getResourceDiagnosticsTotal = function (\n\tthis: InteractiveModeBase,\n\tvalues: ResourceDiagnostic[][],\n): number {\n\treturn values.reduce((total, diagnostics) => total + diagnostics.length, 0);\n};\n\nInteractiveModeBase.prototype.formatResourceCount = function (\n\tthis: InteractiveModeBase,\n\tcount: number,\n\tsingular: string,\n\tplural = `${singular}s`,\n): string | undefined {\n\tif (count <= 0) {\n\t\treturn undefined;\n\t}\n\treturn `${count} ${count === 1 ? singular : plural}`;\n};\n\nInteractiveModeBase.prototype.addResourceDisclosure = function (\n\tthis: InteractiveModeBase,\n\toptions: {\n\t\tcontextFiles: ReadonlyArray<{ path: string }>;\n\t\tskills: ReadonlyArray<{ filePath: string; name: string }>;\n\t\tprompts: ReadonlyArray<{ filePath: string; name: string }>;\n\t\ttemplates: ReadonlyArray<{ filePath: string; name: string }>;\n\t\textensions: ReadonlyArray<{ path: string; sourceInfo?: SourceInfo }>;\n\t\tthemes: ReadonlyArray<{ name?: string; sourcePath?: string }>;\n\t\tdiagnosticsTotal: number;\n\t\texpandedBody: string;\n\t\ttargetContainer?: Container;\n\t},\n): void {\n\tconst contextLabels = options.contextFiles.map((contextFile) => this.formatContextPath(contextFile.path));\n\tconst promptCount = options.prompts.length + options.templates.length;\n\tconst summaryParts = [\n\t\tcontextLabels.length > 0 ? contextLabels.join(\", \") : \"context ready\",\n\t\tthis.formatResourceCount(options.skills.length, \"skill\"),\n\t\tthis.formatResourceCount(promptCount, \"prompt\"),\n\t\tthis.formatResourceCount(options.extensions.length, \"extension\"),\n\t\tthis.formatResourceCount(options.themes.length, \"theme\"),\n\t\tthis.formatResourceCount(options.diagnosticsTotal, \"issue\"),\n\t].filter((part): part is string => part !== undefined && part.length > 0);\n\n\tconst collapsed = `${theme.bold(theme.fg(\"muted\", \"RESOURCES\"))} ${theme.fg(\"muted\", summaryParts.join(\" · \"))}`;\n\n\tconst ok = theme.fg(\"success\", \"✓\");\n\tconst pending = theme.fg(\"dim\", \"○\");\n\tconst sep = theme.fg(\"dim\", \" · \");\n\tconst label = (value: string) => theme.bold(theme.fg(\"text\", value.padEnd(10)));\n\tconst mutedList = (values: string[], maxItems = 4) => {\n\t\tif (values.length === 0) {\n\t\t\treturn theme.fg(\"dim\", \"none\");\n\t\t}\n\t\tconst shown = values.slice(0, maxItems).join(\", \");\n\t\tconst suffix = values.length > maxItems ? `, +${values.length - maxItems}` : \"\";\n\t\treturn theme.fg(\"dim\", `${shown}${suffix}`);\n\t};\n\n\tconst extensionLabels = this.getCompactExtensionLabels([...options.extensions]);\n\tconst themeLabels = options.themes.map(\n\t\t(loadedTheme) =>\n\t\t\tloadedTheme.name ??\n\t\t\t(loadedTheme.sourcePath ? this.getCompactPathLabel(loadedTheme.sourcePath, undefined) : \"theme\"),\n\t);\n\tconst expandedSummary = [\n\t\t`${ok} ${label(\"Ready\")} ${contextLabels.length > 0 ? contextLabels.join(\", \") : \"context loaded\"}`,\n\t\t`${ok} ${label(\"Skills\")} ${options.skills.length} available${sep}${mutedList(options.skills.map((skill) => skill.name))}`,\n\t\t`${ok} ${label(\"Prompts\")} ${promptCount} available${sep}${mutedList([\n\t\t\t...options.templates.map((template) => `/${template.name}`),\n\t\t\t...options.prompts.map((prompt) => prompt.name),\n\t\t])}`,\n\t\t`${ok} ${label(\"Extensions\")} ${options.extensions.length} available${sep}${mutedList(extensionLabels)}`,\n\t];\n\n\tif (themeLabels.length > 0) {\n\t\texpandedSummary.push(`${ok} ${label(\"Themes\")} ${themeLabels.length} loaded${sep}${mutedList(themeLabels)}`);\n\t}\n\tif (options.diagnosticsTotal > 0) {\n\t\texpandedSummary.push(\n\t\t\t`${pending} ${label(\"Issues\")} ${options.diagnosticsTotal} noted${sep}${theme.fg(\"dim\", \"details below\")}`,\n\t\t);\n\t}\n\n\tconst expanded = `${collapsed}\\n${expandedSummary.join(\"\\n\")}${\n\t\toptions.expandedBody.length > 0 ? `\\n\\n${options.expandedBody}` : \"\"\n\t}`;\n\n\tconst targetContainer = options.targetContainer ?? this.chatContainer;\n\ttargetContainer.addChild(\n\t\tnew ExpandableText(\n\t\t\t() => collapsed,\n\t\t\t() => expanded,\n\t\t\tthis.getStartupExpansionState(),\n\t\t\t0,\n\t\t\t0,\n\t\t),\n\t);\n\ttargetContainer.addChild(new Spacer(1));\n};\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-resource-disclosure.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-resource-disclosure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAA4D,MAAM,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA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,OAAO,CAAC,MAAM,CAAC,GAAG,CACjB,CAAC,WAAW,EAAE,EAAE,CACf,WAAW,CAAC,IAAI;QAChB,CAAC,WAAW,CAAC,UAAU;YACtB,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC;YAC1E,CAAC,CAAC,OAAO,CAAC,CACZ,EACD,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAC/B,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Container, type ResourceDiagnostic, type SourceInfo, Spacer, theme } from \"./interactive-mode-deps.ts\";\nimport { ExpandableText } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.formatDiagnostics = function (\n\tthis: InteractiveModeBase,\n\tdiagnostics: readonly ResourceDiagnostic[],\n\tsourceInfos: Map<string, SourceInfo>,\n): string {\n\tconst lines: string[] = [];\n\n\t// Group collision diagnostics by name\n\tconst collisions = new Map<string, ResourceDiagnostic[]>();\n\tconst otherDiagnostics: ResourceDiagnostic[] = [];\n\n\tfor (const d of diagnostics) {\n\t\tif (d.type === \"collision\" && d.collision) {\n\t\t\tconst list = collisions.get(d.collision.name) ?? [];\n\t\t\tlist.push(d);\n\t\t\tcollisions.set(d.collision.name, list);\n\t\t} else {\n\t\t\totherDiagnostics.push(d);\n\t\t}\n\t}\n\n\t// Format collision diagnostics grouped by name\n\tfor (const [name, collisionList] of collisions) {\n\t\tconst first = collisionList[0]?.collision;\n\t\tif (!first) continue;\n\t\tlines.push(theme.fg(\"warning\", ` \"${name}\" collision:`));\n\t\tlines.push(\n\t\t\ttheme.fg(\n\t\t\t\t\"dim\",\n\t\t\t\t` ${theme.fg(\"success\", \"✓\")} ${this.formatPathWithSource(first.winnerPath, this.findSourceInfoForPath(first.winnerPath, sourceInfos))}${\n\t\t\t\t\tfirst.winnerSelector ? ` (default /skill:${name}; exact /skill:${first.winnerSelector})` : \"\"\n\t\t\t\t}`,\n\t\t\t),\n\t\t);\n\t\tfor (const d of collisionList) {\n\t\t\tif (d.collision) {\n\t\t\t\tlines.push(\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"dim\",\n\t\t\t\t\t\t` ${theme.fg(\"warning\", d.collision.loserSelector ? \"•\" : \"✗\")} ${this.formatPathWithSource(d.collision.loserPath, this.findSourceInfoForPath(d.collision.loserPath, sourceInfos))}${\n\t\t\t\t\t\t\td.collision.loserSelector ? ` (/skill:${d.collision.loserSelector})` : \" (skipped)\"\n\t\t\t\t\t\t}`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const d of otherDiagnostics) {\n\t\tif (d.path) {\n\t\t\tconst formattedPath = this.formatPathWithSource(d.path, this.findSourceInfoForPath(d.path, sourceInfos));\n\t\t\tlines.push(theme.fg(d.type === \"error\" ? \"error\" : \"warning\", ` ${formattedPath}`));\n\t\t\tlines.push(theme.fg(d.type === \"error\" ? \"error\" : \"warning\", ` ${d.message}`));\n\t\t} else {\n\t\t\tlines.push(theme.fg(d.type === \"error\" ? \"error\" : \"warning\", ` ${d.message}`));\n\t\t}\n\t}\n\n\treturn lines.join(\"\\n\");\n};\n\nInteractiveModeBase.prototype.addResourceDisclosure = function (\n\tthis: InteractiveModeBase,\n\toptions: {\n\t\tcontextFiles: ReadonlyArray<{ path: string }>;\n\t\tskills: ReadonlyArray<{ filePath: string; name: string }>;\n\t\tprompts: ReadonlyArray<{ filePath: string; name: string }>;\n\t\textensions: ReadonlyArray<{ path: string; sourceInfo?: SourceInfo }>;\n\t\tthemes: ReadonlyArray<{ name?: string; sourcePath?: string; sourceInfo?: SourceInfo }>;\n\t\texpandedSections: {\n\t\t\tcontext?: string;\n\t\t\tskills?: string;\n\t\t\tprompts?: string;\n\t\t\textensions?: string;\n\t\t\tthemes?: string;\n\t\t};\n\t\ttargetContainer?: Container;\n\t},\n): void {\n\tconst targetContainer = options.targetContainer ?? this.chatContainer;\n\tconst compactList = (values: string[], sort = true): string => {\n\t\tconst labels = values.map((value) => value.trim()).filter((value) => value.length > 0);\n\t\tif (sort) labels.sort((left, right) => left.localeCompare(right));\n\t\treturn theme.fg(\"dim\", ` ${labels.join(\", \")}`);\n\t};\n\tconst addSection = (name: string, labels: string[], expandedBody?: string, sort = true): void => {\n\t\tif (labels.length === 0) return;\n\t\tconst collapsedBody = compactList(labels, sort);\n\t\ttargetContainer.addChild(\n\t\t\tnew ExpandableText(\n\t\t\t\t() => `${theme.fg(\"mdHeading\", `[${name}]`)}\\n${collapsedBody}`,\n\t\t\t\t() => `${theme.fg(\"mdHeading\", `[${name}]`)}\\n${expandedBody ?? collapsedBody}`,\n\t\t\t\tthis.getStartupExpansionState(),\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t),\n\t\t);\n\t\ttargetContainer.addChild(new Spacer(1));\n\t};\n\n\taddSection(\n\t\t\"Context\",\n\t\toptions.contextFiles.map((contextFile) => this.formatContextPath(contextFile.path)),\n\t\toptions.expandedSections.context,\n\t\tfalse,\n\t);\n\taddSection(\n\t\t\"Skills\",\n\t\toptions.skills.map((skill) => skill.name),\n\t\toptions.expandedSections.skills,\n\t);\n\taddSection(\n\t\t\"Prompts\",\n\t\toptions.prompts.map((prompt) => `/${prompt.name}`),\n\t\toptions.expandedSections.prompts,\n\t);\n\taddSection(\n\t\t\"Extensions\",\n\t\tthis.getCompactExtensionLabels([...options.extensions]),\n\t\toptions.expandedSections.extensions,\n\t);\n\taddSection(\n\t\t\"Themes\",\n\t\toptions.themes.map(\n\t\t\t(loadedTheme) =>\n\t\t\t\tloadedTheme.name ??\n\t\t\t\t(loadedTheme.sourcePath\n\t\t\t\t\t? this.getCompactPathLabel(loadedTheme.sourcePath, loadedTheme.sourceInfo)\n\t\t\t\t\t: \"theme\"),\n\t\t),\n\t\toptions.expandedSections.themes,\n\t);\n};\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getBuiltinExtensionEntryLabel } from "../../core/extensions/builtin-extension-entry-labels.js";
|
|
1
2
|
import { InteractiveModeBase } from "./interactive-mode-base.js";
|
|
2
3
|
import { parseGitUrl, path, theme } from "./interactive-mode-deps.js";
|
|
3
4
|
InteractiveModeBase.prototype.getShortPath = function (fullPath, sourceInfo) {
|
|
@@ -91,24 +92,29 @@ InteractiveModeBase.prototype.getCompactNonPackageExtensionLabel = function (res
|
|
|
91
92
|
return candidate;
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
|
-
return
|
|
95
|
+
return this.formatDisplayPath(resourcePath).replace(/\\/g, "/");
|
|
95
96
|
};
|
|
96
97
|
InteractiveModeBase.prototype.getCompactExtensionLabels = function (extensions) {
|
|
97
98
|
const nonPackageExtensions = extensions
|
|
98
99
|
.map((extension) => {
|
|
99
|
-
const
|
|
100
|
+
const builtinLabel = getBuiltinExtensionEntryLabel(extension.path);
|
|
101
|
+
const segments = builtinLabel ? [builtinLabel] : this.getCompactDisplayPathSegments(extension.path);
|
|
100
102
|
const lastSegment = segments[segments.length - 1];
|
|
101
|
-
if (segments.length > 1 && (lastSegment === "index.ts" || lastSegment === "index.js")) {
|
|
103
|
+
if (!builtinLabel && segments.length > 1 && (lastSegment === "index.ts" || lastSegment === "index.js")) {
|
|
102
104
|
segments.pop();
|
|
103
105
|
}
|
|
104
106
|
return {
|
|
105
107
|
path: extension.path,
|
|
106
108
|
sourceInfo: extension.sourceInfo,
|
|
107
109
|
segments,
|
|
110
|
+
builtinLabel,
|
|
108
111
|
};
|
|
109
112
|
})
|
|
110
|
-
.filter((extension) => !this.isPackageSource(extension.sourceInfo));
|
|
111
|
-
|
|
113
|
+
.filter((extension) => extension.builtinLabel || !this.isPackageSource(extension.sourceInfo));
|
|
114
|
+
const labels = extensions.map((extension) => {
|
|
115
|
+
const builtinLabel = getBuiltinExtensionEntryLabel(extension.path);
|
|
116
|
+
if (builtinLabel)
|
|
117
|
+
return builtinLabel;
|
|
112
118
|
if (this.isPackageSource(extension.sourceInfo)) {
|
|
113
119
|
return this.getCompactExtensionLabel(extension.path, extension.sourceInfo);
|
|
114
120
|
}
|
|
@@ -118,6 +124,24 @@ InteractiveModeBase.prototype.getCompactExtensionLabels = function (extensions)
|
|
|
118
124
|
}
|
|
119
125
|
return this.getCompactNonPackageExtensionLabel(extension.path, nonPackageIndex, nonPackageExtensions);
|
|
120
126
|
});
|
|
127
|
+
const taken = new Set(extensions.flatMap((extension) => {
|
|
128
|
+
const builtinLabel = getBuiltinExtensionEntryLabel(extension.path);
|
|
129
|
+
return builtinLabel ? [builtinLabel] : [];
|
|
130
|
+
}));
|
|
131
|
+
return labels.map((label, index) => {
|
|
132
|
+
if (getBuiltinExtensionEntryLabel(extensions[index].path))
|
|
133
|
+
return label;
|
|
134
|
+
if (!taken.has(label)) {
|
|
135
|
+
taken.add(label);
|
|
136
|
+
return label;
|
|
137
|
+
}
|
|
138
|
+
let suffix = 2;
|
|
139
|
+
while (taken.has(`${label} (${suffix})`))
|
|
140
|
+
suffix += 1;
|
|
141
|
+
const uniqueLabel = `${label} (${suffix})`;
|
|
142
|
+
taken.add(uniqueLabel);
|
|
143
|
+
return uniqueLabel;
|
|
144
|
+
});
|
|
121
145
|
};
|
|
122
146
|
InteractiveModeBase.prototype.getDisplaySourceInfo = function (sourceInfo) {
|
|
123
147
|
const source = sourceInfo?.source ?? "local";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-resource-paths.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-resource-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAmB,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEvF,mBAAmB,CAAC,SAAS,CAAC,YAAY,GAAG,UAE5C,QAAgB,EAChB,UAAuB;IAEvB,MAAM,kBAAkB,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAA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AO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,qBAAqB,GAAG,UAErD,CAAS,EACT,WAAoC;IAEpC,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IAExB,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;IAC3B,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,oBAAoB,GAAG,UAEpD,CAAS,EACT,UAAuB;IAEvB,IAAI,UAAU,EAAE,CAAC;QAChB,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;QACpE,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,UAAU,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;QAClE,OAAO,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC;IACpC,CAAC;IACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { parseGitUrl, path, type SourceInfo, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.getShortPath = function (\n\tthis: InteractiveModeBase,\n\tfullPath: string,\n\tsourceInfo?: SourceInfo,\n): string {\n\tconst normalizedFullPath = fullPath.replace(/\\\\/g, \"/\");\n\tconst baseDir = sourceInfo?.baseDir;\n\tif (baseDir && this.isPackageSource(sourceInfo)) {\n\t\tconst normalizedBaseDir = baseDir.replace(/\\\\/g, \"/\");\n\t\tconst npmRootMatch = normalizedBaseDir.match(/^(.*\\/node_modules)\\/(@?[^/]+(?:\\/[^/]+)?)$/);\n\t\tif (npmRootMatch?.[1] && normalizedFullPath.startsWith(`${npmRootMatch[1]}/`)) {\n\t\t\treturn path.posix.relative(normalizedBaseDir, normalizedFullPath);\n\t\t}\n\t\tconst relativePath = path.relative(path.resolve(baseDir), path.resolve(fullPath));\n\t\tif (\n\t\t\trelativePath &&\n\t\t\trelativePath !== \".\" &&\n\t\t\t!relativePath.startsWith(\"..\") &&\n\t\t\t!relativePath.startsWith(`..${path.sep}`) &&\n\t\t\t!path.isAbsolute(relativePath)\n\t\t) {\n\t\t\treturn relativePath.replace(/\\\\/g, \"/\");\n\t\t}\n\t}\n\n\tconst source = sourceInfo?.source ?? \"\";\n\tconst npmMatch = normalizedFullPath.match(/node_modules\\/(@?[^/]+(?:\\/[^/]+)?)\\/(.*)/);\n\tif (npmMatch && source.startsWith(\"npm:\")) {\n\t\treturn npmMatch[2];\n\t}\n\n\tconst gitMatch = normalizedFullPath.match(/git\\/[^/]+\\/[^/]+\\/(.*)/);\n\tif (gitMatch && source.startsWith(\"git:\")) {\n\t\treturn gitMatch[1];\n\t}\n\n\treturn this.formatDisplayPath(fullPath);\n};\n\nInteractiveModeBase.prototype.getCompactPathLabel = function (\n\tthis: InteractiveModeBase,\n\tresourcePath: string,\n\tsourceInfo?: SourceInfo,\n): string {\n\tconst shortPath = this.getShortPath(resourcePath, sourceInfo);\n\tconst normalizedPath = shortPath.replace(/\\\\/g, \"/\");\n\tconst segments = normalizedPath.split(\"/\").filter((segment) => segment.length > 0 && segment !== \"~\");\n\tif (segments.length > 0) {\n\t\treturn segments[segments.length - 1]!;\n\t}\n\treturn shortPath;\n};\n\nInteractiveModeBase.prototype.getCompactPackageSourceLabel = function (\n\tthis: InteractiveModeBase,\n\tsourceInfo?: SourceInfo,\n): string {\n\tconst source = sourceInfo?.source ?? \"\";\n\tif (source.startsWith(\"npm:\")) {\n\t\treturn source.slice(\"npm:\".length) || source;\n\t}\n\n\tconst gitSource = parseGitUrl(source);\n\tif (gitSource) {\n\t\treturn gitSource.path || source;\n\t}\n\n\tif (sourceInfo?.origin === \"package\") {\n\t\treturn path.basename(source) || source;\n\t}\n\n\treturn source;\n};\n\nInteractiveModeBase.prototype.getCompactExtensionLabel = function (\n\tthis: InteractiveModeBase,\n\tresourcePath: string,\n\tsourceInfo?: SourceInfo,\n): string {\n\tif (!this.isPackageSource(sourceInfo)) {\n\t\treturn this.getCompactPathLabel(resourcePath, sourceInfo);\n\t}\n\n\tconst sourceLabel = this.getCompactPackageSourceLabel(sourceInfo);\n\tif (!sourceLabel) {\n\t\treturn this.getCompactPathLabel(resourcePath, sourceInfo);\n\t}\n\n\tconst shortPath = this.getShortPath(resourcePath, sourceInfo).replace(/\\\\/g, \"/\");\n\tconst packagePath = shortPath.startsWith(\"extensions/\") ? shortPath.slice(\"extensions/\".length) : shortPath;\n\tconst parsedPath = path.posix.parse(packagePath);\n\n\tif (parsedPath.name === \"index\") {\n\t\treturn !parsedPath.dir || parsedPath.dir === \".\" ? sourceLabel : `${sourceLabel}:${parsedPath.dir}`;\n\t}\n\n\treturn `${sourceLabel}:${packagePath}`;\n};\n\nInteractiveModeBase.prototype.getCompactDisplayPathSegments = function (\n\tthis: InteractiveModeBase,\n\tresourcePath: string,\n): string[] {\n\treturn this.formatDisplayPath(resourcePath)\n\t\t.replace(/\\\\/g, \"/\")\n\t\t.split(\"/\")\n\t\t.filter((segment) => segment.length > 0 && segment !== \"~\");\n};\n\nInteractiveModeBase.prototype.getCompactNonPackageExtensionLabel = function (\n\tthis: InteractiveModeBase,\n\tresourcePath: string,\n\tindex: number,\n\tallPaths: Array<{ path: string; segments: string[] }>,\n): string {\n\tconst segments = allPaths[index]?.segments;\n\tif (!segments || segments.length === 0) {\n\t\treturn this.getCompactPathLabel(resourcePath);\n\t}\n\n\tfor (let segmentCount = 1; segmentCount <= segments.length; segmentCount += 1) {\n\t\tconst candidate = segments.slice(-segmentCount).join(\"/\");\n\t\tconst isUnique = allPaths.every((item, itemIndex) => {\n\t\t\tif (itemIndex === index) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn item.segments.slice(-segmentCount).join(\"/\") !== candidate;\n\t\t});\n\n\t\tif (isUnique) {\n\t\t\treturn candidate;\n\t\t}\n\t}\n\n\treturn segments.join(\"/\");\n};\n\nInteractiveModeBase.prototype.getCompactExtensionLabels = function (\n\tthis: InteractiveModeBase,\n\textensions: Array<{ path: string; sourceInfo?: SourceInfo }>,\n): string[] {\n\tconst nonPackageExtensions = extensions\n\t\t.map((extension) => {\n\t\t\tconst segments = this.getCompactDisplayPathSegments(extension.path);\n\t\t\tconst lastSegment = segments[segments.length - 1];\n\t\t\tif (segments.length > 1 && (lastSegment === \"index.ts\" || lastSegment === \"index.js\")) {\n\t\t\t\tsegments.pop();\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpath: extension.path,\n\t\t\t\tsourceInfo: extension.sourceInfo,\n\t\t\t\tsegments,\n\t\t\t};\n\t\t})\n\t\t.filter((extension) => !this.isPackageSource(extension.sourceInfo));\n\n\treturn extensions.map((extension) => {\n\t\tif (this.isPackageSource(extension.sourceInfo)) {\n\t\t\treturn this.getCompactExtensionLabel(extension.path, extension.sourceInfo);\n\t\t}\n\n\t\tconst nonPackageIndex = nonPackageExtensions.findIndex((item) => item.path === extension.path);\n\t\tif (nonPackageIndex === -1) {\n\t\t\treturn this.getCompactPathLabel(extension.path, extension.sourceInfo);\n\t\t}\n\n\t\treturn this.getCompactNonPackageExtensionLabel(extension.path, nonPackageIndex, nonPackageExtensions);\n\t});\n};\n\nInteractiveModeBase.prototype.getDisplaySourceInfo = function (\n\tthis: InteractiveModeBase,\n\tsourceInfo?: SourceInfo,\n): {\n\tlabel: string;\n\tscopeLabel?: string;\n\tcolor: \"accent\" | \"muted\";\n} {\n\tconst source = sourceInfo?.source ?? \"local\";\n\tconst scope = sourceInfo?.scope ?? \"project\";\n\tif (source === \"local\") {\n\t\tif (scope === \"user\") {\n\t\t\treturn { label: \"user\", color: \"muted\" };\n\t\t}\n\t\tif (scope === \"project\") {\n\t\t\treturn { label: \"project\", color: \"muted\" };\n\t\t}\n\t\tif (scope === \"temporary\") {\n\t\t\treturn { label: \"path\", scopeLabel: \"temp\", color: \"muted\" };\n\t\t}\n\t\treturn { label: \"path\", color: \"muted\" };\n\t}\n\n\tif (source === \"cli\") {\n\t\treturn {\n\t\t\tlabel: \"path\",\n\t\t\tscopeLabel: scope === \"temporary\" ? \"temp\" : undefined,\n\t\t\tcolor: \"muted\",\n\t\t};\n\t}\n\n\tconst scopeLabel =\n\t\tscope === \"user\" ? \"user\" : scope === \"project\" ? \"project\" : scope === \"temporary\" ? \"temp\" : undefined;\n\treturn { label: source, scopeLabel, color: \"accent\" };\n};\n\nInteractiveModeBase.prototype.getScopeGroup = function (\n\tthis: InteractiveModeBase,\n\tsourceInfo?: SourceInfo,\n): \"user\" | \"project\" | \"path\" {\n\tconst source = sourceInfo?.source ?? \"local\";\n\tconst scope = sourceInfo?.scope ?? \"project\";\n\tif (source === \"cli\" || scope === \"temporary\") return \"path\";\n\tif (scope === \"user\") return \"user\";\n\tif (scope === \"project\") return \"project\";\n\treturn \"path\";\n};\n\nInteractiveModeBase.prototype.isPackageSource = function (this: InteractiveModeBase, sourceInfo?: SourceInfo): boolean {\n\tconst source = sourceInfo?.source ?? \"\";\n\treturn source.startsWith(\"npm:\") || source.startsWith(\"git:\");\n};\n\nInteractiveModeBase.prototype.buildScopeGroups = function (\n\tthis: InteractiveModeBase,\n\titems: Array<{ path: string; sourceInfo?: SourceInfo }>,\n): Array<{\n\tscope: \"user\" | \"project\" | \"path\";\n\tpaths: Array<{ path: string; sourceInfo?: SourceInfo }>;\n\tpackages: Map<string, Array<{ path: string; sourceInfo?: SourceInfo }>>;\n}> {\n\tconst groups: Record<\n\t\t\"user\" | \"project\" | \"path\",\n\t\t{\n\t\t\tscope: \"user\" | \"project\" | \"path\";\n\t\t\tpaths: Array<{ path: string; sourceInfo?: SourceInfo }>;\n\t\t\tpackages: Map<string, Array<{ path: string; sourceInfo?: SourceInfo }>>;\n\t\t}\n\t> = {\n\t\tuser: { scope: \"user\", paths: [], packages: new Map() },\n\t\tproject: { scope: \"project\", paths: [], packages: new Map() },\n\t\tpath: { scope: \"path\", paths: [], packages: new Map() },\n\t};\n\n\tfor (const item of items) {\n\t\tconst groupKey = this.getScopeGroup(item.sourceInfo);\n\t\tconst group = groups[groupKey];\n\t\tconst source = item.sourceInfo?.source ?? \"local\";\n\n\t\tif (this.isPackageSource(item.sourceInfo)) {\n\t\t\tconst list = group.packages.get(source) ?? [];\n\t\t\tlist.push(item);\n\t\t\tgroup.packages.set(source, list);\n\t\t} else {\n\t\t\tgroup.paths.push(item);\n\t\t}\n\t}\n\n\treturn [groups.project, groups.user, groups.path].filter(\n\t\t(group) => group.paths.length > 0 || group.packages.size > 0,\n\t);\n};\n\nInteractiveModeBase.prototype.formatScopeGroups = function (\n\tthis: InteractiveModeBase,\n\tgroups: Array<{\n\t\tscope: \"user\" | \"project\" | \"path\";\n\t\tpaths: Array<{ path: string; sourceInfo?: SourceInfo }>;\n\t\tpackages: Map<string, Array<{ path: string; sourceInfo?: SourceInfo }>>;\n\t}>,\n\toptions: {\n\t\tformatPath: (item: { path: string; sourceInfo?: SourceInfo }) => string;\n\t\tformatPackagePath: (item: { path: string; sourceInfo?: SourceInfo }, source: string) => string;\n\t},\n): string {\n\tconst lines: string[] = [];\n\n\tfor (const group of groups) {\n\t\tlines.push(` ${theme.fg(\"accent\", group.scope)}`);\n\n\t\tconst sortedPaths = [...group.paths].sort((a, b) => a.path.localeCompare(b.path));\n\t\tfor (const item of sortedPaths) {\n\t\t\tlines.push(theme.fg(\"dim\", ` ${options.formatPath(item)}`));\n\t\t}\n\n\t\tconst sortedPackages = Array.from(group.packages.entries()).sort(([a], [b]) => a.localeCompare(b));\n\t\tfor (const [source, items] of sortedPackages) {\n\t\t\tlines.push(` ${theme.fg(\"mdLink\", source)}`);\n\t\t\tconst sortedPackagePaths = [...items].sort((a, b) => a.path.localeCompare(b.path));\n\t\t\tfor (const item of sortedPackagePaths) {\n\t\t\t\tlines.push(theme.fg(\"dim\", ` ${options.formatPackagePath(item, source)}`));\n\t\t\t}\n\t\t}\n\t}\n\n\treturn lines.join(\"\\n\");\n};\n\nInteractiveModeBase.prototype.findSourceInfoForPath = function (\n\tthis: InteractiveModeBase,\n\tp: string,\n\tsourceInfos: Map<string, SourceInfo>,\n): SourceInfo | undefined {\n\tconst exact = sourceInfos.get(p);\n\tif (exact) return exact;\n\n\tlet current = p;\n\twhile (current.includes(\"/\")) {\n\t\tcurrent = current.substring(0, current.lastIndexOf(\"/\"));\n\t\tconst parent = sourceInfos.get(current);\n\t\tif (parent) return parent;\n\t}\n\n\treturn undefined;\n};\n\nInteractiveModeBase.prototype.formatPathWithSource = function (\n\tthis: InteractiveModeBase,\n\tp: string,\n\tsourceInfo?: SourceInfo,\n): string {\n\tif (sourceInfo) {\n\t\tconst shortPath = this.getShortPath(p, sourceInfo);\n\t\tconst { label, scopeLabel } = this.getDisplaySourceInfo(sourceInfo);\n\t\tconst labelText = scopeLabel ? `${label} (${scopeLabel})` : label;\n\t\treturn `${labelText} ${shortPath}`;\n\t}\n\treturn this.formatDisplayPath(p);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-resource-paths.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-resource-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,yDAAyD,CAAC;AACxG,OAAO,EAAE,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AK,CAAC;QAClE,OAAO,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC;IACpC,CAAC;IACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import { getBuiltinExtensionEntryLabel } from \"../../core/extensions/builtin-extension-entry-labels.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { parseGitUrl, path, type SourceInfo, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.getShortPath = function (\n\tthis: InteractiveModeBase,\n\tfullPath: string,\n\tsourceInfo?: SourceInfo,\n): string {\n\tconst normalizedFullPath = fullPath.replace(/\\\\/g, \"/\");\n\tconst baseDir = sourceInfo?.baseDir;\n\tif (baseDir && this.isPackageSource(sourceInfo)) {\n\t\tconst normalizedBaseDir = baseDir.replace(/\\\\/g, \"/\");\n\t\tconst npmRootMatch = normalizedBaseDir.match(/^(.*\\/node_modules)\\/(@?[^/]+(?:\\/[^/]+)?)$/);\n\t\tif (npmRootMatch?.[1] && normalizedFullPath.startsWith(`${npmRootMatch[1]}/`)) {\n\t\t\treturn path.posix.relative(normalizedBaseDir, normalizedFullPath);\n\t\t}\n\t\tconst relativePath = path.relative(path.resolve(baseDir), path.resolve(fullPath));\n\t\tif (\n\t\t\trelativePath &&\n\t\t\trelativePath !== \".\" &&\n\t\t\t!relativePath.startsWith(\"..\") &&\n\t\t\t!relativePath.startsWith(`..${path.sep}`) &&\n\t\t\t!path.isAbsolute(relativePath)\n\t\t) {\n\t\t\treturn relativePath.replace(/\\\\/g, \"/\");\n\t\t}\n\t}\n\n\tconst source = sourceInfo?.source ?? \"\";\n\tconst npmMatch = normalizedFullPath.match(/node_modules\\/(@?[^/]+(?:\\/[^/]+)?)\\/(.*)/);\n\tif (npmMatch && source.startsWith(\"npm:\")) {\n\t\treturn npmMatch[2];\n\t}\n\n\tconst gitMatch = normalizedFullPath.match(/git\\/[^/]+\\/[^/]+\\/(.*)/);\n\tif (gitMatch && source.startsWith(\"git:\")) {\n\t\treturn gitMatch[1];\n\t}\n\n\treturn this.formatDisplayPath(fullPath);\n};\n\nInteractiveModeBase.prototype.getCompactPathLabel = function (\n\tthis: InteractiveModeBase,\n\tresourcePath: string,\n\tsourceInfo?: SourceInfo,\n): string {\n\tconst shortPath = this.getShortPath(resourcePath, sourceInfo);\n\tconst normalizedPath = shortPath.replace(/\\\\/g, \"/\");\n\tconst segments = normalizedPath.split(\"/\").filter((segment) => segment.length > 0 && segment !== \"~\");\n\tif (segments.length > 0) {\n\t\treturn segments[segments.length - 1]!;\n\t}\n\treturn shortPath;\n};\n\nInteractiveModeBase.prototype.getCompactPackageSourceLabel = function (\n\tthis: InteractiveModeBase,\n\tsourceInfo?: SourceInfo,\n): string {\n\tconst source = sourceInfo?.source ?? \"\";\n\tif (source.startsWith(\"npm:\")) {\n\t\treturn source.slice(\"npm:\".length) || source;\n\t}\n\n\tconst gitSource = parseGitUrl(source);\n\tif (gitSource) {\n\t\treturn gitSource.path || source;\n\t}\n\n\tif (sourceInfo?.origin === \"package\") {\n\t\treturn path.basename(source) || source;\n\t}\n\n\treturn source;\n};\n\nInteractiveModeBase.prototype.getCompactExtensionLabel = function (\n\tthis: InteractiveModeBase,\n\tresourcePath: string,\n\tsourceInfo?: SourceInfo,\n): string {\n\tif (!this.isPackageSource(sourceInfo)) {\n\t\treturn this.getCompactPathLabel(resourcePath, sourceInfo);\n\t}\n\n\tconst sourceLabel = this.getCompactPackageSourceLabel(sourceInfo);\n\tif (!sourceLabel) {\n\t\treturn this.getCompactPathLabel(resourcePath, sourceInfo);\n\t}\n\n\tconst shortPath = this.getShortPath(resourcePath, sourceInfo).replace(/\\\\/g, \"/\");\n\tconst packagePath = shortPath.startsWith(\"extensions/\") ? shortPath.slice(\"extensions/\".length) : shortPath;\n\tconst parsedPath = path.posix.parse(packagePath);\n\n\tif (parsedPath.name === \"index\") {\n\t\treturn !parsedPath.dir || parsedPath.dir === \".\" ? sourceLabel : `${sourceLabel}:${parsedPath.dir}`;\n\t}\n\n\treturn `${sourceLabel}:${packagePath}`;\n};\n\nInteractiveModeBase.prototype.getCompactDisplayPathSegments = function (\n\tthis: InteractiveModeBase,\n\tresourcePath: string,\n): string[] {\n\treturn this.formatDisplayPath(resourcePath)\n\t\t.replace(/\\\\/g, \"/\")\n\t\t.split(\"/\")\n\t\t.filter((segment) => segment.length > 0 && segment !== \"~\");\n};\n\nInteractiveModeBase.prototype.getCompactNonPackageExtensionLabel = function (\n\tthis: InteractiveModeBase,\n\tresourcePath: string,\n\tindex: number,\n\tallPaths: Array<{ path: string; segments: string[] }>,\n): string {\n\tconst segments = allPaths[index]?.segments;\n\tif (!segments || segments.length === 0) {\n\t\treturn this.getCompactPathLabel(resourcePath);\n\t}\n\n\tfor (let segmentCount = 1; segmentCount <= segments.length; segmentCount += 1) {\n\t\tconst candidate = segments.slice(-segmentCount).join(\"/\");\n\t\tconst isUnique = allPaths.every((item, itemIndex) => {\n\t\t\tif (itemIndex === index) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn item.segments.slice(-segmentCount).join(\"/\") !== candidate;\n\t\t});\n\n\t\tif (isUnique) {\n\t\t\treturn candidate;\n\t\t}\n\t}\n\n\treturn this.formatDisplayPath(resourcePath).replace(/\\\\/g, \"/\");\n};\n\nInteractiveModeBase.prototype.getCompactExtensionLabels = function (\n\tthis: InteractiveModeBase,\n\textensions: Array<{ path: string; sourceInfo?: SourceInfo }>,\n): string[] {\n\tconst nonPackageExtensions = extensions\n\t\t.map((extension) => {\n\t\t\tconst builtinLabel = getBuiltinExtensionEntryLabel(extension.path);\n\t\t\tconst segments = builtinLabel ? [builtinLabel] : this.getCompactDisplayPathSegments(extension.path);\n\t\t\tconst lastSegment = segments[segments.length - 1];\n\t\t\tif (!builtinLabel && segments.length > 1 && (lastSegment === \"index.ts\" || lastSegment === \"index.js\")) {\n\t\t\t\tsegments.pop();\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpath: extension.path,\n\t\t\t\tsourceInfo: extension.sourceInfo,\n\t\t\t\tsegments,\n\t\t\t\tbuiltinLabel,\n\t\t\t};\n\t\t})\n\t\t.filter((extension) => extension.builtinLabel || !this.isPackageSource(extension.sourceInfo));\n\n\tconst labels = extensions.map((extension) => {\n\t\tconst builtinLabel = getBuiltinExtensionEntryLabel(extension.path);\n\t\tif (builtinLabel) return builtinLabel;\n\t\tif (this.isPackageSource(extension.sourceInfo)) {\n\t\t\treturn this.getCompactExtensionLabel(extension.path, extension.sourceInfo);\n\t\t}\n\n\t\tconst nonPackageIndex = nonPackageExtensions.findIndex((item) => item.path === extension.path);\n\t\tif (nonPackageIndex === -1) {\n\t\t\treturn this.getCompactPathLabel(extension.path, extension.sourceInfo);\n\t\t}\n\n\t\treturn this.getCompactNonPackageExtensionLabel(extension.path, nonPackageIndex, nonPackageExtensions);\n\t});\n\n\tconst taken = new Set<string>(\n\t\textensions.flatMap((extension) => {\n\t\t\tconst builtinLabel = getBuiltinExtensionEntryLabel(extension.path);\n\t\t\treturn builtinLabel ? [builtinLabel] : [];\n\t\t}),\n\t);\n\n\treturn labels.map((label, index) => {\n\t\tif (getBuiltinExtensionEntryLabel(extensions[index]!.path)) return label;\n\t\tif (!taken.has(label)) {\n\t\t\ttaken.add(label);\n\t\t\treturn label;\n\t\t}\n\n\t\tlet suffix = 2;\n\t\twhile (taken.has(`${label} (${suffix})`)) suffix += 1;\n\t\tconst uniqueLabel = `${label} (${suffix})`;\n\t\ttaken.add(uniqueLabel);\n\t\treturn uniqueLabel;\n\t});\n};\n\nInteractiveModeBase.prototype.getDisplaySourceInfo = function (\n\tthis: InteractiveModeBase,\n\tsourceInfo?: SourceInfo,\n): {\n\tlabel: string;\n\tscopeLabel?: string;\n\tcolor: \"accent\" | \"muted\";\n} {\n\tconst source = sourceInfo?.source ?? \"local\";\n\tconst scope = sourceInfo?.scope ?? \"project\";\n\tif (source === \"local\") {\n\t\tif (scope === \"user\") {\n\t\t\treturn { label: \"user\", color: \"muted\" };\n\t\t}\n\t\tif (scope === \"project\") {\n\t\t\treturn { label: \"project\", color: \"muted\" };\n\t\t}\n\t\tif (scope === \"temporary\") {\n\t\t\treturn { label: \"path\", scopeLabel: \"temp\", color: \"muted\" };\n\t\t}\n\t\treturn { label: \"path\", color: \"muted\" };\n\t}\n\n\tif (source === \"cli\") {\n\t\treturn {\n\t\t\tlabel: \"path\",\n\t\t\tscopeLabel: scope === \"temporary\" ? \"temp\" : undefined,\n\t\t\tcolor: \"muted\",\n\t\t};\n\t}\n\n\tconst scopeLabel =\n\t\tscope === \"user\" ? \"user\" : scope === \"project\" ? \"project\" : scope === \"temporary\" ? \"temp\" : undefined;\n\treturn { label: source, scopeLabel, color: \"accent\" };\n};\n\nInteractiveModeBase.prototype.getScopeGroup = function (\n\tthis: InteractiveModeBase,\n\tsourceInfo?: SourceInfo,\n): \"user\" | \"project\" | \"path\" {\n\tconst source = sourceInfo?.source ?? \"local\";\n\tconst scope = sourceInfo?.scope ?? \"project\";\n\tif (source === \"cli\" || scope === \"temporary\") return \"path\";\n\tif (scope === \"user\") return \"user\";\n\tif (scope === \"project\") return \"project\";\n\treturn \"path\";\n};\n\nInteractiveModeBase.prototype.isPackageSource = function (this: InteractiveModeBase, sourceInfo?: SourceInfo): boolean {\n\tconst source = sourceInfo?.source ?? \"\";\n\treturn source.startsWith(\"npm:\") || source.startsWith(\"git:\");\n};\n\nInteractiveModeBase.prototype.buildScopeGroups = function (\n\tthis: InteractiveModeBase,\n\titems: Array<{ path: string; sourceInfo?: SourceInfo }>,\n): Array<{\n\tscope: \"user\" | \"project\" | \"path\";\n\tpaths: Array<{ path: string; sourceInfo?: SourceInfo }>;\n\tpackages: Map<string, Array<{ path: string; sourceInfo?: SourceInfo }>>;\n}> {\n\tconst groups: Record<\n\t\t\"user\" | \"project\" | \"path\",\n\t\t{\n\t\t\tscope: \"user\" | \"project\" | \"path\";\n\t\t\tpaths: Array<{ path: string; sourceInfo?: SourceInfo }>;\n\t\t\tpackages: Map<string, Array<{ path: string; sourceInfo?: SourceInfo }>>;\n\t\t}\n\t> = {\n\t\tuser: { scope: \"user\", paths: [], packages: new Map() },\n\t\tproject: { scope: \"project\", paths: [], packages: new Map() },\n\t\tpath: { scope: \"path\", paths: [], packages: new Map() },\n\t};\n\n\tfor (const item of items) {\n\t\tconst groupKey = this.getScopeGroup(item.sourceInfo);\n\t\tconst group = groups[groupKey];\n\t\tconst source = item.sourceInfo?.source ?? \"local\";\n\n\t\tif (this.isPackageSource(item.sourceInfo)) {\n\t\t\tconst list = group.packages.get(source) ?? [];\n\t\t\tlist.push(item);\n\t\t\tgroup.packages.set(source, list);\n\t\t} else {\n\t\t\tgroup.paths.push(item);\n\t\t}\n\t}\n\n\treturn [groups.project, groups.user, groups.path].filter(\n\t\t(group) => group.paths.length > 0 || group.packages.size > 0,\n\t);\n};\n\nInteractiveModeBase.prototype.formatScopeGroups = function (\n\tthis: InteractiveModeBase,\n\tgroups: Array<{\n\t\tscope: \"user\" | \"project\" | \"path\";\n\t\tpaths: Array<{ path: string; sourceInfo?: SourceInfo }>;\n\t\tpackages: Map<string, Array<{ path: string; sourceInfo?: SourceInfo }>>;\n\t}>,\n\toptions: {\n\t\tformatPath: (item: { path: string; sourceInfo?: SourceInfo }) => string;\n\t\tformatPackagePath: (item: { path: string; sourceInfo?: SourceInfo }, source: string) => string;\n\t},\n): string {\n\tconst lines: string[] = [];\n\n\tfor (const group of groups) {\n\t\tlines.push(` ${theme.fg(\"accent\", group.scope)}`);\n\n\t\tconst sortedPaths = [...group.paths].sort((a, b) => a.path.localeCompare(b.path));\n\t\tfor (const item of sortedPaths) {\n\t\t\tlines.push(theme.fg(\"dim\", ` ${options.formatPath(item)}`));\n\t\t}\n\n\t\tconst sortedPackages = Array.from(group.packages.entries()).sort(([a], [b]) => a.localeCompare(b));\n\t\tfor (const [source, items] of sortedPackages) {\n\t\t\tlines.push(` ${theme.fg(\"mdLink\", source)}`);\n\t\t\tconst sortedPackagePaths = [...items].sort((a, b) => a.path.localeCompare(b.path));\n\t\t\tfor (const item of sortedPackagePaths) {\n\t\t\t\tlines.push(theme.fg(\"dim\", ` ${options.formatPackagePath(item, source)}`));\n\t\t\t}\n\t\t}\n\t}\n\n\treturn lines.join(\"\\n\");\n};\n\nInteractiveModeBase.prototype.findSourceInfoForPath = function (\n\tthis: InteractiveModeBase,\n\tp: string,\n\tsourceInfos: Map<string, SourceInfo>,\n): SourceInfo | undefined {\n\tconst exact = sourceInfos.get(p);\n\tif (exact) return exact;\n\n\tlet current = p;\n\twhile (current.includes(\"/\")) {\n\t\tcurrent = current.substring(0, current.lastIndexOf(\"/\"));\n\t\tconst parent = sourceInfos.get(current);\n\t\tif (parent) return parent;\n\t}\n\n\treturn undefined;\n};\n\nInteractiveModeBase.prototype.formatPathWithSource = function (\n\tthis: InteractiveModeBase,\n\tp: string,\n\tsourceInfo?: SourceInfo,\n): string {\n\tif (sourceInfo) {\n\t\tconst shortPath = this.getShortPath(p, sourceInfo);\n\t\tconst { label, scopeLabel } = this.getDisplaySourceInfo(sourceInfo);\n\t\tconst labelText = scopeLabel ? `${label} (${scopeLabel})` : label;\n\t\treturn `${labelText} ${shortPath}`;\n\t}\n\treturn this.formatDisplayPath(p);\n};\n"]}
|