@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
|
@@ -1,70 +1,25 @@
|
|
|
1
1
|
import { type SavedSession } from './sessions.js';
|
|
2
2
|
import type { RunCheckpoint } from './run-progress.js';
|
|
3
|
-
/**
|
|
4
|
-
* The directory holding one JSON Lines event log and one JSON result per run.
|
|
5
|
-
*
|
|
6
|
-
* `runs/` sits inside the installation directory, beside `config.json` and `artifacts/`, so the
|
|
7
|
-
* identity that names a record is also the last path segment of a file this process writes.
|
|
8
|
-
*/
|
|
9
3
|
export declare function runRecordsDirectory(directory?: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* The state a run record's `status` field can hold.
|
|
12
|
-
*
|
|
13
|
-
* The terminal names are the runtime's own result statuses. `running` is written when the run
|
|
14
|
-
* starts — before any result exists — so a stopped or crashed attempt is visible without waiting
|
|
15
|
-
* for a finalizer that may never land, and `interrupted` is what recovery writes when it finds
|
|
16
|
-
* such a record whose engine is gone.
|
|
17
|
-
*/
|
|
18
4
|
export type RunRecordStatus = 'running' | 'interrupted' | 'succeeded' | 'exhausted' | 'cancelled' | 'infrastructure_error' | 'needs_clarification';
|
|
19
|
-
/**
|
|
20
|
-
* The record written the moment a run starts, replaced by the terminal result when it finalizes.
|
|
21
|
-
*
|
|
22
|
-
* It is deliberately the same file the finalizer writes: a crash between the two leaves the open
|
|
23
|
-
* record on disk, which is what lets startup recovery classify the run instead of losing it, and
|
|
24
|
-
* `listRuns` reports it with a status rather than hiding a run that has no result yet.
|
|
25
|
-
*/
|
|
26
5
|
export interface OpenRunRecord {
|
|
27
6
|
id: string;
|
|
28
7
|
status: 'running';
|
|
29
|
-
/** The session the attempt belongs to, so recovery can find the marker turn to upgrade. */
|
|
30
8
|
sessionId: string;
|
|
31
9
|
startedAt: string;
|
|
32
|
-
/** The engine process that owns the run; recovery marks the run interrupted when this pid is gone. */
|
|
33
10
|
pid: number;
|
|
34
|
-
/** What the user selected (`default`, `:andorra`, a custom graph id) — a resume re-selects through the access rules with this, not with the pinned graph's id. */
|
|
35
11
|
graphSelection?: string;
|
|
36
|
-
/** Signed-in account subject at run creation, bound to Graph Studio run inspection. */
|
|
37
12
|
accountSubject?: string;
|
|
38
13
|
graph: {
|
|
39
14
|
id: string;
|
|
40
15
|
};
|
|
41
16
|
provider: string;
|
|
42
17
|
model: string;
|
|
43
|
-
/** Set on a run an external host drives as a subagent, so a recovered attempt keeps that identity. */
|
|
44
18
|
subagent?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* The permission the attempt ran under, when the host bound it to one.
|
|
47
|
-
*
|
|
48
|
-
* A read-only subagent that is later resumed must not come back as a full-access run: the
|
|
49
|
-
* workspace's own setting is not the host's instruction, and the host is the one that
|
|
50
|
-
* prohibited the mutations. A resuming caller that names a permission of its own still wins.
|
|
51
|
-
*/
|
|
52
19
|
permissions?: string;
|
|
53
|
-
/** Set on a resumed attempt: the run whose stopped state this run continues. */
|
|
54
20
|
resumedFrom?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Set when the resume carried a message: the instruction the user sent as this attempt continued.
|
|
57
|
-
* The finalized record carries it; the open record must too, because an attempt that crashes or
|
|
58
|
-
* stops leaves this record as the only per-run account of the continuation while it stands.
|
|
59
|
-
*/
|
|
60
21
|
direction?: string;
|
|
61
|
-
/** Set when a wake delivered the run's message (its task, or its direction) instead of the user. */
|
|
62
22
|
wake?: 'timer' | 'auto-fix';
|
|
63
|
-
/**
|
|
64
|
-
* Older recorded directions this attempt armed ahead of its own message, oldest first, each
|
|
65
|
-
* naming the attempt that sent it. A record that carries only the newest direction drops the
|
|
66
|
-
* older instruction behind it when a second crash lands before any checkpoint proves delivery.
|
|
67
|
-
*/
|
|
68
23
|
pendingDirections?: {
|
|
69
24
|
runId: string;
|
|
70
25
|
direction: string;
|
|
@@ -72,77 +27,31 @@ export interface OpenRunRecord {
|
|
|
72
27
|
wake?: 'timer' | 'auto-fix';
|
|
73
28
|
node?: string;
|
|
74
29
|
}[];
|
|
75
|
-
/** The node a timer's continuation direction belongs to, so a resume that recovers it delivers it there. */
|
|
76
30
|
directionNode?: string;
|
|
77
|
-
/**
|
|
78
|
-
* The run's full scope and per-run thinking effort, persisted so a resume rebuilds the same
|
|
79
|
-
* `$run.input.*`/`$run.state.*` work under the same model behavior the stopped attempt ran: the
|
|
80
|
-
* open record carries them from the first moment, and the finalizer copies them forward, so a
|
|
81
|
-
* resume can read them whether the attempt crashed or stopped cleanly.
|
|
82
|
-
*/
|
|
83
31
|
runInput?: Record<string, unknown>;
|
|
84
32
|
runState?: Record<string, unknown>;
|
|
85
33
|
reasoningEffort?: string;
|
|
86
|
-
/**
|
|
87
|
-
* Set when the attempt overrode every node's model: the graph's own per-node selections were set
|
|
88
|
-
* aside for this run, so a resume has to set them aside again or the nodes would come back on
|
|
89
|
-
* the models the graph names for themselves.
|
|
90
|
-
*/
|
|
91
34
|
overrideAllNodes?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Nodes this attempt switched to another pair mid-run, keyed by node id. The run's own pair and
|
|
94
|
-
* every other node are untouched: a resume re-applies these on top of the bound graph, so the
|
|
95
|
-
* switched nodes keep their new models while everything else runs as the graph names. A
|
|
96
|
-
* whole-run override clears the map — it rebuilds from the graph's own selections.
|
|
97
|
-
*/
|
|
98
35
|
nodeModelOverrides?: Record<string, {
|
|
99
36
|
provider: string;
|
|
100
37
|
model: string;
|
|
101
38
|
}>;
|
|
102
|
-
/**
|
|
103
|
-
* A live model selection was accepted during this attempt. The current provider/model and
|
|
104
|
-
* override scope are persisted before that selection becomes visible to model turns. On resume,
|
|
105
|
-
* old-stamped checkpoints are reconciled to this pair without losing completed tool history.
|
|
106
|
-
*/
|
|
107
39
|
liveModelChanged?: boolean;
|
|
108
|
-
/**
|
|
109
|
-
* The surface that produced the run, so recovery on another surface reports the pair as one
|
|
110
|
-
* pair: a crashed CLI run found by a desktop app-server must not finish as `desktop`, or the
|
|
111
|
-
* joined lifecycle events disagree and the interrupted outcome lands in the wrong bucket.
|
|
112
|
-
*/
|
|
113
40
|
surface?: 'cli' | 'desktop' | 'remote' | 'subagent';
|
|
114
|
-
/**
|
|
115
|
-
* The random telemetry run id and the start's dimensions.
|
|
116
|
-
*
|
|
117
|
-
* They are written into the open record so recovery can enqueue one idempotent `interrupted`
|
|
118
|
-
* finish for a run whose process died: the finish repeats the start's dimensions, and `runId`
|
|
119
|
-
* is what joins the pair. Neither value is derived from local state or from an account.
|
|
120
|
-
*/
|
|
121
41
|
telemetry?: {
|
|
122
42
|
runId: string;
|
|
123
43
|
nodes: number;
|
|
124
44
|
subagents: boolean;
|
|
125
45
|
jevEnabled: boolean;
|
|
126
46
|
decisionRouting: 'off' | 'shadow' | 'active';
|
|
127
|
-
/** The workspace permission mode, where the surface records it inside telemetry. */
|
|
128
47
|
permissions?: string;
|
|
129
48
|
permissionMode?: string;
|
|
130
|
-
/** False until the start is queued; recovery reads it to decide whether it owes the start. */
|
|
131
49
|
startSent?: boolean;
|
|
132
50
|
};
|
|
133
51
|
}
|
|
134
|
-
/** The history entry a session carries while its attempt is in flight, replaced when the attempt lands. */
|
|
135
52
|
export declare const RUNNING_TURN_SUMMARY = "This attempt was interrupted or is still running. Verify the workspace before continuing.";
|
|
136
|
-
/** The same entry after recovery classifies the attempt as one the engine never finished. */
|
|
137
53
|
export declare const INTERRUPTED_TURN_SUMMARY = "This attempt stopped unexpectedly before it finished; its work may be incomplete.";
|
|
138
|
-
/**
|
|
139
|
-
* What a session marker should say when the run record finalized but the session never heard how
|
|
140
|
-
* the attempt ended. Stopped outcomes commonly carry no completion object at all — a cancel has
|
|
141
|
-
* nothing to summarize — and then the recorded status is the only account left: a sentence about
|
|
142
|
-
* the engine stopping unexpectedly would contradict a record that says the user cancelled.
|
|
143
|
-
*/
|
|
144
54
|
export declare function summaryForStoppedRecord(record: Record<string, unknown>): string;
|
|
145
|
-
/** A small independent projection for Graph Studio: final run records may be huge. */
|
|
146
55
|
export interface StudioRunSummary {
|
|
147
56
|
id: string;
|
|
148
57
|
status: string;
|
|
@@ -156,451 +65,99 @@ export interface StudioRunSummary {
|
|
|
156
65
|
toolCalls?: number;
|
|
157
66
|
}
|
|
158
67
|
export declare function writeStudioRunSummary(directory: string, record: StudioRunSummary): Promise<void>;
|
|
159
|
-
/**
|
|
160
|
-
* The small marker naming an open run: one per run in flight, holding what the guard needs.
|
|
161
|
-
*
|
|
162
|
-
* It is the index entry `sessionHasOpenRun` answers from, so the guard never reopens the result
|
|
163
|
-
* records: those are the files that grow (a completed attempt's record carries its whole
|
|
164
|
-
* completion), and the guard runs on every rail action. The claim is deliberately a separate
|
|
165
|
-
* extension from every record the scans read, it names the run rather than the session so two
|
|
166
|
-
* concurrent runs of one session each keep their own entry, and an engine clears its own on
|
|
167
|
-
* finalize. A claim left by a process that is gone proves nothing: `sessionHasOpenRun` clears one
|
|
168
|
-
* whose owner is gone — a dead pid, or a pid the platform says now belongs to a process that
|
|
169
|
-
* started after the claim — and startup recovery clears the claims of the records it marks
|
|
170
|
-
* interrupted.
|
|
171
|
-
*/
|
|
172
68
|
export interface OpenRunClaim {
|
|
173
69
|
runId: string;
|
|
174
70
|
sessionId: string;
|
|
175
|
-
/** The engine process owning the run; a dead pid marks the claim as a crash leftover. */
|
|
176
71
|
pid: number;
|
|
177
72
|
claimedAt: string;
|
|
178
|
-
/**
|
|
179
|
-
* When the owning process started, as that process recorded it. A pid alone is not an
|
|
180
|
-
* identity — the OS hands a dead process's number to the next one — so `sessionHasOpenRun`
|
|
181
|
-
* corroborates a live pid against this, the way `inspectClaim` does for a resume claim.
|
|
182
|
-
* Absent on a claim an older installation wrote, where the pid stands on its own.
|
|
183
|
-
*/
|
|
184
73
|
startedAt?: string;
|
|
185
|
-
/**
|
|
186
|
-
* The writing process instance's nonce, when it had one.
|
|
187
|
-
*
|
|
188
|
-
* It is the exact answer to "is this claim mine": the start time beside it is a wall-clock
|
|
189
|
-
* reading that a restarted process can come within a few seconds of, and the nonce cannot be
|
|
190
|
-
* come close to. Absent on a claim an older installation wrote.
|
|
191
|
-
*/
|
|
192
74
|
nonce?: string;
|
|
193
75
|
}
|
|
194
|
-
/** Drop a run's open claim. A run only ever owns its own claim, so this cannot clobber another's. */
|
|
195
76
|
export declare function clearOpenRunClaim(directory: string, runId: string): Promise<void>;
|
|
196
|
-
/**
|
|
197
|
-
* Remove the record of an attempt that never began.
|
|
198
|
-
*
|
|
199
|
-
* The claim and the record answer one question — is a run live? — and a question with no run behind
|
|
200
|
-
* it has to have neither. A record left behind is an attempt the Runs view lists, and its live pid
|
|
201
|
-
* tells the recovery that another process owns it, so the attempt stays `running` until that
|
|
202
|
-
* process exits.
|
|
203
|
-
*/
|
|
204
77
|
export declare function removeOpenRunRecord(directory: string, runId: string): Promise<void>;
|
|
205
|
-
/** The result file written at start; atomic, so a crash mid-write cannot tear the record. */
|
|
206
78
|
export declare function writeOpenRunRecord(directory: string, record: OpenRunRecord): Promise<void>;
|
|
207
|
-
/** Whether a process is running. A live process owned by another user answers EPERM, not ESRCH. */
|
|
208
79
|
export declare function isPidAlive(pid: number): boolean;
|
|
209
|
-
/** This process's own start time, as the claims it writes record it. */
|
|
210
80
|
export declare function processStartedAt(): string;
|
|
211
|
-
/** This process instance's nonce, for a claim that carries one. */
|
|
212
81
|
export declare function processNonce(): string;
|
|
213
|
-
/**
|
|
214
|
-
* Reserve a workspace for an engine in this process.
|
|
215
|
-
*
|
|
216
|
-
* @returns whether the reservation was taken; a workspace another engine in this process is
|
|
217
|
-
* working in is not available.
|
|
218
|
-
*/
|
|
219
82
|
export declare function claimProcessWorkspace(workspace: string, owner: string): boolean;
|
|
220
|
-
/** Give a workspace back, when the engine releasing it is the one that reserved it. */
|
|
221
83
|
export declare function releaseProcessWorkspace(workspace: string, owner: string): void;
|
|
222
84
|
export interface RunRecovery {
|
|
223
|
-
/** Open run records that could not belong to a live process and were marked interrupted. */
|
|
224
85
|
runs: string[];
|
|
225
|
-
/** Sessions whose in-flight marker turns were upgraded to match. */
|
|
226
86
|
markers: number;
|
|
227
|
-
/**
|
|
228
|
-
* Open records the sweep left running because a live process other than this one owns them —
|
|
229
|
-
* each holder's run identity, pid, and session. Captured by the same walk that did the sweep,
|
|
230
|
-
* so a holder that exited before the pass observed it is already recovered and one that exits
|
|
231
|
-
* after it is already in this set: an engine watching these pids needs no second scan, and an
|
|
232
|
-
* exit at any moment is either recovered immediately or retained for polling.
|
|
233
|
-
*/
|
|
234
87
|
live: {
|
|
235
88
|
runId: string;
|
|
236
89
|
pid: number;
|
|
237
90
|
sessionId: string | undefined;
|
|
238
91
|
}[];
|
|
239
|
-
/** The rewritten records, so a caller can emit the `interrupted` finish that joins their start. */
|
|
240
92
|
interrupted: Record<string, unknown>[];
|
|
241
93
|
}
|
|
242
|
-
/**
|
|
243
|
-
* Classify the runs and session turns a previous process left unfinished.
|
|
244
|
-
*
|
|
245
|
-
* A run that finalizes replaces its open record and its marker turn together; anything that ends
|
|
246
|
-
* that way needs no help here. What this repairs is the other end: a process killed between the
|
|
247
|
-
* open record and the finalizer leaves a record stuck at `running` and a session turn claiming the
|
|
248
|
-
* attempt "is still running", and neither can tell the difference between live work and a crash on
|
|
249
|
-
* its own. The pid answers it — a process this home's engine cannot see is gone — and from there
|
|
250
|
-
* the record becomes `interrupted`, the marker entry is upgraded to say so, and a marker whose
|
|
251
|
-
* record never landed gets an interrupted record synthesized so the run is at least listable.
|
|
252
|
-
*
|
|
253
|
-
* A record whose pid is alive is left untouched: another engine on this home may genuinely be
|
|
254
|
-
* running it — and it is named in `live`, captured by the same walk, so a caller who wants to
|
|
255
|
-
* react when such a holder exits needs no second scan (and no gap between two). `onlyRunIds`
|
|
256
|
-
* bounds the rewrite to records the caller already knows its own earlier sweep left open: a
|
|
257
|
-
* delayed repair must never touch a record a live process still owns, including the calling
|
|
258
|
-
* engine's own active run. The whole pass is best-effort; one damaged record never hides the
|
|
259
|
-
* others.
|
|
260
|
-
*/
|
|
261
94
|
export declare function reconcileInterruptedRuns(directory: string, onlyRunIds?: Set<string>, options?: {
|
|
262
95
|
skipOwnProcess?: boolean;
|
|
263
96
|
includePending?: boolean;
|
|
264
97
|
}): Promise<RunRecovery>;
|
|
265
|
-
/**
|
|
266
|
-
* Whether a live process currently owns a run of this session, this engine or another.
|
|
267
|
-
*
|
|
268
|
-
* The open-run claims are the answer: one small file per run in flight, written by
|
|
269
|
-
* `writeOpenRunRecord` and cleared when the run finalizes, each naming its session and its owning
|
|
270
|
-
* pid. A guard reading them touches only files that stay small (open runs are few, and a claim is
|
|
271
|
-
* one line), so a rail action costs a directory listing and a handful of tiny reads — never the
|
|
272
|
-
* historical records, which grow with the installation's whole history and are expensive to reopen
|
|
273
|
-
* (a completed attempt's record can carry a large completion). An engine's in-process fields
|
|
274
|
-
* describe only itself: an archive or rename accepted while a second window runs the same session
|
|
275
|
-
* would be silently reverted when that run saves the record it captured before the mutation. A
|
|
276
|
-
* claim is treated as owned unless its owner is provably gone — a dead pid, or a live pid whose
|
|
277
|
-
* start time contradicts the one the claim recorded, which means the number went to an unrelated
|
|
278
|
-
* process after the owner died. Both are crash leftovers that reconcile marks interrupted, so an
|
|
279
|
-
* unknown owner blocks conservatively rather than racing, and one read as gone is removed on the
|
|
280
|
-
* way out. Without that corroboration a recycled pid would hold a session busy — refusing every
|
|
281
|
-
* rename, archive, and delete — for as long as the unrelated process lives.
|
|
282
|
-
*
|
|
283
|
-
* Two fallbacks keep the old scan's answers for states the index cannot see: a session identity
|
|
284
|
-
* outside the claim path's alphabet (never a real session, which is a UUID) and a claim file that
|
|
285
|
-
* cannot be parsed, both of which fall back to reading the `running` records directly.
|
|
286
|
-
*/
|
|
287
|
-
/**
|
|
288
|
-
* The live session IDs named by open-run claims, plus the crashed attempts the
|
|
289
|
-
* session snapshots cannot show. One bounded directory pass lets session-monitor
|
|
290
|
-
* identify a new run before the running turn has been saved, without scanning
|
|
291
|
-
* every claim for every retained session. Superseded and orphaned crash markers
|
|
292
|
-
* are removed by that same pass, so later polls read only live crash signals.
|
|
293
|
-
*
|
|
294
|
-
* These are hints only: callers can still check sessionHasOpenRun immediately
|
|
295
|
-
* before reporting status, retaining its conservative malformed-claim fallback.
|
|
296
|
-
*/
|
|
297
98
|
export interface MonitoredRunClaims {
|
|
298
99
|
active: Set<string>;
|
|
299
|
-
/** Dead attempts with no persisted turn of their own and no later run to supersede them. */
|
|
300
100
|
crashed: Map<string, {
|
|
301
101
|
runId: string;
|
|
302
102
|
claimedAt: string;
|
|
303
103
|
}>;
|
|
304
104
|
}
|
|
305
105
|
export declare function sessionsWithOpenRunClaims(directory: string, sessions?: readonly SavedSession[]): Promise<MonitoredRunClaims>;
|
|
306
|
-
/**
|
|
307
|
-
* Whether a live open-run claim still holds this session against mutations.
|
|
308
|
-
*
|
|
309
|
-
* `ignoreRunId` excuses one run from the answer: the engine that owns that run mutates the session
|
|
310
|
-
* safely beside it when its finalizer merges into the record it saves, so it names its own
|
|
311
|
-
* in-flight run here instead of being held by its own claim. Every other owner — a second window
|
|
312
|
-
* or the CLI sharing the home — answers exactly as before, crash-claim cleanup included.
|
|
313
|
-
*/
|
|
314
106
|
export declare function sessionHasOpenRun(directory: string, sessionId: string, options?: {
|
|
315
107
|
ignoreRunId?: string;
|
|
316
108
|
}): Promise<boolean>;
|
|
317
|
-
/**
|
|
318
|
-
* Whether an armed wake still names this session from any engine.
|
|
319
|
-
*
|
|
320
|
-
* A wake lives in the registry of the engine that armed it, and every engine sharing the
|
|
321
|
-
* installation runs a reaper pass over the same store: asked of its own registry alone, one
|
|
322
|
-
* engine's pass would file away a session another engine still owes a prompt. Each arm wrote a
|
|
323
|
-
* claim, so the claims are the answer. A claim whose owner is live holds the session; a claim
|
|
324
|
-
* whose owner is gone is swept here, because the wake it named was a promise its process held and
|
|
325
|
-
* nothing will deliver it now. A claim that cannot be read might name a live wake, so it holds
|
|
326
|
-
* the session too.
|
|
327
|
-
*/
|
|
328
109
|
export declare function sessionHasArmedWake(directory: string, sessionId: string): Promise<boolean>;
|
|
329
|
-
/**
|
|
330
|
-
* Record that this engine armed a wake for a session.
|
|
331
|
-
*
|
|
332
|
-
* The wake itself lives in this process's registry, so a reaper pass in another engine cannot see
|
|
333
|
-
* it there. The claim is what makes it visible across the engines that share the installation: one
|
|
334
|
-
* small file per wake, carrying the writing process's identity, read by `sessionHasArmedWake`. Best
|
|
335
|
-
* effort — a claim that fails to land leaves the wake invisible to a foreign pass until its
|
|
336
|
-
* delivery lands and reverts the filing, the way the run that armed it would have.
|
|
337
|
-
*/
|
|
338
110
|
export declare function writeWakeClaim(directory: string, sessionId: string, timerId: string): Promise<void>;
|
|
339
|
-
/** Drop one wake's claim: the wake was delivered, spent, or canceled by the engine that armed it. */
|
|
340
111
|
export declare function clearWakeClaim(directory: string, sessionId: string, timerId: string): Promise<void>;
|
|
341
|
-
/**
|
|
342
|
-
* Drop every claim a session's wakes hold, when the wakes go with the session they were armed for.
|
|
343
|
-
*
|
|
344
|
-
* Deleting a session clears its wakes with the record; the claims have to go with them, or claims
|
|
345
|
-
* naming a session that no longer exists would outlive the session that could ever clear them.
|
|
346
|
-
* Only claims naming this session are removed: another session's wakes are nobody else's to drop.
|
|
347
|
-
*/
|
|
348
112
|
export declare function clearWakeClaims(directory: string, sessionId: string): Promise<void>;
|
|
349
|
-
/**
|
|
350
|
-
* Bring one session's unfinished turns in line with the run records.
|
|
351
|
-
*
|
|
352
|
-
* The same repair the startup pass makes, for one session: a run whose final session save failed
|
|
353
|
-
* leaves its turn marked running, and a long-lived server would keep it that way until it was
|
|
354
|
-
* restarted. The attempt's own record says how it ended, so the turn takes that account of it.
|
|
355
|
-
*/
|
|
356
113
|
export declare function repairSessionMarkers(directory: string, sessionId: string): Promise<number>;
|
|
357
|
-
/**
|
|
358
|
-
* The path a run's persisted record lives at.
|
|
359
|
-
*
|
|
360
|
-
* The run identity reaches this path from runtime events, where it is typed `unknown`, so the
|
|
361
|
-
* alphabet is checked here at the sink rather than trusted from every caller. The identity is
|
|
362
|
-
* always a UUID, and the guard admits only `[A-Za-z0-9_-]` -- the same alphabet `ArtifactStore`
|
|
363
|
-
* uses for its own run-scoped directory. That rejects every spelling that could leave `runs/`:
|
|
364
|
-
* `.` and `..` segments (the dot is not in the alphabet, so `..` is not merely resolved away but
|
|
365
|
-
* refused), `/` and `\` separators, an absolute path, and a Windows drive-relative or
|
|
366
|
-
* alternate-data-stream name (`:`).
|
|
367
|
-
* @param directory - the installation directory holding `runs/`.
|
|
368
|
-
* @param runId - the run identity, typically a generated UUID.
|
|
369
|
-
* @param extension - which record per run this path names: the result, the journal, or the
|
|
370
|
-
* checkpoint the resume work leaves behind until the run succeeds.
|
|
371
|
-
* @returns the absolute or installation-relative path of the record.
|
|
372
|
-
*/
|
|
373
114
|
export declare function runRecordPath(directory: string, runId: unknown, extension: 'json' | 'jsonl' | 'checkpoint' | 'claim' | 'journal-error' | 'checkpoint-error' | 'open-run' | 'mutation-lock' | 'mcp-crash'): string;
|
|
374
|
-
/**
|
|
375
|
-
* Record that a run's journal is missing events, durably and separately from the sink that failed.
|
|
376
|
-
*
|
|
377
|
-
* The engine deliberately keeps running when an append fails (a full disk must not kill the user's
|
|
378
|
-
* work), and the journal writer holds what it could not write and writes it once the file accepts
|
|
379
|
-
* appends again. This marker covers the window in between and the cases that never close: the
|
|
380
|
-
* process dying while events are still held, or the writer giving some up. The lines after such a
|
|
381
|
-
* gap are present, so nothing in the file itself reveals it. The writer removes the marker once
|
|
382
|
-
* everything it held has landed (best effort both ways: if the marker cannot be written, the
|
|
383
|
-
* record's own flag is what stands), and `journalWriteFailed` is what a resume reads to warn that a
|
|
384
|
-
* step may repeat.
|
|
385
|
-
*/
|
|
386
115
|
export declare function noteJournalWriteFailure(directory: string, runId: string, detail: string): Promise<void>;
|
|
387
|
-
/**
|
|
388
|
-
* Whether a run's journal is known to be incomplete: the marker the writer left, or the flag the
|
|
389
|
-
* attempt's result record carries. A resume still continues such an attempt (a session must
|
|
390
|
-
* always be resumable), but it tells the user that a step the missing events recorded may repeat.
|
|
391
|
-
*/
|
|
392
116
|
export declare function journalWriteFailed(directory: string, runId: string): Promise<boolean>;
|
|
393
|
-
/** The file operations a journal writer uses, replaceable so a test can fail them on cue. */
|
|
394
117
|
export interface JournalFileOperations {
|
|
395
118
|
appendFile(path: string, data: string): Promise<void>;
|
|
396
|
-
/** Cut the file back to `size` bytes. */
|
|
397
119
|
truncate(path: string, size: number): Promise<void>;
|
|
398
|
-
/** The file's length in bytes: 0 when it does not exist yet, and `undefined` when the path is not a regular file. */
|
|
399
120
|
size(path: string): Promise<number | undefined>;
|
|
400
121
|
mkdir(path: string): Promise<void>;
|
|
401
122
|
}
|
|
402
|
-
/** One run's journal sink. */
|
|
403
123
|
export interface RunJournalWriter {
|
|
404
|
-
/**
|
|
405
|
-
* Queue one event. The promise settles once the event and everything queued before it are on
|
|
406
|
-
* disk, or held for a later retry. It never rejects: a failed write is the writer's to retry.
|
|
407
|
-
*/
|
|
408
124
|
append(event: unknown): Promise<void>;
|
|
409
|
-
/** Retry whatever is still held, and report whether the journal is a complete account. */
|
|
410
125
|
settle(): Promise<boolean>;
|
|
411
|
-
/** Whether every event queued so far is on disk. */
|
|
412
126
|
readonly intact: boolean;
|
|
413
127
|
}
|
|
414
|
-
/**
|
|
415
|
-
* The journal sink for one run: ordered appends that leave no silent hole.
|
|
416
|
-
*
|
|
417
|
-
* The filesystem does not finish concurrent appends in the order they were started, so events are
|
|
418
|
-
* written one after another. An event the file refuses (a full disk, most often) is held rather
|
|
419
|
-
* than dropped, and each later event first retries everything held, oldest first. A disk that
|
|
420
|
-
* fills for a minute and is then freed leaves a complete journal behind, not a permanently
|
|
421
|
-
* untrusted one.
|
|
422
|
-
*
|
|
423
|
-
* A failed append can still have written part of its line, so after any failed write the next one
|
|
424
|
-
* measures the file before it appends anything. When the file grew past the length the writer last
|
|
425
|
-
* knew to be whole lines, it is cut back first, so a retried event neither merges with its own torn
|
|
426
|
-
* fragment nor appears twice. While the file cannot be measured (or is not a regular file), nothing
|
|
427
|
-
* is appended: the events stay held, and the journal cannot be reported complete. When even the cut
|
|
428
|
-
* fails, the next line starts on a fresh line and the journal is reported as no longer complete: the
|
|
429
|
-
* fragment cannot be told apart from an event that really ran. The same holds when the file turns
|
|
430
|
-
* out shorter than the lines already written to it: something else cut it, and those lines are gone.
|
|
431
|
-
*
|
|
432
|
-
* While anything is held, or after anything was given up, the run's `journal-error` marker says
|
|
433
|
-
* so. Events are given up only when what is held passes `maxHeldBytes`. Once everything held has
|
|
434
|
-
* landed and nothing was given up, the writer removes the marker again.
|
|
435
|
-
*/
|
|
436
128
|
export declare function createRunJournalWriter(directory: string, runId: string, options?: {
|
|
437
129
|
onFailure?: (error: unknown) => void;
|
|
438
130
|
maxHeldBytes?: number;
|
|
439
131
|
files?: Partial<JournalFileOperations>;
|
|
440
132
|
}): RunJournalWriter;
|
|
441
|
-
/**
|
|
442
|
-
* One checkpointed visit: the node, and the scheduling generation of the visit when the writer
|
|
443
|
-
* knew it. A node in a cycle can have visits pending at several generations, and its single
|
|
444
|
-
* checkpoint file holds whichever visit wrote last, so a failure belongs to a visit, not a node.
|
|
445
|
-
*/
|
|
446
133
|
export interface CheckpointVisit {
|
|
447
134
|
nodeId: string;
|
|
448
135
|
generation?: number;
|
|
449
136
|
}
|
|
450
|
-
/**
|
|
451
|
-
* The failures a run's checkpoint writes left unhealed, by visit.
|
|
452
|
-
*
|
|
453
|
-
* A checkpoint is the conversation a resume re-enters a visit with, and each write replaces the
|
|
454
|
-
* node's whole file. So a failed write matters only until a later write of the same visit
|
|
455
|
-
* succeeds: after that, the file on disk is that visit's newer conversation, and the failure says
|
|
456
|
-
* nothing about it. A successful write for another visit of the same node does not heal it — the
|
|
457
|
-
* file then holds the other visit, and a resume skips it for the one whose write failed. The
|
|
458
|
-
* tracker keeps the run's `checkpoint-error` marker naming the visits whose newest write failed,
|
|
459
|
-
* removes it once none is left, and hands the same list to the run's final record.
|
|
460
|
-
*/
|
|
461
137
|
export interface CheckpointFailureTracker {
|
|
462
|
-
/** Record that a visit's checkpoint write failed. Never rejects. */
|
|
463
138
|
failed(visit: CheckpointVisit, error: unknown): Promise<void>;
|
|
464
|
-
/** Record that a visit's checkpoint write succeeded, which heals an earlier failure of the same visit. Never rejects. */
|
|
465
139
|
succeeded(visit: CheckpointVisit): Promise<void>;
|
|
466
|
-
/** Whether no visit's newest checkpoint write failed. */
|
|
467
140
|
readonly intact: boolean;
|
|
468
|
-
/** The visits whose newest checkpoint write failed, for the run's final record. */
|
|
469
141
|
readonly failures: CheckpointVisit[];
|
|
470
142
|
}
|
|
471
|
-
/**
|
|
472
|
-
* Track one run's checkpoint writes. The caller reports every write's outcome in the order the
|
|
473
|
-
* writes ran (the checkpoint writers already serialize them). The run's final record carries
|
|
474
|
-
* `checkpointIntegrity: 'failed'` and the `failures` list while `intact` is false.
|
|
475
|
-
*/
|
|
476
143
|
export declare function createCheckpointFailureTracker(directory: string, runId: string): CheckpointFailureTracker;
|
|
477
|
-
/**
|
|
478
|
-
* Whether a run's checkpoints are known to be incomplete: the record's flag, or the marker the
|
|
479
|
-
* tracker left. A resume still continues such an attempt, and tells the user that a visit whose
|
|
480
|
-
* conversation was not saved may repeat work.
|
|
481
|
-
*/
|
|
482
144
|
export declare function checkpointWriteFailed(directory: string, runId: string): Promise<boolean>;
|
|
483
|
-
/** A checkpoint failure a run left unhealed, as far as its records can say. */
|
|
484
145
|
export interface CheckpointFailure {
|
|
485
|
-
/** The visits whose newest write failed; absent when the records cannot name them. */
|
|
486
146
|
visits?: CheckpointVisit[];
|
|
487
|
-
/** When the newest recorded failure happened; absent when the records cannot say. */
|
|
488
147
|
at?: string;
|
|
489
148
|
}
|
|
490
|
-
/**
|
|
491
|
-
* The checkpoint failure a run left unhealed: `undefined` when there is none.
|
|
492
|
-
*
|
|
493
|
-
* The final record comes first. It is written once every checkpoint write has settled, from the
|
|
494
|
-
* tracker itself, so its list is the whole failure set — while the marker is appended as failures
|
|
495
|
-
* happen, and the same full disk that failed a checkpoint can fail the marker line naming it. A
|
|
496
|
-
* record that is flagged but carries no list (a build that predates the list) therefore names
|
|
497
|
-
* nothing and dates nothing: its marker may be missing the very failure that matters. Only a run
|
|
498
|
-
* with no final record (one that crashed) is read from its marker, best effort.
|
|
499
|
-
*
|
|
500
|
-
* `visits` is absent when the failures cannot be named. `at` lets a resume see that a checkpoint
|
|
501
|
-
* saved after the newest failure already replaced whatever the failed write would have written.
|
|
502
|
-
*/
|
|
503
149
|
export declare function checkpointFailure(directory: string, runId: string): Promise<CheckpointFailure | undefined>;
|
|
504
|
-
/**
|
|
505
|
-
* Persist the in-flight conversation of the node a run is working on.
|
|
506
|
-
*
|
|
507
|
-
* The write is atomic (a staged rename, the same discipline as every durable record in this
|
|
508
|
-
* directory) at mode 0600: the file carries the node's full message history — including tool
|
|
509
|
-
* outputs — so it is as sensitive as the run journal, and a crash mid-write must never leave a
|
|
510
|
-
* half-file a resume would read back. A new snapshot replaces the last; the runner already
|
|
511
|
-
* sanitizes an interrupted conversation before publishing its checkpoint (stub tool messages are
|
|
512
|
-
* marked as not replayed), so whatever the callback handed over is what belongs on disk.
|
|
513
|
-
*/
|
|
514
150
|
export declare function writeRunCheckpoint(directory: string, runId: string, checkpoint: RunCheckpoint): Promise<void>;
|
|
515
|
-
/**
|
|
516
|
-
* Read back one node's checkpoint, or nothing when there is no usable one.
|
|
517
|
-
*
|
|
518
|
-
* Missing and unreadable both mean the same thing to the caller: resume without the prior
|
|
519
|
-
* conversation (the safe restart the runner falls back to). Shape validation is deliberately
|
|
520
|
-
* shallow — a checkpoint from an incompatible build would carry the wrong state fields, and the
|
|
521
|
-
* node re-running from scratch is safer than a seeded conversation whose counters disagree with
|
|
522
|
-
* the graph the run is being replayed onto.
|
|
523
|
-
*
|
|
524
|
-
* One field is rebuilt rather than trusted: the tool-failure tracker is a class whose behavior
|
|
525
|
-
* (and whose Map) JSON does not carry, so a resumed node gets a fresh one. Losing the repeated-
|
|
526
|
-
* failure strike counts is the conservative direction — the worst case is one more retry before
|
|
527
|
-
* the tracker strikes out again, not a crash on a state object without its methods.
|
|
528
|
-
*/
|
|
529
151
|
export declare function readRunCheckpoint(directory: string, runId: string, nodeId: string): Promise<RunCheckpoint | undefined>;
|
|
530
|
-
/**
|
|
531
|
-
* Read every checkpoint the run kept — one file per node, plus the legacy single-file shape an
|
|
532
|
-
* older build may have left behind. Unreadable or invalid files are skipped individually: a
|
|
533
|
-
* damaged branch costs that branch its conversation, nothing more.
|
|
534
|
-
*/
|
|
535
152
|
export declare function readRunCheckpoints(directory: string, runId: string): Promise<RunCheckpoint[]>;
|
|
536
|
-
/**
|
|
537
|
-
* Discard a run's checkpoints — every per-node file and the legacy single file. The terminal
|
|
538
|
-
* paths call this once the attempt has finished, so durable checkpoints exist only for attempts
|
|
539
|
-
* a resume can actually pick up again.
|
|
540
|
-
*/
|
|
541
153
|
export declare function removeRunCheckpoint(directory: string, runId: string): Promise<void>;
|
|
542
|
-
/**
|
|
543
|
-
* Take (or refuse) the cross-process claim that this run id is being resumed.
|
|
544
|
-
*
|
|
545
|
-
* Two engines sharing one home can both be asked to resume the same stopped attempt, and the
|
|
546
|
-
* per-process start guard cannot see the other one. The claim is a create-exclusive file: the
|
|
547
|
-
* winner proceeds, and a file left by a process that is gone is stale and gets reclaimed. It is
|
|
548
|
-
* deliberately a separate name from every record the Runs view scans, and it names the original
|
|
549
|
-
* attempt — the thing two resumers would collide over.
|
|
550
|
-
*
|
|
551
|
-
* Reclamation may not be "read the file, then unlink the path", nor "rename whatever is in the
|
|
552
|
-
* way, then read it": the first deletes a claim another engine may have created in between, and
|
|
553
|
-
* the second vacates the canonical path — unlocking a live holder's claim for the rename window,
|
|
554
|
-
* so a third engine linking into it takes the name while the original holder still believes it
|
|
555
|
-
* owns it. What survives both is refusing to act on anything but verified evidence: the claim is
|
|
556
|
-
* read in place (which never disturbs it), the reclamation takes the ticket above, the file is
|
|
557
|
-
* re-read UNDER the ticket so a claim replaced in between refuses instead of being moved, and the
|
|
558
|
-
* moved file's identity is checked before it is discarded. A live claim is never vacated, and the
|
|
559
|
-
* only file ever deleted here is one this process read as stale twice and matched by identity.
|
|
560
|
-
*
|
|
561
|
-
* @returns whether the claim was taken; false means a live process holds it, or another engine is
|
|
562
|
-
* reclaiming it right now.
|
|
563
|
-
*/
|
|
564
154
|
export declare function claimRunResume(directory: string, runId: string): Promise<boolean>;
|
|
565
|
-
/**
|
|
566
|
-
* Give up a resume claim taken by a start that never reached its run — the claim itself, and the
|
|
567
|
-
* reclaim ticket this process could be holding. A live reclaimer's ticket is left alone: it is
|
|
568
|
-
* what serializes that engine's delete, and removing it early would hand the serialization to a
|
|
569
|
-
* third contender mid-reclaim.
|
|
570
|
-
*/
|
|
571
155
|
export declare function releaseRunResumeClaim(directory: string, runId: string): Promise<void>;
|
|
572
|
-
/** Thrown when a session mutation lock is held elsewhere and does not free up within the wait. */
|
|
573
156
|
export declare class SessionMutationLockHeldError extends Error {
|
|
574
157
|
constructor(sessionId: string);
|
|
575
158
|
}
|
|
576
|
-
/**
|
|
577
|
-
* Serialize a session's cross-process read-modify-write mutation.
|
|
578
|
-
*
|
|
579
|
-
* Every rename, archive, and delete reads a session record, edits fields, and saves it back. Two
|
|
580
|
-
* windows doing that to one session can interleave — each save overwrites the whole record, so one
|
|
581
|
-
* loses the other's field, and a save landing after a delete recreates the session the user
|
|
582
|
-
* removed. The answer is one lock per session, held across exactly that window: take it before the
|
|
583
|
-
* busy check, do the check, the fresh re-read, and the save inside it, and release. A fresh read
|
|
584
|
-
* under the lock is what makes two serialized mutations additive rather than lossy: each sees what
|
|
585
|
-
* the last one wrote.
|
|
586
|
-
*
|
|
587
|
-
* The lock is the same claim protocol the resume claim uses — create-exclusive, with verified
|
|
588
|
-
* reclamation of a file left by a dead process — so a holder that dies cannot strand the session:
|
|
589
|
-
* the next contender reclaims and proceeds. It also carries an in-process turnstile, because the
|
|
590
|
-
* app-server can have two concurrent requests for one session, and a request must never judge its
|
|
591
|
-
* own process's live claim stale.
|
|
592
|
-
*
|
|
593
|
-
* @returns the release function. Throws `SessionMutationLockHeldError` when another writer keeps
|
|
594
|
-
* the lock past the wait — the caller owes the user a busy error, not a mutation.
|
|
595
|
-
*/
|
|
596
159
|
export declare function acquireSessionMutationLock(directory: string, sessionId: string, options?: {
|
|
597
160
|
waitMs?: number;
|
|
598
161
|
intervalMs?: number;
|
|
599
162
|
}): Promise<() => Promise<void>>;
|
|
600
|
-
/**
|
|
601
|
-
* Clear the recovery marker once a record's `interrupted` finish has been queued.
|
|
602
|
-
*
|
|
603
|
-
* Called by the reporter rather than the sweep: the sweep must not claim the work is done, because
|
|
604
|
-
* the finish it returns may never be enqueued if this process dies first.
|
|
605
|
-
*/
|
|
606
163
|
export declare function clearInterruptedTelemetry(directory: string, runIds: string[]): Promise<void>;
|