@code-yeongyu/senpi 2026.6.6-3 → 2026.6.10-2
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 +30 -0
- package/README.md +102 -100
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/project-trust.d.ts +10 -0
- package/dist/cli/project-trust.d.ts.map +1 -0
- package/dist/cli/project-trust.js +48 -0
- package/dist/cli/project-trust.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +7 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +59 -0
- package/dist/cli/startup-ui.js.map +1 -0
- package/dist/cli.js +10 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +3 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +4 -1
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +2 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -2
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +6 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +1 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/degradation-monitor.d.ts +0 -1
- package/dist/core/extensions/builtin/compaction/degradation-monitor.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/degradation-monitor.js +0 -1
- package/dist/core/extensions/builtin/compaction/degradation-monitor.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.js +4 -4
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/policy.d.ts +0 -5
- package/dist/core/extensions/builtin/compaction/policy.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/policy.js +0 -4
- package/dist/core/extensions/builtin/compaction/policy.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.d.ts +0 -6
- package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js +0 -3
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.d.ts +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.js +10 -2
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.js.map +1 -1
- package/dist/core/extensions/builtin/permission-system/cli.d.ts +0 -3
- package/dist/core/extensions/builtin/permission-system/cli.d.ts.map +1 -1
- package/dist/core/extensions/builtin/permission-system/cli.js +0 -13
- package/dist/core/extensions/builtin/permission-system/cli.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/index.js +0 -2
- package/dist/core/extensions/builtin/todotools/index.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/prompt.d.ts +1 -1
- package/dist/core/extensions/builtin/todotools/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/prompt.js +0 -2
- package/dist/core/extensions/builtin/todotools/prompt.js.map +1 -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/loader.d.ts +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +4 -4
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +7 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +34 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +21 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-registry.d.ts +3 -4
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +23 -6
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/project-trust.d.ts +15 -0
- package/dist/core/project-trust.d.ts.map +1 -0
- package/dist/core/project-trust.js +58 -0
- package/dist/core/project-trust.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +2 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +24 -26
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts +0 -4
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +0 -15
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts +14 -3
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +128 -58
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/session-manager.d.ts +3 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +34 -17
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-resident-store.d.ts +16 -0
- package/dist/core/session-resident-store.d.ts.map +1 -0
- package/dist/core/session-resident-store.js +48 -0
- package/dist/core/session-resident-store.js.map +1 -0
- package/dist/core/settings-manager.d.ts +4 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +9 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +0 -5
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +0 -7
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/index.d.ts +0 -5
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +0 -67
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/trust-manager.d.ts +22 -0
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +75 -22
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +92 -129
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +39 -34
- package/dist/migrations.js.map +1 -1
- package/dist/modes/index.d.ts +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +7 -1
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +26 -4
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts +6 -3
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +22 -18
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +15 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +158 -19
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +0 -4
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +0 -7
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/working-status.d.ts +2 -0
- package/dist/modes/interactive/working-status.d.ts.map +1 -1
- package/dist/modes/interactive/working-status.js +34 -0
- package/dist/modes/interactive/working-status.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +0 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts +6 -2
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +58 -11
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/senpi +10 -1
- package/dist/utils/changelog.d.ts +1 -0
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +78 -0
- package/dist/utils/changelog.js.map +1 -1
- package/docs/compaction-guide.md +9 -9
- package/docs/compaction.md +2 -2
- package/docs/containerization.md +22 -22
- package/docs/custom-provider.md +13 -13
- package/docs/development.md +4 -2
- package/docs/docs.json +4 -0
- package/docs/extensions.md +46 -18
- package/docs/index.md +5 -4
- package/docs/json.md +21 -15
- package/docs/keybindings.md +6 -3
- package/docs/models.md +10 -43
- package/docs/packages.md +11 -13
- package/docs/prompt-templates.md +10 -3
- package/docs/providers.md +9 -9
- package/docs/rpc.md +14 -13
- package/docs/sdk.md +18 -9
- package/docs/security.md +55 -0
- package/docs/session-format.md +4 -4
- package/docs/sessions.md +14 -14
- package/docs/settings.md +14 -11
- package/docs/skills.md +8 -8
- package/docs/terminal-setup.md +38 -4
- package/docs/termux.md +3 -3
- package/docs/tmux.md +4 -2
- package/docs/tui.md +4 -4
- package/docs/usage.md +55 -57
- package/examples/extensions/README.md +1 -0
- 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/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/project-trust.ts +64 -0
- 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/node_modules/@earendil-works/pi-agent-core/README.md +4 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +125 -77
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +0 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +0 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +7 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/README.md +4 -5
- package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api-registry.js +0 -3
- package/node_modules/@earendil-works/pi-ai/dist/api-registry.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +6 -6
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +355 -313
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +376 -431
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +15 -7
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +17 -7
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts +0 -4
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js +0 -13
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +4 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts +1 -7
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +2 -16
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +5 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +0 -4
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +0 -6
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/README.md +1 -2
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +2 -0
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +6 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +89 -39
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +5 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +18 -4
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +131 -61
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +4 -7
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +4 -7
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +38 -76
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +14 -4
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +0 -4
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +43 -21
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -8
- package/dist/core/extensions/builtin/compaction/overflow-detection.d.ts +0 -11
- package/dist/core/extensions/builtin/compaction/overflow-detection.d.ts.map +0 -1
- package/dist/core/extensions/builtin/compaction/overflow-detection.js +0 -40
- package/dist/core/extensions/builtin/compaction/overflow-detection.js.map +0 -1
- package/dist/core/extensions/builtin/system-messages.d.ts +0 -47
- package/dist/core/extensions/builtin/system-messages.d.ts.map +0 -1
- package/dist/core/extensions/builtin/system-messages.js +0 -117
- package/dist/core/extensions/builtin/system-messages.js.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/config.d.ts +0 -10
- package/dist/core/extensions/builtin/todotools/continuation/config.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/config.js +0 -33
- package/dist/core/extensions/builtin/todotools/continuation/config.js.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/index.d.ts +0 -2
- package/dist/core/extensions/builtin/todotools/continuation/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/index.js +0 -2
- package/dist/core/extensions/builtin/todotools/continuation/index.js.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/prompt.d.ts +0 -5
- package/dist/core/extensions/builtin/todotools/continuation/prompt.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/prompt.js +0 -34
- package/dist/core/extensions/builtin/todotools/continuation/prompt.js.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/runtime.d.ts +0 -11
- package/dist/core/extensions/builtin/todotools/continuation/runtime.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/continuation/runtime.js +0 -201
- package/dist/core/extensions/builtin/todotools/continuation/runtime.js.map +0 -1
- package/dist/core/extensions/builtin/todotools/settings.d.ts +0 -6
- package/dist/core/extensions/builtin/todotools/settings.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/settings.js +0 -58
- package/dist/core/extensions/builtin/todotools/settings.js.map +0 -1
- package/dist/core/extensions/builtin/todotools/system-messages.d.ts +0 -34
- package/dist/core/extensions/builtin/todotools/system-messages.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/system-messages.js +0 -82
- package/dist/core/extensions/builtin/todotools/system-messages.js.map +0 -1
- package/dist/core/index.d.ts +0 -12
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -12
- package/dist/core/index.js.map +0 -1
package/docs/compaction-guide.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Compaction Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Senpi's compaction system helps you work on complex tasks that would otherwise exceed the LLM's context window. This guide explains how compaction works from a user perspective and how to get the most out of it.
|
|
4
4
|
|
|
5
5
|
## What is Compaction?
|
|
6
6
|
|
|
7
|
-
LLMs have finite context windows. When conversations grow too long,
|
|
7
|
+
LLMs have finite context windows. When conversations grow too long, senpi uses compaction to summarize older messages while preserving recent ones. Think of it like taking notes during a long meeting: you write down the key decisions and next steps so you can continue the conversation without remembering every word that was said.
|
|
8
8
|
|
|
9
9
|
Compaction happens automatically when needed, or you can trigger it manually with the `/compact` command.
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ Compaction happens automatically when needed, or you can trigger it manually wit
|
|
|
12
12
|
|
|
13
13
|
### Automatic Compaction
|
|
14
14
|
|
|
15
|
-
When the conversation approaches the context limit,
|
|
15
|
+
When the conversation approaches the context limit, senpi automatically compacts older messages. You'll see a `[compaction]` message in the TUI with a summary like "Compacted from 45000 tokens". The conversation continues without interruption.
|
|
16
16
|
|
|
17
17
|
### Manual Compaction
|
|
18
18
|
|
|
@@ -98,11 +98,11 @@ path/to/changed.ts
|
|
|
98
98
|
|
|
99
99
|
## Branch Summarization
|
|
100
100
|
|
|
101
|
-
When you use `/tree` to switch to a different branch,
|
|
101
|
+
When you use `/tree` to switch to a different branch, senpi offers to summarize the work you're leaving behind. This injects context from the abandoned branch into your new position.
|
|
102
102
|
|
|
103
103
|
### User Experience
|
|
104
104
|
|
|
105
|
-
After selecting a target in `/tree`,
|
|
105
|
+
After selecting a target in `/tree`, senpi asks: "Summarize branch?" You have three options:
|
|
106
106
|
|
|
107
107
|
1. **No summary** - Switch immediately
|
|
108
108
|
2. **Summarize** - Generate a summary using the default prompt
|
|
@@ -112,7 +112,7 @@ The summary appears as a `branch_summary` entry in your new branch, providing co
|
|
|
112
112
|
|
|
113
113
|
### Skipping the Prompt
|
|
114
114
|
|
|
115
|
-
If you frequently switch branches and don't want the prompt, set `branchSummary.skipPrompt: true` in your settings.
|
|
115
|
+
If you frequently switch branches and don't want the prompt, set `branchSummary.skipPrompt: true` in your settings. Senpi will switch branches without asking.
|
|
116
116
|
|
|
117
117
|
## Settings & Tuning
|
|
118
118
|
|
|
@@ -162,7 +162,7 @@ Check if compaction happened recently (look for the `[compaction]` marker). Expa
|
|
|
162
162
|
|
|
163
163
|
### Long Sessions Are Fine
|
|
164
164
|
|
|
165
|
-
Compaction lets sessions run indefinitely. Don't worry about starting fresh sessions just to manage context.
|
|
165
|
+
Compaction lets sessions run indefinitely. Don't worry about starting fresh sessions just to manage context. Senpi handles it automatically.
|
|
166
166
|
|
|
167
167
|
### If Something Gets Forgotten
|
|
168
168
|
|
|
@@ -235,6 +235,6 @@ Yes. The full history is in your session file. Use `/tree` to navigate to any po
|
|
|
235
235
|
|
|
236
236
|
- [`compaction.md`](compaction.md) - Technical internals and extension hooks
|
|
237
237
|
- [`settings.md`](settings.md) - Complete settings reference
|
|
238
|
-
- [`
|
|
238
|
+
- [`sessions.md`](sessions.md) - Session tree navigation
|
|
239
239
|
- [`extensions.md`](extensions.md) - Extension API for custom compaction
|
|
240
|
-
- [`session.md`](session.md) - Session file format
|
|
240
|
+
- [`session-format.md`](session-format.md) - Session file format
|
package/docs/compaction.md
CHANGED
|
@@ -13,7 +13,7 @@ For TypeScript definitions in your project, inspect `node_modules/@code-yeongyu/
|
|
|
13
13
|
|
|
14
14
|
## Overview
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Senpi has two summarization mechanisms:
|
|
17
17
|
|
|
18
18
|
| Mechanism | Trigger | Purpose |
|
|
19
19
|
|-----------|---------|---------|
|
|
@@ -76,7 +76,7 @@ What the LLM sees:
|
|
|
76
76
|
prompt from cmp messages from firstKeptEntryId
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
On repeated compactions, the summarized span starts at the previous compaction's kept boundary (`firstKeptEntryId`), not at the compaction entry itself, falling back to the entry after the previous compaction if that kept entry cannot be found in the path. This preserves messages that survived the earlier compaction by including them in the next summarization pass as well.
|
|
79
|
+
On repeated compactions, the summarized span starts at the previous compaction's kept boundary (`firstKeptEntryId`), not at the compaction entry itself, falling back to the entry after the previous compaction if that kept entry cannot be found in the path. This preserves messages that survived the earlier compaction by including them in the next summarization pass as well. Senpi also recalculates `tokensBefore` from the rebuilt session context before writing the new `CompactionEntry`, so the token count reflects the actual pre-compaction context being replaced.
|
|
80
80
|
|
|
81
81
|
### Split Turns
|
|
82
82
|
|
package/docs/containerization.md
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
Pi runs with all permissions by default, but in some cases, you will want to have more control over what directories Pi can write to and which accesses it has.
|
|
4
4
|
|
|
5
5
|
There are two general options. You can either
|
|
6
|
-
1. run the whole `
|
|
7
|
-
2. run `
|
|
6
|
+
1. run the whole `senpi` process inside an isolated environment, or
|
|
7
|
+
2. run `senpi` on the host and route tool execution into an isolated environment.
|
|
8
8
|
|
|
9
9
|
## Choose a pattern
|
|
10
10
|
|
|
11
11
|
| Pattern | What is isolated | Best for | Notes |
|
|
12
12
|
| --- | --- | --- | --- |
|
|
13
|
-
| OpenShell | Whole `
|
|
13
|
+
| OpenShell | Whole `senpi` process in a policy-controlled sandbox | Local or remote managed sandbox | Requires an OpenShell gateway |
|
|
14
14
|
| Gondolin extension | Built-in tools and `!` commands | Local micro-VM isolation while keeping auth on host | See [`examples/extensions/gondolin/`](../examples/extensions/gondolin/). |
|
|
15
|
-
| Plain Docker | Whole `
|
|
15
|
+
| Plain Docker | Whole `senpi` process in a local container | Simple local isolation | Provider API keys enter the container. |
|
|
16
16
|
|
|
17
|
-
Extensions run wherever the `
|
|
17
|
+
Extensions run wherever the `senpi` process runs. If you run host `senpi` with a tool-routing extension, other custom extension tools still run on the host unless they also delegate their operations.
|
|
18
18
|
|
|
19
19
|
## OpenShell
|
|
20
20
|
|
|
@@ -29,21 +29,21 @@ openshell gateway add <gateway-url> --name <name>
|
|
|
29
29
|
openshell gateway select <name>
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Launch `
|
|
32
|
+
Launch `senpi` inside an OpenShell sandbox:
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
openshell sandbox create --name
|
|
35
|
+
openshell sandbox create --name senpi-sandbox --from senpi -- senpi
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
In this pattern, the whole `
|
|
38
|
+
In this pattern, the whole `senpi` process runs inside the sandbox.
|
|
39
39
|
Built-in tools, `!` commands, and extension tools execute inside the OpenShell boundary.
|
|
40
40
|
|
|
41
41
|
If the gateway is remote, project files are not bind-mounted from the host, meaning writes in the sandbox are not reflected on your machine.
|
|
42
42
|
Clone the repository inside the sandbox or use OpenShell file transfer commands:
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
openshell sandbox upload
|
|
46
|
-
openshell sandbox download
|
|
45
|
+
openshell sandbox upload senpi-sandbox ./repo /workspace
|
|
46
|
+
openshell sandbox download senpi-sandbox /workspace/repo ./repo-out
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
OpenShell providers can keep raw model API keys outside the sandbox.
|
|
@@ -53,13 +53,13 @@ Configure Pi to use the corresponding OpenAI-compatible or Anthropic-compatible
|
|
|
53
53
|
## Gondolin
|
|
54
54
|
|
|
55
55
|
[Gondolin](https://github.com/earendil-works/gondolin) is a local Linux micro-VM.
|
|
56
|
-
Use the [example extension](../examples/extensions/gondolin) when you want `
|
|
56
|
+
Use the [example extension](../examples/extensions/gondolin) when you want `senpi` on the host but all built-in tools routed into the VM.
|
|
57
57
|
|
|
58
58
|
Setup:
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
cp -R packages/coding-agent/examples/extensions/gondolin ~/.
|
|
62
|
-
cd ~/.
|
|
61
|
+
cp -R packages/coding-agent/examples/extensions/gondolin ~/.senpi/agent/extensions/gondolin
|
|
62
|
+
cd ~/.senpi/agent/extensions/gondolin
|
|
63
63
|
npm install --ignore-scripts
|
|
64
64
|
```
|
|
65
65
|
|
|
@@ -67,7 +67,7 @@ Run from the project you want mounted:
|
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
69
|
cd /path/to/project
|
|
70
|
-
|
|
70
|
+
senpi -e ~/.senpi/agent/extensions/gondolin
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
The extension mounts the host cwd at `/workspace` in the VM and overrides `read`, `write`, `edit`, `bash`, `grep`, `find`, and `ls`.
|
|
@@ -78,9 +78,9 @@ Requirements: Node.js >= 23.6.0 for `@earendil-works/gondolin`, plus QEMU (requi
|
|
|
78
78
|
|
|
79
79
|
## Plain Docker
|
|
80
80
|
|
|
81
|
-
Run the whole `
|
|
81
|
+
Run the whole `senpi` process in Docker when you want the simplest local container boundary.
|
|
82
82
|
|
|
83
|
-
`Dockerfile.
|
|
83
|
+
`Dockerfile.senpi`:
|
|
84
84
|
|
|
85
85
|
```dockerfile
|
|
86
86
|
FROM node:24-bookworm-slim
|
|
@@ -88,24 +88,24 @@ FROM node:24-bookworm-slim
|
|
|
88
88
|
RUN apt-get update \
|
|
89
89
|
&& apt-get install -y --no-install-recommends bash ca-certificates git ripgrep \
|
|
90
90
|
&& rm -rf /var/lib/apt/lists/*
|
|
91
|
-
RUN npm install -g --ignore-scripts @
|
|
91
|
+
RUN npm install -g --ignore-scripts @code-yeongyu/senpi
|
|
92
92
|
|
|
93
93
|
WORKDIR /workspace
|
|
94
|
-
ENTRYPOINT ["
|
|
94
|
+
ENTRYPOINT ["senpi"]
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
Build and run:
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
|
-
docker build -t
|
|
100
|
+
docker build -t senpi-sandbox -f Dockerfile.senpi .
|
|
101
101
|
|
|
102
102
|
docker run --rm -it \
|
|
103
103
|
-e ANTHROPIC_API_KEY \
|
|
104
104
|
-v "$PWD:/workspace" \
|
|
105
|
-
-v
|
|
106
|
-
|
|
105
|
+
-v senpi-agent-home:/root/.senpi/agent \
|
|
106
|
+
senpi-sandbox
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
The `-v "$PWD:/workspace"` mounts your current directory into the container at /workspace such that reads and writes in `/workspace` inside Docker directly affect your host files, like in the Gondolin example.
|
|
110
110
|
|
|
111
|
-
Use a named volume for `/root/.
|
|
111
|
+
Use a named volume for `/root/.senpi/agent` if you want container-local settings and sessions. Mounting your host `~/.senpi/agent` exposes host auth and session files to the container.
|
package/docs/custom-provider.md
CHANGED
|
@@ -372,12 +372,12 @@ interface OAuthCredentials {
|
|
|
372
372
|
For providers with non-standard APIs, implement `streamSimple`. Study the existing provider implementations before writing your own:
|
|
373
373
|
|
|
374
374
|
**Reference implementations:**
|
|
375
|
-
- [anthropic.ts](https://github.com/
|
|
376
|
-
- [mistral.ts](https://github.com/
|
|
377
|
-
- [openai-completions.ts](https://github.com/
|
|
378
|
-
- [openai-responses.ts](https://github.com/
|
|
379
|
-
- [google.ts](https://github.com/
|
|
380
|
-
- [amazon-bedrock.ts](https://github.com/
|
|
375
|
+
- [anthropic.ts](https://github.com/code-yeongyu/senpi/blob/main/packages/ai/src/providers/anthropic.ts) - Anthropic Messages API
|
|
376
|
+
- [mistral.ts](https://github.com/code-yeongyu/senpi/blob/main/packages/ai/src/providers/mistral.ts) - Mistral Conversations API
|
|
377
|
+
- [openai-completions.ts](https://github.com/code-yeongyu/senpi/blob/main/packages/ai/src/providers/openai-completions.ts) - OpenAI Chat Completions
|
|
378
|
+
- [openai-responses.ts](https://github.com/code-yeongyu/senpi/blob/main/packages/ai/src/providers/openai-responses.ts) - OpenAI Responses API
|
|
379
|
+
- [google.ts](https://github.com/code-yeongyu/senpi/blob/main/packages/ai/src/providers/google.ts) - Google Generative AI
|
|
380
|
+
- [amazon-bedrock.ts](https://github.com/code-yeongyu/senpi/blob/main/packages/ai/src/providers/amazon-bedrock.ts) - AWS Bedrock
|
|
381
381
|
|
|
382
382
|
### Stream Pattern
|
|
383
383
|
|
|
@@ -535,14 +535,14 @@ calculateCost(model, output.usage);
|
|
|
535
535
|
|
|
536
536
|
### Context Overflow Errors
|
|
537
537
|
|
|
538
|
-
When a request exceeds the model's context window,
|
|
538
|
+
When a request exceeds the model's context window, senpi can recover automatically by compacting the conversation and retrying. This recovery only kicks in if senpi recognizes the failure as an overflow.
|
|
539
539
|
|
|
540
540
|
Detection runs on the finalized assistant message:
|
|
541
541
|
|
|
542
542
|
- `stopReason === "error"`
|
|
543
|
-
- `errorMessage` matches one of
|
|
543
|
+
- `errorMessage` matches one of senpi's known overflow patterns (see [`packages/ai/src/utils/overflow.ts`](https://github.com/code-yeongyu/senpi/blob/main/packages/ai/src/utils/overflow.ts))
|
|
544
544
|
|
|
545
|
-
If your provider returns overflow errors with a message
|
|
545
|
+
If your provider returns overflow errors with a message senpi does not recognize, normalize the error from the same extension that registers the provider. Use a `message_end` handler to rewrite the assistant message so its `errorMessage` starts with a phrase senpi recognizes. The generic fallback `context_length_exceeded` is the safest choice.
|
|
546
546
|
|
|
547
547
|
```typescript
|
|
548
548
|
const MY_PROVIDER_OVERFLOW_PATTERN = /your provider's overflow phrase/i;
|
|
@@ -574,7 +574,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
574
574
|
}
|
|
575
575
|
```
|
|
576
576
|
|
|
577
|
-
`message_end` runs before
|
|
577
|
+
`message_end` runs before senpi tracks the assistant message for auto-compaction, so the rewritten `errorMessage` is what senpi checks. With this in place, senpi will:
|
|
578
578
|
|
|
579
579
|
1. Detect the overflow from `errorMessage`.
|
|
580
580
|
2. Drop the failed assistant message from live context.
|
|
@@ -584,7 +584,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
584
584
|
Guard the rewrite carefully:
|
|
585
585
|
|
|
586
586
|
- Scope it to your provider (`message.provider` and `ctx.model?.provider`) so unrelated errors from other providers are untouched.
|
|
587
|
-
- Match a provider-specific pattern, not
|
|
587
|
+
- Match a provider-specific pattern, not senpi's generic overflow patterns. Rewriting rate-limit or throttling errors (`rate limit`, `too many requests`) would falsely trigger compaction instead of senpi's normal retry-with-backoff path.
|
|
588
588
|
- Skip when `errorMessage` already includes `context_length_exceeded` so the handler is idempotent.
|
|
589
589
|
|
|
590
590
|
### Registration
|
|
@@ -603,7 +603,7 @@ pi.registerProvider("my-provider", {
|
|
|
603
603
|
|
|
604
604
|
## Testing Your Implementation
|
|
605
605
|
|
|
606
|
-
Test your provider against the same test suites used by built-in providers. Copy and adapt these test files from [packages/ai/test/](https://github.com/
|
|
606
|
+
Test your provider against the same test suites used by built-in providers. Copy and adapt these test files from [packages/ai/test/](https://github.com/code-yeongyu/senpi/tree/main/packages/ai/test):
|
|
607
607
|
|
|
608
608
|
| Test | Purpose |
|
|
609
609
|
|------|---------|
|
|
@@ -612,7 +612,7 @@ Test your provider against the same test suites used by built-in providers. Copy
|
|
|
612
612
|
| `abort.test.ts` | AbortSignal handling |
|
|
613
613
|
| `empty.test.ts` | Empty/minimal responses |
|
|
614
614
|
| `context-overflow.test.ts` | Context window limits |
|
|
615
|
-
| `
|
|
615
|
+
| `images.test.ts` | Image input handling |
|
|
616
616
|
| `unicode-surrogate.test.ts` | Unicode edge cases |
|
|
617
617
|
| `tool-call-without-result.test.ts` | Tool call edge cases |
|
|
618
618
|
| `image-tool-result.test.ts` | Images in tool results |
|
package/docs/development.md
CHANGED
|
@@ -41,7 +41,7 @@ Three execution modes: npm install, standalone binary (`bun build --compile`), t
|
|
|
41
41
|
**Always use `src/config.ts`** for package assets:
|
|
42
42
|
|
|
43
43
|
```typescript
|
|
44
|
-
import { getPackageDir,
|
|
44
|
+
import { getPackageDir, getThemesDir } from "./config.js";
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
Never use `__dirname` directly for package assets.
|
|
@@ -56,10 +56,12 @@ Never use `__dirname` directly for package assets.
|
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
58
|
npm test # Vitest across workspaces (skips live-API; default test runner)
|
|
59
|
-
./pi-test.sh #
|
|
59
|
+
./pi-test.sh # Launch the CLI from source via tsx for manual testing (--no-env unsets API keys)
|
|
60
60
|
npm run check # Biome + tsgo + browser-smoke + web-ui check (pre-commit equivalent)
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
+
Live-API tests are env-gated vitest tests. Set `PI_ENABLE_LIVE_API_TESTS=1` (or a per-provider flag from `packages/ai/test/live-api-gates.ts`) plus the provider API keys, then run `npm test`.
|
|
64
|
+
|
|
63
65
|
Run a specific test:
|
|
64
66
|
|
|
65
67
|
```bash
|
package/docs/docs.json
CHANGED
package/docs/extensions.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Extensions
|
|
4
4
|
|
|
5
|
-
Extensions are TypeScript modules that extend
|
|
5
|
+
Extensions are TypeScript modules that extend senpi's behavior. They can subscribe to lifecycle events, register custom tools callable by the LLM, add commands, and more.
|
|
6
6
|
|
|
7
7
|
> **Placement for /reload:** Put extensions in `~/.senpi/agent/extensions/` (global) or `.senpi/extensions/` (project-local) for auto-discovery. Use `senpi -e ./path.ts` only for quick tests. Extensions in auto-discovered locations can be hot-reloaded with `/reload`.
|
|
8
8
|
|
|
@@ -102,14 +102,14 @@ export default function (pi: ExtensionAPI) {
|
|
|
102
102
|
Test with `--extension` (or `-e`) flag:
|
|
103
103
|
|
|
104
104
|
```bash
|
|
105
|
-
|
|
105
|
+
senpi -e ./my-extension.ts
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
## Extension Locations
|
|
109
109
|
|
|
110
110
|
> **Security:** Extensions run with your full system permissions and can execute arbitrary code. Only install from sources you trust.
|
|
111
111
|
|
|
112
|
-
Extensions are auto-discovered from trusted locations. Project-local `.
|
|
112
|
+
Extensions are auto-discovered from trusted locations. Project-local `.senpi/extensions` entries load only after the project is trusted.
|
|
113
113
|
|
|
114
114
|
| Location | Scope |
|
|
115
115
|
|----------|-------|
|
|
@@ -268,8 +268,9 @@ Run `npm install` in the extension directory, then imports from `node_modules/`
|
|
|
268
268
|
### Lifecycle Overview
|
|
269
269
|
|
|
270
270
|
```
|
|
271
|
-
|
|
271
|
+
senpi starts
|
|
272
272
|
│
|
|
273
|
+
├─► project_trust (user/global and CLI extensions only, before project resources load)
|
|
273
274
|
├─► session_start { reason: "startup" }
|
|
274
275
|
└─► resources_discover { reason: "startup" }
|
|
275
276
|
│
|
|
@@ -334,6 +335,25 @@ exit (Ctrl+C, Ctrl+D, SIGHUP, SIGTERM)
|
|
|
334
335
|
└─► session_shutdown
|
|
335
336
|
```
|
|
336
337
|
|
|
338
|
+
### Startup Events
|
|
339
|
+
|
|
340
|
+
#### project_trust
|
|
341
|
+
|
|
342
|
+
Fired before senpi decides whether to trust a project with dynamic configs (`.senpi` or `.agents/skills`). It runs during startup and when session replacement (for example `/resume`) enters a cwd whose trust has not been resolved in the current process. Only user/global extensions and CLI `-e` extensions participate; project-local extensions are not loaded until after trust is resolved.
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
pi.on("project_trust", async (event, ctx) => {
|
|
346
|
+
// event.cwd - current working directory
|
|
347
|
+
// ctx has a limited trust context: cwd, mode, hasUI, and select/confirm/input/notify UI helpers
|
|
348
|
+
if (await ctx.ui.confirm("Trust project?", event.cwd)) {
|
|
349
|
+
return { trusted: "yes", remember: true };
|
|
350
|
+
}
|
|
351
|
+
return { trusted: "undecided" };
|
|
352
|
+
});
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
A `project_trust` handler must return `{ trusted: "yes" | "no" | "undecided" }`. A user/global or CLI extension that returns `"yes"` or `"no"` owns the decision; the first yes/no decision wins and suppresses the built-in trust prompt. Use `remember: true` to persist a yes/no decision; otherwise it applies only to the current process. Return `"undecided"` to let later handlers or the built-in trust flow decide. Check `ctx.hasUI` before prompting. If no handler returns yes/no, normal trust resolution continues: saved `trust.json` decisions apply first, then `defaultProjectTrust` controls whether senpi asks, trusts, or declines by default.
|
|
356
|
+
|
|
337
357
|
### Resource Events
|
|
338
358
|
|
|
339
359
|
#### resources_discover
|
|
@@ -474,7 +494,7 @@ pi.on("before_agent_start", async (event, ctx) => {
|
|
|
474
494
|
// event.systemPrompt - current chained system prompt for this handler
|
|
475
495
|
// (includes changes from earlier before_agent_start handlers)
|
|
476
496
|
// event.systemPromptOptions - structured options used to build the system prompt
|
|
477
|
-
// .customPrompt - any custom system prompt (from --system-prompt
|
|
497
|
+
// .customPrompt - any custom system prompt (from --system-prompt or custom templates)
|
|
478
498
|
// .selectedTools - tools currently active in the prompt
|
|
479
499
|
// .toolSnippets - one-line descriptions for each tool
|
|
480
500
|
// .promptGuidelines - custom guideline bullets
|
|
@@ -496,7 +516,7 @@ pi.on("before_agent_start", async (event, ctx) => {
|
|
|
496
516
|
});
|
|
497
517
|
```
|
|
498
518
|
|
|
499
|
-
The `systemPromptOptions` field gives extensions access to the same structured data
|
|
519
|
+
The `systemPromptOptions` field gives extensions access to the same structured data senpi uses to build the system prompt. This lets you inspect what senpi has loaded — custom prompts, guidelines, tool snippets, context files, skills — without re-discovering resources or re-parsing flags. Use it when your extension needs to make deep, informed changes to the system prompt while respecting user-provided configuration.
|
|
500
520
|
|
|
501
521
|
Inside `before_agent_start`, `event.systemPrompt` and `ctx.getSystemPrompt()` both reflect the chained system prompt as of the current handler. Later `before_agent_start` handlers can still modify it again.
|
|
502
522
|
|
|
@@ -602,7 +622,7 @@ pi.on("context", async (event, ctx) => {
|
|
|
602
622
|
|
|
603
623
|
Fired after the provider-specific payload is built, right before the request is sent. Handlers run in extension load order. Returning `undefined` keeps the payload unchanged. Returning any other value replaces the payload for later handlers and for the actual request.
|
|
604
624
|
|
|
605
|
-
This hook can rewrite provider-level system instructions or remove them entirely. Those payload-level changes are not reflected by `ctx.getSystemPrompt()`, which reports
|
|
625
|
+
This hook can rewrite provider-level system instructions or remove them entirely. Those payload-level changes are not reflected by `ctx.getSystemPrompt()`, which reports senpi's system prompt string rather than the final serialized provider payload.
|
|
606
626
|
|
|
607
627
|
```typescript
|
|
608
628
|
pi.on("before_provider_request", (event, ctx) => {
|
|
@@ -786,7 +806,7 @@ pi.on("user_bash", (event, ctx) => {
|
|
|
786
806
|
// Option 1: Provide custom operations (e.g., SSH)
|
|
787
807
|
return { operations: remoteBashOps };
|
|
788
808
|
|
|
789
|
-
// Option 2: Wrap
|
|
809
|
+
// Option 2: Wrap senpi's built-in local bash backend
|
|
790
810
|
const local = createLocalBashOperations();
|
|
791
811
|
return {
|
|
792
812
|
operations: {
|
|
@@ -872,6 +892,12 @@ Current run mode: `"tui"`, `"rpc"`, `"json"`, or `"print"`. Use `ctx.mode === "t
|
|
|
872
892
|
|
|
873
893
|
Current working directory.
|
|
874
894
|
|
|
895
|
+
### ctx.isProjectTrusted()
|
|
896
|
+
|
|
897
|
+
Returns whether project-local trust is active for the current session context. This includes temporary trust decisions and CLI trust overrides, not just saved decisions in the global trust store.
|
|
898
|
+
|
|
899
|
+
Use this before reading project-local extension configuration that should only be honored for trusted projects.
|
|
900
|
+
|
|
875
901
|
### ctx.sessionManager
|
|
876
902
|
|
|
877
903
|
Read-only access to session state. See [Session Format](session-format.md) for the full SessionManager API and entry types.
|
|
@@ -919,7 +945,7 @@ Control flow helpers.
|
|
|
919
945
|
|
|
920
946
|
### ctx.shutdown()
|
|
921
947
|
|
|
922
|
-
Request a graceful shutdown of
|
|
948
|
+
Request a graceful shutdown of senpi.
|
|
923
949
|
|
|
924
950
|
- **Interactive mode:** Deferred until the agent becomes idle (after processing all queued steering and follow-up messages).
|
|
925
951
|
- **RPC mode:** Deferred until the next idle state (after completing the current command response, when waiting for the next command).
|
|
@@ -964,7 +990,7 @@ ctx.compact({
|
|
|
964
990
|
|
|
965
991
|
### ctx.getSystemPrompt()
|
|
966
992
|
|
|
967
|
-
Returns
|
|
993
|
+
Returns senpi's current system prompt string.
|
|
968
994
|
|
|
969
995
|
- During `before_agent_start`, this reflects chained system-prompt changes made so far for the current turn.
|
|
970
996
|
- It does not include later `context` message mutations.
|
|
@@ -984,7 +1010,7 @@ Command handlers receive `ExtensionCommandContext`, which extends `ExtensionCont
|
|
|
984
1010
|
|
|
985
1011
|
### ctx.getSystemPromptOptions()
|
|
986
1012
|
|
|
987
|
-
Returns the base inputs
|
|
1013
|
+
Returns the base inputs senpi currently uses to build the system prompt.
|
|
988
1014
|
|
|
989
1015
|
```typescript
|
|
990
1016
|
const options = ctx.getSystemPromptOptions();
|
|
@@ -1319,7 +1345,7 @@ pi.sendUserMessage("What is 2+2?");
|
|
|
1319
1345
|
// With content array (text + images)
|
|
1320
1346
|
pi.sendUserMessage([
|
|
1321
1347
|
{ type: "text", text: "Describe this image:" },
|
|
1322
|
-
{ type: "image",
|
|
1348
|
+
{ type: "image", data: "base64-encoded-data", mimeType: "image/png" },
|
|
1323
1349
|
]);
|
|
1324
1350
|
|
|
1325
1351
|
// During streaming - must specify delivery mode
|
|
@@ -1848,13 +1874,13 @@ Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`,
|
|
|
1848
1874
|
|
|
1849
1875
|
```bash
|
|
1850
1876
|
# Extension's read tool replaces built-in read
|
|
1851
|
-
|
|
1877
|
+
senpi -e ./tool-override.ts
|
|
1852
1878
|
```
|
|
1853
1879
|
|
|
1854
1880
|
Alternatively, use `--no-builtin-tools` to start without any built-in tools while keeping extension tools enabled:
|
|
1855
1881
|
```bash
|
|
1856
1882
|
# No built-in tools, only extension tools
|
|
1857
|
-
|
|
1883
|
+
senpi --no-builtin-tools -e ./my-extension.ts
|
|
1858
1884
|
```
|
|
1859
1885
|
|
|
1860
1886
|
See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.ts) for a complete example that overrides `read` with logging and access control.
|
|
@@ -1905,7 +1931,7 @@ pi.registerTool({
|
|
|
1905
1931
|
|
|
1906
1932
|
**Operations interfaces:** `ReadOperations`, `WriteOperations`, `EditOperations`, `BashOperations`, `LsOperations`, `GrepOperations`, `FindOperations`
|
|
1907
1933
|
|
|
1908
|
-
For `user_bash`, extensions can reuse
|
|
1934
|
+
For `user_bash`, extensions can reuse senpi's local shell backend via `createLocalBashOperations()` instead of reimplementing local process spawning, shell resolution, and process-tree termination.
|
|
1909
1935
|
|
|
1910
1936
|
The bash tool also supports a spawn hook to adjust the command, cwd, or env before execution:
|
|
1911
1937
|
|
|
@@ -2244,7 +2270,7 @@ ctx.ui.setFooter((tui, theme) => ({
|
|
|
2244
2270
|
ctx.ui.setFooter(undefined); // Restore built-in footer
|
|
2245
2271
|
|
|
2246
2272
|
// Terminal title
|
|
2247
|
-
ctx.ui.setTitle("
|
|
2273
|
+
ctx.ui.setTitle("senpi - my-project");
|
|
2248
2274
|
|
|
2249
2275
|
// Editor text
|
|
2250
2276
|
ctx.ui.setEditorText("Prefill text");
|
|
@@ -2255,6 +2281,7 @@ ctx.ui.pasteToEditor("pasted content");
|
|
|
2255
2281
|
|
|
2256
2282
|
// Stack custom autocomplete behavior on top of the built-in provider
|
|
2257
2283
|
ctx.ui.addAutocompleteProvider((current) => ({
|
|
2284
|
+
triggerCharacters: ["#"],
|
|
2258
2285
|
async getSuggestions(lines, line, col, options) {
|
|
2259
2286
|
const beforeCursor = (lines[line] ?? "").slice(0, col);
|
|
2260
2287
|
const match = beforeCursor.match(/(?:^|[ \t])#([^\s#]*)$/);
|
|
@@ -2303,7 +2330,7 @@ Custom working-indicator frames are rendered verbatim. If you want colors, add t
|
|
|
2303
2330
|
|
|
2304
2331
|
### Autocomplete Providers
|
|
2305
2332
|
|
|
2306
|
-
Use `ctx.ui.addAutocompleteProvider()` to stack custom autocomplete logic on top of the built-in slash-command and path provider.
|
|
2333
|
+
Use `ctx.ui.addAutocompleteProvider()` to stack custom autocomplete logic on top of the built-in slash-command and path provider. Set `triggerCharacters` for custom natural triggers such as `$`.
|
|
2307
2334
|
|
|
2308
2335
|
Typical pattern:
|
|
2309
2336
|
|
|
@@ -2315,6 +2342,7 @@ Typical pattern:
|
|
|
2315
2342
|
```typescript
|
|
2316
2343
|
pi.on("session_start", (_event, ctx) => {
|
|
2317
2344
|
ctx.ui.addAutocompleteProvider((current) => ({
|
|
2345
|
+
triggerCharacters: ["#"],
|
|
2318
2346
|
async getSuggestions(lines, cursorLine, cursorCol, options) {
|
|
2319
2347
|
const line = lines[cursorLine] ?? "";
|
|
2320
2348
|
const beforeCursor = line.slice(0, cursorCol);
|
|
@@ -2567,6 +2595,7 @@ All examples in [examples/extensions/](../examples/extensions/).
|
|
|
2567
2595
|
| `shutdown-command.ts` | Graceful shutdown command | `registerCommand`, `shutdown()` |
|
|
2568
2596
|
| **Events & Gates** |||
|
|
2569
2597
|
| `permission-gate.ts` | Block dangerous commands | `on("tool_call")`, `ui.confirm` |
|
|
2598
|
+
| `project-trust.ts` | Decide or defer project trust from a user/global or CLI extension | `on("project_trust")`, trust UI, required trust result |
|
|
2570
2599
|
| `protected-paths.ts` | Block writes to specific paths | `on("tool_call")` |
|
|
2571
2600
|
| `confirm-destructive.ts` | Confirm session changes | `on("session_before_switch")`, `on("session_before_fork")` |
|
|
2572
2601
|
| `dirty-repo-guard.ts` | Warn on dirty git repo | `on("session_before_*")`, `exec` |
|
|
@@ -2607,7 +2636,6 @@ All examples in [examples/extensions/](../examples/extensions/).
|
|
|
2607
2636
|
| `interactive-shell.ts` | Persistent shell session | `on("user_bash")` |
|
|
2608
2637
|
| `sandbox/` | Sandboxed tool execution | Tool operations |
|
|
2609
2638
|
| `gondolin/` | Route built-in tools and `!` commands into a Gondolin micro-VM | Tool operations, built-in tool overrides, `on("user_bash")` |
|
|
2610
|
-
| `subagent/` | Spawn sub-agents | `registerTool`, `exec` |
|
|
2611
2639
|
| **Games** |||
|
|
2612
2640
|
| `snake.ts` | Snake game | `registerCommand`, `ui.custom`, keyboard handling |
|
|
2613
2641
|
| `space-invaders.ts` | Space Invaders game | `registerCommand`, `ui.custom` |
|
package/docs/index.md
CHANGED
|
@@ -10,13 +10,13 @@ Install with npm:
|
|
|
10
10
|
npm install -g @code-yeongyu/senpi
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
To uninstall
|
|
13
|
+
To uninstall senpi itself, use the package manager that installed it:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npm uninstall -g @
|
|
16
|
+
npm uninstall -g @code-yeongyu/senpi
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
For pnpm, Yarn, or Bun installs, use the matching global remove command: `pnpm remove -g @
|
|
19
|
+
For pnpm, Yarn, or Bun installs, use the matching global remove command: `pnpm remove -g @code-yeongyu/senpi`, `yarn global remove @code-yeongyu/senpi`, or `bun uninstall -g @code-yeongyu/senpi`.
|
|
20
20
|
|
|
21
21
|
Then run it in a project directory:
|
|
22
22
|
|
|
@@ -33,7 +33,8 @@ For the full first-run flow, see [Quickstart](quickstart.md).
|
|
|
33
33
|
- [Quickstart](quickstart.md) - install, authenticate, and run a first session.
|
|
34
34
|
- [Using Senpi](usage.md) - interactive mode, slash commands, context files, and CLI reference.
|
|
35
35
|
- [Providers](providers.md) - subscription and API-key setup for built-in providers.
|
|
36
|
-
- [
|
|
36
|
+
- [Security](security.md) - project trust, sandbox boundaries, and vulnerability reporting.
|
|
37
|
+
- [Containerization](containerization.md) - sandbox senpi with OpenShell, Gondolin, or Docker.
|
|
37
38
|
- [Settings](settings.md) - global and project settings.
|
|
38
39
|
- [Keybindings](keybindings.md) - default shortcuts and custom keybindings.
|
|
39
40
|
- [Sessions](sessions.md) - session management, branching, and tree navigation.
|
package/docs/json.md
CHANGED
|
@@ -4,31 +4,37 @@
|
|
|
4
4
|
senpi --mode json "Your prompt"
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
-
Outputs all session events as JSON lines to stdout. Useful for integrating
|
|
7
|
+
Outputs all session events as JSON lines to stdout. Useful for integrating senpi into other tools or custom UIs.
|
|
8
8
|
|
|
9
9
|
## Event Types
|
|
10
10
|
|
|
11
|
-
Events are defined in [`AgentSessionEvent`](
|
|
11
|
+
Events are defined in [`AgentSessionEvent`](../src/core/agent-session.ts):
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
14
|
type AgentSessionEvent =
|
|
15
|
+
// All AgentEvent variants; agent_end additionally carries willRetry: boolean
|
|
15
16
|
| AgentEvent
|
|
16
17
|
| { type: "queue_update"; steering: readonly string[]; followUp: readonly string[] }
|
|
17
18
|
| { type: "compaction_start"; reason: "manual" | "threshold" | "overflow" }
|
|
18
|
-
| { type: "
|
|
19
|
+
| { type: "compaction_progress"; reason: "manual" | "threshold" | "overflow"; delta?: string; text?: string }
|
|
20
|
+
| { type: "compaction_end"; reason: "manual" | "threshold" | "overflow"; result: CompactionResult | undefined; aborted: boolean; willRetry: boolean; requestId?: string; accepted?: boolean; rejectionCause?: "cancelled-by-extension" | "would-overflow" | "circuit-breaker" | "per-turn-cap"; errorMessage?: string }
|
|
21
|
+
| { type: "session_info_changed"; name: string | undefined }
|
|
22
|
+
| { type: "thinking_level_changed"; level: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" }
|
|
23
|
+
| SystemPromptChangeEvent // type: "system_prompt_change"
|
|
24
|
+
| ExtensionToolHookLifecycleEvent // type: "tool_hook_status"
|
|
19
25
|
| { type: "auto_retry_start"; attempt: number; maxAttempts: number; delayMs: number; errorMessage: string }
|
|
20
26
|
| { type: "auto_retry_end"; success: boolean; attempt: number; finalError?: string };
|
|
21
27
|
```
|
|
22
28
|
|
|
23
|
-
`queue_update` emits the full pending steering and follow-up queues whenever they change. `compaction_start` and `compaction_end` cover both manual and automatic compaction.
|
|
29
|
+
`queue_update` emits the full pending steering and follow-up queues whenever they change. `compaction_start`, `compaction_progress`, and `compaction_end` cover both manual and automatic compaction. `session_info_changed` fires when the session display name changes, `thinking_level_changed` when the thinking level changes, `system_prompt_change` (see `SystemPromptChangeEvent` in [`extensions/types.ts`](../src/core/extensions/types.ts)) when a model switch changes the active system prompt, and `tool_hook_status` (see `ExtensionToolHookLifecycleEvent` in [`extensions/runner.ts`](../src/core/extensions/runner.ts)) for extension tool hook start/end phases.
|
|
24
30
|
|
|
25
|
-
Base events from [`AgentEvent`](
|
|
31
|
+
Base events from [`AgentEvent`](../../agent/src/types.ts):
|
|
26
32
|
|
|
27
33
|
```typescript
|
|
28
34
|
type AgentEvent =
|
|
29
35
|
// Agent lifecycle
|
|
30
36
|
| { type: "agent_start" }
|
|
31
|
-
| { type: "agent_end"; messages: AgentMessage[] }
|
|
37
|
+
| { type: "agent_end"; messages: AgentMessage[] } // in JSON mode also: willRetry: boolean
|
|
32
38
|
// Turn lifecycle
|
|
33
39
|
| { type: "turn_start" }
|
|
34
40
|
| { type: "turn_end"; message: AgentMessage; toolResults: ToolResultMessage[] }
|
|
@@ -44,16 +50,16 @@ type AgentEvent =
|
|
|
44
50
|
|
|
45
51
|
## Message Types
|
|
46
52
|
|
|
47
|
-
Base messages from [`packages/ai/src/types.ts`](
|
|
48
|
-
- `UserMessage`
|
|
49
|
-
- `AssistantMessage`
|
|
50
|
-
- `ToolResultMessage`
|
|
53
|
+
Base messages from [`packages/ai/src/types.ts`](../../ai/src/types.ts):
|
|
54
|
+
- `UserMessage`
|
|
55
|
+
- `AssistantMessage`
|
|
56
|
+
- `ToolResultMessage`
|
|
51
57
|
|
|
52
|
-
Extended messages from [`packages/coding-agent/src/core/messages.ts`](
|
|
53
|
-
- `BashExecutionMessage`
|
|
54
|
-
- `CustomMessage`
|
|
55
|
-
- `BranchSummaryMessage`
|
|
56
|
-
- `CompactionSummaryMessage`
|
|
58
|
+
Extended messages from [`packages/coding-agent/src/core/messages.ts`](../src/core/messages.ts):
|
|
59
|
+
- `BashExecutionMessage`
|
|
60
|
+
- `CustomMessage`
|
|
61
|
+
- `BranchSummaryMessage`
|
|
62
|
+
- `CompactionSummaryMessage`
|
|
57
63
|
|
|
58
64
|
## Output Format
|
|
59
65
|
|