@andorra-labs/code 0.1.12 → 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/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 +49 -416
- 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 +9 -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 +13 -245
- 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 +27 -927
- package/dist/src/app-server.js +537 -2992
- 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 +1 -37
- package/dist/src/browser-panel-tool.js +3 -73
- package/dist/src/browser-runner.d.ts +0 -1
- package/dist/src/browser-runner.js +4 -45
- 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 +47 -301
- package/dist/src/browser-view.js +333 -582
- 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 +155 -63
- 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 +1 -55
- package/dist/src/cli.js +80 -721
- package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +4 -59
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +26 -99
- 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 +0 -28
- package/dist/src/codex-rpc.d.ts +0 -10
- package/dist/src/codex-rpc.js +0 -12
- package/dist/src/coding-tools.d.ts +4 -26
- package/dist/src/coding-tools.js +161 -181
- 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 +0 -98
- package/dist/src/completion.js +2 -239
- package/dist/src/config.d.ts +11 -116
- package/dist/src/config.js +39 -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 +0 -10
- 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 +4 -130
- package/dist/src/diff-preview.d.ts +0 -1
- package/dist/src/diff-preview.js +0 -17
- 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 +0 -9
- package/dist/src/extensions.d.ts +3 -2
- package/dist/src/extensions.js +63 -35
- 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 +0 -7
- package/dist/src/file-read-key.js +0 -7
- 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 +0 -3
- package/dist/src/graph-health.d.ts +0 -63
- package/dist/src/graph-health.js +0 -57
- package/dist/src/graph-manager-chat.d.ts +5 -155
- package/dist/src/graph-manager-chat.js +2 -177
- 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 +31 -391
- package/dist/src/graph-selection.d.ts +0 -14
- package/dist/src/graph-selection.js +0 -14
- package/dist/src/graph-server.d.ts +2 -10
- package/dist/src/graph-server.js +39 -101
- 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 +152 -491
- package/dist/src/graph-ui/compat.js +0 -7
- package/dist/src/graph-ui/controls.css +0 -48
- 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 +0 -8
- 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 +1 -78
- package/dist/src/graph-ui/manager.css +0 -18
- package/dist/src/graph-ui/manager.js +3 -180
- package/dist/src/graph-ui/model-picker.js +0 -29
- 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 +6 -157
- package/dist/src/graphs.js +65 -266
- 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 +0 -99
- package/dist/src/mcp.js +4 -170
- 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 +5 -40
- package/dist/src/memory/ProjectMemory.js +22 -47
- package/dist/src/memory/ToolFailureLessons.d.ts +0 -3
- package/dist/src/memory/ToolFailureLessons.js +0 -6
- 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 +1 -16
- package/dist/src/package-name.d.ts +0 -2
- package/dist/src/package-name.js +0 -2
- 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 +1 -96
- 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 +1 -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 +95 -415
- 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 +0 -18
- package/dist/src/remote/cert.js +0 -44
- package/dist/src/remote/client.d.ts +0 -70
- package/dist/src/remote/client.js +1 -116
- 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 +0 -4
- package/dist/src/remote/pem.js +0 -4
- 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 +14 -687
- package/dist/src/run-temp.d.ts +12 -0
- package/dist/src/run-temp.js +50 -0
- package/dist/src/runtime.d.ts +10 -228
- 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 -122
- package/dist/src/sessions.js +7 -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 +0 -39
- package/dist/src/sign-in-detection.js +0 -43
- package/dist/src/sign-in-offer.d.ts +1 -19
- package/dist/src/sign-in-offer.js +0 -13
- 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/provenance.json +1 -1
- 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 +0 -13
- package/dist/src/skills/runtime-skills.js +0 -37
- package/dist/src/stall-recovery.d.ts +0 -25
- package/dist/src/stall-recovery.js +0 -38
- package/dist/src/stray-files.d.ts +0 -9
- package/dist/src/stray-files.js +0 -16
- 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 +4 -373
- 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 +14 -523
- package/dist/src/terminal-ui.js +74 -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 +0 -7
- 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 +0 -6
- package/dist/src/tool-schema-compatibility.js +0 -9
- 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 +0 -41
- package/dist/src/transcript.js +2 -60
- package/dist/src/types.d.ts +1 -168
- package/dist/src/untracked-file-removal.js +0 -20
- package/dist/src/update-check.d.ts +0 -14
- package/dist/src/update-check.js +1 -15
- package/dist/src/update.d.ts +0 -35
- package/dist/src/update.js +0 -100
- 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 +0 -16
- package/dist/src/workspace-git-metadata.js +0 -21
- package/dist/src/workspace-instructions.d.ts +3 -15
- package/dist/src/workspace-instructions.js +6 -19
- 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;
|
|
@@ -130,6 +152,8 @@ export function validateConfig(value) {
|
|
|
130
152
|
throw new Error('commandMemory must be a boolean');
|
|
131
153
|
if (c.projectMemory !== undefined && typeof c.projectMemory !== 'boolean')
|
|
132
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(', ')}`);
|
|
133
157
|
if (c.systemPromptOverride !== undefined && (typeof c.systemPromptOverride !== 'string' || !c.systemPromptOverride.trim() || c.systemPromptOverride.length > MAX_SYSTEM_PROMPT_OVERRIDE)) {
|
|
134
158
|
throw new Error(`systemPromptOverride must be nonempty text of up to ${MAX_SYSTEM_PROMPT_OVERRIDE} characters`);
|
|
135
159
|
}
|
|
@@ -145,16 +169,6 @@ export function validateConfig(value) {
|
|
|
145
169
|
if (c.extensions !== undefined) {
|
|
146
170
|
if (!c.extensions || typeof c.extensions !== 'object' || Array.isArray(c.extensions))
|
|
147
171
|
throw new Error('Invalid extensions configuration');
|
|
148
|
-
const validSkillId = (id) => {
|
|
149
|
-
if (typeof id !== 'string')
|
|
150
|
-
return false;
|
|
151
|
-
const [group, ...paths] = id.split(':');
|
|
152
|
-
if (!/^[\w-]+$/.test(group))
|
|
153
|
-
return false;
|
|
154
|
-
if (!paths.length)
|
|
155
|
-
return true;
|
|
156
|
-
return paths.length === 1 && paths[0].length <= 1000 && (paths[0] === '.' || !!paths[0] && paths[0].split('/').every(part => !!part && part !== '.' && part !== '..' && !/[\\:\0]/.test(part)));
|
|
157
|
-
};
|
|
158
172
|
for (const [entries, valid] of [[c.extensions.disabledSkills, validSkillId], [c.extensions.disabledPlugins, (id) => typeof id === 'string' && /^[\w-]+$/.test(id)]]) {
|
|
159
173
|
if (entries !== undefined && (!Array.isArray(entries) || entries.some(id => !valid(id))))
|
|
160
174
|
throw new Error('Invalid disabled extension ids');
|
|
@@ -164,19 +178,19 @@ export function validateConfig(value) {
|
|
|
164
178
|
if (!c.mcpServers || typeof c.mcpServers !== 'object' || Array.isArray(c.mcpServers))
|
|
165
179
|
throw new Error('Invalid MCP configuration');
|
|
166
180
|
for (const [id, server] of Object.entries(c.mcpServers)) {
|
|
167
|
-
if (
|
|
181
|
+
if (!validMcpServerId(id))
|
|
168
182
|
throw new Error('Invalid MCP server id');
|
|
169
183
|
validateMcpServer(server);
|
|
170
184
|
}
|
|
171
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
|
+
}
|
|
172
190
|
if (c.remote !== undefined)
|
|
173
191
|
validateRemoteConfig(c.remote);
|
|
174
192
|
if (c.projects !== undefined)
|
|
175
193
|
validateProjectsConfig(c.projects);
|
|
176
|
-
// The subagent pair names a provider by id, so a stored selection that outlived the provider
|
|
177
|
-
// it pointed at must fail at load instead of at the first external run. The check comes before
|
|
178
|
-
// the empty-provider return: a configuration with no providers holds no pair either, and a pair
|
|
179
|
-
// that names one of them is not a selection anyone can run.
|
|
180
194
|
if (c.externalSubagent !== undefined && !c.providers.some(p => p?.id === c.externalSubagent.provider)) {
|
|
181
195
|
throw new Error('externalSubagent.provider is not a configured provider');
|
|
182
196
|
}
|
|
@@ -196,8 +210,6 @@ export function validateConfig(value) {
|
|
|
196
210
|
if (p.contextWindow !== undefined && (!Number.isSafeInteger(p.contextWindow) || p.contextWindow <= 0)) {
|
|
197
211
|
throw new Error('Provider contextWindow must be a positive integer');
|
|
198
212
|
}
|
|
199
|
-
// The display name is what lists, pickers, and usage rows read; the id stays the immutable
|
|
200
|
-
// identity the journals record. A name must be text a row can render, never blank or padding.
|
|
201
213
|
if (p.name !== undefined && (typeof p.name !== 'string' || !p.name.trim() || p.name.length > MAX_PROVIDER_NAME_LENGTH)) {
|
|
202
214
|
throw new Error(`Provider name must be nonempty text of up to ${MAX_PROVIDER_NAME_LENGTH} characters`);
|
|
203
215
|
}
|
|
@@ -230,8 +242,6 @@ export function validateConfig(value) {
|
|
|
230
242
|
if (p.type === 'codex' && (p.baseUrl !== 'https://chatgpt.com/backend-api/codex' || p.apiKeyEnv !== undefined)) {
|
|
231
243
|
throw new Error('Codex providers use the official ChatGPT endpoint and Codex sign-in; API key overrides are not supported');
|
|
232
244
|
}
|
|
233
|
-
// A slot key names a directory under the configuration home, so it is held to the same shape as
|
|
234
|
-
// a provider id; the email is display data recorded at sign-in, bounded and single-addressed.
|
|
235
245
|
if (p.codexAccount !== undefined && (p.type !== 'codex' || typeof p.codexAccount !== 'string'
|
|
236
246
|
|| !/^[\w-]+$/.test(p.codexAccount) || p.codexAccount.length > MAX_CODEX_ACCOUNT_KEY_LENGTH)) {
|
|
237
247
|
throw new Error(`codexAccount is a Codex-only account slot key of up to ${MAX_CODEX_ACCOUNT_KEY_LENGTH} word characters and dashes`);
|
|
@@ -239,7 +249,6 @@ export function validateConfig(value) {
|
|
|
239
249
|
if (p.codexEmail !== undefined && (p.type !== 'codex' || typeof p.codexEmail !== 'string' || p.codexEmail.length > 320 || !/^[^@\s]+@[^@\s]+$/.test(p.codexEmail))) {
|
|
240
250
|
throw new Error('codexEmail is a Codex-only account email address');
|
|
241
251
|
}
|
|
242
|
-
// The Console token is issued for the first-party API only; a gateway would receive it instead.
|
|
243
252
|
if (p.anthropicAuth === 'console' && p.baseUrl !== 'https://api.anthropic.com/v1') {
|
|
244
253
|
throw new Error('Claude Console sign-in uses https://api.anthropic.com/v1; custom endpoints are not supported');
|
|
245
254
|
}
|
|
@@ -255,7 +264,6 @@ export function validateConfig(value) {
|
|
|
255
264
|
if (p.type === 'opencode' && p.baseUrl !== OPENCODE_BASE_URL) {
|
|
256
265
|
throw new Error('OpenCode providers use the installed OpenCode CLI; custom endpoints are not supported');
|
|
257
266
|
}
|
|
258
|
-
// OpenCode names each model by the provider that serves it, as `provider/model`.
|
|
259
267
|
if (p.type === 'opencode' && [p.model, ...(p.models ?? [])].some(model => !/^[^/\s]+\/\S/.test(model))) {
|
|
260
268
|
throw new Error('OpenCode models are named provider/model, for example opencode/big-pickle');
|
|
261
269
|
}
|
|
@@ -268,9 +276,6 @@ export function validateConfig(value) {
|
|
|
268
276
|
}
|
|
269
277
|
ids.add(p.id);
|
|
270
278
|
}
|
|
271
|
-
// Slot keys name directories, and the filesystems this ships on treat `Codex-Work` and `codex-work`
|
|
272
|
-
// as one: bindings that differ only by case would silently share a session, and deleting either
|
|
273
|
-
// would delete the other's credentials too. The same key twice is a shared account by choice.
|
|
274
279
|
const slots = new Map();
|
|
275
280
|
for (const p of c.providers) {
|
|
276
281
|
if (p.codexAccount === undefined)
|
|
@@ -282,8 +287,6 @@ export function validateConfig(value) {
|
|
|
282
287
|
}
|
|
283
288
|
slots.set(folded, p.codexAccount);
|
|
284
289
|
}
|
|
285
|
-
// A signed-in Anthropic provider keeps its login in a directory named by its id, so ids that differ
|
|
286
|
-
// only by case would share one login on Windows and macOS, and signing either out would sign out both.
|
|
287
290
|
const accounts = new Map();
|
|
288
291
|
for (const p of c.providers) {
|
|
289
292
|
if (p.anthropicAuth !== 'console')
|
|
@@ -296,8 +299,6 @@ export function validateConfig(value) {
|
|
|
296
299
|
}
|
|
297
300
|
if (!ids.has(c.provider))
|
|
298
301
|
throw new Error('Selected provider is not configured');
|
|
299
|
-
// The subagent pair names a provider by id, so a stored selection that outlived the provider
|
|
300
|
-
// it pointed at must fail at load instead of at the first external run.
|
|
301
302
|
if (c.externalSubagent !== undefined) {
|
|
302
303
|
const provider = c.providers.find(p => p.id === c.externalSubagent.provider);
|
|
303
304
|
if (!provider)
|
|
@@ -308,14 +309,6 @@ export function validateConfig(value) {
|
|
|
308
309
|
}
|
|
309
310
|
return c;
|
|
310
311
|
}
|
|
311
|
-
/**
|
|
312
|
-
* The saved external-subagent pair follows the providers it names.
|
|
313
|
-
*
|
|
314
|
-
* A provider that is removed, or a model that is no longer on its list, leaves the pair naming a
|
|
315
|
-
* model that does not exist, and the configuration would be refused for a setting the reader
|
|
316
|
-
* never touched. The pair is dropped instead, and the next external run asks its caller for a
|
|
317
|
-
* pick.
|
|
318
|
-
*/
|
|
319
312
|
export function reconcileSubagentPair(config) {
|
|
320
313
|
const saved = config.externalSubagent;
|
|
321
314
|
if (!saved)
|
|
@@ -345,14 +338,6 @@ export function validateMcpServer(value) {
|
|
|
345
338
|
throw new Error('MCP transport must be stdio or http');
|
|
346
339
|
return c;
|
|
347
340
|
}
|
|
348
|
-
/**
|
|
349
|
-
* Validate the installation's run bounds.
|
|
350
|
-
*
|
|
351
|
-
* A deadline-shaped bound accepts `0` as the explicit spelling of unlimited; every other
|
|
352
|
-
* value must be a positive safe integer, and a bound the runtime would reject must fail here
|
|
353
|
-
* instead of at the first run.
|
|
354
|
-
* @param limits - the configured limits block.
|
|
355
|
-
*/
|
|
356
341
|
export function validateLimitsConfig(limits) {
|
|
357
342
|
const l = limits;
|
|
358
343
|
if (!l || typeof l !== 'object' || Array.isArray(l))
|
|
@@ -365,9 +350,6 @@ export function validateLimitsConfig(limits) {
|
|
|
365
350
|
continue;
|
|
366
351
|
if (!Number.isSafeInteger(value))
|
|
367
352
|
throw new Error(`limits.${key} must be an integer`);
|
|
368
|
-
// Zero is only an unlimited alias for a deadline-shaped bound. For these two it is a real
|
|
369
|
-
// ceiling — refuse every tool call, or every completion repair — which both executors and
|
|
370
|
-
// graph validation already accept, so installation config must accept it too.
|
|
371
353
|
if (key === 'maxToolCalls' || key === 'maxCompletionRepairs') {
|
|
372
354
|
if (value < 0)
|
|
373
355
|
throw new Error(`limits.${key} must be zero or greater`);
|
|
@@ -379,14 +361,6 @@ export function validateLimitsConfig(limits) {
|
|
|
379
361
|
throw new Error(`limits.${key} must be a positive integer, or 0 for unlimited`);
|
|
380
362
|
}
|
|
381
363
|
}
|
|
382
|
-
/**
|
|
383
|
-
* Read the configured run bounds as effective limits.
|
|
384
|
-
*
|
|
385
|
-
* Normalizes the explicit `0` spelling to an absent key, so the runtime only ever has to
|
|
386
|
-
* answer one question: is a bound set, or is the run unlimited?
|
|
387
|
-
* @param config - the loaded configuration.
|
|
388
|
-
* @returns partial limits ready to hand a run, empty when nothing is configured.
|
|
389
|
-
*/
|
|
390
364
|
export function resolveConfiguredLimits(config) {
|
|
391
365
|
if (config.limits === undefined)
|
|
392
366
|
return {};
|
|
@@ -402,10 +376,6 @@ export function resolveConfiguredLimits(config) {
|
|
|
402
376
|
}
|
|
403
377
|
return resolved;
|
|
404
378
|
}
|
|
405
|
-
/**
|
|
406
|
-
* Graphiti was the only persistent-memory provider and no longer ships with the engine. A
|
|
407
|
-
* config.json or environment that still names it loads normally, with memory off and one notice.
|
|
408
|
-
*/
|
|
409
379
|
export const REMOVED_GRAPHITI_NOTICE = 'Graphiti support was removed; its settings are ignored';
|
|
410
380
|
export function validateMemoryConfig(memory) {
|
|
411
381
|
const m = memory;
|
|
@@ -413,7 +383,6 @@ export function validateMemoryConfig(memory) {
|
|
|
413
383
|
throw new Error('Invalid memory configuration');
|
|
414
384
|
if (m.enabled !== undefined && typeof m.enabled !== 'boolean')
|
|
415
385
|
throw new Error('memory.enabled must be a boolean');
|
|
416
|
-
// 'graphiti' is accepted so an existing config.json still loads; resolveMemoryConfig drops it.
|
|
417
386
|
if (m.provider !== undefined && !['none', 'graphiti'].includes(m.provider))
|
|
418
387
|
throw new Error('memory.provider must be none');
|
|
419
388
|
if (m.automaticRetrieval !== undefined && typeof m.automaticRetrieval !== 'boolean')
|
|
@@ -434,11 +403,6 @@ export function validateMemoryConfig(memory) {
|
|
|
434
403
|
}
|
|
435
404
|
}
|
|
436
405
|
}
|
|
437
|
-
/**
|
|
438
|
-
* Environment overrides win over config.json; nothing is persisted back. Settings left over from
|
|
439
|
-
* the removed Graphiti provider (memory.provider "graphiti", memory.graphiti,
|
|
440
|
-
* ANDORRA_MEMORY_PROVIDER=graphiti, ANDORRA_GRAPHITI_URL) are dropped and reported through `warn`.
|
|
441
|
-
*/
|
|
442
406
|
export function resolveMemoryConfig(config, env = process.env, warn) {
|
|
443
407
|
const memory = { ...(config.memory ?? {}) };
|
|
444
408
|
let removedGraphiti = memory.provider === 'graphiti' || memory.graphiti !== undefined;
|
|
@@ -461,7 +425,6 @@ export function resolveMemoryConfig(config, env = process.env, warn) {
|
|
|
461
425
|
validateMemoryConfig(memory);
|
|
462
426
|
return memory;
|
|
463
427
|
}
|
|
464
|
-
/** Whether stored configuration text says its provider keys are in the OS credential store. */
|
|
465
428
|
function keysInKeyring(text) {
|
|
466
429
|
try {
|
|
467
430
|
return JSON.parse(text)?.providerKeys === PROVIDER_KEYS_IN_KEYRING;
|
|
@@ -470,11 +433,6 @@ function keysInKeyring(text) {
|
|
|
470
433
|
return false;
|
|
471
434
|
}
|
|
472
435
|
}
|
|
473
|
-
/**
|
|
474
|
-
* Provider ids whose saved keys a save removed from the configuration but could not yet delete from
|
|
475
|
-
* the OS credential store. The file names them until a later save deletes them, because once the
|
|
476
|
-
* file stops naming a provider nothing else could find its key.
|
|
477
|
-
*/
|
|
478
436
|
const PENDING_DELETION = 'providerKeysPendingDeletion';
|
|
479
437
|
function pendingDeletions(value) {
|
|
480
438
|
return Array.isArray(value) && value.every(id => typeof id === 'string') ? value : undefined;
|
|
@@ -489,13 +447,11 @@ function storedPendingDeletions(text) {
|
|
|
489
447
|
return [];
|
|
490
448
|
}
|
|
491
449
|
}
|
|
492
|
-
/** Write configuration text and publish it with one rename. */
|
|
493
450
|
async function publishConfig(directory, text) {
|
|
494
451
|
const temporary = join(directory, `config-${randomUUID()}.tmp`);
|
|
495
452
|
await writeFile(temporary, text, { mode: 0o600 });
|
|
496
453
|
await rename(temporary, join(directory, 'config.json'));
|
|
497
454
|
}
|
|
498
|
-
/** The provider ids stored configuration text names, whatever else it holds. */
|
|
499
455
|
function storedProviderIds(text) {
|
|
500
456
|
try {
|
|
501
457
|
const providers = JSON.parse(text)?.providers;
|
|
@@ -505,7 +461,6 @@ function storedProviderIds(text) {
|
|
|
505
461
|
return [];
|
|
506
462
|
}
|
|
507
463
|
}
|
|
508
|
-
/** A provider entry as written to disk once its key is in the OS credential store. */
|
|
509
464
|
function withoutApiKey(provider) {
|
|
510
465
|
const copy = { ...provider };
|
|
511
466
|
delete copy.apiKey;
|
|
@@ -522,15 +477,12 @@ async function readStoredConfig(directory) {
|
|
|
522
477
|
throw error;
|
|
523
478
|
}
|
|
524
479
|
const raw = JSON.parse(text);
|
|
525
|
-
// The marker is an on-disk detail: it is checked and removed here, so no configuration in memory carries it.
|
|
526
480
|
const marker = raw && typeof raw === 'object' && !Array.isArray(raw) ? raw.providerKeys : undefined;
|
|
527
481
|
if (marker !== undefined) {
|
|
528
482
|
if (marker !== PROVIDER_KEYS_IN_KEYRING)
|
|
529
483
|
throw new Error('Invalid providerKeys configuration: the only value is "keyring"');
|
|
530
484
|
delete raw.providerKeys;
|
|
531
485
|
}
|
|
532
|
-
// Keys a save removed but could not yet delete: they are not read back, or the next save would
|
|
533
|
-
// take them for keys the user still has and cancel their deletion.
|
|
534
486
|
let pending = new Set();
|
|
535
487
|
if (raw && typeof raw === 'object' && !Array.isArray(raw) && raw[PENDING_DELETION] !== undefined) {
|
|
536
488
|
const ids = pendingDeletions(raw[PENDING_DELETION]);
|
|
@@ -545,31 +497,22 @@ async function readStoredConfig(directory) {
|
|
|
545
497
|
const keys = await readProviderKeys(directory, config.providers.filter(provider => provider.apiKey === undefined && !pending.has(provider.id)).map(provider => provider.id));
|
|
546
498
|
for (const provider of config.providers) {
|
|
547
499
|
const key = keys.get(provider.id);
|
|
548
|
-
// A key typed into the file by hand is newer than the saved one, and is moved on the next save.
|
|
549
500
|
if (key === undefined || provider.apiKey !== undefined)
|
|
550
501
|
continue;
|
|
551
|
-
// A provider edited by hand into a type that takes no key loads without it rather than failing.
|
|
552
502
|
try {
|
|
553
503
|
assertProviderCredentials({ ...provider, apiKey: key });
|
|
554
504
|
provider.apiKey = key;
|
|
555
505
|
}
|
|
556
|
-
catch {
|
|
506
|
+
catch { }
|
|
557
507
|
}
|
|
558
508
|
}
|
|
559
509
|
return { config, plaintextKeys };
|
|
560
510
|
}
|
|
561
|
-
/** Directories whose plaintext keys this process could not move, so a load does not retry on every call. */
|
|
562
511
|
const unmovedKeys = new Set();
|
|
563
|
-
/**
|
|
564
|
-
* The installation's configuration, with saved provider API keys read back from the OS credential
|
|
565
|
-
* store. A `config.json` that still holds keys in plaintext (written before keys moved to the
|
|
566
|
-
* store, or edited by hand) has them moved on this load; where that cannot happen, the keys stay in
|
|
567
|
-
* the file and the configuration loads exactly as before.
|
|
568
|
-
*/
|
|
569
512
|
export async function loadConfig(directory = configDirectory()) {
|
|
570
513
|
const stored = await readStoredConfig(directory);
|
|
571
514
|
const key = resolve(directory);
|
|
572
|
-
if (stored.plaintextKeys && providerKeysBelongInKeyring() && !unmovedKeys.has(key)) {
|
|
515
|
+
if (stored.plaintextKeys && providerKeysBelongInKeyring(directory) && !unmovedKeys.has(key)) {
|
|
573
516
|
try {
|
|
574
517
|
const moved = await withConfigLock(directory, async () => {
|
|
575
518
|
const current = await readStoredConfig(directory);
|
|
@@ -584,19 +527,6 @@ export async function loadConfig(directory = configDirectory()) {
|
|
|
584
527
|
}
|
|
585
528
|
return stored.config;
|
|
586
529
|
}
|
|
587
|
-
/**
|
|
588
|
-
* The anonymous-feedback preference this installation has saved right now.
|
|
589
|
-
*
|
|
590
|
-
* The setting belongs to the installation rather than to any one process: the desktop app and
|
|
591
|
-
* every CLI write the same file, so a process that started before the change holds a snapshot
|
|
592
|
-
* that no longer says what was saved. A reader that reports or changes the preference asks here
|
|
593
|
-
* for the file's own answer rather than for the snapshot it loaded at startup.
|
|
594
|
-
*
|
|
595
|
-
* Only the block is read, and it is validated on its own: a preference that cannot be stored is
|
|
596
|
-
* a file the user believes is doing something, and a reader must not answer from it.
|
|
597
|
-
* @param directory - the installation's configuration directory.
|
|
598
|
-
* @returns the saved block, or undefined when the file holds none.
|
|
599
|
-
*/
|
|
600
530
|
export async function loadSavedAnalytics(directory = configDirectory()) {
|
|
601
531
|
let stored;
|
|
602
532
|
try {
|
|
@@ -613,20 +543,6 @@ export async function loadSavedAnalytics(directory = configDirectory()) {
|
|
|
613
543
|
validateAnalyticsConfig(parsed.analytics);
|
|
614
544
|
return parsed.analytics;
|
|
615
545
|
}
|
|
616
|
-
/**
|
|
617
|
-
* Write the configuration and publish it with one rename; the caller owns the lock, or is the only writer.
|
|
618
|
-
*
|
|
619
|
-
* Provider API keys go to the OS credential store first and the file records only that they are
|
|
620
|
-
* there, so a reader that sees the new file finds the keys it names. A key this configuration no
|
|
621
|
-
* longer holds is deleted from the store only after the file that drops it is published, so a save
|
|
622
|
-
* that fails or is interrupted leaves the previous configuration's keys in place; a save whose
|
|
623
|
-
* publication fails also puts back the keys it had already overwritten. Until that deletion
|
|
624
|
-
* succeeds the published file lists the providers in `providerKeysPendingDeletion`, so a save
|
|
625
|
-
* that could not delete them (a locked store, an interrupted process) is finished by the next one.
|
|
626
|
-
* Where keys cannot go to the
|
|
627
|
-
* store (see `storeProviderKeys`), they are written into the file as before.
|
|
628
|
-
* @returns whether every key this configuration holds is in the OS credential store.
|
|
629
|
-
*/
|
|
630
546
|
async function writeConfig(config, directory) {
|
|
631
547
|
validateConfig(config);
|
|
632
548
|
await mkdir(directory, { recursive: true });
|
|
@@ -635,8 +551,6 @@ async function writeConfig(config, directory) {
|
|
|
635
551
|
const previouslyInKeyring = previousText !== undefined && keysInKeyring(previousText);
|
|
636
552
|
const keys = new Map(config.providers.flatMap(provider => provider.apiKey === undefined ? [] : [[provider.id, provider.apiKey]]));
|
|
637
553
|
const previousIds = previouslyInKeyring ? storedProviderIds(previousText) : [];
|
|
638
|
-
// What the store holds now, so unchanged keys are not rewritten and a failed save can be undone;
|
|
639
|
-
// undefined when it cannot be read, and then every key is written and nothing is put back.
|
|
640
554
|
const current = previouslyInKeyring
|
|
641
555
|
? await readProviderKeys(directory, [...new Set([...previousIds, ...keys.keys()])]).catch(() => undefined)
|
|
642
556
|
: new Map();
|
|
@@ -653,10 +567,8 @@ async function writeConfig(config, directory) {
|
|
|
653
567
|
written = [...keys].filter(([provider, key]) => current?.get(provider) !== key).map(([provider]) => provider);
|
|
654
568
|
}
|
|
655
569
|
else
|
|
656
|
-
inKeyring = false;
|
|
570
|
+
inKeyring = false;
|
|
657
571
|
}
|
|
658
|
-
// Deletions an earlier save could not finish are retried, except for a provider whose key this
|
|
659
|
-
// save has just stored again.
|
|
660
572
|
drop = [...new Set([...drop, ...pendingBefore])].filter(provider => !inKeyring || !keys.has(provider));
|
|
661
573
|
const settled = JSON.stringify(onDisk, null, 2) + '\n';
|
|
662
574
|
const text = drop.length ? JSON.stringify({ ...onDisk, [PENDING_DELETION]: drop }, null, 2) + '\n' : settled;
|
|
@@ -672,9 +584,6 @@ async function writeConfig(config, directory) {
|
|
|
672
584
|
}
|
|
673
585
|
if (!drop.length)
|
|
674
586
|
return inKeyring;
|
|
675
|
-
// A key the user removed must not outlive the save that removed it; one that only moved into the
|
|
676
|
-
// file is already safe there, so failing to drop the store's copy does not fail the save. Either
|
|
677
|
-
// way the file keeps naming it, and the next save tries again.
|
|
678
587
|
try {
|
|
679
588
|
await removeProviderKeys(directory, drop);
|
|
680
589
|
}
|
|
@@ -683,21 +592,11 @@ async function writeConfig(config, directory) {
|
|
|
683
592
|
throw error;
|
|
684
593
|
return inKeyring;
|
|
685
594
|
}
|
|
686
|
-
// Best-effort: a list left behind only makes the next save delete entries that are already gone.
|
|
687
595
|
await publishConfig(directory, settled).catch(() => { });
|
|
688
596
|
return inKeyring;
|
|
689
597
|
}
|
|
690
|
-
/** How long a write waits for another process's write before reporting the collision. */
|
|
691
598
|
const LOCK_ATTEMPTS = 6;
|
|
692
599
|
const LOCK_RETRY_MS = 50;
|
|
693
|
-
/**
|
|
694
|
-
* Run one configuration write under the installation's own lock.
|
|
695
|
-
*
|
|
696
|
-
* Every writer of this file — the CLI, the terminal UI, each desktop window's engine — takes the same
|
|
697
|
-
* lock, which is what makes a write indivisible against another process. Contention is ordinary rather
|
|
698
|
-
* than exceptional (two surfaces saving at the same moment), so a busy lock is waited on briefly and only
|
|
699
|
-
* then reported; the wait is bounded, and an owner that died holding it is recovered by the lock itself.
|
|
700
|
-
*/
|
|
701
600
|
async function withConfigLock(directory, run) {
|
|
702
601
|
for (let attempt = 0;; attempt++) {
|
|
703
602
|
try {
|
|
@@ -719,25 +618,15 @@ async function withConfigLock(directory, run) {
|
|
|
719
618
|
export async function saveConfig(config, directory = configDirectory()) {
|
|
720
619
|
await withConfigLock(directory, () => writeConfig(config, directory));
|
|
721
620
|
}
|
|
722
|
-
/** Raised when the stored configuration was replaced between a read and the write that followed it. */
|
|
723
621
|
export class ConfigConflictError extends Error {
|
|
724
622
|
constructor() { super('The configuration changed while this change was being applied. Try again.'); this.name = 'ConfigConflictError'; }
|
|
725
623
|
}
|
|
726
|
-
/**
|
|
727
|
-
* Change the configuration file under the installation's lock, re-applying the change if it was replaced.
|
|
728
|
-
*
|
|
729
|
-
* The lock serializes every writer that honours it; the comparison covers the writers that cannot — an
|
|
730
|
-
* older installation, or a person editing the file — by re-applying the change to the newer content when
|
|
731
|
-
* the stored text is not the one this change was computed from. `change` has to be a pure function of the
|
|
732
|
-
* configuration it is given, which is what makes re-applying it safe.
|
|
733
|
-
*/
|
|
734
624
|
export async function changeConfigFile(directory, change, attempts = 3) {
|
|
735
625
|
const stored = join(directory, 'config.json');
|
|
736
626
|
const read = async () => await readFile(stored, 'utf8').catch(() => undefined);
|
|
737
627
|
return await withConfigLock(directory, async () => {
|
|
738
628
|
for (let attempt = 0; attempt < attempts; attempt++) {
|
|
739
629
|
const before = await read();
|
|
740
|
-
// Read without moving plaintext keys: that move takes this same lock, and the write below makes it anyway.
|
|
741
630
|
const next = change((await readStoredConfig(directory)).config);
|
|
742
631
|
if (await read() !== before)
|
|
743
632
|
continue;
|
|
@@ -760,19 +649,16 @@ export function validateCodeIntelConfig(codeIntel) {
|
|
|
760
649
|
throw new Error('codeIntel.enabledRepos must be an array of repository id strings');
|
|
761
650
|
}
|
|
762
651
|
}
|
|
763
|
-
/** Code intelligence defaults to on; config.json can disable it globally or per repository. */
|
|
764
652
|
export function resolveCodeIntelConfig(config) {
|
|
765
|
-
const codeIntel = { enabled:
|
|
653
|
+
const codeIntel = { enabled: false, ...(config.codeIntel ?? {}) };
|
|
766
654
|
validateCodeIntelConfig(codeIntel);
|
|
767
655
|
return codeIntel;
|
|
768
656
|
}
|
|
769
|
-
/** Secrets the remote feature stores are all fixed-size random encodings; anything else is corruption. */
|
|
770
657
|
const BASE64URL_32 = /^[A-Za-z0-9_-]{43}$/;
|
|
771
658
|
const HEX_16 = /^[a-f0-9]{16}$/;
|
|
772
659
|
const HEX_32 = /^[a-f0-9]{32}$/;
|
|
773
660
|
const HEX_12 = /^[a-f0-9]{12}$/;
|
|
774
661
|
const ISO_DATE = /^\d{4}-\d{2}-\d{2}T/;
|
|
775
|
-
/** A user-visible name for a device, share, or workspace: printable, bounded, never multi-line. */
|
|
776
662
|
function isDisplayLabel(value) {
|
|
777
663
|
return typeof value === 'string' && value.length > 0 && value.length <= 64 && !/[\0\r\n]/.test(value);
|
|
778
664
|
}
|
|
@@ -782,16 +668,6 @@ function isIsoDate(value) {
|
|
|
782
668
|
function isPort(value) {
|
|
783
669
|
return Number.isSafeInteger(value) && value >= 1 && value <= 65535;
|
|
784
670
|
}
|
|
785
|
-
/**
|
|
786
|
-
* Validate the Remote Workspace section.
|
|
787
|
-
*
|
|
788
|
-
* Device tokens, invitation tokens, and workspace credentials are 256-bit random values; the id
|
|
789
|
-
* shapes are what the pairing transaction generates. Rejecting anything else here means a
|
|
790
|
-
* hand-edited or corrupted file fails loudly at load instead of being presented as a live device
|
|
791
|
-
* or a redeemable invitation. Absolute share paths are deliberately NOT validated against any
|
|
792
|
-
* allowlist — the host chose them — but they must be plain filesystem paths with no control
|
|
793
|
-
* characters, because the browse layer treats them as containment roots.
|
|
794
|
-
*/
|
|
795
671
|
export function validateRemoteConfig(remote) {
|
|
796
672
|
const r = remote;
|
|
797
673
|
if (!r || typeof r !== 'object' || Array.isArray(r))
|
|
@@ -852,9 +728,6 @@ export function validateRemoteConfig(remote) {
|
|
|
852
728
|
|| (workspace.host !== undefined && (typeof workspace.host !== 'string' || !workspace.host.trim() || workspace.host.length > 253 || /[\0\r\n /]/.test(workspace.host)))
|
|
853
729
|
|| !isPort(workspace.port) || (workspace.transport !== 'https' && workspace.transport !== 'http')
|
|
854
730
|
|| !BASE64URL_32.test(workspace.fingerprint)
|
|
855
|
-
// The certificate is the trust anchor only on https. An http workspace — paired under the
|
|
856
|
-
// explicit plaintext opt-in — stores no certificate at all (''), and requiring one here
|
|
857
|
-
// would fail its write after the host had already redeemed the single-use invitation.
|
|
858
731
|
|| (workspace.transport === 'https'
|
|
859
732
|
? (typeof workspace.certPem !== 'string' || !workspace.certPem.includes('BEGIN CERTIFICATE'))
|
|
860
733
|
: (workspace.certPem !== undefined && typeof workspace.certPem !== 'string'))
|
|
@@ -867,12 +740,6 @@ export function validateRemoteConfig(remote) {
|
|
|
867
740
|
}
|
|
868
741
|
}
|
|
869
742
|
}
|
|
870
|
-
/**
|
|
871
|
-
* Validate the project registry the rail and peers read.
|
|
872
|
-
*
|
|
873
|
-
* `path` is the realpath the registry stores (the entry key for idempotent adds), so it must be a
|
|
874
|
-
* plain absolute-ish filesystem path free of control characters; the name is a display label.
|
|
875
|
-
*/
|
|
876
743
|
export function validateProjectsConfig(projects) {
|
|
877
744
|
if (!Array.isArray(projects) || projects.length > 256)
|
|
878
745
|
throw new Error('projects must be an array of at most 256 entries');
|
|
@@ -881,7 +748,8 @@ export function validateProjectsConfig(projects) {
|
|
|
881
748
|
if (!project || typeof project !== 'object' || Array.isArray(project)
|
|
882
749
|
|| typeof project.path !== 'string' || !project.path.trim() || project.path.includes('\0') || seen.has(project.path)
|
|
883
750
|
|| !isIsoDate(project.addedAt)
|
|
884
|
-
|| (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))))
|
|
885
753
|
throw new Error('Invalid project registry entry');
|
|
886
754
|
seen.add(project.path);
|
|
887
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;
|