@vandeepunk/pi-coding-agent 0.0.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +814 -16
- package/README.md +66 -27
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +7 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -0
- package/dist/bun/register-bedrock.js +4 -0
- package/dist/bun/register-bedrock.js.map +1 -0
- package/dist/cli/args.d.ts +9 -4
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +61 -22
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +4 -0
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/initial-message.d.ts +18 -0
- package/dist/cli/initial-message.d.ts.map +1 -0
- package/dist/cli/initial-message.js +22 -0
- package/dist/cli/initial-message.js.map +1 -0
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +2 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +83 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +236 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +86 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +116 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session.d.ts +63 -49
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +599 -370
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +38 -8
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +220 -96
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts +6 -7
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +27 -114
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +2 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +3 -2
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +3 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +31 -25
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +3 -0
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +16 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +7 -3
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/index.d.ts +7 -4
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +10 -8
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template.css +43 -13
- package/dist/core/export-html/template.html +1 -0
- package/dist/core/export-html/template.js +118 -14
- package/dist/core/export-html/tool-renderer.d.ts +9 -4
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +48 -10
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/index.d.ts +5 -4
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +2 -2
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +49 -13
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +13 -11
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +139 -64
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +174 -34
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +10 -0
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts +4 -11
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +6 -86
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +18 -2
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +220 -40
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/index.d.ts +4 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +4 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +283 -50
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +221 -134
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-registry.d.ts +33 -3
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +165 -97
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +35 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +205 -32
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/output-guard.d.ts +6 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +59 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-manager.d.ts +43 -2
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +541 -102
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +5 -4
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +35 -37
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts +6 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +75 -8
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts +6 -5
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +166 -119
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +11 -8
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +31 -29
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cwd.d.ts +19 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +38 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/session-manager.d.ts +11 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +39 -25
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +60 -10
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +291 -140
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +5 -3
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +54 -9
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts +2 -3
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +3 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/source-info.d.ts +18 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +19 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/system-prompt.d.ts +4 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +31 -52
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/timings.d.ts +1 -0
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +6 -0
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/bash.d.ts +24 -6
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +225 -115
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +23 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +151 -57
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +20 -6
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +111 -61
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +37 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +11 -4
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +82 -30
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +15 -4
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +83 -29
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +63 -21
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +51 -26
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +9 -3
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +67 -13
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts +10 -3
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +110 -51
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +21 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +49 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.js +32 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
- package/dist/core/tools/write.d.ts +9 -3
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +168 -30
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +354 -379
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +31 -11
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +3 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +14 -3
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +0 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +22 -9
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +1 -1
- package/dist/modes/interactive/components/bordered-loader.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 +2 -2
- 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 +2 -2
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +14 -14
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +3 -3
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +6 -6
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +5 -2
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +18 -9
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +5 -5
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +8 -8
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +1 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +21 -40
- 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 +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +3 -36
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +5 -44
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +7 -7
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +13 -9
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +7 -7
- package/dist/modes/interactive/components/oauth-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 +4 -4
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +33 -36
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +5 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +25 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +5 -1
- package/dist/modes/interactive/components/show-images-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 +2 -2
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +5 -1
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +5 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +17 -29
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +139 -501
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +25 -4
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +184 -34
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +6 -6
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +1 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +12 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +25 -17
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +669 -385
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +3 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +83 -48
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts +2 -2
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +90 -79
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +49 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +8 -11
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +2 -2
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +130 -87
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +3 -4
- 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 +4 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +234 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/utils/child-process.d.ts +11 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +78 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +94 -11
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts +1 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard-native.js.map +1 -1
- package/dist/utils/clipboard.d.ts +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +27 -16
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +158 -0
- package/dist/utils/exif-orientation.js.map +1 -0
- package/dist/utils/git.d.ts +5 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +14 -3
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js +5 -1
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-resize.d.ts +5 -5
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +51 -95
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/paths.d.ts +7 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +19 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +67 -22
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/compaction.md +6 -2
- package/docs/custom-provider.md +57 -9
- package/docs/development.md +3 -1
- package/docs/extensions.md +437 -67
- package/docs/json.md +5 -2
- package/docs/keybindings.md +108 -107
- package/docs/models.md +50 -2
- package/docs/packages.md +17 -10
- package/docs/prompt-templates.md +6 -6
- package/docs/providers.md +10 -1
- package/docs/rpc.md +78 -18
- package/docs/sdk.md +261 -96
- package/docs/settings.md +28 -3
- package/docs/skills.md +9 -4
- package/docs/terminal-setup.md +39 -3
- package/docs/tmux.md +61 -0
- package/docs/tree.md +15 -3
- package/docs/tui.md +2 -2
- package/examples/extensions/README.md +3 -0
- package/examples/extensions/antigravity-image-gen.ts +12 -7
- package/examples/extensions/built-in-tool-renderer.ts +246 -0
- package/examples/extensions/commands.ts +3 -3
- package/examples/extensions/custom-compaction.ts +17 -4
- 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/custom-provider-gitlab-duo/test.ts +2 -2
- package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
- package/examples/extensions/doom-overlay/doom/build.sh +2 -2
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/handoff.ts +5 -2
- package/examples/extensions/hello.ts +18 -17
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/minimal-mode.ts +14 -14
- package/examples/extensions/overlay-qa-tests.ts +468 -1
- package/examples/extensions/preset.ts +2 -3
- package/examples/extensions/provider-payload.ts +14 -0
- package/examples/extensions/qna.ts +5 -2
- package/examples/extensions/question.ts +2 -2
- package/examples/extensions/questionnaire.ts +2 -2
- package/examples/extensions/rpc-demo.ts +3 -9
- package/examples/extensions/sandbox/index.ts +6 -3
- package/examples/extensions/status-line.ts +0 -8
- package/examples/extensions/subagent/README.md +4 -4
- package/examples/extensions/subagent/agents.ts +2 -3
- package/examples/extensions/subagent/index.ts +30 -8
- package/examples/extensions/summarize.ts +15 -4
- package/examples/extensions/todo.ts +2 -4
- package/examples/extensions/tool-override.ts +10 -9
- package/examples/extensions/tools.ts +0 -5
- package/examples/extensions/trigger-compact.ts +11 -1
- package/examples/extensions/truncated-tool.ts +8 -5
- package/examples/extensions/widget-placement.ts +4 -12
- package/examples/extensions/with-deps/index.ts +1 -5
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/02-custom-model.ts +2 -2
- package/examples/sdk/04-skills.ts +8 -2
- package/examples/sdk/08-prompt-templates.ts +4 -3
- package/examples/sdk/09-api-keys-and-oauth.ts +5 -5
- package/examples/sdk/10-settings.ts +13 -0
- package/examples/sdk/12-full-control.ts +2 -3
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/README.md +10 -7
- package/package.json +98 -94
- /package/examples/extensions/subagent/{commands → prompts}/implement-and-review.md +0 -0
- /package/examples/extensions/subagent/{commands → prompts}/implement.md +0 -0
- /package/examples/extensions/subagent/{commands → prompts}/scout-and-plan.md +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
2
2
|
import { dirname, join } from "path";
|
|
3
|
+
import lockfile from "proper-lockfile";
|
|
3
4
|
import { CONFIG_DIR_NAME, getAgentDir } from "../config.js";
|
|
4
5
|
/** Deep merge settings: project/overrides take precedence, nested objects merge recursively */
|
|
5
6
|
function deepMergeSettings(base, overrides) {
|
|
@@ -26,54 +27,148 @@ function deepMergeSettings(base, overrides) {
|
|
|
26
27
|
}
|
|
27
28
|
return result;
|
|
28
29
|
}
|
|
29
|
-
export class
|
|
30
|
-
|
|
30
|
+
export class FileSettingsStorage {
|
|
31
|
+
globalSettingsPath;
|
|
31
32
|
projectSettingsPath;
|
|
33
|
+
constructor(cwd = process.cwd(), agentDir = getAgentDir()) {
|
|
34
|
+
this.globalSettingsPath = join(agentDir, "settings.json");
|
|
35
|
+
this.projectSettingsPath = join(cwd, CONFIG_DIR_NAME, "settings.json");
|
|
36
|
+
}
|
|
37
|
+
acquireLockSyncWithRetry(path) {
|
|
38
|
+
const maxAttempts = 10;
|
|
39
|
+
const delayMs = 20;
|
|
40
|
+
let lastError;
|
|
41
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
42
|
+
try {
|
|
43
|
+
return lockfile.lockSync(path, { realpath: false });
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const code = typeof error === "object" && error !== null && "code" in error
|
|
47
|
+
? String(error.code)
|
|
48
|
+
: undefined;
|
|
49
|
+
if (code !== "ELOCKED" || attempt === maxAttempts) {
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
lastError = error;
|
|
53
|
+
const start = Date.now();
|
|
54
|
+
while (Date.now() - start < delayMs) {
|
|
55
|
+
// Sleep synchronously to avoid changing callers to async.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
throw lastError ?? new Error("Failed to acquire settings lock");
|
|
60
|
+
}
|
|
61
|
+
withLock(scope, fn) {
|
|
62
|
+
const path = scope === "global" ? this.globalSettingsPath : this.projectSettingsPath;
|
|
63
|
+
const dir = dirname(path);
|
|
64
|
+
let release;
|
|
65
|
+
try {
|
|
66
|
+
// Only create directory and lock if file exists or we need to write
|
|
67
|
+
const fileExists = existsSync(path);
|
|
68
|
+
if (fileExists) {
|
|
69
|
+
release = this.acquireLockSyncWithRetry(path);
|
|
70
|
+
}
|
|
71
|
+
const current = fileExists ? readFileSync(path, "utf-8") : undefined;
|
|
72
|
+
const next = fn(current);
|
|
73
|
+
if (next !== undefined) {
|
|
74
|
+
// Only create directory when we actually need to write
|
|
75
|
+
if (!existsSync(dir)) {
|
|
76
|
+
mkdirSync(dir, { recursive: true });
|
|
77
|
+
}
|
|
78
|
+
if (!release) {
|
|
79
|
+
release = this.acquireLockSyncWithRetry(path);
|
|
80
|
+
}
|
|
81
|
+
writeFileSync(path, next, "utf-8");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
if (release) {
|
|
86
|
+
release();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export class InMemorySettingsStorage {
|
|
92
|
+
global;
|
|
93
|
+
project;
|
|
94
|
+
withLock(scope, fn) {
|
|
95
|
+
const current = scope === "global" ? this.global : this.project;
|
|
96
|
+
const next = fn(current);
|
|
97
|
+
if (next !== undefined) {
|
|
98
|
+
if (scope === "global") {
|
|
99
|
+
this.global = next;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
this.project = next;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export class SettingsManager {
|
|
108
|
+
storage;
|
|
32
109
|
globalSettings;
|
|
33
|
-
|
|
110
|
+
projectSettings;
|
|
34
111
|
settings;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
this.
|
|
112
|
+
modifiedFields = new Set(); // Track global fields modified during session
|
|
113
|
+
modifiedNestedFields = new Map(); // Track global nested field modifications
|
|
114
|
+
modifiedProjectFields = new Set(); // Track project fields modified during session
|
|
115
|
+
modifiedProjectNestedFields = new Map(); // Track project nested field modifications
|
|
116
|
+
globalSettingsLoadError = null; // Track if global settings file had parse errors
|
|
117
|
+
projectSettingsLoadError = null; // Track if project settings file had parse errors
|
|
118
|
+
writeQueue = Promise.resolve();
|
|
119
|
+
errors;
|
|
120
|
+
constructor(storage, initialGlobal, initialProject, globalLoadError = null, projectLoadError = null, initialErrors = []) {
|
|
121
|
+
this.storage = storage;
|
|
122
|
+
this.globalSettings = initialGlobal;
|
|
123
|
+
this.projectSettings = initialProject;
|
|
124
|
+
this.globalSettingsLoadError = globalLoadError;
|
|
125
|
+
this.projectSettingsLoadError = projectLoadError;
|
|
126
|
+
this.errors = [...initialErrors];
|
|
127
|
+
this.settings = deepMergeSettings(this.globalSettings, this.projectSettings);
|
|
48
128
|
}
|
|
49
129
|
/** Create a SettingsManager that loads from files */
|
|
50
130
|
static create(cwd = process.cwd(), agentDir = getAgentDir()) {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
131
|
+
const storage = new FileSettingsStorage(cwd, agentDir);
|
|
132
|
+
return SettingsManager.fromStorage(storage);
|
|
133
|
+
}
|
|
134
|
+
/** Create a SettingsManager from an arbitrary storage backend */
|
|
135
|
+
static fromStorage(storage) {
|
|
136
|
+
const globalLoad = SettingsManager.tryLoadFromStorage(storage, "global");
|
|
137
|
+
const projectLoad = SettingsManager.tryLoadFromStorage(storage, "project");
|
|
138
|
+
const initialErrors = [];
|
|
139
|
+
if (globalLoad.error) {
|
|
140
|
+
initialErrors.push({ scope: "global", error: globalLoad.error });
|
|
57
141
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
console.error(`Warning: Invalid JSON in ${settingsPath}: ${error}`);
|
|
61
|
-
console.error(`Fix the syntax error to enable settings persistence.`);
|
|
142
|
+
if (projectLoad.error) {
|
|
143
|
+
initialErrors.push({ scope: "project", error: projectLoad.error });
|
|
62
144
|
}
|
|
63
|
-
return new SettingsManager(
|
|
145
|
+
return new SettingsManager(storage, globalLoad.settings, projectLoad.settings, globalLoad.error, projectLoad.error, initialErrors);
|
|
64
146
|
}
|
|
65
147
|
/** Create an in-memory SettingsManager (no file I/O) */
|
|
66
148
|
static inMemory(settings = {}) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
149
|
+
const storage = new InMemorySettingsStorage();
|
|
150
|
+
return new SettingsManager(storage, settings, {});
|
|
151
|
+
}
|
|
152
|
+
static loadFromStorage(storage, scope) {
|
|
153
|
+
let content;
|
|
154
|
+
storage.withLock(scope, (current) => {
|
|
155
|
+
content = current;
|
|
156
|
+
return undefined;
|
|
157
|
+
});
|
|
158
|
+
if (!content) {
|
|
71
159
|
return {};
|
|
72
160
|
}
|
|
73
|
-
const content = readFileSync(path, "utf-8");
|
|
74
161
|
const settings = JSON.parse(content);
|
|
75
162
|
return SettingsManager.migrateSettings(settings);
|
|
76
163
|
}
|
|
164
|
+
static tryLoadFromStorage(storage, scope) {
|
|
165
|
+
try {
|
|
166
|
+
return { settings: SettingsManager.loadFromStorage(storage, scope), error: null };
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
return { settings: {}, error: error };
|
|
170
|
+
}
|
|
171
|
+
}
|
|
77
172
|
/** Migrate old settings format to new format */
|
|
78
173
|
static migrateSettings(settings) {
|
|
79
174
|
// Migrate queueMode -> steeringMode
|
|
@@ -81,6 +176,11 @@ export class SettingsManager {
|
|
|
81
176
|
settings.steeringMode = settings.queueMode;
|
|
82
177
|
delete settings.queueMode;
|
|
83
178
|
}
|
|
179
|
+
// Migrate legacy websockets boolean -> transport enum
|
|
180
|
+
if (!("transport" in settings) && typeof settings.websockets === "boolean") {
|
|
181
|
+
settings.transport = settings.websockets ? "websocket" : "sse";
|
|
182
|
+
delete settings.websockets;
|
|
183
|
+
}
|
|
84
184
|
// Migrate old skills object format to new array format
|
|
85
185
|
if ("skills" in settings &&
|
|
86
186
|
typeof settings.skills === "object" &&
|
|
@@ -99,54 +199,43 @@ export class SettingsManager {
|
|
|
99
199
|
}
|
|
100
200
|
return settings;
|
|
101
201
|
}
|
|
102
|
-
loadProjectSettings() {
|
|
103
|
-
// In-memory mode: return stored in-memory project settings
|
|
104
|
-
if (!this.persist) {
|
|
105
|
-
return structuredClone(this.inMemoryProjectSettings);
|
|
106
|
-
}
|
|
107
|
-
if (!this.projectSettingsPath || !existsSync(this.projectSettingsPath)) {
|
|
108
|
-
return {};
|
|
109
|
-
}
|
|
110
|
-
try {
|
|
111
|
-
const content = readFileSync(this.projectSettingsPath, "utf-8");
|
|
112
|
-
const settings = JSON.parse(content);
|
|
113
|
-
return SettingsManager.migrateSettings(settings);
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
console.error(`Warning: Could not read project settings file: ${error}`);
|
|
117
|
-
return {};
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
202
|
getGlobalSettings() {
|
|
121
203
|
return structuredClone(this.globalSettings);
|
|
122
204
|
}
|
|
123
205
|
getProjectSettings() {
|
|
124
|
-
return this.
|
|
125
|
-
}
|
|
126
|
-
reload() {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
this.globalSettingsLoadError = error;
|
|
135
|
-
}
|
|
206
|
+
return structuredClone(this.projectSettings);
|
|
207
|
+
}
|
|
208
|
+
async reload() {
|
|
209
|
+
await this.writeQueue;
|
|
210
|
+
const globalLoad = SettingsManager.tryLoadFromStorage(this.storage, "global");
|
|
211
|
+
if (!globalLoad.error) {
|
|
212
|
+
this.globalSettings = globalLoad.settings;
|
|
213
|
+
this.globalSettingsLoadError = null;
|
|
136
214
|
}
|
|
137
|
-
|
|
138
|
-
this.
|
|
215
|
+
else {
|
|
216
|
+
this.globalSettingsLoadError = globalLoad.error;
|
|
217
|
+
this.recordError("global", globalLoad.error);
|
|
139
218
|
}
|
|
140
219
|
this.modifiedFields.clear();
|
|
141
220
|
this.modifiedNestedFields.clear();
|
|
142
|
-
|
|
143
|
-
this.
|
|
221
|
+
this.modifiedProjectFields.clear();
|
|
222
|
+
this.modifiedProjectNestedFields.clear();
|
|
223
|
+
const projectLoad = SettingsManager.tryLoadFromStorage(this.storage, "project");
|
|
224
|
+
if (!projectLoad.error) {
|
|
225
|
+
this.projectSettings = projectLoad.settings;
|
|
226
|
+
this.projectSettingsLoadError = null;
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
this.projectSettingsLoadError = projectLoad.error;
|
|
230
|
+
this.recordError("project", projectLoad.error);
|
|
231
|
+
}
|
|
232
|
+
this.settings = deepMergeSettings(this.globalSettings, this.projectSettings);
|
|
144
233
|
}
|
|
145
234
|
/** Apply additional overrides on top of current settings */
|
|
146
235
|
applyOverrides(overrides) {
|
|
147
236
|
this.settings = deepMergeSettings(this.settings, overrides);
|
|
148
237
|
}
|
|
149
|
-
/** Mark a field as modified during this session */
|
|
238
|
+
/** Mark a global field as modified during this session */
|
|
150
239
|
markModified(field, nestedKey) {
|
|
151
240
|
this.modifiedFields.add(field);
|
|
152
241
|
if (nestedKey) {
|
|
@@ -156,74 +245,103 @@ export class SettingsManager {
|
|
|
156
245
|
this.modifiedNestedFields.get(field).add(nestedKey);
|
|
157
246
|
}
|
|
158
247
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
try {
|
|
169
|
-
const dir = dirname(this.settingsPath);
|
|
170
|
-
if (!existsSync(dir)) {
|
|
171
|
-
mkdirSync(dir, { recursive: true });
|
|
172
|
-
}
|
|
173
|
-
// Re-read current file to get latest external changes
|
|
174
|
-
const currentFileSettings = SettingsManager.loadFromFile(this.settingsPath);
|
|
175
|
-
// Start with file settings as base - preserves external edits
|
|
176
|
-
const mergedSettings = { ...currentFileSettings };
|
|
177
|
-
// Only override with in-memory values for fields that were explicitly modified during this session
|
|
178
|
-
for (const field of this.modifiedFields) {
|
|
179
|
-
const value = this.globalSettings[field];
|
|
180
|
-
// Handle nested objects specially - merge at nested level to preserve unmodified nested keys
|
|
181
|
-
if (this.modifiedNestedFields.has(field) && typeof value === "object" && value !== null) {
|
|
182
|
-
const nestedModified = this.modifiedNestedFields.get(field);
|
|
183
|
-
const baseNested = currentFileSettings[field] ?? {};
|
|
184
|
-
const inMemoryNested = value;
|
|
185
|
-
const mergedNested = { ...baseNested };
|
|
186
|
-
for (const nestedKey of nestedModified) {
|
|
187
|
-
mergedNested[nestedKey] = inMemoryNested[nestedKey];
|
|
188
|
-
}
|
|
189
|
-
mergedSettings[field] = mergedNested;
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
// For top-level primitives and arrays, use the modified value directly
|
|
193
|
-
mergedSettings[field] = value;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
this.globalSettings = mergedSettings;
|
|
197
|
-
writeFileSync(this.settingsPath, JSON.stringify(this.globalSettings, null, 2), "utf-8");
|
|
198
|
-
}
|
|
199
|
-
catch (error) {
|
|
200
|
-
// File may have been externally modified with invalid JSON - don't overwrite
|
|
201
|
-
console.error(`Warning: Could not save settings file: ${error}`);
|
|
248
|
+
/** Mark a project field as modified during this session */
|
|
249
|
+
markProjectModified(field, nestedKey) {
|
|
250
|
+
this.modifiedProjectFields.add(field);
|
|
251
|
+
if (nestedKey) {
|
|
252
|
+
if (!this.modifiedProjectNestedFields.has(field)) {
|
|
253
|
+
this.modifiedProjectNestedFields.set(field, new Set());
|
|
202
254
|
}
|
|
255
|
+
this.modifiedProjectNestedFields.get(field).add(nestedKey);
|
|
203
256
|
}
|
|
204
|
-
// Always re-merge to update active settings (needed for both file and inMemory modes)
|
|
205
|
-
const projectSettings = this.loadProjectSettings();
|
|
206
|
-
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
207
257
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
258
|
+
recordError(scope, error) {
|
|
259
|
+
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
260
|
+
this.errors.push({ scope, error: normalizedError });
|
|
261
|
+
}
|
|
262
|
+
clearModifiedScope(scope) {
|
|
263
|
+
if (scope === "global") {
|
|
264
|
+
this.modifiedFields.clear();
|
|
265
|
+
this.modifiedNestedFields.clear();
|
|
212
266
|
return;
|
|
213
267
|
}
|
|
214
|
-
|
|
215
|
-
|
|
268
|
+
this.modifiedProjectFields.clear();
|
|
269
|
+
this.modifiedProjectNestedFields.clear();
|
|
270
|
+
}
|
|
271
|
+
enqueueWrite(scope, task) {
|
|
272
|
+
this.writeQueue = this.writeQueue
|
|
273
|
+
.then(() => {
|
|
274
|
+
task();
|
|
275
|
+
this.clearModifiedScope(scope);
|
|
276
|
+
})
|
|
277
|
+
.catch((error) => {
|
|
278
|
+
this.recordError(scope, error);
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
cloneModifiedNestedFields(source) {
|
|
282
|
+
const snapshot = new Map();
|
|
283
|
+
for (const [key, value] of source.entries()) {
|
|
284
|
+
snapshot.set(key, new Set(value));
|
|
216
285
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
286
|
+
return snapshot;
|
|
287
|
+
}
|
|
288
|
+
persistScopedSettings(scope, snapshotSettings, modifiedFields, modifiedNestedFields) {
|
|
289
|
+
this.storage.withLock(scope, (current) => {
|
|
290
|
+
const currentFileSettings = current
|
|
291
|
+
? SettingsManager.migrateSettings(JSON.parse(current))
|
|
292
|
+
: {};
|
|
293
|
+
const mergedSettings = { ...currentFileSettings };
|
|
294
|
+
for (const field of modifiedFields) {
|
|
295
|
+
const value = snapshotSettings[field];
|
|
296
|
+
if (modifiedNestedFields.has(field) && typeof value === "object" && value !== null) {
|
|
297
|
+
const nestedModified = modifiedNestedFields.get(field);
|
|
298
|
+
const baseNested = currentFileSettings[field] ?? {};
|
|
299
|
+
const inMemoryNested = value;
|
|
300
|
+
const mergedNested = { ...baseNested };
|
|
301
|
+
for (const nestedKey of nestedModified) {
|
|
302
|
+
mergedNested[nestedKey] = inMemoryNested[nestedKey];
|
|
303
|
+
}
|
|
304
|
+
mergedSettings[field] = mergedNested;
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
mergedSettings[field] = value;
|
|
308
|
+
}
|
|
221
309
|
}
|
|
222
|
-
|
|
310
|
+
return JSON.stringify(mergedSettings, null, 2);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
save() {
|
|
314
|
+
this.settings = deepMergeSettings(this.globalSettings, this.projectSettings);
|
|
315
|
+
if (this.globalSettingsLoadError) {
|
|
316
|
+
return;
|
|
223
317
|
}
|
|
224
|
-
|
|
225
|
-
|
|
318
|
+
const snapshotGlobalSettings = structuredClone(this.globalSettings);
|
|
319
|
+
const modifiedFields = new Set(this.modifiedFields);
|
|
320
|
+
const modifiedNestedFields = this.cloneModifiedNestedFields(this.modifiedNestedFields);
|
|
321
|
+
this.enqueueWrite("global", () => {
|
|
322
|
+
this.persistScopedSettings("global", snapshotGlobalSettings, modifiedFields, modifiedNestedFields);
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
saveProjectSettings(settings) {
|
|
326
|
+
this.projectSettings = structuredClone(settings);
|
|
327
|
+
this.settings = deepMergeSettings(this.globalSettings, this.projectSettings);
|
|
328
|
+
if (this.projectSettingsLoadError) {
|
|
329
|
+
return;
|
|
226
330
|
}
|
|
331
|
+
const snapshotProjectSettings = structuredClone(this.projectSettings);
|
|
332
|
+
const modifiedFields = new Set(this.modifiedProjectFields);
|
|
333
|
+
const modifiedNestedFields = this.cloneModifiedNestedFields(this.modifiedProjectNestedFields);
|
|
334
|
+
this.enqueueWrite("project", () => {
|
|
335
|
+
this.persistScopedSettings("project", snapshotProjectSettings, modifiedFields, modifiedNestedFields);
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
async flush() {
|
|
339
|
+
await this.writeQueue;
|
|
340
|
+
}
|
|
341
|
+
drainErrors() {
|
|
342
|
+
const drained = [...this.errors];
|
|
343
|
+
this.errors = [];
|
|
344
|
+
return drained;
|
|
227
345
|
}
|
|
228
346
|
getLastChangelogVersion() {
|
|
229
347
|
return this.settings.lastChangelogVersion;
|
|
@@ -233,6 +351,9 @@ export class SettingsManager {
|
|
|
233
351
|
this.markModified("lastChangelogVersion");
|
|
234
352
|
this.save();
|
|
235
353
|
}
|
|
354
|
+
getSessionDir() {
|
|
355
|
+
return this.settings.sessionDir;
|
|
356
|
+
}
|
|
236
357
|
getDefaultProvider() {
|
|
237
358
|
return this.settings.defaultProvider;
|
|
238
359
|
}
|
|
@@ -288,6 +409,14 @@ export class SettingsManager {
|
|
|
288
409
|
this.markModified("defaultThinkingLevel");
|
|
289
410
|
this.save();
|
|
290
411
|
}
|
|
412
|
+
getTransport() {
|
|
413
|
+
return this.settings.transport ?? "sse";
|
|
414
|
+
}
|
|
415
|
+
setTransport(transport) {
|
|
416
|
+
this.globalSettings.transport = transport;
|
|
417
|
+
this.markModified("transport");
|
|
418
|
+
this.save();
|
|
419
|
+
}
|
|
291
420
|
getCompactionEnabled() {
|
|
292
421
|
return this.settings.compaction?.enabled ?? true;
|
|
293
422
|
}
|
|
@@ -315,8 +444,12 @@ export class SettingsManager {
|
|
|
315
444
|
getBranchSummarySettings() {
|
|
316
445
|
return {
|
|
317
446
|
reserveTokens: this.settings.branchSummary?.reserveTokens ?? 16384,
|
|
447
|
+
skipPrompt: this.settings.branchSummary?.skipPrompt ?? false,
|
|
318
448
|
};
|
|
319
449
|
}
|
|
450
|
+
getBranchSummarySkipPrompt() {
|
|
451
|
+
return this.settings.branchSummary?.skipPrompt ?? false;
|
|
452
|
+
}
|
|
320
453
|
getRetryEnabled() {
|
|
321
454
|
return this.settings.retry?.enabled ?? true;
|
|
322
455
|
}
|
|
@@ -368,6 +501,14 @@ export class SettingsManager {
|
|
|
368
501
|
this.markModified("shellCommandPrefix");
|
|
369
502
|
this.save();
|
|
370
503
|
}
|
|
504
|
+
getNpmCommand() {
|
|
505
|
+
return this.settings.npmCommand ? [...this.settings.npmCommand] : undefined;
|
|
506
|
+
}
|
|
507
|
+
setNpmCommand(command) {
|
|
508
|
+
this.globalSettings.npmCommand = command ? [...command] : undefined;
|
|
509
|
+
this.markModified("npmCommand");
|
|
510
|
+
this.save();
|
|
511
|
+
}
|
|
371
512
|
getCollapseChangelog() {
|
|
372
513
|
return this.settings.collapseChangelog ?? false;
|
|
373
514
|
}
|
|
@@ -385,10 +526,10 @@ export class SettingsManager {
|
|
|
385
526
|
this.save();
|
|
386
527
|
}
|
|
387
528
|
setProjectPackages(packages) {
|
|
388
|
-
const projectSettings = this.
|
|
529
|
+
const projectSettings = structuredClone(this.projectSettings);
|
|
389
530
|
projectSettings.packages = packages;
|
|
531
|
+
this.markProjectModified("packages");
|
|
390
532
|
this.saveProjectSettings(projectSettings);
|
|
391
|
-
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
392
533
|
}
|
|
393
534
|
getExtensionPaths() {
|
|
394
535
|
return [...(this.settings.extensions ?? [])];
|
|
@@ -399,10 +540,10 @@ export class SettingsManager {
|
|
|
399
540
|
this.save();
|
|
400
541
|
}
|
|
401
542
|
setProjectExtensionPaths(paths) {
|
|
402
|
-
const projectSettings = this.
|
|
543
|
+
const projectSettings = structuredClone(this.projectSettings);
|
|
403
544
|
projectSettings.extensions = paths;
|
|
545
|
+
this.markProjectModified("extensions");
|
|
404
546
|
this.saveProjectSettings(projectSettings);
|
|
405
|
-
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
406
547
|
}
|
|
407
548
|
getSkillPaths() {
|
|
408
549
|
return [...(this.settings.skills ?? [])];
|
|
@@ -413,24 +554,24 @@ export class SettingsManager {
|
|
|
413
554
|
this.save();
|
|
414
555
|
}
|
|
415
556
|
setProjectSkillPaths(paths) {
|
|
416
|
-
const projectSettings = this.
|
|
557
|
+
const projectSettings = structuredClone(this.projectSettings);
|
|
417
558
|
projectSettings.skills = paths;
|
|
559
|
+
this.markProjectModified("skills");
|
|
418
560
|
this.saveProjectSettings(projectSettings);
|
|
419
|
-
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
420
561
|
}
|
|
421
562
|
getPromptTemplatePaths() {
|
|
422
|
-
return [...(this.settings.
|
|
563
|
+
return [...(this.settings.prompts ?? [])];
|
|
423
564
|
}
|
|
424
565
|
setPromptTemplatePaths(paths) {
|
|
425
|
-
this.globalSettings.
|
|
426
|
-
this.markModified("
|
|
566
|
+
this.globalSettings.prompts = paths;
|
|
567
|
+
this.markModified("prompts");
|
|
427
568
|
this.save();
|
|
428
569
|
}
|
|
429
570
|
setProjectPromptTemplatePaths(paths) {
|
|
430
|
-
const projectSettings = this.
|
|
431
|
-
projectSettings.
|
|
571
|
+
const projectSettings = structuredClone(this.projectSettings);
|
|
572
|
+
projectSettings.prompts = paths;
|
|
573
|
+
this.markProjectModified("prompts");
|
|
432
574
|
this.saveProjectSettings(projectSettings);
|
|
433
|
-
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
434
575
|
}
|
|
435
576
|
getThemePaths() {
|
|
436
577
|
return [...(this.settings.themes ?? [])];
|
|
@@ -441,10 +582,10 @@ export class SettingsManager {
|
|
|
441
582
|
this.save();
|
|
442
583
|
}
|
|
443
584
|
setProjectThemePaths(paths) {
|
|
444
|
-
const projectSettings = this.
|
|
585
|
+
const projectSettings = structuredClone(this.projectSettings);
|
|
445
586
|
projectSettings.themes = paths;
|
|
587
|
+
this.markProjectModified("themes");
|
|
446
588
|
this.saveProjectSettings(projectSettings);
|
|
447
|
-
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
448
589
|
}
|
|
449
590
|
getEnableSkillCommands() {
|
|
450
591
|
return this.settings.enableSkillCommands ?? true;
|
|
@@ -521,6 +662,16 @@ export class SettingsManager {
|
|
|
521
662
|
this.markModified("doubleEscapeAction");
|
|
522
663
|
this.save();
|
|
523
664
|
}
|
|
665
|
+
getTreeFilterMode() {
|
|
666
|
+
const mode = this.settings.treeFilterMode;
|
|
667
|
+
const valid = ["default", "no-tools", "user-only", "labeled-only", "all"];
|
|
668
|
+
return mode && valid.includes(mode) ? mode : "default";
|
|
669
|
+
}
|
|
670
|
+
setTreeFilterMode(mode) {
|
|
671
|
+
this.globalSettings.treeFilterMode = mode;
|
|
672
|
+
this.markModified("treeFilterMode");
|
|
673
|
+
this.save();
|
|
674
|
+
}
|
|
524
675
|
getShowHardwareCursor() {
|
|
525
676
|
return this.settings.showHardwareCursor ?? process.env.PI_HARDWARE_CURSOR === "1";
|
|
526
677
|
}
|