iosm-cli 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/CHANGELOG.md +55 -0
- package/LICENSE +21 -0
- package/README.md +650 -0
- package/dist/cli/args.d.ts +54 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +331 -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 +79 -0
- package/dist/cli/file-processor.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 +92 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/session-picker.d.ts +9 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +34 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +15 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +88 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +262 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-profiles.d.ts +29 -0
- package/dist/core/agent-profiles.d.ts.map +1 -0
- package/dist/core/agent-profiles.js +86 -0
- package/dist/core/agent-profiles.js.map +1 -0
- package/dist/core/agent-session.d.ts +688 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +3112 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/agent-teams.d.ts +41 -0
- package/dist/core/agent-teams.d.ts.map +1 -0
- package/dist/core/agent-teams.js +90 -0
- package/dist/core/agent-teams.js.map +1 -0
- package/dist/core/ask-user-tool.d.ts +22 -0
- package/dist/core/ask-user-tool.d.ts.map +1 -0
- package/dist/core/ask-user-tool.js +115 -0
- package/dist/core/ask-user-tool.js.map +1 -0
- package/dist/core/auth-storage.d.ts +133 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +391 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +49 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +213 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +86 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +242 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +121 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +610 -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 +35 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +138 -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 +71 -0
- package/dist/core/exec.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 +34 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +222 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +971 -0
- package/dist/core/export-html/template.html +54 -0
- package/dist/core/export-html/template.js +1590 -0
- package/dist/core/export-html/tool-renderer.d.ts +35 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +63 -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 +6 -0
- package/dist/core/extensions/index.d.ts +11 -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 +25 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +447 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +146 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +652 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1074 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +35 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +27 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +102 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +32 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +134 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/hooks.d.ts +53 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/hooks.js +332 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +9 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/keybindings.d.ts +55 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +157 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/mcp/cli.d.ts +27 -0
- package/dist/core/mcp/cli.d.ts.map +1 -0
- package/dist/core/mcp/cli.js +275 -0
- package/dist/core/mcp/cli.js.map +1 -0
- package/dist/core/mcp/config.d.ts +11 -0
- package/dist/core/mcp/config.d.ts.map +1 -0
- package/dist/core/mcp/config.js +310 -0
- package/dist/core/mcp/config.js.map +1 -0
- package/dist/core/mcp/index.d.ts +5 -0
- package/dist/core/mcp/index.d.ts.map +1 -0
- package/dist/core/mcp/index.js +4 -0
- package/dist/core/mcp/index.js.map +1 -0
- package/dist/core/mcp/runtime.d.ts +42 -0
- package/dist/core/mcp/runtime.d.ts.map +1 -0
- package/dist/core/mcp/runtime.js +387 -0
- package/dist/core/mcp/runtime.js.map +1 -0
- package/dist/core/mcp/types.d.ts +76 -0
- package/dist/core/mcp/types.d.ts.map +1 -0
- package/dist/core/mcp/types.js +2 -0
- package/dist/core/mcp/types.js.map +1 -0
- package/dist/core/memory.d.ts +27 -0
- package/dist/core/memory.d.ts.map +1 -0
- package/dist/core/memory.js +203 -0
- package/dist/core/memory.js.map +1 -0
- package/dist/core/messages.d.ts +84 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +141 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-registry.d.ts +115 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +549 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +104 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +448 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/package-manager.d.ts +156 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +1465 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/parallel-task-agent.d.ts +19 -0
- package/dist/core/parallel-task-agent.d.ts.map +1 -0
- package/dist/core/parallel-task-agent.js +482 -0
- package/dist/core/parallel-task-agent.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +50 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +251 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/qwen-cli-provider.d.ts +10 -0
- package/dist/core/qwen-cli-provider.d.ts.map +1 -0
- package/dist/core/qwen-cli-provider.js +271 -0
- package/dist/core/qwen-cli-provider.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +17 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +60 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +195 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +820 -0
- package/dist/core/resource-loader.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 +460 -0
- package/dist/core/sdk.js.map +1 -0
- package/dist/core/session-manager.d.ts +323 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1094 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/settings-manager.d.ts +243 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +691 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +58 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +364 -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 +64 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/subagent-runs.d.ts +16 -0
- package/dist/core/subagent-runs.d.ts.map +1 -0
- package/dist/core/subagent-runs.js +70 -0
- package/dist/core/subagent-runs.js.map +1 -0
- package/dist/core/subagents.d.ts +45 -0
- package/dist/core/subagents.d.ts.map +1 -0
- package/dist/core/subagents.js +467 -0
- package/dist/core/subagents.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 +196 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/task-plan.d.ts +32 -0
- package/dist/core/task-plan.d.ts.map +1 -0
- package/dist/core/task-plan.js +155 -0
- package/dist/core/task-plan.js.map +1 -0
- package/dist/core/timings.d.ts +7 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +26 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +58 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +275 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +63 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +243 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +42 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +158 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/find.d.ts +39 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +219 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +45 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +254 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/ignore-filter.d.ts +5 -0
- package/dist/core/tools/ignore-filter.d.ts.map +1 -0
- package/dist/core/tools/ignore-filter.js +97 -0
- package/dist/core/tools/ignore-filter.js.map +1 -0
- package/dist/core/tools/index.d.ts +97 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +78 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +46 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +136 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +8 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +81 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/permissions.d.ts +8 -0
- package/dist/core/tools/permissions.d.ts.map +1 -0
- package/dist/core/tools/permissions.js +2 -0
- package/dist/core/tools/permissions.js.map +1 -0
- package/dist/core/tools/read.d.ts +39 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +166 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/task.d.ts +109 -0
- package/dist/core/tools/task.d.ts.map +1 -0
- package/dist/core/tools/task.js +1065 -0
- package/dist/core/tools/task.js.map +1 -0
- package/dist/core/tools/todo.d.ts +42 -0
- package/dist/core/tools/todo.d.ts.map +1 -0
- package/dist/core/tools/todo.js +159 -0
- package/dist/core/tools/todo.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 +205 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/write.d.ts +32 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +90 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/iosm/agent-verification.d.ts +16 -0
- package/dist/iosm/agent-verification.d.ts.map +1 -0
- package/dist/iosm/agent-verification.js +138 -0
- package/dist/iosm/agent-verification.js.map +1 -0
- package/dist/iosm/automation.d.ts +40 -0
- package/dist/iosm/automation.d.ts.map +1 -0
- package/dist/iosm/automation.js +76 -0
- package/dist/iosm/automation.js.map +1 -0
- package/dist/iosm/config.d.ts +151 -0
- package/dist/iosm/config.d.ts.map +1 -0
- package/dist/iosm/config.js +323 -0
- package/dist/iosm/config.js.map +1 -0
- package/dist/iosm/context-loader.d.ts +12 -0
- package/dist/iosm/context-loader.d.ts.map +1 -0
- package/dist/iosm/context-loader.js +50 -0
- package/dist/iosm/context-loader.js.map +1 -0
- package/dist/iosm/cycle.d.ts +51 -0
- package/dist/iosm/cycle.d.ts.map +1 -0
- package/dist/iosm/cycle.js +861 -0
- package/dist/iosm/cycle.js.map +1 -0
- package/dist/iosm/guide.d.ts +31 -0
- package/dist/iosm/guide.d.ts.map +1 -0
- package/dist/iosm/guide.js +101 -0
- package/dist/iosm/guide.js.map +1 -0
- package/dist/iosm/index.d.ts +12 -0
- package/dist/iosm/index.d.ts.map +1 -0
- package/dist/iosm/index.js +11 -0
- package/dist/iosm/index.js.map +1 -0
- package/dist/iosm/init.d.ts +58 -0
- package/dist/iosm/init.d.ts.map +1 -0
- package/dist/iosm/init.js +1221 -0
- package/dist/iosm/init.js.map +1 -0
- package/dist/iosm/metrics.d.ts +23 -0
- package/dist/iosm/metrics.d.ts.map +1 -0
- package/dist/iosm/metrics.js +336 -0
- package/dist/iosm/metrics.js.map +1 -0
- package/dist/iosm/paths.d.ts +24 -0
- package/dist/iosm/paths.d.ts.map +1 -0
- package/dist/iosm/paths.js +77 -0
- package/dist/iosm/paths.js.map +1 -0
- package/dist/iosm/runtime-context.d.ts +20 -0
- package/dist/iosm/runtime-context.d.ts.map +1 -0
- package/dist/iosm/runtime-context.js +170 -0
- package/dist/iosm/runtime-context.js.map +1 -0
- package/dist/iosm/types.d.ts +151 -0
- package/dist/iosm/types.d.ts.map +1 -0
- package/dist/iosm/types.js +3 -0
- package/dist/iosm/types.js.map +1 -0
- package/dist/main.d.ts +8 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +1478 -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 +261 -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/components/armin.d.ts +34 -0
- package/dist/modes/interactive/components/armin.d.ts.map +1 -0
- package/dist/modes/interactive/components/armin.js +329 -0
- package/dist/modes/interactive/components/armin.js.map +1 -0
- package/dist/modes/interactive/components/ascii-logo.d.ts +11 -0
- package/dist/modes/interactive/components/ascii-logo.d.ts.map +1 -0
- package/dist/modes/interactive/components/ascii-logo.js +25 -0
- package/dist/modes/interactive/components/ascii-logo.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +16 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +92 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +36 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +170 -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 +48 -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 +42 -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 +43 -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 +470 -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 +28 -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 +63 -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 +74 -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 +138 -0
- package/dist/modes/interactive/components/daxnuts.js.map +1 -0
- package/dist/modes/interactive/components/decrypt-loader.d.ts +25 -0
- package/dist/modes/interactive/components/decrypt-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/decrypt-loader.js +102 -0
- package/dist/modes/interactive/components/decrypt-loader.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 +20 -0
- package/dist/modes/interactive/components/dynamic-border.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 +105 -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 +55 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +24 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +71 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +39 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +285 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +33 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/dist/modes/interactive/components/index.js +34 -0
- package/dist/modes/interactive/components/index.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +50 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +85 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +42 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +139 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/mcp-selector.d.ts +31 -0
- package/dist/modes/interactive/components/mcp-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/mcp-selector.js +171 -0
- package/dist/modes/interactive/components/mcp-selector.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +51 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +292 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +19 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +134 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +49 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +271 -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 +839 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +60 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +311 -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 +34 -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 +45 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/subagent-message.d.ts +91 -0
- package/dist/modes/interactive/components/subagent-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/subagent-message.js +306 -0
- package/dist/modes/interactive/components/subagent-message.js.map +1 -0
- package/dist/modes/interactive/components/task-plan-message.d.ts +12 -0
- package/dist/modes/interactive/components/task-plan-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-plan-message.js +61 -0
- package/dist/modes/interactive/components/task-plan-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 +44 -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 +46 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +78 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +880 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +70 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +921 -0
- package/dist/modes/interactive/components/tree-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 +110 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +9 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +27 -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 +453 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +8669 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +85 -0
- package/dist/modes/interactive/theme/light.json +84 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +78 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +944 -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 +101 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +217 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +404 -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 +580 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +409 -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/utils/changelog.d.ts +21 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +87 -0
- package/dist/utils/changelog.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 +162 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +7 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +14 -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 +67 -0
- package/dist/utils/clipboard.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/git.d.ts +26 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +163 -0
- package/dist/utils/git.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 +35 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-resize.d.ts +36 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +181 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/mime.d.ts +2 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +26 -0
- package/dist/utils/mime.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/shell.d.ts +26 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +186 -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/tools-manager.d.ts +3 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +251 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/docs/README.md +32 -0
- package/docs/cli-reference.md +342 -0
- package/docs/configuration.md +301 -0
- package/docs/development-and-testing.md +295 -0
- package/docs/extensions-packages-themes.md +415 -0
- package/docs/getting-started.md +246 -0
- package/docs/interactive-mode.md +272 -0
- package/docs/iosm-init-and-cycles.md +355 -0
- package/docs/orchestration-and-subagents.md +273 -0
- package/docs/rpc-json-sdk.md +353 -0
- package/docs/sessions-traces-export.md +260 -0
- package/examples/README.md +120 -0
- package/examples/extensions/README.md +306 -0
- package/examples/extensions/antigravity-image-gen.ts +415 -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/built-in-tool-renderer.ts +246 -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 +114 -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 +349 -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/custom-provider-qwen-cli/index.ts +345 -0
- package/examples/extensions/custom-provider-qwen-cli/package.json +16 -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/handoff.ts +150 -0
- package/examples/extensions/hello.ts +25 -0
- package/examples/extensions/inline-bash.ts +94 -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 +881 -0
- package/examples/extensions/overlay-test.ts +150 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +65 -0
- package/examples/extensions/plan-mode/index.ts +340 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +398 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/qna.ts +119 -0
- package/examples/extensions/question.ts +264 -0
- package/examples/extensions/questionnaire.ts +427 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +124 -0
- package/examples/extensions/sandbox/index.ts +318 -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 +40 -0
- package/examples/extensions/subagent/README.md +172 -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 +964 -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 +195 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +299 -0
- package/examples/extensions/tool-override.ts +143 -0
- package/examples/extensions/tools.ts +146 -0
- package/examples/extensions/trigger-compact.ts +40 -0
- package/examples/extensions/truncated-tool.ts +192 -0
- package/examples/extensions/widget-placement.ts +17 -0
- package/examples/extensions/with-deps/index.ts +36 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/rpc-extension-ui.ts +632 -0
- package/examples/sdk/01-minimal.ts +22 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +55 -0
- package/examples/sdk/04-skills.ts +46 -0
- package/examples/sdk/05-tools.ts +56 -0
- package/examples/sdk/06-extensions.ts +88 -0
- package/examples/sdk/07-context-files.ts +40 -0
- package/examples/sdk/08-prompt-templates.ts +47 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +48 -0
- package/examples/sdk/10-settings.ts +51 -0
- package/examples/sdk/11-sessions.ts +48 -0
- package/examples/sdk/12-full-control.ts +82 -0
- package/examples/sdk/README.md +337 -0
- package/examples/tsconfig.json +3 -0
- package/package.json +107 -0
|
@@ -0,0 +1,881 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlay QA Tests - comprehensive overlay positioning and edge case tests
|
|
3
|
+
*
|
|
4
|
+
* Usage: pi --extension ./examples/extensions/overlay-qa-tests.ts
|
|
5
|
+
*
|
|
6
|
+
* Commands:
|
|
7
|
+
* /overlay-animation - Real-time animation demo (~30 FPS, proves DOOM-like rendering works)
|
|
8
|
+
* /overlay-anchors - Cycle through all 9 anchor positions
|
|
9
|
+
* /overlay-margins - Test margin and offset options
|
|
10
|
+
* /overlay-stack - Test stacked overlays
|
|
11
|
+
* /overlay-overflow - Test width overflow with streaming process output
|
|
12
|
+
* /overlay-edge - Test overlay positioned at terminal edge
|
|
13
|
+
* /overlay-percent - Test percentage-based positioning
|
|
14
|
+
* /overlay-maxheight - Test maxHeight truncation
|
|
15
|
+
* /overlay-sidepanel - Responsive sidepanel (hides when terminal < 100 cols)
|
|
16
|
+
* /overlay-toggle - Toggle visibility demo (demonstrates OverlayHandle.setHidden)
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import type { ExtensionAPI, ExtensionCommandContext, Theme } from "iosm-cli";
|
|
20
|
+
import type { OverlayAnchor, OverlayHandle, OverlayOptions, TUI } from "@mariozechner/pi-tui";
|
|
21
|
+
import { matchesKey, truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
|
|
22
|
+
import { spawn } from "child_process";
|
|
23
|
+
|
|
24
|
+
// Global handle for toggle demo (in real code, use a more elegant pattern)
|
|
25
|
+
let globalToggleHandle: OverlayHandle | null = null;
|
|
26
|
+
|
|
27
|
+
export default function (pi: ExtensionAPI) {
|
|
28
|
+
// Animation demo - proves overlays can handle real-time updates (like pi-doom would need)
|
|
29
|
+
pi.registerCommand("overlay-animation", {
|
|
30
|
+
description: "Test real-time animation in overlay (~30 FPS)",
|
|
31
|
+
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
32
|
+
await ctx.ui.custom<void>((tui, theme, _kb, done) => new AnimationDemoComponent(tui, theme, done), {
|
|
33
|
+
overlay: true,
|
|
34
|
+
overlayOptions: { anchor: "center", width: 50, maxHeight: 20 },
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Test all 9 anchor positions
|
|
40
|
+
pi.registerCommand("overlay-anchors", {
|
|
41
|
+
description: "Cycle through all anchor positions",
|
|
42
|
+
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
43
|
+
const anchors: OverlayAnchor[] = [
|
|
44
|
+
"top-left",
|
|
45
|
+
"top-center",
|
|
46
|
+
"top-right",
|
|
47
|
+
"left-center",
|
|
48
|
+
"center",
|
|
49
|
+
"right-center",
|
|
50
|
+
"bottom-left",
|
|
51
|
+
"bottom-center",
|
|
52
|
+
"bottom-right",
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
let index = 0;
|
|
56
|
+
while (true) {
|
|
57
|
+
const result = await ctx.ui.custom<"next" | "confirm" | "cancel">(
|
|
58
|
+
(_tui, theme, _kb, done) => new AnchorTestComponent(theme, anchors[index]!, done),
|
|
59
|
+
{
|
|
60
|
+
overlay: true,
|
|
61
|
+
overlayOptions: { anchor: anchors[index], width: 40 },
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
if (result === "next") {
|
|
66
|
+
index = (index + 1) % anchors.length;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (result === "confirm") {
|
|
70
|
+
ctx.ui.notify(`Selected: ${anchors[index]}`, "info");
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Test margins and offsets
|
|
78
|
+
pi.registerCommand("overlay-margins", {
|
|
79
|
+
description: "Test margin and offset options",
|
|
80
|
+
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
81
|
+
const configs: { name: string; options: OverlayOptions }[] = [
|
|
82
|
+
{ name: "No margin (top-left)", options: { anchor: "top-left", width: 35 } },
|
|
83
|
+
{ name: "Margin: 3 all sides", options: { anchor: "top-left", width: 35, margin: 3 } },
|
|
84
|
+
{
|
|
85
|
+
name: "Margin: top=5, left=10",
|
|
86
|
+
options: { anchor: "top-left", width: 35, margin: { top: 5, left: 10 } },
|
|
87
|
+
},
|
|
88
|
+
{ name: "Center + offset (10, -3)", options: { anchor: "center", width: 35, offsetX: 10, offsetY: -3 } },
|
|
89
|
+
{ name: "Bottom-right, margin: 2", options: { anchor: "bottom-right", width: 35, margin: 2 } },
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
let index = 0;
|
|
93
|
+
while (true) {
|
|
94
|
+
const result = await ctx.ui.custom<"next" | "close">(
|
|
95
|
+
(_tui, theme, _kb, done) => new MarginTestComponent(theme, configs[index]!, done),
|
|
96
|
+
{
|
|
97
|
+
overlay: true,
|
|
98
|
+
overlayOptions: configs[index]!.options,
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
if (result === "next") {
|
|
103
|
+
index = (index + 1) % configs.length;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// Test stacked overlays
|
|
112
|
+
pi.registerCommand("overlay-stack", {
|
|
113
|
+
description: "Test stacked overlays",
|
|
114
|
+
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
115
|
+
// Three large overlays that overlap in the center area
|
|
116
|
+
// Each offset slightly so you can see the stacking
|
|
117
|
+
|
|
118
|
+
ctx.ui.notify("Showing overlay 1 (back)...", "info");
|
|
119
|
+
const p1 = ctx.ui.custom<string>(
|
|
120
|
+
(_tui, theme, _kb, done) => new StackOverlayComponent(theme, 1, "back (red border)", done),
|
|
121
|
+
{
|
|
122
|
+
overlay: true,
|
|
123
|
+
overlayOptions: { anchor: "center", width: 50, offsetX: -8, offsetY: -4, maxHeight: 15 },
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
await sleep(400);
|
|
128
|
+
|
|
129
|
+
ctx.ui.notify("Showing overlay 2 (middle)...", "info");
|
|
130
|
+
const p2 = ctx.ui.custom<string>(
|
|
131
|
+
(_tui, theme, _kb, done) => new StackOverlayComponent(theme, 2, "middle (green border)", done),
|
|
132
|
+
{
|
|
133
|
+
overlay: true,
|
|
134
|
+
overlayOptions: { anchor: "center", width: 50, offsetX: 0, offsetY: 0, maxHeight: 15 },
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
await sleep(400);
|
|
139
|
+
|
|
140
|
+
ctx.ui.notify("Showing overlay 3 (front)...", "info");
|
|
141
|
+
const p3 = ctx.ui.custom<string>(
|
|
142
|
+
(_tui, theme, _kb, done) => new StackOverlayComponent(theme, 3, "front (blue border)", done),
|
|
143
|
+
{
|
|
144
|
+
overlay: true,
|
|
145
|
+
overlayOptions: { anchor: "center", width: 50, offsetX: 8, offsetY: 4, maxHeight: 15 },
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
// Wait for all to close
|
|
150
|
+
const results = await Promise.all([p1, p2, p3]);
|
|
151
|
+
ctx.ui.notify(`Closed in order: ${results.join(", ")}`, "info");
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// Test width overflow scenarios (original crash case) - streams real process output
|
|
156
|
+
pi.registerCommand("overlay-overflow", {
|
|
157
|
+
description: "Test width overflow with streaming process output",
|
|
158
|
+
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
159
|
+
await ctx.ui.custom<void>((tui, theme, _kb, done) => new StreamingOverflowComponent(tui, theme, done), {
|
|
160
|
+
overlay: true,
|
|
161
|
+
overlayOptions: { anchor: "center", width: 90, maxHeight: 20 },
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Test overlay at terminal edge
|
|
167
|
+
pi.registerCommand("overlay-edge", {
|
|
168
|
+
description: "Test overlay positioned at terminal edge",
|
|
169
|
+
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
170
|
+
await ctx.ui.custom<void>((_tui, theme, _kb, done) => new EdgeTestComponent(theme, done), {
|
|
171
|
+
overlay: true,
|
|
172
|
+
overlayOptions: { anchor: "right-center", width: 40, margin: { right: 0 } },
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Test percentage-based positioning
|
|
178
|
+
pi.registerCommand("overlay-percent", {
|
|
179
|
+
description: "Test percentage-based positioning",
|
|
180
|
+
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
181
|
+
const configs = [
|
|
182
|
+
{ name: "rowPercent: 0 (top)", row: 0, col: 50 },
|
|
183
|
+
{ name: "rowPercent: 50 (middle)", row: 50, col: 50 },
|
|
184
|
+
{ name: "rowPercent: 100 (bottom)", row: 100, col: 50 },
|
|
185
|
+
{ name: "colPercent: 0 (left)", row: 50, col: 0 },
|
|
186
|
+
{ name: "colPercent: 100 (right)", row: 50, col: 100 },
|
|
187
|
+
];
|
|
188
|
+
|
|
189
|
+
let index = 0;
|
|
190
|
+
while (true) {
|
|
191
|
+
const config = configs[index]!;
|
|
192
|
+
const result = await ctx.ui.custom<"next" | "close">(
|
|
193
|
+
(_tui, theme, _kb, done) => new PercentTestComponent(theme, config, done),
|
|
194
|
+
{
|
|
195
|
+
overlay: true,
|
|
196
|
+
overlayOptions: {
|
|
197
|
+
width: 30,
|
|
198
|
+
row: `${config.row}%`,
|
|
199
|
+
col: `${config.col}%`,
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
if (result === "next") {
|
|
205
|
+
index = (index + 1) % configs.length;
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// Test maxHeight
|
|
214
|
+
pi.registerCommand("overlay-maxheight", {
|
|
215
|
+
description: "Test maxHeight truncation",
|
|
216
|
+
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
217
|
+
await ctx.ui.custom<void>((_tui, theme, _kb, done) => new MaxHeightTestComponent(theme, done), {
|
|
218
|
+
overlay: true,
|
|
219
|
+
overlayOptions: { anchor: "center", width: 50, maxHeight: 10 },
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// Test responsive sidepanel - only shows when terminal is wide enough
|
|
225
|
+
pi.registerCommand("overlay-sidepanel", {
|
|
226
|
+
description: "Test responsive sidepanel (hides when terminal < 100 cols)",
|
|
227
|
+
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
228
|
+
await ctx.ui.custom<void>((tui, theme, _kb, done) => new SidepanelComponent(tui, theme, done), {
|
|
229
|
+
overlay: true,
|
|
230
|
+
overlayOptions: {
|
|
231
|
+
anchor: "right-center",
|
|
232
|
+
width: "25%",
|
|
233
|
+
minWidth: 30,
|
|
234
|
+
margin: { right: 1 },
|
|
235
|
+
// Only show when terminal is wide enough
|
|
236
|
+
visible: (termWidth) => termWidth >= 100,
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
// Test toggle overlay - demonstrates OverlayHandle.setHidden() via onHandle callback
|
|
243
|
+
pi.registerCommand("overlay-toggle", {
|
|
244
|
+
description: "Test overlay toggle (press 't' to toggle visibility)",
|
|
245
|
+
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
246
|
+
await ctx.ui.custom<void>((tui, theme, _kb, done) => new ToggleDemoComponent(tui, theme, done), {
|
|
247
|
+
overlay: true,
|
|
248
|
+
overlayOptions: { anchor: "center", width: 50 },
|
|
249
|
+
// onHandle callback provides access to the OverlayHandle for visibility control
|
|
250
|
+
onHandle: (handle) => {
|
|
251
|
+
// Store handle globally so component can access it
|
|
252
|
+
// (In real code, you'd use a more elegant pattern like a store or event emitter)
|
|
253
|
+
globalToggleHandle = handle;
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
globalToggleHandle = null;
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function sleep(ms: number): Promise<void> {
|
|
262
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Base overlay component with common rendering
|
|
266
|
+
abstract class BaseOverlay {
|
|
267
|
+
constructor(protected theme: Theme) {}
|
|
268
|
+
|
|
269
|
+
protected box(lines: string[], width: number, title?: string): string[] {
|
|
270
|
+
const th = this.theme;
|
|
271
|
+
const innerW = Math.max(1, width - 2);
|
|
272
|
+
const result: string[] = [];
|
|
273
|
+
|
|
274
|
+
const titleStr = title ? truncateToWidth(` ${title} `, innerW) : "";
|
|
275
|
+
const titleW = visibleWidth(titleStr);
|
|
276
|
+
const topLine = "─".repeat(Math.floor((innerW - titleW) / 2));
|
|
277
|
+
const topLine2 = "─".repeat(Math.max(0, innerW - titleW - topLine.length));
|
|
278
|
+
result.push(th.fg("border", `╭${topLine}`) + th.fg("accent", titleStr) + th.fg("border", `${topLine2}╮`));
|
|
279
|
+
|
|
280
|
+
for (const line of lines) {
|
|
281
|
+
result.push(th.fg("border", "│") + truncateToWidth(line, innerW, "...", true) + th.fg("border", "│"));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
result.push(th.fg("border", `╰${"─".repeat(innerW)}╯`));
|
|
285
|
+
return result;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
invalidate(): void {}
|
|
289
|
+
dispose(): void {}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Anchor position test
|
|
293
|
+
class AnchorTestComponent extends BaseOverlay {
|
|
294
|
+
constructor(
|
|
295
|
+
theme: Theme,
|
|
296
|
+
private anchor: OverlayAnchor,
|
|
297
|
+
private done: (result: "next" | "confirm" | "cancel") => void,
|
|
298
|
+
) {
|
|
299
|
+
super(theme);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
handleInput(data: string): void {
|
|
303
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
304
|
+
this.done("cancel");
|
|
305
|
+
} else if (matchesKey(data, "return")) {
|
|
306
|
+
this.done("confirm");
|
|
307
|
+
} else if (matchesKey(data, "space") || matchesKey(data, "right")) {
|
|
308
|
+
this.done("next");
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
render(width: number): string[] {
|
|
313
|
+
const th = this.theme;
|
|
314
|
+
return this.box(
|
|
315
|
+
[
|
|
316
|
+
"",
|
|
317
|
+
` Current: ${th.fg("accent", this.anchor)}`,
|
|
318
|
+
"",
|
|
319
|
+
` ${th.fg("dim", "Space/→ = next anchor")}`,
|
|
320
|
+
` ${th.fg("dim", "Enter = confirm")}`,
|
|
321
|
+
` ${th.fg("dim", "Esc = cancel")}`,
|
|
322
|
+
"",
|
|
323
|
+
],
|
|
324
|
+
width,
|
|
325
|
+
"Anchor Test",
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Margin/offset test
|
|
331
|
+
class MarginTestComponent extends BaseOverlay {
|
|
332
|
+
constructor(
|
|
333
|
+
theme: Theme,
|
|
334
|
+
private config: { name: string; options: OverlayOptions },
|
|
335
|
+
private done: (result: "next" | "close") => void,
|
|
336
|
+
) {
|
|
337
|
+
super(theme);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
handleInput(data: string): void {
|
|
341
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
342
|
+
this.done("close");
|
|
343
|
+
} else if (matchesKey(data, "space") || matchesKey(data, "right")) {
|
|
344
|
+
this.done("next");
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
render(width: number): string[] {
|
|
349
|
+
const th = this.theme;
|
|
350
|
+
return this.box(
|
|
351
|
+
[
|
|
352
|
+
"",
|
|
353
|
+
` ${th.fg("accent", this.config.name)}`,
|
|
354
|
+
"",
|
|
355
|
+
` ${th.fg("dim", "Space/→ = next config")}`,
|
|
356
|
+
` ${th.fg("dim", "Esc = close")}`,
|
|
357
|
+
"",
|
|
358
|
+
],
|
|
359
|
+
width,
|
|
360
|
+
"Margin Test",
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// Stacked overlay test
|
|
366
|
+
class StackOverlayComponent extends BaseOverlay {
|
|
367
|
+
constructor(
|
|
368
|
+
theme: Theme,
|
|
369
|
+
private num: number,
|
|
370
|
+
private position: string,
|
|
371
|
+
private done: (result: string) => void,
|
|
372
|
+
) {
|
|
373
|
+
super(theme);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
handleInput(data: string): void {
|
|
377
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c") || matchesKey(data, "return")) {
|
|
378
|
+
this.done(`Overlay ${this.num}`);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
render(width: number): string[] {
|
|
383
|
+
const th = this.theme;
|
|
384
|
+
// Use different colors for each overlay to show stacking
|
|
385
|
+
const colors = ["error", "success", "accent"] as const;
|
|
386
|
+
const color = colors[(this.num - 1) % colors.length]!;
|
|
387
|
+
const innerW = Math.max(1, width - 2);
|
|
388
|
+
const border = (char: string) => th.fg(color, char);
|
|
389
|
+
const padLine = (s: string) => truncateToWidth(s, innerW, "...", true);
|
|
390
|
+
const lines: string[] = [];
|
|
391
|
+
|
|
392
|
+
lines.push(border(`╭${"─".repeat(innerW)}╮`));
|
|
393
|
+
lines.push(border("│") + padLine(` Overlay ${th.fg("accent", `#${this.num}`)}`) + border("│"));
|
|
394
|
+
lines.push(border("│") + padLine(` Layer: ${th.fg(color, this.position)}`) + border("│"));
|
|
395
|
+
lines.push(border("│") + padLine("") + border("│"));
|
|
396
|
+
// Add extra lines to make it taller
|
|
397
|
+
for (let i = 0; i < 5; i++) {
|
|
398
|
+
lines.push(border("│") + padLine(` ${"░".repeat(innerW - 2)} `) + border("│"));
|
|
399
|
+
}
|
|
400
|
+
lines.push(border("│") + padLine("") + border("│"));
|
|
401
|
+
lines.push(border("│") + padLine(th.fg("dim", " Press Enter/Esc to close")) + border("│"));
|
|
402
|
+
lines.push(border(`╰${"─".repeat(innerW)}╯`));
|
|
403
|
+
|
|
404
|
+
return lines;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// Streaming overflow test - spawns real process with colored output (original crash scenario)
|
|
409
|
+
class StreamingOverflowComponent extends BaseOverlay {
|
|
410
|
+
private lines: string[] = [];
|
|
411
|
+
private proc: ReturnType<typeof spawn> | null = null;
|
|
412
|
+
private scrollOffset = 0;
|
|
413
|
+
private maxVisibleLines = 15;
|
|
414
|
+
private finished = false;
|
|
415
|
+
private disposed = false;
|
|
416
|
+
|
|
417
|
+
constructor(
|
|
418
|
+
private tui: TUI,
|
|
419
|
+
theme: Theme,
|
|
420
|
+
private done: () => void,
|
|
421
|
+
) {
|
|
422
|
+
super(theme);
|
|
423
|
+
this.startProcess();
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
private startProcess(): void {
|
|
427
|
+
// Run a command that produces many lines with ANSI colors
|
|
428
|
+
// Using find with -ls produces file listings, or use ls --color
|
|
429
|
+
this.proc = spawn("bash", [
|
|
430
|
+
"-c",
|
|
431
|
+
`
|
|
432
|
+
echo "Starting streaming overflow test (30+ seconds)..."
|
|
433
|
+
echo "This simulates subagent output with colors, hyperlinks, and long paths"
|
|
434
|
+
echo ""
|
|
435
|
+
for i in $(seq 1 100); do
|
|
436
|
+
# Simulate long file paths with OSC 8 hyperlinks (clickable) - tests width overflow
|
|
437
|
+
DIR="/Users/nicobailon/Documents/development/pi-mono/packages/coding-agent/src/modes/interactive"
|
|
438
|
+
FILE="\${DIR}/components/very-long-component-name-that-exceeds-width-\${i}.ts"
|
|
439
|
+
echo -e "\\033]8;;file://\${FILE}\\007▶ read: \${FILE}\\033]8;;\\007"
|
|
440
|
+
|
|
441
|
+
# Add some colored status messages with long text
|
|
442
|
+
if [ $((i % 5)) -eq 0 ]; then
|
|
443
|
+
echo -e " \\033[32m✓ Successfully processed \${i} files in /Users/nicobailon/Documents/development/pi-mono\\033[0m"
|
|
444
|
+
fi
|
|
445
|
+
if [ $((i % 7)) -eq 0 ]; then
|
|
446
|
+
echo -e " \\033[33m⚠ Warning: potential issue detected at line \${i} in very-long-component-name-that-exceeds-width.ts\\033[0m"
|
|
447
|
+
fi
|
|
448
|
+
if [ $((i % 11)) -eq 0 ]; then
|
|
449
|
+
echo -e " \\033[31m✗ Error: file not found /some/really/long/path/that/definitely/exceeds/the/overlay/width/limit/file-\${i}.ts\\033[0m"
|
|
450
|
+
fi
|
|
451
|
+
sleep 0.3
|
|
452
|
+
done
|
|
453
|
+
echo ""
|
|
454
|
+
echo -e "\\033[32m✓ Complete - 100 files processed in 30 seconds\\033[0m"
|
|
455
|
+
echo "Press Esc to close"
|
|
456
|
+
`,
|
|
457
|
+
]);
|
|
458
|
+
|
|
459
|
+
this.proc.stdout?.on("data", (data: Buffer) => {
|
|
460
|
+
if (this.disposed) return; // Guard against callbacks after dispose
|
|
461
|
+
const text = data.toString();
|
|
462
|
+
const newLines = text.split("\n");
|
|
463
|
+
for (const line of newLines) {
|
|
464
|
+
if (line) this.lines.push(line);
|
|
465
|
+
}
|
|
466
|
+
// Auto-scroll to bottom
|
|
467
|
+
this.scrollOffset = Math.max(0, this.lines.length - this.maxVisibleLines);
|
|
468
|
+
this.tui.requestRender();
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
this.proc.stderr?.on("data", (data: Buffer) => {
|
|
472
|
+
if (this.disposed) return; // Guard against callbacks after dispose
|
|
473
|
+
this.lines.push(this.theme.fg("error", data.toString().trim()));
|
|
474
|
+
this.tui.requestRender();
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
this.proc.on("close", () => {
|
|
478
|
+
if (this.disposed) return; // Guard against callbacks after dispose
|
|
479
|
+
this.finished = true;
|
|
480
|
+
this.tui.requestRender();
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
handleInput(data: string): void {
|
|
485
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
486
|
+
this.proc?.kill();
|
|
487
|
+
this.done();
|
|
488
|
+
} else if (matchesKey(data, "up")) {
|
|
489
|
+
this.scrollOffset = Math.max(0, this.scrollOffset - 1);
|
|
490
|
+
this.tui.requestRender(); // Trigger re-render after scroll
|
|
491
|
+
} else if (matchesKey(data, "down")) {
|
|
492
|
+
this.scrollOffset = Math.min(Math.max(0, this.lines.length - this.maxVisibleLines), this.scrollOffset + 1);
|
|
493
|
+
this.tui.requestRender(); // Trigger re-render after scroll
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
render(width: number): string[] {
|
|
498
|
+
const th = this.theme;
|
|
499
|
+
const innerW = Math.max(1, width - 2);
|
|
500
|
+
const padLine = (s: string) => truncateToWidth(s, innerW, "...", true);
|
|
501
|
+
const border = (c: string) => th.fg("border", c);
|
|
502
|
+
|
|
503
|
+
const result: string[] = [];
|
|
504
|
+
const title = truncateToWidth(` Streaming Output (${this.lines.length} lines) `, innerW);
|
|
505
|
+
const titlePad = Math.max(0, innerW - visibleWidth(title));
|
|
506
|
+
result.push(border("╭") + th.fg("accent", title) + border(`${"─".repeat(titlePad)}╮`));
|
|
507
|
+
|
|
508
|
+
// Scroll indicators
|
|
509
|
+
const canScrollUp = this.scrollOffset > 0;
|
|
510
|
+
const canScrollDown = this.scrollOffset < this.lines.length - this.maxVisibleLines;
|
|
511
|
+
const scrollInfo = `↑${this.scrollOffset} | ↓${Math.max(0, this.lines.length - this.maxVisibleLines - this.scrollOffset)}`;
|
|
512
|
+
|
|
513
|
+
result.push(
|
|
514
|
+
border("│") + padLine(canScrollUp || canScrollDown ? th.fg("dim", ` ${scrollInfo}`) : "") + border("│"),
|
|
515
|
+
);
|
|
516
|
+
|
|
517
|
+
// Visible lines - truncate long lines to fit within border
|
|
518
|
+
const visibleLines = this.lines.slice(this.scrollOffset, this.scrollOffset + this.maxVisibleLines);
|
|
519
|
+
for (const line of visibleLines) {
|
|
520
|
+
result.push(border("│") + padLine(` ${line}`) + border("│"));
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// Pad to maxVisibleLines
|
|
524
|
+
for (let i = visibleLines.length; i < this.maxVisibleLines; i++) {
|
|
525
|
+
result.push(border("│") + padLine("") + border("│"));
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
const status = this.finished ? th.fg("success", "✓ Done") : th.fg("warning", "● Running");
|
|
529
|
+
result.push(border("│") + padLine(` ${status} ${th.fg("dim", "| ↑↓ scroll | Esc close")}`) + border("│"));
|
|
530
|
+
result.push(border(`╰${"─".repeat(innerW)}╯`));
|
|
531
|
+
|
|
532
|
+
return result;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
dispose(): void {
|
|
536
|
+
this.disposed = true;
|
|
537
|
+
this.proc?.kill();
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// Edge position test
|
|
542
|
+
class EdgeTestComponent extends BaseOverlay {
|
|
543
|
+
constructor(
|
|
544
|
+
theme: Theme,
|
|
545
|
+
private done: () => void,
|
|
546
|
+
) {
|
|
547
|
+
super(theme);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
handleInput(data: string): void {
|
|
551
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
552
|
+
this.done();
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
render(width: number): string[] {
|
|
557
|
+
const th = this.theme;
|
|
558
|
+
return this.box(
|
|
559
|
+
[
|
|
560
|
+
"",
|
|
561
|
+
" This overlay is at the",
|
|
562
|
+
" right edge of terminal.",
|
|
563
|
+
"",
|
|
564
|
+
` ${th.fg("dim", "Verify right border")}`,
|
|
565
|
+
` ${th.fg("dim", "aligns with edge.")}`,
|
|
566
|
+
"",
|
|
567
|
+
` ${th.fg("dim", "Press Esc to close")}`,
|
|
568
|
+
"",
|
|
569
|
+
],
|
|
570
|
+
width,
|
|
571
|
+
"Edge Test",
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
// Percentage positioning test
|
|
577
|
+
class PercentTestComponent extends BaseOverlay {
|
|
578
|
+
constructor(
|
|
579
|
+
theme: Theme,
|
|
580
|
+
private config: { name: string; row: number; col: number },
|
|
581
|
+
private done: (result: "next" | "close") => void,
|
|
582
|
+
) {
|
|
583
|
+
super(theme);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
handleInput(data: string): void {
|
|
587
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
588
|
+
this.done("close");
|
|
589
|
+
} else if (matchesKey(data, "space") || matchesKey(data, "right")) {
|
|
590
|
+
this.done("next");
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
render(width: number): string[] {
|
|
595
|
+
const th = this.theme;
|
|
596
|
+
return this.box(
|
|
597
|
+
[
|
|
598
|
+
"",
|
|
599
|
+
` ${th.fg("accent", this.config.name)}`,
|
|
600
|
+
"",
|
|
601
|
+
` ${th.fg("dim", "Space/→ = next")}`,
|
|
602
|
+
` ${th.fg("dim", "Esc = close")}`,
|
|
603
|
+
"",
|
|
604
|
+
],
|
|
605
|
+
width,
|
|
606
|
+
"Percent Test",
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
// MaxHeight test - renders 20 lines, truncated to 10 by maxHeight
|
|
612
|
+
class MaxHeightTestComponent extends BaseOverlay {
|
|
613
|
+
constructor(
|
|
614
|
+
theme: Theme,
|
|
615
|
+
private done: () => void,
|
|
616
|
+
) {
|
|
617
|
+
super(theme);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
handleInput(data: string): void {
|
|
621
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
622
|
+
this.done();
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
render(width: number): string[] {
|
|
627
|
+
const th = this.theme;
|
|
628
|
+
// Intentionally render 21 lines - maxHeight: 10 will truncate to first 10
|
|
629
|
+
// You should see header + lines 1-6, with bottom border cut off
|
|
630
|
+
const contentLines: string[] = [
|
|
631
|
+
th.fg("warning", " ⚠ Rendering 21 lines, maxHeight: 10"),
|
|
632
|
+
th.fg("dim", " Lines 11-21 truncated (no bottom border)"),
|
|
633
|
+
"",
|
|
634
|
+
];
|
|
635
|
+
|
|
636
|
+
for (let i = 1; i <= 14; i++) {
|
|
637
|
+
contentLines.push(` Line ${i} of 14`);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
contentLines.push("", th.fg("dim", " Press Esc to close"));
|
|
641
|
+
|
|
642
|
+
return this.box(contentLines, width, "MaxHeight Test");
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
// Responsive sidepanel - demonstrates percentage width and visibility callback
|
|
647
|
+
class SidepanelComponent extends BaseOverlay {
|
|
648
|
+
private items = ["Dashboard", "Messages", "Settings", "Help", "About"];
|
|
649
|
+
private selectedIndex = 0;
|
|
650
|
+
|
|
651
|
+
constructor(
|
|
652
|
+
private tui: TUI,
|
|
653
|
+
theme: Theme,
|
|
654
|
+
private done: () => void,
|
|
655
|
+
) {
|
|
656
|
+
super(theme);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
handleInput(data: string): void {
|
|
660
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
661
|
+
this.done();
|
|
662
|
+
} else if (matchesKey(data, "up")) {
|
|
663
|
+
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
664
|
+
this.tui.requestRender();
|
|
665
|
+
} else if (matchesKey(data, "down")) {
|
|
666
|
+
this.selectedIndex = Math.min(this.items.length - 1, this.selectedIndex + 1);
|
|
667
|
+
this.tui.requestRender();
|
|
668
|
+
} else if (matchesKey(data, "return")) {
|
|
669
|
+
// Could trigger an action here
|
|
670
|
+
this.tui.requestRender();
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
render(width: number): string[] {
|
|
675
|
+
const th = this.theme;
|
|
676
|
+
const innerW = Math.max(1, width - 2);
|
|
677
|
+
const padLine = (s: string) => truncateToWidth(s, innerW, "...", true);
|
|
678
|
+
const border = (c: string) => th.fg("border", c);
|
|
679
|
+
const lines: string[] = [];
|
|
680
|
+
|
|
681
|
+
// Header
|
|
682
|
+
lines.push(border(`╭${"─".repeat(innerW)}╮`));
|
|
683
|
+
lines.push(border("│") + padLine(th.fg("accent", " Responsive Sidepanel")) + border("│"));
|
|
684
|
+
lines.push(border("├") + border("─".repeat(innerW)) + border("┤"));
|
|
685
|
+
|
|
686
|
+
// Menu items
|
|
687
|
+
for (let i = 0; i < this.items.length; i++) {
|
|
688
|
+
const item = this.items[i]!;
|
|
689
|
+
const isSelected = i === this.selectedIndex;
|
|
690
|
+
const prefix = isSelected ? th.fg("accent", "→ ") : " ";
|
|
691
|
+
const text = isSelected ? th.fg("accent", item) : item;
|
|
692
|
+
lines.push(border("│") + padLine(`${prefix}${text}`) + border("│"));
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// Footer with responsive behavior info
|
|
696
|
+
lines.push(border("├") + border("─".repeat(innerW)) + border("┤"));
|
|
697
|
+
lines.push(border("│") + padLine(th.fg("warning", " ⚠ Resize terminal < 100 cols")) + border("│"));
|
|
698
|
+
lines.push(border("│") + padLine(th.fg("warning", " to see panel auto-hide")) + border("│"));
|
|
699
|
+
lines.push(border("│") + padLine(th.fg("dim", " Uses visible: (w) => w >= 100")) + border("│"));
|
|
700
|
+
lines.push(border("│") + padLine(th.fg("dim", " ↑↓ navigate | Esc close")) + border("│"));
|
|
701
|
+
lines.push(border(`╰${"─".repeat(innerW)}╯`));
|
|
702
|
+
|
|
703
|
+
return lines;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
// Animation demo - proves overlays can handle real-time updates like pi-doom
|
|
708
|
+
class AnimationDemoComponent extends BaseOverlay {
|
|
709
|
+
private frame = 0;
|
|
710
|
+
private interval: ReturnType<typeof setInterval> | null = null;
|
|
711
|
+
private fps = 0;
|
|
712
|
+
private lastFpsUpdate = Date.now();
|
|
713
|
+
private framesSinceLastFps = 0;
|
|
714
|
+
|
|
715
|
+
constructor(
|
|
716
|
+
private tui: TUI,
|
|
717
|
+
theme: Theme,
|
|
718
|
+
private done: () => void,
|
|
719
|
+
) {
|
|
720
|
+
super(theme);
|
|
721
|
+
this.startAnimation();
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
private startAnimation(): void {
|
|
725
|
+
// Run at ~30 FPS (same as DOOM target)
|
|
726
|
+
this.interval = setInterval(() => {
|
|
727
|
+
this.frame++;
|
|
728
|
+
this.framesSinceLastFps++;
|
|
729
|
+
|
|
730
|
+
// Update FPS counter every second
|
|
731
|
+
const now = Date.now();
|
|
732
|
+
if (now - this.lastFpsUpdate >= 1000) {
|
|
733
|
+
this.fps = this.framesSinceLastFps;
|
|
734
|
+
this.framesSinceLastFps = 0;
|
|
735
|
+
this.lastFpsUpdate = now;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
this.tui.requestRender();
|
|
739
|
+
}, 1000 / 30);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
handleInput(data: string): void {
|
|
743
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
744
|
+
this.dispose();
|
|
745
|
+
this.done();
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
render(width: number): string[] {
|
|
750
|
+
const th = this.theme;
|
|
751
|
+
const innerW = Math.max(1, width - 2);
|
|
752
|
+
const padLine = (s: string) => truncateToWidth(s, innerW, "...", true);
|
|
753
|
+
const border = (c: string) => th.fg("border", c);
|
|
754
|
+
|
|
755
|
+
const lines: string[] = [];
|
|
756
|
+
lines.push(border(`╭${"─".repeat(innerW)}╮`));
|
|
757
|
+
lines.push(border("│") + padLine(th.fg("accent", " Animation Demo (~30 FPS)")) + border("│"));
|
|
758
|
+
lines.push(border("│") + padLine(``) + border("│"));
|
|
759
|
+
lines.push(border("│") + padLine(` Frame: ${th.fg("accent", String(this.frame))}`) + border("│"));
|
|
760
|
+
lines.push(border("│") + padLine(` FPS: ${th.fg("success", String(this.fps))}`) + border("│"));
|
|
761
|
+
lines.push(border("│") + padLine(``) + border("│"));
|
|
762
|
+
|
|
763
|
+
// Animated content - bouncing bar
|
|
764
|
+
const barWidth = Math.max(12, innerW - 4); // Ensure enough space for bar
|
|
765
|
+
const pos = Math.max(0, Math.floor(((Math.sin(this.frame / 10) + 1) * (barWidth - 10)) / 2));
|
|
766
|
+
const bar = " ".repeat(pos) + th.fg("accent", "██████████") + " ".repeat(Math.max(0, barWidth - 10 - pos));
|
|
767
|
+
lines.push(border("│") + padLine(` ${bar}`) + border("│"));
|
|
768
|
+
|
|
769
|
+
// Spinning character
|
|
770
|
+
const spinChars = ["◐", "◓", "◑", "◒"];
|
|
771
|
+
const spin = spinChars[this.frame % spinChars.length];
|
|
772
|
+
lines.push(border("│") + padLine(` Spinner: ${th.fg("warning", spin!)}`) + border("│"));
|
|
773
|
+
|
|
774
|
+
// Color cycling
|
|
775
|
+
const hue = (this.frame * 3) % 360;
|
|
776
|
+
const rgb = hslToRgb(hue / 360, 0.8, 0.5);
|
|
777
|
+
const colorBlock = `\x1b[48;2;${rgb[0]};${rgb[1]};${rgb[2]}m${" ".repeat(10)}\x1b[0m`;
|
|
778
|
+
lines.push(border("│") + padLine(` Color: ${colorBlock}`) + border("│"));
|
|
779
|
+
|
|
780
|
+
lines.push(border("│") + padLine(``) + border("│"));
|
|
781
|
+
lines.push(border("│") + padLine(th.fg("dim", " This proves overlays can handle")) + border("│"));
|
|
782
|
+
lines.push(border("│") + padLine(th.fg("dim", " real-time game-like rendering.")) + border("│"));
|
|
783
|
+
lines.push(border("│") + padLine(th.fg("dim", " (pi-doom uses same approach)")) + border("│"));
|
|
784
|
+
lines.push(border("│") + padLine(``) + border("│"));
|
|
785
|
+
lines.push(border("│") + padLine(th.fg("dim", " Press Esc to close")) + border("│"));
|
|
786
|
+
lines.push(border(`╰${"─".repeat(innerW)}╯`));
|
|
787
|
+
|
|
788
|
+
return lines;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
dispose(): void {
|
|
792
|
+
if (this.interval) {
|
|
793
|
+
clearInterval(this.interval);
|
|
794
|
+
this.interval = null;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// HSL to RGB helper for color cycling animation
|
|
800
|
+
function hslToRgb(h: number, s: number, l: number): [number, number, number] {
|
|
801
|
+
let r: number, g: number, b: number;
|
|
802
|
+
if (s === 0) {
|
|
803
|
+
r = g = b = l;
|
|
804
|
+
} else {
|
|
805
|
+
const hue2rgb = (p: number, q: number, t: number) => {
|
|
806
|
+
if (t < 0) t += 1;
|
|
807
|
+
if (t > 1) t -= 1;
|
|
808
|
+
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
809
|
+
if (t < 1 / 2) return q;
|
|
810
|
+
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
811
|
+
return p;
|
|
812
|
+
};
|
|
813
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
814
|
+
const p = 2 * l - q;
|
|
815
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
816
|
+
g = hue2rgb(p, q, h);
|
|
817
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
818
|
+
}
|
|
819
|
+
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
// Toggle demo - demonstrates OverlayHandle.setHidden() via onHandle callback
|
|
823
|
+
class ToggleDemoComponent extends BaseOverlay {
|
|
824
|
+
private toggleCount = 0;
|
|
825
|
+
private isToggling = false;
|
|
826
|
+
|
|
827
|
+
constructor(
|
|
828
|
+
private tui: TUI,
|
|
829
|
+
theme: Theme,
|
|
830
|
+
private done: () => void,
|
|
831
|
+
) {
|
|
832
|
+
super(theme);
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
handleInput(data: string): void {
|
|
836
|
+
if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
837
|
+
this.done();
|
|
838
|
+
} else if (matchesKey(data, "t") && globalToggleHandle && !this.isToggling) {
|
|
839
|
+
// Demonstrate toggle by hiding for 1 second then showing again
|
|
840
|
+
// (In real usage, a global keybinding would control visibility)
|
|
841
|
+
this.isToggling = true;
|
|
842
|
+
this.toggleCount++;
|
|
843
|
+
globalToggleHandle.setHidden(true);
|
|
844
|
+
|
|
845
|
+
// Auto-restore after 1 second to demonstrate the API
|
|
846
|
+
setTimeout(() => {
|
|
847
|
+
if (globalToggleHandle) {
|
|
848
|
+
globalToggleHandle.setHidden(false);
|
|
849
|
+
this.isToggling = false;
|
|
850
|
+
this.tui.requestRender();
|
|
851
|
+
}
|
|
852
|
+
}, 1000);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
render(width: number): string[] {
|
|
857
|
+
const th = this.theme;
|
|
858
|
+
return this.box(
|
|
859
|
+
[
|
|
860
|
+
"",
|
|
861
|
+
th.fg("accent", " Toggle Demo"),
|
|
862
|
+
"",
|
|
863
|
+
" This overlay demonstrates the",
|
|
864
|
+
" onHandle callback API.",
|
|
865
|
+
"",
|
|
866
|
+
` Toggle count: ${th.fg("accent", String(this.toggleCount))}`,
|
|
867
|
+
"",
|
|
868
|
+
th.fg("dim", " Press 't' to hide for 1 second"),
|
|
869
|
+
th.fg("dim", " (demonstrates setHidden API)"),
|
|
870
|
+
"",
|
|
871
|
+
th.fg("dim", " In real usage, a global keybinding"),
|
|
872
|
+
th.fg("dim", " would toggle visibility externally."),
|
|
873
|
+
"",
|
|
874
|
+
th.fg("dim", " Press Esc to close"),
|
|
875
|
+
"",
|
|
876
|
+
],
|
|
877
|
+
width,
|
|
878
|
+
"Toggle Demo",
|
|
879
|
+
);
|
|
880
|
+
}
|
|
881
|
+
}
|