@ricsam/r5d-worker 0.0.57 → 0.0.59

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.
@@ -2,8 +2,8 @@ import { type CheckoutPathSegments } from "./managed-paths";
2
2
  import { type WorkspaceMutationLease } from "./workspace-mutation-gate";
3
3
  export declare const WORKSPACE_BRANCH = "main";
4
4
  export declare const WORKSPACE_INTENT_REF_PREFIX = "refs/r5d/workspace-intents/";
5
+ export declare const WORKSPACE_PUBLICATION_REF_PREFIX = "refs/r5d/workspace-publications/";
5
6
  export declare const MAX_WORKSPACE_SYNC_DIFF_BYTES: number;
6
- export declare const WORKSPACE_PERIODIC_SCAN_INTERVAL_MS = 5000;
7
7
  export type WorkspaceProjectManifestEntry = {
8
8
  projectId: string;
9
9
  checkoutPathSegments: CheckoutPathSegments;
@@ -32,7 +32,7 @@ export type WorkspaceSyncTrigger = {
32
32
  canonicalCheckoutOnly?: boolean;
33
33
  detail?: string;
34
34
  };
35
- export type WorkspaceSyncOutcome = "no_change" | "candidate_ready" | "published" | "updated" | "conflict_reset" | "large_diff_blocked" | "reset" | "failed";
35
+ export type WorkspaceSyncOutcome = "no_change" | "candidate_ready" | "published" | "updated" | "conflict_reset" | "large_diff_blocked" | "conflict_blocked" | "reset" | "failed";
36
36
  export type WorkspaceSyncResult = {
37
37
  type: "workspace_sync";
38
38
  attemptId: string;
@@ -51,7 +51,14 @@ export type WorkspaceSyncResult = {
51
51
  affectedPaths: string[];
52
52
  discardedPaths: string[];
53
53
  localChangesDiscarded: boolean;
54
+ dirtyGeneration?: number;
54
55
  sampledCanonicalCheckoutTreeHash?: string;
56
+ telemetry?: {
57
+ totalMs: number;
58
+ queueMs: number;
59
+ prepareMs: number;
60
+ synchronizeMs: number;
61
+ };
55
62
  error?: string;
56
63
  };
57
64
  export type WorkspaceSyncInput = {
@@ -69,6 +76,8 @@ export type WorkspaceSyncInput = {
69
76
  * Workers never publish the canonical workspace branch directly.
70
77
  */
71
78
  quarantineRef?: string;
79
+ /** Exact canonical head fenced by checkpoint authority. */
80
+ expectedCanonicalHead?: string | null;
72
81
  confirmedLargeDiff?: boolean;
73
82
  confirmationReason?: string;
74
83
  resetToCanonical?: boolean;
@@ -113,6 +122,25 @@ export declare function mirrorVisibleWorkspaceToShadow(input: WorkspaceSyncInput
113
122
  export declare function mirrorShadowWorkspaceToVisible(input: WorkspaceSyncInput, opaqueWorkspaceRoots?: readonly string[], hydrationPreimages?: VisibleHydrationPreimages): void;
114
123
  export declare function assertWorkspaceQuarantineRef(quarantineRef: string): void;
115
124
  export declare function synchronizeWorkspace(rawInput: WorkspaceSyncInput): Promise<WorkspaceSyncResult>;
125
+ export type WorkspaceHeadConvergenceResult = {
126
+ localHead: string | null;
127
+ canonicalHead: string | null;
128
+ localChanges: boolean;
129
+ hydrated: boolean;
130
+ hydrationConflicts: string[];
131
+ };
132
+ /**
133
+ * Fetches the newest canonical head without treating an inbound overlap as an
134
+ * incident. A busy caller passes hydrateVisible=false, which updates only the
135
+ * remote-tracking ref. An idle caller may hydrate only after proving that its
136
+ * visible tree still matches the local workspace head.
137
+ */
138
+ export declare function convergeWorkspaceHead(rawInput: WorkspaceSyncInput, options: {
139
+ hydrateVisible: boolean;
140
+ }): Promise<WorkspaceHeadConvergenceResult>;
141
+ /** Returns a local-only fingerprint. Unlike the legacy periodic observation it
142
+ * deliberately ignores whether origin/main has advanced. */
143
+ export declare function calculateWorkspaceLocalDiffFingerprint(rawInput: WorkspaceSyncInput): string;
116
144
  export declare function calculateWorkspaceDiffFingerprint(rawInput: WorkspaceSyncInput): string;
117
145
  export declare class WorkspaceSyncSingleFlight {
118
146
  private readonly mutationGate;
@@ -122,6 +150,7 @@ export declare class WorkspaceSyncSingleFlight {
122
150
  runPrepared(prepare: () => WorkspaceSyncInput): Promise<WorkspaceSyncResult>;
123
151
  fingerprint(input: WorkspaceSyncInput): Promise<string>;
124
152
  fingerprintPrepared(prepare: () => WorkspaceSyncInput): Promise<string>;
153
+ runExclusive<T>(operation: () => Promise<T> | T): Promise<T>;
125
154
  runMutation<T>(operation: () => Promise<T> | T): Promise<T>;
126
155
  acquireMutation(): Promise<WorkspaceMutationLease>;
127
156
  afterCurrent(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.57",
3
+ "version": "0.0.59",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",