@ricsam/r5d-worker 0.0.74 → 0.0.76

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.
Files changed (32) hide show
  1. package/README.md +6 -4
  2. package/dist/cjs/main.cjs +1031 -976
  3. package/dist/cjs/package.json +1 -1
  4. package/dist/cjs/project-workspace-state.cjs +777 -0
  5. package/dist/cjs/project-worktrees.cjs +559 -0
  6. package/dist/cjs/working-tree-mirror.cjs +225 -0
  7. package/dist/cjs/workspace-git-sync.cjs +565 -0
  8. package/dist/cjs/workspace-incident-state.cjs +2 -38
  9. package/dist/mjs/main.mjs +1048 -987
  10. package/dist/mjs/package.json +1 -1
  11. package/dist/mjs/project-workspace-state.mjs +745 -0
  12. package/dist/mjs/project-worktrees.mjs +513 -0
  13. package/dist/mjs/working-tree-mirror.mjs +190 -0
  14. package/dist/mjs/workspace-git-sync.mjs +524 -0
  15. package/dist/mjs/workspace-incident-state.mjs +1 -35
  16. package/dist/types/main.d.ts +35 -55
  17. package/dist/types/project-workspace-state.d.ts +144 -0
  18. package/dist/types/project-worktrees.d.ts +112 -0
  19. package/dist/types/working-tree-mirror.d.ts +24 -0
  20. package/dist/types/workspace-git-sync.d.ts +97 -0
  21. package/dist/types/workspace-incident-state.d.ts +0 -17
  22. package/dist/types/workspace-mutation-gate.d.ts +3 -3
  23. package/package.json +1 -1
  24. package/dist/cjs/workspace-convergence.cjs +0 -280
  25. package/dist/cjs/workspace-manifest-admission.cjs +0 -60
  26. package/dist/cjs/workspace-sync.cjs +0 -2469
  27. package/dist/mjs/workspace-convergence.mjs +0 -236
  28. package/dist/mjs/workspace-manifest-admission.mjs +0 -26
  29. package/dist/mjs/workspace-sync.mjs +0 -2417
  30. package/dist/types/workspace-convergence.d.ts +0 -93
  31. package/dist/types/workspace-manifest-admission.d.ts +0 -22
  32. package/dist/types/workspace-sync.d.ts +0 -167
@@ -1,5 +1,17 @@
1
1
  #!/usr/bin/env bun
