@ricsam/r5d-worker 0.0.55 → 0.0.56
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/README.md +2 -2
- package/dist/cjs/main.cjs +21 -11
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/workspace-command-sync-policy.cjs +40 -0
- package/dist/cjs/workspace-sync.cjs +741 -64
- package/dist/mjs/main.mjs +21 -11
- package/dist/mjs/package.json +1 -1
- package/dist/mjs/workspace-command-sync-policy.mjs +14 -0
- package/dist/mjs/workspace-sync.mjs +741 -64
- package/dist/types/workspace-command-sync-policy.d.ts +19 -0
- package/dist/types/workspace-mutation-gate.d.ts +3 -1
- package/dist/types/workspace-sync.d.ts +12 -1
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type WorkspaceCommandTarget = {
|
|
2
|
+
type: "project";
|
|
3
|
+
} | {
|
|
4
|
+
type: "workspace";
|
|
5
|
+
rootProfile: "visible_projects" | "canonical_sync";
|
|
6
|
+
};
|
|
7
|
+
type WorkspaceCommandMutationCoordinator = {
|
|
8
|
+
runMutation<T>(operation: () => Promise<T> | T): Promise<T>;
|
|
9
|
+
acquireMutation(): Promise<() => void>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Commands in visible checkouts behave like independent Git clients and may
|
|
13
|
+
* overlap periodic synchronization. Canonical remediation commands mutate the
|
|
14
|
+
* sync checkout itself, so they must remain serialized with synchronization.
|
|
15
|
+
*/
|
|
16
|
+
export declare function shouldSerializeWorkspaceCommand(target: WorkspaceCommandTarget): boolean;
|
|
17
|
+
export declare function runWorkspaceCommand<T>(target: WorkspaceCommandTarget, coordinator: WorkspaceCommandMutationCoordinator, operation: () => Promise<T> | T): Promise<T>;
|
|
18
|
+
export declare function acquireWorkspaceCommandMutation(target: WorkspaceCommandTarget, coordinator: WorkspaceCommandMutationCoordinator): Promise<(() => void) | undefined>;
|
|
19
|
+
export {};
|
|
@@ -4,7 +4,9 @@ export type WorkspaceMutationLease = () => void;
|
|
|
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
|
-
* so a
|
|
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
10
|
*/
|
|
9
11
|
export declare class WorkspaceMutationGate {
|
|
10
12
|
private activeMutations;
|
|
@@ -93,13 +93,24 @@ type GitlinkEntry = {
|
|
|
93
93
|
filePath: string;
|
|
94
94
|
objectId: string;
|
|
95
95
|
};
|
|
96
|
+
type VisibleHydrationEntry = {
|
|
97
|
+
kind: "blob";
|
|
98
|
+
mode: "100644" | "100755" | "120000";
|
|
99
|
+
objectId: string;
|
|
100
|
+
} | {
|
|
101
|
+
kind: "gitlink";
|
|
102
|
+
objectId: string;
|
|
103
|
+
};
|
|
104
|
+
type VisibleHydrationPreimage = Map<string, VisibleHydrationEntry>;
|
|
105
|
+
type VisibleHydrationPreimages = Map<string, VisibleHydrationPreimage | null>;
|
|
96
106
|
type GitlinkProjection = {
|
|
97
107
|
entries: GitlinkEntry[];
|
|
98
108
|
opaqueRoots: string[];
|
|
109
|
+
visiblePreimages?: VisibleHydrationPreimages;
|
|
99
110
|
};
|
|
100
111
|
export declare function assertCanonicalCheckoutIndexMatchesWorktree(checkoutPath: string): void;
|
|
101
112
|
export declare function mirrorVisibleWorkspaceToShadow(input: WorkspaceSyncInput, excludedCheckouts?: ReadonlySet<string>): GitlinkProjection;
|
|
102
|
-
export declare function mirrorShadowWorkspaceToVisible(input: WorkspaceSyncInput, opaqueWorkspaceRoots?: readonly string[]): void;
|
|
113
|
+
export declare function mirrorShadowWorkspaceToVisible(input: WorkspaceSyncInput, opaqueWorkspaceRoots?: readonly string[], hydrationPreimages?: VisibleHydrationPreimages): void;
|
|
103
114
|
export declare function assertWorkspaceQuarantineRef(quarantineRef: string): void;
|
|
104
115
|
export declare function synchronizeWorkspace(rawInput: WorkspaceSyncInput): Promise<WorkspaceSyncResult>;
|
|
105
116
|
export declare function calculateWorkspaceDiffFingerprint(rawInput: WorkspaceSyncInput): string;
|