@andorra-labs/code 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/dist/src/account-presentation.d.ts +1 -37
- package/dist/src/account-presentation.js +2 -42
- package/dist/src/activity.d.ts +0 -25
- package/dist/src/activity.js +1 -23
- package/dist/src/agent-definitions.d.ts +0 -26
- package/dist/src/agent-definitions.js +0 -43
- package/dist/src/agent-execution.d.ts +0 -2
- package/dist/src/agent-execution.js +59 -414
- package/dist/src/agent-mcp-catalog.d.ts +0 -8
- package/dist/src/agent-mcp-catalog.js +0 -2
- package/dist/src/agent-mcp.d.ts +0 -56
- package/dist/src/agent-mcp.js +14 -153
- package/dist/src/agent-modifiers.d.ts +0 -1
- package/dist/src/agent-modifiers.js +25 -68
- package/dist/src/analytics.d.ts +0 -66
- package/dist/src/analytics.js +0 -45
- package/dist/src/anthropic-console-auth.d.ts +0 -24
- package/dist/src/anthropic-console-auth.js +0 -37
- package/dist/src/anthropic-credentials.d.ts +0 -25
- package/dist/src/anthropic-credentials.js +0 -28
- package/dist/src/app-server/protocol.d.ts +19 -244
- package/dist/src/app-server/protocol.js +1 -132
- package/dist/src/app-server/reasoning.d.ts +0 -31
- package/dist/src/app-server/reasoning.js +0 -54
- package/dist/src/app-server/terminal.d.ts +0 -36
- package/dist/src/app-server/terminal.js +3 -39
- package/dist/src/app-server/workspace.d.ts +0 -167
- package/dist/src/app-server/workspace.js +4 -406
- package/dist/src/app-server.d.ts +33 -918
- package/dist/src/app-server.js +608 -2984
- package/dist/src/artifacts.d.ts +0 -10
- package/dist/src/artifacts.js +1 -11
- package/dist/src/attachments.d.ts +4 -98
- package/dist/src/attachments.js +10 -130
- package/dist/src/auth/AuthManager.d.ts +0 -93
- package/dist/src/auth/AuthManager.js +3 -165
- package/dist/src/auth/callback-page.d.ts +0 -1
- package/dist/src/auth/callback-page.js +0 -4
- package/dist/src/auth/callback.d.ts +0 -25
- package/dist/src/auth/callback.js +1 -29
- package/dist/src/auth/deployment.d.ts +0 -16
- package/dist/src/auth/deployment.js +0 -16
- package/dist/src/auth/index.d.ts +0 -11
- package/dist/src/auth/index.js +0 -11
- package/dist/src/auth/lock.d.ts +0 -1
- package/dist/src/auth/lock.js +0 -1
- package/dist/src/auth/store.d.ts +7 -108
- package/dist/src/auth/store.js +21 -129
- package/dist/src/auth/types.d.ts +0 -8
- package/dist/src/auth-commands.d.ts +0 -5
- package/dist/src/auth-commands.js +0 -1
- package/dist/src/automation-runner.d.ts +0 -9
- package/dist/src/automation-runner.js +0 -11
- package/dist/src/automation-service.d.ts +0 -10
- package/dist/src/automation-service.js +3 -17
- package/dist/src/automation-tool.js +0 -5
- package/dist/src/automation-worker-shutdown.d.ts +0 -1
- package/dist/src/automation-worker-shutdown.js +0 -3
- package/dist/src/automations.d.ts +23 -2
- package/dist/src/automations.js +91 -12
- package/dist/src/background-tasks.d.ts +0 -23
- package/dist/src/background-tasks.js +0 -11
- package/dist/src/boot-trace.d.ts +0 -13
- package/dist/src/boot-trace.js +1 -14
- package/dist/src/browser-activity.js +0 -2
- package/dist/src/browser-bridge.d.ts +0 -2
- package/dist/src/browser-bridge.js +0 -27
- package/dist/src/browser-captcha-tool.d.ts +0 -13
- package/dist/src/browser-captcha-tool.js +3 -35
- package/dist/src/browser-extensions-tool.d.ts +24 -0
- package/dist/src/browser-extensions-tool.js +137 -0
- package/dist/src/browser-extensions.d.ts +127 -0
- package/dist/src/browser-extensions.js +729 -0
- package/dist/src/browser-observation.d.ts +0 -15
- package/dist/src/browser-observation.js +1 -22
- package/dist/src/browser-panel-tool.d.ts +10 -25
- package/dist/src/browser-panel-tool.js +64 -60
- package/dist/src/browser-runner.d.ts +0 -1
- package/dist/src/browser-runner.js +7 -46
- package/dist/src/browser-server.d.ts +0 -6
- package/dist/src/browser-server.js +6 -229
- package/dist/src/browser-session.d.ts +0 -25
- package/dist/src/browser-session.js +1 -71
- package/dist/src/browser-stealth.d.ts +0 -12
- package/dist/src/browser-stealth.js +0 -36
- package/dist/src/browser-ui/app.js +7 -174
- package/dist/src/browser-ui/style.css +0 -68
- package/dist/src/browser-ui/tokens.css +11 -93
- package/dist/src/browser-view.d.ts +52 -290
- package/dist/src/browser-view.js +354 -567
- package/dist/src/capabilities.d.ts +0 -8
- package/dist/src/capabilities.js +0 -29
- package/dist/src/capsolver.d.ts +0 -13
- package/dist/src/capsolver.js +0 -15
- package/dist/src/clarification-ui.d.ts +0 -7
- package/dist/src/clarification-ui.js +0 -8
- package/dist/src/claude-executable.d.ts +0 -1
- package/dist/src/claude-executable.js +1 -2
- package/dist/src/claude-provider.d.ts +6 -19
- package/dist/src/claude-provider.js +166 -61
- package/dist/src/cli-executable.d.ts +0 -16
- package/dist/src/cli-executable.js +0 -7
- package/dist/src/cli-process.d.ts +0 -26
- package/dist/src/cli-process.js +0 -18
- package/dist/src/cli-sign-in.d.ts +0 -20
- package/dist/src/cli-sign-in.js +1 -17
- package/dist/src/cli.d.ts +3 -56
- package/dist/src/cli.js +193 -702
- package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +4 -59
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +27 -100
- package/dist/src/code-intelligence/ContextLedger.d.ts +0 -4
- package/dist/src/code-intelligence/ContextLedger.js +0 -10
- package/dist/src/code-intelligence/ContextRouter.d.ts +0 -6
- package/dist/src/code-intelligence/ContextRouter.js +0 -8
- package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.d.ts +0 -2
- package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.js +5 -12
- package/dist/src/code-intelligence/codegraph/CodeGraphProvider.d.ts +0 -6
- package/dist/src/code-intelligence/codegraph/CodeGraphProvider.js +0 -6
- package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.d.ts +0 -5
- package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.js +1 -17
- package/dist/src/code-intelligence/codegraph/repoExploreTool.d.ts +0 -5
- package/dist/src/code-intelligence/codegraph/repoExploreTool.js +0 -5
- package/dist/src/code-intelligence/repository.d.ts +0 -9
- package/dist/src/code-intelligence/repository.js +1 -11
- package/dist/src/code-intelligence/types.d.ts +0 -8
- package/dist/src/codex-auth.d.ts +0 -44
- package/dist/src/codex-auth.js +0 -45
- package/dist/src/codex-browser-auth.d.ts +0 -13
- package/dist/src/codex-browser-auth.js +3 -20
- package/dist/src/codex-errors.js +0 -2
- package/dist/src/codex-executable.d.ts +0 -2
- package/dist/src/codex-executable.js +1 -7
- package/dist/src/codex-provider.d.ts +0 -13
- package/dist/src/codex-provider.js +1 -26
- package/dist/src/codex-rpc.d.ts +0 -10
- package/dist/src/codex-rpc.js +0 -12
- package/dist/src/coding-tools.d.ts +6 -27
- package/dist/src/coding-tools.js +193 -205
- package/dist/src/command-metrics.d.ts +0 -4
- package/dist/src/command-output-tap.d.ts +0 -11
- package/dist/src/command-output-tap.js +0 -3
- package/dist/src/command-screens.d.ts +24 -0
- package/dist/src/command-screens.js +132 -100
- package/dist/src/commands.d.ts +6 -63
- package/dist/src/commands.js +20 -100
- package/dist/src/completion-gates.d.ts +0 -47
- package/dist/src/completion-gates.js +0 -14
- package/dist/src/completion.d.ts +2 -58
- package/dist/src/completion.js +90 -186
- package/dist/src/config.d.ts +12 -116
- package/dist/src/config.js +41 -171
- package/dist/src/context-budget.d.ts +0 -22
- package/dist/src/context-budget.js +0 -44
- package/dist/src/context-compaction.d.ts +29 -6
- package/dist/src/context-compaction.js +94 -25
- package/dist/src/context-selection.d.ts +0 -24
- package/dist/src/context-selection.js +0 -34
- package/dist/src/dashboard-view.d.ts +0 -2
- package/dist/src/dashboard-view.js +0 -35
- package/dist/src/dashboard.d.ts +0 -2
- package/dist/src/dashboard.js +0 -9
- package/dist/src/deadline.d.ts +0 -45
- package/dist/src/deadline.js +0 -54
- package/dist/src/decision/ContinuationAdapter.d.ts +0 -5
- package/dist/src/decision/ContinuationAdapter.js +0 -5
- package/dist/src/decision/DecisionEngine.d.ts +0 -4
- package/dist/src/decision/DecisionManager.d.ts +0 -1
- package/dist/src/decision/DecisionManager.js +2 -7
- package/dist/src/decision/DecisionPolicy.d.ts +0 -1
- package/dist/src/decision/DecisionPolicy.js +0 -1
- package/dist/src/decision/FactContinuations.d.ts +11 -43
- package/dist/src/decision/FactContinuations.js +126 -95
- package/dist/src/decision/FactServiceGate.d.ts +0 -1
- package/dist/src/decision/FactServiceGate.js +0 -4
- package/dist/src/decision/PreparedSteps.d.ts +0 -15
- package/dist/src/decision/PreparedSteps.js +1 -11
- package/dist/src/decision/applyToolMenu.d.ts +0 -1
- package/dist/src/decision/applyToolMenu.js +1 -5
- package/dist/src/decision/checks.d.ts +15 -28
- package/dist/src/decision/checks.js +118 -49
- package/dist/src/decision/facts.d.ts +0 -16
- package/dist/src/decision/facts.js +0 -30
- package/dist/src/decision/guidancePolicy.js +0 -1
- package/dist/src/decision/hostedPolicy.d.ts +0 -6
- package/dist/src/decision/hostedPolicy.js +0 -7
- package/dist/src/decision/hostedSkills.d.ts +0 -19
- package/dist/src/decision/hostedSkills.js +0 -19
- package/dist/src/decision/optimizationPolicy.d.ts +0 -3
- package/dist/src/decision/optimizationPolicy.js +1 -4
- package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +0 -7
- package/dist/src/decision/providers/AndorraDecisionProvider.js +4 -27
- package/dist/src/decision/providers/HttpDecisionProvider.d.ts +0 -2
- package/dist/src/decision/providers/HttpDecisionProvider.js +0 -6
- package/dist/src/decision/routeTools.d.ts +0 -8
- package/dist/src/decision/routeTools.js +1 -8
- package/dist/src/decision/toolFamilies.d.ts +0 -1
- package/dist/src/decision/toolFamilies.js +0 -1
- package/dist/src/decision/toolMenu.d.ts +0 -3
- package/dist/src/decision/toolMenu.js +0 -4
- package/dist/src/decision/types.d.ts +0 -6
- package/dist/src/default-graph.d.ts +0 -9
- package/dist/src/default-graph.js +0 -9
- package/dist/src/delegation-changes.d.ts +0 -56
- package/dist/src/delegation-changes.js +15 -124
- package/dist/src/diff-preview.d.ts +1 -1
- package/dist/src/diff-preview.js +4 -12
- package/dist/src/duration.d.ts +0 -50
- package/dist/src/duration.js +0 -50
- package/dist/src/efficiency.d.ts +0 -39
- package/dist/src/efficiency.js +0 -16
- package/dist/src/engine/protocol.d.ts +0 -2
- package/dist/src/engine/protocol.js +0 -2
- package/dist/src/engine-streams.d.ts +13 -0
- package/dist/src/engine-streams.js +16 -0
- package/dist/src/extensions.d.ts +3 -2
- package/dist/src/extensions.js +76 -37
- package/dist/src/favicons.d.ts +0 -26
- package/dist/src/favicons.js +0 -34
- package/dist/src/file-diff.d.ts +2 -58
- package/dist/src/file-diff.js +0 -32
- package/dist/src/file-read-key.d.ts +1 -0
- package/dist/src/file-read-key.js +5 -0
- package/dist/src/file-read-state.d.ts +0 -1
- package/dist/src/file-read-state.js +0 -4
- package/dist/src/firefox-cookies.d.ts +0 -34
- package/dist/src/firefox-cookies.js +1 -55
- package/dist/src/git-identity-audit.d.ts +27 -0
- package/dist/src/git-identity-audit.js +286 -0
- package/dist/src/git-identity-guard.d.ts +4 -0
- package/dist/src/git-identity-guard.js +998 -0
- package/dist/src/git-identity-hold.d.ts +12 -0
- package/dist/src/git-identity-hold.js +81 -0
- package/dist/src/git-summary.d.ts +0 -58
- package/dist/src/git-summary.js +2 -212
- package/dist/src/goal-completion-verification.d.ts +2 -2
- package/dist/src/goal-completion-verification.js +3 -6
- package/dist/src/graph-account.d.ts +0 -21
- package/dist/src/graph-account.js +0 -17
- package/dist/src/graph-editor-session.d.ts +0 -1
- package/dist/src/graph-editor-session.js +1 -3
- package/dist/src/graph-health.d.ts +7 -49
- package/dist/src/graph-health.js +35 -46
- package/dist/src/graph-manager-chat.d.ts +27 -128
- package/dist/src/graph-manager-chat.js +36 -166
- package/dist/src/graph-provider-portability.d.ts +1 -21
- package/dist/src/graph-provider-portability.js +6 -45
- package/dist/src/graph-quota.d.ts +0 -33
- package/dist/src/graph-quota.js +1 -44
- package/dist/src/graph-runner.d.ts +0 -1
- package/dist/src/graph-runner.js +47 -387
- package/dist/src/graph-selection.d.ts +0 -14
- package/dist/src/graph-selection.js +0 -14
- package/dist/src/graph-server.d.ts +3 -11
- package/dist/src/graph-server.js +70 -111
- package/dist/src/graph-studio-features.d.ts +0 -5
- package/dist/src/graph-studio-features.js +2 -42
- package/dist/src/graph-sync.d.ts +0 -78
- package/dist/src/graph-sync.js +5 -201
- package/dist/src/graph-tool.d.ts +0 -18
- package/dist/src/graph-tool.js +0 -27
- package/dist/src/graph-ui/app.js +229 -498
- package/dist/src/graph-ui/compat.js +0 -7
- package/dist/src/graph-ui/controls.css +47 -43
- package/dist/src/graph-ui/controls.js +0 -88
- package/dist/src/graph-ui/drafts.js +0 -12
- package/dist/src/graph-ui/edge-router.js +0 -62
- package/dist/src/graph-ui/embed.js +0 -59
- package/dist/src/graph-ui/icons.js +2 -7
- package/dist/src/graph-ui/index.html +2 -2
- package/dist/src/graph-ui/library.css +0 -5
- package/dist/src/graph-ui/manager-markdown.js +0 -11
- package/dist/src/graph-ui/manager-state.js +110 -49
- package/dist/src/graph-ui/manager.css +2 -20
- package/dist/src/graph-ui/manager.js +251 -166
- package/dist/src/graph-ui/model-picker.js +250 -0
- package/dist/src/graph-ui/provider-glyphs/alibaba-cloud.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/anthropic.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/aws-bedrock.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/claude.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/deepseek.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/fireworks.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/kimi.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/minimax.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/openai.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/opencode.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/openrouter.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/xai.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/xiaomi-mimo.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/zai.png +0 -0
- package/dist/src/graph-ui/sidebar.js +2 -3
- package/dist/src/graph-ui/skill-picker.js +373 -39
- package/dist/src/graph-ui/studio-canvas.js +3 -38
- package/dist/src/graph-ui/studio.css +0 -18
- package/dist/src/graph-ui/studio.js +3 -71
- package/dist/src/graph-ui/style.css +11 -134
- package/dist/src/graph-ui/theme.js +1 -26
- package/dist/src/graph-ui/tokens.css +15 -114
- package/dist/src/graphs.d.ts +7 -156
- package/dist/src/graphs.js +72 -273
- package/dist/src/grep-regex-worker.js +0 -2
- package/dist/src/grep-regex.d.ts +1 -5
- package/dist/src/grep-regex.js +6 -8
- package/dist/src/grok-provider.d.ts +0 -17
- package/dist/src/grok-provider.js +1 -26
- package/dist/src/handoffs.d.ts +0 -11
- package/dist/src/handoffs.js +0 -13
- package/dist/src/hardened-runtime.d.ts +0 -10
- package/dist/src/hardened-runtime.js +8 -46
- package/dist/src/harness-home.d.ts +21 -0
- package/dist/src/harness-home.js +87 -0
- package/dist/src/host-process-guard.d.ts +0 -50
- package/dist/src/host-process-guard.js +0 -641
- package/dist/src/limits.d.ts +0 -64
- package/dist/src/limits.js +0 -62
- package/dist/src/managed-sign-in.d.ts +0 -12
- package/dist/src/managed-sign-in.js +0 -16
- package/dist/src/markdown.d.ts +0 -28
- package/dist/src/markdown.js +1 -175
- package/dist/src/mcp.d.ts +21 -82
- package/dist/src/mcp.js +228 -237
- package/dist/src/membership-errors.d.ts +0 -14
- package/dist/src/membership-errors.js +0 -13
- package/dist/src/membership.d.ts +2 -60
- package/dist/src/membership.js +0 -85
- package/dist/src/memory/LocalToolMemory.d.ts +0 -1
- package/dist/src/memory/LocalToolMemory.js +2 -7
- package/dist/src/memory/MemoryDistiller.js +0 -15
- package/dist/src/memory/MemoryManager.d.ts +0 -3
- package/dist/src/memory/MemoryManager.js +6 -18
- package/dist/src/memory/MemoryPolicy.d.ts +0 -2
- package/dist/src/memory/MemoryPolicy.js +0 -2
- package/dist/src/memory/MemoryProvider.d.ts +0 -6
- package/dist/src/memory/MemoryRetriever.js +0 -7
- package/dist/src/memory/PermissionMemoryProvider.d.ts +0 -1
- package/dist/src/memory/PermissionMemoryProvider.js +0 -1
- package/dist/src/memory/ProjectMemory.d.ts +42 -0
- package/dist/src/memory/ProjectMemory.js +285 -0
- package/dist/src/memory/ToolFailureLessons.d.ts +0 -3
- package/dist/src/memory/ToolFailureLessons.js +0 -6
- package/dist/src/memory/index.d.ts +1 -0
- package/dist/src/memory/index.js +1 -0
- package/dist/src/memory/providers/NoOpMemoryProvider.d.ts +0 -1
- package/dist/src/memory/providers/NoOpMemoryProvider.js +0 -1
- package/dist/src/memory/redaction.d.ts +0 -5
- package/dist/src/memory/redaction.js +0 -11
- package/dist/src/memory/repository.d.ts +0 -6
- package/dist/src/memory/repository.js +2 -12
- package/dist/src/memory/types.d.ts +0 -1
- package/dist/src/model-health-cache.d.ts +0 -38
- package/dist/src/model-health-cache.js +1 -49
- package/dist/src/model-metadata.d.ts +0 -18
- package/dist/src/model-metadata.js +2 -42
- package/dist/src/model-override.d.ts +0 -36
- package/dist/src/model-override.js +0 -43
- package/dist/src/model-tiers.d.ts +0 -13
- package/dist/src/model-tiers.js +0 -23
- package/dist/src/opencode-catalog.d.ts +0 -2
- package/dist/src/opencode-catalog.js +0 -11
- package/dist/src/opencode-cli-provider.d.ts +0 -35
- package/dist/src/opencode-cli-provider.js +1 -44
- package/dist/src/opencode-provider.d.ts +0 -2
- package/dist/src/opencode-provider.js +6 -22
- package/dist/src/package-name.d.ts +1 -0
- package/dist/src/package-name.js +1 -0
- package/dist/src/paged-transcript.d.ts +0 -11
- package/dist/src/paged-transcript.js +2 -20
- package/dist/src/palette.d.ts +0 -63
- package/dist/src/palette.js +0 -63
- package/dist/src/permissions.d.ts +0 -15
- package/dist/src/permissions.js +0 -17
- package/dist/src/powershell-pool.d.ts +0 -9
- package/dist/src/powershell-pool.js +3 -26
- package/dist/src/process-warnings.d.ts +4 -0
- package/dist/src/process-warnings.js +103 -0
- package/dist/src/profile.d.ts +0 -43
- package/dist/src/profile.js +0 -43
- package/dist/src/project-reservation.d.ts +11 -0
- package/dist/src/project-reservation.js +143 -0
- package/dist/src/provider-connection.d.ts +0 -18
- package/dist/src/provider-connection.js +0 -39
- package/dist/src/provider-engine.d.ts +0 -21
- package/dist/src/provider-engine.js +3 -98
- package/dist/src/provider-import.d.ts +0 -49
- package/dist/src/provider-import.js +0 -60
- package/dist/src/provider-keys.d.ts +1 -36
- package/dist/src/provider-keys.js +5 -48
- package/dist/src/provider-settings.d.ts +0 -2
- package/dist/src/provider-settings.js +0 -32
- package/dist/src/providers.d.ts +0 -217
- package/dist/src/providers.js +0 -315
- package/dist/src/pull-requests.d.ts +0 -173
- package/dist/src/pull-requests.js +5 -195
- package/dist/src/qa/browser/PlaywrightRunner.d.ts +0 -7
- package/dist/src/qa/browser/PlaywrightRunner.js +2 -16
- package/dist/src/qa/command-policy.d.ts +0 -23
- package/dist/src/qa/command-policy.js +0 -30
- package/dist/src/qa/guidance.d.ts +0 -21
- package/dist/src/qa/guidance.js +0 -20
- package/dist/src/qa/profile/ProjectInspector.d.ts +0 -4
- package/dist/src/qa/profile/ProjectInspector.js +0 -6
- package/dist/src/qa/profile/QaConfigLoader.d.ts +0 -7
- package/dist/src/qa/profile/QaConfigLoader.js +0 -6
- package/dist/src/qa/profile/QaProfile.d.ts +0 -7
- package/dist/src/qa/profile/QaProfile.js +0 -7
- package/dist/src/qa/profile/yaml.d.ts +0 -9
- package/dist/src/qa/profile/yaml.js +0 -13
- package/dist/src/qa/qa-authorize.d.ts +0 -19
- package/dist/src/qa/qa-authorize.js +4 -11
- package/dist/src/qa/runtime/ProcessManager.d.ts +0 -31
- package/dist/src/qa/runtime/ProcessManager.js +4 -41
- package/dist/src/qa/runtime/PtyManager.d.ts +0 -4
- package/dist/src/qa/runtime/PtyManager.js +2 -7
- package/dist/src/qa/runtime/changes.d.ts +0 -11
- package/dist/src/qa/runtime/changes.js +1 -3
- package/dist/src/qa/tools.d.ts +0 -10
- package/dist/src/qa/tools.js +0 -12
- package/dist/src/qa/types.d.ts +0 -13
- package/dist/src/react-runtime.d.ts +2 -21
- package/dist/src/react-runtime.js +106 -418
- package/dist/src/read-document-doc.d.ts +0 -6
- package/dist/src/read-document-doc.js +0 -55
- package/dist/src/read-document-docx.d.ts +0 -16
- package/dist/src/read-document-docx.js +2 -69
- package/dist/src/read-document-text.d.ts +0 -17
- package/dist/src/read-document-text.js +0 -22
- package/dist/src/read-document-tool.d.ts +0 -31
- package/dist/src/read-document-tool.js +0 -30
- package/dist/src/read-document.d.ts +0 -49
- package/dist/src/read-document.js +1 -67
- package/dist/src/read-image.d.ts +0 -32
- package/dist/src/read-image.js +0 -33
- package/dist/src/remote/cert.d.ts +1 -19
- package/dist/src/remote/cert.js +2 -51
- package/dist/src/remote/client.d.ts +0 -70
- package/dist/src/remote/client.js +2 -117
- package/dist/src/remote/command.js +0 -17
- package/dist/src/remote/engine-pool.d.ts +0 -152
- package/dist/src/remote/engine-pool.js +17 -335
- package/dist/src/remote/errors.d.ts +0 -15
- package/dist/src/remote/errors.js +0 -7
- package/dist/src/remote/network.d.ts +0 -26
- package/dist/src/remote/network.js +1 -34
- package/dist/src/remote/pairing.d.ts +16 -51
- package/dist/src/remote/pairing.js +50 -57
- package/dist/src/remote/pem.d.ts +2 -0
- package/dist/src/remote/pem.js +7 -0
- package/dist/src/remote/roots.d.ts +0 -20
- package/dist/src/remote/roots.js +0 -8
- package/dist/src/remote/serve.d.ts +0 -47
- package/dist/src/remote/serve.js +0 -30
- package/dist/src/remote/server.d.ts +0 -14
- package/dist/src/remote/server.js +1 -79
- package/dist/src/remote/types.d.ts +1 -32
- package/dist/src/remote/types.js +0 -10
- package/dist/src/run-control.d.ts +0 -7
- package/dist/src/run-control.js +0 -7
- package/dist/src/run-progress.d.ts +0 -170
- package/dist/src/run-progress.js +0 -285
- package/dist/src/run-records.d.ts +0 -443
- package/dist/src/run-records.js +44 -678
- package/dist/src/run-temp.d.ts +12 -0
- package/dist/src/run-temp.js +50 -0
- package/dist/src/runtime.d.ts +11 -227
- package/dist/src/runtime.js +0 -127
- package/dist/src/sandbox-child.js +0 -1
- package/dist/src/save-lock.d.ts +0 -12
- package/dist/src/save-lock.js +0 -28
- package/dist/src/screen-selection.d.ts +0 -23
- package/dist/src/screen-selection.js +0 -22
- package/dist/src/secret-redaction.d.ts +0 -12
- package/dist/src/secret-redaction.js +0 -45
- package/dist/src/session-changes.d.ts +4 -80
- package/dist/src/session-changes.js +25 -130
- package/dist/src/session-goal.d.ts +129 -0
- package/dist/src/session-goal.js +230 -0
- package/dist/src/session-monitor.d.ts +1 -10
- package/dist/src/session-monitor.js +2 -39
- package/dist/src/session-reaper.d.ts +0 -15
- package/dist/src/session-reaper.js +0 -14
- package/dist/src/session-skills.d.ts +15 -44
- package/dist/src/session-skills.js +75 -60
- package/dist/src/session-summary.d.ts +0 -26
- package/dist/src/session-summary.js +0 -32
- package/dist/src/session-title.d.ts +0 -1
- package/dist/src/session-title.js +0 -2
- package/dist/src/sessions.d.ts +2 -120
- package/dist/src/sessions.js +9 -178
- package/dist/src/shell.d.ts +3 -20
- package/dist/src/shell.js +8 -72
- package/dist/src/side-panel.d.ts +5 -99
- package/dist/src/side-panel.js +76 -133
- package/dist/src/sign-in-detection.d.ts +43 -0
- package/dist/src/sign-in-detection.js +154 -0
- package/dist/src/sign-in-offer.d.ts +17 -0
- package/dist/src/sign-in-offer.js +103 -0
- package/dist/src/skill-commands.d.ts +0 -1
- package/dist/src/skill-commands.js +1 -4
- package/dist/src/skills/bundled/control-browser/SKILL.md +1 -1
- package/dist/src/skills/bundled/graph-manager/SKILL.md +22 -4
- package/dist/src/skills/bundled/provenance.json +2 -2
- package/dist/src/skills/invocable-skills.d.ts +0 -18
- package/dist/src/skills/invocable-skills.js +0 -17
- package/dist/src/skills/project-skills.d.ts +0 -1
- package/dist/src/skills/project-skills.js +0 -3
- package/dist/src/skills/prompt-skills.js +0 -14
- package/dist/src/skills/runtime-skills.d.ts +1 -8
- package/dist/src/skills/runtime-skills.js +8 -32
- package/dist/src/stall-recovery.d.ts +0 -25
- package/dist/src/stall-recovery.js +0 -38
- package/dist/src/stray-files.d.ts +5 -0
- package/dist/src/stray-files.js +65 -0
- package/dist/src/structured-step.d.ts +0 -22
- package/dist/src/structured-step.js +0 -22
- package/dist/src/subagent-run.d.ts +0 -163
- package/dist/src/subagent-run.js +10 -374
- package/dist/src/subagent-tree.d.ts +32 -0
- package/dist/src/subagent-tree.js +128 -0
- package/dist/src/telemetry/aggregate.d.ts +0 -37
- package/dist/src/telemetry/aggregate.js +0 -40
- package/dist/src/telemetry/capture-core.d.ts +0 -87
- package/dist/src/telemetry/capture-core.js +0 -67
- package/dist/src/telemetry/capture.d.ts +0 -1
- package/dist/src/telemetry/capture.js +0 -3
- package/dist/src/telemetry/classify.d.ts +0 -58
- package/dist/src/telemetry/classify.js +0 -60
- package/dist/src/telemetry/decision-capture.d.ts +0 -1
- package/dist/src/telemetry/emitter.d.ts +0 -30
- package/dist/src/telemetry/emitter.js +1 -62
- package/dist/src/telemetry/gate.d.ts +0 -29
- package/dist/src/telemetry/gate.js +0 -22
- package/dist/src/telemetry/identity.d.ts +0 -13
- package/dist/src/telemetry/identity.js +0 -29
- package/dist/src/telemetry/outbox.d.ts +0 -64
- package/dist/src/telemetry/outbox.js +1 -108
- package/dist/src/telemetry/schema.d.ts +1 -49
- package/dist/src/telemetry/schema.js +1 -82
- package/dist/src/telemetry/state.d.ts +0 -53
- package/dist/src/telemetry/state.js +0 -64
- package/dist/src/telemetry/surface.d.ts +0 -31
- package/dist/src/telemetry/surface.js +1 -39
- package/dist/src/telemetry/uploader.d.ts +0 -11
- package/dist/src/telemetry/uploader.js +0 -46
- package/dist/src/telemetry/uploads.d.ts +0 -11
- package/dist/src/telemetry/uploads.js +0 -11
- package/dist/src/telemetry/version.d.ts +0 -4
- package/dist/src/telemetry/version.js +0 -14
- package/dist/src/telemetry/workspace.d.ts +0 -7
- package/dist/src/telemetry/workspace.js +1 -22
- package/dist/src/terminal-ui.d.ts +15 -524
- package/dist/src/terminal-ui.js +80 -876
- package/dist/src/test-edit-guard.d.ts +74 -0
- package/dist/src/test-edit-guard.js +269 -0
- package/dist/src/text.d.ts +0 -1
- package/dist/src/text.js +0 -1
- package/dist/src/time-limit.d.ts +0 -36
- package/dist/src/time-limit.js +0 -37
- package/dist/src/timers.d.ts +0 -161
- package/dist/src/timers.js +0 -126
- package/dist/src/todos.d.ts +0 -1
- package/dist/src/todos.js +0 -3
- package/dist/src/token-rate.d.ts +0 -94
- package/dist/src/token-rate.js +0 -154
- package/dist/src/tool-activity.d.ts +0 -6
- package/dist/src/tool-activity.js +1 -8
- package/dist/src/tool-availability.d.ts +0 -13
- package/dist/src/tool-availability.js +1 -14
- package/dist/src/tool-call-clock.d.ts +1 -4
- package/dist/src/tool-call-clock.js +0 -13
- package/dist/src/tool-catalog.d.ts +0 -11
- package/dist/src/tool-catalog.js +0 -23
- package/dist/src/tool-dependencies.d.ts +0 -5
- package/dist/src/tool-dependencies.js +0 -4
- package/dist/src/tool-diff-stats.d.ts +0 -23
- package/dist/src/tool-diff-stats.js +0 -49
- package/dist/src/tool-errors.d.ts +9 -7
- package/dist/src/tool-errors.js +13 -6
- package/dist/src/tool-failure-tracker.d.ts +3 -11
- package/dist/src/tool-failure-tracker.js +19 -27
- package/dist/src/tool-names.d.ts +0 -16
- package/dist/src/tool-names.js +0 -12
- package/dist/src/tool-profile.d.ts +6 -0
- package/dist/src/tool-profile.js +23 -0
- package/dist/src/tool-result-filter.d.ts +0 -19
- package/dist/src/tool-result-filter.js +1 -66
- package/dist/src/tool-schema-compatibility.d.ts +1 -2
- package/dist/src/tool-schema-compatibility.js +2 -7
- package/dist/src/tools.d.ts +0 -4
- package/dist/src/tools.js +11 -114
- package/dist/src/trajectory.d.ts +0 -13
- package/dist/src/trajectory.js +23 -79
- package/dist/src/transcript.d.ts +1 -37
- package/dist/src/transcript.js +11 -61
- package/dist/src/types.d.ts +2 -167
- package/dist/src/untracked-file-removal.d.ts +3 -0
- package/dist/src/untracked-file-removal.js +105 -0
- package/dist/src/update-check.d.ts +0 -14
- package/dist/src/update-check.js +2 -16
- package/dist/src/update.d.ts +4 -29
- package/dist/src/update.js +20 -98
- package/dist/src/usage-analytics.d.ts +17 -17
- package/dist/src/usage-analytics.js +168 -209
- package/dist/src/web-search.d.ts +0 -23
- package/dist/src/web-search.js +1 -27
- package/dist/src/widgets.d.ts +0 -25
- package/dist/src/widgets.js +0 -24
- package/dist/src/workspace-facts.d.ts +0 -12
- package/dist/src/workspace-facts.js +1 -18
- package/dist/src/workspace-git-metadata.d.ts +4 -5
- package/dist/src/workspace-git-metadata.js +37 -9
- package/dist/src/workspace-instructions.d.ts +3 -15
- package/dist/src/workspace-instructions.js +7 -20
- package/package.json +2 -2
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
2
3
|
import { mkdir } from 'node:fs/promises';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
3
5
|
import { isAbsolute, join, resolve } from 'node:path';
|
|
4
6
|
import { createInterface } from 'node:readline';
|
|
5
7
|
import { fileURLToPath } from 'node:url';
|
|
@@ -9,24 +11,36 @@ import { GRAPH_MANAGER_GRAPH_ID } from './graphs.js';
|
|
|
9
11
|
import { clipText } from './text.js';
|
|
10
12
|
import { describeTool } from './transcript.js';
|
|
11
13
|
const STARTUP_MS = 60_000;
|
|
12
|
-
/** How long a new chat waits for a cancelled run to end before it stops the engine instead. */
|
|
13
14
|
const RESET_WAIT_MS = 10_000;
|
|
14
|
-
/** How long a message waits for a run that is already ending before it is reported instead of sent. */
|
|
15
15
|
const ENDING_WAIT_MS = 30_000;
|
|
16
|
-
/** Mirrors `MAX_TASK_CHARS` in `app-server.ts`: the engine refuses a longer `run.start` task or `run.steer` text. */
|
|
17
16
|
export const MANAGER_TASK_MAX_CHARS = 100_000;
|
|
18
17
|
const UPDATE_MESSAGE = 'Update Andorra Code to use Graph Manager.';
|
|
19
18
|
const TOO_LARGE_MESSAGE = 'This graph is too large to send to Graph Manager.';
|
|
20
|
-
/** The longest tool or approval line the panel is given. */
|
|
21
19
|
const TOOL_LINE_MAX = 120;
|
|
22
|
-
/** How many draft-to-graph pairings are remembered; an agent holds a handful of drafts at most. */
|
|
23
20
|
const DRAFTS_MAX = 64;
|
|
24
|
-
/** The bundled preset every installation has. Nothing can be saved under its id. */
|
|
25
21
|
const BUNDLED_GRAPH_ID = 'default';
|
|
26
|
-
|
|
22
|
+
const DRAFT_EDIT_ACTIONS = new Set(['andorra_graph_node_upsert', 'andorra_graph_node_patch', 'andorra_graph_node_remove', 'andorra_graph_edge_upsert', 'andorra_graph_edge_remove', 'andorra_graph_patch']);
|
|
23
|
+
export function draftEdit(action, args, output) {
|
|
24
|
+
let reply = {};
|
|
25
|
+
try {
|
|
26
|
+
reply = record(record(JSON.parse(String(output ?? ''))).data);
|
|
27
|
+
}
|
|
28
|
+
catch { }
|
|
29
|
+
const node = record(reply.node), edge = record(reply.edge), patch = record(args.patch);
|
|
30
|
+
if (action === 'andorra_graph_node_upsert' || action === 'andorra_graph_node_patch')
|
|
31
|
+
return typeof node.id === 'string' ? { kind: 'node', node } : undefined;
|
|
32
|
+
if (action === 'andorra_graph_edge_upsert')
|
|
33
|
+
return typeof edge.id === 'string' && typeof edge.source === 'string' && typeof edge.target === 'string' ? { kind: 'edge', edge } : undefined;
|
|
34
|
+
if (action === 'andorra_graph_node_remove')
|
|
35
|
+
return typeof args.nodeId === 'string' && args.nodeId ? { kind: 'node.remove', nodeId: args.nodeId } : undefined;
|
|
36
|
+
if (action === 'andorra_graph_edge_remove')
|
|
37
|
+
return typeof args.edgeId === 'string' && args.edgeId ? { kind: 'edge.remove', edgeId: args.edgeId } : undefined;
|
|
38
|
+
if (action === 'andorra_graph_patch')
|
|
39
|
+
return Object.keys(patch).length ? { kind: 'graph', patch } : undefined;
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
27
42
|
class EngineStopped extends Error {
|
|
28
43
|
}
|
|
29
|
-
/** The engine answered a request with an error; `code` is its own classification. */
|
|
30
44
|
class EngineRefusal extends Error {
|
|
31
45
|
code;
|
|
32
46
|
constructor(message, code) {
|
|
@@ -45,15 +59,8 @@ const toolArguments = (value) => {
|
|
|
45
59
|
return {};
|
|
46
60
|
}
|
|
47
61
|
};
|
|
48
|
-
/** Plain text on one line: control characters and line breaks become single spaces. */
|
|
49
62
|
const oneLine = (value) => typeof value === 'string' ? value.replace(/[\x00-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069\s]+/g, ' ').trim() : '';
|
|
50
63
|
const toolLine = (...parts) => clipText(parts.map(oneLine).filter(Boolean).join(' \u00b7 '), TOOL_LINE_MAX);
|
|
51
|
-
/**
|
|
52
|
-
* One line saying what a tool call or an approval is about, for the tools Graph Manager works with:
|
|
53
|
-
* the `graphs` action and the graph it names, the skill being read, the server being connected.
|
|
54
|
-
* A publish names only its draft, so `graphOfDraft` supplies the graph when the caller knows it.
|
|
55
|
-
* Every other tool keeps the transcript's wording. The line is at most 120 characters.
|
|
56
|
-
*/
|
|
57
64
|
export function describeManagerTool(name, value, graphOfDraft = () => undefined) {
|
|
58
65
|
const args = toolArguments(value);
|
|
59
66
|
if (name === 'graphs') {
|
|
@@ -69,7 +76,6 @@ export function describeManagerTool(name, value, graphOfDraft = () => undefined)
|
|
|
69
76
|
return toolLine(name, args.server);
|
|
70
77
|
return clipText(describeTool(name, value), TOOL_LINE_MAX);
|
|
71
78
|
}
|
|
72
|
-
/** What each `graphs` action does, as the row's verb. An action not named here shows its own name. */
|
|
73
79
|
const GRAPH_ACTION_VERBS = {
|
|
74
80
|
andorra_graph_begin: 'Open draft', andorra_graph_get: 'Read graph', andorra_graph_guide: 'Read guide',
|
|
75
81
|
andorra_graph_node_upsert: 'Set step', andorra_graph_node_patch: 'Edit step', andorra_graph_node_remove: 'Remove step',
|
|
@@ -77,12 +83,6 @@ const GRAPH_ACTION_VERBS = {
|
|
|
77
83
|
andorra_graph_validate: 'Validate draft', andorra_graph_publish: 'Save version', andorra_graph_discard: 'Discard draft',
|
|
78
84
|
andorra_graph_delete: 'Delete graph', andorra_graph_restore: 'Restore graph',
|
|
79
85
|
};
|
|
80
|
-
/**
|
|
81
|
-
* A tool call split the way the app's transcript draws it: the verb, and the thing it acted on.
|
|
82
|
-
* A node is named by its name when the call carries one; a connection reads `source → target`
|
|
83
|
-
* with its outcome. The graph the call is about is left out when it is the open one, which every
|
|
84
|
-
* call of a conversation usually is. Any other tool keeps the transcript's one line as its verb.
|
|
85
|
-
*/
|
|
86
86
|
export function managerToolParts(name, value, openGraphId) {
|
|
87
87
|
const args = toolArguments(value);
|
|
88
88
|
const clip = (text) => text ? clipText(text, TOOL_LINE_MAX) : undefined;
|
|
@@ -116,25 +116,8 @@ export function managerToolParts(name, value, openGraphId) {
|
|
|
116
116
|
return parts('Connect server', oneLine(args.server));
|
|
117
117
|
return { verb: clipText(describeTool(name, value), TOOL_LINE_MAX) };
|
|
118
118
|
}
|
|
119
|
-
/** Bookkeeping calls the runtime handles itself; a conversation shows what the agent did, not these. */
|
|
120
119
|
const HIDDEN_TOOLS = new Set(['update_todos', 'update_widget', 'prepare_steps', 'restore_tools', 'complete_agent']);
|
|
121
120
|
const STOPPED_UNREAD_MESSAGE = 'Graph Manager was stopped before it read your last message. Send it again to continue.';
|
|
122
|
-
/**
|
|
123
|
-
* The environment the chat's engine starts in: the parent's own, so the engine is signed in as the
|
|
124
|
-
* parent is. Stored credentials are scoped to an explicitly named home (`credentialIdentity`), so
|
|
125
|
-
* naming even the default home would move the engine to an empty credential slot. The home is
|
|
126
|
-
* named only when the chat runs against a different one than the environment already selects.
|
|
127
|
-
*
|
|
128
|
-
* The engine is marked as a worker, as the automation runner marks its own. An unmarked engine is a
|
|
129
|
-
* window's: it runs the user's automations, watches their pull requests and archives old sessions.
|
|
130
|
-
* This one is stopped when idle and when the editor closes, which would interrupt an automation it
|
|
131
|
-
* had claimed. The mark switches off those three background services and nothing else.
|
|
132
|
-
*
|
|
133
|
-
* A relative inherited home means the parent's working directory, and the engine starts in its own
|
|
134
|
-
* workspace, where the same words would name another folder with another configuration and another
|
|
135
|
-
* credential slot. It is handed the absolute path instead, which `credentialIdentity` resolves to
|
|
136
|
-
* the scope the parent reads.
|
|
137
|
-
*/
|
|
138
121
|
export function managerEngineEnvironment(directory, environment = process.env) {
|
|
139
122
|
const inherited = environment.ANDORRACODE_HOME;
|
|
140
123
|
const worker = { ...environment, ...(inherited && !isAbsolute(inherited) ? { ANDORRACODE_HOME: resolve(inherited) } : {}), ANDORRA_AUTOMATION_WORKER: '1' };
|
|
@@ -142,15 +125,13 @@ export function managerEngineEnvironment(directory, environment = process.env) {
|
|
|
142
125
|
return worker;
|
|
143
126
|
return { ...worker, ANDORRACODE_HOME: resolve(directory) };
|
|
144
127
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
*/
|
|
128
|
+
export function managerWorkspace(directory) {
|
|
129
|
+
return join(tmpdir(), 'andorra-graph-manager', createHash('sha256').update(resolve(directory)).digest('hex').slice(0, 16));
|
|
130
|
+
}
|
|
149
131
|
export function managerTask(turn) {
|
|
150
132
|
const saved = !turn.saved ? 'not saved yet' : turn.revision === undefined ? 'saved' : `saved revision ${turn.revision}`;
|
|
151
133
|
return [
|
|
152
134
|
`You are helping in Graph Studio. Open graph: "${graphName(turn.graph)}", id ${graphId(turn.graph)} (${saved}).`,
|
|
153
|
-
// A save under the preset's id is refused, so the agent is told before it tries.
|
|
154
135
|
graphId(turn.graph) === BUNDLED_GRAPH_ID
|
|
155
136
|
? `The open graph is the bundled preset, which cannot be changed: nothing can be saved under the id "${BUNDLED_GRAPH_ID}". The canvas below is what the user sees now. Do not edit this graph; create a new graph with a new id and its own name (mode "create"), based on the canvas, and make your changes there.`
|
|
156
137
|
: 'The canvas below is what the user sees now, including edits not yet saved. Work from it, and save your changes under this same graph id (mode "create" when it is not saved yet, "edit" otherwise).',
|
|
@@ -165,17 +146,6 @@ export function managerTask(turn) {
|
|
|
165
146
|
turn.text,
|
|
166
147
|
].join('\n');
|
|
167
148
|
}
|
|
168
|
-
/**
|
|
169
|
-
* One Graph Manager conversation, run on an engine of its own.
|
|
170
|
-
*
|
|
171
|
-
* The engine that hosts Graph Studio may be busy with the user's task and runs one task at a time,
|
|
172
|
-
* so the chat spawns a dedicated `app-server --stdio` child in an empty workspace and speaks the
|
|
173
|
-
* same line protocol the automation runner does. Every panel connected to the graph server shares
|
|
174
|
-
* this one conversation: each subscriber is caught up with a snapshot and then receives the stream.
|
|
175
|
-
*
|
|
176
|
-
* Failures on the engine's side are reported as `error` events rather than rejections, because the
|
|
177
|
-
* message that failed is already on every panel's transcript and the stream is where panels listen.
|
|
178
|
-
*/
|
|
179
149
|
export class GraphManagerChat {
|
|
180
150
|
options;
|
|
181
151
|
directory;
|
|
@@ -187,55 +157,38 @@ export class GraphManagerChat {
|
|
|
187
157
|
engine;
|
|
188
158
|
sessionId;
|
|
189
159
|
runId;
|
|
190
|
-
/** The run whose terminal event has been handled; its late `run.start` answer must not revive it. */
|
|
191
160
|
finishedRunId;
|
|
192
|
-
/** Approvals and questions the panel has been shown and nobody has settled yet. */
|
|
193
161
|
prompts = new Set();
|
|
194
|
-
/** `graphs` calls in flight, by tool call id: the line shown for each, and the graph a begin opens or a publish saves. */
|
|
195
162
|
graphCalls = new Map();
|
|
196
|
-
/** Which graph each draft is of, learned from `andorra_graph_begin`, so a publish can name its graph. */
|
|
197
163
|
drafts = new Map();
|
|
198
|
-
/** The latest revision reported for each graph the agent saved other than the open one. */
|
|
199
164
|
otherRevisions = new Map();
|
|
200
|
-
/** The model the latest message chose, for a steering message that has to be sent again as a run. */
|
|
201
165
|
lastModel;
|
|
202
|
-
/**
|
|
203
|
-
* Messages a run ended without reading, oldest first, each already a whole task. The engine keeps
|
|
204
|
-
* them out of the session's history, so they stay here until an engine has accepted them.
|
|
205
|
-
*/
|
|
206
166
|
unread = [];
|
|
207
|
-
/** The pair the latest run was started on or last switched to, to tell when a message changes it. */
|
|
208
167
|
runModel;
|
|
209
168
|
openGraphId;
|
|
210
169
|
lastRevision = 0;
|
|
211
170
|
revisionCheck = Promise.resolve();
|
|
212
171
|
cancelling = false;
|
|
213
|
-
/** How many times Stop was pressed, so a message still waiting to be sent can tell it was stopped too. */
|
|
214
172
|
stops = 0;
|
|
215
173
|
closed = false;
|
|
216
|
-
/** Messages and resets are delivered one at a time, in the order they were asked for. */
|
|
217
174
|
queue = Promise.resolve();
|
|
218
175
|
idleTimer;
|
|
219
176
|
idleWaiters = [];
|
|
220
177
|
now;
|
|
221
|
-
/** Names the rows of tool calls the engine reported without an id of their own. */
|
|
222
178
|
toolRows = 0;
|
|
223
179
|
constructor(options) {
|
|
224
180
|
this.options = options;
|
|
225
|
-
// Resolved now: the engine is started in another working directory.
|
|
226
181
|
this.directory = resolve(options.directory);
|
|
227
|
-
this.workspace =
|
|
182
|
+
this.workspace = resolve(options.workspace ?? managerWorkspace(this.directory));
|
|
228
183
|
this.idleMs = options.idleMs ?? 600_000;
|
|
229
184
|
this.now = options.now ?? Date.now;
|
|
230
185
|
}
|
|
231
|
-
/** The listener is first handed the conversation so far as one snapshot, then every later event. */
|
|
232
186
|
subscribe(listener) {
|
|
233
187
|
this.listeners.add(listener);
|
|
234
188
|
this.armIdleStop();
|
|
235
189
|
this.deliverTo(listener, { type: 'snapshot', events: [...this.transcript], state: this.state });
|
|
236
190
|
return () => { this.listeners.delete(listener); this.armIdleStop(); };
|
|
237
191
|
}
|
|
238
|
-
/** Start the conversation, continue it, or steer the run that is working. */
|
|
239
192
|
send(turn) {
|
|
240
193
|
if (this.closed)
|
|
241
194
|
return Promise.resolve();
|
|
@@ -246,7 +199,6 @@ export class GraphManagerChat {
|
|
|
246
199
|
async approve(id, approved) {
|
|
247
200
|
if (!this.engine || !this.prompts.has(id))
|
|
248
201
|
return;
|
|
249
|
-
// A refusal means the engine no longer holds the prompt, which settles it just the same.
|
|
250
202
|
await this.request(this.engine, 'run.approve', { id, approved }).catch(() => { });
|
|
251
203
|
this.resolvePrompt(id);
|
|
252
204
|
}
|
|
@@ -257,23 +209,18 @@ export class GraphManagerChat {
|
|
|
257
209
|
this.resolvePrompt(id);
|
|
258
210
|
}
|
|
259
211
|
async cancel() {
|
|
260
|
-
// A live run is cancelled at once, whatever is queued behind it. A start still on its way has
|
|
261
|
-
// no run to name yet, so the cancel follows it; every queued step is bounded, so this ends.
|
|
262
212
|
this.stops++;
|
|
263
|
-
// Stop covers a message no run has read yet, as it covers one still waiting to be sent.
|
|
264
213
|
if (this.unread.splice(0).length)
|
|
265
214
|
this.emit({ type: 'error', message: STOPPED_UNREAD_MESSAGE });
|
|
266
215
|
if (this.runId === undefined)
|
|
267
216
|
await this.queue;
|
|
268
217
|
await this.cancelRun();
|
|
269
218
|
}
|
|
270
|
-
/** Forget the session and the transcript. The engine stays for the next conversation. */
|
|
271
219
|
reset() {
|
|
272
220
|
if (this.closed)
|
|
273
221
|
return Promise.resolve();
|
|
274
222
|
return this.enqueue(async () => {
|
|
275
223
|
await this.cancelRun();
|
|
276
|
-
// The engine runs one task at a time, so the next conversation waits for this one to end.
|
|
277
224
|
if (this.state !== 'idle')
|
|
278
225
|
await this.whenIdle(RESET_WAIT_MS);
|
|
279
226
|
if (this.state !== 'idle') {
|
|
@@ -295,7 +242,6 @@ export class GraphManagerChat {
|
|
|
295
242
|
this.deliverTo(listener, snapshot);
|
|
296
243
|
});
|
|
297
244
|
}
|
|
298
|
-
/** Cancel the run, stop the child and clear the timers. Nothing is started afterwards. */
|
|
299
245
|
async close() {
|
|
300
246
|
if (this.closed)
|
|
301
247
|
return;
|
|
@@ -312,7 +258,6 @@ export class GraphManagerChat {
|
|
|
312
258
|
await this.stopEngine(engine);
|
|
313
259
|
}
|
|
314
260
|
enqueue(step) {
|
|
315
|
-
// A step reports its own failures, so the chain never rejects and never stalls.
|
|
316
261
|
const next = this.queue.then(step).catch(() => { });
|
|
317
262
|
this.queue = next;
|
|
318
263
|
return next;
|
|
@@ -320,8 +265,6 @@ export class GraphManagerChat {
|
|
|
320
265
|
async deliver(turn, stops) {
|
|
321
266
|
if (this.closed)
|
|
322
267
|
return;
|
|
323
|
-
// Stop was pressed after this message was sent, while it waited its turn behind another. Stop
|
|
324
|
-
// covers everything sent before it: delivering it now would start a run the user just stopped.
|
|
325
268
|
if (this.stops !== stops) {
|
|
326
269
|
this.emit({ type: 'error', message: STOPPED_UNREAD_MESSAGE });
|
|
327
270
|
return;
|
|
@@ -332,43 +275,32 @@ export class GraphManagerChat {
|
|
|
332
275
|
this.openGraphId = id;
|
|
333
276
|
this.lastModel = { provider: turn.provider, model: turn.model };
|
|
334
277
|
const task = managerTask(turn);
|
|
335
|
-
// The canvas travels inside the task, so a large graph can pass the engine's limit. Refused here,
|
|
336
|
-
// before anything is sent, with words about the graph rather than the engine's about a field.
|
|
337
278
|
if (task.length > MANAGER_TASK_MAX_CHARS) {
|
|
338
279
|
this.emit({ type: 'error', message: TOO_LARGE_MESSAGE });
|
|
339
280
|
return;
|
|
340
281
|
}
|
|
341
282
|
if (this.runId !== undefined && this.state !== 'idle' && this.engine) {
|
|
342
283
|
const engine = this.engine, runId = this.runId;
|
|
343
|
-
// A steer carries words only, so a model chosen since the run began is applied to the run first.
|
|
344
|
-
// A refusal is held until the steer is answered: a run that is ending refuses both, and the
|
|
345
|
-
// message then starts the next run on the new model with nothing to report.
|
|
346
284
|
const keptModel = await this.switchRunModel(engine, runId, turn.provider, turn.model);
|
|
347
285
|
if (keptModel === 'stopped')
|
|
348
286
|
return;
|
|
349
287
|
try {
|
|
350
288
|
await this.request(engine, 'run.steer', { runId, sessionId: this.sessionId, text: task });
|
|
351
289
|
if (keptModel !== undefined)
|
|
352
|
-
this.emit({ type: 'error', message: `Graph Manager could not switch to ${turn.provider}/${turn.model}, so this run keeps its model: ${keptModel.reason}
|
|
290
|
+
this.emit({ type: 'error', message: `Graph Manager could not switch to ${turn.provider}/${turn.model}, so this run keeps its model: ${keptModel.reason}`, warning: true });
|
|
353
291
|
return;
|
|
354
292
|
}
|
|
355
293
|
catch (error) {
|
|
356
294
|
if (error instanceof EngineStopped)
|
|
357
295
|
return;
|
|
358
|
-
// `not-found` and `busy` are how the engine says the run is already ending and will not read
|
|
359
|
-
// another message. Anything else is a refusal of the message itself, with the run still live.
|
|
360
296
|
const ending = error instanceof EngineRefusal && (error.code === 'not-found' || error.code === 'busy');
|
|
361
297
|
if (!ending) {
|
|
362
298
|
this.emit({ type: 'error', message: error instanceof Error ? error.message : String(error) });
|
|
363
299
|
return;
|
|
364
300
|
}
|
|
365
|
-
// The message becomes the next run. The wait ends with the run, with the engine (an exit sets
|
|
366
|
-
// idle), or at the bound, so nothing queued behind it is held indefinitely.
|
|
367
301
|
await this.whenIdle(ENDING_WAIT_MS);
|
|
368
302
|
if (this.closed)
|
|
369
303
|
return;
|
|
370
|
-
// Stop was pressed after this message was sent. It covers the message too: starting a run for
|
|
371
|
-
// it now would set Graph Manager working again right after the user stopped it.
|
|
372
304
|
if (this.stops !== stops) {
|
|
373
305
|
this.emit({ type: 'error', message: STOPPED_UNREAD_MESSAGE });
|
|
374
306
|
return;
|
|
@@ -379,9 +311,6 @@ export class GraphManagerChat {
|
|
|
379
311
|
}
|
|
380
312
|
}
|
|
381
313
|
}
|
|
382
|
-
// Messages the last run never read come first, so the agent takes them in the order they were
|
|
383
|
-
// sent. When they do not fit in one task with this one they stay queued, and are steered into
|
|
384
|
-
// the run this message starts.
|
|
385
314
|
const carried = [...this.unread, task].join('\n\n');
|
|
386
315
|
if (this.unread.length && carried.length <= MANAGER_TASK_MAX_CHARS) {
|
|
387
316
|
this.unread = [];
|
|
@@ -390,18 +319,12 @@ export class GraphManagerChat {
|
|
|
390
319
|
}
|
|
391
320
|
await this.start(task, turn.provider, turn.model, graphName(turn.graph));
|
|
392
321
|
}
|
|
393
|
-
/**
|
|
394
|
-
* Hands the engine every message a run ended without reading. A message leaves `unread` only when
|
|
395
|
-
* it is on its way to an engine: as the next run when nothing is working, else steered into the run
|
|
396
|
-
* that is. A run that is itself ending refuses the steer, and the message then waits for the run after it.
|
|
397
|
-
*/
|
|
398
322
|
async deliverUnread() {
|
|
399
323
|
while (this.unread.length && !this.closed) {
|
|
400
324
|
const chosen = this.lastModel;
|
|
401
325
|
if (!chosen)
|
|
402
326
|
return;
|
|
403
327
|
if (this.isIdle()) {
|
|
404
|
-
// As many as one task holds, and always at least the oldest.
|
|
405
328
|
let taken = 1;
|
|
406
329
|
while (taken < this.unread.length && this.unread.slice(0, taken + 1).join('\n\n').length <= MANAGER_TASK_MAX_CHARS)
|
|
407
330
|
taken++;
|
|
@@ -411,7 +334,6 @@ export class GraphManagerChat {
|
|
|
411
334
|
const text = this.unread[0];
|
|
412
335
|
const engine = this.engine;
|
|
413
336
|
if (this.runId === undefined || !engine) {
|
|
414
|
-
// A run is starting or its engine is going: the message waits for whichever comes of it.
|
|
415
337
|
await this.whenIdle(ENDING_WAIT_MS);
|
|
416
338
|
if (!this.isIdle())
|
|
417
339
|
return;
|
|
@@ -419,7 +341,6 @@ export class GraphManagerChat {
|
|
|
419
341
|
}
|
|
420
342
|
try {
|
|
421
343
|
await this.request(engine, 'run.steer', { runId: this.runId, sessionId: this.sessionId, text });
|
|
422
|
-
// Stop may have taken the message while the engine was answering.
|
|
423
344
|
if (this.unread[0] === text)
|
|
424
345
|
this.unread.shift();
|
|
425
346
|
}
|
|
@@ -427,30 +348,21 @@ export class GraphManagerChat {
|
|
|
427
348
|
if (this.unread[0] !== text)
|
|
428
349
|
continue;
|
|
429
350
|
if (error instanceof EngineStopped) {
|
|
430
|
-
// A deliberate stop keeps the message for the next run; a crash has set the chat idle.
|
|
431
351
|
if (!this.isIdle())
|
|
432
352
|
return;
|
|
433
353
|
continue;
|
|
434
354
|
}
|
|
435
355
|
if (!(error instanceof EngineRefusal && (error.code === 'not-found' || error.code === 'busy'))) {
|
|
436
|
-
// A refusal of the message itself: no engine will take it, and the user is told.
|
|
437
356
|
this.unread.shift();
|
|
438
357
|
this.emit({ type: 'error', message: error instanceof Error ? error.message : String(error) });
|
|
439
358
|
continue;
|
|
440
359
|
}
|
|
441
360
|
await this.whenIdle(ENDING_WAIT_MS);
|
|
442
|
-
// Still not over at the bound: the message stays for the next message's run to carry.
|
|
443
361
|
if (!this.isIdle())
|
|
444
362
|
return;
|
|
445
363
|
}
|
|
446
364
|
}
|
|
447
365
|
}
|
|
448
|
-
/**
|
|
449
|
-
* Moves the working run to the pair a message chose, when it differs from the pair the run is on.
|
|
450
|
-
* `overrideAllNodes: false` is the scope `run.start` gave the first pair: the run's own, which
|
|
451
|
-
* Graph Manager's one agent node (it names no model) and whatever it delegates to answer from.
|
|
452
|
-
* Undefined when the run is on the pair; otherwise why it is not.
|
|
453
|
-
*/
|
|
454
366
|
async switchRunModel(engine, runId, provider, model) {
|
|
455
367
|
const running = this.runModel;
|
|
456
368
|
if (running === undefined || (running.provider === provider && running.model === model))
|
|
@@ -478,12 +390,9 @@ export class GraphManagerChat {
|
|
|
478
390
|
const id = record(created.session).id;
|
|
479
391
|
if (typeof id !== 'string')
|
|
480
392
|
throw new Error('Graph Manager could not start its conversation.');
|
|
481
|
-
// The rename pins the name, so the engine's automatic titling leaves it alone.
|
|
482
393
|
await this.request(engine, 'sessions.rename', { id, name: title });
|
|
483
394
|
this.sessionId = id;
|
|
484
395
|
}
|
|
485
|
-
// `continueSession` extends the session just created instead of forking it, which a start
|
|
486
|
-
// that only names a session would do, leaving an empty copy behind for every conversation.
|
|
487
396
|
const started = await this.request(engine, 'run.start', {
|
|
488
397
|
workspace: this.workspace, sessionId: this.sessionId, continueSession: true, task,
|
|
489
398
|
provider, model, graph: GRAPH_MANAGER_GRAPH_ID, runPermissions: 'ask-for-approval',
|
|
@@ -491,7 +400,6 @@ export class GraphManagerChat {
|
|
|
491
400
|
if (typeof started.sessionId === 'string')
|
|
492
401
|
this.sessionId = started.sessionId;
|
|
493
402
|
this.runModel = { provider, model };
|
|
494
|
-
// A run that already ended has reported it; only a live one is still working.
|
|
495
403
|
if (typeof started.runId === 'string' && started.runId !== this.finishedRunId) {
|
|
496
404
|
this.runId = started.runId;
|
|
497
405
|
if (this.state === 'starting')
|
|
@@ -535,7 +443,6 @@ export class GraphManagerChat {
|
|
|
535
443
|
let failReady;
|
|
536
444
|
let markClosed;
|
|
537
445
|
const ready = new Promise((done, fail) => { markReady = done; failReady = fail; });
|
|
538
|
-
// Awaited by whoever starts a run; a stop nobody is waiting on must not be an unhandled rejection.
|
|
539
446
|
ready.catch(() => { });
|
|
540
447
|
const engine = {
|
|
541
448
|
child, lines: createInterface({ input: child.stdout }), ready,
|
|
@@ -564,15 +471,12 @@ export class GraphManagerChat {
|
|
|
564
471
|
this.engine = undefined;
|
|
565
472
|
if (engine.stopping || this.closed)
|
|
566
473
|
return;
|
|
567
|
-
// The run died with the engine, and its session may still carry that run's claim, so the next
|
|
568
|
-
// message begins a new session on a new engine.
|
|
569
474
|
this.sessionId = undefined;
|
|
570
475
|
const tail = engine.stderr.trim().split('\n').at(-1)?.trim();
|
|
571
476
|
this.emit({ type: 'error', message: `Graph Manager stopped unexpectedly (${detail}). Send your message again to restart it.${tail ? `\n${tail}` : ''}` });
|
|
572
477
|
this.finish(this.runId);
|
|
573
478
|
};
|
|
574
479
|
child.stderr.on('data', chunk => { engine.stderr = (engine.stderr + String(chunk)).slice(-8_192); });
|
|
575
|
-
// A write into a pipe whose reader has gone is followed by the close that reports it.
|
|
576
480
|
child.stdin.on('error', () => { });
|
|
577
481
|
child.on('error', error => gone(error.message));
|
|
578
482
|
child.once('close', code => gone(`exit ${code ?? 'signal'}`));
|
|
@@ -600,7 +504,6 @@ export class GraphManagerChat {
|
|
|
600
504
|
const data = record(message.data);
|
|
601
505
|
if (message.event === 'ready') {
|
|
602
506
|
clearTimeout(startup);
|
|
603
|
-
// Without run-scoped permissions the run would take the workspace's saved mode, not Ask for approval.
|
|
604
507
|
if (Array.isArray(data.capabilities) && data.capabilities.includes('run.start.runPermissions'))
|
|
605
508
|
markReady();
|
|
606
509
|
else
|
|
@@ -623,7 +526,6 @@ export class GraphManagerChat {
|
|
|
623
526
|
engine.child.stdin.write(JSON.stringify({ id, method, params }) + '\n');
|
|
624
527
|
});
|
|
625
528
|
}
|
|
626
|
-
/** A deliberate stop: EOF lets the engine finish its own cleanup, and it is reaped if it does not. */
|
|
627
529
|
async stopEngine(engine) {
|
|
628
530
|
engine.stopping = true;
|
|
629
531
|
if (this.engine === engine)
|
|
@@ -648,7 +550,6 @@ export class GraphManagerChat {
|
|
|
648
550
|
if (data.state === 'awaiting-approval' || data.state === 'awaiting-input')
|
|
649
551
|
this.setState('awaiting');
|
|
650
552
|
else if (data.state === 'running') {
|
|
651
|
-
// The engine reports running again only once nothing is pending, however each prompt was settled.
|
|
652
553
|
this.resolvePrompts();
|
|
653
554
|
this.setState('working');
|
|
654
555
|
}
|
|
@@ -660,13 +561,10 @@ export class GraphManagerChat {
|
|
|
660
561
|
if (event === 'run.failed' && !cancelled)
|
|
661
562
|
this.emit({ type: 'error', message: String(data.message ?? 'The run failed.') });
|
|
662
563
|
this.finish(runId);
|
|
663
|
-
// A message queued too late for the run to read is still the user's request: it becomes the next run.
|
|
664
564
|
const unread = Array.isArray(data.undeliveredSteers)
|
|
665
565
|
? data.undeliveredSteers.map(entry => record(entry).text).filter((text) => typeof text === 'string')
|
|
666
566
|
: [];
|
|
667
567
|
if (unread.length && !cancelled && !this.closed) {
|
|
668
|
-
// Queued behind whatever is already being delivered. A message whose steer this run refused
|
|
669
|
-
// starts the next run first, and takes these with it.
|
|
670
568
|
this.unread.push(...unread);
|
|
671
569
|
void this.enqueue(() => this.deliverUnread());
|
|
672
570
|
}
|
|
@@ -687,7 +585,6 @@ export class GraphManagerChat {
|
|
|
687
585
|
return;
|
|
688
586
|
const line = this.describe(String(data.name), data.arguments);
|
|
689
587
|
const id = typeof data.toolCallId === 'string' && data.toolCallId ? data.toolCallId : `tool-${++this.toolRows}`;
|
|
690
|
-
// A call id the engine reuses (a resumed call) reopens its row rather than adding a second one.
|
|
691
588
|
const opened = { type: 'tool', id, text: line, ...managerToolParts(String(data.name), data.arguments, this.openGraphId), status: 'running', startedAt: this.now() };
|
|
692
589
|
if (!this.replace(entry => entry.type === 'tool' && entry.id === id, () => opened, opened))
|
|
693
590
|
this.emit(opened);
|
|
@@ -698,7 +595,9 @@ export class GraphManagerChat {
|
|
|
698
595
|
const begins = args.action === 'andorra_graph_begin' && typeof input.id === 'string' ? { id: input.id, ...(name ? { name } : {}) } : undefined;
|
|
699
596
|
const publishes = args.action === 'andorra_graph_publish' && typeof input.draftId === 'string' ? this.drafts.get(input.draftId) : undefined;
|
|
700
597
|
const removes = (args.action === 'andorra_graph_delete' || args.action === 'andorra_graph_restore') && typeof input.id === 'string' ? { id: input.id } : undefined;
|
|
701
|
-
|
|
598
|
+
const edited = DRAFT_EDIT_ACTIONS.has(String(args.action)) && typeof input.draftId === 'string' ? this.drafts.get(input.draftId) : undefined;
|
|
599
|
+
const edits = edited ? { graphId: edited.id, action: String(args.action), args: input } : undefined;
|
|
600
|
+
this.graphCalls.set(data.toolCallId, { line, ...(begins ? { begins } : {}), ...(publishes ? { publishes } : {}), ...(removes ? { removes } : {}), ...(edits ? { edits } : {}) });
|
|
702
601
|
}
|
|
703
602
|
}
|
|
704
603
|
else if (event.type === 'node.tool.failed') {
|
|
@@ -712,7 +611,6 @@ export class GraphManagerChat {
|
|
|
712
611
|
else if (event.type === 'node.tool.completed') {
|
|
713
612
|
this.settleTool(data.toolCallId, 'done');
|
|
714
613
|
const call = this.endGraphCall(data.toolCallId);
|
|
715
|
-
// The reply may be clipped, or quoted inside a preview, so the draft id is found rather than parsed.
|
|
716
614
|
const draft = call?.begins === undefined ? undefined : /\\*"draftId\\*"\s*:\s*\\*"([a-f0-9-]{36})\\*"/i.exec(String(data.output ?? ''))?.[1];
|
|
717
615
|
if (draft !== undefined && call?.begins !== undefined) {
|
|
718
616
|
this.drafts.delete(draft);
|
|
@@ -720,10 +618,14 @@ export class GraphManagerChat {
|
|
|
720
618
|
if (this.drafts.size > DRAFTS_MAX)
|
|
721
619
|
this.drafts.delete(this.drafts.keys().next().value);
|
|
722
620
|
}
|
|
621
|
+
if (call?.edits) {
|
|
622
|
+
const edit = draftEdit(call.edits.action, call.edits.args, data.output);
|
|
623
|
+
if (edit)
|
|
624
|
+
this.broadcast({ type: 'graph.edit', graphId: call.edits.graphId, edit });
|
|
625
|
+
}
|
|
723
626
|
this.checkRevision(call?.publishes ?? call?.removes);
|
|
724
627
|
}
|
|
725
628
|
}
|
|
726
|
-
/** Settles a tool row in place. A call reported without an id, or never opened, has no row to settle. */
|
|
727
629
|
settleTool(toolCallId, status, reason) {
|
|
728
630
|
if (typeof toolCallId !== 'string' || !toolCallId)
|
|
729
631
|
return;
|
|
@@ -733,11 +635,6 @@ export class GraphManagerChat {
|
|
|
733
635
|
const detail = reason ? { reason } : {};
|
|
734
636
|
this.replace(entry => entry.type === 'tool' && entry.id === toolCallId && entry.status === 'running', entry => ({ ...entry, status, ...detail, endedAt }), { type: 'tool.settled', id: toolCallId, status, ...detail, endedAt });
|
|
735
637
|
}
|
|
736
|
-
/**
|
|
737
|
-
* One model call's reasoning, folded into a single row the way the app's transcript folds it: a
|
|
738
|
-
* retried request restarts the row, deltas grow it, and the completion settles it with the
|
|
739
|
-
* authoritative text, or takes it away when the call streamed no reasoning at all.
|
|
740
|
-
*/
|
|
741
638
|
onReasoning(type, data) {
|
|
742
639
|
const reasoningId = typeof data.reasoningId === 'string' && data.reasoningId ? data.reasoningId : undefined;
|
|
743
640
|
if (!reasoningId)
|
|
@@ -753,7 +650,6 @@ export class GraphManagerChat {
|
|
|
753
650
|
else if (type === 'agent.reasoning.delta') {
|
|
754
651
|
if (!text)
|
|
755
652
|
return;
|
|
756
|
-
// A delta past the row's completion belongs to a stream the engine already closed.
|
|
757
653
|
if (!this.replace(entry => mine(entry) && entry.type === 'thought' && entry.status === 'thinking', entry => ({ ...entry, text: entry.text + text }), { type: 'thought.delta', id, text })) {
|
|
758
654
|
if (!this.transcript.some(mine))
|
|
759
655
|
this.emit({ type: 'thought', id, text, status: 'thinking', startedAt: this.now() });
|
|
@@ -782,10 +678,6 @@ export class GraphManagerChat {
|
|
|
782
678
|
this.emit(settled);
|
|
783
679
|
}
|
|
784
680
|
}
|
|
785
|
-
/**
|
|
786
|
-
* Rows a run left open when it ended: a call it never reported the end of is stopped, a thought
|
|
787
|
-
* still streaming keeps what it streamed, and one that streamed nothing is taken away.
|
|
788
|
-
*/
|
|
789
681
|
settleOpenRows() {
|
|
790
682
|
const endedAt = this.now();
|
|
791
683
|
for (const entry of [...this.transcript]) {
|
|
@@ -814,16 +706,6 @@ export class GraphManagerChat {
|
|
|
814
706
|
this.graphCalls.delete(toolCallId);
|
|
815
707
|
return call;
|
|
816
708
|
}
|
|
817
|
-
/**
|
|
818
|
-
* The `graphs` tool also lists and reads, so a save is told by the stored revision rising. The
|
|
819
|
-
* open graph is checked after every call. A publish of another graph (the only way the agent can
|
|
820
|
-
* save its work on the bundled preset) is checked under that graph's id, and reported with the
|
|
821
|
-
* name it was begun with so the panel can offer to open it; so is a delete or a restore of one.
|
|
822
|
-
*
|
|
823
|
-
* Deleting a graph also raises its revision: the new one carries `metadata.deletedAt`. That is
|
|
824
|
-
* reported as `graph.deleted`, never as a save, so no panel loads a deleted graph as an editable
|
|
825
|
-
* one. A restore publishes a live revision above it, which is a save like any other.
|
|
826
|
-
*/
|
|
827
709
|
checkRevision(published) {
|
|
828
710
|
const other = published !== undefined && published.id !== this.openGraphId ? published : undefined;
|
|
829
711
|
const id = other?.id ?? this.openGraphId;
|
|
@@ -835,7 +717,6 @@ export class GraphManagerChat {
|
|
|
835
717
|
return;
|
|
836
718
|
const { revision } = latest;
|
|
837
719
|
if (other) {
|
|
838
|
-
// The user may have opened that graph since: its saves are then the open graph's to report.
|
|
839
720
|
if (id === this.openGraphId || revision <= (this.otherRevisions.get(id) ?? 0))
|
|
840
721
|
return;
|
|
841
722
|
this.otherRevisions.set(id, revision);
|
|
@@ -848,11 +729,9 @@ export class GraphManagerChat {
|
|
|
848
729
|
this.emit(latest.deleted ? { type: 'graph.deleted', graphId: id } : { type: 'graph.saved', graphId: id, revision });
|
|
849
730
|
});
|
|
850
731
|
}
|
|
851
|
-
/** The run is over, however it ended. */
|
|
852
732
|
finish(runId) {
|
|
853
733
|
if (runId !== undefined)
|
|
854
734
|
this.finishedRunId = runId;
|
|
855
|
-
// A call the run never reported the end of ended with the run.
|
|
856
735
|
this.graphCalls.clear();
|
|
857
736
|
this.settleOpenRows();
|
|
858
737
|
this.runId = undefined;
|
|
@@ -878,7 +757,6 @@ export class GraphManagerChat {
|
|
|
878
757
|
wake();
|
|
879
758
|
this.armIdleStop();
|
|
880
759
|
}
|
|
881
|
-
/** Read through a call so a check after an await sees the state as it is then. */
|
|
882
760
|
isIdle() { return this.state === 'idle'; }
|
|
883
761
|
whenIdle(ms) {
|
|
884
762
|
if (this.state === 'idle' || this.closed)
|
|
@@ -889,7 +767,6 @@ export class GraphManagerChat {
|
|
|
889
767
|
this.idleWaiters.push(() => { clearTimeout(timer); done(); });
|
|
890
768
|
});
|
|
891
769
|
}
|
|
892
|
-
/** An engine is kept while a run is working or waiting on the user, and while any panel is connected. */
|
|
893
770
|
armIdleStop() {
|
|
894
771
|
clearTimeout(this.idleTimer);
|
|
895
772
|
this.idleTimer = undefined;
|
|
@@ -897,7 +774,6 @@ export class GraphManagerChat {
|
|
|
897
774
|
return;
|
|
898
775
|
const engine = this.engine;
|
|
899
776
|
this.idleTimer = setTimeout(() => {
|
|
900
|
-
// The session is on disk, so the conversation continues on the next engine.
|
|
901
777
|
if (this.engine === engine && this.state === 'idle' && this.listeners.size === 0)
|
|
902
778
|
void this.stopEngine(engine);
|
|
903
779
|
}, this.idleMs);
|
|
@@ -909,17 +785,12 @@ export class GraphManagerChat {
|
|
|
909
785
|
this.transcript.push(event);
|
|
910
786
|
this.broadcast(event);
|
|
911
787
|
}
|
|
912
|
-
/** Sends an event without adding a row: it changes a row the transcript already holds. */
|
|
913
788
|
broadcast(event) {
|
|
914
789
|
if (this.closed)
|
|
915
790
|
return;
|
|
916
791
|
for (const listener of [...this.listeners])
|
|
917
792
|
this.deliverTo(listener, event);
|
|
918
793
|
}
|
|
919
|
-
/**
|
|
920
|
-
* Replaces the latest row `match` finds with `next` of it, and tells the panels with `event`.
|
|
921
|
-
* False when no row matches, so the caller can add one instead.
|
|
922
|
-
*/
|
|
923
794
|
replace(match, next, event) {
|
|
924
795
|
for (let index = this.transcript.length - 1; index >= 0; index--) {
|
|
925
796
|
if (!match(this.transcript[index]))
|
|
@@ -931,10 +802,9 @@ export class GraphManagerChat {
|
|
|
931
802
|
return false;
|
|
932
803
|
}
|
|
933
804
|
deliverTo(listener, event) {
|
|
934
|
-
// One panel's broken connection must not cost the others the event.
|
|
935
805
|
try {
|
|
936
806
|
listener(event);
|
|
937
807
|
}
|
|
938
|
-
catch {
|
|
808
|
+
catch { }
|
|
939
809
|
}
|
|
940
810
|
}
|
|
@@ -1,30 +1,10 @@
|
|
|
1
1
|
import type { Config } from './config.js';
|
|
2
2
|
import type { Graph } from './graphs.js';
|
|
3
3
|
import { type ProviderConfig } from './providers.js';
|
|
4
|
-
/**
|
|
5
|
-
* A graph cannot be bound to this machine's providers: one it names is absent, or more than one
|
|
6
|
-
* local Codex OAuth profile could serve it, so execution has no single profile to bind.
|
|
7
|
-
*
|
|
8
|
-
* Selection keeps the graph (it must stay selectable to be edited, and a run that overrides every
|
|
9
|
-
* node sets the references aside); what refuses is the run, before any node starts. The two are
|
|
10
|
-
* told apart by this class rather than by message text.
|
|
11
|
-
*/
|
|
12
4
|
export declare class GraphProviderUnavailableError extends Error {
|
|
13
5
|
constructor(message: string);
|
|
14
6
|
}
|
|
15
|
-
/** Add portable identity metadata when a machine publishes a graph revision. Existing identities win. */
|
|
16
7
|
export declare function stampGraphProviderProfiles(graph: Graph, config: {
|
|
17
8
|
providers: readonly Pick<ProviderConfig, 'id' | 'type' | 'model'>[];
|
|
18
|
-
},
|
|
19
|
-
/** A CLI model override chooses its model before updating config.json. */
|
|
20
|
-
selectedModels?: Readonly<Record<string, string>>): Graph;
|
|
21
|
-
/**
|
|
22
|
-
* Use local profiles for execution without changing the saved graph. A provider configured
|
|
23
|
-
* locally under the same ID is authoritative: references that do not name a model follow that
|
|
24
|
-
* provider's current configured model, so a provider-settings change reaches future runs without
|
|
25
|
-
* republishing the graph. A recorded Codex OAuth identity may instead bind to a differently named
|
|
26
|
-
* local Codex profile offering every model its references require — including models from
|
|
27
|
-
* providerless `per-role` or `specific` subagent entries, which execution resolves through the
|
|
28
|
-
* parent node. The Codex adapter/health check verifies the actual sign-in before any run is allowed.
|
|
29
|
-
*/
|
|
9
|
+
}, selectedModels?: Readonly<Record<string, string>>): Graph;
|
|
30
10
|
export declare function bindPortableGraphProviders(graph: Graph, config: Pick<Config, 'providers'>): Graph;
|