apex-code 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +257 -5
- package/README.md +624 -0
- package/dist/bun/cli.d.ts +3 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +3 -9
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/runtime-setup.d.ts +2 -0
- package/dist/bun/runtime-setup.d.ts.map +1 -0
- package/dist/bun/runtime-setup.js +9 -0
- package/dist/bun/runtime-setup.js.map +1 -0
- package/dist/bun/sandbox-env-setup.d.ts +2 -0
- package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
- package/dist/bun/sandbox-env-setup.js +4 -0
- package/dist/bun/sandbox-env-setup.js.map +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +16 -5
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +2 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/file-processor.d.ts +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/session-picker.d.ts +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/setup.d.ts +2 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +13 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +16 -8
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +85 -15
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +685 -266
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +55 -0
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bug-report.d.ts +176 -0
- package/dist/core/bug-report.d.ts.map +1 -0
- package/dist/core/bug-report.js +291 -0
- package/dist/core/bug-report.js.map +1 -0
- package/dist/core/cache-stats.d.ts.map +1 -1
- package/dist/core/cache-stats.js +12 -1
- package/dist/core/cache-stats.js.map +1 -1
- package/dist/core/cache-warmer.d.ts +103 -0
- package/dist/core/cache-warmer.d.ts.map +1 -0
- package/dist/core/cache-warmer.js +356 -0
- package/dist/core/cache-warmer.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +4 -3
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +5 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +163 -66
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/context/pipeline.d.ts +8 -8
- package/dist/core/context/pipeline.d.ts.map +1 -1
- package/dist/core/context/pipeline.js +21 -12
- package/dist/core/context/pipeline.js.map +1 -1
- package/dist/core/crash-log.d.ts +27 -0
- package/dist/core/crash-log.d.ts.map +1 -0
- package/dist/core/crash-log.js +139 -0
- package/dist/core/crash-log.js.map +1 -0
- package/dist/core/export-html/template.js +6 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/jiti-loader.d.ts +2 -0
- package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
- package/dist/core/extensions/jiti-loader.js +4 -0
- package/dist/core/extensions/jiti-loader.js.map +1 -0
- package/dist/core/extensions/jiti-static-loader.d.ts +2 -0
- package/dist/core/extensions/jiti-static-loader.d.ts.map +1 -0
- package/dist/core/extensions/jiti-static-loader.js +4 -0
- package/dist/core/extensions/jiti-static-loader.js.map +1 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +40 -59
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +24 -8
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +195 -72
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +142 -55
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts +3 -0
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/virtual-modules.js +41 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +1 -20
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +2 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +6 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +5 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +1 -0
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts +168 -20
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +44 -18
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +5 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +8 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +4 -3
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +1 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +12 -6
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/permissions/store.d.ts.map +1 -1
- package/dist/core/permissions/store.js +11 -8
- package/dist/core/permissions/store.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +6 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +61 -35
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-composer.d.ts +4 -2
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +29 -2
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/radius.d.ts +3 -0
- package/dist/core/radius.d.ts.map +1 -1
- package/dist/core/radius.js +6 -0
- package/dist/core/radius.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +6 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +63 -42
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-export.d.ts +6 -2
- package/dist/core/session-export.d.ts.map +1 -1
- package/dist/core/session-export.js +14 -13
- package/dist/core/session-export.js.map +1 -1
- package/dist/core/session-manager.d.ts +66 -15
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +295 -115
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +27 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +55 -7
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +5 -4
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts +49 -6
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +140 -79
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +7 -8
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +20 -115
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +1 -12
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +6 -204
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +4 -55
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +4 -60
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +4 -49
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts +4 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +10 -125
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts +18 -0
- package/dist/core/tools/renderers/bash.d.ts.map +1 -0
- package/dist/core/tools/renderers/bash.js +126 -0
- package/dist/core/tools/renderers/bash.js.map +1 -0
- package/dist/core/tools/renderers/edit.d.ts +23 -0
- package/dist/core/tools/renderers/edit.d.ts.map +1 -0
- package/dist/core/tools/renderers/edit.js +207 -0
- package/dist/core/tools/renderers/edit.js.map +1 -0
- package/dist/core/tools/renderers/find.d.ts +10 -0
- package/dist/core/tools/renderers/find.d.ts.map +1 -0
- package/dist/core/tools/renderers/find.js +64 -0
- package/dist/core/tools/renderers/find.js.map +1 -0
- package/dist/core/tools/renderers/grep.d.ts +10 -0
- package/dist/core/tools/renderers/grep.d.ts.map +1 -0
- package/dist/core/tools/renderers/grep.js +69 -0
- package/dist/core/tools/renderers/grep.js.map +1 -0
- package/dist/core/tools/renderers/index.d.ts +34 -0
- package/dist/core/tools/renderers/index.d.ts.map +1 -0
- package/dist/core/tools/renderers/index.js +47 -0
- package/dist/core/tools/renderers/index.js.map +1 -0
- package/dist/core/tools/renderers/ls.d.ts +10 -0
- package/dist/core/tools/renderers/ls.d.ts.map +1 -0
- package/dist/core/tools/renderers/ls.js +58 -0
- package/dist/core/tools/renderers/ls.js.map +1 -0
- package/dist/core/tools/renderers/read.d.ts +11 -0
- package/dist/core/tools/renderers/read.d.ts.map +1 -0
- package/dist/core/tools/renderers/read.js +132 -0
- package/dist/core/tools/renderers/read.js.map +1 -0
- package/dist/core/tools/renderers/write.d.ts +10 -0
- package/dist/core/tools/renderers/write.d.ts.map +1 -0
- package/dist/core/tools/renderers/write.js +152 -0
- package/dist/core/tools/renderers/write.js.map +1 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +6 -146
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/usage-totals.d.ts +1 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +5 -1
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/extensions/llama/client.d.ts +2 -0
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +7 -3
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +20 -5
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +21 -13
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/bug-report.d.ts +16 -0
- package/dist/modes/interactive/bug-report.d.ts.map +1 -0
- package/dist/modes/interactive/bug-report.js +167 -0
- package/dist/modes/interactive/bug-report.js.map +1 -0
- package/dist/modes/interactive/chat-viewport.d.ts +20 -0
- package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
- package/dist/modes/interactive/chat-viewport.js +28 -0
- package/dist/modes/interactive/chat-viewport.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +7 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +63 -17
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +12 -5
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +12 -5
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +12 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +38 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/error-summary.d.ts +11 -0
- package/dist/modes/interactive/components/error-summary.d.ts.map +1 -0
- package/dist/modes/interactive/components/error-summary.js +31 -0
- package/dist/modes/interactive/components/error-summary.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +4 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +6 -1
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +2 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +6 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +2 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +4 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +4 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +3 -3
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +13 -15
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +5 -5
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +74 -48
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +5 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +35 -10
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +11 -4
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +3 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +10 -3
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +6 -6
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +27 -5
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +64 -42
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +9 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +2 -2
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +43 -29
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +431 -166
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +2 -1
- package/dist/modes/interactive/theme/light.json +2 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +5 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +84 -0
- package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-json.js +130 -0
- package/dist/modes/interactive/theme/theme-json.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +6 -2
- package/dist/modes/interactive/theme/theme.d.ts +14 -5
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +18 -119
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/tui-renderer.d.ts +21 -0
- package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
- package/dist/modes/interactive/tui-renderer.js +66 -0
- package/dist/modes/interactive/tui-renderer.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +2 -2
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/testing/replay/recorded-provider.d.ts +2 -2
- package/dist/testing/replay/recorded-provider.d.ts.map +1 -1
- package/dist/testing/replay/recorded-provider.js +2 -5
- package/dist/testing/replay/recorded-provider.js.map +1 -1
- package/dist/testing/replay/runner.d.ts.map +1 -1
- package/dist/testing/replay/runner.js +0 -1
- package/dist/testing/replay/runner.js.map +1 -1
- package/dist/utils/clipboard-command.d.ts +7 -0
- package/dist/utils/clipboard-command.d.ts.map +1 -0
- package/dist/utils/clipboard-command.js +45 -0
- package/dist/utils/clipboard-command.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +53 -81
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +111 -121
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js +2 -3
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js +1 -1
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +21 -21
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tool-result-images.d.ts +3 -1
- package/dist/utils/tool-result-images.d.ts.map +1 -1
- package/dist/utils/tool-result-images.js +4 -1
- package/dist/utils/tool-result-images.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +11 -2
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/wsl.d.ts +3 -0
- package/dist/utils/wsl.d.ts.map +1 -0
- package/dist/utils/wsl.js +15 -0
- package/dist/utils/wsl.js.map +1 -0
- package/dist/utils/zip.d.ts +7 -0
- package/dist/utils/zip.d.ts.map +1 -0
- package/dist/utils/zip.js +60 -0
- package/dist/utils/zip.js.map +1 -0
- package/docs/cli-integration.md +107 -0
- package/docs/cli.md +269 -0
- package/docs/compaction.md +73 -24
- package/docs/configuration.md +45 -0
- package/docs/containerization.md +22 -21
- package/docs/custom-provider.md +21 -12
- package/docs/development.md +19 -0
- package/docs/docs.json +139 -95
- package/docs/extensions.md +243 -371
- package/docs/how-pi-works.md +49 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/index.md +3 -3
- package/docs/json.md +7 -3
- package/docs/keybindings.md +57 -54
- package/docs/llama-cpp.md +2 -2
- package/docs/message-types.md +261 -0
- package/docs/models.md +103 -49
- package/docs/packages.md +49 -47
- package/docs/prompt-templates.md +29 -56
- package/docs/providers.md +91 -139
- package/docs/quickstart.md +42 -14
- package/docs/rpc-commands.md +854 -0
- package/docs/rpc-extension-ui.md +200 -0
- package/docs/rpc.md +121 -223
- package/docs/sdk.md +99 -124
- package/docs/security.md +7 -7
- package/docs/session-format.md +85 -82
- package/docs/sessions.md +41 -57
- package/docs/settings.md +94 -87
- package/docs/shell-aliases.md +68 -3
- package/docs/skills.md +62 -49
- package/docs/slash-commands.md +60 -0
- package/docs/terminal-setup.md +86 -55
- package/docs/termux.md +65 -75
- package/docs/themes.md +64 -86
- package/docs/tmux.md +29 -7
- package/docs/tui.md +67 -122
- package/docs/usage.md +31 -42
- package/docs/windows.md +41 -13
- package/examples/README.md +16 -2
- package/examples/extensions/README.md +0 -1
- package/examples/extensions/custom-provider-anthropic/index.ts +18 -12
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/dynamic-resources/dynamic.json +2 -0
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/prompt-customizer.ts +19 -67
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/plugins/pi-example-plugin/README.md +38 -0
- package/examples/plugins/pi-example-plugin/package.json +10 -0
- package/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
- package/examples/plugins/pi-example-plugin/src/session.ts +24 -0
- package/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
- package/examples/rpc-client.ts +35 -0
- package/examples/rpc-extension-ui.ts +25 -5
- package/examples/sdk/README.md +1 -1
- package/npm-shrinkwrap.json +861 -513
- package/package.json +27 -18
- package/dist/bun/register-bedrock.d.ts +0 -2
- package/dist/bun/register-bedrock.d.ts.map +0 -1
- package/dist/bun/register-bedrock.js +0 -4
- package/dist/bun/register-bedrock.js.map +0 -1
- package/dist/cli/experimental/auth.d.ts +0 -16
- package/dist/cli/experimental/auth.d.ts.map +0 -1
- package/dist/cli/experimental/auth.js +0 -13
- package/dist/cli/experimental/auth.js.map +0 -1
- package/dist/cli/experimental/cli.d.ts +0 -6
- package/dist/cli/experimental/cli.d.ts.map +0 -1
- package/dist/cli/experimental/cli.js +0 -5
- package/dist/cli/experimental/cli.js.map +0 -1
- package/dist/cli/experimental/command-options.d.ts +0 -17
- package/dist/cli/experimental/command-options.d.ts.map +0 -1
- package/dist/cli/experimental/command-options.js +0 -35
- package/dist/cli/experimental/command-options.js.map +0 -1
- package/dist/cli/experimental/command.d.ts +0 -63
- package/dist/cli/experimental/command.d.ts.map +0 -1
- package/dist/cli/experimental/command.js +0 -130
- package/dist/cli/experimental/command.js.map +0 -1
- package/dist/cli/experimental/commands/client.d.ts +0 -13
- package/dist/cli/experimental/commands/client.d.ts.map +0 -1
- package/dist/cli/experimental/commands/client.js +0 -25
- package/dist/cli/experimental/commands/client.js.map +0 -1
- package/dist/cli/experimental/commands/pi.d.ts +0 -15
- package/dist/cli/experimental/commands/pi.d.ts.map +0 -1
- package/dist/cli/experimental/commands/pi.js +0 -28
- package/dist/cli/experimental/commands/pi.js.map +0 -1
- package/dist/cli/experimental/commands/server.d.ts +0 -13
- package/dist/cli/experimental/commands/server.d.ts.map +0 -1
- package/dist/cli/experimental/commands/server.js +0 -25
- package/dist/cli/experimental/commands/server.js.map +0 -1
- package/dist/cli/experimental/transport-address.d.ts +0 -10
- package/dist/cli/experimental/transport-address.d.ts.map +0 -1
- package/dist/cli/experimental/transport-address.js +0 -38
- package/dist/cli/experimental/transport-address.js.map +0 -1
- package/dist/client/index.d.ts +0 -3
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -3
- package/dist/client/index.js.map +0 -1
- package/dist/client/remote-session.d.ts +0 -53
- package/dist/client/remote-session.d.ts.map +0 -1
- package/dist/client/remote-session.js +0 -340
- package/dist/client/remote-session.js.map +0 -1
- package/dist/client/transcript.d.ts +0 -12
- package/dist/client/transcript.d.ts.map +0 -1
- package/dist/client/transcript.js +0 -98
- package/dist/client/transcript.js.map +0 -1
- package/dist/utils/clipboard-native.d.ts +0 -11
- package/dist/utils/clipboard-native.d.ts.map +0 -1
- package/dist/utils/clipboard-native.js +0 -20
- package/dist/utils/clipboard-native.js.map +0 -1
package/docs/tmux.md
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
1
|
-
# tmux
|
|
1
|
+
# Run Pi in tmux
|
|
2
2
|
|
|
3
3
|
Apex Code works inside tmux, but tmux strips modifier information from certain keys by default. Without configuration, `Shift+Enter` and `Ctrl+Enter` are usually indistinguishable from plain `Enter`.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Check your tmux version
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
tmux -V
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For tmux 3.5 or newer, use the recommended CSI-u configuration below. For tmux 3.2 through 3.4, use the older-version configuration.
|
|
12
|
+
|
|
13
|
+
## Enable extended keys in tmux 3.5 or newer
|
|
14
|
+
|
|
15
|
+
Add these lines to `~/.tmux.conf`:
|
|
8
16
|
|
|
9
17
|
```tmux
|
|
10
18
|
set -g extended-keys on
|
|
11
19
|
set -g extended-keys-format csi-u
|
|
12
20
|
```
|
|
13
21
|
|
|
14
|
-
|
|
22
|
+
Pi requests extended-key reporting when the terminal does not provide the Kitty keyboard protocol directly. CSI-u is the most reliable format for forwarding modified keys through tmux.
|
|
23
|
+
|
|
24
|
+
## Restart tmux
|
|
25
|
+
|
|
26
|
+
The configuration applies to the tmux server. To guarantee that it is active, close your tmux sessions and start a new server.
|
|
27
|
+
|
|
28
|
+
If you choose to stop the server from the command line, save your work first. This command terminates every session managed by that server:
|
|
15
29
|
|
|
16
30
|
```bash
|
|
17
31
|
tmux kill-server
|
|
@@ -20,15 +34,23 @@ tmux
|
|
|
20
34
|
|
|
21
35
|
Apex Code requests extended key reporting automatically when Kitty keyboard protocol is not available. With `extended-keys-format csi-u`, tmux forwards modified keys in CSI-u format, which is the most reliable configuration. The `extended-keys-format` option requires tmux 3.5 or later.
|
|
22
36
|
|
|
23
|
-
|
|
37
|
+
Start Pi inside the new tmux session and check that:
|
|
38
|
+
|
|
39
|
+
1. `Shift+Enter` inserts a new line in the editor.
|
|
40
|
+
2. `Enter` submits the prompt.
|
|
41
|
+
3. `Alt+Enter` queues a follow-up on macOS and Linux. Windows and WSL use `Ctrl+Q` by default.
|
|
42
|
+
|
|
43
|
+
If these keys still behave like plain `Enter`, verify that the terminal outside tmux can report modified keys. See [Configure your terminal](terminal-setup.md).
|
|
44
|
+
|
|
45
|
+
## Use tmux 3.2 through 3.4
|
|
24
46
|
|
|
25
|
-
|
|
47
|
+
These versions support extended keys but not `extended-keys-format csi-u`. Add only:
|
|
26
48
|
|
|
27
49
|
```tmux
|
|
28
50
|
set -g extended-keys on
|
|
29
51
|
```
|
|
30
52
|
|
|
31
|
-
|
|
53
|
+
Pi supports the xterm `modifyOtherKeys` format used by these versions. Restart tmux and repeat the verification steps.
|
|
32
54
|
|
|
33
55
|
- `Ctrl+C` → `\x1b[27;5;99~`
|
|
34
56
|
- `Ctrl+D` → `\x1b[27;5;100~`
|
package/docs/tui.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Extensions and custom tools can render custom TUI components for interactive user interfaces. This page covers the component system and available building blocks.
|
|
6
6
|
|
|
7
|
-
**Source:** [`@earendil-works/pi-tui`](https://github.com/earendil-works/pi
|
|
7
|
+
**Source:** [`@earendil-works/pi-tui`](https://github.com/earendil-works/pi/tree/main/packages/tui)
|
|
8
8
|
|
|
9
9
|
## Component Interface
|
|
10
10
|
|
|
@@ -14,6 +14,7 @@ All components implement:
|
|
|
14
14
|
interface Component {
|
|
15
15
|
render(width: number): string[];
|
|
16
16
|
handleInput?(data: string): void;
|
|
17
|
+
handleMouse?(event: TuiMouseEvent): TuiMouseEventResult | undefined;
|
|
17
18
|
wantsKeyRelease?: boolean;
|
|
18
19
|
invalidate(): void;
|
|
19
20
|
}
|
|
@@ -23,6 +24,7 @@ interface Component {
|
|
|
23
24
|
|--------|-------------|
|
|
24
25
|
| `render(width)` | Return array of strings (one per line). Each line **must not exceed `width`**. |
|
|
25
26
|
| `handleInput?(data)` | Receive keyboard input when component has focus. |
|
|
27
|
+
| `handleMouse?(event)` | Receive normalized pointer input in fullscreen mode. |
|
|
26
28
|
| `wantsKeyRelease?` | If true, component receives key release events (Kitty protocol). Default: false. |
|
|
27
29
|
| `invalidate()` | Clear cached render state. Called on theme changes. |
|
|
28
30
|
|
|
@@ -52,7 +54,7 @@ When a `Focusable` component has focus, TUI:
|
|
|
52
54
|
3. Positions the hardware terminal cursor at that location
|
|
53
55
|
4. Shows the hardware cursor only when `showHardwareCursor` is enabled
|
|
54
56
|
|
|
55
|
-
The cursor remains hidden by default. This keeps the fake cursor rendering, while still positioning the hardware cursor for terminals that track IME candidate windows with hidden cursors. Some terminals require a visible hardware cursor for IME positioning; enable it with `showHardwareCursor
|
|
57
|
+
The cursor remains hidden by default. This keeps the fake cursor rendering, while still positioning the hardware cursor for terminals that track IME candidate windows with hidden cursors. Some terminals require a visible hardware cursor for IME positioning; enable it with the renderer's `showHardwareCursor` constructor argument or `setShowHardwareCursor(true)`. Pi also maps `PI_HARDWARE_CURSOR=1` to this setting before it creates its renderer. The `Editor` and `Input` built-in components already implement this interface.
|
|
56
58
|
|
|
57
59
|
### Container Components with Embedded Inputs
|
|
58
60
|
|
|
@@ -246,31 +248,24 @@ container.addChild(component2);
|
|
|
246
248
|
container.removeChild(component1);
|
|
247
249
|
```
|
|
248
250
|
|
|
249
|
-
|
|
251
|
+
`@earendil-works/pi-tui` provides the terminal component system used by Pi. Extensions use it when built-in dialogs, notifications, status text, and widgets are not enough for the interaction they need.
|
|
250
252
|
|
|
251
|
-
|
|
253
|
+
Start with `ctx.ui` methods from an [extension](extensions.md#interact-with-the-user). Build a custom component only when the UI needs its own rendering, keyboard or mouse input, focus, layout, or lifecycle.
|
|
252
254
|
|
|
253
|
-
|
|
254
|
-
const spacer = new Spacer(2); // 2 empty lines
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
### Markdown
|
|
255
|
+
## Choose an integration point
|
|
258
256
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
);
|
|
268
|
-
md.setText("Updated markdown");
|
|
269
|
-
```
|
|
257
|
+
| Need | Use |
|
|
258
|
+
|---|---|
|
|
259
|
+
| Select, confirm, input, or multi-line editor | `ctx.ui.select()`, `confirm()`, `input()`, or `editor()` |
|
|
260
|
+
| Non-blocking feedback | `ctx.ui.notify()` or `setStatus()` |
|
|
261
|
+
| Persistent content near the editor | `ctx.ui.setWidget()` |
|
|
262
|
+
| Replace the header, footer, or editor | The corresponding `ctx.ui` component factory |
|
|
263
|
+
| Temporary interactive screen or overlay | `ctx.ui.custom()` |
|
|
264
|
+
| Custom rendering for a tool or session entry | An extension renderer |
|
|
270
265
|
|
|
271
|
-
|
|
266
|
+
These APIs receive Pi’s active theme and keybindings where needed. Do not create a second terminal renderer inside an extension.
|
|
272
267
|
|
|
273
|
-
|
|
268
|
+
## Understand the component model
|
|
274
269
|
|
|
275
270
|
```typescript
|
|
276
271
|
const image = new Image(
|
|
@@ -307,6 +302,22 @@ handleInput(data: string) {
|
|
|
307
302
|
- With modifiers: `Key.ctrl("c")`, `Key.shift("tab")`, `Key.alt("left")`, `Key.ctrlShift("p")`
|
|
308
303
|
- String format also works: `"enter"`, `"ctrl+c"`, `"shift+tab"`, `"ctrl+shift+p"`
|
|
309
304
|
|
|
305
|
+
## Mouse Input
|
|
306
|
+
|
|
307
|
+
Fullscreen mode routes normalized press, release, click, move, drag, and wheel events to components and overlays. Return `{ handled: true }` to suppress default behavior, `capture: true` to retain drag/release ownership, `focus: true` to request keyboard focus, and `render: true` when a hover or release visibly changes the component. Press, click, drag, and wheel render by default; no-op move/release events do not.
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
import { MouseRegion } from "@earendil-works/pi-tui";
|
|
311
|
+
|
|
312
|
+
const clickable = new MouseRegion(content, (event) => {
|
|
313
|
+
if (event.type !== "click" || event.button !== "left") return undefined;
|
|
314
|
+
expanded = !expanded;
|
|
315
|
+
return { handled: true };
|
|
316
|
+
});
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Unhandled wheel input scrolls the nearest `ScrollView`; unhandled primary-button drags retain transcript selection. OSC 8 links take precedence over parent click regions. `Input`, `Editor`, `SelectList`, and `SettingsList` include fullscreen mouse behavior. Regular mode does not capture mouse input because the terminal owns its scrollback.
|
|
320
|
+
|
|
310
321
|
## Line Width
|
|
311
322
|
|
|
312
323
|
**Critical:** Each line from `render()` must not exceed the `width` parameter.
|
|
@@ -507,107 +518,51 @@ Call `invalidate()` when state changes, then use the injected `tui.requestRender
|
|
|
507
518
|
|
|
508
519
|
When the theme changes, the TUI calls `invalidate()` on all components to clear their caches. Components must properly implement `invalidate()` to ensure theme changes take effect.
|
|
509
520
|
|
|
510
|
-
|
|
521
|
+
Every rendered line must fit within the supplied width. Measure visible terminal columns rather than string length because ANSI escapes, wide characters, emoji, and combining characters change display width.
|
|
511
522
|
|
|
512
|
-
|
|
523
|
+
Use `visibleWidth()`, `truncateToWidth()`, `sliceByColumn()`, and `wrapTextWithAnsi()` instead of implementing terminal-width handling yourself. Pi resets styling and hyperlinks after every line, so reapply styles on each rendered line.
|
|
513
524
|
|
|
514
|
-
|
|
525
|
+
After changing component state, invalidate the affected component and call the injected `tui.requestRender()`. The TUI coalesces render requests and updates the terminal.
|
|
515
526
|
|
|
516
|
-
|
|
517
|
-
class BadComponent extends Container {
|
|
518
|
-
private content: Text;
|
|
527
|
+
## Compose built-in components
|
|
519
528
|
|
|
520
|
-
|
|
521
|
-
super();
|
|
522
|
-
// Pre-baked theme colors stored in Text component
|
|
523
|
-
this.content = new Text(theme.fg("accent", message), 1, 0);
|
|
524
|
-
this.addChild(this.content);
|
|
525
|
-
}
|
|
526
|
-
// No invalidate override - parent's invalidate only clears
|
|
527
|
-
// child render caches, not the pre-baked content
|
|
528
|
-
}
|
|
529
|
-
```
|
|
529
|
+
The package includes components for common layouts and controls:
|
|
530
530
|
|
|
531
|
-
|
|
531
|
+
- `Text`, `Markdown`, `Image`, and `TruncatedText` render content.
|
|
532
|
+
- `Container`, `VStack`, `HStack`, `Box`, and `Spacer` compose layouts.
|
|
533
|
+
- `Input` and `Editor` accept text.
|
|
534
|
+
- `SelectList` and `SettingsList` implement searchable selection and settings flows.
|
|
535
|
+
- `ScrollView` provides a bounded scrollable viewport.
|
|
536
|
+
- `Loader` and `CancellableLoader` report ongoing work.
|
|
537
|
+
- `MouseRegion` adds pointer behavior around another component.
|
|
532
538
|
|
|
533
|
-
|
|
539
|
+
Prefer these components over rebuilding selection, scrolling, text editing, or width handling. The extension examples show how to combine them with Pi’s borders and themes.
|
|
534
540
|
|
|
535
|
-
|
|
536
|
-
class GoodComponent extends Container {
|
|
537
|
-
private message: string;
|
|
538
|
-
private content: Text;
|
|
541
|
+
## Handle keyboard input and focus
|
|
539
542
|
|
|
540
|
-
|
|
541
|
-
super();
|
|
542
|
-
this.message = message;
|
|
543
|
-
this.content = new Text("", 1, 0);
|
|
544
|
-
this.addChild(this.content);
|
|
545
|
-
this.updateDisplay();
|
|
546
|
-
}
|
|
543
|
+
Use `matchesKey()` and `Key` for terminal keyboard input. The parser accounts for supported terminal protocols and key modifiers. Extension components should use the injected `KeybindingsManager` for configurable application actions.
|
|
547
544
|
|
|
548
|
-
|
|
549
|
-
// Rebuild content with current theme
|
|
550
|
-
this.content.setText(theme.fg("accent", this.message));
|
|
551
|
-
}
|
|
545
|
+
A component that displays a text cursor should implement `Focusable` and place `CURSOR_MARKER` immediately before its visual cursor. The TUI uses that marker to position the hardware cursor for input method editors.
|
|
552
546
|
|
|
553
|
-
|
|
554
|
-
super.invalidate(); // Clear child caches
|
|
555
|
-
this.updateDisplay(); // Rebuild with new theme
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
```
|
|
547
|
+
Containers that wrap an `Input` or `Editor` must propagate their `focused` state to that child. Without propagation, Chinese, Japanese, Korean, and other IME candidate windows can appear at the wrong screen position.
|
|
559
548
|
|
|
560
|
-
|
|
549
|
+
Extend Pi’s `CustomEditor` when replacing the main editor. It preserves application shortcuts and agent controls.
|
|
561
550
|
|
|
562
|
-
|
|
551
|
+
Forward keys your editor does not own to the base implementation, and restore the default by clearing the custom editor factory.
|
|
563
552
|
|
|
564
|
-
|
|
565
|
-
class ComplexComponent extends Container {
|
|
566
|
-
private data: SomeData;
|
|
567
|
-
|
|
568
|
-
constructor(data: SomeData) {
|
|
569
|
-
super();
|
|
570
|
-
this.data = data;
|
|
571
|
-
this.rebuild();
|
|
572
|
-
}
|
|
553
|
+
## Handle mouse input
|
|
573
554
|
|
|
574
|
-
|
|
575
|
-
this.clear(); // Remove all children
|
|
555
|
+
Fullscreen mode routes normalized mouse events to components. A handler can mark an event handled, capture a drag sequence, request focus, or request a render.
|
|
576
556
|
|
|
577
|
-
|
|
578
|
-
this.addChild(new Text(theme.fg("accent", theme.bold("Title")), 1, 0));
|
|
579
|
-
this.addChild(new Spacer(1));
|
|
557
|
+
Unhandled wheel events scroll the nearest `ScrollView`. Unhandled primary-button drags remain available for transcript selection. OSC 8 links take precedence over enclosing click regions.
|
|
580
558
|
|
|
581
|
-
|
|
582
|
-
const color = item.active ? "success" : "muted";
|
|
583
|
-
this.addChild(new Text(theme.fg(color, item.label), 1, 0));
|
|
584
|
-
}
|
|
585
|
-
}
|
|
559
|
+
Regular mode leaves mouse input to the terminal because the terminal owns scrollback. Design every interaction with a keyboard path even when fullscreen mouse input is available.
|
|
586
560
|
|
|
587
|
-
|
|
588
|
-
super.invalidate();
|
|
589
|
-
this.rebuild();
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
```
|
|
561
|
+
## Use custom screens and overlays
|
|
593
562
|
|
|
594
|
-
|
|
563
|
+
`ctx.ui.custom()` temporarily gives one component control of the interactive area and resolves when that component calls the supplied completion callback.
|
|
595
564
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
1. **Pre-baking theme colors** - Using `theme.fg()` or `theme.bg()` to create styled strings stored in child components
|
|
599
|
-
2. **Syntax highlighting** - Using `highlightCode()` which applies theme-based syntax colors
|
|
600
|
-
3. **Complex layouts** - Building child component trees that embed theme colors
|
|
601
|
-
|
|
602
|
-
This pattern is NOT needed when:
|
|
603
|
-
|
|
604
|
-
1. **Using theme callbacks** - Passing functions like `(text) => theme.fg("accent", text)` that are called during render
|
|
605
|
-
2. **Simple containers** - Just grouping other components without adding themed content
|
|
606
|
-
3. **Stateless render** - Computing themed output fresh in every `render()` call (no caching)
|
|
607
|
-
|
|
608
|
-
## Common Patterns
|
|
609
|
-
|
|
610
|
-
These patterns cover the most common UI needs in extensions. **Copy these patterns instead of building from scratch.**
|
|
565
|
+
Pass `overlay: true` to draw above existing content. Overlay options control size, anchors, offsets, margins, and responsive visibility. An overlay handle can change focus or temporarily hide and show the overlay with `setHidden()` while the interaction remains active.
|
|
611
566
|
|
|
612
567
|
### Pattern 1: Selection Dialog (SelectList)
|
|
613
568
|
|
|
@@ -690,16 +645,9 @@ pi.registerCommand("fetch", {
|
|
|
690
645
|
return loader;
|
|
691
646
|
});
|
|
692
647
|
|
|
693
|
-
|
|
694
|
-
ctx.ui.notify("Cancelled", "info");
|
|
695
|
-
} else {
|
|
696
|
-
ctx.ui.setEditorText(result);
|
|
697
|
-
}
|
|
698
|
-
},
|
|
699
|
-
});
|
|
700
|
-
```
|
|
648
|
+
Treat each custom component instance as belonging to one interaction. Create a new instance when starting that interaction again.
|
|
701
649
|
|
|
702
|
-
|
|
650
|
+
Finish the interaction with the completion callback supplied to the component factory. It resolves the `ctx.ui.custom()` promise and disposes the component. Do not call `OverlayHandle.hide()` on an overlay created by `ctx.ui.custom()`.
|
|
703
651
|
|
|
704
652
|
### Pattern 3: Settings/Toggles (SettingsList)
|
|
705
653
|
|
|
@@ -745,19 +693,15 @@ pi.registerCommand("settings", {
|
|
|
745
693
|
|
|
746
694
|
**Examples:** [tools.ts](../examples/extensions/tools.ts)
|
|
747
695
|
|
|
748
|
-
|
|
696
|
+
## Apply themes correctly
|
|
749
697
|
|
|
750
|
-
|
|
698
|
+
Use the theme passed to the extension or component callback. Theme helpers produce ANSI-styled strings for semantic colors such as accent, muted text, success, warnings, errors, tool output, and Markdown.
|
|
751
699
|
|
|
752
|
-
|
|
753
|
-
// Set status (shown in footer)
|
|
754
|
-
ctx.ui.setStatus("my-ext", ctx.ui.theme.fg("accent", "● active"));
|
|
700
|
+
Do not permanently store strings with theme colors unless `invalidate()` rebuilds them. A theme change clears render caches, but it cannot remove old ANSI colors embedded in application state.
|
|
755
701
|
|
|
756
|
-
|
|
757
|
-
ctx.ui.setStatus("my-ext", undefined);
|
|
758
|
-
```
|
|
702
|
+
Theme callbacks evaluated during rendering do not need special rebuilding. Stateless components can also calculate themed output on every render.
|
|
759
703
|
|
|
760
|
-
|
|
704
|
+
Use [Themes](themes.md) to create terminal palettes. Use Pi’s `getMarkdownTheme()` when rendering Markdown that should match the active application theme.
|
|
761
705
|
|
|
762
706
|
### Pattern 4b: Working Indicator Customization
|
|
763
707
|
|
|
@@ -912,6 +856,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
912
856
|
|
|
913
857
|
- **Extend `CustomEditor`** (not base `Editor`) to get app keybindings (escape to abort, ctrl+d to exit, model switching, etc.)
|
|
914
858
|
- **Call `super.handleInput(data)`** for keys you don't handle
|
|
859
|
+
- **Status spinners**: custom editors keep standalone status rows by default. Pass `{ embedWorkingStatus: true }` as the fourth `CustomEditor` constructor argument to embed working, compaction, branch summarization, and retry spinners in the editor border instead.
|
|
915
860
|
- **Factory pattern**: `setEditorComponent` receives a factory function that gets `tui`, `theme`, and `keybindings`
|
|
916
861
|
- **Pass `undefined`** to restore the default editor: `ctx.ui.setEditorComponent(undefined)`
|
|
917
862
|
|
package/docs/usage.md
CHANGED
|
@@ -1,38 +1,28 @@
|
|
|
1
1
|
# Using Apex Code
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Run `pi` from the folder you want to work in. Pi uses that folder to discover files, instructions, and configuration, and to group saved sessions. If you have not installed Pi or chosen a model yet, follow the [Quickstart](quickstart.md).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Pi may ask whether you trust the working folder before loading its project resources. See [Project trust](security.md#understand-project-trust).
|
|
6
6
|
|
|
7
|
-
<p align="center"><img src="images/interactive-mode.png" alt="
|
|
7
|
+
<p align="center"><img src="images/interactive-mode.png" alt="Pi interactive mode showing a conversation, editor, and status information" width="750"></p>
|
|
8
8
|
|
|
9
|
-
The
|
|
9
|
+
The transcript shows your prompts, Pi's responses, tool calls, results, and errors. You write prompts and commands in the editor. The footer shows the current folder, session, model, context usage, and accumulated usage and cost.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
- **Messages** - user messages, assistant responses, tool calls, tool results, notifications, errors, and extension UI
|
|
13
|
-
- **Editor** - where you type; border color indicates the current thinking level
|
|
14
|
-
- **Footer** - working directory, session name, token/cache usage, cost, context usage, and current model. Totals include assistant responses, usage reported by tools, and summary generation.
|
|
11
|
+
## Enter a prompt
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
Type a request and press `Enter` to send it. Use `Shift+Enter` to add a line, or press `Ctrl+G` to work on a longer prompt in your configured external editor.
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
To include files or images:
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
| Path completion | Press Tab to complete paths |
|
|
24
|
-
| Multi-line input | Shift+Enter, or Ctrl+Enter on Windows Terminal |
|
|
25
|
-
| Copy response | Ctrl+X copies the selected message in `/tree`; otherwise it copies the last assistant message, or the active fullscreen text selection when `fullscreenCopyOnSelect` is disabled |
|
|
26
|
-
| Images | Paste with Ctrl+V, Alt+V on Windows, or drag into the terminal |
|
|
27
|
-
| Shell command | `!command` runs and sends output to the model |
|
|
28
|
-
| Hidden shell command | `!!command` runs without sending output to the model |
|
|
29
|
-
| External editor | Ctrl+G opens `externalEditor`, `$VISUAL`, `$EDITOR`, Notepad on Windows, or `nano` elsewhere |
|
|
17
|
+
- Type `@` to search for a file and add it to your prompt.
|
|
18
|
+
- Press `Tab` to complete a path.
|
|
19
|
+
- Paste an image or drag it into a compatible terminal.
|
|
30
20
|
|
|
31
|
-
|
|
21
|
+
## Follow Pi's work
|
|
32
22
|
|
|
33
|
-
|
|
23
|
+
Pi shows each tool call and result while it works. Press `Ctrl+O` to expand or collapse tool output. Press `Ctrl+T` to show or hide thinking blocks.
|
|
34
24
|
|
|
35
|
-
|
|
25
|
+
The startup header lists the instructions and resources Pi loaded. The editor border indicates the current thinking level. The footer updates as the model uses context and reports usage.
|
|
36
26
|
|
|
37
27
|
| Command | Description |
|
|
38
28
|
|---------|-------------|
|
|
@@ -55,25 +45,28 @@ Type `/` in the editor to open command completion. Extensions can register custo
|
|
|
55
45
|
| `/export [file]` | Export session to HTML or JSONL |
|
|
56
46
|
| `/import <file>` | Import and resume a session from a JSONL file |
|
|
57
47
|
| `/share` | Upload as private GitHub gist with shareable HTML link |
|
|
48
|
+
| `/bug [description]` | Report a bug to the Pi developers; see [Sessions](sessions.md#reporting-bugs) |
|
|
58
49
|
| `/reload` | Reload keybindings, extensions, skills, prompts, themes, and context files |
|
|
59
50
|
| `/hotkeys` | Show all keyboard shortcuts |
|
|
60
51
|
| `/changelog` | Display version history |
|
|
61
52
|
| `/quit` | Quit Apex Code |
|
|
62
53
|
|
|
63
|
-
##
|
|
54
|
+
## Change direction
|
|
64
55
|
|
|
65
|
-
You can
|
|
56
|
+
You can send more input while Pi is working:
|
|
66
57
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
| What you want | Action |
|
|
59
|
+
|---|---|
|
|
60
|
+
| Adjust the current task | Type a message and press `Enter` |
|
|
61
|
+
| Add work after the current task | Type a message and press `Alt+Enter` |
|
|
62
|
+
| Return queued messages to the editor | Press `Alt+Up` |
|
|
63
|
+
| Stop the current task | Press `Escape` |
|
|
71
64
|
|
|
72
65
|
On Windows Terminal, Alt+Enter is fullscreen by default. Remap it as described in [Terminal setup](terminal-setup.md) if you want Apex Code to receive the shortcut.
|
|
73
66
|
|
|
74
|
-
|
|
67
|
+
Windows Terminal reserves some Alt shortcuts. See [Terminal Setup](terminal-setup.md) for the Windows alternatives.
|
|
75
68
|
|
|
76
|
-
##
|
|
69
|
+
## Change the model or settings
|
|
77
70
|
|
|
78
71
|
Sessions are saved automatically to `~/.apex-code/agent/sessions/`, organized by working directory.
|
|
79
72
|
|
|
@@ -86,17 +79,13 @@ apex-code --session <path|id> # Use a specific session file or session ID
|
|
|
86
79
|
apex-code --fork <path|id> # Fork a session into a new session file
|
|
87
80
|
```
|
|
88
81
|
|
|
89
|
-
|
|
82
|
+
Use `!!` when you want to run a command without sending its output to the model.
|
|
90
83
|
|
|
91
|
-
|
|
92
|
-
- `/tree` navigates the in-file session tree and can summarize abandoned branches.
|
|
93
|
-
- `/fork` creates a new session from an earlier user message.
|
|
94
|
-
- `/clone` duplicates the current active branch into a new session file.
|
|
95
|
-
- `/compact` summarizes older messages to free context.
|
|
84
|
+
## Copy, export, or share results
|
|
96
85
|
|
|
97
|
-
|
|
86
|
+
Press `Ctrl+X` or run `/copy` to copy the last assistant response. Use `/export` to save the session as HTML or JSONL.
|
|
98
87
|
|
|
99
|
-
|
|
88
|
+
Use `/share` to upload the session and get a viewer link. With Radius authentication, the artifact is visible to your Radius organization. Otherwise, Pi creates a private GitHub gist through the GitHub CLI. Review the session first because it can contain prompts, tool output, file contents, and credentials exposed during the conversation.
|
|
100
89
|
|
|
101
90
|
Apex Code loads `AGENTS.md` or `CLAUDE.md` at startup from:
|
|
102
91
|
|
|
@@ -106,9 +95,9 @@ Apex Code loads `AGENTS.md` or `CLAUDE.md` at startup from:
|
|
|
106
95
|
|
|
107
96
|
If a directory contains `AGENTS.override.md`, Apex Code loads it instead of `AGENTS.md` or `CLAUDE.md` from that directory. Context files from other directories still layer normally.
|
|
108
97
|
|
|
109
|
-
|
|
98
|
+
## Collect diagnostic information
|
|
110
99
|
|
|
111
|
-
|
|
100
|
+
When troubleshooting terminal rendering or conversation state, run `/debug`. Pi writes the rendered terminal lines and current session messages to `pi-debug.log` in your [agent directory](configuration.md#agent-directory).
|
|
112
101
|
|
|
113
102
|
Replace the default system prompt with:
|
|
114
103
|
|
|
@@ -277,7 +266,7 @@ apex-code "List all .ts files in src/"
|
|
|
277
266
|
apex-code -p "Summarize this codebase"
|
|
278
267
|
|
|
279
268
|
# Prompt beginning with a dash
|
|
280
|
-
|
|
269
|
+
apex-code -p -- "- Summarize these points"
|
|
281
270
|
|
|
282
271
|
# Non-interactive with piped stdin
|
|
283
272
|
cat README.md | apex-code -p "Summarize this text"
|
package/docs/windows.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Windows
|
|
1
|
+
# Run Pi on Windows
|
|
2
2
|
|
|
3
3
|
Apex Code uses Git Bash by default on Windows. Checked locations (in order):
|
|
4
4
|
|
|
@@ -6,34 +6,62 @@ Apex Code uses Git Bash by default on Windows. Checked locations (in order):
|
|
|
6
6
|
2. Git Bash (`C:\Program Files\Git\bin\bash.exe`)
|
|
7
7
|
3. `bash.exe` on PATH (Cygwin, MSYS2, WSL)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Choose native Windows or WSL
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
| Environment | Command environment | Use it when |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Native Windows with Git Bash | Git Bash for the built-in `bash` tool and `!` commands | Your files and development tools primarily live on Windows |
|
|
14
|
+
| Native Windows with the `powershell` tool | PowerShell for model tool calls; Bash remains available for `!` commands | The task depends on PowerShell modules or Windows-native commands |
|
|
15
|
+
| WSL | Linux Bash and tools inside the selected WSL distribution | Your files and toolchain already live in Linux or WSL |
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
## Use Git Bash on native Windows
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
For most native Windows users, installing [Git for Windows](https://git-scm.com/download/win) is sufficient.
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
Pi resolves Bash in this order:
|
|
22
|
+
|
|
23
|
+
1. `shellPath` from `~/.apex-code/agent/settings.json`
|
|
24
|
+
2. Git Bash under `Program Files` or `Program Files (x86)`
|
|
25
|
+
3. `bash.exe` on `PATH`, including Cygwin, MSYS2, or legacy WSL Bash
|
|
26
|
+
|
|
27
|
+
Start Pi and enter this command to verify the shell:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
!printf 'Bash is working\n'
|
|
21
31
|
```
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
If Pi cannot find Bash, it reports the locations it checked. Install Git for Windows, put another Bash executable on `PATH`, or configure `shellPath`.
|
|
34
|
+
|
|
35
|
+
## Let the model use PowerShell
|
|
36
|
+
|
|
37
|
+
The optional `powershell` tool runs commands through `pwsh.exe` when available, then falls back to Windows PowerShell. It starts PowerShell with `-NoProfile -NonInteractive -ExecutionPolicy Bypass`. Administrator-enforced execution policies can still take precedence.
|
|
38
|
+
|
|
39
|
+
To replace the model-facing `bash` tool with `powershell`, add this to `~/.apex-code/agent/settings.json`:
|
|
24
40
|
|
|
25
41
|
```json
|
|
26
42
|
{
|
|
27
|
-
"defaultTools": ["read", "
|
|
43
|
+
"defaultTools": ["read", "powershell", "edit", "write"]
|
|
28
44
|
}
|
|
29
45
|
```
|
|
30
46
|
|
|
31
|
-
The `!` and `!!` editor commands
|
|
47
|
+
Restart Pi, then ask it to run a harmless PowerShell command. The `!` and `!!` editor commands continue to use Bash. The `powershell` tool is available only when Pi runs as a native Windows process.
|
|
48
|
+
|
|
49
|
+
See [Settings](settings.md#tools) for other tool combinations.
|
|
50
|
+
|
|
51
|
+
## Use a custom Bash executable
|
|
32
52
|
|
|
33
|
-
|
|
53
|
+
Set `shellPath` when Bash is installed somewhere Pi does not discover automatically:
|
|
34
54
|
|
|
35
55
|
```json
|
|
36
56
|
{
|
|
37
57
|
"shellPath": "C:\\cygwin64\\bin\\bash.exe"
|
|
38
58
|
}
|
|
39
59
|
```
|
|
60
|
+
|
|
61
|
+
JSON uses backslashes for escape sequences. When you write a Windows path with backslashes, write each backslash twice, as shown above.
|
|
62
|
+
|
|
63
|
+
See [Configure shell commands](shell-aliases.md) for command prefixes, aliases, and the complete shell-resolution behavior.
|
|
64
|
+
|
|
65
|
+
## Configure Windows Terminal
|
|
66
|
+
|
|
67
|
+
Windows Terminal reserves or rewrites some modified keys. See [Windows Terminal](terminal-setup.md#windows-terminal) to configure `Shift+Enter` and `Alt+Enter`, and [Keybindings](keybindings.md) for Pi's Windows and WSL shortcut defaults.
|
package/examples/README.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Examples
|
|
2
2
|
|
|
3
|
-
Example code for pi-coding-agent SDK and extensions.
|
|
3
|
+
Example code for the pi-coding-agent SDK, process integration, and extensions.
|
|
4
|
+
|
|
5
|
+
## CLI integration
|
|
6
|
+
|
|
7
|
+
[`rpc-client.ts`](rpc-client.ts) uses the typed `RpcClient` to run Pi in a child process, stream events, and wait for the run to settle.
|
|
8
|
+
|
|
9
|
+
Build the coding-agent package before running it from a repository checkout:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx tsx examples/rpc-client.ts "Explain this repository"
|
|
13
|
+
```
|
|
4
14
|
|
|
5
15
|
## Directories
|
|
6
16
|
|
|
@@ -18,8 +28,12 @@ Example extensions demonstrating:
|
|
|
18
28
|
- External integrations (SSH, file watchers, system theme sync)
|
|
19
29
|
- Custom providers (Anthropic with custom streaming, GitLab Duo)
|
|
20
30
|
|
|
31
|
+
### [plugins/pi-example-plugin/](plugins/pi-example-plugin/)
|
|
32
|
+
An experimental plugin package that Pi automatically builds into separate Session-worker and TUI Chord facets.
|
|
33
|
+
|
|
21
34
|
## Documentation
|
|
22
35
|
|
|
23
|
-
- [SDK
|
|
36
|
+
- [SDK Examples](sdk/README.md)
|
|
37
|
+
- [CLI Integration](../docs/cli-integration.md)
|
|
24
38
|
- [Extensions Documentation](../docs/extensions.md)
|
|
25
39
|
- [Skills Documentation](../docs/skills.md)
|
|
@@ -36,7 +36,6 @@ cp permission-gate.ts ~/.pi/agent/extensions/
|
|
|
36
36
|
| `questionnaire.ts` | Multi-question input with tab bar navigation between questions |
|
|
37
37
|
| `tool-override.ts` | Override built-in tools (e.g., add logging/access control to `read`) |
|
|
38
38
|
| `dynamic-tools.ts` | Register tools after startup (`session_start`) and at runtime via command, with prompt snippets and tool-specific prompt guidelines |
|
|
39
|
-
| `kimi-deferred-tools.ts` | Search for and progressively activate tools for Kimi's deferred-tool loading protocol |
|
|
40
39
|
| `structured-output.ts` | Final structured-output tool that returns `terminate: true` so the agent can end on the tool call |
|
|
41
40
|
| `built-in-tool-renderer.ts` | Custom compact rendering for built-in tools (read, bash, edit, write) while keeping original behavior |
|
|
42
41
|
| `minimal-mode.ts` | Override built-in tool rendering for minimal display (only tool calls, no output in collapsed mode) |
|