@andorra-labs/code 0.1.12 → 0.1.14
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 +6 -43
- 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 +347 -554
- 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 +11 -155
- 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/andorra/endpoint.d.ts +7 -0
- package/dist/src/andorra/endpoint.js +46 -0
- package/dist/src/andorra/entry.d.ts +21 -0
- package/dist/src/andorra/entry.js +100 -0
- package/dist/src/andorra/errors.d.ts +2 -0
- package/dist/src/andorra/errors.js +39 -0
- package/dist/src/andorra/hosted.d.ts +52 -0
- package/dist/src/andorra/hosted.js +126 -0
- package/dist/src/andorra/monitor.d.ts +151 -0
- package/dist/src/andorra/monitor.js +393 -0
- package/dist/src/andorra/notices.d.ts +7 -0
- package/dist/src/andorra/notices.js +15 -0
- package/dist/src/andorra/opt-in.d.ts +58 -0
- package/dist/src/andorra/opt-in.js +112 -0
- package/dist/src/andorra/request-watch.d.ts +6 -0
- package/dist/src/andorra/request-watch.js +10 -0
- package/dist/src/andorra/state.d.ts +86 -0
- package/dist/src/andorra/state.js +238 -0
- package/dist/src/andorra/terminal.d.ts +68 -0
- package/dist/src/andorra/terminal.js +125 -0
- package/dist/src/andorra/usage-format.d.ts +9 -0
- package/dist/src/andorra/usage-format.js +19 -0
- 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 +9 -29
- package/dist/src/app-server/protocol.d.ts +18 -246
- 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 +52 -925
- package/dist/src/app-server.js +828 -3076
- 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 +9 -93
- package/dist/src/auth/AuthManager.js +164 -186
- 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 +1 -16
- package/dist/src/auth/deployment.js +1 -16
- package/dist/src/auth/index.d.ts +1 -12
- package/dist/src/auth/index.js +1 -12
- package/dist/src/auth/lock.d.ts +0 -1
- package/dist/src/auth/lock.js +0 -1
- package/dist/src/auth/store.d.ts +33 -108
- package/dist/src/auth/store.js +55 -130
- 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 +5 -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 +19 -13
- package/dist/src/browser-stealth.js +22 -38
- 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 +15 -97
- package/dist/src/browser-view.d.ts +106 -295
- package/dist/src/browser-view.js +551 -587
- 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 +118 -742
- 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 +41 -1
- package/dist/src/command-screens.js +316 -113
- package/dist/src/commands.d.ts +12 -63
- package/dist/src/commands.js +98 -127
- 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 +15 -115
- package/dist/src/config.js +123 -172
- 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 +2 -2
- package/dist/src/dashboard-view.js +11 -37
- 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 +2 -6
- 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 +1 -2
- package/dist/src/decision/toolMenu.d.ts +0 -3
- package/dist/src/decision/toolMenu.js +0 -4
- package/dist/src/decision/types.d.ts +1 -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 +9 -61
- package/dist/src/graph-health.js +34 -59
- package/dist/src/graph-manager-chat.d.ts +36 -153
- package/dist/src/graph-manager-chat.js +161 -182
- 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 +58 -391
- package/dist/src/graph-selection.d.ts +0 -14
- package/dist/src/graph-selection.js +2 -15
- 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 +176 -492
- 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 +43 -185
- 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 +16 -136
- package/dist/src/graph-ui/theme.js +1 -26
- package/dist/src/graph-ui/tokens.css +19 -118
- package/dist/src/graphs.d.ts +6 -157
- package/dist/src/graphs.js +66 -269
- 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 +9 -47
- 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 +1 -14
- package/dist/src/membership.d.ts +9 -59
- package/dist/src/membership.js +20 -91
- 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-context-windows.d.ts +2 -0
- package/dist/src/model-context-windows.js +24 -0
- package/dist/src/model-health-cache.d.ts +0 -38
- package/dist/src/model-health-cache.js +2 -50
- package/dist/src/model-metadata.d.ts +1 -18
- package/dist/src/model-metadata.js +42 -45
- 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 +1 -63
- package/dist/src/palette.js +1 -64
- package/dist/src/permissions.d.ts +0 -15
- package/dist/src/permissions.js +17 -21
- 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 +15 -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 +16 -3
- package/dist/src/provider-settings.js +36 -52
- package/dist/src/providers.d.ts +14 -219
- package/dist/src/providers.js +69 -326
- 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 +107 -422
- 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 +22 -339
- 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 +2 -9
- package/dist/src/run-control.js +9 -13
- 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 +12 -228
- package/dist/src/runtime.js +2 -128
- 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 +3 -122
- 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 +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/graph-manager/errors.md +1 -1
- package/dist/src/skills/bundled/provenance.json +738 -738
- 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 +2 -163
- package/dist/src/subagent-run.js +18 -376
- 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 +3 -84
- 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 +33 -521
- package/dist/src/terminal-ui.js +145 -884
- 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 +5 -60
- package/dist/src/types.d.ts +4 -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 +13 -2
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The tools the Andorra agent-control MCP server advertises, as plain data.
|
|
3
|
-
*
|
|
4
|
-
* Kept apart from `agent-mcp.ts` so the engine can describe its built-in `graphs` tool without
|
|
5
|
-
* loading the graph backend (and its sync, membership and subagent modules) until a graph action runs.
|
|
6
|
-
*/
|
|
7
1
|
export interface AgentMcpToolSpec {
|
|
8
2
|
name: string;
|
|
9
3
|
description: string;
|
|
@@ -15,7 +9,5 @@ export interface AgentMcpToolSpec {
|
|
|
15
9
|
};
|
|
16
10
|
}
|
|
17
11
|
export declare const AGENT_MCP_CATALOG: readonly AgentMcpToolSpec[];
|
|
18
|
-
/** The tool names this server advertises; bundled skills that drive it are checked against this list. */
|
|
19
12
|
export declare const AGENT_MCP_TOOL_NAMES: readonly string[];
|
|
20
|
-
/** Graph authoring: what the engine's built-in `graphs` tool offers. Session and subagent tools stay MCP-only. */
|
|
21
13
|
export declare const AGENT_MCP_GRAPH_TOOLS: readonly AgentMcpToolSpec[];
|
|
@@ -34,7 +34,5 @@ export const AGENT_MCP_CATALOG = [
|
|
|
34
34
|
{ name: 'andorra_subagent_result', description: 'Read the subagent run outcome. waitMs (0-60000) waits for completion within the call; otherwise returns running immediately when unfinished. The finished reply carries the full run result including completion summary and status. The runId must be the one the start returned.', inputSchema: obj({ waitMs: { type: 'integer', minimum: 0, maximum: 60000 }, runId: str }, ['runId']) },
|
|
35
35
|
{ name: 'andorra_subagent_cancel', description: 'Cancel the subagent run. The runId must be the one the start returned, so a delayed cancellation cannot stop a run that replaced it.', inputSchema: obj({ runId: str }, ['runId']) },
|
|
36
36
|
];
|
|
37
|
-
/** The tool names this server advertises; bundled skills that drive it are checked against this list. */
|
|
38
37
|
export const AGENT_MCP_TOOL_NAMES = AGENT_MCP_CATALOG.map(tool => tool.name);
|
|
39
|
-
/** Graph authoring: what the engine's built-in `graphs` tool offers. Session and subagent tools stay MCP-only. */
|
|
40
38
|
export const AGENT_MCP_GRAPH_TOOLS = AGENT_MCP_CATALOG.filter(tool => tool.name.startsWith('andorra_graph_') || tool.name === 'andorra_graphs_list' || tool.name === 'andorra_providers_list');
|
package/dist/src/agent-mcp.d.ts
CHANGED
|
@@ -27,33 +27,18 @@ export type AgentMcpReply = {
|
|
|
27
27
|
type GraphSyncClient = Pick<GraphSync, 'start' | 'waitForSync' | 'close' | 'sync' | 'status' | 'reviveGraph'>;
|
|
28
28
|
export interface AgentMcpBackendOptions {
|
|
29
29
|
directory?: string;
|
|
30
|
-
/** Test-only or embedded-host override. Production graph access enforces paid membership and account ownership. */
|
|
31
|
-
/** `free` holds the access to the free graph allowance; production reads it from membership. */
|
|
32
30
|
graphAccess?: () => Promise<{
|
|
33
31
|
directory: string;
|
|
34
32
|
subject?: string;
|
|
35
33
|
free?: boolean;
|
|
36
34
|
}>;
|
|
37
|
-
/** Test-only sync boundary for deterministic concurrency and initial-sync checks. */
|
|
38
35
|
graphSyncFactory?: (directory: string, subject: string) => GraphSyncClient;
|
|
39
|
-
/** Test-only stable store reader for reproducing inter-page session mutations. */
|
|
40
36
|
sessionStore?: Pick<SessionStore, 'list'>;
|
|
41
|
-
/** Test-only config reader for reproducing changes during the final provider reload. */
|
|
42
37
|
providerConfig?: () => ReturnType<typeof loadConfig>;
|
|
43
|
-
/** Test-only identity readers for reproducing cross-account auth races. */
|
|
44
38
|
authStatus?: typeof getAuthStatus;
|
|
45
39
|
membershipStatus?: typeof getMembership;
|
|
46
|
-
/** Embedded host override for subagent runs; production runs use the caller's working directory. */
|
|
47
40
|
subagentWorkspace?: string;
|
|
48
|
-
/** Test-only adapter so subagent runs stay offline and deterministic. */
|
|
49
41
|
subagentAdapterFactory?: (provider: import('./providers.js').ProviderConfig) => ModelAdapter;
|
|
50
|
-
/**
|
|
51
|
-
* Whether construction sweeps the home for runs a crashed process left `running` (default true).
|
|
52
|
-
*
|
|
53
|
-
* The stdio server needs it: a host that only talks to the server would otherwise never see its own
|
|
54
|
-
* crashed runs classified. The engine's built-in `graphs` tool passes false: it starts no subagent
|
|
55
|
-
* runs, and the run records of its home belong to the engine that hosts it.
|
|
56
|
-
*/
|
|
57
42
|
recoverRuns?: boolean;
|
|
58
43
|
}
|
|
59
44
|
export declare const GRAPH_AGENT_GUIDE: string;
|
|
@@ -74,13 +59,6 @@ export declare class AgentMcpError extends Error {
|
|
|
74
59
|
}[];
|
|
75
60
|
});
|
|
76
61
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Where a node new to a graph goes on the canvas. A node placed in free space keeps its position. One
|
|
79
|
-
* with no position goes a stage to the right of the rightmost card, level with it; one that lands on
|
|
80
|
-
* another card moves to the nearest spot that keeps a clear margin around every card, preferring a
|
|
81
|
-
* spot below, then above, then to the right. Existing cards never move. Undefined when the asked-for
|
|
82
|
-
* position is already free.
|
|
83
|
-
*/
|
|
84
62
|
export declare function placeNewNode(node: GraphNode, others: GraphNode[]): {
|
|
85
63
|
x: number;
|
|
86
64
|
y: number;
|
|
@@ -91,60 +69,26 @@ export declare class AgentMcpBackend {
|
|
|
91
69
|
private drafts;
|
|
92
70
|
private sync?;
|
|
93
71
|
private accessKey?;
|
|
94
|
-
/** An account's first snapshot reconciliation must finish before any reader sees its graphs. */
|
|
95
72
|
private initialSync?;
|
|
96
|
-
/** Subagent runs this process owns; one at a time, like every other engine surface. */
|
|
97
73
|
private readonly subagent;
|
|
98
|
-
/**
|
|
99
|
-
* The starts that are preparing and have published no run id yet.
|
|
100
|
-
*
|
|
101
|
-
* A count, not a flag: a second start that is refused while the first is still preparing
|
|
102
|
-
* releases its own reservation, and a flag it cleared would take the first start's with it.
|
|
103
|
-
*/
|
|
104
74
|
private starting;
|
|
105
|
-
/** Set when the connection closed: a start that begins after it must not launch a run. */
|
|
106
75
|
private closed;
|
|
107
76
|
constructor(options?: AgentMcpBackendOptions);
|
|
108
|
-
/** The startup recovery, finished before the first subagent start is accepted. */
|
|
109
77
|
private readonly recovery;
|
|
110
|
-
/**
|
|
111
|
-
* The run a control call is about.
|
|
112
|
-
*
|
|
113
|
-
* One backend can serve several requesters, and a new run may start as soon as the previous one
|
|
114
|
-
* has finished. A call that names the run it means is refused when that run is no longer the
|
|
115
|
-
* current one: a delayed result would otherwise report the next run's state, and a delayed
|
|
116
|
-
* cancellation would stop it.
|
|
117
|
-
*/
|
|
118
78
|
private assertSubagentRun;
|
|
119
79
|
close(): Promise<void>;
|
|
120
80
|
private graphAccess;
|
|
121
|
-
/** Graph storage is account-owned. Verify identity again after filesystem awaits
|
|
122
|
-
* and before releasing any graph data to an MCP caller. */
|
|
123
81
|
private assertGraphIdentity;
|
|
124
82
|
private obtainDraft;
|
|
125
83
|
private providers;
|
|
126
|
-
/**
|
|
127
|
-
* Soft-delete or restore: publish the next revision with metadata.deletedAt set or removed.
|
|
128
|
-
*
|
|
129
|
-
* The revision goes through the same save path as a publish, so free-tier rules and the optimistic
|
|
130
|
-
* revision check apply unchanged, and cloud sync carries the marker to every machine.
|
|
131
|
-
*/
|
|
132
84
|
private setDeleted;
|
|
133
|
-
/** Missing graph identity is not a broken graph. Tell the agent to list or create it. */
|
|
134
85
|
private readGraph;
|
|
135
86
|
private upsertNode;
|
|
136
87
|
private upsertEdge;
|
|
137
|
-
/**
|
|
138
|
-
* Run one tool call. `beforeSave` runs synchronously immediately before a revision is written
|
|
139
|
-
* (publish, delete, restore), after every await that precedes the write; throwing from it abandons
|
|
140
|
-
* the save. An embedding host uses it to refuse a save its task may no longer make (cancelled, or
|
|
141
|
-
* switched to Plan) while the call was waiting on sign-in checks or cloud sync.
|
|
142
|
-
*/
|
|
143
88
|
call(name: string, rawArgs?: unknown, options?: {
|
|
144
89
|
beforeSave?: () => void;
|
|
145
90
|
}): Promise<AgentMcpReply>;
|
|
146
91
|
private dispatch;
|
|
147
92
|
}
|
|
148
|
-
/** The tool names this server advertises; bundled skills that drive it are checked against this list. */
|
|
149
93
|
export { AGENT_MCP_TOOL_NAMES };
|
|
150
94
|
export declare function runAgentMcpServer(): Promise<number>;
|
package/dist/src/agent-mcp.js
CHANGED
|
@@ -9,7 +9,7 @@ import { stampGraphProviderProfiles } from './graph-provider-portability.js';
|
|
|
9
9
|
import { getAuthStatus } from './auth/index.js';
|
|
10
10
|
import { getMembership, PaidMembershipRequiredError } from './membership.js';
|
|
11
11
|
import { FREE_CUSTOM_GRAPH_LIMIT, FREE_GRAPH_LIMIT_MESSAGE, FreeTierLimitError, readGraphQuota, saveFreeTierGraph } from './graph-quota.js';
|
|
12
|
-
import { GraphConflictError, isDeletedGraph, listGraphs, loadGraph, migrateGraphForEditor, nodeOutcomes, saveGraph, validateGraph, withoutDeletedGraphs } from './graphs.js';
|
|
12
|
+
import { GraphConflictError, isDeletedGraph, listGraphs, loadGraph, migrateGraphForEditor, nodeOutcomes, optionalOutcomes, saveGraph, validateGraph, withoutDeletedGraphs } from './graphs.js';
|
|
13
13
|
import { getAgentSession, listAgentProjects, queryAgentSessions, scanAgentSessions, SessionQueryError } from './session-monitor.js';
|
|
14
14
|
import { AutomationStore } from './automations.js';
|
|
15
15
|
import { canonicalWorkspace, MAX_SUBAGENT_TASK_CHARS, SubagentInvalidArgumentError, SubagentProviderNotSetError, SubagentRunInProgressError, SubagentRunner, SubagentSelectionError } from './subagent-run.js';
|
|
@@ -65,7 +65,7 @@ export const GRAPH_AGENT_GUIDE = [
|
|
|
65
65
|
'Sessions that already ran it keep resuming. andorra_graphs_list {includeDeleted:true} lists deleted graphs with deleted=true.',
|
|
66
66
|
'andorra_graph_restore {id, expectedRevision} publishes the next revision without the marker.',
|
|
67
67
|
'A deleted graph still counts toward a free account\'s one custom graph, so a free account restores it rather than replacing it.',
|
|
68
|
-
'DEFAULT_GRAPH: the bundled Default graph
|
|
68
|
+
'DEFAULT_GRAPH: the bundled Default graph cannot be deleted.',
|
|
69
69
|
'CONFIRMATION_MISMATCH: confirm must equal id. GRAPH_IN_USE: an automation runs the graph; the error lists them; change them first.',
|
|
70
70
|
'GRAPH_DELETED: the graph is deleted; restore it before editing or deleting it again. GRAPH_NOT_DELETED: restore needs a deleted graph.',
|
|
71
71
|
'RESERVED_METADATA: metadata.deletedAt is set only by the delete and restore tools; andorra_graph_patch and publishing refuse it.',
|
|
@@ -138,22 +138,16 @@ function draftId(args) {
|
|
|
138
138
|
return value;
|
|
139
139
|
}
|
|
140
140
|
const knownTypes = ['agent', 'end', 'join', 'parallel', 'condition', 'loop', 'action', 'approval'];
|
|
141
|
-
/** The editor's card: 210 wide, 94 tall with one outcome, and one `.output-port` row (25px) taller for each further one. */
|
|
142
141
|
const CARD_WIDTH = 210, CARD_HEIGHT = 94, PORT_HEIGHT = 25;
|
|
143
|
-
/** Where the editor draws a card that has no position: in a row along the top, by its place in the graph (`position` in src/graph-ui/app.js). */
|
|
144
142
|
const UNPLACED_SPACING = 290;
|
|
145
|
-
/** The largest coordinate a saved position may have (`validateGraph` in src/graphs.ts). */
|
|
146
143
|
const COORDINATE_LIMIT = 100_000;
|
|
147
|
-
/** The space kept clear around a placed card, so its routes have room to pass. */
|
|
148
144
|
const CARD_GAP_X = 60, CARD_GAP_Y = 40;
|
|
149
|
-
/** Placement steps across the canvas, and how far from the asked-for spot a free one is looked for. */
|
|
150
145
|
const PLACE_STEP = 40, PLACE_RINGS = 25;
|
|
151
146
|
const STAGE_SPACING = 300;
|
|
152
|
-
/** How many output ports a card draws; a node still being built may not have a readable set yet. */
|
|
153
147
|
const portCount = (node) => {
|
|
154
148
|
try {
|
|
155
149
|
const ports = nodeOutcomes(node);
|
|
156
|
-
return Array.isArray(ports) ? ports.length : 1;
|
|
150
|
+
return Array.isArray(ports) ? ports.length + optionalOutcomes(node).length : 1;
|
|
157
151
|
}
|
|
158
152
|
catch {
|
|
159
153
|
return 1;
|
|
@@ -162,20 +156,9 @@ const portCount = (node) => {
|
|
|
162
156
|
const footprint = (node, at) => ({ x: at.x, y: at.y, width: CARD_WIDTH, height: CARD_HEIGHT + Math.max(0, portCount(node) - 1) * PORT_HEIGHT });
|
|
163
157
|
const collides = (a, b) => a.x < b.x + b.width + CARD_GAP_X && b.x < a.x + a.width + CARD_GAP_X && a.y < b.y + b.height + CARD_GAP_Y && b.y < a.y + a.height + CARD_GAP_Y;
|
|
164
158
|
const validPoint = (value) => record(value) && Number.isFinite(value.x) && Number.isFinite(value.y);
|
|
165
|
-
/**
|
|
166
|
-
* Where a node new to a graph goes on the canvas. A node placed in free space keeps its position. One
|
|
167
|
-
* with no position goes a stage to the right of the rightmost card, level with it; one that lands on
|
|
168
|
-
* another card moves to the nearest spot that keeps a clear margin around every card, preferring a
|
|
169
|
-
* spot below, then above, then to the right. Existing cards never move. Undefined when the asked-for
|
|
170
|
-
* position is already free.
|
|
171
|
-
*/
|
|
172
159
|
export function placeNewNode(node, others) {
|
|
173
|
-
// A card with no position is still on the canvas, where the editor draws it: by its place in the
|
|
174
|
-
// graph as it will be once this node is in it. An integer-like id is enumerated first, so the new
|
|
175
|
-
// node can move every unplaced card one slot along.
|
|
176
160
|
const order = Object.keys({ ...Object.fromEntries(others.map(other => [other.id, true])), [node.id]: true });
|
|
177
161
|
const cards = others.map(other => footprint(other, validPoint(other.position) ? other.position : { x: order.indexOf(other.id) * UNPLACED_SPACING, y: 0 }));
|
|
178
|
-
// A spot past the canvas's coordinate limit would make the graph unpublishable.
|
|
179
162
|
const inBounds = (at) => Math.abs(Math.round(at.x)) <= COORDINATE_LIMIT && Math.abs(Math.round(at.y)) <= COORDINATE_LIMIT;
|
|
180
163
|
const clamp = (value) => Math.round(Math.max(-COORDINATE_LIMIT, Math.min(COORDINATE_LIMIT, value)));
|
|
181
164
|
const free = (at) => inBounds(at) && !cards.some(card => collides(footprint(node, at), card));
|
|
@@ -187,7 +170,6 @@ export function placeNewNode(node, others) {
|
|
|
187
170
|
const origin = { x: clamp(wanted.x), y: clamp(wanted.y) };
|
|
188
171
|
if (free(origin))
|
|
189
172
|
return { x: Math.round(origin.x), y: Math.round(origin.y) };
|
|
190
|
-
// Spots nearest the origin first; among equally near ones, below before above before to the right.
|
|
191
173
|
const spots = [];
|
|
192
174
|
for (let dx = 0; dx <= PLACE_RINGS; dx++)
|
|
193
175
|
for (let dy = -PLACE_RINGS; dy <= PLACE_RINGS; dy++) {
|
|
@@ -199,15 +181,10 @@ export function placeNewNode(node, others) {
|
|
|
199
181
|
const spot = spots.find(free);
|
|
200
182
|
if (spot)
|
|
201
183
|
return { x: Math.round(spot.x), y: Math.round(spot.y) };
|
|
202
|
-
// A canvas packed all around the origin: the new card starts a stage of its own past every card.
|
|
203
|
-
// At the canvas's edge that stage is clamped inside it: a card on another beats a graph that cannot be saved.
|
|
204
184
|
const right = Math.max(...cards.map(card => card.x + card.width));
|
|
205
185
|
return { x: clamp(right + STAGE_SPACING - CARD_WIDTH), y: origin.y };
|
|
206
186
|
}
|
|
207
|
-
/** Used only inside the canonical graph validator's catch block. */
|
|
208
187
|
const graphValidationIssue = (error) => ({ code: 'GRAPH_INVALID', message: error instanceof Error ? error.message : 'Graph validation failed.' });
|
|
209
|
-
/** Ordinary backend and storage failures are not evidence of malformed graph topology.
|
|
210
|
-
* Do not echo raw OS exception messages: they can contain private local paths. */
|
|
211
188
|
function backendIssue(error) {
|
|
212
189
|
const code = error && typeof error === 'object' && 'code' in error
|
|
213
190
|
? error.code : undefined;
|
|
@@ -216,7 +193,6 @@ function backendIssue(error) {
|
|
|
216
193
|
? { code: 'STORAGE_ERROR', message: 'Andorra Code could not access its local data. Check the installation directory and filesystem permissions, then retry.' }
|
|
217
194
|
: { code: 'BACKEND_ERROR', message: 'Andorra Code could not complete this MCP request. Check the local configuration and logs, then retry.' };
|
|
218
195
|
}
|
|
219
|
-
/** Single source of truth: the published graph validator remains authoritative for all topology rules. */
|
|
220
196
|
function graphIssues(graph, providers, defaultProvider, authoredAgents = new Set()) {
|
|
221
197
|
const issues = [];
|
|
222
198
|
for (const [id, node] of Object.entries(graph.nodes)) {
|
|
@@ -238,7 +214,7 @@ function graphIssues(graph, providers, defaultProvider, authoredAgents = new Set
|
|
|
238
214
|
}
|
|
239
215
|
catch {
|
|
240
216
|
continue;
|
|
241
|
-
}
|
|
217
|
+
}
|
|
242
218
|
for (const port of ports) {
|
|
243
219
|
if (node.completion?.mode === 'outcomes' && node.completion.requireRoutes === false)
|
|
244
220
|
continue;
|
|
@@ -274,16 +250,11 @@ function graphIssues(graph, providers, defaultProvider, authoredAgents = new Set
|
|
|
274
250
|
if (Object.keys(graph.nodes).length > 0 && !Object.values(graph.nodes).some(node => node?.type === 'end')) {
|
|
275
251
|
issues.push({ code: 'END_NODE_MISSING', message: 'Graph must contain at least one End node. Add an End node and connect a valid path.' });
|
|
276
252
|
}
|
|
277
|
-
// The full validator also checks schemas, cycles and Join dependencies. Run it
|
|
278
|
-
// even while there are missing ports: otherwise the agent learns about an
|
|
279
|
-
// invalid schema only after another round trip to repair an unrelated edge.
|
|
280
253
|
try {
|
|
281
254
|
validateGraph(graph, { providers, defaultProvider, spawnAvailable: true });
|
|
282
255
|
}
|
|
283
256
|
catch (error) {
|
|
284
257
|
const issue = graphValidationIssue(error);
|
|
285
|
-
// Required routes have already been reported with nodeId/port above.
|
|
286
|
-
// Avoid burying a useful diagnosis under the validator's duplicate prose.
|
|
287
258
|
if (!issues.some(item => item.code === 'NODE_ROUTE_MISSING'
|
|
288
259
|
&& issue.message.includes(`node ${item.nodeId}: required outcome ${item.port} has no route`))
|
|
289
260
|
&& !(issues.some(item => item.code === 'ENTRY_NOT_FOUND') && /entry must reference an existing node/.test(issue.message))
|
|
@@ -298,69 +269,33 @@ export class AgentMcpBackend {
|
|
|
298
269
|
drafts = new Map();
|
|
299
270
|
sync;
|
|
300
271
|
accessKey;
|
|
301
|
-
/** An account's first snapshot reconciliation must finish before any reader sees its graphs. */
|
|
302
272
|
initialSync;
|
|
303
|
-
/** Subagent runs this process owns; one at a time, like every other engine surface. */
|
|
304
273
|
subagent;
|
|
305
|
-
/**
|
|
306
|
-
* The starts that are preparing and have published no run id yet.
|
|
307
|
-
*
|
|
308
|
-
* A count, not a flag: a second start that is refused while the first is still preparing
|
|
309
|
-
* releases its own reservation, and a flag it cleared would take the first start's with it.
|
|
310
|
-
*/
|
|
311
274
|
starting = 0;
|
|
312
|
-
/** Set when the connection closed: a start that begins after it must not launch a run. */
|
|
313
275
|
closed = false;
|
|
314
276
|
constructor(options = {}) {
|
|
315
277
|
this.options = options;
|
|
316
278
|
this.directory = options.directory ?? configDirectory();
|
|
317
|
-
// The run's records belong to the home this backend was built for, not to whichever
|
|
318
|
-
// installation happens to sit on the machine.
|
|
319
279
|
this.subagent = new SubagentRunner({
|
|
320
280
|
directory: this.directory,
|
|
321
|
-
// The injected provider reader keeps embedded hosts and tests on their own configuration;
|
|
322
|
-
// production reads the installation directory this backend was built for.
|
|
323
281
|
loadConfig: directory => this.options.providerConfig ? this.options.providerConfig() : loadConfig(directory),
|
|
324
282
|
});
|
|
325
|
-
// Attempts a previous process left in flight are classified before this one starts: a host
|
|
326
|
-
// that only ever talks to the MCP server would otherwise keep its own crashed runs marked
|
|
327
|
-
// `running` until an unrelated interactive CLI or app-server was opened. Best effort: a
|
|
328
|
-
// damaged home must not block the server.
|
|
329
|
-
// Another engine in this process may have a live run in this home — an app-server, or a
|
|
330
|
-
// second backend. A record this process is running is not this backend's to classify, so the
|
|
331
|
-
// sweep leaves it alone.
|
|
332
283
|
this.recovery = options.recoverRuns === false ? Promise.resolve()
|
|
333
284
|
: reconcileInterruptedRuns(this.directory, undefined, { skipOwnProcess: true }).then(() => undefined).catch(() => undefined);
|
|
334
285
|
}
|
|
335
|
-
/** The startup recovery, finished before the first subagent start is accepted. */
|
|
336
286
|
recovery;
|
|
337
|
-
/**
|
|
338
|
-
* The run a control call is about.
|
|
339
|
-
*
|
|
340
|
-
* One backend can serve several requesters, and a new run may start as soon as the previous one
|
|
341
|
-
* has finished. A call that names the run it means is refused when that run is no longer the
|
|
342
|
-
* current one: a delayed result would otherwise report the next run's state, and a delayed
|
|
343
|
-
* cancellation would stop it.
|
|
344
|
-
*/
|
|
345
287
|
assertSubagentRun(runId) {
|
|
346
288
|
if (typeof runId !== 'string' || !runId) {
|
|
347
289
|
throw new AgentMcpError('INVALID_ARGUMENTS', 'runId must be the id the start returned.');
|
|
348
290
|
}
|
|
349
291
|
const status = this.subagent.status();
|
|
350
292
|
const current = status.runId;
|
|
351
|
-
// A start that is still preparing has published no id: a control call cannot name the run it
|
|
352
|
-
// is about, and an id it made up would cancel a run whose id the caller never had.
|
|
353
293
|
if (current === undefined && this.starting > 0) {
|
|
354
294
|
throw new AgentMcpError('INVALID_ARGUMENTS', 'The run is still starting and has published no id yet.');
|
|
355
295
|
}
|
|
356
|
-
// A replacement is preparing while the run that was current has already finished. A control
|
|
357
|
-
// call that names the finished run is stale, and the runner would read it as a cancellation
|
|
358
|
-
// of the replacement — a run whose id the caller never received.
|
|
359
296
|
if (current !== undefined && this.starting > 0 && status.state !== 'running') {
|
|
360
297
|
throw new AgentMcpError('INVALID_ARGUMENTS', 'That run has finished and a replacement is starting; the run it named is not the one this process owns.');
|
|
361
298
|
}
|
|
362
|
-
// No run is live: the id the caller names cannot have come from a start, and answering about
|
|
363
|
-
// whatever the process happens to hold would let a stale caller read a different run's state.
|
|
364
299
|
if (current === undefined) {
|
|
365
300
|
throw new AgentMcpError('NO_RUN', 'No run is live in this process; the run it named has finished.');
|
|
366
301
|
}
|
|
@@ -369,12 +304,8 @@ export class AgentMcpBackend {
|
|
|
369
304
|
}
|
|
370
305
|
}
|
|
371
306
|
async close() {
|
|
372
|
-
// The connection is gone: a start that is still preparing must not become a run, and the
|
|
373
|
-
// runner refuses one from here on.
|
|
374
307
|
this.closed = true;
|
|
375
308
|
this.drafts.clear();
|
|
376
|
-
// The run this process owns ends with it: a provider request or a full-access tool call
|
|
377
|
-
// that outlived the connection would keep a supposedly closed process alive.
|
|
378
309
|
await this.subagent.shutdown();
|
|
379
310
|
await this.initialSync?.catch(() => { });
|
|
380
311
|
await this.sync?.close();
|
|
@@ -393,11 +324,7 @@ export class AgentMcpBackend {
|
|
|
393
324
|
throw new AgentMcpError('AUTH_REQUIRED', 'Sign in to your Andorra Code account to edit graphs.');
|
|
394
325
|
if (!/^[A-Za-z0-9-]{1,128}$/.test(before.subject))
|
|
395
326
|
throw new AgentMcpError('AUTH_REQUIRED', 'The signed-in account has an invalid graph storage identity. Sign in again.');
|
|
396
|
-
// A paid verdict is scoped to the exact subject returned by /me. Checking
|
|
397
|
-
// paid first and reading whichever account is current afterwards would let
|
|
398
|
-
// a concurrent login switch open another account's graph directory.
|
|
399
327
|
const membership = await (this.options.membershipStatus ?? getMembership)();
|
|
400
|
-
// A free account edits its one custom graph; the allowance is enforced when a draft is published.
|
|
401
328
|
if (!membership.paid && !membership.subject)
|
|
402
329
|
throw PaidMembershipRequiredError.for(membership);
|
|
403
330
|
if (!membership.subject || membership.subject !== before.subject)
|
|
@@ -413,9 +340,6 @@ export class AgentMcpBackend {
|
|
|
413
340
|
}
|
|
414
341
|
const key = access.directory + '\0' + (access.subject ?? '');
|
|
415
342
|
if (this.accessKey !== key) {
|
|
416
|
-
// Set up the *shared* initialization promise synchronously before any await.
|
|
417
|
-
// Concurrent list/get requests must all observe the same completed sync, not
|
|
418
|
-
// treat a matching accessKey as proof that cloud restore finished.
|
|
419
343
|
const previous = this.sync;
|
|
420
344
|
this.accessKey = key;
|
|
421
345
|
this.drafts.clear();
|
|
@@ -441,9 +365,6 @@ export class AgentMcpBackend {
|
|
|
441
365
|
await initialization;
|
|
442
366
|
}
|
|
443
367
|
catch (error) {
|
|
444
|
-
// An initialization failure must not poison this account for the lifetime
|
|
445
|
-
// of the MCP process. Concurrent callers share the same rejected promise,
|
|
446
|
-
// but only the owner of that promise clears it and closes the failed sync.
|
|
447
368
|
if (this.accessKey === key && this.initialSync === initialization) {
|
|
448
369
|
const failedSync = this.sync;
|
|
449
370
|
this.accessKey = undefined;
|
|
@@ -462,8 +383,6 @@ export class AgentMcpBackend {
|
|
|
462
383
|
}
|
|
463
384
|
return access;
|
|
464
385
|
}
|
|
465
|
-
/** Graph storage is account-owned. Verify identity again after filesystem awaits
|
|
466
|
-
* and before releasing any graph data to an MCP caller. */
|
|
467
386
|
async assertGraphIdentity(access) {
|
|
468
387
|
if (this.options.graphAccess)
|
|
469
388
|
return;
|
|
@@ -486,19 +405,15 @@ export class AgentMcpBackend {
|
|
|
486
405
|
}
|
|
487
406
|
async providers() {
|
|
488
407
|
const config = await (this.options.providerConfig ? this.options.providerConfig() : loadConfig(this.directory));
|
|
489
|
-
|
|
408
|
+
// `models` travels with the profile because a subagent may pin any model the profile lists,
|
|
409
|
+
// not only its default; without it validation rejects a graph the app itself runs.
|
|
410
|
+
return { providers: config.providers.map(({ id, model, type, models }) => ({ id, model, type, ...(models?.length ? { models: [...models] } : {}) })), active: config.provider };
|
|
490
411
|
}
|
|
491
|
-
/**
|
|
492
|
-
* Soft-delete or restore: publish the next revision with metadata.deletedAt set or removed.
|
|
493
|
-
*
|
|
494
|
-
* The revision goes through the same save path as a publish, so free-tier rules and the optimistic
|
|
495
|
-
* revision check apply unchanged, and cloud sync carries the marker to every machine.
|
|
496
|
-
*/
|
|
497
412
|
async setDeleted(deleting, args, access, beforeSave) {
|
|
498
413
|
const tool = deleting ? 'andorra_graph_delete' : 'andorra_graph_restore';
|
|
499
414
|
const id = field(args, 'id');
|
|
500
415
|
if (id === 'default' || id.includes(':'))
|
|
501
|
-
throw new AgentMcpError('DEFAULT_GRAPH', 'The bundled Default graph
|
|
416
|
+
throw new AgentMcpError('DEFAULT_GRAPH', 'The bundled Default graph cannot be deleted or restored.');
|
|
502
417
|
if (!safeId(id))
|
|
503
418
|
throw new AgentMcpError('INVALID_GRAPH_ID', 'Graph id must be a safe identifier of 1-80 characters.');
|
|
504
419
|
if (Object.keys(args).some(key => !['id', 'expectedRevision', ...(deleting ? ['confirm'] : [])].includes(key)))
|
|
@@ -508,7 +423,6 @@ export class AgentMcpBackend {
|
|
|
508
423
|
throw new AgentMcpError('INVALID_ARGUMENTS', 'expectedRevision must be the positive revision andorra_graph_get or andorra_graphs_list reported.');
|
|
509
424
|
if (deleting && args.confirm !== id)
|
|
510
425
|
throw new AgentMcpError('CONFIRMATION_MISMATCH', 'confirm must repeat the graph id ' + id + '. Ask the user to confirm the deletion in chat first.');
|
|
511
|
-
// Bring in a revision another machine published, so the revision check compares against it.
|
|
512
426
|
await this.sync?.sync();
|
|
513
427
|
const latest = await this.readGraph(id, access.directory);
|
|
514
428
|
await this.assertGraphIdentity(access);
|
|
@@ -519,7 +433,6 @@ export class AgentMcpBackend {
|
|
|
519
433
|
if (!deleting && !isDeletedGraph(latest))
|
|
520
434
|
throw new AgentMcpError('GRAPH_NOT_DELETED', 'Graph ' + id + ' is not deleted, so there is nothing to restore.');
|
|
521
435
|
if (deleting) {
|
|
522
|
-
// An automation would fail at its next run; the user decides what it runs instead.
|
|
523
436
|
const users = (await new AutomationStore(this.directory).list()).filter(job => job.execution?.graph === id);
|
|
524
437
|
if (users.length)
|
|
525
438
|
throw new AgentMcpError('GRAPH_IN_USE', 'Graph ' + id + ' is run by automation'
|
|
@@ -538,7 +451,6 @@ export class AgentMcpBackend {
|
|
|
538
451
|
beforeSave?.();
|
|
539
452
|
const saved = freshAccess.free ? await saveFreeTierGraph(next, latest.revision, access.directory)
|
|
540
453
|
: await saveGraph(next, latest.revision, access.directory);
|
|
541
|
-
// A draft of a deleted graph could only publish over the deletion.
|
|
542
454
|
if (deleting)
|
|
543
455
|
for (const [key, draft] of this.drafts)
|
|
544
456
|
if (draft.graph.id === id && draft.directory === access.directory)
|
|
@@ -549,7 +461,6 @@ export class AgentMcpBackend {
|
|
|
549
461
|
? { id, revision: saved.revision, deletedAt, note: freshAccess.free ? note + ' A deleted graph still counts as this free account\'s one custom graph; restore it to use it again.' : note }
|
|
550
462
|
: { id, revision: saved.revision, note };
|
|
551
463
|
}
|
|
552
|
-
/** Missing graph identity is not a broken graph. Tell the agent to list or create it. */
|
|
553
464
|
async readGraph(id, directory, revision) {
|
|
554
465
|
try {
|
|
555
466
|
return await loadGraph(id, revision, directory);
|
|
@@ -577,8 +488,6 @@ export class AgentMcpBackend {
|
|
|
577
488
|
&& Object.values(proposedNodes).some(item => item.type === 'agent' && item.agentRole === 'orchestrator');
|
|
578
489
|
if (Object.keys(proposedNodes).length > (hasOrchestrator ? 101 : 100))
|
|
579
490
|
throw new AgentMcpError('NODE_LIMIT', 'A graph supports at most 100 nodes plus one version-3 Orchestrator. Remove a node before adding another.');
|
|
580
|
-
// A card the draft did not have yet is kept off the others; a card that exists stays where it is
|
|
581
|
-
// put, so an edit never moves the user's layout.
|
|
582
491
|
let placed;
|
|
583
492
|
if (!Object.hasOwn(draft.graph.nodes, node.id)) {
|
|
584
493
|
const spot = placeNewNode(node, Object.values(draft.graph.nodes));
|
|
@@ -605,8 +514,9 @@ export class AgentMcpBackend {
|
|
|
605
514
|
throw new AgentMcpError('EDGE_TARGET_MISSING', 'Target node ' + value.target + ' does not exist.', { nodeId: value.target });
|
|
606
515
|
const ports = nodeOutcomes(source);
|
|
607
516
|
const outcome = value.outcome === undefined ? ports.length === 1 ? ports[0] : undefined : value.outcome;
|
|
608
|
-
|
|
609
|
-
|
|
517
|
+
const routable = [...ports, ...optionalOutcomes(source)];
|
|
518
|
+
if (typeof outcome !== 'string' || !routable.includes(outcome))
|
|
519
|
+
throw new AgentMcpError('EDGE_OUTCOME_INVALID', 'Node ' + source.id + ': specify a valid outcome (' + routable.join(', ') + ').', { nodeId: source.id, port: typeof outcome === 'string' ? outcome : undefined });
|
|
610
520
|
const id = value.id === undefined ? randomUUID() : value.id;
|
|
611
521
|
if (!safeId(id))
|
|
612
522
|
throw new AgentMcpError('EDGE_INVALID', 'Edge id must be a safe identifier.');
|
|
@@ -621,12 +531,6 @@ export class AgentMcpBackend {
|
|
|
621
531
|
draft.graph.edges[index] = edge;
|
|
622
532
|
return { edge, edgeCount: draft.graph.edges.length };
|
|
623
533
|
}
|
|
624
|
-
/**
|
|
625
|
-
* Run one tool call. `beforeSave` runs synchronously immediately before a revision is written
|
|
626
|
-
* (publish, delete, restore), after every await that precedes the write; throwing from it abandons
|
|
627
|
-
* the save. An embedding host uses it to refuse a save its task may no longer make (cancelled, or
|
|
628
|
-
* switched to Plan) while the call was waiting on sign-in checks or cloud sync.
|
|
629
|
-
*/
|
|
630
534
|
async call(name, rawArgs = {}, options = {}) {
|
|
631
535
|
try {
|
|
632
536
|
return { ok: true, data: await this.dispatch(name, argsRecord(rawArgs), options.beforeSave) };
|
|
@@ -649,8 +553,6 @@ export class AgentMcpBackend {
|
|
|
649
553
|
return { ok: false, error: { code: error.code, message: error.message,
|
|
650
554
|
...error.info } };
|
|
651
555
|
}
|
|
652
|
-
// These failures can come from non-graph MCP tools (project/session/provider
|
|
653
|
-
// discovery). Only graphIssues should label a validation exception GRAPH_INVALID.
|
|
654
556
|
return { ok: false, error: backendIssue(error) };
|
|
655
557
|
}
|
|
656
558
|
}
|
|
@@ -665,8 +567,6 @@ export class AgentMcpBackend {
|
|
|
665
567
|
const query = { ...args };
|
|
666
568
|
if (args.status !== undefined)
|
|
667
569
|
throw new AgentMcpError('INVALID_ARGUMENTS', 'andorra_sessions_attention does not take status; it returns all sessions needing attention.');
|
|
668
|
-
// One locked snapshot and crash index for the entire paged scan. A
|
|
669
|
-
// concurrent query's pruning cannot change what later pages report.
|
|
670
570
|
const { sessions, truncated } = await scanAgentSessions(this.directory, query, {
|
|
671
571
|
...(this.options.sessionStore === undefined ? {} : { store: this.options.sessionStore }),
|
|
672
572
|
pageSize: 100, maxSessions: 500,
|
|
@@ -685,12 +585,8 @@ export class AgentMcpBackend {
|
|
|
685
585
|
}
|
|
686
586
|
if (name === 'andorra_providers_list')
|
|
687
587
|
return this.providers();
|
|
688
|
-
// Subagent runs need no account or membership: they execute the bundled Andorra Agent
|
|
689
|
-
// harness with a locally configured provider, the same tier as provider discovery.
|
|
690
588
|
if (name === 'andorra_subagent_start') {
|
|
691
589
|
const task = field(args, 'prompt');
|
|
692
|
-
// The prompt is bounded before the open record and the session are created: an accidentally
|
|
693
|
-
// enormous one would otherwise fill the installation's storage and the model's context.
|
|
694
590
|
if (task.length > MAX_SUBAGENT_TASK_CHARS) {
|
|
695
591
|
throw new AgentMcpError('INVALID_ARGUMENTS', `The task must be at most ${MAX_SUBAGENT_TASK_CHARS} characters.`);
|
|
696
592
|
}
|
|
@@ -711,11 +607,7 @@ export class AgentMcpBackend {
|
|
|
711
607
|
throw new AgentMcpError('INVALID_ARGUMENTS', error instanceof Error ? error.message : String(error));
|
|
712
608
|
}
|
|
713
609
|
try {
|
|
714
|
-
// The startup recovery finishes first: a start must not land beside a crashed attempt that
|
|
715
|
-
// still claims to be live.
|
|
716
610
|
await this.recovery;
|
|
717
|
-
// The connection may have closed while this call was preparing. A run that begins now
|
|
718
|
-
// would outlive the connection that asked for it.
|
|
719
611
|
if (this.closed)
|
|
720
612
|
throw new AgentMcpError('INVALID_ARGUMENTS', 'The connection to Andorra closed before the run started.');
|
|
721
613
|
this.starting += 1;
|
|
@@ -734,12 +626,8 @@ export class AgentMcpBackend {
|
|
|
734
626
|
catch (error) {
|
|
735
627
|
if (error instanceof SubagentProviderNotSetError)
|
|
736
628
|
throw new AgentMcpError('PROVIDER_NOT_SET', error.message, { providers: error.providers });
|
|
737
|
-
// The caller's own choice was wrong, and it can read that: a generic backend error
|
|
738
|
-
// would leave it guessing which identifier to correct.
|
|
739
629
|
if (error instanceof SubagentSelectionError)
|
|
740
630
|
throw new AgentMcpError('INVALID_ARGUMENTS', error.message);
|
|
741
|
-
// A value the run itself refuses — a permission outside the two modes, a model id longer
|
|
742
|
-
// than the configured ones may be — is the caller's own mistake, and the code says so.
|
|
743
631
|
if (error instanceof SubagentInvalidArgumentError)
|
|
744
632
|
throw new AgentMcpError('INVALID_ARGUMENTS', error.message);
|
|
745
633
|
if (error instanceof SubagentRunInProgressError)
|
|
@@ -759,8 +647,6 @@ export class AgentMcpBackend {
|
|
|
759
647
|
if (this.subagent.status().state === 'idle')
|
|
760
648
|
throw new AgentMcpError('NO_RUN', 'No subagent run has been started in this process. Call andorra_subagent_start first.');
|
|
761
649
|
const outcome = await this.subagent.result(waitMs);
|
|
762
|
-
// The id the caller asked about, not the one the process holds now: a run that started while
|
|
763
|
-
// this one was being awaited would label this answer with the wrong run.
|
|
764
650
|
return { ...outcome, runId: args.runId };
|
|
765
651
|
}
|
|
766
652
|
if (name === 'andorra_subagent_cancel') {
|
|
@@ -786,8 +672,6 @@ export class AgentMcpBackend {
|
|
|
786
672
|
if (revision !== undefined && (!Number.isSafeInteger(revision) || typeof revision !== 'number' || revision < 1))
|
|
787
673
|
throw new AgentMcpError('INVALID_ARGUMENTS', 'revision must be a positive safe integer when supplied.');
|
|
788
674
|
const graph = await this.readGraph(field(args, 'id'), access.directory, revision);
|
|
789
|
-
// Read tools return the exact published revision, not an editor migration.
|
|
790
|
-
// Recheck account identity *after* the awaited account-owned filesystem read.
|
|
791
675
|
await this.assertGraphIdentity(access);
|
|
792
676
|
return { graph, ...(isDeletedGraph(graph) ? { deletedAt: graph.metadata.deletedAt } : {}) };
|
|
793
677
|
}
|
|
@@ -826,7 +710,6 @@ export class AgentMcpBackend {
|
|
|
826
710
|
if (error.code !== 'ENOENT')
|
|
827
711
|
throw error;
|
|
828
712
|
}
|
|
829
|
-
// A free account at its graph limit learns so before it builds a draft it cannot publish.
|
|
830
713
|
if (access.free && (await readGraphQuota(access.directory)).customGraphs >= FREE_CUSTOM_GRAPH_LIMIT)
|
|
831
714
|
throw new FreeTierLimitError(FREE_GRAPH_LIMIT_MESSAGE);
|
|
832
715
|
graph = { schemaVersion: 3, id, name: nameValue, revision: 0, entry: '', nodes: {}, edges: [] };
|
|
@@ -834,11 +717,7 @@ export class AgentMcpBackend {
|
|
|
834
717
|
}
|
|
835
718
|
else
|
|
836
719
|
throw new AgentMcpError('INVALID_ARGUMENTS', 'mode must be create or edit.');
|
|
837
|
-
// Edit/create reads account-owned graph data too. A user who signs out
|
|
838
|
-
// during these awaits may not retain a draft containing that graph.
|
|
839
720
|
await this.assertGraphIdentity(access);
|
|
840
|
-
// Awaited graph reads can finish concurrently. Recheck immediately before
|
|
841
|
-
// insertion (no await between check and set) to enforce the 24-draft cap.
|
|
842
721
|
for (const [expiredId, draft] of this.drafts)
|
|
843
722
|
if (Date.now() - draft.touched > 60 * 60_000 && !draft.publishing)
|
|
844
723
|
this.drafts.delete(expiredId);
|
|
@@ -856,16 +735,12 @@ export class AgentMcpBackend {
|
|
|
856
735
|
return { discarded: true };
|
|
857
736
|
}
|
|
858
737
|
const draft = this.obtainDraft(draftId(args), access);
|
|
859
|
-
// Publishing becomes exclusive before the first async provider read. Concurrent mutation
|
|
860
|
-
// requests must never edit a draft while a snapshot is being validated or saved.
|
|
861
738
|
const publishing = name === 'andorra_graph_publish';
|
|
862
739
|
if (publishing)
|
|
863
740
|
draft.publishing = true;
|
|
864
741
|
try {
|
|
865
742
|
if (name === 'andorra_graph_node_upsert') {
|
|
866
743
|
const profiles = await this.providers();
|
|
867
|
-
// Recheck after the await: the draft may have been discarded or entered
|
|
868
|
-
// publication while provider config was loading.
|
|
869
744
|
const current = this.obtainDraft(draftId(args), access);
|
|
870
745
|
return this.upsertNode(current, args.node, profiles.providers.map(item => item.id));
|
|
871
746
|
}
|
|
@@ -874,9 +749,6 @@ export class AgentMcpBackend {
|
|
|
874
749
|
if (!record(args.patch) || Object.keys(args.patch).some(key => key === 'id' || key === 'type'))
|
|
875
750
|
throw new AgentMcpError('INVALID_ARGUMENTS', 'patch must be a node settings object without id or type.');
|
|
876
751
|
const profiles = await this.providers();
|
|
877
|
-
// Always reread the node after the asynchronous provider lookup. Two
|
|
878
|
-
// concurrently submitted patches then each merge with the latest node,
|
|
879
|
-
// preserving unrelated fields instead of overwriting a stale snapshot.
|
|
880
752
|
const currentDraft = this.obtainDraft(draftId(args), access);
|
|
881
753
|
const currentNode = currentDraft.graph.nodes[id];
|
|
882
754
|
if (!currentNode)
|
|
@@ -917,8 +789,6 @@ export class AgentMcpBackend {
|
|
|
917
789
|
return { graphId: draft.graph.id, entry: draft.graph.entry, name: draft.graph.name };
|
|
918
790
|
}
|
|
919
791
|
if (name === 'andorra_graph_validate' || name === 'andorra_graph_publish') {
|
|
920
|
-
// A draft opened before this rule, or a node patch, could still carry the marker; publishing it
|
|
921
|
-
// would delete the graph without the delete tool's confirmation and automation checks.
|
|
922
792
|
if (draft.graph.metadata && Object.hasOwn(draft.graph.metadata, 'deletedAt'))
|
|
923
793
|
throw new AgentMcpError('RESERVED_METADATA', 'metadata.deletedAt is reserved. Delete a graph with andorra_graph_delete and restore it with andorra_graph_restore.');
|
|
924
794
|
const profiles = await this.providers();
|
|
@@ -929,24 +799,15 @@ export class AgentMcpBackend {
|
|
|
929
799
|
throw new AgentMcpError(issues[0].code, issues[0].message, { nodeId: issues[0].nodeId, port: issues[0].port, edgeId: issues[0].edgeId, issues });
|
|
930
800
|
if (Buffer.byteLength(JSON.stringify(draft.graph)) > 512 * 1024)
|
|
931
801
|
throw new AgentMcpError('GRAPH_TOO_LARGE', 'Graph exceeds 512 KiB. Reduce prompt or schema size before publishing.');
|
|
932
|
-
// Refresh the account-scoped graph snapshots before the compare-and-swap. A remote
|
|
933
|
-
// editor may have published after the draft began; this lets its latest revision
|
|
934
|
-
// participate in the same local CAS that protects two editors on one machine.
|
|
935
802
|
await this.sync?.sync();
|
|
936
|
-
// Provider configuration can be edited by another process during a network
|
|
937
|
-
// sync. Validate again against the *current* provider list before publishing.
|
|
938
803
|
if (this.drafts.get(draftId(args)) !== draft)
|
|
939
804
|
throw new AgentMcpError('DRAFT_NOT_FOUND', 'Draft was closed during synchronization. Start a new graph draft.');
|
|
940
|
-
// An account switch can also happen during a long pre-publish cloud sync.
|
|
941
|
-
// Rebind entitlement before touching the immutable revision on disk.
|
|
942
805
|
const freshAccess = await this.graphAccess();
|
|
943
806
|
if (freshAccess.directory !== access.directory || freshAccess.subject !== access.subject)
|
|
944
807
|
throw new AgentMcpError('AUTH_CHANGED', 'Account changed during graph synchronization. Reopen the draft for the current account.');
|
|
945
808
|
if (this.drafts.get(draftId(args)) !== draft)
|
|
946
809
|
throw new AgentMcpError('DRAFT_NOT_FOUND', 'Draft was closed during synchronization. Start a new graph draft.');
|
|
947
810
|
const latestProfiles = await this.providers();
|
|
948
|
-
// Reloading provider config is asynchronous; another process can switch
|
|
949
|
-
// accounts during that read. Recheck immediately before the local save.
|
|
950
811
|
const finalAccess = await this.graphAccess();
|
|
951
812
|
if (finalAccess.directory !== access.directory || finalAccess.subject !== access.subject)
|
|
952
813
|
throw new AgentMcpError('AUTH_CHANGED', 'Account changed while verifying providers. Retry with the current account.');
|
|
@@ -958,16 +819,12 @@ export class AgentMcpBackend {
|
|
|
958
819
|
edgeId: currentIssues[0].edgeId, issues: currentIssues });
|
|
959
820
|
const normalized = validateGraph(draft.graph, { providers: latestProfiles.providers,
|
|
960
821
|
defaultProvider: latestProfiles.active, spawnAvailable: true });
|
|
961
|
-
// Stamping can add profile entries after the submitted graph already passed the size checks.
|
|
962
822
|
const stamped = stampGraphProviderProfiles(normalized, latestProfiles);
|
|
963
823
|
if (Buffer.byteLength(JSON.stringify(stamped)) > 512 * 1024)
|
|
964
824
|
throw new AgentMcpError('VALIDATION_FAILED', 'Graph exceeds 512 KiB after portable provider identities are recorded.');
|
|
965
825
|
beforeSave?.();
|
|
966
826
|
const saved = finalAccess.free ? await saveFreeTierGraph(stamped, draft.expectedRevision, access.directory)
|
|
967
827
|
: await saveGraph(stamped, draft.expectedRevision, access.directory);
|
|
968
|
-
// A re-created graph id must not stay deleted: the editor's save endpoint clears the
|
|
969
|
-
// tombstone after its save, and a publish that reuses a deleted id must too, or the
|
|
970
|
-
// replacement keeps refusing autosaves and its cloud snapshots never restore here.
|
|
971
828
|
await this.sync?.reviveGraph(saved.id);
|
|
972
829
|
draft.graph = saved;
|
|
973
830
|
draft.expectedRevision = saved.revision;
|
|
@@ -983,7 +840,6 @@ export class AgentMcpBackend {
|
|
|
983
840
|
}
|
|
984
841
|
}
|
|
985
842
|
}
|
|
986
|
-
/** The tool names this server advertises; bundled skills that drive it are checked against this list. */
|
|
987
843
|
export { AGENT_MCP_TOOL_NAMES };
|
|
988
844
|
export async function runAgentMcpServer() {
|
|
989
845
|
const backend = new AgentMcpBackend();
|