@astralyn/pi 0.81.1-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 +5113 -0
- package/README.md +677 -0
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +11 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -0
- package/dist/bun/register-bedrock.js +4 -0
- package/dist/bun/register-bedrock.js.map +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +17 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +36 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/cli/args.d.ts +57 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +381 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config-selector.d.ts +16 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/file-processor.d.ts +15 -0
- package/dist/cli/file-processor.d.ts.map +1 -0
- package/dist/cli/file-processor.js +70 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/initial-message.d.ts +18 -0
- package/dist/cli/initial-message.d.ts.map +1 -0
- package/dist/cli/initial-message.js +22 -0
- package/dist/cli/initial-message.js.map +1 -0
- package/dist/cli/list-models.d.ts +9 -0
- package/dist/cli/list-models.d.ts.map +1 -0
- package/dist/cli/list-models.js +98 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/project-trust.d.ts +10 -0
- package/dist/cli/project-trust.d.ts.map +1 -0
- package/dist/cli/project-trust.js +48 -0
- package/dist/cli/project-trust.js.map +1 -0
- package/dist/cli/session-picker.d.ts +10 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +36 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +20 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +184 -0
- package/dist/cli/startup-ui.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +18 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +96 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +455 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +119 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +306 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +85 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +133 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session.d.ts +642 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +2679 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-guidance.d.ts +5 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +21 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +56 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +229 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +32 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +111 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/cache-stats.d.ts +49 -0
- package/dist/core/cache-stats.d.ts.map +1 -0
- package/dist/core/cache-stats.js +101 -0
- package/dist/core/cache-stats.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +98 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +246 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +137 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +637 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.d.ts.map +1 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/index.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +38 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +142 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/defaults.d.ts +3 -0
- package/dist/core/defaults.d.ts.map +1 -0
- package/dist/core/defaults.js +2 -0
- package/dist/core/defaults.js.map +1 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +29 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +75 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/experimental.d.ts +2 -0
- package/dist/core/experimental.d.ts.map +1 -0
- package/dist/core/experimental.js +4 -0
- package/dist/core/experimental.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +37 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +226 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1864 -0
- package/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +108 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +78 -0
- package/dist/core/extensions/index.d.ts +12 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/index.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +23 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +558 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +171 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +953 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1259 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +45 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +41 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +54 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +338 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -0
- package/dist/core/http-dispatcher.js +91 -0
- package/dist/core/http-dispatcher.js.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/keybindings.d.ts +363 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +300 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/messages.d.ts +77 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +123 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-config.d.ts +512 -0
- package/dist/core/model-config.d.ts.map +1 -0
- package/dist/core/model-config.js +243 -0
- package/dist/core/model-config.js.map +1 -0
- package/dist/core/model-registry.d.ts +43 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +104 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +121 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +534 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/model-runtime.d.ts +82 -0
- package/dist/core/model-runtime.d.ts.map +1 -0
- package/dist/core/model-runtime.js +441 -0
- package/dist/core/model-runtime.js.map +1 -0
- package/dist/core/models-store.d.ts +17 -0
- package/dist/core/models-store.d.ts.map +1 -0
- package/dist/core/models-store.js +45 -0
- package/dist/core/models-store.js.map +1 -0
- package/dist/core/output-guard.d.ts +7 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +89 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-manager.d.ts +210 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +2135 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/project-trust.d.ts +15 -0
- package/dist/core/project-trust.d.ts.map +1 -0
- package/dist/core/project-trust.js +59 -0
- package/dist/core/project-trust.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +54 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +236 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/provider-attribution.d.ts +4 -0
- package/dist/core/provider-attribution.d.ts.map +1 -0
- package/dist/core/provider-attribution.js +72 -0
- package/dist/core/provider-attribution.js.map +1 -0
- package/dist/core/provider-composer.d.ts +55 -0
- package/dist/core/provider-composer.d.ts.map +1 -0
- package/dist/core/provider-composer.js +375 -0
- package/dist/core/provider-composer.js.map +1 -0
- package/dist/core/radius.d.ts +2 -0
- package/dist/core/radius.d.ts.map +1 -0
- package/dist/core/radius.js +2 -0
- package/dist/core/radius.js.map +1 -0
- package/dist/core/remote-catalog-provider.d.ts +5 -0
- package/dist/core/remote-catalog-provider.d.ts.map +1 -0
- package/dist/core/remote-catalog-provider.js +102 -0
- package/dist/core/remote-catalog-provider.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +247 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +206 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +817 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/runtime-credentials.d.ts +15 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -0
- package/dist/core/runtime-credentials.js +36 -0
- package/dist/core/runtime-credentials.js.map +1 -0
- package/dist/core/sdk.d.ts +106 -0
- package/dist/core/sdk.d.ts.map +1 -0
- package/dist/core/sdk.js +267 -0
- package/dist/core/sdk.js.map +1 -0
- package/dist/core/session-cwd.d.ts +19 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +38 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/session-manager.d.ts +356 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1338 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/settings-manager.d.ts +297 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +902 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +60 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +387 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +15 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +26 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/source-info.d.ts +18 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +19 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/system-prompt.d.ts +28 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +110 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/telemetry.d.ts +3 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/core/telemetry.js +9 -0
- package/dist/core/telemetry.js.map +1 -0
- package/dist/core/timings.d.ts +10 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +41 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +68 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +361 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +106 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +424 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +50 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +261 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +52 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +35 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +305 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +37 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +304 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +40 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +112 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +37 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +167 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +52 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +184 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +10 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +99 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +35 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +276 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +24 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +65 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.js +34 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
- package/dist/core/tools/truncate.d.ts +70 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +215 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/write.d.ts +26 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +197 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/core/trust-manager.d.ts +36 -0
- package/dist/core/trust-manager.d.ts.map +1 -0
- package/dist/core/trust-manager.js +202 -0
- package/dist/core/trust-manager.js.map +1 -0
- package/dist/core/usage-totals.d.ts +19 -0
- package/dist/core/usage-totals.d.ts.map +1 -0
- package/dist/core/usage-totals.js +52 -0
- package/dist/core/usage-totals.js.map +1 -0
- package/dist/extensions/deepwiki/client.d.ts +14 -0
- package/dist/extensions/deepwiki/client.d.ts.map +1 -0
- package/dist/extensions/deepwiki/client.js +196 -0
- package/dist/extensions/deepwiki/client.js.map +1 -0
- package/dist/extensions/deepwiki/constants.d.ts +13 -0
- package/dist/extensions/deepwiki/constants.d.ts.map +1 -0
- package/dist/extensions/deepwiki/constants.js +18 -0
- package/dist/extensions/deepwiki/constants.js.map +1 -0
- package/dist/extensions/deepwiki/contents.d.ts +63 -0
- package/dist/extensions/deepwiki/contents.d.ts.map +1 -0
- package/dist/extensions/deepwiki/contents.js +174 -0
- package/dist/extensions/deepwiki/contents.js.map +1 -0
- package/dist/extensions/deepwiki/execute.d.ts +25 -0
- package/dist/extensions/deepwiki/execute.d.ts.map +1 -0
- package/dist/extensions/deepwiki/execute.js +78 -0
- package/dist/extensions/deepwiki/execute.js.map +1 -0
- package/dist/extensions/deepwiki/http.d.ts +12 -0
- package/dist/extensions/deepwiki/http.d.ts.map +1 -0
- package/dist/extensions/deepwiki/http.js +74 -0
- package/dist/extensions/deepwiki/http.js.map +1 -0
- package/dist/extensions/deepwiki/index.d.ts +9 -0
- package/dist/extensions/deepwiki/index.d.ts.map +1 -0
- package/dist/extensions/deepwiki/index.js +25 -0
- package/dist/extensions/deepwiki/index.js.map +1 -0
- package/dist/extensions/deepwiki/render.d.ts +14 -0
- package/dist/extensions/deepwiki/render.d.ts.map +1 -0
- package/dist/extensions/deepwiki/render.js +166 -0
- package/dist/extensions/deepwiki/render.js.map +1 -0
- package/dist/extensions/deepwiki/schema.d.ts +13 -0
- package/dist/extensions/deepwiki/schema.d.ts.map +1 -0
- package/dist/extensions/deepwiki/schema.js +208 -0
- package/dist/extensions/deepwiki/schema.js.map +1 -0
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +17 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/llama/client.d.ts +61 -0
- package/dist/extensions/llama/client.d.ts.map +1 -0
- package/dist/extensions/llama/client.js +302 -0
- package/dist/extensions/llama/client.js.map +1 -0
- package/dist/extensions/llama/huggingface.d.ts +23 -0
- package/dist/extensions/llama/huggingface.d.ts.map +1 -0
- package/dist/extensions/llama/huggingface.js +141 -0
- package/dist/extensions/llama/huggingface.js.map +1 -0
- package/dist/extensions/llama/index.d.ts +3 -0
- package/dist/extensions/llama/index.d.ts.map +1 -0
- package/dist/extensions/llama/index.js +208 -0
- package/dist/extensions/llama/index.js.map +1 -0
- package/dist/extensions/llama/provider.d.ts +10 -0
- package/dist/extensions/llama/provider.d.ts.map +1 -0
- package/dist/extensions/llama/provider.js +102 -0
- package/dist/extensions/llama/provider.js.map +1 -0
- package/dist/extensions/llama/ui.d.ts +42 -0
- package/dist/extensions/llama/ui.d.ts.map +1 -0
- package/dist/extensions/llama/ui.js +416 -0
- package/dist/extensions/llama/ui.js.map +1 -0
- package/dist/extensions/question/constants.d.ts +13 -0
- package/dist/extensions/question/constants.d.ts.map +1 -0
- package/dist/extensions/question/constants.js +17 -0
- package/dist/extensions/question/constants.js.map +1 -0
- package/dist/extensions/question/dialog-primitives.d.ts +6 -0
- package/dist/extensions/question/dialog-primitives.d.ts.map +1 -0
- package/dist/extensions/question/dialog-primitives.js +20 -0
- package/dist/extensions/question/dialog-primitives.js.map +1 -0
- package/dist/extensions/question/dialog.d.ts +10 -0
- package/dist/extensions/question/dialog.d.ts.map +1 -0
- package/dist/extensions/question/dialog.js +519 -0
- package/dist/extensions/question/dialog.js.map +1 -0
- package/dist/extensions/question/index.d.ts +9 -0
- package/dist/extensions/question/index.d.ts.map +1 -0
- package/dist/extensions/question/index.js +32 -0
- package/dist/extensions/question/index.js.map +1 -0
- package/dist/extensions/question/limits.d.ts +11 -0
- package/dist/extensions/question/limits.d.ts.map +1 -0
- package/dist/extensions/question/limits.js +11 -0
- package/dist/extensions/question/limits.js.map +1 -0
- package/dist/extensions/question/render-cache.d.ts +9 -0
- package/dist/extensions/question/render-cache.d.ts.map +1 -0
- package/dist/extensions/question/render-cache.js +18 -0
- package/dist/extensions/question/render-cache.js.map +1 -0
- package/dist/extensions/question/render.d.ts +17 -0
- package/dist/extensions/question/render.d.ts.map +1 -0
- package/dist/extensions/question/render.js +47 -0
- package/dist/extensions/question/render.js.map +1 -0
- package/dist/extensions/question/results.d.ts +8 -0
- package/dist/extensions/question/results.d.ts.map +1 -0
- package/dist/extensions/question/results.js +68 -0
- package/dist/extensions/question/results.js.map +1 -0
- package/dist/extensions/question/schema.d.ts +22 -0
- package/dist/extensions/question/schema.d.ts.map +1 -0
- package/dist/extensions/question/schema.js +98 -0
- package/dist/extensions/question/schema.js.map +1 -0
- package/dist/extensions/question/state.d.ts +9 -0
- package/dist/extensions/question/state.d.ts.map +1 -0
- package/dist/extensions/question/state.js +76 -0
- package/dist/extensions/question/state.js.map +1 -0
- package/dist/extensions/question/types.d.ts +60 -0
- package/dist/extensions/question/types.d.ts.map +1 -0
- package/dist/extensions/question/types.js +2 -0
- package/dist/extensions/question/types.js.map +1 -0
- package/dist/extensions/rewind/config.d.ts +16 -0
- package/dist/extensions/rewind/config.d.ts.map +1 -0
- package/dist/extensions/rewind/config.js +69 -0
- package/dist/extensions/rewind/config.js.map +1 -0
- package/dist/extensions/rewind/engine.d.ts +97 -0
- package/dist/extensions/rewind/engine.d.ts.map +1 -0
- package/dist/extensions/rewind/engine.js +747 -0
- package/dist/extensions/rewind/engine.js.map +1 -0
- package/dist/extensions/rewind/gc.d.ts +35 -0
- package/dist/extensions/rewind/gc.d.ts.map +1 -0
- package/dist/extensions/rewind/gc.js +169 -0
- package/dist/extensions/rewind/gc.js.map +1 -0
- package/dist/extensions/rewind/index.d.ts +3 -0
- package/dist/extensions/rewind/index.d.ts.map +1 -0
- package/dist/extensions/rewind/index.js +253 -0
- package/dist/extensions/rewind/index.js.map +1 -0
- package/dist/extensions/rewind/menu.d.ts +13 -0
- package/dist/extensions/rewind/menu.d.ts.map +1 -0
- package/dist/extensions/rewind/menu.js +118 -0
- package/dist/extensions/rewind/menu.js.map +1 -0
- package/dist/extensions/rewind/paths.d.ts +4 -0
- package/dist/extensions/rewind/paths.d.ts.map +1 -0
- package/dist/extensions/rewind/paths.js +15 -0
- package/dist/extensions/rewind/paths.js.map +1 -0
- package/dist/extensions/rewind/restore.d.ts +37 -0
- package/dist/extensions/rewind/restore.d.ts.map +1 -0
- package/dist/extensions/rewind/restore.js +52 -0
- package/dist/extensions/rewind/restore.js.map +1 -0
- package/dist/extensions/rewind/snapshot.d.ts +45 -0
- package/dist/extensions/rewind/snapshot.d.ts.map +1 -0
- package/dist/extensions/rewind/snapshot.js +21 -0
- package/dist/extensions/rewind/snapshot.js.map +1 -0
- package/dist/extensions/rewind/storage.d.ts +12 -0
- package/dist/extensions/rewind/storage.d.ts.map +1 -0
- package/dist/extensions/rewind/storage.js +33 -0
- package/dist/extensions/rewind/storage.js.map +1 -0
- package/dist/extensions/rewind/text.d.ts +7 -0
- package/dist/extensions/rewind/text.d.ts.map +1 -0
- package/dist/extensions/rewind/text.js +19 -0
- package/dist/extensions/rewind/text.js.map +1 -0
- package/dist/extensions/rewind/tool-path.d.ts +3 -0
- package/dist/extensions/rewind/tool-path.d.ts.map +1 -0
- package/dist/extensions/rewind/tool-path.js +9 -0
- package/dist/extensions/rewind/tool-path.js.map +1 -0
- package/dist/extensions/router/constants.d.ts +20 -0
- package/dist/extensions/router/constants.d.ts.map +1 -0
- package/dist/extensions/router/constants.js +27 -0
- package/dist/extensions/router/constants.js.map +1 -0
- package/dist/extensions/router/dialog.d.ts +38 -0
- package/dist/extensions/router/dialog.d.ts.map +1 -0
- package/dist/extensions/router/dialog.js +407 -0
- package/dist/extensions/router/dialog.js.map +1 -0
- package/dist/extensions/router/index.d.ts +15 -0
- package/dist/extensions/router/index.d.ts.map +1 -0
- package/dist/extensions/router/index.js +61 -0
- package/dist/extensions/router/index.js.map +1 -0
- package/dist/extensions/router/presets.d.ts +48 -0
- package/dist/extensions/router/presets.d.ts.map +1 -0
- package/dist/extensions/router/presets.js +109 -0
- package/dist/extensions/router/presets.js.map +1 -0
- package/dist/extensions/router/probe.d.ts +20 -0
- package/dist/extensions/router/probe.d.ts.map +1 -0
- package/dist/extensions/router/probe.js +125 -0
- package/dist/extensions/router/probe.js.map +1 -0
- package/dist/extensions/router/register.d.ts +34 -0
- package/dist/extensions/router/register.d.ts.map +1 -0
- package/dist/extensions/router/register.js +81 -0
- package/dist/extensions/router/register.js.map +1 -0
- package/dist/extensions/router/store.d.ts +12 -0
- package/dist/extensions/router/store.d.ts.map +1 -0
- package/dist/extensions/router/store.js +164 -0
- package/dist/extensions/router/store.js.map +1 -0
- package/dist/extensions/router/stream.d.ts +16 -0
- package/dist/extensions/router/stream.d.ts.map +1 -0
- package/dist/extensions/router/stream.js +198 -0
- package/dist/extensions/router/stream.js.map +1 -0
- package/dist/extensions/router/types.d.ts +23 -0
- package/dist/extensions/router/types.d.ts.map +1 -0
- package/dist/extensions/router/types.js +2 -0
- package/dist/extensions/router/types.js.map +1 -0
- package/dist/extensions/router/ui.d.ts +9 -0
- package/dist/extensions/router/ui.d.ts.map +1 -0
- package/dist/extensions/router/ui.js +538 -0
- package/dist/extensions/router/ui.js.map +1 -0
- package/dist/extensions/statusline/index.d.ts +3 -0
- package/dist/extensions/statusline/index.d.ts.map +1 -0
- package/dist/extensions/statusline/index.js +367 -0
- package/dist/extensions/statusline/index.js.map +1 -0
- package/dist/extensions/todo/constants.d.ts +16 -0
- package/dist/extensions/todo/constants.d.ts.map +1 -0
- package/dist/extensions/todo/constants.js +20 -0
- package/dist/extensions/todo/constants.js.map +1 -0
- package/dist/extensions/todo/index.d.ts +17 -0
- package/dist/extensions/todo/index.d.ts.map +1 -0
- package/dist/extensions/todo/index.js +83 -0
- package/dist/extensions/todo/index.js.map +1 -0
- package/dist/extensions/todo/overlay.d.ts +24 -0
- package/dist/extensions/todo/overlay.d.ts.map +1 -0
- package/dist/extensions/todo/overlay.js +139 -0
- package/dist/extensions/todo/overlay.js.map +1 -0
- package/dist/extensions/todo/schema.d.ts +41 -0
- package/dist/extensions/todo/schema.d.ts.map +1 -0
- package/dist/extensions/todo/schema.js +36 -0
- package/dist/extensions/todo/schema.js.map +1 -0
- package/dist/extensions/todo/state.d.ts +57 -0
- package/dist/extensions/todo/state.d.ts.map +1 -0
- package/dist/extensions/todo/state.js +452 -0
- package/dist/extensions/todo/state.js.map +1 -0
- package/dist/extensions/todo/view.d.ts +8 -0
- package/dist/extensions/todo/view.d.ts.map +1 -0
- package/dist/extensions/todo/view.js +119 -0
- package/dist/extensions/todo/view.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +12 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +704 -0
- package/dist/main.js.map +1 -0
- package/dist/migrations.d.ts +33 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +281 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/index.d.ts +9 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +8 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/modes/interactive/components/armin.d.ts.map +1 -0
- package/dist/modes/interactive/components/armin.js +333 -0
- package/dist/modes/interactive/components/armin.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +22 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +141 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +34 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +175 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +54 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +44 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +45 -0
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +102 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +761 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +70 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-entry.d.ts +19 -0
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-entry.js +52 -0
- package/dist/modes/interactive/components/custom-entry.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +79 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
- package/dist/modes/interactive/components/daxnuts.js +140 -0
- package/dist/modes/interactive/components/daxnuts.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +133 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +21 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
- package/dist/modes/interactive/components/earendil-announcement.js +40 -0
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +22 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +128 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-input.js +61 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +26 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +83 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.js +103 -0
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +32 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +222 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +34 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/dist/modes/interactive/components/index.js +35 -0
- package/dist/modes/interactive/components/index.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +36 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +52 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +188 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +54 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +310 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +163 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +42 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +293 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +155 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +867 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +77 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +593 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +39 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +47 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/status-indicator.d.ts +28 -0
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
- package/dist/modes/interactive/components/status-indicator.js +60 -0
- package/dist/modes/interactive/components/status-indicator.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js +50 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.js +52 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +62 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +361 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +94 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1245 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/trust-selector.js +91 -0
- package/dist/modes/interactive/components/trust-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +114 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +14 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +42 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +394 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +5039 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/model-search.d.ts +12 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -0
- package/dist/modes/interactive/model-search.js +15 -0
- package/dist/modes/interactive/model-search.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +87 -0
- package/dist/modes/interactive/theme/ice-cream-dark.json +101 -0
- package/dist/modes/interactive/theme/ice-cream-light.json +101 -0
- package/dist/modes/interactive/theme/light.json +86 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +102 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +340 -0
- package/dist/modes/interactive/theme/theme.d.ts +120 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +1063 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/print-mode.d.ts +28 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +132 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +49 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +246 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +488 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +639 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +457 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/package-manager-cli.d.ts +8 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +775 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/rpc-entry.d.ts +3 -0
- package/dist/rpc-entry.d.ts.map +1 -0
- package/dist/rpc-entry.js +10 -0
- package/dist/rpc-entry.js.map +1 -0
- package/dist/utils/ansi.d.ts +2 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +52 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/changelog.d.ts +22 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +165 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/child-process.d.ts +18 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +106 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +245 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +20 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +4 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +130 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/deprecation.d.ts +4 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/deprecation.js +13 -0
- package/dist/utils/deprecation.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +158 -0
- package/dist/utils/exif-orientation.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/fs-watch.d.ts +5 -0
- package/dist/utils/fs-watch.d.ts.map +1 -0
- package/dist/utils/fs-watch.js +25 -0
- package/dist/utils/fs-watch.js.map +1 -0
- package/dist/utils/git.d.ts +26 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +195 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/image-convert.d.ts +10 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +45 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-process.d.ts +18 -0
- package/dist/utils/image-process.d.ts.map +1 -0
- package/dist/utils/image-process.js +83 -0
- package/dist/utils/image-process.js.map +1 -0
- package/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -0
- package/dist/utils/image-resize-core.js +124 -0
- package/dist/utils/image-resize-core.js.map +1 -0
- package/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/utils/image-resize-worker.d.ts.map +1 -0
- package/dist/utils/image-resize-worker.js +31 -0
- package/dist/utils/image-resize-worker.js.map +1 -0
- package/dist/utils/image-resize.d.ts +16 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +97 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +7 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/mime.d.ts +3 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +110 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +22 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/paths.d.ts +31 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +92 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/photon.d.ts +21 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +121 -0
- package/dist/utils/photon.js.map +1 -0
- package/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/utils/pi-user-agent.d.ts.map +1 -0
- package/dist/utils/pi-user-agent.js +5 -0
- package/dist/utils/pi-user-agent.js.map +1 -0
- package/dist/utils/shell.d.ts +31 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +202 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +118 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +3 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +328 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/dist/utils/version-check.d.ts +15 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +54 -0
- package/dist/utils/version-check.js.map +1 -0
- package/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/utils/windows-self-update.d.ts.map +1 -0
- package/dist/utils/windows-self-update.js +77 -0
- package/dist/utils/windows-self-update.js.map +1 -0
- package/docs/compaction.md +401 -0
- package/docs/containerization.md +111 -0
- package/docs/custom-provider.md +763 -0
- package/docs/development.md +71 -0
- package/docs/docs.json +156 -0
- package/docs/extensions.md +2953 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +77 -0
- package/docs/json.md +86 -0
- package/docs/keybindings.md +198 -0
- package/docs/llama-cpp.md +99 -0
- package/docs/models.md +540 -0
- package/docs/packages.md +228 -0
- package/docs/prompt-templates.md +96 -0
- package/docs/providers.md +301 -0
- package/docs/quickstart.md +165 -0
- package/docs/rpc.md +1559 -0
- package/docs/sdk.md +1186 -0
- package/docs/security.md +59 -0
- package/docs/session-format.md +436 -0
- package/docs/sessions.md +145 -0
- package/docs/settings.md +319 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +231 -0
- package/docs/terminal-setup.md +142 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +301 -0
- package/docs/tmux.md +63 -0
- package/docs/tui.md +942 -0
- package/docs/usage.md +311 -0
- package/docs/windows.md +17 -0
- package/examples/README.md +25 -0
- package/examples/extensions/README.md +213 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +145 -0
- package/examples/extensions/built-in-tool-renderer.ts +249 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +129 -0
- package/examples/extensions/custom-footer.ts +64 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +604 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +404 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +15 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/entry-renderer.ts +41 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/gondolin/index.ts +531 -0
- package/examples/extensions/gondolin/package-lock.json +185 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/examples/extensions/handoff.ts +191 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform-streaming.ts +39 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/kimi-deferred-tools.ts +61 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +426 -0
- package/examples/extensions/modal-editor.ts +85 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +55 -0
- package/examples/extensions/overlay-qa-tests.ts +1450 -0
- package/examples/extensions/overlay-test.ts +153 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +66 -0
- package/examples/extensions/plan-mode/index.ts +390 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +436 -0
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +122 -0
- package/examples/extensions/question.ts +286 -0
- package/examples/extensions/questionnaire.ts +448 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/sandbox/index.ts +321 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +343 -0
- package/examples/extensions/space-invaders.ts +560 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +175 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +126 -0
- package/examples/extensions/subagent/index.ts +1009 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +207 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1008 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +297 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +146 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +195 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/rpc-extension-ui.ts +632 -0
- package/examples/sdk/01-minimal.ts +26 -0
- package/examples/sdk/02-custom-model.ts +50 -0
- package/examples/sdk/03-custom-prompt.ts +70 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +48 -0
- package/examples/sdk/06-extensions.ts +94 -0
- package/examples/sdk/07-context-files.ts +42 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +52 -0
- package/examples/sdk/12-full-control.ts +72 -0
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/README.md +140 -0
- package/npm-shrinkwrap.json +1824 -0
- package/package.json +99 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/extensions/question/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,GAAG,EAAiC,MAAM,wBAAwB,CAAC;AACrH,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAYtF,OAAO,KAAK,EAAE,YAAY,EAA4B,QAAQ,EAAkB,MAAM,YAAY,CAAC;AAYnG,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,QAAQ,EAAE;;;;;EAilBzD","sourcesContent":["import { Editor, type EditorTheme, Markdown, type TUI, truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport { getMarkdownTheme, type Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { ruleBorder, wrapWithPrefix } from \"./dialog-primitives.ts\";\nimport { QUESTION_LIMITS } from \"./limits.ts\";\nimport { WidthCachedRender } from \"./render-cache.ts\";\nimport {\n\tdisplayOptions,\n\tfirstUnanswered,\n\thasAnswer,\n\thasMultiAnswer,\n\tnewQuestionState,\n\torderedAnswers,\n} from \"./state.ts\";\nimport type { DialogResult, DisplayOption, InputMode, Question, QuestionOption } from \"./types.ts\";\n\ntype DialogView = \"question\" | \"review\";\n\ntype DialogKeybindings = {\n\tmatches(data: string, keybinding: string): boolean;\n\tgetKeys(keybinding: string): string[];\n};\n\nconst PREVIEW_MAX_LINES = 16;\nconst PREVIEW_CHROME_ROWS = 18;\n\nexport function createQuestionDialog(questions: Question[]) {\n\treturn (tui: TUI, theme: Theme, keybindings: unknown, done: (result: DialogResult) => void) => {\n\t\tlet currentIdx = 0;\n\t\tlet view: DialogView = \"question\";\n\t\tlet inputMode: InputMode;\n\t\tlet noteTarget: string | undefined;\n\t\tlet dialogFocused = false;\n\t\tlet footerFocused = false;\n\t\tconst cache = new WidthCachedRender();\n\t\tconst states = questions.map(() => newQuestionState());\n\t\tconst bindings = keybindings as DialogKeybindings;\n\n\t\tconst editorTheme: EditorTheme = {\n\t\t\tborderColor: (s) => theme.fg(\"accent\", s),\n\t\t\tselectList: {\n\t\t\t\tselectedPrefix: (t) => theme.fg(\"accent\", t),\n\t\t\t\tselectedText: (t) => theme.fg(\"accent\", t),\n\t\t\t\tdescription: (t) => theme.fg(\"muted\", t),\n\t\t\t\tscrollInfo: (t) => theme.fg(\"dim\", t),\n\t\t\t\tnoMatch: (t) => theme.fg(\"warning\", t),\n\t\t\t},\n\t\t};\n\t\tconst editor = new Editor(tui, editorTheme);\n\n\t\tconst currentQuestion = () => questions[currentIdx];\n\t\tconst currentState = () => states[currentIdx];\n\t\tconst keyMatches = (data: string, keybinding: string) => bindings.matches(data, keybinding);\n\t\tconst keyLabel = (keybinding: string, fallback: string) => bindings.getKeys(keybinding).join(\"/\") || fallback;\n\n\t\tfunction refresh(): void {\n\t\t\tcache.invalidate();\n\t\t\ttui.requestRender();\n\t\t}\n\n\t\tfunction syncEditorFocus(): void {\n\t\t\teditor.focused = dialogFocused && inputMode !== undefined;\n\t\t}\n\n\t\tfunction setCurrentIdx(index: number): void {\n\t\t\tcurrentIdx = Math.max(0, Math.min(questions.length - 1, index));\n\t\t\tview = \"question\";\n\t\t\tinputMode = undefined;\n\t\t\tnoteTarget = undefined;\n\t\t\tfooterFocused = false;\n\t\t\teditor.setText(\"\");\n\t\t\tsyncEditorFocus();\n\t\t\trefresh();\n\t\t}\n\n\t\tfunction clearWarning(): void {\n\t\t\tcurrentState().warning = undefined;\n\t\t}\n\n\t\tfunction focusedOption(): DisplayOption | undefined {\n\t\t\treturn displayOptions(currentQuestion())[currentState().optionIndex];\n\t\t}\n\n\t\tfunction showReview(): void {\n\t\t\tconst missing = firstUnanswered(states);\n\t\t\tif (missing !== undefined) {\n\t\t\t\tsetCurrentIdx(missing);\n\t\t\t\tcurrentState().warning = \"Answer this question before reviewing your answers.\";\n\t\t\t\trefresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tview = \"review\";\n\t\t\tinputMode = undefined;\n\t\t\tnoteTarget = undefined;\n\t\t\tfooterFocused = false;\n\t\t\teditor.setText(\"\");\n\t\t\tsyncEditorFocus();\n\t\t\trefresh();\n\t\t}\n\n\t\tfunction advanceAfterAnswer(): void {\n\t\t\tif (questions.length === 1 && !currentQuestion().multiSelect) {\n\t\t\t\tdone({ answers: orderedAnswers(questions, states), outcome: \"answered\" });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst missing = firstUnanswered(states);\n\t\t\tif (missing === undefined) {\n\t\t\t\tshowReview();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetCurrentIdx(missing);\n\t\t}\n\n\t\tfunction beginCustomInput(): void {\n\t\t\tconst state = currentState();\n\t\t\tinputMode = \"custom\";\n\t\t\tnoteTarget = undefined;\n\t\t\tconst existingSingle = state.singleAnswer?.kind === \"custom\" ? state.singleAnswer.answer : undefined;\n\t\t\teditor.setText(state.customAnswer?.text ?? existingSingle ?? \"\");\n\t\t\tsyncEditorFocus();\n\t\t\trefresh();\n\t\t}\n\n\t\tfunction selectSingleOption(option: QuestionOption): void {\n\t\t\tconst question = currentQuestion();\n\t\t\tconst state = currentState();\n\t\t\tstate.singleAnswer = {\n\t\t\t\tquestionIndex: currentIdx,\n\t\t\t\tquestion: question.question,\n\t\t\t\theader: question.header,\n\t\t\t\tkind: \"option\",\n\t\t\t\tanswer: option.label,\n\t\t\t\t...(option.preview ? { preview: option.preview } : {}),\n\t\t\t};\n\t\t\tstate.warning = undefined;\n\t\t}\n\n\t\tfunction beginNotesInput(): void {\n\t\t\tconst question = currentQuestion();\n\t\t\tconst state = currentState();\n\t\t\tconst option = focusedOption();\n\t\t\tif (!option || option.kind === \"other\") {\n\t\t\t\tbeginCustomInput();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (question.multiSelect && !state.multiSelected.has(option.optionIndex)) {\n\t\t\t\tstate.warning = \"Select the option first, then add notes.\";\n\t\t\t\trefresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!question.multiSelect) selectSingleOption(option);\n\t\t\tinputMode = \"notes\";\n\t\t\tnoteTarget = option.label;\n\t\t\teditor.setText(state.notesByOption.get(option.label) ?? \"\");\n\t\t\tsyncEditorFocus();\n\t\t\trefresh();\n\t\t}\n\n\t\tfunction recordSingle(option: DisplayOption): void {\n\t\t\tif (option.kind === \"other\") {\n\t\t\t\tif (currentState().singleAnswer?.kind === \"custom\") {\n\t\t\t\t\tadvanceAfterAnswer();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbeginCustomInput();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tselectSingleOption(option);\n\t\t\tadvanceAfterAnswer();\n\t\t}\n\n\t\tfunction recordMulti(): void {\n\t\t\tconst state = currentState();\n\t\t\tif (!hasMultiAnswer(state)) {\n\t\t\t\tstate.warning = \"Select at least one option, type a custom answer, or cancel the questions.\";\n\t\t\t\trefresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstate.warning = undefined;\n\t\t\tadvanceAfterAnswer();\n\t\t}\n\n\t\tfunction finishReview(): void {\n\t\t\tconst missing = firstUnanswered(states);\n\t\t\tif (missing !== undefined) {\n\t\t\t\tsetCurrentIdx(missing);\n\t\t\t\tcurrentState().warning = \"Answer this question before submitting.\";\n\t\t\t\trefresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdone({ answers: orderedAnswers(questions, states), outcome: \"answered\" });\n\t\t}\n\n\t\teditor.onSubmit = (value) => {\n\t\t\tconst trimmed = value.trim();\n\t\t\tconst question = currentQuestion();\n\t\t\tconst state = currentState();\n\t\t\tif (trimmed.length > QUESTION_LIMITS.userTextChars) {\n\t\t\t\tstate.warning = `Keep notes and custom answers under ${QUESTION_LIMITS.userTextChars} characters.`;\n\t\t\t\trefresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (inputMode === \"notes\") {\n\t\t\t\tif (noteTarget) {\n\t\t\t\t\tif (trimmed) state.notesByOption.set(noteTarget, trimmed);\n\t\t\t\t\telse state.notesByOption.delete(noteTarget);\n\t\t\t\t}\n\t\t\t\tinputMode = undefined;\n\t\t\t\tnoteTarget = undefined;\n\t\t\t\teditor.setText(\"\");\n\t\t\t\tsyncEditorFocus();\n\t\t\t\trefresh();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (inputMode === \"custom\") {\n\t\t\t\tif (!trimmed) {\n\t\t\t\t\tinputMode = undefined;\n\t\t\t\t\teditor.setText(\"\");\n\t\t\t\t\tsyncEditorFocus();\n\t\t\t\t\trefresh();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (question.multiSelect) {\n\t\t\t\t\tstate.customAnswer = { text: trimmed, selected: true };\n\t\t\t\t\tstate.optionIndex = question.options.length;\n\t\t\t\t\tinputMode = undefined;\n\t\t\t\t\teditor.setText(\"\");\n\t\t\t\t\tsyncEditorFocus();\n\t\t\t\t\trefresh();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tstate.singleAnswer = {\n\t\t\t\t\tquestionIndex: currentIdx,\n\t\t\t\t\tquestion: question.question,\n\t\t\t\t\theader: question.header,\n\t\t\t\t\tkind: \"custom\",\n\t\t\t\t\tanswer: trimmed,\n\t\t\t\t};\n\t\t\t\tinputMode = undefined;\n\t\t\t\teditor.setText(\"\");\n\t\t\t\tsyncEditorFocus();\n\t\t\t\tadvanceAfterAnswer();\n\t\t\t}\n\t\t};\n\n\t\tfunction handleReviewInput(data: string): void {\n\t\t\tif (keyMatches(data, \"tui.editor.cursorLeft\")) {\n\t\t\t\tsetCurrentIdx(questions.length - 1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keyMatches(data, \"tui.select.confirm\")) {\n\t\t\t\tfinishReview();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keyMatches(data, \"tui.select.cancel\")) {\n\t\t\t\tsetCurrentIdx(questions.length - 1);\n\t\t\t}\n\t\t}\n\n\t\tfunction handleQuestionInput(data: string): void {\n\t\t\tif (inputMode) {\n\t\t\t\tif (keyMatches(data, \"tui.select.cancel\")) {\n\t\t\t\t\tinputMode = undefined;\n\t\t\t\t\tnoteTarget = undefined;\n\t\t\t\t\teditor.setText(\"\");\n\t\t\t\t\tsyncEditorFocus();\n\t\t\t\t\trefresh();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\teditor.handleInput(data);\n\t\t\t\trefresh();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (keyMatches(data, \"tui.editor.cursorLeft\")) {\n\t\t\t\tif (currentIdx > 0) setCurrentIdx(currentIdx - 1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keyMatches(data, \"tui.editor.cursorRight\")) {\n\t\t\t\tif (currentIdx < questions.length - 1) setCurrentIdx(currentIdx + 1);\n\t\t\t\telse if (firstUnanswered(states) === undefined) showReview();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst state = currentState();\n\t\t\tconst options = displayOptions(currentQuestion());\n\t\t\tif (keyMatches(data, \"tui.select.up\")) {\n\t\t\t\tif (footerFocused) {\n\t\t\t\t\tfooterFocused = false;\n\t\t\t\t\tstate.optionIndex = options.length - 1;\n\t\t\t\t} else if (state.optionIndex > 0) {\n\t\t\t\t\tstate.optionIndex--;\n\t\t\t\t}\n\t\t\t\tclearWarning();\n\t\t\t\trefresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keyMatches(data, \"tui.select.down\")) {\n\t\t\t\tif (footerFocused) return;\n\t\t\t\tif (state.optionIndex < options.length - 1) state.optionIndex++;\n\t\t\t\telse footerFocused = true;\n\t\t\t\tclearWarning();\n\t\t\t\trefresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keyMatches(data, \"tui.input.tab\")) {\n\t\t\t\tif (!footerFocused) beginNotesInput();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (footerFocused) {\n\t\t\t\tif (keyMatches(data, \"tui.select.confirm\")) {\n\t\t\t\t\tdone({ answers: orderedAnswers(questions, states), outcome: \"needs_clarification\" });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (keyMatches(data, \"tui.select.cancel\")) {\n\t\t\t\t\tdone({ answers: orderedAnswers(questions, states), outcome: \"cancelled\" });\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst question = currentQuestion();\n\t\t\tconst option = options[state.optionIndex];\n\t\t\tif (question.multiSelect && keyMatches(data, \"app.list.toggle\")) {\n\t\t\t\tif (option?.kind === \"other\") {\n\t\t\t\t\tif (state.customAnswer) {\n\t\t\t\t\t\tstate.customAnswer.selected = !state.customAnswer.selected;\n\t\t\t\t\t\tclearWarning();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstate.warning = `Press ${keyLabel(\"tui.input.tab\", \"Tab\")} to type a custom answer.`;\n\t\t\t\t\t}\n\t\t\t\t\trefresh();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (option?.kind === \"option\") {\n\t\t\t\t\tif (state.multiSelected.has(option.optionIndex)) state.multiSelected.delete(option.optionIndex);\n\t\t\t\t\telse state.multiSelected.add(option.optionIndex);\n\t\t\t\t}\n\t\t\t\tclearWarning();\n\t\t\t\trefresh();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (keyMatches(data, \"tui.select.confirm\")) {\n\t\t\t\tif (question.multiSelect) recordMulti();\n\t\t\t\telse if (option) recordSingle(option);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (keyMatches(data, \"tui.select.cancel\")) {\n\t\t\t\tdone({ answers: orderedAnswers(questions, states), outcome: \"cancelled\" });\n\t\t\t}\n\t\t}\n\n\t\tfunction handleInput(data: string): void {\n\t\t\tif (view === \"review\") handleReviewInput(data);\n\t\t\telse handleQuestionInput(data);\n\t\t}\n\n\t\tfunction render(width: number): string[] {\n\t\t\treturn cache.get(width, tui.terminal.rows, compute);\n\t\t}\n\n\t\tfunction renderTabs(renderWidth: number, lines: string[]): void {\n\t\t\tif (questions.length < 2) return;\n\t\t\tconst tabCount = questions.length + 1;\n\t\t\tconst headerWidth = Math.max(4, Math.floor((renderWidth - tabCount * 5) / tabCount));\n\t\t\tconst tabs = [\n\t\t\t\t...questions.map((question, index) => {\n\t\t\t\t\tconst answered = hasAnswer(states[index]);\n\t\t\t\t\tconst label = ` ${answered ? \"■\" : \"□\"} ${truncateToWidth(question.header, headerWidth)} `;\n\t\t\t\t\tif (view === \"question\" && index === currentIdx) {\n\t\t\t\t\t\treturn theme.bg(\"selectedBg\", theme.fg(answered ? \"success\" : \"text\", label));\n\t\t\t\t\t}\n\t\t\t\t\treturn theme.fg(answered ? \"success\" : \"muted\", label);\n\t\t\t\t}),\n\t\t\t\tview === \"review\"\n\t\t\t\t\t? theme.bg(\"selectedBg\", theme.fg(\"text\", \" ✓ Submit \"))\n\t\t\t\t\t: theme.fg(firstUnanswered(states) === undefined ? \"success\" : \"dim\", \" ✓ Submit \"),\n\t\t\t].join(\" \");\n\t\t\twrapWithPrefix(\" \", tabs, renderWidth, lines);\n\t\t\tlines.push(\"\");\n\t\t}\n\n\t\tfunction previewLines(previewText: string, width: number, terminalRows: number): string[] {\n\t\t\tconst markdown = new Markdown(previewText, 1, 0, getMarkdownTheme());\n\t\t\tconst rendered = markdown.render(Math.max(1, width));\n\t\t\tconst maxLines = Math.max(4, Math.min(PREVIEW_MAX_LINES, terminalRows - PREVIEW_CHROME_ROWS));\n\t\t\tif (rendered.length <= maxLines) return rendered;\n\t\t\treturn [\n\t\t\t\t...rendered.slice(0, maxLines),\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"dim\",\n\t\t\t\t\ttruncateToWidth(`… ${rendered.length - maxLines} preview lines hidden`, Math.max(1, width)),\n\t\t\t\t),\n\t\t\t];\n\t\t}\n\n\t\tfunction renderReview(renderWidth: number, lines: string[]): void {\n\t\t\twrapWithPrefix(\" \", theme.fg(\"accent\", \"Review answers\"), renderWidth, lines);\n\t\t\tlines.push(\"\");\n\t\t\tfor (const answer of orderedAnswers(questions, states)) {\n\t\t\t\twrapWithPrefix(\n\t\t\t\t\t\" \",\n\t\t\t\t\ttheme.fg(\"text\", `${answer.questionIndex + 1}. ${answer.question}`),\n\t\t\t\t\trenderWidth,\n\t\t\t\t\tlines,\n\t\t\t\t);\n\t\t\t\tconst response =\n\t\t\t\t\tanswer.kind === \"multi\"\n\t\t\t\t\t\t? (answer.selected?.join(\", \") ?? \"(no input)\")\n\t\t\t\t\t\t: (answer.answer ?? \"(no input)\");\n\t\t\t\twrapWithPrefix(\" \", theme.fg(\"success\", response), renderWidth, lines);\n\t\t\t\tfor (const note of answer.notes ?? []) {\n\t\t\t\t\twrapWithPrefix(\" \", theme.fg(\"muted\", `Note for ${note.option}: ${note.text}`), renderWidth, lines);\n\t\t\t\t}\n\t\t\t\tlines.push(\"\");\n\t\t\t}\n\t\t\twrapWithPrefix(\n\t\t\t\t\" \",\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"dim\",\n\t\t\t\t\t`${keyLabel(\"tui.select.confirm\", \"Enter\")} to submit • ${keyLabel(\"tui.select.cancel\", \"Esc\")} to edit the last question`,\n\t\t\t\t),\n\t\t\t\trenderWidth,\n\t\t\t\tlines,\n\t\t\t);\n\t\t}\n\n\t\tfunction compute(width: number, terminalRows: number): string[] {\n\t\t\tconst lines: string[] = [];\n\t\t\tconst renderWidth = Math.max(1, width);\n\t\t\tlines.push(ruleBorder(theme, renderWidth));\n\t\t\trenderTabs(renderWidth, lines);\n\n\t\t\tif (view === \"review\") {\n\t\t\t\trenderReview(renderWidth, lines);\n\t\t\t\tlines.push(ruleBorder(theme, renderWidth));\n\t\t\t\treturn lines;\n\t\t\t}\n\n\t\t\tconst question = currentQuestion();\n\t\t\tconst state = currentState();\n\t\t\tconst options = displayOptions(question);\n\t\t\tconst isMulti = question.multiSelect === true;\n\t\t\twrapWithPrefix(\n\t\t\t\t\" \",\n\t\t\t\t`${theme.fg(\"accent\", question.header)} ${theme.fg(\"text\", question.question)}`,\n\t\t\t\trenderWidth,\n\t\t\t\tlines,\n\t\t\t);\n\t\t\tlines.push(\"\");\n\n\t\t\tconst optionLines: string[] = [];\n\t\t\tconst hasPreview = !isMulti && options.some((option) => option.kind === \"option\" && option.preview);\n\t\t\tconst showPreviewSideBySide = hasPreview && renderWidth >= 60;\n\t\t\tconst listWidth = showPreviewSideBySide ? Math.max(20, Math.floor(renderWidth * 0.4)) : renderWidth;\n\n\t\t\tfor (let index = 0; index < options.length; index++) {\n\t\t\t\tconst option = options[index];\n\t\t\t\tconst focused = !footerFocused && index === state.optionIndex;\n\t\t\t\tconst checked =\n\t\t\t\t\tisMulti &&\n\t\t\t\t\t((option.kind === \"option\" && state.multiSelected.has(option.optionIndex)) ||\n\t\t\t\t\t\t(option.kind === \"other\" && state.customAnswer?.selected === true));\n\t\t\t\tconst selectedSingle =\n\t\t\t\t\t!isMulti &&\n\t\t\t\t\t(option.kind === \"other\"\n\t\t\t\t\t\t? state.singleAnswer?.kind === \"custom\"\n\t\t\t\t\t\t: state.singleAnswer?.answer === option.label);\n\t\t\t\tconst marker = isMulti\n\t\t\t\t\t? option.kind === \"other\"\n\t\t\t\t\t\t? state.customAnswer\n\t\t\t\t\t\t\t? checked\n\t\t\t\t\t\t\t\t? theme.fg(\"success\", \"[x]\")\n\t\t\t\t\t\t\t\t: theme.fg(\"dim\", \"[ ]\")\n\t\t\t\t\t\t\t: \" \"\n\t\t\t\t\t\t: checked\n\t\t\t\t\t\t\t? theme.fg(\"success\", \"[x]\")\n\t\t\t\t\t\t\t: theme.fg(\"dim\", \"[ ]\")\n\t\t\t\t\t: \"\";\n\t\t\t\tconst focusArrow = focused ? theme.fg(\"accent\", \"→\") : \" \";\n\t\t\t\tconst note =\n\t\t\t\t\toption.kind === \"option\" && state.notesByOption.has(option.label) ? theme.fg(\"success\", \" +note\") : \"\";\n\t\t\t\tconst customText =\n\t\t\t\t\toption.kind === \"other\"\n\t\t\t\t\t\t? (state.customAnswer?.text ??\n\t\t\t\t\t\t\t(state.singleAnswer?.kind === \"custom\" ? state.singleAnswer.answer : undefined))\n\t\t\t\t\t\t: undefined;\n\t\t\t\tconst labelText = customText ? `${option.label} ✎ ${customText}` : option.label;\n\t\t\t\tconst label = `${index + 1}. ${labelText}${selectedSingle ? \" ✓\" : \"\"}${note}`;\n\t\t\t\tconst color = focused ? \"accent\" : selectedSingle || checked ? \"success\" : \"text\";\n\t\t\t\twrapWithPrefix(`${focusArrow} ${marker} `, theme.fg(color, label), listWidth, optionLines);\n\t\t\t\tif (option.kind === \"option\" && option.description) {\n\t\t\t\t\twrapWithPrefix(\" \", theme.fg(\"muted\", option.description), listWidth, optionLines);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (inputMode) {\n\t\t\t\toptionLines.push(\"\");\n\t\t\t\tconst label = inputMode === \"notes\" ? `Notes for ${noteTarget ?? \"option\"}:` : \"Your answer:\";\n\t\t\t\twrapWithPrefix(\" \", theme.fg(\"muted\", label), listWidth, optionLines);\n\t\t\t\tfor (const line of editor.render(Math.max(1, listWidth - 2))) optionLines.push(` ${line}`);\n\t\t\t}\n\n\t\t\tif (showPreviewSideBySide) {\n\t\t\t\tconst gap = 2;\n\t\t\t\tconst rightWidth = renderWidth - listWidth - gap;\n\t\t\t\tconst focused = options[state.optionIndex];\n\t\t\t\tconst previewText = focused?.kind === \"option\" && focused.preview ? focused.preview : \"\";\n\t\t\t\tconst rightLines = previewText\n\t\t\t\t\t? previewLines(previewText, rightWidth, terminalRows)\n\t\t\t\t\t: [theme.fg(\"dim\", \"(no preview)\")];\n\t\t\t\tconst maxRows = Math.max(optionLines.length, rightLines.length);\n\t\t\t\tconst pad = \" \".repeat(gap);\n\t\t\t\tfor (let row = 0; row < maxRows; row++) {\n\t\t\t\t\tconst left = row < optionLines.length ? optionLines[row] : \"\";\n\t\t\t\t\tconst leftPadded = left + \" \".repeat(Math.max(0, listWidth - visibleWidth(left)));\n\t\t\t\t\tconst right = row < rightLines.length ? rightLines[row] : \"\";\n\t\t\t\t\tlines.push(`${leftPadded}${pad}${right}`);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlines.push(...optionLines);\n\t\t\t\tif (hasPreview) {\n\t\t\t\t\tconst focused = options[state.optionIndex];\n\t\t\t\t\tconst previewText = focused?.kind === \"option\" && focused.preview ? focused.preview : \"\";\n\t\t\t\t\tif (previewText) {\n\t\t\t\t\t\tlines.push(\"\");\n\t\t\t\t\t\tlines.push(ruleBorder(theme, renderWidth, \"dim\"));\n\t\t\t\t\t\tlines.push(...previewLines(previewText, renderWidth, terminalRows));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlines.push(\"\");\n\t\t\tconst chatPrefix = footerFocused ? theme.fg(\"accent\", \"→\") : \" \";\n\t\t\twrapWithPrefix(\n\t\t\t\t`${chatPrefix} `,\n\t\t\t\ttheme.fg(footerFocused ? \"accent\" : \"text\", \"Chat about this\"),\n\t\t\t\trenderWidth,\n\t\t\t\tlines,\n\t\t\t);\n\t\t\tif (state.warning) {\n\t\t\t\tlines.push(\"\");\n\t\t\t\twrapWithPrefix(\" \", theme.fg(\"warning\", state.warning), renderWidth, lines);\n\t\t\t}\n\t\t\tlines.push(\"\");\n\t\t\tif (inputMode === \"notes\") {\n\t\t\t\twrapWithPrefix(\n\t\t\t\t\t\" \",\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"dim\",\n\t\t\t\t\t\t`${keyLabel(\"tui.select.confirm\", \"Enter\")} to save notes • ${keyLabel(\"tui.select.cancel\", \"Esc\")} to go back`,\n\t\t\t\t\t),\n\t\t\t\t\trenderWidth,\n\t\t\t\t\tlines,\n\t\t\t\t);\n\t\t\t} else if (inputMode === \"custom\") {\n\t\t\t\tconst hint = isMulti ? \"to save custom answer\" : \"to continue\";\n\t\t\t\twrapWithPrefix(\n\t\t\t\t\t\" \",\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"dim\",\n\t\t\t\t\t\t`${keyLabel(\"tui.select.confirm\", \"Enter\")} ${hint} • ${keyLabel(\"tui.select.cancel\", \"Esc\")} to go back`,\n\t\t\t\t\t),\n\t\t\t\t\trenderWidth,\n\t\t\t\t\tlines,\n\t\t\t\t);\n\t\t\t} else if (footerFocused) {\n\t\t\t\twrapWithPrefix(\n\t\t\t\t\t\" \",\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"dim\",\n\t\t\t\t\t\t`${keyLabel(\"tui.select.confirm\", \"Enter\")} to discuss • ${keyLabel(\"tui.select.up\", \"Up\")} to return to options`,\n\t\t\t\t\t),\n\t\t\t\t\trenderWidth,\n\t\t\t\t\tlines,\n\t\t\t\t);\n\t\t\t} else if (isMulti) {\n\t\t\t\twrapWithPrefix(\n\t\t\t\t\t\" \",\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"dim\",\n\t\t\t\t\t\t`${keyLabel(\"app.list.toggle\", \"Space\")} to toggle • ${keyLabel(\"tui.input.tab\", \"Tab\")} for notes/custom • ${keyLabel(\"tui.select.confirm\", \"Enter\")} to continue • ${keyLabel(\"tui.editor.cursorLeft\", \"Left\")}/${keyLabel(\"tui.editor.cursorRight\", \"Right\")} questions • ${keyLabel(\"tui.select.cancel\", \"Esc\")} to cancel`,\n\t\t\t\t\t),\n\t\t\t\t\trenderWidth,\n\t\t\t\t\tlines,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\twrapWithPrefix(\n\t\t\t\t\t\" \",\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"dim\",\n\t\t\t\t\t\t`${keyLabel(\"tui.input.tab\", \"Tab\")} for notes/custom • ${keyLabel(\"tui.select.confirm\", \"Enter\")} to select • ${keyLabel(\"tui.editor.cursorLeft\", \"Left\")}/${keyLabel(\"tui.editor.cursorRight\", \"Right\")} questions • ${keyLabel(\"tui.select.cancel\", \"Esc\")} to cancel`,\n\t\t\t\t\t),\n\t\t\t\t\trenderWidth,\n\t\t\t\t\tlines,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlines.push(ruleBorder(theme, renderWidth));\n\t\t\treturn lines;\n\t\t}\n\n\t\treturn {\n\t\t\tget focused() {\n\t\t\t\treturn dialogFocused;\n\t\t\t},\n\t\t\tset focused(value: boolean) {\n\t\t\t\tdialogFocused = value;\n\t\t\t\tsyncEditorFocus();\n\t\t\t},\n\t\t\trender,\n\t\t\tinvalidate: () => {\n\t\t\t\tcache.invalidate();\n\t\t\t},\n\t\t\thandleInput,\n\t\t};\n\t};\n}\n"]}
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import { Editor, Markdown, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
2
|
+
import { getMarkdownTheme } from "../../modes/interactive/theme/theme.js";
|
|
3
|
+
import { ruleBorder, wrapWithPrefix } from "./dialog-primitives.js";
|
|
4
|
+
import { QUESTION_LIMITS } from "./limits.js";
|
|
5
|
+
import { WidthCachedRender } from "./render-cache.js";
|
|
6
|
+
import { displayOptions, firstUnanswered, hasAnswer, hasMultiAnswer, newQuestionState, orderedAnswers, } from "./state.js";
|
|
7
|
+
const PREVIEW_MAX_LINES = 16;
|
|
8
|
+
const PREVIEW_CHROME_ROWS = 18;
|
|
9
|
+
export function createQuestionDialog(questions) {
|
|
10
|
+
return (tui, theme, keybindings, done) => {
|
|
11
|
+
let currentIdx = 0;
|
|
12
|
+
let view = "question";
|
|
13
|
+
let inputMode;
|
|
14
|
+
let noteTarget;
|
|
15
|
+
let dialogFocused = false;
|
|
16
|
+
let footerFocused = false;
|
|
17
|
+
const cache = new WidthCachedRender();
|
|
18
|
+
const states = questions.map(() => newQuestionState());
|
|
19
|
+
const bindings = keybindings;
|
|
20
|
+
const editorTheme = {
|
|
21
|
+
borderColor: (s) => theme.fg("accent", s),
|
|
22
|
+
selectList: {
|
|
23
|
+
selectedPrefix: (t) => theme.fg("accent", t),
|
|
24
|
+
selectedText: (t) => theme.fg("accent", t),
|
|
25
|
+
description: (t) => theme.fg("muted", t),
|
|
26
|
+
scrollInfo: (t) => theme.fg("dim", t),
|
|
27
|
+
noMatch: (t) => theme.fg("warning", t),
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
const editor = new Editor(tui, editorTheme);
|
|
31
|
+
const currentQuestion = () => questions[currentIdx];
|
|
32
|
+
const currentState = () => states[currentIdx];
|
|
33
|
+
const keyMatches = (data, keybinding) => bindings.matches(data, keybinding);
|
|
34
|
+
const keyLabel = (keybinding, fallback) => bindings.getKeys(keybinding).join("/") || fallback;
|
|
35
|
+
function refresh() {
|
|
36
|
+
cache.invalidate();
|
|
37
|
+
tui.requestRender();
|
|
38
|
+
}
|
|
39
|
+
function syncEditorFocus() {
|
|
40
|
+
editor.focused = dialogFocused && inputMode !== undefined;
|
|
41
|
+
}
|
|
42
|
+
function setCurrentIdx(index) {
|
|
43
|
+
currentIdx = Math.max(0, Math.min(questions.length - 1, index));
|
|
44
|
+
view = "question";
|
|
45
|
+
inputMode = undefined;
|
|
46
|
+
noteTarget = undefined;
|
|
47
|
+
footerFocused = false;
|
|
48
|
+
editor.setText("");
|
|
49
|
+
syncEditorFocus();
|
|
50
|
+
refresh();
|
|
51
|
+
}
|
|
52
|
+
function clearWarning() {
|
|
53
|
+
currentState().warning = undefined;
|
|
54
|
+
}
|
|
55
|
+
function focusedOption() {
|
|
56
|
+
return displayOptions(currentQuestion())[currentState().optionIndex];
|
|
57
|
+
}
|
|
58
|
+
function showReview() {
|
|
59
|
+
const missing = firstUnanswered(states);
|
|
60
|
+
if (missing !== undefined) {
|
|
61
|
+
setCurrentIdx(missing);
|
|
62
|
+
currentState().warning = "Answer this question before reviewing your answers.";
|
|
63
|
+
refresh();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
view = "review";
|
|
67
|
+
inputMode = undefined;
|
|
68
|
+
noteTarget = undefined;
|
|
69
|
+
footerFocused = false;
|
|
70
|
+
editor.setText("");
|
|
71
|
+
syncEditorFocus();
|
|
72
|
+
refresh();
|
|
73
|
+
}
|
|
74
|
+
function advanceAfterAnswer() {
|
|
75
|
+
if (questions.length === 1 && !currentQuestion().multiSelect) {
|
|
76
|
+
done({ answers: orderedAnswers(questions, states), outcome: "answered" });
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const missing = firstUnanswered(states);
|
|
80
|
+
if (missing === undefined) {
|
|
81
|
+
showReview();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
setCurrentIdx(missing);
|
|
85
|
+
}
|
|
86
|
+
function beginCustomInput() {
|
|
87
|
+
const state = currentState();
|
|
88
|
+
inputMode = "custom";
|
|
89
|
+
noteTarget = undefined;
|
|
90
|
+
const existingSingle = state.singleAnswer?.kind === "custom" ? state.singleAnswer.answer : undefined;
|
|
91
|
+
editor.setText(state.customAnswer?.text ?? existingSingle ?? "");
|
|
92
|
+
syncEditorFocus();
|
|
93
|
+
refresh();
|
|
94
|
+
}
|
|
95
|
+
function selectSingleOption(option) {
|
|
96
|
+
const question = currentQuestion();
|
|
97
|
+
const state = currentState();
|
|
98
|
+
state.singleAnswer = {
|
|
99
|
+
questionIndex: currentIdx,
|
|
100
|
+
question: question.question,
|
|
101
|
+
header: question.header,
|
|
102
|
+
kind: "option",
|
|
103
|
+
answer: option.label,
|
|
104
|
+
...(option.preview ? { preview: option.preview } : {}),
|
|
105
|
+
};
|
|
106
|
+
state.warning = undefined;
|
|
107
|
+
}
|
|
108
|
+
function beginNotesInput() {
|
|
109
|
+
const question = currentQuestion();
|
|
110
|
+
const state = currentState();
|
|
111
|
+
const option = focusedOption();
|
|
112
|
+
if (!option || option.kind === "other") {
|
|
113
|
+
beginCustomInput();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (question.multiSelect && !state.multiSelected.has(option.optionIndex)) {
|
|
117
|
+
state.warning = "Select the option first, then add notes.";
|
|
118
|
+
refresh();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (!question.multiSelect)
|
|
122
|
+
selectSingleOption(option);
|
|
123
|
+
inputMode = "notes";
|
|
124
|
+
noteTarget = option.label;
|
|
125
|
+
editor.setText(state.notesByOption.get(option.label) ?? "");
|
|
126
|
+
syncEditorFocus();
|
|
127
|
+
refresh();
|
|
128
|
+
}
|
|
129
|
+
function recordSingle(option) {
|
|
130
|
+
if (option.kind === "other") {
|
|
131
|
+
if (currentState().singleAnswer?.kind === "custom") {
|
|
132
|
+
advanceAfterAnswer();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
beginCustomInput();
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
selectSingleOption(option);
|
|
139
|
+
advanceAfterAnswer();
|
|
140
|
+
}
|
|
141
|
+
function recordMulti() {
|
|
142
|
+
const state = currentState();
|
|
143
|
+
if (!hasMultiAnswer(state)) {
|
|
144
|
+
state.warning = "Select at least one option, type a custom answer, or cancel the questions.";
|
|
145
|
+
refresh();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
state.warning = undefined;
|
|
149
|
+
advanceAfterAnswer();
|
|
150
|
+
}
|
|
151
|
+
function finishReview() {
|
|
152
|
+
const missing = firstUnanswered(states);
|
|
153
|
+
if (missing !== undefined) {
|
|
154
|
+
setCurrentIdx(missing);
|
|
155
|
+
currentState().warning = "Answer this question before submitting.";
|
|
156
|
+
refresh();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
done({ answers: orderedAnswers(questions, states), outcome: "answered" });
|
|
160
|
+
}
|
|
161
|
+
editor.onSubmit = (value) => {
|
|
162
|
+
const trimmed = value.trim();
|
|
163
|
+
const question = currentQuestion();
|
|
164
|
+
const state = currentState();
|
|
165
|
+
if (trimmed.length > QUESTION_LIMITS.userTextChars) {
|
|
166
|
+
state.warning = `Keep notes and custom answers under ${QUESTION_LIMITS.userTextChars} characters.`;
|
|
167
|
+
refresh();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (inputMode === "notes") {
|
|
171
|
+
if (noteTarget) {
|
|
172
|
+
if (trimmed)
|
|
173
|
+
state.notesByOption.set(noteTarget, trimmed);
|
|
174
|
+
else
|
|
175
|
+
state.notesByOption.delete(noteTarget);
|
|
176
|
+
}
|
|
177
|
+
inputMode = undefined;
|
|
178
|
+
noteTarget = undefined;
|
|
179
|
+
editor.setText("");
|
|
180
|
+
syncEditorFocus();
|
|
181
|
+
refresh();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (inputMode === "custom") {
|
|
185
|
+
if (!trimmed) {
|
|
186
|
+
inputMode = undefined;
|
|
187
|
+
editor.setText("");
|
|
188
|
+
syncEditorFocus();
|
|
189
|
+
refresh();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (question.multiSelect) {
|
|
193
|
+
state.customAnswer = { text: trimmed, selected: true };
|
|
194
|
+
state.optionIndex = question.options.length;
|
|
195
|
+
inputMode = undefined;
|
|
196
|
+
editor.setText("");
|
|
197
|
+
syncEditorFocus();
|
|
198
|
+
refresh();
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
state.singleAnswer = {
|
|
202
|
+
questionIndex: currentIdx,
|
|
203
|
+
question: question.question,
|
|
204
|
+
header: question.header,
|
|
205
|
+
kind: "custom",
|
|
206
|
+
answer: trimmed,
|
|
207
|
+
};
|
|
208
|
+
inputMode = undefined;
|
|
209
|
+
editor.setText("");
|
|
210
|
+
syncEditorFocus();
|
|
211
|
+
advanceAfterAnswer();
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
function handleReviewInput(data) {
|
|
215
|
+
if (keyMatches(data, "tui.editor.cursorLeft")) {
|
|
216
|
+
setCurrentIdx(questions.length - 1);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (keyMatches(data, "tui.select.confirm")) {
|
|
220
|
+
finishReview();
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (keyMatches(data, "tui.select.cancel")) {
|
|
224
|
+
setCurrentIdx(questions.length - 1);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function handleQuestionInput(data) {
|
|
228
|
+
if (inputMode) {
|
|
229
|
+
if (keyMatches(data, "tui.select.cancel")) {
|
|
230
|
+
inputMode = undefined;
|
|
231
|
+
noteTarget = undefined;
|
|
232
|
+
editor.setText("");
|
|
233
|
+
syncEditorFocus();
|
|
234
|
+
refresh();
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
editor.handleInput(data);
|
|
238
|
+
refresh();
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (keyMatches(data, "tui.editor.cursorLeft")) {
|
|
242
|
+
if (currentIdx > 0)
|
|
243
|
+
setCurrentIdx(currentIdx - 1);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (keyMatches(data, "tui.editor.cursorRight")) {
|
|
247
|
+
if (currentIdx < questions.length - 1)
|
|
248
|
+
setCurrentIdx(currentIdx + 1);
|
|
249
|
+
else if (firstUnanswered(states) === undefined)
|
|
250
|
+
showReview();
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const state = currentState();
|
|
254
|
+
const options = displayOptions(currentQuestion());
|
|
255
|
+
if (keyMatches(data, "tui.select.up")) {
|
|
256
|
+
if (footerFocused) {
|
|
257
|
+
footerFocused = false;
|
|
258
|
+
state.optionIndex = options.length - 1;
|
|
259
|
+
}
|
|
260
|
+
else if (state.optionIndex > 0) {
|
|
261
|
+
state.optionIndex--;
|
|
262
|
+
}
|
|
263
|
+
clearWarning();
|
|
264
|
+
refresh();
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (keyMatches(data, "tui.select.down")) {
|
|
268
|
+
if (footerFocused)
|
|
269
|
+
return;
|
|
270
|
+
if (state.optionIndex < options.length - 1)
|
|
271
|
+
state.optionIndex++;
|
|
272
|
+
else
|
|
273
|
+
footerFocused = true;
|
|
274
|
+
clearWarning();
|
|
275
|
+
refresh();
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (keyMatches(data, "tui.input.tab")) {
|
|
279
|
+
if (!footerFocused)
|
|
280
|
+
beginNotesInput();
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
if (footerFocused) {
|
|
284
|
+
if (keyMatches(data, "tui.select.confirm")) {
|
|
285
|
+
done({ answers: orderedAnswers(questions, states), outcome: "needs_clarification" });
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if (keyMatches(data, "tui.select.cancel")) {
|
|
289
|
+
done({ answers: orderedAnswers(questions, states), outcome: "cancelled" });
|
|
290
|
+
}
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
const question = currentQuestion();
|
|
294
|
+
const option = options[state.optionIndex];
|
|
295
|
+
if (question.multiSelect && keyMatches(data, "app.list.toggle")) {
|
|
296
|
+
if (option?.kind === "other") {
|
|
297
|
+
if (state.customAnswer) {
|
|
298
|
+
state.customAnswer.selected = !state.customAnswer.selected;
|
|
299
|
+
clearWarning();
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
state.warning = `Press ${keyLabel("tui.input.tab", "Tab")} to type a custom answer.`;
|
|
303
|
+
}
|
|
304
|
+
refresh();
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (option?.kind === "option") {
|
|
308
|
+
if (state.multiSelected.has(option.optionIndex))
|
|
309
|
+
state.multiSelected.delete(option.optionIndex);
|
|
310
|
+
else
|
|
311
|
+
state.multiSelected.add(option.optionIndex);
|
|
312
|
+
}
|
|
313
|
+
clearWarning();
|
|
314
|
+
refresh();
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (keyMatches(data, "tui.select.confirm")) {
|
|
318
|
+
if (question.multiSelect)
|
|
319
|
+
recordMulti();
|
|
320
|
+
else if (option)
|
|
321
|
+
recordSingle(option);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (keyMatches(data, "tui.select.cancel")) {
|
|
325
|
+
done({ answers: orderedAnswers(questions, states), outcome: "cancelled" });
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function handleInput(data) {
|
|
329
|
+
if (view === "review")
|
|
330
|
+
handleReviewInput(data);
|
|
331
|
+
else
|
|
332
|
+
handleQuestionInput(data);
|
|
333
|
+
}
|
|
334
|
+
function render(width) {
|
|
335
|
+
return cache.get(width, tui.terminal.rows, compute);
|
|
336
|
+
}
|
|
337
|
+
function renderTabs(renderWidth, lines) {
|
|
338
|
+
if (questions.length < 2)
|
|
339
|
+
return;
|
|
340
|
+
const tabCount = questions.length + 1;
|
|
341
|
+
const headerWidth = Math.max(4, Math.floor((renderWidth - tabCount * 5) / tabCount));
|
|
342
|
+
const tabs = [
|
|
343
|
+
...questions.map((question, index) => {
|
|
344
|
+
const answered = hasAnswer(states[index]);
|
|
345
|
+
const label = ` ${answered ? "■" : "□"} ${truncateToWidth(question.header, headerWidth)} `;
|
|
346
|
+
if (view === "question" && index === currentIdx) {
|
|
347
|
+
return theme.bg("selectedBg", theme.fg(answered ? "success" : "text", label));
|
|
348
|
+
}
|
|
349
|
+
return theme.fg(answered ? "success" : "muted", label);
|
|
350
|
+
}),
|
|
351
|
+
view === "review"
|
|
352
|
+
? theme.bg("selectedBg", theme.fg("text", " ✓ Submit "))
|
|
353
|
+
: theme.fg(firstUnanswered(states) === undefined ? "success" : "dim", " ✓ Submit "),
|
|
354
|
+
].join(" ");
|
|
355
|
+
wrapWithPrefix(" ", tabs, renderWidth, lines);
|
|
356
|
+
lines.push("");
|
|
357
|
+
}
|
|
358
|
+
function previewLines(previewText, width, terminalRows) {
|
|
359
|
+
const markdown = new Markdown(previewText, 1, 0, getMarkdownTheme());
|
|
360
|
+
const rendered = markdown.render(Math.max(1, width));
|
|
361
|
+
const maxLines = Math.max(4, Math.min(PREVIEW_MAX_LINES, terminalRows - PREVIEW_CHROME_ROWS));
|
|
362
|
+
if (rendered.length <= maxLines)
|
|
363
|
+
return rendered;
|
|
364
|
+
return [
|
|
365
|
+
...rendered.slice(0, maxLines),
|
|
366
|
+
theme.fg("dim", truncateToWidth(`… ${rendered.length - maxLines} preview lines hidden`, Math.max(1, width))),
|
|
367
|
+
];
|
|
368
|
+
}
|
|
369
|
+
function renderReview(renderWidth, lines) {
|
|
370
|
+
wrapWithPrefix(" ", theme.fg("accent", "Review answers"), renderWidth, lines);
|
|
371
|
+
lines.push("");
|
|
372
|
+
for (const answer of orderedAnswers(questions, states)) {
|
|
373
|
+
wrapWithPrefix(" ", theme.fg("text", `${answer.questionIndex + 1}. ${answer.question}`), renderWidth, lines);
|
|
374
|
+
const response = answer.kind === "multi"
|
|
375
|
+
? (answer.selected?.join(", ") ?? "(no input)")
|
|
376
|
+
: (answer.answer ?? "(no input)");
|
|
377
|
+
wrapWithPrefix(" ", theme.fg("success", response), renderWidth, lines);
|
|
378
|
+
for (const note of answer.notes ?? []) {
|
|
379
|
+
wrapWithPrefix(" ", theme.fg("muted", `Note for ${note.option}: ${note.text}`), renderWidth, lines);
|
|
380
|
+
}
|
|
381
|
+
lines.push("");
|
|
382
|
+
}
|
|
383
|
+
wrapWithPrefix(" ", theme.fg("dim", `${keyLabel("tui.select.confirm", "Enter")} to submit • ${keyLabel("tui.select.cancel", "Esc")} to edit the last question`), renderWidth, lines);
|
|
384
|
+
}
|
|
385
|
+
function compute(width, terminalRows) {
|
|
386
|
+
const lines = [];
|
|
387
|
+
const renderWidth = Math.max(1, width);
|
|
388
|
+
lines.push(ruleBorder(theme, renderWidth));
|
|
389
|
+
renderTabs(renderWidth, lines);
|
|
390
|
+
if (view === "review") {
|
|
391
|
+
renderReview(renderWidth, lines);
|
|
392
|
+
lines.push(ruleBorder(theme, renderWidth));
|
|
393
|
+
return lines;
|
|
394
|
+
}
|
|
395
|
+
const question = currentQuestion();
|
|
396
|
+
const state = currentState();
|
|
397
|
+
const options = displayOptions(question);
|
|
398
|
+
const isMulti = question.multiSelect === true;
|
|
399
|
+
wrapWithPrefix(" ", `${theme.fg("accent", question.header)} ${theme.fg("text", question.question)}`, renderWidth, lines);
|
|
400
|
+
lines.push("");
|
|
401
|
+
const optionLines = [];
|
|
402
|
+
const hasPreview = !isMulti && options.some((option) => option.kind === "option" && option.preview);
|
|
403
|
+
const showPreviewSideBySide = hasPreview && renderWidth >= 60;
|
|
404
|
+
const listWidth = showPreviewSideBySide ? Math.max(20, Math.floor(renderWidth * 0.4)) : renderWidth;
|
|
405
|
+
for (let index = 0; index < options.length; index++) {
|
|
406
|
+
const option = options[index];
|
|
407
|
+
const focused = !footerFocused && index === state.optionIndex;
|
|
408
|
+
const checked = isMulti &&
|
|
409
|
+
((option.kind === "option" && state.multiSelected.has(option.optionIndex)) ||
|
|
410
|
+
(option.kind === "other" && state.customAnswer?.selected === true));
|
|
411
|
+
const selectedSingle = !isMulti &&
|
|
412
|
+
(option.kind === "other"
|
|
413
|
+
? state.singleAnswer?.kind === "custom"
|
|
414
|
+
: state.singleAnswer?.answer === option.label);
|
|
415
|
+
const marker = isMulti
|
|
416
|
+
? option.kind === "other"
|
|
417
|
+
? state.customAnswer
|
|
418
|
+
? checked
|
|
419
|
+
? theme.fg("success", "[x]")
|
|
420
|
+
: theme.fg("dim", "[ ]")
|
|
421
|
+
: " "
|
|
422
|
+
: checked
|
|
423
|
+
? theme.fg("success", "[x]")
|
|
424
|
+
: theme.fg("dim", "[ ]")
|
|
425
|
+
: "";
|
|
426
|
+
const focusArrow = focused ? theme.fg("accent", "→") : " ";
|
|
427
|
+
const note = option.kind === "option" && state.notesByOption.has(option.label) ? theme.fg("success", " +note") : "";
|
|
428
|
+
const customText = option.kind === "other"
|
|
429
|
+
? (state.customAnswer?.text ??
|
|
430
|
+
(state.singleAnswer?.kind === "custom" ? state.singleAnswer.answer : undefined))
|
|
431
|
+
: undefined;
|
|
432
|
+
const labelText = customText ? `${option.label} ✎ ${customText}` : option.label;
|
|
433
|
+
const label = `${index + 1}. ${labelText}${selectedSingle ? " ✓" : ""}${note}`;
|
|
434
|
+
const color = focused ? "accent" : selectedSingle || checked ? "success" : "text";
|
|
435
|
+
wrapWithPrefix(`${focusArrow} ${marker} `, theme.fg(color, label), listWidth, optionLines);
|
|
436
|
+
if (option.kind === "option" && option.description) {
|
|
437
|
+
wrapWithPrefix(" ", theme.fg("muted", option.description), listWidth, optionLines);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
if (inputMode) {
|
|
441
|
+
optionLines.push("");
|
|
442
|
+
const label = inputMode === "notes" ? `Notes for ${noteTarget ?? "option"}:` : "Your answer:";
|
|
443
|
+
wrapWithPrefix(" ", theme.fg("muted", label), listWidth, optionLines);
|
|
444
|
+
for (const line of editor.render(Math.max(1, listWidth - 2)))
|
|
445
|
+
optionLines.push(` ${line}`);
|
|
446
|
+
}
|
|
447
|
+
if (showPreviewSideBySide) {
|
|
448
|
+
const gap = 2;
|
|
449
|
+
const rightWidth = renderWidth - listWidth - gap;
|
|
450
|
+
const focused = options[state.optionIndex];
|
|
451
|
+
const previewText = focused?.kind === "option" && focused.preview ? focused.preview : "";
|
|
452
|
+
const rightLines = previewText
|
|
453
|
+
? previewLines(previewText, rightWidth, terminalRows)
|
|
454
|
+
: [theme.fg("dim", "(no preview)")];
|
|
455
|
+
const maxRows = Math.max(optionLines.length, rightLines.length);
|
|
456
|
+
const pad = " ".repeat(gap);
|
|
457
|
+
for (let row = 0; row < maxRows; row++) {
|
|
458
|
+
const left = row < optionLines.length ? optionLines[row] : "";
|
|
459
|
+
const leftPadded = left + " ".repeat(Math.max(0, listWidth - visibleWidth(left)));
|
|
460
|
+
const right = row < rightLines.length ? rightLines[row] : "";
|
|
461
|
+
lines.push(`${leftPadded}${pad}${right}`);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
lines.push(...optionLines);
|
|
466
|
+
if (hasPreview) {
|
|
467
|
+
const focused = options[state.optionIndex];
|
|
468
|
+
const previewText = focused?.kind === "option" && focused.preview ? focused.preview : "";
|
|
469
|
+
if (previewText) {
|
|
470
|
+
lines.push("");
|
|
471
|
+
lines.push(ruleBorder(theme, renderWidth, "dim"));
|
|
472
|
+
lines.push(...previewLines(previewText, renderWidth, terminalRows));
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
lines.push("");
|
|
477
|
+
const chatPrefix = footerFocused ? theme.fg("accent", "→") : " ";
|
|
478
|
+
wrapWithPrefix(`${chatPrefix} `, theme.fg(footerFocused ? "accent" : "text", "Chat about this"), renderWidth, lines);
|
|
479
|
+
if (state.warning) {
|
|
480
|
+
lines.push("");
|
|
481
|
+
wrapWithPrefix(" ", theme.fg("warning", state.warning), renderWidth, lines);
|
|
482
|
+
}
|
|
483
|
+
lines.push("");
|
|
484
|
+
if (inputMode === "notes") {
|
|
485
|
+
wrapWithPrefix(" ", theme.fg("dim", `${keyLabel("tui.select.confirm", "Enter")} to save notes • ${keyLabel("tui.select.cancel", "Esc")} to go back`), renderWidth, lines);
|
|
486
|
+
}
|
|
487
|
+
else if (inputMode === "custom") {
|
|
488
|
+
const hint = isMulti ? "to save custom answer" : "to continue";
|
|
489
|
+
wrapWithPrefix(" ", theme.fg("dim", `${keyLabel("tui.select.confirm", "Enter")} ${hint} • ${keyLabel("tui.select.cancel", "Esc")} to go back`), renderWidth, lines);
|
|
490
|
+
}
|
|
491
|
+
else if (footerFocused) {
|
|
492
|
+
wrapWithPrefix(" ", theme.fg("dim", `${keyLabel("tui.select.confirm", "Enter")} to discuss • ${keyLabel("tui.select.up", "Up")} to return to options`), renderWidth, lines);
|
|
493
|
+
}
|
|
494
|
+
else if (isMulti) {
|
|
495
|
+
wrapWithPrefix(" ", theme.fg("dim", `${keyLabel("app.list.toggle", "Space")} to toggle • ${keyLabel("tui.input.tab", "Tab")} for notes/custom • ${keyLabel("tui.select.confirm", "Enter")} to continue • ${keyLabel("tui.editor.cursorLeft", "Left")}/${keyLabel("tui.editor.cursorRight", "Right")} questions • ${keyLabel("tui.select.cancel", "Esc")} to cancel`), renderWidth, lines);
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
wrapWithPrefix(" ", theme.fg("dim", `${keyLabel("tui.input.tab", "Tab")} for notes/custom • ${keyLabel("tui.select.confirm", "Enter")} to select • ${keyLabel("tui.editor.cursorLeft", "Left")}/${keyLabel("tui.editor.cursorRight", "Right")} questions • ${keyLabel("tui.select.cancel", "Esc")} to cancel`), renderWidth, lines);
|
|
499
|
+
}
|
|
500
|
+
lines.push(ruleBorder(theme, renderWidth));
|
|
501
|
+
return lines;
|
|
502
|
+
}
|
|
503
|
+
return {
|
|
504
|
+
get focused() {
|
|
505
|
+
return dialogFocused;
|
|
506
|
+
},
|
|
507
|
+
set focused(value) {
|
|
508
|
+
dialogFocused = value;
|
|
509
|
+
syncEditorFocus();
|
|
510
|
+
},
|
|
511
|
+
render,
|
|
512
|
+
invalidate: () => {
|
|
513
|
+
cache.invalidate();
|
|
514
|
+
},
|
|
515
|
+
handleInput,
|
|
516
|
+
};
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
//# sourceMappingURL=dialog.js.map
|