@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,61 +1,20 @@
|
|
|
1
1
|
import type { AppServerSessionChanges, AppServerSessionChangesKept, AppServerSessionChangesUndone, AppServerSessionFileChange } from './app-server/protocol.js';
|
|
2
|
-
/**
|
|
3
|
-
* The files an agent changed in a session since the person last reviewed them, with Keep and Undo.
|
|
4
|
-
*
|
|
5
|
-
* Every write an agent makes to a workspace file passes one function (`atomicWrite` in `tools.ts`), and a
|
|
6
|
-
* delegated change lands through one more (`applyLanding`). Both report here, before and after: before, so
|
|
7
|
-
* the content the file held can be kept as its baseline the first time the agent touches it; after, so the
|
|
8
|
-
* store knows what the agent's write left. Between two reviews the baseline never moves — a file edited ten
|
|
9
|
-
* times has one entry, and its diff is the file's whole change, not the last call's.
|
|
10
|
-
*
|
|
11
|
-
* Keep makes the file as it is the new baseline: it leaves the pending set and its stored original is
|
|
12
|
-
* dropped. Undo puts the baseline back — the earlier content, or no file at all for one the agent created,
|
|
13
|
-
* or the file again for one a landing removed — but only while the file is still what the agent left: a file
|
|
14
|
-
* something else changed afterwards is reported as a conflict instead of being overwritten, unless the
|
|
15
|
-
* caller asks with `force`.
|
|
16
|
-
*
|
|
17
|
-
* The record lives in the configuration home beside the session (`session-changes/<id>/`), not in the
|
|
18
|
-
* workspace and not in Git: it works for a folder that is no repository, needs no index, and survives an
|
|
19
|
-
* app restart and a resumed session. Engines sharing a home can all read and change it — the desktop runs a
|
|
20
|
-
* process per task and browses with another — so every change happens under the session's store lock, and
|
|
21
|
-
* the revision it carries orders every answer and event across those processes.
|
|
22
|
-
*/
|
|
23
|
-
/** Past this size a file's earlier content is not kept: the change is listed, and Undo refuses the file. */
|
|
24
2
|
export declare const BASELINE_BYTE_LIMIT: number;
|
|
25
|
-
/** Diff lines `list` returns per file unless asked for another bound. */
|
|
26
3
|
export declare const LIST_DIFF_LINES = 200;
|
|
27
|
-
/** The most diff lines one answer may ask for per file. */
|
|
28
4
|
export declare const MAX_DIFF_LINES = 20000;
|
|
29
|
-
/** Session ids name files, so only the characters a session id is made of are accepted. */
|
|
30
5
|
export declare function sessionChangesId(id: string): string;
|
|
31
6
|
export declare const sessionChangesRoot: (home: string) => string;
|
|
32
7
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* review lock — the one Keep and Undo take — so an Undo can never observe a file, have an agent write land on
|
|
37
|
-
* it, and then restore over that write: either the Undo finishes first and the write lands on the restored
|
|
38
|
-
* file (and is recorded against it), or the write lands first and the Undo sees it.
|
|
39
|
-
*
|
|
40
|
-
* - `begin` takes the lock and reads what each file holds now, which becomes its original the first time it
|
|
41
|
-
* changes. Call it right before the mutation, after anything that can wait on a person (an approval).
|
|
42
|
-
* - `commit` records what the mutation left and releases the lock; `abort` releases it for a write that did
|
|
43
|
-
* not land. Exactly one of them must follow a `begin` that resolved.
|
|
44
|
-
*
|
|
45
|
-
* None of them may fail the write: a record that cannot be made is a change the review does not list, not a
|
|
46
|
-
* lost edit. They reject only when the lock could not be taken (`begin`), which the writer treats as
|
|
47
|
-
* "write unrecorded".
|
|
8
|
+
* Points a session's recorded file changes at the folder the project moved to.
|
|
9
|
+
* Review diffs and Undo read each change's own root, so a rename that only moved the
|
|
10
|
+
* saved session would leave them describing files that no longer exist.
|
|
48
11
|
*/
|
|
12
|
+
export declare function relinkSessionChangeRoots(home: string, sessionId: string, from: string, to: string): Promise<void>;
|
|
49
13
|
export interface FileWriteRecording {
|
|
50
14
|
begin(): Promise<void>;
|
|
51
15
|
commit(): Promise<void>;
|
|
52
16
|
abort(): Promise<void>;
|
|
53
17
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Where a run's tools report their writes. `beforeWrite` is called with the canonical paths a mutation will
|
|
56
|
-
* write or remove, before any folder is created for them; it answers nothing when none of the paths is one
|
|
57
|
-
* this recorder tracks.
|
|
58
|
-
*/
|
|
59
18
|
export interface FileChangeRecorder {
|
|
60
19
|
beforeWrite(targets: string | readonly string[]): Promise<FileWriteRecording | undefined>;
|
|
61
20
|
}
|
|
@@ -63,60 +22,25 @@ export declare class SessionChangeStore {
|
|
|
63
22
|
private readonly home;
|
|
64
23
|
private readonly baselineLimit;
|
|
65
24
|
private readonly beforeRestore?;
|
|
66
|
-
/**
|
|
67
|
-
* Both options exist for tests: `baselineLimit` is the size past which an original is not kept, and
|
|
68
|
-
* `beforeRestore` runs inside an Undo, under its lock, after it has checked the files and before it writes.
|
|
69
|
-
*/
|
|
70
25
|
constructor(home: string, options?: {
|
|
71
26
|
baselineLimit?: number;
|
|
72
27
|
beforeRestore?: () => Promise<void>;
|
|
73
28
|
beginMemory?: number;
|
|
74
29
|
});
|
|
75
|
-
/** Test seam: the bytes of originals one write holds in memory before the rest go to the store. */
|
|
76
30
|
private readonly beginMemory;
|
|
77
|
-
/**
|
|
78
|
-
* The recorder a run's tools report their writes to. Only files inside `root` (the run's workspace folder)
|
|
79
|
-
* are tracked: a delegated subagent writes in a worktree of its own, and its change reaches the workspace
|
|
80
|
-
* through the landing, which reports the files it lands.
|
|
81
|
-
*
|
|
82
|
-
* `review` answers, as a write lands, whether the person reviews this run's writes. A run that does not
|
|
83
|
-
* ask (Full Access) adds no file to the pending set: its writes are kept as they land, and nothing waits
|
|
84
|
-
* on a Keep. A file already pending from a reviewed write stays tracked, so its entry and its Undo still
|
|
85
|
-
* describe what is on disk.
|
|
86
|
-
*/
|
|
87
31
|
recorder(sessionId: string, workspace: string, onChange: (changes: AppServerSessionChanges) => void, onError?: (error: unknown) => void, review?: () => boolean): FileChangeRecorder;
|
|
88
|
-
/** Records what a landed write left, for each file it wrote. The caller holds the session's lock. */
|
|
89
32
|
private recordWrites;
|
|
90
|
-
/** Updates one file's entry in `state`; answers whether the pending set changed. */
|
|
91
33
|
private recordWrite;
|
|
92
|
-
/** The pending set as the last write, Keep or Undo left it, without reading the files. */
|
|
93
34
|
pending(sessionId: string): Promise<AppServerSessionChanges>;
|
|
94
|
-
/** Each pending file with its diff from the earlier content to the file as it is now, `maxLines` per file. */
|
|
95
35
|
list(sessionId: string, maxLines?: number): Promise<AppServerSessionChanges>;
|
|
96
|
-
/** One pending file with its diff, up to `maxLines`; null when the file is not pending. */
|
|
97
36
|
get(sessionId: string, relative: string, maxLines?: number): Promise<{
|
|
98
37
|
revision: number;
|
|
99
38
|
change: AppServerSessionFileChange | null;
|
|
100
39
|
}>;
|
|
101
|
-
/** A stored entry measured against the disk now; nothing when the file is back to its baseline. */
|
|
102
40
|
private fresh;
|
|
103
|
-
/** Accepts the named files (every pending file when `paths` is omitted): each leaves the pending set as it is. */
|
|
104
41
|
keep(sessionId: string, paths?: readonly string[]): Promise<AppServerSessionChangesKept>;
|
|
105
|
-
/**
|
|
106
|
-
* Restores the named files (every pending file when `paths` is omitted) to their content before the first
|
|
107
|
-
* unreviewed change. A file whose disk content is no longer what the agent left is a conflict: without
|
|
108
|
-
* `force` one such conflict reverts nothing, so a multi-file Undo never leaves the folder half restored by
|
|
109
|
-
* choice. A file whose original was too large to keep is reported and stays pending either way.
|
|
110
|
-
*
|
|
111
|
-
* The check and the restore run under the lock of every file restored, the lock any session's agent write
|
|
112
|
-
* holds from just before its rename until it is recorded (`FileWriteRecording`), so no write — of this
|
|
113
|
-
* session or another one editing the same folder — can land between them.
|
|
114
|
-
*/
|
|
115
42
|
undo(sessionId: string, paths?: readonly string[], force?: boolean): Promise<AppServerSessionChangesUndone>;
|
|
116
|
-
/** Undo of `targets`, whose file locks and the session's lock the caller holds. */
|
|
117
43
|
private undoLocked;
|
|
118
|
-
/** Puts one file back to its baseline. Refuses a path whose folders now lead outside the workspace. */
|
|
119
44
|
private restore;
|
|
120
|
-
/** Forgets the session's record and its stored originals, as a deleted session must. */
|
|
121
45
|
remove(sessionId: string): Promise<void>;
|
|
122
46
|
}
|
|
@@ -3,43 +3,15 @@ import { chmod, lstat, mkdir, open, readFile, readdir, realpath, rename, rm, rmd
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { acquireSaveLock, SaveLockBusyError } from './save-lock.js';
|
|
5
5
|
import { fileDiff } from './file-diff.js';
|
|
6
|
-
/**
|
|
7
|
-
* The files an agent changed in a session since the person last reviewed them, with Keep and Undo.
|
|
8
|
-
*
|
|
9
|
-
* Every write an agent makes to a workspace file passes one function (`atomicWrite` in `tools.ts`), and a
|
|
10
|
-
* delegated change lands through one more (`applyLanding`). Both report here, before and after: before, so
|
|
11
|
-
* the content the file held can be kept as its baseline the first time the agent touches it; after, so the
|
|
12
|
-
* store knows what the agent's write left. Between two reviews the baseline never moves — a file edited ten
|
|
13
|
-
* times has one entry, and its diff is the file's whole change, not the last call's.
|
|
14
|
-
*
|
|
15
|
-
* Keep makes the file as it is the new baseline: it leaves the pending set and its stored original is
|
|
16
|
-
* dropped. Undo puts the baseline back — the earlier content, or no file at all for one the agent created,
|
|
17
|
-
* or the file again for one a landing removed — but only while the file is still what the agent left: a file
|
|
18
|
-
* something else changed afterwards is reported as a conflict instead of being overwritten, unless the
|
|
19
|
-
* caller asks with `force`.
|
|
20
|
-
*
|
|
21
|
-
* The record lives in the configuration home beside the session (`session-changes/<id>/`), not in the
|
|
22
|
-
* workspace and not in Git: it works for a folder that is no repository, needs no index, and survives an
|
|
23
|
-
* app restart and a resumed session. Engines sharing a home can all read and change it — the desktop runs a
|
|
24
|
-
* process per task and browses with another — so every change happens under the session's store lock, and
|
|
25
|
-
* the revision it carries orders every answer and event across those processes.
|
|
26
|
-
*/
|
|
27
|
-
/** Past this size a file's earlier content is not kept: the change is listed, and Undo refuses the file. */
|
|
28
6
|
export const BASELINE_BYTE_LIMIT = 16 * 1024 * 1024;
|
|
29
|
-
/** Diff lines `list` returns per file unless asked for another bound. */
|
|
30
7
|
export const LIST_DIFF_LINES = 200;
|
|
31
|
-
/** The most diff lines one answer may ask for per file. */
|
|
32
8
|
export const MAX_DIFF_LINES = 20_000;
|
|
33
|
-
/** Characters of diff text per file, so a minified rewrite cannot fill an answer. */
|
|
34
9
|
const DIFF_CHARS = 1024 * 1024;
|
|
35
10
|
const LINE_CHARS = 2_000;
|
|
36
11
|
const LOCK_WAIT_MS = 60_000;
|
|
37
|
-
/** Bytes of originals one write holds in memory while it lands; the rest wait in the store of originals. */
|
|
38
12
|
const BEGIN_MEMORY = 64 * 1024 * 1024;
|
|
39
|
-
/** Diff lines and characters one `list` answer carries across all its files; past them a file lists its counts and `hiddenLines`. */
|
|
40
13
|
const LIST_TOTAL_LINES = 20_000;
|
|
41
14
|
const LIST_TOTAL_CHARS = 4 * 1024 * 1024;
|
|
42
|
-
/** Session ids name files, so only the characters a session id is made of are accepted. */
|
|
43
15
|
export function sessionChangesId(id) {
|
|
44
16
|
if (!/^[A-Za-z0-9_-]{1,128}$/.test(id))
|
|
45
17
|
throw new Error(`Invalid session id: ${id}`);
|
|
@@ -84,10 +56,9 @@ async function readState(home, sessionId) {
|
|
|
84
56
|
if (validState(value))
|
|
85
57
|
return value;
|
|
86
58
|
}
|
|
87
|
-
catch {
|
|
59
|
+
catch { }
|
|
88
60
|
throw new Error(`The review record of session ${sessionId} is not readable`);
|
|
89
61
|
}
|
|
90
|
-
/** Through a temporary file and a rename, so a reader in another engine never sees half a record. */
|
|
91
62
|
async function writeState(home, sessionId, state) {
|
|
92
63
|
const target = stateFile(home, sessionId);
|
|
93
64
|
await mkdir(path.dirname(target), { recursive: true });
|
|
@@ -101,6 +72,30 @@ async function writeState(home, sessionId, state) {
|
|
|
101
72
|
throw error;
|
|
102
73
|
}
|
|
103
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Points a session's recorded file changes at the folder the project moved to.
|
|
77
|
+
* Review diffs and Undo read each change's own root, so a rename that only moved the
|
|
78
|
+
* saved session would leave them describing files that no longer exist.
|
|
79
|
+
*/
|
|
80
|
+
export async function relinkSessionChangeRoots(home, sessionId, from, to) {
|
|
81
|
+
const release = await lock(sessionLockFolder(home, sessionId));
|
|
82
|
+
try {
|
|
83
|
+
const state = await readState(home, sessionId);
|
|
84
|
+
let changed = false;
|
|
85
|
+
const changes = state.changes.map(change => {
|
|
86
|
+
if (path.resolve(change.root) !== path.resolve(from))
|
|
87
|
+
return change;
|
|
88
|
+
changed = true;
|
|
89
|
+
return { ...change, root: to };
|
|
90
|
+
});
|
|
91
|
+
if (!changed)
|
|
92
|
+
return;
|
|
93
|
+
await writeState(home, sessionId, { ...state, revision: state.revision + 1, changes });
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
await release();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
104
99
|
async function writeBlob(home, sessionId, hash, bytes) {
|
|
105
100
|
const target = blobFile(home, sessionId, hash);
|
|
106
101
|
try {
|
|
@@ -128,7 +123,6 @@ async function readBlob(home, sessionId, hash) {
|
|
|
128
123
|
throw new Error('The stored original of this file is damaged');
|
|
129
124
|
return bytes;
|
|
130
125
|
}
|
|
131
|
-
/** Removes every stored original no entry refers to any more. Best effort: a leftover blob is only disk. */
|
|
132
126
|
async function collectBlobs(home, sessionId, state) {
|
|
133
127
|
const referenced = new Set(state.changes.flatMap(change => change.baseline.kind === 'file' ? [change.baseline.hash] : []));
|
|
134
128
|
let names;
|
|
@@ -144,7 +138,6 @@ async function collectBlobs(home, sessionId, state) {
|
|
|
144
138
|
if (!referenced.size)
|
|
145
139
|
await rmdir(blobFolder(home, sessionId)).catch(() => { });
|
|
146
140
|
}
|
|
147
|
-
/** The file at `target` as it stands, read only when it is a regular file small enough to keep. */
|
|
148
141
|
async function observe(target, limit) {
|
|
149
142
|
let info;
|
|
150
143
|
try {
|
|
@@ -170,11 +163,6 @@ async function observe(target, limit) {
|
|
|
170
163
|
}
|
|
171
164
|
}
|
|
172
165
|
const queues = new Map();
|
|
173
|
-
/**
|
|
174
|
-
* Runs `work` as the only holder of the store lock in `folder`, across every engine sharing the home: an
|
|
175
|
-
* in-process queue keeps one engine's callers in order, and the store lock (the one graph saves use, which
|
|
176
|
-
* recovers an abandoned owner) covers the other processes.
|
|
177
|
-
*/
|
|
178
166
|
function withLock(folder, work) {
|
|
179
167
|
const previous = queues.get(folder) ?? Promise.resolve();
|
|
180
168
|
const next = previous.catch(() => { }).then(async () => {
|
|
@@ -192,7 +180,6 @@ function withLock(folder, work) {
|
|
|
192
180
|
queues.delete(folder); });
|
|
193
181
|
return next;
|
|
194
182
|
}
|
|
195
|
-
/** Takes the lock `withLock` takes and answers its release: for a critical section that is not one callback. */
|
|
196
183
|
function holdLock(folder) {
|
|
197
184
|
return new Promise((resolve, reject) => {
|
|
198
185
|
let open;
|
|
@@ -214,9 +201,6 @@ async function lock(folder) {
|
|
|
214
201
|
return await acquireSaveLock(folder);
|
|
215
202
|
}
|
|
216
203
|
catch (error) {
|
|
217
|
-
// Windows answers a lock directory created while the previous holder's is being removed with EPERM
|
|
218
|
-
// (or EACCES/EBUSY): the same "someone else is mid-change" as a busy lock, and it clears the same way.
|
|
219
|
-
// ENOENT is a file lock's folder being removed by its last holder between this taker's two mkdirs.
|
|
220
204
|
const transient = error instanceof SaveLockBusyError || ['EPERM', 'EACCES', 'EBUSY', 'ENOENT'].includes(error.code ?? '');
|
|
221
205
|
if (!transient || Date.now() >= deadline)
|
|
222
206
|
throw error;
|
|
@@ -224,20 +208,8 @@ async function lock(folder) {
|
|
|
224
208
|
}
|
|
225
209
|
}
|
|
226
210
|
}
|
|
227
|
-
/*
|
|
228
|
-
* Two kinds of lock, always taken in this order, which is what keeps them free of deadlock:
|
|
229
|
-
*
|
|
230
|
-
* 1. File locks, one per canonical file path, taken in sorted order. Every recorded agent write holds the lock
|
|
231
|
-
* of each file it writes from just before its rename until it is recorded, whatever its session, and an Undo
|
|
232
|
-
* holds the locks of the files it restores from its check until its restore. Two sessions can edit the
|
|
233
|
-
* same folder, so the session's own lock alone would let session B's write land between session A's check
|
|
234
|
-
* and A's restore.
|
|
235
|
-
* 2. The session lock, which guards one session's record (`state.json` and its originals). Keep, Undo and
|
|
236
|
-
* the record of a write take it last and hold no other session's.
|
|
237
|
-
*/
|
|
238
211
|
const sessionLockFolder = (home, sessionId) => path.join(sessionChangesRoot(home), '.locks', sessionChangesId(sessionId));
|
|
239
212
|
const fileLockFolder = (home, key) => path.join(sessionChangesRoot(home), '.file-locks', key);
|
|
240
|
-
/** The identity a file is locked by: its canonical absolute path (case folded on Windows), hashed to a name. */
|
|
241
213
|
function fileLockKey(root, relative) {
|
|
242
214
|
const absolute = path.join(root, ...relative.split('/'));
|
|
243
215
|
return createHash('sha256').update(process.platform === 'win32' ? absolute.toLowerCase() : absolute).digest('hex');
|
|
@@ -246,7 +218,6 @@ function withSession(home, sessionId, work) {
|
|
|
246
218
|
return withLock(sessionLockFolder(home, sessionId), work);
|
|
247
219
|
}
|
|
248
220
|
const holdSession = (home, sessionId) => holdLock(sessionLockFolder(home, sessionId));
|
|
249
|
-
/** Takes the locks of these files, in sorted order, and answers the release of all of them. */
|
|
250
221
|
async function holdFiles(home, keys) {
|
|
251
222
|
const releases = [];
|
|
252
223
|
const releaseAll = async () => { for (const release of releases.splice(0).reverse())
|
|
@@ -255,8 +226,6 @@ async function holdFiles(home, keys) {
|
|
|
255
226
|
for (const key of [...new Set(keys)].sort()) {
|
|
256
227
|
const folder = fileLockFolder(home, key);
|
|
257
228
|
const release = await holdLock(folder);
|
|
258
|
-
// One folder per file ever written would pile up in the home, so the last holder removes it. A taker
|
|
259
|
-
// that is between its own mkdirs then finds no folder and retries; a held lock keeps it non-empty.
|
|
260
229
|
releases.push(async () => { await release(); await rmdir(folder).catch(() => { }); });
|
|
261
230
|
}
|
|
262
231
|
}
|
|
@@ -274,20 +243,13 @@ function statusOf(baseline, current) {
|
|
|
274
243
|
function wireDiff(result) {
|
|
275
244
|
return result.kind === 'text' ? { hunks: result.diff.hunks, hiddenLines: result.diff.hiddenLines } : null;
|
|
276
245
|
}
|
|
277
|
-
/**
|
|
278
|
-
* Permission bits are part of a file's state where the file system keeps them: a landing can change only a
|
|
279
|
-
* file's executable bit, and that is a change to review and to undo. Windows reports a mode that stands
|
|
280
|
-
* for nothing the tools change, so there it is not compared.
|
|
281
|
-
*/
|
|
282
246
|
const MODES_COMPARABLE = process.platform !== 'win32';
|
|
283
247
|
const octal = (mode) => (mode & 0o777).toString(8).padStart(3, '0');
|
|
284
|
-
/** `from` → `to` permission bits when the file exists on both sides with different modes. */
|
|
285
248
|
function modeChangeOf(baseline, current) {
|
|
286
249
|
if (!MODES_COMPARABLE || baseline.kind !== 'file' || (current.kind !== 'file' && current.kind !== 'large'))
|
|
287
250
|
return undefined;
|
|
288
251
|
return baseline.mode === current.mode ? undefined : { from: octal(baseline.mode), to: octal(current.mode) };
|
|
289
252
|
}
|
|
290
|
-
/** A text's line terminators: all LF, all CRLF, or both; nothing for text with no line break. */
|
|
291
253
|
function lineEndingOf(bytes) {
|
|
292
254
|
let lf = 0, crlf = 0;
|
|
293
255
|
for (let at = bytes.indexOf(0x0a); at >= 0; at = bytes.indexOf(0x0a, at + 1)) {
|
|
@@ -300,11 +262,6 @@ function lineEndingOf(bytes) {
|
|
|
300
262
|
return undefined;
|
|
301
263
|
return lf && crlf ? 'mixed' : crlf ? 'crlf' : 'lf';
|
|
302
264
|
}
|
|
303
|
-
/**
|
|
304
|
-
* The line terminators changed between the sides — a conversion every line of which reads the same once the
|
|
305
|
-
* terminator is dropped, which is what the diff lines show. Said once for the file so a view can explain why
|
|
306
|
-
* a line is removed and added with the same text.
|
|
307
|
-
*/
|
|
308
265
|
function lineEndingsOf(result, before, after) {
|
|
309
266
|
if (result.kind !== 'text' || !before || !after)
|
|
310
267
|
return undefined;
|
|
@@ -330,7 +287,6 @@ function summary(change) {
|
|
|
330
287
|
function snapshot(sessionId, state) {
|
|
331
288
|
return { sessionId, revision: state.revision, changes: state.changes.map(summary) };
|
|
332
289
|
}
|
|
333
|
-
/** Whether the file on disk is still what the agent's last write left: its bytes and, where kept, its mode. */
|
|
334
290
|
function sameAsWritten(written, current) {
|
|
335
291
|
if (written.kind === 'absent')
|
|
336
292
|
return current.kind === 'absent';
|
|
@@ -340,7 +296,6 @@ function sameAsWritten(written, current) {
|
|
|
340
296
|
return false;
|
|
341
297
|
return current.bytes.length === written.size && hashOf(current.bytes) === written.hash;
|
|
342
298
|
}
|
|
343
|
-
/** Whether the file is back to its baseline: the same bytes and, where modes mean something, the same mode. */
|
|
344
299
|
function sameAsBaseline(baseline, current) {
|
|
345
300
|
if (baseline.kind === 'absent')
|
|
346
301
|
return current.kind === 'absent';
|
|
@@ -354,28 +309,13 @@ export class SessionChangeStore {
|
|
|
354
309
|
home;
|
|
355
310
|
baselineLimit;
|
|
356
311
|
beforeRestore;
|
|
357
|
-
/**
|
|
358
|
-
* Both options exist for tests: `baselineLimit` is the size past which an original is not kept, and
|
|
359
|
-
* `beforeRestore` runs inside an Undo, under its lock, after it has checked the files and before it writes.
|
|
360
|
-
*/
|
|
361
312
|
constructor(home, options = {}) {
|
|
362
313
|
this.home = home;
|
|
363
314
|
this.baselineLimit = options.baselineLimit ?? BASELINE_BYTE_LIMIT;
|
|
364
315
|
this.beforeRestore = options.beforeRestore;
|
|
365
316
|
this.beginMemory = options.beginMemory ?? BEGIN_MEMORY;
|
|
366
317
|
}
|
|
367
|
-
/** Test seam: the bytes of originals one write holds in memory before the rest go to the store. */
|
|
368
318
|
beginMemory;
|
|
369
|
-
/**
|
|
370
|
-
* The recorder a run's tools report their writes to. Only files inside `root` (the run's workspace folder)
|
|
371
|
-
* are tracked: a delegated subagent writes in a worktree of its own, and its change reaches the workspace
|
|
372
|
-
* through the landing, which reports the files it lands.
|
|
373
|
-
*
|
|
374
|
-
* `review` answers, as a write lands, whether the person reviews this run's writes. A run that does not
|
|
375
|
-
* ask (Full Access) adds no file to the pending set: its writes are kept as they land, and nothing waits
|
|
376
|
-
* on a Keep. A file already pending from a reviewed write stays tracked, so its entry and its Undo still
|
|
377
|
-
* describe what is on disk.
|
|
378
|
-
*/
|
|
379
319
|
recorder(sessionId, workspace, onChange, onError, review = () => true) {
|
|
380
320
|
sessionChangesId(sessionId);
|
|
381
321
|
let rootPromise;
|
|
@@ -384,8 +324,6 @@ export class SessionChangeStore {
|
|
|
384
324
|
beforeWrite: async (targets) => {
|
|
385
325
|
try {
|
|
386
326
|
const canonicalRoot = await root();
|
|
387
|
-
// The paths this recorder tracks, and the folders a write to each would create (Undo of a created
|
|
388
|
-
// file removes them again when they are empty). Read now, before the writer makes any folder.
|
|
389
327
|
const tracked = [];
|
|
390
328
|
for (const target of typeof targets === 'string' ? [targets] : targets) {
|
|
391
329
|
const resolved = path.resolve(target);
|
|
@@ -411,7 +349,6 @@ export class SessionChangeStore {
|
|
|
411
349
|
begin: async () => {
|
|
412
350
|
if (release)
|
|
413
351
|
throw new Error('This write is already begun');
|
|
414
|
-
// The files' locks first (sorted), then the session's: the order every holder uses.
|
|
415
352
|
const releaseFiles = await holdFiles(this.home, tracked.map(entry => fileLockKey(canonicalRoot, entry.relative)));
|
|
416
353
|
let releaseSession;
|
|
417
354
|
try {
|
|
@@ -428,8 +365,6 @@ export class SessionChangeStore {
|
|
|
428
365
|
await releaseFiles();
|
|
429
366
|
} };
|
|
430
367
|
try {
|
|
431
|
-
// One file at a time, and past the budget straight into the store of originals: a landing of many
|
|
432
|
-
// large files must not hold all of them in memory until it is recorded.
|
|
433
368
|
before = [];
|
|
434
369
|
let held = 0;
|
|
435
370
|
for (const entry of tracked) {
|
|
@@ -469,7 +404,6 @@ export class SessionChangeStore {
|
|
|
469
404
|
}
|
|
470
405
|
},
|
|
471
406
|
abort: async () => {
|
|
472
|
-
// Originals stored for a write that did not land are referenced by nothing.
|
|
473
407
|
if (spilled && release)
|
|
474
408
|
await readState(this.home, sessionId).then(state => collectBlobs(this.home, sessionId, state)).catch(onError);
|
|
475
409
|
await letGo().catch(onError);
|
|
@@ -483,14 +417,12 @@ export class SessionChangeStore {
|
|
|
483
417
|
},
|
|
484
418
|
};
|
|
485
419
|
}
|
|
486
|
-
/** Records what a landed write left, for each file it wrote. The caller holds the session's lock. */
|
|
487
420
|
async recordWrites(sessionId, root, files, spilled = false, review = true) {
|
|
488
421
|
const state = await readState(this.home, sessionId);
|
|
489
422
|
let changed = false;
|
|
490
423
|
for (const file of files)
|
|
491
424
|
changed = await this.recordWrite(sessionId, state, root, file.relative, file.before, file.created, review) || changed;
|
|
492
425
|
if (!changed) {
|
|
493
|
-
// Originals stored while the write began, for files it left as they were, are referenced by nothing.
|
|
494
426
|
if (spilled)
|
|
495
427
|
await collectBlobs(this.home, sessionId, state);
|
|
496
428
|
return undefined;
|
|
@@ -500,12 +432,10 @@ export class SessionChangeStore {
|
|
|
500
432
|
await collectBlobs(this.home, sessionId, state);
|
|
501
433
|
return snapshot(sessionId, state);
|
|
502
434
|
}
|
|
503
|
-
/** Updates one file's entry in `state`; answers whether the pending set changed. */
|
|
504
435
|
async recordWrite(sessionId, state, root, relative, before, created, review = true) {
|
|
505
436
|
const target = path.join(root, ...relative.split('/'));
|
|
506
437
|
if (before.kind === 'other')
|
|
507
438
|
return false;
|
|
508
|
-
// A write nobody reviews starts no entry; one for a file already pending is still recorded.
|
|
509
439
|
if (!review && !state.changes.some(change => keyOf(change.root, change.path) === keyOf(root, relative)))
|
|
510
440
|
return false;
|
|
511
441
|
const after = await observe(target, this.baselineLimit);
|
|
@@ -513,8 +443,6 @@ export class SessionChangeStore {
|
|
|
513
443
|
return false;
|
|
514
444
|
const written = after.kind === 'absent' ? { kind: 'absent' }
|
|
515
445
|
: after.kind === 'file' ? { kind: 'file', hash: hashOf(after.bytes), size: after.bytes.length, mode: after.mode }
|
|
516
|
-
// Too large to hash in the record's terms: a size no real write produces stands in, so a later
|
|
517
|
-
// Undo sees "changed since" and asks before it overwrites anything.
|
|
518
446
|
: { kind: 'file', hash: 'unmeasured', size: -1 };
|
|
519
447
|
const key = keyOf(root, relative);
|
|
520
448
|
const index = state.changes.findIndex(change => keyOf(change.root, change.path) === key);
|
|
@@ -529,13 +457,11 @@ export class SessionChangeStore {
|
|
|
529
457
|
...(baseline.kind === 'absent' && created.length ? { createdDirectories: created } : {}) };
|
|
530
458
|
}
|
|
531
459
|
if (sameAsBaseline(entry.baseline, after)) {
|
|
532
|
-
// The agent wrote the file back to what it was (or a write changed nothing): there is nothing to review.
|
|
533
460
|
if (index < 0)
|
|
534
461
|
return false;
|
|
535
462
|
state.changes.splice(index, 1);
|
|
536
463
|
return true;
|
|
537
464
|
}
|
|
538
|
-
// A new entry's original is stored only now that there is a change to keep it for.
|
|
539
465
|
if (index < 0 && entry.baseline.kind === 'file' && before.kind === 'file')
|
|
540
466
|
await writeBlob(this.home, sessionId, entry.baseline.hash, before.bytes);
|
|
541
467
|
const baselineBytes = entry.baseline.kind !== 'file' ? null
|
|
@@ -546,9 +472,6 @@ export class SessionChangeStore {
|
|
|
546
472
|
const { binary: _binary, tooLarge: _tooLarge, modeChange: _modeChange, lineEndings: _lineEndings, diffLines: _diffLines, ...rest } = entry;
|
|
547
473
|
const modeChange = modeChangeOf(entry.baseline, after);
|
|
548
474
|
const lineEndings = lineEndingsOf(result, baselineBytes, after.kind === 'file' ? after.bytes : null);
|
|
549
|
-
// The version is the revision this write gives the record, so it never repeats for a path — not even when
|
|
550
|
-
// the file was kept or undone and the agent changes it again: a client's cached diff of an earlier
|
|
551
|
-
// generation can never pass for this one.
|
|
552
475
|
entry = { ...rest, ...measured(result), ...(modeChange ? { modeChange } : {}), ...(lineEndings ? { lineEndings } : {}),
|
|
553
476
|
...(result.kind === 'text' ? { diffLines: result.diff.hiddenLines } : {}),
|
|
554
477
|
written, status: statusOf(entry.baseline, after), version: state.revision + 1, updatedAt: now };
|
|
@@ -558,16 +481,12 @@ export class SessionChangeStore {
|
|
|
558
481
|
state.changes[index] = entry;
|
|
559
482
|
return true;
|
|
560
483
|
}
|
|
561
|
-
/** The pending set as the last write, Keep or Undo left it, without reading the files. */
|
|
562
484
|
async pending(sessionId) {
|
|
563
485
|
return snapshot(sessionId, await readState(this.home, sessionId));
|
|
564
486
|
}
|
|
565
|
-
/** Each pending file with its diff from the earlier content to the file as it is now, `maxLines` per file. */
|
|
566
487
|
async list(sessionId, maxLines = LIST_DIFF_LINES) {
|
|
567
488
|
const state = await readState(this.home, sessionId);
|
|
568
489
|
const changes = [];
|
|
569
|
-
// One answer carries a bounded amount of diff whatever the number of files: once it is spent, a file still
|
|
570
|
-
// lists its counts, and its `hiddenLines` says there is a diff to read with `get`.
|
|
571
490
|
let lines = LIST_TOTAL_LINES, chars = LIST_TOTAL_CHARS;
|
|
572
491
|
for (const stored of state.changes) {
|
|
573
492
|
const fresh = await this.fresh(sessionId, stored, Math.min(maxLines, lines), Math.min(DIFF_CHARS, chars));
|
|
@@ -582,19 +501,15 @@ export class SessionChangeStore {
|
|
|
582
501
|
}
|
|
583
502
|
return { sessionId, revision: state.revision, changes };
|
|
584
503
|
}
|
|
585
|
-
/** One pending file with its diff, up to `maxLines`; null when the file is not pending. */
|
|
586
504
|
async get(sessionId, relative, maxLines = MAX_DIFF_LINES) {
|
|
587
505
|
const state = await readState(this.home, sessionId);
|
|
588
506
|
const stored = state.changes.find(change => change.path === relative);
|
|
589
507
|
const fresh = stored ? await this.fresh(sessionId, stored, maxLines) : undefined;
|
|
590
508
|
return { revision: state.revision, change: fresh?.change ?? null };
|
|
591
509
|
}
|
|
592
|
-
/** A stored entry measured against the disk now; nothing when the file is back to its baseline. */
|
|
593
510
|
async fresh(sessionId, stored, maxLines, maxChars = DIFF_CHARS) {
|
|
594
511
|
const target = path.join(stored.root, ...stored.path.split('/'));
|
|
595
512
|
let current;
|
|
596
|
-
// Read up to the size an original is kept at, so "changed since the agent wrote it" stays exact for
|
|
597
|
-
// every file Undo could restore; past the diff bound the change is still listed, without a diff.
|
|
598
513
|
try {
|
|
599
514
|
current = await observe(target, this.baselineLimit);
|
|
600
515
|
}
|
|
@@ -603,8 +518,6 @@ export class SessionChangeStore {
|
|
|
603
518
|
}
|
|
604
519
|
if (sameAsBaseline(stored.baseline, current))
|
|
605
520
|
return undefined;
|
|
606
|
-
// A listing whose diff budget is spent shows only counts. While the file is what the agent left, the
|
|
607
|
-
// figures measured at that write are exact, so the diff is not computed again just to be thrown away.
|
|
608
521
|
if (maxLines <= 0 && stored.diffLines !== undefined && sameAsWritten(stored.written, current)) {
|
|
609
522
|
return { change: { ...summary(stored), diff: { hunks: [], hiddenLines: stored.diffLines } }, current };
|
|
610
523
|
}
|
|
@@ -632,14 +545,12 @@ export class SessionChangeStore {
|
|
|
632
545
|
...(sameAsWritten(stored.written, current) ? {} : { changedOnDisk: true }),
|
|
633
546
|
diff: wireDiff(result),
|
|
634
547
|
};
|
|
635
|
-
// `measured` reports 0/0 for a too-large side it could not count; keep the figures the write measured.
|
|
636
548
|
if (result.kind === 'too-large' && result.linesAdded === undefined) {
|
|
637
549
|
change.linesAdded = stored.linesAdded;
|
|
638
550
|
change.linesRemoved = stored.linesRemoved;
|
|
639
551
|
}
|
|
640
552
|
return { change, current };
|
|
641
553
|
}
|
|
642
|
-
/** Accepts the named files (every pending file when `paths` is omitted): each leaves the pending set as it is. */
|
|
643
554
|
async keep(sessionId, paths) {
|
|
644
555
|
return withSession(this.home, sessionId, async () => {
|
|
645
556
|
const state = await readState(this.home, sessionId);
|
|
@@ -654,23 +565,11 @@ export class SessionChangeStore {
|
|
|
654
565
|
return { ...snapshot(sessionId, state), kept };
|
|
655
566
|
});
|
|
656
567
|
}
|
|
657
|
-
/**
|
|
658
|
-
* Restores the named files (every pending file when `paths` is omitted) to their content before the first
|
|
659
|
-
* unreviewed change. A file whose disk content is no longer what the agent left is a conflict: without
|
|
660
|
-
* `force` one such conflict reverts nothing, so a multi-file Undo never leaves the folder half restored by
|
|
661
|
-
* choice. A file whose original was too large to keep is reported and stays pending either way.
|
|
662
|
-
*
|
|
663
|
-
* The check and the restore run under the lock of every file restored, the lock any session's agent write
|
|
664
|
-
* holds from just before its rename until it is recorded (`FileWriteRecording`), so no write — of this
|
|
665
|
-
* session or another one editing the same folder — can land between them.
|
|
666
|
-
*/
|
|
667
568
|
async undo(sessionId, paths, force = false) {
|
|
668
569
|
const chosenOf = (state) => {
|
|
669
570
|
const chosen = new Set(paths ?? state.changes.map(change => change.path));
|
|
670
571
|
return state.changes.filter(change => chosen.has(change.path));
|
|
671
572
|
};
|
|
672
|
-
// The files' locks are taken before the session's, so which files to lock is read first; a file that
|
|
673
|
-
// became pending meanwhile sends the Undo round again, and after a few rounds it is left for the next one.
|
|
674
573
|
for (let attempt = 1;; attempt++) {
|
|
675
574
|
const keys = chosenOf(await readState(this.home, sessionId)).map(change => fileLockKey(change.root, change.path));
|
|
676
575
|
const releaseFiles = await holdFiles(this.home, keys);
|
|
@@ -692,7 +591,6 @@ export class SessionChangeStore {
|
|
|
692
591
|
}
|
|
693
592
|
}
|
|
694
593
|
}
|
|
695
|
-
/** Undo of `targets`, whose file locks and the session's lock the caller holds. */
|
|
696
594
|
async undoLocked(sessionId, state, targets, force) {
|
|
697
595
|
const conflicts = [];
|
|
698
596
|
const failed = [];
|
|
@@ -743,7 +641,6 @@ export class SessionChangeStore {
|
|
|
743
641
|
}
|
|
744
642
|
return { ...snapshot(sessionId, state), reverted, conflicts, failed };
|
|
745
643
|
}
|
|
746
|
-
/** Puts one file back to its baseline. Refuses a path whose folders now lead outside the workspace. */
|
|
747
644
|
async restore(sessionId, change, current) {
|
|
748
645
|
const root = await realpath(change.root);
|
|
749
646
|
const target = path.join(root, ...change.path.split('/'));
|
|
@@ -752,7 +649,6 @@ export class SessionChangeStore {
|
|
|
752
649
|
if (current.kind === 'other')
|
|
753
650
|
throw new Error('The path is no longer a regular file');
|
|
754
651
|
const parent = path.dirname(target);
|
|
755
|
-
// A folder on the way that became a link must not carry the restore out of the workspace.
|
|
756
652
|
const existing = await nearestExisting(parent, root);
|
|
757
653
|
if (!within(root, await realpath(existing)))
|
|
758
654
|
throw new Error('A folder on the file’s path now leads outside the workspace');
|
|
@@ -781,7 +677,6 @@ export class SessionChangeStore {
|
|
|
781
677
|
throw error;
|
|
782
678
|
}
|
|
783
679
|
}
|
|
784
|
-
/** Forgets the session's record and its stored originals, as a deleted session must. */
|
|
785
680
|
async remove(sessionId) {
|
|
786
681
|
await withSession(this.home, sessionId, async () => {
|
|
787
682
|
await rm(sessionFolder(this.home, sessionId), { recursive: true, force: true });
|