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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# How Apex Code Works
|
|
2
|
+
|
|
3
|
+
Apex Code coordinates model requests, tool execution, context assembly, and session storage. A session is Apex Code's record of a conversation, including messages, tool calls and results, model changes, compactions, and other events.
|
|
4
|
+
|
|
5
|
+
Messages and events in a session form a tree. Each path through that tree is a branch. The branch ending at the current entry is the active branch and supplies the history for the next model request.
|
|
6
|
+
|
|
7
|
+
## Agent loop
|
|
8
|
+
|
|
9
|
+
A submitted message is added to the active branch. Apex Code builds a model request from the system prompt, active branch, available tools, and model settings, then sends it through the selected provider.
|
|
10
|
+
|
|
11
|
+
The provider streams an assistant response, which can contain text and tool calls. Apex Code records the response, executes each tool call, and records the results. That completes one turn. If tool results or queued messages require another model request, Apex Code starts another turn. Otherwise, the run ends.
|
|
12
|
+
|
|
13
|
+
Steering messages enter after the current assistant turn. Follow-up messages enter after the agent has finished its pending work. Aborting stops the current run and returns queued messages to the editor.
|
|
14
|
+
|
|
15
|
+
## Context
|
|
16
|
+
|
|
17
|
+
The active branch supplies conversation history. Apex Code converts its session entries into model-compatible user, assistant, and tool-result messages.
|
|
18
|
+
|
|
19
|
+
Apex Code builds the system prompt from its base instructions and discovered context files. The request also carries tool definitions and skill descriptions.
|
|
20
|
+
|
|
21
|
+
Full skill instructions are loaded on demand. Extensions can add instructions or transform context.
|
|
22
|
+
|
|
23
|
+
Prompt templates expand editor input before it becomes a user message. Selected files, images, pasted text, and shell output can become message content.
|
|
24
|
+
|
|
25
|
+
## Sessions
|
|
26
|
+
|
|
27
|
+
Persistent sessions are JSONL files. Each tree entry has an ID and refers to its parent. The current entry identifies the active branch.
|
|
28
|
+
|
|
29
|
+
Continuing from an earlier entry creates another branch in the same file. Forking and cloning copy selected history into a new session file.
|
|
30
|
+
|
|
31
|
+
Model context is reconstructed from the active branch. Compaction inserts a summary entry that replaces older messages in subsequent model requests. The original entries remain in the session tree.
|
|
32
|
+
|
|
33
|
+
## Interfaces
|
|
34
|
+
|
|
35
|
+
Interactive mode renders session and agent events in the terminal. Print mode runs a prompt and writes the final response. JSON mode writes agent events as JSONL.
|
|
36
|
+
|
|
37
|
+
RPC mode accepts JSONL commands on stdin and writes responses and events to stdout. The TypeScript SDK creates and controls agent sessions in process.
|
|
38
|
+
|
|
39
|
+
All interfaces use the same agent and session mechanisms.
|
|
40
|
+
|
|
41
|
+
## Extensions and resources
|
|
42
|
+
|
|
43
|
+
Extensions are TypeScript modules loaded into the Apex Code process. Their factory functions register tools, commands, shortcuts, providers, event handlers, renderers, and terminal UI.
|
|
44
|
+
|
|
45
|
+
Skills provide on-demand instructions and supporting files. Prompt templates provide reusable message text. Themes provide terminal colors. Apex Code packages distribute these resources through npm or git.
|
|
46
|
+
|
|
47
|
+
## Trust and permissions
|
|
48
|
+
|
|
49
|
+
Apex Code resolves project trust before loading project settings and resources. After the trust decision and project-resource loading, Apex Code loads context files. Enabled tools use the operating-system permissions of the Apex Code process. Extensions execute inside that process.
|
|
Binary file
|
package/docs/index.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Apex Code is a minimal terminal coding harness. It is designed to stay small at the core while being extended through TypeScript extensions, skills, prompt templates, themes, and Apex Code packages.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Use Apex Code for software development, research notes, writing projects, data files, or hobby work. You can use Apex Code as is, prompt it to adapt itself to your workflow, or build other applications powered by Apex Code using the SDK.
|
|
6
6
|
|
|
7
7
|
Install Apex Code with npm, pnpm, Yarn, or Bun — all resolve it from the same npm registry:
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@ npm install -g --ignore-scripts apex-code
|
|
|
14
14
|
|
|
15
15
|
To uninstall, use the package manager that installed it: `npm uninstall -g apex-code`, `pnpm remove -g apex-code`, `yarn global remove apex-code`, or `bun uninstall -g apex-code`.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Find reference and setup information
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
apex-code
|
|
@@ -22,7 +22,7 @@ apex-code
|
|
|
22
22
|
|
|
23
23
|
Authenticate with `/login` for subscription providers, or set an API key such as `ANTHROPIC_API_KEY` before starting Apex Code.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
## Work safely
|
|
26
26
|
|
|
27
27
|
## Start here
|
|
28
28
|
|
package/docs/json.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
# JSON Event Stream
|
|
1
|
+
# JSON Event Stream
|
|
2
|
+
|
|
3
|
+
JSON mode emits structured progress for one invocation:
|
|
2
4
|
|
|
3
5
|
```bash
|
|
4
6
|
apex-code --mode json "Your prompt"
|
|
@@ -6,7 +8,7 @@ apex-code --mode json "Your prompt"
|
|
|
6
8
|
|
|
7
9
|
Outputs all session events as JSON lines to stdout. Useful for integrating Apex Code into other tools or custom UIs.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
This page is the canonical reference for events shared by JSON and RPC mode. Message values use the [shared message types](message-types.md).
|
|
10
12
|
|
|
11
13
|
Wire events use `JsonAgentSessionEvent`. It matches
|
|
12
14
|
[`AgentSessionEvent`](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/agent-session.ts)
|
|
@@ -53,7 +55,7 @@ type AgentEvent =
|
|
|
53
55
|
|
|
54
56
|
## Message Types
|
|
55
57
|
|
|
56
|
-
Base messages from [`packages/ai/src/types.ts`](https://github.com/earendil-works/pi
|
|
58
|
+
Base messages from [`packages/ai/src/types.ts`](https://github.com/earendil-works/pi/blob/main/packages/ai/src/types.ts#L134):
|
|
57
59
|
- `UserMessage` (line 134)
|
|
58
60
|
- `AssistantMessage` (line 140)
|
|
59
61
|
- `ToolResultMessage` (line 152)
|
|
@@ -93,6 +95,8 @@ fields. `message_end` contains the final authoritative message.
|
|
|
93
95
|
|
|
94
96
|
## Example
|
|
95
97
|
|
|
98
|
+
Print completed messages from a one-shot run:
|
|
99
|
+
|
|
96
100
|
```bash
|
|
97
101
|
apex-code --mode json "List files" 2>/dev/null | jq -c 'select(.type == "message_end")'
|
|
98
102
|
```
|
package/docs/keybindings.md
CHANGED
|
@@ -1,16 +1,35 @@
|
|
|
1
|
-
# Keybindings
|
|
1
|
+
# Keybindings Reference
|
|
2
2
|
|
|
3
3
|
All keyboard shortcuts can be customized via `~/.apex-code/agent/keybindings.json`. Each action can be bound to one or more keys.
|
|
4
4
|
|
|
5
5
|
The config file uses the same namespaced keybinding ids that Apex Code uses internally and that extension authors use in `keyHint()` and injected `keybindings` managers.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Assign keybindings
|
|
8
8
|
|
|
9
9
|
After editing `keybindings.json`, run `/reload` in Apex Code to apply the changes without restarting the session.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Map each action identifier to one key or a list of keys:
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"app.session.new": "ctrl+shift+n",
|
|
16
|
+
"app.session.tree": ["ctrl+shift+t", "alt+shift+t"]
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
A configured value replaces the default for that action. Use an empty list to disable an action's keybindings:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"tui.altScreen.pageUp": []
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
After editing the file, run `/reload` to apply the changes to the active session.
|
|
29
|
+
|
|
30
|
+
## Key syntax
|
|
31
|
+
|
|
32
|
+
Write a key as `modifier+key`. Modifiers are `ctrl`, `shift`, `alt`, and `super`. You can combine modifiers. Valid keys are:
|
|
14
33
|
|
|
15
34
|
- **Letters:** `a-z`
|
|
16
35
|
- **Digits:** `0-9`
|
|
@@ -18,20 +37,22 @@ After editing `keybindings.json`, run `/reload` in Apex Code to apply the change
|
|
|
18
37
|
- **Function:** `f1`-`f12`
|
|
19
38
|
- **Symbols:** `` ` ``, `-`, `=`, `[`, `]`, `\`, `;`, `'`, `,`, `.`, `/`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, `*`, `(`, `)`, `_`, `+`, `|`, `~`, `{`, `}`, `:`, `<`, `>`, `?`
|
|
20
39
|
|
|
21
|
-
|
|
40
|
+
Examples: `ctrl+shift+x`, `alt+ctrl+x`, `ctrl+shift+alt+x`, `super+k`, `ctrl+super+k`, and `ctrl+1`.
|
|
22
41
|
|
|
23
42
|
`super` bindings require a terminal that reports the modifier separately, typically through the Kitty keyboard protocol. They may not work in terminals without that support.
|
|
24
43
|
|
|
25
|
-
##
|
|
44
|
+
## Actions
|
|
26
45
|
|
|
27
|
-
###
|
|
46
|
+
### Terminal UI
|
|
47
|
+
|
|
48
|
+
#### Cursor movement
|
|
28
49
|
|
|
29
50
|
| Keybinding id | Default | Description |
|
|
30
|
-
|
|
51
|
+
|---|---|---|
|
|
31
52
|
| `tui.editor.cursorUp` | `up` | Move cursor up, browsing older history at the top |
|
|
32
53
|
| `tui.editor.cursorDown` | `down` | Move cursor down, browsing newer history at the bottom |
|
|
33
|
-
| `tui.editor.historyPrevious` |
|
|
34
|
-
| `tui.editor.historyNext` |
|
|
54
|
+
| `tui.editor.historyPrevious` | None | Select the previous prompt history entry |
|
|
55
|
+
| `tui.editor.historyNext` | None | Select the next prompt history entry |
|
|
35
56
|
| `tui.editor.cursorLeft` | `left`, `ctrl+b` | Move cursor left |
|
|
36
57
|
| `tui.editor.cursorRight` | `right`, `ctrl+f` | Move cursor right |
|
|
37
58
|
| `tui.editor.cursorWordLeft` | `alt+left`, `ctrl+left`, `alt+b` | Move cursor word left |
|
|
@@ -43,39 +64,29 @@ Modifier combinations: `ctrl+shift+x`, `alt+ctrl+x`, `ctrl+shift+alt+x`, `super+
|
|
|
43
64
|
| `tui.editor.pageUp` | `pageUp`, `ctrl+pageUp` | Scroll up by page |
|
|
44
65
|
| `tui.editor.pageDown` | `pageDown`, `ctrl+pageDown` | Scroll down by page |
|
|
45
66
|
|
|
46
|
-
The dedicated history actions
|
|
67
|
+
The dedicated history actions browse prompt history regardless of cursor position and take precedence over application actions using the same key.
|
|
47
68
|
|
|
48
|
-
|
|
69
|
+
#### Text editing
|
|
49
70
|
|
|
50
71
|
| Keybinding id | Default | Description |
|
|
51
|
-
|
|
72
|
+
|---|---|---|
|
|
52
73
|
| `tui.editor.deleteCharBackward` | `backspace` | Delete character backward |
|
|
53
74
|
| `tui.editor.deleteCharForward` | `delete`, `ctrl+d` | Delete character forward |
|
|
54
75
|
| `tui.editor.deleteWordBackward` | `ctrl+w`, `alt+backspace` | Delete word backward |
|
|
55
76
|
| `tui.editor.deleteWordForward` | `alt+d`, `alt+delete` | Delete word forward |
|
|
56
77
|
| `tui.editor.deleteToLineStart` | `ctrl+u` | Delete to line start |
|
|
57
78
|
| `tui.editor.deleteToLineEnd` | `ctrl+k` | Delete to line end |
|
|
58
|
-
|
|
59
|
-
### TUI Input
|
|
60
|
-
|
|
61
|
-
| Keybinding id | Default | Description |
|
|
62
|
-
|--------|---------|-------------|
|
|
63
|
-
| `tui.input.newLine` | `shift+enter`, `ctrl+j` | Insert new line |
|
|
64
|
-
| `tui.input.submit` | `enter` | Submit input |
|
|
65
|
-
| `tui.input.tab` | `tab` | Tab / autocomplete |
|
|
66
|
-
|
|
67
|
-
### TUI Kill Ring
|
|
68
|
-
|
|
69
|
-
| Keybinding id | Default | Description |
|
|
70
|
-
|--------|---------|-------------|
|
|
71
79
|
| `tui.editor.yank` | `ctrl+y` | Paste most recently deleted text |
|
|
72
80
|
| `tui.editor.yankPop` | `alt+y` | Cycle through deleted text after yank |
|
|
73
81
|
| `tui.editor.undo` | `ctrl+-` (`ctrl+z` on Windows; `alt+z` on WSL) | Undo last edit |
|
|
74
82
|
|
|
75
|
-
|
|
83
|
+
#### Input and selection
|
|
76
84
|
|
|
77
85
|
| Keybinding id | Default | Description |
|
|
78
|
-
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| `tui.input.newLine` | `shift+enter`, `ctrl+j` | Insert new line |
|
|
88
|
+
| `tui.input.submit` | `enter` | Submit input |
|
|
89
|
+
| `tui.input.tab` | `tab` | Tab or autocomplete |
|
|
79
90
|
| `tui.input.copy` | `ctrl+c` | Copy selection |
|
|
80
91
|
| `tui.select.up` | `up` | Move selection up |
|
|
81
92
|
| `tui.select.down` | `down` | Move selection down |
|
|
@@ -84,29 +95,18 @@ The dedicated history actions always change history entries, regardless of the c
|
|
|
84
95
|
| `tui.select.confirm` | `enter` | Confirm selection |
|
|
85
96
|
| `tui.select.cancel` | `escape`, `ctrl+c` | Cancel selection |
|
|
86
97
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
These actions apply when interactive mode uses `--tui-mode fullscreen` and target the primary transcript scroll region. Two-finger trackpad and mouse-wheel input scroll the region under the pointer, falling back to the transcript over the fixed editor/status/footer dock. Clicking an OSC 8 hyperlink opens it in the default handler. Dragging with the primary mouse button selects text and copies it to the clipboard; holding at the transcript's top or bottom edge auto-scrolls into off-screen content. See [Terminal setup](terminal-setup.md) for terminal-specific mouse and trackpad behavior.
|
|
98
|
+
#### Fullscreen
|
|
90
99
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
| Key | Default mode | Fullscreen mode |
|
|
94
|
-
|-----|--------------|-----------------|
|
|
95
|
-
| `home`, `end` | Editor | Transcript |
|
|
96
|
-
| `ctrl+home`, `ctrl+end` | Editor | Editor |
|
|
97
|
-
| `pageUp`, `pageDown` | Editor | Transcript |
|
|
98
|
-
| `ctrl+pageUp`, `ctrl+pageDown` | Editor | Editor |
|
|
99
|
-
|
|
100
|
-
This routing remains configurable through the ordinary action bindings. For example, `"tui.altScreen.pageUp": "ctrl+pageUp"` makes `pageUp` control the editor and `ctrl+pageUp` control the transcript in fullscreen mode. Bind `tui.altScreen.halfPageUp` and `tui.altScreen.halfPageDown` for half-page steps, or bind `tui.altScreen.lineUp` and `tui.altScreen.lineDown` for single-line steps. Setting `"tui.altScreen.pageUp": []` disables that transcript shortcut entirely. User bindings replace the defaults for that action.
|
|
100
|
+
In fullscreen mode, these actions control the transcript and take precedence over editor actions using the same key.
|
|
101
101
|
|
|
102
102
|
| Keybinding id | Default | Description |
|
|
103
|
-
|
|
103
|
+
|---|---|---|
|
|
104
104
|
| `tui.altScreen.pageUp` | `pageUp` | Scroll the transcript up by one page |
|
|
105
105
|
| `tui.altScreen.pageDown` | `pageDown` | Scroll the transcript down by one page |
|
|
106
|
-
| `tui.altScreen.halfPageUp` |
|
|
107
|
-
| `tui.altScreen.halfPageDown` |
|
|
108
|
-
| `tui.altScreen.lineUp` |
|
|
109
|
-
| `tui.altScreen.lineDown` |
|
|
106
|
+
| `tui.altScreen.halfPageUp` | None | Scroll the transcript up by half a page |
|
|
107
|
+
| `tui.altScreen.halfPageDown` | None | Scroll the transcript down by half a page |
|
|
108
|
+
| `tui.altScreen.lineUp` | None | Scroll the transcript up by one line |
|
|
109
|
+
| `tui.altScreen.lineDown` | None | Scroll the transcript down by one line |
|
|
110
110
|
| `tui.altScreen.previousPrompt` | `ctrl+shift+up`, `ctrl+up` (`ctrl+up` only on Windows and WSL) | Jump to the previous marked message |
|
|
111
111
|
| `tui.altScreen.nextPrompt` | `ctrl+shift+down`, `ctrl+down` (`ctrl+down` only on Windows and WSL) | Jump to the next marked message |
|
|
112
112
|
| `tui.altScreen.search` | `ctrl+shift+f` (`ctrl+f` on Windows and WSL) | Search the rendered transcript |
|
|
@@ -123,18 +123,20 @@ This routing remains configurable through the ordinary action bindings. For exam
|
|
|
123
123
|
| `app.interrupt` | `escape` | Cancel / abort |
|
|
124
124
|
| `app.clear` | `ctrl+c` | Clear editor (first) / exit (second) |
|
|
125
125
|
| `app.exit` | `ctrl+d` | Exit (when editor empty) |
|
|
126
|
-
| `app.suspend` | `ctrl+z` (
|
|
126
|
+
| `app.suspend` | `ctrl+z` (None on Windows) | Suspend to background |
|
|
127
127
|
| `app.editor.external` | `ctrl+g` | Open in external editor (`externalEditor`, `$VISUAL`, `$EDITOR`, Notepad on Windows, or `nano` elsewhere) |
|
|
128
128
|
| `app.clipboard.pasteImage` | `ctrl+v` (`alt+v` on Windows and WSL) | Paste image or text from clipboard |
|
|
129
129
|
|
|
130
|
+
On native Windows, `app.suspend` has no default because Windows terminals do not support Unix job control. If you assign it manually, Pi shows a status message instead of suspending. WSL uses the normal `ctrl+z` and `fg` behavior.
|
|
131
|
+
|
|
130
132
|
### Sessions
|
|
131
133
|
|
|
132
134
|
| Keybinding id | Default | Description |
|
|
133
135
|
|--------|---------|-------------|
|
|
134
|
-
| `app.session.new` |
|
|
135
|
-
| `app.session.tree` |
|
|
136
|
-
| `app.session.fork` |
|
|
137
|
-
| `app.session.resume` |
|
|
136
|
+
| `app.session.new` | None | Start a new session (`/new`) |
|
|
137
|
+
| `app.session.tree` | None | Open session tree navigator (`/tree`) |
|
|
138
|
+
| `app.session.fork` | None | Fork current session (`/fork`) |
|
|
139
|
+
| `app.session.resume` | None | Open session resume picker (`/resume`) |
|
|
138
140
|
| `app.session.togglePath` | `ctrl+p` | Toggle path display |
|
|
139
141
|
| `app.session.toggleSort` | `ctrl+s` | Toggle sort mode |
|
|
140
142
|
| `app.session.toggleNamedFilter` | `ctrl+n` | Toggle named-only filter |
|
|
@@ -149,15 +151,17 @@ This routing remains configurable through the ordinary action bindings. For exam
|
|
|
149
151
|
| `app.model.select` | `ctrl+l` | Open model selector |
|
|
150
152
|
| `app.model.cycleForward` | `ctrl+p` | Cycle to next model |
|
|
151
153
|
| `app.model.cycleBackward` | `shift+ctrl+p` (`alt+p` on Windows and WSL) | Cycle to previous model |
|
|
154
|
+
| `app.models.save` | `ctrl+s` | Save the selected default model or scoped model configuration to settings |
|
|
152
155
|
| `app.thinking.cycle` | `shift+tab` | Cycle thinking level |
|
|
156
|
+
| `app.thinking.save` | `ctrl+s` | Save current thinking level to settings |
|
|
153
157
|
| `app.thinking.toggle` | `ctrl+t` | Collapse or expand thinking blocks |
|
|
154
158
|
|
|
155
159
|
### Display and Message Queue
|
|
156
160
|
|
|
157
161
|
| Keybinding id | Default | Description |
|
|
158
162
|
|--------|---------|-------------|
|
|
159
|
-
| `app.tools.expand` | `ctrl+o` |
|
|
160
|
-
| `app.message.copy` | `ctrl+x` | Copy the selected message in `/tree`;
|
|
163
|
+
| `app.tools.expand` | `ctrl+o` | Cycle conversation detail: overview (everything collapsed), details (diffs and thinking if enabled in settings), all (full tool output and thinking) |
|
|
164
|
+
| `app.message.copy` | `ctrl+x` | Copy the selected message in `/tree`; in fullscreen mode, copy the active selection when `fullscreenCopyOnSelect` is `false`; otherwise copy the last assistant message |
|
|
161
165
|
| `app.message.followUp` | `alt+enter` (`ctrl+q` on Windows and WSL) | Queue follow-up message |
|
|
162
166
|
| `app.message.dequeue` | `alt+up` (`alt+q` on Windows and WSL) | Restore queued messages to editor |
|
|
163
167
|
|
|
@@ -183,7 +187,6 @@ Used inside the scoped models selector (opened via `/scoped-models`).
|
|
|
183
187
|
|
|
184
188
|
| Keybinding id | Default | Description |
|
|
185
189
|
|--------|---------|-------------|
|
|
186
|
-
| `app.models.save` | `ctrl+s` | Save current model selection to settings |
|
|
187
190
|
| `app.models.enableAll` | `ctrl+a` | Enable all models (or all matching the current search) |
|
|
188
191
|
| `app.models.clearAll` | `ctrl+x` | Clear all models (or all matching the current search) |
|
|
189
192
|
| `app.models.toggleProvider` | `ctrl+p` | Toggle all models for the current provider |
|
package/docs/llama-cpp.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# llama.cpp
|
|
1
|
+
# Local Models with llama.cpp
|
|
2
2
|
|
|
3
3
|
Apex Code supports the [llama.cpp](https://github.com/ggml-org/llama.cpp) router server. The router discovers multiple GGUF models and loads or unloads them on demand.
|
|
4
4
|
|
|
@@ -96,6 +96,6 @@ curl http://127.0.0.1:8080/models
|
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
- **No models in `/llama`:** Check `--models-dir`, the directory layout, and restart the router.
|
|
99
|
-
- **Model missing from `/model`:** Load it with `/llama` first.
|
|
99
|
+
- **Model missing from `/model` with `--no-models-autoload`:** Load it with `/llama` first.
|
|
100
100
|
- **Load fails or uses too much memory:** Lower `-c` or unload another model.
|
|
101
101
|
- **Server is not in router mode:** Start it without `--model`, `-m`, or `-hf`.
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# Message Types
|
|
2
|
+
|
|
3
|
+
Apex Code uses `AgentMessage` values in SDK state, lifecycle events, RPC responses, and persisted session message entries. This page defines those shared messages and their content blocks.
|
|
4
|
+
|
|
5
|
+
Message timestamps are Unix timestamps in milliseconds. They are different from the ISO 8601 timestamps on [session entries](session-format.md#entry-base).
|
|
6
|
+
|
|
7
|
+
Source definitions:
|
|
8
|
+
|
|
9
|
+
- [`packages/ai/src/types.ts`](https://github.com/Fchery87/apex-code/blob/main/packages/ai/src/types.ts) defines provider-facing messages and content blocks.
|
|
10
|
+
- [`packages/agent/src/types.ts`](https://github.com/Fchery87/apex-code/blob/main/packages/agent/src/types.ts) defines the extensible `AgentMessage` union.
|
|
11
|
+
- [`packages/coding-agent/src/core/messages.ts`](https://github.com/Fchery87/apex-code/blob/main/packages/coding-agent/src/core/messages.ts) adds coding-agent message roles.
|
|
12
|
+
|
|
13
|
+
## Content blocks
|
|
14
|
+
|
|
15
|
+
### TextContent
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
interface TextContent {
|
|
19
|
+
type: "text";
|
|
20
|
+
text: string;
|
|
21
|
+
textSignature?: string;
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`textSignature` contains provider-specific message metadata. Treat it as opaque.
|
|
26
|
+
|
|
27
|
+
### ImageContent
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
interface ImageContent {
|
|
31
|
+
type: "image";
|
|
32
|
+
data: string;
|
|
33
|
+
mimeType: string;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`data` is base64-encoded image data. `mimeType` identifies its media type, such as `image/png` or `image/jpeg`.
|
|
38
|
+
|
|
39
|
+
### ThinkingContent
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
interface ThinkingContent {
|
|
43
|
+
type: "thinking";
|
|
44
|
+
thinking: string;
|
|
45
|
+
thinkingSignature?: string;
|
|
46
|
+
redacted?: boolean;
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Thinking signatures contain provider-specific replay data. Treat them as opaque. A redacted block can have no visible thinking text while retaining an encrypted payload in `thinkingSignature`.
|
|
51
|
+
|
|
52
|
+
### ToolCall
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
interface ToolCall {
|
|
56
|
+
type: "toolCall";
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
arguments: Record<string, any>;
|
|
60
|
+
thoughtSignature?: string;
|
|
61
|
+
namespace?: string;
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`thoughtSignature` is provider-specific. `namespace` identifies an OpenAI Responses namespace for dynamically loaded or namespaced tools.
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
Assistant messages always contain usage. Tool results can contain usage when the tool performed nested model work.
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
interface Usage {
|
|
73
|
+
input: number;
|
|
74
|
+
output: number;
|
|
75
|
+
cacheRead: number;
|
|
76
|
+
cacheWrite: number;
|
|
77
|
+
cacheWrite1h?: number;
|
|
78
|
+
reasoning?: number;
|
|
79
|
+
totalTokens: number;
|
|
80
|
+
cost: {
|
|
81
|
+
input: number;
|
|
82
|
+
output: number;
|
|
83
|
+
cacheRead: number;
|
|
84
|
+
cacheWrite: number;
|
|
85
|
+
total: number;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
When present, `reasoning` is already included in `output`; do not add it again. `cacheWrite1h` is the subset of `cacheWrite` written with one-hour retention.
|
|
91
|
+
|
|
92
|
+
## Base messages
|
|
93
|
+
|
|
94
|
+
### SystemMessage
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
interface SystemMessage {
|
|
98
|
+
role: "system";
|
|
99
|
+
content: string | TextContent[];
|
|
100
|
+
sections?: Record<string, string | null>;
|
|
101
|
+
toolsAdded?: Tool[];
|
|
102
|
+
toolsRemoved?: ToolReference[];
|
|
103
|
+
replace?: boolean;
|
|
104
|
+
timestamp: number;
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The leading system message declares the initial prompt and tools. Later system messages can append instructions, replace or remove named prompt sections, and add or remove tools. Replaying them in order yields the current state. A message with `replace: true` discards the earlier state and establishes a complete new baseline.
|
|
109
|
+
|
|
110
|
+
### UserMessage
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
interface UserMessage {
|
|
114
|
+
role: "user";
|
|
115
|
+
content: string | (TextContent | ImageContent)[];
|
|
116
|
+
timestamp: number;
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### AssistantMessage
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
interface AssistantMessage {
|
|
124
|
+
role: "assistant";
|
|
125
|
+
content: (TextContent | ThinkingContent | ToolCall)[];
|
|
126
|
+
api: string;
|
|
127
|
+
provider: string;
|
|
128
|
+
model: string;
|
|
129
|
+
responseModel?: string;
|
|
130
|
+
responseId?: string;
|
|
131
|
+
providerThinkingLevel?: string;
|
|
132
|
+
diagnostics?: AssistantMessageDiagnostic[];
|
|
133
|
+
usage: Usage;
|
|
134
|
+
stopReason: "pending" | "stop" | "length" | "toolUse" | "error" | "aborted" | "deferred";
|
|
135
|
+
deferred?: DeferredHandle;
|
|
136
|
+
errorMessage?: string;
|
|
137
|
+
rawStopReason?: string;
|
|
138
|
+
endTurn?: boolean;
|
|
139
|
+
timestamp: number;
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`responseModel` records a concrete provider response model when it differs from the requested model. `responseId`, `providerThinkingLevel`, `diagnostics`, and `rawStopReason` preserve provider or runtime details.
|
|
144
|
+
|
|
145
|
+
`"pending"` is used for a partial assistant message while it streams. The completed message in `message_end` has a terminal stop reason, and Apex Code does not persist `"pending"` assistant messages in session JSONL.
|
|
146
|
+
|
|
147
|
+
A `"deferred"` response has a `DeferredHandle` with the provider data needed to retrieve it:
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
interface DeferredHandle {
|
|
151
|
+
provider: string;
|
|
152
|
+
modelId: string;
|
|
153
|
+
api: string;
|
|
154
|
+
id: string;
|
|
155
|
+
expiresAt?: number;
|
|
156
|
+
pollAfterMs?: number;
|
|
157
|
+
data?: JsonValue;
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### ToolResultMessage
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
interface ToolResultMessage<TDetails = any> {
|
|
165
|
+
role: "toolResult";
|
|
166
|
+
toolCallId: string;
|
|
167
|
+
toolName: string;
|
|
168
|
+
content: (TextContent | ImageContent)[];
|
|
169
|
+
details?: TDetails;
|
|
170
|
+
usage?: Usage;
|
|
171
|
+
isError: boolean;
|
|
172
|
+
timestamp: number;
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`details` is tool-specific. Optional `usage` reports nested model work performed by the tool and contributes to full-session statistics, but it is not part of the main model-call usage.
|
|
177
|
+
|
|
178
|
+
## Coding-agent messages
|
|
179
|
+
|
|
180
|
+
The coding-agent package extends `AgentMessage` with four roles.
|
|
181
|
+
|
|
182
|
+
### BashExecutionMessage
|
|
183
|
+
|
|
184
|
+
Created by direct shell commands, including the RPC [`bash`](rpc-commands.md#bash) command. It is not an LLM tool result.
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
interface BashExecutionMessage {
|
|
188
|
+
role: "bashExecution";
|
|
189
|
+
command: string;
|
|
190
|
+
output: string;
|
|
191
|
+
exitCode: number | undefined;
|
|
192
|
+
cancelled: boolean;
|
|
193
|
+
truncated: boolean;
|
|
194
|
+
fullOutputPath?: string;
|
|
195
|
+
excludeFromContext?: boolean;
|
|
196
|
+
timestamp: number;
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Unless `excludeFromContext` is true, Apex Code converts this message to user-role text before the next model request.
|
|
201
|
+
|
|
202
|
+
### CustomMessage
|
|
203
|
+
|
|
204
|
+
Created when an extension sends a context message.
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
interface CustomMessage<T = unknown> {
|
|
208
|
+
role: "custom";
|
|
209
|
+
customType: string;
|
|
210
|
+
content: string | (TextContent | ImageContent)[];
|
|
211
|
+
display: boolean;
|
|
212
|
+
details?: T;
|
|
213
|
+
timestamp: number;
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Apex Code converts its content to a user message for model requests. `display` controls terminal rendering; `details` is not sent to the model.
|
|
218
|
+
|
|
219
|
+
### BranchSummaryMessage
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
interface BranchSummaryMessage {
|
|
223
|
+
role: "branchSummary";
|
|
224
|
+
summary: string;
|
|
225
|
+
fromId: string | null;
|
|
226
|
+
timestamp: number;
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Apex Code creates this context message from a persisted `branch_summary` entry.
|
|
231
|
+
|
|
232
|
+
### CompactionSummaryMessage
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
interface CompactionSummaryMessage {
|
|
236
|
+
role: "compactionSummary";
|
|
237
|
+
summary: string;
|
|
238
|
+
tokensBefore: number;
|
|
239
|
+
timestamp: number;
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Apex Code creates this context message from a persisted `compaction` entry.
|
|
244
|
+
|
|
245
|
+
## AgentMessage union
|
|
246
|
+
|
|
247
|
+
In the coding agent, the union is equivalent to:
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
type AgentMessage =
|
|
251
|
+
| SystemMessage
|
|
252
|
+
| UserMessage
|
|
253
|
+
| AssistantMessage
|
|
254
|
+
| ToolResultMessage
|
|
255
|
+
| BashExecutionMessage
|
|
256
|
+
| CustomMessage
|
|
257
|
+
| BranchSummaryMessage
|
|
258
|
+
| CompactionSummaryMessage;
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
At the lower-level agent package, `AgentMessage` is `Message | CustomAgentMessages[keyof CustomAgentMessages]`. Applications can add roles through TypeScript declaration merging, so consumers should tolerate unknown custom roles when they accept messages from an augmented host.
|