@andorra-labs/code 0.1.11 → 0.1.13
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/README.md +8 -2
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/dist/src/account-presentation.d.ts +1 -37
- package/dist/src/account-presentation.js +2 -42
- package/dist/src/activity.d.ts +0 -25
- package/dist/src/activity.js +1 -23
- package/dist/src/agent-definitions.d.ts +0 -26
- package/dist/src/agent-definitions.js +0 -43
- package/dist/src/agent-execution.d.ts +0 -2
- package/dist/src/agent-execution.js +59 -414
- package/dist/src/agent-mcp-catalog.d.ts +0 -8
- package/dist/src/agent-mcp-catalog.js +0 -2
- package/dist/src/agent-mcp.d.ts +0 -56
- package/dist/src/agent-mcp.js +14 -153
- package/dist/src/agent-modifiers.d.ts +0 -1
- package/dist/src/agent-modifiers.js +25 -68
- package/dist/src/analytics.d.ts +0 -66
- package/dist/src/analytics.js +0 -45
- package/dist/src/anthropic-console-auth.d.ts +0 -24
- package/dist/src/anthropic-console-auth.js +0 -37
- package/dist/src/anthropic-credentials.d.ts +0 -25
- package/dist/src/anthropic-credentials.js +0 -28
- package/dist/src/app-server/protocol.d.ts +19 -244
- package/dist/src/app-server/protocol.js +1 -132
- package/dist/src/app-server/reasoning.d.ts +0 -31
- package/dist/src/app-server/reasoning.js +0 -54
- package/dist/src/app-server/terminal.d.ts +0 -36
- package/dist/src/app-server/terminal.js +3 -39
- package/dist/src/app-server/workspace.d.ts +0 -167
- package/dist/src/app-server/workspace.js +4 -406
- package/dist/src/app-server.d.ts +33 -918
- package/dist/src/app-server.js +608 -2984
- package/dist/src/artifacts.d.ts +0 -10
- package/dist/src/artifacts.js +1 -11
- package/dist/src/attachments.d.ts +4 -98
- package/dist/src/attachments.js +10 -130
- package/dist/src/auth/AuthManager.d.ts +0 -93
- package/dist/src/auth/AuthManager.js +3 -165
- package/dist/src/auth/callback-page.d.ts +0 -1
- package/dist/src/auth/callback-page.js +0 -4
- package/dist/src/auth/callback.d.ts +0 -25
- package/dist/src/auth/callback.js +1 -29
- package/dist/src/auth/deployment.d.ts +0 -16
- package/dist/src/auth/deployment.js +0 -16
- package/dist/src/auth/index.d.ts +0 -11
- package/dist/src/auth/index.js +0 -11
- package/dist/src/auth/lock.d.ts +0 -1
- package/dist/src/auth/lock.js +0 -1
- package/dist/src/auth/store.d.ts +7 -108
- package/dist/src/auth/store.js +21 -129
- package/dist/src/auth/types.d.ts +0 -8
- package/dist/src/auth-commands.d.ts +0 -5
- package/dist/src/auth-commands.js +0 -1
- package/dist/src/automation-runner.d.ts +0 -9
- package/dist/src/automation-runner.js +0 -11
- package/dist/src/automation-service.d.ts +0 -10
- package/dist/src/automation-service.js +3 -17
- package/dist/src/automation-tool.js +0 -5
- package/dist/src/automation-worker-shutdown.d.ts +0 -1
- package/dist/src/automation-worker-shutdown.js +0 -3
- package/dist/src/automations.d.ts +23 -2
- package/dist/src/automations.js +91 -12
- package/dist/src/background-tasks.d.ts +0 -23
- package/dist/src/background-tasks.js +0 -11
- package/dist/src/boot-trace.d.ts +0 -13
- package/dist/src/boot-trace.js +1 -14
- package/dist/src/browser-activity.js +0 -2
- package/dist/src/browser-bridge.d.ts +0 -2
- package/dist/src/browser-bridge.js +0 -27
- package/dist/src/browser-captcha-tool.d.ts +0 -13
- package/dist/src/browser-captcha-tool.js +3 -35
- package/dist/src/browser-extensions-tool.d.ts +24 -0
- package/dist/src/browser-extensions-tool.js +137 -0
- package/dist/src/browser-extensions.d.ts +127 -0
- package/dist/src/browser-extensions.js +729 -0
- package/dist/src/browser-observation.d.ts +0 -15
- package/dist/src/browser-observation.js +1 -22
- package/dist/src/browser-panel-tool.d.ts +10 -25
- package/dist/src/browser-panel-tool.js +64 -60
- package/dist/src/browser-runner.d.ts +0 -1
- package/dist/src/browser-runner.js +7 -46
- package/dist/src/browser-server.d.ts +0 -6
- package/dist/src/browser-server.js +6 -229
- package/dist/src/browser-session.d.ts +0 -25
- package/dist/src/browser-session.js +1 -71
- package/dist/src/browser-stealth.d.ts +0 -12
- package/dist/src/browser-stealth.js +0 -36
- package/dist/src/browser-ui/app.js +7 -174
- package/dist/src/browser-ui/style.css +0 -68
- package/dist/src/browser-ui/tokens.css +11 -93
- package/dist/src/browser-view.d.ts +52 -290
- package/dist/src/browser-view.js +354 -567
- package/dist/src/capabilities.d.ts +0 -8
- package/dist/src/capabilities.js +0 -29
- package/dist/src/capsolver.d.ts +0 -13
- package/dist/src/capsolver.js +0 -15
- package/dist/src/clarification-ui.d.ts +0 -7
- package/dist/src/clarification-ui.js +0 -8
- package/dist/src/claude-executable.d.ts +0 -1
- package/dist/src/claude-executable.js +1 -2
- package/dist/src/claude-provider.d.ts +6 -19
- package/dist/src/claude-provider.js +166 -61
- package/dist/src/cli-executable.d.ts +0 -16
- package/dist/src/cli-executable.js +0 -7
- package/dist/src/cli-process.d.ts +0 -26
- package/dist/src/cli-process.js +0 -18
- package/dist/src/cli-sign-in.d.ts +0 -20
- package/dist/src/cli-sign-in.js +1 -17
- package/dist/src/cli.d.ts +3 -56
- package/dist/src/cli.js +193 -702
- package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +4 -59
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +27 -100
- package/dist/src/code-intelligence/ContextLedger.d.ts +0 -4
- package/dist/src/code-intelligence/ContextLedger.js +0 -10
- package/dist/src/code-intelligence/ContextRouter.d.ts +0 -6
- package/dist/src/code-intelligence/ContextRouter.js +0 -8
- package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.d.ts +0 -2
- package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.js +5 -12
- package/dist/src/code-intelligence/codegraph/CodeGraphProvider.d.ts +0 -6
- package/dist/src/code-intelligence/codegraph/CodeGraphProvider.js +0 -6
- package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.d.ts +0 -5
- package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.js +1 -17
- package/dist/src/code-intelligence/codegraph/repoExploreTool.d.ts +0 -5
- package/dist/src/code-intelligence/codegraph/repoExploreTool.js +0 -5
- package/dist/src/code-intelligence/repository.d.ts +0 -9
- package/dist/src/code-intelligence/repository.js +1 -11
- package/dist/src/code-intelligence/types.d.ts +0 -8
- package/dist/src/codex-auth.d.ts +0 -44
- package/dist/src/codex-auth.js +0 -45
- package/dist/src/codex-browser-auth.d.ts +0 -13
- package/dist/src/codex-browser-auth.js +3 -20
- package/dist/src/codex-errors.js +0 -2
- package/dist/src/codex-executable.d.ts +0 -2
- package/dist/src/codex-executable.js +1 -7
- package/dist/src/codex-provider.d.ts +0 -13
- package/dist/src/codex-provider.js +1 -26
- package/dist/src/codex-rpc.d.ts +0 -10
- package/dist/src/codex-rpc.js +0 -12
- package/dist/src/coding-tools.d.ts +6 -27
- package/dist/src/coding-tools.js +193 -205
- package/dist/src/command-metrics.d.ts +0 -4
- package/dist/src/command-output-tap.d.ts +0 -11
- package/dist/src/command-output-tap.js +0 -3
- package/dist/src/command-screens.d.ts +24 -0
- package/dist/src/command-screens.js +132 -100
- package/dist/src/commands.d.ts +6 -63
- package/dist/src/commands.js +20 -100
- package/dist/src/completion-gates.d.ts +0 -47
- package/dist/src/completion-gates.js +0 -14
- package/dist/src/completion.d.ts +2 -58
- package/dist/src/completion.js +90 -186
- package/dist/src/config.d.ts +12 -116
- package/dist/src/config.js +41 -171
- package/dist/src/context-budget.d.ts +0 -22
- package/dist/src/context-budget.js +0 -44
- package/dist/src/context-compaction.d.ts +29 -6
- package/dist/src/context-compaction.js +94 -25
- package/dist/src/context-selection.d.ts +0 -24
- package/dist/src/context-selection.js +0 -34
- package/dist/src/dashboard-view.d.ts +0 -2
- package/dist/src/dashboard-view.js +0 -35
- package/dist/src/dashboard.d.ts +0 -2
- package/dist/src/dashboard.js +0 -9
- package/dist/src/deadline.d.ts +0 -45
- package/dist/src/deadline.js +0 -54
- package/dist/src/decision/ContinuationAdapter.d.ts +0 -5
- package/dist/src/decision/ContinuationAdapter.js +0 -5
- package/dist/src/decision/DecisionEngine.d.ts +0 -4
- package/dist/src/decision/DecisionManager.d.ts +0 -1
- package/dist/src/decision/DecisionManager.js +2 -7
- package/dist/src/decision/DecisionPolicy.d.ts +0 -1
- package/dist/src/decision/DecisionPolicy.js +0 -1
- package/dist/src/decision/FactContinuations.d.ts +11 -43
- package/dist/src/decision/FactContinuations.js +126 -95
- package/dist/src/decision/FactServiceGate.d.ts +0 -1
- package/dist/src/decision/FactServiceGate.js +0 -4
- package/dist/src/decision/PreparedSteps.d.ts +0 -15
- package/dist/src/decision/PreparedSteps.js +1 -11
- package/dist/src/decision/applyToolMenu.d.ts +0 -1
- package/dist/src/decision/applyToolMenu.js +1 -5
- package/dist/src/decision/checks.d.ts +15 -28
- package/dist/src/decision/checks.js +118 -49
- package/dist/src/decision/facts.d.ts +0 -16
- package/dist/src/decision/facts.js +0 -30
- package/dist/src/decision/guidancePolicy.js +0 -1
- package/dist/src/decision/hostedPolicy.d.ts +0 -6
- package/dist/src/decision/hostedPolicy.js +0 -7
- package/dist/src/decision/hostedSkills.d.ts +0 -19
- package/dist/src/decision/hostedSkills.js +0 -19
- package/dist/src/decision/optimizationPolicy.d.ts +0 -3
- package/dist/src/decision/optimizationPolicy.js +1 -4
- package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +0 -7
- package/dist/src/decision/providers/AndorraDecisionProvider.js +4 -27
- package/dist/src/decision/providers/HttpDecisionProvider.d.ts +0 -2
- package/dist/src/decision/providers/HttpDecisionProvider.js +0 -6
- package/dist/src/decision/routeTools.d.ts +0 -8
- package/dist/src/decision/routeTools.js +1 -8
- package/dist/src/decision/toolFamilies.d.ts +0 -1
- package/dist/src/decision/toolFamilies.js +0 -1
- package/dist/src/decision/toolMenu.d.ts +0 -3
- package/dist/src/decision/toolMenu.js +0 -4
- package/dist/src/decision/types.d.ts +0 -6
- package/dist/src/default-graph.d.ts +0 -9
- package/dist/src/default-graph.js +0 -9
- package/dist/src/delegation-changes.d.ts +0 -56
- package/dist/src/delegation-changes.js +15 -124
- package/dist/src/diff-preview.d.ts +1 -1
- package/dist/src/diff-preview.js +4 -12
- package/dist/src/duration.d.ts +0 -50
- package/dist/src/duration.js +0 -50
- package/dist/src/efficiency.d.ts +0 -39
- package/dist/src/efficiency.js +0 -16
- package/dist/src/engine/protocol.d.ts +0 -2
- package/dist/src/engine/protocol.js +0 -2
- package/dist/src/engine-streams.d.ts +13 -0
- package/dist/src/engine-streams.js +16 -0
- package/dist/src/extensions.d.ts +3 -2
- package/dist/src/extensions.js +76 -37
- package/dist/src/favicons.d.ts +0 -26
- package/dist/src/favicons.js +0 -34
- package/dist/src/file-diff.d.ts +2 -58
- package/dist/src/file-diff.js +0 -32
- package/dist/src/file-read-key.d.ts +1 -0
- package/dist/src/file-read-key.js +5 -0
- package/dist/src/file-read-state.d.ts +0 -1
- package/dist/src/file-read-state.js +0 -4
- package/dist/src/firefox-cookies.d.ts +0 -34
- package/dist/src/firefox-cookies.js +1 -55
- package/dist/src/git-identity-audit.d.ts +27 -0
- package/dist/src/git-identity-audit.js +286 -0
- package/dist/src/git-identity-guard.d.ts +4 -0
- package/dist/src/git-identity-guard.js +998 -0
- package/dist/src/git-identity-hold.d.ts +12 -0
- package/dist/src/git-identity-hold.js +81 -0
- package/dist/src/git-summary.d.ts +0 -58
- package/dist/src/git-summary.js +2 -212
- package/dist/src/goal-completion-verification.d.ts +2 -2
- package/dist/src/goal-completion-verification.js +3 -6
- package/dist/src/graph-account.d.ts +0 -21
- package/dist/src/graph-account.js +0 -17
- package/dist/src/graph-editor-session.d.ts +0 -1
- package/dist/src/graph-editor-session.js +1 -3
- package/dist/src/graph-health.d.ts +7 -49
- package/dist/src/graph-health.js +35 -46
- package/dist/src/graph-manager-chat.d.ts +27 -128
- package/dist/src/graph-manager-chat.js +36 -166
- package/dist/src/graph-provider-portability.d.ts +1 -21
- package/dist/src/graph-provider-portability.js +6 -45
- package/dist/src/graph-quota.d.ts +0 -33
- package/dist/src/graph-quota.js +1 -44
- package/dist/src/graph-runner.d.ts +0 -1
- package/dist/src/graph-runner.js +47 -387
- package/dist/src/graph-selection.d.ts +0 -14
- package/dist/src/graph-selection.js +0 -14
- package/dist/src/graph-server.d.ts +3 -11
- package/dist/src/graph-server.js +70 -111
- package/dist/src/graph-studio-features.d.ts +0 -5
- package/dist/src/graph-studio-features.js +2 -42
- package/dist/src/graph-sync.d.ts +0 -78
- package/dist/src/graph-sync.js +5 -201
- package/dist/src/graph-tool.d.ts +0 -18
- package/dist/src/graph-tool.js +0 -27
- package/dist/src/graph-ui/app.js +229 -498
- package/dist/src/graph-ui/compat.js +0 -7
- package/dist/src/graph-ui/controls.css +47 -43
- package/dist/src/graph-ui/controls.js +0 -88
- package/dist/src/graph-ui/drafts.js +0 -12
- package/dist/src/graph-ui/edge-router.js +0 -62
- package/dist/src/graph-ui/embed.js +0 -59
- package/dist/src/graph-ui/icons.js +2 -7
- package/dist/src/graph-ui/index.html +2 -2
- package/dist/src/graph-ui/library.css +0 -5
- package/dist/src/graph-ui/manager-markdown.js +0 -11
- package/dist/src/graph-ui/manager-state.js +110 -49
- package/dist/src/graph-ui/manager.css +2 -20
- package/dist/src/graph-ui/manager.js +251 -166
- package/dist/src/graph-ui/model-picker.js +250 -0
- package/dist/src/graph-ui/provider-glyphs/alibaba-cloud.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/anthropic.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/aws-bedrock.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/claude.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/deepseek.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/fireworks.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/kimi.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/minimax.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/openai.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/opencode.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/openrouter.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/xai.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/xiaomi-mimo.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/zai.png +0 -0
- package/dist/src/graph-ui/sidebar.js +2 -3
- package/dist/src/graph-ui/skill-picker.js +373 -39
- package/dist/src/graph-ui/studio-canvas.js +3 -38
- package/dist/src/graph-ui/studio.css +0 -18
- package/dist/src/graph-ui/studio.js +3 -71
- package/dist/src/graph-ui/style.css +11 -134
- package/dist/src/graph-ui/theme.js +1 -26
- package/dist/src/graph-ui/tokens.css +15 -114
- package/dist/src/graphs.d.ts +7 -156
- package/dist/src/graphs.js +72 -273
- package/dist/src/grep-regex-worker.js +0 -2
- package/dist/src/grep-regex.d.ts +1 -5
- package/dist/src/grep-regex.js +6 -8
- package/dist/src/grok-provider.d.ts +0 -17
- package/dist/src/grok-provider.js +1 -26
- package/dist/src/handoffs.d.ts +0 -11
- package/dist/src/handoffs.js +0 -13
- package/dist/src/hardened-runtime.d.ts +0 -10
- package/dist/src/hardened-runtime.js +8 -46
- package/dist/src/harness-home.d.ts +21 -0
- package/dist/src/harness-home.js +87 -0
- package/dist/src/host-process-guard.d.ts +0 -50
- package/dist/src/host-process-guard.js +0 -641
- package/dist/src/limits.d.ts +0 -64
- package/dist/src/limits.js +0 -62
- package/dist/src/managed-sign-in.d.ts +0 -12
- package/dist/src/managed-sign-in.js +0 -16
- package/dist/src/markdown.d.ts +0 -28
- package/dist/src/markdown.js +1 -175
- package/dist/src/mcp.d.ts +21 -82
- package/dist/src/mcp.js +228 -237
- package/dist/src/membership-errors.d.ts +0 -14
- package/dist/src/membership-errors.js +0 -13
- package/dist/src/membership.d.ts +2 -60
- package/dist/src/membership.js +0 -85
- package/dist/src/memory/LocalToolMemory.d.ts +0 -1
- package/dist/src/memory/LocalToolMemory.js +2 -7
- package/dist/src/memory/MemoryDistiller.js +0 -15
- package/dist/src/memory/MemoryManager.d.ts +0 -3
- package/dist/src/memory/MemoryManager.js +6 -18
- package/dist/src/memory/MemoryPolicy.d.ts +0 -2
- package/dist/src/memory/MemoryPolicy.js +0 -2
- package/dist/src/memory/MemoryProvider.d.ts +0 -6
- package/dist/src/memory/MemoryRetriever.js +0 -7
- package/dist/src/memory/PermissionMemoryProvider.d.ts +0 -1
- package/dist/src/memory/PermissionMemoryProvider.js +0 -1
- package/dist/src/memory/ProjectMemory.d.ts +42 -0
- package/dist/src/memory/ProjectMemory.js +285 -0
- package/dist/src/memory/ToolFailureLessons.d.ts +0 -3
- package/dist/src/memory/ToolFailureLessons.js +0 -6
- package/dist/src/memory/index.d.ts +1 -0
- package/dist/src/memory/index.js +1 -0
- package/dist/src/memory/providers/NoOpMemoryProvider.d.ts +0 -1
- package/dist/src/memory/providers/NoOpMemoryProvider.js +0 -1
- package/dist/src/memory/redaction.d.ts +0 -5
- package/dist/src/memory/redaction.js +0 -11
- package/dist/src/memory/repository.d.ts +0 -6
- package/dist/src/memory/repository.js +2 -12
- package/dist/src/memory/types.d.ts +0 -1
- package/dist/src/model-health-cache.d.ts +0 -38
- package/dist/src/model-health-cache.js +1 -49
- package/dist/src/model-metadata.d.ts +0 -18
- package/dist/src/model-metadata.js +2 -42
- package/dist/src/model-override.d.ts +0 -36
- package/dist/src/model-override.js +0 -43
- package/dist/src/model-tiers.d.ts +0 -13
- package/dist/src/model-tiers.js +0 -23
- package/dist/src/opencode-catalog.d.ts +0 -2
- package/dist/src/opencode-catalog.js +0 -11
- package/dist/src/opencode-cli-provider.d.ts +0 -35
- package/dist/src/opencode-cli-provider.js +1 -44
- package/dist/src/opencode-provider.d.ts +0 -2
- package/dist/src/opencode-provider.js +6 -22
- package/dist/src/package-name.d.ts +1 -0
- package/dist/src/package-name.js +1 -0
- package/dist/src/paged-transcript.d.ts +0 -11
- package/dist/src/paged-transcript.js +2 -20
- package/dist/src/palette.d.ts +0 -63
- package/dist/src/palette.js +0 -63
- package/dist/src/permissions.d.ts +0 -15
- package/dist/src/permissions.js +0 -17
- package/dist/src/powershell-pool.d.ts +0 -9
- package/dist/src/powershell-pool.js +3 -26
- package/dist/src/process-warnings.d.ts +4 -0
- package/dist/src/process-warnings.js +103 -0
- package/dist/src/profile.d.ts +0 -43
- package/dist/src/profile.js +0 -43
- package/dist/src/project-reservation.d.ts +11 -0
- package/dist/src/project-reservation.js +143 -0
- package/dist/src/provider-connection.d.ts +0 -18
- package/dist/src/provider-connection.js +0 -39
- package/dist/src/provider-engine.d.ts +0 -21
- package/dist/src/provider-engine.js +3 -98
- package/dist/src/provider-import.d.ts +0 -49
- package/dist/src/provider-import.js +0 -60
- package/dist/src/provider-keys.d.ts +1 -36
- package/dist/src/provider-keys.js +5 -48
- package/dist/src/provider-settings.d.ts +0 -2
- package/dist/src/provider-settings.js +0 -32
- package/dist/src/providers.d.ts +0 -217
- package/dist/src/providers.js +0 -315
- package/dist/src/pull-requests.d.ts +0 -173
- package/dist/src/pull-requests.js +5 -195
- package/dist/src/qa/browser/PlaywrightRunner.d.ts +0 -7
- package/dist/src/qa/browser/PlaywrightRunner.js +2 -16
- package/dist/src/qa/command-policy.d.ts +0 -23
- package/dist/src/qa/command-policy.js +0 -30
- package/dist/src/qa/guidance.d.ts +0 -21
- package/dist/src/qa/guidance.js +0 -20
- package/dist/src/qa/profile/ProjectInspector.d.ts +0 -4
- package/dist/src/qa/profile/ProjectInspector.js +0 -6
- package/dist/src/qa/profile/QaConfigLoader.d.ts +0 -7
- package/dist/src/qa/profile/QaConfigLoader.js +0 -6
- package/dist/src/qa/profile/QaProfile.d.ts +0 -7
- package/dist/src/qa/profile/QaProfile.js +0 -7
- package/dist/src/qa/profile/yaml.d.ts +0 -9
- package/dist/src/qa/profile/yaml.js +0 -13
- package/dist/src/qa/qa-authorize.d.ts +0 -19
- package/dist/src/qa/qa-authorize.js +4 -11
- package/dist/src/qa/runtime/ProcessManager.d.ts +0 -31
- package/dist/src/qa/runtime/ProcessManager.js +4 -41
- package/dist/src/qa/runtime/PtyManager.d.ts +0 -4
- package/dist/src/qa/runtime/PtyManager.js +2 -7
- package/dist/src/qa/runtime/changes.d.ts +0 -11
- package/dist/src/qa/runtime/changes.js +1 -3
- package/dist/src/qa/tools.d.ts +0 -10
- package/dist/src/qa/tools.js +0 -12
- package/dist/src/qa/types.d.ts +0 -13
- package/dist/src/react-runtime.d.ts +2 -21
- package/dist/src/react-runtime.js +106 -418
- package/dist/src/read-document-doc.d.ts +0 -6
- package/dist/src/read-document-doc.js +0 -55
- package/dist/src/read-document-docx.d.ts +0 -16
- package/dist/src/read-document-docx.js +2 -69
- package/dist/src/read-document-text.d.ts +0 -17
- package/dist/src/read-document-text.js +0 -22
- package/dist/src/read-document-tool.d.ts +0 -31
- package/dist/src/read-document-tool.js +0 -30
- package/dist/src/read-document.d.ts +0 -49
- package/dist/src/read-document.js +1 -67
- package/dist/src/read-image.d.ts +0 -32
- package/dist/src/read-image.js +0 -33
- package/dist/src/remote/cert.d.ts +1 -19
- package/dist/src/remote/cert.js +2 -51
- package/dist/src/remote/client.d.ts +0 -70
- package/dist/src/remote/client.js +2 -117
- package/dist/src/remote/command.js +0 -17
- package/dist/src/remote/engine-pool.d.ts +0 -152
- package/dist/src/remote/engine-pool.js +17 -335
- package/dist/src/remote/errors.d.ts +0 -15
- package/dist/src/remote/errors.js +0 -7
- package/dist/src/remote/network.d.ts +0 -26
- package/dist/src/remote/network.js +1 -34
- package/dist/src/remote/pairing.d.ts +16 -51
- package/dist/src/remote/pairing.js +50 -57
- package/dist/src/remote/pem.d.ts +2 -0
- package/dist/src/remote/pem.js +7 -0
- package/dist/src/remote/roots.d.ts +0 -20
- package/dist/src/remote/roots.js +0 -8
- package/dist/src/remote/serve.d.ts +0 -47
- package/dist/src/remote/serve.js +0 -30
- package/dist/src/remote/server.d.ts +0 -14
- package/dist/src/remote/server.js +1 -79
- package/dist/src/remote/types.d.ts +1 -32
- package/dist/src/remote/types.js +0 -10
- package/dist/src/run-control.d.ts +0 -7
- package/dist/src/run-control.js +0 -7
- package/dist/src/run-progress.d.ts +0 -170
- package/dist/src/run-progress.js +0 -285
- package/dist/src/run-records.d.ts +0 -443
- package/dist/src/run-records.js +44 -678
- package/dist/src/run-temp.d.ts +12 -0
- package/dist/src/run-temp.js +50 -0
- package/dist/src/runtime.d.ts +11 -227
- package/dist/src/runtime.js +0 -127
- package/dist/src/sandbox-child.js +0 -1
- package/dist/src/save-lock.d.ts +0 -12
- package/dist/src/save-lock.js +0 -28
- package/dist/src/screen-selection.d.ts +0 -23
- package/dist/src/screen-selection.js +0 -22
- package/dist/src/secret-redaction.d.ts +0 -12
- package/dist/src/secret-redaction.js +0 -45
- package/dist/src/session-changes.d.ts +4 -80
- package/dist/src/session-changes.js +25 -130
- package/dist/src/session-goal.d.ts +129 -0
- package/dist/src/session-goal.js +230 -0
- package/dist/src/session-monitor.d.ts +1 -10
- package/dist/src/session-monitor.js +2 -39
- package/dist/src/session-reaper.d.ts +0 -15
- package/dist/src/session-reaper.js +0 -14
- package/dist/src/session-skills.d.ts +15 -44
- package/dist/src/session-skills.js +75 -60
- package/dist/src/session-summary.d.ts +0 -26
- package/dist/src/session-summary.js +0 -32
- package/dist/src/session-title.d.ts +0 -1
- package/dist/src/session-title.js +0 -2
- package/dist/src/sessions.d.ts +2 -120
- package/dist/src/sessions.js +9 -178
- package/dist/src/shell.d.ts +3 -20
- package/dist/src/shell.js +8 -72
- package/dist/src/side-panel.d.ts +5 -99
- package/dist/src/side-panel.js +76 -133
- package/dist/src/sign-in-detection.d.ts +43 -0
- package/dist/src/sign-in-detection.js +154 -0
- package/dist/src/sign-in-offer.d.ts +17 -0
- package/dist/src/sign-in-offer.js +103 -0
- package/dist/src/skill-commands.d.ts +0 -1
- package/dist/src/skill-commands.js +1 -4
- package/dist/src/skills/bundled/control-browser/SKILL.md +1 -1
- package/dist/src/skills/bundled/graph-manager/SKILL.md +22 -4
- package/dist/src/skills/bundled/provenance.json +2 -2
- package/dist/src/skills/invocable-skills.d.ts +0 -18
- package/dist/src/skills/invocable-skills.js +0 -17
- package/dist/src/skills/project-skills.d.ts +0 -1
- package/dist/src/skills/project-skills.js +0 -3
- package/dist/src/skills/prompt-skills.js +0 -14
- package/dist/src/skills/runtime-skills.d.ts +1 -8
- package/dist/src/skills/runtime-skills.js +8 -32
- package/dist/src/stall-recovery.d.ts +0 -25
- package/dist/src/stall-recovery.js +0 -38
- package/dist/src/stray-files.d.ts +5 -0
- package/dist/src/stray-files.js +65 -0
- package/dist/src/structured-step.d.ts +0 -22
- package/dist/src/structured-step.js +0 -22
- package/dist/src/subagent-run.d.ts +0 -163
- package/dist/src/subagent-run.js +10 -374
- package/dist/src/subagent-tree.d.ts +32 -0
- package/dist/src/subagent-tree.js +128 -0
- package/dist/src/telemetry/aggregate.d.ts +0 -37
- package/dist/src/telemetry/aggregate.js +0 -40
- package/dist/src/telemetry/capture-core.d.ts +0 -87
- package/dist/src/telemetry/capture-core.js +0 -67
- package/dist/src/telemetry/capture.d.ts +0 -1
- package/dist/src/telemetry/capture.js +0 -3
- package/dist/src/telemetry/classify.d.ts +0 -58
- package/dist/src/telemetry/classify.js +0 -60
- package/dist/src/telemetry/decision-capture.d.ts +0 -1
- package/dist/src/telemetry/emitter.d.ts +0 -30
- package/dist/src/telemetry/emitter.js +1 -62
- package/dist/src/telemetry/gate.d.ts +0 -29
- package/dist/src/telemetry/gate.js +0 -22
- package/dist/src/telemetry/identity.d.ts +0 -13
- package/dist/src/telemetry/identity.js +0 -29
- package/dist/src/telemetry/outbox.d.ts +0 -64
- package/dist/src/telemetry/outbox.js +1 -108
- package/dist/src/telemetry/schema.d.ts +1 -49
- package/dist/src/telemetry/schema.js +1 -82
- package/dist/src/telemetry/state.d.ts +0 -53
- package/dist/src/telemetry/state.js +0 -64
- package/dist/src/telemetry/surface.d.ts +0 -31
- package/dist/src/telemetry/surface.js +1 -39
- package/dist/src/telemetry/uploader.d.ts +0 -11
- package/dist/src/telemetry/uploader.js +0 -46
- package/dist/src/telemetry/uploads.d.ts +0 -11
- package/dist/src/telemetry/uploads.js +0 -11
- package/dist/src/telemetry/version.d.ts +0 -4
- package/dist/src/telemetry/version.js +0 -14
- package/dist/src/telemetry/workspace.d.ts +0 -7
- package/dist/src/telemetry/workspace.js +1 -22
- package/dist/src/terminal-ui.d.ts +15 -524
- package/dist/src/terminal-ui.js +80 -876
- package/dist/src/test-edit-guard.d.ts +74 -0
- package/dist/src/test-edit-guard.js +269 -0
- package/dist/src/text.d.ts +0 -1
- package/dist/src/text.js +0 -1
- package/dist/src/time-limit.d.ts +0 -36
- package/dist/src/time-limit.js +0 -37
- package/dist/src/timers.d.ts +0 -161
- package/dist/src/timers.js +0 -126
- package/dist/src/todos.d.ts +0 -1
- package/dist/src/todos.js +0 -3
- package/dist/src/token-rate.d.ts +0 -94
- package/dist/src/token-rate.js +0 -154
- package/dist/src/tool-activity.d.ts +0 -6
- package/dist/src/tool-activity.js +1 -8
- package/dist/src/tool-availability.d.ts +0 -13
- package/dist/src/tool-availability.js +1 -14
- package/dist/src/tool-call-clock.d.ts +1 -4
- package/dist/src/tool-call-clock.js +0 -13
- package/dist/src/tool-catalog.d.ts +0 -11
- package/dist/src/tool-catalog.js +0 -23
- package/dist/src/tool-dependencies.d.ts +0 -5
- package/dist/src/tool-dependencies.js +0 -4
- package/dist/src/tool-diff-stats.d.ts +0 -23
- package/dist/src/tool-diff-stats.js +0 -49
- package/dist/src/tool-errors.d.ts +9 -7
- package/dist/src/tool-errors.js +13 -6
- package/dist/src/tool-failure-tracker.d.ts +3 -11
- package/dist/src/tool-failure-tracker.js +19 -27
- package/dist/src/tool-names.d.ts +0 -16
- package/dist/src/tool-names.js +0 -12
- package/dist/src/tool-profile.d.ts +6 -0
- package/dist/src/tool-profile.js +23 -0
- package/dist/src/tool-result-filter.d.ts +0 -19
- package/dist/src/tool-result-filter.js +1 -66
- package/dist/src/tool-schema-compatibility.d.ts +1 -2
- package/dist/src/tool-schema-compatibility.js +2 -7
- package/dist/src/tools.d.ts +0 -4
- package/dist/src/tools.js +11 -114
- package/dist/src/trajectory.d.ts +0 -13
- package/dist/src/trajectory.js +23 -79
- package/dist/src/transcript.d.ts +1 -37
- package/dist/src/transcript.js +11 -61
- package/dist/src/types.d.ts +2 -167
- package/dist/src/untracked-file-removal.d.ts +3 -0
- package/dist/src/untracked-file-removal.js +105 -0
- package/dist/src/update-check.d.ts +0 -14
- package/dist/src/update-check.js +2 -16
- package/dist/src/update.d.ts +4 -29
- package/dist/src/update.js +20 -98
- package/dist/src/usage-analytics.d.ts +17 -17
- package/dist/src/usage-analytics.js +168 -209
- package/dist/src/web-search.d.ts +0 -23
- package/dist/src/web-search.js +1 -27
- package/dist/src/widgets.d.ts +0 -25
- package/dist/src/widgets.js +0 -24
- package/dist/src/workspace-facts.d.ts +0 -12
- package/dist/src/workspace-facts.js +1 -18
- package/dist/src/workspace-git-metadata.d.ts +4 -5
- package/dist/src/workspace-git-metadata.js +37 -9
- package/dist/src/workspace-instructions.d.ts +3 -15
- package/dist/src/workspace-instructions.js +7 -20
- package/package.json +2 -2
package/dist/src/config.js
CHANGED
|
@@ -9,9 +9,35 @@ import { GROK_BASE_URL } from './grok-provider.js';
|
|
|
9
9
|
import { OPENCODE_BASE_URL } from './opencode-cli-provider.js';
|
|
10
10
|
import { validateAnalyticsConfig } from './analytics.js';
|
|
11
11
|
import { isPermissionMode } from './permissions.js';
|
|
12
|
+
import { TOOL_PROFILES, isToolProfile } from './tool-profile.js';
|
|
12
13
|
import { LIMIT_KEYS } from './limits.js';
|
|
13
14
|
import { acquireSaveLock, SaveLockBusyError } from './save-lock.js';
|
|
14
15
|
import { PROVIDER_KEYS_IN_KEYRING, providerKeysBelongInKeyring, readProviderKeys, removeProviderKeys, restoreProviderKeys, storeProviderKeys } from './provider-keys.js';
|
|
16
|
+
export function validSkillId(value) {
|
|
17
|
+
if (typeof value !== 'string')
|
|
18
|
+
return false;
|
|
19
|
+
const [group, ...paths] = value.split(':');
|
|
20
|
+
if (!/^[\w-]+$/.test(group))
|
|
21
|
+
return false;
|
|
22
|
+
if (!paths.length)
|
|
23
|
+
return true;
|
|
24
|
+
return paths.length === 1 && paths[0].length <= 1000 && (paths[0] === '.' || !!paths[0] && paths[0].split('/').every(part => !!part && part !== '.' && part !== '..' && !/[\\:\0]/.test(part)));
|
|
25
|
+
}
|
|
26
|
+
export function validMcpServerId(value) {
|
|
27
|
+
return typeof value === 'string' && /^[\w-]+$/.test(value) && !['__proto__', 'constructor', 'prototype'].includes(value);
|
|
28
|
+
}
|
|
29
|
+
export function isProjectExtensionOverride(entry) {
|
|
30
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry))
|
|
31
|
+
return false;
|
|
32
|
+
const override = entry;
|
|
33
|
+
if (typeof override.override !== 'boolean')
|
|
34
|
+
return false;
|
|
35
|
+
if (override.disabledSkills !== undefined && (!Array.isArray(override.disabledSkills) || override.disabledSkills.some(id => !validSkillId(id))))
|
|
36
|
+
return false;
|
|
37
|
+
if (override.disabledMcpServers !== undefined && (!Array.isArray(override.disabledMcpServers) || override.disabledMcpServers.some(id => !validMcpServerId(id))))
|
|
38
|
+
return false;
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
15
41
|
export const MAX_CAPSOLVER_API_KEY_LENGTH = 256;
|
|
16
42
|
export function validateBrowserConfig(value) {
|
|
17
43
|
const c = value;
|
|
@@ -24,16 +50,13 @@ export function validateBrowserConfig(value) {
|
|
|
24
50
|
}
|
|
25
51
|
return c;
|
|
26
52
|
}
|
|
27
|
-
/** The search services the web_search tool can query, in the order "automatic" tries them. */
|
|
28
53
|
export const WEB_SEARCH_PROVIDERS = ['brave', 'tavily', 'exa', 'serper', 'google', 'searxng'];
|
|
29
|
-
/** The configuration field that holds each keyed service's API key. SearXNG takes a URL instead. */
|
|
30
54
|
export const WEB_SEARCH_KEY_FIELDS = {
|
|
31
55
|
brave: 'braveApiKey', tavily: 'tavilyApiKey', exa: 'exaApiKey', serper: 'serperApiKey', google: 'googleApiKey',
|
|
32
56
|
};
|
|
33
57
|
export const WEB_SEARCH_FIELDS = [...Object.values(WEB_SEARCH_KEY_FIELDS), 'defaultProvider', 'googleSearchEngineId', 'searxngUrl'];
|
|
34
58
|
export const MAX_WEB_SEARCH_API_KEY_LENGTH = 256;
|
|
35
59
|
export const MAX_WEB_SEARCH_URL_LENGTH = 2048;
|
|
36
|
-
/** A SearXNG base URL: HTTP(S), no credentials, query or fragment. Returns the normalized URL or an error message. */
|
|
37
60
|
export function checkSearxngUrl(value) {
|
|
38
61
|
let url;
|
|
39
62
|
try {
|
|
@@ -79,7 +102,6 @@ export function validateWebSearchConfig(value) {
|
|
|
79
102
|
}
|
|
80
103
|
return c;
|
|
81
104
|
}
|
|
82
|
-
/** The longest override the setting accepts: the same bound the workspace guide is clipped to. */
|
|
83
105
|
export const MAX_SYSTEM_PROMPT_OVERRIDE = 16_000;
|
|
84
106
|
export const AUTO_ARCHIVE_MIN_DAYS = 1;
|
|
85
107
|
export const AUTO_ARCHIVE_MAX_DAYS = 30;
|
|
@@ -128,6 +150,10 @@ export function validateConfig(value) {
|
|
|
128
150
|
throw new Error('jevEnabled must be a boolean');
|
|
129
151
|
if (c.commandMemory !== undefined && typeof c.commandMemory !== 'boolean')
|
|
130
152
|
throw new Error('commandMemory must be a boolean');
|
|
153
|
+
if (c.projectMemory !== undefined && typeof c.projectMemory !== 'boolean')
|
|
154
|
+
throw new Error('projectMemory must be a boolean');
|
|
155
|
+
if (c.toolProfile !== undefined && !isToolProfile(c.toolProfile))
|
|
156
|
+
throw new Error(`toolProfile must be one of: ${TOOL_PROFILES.join(', ')}`);
|
|
131
157
|
if (c.systemPromptOverride !== undefined && (typeof c.systemPromptOverride !== 'string' || !c.systemPromptOverride.trim() || c.systemPromptOverride.length > MAX_SYSTEM_PROMPT_OVERRIDE)) {
|
|
132
158
|
throw new Error(`systemPromptOverride must be nonempty text of up to ${MAX_SYSTEM_PROMPT_OVERRIDE} characters`);
|
|
133
159
|
}
|
|
@@ -143,16 +169,6 @@ export function validateConfig(value) {
|
|
|
143
169
|
if (c.extensions !== undefined) {
|
|
144
170
|
if (!c.extensions || typeof c.extensions !== 'object' || Array.isArray(c.extensions))
|
|
145
171
|
throw new Error('Invalid extensions configuration');
|
|
146
|
-
const validSkillId = (id) => {
|
|
147
|
-
if (typeof id !== 'string')
|
|
148
|
-
return false;
|
|
149
|
-
const [group, ...paths] = id.split(':');
|
|
150
|
-
if (!/^[\w-]+$/.test(group))
|
|
151
|
-
return false;
|
|
152
|
-
if (!paths.length)
|
|
153
|
-
return true;
|
|
154
|
-
return paths.length === 1 && paths[0].length <= 1000 && (paths[0] === '.' || !!paths[0] && paths[0].split('/').every(part => !!part && part !== '.' && part !== '..' && !/[\\:\0]/.test(part)));
|
|
155
|
-
};
|
|
156
172
|
for (const [entries, valid] of [[c.extensions.disabledSkills, validSkillId], [c.extensions.disabledPlugins, (id) => typeof id === 'string' && /^[\w-]+$/.test(id)]]) {
|
|
157
173
|
if (entries !== undefined && (!Array.isArray(entries) || entries.some(id => !valid(id))))
|
|
158
174
|
throw new Error('Invalid disabled extension ids');
|
|
@@ -162,19 +178,19 @@ export function validateConfig(value) {
|
|
|
162
178
|
if (!c.mcpServers || typeof c.mcpServers !== 'object' || Array.isArray(c.mcpServers))
|
|
163
179
|
throw new Error('Invalid MCP configuration');
|
|
164
180
|
for (const [id, server] of Object.entries(c.mcpServers)) {
|
|
165
|
-
if (
|
|
181
|
+
if (!validMcpServerId(id))
|
|
166
182
|
throw new Error('Invalid MCP server id');
|
|
167
183
|
validateMcpServer(server);
|
|
168
184
|
}
|
|
169
185
|
}
|
|
186
|
+
if (c.projectExtensions !== undefined && (!c.projectExtensions || typeof c.projectExtensions !== 'object' || Array.isArray(c.projectExtensions)
|
|
187
|
+
|| Object.entries(c.projectExtensions).some(([key, entry]) => !/^[a-f0-9]{64}$/.test(key) || !isProjectExtensionOverride(entry)))) {
|
|
188
|
+
throw new Error('Invalid projectExtensions configuration');
|
|
189
|
+
}
|
|
170
190
|
if (c.remote !== undefined)
|
|
171
191
|
validateRemoteConfig(c.remote);
|
|
172
192
|
if (c.projects !== undefined)
|
|
173
193
|
validateProjectsConfig(c.projects);
|
|
174
|
-
// The subagent pair names a provider by id, so a stored selection that outlived the provider
|
|
175
|
-
// it pointed at must fail at load instead of at the first external run. The check comes before
|
|
176
|
-
// the empty-provider return: a configuration with no providers holds no pair either, and a pair
|
|
177
|
-
// that names one of them is not a selection anyone can run.
|
|
178
194
|
if (c.externalSubagent !== undefined && !c.providers.some(p => p?.id === c.externalSubagent.provider)) {
|
|
179
195
|
throw new Error('externalSubagent.provider is not a configured provider');
|
|
180
196
|
}
|
|
@@ -194,8 +210,6 @@ export function validateConfig(value) {
|
|
|
194
210
|
if (p.contextWindow !== undefined && (!Number.isSafeInteger(p.contextWindow) || p.contextWindow <= 0)) {
|
|
195
211
|
throw new Error('Provider contextWindow must be a positive integer');
|
|
196
212
|
}
|
|
197
|
-
// The display name is what lists, pickers, and usage rows read; the id stays the immutable
|
|
198
|
-
// identity the journals record. A name must be text a row can render, never blank or padding.
|
|
199
213
|
if (p.name !== undefined && (typeof p.name !== 'string' || !p.name.trim() || p.name.length > MAX_PROVIDER_NAME_LENGTH)) {
|
|
200
214
|
throw new Error(`Provider name must be nonempty text of up to ${MAX_PROVIDER_NAME_LENGTH} characters`);
|
|
201
215
|
}
|
|
@@ -228,8 +242,6 @@ export function validateConfig(value) {
|
|
|
228
242
|
if (p.type === 'codex' && (p.baseUrl !== 'https://chatgpt.com/backend-api/codex' || p.apiKeyEnv !== undefined)) {
|
|
229
243
|
throw new Error('Codex providers use the official ChatGPT endpoint and Codex sign-in; API key overrides are not supported');
|
|
230
244
|
}
|
|
231
|
-
// A slot key names a directory under the configuration home, so it is held to the same shape as
|
|
232
|
-
// a provider id; the email is display data recorded at sign-in, bounded and single-addressed.
|
|
233
245
|
if (p.codexAccount !== undefined && (p.type !== 'codex' || typeof p.codexAccount !== 'string'
|
|
234
246
|
|| !/^[\w-]+$/.test(p.codexAccount) || p.codexAccount.length > MAX_CODEX_ACCOUNT_KEY_LENGTH)) {
|
|
235
247
|
throw new Error(`codexAccount is a Codex-only account slot key of up to ${MAX_CODEX_ACCOUNT_KEY_LENGTH} word characters and dashes`);
|
|
@@ -237,7 +249,6 @@ export function validateConfig(value) {
|
|
|
237
249
|
if (p.codexEmail !== undefined && (p.type !== 'codex' || typeof p.codexEmail !== 'string' || p.codexEmail.length > 320 || !/^[^@\s]+@[^@\s]+$/.test(p.codexEmail))) {
|
|
238
250
|
throw new Error('codexEmail is a Codex-only account email address');
|
|
239
251
|
}
|
|
240
|
-
// The Console token is issued for the first-party API only; a gateway would receive it instead.
|
|
241
252
|
if (p.anthropicAuth === 'console' && p.baseUrl !== 'https://api.anthropic.com/v1') {
|
|
242
253
|
throw new Error('Claude Console sign-in uses https://api.anthropic.com/v1; custom endpoints are not supported');
|
|
243
254
|
}
|
|
@@ -253,7 +264,6 @@ export function validateConfig(value) {
|
|
|
253
264
|
if (p.type === 'opencode' && p.baseUrl !== OPENCODE_BASE_URL) {
|
|
254
265
|
throw new Error('OpenCode providers use the installed OpenCode CLI; custom endpoints are not supported');
|
|
255
266
|
}
|
|
256
|
-
// OpenCode names each model by the provider that serves it, as `provider/model`.
|
|
257
267
|
if (p.type === 'opencode' && [p.model, ...(p.models ?? [])].some(model => !/^[^/\s]+\/\S/.test(model))) {
|
|
258
268
|
throw new Error('OpenCode models are named provider/model, for example opencode/big-pickle');
|
|
259
269
|
}
|
|
@@ -266,9 +276,6 @@ export function validateConfig(value) {
|
|
|
266
276
|
}
|
|
267
277
|
ids.add(p.id);
|
|
268
278
|
}
|
|
269
|
-
// Slot keys name directories, and the filesystems this ships on treat `Codex-Work` and `codex-work`
|
|
270
|
-
// as one: bindings that differ only by case would silently share a session, and deleting either
|
|
271
|
-
// would delete the other's credentials too. The same key twice is a shared account by choice.
|
|
272
279
|
const slots = new Map();
|
|
273
280
|
for (const p of c.providers) {
|
|
274
281
|
if (p.codexAccount === undefined)
|
|
@@ -280,8 +287,6 @@ export function validateConfig(value) {
|
|
|
280
287
|
}
|
|
281
288
|
slots.set(folded, p.codexAccount);
|
|
282
289
|
}
|
|
283
|
-
// A signed-in Anthropic provider keeps its login in a directory named by its id, so ids that differ
|
|
284
|
-
// only by case would share one login on Windows and macOS, and signing either out would sign out both.
|
|
285
290
|
const accounts = new Map();
|
|
286
291
|
for (const p of c.providers) {
|
|
287
292
|
if (p.anthropicAuth !== 'console')
|
|
@@ -294,8 +299,6 @@ export function validateConfig(value) {
|
|
|
294
299
|
}
|
|
295
300
|
if (!ids.has(c.provider))
|
|
296
301
|
throw new Error('Selected provider is not configured');
|
|
297
|
-
// The subagent pair names a provider by id, so a stored selection that outlived the provider
|
|
298
|
-
// it pointed at must fail at load instead of at the first external run.
|
|
299
302
|
if (c.externalSubagent !== undefined) {
|
|
300
303
|
const provider = c.providers.find(p => p.id === c.externalSubagent.provider);
|
|
301
304
|
if (!provider)
|
|
@@ -306,14 +309,6 @@ export function validateConfig(value) {
|
|
|
306
309
|
}
|
|
307
310
|
return c;
|
|
308
311
|
}
|
|
309
|
-
/**
|
|
310
|
-
* The saved external-subagent pair follows the providers it names.
|
|
311
|
-
*
|
|
312
|
-
* A provider that is removed, or a model that is no longer on its list, leaves the pair naming a
|
|
313
|
-
* model that does not exist, and the configuration would be refused for a setting the reader
|
|
314
|
-
* never touched. The pair is dropped instead, and the next external run asks its caller for a
|
|
315
|
-
* pick.
|
|
316
|
-
*/
|
|
317
312
|
export function reconcileSubagentPair(config) {
|
|
318
313
|
const saved = config.externalSubagent;
|
|
319
314
|
if (!saved)
|
|
@@ -343,14 +338,6 @@ export function validateMcpServer(value) {
|
|
|
343
338
|
throw new Error('MCP transport must be stdio or http');
|
|
344
339
|
return c;
|
|
345
340
|
}
|
|
346
|
-
/**
|
|
347
|
-
* Validate the installation's run bounds.
|
|
348
|
-
*
|
|
349
|
-
* A deadline-shaped bound accepts `0` as the explicit spelling of unlimited; every other
|
|
350
|
-
* value must be a positive safe integer, and a bound the runtime would reject must fail here
|
|
351
|
-
* instead of at the first run.
|
|
352
|
-
* @param limits - the configured limits block.
|
|
353
|
-
*/
|
|
354
341
|
export function validateLimitsConfig(limits) {
|
|
355
342
|
const l = limits;
|
|
356
343
|
if (!l || typeof l !== 'object' || Array.isArray(l))
|
|
@@ -363,9 +350,6 @@ export function validateLimitsConfig(limits) {
|
|
|
363
350
|
continue;
|
|
364
351
|
if (!Number.isSafeInteger(value))
|
|
365
352
|
throw new Error(`limits.${key} must be an integer`);
|
|
366
|
-
// Zero is only an unlimited alias for a deadline-shaped bound. For these two it is a real
|
|
367
|
-
// ceiling — refuse every tool call, or every completion repair — which both executors and
|
|
368
|
-
// graph validation already accept, so installation config must accept it too.
|
|
369
353
|
if (key === 'maxToolCalls' || key === 'maxCompletionRepairs') {
|
|
370
354
|
if (value < 0)
|
|
371
355
|
throw new Error(`limits.${key} must be zero or greater`);
|
|
@@ -377,14 +361,6 @@ export function validateLimitsConfig(limits) {
|
|
|
377
361
|
throw new Error(`limits.${key} must be a positive integer, or 0 for unlimited`);
|
|
378
362
|
}
|
|
379
363
|
}
|
|
380
|
-
/**
|
|
381
|
-
* Read the configured run bounds as effective limits.
|
|
382
|
-
*
|
|
383
|
-
* Normalizes the explicit `0` spelling to an absent key, so the runtime only ever has to
|
|
384
|
-
* answer one question: is a bound set, or is the run unlimited?
|
|
385
|
-
* @param config - the loaded configuration.
|
|
386
|
-
* @returns partial limits ready to hand a run, empty when nothing is configured.
|
|
387
|
-
*/
|
|
388
364
|
export function resolveConfiguredLimits(config) {
|
|
389
365
|
if (config.limits === undefined)
|
|
390
366
|
return {};
|
|
@@ -400,10 +376,6 @@ export function resolveConfiguredLimits(config) {
|
|
|
400
376
|
}
|
|
401
377
|
return resolved;
|
|
402
378
|
}
|
|
403
|
-
/**
|
|
404
|
-
* Graphiti was the only persistent-memory provider and no longer ships with the engine. A
|
|
405
|
-
* config.json or environment that still names it loads normally, with memory off and one notice.
|
|
406
|
-
*/
|
|
407
379
|
export const REMOVED_GRAPHITI_NOTICE = 'Graphiti support was removed; its settings are ignored';
|
|
408
380
|
export function validateMemoryConfig(memory) {
|
|
409
381
|
const m = memory;
|
|
@@ -411,7 +383,6 @@ export function validateMemoryConfig(memory) {
|
|
|
411
383
|
throw new Error('Invalid memory configuration');
|
|
412
384
|
if (m.enabled !== undefined && typeof m.enabled !== 'boolean')
|
|
413
385
|
throw new Error('memory.enabled must be a boolean');
|
|
414
|
-
// 'graphiti' is accepted so an existing config.json still loads; resolveMemoryConfig drops it.
|
|
415
386
|
if (m.provider !== undefined && !['none', 'graphiti'].includes(m.provider))
|
|
416
387
|
throw new Error('memory.provider must be none');
|
|
417
388
|
if (m.automaticRetrieval !== undefined && typeof m.automaticRetrieval !== 'boolean')
|
|
@@ -432,11 +403,6 @@ export function validateMemoryConfig(memory) {
|
|
|
432
403
|
}
|
|
433
404
|
}
|
|
434
405
|
}
|
|
435
|
-
/**
|
|
436
|
-
* Environment overrides win over config.json; nothing is persisted back. Settings left over from
|
|
437
|
-
* the removed Graphiti provider (memory.provider "graphiti", memory.graphiti,
|
|
438
|
-
* ANDORRA_MEMORY_PROVIDER=graphiti, ANDORRA_GRAPHITI_URL) are dropped and reported through `warn`.
|
|
439
|
-
*/
|
|
440
406
|
export function resolveMemoryConfig(config, env = process.env, warn) {
|
|
441
407
|
const memory = { ...(config.memory ?? {}) };
|
|
442
408
|
let removedGraphiti = memory.provider === 'graphiti' || memory.graphiti !== undefined;
|
|
@@ -459,7 +425,6 @@ export function resolveMemoryConfig(config, env = process.env, warn) {
|
|
|
459
425
|
validateMemoryConfig(memory);
|
|
460
426
|
return memory;
|
|
461
427
|
}
|
|
462
|
-
/** Whether stored configuration text says its provider keys are in the OS credential store. */
|
|
463
428
|
function keysInKeyring(text) {
|
|
464
429
|
try {
|
|
465
430
|
return JSON.parse(text)?.providerKeys === PROVIDER_KEYS_IN_KEYRING;
|
|
@@ -468,11 +433,6 @@ function keysInKeyring(text) {
|
|
|
468
433
|
return false;
|
|
469
434
|
}
|
|
470
435
|
}
|
|
471
|
-
/**
|
|
472
|
-
* Provider ids whose saved keys a save removed from the configuration but could not yet delete from
|
|
473
|
-
* the OS credential store. The file names them until a later save deletes them, because once the
|
|
474
|
-
* file stops naming a provider nothing else could find its key.
|
|
475
|
-
*/
|
|
476
436
|
const PENDING_DELETION = 'providerKeysPendingDeletion';
|
|
477
437
|
function pendingDeletions(value) {
|
|
478
438
|
return Array.isArray(value) && value.every(id => typeof id === 'string') ? value : undefined;
|
|
@@ -487,13 +447,11 @@ function storedPendingDeletions(text) {
|
|
|
487
447
|
return [];
|
|
488
448
|
}
|
|
489
449
|
}
|
|
490
|
-
/** Write configuration text and publish it with one rename. */
|
|
491
450
|
async function publishConfig(directory, text) {
|
|
492
451
|
const temporary = join(directory, `config-${randomUUID()}.tmp`);
|
|
493
452
|
await writeFile(temporary, text, { mode: 0o600 });
|
|
494
453
|
await rename(temporary, join(directory, 'config.json'));
|
|
495
454
|
}
|
|
496
|
-
/** The provider ids stored configuration text names, whatever else it holds. */
|
|
497
455
|
function storedProviderIds(text) {
|
|
498
456
|
try {
|
|
499
457
|
const providers = JSON.parse(text)?.providers;
|
|
@@ -503,7 +461,6 @@ function storedProviderIds(text) {
|
|
|
503
461
|
return [];
|
|
504
462
|
}
|
|
505
463
|
}
|
|
506
|
-
/** A provider entry as written to disk once its key is in the OS credential store. */
|
|
507
464
|
function withoutApiKey(provider) {
|
|
508
465
|
const copy = { ...provider };
|
|
509
466
|
delete copy.apiKey;
|
|
@@ -520,15 +477,12 @@ async function readStoredConfig(directory) {
|
|
|
520
477
|
throw error;
|
|
521
478
|
}
|
|
522
479
|
const raw = JSON.parse(text);
|
|
523
|
-
// The marker is an on-disk detail: it is checked and removed here, so no configuration in memory carries it.
|
|
524
480
|
const marker = raw && typeof raw === 'object' && !Array.isArray(raw) ? raw.providerKeys : undefined;
|
|
525
481
|
if (marker !== undefined) {
|
|
526
482
|
if (marker !== PROVIDER_KEYS_IN_KEYRING)
|
|
527
483
|
throw new Error('Invalid providerKeys configuration: the only value is "keyring"');
|
|
528
484
|
delete raw.providerKeys;
|
|
529
485
|
}
|
|
530
|
-
// Keys a save removed but could not yet delete: they are not read back, or the next save would
|
|
531
|
-
// take them for keys the user still has and cancel their deletion.
|
|
532
486
|
let pending = new Set();
|
|
533
487
|
if (raw && typeof raw === 'object' && !Array.isArray(raw) && raw[PENDING_DELETION] !== undefined) {
|
|
534
488
|
const ids = pendingDeletions(raw[PENDING_DELETION]);
|
|
@@ -543,31 +497,22 @@ async function readStoredConfig(directory) {
|
|
|
543
497
|
const keys = await readProviderKeys(directory, config.providers.filter(provider => provider.apiKey === undefined && !pending.has(provider.id)).map(provider => provider.id));
|
|
544
498
|
for (const provider of config.providers) {
|
|
545
499
|
const key = keys.get(provider.id);
|
|
546
|
-
// A key typed into the file by hand is newer than the saved one, and is moved on the next save.
|
|
547
500
|
if (key === undefined || provider.apiKey !== undefined)
|
|
548
501
|
continue;
|
|
549
|
-
// A provider edited by hand into a type that takes no key loads without it rather than failing.
|
|
550
502
|
try {
|
|
551
503
|
assertProviderCredentials({ ...provider, apiKey: key });
|
|
552
504
|
provider.apiKey = key;
|
|
553
505
|
}
|
|
554
|
-
catch {
|
|
506
|
+
catch { }
|
|
555
507
|
}
|
|
556
508
|
}
|
|
557
509
|
return { config, plaintextKeys };
|
|
558
510
|
}
|
|
559
|
-
/** Directories whose plaintext keys this process could not move, so a load does not retry on every call. */
|
|
560
511
|
const unmovedKeys = new Set();
|
|
561
|
-
/**
|
|
562
|
-
* The installation's configuration, with saved provider API keys read back from the OS credential
|
|
563
|
-
* store. A `config.json` that still holds keys in plaintext (written before keys moved to the
|
|
564
|
-
* store, or edited by hand) has them moved on this load; where that cannot happen, the keys stay in
|
|
565
|
-
* the file and the configuration loads exactly as before.
|
|
566
|
-
*/
|
|
567
512
|
export async function loadConfig(directory = configDirectory()) {
|
|
568
513
|
const stored = await readStoredConfig(directory);
|
|
569
514
|
const key = resolve(directory);
|
|
570
|
-
if (stored.plaintextKeys && providerKeysBelongInKeyring() && !unmovedKeys.has(key)) {
|
|
515
|
+
if (stored.plaintextKeys && providerKeysBelongInKeyring(directory) && !unmovedKeys.has(key)) {
|
|
571
516
|
try {
|
|
572
517
|
const moved = await withConfigLock(directory, async () => {
|
|
573
518
|
const current = await readStoredConfig(directory);
|
|
@@ -582,19 +527,6 @@ export async function loadConfig(directory = configDirectory()) {
|
|
|
582
527
|
}
|
|
583
528
|
return stored.config;
|
|
584
529
|
}
|
|
585
|
-
/**
|
|
586
|
-
* The anonymous-feedback preference this installation has saved right now.
|
|
587
|
-
*
|
|
588
|
-
* The setting belongs to the installation rather than to any one process: the desktop app and
|
|
589
|
-
* every CLI write the same file, so a process that started before the change holds a snapshot
|
|
590
|
-
* that no longer says what was saved. A reader that reports or changes the preference asks here
|
|
591
|
-
* for the file's own answer rather than for the snapshot it loaded at startup.
|
|
592
|
-
*
|
|
593
|
-
* Only the block is read, and it is validated on its own: a preference that cannot be stored is
|
|
594
|
-
* a file the user believes is doing something, and a reader must not answer from it.
|
|
595
|
-
* @param directory - the installation's configuration directory.
|
|
596
|
-
* @returns the saved block, or undefined when the file holds none.
|
|
597
|
-
*/
|
|
598
530
|
export async function loadSavedAnalytics(directory = configDirectory()) {
|
|
599
531
|
let stored;
|
|
600
532
|
try {
|
|
@@ -611,20 +543,6 @@ export async function loadSavedAnalytics(directory = configDirectory()) {
|
|
|
611
543
|
validateAnalyticsConfig(parsed.analytics);
|
|
612
544
|
return parsed.analytics;
|
|
613
545
|
}
|
|
614
|
-
/**
|
|
615
|
-
* Write the configuration and publish it with one rename; the caller owns the lock, or is the only writer.
|
|
616
|
-
*
|
|
617
|
-
* Provider API keys go to the OS credential store first and the file records only that they are
|
|
618
|
-
* there, so a reader that sees the new file finds the keys it names. A key this configuration no
|
|
619
|
-
* longer holds is deleted from the store only after the file that drops it is published, so a save
|
|
620
|
-
* that fails or is interrupted leaves the previous configuration's keys in place; a save whose
|
|
621
|
-
* publication fails also puts back the keys it had already overwritten. Until that deletion
|
|
622
|
-
* succeeds the published file lists the providers in `providerKeysPendingDeletion`, so a save
|
|
623
|
-
* that could not delete them (a locked store, an interrupted process) is finished by the next one.
|
|
624
|
-
* Where keys cannot go to the
|
|
625
|
-
* store (see `storeProviderKeys`), they are written into the file as before.
|
|
626
|
-
* @returns whether every key this configuration holds is in the OS credential store.
|
|
627
|
-
*/
|
|
628
546
|
async function writeConfig(config, directory) {
|
|
629
547
|
validateConfig(config);
|
|
630
548
|
await mkdir(directory, { recursive: true });
|
|
@@ -633,8 +551,6 @@ async function writeConfig(config, directory) {
|
|
|
633
551
|
const previouslyInKeyring = previousText !== undefined && keysInKeyring(previousText);
|
|
634
552
|
const keys = new Map(config.providers.flatMap(provider => provider.apiKey === undefined ? [] : [[provider.id, provider.apiKey]]));
|
|
635
553
|
const previousIds = previouslyInKeyring ? storedProviderIds(previousText) : [];
|
|
636
|
-
// What the store holds now, so unchanged keys are not rewritten and a failed save can be undone;
|
|
637
|
-
// undefined when it cannot be read, and then every key is written and nothing is put back.
|
|
638
554
|
const current = previouslyInKeyring
|
|
639
555
|
? await readProviderKeys(directory, [...new Set([...previousIds, ...keys.keys()])]).catch(() => undefined)
|
|
640
556
|
: new Map();
|
|
@@ -651,10 +567,8 @@ async function writeConfig(config, directory) {
|
|
|
651
567
|
written = [...keys].filter(([provider, key]) => current?.get(provider) !== key).map(([provider]) => provider);
|
|
652
568
|
}
|
|
653
569
|
else
|
|
654
|
-
inKeyring = false;
|
|
570
|
+
inKeyring = false;
|
|
655
571
|
}
|
|
656
|
-
// Deletions an earlier save could not finish are retried, except for a provider whose key this
|
|
657
|
-
// save has just stored again.
|
|
658
572
|
drop = [...new Set([...drop, ...pendingBefore])].filter(provider => !inKeyring || !keys.has(provider));
|
|
659
573
|
const settled = JSON.stringify(onDisk, null, 2) + '\n';
|
|
660
574
|
const text = drop.length ? JSON.stringify({ ...onDisk, [PENDING_DELETION]: drop }, null, 2) + '\n' : settled;
|
|
@@ -670,9 +584,6 @@ async function writeConfig(config, directory) {
|
|
|
670
584
|
}
|
|
671
585
|
if (!drop.length)
|
|
672
586
|
return inKeyring;
|
|
673
|
-
// A key the user removed must not outlive the save that removed it; one that only moved into the
|
|
674
|
-
// file is already safe there, so failing to drop the store's copy does not fail the save. Either
|
|
675
|
-
// way the file keeps naming it, and the next save tries again.
|
|
676
587
|
try {
|
|
677
588
|
await removeProviderKeys(directory, drop);
|
|
678
589
|
}
|
|
@@ -681,21 +592,11 @@ async function writeConfig(config, directory) {
|
|
|
681
592
|
throw error;
|
|
682
593
|
return inKeyring;
|
|
683
594
|
}
|
|
684
|
-
// Best-effort: a list left behind only makes the next save delete entries that are already gone.
|
|
685
595
|
await publishConfig(directory, settled).catch(() => { });
|
|
686
596
|
return inKeyring;
|
|
687
597
|
}
|
|
688
|
-
/** How long a write waits for another process's write before reporting the collision. */
|
|
689
598
|
const LOCK_ATTEMPTS = 6;
|
|
690
599
|
const LOCK_RETRY_MS = 50;
|
|
691
|
-
/**
|
|
692
|
-
* Run one configuration write under the installation's own lock.
|
|
693
|
-
*
|
|
694
|
-
* Every writer of this file — the CLI, the terminal UI, each desktop window's engine — takes the same
|
|
695
|
-
* lock, which is what makes a write indivisible against another process. Contention is ordinary rather
|
|
696
|
-
* than exceptional (two surfaces saving at the same moment), so a busy lock is waited on briefly and only
|
|
697
|
-
* then reported; the wait is bounded, and an owner that died holding it is recovered by the lock itself.
|
|
698
|
-
*/
|
|
699
600
|
async function withConfigLock(directory, run) {
|
|
700
601
|
for (let attempt = 0;; attempt++) {
|
|
701
602
|
try {
|
|
@@ -717,25 +618,15 @@ async function withConfigLock(directory, run) {
|
|
|
717
618
|
export async function saveConfig(config, directory = configDirectory()) {
|
|
718
619
|
await withConfigLock(directory, () => writeConfig(config, directory));
|
|
719
620
|
}
|
|
720
|
-
/** Raised when the stored configuration was replaced between a read and the write that followed it. */
|
|
721
621
|
export class ConfigConflictError extends Error {
|
|
722
622
|
constructor() { super('The configuration changed while this change was being applied. Try again.'); this.name = 'ConfigConflictError'; }
|
|
723
623
|
}
|
|
724
|
-
/**
|
|
725
|
-
* Change the configuration file under the installation's lock, re-applying the change if it was replaced.
|
|
726
|
-
*
|
|
727
|
-
* The lock serializes every writer that honours it; the comparison covers the writers that cannot — an
|
|
728
|
-
* older installation, or a person editing the file — by re-applying the change to the newer content when
|
|
729
|
-
* the stored text is not the one this change was computed from. `change` has to be a pure function of the
|
|
730
|
-
* configuration it is given, which is what makes re-applying it safe.
|
|
731
|
-
*/
|
|
732
624
|
export async function changeConfigFile(directory, change, attempts = 3) {
|
|
733
625
|
const stored = join(directory, 'config.json');
|
|
734
626
|
const read = async () => await readFile(stored, 'utf8').catch(() => undefined);
|
|
735
627
|
return await withConfigLock(directory, async () => {
|
|
736
628
|
for (let attempt = 0; attempt < attempts; attempt++) {
|
|
737
629
|
const before = await read();
|
|
738
|
-
// Read without moving plaintext keys: that move takes this same lock, and the write below makes it anyway.
|
|
739
630
|
const next = change((await readStoredConfig(directory)).config);
|
|
740
631
|
if (await read() !== before)
|
|
741
632
|
continue;
|
|
@@ -758,19 +649,16 @@ export function validateCodeIntelConfig(codeIntel) {
|
|
|
758
649
|
throw new Error('codeIntel.enabledRepos must be an array of repository id strings');
|
|
759
650
|
}
|
|
760
651
|
}
|
|
761
|
-
/** Code intelligence defaults to on; config.json can disable it globally or per repository. */
|
|
762
652
|
export function resolveCodeIntelConfig(config) {
|
|
763
|
-
const codeIntel = { enabled:
|
|
653
|
+
const codeIntel = { enabled: false, ...(config.codeIntel ?? {}) };
|
|
764
654
|
validateCodeIntelConfig(codeIntel);
|
|
765
655
|
return codeIntel;
|
|
766
656
|
}
|
|
767
|
-
/** Secrets the remote feature stores are all fixed-size random encodings; anything else is corruption. */
|
|
768
657
|
const BASE64URL_32 = /^[A-Za-z0-9_-]{43}$/;
|
|
769
658
|
const HEX_16 = /^[a-f0-9]{16}$/;
|
|
770
659
|
const HEX_32 = /^[a-f0-9]{32}$/;
|
|
771
660
|
const HEX_12 = /^[a-f0-9]{12}$/;
|
|
772
661
|
const ISO_DATE = /^\d{4}-\d{2}-\d{2}T/;
|
|
773
|
-
/** A user-visible name for a device, share, or workspace: printable, bounded, never multi-line. */
|
|
774
662
|
function isDisplayLabel(value) {
|
|
775
663
|
return typeof value === 'string' && value.length > 0 && value.length <= 64 && !/[\0\r\n]/.test(value);
|
|
776
664
|
}
|
|
@@ -780,16 +668,6 @@ function isIsoDate(value) {
|
|
|
780
668
|
function isPort(value) {
|
|
781
669
|
return Number.isSafeInteger(value) && value >= 1 && value <= 65535;
|
|
782
670
|
}
|
|
783
|
-
/**
|
|
784
|
-
* Validate the Remote Workspace section.
|
|
785
|
-
*
|
|
786
|
-
* Device tokens, invitation tokens, and workspace credentials are 256-bit random values; the id
|
|
787
|
-
* shapes are what the pairing transaction generates. Rejecting anything else here means a
|
|
788
|
-
* hand-edited or corrupted file fails loudly at load instead of being presented as a live device
|
|
789
|
-
* or a redeemable invitation. Absolute share paths are deliberately NOT validated against any
|
|
790
|
-
* allowlist — the host chose them — but they must be plain filesystem paths with no control
|
|
791
|
-
* characters, because the browse layer treats them as containment roots.
|
|
792
|
-
*/
|
|
793
671
|
export function validateRemoteConfig(remote) {
|
|
794
672
|
const r = remote;
|
|
795
673
|
if (!r || typeof r !== 'object' || Array.isArray(r))
|
|
@@ -850,9 +728,6 @@ export function validateRemoteConfig(remote) {
|
|
|
850
728
|
|| (workspace.host !== undefined && (typeof workspace.host !== 'string' || !workspace.host.trim() || workspace.host.length > 253 || /[\0\r\n /]/.test(workspace.host)))
|
|
851
729
|
|| !isPort(workspace.port) || (workspace.transport !== 'https' && workspace.transport !== 'http')
|
|
852
730
|
|| !BASE64URL_32.test(workspace.fingerprint)
|
|
853
|
-
// The certificate is the trust anchor only on https. An http workspace — paired under the
|
|
854
|
-
// explicit plaintext opt-in — stores no certificate at all (''), and requiring one here
|
|
855
|
-
// would fail its write after the host had already redeemed the single-use invitation.
|
|
856
731
|
|| (workspace.transport === 'https'
|
|
857
732
|
? (typeof workspace.certPem !== 'string' || !workspace.certPem.includes('BEGIN CERTIFICATE'))
|
|
858
733
|
: (workspace.certPem !== undefined && typeof workspace.certPem !== 'string'))
|
|
@@ -865,12 +740,6 @@ export function validateRemoteConfig(remote) {
|
|
|
865
740
|
}
|
|
866
741
|
}
|
|
867
742
|
}
|
|
868
|
-
/**
|
|
869
|
-
* Validate the project registry the rail and peers read.
|
|
870
|
-
*
|
|
871
|
-
* `path` is the realpath the registry stores (the entry key for idempotent adds), so it must be a
|
|
872
|
-
* plain absolute-ish filesystem path free of control characters; the name is a display label.
|
|
873
|
-
*/
|
|
874
743
|
export function validateProjectsConfig(projects) {
|
|
875
744
|
if (!Array.isArray(projects) || projects.length > 256)
|
|
876
745
|
throw new Error('projects must be an array of at most 256 entries');
|
|
@@ -879,7 +748,8 @@ export function validateProjectsConfig(projects) {
|
|
|
879
748
|
if (!project || typeof project !== 'object' || Array.isArray(project)
|
|
880
749
|
|| typeof project.path !== 'string' || !project.path.trim() || project.path.includes('\0') || seen.has(project.path)
|
|
881
750
|
|| !isIsoDate(project.addedAt)
|
|
882
|
-
|| (project.name !== undefined && (typeof project.name !== 'string' || !project.name.trim() || project.name.length > 100 || /[\0\r\n]/.test(project.name)))
|
|
751
|
+
|| (project.name !== undefined && (typeof project.name !== 'string' || !project.name.trim() || project.name.length > 100 || /[\0\r\n]/.test(project.name)))
|
|
752
|
+
|| (project.id !== undefined && (typeof project.id !== 'string' || !/^[a-f0-9]{16}$/.test(project.id))))
|
|
883
753
|
throw new Error('Invalid project registry entry');
|
|
884
754
|
seen.add(project.path);
|
|
885
755
|
}
|
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
import type { Message } from './types.js';
|
|
2
|
-
/** Text budget projection: bounded native image bytes are never text tokens. */
|
|
3
2
|
export declare function serializeContext(messages: Message[]): string;
|
|
4
3
|
export declare function pruneHistoricalImages(messages: Message[], keepToolTurns?: number): number;
|
|
5
4
|
export declare const IMAGE_INPUT_REJECTED_NOTE = "[Image omitted: this model endpoint rejected image input. Inspect the image with a script or command instead.]";
|
|
6
|
-
/**
|
|
7
|
-
* Remove every native image once the provider has refused a request that carried one. The text
|
|
8
|
-
* of each message stays, with a note saying why its picture is gone, so the model changes
|
|
9
|
-
* approach instead of asking for the same image again.
|
|
10
|
-
*/
|
|
11
5
|
export declare function dropRejectedImages(messages: Message[]): number;
|
|
12
|
-
/** Conservative fallback including opaque continuation state (never returned). */
|
|
13
6
|
export declare function estimateContextTokens(messages: Message[], toolChars: number): number;
|
|
14
7
|
export declare function contextThreshold(contextWindow: number, outputReserve: number): number;
|
|
15
|
-
/**
|
|
16
|
-
* Use measured input while the schemas and the committed prefix are unchanged.
|
|
17
|
-
*
|
|
18
|
-
* The caller may declare that the last `mutableTail` recorded messages are run snapshots (todo
|
|
19
|
-
* list, widget values, post-tool guidance) that are rewritten between turns. A later request
|
|
20
|
-
* that differs only in those messages still reuses the measurement: the recorded snapshots'
|
|
21
|
-
* estimate is swapped for the estimate of whatever now follows the shared prefix.
|
|
22
|
-
*/
|
|
23
8
|
export declare class ContextUsageAnchor {
|
|
24
9
|
private prefix;
|
|
25
10
|
private tail;
|
|
@@ -32,17 +17,10 @@ export declare class ContextUsageAnchor {
|
|
|
32
17
|
source: 'estimate' | 'provider_usage';
|
|
33
18
|
};
|
|
34
19
|
}
|
|
35
|
-
/** Pressure-only cleanup: preserve source reads, errors, guidance and call/result pairs. */
|
|
36
20
|
export declare function microcompactToolResults(messages: Message[], threshold: number, toolChars: number, inherited?: Set<Message>, pressureTokens?: number): {
|
|
37
21
|
observations: number;
|
|
38
22
|
removedChars: number;
|
|
39
23
|
};
|
|
40
|
-
/**
|
|
41
|
-
* The accounting fields a `decision.turn_bypassed` event carries: the input the skipped request
|
|
42
|
-
* would have sent, and the provider and model it would have gone to. The Usage dashboard counts
|
|
43
|
-
* them as the bypass's avoided input; an event without them falls back to the node's last measured
|
|
44
|
-
* input. An estimate that is missing or not a positive whole number is left out, never sent as zero.
|
|
45
|
-
*/
|
|
46
24
|
export declare function bypassAccounting(estimatedInputTokens: number | undefined, providerId: string | undefined, model: string | undefined): {
|
|
47
25
|
estimatedInputTokens?: number;
|
|
48
26
|
providerId?: string;
|