@oh-my-pi/pi-coding-agent 17.0.8 → 17.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -1
- package/README.md +1 -1
- package/dist/cli.js +5495 -5021
- package/dist/types/async/job-manager.d.ts +37 -1
- package/dist/types/cli/args.d.ts +2 -0
- package/dist/types/cli/bench-cli.d.ts +41 -0
- package/dist/types/commands/bench.d.ts +15 -3
- package/dist/types/commands/launch.d.ts +4 -0
- package/dist/types/config/__tests__/model-registry.test.d.ts +1 -0
- package/dist/types/config/model-registry.d.ts +30 -1
- package/dist/types/config/models-config-schema.d.ts +18 -6
- package/dist/types/config/models-config.d.ts +14 -5
- package/dist/types/config/provider-globals.d.ts +2 -2
- package/dist/types/config/service-tier.d.ts +5 -1
- package/dist/types/config/settings-schema.d.ts +350 -50
- package/dist/types/config/settings.d.ts +7 -0
- package/dist/types/dap/client.d.ts +20 -0
- package/dist/types/exec/bash-executor.d.ts +38 -0
- package/dist/types/exec/direnv.d.ts +33 -0
- package/dist/types/export/html/args.d.ts +15 -0
- package/dist/types/export/html/index.d.ts +11 -26
- package/dist/types/export/html/web-palette.d.ts +55 -116
- package/dist/types/extensibility/extensions/loader.d.ts +3 -0
- package/dist/types/extensibility/extensions/types.d.ts +17 -2
- package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +1 -0
- package/dist/types/extensibility/legacy-pi-tui-shim.d.ts +10 -0
- package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +14 -1
- package/dist/types/internal-urls/registry-helpers.d.ts +11 -0
- package/dist/types/live/controller.d.ts +40 -0
- package/dist/types/live/protocol.d.ts +85 -0
- package/dist/types/live/protocol.test.d.ts +1 -0
- package/dist/types/live/transport.d.ts +48 -0
- package/dist/types/live/visualizer.d.ts +33 -0
- package/dist/types/lsp/client.d.ts +18 -1
- package/dist/types/mcp/config-writer.test.d.ts +1 -0
- package/dist/types/mcp/manager.d.ts +6 -2
- package/dist/types/mcp/oauth-discovery.d.ts +2 -0
- package/dist/types/mcp/render.d.ts +2 -2
- package/dist/types/mcp/smithery-auth.d.ts +1 -1
- package/dist/types/mcp/smithery-auth.test.d.ts +1 -0
- package/dist/types/mcp/tool-bridge.d.ts +7 -3
- package/dist/types/mcp/types.d.ts +6 -0
- package/dist/types/memory-backend/tool-names.d.ts +2 -0
- package/dist/types/modes/components/login-dialog.d.ts +2 -2
- package/dist/types/modes/components/oauth-selector.d.ts +8 -0
- package/dist/types/modes/components/plan-review-overlay.d.ts +26 -0
- package/dist/types/modes/components/settings-defs.d.ts +8 -1
- package/dist/types/modes/components/status-line/component.jj-cache.test.d.ts +1 -0
- package/dist/types/modes/components/tool-execution.d.ts +9 -1
- package/dist/types/modes/controllers/command-controller.d.ts +1 -1
- package/dist/types/modes/controllers/event-controller.d.ts +6 -1
- package/dist/types/modes/controllers/live-command-controller.d.ts +14 -0
- package/dist/types/modes/controllers/mcp-command-controller.d.ts +3 -0
- package/dist/types/modes/interactive-mode.d.ts +5 -0
- package/dist/types/modes/rpc/rpc-client.d.ts +10 -1
- package/dist/types/modes/rpc/rpc-frame.d.ts +16 -0
- package/dist/types/modes/rpc/rpc-messages.d.ts +26 -0
- package/dist/types/modes/rpc/rpc-types.d.ts +40 -0
- package/dist/types/modes/setup-wizard/scenes/sign-in.d.ts +1 -1
- package/dist/types/modes/setup-wizard/scenes/types.d.ts +9 -1
- package/dist/types/modes/setup-wizard/scenes/web-search.d.ts +1 -1
- package/dist/types/modes/theme/theme.d.ts +1 -1
- package/dist/types/modes/types.d.ts +3 -1
- package/dist/types/modes/utils/context-usage.d.ts +12 -2
- package/dist/types/plan-mode/plan-files.d.ts +10 -0
- package/dist/types/registry/agent-lifecycle.d.ts +21 -9
- package/dist/types/registry/agent-registry.d.ts +11 -4
- package/dist/types/sdk.d.ts +15 -1
- package/dist/types/secrets/index.d.ts +15 -2
- package/dist/types/secrets/obfuscator.d.ts +113 -15
- package/dist/types/session/acp-permission-gate.d.ts +19 -0
- package/dist/types/session/agent-session-events.d.ts +84 -0
- package/dist/types/session/agent-session-types.d.ts +314 -0
- package/dist/types/session/agent-session.d.ts +120 -750
- package/dist/types/session/async-job-delivery.d.ts +28 -0
- package/dist/types/session/bash-runner.d.ts +75 -0
- package/dist/types/session/blob-store.d.ts +11 -1
- package/dist/types/session/blob-store.test.d.ts +1 -0
- package/dist/types/session/checkpoint-entries.d.ts +28 -0
- package/dist/types/session/eval-runner.d.ts +49 -0
- package/dist/types/session/irc-bridge.d.ts +46 -0
- package/dist/types/session/messages.d.ts +22 -0
- package/dist/types/session/model-controls.d.ts +180 -0
- package/dist/types/session/prewalk.d.ts +46 -0
- package/dist/types/session/queued-messages.d.ts +22 -0
- package/dist/types/session/redis-session-storage.d.ts +1 -0
- package/dist/types/session/retry-fallback-chains.d.ts +74 -0
- package/dist/types/session/role-models.d.ts +15 -0
- package/dist/types/session/session-advisors.d.ts +228 -0
- package/dist/types/session/session-entries.d.ts +8 -0
- package/dist/types/session/session-handoff.d.ts +70 -0
- package/dist/types/session/session-history-format.d.ts +6 -1
- package/dist/types/session/session-loader.d.ts +6 -4
- package/dist/types/session/session-maintenance.d.ts +246 -0
- package/dist/types/session/session-manager.d.ts +41 -0
- package/dist/types/session/session-memory.d.ts +56 -0
- package/dist/types/session/session-provider-boundary.d.ts +62 -0
- package/dist/types/session/session-stats.d.ts +48 -0
- package/dist/types/session/session-tools.d.ts +143 -0
- package/dist/types/session/session-workspace.d.ts +32 -0
- package/dist/types/session/stream-guards.d.ts +44 -0
- package/dist/types/session/todo-tracker.d.ts +56 -0
- package/dist/types/session/ttsr-coordinator.d.ts +51 -0
- package/dist/types/session/turn-recovery.d.ts +225 -0
- package/dist/types/system-prompt.d.ts +2 -0
- package/dist/types/task/executor.d.ts +4 -1
- package/dist/types/task/output-manager.d.ts +3 -1
- package/dist/types/task/types.d.ts +14 -0
- package/dist/types/tools/approval.d.ts +1 -0
- package/dist/types/tools/browser/launch.d.ts +5 -0
- package/dist/types/tools/hub/jobs.d.ts +1 -1
- package/dist/types/tools/image-gen.d.ts +4 -4
- package/dist/types/tools/image-providers.d.ts +38 -0
- package/dist/types/tools/index.d.ts +8 -0
- package/dist/types/tools/path-utils.d.ts +8 -0
- package/dist/types/tools/report-tool-issue.d.ts +24 -9
- package/dist/types/tools/todo.d.ts +10 -4
- package/dist/types/tools/xdev.d.ts +5 -1
- package/dist/types/tts/streaming-player.d.ts +14 -0
- package/dist/types/tts/vocalizer.d.ts +5 -0
- package/dist/types/utils/jj.d.ts +29 -0
- package/dist/types/utils/lang-from-path.d.ts +1 -0
- package/dist/types/utils/title-generator.d.ts +30 -0
- package/dist/types/vibe/runtime.d.ts +36 -8
- package/dist/types/web/search/index.d.ts +1 -1
- package/dist/types/web/search/provider.d.ts +15 -5
- package/dist/types/web/search/providers/firecrawl.d.ts +9 -0
- package/dist/types/web/search/types.d.ts +95 -1
- package/package.json +13 -12
- package/scripts/generate-share-viewer.ts +4 -6
- package/scripts/legacy-pi-virtual-module.ts +1 -1
- package/src/advisor/__tests__/advisor.test.ts +643 -0
- package/src/advisor/runtime.ts +144 -43
- package/src/async/job-manager.ts +90 -2
- package/src/cli/args.ts +2 -0
- package/src/cli/auth-gateway-cli.ts +18 -3
- package/src/cli/bench-cli.ts +395 -29
- package/src/cli/flag-tables.ts +3 -0
- package/src/cli/gc-cli.ts +2 -2
- package/src/cli/grievances-cli.ts +2 -2
- package/src/cli/usage-cli.ts +11 -2
- package/src/collab/host.ts +3 -2
- package/src/commands/bench.ts +18 -4
- package/src/commands/launch.ts +4 -0
- package/src/config/__tests__/model-registry.test.ts +147 -0
- package/src/config/model-registry.ts +50 -2
- package/src/config/model-resolver.ts +0 -1
- package/src/config/models-config-schema.ts +15 -4
- package/src/config/provider-globals.ts +9 -9
- package/src/config/service-tier.ts +26 -1
- package/src/config/settings-schema.ts +250 -54
- package/src/config/settings.ts +81 -2
- package/src/dap/client.ts +37 -4
- package/src/edit/index.ts +49 -12
- package/src/eval/py/executor.ts +103 -33
- package/src/exec/bash-executor.ts +89 -6
- package/src/exec/direnv.ts +145 -0
- package/src/export/html/args.ts +20 -0
- package/src/export/html/index.ts +45 -47
- package/src/export/html/template.css +19 -1
- package/src/export/html/template.html +6 -0
- package/src/export/html/template.js +21 -0
- package/src/export/html/tool-views.generated.js +31 -31
- package/src/export/html/web-palette.ts +116 -132
- package/src/export/share.ts +249 -49
- package/src/extensibility/extensions/loader.ts +29 -1
- package/src/extensibility/extensions/runner.ts +6 -0
- package/src/extensibility/extensions/types.ts +33 -2
- package/src/extensibility/legacy-pi-coding-agent-shim.ts +1 -0
- package/src/extensibility/legacy-pi-tui-shim.ts +10 -0
- package/src/extensibility/plugins/legacy-pi-compat.ts +870 -311
- package/src/hindsight/state.ts +64 -6
- package/src/internal-urls/local-protocol.ts +2 -1
- package/src/internal-urls/memory-protocol.ts +2 -2
- package/src/internal-urls/registry-helpers.ts +40 -0
- package/src/internal-urls/skill-protocol.ts +2 -2
- package/src/internal-urls/ssh-protocol.ts +2 -1
- package/src/internal-urls/vault-protocol.ts +2 -1
- package/src/live/audio-worklet.txt +59 -0
- package/src/live/browser-runtime.txt +221 -0
- package/src/live/controller.ts +464 -0
- package/src/live/prompts/agent-final-message.md +3 -0
- package/src/live/prompts/live-instructions.md +23 -0
- package/src/live/protocol.test.ts +140 -0
- package/src/live/protocol.ts +233 -0
- package/src/live/transport.ts +490 -0
- package/src/live/visualizer.ts +234 -0
- package/src/lsp/client.ts +52 -9
- package/src/lsp/clients/biome-client.ts +3 -4
- package/src/lsp/index.ts +44 -11
- package/src/main.ts +9 -1
- package/src/mcp/config-writer.test.ts +43 -0
- package/src/mcp/config-writer.ts +109 -82
- package/src/mcp/manager.ts +39 -8
- package/src/mcp/oauth-discovery.ts +10 -2
- package/src/mcp/render.ts +94 -35
- package/src/mcp/smithery-auth.test.ts +29 -0
- package/src/mcp/smithery-auth.ts +3 -2
- package/src/mcp/tool-bridge.ts +107 -11
- package/src/mcp/types.ts +7 -0
- package/src/memories/index.ts +40 -20
- package/src/memory-backend/tool-names.ts +2 -0
- package/src/mnemopi/backend.ts +24 -7
- package/src/modes/acp/acp-agent.ts +56 -10
- package/src/modes/acp/acp-event-mapper.ts +8 -1
- package/src/modes/components/agent-hub.ts +27 -10
- package/src/modes/components/login-dialog.ts +14 -4
- package/src/modes/components/oauth-selector.ts +24 -7
- package/src/modes/components/plan-review-overlay.ts +350 -35
- package/src/modes/components/settings-defs.ts +28 -3
- package/src/modes/components/settings-selector.ts +178 -6
- package/src/modes/components/status-line/component.jj-cache.test.ts +229 -0
- package/src/modes/components/status-line/component.ts +123 -2
- package/src/modes/components/tool-execution.test.ts +63 -2
- package/src/modes/components/tool-execution.ts +11 -2
- package/src/modes/controllers/command-controller.ts +70 -22
- package/src/modes/controllers/event-controller.ts +111 -16
- package/src/modes/controllers/extension-ui-controller.test.ts +1 -0
- package/src/modes/controllers/extension-ui-controller.ts +20 -4
- package/src/modes/controllers/live-command-controller.ts +178 -0
- package/src/modes/controllers/mcp-command-controller.ts +80 -41
- package/src/modes/controllers/omfg-controller.ts +44 -40
- package/src/modes/controllers/selector-controller.ts +18 -10
- package/src/modes/controllers/session-focus-controller.ts +6 -1
- package/src/modes/interactive-mode.ts +160 -38
- package/src/modes/rpc/rpc-client.ts +94 -3
- package/src/modes/rpc/rpc-frame.ts +164 -4
- package/src/modes/rpc/rpc-messages.ts +127 -0
- package/src/modes/rpc/rpc-mode.ts +79 -7
- package/src/modes/rpc/rpc-types.ts +34 -2
- package/src/modes/runtime-init.ts +2 -0
- package/src/modes/setup-wizard/scenes/model.ts +5 -7
- package/src/modes/setup-wizard/scenes/providers.ts +3 -2
- package/src/modes/setup-wizard/scenes/sign-in.ts +8 -2
- package/src/modes/setup-wizard/scenes/theme.ts +13 -3
- package/src/modes/setup-wizard/scenes/types.ts +9 -1
- package/src/modes/setup-wizard/scenes/web-search.ts +23 -10
- package/src/modes/setup-wizard/wizard-overlay.ts +1 -1
- package/src/modes/theme/theme.ts +1 -1
- package/src/modes/types.ts +3 -1
- package/src/modes/utils/context-usage.ts +23 -7
- package/src/modes/utils/ui-helpers.ts +10 -5
- package/src/plan-mode/plan-files.ts +40 -0
- package/src/prompts/bench/cache-prefix-chunk.md +1 -0
- package/src/prompts/bench/cache-prefix.md +3 -0
- package/src/prompts/bench/cache-suffix.md +1 -0
- package/src/prompts/goals/guided-goal-system.md +24 -3
- package/src/prompts/system/custom-system-prompt.md +1 -1
- package/src/prompts/system/project-prompt.md +8 -1
- package/src/prompts/system/subagent-async-pending.md +6 -0
- package/src/prompts/system/system-prompt.md +1 -1
- package/src/prompts/system/workflow-notice.md +48 -40
- package/src/prompts/system/xdev-mount-notice.md +4 -0
- package/src/prompts/tools/task.md +12 -2
- package/src/prompts/tools/todo.md +3 -1
- package/src/registry/agent-lifecycle.ts +116 -46
- package/src/registry/agent-registry.ts +35 -8
- package/src/registry/persisted-agents.ts +26 -2
- package/src/sdk.ts +255 -139
- package/src/secrets/index.ts +127 -4
- package/src/secrets/obfuscator.ts +2328 -105
- package/src/session/acp-permission-gate.ts +165 -0
- package/src/session/agent-session-error-log.test.ts +1 -1
- package/src/session/agent-session-events.ts +66 -0
- package/src/session/agent-session-types.ts +334 -0
- package/src/session/agent-session.ts +1910 -12213
- package/src/session/artifacts.ts +6 -5
- package/src/session/async-job-delivery.ts +74 -0
- package/src/session/bash-runner.ts +326 -0
- package/src/session/blob-store.test.ts +56 -0
- package/src/session/blob-store.ts +18 -2
- package/src/session/checkpoint-entries.ts +81 -0
- package/src/session/eval-runner.ts +212 -0
- package/src/session/indexed-session-storage.ts +9 -2
- package/src/session/irc-bridge.ts +203 -0
- package/src/session/messages.ts +263 -1
- package/src/session/model-controls.ts +714 -0
- package/src/session/prewalk.ts +252 -0
- package/src/session/queued-messages.ts +93 -0
- package/src/session/redis-session-storage.ts +51 -11
- package/src/session/retry-fallback-chains.ts +455 -0
- package/src/session/role-models.ts +85 -0
- package/src/session/session-advisors.ts +1679 -0
- package/src/session/session-context.test.ts +224 -1
- package/src/session/session-context.ts +47 -5
- package/src/session/session-entries.ts +8 -0
- package/src/session/session-handoff.ts +308 -0
- package/src/session/session-history-format.ts +20 -9
- package/src/session/session-loader.ts +10 -51
- package/src/session/session-maintenance.ts +2983 -0
- package/src/session/session-manager.ts +390 -30
- package/src/session/session-memory.ts +222 -0
- package/src/session/session-provider-boundary.ts +307 -0
- package/src/session/session-stats.ts +293 -0
- package/src/session/session-tools.ts +943 -0
- package/src/session/session-workspace.ts +53 -0
- package/src/session/stream-guards.ts +417 -0
- package/src/session/todo-tracker.ts +380 -0
- package/src/session/ttsr-coordinator.ts +496 -0
- package/src/session/turn-recovery.ts +1629 -0
- package/src/slash-commands/builtin-registry.ts +92 -11
- package/src/slash-commands/helpers/usage-report.ts +25 -4
- package/src/system-prompt.ts +41 -17
- package/src/task/executor.ts +288 -70
- package/src/task/index.ts +148 -111
- package/src/task/output-manager.ts +25 -3
- package/src/task/persisted-revive.ts +4 -3
- package/src/task/structured-subagent.ts +4 -1
- package/src/task/types.ts +16 -0
- package/src/tools/approval.ts +55 -10
- package/src/tools/bash-interactive.ts +26 -0
- package/src/tools/bash-skill-urls.ts +28 -2
- package/src/tools/bash.ts +339 -123
- package/src/tools/browser/launch.ts +9 -1
- package/src/tools/browser/tab-supervisor.ts +8 -5
- package/src/tools/browser.ts +94 -47
- package/src/tools/hub/index.ts +1 -1
- package/src/tools/hub/jobs.ts +67 -8
- package/src/tools/image-gen.ts +20 -28
- package/src/tools/image-providers.ts +50 -0
- package/src/tools/index.ts +12 -0
- package/src/tools/path-utils.ts +49 -2
- package/src/tools/read.ts +156 -88
- package/src/tools/renderers.ts +7 -1
- package/src/tools/report-tool-issue.ts +79 -28
- package/src/tools/todo.ts +101 -11
- package/src/tools/vibe.ts +1 -2
- package/src/tools/write.ts +51 -1
- package/src/tools/xdev.ts +67 -3
- package/src/tts/streaming-player.ts +62 -4
- package/src/tts/vocalizer.ts +18 -1
- package/src/utils/jj.ts +125 -4
- package/src/utils/lang-from-path.ts +7 -0
- package/src/utils/title-generator.ts +137 -1
- package/src/vibe/runtime.ts +852 -72
- package/src/web/search/index.ts +3 -6
- package/src/web/search/provider.ts +31 -16
- package/src/web/search/providers/firecrawl.ts +46 -13
- package/src/web/search/providers/xai.ts +7 -1
- package/src/web/search/types.ts +8 -1
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
TINY_TITLE_MODEL_OPTIONS,
|
|
27
27
|
TINY_TITLE_MODEL_VALUES,
|
|
28
28
|
} from "../tiny/models";
|
|
29
|
+
import { IMAGE_PROVIDER_CHOICES, type ImageProvider } from "../tools/image-providers";
|
|
29
30
|
import {
|
|
30
31
|
DEFAULT_TTS_LOCAL_MODEL_KEY,
|
|
31
32
|
DEFAULT_TTS_VOICE,
|
|
@@ -35,7 +36,7 @@ import {
|
|
|
35
36
|
TTS_LOCAL_VOICE_VALUES,
|
|
36
37
|
} from "../tts/models";
|
|
37
38
|
import { EDIT_MODES } from "../utils/edit-mode";
|
|
38
|
-
import {
|
|
39
|
+
import { SEARCH_PROVIDER_CHOICES, type SearchProviderId } from "../web/search/types";
|
|
39
40
|
import {
|
|
40
41
|
SERVICE_TIER_ANTHROPIC_OPTIONS,
|
|
41
42
|
SERVICE_TIER_ANTHROPIC_VALUES,
|
|
@@ -207,6 +208,8 @@ interface UiNumber extends UiBase {
|
|
|
207
208
|
}
|
|
208
209
|
|
|
209
210
|
interface UiString extends UiBase {
|
|
211
|
+
/** Mask the value in both the settings row and text editor. */
|
|
212
|
+
secret?: boolean;
|
|
210
213
|
/**
|
|
211
214
|
* Submenu options.
|
|
212
215
|
* - Array → submenu with these choices.
|
|
@@ -216,9 +219,18 @@ interface UiString extends UiBase {
|
|
|
216
219
|
options?: ReadonlyArray<SubmenuOption> | "runtime";
|
|
217
220
|
}
|
|
218
221
|
|
|
222
|
+
interface UiArray extends UiBase {
|
|
223
|
+
/** Membership choices. Without options, an array setting has no UI representation (config-file only). */
|
|
224
|
+
options?: ReadonlyArray<SubmenuOption>;
|
|
225
|
+
/** Selection order is meaningful; the editor renders positions and supports reordering. */
|
|
226
|
+
ordered?: boolean;
|
|
227
|
+
}
|
|
228
|
+
|
|
219
229
|
/** Wide ui shape exposed to consumers that walk the schema generically. */
|
|
220
230
|
export type AnyUiMetadata = UiBase & {
|
|
221
231
|
options?: ReadonlyArray<SubmenuOption> | "runtime";
|
|
232
|
+
secret?: boolean;
|
|
233
|
+
ordered?: boolean;
|
|
222
234
|
};
|
|
223
235
|
|
|
224
236
|
interface BooleanDef {
|
|
@@ -249,7 +261,7 @@ interface EnumDef<T extends readonly string[]> {
|
|
|
249
261
|
interface ArrayDef<T> {
|
|
250
262
|
type: "array";
|
|
251
263
|
default: T[];
|
|
252
|
-
ui?:
|
|
264
|
+
ui?: UiArray;
|
|
253
265
|
}
|
|
254
266
|
|
|
255
267
|
interface RecordDef<T> {
|
|
@@ -901,6 +913,18 @@ export const SETTINGS_SCHEMA = {
|
|
|
901
913
|
},
|
|
902
914
|
},
|
|
903
915
|
|
|
916
|
+
"tui.titleState": {
|
|
917
|
+
type: "boolean",
|
|
918
|
+
default: true,
|
|
919
|
+
ui: {
|
|
920
|
+
tab: "appearance",
|
|
921
|
+
group: "Display",
|
|
922
|
+
label: "Terminal Title Run State",
|
|
923
|
+
description:
|
|
924
|
+
"Show the agent run state in the terminal title's separator — an animated spinner while working, '>' when it's your turn, '!' when the agent is waiting on you",
|
|
925
|
+
},
|
|
926
|
+
},
|
|
927
|
+
|
|
904
928
|
"tui.hyperlinks": {
|
|
905
929
|
type: "enum",
|
|
906
930
|
values: ["off", "auto", "always"] as const,
|
|
@@ -1185,6 +1209,18 @@ export const SETTINGS_SCHEMA = {
|
|
|
1185
1209
|
},
|
|
1186
1210
|
},
|
|
1187
1211
|
|
|
1212
|
+
"workspace.additionalDirectories": {
|
|
1213
|
+
type: "array",
|
|
1214
|
+
default: [] as string[],
|
|
1215
|
+
ui: {
|
|
1216
|
+
tab: "context",
|
|
1217
|
+
group: "General",
|
|
1218
|
+
label: "Additional Workspace Dirs",
|
|
1219
|
+
description:
|
|
1220
|
+
"Extra workspace directories added to every session as additional roots (multi-root workspace). Managed live via /add-dir and /remove-dir. Paths resolve relative to cwd; absolute paths recommended. The agent is told these roots exist and can read/grep/glob them.",
|
|
1221
|
+
},
|
|
1222
|
+
},
|
|
1223
|
+
|
|
1188
1224
|
personality: {
|
|
1189
1225
|
type: "enum",
|
|
1190
1226
|
values: ["default", "friendly", "pragmatic", "none"] as const,
|
|
@@ -1457,6 +1493,65 @@ export const SETTINGS_SCHEMA = {
|
|
|
1457
1493
|
description: "Allow retry recovery to switch to configured fallback models",
|
|
1458
1494
|
},
|
|
1459
1495
|
},
|
|
1496
|
+
"retry.usageAwareFallback": {
|
|
1497
|
+
type: "boolean",
|
|
1498
|
+
default: false,
|
|
1499
|
+
ui: {
|
|
1500
|
+
tab: "model",
|
|
1501
|
+
group: "Retry & Fallback",
|
|
1502
|
+
label: "Usage-Aware Fallback",
|
|
1503
|
+
description:
|
|
1504
|
+
"Use reliable coding-plan quota reports to prefer same-provider accounts, then configured fallback models, before a hard usage limit. Ordinary configured API keys are excluded.",
|
|
1505
|
+
},
|
|
1506
|
+
},
|
|
1507
|
+
"retry.usageReservePct": {
|
|
1508
|
+
type: "number",
|
|
1509
|
+
default: 10,
|
|
1510
|
+
ui: {
|
|
1511
|
+
tab: "model",
|
|
1512
|
+
group: "Retry & Fallback",
|
|
1513
|
+
label: "Reserve Margin",
|
|
1514
|
+
description:
|
|
1515
|
+
"Treat a coding-plan model as near its limit below this remaining percentage. Unknown or unmapped usage keeps the primary model.",
|
|
1516
|
+
condition: "usageAwareFallbackEnabled",
|
|
1517
|
+
options: [
|
|
1518
|
+
{ value: "5", label: "5%", description: "Act only when nearly exhausted" },
|
|
1519
|
+
{ value: "10", label: "10%", description: "Balanced safety margin" },
|
|
1520
|
+
{ value: "15", label: "15%", description: "Conservative" },
|
|
1521
|
+
{ value: "20", label: "20%", description: "Early protection" },
|
|
1522
|
+
{ value: "25", label: "25%", description: "Very conservative" },
|
|
1523
|
+
],
|
|
1524
|
+
},
|
|
1525
|
+
},
|
|
1526
|
+
"retry.usageReservePolicy": {
|
|
1527
|
+
type: "enum",
|
|
1528
|
+
values: ["confirm", "auto", "fail-closed"] as const,
|
|
1529
|
+
default: "confirm",
|
|
1530
|
+
ui: {
|
|
1531
|
+
tab: "model",
|
|
1532
|
+
group: "Retry & Fallback",
|
|
1533
|
+
label: "Reserve Policy",
|
|
1534
|
+
description: "What to do when every same-provider coding-plan account is inside the reserve margin.",
|
|
1535
|
+
condition: "usageAwareFallbackEnabled",
|
|
1536
|
+
options: [
|
|
1537
|
+
{
|
|
1538
|
+
value: "confirm",
|
|
1539
|
+
label: "Confirm interactively",
|
|
1540
|
+
description: "Keep interactive sessions on the primary until confirmed; background agents auto-fallback",
|
|
1541
|
+
},
|
|
1542
|
+
{
|
|
1543
|
+
value: "auto",
|
|
1544
|
+
label: "Auto-fallback",
|
|
1545
|
+
description: "Always select the next eligible configured fallback",
|
|
1546
|
+
},
|
|
1547
|
+
{
|
|
1548
|
+
value: "fail-closed",
|
|
1549
|
+
label: "Fail closed",
|
|
1550
|
+
description: "Do not spend reserve quota or select a fallback",
|
|
1551
|
+
},
|
|
1552
|
+
],
|
|
1553
|
+
},
|
|
1554
|
+
},
|
|
1460
1555
|
"retry.fallbackChains": {
|
|
1461
1556
|
type: "record",
|
|
1462
1557
|
default: {} as Record<string, string[]>,
|
|
@@ -1770,6 +1865,18 @@ export const SETTINGS_SCHEMA = {
|
|
|
1770
1865
|
},
|
|
1771
1866
|
},
|
|
1772
1867
|
|
|
1868
|
+
"error.notify": {
|
|
1869
|
+
type: "enum",
|
|
1870
|
+
values: ["on", "off"] as const,
|
|
1871
|
+
default: "off",
|
|
1872
|
+
ui: {
|
|
1873
|
+
tab: "interaction",
|
|
1874
|
+
group: "Notifications",
|
|
1875
|
+
label: "Error Notification",
|
|
1876
|
+
description: "Notify when the agent stops with an error",
|
|
1877
|
+
},
|
|
1878
|
+
},
|
|
1879
|
+
|
|
1773
1880
|
"ask.timeout": {
|
|
1774
1881
|
type: "number",
|
|
1775
1882
|
default: 0,
|
|
@@ -2445,9 +2552,8 @@ export const SETTINGS_SCHEMA = {
|
|
|
2445
2552
|
"memories.summaryInjectionTokenLimit": { type: "number", default: 5000 },
|
|
2446
2553
|
|
|
2447
2554
|
// Memory backend selector — picks between local memories pipeline,
|
|
2448
|
-
// Mnemopi local SQLite, Hindsight remote memory, or off.
|
|
2449
|
-
// `memories.enabled`
|
|
2450
|
-
// migration for details.
|
|
2555
|
+
// Mnemopi local SQLite, Hindsight remote memory, or off. The legacy
|
|
2556
|
+
// `memories.enabled` flag is migration input only; see config/settings.ts.
|
|
2451
2557
|
"memory.backend": {
|
|
2452
2558
|
type: "enum",
|
|
2453
2559
|
values: ["off", "local", "hindsight", "mnemopi"] as const,
|
|
@@ -2753,7 +2859,18 @@ export const SETTINGS_SCHEMA = {
|
|
|
2753
2859
|
},
|
|
2754
2860
|
},
|
|
2755
2861
|
|
|
2756
|
-
"hindsight.apiToken": {
|
|
2862
|
+
"hindsight.apiToken": {
|
|
2863
|
+
type: "string",
|
|
2864
|
+
default: undefined,
|
|
2865
|
+
ui: {
|
|
2866
|
+
tab: "memory",
|
|
2867
|
+
group: "Hindsight",
|
|
2868
|
+
label: "Hindsight API Token",
|
|
2869
|
+
description: "Bearer token for authenticated Hindsight servers",
|
|
2870
|
+
condition: "hindsightActive",
|
|
2871
|
+
secret: true,
|
|
2872
|
+
},
|
|
2873
|
+
},
|
|
2757
2874
|
|
|
2758
2875
|
"hindsight.bankId": {
|
|
2759
2876
|
type: "string",
|
|
@@ -3094,6 +3211,17 @@ export const SETTINGS_SCHEMA = {
|
|
|
3094
3211
|
},
|
|
3095
3212
|
},
|
|
3096
3213
|
|
|
3214
|
+
"read.renderMarkdown": {
|
|
3215
|
+
type: "boolean",
|
|
3216
|
+
default: false,
|
|
3217
|
+
ui: {
|
|
3218
|
+
tab: "files",
|
|
3219
|
+
group: "Reading",
|
|
3220
|
+
label: "Markdown Previews",
|
|
3221
|
+
description: "Render Markdown read results as formatted terminal Markdown previews instead of raw source",
|
|
3222
|
+
},
|
|
3223
|
+
},
|
|
3224
|
+
|
|
3097
3225
|
"read.summarize.enabled": {
|
|
3098
3226
|
type: "boolean",
|
|
3099
3227
|
default: true,
|
|
@@ -3273,6 +3401,17 @@ export const SETTINGS_SCHEMA = {
|
|
|
3273
3401
|
description: "Automatically background long-running bash commands and deliver the result later",
|
|
3274
3402
|
},
|
|
3275
3403
|
},
|
|
3404
|
+
"bash.patterns": {
|
|
3405
|
+
type: "array",
|
|
3406
|
+
default: [],
|
|
3407
|
+
ui: {
|
|
3408
|
+
tab: "shell",
|
|
3409
|
+
group: "Bash",
|
|
3410
|
+
label: "Bash Approval Patterns",
|
|
3411
|
+
description:
|
|
3412
|
+
"Ordered bash command approval rules. Each item has match and approval fields; only '*' wildcards are supported.",
|
|
3413
|
+
},
|
|
3414
|
+
},
|
|
3276
3415
|
|
|
3277
3416
|
// Bash interceptor
|
|
3278
3417
|
"bashInterceptor.enabled": {
|
|
@@ -3287,6 +3426,29 @@ export const SETTINGS_SCHEMA = {
|
|
|
3287
3426
|
},
|
|
3288
3427
|
"bashInterceptor.patterns": { type: "array", default: DEFAULT_BASH_INTERCEPTOR_RULES },
|
|
3289
3428
|
|
|
3429
|
+
"bash.direnv": {
|
|
3430
|
+
type: "enum",
|
|
3431
|
+
values: ["auto", "off"] as const,
|
|
3432
|
+
default: "auto",
|
|
3433
|
+
ui: {
|
|
3434
|
+
tab: "shell",
|
|
3435
|
+
group: "Bash",
|
|
3436
|
+
label: "direnv Auto-Load",
|
|
3437
|
+
description:
|
|
3438
|
+
"Auto-load a repo's direnv/devenv `.envrc` into the bash session so devenv tools and env vars are present without manual `direnv exec`. Honors direnv's allow list: an `.envrc` you haven't `direnv allow`ed is never executed",
|
|
3439
|
+
},
|
|
3440
|
+
},
|
|
3441
|
+
"bash.direnvLoadTimeoutMs": {
|
|
3442
|
+
type: "number",
|
|
3443
|
+
default: 30_000,
|
|
3444
|
+
ui: {
|
|
3445
|
+
tab: "shell",
|
|
3446
|
+
group: "Bash",
|
|
3447
|
+
label: "direnv Load Timeout (ms)",
|
|
3448
|
+
description:
|
|
3449
|
+
"Max wait for the first `direnv export` (a cold devenv shell can be slow); on timeout the session runs without the direnv env",
|
|
3450
|
+
},
|
|
3451
|
+
},
|
|
3290
3452
|
// Shell output minimizer
|
|
3291
3453
|
"shellMinimizer.enabled": {
|
|
3292
3454
|
type: "boolean",
|
|
@@ -3933,6 +4095,40 @@ export const SETTINGS_SCHEMA = {
|
|
|
3933
4095
|
},
|
|
3934
4096
|
},
|
|
3935
4097
|
|
|
4098
|
+
"tools.xdevDocs": {
|
|
4099
|
+
type: "enum",
|
|
4100
|
+
values: ["inline", "builtins", "catalog"] as const,
|
|
4101
|
+
default: "builtins",
|
|
4102
|
+
ui: {
|
|
4103
|
+
tab: "tools",
|
|
4104
|
+
group: "Discovery & MCP",
|
|
4105
|
+
label: "xd:// Prompt Docs",
|
|
4106
|
+
description:
|
|
4107
|
+
"Choose which mounted-device docs and schemas are inlined in the system prompt. Built-ins keeps core tools inline while MCP and extension tools stay on-demand.",
|
|
4108
|
+
options: [
|
|
4109
|
+
{ value: "inline", label: "All Devices", description: "Inline docs and schemas for every mounted device." },
|
|
4110
|
+
{
|
|
4111
|
+
value: "builtins",
|
|
4112
|
+
label: "Built-ins Only",
|
|
4113
|
+
description: "Inline built-in docs; fetch MCP and extension docs on demand.",
|
|
4114
|
+
},
|
|
4115
|
+
{ value: "catalog", label: "Catalog Only", description: "List every device; fetch all docs on demand." },
|
|
4116
|
+
],
|
|
4117
|
+
},
|
|
4118
|
+
},
|
|
4119
|
+
|
|
4120
|
+
"tools.xdevInlineDevices": {
|
|
4121
|
+
type: "array",
|
|
4122
|
+
default: EMPTY_STRING_ARRAY,
|
|
4123
|
+
ui: {
|
|
4124
|
+
tab: "tools",
|
|
4125
|
+
group: "Discovery & MCP",
|
|
4126
|
+
label: "xd:// Inline Devices",
|
|
4127
|
+
description:
|
|
4128
|
+
"When xd:// Prompt Docs is Built-ins Only, inline dynamic devices whose names match these glob patterns (for example mcp__context_mode_*). Catalog Only ignores this setting.",
|
|
4129
|
+
},
|
|
4130
|
+
},
|
|
4131
|
+
|
|
3936
4132
|
// MCP
|
|
3937
4133
|
"mcp.enableProjectConfig": {
|
|
3938
4134
|
type: "boolean",
|
|
@@ -3945,6 +4141,17 @@ export const SETTINGS_SCHEMA = {
|
|
|
3945
4141
|
},
|
|
3946
4142
|
},
|
|
3947
4143
|
|
|
4144
|
+
"mcp.renderMarkdownResults": {
|
|
4145
|
+
type: "boolean",
|
|
4146
|
+
default: true,
|
|
4147
|
+
ui: {
|
|
4148
|
+
tab: "tools",
|
|
4149
|
+
group: "Discovery & MCP",
|
|
4150
|
+
label: "MCP Markdown Results",
|
|
4151
|
+
description: "Render non-JSON MCP text results as Markdown in the transcript",
|
|
4152
|
+
},
|
|
4153
|
+
},
|
|
4154
|
+
|
|
3948
4155
|
"mcp.notifications": {
|
|
3949
4156
|
type: "boolean",
|
|
3950
4157
|
default: false,
|
|
@@ -4089,6 +4296,18 @@ export const SETTINGS_SCHEMA = {
|
|
|
4089
4296
|
},
|
|
4090
4297
|
},
|
|
4091
4298
|
|
|
4299
|
+
"task.isolation.apply": {
|
|
4300
|
+
type: "boolean",
|
|
4301
|
+
default: true,
|
|
4302
|
+
ui: {
|
|
4303
|
+
tab: "tasks",
|
|
4304
|
+
group: "Isolation",
|
|
4305
|
+
label: "Apply Isolated Changes",
|
|
4306
|
+
description:
|
|
4307
|
+
"Automatically apply successful isolated task changes to the parent checkout; disable to retain patch or branch artifacts",
|
|
4308
|
+
},
|
|
4309
|
+
},
|
|
4310
|
+
|
|
4092
4311
|
"task.isolation.merge": {
|
|
4093
4312
|
type: "enum",
|
|
4094
4313
|
values: ["patch", "branch"] as const,
|
|
@@ -4158,7 +4377,7 @@ export const SETTINGS_SCHEMA = {
|
|
|
4158
4377
|
group: "Subagents",
|
|
4159
4378
|
label: "Batch Task Calls",
|
|
4160
4379
|
description:
|
|
4161
|
-
"Switch the task tool to its batch shape: one call carries {
|
|
4380
|
+
"Switch the task tool to its batch shape: one call carries { context, tasks[] } — one subagent per item, with an optional per-item agent (defaulting to the session spawn-policy agent), per-item isolation, and a required shared context prepended to every assignment. With async.enabled=true, each spawn runs as an independent background agent with the normal idle/parked lifecycle; otherwise the call blocks for merged results. Disable to restore the flat single-spawn schema.",
|
|
4162
4381
|
},
|
|
4163
4382
|
},
|
|
4164
4383
|
|
|
@@ -4421,7 +4640,7 @@ export const SETTINGS_SCHEMA = {
|
|
|
4421
4640
|
tab: "providers",
|
|
4422
4641
|
group: "Privacy",
|
|
4423
4642
|
label: "Hide Secrets",
|
|
4424
|
-
description: "Obfuscate secrets before sending to AI providers",
|
|
4643
|
+
description: "Obfuscate configured secrets and redact credential-shaped tokens before sending to AI providers",
|
|
4425
4644
|
},
|
|
4426
4645
|
},
|
|
4427
4646
|
|
|
@@ -4437,16 +4656,17 @@ export const SETTINGS_SCHEMA = {
|
|
|
4437
4656
|
"Maximum concurrent Ollama Cloud subagent runs per process; 0 disables the provider-specific limit",
|
|
4438
4657
|
},
|
|
4439
4658
|
},
|
|
4440
|
-
"providers.
|
|
4441
|
-
type: "
|
|
4442
|
-
|
|
4443
|
-
default: "auto",
|
|
4659
|
+
"providers.webSearchOrder": {
|
|
4660
|
+
type: "array",
|
|
4661
|
+
default: [] as SearchProviderId[],
|
|
4444
4662
|
ui: {
|
|
4445
4663
|
tab: "providers",
|
|
4446
4664
|
group: "Services",
|
|
4447
|
-
label: "Web Search Provider",
|
|
4448
|
-
description:
|
|
4449
|
-
|
|
4665
|
+
label: "Web Search Provider Order",
|
|
4666
|
+
description:
|
|
4667
|
+
"Prioritized providers for the web_search tool; unlisted providers retain their default order afterward",
|
|
4668
|
+
options: SEARCH_PROVIDER_CHOICES,
|
|
4669
|
+
ordered: true,
|
|
4450
4670
|
},
|
|
4451
4671
|
},
|
|
4452
4672
|
"providers.webSearchExclude": {
|
|
@@ -4457,6 +4677,7 @@ export const SETTINGS_SCHEMA = {
|
|
|
4457
4677
|
group: "Services",
|
|
4458
4678
|
label: "Excluded Web Search Providers",
|
|
4459
4679
|
description: "Providers that web_search should never use, even as fallbacks",
|
|
4680
|
+
options: SEARCH_PROVIDER_CHOICES,
|
|
4460
4681
|
},
|
|
4461
4682
|
},
|
|
4462
4683
|
"providers.webSearchGeminiModel": {
|
|
@@ -4497,46 +4718,17 @@ export const SETTINGS_SCHEMA = {
|
|
|
4497
4718
|
],
|
|
4498
4719
|
},
|
|
4499
4720
|
},
|
|
4500
|
-
"providers.
|
|
4501
|
-
type: "
|
|
4502
|
-
|
|
4503
|
-
default: "auto",
|
|
4721
|
+
"providers.imageOrder": {
|
|
4722
|
+
type: "array",
|
|
4723
|
+
default: [] as ImageProvider[],
|
|
4504
4724
|
ui: {
|
|
4505
4725
|
tab: "providers",
|
|
4506
4726
|
group: "Services",
|
|
4507
|
-
label: "Image Provider",
|
|
4508
|
-
description:
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
label: "Auto",
|
|
4513
|
-
description:
|
|
4514
|
-
"Priority: per-request provider > configured provider > active session provider > GPT model image tool > Codex subscription > Antigravity > xAI > OpenRouter > Gemini",
|
|
4515
|
-
},
|
|
4516
|
-
{
|
|
4517
|
-
value: "openai",
|
|
4518
|
-
label: "OpenAI",
|
|
4519
|
-
description:
|
|
4520
|
-
"OPENAI_API_KEY (gpt-image-2) or active GPT model; falls back to a connected Codex subscription",
|
|
4521
|
-
},
|
|
4522
|
-
{
|
|
4523
|
-
value: "openai-codex",
|
|
4524
|
-
label: "OpenAI Codex (ChatGPT)",
|
|
4525
|
-
description: "Uses a connected Codex / ChatGPT subscription — no OPENAI_API_KEY needed",
|
|
4526
|
-
},
|
|
4527
|
-
{
|
|
4528
|
-
value: "antigravity",
|
|
4529
|
-
label: "Antigravity",
|
|
4530
|
-
description: "Requires google-antigravity OAuth",
|
|
4531
|
-
},
|
|
4532
|
-
{
|
|
4533
|
-
value: "xai",
|
|
4534
|
-
label: "xAI Grok Imagine",
|
|
4535
|
-
description: "Requires xAI Grok OAuth or XAI_API_KEY",
|
|
4536
|
-
},
|
|
4537
|
-
{ value: "gemini", label: "Gemini", description: "Requires GEMINI_API_KEY" },
|
|
4538
|
-
{ value: "openrouter", label: "OpenRouter", description: "Requires OPENROUTER_API_KEY" },
|
|
4539
|
-
],
|
|
4727
|
+
label: "Image Provider Order",
|
|
4728
|
+
description:
|
|
4729
|
+
"Prioritized providers for image generation; unlisted providers follow the active session provider and the built-in order",
|
|
4730
|
+
options: IMAGE_PROVIDER_CHOICES,
|
|
4731
|
+
ordered: true,
|
|
4540
4732
|
},
|
|
4541
4733
|
},
|
|
4542
4734
|
"providers.fireworksTier": {
|
|
@@ -5032,12 +5224,13 @@ export const SETTINGS_SCHEMA = {
|
|
|
5032
5224
|
|
|
5033
5225
|
"dev.autoqa": {
|
|
5034
5226
|
type: "boolean",
|
|
5035
|
-
default:
|
|
5227
|
+
default: true,
|
|
5036
5228
|
ui: {
|
|
5037
5229
|
tab: "tools",
|
|
5038
5230
|
group: "Developer",
|
|
5039
5231
|
label: "Auto QA",
|
|
5040
|
-
description:
|
|
5232
|
+
description:
|
|
5233
|
+
"Automated tool issue reporting (xd://report_issue). On by default; the first report asks for consent, and denying it disables reporting until re-enabled explicitly",
|
|
5041
5234
|
},
|
|
5042
5235
|
},
|
|
5043
5236
|
|
|
@@ -5225,6 +5418,9 @@ export interface RetrySettings {
|
|
|
5225
5418
|
baseDelayMs: number;
|
|
5226
5419
|
maxDelayMs: number;
|
|
5227
5420
|
modelFallback: boolean;
|
|
5421
|
+
usageAwareFallback: boolean;
|
|
5422
|
+
usageReservePct: number;
|
|
5423
|
+
usageReservePolicy: "confirm" | "auto" | "fail-closed";
|
|
5228
5424
|
}
|
|
5229
5425
|
|
|
5230
5426
|
export interface MemoriesSettings {
|
package/src/config/settings.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import * as fs from "node:fs";
|
|
15
15
|
import * as os from "node:os";
|
|
16
16
|
import * as path from "node:path";
|
|
17
|
+
import { configureCredentialRedaction } from "@oh-my-pi/pi-ai/providers/transform-messages";
|
|
17
18
|
import { configureProviderMaxInFlightRequests } from "@oh-my-pi/pi-ai/stream";
|
|
18
19
|
import {
|
|
19
20
|
getAgentDbPath,
|
|
@@ -33,7 +34,9 @@ import type { ModelRole } from "../config/model-roles";
|
|
|
33
34
|
import { loadCapability } from "../discovery";
|
|
34
35
|
import { isLightTheme, setAutoThemeMapping, setColorBlindMode, setSymbolPreset } from "../modes/theme/theme";
|
|
35
36
|
import { AgentStorage } from "../session/agent-storage";
|
|
37
|
+
import { AUTO_IMAGE_PROVIDER_ORDER, isImageProviderId } from "../tools/image-providers";
|
|
36
38
|
import { type EditMode, normalizeEditMode } from "../utils/edit-mode";
|
|
39
|
+
import { isSearchProviderId, SEARCH_PROVIDER_ORDER } from "../web/search/types";
|
|
37
40
|
import { withFileLock } from "./file-lock";
|
|
38
41
|
import {
|
|
39
42
|
type BashInterceptorRule,
|
|
@@ -361,6 +364,7 @@ export class Settings {
|
|
|
361
364
|
if (options.configFiles) configFiles.push(...options.configFiles);
|
|
362
365
|
this.#configFiles = configFiles.map(file => path.resolve(this.#cwd, expandTilde(file)));
|
|
363
366
|
this.#persist = !options.inMemory && options.readOnly !== true;
|
|
367
|
+
liveSettingsInstances.add(new WeakRef(this));
|
|
364
368
|
|
|
365
369
|
if (options.overrides) {
|
|
366
370
|
for (const [key, value] of Object.entries(options.overrides)) {
|
|
@@ -534,6 +538,23 @@ export class Settings {
|
|
|
534
538
|
}
|
|
535
539
|
}
|
|
536
540
|
|
|
541
|
+
/** Set once this instance is discarded; background saves become no-ops. */
|
|
542
|
+
#savesCancelled = false;
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Drop pending debounced saves and refuse any further background writes.
|
|
546
|
+
* Used when an instance is being discarded (test teardown): an armed timer
|
|
547
|
+
* or a chained in-flight save on a dropped instance would otherwise fire
|
|
548
|
+
* later and race the successor's file locks.
|
|
549
|
+
*/
|
|
550
|
+
cancelPendingSaves(): void {
|
|
551
|
+
this.#savesCancelled = true;
|
|
552
|
+
clearTimeout(this.#saveTimer);
|
|
553
|
+
this.#saveTimer = undefined;
|
|
554
|
+
clearTimeout(this.#projectSaveTimer);
|
|
555
|
+
this.#projectSaveTimer = undefined;
|
|
556
|
+
}
|
|
557
|
+
|
|
537
558
|
/**
|
|
538
559
|
* Flush any pending saves to disk.
|
|
539
560
|
* Call before exit to ensure all changes are persisted.
|
|
@@ -1595,6 +1616,45 @@ export class Settings {
|
|
|
1595
1616
|
delete raw["mcp.discoveryMode"];
|
|
1596
1617
|
delete raw["mcp.discoveryDefaultServers"];
|
|
1597
1618
|
|
|
1619
|
+
// providers.webSearch / providers.image (single preferred provider) →
|
|
1620
|
+
// providers.webSearchOrder / providers.imageOrder (priority lists). A
|
|
1621
|
+
// concrete legacy choice becomes the head of the new list with every
|
|
1622
|
+
// remaining provider appended in its built-in order, so the old
|
|
1623
|
+
// preference stays #1 and the fallback chain is written out explicitly.
|
|
1624
|
+
// "auto" (or an unknown id) just drops the key — the default chain.
|
|
1625
|
+
const providerPrefsObj = raw.providers as Record<string, unknown> | undefined;
|
|
1626
|
+
const migrateProviderPreference = (
|
|
1627
|
+
legacyKey: string,
|
|
1628
|
+
orderKey: string,
|
|
1629
|
+
expand: (value: string) => string[] | undefined,
|
|
1630
|
+
): void => {
|
|
1631
|
+
const flatLegacyKey = `providers.${legacyKey}`;
|
|
1632
|
+
const legacy = providerPrefsObj?.[legacyKey] ?? raw[flatLegacyKey];
|
|
1633
|
+
if (legacy === undefined) return;
|
|
1634
|
+
const existingOrder = providerPrefsObj?.[orderKey] ?? raw[`providers.${orderKey}`];
|
|
1635
|
+
const orderAlreadySet = Array.isArray(existingOrder) && existingOrder.length > 0;
|
|
1636
|
+
if (!orderAlreadySet && typeof legacy === "string") {
|
|
1637
|
+
const expanded = expand(legacy);
|
|
1638
|
+
if (expanded) {
|
|
1639
|
+
const root = providerPrefsObj ?? {};
|
|
1640
|
+
root[orderKey] = expanded;
|
|
1641
|
+
raw.providers = root;
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
if (providerPrefsObj) delete providerPrefsObj[legacyKey];
|
|
1645
|
+
delete raw[flatLegacyKey];
|
|
1646
|
+
};
|
|
1647
|
+
migrateProviderPreference("webSearch", "webSearchOrder", value =>
|
|
1648
|
+
value !== "auto" && isSearchProviderId(value)
|
|
1649
|
+
? [value, ...SEARCH_PROVIDER_ORDER.filter(id => id !== value)]
|
|
1650
|
+
: undefined,
|
|
1651
|
+
);
|
|
1652
|
+
migrateProviderPreference("image", "imageOrder", value =>
|
|
1653
|
+
value !== "auto" && isImageProviderId(value)
|
|
1654
|
+
? [value, ...AUTO_IMAGE_PROVIDER_ORDER.filter(id => id !== value)]
|
|
1655
|
+
: undefined,
|
|
1656
|
+
);
|
|
1657
|
+
|
|
1598
1658
|
return raw;
|
|
1599
1659
|
}
|
|
1600
1660
|
|
|
@@ -1646,7 +1706,7 @@ export class Settings {
|
|
|
1646
1706
|
}
|
|
1647
1707
|
|
|
1648
1708
|
async #saveNow(): Promise<void> {
|
|
1649
|
-
if (!this.#persist || !this.#configPath) return;
|
|
1709
|
+
if (this.#savesCancelled || !this.#persist || !this.#configPath) return;
|
|
1650
1710
|
if (this.#modified.size === 0 && this.#modifiedGlobalModelRoles.size === 0) return;
|
|
1651
1711
|
|
|
1652
1712
|
const configPath = this.#configPath;
|
|
@@ -1750,7 +1810,7 @@ export class Settings {
|
|
|
1750
1810
|
}
|
|
1751
1811
|
|
|
1752
1812
|
async #saveProjectNow(): Promise<void> {
|
|
1753
|
-
if (!this.#persist || this.#modifiedProjectModelRoles.size === 0) return;
|
|
1813
|
+
if (this.#savesCancelled || !this.#persist || this.#modifiedProjectModelRoles.size === 0) return;
|
|
1754
1814
|
|
|
1755
1815
|
const projectConfigPath = path.join(this.#cwd, ".omp", "config.yml");
|
|
1756
1816
|
const modifiedModelRoles = [...this.#modifiedProjectModelRoles];
|
|
@@ -1919,6 +1979,9 @@ const SETTING_HOOKS: Partial<Record<SettingPath, SettingHook<any>>> = {
|
|
|
1919
1979
|
"providers.maxInFlightRequests": value => {
|
|
1920
1980
|
configureProviderMaxInFlightRequests(validateProviderMaxInFlightRequests(value));
|
|
1921
1981
|
},
|
|
1982
|
+
"secrets.enabled": value => {
|
|
1983
|
+
configureCredentialRedaction(value === true);
|
|
1984
|
+
},
|
|
1922
1985
|
"hindsight.bankId": () => hindsightScopeSignal.fire(),
|
|
1923
1986
|
"hindsight.bankIdPrefix": () => hindsightScopeSignal.fire(),
|
|
1924
1987
|
"hindsight.scoping": () => hindsightScopeSignal.fire(),
|
|
@@ -1978,6 +2041,13 @@ export const onHindsightScopeChanged = (cb: () => void) => hindsightScopeSignal.
|
|
|
1978
2041
|
// Global Singleton
|
|
1979
2042
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
1980
2043
|
|
|
2044
|
+
/**
|
|
2045
|
+
* Weak registry of every constructed instance so `resetSettingsForTest` can
|
|
2046
|
+
* disarm stray background saves on isolated instances too. WeakRefs never
|
|
2047
|
+
* retain instances; the set is cleared on every test reset.
|
|
2048
|
+
*/
|
|
2049
|
+
const liveSettingsInstances = new Set<WeakRef<Settings>>();
|
|
2050
|
+
|
|
1981
2051
|
let globalInstance: Settings | null = null;
|
|
1982
2052
|
let globalInstancePromise: Promise<Settings> | null = null;
|
|
1983
2053
|
let boundSettingsInstance: Settings | null = null;
|
|
@@ -1997,10 +2067,19 @@ export function isSettingsInitialized(): boolean {
|
|
|
1997
2067
|
* @internal
|
|
1998
2068
|
*/
|
|
1999
2069
|
export function resetSettingsForTest(): void {
|
|
2070
|
+
// Disarm every constructed instance's debounced saves — including isolated
|
|
2071
|
+
// (non-singleton) instances: an armed timer or chained in-flight save on a
|
|
2072
|
+
// dropped instance fires mid-way through the NEXT test and races its file
|
|
2073
|
+
// locks/spies (cross-file pollution).
|
|
2074
|
+
for (const ref of liveSettingsInstances) {
|
|
2075
|
+
ref.deref()?.cancelPendingSaves();
|
|
2076
|
+
}
|
|
2077
|
+
liveSettingsInstances.clear();
|
|
2000
2078
|
globalInstance = null;
|
|
2001
2079
|
globalInstancePromise = null;
|
|
2002
2080
|
clearBoundSettingsMethods();
|
|
2003
2081
|
configureProviderMaxInFlightRequests(undefined);
|
|
2082
|
+
configureCredentialRedaction(false);
|
|
2004
2083
|
}
|
|
2005
2084
|
|
|
2006
2085
|
/**
|