@ricsam/r5d-worker 0.0.82 → 0.0.86

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.
@@ -21,6 +21,23 @@ export type PendingCreatedBranchAutomaticSyncDeferral = {
21
21
  export declare function pendingCreatedBranchKey(projectId: string, branchName: string): string;
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
+ /**
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;
24
41
  /**
25
42
  * A workspace sync is global and synchronous enough to monopolize the worker
26
43
  * event loop. Keep automatic intent pending while an agent process is active
@@ -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;
@@ -53,8 +61,13 @@ export type WorkspaceGitSyncResult = {
53
61
  remote: string;
54
62
  };
55
63
  conflictKind?: "integration_rebase" | "projection_merge";
64
+ verifiedAncestorHeads?: string[];
56
65
  error?: string;
57
66
  };
67
+ /** A guarded remediation was rejected before it was allowed to hydrate or publish. */
68
+ export declare class WorkspaceRemediationAncestryError extends Error {
69
+ constructor(message: string);
70
+ }
58
71
  declare function gitCommandArgs(args: string[]): string[];
59
72
  declare function workspaceCloneCommandArgs(args: string[], remoteUrl: string, credentialHelper?: string | null, credentialUsername?: string | null): string[];
60
73
  export declare function workspaceGitHydrationIsCurrent(workspacePath: string, mounts?: readonly WorkspaceGitMount[]): boolean;
@@ -68,6 +81,22 @@ declare function configureWorkspaceRepository(input: {
68
81
  email: string;
69
82
  };
70
83
  }): void;
84
+ /**
85
+ * Rebind only the existing canonical checkout's local Git configuration while
86
+ * an incident owns its HEAD. In particular, this deliberately does not fetch,
87
+ * recover durability, move refs, reset the index/worktree, or inspect/abort an
88
+ * in-progress merge or rebase.
89
+ */
90
+ export declare function configureExistingWorkspaceGitForRemediation(input: {
91
+ workspacePath: string;
92
+ remoteUrl: string;
93
+ credentialHelper?: string | null;
94
+ credentialUsername?: string | null;
95
+ gitIdentity: {
96
+ name: string;
97
+ email: string;
98
+ };
99
+ }): void;
71
100
  export declare function ensureWorkspaceGitClone(input: {
72
101
  workspacePath: string;
73
102
  remoteUrl: string;
@@ -113,6 +142,7 @@ export declare function resetWorkspaceGit(input: {
113
142
  activeMountIds: string[];
114
143
  skippedMountIds: string[];
115
144
  };
145
+ declare function diffSizeBytes(workspacePath: string, baseRevision: string | null, headRevision: string, limit: number): Promise<number>;
116
146
  export declare function synchronizeWorkspaceGit(input: {
117
147
  attemptId?: string;
118
148
  workerLabel: string;
@@ -131,6 +161,12 @@ export declare function synchronizeWorkspaceGit(input: {
131
161
  maxPushAttempts?: number;
132
162
  /** Publish edits already made in the outer clone without first projecting visible mounts over them. */
133
163
  skipMountMirror?: boolean;
164
+ /** Positive ancestry proof required before a remediation may integrate, publish, or hydrate. */
165
+ requiredAncestorHeads?: readonly string[];
166
+ /** Revalidate the worker/config/incident generation after every async boundary. */
167
+ assertStillAdmitted?: () => void;
168
+ /** Test seam for exercising an incident transition during asynchronous diff measurement. */
169
+ measureDiffSize?: typeof diffSizeBytes;
134
170
  afterWorkspacePublished?: (context: {
135
171
  publishedHead: string;
136
172
  activeMountIds: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.82",
3
+ "version": "0.0.86",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",