@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
|
@@ -11,33 +11,21 @@ import { GRAPH_MANAGER_GRAPH_ID } from './graphs.js';
|
|
|
11
11
|
import { clipText } from './text.js';
|
|
12
12
|
import { describeTool } from './transcript.js';
|
|
13
13
|
const STARTUP_MS = 60_000;
|
|
14
|
-
/** How long a new chat waits for a cancelled run to end before it stops the engine instead. */
|
|
15
14
|
const RESET_WAIT_MS = 10_000;
|
|
16
|
-
/** How long a message waits for a run that is already ending before it is reported instead of sent. */
|
|
17
15
|
const ENDING_WAIT_MS = 30_000;
|
|
18
|
-
/** Mirrors `MAX_TASK_CHARS` in `app-server.ts`: the engine refuses a longer `run.start` task or `run.steer` text. */
|
|
19
16
|
export const MANAGER_TASK_MAX_CHARS = 100_000;
|
|
20
17
|
const UPDATE_MESSAGE = 'Update Andorra Code to use Graph Manager.';
|
|
21
18
|
const TOO_LARGE_MESSAGE = 'This graph is too large to send to Graph Manager.';
|
|
22
|
-
/** The longest tool or approval line the panel is given. */
|
|
23
19
|
const TOOL_LINE_MAX = 120;
|
|
24
|
-
/** How many draft-to-graph pairings are remembered; an agent holds a handful of drafts at most. */
|
|
25
20
|
const DRAFTS_MAX = 64;
|
|
26
|
-
/** The bundled preset every installation has. Nothing can be saved under its id. */
|
|
27
21
|
const BUNDLED_GRAPH_ID = 'default';
|
|
28
|
-
/** The draft actions that change what the canvas shows. */
|
|
29
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']);
|
|
30
|
-
/**
|
|
31
|
-
* The change a successful draft call made, read from its reply where the backend decided something
|
|
32
|
-
* (a new card's placement, a connection's generated id) and from its arguments otherwise. Undefined
|
|
33
|
-
* when the reply cannot be read, so the canvas is never shown a guess.
|
|
34
|
-
*/
|
|
35
23
|
export function draftEdit(action, args, output) {
|
|
36
24
|
let reply = {};
|
|
37
25
|
try {
|
|
38
26
|
reply = record(record(JSON.parse(String(output ?? ''))).data);
|
|
39
27
|
}
|
|
40
|
-
catch {
|
|
28
|
+
catch { }
|
|
41
29
|
const node = record(reply.node), edge = record(reply.edge), patch = record(args.patch);
|
|
42
30
|
if (action === 'andorra_graph_node_upsert' || action === 'andorra_graph_node_patch')
|
|
43
31
|
return typeof node.id === 'string' ? { kind: 'node', node } : undefined;
|
|
@@ -51,10 +39,8 @@ export function draftEdit(action, args, output) {
|
|
|
51
39
|
return Object.keys(patch).length ? { kind: 'graph', patch } : undefined;
|
|
52
40
|
return undefined;
|
|
53
41
|
}
|
|
54
|
-
/** The engine went away, deliberately or not; whoever stopped it has already said what there is to say. */
|
|
55
42
|
class EngineStopped extends Error {
|
|
56
43
|
}
|
|
57
|
-
/** The engine answered a request with an error; `code` is its own classification. */
|
|
58
44
|
class EngineRefusal extends Error {
|
|
59
45
|
code;
|
|
60
46
|
constructor(message, code) {
|
|
@@ -73,15 +59,8 @@ const toolArguments = (value) => {
|
|
|
73
59
|
return {};
|
|
74
60
|
}
|
|
75
61
|
};
|
|
76
|
-
/** Plain text on one line: control characters and line breaks become single spaces. */
|
|
77
62
|
const oneLine = (value) => typeof value === 'string' ? value.replace(/[\x00-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069\s]+/g, ' ').trim() : '';
|
|
78
63
|
const toolLine = (...parts) => clipText(parts.map(oneLine).filter(Boolean).join(' \u00b7 '), TOOL_LINE_MAX);
|
|
79
|
-
/**
|
|
80
|
-
* One line saying what a tool call or an approval is about, for the tools Graph Manager works with:
|
|
81
|
-
* the `graphs` action and the graph it names, the skill being read, the server being connected.
|
|
82
|
-
* A publish names only its draft, so `graphOfDraft` supplies the graph when the caller knows it.
|
|
83
|
-
* Every other tool keeps the transcript's wording. The line is at most 120 characters.
|
|
84
|
-
*/
|
|
85
64
|
export function describeManagerTool(name, value, graphOfDraft = () => undefined) {
|
|
86
65
|
const args = toolArguments(value);
|
|
87
66
|
if (name === 'graphs') {
|
|
@@ -97,7 +76,6 @@ export function describeManagerTool(name, value, graphOfDraft = () => undefined)
|
|
|
97
76
|
return toolLine(name, args.server);
|
|
98
77
|
return clipText(describeTool(name, value), TOOL_LINE_MAX);
|
|
99
78
|
}
|
|
100
|
-
/** What each `graphs` action does, as the row's verb. An action not named here shows its own name. */
|
|
101
79
|
const GRAPH_ACTION_VERBS = {
|
|
102
80
|
andorra_graph_begin: 'Open draft', andorra_graph_get: 'Read graph', andorra_graph_guide: 'Read guide',
|
|
103
81
|
andorra_graph_node_upsert: 'Set step', andorra_graph_node_patch: 'Edit step', andorra_graph_node_remove: 'Remove step',
|
|
@@ -105,12 +83,6 @@ const GRAPH_ACTION_VERBS = {
|
|
|
105
83
|
andorra_graph_validate: 'Validate draft', andorra_graph_publish: 'Save version', andorra_graph_discard: 'Discard draft',
|
|
106
84
|
andorra_graph_delete: 'Delete graph', andorra_graph_restore: 'Restore graph',
|
|
107
85
|
};
|
|
108
|
-
/**
|
|
109
|
-
* A tool call split the way the app's transcript draws it: the verb, and the thing it acted on.
|
|
110
|
-
* A node is named by its name when the call carries one; a connection reads `source → target`
|
|
111
|
-
* with its outcome. The graph the call is about is left out when it is the open one, which every
|
|
112
|
-
* call of a conversation usually is. Any other tool keeps the transcript's one line as its verb.
|
|
113
|
-
*/
|
|
114
86
|
export function managerToolParts(name, value, openGraphId) {
|
|
115
87
|
const args = toolArguments(value);
|
|
116
88
|
const clip = (text) => text ? clipText(text, TOOL_LINE_MAX) : undefined;
|
|
@@ -144,25 +116,8 @@ export function managerToolParts(name, value, openGraphId) {
|
|
|
144
116
|
return parts('Connect server', oneLine(args.server));
|
|
145
117
|
return { verb: clipText(describeTool(name, value), TOOL_LINE_MAX) };
|
|
146
118
|
}
|
|
147
|
-
/** Bookkeeping calls the runtime handles itself; a conversation shows what the agent did, not these. */
|
|
148
119
|
const HIDDEN_TOOLS = new Set(['update_todos', 'update_widget', 'prepare_steps', 'restore_tools', 'complete_agent']);
|
|
149
120
|
const STOPPED_UNREAD_MESSAGE = 'Graph Manager was stopped before it read your last message. Send it again to continue.';
|
|
150
|
-
/**
|
|
151
|
-
* The environment the chat's engine starts in: the parent's own, so the engine is signed in as the
|
|
152
|
-
* parent is. Stored credentials are scoped to an explicitly named home (`credentialIdentity`), so
|
|
153
|
-
* naming even the default home would move the engine to an empty credential slot. The home is
|
|
154
|
-
* named only when the chat runs against a different one than the environment already selects.
|
|
155
|
-
*
|
|
156
|
-
* The engine is marked as a worker, as the automation runner marks its own. An unmarked engine is a
|
|
157
|
-
* window's: it runs the user's automations, watches their pull requests and archives old sessions.
|
|
158
|
-
* This one is stopped when idle and when the editor closes, which would interrupt an automation it
|
|
159
|
-
* had claimed. The mark switches off those three background services and nothing else.
|
|
160
|
-
*
|
|
161
|
-
* A relative inherited home means the parent's working directory, and the engine starts in its own
|
|
162
|
-
* workspace, where the same words would name another folder with another configuration and another
|
|
163
|
-
* credential slot. It is handed the absolute path instead, which `credentialIdentity` resolves to
|
|
164
|
-
* the scope the parent reads.
|
|
165
|
-
*/
|
|
166
121
|
export function managerEngineEnvironment(directory, environment = process.env) {
|
|
167
122
|
const inherited = environment.ANDORRACODE_HOME;
|
|
168
123
|
const worker = { ...environment, ...(inherited && !isAbsolute(inherited) ? { ANDORRACODE_HOME: resolve(inherited) } : {}), ANDORRA_AUTOMATION_WORKER: '1' };
|
|
@@ -170,24 +125,13 @@ export function managerEngineEnvironment(directory, environment = process.env) {
|
|
|
170
125
|
return worker;
|
|
171
126
|
return { ...worker, ANDORRACODE_HOME: resolve(directory) };
|
|
172
127
|
}
|
|
173
|
-
/**
|
|
174
|
-
* The empty folder Graph Manager's engine runs in: one per config home, outside it. The config home
|
|
175
|
-
* is protected runtime metadata, so a workspace inside it made every read the agent tried (a Grep, a
|
|
176
|
-
* Glob) ask the user for approval. Outside it, reads run freely in an empty folder and the only
|
|
177
|
-
* prompts left are the ones that change something: publishing, deleting or restoring a graph.
|
|
178
|
-
*/
|
|
179
128
|
export function managerWorkspace(directory) {
|
|
180
129
|
return join(tmpdir(), 'andorra-graph-manager', createHash('sha256').update(resolve(directory)).digest('hex').slice(0, 16));
|
|
181
130
|
}
|
|
182
|
-
/**
|
|
183
|
-
* What the agent is given with every message: which graph is open, the canvas as the user sees it
|
|
184
|
-
* now (unsaved edits included), the model the panel has selected, and the user's own words.
|
|
185
|
-
*/
|
|
186
131
|
export function managerTask(turn) {
|
|
187
132
|
const saved = !turn.saved ? 'not saved yet' : turn.revision === undefined ? 'saved' : `saved revision ${turn.revision}`;
|
|
188
133
|
return [
|
|
189
134
|
`You are helping in Graph Studio. Open graph: "${graphName(turn.graph)}", id ${graphId(turn.graph)} (${saved}).`,
|
|
190
|
-
// A save under the preset's id is refused, so the agent is told before it tries.
|
|
191
135
|
graphId(turn.graph) === BUNDLED_GRAPH_ID
|
|
192
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.`
|
|
193
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).',
|
|
@@ -202,18 +146,6 @@ export function managerTask(turn) {
|
|
|
202
146
|
turn.text,
|
|
203
147
|
].join('\n');
|
|
204
148
|
}
|
|
205
|
-
/**
|
|
206
|
-
* One Graph Manager conversation, run on an engine of its own.
|
|
207
|
-
*
|
|
208
|
-
* The engine that hosts Graph Studio may be busy with the user's task and runs one task at a time,
|
|
209
|
-
* so the chat spawns a dedicated `app-server --stdio` child in an empty workspace and speaks the
|
|
210
|
-
* same line protocol the automation runner does. The graph server keeps one chat per graph, and every
|
|
211
|
-
* panel open on that graph shares it: each subscriber is caught up with a snapshot and then receives
|
|
212
|
-
* the stream.
|
|
213
|
-
*
|
|
214
|
-
* Failures on the engine's side are reported as `error` events rather than rejections, because the
|
|
215
|
-
* message that failed is already on every panel's transcript and the stream is where panels listen.
|
|
216
|
-
*/
|
|
217
149
|
export class GraphManagerChat {
|
|
218
150
|
options;
|
|
219
151
|
directory;
|
|
@@ -225,55 +157,38 @@ export class GraphManagerChat {
|
|
|
225
157
|
engine;
|
|
226
158
|
sessionId;
|
|
227
159
|
runId;
|
|
228
|
-
/** The run whose terminal event has been handled; its late `run.start` answer must not revive it. */
|
|
229
160
|
finishedRunId;
|
|
230
|
-
/** Approvals and questions the panel has been shown and nobody has settled yet. */
|
|
231
161
|
prompts = new Set();
|
|
232
|
-
/** `graphs` calls in flight, by tool call id: the line shown for each, and the graph a begin opens or a publish saves. */
|
|
233
162
|
graphCalls = new Map();
|
|
234
|
-
/** Which graph each draft is of, learned from `andorra_graph_begin`, so a publish can name its graph. */
|
|
235
163
|
drafts = new Map();
|
|
236
|
-
/** The latest revision reported for each graph the agent saved other than the open one. */
|
|
237
164
|
otherRevisions = new Map();
|
|
238
|
-
/** The model the latest message chose, for a steering message that has to be sent again as a run. */
|
|
239
165
|
lastModel;
|
|
240
|
-
/**
|
|
241
|
-
* Messages a run ended without reading, oldest first, each already a whole task. The engine keeps
|
|
242
|
-
* them out of the session's history, so they stay here until an engine has accepted them.
|
|
243
|
-
*/
|
|
244
166
|
unread = [];
|
|
245
|
-
/** The pair the latest run was started on or last switched to, to tell when a message changes it. */
|
|
246
167
|
runModel;
|
|
247
168
|
openGraphId;
|
|
248
169
|
lastRevision = 0;
|
|
249
170
|
revisionCheck = Promise.resolve();
|
|
250
171
|
cancelling = false;
|
|
251
|
-
/** How many times Stop was pressed, so a message still waiting to be sent can tell it was stopped too. */
|
|
252
172
|
stops = 0;
|
|
253
173
|
closed = false;
|
|
254
|
-
/** Messages and resets are delivered one at a time, in the order they were asked for. */
|
|
255
174
|
queue = Promise.resolve();
|
|
256
175
|
idleTimer;
|
|
257
176
|
idleWaiters = [];
|
|
258
177
|
now;
|
|
259
|
-
/** Names the rows of tool calls the engine reported without an id of their own. */
|
|
260
178
|
toolRows = 0;
|
|
261
179
|
constructor(options) {
|
|
262
180
|
this.options = options;
|
|
263
|
-
// Resolved now: the engine is started in another working directory.
|
|
264
181
|
this.directory = resolve(options.directory);
|
|
265
182
|
this.workspace = resolve(options.workspace ?? managerWorkspace(this.directory));
|
|
266
183
|
this.idleMs = options.idleMs ?? 600_000;
|
|
267
184
|
this.now = options.now ?? Date.now;
|
|
268
185
|
}
|
|
269
|
-
/** The listener is first handed the conversation so far as one snapshot, then every later event. */
|
|
270
186
|
subscribe(listener) {
|
|
271
187
|
this.listeners.add(listener);
|
|
272
188
|
this.armIdleStop();
|
|
273
189
|
this.deliverTo(listener, { type: 'snapshot', events: [...this.transcript], state: this.state });
|
|
274
190
|
return () => { this.listeners.delete(listener); this.armIdleStop(); };
|
|
275
191
|
}
|
|
276
|
-
/** Start the conversation, continue it, or steer the run that is working. */
|
|
277
192
|
send(turn) {
|
|
278
193
|
if (this.closed)
|
|
279
194
|
return Promise.resolve();
|
|
@@ -284,7 +199,6 @@ export class GraphManagerChat {
|
|
|
284
199
|
async approve(id, approved) {
|
|
285
200
|
if (!this.engine || !this.prompts.has(id))
|
|
286
201
|
return;
|
|
287
|
-
// A refusal means the engine no longer holds the prompt, which settles it just the same.
|
|
288
202
|
await this.request(this.engine, 'run.approve', { id, approved }).catch(() => { });
|
|
289
203
|
this.resolvePrompt(id);
|
|
290
204
|
}
|
|
@@ -295,23 +209,18 @@ export class GraphManagerChat {
|
|
|
295
209
|
this.resolvePrompt(id);
|
|
296
210
|
}
|
|
297
211
|
async cancel() {
|
|
298
|
-
// A live run is cancelled at once, whatever is queued behind it. A start still on its way has
|
|
299
|
-
// no run to name yet, so the cancel follows it; every queued step is bounded, so this ends.
|
|
300
212
|
this.stops++;
|
|
301
|
-
// Stop covers a message no run has read yet, as it covers one still waiting to be sent.
|
|
302
213
|
if (this.unread.splice(0).length)
|
|
303
214
|
this.emit({ type: 'error', message: STOPPED_UNREAD_MESSAGE });
|
|
304
215
|
if (this.runId === undefined)
|
|
305
216
|
await this.queue;
|
|
306
217
|
await this.cancelRun();
|
|
307
218
|
}
|
|
308
|
-
/** Forget the session and the transcript. The engine stays for the next conversation. */
|
|
309
219
|
reset() {
|
|
310
220
|
if (this.closed)
|
|
311
221
|
return Promise.resolve();
|
|
312
222
|
return this.enqueue(async () => {
|
|
313
223
|
await this.cancelRun();
|
|
314
|
-
// The engine runs one task at a time, so the next conversation waits for this one to end.
|
|
315
224
|
if (this.state !== 'idle')
|
|
316
225
|
await this.whenIdle(RESET_WAIT_MS);
|
|
317
226
|
if (this.state !== 'idle') {
|
|
@@ -333,7 +242,6 @@ export class GraphManagerChat {
|
|
|
333
242
|
this.deliverTo(listener, snapshot);
|
|
334
243
|
});
|
|
335
244
|
}
|
|
336
|
-
/** Cancel the run, stop the child and clear the timers. Nothing is started afterwards. */
|
|
337
245
|
async close() {
|
|
338
246
|
if (this.closed)
|
|
339
247
|
return;
|
|
@@ -350,7 +258,6 @@ export class GraphManagerChat {
|
|
|
350
258
|
await this.stopEngine(engine);
|
|
351
259
|
}
|
|
352
260
|
enqueue(step) {
|
|
353
|
-
// A step reports its own failures, so the chain never rejects and never stalls.
|
|
354
261
|
const next = this.queue.then(step).catch(() => { });
|
|
355
262
|
this.queue = next;
|
|
356
263
|
return next;
|
|
@@ -358,8 +265,6 @@ export class GraphManagerChat {
|
|
|
358
265
|
async deliver(turn, stops) {
|
|
359
266
|
if (this.closed)
|
|
360
267
|
return;
|
|
361
|
-
// Stop was pressed after this message was sent, while it waited its turn behind another. Stop
|
|
362
|
-
// covers everything sent before it: delivering it now would start a run the user just stopped.
|
|
363
268
|
if (this.stops !== stops) {
|
|
364
269
|
this.emit({ type: 'error', message: STOPPED_UNREAD_MESSAGE });
|
|
365
270
|
return;
|
|
@@ -370,17 +275,12 @@ export class GraphManagerChat {
|
|
|
370
275
|
this.openGraphId = id;
|
|
371
276
|
this.lastModel = { provider: turn.provider, model: turn.model };
|
|
372
277
|
const task = managerTask(turn);
|
|
373
|
-
// The canvas travels inside the task, so a large graph can pass the engine's limit. Refused here,
|
|
374
|
-
// before anything is sent, with words about the graph rather than the engine's about a field.
|
|
375
278
|
if (task.length > MANAGER_TASK_MAX_CHARS) {
|
|
376
279
|
this.emit({ type: 'error', message: TOO_LARGE_MESSAGE });
|
|
377
280
|
return;
|
|
378
281
|
}
|
|
379
282
|
if (this.runId !== undefined && this.state !== 'idle' && this.engine) {
|
|
380
283
|
const engine = this.engine, runId = this.runId;
|
|
381
|
-
// A steer carries words only, so a model chosen since the run began is applied to the run first.
|
|
382
|
-
// A refusal is held until the steer is answered: a run that is ending refuses both, and the
|
|
383
|
-
// message then starts the next run on the new model with nothing to report.
|
|
384
284
|
const keptModel = await this.switchRunModel(engine, runId, turn.provider, turn.model);
|
|
385
285
|
if (keptModel === 'stopped')
|
|
386
286
|
return;
|
|
@@ -393,20 +293,14 @@ export class GraphManagerChat {
|
|
|
393
293
|
catch (error) {
|
|
394
294
|
if (error instanceof EngineStopped)
|
|
395
295
|
return;
|
|
396
|
-
// `not-found` and `busy` are how the engine says the run is already ending and will not read
|
|
397
|
-
// another message. Anything else is a refusal of the message itself, with the run still live.
|
|
398
296
|
const ending = error instanceof EngineRefusal && (error.code === 'not-found' || error.code === 'busy');
|
|
399
297
|
if (!ending) {
|
|
400
298
|
this.emit({ type: 'error', message: error instanceof Error ? error.message : String(error) });
|
|
401
299
|
return;
|
|
402
300
|
}
|
|
403
|
-
// The message becomes the next run. The wait ends with the run, with the engine (an exit sets
|
|
404
|
-
// idle), or at the bound, so nothing queued behind it is held indefinitely.
|
|
405
301
|
await this.whenIdle(ENDING_WAIT_MS);
|
|
406
302
|
if (this.closed)
|
|
407
303
|
return;
|
|
408
|
-
// Stop was pressed after this message was sent. It covers the message too: starting a run for
|
|
409
|
-
// it now would set Graph Manager working again right after the user stopped it.
|
|
410
304
|
if (this.stops !== stops) {
|
|
411
305
|
this.emit({ type: 'error', message: STOPPED_UNREAD_MESSAGE });
|
|
412
306
|
return;
|
|
@@ -417,9 +311,6 @@ export class GraphManagerChat {
|
|
|
417
311
|
}
|
|
418
312
|
}
|
|
419
313
|
}
|
|
420
|
-
// Messages the last run never read come first, so the agent takes them in the order they were
|
|
421
|
-
// sent. When they do not fit in one task with this one they stay queued, and are steered into
|
|
422
|
-
// the run this message starts.
|
|
423
314
|
const carried = [...this.unread, task].join('\n\n');
|
|
424
315
|
if (this.unread.length && carried.length <= MANAGER_TASK_MAX_CHARS) {
|
|
425
316
|
this.unread = [];
|
|
@@ -428,18 +319,12 @@ export class GraphManagerChat {
|
|
|
428
319
|
}
|
|
429
320
|
await this.start(task, turn.provider, turn.model, graphName(turn.graph));
|
|
430
321
|
}
|
|
431
|
-
/**
|
|
432
|
-
* Hands the engine every message a run ended without reading. A message leaves `unread` only when
|
|
433
|
-
* it is on its way to an engine: as the next run when nothing is working, else steered into the run
|
|
434
|
-
* that is. A run that is itself ending refuses the steer, and the message then waits for the run after it.
|
|
435
|
-
*/
|
|
436
322
|
async deliverUnread() {
|
|
437
323
|
while (this.unread.length && !this.closed) {
|
|
438
324
|
const chosen = this.lastModel;
|
|
439
325
|
if (!chosen)
|
|
440
326
|
return;
|
|
441
327
|
if (this.isIdle()) {
|
|
442
|
-
// As many as one task holds, and always at least the oldest.
|
|
443
328
|
let taken = 1;
|
|
444
329
|
while (taken < this.unread.length && this.unread.slice(0, taken + 1).join('\n\n').length <= MANAGER_TASK_MAX_CHARS)
|
|
445
330
|
taken++;
|
|
@@ -449,7 +334,6 @@ export class GraphManagerChat {
|
|
|
449
334
|
const text = this.unread[0];
|
|
450
335
|
const engine = this.engine;
|
|
451
336
|
if (this.runId === undefined || !engine) {
|
|
452
|
-
// A run is starting or its engine is going: the message waits for whichever comes of it.
|
|
453
337
|
await this.whenIdle(ENDING_WAIT_MS);
|
|
454
338
|
if (!this.isIdle())
|
|
455
339
|
return;
|
|
@@ -457,7 +341,6 @@ export class GraphManagerChat {
|
|
|
457
341
|
}
|
|
458
342
|
try {
|
|
459
343
|
await this.request(engine, 'run.steer', { runId: this.runId, sessionId: this.sessionId, text });
|
|
460
|
-
// Stop may have taken the message while the engine was answering.
|
|
461
344
|
if (this.unread[0] === text)
|
|
462
345
|
this.unread.shift();
|
|
463
346
|
}
|
|
@@ -465,30 +348,21 @@ export class GraphManagerChat {
|
|
|
465
348
|
if (this.unread[0] !== text)
|
|
466
349
|
continue;
|
|
467
350
|
if (error instanceof EngineStopped) {
|
|
468
|
-
// A deliberate stop keeps the message for the next run; a crash has set the chat idle.
|
|
469
351
|
if (!this.isIdle())
|
|
470
352
|
return;
|
|
471
353
|
continue;
|
|
472
354
|
}
|
|
473
355
|
if (!(error instanceof EngineRefusal && (error.code === 'not-found' || error.code === 'busy'))) {
|
|
474
|
-
// A refusal of the message itself: no engine will take it, and the user is told.
|
|
475
356
|
this.unread.shift();
|
|
476
357
|
this.emit({ type: 'error', message: error instanceof Error ? error.message : String(error) });
|
|
477
358
|
continue;
|
|
478
359
|
}
|
|
479
360
|
await this.whenIdle(ENDING_WAIT_MS);
|
|
480
|
-
// Still not over at the bound: the message stays for the next message's run to carry.
|
|
481
361
|
if (!this.isIdle())
|
|
482
362
|
return;
|
|
483
363
|
}
|
|
484
364
|
}
|
|
485
365
|
}
|
|
486
|
-
/**
|
|
487
|
-
* Moves the working run to the pair a message chose, when it differs from the pair the run is on.
|
|
488
|
-
* `overrideAllNodes: false` is the scope `run.start` gave the first pair: the run's own, which
|
|
489
|
-
* Graph Manager's one agent node (it names no model) and whatever it delegates to answer from.
|
|
490
|
-
* Undefined when the run is on the pair; otherwise why it is not.
|
|
491
|
-
*/
|
|
492
366
|
async switchRunModel(engine, runId, provider, model) {
|
|
493
367
|
const running = this.runModel;
|
|
494
368
|
if (running === undefined || (running.provider === provider && running.model === model))
|
|
@@ -516,12 +390,9 @@ export class GraphManagerChat {
|
|
|
516
390
|
const id = record(created.session).id;
|
|
517
391
|
if (typeof id !== 'string')
|
|
518
392
|
throw new Error('Graph Manager could not start its conversation.');
|
|
519
|
-
// The rename pins the name, so the engine's automatic titling leaves it alone.
|
|
520
393
|
await this.request(engine, 'sessions.rename', { id, name: title });
|
|
521
394
|
this.sessionId = id;
|
|
522
395
|
}
|
|
523
|
-
// `continueSession` extends the session just created instead of forking it, which a start
|
|
524
|
-
// that only names a session would do, leaving an empty copy behind for every conversation.
|
|
525
396
|
const started = await this.request(engine, 'run.start', {
|
|
526
397
|
workspace: this.workspace, sessionId: this.sessionId, continueSession: true, task,
|
|
527
398
|
provider, model, graph: GRAPH_MANAGER_GRAPH_ID, runPermissions: 'ask-for-approval',
|
|
@@ -529,7 +400,6 @@ export class GraphManagerChat {
|
|
|
529
400
|
if (typeof started.sessionId === 'string')
|
|
530
401
|
this.sessionId = started.sessionId;
|
|
531
402
|
this.runModel = { provider, model };
|
|
532
|
-
// A run that already ended has reported it; only a live one is still working.
|
|
533
403
|
if (typeof started.runId === 'string' && started.runId !== this.finishedRunId) {
|
|
534
404
|
this.runId = started.runId;
|
|
535
405
|
if (this.state === 'starting')
|
|
@@ -573,7 +443,6 @@ export class GraphManagerChat {
|
|
|
573
443
|
let failReady;
|
|
574
444
|
let markClosed;
|
|
575
445
|
const ready = new Promise((done, fail) => { markReady = done; failReady = fail; });
|
|
576
|
-
// Awaited by whoever starts a run; a stop nobody is waiting on must not be an unhandled rejection.
|
|
577
446
|
ready.catch(() => { });
|
|
578
447
|
const engine = {
|
|
579
448
|
child, lines: createInterface({ input: child.stdout }), ready,
|
|
@@ -602,15 +471,12 @@ export class GraphManagerChat {
|
|
|
602
471
|
this.engine = undefined;
|
|
603
472
|
if (engine.stopping || this.closed)
|
|
604
473
|
return;
|
|
605
|
-
// The run died with the engine, and its session may still carry that run's claim, so the next
|
|
606
|
-
// message begins a new session on a new engine.
|
|
607
474
|
this.sessionId = undefined;
|
|
608
475
|
const tail = engine.stderr.trim().split('\n').at(-1)?.trim();
|
|
609
476
|
this.emit({ type: 'error', message: `Graph Manager stopped unexpectedly (${detail}). Send your message again to restart it.${tail ? `\n${tail}` : ''}` });
|
|
610
477
|
this.finish(this.runId);
|
|
611
478
|
};
|
|
612
479
|
child.stderr.on('data', chunk => { engine.stderr = (engine.stderr + String(chunk)).slice(-8_192); });
|
|
613
|
-
// A write into a pipe whose reader has gone is followed by the close that reports it.
|
|
614
480
|
child.stdin.on('error', () => { });
|
|
615
481
|
child.on('error', error => gone(error.message));
|
|
616
482
|
child.once('close', code => gone(`exit ${code ?? 'signal'}`));
|
|
@@ -638,7 +504,6 @@ export class GraphManagerChat {
|
|
|
638
504
|
const data = record(message.data);
|
|
639
505
|
if (message.event === 'ready') {
|
|
640
506
|
clearTimeout(startup);
|
|
641
|
-
// Without run-scoped permissions the run would take the workspace's saved mode, not Ask for approval.
|
|
642
507
|
if (Array.isArray(data.capabilities) && data.capabilities.includes('run.start.runPermissions'))
|
|
643
508
|
markReady();
|
|
644
509
|
else
|
|
@@ -661,7 +526,6 @@ export class GraphManagerChat {
|
|
|
661
526
|
engine.child.stdin.write(JSON.stringify({ id, method, params }) + '\n');
|
|
662
527
|
});
|
|
663
528
|
}
|
|
664
|
-
/** A deliberate stop: EOF lets the engine finish its own cleanup, and it is reaped if it does not. */
|
|
665
529
|
async stopEngine(engine) {
|
|
666
530
|
engine.stopping = true;
|
|
667
531
|
if (this.engine === engine)
|
|
@@ -686,7 +550,6 @@ export class GraphManagerChat {
|
|
|
686
550
|
if (data.state === 'awaiting-approval' || data.state === 'awaiting-input')
|
|
687
551
|
this.setState('awaiting');
|
|
688
552
|
else if (data.state === 'running') {
|
|
689
|
-
// The engine reports running again only once nothing is pending, however each prompt was settled.
|
|
690
553
|
this.resolvePrompts();
|
|
691
554
|
this.setState('working');
|
|
692
555
|
}
|
|
@@ -698,13 +561,10 @@ export class GraphManagerChat {
|
|
|
698
561
|
if (event === 'run.failed' && !cancelled)
|
|
699
562
|
this.emit({ type: 'error', message: String(data.message ?? 'The run failed.') });
|
|
700
563
|
this.finish(runId);
|
|
701
|
-
// A message queued too late for the run to read is still the user's request: it becomes the next run.
|
|
702
564
|
const unread = Array.isArray(data.undeliveredSteers)
|
|
703
565
|
? data.undeliveredSteers.map(entry => record(entry).text).filter((text) => typeof text === 'string')
|
|
704
566
|
: [];
|
|
705
567
|
if (unread.length && !cancelled && !this.closed) {
|
|
706
|
-
// Queued behind whatever is already being delivered. A message whose steer this run refused
|
|
707
|
-
// starts the next run first, and takes these with it.
|
|
708
568
|
this.unread.push(...unread);
|
|
709
569
|
void this.enqueue(() => this.deliverUnread());
|
|
710
570
|
}
|
|
@@ -725,7 +585,6 @@ export class GraphManagerChat {
|
|
|
725
585
|
return;
|
|
726
586
|
const line = this.describe(String(data.name), data.arguments);
|
|
727
587
|
const id = typeof data.toolCallId === 'string' && data.toolCallId ? data.toolCallId : `tool-${++this.toolRows}`;
|
|
728
|
-
// A call id the engine reuses (a resumed call) reopens its row rather than adding a second one.
|
|
729
588
|
const opened = { type: 'tool', id, text: line, ...managerToolParts(String(data.name), data.arguments, this.openGraphId), status: 'running', startedAt: this.now() };
|
|
730
589
|
if (!this.replace(entry => entry.type === 'tool' && entry.id === id, () => opened, opened))
|
|
731
590
|
this.emit(opened);
|
|
@@ -752,7 +611,6 @@ export class GraphManagerChat {
|
|
|
752
611
|
else if (event.type === 'node.tool.completed') {
|
|
753
612
|
this.settleTool(data.toolCallId, 'done');
|
|
754
613
|
const call = this.endGraphCall(data.toolCallId);
|
|
755
|
-
// The reply may be clipped, or quoted inside a preview, so the draft id is found rather than parsed.
|
|
756
614
|
const draft = call?.begins === undefined ? undefined : /\\*"draftId\\*"\s*:\s*\\*"([a-f0-9-]{36})\\*"/i.exec(String(data.output ?? ''))?.[1];
|
|
757
615
|
if (draft !== undefined && call?.begins !== undefined) {
|
|
758
616
|
this.drafts.delete(draft);
|
|
@@ -768,7 +626,6 @@ export class GraphManagerChat {
|
|
|
768
626
|
this.checkRevision(call?.publishes ?? call?.removes);
|
|
769
627
|
}
|
|
770
628
|
}
|
|
771
|
-
/** Settles a tool row in place. A call reported without an id, or never opened, has no row to settle. */
|
|
772
629
|
settleTool(toolCallId, status, reason) {
|
|
773
630
|
if (typeof toolCallId !== 'string' || !toolCallId)
|
|
774
631
|
return;
|
|
@@ -778,11 +635,6 @@ export class GraphManagerChat {
|
|
|
778
635
|
const detail = reason ? { reason } : {};
|
|
779
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 });
|
|
780
637
|
}
|
|
781
|
-
/**
|
|
782
|
-
* One model call's reasoning, folded into a single row the way the app's transcript folds it: a
|
|
783
|
-
* retried request restarts the row, deltas grow it, and the completion settles it with the
|
|
784
|
-
* authoritative text, or takes it away when the call streamed no reasoning at all.
|
|
785
|
-
*/
|
|
786
638
|
onReasoning(type, data) {
|
|
787
639
|
const reasoningId = typeof data.reasoningId === 'string' && data.reasoningId ? data.reasoningId : undefined;
|
|
788
640
|
if (!reasoningId)
|
|
@@ -798,7 +650,6 @@ export class GraphManagerChat {
|
|
|
798
650
|
else if (type === 'agent.reasoning.delta') {
|
|
799
651
|
if (!text)
|
|
800
652
|
return;
|
|
801
|
-
// A delta past the row's completion belongs to a stream the engine already closed.
|
|
802
653
|
if (!this.replace(entry => mine(entry) && entry.type === 'thought' && entry.status === 'thinking', entry => ({ ...entry, text: entry.text + text }), { type: 'thought.delta', id, text })) {
|
|
803
654
|
if (!this.transcript.some(mine))
|
|
804
655
|
this.emit({ type: 'thought', id, text, status: 'thinking', startedAt: this.now() });
|
|
@@ -827,10 +678,6 @@ export class GraphManagerChat {
|
|
|
827
678
|
this.emit(settled);
|
|
828
679
|
}
|
|
829
680
|
}
|
|
830
|
-
/**
|
|
831
|
-
* Rows a run left open when it ended: a call it never reported the end of is stopped, a thought
|
|
832
|
-
* still streaming keeps what it streamed, and one that streamed nothing is taken away.
|
|
833
|
-
*/
|
|
834
681
|
settleOpenRows() {
|
|
835
682
|
const endedAt = this.now();
|
|
836
683
|
for (const entry of [...this.transcript]) {
|
|
@@ -859,16 +706,6 @@ export class GraphManagerChat {
|
|
|
859
706
|
this.graphCalls.delete(toolCallId);
|
|
860
707
|
return call;
|
|
861
708
|
}
|
|
862
|
-
/**
|
|
863
|
-
* The `graphs` tool also lists and reads, so a save is told by the stored revision rising. The
|
|
864
|
-
* open graph is checked after every call. A publish of another graph (the only way the agent can
|
|
865
|
-
* save its work on the bundled preset) is checked under that graph's id, and reported with the
|
|
866
|
-
* name it was begun with so the panel can offer to open it; so is a delete or a restore of one.
|
|
867
|
-
*
|
|
868
|
-
* Deleting a graph also raises its revision: the new one carries `metadata.deletedAt`. That is
|
|
869
|
-
* reported as `graph.deleted`, never as a save, so no panel loads a deleted graph as an editable
|
|
870
|
-
* one. A restore publishes a live revision above it, which is a save like any other.
|
|
871
|
-
*/
|
|
872
709
|
checkRevision(published) {
|
|
873
710
|
const other = published !== undefined && published.id !== this.openGraphId ? published : undefined;
|
|
874
711
|
const id = other?.id ?? this.openGraphId;
|
|
@@ -880,7 +717,6 @@ export class GraphManagerChat {
|
|
|
880
717
|
return;
|
|
881
718
|
const { revision } = latest;
|
|
882
719
|
if (other) {
|
|
883
|
-
// The user may have opened that graph since: its saves are then the open graph's to report.
|
|
884
720
|
if (id === this.openGraphId || revision <= (this.otherRevisions.get(id) ?? 0))
|
|
885
721
|
return;
|
|
886
722
|
this.otherRevisions.set(id, revision);
|
|
@@ -893,11 +729,9 @@ export class GraphManagerChat {
|
|
|
893
729
|
this.emit(latest.deleted ? { type: 'graph.deleted', graphId: id } : { type: 'graph.saved', graphId: id, revision });
|
|
894
730
|
});
|
|
895
731
|
}
|
|
896
|
-
/** The run is over, however it ended. */
|
|
897
732
|
finish(runId) {
|
|
898
733
|
if (runId !== undefined)
|
|
899
734
|
this.finishedRunId = runId;
|
|
900
|
-
// A call the run never reported the end of ended with the run.
|
|
901
735
|
this.graphCalls.clear();
|
|
902
736
|
this.settleOpenRows();
|
|
903
737
|
this.runId = undefined;
|
|
@@ -923,7 +757,6 @@ export class GraphManagerChat {
|
|
|
923
757
|
wake();
|
|
924
758
|
this.armIdleStop();
|
|
925
759
|
}
|
|
926
|
-
/** Read through a call so a check after an await sees the state as it is then. */
|
|
927
760
|
isIdle() { return this.state === 'idle'; }
|
|
928
761
|
whenIdle(ms) {
|
|
929
762
|
if (this.state === 'idle' || this.closed)
|
|
@@ -934,7 +767,6 @@ export class GraphManagerChat {
|
|
|
934
767
|
this.idleWaiters.push(() => { clearTimeout(timer); done(); });
|
|
935
768
|
});
|
|
936
769
|
}
|
|
937
|
-
/** An engine is kept while a run is working or waiting on the user, and while any panel is connected. */
|
|
938
770
|
armIdleStop() {
|
|
939
771
|
clearTimeout(this.idleTimer);
|
|
940
772
|
this.idleTimer = undefined;
|
|
@@ -942,7 +774,6 @@ export class GraphManagerChat {
|
|
|
942
774
|
return;
|
|
943
775
|
const engine = this.engine;
|
|
944
776
|
this.idleTimer = setTimeout(() => {
|
|
945
|
-
// The session is on disk, so the conversation continues on the next engine.
|
|
946
777
|
if (this.engine === engine && this.state === 'idle' && this.listeners.size === 0)
|
|
947
778
|
void this.stopEngine(engine);
|
|
948
779
|
}, this.idleMs);
|
|
@@ -954,17 +785,12 @@ export class GraphManagerChat {
|
|
|
954
785
|
this.transcript.push(event);
|
|
955
786
|
this.broadcast(event);
|
|
956
787
|
}
|
|
957
|
-
/** Sends an event without adding a row: it changes a row the transcript already holds. */
|
|
958
788
|
broadcast(event) {
|
|
959
789
|
if (this.closed)
|
|
960
790
|
return;
|
|
961
791
|
for (const listener of [...this.listeners])
|
|
962
792
|
this.deliverTo(listener, event);
|
|
963
793
|
}
|
|
964
|
-
/**
|
|
965
|
-
* Replaces the latest row `match` finds with `next` of it, and tells the panels with `event`.
|
|
966
|
-
* False when no row matches, so the caller can add one instead.
|
|
967
|
-
*/
|
|
968
794
|
replace(match, next, event) {
|
|
969
795
|
for (let index = this.transcript.length - 1; index >= 0; index--) {
|
|
970
796
|
if (!match(this.transcript[index]))
|
|
@@ -976,10 +802,9 @@ export class GraphManagerChat {
|
|
|
976
802
|
return false;
|
|
977
803
|
}
|
|
978
804
|
deliverTo(listener, event) {
|
|
979
|
-
// One panel's broken connection must not cost the others the event.
|
|
980
805
|
try {
|
|
981
806
|
listener(event);
|
|
982
807
|
}
|
|
983
|
-
catch {
|
|
808
|
+
catch { }
|
|
984
809
|
}
|
|
985
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;
|