@ricsam/r5d-worker 0.0.81 → 0.0.83

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.
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  import { Database } from "bun:sqlite";
3
+ import type { WorkerGitIdentity } from "./git-identity";
3
4
  import { configureGitHubRegistryAuthFiles, type PreparedPrivateAuthFileGeneration } from "./registry-auth";
4
5
  type WorkerProjectConfig = {
5
6
  projectId: string;
@@ -22,6 +23,53 @@ type WorkerProjectConfig = {
22
23
  baseCommitHash: string;
23
24
  }>;
24
25
  };
26
+ type WorkspaceSyncTrigger = {
27
+ type: "connect" | "inbound_head" | "write" | "edit" | "shell_inline" | "process_terminal" | "process_cancel" | "periodic" | "manual" | "remediation" | "remediation_confirm" | "remediation_reset";
28
+ sessionId?: string;
29
+ processRunId?: string;
30
+ toolCallId?: string;
31
+ projectId?: string;
32
+ branchName?: string;
33
+ detail?: string;
34
+ };
35
+ type WorkspaceSyncResult = {
36
+ type: "workspace_sync";
37
+ attemptId: string;
38
+ workerLabel: string;
39
+ trigger: WorkspaceSyncTrigger;
40
+ outcome: "no_change" | "published" | "updated" | "conflict_reset" | "large_diff_blocked" | "conflict_blocked" | "reset" | "failed";
41
+ startingHead: string | null;
42
+ localHead?: string;
43
+ publishedHead?: string;
44
+ rebaseCount: number;
45
+ diffSizeBytes: number;
46
+ gitStatus: string;
47
+ affectedProjects: string[];
48
+ affectedPaths: string[];
49
+ activeMountIds?: string[];
50
+ skippedMountIds?: string[];
51
+ activeProjectBranchPublications?: Array<{
52
+ branchId: string;
53
+ projectId: string;
54
+ branchName: string;
55
+ }>;
56
+ discardedPaths: string[];
57
+ localChangesDiscarded: boolean;
58
+ conflictPaths?: string[];
59
+ conflictSnapshotRefs?: {
60
+ local: string;
61
+ remote: string;
62
+ };
63
+ conflictKind?: "integration_rebase" | "projection_merge";
64
+ verifiedAncestorHeads?: string[];
65
+ telemetry?: {
66
+ totalMs: number;
67
+ queueMs: number;
68
+ prepareMs: number;
69
+ synchronizeMs: number;
70
+ };
71
+ error?: string;
72
+ };
25
73
  export type WorkerSessionTarget = {
26
74
  type: "project";
27
75
  projectId: string;
@@ -31,6 +79,207 @@ export type WorkerSessionTarget = {
31
79
  ownerUserId: string;
32
80
  rootProfile: "visible_projects" | "canonical_sync";
33
81
  };
82
+ type WorkerServerMessage = {
83
+ type: "connected";
84
+ label: string;
85
+ workerId: string;
86
+ } | {
87
+ type: "workspace_config";
88
+ requestId: string;
89
+ projects: WorkerProjectConfig[];
90
+ workspaceRemoteUrl: string;
91
+ gitIdentity: WorkerGitIdentity;
92
+ githubCredential: WorkerGitHubCredential | null;
93
+ deferWorkspaceSyncForIncidentId?: string;
94
+ } | {
95
+ type: "sync_workspace";
96
+ requestId: string;
97
+ attemptId: string;
98
+ trigger: WorkspaceSyncTrigger;
99
+ confirmedLargeDiff?: boolean;
100
+ confirmationReason?: string;
101
+ resetToCanonical?: boolean;
102
+ requiredAncestorHeads?: string[];
103
+ } | {
104
+ type: "create_project_branch";
105
+ requestId: string;
106
+ branchId: string;
107
+ projectId: string;
108
+ sourceBranch: string;
109
+ targetBranch: string;
110
+ } | {
111
+ type: "delete_project_branch";
112
+ requestId: string;
113
+ branchId: string;
114
+ projectId: string;
115
+ branchName: string;
116
+ } | {
117
+ type: "code_list";
118
+ requestId: string;
119
+ target: Extract<WorkerSessionTarget, {
120
+ type: "project";
121
+ }>;
122
+ path: string;
123
+ } | {
124
+ type: "code_read";
125
+ requestId: string;
126
+ target: Extract<WorkerSessionTarget, {
127
+ type: "project";
128
+ }>;
129
+ path: string;
130
+ } | {
131
+ type: "sync_session_artifacts";
132
+ requestId: string;
133
+ sessionId: string;
134
+ } | {
135
+ type: "workspace_incident_updated";
136
+ incidentId: string | null;
137
+ status: "remediating" | "waiting_for_worker" | "resolved" | "confirmed" | "reset" | null;
138
+ originWorkerLabel?: string;
139
+ } | {
140
+ type: "exec_terminal_ack";
141
+ runId: string;
142
+ } | {
143
+ type: "port_forward_connect";
144
+ forwardId: string;
145
+ relayConnectionId: string;
146
+ workerPort: number;
147
+ } | {
148
+ type: "update_clis";
149
+ requestId: string;
150
+ workerPackageSpec: string;
151
+ r5dctlPackageSpec: string;
152
+ targetWorkerVersion: string;
153
+ targetR5dctlVersion: string;
154
+ } | {
155
+ type: "exec";
156
+ requestId: string;
157
+ runId: string;
158
+ target: WorkerSessionTarget;
159
+ sessionId?: string;
160
+ argv: string[];
161
+ cwd?: string;
162
+ env?: Record<string, string>;
163
+ timeoutMs?: number;
164
+ workspaceEffect?: "none";
165
+ } | {
166
+ type: "exec_start";
167
+ requestId: string;
168
+ runId: string;
169
+ target: WorkerSessionTarget;
170
+ sessionId: string;
171
+ argv: string[];
172
+ command: string;
173
+ mode: "foreground" | "detached";
174
+ credentialId?: string;
175
+ cwd?: string;
176
+ env?: Record<string, string>;
177
+ timeoutMs?: number;
178
+ interactive?: boolean;
179
+ workspaceEffect?: "none";
180
+ } | {
181
+ type: "exec_stdin";
182
+ requestId: string;
183
+ runId: string;
184
+ data?: string;
185
+ eof?: boolean;
186
+ } | {
187
+ type: "pty_open";
188
+ requestId: string;
189
+ ptyId: string;
190
+ target: WorkerSessionTarget;
191
+ cols: number;
192
+ rows: number;
193
+ command?: string;
194
+ env?: Record<string, string>;
195
+ envFiles?: Array<{
196
+ path: string;
197
+ content: string;
198
+ mode?: number;
199
+ }>;
200
+ } | {
201
+ type: "pty_input";
202
+ ptyId: string;
203
+ data: string;
204
+ } | {
205
+ type: "pty_resize";
206
+ ptyId: string;
207
+ cols: number;
208
+ rows: number;
209
+ } | {
210
+ type: "pty_close";
211
+ ptyId: string;
212
+ } | {
213
+ type: "read";
214
+ requestId: string;
215
+ target: WorkerSessionTarget;
216
+ sessionId?: string;
217
+ activePlanId?: string;
218
+ filePath: string;
219
+ offset?: number;
220
+ limit?: number;
221
+ } | {
222
+ type: "write";
223
+ requestId: string;
224
+ target: WorkerSessionTarget;
225
+ sessionId?: string;
226
+ activePlanId?: string;
227
+ filePath: string;
228
+ content: string;
229
+ } | {
230
+ type: "edit";
231
+ requestId: string;
232
+ target: WorkerSessionTarget;
233
+ sessionId?: string;
234
+ activePlanId?: string;
235
+ filePath: string;
236
+ edits: Array<{
237
+ oldText: string;
238
+ newText: string;
239
+ }>;
240
+ } | {
241
+ type: "grep";
242
+ requestId: string;
243
+ target: WorkerSessionTarget;
244
+ sessionId?: string;
245
+ activePlanId?: string;
246
+ pattern: string;
247
+ path?: string;
248
+ glob?: string;
249
+ caseSensitive?: boolean;
250
+ limit?: number;
251
+ } | {
252
+ type: "find";
253
+ requestId: string;
254
+ target: WorkerSessionTarget;
255
+ sessionId?: string;
256
+ activePlanId?: string;
257
+ pattern?: string;
258
+ path?: string;
259
+ entryType?: string;
260
+ limit?: number;
261
+ } | {
262
+ type: "ls";
263
+ requestId: string;
264
+ target: WorkerSessionTarget;
265
+ sessionId?: string;
266
+ activePlanId?: string;
267
+ path?: string;
268
+ limit?: number;
269
+ } | {
270
+ type: "view_file_bytes";
271
+ requestId: string;
272
+ target: WorkerSessionTarget;
273
+ sessionId?: string;
274
+ activePlanId?: string;
275
+ filePath: string;
276
+ } | {
277
+ type: "cancel";
278
+ requestId: string;
279
+ runId: string;
280
+ } | {
281
+ type: "ping";
282
+ };
34
283
  type WorkerReadFileResult = {
35
284
  type: "read";
36
285
  kind: "text";
@@ -114,6 +363,47 @@ declare function assertWorkerChildAdmission(input: {
114
363
  workspaceConfigured: boolean;
115
364
  runtimeHealthy: boolean;
116
365
  }): void;
366
+ type WorkerPty = {
367
+ write(data: string): void;
368
+ resize(cols: number, rows: number): void;
369
+ kill(): void;
370
+ terminate(): Promise<void>;
371
+ };
372
+ type ActiveWorkerPty = WorkerPty & {
373
+ target: WorkerSessionTarget;
374
+ foregroundBusy: boolean;
375
+ lastInputAt: number;
376
+ releaseWorkspaceMutation?: () => void;
377
+ };
378
+ type StagedPtyEnvFiles = {
379
+ paths: string[];
380
+ resolvedByRequestedPath: Map<string, string>;
381
+ };
382
+ declare function resolvePtyEnvFilePath(requestedPath: string, temporaryRoot?: string): string;
383
+ declare function removePtyEnvFiles(paths: readonly string[]): void;
384
+ declare function stagePtyEnvFiles(envFiles: readonly {
385
+ path: string;
386
+ content: string;
387
+ mode?: number;
388
+ }[] | undefined, temporaryRoot?: string): StagedPtyEnvFiles;
389
+ declare function resolvePtyEnvFileReferences(env: Record<string, string>, staged: StagedPtyEnvFiles): Record<string, string>;
390
+ declare function workerCommandHasWorkspaceEffect(message: {
391
+ workspaceEffect?: "none";
392
+ }): boolean;
393
+ declare function workerPtyIsWorkspaceBusy(pty: Pick<ActiveWorkerPty, "foregroundBusy" | "lastInputAt">, now?: number, foregroundIdleEnabled?: boolean): boolean;
394
+ declare function parseLinuxPtyForegroundBusy(stat: string): boolean | null;
395
+ export declare const workerPtyTestHarness: {
396
+ temporaryPathPrefix: string;
397
+ inputBusyGraceMs: number;
398
+ resolveEnvFilePath: typeof resolvePtyEnvFilePath;
399
+ stageEnvFiles: typeof stagePtyEnvFiles;
400
+ removeEnvFiles: typeof removePtyEnvFiles;
401
+ resolveEnvFileReferences: typeof resolvePtyEnvFileReferences;
402
+ commandHasWorkspaceEffect: typeof workerCommandHasWorkspaceEffect;
403
+ canonicalSyncTerminalHead: typeof canonicalSyncTerminalHead;
404
+ ptyIsWorkspaceBusy: typeof workerPtyIsWorkspaceBusy;
405
+ parseLinuxForegroundBusy: typeof parseLinuxPtyForegroundBusy;
406
+ };
117
407
  export type WorkerBuiltInToolPaths = {
118
408
  artifactsDir?: string;
119
409
  plansDir?: string;
@@ -262,6 +552,51 @@ type CredentialReapContractProbe = {
262
552
  type CredentialReapContractStatus = "direct" | "systemd_unverified" | "verified_systemd";
263
553
  declare function credentialReapContractStatus(probe?: CredentialReapContractProbe): CredentialReapContractStatus;
264
554
  declare function verifiedCredentialReapContract(probe?: CredentialReapContractProbe): boolean;
555
+ declare function workspaceConfigurationIncidentDeferral(input: {
556
+ requestedIncidentId: string | undefined;
557
+ activeIncidentId: string | null;
558
+ }): {
559
+ incidentId: string | null;
560
+ error?: Error;
561
+ };
562
+ type DeferredWorkspaceConfiguration = {
563
+ incidentId: string;
564
+ serverRefreshExpected: boolean;
565
+ };
566
+ declare function workspaceIncidentTerminalClearDisposition(input: {
567
+ deferredConfiguration: DeferredWorkspaceConfiguration | null;
568
+ clearedIncidentId: string | null;
569
+ }): "ordinary_resume" | "await_server_refresh" | "reconnect_for_refresh";
570
+ declare function deferredWorkspaceTargetIsAllowed(deferredConfiguration: DeferredWorkspaceConfiguration | null, activeIncidentId: string | null, target: WorkerSessionTarget): boolean;
571
+ declare function deferredWorkspaceSyncTriggerIsAllowed(deferredConfiguration: DeferredWorkspaceConfiguration | null, activeIncidentId: string | null, trigger: WorkspaceSyncTrigger): boolean;
572
+ declare function workspaceOperationsAreFenced(deferredConfiguration: DeferredWorkspaceConfiguration | null, activeIncidentId: string | null): boolean;
573
+ declare function workspaceCommandTransportIsAllowed(deferredConfiguration: DeferredWorkspaceConfiguration | null, activeIncidentId: string | null, transport: "exec" | "exec_start"): boolean;
574
+ declare function deferredCredentialTransitionMustWait(input: {
575
+ incidentId: string | null;
576
+ transitionPhase: CredentialGenerationTransitionPhase;
577
+ canonicalRemediationActive: boolean;
578
+ }): boolean;
579
+ declare function workspaceConfigurationIncidentSnapshotIsCurrent(capturedIncidentId: string | null, activeIncidentId: string | null): boolean;
580
+ declare function deferredWorkspaceRefreshWatchdogIsCurrent(input: {
581
+ capturedIncidentId: string;
582
+ deferredConfiguration: DeferredWorkspaceConfiguration | null;
583
+ activeIncidentId: string | null;
584
+ }): boolean;
585
+ declare function incidentDeferredProjectCheckouts(projects: readonly WorkerProjectConfig[]): Array<{
586
+ projectId: string;
587
+ branchName: string;
588
+ }>;
589
+ declare function deferredIncidentWorkspaceConfigurationResult(input: {
590
+ attemptId: string;
591
+ workerLabel: string;
592
+ head: string | null;
593
+ skippedMountIds: string[];
594
+ }): WorkspaceSyncResult;
595
+ declare function workspaceSyncFailureHydrationIsSafe(input: {
596
+ error: unknown;
597
+ resetToCanonical: boolean;
598
+ inspectCurrentHydration: () => boolean;
599
+ }): boolean;
265
600
  declare function fenceUnsafeWorkspaceSyncFailure(input: {
266
601
  hydrationCurrent: boolean;
267
602
  invalidateExecution: () => void;
@@ -292,7 +627,21 @@ export declare const workerGitSecurityTestHarness: {
292
627
  credentialReapContractStatus: typeof credentialReapContractStatus;
293
628
  verifiedCredentialReapContract: typeof verifiedCredentialReapContract;
294
629
  fenceUnsafeWorkspaceSyncFailure: typeof fenceUnsafeWorkspaceSyncFailure;
630
+ workspaceConfigurationIncidentDeferral: typeof workspaceConfigurationIncidentDeferral;
631
+ workspaceIncidentTerminalClearDisposition: typeof workspaceIncidentTerminalClearDisposition;
632
+ deferredWorkspaceTargetIsAllowed: typeof deferredWorkspaceTargetIsAllowed;
633
+ deferredWorkspaceSyncTriggerIsAllowed: typeof deferredWorkspaceSyncTriggerIsAllowed;
634
+ workspaceOperationsAreFenced: typeof workspaceOperationsAreFenced;
635
+ workspaceCommandTransportIsAllowed: typeof workspaceCommandTransportIsAllowed;
636
+ deferredCredentialTransitionMustWait: typeof deferredCredentialTransitionMustWait;
637
+ workspaceConfigurationIncidentSnapshotIsCurrent: typeof workspaceConfigurationIncidentSnapshotIsCurrent;
638
+ deferredWorkspaceRefreshWatchdogIsCurrent: typeof deferredWorkspaceRefreshWatchdogIsCurrent;
639
+ incidentDeferredProjectCheckouts: typeof incidentDeferredProjectCheckouts;
640
+ deferredIncidentWorkspaceConfigurationResult: typeof deferredIncidentWorkspaceConfigurationResult;
641
+ workspaceSyncFailureHydrationIsSafe: typeof workspaceSyncFailureHydrationIsSafe;
295
642
  assertWorkerChildAdmission: typeof assertWorkerChildAdmission;
643
+ executeWriteFileOperation: typeof executeWriteFileOperation;
644
+ executeEditFileOperation: typeof executeEditFileOperation;
296
645
  terminateCredentialBearingChildren: typeof terminateCredentialBearingChildren;
297
646
  terminateCredentialBearingChildrenWithRetention: typeof terminateCredentialBearingChildrenWithRetention;
298
647
  commitCredentialGeneration(prepared: PreparedPrivateAuthFileGeneration, credential: WorkerGitHubCredential | null, children: readonly {
@@ -325,6 +674,7 @@ type ResolvedWorkerSessionTarget = {
325
674
  rootPath: string;
326
675
  config?: WorkerProjectConfig;
327
676
  };
677
+ declare function canonicalSyncTerminalHead(resolvedTarget: Pick<ResolvedWorkerSessionTarget, "target" | "rootPath">, readHead?: (rootPath: string) => string): string | undefined;
328
678
  export declare function describeWorkerSessionTarget(target: WorkerSessionTarget): string;
329
679
  export declare function resolveWorkerSessionTarget(input: {
330
680
  target: WorkerSessionTarget;
@@ -349,6 +699,28 @@ export declare function editWorkerTextFile(branchPath: string, filePath: string,
349
699
  oldText: string;
350
700
  newText: string;
351
701
  }>, builtInPaths?: WorkerBuiltInToolPaths): WorkerEditFileResult;
702
+ declare function executeWriteFileOperation(input: {
703
+ message: Extract<WorkerServerMessage, {
704
+ type: "write";
705
+ }>;
706
+ resolvedTarget: ResolvedWorkerSessionTarget;
707
+ baseUrl: string;
708
+ token: string;
709
+ artifactRoot: string;
710
+ planRoot: string;
711
+ assertAdmission: () => void;
712
+ }): Promise<WorkerWriteFileResult>;
713
+ declare function executeEditFileOperation(input: {
714
+ message: Extract<WorkerServerMessage, {
715
+ type: "edit";
716
+ }>;
717
+ resolvedTarget: ResolvedWorkerSessionTarget;
718
+ baseUrl: string;
719
+ token: string;
720
+ artifactRoot: string;
721
+ planRoot: string;
722
+ assertAdmission: () => void;
723
+ }): Promise<WorkerEditFileResult>;
352
724
  export declare function grepWorkerFiles(branchPath: string, input: {
353
725
  pattern: string;
354
726
  path?: string;
@@ -375,6 +747,29 @@ export declare function prepareShellEnvForTarget(input: {
375
747
  artifactRoot: string;
376
748
  planRoot: string;
377
749
  }): Promise<Record<string, string>>;
750
+ declare function createNodePtyBridge(options: {
751
+ file: string;
752
+ args: string[];
753
+ ptyOptions: {
754
+ name: string;
755
+ cols: number;
756
+ rows: number;
757
+ cwd: string;
758
+ env: Record<string, string | undefined>;
759
+ };
760
+ onOpened: (pid: number) => void;
761
+ onForeground: (busy: boolean) => void;
762
+ onOutput: (data: string) => void;
763
+ onExit: (event: {
764
+ exitCode: number;
765
+ signal?: number | string;
766
+ }) => void;
767
+ onError: (error: Error) => void;
768
+ onTerminationError: (error: Error) => void;
769
+ }): WorkerPty;
770
+ export declare const workerPtyBridgeTestHarness: {
771
+ create: typeof createNodePtyBridge;
772
+ };
378
773
  export declare function resolveHostShell(command?: string, platform?: NodeJS.Platform): {
379
774
  file: string;
380
775
  args: string[];
@@ -1,7 +1,7 @@
1
1
  export type WorkingTreeSourceMode = "all" | "git";
2
2
  export type WorkingTreeDeletionMode = "all" | "git";
3
3
  export type WorkingTreeMirrorDurability = "per_entry" | "deferred_private_staging";
4
- type TreeEntry = {
4
+ export type TreeEntry = {
5
5
  kind: "directory";
6
6
  mode: number;
7
7
  } | {
@@ -35,4 +35,3 @@ export declare function mirrorWorkingTree(input: {
35
35
  }): {
36
36
  paths: string[];
37
37
  };
38
- export {};
@@ -12,9 +12,10 @@ type WorkspaceSyncCompletionBarrier = {
12
12
  afterCurrent(): Promise<void>;
13
13
  };
14
14
  /**
15
- * A visible command must not become active halfway through an outer sync. Wait
16
- * for the current cycle, then register the target without another await so a
17
- * later cycle observes the reservation and defers before integration.
15
+ * A project command may reserve immediately: per-mount hydration rechecks its
16
+ * busy predicate immediately before touching visible bytes. A visible-projects
17
+ * workspace command spans every project, so it keeps the whole-cycle barrier.
18
+ * Canonical remediation is serialized separately by the mutation gate.
18
19
  */
19
20
  export declare function reserveWorkspaceCommandAfterCurrentSync(target: WorkspaceCommandTarget, coordinator: WorkspaceSyncCompletionBarrier, reserve: () => void): Promise<void>;
20
21
  /**
@@ -29,6 +29,8 @@ export type WorkspaceGitMount = {
29
29
  /** Remove the outer-workspace subtree when the mounted source was intentionally deleted. */
30
30
  deleteWhenSourceMissing?: boolean;
31
31
  busy?: () => boolean;
32
+ /** Monotonic/opaque visible-mutation token used to catch short writes that begin and end between busy checks. */
33
+ mutationToken?: () => string;
32
34
  /** Activity-only fence used before checkout readiness is established on reconnect. */
33
35
  busyForRecovery?: () => boolean;
34
36
  };
@@ -50,8 +52,14 @@ export type WorkspaceGitSyncResult = {
50
52
  local: string;
51
53
  remote: string;
52
54
  };
55
+ conflictKind?: "integration_rebase" | "projection_merge";
56
+ verifiedAncestorHeads?: string[];
53
57
  error?: string;
54
58
  };
59
+ /** A guarded remediation was rejected before it was allowed to hydrate or publish. */
60
+ export declare class WorkspaceRemediationAncestryError extends Error {
61
+ constructor(message: string);
62
+ }
55
63
  declare function gitCommandArgs(args: string[]): string[];
56
64
  declare function workspaceCloneCommandArgs(args: string[], remoteUrl: string, credentialHelper?: string | null, credentialUsername?: string | null): string[];
57
65
  export declare function workspaceGitHydrationIsCurrent(workspacePath: string, mounts?: readonly WorkspaceGitMount[]): boolean;
@@ -65,6 +73,22 @@ declare function configureWorkspaceRepository(input: {
65
73
  email: string;
66
74
  };
67
75
  }): void;
76
+ /**
77
+ * Rebind only the existing canonical checkout's local Git configuration while
78
+ * an incident owns its HEAD. In particular, this deliberately does not fetch,
79
+ * recover durability, move refs, reset the index/worktree, or inspect/abort an
80
+ * in-progress merge or rebase.
81
+ */
82
+ export declare function configureExistingWorkspaceGitForRemediation(input: {
83
+ workspacePath: string;
84
+ remoteUrl: string;
85
+ credentialHelper?: string | null;
86
+ credentialUsername?: string | null;
87
+ gitIdentity: {
88
+ name: string;
89
+ email: string;
90
+ };
91
+ }): void;
68
92
  export declare function ensureWorkspaceGitClone(input: {
69
93
  workspacePath: string;
70
94
  remoteUrl: string;
@@ -74,6 +98,7 @@ export declare function ensureWorkspaceGitClone(input: {
74
98
  name: string;
75
99
  email: string;
76
100
  };
101
+ preserveResolutionInProgress?: boolean;
77
102
  }): {
78
103
  localHead: string | null;
79
104
  remoteHead: string | null;
@@ -88,6 +113,8 @@ export declare function hydrateWorkspaceGitMounts(workspacePath: string, mounts:
88
113
  export declare function recoverWorkspaceGitHydration(workspacePath: string, mounts: readonly WorkspaceGitMount[], options?: {
89
114
  ignoreBusy?: boolean;
90
115
  deferMountIds?: ReadonlySet<string>;
116
+ preserveResolutionInProgress?: boolean;
117
+ preserveStaleBases?: boolean;
91
118
  }): void;
92
119
  export declare function resetWorkspaceGit(input: {
93
120
  workspacePath: string;
@@ -107,6 +134,7 @@ export declare function resetWorkspaceGit(input: {
107
134
  activeMountIds: string[];
108
135
  skippedMountIds: string[];
109
136
  };
137
+ declare function diffSizeBytes(workspacePath: string, baseRevision: string | null, headRevision: string, limit: number): Promise<number>;
110
138
  export declare function synchronizeWorkspaceGit(input: {
111
139
  attemptId?: string;
112
140
  workerLabel: string;
@@ -125,6 +153,12 @@ export declare function synchronizeWorkspaceGit(input: {
125
153
  maxPushAttempts?: number;
126
154
  /** Publish edits already made in the outer clone without first projecting visible mounts over them. */
127
155
  skipMountMirror?: boolean;
156
+ /** Positive ancestry proof required before a remediation may integrate, publish, or hydrate. */
157
+ requiredAncestorHeads?: readonly string[];
158
+ /** Revalidate the worker/config/incident generation after every async boundary. */
159
+ assertStillAdmitted?: () => void;
160
+ /** Test seam for exercising an incident transition during asynchronous diff measurement. */
161
+ measureDiffSize?: typeof diffSizeBytes;
128
162
  afterWorkspacePublished?: (context: {
129
163
  publishedHead: string;
130
164
  activeMountIds: string[];
@@ -0,0 +1,42 @@
1
+ import { type WorkingTreeSourceMode } from "./working-tree-mirror";
2
+ export type WorkspaceMergeProjectionSupport = {
3
+ supported: true;
4
+ } | {
5
+ supported: false;
6
+ error: string;
7
+ };
8
+ export type WorkspaceMergeProjectionMount = {
9
+ id: string;
10
+ sourcePath: string;
11
+ workspaceRelativePath: string;
12
+ sourceMode: WorkingTreeSourceMode;
13
+ };
14
+ export type WorkspaceMergeProjectionResult = {
15
+ kind: "clean";
16
+ resultTree: string;
17
+ oursCommit: string;
18
+ } | {
19
+ kind: "conflict";
20
+ oursCommit: string;
21
+ conflictPaths: string[];
22
+ error: string;
23
+ };
24
+ declare function gitVersionIsSupported(version: string): boolean;
25
+ export declare function workspaceMergeProjectionSupport(): WorkspaceMergeProjectionSupport;
26
+ export declare function mergeWorkspaceProjectionMount(input: {
27
+ workspacePath: string;
28
+ mount: WorkspaceMergeProjectionMount;
29
+ basisHead: string;
30
+ currentHead: string;
31
+ attemptId: string;
32
+ }): WorkspaceMergeProjectionResult;
33
+ export declare function materializeWorkspaceProjectionTree(input: {
34
+ workspacePath: string;
35
+ workspaceRelativePath: string;
36
+ resultTree: string;
37
+ }): void;
38
+ export declare const workspaceMergeProjectionTestHarness: {
39
+ gitVersionIsSupported: typeof gitVersionIsSupported;
40
+ resetSupportProbe(): void;
41
+ };
42
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.81",
3
+ "version": "0.0.83",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",