@ricsam/r5d-worker 0.0.83 → 0.0.87
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/cjs/main.cjs +180 -106
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/project-worktrees.cjs +183 -104
- package/dist/cjs/workspace-automatic-sync-policy.cjs +12 -2
- package/dist/cjs/workspace-command-sync-policy.cjs +21 -0
- package/dist/cjs/workspace-git-sync.cjs +501 -191
- package/dist/mjs/main.mjs +185 -107
- package/dist/mjs/package.json +1 -1
- package/dist/mjs/project-worktrees.mjs +183 -104
- package/dist/mjs/workspace-automatic-sync-policy.mjs +9 -1
- package/dist/mjs/workspace-command-sync-policy.mjs +20 -0
- package/dist/mjs/workspace-git-sync.mjs +500 -191
- package/dist/types/main.d.ts +19 -2
- package/dist/types/project-worktrees.d.ts +12 -12
- package/dist/types/workspace-automatic-sync-policy.d.ts +24 -4
- package/dist/types/workspace-command-sync-policy.d.ts +7 -0
- package/dist/types/workspace-git-sync.d.ts +17 -9
- package/package.json +1 -1
package/dist/types/main.d.ts
CHANGED
|
@@ -91,6 +91,7 @@ type WorkerServerMessage = {
|
|
|
91
91
|
gitIdentity: WorkerGitIdentity;
|
|
92
92
|
githubCredential: WorkerGitHubCredential | null;
|
|
93
93
|
deferWorkspaceSyncForIncidentId?: string;
|
|
94
|
+
resetToCanonical?: boolean;
|
|
94
95
|
} | {
|
|
95
96
|
type: "sync_workspace";
|
|
96
97
|
requestId: string;
|
|
@@ -565,8 +566,20 @@ type DeferredWorkspaceConfiguration = {
|
|
|
565
566
|
};
|
|
566
567
|
declare function workspaceIncidentTerminalClearDisposition(input: {
|
|
567
568
|
deferredConfiguration: DeferredWorkspaceConfiguration | null;
|
|
568
|
-
clearedIncidentId: string
|
|
569
|
-
}): "
|
|
569
|
+
clearedIncidentId: string;
|
|
570
|
+
}): "await_server_refresh" | "reconnect_for_refresh";
|
|
571
|
+
declare function workspaceIncidentTerminalRefreshFence(input: {
|
|
572
|
+
deferredConfiguration: DeferredWorkspaceConfiguration | null;
|
|
573
|
+
clearedIncidentId: string;
|
|
574
|
+
}): {
|
|
575
|
+
disposition: "await_server_refresh" | "reconnect_for_refresh";
|
|
576
|
+
deferredConfiguration: DeferredWorkspaceConfiguration;
|
|
577
|
+
};
|
|
578
|
+
declare function workspaceAutomaticSyncIsAdmitted(input: {
|
|
579
|
+
workspaceConfigured: boolean;
|
|
580
|
+
activeIncidentId: string | null;
|
|
581
|
+
deferredConfiguration: DeferredWorkspaceConfiguration | null;
|
|
582
|
+
}): boolean;
|
|
570
583
|
declare function deferredWorkspaceTargetIsAllowed(deferredConfiguration: DeferredWorkspaceConfiguration | null, activeIncidentId: string | null, target: WorkerSessionTarget): boolean;
|
|
571
584
|
declare function deferredWorkspaceSyncTriggerIsAllowed(deferredConfiguration: DeferredWorkspaceConfiguration | null, activeIncidentId: string | null, trigger: WorkspaceSyncTrigger): boolean;
|
|
572
585
|
declare function workspaceOperationsAreFenced(deferredConfiguration: DeferredWorkspaceConfiguration | null, activeIncidentId: string | null): boolean;
|
|
@@ -577,6 +590,7 @@ declare function deferredCredentialTransitionMustWait(input: {
|
|
|
577
590
|
canonicalRemediationActive: boolean;
|
|
578
591
|
}): boolean;
|
|
579
592
|
declare function workspaceConfigurationIncidentSnapshotIsCurrent(capturedIncidentId: string | null, activeIncidentId: string | null): boolean;
|
|
593
|
+
declare function workspaceConfigurationResetToCanonicalIsAllowed(requested: boolean | undefined, incidentId: string | null): boolean;
|
|
580
594
|
declare function deferredWorkspaceRefreshWatchdogIsCurrent(input: {
|
|
581
595
|
capturedIncidentId: string;
|
|
582
596
|
deferredConfiguration: DeferredWorkspaceConfiguration | null;
|
|
@@ -629,12 +643,15 @@ export declare const workerGitSecurityTestHarness: {
|
|
|
629
643
|
fenceUnsafeWorkspaceSyncFailure: typeof fenceUnsafeWorkspaceSyncFailure;
|
|
630
644
|
workspaceConfigurationIncidentDeferral: typeof workspaceConfigurationIncidentDeferral;
|
|
631
645
|
workspaceIncidentTerminalClearDisposition: typeof workspaceIncidentTerminalClearDisposition;
|
|
646
|
+
workspaceIncidentTerminalRefreshFence: typeof workspaceIncidentTerminalRefreshFence;
|
|
647
|
+
workspaceAutomaticSyncIsAdmitted: typeof workspaceAutomaticSyncIsAdmitted;
|
|
632
648
|
deferredWorkspaceTargetIsAllowed: typeof deferredWorkspaceTargetIsAllowed;
|
|
633
649
|
deferredWorkspaceSyncTriggerIsAllowed: typeof deferredWorkspaceSyncTriggerIsAllowed;
|
|
634
650
|
workspaceOperationsAreFenced: typeof workspaceOperationsAreFenced;
|
|
635
651
|
workspaceCommandTransportIsAllowed: typeof workspaceCommandTransportIsAllowed;
|
|
636
652
|
deferredCredentialTransitionMustWait: typeof deferredCredentialTransitionMustWait;
|
|
637
653
|
workspaceConfigurationIncidentSnapshotIsCurrent: typeof workspaceConfigurationIncidentSnapshotIsCurrent;
|
|
654
|
+
workspaceConfigurationResetToCanonicalIsAllowed: typeof workspaceConfigurationResetToCanonicalIsAllowed;
|
|
638
655
|
deferredWorkspaceRefreshWatchdogIsCurrent: typeof deferredWorkspaceRefreshWatchdogIsCurrent;
|
|
639
656
|
incidentDeferredProjectCheckouts: typeof incidentDeferredProjectCheckouts;
|
|
640
657
|
deferredIncidentWorkspaceConfigurationResult: typeof deferredIncidentWorkspaceConfigurationResult;
|
|
@@ -93,7 +93,7 @@ declare function configureRepository(input: {
|
|
|
93
93
|
name: string;
|
|
94
94
|
email: string;
|
|
95
95
|
} | null;
|
|
96
|
-
}): void
|
|
96
|
+
}): Promise<void>;
|
|
97
97
|
export declare function ensureProjectWorktrees(input: {
|
|
98
98
|
projectRoot: string;
|
|
99
99
|
primaryBranchName: string;
|
|
@@ -110,7 +110,7 @@ export declare function ensureProjectWorktrees(input: {
|
|
|
110
110
|
} | null;
|
|
111
111
|
exactMirrorBranches?: ReadonlySet<string>;
|
|
112
112
|
snapshotRoot?: string;
|
|
113
|
-
}): ProjectWorktreeState[]
|
|
113
|
+
}): Promise<ProjectWorktreeState[]>;
|
|
114
114
|
export declare function projectWorktreeOperationInProgress(checkoutPath: string): boolean;
|
|
115
115
|
export declare function createLinkedProjectBranch(input: {
|
|
116
116
|
projectRoot: string;
|
|
@@ -153,7 +153,7 @@ export declare function deleteProjectMirrorBranch(input: {
|
|
|
153
153
|
mirrorUrl: string;
|
|
154
154
|
credentialHelper?: string | null;
|
|
155
155
|
credentialUsername?: string | null;
|
|
156
|
-
}): void
|
|
156
|
+
}): Promise<void>;
|
|
157
157
|
export declare function pushProjectMirrorHeads(input: {
|
|
158
158
|
projectRoot: string;
|
|
159
159
|
branchNames: readonly string[];
|
|
@@ -163,12 +163,12 @@ export declare function pushProjectMirrorHeads(input: {
|
|
|
163
163
|
onlyBranches?: ReadonlySet<string>;
|
|
164
164
|
/** Exact pre-projection commits to publish after the outer tree is reachable. */
|
|
165
165
|
publicationHeads?: ReadonlyMap<string, string>;
|
|
166
|
-
}): Array<{
|
|
166
|
+
}): Promise<Array<{
|
|
167
167
|
branchName: string;
|
|
168
168
|
head: string;
|
|
169
169
|
pushed: boolean;
|
|
170
170
|
reason?: string;
|
|
171
|
-
}
|
|
171
|
+
}>>;
|
|
172
172
|
export declare function assertProjectMirrorHeadsPushed(results: readonly {
|
|
173
173
|
branchName: string;
|
|
174
174
|
pushed: boolean;
|
|
@@ -198,7 +198,7 @@ export type ProjectMirrorHeadObservation = {
|
|
|
198
198
|
*/
|
|
199
199
|
export declare function observeProjectMirrorHeads(input: Omit<ProjectMirrorHeadUpdateInput, "branchMutationAllowed"> & {
|
|
200
200
|
allowNonFastForward: boolean;
|
|
201
|
-
}): ProjectMirrorHeadObservation[]
|
|
201
|
+
}): Promise<ProjectMirrorHeadObservation[]>;
|
|
202
202
|
/** Apply only previously observed object ids; this function never refetches. */
|
|
203
203
|
export declare function applyObservedProjectMirrorHeads(input: {
|
|
204
204
|
projectRoot: string;
|
|
@@ -206,24 +206,24 @@ export declare function applyObservedProjectMirrorHeads(input: {
|
|
|
206
206
|
observations: readonly ProjectMirrorHeadObservation[];
|
|
207
207
|
/** Rechecked immediately before refs or the index move. */
|
|
208
208
|
branchMutationAllowed?: (branchName: string, checkoutPath: string) => boolean;
|
|
209
|
-
}): Array<{
|
|
209
|
+
}): Promise<Array<{
|
|
210
210
|
branchName: string;
|
|
211
211
|
previousHead: string;
|
|
212
212
|
mirrorHead: string | null;
|
|
213
213
|
moved: boolean;
|
|
214
|
-
}
|
|
215
|
-
export declare function fastForwardProjectHeadsFromMirror(input: ProjectMirrorHeadUpdateInput): Array<{
|
|
214
|
+
}>>;
|
|
215
|
+
export declare function fastForwardProjectHeadsFromMirror(input: ProjectMirrorHeadUpdateInput): Promise<Array<{
|
|
216
216
|
branchName: string;
|
|
217
217
|
previousHead: string;
|
|
218
218
|
mirrorHead: string | null;
|
|
219
219
|
fastForwarded: boolean;
|
|
220
|
-
}
|
|
221
|
-
export declare function reseedProjectHeadsFromMirror(input: ProjectMirrorHeadUpdateInput): Array<{
|
|
220
|
+
}>>;
|
|
221
|
+
export declare function reseedProjectHeadsFromMirror(input: ProjectMirrorHeadUpdateInput): Promise<Array<{
|
|
222
222
|
branchName: string;
|
|
223
223
|
previousHead: string;
|
|
224
224
|
mirrorHead: string | null;
|
|
225
225
|
reseeded: boolean;
|
|
226
|
-
}
|
|
226
|
+
}>>;
|
|
227
227
|
export declare const projectWorktreesTestHarness: {
|
|
228
228
|
commandArgs: typeof gitCommandArgs;
|
|
229
229
|
configureRepository: typeof configureRepository;
|
|
@@ -22,10 +22,30 @@ export declare function pendingCreatedBranchKey(projectId: string, branchName: s
|
|
|
22
22
|
export declare function hasActiveVisibleProjectsWorkspaceTarget(activeTargets: Iterable<ProjectTarget | WorkspaceTarget>): boolean;
|
|
23
23
|
export declare function projectBranchHasActiveWorkspaceTarget(projectId: string, branchName: string, activeTargets: Iterable<ProjectTarget | WorkspaceTarget>): boolean;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* Activity fence evaluated from inside the workspace mutation gate's exclusive
|
|
26
|
+
* sync lease. Canonical-sync targets are deliberately absent: an immediately
|
|
27
|
+
* reserved follow-up remediation command may already be queued, but the gate
|
|
28
|
+
* proves that it cannot overlap this sync. A credential-bearing process group
|
|
29
|
+
* that survived command teardown is tracked separately and still fails closed.
|
|
30
|
+
*/
|
|
31
|
+
export declare function projectBranchMountBusyDuringExclusiveSync(input: {
|
|
32
|
+
projectId: string;
|
|
33
|
+
branchName: string;
|
|
34
|
+
executionDisabled: boolean;
|
|
35
|
+
worktreeOperationInProgress: boolean;
|
|
36
|
+
retainedCanonicalProcessGroup: boolean;
|
|
37
|
+
activeTargets: Iterable<ProjectTarget | WorkspaceTarget>;
|
|
38
|
+
}): boolean;
|
|
39
|
+
/** Fence visible activity and any retained canonical descendant that outlived its command lease. */
|
|
40
|
+
export declare function workspacePlansMountBusyDuringExclusiveSync(activeTargets: Iterable<ProjectTarget | WorkspaceTarget>, retainedCanonicalProcessGroup?: boolean): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Keep automatic intent pending while an agent process is active on a
|
|
43
|
+
* creator-local branch: the branch's mount would be skipped as busy anyway,
|
|
44
|
+
* and the cycle's subprocess and disk work would only compete with that
|
|
45
|
+
* process's next command. Its terminal trigger (or a later periodic/connect
|
|
46
|
+
* cycle) publishes afterward. (The sync cycle itself now yields the event
|
|
47
|
+
* loop while it runs; this deferral is about not starting pointless work,
|
|
48
|
+
* not about loop starvation.)
|
|
29
49
|
*/
|
|
30
50
|
export declare function shouldDeferAutomaticWorkspaceSyncForPendingBranch(pendingCreatedBranches: readonly PendingCreatedBranch[], activeTargets: Iterable<ProjectTarget | WorkspaceTarget>): boolean;
|
|
31
51
|
/**
|
|
@@ -25,5 +25,12 @@ export declare function reserveWorkspaceCommandAfterCurrentSync(target: Workspac
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function shouldSerializeWorkspaceCommand(target: WorkspaceCommandTarget): boolean;
|
|
27
27
|
export declare function runWorkspaceCommand<T>(target: WorkspaceCommandTarget, coordinator: WorkspaceCommandMutationCoordinator, operation: () => Promise<T> | T): Promise<T>;
|
|
28
|
+
/**
|
|
29
|
+
* Run a command whose target was reserved before asynchronous preparation.
|
|
30
|
+
* For a serialized canonical command, the reservation must disappear inside
|
|
31
|
+
* the mutation operation: removing it after `runMutation` resolves is too
|
|
32
|
+
* late because releasing the lease can synchronously wake a queued sync.
|
|
33
|
+
*/
|
|
34
|
+
export declare function runReservedWorkspaceCommand<T>(target: WorkspaceCommandTarget, coordinator: WorkspaceCommandMutationCoordinator, operation: () => Promise<T> | T, releaseReservation: () => void): Promise<T>;
|
|
28
35
|
export declare function acquireWorkspaceCommandMutation(target: WorkspaceCommandTarget, coordinator: WorkspaceCommandMutationCoordinator): Promise<(() => void) | undefined>;
|
|
29
36
|
export {};
|
|
@@ -34,6 +34,14 @@ export type WorkspaceGitMount = {
|
|
|
34
34
|
/** Activity-only fence used before checkout readiness is established on reconnect. */
|
|
35
35
|
busyForRecovery?: () => boolean;
|
|
36
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Incident-bound configuration keeps project checkouts unready while the
|
|
39
|
+
* canonical remediation owns the workspace. The guarded remediation sync is
|
|
40
|
+
* nevertheless allowed to hydrate an existing checkout when its activity-only
|
|
41
|
+
* fence is clear; the ordinary `busy` predicate would mistake that deliberate
|
|
42
|
+
* unready state for concurrent visible work.
|
|
43
|
+
*/
|
|
44
|
+
export declare function workspaceGitMountsForRemediation(mounts: readonly WorkspaceGitMount[]): WorkspaceGitMount[];
|
|
37
45
|
export type WorkspaceGitSyncOutcome = "no_change" | "updated" | "pushed" | "large_diff_blocked" | "conflict_blocked";
|
|
38
46
|
export type WorkspaceGitSyncResult = {
|
|
39
47
|
outcome: WorkspaceGitSyncOutcome;
|
|
@@ -72,7 +80,7 @@ declare function configureWorkspaceRepository(input: {
|
|
|
72
80
|
name: string;
|
|
73
81
|
email: string;
|
|
74
82
|
};
|
|
75
|
-
}): void
|
|
83
|
+
}): Promise<void>;
|
|
76
84
|
/**
|
|
77
85
|
* Rebind only the existing canonical checkout's local Git configuration while
|
|
78
86
|
* an incident owns its HEAD. In particular, this deliberately does not fetch,
|
|
@@ -88,7 +96,7 @@ export declare function configureExistingWorkspaceGitForRemediation(input: {
|
|
|
88
96
|
name: string;
|
|
89
97
|
email: string;
|
|
90
98
|
};
|
|
91
|
-
}): void
|
|
99
|
+
}): Promise<void>;
|
|
92
100
|
export declare function ensureWorkspaceGitClone(input: {
|
|
93
101
|
workspacePath: string;
|
|
94
102
|
remoteUrl: string;
|
|
@@ -99,23 +107,23 @@ export declare function ensureWorkspaceGitClone(input: {
|
|
|
99
107
|
email: string;
|
|
100
108
|
};
|
|
101
109
|
preserveResolutionInProgress?: boolean;
|
|
102
|
-
}): {
|
|
110
|
+
}): Promise<{
|
|
103
111
|
localHead: string | null;
|
|
104
112
|
remoteHead: string | null;
|
|
105
|
-
}
|
|
113
|
+
}>;
|
|
106
114
|
declare function mirrorMountsToWorkspace(workspacePath: string, mounts: readonly WorkspaceGitMount[]): void;
|
|
107
115
|
export declare function hydrateWorkspaceGitMounts(workspacePath: string, mounts: readonly WorkspaceGitMount[], options?: {
|
|
108
116
|
ignoreBusy?: boolean;
|
|
109
|
-
}): {
|
|
117
|
+
}): Promise<{
|
|
110
118
|
hydratedMountIds: string[];
|
|
111
119
|
skippedMountIds: string[];
|
|
112
|
-
}
|
|
120
|
+
}>;
|
|
113
121
|
export declare function recoverWorkspaceGitHydration(workspacePath: string, mounts: readonly WorkspaceGitMount[], options?: {
|
|
114
122
|
ignoreBusy?: boolean;
|
|
115
123
|
deferMountIds?: ReadonlySet<string>;
|
|
116
124
|
preserveResolutionInProgress?: boolean;
|
|
117
125
|
preserveStaleBases?: boolean;
|
|
118
|
-
}): void
|
|
126
|
+
}): Promise<void>;
|
|
119
127
|
export declare function resetWorkspaceGit(input: {
|
|
120
128
|
workspacePath: string;
|
|
121
129
|
remoteUrl: string;
|
|
@@ -126,14 +134,14 @@ export declare function resetWorkspaceGit(input: {
|
|
|
126
134
|
email: string;
|
|
127
135
|
};
|
|
128
136
|
mounts: readonly WorkspaceGitMount[];
|
|
129
|
-
}): {
|
|
137
|
+
}): Promise<{
|
|
130
138
|
startingHead: string | null;
|
|
131
139
|
localHead: string | null;
|
|
132
140
|
remoteHead: string | null;
|
|
133
141
|
discardedPaths: string[];
|
|
134
142
|
activeMountIds: string[];
|
|
135
143
|
skippedMountIds: string[];
|
|
136
|
-
}
|
|
144
|
+
}>;
|
|
137
145
|
declare function diffSizeBytes(workspacePath: string, baseRevision: string | null, headRevision: string, limit: number): Promise<number>;
|
|
138
146
|
export declare function synchronizeWorkspaceGit(input: {
|
|
139
147
|
attemptId?: string;
|