Class: GitCowWorktreeScopeDriver
Defined in: git/src/executors/git-cow-worktree-scope.ts:48
Tier-3 branchable Copy-on-Write Git worktree isolation scope driver (git.cowWorktree).
Implements disjoint root/fork worktrees, git-index checkpoints, post-flight .git integrity diffing, automatic parent dirty-tree flushing, and stateless git merge-tree --write-tree 3-way reconciliation.
Implements
Constructors
Constructor
new GitCowWorktreeScopeDriver(node): GitCowWorktreeScopeDriver;Defined in: git/src/executors/git-cow-worktree-scope.ts:77
Initializes a GitCowWorktreeScopeDriver from its passive GitCowWorktreeNode AST configuration.
Binds the repository path, disjoint worktree directory layout, and checkpoint policy configuration.
Parameters
| Parameter | Type | Description |
|---|---|---|
node | GitCowWorktreeNode | Passive worktree scope AST configuration node. |
Returns
GitCowWorktreeScopeDriver
Methods
acquireRoot()
acquireRoot(runId): Promise<GitWorktreeHandle>;Defined in: git/src/executors/git-cow-worktree-scope.ts:93
Provisions an isolated Task Root Worktree at <dir>/roots/<runId> for runId.
Hydrates node_modules according to .lockfileGate and .setup and initializes <gitdir>/harness-meta.json.
Parameters
| Parameter | Type | Description |
|---|---|---|
runId | string | Unique identifier of the flow run. |
Returns
Promise<GitWorktreeHandle>
Newly acquired root worktree handle.
Implementation of
commitChild()
commitChild(child, parent): Promise<ReconcileResult<GitScopeReceipt>>;Defined in: git/src/executors/git-cow-worktree-scope.ts:263
Reconciles child into parent via stateless git merge-tree --write-tree over shared parent $C_0$.
Leaves parent untouched on conflict and materializes conflicted blobs into child with unresolvedConflictPaths.
Parameters
| Parameter | Type | Description |
|---|---|---|
child | GitWorktreeHandle | Completed child worktree handle. |
parent | GitWorktreeHandle | Target parent worktree handle. |
Returns
Promise<ReconcileResult<GitScopeReceipt>>
Clean or conflicted reconciliation result.
Implementation of
diffEffects()
diffEffects(fromCheckpoint, handle): Promise<readonly ToolEffect[]>;Defined in: git/src/executors/git-cow-worktree-scope.ts:175
Verifies worktree-local .git and node_modules integrity and diffs handle against fromCheckpoint.
Restores fromCheckpoint and throws immediately if .git metadata or node_modules was tampered with.
Parameters
| Parameter | Type | Description |
|---|---|---|
fromCheckpoint | string | Pre-tool serialized checkpoint payload. |
handle | GitWorktreeHandle | Worktree handle after subprocess tool execution. |
Returns
Promise<readonly ToolEffect[]>
Synthesized FsToolEffect list for modified paths.
Implementation of
forkChild()
forkChild(parent, forkId): Promise<GitWorktreeHandle>;Defined in: git/src/executors/git-cow-worktree-scope.ts:220
Flushes clean dirty files on parent under a per-parent async mutex and forks <dir>/forks/<runId>/<forkId>.
Copies any remaining unresolvedConflictPaths from parent into the newly forked child worktree.
Parameters
| Parameter | Type | Description |
|---|---|---|
parent | GitWorktreeHandle | Parent worktree handle to clone from. |
forkId | string | Unique child fork or speculative branch identifier. |
Returns
Promise<GitWorktreeHandle>
Newly provisioned child worktree handle.
Implementation of
getConflictLease()
getConflictLease(handle): LeaseDelta | undefined;Defined in: git/src/executors/git-cow-worktree-scope.ts:304
Returns a temporary write capability lease (fs:match-globs) for handle.unresolvedConflictPaths.
Returns undefined when handle.unresolvedConflictPaths is empty.
Parameters
| Parameter | Type | Description |
|---|---|---|
handle | GitWorktreeHandle | Worktree handle containing unresolved conflict paths. |
Returns
LeaseDelta | undefined
Temporary conflict write lease delta, or undefined when clean.
Implementation of
BranchableScope.getConflictLease
inspect()
inspect(handle): Promise<GitScopeReceipt>;Defined in: git/src/executors/git-cow-worktree-scope.ts:120
Captures a non-mutating GitScopeReceipt for handle using a temporary GIT_INDEX_FILE.
Pins refs/harness/candidates/<run-id>/<branch-index> when inspecting a speculative branch handle.
Parameters
| Parameter | Type | Description |
|---|---|---|
handle | GitWorktreeHandle | Active worktree handle to inspect. |
Returns
Promise<GitScopeReceipt>
Validated GitScopeReceipt without mutating live HEAD or .git/index.
Implementation of
reattachChild()
reattachChild(
parent,
forkId,
checkpoint?
): Promise<GitWorktreeHandle>;Defined in: git/src/executors/git-cow-worktree-scope.ts:244
Rebinds an existing child fork worktree at <dir>/forks/<runId>/<forkId> during crash recovery.
Completes any interrupted inFlightMerge state and preserves uncommitted child edits across reboots.
Parameters
| Parameter | Type | Description |
|---|---|---|
parent | GitWorktreeHandle | Reattached parent worktree handle. |
forkId | string | Unique child fork identifier. |
checkpoint? | string | Optional serialized checkpoint fallback when the directory is missing. |
Returns
Promise<GitWorktreeHandle>
Reattached child worktree handle.
Implementation of
reattachRoot()
reattachRoot(runId, checkpoint?): Promise<GitWorktreeHandle>;Defined in: git/src/executors/git-cow-worktree-scope.ts:107
Rebinds an existing Task Root Worktree at <dir>/roots/<runId> during crash recovery.
Completes interrupted pendingParentHeadSha or inFlightMerge state and rolls back inFlightCommitAndPush.
Parameters
| Parameter | Type | Description |
|---|---|---|
runId | string | Unique identifier of the recovering flow run. |
checkpoint? | string | Optional serialized checkpoint fallback when the worktree directory is missing. |
Returns
Promise<GitWorktreeHandle>
Reattached root worktree handle.
Implementation of
release()
release(handle): Promise<void>;Defined in: git/src/executors/git-cow-worktree-scope.ts:133
Pins the final commit SHA under refs/harness/completed/... and removes the worktree directory.
Prunes <gitdir>/harness-ckpt-blobs/ and <gitdir>/harness-ckpt-nm/ before git worktree remove --force.
Parameters
| Parameter | Type | Description |
|---|---|---|
handle | GitWorktreeHandle | Ephemeral root or child worktree handle to release. |
Returns
Promise<void>
Resolves once the completed ref is pinned and the worktree is removed.
Implementation of
restoreCheckpoint()
restoreCheckpoint(handle, checkpoint): Promise<void>;Defined in: git/src/executors/git-cow-worktree-scope.ts:161
Restores handle to the exact state captured by checkpoint using the 4-step restoration protocol.
Restores .git metadata and .gitignore rules, unlinks symmetric-diff extras, checks out treeSha, and copies back oversized blobs.
Parameters
| Parameter | Type | Description |
|---|---|---|
handle | GitWorktreeHandle | Active worktree handle to roll back. |
checkpoint | string | Serialized JSON checkpoint payload. |
Returns
Promise<void>
Resolves once handle matches checkpoint.
Implementation of
BranchableScope.restoreCheckpoint
serializeCheckpoint()
serializeCheckpoint(handle): Promise<string>;Defined in: git/src/executors/git-cow-worktree-scope.ts:147
Captures the uncommitted working-tree and worktree-local .git state of handle into a JSON checkpoint token.
Uses git status --porcelain=v2 -z --no-renames --untracked-files=all and a temporary GIT_INDEX_FILE.
Parameters
| Parameter | Type | Description |
|---|---|---|
handle | GitWorktreeHandle | Active worktree handle to snapshot. |
Returns
Promise<string>
Serialized JSON GitCheckpointPayload string.
Implementation of
BranchableScope.serializeCheckpoint
syncChild()
syncChild(parent, pausedChild): Promise<ReconcileResult<GitSyncReceipt>>;Defined in: git/src/executors/git-cow-worktree-scope.ts:277
Rebases/merges uncommitted changes in pausedChild onto an updated parent worktree handle.
Materializes the merged tree into pausedChild and updates pausedChild.baseRef to parent.HEAD.
Parameters
| Parameter | Type | Description |
|---|---|---|
parent | GitWorktreeHandle | Updated parent worktree handle. |
pausedChild | GitWorktreeHandle | Suspended child worktree handle being resumed. |
Returns
Promise<ReconcileResult<GitSyncReceipt>>
Clean or conflicted synchronization result.
Implementation of
syncRoot()
syncRoot(rootHandle, prerequisiteReceipts): Promise<ReconcileResult<GitSyncReceipt>>;Defined in: git/src/executors/git-cow-worktree-scope.ts:291
Synchronizes rootHandle onto the terminal commit of completed prerequisite runs.
Updates rootHandle.baseBranch when prerequisite branches remain unmerged on origin/main.
Parameters
| Parameter | Type | Description |
|---|---|---|
rootHandle | GitWorktreeHandle | Task root worktree handle. |
prerequisiteReceipts | readonly GitScopeReceipt[] | Terminal scope receipts of completed prerequisites. |
Returns
Promise<ReconcileResult<GitSyncReceipt>>
Clean or conflicted synchronization result.
Implementation of
Properties
id
readonly id: string;Defined in: git/src/executors/git-cow-worktree-scope.ts:52
Unique identifier of this isolation scope driver instance.
Implementation of
receiptSchema
readonly receiptSchema: ZodObject<{
baseBranch: ZodDefault<ZodString>;
baseRef: ZodString;
branchName: ZodOptional<ZodString>;
diffStat: ZodString;
headRef: ZodString;
mutatedFiles: ZodReadonly<ZodArray<ZodString>>;
}, $strip> = GitScopeReceiptSchema;Defined in: git/src/executors/git-cow-worktree-scope.ts:54
Zod schema validating inspection receipts returned by inspect().
Implementation of
supportsBranching
readonly supportsBranching: true;Defined in: git/src/executors/git-cow-worktree-scope.ts:60
Capability flag confirming Copy-on-Write child worktree branching and 3-way reconciliation support.
Implementation of
BranchableScope.supportsBranching
supportsCheckpoints
readonly supportsCheckpoints: true;Defined in: git/src/executors/git-cow-worktree-scope.ts:58
Capability flag confirming git-index checkpoint serialization and rollback support.
Implementation of
BranchableScope.supportsCheckpoints
syncSchema
readonly syncSchema: ZodObject<{
baseBranch: ZodDefault<ZodString>;
rebasedOntoRef: ZodString;
updatedFiles: ZodReadonly<ZodArray<ZodString>>;
}, $strip> = GitSyncReceiptSchema;Defined in: git/src/executors/git-cow-worktree-scope.ts:56
Zod schema validating synchronization receipts returned by syncChild() and syncRoot().