@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/graphs.js
CHANGED
|
@@ -6,14 +6,8 @@ import { acquireSaveLock, archiveUnpublishedSnapshot, removeLockedFolder, SaveLo
|
|
|
6
6
|
import { validateMappingConstants, validateMappings, validateSchema, validateValue, schemaAt, nodeOutputSchema } from './handoffs.js';
|
|
7
7
|
import { CANONICAL_CODING_TOOLS, canonicalToolName, canonicalizeToolList, toolNameMatches } from './tool-names.js';
|
|
8
8
|
import { DEFAULT_AGENT_GRAPH } from './default-graph.js';
|
|
9
|
-
export const GRAPH_TOOLS = [...CANONICAL_CODING_TOOLS, 'NativeExec', 'AsyncProcess', 'PowerShellFast', 'ShellMetrics', 'read_file', 'list_files', 'search_files', 'write_file', 'edit_file', 'read', 'write', 'edit', 'find', 'grep', 'ls', 'powershell', 'bash', 'shell', 'git_read', 'read_artifact', 'write_artifact', 'repo_explore', 'memory_search', 'set_timer', 'pull_request', 'graphs', 'qa.terminal', 'qa.browser', 'qa.browser_session', 'browser.solve_captcha', 'web_search', 'read_skill_resource', 'browser.panel', 'browser.incognito'];
|
|
10
|
-
/** QA tool names are an explicit allowlist; gating keys off membership, never a name prefix. */
|
|
9
|
+
export const GRAPH_TOOLS = [...CANONICAL_CODING_TOOLS, 'NativeExec', 'AsyncProcess', 'PowerShellFast', 'ShellMetrics', 'read_file', 'list_files', 'search_files', 'write_file', 'edit_file', 'read', 'write', 'edit', 'find', 'grep', 'ls', 'powershell', 'bash', 'shell', 'git_read', 'read_artifact', 'write_artifact', 'repo_explore', 'memory_search', 'set_timer', 'pull_request', 'graphs', 'qa.terminal', 'qa.browser', 'qa.browser_session', 'browser.solve_captcha', 'web_search', 'read_skill_resource', 'browser.panel', 'browser.incognito', 'browser.extensions'];
|
|
11
10
|
export const QA_TOOL_NAMES = ['qa.terminal', 'qa.browser'];
|
|
12
|
-
/**
|
|
13
|
-
* The QA check pipeline, removed: these tools ran lint, tests and a merge gate that the agent's
|
|
14
|
-
* own shell commands already cover, at about two extra requests per run. A saved graph may still
|
|
15
|
-
* list them in a node's tools; they are dropped on load instead of failing the graph.
|
|
16
|
-
*/
|
|
17
11
|
export const RETIRED_GRAPH_TOOLS = new Set(['qa.inspect_project', 'qa.status', 'qa.fast', 'qa.deep', 'qa.test', 'qa.security']);
|
|
18
12
|
export const isQaToolName = (name) => QA_TOOL_NAMES.includes(name);
|
|
19
13
|
export const LEGACY_DEFAULT_HARNESS = {
|
|
@@ -26,14 +20,13 @@ export const LEGACY_DEFAULT_HARNESS = {
|
|
|
26
20
|
done: { id: 'done', name: 'Done', type: 'end', position: { x: 440, y: 120 } },
|
|
27
21
|
}, edges: [{ source: 'engineer', target: 'done' }],
|
|
28
22
|
};
|
|
29
|
-
/** The intake role is configuration for the shared executor, not a separate runtime. */
|
|
30
23
|
export function createOrchestratorNode(id = 'orchestrator') {
|
|
31
24
|
const list = { type: 'array', items: { type: 'string' } };
|
|
32
25
|
return {
|
|
33
26
|
id, name: 'Orchestrator', type: 'agent', agentRole: 'orchestrator', executor: 'react-basic',
|
|
34
27
|
instruction: 'Understand the requested work before delegating implementation. Inspect relevant repository files, components, interfaces, architecture and testing patterns with the available read tools. Ground codebase findings in inspected paths and distinguish evidence from unknowns. Ask the user to clarify requirements, acceptance criteria, design preferences and important tradeoffs before handing work onward; do not infer approval from silence. Summarize the confirmed requirements, design considerations and codebase findings, then produce a concrete task instruction for the next Agent. Research subagents are optional and bounded; use only those that help resolve specific questions. Do not implement or modify the workspace during intake.',
|
|
35
28
|
capabilities: { filesystem: 'read', shell: 'disabled', git: 'read', github: 'none', browser: 'playwright', deployment: 'none' },
|
|
36
|
-
tools: ['read_file', 'list_files', 'search_files', 'git_read', 'read_artifact', 'write_artifact', 'repo_explore', 'read_skill_resource', 'qa.browser_session', 'browser.panel', 'browser.incognito'],
|
|
29
|
+
tools: ['read_file', 'list_files', 'search_files', 'git_read', 'read_artifact', 'write_artifact', 'repo_explore', 'read_skill_resource', 'qa.browser_session', 'browser.panel', 'browser.incognito', 'browser.extensions'],
|
|
37
30
|
completion: { mode: 'single', outcome: 'completed' },
|
|
38
31
|
contextPolicy: { history: true },
|
|
39
32
|
inputs: { originalTask: '$run.input.task' },
|
|
@@ -48,16 +41,6 @@ export const ORCHESTRATOR_HANDOFF = {
|
|
|
48
41
|
originalTask: '$run.input.task', taskInstruction: '$source.output.taskInstruction', requirements: '$source.output.requirements',
|
|
49
42
|
acceptanceCriteria: '$source.output.acceptanceCriteria', designConsiderations: '$source.output.designConsiderations', codebaseFindings: '$source.output.codebaseFindings',
|
|
50
43
|
};
|
|
51
|
-
/**
|
|
52
|
-
* Revision 2 of the bundled harness, frozen exactly as it was published.
|
|
53
|
-
*
|
|
54
|
-
* A published revision is a promise about behavior, so each one is stored as its own snapshot
|
|
55
|
-
* rather than rebuilt from the current builders. Were revision 2 derived from
|
|
56
|
-
* {@link createOrchestratorNode} or from the current harness body, editing either would silently
|
|
57
|
-
* rewrite history and `loadGraph('default', 2)` would stop describing the graph revision 2 always
|
|
58
|
-
* described; the revision-1 graph above is frozen the same way. Do not tidy this into a builder,
|
|
59
|
-
* and publish a new revision rather than editing it.
|
|
60
|
-
*/
|
|
61
44
|
export const DEFAULT_HARNESS_REVISION_2 = {
|
|
62
45
|
schemaVersion: 3, id: "default", name: "Software Engineer", revision: 2, entry: "orchestrator",
|
|
63
46
|
nodes: {
|
|
@@ -67,20 +50,10 @@ export const DEFAULT_HARNESS_REVISION_2 = {
|
|
|
67
50
|
},
|
|
68
51
|
edges: [{ "id": "orchestrator-engineer", "source": "orchestrator", "target": "engineer", "outcome": "completed", "inputMapping": { "originalTask": "$run.input.task", "taskInstruction": "$source.output.taskInstruction", "requirements": "$source.output.requirements", "acceptanceCriteria": "$source.output.acceptanceCriteria", "designConsiderations": "$source.output.designConsiderations", "codebaseFindings": "$source.output.codebaseFindings" } }, { "id": "engineer-done", "source": "engineer", "target": "done", "outcome": "completed" }],
|
|
69
52
|
};
|
|
70
|
-
/**
|
|
71
|
-
* Frozen revision 3 adds one retry for the Orchestrator to the revision-2 snapshot.
|
|
72
|
-
*
|
|
73
|
-
* Intake is read-only and runs many turns, so one transient provider failure must not discard it,
|
|
74
|
-
* and the retry keeps the user's confirmed clarifications. The Engineer writes to the workspace,
|
|
75
|
-
* where re-running a finished attempt could repeat side effects, so it stays single-shot; a graph
|
|
76
|
-
* that wants retries there opts in per node.
|
|
77
|
-
*/
|
|
78
53
|
export const DEFAULT_HARNESS_REVISION_3 = { ...structuredClone(DEFAULT_HARNESS_REVISION_2), revision: 3 };
|
|
79
54
|
DEFAULT_HARNESS_REVISION_3.nodes.orchestrator.retry = { maxAttempts: 2 };
|
|
80
|
-
/** Frozen revision 4 adds skill resources to the published revision-3 snapshot. */
|
|
81
55
|
export const DEFAULT_HARNESS_REVISION_4 = { ...structuredClone(DEFAULT_HARNESS_REVISION_3), revision: 4 };
|
|
82
56
|
DEFAULT_HARNESS_REVISION_4.nodes.orchestrator.tools.push('read_skill_resource');
|
|
83
|
-
/** Frozen revision 5 enables the integrated browser for all default agents. */
|
|
84
57
|
export const DEFAULT_HARNESS_REVISION_5 = {
|
|
85
58
|
schemaVersion: 3, id: 'default', name: 'Software Engineer', revision: 5, entry: 'orchestrator',
|
|
86
59
|
nodes: {
|
|
@@ -89,47 +62,14 @@ export const DEFAULT_HARNESS_REVISION_5 = {
|
|
|
89
62
|
done: { id: 'done', name: 'Done', type: 'end', position: { x: 780, y: 120 } },
|
|
90
63
|
}, edges: [{ id: 'orchestrator-engineer', source: 'orchestrator', target: 'engineer', outcome: 'completed', inputMapping: structuredClone(ORCHESTRATOR_HANDOFF) }, { id: 'engineer-done', source: 'engineer', target: 'done', outcome: 'completed' }],
|
|
91
64
|
};
|
|
92
|
-
/**
|
|
93
|
-
* Revision 6 renames the bundled execution agent to Andorra Agent and widens its role to general
|
|
94
|
-
* tasks alongside coding. The agent still receives the confirmed task instruction through the same
|
|
95
|
-
* intake handoff, and topology, capabilities and tooling are exactly revision 5's, so the change is
|
|
96
|
-
* presentation and instruction only.
|
|
97
|
-
*
|
|
98
|
-
* Revision 6 is frozen and is no longer the latest `default`: it is the body of the paid Andorra
|
|
99
|
-
* preset (`getAndorraHarness`), the Orchestrator -> Andorra Agent -> Done workflow. The graph a
|
|
100
|
-
* Default run executes is {@link DEFAULT_GRAPH}.
|
|
101
|
-
*/
|
|
102
65
|
export const DEFAULT_HARNESS = { ...structuredClone(DEFAULT_HARNESS_REVISION_5), name: 'Andorra Agent', revision: 6 };
|
|
103
66
|
DEFAULT_HARNESS.nodes.engineer.name = 'Andorra Agent';
|
|
104
67
|
DEFAULT_HARNESS.nodes.engineer.instruction = 'Carry out the confirmed task instruction completely, whether it is a coding task or a general one: implement code and verify changes with appropriate tools, and answer general research, writing and analysis directly. Use the supplied requirements, acceptance criteria, design considerations and repository findings to guide the work. Verify the result and report remaining issues.';
|
|
105
|
-
/**
|
|
106
|
-
* Revision 7, the latest `default`: one Andorra Agent and no Orchestrator intake.
|
|
107
|
-
*
|
|
108
|
-
* Selecting Default runs a single agent that cannot delegate (`SOFTWARE_ENGINEER_HARNESS`, built from
|
|
109
|
-
* the same {@link DEFAULT_AGENT_GRAPH} as this revision), while revision 6 put an Orchestrator in front of it. Graph
|
|
110
|
-
* Studio and the graph tools read `default` from here, so they showed a workflow that Default never
|
|
111
|
-
* ran. This revision describes what Default runs; revision 6 remains loadable as history and as the
|
|
112
|
-
* Andorra preset. It is schema version 3 so the editor's migration leaves it as one agent rather than
|
|
113
|
-
* adding an Orchestrator in front of it.
|
|
114
|
-
*/
|
|
115
68
|
export const DEFAULT_GRAPH = {
|
|
116
69
|
schemaVersion: 3, id: 'default', name: DEFAULT_AGENT_GRAPH.name, revision: 7, entry: DEFAULT_AGENT_GRAPH.entry,
|
|
117
70
|
nodes: structuredClone(DEFAULT_AGENT_GRAPH.nodes), edges: structuredClone(DEFAULT_AGENT_GRAPH.edges),
|
|
118
71
|
};
|
|
119
|
-
/** The id of the bundled Graph Manager graph. Reserved: no saved, synced or deleted graph may use it. */
|
|
120
72
|
export const GRAPH_MANAGER_GRAPH_ID = 'andorra-graph-manager';
|
|
121
|
-
/**
|
|
122
|
-
* The graph Graph Studio's Graph Manager chat runs: one top-level agent and no Orchestrator intake.
|
|
123
|
-
*
|
|
124
|
-
* It is built in rather than saved so every installation has it and no account can edit it, and it
|
|
125
|
-
* is hidden from graph lists because it is not a workflow a user selects for a task. The agent
|
|
126
|
-
* sets neither `capabilities` nor `tools`, exactly as the default graph's execution agent: the
|
|
127
|
-
* defaults allow the shell, which is what grants the `graphs` tool, and filesystem reads, which
|
|
128
|
-
* grant `read_skill_resource`. A delegated subagent never receives `graphs`, so the work stays on
|
|
129
|
-
* this node. Its instruction has the agent ask in its reply, with the user's next message as the
|
|
130
|
-
* answer, and the node keeps session history so that message sees the question; as a top-level
|
|
131
|
-
* agent it is also offered `ask_user` wherever a person can answer.
|
|
132
|
-
*/
|
|
133
73
|
export const GRAPH_MANAGER_HARNESS = {
|
|
134
74
|
schemaVersion: 3, id: GRAPH_MANAGER_GRAPH_ID, name: 'Graph Manager', revision: 1, entry: 'manager',
|
|
135
75
|
nodes: {
|
|
@@ -137,30 +77,13 @@ export const GRAPH_MANAGER_HARNESS = {
|
|
|
137
77
|
done: { id: 'done', name: 'Done', type: 'end', position: { x: 440, y: 120 } },
|
|
138
78
|
}, edges: [{ id: 'manager-done', source: 'manager', target: 'done', outcome: 'completed' }],
|
|
139
79
|
};
|
|
140
|
-
/**
|
|
141
|
-
* The configured MCP servers a run of this graph connects at its start.
|
|
142
|
-
*
|
|
143
|
-
* Graph Manager works only through the `graphs` tool and its bundled skill, and its chat runs
|
|
144
|
-
* under Ask for approval, where every server raises a connection prompt before the first reply:
|
|
145
|
-
* its run connects none. Every other graph connects what the user configured.
|
|
146
|
-
*/
|
|
147
80
|
export function graphMcpServers(graphId, servers) {
|
|
148
81
|
return graphId === GRAPH_MANAGER_GRAPH_ID ? {} : servers;
|
|
149
82
|
}
|
|
150
|
-
/** The refusal every path that would write, delete or tombstone the reserved id answers with. */
|
|
151
83
|
export const reservedGraphId = (id) => new Error(`Graph id ${id} is reserved for a built-in graph`);
|
|
152
|
-
/** Upgrade only in-memory copies. Stored snapshots remain unchanged. */
|
|
153
|
-
/**
|
|
154
|
-
* `addOrchestrator: false` upgrades a legacy graph without an Orchestrator to the current schema as it
|
|
155
|
-
* stands, rather than placing an Orchestrator in front of its entry: a free account's graph may not
|
|
156
|
-
* carry one, and inserting it would leave an eligible graph unsavable.
|
|
157
|
-
*/
|
|
158
84
|
export function migrateGraphForEditor(input, options = {}) {
|
|
159
85
|
const graph = validateGraphInternal(input);
|
|
160
86
|
for (const node of Object.values(graph.nodes)) {
|
|
161
|
-
// Assign only when a list exists: writing back undefined would add a `tools: undefined`
|
|
162
|
-
// own property, and the editor's round-trip checks compare the copy against loaded
|
|
163
|
-
// snapshots that never carried the key.
|
|
164
87
|
if (node.tools)
|
|
165
88
|
node.tools = canonicalizeToolList(node.tools);
|
|
166
89
|
if (node.subagents?.roles)
|
|
@@ -207,9 +130,6 @@ export function migrateGraphForEditor(input, options = {}) {
|
|
|
207
130
|
for (let i = 2; Object.hasOwn(graph.nodes, id); i++)
|
|
208
131
|
id = `orchestrator-${i}`;
|
|
209
132
|
const orchestrator = createOrchestratorNode(id);
|
|
210
|
-
// The promoted intake is built after the canonicalization loop above, and the builder
|
|
211
|
-
// must keep the frozen legacy spellings for the published revisions. Rewrite this copy
|
|
212
|
-
// so the editor graph is canonical end to end, and re-migrating it is a no-op.
|
|
213
133
|
if (orchestrator.tools)
|
|
214
134
|
orchestrator.tools = canonicalizeToolList(orchestrator.tools);
|
|
215
135
|
if (orchestrator.subagents?.roles)
|
|
@@ -238,11 +158,6 @@ export function migrateGraphForEditor(input, options = {}) {
|
|
|
238
158
|
return validateGraph(graph);
|
|
239
159
|
}
|
|
240
160
|
const validId = (value) => typeof value === 'string' && /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,79}$/.test(value) && !['constructor', 'prototype', '__proto__'].includes(value);
|
|
241
|
-
/**
|
|
242
|
-
* Outcome names are author-facing phrases rather than identifiers ("FAILED TESTING"), yet
|
|
243
|
-
* they still travel through loop exits, edge routing and criteria keys, so single inner
|
|
244
|
-
* spaces are the only addition over the identifier rules and both ends stay alphanumeric.
|
|
245
|
-
*/
|
|
246
161
|
const validOutcomeName = (value) => typeof value === 'string'
|
|
247
162
|
&& /^[a-zA-Z0-9][a-zA-Z0-9_ -]{0,79}$/.test(value) && !value.endsWith(' ') && !value.includes(' ')
|
|
248
163
|
&& !['constructor', 'prototype', '__proto__'].includes(value);
|
|
@@ -257,31 +172,20 @@ export function intakeCapabilities(node) {
|
|
|
257
172
|
return { filesystem: policy.filesystem === 'none' ? 'none' : 'read', shell: 'disabled',
|
|
258
173
|
git: policy.git === 'none' ? 'none' : 'read', github: 'none', browser: policy.browser, deployment: 'none' };
|
|
259
174
|
}
|
|
260
|
-
/** The second completion outcome of a delegating Orchestrator: subagents did the work and it landed. */
|
|
261
175
|
export const DELIVERED_OUTCOME = 'delivered';
|
|
262
176
|
export function isWritingRole(role) {
|
|
263
177
|
return role.capabilities?.filesystem === 'read-write' || role.capabilities?.git === 'write';
|
|
264
178
|
}
|
|
265
|
-
/** An Orchestrator delegates implementation when spawning is on and at least one role may write. */
|
|
266
179
|
export function delegatesWriting(node) {
|
|
267
180
|
return node.type === 'agent' && node.agentRole === 'orchestrator' && node.subagents?.enabled === true && node.maxSubagents !== 0
|
|
268
181
|
&& (node.subagents.roles ?? []).some(isWritingRole);
|
|
269
182
|
}
|
|
270
|
-
/**
|
|
271
|
-
* The shell setting alone decides whether a node runs commands. Filesystem and Git settings govern
|
|
272
|
-
* their own structured tools (Write/Edit, git writes) and do not take the shell away: a reviewer set
|
|
273
|
-
* to read files but allowed a shell needs `gh pr diff`, and withholding the shell silently left it
|
|
274
|
-
* with instructions it could not follow (run 8a245b0f). Commands still go through the run's approval
|
|
275
|
-
* rules. Ordinary delegated children never run commands; only a delegated-worktree child does.
|
|
276
|
-
*/
|
|
277
183
|
const canRunCommands = (policy, child) => child !== true && policy.shell === 'allowed';
|
|
278
184
|
export function permitsBuiltInTool(node, name, child = false) {
|
|
279
185
|
if (node.tools !== undefined && !node.tools.some(configured => toolNameMatches(configured, name)))
|
|
280
186
|
return false;
|
|
281
187
|
const policy = effectiveCapabilities(node);
|
|
282
188
|
const canonical = canonicalToolName(name);
|
|
283
|
-
// The solve tool only acts on this agent's own qa.browser_session pages, so it follows the same policy;
|
|
284
|
-
// web_search reaches the internet the way the browser does, so the browser policy governs it too.
|
|
285
189
|
if (name === 'qa.browser_session' || name === 'browser.solve_captcha' || name === 'web_search')
|
|
286
190
|
return policy.browser === 'playwright';
|
|
287
191
|
if (['Read', 'Glob', 'Grep', 'repo_explore', 'read_skill_resource'].includes(canonical))
|
|
@@ -292,8 +196,6 @@ export function permitsBuiltInTool(node, name, child = false) {
|
|
|
292
196
|
return canRunCommands(policy, child);
|
|
293
197
|
if (name === 'ShellMetrics')
|
|
294
198
|
return policy.filesystem !== 'none';
|
|
295
|
-
// Every QA tool is part of the command-execution surface: even the read-only
|
|
296
|
-
// pair only makes sense for nodes that can run the QA pipeline itself.
|
|
297
199
|
if (isQaToolName(name))
|
|
298
200
|
return canRunCommands(policy, child);
|
|
299
201
|
if (name === 'git_read')
|
|
@@ -308,6 +210,16 @@ export function capabilitySubset(child, parent) {
|
|
|
308
210
|
return levels.indexOf(child[key]) <= levels.indexOf(parent[key]);
|
|
309
211
|
});
|
|
310
212
|
}
|
|
213
|
+
/** An Action takes this outcome when its command ran to the end and exited non-zero. */
|
|
214
|
+
export const ACTION_FAILED_OUTCOME = 'failed';
|
|
215
|
+
/** Outcomes a node can take that a graph may route but does not have to. */
|
|
216
|
+
export function optionalOutcomes(node) {
|
|
217
|
+
return node.type === 'action' ? [ACTION_FAILED_OUTCOME] : [];
|
|
218
|
+
}
|
|
219
|
+
/** Every outcome a node can leave through in this graph: the required ones, and each optional one that has an edge. */
|
|
220
|
+
function routedOutcomes(node, edges) {
|
|
221
|
+
return [...nodeOutcomes(node), ...optionalOutcomes(node).filter(outcome => edges.some(edge => edge.source === node.id && edge.outcome === outcome))];
|
|
222
|
+
}
|
|
311
223
|
export function nodeOutcomes(node) {
|
|
312
224
|
if (node.type === 'end')
|
|
313
225
|
return [];
|
|
@@ -336,9 +248,7 @@ function guaranteedGraphInvocations(graph) {
|
|
|
336
248
|
for (const node of nodes) {
|
|
337
249
|
if (node.id === boundary)
|
|
338
250
|
continue;
|
|
339
|
-
|
|
340
|
-
// completed route guarantees; once routed it is a real alternative like any other outcome.
|
|
341
|
-
const alternatives = nodeOutcomes(node).filter(outcome => outcome !== DELIVERED_OUTCOME || !delegatesWriting(node) || routes(node.id, outcome).length > 0).map(outcome => {
|
|
251
|
+
const alternatives = routedOutcomes(node, graph.edges).filter(outcome => outcome !== DELIVERED_OUTCOME || !delegatesWriting(node) || routes(node.id, outcome).length > 0).map(outcome => {
|
|
342
252
|
const reached = new Set();
|
|
343
253
|
for (const edge of routes(node.id, outcome))
|
|
344
254
|
for (const id of guaranteed.get(edge.target))
|
|
@@ -380,24 +290,9 @@ export function minimumGraphToolCalls(graph) {
|
|
|
380
290
|
}
|
|
381
291
|
return [...calls.values()].reduce((total, count) => total + count, 0);
|
|
382
292
|
}
|
|
383
|
-
/**
|
|
384
|
-
* Whether a configured tool-call ceiling is at least what the graph needs.
|
|
385
|
-
*
|
|
386
|
-
* An absent ceiling means unlimited, so it always satisfies the minimum. Comparing
|
|
387
|
-
* against the old numeric default instead would read an unset limit as "no budget"
|
|
388
|
-
* and reject a graph that is in fact unbounded.
|
|
389
|
-
* @param configured - the graph's explicit ceiling, or undefined when unlimited.
|
|
390
|
-
* @param minimum - the fewest tool calls the graph provably needs.
|
|
391
|
-
* @returns whether the graph can afford its guaranteed tool calls.
|
|
392
|
-
*/
|
|
393
293
|
function meetsMinimumToolCalls(configured, minimum) {
|
|
394
294
|
return configured === undefined || configured >= minimum;
|
|
395
295
|
}
|
|
396
|
-
/**
|
|
397
|
-
* Raise a graph's explicit tool-call ceiling to the minimum its guaranteed
|
|
398
|
-
* invocations need. An unlimited graph needs no ceiling, so this is a no-op then.
|
|
399
|
-
* @param graph - graph being migrated in place.
|
|
400
|
-
*/
|
|
401
296
|
function raiseGraphToolCallsToMinimum(graph) {
|
|
402
297
|
const configured = graph.limits?.maxToolCalls;
|
|
403
298
|
if (configured === undefined)
|
|
@@ -410,41 +305,15 @@ function bounds(value, label, max = 1_000_000_000, min = 1) {
|
|
|
410
305
|
if (value !== undefined && (!Number.isSafeInteger(value) || value < min || value > max))
|
|
411
306
|
fail(`${label} must be an integer between ${min} and ${max}`);
|
|
412
307
|
}
|
|
413
|
-
/**
|
|
414
|
-
* Erase the explicit `0` spelling of an unlimited deadline-shaped bound.
|
|
415
|
-
*
|
|
416
|
-
* Internally an absent key is the only spelling of unlimited, so the alias is resolved at the
|
|
417
|
-
* one boundary where graph JSON enters rather than making every consumer handle two
|
|
418
|
-
* encodings. A zero tool-call ceiling is untouched: there it genuinely means "no calls".
|
|
419
|
-
* @param holder - the object owning the limit.
|
|
420
|
-
* @param key - the limit key to normalize.
|
|
421
|
-
*/
|
|
422
308
|
function normalizeUnlimited(holder, key) {
|
|
423
309
|
const limits = holder;
|
|
424
310
|
if (limits[key] === 0)
|
|
425
311
|
delete limits[key];
|
|
426
312
|
}
|
|
427
|
-
/**
|
|
428
|
-
* The visit ceiling a graph enforces on each node, or `Infinity` when it enforces none.
|
|
429
|
-
*
|
|
430
|
-
* Node visits are unlimited unless a graph says otherwise: the setting's default is `0`, and a
|
|
431
|
-
* `0` is normalized away, so an absent limit is the single internal spelling of "no ceiling".
|
|
432
|
-
* @param graph - the graph whose limits apply.
|
|
433
|
-
* @returns the maximum visits per node, or Infinity when visits are unbounded.
|
|
434
|
-
*/
|
|
435
313
|
export function maxNodeVisitsOf(graph) {
|
|
436
314
|
const limit = graph.limits?.maxNodeVisits;
|
|
437
315
|
return limit === undefined || limit === 0 ? Infinity : limit;
|
|
438
316
|
}
|
|
439
|
-
/**
|
|
440
|
-
* Whether a graph's run is bounded well enough for a return connection to terminate.
|
|
441
|
-
*
|
|
442
|
-
* A cycle repeats the same agents until something stops it. Visits are unlimited by default, so
|
|
443
|
-
* a cycle needs a ceiling of its own: a finite visit count, or the run's wall clock, which
|
|
444
|
-
* advances whatever the agents do.
|
|
445
|
-
* @param graph - the validated graph.
|
|
446
|
-
* @returns whether the graph bounds how long its cycles may run.
|
|
447
|
-
*/
|
|
448
317
|
function hasRunCeiling(graph) {
|
|
449
318
|
return graph.limits?.maxNodeVisits !== undefined || graph.limits?.wallTimeMs !== undefined;
|
|
450
319
|
}
|
|
@@ -496,13 +365,6 @@ function toolsValid(value, label) {
|
|
|
496
365
|
fail(`${label}: tools must be unique supported tool names`);
|
|
497
366
|
}
|
|
498
367
|
export function validateGraph(value, options = {}) { return validateGraphInternal(value, options); }
|
|
499
|
-
/**
|
|
500
|
-
* The agent nodes a run can reach after this node, nearest first, without the node itself.
|
|
501
|
-
*
|
|
502
|
-
* Every outgoing edge counts whatever its outcome, so the list is what may run after the node,
|
|
503
|
-
* not what will: a node told what later nodes exist leaves their work to them rather than doing
|
|
504
|
-
* it early. A node a loop leads back to is still excluded, because it is this node.
|
|
505
|
-
*/
|
|
506
368
|
export function laterAgentNodes(graph, nodeId) {
|
|
507
369
|
const seen = new Set([nodeId]);
|
|
508
370
|
const later = [];
|
|
@@ -520,35 +382,14 @@ export function laterAgentNodes(graph, nodeId) {
|
|
|
520
382
|
}
|
|
521
383
|
return later;
|
|
522
384
|
}
|
|
523
|
-
/**
|
|
524
|
-
* Whether a node's name says it tests the change: "QA Tester", "Test runner", "Verifier".
|
|
525
|
-
*
|
|
526
|
-
* Graphs declare no testing role, so the name is the evidence a graph author gives; a name that
|
|
527
|
-
* does not say so is treated as not testing, which leaves the node's predecessors told to verify
|
|
528
|
-
* their own work as before.
|
|
529
|
-
*/
|
|
530
385
|
export function isTestingNode(node) {
|
|
531
386
|
return /\b(?:qa|tests?|tester|testing|verif(?:y|ier|ication))\b/i.test(node.name ?? '');
|
|
532
387
|
}
|
|
533
|
-
/**
|
|
534
|
-
* The testing node this node's work is sure to pass through: every outcome the node can complete
|
|
535
|
-
* with routes, along every path, through a testing node before the run can end. Absent when any
|
|
536
|
-
* route can finish untested — a delegating Orchestrator's `delivered` edge straight to Done, an
|
|
537
|
-
* outcome no edge handles (this node's or any node's on the way), or a branch that reaches an end
|
|
538
|
-
* first — because a node told to leave
|
|
539
|
-
* the running app to a tester must not be one whose work can ship without that tester.
|
|
540
|
-
*
|
|
541
|
-
* A path that leads back to the node itself is not an escape: the node runs again and its own
|
|
542
|
-
* routes are the ones being checked.
|
|
543
|
-
*/
|
|
544
388
|
export function testerOnEveryRoute(graph, nodeId) {
|
|
545
389
|
const node = graph.nodes[nodeId];
|
|
546
390
|
if (node === undefined)
|
|
547
391
|
return undefined;
|
|
548
|
-
|
|
549
|
-
// outcome is the `completed` route. A declared outcome with no edge is an empty route, which ends
|
|
550
|
-
// the run there (a graph saved with `requireRoutes: false` may leave one unconnected).
|
|
551
|
-
const routes = (id, of) => nodeOutcomes(of).map(outcome => (graph.edges ?? []).filter(edge => edge.source === id && (edge.outcome ?? 'completed') === outcome).map(edge => edge.target));
|
|
392
|
+
const routes = (id, of) => routedOutcomes({ ...of, id }, graph.edges ?? []).map(outcome => (graph.edges ?? []).filter(edge => edge.source === id && (edge.outcome ?? 'completed') === outcome).map(edge => edge.target));
|
|
552
393
|
const seen = new Set([nodeId]);
|
|
553
394
|
const stack = [];
|
|
554
395
|
for (const targets of routes(nodeId, node)) {
|
|
@@ -569,7 +410,6 @@ export function testerOnEveryRoute(graph, nodeId) {
|
|
|
569
410
|
tester ??= next.name;
|
|
570
411
|
continue;
|
|
571
412
|
}
|
|
572
|
-
// Every outcome of a node on the way counts, not only the ones the graph happened to connect.
|
|
573
413
|
const nextRoutes = routes(id, next);
|
|
574
414
|
if (nextRoutes.length === 0 || nextRoutes.some(targets => targets.length === 0))
|
|
575
415
|
return undefined;
|
|
@@ -578,16 +418,6 @@ export function testerOnEveryRoute(graph, nodeId) {
|
|
|
578
418
|
}
|
|
579
419
|
return tester;
|
|
580
420
|
}
|
|
581
|
-
/**
|
|
582
|
-
* Whether a run of this graph can execute the session's own provider/model pair.
|
|
583
|
-
*
|
|
584
|
-
* An agent node that omits its provider resolves against the live session pair, so the run's own
|
|
585
|
-
* adapter is reachable and its metadata has to be resolved. When every agent node names its own
|
|
586
|
-
* provider, every model call resolves against that node's provider instead — this is the same
|
|
587
|
-
* predicate the desktop's model-pinning read applies when it hides the session model controls —
|
|
588
|
-
* and a run of the graph cannot consult the session pair at all. A graph with no agent node leaves
|
|
589
|
-
* it unused as well.
|
|
590
|
-
*/
|
|
591
421
|
export function graphLeavesNodesToSession(graph) {
|
|
592
422
|
const agents = Object.values(graph?.nodes ?? {}).filter(node => node.type === 'agent');
|
|
593
423
|
return agents.length === 0 || agents.some(node => node.provider === undefined);
|
|
@@ -617,8 +447,6 @@ function validateGraphInternal(value, options = {}) {
|
|
|
617
447
|
if (graph.metadata !== undefined) {
|
|
618
448
|
if (!record(graph.metadata))
|
|
619
449
|
fail('graph metadata must be an object');
|
|
620
|
-
// Studio layout data has a dedicated versioned key; metadata.groups was
|
|
621
|
-
// previously unrestricted extension data and must not be reinterpreted.
|
|
622
450
|
const groups = graph.metadata.studioLayoutGroupsV1;
|
|
623
451
|
if (groups !== undefined) {
|
|
624
452
|
if (!Array.isArray(groups) || groups.length > 50)
|
|
@@ -639,10 +467,6 @@ function validateGraphInternal(value, options = {}) {
|
|
|
639
467
|
}
|
|
640
468
|
}
|
|
641
469
|
}
|
|
642
|
-
// A zero tool-call ceiling is valid: it permits a node to complete without tools while
|
|
643
|
-
// refusing any call. The runtime accepts it, so the validator must too, or a graph the
|
|
644
|
-
// editor offers to save cannot be saved. A zero wall time, iteration or node-visit ceiling
|
|
645
|
-
// is a different thing — the explicit spelling of unlimited — and is normalized away below.
|
|
646
470
|
if (graph.limits !== undefined) {
|
|
647
471
|
if (!record(graph.limits))
|
|
648
472
|
fail('limits must be an object');
|
|
@@ -766,9 +590,6 @@ function validateGraphInternal(value, options = {}) {
|
|
|
766
590
|
fail(`${label}: node limits are supported only on Agent nodes; remove them and use graph limits (or loop.maxIterations for a Loop)`);
|
|
767
591
|
if (node.agentRole === 'orchestrator')
|
|
768
592
|
validateOrchestratorContracts(node, label);
|
|
769
|
-
// `maxTokens` is accepted but ignored: graphs saved before the cumulative token
|
|
770
|
-
// ceiling was removed still carry it, and rejecting an unknown key would make those
|
|
771
|
-
// graphs fail to load instead of simply dropping a setting that no longer applies.
|
|
772
593
|
if (node.limits !== undefined) {
|
|
773
594
|
if (!record(node.limits))
|
|
774
595
|
fail(`${label}: limits must be an object`);
|
|
@@ -877,8 +698,6 @@ function validateGraphInternal(value, options = {}) {
|
|
|
877
698
|
const s = node.subagents;
|
|
878
699
|
if (!record(s) || typeof s.enabled !== 'boolean')
|
|
879
700
|
fail(`${label}: subagents.enabled must be boolean`);
|
|
880
|
-
// The two subagent token budgets are accepted but ignored for the same reason as
|
|
881
|
-
// node maxTokens: previously saved graphs must keep loading.
|
|
882
701
|
for (const key of Object.keys(s)) {
|
|
883
702
|
if (key === 'maxTokensPerSubagent' || key === 'maxCombinedTokens')
|
|
884
703
|
continue;
|
|
@@ -924,8 +743,6 @@ function validateGraphInternal(value, options = {}) {
|
|
|
924
743
|
fail(`${label}: task-only context cannot supply required inputs for role ${r.id}; select selected context or make the role inputs optional`);
|
|
925
744
|
if (r.capabilities)
|
|
926
745
|
capabilities(r.capabilities, `${label} role ${r.id}`);
|
|
927
|
-
// A writing role on an Orchestrator is a delegated one: delegatesWriting(node) && isWritingRole(r),
|
|
928
|
-
// spelled out per role so that roles not yet shape-checked by this loop are never inspected.
|
|
929
746
|
const delegated = node.agentRole === 'orchestrator' && spawningEnabled && isWritingRole(r);
|
|
930
747
|
if (delegated && (s.workspace ?? 'shared-read-only') !== 'worktree')
|
|
931
748
|
fail(`${label}: writing roles on an Orchestrator require separate worktrees; set subagents.workspace to "worktree" (Separate Git worktree)`);
|
|
@@ -933,13 +750,10 @@ function validateGraphInternal(value, options = {}) {
|
|
|
933
750
|
fail(`${label}: Orchestrator delegation needs a single completion outcome; remove declared outcomes or the writing roles`);
|
|
934
751
|
if (delegated && node.completion?.mode === 'single' && node.completion.outcome === DELIVERED_OUTCOME)
|
|
935
752
|
fail(`${label}: the outcome name ${DELIVERED_OUTCOME} is reserved for Orchestrator delegation; rename the completion outcome`);
|
|
936
|
-
// Two ceilings: the Orchestrator itself and its read-only roles stay under the intake ceiling;
|
|
937
|
-
// a delegated writing role is measured against the node's configured capabilities.
|
|
938
753
|
const parent = node.agentRole === 'orchestrator' && spawningEnabled && !delegated ? intakeCapabilities(node) : effectiveCapabilities(node);
|
|
939
754
|
const child = r.capabilities ?? { ...parent, ...((s.workspace ?? 'shared-read-only') === 'shared-read-only' ? { filesystem: parent.filesystem === 'none' ? 'none' : 'read', git: parent.git === 'none' ? 'none' : 'read', shell: 'disabled' } : {}) };
|
|
940
755
|
if (!capabilitySubset(child, parent))
|
|
941
756
|
fail(`${label}: role ${r.id} capability exceeds parent${node.agentRole === 'orchestrator' && !delegated ? ' intake read-only ceiling; reduce child permissions' : '; reduce child permissions or explicitly grant them to the parent'}`);
|
|
942
|
-
// The delegation ceiling is the node's capabilities alone: the Orchestrator's own tool list is its intake kit.
|
|
943
757
|
if (r.tools?.some(t => !permitsBuiltInTool(delegated ? { capabilities: parent } : { ...node, capabilities: parent }, t)))
|
|
944
758
|
fail(`${label}: role ${r.id} tools exceed effective parent capabilities; reduce its tools or explicitly grant parent permissions`);
|
|
945
759
|
if (r.tools?.some(t => !permitsBuiltInTool({ capabilities: child }, t, delegated ? 'delegated-worktree' : true)))
|
|
@@ -970,7 +784,7 @@ function validateGraphInternal(value, options = {}) {
|
|
|
970
784
|
if (!validId(edge.id) || ids.has(edge.id))
|
|
971
785
|
fail('duplicate/invalid edge id; assign a unique safe identifier');
|
|
972
786
|
ids.add(edge.id);
|
|
973
|
-
if (!nodeOutcomes(graph.nodes[edge.source]).includes(edge.outcome))
|
|
787
|
+
if (!nodeOutcomes(graph.nodes[edge.source]).includes(edge.outcome) && !optionalOutcomes(graph.nodes[edge.source]).includes(edge.outcome))
|
|
974
788
|
fail(`edge ${edge.id}: nonexistent outcome ${edge.outcome}; select a declared output port`);
|
|
975
789
|
if (edge.toInput !== undefined && !validId(edge.toInput))
|
|
976
790
|
fail(`edge ${edge.id}: invalid target input name`);
|
|
@@ -1041,14 +855,11 @@ function validateGraphInternal(value, options = {}) {
|
|
|
1041
855
|
entriesRequired = Math.max(entriesRequired, graph.nodes[outerId].loop.maxIterations);
|
|
1042
856
|
}
|
|
1043
857
|
const minimumVisits = node.loop.maxIterations + entriesRequired;
|
|
1044
|
-
// An unlimited visit budget can always reach the done outcome, so the check is about a
|
|
1045
|
-
// finite cap that is too small to get there.
|
|
1046
858
|
if (maxNodeVisitsOf(graph) < minimumVisits)
|
|
1047
859
|
fail(`Loop ${id}: set graph limits.maxNodeVisits to at least ${minimumVisits} so the body cycle and enclosing reentries can return for the done outcome`);
|
|
1048
860
|
}
|
|
1049
861
|
if (node.type === 'condition' && (node.condition.source === id || canReach(graph.entry, id, node.condition.source)))
|
|
1050
862
|
fail(`Condition ${id}: source ${node.condition.source} must execute on every path before this condition; route through the source first`);
|
|
1051
|
-
// A delegating Orchestrator's delivered port is optional: unrouted, the graph behaves like intake.
|
|
1052
863
|
for (const outcome of nodeOutcomes(node))
|
|
1053
864
|
if (!(node.completion?.mode === 'outcomes' && node.completion.requireRoutes === false) && !(outcome === DELIVERED_OUTCOME && delegatesWriting(node)) && !(outgoing.get(id) ?? []).some(e => e.outcome === outcome))
|
|
1054
865
|
fail(`node ${id}: required outcome ${outcome} has no route; connect its output port`);
|
|
@@ -1056,8 +867,6 @@ function validateGraphInternal(value, options = {}) {
|
|
|
1056
867
|
const edges = (incoming.get(id) ?? []).filter(edge => !edge.bootstrap);
|
|
1057
868
|
if (!edges.length)
|
|
1058
869
|
fail(`Join ${id} needs an incoming branch`);
|
|
1059
|
-
// Like bootstrap entry, direct entry skips the first barrier. Each cyclic
|
|
1060
|
-
// return then advances its own generation, so multiple returns cannot join.
|
|
1061
870
|
if (graph.schemaVersion === 3 && graph.entry === id && edges.length > 1)
|
|
1062
871
|
fail(`Join ${id}: direct-start Join all supports only one ordinary cyclic incoming branch; use Join any or a single return branch`);
|
|
1063
872
|
if (graph.schemaVersion === 3 && edges.some(edge => canReach(graph.entry, edge.source, id)) && edges.some(edge => canReach(id, edge.source)))
|
|
@@ -1075,7 +884,7 @@ function validateGraphInternal(value, options = {}) {
|
|
|
1075
884
|
fail(`Join ${id}: returning Loop ${loopId} advances generations independently of a sibling branch; use Join any or move the Loop before the shared fan-out`);
|
|
1076
885
|
}
|
|
1077
886
|
for (const [ancestorId, ancestor] of entries) {
|
|
1078
|
-
if (
|
|
887
|
+
if (routedOutcomes(ancestor, graph.edges).length < 2)
|
|
1079
888
|
continue;
|
|
1080
889
|
const reaches = (start, target, seen = new Set()) => { if (start === target)
|
|
1081
890
|
return true; if (start === id || start === ancestorId || seen.has(start))
|
|
@@ -1106,14 +915,9 @@ function validateGraphInternal(value, options = {}) {
|
|
|
1106
915
|
if (!['read', 'find', 'grep', 'ls', 'read_file', 'list_files', 'search_files', 'repo_explore'].some(tool => permitsBuiltInTool(orchestrators[0][1], tool)))
|
|
1107
916
|
fail('Orchestrator requires a usable research path; enable a filesystem read tool and filesystem read access');
|
|
1108
917
|
const intake = orchestrators[0][1];
|
|
1109
|
-
// An unlimited iteration ceiling has no upper bound at all, so it satisfies the minimum
|
|
1110
|
-
// trivially. Only an explicit ceiling that is too small can fail this check; treating an
|
|
1111
|
-
// absent bound as `3` would have made the check pass for the wrong reason.
|
|
1112
918
|
const intakeIterations = [intake.maxIterations, intake.limits?.maxIterations].filter((value) => typeof value === 'number' && value > 0);
|
|
1113
919
|
if (intakeIterations.length && Math.min(...intakeIterations) < 3)
|
|
1114
920
|
fail('Orchestrator requires at least three model iterations; raise maxIterations or limits.maxIterations for research, clarification and completion, or leave them unset for no ceiling; todo-only turns have a separate budget');
|
|
1115
|
-
// An absent ceiling is unlimited, which satisfies the Orchestrator minimum; only
|
|
1116
|
-
// an explicit ceiling that is too small fails.
|
|
1117
921
|
if (!meetsMinimumToolCalls(intake.limits?.maxToolCalls, 2))
|
|
1118
922
|
fail('Orchestrator requires at least two tool calls; increase node limits.maxToolCalls for research and ask_user');
|
|
1119
923
|
if (!meetsMinimumToolCalls(graph.limits?.maxToolCalls, 2))
|
|
@@ -1134,25 +938,16 @@ function validateGraphInternal(value, options = {}) {
|
|
|
1134
938
|
export class GraphConflictError extends Error {
|
|
1135
939
|
constructor(message = 'This graph changed in another editor. Reload it before saving.') { super(message); this.name = 'GraphConflictError'; }
|
|
1136
940
|
}
|
|
1137
|
-
/**
|
|
1138
|
-
* A soft-deleted graph: its latest revision carries `metadata.deletedAt`.
|
|
1139
|
-
*
|
|
1140
|
-
* Deleting publishes that revision rather than removing files, because cloud sync restores every graph
|
|
1141
|
-
* an account holds and would bring removed files back. Every earlier revision stays stored.
|
|
1142
|
-
*/
|
|
1143
941
|
export function isDeletedGraph(graph) {
|
|
1144
942
|
return typeof graph.metadata?.deletedAt === 'string' && graph.metadata.deletedAt.length > 0;
|
|
1145
943
|
}
|
|
1146
|
-
/** What a listing shows. Quota is computed from the full list, so deleted graphs still count there. */
|
|
1147
944
|
export function withoutDeletedGraphs(graphs) {
|
|
1148
945
|
return graphs.filter(graph => !isDeletedGraph(graph));
|
|
1149
946
|
}
|
|
1150
|
-
/** A new run named a deleted graph. Resuming a session that already ran it is still allowed. */
|
|
1151
947
|
export class GraphDeletedError extends Error {
|
|
1152
948
|
code = 'GRAPH_DELETED';
|
|
1153
949
|
constructor(name) { super(`Graph ${name} was deleted. Restore it before running it.`); this.name = 'GraphDeletedError'; }
|
|
1154
950
|
}
|
|
1155
|
-
/** Whether the folder holds a published graph: a save's latest pointer or any numbered revision. */
|
|
1156
951
|
async function publishedRevision(folder) {
|
|
1157
952
|
try {
|
|
1158
953
|
await readFile(join(folder, 'latest.json'), 'utf8');
|
|
@@ -1172,13 +967,6 @@ async function publishedRevision(folder) {
|
|
|
1172
967
|
return error.code !== 'ENOENT';
|
|
1173
968
|
}
|
|
1174
969
|
}
|
|
1175
|
-
/**
|
|
1176
|
-
* Publish an immutable cloud revision only when the local revision is absent or identical.
|
|
1177
|
-
*
|
|
1178
|
-
* `skip` and `floorOf` are consulted under the folder's save lock immediately before any write:
|
|
1179
|
-
* a graph deleted on this machine must not be written back, and asking while holding the lock
|
|
1180
|
-
* makes those verdicts final against a delete or revival that is still running.
|
|
1181
|
-
*/
|
|
1182
970
|
export async function restoreGraphRevision(input, directory, skip, floorOf) {
|
|
1183
971
|
const graph = validateGraphInternal(input);
|
|
1184
972
|
if (graph.id === 'default' || graph.revision < 1)
|
|
@@ -1191,16 +979,10 @@ export async function restoreGraphRevision(input, directory, skip, floorOf) {
|
|
|
1191
979
|
const temp = join(folder, `latest-${randomUUID()}.tmp`);
|
|
1192
980
|
try {
|
|
1193
981
|
if (skip && await skip(graph)) {
|
|
1194
|
-
// The tombstone is the authority: what this restore finds here is either residue from a
|
|
1195
|
-
// restore that raced the delete — removed under the lock — or a graph a save re-created
|
|
1196
|
-
// after the delete and before the tombstone revival cleared it. Erasing that re-creation
|
|
1197
|
-
// would lose a save that already succeeded, so only an unpublished folder is removed.
|
|
1198
982
|
if (!await publishedRevision(folder))
|
|
1199
983
|
await removeLockedFolder(folder);
|
|
1200
984
|
return { graph, restored: false };
|
|
1201
985
|
}
|
|
1202
|
-
// The latest pointer is read before any write: the floor verdict below needs it, and a
|
|
1203
|
-
// damaged pointer must refuse the restore before the folder receives new content.
|
|
1204
986
|
let current = 0;
|
|
1205
987
|
try {
|
|
1206
988
|
const raw = await readFile(join(folder, 'latest.json'), 'utf8');
|
|
@@ -1217,27 +999,10 @@ export async function restoreGraphRevision(input, directory, skip, floorOf) {
|
|
|
1217
999
|
}
|
|
1218
1000
|
if (!Number.isSafeInteger(current) || current < 0)
|
|
1219
1001
|
throw new GraphConflictError('Invalid latest revision');
|
|
1220
|
-
// A re-created id starts a new lineage. While a deletion floor is recorded for the id, cloud
|
|
1221
|
-
// revisions above the replacement's head never advance its latest pointer: the floor the
|
|
1222
|
-
// deleting machine recorded can sit behind the cloud (another device synced newer revisions
|
|
1223
|
-
// it never pulled), so a revision above the floor is not proof of new-lineage history.
|
|
1224
|
-
// New-lineage snapshots are unaffected — they were restored locally before their upload, so
|
|
1225
|
-
// their revisions never exceed the head. A device with no local graph at all still adopts
|
|
1226
|
-
// revisions above the floor: only what the deleting machine had already seen is known to
|
|
1227
|
-
// belong to the deleted lineage. Everything else stays in the immutable snapshot cache,
|
|
1228
|
-
// which would otherwise make the replacement open as the old graph again.
|
|
1229
1002
|
const floor = floorOf ? await floorOf(graph) : undefined;
|
|
1230
1003
|
if (floor !== undefined && current < graph.revision && (current >= 1 || graph.revision <= floor)) {
|
|
1231
|
-
// A live replacement can still take a later revision of its own lineage: storage pins
|
|
1232
|
-
// metadata.createdAt per lineage (a save takes it from the stored head, never from the
|
|
1233
|
-
// submitted graph), every save of the lineage preserves it, and a foreign lineage cannot
|
|
1234
|
-
// produce it. A snapshot above the head that carries the replacement's creation time is a
|
|
1235
|
-
// later edit of the replacement — another device that adopted it and saved — so it advances
|
|
1236
|
-
// the pointer like any save. Anything else belongs to the deleted lineage the floor keeps
|
|
1237
|
-
// out: the replacement is young, or the revision predates it, or no replacement lives here.
|
|
1238
1004
|
let replacementCreatedAt;
|
|
1239
1005
|
if (current >= 1) {
|
|
1240
|
-
// An unreadable head cannot vouch for any lineage, so the verdict stays refusal.
|
|
1241
1006
|
try {
|
|
1242
1007
|
replacementCreatedAt = JSON.parse(await readFile(join(folder, `${current}.json`), 'utf8'))?.metadata?.createdAt;
|
|
1243
1008
|
}
|
|
@@ -1290,7 +1055,6 @@ export async function loadGraph(id, revision, directory = configDirectory()) {
|
|
|
1290
1055
|
throw new Error('Default graph revision does not exist');
|
|
1291
1056
|
return structuredClone(revision === 1 ? LEGACY_DEFAULT_HARNESS : revision === 2 ? DEFAULT_HARNESS_REVISION_2 : revision === 3 ? DEFAULT_HARNESS_REVISION_3 : revision === 4 ? DEFAULT_HARNESS_REVISION_4 : revision === 5 ? DEFAULT_HARNESS_REVISION_5 : revision === 6 ? DEFAULT_HARNESS : DEFAULT_GRAPH);
|
|
1292
1057
|
}
|
|
1293
|
-
// Built in like `default`: answered before storage is read, so a folder of the same name is never loaded.
|
|
1294
1058
|
if (id === GRAPH_MANAGER_GRAPH_ID) {
|
|
1295
1059
|
if (revision !== undefined && revision !== GRAPH_MANAGER_HARNESS.revision)
|
|
1296
1060
|
throw new Error('Graph Manager graph revision does not exist');
|
|
@@ -1305,6 +1069,16 @@ export async function loadGraph(id, revision, directory = configDirectory()) {
|
|
|
1305
1069
|
throw new Error('Stored graph identity does not match its revision');
|
|
1306
1070
|
return graph;
|
|
1307
1071
|
}
|
|
1072
|
+
const GRAPH_ORDER_FILE = 'order.json';
|
|
1073
|
+
const readGraphOrder = async (directory) => {
|
|
1074
|
+
try {
|
|
1075
|
+
const stored = JSON.parse(await readFile(join(directory, 'graphs', GRAPH_ORDER_FILE), 'utf8'));
|
|
1076
|
+
return Array.isArray(stored) ? stored.filter(item => typeof item === 'string' && validId(item)) : [];
|
|
1077
|
+
}
|
|
1078
|
+
catch {
|
|
1079
|
+
return [];
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1308
1082
|
export async function listGraphs(directory = configDirectory(), onLoadError) {
|
|
1309
1083
|
let entries;
|
|
1310
1084
|
try {
|
|
@@ -1315,17 +1089,54 @@ export async function listGraphs(directory = configDirectory(), onLoadError) {
|
|
|
1315
1089
|
return [structuredClone(DEFAULT_GRAPH)];
|
|
1316
1090
|
throw error;
|
|
1317
1091
|
}
|
|
1318
|
-
const
|
|
1092
|
+
const loaded = new Map();
|
|
1319
1093
|
for (const entry of entries.filter(item => item.isDirectory() && validId(item.name) && item.name !== 'default' && item.name !== GRAPH_MANAGER_GRAPH_ID).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
1320
1094
|
try {
|
|
1321
|
-
|
|
1095
|
+
loaded.set(entry.name, await loadGraph(entry.name, undefined, directory));
|
|
1322
1096
|
}
|
|
1323
1097
|
catch (error) {
|
|
1324
1098
|
onLoadError?.(entry.name, error);
|
|
1325
1099
|
}
|
|
1326
1100
|
}
|
|
1101
|
+
const graphs = [structuredClone(DEFAULT_GRAPH)];
|
|
1102
|
+
const ordered = new Set();
|
|
1103
|
+
for (const id of await readGraphOrder(directory)) {
|
|
1104
|
+
const graph = loaded.get(id);
|
|
1105
|
+
if (!graph)
|
|
1106
|
+
continue;
|
|
1107
|
+
graphs.push(graph);
|
|
1108
|
+
ordered.add(id);
|
|
1109
|
+
}
|
|
1110
|
+
for (const id of [...loaded.keys()].filter(id => !ordered.has(id)).sort((a, b) => a.localeCompare(b)))
|
|
1111
|
+
graphs.push(loaded.get(id));
|
|
1327
1112
|
return graphs;
|
|
1328
1113
|
}
|
|
1114
|
+
export async function saveGraphOrder(order, directory = configDirectory()) {
|
|
1115
|
+
if (!Array.isArray(order))
|
|
1116
|
+
throw new Error('Graph order must be an array of graph ids');
|
|
1117
|
+
const ids = [];
|
|
1118
|
+
for (const id of order) {
|
|
1119
|
+
if (!validId(id))
|
|
1120
|
+
throw new Error('Graph order must be an array of graph ids');
|
|
1121
|
+
if (id === 'default')
|
|
1122
|
+
throw new Error('The bundled default graph is always first; do not include it in the order');
|
|
1123
|
+
if (id === GRAPH_MANAGER_GRAPH_ID)
|
|
1124
|
+
throw reservedGraphId(id);
|
|
1125
|
+
if (!ids.includes(id))
|
|
1126
|
+
ids.push(id);
|
|
1127
|
+
}
|
|
1128
|
+
const folder = join(directory, 'graphs');
|
|
1129
|
+
await mkdir(folder, { recursive: true });
|
|
1130
|
+
const temporary = join(folder, `order-${randomUUID()}.tmp`);
|
|
1131
|
+
try {
|
|
1132
|
+
await writeFile(temporary, JSON.stringify(ids) + '\n', { flag: 'wx', mode: 0o600 });
|
|
1133
|
+
await rename(temporary, join(folder, GRAPH_ORDER_FILE));
|
|
1134
|
+
}
|
|
1135
|
+
finally {
|
|
1136
|
+
await unlink(temporary).catch(() => { });
|
|
1137
|
+
}
|
|
1138
|
+
return ids;
|
|
1139
|
+
}
|
|
1329
1140
|
export async function saveGraph(input, expectedRevision, directory = configDirectory()) {
|
|
1330
1141
|
const graph = validateGraph(input);
|
|
1331
1142
|
if (graph.id === 'default')
|
|
@@ -1361,8 +1172,6 @@ export async function saveGraph(input, expectedRevision, directory = configDirec
|
|
|
1361
1172
|
if ((current?.revision ?? null) !== expectedRevision)
|
|
1362
1173
|
throw new GraphConflictError();
|
|
1363
1174
|
graph.revision = (expectedRevision ?? 0) + 1;
|
|
1364
|
-
// The creation time comes from storage, not the submitted graph: it decides which graph a free
|
|
1365
|
-
// account keeps, so a save cannot move it.
|
|
1366
1175
|
const now = new Date().toISOString();
|
|
1367
1176
|
const createdAt = current ? current.metadata?.createdAt : now;
|
|
1368
1177
|
graph.metadata = { ...graph.metadata, updatedAt: now };
|
|
@@ -1386,16 +1195,6 @@ export async function saveGraph(input, expectedRevision, directory = configDirec
|
|
|
1386
1195
|
await releaseLock();
|
|
1387
1196
|
}
|
|
1388
1197
|
}
|
|
1389
|
-
/**
|
|
1390
|
-
* Remove a saved graph and its whole revision history.
|
|
1391
|
-
*
|
|
1392
|
-
* The save lock serializes against a save or cloud restore of the same graph, so a delete cannot
|
|
1393
|
-
* race one into leaving a half-written folder behind. The folder leaves the live path in one
|
|
1394
|
-
* rename while the lock is held, so a save that lands during the removal writes into a fresh
|
|
1395
|
-
* folder and survives it. Deleting the bundled `default` is refused: it has no storage to remove,
|
|
1396
|
-
* and a hidden preset would only return on the next launch. The built-in Graph Manager graph is
|
|
1397
|
-
* refused for the same reason, by name.
|
|
1398
|
-
*/
|
|
1399
1198
|
export async function deleteGraph(id, directory = configDirectory(), options = {}) {
|
|
1400
1199
|
if (!validId(id) || id === 'default')
|
|
1401
1200
|
throw new Error('Invalid graph id');
|