@caupulican/pi-adaptative 0.81.37 → 0.81.39
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 +91 -0
- package/README.md +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/README.md +18 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts +131 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +1 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +196 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +1 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +308 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts +22 -2
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +585 -24
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +749 -27
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/__init__.py +43 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/fs.py +270 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/search.py +252 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/strings.py +399 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/commands/text.py +575 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/context.py +52 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/errors.py +49 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/exec.py +734 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/expand.py +238 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/main.py +132 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/nodes.py +116 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/parser.py +287 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/proc.py +137 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/state.py +100 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/tokens.py +579 -0
- package/dist/bundled-resources/skills/tool-call-repair/SKILL.md +19 -9
- package/dist/bundled-resources/skills/tool-call-repair/references/failure-grammar.md +22 -5
- package/dist/bundled-resources/skills/tool-call-repair/references/repair-catalogue.md +5 -5
- package/dist/bundled-resources/skills/tool-call-repair/references/text-protocol-grammar.md +28 -7
- package/dist/cli/args.d.ts +3 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +15 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-paths.d.ts +49 -0
- package/dist/core/agent-paths.d.ts.map +1 -0
- package/dist/core/agent-paths.js +107 -0
- package/dist/core/agent-paths.js.map +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +3 -3
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +234 -17
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +484 -62
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomy/contracts.d.ts +9 -0
- package/dist/core/autonomy/contracts.d.ts.map +1 -1
- package/dist/core/autonomy/contracts.js.map +1 -1
- package/dist/core/autonomy/lane-tracker.d.ts +10 -1
- package/dist/core/autonomy/lane-tracker.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tracker.js +5 -1
- package/dist/core/autonomy/lane-tracker.js.map +1 -1
- package/dist/core/background-lane-controller.d.ts +122 -6
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +447 -90
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/bash-execution-controller.d.ts +4 -0
- package/dist/core/bash-execution-controller.d.ts.map +1 -1
- package/dist/core/bash-execution-controller.js +7 -1
- package/dist/core/bash-execution-controller.js.map +1 -1
- package/dist/core/compaction-support.d.ts +13 -3
- package/dist/core/compaction-support.d.ts.map +1 -1
- package/dist/core/compaction-support.js +43 -7
- package/dist/core/compaction-support.js.map +1 -1
- package/dist/core/context/context-audit.d.ts +33 -1
- package/dist/core/context/context-audit.d.ts.map +1 -1
- package/dist/core/context/context-audit.js +31 -5
- package/dist/core/context/context-audit.js.map +1 -1
- package/dist/core/context/sqlite-runtime-index.d.ts.map +1 -1
- package/dist/core/context/sqlite-runtime-index.js +13 -7
- package/dist/core/context/sqlite-runtime-index.js.map +1 -1
- package/dist/core/context-gc.d.ts.map +1 -1
- package/dist/core/context-gc.js +16 -1
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/context-pipeline.d.ts +26 -4
- package/dist/core/context-pipeline.d.ts.map +1 -1
- package/dist/core/context-pipeline.js +137 -14
- package/dist/core/context-pipeline.js.map +1 -1
- package/dist/core/cost-guard.d.ts +19 -3
- package/dist/core/cost-guard.d.ts.map +1 -1
- package/dist/core/cost-guard.js +18 -3
- package/dist/core/cost-guard.js.map +1 -1
- package/dist/core/delegation/session-worker-result.d.ts +34 -4
- package/dist/core/delegation/session-worker-result.d.ts.map +1 -1
- package/dist/core/delegation/session-worker-result.js +64 -4
- package/dist/core/delegation/session-worker-result.js.map +1 -1
- package/dist/core/delegation/worker-actions.d.ts.map +1 -1
- package/dist/core/delegation/worker-actions.js +1 -1
- package/dist/core/delegation/worker-actions.js.map +1 -1
- package/dist/core/delegation/worker-result.d.ts +42 -1
- package/dist/core/delegation/worker-result.d.ts.map +1 -1
- package/dist/core/delegation/worker-result.js +68 -0
- package/dist/core/delegation/worker-result.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +23 -7
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +51 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/goal-loop-controller.d.ts +17 -1
- package/dist/core/goal-loop-controller.d.ts.map +1 -1
- package/dist/core/goal-loop-controller.js +79 -11
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/goal-continuation-controller.d.ts +48 -2
- package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-controller.js +77 -0
- package/dist/core/goals/goal-continuation-controller.js.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.d.ts +39 -0
- package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.js +42 -0
- package/dist/core/goals/goal-continuation-defaults.js.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.d.ts +4 -0
- package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.js +51 -10
- package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
- package/dist/core/goals/goal-runtime-snapshot.d.ts +101 -2
- package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/goals/goal-runtime-snapshot.js +87 -4
- package/dist/core/goals/goal-runtime-snapshot.js.map +1 -1
- package/dist/core/goals/goal-state.d.ts +89 -1
- package/dist/core/goals/goal-state.d.ts.map +1 -1
- package/dist/core/goals/goal-state.js +71 -5
- package/dist/core/goals/goal-state.js.map +1 -1
- package/dist/core/goals/goal-tool-core.d.ts +56 -2
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
- package/dist/core/goals/goal-tool-core.js +111 -5
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/goals/session-goal-state.d.ts +11 -2
- package/dist/core/goals/session-goal-state.d.ts.map +1 -1
- package/dist/core/goals/session-goal-state.js +32 -17
- package/dist/core/goals/session-goal-state.js.map +1 -1
- package/dist/core/keybindings.d.ts +10 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +10 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/learning/observation-store.d.ts +12 -3
- package/dist/core/learning/observation-store.d.ts.map +1 -1
- package/dist/core/learning/observation-store.js +30 -15
- package/dist/core/learning/observation-store.js.map +1 -1
- package/dist/core/learning/skill-curator.d.ts +5 -1
- package/dist/core/learning/skill-curator.d.ts.map +1 -1
- package/dist/core/learning/skill-curator.js +21 -19
- package/dist/core/learning/skill-curator.js.map +1 -1
- package/dist/core/local-runtime-controller.d.ts +65 -3
- package/dist/core/local-runtime-controller.d.ts.map +1 -1
- package/dist/core/local-runtime-controller.js +186 -26
- package/dist/core/local-runtime-controller.js.map +1 -1
- package/dist/core/memory/providers/file-store.d.ts +1 -1
- package/dist/core/memory/providers/file-store.d.ts.map +1 -1
- package/dist/core/memory/providers/file-store.js +6 -6
- package/dist/core/memory/providers/file-store.js.map +1 -1
- package/dist/core/model-capability.d.ts +34 -0
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +42 -1
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-router/tool-escalation.d.ts +15 -0
- package/dist/core/model-router/tool-escalation.d.ts.map +1 -1
- package/dist/core/model-router/tool-escalation.js +23 -1
- package/dist/core/model-router/tool-escalation.js.map +1 -1
- package/dist/core/model-router-controller.d.ts +34 -7
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +95 -16
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/models/adaptation-store.d.ts +7 -0
- package/dist/core/models/adaptation-store.d.ts.map +1 -1
- package/dist/core/models/adaptation-store.js +47 -11
- package/dist/core/models/adaptation-store.js.map +1 -1
- package/dist/core/models/default-model-suggestions.d.ts.map +1 -1
- package/dist/core/models/default-model-suggestions.js +17 -0
- package/dist/core/models/default-model-suggestions.js.map +1 -1
- package/dist/core/models/fitness-store.d.ts +3 -0
- package/dist/core/models/fitness-store.d.ts.map +1 -1
- package/dist/core/models/fitness-store.js +11 -2
- package/dist/core/models/fitness-store.js.map +1 -1
- package/dist/core/models/llamacpp-runtime.d.ts +180 -0
- package/dist/core/models/llamacpp-runtime.d.ts.map +1 -0
- package/dist/core/models/llamacpp-runtime.js +475 -0
- package/dist/core/models/llamacpp-runtime.js.map +1 -0
- package/dist/core/models/local-registration.d.ts +40 -0
- package/dist/core/models/local-registration.d.ts.map +1 -1
- package/dist/core/models/local-registration.js +94 -5
- package/dist/core/models/local-registration.js.map +1 -1
- package/dist/core/models/local-runtime.d.ts.map +1 -1
- package/dist/core/models/local-runtime.js +9 -7
- package/dist/core/models/local-runtime.js.map +1 -1
- package/dist/core/models/model-ref.d.ts +7 -0
- package/dist/core/models/model-ref.d.ts.map +1 -1
- package/dist/core/models/model-ref.js +26 -0
- package/dist/core/models/model-ref.js.map +1 -1
- package/dist/core/models/needle-runtime.d.ts +257 -0
- package/dist/core/models/needle-runtime.d.ts.map +1 -0
- package/dist/core/models/needle-runtime.js +519 -0
- package/dist/core/models/needle-runtime.js.map +1 -0
- package/dist/core/models/prism-llamacpp-lifecycle.d.ts +89 -0
- package/dist/core/models/prism-llamacpp-lifecycle.d.ts.map +1 -0
- package/dist/core/models/prism-llamacpp-lifecycle.js +121 -0
- package/dist/core/models/prism-llamacpp-lifecycle.js.map +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +11 -10
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/process-matrix/codes.d.ts +72 -0
- package/dist/core/process-matrix/codes.d.ts.map +1 -0
- package/dist/core/process-matrix/codes.js +15 -0
- package/dist/core/process-matrix/codes.js.map +1 -0
- package/dist/core/process-matrix/runtime.d.ts +63 -0
- package/dist/core/process-matrix/runtime.d.ts.map +1 -0
- package/dist/core/process-matrix/runtime.js +310 -0
- package/dist/core/process-matrix/runtime.js.map +1 -0
- package/dist/core/process-matrix/store.d.ts +22 -0
- package/dist/core/process-matrix/store.d.ts.map +1 -0
- package/dist/core/process-matrix/store.js +80 -0
- package/dist/core/process-matrix/store.js.map +1 -0
- package/dist/core/process-matrix/supervisor.d.ts +72 -0
- package/dist/core/process-matrix/supervisor.d.ts.map +1 -0
- package/dist/core/process-matrix/supervisor.js +130 -0
- package/dist/core/process-matrix/supervisor.js.map +1 -0
- package/dist/core/profile-registry.d.ts +7 -0
- package/dist/core/profile-registry.d.ts.map +1 -1
- package/dist/core/profile-registry.js +20 -0
- package/dist/core/profile-registry.js.map +1 -1
- package/dist/core/python-runtime.d.ts.map +1 -1
- package/dist/core/python-runtime.js +3 -3
- package/dist/core/python-runtime.js.map +1 -1
- package/dist/core/reflection-controller.d.ts +29 -5
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +215 -126
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/reload-blockers.d.ts +36 -0
- package/dist/core/reload-blockers.d.ts.map +1 -1
- package/dist/core/reload-blockers.js +44 -0
- package/dist/core/reload-blockers.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +8 -7
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/runtime-builder.d.ts +58 -5
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +209 -25
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/scout-controller.d.ts +6 -0
- package/dist/core/scout-controller.d.ts.map +1 -1
- package/dist/core/scout-controller.js +66 -52
- package/dist/core/scout-controller.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -3
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-role.d.ts +31 -0
- package/dist/core/session-role.d.ts.map +1 -0
- package/dist/core/session-role.js +52 -0
- package/dist/core/session-role.js.map +1 -0
- package/dist/core/settings-manager.d.ts +42 -3
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +94 -60
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt-builder.d.ts +12 -0
- package/dist/core/system-prompt-builder.d.ts.map +1 -1
- package/dist/core/system-prompt-builder.js +6 -0
- package/dist/core/system-prompt-builder.js.map +1 -1
- package/dist/core/system-prompt.d.ts +14 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +20 -3
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/session-task-state.d.ts +11 -2
- package/dist/core/tasks/session-task-state.d.ts.map +1 -1
- package/dist/core/tasks/session-task-state.js +27 -11
- package/dist/core/tasks/session-task-state.js.map +1 -1
- package/dist/core/tasks/task-contract-monitor.d.ts +45 -0
- package/dist/core/tasks/task-contract-monitor.d.ts.map +1 -0
- package/dist/core/tasks/task-contract-monitor.js +56 -0
- package/dist/core/tasks/task-contract-monitor.js.map +1 -0
- package/dist/core/tasks/task-state.d.ts +8 -0
- package/dist/core/tasks/task-state.d.ts.map +1 -1
- package/dist/core/tasks/task-state.js +28 -1
- package/dist/core/tasks/task-state.js.map +1 -1
- package/dist/core/tool-gate-controller.d.ts.map +1 -1
- package/dist/core/tool-gate-controller.js +5 -0
- package/dist/core/tool-gate-controller.js.map +1 -1
- package/dist/core/tool-recovery-log-records.d.ts +7 -0
- package/dist/core/tool-recovery-log-records.d.ts.map +1 -1
- package/dist/core/tool-recovery-log-records.js +14 -6
- package/dist/core/tool-recovery-log-records.js.map +1 -1
- package/dist/core/tool-selection/promotion.d.ts +54 -0
- package/dist/core/tool-selection/promotion.d.ts.map +1 -0
- package/dist/core/tool-selection/promotion.js +81 -0
- package/dist/core/tool-selection/promotion.js.map +1 -0
- package/dist/core/tool-selection/tool-performance-store.d.ts +37 -0
- package/dist/core/tool-selection/tool-performance-store.d.ts.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.js +87 -3
- package/dist/core/tool-selection/tool-performance-store.js.map +1 -1
- package/dist/core/tool-selection/tool-selection-controller.d.ts +45 -0
- package/dist/core/tool-selection/tool-selection-controller.d.ts.map +1 -1
- package/dist/core/tool-selection/tool-selection-controller.js +96 -0
- package/dist/core/tool-selection/tool-selection-controller.js.map +1 -1
- package/dist/core/tools/bash.d.ts +18 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +97 -18
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/delegate-status.d.ts +14 -0
- package/dist/core/tools/delegate-status.d.ts.map +1 -1
- package/dist/core/tools/delegate-status.js +82 -7
- package/dist/core/tools/delegate-status.js.map +1 -1
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +25 -8
- package/dist/core/tools/delegate.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +52 -44
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/goal.d.ts +94 -3
- package/dist/core/tools/goal.d.ts.map +1 -1
- package/dist/core/tools/goal.js +165 -15
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +5 -4
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/model-fitness.d.ts +7 -0
- package/dist/core/tools/model-fitness.d.ts.map +1 -1
- package/dist/core/tools/model-fitness.js +2 -2
- package/dist/core/tools/model-fitness.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/shell-contract-router.d.ts +6 -1
- package/dist/core/tools/shell-contract-router.d.ts.map +1 -1
- package/dist/core/tools/shell-contract-router.js +69 -13
- package/dist/core/tools/shell-contract-router.js.map +1 -1
- package/dist/core/tools/shell-session.d.ts +89 -0
- package/dist/core/tools/shell-session.d.ts.map +1 -0
- package/dist/core/tools/shell-session.js +432 -0
- package/dist/core/tools/shell-session.js.map +1 -0
- package/dist/core/tools/task-steps.d.ts +4 -0
- package/dist/core/tools/task-steps.d.ts.map +1 -1
- package/dist/core/tools/task-steps.js +63 -8
- package/dist/core/tools/task-steps.js.map +1 -1
- package/dist/core/tools/tmux-dispatch.d.ts +86 -0
- package/dist/core/tools/tmux-dispatch.d.ts.map +1 -0
- package/dist/core/tools/tmux-dispatch.js +91 -0
- package/dist/core/tools/tmux-dispatch.js.map +1 -0
- package/dist/core/tools/windows-shell-engine.d.ts +42 -0
- package/dist/core/tools/windows-shell-engine.d.ts.map +1 -0
- package/dist/core/tools/windows-shell-engine.js +153 -0
- package/dist/core/tools/windows-shell-engine.js.map +1 -0
- package/dist/core/tools/windows-shell-state.d.ts +40 -0
- package/dist/core/tools/windows-shell-state.d.ts.map +1 -0
- package/dist/core/tools/windows-shell-state.js +59 -0
- package/dist/core/tools/windows-shell-state.js.map +1 -0
- package/dist/core/tools/worktree-sync.d.ts +24 -0
- package/dist/core/tools/worktree-sync.d.ts.map +1 -0
- package/dist/core/tools/worktree-sync.js +338 -0
- package/dist/core/tools/worktree-sync.js.map +1 -0
- package/dist/core/trust-manager.d.ts +4 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +20 -2
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/util/atomic-file.d.ts +55 -0
- package/dist/core/util/atomic-file.d.ts.map +1 -0
- package/dist/core/util/atomic-file.js +255 -0
- package/dist/core/util/atomic-file.js.map +1 -0
- package/dist/core/util/minimatch-cache.d.ts +33 -0
- package/dist/core/util/minimatch-cache.d.ts.map +1 -0
- package/dist/core/util/minimatch-cache.js +0 -0
- package/dist/core/util/minimatch-cache.js.map +1 -0
- package/dist/core/worktree-sync/codes.d.ts +227 -0
- package/dist/core/worktree-sync/codes.d.ts.map +1 -0
- package/dist/core/worktree-sync/codes.js +14 -0
- package/dist/core/worktree-sync/codes.js.map +1 -0
- package/dist/core/worktree-sync/git-engine.d.ts +156 -0
- package/dist/core/worktree-sync/git-engine.d.ts.map +1 -0
- package/dist/core/worktree-sync/git-engine.js +1191 -0
- package/dist/core/worktree-sync/git-engine.js.map +1 -0
- package/dist/core/worktree-sync/lane-gate.d.ts +75 -0
- package/dist/core/worktree-sync/lane-gate.d.ts.map +1 -0
- package/dist/core/worktree-sync/lane-gate.js +360 -0
- package/dist/core/worktree-sync/lane-gate.js.map +1 -0
- package/dist/core/worktree-sync/runtime.d.ts +47 -0
- package/dist/core/worktree-sync/runtime.d.ts.map +1 -0
- package/dist/core/worktree-sync/runtime.js +96 -0
- package/dist/core/worktree-sync/runtime.js.map +1 -0
- package/dist/core/worktree-sync/store.d.ts +69 -0
- package/dist/core/worktree-sync/store.d.ts.map +1 -0
- package/dist/core/worktree-sync/store.js +247 -0
- package/dist/core/worktree-sync/store.js.map +1 -0
- package/dist/core/worktree-sync/watcher.d.ts +29 -0
- package/dist/core/worktree-sync/watcher.d.ts.map +1 -0
- package/dist/core/worktree-sync/watcher.js +93 -0
- package/dist/core/worktree-sync/watcher.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +94 -0
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +9 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +38 -0
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.d.ts +16 -1
- package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.js +50 -8
- package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
- package/dist/modes/interactive/components/profile-resource-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/profile-resource-editor.js +23 -1
- package/dist/modes/interactive/components/profile-resource-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +4 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/local-model-commands.d.ts +43 -0
- package/dist/modes/interactive/local-model-commands.d.ts.map +1 -1
- package/dist/modes/interactive/local-model-commands.js +290 -3
- package/dist/modes/interactive/local-model-commands.js.map +1 -1
- package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-flow-commands.js +24 -4
- package/dist/modes/interactive/session-flow-commands.js.map +1 -1
- package/dist/utils/fs-watch.d.ts +11 -0
- package/dist/utils/fs-watch.d.ts.map +1 -1
- package/dist/utils/fs-watch.js +20 -2
- package/dist/utils/fs-watch.js.map +1 -1
- package/dist/utils/highlight-js-languages.d.ts +4 -0
- package/dist/utils/highlight-js-languages.d.ts.map +1 -0
- package/dist/utils/highlight-js-languages.js +573 -0
- package/dist/utils/highlight-js-languages.js.map +1 -0
- package/dist/utils/shell.d.ts +7 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +39 -9
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +53 -5
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +112 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/development.md +2 -0
- package/docs/packages.md +1 -1
- package/docs/process-matrix.md +120 -0
- package/docs/settings.md +5 -2
- package/docs/tmux-agent-manager.md +85 -2
- package/docs/windows.md +52 -3
- package/docs/work-directory.md +29 -0
- package/docs/worktree-sync.md +250 -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/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/npm-shrinkwrap.json +12 -12
- package/package.json +10 -4
- package/docs/integration-sweep-builder-blueprint-2026-07-09.md +0 -365
- package/docs/integration-sweep-resume-2026-07-09.md +0 -407
|
@@ -1 +1 @@
|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M,CAAC;YACR,OAAO,IAAI,CAAC;QACb,CAAC;IAAA,CACD;IAED,iCAAiC,GAAa;QAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAE/C,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAC/B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CACnF,CAAC;QAEF,MAAM,SAAS,GAAa,EAAE,CAAC;QAC/B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;YAC5C,IAAI,UAAU,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC1G,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC5B,CAAC;QACF,CAAC;QACD,OAAO,SAAS,CAAC;IAAA,CACjB;CACD","sourcesContent":["import type { Transport } from \"@caupulican/pi-ai\";\nimport { createHash } from \"crypto\";\nimport { existsSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from \"fs\";\nimport { minimatch } from \"minimatch\";\nimport { homedir } from \"os\";\nimport { basename, dirname, join, relative, resolve, sep } from \"path\";\nimport lockfile from \"proper-lockfile\";\nimport { CONFIG_DIR_NAME, getAgentDir, getProfilesDir } from \"../config.ts\";\nimport { normalizePath, resolvePath } from \"../utils/paths.ts\";\nimport {\n\tDEFAULT_GOAL_AUTO_CONTINUE,\n\tDEFAULT_GOAL_AUTO_CONTINUE_DELAY_MS,\n\tDEFAULT_GOAL_CONTINUE_MAX_STALL_TURNS,\n\tDEFAULT_GOAL_CONTINUE_MAX_TURNS,\n\tDEFAULT_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES,\n\tMAX_GOAL_AUTO_CONTINUE_DELAY_MS,\n\tMAX_GOAL_CONTINUE_MAX_STALL_TURNS,\n\tMAX_GOAL_CONTINUE_MAX_TURNS,\n\tMAX_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES,\n} from \"./goals/goal-continuation-defaults.ts\";\nimport { DEFAULT_HTTP_IDLE_TIMEOUT_MS, parseHttpIdleTimeoutMs } from \"./http-dispatcher.ts\";\nimport { ProfileRegistry } from \"./profile-registry.ts\";\nimport { mergeResourceProfileMap, mergeResourceProfileSettings } from \"./resource-profile-blocks.ts\";\nimport { validateSkillName } from \"./skills.ts\";\nimport type { ToolkitScript } from \"./toolkit/script-registry.ts\";\n\nexport interface CompactionSettings {\n\tenabled?: boolean; // default: true\n\treserveTokens?: number; // default: 16384\n\tkeepRecentTokens?: number; // default: 20000\n\ttriggerPercent?: number; // default: 0.7 — early context-efficiency threshold, separate from the USD cost guard\n\tmodel?: string; // default: \"auto\" — cheap auxiliary model for the summary; \"auto\" picks cheapest authed, else the session model\n}\n\nexport interface ScoutSettings {\n\tenabled?: boolean; // default: false\n\tmodel?: string; // default: \"auto\" — resolve an installed FastContext model, else return unavailable from the tool\n}\n\nexport interface SemanticMemoryGcSettings {\n\tenabled?: boolean; // default: true\n\tpreserveRecentPages?: number; // default: 2\n\tminChars?: number; // default: 1200\n\tmarkers?: string[]; // default: Automata/Mind XML-ish response tags\n}\n\nexport interface ContextGcSettings {\n\tenabled?: boolean; // default: true\n\tpreserveRecentMessages?: number; // default: 12\n\tminToolResultChars?: number; // default: 2500\n\ttools?: string[]; // default: read,bash,rg,grep,context_headroom_retrieve,headroom_retrieve\n\tsemanticMemory?: SemanticMemoryGcSettings;\n}\n\n/**\n * Conservative, opt-in first enforcement pilot for the context-policy layer (observe-only\n * by default -- see context/context-prompt-enforcement.ts). When enabled, stale\n * artifact-backed tool_output results outside the recent window are stubbed in place in\n * the provider-visible prompt only; the transcript/session history is never touched.\n */\nexport interface ContextPromptEnforcementSettings {\n\tenabled?: boolean; // default: false -- no behavior change unless explicitly opted in\n\tpreserveRecentMessages?: number; // default: 8 (mirrors context-gc's own default recency window)\n\tminChars?: number; // default: 1200 (mirrors context-gc's own minToolResultChars default)\n}\n\n/**\n * Local memory retrieval (see context/memory-retrieval.ts, context/memory-prompt-block.ts):\n * default-on for local, safe-auto sources. Prompt inclusion is still budget-gated per turn;\n * compact models get at most a 10-line/~200-token source-labeled block or no memory block.\n * External/non-local providers remain blocked unless explicitly allowed by policy.\n */\nexport interface MemoryRetrievalSettings {\n\tenabled?: boolean; // default: true -- local safe-auto retrieval\n\tmaxResults?: number; // default: 5, clamped to [1, 20]\n\tincludeInPrompt?: boolean; // default: true -- budget-gated safe-auto prompt inclusion\n\tallowExternalEgress?: boolean; // default: false -- explicit opt-in for raw query egress\n}\n\nexport interface ContextCurationSettings {\n\tenabled?: boolean; // default: false -- the curator never runs unless explicitly opted in\n\t/** Local model ref (\"provider/id\" or bare id) used for curation jobs. Required to drain. */\n\tmodel?: string;\n\tmaxJobsPerTurn?: number; // default: 4, clamped to [1, 16]\n}\n\nexport interface ContextPolicySettings {\n\tenforcement?: ContextPromptEnforcementSettings;\n\tmemory?: MemoryRetrievalSettings;\n\tcuration?: ContextCurationSettings;\n}\n\nexport const MEMORY_RETRIEVAL_MAX_RESULTS_MIN = 1;\nexport const MEMORY_RETRIEVAL_MAX_RESULTS_MAX = 20;\nconst MEMORY_RETRIEVAL_MAX_RESULTS_DEFAULT = 5;\n\nfunction clampMemoryRetrievalMaxResults(value: number): number {\n\treturn Math.min(MEMORY_RETRIEVAL_MAX_RESULTS_MAX, Math.max(MEMORY_RETRIEVAL_MAX_RESULTS_MIN, Math.trunc(value)));\n}\n\nexport interface BranchSummarySettings {\n\treserveTokens?: number; // default: 16384 (tokens reserved for prompt + LLM response)\n\tskipPrompt?: boolean; // default: false - when true, skips \"Summarize branch?\" prompt and defaults to no summary\n}\n\nexport interface ProviderRetrySettings {\n\ttimeoutMs?: number; // SDK/provider request timeout in milliseconds\n\tmaxRetries?: number; // SDK/provider retry attempts\n\tmaxRetryDelayMs?: number; // default: 60000 (max server-requested delay before failing)\n}\n\nexport interface StreamStallSettings {\n\tconnectMs?: number; // default: 120000 — max wait for the first stream event\n\tactiveIdleMs?: number; // default: 180000 — max event gap while content is flowing\n\tquietIdleMs?: number; // default: 600000 — max event gap during prefill/unstreamed thinking; clamped below nonzero httpIdleTimeoutMs\n}\n\nexport interface RetrySettings {\n\tenabled?: boolean; // default: true\n\tmaxRetries?: number; // default: 3\n\tbaseDelayMs?: number; // default: 2000 (exponential backoff: 2s, 4s, 8s)\n\tprovider?: ProviderRetrySettings;\n\tstall?: StreamStallSettings; // stream-stall watchdog bounds (pi-agent-core reliability/watchdogs.ts)\n}\n\nexport interface TerminalSettings {\n\tshowImages?: boolean; // default: true (only relevant if terminal supports images)\n\timageWidthCells?: number; // default: 60 (preferred inline image width in terminal cells)\n\tclearOnShrink?: boolean; // default: false (clear empty rows when content shrinks)\n\tshowTerminalProgress?: boolean; // default: false (OSC 9;4 terminal progress indicators)\n}\n\nexport interface ImageSettings {\n\tautoResize?: boolean; // default: true (resize images to 2000x2000 max for better model compatibility)\n\tblockImages?: boolean; // default: false - when true, prevents all images from being sent to LLM providers\n}\n\nexport interface ThinkingBudgetsSettings {\n\tminimal?: number;\n\tlow?: number;\n\tmedium?: number;\n\thigh?: number;\n}\n\nexport interface MarkdownSettings {\n\tcodeBlockIndent?: string; // default: \" \"\n}\n\nexport interface WarningSettings {\n\tanthropicExtraUsage?: boolean; // default: true\n}\n\nexport interface SelfModificationSettings {\n\tenabled?: boolean; // default: false\n\tsourcePath?: string; // Single pi-adaptative source tree path (legacy; still honored)\n\tsourcePaths?: string[]; // Ordered candidate source trees; first existing wins. Enables portable WSL/Termux switching from settings alone.\n}\n\nexport type AutoLearnThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\" | \"ultra\";\n\nexport interface AutoLearnSettings {\n\tenabled?: boolean; // default: false - autonomously trigger background history scavenging for long sessions\n\tmodel?: string; // \"active\" or omitted uses the current session model; otherwise a pi --model pattern\n\tthinkingLevel?: AutoLearnThinkingLevel; // default: low for background learner subprocesses\n\tlongSessionMessages?: number; // default: 64\n\tlongSessionContextPercent?: number; // default: 85\n\tcooldownMinutes?: number; // default: 1440 per session tenant (manual /auto-learn run bypasses)\n\tleaseMinutes?: number; // default: 90 for background learner state leases\n\tmaxConcurrentLearners?: number; // default: 2 per session tenant\n\tapplyHighConfidence?: boolean; // default: false unless the learning extension config opts in\n\treflectionReview?: boolean; // default: true when Auto Learn is enabled - post-turn review after corrective/complex turns\n\treflectionMinToolCalls?: number; // default: 12 tool calls in a turn before reflection review triggers\n\treflectionCooldownMinutes?: number; // default: 1440 per session tenant for reflection reviews\n\tcomplexTaskToolCalls?: number; // default: 12 tool calls before bypassing reflection cooldown as a complex task\n}\n\nexport type AutonomyMode = \"off\" | \"safe\" | \"balanced\" | \"full\";\n\nexport const DEFAULT_AUTONOMY_MAX_STALL_TURNS = DEFAULT_GOAL_CONTINUE_MAX_STALL_TURNS;\nexport const DEFAULT_AUTONOMY_GOAL_CONTINUE_TURNS = DEFAULT_GOAL_CONTINUE_MAX_TURNS;\nexport const DEFAULT_AUTONOMY_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES = DEFAULT_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES;\nexport const DEFAULT_AUTONOMY_GOAL_AUTO_CONTINUE = DEFAULT_GOAL_AUTO_CONTINUE;\nexport const DEFAULT_AUTONOMY_GOAL_AUTO_CONTINUE_DELAY_MS = DEFAULT_GOAL_AUTO_CONTINUE_DELAY_MS;\n\nexport interface AutonomySettings {\n\tmode?: AutonomyMode; // default: off; presets drive Auto Learn/reflection without many knobs\n\tmaxStallTurns?: number; // default: 20; maximum no-progress rounds before goal continuation asks the user\n\tgoalContinueTurns?: number; // default: 20; maximum continuation prompts per idle/explicit goal loop\n\tgoalContinueMaxWallClockMinutes?: number; // default: 0; 0 disables wall-clock budget\n\tgoalAutoContinue?: boolean; // default: true; auto-inject continuation prompts when an active goal is idle\n\tgoalAutoContinueDelayMs?: number; // default: 0; delay before idle auto-continuation starts\n}\n\nexport interface FailoverSettings {\n\tsubscriptionHop?: boolean; // default: true; subscription quota can hop once to an authenticated provider default\n}\n\nexport interface ModelRouterSettings {\n\tenabled?: boolean; // default: false — routing is opt-in until escalation safeguards are complete\n\tcheapModel?: string; // model pattern for read-only/research turns\n\tmediumModel?: string; // model pattern for normal scoped implementation, edits, and refactors\n\texpensiveModel?: string; // model pattern for modify/tool-heavy turns\n\tlearningModel?: string; // model pattern for background reflection/learn/skill-creator work; \"active\" uses session model\n\tjudgeEnabled?: boolean; // default: true — the routing judge runs automatically whenever the router is enabled and a judge model resolves\n\tfitnessGate?: boolean; // default: false — opt-in; blocks tier models whose probed relevant lane failed (Class B, subtractive)\n\tjudgeModel?: string; // model pattern for the routing-only judge; unset falls back to mediumModel\n\texecutorModel?: string; // model pattern for the local executor lane (direct toolkit commands); unset disables it\n\t// Per-tier thinking (R1): overrides the inherited-and-clamped session thinking level for a routed\n\t// turn on that tier only (see agent-session.ts's routed-turn swap). Unset reproduces today's\n\t// behavior exactly — inherit the session thinking level, clamped to the routed model. learningModel\n\t// already has its own thinking via autoLearn.thinkingLevel, so there is deliberately no learningThinking.\n\tcheapThinking?: ThinkingLevel;\n\tmediumThinking?: ThinkingLevel;\n\texpensiveThinking?: ThinkingLevel;\n\texecutorThinking?: ThinkingLevel; // thinking level for the executor-direct lane\n\tjudgeThinking?: ThinkingLevel; // thinking level for the routing judge's own completion; unset keeps today's \"off\"\n}\n\nexport const DEFAULT_RESEARCH_LANE_ENABLED = false;\nexport const DEFAULT_RESEARCH_LANE_MAX_USD = 0.25;\nexport const DEFAULT_RESEARCH_LANE_MAX_SOURCES = 8;\nexport const DEFAULT_RESEARCH_LANE_MAX_FINDINGS = 10;\nexport const DEFAULT_RESEARCH_LANE_MAX_WALL_CLOCK_MS = 120_000;\nexport const DEFAULT_RESEARCH_LANE_IDLE_DELAY_MS = 0;\nexport const DEFAULT_RESEARCH_LANE_MAX_RUNS_PER_SESSION = 10;\nexport const MAX_RESEARCH_LANE_MAX_USD = 5;\nexport const MAX_RESEARCH_LANE_MAX_SOURCES = 32;\nexport const MAX_RESEARCH_LANE_MAX_FINDINGS = 50;\nexport const MAX_RESEARCH_LANE_MAX_WALL_CLOCK_MS = 3_600_000;\nexport const MAX_RESEARCH_LANE_IDLE_DELAY_MS = 300_000;\nexport const MAX_RESEARCH_LANE_MAX_RUNS_PER_SESSION = 100;\n\nexport interface ResearchLaneSettings {\n\tenabled?: boolean; // default: false — autonomous background research is opt-in\n\tmodel?: string; // model pattern; unset inherits the session model the lane was shipped from\n\tprofile?: string; // shipped profile; model/soul/thinking plus grants over classified read-only lane tools govern it\n\tsystemPrompt?: string; // replaces the lane role prompt (the level-0 subagent core always remains)\n\tmaxUsd?: number; // default: 0.25 per research pass; post-hoc breaches mark the lane budget_exhausted\n\tmaxSources?: number; // default: 8 evidence sources per bundle\n\tmaxFindings?: number; // default: 10 findings per bundle\n\tmaxWallClockMs?: number; // default: 120000; 0 disables the wall-clock budget\n\tidleDelayMs?: number; // default: 0 — delay before idle-triggered research starts\n\tmaxRunsPerSession?: number; // default: 10 idle-triggered research passes per session\n}\n\nexport type ResolvedResearchLaneSettings = Required<Omit<ResearchLaneSettings, \"model\" | \"profile\" | \"systemPrompt\">> &\n\tPick<ResearchLaneSettings, \"model\" | \"profile\" | \"systemPrompt\">;\n\nexport const DEFAULT_WORKER_DELEGATION_ENABLED = true;\nexport const DEFAULT_WORKER_DELEGATION_MAX_USD = 0.5;\nexport const DEFAULT_WORKER_DELEGATION_MAX_WALL_CLOCK_MS = 120_000;\nexport const MAX_WORKER_DELEGATION_MAX_USD = 5;\nexport const MAX_WORKER_DELEGATION_MAX_WALL_CLOCK_MS = 3_600_000;\n\nexport interface WorkerDelegationSettings {\n\tenabled?: boolean; // default: true for capable models; explicit false is a hard off-switch\n\tmodel?: string; // model pattern; unset inherits the session model the lane was shipped from\n\tprofile?: string; // shipped profile; tool grants filter classified lane tools (opaque extension tools stay unavailable)\n\tsystemPrompt?: string; // replaces the worker role prompt (the level-0 subagent core always remains)\n\tmaxUsd?: number; // default: 0.50 per delegated worker; post-hoc breaches mark the lane budget_exhausted\n\tmaxWallClockMs?: number; // default: 120000; 0 disables the wall-clock budget\n\twriteEnabled?: boolean; // default: false — grants write_files so workers may emit file actions\n\twritePaths?: string[]; // envelope path scope for write workers (REQUIRED for writes; empty = writes refused)\n\tmaxConcurrent?: number; // default: 1, clamped [1,3] — concurrent delegated workers\n}\n\nexport type ResolvedWorkerDelegationSettings = Required<\n\tOmit<WorkerDelegationSettings, \"model\" | \"profile\" | \"systemPrompt\">\n> &\n\tPick<WorkerDelegationSettings, \"model\" | \"profile\" | \"systemPrompt\">;\n\nexport type LearningPolicyLayer =\n\t| \"memory\"\n\t| \"skill\"\n\t| \"prompt\"\n\t| \"extension\"\n\t| \"tool\"\n\t| \"script\"\n\t| \"settings\"\n\t| \"source\";\n\nexport const DEFAULT_LEARNING_POLICY_ENABLED = false;\nexport const DEFAULT_LEARNING_POLICY_AUTO_APPLY_ENABLED = false;\nexport const DEFAULT_LEARNING_POLICY_CONFIDENCE_THRESHOLD = 90;\nexport const DEFAULT_LEARNING_POLICY_MIN_OBSERVATIONS = 2;\nexport const DEFAULT_LEARNING_POLICY_ALLOWED_AUTO_APPLY_LAYERS: readonly LearningPolicyLayer[] = [\"memory\"];\nexport const DEFAULT_LEARNING_POLICY_REFLECTION_SOURCE_CONFIDENCE = 50;\nexport const DEFAULT_LEARNING_POLICY_AUTO_APPLY_SUPERSESSIONS = false;\n\nexport interface LearningPolicySettings {\n\tenabled?: boolean; // default: false — until enabled, reflection writes keep the legacy direct-apply path (now audited)\n\tautoApplyEnabled?: boolean; // default: false — with the policy on, writes become proposals unless auto-apply is enabled\n\tconfidenceThreshold?: number; // default: 90 (0-100)\n\tminObservations?: number; // default: 2 — single-session cues do not auto-apply\n\tallowedAutoApplyLayers?: LearningPolicyLayer[]; // default: [\"memory\"] — every other layer stays proposal-first\n\trequireRollbackPlan?: boolean; // default: true — durable writes need a rollback plan to auto-apply\n\treflectionSourceConfidence?: number; // default: 50 — trust assigned to single-session reflection cues (0-100)\n\tautoApplySupersessions?: boolean; // default: false — a memory_replace/memory_remove (supersedes/deletes an existing fact) stays a proposal even when otherwise eligible, unless explicitly opted in\n}\n\nexport type ResolvedLearningPolicySettings = Required<LearningPolicySettings>;\n\nexport interface ToolkitSettings {\n\t/** The blessed daily-ops scripts run_toolkit_script may execute. Nothing else ever runs. */\n\tscripts?: ToolkitScript[];\n}\n\nexport type ModelCapabilityMode = \"auto\" | \"off\" | \"full\" | \"lean\" | \"minimal\" | \"chat\";\n\nexport const DEFAULT_MODEL_CAPABILITY_MODE: ModelCapabilityMode = \"auto\";\n\nexport interface ModelCapabilitySettings {\n\t/**\n\t * default: \"auto\" — derive the tool/lane surface from the model's context window so small open\n\t * models stay usable for chat. \"off\" disables detection; a class name forces that class.\n\t */\n\tmode?: ModelCapabilityMode;\n}\n\nexport type TransportSetting = Transport;\n\n/**\n * Package source for npm/git packages.\n * - String form: load all resources from the package\n * - Object form: filter which resources to load\n */\nexport type PackageSource =\n\t| string\n\t| {\n\t\t\tsource: string;\n\t\t\textensions?: string[];\n\t\t\tskills?: string[];\n\t\t\tprompts?: string[];\n\t\t\tthemes?: string[];\n\t };\n\nexport type ResourceProfileKind = \"extensions\" | \"skills\" | \"prompts\" | \"themes\" | \"agents\" | \"tools\";\n\nexport interface ResourceProfileFilterSettings {\n\t/** Allowlist patterns. When non-empty, only matching resources stay available. */\n\tallow?: string[];\n\t/** Blocklist patterns. Applied after allow. */\n\tblock?: string[];\n}\n\nexport type ResourceProfileSettings = Partial<Record<ResourceProfileKind, ResourceProfileFilterSettings>>;\n\nexport interface DisabledResourcesSettings {\n\textensions?: string[];\n\tskills?: string[];\n\tprompts?: string[];\n\tthemes?: string[];\n\tagents?: string[];\n\ttools?: string[];\n}\n\nexport interface ToolRepairSettings {\n\tteach?: boolean;\n\ttextProtocol?: boolean;\n\tlogging?: boolean;\n}\n\nexport interface Settings {\n\tlastChangelogVersion?: string;\n\tdefaultProvider?: string;\n\tdefaultModel?: string;\n\tdefaultThinkingLevel?: ThinkingLevel;\n\ttransport?: TransportSetting; // default: \"auto\"\n\tsteeringMode?: \"all\" | \"one-at-a-time\";\n\tfollowUpMode?: \"all\" | \"one-at-a-time\";\n\ttheme?: string;\n\t/** Resource catalog directory (round resource management): the folder pi installs/updates/backs up from. */\n\tcatalogDir?: string;\n\tcompaction?: CompactionSettings;\n\tscout?: ScoutSettings;\n\t/** Proactive per-turn cost guard (#34). */\n\tcostGuard?: { maxTurnUsd?: number; action?: \"warn\" | \"downgrade\" };\n\t/** Skill curator (#32): auto-archive stale reflection-promoted skills at session start. */\n\tcurator?: { autoArchive?: boolean; staleDays?: number };\n\tcontextGc?: ContextGcSettings;\n\tcontextPolicy?: ContextPolicySettings;\n\tbranchSummary?: BranchSummarySettings;\n\tretry?: RetrySettings;\n\thideThinkingBlock?: boolean;\n\tshellPath?: string; // Custom shell path (e.g., for Cygwin users on Windows)\n\tquietStartup?: boolean;\n\tshellCommandPrefix?: string; // Prefix prepended to every bash command (e.g., \"shopt -s expand_aliases\" for alias support)\n\tnpmCommand?: string[]; // Command used for npm package lookup/install operations, argv-style (e.g., [\"mise\", \"exec\", \"node@20\", \"--\", \"npm\"])\n\tcollapseChangelog?: boolean; // Show condensed changelog after update (use /changelog for full)\n\tenableInstallTelemetry?: boolean; // default: true - anonymous version/update ping after changelog-detected updates\n\tpackages?: PackageSource[]; // Array of npm/git package sources (string or object with filtering)\n\textensions?: string[]; // Array of local extension file paths/directories or include/exclude patterns\n\tskills?: string[]; // Array of local skill file paths/directories or include/exclude patterns\n\tprompts?: string[]; // Array of local prompt template paths/directories or include/exclude patterns\n\tthemes?: string[]; // Array of local theme file paths/directories or include/exclude patterns\n\texternalResourceRoots?: string[]; // External directory roots to scan for resources\n\ttrustedResourceRoots?: string[]; // Explicitly trusted external directory roots (canonical absolute paths)\n\tdisabledResources?: DisabledResourcesSettings; // Legacy reversible block filters for extensions/skills/prompts/themes/agents/tools\n\tresourceProfiles?: Record<string, ResourceProfileSettings | ProfileDefinitionInput>; // Named resource filters, optionally with full situation metadata\n\tactiveResourceProfile?: string | string[]; // Active profile name(s), applied after global/project/directory settings merge\n\tactiveResourceProfiles?: string[]; // Active profile names, equivalent to activeResourceProfile array\n\tenableSkillCommands?: boolean; // default: true - register skills as /skill:name commands\n\tterminal?: TerminalSettings;\n\timages?: ImageSettings;\n\tenabledModels?: string[]; // Model patterns for cycling (same format as --models CLI flag)\n\tdoubleEscapeAction?: \"fork\" | \"tree\" | \"none\"; // Action for double-escape with empty editor (default: \"tree\")\n\ttreeFilterMode?: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\"; // Default filter when opening /tree\n\tthinkingBudgets?: ThinkingBudgetsSettings; // Custom token budgets for thinking levels\n\teditorPaddingX?: number; // Horizontal padding for input editor (default: 0)\n\tautocompleteMaxVisible?: number; // Max visible items in autocomplete dropdown (default: 5)\n\tshowHardwareCursor?: boolean; // Show terminal cursor while still positioning it for IME\n\tmarkdown?: MarkdownSettings;\n\twarnings?: WarningSettings;\n\tselfModification?: SelfModificationSettings; // Local guardrails for modifying the pi-adaptative source/harness\n\tautonomy?: AutonomySettings; // Low-config autonomy preset controlling background learning/reflection defaults\n\tresearchLane?: ResearchLaneSettings; // Opt-in autonomous read-only research lane producing evidence bundles\n\tworkerDelegation?: WorkerDelegationSettings; // Bounded scout-worker delegation; enabled by default on capable models\n\tlearningPolicy?: LearningPolicySettings; // Opt-in learning apply policy: proposal-first durable writes with audit/rollback\n\tmodelCapability?: ModelCapabilitySettings; // Auto-detected small-model tool/lane surface (default: auto)\n\ttoolkit?: ToolkitSettings; // User's blessed daily-ops script registry for run_toolkit_script\n\tmodelRouter?: ModelRouterSettings; // Opt-in deterministic cheap/expensive model routing foundation\n\ttoolRepair?: ToolRepairSettings; // Tool-recovery logging plus teach and text-protocol switches\n\tfailover?: FailoverSettings; // Provider quota behavior; metered quota always halts for explicit user choice\n\tautoLearn?: AutoLearnSettings; // Setting-gated autonomous background learning for long sessions\n\tsessionDir?: string; // Custom session storage directory (same format as --session-dir CLI flag)\n\thttpIdleTimeoutMs?: number; // HTTP header/body idle timeout in ms; 0 disables it. Nonzero values constrain every stream-watchdog phase below this timeout\n\twebsocketConnectTimeoutMs?: number; // WebSocket connect/open handshake timeout in milliseconds; 0 disables it\n}\n\n/** Deep merge settings: project/overrides take precedence, nested objects merge recursively */\nfunction deepMergeSettings(base: Settings, overrides: Settings): Settings {\n\tconst result: Settings = { ...base };\n\n\tfor (const key of Object.keys(overrides) as (keyof Settings)[]) {\n\t\tconst overrideValue = overrides[key];\n\t\tconst baseValue = base[key];\n\n\t\tif (overrideValue === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// For nested objects, merge recursively\n\t\tif (\n\t\t\ttypeof overrideValue === \"object\" &&\n\t\t\toverrideValue !== null &&\n\t\t\t!Array.isArray(overrideValue) &&\n\t\t\ttypeof baseValue === \"object\" &&\n\t\t\tbaseValue !== null &&\n\t\t\t!Array.isArray(baseValue)\n\t\t) {\n\t\t\t(result as Record<string, unknown>)[key] = deepMergeSettings(baseValue as Settings, overrideValue as Settings);\n\t\t} else {\n\t\t\t// For primitives and arrays, override value wins\n\t\t\t(result as Record<string, unknown>)[key] = overrideValue;\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction toPosixPath(p: string): string {\n\treturn p.split(sep).join(\"/\");\n}\n\nfunction findDirectoryProfileRoot(cwd: string): string {\n\tlet current = resolvePath(cwd);\n\twhile (true) {\n\t\tfor (const marker of [\".git\", \".hg\", \".svn\"]) {\n\t\t\ttry {\n\t\t\t\tstatSync(join(current, marker));\n\t\t\t\treturn current;\n\t\t\t} catch {}\n\t\t}\n\t\tconst parent = resolve(current, \"..\");\n\t\tif (parent === current) return resolvePath(cwd);\n\t\tcurrent = parent;\n\t}\n}\n\nexport interface DirectoryResourceProfileInfo {\n\troot: string;\n\thash: string;\n\tpath: string;\n}\n\nexport function getDirectoryResourceProfileInfo(\n\tcwd: string,\n\tagentDir: string = getAgentDir(),\n): DirectoryResourceProfileInfo {\n\tconst root = findDirectoryProfileRoot(cwd);\n\tconst hash = createHash(\"sha256\").update(root).digest(\"hex\").slice(0, 16);\n\treturn {\n\t\troot,\n\t\thash,\n\t\tpath: join(resolvePath(agentDir), \"resource-profiles\", hash, \"settings.json\"),\n\t};\n}\n\nexport function matchesResourceProfilePattern(resourcePath: string, patterns: string[], baseDir = \"\"): boolean {\n\tif (patterns.length === 0) return false;\n\tconst resolvedBase = baseDir ? resolvePath(baseDir) : \"\";\n\tconst rel = resolvedBase ? toPosixPath(relative(resolvedBase, resourcePath)) : toPosixPath(resourcePath);\n\tconst name = basename(resourcePath);\n\tconst filePathPosix = toPosixPath(resourcePath);\n\tconst parentDir = dirname(resourcePath);\n\tconst parentRel = resolvedBase ? toPosixPath(relative(resolvedBase, parentDir)) : toPosixPath(parentDir);\n\tconst parentName = basename(parentDir);\n\tconst parentDirPosix = toPosixPath(parentDir);\n\n\treturn patterns.some((pattern) => {\n\t\tconst normalizedPattern = toPosixPath(pattern);\n\t\treturn (\n\t\t\tminimatch(rel, normalizedPattern) ||\n\t\t\tminimatch(name, normalizedPattern) ||\n\t\t\tminimatch(filePathPosix, normalizedPattern) ||\n\t\t\tminimatch(parentRel, normalizedPattern) ||\n\t\t\tminimatch(parentName, normalizedPattern) ||\n\t\t\tminimatch(parentDirPosix, normalizedPattern)\n\t\t);\n\t});\n}\n\nfunction normalizeResourceProfileNames(value: unknown): string[] {\n\tconst values: string[] = [];\n\tconst add = (candidate: unknown) => {\n\t\tif (Array.isArray(candidate)) {\n\t\t\tfor (const item of candidate) add(item);\n\t\t\treturn;\n\t\t}\n\t\tif (typeof candidate === \"string\") {\n\t\t\tfor (const part of candidate.split(\",\")) {\n\t\t\t\tconst trimmed = part.trim();\n\t\t\t\tif (trimmed) values.push(trimmed);\n\t\t\t}\n\t\t}\n\t};\n\tadd(value);\n\treturn [...new Set(values)];\n}\n\nfunction hasExplicitActiveResourceProfileSelection(settings: Settings): boolean {\n\treturn Object.hasOwn(settings, \"activeResourceProfiles\") || Object.hasOwn(settings, \"activeResourceProfile\");\n}\n\nfunction hasExplicitEmptyActiveResourceProfileSelection(settings: Settings): boolean {\n\treturn (\n\t\tObject.hasOwn(settings, \"activeResourceProfiles\") &&\n\t\tnormalizeResourceProfileNames(settings.activeResourceProfiles).length === 0\n\t);\n}\n\nfunction normalizeActiveResourceProfiles(settings: Settings): string[] {\n\t// The array form is canonical when present, including an explicit empty array. Falling through\n\t// from `activeResourceProfiles: []` to the scalar alias would resurrect a lower-precedence or\n\t// legacy selection and makes it impossible to persist a durable \"none\" choice.\n\tconst values = Object.hasOwn(settings, \"activeResourceProfiles\")\n\t\t? normalizeResourceProfileNames(settings.activeResourceProfiles)\n\t\t: normalizeResourceProfileNames(settings.activeResourceProfile);\n\tif (\n\t\tvalues.length === 0 &&\n\t\t!hasExplicitActiveResourceProfileSelection(settings) &&\n\t\tsettings.resourceProfiles?.default\n\t) {\n\t\tvalues.push(\"default\");\n\t}\n\treturn [...new Set(values)];\n}\n\nfunction appendFilter(target: ResourceProfileFilterSettings, source?: ResourceProfileFilterSettings): void {\n\tif (!source) return;\n\tif (Array.isArray(source.allow)) target.allow = [...(target.allow ?? []), ...source.allow];\n\tif (Array.isArray(source.block)) target.block = [...(target.block ?? []), ...source.block];\n}\n\nfunction collectLegacyDisabledFilterFromSettings(\n\tsettings: Settings,\n\tkind: ResourceProfileKind,\n): ResourceProfileFilterSettings {\n\tconst legacyDisabled = settings.disabledResources?.[kind];\n\treturn Array.isArray(legacyDisabled) ? { block: legacyDisabled } : {};\n}\n\nfunction mergeResourceProfileFilters(...filters: ResourceProfileFilterSettings[]): ResourceProfileFilterSettings {\n\tconst result: ResourceProfileFilterSettings = {};\n\tfor (const filter of filters) appendFilter(result, filter);\n\treturn result;\n}\n\nfunction parseTimeoutSetting(value: unknown, settingName: string): number | undefined {\n\tconst timeoutMs = parseHttpIdleTimeoutMs(value);\n\tif (timeoutMs !== undefined) {\n\t\treturn timeoutMs;\n\t}\n\tif (value !== undefined) {\n\t\tthrow new Error(`Invalid ${settingName} setting: ${String(value)}`);\n\t}\n\treturn undefined;\n}\n\n/** Stall bounds must be strictly positive — 0 is not \"disabled\" here (it would stall instantly). */\nfunction parseStallBoundMs(value: unknown, settingName: string): number | undefined {\n\tif (value === undefined) return undefined;\n\tif (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) {\n\t\tthrow new Error(`Invalid ${settingName} setting: ${String(value)}`);\n\t}\n\treturn Math.floor(value);\n}\n\nfunction sanitizeIntegerSetting(value: unknown, fallback: number, min: number, max: number): number {\n\tif (typeof value !== \"number\" || !Number.isInteger(value)) return fallback;\n\tif (value < min || value > max) return fallback;\n\treturn value;\n}\n\nfunction sanitizeNumberSetting(value: unknown, fallback: number, min: number, max: number): number {\n\tif (typeof value !== \"number\" || !Number.isFinite(value)) return fallback;\n\tif (value < min || value > max) return fallback;\n\treturn value;\n}\n\nexport type ThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\" | \"ultra\";\n\nexport interface ProfileDefinitionInput {\n\tname?: string;\n\tdescription?: string;\n\tmodel?: string;\n\tthinking?: ThinkingLevel;\n\tmodelRouter?: ModelRouterSettings;\n\t/**\n\t * Situational identity (R6): a system-prompt prefix injected while this profile is active, so a\n\t * profile becomes a full \"situation\" = soul + capabilities + model/thinking, switched atomically.\n\t */\n\tsoul?: string;\n\tresources: ResourceProfileSettings;\n}\n\nexport type ProfilePersistenceScope = \"session\" | \"directory\" | \"project\" | \"global\" | \"reusable-file\";\n\nconst VALID_THINKING_LEVELS = [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\", \"ultra\"] as const;\nfunction isThinkingLevel(value: unknown): value is ThinkingLevel {\n\treturn typeof value === \"string\" && VALID_THINKING_LEVELS.includes(value as ThinkingLevel);\n}\n\nfunction asStringArrayWithPattern(value: unknown): string[] | undefined {\n\tif (!Array.isArray(value)) return undefined;\n\tconst values = value.filter((item): item is string => typeof item === \"string\" && item.trim().length > 0);\n\treturn values.length > 0 ? values : undefined;\n}\n\nfunction normalizeProfileFilterResource(value: unknown): ResourceProfileFilterSettings {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(\"resource profile filter must be an object\");\n\t}\n\tconst filter = value as Record<string, unknown>;\n\treturn {\n\t\tallow: asStringArrayWithPattern(filter.allow),\n\t\tblock: asStringArrayWithPattern(filter.block),\n\t};\n}\n\nfunction normalizeProfileResources(value: unknown): ResourceProfileSettings {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(\"resources must be an object\");\n\t}\n\tconst input = value as Record<string, unknown>;\n\tconst result: ResourceProfileSettings = {};\n\tfor (const kind of [\"extensions\", \"skills\", \"prompts\", \"themes\", \"agents\", \"tools\"] as const) {\n\t\tif (input[kind] === undefined) continue;\n\t\tresult[kind] = normalizeProfileFilterResource(input[kind]);\n\t}\n\treturn result;\n}\n\nfunction normalizeModelRouterSettings(value: unknown): ModelRouterSettings | undefined {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return undefined;\n\tconst input = value as Record<string, unknown>;\n\tconst settings: ModelRouterSettings = {};\n\tfor (const key of [\"enabled\", \"judgeEnabled\", \"fitnessGate\"] as const) {\n\t\tif (typeof input[key] === \"boolean\") settings[key] = input[key];\n\t}\n\tfor (const key of [\n\t\t\"cheapModel\",\n\t\t\"mediumModel\",\n\t\t\"expensiveModel\",\n\t\t\"learningModel\",\n\t\t\"judgeModel\",\n\t\t\"executorModel\",\n\t] as const) {\n\t\tconst candidate = input[key];\n\t\tif (typeof candidate !== \"string\") continue;\n\t\tconst trimmed = candidate.trim();\n\t\tif (trimmed) settings[key] = trimmed;\n\t}\n\tfor (const key of [\n\t\t\"cheapThinking\",\n\t\t\"mediumThinking\",\n\t\t\"expensiveThinking\",\n\t\t\"executorThinking\",\n\t\t\"judgeThinking\",\n\t] as const) {\n\t\tconst candidate = input[key];\n\t\tif (isThinkingLevel(candidate)) settings[key] = candidate;\n\t}\n\treturn Object.keys(settings).length > 0 ? settings : undefined;\n}\n\nfunction parseProfileFileDefinition(content: string, fallbackName?: string): ProfileDefinitionInput {\n\tconst parsed = JSON.parse(content) as Record<string, unknown>;\n\tif (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n\t\tthrow new Error(\"profile file must contain a JSON object\");\n\t}\n\tconst name = (typeof parsed.name === \"string\" ? parsed.name.trim() : undefined) || fallbackName;\n\tif (!name) {\n\t\tthrow new Error(\"profile name is required\");\n\t}\n\tconst resourceSection = parsed.resources ?? {};\n\treturn {\n\t\tname,\n\t\tdescription: typeof parsed.description === \"string\" ? parsed.description.trim() || undefined : undefined,\n\t\tmodel: typeof parsed.model === \"string\" ? parsed.model.trim() || undefined : undefined,\n\t\tthinking: isThinkingLevel(parsed.thinking) ? parsed.thinking : undefined,\n\t\tmodelRouter: normalizeModelRouterSettings(parsed.modelRouter),\n\t\tsoul: typeof parsed.soul === \"string\" ? parsed.soul.trim() || undefined : undefined,\n\t\tresources: normalizeProfileResources(resourceSection),\n\t};\n}\n\nexport type SettingsScope = \"global\" | \"project\" | \"directoryProfile\";\nexport type SettingsErrorScope = SettingsScope;\n\nexport interface SettingsManagerCreateOptions {\n\tprojectTrusted?: boolean;\n}\n\nexport interface SettingsStorage {\n\twithLock(scope: SettingsScope, fn: (current: string | undefined) => string | undefined): void;\n\tgetProfilesDir?(): string;\n\t/** Base directory used to resolve explicit ./ or ../ profile references. */\n\tgetProfileResolutionBaseDir?(): string;\n}\n\nexport interface SettingsError {\n\tscope: SettingsErrorScope;\n\terror: Error;\n}\n\n/** In-memory settings generation captured around an atomic runtime reload. */\nexport interface SettingsReloadSnapshot {\n\tglobalSettings: Settings;\n\tprojectSettings: Settings;\n\tdirectoryProfileSettings: Settings;\n\truntimeResourceProfiles: string[] | undefined;\n\tinlineResourceProfileDefinitions: Record<string, ProfileDefinitionInput>;\n\tdiscoveredResourceProfileDefinitions: Record<string, ResourceProfileSettings>;\n\teffectiveSettings: Settings;\n\tprojectTrusted: boolean;\n\tmodifiedFields: Set<keyof Settings>;\n\tmodifiedNestedFields: Map<keyof Settings, Set<string>>;\n\tmodifiedProjectFields: Set<keyof Settings>;\n\tmodifiedProjectNestedFields: Map<keyof Settings, Set<string>>;\n\tglobalSettingsLoadError: Error | null;\n\tprojectSettingsLoadError: Error | null;\n\tdirectoryProfileInfo: DirectoryResourceProfileInfo | null;\n\terrors: SettingsError[];\n}\n\nexport interface GlobalResourceProfileConfiguration {\n\tresourceProfiles?: Settings[\"resourceProfiles\"];\n\tactiveResourceProfile?: Settings[\"activeResourceProfile\"];\n\tactiveResourceProfiles?: Settings[\"activeResourceProfiles\"];\n\texternalResourceRoots?: string[];\n\ttrustedResourceRoots?: string[];\n}\n\nexport class FileSettingsStorage implements SettingsStorage {\n\tprivate profileResolutionBaseDir: string;\n\tprivate globalSettingsPath: string;\n\tprivate projectSettingsPath: string;\n\tprivate directoryProfileInfo: DirectoryResourceProfileInfo;\n\tprivate profilesDir: string;\n\n\tconstructor(cwd: string, agentDir: string) {\n\t\tconst resolvedCwd = resolvePath(cwd);\n\t\tconst resolvedAgentDir = resolvePath(agentDir);\n\t\tthis.profileResolutionBaseDir = resolvedCwd;\n\t\tthis.globalSettingsPath = join(resolvedAgentDir, \"settings.json\");\n\t\tthis.projectSettingsPath = join(resolvedCwd, CONFIG_DIR_NAME, \"settings.json\");\n\t\tthis.directoryProfileInfo = getDirectoryResourceProfileInfo(resolvedCwd, resolvedAgentDir);\n\t\tthis.profilesDir = getProfilesDir(resolvedAgentDir);\n\t}\n\n\tgetDirectoryResourceProfileInfo(): DirectoryResourceProfileInfo {\n\t\treturn { ...this.directoryProfileInfo };\n\t}\n\n\tgetProfilesDir(): string {\n\t\treturn this.profilesDir;\n\t}\n\n\tgetProfileResolutionBaseDir(): string {\n\t\treturn this.profileResolutionBaseDir;\n\t}\n\n\treadDirectoryResourceProfile(): string | undefined {\n\t\tconst path = this.directoryProfileInfo.path;\n\t\treturn existsSync(path) ? readFileSync(path, \"utf-8\") : undefined;\n\t}\n\n\tprivate acquireLockSyncWithRetry(path: string): () => void {\n\t\tconst maxAttempts = 10;\n\t\tconst delayMs = 20;\n\t\tlet lastError: unknown;\n\n\t\tfor (let attempt = 1; attempt <= maxAttempts; attempt++) {\n\t\t\ttry {\n\t\t\t\treturn lockfile.lockSync(path, { realpath: false });\n\t\t\t} catch (error) {\n\t\t\t\tconst code =\n\t\t\t\t\ttypeof error === \"object\" && error !== null && \"code\" in error\n\t\t\t\t\t\t? String((error as { code?: unknown }).code)\n\t\t\t\t\t\t: undefined;\n\t\t\t\tif (code !== \"ELOCKED\" || attempt === maxAttempts) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tlastError = error;\n\t\t\t\tconst start = Date.now();\n\t\t\t\twhile (Date.now() - start < delayMs) {\n\t\t\t\t\t// Sleep synchronously to avoid changing callers to async.\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthrow (lastError as Error) ?? new Error(\"Failed to acquire settings lock\");\n\t}\n\n\twithLock(scope: SettingsScope, fn: (current: string | undefined) => string | undefined): void {\n\t\tconst path =\n\t\t\tscope === \"global\"\n\t\t\t\t? this.globalSettingsPath\n\t\t\t\t: scope === \"project\"\n\t\t\t\t\t? this.projectSettingsPath\n\t\t\t\t\t: this.directoryProfileInfo.path;\n\t\tconst dir = dirname(path);\n\n\t\tlet release: (() => void) | undefined;\n\t\ttry {\n\t\t\t// Only create directory and lock if file exists or we need to write\n\t\t\tconst fileExists = existsSync(path);\n\t\t\tif (fileExists) {\n\t\t\t\trelease = this.acquireLockSyncWithRetry(path);\n\t\t\t}\n\t\t\tconst current = fileExists ? readFileSync(path, \"utf-8\") : undefined;\n\t\t\tconst next = fn(current);\n\t\t\tif (next !== undefined) {\n\t\t\t\t// Only create directory when we actually need to write\n\t\t\t\tif (!existsSync(dir)) {\n\t\t\t\t\tmkdirSync(dir, { recursive: true });\n\t\t\t\t}\n\t\t\t\tif (!release) {\n\t\t\t\t\trelease = this.acquireLockSyncWithRetry(path);\n\t\t\t\t}\n\t\t\t\twriteFileSync(path, next, \"utf-8\");\n\t\t\t}\n\t\t} finally {\n\t\t\tif (release) {\n\t\t\t\trelease();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport class InMemorySettingsStorage implements SettingsStorage {\n\tprivate global: string | undefined;\n\tprivate project: string | undefined;\n\tprivate directoryProfile: string | undefined;\n\n\twithLock(scope: SettingsScope, fn: (current: string | undefined) => string | undefined): void {\n\t\tconst current = scope === \"global\" ? this.global : scope === \"project\" ? this.project : this.directoryProfile;\n\t\tconst next = fn(current);\n\t\tif (next === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tif (scope === \"global\") {\n\t\t\tthis.global = next;\n\t\t\treturn;\n\t\t}\n\t\tif (scope === \"project\") {\n\t\t\tthis.project = next;\n\t\t\treturn;\n\t\t}\n\t\tthis.directoryProfile = next;\n\t}\n}\n\nexport class SettingsManager {\n\tprivate storage: SettingsStorage;\n\tprivate globalSettings: Settings;\n\tprivate projectSettings: Settings;\n\tprivate directoryProfileSettings: Settings;\n\tprivate runtimeResourceProfiles: string[] | undefined;\n\tprivate inlineResourceProfileDefinitions: Record<string, ProfileDefinitionInput> = {};\n\tprivate discoveredResourceProfileDefinitions: Record<string, ResourceProfileSettings> = {};\n\tsettings: Settings;\n\tprivate projectTrusted: boolean;\n\tprivate modifiedFields = new Set<keyof Settings>(); // Track global fields modified during session\n\tprivate modifiedNestedFields = new Map<keyof Settings, Set<string>>(); // Track global nested field modifications\n\tprivate modifiedProjectFields = new Set<keyof Settings>(); // Track project fields modified during session\n\tprivate modifiedProjectNestedFields = new Map<keyof Settings, Set<string>>(); // Track project nested field modifications\n\tprivate globalSettingsLoadError: Error | null = null; // Track if global settings file had parse errors\n\tprivate projectSettingsLoadError: Error | null = null; // Track if project settings file had parse errors\n\tprivate directoryProfileInfo: DirectoryResourceProfileInfo | null = null;\n\tprivate profileRegistry!: ProfileRegistry;\n\tprivate writeQueue: Promise<void> = Promise.resolve();\n\tprivate errors: SettingsError[];\n\n\tprivate constructor(\n\t\tstorage: SettingsStorage,\n\t\tinitialGlobal: Settings,\n\t\tinitialProject: Settings,\n\t\tinitialDirectoryProfile: Settings = {},\n\t\tglobalLoadError: Error | null = null,\n\t\tprojectLoadError: Error | null = null,\n\t\tinitialErrors: SettingsError[] = [],\n\t\tprojectTrusted = true,\n\t\tdirectoryProfileInfo: DirectoryResourceProfileInfo | null = null,\n\t) {\n\t\tthis.storage = storage;\n\t\tthis.globalSettings = initialGlobal;\n\t\tthis.projectSettings = initialProject;\n\t\tthis.directoryProfileSettings = initialDirectoryProfile;\n\t\tthis.projectTrusted = projectTrusted;\n\t\tthis.globalSettingsLoadError = globalLoadError;\n\t\tthis.projectSettingsLoadError = projectLoadError;\n\t\tthis.directoryProfileInfo = directoryProfileInfo;\n\t\tthis.errors = [...initialErrors];\n\t\tthis.settings = this.mergeEffectiveSettings();\n\t\tthis.refreshProfileRegistry();\n\t}\n\n\tprivate createProfileRegistry(): ProfileRegistry {\n\t\treturn new ProfileRegistry({\n\t\t\tglobalSettings: this.globalSettings,\n\t\t\tprojectSettings: this.projectSettings,\n\t\t\tdirectoryProfileSettings: this.directoryProfileSettings,\n\t\t\tinlineResourceProfileDefinitions: this.inlineResourceProfileDefinitions,\n\t\t\tdiscoveredResourceProfileDefinitions: this.discoveredResourceProfileDefinitions,\n\t\t\tprofilesDir: this.storage.getProfilesDir?.(),\n\t\t\texternalResourceRoots: this.getEffectiveExternalResourceRoots(),\n\t\t});\n\t}\n\n\tprivate profileDiagnosticKeys = new Set<string>();\n\tprivate reportProfileDiagnostic(scope: SettingsErrorScope, message: string): void {\n\t\tconst key = `${scope}:${message}`;\n\t\tif (this.profileDiagnosticKeys.has(key)) {\n\t\t\treturn;\n\t\t}\n\t\tthis.profileDiagnosticKeys.add(key);\n\t\tthis.errors.push({ scope, error: new Error(message) });\n\t}\n\n\tprivate getActiveProfileNamesForDiagnostics(): string[] {\n\t\t// Mirror getActiveResourceProfileNames()'s source precedence (runtime profiles from\n\t\t// --resource-profile take priority) so a bad runtime profile name still surfaces a\n\t\t// \"profile not found\" diagnostic instead of silently applying zero filtering.\n\t\tif (this.runtimeResourceProfiles !== undefined) {\n\t\t\treturn normalizeResourceProfileNames(this.runtimeResourceProfiles);\n\t\t}\n\t\t// `/profiles none` is persisted globally as an explicit empty array. It is a durable\n\t\t// user-level off switch and must dominate project/directory/default/external fallbacks until\n\t\t// the user explicitly selects another profile.\n\t\tif (hasExplicitEmptyActiveResourceProfileSelection(this.globalSettings)) {\n\t\t\treturn [];\n\t\t}\n\t\tconst explicitProfiles =\n\t\t\tthis.settings.activeResourceProfiles && this.settings.activeResourceProfiles.length > 0\n\t\t\t\t? this.settings.activeResourceProfiles\n\t\t\t\t: this.settings.activeResourceProfile\n\t\t\t\t\t? [this.settings.activeResourceProfile]\n\t\t\t\t\t: [];\n\t\tconst names = normalizeResourceProfileNames(explicitProfiles);\n\t\treturn names.length > 0 || hasExplicitActiveResourceProfileSelection(this.settings)\n\t\t\t? names\n\t\t\t: this.getExternalRootActiveResourceProfileNames();\n\t}\n\n\tprivate getExternalRootActiveResourceProfileNames(): string[] {\n\t\tconst names: string[] = [];\n\t\tfor (const root of this.getEffectiveExternalResourceRoots()) {\n\t\t\ttry {\n\t\t\t\tconst settingsPath = join(root, \"settings.json\");\n\t\t\t\tif (!existsSync(settingsPath)) continue;\n\t\t\t\tconst parsed = JSON.parse(readFileSync(settingsPath, \"utf-8\")) as Settings;\n\t\t\t\tnames.push(...normalizeActiveResourceProfiles(parsed));\n\t\t\t} catch {\n\t\t\t\t// External-root settings are optional; ignore malformed files for active-profile fallback.\n\t\t\t}\n\t\t}\n\t\treturn [...new Set(names)];\n\t}\n\n\tprivate refreshProfileRegistry(): void {\n\t\tthis.profileDiagnosticKeys.clear();\n\t\tthis.profileRegistry = this.createProfileRegistry();\n\t\tconst registryDiagnostics = this.profileRegistry.listDiagnostics();\n\t\tfor (const diagnostic of registryDiagnostics) {\n\t\t\tconst path = diagnostic.path ? ` (${diagnostic.path})` : \"\";\n\t\t\tthis.reportProfileDiagnostic(\"global\", `Profile diagnostic${path}: ${diagnostic.message}`);\n\t\t}\n\t\tfor (const profileName of this.getActiveProfileNamesForDiagnostics()) {\n\t\t\tif (!this.resolveProfileFromRegistry(this.profileRegistry, profileName)) {\n\t\t\t\tthis.reportProfileDiagnostic(\"global\", `Active profile not found: ${profileName}`);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate resolveProfileFromRegistry(registry: ProfileRegistry, profileRef: string) {\n\t\treturn profileRef.startsWith(\"./\") || profileRef.startsWith(\"../\")\n\t\t\t? registry.resolveProfileRef(profileRef, this.storage.getProfileResolutionBaseDir?.() ?? process.cwd())\n\t\t\t: registry.getProfile(profileRef);\n\t}\n\n\tprivate mergeEffectiveSettings(): Settings {\n\t\tlet merged = deepMergeSettings(this.globalSettings, this.projectSettings);\n\t\tmerged = deepMergeSettings(merged, this.directoryProfileSettings);\n\t\tif (this.runtimeResourceProfiles !== undefined) {\n\t\t\tmerged = deepMergeSettings(merged, {\n\t\t\t\tactiveResourceProfile: this.runtimeResourceProfiles,\n\t\t\t\tactiveResourceProfiles: this.runtimeResourceProfiles,\n\t\t\t});\n\t\t}\n\t\treturn merged;\n\t}\n\n\tprivate recomputeSettings(): void {\n\t\tthis.settings = this.mergeEffectiveSettings();\n\t\tthis.refreshProfileRegistry();\n\t}\n\n\t/** Create a SettingsManager that loads from files */\n\tstatic create(\n\t\tcwd: string,\n\t\tagentDir: string = getAgentDir(),\n\t\toptions: SettingsManagerCreateOptions = {},\n\t): SettingsManager {\n\t\tconst storage = new FileSettingsStorage(cwd, agentDir);\n\t\treturn SettingsManager.fromStorage(storage, options);\n\t}\n\n\t/** Create a SettingsManager from an arbitrary storage backend */\n\tstatic fromStorage(storage: SettingsStorage, options: SettingsManagerCreateOptions = {}): SettingsManager {\n\t\tconst projectTrusted = options.projectTrusted ?? true;\n\t\tconst globalLoad = SettingsManager.tryLoadFromStorage(storage, \"global\");\n\t\tconst projectLoad = SettingsManager.tryLoadFromStorage(storage, \"project\", projectTrusted);\n\t\tconst directoryProfileLoad = SettingsManager.tryLoadDirectoryProfileFromStorage(storage);\n\t\tconst initialErrors: SettingsError[] = [];\n\t\tif (globalLoad.error) {\n\t\t\tinitialErrors.push({ scope: \"global\", error: globalLoad.error });\n\t\t}\n\t\tif (projectLoad.error) {\n\t\t\tinitialErrors.push({ scope: \"project\", error: projectLoad.error });\n\t\t}\n\t\tif (directoryProfileLoad.error) {\n\t\t\tinitialErrors.push({ scope: \"directoryProfile\", error: directoryProfileLoad.error });\n\t\t}\n\n\t\treturn new SettingsManager(\n\t\t\tstorage,\n\t\t\tglobalLoad.settings,\n\t\t\tprojectLoad.settings,\n\t\t\tdirectoryProfileLoad.settings,\n\t\t\tglobalLoad.error,\n\t\t\tprojectLoad.error,\n\t\t\tinitialErrors,\n\t\t\tprojectTrusted,\n\t\t\tdirectoryProfileLoad.info,\n\t\t);\n\t}\n\n\t/** Create an in-memory SettingsManager (no file I/O) */\n\tstatic inMemory(settings: Partial<Settings> = {}): SettingsManager {\n\t\tconst storage = new InMemorySettingsStorage();\n\t\tconst initialSettings = SettingsManager.migrateSettings(structuredClone(settings) as Record<string, unknown>);\n\t\tstorage.withLock(\"global\", () => JSON.stringify(initialSettings, null, 2));\n\t\treturn SettingsManager.fromStorage(storage);\n\t}\n\n\tprivate static loadFromStorage(storage: SettingsStorage, scope: SettingsScope, projectTrusted = true): Settings {\n\t\tif (scope === \"project\" && !projectTrusted) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet content: string | undefined;\n\t\tstorage.withLock(scope, (current) => {\n\t\t\tcontent = current;\n\t\t\treturn undefined;\n\t\t});\n\n\t\tif (!content) {\n\t\t\treturn {};\n\t\t}\n\t\tconst settings = JSON.parse(content);\n\t\treturn SettingsManager.migrateSettings(settings);\n\t}\n\n\tprivate static tryLoadFromStorage(\n\t\tstorage: SettingsStorage,\n\t\tscope: SettingsScope,\n\t\tprojectTrusted = true,\n\t): { settings: Settings; error: Error | null } {\n\t\ttry {\n\t\t\treturn { settings: SettingsManager.loadFromStorage(storage, scope, projectTrusted), error: null };\n\t\t} catch (error) {\n\t\t\treturn { settings: {}, error: error as Error };\n\t\t}\n\t}\n\n\tprivate static tryLoadDirectoryProfileFromStorage(storage: SettingsStorage): {\n\t\tsettings: Settings;\n\t\terror: Error | null;\n\t\tinfo: DirectoryResourceProfileInfo | null;\n\t} {\n\t\tif (!(storage instanceof FileSettingsStorage)) {\n\t\t\treturn { settings: {}, error: null, info: null };\n\t\t}\n\t\tconst info = storage.getDirectoryResourceProfileInfo();\n\t\ttry {\n\t\t\tconst content = storage.readDirectoryResourceProfile();\n\t\t\tif (!content) return { settings: {}, error: null, info };\n\t\t\tconst settings = JSON.parse(content);\n\t\t\treturn { settings: SettingsManager.migrateSettings(settings), error: null, info };\n\t\t} catch (error) {\n\t\t\treturn { settings: {}, error: error as Error, info };\n\t\t}\n\t}\n\n\t/** Migrate old settings format to new format */\n\tprivate static migrateSettings(settings: Record<string, unknown>): Settings {\n\t\t// Migrate queueMode -> steeringMode\n\t\tif (\"queueMode\" in settings && !(\"steeringMode\" in settings)) {\n\t\t\tsettings.steeringMode = settings.queueMode;\n\t\t\tdelete settings.queueMode;\n\t\t}\n\n\t\t// Migrate legacy websockets boolean -> transport enum\n\t\tif (!(\"transport\" in settings) && typeof settings.websockets === \"boolean\") {\n\t\t\tsettings.transport = settings.websockets ? \"websocket\" : \"sse\";\n\t\t\tdelete settings.websockets;\n\t\t}\n\n\t\t// Migrate old skills object format to new array format\n\t\tif (\n\t\t\t\"skills\" in settings &&\n\t\t\ttypeof settings.skills === \"object\" &&\n\t\t\tsettings.skills !== null &&\n\t\t\t!Array.isArray(settings.skills)\n\t\t) {\n\t\t\tconst skillsSettings = settings.skills as {\n\t\t\t\tenableSkillCommands?: boolean;\n\t\t\t\tcustomDirectories?: unknown;\n\t\t\t};\n\t\t\tif (skillsSettings.enableSkillCommands !== undefined && settings.enableSkillCommands === undefined) {\n\t\t\t\tsettings.enableSkillCommands = skillsSettings.enableSkillCommands;\n\t\t\t}\n\t\t\tif (Array.isArray(skillsSettings.customDirectories) && skillsSettings.customDirectories.length > 0) {\n\t\t\t\tsettings.skills = skillsSettings.customDirectories;\n\t\t\t} else {\n\t\t\t\tdelete settings.skills;\n\t\t\t}\n\t\t}\n\n\t\t// Migrate retry.maxDelayMs -> retry.provider.maxRetryDelayMs\n\t\tif (\n\t\t\t\"retry\" in settings &&\n\t\t\ttypeof settings.retry === \"object\" &&\n\t\t\tsettings.retry !== null &&\n\t\t\t!Array.isArray(settings.retry)\n\t\t) {\n\t\t\tconst retrySettings = settings.retry as Record<string, unknown>;\n\t\t\tconst providerSettings =\n\t\t\t\ttypeof retrySettings.provider === \"object\" && retrySettings.provider !== null\n\t\t\t\t\t? (retrySettings.provider as Record<string, unknown>)\n\t\t\t\t\t: undefined;\n\t\t\tif (\n\t\t\t\ttypeof retrySettings.maxDelayMs === \"number\" &&\n\t\t\t\t(providerSettings?.maxRetryDelayMs === undefined || providerSettings?.maxRetryDelayMs === null)\n\t\t\t) {\n\t\t\t\tretrySettings.provider = {\n\t\t\t\t\t...(providerSettings ?? {}),\n\t\t\t\t\tmaxRetryDelayMs: retrySettings.maxDelayMs,\n\t\t\t\t};\n\t\t\t}\n\t\t\tdelete retrySettings.maxDelayMs;\n\t\t}\n\n\t\treturn settings as Settings;\n\t}\n\n\tgetGlobalSettings(): Settings {\n\t\treturn structuredClone(this.globalSettings);\n\t}\n\n\tgetProjectSettings(): Settings {\n\t\treturn structuredClone(this.projectSettings);\n\t}\n\n\tgetDirectoryResourceProfileSettings(): Settings {\n\t\treturn structuredClone(this.directoryProfileSettings);\n\t}\n\n\tgetDirectoryResourceProfileInfo(): DirectoryResourceProfileInfo | null {\n\t\treturn this.directoryProfileInfo ? { ...this.directoryProfileInfo } : null;\n\t}\n\n\tgetProfileRegistry(): ProfileRegistry {\n\t\tthis.refreshProfileRegistry();\n\t\treturn this.profileRegistry;\n\t}\n\n\tgetActiveResourceProfileNames(): string[] {\n\t\tif (this.runtimeResourceProfiles !== undefined) {\n\t\t\treturn [...this.runtimeResourceProfiles];\n\t\t}\n\t\tif (hasExplicitEmptyActiveResourceProfileSelection(this.globalSettings)) {\n\t\t\treturn [];\n\t\t}\n\t\tconst names = normalizeActiveResourceProfiles(this.settings);\n\t\treturn names.length > 0 || hasExplicitActiveResourceProfileSelection(this.settings)\n\t\t\t? names\n\t\t\t: this.getExternalRootActiveResourceProfileNames();\n\t}\n\n\thasExplicitActiveResourceProfileSelection(): boolean {\n\t\t// An explicit empty runtime/settings selection means \"no profile\", not an invalid profile\n\t\t// whose authority should collapse to deny-all. Non-empty unresolved refs remain explicit and\n\t\t// are diagnosed/strictly denied through the normal active-profile path.\n\t\treturn this.getActiveResourceProfileNames().length > 0;\n\t}\n\n\t/**\n\t * Aggregate ONLY the active profiles' contribution to a resource kind's filter — the user's own\n\t * legacy `disabledResources` list is not merged in. Includes the strict-UAC deny-all (an\n\t * authority-bearing kind no active profile mentions is denied outright); that denial is\n\t * profile-driven too. Shared by `getResourceProfileFilter` (which merges the legacy disable list\n\t * on top) and `isResourceDeniedByActiveProfile` (which must attribute a denial to the profile\n\t * ALONE — a user-only disable must never be reported as \"withheld by the active resource\n\t * profile\").\n\t */\n\tprivate computeProfileOnlyResourceFilter(kind: ResourceProfileKind): Required<ResourceProfileFilterSettings> {\n\t\tconst profileFilter: ResourceProfileFilterSettings = {};\n\t\tconst seenProfiles = new Set<string>();\n\t\tconst registry = this.getProfileRegistry();\n\t\tconst activeProfileNames = this.getActiveResourceProfileNames();\n\t\tlet kindMentionedByProfile = false;\n\t\tfor (const profileName of activeProfileNames) {\n\t\t\tif (seenProfiles.has(profileName)) continue;\n\t\t\tseenProfiles.add(profileName);\n\t\t\tconst kindFilter = this.resolveProfileFromRegistry(registry, profileName)?.resources[kind];\n\t\t\tif (kindFilter && ((kindFilter.allow?.length ?? 0) > 0 || (kindFilter.block?.length ?? 0) > 0)) {\n\t\t\t\tkindMentionedByProfile = true;\n\t\t\t}\n\t\t\tappendFilter(profileFilter, kindFilter);\n\t\t}\n\n\t\t// Strict UAC: an active profile set is the COMPLETE grant. An authority-bearing kind that no\n\t\t// active profile explicitly mentions is denied outright — grant-all must be said out loud\n\t\t// via `allow: [\"*\"]`. Themes are exempt (cosmetic, no authority). With no active profile,\n\t\t// behavior is unchanged: profiles are the opt-in least-privilege boundary.\n\t\tif (activeProfileNames.length > 0 && kind !== \"themes\" && !kindMentionedByProfile) {\n\t\t\treturn { allow: [], block: [\"*\"] };\n\t\t}\n\n\t\treturn {\n\t\t\tallow: [...new Set(profileFilter.allow ?? [])],\n\t\t\tblock: [...new Set(profileFilter.block ?? [])],\n\t\t};\n\t}\n\n\tgetResourceProfileFilter(kind: ResourceProfileKind): Required<ResourceProfileFilterSettings> {\n\t\tconst legacyFilter = mergeResourceProfileFilters(\n\t\t\tcollectLegacyDisabledFilterFromSettings(this.globalSettings, kind),\n\t\t\tcollectLegacyDisabledFilterFromSettings(this.projectSettings, kind),\n\t\t\tcollectLegacyDisabledFilterFromSettings(this.directoryProfileSettings, kind),\n\t\t);\n\t\tconst filter = mergeResourceProfileFilters(legacyFilter, this.computeProfileOnlyResourceFilter(kind));\n\t\treturn {\n\t\t\tallow: [...new Set(filter.allow ?? [])],\n\t\t\tblock: [...new Set(filter.block ?? [])],\n\t\t};\n\t}\n\n\t/**\n\t * Profile grants the user's own disable list overrides. RATIFIED precedence: a user disable\n\t * (`disabledResources` / `!` overrides) is a hard off-switch that always WINS over a profile\n\t * allow (the legacy disabled filter merges into every profile filter as a block, and blocks\n\t * beat allows). This helper only SURFACES the conflict so a granted-but-disabled resource\n\t * doesn't look like a broken grant.\n\t */\n\tgetProfileGrantsOverriddenByUserDisable(kind: ResourceProfileKind): string[] {\n\t\tconst disabled = this.settings.disabledResources?.[kind] ?? [];\n\t\tif (!Array.isArray(disabled) || disabled.length === 0) return [];\n\t\tconst registry = this.getProfileRegistry();\n\t\tconst conflicts = new Set<string>();\n\t\tfor (const profileName of this.getActiveResourceProfileNames()) {\n\t\t\tconst filter = this.resolveProfileFromRegistry(registry, profileName)?.resources[kind];\n\t\t\tfor (const allowEntry of filter?.allow ?? []) {\n\t\t\t\tif (allowEntry === \"*\") continue;\n\t\t\t\tif (disabled.includes(allowEntry) || matchesResourceProfilePattern(allowEntry, disabled)) {\n\t\t\t\t\tconflicts.add(allowEntry);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn [...conflicts];\n\t}\n\n\tisResourceAllowedByProfile(kind: ResourceProfileKind, resourcePath: string, baseDir = \"\"): boolean {\n\t\tconst filter = this.getResourceProfileFilter(kind);\n\t\tif (filter.allow.length > 0 && !matchesResourceProfilePattern(resourcePath, filter.allow, baseDir)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (matchesResourceProfilePattern(resourcePath, filter.block, baseDir)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * Whether the ACTIVE PROFILE alone denies this resource — the user's own legacy\n\t * `disabledResources` list is ignored. A \"withheld by the active resource profile\" report must\n\t * use this, not `isResourceAllowedByProfile`: that check merges the user's own disables in, so a\n\t * plain user-disabled resource (no profile even mentioning it) would otherwise be misattributed\n\t * to the profile.\n\t */\n\tisResourceDeniedByActiveProfile(kind: ResourceProfileKind, resourcePath: string, baseDir = \"\"): boolean {\n\t\tif (this.getActiveResourceProfileNames().length === 0) return false;\n\t\tconst filter = this.computeProfileOnlyResourceFilter(kind);\n\t\tif (filter.allow.length > 0 && !matchesResourceProfilePattern(resourcePath, filter.allow, baseDir)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn matchesResourceProfilePattern(resourcePath, filter.block, baseDir);\n\t}\n\n\t/**\n\t * Situational soul(s) of the currently active profile(s) (R6): a system-prompt identity prefix\n\t * injected while the profile is active. Multiple active profiles' souls are concatenated.\n\t */\n\tgetActiveProfileSoul(): string | undefined {\n\t\t// First-wins precedence (like profile model/thinking): the most-specific active profile's soul\n\t\t// is the identity — concatenating multiple souls would inject contradictory identities (Bug #16).\n\t\tconst registry = this.getProfileRegistry();\n\t\tconst seen = new Set<string>();\n\t\tfor (const profileName of this.getActiveResourceProfileNames()) {\n\t\t\tif (seen.has(profileName)) continue;\n\t\t\tseen.add(profileName);\n\t\t\tconst soul = this.resolveProfileFromRegistry(registry, profileName)?.soul?.trim();\n\t\t\tif (soul) return soul;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tisProjectTrusted(): boolean {\n\t\treturn this.projectTrusted;\n\t}\n\n\tsetProjectTrusted(trusted: boolean): void {\n\t\tif (this.projectTrusted === trusted) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.projectTrusted = trusted;\n\t\tthis.modifiedProjectFields.clear();\n\t\tthis.modifiedProjectNestedFields.clear();\n\n\t\tif (!trusted) {\n\t\t\tthis.projectSettings = {};\n\t\t\tthis.projectSettingsLoadError = null;\n\t\t\tthis.recomputeSettings();\n\t\t\treturn;\n\t\t}\n\n\t\tconst projectLoad = SettingsManager.tryLoadFromStorage(this.storage, \"project\", trusted);\n\t\tthis.projectSettings = projectLoad.settings;\n\t\tthis.projectSettingsLoadError = projectLoad.error;\n\t\tif (projectLoad.error) {\n\t\t\tthis.recordError(\"project\", projectLoad.error);\n\t\t}\n\t\tthis.recomputeSettings();\n\t}\n\n\tasync reload(): Promise<void> {\n\t\tawait this.writeQueue;\n\t\tconst globalLoad = SettingsManager.tryLoadFromStorage(this.storage, \"global\");\n\t\tif (!globalLoad.error) {\n\t\t\tthis.globalSettings = globalLoad.settings;\n\t\t\tthis.globalSettingsLoadError = null;\n\t\t} else {\n\t\t\tthis.globalSettingsLoadError = globalLoad.error;\n\t\t\tthis.recordError(\"global\", globalLoad.error);\n\t\t}\n\n\t\tthis.modifiedFields.clear();\n\t\tthis.modifiedNestedFields.clear();\n\t\tthis.modifiedProjectFields.clear();\n\t\tthis.modifiedProjectNestedFields.clear();\n\n\t\tconst projectLoad = SettingsManager.tryLoadFromStorage(this.storage, \"project\", this.projectTrusted);\n\t\tif (!projectLoad.error) {\n\t\t\tthis.projectSettings = projectLoad.settings;\n\t\t\tthis.projectSettingsLoadError = null;\n\t\t} else {\n\t\t\tthis.projectSettingsLoadError = projectLoad.error;\n\t\t\tthis.recordError(\"project\", projectLoad.error);\n\t\t}\n\n\t\tconst directoryProfileLoad = SettingsManager.tryLoadDirectoryProfileFromStorage(this.storage);\n\t\tthis.directoryProfileInfo = directoryProfileLoad.info;\n\t\tif (!directoryProfileLoad.error) {\n\t\t\tthis.directoryProfileSettings = directoryProfileLoad.settings;\n\t\t} else {\n\t\t\tthis.recordError(\"directoryProfile\", directoryProfileLoad.error);\n\t\t}\n\n\t\tthis.recomputeSettings();\n\t}\n\n\t/** Capture the complete in-memory settings generation before runtime reload mutates it. */\n\tcreateReloadSnapshot(): SettingsReloadSnapshot {\n\t\treturn {\n\t\t\tglobalSettings: structuredClone(this.globalSettings),\n\t\t\tprojectSettings: structuredClone(this.projectSettings),\n\t\t\tdirectoryProfileSettings: structuredClone(this.directoryProfileSettings),\n\t\t\truntimeResourceProfiles:\n\t\t\t\tthis.runtimeResourceProfiles === undefined ? undefined : [...this.runtimeResourceProfiles],\n\t\t\tinlineResourceProfileDefinitions: structuredClone(this.inlineResourceProfileDefinitions),\n\t\t\tdiscoveredResourceProfileDefinitions: structuredClone(this.discoveredResourceProfileDefinitions),\n\t\t\teffectiveSettings: structuredClone(this.settings),\n\t\t\tprojectTrusted: this.projectTrusted,\n\t\t\tmodifiedFields: new Set(this.modifiedFields),\n\t\t\tmodifiedNestedFields: this.cloneModifiedNestedFields(this.modifiedNestedFields),\n\t\t\tmodifiedProjectFields: new Set(this.modifiedProjectFields),\n\t\t\tmodifiedProjectNestedFields: this.cloneModifiedNestedFields(this.modifiedProjectNestedFields),\n\t\t\tglobalSettingsLoadError: this.globalSettingsLoadError,\n\t\t\tprojectSettingsLoadError: this.projectSettingsLoadError,\n\t\t\tdirectoryProfileInfo: this.directoryProfileInfo ? { ...this.directoryProfileInfo } : null,\n\t\t\terrors: [...this.errors],\n\t\t};\n\t}\n\n\t/** Restore a failed runtime reload without changing the on-disk settings generation. */\n\trestoreReloadSnapshot(snapshot: SettingsReloadSnapshot): void {\n\t\tthis.globalSettings = structuredClone(snapshot.globalSettings);\n\t\tthis.projectSettings = structuredClone(snapshot.projectSettings);\n\t\tthis.directoryProfileSettings = structuredClone(snapshot.directoryProfileSettings);\n\t\tthis.runtimeResourceProfiles =\n\t\t\tsnapshot.runtimeResourceProfiles === undefined ? undefined : [...snapshot.runtimeResourceProfiles];\n\t\tthis.inlineResourceProfileDefinitions = structuredClone(snapshot.inlineResourceProfileDefinitions);\n\t\tthis.discoveredResourceProfileDefinitions = structuredClone(snapshot.discoveredResourceProfileDefinitions);\n\t\tthis.settings = structuredClone(snapshot.effectiveSettings);\n\t\tthis.projectTrusted = snapshot.projectTrusted;\n\t\tthis.modifiedFields = new Set(snapshot.modifiedFields);\n\t\tthis.modifiedNestedFields = this.cloneModifiedNestedFields(snapshot.modifiedNestedFields);\n\t\tthis.modifiedProjectFields = new Set(snapshot.modifiedProjectFields);\n\t\tthis.modifiedProjectNestedFields = this.cloneModifiedNestedFields(snapshot.modifiedProjectNestedFields);\n\t\tthis.globalSettingsLoadError = snapshot.globalSettingsLoadError;\n\t\tthis.projectSettingsLoadError = snapshot.projectSettingsLoadError;\n\t\tthis.directoryProfileInfo = snapshot.directoryProfileInfo ? { ...snapshot.directoryProfileInfo } : null;\n\t\tthis.errors = [...snapshot.errors];\n\t\tthis.refreshProfileRegistry();\n\t}\n\n\t/** Apply additional overrides on top of current settings */\n\tapplyOverrides(overrides: Partial<Settings>): void {\n\t\tthis.settings = deepMergeSettings(this.settings, overrides);\n\t}\n\n\t/** Select runtime-only resource profiles, e.g. from CLI/subagent launch options. */\n\tsetRuntimeResourceProfiles(profileNames: string[]): void {\n\t\tthis.runtimeResourceProfiles = normalizeResourceProfileNames(profileNames);\n\t\tthis.recomputeSettings();\n\t}\n\n\t/** Add one-shot profile definitions from CLI/SDK/ephemeral agent launch input. Never writes to disk. */\n\taddInlineResourceProfileDefinitions(\n\t\tprofiles: Record<string, ResourceProfileSettings | ProfileDefinitionInput>,\n\t): void {\n\t\tconst next = { ...this.inlineResourceProfileDefinitions };\n\t\tfor (const [name, input] of Object.entries(profiles)) {\n\t\t\tconst existing = next[name];\n\t\t\tconst definition = Object.hasOwn(input, \"resources\")\n\t\t\t\t? (input as ProfileDefinitionInput)\n\t\t\t\t: { resources: input as ResourceProfileSettings };\n\t\t\tconst resources = mergeResourceProfileSettings(existing?.resources, definition.resources);\n\t\t\tnext[name] = this.mergeProfileDefinition(name, definition, resources, existing);\n\t\t}\n\t\tthis.inlineResourceProfileDefinitions = next;\n\t\tthis.refreshProfileRegistry();\n\t}\n\n\t/** Replace profile definitions discovered inside loaded resource files. Never writes to disk. */\n\treplaceDiscoveredResourceProfileDefinitions(profiles: Record<string, ResourceProfileSettings>): void {\n\t\tthis.discoveredResourceProfileDefinitions = { ...profiles };\n\t\tthis.refreshProfileRegistry();\n\t}\n\n\t/** Add profile definitions discovered after resource resolution, e.g. context agent files. Never writes to disk. */\n\taddDiscoveredResourceProfileDefinitions(profiles: Record<string, ResourceProfileSettings>): void {\n\t\tthis.discoveredResourceProfileDefinitions = mergeResourceProfileMap(\n\t\t\tthis.discoveredResourceProfileDefinitions,\n\t\t\tprofiles,\n\t\t);\n\t\tthis.refreshProfileRegistry();\n\t}\n\n\tprivate normalizeProfileName(profileName: string): string {\n\t\tconst trimmed = profileName.trim();\n\t\tif (!trimmed) {\n\t\t\tthrow new Error(\"Profile name is required\");\n\t\t}\n\t\tconst errors = validateSkillName(trimmed);\n\t\tif (errors.length > 0) {\n\t\t\tthrow new Error(`Invalid profile name \"${trimmed}\": ${errors.join(\", \")}`);\n\t\t}\n\t\treturn trimmed;\n\t}\n\n\tprivate normalizeProfileSelection(profileName: string): string {\n\t\tconst trimmed = profileName.trim();\n\t\tif (trimmed.startsWith(\"./\") || trimmed.startsWith(\"../\")) {\n\t\t\treturn trimmed;\n\t\t}\n\t\treturn this.normalizeProfileName(trimmed);\n\t}\n\n\tprivate sanitizeProfileResources(resources: ResourceProfileSettings): ResourceProfileSettings {\n\t\tconst result: ResourceProfileSettings = {};\n\t\tfor (const kind of [\"extensions\", \"skills\", \"prompts\", \"themes\", \"agents\", \"tools\"] as const) {\n\t\t\tconst filter = resources[kind];\n\t\t\tif (!filter) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tresult[kind] = {\n\t\t\t\tallow: filter.allow ? [...filter.allow] : undefined,\n\t\t\t\tblock: filter.block ? [...filter.block] : undefined,\n\t\t\t};\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate decodeStoredProfileDefinition(\n\t\tname: string,\n\t\tstored: ResourceProfileSettings | ProfileDefinitionInput | undefined,\n\t): ProfileDefinitionInput {\n\t\tif (stored && Object.hasOwn(stored, \"resources\")) {\n\t\t\tconst definition = stored as ProfileDefinitionInput;\n\t\t\treturn { ...definition, name, resources: this.sanitizeProfileResources(definition.resources) };\n\t\t}\n\t\treturn {\n\t\t\tname,\n\t\t\tresources: this.sanitizeProfileResources((stored as ResourceProfileSettings | undefined) ?? {}),\n\t\t};\n\t}\n\n\tprivate mergeProfileDefinition(\n\t\tname: string,\n\t\tdefinition: ProfileDefinitionInput,\n\t\tresources: ResourceProfileSettings,\n\t\texisting?: ResourceProfileSettings | ProfileDefinitionInput,\n\t): ProfileDefinitionInput {\n\t\tconst previous = this.decodeStoredProfileDefinition(name, existing);\n\t\treturn {\n\t\t\t...previous,\n\t\t\tname,\n\t\t\tresources,\n\t\t\tdescription: definition.description ?? previous.description,\n\t\t\tmodel: Object.hasOwn(definition, \"model\") ? definition.model : previous.model,\n\t\t\tthinking: definition.thinking ?? previous.thinking,\n\t\t\tmodelRouter: definition.modelRouter ?? previous.modelRouter,\n\t\t\tsoul: definition.soul ?? previous.soul,\n\t\t};\n\t}\n\n\tprivate encodeStoredProfileDefinition(\n\t\tdefinition: ProfileDefinitionInput,\n\t): ResourceProfileSettings | ProfileDefinitionInput | undefined {\n\t\tconst hasMetadata = Boolean(\n\t\t\tdefinition.description || definition.model || definition.thinking || definition.modelRouter || definition.soul,\n\t\t);\n\t\tif (hasMetadata) return definition;\n\t\treturn Object.keys(definition.resources).length > 0 ? definition.resources : undefined;\n\t}\n\n\tprivate setActiveProfileInSettings(settings: Settings, profileName: string | undefined): void {\n\t\tif (profileName) {\n\t\t\tsettings.activeResourceProfile = profileName;\n\t\t\tsettings.activeResourceProfiles = [profileName];\n\t\t\treturn;\n\t\t}\n\t\tsettings.activeResourceProfiles = [];\n\t\tdelete settings.activeResourceProfile;\n\t}\n\n\tprivate rewriteActiveProfileReference(settings: Settings, oldName: string, newName: string | undefined): boolean {\n\t\tlet changed = false;\n\t\tconst rewrite = (values: string[]): string[] => {\n\t\t\tconst next = values.flatMap((value) => {\n\t\t\t\tif (value !== oldName) return [value];\n\t\t\t\tchanged = true;\n\t\t\t\treturn newName ? [newName] : [];\n\t\t\t});\n\t\t\treturn [...new Set(next)];\n\t\t};\n\n\t\tif (settings.activeResourceProfiles !== undefined) {\n\t\t\tconst next = rewrite(normalizeResourceProfileNames(settings.activeResourceProfiles));\n\t\t\tif (next.length > 0) settings.activeResourceProfiles = next;\n\t\t\telse delete settings.activeResourceProfiles;\n\t\t}\n\t\tif (settings.activeResourceProfile !== undefined) {\n\t\t\tconst next = rewrite(normalizeResourceProfileNames(settings.activeResourceProfile));\n\t\t\tif (next.length === 0) delete settings.activeResourceProfile;\n\t\t\telse\n\t\t\t\tsettings.activeResourceProfile =\n\t\t\t\t\tArray.isArray(settings.activeResourceProfile) || next.length > 1 ? next : next[0];\n\t\t}\n\t\treturn changed;\n\t}\n\n\tprivate rewriteReusableProfileSelections(oldName: string, newName: string | undefined): void {\n\t\tif (this.runtimeResourceProfiles?.includes(oldName)) {\n\t\t\tthis.runtimeResourceProfiles = [\n\t\t\t\t...new Set(\n\t\t\t\t\tthis.runtimeResourceProfiles.flatMap((profile) =>\n\t\t\t\t\t\tprofile === oldName ? (newName ? [newName] : []) : [profile],\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t];\n\t\t}\n\n\t\tif (this.rewriteActiveProfileReference(this.globalSettings, oldName, newName)) {\n\t\t\tthis.markModified(\"activeResourceProfile\");\n\t\t\tthis.markModified(\"activeResourceProfiles\");\n\t\t\tthis.save();\n\t\t}\n\n\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\tif (this.rewriteActiveProfileReference(projectSettings, oldName, newName)) {\n\t\t\tthis.markProjectModified(\"activeResourceProfile\");\n\t\t\tthis.markProjectModified(\"activeResourceProfiles\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t}\n\n\t\tif (this.rewriteActiveProfileReference(this.directoryProfileSettings, oldName, newName)) {\n\t\t\tthis.persistDirectoryProfiles(() => {});\n\t\t}\n\t\tthis.recomputeSettings();\n\t}\n\n\tprivate persistDirectoryProfiles(update: (settings: Settings) => void): void {\n\t\tconst next = structuredClone(this.directoryProfileSettings);\n\t\tupdate(next);\n\t\tthis.directoryProfileSettings = next;\n\t\tthis.recomputeSettings();\n\n\t\tif (!this.directoryProfileInfo) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.enqueueWrite(\"directoryProfile\", () => {\n\t\t\tthis.storage.withLock(\"directoryProfile\", (current) => {\n\t\t\t\tconst currentSettings = current\n\t\t\t\t\t? SettingsManager.migrateSettings(JSON.parse(current) as Record<string, unknown>)\n\t\t\t\t\t: {};\n\t\t\t\tconst merged: Settings = {\n\t\t\t\t\t...currentSettings,\n\t\t\t\t\t...next,\n\t\t\t\t\tresourceProfiles: next.resourceProfiles,\n\t\t\t\t\tactiveResourceProfiles: next.activeResourceProfiles,\n\t\t\t\t\tactiveResourceProfile: next.activeResourceProfile,\n\t\t\t\t};\n\t\t\t\tif (!next.resourceProfiles) {\n\t\t\t\t\tdelete merged.resourceProfiles;\n\t\t\t\t}\n\t\t\t\tif (!next.activeResourceProfiles && next.activeResourceProfile === undefined) {\n\t\t\t\t\tdelete merged.activeResourceProfiles;\n\t\t\t\t\tdelete merged.activeResourceProfile;\n\t\t\t\t}\n\t\t\t\treturn JSON.stringify(merged, null, 2);\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate getProfileFilePath(profileName: string): string {\n\t\tconst normalized = this.normalizeProfileName(profileName);\n\t\tconst profilesDir = this.storage.getProfilesDir?.();\n\t\tif (!profilesDir) {\n\t\t\tthrow new Error(\"Profiles directory is not configured\");\n\t\t}\n\t\treturn join(resolve(profilesDir), `${normalized}.json`);\n\t}\n\n\t/**\n\t * Create or update a profile definition in the selected persistence scope.\n\t */\n\tsetProfileDefinition(profileName: string, definition: ProfileDefinitionInput, scope: ProfilePersistenceScope): void {\n\t\tconst name = this.normalizeProfileName(profileName);\n\t\tconst resources = this.sanitizeProfileResources(definition.resources);\n\n\t\tif (scope === \"session\") {\n\t\t\tconst next = { ...this.inlineResourceProfileDefinitions };\n\t\t\tconst payload = this.mergeProfileDefinition(name, definition, resources, next[name]);\n\t\t\tif (this.encodeStoredProfileDefinition(payload)) {\n\t\t\t\tnext[name] = payload;\n\t\t\t} else {\n\t\t\t\tdelete next[name];\n\t\t\t}\n\t\t\tthis.inlineResourceProfileDefinitions = next;\n\t\t\tthis.refreshProfileRegistry();\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"global\") {\n\t\t\tconst next = structuredClone(this.globalSettings);\n\t\t\tnext.resourceProfiles = { ...(next.resourceProfiles ?? {}) };\n\t\t\tconst stored = this.encodeStoredProfileDefinition(\n\t\t\t\tthis.mergeProfileDefinition(name, definition, resources, next.resourceProfiles[name]),\n\t\t\t);\n\t\t\tif (stored) {\n\t\t\t\tnext.resourceProfiles[name] = stored;\n\t\t\t} else {\n\t\t\t\tdelete next.resourceProfiles[name];\n\t\t\t}\n\t\t\tif (Object.keys(next.resourceProfiles).length === 0) {\n\t\t\t\tdelete next.resourceProfiles;\n\t\t\t}\n\t\t\tthis.globalSettings = next;\n\t\t\tthis.markModified(\"resourceProfiles\");\n\t\t\tthis.save();\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"project\") {\n\t\t\tthis.updateProjectSettings(\"resourceProfiles\", (settings) => {\n\t\t\t\tconst next = structuredClone(settings.resourceProfiles ?? {});\n\t\t\t\tconst stored = this.encodeStoredProfileDefinition(\n\t\t\t\t\tthis.mergeProfileDefinition(name, definition, resources, next[name]),\n\t\t\t\t);\n\t\t\t\tif (stored) {\n\t\t\t\t\tnext[name] = stored;\n\t\t\t\t} else {\n\t\t\t\t\tdelete next[name];\n\t\t\t\t}\n\t\t\t\tif (Object.keys(next).length > 0) {\n\t\t\t\t\tsettings.resourceProfiles = next;\n\t\t\t\t} else {\n\t\t\t\t\tdelete settings.resourceProfiles;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"directory\") {\n\t\t\tthis.persistDirectoryProfiles((current) => {\n\t\t\t\tconst next = { ...(current.resourceProfiles ?? {}) };\n\t\t\t\tconst stored = this.encodeStoredProfileDefinition(\n\t\t\t\t\tthis.mergeProfileDefinition(name, definition, resources, next[name]),\n\t\t\t\t);\n\t\t\t\tif (stored) {\n\t\t\t\t\tnext[name] = stored;\n\t\t\t\t} else {\n\t\t\t\t\tdelete next[name];\n\t\t\t\t}\n\t\t\t\tif (Object.keys(next).length > 0) {\n\t\t\t\t\tcurrent.resourceProfiles = next;\n\t\t\t\t} else {\n\t\t\t\t\tdelete current.resourceProfiles;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst path = this.getProfileFilePath(name);\n\t\tconst existing = existsSync(path)\n\t\t\t? parseProfileFileDefinition(readFileSync(path, \"utf-8\"), name)\n\t\t\t: { name, resources: {} };\n\t\tconst payload = this.mergeProfileDefinition(name, definition, resources, existing);\n\t\tmkdirSync(dirname(path), { recursive: true });\n\t\twriteFileSync(path, JSON.stringify(payload, null, 2), \"utf-8\");\n\t}\n\n\t/**\n\t * Delete a profile from the selected scope.\n\t */\n\tdeleteProfile(profileName: string, scope: ProfilePersistenceScope): void {\n\t\tconst name = this.normalizeProfileName(profileName);\n\n\t\tif (scope === \"session\") {\n\t\t\tconst next = { ...this.inlineResourceProfileDefinitions };\n\t\t\tdelete next[name];\n\t\t\tthis.inlineResourceProfileDefinitions = next;\n\t\t\tthis.refreshProfileRegistry();\n\t\t\tif (this.runtimeResourceProfiles) {\n\t\t\t\tthis.setRuntimeResourceProfiles(this.runtimeResourceProfiles.filter((profile) => profile !== name));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"global\") {\n\t\t\tconst next = { ...(this.globalSettings.resourceProfiles ?? {}) };\n\t\t\tdelete next[name];\n\t\t\tif (Object.keys(next).length > 0) {\n\t\t\t\tthis.globalSettings.resourceProfiles = next;\n\t\t\t} else {\n\t\t\t\tdelete this.globalSettings.resourceProfiles;\n\t\t\t}\n\t\t\tif (this.globalSettings.activeResourceProfile === name) {\n\t\t\t\tdelete this.globalSettings.activeResourceProfile;\n\t\t\t}\n\t\t\tif (this.globalSettings.activeResourceProfiles) {\n\t\t\t\tthis.globalSettings.activeResourceProfiles = this.globalSettings.activeResourceProfiles.filter(\n\t\t\t\t\t(profile) => profile !== name,\n\t\t\t\t);\n\t\t\t\tif (this.globalSettings.activeResourceProfiles.length === 0) {\n\t\t\t\t\tdelete this.globalSettings.activeResourceProfiles;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.markModified(\"resourceProfiles\");\n\t\t\tthis.save();\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"project\") {\n\t\t\tthis.updateProjectSettings(\"resourceProfiles\", (settings) => {\n\t\t\t\tconst next = { ...(settings.resourceProfiles ?? {}) };\n\t\t\t\tdelete next[name];\n\t\t\t\tif (Object.keys(next).length > 0) {\n\t\t\t\t\tsettings.resourceProfiles = next;\n\t\t\t\t} else {\n\t\t\t\t\tdelete settings.resourceProfiles;\n\t\t\t\t}\n\t\t\t\tif (settings.activeResourceProfile === name) {\n\t\t\t\t\tdelete settings.activeResourceProfile;\n\t\t\t\t}\n\t\t\t\tif (settings.activeResourceProfiles) {\n\t\t\t\t\tsettings.activeResourceProfiles = settings.activeResourceProfiles.filter((profile) => profile !== name);\n\t\t\t\t\tif (settings.activeResourceProfiles.length === 0) {\n\t\t\t\t\t\tdelete settings.activeResourceProfiles;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"directory\") {\n\t\t\tthis.persistDirectoryProfiles((current) => {\n\t\t\t\tconst next = { ...(current.resourceProfiles ?? {}) };\n\t\t\t\tdelete next[name];\n\t\t\t\tif (Object.keys(next).length > 0) {\n\t\t\t\t\tcurrent.resourceProfiles = next;\n\t\t\t\t} else {\n\t\t\t\t\tdelete current.resourceProfiles;\n\t\t\t\t}\n\t\t\t\tif (current.activeResourceProfile === name) {\n\t\t\t\t\tdelete current.activeResourceProfile;\n\t\t\t\t}\n\t\t\t\tif (current.activeResourceProfiles) {\n\t\t\t\t\tcurrent.activeResourceProfiles = current.activeResourceProfiles.filter((profile) => profile !== name);\n\t\t\t\t\tif (current.activeResourceProfiles.length === 0) {\n\t\t\t\t\t\tdelete current.activeResourceProfiles;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst profilePath = this.getProfileFilePath(name);\n\t\tif (!existsSync(profilePath)) {\n\t\t\tthrow new Error(`Profile not found: ${name}`);\n\t\t}\n\t\trmSync(profilePath, { force: true });\n\t\tthis.rewriteReusableProfileSelections(name, undefined);\n\t}\n\n\trenameProfile(profileName: string, newProfileName: string, scope: ProfilePersistenceScope): void {\n\t\tconst oldName = this.normalizeProfileName(profileName);\n\t\tconst newName = this.normalizeProfileName(newProfileName);\n\t\tif (oldName === newName) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"session\") {\n\t\t\tconst profile = this.inlineResourceProfileDefinitions[oldName];\n\t\t\tif (!profile) {\n\t\t\t\tthrow new Error(`Profile not found: ${oldName}`);\n\t\t\t}\n\t\t\tdelete this.inlineResourceProfileDefinitions[oldName];\n\t\t\tthis.inlineResourceProfileDefinitions[newName] = profile;\n\t\t\tif (this.runtimeResourceProfiles) {\n\t\t\t\tthis.runtimeResourceProfiles = this.runtimeResourceProfiles.map((name) =>\n\t\t\t\t\tname === oldName ? newName : name,\n\t\t\t\t);\n\t\t\t\tthis.setRuntimeResourceProfiles(this.runtimeResourceProfiles);\n\t\t\t}\n\t\t\tthis.refreshProfileRegistry();\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"global\") {\n\t\t\tconst next = structuredClone(this.globalSettings);\n\t\t\tif (!next.resourceProfiles?.[oldName]) {\n\t\t\t\tthrow new Error(`Profile not found: ${oldName}`);\n\t\t\t}\n\t\t\tif (next.resourceProfiles[newName]) {\n\t\t\t\tthrow new Error(`Profile already exists: ${newName}`);\n\t\t\t}\n\t\t\tnext.resourceProfiles[newName] = next.resourceProfiles[oldName]!;\n\t\t\tdelete next.resourceProfiles[oldName];\n\t\t\tif (next.activeResourceProfile === oldName) {\n\t\t\t\tnext.activeResourceProfile = newName;\n\t\t\t}\n\t\t\tif (next.activeResourceProfiles) {\n\t\t\t\tnext.activeResourceProfiles = next.activeResourceProfiles.map((name) =>\n\t\t\t\t\tname === oldName ? newName : name,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.globalSettings = next;\n\t\t\tthis.markModified(\"resourceProfiles\");\n\t\t\tthis.markModified(\"activeResourceProfile\");\n\t\t\tthis.markModified(\"activeResourceProfiles\");\n\t\t\tthis.save();\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"project\") {\n\t\t\tthis.updateProjectSettings(\"resourceProfiles\", (settings) => {\n\t\t\t\tconst next = structuredClone(settings.resourceProfiles ?? {});\n\t\t\t\tif (!next[oldName]) {\n\t\t\t\t\tthrow new Error(`Profile not found: ${oldName}`);\n\t\t\t\t}\n\t\t\t\tif (next[newName]) {\n\t\t\t\t\tthrow new Error(`Profile already exists: ${newName}`);\n\t\t\t\t}\n\t\t\t\tnext[newName] = next[oldName]!;\n\t\t\t\tdelete next[oldName];\n\t\t\t\tsettings.resourceProfiles = next;\n\t\t\t\tif (settings.activeResourceProfile === oldName) {\n\t\t\t\t\tsettings.activeResourceProfile = newName;\n\t\t\t\t}\n\t\t\t\tif (settings.activeResourceProfiles) {\n\t\t\t\t\tsettings.activeResourceProfiles = settings.activeResourceProfiles.map((name) =>\n\t\t\t\t\t\tname === oldName ? newName : name,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"directory\") {\n\t\t\tconst next = structuredClone(this.directoryProfileSettings.resourceProfiles ?? {});\n\t\t\tif (!next[oldName]) {\n\t\t\t\tthrow new Error(`Profile not found: ${oldName}`);\n\t\t\t}\n\t\t\tif (next[newName]) {\n\t\t\t\tthrow new Error(`Profile already exists: ${newName}`);\n\t\t\t}\n\t\t\tnext[newName] = next[oldName]!;\n\t\t\tdelete next[oldName];\n\t\t\tthis.persistDirectoryProfiles((current) => {\n\t\t\t\tcurrent.resourceProfiles = next;\n\t\t\t\tif (current.activeResourceProfile === oldName) {\n\t\t\t\t\tcurrent.activeResourceProfile = newName;\n\t\t\t\t}\n\t\t\t\tif (current.activeResourceProfiles) {\n\t\t\t\t\tcurrent.activeResourceProfiles = current.activeResourceProfiles.map((name) =>\n\t\t\t\t\t\tname === oldName ? newName : name,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst oldPath = this.getProfileFilePath(oldName);\n\t\tconst newPath = this.getProfileFilePath(newName);\n\t\tif (!existsSync(oldPath)) {\n\t\t\tthrow new Error(`Profile not found: ${oldName}`);\n\t\t}\n\t\tif (existsSync(newPath)) {\n\t\t\tthrow new Error(`Profile already exists: ${newName}`);\n\t\t}\n\t\tconst parsed = parseProfileFileDefinition(readFileSync(oldPath, \"utf-8\"), oldName);\n\t\tparsed.name = newName;\n\t\twriteFileSync(newPath, JSON.stringify(parsed, null, 2), \"utf-8\");\n\t\trmSync(oldPath, { force: true });\n\t\tthis.rewriteReusableProfileSelections(oldName, newName);\n\t}\n\n\t/**\n\t * Set active profile selection in the selected scope.\n\t */\n\tsetActiveProfile(profileName: string | undefined, scope: Exclude<ProfilePersistenceScope, \"reusable-file\">): void {\n\t\tconst name = profileName ? this.normalizeProfileSelection(profileName) : undefined;\n\t\tif (scope === \"session\") {\n\t\t\tif (name) {\n\t\t\t\tthis.setRuntimeResourceProfiles([name]);\n\t\t\t} else {\n\t\t\t\tthis.setRuntimeResourceProfiles([]);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"global\") {\n\t\t\tif (name) {\n\t\t\t\tthis.globalSettings.activeResourceProfile = name;\n\t\t\t\tthis.globalSettings.activeResourceProfiles = [name];\n\t\t\t} else {\n\t\t\t\tdelete this.globalSettings.activeResourceProfile;\n\t\t\t\tthis.globalSettings.activeResourceProfiles = [];\n\t\t\t}\n\t\t\tthis.markModified(\"activeResourceProfile\");\n\t\t\tthis.markModified(\"activeResourceProfiles\");\n\t\t\tthis.save();\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"project\") {\n\t\t\tthis.updateProjectSettings(\"activeResourceProfile\", (settings) => {\n\t\t\t\tthis.setActiveProfileInSettings(settings, name);\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tthis.persistDirectoryProfiles((current) => {\n\t\t\tthis.setActiveProfileInSettings(current, name);\n\t\t});\n\t}\n\n\t/** Atomically replace the global profile/authority fields used by config restore and rollback. */\n\treplaceGlobalResourceProfileConfiguration(configuration: GlobalResourceProfileConfiguration): void {\n\t\tconst next = structuredClone(this.globalSettings);\n\t\tconst replace = <K extends keyof GlobalResourceProfileConfiguration>(key: K): void => {\n\t\t\tconst value = configuration[key];\n\t\t\tif (value === undefined) {\n\t\t\t\tdelete next[key];\n\t\t\t} else {\n\t\t\t\tnext[key] = structuredClone(value) as Settings[K];\n\t\t\t}\n\t\t\tthis.markModified(key);\n\t\t};\n\t\treplace(\"resourceProfiles\");\n\t\treplace(\"activeResourceProfile\");\n\t\treplace(\"activeResourceProfiles\");\n\t\treplace(\"externalResourceRoots\");\n\t\treplace(\"trustedResourceRoots\");\n\t\tthis.globalSettings = next;\n\t\tthis.save();\n\t}\n\n\t/** Restore one profile definition's persistent owner after a post-doctor commit failure. */\n\trestoreProfileDefinitionFromReloadSnapshot(\n\t\tprofileName: string,\n\t\tscope: Exclude<ProfilePersistenceScope, \"reusable-file\">,\n\t\tsnapshot: SettingsReloadSnapshot,\n\t): void {\n\t\tconst name = this.normalizeProfileName(profileName);\n\t\tif (scope === \"session\") {\n\t\t\tconst previous = snapshot.inlineResourceProfileDefinitions[name];\n\t\t\tif (previous) this.inlineResourceProfileDefinitions[name] = structuredClone(previous);\n\t\t\telse delete this.inlineResourceProfileDefinitions[name];\n\t\t\tthis.refreshProfileRegistry();\n\t\t\treturn;\n\t\t}\n\n\t\tconst restoreDefinition = (settings: Settings, previous: Settings): void => {\n\t\t\tconst definitions = structuredClone(settings.resourceProfiles ?? {});\n\t\t\tconst oldDefinition = previous.resourceProfiles?.[name];\n\t\t\tif (oldDefinition) definitions[name] = structuredClone(oldDefinition);\n\t\t\telse delete definitions[name];\n\t\t\tif (Object.keys(definitions).length > 0) settings.resourceProfiles = definitions;\n\t\t\telse delete settings.resourceProfiles;\n\t\t};\n\n\t\tif (scope === \"global\") {\n\t\t\trestoreDefinition(this.globalSettings, snapshot.globalSettings);\n\t\t\tthis.markModified(\"resourceProfiles\");\n\t\t\tthis.save();\n\t\t\treturn;\n\t\t}\n\t\tif (scope === \"project\") {\n\t\t\tthis.updateProjectSettings(\"resourceProfiles\", (settings) => {\n\t\t\t\trestoreDefinition(settings, snapshot.projectSettings);\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tthis.persistDirectoryProfiles((settings) => {\n\t\t\trestoreDefinition(settings, snapshot.directoryProfileSettings);\n\t\t});\n\t}\n\n\t/** Mark a global field as modified during this session */\n\tprivate markModified(field: keyof Settings, nestedKey?: string): void {\n\t\tthis.modifiedFields.add(field);\n\t\tif (nestedKey) {\n\t\t\tif (!this.modifiedNestedFields.has(field)) {\n\t\t\t\tthis.modifiedNestedFields.set(field, new Set());\n\t\t\t}\n\t\t\tthis.modifiedNestedFields.get(field)!.add(nestedKey);\n\t\t}\n\t}\n\n\t/** Mark a project field as modified during this session */\n\tprivate markProjectModified(field: keyof Settings, nestedKey?: string): void {\n\t\tthis.modifiedProjectFields.add(field);\n\t\tif (nestedKey) {\n\t\t\tif (!this.modifiedProjectNestedFields.has(field)) {\n\t\t\t\tthis.modifiedProjectNestedFields.set(field, new Set());\n\t\t\t}\n\t\t\tthis.modifiedProjectNestedFields.get(field)!.add(nestedKey);\n\t\t}\n\t}\n\n\tprivate assertProjectTrustedForWrite(): void {\n\t\tif (!this.projectTrusted) {\n\t\t\tthrow new Error(\"Project is not trusted; refusing to write project settings\");\n\t\t}\n\t}\n\n\tprivate recordError(scope: SettingsErrorScope, error: unknown): void {\n\t\tconst normalizedError = error instanceof Error ? error : new Error(String(error));\n\t\tthis.errors.push({ scope, error: normalizedError });\n\t}\n\n\tprivate clearModifiedScope(scope: SettingsScope): void {\n\t\tif (scope === \"global\") {\n\t\t\tthis.modifiedFields.clear();\n\t\t\tthis.modifiedNestedFields.clear();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.modifiedProjectFields.clear();\n\t\tthis.modifiedProjectNestedFields.clear();\n\t}\n\n\tprivate enqueueWrite(scope: SettingsScope, task: () => void): void {\n\t\tthis.writeQueue = this.writeQueue\n\t\t\t.then(() => {\n\t\t\t\tif (scope === \"project\") {\n\t\t\t\t\tthis.assertProjectTrustedForWrite();\n\t\t\t\t}\n\t\t\t\ttask();\n\t\t\t\tthis.clearModifiedScope(scope);\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.recordError(scope, error);\n\t\t\t});\n\t}\n\n\tprivate cloneModifiedNestedFields(source: Map<keyof Settings, Set<string>>): Map<keyof Settings, Set<string>> {\n\t\tconst snapshot = new Map<keyof Settings, Set<string>>();\n\t\tfor (const [key, value] of source.entries()) {\n\t\t\tsnapshot.set(key, new Set(value));\n\t\t}\n\t\treturn snapshot;\n\t}\n\n\tprivate persistScopedSettings(\n\t\tscope: SettingsScope,\n\t\tsnapshotSettings: Settings,\n\t\tmodifiedFields: Set<keyof Settings>,\n\t\tmodifiedNestedFields: Map<keyof Settings, Set<string>>,\n\t): void {\n\t\tthis.storage.withLock(scope, (current) => {\n\t\t\tconst currentFileSettings = current\n\t\t\t\t? SettingsManager.migrateSettings(JSON.parse(current) as Record<string, unknown>)\n\t\t\t\t: {};\n\t\t\tconst mergedSettings: Settings = { ...currentFileSettings };\n\t\t\tfor (const field of modifiedFields) {\n\t\t\t\tconst value = snapshotSettings[field];\n\t\t\t\tif (modifiedNestedFields.has(field) && typeof value === \"object\" && value !== null) {\n\t\t\t\t\tconst nestedModified = modifiedNestedFields.get(field)!;\n\t\t\t\t\tconst baseNested = (currentFileSettings[field] as Record<string, unknown>) ?? {};\n\t\t\t\t\tconst inMemoryNested = value as Record<string, unknown>;\n\t\t\t\t\tconst mergedNested = { ...baseNested };\n\t\t\t\t\tfor (const nestedKey of nestedModified) {\n\t\t\t\t\t\tmergedNested[nestedKey] = inMemoryNested[nestedKey];\n\t\t\t\t\t}\n\t\t\t\t\t(mergedSettings as Record<string, unknown>)[field] = mergedNested;\n\t\t\t\t} else {\n\t\t\t\t\t(mergedSettings as Record<string, unknown>)[field] = value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn JSON.stringify(mergedSettings, null, 2);\n\t\t});\n\t}\n\n\tprivate save(): void {\n\t\tthis.recomputeSettings();\n\n\t\tif (this.globalSettingsLoadError) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst snapshotGlobalSettings = structuredClone(this.globalSettings);\n\t\tconst modifiedFields = new Set(this.modifiedFields);\n\t\tconst modifiedNestedFields = this.cloneModifiedNestedFields(this.modifiedNestedFields);\n\n\t\tthis.enqueueWrite(\"global\", () => {\n\t\t\tthis.persistScopedSettings(\"global\", snapshotGlobalSettings, modifiedFields, modifiedNestedFields);\n\t\t});\n\t}\n\n\tprivate saveProjectSettings(settings: Settings): void {\n\t\tthis.assertProjectTrustedForWrite();\n\t\tthis.projectSettings = structuredClone(settings);\n\t\tthis.recomputeSettings();\n\n\t\tif (this.projectSettingsLoadError) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst snapshotProjectSettings = structuredClone(this.projectSettings);\n\t\tconst modifiedFields = new Set(this.modifiedProjectFields);\n\t\tconst modifiedNestedFields = this.cloneModifiedNestedFields(this.modifiedProjectNestedFields);\n\t\tthis.enqueueWrite(\"project\", () => {\n\t\t\tthis.persistScopedSettings(\"project\", snapshotProjectSettings, modifiedFields, modifiedNestedFields);\n\t\t});\n\t}\n\n\tprivate updateProjectSettings(field: keyof Settings, update: (settings: Settings) => void): void {\n\t\tthis.assertProjectTrustedForWrite();\n\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\tupdate(projectSettings);\n\t\tthis.markProjectModified(field);\n\t\tthis.saveProjectSettings(projectSettings);\n\t}\n\n\tasync flush(): Promise<void> {\n\t\tawait this.writeQueue;\n\t}\n\n\tdrainErrors(): SettingsError[] {\n\t\tconst drained = [...this.errors];\n\t\tthis.errors = [];\n\t\treturn drained;\n\t}\n\n\tgetLastChangelogVersion(): string | undefined {\n\t\treturn this.settings.lastChangelogVersion;\n\t}\n\n\tsetLastChangelogVersion(version: string): void {\n\t\tthis.globalSettings.lastChangelogVersion = version;\n\t\tthis.markModified(\"lastChangelogVersion\");\n\t\tthis.save();\n\t}\n\n\tgetSessionDir(): string | undefined {\n\t\tconst sessionDir = this.settings.sessionDir;\n\t\treturn sessionDir ? normalizePath(sessionDir) : sessionDir;\n\t}\n\n\tgetDefaultProvider(): string | undefined {\n\t\treturn this.settings.defaultProvider;\n\t}\n\n\tgetDefaultModel(): string | undefined {\n\t\treturn this.settings.defaultModel;\n\t}\n\n\tsetDefaultProvider(provider: string): void {\n\t\tthis.globalSettings.defaultProvider = provider;\n\t\tthis.markModified(\"defaultProvider\");\n\t\tthis.save();\n\t}\n\n\tsetDefaultModel(modelId: string): void {\n\t\tthis.globalSettings.defaultModel = modelId;\n\t\tthis.markModified(\"defaultModel\");\n\t\tthis.save();\n\t}\n\n\tsetDefaultModelAndProvider(provider: string, modelId: string): void {\n\t\tthis.globalSettings.defaultProvider = provider;\n\t\tthis.globalSettings.defaultModel = modelId;\n\t\tthis.markModified(\"defaultProvider\");\n\t\tthis.markModified(\"defaultModel\");\n\t\tthis.save();\n\t}\n\n\tgetSteeringMode(): \"all\" | \"one-at-a-time\" {\n\t\treturn this.settings.steeringMode || \"one-at-a-time\";\n\t}\n\n\tsetSteeringMode(mode: \"all\" | \"one-at-a-time\"): void {\n\t\tthis.globalSettings.steeringMode = mode;\n\t\tthis.markModified(\"steeringMode\");\n\t\tthis.save();\n\t}\n\n\tgetFollowUpMode(): \"all\" | \"one-at-a-time\" {\n\t\treturn this.settings.followUpMode || \"one-at-a-time\";\n\t}\n\n\tsetFollowUpMode(mode: \"all\" | \"one-at-a-time\"): void {\n\t\tthis.globalSettings.followUpMode = mode;\n\t\tthis.markModified(\"followUpMode\");\n\t\tthis.save();\n\t}\n\n\tgetTheme(): string | undefined {\n\t\treturn this.settings.theme;\n\t}\n\n\tsetTheme(theme: string): void {\n\t\tthis.globalSettings.theme = theme;\n\t\tthis.markModified(\"theme\");\n\t\tthis.save();\n\t}\n\n\t/** The configured resource catalog directory, if any (round resource management). */\n\tgetCatalogDir(): string | undefined {\n\t\treturn this.settings.catalogDir;\n\t}\n\n\tsetCatalogDir(dir: string | undefined): void {\n\t\tif (dir) {\n\t\t\tthis.globalSettings.catalogDir = dir;\n\t\t} else {\n\t\t\tdelete this.globalSettings.catalogDir;\n\t\t}\n\t\tthis.markModified(\"catalogDir\");\n\t\tthis.save();\n\t}\n\n\tgetDefaultThinkingLevel(): ThinkingLevel | undefined {\n\t\treturn this.settings.defaultThinkingLevel;\n\t}\n\n\tsetDefaultThinkingLevel(level: ThinkingLevel): void {\n\t\tthis.globalSettings.defaultThinkingLevel = level;\n\t\tthis.markModified(\"defaultThinkingLevel\");\n\t\tthis.save();\n\t}\n\n\tgetTransport(): TransportSetting {\n\t\treturn this.settings.transport ?? \"auto\";\n\t}\n\n\tsetTransport(transport: TransportSetting): void {\n\t\tthis.globalSettings.transport = transport;\n\t\tthis.markModified(\"transport\");\n\t\tthis.save();\n\t}\n\n\tgetCompactionEnabled(): boolean {\n\t\treturn this.settings.compaction?.enabled ?? true;\n\t}\n\n\tsetCompactionEnabled(enabled: boolean): void {\n\t\tif (!this.globalSettings.compaction) {\n\t\t\tthis.globalSettings.compaction = {};\n\t\t}\n\t\tthis.globalSettings.compaction.enabled = enabled;\n\t\tthis.markModified(\"compaction\", \"enabled\");\n\t\tthis.save();\n\t}\n\n\tgetCompactionReserveTokens(): number {\n\t\treturn this.settings.compaction?.reserveTokens ?? 16384;\n\t}\n\n\tgetCompactionKeepRecentTokens(): number {\n\t\treturn this.settings.compaction?.keepRecentTokens ?? 20000;\n\t}\n\n\tgetCompactionTriggerPercent(): number {\n\t\treturn this.settings.compaction?.triggerPercent ?? 0.7;\n\t}\n\n\t/**\n\t * Skill curator (#32). Auto-archive of stale reflection-promoted skills is ON by default (restorable,\n\t * announced, promoted-only). Set `autoArchive: false` to make it propose-only (`/curate`).\n\t */\n\tgetCuratorSettings(): { autoArchive: boolean; staleDays: number } {\n\t\treturn {\n\t\t\tautoArchive: this.settings.curator?.autoArchive ?? true,\n\t\t\tstaleDays: this.settings.curator?.staleDays ?? 30,\n\t\t};\n\t}\n\n\t/**\n\t * Proactive per-turn cost guard (#34). Default ON in WARN-only mode with a high anomaly-catching\n\t * projection threshold so an unusually expensive turn surfaces a visible footer notice without silently\n\t * changing behavior. Set `maxTurnUsd: 0` to disable, or `action: \"downgrade\"` to also auto-reduce\n\t * reasoning effort over the ceiling.\n\t */\n\tgetCostGuardSettings(): { maxTurnUsd: number; action: \"warn\" | \"downgrade\" } {\n\t\treturn {\n\t\t\tmaxTurnUsd: this.settings.costGuard?.maxTurnUsd ?? 2.5,\n\t\t\taction: this.settings.costGuard?.action ?? \"warn\",\n\t\t};\n\t}\n\n\tgetFailoverSettings(): Required<FailoverSettings> {\n\t\treturn { subscriptionHop: this.settings.failover?.subscriptionHop ?? true };\n\t}\n\n\tprivate getProfileModelRouterSettings(): ModelRouterSettings | undefined {\n\t\tconst activeProfileNames = this.getActiveResourceProfileNames();\n\t\tif (activeProfileNames.length === 0) return undefined;\n\t\tconst registry = this.getProfileRegistry();\n\t\tconst merged: ModelRouterSettings = {};\n\t\tfor (let index = activeProfileNames.length - 1; index >= 0; index--) {\n\t\t\tconst profile = this.resolveProfileFromRegistry(registry, activeProfileNames[index]);\n\t\t\tconst router = profile?.modelRouter;\n\t\t\tif (!router) continue;\n\t\t\tif (router.enabled !== undefined) merged.enabled = router.enabled;\n\t\t\tif (router.judgeEnabled !== undefined) merged.judgeEnabled = router.judgeEnabled;\n\t\t\tif (router.fitnessGate !== undefined) merged.fitnessGate = router.fitnessGate;\n\t\t\tif (router.cheapModel !== undefined) merged.cheapModel = router.cheapModel;\n\t\t\tif (router.mediumModel !== undefined) merged.mediumModel = router.mediumModel;\n\t\t\tif (router.expensiveModel !== undefined) merged.expensiveModel = router.expensiveModel;\n\t\t\tif (router.learningModel !== undefined) merged.learningModel = router.learningModel;\n\t\t\tif (router.judgeModel !== undefined) merged.judgeModel = router.judgeModel;\n\t\t\tif (router.executorModel !== undefined) merged.executorModel = router.executorModel;\n\t\t\tif (router.cheapThinking !== undefined) merged.cheapThinking = router.cheapThinking;\n\t\t\tif (router.mediumThinking !== undefined) merged.mediumThinking = router.mediumThinking;\n\t\t\tif (router.expensiveThinking !== undefined) merged.expensiveThinking = router.expensiveThinking;\n\t\t\tif (router.executorThinking !== undefined) merged.executorThinking = router.executorThinking;\n\t\t\tif (router.judgeThinking !== undefined) merged.judgeThinking = router.judgeThinking;\n\t\t}\n\t\treturn Object.keys(merged).length > 0 ? merged : undefined;\n\t}\n\n\tgetModelRouterSettings(): {\n\t\tenabled: boolean;\n\t\tcheapModel?: string;\n\t\tmediumModel?: string;\n\t\texpensiveModel?: string;\n\t\tlearningModel?: string;\n\t\tjudgeEnabled: boolean;\n\t\tjudgeModel?: string;\n\t\texecutorModel?: string;\n\t\tfitnessGate: boolean;\n\t\tcheapThinking?: ThinkingLevel;\n\t\tmediumThinking?: ThinkingLevel;\n\t\texpensiveThinking?: ThinkingLevel;\n\t\texecutorThinking?: ThinkingLevel;\n\t\tjudgeThinking?: ThinkingLevel;\n\t} {\n\t\tconst profileSettings = this.getProfileModelRouterSettings();\n\t\tconst settings = {\n\t\t\tenabled: this.settings.modelRouter?.enabled ?? false,\n\t\t\tcheapModel: this.settings.modelRouter?.cheapModel?.trim() || undefined,\n\t\t\tmediumModel: this.settings.modelRouter?.mediumModel?.trim() || undefined,\n\t\t\texpensiveModel: this.settings.modelRouter?.expensiveModel?.trim() || undefined,\n\t\t\tlearningModel: this.settings.modelRouter?.learningModel?.trim() || undefined,\n\t\t\tjudgeEnabled: this.settings.modelRouter?.judgeEnabled ?? true,\n\t\t\tfitnessGate: this.settings.modelRouter?.fitnessGate ?? false,\n\t\t\tjudgeModel: this.settings.modelRouter?.judgeModel?.trim() || undefined,\n\t\t\texecutorModel: this.settings.modelRouter?.executorModel?.trim() || undefined,\n\t\t\tcheapThinking: isThinkingLevel(this.settings.modelRouter?.cheapThinking)\n\t\t\t\t? this.settings.modelRouter?.cheapThinking\n\t\t\t\t: undefined,\n\t\t\tmediumThinking: isThinkingLevel(this.settings.modelRouter?.mediumThinking)\n\t\t\t\t? this.settings.modelRouter?.mediumThinking\n\t\t\t\t: undefined,\n\t\t\texpensiveThinking: isThinkingLevel(this.settings.modelRouter?.expensiveThinking)\n\t\t\t\t? this.settings.modelRouter?.expensiveThinking\n\t\t\t\t: undefined,\n\t\t\texecutorThinking: isThinkingLevel(this.settings.modelRouter?.executorThinking)\n\t\t\t\t? this.settings.modelRouter?.executorThinking\n\t\t\t\t: undefined,\n\t\t\tjudgeThinking: isThinkingLevel(this.settings.modelRouter?.judgeThinking)\n\t\t\t\t? this.settings.modelRouter?.judgeThinking\n\t\t\t\t: undefined,\n\t\t};\n\t\treturn {\n\t\t\tenabled: profileSettings?.enabled ?? settings.enabled,\n\t\t\tcheapModel: profileSettings?.cheapModel?.trim() || settings.cheapModel,\n\t\t\tmediumModel: profileSettings?.mediumModel?.trim() || settings.mediumModel,\n\t\t\texpensiveModel: profileSettings?.expensiveModel?.trim() || settings.expensiveModel,\n\t\t\tlearningModel: profileSettings?.learningModel?.trim() || settings.learningModel,\n\t\t\tjudgeEnabled: profileSettings?.judgeEnabled ?? settings.judgeEnabled,\n\t\t\tfitnessGate: profileSettings?.fitnessGate ?? settings.fitnessGate,\n\t\t\tjudgeModel: profileSettings?.judgeModel?.trim() || settings.judgeModel,\n\t\t\texecutorModel: profileSettings?.executorModel?.trim() || settings.executorModel,\n\t\t\tcheapThinking: profileSettings?.cheapThinking ?? settings.cheapThinking,\n\t\t\tmediumThinking: profileSettings?.mediumThinking ?? settings.mediumThinking,\n\t\t\texpensiveThinking: profileSettings?.expensiveThinking ?? settings.expensiveThinking,\n\t\t\texecutorThinking: profileSettings?.executorThinking ?? settings.executorThinking,\n\t\t\tjudgeThinking: profileSettings?.judgeThinking ?? settings.judgeThinking,\n\t\t};\n\t}\n\n\tsetModelRouterSettings(settings: ModelRouterSettings, scope: SettingsScope = \"global\"): void {\n\t\tconst normalized: ModelRouterSettings = {\n\t\t\tenabled: settings.enabled ?? false,\n\t\t\tcheapModel: settings.cheapModel?.trim() || undefined,\n\t\t\tmediumModel: settings.mediumModel?.trim() || undefined,\n\t\t\texpensiveModel: settings.expensiveModel?.trim() || undefined,\n\t\t\tlearningModel: settings.learningModel?.trim() || undefined,\n\t\t\tjudgeEnabled: settings.judgeEnabled ?? true,\n\t\t\tfitnessGate: settings.fitnessGate ?? false,\n\t\t\tjudgeModel: settings.judgeModel?.trim() || undefined,\n\t\t\texecutorModel: settings.executorModel?.trim() || undefined,\n\t\t\tcheapThinking: isThinkingLevel(settings.cheapThinking) ? settings.cheapThinking : undefined,\n\t\t\tmediumThinking: isThinkingLevel(settings.mediumThinking) ? settings.mediumThinking : undefined,\n\t\t\texpensiveThinking: isThinkingLevel(settings.expensiveThinking) ? settings.expensiveThinking : undefined,\n\t\t\texecutorThinking: isThinkingLevel(settings.executorThinking) ? settings.executorThinking : undefined,\n\t\t\tjudgeThinking: isThinkingLevel(settings.judgeThinking) ? settings.judgeThinking : undefined,\n\t\t};\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.modelRouter = normalized;\n\t\t\tthis.markProjectModified(\"modelRouter\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.modelRouter = normalized;\n\t\tthis.markModified(\"modelRouter\");\n\t\tthis.save();\n\t}\n\n\t/** Configured auxiliary summarizer model id, or \"auto\" (default) to pick the cheapest authed model. */\n\tgetCompactionModel(): string {\n\t\treturn this.settings.compaction?.model ?? \"auto\";\n\t}\n\n\tgetCompactionSettings(): {\n\t\tenabled: boolean;\n\t\treserveTokens: number;\n\t\tkeepRecentTokens: number;\n\t\ttriggerPercent: number;\n\t} {\n\t\treturn {\n\t\t\tenabled: this.getCompactionEnabled(),\n\t\t\treserveTokens: this.getCompactionReserveTokens(),\n\t\t\tkeepRecentTokens: this.getCompactionKeepRecentTokens(),\n\t\t\ttriggerPercent: this.getCompactionTriggerPercent(),\n\t\t};\n\t}\n\n\tgetScoutSettings(): { enabled: boolean; model: string } {\n\t\treturn {\n\t\t\tenabled: this.settings.scout?.enabled ?? false,\n\t\t\tmodel: this.settings.scout?.model ?? \"auto\",\n\t\t};\n\t}\n\n\tsetScoutSettings(settings: ScoutSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.scout = { ...settings };\n\t\t\tthis.markProjectModified(\"scout\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\t\tthis.globalSettings.scout = { ...settings };\n\t\tthis.markModified(\"scout\");\n\t\tthis.save();\n\t}\n\n\tgetContextGcSettings(): {\n\t\tenabled: boolean;\n\t\tpreserveRecentMessages: number;\n\t\tminToolResultChars: number;\n\t\ttools: string[];\n\t\tsemanticMemory: {\n\t\t\tenabled: boolean;\n\t\t\tpreserveRecentPages: number;\n\t\t\tminChars: number;\n\t\t\tmarkers: string[];\n\t\t};\n\t} {\n\t\treturn {\n\t\t\tenabled: this.settings.contextGc?.enabled ?? true,\n\t\t\tpreserveRecentMessages: this.settings.contextGc?.preserveRecentMessages ?? 8,\n\t\t\tminToolResultChars: this.settings.contextGc?.minToolResultChars ?? 1200,\n\t\t\ttools: this.settings.contextGc?.tools ?? [\n\t\t\t\t\"read\",\n\t\t\t\t\"bash\",\n\t\t\t\t\"python\",\n\t\t\t\t\"powershell\",\n\t\t\t\t\"rg\",\n\t\t\t\t\"grep\",\n\t\t\t\t\"find\",\n\t\t\t\t\"ls\",\n\t\t\t\t\"skill_open\",\n\t\t\t\t\"automata_graph_status\",\n\t\t\t\t\"automata_graph_search\",\n\t\t\t\t\"automata_graph_query\",\n\t\t\t\t\"automata_graph_neighbors\",\n\t\t\t\t\"automata_graph_path\",\n\t\t\t\t\"automata_graph_pointer_pack\",\n\t\t\t\t\"learning_query_memory\",\n\t\t\t\t\"subagent\",\n\t\t\t\t\"delegate\",\n\t\t\t\t\"task_steps\",\n\t\t\t\t\"task_background\",\n\t\t\t\t\"task_goal\",\n\t\t\t\t\"run_ledger\",\n\t\t\t\t\"context_headroom_retrieve\",\n\t\t\t\t\"headroom_retrieve\",\n\t\t\t],\n\t\t\tsemanticMemory: {\n\t\t\t\tenabled: this.settings.contextGc?.semanticMemory?.enabled ?? true,\n\t\t\t\tpreserveRecentPages: this.settings.contextGc?.semanticMemory?.preserveRecentPages ?? 1,\n\t\t\t\tminChars: this.settings.contextGc?.semanticMemory?.minChars ?? 900,\n\t\t\t\tmarkers: this.settings.contextGc?.semanticMemory?.markers ?? [\n\t\t\t\t\t// Generic recall-page marker the bundled default provider (transcript-recall)\n\t\t\t\t\t// emits; must be present here because a non-empty settings list fully replaces\n\t\t\t\t\t// the context-gc code default that already includes it.\n\t\t\t\t\t\"<memory_context\",\n\t\t\t\t\t\"<automata_context\",\n\t\t\t\t\t\"<automata_response\",\n\t\t\t\t\t\"<automata_query\",\n\t\t\t\t\t\"<automata_fetch\",\n\t\t\t\t\t\"<memory_lifecycle_audit\",\n\t\t\t\t\t\"<memory_lifecycle_purge\",\n\t\t\t\t\t\"<automata_doctor\",\n\t\t\t\t\t\"<automata_optimizer\",\n\t\t\t\t\t\"<automata_mesh\",\n\t\t\t\t],\n\t\t\t},\n\t\t};\n\t}\n\n\tgetContextPromptEnforcementSettings(): { enabled: boolean; preserveRecentMessages: number; minChars: number } {\n\t\treturn {\n\t\t\tenabled: this.settings.contextPolicy?.enforcement?.enabled ?? false,\n\t\t\tpreserveRecentMessages: this.settings.contextPolicy?.enforcement?.preserveRecentMessages ?? 8,\n\t\t\tminChars: this.settings.contextPolicy?.enforcement?.minChars ?? 1200,\n\t\t};\n\t}\n\n\tgetContextCurationSettings(): { enabled: boolean; model?: string; maxJobsPerTurn: number } {\n\t\treturn {\n\t\t\tenabled: this.settings.contextPolicy?.curation?.enabled ?? false,\n\t\t\tmodel: this.settings.contextPolicy?.curation?.model?.trim() || undefined,\n\t\t\tmaxJobsPerTurn: sanitizeIntegerSetting(this.settings.contextPolicy?.curation?.maxJobsPerTurn, 4, 1, 16),\n\t\t};\n\t}\n\n\tsetContextCurationSettings(settings: ContextCurationSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.contextPolicy = { ...projectSettings.contextPolicy, curation: { ...settings } };\n\t\t\tthis.markProjectModified(\"contextPolicy\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\t\tthis.globalSettings.contextPolicy = { ...this.globalSettings.contextPolicy, curation: { ...settings } };\n\t\tthis.markModified(\"contextPolicy\");\n\t\tthis.save();\n\t}\n\n\tsetContextPromptEnforcementSettings(\n\t\tsettings: ContextPromptEnforcementSettings,\n\t\tscope: SettingsScope = \"global\",\n\t): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.contextPolicy = { ...projectSettings.contextPolicy, enforcement: { ...settings } };\n\t\t\tthis.markProjectModified(\"contextPolicy\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.contextPolicy = { ...this.globalSettings.contextPolicy, enforcement: { ...settings } };\n\t\tthis.markModified(\"contextPolicy\");\n\t\tthis.save();\n\t}\n\n\tgetMemoryRetrievalSettings(): {\n\t\tenabled: boolean;\n\t\tmaxResults: number;\n\t\tincludeInPrompt: boolean;\n\t\tallowExternalEgress: boolean;\n\t} {\n\t\treturn {\n\t\t\tenabled: this.settings.contextPolicy?.memory?.enabled ?? true,\n\t\t\tmaxResults: clampMemoryRetrievalMaxResults(\n\t\t\t\tthis.settings.contextPolicy?.memory?.maxResults ?? MEMORY_RETRIEVAL_MAX_RESULTS_DEFAULT,\n\t\t\t),\n\t\t\tincludeInPrompt: this.settings.contextPolicy?.memory?.includeInPrompt ?? true,\n\t\t\tallowExternalEgress: this.settings.contextPolicy?.memory?.allowExternalEgress === true,\n\t\t};\n\t}\n\n\tsetMemoryRetrievalSettings(settings: MemoryRetrievalSettings, scope: SettingsScope = \"global\"): void {\n\t\tconst normalized: MemoryRetrievalSettings = {\n\t\t\tenabled: settings.enabled,\n\t\t\tmaxResults:\n\t\t\t\tsettings.maxResults === undefined ? undefined : clampMemoryRetrievalMaxResults(settings.maxResults),\n\t\t\tincludeInPrompt: settings.includeInPrompt,\n\t\t\tallowExternalEgress: settings.allowExternalEgress,\n\t\t};\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.contextPolicy = { ...projectSettings.contextPolicy, memory: normalized };\n\t\t\tthis.markProjectModified(\"contextPolicy\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.contextPolicy = { ...this.globalSettings.contextPolicy, memory: normalized };\n\t\tthis.markModified(\"contextPolicy\");\n\t\tthis.save();\n\t}\n\n\tgetBranchSummarySettings(): { reserveTokens: number; skipPrompt: boolean } {\n\t\treturn {\n\t\t\treserveTokens: this.settings.branchSummary?.reserveTokens ?? 16384,\n\t\t\tskipPrompt: this.settings.branchSummary?.skipPrompt ?? false,\n\t\t};\n\t}\n\n\tgetBranchSummarySkipPrompt(): boolean {\n\t\treturn this.settings.branchSummary?.skipPrompt ?? false;\n\t}\n\n\tgetRetryEnabled(): boolean {\n\t\treturn this.settings.retry?.enabled ?? true;\n\t}\n\n\tsetRetryEnabled(enabled: boolean): void {\n\t\tif (!this.globalSettings.retry) {\n\t\t\tthis.globalSettings.retry = {};\n\t\t}\n\t\tthis.globalSettings.retry.enabled = enabled;\n\t\tthis.markModified(\"retry\", \"enabled\");\n\t\tthis.save();\n\t}\n\n\tgetRetrySettings(): { enabled: boolean; maxRetries: number; baseDelayMs: number } {\n\t\treturn {\n\t\t\tenabled: this.getRetryEnabled(),\n\t\t\tmaxRetries: this.settings.retry?.maxRetries ?? 3,\n\t\t\tbaseDelayMs: this.settings.retry?.baseDelayMs ?? 2000,\n\t\t};\n\t}\n\n\t/**\n\t * Stream-stall watchdog bounds (pi-agent-core reliability/watchdogs.ts). Returns only the\n\t * fields the user set, validated; unset fields fall back to DEFAULT_STREAM_IDLE at the\n\t * wiring site (agent-session constructor). Resolved per request, so edits apply live.\n\t */\n\tgetStreamStallSettings(): { connectMs?: number; activeIdleMs?: number; quietIdleMs?: number } {\n\t\tconst stall = this.settings.retry?.stall;\n\t\treturn {\n\t\t\tconnectMs: parseStallBoundMs(stall?.connectMs, \"retry.stall.connectMs\"),\n\t\t\tactiveIdleMs: parseStallBoundMs(stall?.activeIdleMs, \"retry.stall.activeIdleMs\"),\n\t\t\tquietIdleMs: parseStallBoundMs(stall?.quietIdleMs, \"retry.stall.quietIdleMs\"),\n\t\t};\n\t}\n\n\tgetHttpIdleTimeoutMs(): number {\n\t\treturn parseTimeoutSetting(this.settings.httpIdleTimeoutMs, \"httpIdleTimeoutMs\") ?? DEFAULT_HTTP_IDLE_TIMEOUT_MS;\n\t}\n\n\tsetHttpIdleTimeoutMs(timeoutMs: number): void {\n\t\tif (!Number.isFinite(timeoutMs) || timeoutMs < 0) {\n\t\t\tthrow new Error(`Invalid httpIdleTimeoutMs setting: ${String(timeoutMs)}`);\n\t\t}\n\t\tthis.globalSettings.httpIdleTimeoutMs = Math.floor(timeoutMs);\n\t\tthis.markModified(\"httpIdleTimeoutMs\");\n\t\tthis.save();\n\t}\n\n\tgetProviderRetrySettings(): { timeoutMs?: number; maxRetries?: number; maxRetryDelayMs: number } {\n\t\treturn {\n\t\t\ttimeoutMs: this.settings.retry?.provider?.timeoutMs,\n\t\t\tmaxRetries: this.settings.retry?.provider?.maxRetries,\n\t\t\tmaxRetryDelayMs: this.settings.retry?.provider?.maxRetryDelayMs ?? 60000,\n\t\t};\n\t}\n\n\tgetWebSocketConnectTimeoutMs(): number | undefined {\n\t\treturn parseTimeoutSetting(this.settings.websocketConnectTimeoutMs, \"websocketConnectTimeoutMs\");\n\t}\n\n\tgetHideThinkingBlock(): boolean {\n\t\treturn this.settings.hideThinkingBlock ?? false;\n\t}\n\n\tsetHideThinkingBlock(hide: boolean): void {\n\t\tthis.globalSettings.hideThinkingBlock = hide;\n\t\tthis.markModified(\"hideThinkingBlock\");\n\t\tthis.save();\n\t}\n\n\tgetShellPath(): string | undefined {\n\t\treturn this.settings.shellPath;\n\t}\n\n\tsetShellPath(path: string | undefined): void {\n\t\tthis.globalSettings.shellPath = path;\n\t\tthis.markModified(\"shellPath\");\n\t\tthis.save();\n\t}\n\n\tgetQuietStartup(): boolean {\n\t\treturn this.settings.quietStartup ?? false;\n\t}\n\n\tsetQuietStartup(quiet: boolean): void {\n\t\tthis.globalSettings.quietStartup = quiet;\n\t\tthis.markModified(\"quietStartup\");\n\t\tthis.save();\n\t}\n\n\tgetShellCommandPrefix(): string | undefined {\n\t\treturn this.settings.shellCommandPrefix;\n\t}\n\n\tsetShellCommandPrefix(prefix: string | undefined): void {\n\t\tthis.globalSettings.shellCommandPrefix = prefix;\n\t\tthis.markModified(\"shellCommandPrefix\");\n\t\tthis.save();\n\t}\n\n\tgetNpmCommand(): string[] | undefined {\n\t\treturn this.settings.npmCommand ? [...this.settings.npmCommand] : undefined;\n\t}\n\n\tsetNpmCommand(command: string[] | undefined): void {\n\t\tthis.globalSettings.npmCommand = command ? [...command] : undefined;\n\t\tthis.markModified(\"npmCommand\");\n\t\tthis.save();\n\t}\n\n\tgetCollapseChangelog(): boolean {\n\t\treturn this.settings.collapseChangelog ?? false;\n\t}\n\n\tsetCollapseChangelog(collapse: boolean): void {\n\t\tthis.globalSettings.collapseChangelog = collapse;\n\t\tthis.markModified(\"collapseChangelog\");\n\t\tthis.save();\n\t}\n\n\tgetEnableInstallTelemetry(): boolean {\n\t\treturn this.settings.enableInstallTelemetry ?? true;\n\t}\n\n\tsetEnableInstallTelemetry(enabled: boolean): void {\n\t\tthis.globalSettings.enableInstallTelemetry = enabled;\n\t\tthis.markModified(\"enableInstallTelemetry\");\n\t\tthis.save();\n\t}\n\n\tgetPackages(): PackageSource[] {\n\t\treturn [...(this.settings.packages ?? [])];\n\t}\n\n\tsetPackages(packages: PackageSource[]): void {\n\t\tthis.globalSettings.packages = packages;\n\t\tthis.markModified(\"packages\");\n\t\tthis.save();\n\t}\n\n\tsetProjectPackages(packages: PackageSource[]): void {\n\t\tthis.updateProjectSettings(\"packages\", (settings) => {\n\t\t\tsettings.packages = packages;\n\t\t});\n\t}\n\n\tgetExtensionPaths(): string[] {\n\t\treturn [...(this.settings.extensions ?? [])];\n\t}\n\n\tsetExtensionPaths(paths: string[]): void {\n\t\tthis.globalSettings.extensions = paths;\n\t\tthis.markModified(\"extensions\");\n\t\tthis.save();\n\t}\n\n\tsetProjectExtensionPaths(paths: string[]): void {\n\t\tthis.updateProjectSettings(\"extensions\", (settings) => {\n\t\t\tsettings.extensions = paths;\n\t\t});\n\t}\n\n\tgetSkillPaths(): string[] {\n\t\treturn [...(this.settings.skills ?? [])];\n\t}\n\n\tsetSkillPaths(paths: string[]): void {\n\t\tthis.globalSettings.skills = paths;\n\t\tthis.markModified(\"skills\");\n\t\tthis.save();\n\t}\n\n\tsetProjectSkillPaths(paths: string[]): void {\n\t\tthis.updateProjectSettings(\"skills\", (settings) => {\n\t\t\tsettings.skills = paths;\n\t\t});\n\t}\n\n\tgetPromptTemplatePaths(): string[] {\n\t\treturn [...(this.settings.prompts ?? [])];\n\t}\n\n\tsetPromptTemplatePaths(paths: string[]): void {\n\t\tthis.globalSettings.prompts = paths;\n\t\tthis.markModified(\"prompts\");\n\t\tthis.save();\n\t}\n\n\tsetProjectPromptTemplatePaths(paths: string[]): void {\n\t\tthis.updateProjectSettings(\"prompts\", (settings) => {\n\t\t\tsettings.prompts = paths;\n\t\t});\n\t}\n\n\tgetThemePaths(): string[] {\n\t\treturn [...(this.settings.themes ?? [])];\n\t}\n\n\tsetThemePaths(paths: string[]): void {\n\t\tthis.globalSettings.themes = paths;\n\t\tthis.markModified(\"themes\");\n\t\tthis.save();\n\t}\n\n\tsetProjectThemePaths(paths: string[]): void {\n\t\tthis.updateProjectSettings(\"themes\", (settings) => {\n\t\t\tsettings.themes = paths;\n\t\t});\n\t}\n\n\tgetEnableSkillCommands(): boolean {\n\t\treturn this.settings.enableSkillCommands ?? true;\n\t}\n\n\tsetEnableSkillCommands(enabled: boolean): void {\n\t\tthis.globalSettings.enableSkillCommands = enabled;\n\t\tthis.markModified(\"enableSkillCommands\");\n\t\tthis.save();\n\t}\n\n\tgetThinkingBudgets(): ThinkingBudgetsSettings | undefined {\n\t\treturn this.settings.thinkingBudgets;\n\t}\n\n\tgetShowImages(): boolean {\n\t\treturn this.settings.terminal?.showImages ?? true;\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tif (!this.globalSettings.terminal) {\n\t\t\tthis.globalSettings.terminal = {};\n\t\t}\n\t\tthis.globalSettings.terminal.showImages = show;\n\t\tthis.markModified(\"terminal\", \"showImages\");\n\t\tthis.save();\n\t}\n\n\tgetImageWidthCells(): number {\n\t\tconst width = this.settings.terminal?.imageWidthCells;\n\t\tif (typeof width !== \"number\" || !Number.isFinite(width)) {\n\t\t\treturn 60;\n\t\t}\n\t\treturn Math.max(1, Math.floor(width));\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tif (!this.globalSettings.terminal) {\n\t\t\tthis.globalSettings.terminal = {};\n\t\t}\n\t\tthis.globalSettings.terminal.imageWidthCells = Math.max(1, Math.floor(width));\n\t\tthis.markModified(\"terminal\", \"imageWidthCells\");\n\t\tthis.save();\n\t}\n\n\tgetClearOnShrink(): boolean {\n\t\t// Settings takes precedence, then env var, then default false\n\t\tif (this.settings.terminal?.clearOnShrink !== undefined) {\n\t\t\treturn this.settings.terminal.clearOnShrink;\n\t\t}\n\t\treturn process.env.PI_CLEAR_ON_SHRINK === \"1\";\n\t}\n\n\tsetClearOnShrink(enabled: boolean): void {\n\t\tif (!this.globalSettings.terminal) {\n\t\t\tthis.globalSettings.terminal = {};\n\t\t}\n\t\tthis.globalSettings.terminal.clearOnShrink = enabled;\n\t\tthis.markModified(\"terminal\", \"clearOnShrink\");\n\t\tthis.save();\n\t}\n\n\tgetShowTerminalProgress(): boolean {\n\t\treturn this.settings.terminal?.showTerminalProgress ?? false;\n\t}\n\n\tsetShowTerminalProgress(enabled: boolean): void {\n\t\tif (!this.globalSettings.terminal) {\n\t\t\tthis.globalSettings.terminal = {};\n\t\t}\n\t\tthis.globalSettings.terminal.showTerminalProgress = enabled;\n\t\tthis.markModified(\"terminal\", \"showTerminalProgress\");\n\t\tthis.save();\n\t}\n\n\tgetImageAutoResize(): boolean {\n\t\treturn this.settings.images?.autoResize ?? true;\n\t}\n\n\tsetImageAutoResize(enabled: boolean): void {\n\t\tif (!this.globalSettings.images) {\n\t\t\tthis.globalSettings.images = {};\n\t\t}\n\t\tthis.globalSettings.images.autoResize = enabled;\n\t\tthis.markModified(\"images\", \"autoResize\");\n\t\tthis.save();\n\t}\n\n\tgetBlockImages(): boolean {\n\t\treturn this.settings.images?.blockImages ?? false;\n\t}\n\n\tsetBlockImages(blocked: boolean): void {\n\t\tif (!this.globalSettings.images) {\n\t\t\tthis.globalSettings.images = {};\n\t\t}\n\t\tthis.globalSettings.images.blockImages = blocked;\n\t\tthis.markModified(\"images\", \"blockImages\");\n\t\tthis.save();\n\t}\n\n\tgetEnabledModels(): string[] | undefined {\n\t\treturn this.settings.enabledModels;\n\t}\n\n\tsetEnabledModels(patterns: string[] | undefined): void {\n\t\tthis.globalSettings.enabledModels = patterns;\n\t\tthis.markModified(\"enabledModels\");\n\t\tthis.save();\n\t}\n\n\tgetDoubleEscapeAction(): \"fork\" | \"tree\" | \"none\" {\n\t\treturn this.settings.doubleEscapeAction ?? \"tree\";\n\t}\n\n\tsetDoubleEscapeAction(action: \"fork\" | \"tree\" | \"none\"): void {\n\t\tthis.globalSettings.doubleEscapeAction = action;\n\t\tthis.markModified(\"doubleEscapeAction\");\n\t\tthis.save();\n\t}\n\n\tgetTreeFilterMode(): \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\" {\n\t\tconst mode = this.settings.treeFilterMode;\n\t\tconst valid = [\"default\", \"no-tools\", \"user-only\", \"labeled-only\", \"all\"];\n\t\treturn mode && valid.includes(mode) ? mode : \"default\";\n\t}\n\n\tsetTreeFilterMode(mode: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\"): void {\n\t\tthis.globalSettings.treeFilterMode = mode;\n\t\tthis.markModified(\"treeFilterMode\");\n\t\tthis.save();\n\t}\n\n\tgetShowHardwareCursor(): boolean {\n\t\treturn this.settings.showHardwareCursor ?? process.env.PI_HARDWARE_CURSOR === \"1\";\n\t}\n\n\tsetShowHardwareCursor(enabled: boolean): void {\n\t\tthis.globalSettings.showHardwareCursor = enabled;\n\t\tthis.markModified(\"showHardwareCursor\");\n\t\tthis.save();\n\t}\n\n\tgetEditorPaddingX(): number {\n\t\treturn this.settings.editorPaddingX ?? 0;\n\t}\n\n\tsetEditorPaddingX(padding: number): void {\n\t\tthis.globalSettings.editorPaddingX = Math.max(0, Math.min(3, Math.floor(padding)));\n\t\tthis.markModified(\"editorPaddingX\");\n\t\tthis.save();\n\t}\n\n\tgetAutocompleteMaxVisible(): number {\n\t\treturn this.settings.autocompleteMaxVisible ?? 5;\n\t}\n\n\tsetAutocompleteMaxVisible(maxVisible: number): void {\n\t\tthis.globalSettings.autocompleteMaxVisible = Math.max(3, Math.min(20, Math.floor(maxVisible)));\n\t\tthis.markModified(\"autocompleteMaxVisible\");\n\t\tthis.save();\n\t}\n\n\tgetCodeBlockIndent(): string {\n\t\treturn this.settings.markdown?.codeBlockIndent ?? \" \";\n\t}\n\n\tgetWarnings(): WarningSettings {\n\t\treturn { ...(this.settings.warnings ?? {}) };\n\t}\n\n\tsetWarnings(warnings: WarningSettings): void {\n\t\tthis.globalSettings.warnings = { ...warnings };\n\t\tthis.markModified(\"warnings\");\n\t\tthis.save();\n\t}\n\n\tgetSelfModificationSettings(): { enabled: boolean; sourcePath?: string; sourcePaths?: string[] } {\n\t\treturn {\n\t\t\tenabled: this.settings.selfModification?.enabled ?? false,\n\t\t\tsourcePath: this.settings.selfModification?.sourcePath,\n\t\t\tsourcePaths: this.settings.selfModification?.sourcePaths,\n\t\t};\n\t}\n\n\tsetSelfModificationSettings(settings: SelfModificationSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tconst existing = projectSettings.selfModification;\n\t\t\tprojectSettings.selfModification = {\n\t\t\t\t...existing,\n\t\t\t\t...settings,\n\t\t\t\tsourcePaths: settings.sourcePaths ?? existing?.sourcePaths,\n\t\t\t};\n\t\t\tthis.markProjectModified(\"selfModification\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tconst existing = this.globalSettings.selfModification;\n\t\tthis.globalSettings.selfModification = {\n\t\t\t...existing,\n\t\t\t...settings,\n\t\t\tsourcePaths: settings.sourcePaths ?? existing?.sourcePaths,\n\t\t};\n\t\tthis.markModified(\"selfModification\");\n\t\tthis.save();\n\t}\n\n\tgetAutonomySettings(): Required<AutonomySettings> {\n\t\tconst mode = this.settings.autonomy?.mode;\n\t\tconst configuredMaxStallTurns = this.settings.autonomy?.maxStallTurns;\n\t\tconst configuredGoalContinueTurns = this.settings.autonomy?.goalContinueTurns;\n\t\tconst configuredGoalContinueMaxWallClockMinutes = this.settings.autonomy?.goalContinueMaxWallClockMinutes;\n\t\tconst configuredGoalAutoContinue = this.settings.autonomy?.goalAutoContinue;\n\t\tconst configuredGoalAutoContinueDelayMs = this.settings.autonomy?.goalAutoContinueDelayMs;\n\n\t\tconst maxStallTurns = sanitizeIntegerSetting(\n\t\t\tconfiguredMaxStallTurns,\n\t\t\tDEFAULT_AUTONOMY_MAX_STALL_TURNS,\n\t\t\t0,\n\t\t\tMAX_GOAL_CONTINUE_MAX_STALL_TURNS,\n\t\t);\n\t\tconst goalContinueTurns = sanitizeIntegerSetting(\n\t\t\tconfiguredGoalContinueTurns,\n\t\t\tDEFAULT_AUTONOMY_GOAL_CONTINUE_TURNS,\n\t\t\t1,\n\t\t\tMAX_GOAL_CONTINUE_MAX_TURNS,\n\t\t);\n\t\tconst goalContinueMaxWallClockMinutes = sanitizeIntegerSetting(\n\t\t\tconfiguredGoalContinueMaxWallClockMinutes,\n\t\t\tDEFAULT_AUTONOMY_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES,\n\t\t\t0,\n\t\t\tMAX_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES,\n\t\t);\n\t\tconst goalAutoContinueDelayMs = sanitizeIntegerSetting(\n\t\t\tconfiguredGoalAutoContinueDelayMs,\n\t\t\tDEFAULT_AUTONOMY_GOAL_AUTO_CONTINUE_DELAY_MS,\n\t\t\t0,\n\t\t\tMAX_GOAL_AUTO_CONTINUE_DELAY_MS,\n\t\t);\n\n\t\treturn {\n\t\t\tmode: mode === \"safe\" || mode === \"balanced\" || mode === \"full\" ? mode : \"off\",\n\t\t\tmaxStallTurns,\n\t\t\tgoalContinueTurns,\n\t\t\tgoalContinueMaxWallClockMinutes,\n\t\t\tgoalAutoContinue:\n\t\t\t\ttypeof configuredGoalAutoContinue === \"boolean\"\n\t\t\t\t\t? configuredGoalAutoContinue\n\t\t\t\t\t: DEFAULT_AUTONOMY_GOAL_AUTO_CONTINUE,\n\t\t\tgoalAutoContinueDelayMs,\n\t\t};\n\t}\n\n\tsetAutonomySettings(settings: AutonomySettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.autonomy = { ...settings };\n\t\t\tthis.markProjectModified(\"autonomy\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.autonomy = { ...settings };\n\t\tthis.markModified(\"autonomy\");\n\t\tthis.save();\n\t}\n\n\tgetResearchLaneSettings(): ResolvedResearchLaneSettings {\n\t\tconst configured = this.settings.researchLane ?? {};\n\n\t\tconst resolved: ResolvedResearchLaneSettings = {\n\t\t\tenabled: typeof configured.enabled === \"boolean\" ? configured.enabled : DEFAULT_RESEARCH_LANE_ENABLED,\n\t\t\tmaxUsd: sanitizeNumberSetting(configured.maxUsd, DEFAULT_RESEARCH_LANE_MAX_USD, 0, MAX_RESEARCH_LANE_MAX_USD),\n\t\t\tmaxSources: sanitizeIntegerSetting(\n\t\t\t\tconfigured.maxSources,\n\t\t\t\tDEFAULT_RESEARCH_LANE_MAX_SOURCES,\n\t\t\t\t1,\n\t\t\t\tMAX_RESEARCH_LANE_MAX_SOURCES,\n\t\t\t),\n\t\t\tmaxFindings: sanitizeIntegerSetting(\n\t\t\t\tconfigured.maxFindings,\n\t\t\t\tDEFAULT_RESEARCH_LANE_MAX_FINDINGS,\n\t\t\t\t1,\n\t\t\t\tMAX_RESEARCH_LANE_MAX_FINDINGS,\n\t\t\t),\n\t\t\tmaxWallClockMs: sanitizeIntegerSetting(\n\t\t\t\tconfigured.maxWallClockMs,\n\t\t\t\tDEFAULT_RESEARCH_LANE_MAX_WALL_CLOCK_MS,\n\t\t\t\t0,\n\t\t\t\tMAX_RESEARCH_LANE_MAX_WALL_CLOCK_MS,\n\t\t\t),\n\t\t\tidleDelayMs: sanitizeIntegerSetting(\n\t\t\t\tconfigured.idleDelayMs,\n\t\t\t\tDEFAULT_RESEARCH_LANE_IDLE_DELAY_MS,\n\t\t\t\t0,\n\t\t\t\tMAX_RESEARCH_LANE_IDLE_DELAY_MS,\n\t\t\t),\n\t\t\tmaxRunsPerSession: sanitizeIntegerSetting(\n\t\t\t\tconfigured.maxRunsPerSession,\n\t\t\t\tDEFAULT_RESEARCH_LANE_MAX_RUNS_PER_SESSION,\n\t\t\t\t0,\n\t\t\t\tMAX_RESEARCH_LANE_MAX_RUNS_PER_SESSION,\n\t\t\t),\n\t\t};\n\t\tif (typeof configured.model === \"string\" && configured.model.trim().length > 0) {\n\t\t\tresolved.model = configured.model;\n\t\t}\n\t\tif (typeof configured.profile === \"string\" && configured.profile.trim().length > 0) {\n\t\t\tresolved.profile = configured.profile;\n\t\t}\n\t\tif (typeof configured.systemPrompt === \"string\" && configured.systemPrompt.trim().length > 0) {\n\t\t\tresolved.systemPrompt = configured.systemPrompt;\n\t\t}\n\t\treturn resolved;\n\t}\n\n\tsetResearchLaneSettings(settings: ResearchLaneSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.researchLane = { ...settings };\n\t\t\tthis.markProjectModified(\"researchLane\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.researchLane = { ...settings };\n\t\tthis.markModified(\"researchLane\");\n\t\tthis.save();\n\t}\n\n\tgetWorkerDelegationSettings(): ResolvedWorkerDelegationSettings {\n\t\tconst configured = this.settings.workerDelegation ?? {};\n\n\t\tconst resolved: ResolvedWorkerDelegationSettings = {\n\t\t\tenabled: typeof configured.enabled === \"boolean\" ? configured.enabled : DEFAULT_WORKER_DELEGATION_ENABLED,\n\t\t\tmaxUsd: sanitizeNumberSetting(\n\t\t\t\tconfigured.maxUsd,\n\t\t\t\tDEFAULT_WORKER_DELEGATION_MAX_USD,\n\t\t\t\t0,\n\t\t\t\tMAX_WORKER_DELEGATION_MAX_USD,\n\t\t\t),\n\t\t\tmaxWallClockMs: sanitizeIntegerSetting(\n\t\t\t\tconfigured.maxWallClockMs,\n\t\t\t\tDEFAULT_WORKER_DELEGATION_MAX_WALL_CLOCK_MS,\n\t\t\t\t0,\n\t\t\t\tMAX_WORKER_DELEGATION_MAX_WALL_CLOCK_MS,\n\t\t\t),\n\t\t\twriteEnabled: configured.writeEnabled === true,\n\t\t\twritePaths: Array.isArray(configured.writePaths)\n\t\t\t\t? configured.writePaths.filter((entry): entry is string => typeof entry === \"string\" && entry.length > 0)\n\t\t\t\t: [],\n\t\t\tmaxConcurrent: sanitizeIntegerSetting(configured.maxConcurrent, 1, 1, 3),\n\t\t};\n\t\tif (typeof configured.model === \"string\" && configured.model.trim().length > 0) {\n\t\t\tresolved.model = configured.model;\n\t\t}\n\t\tif (typeof configured.profile === \"string\" && configured.profile.trim().length > 0) {\n\t\t\tresolved.profile = configured.profile;\n\t\t}\n\t\tif (typeof configured.systemPrompt === \"string\" && configured.systemPrompt.trim().length > 0) {\n\t\t\tresolved.systemPrompt = configured.systemPrompt;\n\t\t}\n\t\treturn resolved;\n\t}\n\n\tsetWorkerDelegationSettings(settings: WorkerDelegationSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.workerDelegation = { ...settings };\n\t\t\tthis.markProjectModified(\"workerDelegation\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.workerDelegation = { ...settings };\n\t\tthis.markModified(\"workerDelegation\");\n\t\tthis.save();\n\t}\n\n\tgetLearningPolicySettings(): ResolvedLearningPolicySettings {\n\t\tconst configured = this.settings.learningPolicy ?? {};\n\n\t\tconst allowedLayers = Array.isArray(configured.allowedAutoApplyLayers)\n\t\t\t? configured.allowedAutoApplyLayers.filter(\n\t\t\t\t\t(layer): layer is LearningPolicyLayer =>\n\t\t\t\t\t\ttypeof layer === \"string\" &&\n\t\t\t\t\t\t[\"memory\", \"skill\", \"prompt\", \"extension\", \"tool\", \"script\", \"settings\", \"source\"].includes(layer),\n\t\t\t\t)\n\t\t\t: [...DEFAULT_LEARNING_POLICY_ALLOWED_AUTO_APPLY_LAYERS];\n\n\t\treturn {\n\t\t\tenabled: typeof configured.enabled === \"boolean\" ? configured.enabled : DEFAULT_LEARNING_POLICY_ENABLED,\n\t\t\tautoApplyEnabled:\n\t\t\t\ttypeof configured.autoApplyEnabled === \"boolean\"\n\t\t\t\t\t? configured.autoApplyEnabled\n\t\t\t\t\t: DEFAULT_LEARNING_POLICY_AUTO_APPLY_ENABLED,\n\t\t\tconfidenceThreshold: sanitizeIntegerSetting(\n\t\t\t\tconfigured.confidenceThreshold,\n\t\t\t\tDEFAULT_LEARNING_POLICY_CONFIDENCE_THRESHOLD,\n\t\t\t\t0,\n\t\t\t\t100,\n\t\t\t),\n\t\t\tminObservations: sanitizeIntegerSetting(\n\t\t\t\tconfigured.minObservations,\n\t\t\t\tDEFAULT_LEARNING_POLICY_MIN_OBSERVATIONS,\n\t\t\t\t0,\n\t\t\t\t100,\n\t\t\t),\n\t\t\tallowedAutoApplyLayers: allowedLayers,\n\t\t\trequireRollbackPlan:\n\t\t\t\ttypeof configured.requireRollbackPlan === \"boolean\" ? configured.requireRollbackPlan : true,\n\t\t\treflectionSourceConfidence: sanitizeIntegerSetting(\n\t\t\t\tconfigured.reflectionSourceConfidence,\n\t\t\t\tDEFAULT_LEARNING_POLICY_REFLECTION_SOURCE_CONFIDENCE,\n\t\t\t\t0,\n\t\t\t\t100,\n\t\t\t),\n\t\t\tautoApplySupersessions:\n\t\t\t\ttypeof configured.autoApplySupersessions === \"boolean\"\n\t\t\t\t\t? configured.autoApplySupersessions\n\t\t\t\t\t: DEFAULT_LEARNING_POLICY_AUTO_APPLY_SUPERSESSIONS,\n\t\t};\n\t}\n\n\tgetToolkitScripts(): ToolkitScript[] {\n\t\tconst configured = this.settings.toolkit?.scripts;\n\t\tif (!Array.isArray(configured)) return [];\n\t\treturn configured.filter(\n\t\t\t(script): script is ToolkitScript =>\n\t\t\t\tBoolean(script) &&\n\t\t\t\ttypeof script.name === \"string\" &&\n\t\t\t\tscript.name.length > 0 &&\n\t\t\t\ttypeof script.description === \"string\" &&\n\t\t\t\ttypeof script.path === \"string\" &&\n\t\t\t\t(script.runner === \"uv\" || script.runner === \"powershell\" || script.runner === \"bash\"),\n\t\t);\n\t}\n\n\tsetToolkitSettings(settings: ToolkitSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.toolkit = { ...settings };\n\t\t\tthis.markProjectModified(\"toolkit\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.toolkit = { ...settings };\n\t\tthis.markModified(\"toolkit\");\n\t\tthis.save();\n\t}\n\n\tgetModelCapabilitySettings(): Required<ModelCapabilitySettings> {\n\t\tconst configured = this.settings.modelCapability?.mode;\n\t\tconst mode: ModelCapabilityMode =\n\t\t\tconfigured === \"auto\" ||\n\t\t\tconfigured === \"off\" ||\n\t\t\tconfigured === \"full\" ||\n\t\t\tconfigured === \"lean\" ||\n\t\t\tconfigured === \"minimal\" ||\n\t\t\tconfigured === \"chat\"\n\t\t\t\t? configured\n\t\t\t\t: DEFAULT_MODEL_CAPABILITY_MODE;\n\t\treturn { mode };\n\t}\n\n\tsetModelCapabilitySettings(settings: ModelCapabilitySettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.modelCapability = { ...settings };\n\t\t\tthis.markProjectModified(\"modelCapability\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.modelCapability = { ...settings };\n\t\tthis.markModified(\"modelCapability\");\n\t\tthis.save();\n\t}\n\n\tsetLearningPolicySettings(settings: LearningPolicySettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.learningPolicy = { ...settings };\n\t\t\tthis.markProjectModified(\"learningPolicy\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.learningPolicy = { ...settings };\n\t\tthis.markModified(\"learningPolicy\");\n\t\tthis.save();\n\t}\n\n\tgetAutoLearnSettings(): AutoLearnSettings {\n\t\tconst settings = this.settings.autoLearn ?? {};\n\t\treturn {\n\t\t\t...settings,\n\t\t\tmodel: settings.model ?? this.getModelRouterSettings().learningModel,\n\t\t\tthinkingLevel: settings.thinkingLevel ?? \"low\",\n\t\t\tcomplexTaskToolCalls: settings.complexTaskToolCalls ?? 12,\n\t\t};\n\t}\n\n\tsetAutoLearnSettings(settings: AutoLearnSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.autoLearn = { ...settings };\n\t\t\tthis.markProjectModified(\"autoLearn\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.autoLearn = { ...settings };\n\t\tthis.markModified(\"autoLearn\");\n\t\tthis.save();\n\t}\n\n\tgetExternalResourceRoots(): string[] {\n\t\treturn this.settings.externalResourceRoots ?? [];\n\t}\n\n\tsetExternalResourceRoots(roots: string[], scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.externalResourceRoots = [...roots];\n\t\t\tthis.markProjectModified(\"externalResourceRoots\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.externalResourceRoots = [...roots];\n\t\tthis.markModified(\"externalResourceRoots\");\n\t\tthis.save();\n\t}\n\n\tgetTrustedResourceRoots(): string[] {\n\t\treturn this.settings.trustedResourceRoots ?? [];\n\t}\n\n\tsetTrustedResourceRoots(roots: string[], scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.trustedResourceRoots = [...roots];\n\t\t\tthis.markProjectModified(\"trustedResourceRoots\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.trustedResourceRoots = [...roots];\n\t\tthis.markModified(\"trustedResourceRoots\");\n\t\tthis.save();\n\t}\n\n\taddTrustedResourceRoot(path: string, scope: SettingsScope = \"global\"): void {\n\t\tconst canonicalPath = this.canonicalizePath(path);\n\t\tif (!canonicalPath) return;\n\n\t\tconst current = this.getTrustedResourceRoots();\n\t\tif (!current.includes(canonicalPath)) {\n\t\t\tthis.setTrustedResourceRoots([...current, canonicalPath], scope);\n\t\t}\n\t}\n\n\tcanonicalizePath(p: string): string | null {\n\t\ttry {\n\t\t\tconst resolved = resolve(p.replace(/^~/, homedir()));\n\t\t\tif (existsSync(resolved)) {\n\t\t\t\treturn realpathSync(resolved);\n\t\t\t}\n\t\t\treturn resolved;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tgetEffectiveExternalResourceRoots(): string[] {\n\t\tconst roots = this.getExternalResourceRoots();\n\t\tconst trusted = this.getTrustedResourceRoots();\n\n\t\tconst canonicalTrusted = new Set(\n\t\t\ttrusted.map((t) => this.canonicalizePath(t)).filter((t): t is string => t !== null),\n\t\t);\n\n\t\tconst effective: string[] = [];\n\t\tfor (const r of roots) {\n\t\t\tconst canonicalR = this.canonicalizePath(r);\n\t\t\tif (canonicalR && canonicalR.trim() !== \"\" && canonicalTrusted.has(canonicalR) && existsSync(canonicalR)) {\n\t\t\t\teffective.push(canonicalR);\n\t\t\t}\n\t\t}\n\t\treturn effective;\n\t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C,CAAC,CAAC;YACrD,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC1B,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC/B,CAAC;YACD,OAAO,QAAQ,CAAC;QACjB,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,IAAI,CAAC;QACb,CAAC;IAAA,CACD;IAED,iCAAiC,GAAa;QAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAE/C,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAC/B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CACnF,CAAC;QAEF,MAAM,SAAS,GAAa,EAAE,CAAC;QAC/B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;YAC5C,IAAI,UAAU,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC1G,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC5B,CAAC;QACF,CAAC;QACD,OAAO,SAAS,CAAC;IAAA,CACjB;CACD","sourcesContent":["import type { Transport } from \"@caupulican/pi-ai\";\nimport { createHash } from \"crypto\";\nimport { existsSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from \"fs\";\nimport { homedir } from \"os\";\nimport { basename, dirname, join, relative, resolve, sep } from \"path\";\nimport lockfile from \"proper-lockfile\";\nimport { CONFIG_DIR_NAME, getAgentDir, getProfilesDir } from \"../config.ts\";\nimport { normalizePath, resolvePath } from \"../utils/paths.ts\";\nimport { configFile } from \"./agent-paths.ts\";\nimport { DEFAULT_CONTEXT_GC_SETTINGS } from \"./context-gc.ts\";\nimport {\n\tDEFAULT_GOAL_AUTO_CONTINUE,\n\tDEFAULT_GOAL_AUTO_CONTINUE_DELAY_MS,\n\tDEFAULT_GOAL_CONTINUE_MAX_STALL_TURNS,\n\tDEFAULT_GOAL_CONTINUE_MAX_TURNS,\n\tDEFAULT_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES,\n\tMAX_GOAL_AUTO_CONTINUE_DELAY_MS,\n\tMAX_GOAL_CONTINUE_MAX_STALL_TURNS,\n\tMAX_GOAL_CONTINUE_MAX_TURNS,\n\tMAX_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES,\n} from \"./goals/goal-continuation-defaults.ts\";\nimport { DEFAULT_HTTP_IDLE_TIMEOUT_MS, parseHttpIdleTimeoutMs } from \"./http-dispatcher.ts\";\nimport { ProfileRegistry } from \"./profile-registry.ts\";\nimport { mergeResourceProfileMap, mergeResourceProfileSettings } from \"./resource-profile-blocks.ts\";\nimport { isWorkerSession } from \"./session-role.ts\";\nimport { validateSkillName } from \"./skills.ts\";\nimport type { ToolkitScript } from \"./toolkit/script-registry.ts\";\nimport { matchesCompiledPattern } from \"./util/minimatch-cache.ts\";\n\nexport interface CompactionSettings {\n\tenabled?: boolean; // default: true\n\treserveTokens?: number; // default: 16384\n\tkeepRecentTokens?: number; // default: 20000\n\ttriggerPercent?: number; // default: 0.7 — early context-efficiency threshold, separate from the USD cost guard\n\tmodel?: string; // default: \"auto\" — cheap auxiliary model for the summary; \"auto\" picks cheapest authed, else the session model\n}\n\nexport interface ScoutSettings {\n\tenabled?: boolean; // default: false\n\tmodel?: string; // default: \"auto\" — resolve an installed FastContext model, else return unavailable from the tool\n}\n\nexport interface SemanticMemoryGcSettings {\n\tenabled?: boolean; // default: true\n\tpreserveRecentPages?: number; // default: 1 -- see context-gc.ts DEFAULT_CONTEXT_GC_SETTINGS (canonical)\n\tminChars?: number; // default: 900 -- see context-gc.ts DEFAULT_CONTEXT_GC_SETTINGS (canonical)\n\tmarkers?: string[]; // default: memory/automata recall markers + the task_steps_context checklist marker\n}\n\nexport interface ContextGcSettings {\n\tenabled?: boolean; // default: true\n\tpreserveRecentMessages?: number; // default: 8\n\tminToolResultChars?: number; // default: 1200\n\ttools?: string[]; // default: read,bash,rg,grep,context_headroom_retrieve,headroom_retrieve\n\tsemanticMemory?: SemanticMemoryGcSettings;\n}\n\n/**\n * Conservative, opt-in first enforcement pilot for the context-policy layer (observe-only\n * by default -- see context/context-prompt-enforcement.ts). When enabled, stale\n * artifact-backed tool_output results outside the recent window are stubbed in place in\n * the provider-visible prompt only; the transcript/session history is never touched.\n */\nexport interface ContextPromptEnforcementSettings {\n\tenabled?: boolean; // default: false -- no behavior change unless explicitly opted in\n\t// default: mirrors the live contextGc.preserveRecentMessages (getContextGcSettings()), so tuning\n\t// GC's window moves this default with it; an explicit value here always wins over the mirror.\n\tpreserveRecentMessages?: number;\n\t// default: mirrors the live contextGc.minToolResultChars (getContextGcSettings()); an explicit\n\t// value here always wins over the mirror.\n\tminChars?: number;\n}\n\n/**\n * Local memory retrieval (see context/memory-retrieval.ts, context/memory-prompt-block.ts):\n * default-on for local, safe-auto sources. Prompt inclusion is still budget-gated per turn;\n * compact models get at most a 10-line/~200-token source-labeled block or no memory block.\n * External/non-local providers remain blocked unless explicitly allowed by policy.\n */\nexport interface MemoryRetrievalSettings {\n\tenabled?: boolean; // default: true -- local safe-auto retrieval\n\tmaxResults?: number; // default: 5, clamped to [1, 20]\n\tincludeInPrompt?: boolean; // default: true -- budget-gated safe-auto prompt inclusion\n\tallowExternalEgress?: boolean; // default: false -- explicit opt-in for raw query egress\n}\n\nexport interface ContextCurationSettings {\n\tenabled?: boolean; // default: false -- the curator never runs unless explicitly opted in\n\t/** Local model ref (\"provider/id\" or bare id) used for curation jobs. Required to drain. */\n\tmodel?: string;\n\tmaxJobsPerTurn?: number; // default: 4, clamped to [1, 16]\n}\n\nexport interface ContextPolicySettings {\n\tenforcement?: ContextPromptEnforcementSettings;\n\tmemory?: MemoryRetrievalSettings;\n\tcuration?: ContextCurationSettings;\n}\n\nexport const MEMORY_RETRIEVAL_MAX_RESULTS_MIN = 1;\nexport const MEMORY_RETRIEVAL_MAX_RESULTS_MAX = 20;\nconst MEMORY_RETRIEVAL_MAX_RESULTS_DEFAULT = 5;\n\nfunction clampMemoryRetrievalMaxResults(value: number): number {\n\treturn Math.min(MEMORY_RETRIEVAL_MAX_RESULTS_MAX, Math.max(MEMORY_RETRIEVAL_MAX_RESULTS_MIN, Math.trunc(value)));\n}\n\nexport interface BranchSummarySettings {\n\treserveTokens?: number; // default: 16384 (tokens reserved for prompt + LLM response)\n\tskipPrompt?: boolean; // default: false - when true, skips \"Summarize branch?\" prompt and defaults to no summary\n}\n\nexport interface ProviderRetrySettings {\n\ttimeoutMs?: number; // SDK/provider request timeout in milliseconds\n\tmaxRetries?: number; // SDK/provider retry attempts\n\tmaxRetryDelayMs?: number; // default: 60000 (max server-requested delay before failing)\n}\n\nexport interface StreamStallSettings {\n\tconnectMs?: number; // default: 120000 — max wait for the first stream event\n\tactiveIdleMs?: number; // default: 180000 — max event gap while content is flowing\n\tquietIdleMs?: number; // default: 600000 — max event gap during prefill/unstreamed thinking; clamped below nonzero httpIdleTimeoutMs\n}\n\nexport interface RetrySettings {\n\tenabled?: boolean; // default: true\n\tmaxRetries?: number; // default: 3\n\tbaseDelayMs?: number; // default: 2000 (exponential backoff: 2s, 4s, 8s)\n\tprovider?: ProviderRetrySettings;\n\tstall?: StreamStallSettings; // stream-stall watchdog bounds (pi-agent-core reliability/watchdogs.ts)\n}\n\nexport interface TerminalSettings {\n\tshowImages?: boolean; // default: true (only relevant if terminal supports images)\n\timageWidthCells?: number; // default: 60 (preferred inline image width in terminal cells)\n\tclearOnShrink?: boolean; // default: false (clear empty rows when content shrinks)\n\tshowTerminalProgress?: boolean; // default: false (OSC 9;4 terminal progress indicators)\n}\n\nexport interface ImageSettings {\n\tautoResize?: boolean; // default: true (resize images to 2000x2000 max for better model compatibility)\n\tblockImages?: boolean; // default: false - when true, prevents all images from being sent to LLM providers\n}\n\nexport interface ThinkingBudgetsSettings {\n\tminimal?: number;\n\tlow?: number;\n\tmedium?: number;\n\thigh?: number;\n}\n\nexport interface MarkdownSettings {\n\tcodeBlockIndent?: string; // default: \" \"\n}\n\nexport interface WarningSettings {\n\tanthropicExtraUsage?: boolean; // default: true\n}\n\nexport interface SelfModificationSettings {\n\tenabled?: boolean; // default: false\n\tsourcePath?: string; // Single pi-adaptative source tree path (legacy; still honored)\n\tsourcePaths?: string[]; // Ordered candidate source trees; first existing wins. Enables portable WSL/Termux switching from settings alone.\n}\n\nexport type AutoLearnThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\" | \"ultra\";\n\nexport interface AutoLearnSettings {\n\tenabled?: boolean; // default: false - autonomously trigger background history scavenging for long sessions\n\tmodel?: string; // \"active\" or omitted uses the current session model; otherwise a pi --model pattern\n\tthinkingLevel?: AutoLearnThinkingLevel; // default: low for background learner subprocesses\n\tlongSessionMessages?: number; // default: 64\n\tlongSessionContextPercent?: number; // default: 85\n\tcooldownMinutes?: number; // default: 1440 per session tenant (manual /auto-learn run bypasses)\n\tleaseMinutes?: number; // default: 90 for background learner state leases\n\tmaxConcurrentLearners?: number; // default: 2 per session tenant\n\tapplyHighConfidence?: boolean; // default: false unless the learning extension config opts in\n\treflectionReview?: boolean; // default: true when Auto Learn is enabled - post-turn review after corrective/complex turns\n\treflectionMinToolCalls?: number; // default: 12 tool calls in a turn before reflection review triggers\n\treflectionCooldownMinutes?: number; // default: 1440 per session tenant for reflection reviews\n\tcomplexTaskToolCalls?: number; // default: 12 tool calls before bypassing reflection cooldown as a complex task\n}\n\nexport type AutonomyMode = \"off\" | \"safe\" | \"balanced\" | \"full\";\n\nexport const DEFAULT_AUTONOMY_MAX_STALL_TURNS = DEFAULT_GOAL_CONTINUE_MAX_STALL_TURNS;\nexport const DEFAULT_AUTONOMY_GOAL_CONTINUE_TURNS = DEFAULT_GOAL_CONTINUE_MAX_TURNS;\nexport const DEFAULT_AUTONOMY_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES = DEFAULT_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES;\nexport const DEFAULT_AUTONOMY_GOAL_AUTO_CONTINUE = DEFAULT_GOAL_AUTO_CONTINUE;\nexport const DEFAULT_AUTONOMY_GOAL_AUTO_CONTINUE_DELAY_MS = DEFAULT_GOAL_AUTO_CONTINUE_DELAY_MS;\n\nexport interface AutonomySettings {\n\tmode?: AutonomyMode; // default: off; presets drive Auto Learn/reflection without many knobs\n\tmaxStallTurns?: number; // default: 20; maximum no-progress rounds before goal continuation asks the user\n\tgoalContinueTurns?: number; // default: 20; maximum continuation prompts per idle/explicit goal loop\n\tgoalContinueMaxWallClockMinutes?: number; // default: 0; 0 disables wall-clock budget\n\tgoalAutoContinue?: boolean; // default: true; auto-inject continuation prompts when an active goal is idle\n\tgoalAutoContinueDelayMs?: number; // default: 0; delay before idle auto-continuation starts\n}\n\nexport interface FailoverSettings {\n\tsubscriptionHop?: boolean; // default: true; subscription quota can hop once to an authenticated provider default\n}\n\nexport interface ModelRouterSettings {\n\tenabled?: boolean; // default: false — routing is opt-in until escalation safeguards are complete\n\tcheapModel?: string; // model pattern for read-only/research turns\n\tmediumModel?: string; // model pattern for normal scoped implementation, edits, and refactors\n\texpensiveModel?: string; // model pattern for modify/tool-heavy turns\n\tlearningModel?: string; // model pattern for background reflection/learn/skill-creator work; \"active\" uses session model\n\tjudgeEnabled?: boolean; // default: true — the routing judge runs automatically whenever the router is enabled and a judge model resolves\n\tfitnessGate?: boolean; // default: false — opt-in; blocks tier models whose probed relevant lane failed (Class B, subtractive)\n\tjudgeModel?: string; // model pattern for the routing-only judge; unset falls back to mediumModel\n\texecutorModel?: string; // model pattern for the local executor lane (direct toolkit commands); unset disables it\n\t// Per-tier thinking: overrides the inherited-and-clamped session thinking level for a routed\n\t// turn on that tier only (see agent-session.ts's routed-turn swap). Unset reproduces today's\n\t// behavior exactly — inherit the session thinking level, clamped to the routed model. learningModel\n\t// already has its own thinking via autoLearn.thinkingLevel, so there is deliberately no learningThinking.\n\tcheapThinking?: ThinkingLevel;\n\tmediumThinking?: ThinkingLevel;\n\texpensiveThinking?: ThinkingLevel;\n\texecutorThinking?: ThinkingLevel; // thinking level for the executor-direct lane\n\tjudgeThinking?: ThinkingLevel; // thinking level for the routing judge's own completion; unset keeps today's \"off\"\n}\n\nexport const DEFAULT_RESEARCH_LANE_ENABLED = false;\nexport const DEFAULT_RESEARCH_LANE_MAX_USD = 0.25;\nexport const DEFAULT_RESEARCH_LANE_MAX_SOURCES = 8;\nexport const DEFAULT_RESEARCH_LANE_MAX_FINDINGS = 10;\nexport const DEFAULT_RESEARCH_LANE_MAX_WALL_CLOCK_MS = 120_000;\nexport const DEFAULT_RESEARCH_LANE_IDLE_DELAY_MS = 0;\nexport const DEFAULT_RESEARCH_LANE_MAX_RUNS_PER_SESSION = 10;\nexport const MAX_RESEARCH_LANE_MAX_USD = 5;\nexport const MAX_RESEARCH_LANE_MAX_SOURCES = 32;\nexport const MAX_RESEARCH_LANE_MAX_FINDINGS = 50;\nexport const MAX_RESEARCH_LANE_MAX_WALL_CLOCK_MS = 3_600_000;\nexport const MAX_RESEARCH_LANE_IDLE_DELAY_MS = 300_000;\nexport const MAX_RESEARCH_LANE_MAX_RUNS_PER_SESSION = 100;\n\nexport interface ResearchLaneSettings {\n\tenabled?: boolean; // default: false — autonomous background research is opt-in\n\tmodel?: string; // model pattern; unset inherits the session model the lane was shipped from\n\tprofile?: string; // shipped profile; model/soul/thinking plus grants over classified read-only lane tools govern it\n\tsystemPrompt?: string; // replaces the lane role prompt (the level-0 subagent core always remains)\n\tmaxUsd?: number; // default: 0.25 per research pass; post-hoc breaches mark the lane budget_exhausted\n\tmaxSources?: number; // default: 8 evidence sources per bundle\n\tmaxFindings?: number; // default: 10 findings per bundle\n\tmaxWallClockMs?: number; // default: 120000; 0 disables the wall-clock budget\n\tidleDelayMs?: number; // default: 0 — delay before idle-triggered research starts\n\tmaxRunsPerSession?: number; // default: 10 idle-triggered research passes per session\n}\n\nexport type ResolvedResearchLaneSettings = Required<Omit<ResearchLaneSettings, \"model\" | \"profile\" | \"systemPrompt\">> &\n\tPick<ResearchLaneSettings, \"model\" | \"profile\" | \"systemPrompt\">;\n\nexport const DEFAULT_WORKER_DELEGATION_ENABLED = true;\nexport const DEFAULT_WORKER_DELEGATION_MAX_USD = 0.5;\nexport const DEFAULT_WORKER_DELEGATION_MAX_WALL_CLOCK_MS = 120_000;\nexport const MAX_WORKER_DELEGATION_MAX_USD = 5;\nexport const MAX_WORKER_DELEGATION_MAX_WALL_CLOCK_MS = 3_600_000;\n\nexport interface WorkerDelegationSettings {\n\tenabled?: boolean; // default: true for capable models; explicit false is a hard off-switch\n\tmodel?: string; // model pattern; unset inherits the session model the lane was shipped from\n\tprofile?: string; // shipped profile; tool grants filter classified lane tools (opaque extension tools stay unavailable)\n\tsystemPrompt?: string; // replaces the worker role prompt (the level-0 subagent core always remains)\n\tmaxUsd?: number; // default: 0.50 per delegated worker; post-hoc breaches mark the lane budget_exhausted\n\tmaxWallClockMs?: number; // default: 120000; 0 disables the wall-clock budget\n\twriteEnabled?: boolean; // default: false — grants write_files so workers may emit file actions\n\twritePaths?: string[]; // envelope path scope for write workers (REQUIRED for writes; empty = writes refused)\n\tmaxConcurrent?: number; // default: 1, clamped [1,3] — concurrent delegated workers\n}\n\nexport type ResolvedWorkerDelegationSettings = Required<\n\tOmit<WorkerDelegationSettings, \"model\" | \"profile\" | \"systemPrompt\">\n> &\n\tPick<WorkerDelegationSettings, \"model\" | \"profile\" | \"systemPrompt\">;\n\n/** Staleness-propagation policy for worktree-sync; see `core/worktree-sync/codes.ts`. */\nexport type WorktreeSyncPolicySetting = \"on_land_mandatory\" | \"overlap_mandatory\" | \"land_time_only\";\n\nexport interface WorktreeSyncSettings {\n\tenabled?: boolean; // default: true -- master switch; explicit false is the hard off-switch (zero behavior change when off)\n\tmainBranch?: string; // overrides default-branch resolution (main, then master; never guessed further)\n\tsyncPolicy?: WorktreeSyncPolicySetting; // default: \"on_land_mandatory\" -- every land marks every other active lane sync_required\n\tgateCommand?: string; // land gate command run in the lane worktree at the exact tip that becomes main (e.g. \"npm run check\")\n\tgate?: \"on\" | \"off\"; // default: \"on\" -- \"off\" is the owner-level G4 opt-out, recorded per land event\n\tgateTimeoutMs?: number; // default: 900000\n\tmaxLanes?: number; // default: 5 -- active-lane ceiling, matches the <=5-coder orchestration shape\n\tworktreesRoot?: string; // overrides the default lane-checkout root (agent-paths worktreesDir)\n\tworkerLand?: \"deny\" | \"allow\"; // default: \"deny\" -- whether a WORKER session (see session-role.ts) may run the \"land\" action at all; \"allow\" still subjects the land to normal ownership/freshness gating\n}\n\nexport type ResolvedWorktreeSyncSettings = Required<\n\tOmit<WorktreeSyncSettings, \"mainBranch\" | \"gateCommand\" | \"worktreesRoot\">\n> &\n\tPick<WorktreeSyncSettings, \"mainBranch\" | \"gateCommand\" | \"worktreesRoot\">;\n\nexport const DEFAULT_WORKTREE_SYNC_POLICY: WorktreeSyncPolicySetting = \"on_land_mandatory\";\nexport const DEFAULT_WORKTREE_SYNC_GATE_TIMEOUT_MS = 900_000;\nexport const DEFAULT_WORKTREE_SYNC_MAX_LANES = 5;\n\n/** Durable master/worker process-matrix supervision; see `core/process-matrix/`. */\nexport interface ProcessMatrixSettings {\n\tenabled?: boolean; // default: true -- master switch; explicit false is the hard off-switch (zero behavior change when off)\n\theartbeatMs?: number; // default: 30000 -- master heartbeat interval\n\tadoptionGraceMs?: number; // default: 300000 -- how long an orphaned worker waits (polling for an adopt/cleanup directive) before self-exiting\n\twatcherPollMs?: number; // default: 25000 -- poll cadence for parent-liveness / directive checks\n}\n\nexport type ResolvedProcessMatrixSettings = Required<ProcessMatrixSettings>;\n\nexport const DEFAULT_PROCESS_MATRIX_HEARTBEAT_MS = 30_000;\nexport const DEFAULT_PROCESS_MATRIX_ADOPTION_GRACE_MS = 300_000;\nexport const DEFAULT_PROCESS_MATRIX_WATCHER_POLL_MS = 25_000;\n\n/** Windows shell contract engine tier (`src/core/tools/windows-shell-engine.ts`). */\nexport interface WindowsShellSettings {\n\tpythonEngine?: boolean; // default: true -- routes complex/state-mutating Bash constructs to the bundled Python engine on Windows; explicit false restores the PowerShell-only floor verbatim\n}\n\nexport type ResolvedWindowsShellSettings = Required<WindowsShellSettings>;\n\nexport type LearningPolicyLayer =\n\t| \"memory\"\n\t| \"skill\"\n\t| \"prompt\"\n\t| \"extension\"\n\t| \"tool\"\n\t| \"script\"\n\t| \"settings\"\n\t| \"source\";\n\nexport const DEFAULT_LEARNING_POLICY_ENABLED = true;\nexport const DEFAULT_LEARNING_POLICY_AUTO_APPLY_ENABLED = false;\nexport const DEFAULT_LEARNING_POLICY_CONFIDENCE_THRESHOLD = 90;\nexport const DEFAULT_LEARNING_POLICY_MIN_OBSERVATIONS = 2;\nexport const DEFAULT_LEARNING_POLICY_ALLOWED_AUTO_APPLY_LAYERS: readonly LearningPolicyLayer[] = [\"memory\"];\nexport const DEFAULT_LEARNING_POLICY_REFLECTION_SOURCE_CONFIDENCE = 50;\nexport const DEFAULT_LEARNING_POLICY_AUTO_APPLY_SUPERSESSIONS = false;\n\nexport interface LearningPolicySettings {\n\tenabled?: boolean; // default: false — until enabled, reflection writes keep the legacy direct-apply path (now audited)\n\tautoApplyEnabled?: boolean; // default: false — with the policy on, writes become proposals unless auto-apply is enabled\n\tconfidenceThreshold?: number; // default: 90 (0-100)\n\tminObservations?: number; // default: 2 — single-session cues do not auto-apply\n\tallowedAutoApplyLayers?: LearningPolicyLayer[]; // default: [\"memory\"] — every other layer stays proposal-first\n\trequireRollbackPlan?: boolean; // default: true — durable writes need a rollback plan to auto-apply\n\treflectionSourceConfidence?: number; // default: 50 — trust assigned to single-session reflection cues (0-100)\n\tautoApplySupersessions?: boolean; // default: false — a memory_replace/memory_remove (supersedes/deletes an existing fact) stays a proposal even when otherwise eligible, unless explicitly opted in\n}\n\nexport type ResolvedLearningPolicySettings = Required<LearningPolicySettings>;\n\nexport interface ToolkitSettings {\n\t/** The blessed daily-ops scripts run_toolkit_script may execute. Nothing else ever runs. */\n\tscripts?: ToolkitScript[];\n}\n\nexport type ModelCapabilityMode = \"auto\" | \"off\" | \"full\" | \"lean\" | \"minimal\" | \"chat\";\n\nexport const DEFAULT_MODEL_CAPABILITY_MODE: ModelCapabilityMode = \"auto\";\n\nexport interface ModelCapabilitySettings {\n\t/**\n\t * default: \"auto\" — derive the tool/lane surface from the model's context window so small open\n\t * models stay usable for chat. \"off\" disables detection; a class name forces that class.\n\t */\n\tmode?: ModelCapabilityMode;\n}\n\nexport type TransportSetting = Transport;\n\n/**\n * Package source for npm/git packages.\n * - String form: load all resources from the package\n * - Object form: filter which resources to load\n */\nexport type PackageSource =\n\t| string\n\t| {\n\t\t\tsource: string;\n\t\t\textensions?: string[];\n\t\t\tskills?: string[];\n\t\t\tprompts?: string[];\n\t\t\tthemes?: string[];\n\t };\n\nexport type ResourceProfileKind = \"extensions\" | \"skills\" | \"prompts\" | \"themes\" | \"agents\" | \"tools\";\n\nexport interface ResourceProfileFilterSettings {\n\t/** Allowlist patterns. When non-empty, only matching resources stay available. */\n\tallow?: string[];\n\t/** Blocklist patterns. Applied after allow. */\n\tblock?: string[];\n}\n\nexport type ResourceProfileSettings = Partial<Record<ResourceProfileKind, ResourceProfileFilterSettings>>;\n\nexport interface DisabledResourcesSettings {\n\textensions?: string[];\n\tskills?: string[];\n\tprompts?: string[];\n\tthemes?: string[];\n\tagents?: string[];\n\ttools?: string[];\n}\n\nexport interface ToolRepairSettings {\n\tteach?: boolean;\n\ttextProtocol?: boolean;\n\tlogging?: boolean;\n}\n\nexport interface Settings {\n\tlastChangelogVersion?: string;\n\tdefaultProvider?: string;\n\tdefaultModel?: string;\n\tdefaultThinkingLevel?: ThinkingLevel;\n\ttransport?: TransportSetting; // default: \"auto\"\n\tsteeringMode?: \"all\" | \"one-at-a-time\";\n\tfollowUpMode?: \"all\" | \"one-at-a-time\";\n\ttheme?: string;\n\t/** Resource catalog directory (round resource management): the folder pi installs/updates/backs up from. */\n\tcatalogDir?: string;\n\tcompaction?: CompactionSettings;\n\tscout?: ScoutSettings;\n\t/** Proactive per-turn cost guard (#34). */\n\tcostGuard?: { maxTurnUsd?: number; action?: \"warn\" | \"downgrade\" };\n\t/** Skill curator (#32): auto-archive stale reflection-promoted skills at session start. */\n\tcurator?: { autoArchive?: boolean; staleDays?: number };\n\tcontextGc?: ContextGcSettings;\n\tcontextPolicy?: ContextPolicySettings;\n\tbranchSummary?: BranchSummarySettings;\n\tretry?: RetrySettings;\n\thideThinkingBlock?: boolean;\n\tshellPath?: string; // Custom shell path (e.g., for Cygwin users on Windows)\n\tquietStartup?: boolean;\n\tshellCommandPrefix?: string; // Prefix prepended to every bash command (e.g., \"shopt -s expand_aliases\" for alias support)\n\tnpmCommand?: string[]; // Command used for npm package lookup/install operations, argv-style (e.g., [\"mise\", \"exec\", \"node@20\", \"--\", \"npm\"])\n\tcollapseChangelog?: boolean; // Show condensed changelog after update (use /changelog for full)\n\tenableInstallTelemetry?: boolean; // default: true - anonymous version/update ping after changelog-detected updates\n\tpackages?: PackageSource[]; // Array of npm/git package sources (string or object with filtering)\n\textensions?: string[]; // Array of local extension file paths/directories or include/exclude patterns\n\tskills?: string[]; // Array of local skill file paths/directories or include/exclude patterns\n\tprompts?: string[]; // Array of local prompt template paths/directories or include/exclude patterns\n\tthemes?: string[]; // Array of local theme file paths/directories or include/exclude patterns\n\texternalResourceRoots?: string[]; // External directory roots to scan for resources\n\ttrustedResourceRoots?: string[]; // Explicitly trusted external directory roots (canonical absolute paths)\n\tdisabledResources?: DisabledResourcesSettings; // Legacy reversible block filters for extensions/skills/prompts/themes/agents/tools\n\tresourceProfiles?: Record<string, ResourceProfileSettings | ProfileDefinitionInput>; // Named resource filters, optionally with full situation metadata\n\tactiveResourceProfile?: string | string[]; // Active profile name(s), applied after global/project/directory settings merge\n\tactiveResourceProfiles?: string[]; // Active profile names, equivalent to activeResourceProfile array\n\tenableSkillCommands?: boolean; // default: true - register skills as /skill:name commands\n\tterminal?: TerminalSettings;\n\timages?: ImageSettings;\n\tenabledModels?: string[]; // Model patterns for cycling (same format as --models CLI flag)\n\tdoubleEscapeAction?: \"fork\" | \"tree\" | \"none\"; // Action for double-escape with empty editor (default: \"tree\")\n\ttreeFilterMode?: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\"; // Default filter when opening /tree\n\tthinkingBudgets?: ThinkingBudgetsSettings; // Custom token budgets for thinking levels\n\teditorPaddingX?: number; // Horizontal padding for input editor (default: 0)\n\tautocompleteMaxVisible?: number; // Max visible items in autocomplete dropdown (default: 5)\n\tshowHardwareCursor?: boolean; // Show terminal cursor while still positioning it for IME\n\tmarkdown?: MarkdownSettings;\n\twarnings?: WarningSettings;\n\tselfModification?: SelfModificationSettings; // Local guardrails for modifying the pi-adaptative source/harness\n\tautonomy?: AutonomySettings; // Low-config autonomy preset controlling background learning/reflection defaults\n\tresearchLane?: ResearchLaneSettings; // Opt-in autonomous read-only research lane producing evidence bundles\n\tworkerDelegation?: WorkerDelegationSettings; // Bounded scout-worker delegation; enabled by default on capable models\n\tworktreeSync?: WorktreeSyncSettings; // Opt-in hard-gated worktree-per-lane parallel-work workflow (core/worktree-sync)\n\tprocessMatrix?: ProcessMatrixSettings; // Durable master/worker process-matrix supervision (core/process-matrix); on by default\n\twindowsShell?: WindowsShellSettings; // Windows shell contract engine tier (core/tools/windows-shell-engine); on by default\n\tlearningPolicy?: LearningPolicySettings; // Opt-in learning apply policy: proposal-first durable writes with audit/rollback\n\tmodelCapability?: ModelCapabilitySettings; // Auto-detected small-model tool/lane surface (default: auto)\n\ttoolkit?: ToolkitSettings; // User's blessed daily-ops script registry for run_toolkit_script\n\tmodelRouter?: ModelRouterSettings; // Opt-in deterministic cheap/expensive model routing foundation\n\ttoolRepair?: ToolRepairSettings; // Tool-recovery logging plus teach and text-protocol switches\n\tfailover?: FailoverSettings; // Provider quota behavior; metered quota always halts for explicit user choice\n\tautoLearn?: AutoLearnSettings; // Setting-gated autonomous background learning for long sessions\n\tsessionDir?: string; // Custom session storage directory (same format as --session-dir CLI flag)\n\thttpIdleTimeoutMs?: number; // HTTP header/body idle timeout in ms; 0 disables it. Nonzero values constrain every stream-watchdog phase below this timeout\n\twebsocketConnectTimeoutMs?: number; // WebSocket connect/open handshake timeout in milliseconds; 0 disables it\n}\n\n/** Deep merge settings: project/overrides take precedence, nested objects merge recursively */\nfunction deepMergeSettings(base: Settings, overrides: Settings): Settings {\n\tconst result: Settings = { ...base };\n\n\tfor (const key of Object.keys(overrides) as (keyof Settings)[]) {\n\t\tconst overrideValue = overrides[key];\n\t\tconst baseValue = base[key];\n\n\t\tif (overrideValue === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// For nested objects, merge recursively\n\t\tif (\n\t\t\ttypeof overrideValue === \"object\" &&\n\t\t\toverrideValue !== null &&\n\t\t\t!Array.isArray(overrideValue) &&\n\t\t\ttypeof baseValue === \"object\" &&\n\t\t\tbaseValue !== null &&\n\t\t\t!Array.isArray(baseValue)\n\t\t) {\n\t\t\t(result as Record<string, unknown>)[key] = deepMergeSettings(baseValue as Settings, overrideValue as Settings);\n\t\t} else {\n\t\t\t// For primitives and arrays, override value wins\n\t\t\t(result as Record<string, unknown>)[key] = overrideValue;\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction toPosixPath(p: string): string {\n\treturn p.split(sep).join(\"/\");\n}\n\nfunction findDirectoryProfileRoot(cwd: string): string {\n\tlet current = resolvePath(cwd);\n\twhile (true) {\n\t\tfor (const marker of [\".git\", \".hg\", \".svn\"]) {\n\t\t\ttry {\n\t\t\t\tstatSync(join(current, marker));\n\t\t\t\treturn current;\n\t\t\t} catch {}\n\t\t}\n\t\tconst parent = resolve(current, \"..\");\n\t\tif (parent === current) return resolvePath(cwd);\n\t\tcurrent = parent;\n\t}\n}\n\nexport interface DirectoryResourceProfileInfo {\n\troot: string;\n\thash: string;\n\tpath: string;\n}\n\nexport function getDirectoryResourceProfileInfo(\n\tcwd: string,\n\tagentDir: string = getAgentDir(),\n): DirectoryResourceProfileInfo {\n\tconst root = findDirectoryProfileRoot(cwd);\n\tconst hash = createHash(\"sha256\").update(root).digest(\"hex\").slice(0, 16);\n\t// resource-profiles/ stays at the agentDir root (not state/): moving it needs the two user-visible\n\t// scope descriptions in profile-menu-controller.ts updated in the same change, which has not\n\t// happened yet. Still routed through the SSOT root accessor so the eventual move is a one-line\n\t// change here.\n\treturn {\n\t\troot,\n\t\thash,\n\t\tpath: join(configFile(resolvePath(agentDir), \"resource-profiles\"), hash, \"settings.json\"),\n\t};\n}\n\nexport function matchesResourceProfilePattern(resourcePath: string, patterns: string[], baseDir = \"\"): boolean {\n\tif (patterns.length === 0) return false;\n\tconst resolvedBase = baseDir ? resolvePath(baseDir) : \"\";\n\tconst rel = resolvedBase ? toPosixPath(relative(resolvedBase, resourcePath)) : toPosixPath(resourcePath);\n\tconst name = basename(resourcePath);\n\tconst filePathPosix = toPosixPath(resourcePath);\n\tconst parentDir = dirname(resourcePath);\n\tconst parentRel = resolvedBase ? toPosixPath(relative(resolvedBase, parentDir)) : toPosixPath(parentDir);\n\tconst parentName = basename(parentDir);\n\tconst parentDirPosix = toPosixPath(parentDir);\n\n\treturn patterns.some((pattern) => {\n\t\tconst normalizedPattern = toPosixPath(pattern);\n\t\treturn (\n\t\t\tmatchesCompiledPattern(rel, normalizedPattern) ||\n\t\t\tmatchesCompiledPattern(name, normalizedPattern) ||\n\t\t\tmatchesCompiledPattern(filePathPosix, normalizedPattern) ||\n\t\t\tmatchesCompiledPattern(parentRel, normalizedPattern) ||\n\t\t\tmatchesCompiledPattern(parentName, normalizedPattern) ||\n\t\t\tmatchesCompiledPattern(parentDirPosix, normalizedPattern)\n\t\t);\n\t});\n}\n\nfunction normalizeResourceProfileNames(value: unknown): string[] {\n\tconst values: string[] = [];\n\tconst add = (candidate: unknown) => {\n\t\tif (Array.isArray(candidate)) {\n\t\t\tfor (const item of candidate) add(item);\n\t\t\treturn;\n\t\t}\n\t\tif (typeof candidate === \"string\") {\n\t\t\tfor (const part of candidate.split(\",\")) {\n\t\t\t\tconst trimmed = part.trim();\n\t\t\t\tif (trimmed) values.push(trimmed);\n\t\t\t}\n\t\t}\n\t};\n\tadd(value);\n\treturn [...new Set(values)];\n}\n\nfunction hasExplicitActiveResourceProfileSelection(settings: Settings): boolean {\n\treturn Object.hasOwn(settings, \"activeResourceProfiles\") || Object.hasOwn(settings, \"activeResourceProfile\");\n}\n\nfunction hasExplicitEmptyActiveResourceProfileSelection(settings: Settings): boolean {\n\treturn (\n\t\tObject.hasOwn(settings, \"activeResourceProfiles\") &&\n\t\tnormalizeResourceProfileNames(settings.activeResourceProfiles).length === 0\n\t);\n}\n\nfunction normalizeActiveResourceProfiles(settings: Settings): string[] {\n\t// The array form is canonical when present, including an explicit empty array. Falling through\n\t// from `activeResourceProfiles: []` to the scalar alias would resurrect a lower-precedence or\n\t// legacy selection and makes it impossible to persist a durable \"none\" choice.\n\tconst values = Object.hasOwn(settings, \"activeResourceProfiles\")\n\t\t? normalizeResourceProfileNames(settings.activeResourceProfiles)\n\t\t: normalizeResourceProfileNames(settings.activeResourceProfile);\n\tif (\n\t\tvalues.length === 0 &&\n\t\t!hasExplicitActiveResourceProfileSelection(settings) &&\n\t\tsettings.resourceProfiles?.default\n\t) {\n\t\tvalues.push(\"default\");\n\t}\n\treturn [...new Set(values)];\n}\n\nfunction appendFilter(target: ResourceProfileFilterSettings, source?: ResourceProfileFilterSettings): void {\n\tif (!source) return;\n\tif (Array.isArray(source.allow)) target.allow = [...(target.allow ?? []), ...source.allow];\n\tif (Array.isArray(source.block)) target.block = [...(target.block ?? []), ...source.block];\n}\n\nfunction collectLegacyDisabledFilterFromSettings(\n\tsettings: Settings,\n\tkind: ResourceProfileKind,\n): ResourceProfileFilterSettings {\n\tconst legacyDisabled = settings.disabledResources?.[kind];\n\treturn Array.isArray(legacyDisabled) ? { block: legacyDisabled } : {};\n}\n\nfunction mergeResourceProfileFilters(...filters: ResourceProfileFilterSettings[]): ResourceProfileFilterSettings {\n\tconst result: ResourceProfileFilterSettings = {};\n\tfor (const filter of filters) appendFilter(result, filter);\n\treturn result;\n}\n\nfunction parseTimeoutSetting(value: unknown, settingName: string): number | undefined {\n\tconst timeoutMs = parseHttpIdleTimeoutMs(value);\n\tif (timeoutMs !== undefined) {\n\t\treturn timeoutMs;\n\t}\n\tif (value !== undefined) {\n\t\tthrow new Error(`Invalid ${settingName} setting: ${String(value)}`);\n\t}\n\treturn undefined;\n}\n\n/** Stall bounds must be strictly positive — 0 is not \"disabled\" here (it would stall instantly). */\nfunction parseStallBoundMs(value: unknown, settingName: string): number | undefined {\n\tif (value === undefined) return undefined;\n\tif (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) {\n\t\tthrow new Error(`Invalid ${settingName} setting: ${String(value)}`);\n\t}\n\treturn Math.floor(value);\n}\n\nfunction sanitizeIntegerSetting(value: unknown, fallback: number, min: number, max: number): number {\n\tif (typeof value !== \"number\" || !Number.isInteger(value)) return fallback;\n\tif (value < min || value > max) return fallback;\n\treturn value;\n}\n\nfunction sanitizeNumberSetting(value: unknown, fallback: number, min: number, max: number): number {\n\tif (typeof value !== \"number\" || !Number.isFinite(value)) return fallback;\n\tif (value < min || value > max) return fallback;\n\treturn value;\n}\n\nexport type ThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\" | \"ultra\";\n\nexport interface ProfileDefinitionInput {\n\tname?: string;\n\tdescription?: string;\n\tmodel?: string;\n\tthinking?: ThinkingLevel;\n\tmodelRouter?: ModelRouterSettings;\n\t/**\n\t * Situational identity: a system-prompt prefix injected while this profile is active, so a\n\t * profile becomes a full \"situation\" = soul + capabilities + model/thinking, switched atomically.\n\t */\n\tsoul?: string;\n\tresources: ResourceProfileSettings;\n}\n\nexport type ProfilePersistenceScope = \"session\" | \"directory\" | \"project\" | \"global\" | \"reusable-file\";\n\nconst VALID_THINKING_LEVELS = [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\", \"ultra\"] as const;\nfunction isThinkingLevel(value: unknown): value is ThinkingLevel {\n\treturn typeof value === \"string\" && VALID_THINKING_LEVELS.includes(value as ThinkingLevel);\n}\n\nfunction asStringArrayWithPattern(value: unknown): string[] | undefined {\n\tif (!Array.isArray(value)) return undefined;\n\tconst values = value.filter((item): item is string => typeof item === \"string\" && item.trim().length > 0);\n\treturn values.length > 0 ? values : undefined;\n}\n\nfunction normalizeProfileFilterResource(value: unknown): ResourceProfileFilterSettings {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(\"resource profile filter must be an object\");\n\t}\n\tconst filter = value as Record<string, unknown>;\n\treturn {\n\t\tallow: asStringArrayWithPattern(filter.allow),\n\t\tblock: asStringArrayWithPattern(filter.block),\n\t};\n}\n\nfunction normalizeProfileResources(value: unknown): ResourceProfileSettings {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(\"resources must be an object\");\n\t}\n\tconst input = value as Record<string, unknown>;\n\tconst result: ResourceProfileSettings = {};\n\tfor (const kind of [\"extensions\", \"skills\", \"prompts\", \"themes\", \"agents\", \"tools\"] as const) {\n\t\tif (input[kind] === undefined) continue;\n\t\tresult[kind] = normalizeProfileFilterResource(input[kind]);\n\t}\n\treturn result;\n}\n\nfunction normalizeModelRouterSettings(value: unknown): ModelRouterSettings | undefined {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return undefined;\n\tconst input = value as Record<string, unknown>;\n\tconst settings: ModelRouterSettings = {};\n\tfor (const key of [\"enabled\", \"judgeEnabled\", \"fitnessGate\"] as const) {\n\t\tif (typeof input[key] === \"boolean\") settings[key] = input[key];\n\t}\n\tfor (const key of [\n\t\t\"cheapModel\",\n\t\t\"mediumModel\",\n\t\t\"expensiveModel\",\n\t\t\"learningModel\",\n\t\t\"judgeModel\",\n\t\t\"executorModel\",\n\t] as const) {\n\t\tconst candidate = input[key];\n\t\tif (typeof candidate !== \"string\") continue;\n\t\tconst trimmed = candidate.trim();\n\t\tif (trimmed) settings[key] = trimmed;\n\t}\n\tfor (const key of [\n\t\t\"cheapThinking\",\n\t\t\"mediumThinking\",\n\t\t\"expensiveThinking\",\n\t\t\"executorThinking\",\n\t\t\"judgeThinking\",\n\t] as const) {\n\t\tconst candidate = input[key];\n\t\tif (isThinkingLevel(candidate)) settings[key] = candidate;\n\t}\n\treturn Object.keys(settings).length > 0 ? settings : undefined;\n}\n\nfunction parseProfileFileDefinition(content: string, fallbackName?: string): ProfileDefinitionInput {\n\tconst parsed = JSON.parse(content) as Record<string, unknown>;\n\tif (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n\t\tthrow new Error(\"profile file must contain a JSON object\");\n\t}\n\tconst name = (typeof parsed.name === \"string\" ? parsed.name.trim() : undefined) || fallbackName;\n\tif (!name) {\n\t\tthrow new Error(\"profile name is required\");\n\t}\n\tconst resourceSection = parsed.resources ?? {};\n\treturn {\n\t\tname,\n\t\tdescription: typeof parsed.description === \"string\" ? parsed.description.trim() || undefined : undefined,\n\t\tmodel: typeof parsed.model === \"string\" ? parsed.model.trim() || undefined : undefined,\n\t\tthinking: isThinkingLevel(parsed.thinking) ? parsed.thinking : undefined,\n\t\tmodelRouter: normalizeModelRouterSettings(parsed.modelRouter),\n\t\tsoul: typeof parsed.soul === \"string\" ? parsed.soul.trim() || undefined : undefined,\n\t\tresources: normalizeProfileResources(resourceSection),\n\t};\n}\n\nexport type SettingsScope = \"global\" | \"project\" | \"directoryProfile\";\nexport type SettingsErrorScope = SettingsScope;\n\nexport interface SettingsManagerCreateOptions {\n\tprojectTrusted?: boolean;\n}\n\nexport interface SettingsStorage {\n\twithLock(scope: SettingsScope, fn: (current: string | undefined) => string | undefined): void;\n\tgetProfilesDir?(): string;\n\t/** Base directory used to resolve explicit ./ or ../ profile references. */\n\tgetProfileResolutionBaseDir?(): string;\n}\n\nexport interface SettingsError {\n\tscope: SettingsErrorScope;\n\terror: Error;\n}\n\n/** In-memory settings generation captured around an atomic runtime reload. */\nexport interface SettingsReloadSnapshot {\n\tglobalSettings: Settings;\n\tprojectSettings: Settings;\n\tdirectoryProfileSettings: Settings;\n\truntimeResourceProfiles: string[] | undefined;\n\tinlineResourceProfileDefinitions: Record<string, ProfileDefinitionInput>;\n\tdiscoveredResourceProfileDefinitions: Record<string, ResourceProfileSettings>;\n\teffectiveSettings: Settings;\n\tprojectTrusted: boolean;\n\tmodifiedFields: Set<keyof Settings>;\n\tmodifiedNestedFields: Map<keyof Settings, Set<string>>;\n\tmodifiedProjectFields: Set<keyof Settings>;\n\tmodifiedProjectNestedFields: Map<keyof Settings, Set<string>>;\n\tglobalSettingsLoadError: Error | null;\n\tprojectSettingsLoadError: Error | null;\n\tdirectoryProfileInfo: DirectoryResourceProfileInfo | null;\n\terrors: SettingsError[];\n}\n\nexport interface GlobalResourceProfileConfiguration {\n\tresourceProfiles?: Settings[\"resourceProfiles\"];\n\tactiveResourceProfile?: Settings[\"activeResourceProfile\"];\n\tactiveResourceProfiles?: Settings[\"activeResourceProfiles\"];\n\texternalResourceRoots?: string[];\n\ttrustedResourceRoots?: string[];\n}\n\nexport class FileSettingsStorage implements SettingsStorage {\n\tprivate profileResolutionBaseDir: string;\n\tprivate globalSettingsPath: string;\n\tprivate projectSettingsPath: string;\n\tprivate directoryProfileInfo: DirectoryResourceProfileInfo;\n\tprivate profilesDir: string;\n\n\tconstructor(cwd: string, agentDir: string) {\n\t\tconst resolvedCwd = resolvePath(cwd);\n\t\tconst resolvedAgentDir = resolvePath(agentDir);\n\t\tthis.profileResolutionBaseDir = resolvedCwd;\n\t\tthis.globalSettingsPath = join(resolvedAgentDir, \"settings.json\");\n\t\tthis.projectSettingsPath = join(resolvedCwd, CONFIG_DIR_NAME, \"settings.json\");\n\t\tthis.directoryProfileInfo = getDirectoryResourceProfileInfo(resolvedCwd, resolvedAgentDir);\n\t\tthis.profilesDir = getProfilesDir(resolvedAgentDir);\n\t}\n\n\tgetDirectoryResourceProfileInfo(): DirectoryResourceProfileInfo {\n\t\treturn { ...this.directoryProfileInfo };\n\t}\n\n\tgetProfilesDir(): string {\n\t\treturn this.profilesDir;\n\t}\n\n\tgetProfileResolutionBaseDir(): string {\n\t\treturn this.profileResolutionBaseDir;\n\t}\n\n\treadDirectoryResourceProfile(): string | undefined {\n\t\tconst path = this.directoryProfileInfo.path;\n\t\treturn existsSync(path) ? readFileSync(path, \"utf-8\") : undefined;\n\t}\n\n\tprivate acquireLockSyncWithRetry(path: string): () => void {\n\t\tconst maxAttempts = 10;\n\t\tconst delayMs = 20;\n\t\tlet lastError: unknown;\n\n\t\tfor (let attempt = 1; attempt <= maxAttempts; attempt++) {\n\t\t\ttry {\n\t\t\t\treturn lockfile.lockSync(path, { realpath: false });\n\t\t\t} catch (error) {\n\t\t\t\tconst code =\n\t\t\t\t\ttypeof error === \"object\" && error !== null && \"code\" in error\n\t\t\t\t\t\t? String((error as { code?: unknown }).code)\n\t\t\t\t\t\t: undefined;\n\t\t\t\tif (code !== \"ELOCKED\" || attempt === maxAttempts) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tlastError = error;\n\t\t\t\tconst start = Date.now();\n\t\t\t\twhile (Date.now() - start < delayMs) {\n\t\t\t\t\t// Sleep synchronously to avoid changing callers to async.\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthrow (lastError as Error) ?? new Error(\"Failed to acquire settings lock\");\n\t}\n\n\twithLock(scope: SettingsScope, fn: (current: string | undefined) => string | undefined): void {\n\t\tconst path =\n\t\t\tscope === \"global\"\n\t\t\t\t? this.globalSettingsPath\n\t\t\t\t: scope === \"project\"\n\t\t\t\t\t? this.projectSettingsPath\n\t\t\t\t\t: this.directoryProfileInfo.path;\n\t\tconst dir = dirname(path);\n\n\t\tlet release: (() => void) | undefined;\n\t\ttry {\n\t\t\t// Only create directory and lock if file exists or we need to write\n\t\t\tconst fileExists = existsSync(path);\n\t\t\tif (fileExists) {\n\t\t\t\trelease = this.acquireLockSyncWithRetry(path);\n\t\t\t}\n\t\t\tconst current = fileExists ? readFileSync(path, \"utf-8\") : undefined;\n\t\t\tconst next = fn(current);\n\t\t\tif (next !== undefined) {\n\t\t\t\t// Only create directory when we actually need to write\n\t\t\t\tif (!existsSync(dir)) {\n\t\t\t\t\tmkdirSync(dir, { recursive: true });\n\t\t\t\t}\n\t\t\t\tif (!release) {\n\t\t\t\t\trelease = this.acquireLockSyncWithRetry(path);\n\t\t\t\t}\n\t\t\t\twriteFileSync(path, next, \"utf-8\");\n\t\t\t}\n\t\t} finally {\n\t\t\tif (release) {\n\t\t\t\trelease();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport class InMemorySettingsStorage implements SettingsStorage {\n\tprivate global: string | undefined;\n\tprivate project: string | undefined;\n\tprivate directoryProfile: string | undefined;\n\n\twithLock(scope: SettingsScope, fn: (current: string | undefined) => string | undefined): void {\n\t\tconst current = scope === \"global\" ? this.global : scope === \"project\" ? this.project : this.directoryProfile;\n\t\tconst next = fn(current);\n\t\tif (next === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tif (scope === \"global\") {\n\t\t\tthis.global = next;\n\t\t\treturn;\n\t\t}\n\t\tif (scope === \"project\") {\n\t\t\tthis.project = next;\n\t\t\treturn;\n\t\t}\n\t\tthis.directoryProfile = next;\n\t}\n}\n\nexport class SettingsManager {\n\tprivate storage: SettingsStorage;\n\tprivate globalSettings: Settings;\n\tprivate projectSettings: Settings;\n\tprivate directoryProfileSettings: Settings;\n\tprivate runtimeResourceProfiles: string[] | undefined;\n\tprivate inlineResourceProfileDefinitions: Record<string, ProfileDefinitionInput> = {};\n\tprivate discoveredResourceProfileDefinitions: Record<string, ResourceProfileSettings> = {};\n\tsettings: Settings;\n\tprivate projectTrusted: boolean;\n\tprivate modifiedFields = new Set<keyof Settings>(); // Track global fields modified during session\n\tprivate modifiedNestedFields = new Map<keyof Settings, Set<string>>(); // Track global nested field modifications\n\tprivate modifiedProjectFields = new Set<keyof Settings>(); // Track project fields modified during session\n\tprivate modifiedProjectNestedFields = new Map<keyof Settings, Set<string>>(); // Track project nested field modifications\n\tprivate globalSettingsLoadError: Error | null = null; // Track if global settings file had parse errors\n\tprivate projectSettingsLoadError: Error | null = null; // Track if project settings file had parse errors\n\tprivate directoryProfileInfo: DirectoryResourceProfileInfo | null = null;\n\tprivate profileRegistry!: ProfileRegistry;\n\tprivate writeQueue: Promise<void> = Promise.resolve();\n\tprivate errors: SettingsError[];\n\n\tprivate constructor(\n\t\tstorage: SettingsStorage,\n\t\tinitialGlobal: Settings,\n\t\tinitialProject: Settings,\n\t\tinitialDirectoryProfile: Settings = {},\n\t\tglobalLoadError: Error | null = null,\n\t\tprojectLoadError: Error | null = null,\n\t\tinitialErrors: SettingsError[] = [],\n\t\tprojectTrusted = true,\n\t\tdirectoryProfileInfo: DirectoryResourceProfileInfo | null = null,\n\t) {\n\t\tthis.storage = storage;\n\t\tthis.globalSettings = initialGlobal;\n\t\tthis.projectSettings = initialProject;\n\t\tthis.directoryProfileSettings = initialDirectoryProfile;\n\t\tthis.projectTrusted = projectTrusted;\n\t\tthis.globalSettingsLoadError = globalLoadError;\n\t\tthis.projectSettingsLoadError = projectLoadError;\n\t\tthis.directoryProfileInfo = directoryProfileInfo;\n\t\tthis.errors = [...initialErrors];\n\t\tthis.settings = this.mergeEffectiveSettings();\n\t\tthis.refreshProfileRegistry();\n\t}\n\n\tprivate createProfileRegistry(): ProfileRegistry {\n\t\treturn new ProfileRegistry({\n\t\t\tglobalSettings: this.globalSettings,\n\t\t\tprojectSettings: this.projectSettings,\n\t\t\tdirectoryProfileSettings: this.directoryProfileSettings,\n\t\t\tinlineResourceProfileDefinitions: this.inlineResourceProfileDefinitions,\n\t\t\tdiscoveredResourceProfileDefinitions: this.discoveredResourceProfileDefinitions,\n\t\t\tprofilesDir: this.storage.getProfilesDir?.(),\n\t\t\texternalResourceRoots: this.getEffectiveExternalResourceRoots(),\n\t\t});\n\t}\n\n\tprivate profileDiagnosticKeys = new Set<string>();\n\tprivate reportProfileDiagnostic(scope: SettingsErrorScope, message: string): void {\n\t\tconst key = `${scope}:${message}`;\n\t\tif (this.profileDiagnosticKeys.has(key)) {\n\t\t\treturn;\n\t\t}\n\t\tthis.profileDiagnosticKeys.add(key);\n\t\tthis.errors.push({ scope, error: new Error(message) });\n\t}\n\n\tprivate getActiveProfileNamesForDiagnostics(): string[] {\n\t\t// Mirror getActiveResourceProfileNames()'s source precedence (runtime profiles from\n\t\t// --resource-profile take priority) so a bad runtime profile name still surfaces a\n\t\t// \"profile not found\" diagnostic instead of silently applying zero filtering.\n\t\tif (this.runtimeResourceProfiles !== undefined) {\n\t\t\treturn normalizeResourceProfileNames(this.runtimeResourceProfiles);\n\t\t}\n\t\t// `/profiles none` is persisted globally as an explicit empty array. It is a durable\n\t\t// user-level off switch and must dominate project/directory/default/external fallbacks until\n\t\t// the user explicitly selects another profile.\n\t\tif (hasExplicitEmptyActiveResourceProfileSelection(this.globalSettings)) {\n\t\t\treturn [];\n\t\t}\n\t\tconst explicitProfiles =\n\t\t\tthis.settings.activeResourceProfiles && this.settings.activeResourceProfiles.length > 0\n\t\t\t\t? this.settings.activeResourceProfiles\n\t\t\t\t: this.settings.activeResourceProfile\n\t\t\t\t\t? [this.settings.activeResourceProfile]\n\t\t\t\t\t: [];\n\t\tconst names = normalizeResourceProfileNames(explicitProfiles);\n\t\treturn names.length > 0 || hasExplicitActiveResourceProfileSelection(this.settings)\n\t\t\t? names\n\t\t\t: this.getExternalRootActiveResourceProfileNames();\n\t}\n\n\tprivate getExternalRootActiveResourceProfileNames(): string[] {\n\t\tconst names: string[] = [];\n\t\tfor (const root of this.getEffectiveExternalResourceRoots()) {\n\t\t\ttry {\n\t\t\t\tconst settingsPath = join(root, \"settings.json\");\n\t\t\t\tif (!existsSync(settingsPath)) continue;\n\t\t\t\tconst parsed = JSON.parse(readFileSync(settingsPath, \"utf-8\")) as Settings;\n\t\t\t\tnames.push(...normalizeActiveResourceProfiles(parsed));\n\t\t\t} catch {\n\t\t\t\t// External-root settings are optional; ignore malformed files for active-profile fallback.\n\t\t\t}\n\t\t}\n\t\treturn [...new Set(names)];\n\t}\n\n\tprivate refreshProfileRegistry(): void {\n\t\tthis.profileDiagnosticKeys.clear();\n\t\tthis.profileRegistry = this.createProfileRegistry();\n\t\tconst registryDiagnostics = this.profileRegistry.listDiagnostics();\n\t\tfor (const diagnostic of registryDiagnostics) {\n\t\t\tconst path = diagnostic.path ? ` (${diagnostic.path})` : \"\";\n\t\t\tthis.reportProfileDiagnostic(\"global\", `Profile diagnostic${path}: ${diagnostic.message}`);\n\t\t}\n\t\tfor (const profileName of this.getActiveProfileNamesForDiagnostics()) {\n\t\t\tif (!this.resolveProfileFromRegistry(this.profileRegistry, profileName)) {\n\t\t\t\tthis.reportProfileDiagnostic(\"global\", `Active profile not found: ${profileName}`);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate resolveProfileFromRegistry(registry: ProfileRegistry, profileRef: string) {\n\t\treturn profileRef.startsWith(\"./\") || profileRef.startsWith(\"../\")\n\t\t\t? registry.resolveProfileRef(profileRef, this.storage.getProfileResolutionBaseDir?.() ?? process.cwd())\n\t\t\t: registry.getProfile(profileRef);\n\t}\n\n\tprivate mergeEffectiveSettings(): Settings {\n\t\tlet merged = deepMergeSettings(this.globalSettings, this.projectSettings);\n\t\tmerged = deepMergeSettings(merged, this.directoryProfileSettings);\n\t\tif (this.runtimeResourceProfiles !== undefined) {\n\t\t\tmerged = deepMergeSettings(merged, {\n\t\t\t\tactiveResourceProfile: this.runtimeResourceProfiles,\n\t\t\t\tactiveResourceProfiles: this.runtimeResourceProfiles,\n\t\t\t});\n\t\t}\n\t\treturn merged;\n\t}\n\n\tprivate recomputeSettings(): void {\n\t\tthis.settings = this.mergeEffectiveSettings();\n\t\tthis.refreshProfileRegistry();\n\t}\n\n\t/** Create a SettingsManager that loads from files */\n\tstatic create(\n\t\tcwd: string,\n\t\tagentDir: string = getAgentDir(),\n\t\toptions: SettingsManagerCreateOptions = {},\n\t): SettingsManager {\n\t\tconst storage = new FileSettingsStorage(cwd, agentDir);\n\t\treturn SettingsManager.fromStorage(storage, options);\n\t}\n\n\t/** Create a SettingsManager from an arbitrary storage backend */\n\tstatic fromStorage(storage: SettingsStorage, options: SettingsManagerCreateOptions = {}): SettingsManager {\n\t\tconst projectTrusted = options.projectTrusted ?? true;\n\t\tconst globalLoad = SettingsManager.tryLoadFromStorage(storage, \"global\");\n\t\tconst projectLoad = SettingsManager.tryLoadFromStorage(storage, \"project\", projectTrusted);\n\t\tconst directoryProfileLoad = SettingsManager.tryLoadDirectoryProfileFromStorage(storage);\n\t\tconst initialErrors: SettingsError[] = [];\n\t\tif (globalLoad.error) {\n\t\t\tinitialErrors.push({ scope: \"global\", error: globalLoad.error });\n\t\t}\n\t\tif (projectLoad.error) {\n\t\t\tinitialErrors.push({ scope: \"project\", error: projectLoad.error });\n\t\t}\n\t\tif (directoryProfileLoad.error) {\n\t\t\tinitialErrors.push({ scope: \"directoryProfile\", error: directoryProfileLoad.error });\n\t\t}\n\n\t\treturn new SettingsManager(\n\t\t\tstorage,\n\t\t\tglobalLoad.settings,\n\t\t\tprojectLoad.settings,\n\t\t\tdirectoryProfileLoad.settings,\n\t\t\tglobalLoad.error,\n\t\t\tprojectLoad.error,\n\t\t\tinitialErrors,\n\t\t\tprojectTrusted,\n\t\t\tdirectoryProfileLoad.info,\n\t\t);\n\t}\n\n\t/** Create an in-memory SettingsManager (no file I/O) */\n\tstatic inMemory(settings: Partial<Settings> = {}): SettingsManager {\n\t\tconst storage = new InMemorySettingsStorage();\n\t\tconst initialSettings = SettingsManager.migrateSettings(structuredClone(settings) as Record<string, unknown>);\n\t\tstorage.withLock(\"global\", () => JSON.stringify(initialSettings, null, 2));\n\t\treturn SettingsManager.fromStorage(storage);\n\t}\n\n\tprivate static loadFromStorage(storage: SettingsStorage, scope: SettingsScope, projectTrusted = true): Settings {\n\t\tif (scope === \"project\" && !projectTrusted) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet content: string | undefined;\n\t\tstorage.withLock(scope, (current) => {\n\t\t\tcontent = current;\n\t\t\treturn undefined;\n\t\t});\n\n\t\tif (!content) {\n\t\t\treturn {};\n\t\t}\n\t\tconst settings = JSON.parse(content);\n\t\treturn SettingsManager.migrateSettings(settings);\n\t}\n\n\tprivate static tryLoadFromStorage(\n\t\tstorage: SettingsStorage,\n\t\tscope: SettingsScope,\n\t\tprojectTrusted = true,\n\t): { settings: Settings; error: Error | null } {\n\t\ttry {\n\t\t\treturn { settings: SettingsManager.loadFromStorage(storage, scope, projectTrusted), error: null };\n\t\t} catch (error) {\n\t\t\treturn { settings: {}, error: error as Error };\n\t\t}\n\t}\n\n\tprivate static tryLoadDirectoryProfileFromStorage(storage: SettingsStorage): {\n\t\tsettings: Settings;\n\t\terror: Error | null;\n\t\tinfo: DirectoryResourceProfileInfo | null;\n\t} {\n\t\tif (!(storage instanceof FileSettingsStorage)) {\n\t\t\treturn { settings: {}, error: null, info: null };\n\t\t}\n\t\tconst info = storage.getDirectoryResourceProfileInfo();\n\t\ttry {\n\t\t\tconst content = storage.readDirectoryResourceProfile();\n\t\t\tif (!content) return { settings: {}, error: null, info };\n\t\t\tconst settings = JSON.parse(content);\n\t\t\treturn { settings: SettingsManager.migrateSettings(settings), error: null, info };\n\t\t} catch (error) {\n\t\t\treturn { settings: {}, error: error as Error, info };\n\t\t}\n\t}\n\n\t/** Migrate old settings format to new format */\n\tprivate static migrateSettings(settings: Record<string, unknown>): Settings {\n\t\t// Migrate queueMode -> steeringMode\n\t\tif (\"queueMode\" in settings && !(\"steeringMode\" in settings)) {\n\t\t\tsettings.steeringMode = settings.queueMode;\n\t\t\tdelete settings.queueMode;\n\t\t}\n\n\t\t// Migrate legacy websockets boolean -> transport enum\n\t\tif (!(\"transport\" in settings) && typeof settings.websockets === \"boolean\") {\n\t\t\tsettings.transport = settings.websockets ? \"websocket\" : \"sse\";\n\t\t\tdelete settings.websockets;\n\t\t}\n\n\t\t// Migrate old skills object format to new array format\n\t\tif (\n\t\t\t\"skills\" in settings &&\n\t\t\ttypeof settings.skills === \"object\" &&\n\t\t\tsettings.skills !== null &&\n\t\t\t!Array.isArray(settings.skills)\n\t\t) {\n\t\t\tconst skillsSettings = settings.skills as {\n\t\t\t\tenableSkillCommands?: boolean;\n\t\t\t\tcustomDirectories?: unknown;\n\t\t\t};\n\t\t\tif (skillsSettings.enableSkillCommands !== undefined && settings.enableSkillCommands === undefined) {\n\t\t\t\tsettings.enableSkillCommands = skillsSettings.enableSkillCommands;\n\t\t\t}\n\t\t\tif (Array.isArray(skillsSettings.customDirectories) && skillsSettings.customDirectories.length > 0) {\n\t\t\t\tsettings.skills = skillsSettings.customDirectories;\n\t\t\t} else {\n\t\t\t\tdelete settings.skills;\n\t\t\t}\n\t\t}\n\n\t\t// Migrate retry.maxDelayMs -> retry.provider.maxRetryDelayMs\n\t\tif (\n\t\t\t\"retry\" in settings &&\n\t\t\ttypeof settings.retry === \"object\" &&\n\t\t\tsettings.retry !== null &&\n\t\t\t!Array.isArray(settings.retry)\n\t\t) {\n\t\t\tconst retrySettings = settings.retry as Record<string, unknown>;\n\t\t\tconst providerSettings =\n\t\t\t\ttypeof retrySettings.provider === \"object\" && retrySettings.provider !== null\n\t\t\t\t\t? (retrySettings.provider as Record<string, unknown>)\n\t\t\t\t\t: undefined;\n\t\t\tif (\n\t\t\t\ttypeof retrySettings.maxDelayMs === \"number\" &&\n\t\t\t\t(providerSettings?.maxRetryDelayMs === undefined || providerSettings?.maxRetryDelayMs === null)\n\t\t\t) {\n\t\t\t\tretrySettings.provider = {\n\t\t\t\t\t...(providerSettings ?? {}),\n\t\t\t\t\tmaxRetryDelayMs: retrySettings.maxDelayMs,\n\t\t\t\t};\n\t\t\t}\n\t\t\tdelete retrySettings.maxDelayMs;\n\t\t}\n\n\t\treturn settings as Settings;\n\t}\n\n\tgetGlobalSettings(): Settings {\n\t\treturn structuredClone(this.globalSettings);\n\t}\n\n\tgetProjectSettings(): Settings {\n\t\treturn structuredClone(this.projectSettings);\n\t}\n\n\tgetDirectoryResourceProfileSettings(): Settings {\n\t\treturn structuredClone(this.directoryProfileSettings);\n\t}\n\n\tgetDirectoryResourceProfileInfo(): DirectoryResourceProfileInfo | null {\n\t\treturn this.directoryProfileInfo ? { ...this.directoryProfileInfo } : null;\n\t}\n\n\tgetProfileRegistry(): ProfileRegistry {\n\t\tthis.refreshProfileRegistry();\n\t\treturn this.profileRegistry;\n\t}\n\n\tgetActiveResourceProfileNames(): string[] {\n\t\tif (this.runtimeResourceProfiles !== undefined) {\n\t\t\treturn [...this.runtimeResourceProfiles];\n\t\t}\n\t\tif (hasExplicitEmptyActiveResourceProfileSelection(this.globalSettings)) {\n\t\t\treturn [];\n\t\t}\n\t\tconst names = normalizeActiveResourceProfiles(this.settings);\n\t\treturn names.length > 0 || hasExplicitActiveResourceProfileSelection(this.settings)\n\t\t\t? names\n\t\t\t: this.getExternalRootActiveResourceProfileNames();\n\t}\n\n\thasExplicitActiveResourceProfileSelection(): boolean {\n\t\t// An explicit empty runtime/settings selection means \"no profile\", not an invalid profile\n\t\t// whose authority should collapse to deny-all. Non-empty unresolved refs remain explicit and\n\t\t// are diagnosed/strictly denied through the normal active-profile path.\n\t\treturn this.getActiveResourceProfileNames().length > 0;\n\t}\n\n\t/**\n\t * Aggregate ONLY the active profiles' contribution to a resource kind's filter — the user's own\n\t * legacy `disabledResources` list is not merged in. Includes the strict-UAC deny-all (an\n\t * authority-bearing kind no active profile mentions is denied outright); that denial is\n\t * profile-driven too. Shared by `getResourceProfileFilter` (which merges the legacy disable list\n\t * on top) and `isResourceDeniedByActiveProfile` (which must attribute a denial to the profile\n\t * ALONE — a user-only disable must never be reported as \"withheld by the active resource\n\t * profile\").\n\t */\n\tprivate computeProfileOnlyResourceFilter(kind: ResourceProfileKind): Required<ResourceProfileFilterSettings> {\n\t\tconst profileFilter: ResourceProfileFilterSettings = {};\n\t\tconst seenProfiles = new Set<string>();\n\t\tconst registry = this.getProfileRegistry();\n\t\tconst activeProfileNames = this.getActiveResourceProfileNames();\n\t\tlet kindMentionedByProfile = false;\n\t\tfor (const profileName of activeProfileNames) {\n\t\t\tif (seenProfiles.has(profileName)) continue;\n\t\t\tseenProfiles.add(profileName);\n\t\t\tconst kindFilter = this.resolveProfileFromRegistry(registry, profileName)?.resources[kind];\n\t\t\tif (kindFilter && ((kindFilter.allow?.length ?? 0) > 0 || (kindFilter.block?.length ?? 0) > 0)) {\n\t\t\t\tkindMentionedByProfile = true;\n\t\t\t}\n\t\t\tappendFilter(profileFilter, kindFilter);\n\t\t}\n\n\t\t// Strict UAC: an active profile set is the COMPLETE grant. An authority-bearing kind that no\n\t\t// active profile explicitly mentions is denied outright — grant-all must be said out loud\n\t\t// via `allow: [\"*\"]`. Themes are exempt (cosmetic, no authority). With no active profile,\n\t\t// behavior is unchanged: profiles are the opt-in least-privilege boundary.\n\t\tif (activeProfileNames.length > 0 && kind !== \"themes\" && !kindMentionedByProfile) {\n\t\t\treturn { allow: [], block: [\"*\"] };\n\t\t}\n\n\t\treturn {\n\t\t\tallow: [...new Set(profileFilter.allow ?? [])],\n\t\t\tblock: [...new Set(profileFilter.block ?? [])],\n\t\t};\n\t}\n\n\tgetResourceProfileFilter(kind: ResourceProfileKind): Required<ResourceProfileFilterSettings> {\n\t\tconst legacyFilter = mergeResourceProfileFilters(\n\t\t\tcollectLegacyDisabledFilterFromSettings(this.globalSettings, kind),\n\t\t\tcollectLegacyDisabledFilterFromSettings(this.projectSettings, kind),\n\t\t\tcollectLegacyDisabledFilterFromSettings(this.directoryProfileSettings, kind),\n\t\t);\n\t\tconst filter = mergeResourceProfileFilters(legacyFilter, this.computeProfileOnlyResourceFilter(kind));\n\t\treturn {\n\t\t\tallow: [...new Set(filter.allow ?? [])],\n\t\t\tblock: [...new Set(filter.block ?? [])],\n\t\t};\n\t}\n\n\t/**\n\t * Profile grants the user's own disable list overrides. RATIFIED precedence: a user disable\n\t * (`disabledResources` / `!` overrides) is a hard off-switch that always WINS over a profile\n\t * allow (the legacy disabled filter merges into every profile filter as a block, and blocks\n\t * beat allows). This helper only SURFACES the conflict so a granted-but-disabled resource\n\t * doesn't look like a broken grant.\n\t */\n\tgetProfileGrantsOverriddenByUserDisable(kind: ResourceProfileKind): string[] {\n\t\tconst disabled = this.settings.disabledResources?.[kind] ?? [];\n\t\tif (!Array.isArray(disabled) || disabled.length === 0) return [];\n\t\tconst registry = this.getProfileRegistry();\n\t\tconst conflicts = new Set<string>();\n\t\tfor (const profileName of this.getActiveResourceProfileNames()) {\n\t\t\tconst filter = this.resolveProfileFromRegistry(registry, profileName)?.resources[kind];\n\t\t\tfor (const allowEntry of filter?.allow ?? []) {\n\t\t\t\tif (allowEntry === \"*\") continue;\n\t\t\t\tif (disabled.includes(allowEntry) || matchesResourceProfilePattern(allowEntry, disabled)) {\n\t\t\t\t\tconflicts.add(allowEntry);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn [...conflicts];\n\t}\n\n\tisResourceAllowedByProfile(kind: ResourceProfileKind, resourcePath: string, baseDir = \"\"): boolean {\n\t\tconst filter = this.getResourceProfileFilter(kind);\n\t\tif (filter.allow.length > 0 && !matchesResourceProfilePattern(resourcePath, filter.allow, baseDir)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (matchesResourceProfilePattern(resourcePath, filter.block, baseDir)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * Whether the ACTIVE PROFILE alone denies this resource — the user's own legacy\n\t * `disabledResources` list is ignored. A \"withheld by the active resource profile\" report must\n\t * use this, not `isResourceAllowedByProfile`: that check merges the user's own disables in, so a\n\t * plain user-disabled resource (no profile even mentioning it) would otherwise be misattributed\n\t * to the profile.\n\t */\n\tisResourceDeniedByActiveProfile(kind: ResourceProfileKind, resourcePath: string, baseDir = \"\"): boolean {\n\t\tif (this.getActiveResourceProfileNames().length === 0) return false;\n\t\tconst filter = this.computeProfileOnlyResourceFilter(kind);\n\t\tif (filter.allow.length > 0 && !matchesResourceProfilePattern(resourcePath, filter.allow, baseDir)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn matchesResourceProfilePattern(resourcePath, filter.block, baseDir);\n\t}\n\n\t/**\n\t * Situational soul(s) of the currently active profile(s): a system-prompt identity prefix\n\t * injected while the profile is active. Multiple active profiles' souls are concatenated.\n\t */\n\tgetActiveProfileSoul(): string | undefined {\n\t\t// First-wins precedence (like profile model/thinking): the most-specific active profile's soul\n\t\t// is the identity — concatenating multiple souls would inject contradictory identities.\n\t\tconst registry = this.getProfileRegistry();\n\t\tconst seen = new Set<string>();\n\t\tfor (const profileName of this.getActiveResourceProfileNames()) {\n\t\t\tif (seen.has(profileName)) continue;\n\t\t\tseen.add(profileName);\n\t\t\tconst soul = this.resolveProfileFromRegistry(registry, profileName)?.soul?.trim();\n\t\t\tif (soul) return soul;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tisProjectTrusted(): boolean {\n\t\treturn this.projectTrusted;\n\t}\n\n\tsetProjectTrusted(trusted: boolean): void {\n\t\tif (this.projectTrusted === trusted) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.projectTrusted = trusted;\n\t\tthis.modifiedProjectFields.clear();\n\t\tthis.modifiedProjectNestedFields.clear();\n\n\t\tif (!trusted) {\n\t\t\tthis.projectSettings = {};\n\t\t\tthis.projectSettingsLoadError = null;\n\t\t\tthis.recomputeSettings();\n\t\t\treturn;\n\t\t}\n\n\t\tconst projectLoad = SettingsManager.tryLoadFromStorage(this.storage, \"project\", trusted);\n\t\tthis.projectSettings = projectLoad.settings;\n\t\tthis.projectSettingsLoadError = projectLoad.error;\n\t\tif (projectLoad.error) {\n\t\t\tthis.recordError(\"project\", projectLoad.error);\n\t\t}\n\t\tthis.recomputeSettings();\n\t}\n\n\tasync reload(): Promise<void> {\n\t\tawait this.writeQueue;\n\t\tconst globalLoad = SettingsManager.tryLoadFromStorage(this.storage, \"global\");\n\t\tif (!globalLoad.error) {\n\t\t\tthis.globalSettings = globalLoad.settings;\n\t\t\tthis.globalSettingsLoadError = null;\n\t\t} else {\n\t\t\tthis.globalSettingsLoadError = globalLoad.error;\n\t\t\tthis.recordError(\"global\", globalLoad.error);\n\t\t}\n\n\t\tthis.modifiedFields.clear();\n\t\tthis.modifiedNestedFields.clear();\n\t\tthis.modifiedProjectFields.clear();\n\t\tthis.modifiedProjectNestedFields.clear();\n\n\t\tconst projectLoad = SettingsManager.tryLoadFromStorage(this.storage, \"project\", this.projectTrusted);\n\t\tif (!projectLoad.error) {\n\t\t\tthis.projectSettings = projectLoad.settings;\n\t\t\tthis.projectSettingsLoadError = null;\n\t\t} else {\n\t\t\tthis.projectSettingsLoadError = projectLoad.error;\n\t\t\tthis.recordError(\"project\", projectLoad.error);\n\t\t}\n\n\t\tconst directoryProfileLoad = SettingsManager.tryLoadDirectoryProfileFromStorage(this.storage);\n\t\tthis.directoryProfileInfo = directoryProfileLoad.info;\n\t\tif (!directoryProfileLoad.error) {\n\t\t\tthis.directoryProfileSettings = directoryProfileLoad.settings;\n\t\t} else {\n\t\t\tthis.recordError(\"directoryProfile\", directoryProfileLoad.error);\n\t\t}\n\n\t\tthis.recomputeSettings();\n\t}\n\n\t/** Capture the complete in-memory settings generation before runtime reload mutates it. */\n\tcreateReloadSnapshot(): SettingsReloadSnapshot {\n\t\treturn {\n\t\t\tglobalSettings: structuredClone(this.globalSettings),\n\t\t\tprojectSettings: structuredClone(this.projectSettings),\n\t\t\tdirectoryProfileSettings: structuredClone(this.directoryProfileSettings),\n\t\t\truntimeResourceProfiles:\n\t\t\t\tthis.runtimeResourceProfiles === undefined ? undefined : [...this.runtimeResourceProfiles],\n\t\t\tinlineResourceProfileDefinitions: structuredClone(this.inlineResourceProfileDefinitions),\n\t\t\tdiscoveredResourceProfileDefinitions: structuredClone(this.discoveredResourceProfileDefinitions),\n\t\t\teffectiveSettings: structuredClone(this.settings),\n\t\t\tprojectTrusted: this.projectTrusted,\n\t\t\tmodifiedFields: new Set(this.modifiedFields),\n\t\t\tmodifiedNestedFields: this.cloneModifiedNestedFields(this.modifiedNestedFields),\n\t\t\tmodifiedProjectFields: new Set(this.modifiedProjectFields),\n\t\t\tmodifiedProjectNestedFields: this.cloneModifiedNestedFields(this.modifiedProjectNestedFields),\n\t\t\tglobalSettingsLoadError: this.globalSettingsLoadError,\n\t\t\tprojectSettingsLoadError: this.projectSettingsLoadError,\n\t\t\tdirectoryProfileInfo: this.directoryProfileInfo ? { ...this.directoryProfileInfo } : null,\n\t\t\terrors: [...this.errors],\n\t\t};\n\t}\n\n\t/** Restore a failed runtime reload without changing the on-disk settings generation. */\n\trestoreReloadSnapshot(snapshot: SettingsReloadSnapshot): void {\n\t\tthis.globalSettings = structuredClone(snapshot.globalSettings);\n\t\tthis.projectSettings = structuredClone(snapshot.projectSettings);\n\t\tthis.directoryProfileSettings = structuredClone(snapshot.directoryProfileSettings);\n\t\tthis.runtimeResourceProfiles =\n\t\t\tsnapshot.runtimeResourceProfiles === undefined ? undefined : [...snapshot.runtimeResourceProfiles];\n\t\tthis.inlineResourceProfileDefinitions = structuredClone(snapshot.inlineResourceProfileDefinitions);\n\t\tthis.discoveredResourceProfileDefinitions = structuredClone(snapshot.discoveredResourceProfileDefinitions);\n\t\tthis.settings = structuredClone(snapshot.effectiveSettings);\n\t\tthis.projectTrusted = snapshot.projectTrusted;\n\t\tthis.modifiedFields = new Set(snapshot.modifiedFields);\n\t\tthis.modifiedNestedFields = this.cloneModifiedNestedFields(snapshot.modifiedNestedFields);\n\t\tthis.modifiedProjectFields = new Set(snapshot.modifiedProjectFields);\n\t\tthis.modifiedProjectNestedFields = this.cloneModifiedNestedFields(snapshot.modifiedProjectNestedFields);\n\t\tthis.globalSettingsLoadError = snapshot.globalSettingsLoadError;\n\t\tthis.projectSettingsLoadError = snapshot.projectSettingsLoadError;\n\t\tthis.directoryProfileInfo = snapshot.directoryProfileInfo ? { ...snapshot.directoryProfileInfo } : null;\n\t\tthis.errors = [...snapshot.errors];\n\t\tthis.refreshProfileRegistry();\n\t}\n\n\t/** Apply additional overrides on top of current settings */\n\tapplyOverrides(overrides: Partial<Settings>): void {\n\t\tthis.settings = deepMergeSettings(this.settings, overrides);\n\t}\n\n\t/** Select runtime-only resource profiles, e.g. from CLI/subagent launch options. */\n\tsetRuntimeResourceProfiles(profileNames: string[]): void {\n\t\tthis.runtimeResourceProfiles = normalizeResourceProfileNames(profileNames);\n\t\tthis.recomputeSettings();\n\t}\n\n\t/** Add one-shot profile definitions from CLI/SDK/ephemeral agent launch input. Never writes to disk. */\n\taddInlineResourceProfileDefinitions(\n\t\tprofiles: Record<string, ResourceProfileSettings | ProfileDefinitionInput>,\n\t): void {\n\t\tconst next = { ...this.inlineResourceProfileDefinitions };\n\t\tfor (const [name, input] of Object.entries(profiles)) {\n\t\t\tconst existing = next[name];\n\t\t\tconst definition = Object.hasOwn(input, \"resources\")\n\t\t\t\t? (input as ProfileDefinitionInput)\n\t\t\t\t: { resources: input as ResourceProfileSettings };\n\t\t\tconst resources = mergeResourceProfileSettings(existing?.resources, definition.resources);\n\t\t\tnext[name] = this.mergeProfileDefinition(name, definition, resources, existing);\n\t\t}\n\t\tthis.inlineResourceProfileDefinitions = next;\n\t\tthis.refreshProfileRegistry();\n\t}\n\n\t/** Replace profile definitions discovered inside loaded resource files. Never writes to disk. */\n\treplaceDiscoveredResourceProfileDefinitions(profiles: Record<string, ResourceProfileSettings>): void {\n\t\tthis.discoveredResourceProfileDefinitions = { ...profiles };\n\t\tthis.refreshProfileRegistry();\n\t}\n\n\t/** Add profile definitions discovered after resource resolution, e.g. context agent files. Never writes to disk. */\n\taddDiscoveredResourceProfileDefinitions(profiles: Record<string, ResourceProfileSettings>): void {\n\t\tthis.discoveredResourceProfileDefinitions = mergeResourceProfileMap(\n\t\t\tthis.discoveredResourceProfileDefinitions,\n\t\t\tprofiles,\n\t\t);\n\t\tthis.refreshProfileRegistry();\n\t}\n\n\tprivate normalizeProfileName(profileName: string): string {\n\t\tconst trimmed = profileName.trim();\n\t\tif (!trimmed) {\n\t\t\tthrow new Error(\"Profile name is required\");\n\t\t}\n\t\tconst errors = validateSkillName(trimmed);\n\t\tif (errors.length > 0) {\n\t\t\tthrow new Error(`Invalid profile name \"${trimmed}\": ${errors.join(\", \")}`);\n\t\t}\n\t\treturn trimmed;\n\t}\n\n\tprivate normalizeProfileSelection(profileName: string): string {\n\t\tconst trimmed = profileName.trim();\n\t\tif (trimmed.startsWith(\"./\") || trimmed.startsWith(\"../\")) {\n\t\t\treturn trimmed;\n\t\t}\n\t\treturn this.normalizeProfileName(trimmed);\n\t}\n\n\tprivate sanitizeProfileResources(resources: ResourceProfileSettings): ResourceProfileSettings {\n\t\tconst result: ResourceProfileSettings = {};\n\t\tfor (const kind of [\"extensions\", \"skills\", \"prompts\", \"themes\", \"agents\", \"tools\"] as const) {\n\t\t\tconst filter = resources[kind];\n\t\t\tif (!filter) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tresult[kind] = {\n\t\t\t\tallow: filter.allow ? [...filter.allow] : undefined,\n\t\t\t\tblock: filter.block ? [...filter.block] : undefined,\n\t\t\t};\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate decodeStoredProfileDefinition(\n\t\tname: string,\n\t\tstored: ResourceProfileSettings | ProfileDefinitionInput | undefined,\n\t): ProfileDefinitionInput {\n\t\tif (stored && Object.hasOwn(stored, \"resources\")) {\n\t\t\tconst definition = stored as ProfileDefinitionInput;\n\t\t\treturn { ...definition, name, resources: this.sanitizeProfileResources(definition.resources) };\n\t\t}\n\t\treturn {\n\t\t\tname,\n\t\t\tresources: this.sanitizeProfileResources((stored as ResourceProfileSettings | undefined) ?? {}),\n\t\t};\n\t}\n\n\tprivate mergeProfileDefinition(\n\t\tname: string,\n\t\tdefinition: ProfileDefinitionInput,\n\t\tresources: ResourceProfileSettings,\n\t\texisting?: ResourceProfileSettings | ProfileDefinitionInput,\n\t): ProfileDefinitionInput {\n\t\tconst previous = this.decodeStoredProfileDefinition(name, existing);\n\t\treturn {\n\t\t\t...previous,\n\t\t\tname,\n\t\t\tresources,\n\t\t\tdescription: definition.description ?? previous.description,\n\t\t\tmodel: Object.hasOwn(definition, \"model\") ? definition.model : previous.model,\n\t\t\tthinking: definition.thinking ?? previous.thinking,\n\t\t\tmodelRouter: definition.modelRouter ?? previous.modelRouter,\n\t\t\tsoul: definition.soul ?? previous.soul,\n\t\t};\n\t}\n\n\tprivate encodeStoredProfileDefinition(\n\t\tdefinition: ProfileDefinitionInput,\n\t): ResourceProfileSettings | ProfileDefinitionInput | undefined {\n\t\tconst hasMetadata = Boolean(\n\t\t\tdefinition.description || definition.model || definition.thinking || definition.modelRouter || definition.soul,\n\t\t);\n\t\tif (hasMetadata) return definition;\n\t\treturn Object.keys(definition.resources).length > 0 ? definition.resources : undefined;\n\t}\n\n\tprivate setActiveProfileInSettings(settings: Settings, profileName: string | undefined): void {\n\t\tif (profileName) {\n\t\t\tsettings.activeResourceProfile = profileName;\n\t\t\tsettings.activeResourceProfiles = [profileName];\n\t\t\treturn;\n\t\t}\n\t\tsettings.activeResourceProfiles = [];\n\t\tdelete settings.activeResourceProfile;\n\t}\n\n\tprivate rewriteActiveProfileReference(settings: Settings, oldName: string, newName: string | undefined): boolean {\n\t\tlet changed = false;\n\t\tconst rewrite = (values: string[]): string[] => {\n\t\t\tconst next = values.flatMap((value) => {\n\t\t\t\tif (value !== oldName) return [value];\n\t\t\t\tchanged = true;\n\t\t\t\treturn newName ? [newName] : [];\n\t\t\t});\n\t\t\treturn [...new Set(next)];\n\t\t};\n\n\t\tif (settings.activeResourceProfiles !== undefined) {\n\t\t\tconst next = rewrite(normalizeResourceProfileNames(settings.activeResourceProfiles));\n\t\t\tif (next.length > 0) settings.activeResourceProfiles = next;\n\t\t\telse delete settings.activeResourceProfiles;\n\t\t}\n\t\tif (settings.activeResourceProfile !== undefined) {\n\t\t\tconst next = rewrite(normalizeResourceProfileNames(settings.activeResourceProfile));\n\t\t\tif (next.length === 0) delete settings.activeResourceProfile;\n\t\t\telse\n\t\t\t\tsettings.activeResourceProfile =\n\t\t\t\t\tArray.isArray(settings.activeResourceProfile) || next.length > 1 ? next : next[0];\n\t\t}\n\t\treturn changed;\n\t}\n\n\tprivate rewriteReusableProfileSelections(oldName: string, newName: string | undefined): void {\n\t\tif (this.runtimeResourceProfiles?.includes(oldName)) {\n\t\t\tthis.runtimeResourceProfiles = [\n\t\t\t\t...new Set(\n\t\t\t\t\tthis.runtimeResourceProfiles.flatMap((profile) =>\n\t\t\t\t\t\tprofile === oldName ? (newName ? [newName] : []) : [profile],\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t];\n\t\t}\n\n\t\tif (this.rewriteActiveProfileReference(this.globalSettings, oldName, newName)) {\n\t\t\tthis.markModified(\"activeResourceProfile\");\n\t\t\tthis.markModified(\"activeResourceProfiles\");\n\t\t\tthis.save();\n\t\t}\n\n\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\tif (this.rewriteActiveProfileReference(projectSettings, oldName, newName)) {\n\t\t\tthis.markProjectModified(\"activeResourceProfile\");\n\t\t\tthis.markProjectModified(\"activeResourceProfiles\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t}\n\n\t\tif (this.rewriteActiveProfileReference(this.directoryProfileSettings, oldName, newName)) {\n\t\t\tthis.persistDirectoryProfiles(() => {});\n\t\t}\n\t\tthis.recomputeSettings();\n\t}\n\n\tprivate persistDirectoryProfiles(update: (settings: Settings) => void): void {\n\t\tconst next = structuredClone(this.directoryProfileSettings);\n\t\tupdate(next);\n\t\tthis.directoryProfileSettings = next;\n\t\tthis.recomputeSettings();\n\n\t\tif (!this.directoryProfileInfo) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.enqueueWrite(\"directoryProfile\", () => {\n\t\t\tthis.storage.withLock(\"directoryProfile\", (current) => {\n\t\t\t\tconst currentSettings = current\n\t\t\t\t\t? SettingsManager.migrateSettings(JSON.parse(current) as Record<string, unknown>)\n\t\t\t\t\t: {};\n\t\t\t\tconst merged: Settings = {\n\t\t\t\t\t...currentSettings,\n\t\t\t\t\t...next,\n\t\t\t\t\tresourceProfiles: next.resourceProfiles,\n\t\t\t\t\tactiveResourceProfiles: next.activeResourceProfiles,\n\t\t\t\t\tactiveResourceProfile: next.activeResourceProfile,\n\t\t\t\t};\n\t\t\t\tif (!next.resourceProfiles) {\n\t\t\t\t\tdelete merged.resourceProfiles;\n\t\t\t\t}\n\t\t\t\tif (!next.activeResourceProfiles && next.activeResourceProfile === undefined) {\n\t\t\t\t\tdelete merged.activeResourceProfiles;\n\t\t\t\t\tdelete merged.activeResourceProfile;\n\t\t\t\t}\n\t\t\t\treturn JSON.stringify(merged, null, 2);\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate getProfileFilePath(profileName: string): string {\n\t\tconst normalized = this.normalizeProfileName(profileName);\n\t\tconst profilesDir = this.storage.getProfilesDir?.();\n\t\tif (!profilesDir) {\n\t\t\tthrow new Error(\"Profiles directory is not configured\");\n\t\t}\n\t\treturn join(resolve(profilesDir), `${normalized}.json`);\n\t}\n\n\t/**\n\t * Create or update a profile definition in the selected persistence scope.\n\t */\n\tsetProfileDefinition(profileName: string, definition: ProfileDefinitionInput, scope: ProfilePersistenceScope): void {\n\t\tconst name = this.normalizeProfileName(profileName);\n\t\tconst resources = this.sanitizeProfileResources(definition.resources);\n\n\t\tif (scope === \"session\") {\n\t\t\tconst next = { ...this.inlineResourceProfileDefinitions };\n\t\t\tconst payload = this.mergeProfileDefinition(name, definition, resources, next[name]);\n\t\t\tif (this.encodeStoredProfileDefinition(payload)) {\n\t\t\t\tnext[name] = payload;\n\t\t\t} else {\n\t\t\t\tdelete next[name];\n\t\t\t}\n\t\t\tthis.inlineResourceProfileDefinitions = next;\n\t\t\tthis.refreshProfileRegistry();\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"global\") {\n\t\t\tconst next = structuredClone(this.globalSettings);\n\t\t\tnext.resourceProfiles = { ...(next.resourceProfiles ?? {}) };\n\t\t\tconst stored = this.encodeStoredProfileDefinition(\n\t\t\t\tthis.mergeProfileDefinition(name, definition, resources, next.resourceProfiles[name]),\n\t\t\t);\n\t\t\tif (stored) {\n\t\t\t\tnext.resourceProfiles[name] = stored;\n\t\t\t} else {\n\t\t\t\tdelete next.resourceProfiles[name];\n\t\t\t}\n\t\t\tif (Object.keys(next.resourceProfiles).length === 0) {\n\t\t\t\tdelete next.resourceProfiles;\n\t\t\t}\n\t\t\tthis.globalSettings = next;\n\t\t\tthis.markModified(\"resourceProfiles\");\n\t\t\tthis.save();\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"project\") {\n\t\t\tthis.updateProjectSettings(\"resourceProfiles\", (settings) => {\n\t\t\t\tconst next = structuredClone(settings.resourceProfiles ?? {});\n\t\t\t\tconst stored = this.encodeStoredProfileDefinition(\n\t\t\t\t\tthis.mergeProfileDefinition(name, definition, resources, next[name]),\n\t\t\t\t);\n\t\t\t\tif (stored) {\n\t\t\t\t\tnext[name] = stored;\n\t\t\t\t} else {\n\t\t\t\t\tdelete next[name];\n\t\t\t\t}\n\t\t\t\tif (Object.keys(next).length > 0) {\n\t\t\t\t\tsettings.resourceProfiles = next;\n\t\t\t\t} else {\n\t\t\t\t\tdelete settings.resourceProfiles;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"directory\") {\n\t\t\tthis.persistDirectoryProfiles((current) => {\n\t\t\t\tconst next = { ...(current.resourceProfiles ?? {}) };\n\t\t\t\tconst stored = this.encodeStoredProfileDefinition(\n\t\t\t\t\tthis.mergeProfileDefinition(name, definition, resources, next[name]),\n\t\t\t\t);\n\t\t\t\tif (stored) {\n\t\t\t\t\tnext[name] = stored;\n\t\t\t\t} else {\n\t\t\t\t\tdelete next[name];\n\t\t\t\t}\n\t\t\t\tif (Object.keys(next).length > 0) {\n\t\t\t\t\tcurrent.resourceProfiles = next;\n\t\t\t\t} else {\n\t\t\t\t\tdelete current.resourceProfiles;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst path = this.getProfileFilePath(name);\n\t\tconst existing = existsSync(path)\n\t\t\t? parseProfileFileDefinition(readFileSync(path, \"utf-8\"), name)\n\t\t\t: { name, resources: {} };\n\t\tconst payload = this.mergeProfileDefinition(name, definition, resources, existing);\n\t\tmkdirSync(dirname(path), { recursive: true });\n\t\twriteFileSync(path, JSON.stringify(payload, null, 2), \"utf-8\");\n\t}\n\n\t/**\n\t * Delete a profile from the selected scope.\n\t */\n\tdeleteProfile(profileName: string, scope: ProfilePersistenceScope): void {\n\t\tconst name = this.normalizeProfileName(profileName);\n\n\t\tif (scope === \"session\") {\n\t\t\tconst next = { ...this.inlineResourceProfileDefinitions };\n\t\t\tdelete next[name];\n\t\t\tthis.inlineResourceProfileDefinitions = next;\n\t\t\tthis.refreshProfileRegistry();\n\t\t\tif (this.runtimeResourceProfiles) {\n\t\t\t\tthis.setRuntimeResourceProfiles(this.runtimeResourceProfiles.filter((profile) => profile !== name));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"global\") {\n\t\t\tconst next = { ...(this.globalSettings.resourceProfiles ?? {}) };\n\t\t\tdelete next[name];\n\t\t\tif (Object.keys(next).length > 0) {\n\t\t\t\tthis.globalSettings.resourceProfiles = next;\n\t\t\t} else {\n\t\t\t\tdelete this.globalSettings.resourceProfiles;\n\t\t\t}\n\t\t\tif (this.globalSettings.activeResourceProfile === name) {\n\t\t\t\tdelete this.globalSettings.activeResourceProfile;\n\t\t\t}\n\t\t\tif (this.globalSettings.activeResourceProfiles) {\n\t\t\t\tthis.globalSettings.activeResourceProfiles = this.globalSettings.activeResourceProfiles.filter(\n\t\t\t\t\t(profile) => profile !== name,\n\t\t\t\t);\n\t\t\t\tif (this.globalSettings.activeResourceProfiles.length === 0) {\n\t\t\t\t\tdelete this.globalSettings.activeResourceProfiles;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.markModified(\"resourceProfiles\");\n\t\t\tthis.save();\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"project\") {\n\t\t\tthis.updateProjectSettings(\"resourceProfiles\", (settings) => {\n\t\t\t\tconst next = { ...(settings.resourceProfiles ?? {}) };\n\t\t\t\tdelete next[name];\n\t\t\t\tif (Object.keys(next).length > 0) {\n\t\t\t\t\tsettings.resourceProfiles = next;\n\t\t\t\t} else {\n\t\t\t\t\tdelete settings.resourceProfiles;\n\t\t\t\t}\n\t\t\t\tif (settings.activeResourceProfile === name) {\n\t\t\t\t\tdelete settings.activeResourceProfile;\n\t\t\t\t}\n\t\t\t\tif (settings.activeResourceProfiles) {\n\t\t\t\t\tsettings.activeResourceProfiles = settings.activeResourceProfiles.filter((profile) => profile !== name);\n\t\t\t\t\tif (settings.activeResourceProfiles.length === 0) {\n\t\t\t\t\t\tdelete settings.activeResourceProfiles;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"directory\") {\n\t\t\tthis.persistDirectoryProfiles((current) => {\n\t\t\t\tconst next = { ...(current.resourceProfiles ?? {}) };\n\t\t\t\tdelete next[name];\n\t\t\t\tif (Object.keys(next).length > 0) {\n\t\t\t\t\tcurrent.resourceProfiles = next;\n\t\t\t\t} else {\n\t\t\t\t\tdelete current.resourceProfiles;\n\t\t\t\t}\n\t\t\t\tif (current.activeResourceProfile === name) {\n\t\t\t\t\tdelete current.activeResourceProfile;\n\t\t\t\t}\n\t\t\t\tif (current.activeResourceProfiles) {\n\t\t\t\t\tcurrent.activeResourceProfiles = current.activeResourceProfiles.filter((profile) => profile !== name);\n\t\t\t\t\tif (current.activeResourceProfiles.length === 0) {\n\t\t\t\t\t\tdelete current.activeResourceProfiles;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst profilePath = this.getProfileFilePath(name);\n\t\tif (!existsSync(profilePath)) {\n\t\t\tthrow new Error(`Profile not found: ${name}`);\n\t\t}\n\t\trmSync(profilePath, { force: true });\n\t\tthis.rewriteReusableProfileSelections(name, undefined);\n\t}\n\n\trenameProfile(profileName: string, newProfileName: string, scope: ProfilePersistenceScope): void {\n\t\tconst oldName = this.normalizeProfileName(profileName);\n\t\tconst newName = this.normalizeProfileName(newProfileName);\n\t\tif (oldName === newName) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"session\") {\n\t\t\tconst profile = this.inlineResourceProfileDefinitions[oldName];\n\t\t\tif (!profile) {\n\t\t\t\tthrow new Error(`Profile not found: ${oldName}`);\n\t\t\t}\n\t\t\tdelete this.inlineResourceProfileDefinitions[oldName];\n\t\t\tthis.inlineResourceProfileDefinitions[newName] = profile;\n\t\t\tif (this.runtimeResourceProfiles) {\n\t\t\t\tthis.runtimeResourceProfiles = this.runtimeResourceProfiles.map((name) =>\n\t\t\t\t\tname === oldName ? newName : name,\n\t\t\t\t);\n\t\t\t\tthis.setRuntimeResourceProfiles(this.runtimeResourceProfiles);\n\t\t\t}\n\t\t\tthis.refreshProfileRegistry();\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"global\") {\n\t\t\tconst next = structuredClone(this.globalSettings);\n\t\t\tif (!next.resourceProfiles?.[oldName]) {\n\t\t\t\tthrow new Error(`Profile not found: ${oldName}`);\n\t\t\t}\n\t\t\tif (next.resourceProfiles[newName]) {\n\t\t\t\tthrow new Error(`Profile already exists: ${newName}`);\n\t\t\t}\n\t\t\tnext.resourceProfiles[newName] = next.resourceProfiles[oldName]!;\n\t\t\tdelete next.resourceProfiles[oldName];\n\t\t\tif (next.activeResourceProfile === oldName) {\n\t\t\t\tnext.activeResourceProfile = newName;\n\t\t\t}\n\t\t\tif (next.activeResourceProfiles) {\n\t\t\t\tnext.activeResourceProfiles = next.activeResourceProfiles.map((name) =>\n\t\t\t\t\tname === oldName ? newName : name,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.globalSettings = next;\n\t\t\tthis.markModified(\"resourceProfiles\");\n\t\t\tthis.markModified(\"activeResourceProfile\");\n\t\t\tthis.markModified(\"activeResourceProfiles\");\n\t\t\tthis.save();\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"project\") {\n\t\t\tthis.updateProjectSettings(\"resourceProfiles\", (settings) => {\n\t\t\t\tconst next = structuredClone(settings.resourceProfiles ?? {});\n\t\t\t\tif (!next[oldName]) {\n\t\t\t\t\tthrow new Error(`Profile not found: ${oldName}`);\n\t\t\t\t}\n\t\t\t\tif (next[newName]) {\n\t\t\t\t\tthrow new Error(`Profile already exists: ${newName}`);\n\t\t\t\t}\n\t\t\t\tnext[newName] = next[oldName]!;\n\t\t\t\tdelete next[oldName];\n\t\t\t\tsettings.resourceProfiles = next;\n\t\t\t\tif (settings.activeResourceProfile === oldName) {\n\t\t\t\t\tsettings.activeResourceProfile = newName;\n\t\t\t\t}\n\t\t\t\tif (settings.activeResourceProfiles) {\n\t\t\t\t\tsettings.activeResourceProfiles = settings.activeResourceProfiles.map((name) =>\n\t\t\t\t\t\tname === oldName ? newName : name,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"directory\") {\n\t\t\tconst next = structuredClone(this.directoryProfileSettings.resourceProfiles ?? {});\n\t\t\tif (!next[oldName]) {\n\t\t\t\tthrow new Error(`Profile not found: ${oldName}`);\n\t\t\t}\n\t\t\tif (next[newName]) {\n\t\t\t\tthrow new Error(`Profile already exists: ${newName}`);\n\t\t\t}\n\t\t\tnext[newName] = next[oldName]!;\n\t\t\tdelete next[oldName];\n\t\t\tthis.persistDirectoryProfiles((current) => {\n\t\t\t\tcurrent.resourceProfiles = next;\n\t\t\t\tif (current.activeResourceProfile === oldName) {\n\t\t\t\t\tcurrent.activeResourceProfile = newName;\n\t\t\t\t}\n\t\t\t\tif (current.activeResourceProfiles) {\n\t\t\t\t\tcurrent.activeResourceProfiles = current.activeResourceProfiles.map((name) =>\n\t\t\t\t\t\tname === oldName ? newName : name,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst oldPath = this.getProfileFilePath(oldName);\n\t\tconst newPath = this.getProfileFilePath(newName);\n\t\tif (!existsSync(oldPath)) {\n\t\t\tthrow new Error(`Profile not found: ${oldName}`);\n\t\t}\n\t\tif (existsSync(newPath)) {\n\t\t\tthrow new Error(`Profile already exists: ${newName}`);\n\t\t}\n\t\tconst parsed = parseProfileFileDefinition(readFileSync(oldPath, \"utf-8\"), oldName);\n\t\tparsed.name = newName;\n\t\twriteFileSync(newPath, JSON.stringify(parsed, null, 2), \"utf-8\");\n\t\trmSync(oldPath, { force: true });\n\t\tthis.rewriteReusableProfileSelections(oldName, newName);\n\t}\n\n\t/**\n\t * Set active profile selection in the selected scope.\n\t */\n\tsetActiveProfile(profileName: string | undefined, scope: Exclude<ProfilePersistenceScope, \"reusable-file\">): void {\n\t\tconst name = profileName ? this.normalizeProfileSelection(profileName) : undefined;\n\t\tif (scope === \"session\") {\n\t\t\tif (name) {\n\t\t\t\tthis.setRuntimeResourceProfiles([name]);\n\t\t\t} else {\n\t\t\t\tthis.setRuntimeResourceProfiles([]);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"global\") {\n\t\t\tif (name) {\n\t\t\t\tthis.globalSettings.activeResourceProfile = name;\n\t\t\t\tthis.globalSettings.activeResourceProfiles = [name];\n\t\t\t} else {\n\t\t\t\tdelete this.globalSettings.activeResourceProfile;\n\t\t\t\tthis.globalSettings.activeResourceProfiles = [];\n\t\t\t}\n\t\t\tthis.markModified(\"activeResourceProfile\");\n\t\t\tthis.markModified(\"activeResourceProfiles\");\n\t\t\tthis.save();\n\t\t\treturn;\n\t\t}\n\n\t\tif (scope === \"project\") {\n\t\t\tthis.updateProjectSettings(\"activeResourceProfile\", (settings) => {\n\t\t\t\tthis.setActiveProfileInSettings(settings, name);\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tthis.persistDirectoryProfiles((current) => {\n\t\t\tthis.setActiveProfileInSettings(current, name);\n\t\t});\n\t}\n\n\t/** Atomically replace the global profile/authority fields used by config restore and rollback. */\n\treplaceGlobalResourceProfileConfiguration(configuration: GlobalResourceProfileConfiguration): void {\n\t\tconst next = structuredClone(this.globalSettings);\n\t\tconst replace = <K extends keyof GlobalResourceProfileConfiguration>(key: K): void => {\n\t\t\tconst value = configuration[key];\n\t\t\tif (value === undefined) {\n\t\t\t\tdelete next[key];\n\t\t\t} else {\n\t\t\t\tnext[key] = structuredClone(value) as Settings[K];\n\t\t\t}\n\t\t\tthis.markModified(key);\n\t\t};\n\t\treplace(\"resourceProfiles\");\n\t\treplace(\"activeResourceProfile\");\n\t\treplace(\"activeResourceProfiles\");\n\t\treplace(\"externalResourceRoots\");\n\t\treplace(\"trustedResourceRoots\");\n\t\tthis.globalSettings = next;\n\t\tthis.save();\n\t}\n\n\t/** Restore one profile definition's persistent owner after a post-doctor commit failure. */\n\trestoreProfileDefinitionFromReloadSnapshot(\n\t\tprofileName: string,\n\t\tscope: Exclude<ProfilePersistenceScope, \"reusable-file\">,\n\t\tsnapshot: SettingsReloadSnapshot,\n\t): void {\n\t\tconst name = this.normalizeProfileName(profileName);\n\t\tif (scope === \"session\") {\n\t\t\tconst previous = snapshot.inlineResourceProfileDefinitions[name];\n\t\t\tif (previous) this.inlineResourceProfileDefinitions[name] = structuredClone(previous);\n\t\t\telse delete this.inlineResourceProfileDefinitions[name];\n\t\t\tthis.refreshProfileRegistry();\n\t\t\treturn;\n\t\t}\n\n\t\tconst restoreDefinition = (settings: Settings, previous: Settings): void => {\n\t\t\tconst definitions = structuredClone(settings.resourceProfiles ?? {});\n\t\t\tconst oldDefinition = previous.resourceProfiles?.[name];\n\t\t\tif (oldDefinition) definitions[name] = structuredClone(oldDefinition);\n\t\t\telse delete definitions[name];\n\t\t\tif (Object.keys(definitions).length > 0) settings.resourceProfiles = definitions;\n\t\t\telse delete settings.resourceProfiles;\n\t\t};\n\n\t\tif (scope === \"global\") {\n\t\t\trestoreDefinition(this.globalSettings, snapshot.globalSettings);\n\t\t\tthis.markModified(\"resourceProfiles\");\n\t\t\tthis.save();\n\t\t\treturn;\n\t\t}\n\t\tif (scope === \"project\") {\n\t\t\tthis.updateProjectSettings(\"resourceProfiles\", (settings) => {\n\t\t\t\trestoreDefinition(settings, snapshot.projectSettings);\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tthis.persistDirectoryProfiles((settings) => {\n\t\t\trestoreDefinition(settings, snapshot.directoryProfileSettings);\n\t\t});\n\t}\n\n\t/** Mark a global field as modified during this session */\n\tprivate markModified(field: keyof Settings, nestedKey?: string): void {\n\t\tthis.modifiedFields.add(field);\n\t\tif (nestedKey) {\n\t\t\tif (!this.modifiedNestedFields.has(field)) {\n\t\t\t\tthis.modifiedNestedFields.set(field, new Set());\n\t\t\t}\n\t\t\tthis.modifiedNestedFields.get(field)!.add(nestedKey);\n\t\t}\n\t}\n\n\t/** Mark a project field as modified during this session */\n\tprivate markProjectModified(field: keyof Settings, nestedKey?: string): void {\n\t\tthis.modifiedProjectFields.add(field);\n\t\tif (nestedKey) {\n\t\t\tif (!this.modifiedProjectNestedFields.has(field)) {\n\t\t\t\tthis.modifiedProjectNestedFields.set(field, new Set());\n\t\t\t}\n\t\t\tthis.modifiedProjectNestedFields.get(field)!.add(nestedKey);\n\t\t}\n\t}\n\n\tprivate assertProjectTrustedForWrite(): void {\n\t\tif (!this.projectTrusted) {\n\t\t\tthrow new Error(\"Project is not trusted; refusing to write project settings\");\n\t\t}\n\t}\n\n\tprivate recordError(scope: SettingsErrorScope, error: unknown): void {\n\t\tconst normalizedError = error instanceof Error ? error : new Error(String(error));\n\t\tthis.errors.push({ scope, error: normalizedError });\n\t}\n\n\tprivate clearModifiedScope(scope: SettingsScope): void {\n\t\tif (scope === \"global\") {\n\t\t\tthis.modifiedFields.clear();\n\t\t\tthis.modifiedNestedFields.clear();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.modifiedProjectFields.clear();\n\t\tthis.modifiedProjectNestedFields.clear();\n\t}\n\n\tprivate enqueueWrite(scope: SettingsScope, task: () => void): void {\n\t\t// Zero-footprint (worker session): this is the universal disk-write choke for every settings\n\t\t// scope (save() -> \"global\", saveProjectSettings() -> \"project\", directoryProfile writes) --\n\t\t// a worker session never writes settings.json (or any scoped variant) to disk. In-memory\n\t\t// settings are already updated by the caller before reaching here, so reads are unaffected.\n\t\tif (isWorkerSession()) return;\n\t\tthis.writeQueue = this.writeQueue\n\t\t\t.then(() => {\n\t\t\t\tif (scope === \"project\") {\n\t\t\t\t\tthis.assertProjectTrustedForWrite();\n\t\t\t\t}\n\t\t\t\ttask();\n\t\t\t\tthis.clearModifiedScope(scope);\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.recordError(scope, error);\n\t\t\t});\n\t}\n\n\tprivate cloneModifiedNestedFields(source: Map<keyof Settings, Set<string>>): Map<keyof Settings, Set<string>> {\n\t\tconst snapshot = new Map<keyof Settings, Set<string>>();\n\t\tfor (const [key, value] of source.entries()) {\n\t\t\tsnapshot.set(key, new Set(value));\n\t\t}\n\t\treturn snapshot;\n\t}\n\n\tprivate persistScopedSettings(\n\t\tscope: SettingsScope,\n\t\tsnapshotSettings: Settings,\n\t\tmodifiedFields: Set<keyof Settings>,\n\t\tmodifiedNestedFields: Map<keyof Settings, Set<string>>,\n\t): void {\n\t\tthis.storage.withLock(scope, (current) => {\n\t\t\tconst currentFileSettings = current\n\t\t\t\t? SettingsManager.migrateSettings(JSON.parse(current) as Record<string, unknown>)\n\t\t\t\t: {};\n\t\t\tconst mergedSettings: Settings = { ...currentFileSettings };\n\t\t\tfor (const field of modifiedFields) {\n\t\t\t\tconst value = snapshotSettings[field];\n\t\t\t\tif (modifiedNestedFields.has(field) && typeof value === \"object\" && value !== null) {\n\t\t\t\t\tconst nestedModified = modifiedNestedFields.get(field)!;\n\t\t\t\t\tconst baseNested = (currentFileSettings[field] as Record<string, unknown>) ?? {};\n\t\t\t\t\tconst inMemoryNested = value as Record<string, unknown>;\n\t\t\t\t\tconst mergedNested = { ...baseNested };\n\t\t\t\t\tfor (const nestedKey of nestedModified) {\n\t\t\t\t\t\tmergedNested[nestedKey] = inMemoryNested[nestedKey];\n\t\t\t\t\t}\n\t\t\t\t\t(mergedSettings as Record<string, unknown>)[field] = mergedNested;\n\t\t\t\t} else {\n\t\t\t\t\t(mergedSettings as Record<string, unknown>)[field] = value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn JSON.stringify(mergedSettings, null, 2);\n\t\t});\n\t}\n\n\tprivate save(): void {\n\t\tthis.recomputeSettings();\n\n\t\tif (this.globalSettingsLoadError) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst snapshotGlobalSettings = structuredClone(this.globalSettings);\n\t\tconst modifiedFields = new Set(this.modifiedFields);\n\t\tconst modifiedNestedFields = this.cloneModifiedNestedFields(this.modifiedNestedFields);\n\n\t\tthis.enqueueWrite(\"global\", () => {\n\t\t\tthis.persistScopedSettings(\"global\", snapshotGlobalSettings, modifiedFields, modifiedNestedFields);\n\t\t});\n\t}\n\n\tprivate saveProjectSettings(settings: Settings): void {\n\t\tthis.assertProjectTrustedForWrite();\n\t\tthis.projectSettings = structuredClone(settings);\n\t\tthis.recomputeSettings();\n\n\t\tif (this.projectSettingsLoadError) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst snapshotProjectSettings = structuredClone(this.projectSettings);\n\t\tconst modifiedFields = new Set(this.modifiedProjectFields);\n\t\tconst modifiedNestedFields = this.cloneModifiedNestedFields(this.modifiedProjectNestedFields);\n\t\tthis.enqueueWrite(\"project\", () => {\n\t\t\tthis.persistScopedSettings(\"project\", snapshotProjectSettings, modifiedFields, modifiedNestedFields);\n\t\t});\n\t}\n\n\tprivate updateProjectSettings(field: keyof Settings, update: (settings: Settings) => void): void {\n\t\tthis.assertProjectTrustedForWrite();\n\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\tupdate(projectSettings);\n\t\tthis.markProjectModified(field);\n\t\tthis.saveProjectSettings(projectSettings);\n\t}\n\n\tasync flush(): Promise<void> {\n\t\tawait this.writeQueue;\n\t}\n\n\tdrainErrors(): SettingsError[] {\n\t\tconst drained = [...this.errors];\n\t\tthis.errors = [];\n\t\treturn drained;\n\t}\n\n\tgetLastChangelogVersion(): string | undefined {\n\t\treturn this.settings.lastChangelogVersion;\n\t}\n\n\tsetLastChangelogVersion(version: string): void {\n\t\tthis.globalSettings.lastChangelogVersion = version;\n\t\tthis.markModified(\"lastChangelogVersion\");\n\t\tthis.save();\n\t}\n\n\tgetSessionDir(): string | undefined {\n\t\tconst sessionDir = this.settings.sessionDir;\n\t\treturn sessionDir ? normalizePath(sessionDir) : sessionDir;\n\t}\n\n\tgetDefaultProvider(): string | undefined {\n\t\treturn this.settings.defaultProvider;\n\t}\n\n\tgetDefaultModel(): string | undefined {\n\t\treturn this.settings.defaultModel;\n\t}\n\n\tsetDefaultProvider(provider: string): void {\n\t\tthis.globalSettings.defaultProvider = provider;\n\t\tthis.markModified(\"defaultProvider\");\n\t\tthis.save();\n\t}\n\n\tsetDefaultModel(modelId: string): void {\n\t\tthis.globalSettings.defaultModel = modelId;\n\t\tthis.markModified(\"defaultModel\");\n\t\tthis.save();\n\t}\n\n\tsetDefaultModelAndProvider(provider: string, modelId: string): void {\n\t\tthis.globalSettings.defaultProvider = provider;\n\t\tthis.globalSettings.defaultModel = modelId;\n\t\tthis.markModified(\"defaultProvider\");\n\t\tthis.markModified(\"defaultModel\");\n\t\tthis.save();\n\t}\n\n\tgetSteeringMode(): \"all\" | \"one-at-a-time\" {\n\t\treturn this.settings.steeringMode || \"one-at-a-time\";\n\t}\n\n\tsetSteeringMode(mode: \"all\" | \"one-at-a-time\"): void {\n\t\tthis.globalSettings.steeringMode = mode;\n\t\tthis.markModified(\"steeringMode\");\n\t\tthis.save();\n\t}\n\n\tgetFollowUpMode(): \"all\" | \"one-at-a-time\" {\n\t\treturn this.settings.followUpMode || \"one-at-a-time\";\n\t}\n\n\tsetFollowUpMode(mode: \"all\" | \"one-at-a-time\"): void {\n\t\tthis.globalSettings.followUpMode = mode;\n\t\tthis.markModified(\"followUpMode\");\n\t\tthis.save();\n\t}\n\n\tgetTheme(): string | undefined {\n\t\treturn this.settings.theme;\n\t}\n\n\tsetTheme(theme: string): void {\n\t\tthis.globalSettings.theme = theme;\n\t\tthis.markModified(\"theme\");\n\t\tthis.save();\n\t}\n\n\t/** The configured resource catalog directory, if any (round resource management). */\n\tgetCatalogDir(): string | undefined {\n\t\treturn this.settings.catalogDir;\n\t}\n\n\tsetCatalogDir(dir: string | undefined): void {\n\t\tif (dir) {\n\t\t\tthis.globalSettings.catalogDir = dir;\n\t\t} else {\n\t\t\tdelete this.globalSettings.catalogDir;\n\t\t}\n\t\tthis.markModified(\"catalogDir\");\n\t\tthis.save();\n\t}\n\n\tgetDefaultThinkingLevel(): ThinkingLevel | undefined {\n\t\treturn this.settings.defaultThinkingLevel;\n\t}\n\n\tsetDefaultThinkingLevel(level: ThinkingLevel): void {\n\t\tthis.globalSettings.defaultThinkingLevel = level;\n\t\tthis.markModified(\"defaultThinkingLevel\");\n\t\tthis.save();\n\t}\n\n\tgetTransport(): TransportSetting {\n\t\treturn this.settings.transport ?? \"auto\";\n\t}\n\n\tsetTransport(transport: TransportSetting): void {\n\t\tthis.globalSettings.transport = transport;\n\t\tthis.markModified(\"transport\");\n\t\tthis.save();\n\t}\n\n\tgetCompactionEnabled(): boolean {\n\t\treturn this.settings.compaction?.enabled ?? true;\n\t}\n\n\tsetCompactionEnabled(enabled: boolean): void {\n\t\tif (!this.globalSettings.compaction) {\n\t\t\tthis.globalSettings.compaction = {};\n\t\t}\n\t\tthis.globalSettings.compaction.enabled = enabled;\n\t\tthis.markModified(\"compaction\", \"enabled\");\n\t\tthis.save();\n\t}\n\n\tgetCompactionReserveTokens(): number {\n\t\treturn this.settings.compaction?.reserveTokens ?? 16384;\n\t}\n\n\tgetCompactionKeepRecentTokens(): number {\n\t\treturn this.settings.compaction?.keepRecentTokens ?? 20000;\n\t}\n\n\tgetCompactionTriggerPercent(): number {\n\t\treturn this.settings.compaction?.triggerPercent ?? 0.7;\n\t}\n\n\t/**\n\t * Skill curator (#32). Auto-archive of stale reflection-promoted skills is ON by default (restorable,\n\t * announced, promoted-only). Set `autoArchive: false` to make it propose-only (`/curate`).\n\t */\n\tgetCuratorSettings(): { autoArchive: boolean; staleDays: number } {\n\t\treturn {\n\t\t\tautoArchive: this.settings.curator?.autoArchive ?? true,\n\t\t\tstaleDays: this.settings.curator?.staleDays ?? 30,\n\t\t};\n\t}\n\n\t/**\n\t * Proactive per-turn cost guard (#34). Default ON in WARN-only mode with a high anomaly-catching\n\t * projection threshold so an unusually expensive turn surfaces a visible footer notice without silently\n\t * changing behavior. Set `maxTurnUsd: 0` to disable, or `action: \"downgrade\"` to also auto-reduce\n\t * reasoning effort over the ceiling.\n\t */\n\tgetCostGuardSettings(): { maxTurnUsd: number; action: \"warn\" | \"downgrade\" } {\n\t\treturn {\n\t\t\tmaxTurnUsd: this.settings.costGuard?.maxTurnUsd ?? 2.5,\n\t\t\taction: this.settings.costGuard?.action ?? \"warn\",\n\t\t};\n\t}\n\n\tgetFailoverSettings(): Required<FailoverSettings> {\n\t\treturn { subscriptionHop: this.settings.failover?.subscriptionHop ?? true };\n\t}\n\n\tprivate getProfileModelRouterSettings(): ModelRouterSettings | undefined {\n\t\tconst activeProfileNames = this.getActiveResourceProfileNames();\n\t\tif (activeProfileNames.length === 0) return undefined;\n\t\tconst registry = this.getProfileRegistry();\n\t\tconst merged: ModelRouterSettings = {};\n\t\tfor (let index = activeProfileNames.length - 1; index >= 0; index--) {\n\t\t\tconst profile = this.resolveProfileFromRegistry(registry, activeProfileNames[index]);\n\t\t\tconst router = profile?.modelRouter;\n\t\t\tif (!router) continue;\n\t\t\tif (router.enabled !== undefined) merged.enabled = router.enabled;\n\t\t\tif (router.judgeEnabled !== undefined) merged.judgeEnabled = router.judgeEnabled;\n\t\t\tif (router.fitnessGate !== undefined) merged.fitnessGate = router.fitnessGate;\n\t\t\tif (router.cheapModel !== undefined) merged.cheapModel = router.cheapModel;\n\t\t\tif (router.mediumModel !== undefined) merged.mediumModel = router.mediumModel;\n\t\t\tif (router.expensiveModel !== undefined) merged.expensiveModel = router.expensiveModel;\n\t\t\tif (router.learningModel !== undefined) merged.learningModel = router.learningModel;\n\t\t\tif (router.judgeModel !== undefined) merged.judgeModel = router.judgeModel;\n\t\t\tif (router.executorModel !== undefined) merged.executorModel = router.executorModel;\n\t\t\tif (router.cheapThinking !== undefined) merged.cheapThinking = router.cheapThinking;\n\t\t\tif (router.mediumThinking !== undefined) merged.mediumThinking = router.mediumThinking;\n\t\t\tif (router.expensiveThinking !== undefined) merged.expensiveThinking = router.expensiveThinking;\n\t\t\tif (router.executorThinking !== undefined) merged.executorThinking = router.executorThinking;\n\t\t\tif (router.judgeThinking !== undefined) merged.judgeThinking = router.judgeThinking;\n\t\t}\n\t\treturn Object.keys(merged).length > 0 ? merged : undefined;\n\t}\n\n\tgetModelRouterSettings(): {\n\t\tenabled: boolean;\n\t\tcheapModel?: string;\n\t\tmediumModel?: string;\n\t\texpensiveModel?: string;\n\t\tlearningModel?: string;\n\t\tjudgeEnabled: boolean;\n\t\tjudgeModel?: string;\n\t\texecutorModel?: string;\n\t\tfitnessGate: boolean;\n\t\tcheapThinking?: ThinkingLevel;\n\t\tmediumThinking?: ThinkingLevel;\n\t\texpensiveThinking?: ThinkingLevel;\n\t\texecutorThinking?: ThinkingLevel;\n\t\tjudgeThinking?: ThinkingLevel;\n\t} {\n\t\tconst profileSettings = this.getProfileModelRouterSettings();\n\t\tconst settings = {\n\t\t\tenabled: this.settings.modelRouter?.enabled ?? false,\n\t\t\tcheapModel: this.settings.modelRouter?.cheapModel?.trim() || undefined,\n\t\t\tmediumModel: this.settings.modelRouter?.mediumModel?.trim() || undefined,\n\t\t\texpensiveModel: this.settings.modelRouter?.expensiveModel?.trim() || undefined,\n\t\t\tlearningModel: this.settings.modelRouter?.learningModel?.trim() || undefined,\n\t\t\tjudgeEnabled: this.settings.modelRouter?.judgeEnabled ?? true,\n\t\t\tfitnessGate: this.settings.modelRouter?.fitnessGate ?? false,\n\t\t\tjudgeModel: this.settings.modelRouter?.judgeModel?.trim() || undefined,\n\t\t\texecutorModel: this.settings.modelRouter?.executorModel?.trim() || undefined,\n\t\t\tcheapThinking: isThinkingLevel(this.settings.modelRouter?.cheapThinking)\n\t\t\t\t? this.settings.modelRouter?.cheapThinking\n\t\t\t\t: undefined,\n\t\t\tmediumThinking: isThinkingLevel(this.settings.modelRouter?.mediumThinking)\n\t\t\t\t? this.settings.modelRouter?.mediumThinking\n\t\t\t\t: undefined,\n\t\t\texpensiveThinking: isThinkingLevel(this.settings.modelRouter?.expensiveThinking)\n\t\t\t\t? this.settings.modelRouter?.expensiveThinking\n\t\t\t\t: undefined,\n\t\t\texecutorThinking: isThinkingLevel(this.settings.modelRouter?.executorThinking)\n\t\t\t\t? this.settings.modelRouter?.executorThinking\n\t\t\t\t: undefined,\n\t\t\tjudgeThinking: isThinkingLevel(this.settings.modelRouter?.judgeThinking)\n\t\t\t\t? this.settings.modelRouter?.judgeThinking\n\t\t\t\t: undefined,\n\t\t};\n\t\treturn {\n\t\t\tenabled: profileSettings?.enabled ?? settings.enabled,\n\t\t\tcheapModel: profileSettings?.cheapModel?.trim() || settings.cheapModel,\n\t\t\tmediumModel: profileSettings?.mediumModel?.trim() || settings.mediumModel,\n\t\t\texpensiveModel: profileSettings?.expensiveModel?.trim() || settings.expensiveModel,\n\t\t\tlearningModel: profileSettings?.learningModel?.trim() || settings.learningModel,\n\t\t\tjudgeEnabled: profileSettings?.judgeEnabled ?? settings.judgeEnabled,\n\t\t\tfitnessGate: profileSettings?.fitnessGate ?? settings.fitnessGate,\n\t\t\tjudgeModel: profileSettings?.judgeModel?.trim() || settings.judgeModel,\n\t\t\texecutorModel: profileSettings?.executorModel?.trim() || settings.executorModel,\n\t\t\tcheapThinking: profileSettings?.cheapThinking ?? settings.cheapThinking,\n\t\t\tmediumThinking: profileSettings?.mediumThinking ?? settings.mediumThinking,\n\t\t\texpensiveThinking: profileSettings?.expensiveThinking ?? settings.expensiveThinking,\n\t\t\texecutorThinking: profileSettings?.executorThinking ?? settings.executorThinking,\n\t\t\tjudgeThinking: profileSettings?.judgeThinking ?? settings.judgeThinking,\n\t\t};\n\t}\n\n\tsetModelRouterSettings(settings: ModelRouterSettings, scope: SettingsScope = \"global\"): void {\n\t\tconst normalized: ModelRouterSettings = {\n\t\t\tenabled: settings.enabled ?? false,\n\t\t\tcheapModel: settings.cheapModel?.trim() || undefined,\n\t\t\tmediumModel: settings.mediumModel?.trim() || undefined,\n\t\t\texpensiveModel: settings.expensiveModel?.trim() || undefined,\n\t\t\tlearningModel: settings.learningModel?.trim() || undefined,\n\t\t\tjudgeEnabled: settings.judgeEnabled ?? true,\n\t\t\tfitnessGate: settings.fitnessGate ?? false,\n\t\t\tjudgeModel: settings.judgeModel?.trim() || undefined,\n\t\t\texecutorModel: settings.executorModel?.trim() || undefined,\n\t\t\tcheapThinking: isThinkingLevel(settings.cheapThinking) ? settings.cheapThinking : undefined,\n\t\t\tmediumThinking: isThinkingLevel(settings.mediumThinking) ? settings.mediumThinking : undefined,\n\t\t\texpensiveThinking: isThinkingLevel(settings.expensiveThinking) ? settings.expensiveThinking : undefined,\n\t\t\texecutorThinking: isThinkingLevel(settings.executorThinking) ? settings.executorThinking : undefined,\n\t\t\tjudgeThinking: isThinkingLevel(settings.judgeThinking) ? settings.judgeThinking : undefined,\n\t\t};\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.modelRouter = normalized;\n\t\t\tthis.markProjectModified(\"modelRouter\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.modelRouter = normalized;\n\t\tthis.markModified(\"modelRouter\");\n\t\tthis.save();\n\t}\n\n\t/** Configured auxiliary summarizer model id, or \"auto\" (default) to pick the cheapest authed model. */\n\tgetCompactionModel(): string {\n\t\treturn this.settings.compaction?.model ?? \"auto\";\n\t}\n\n\tgetCompactionSettings(): {\n\t\tenabled: boolean;\n\t\treserveTokens: number;\n\t\tkeepRecentTokens: number;\n\t\ttriggerPercent: number;\n\t} {\n\t\treturn {\n\t\t\tenabled: this.getCompactionEnabled(),\n\t\t\treserveTokens: this.getCompactionReserveTokens(),\n\t\t\tkeepRecentTokens: this.getCompactionKeepRecentTokens(),\n\t\t\ttriggerPercent: this.getCompactionTriggerPercent(),\n\t\t};\n\t}\n\n\tgetScoutSettings(): { enabled: boolean; model: string } {\n\t\treturn {\n\t\t\tenabled: this.settings.scout?.enabled ?? false,\n\t\t\tmodel: this.settings.scout?.model ?? \"auto\",\n\t\t};\n\t}\n\n\tsetScoutSettings(settings: ScoutSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.scout = { ...settings };\n\t\t\tthis.markProjectModified(\"scout\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\t\tthis.globalSettings.scout = { ...settings };\n\t\tthis.markModified(\"scout\");\n\t\tthis.save();\n\t}\n\n\tgetContextGcSettings(): {\n\t\tenabled: boolean;\n\t\tpreserveRecentMessages: number;\n\t\tminToolResultChars: number;\n\t\ttools: string[];\n\t\tsemanticMemory: {\n\t\t\tenabled: boolean;\n\t\t\tpreserveRecentPages: number;\n\t\t\tminChars: number;\n\t\t\tmarkers: string[];\n\t\t};\n\t} {\n\t\t// Per-field fallback throughout (never a whole-object `??`) so an explicit partial override --\n\t\t// e.g. only `contextGc.minToolResultChars`, or only `semanticMemory.enabled` -- still gets the\n\t\t// canonical default for every field it didn't set. Every fallback DERIVES from context-gc.ts's\n\t\t// exported DEFAULT_CONTEXT_GC_SETTINGS (the same object applyContextGc's own normalizer falls\n\t\t// back to) instead of a hand-kept copy, so this method and context-gc.ts's defaults can never\n\t\t// drift again -- hand-copied fallbacks here previously (a) missed the \"<task_steps_context\"\n\t\t// marker context-gc.ts's own default carries, silently disabling GC packing\n\t\t// for that page under default settings, and (b) diverged on the `tools` list (missing\n\t\t// \"run_toolkit_script\", present only here) -- both classes of drift are now structurally\n\t\t// impossible since there is exactly one place these defaults are written down.\n\t\treturn {\n\t\t\tenabled: this.settings.contextGc?.enabled ?? DEFAULT_CONTEXT_GC_SETTINGS.enabled,\n\t\t\tpreserveRecentMessages:\n\t\t\t\tthis.settings.contextGc?.preserveRecentMessages ?? DEFAULT_CONTEXT_GC_SETTINGS.preserveRecentMessages,\n\t\t\tminToolResultChars:\n\t\t\t\tthis.settings.contextGc?.minToolResultChars ?? DEFAULT_CONTEXT_GC_SETTINGS.minToolResultChars,\n\t\t\ttools: this.settings.contextGc?.tools ?? DEFAULT_CONTEXT_GC_SETTINGS.tools,\n\t\t\tsemanticMemory: {\n\t\t\t\tenabled:\n\t\t\t\t\tthis.settings.contextGc?.semanticMemory?.enabled ?? DEFAULT_CONTEXT_GC_SETTINGS.semanticMemory.enabled,\n\t\t\t\tpreserveRecentPages:\n\t\t\t\t\tthis.settings.contextGc?.semanticMemory?.preserveRecentPages ??\n\t\t\t\t\tDEFAULT_CONTEXT_GC_SETTINGS.semanticMemory.preserveRecentPages,\n\t\t\t\tminChars:\n\t\t\t\t\tthis.settings.contextGc?.semanticMemory?.minChars ?? DEFAULT_CONTEXT_GC_SETTINGS.semanticMemory.minChars,\n\t\t\t\tmarkers:\n\t\t\t\t\tthis.settings.contextGc?.semanticMemory?.markers ?? DEFAULT_CONTEXT_GC_SETTINGS.semanticMemory.markers,\n\t\t\t},\n\t\t};\n\t}\n\n\tgetContextPromptEnforcementSettings(): { enabled: boolean; preserveRecentMessages: number; minChars: number } {\n\t\t// Enforcement's own default MIRRORS the live context-gc settings (not a second hardcoded\n\t\t// literal) so tuning contextGc.preserveRecentMessages/minToolResultChars moves this default\n\t\t// with it instead of silently drifting. An explicitly configured enforcement value always\n\t\t// wins over the mirror -- see the ContextPromptEnforcementSettings doc comment.\n\t\tconst gcSettings = this.getContextGcSettings();\n\t\treturn {\n\t\t\tenabled: this.settings.contextPolicy?.enforcement?.enabled ?? false,\n\t\t\tpreserveRecentMessages:\n\t\t\t\tthis.settings.contextPolicy?.enforcement?.preserveRecentMessages ?? gcSettings.preserveRecentMessages,\n\t\t\tminChars: this.settings.contextPolicy?.enforcement?.minChars ?? gcSettings.minToolResultChars,\n\t\t};\n\t}\n\n\tgetContextCurationSettings(): { enabled: boolean; model?: string; maxJobsPerTurn: number } {\n\t\treturn {\n\t\t\tenabled: this.settings.contextPolicy?.curation?.enabled ?? false,\n\t\t\tmodel: this.settings.contextPolicy?.curation?.model?.trim() || undefined,\n\t\t\tmaxJobsPerTurn: sanitizeIntegerSetting(this.settings.contextPolicy?.curation?.maxJobsPerTurn, 4, 1, 16),\n\t\t};\n\t}\n\n\tsetContextCurationSettings(settings: ContextCurationSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.contextPolicy = { ...projectSettings.contextPolicy, curation: { ...settings } };\n\t\t\tthis.markProjectModified(\"contextPolicy\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\t\tthis.globalSettings.contextPolicy = { ...this.globalSettings.contextPolicy, curation: { ...settings } };\n\t\tthis.markModified(\"contextPolicy\");\n\t\tthis.save();\n\t}\n\n\tsetContextPromptEnforcementSettings(\n\t\tsettings: ContextPromptEnforcementSettings,\n\t\tscope: SettingsScope = \"global\",\n\t): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.contextPolicy = { ...projectSettings.contextPolicy, enforcement: { ...settings } };\n\t\t\tthis.markProjectModified(\"contextPolicy\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.contextPolicy = { ...this.globalSettings.contextPolicy, enforcement: { ...settings } };\n\t\tthis.markModified(\"contextPolicy\");\n\t\tthis.save();\n\t}\n\n\tgetMemoryRetrievalSettings(): {\n\t\tenabled: boolean;\n\t\tmaxResults: number;\n\t\tincludeInPrompt: boolean;\n\t\tallowExternalEgress: boolean;\n\t} {\n\t\treturn {\n\t\t\tenabled: this.settings.contextPolicy?.memory?.enabled ?? true,\n\t\t\tmaxResults: clampMemoryRetrievalMaxResults(\n\t\t\t\tthis.settings.contextPolicy?.memory?.maxResults ?? MEMORY_RETRIEVAL_MAX_RESULTS_DEFAULT,\n\t\t\t),\n\t\t\tincludeInPrompt: this.settings.contextPolicy?.memory?.includeInPrompt ?? true,\n\t\t\tallowExternalEgress: this.settings.contextPolicy?.memory?.allowExternalEgress === true,\n\t\t};\n\t}\n\n\tsetMemoryRetrievalSettings(settings: MemoryRetrievalSettings, scope: SettingsScope = \"global\"): void {\n\t\tconst normalized: MemoryRetrievalSettings = {\n\t\t\tenabled: settings.enabled,\n\t\t\tmaxResults:\n\t\t\t\tsettings.maxResults === undefined ? undefined : clampMemoryRetrievalMaxResults(settings.maxResults),\n\t\t\tincludeInPrompt: settings.includeInPrompt,\n\t\t\tallowExternalEgress: settings.allowExternalEgress,\n\t\t};\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.contextPolicy = { ...projectSettings.contextPolicy, memory: normalized };\n\t\t\tthis.markProjectModified(\"contextPolicy\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.contextPolicy = { ...this.globalSettings.contextPolicy, memory: normalized };\n\t\tthis.markModified(\"contextPolicy\");\n\t\tthis.save();\n\t}\n\n\tgetBranchSummarySettings(): { reserveTokens: number; skipPrompt: boolean } {\n\t\treturn {\n\t\t\treserveTokens: this.settings.branchSummary?.reserveTokens ?? 16384,\n\t\t\tskipPrompt: this.settings.branchSummary?.skipPrompt ?? false,\n\t\t};\n\t}\n\n\tgetBranchSummarySkipPrompt(): boolean {\n\t\treturn this.settings.branchSummary?.skipPrompt ?? false;\n\t}\n\n\tgetRetryEnabled(): boolean {\n\t\treturn this.settings.retry?.enabled ?? true;\n\t}\n\n\tsetRetryEnabled(enabled: boolean): void {\n\t\tif (!this.globalSettings.retry) {\n\t\t\tthis.globalSettings.retry = {};\n\t\t}\n\t\tthis.globalSettings.retry.enabled = enabled;\n\t\tthis.markModified(\"retry\", \"enabled\");\n\t\tthis.save();\n\t}\n\n\tgetRetrySettings(): { enabled: boolean; maxRetries: number; baseDelayMs: number } {\n\t\treturn {\n\t\t\tenabled: this.getRetryEnabled(),\n\t\t\tmaxRetries: this.settings.retry?.maxRetries ?? 3,\n\t\t\tbaseDelayMs: this.settings.retry?.baseDelayMs ?? 2000,\n\t\t};\n\t}\n\n\t/**\n\t * Stream-stall watchdog bounds (pi-agent-core reliability/watchdogs.ts). Returns only the\n\t * fields the user set, validated; unset fields fall back to DEFAULT_STREAM_IDLE at the\n\t * wiring site (agent-session constructor). Resolved per request, so edits apply live.\n\t */\n\tgetStreamStallSettings(): { connectMs?: number; activeIdleMs?: number; quietIdleMs?: number } {\n\t\tconst stall = this.settings.retry?.stall;\n\t\treturn {\n\t\t\tconnectMs: parseStallBoundMs(stall?.connectMs, \"retry.stall.connectMs\"),\n\t\t\tactiveIdleMs: parseStallBoundMs(stall?.activeIdleMs, \"retry.stall.activeIdleMs\"),\n\t\t\tquietIdleMs: parseStallBoundMs(stall?.quietIdleMs, \"retry.stall.quietIdleMs\"),\n\t\t};\n\t}\n\n\tgetHttpIdleTimeoutMs(): number {\n\t\treturn parseTimeoutSetting(this.settings.httpIdleTimeoutMs, \"httpIdleTimeoutMs\") ?? DEFAULT_HTTP_IDLE_TIMEOUT_MS;\n\t}\n\n\tsetHttpIdleTimeoutMs(timeoutMs: number): void {\n\t\tif (!Number.isFinite(timeoutMs) || timeoutMs < 0) {\n\t\t\tthrow new Error(`Invalid httpIdleTimeoutMs setting: ${String(timeoutMs)}`);\n\t\t}\n\t\tthis.globalSettings.httpIdleTimeoutMs = Math.floor(timeoutMs);\n\t\tthis.markModified(\"httpIdleTimeoutMs\");\n\t\tthis.save();\n\t}\n\n\tgetProviderRetrySettings(): { timeoutMs?: number; maxRetries?: number; maxRetryDelayMs: number } {\n\t\treturn {\n\t\t\ttimeoutMs: this.settings.retry?.provider?.timeoutMs,\n\t\t\tmaxRetries: this.settings.retry?.provider?.maxRetries,\n\t\t\tmaxRetryDelayMs: this.settings.retry?.provider?.maxRetryDelayMs ?? 60000,\n\t\t};\n\t}\n\n\tgetWebSocketConnectTimeoutMs(): number | undefined {\n\t\treturn parseTimeoutSetting(this.settings.websocketConnectTimeoutMs, \"websocketConnectTimeoutMs\");\n\t}\n\n\tgetHideThinkingBlock(): boolean {\n\t\treturn this.settings.hideThinkingBlock ?? false;\n\t}\n\n\tsetHideThinkingBlock(hide: boolean): void {\n\t\tthis.globalSettings.hideThinkingBlock = hide;\n\t\tthis.markModified(\"hideThinkingBlock\");\n\t\tthis.save();\n\t}\n\n\tgetShellPath(): string | undefined {\n\t\treturn this.settings.shellPath;\n\t}\n\n\tsetShellPath(path: string | undefined): void {\n\t\tthis.globalSettings.shellPath = path;\n\t\tthis.markModified(\"shellPath\");\n\t\tthis.save();\n\t}\n\n\tgetQuietStartup(): boolean {\n\t\treturn this.settings.quietStartup ?? false;\n\t}\n\n\tsetQuietStartup(quiet: boolean): void {\n\t\tthis.globalSettings.quietStartup = quiet;\n\t\tthis.markModified(\"quietStartup\");\n\t\tthis.save();\n\t}\n\n\tgetShellCommandPrefix(): string | undefined {\n\t\treturn this.settings.shellCommandPrefix;\n\t}\n\n\tsetShellCommandPrefix(prefix: string | undefined): void {\n\t\tthis.globalSettings.shellCommandPrefix = prefix;\n\t\tthis.markModified(\"shellCommandPrefix\");\n\t\tthis.save();\n\t}\n\n\tgetNpmCommand(): string[] | undefined {\n\t\treturn this.settings.npmCommand ? [...this.settings.npmCommand] : undefined;\n\t}\n\n\tsetNpmCommand(command: string[] | undefined): void {\n\t\tthis.globalSettings.npmCommand = command ? [...command] : undefined;\n\t\tthis.markModified(\"npmCommand\");\n\t\tthis.save();\n\t}\n\n\tgetCollapseChangelog(): boolean {\n\t\treturn this.settings.collapseChangelog ?? false;\n\t}\n\n\tsetCollapseChangelog(collapse: boolean): void {\n\t\tthis.globalSettings.collapseChangelog = collapse;\n\t\tthis.markModified(\"collapseChangelog\");\n\t\tthis.save();\n\t}\n\n\tgetEnableInstallTelemetry(): boolean {\n\t\treturn this.settings.enableInstallTelemetry ?? true;\n\t}\n\n\tsetEnableInstallTelemetry(enabled: boolean): void {\n\t\tthis.globalSettings.enableInstallTelemetry = enabled;\n\t\tthis.markModified(\"enableInstallTelemetry\");\n\t\tthis.save();\n\t}\n\n\tgetPackages(): PackageSource[] {\n\t\treturn [...(this.settings.packages ?? [])];\n\t}\n\n\tsetPackages(packages: PackageSource[]): void {\n\t\tthis.globalSettings.packages = packages;\n\t\tthis.markModified(\"packages\");\n\t\tthis.save();\n\t}\n\n\tsetProjectPackages(packages: PackageSource[]): void {\n\t\tthis.updateProjectSettings(\"packages\", (settings) => {\n\t\t\tsettings.packages = packages;\n\t\t});\n\t}\n\n\tgetExtensionPaths(): string[] {\n\t\treturn [...(this.settings.extensions ?? [])];\n\t}\n\n\tsetExtensionPaths(paths: string[]): void {\n\t\tthis.globalSettings.extensions = paths;\n\t\tthis.markModified(\"extensions\");\n\t\tthis.save();\n\t}\n\n\tsetProjectExtensionPaths(paths: string[]): void {\n\t\tthis.updateProjectSettings(\"extensions\", (settings) => {\n\t\t\tsettings.extensions = paths;\n\t\t});\n\t}\n\n\tgetSkillPaths(): string[] {\n\t\treturn [...(this.settings.skills ?? [])];\n\t}\n\n\tsetSkillPaths(paths: string[]): void {\n\t\tthis.globalSettings.skills = paths;\n\t\tthis.markModified(\"skills\");\n\t\tthis.save();\n\t}\n\n\tsetProjectSkillPaths(paths: string[]): void {\n\t\tthis.updateProjectSettings(\"skills\", (settings) => {\n\t\t\tsettings.skills = paths;\n\t\t});\n\t}\n\n\tgetPromptTemplatePaths(): string[] {\n\t\treturn [...(this.settings.prompts ?? [])];\n\t}\n\n\tsetPromptTemplatePaths(paths: string[]): void {\n\t\tthis.globalSettings.prompts = paths;\n\t\tthis.markModified(\"prompts\");\n\t\tthis.save();\n\t}\n\n\tsetProjectPromptTemplatePaths(paths: string[]): void {\n\t\tthis.updateProjectSettings(\"prompts\", (settings) => {\n\t\t\tsettings.prompts = paths;\n\t\t});\n\t}\n\n\tgetThemePaths(): string[] {\n\t\treturn [...(this.settings.themes ?? [])];\n\t}\n\n\tsetThemePaths(paths: string[]): void {\n\t\tthis.globalSettings.themes = paths;\n\t\tthis.markModified(\"themes\");\n\t\tthis.save();\n\t}\n\n\tsetProjectThemePaths(paths: string[]): void {\n\t\tthis.updateProjectSettings(\"themes\", (settings) => {\n\t\t\tsettings.themes = paths;\n\t\t});\n\t}\n\n\tgetEnableSkillCommands(): boolean {\n\t\treturn this.settings.enableSkillCommands ?? true;\n\t}\n\n\tsetEnableSkillCommands(enabled: boolean): void {\n\t\tthis.globalSettings.enableSkillCommands = enabled;\n\t\tthis.markModified(\"enableSkillCommands\");\n\t\tthis.save();\n\t}\n\n\tgetThinkingBudgets(): ThinkingBudgetsSettings | undefined {\n\t\treturn this.settings.thinkingBudgets;\n\t}\n\n\tgetShowImages(): boolean {\n\t\treturn this.settings.terminal?.showImages ?? true;\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tif (!this.globalSettings.terminal) {\n\t\t\tthis.globalSettings.terminal = {};\n\t\t}\n\t\tthis.globalSettings.terminal.showImages = show;\n\t\tthis.markModified(\"terminal\", \"showImages\");\n\t\tthis.save();\n\t}\n\n\tgetImageWidthCells(): number {\n\t\tconst width = this.settings.terminal?.imageWidthCells;\n\t\tif (typeof width !== \"number\" || !Number.isFinite(width)) {\n\t\t\treturn 60;\n\t\t}\n\t\treturn Math.max(1, Math.floor(width));\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tif (!this.globalSettings.terminal) {\n\t\t\tthis.globalSettings.terminal = {};\n\t\t}\n\t\tthis.globalSettings.terminal.imageWidthCells = Math.max(1, Math.floor(width));\n\t\tthis.markModified(\"terminal\", \"imageWidthCells\");\n\t\tthis.save();\n\t}\n\n\tgetClearOnShrink(): boolean {\n\t\t// Settings takes precedence, then env var, then default false\n\t\tif (this.settings.terminal?.clearOnShrink !== undefined) {\n\t\t\treturn this.settings.terminal.clearOnShrink;\n\t\t}\n\t\treturn process.env.PI_CLEAR_ON_SHRINK === \"1\";\n\t}\n\n\tsetClearOnShrink(enabled: boolean): void {\n\t\tif (!this.globalSettings.terminal) {\n\t\t\tthis.globalSettings.terminal = {};\n\t\t}\n\t\tthis.globalSettings.terminal.clearOnShrink = enabled;\n\t\tthis.markModified(\"terminal\", \"clearOnShrink\");\n\t\tthis.save();\n\t}\n\n\tgetShowTerminalProgress(): boolean {\n\t\treturn this.settings.terminal?.showTerminalProgress ?? false;\n\t}\n\n\tsetShowTerminalProgress(enabled: boolean): void {\n\t\tif (!this.globalSettings.terminal) {\n\t\t\tthis.globalSettings.terminal = {};\n\t\t}\n\t\tthis.globalSettings.terminal.showTerminalProgress = enabled;\n\t\tthis.markModified(\"terminal\", \"showTerminalProgress\");\n\t\tthis.save();\n\t}\n\n\tgetImageAutoResize(): boolean {\n\t\treturn this.settings.images?.autoResize ?? true;\n\t}\n\n\tsetImageAutoResize(enabled: boolean): void {\n\t\tif (!this.globalSettings.images) {\n\t\t\tthis.globalSettings.images = {};\n\t\t}\n\t\tthis.globalSettings.images.autoResize = enabled;\n\t\tthis.markModified(\"images\", \"autoResize\");\n\t\tthis.save();\n\t}\n\n\tgetBlockImages(): boolean {\n\t\treturn this.settings.images?.blockImages ?? false;\n\t}\n\n\tsetBlockImages(blocked: boolean): void {\n\t\tif (!this.globalSettings.images) {\n\t\t\tthis.globalSettings.images = {};\n\t\t}\n\t\tthis.globalSettings.images.blockImages = blocked;\n\t\tthis.markModified(\"images\", \"blockImages\");\n\t\tthis.save();\n\t}\n\n\tgetEnabledModels(): string[] | undefined {\n\t\treturn this.settings.enabledModels;\n\t}\n\n\tsetEnabledModels(patterns: string[] | undefined): void {\n\t\tthis.globalSettings.enabledModels = patterns;\n\t\tthis.markModified(\"enabledModels\");\n\t\tthis.save();\n\t}\n\n\tgetDoubleEscapeAction(): \"fork\" | \"tree\" | \"none\" {\n\t\treturn this.settings.doubleEscapeAction ?? \"tree\";\n\t}\n\n\tsetDoubleEscapeAction(action: \"fork\" | \"tree\" | \"none\"): void {\n\t\tthis.globalSettings.doubleEscapeAction = action;\n\t\tthis.markModified(\"doubleEscapeAction\");\n\t\tthis.save();\n\t}\n\n\tgetTreeFilterMode(): \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\" {\n\t\tconst mode = this.settings.treeFilterMode;\n\t\tconst valid = [\"default\", \"no-tools\", \"user-only\", \"labeled-only\", \"all\"];\n\t\treturn mode && valid.includes(mode) ? mode : \"default\";\n\t}\n\n\tsetTreeFilterMode(mode: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\"): void {\n\t\tthis.globalSettings.treeFilterMode = mode;\n\t\tthis.markModified(\"treeFilterMode\");\n\t\tthis.save();\n\t}\n\n\tgetShowHardwareCursor(): boolean {\n\t\treturn this.settings.showHardwareCursor ?? process.env.PI_HARDWARE_CURSOR === \"1\";\n\t}\n\n\tsetShowHardwareCursor(enabled: boolean): void {\n\t\tthis.globalSettings.showHardwareCursor = enabled;\n\t\tthis.markModified(\"showHardwareCursor\");\n\t\tthis.save();\n\t}\n\n\tgetEditorPaddingX(): number {\n\t\treturn this.settings.editorPaddingX ?? 0;\n\t}\n\n\tsetEditorPaddingX(padding: number): void {\n\t\tthis.globalSettings.editorPaddingX = Math.max(0, Math.min(3, Math.floor(padding)));\n\t\tthis.markModified(\"editorPaddingX\");\n\t\tthis.save();\n\t}\n\n\tgetAutocompleteMaxVisible(): number {\n\t\treturn this.settings.autocompleteMaxVisible ?? 5;\n\t}\n\n\tsetAutocompleteMaxVisible(maxVisible: number): void {\n\t\tthis.globalSettings.autocompleteMaxVisible = Math.max(3, Math.min(20, Math.floor(maxVisible)));\n\t\tthis.markModified(\"autocompleteMaxVisible\");\n\t\tthis.save();\n\t}\n\n\tgetCodeBlockIndent(): string {\n\t\treturn this.settings.markdown?.codeBlockIndent ?? \" \";\n\t}\n\n\tgetWarnings(): WarningSettings {\n\t\treturn { ...(this.settings.warnings ?? {}) };\n\t}\n\n\tsetWarnings(warnings: WarningSettings): void {\n\t\tthis.globalSettings.warnings = { ...warnings };\n\t\tthis.markModified(\"warnings\");\n\t\tthis.save();\n\t}\n\n\tgetSelfModificationSettings(): { enabled: boolean; sourcePath?: string; sourcePaths?: string[] } {\n\t\treturn {\n\t\t\tenabled: this.settings.selfModification?.enabled ?? false,\n\t\t\tsourcePath: this.settings.selfModification?.sourcePath,\n\t\t\tsourcePaths: this.settings.selfModification?.sourcePaths,\n\t\t};\n\t}\n\n\tsetSelfModificationSettings(settings: SelfModificationSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tconst existing = projectSettings.selfModification;\n\t\t\tprojectSettings.selfModification = {\n\t\t\t\t...existing,\n\t\t\t\t...settings,\n\t\t\t\tsourcePaths: settings.sourcePaths ?? existing?.sourcePaths,\n\t\t\t};\n\t\t\tthis.markProjectModified(\"selfModification\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tconst existing = this.globalSettings.selfModification;\n\t\tthis.globalSettings.selfModification = {\n\t\t\t...existing,\n\t\t\t...settings,\n\t\t\tsourcePaths: settings.sourcePaths ?? existing?.sourcePaths,\n\t\t};\n\t\tthis.markModified(\"selfModification\");\n\t\tthis.save();\n\t}\n\n\tgetAutonomySettings(): Required<AutonomySettings> {\n\t\tconst mode = this.settings.autonomy?.mode;\n\t\tconst configuredMaxStallTurns = this.settings.autonomy?.maxStallTurns;\n\t\tconst configuredGoalContinueTurns = this.settings.autonomy?.goalContinueTurns;\n\t\tconst configuredGoalContinueMaxWallClockMinutes = this.settings.autonomy?.goalContinueMaxWallClockMinutes;\n\t\tconst configuredGoalAutoContinue = this.settings.autonomy?.goalAutoContinue;\n\t\tconst configuredGoalAutoContinueDelayMs = this.settings.autonomy?.goalAutoContinueDelayMs;\n\n\t\tconst maxStallTurns = sanitizeIntegerSetting(\n\t\t\tconfiguredMaxStallTurns,\n\t\t\tDEFAULT_AUTONOMY_MAX_STALL_TURNS,\n\t\t\t0,\n\t\t\tMAX_GOAL_CONTINUE_MAX_STALL_TURNS,\n\t\t);\n\t\tconst goalContinueTurns = sanitizeIntegerSetting(\n\t\t\tconfiguredGoalContinueTurns,\n\t\t\tDEFAULT_AUTONOMY_GOAL_CONTINUE_TURNS,\n\t\t\t1,\n\t\t\tMAX_GOAL_CONTINUE_MAX_TURNS,\n\t\t);\n\t\tconst goalContinueMaxWallClockMinutes = sanitizeIntegerSetting(\n\t\t\tconfiguredGoalContinueMaxWallClockMinutes,\n\t\t\tDEFAULT_AUTONOMY_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES,\n\t\t\t0,\n\t\t\tMAX_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES,\n\t\t);\n\t\tconst goalAutoContinueDelayMs = sanitizeIntegerSetting(\n\t\t\tconfiguredGoalAutoContinueDelayMs,\n\t\t\tDEFAULT_AUTONOMY_GOAL_AUTO_CONTINUE_DELAY_MS,\n\t\t\t0,\n\t\t\tMAX_GOAL_AUTO_CONTINUE_DELAY_MS,\n\t\t);\n\n\t\treturn {\n\t\t\tmode: mode === \"safe\" || mode === \"balanced\" || mode === \"full\" ? mode : \"off\",\n\t\t\tmaxStallTurns,\n\t\t\tgoalContinueTurns,\n\t\t\tgoalContinueMaxWallClockMinutes,\n\t\t\tgoalAutoContinue:\n\t\t\t\ttypeof configuredGoalAutoContinue === \"boolean\"\n\t\t\t\t\t? configuredGoalAutoContinue\n\t\t\t\t\t: DEFAULT_AUTONOMY_GOAL_AUTO_CONTINUE,\n\t\t\tgoalAutoContinueDelayMs,\n\t\t};\n\t}\n\n\tsetAutonomySettings(settings: AutonomySettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.autonomy = { ...settings };\n\t\t\tthis.markProjectModified(\"autonomy\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.autonomy = { ...settings };\n\t\tthis.markModified(\"autonomy\");\n\t\tthis.save();\n\t}\n\n\tgetResearchLaneSettings(): ResolvedResearchLaneSettings {\n\t\tconst configured = this.settings.researchLane ?? {};\n\n\t\tconst resolved: ResolvedResearchLaneSettings = {\n\t\t\tenabled: typeof configured.enabled === \"boolean\" ? configured.enabled : DEFAULT_RESEARCH_LANE_ENABLED,\n\t\t\tmaxUsd: sanitizeNumberSetting(configured.maxUsd, DEFAULT_RESEARCH_LANE_MAX_USD, 0, MAX_RESEARCH_LANE_MAX_USD),\n\t\t\tmaxSources: sanitizeIntegerSetting(\n\t\t\t\tconfigured.maxSources,\n\t\t\t\tDEFAULT_RESEARCH_LANE_MAX_SOURCES,\n\t\t\t\t1,\n\t\t\t\tMAX_RESEARCH_LANE_MAX_SOURCES,\n\t\t\t),\n\t\t\tmaxFindings: sanitizeIntegerSetting(\n\t\t\t\tconfigured.maxFindings,\n\t\t\t\tDEFAULT_RESEARCH_LANE_MAX_FINDINGS,\n\t\t\t\t1,\n\t\t\t\tMAX_RESEARCH_LANE_MAX_FINDINGS,\n\t\t\t),\n\t\t\tmaxWallClockMs: sanitizeIntegerSetting(\n\t\t\t\tconfigured.maxWallClockMs,\n\t\t\t\tDEFAULT_RESEARCH_LANE_MAX_WALL_CLOCK_MS,\n\t\t\t\t0,\n\t\t\t\tMAX_RESEARCH_LANE_MAX_WALL_CLOCK_MS,\n\t\t\t),\n\t\t\tidleDelayMs: sanitizeIntegerSetting(\n\t\t\t\tconfigured.idleDelayMs,\n\t\t\t\tDEFAULT_RESEARCH_LANE_IDLE_DELAY_MS,\n\t\t\t\t0,\n\t\t\t\tMAX_RESEARCH_LANE_IDLE_DELAY_MS,\n\t\t\t),\n\t\t\tmaxRunsPerSession: sanitizeIntegerSetting(\n\t\t\t\tconfigured.maxRunsPerSession,\n\t\t\t\tDEFAULT_RESEARCH_LANE_MAX_RUNS_PER_SESSION,\n\t\t\t\t0,\n\t\t\t\tMAX_RESEARCH_LANE_MAX_RUNS_PER_SESSION,\n\t\t\t),\n\t\t};\n\t\tif (typeof configured.model === \"string\" && configured.model.trim().length > 0) {\n\t\t\tresolved.model = configured.model;\n\t\t}\n\t\tif (typeof configured.profile === \"string\" && configured.profile.trim().length > 0) {\n\t\t\tresolved.profile = configured.profile;\n\t\t}\n\t\tif (typeof configured.systemPrompt === \"string\" && configured.systemPrompt.trim().length > 0) {\n\t\t\tresolved.systemPrompt = configured.systemPrompt;\n\t\t}\n\t\treturn resolved;\n\t}\n\n\tsetResearchLaneSettings(settings: ResearchLaneSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.researchLane = { ...settings };\n\t\t\tthis.markProjectModified(\"researchLane\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.researchLane = { ...settings };\n\t\tthis.markModified(\"researchLane\");\n\t\tthis.save();\n\t}\n\n\tgetWorktreeSyncSettings(): ResolvedWorktreeSyncSettings {\n\t\tconst configured = this.settings.worktreeSync ?? {};\n\t\tconst resolved: ResolvedWorktreeSyncSettings = {\n\t\t\tenabled: configured.enabled !== false,\n\t\t\tsyncPolicy:\n\t\t\t\tconfigured.syncPolicy === \"overlap_mandatory\" || configured.syncPolicy === \"land_time_only\"\n\t\t\t\t\t? configured.syncPolicy\n\t\t\t\t\t: DEFAULT_WORKTREE_SYNC_POLICY,\n\t\t\tgate: configured.gate === \"off\" ? \"off\" : \"on\",\n\t\t\tgateTimeoutMs: sanitizeIntegerSetting(\n\t\t\t\tconfigured.gateTimeoutMs,\n\t\t\t\tDEFAULT_WORKTREE_SYNC_GATE_TIMEOUT_MS,\n\t\t\t\t1000,\n\t\t\t\t3_600_000,\n\t\t\t),\n\t\t\tmaxLanes: sanitizeIntegerSetting(configured.maxLanes, DEFAULT_WORKTREE_SYNC_MAX_LANES, 1, 32),\n\t\t\tworkerLand: configured.workerLand === \"allow\" ? \"allow\" : \"deny\",\n\t\t};\n\t\tif (typeof configured.mainBranch === \"string\" && configured.mainBranch.trim().length > 0) {\n\t\t\tresolved.mainBranch = configured.mainBranch.trim();\n\t\t}\n\t\tif (typeof configured.gateCommand === \"string\" && configured.gateCommand.trim().length > 0) {\n\t\t\tresolved.gateCommand = configured.gateCommand.trim();\n\t\t}\n\t\tif (typeof configured.worktreesRoot === \"string\" && configured.worktreesRoot.trim().length > 0) {\n\t\t\tresolved.worktreesRoot = configured.worktreesRoot.trim();\n\t\t}\n\t\treturn resolved;\n\t}\n\n\tgetProcessMatrixSettings(): ResolvedProcessMatrixSettings {\n\t\tconst configured = this.settings.processMatrix ?? {};\n\t\treturn {\n\t\t\tenabled: configured.enabled !== false,\n\t\t\theartbeatMs: sanitizeIntegerSetting(\n\t\t\t\tconfigured.heartbeatMs,\n\t\t\t\tDEFAULT_PROCESS_MATRIX_HEARTBEAT_MS,\n\t\t\t\t1000,\n\t\t\t\t600_000,\n\t\t\t),\n\t\t\tadoptionGraceMs: sanitizeIntegerSetting(\n\t\t\t\tconfigured.adoptionGraceMs,\n\t\t\t\tDEFAULT_PROCESS_MATRIX_ADOPTION_GRACE_MS,\n\t\t\t\t5000,\n\t\t\t\t3_600_000,\n\t\t\t),\n\t\t\twatcherPollMs: sanitizeIntegerSetting(\n\t\t\t\tconfigured.watcherPollMs,\n\t\t\t\tDEFAULT_PROCESS_MATRIX_WATCHER_POLL_MS,\n\t\t\t\t1000,\n\t\t\t\t600_000,\n\t\t\t),\n\t\t};\n\t}\n\n\tgetWindowsShellSettings(): ResolvedWindowsShellSettings {\n\t\tconst configured = this.settings.windowsShell ?? {};\n\t\treturn {\n\t\t\tpythonEngine: configured.pythonEngine !== false,\n\t\t};\n\t}\n\n\tgetWorkerDelegationSettings(): ResolvedWorkerDelegationSettings {\n\t\tconst configured = this.settings.workerDelegation ?? {};\n\n\t\tconst resolved: ResolvedWorkerDelegationSettings = {\n\t\t\tenabled: typeof configured.enabled === \"boolean\" ? configured.enabled : DEFAULT_WORKER_DELEGATION_ENABLED,\n\t\t\tmaxUsd: sanitizeNumberSetting(\n\t\t\t\tconfigured.maxUsd,\n\t\t\t\tDEFAULT_WORKER_DELEGATION_MAX_USD,\n\t\t\t\t0,\n\t\t\t\tMAX_WORKER_DELEGATION_MAX_USD,\n\t\t\t),\n\t\t\tmaxWallClockMs: sanitizeIntegerSetting(\n\t\t\t\tconfigured.maxWallClockMs,\n\t\t\t\tDEFAULT_WORKER_DELEGATION_MAX_WALL_CLOCK_MS,\n\t\t\t\t0,\n\t\t\t\tMAX_WORKER_DELEGATION_MAX_WALL_CLOCK_MS,\n\t\t\t),\n\t\t\twriteEnabled: configured.writeEnabled === true,\n\t\t\twritePaths: Array.isArray(configured.writePaths)\n\t\t\t\t? configured.writePaths.filter((entry): entry is string => typeof entry === \"string\" && entry.length > 0)\n\t\t\t\t: [],\n\t\t\tmaxConcurrent: sanitizeIntegerSetting(configured.maxConcurrent, 1, 1, 3),\n\t\t};\n\t\tif (typeof configured.model === \"string\" && configured.model.trim().length > 0) {\n\t\t\tresolved.model = configured.model;\n\t\t}\n\t\tif (typeof configured.profile === \"string\" && configured.profile.trim().length > 0) {\n\t\t\tresolved.profile = configured.profile;\n\t\t}\n\t\tif (typeof configured.systemPrompt === \"string\" && configured.systemPrompt.trim().length > 0) {\n\t\t\tresolved.systemPrompt = configured.systemPrompt;\n\t\t}\n\t\treturn resolved;\n\t}\n\n\tsetWorkerDelegationSettings(settings: WorkerDelegationSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.workerDelegation = { ...settings };\n\t\t\tthis.markProjectModified(\"workerDelegation\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.workerDelegation = { ...settings };\n\t\tthis.markModified(\"workerDelegation\");\n\t\tthis.save();\n\t}\n\n\tgetLearningPolicySettings(): ResolvedLearningPolicySettings {\n\t\tconst configured = this.settings.learningPolicy ?? {};\n\n\t\tconst allowedLayers = Array.isArray(configured.allowedAutoApplyLayers)\n\t\t\t? configured.allowedAutoApplyLayers.filter(\n\t\t\t\t\t(layer): layer is LearningPolicyLayer =>\n\t\t\t\t\t\ttypeof layer === \"string\" &&\n\t\t\t\t\t\t[\"memory\", \"skill\", \"prompt\", \"extension\", \"tool\", \"script\", \"settings\", \"source\"].includes(layer),\n\t\t\t\t)\n\t\t\t: [...DEFAULT_LEARNING_POLICY_ALLOWED_AUTO_APPLY_LAYERS];\n\n\t\treturn {\n\t\t\tenabled: typeof configured.enabled === \"boolean\" ? configured.enabled : DEFAULT_LEARNING_POLICY_ENABLED,\n\t\t\tautoApplyEnabled:\n\t\t\t\ttypeof configured.autoApplyEnabled === \"boolean\"\n\t\t\t\t\t? configured.autoApplyEnabled\n\t\t\t\t\t: DEFAULT_LEARNING_POLICY_AUTO_APPLY_ENABLED,\n\t\t\tconfidenceThreshold: sanitizeIntegerSetting(\n\t\t\t\tconfigured.confidenceThreshold,\n\t\t\t\tDEFAULT_LEARNING_POLICY_CONFIDENCE_THRESHOLD,\n\t\t\t\t0,\n\t\t\t\t100,\n\t\t\t),\n\t\t\tminObservations: sanitizeIntegerSetting(\n\t\t\t\tconfigured.minObservations,\n\t\t\t\tDEFAULT_LEARNING_POLICY_MIN_OBSERVATIONS,\n\t\t\t\t0,\n\t\t\t\t100,\n\t\t\t),\n\t\t\tallowedAutoApplyLayers: allowedLayers,\n\t\t\trequireRollbackPlan:\n\t\t\t\ttypeof configured.requireRollbackPlan === \"boolean\" ? configured.requireRollbackPlan : true,\n\t\t\treflectionSourceConfidence: sanitizeIntegerSetting(\n\t\t\t\tconfigured.reflectionSourceConfidence,\n\t\t\t\tDEFAULT_LEARNING_POLICY_REFLECTION_SOURCE_CONFIDENCE,\n\t\t\t\t0,\n\t\t\t\t100,\n\t\t\t),\n\t\t\tautoApplySupersessions:\n\t\t\t\ttypeof configured.autoApplySupersessions === \"boolean\"\n\t\t\t\t\t? configured.autoApplySupersessions\n\t\t\t\t\t: DEFAULT_LEARNING_POLICY_AUTO_APPLY_SUPERSESSIONS,\n\t\t};\n\t}\n\n\tgetToolkitScripts(): ToolkitScript[] {\n\t\tconst configured = this.settings.toolkit?.scripts;\n\t\tif (!Array.isArray(configured)) return [];\n\t\treturn configured.filter(\n\t\t\t(script): script is ToolkitScript =>\n\t\t\t\tBoolean(script) &&\n\t\t\t\ttypeof script.name === \"string\" &&\n\t\t\t\tscript.name.length > 0 &&\n\t\t\t\ttypeof script.description === \"string\" &&\n\t\t\t\ttypeof script.path === \"string\" &&\n\t\t\t\t(script.runner === \"uv\" || script.runner === \"powershell\" || script.runner === \"bash\"),\n\t\t);\n\t}\n\n\tsetToolkitSettings(settings: ToolkitSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.toolkit = { ...settings };\n\t\t\tthis.markProjectModified(\"toolkit\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.toolkit = { ...settings };\n\t\tthis.markModified(\"toolkit\");\n\t\tthis.save();\n\t}\n\n\tgetModelCapabilitySettings(): Required<ModelCapabilitySettings> {\n\t\tconst configured = this.settings.modelCapability?.mode;\n\t\tconst mode: ModelCapabilityMode =\n\t\t\tconfigured === \"auto\" ||\n\t\t\tconfigured === \"off\" ||\n\t\t\tconfigured === \"full\" ||\n\t\t\tconfigured === \"lean\" ||\n\t\t\tconfigured === \"minimal\" ||\n\t\t\tconfigured === \"chat\"\n\t\t\t\t? configured\n\t\t\t\t: DEFAULT_MODEL_CAPABILITY_MODE;\n\t\treturn { mode };\n\t}\n\n\tsetModelCapabilitySettings(settings: ModelCapabilitySettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.modelCapability = { ...settings };\n\t\t\tthis.markProjectModified(\"modelCapability\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.modelCapability = { ...settings };\n\t\tthis.markModified(\"modelCapability\");\n\t\tthis.save();\n\t}\n\n\tsetLearningPolicySettings(settings: LearningPolicySettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.learningPolicy = { ...settings };\n\t\t\tthis.markProjectModified(\"learningPolicy\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.learningPolicy = { ...settings };\n\t\tthis.markModified(\"learningPolicy\");\n\t\tthis.save();\n\t}\n\n\tgetAutoLearnSettings(): AutoLearnSettings {\n\t\tconst settings = this.settings.autoLearn ?? {};\n\t\treturn {\n\t\t\t...settings,\n\t\t\tmodel: settings.model ?? this.getModelRouterSettings().learningModel,\n\t\t\tthinkingLevel: settings.thinkingLevel ?? \"low\",\n\t\t\tcomplexTaskToolCalls: settings.complexTaskToolCalls ?? 12,\n\t\t};\n\t}\n\n\tsetAutoLearnSettings(settings: AutoLearnSettings, scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.autoLearn = { ...settings };\n\t\t\tthis.markProjectModified(\"autoLearn\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.autoLearn = { ...settings };\n\t\tthis.markModified(\"autoLearn\");\n\t\tthis.save();\n\t}\n\n\tgetExternalResourceRoots(): string[] {\n\t\treturn this.settings.externalResourceRoots ?? [];\n\t}\n\n\tsetExternalResourceRoots(roots: string[], scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.externalResourceRoots = [...roots];\n\t\t\tthis.markProjectModified(\"externalResourceRoots\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.externalResourceRoots = [...roots];\n\t\tthis.markModified(\"externalResourceRoots\");\n\t\tthis.save();\n\t}\n\n\tgetTrustedResourceRoots(): string[] {\n\t\treturn this.settings.trustedResourceRoots ?? [];\n\t}\n\n\tsetTrustedResourceRoots(roots: string[], scope: SettingsScope = \"global\"): void {\n\t\tif (scope === \"project\") {\n\t\t\tconst projectSettings = structuredClone(this.projectSettings);\n\t\t\tprojectSettings.trustedResourceRoots = [...roots];\n\t\t\tthis.markProjectModified(\"trustedResourceRoots\");\n\t\t\tthis.saveProjectSettings(projectSettings);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.globalSettings.trustedResourceRoots = [...roots];\n\t\tthis.markModified(\"trustedResourceRoots\");\n\t\tthis.save();\n\t}\n\n\taddTrustedResourceRoot(path: string, scope: SettingsScope = \"global\"): void {\n\t\tconst canonicalPath = this.canonicalizePath(path);\n\t\tif (!canonicalPath) return;\n\n\t\tconst current = this.getTrustedResourceRoots();\n\t\tif (!current.includes(canonicalPath)) {\n\t\t\tthis.setTrustedResourceRoots([...current, canonicalPath], scope);\n\t\t}\n\t}\n\n\tcanonicalizePath(p: string): string | null {\n\t\ttry {\n\t\t\tconst resolved = resolve(p.replace(/^~/, homedir()));\n\t\t\tif (existsSync(resolved)) {\n\t\t\t\treturn realpathSync(resolved);\n\t\t\t}\n\t\t\treturn resolved;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tgetEffectiveExternalResourceRoots(): string[] {\n\t\tconst roots = this.getExternalResourceRoots();\n\t\tconst trusted = this.getTrustedResourceRoots();\n\n\t\tconst canonicalTrusted = new Set(\n\t\t\ttrusted.map((t) => this.canonicalizePath(t)).filter((t): t is string => t !== null),\n\t\t);\n\n\t\tconst effective: string[] = [];\n\t\tfor (const r of roots) {\n\t\t\tconst canonicalR = this.canonicalizePath(r);\n\t\t\tif (canonicalR && canonicalR.trim() !== \"\" && canonicalTrusted.has(canonicalR) && existsSync(canonicalR)) {\n\t\t\t\teffective.push(canonicalR);\n\t\t\t}\n\t\t}\n\t\treturn effective;\n\t}\n}\n"]}
|