@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,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* snapshot.ts — persisted data shapes for the rewind extension's file-history
|
|
3
|
+
* engine. Pure types + tiny helpers; no Pi imports, no side effects, so the
|
|
4
|
+
* engine and its selftests can import them under plain node.
|
|
5
|
+
*
|
|
6
|
+
* A FileHistorySnapshot is written to the session JSONL (via the integration
|
|
7
|
+
* layer's appendEntry, custom type "pi-rewind-snapshot"). It is never sent to
|
|
8
|
+
* the LLM and survives reload/compaction. Each snapshot anchors to one turn and
|
|
9
|
+
* records, for every tracked file, which backup blob holds that file's contents
|
|
10
|
+
* as of the start of the turn.
|
|
11
|
+
*/
|
|
12
|
+
/** Custom session-entry type used to persist snapshots to the session JSONL. */
|
|
13
|
+
export declare const SNAPSHOT_ENTRY_TYPE = "pi-rewind-snapshot";
|
|
14
|
+
/**
|
|
15
|
+
* One file's backup at a specific version.
|
|
16
|
+
* `backupName === null` means the file did not exist at this version — rewinding
|
|
17
|
+
* to a snapshot carrying a null backup deletes the file.
|
|
18
|
+
*/
|
|
19
|
+
export interface FileBackup {
|
|
20
|
+
/** Backup blob filename (`<sha256(relpath)[:16]>@v<n>`), or null if the file did not exist. */
|
|
21
|
+
backupName: string | null;
|
|
22
|
+
/** Monotonic version for this file within the session (1-based). */
|
|
23
|
+
version: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* One turn's snapshot. `v` lets future readers migrate old entries.
|
|
27
|
+
* `trackedFileBackups` is keyed by the file's path *relative to cwd* when inside
|
|
28
|
+
* cwd (else the absolute path), matching the engine's path shortening.
|
|
29
|
+
*/
|
|
30
|
+
export interface FileHistorySnapshot {
|
|
31
|
+
v: 1;
|
|
32
|
+
/** Session entry id this snapshot anchors to (used to match /tree navigation). */
|
|
33
|
+
userEntryId: string;
|
|
34
|
+
/** Leaf/turn id when finalized (informational). */
|
|
35
|
+
turnId: string;
|
|
36
|
+
/** The user prompt that drove the turn (truncated; shown in the /tree sync prompt). */
|
|
37
|
+
prompt: string;
|
|
38
|
+
/** Map of tracking-path → the backup recorded for that file at the start of this turn. */
|
|
39
|
+
trackedFileBackups: Record<string, FileBackup>;
|
|
40
|
+
/** ISO timestamp the snapshot was finalized. */
|
|
41
|
+
timestamp: string;
|
|
42
|
+
}
|
|
43
|
+
/** Narrow an arbitrary session-entry payload to a FileHistorySnapshot. */
|
|
44
|
+
export declare function isSnapshot(data: unknown): data is FileHistorySnapshot;
|
|
45
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../src/extensions/rewind/snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,UAAU;IAC1B,+FAA+F;IAC/F,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC,CAAC,EAAE,CAAC,CAAC;IACL,kFAAkF;IAClF,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,uFAAuF;IACvF,MAAM,EAAE,MAAM,CAAC;IACf,4FAA0F;IAC1F,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC/C,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,mBAAmB,CAMrE","sourcesContent":["/**\n * snapshot.ts — persisted data shapes for the rewind extension's file-history\n * engine. Pure types + tiny helpers; no Pi imports, no side effects, so the\n * engine and its selftests can import them under plain node.\n *\n * A FileHistorySnapshot is written to the session JSONL (via the integration\n * layer's appendEntry, custom type \"pi-rewind-snapshot\"). It is never sent to\n * the LLM and survives reload/compaction. Each snapshot anchors to one turn and\n * records, for every tracked file, which backup blob holds that file's contents\n * as of the start of the turn.\n */\n\n/** Custom session-entry type used to persist snapshots to the session JSONL. */\nexport const SNAPSHOT_ENTRY_TYPE = \"pi-rewind-snapshot\";\n\n/**\n * One file's backup at a specific version.\n * `backupName === null` means the file did not exist at this version — rewinding\n * to a snapshot carrying a null backup deletes the file.\n */\nexport interface FileBackup {\n\t/** Backup blob filename (`<sha256(relpath)[:16]>@v<n>`), or null if the file did not exist. */\n\tbackupName: string | null;\n\t/** Monotonic version for this file within the session (1-based). */\n\tversion: number;\n}\n\n/**\n * One turn's snapshot. `v` lets future readers migrate old entries.\n * `trackedFileBackups` is keyed by the file's path *relative to cwd* when inside\n * cwd (else the absolute path), matching the engine's path shortening.\n */\nexport interface FileHistorySnapshot {\n\tv: 1;\n\t/** Session entry id this snapshot anchors to (used to match /tree navigation). */\n\tuserEntryId: string;\n\t/** Leaf/turn id when finalized (informational). */\n\tturnId: string;\n\t/** The user prompt that drove the turn (truncated; shown in the /tree sync prompt). */\n\tprompt: string;\n\t/** Map of tracking-path → the backup recorded for that file at the start of this turn. */\n\ttrackedFileBackups: Record<string, FileBackup>;\n\t/** ISO timestamp the snapshot was finalized. */\n\ttimestamp: string;\n}\n\n/** Narrow an arbitrary session-entry payload to a FileHistorySnapshot. */\nexport function isSnapshot(data: unknown): data is FileHistorySnapshot {\n\tif (!data || typeof data !== \"object\") return false;\n\tconst s = data as Partial<FileHistorySnapshot>;\n\treturn (\n\t\ttypeof s.userEntryId === \"string\" && typeof s.trackedFileBackups === \"object\" && s.trackedFileBackups !== null\n\t);\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* snapshot.ts — persisted data shapes for the rewind extension's file-history
|
|
3
|
+
* engine. Pure types + tiny helpers; no Pi imports, no side effects, so the
|
|
4
|
+
* engine and its selftests can import them under plain node.
|
|
5
|
+
*
|
|
6
|
+
* A FileHistorySnapshot is written to the session JSONL (via the integration
|
|
7
|
+
* layer's appendEntry, custom type "pi-rewind-snapshot"). It is never sent to
|
|
8
|
+
* the LLM and survives reload/compaction. Each snapshot anchors to one turn and
|
|
9
|
+
* records, for every tracked file, which backup blob holds that file's contents
|
|
10
|
+
* as of the start of the turn.
|
|
11
|
+
*/
|
|
12
|
+
/** Custom session-entry type used to persist snapshots to the session JSONL. */
|
|
13
|
+
export const SNAPSHOT_ENTRY_TYPE = "pi-rewind-snapshot";
|
|
14
|
+
/** Narrow an arbitrary session-entry payload to a FileHistorySnapshot. */
|
|
15
|
+
export function isSnapshot(data) {
|
|
16
|
+
if (!data || typeof data !== "object")
|
|
17
|
+
return false;
|
|
18
|
+
const s = data;
|
|
19
|
+
return (typeof s.userEntryId === "string" && typeof s.trackedFileBackups === "object" && s.trackedFileBackups !== null);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../src/extensions/rewind/snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,gFAAgF;AAChF,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAiCxD,0EAA0E;AAC1E,MAAM,UAAU,UAAU,CAAC,IAAa,EAA+B;IACtE,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACpD,MAAM,CAAC,GAAG,IAAoC,CAAC;IAC/C,OAAO,CACN,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,kBAAkB,KAAK,QAAQ,IAAI,CAAC,CAAC,kBAAkB,KAAK,IAAI,CAC9G,CAAC;AAAA,CACF","sourcesContent":["/**\n * snapshot.ts — persisted data shapes for the rewind extension's file-history\n * engine. Pure types + tiny helpers; no Pi imports, no side effects, so the\n * engine and its selftests can import them under plain node.\n *\n * A FileHistorySnapshot is written to the session JSONL (via the integration\n * layer's appendEntry, custom type \"pi-rewind-snapshot\"). It is never sent to\n * the LLM and survives reload/compaction. Each snapshot anchors to one turn and\n * records, for every tracked file, which backup blob holds that file's contents\n * as of the start of the turn.\n */\n\n/** Custom session-entry type used to persist snapshots to the session JSONL. */\nexport const SNAPSHOT_ENTRY_TYPE = \"pi-rewind-snapshot\";\n\n/**\n * One file's backup at a specific version.\n * `backupName === null` means the file did not exist at this version — rewinding\n * to a snapshot carrying a null backup deletes the file.\n */\nexport interface FileBackup {\n\t/** Backup blob filename (`<sha256(relpath)[:16]>@v<n>`), or null if the file did not exist. */\n\tbackupName: string | null;\n\t/** Monotonic version for this file within the session (1-based). */\n\tversion: number;\n}\n\n/**\n * One turn's snapshot. `v` lets future readers migrate old entries.\n * `trackedFileBackups` is keyed by the file's path *relative to cwd* when inside\n * cwd (else the absolute path), matching the engine's path shortening.\n */\nexport interface FileHistorySnapshot {\n\tv: 1;\n\t/** Session entry id this snapshot anchors to (used to match /tree navigation). */\n\tuserEntryId: string;\n\t/** Leaf/turn id when finalized (informational). */\n\tturnId: string;\n\t/** The user prompt that drove the turn (truncated; shown in the /tree sync prompt). */\n\tprompt: string;\n\t/** Map of tracking-path → the backup recorded for that file at the start of this turn. */\n\ttrackedFileBackups: Record<string, FileBackup>;\n\t/** ISO timestamp the snapshot was finalized. */\n\ttimestamp: string;\n}\n\n/** Narrow an arbitrary session-entry payload to a FileHistorySnapshot. */\nexport function isSnapshot(data: unknown): data is FileHistorySnapshot {\n\tif (!data || typeof data !== \"object\") return false;\n\tconst s = data as Partial<FileHistorySnapshot>;\n\treturn (\n\t\ttypeof s.userEntryId === \"string\" && typeof s.trackedFileBackups === \"object\" && s.trackedFileBackups !== null\n\t);\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Bind the on-disk roots. Called once by index.ts (or by selftests). */
|
|
2
|
+
export declare function configureStorage(opts: {
|
|
3
|
+
backupsRoot: string;
|
|
4
|
+
sessionsRoot: string;
|
|
5
|
+
}): void;
|
|
6
|
+
/** Root holding every session's backup directory. */
|
|
7
|
+
export declare function backupsRootDir(): string;
|
|
8
|
+
/** A single session's backup directory. */
|
|
9
|
+
export declare function backupsDir(sessionId: string): string;
|
|
10
|
+
/** Root holding Pi's session JSONL files (for orphan detection). */
|
|
11
|
+
export declare function sessionsRootDir(): string;
|
|
12
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/extensions/rewind/storage.ts"],"names":[],"mappings":"AAiBA,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAG1F;AAED,qDAAqD;AACrD,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,2CAA2C;AAC3C,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,oEAAoE;AACpE,wBAAgB,eAAe,IAAI,MAAM,CAExC","sourcesContent":["/**\n * storage.ts — injected storage roots for the rewind engine.\n *\n * engine.ts and gc.ts must stay loadable under plain node (for offline\n * selftests), so they cannot statically import paths.ts (which imports\n * getAgentDir from @astralyn/pi — unresolvable outside Pi).\n * Instead they read the roots from here, and the integration layer (index.ts)\n * calls configureStorage() with the real paths at startup. Selftests call it with\n * temp directories.\n *\n * No Pi imports in this module.\n */\nimport { join } from \"node:path\";\n\nlet backupsRoot = \"\";\nlet sessionsRoot = \"\";\n\n/** Bind the on-disk roots. Called once by index.ts (or by selftests). */\nexport function configureStorage(opts: { backupsRoot: string; sessionsRoot: string }): void {\n\tbackupsRoot = opts.backupsRoot;\n\tsessionsRoot = opts.sessionsRoot;\n}\n\n/** Root holding every session's backup directory. */\nexport function backupsRootDir(): string {\n\treturn backupsRoot;\n}\n\n/** A single session's backup directory. */\nexport function backupsDir(sessionId: string): string {\n\treturn join(backupsRoot, sessionId);\n}\n\n/** Root holding Pi's session JSONL files (for orphan detection). */\nexport function sessionsRootDir(): string {\n\treturn sessionsRoot;\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* storage.ts — injected storage roots for the rewind engine.
|
|
3
|
+
*
|
|
4
|
+
* engine.ts and gc.ts must stay loadable under plain node (for offline
|
|
5
|
+
* selftests), so they cannot statically import paths.ts (which imports
|
|
6
|
+
* getAgentDir from @astralyn/pi — unresolvable outside Pi).
|
|
7
|
+
* Instead they read the roots from here, and the integration layer (index.ts)
|
|
8
|
+
* calls configureStorage() with the real paths at startup. Selftests call it with
|
|
9
|
+
* temp directories.
|
|
10
|
+
*
|
|
11
|
+
* No Pi imports in this module.
|
|
12
|
+
*/
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
let backupsRoot = "";
|
|
15
|
+
let sessionsRoot = "";
|
|
16
|
+
/** Bind the on-disk roots. Called once by index.ts (or by selftests). */
|
|
17
|
+
export function configureStorage(opts) {
|
|
18
|
+
backupsRoot = opts.backupsRoot;
|
|
19
|
+
sessionsRoot = opts.sessionsRoot;
|
|
20
|
+
}
|
|
21
|
+
/** Root holding every session's backup directory. */
|
|
22
|
+
export function backupsRootDir() {
|
|
23
|
+
return backupsRoot;
|
|
24
|
+
}
|
|
25
|
+
/** A single session's backup directory. */
|
|
26
|
+
export function backupsDir(sessionId) {
|
|
27
|
+
return join(backupsRoot, sessionId);
|
|
28
|
+
}
|
|
29
|
+
/** Root holding Pi's session JSONL files (for orphan detection). */
|
|
30
|
+
export function sessionsRootDir() {
|
|
31
|
+
return sessionsRoot;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/extensions/rewind/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,IAAI,WAAW,GAAG,EAAE,CAAC;AACrB,IAAI,YAAY,GAAG,EAAE,CAAC;AAEtB,yEAAyE;AACzE,MAAM,UAAU,gBAAgB,CAAC,IAAmD,EAAQ;IAC3F,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IAC/B,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;AAAA,CACjC;AAED,qDAAqD;AACrD,MAAM,UAAU,cAAc,GAAW;IACxC,OAAO,WAAW,CAAC;AAAA,CACnB;AAED,2CAA2C;AAC3C,MAAM,UAAU,UAAU,CAAC,SAAiB,EAAU;IACrD,OAAO,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAAA,CACpC;AAED,oEAAoE;AACpE,MAAM,UAAU,eAAe,GAAW;IACzC,OAAO,YAAY,CAAC;AAAA,CACpB","sourcesContent":["/**\n * storage.ts — injected storage roots for the rewind engine.\n *\n * engine.ts and gc.ts must stay loadable under plain node (for offline\n * selftests), so they cannot statically import paths.ts (which imports\n * getAgentDir from @astralyn/pi — unresolvable outside Pi).\n * Instead they read the roots from here, and the integration layer (index.ts)\n * calls configureStorage() with the real paths at startup. Selftests call it with\n * temp directories.\n *\n * No Pi imports in this module.\n */\nimport { join } from \"node:path\";\n\nlet backupsRoot = \"\";\nlet sessionsRoot = \"\";\n\n/** Bind the on-disk roots. Called once by index.ts (or by selftests). */\nexport function configureStorage(opts: { backupsRoot: string; sessionsRoot: string }): void {\n\tbackupsRoot = opts.backupsRoot;\n\tsessionsRoot = opts.sessionsRoot;\n}\n\n/** Root holding every session's backup directory. */\nexport function backupsRootDir(): string {\n\treturn backupsRoot;\n}\n\n/** A single session's backup directory. */\nexport function backupsDir(sessionId: string): string {\n\treturn join(backupsRoot, sessionId);\n}\n\n/** Root holding Pi's session JSONL files (for orphan detection). */\nexport function sessionsRootDir(): string {\n\treturn sessionsRoot;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface TruncateTextOptions {
|
|
2
|
+
ellipsis?: string;
|
|
3
|
+
collapseWhitespace?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function truncateText(text: string, maxLength: number, options?: TruncateTextOptions): string;
|
|
6
|
+
export declare function formatSize(bytes: number): string;
|
|
7
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/extensions/rewind/text.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAMvG;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKhD","sourcesContent":["export interface TruncateTextOptions {\n\tellipsis?: string;\n\tcollapseWhitespace?: boolean;\n}\n\nexport function truncateText(text: string, maxLength: number, options: TruncateTextOptions = {}): string {\n\tconst ellipsis = options.ellipsis ?? \"...\";\n\tconst source = options.collapseWhitespace ? text.replace(/\\s+/g, \" \").trim() : text;\n\tif (source.length <= maxLength) return source;\n\tif (ellipsis.length >= maxLength) return ellipsis.slice(0, maxLength);\n\treturn `${source.slice(0, maxLength - ellipsis.length)}${ellipsis}`;\n}\n\nexport function formatSize(bytes: number): string {\n\tif (bytes < 1024) return `${bytes}B`;\n\tif (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;\n\tif (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;\n\treturn `${(bytes / (1024 * 1024 * 1024)).toFixed(2)}GB`;\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function truncateText(text, maxLength, options = {}) {
|
|
2
|
+
const ellipsis = options.ellipsis ?? "...";
|
|
3
|
+
const source = options.collapseWhitespace ? text.replace(/\s+/g, " ").trim() : text;
|
|
4
|
+
if (source.length <= maxLength)
|
|
5
|
+
return source;
|
|
6
|
+
if (ellipsis.length >= maxLength)
|
|
7
|
+
return ellipsis.slice(0, maxLength);
|
|
8
|
+
return `${source.slice(0, maxLength - ellipsis.length)}${ellipsis}`;
|
|
9
|
+
}
|
|
10
|
+
export function formatSize(bytes) {
|
|
11
|
+
if (bytes < 1024)
|
|
12
|
+
return `${bytes}B`;
|
|
13
|
+
if (bytes < 1024 * 1024)
|
|
14
|
+
return `${(bytes / 1024).toFixed(1)}KB`;
|
|
15
|
+
if (bytes < 1024 * 1024 * 1024)
|
|
16
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
|
17
|
+
return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)}GB`;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/extensions/rewind/text.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,SAAiB,EAAE,OAAO,GAAwB,EAAE,EAAU;IACxG,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC;IAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACpF,IAAI,MAAM,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,MAAM,CAAC;IAC9C,IAAI,QAAQ,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IACtE,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,EAAE,CAAC;AAAA,CACpE;AAED,MAAM,UAAU,UAAU,CAAC,KAAa,EAAU;IACjD,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,GAAG,CAAC;IACrC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IACjE,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IACjF,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAAA,CACxD","sourcesContent":["export interface TruncateTextOptions {\n\tellipsis?: string;\n\tcollapseWhitespace?: boolean;\n}\n\nexport function truncateText(text: string, maxLength: number, options: TruncateTextOptions = {}): string {\n\tconst ellipsis = options.ellipsis ?? \"...\";\n\tconst source = options.collapseWhitespace ? text.replace(/\\s+/g, \" \").trim() : text;\n\tif (source.length <= maxLength) return source;\n\tif (ellipsis.length >= maxLength) return ellipsis.slice(0, maxLength);\n\treturn `${source.slice(0, maxLength - ellipsis.length)}${ellipsis}`;\n}\n\nexport function formatSize(bytes: number): string {\n\tif (bytes < 1024) return `${bytes}B`;\n\tif (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;\n\tif (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;\n\treturn `${(bytes / (1024 * 1024 * 1024)).toFixed(2)}GB`;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-path.d.ts","sourceRoot":"","sources":["../../../src/extensions/rewind/tool-path.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGtE;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpE","sourcesContent":["import path from \"node:path\";\n\nexport function editWriteTargetPath(input: unknown): string | undefined {\n\tconst rawPath = (input as { path?: unknown } | undefined)?.path;\n\treturn typeof rawPath === \"string\" && rawPath.length > 0 ? rawPath : undefined;\n}\n\nexport function resolveToolPath(rawPath: string, cwd: string): string {\n\treturn path.isAbsolute(rawPath) ? rawPath : path.resolve(cwd, rawPath);\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
export function editWriteTargetPath(input) {
|
|
3
|
+
const rawPath = input?.path;
|
|
4
|
+
return typeof rawPath === "string" && rawPath.length > 0 ? rawPath : undefined;
|
|
5
|
+
}
|
|
6
|
+
export function resolveToolPath(rawPath, cwd) {
|
|
7
|
+
return path.isAbsolute(rawPath) ? rawPath : path.resolve(cwd, rawPath);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=tool-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-path.js","sourceRoot":"","sources":["../../../src/extensions/rewind/tool-path.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,mBAAmB,CAAC,KAAc,EAAsB;IACvE,MAAM,OAAO,GAAI,KAAwC,EAAE,IAAI,CAAC;IAChE,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAAA,CAC/E;AAED,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,GAAW,EAAU;IACrE,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAAA,CACvE","sourcesContent":["import path from \"node:path\";\n\nexport function editWriteTargetPath(input: unknown): string | undefined {\n\tconst rawPath = (input as { path?: unknown } | undefined)?.path;\n\treturn typeof rawPath === \"string\" && rawPath.length > 0 ? rawPath : undefined;\n}\n\nexport function resolveToolPath(rawPath: string, cwd: string): string {\n\treturn path.isAbsolute(rawPath) ? rawPath : path.resolve(cwd, rawPath);\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const COMMAND_NAME = "router";
|
|
2
|
+
export declare const COMMAND_DESCRIPTION = "Manage Codex-style API relays";
|
|
3
|
+
/** Custom api tag; routes to our streamSimple, not Pi built-in handlers. */
|
|
4
|
+
export declare const ROUTER_API: "router-codex";
|
|
5
|
+
export declare const CONFIG_VERSION: 1;
|
|
6
|
+
export declare const DEFAULTS: {
|
|
7
|
+
readonly contextWindow: 272000;
|
|
8
|
+
readonly maxTokens: 128000;
|
|
9
|
+
readonly probeTimeoutMs: 10000;
|
|
10
|
+
readonly probeBodyBytes: number;
|
|
11
|
+
readonly probeMaxModels: 2000;
|
|
12
|
+
readonly originator: "codex";
|
|
13
|
+
};
|
|
14
|
+
export declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
15
|
+
export type ThinkingLevel = (typeof THINKING_LEVELS)[number];
|
|
16
|
+
export declare const NO_UI_WARNING = "/router requires an interactive UI.";
|
|
17
|
+
export declare function isValidRelayId(id: string): boolean;
|
|
18
|
+
export declare function truncate(value: string, maxLength: number): string;
|
|
19
|
+
export declare function formatError(error: unknown): string;
|
|
20
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/extensions/router/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,WAAW,CAAC;AACrC,eAAO,MAAM,mBAAmB,kCAAkC,CAAC;AAEnE,4EAA4E;AAC5E,eAAO,MAAM,UAAU,gBAA0B,CAAC;AAElD,eAAO,MAAM,cAAc,GAAa,CAAC;AAEzC,eAAO,MAAM,QAAQ;;;;;;;CAOX,CAAC;AAEX,eAAO,MAAM,eAAe,sEAAuE,CAAC;AACpG,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,aAAa,wCAAwC,CAAC;AAEnE,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGjE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAElD","sourcesContent":["export const COMMAND_NAME = \"router\";\nexport const COMMAND_DESCRIPTION = \"Manage Codex-style API relays\";\n\n/** Custom api tag; routes to our streamSimple, not Pi built-in handlers. */\nexport const ROUTER_API = \"router-codex\" as const;\n\nexport const CONFIG_VERSION = 1 as const;\n\nexport const DEFAULTS = {\n\tcontextWindow: 272_000,\n\tmaxTokens: 128_000,\n\tprobeTimeoutMs: 10_000,\n\tprobeBodyBytes: 4 * 1024 * 1024,\n\tprobeMaxModels: 2_000,\n\toriginator: \"codex\",\n} as const;\n\nexport const THINKING_LEVELS = [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const;\nexport type ThinkingLevel = (typeof THINKING_LEVELS)[number];\n\nexport const NO_UI_WARNING = \"/router requires an interactive UI.\";\n\nexport function isValidRelayId(id: string): boolean {\n\treturn Boolean(id) && !id.includes(\"/\") && !/[\\u0000-\\u001f\\u007f]/.test(id);\n}\n\nexport function truncate(value: string, maxLength: number): string {\n\tif (value.length <= maxLength) return value;\n\treturn `${value.slice(0, Math.max(0, maxLength - 1))}…`;\n}\n\nexport function formatError(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const COMMAND_NAME = "router";
|
|
2
|
+
export const COMMAND_DESCRIPTION = "Manage Codex-style API relays";
|
|
3
|
+
/** Custom api tag; routes to our streamSimple, not Pi built-in handlers. */
|
|
4
|
+
export const ROUTER_API = "router-codex";
|
|
5
|
+
export const CONFIG_VERSION = 1;
|
|
6
|
+
export const DEFAULTS = {
|
|
7
|
+
contextWindow: 272_000,
|
|
8
|
+
maxTokens: 128_000,
|
|
9
|
+
probeTimeoutMs: 10_000,
|
|
10
|
+
probeBodyBytes: 4 * 1024 * 1024,
|
|
11
|
+
probeMaxModels: 2_000,
|
|
12
|
+
originator: "codex",
|
|
13
|
+
};
|
|
14
|
+
export const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
15
|
+
export const NO_UI_WARNING = "/router requires an interactive UI.";
|
|
16
|
+
export function isValidRelayId(id) {
|
|
17
|
+
return Boolean(id) && !id.includes("/") && !/[\u0000-\u001f\u007f]/.test(id);
|
|
18
|
+
}
|
|
19
|
+
export function truncate(value, maxLength) {
|
|
20
|
+
if (value.length <= maxLength)
|
|
21
|
+
return value;
|
|
22
|
+
return `${value.slice(0, Math.max(0, maxLength - 1))}…`;
|
|
23
|
+
}
|
|
24
|
+
export function formatError(error) {
|
|
25
|
+
return error instanceof Error ? error.message : String(error);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/extensions/router/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AACrC,MAAM,CAAC,MAAM,mBAAmB,GAAG,+BAA+B,CAAC;AAEnE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,UAAU,GAAG,cAAuB,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB,aAAa,EAAE,OAAO;IACtB,SAAS,EAAE,OAAO;IAClB,cAAc,EAAE,MAAM;IACtB,cAAc,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;IAC/B,cAAc,EAAE,KAAK;IACrB,UAAU,EAAE,OAAO;CACV,CAAC;AAEX,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAGpG,MAAM,CAAC,MAAM,aAAa,GAAG,qCAAqC,CAAC;AAEnE,MAAM,UAAU,cAAc,CAAC,EAAU,EAAW;IACnD,OAAO,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAAA,CAC7E;AAED,MAAM,UAAU,QAAQ,CAAC,KAAa,EAAE,SAAiB,EAAU;IAClE,IAAI,KAAK,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC,KAAG,CAAC;AAAA,CACxD;AAED,MAAM,UAAU,WAAW,CAAC,KAAc,EAAU;IACnD,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAAA,CAC9D","sourcesContent":["export const COMMAND_NAME = \"router\";\nexport const COMMAND_DESCRIPTION = \"Manage Codex-style API relays\";\n\n/** Custom api tag; routes to our streamSimple, not Pi built-in handlers. */\nexport const ROUTER_API = \"router-codex\" as const;\n\nexport const CONFIG_VERSION = 1 as const;\n\nexport const DEFAULTS = {\n\tcontextWindow: 272_000,\n\tmaxTokens: 128_000,\n\tprobeTimeoutMs: 10_000,\n\tprobeBodyBytes: 4 * 1024 * 1024,\n\tprobeMaxModels: 2_000,\n\toriginator: \"codex\",\n} as const;\n\nexport const THINKING_LEVELS = [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const;\nexport type ThinkingLevel = (typeof THINKING_LEVELS)[number];\n\nexport const NO_UI_WARNING = \"/router requires an interactive UI.\";\n\nexport function isValidRelayId(id: string): boolean {\n\treturn Boolean(id) && !id.includes(\"/\") && !/[\\u0000-\\u001f\\u007f]/.test(id);\n}\n\nexport function truncate(value: string, maxLength: number): string {\n\tif (value.length <= maxLength) return value;\n\treturn `${value.slice(0, Math.max(0, maxLength - 1))}…`;\n}\n\nexport function formatError(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Private TUI primitives for /router. */
|
|
2
|
+
import { Container, type KeybindingsManager, type TUI } from "@earendil-works/pi-tui";
|
|
3
|
+
import type { Theme } from "../../modes/interactive/theme/theme.ts";
|
|
4
|
+
import type { ThinkingLevelMap } from "./types.ts";
|
|
5
|
+
export interface SelectItem<T extends string = string> {
|
|
6
|
+
value: T;
|
|
7
|
+
label: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
searchText?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createSearchableSelector<T extends string>(opts: {
|
|
12
|
+
title: string;
|
|
13
|
+
subtitle?: string;
|
|
14
|
+
items: ReadonlyArray<SelectItem<T>>;
|
|
15
|
+
initialValue?: T;
|
|
16
|
+
initialQuery?: string;
|
|
17
|
+
maxVisible?: number;
|
|
18
|
+
emptyMessage?: string;
|
|
19
|
+
}): (tui: TUI, theme: Theme, keybindings: KeybindingsManager, done: (result: T | undefined) => void) => Container;
|
|
20
|
+
export declare function createModelChecklist(opts: {
|
|
21
|
+
title: string;
|
|
22
|
+
subtitle?: string;
|
|
23
|
+
models: ReadonlyArray<{
|
|
24
|
+
id: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
}>;
|
|
27
|
+
initiallySelected?: ReadonlySet<string>;
|
|
28
|
+
}): (tui: TUI, theme: Theme, keybindings: KeybindingsManager, done: (result: {
|
|
29
|
+
kind: "save";
|
|
30
|
+
selectedIds: string[];
|
|
31
|
+
} | {
|
|
32
|
+
kind: "cancel";
|
|
33
|
+
}) => void) => Container;
|
|
34
|
+
export declare function createThinkingMapEditor(opts: {
|
|
35
|
+
title: string;
|
|
36
|
+
map: ThinkingLevelMap;
|
|
37
|
+
}): (tui: TUI, theme: Theme, keybindings: KeybindingsManager, done: (result: ThinkingLevelMap | undefined) => void) => Container;
|
|
38
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/extensions/router/dialog.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAE1C,OAAO,EACN,SAAS,EAGT,KAAK,kBAAkB,EAIvB,KAAK,GAAG,EACR,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAEpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACpD,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,SAAS,KAAK,IAAI,KAAK,SAAS,CA8HhH;AAQD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACxC,GAAG,CACH,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,kBAAkB,EAC/B,IAAI,EAAE,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,KAAK,IAAI,KAChF,SAAS,CA2Kb;AAWD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,gBAAgB,CAAC;CACtB,GAAG,CACH,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,kBAAkB,EAC/B,IAAI,EAAE,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,KAAK,IAAI,KAChD,SAAS,CAiHb","sourcesContent":["/** Private TUI primitives for /router. */\n\nimport {\n\tContainer,\n\tfuzzyFilter,\n\tInput,\n\ttype KeybindingsManager,\n\tSpacer,\n\tText,\n\tTruncatedText,\n\ttype TUI,\n} from \"@earendil-works/pi-tui\";\nimport { DynamicBorder } from \"../../modes/interactive/components/dynamic-border.ts\";\nimport { keyHint, rawKeyHint } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { THINKING_LEVELS, type ThinkingLevel, truncate } from \"./constants.ts\";\nimport type { ThinkingLevelMap } from \"./types.ts\";\n\nexport interface SelectItem<T extends string = string> {\n\tvalue: T;\n\tlabel: string;\n\tdescription?: string;\n\tsearchText?: string;\n}\n\nexport function createSearchableSelector<T extends string>(opts: {\n\ttitle: string;\n\tsubtitle?: string;\n\titems: ReadonlyArray<SelectItem<T>>;\n\tinitialValue?: T;\n\tinitialQuery?: string;\n\tmaxVisible?: number;\n\temptyMessage?: string;\n}): (tui: TUI, theme: Theme, keybindings: KeybindingsManager, done: (result: T | undefined) => void) => Container {\n\treturn (tui, theme, keybindings, done) => {\n\t\tconst allItems = [...opts.items];\n\t\tlet filteredItems = allItems;\n\t\tlet selectedIndex = Math.max(\n\t\t\t0,\n\t\t\tallItems.findIndex((item) => item.value === opts.initialValue),\n\t\t);\n\t\tconst maxVisible = Math.max(1, opts.maxVisible ?? 10);\n\t\tconst input = new Input();\n\t\tif (opts.initialQuery) input.setValue(opts.initialQuery);\n\t\tconst search = new Container();\n\t\tconst list = new Container();\n\t\tconst footer = new Text(\"\", 1, 0);\n\t\tconst container = new Container() as Container & {\n\t\t\thandleInput: (data: string) => void;\n\t\t\tfocused: boolean;\n\t\t};\n\n\t\tconst refresh = () => {\n\t\t\tsearch.clear();\n\t\t\tif (input.getValue()) {\n\t\t\t\tsearch.addChild(input);\n\t\t\t\tsearch.addChild(new Spacer(1));\n\t\t\t}\n\t\t\tlist.clear();\n\t\t\tconst start = Math.max(\n\t\t\t\t0,\n\t\t\t\tMath.min(selectedIndex - Math.floor(maxVisible / 2), Math.max(0, filteredItems.length - maxVisible)),\n\t\t\t);\n\t\t\tconst end = Math.min(start + maxVisible, filteredItems.length);\n\t\t\tfor (let index = start; index < end; index++) {\n\t\t\t\tconst item = filteredItems[index];\n\t\t\t\tif (!item) continue;\n\t\t\t\tconst active = index === selectedIndex;\n\t\t\t\tconst prefix = active ? theme.fg(\"accent\", \"→ \") : \" \";\n\t\t\t\tconst label = theme.fg(active ? \"accent\" : \"text\", item.label);\n\t\t\t\tconst description = item.description ? theme.fg(\"muted\", ` ${truncate(item.description, 48)}`) : \"\";\n\t\t\t\tlist.addChild(new TruncatedText(prefix + label + description, 1, 0));\n\t\t\t}\n\t\t\tif (filteredItems.length === 0) {\n\t\t\t\tlist.addChild(new Text(theme.fg(\"muted\", ` ${opts.emptyMessage ?? \"No matching items\"}`), 1, 0));\n\t\t\t} else if (start > 0 || end < filteredItems.length) {\n\t\t\t\tlist.addChild(new Text(theme.fg(\"muted\", ` (${selectedIndex + 1}/${filteredItems.length})`), 1, 0));\n\t\t\t}\n\t\t\tconst hints = [\n\t\t\t\trawKeyHint(\"type\", \"filter\"),\n\t\t\t\trawKeyHint(\"↑↓\", \"navigate\"),\n\t\t\t\tkeyHint(\"tui.select.confirm\", \"select\"),\n\t\t\t\tkeyHint(\"tui.select.cancel\", input.getValue() ? \"clear filter\" : \"back\"),\n\t\t\t];\n\t\t\tfooter.setText(hints.join(\" \"));\n\t\t\tcontainer.invalidate();\n\t\t\ttui.requestRender();\n\t\t};\n\n\t\tconst applyFilter = (query: string, preferred?: T) => {\n\t\t\tfilteredItems = query\n\t\t\t\t? fuzzyFilter(\n\t\t\t\t\t\tallItems,\n\t\t\t\t\t\tquery,\n\t\t\t\t\t\t(item) => item.searchText ?? `${item.label} ${item.description ?? \"\"} ${item.value}`,\n\t\t\t\t\t)\n\t\t\t\t: allItems;\n\t\t\tconst preferredIndex = preferred ? filteredItems.findIndex((item) => item.value === preferred) : -1;\n\t\t\tselectedIndex = preferredIndex >= 0 ? preferredIndex : 0;\n\t\t\trefresh();\n\t\t};\n\n\t\tcontainer.addChild(new DynamicBorder((text) => theme.fg(\"border\", text)));\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(new TruncatedText(theme.fg(\"accent\", theme.bold(opts.title)), 1, 0));\n\t\tif (opts.subtitle) container.addChild(new TruncatedText(theme.fg(\"muted\", opts.subtitle), 1, 0));\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(search);\n\t\tcontainer.addChild(list);\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(footer);\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(new DynamicBorder((text) => theme.fg(\"border\", text)));\n\n\t\tObject.defineProperty(container, \"focused\", {\n\t\t\tget: () => input.focused,\n\t\t\tset: (focused: boolean) => {\n\t\t\t\tinput.focused = focused;\n\t\t\t},\n\t\t});\n\n\t\tcontainer.handleInput = (data: string) => {\n\t\t\tif (keybindings.matches(data, \"tui.select.up\")) {\n\t\t\t\tif (filteredItems.length > 0) {\n\t\t\t\t\tselectedIndex = selectedIndex === 0 ? filteredItems.length - 1 : selectedIndex - 1;\n\t\t\t\t\trefresh();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"tui.select.down\")) {\n\t\t\t\tif (filteredItems.length > 0) {\n\t\t\t\t\tselectedIndex = selectedIndex === filteredItems.length - 1 ? 0 : selectedIndex + 1;\n\t\t\t\t\trefresh();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"tui.select.confirm\")) {\n\t\t\t\tconst item = filteredItems[selectedIndex];\n\t\t\t\tif (item) done(item.value);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"tui.select.cancel\")) {\n\t\t\t\tif (input.getValue()) {\n\t\t\t\t\tinput.setValue(\"\");\n\t\t\t\t\tapplyFilter(\"\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tdone(undefined);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst before = input.getValue();\n\t\t\tinput.handleInput(data);\n\t\t\tconst after = input.getValue();\n\t\t\tif (after !== before) applyFilter(after);\n\t\t};\n\n\t\tapplyFilter(opts.initialQuery ?? \"\", opts.initialValue);\n\t\treturn container;\n\t};\n}\n\nfunction sameIdSet(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean {\n\tif (a.size !== b.size) return false;\n\tfor (const id of a) if (!b.has(id)) return false;\n\treturn true;\n}\n\nexport function createModelChecklist(opts: {\n\ttitle: string;\n\tsubtitle?: string;\n\tmodels: ReadonlyArray<{ id: string; name?: string }>;\n\tinitiallySelected?: ReadonlySet<string>;\n}): (\n\ttui: TUI,\n\ttheme: Theme,\n\tkeybindings: KeybindingsManager,\n\tdone: (result: { kind: \"save\"; selectedIds: string[] } | { kind: \"cancel\" }) => void,\n) => Container {\n\treturn (tui, theme, keybindings, done) => {\n\t\tconst items = opts.models.map((model) => ({\n\t\t\tid: model.id,\n\t\t\tlabel: model.name && model.name !== model.id ? `${model.id} · ${model.name}` : model.id,\n\t\t}));\n\t\tconst initialSelected = new Set(opts.initiallySelected ?? []);\n\t\tconst selected = new Set(initialSelected);\n\t\tlet filter = \"\";\n\t\tlet selectedIndex = 0;\n\t\tlet discardArmed = false;\n\t\tconst maxVisible = 12;\n\t\tconst input = new Input();\n\t\tconst list = new Container();\n\t\tconst footer = new Text(\"\", 1, 0);\n\t\tconst container = new Container() as Container & {\n\t\t\thandleInput: (data: string) => void;\n\t\t\tfocused: boolean;\n\t\t};\n\n\t\tconst isDirty = () => !sameIdSet(selected, initialSelected);\n\n\t\tconst filtered = () => {\n\t\t\tconst q = filter.trim().toLowerCase();\n\t\t\tif (!q) return items;\n\t\t\treturn items.filter((item) => item.id.toLowerCase().includes(q) || item.label.toLowerCase().includes(q));\n\t\t};\n\n\t\tconst refresh = () => {\n\t\t\tconst rows = filtered();\n\t\t\tif (selectedIndex >= rows.length) selectedIndex = Math.max(0, rows.length - 1);\n\t\t\tlist.clear();\n\t\t\tconst start = Math.max(\n\t\t\t\t0,\n\t\t\t\tMath.min(selectedIndex - Math.floor(maxVisible / 2), Math.max(0, rows.length - maxVisible)),\n\t\t\t);\n\t\t\tconst end = Math.min(start + maxVisible, rows.length);\n\t\t\tfor (let index = start; index < end; index++) {\n\t\t\t\tconst item = rows[index]!;\n\t\t\t\tconst active = index === selectedIndex;\n\t\t\t\tconst mark = selected.has(item.id) ? theme.fg(\"success\", \"[x]\") : theme.fg(\"muted\", \"[ ]\");\n\t\t\t\tconst prefix = active ? theme.fg(\"accent\", \"→ \") : \" \";\n\t\t\t\tconst label = theme.fg(active ? \"accent\" : \"text\", item.label);\n\t\t\t\tlist.addChild(new TruncatedText(`${prefix}${mark} ${label}`, 1, 0));\n\t\t\t}\n\t\t\tif (rows.length === 0) {\n\t\t\t\tlist.addChild(new Text(theme.fg(\"muted\", \" No matching models\"), 1, 0));\n\t\t\t}\n\n\t\t\tconst statusParts = [`${selected.size} selected`, `${rows.length} shown`];\n\t\t\tif (isDirty()) statusParts.push(theme.fg(\"warning\", \"unsaved\"));\n\t\t\tconst statusLine = theme.fg(\"muted\", statusParts.join(\" · \"));\n\n\t\t\tlet hints: string[];\n\t\t\tif (discardArmed && isDirty()) {\n\t\t\t\thints = [\n\t\t\t\t\ttheme.fg(\"warning\", \"Unsaved selection — Esc again discards\"),\n\t\t\t\t\tkeyHint(\"app.models.save\", \"apply\"),\n\t\t\t\t];\n\t\t\t} else {\n\t\t\t\thints = [\n\t\t\t\t\tkeyHint(\"app.list.toggle\", \"toggle\"),\n\t\t\t\t\tkeyHint(\"app.models.enableAll\", \"all\"),\n\t\t\t\t\tkeyHint(\"app.models.clearAll\", \"none\"),\n\t\t\t\t\tkeyHint(\"app.models.save\", \"apply\"),\n\t\t\t\t\trawKeyHint(\"type\", \"filter\"),\n\t\t\t\t\tkeyHint(\"tui.select.cancel\", filter ? \"clear\" : isDirty() ? \"warn discard\" : \"cancel\"),\n\t\t\t\t];\n\t\t\t}\n\t\t\tfooter.setText(`${statusLine}\\n${hints.join(\" \")}`);\n\t\t\tcontainer.invalidate();\n\t\t\ttui.requestRender();\n\t\t};\n\n\t\tconst markChanged = () => {\n\t\t\tdiscardArmed = false;\n\t\t\trefresh();\n\t\t};\n\n\t\tcontainer.addChild(new DynamicBorder((text) => theme.fg(\"border\", text)));\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(new TruncatedText(theme.fg(\"accent\", theme.bold(opts.title)), 1, 0));\n\t\tif (opts.subtitle) container.addChild(new TruncatedText(theme.fg(\"muted\", opts.subtitle), 1, 0));\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(input);\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(list);\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(footer);\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(new DynamicBorder((text) => theme.fg(\"border\", text)));\n\n\t\tObject.defineProperty(container, \"focused\", {\n\t\t\tget: () => input.focused,\n\t\t\tset: (focused: boolean) => {\n\t\t\t\tinput.focused = focused;\n\t\t\t},\n\t\t});\n\n\t\tcontainer.handleInput = (data: string) => {\n\t\t\tconst rows = filtered();\n\t\t\tif (keybindings.matches(data, \"app.list.toggle\")) {\n\t\t\t\tconst item = rows[selectedIndex];\n\t\t\t\tif (item) {\n\t\t\t\t\tif (selected.has(item.id)) selected.delete(item.id);\n\t\t\t\t\telse selected.add(item.id);\n\t\t\t\t\tmarkChanged();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"app.models.enableAll\")) {\n\t\t\t\tfor (const item of rows) selected.add(item.id);\n\t\t\t\tmarkChanged();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"app.models.clearAll\")) {\n\t\t\t\tfor (const item of rows) selected.delete(item.id);\n\t\t\t\tmarkChanged();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"app.models.save\")) {\n\t\t\t\tdone({ kind: \"save\", selectedIds: [...selected] });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"tui.select.up\")) {\n\t\t\t\tif (rows.length > 0) {\n\t\t\t\t\tselectedIndex = selectedIndex === 0 ? rows.length - 1 : selectedIndex - 1;\n\t\t\t\t\tdiscardArmed = false;\n\t\t\t\t\trefresh();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"tui.select.down\")) {\n\t\t\t\tif (rows.length > 0) {\n\t\t\t\t\tselectedIndex = selectedIndex === rows.length - 1 ? 0 : selectedIndex + 1;\n\t\t\t\t\tdiscardArmed = false;\n\t\t\t\t\trefresh();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"tui.select.cancel\")) {\n\t\t\t\tif (filter) {\n\t\t\t\t\tfilter = \"\";\n\t\t\t\t\tinput.setValue(\"\");\n\t\t\t\t\tselectedIndex = 0;\n\t\t\t\t\tdiscardArmed = false;\n\t\t\t\t\trefresh();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (isDirty() && !discardArmed) {\n\t\t\t\t\tdiscardArmed = true;\n\t\t\t\t\trefresh();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tdone({ kind: \"cancel\" });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst before = input.getValue();\n\t\t\tinput.handleInput(data);\n\t\t\tconst after = input.getValue();\n\t\t\tif (after !== before) {\n\t\t\t\tfilter = after;\n\t\t\t\tselectedIndex = 0;\n\t\t\t\tdiscardArmed = false;\n\t\t\t\trefresh();\n\t\t\t}\n\t\t};\n\n\t\trefresh();\n\t\treturn container;\n\t};\n}\n\nfunction thinkingMapsEqual(a: ThinkingLevelMap, b: ThinkingLevelMap): boolean {\n\tfor (const level of THINKING_LEVELS) {\n\t\tconst av = Object.hasOwn(a, level) ? a[level] : undefined;\n\t\tconst bv = Object.hasOwn(b, level) ? b[level] : undefined;\n\t\tif (av !== bv) return false;\n\t}\n\treturn true;\n}\n\nexport function createThinkingMapEditor(opts: {\n\ttitle: string;\n\tmap: ThinkingLevelMap;\n}): (\n\ttui: TUI,\n\ttheme: Theme,\n\tkeybindings: KeybindingsManager,\n\tdone: (result: ThinkingLevelMap | undefined) => void,\n) => Container {\n\treturn (tui, theme, keybindings, done) => {\n\t\tconst initial: ThinkingLevelMap = { ...opts.map };\n\t\tconst working: ThinkingLevelMap = { ...opts.map };\n\t\tlet index = 0;\n\t\tlet discardArmed = false;\n\t\tconst list = new Container();\n\t\tconst footer = new Text(\"\", 1, 0);\n\t\tconst container = new Container() as Container & {\n\t\t\thandleInput: (data: string) => void;\n\t\t\tfocused: boolean;\n\t\t};\n\n\t\tconst isDirty = () => !thinkingMapsEqual(working, initial);\n\n\t\tconst status = (level: ThinkingLevel): string => {\n\t\t\tconst value = working[level];\n\t\t\tif (value === null) return \"hidden\";\n\t\t\tif (value === undefined) return \"default\";\n\t\t\treturn value === level ? \"on\" : `→ ${value}`;\n\t\t};\n\n\t\tconst refresh = () => {\n\t\t\tlist.clear();\n\t\t\tfor (let i = 0; i < THINKING_LEVELS.length; i++) {\n\t\t\t\tconst level = THINKING_LEVELS[i]!;\n\t\t\t\tconst active = i === index;\n\t\t\t\tconst prefix = active ? theme.fg(\"accent\", \"→ \") : \" \";\n\t\t\t\tconst label = theme.fg(active ? \"accent\" : \"text\", level.padEnd(8));\n\t\t\t\tconst st = status(level);\n\t\t\t\tconst color = st === \"hidden\" ? \"muted\" : st === \"default\" ? \"dim\" : \"success\";\n\t\t\t\tlist.addChild(new Text(`${prefix}${label} ${theme.fg(color, st)}`, 1, 0));\n\t\t\t}\n\n\t\t\tconst statusLine = isDirty() ? theme.fg(\"warning\", \"Unsaved changes\") : theme.fg(\"muted\", \"No changes yet\");\n\n\t\t\tlet hints: string[];\n\t\t\tif (discardArmed && isDirty()) {\n\t\t\t\thints = [theme.fg(\"warning\", \"Esc again discards\"), keyHint(\"app.models.save\", \"apply\")];\n\t\t\t} else {\n\t\t\t\thints = [\n\t\t\t\t\tkeyHint(\"app.list.toggle\", \"toggle on/hidden\"),\n\t\t\t\t\tkeyHint(\"tui.select.confirm\", \"toggle on/hidden\"),\n\t\t\t\t\tkeyHint(\"app.models.save\", \"apply\"),\n\t\t\t\t\tkeyHint(\"tui.select.cancel\", isDirty() ? \"warn discard\" : \"back\"),\n\t\t\t\t];\n\t\t\t}\n\t\t\tfooter.setText(`${statusLine}\\n${hints.join(\" \")}`);\n\t\t\tcontainer.invalidate();\n\t\t\ttui.requestRender();\n\t\t};\n\n\t\tconst toggle = () => {\n\t\t\tconst level = THINKING_LEVELS[index]!;\n\t\t\tif (working[level] === null) {\n\t\t\t\tworking[level] = level === \"off\" ? \"none\" : level;\n\t\t\t} else {\n\t\t\t\tworking[level] = null;\n\t\t\t}\n\t\t\tdiscardArmed = false;\n\t\t\trefresh();\n\t\t};\n\n\t\tcontainer.addChild(new DynamicBorder((text) => theme.fg(\"border\", text)));\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(new TruncatedText(theme.fg(\"accent\", theme.bold(opts.title)), 1, 0));\n\t\tcontainer.addChild(new Text(theme.fg(\"muted\", \" Toggle which Pi thinking levels this model exposes.\"), 1, 0));\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(list);\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(footer);\n\t\tcontainer.addChild(new Spacer(1));\n\t\tcontainer.addChild(new DynamicBorder((text) => theme.fg(\"border\", text)));\n\n\t\tObject.defineProperty(container, \"focused\", {\n\t\t\tget: () => true,\n\t\t\tset: () => {},\n\t\t});\n\n\t\tcontainer.handleInput = (data: string) => {\n\t\t\tif (keybindings.matches(data, \"tui.select.up\")) {\n\t\t\t\tindex = index === 0 ? THINKING_LEVELS.length - 1 : index - 1;\n\t\t\t\tdiscardArmed = false;\n\t\t\t\trefresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"tui.select.down\")) {\n\t\t\t\tindex = index === THINKING_LEVELS.length - 1 ? 0 : index + 1;\n\t\t\t\tdiscardArmed = false;\n\t\t\t\trefresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"app.list.toggle\") || keybindings.matches(data, \"tui.select.confirm\")) {\n\t\t\t\ttoggle();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"app.models.save\")) {\n\t\t\t\tdone({ ...working });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (keybindings.matches(data, \"tui.select.cancel\")) {\n\t\t\t\tif (isDirty() && !discardArmed) {\n\t\t\t\t\tdiscardArmed = true;\n\t\t\t\t\trefresh();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tdone(undefined);\n\t\t\t}\n\t\t};\n\n\t\trefresh();\n\t\treturn container;\n\t};\n}\n"]}
|