@selesai/code 0.1.0
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/README.md +198 -0
- package/dist/agents/architect.md +216 -0
- package/dist/agents/builder.md +119 -0
- package/dist/agents/commentator.md +128 -0
- package/dist/agents/explorer.md +51 -0
- package/dist/agents/recapper.md +24 -0
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +9 -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 +379 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config-selector.d.ts +14 -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 +82 -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 +23 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +172 -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 +154 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +579 -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 +303 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +88 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +119 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session.d.ts +607 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +2552 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/agents.d.ts +53 -0
- package/dist/core/agents.d.ts.map +1 -0
- package/dist/core/agents.js +238 -0
- package/dist/core/agents.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 +140 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +434 -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/compaction/branch-summarization.d.ts +92 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +249 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +122 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +625 -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 +153 -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 +531 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +166 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +876 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1209 -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 +22 -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 +64 -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 +353 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +295 -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-registry.d.ts +151 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +750 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +111 -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/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 +207 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +2088 -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 +53 -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 +82 -0
- package/dist/core/provider-attribution.js.map +1 -0
- package/dist/core/provider-display-names.d.ts +2 -0
- package/dist/core/provider-display-names.d.ts.map +1 -0
- package/dist/core/provider-display-names.js +36 -0
- package/dist/core/provider-display-names.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 +230 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +861 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/sdk.d.ts +109 -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 +332 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1230 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/settings-manager.d.ts +286 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +874 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +69 -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 +14 -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 +31 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +128 -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 +8 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +31 -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 +346 -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 +51 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +284 -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 +289 -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/defaults/models.json +3 -0
- package/dist/defaults/settings.json +68 -0
- package/dist/extensions/copy-turn.ts +125 -0
- package/dist/extensions/gitignore-guard.ts +132 -0
- package/dist/extensions/hooks/claude-codex-hooks.json +44 -0
- package/dist/extensions/hooks/copilot-hooks.json +21 -0
- package/dist/extensions/hooks/ponytail-activate.js +91 -0
- package/dist/extensions/hooks/ponytail-config.js +122 -0
- package/dist/extensions/hooks/ponytail-instructions.js +94 -0
- package/dist/extensions/hooks/ponytail-mode-tracker.js +55 -0
- package/dist/extensions/hooks/ponytail-runtime.js +68 -0
- package/dist/extensions/hooks/ponytail-statusline.ps1 +21 -0
- package/dist/extensions/hooks/ponytail-statusline.sh +12 -0
- package/dist/extensions/hooks/ponytail-subagent.js +22 -0
- package/dist/extensions/package.json +19 -0
- package/dist/extensions/pi-extension/index.js +189 -0
- package/dist/extensions/pi-extension/package.json +8 -0
- package/dist/extensions/pi-extension/test/extension.test.js +167 -0
- package/dist/extensions/pi-extension/test/helpers.test.js +92 -0
- package/dist/extensions/pi-powerline-footer/CHANGELOG.md +516 -0
- package/dist/extensions/pi-powerline-footer/README.md +382 -0
- package/dist/extensions/pi-powerline-footer/banner.png +0 -0
- package/dist/extensions/pi-powerline-footer/bash-mode/completion.ts +556 -0
- package/dist/extensions/pi-powerline-footer/bash-mode/editor.ts +397 -0
- package/dist/extensions/pi-powerline-footer/bash-mode/history.ts +151 -0
- package/dist/extensions/pi-powerline-footer/bash-mode/shell-session.ts +286 -0
- package/dist/extensions/pi-powerline-footer/bash-mode/transcript.ts +108 -0
- package/dist/extensions/pi-powerline-footer/bash-mode/types.ts +59 -0
- package/dist/extensions/pi-powerline-footer/colors.ts +69 -0
- package/dist/extensions/pi-powerline-footer/context-usage.ts +41 -0
- package/dist/extensions/pi-powerline-footer/fixed-editor/cluster.ts +113 -0
- package/dist/extensions/pi-powerline-footer/fixed-editor/terminal-split.ts +1077 -0
- package/dist/extensions/pi-powerline-footer/git-status.ts +212 -0
- package/dist/extensions/pi-powerline-footer/icons.ts +181 -0
- package/dist/extensions/pi-powerline-footer/index.ts +2817 -0
- package/dist/extensions/pi-powerline-footer/package.json +46 -0
- package/dist/extensions/pi-powerline-footer/powerline-config.ts +182 -0
- package/dist/extensions/pi-powerline-footer/presets.ts +121 -0
- package/dist/extensions/pi-powerline-footer/render-scheduler.ts +24 -0
- package/dist/extensions/pi-powerline-footer/segments.ts +566 -0
- package/dist/extensions/pi-powerline-footer/separators.ts +57 -0
- package/dist/extensions/pi-powerline-footer/shortcuts.ts +47 -0
- package/dist/extensions/pi-powerline-footer/tests/bash-mode.test.ts +1503 -0
- package/dist/extensions/pi-powerline-footer/tests/context-usage.test.ts +38 -0
- package/dist/extensions/pi-powerline-footer/tests/custom-items.test.ts +135 -0
- package/dist/extensions/pi-powerline-footer/tests/editor-responsiveness.test.ts +180 -0
- package/dist/extensions/pi-powerline-footer/tests/fixed-editor.test.ts +1416 -0
- package/dist/extensions/pi-powerline-footer/tests/jump-shortcuts.test.ts +213 -0
- package/dist/extensions/pi-powerline-footer/tests/stash-shortcut.test.ts +32 -0
- package/dist/extensions/pi-powerline-footer/tests/thinking-segment.test.ts +61 -0
- package/dist/extensions/pi-powerline-footer/tests/working-vibes.test.ts +226 -0
- package/dist/extensions/pi-powerline-footer/theme.example.json +24 -0
- package/dist/extensions/pi-powerline-footer/theme.json +12 -0
- package/dist/extensions/pi-powerline-footer/theme.ts +227 -0
- package/dist/extensions/pi-powerline-footer/types.ts +191 -0
- package/dist/extensions/pi-powerline-footer/welcome-dismiss.ts +34 -0
- package/dist/extensions/pi-powerline-footer/welcome.ts +611 -0
- package/dist/extensions/pi-powerline-footer/working-vibes.ts +695 -0
- package/dist/extensions/prototype.ts +713 -0
- package/dist/extensions/question.ts +350 -0
- package/dist/extensions/rtk.ts +81 -0
- package/dist/extensions/tps-tracker.ts +280 -0
- package/dist/extensions/undo.ts +292 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -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 +700 -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 +20 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +121 -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 +71 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +506 -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-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 +20 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +119 -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 +28 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +221 -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 +179 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +47 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +279 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +31 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +165 -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 +73 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +570 -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/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 +51 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +63 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +317 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +89 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1208 -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 +10 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +29 -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 +381 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +4802 -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 +86 -0
- package/dist/modes/interactive/theme/light.json +85 -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 +336 -0
- package/dist/modes/interactive/theme/theme.d.ts +119 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +1056 -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 +227 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +467 -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 +637 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +428 -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 +659 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/skills/grill-me/SKILL.md +10 -0
- package/dist/skills/handoff/SKILL.md +15 -0
- package/dist/skills/implanger/SKILL.md +68 -0
- package/dist/skills/improve-codebase/REFERENCE.md +78 -0
- package/dist/skills/improve-codebase/SKILL.md +178 -0
- package/dist/skills/planger/SKILL.md +165 -0
- package/dist/skills/ponytail/SKILL.md +117 -0
- package/dist/skills/ponytail-audit/SKILL.md +41 -0
- package/dist/skills/ponytail-debt/SKILL.md +44 -0
- package/dist/skills/ponytail-gain/SKILL.md +50 -0
- package/dist/skills/ponytail-help/SKILL.md +69 -0
- package/dist/skills/ponytail-review/SKILL.md +57 -0
- package/dist/skills/selesai-default/SKILL.md +16 -0
- package/dist/themes/powerline-footer/theme.json +33 -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 +10 -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 +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +117 -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 +9 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +39 -0
- package/dist/utils/image-convert.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 +69 -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 +52 -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 +396 -0
- package/docs/containerization.md +111 -0
- package/docs/custom-provider.md +737 -0
- package/docs/development.md +71 -0
- package/docs/docs.json +156 -0
- package/docs/extensions.md +2681 -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 +82 -0
- package/docs/json.md +82 -0
- package/docs/keybindings.md +197 -0
- package/docs/models.md +495 -0
- package/docs/packages.md +227 -0
- package/docs/prompt-templates.md +95 -0
- package/docs/providers.md +274 -0
- package/docs/quickstart.md +165 -0
- package/docs/rpc.md +1412 -0
- package/docs/sdk.md +1143 -0
- package/docs/security.md +59 -0
- package/docs/session-format.md +412 -0
- package/docs/sessions.md +145 -0
- package/docs/settings.md +308 -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 +295 -0
- package/docs/tmux.md +63 -0
- package/docs/tui.md +927 -0
- package/docs/usage.md +308 -0
- package/docs/windows.md +17 -0
- package/examples/README.md +25 -0
- package/examples/extensions/README.md +211 -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 +150 -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 +127 -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/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/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 +285 -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 +1015 -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 +206 -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 +53 -0
- package/examples/sdk/03-custom-prompt.ts +75 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +48 -0
- package/examples/sdk/06-extensions.ts +99 -0
- package/examples/sdk/07-context-files.ts +47 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +52 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +52 -0
- package/examples/sdk/12-full-control.ts +77 -0
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/README.md +144 -0
- package/package.json +65 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { mkdtempSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { basename, join } from "node:path";
|
|
4
|
+
import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process";
|
|
5
|
+
import type { BashTranscriptStore } from "./transcript.ts";
|
|
6
|
+
import type { ShellSessionState } from "./types.ts";
|
|
7
|
+
|
|
8
|
+
const READY_SENTINEL = "__PI_READY__";
|
|
9
|
+
const COMMAND_START_SENTINEL = "__PI_CMD_START__";
|
|
10
|
+
const COMMAND_DONE_SENTINEL = "__PI_CMD_DONE__";
|
|
11
|
+
|
|
12
|
+
function stripAnsi(value: string): string {
|
|
13
|
+
return value
|
|
14
|
+
.replace(/\x1B\[[0-9;?]*[ -/]*[@-~]/g, "")
|
|
15
|
+
.replace(/\x1B\][^\u0007]*(?:\u0007|\x1b\\)/g, "")
|
|
16
|
+
.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g, "");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function quoteShellArg(value: string): string {
|
|
20
|
+
return `'${value.replace(/'/g, `'"'"'`)}'`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function getCloseExitCode(code: number | null, signal: NodeJS.Signals | null): number {
|
|
24
|
+
if (typeof code === "number") {
|
|
25
|
+
return code;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (signal === "SIGINT") {
|
|
29
|
+
return 130;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (signal === "SIGTERM") {
|
|
33
|
+
return 143;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (signal === "SIGKILL") {
|
|
37
|
+
return 137;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getShellInitScript(shellName: string): string {
|
|
44
|
+
if (shellName.includes("fish")) {
|
|
45
|
+
return `
|
|
46
|
+
function __pi_eval
|
|
47
|
+
set -l __pi_id $argv[1]
|
|
48
|
+
set -l __pi_file $argv[2]
|
|
49
|
+
echo "${COMMAND_START_SENTINEL}:$__pi_id:$PWD"
|
|
50
|
+
source $__pi_file
|
|
51
|
+
set -l __pi_status $status
|
|
52
|
+
rm -f $__pi_file
|
|
53
|
+
echo "${COMMAND_DONE_SENTINEL}:$__pi_id:$__pi_status:$PWD"
|
|
54
|
+
end
|
|
55
|
+
echo "${READY_SENTINEL}:$PWD"
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (shellName.includes("bash")) {
|
|
60
|
+
return `
|
|
61
|
+
__pi_eval() {
|
|
62
|
+
local __pi_id="$1"
|
|
63
|
+
local __pi_file="$2"
|
|
64
|
+
printf '%s:%s:%s\n' '${COMMAND_START_SENTINEL}' "$__pi_id" "$PWD"
|
|
65
|
+
source "$__pi_file"
|
|
66
|
+
local __pi_status=$?
|
|
67
|
+
rm -f "$__pi_file"
|
|
68
|
+
printf '%s:%s:%s:%s\n' '${COMMAND_DONE_SENTINEL}' "$__pi_id" "$__pi_status" "$PWD"
|
|
69
|
+
}
|
|
70
|
+
printf '%s:%s\n' '${READY_SENTINEL}' "$PWD"
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return `
|
|
75
|
+
function __pi_eval() {
|
|
76
|
+
local __pi_id="$1"
|
|
77
|
+
local __pi_file="$2"
|
|
78
|
+
print -r -- "${COMMAND_START_SENTINEL}:$__pi_id:$PWD"
|
|
79
|
+
builtin source "$__pi_file"
|
|
80
|
+
local __pi_status=$?
|
|
81
|
+
rm -f "$__pi_file"
|
|
82
|
+
print -r -- "${COMMAND_DONE_SENTINEL}:$__pi_id:$__pi_status:$PWD"
|
|
83
|
+
}
|
|
84
|
+
print -r -- "${READY_SENTINEL}:$PWD"
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export class ManagedShellSession {
|
|
89
|
+
private readonly shellPath: string;
|
|
90
|
+
private readonly transcript: BashTranscriptStore;
|
|
91
|
+
private readonly onStateChange: () => void;
|
|
92
|
+
private readonly onCommandSuccess: (command: string, cwd: string) => void;
|
|
93
|
+
private process: ChildProcessWithoutNullStreams | null = null;
|
|
94
|
+
private readonly tempDir = mkdtempSync(join(tmpdir(), "powerline-bash-mode-"));
|
|
95
|
+
private buffer = "";
|
|
96
|
+
private commandCounter = 0;
|
|
97
|
+
private currentCommandId: string | null = null;
|
|
98
|
+
private readyPromise: Promise<void> | null = null;
|
|
99
|
+
private readyResolve: (() => void) | null = null;
|
|
100
|
+
private readyReject: ((error: Error) => void) | null = null;
|
|
101
|
+
private disposed = false;
|
|
102
|
+
readonly state: ShellSessionState;
|
|
103
|
+
|
|
104
|
+
constructor(
|
|
105
|
+
shellPath: string,
|
|
106
|
+
cwd: string,
|
|
107
|
+
transcript: BashTranscriptStore,
|
|
108
|
+
onStateChange: () => void,
|
|
109
|
+
onCommandSuccess: (command: string, cwd: string) => void,
|
|
110
|
+
) {
|
|
111
|
+
this.shellPath = shellPath;
|
|
112
|
+
this.transcript = transcript;
|
|
113
|
+
this.onStateChange = onStateChange;
|
|
114
|
+
this.onCommandSuccess = onCommandSuccess;
|
|
115
|
+
const shellName = basename(shellPath).toLowerCase();
|
|
116
|
+
this.state = {
|
|
117
|
+
ready: false,
|
|
118
|
+
running: false,
|
|
119
|
+
shellPath,
|
|
120
|
+
shellName,
|
|
121
|
+
cwd,
|
|
122
|
+
lastExitCode: null,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async ensureReady(): Promise<void> {
|
|
127
|
+
if (this.state.ready) return;
|
|
128
|
+
if (this.readyPromise) return this.readyPromise;
|
|
129
|
+
|
|
130
|
+
this.readyPromise = new Promise<void>((resolve, reject) => {
|
|
131
|
+
this.readyResolve = resolve;
|
|
132
|
+
this.readyReject = reject;
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
this.process = spawn(this.shellPath, [], {
|
|
136
|
+
cwd: this.state.cwd,
|
|
137
|
+
env: {
|
|
138
|
+
...process.env,
|
|
139
|
+
DISABLE_AUTO_UPDATE: "true",
|
|
140
|
+
DISABLE_UPDATE_PROMPT: "true",
|
|
141
|
+
},
|
|
142
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
143
|
+
detached: true,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
this.process.stdout.setEncoding("utf8");
|
|
147
|
+
this.process.stderr.setEncoding("utf8");
|
|
148
|
+
this.process.stdout.on("data", (chunk) => this.handleChunk(String(chunk)));
|
|
149
|
+
this.process.stderr.on("data", (chunk) => this.handleChunk(String(chunk)));
|
|
150
|
+
this.process.on("error", (error) => {
|
|
151
|
+
if (!this.state.ready) {
|
|
152
|
+
this.readyReject?.(error instanceof Error ? error : new Error(String(error)));
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
this.process.on("close", (code, signal) => {
|
|
156
|
+
const exitCode = getCloseExitCode(code, signal);
|
|
157
|
+
if (!this.disposed && !this.state.ready) {
|
|
158
|
+
this.readyReject?.(new Error(`Shell failed to start (exit ${exitCode})`));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (this.currentCommandId) {
|
|
162
|
+
this.transcript.finishCommand(this.currentCommandId, exitCode);
|
|
163
|
+
this.state.lastExitCode = exitCode;
|
|
164
|
+
this.currentCommandId = null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
this.process = null;
|
|
168
|
+
this.buffer = "";
|
|
169
|
+
this.readyPromise = null;
|
|
170
|
+
this.readyResolve = null;
|
|
171
|
+
this.readyReject = null;
|
|
172
|
+
this.state.ready = false;
|
|
173
|
+
this.state.running = false;
|
|
174
|
+
this.onStateChange();
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
this.sendRaw(getShellInitScript(this.state.shellName) + "\n");
|
|
178
|
+
return this.readyPromise;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async runCommand(command: string): Promise<void> {
|
|
182
|
+
await this.ensureReady();
|
|
183
|
+
if (!this.process) {
|
|
184
|
+
throw new Error("Shell process not available");
|
|
185
|
+
}
|
|
186
|
+
if (this.state.running) {
|
|
187
|
+
throw new Error("Shell command already running");
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const id = `cmd-${++this.commandCounter}`;
|
|
191
|
+
const extension = this.state.shellName.includes("fish") ? "fish" : "sh";
|
|
192
|
+
const filePath = join(this.tempDir, `${id}.${extension}`);
|
|
193
|
+
writeFileSync(filePath, command.endsWith("\n") ? command : `${command}\n`, "utf8");
|
|
194
|
+
|
|
195
|
+
this.currentCommandId = id;
|
|
196
|
+
this.state.running = true;
|
|
197
|
+
this.transcript.startCommand(id, command, this.state.cwd);
|
|
198
|
+
this.onStateChange();
|
|
199
|
+
this.sendRaw(`__pi_eval ${quoteShellArg(id)} ${quoteShellArg(filePath)}\n`);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
interrupt(): void {
|
|
203
|
+
if (!this.process || !this.state.running) return;
|
|
204
|
+
try {
|
|
205
|
+
process.kill(-this.process.pid!, "SIGINT");
|
|
206
|
+
} catch {
|
|
207
|
+
// The shell may not own a process group anymore.
|
|
208
|
+
this.process.kill("SIGINT");
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
dispose(): void {
|
|
213
|
+
this.disposed = true;
|
|
214
|
+
this.readyPromise = null;
|
|
215
|
+
this.readyResolve = null;
|
|
216
|
+
this.readyReject = null;
|
|
217
|
+
if (!this.process) return;
|
|
218
|
+
try {
|
|
219
|
+
process.kill(-this.process.pid!, "SIGKILL");
|
|
220
|
+
} catch {
|
|
221
|
+
// The shell may not own a process group anymore.
|
|
222
|
+
this.process.kill("SIGKILL");
|
|
223
|
+
}
|
|
224
|
+
this.process = null;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
private sendRaw(text: string): void {
|
|
228
|
+
if (!this.process) return;
|
|
229
|
+
this.process.stdin.write(text);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
private handleChunk(chunk: string): void {
|
|
233
|
+
const sanitized = stripAnsi(chunk).replace(/\r/g, "");
|
|
234
|
+
if (!sanitized) return;
|
|
235
|
+
|
|
236
|
+
this.buffer += sanitized;
|
|
237
|
+
const parts = this.buffer.split("\n");
|
|
238
|
+
this.buffer = parts.pop() ?? "";
|
|
239
|
+
|
|
240
|
+
for (const rawLine of parts) {
|
|
241
|
+
const line = rawLine.trimEnd();
|
|
242
|
+
if (!this.state.ready) {
|
|
243
|
+
if (line.startsWith(`${READY_SENTINEL}:`)) {
|
|
244
|
+
this.state.ready = true;
|
|
245
|
+
this.state.cwd = line.slice(READY_SENTINEL.length + 1) || this.state.cwd;
|
|
246
|
+
this.readyResolve?.();
|
|
247
|
+
this.readyResolve = null;
|
|
248
|
+
this.readyReject = null;
|
|
249
|
+
this.onStateChange();
|
|
250
|
+
}
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (line.startsWith(`${COMMAND_START_SENTINEL}:`)) {
|
|
255
|
+
const [, id, cwd] = line.split(":");
|
|
256
|
+
if (cwd) this.state.cwd = cwd;
|
|
257
|
+
this.currentCommandId = id ?? this.currentCommandId;
|
|
258
|
+
this.onStateChange();
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (line.startsWith(`${COMMAND_DONE_SENTINEL}:`)) {
|
|
263
|
+
const [, id, exitCodeText, cwd] = line.split(":");
|
|
264
|
+
const exitCode = Number.parseInt(exitCodeText ?? "1", 10);
|
|
265
|
+
this.state.running = false;
|
|
266
|
+
this.state.lastExitCode = Number.isFinite(exitCode) ? exitCode : 1;
|
|
267
|
+
if (cwd) this.state.cwd = cwd;
|
|
268
|
+
if (id) {
|
|
269
|
+
this.transcript.finishCommand(id, this.state.lastExitCode);
|
|
270
|
+
const snapshot = this.transcript.getSnapshot();
|
|
271
|
+
const command = snapshot.commands.find((entry) => entry.id === id);
|
|
272
|
+
if (command && this.state.lastExitCode === 0) {
|
|
273
|
+
this.onCommandSuccess(command.command, this.state.cwd);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
this.currentCommandId = null;
|
|
277
|
+
this.onStateChange();
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (!this.currentCommandId) continue;
|
|
282
|
+
this.transcript.appendOutput(this.currentCommandId, line);
|
|
283
|
+
this.onStateChange();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { BashCommandRecord, BashModeSettings, BashTranscriptSnapshot } from "./types.ts";
|
|
2
|
+
|
|
3
|
+
function byteLength(value: string): number {
|
|
4
|
+
return Buffer.byteLength(value, "utf8");
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function compactLines(lines: string[]): string[] {
|
|
8
|
+
const normalized: string[] = [];
|
|
9
|
+
for (const line of lines) {
|
|
10
|
+
const sanitized = line.replace(/\r/g, "");
|
|
11
|
+
if (sanitized.length === 0) {
|
|
12
|
+
normalized.push("");
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
normalized.push(...sanitized.split("\n"));
|
|
16
|
+
}
|
|
17
|
+
return normalized;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class BashTranscriptStore {
|
|
21
|
+
private readonly settings: Pick<BashModeSettings, "transcriptMaxLines" | "transcriptMaxBytes">;
|
|
22
|
+
private commands: BashCommandRecord[] = [];
|
|
23
|
+
private commandIndex = new Map<string, BashCommandRecord>();
|
|
24
|
+
private totalLines = 0;
|
|
25
|
+
private totalBytes = 0;
|
|
26
|
+
private truncatedCommands = 0;
|
|
27
|
+
|
|
28
|
+
constructor(settings: Pick<BashModeSettings, "transcriptMaxLines" | "transcriptMaxBytes">) {
|
|
29
|
+
this.settings = settings;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
startCommand(id: string, command: string, cwdAtStart: string): BashCommandRecord {
|
|
33
|
+
const entry: BashCommandRecord = {
|
|
34
|
+
id,
|
|
35
|
+
command,
|
|
36
|
+
cwdAtStart,
|
|
37
|
+
startedAt: Date.now(),
|
|
38
|
+
output: [],
|
|
39
|
+
outputBytes: 0,
|
|
40
|
+
exitCode: null,
|
|
41
|
+
finishedAt: null,
|
|
42
|
+
truncated: false,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
this.commands.push(entry);
|
|
46
|
+
this.commandIndex.set(id, entry);
|
|
47
|
+
this.enforceLimits();
|
|
48
|
+
return entry;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
appendOutput(id: string, chunk: string): void {
|
|
52
|
+
const entry = this.commandIndex.get(id);
|
|
53
|
+
if (!entry || !chunk) return;
|
|
54
|
+
|
|
55
|
+
const lines = compactLines([chunk]);
|
|
56
|
+
if (lines.length === 0) return;
|
|
57
|
+
|
|
58
|
+
entry.output.push(...lines);
|
|
59
|
+
const addedBytes = lines.reduce((sum, line) => sum + byteLength(line) + 1, 0);
|
|
60
|
+
entry.outputBytes += addedBytes;
|
|
61
|
+
this.totalLines += lines.length;
|
|
62
|
+
this.totalBytes += addedBytes;
|
|
63
|
+
this.enforceLimits();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
finishCommand(id: string, exitCode: number): void {
|
|
67
|
+
const entry = this.commandIndex.get(id);
|
|
68
|
+
if (!entry) return;
|
|
69
|
+
|
|
70
|
+
entry.exitCode = exitCode;
|
|
71
|
+
entry.finishedAt = Date.now();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
clear(): void {
|
|
75
|
+
this.commands = [];
|
|
76
|
+
this.commandIndex.clear();
|
|
77
|
+
this.totalLines = 0;
|
|
78
|
+
this.totalBytes = 0;
|
|
79
|
+
this.truncatedCommands = 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
getSnapshot(): BashTranscriptSnapshot {
|
|
83
|
+
return {
|
|
84
|
+
commands: this.commands.map((command) => ({
|
|
85
|
+
...command,
|
|
86
|
+
output: [...command.output],
|
|
87
|
+
})),
|
|
88
|
+
totalLines: this.totalLines,
|
|
89
|
+
totalBytes: this.totalBytes,
|
|
90
|
+
truncatedCommands: this.truncatedCommands,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private enforceLimits(): void {
|
|
95
|
+
while (
|
|
96
|
+
this.commands.length > 1
|
|
97
|
+
&& (this.totalLines > this.settings.transcriptMaxLines || this.totalBytes > this.settings.transcriptMaxBytes)
|
|
98
|
+
) {
|
|
99
|
+
const removed = this.commands.shift();
|
|
100
|
+
if (!removed) break;
|
|
101
|
+
this.commandIndex.delete(removed.id);
|
|
102
|
+
this.totalLines = Math.max(0, this.totalLines - removed.output.length);
|
|
103
|
+
this.totalBytes = Math.max(0, this.totalBytes - removed.outputBytes);
|
|
104
|
+
this.truncatedCommands += 1;
|
|
105
|
+
removed.truncated = true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface BashModeSettings {
|
|
2
|
+
toggleShortcut: string;
|
|
3
|
+
transcriptMaxLines: number;
|
|
4
|
+
transcriptMaxBytes: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface BashCommandRecord {
|
|
8
|
+
id: string;
|
|
9
|
+
command: string;
|
|
10
|
+
startedAt: number;
|
|
11
|
+
cwdAtStart: string;
|
|
12
|
+
output: string[];
|
|
13
|
+
outputBytes: number;
|
|
14
|
+
exitCode: number | null;
|
|
15
|
+
finishedAt: number | null;
|
|
16
|
+
truncated: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface BashTranscriptSnapshot {
|
|
20
|
+
commands: BashCommandRecord[];
|
|
21
|
+
totalLines: number;
|
|
22
|
+
totalBytes: number;
|
|
23
|
+
truncatedCommands: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface GhostSuggestion {
|
|
27
|
+
value: string;
|
|
28
|
+
source:
|
|
29
|
+
| "project-history"
|
|
30
|
+
| "global-history"
|
|
31
|
+
| "git"
|
|
32
|
+
| "path"
|
|
33
|
+
| "executable";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ExtendedCompletionItem {
|
|
37
|
+
value: string;
|
|
38
|
+
label: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
replacement: string;
|
|
41
|
+
startCol: number;
|
|
42
|
+
endCol: number;
|
|
43
|
+
source:
|
|
44
|
+
| "project-history"
|
|
45
|
+
| "global-history"
|
|
46
|
+
| "git"
|
|
47
|
+
| "path"
|
|
48
|
+
| "executable";
|
|
49
|
+
score: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ShellSessionState {
|
|
53
|
+
ready: boolean;
|
|
54
|
+
running: boolean;
|
|
55
|
+
shellPath: string;
|
|
56
|
+
shellName: string;
|
|
57
|
+
cwd: string;
|
|
58
|
+
lastExitCode: number | null;
|
|
59
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// ANSI escape codes for colors
|
|
2
|
+
// Matching oh-my-pi dark theme colors exactly
|
|
3
|
+
|
|
4
|
+
export interface AnsiColors {
|
|
5
|
+
getBgAnsi(r: number, g: number, b: number): string;
|
|
6
|
+
getFgAnsi(r: number, g: number, b: number): string;
|
|
7
|
+
getFgAnsi256(code: number): string;
|
|
8
|
+
reset: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ansi: AnsiColors = {
|
|
12
|
+
getBgAnsi: (r, g, b) => `\x1b[48;2;${r};${g};${b}m`,
|
|
13
|
+
getFgAnsi: (r, g, b) => `\x1b[38;2;${r};${g};${b}m`,
|
|
14
|
+
getFgAnsi256: (code) => `\x1b[38;5;${code}m`,
|
|
15
|
+
reset: "\x1b[0m",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// Convert hex to RGB tuple
|
|
19
|
+
function hexToRgb(hex: string): [number, number, number] {
|
|
20
|
+
const h = hex.replace("#", "");
|
|
21
|
+
return [
|
|
22
|
+
parseInt(h.slice(0, 2), 16),
|
|
23
|
+
parseInt(h.slice(2, 4), 16),
|
|
24
|
+
parseInt(h.slice(4, 6), 16),
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Colors used by welcome/editor chrome rendering
|
|
29
|
+
const THEME = {
|
|
30
|
+
sep: 244, // ANSI 256 gray
|
|
31
|
+
model: "#d787af", // Pink/mauve
|
|
32
|
+
path: "#00afaf", // Teal/cyan
|
|
33
|
+
gitClean: "#5faf5f", // Green
|
|
34
|
+
accent: "#febc38", // Orange
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Color name to ANSI code mapping
|
|
38
|
+
type ColorName = "sep" | "model" | "path" | "gitClean" | "accent";
|
|
39
|
+
|
|
40
|
+
function getAnsiCode(color: ColorName): string {
|
|
41
|
+
const value = THEME[color as keyof typeof THEME];
|
|
42
|
+
|
|
43
|
+
if (value === undefined || value === "") {
|
|
44
|
+
return ""; // No color, use terminal default
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (typeof value === "number") {
|
|
48
|
+
return ansi.getFgAnsi256(value);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof value === "string" && value.startsWith("#")) {
|
|
52
|
+
const [r, g, b] = hexToRgb(value);
|
|
53
|
+
return ansi.getFgAnsi(r, g, b);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return "";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Helper to apply foreground color only (no reset - caller manages reset)
|
|
60
|
+
export function fgOnly(color: ColorName, text: string): string {
|
|
61
|
+
const code = getAnsiCode(color);
|
|
62
|
+
return code ? `${code}${text}` : text;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Get raw ANSI code for a color
|
|
66
|
+
export function getFgAnsiCode(color: ColorName): string {
|
|
67
|
+
return getAnsiCode(color);
|
|
68
|
+
}
|
|
69
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
interface CoreContextUsage {
|
|
2
|
+
contextTokens: number;
|
|
3
|
+
contextWindow: number;
|
|
4
|
+
contextPercent: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
8
|
+
return typeof value === "object" && value !== null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function readCoreContextUsage(ctx: unknown): CoreContextUsage | null {
|
|
12
|
+
if (!isRecord(ctx) || typeof ctx.getContextUsage !== "function") {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const usage = ctx.getContextUsage();
|
|
17
|
+
if (!isRecord(usage)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const tokens = usage.tokens;
|
|
22
|
+
const contextWindow = usage.contextWindow;
|
|
23
|
+
if (
|
|
24
|
+
typeof tokens !== "number"
|
|
25
|
+
|| !Number.isFinite(tokens)
|
|
26
|
+
|| typeof contextWindow !== "number"
|
|
27
|
+
|| !Number.isFinite(contextWindow)
|
|
28
|
+
|| contextWindow <= 0
|
|
29
|
+
) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const percent = usage.percent;
|
|
34
|
+
return {
|
|
35
|
+
contextTokens: tokens,
|
|
36
|
+
contextWindow,
|
|
37
|
+
contextPercent: typeof percent === "number" && Number.isFinite(percent)
|
|
38
|
+
? percent
|
|
39
|
+
: (tokens / contextWindow) * 100,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
2
|
+
|
|
3
|
+
export const CURSOR_MARKER = "\x1b_pi:c\x07";
|
|
4
|
+
|
|
5
|
+
export interface FixedEditorClusterInput {
|
|
6
|
+
width: number;
|
|
7
|
+
terminalRows: number;
|
|
8
|
+
statusLines?: string[];
|
|
9
|
+
topLines?: string[];
|
|
10
|
+
editorLines: string[];
|
|
11
|
+
secondaryLines?: string[];
|
|
12
|
+
transcriptLines?: string[];
|
|
13
|
+
lastPromptLines?: string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface FixedEditorCursor {
|
|
17
|
+
row: number;
|
|
18
|
+
col: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface FixedEditorClusterRender {
|
|
22
|
+
lines: string[];
|
|
23
|
+
cursor: FixedEditorCursor | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function normalizeLines(lines: string[] | undefined, width: number): string[] {
|
|
27
|
+
if (!lines || width <= 0) return [];
|
|
28
|
+
|
|
29
|
+
return lines
|
|
30
|
+
.filter((line) => line !== undefined && line !== null)
|
|
31
|
+
.map((line) => visibleWidth(line) > width ? truncateToWidth(line, width, "", true) : line);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function takeTail(lines: string[], count: number): string[] {
|
|
35
|
+
if (count <= 0) return [];
|
|
36
|
+
return lines.length <= count ? lines : lines.slice(lines.length - count);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function capEditorLines(lines: string[], count: number): string[] {
|
|
40
|
+
if (count <= 0) return [];
|
|
41
|
+
if (lines.length <= count) return lines;
|
|
42
|
+
|
|
43
|
+
const cursorRow = lines.findIndex((line) => line.includes(CURSOR_MARKER));
|
|
44
|
+
if (cursorRow !== -1) {
|
|
45
|
+
const start = Math.max(0, Math.min(cursorRow - count + 1, lines.length - count));
|
|
46
|
+
return lines.slice(start, start + count);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const selectedRow = lines.findIndex((line) => line.replace(/\x1b\[[0-9;]*m/g, "").trimStart().startsWith("→ "));
|
|
50
|
+
if (selectedRow === -1) {
|
|
51
|
+
return lines.slice(0, count);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const start = Math.max(0, Math.min(selectedRow - Math.floor(count / 2), lines.length - count));
|
|
55
|
+
return lines.slice(start, start + count);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function extractCursor(lines: string[]): FixedEditorClusterRender {
|
|
59
|
+
let cursor: FixedEditorCursor | null = null;
|
|
60
|
+
const cleaned = lines.map((line, row) => {
|
|
61
|
+
const markerIndex = line.indexOf(CURSOR_MARKER);
|
|
62
|
+
if (markerIndex === -1) return line;
|
|
63
|
+
|
|
64
|
+
if (!cursor) {
|
|
65
|
+
cursor = {
|
|
66
|
+
row,
|
|
67
|
+
col: visibleWidth(line.slice(0, markerIndex)),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return line.slice(0, markerIndex) + line.slice(markerIndex + CURSOR_MARKER.length);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return { lines: cleaned, cursor };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function renderFixedEditorCluster(input: FixedEditorClusterInput): FixedEditorClusterRender {
|
|
78
|
+
const width = Math.max(1, input.width);
|
|
79
|
+
const maxRows = Math.max(1, input.terminalRows - 1);
|
|
80
|
+
|
|
81
|
+
const statusLines = normalizeLines(input.statusLines, width);
|
|
82
|
+
const topLines = normalizeLines(input.topLines, width);
|
|
83
|
+
const editorSource = normalizeLines(input.editorLines, width);
|
|
84
|
+
const secondaryLines = normalizeLines(input.secondaryLines, width);
|
|
85
|
+
const transcriptLines = normalizeLines(input.transcriptLines, width);
|
|
86
|
+
const lastPromptLines = normalizeLines(input.lastPromptLines, width);
|
|
87
|
+
|
|
88
|
+
const editorLines = capEditorLines(editorSource, maxRows);
|
|
89
|
+
let remaining = maxRows - editorLines.length;
|
|
90
|
+
|
|
91
|
+
const top = takeTail(topLines, remaining);
|
|
92
|
+
remaining -= top.length;
|
|
93
|
+
|
|
94
|
+
const secondary = takeTail(secondaryLines, remaining);
|
|
95
|
+
remaining -= secondary.length;
|
|
96
|
+
|
|
97
|
+
const lastPrompt = takeTail(lastPromptLines, remaining);
|
|
98
|
+
remaining -= lastPrompt.length;
|
|
99
|
+
|
|
100
|
+
const status = takeTail(statusLines, remaining);
|
|
101
|
+
remaining -= status.length;
|
|
102
|
+
|
|
103
|
+
const transcript = takeTail(transcriptLines, remaining);
|
|
104
|
+
|
|
105
|
+
return extractCursor([
|
|
106
|
+
...status,
|
|
107
|
+
...top,
|
|
108
|
+
...editorLines,
|
|
109
|
+
...secondary,
|
|
110
|
+
...transcript,
|
|
111
|
+
...lastPrompt,
|
|
112
|
+
]);
|
|
113
|
+
}
|