2
- import { type WorkspaceProjectManifestEntry } from "./workspace-sync";
2
+ type WorkerProjectConfig = {
3
+ projectId: string;
4
+ checkoutPathSegments: [namespace: string, project: string];
5
+ projectPath: string;
6
+ repoHttpUrl: string | null;
7
+ repoAuthHeader: string | null;
8
+ defaultBranch: string;
9
+ branches: Array<{
10
+ branchName: string;
11
+ sourceBranchName: string | null;
12
+ baseCommitHash: string;
13
+ }>;
14
+ };
3
15
  export type WorkerSessionTarget = {
4
16
  type: "project";
5
17
  projectId: string;
@@ -21,7 +33,6 @@ type WorkerReadFileResult = {
21
33
  truncated: boolean;
22
34
  continuation?: string;
23
35
  };
24
- type WorkerProjectManifestEntry = WorkspaceProjectManifestEntry;
25
36
  type WorkerWriteFileResult = {
26
37
  type: "write";
27
38
  file: string;
@@ -60,6 +71,24 @@ type WorkerViewFileBytesResult = {
60
71
  width: number;
61
72
  height: number;
62
73
  };
74
+ type WorkerCodeEntry = {
75
+ name: string;
76
+ type: "file" | "directory";
77
+ size: number | null;
78
+ mtime: string;
79
+ };
80
+ type WorkerCodeListResult = {
81
+ type: "code_list";
82
+ path: string;
83
+ entries: WorkerCodeEntry[];
84
+ };
85
+ type WorkerCodeReadResult = {
86
+ type: "code_read";
87
+ path: string;
88
+ size: number;
89
+ mtime: string;
90
+ base64: string;
91
+ };
63
92
  export type WorkerBuiltInToolPaths = {
64
93
  artifactsDir?: string;
65
94
  plansDir?: string;
@@ -83,17 +112,6 @@ export declare function preparePlanEnvForShell(input: {
83
112
  planRoot: string;
84
113
  activePlanId?: string;
85
114
  }): Record<string, string>;
86
- type GitAuth = {
87
- extraHeaderUrl: string;
88
- header: string;
89
- };
90
- declare function gitAuthArgs(auth?: GitAuth): string[];
91
- export declare const visibleCheckoutGitTestHarness: {
92
- gitAuthArgs: typeof gitAuthArgs;
93
- commandArgs: (args: string[], auth?: GitAuth) => string[];
94
- cloneArgs: (remoteUrl: string, branchPath: string) => string[];
95
- fetchArgs: (...args: string[]) => string[];
96
- };
97
115
  type ResolvedWorkerFilePath = {
98
116
  absolutePath: string;
99
117
  displayPath: string;
@@ -112,59 +130,19 @@ type ResolvedWorkerFilePath = {
112
130
  virtualRootPath: string;
113
131
  };
114
132
  export declare function resolveWorkerFilePath(branchPath: string, inputPath: string, builtInPaths?: WorkerBuiltInToolPaths): ResolvedWorkerFilePath;
115
- export declare function visibleCheckoutRemoteFor(input: {
116
- baseUrl: string;
117
- token: string;
118
- projectId: string;
119
- branchName: string;
120
- manifest?: WorkerProjectManifestEntry;
121
- }): {
122
- remoteUrl: string;
123
- authHeader: string | null;
124
- persistAuth: boolean;
125
- reconcileExistingOrigin: boolean;
126
- requireRemoteBranch: boolean;
127
- requiredBaseCommit: string | null;
128
- };
129
133
  export declare function githubCliEnv(token: string | null | undefined): Record<string, string>;
130
- export declare function ensureVisibleGitCheckout(input: {
131
- projectRoot: string;
132
- branchName: string;
133
- remoteUrl: string;
134
- remoteAuth?: GitAuth;
135
- persistentAuthHeader?: string | null;
136
- defaultBranch: string;
137
- reconcileExistingOrigin?: boolean;
138
- requireRemoteBranch?: boolean;
139
- requiredBaseCommit?: string | null;
140
- allowRequiredRemoteMigration?: boolean;
141
- clearPersistentAuth?: boolean;
142
- }): string;
143
134
  type ResolvedWorkerSessionTarget = {
144
135
  target: WorkerSessionTarget;
145
136
  rootPath: string;
146
- manifest?: WorkerProjectManifestEntry;
137
+ config?: WorkerProjectConfig;
147
138
  };
148
139
  export declare function describeWorkerSessionTarget(target: WorkerSessionTarget): string;
149
140
  export declare function resolveWorkerSessionTarget(input: {
150
141
  target: WorkerSessionTarget;
151
- baseUrl: string;
152
- token: string;
153
142
  projectsRoot: string;
154
- syncRoot: string;
155
143
  workspaceShadowRoot: string;
156
- manifestByProjectId: Map<string, WorkerProjectManifestEntry>;
144
+ projectConfigById: Map<string, WorkerProjectConfig>;
157
145
  }): ResolvedWorkerSessionTarget;
158
- type VisibleCheckoutTarget = {
159
- projectId: string;
160
- branchName: string;
161
- };
162
- export declare function workspaceSyncCheckoutTargets(input: {
163
- projects: readonly WorkspaceProjectManifestEntry[];
164
- pendingTargets: readonly VisibleCheckoutTarget[];
165
- includeAllManifestCheckouts: boolean;
166
- canonicalCheckoutOnly?: VisibleCheckoutTarget;
167
- }): VisibleCheckoutTarget[];
168
146
  export declare function prepareBuiltInToolPathsForTarget(input: {
169
147
  target: WorkerSessionTarget;
170
148
  filePath: string;
@@ -196,6 +174,8 @@ export declare function findWorkerFiles(branchPath: string, input: {
196
174
  limit?: number;
197
175
  }, builtInPaths?: WorkerBuiltInToolPaths): WorkerFindResult;
198
176
  export declare function listWorkerDirectory(branchPath: string, inputPath?: string, inputLimit?: number, builtInPaths?: WorkerBuiltInToolPaths): WorkerLsResult;
177
+ export declare function listWorkerCodeDirectory(branchPath: string, inputPath: string): WorkerCodeListResult;
178
+ export declare function readWorkerCodeFile(branchPath: string, inputPath: string): WorkerCodeReadResult;
199
179
  export declare function readWorkerImageFile(branchPath: string, filePath: string, builtInPaths?: WorkerBuiltInToolPaths): WorkerViewFileBytesResult;
200
180
  export declare function prepareShellEnvForTarget(input: {
201
181
  target: WorkerSessionTarget;
@@ -0,0 +1,144 @@
1
+ import { type CheckoutPathSegments } from "./managed-paths";
2
+ export declare const PROJECT_WORKSPACE_STATE_FILE = "project-workspace-state.json";
3
+ export type ProjectWorkspaceDesiredProjectInput = {
4
+ projectId: string;
5
+ checkoutPathSegments: CheckoutPathSegments;
6
+ defaultBranch: string;
7
+ branches: readonly {
8
+ branchName: string;
9
+ }[];
10
+ };
11
+ export type ProjectWorkspaceDesiredProject = {
12
+ projectId: string;
13
+ checkoutPathSegments: CheckoutPathSegments;
14
+ defaultBranch: string;
15
+ branches: Array<{
16
+ branchName: string;
17
+ }>;
18
+ };
19
+ export type LocallyPendingCreatedProjectBranch = {
20
+ projectId: string;
21
+ branchName: string;
22
+ };
23
+ type ProjectWorkspaceDeletionBase = {
24
+ id: string;
25
+ projectId: string;
26
+ checkoutPathSegments: CheckoutPathSegments;
27
+ treePublishedHead: string | null;
28
+ mirrorRefsDeleted: string[];
29
+ };
30
+ export type ProjectWorkspaceBranchDeletionTombstone = ProjectWorkspaceDeletionBase & {
31
+ kind: "branch";
32
+ branchName: string;
33
+ };
34
+ export type ProjectWorkspaceProjectDeletionTombstone = ProjectWorkspaceDeletionBase & {
35
+ kind: "project";
36
+ branchNames: string[];
37
+ };
38
+ export type ProjectWorkspaceDeletionTombstone = ProjectWorkspaceBranchDeletionTombstone | ProjectWorkspaceProjectDeletionTombstone;
39
+ export type PendingProjectWorkspaceTreeDeletion = {
40
+ tombstoneId: string;
41
+ kind: "branch";
42
+ projectId: string;
43
+ checkoutPathSegments: CheckoutPathSegments;
44
+ branchName: string;
45
+ managedPath: string;
46
+ primaryBranchName: string | null;
47
+ } | {
48
+ tombstoneId: string;
49
+ kind: "project";
50
+ projectId: string;
51
+ checkoutPathSegments: CheckoutPathSegments;
52
+ branchNames: string[];
53
+ managedPath: string;
54
+ projectDeleted: boolean;
55
+ };
56
+ export type PendingProjectMirrorRefDeletion = {
57
+ tombstoneId: string;
58
+ projectId: string;
59
+ branchName: string;
60
+ checkoutPathSegments: CheckoutPathSegments;
61
+ managedPath: string;
62
+ primaryBranchName: string | null;
63
+ treePublishedHead: string;
64
+ };
65
+ export type ProjectWorkspaceStateView = {
66
+ desiredProjects: ProjectWorkspaceDesiredProject[];
67
+ effectiveDesiredProjects: ProjectWorkspaceDesiredProject[];
68
+ locallyPendingCreatedBranches: LocallyPendingCreatedProjectBranch[];
69
+ tombstones: ProjectWorkspaceDeletionTombstone[];
70
+ pendingTreeDeletions: PendingProjectWorkspaceTreeDeletion[];
71
+ pendingMirrorRefDeletions: PendingProjectMirrorRefDeletion[];
72
+ };
73
+ export type StaleOuterProjectWorkspaceBranch = {
74
+ kind: "branch";
75
+ projectId: string;
76
+ branchName: string;
77
+ projectTreePath: string | null;
78
+ planTreePath: string | null;
79
+ };
80
+ export type StaleOuterProjectWorkspaceProject = {
81
+ kind: "project";
82
+ projectId: string;
83
+ projectTreePath: string | null;
84
+ planTreePath: string | null;
85
+ branches: Array<{
86
+ branchName: string;
87
+ projectTreePath: string | null;
88
+ planTreePath: string | null;
89
+ }>;
90
+ };
91
+ export type StaleOuterProjectWorkspaceEntry = StaleOuterProjectWorkspaceBranch | StaleOuterProjectWorkspaceProject;
92
+ /**
93
+ * A fresh authoritative configuration wins over any deletion staged by an
94
+ * older configuration. Remove only exact project/branch targets so unrelated
95
+ * cleanup (including an old checkout-path tombstone) remains durable.
96
+ */
97
+ export declare function pruneAuthoritativelyDesiredBranchDeletions<T extends LocallyPendingCreatedProjectBranch>(pendingDeletions: Map<string, T>, desiredProjects: readonly ProjectWorkspaceDesiredProjectInput[]): void;
98
+ /**
99
+ * Discover legacy outer-tree entries without trusting or walking arbitrary
100
+ * filesystem names. Only canonical managed project ids and encoded branch
101
+ * directory names are returned; symlinks, files, and non-layout entries are
102
+ * deliberately left for an operator.
103
+ */
104
+ export declare function discoverStaleOuterProjectWorkspaceEntries(input: {
105
+ workspaceShadowRoot: string;
106
+ desiredProjects: readonly ProjectWorkspaceDesiredProjectInput[];
107
+ locallyPendingCreatedBranches?: readonly LocallyPendingCreatedProjectBranch[];
108
+ }): StaleOuterProjectWorkspaceEntry[];
109
+ /**
110
+ * Durable worker-local ledger for desired project mounts and ordered deletion
111
+ * side effects. The caller must remove each managed path before including its
112
+ * tombstone in an outer-tree publication. Mirror refs may be acknowledged only
113
+ * after that publication is durably recorded.
114
+ */
115
+ export declare class ProjectWorkspaceStateStore {
116
+ readonly stateRoot: string;
117
+ readonly projectsRoot: string;
118
+ readonly statePath: string;
119
+ constructor(input: {
120
+ stateRoot: string;
121
+ projectsRoot: string;
122
+ });
123
+ read(): ProjectWorkspaceStateView;
124
+ discoverStaleOuterEntries(workspaceShadowRoot: string): StaleOuterProjectWorkspaceEntry[];
125
+ reconcile(input: {
126
+ desiredProjects: readonly ProjectWorkspaceDesiredProjectInput[];
127
+ locallyPendingCreatedBranches?: readonly LocallyPendingCreatedProjectBranch[];
128
+ }): ProjectWorkspaceStateView;
129
+ /** Persist the create intent before invoking Git so a crash cannot orphan an untracked worktree. */
130
+ recordPendingCreatedBranch(input: LocallyPendingCreatedProjectBranch): ProjectWorkspaceStateView;
131
+ /** Clear a create intent after an authoritative desired config contains it. */
132
+ clearPendingCreatedBranch(input: LocallyPendingCreatedProjectBranch): ProjectWorkspaceStateView;
133
+ /** Persist a branch tombstone before mutating its linked worktree or local ref. */
134
+ beginBranchDeletion(input: LocallyPendingCreatedProjectBranch): ProjectWorkspaceStateView;
135
+ recordTreePublication(input: {
136
+ tombstoneIds: readonly string[];
137
+ publishedHead: string;
138
+ }): ProjectWorkspaceStateView;
139
+ recordMirrorRefDeletion(input: {
140
+ tombstoneId: string;
141
+ branchName: string;
142
+ }): ProjectWorkspaceStateView;
143
+ }
144
+ export {};
@@ -0,0 +1,112 @@
1
+ export declare const PROJECT_WORKTREE_SNAPSHOT_PREFIX = "r5d-project-worktrees-";
2
+ export type GitHttpAuth = {
3
+ extraHeaderUrl: string;
4
+ header: string;
5
+ };
6
+ export type ProjectWorktreeBranch = {
7
+ branchName: string;
8
+ baseCommitHash: string;
9
+ sourceBranchName?: string | null;
10
+ };
11
+ export type ProjectWorktreeState = {
12
+ branchName: string;
13
+ branchPath: string;
14
+ head: string;
15
+ mirrorHead: string | null;
16
+ ahead: number | null;
17
+ behind: number | null;
18
+ };
19
+ export declare function projectWorktreeConfigurationFingerprint(input: {
20
+ checkoutPathSegments: readonly string[];
21
+ projectPath: string;
22
+ repoHttpUrl: string | null;
23
+ repoAuthHeader: string | null;
24
+ defaultBranch: string;
25
+ branches: readonly ProjectWorktreeBranch[];
26
+ gitIdentity: {
27
+ name: string;
28
+ email: string;
29
+ } | null;
30
+ }): string;
31
+ export declare function hasLinkedProjectWorktreeLayout(input: {
32
+ projectRoot: string;
33
+ primaryBranchName: string;
34
+ branches: readonly Pick<ProjectWorktreeBranch, "branchName">[];
35
+ }): boolean;
36
+ export declare function cleanupStaleProjectWorktreeSnapshots(input?: {
37
+ temporaryRoot?: string;
38
+ processAlive?: (processId: number) => boolean;
39
+ }): {
40
+ removed: string[];
41
+ failed: Array<{
42
+ path: string;
43
+ error: string;
44
+ }>;
45
+ };
46
+ export declare function ensureProjectWorktrees(input: {
47
+ projectRoot: string;
48
+ primaryBranchName: string;
49
+ branches: readonly ProjectWorktreeBranch[];
50
+ originUrl: string;
51
+ originAuth?: GitHttpAuth;
52
+ mirrorUrl: string;
53
+ mirrorAuth?: GitHttpAuth;
54
+ credentialHelper?: string | null;
55
+ gitIdentity?: {
56
+ name: string;
57
+ email: string;
58
+ } | null;
59
+ }): ProjectWorktreeState[];
60
+ export declare function projectWorktreeOperationInProgress(checkoutPath: string): boolean;
61
+ export declare function createLinkedProjectBranch(input: {
62
+ projectRoot: string;
63
+ sourceBranchName: string;
64
+ branchName: string;
65
+ }): {
66
+ branchPath: string;
67
+ baseCommitHash: string;
68
+ };
69
+ export declare function deleteLinkedProjectBranch(input: {
70
+ projectRoot: string;
71
+ primaryBranchName: string;
72
+ branchName: string;
73
+ }): {
74
+ branchName: string;
75
+ };
76
+ export declare function removeProjectWorktrees(input: {
77
+ projectRoot: string;
78
+ branchNames: readonly string[];
79
+ }): void;
80
+ export declare function deleteProjectMirrorBranch(input: {
81
+ gitDirectory: string;
82
+ branchName: string;
83
+ mirrorUrl: string;
84
+ mirrorAuth?: GitHttpAuth;
85
+ }): void;
86
+ export declare function pushProjectMirrorHeads(input: {
87
+ projectRoot: string;
88
+ branchNames: readonly string[];
89
+ mirrorUrl: string;
90
+ mirrorAuth?: GitHttpAuth;
91
+ onlyBranches?: ReadonlySet<string>;
92
+ }): Array<{
93
+ branchName: string;
94
+ head: string;
95
+ pushed: boolean;
96
+ reason?: string;
97
+ }>;
98
+ export declare function fastForwardProjectHeadsFromMirror(input: {
99
+ projectRoot: string;
100
+ primaryBranchName: string;
101
+ branchNames: readonly string[];
102
+ mirrorUrl: string;
103
+ mirrorAuth?: GitHttpAuth;
104
+ }): Array<{
105
+ branchName: string;
106
+ previousHead: string;
107
+ mirrorHead: string | null;
108
+ fastForwarded: boolean;
109
+ }>;
110
+ export declare const projectWorktreesTestHarness: {
111
+ commandArgs: (args: string[], auth?: GitHttpAuth) => string[];
112
+ };
@@ -0,0 +1,24 @@
1
+ export type WorkingTreeSourceMode = "all" | "git";
2
+ export type WorkingTreeDeletionMode = "all" | "git";
3
+ type TreeEntry = {
4
+ kind: "directory";
5
+ mode: number;
6
+ } | {
7
+ kind: "file";
8
+ mode: number;
9
+ size: number;
10
+ } | {
11
+ kind: "symlink";
12
+ mode: number;
13
+ target: string;
14
+ };
15
+ export declare function inspectWorkingTree(root: string, mode: WorkingTreeSourceMode): Map<string, TreeEntry>;
16
+ export declare function mirrorWorkingTree(input: {
17
+ sourceRoot: string;
18
+ targetRoot: string;
19
+ sourceMode: WorkingTreeSourceMode;
20
+ deletionMode: WorkingTreeDeletionMode;
21
+ }): {
22
+ paths: string[];
23
+ };
24
+ export {};
@@ -0,0 +1,97 @@
1
+ import { type WorkingTreeSourceMode } from "./working-tree-mirror";
2
+ import type { GitHttpAuth } from "./project-worktrees";
3
+ export declare const WORKSPACE_GIT_BRANCH = "main";
4
+ export declare const MAX_WORKSPACE_GIT_DIFF_BYTES: number;
5
+ export declare const WORKSPACE_GIT_CONFIRMED_LARGE_DIFF_PUSH_OPTION = "r5d-confirm-large-diff-v1";
6
+ export type WorkspaceGitMount = {
7
+ id: string;
8
+ sourcePath: string;
9
+ workspaceRelativePath: string;
10
+ sourceMode: WorkingTreeSourceMode;
11
+ hydrateDeletionMode: "all" | "git";
12
+ /** Remove the outer-workspace subtree when the mounted source was intentionally deleted. */
13
+ deleteWhenSourceMissing?: boolean;
14
+ busy?: () => boolean;
15
+ };
16
+ export type WorkspaceGitSyncOutcome = "no_change" | "updated" | "pushed" | "large_diff_blocked" | "conflict_blocked";
17
+ export type WorkspaceGitSyncResult = {
18
+ outcome: WorkspaceGitSyncOutcome;
19
+ startingHead: string | null;
20
+ /** The worker-local commit, including an unpublished blocked commit. */
21
+ localHead: string | null;
22
+ remoteHead: string | null;
23
+ publishedHead: string | null;
24
+ rebaseCount: number;
25
+ diffSizeBytes: number;
26
+ affectedPaths: string[];
27
+ activeMountIds: string[];
28
+ skippedMountIds: string[];
29
+ conflictPaths?: string[];
30
+ conflictSnapshotRefs?: {
31
+ local: string;
32
+ remote: string;
33
+ };
34
+ error?: string;
35
+ };
36
+ export declare function ensureWorkspaceGitClone(input: {
37
+ workspacePath: string;
38
+ remoteUrl: string;
39
+ remoteAuth?: GitHttpAuth;
40
+ credentialHelper?: string | null;
41
+ gitIdentity: {
42
+ name: string;
43
+ email: string;
44
+ };
45
+ }): {
46
+ localHead: string | null;
47
+ remoteHead: string | null;
48
+ };
49
+ declare function mirrorMountsToWorkspace(workspacePath: string, mounts: readonly WorkspaceGitMount[]): void;
50
+ export declare function hydrateWorkspaceGitMounts(workspacePath: string, mounts: readonly WorkspaceGitMount[]): void;
51
+ export declare function resetWorkspaceGit(input: {
52
+ workspacePath: string;
53
+ remoteUrl: string;
54
+ remoteAuth?: GitHttpAuth;
55
+ credentialHelper?: string | null;
56
+ gitIdentity: {
57
+ name: string;
58
+ email: string;
59
+ };
60
+ mounts: readonly WorkspaceGitMount[];
61
+ }): {
62
+ startingHead: string | null;
63
+ localHead: string | null;
64
+ remoteHead: string | null;
65
+ discardedPaths: string[];
66
+ };
67
+ export declare function synchronizeWorkspaceGit(input: {
68
+ attemptId?: string;
69
+ workerLabel: string;
70
+ workspacePath: string;
71
+ remoteUrl: string;
72
+ remoteAuth?: GitHttpAuth;
73
+ credentialHelper?: string | null;
74
+ gitIdentity: {
75
+ name: string;
76
+ email: string;
77
+ };
78
+ mounts: readonly WorkspaceGitMount[];
79
+ commitDetail?: string;
80
+ allowLargeDiff?: boolean;
81
+ maxDiffBytes?: number;
82
+ maxPushAttempts?: number;
83
+ /** Publish edits already made in the outer clone without first projecting visible mounts over them. */
84
+ skipMountMirror?: boolean;
85
+ /** Leave visible mounts untouched after publication (used by remediation commands in the outer clone). */
86
+ skipMountHydration?: boolean;
87
+ afterWorkspacePublished?: (context: {
88
+ publishedHead: string;
89
+ activeMountIds: string[];
90
+ }) => void | Promise<void>;
91
+ }): Promise<WorkspaceGitSyncResult>;
92
+ export declare const workspaceGitSyncTestHarness: {
93
+ commandArgs: (args: string[], auth?: GitHttpAuth) => string[];
94
+ mirrorMountsToWorkspace: typeof mirrorMountsToWorkspace;
95
+ hydrateMountsFromWorkspace: typeof hydrateWorkspaceGitMounts;
96
+ };
97
+ export {};
@@ -2,21 +2,4 @@ export type WorkspaceIncidentUpdate = {
2
2
  incidentId: string | null;
3
3
  status: "remediating" | "waiting_for_worker" | "resolved" | "confirmed" | "reset" | null;
4
4
  };
5
- /**
6
- * WebSocket writes are ordered, but independent server handlers can decide an
7
- * incident state under the user lock and write their messages after releasing
8
- * it. Remember terminal incident IDs so a delayed publication response cannot
9
- * resurrect a barrier that this connection has already observed as terminal.
10
- */
11
- export declare class WorkspaceIncidentOrderingFence {
12
- private readonly historyLimit;
13
- private readonly terminalIncidentIds;
14
- private readonly terminalIncidentOrder;
15
- constructor(historyLimit?: number);
16
- observe(update: WorkspaceIncidentUpdate): void;
17
- permitsBlockedResponse(incidentId: string | null | undefined): boolean;
18
- }
19
5
  export declare function applyWorkspaceIncidentUpdate(currentIncidentId: string | null, update: WorkspaceIncidentUpdate): string | null;
20
- export declare function releasePendingWorkspaceHead(previousIncidentId: string | null, currentIncidentId: string | null, terminalIncidentId?: string | null): {
21
- fetchAuthoritativeHead: boolean;
22
- };
@@ -1,12 +1,12 @@
1
1
  export type WorkspaceMutationLease = () => void;
2
2
  /**
3
- * Coordinates the visible workspace with its disposable sync shadow.
3
+ * Coordinates project worktrees with the outer workspace Git clone.
4
4
  *
5
5
  * Ordinary worktree activity may overlap other ordinary activity, but a sync
6
6
  * gets exclusive access. Once a sync is queued, later mutations wait behind it
7
7
  * so a queued sync cannot be starved by later short mutations. Long-running
8
- * visible-checkout commands do not enter this gate; canonical remediation
9
- * commands do because they operate on the sync checkout itself.
8
+ * long-running project commands do not enter this gate; outer-workspace
9
+ * remediation commands do because they operate on the sync clone itself.
10
10
  */
11
11
  export declare class WorkspaceMutationGate {
12
12
  private activeMutations;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.74",
3
+ "version": "0.0.76",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",