@ricsam/r5d-worker 0.0.137 → 0.0.139
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 +4 -94
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/main.mjs +46 -7543
- package/dist/mjs/package.json +1 -1
- package/dist/mjs/personal/action-scheduler.mjs +31 -0
- package/dist/mjs/personal/client.mjs +215 -0
- package/dist/mjs/personal/runtime.mjs +359 -0
- package/dist/mjs/personal/tcp.mjs +217 -0
- package/dist/mjs/runtime/adapter.mjs +42 -0
- package/dist/mjs/runtime/client.mjs +95 -0
- package/dist/mjs/runtime/daemon.mjs +131 -0
- package/dist/mjs/runtime/executor.mjs +436 -0
- package/dist/mjs/runtime/index.mjs +15 -0
- package/dist/mjs/runtime/protocol.mjs +139 -0
- package/dist/mjs/runtime/pty-host.mjs +156 -0
- package/dist/mjs/runtime/pty.mjs +127 -0
- package/dist/mjs/runtime/releases/artifacts.mjs +201 -0
- package/dist/mjs/runtime/releases/grants.mjs +93 -0
- package/dist/mjs/runtime/releases/main.mjs +101 -0
- package/dist/mjs/runtime/releases/manager.mjs +541 -0
- package/dist/mjs/runtime/releases/process.mjs +88 -0
- package/dist/mjs/runtime/releases/retirement.mjs +18 -0
- package/dist/mjs/runtime/releases/rpc-client.mjs +184 -0
- package/dist/mjs/runtime/releases/rpc-main.mjs +213 -0
- package/dist/mjs/runtime/releases/rpc-protocol.mjs +103 -0
- package/dist/mjs/runtime/storage.mjs +156 -0
- package/dist/mjs/runtime/workspace/artifacts.mjs +121 -0
- package/dist/mjs/runtime/workspace/authority.mjs +1355 -0
- package/dist/mjs/runtime/workspace/contracts.mjs +60 -0
- package/dist/mjs/runtime/workspace/file-write.mjs +23 -0
- package/dist/mjs/runtime/workspace/files.mjs +308 -0
- package/dist/mjs/runtime/workspace/http-body.mjs +45 -0
- package/dist/mjs/runtime/workspace/storage-client.mjs +59 -0
- package/dist/mjs/runtime/workspace/storage-wire.mjs +53 -0
- package/dist/types/main.d.ts +0 -1167
- package/dist/types/personal/action-scheduler.d.ts +23 -0
- package/dist/types/personal/client.d.ts +14 -0
- package/dist/types/personal/runtime.d.ts +121 -0
- package/dist/types/personal/tcp.d.ts +14 -0
- package/dist/types/runtime/client.d.ts +3 -1
- package/dist/types/runtime/executor.d.ts +6 -1
- package/dist/types/runtime/protocol.d.ts +176 -4
- package/dist/types/runtime/pty.d.ts +1 -0
- package/dist/types/runtime/releases/artifacts.d.ts +51 -0
- package/dist/types/runtime/releases/grants.d.ts +16 -0
- package/dist/types/runtime/releases/manager.d.ts +145 -0
- package/dist/types/runtime/releases/process.d.ts +14 -0
- package/dist/types/runtime/releases/retirement.d.ts +15 -0
- package/dist/types/runtime/releases/rpc-client.d.ts +52 -0
- package/dist/types/runtime/releases/rpc-main.d.ts +10 -0
- package/dist/types/runtime/releases/rpc-protocol.d.ts +1139 -0
- package/dist/types/runtime/workspace/artifacts.d.ts +30 -0
- package/dist/types/runtime/workspace/authority.d.ts +338 -0
- package/dist/types/runtime/workspace/contracts.d.ts +86 -0
- package/dist/types/runtime/workspace/file-write.d.ts +14 -0
- package/dist/types/runtime/workspace/files.d.ts +21 -0
- package/dist/types/runtime/workspace/http-body.d.ts +9 -0
- package/dist/types/runtime/workspace/storage-client.d.ts +23 -0
- package/dist/types/runtime/workspace/storage-wire.d.ts +138 -0
- package/package.json +8 -6
- package/dist/cjs/atomic-rename.cjs +0 -303
- package/dist/cjs/browser-upload.cjs +0 -73
- package/dist/cjs/cli-update.cjs +0 -108
- package/dist/cjs/command-launcher.cjs +0 -423
- package/dist/cjs/control-command-policy.cjs +0 -177
- package/dist/cjs/git-blob-hash.cjs +0 -41
- package/dist/cjs/git-identity.cjs +0 -39
- package/dist/cjs/git-process-environment.cjs +0 -133
- package/dist/cjs/inline-output.cjs +0 -62
- package/dist/cjs/main.cjs +0 -7517
- package/dist/cjs/managed-paths.cjs +0 -215
- package/dist/cjs/plan-lint.cjs +0 -165
- package/dist/cjs/plan-parser.cjs +0 -127
- package/dist/cjs/plan-paths.cjs +0 -53
- package/dist/cjs/port-forward-client.cjs +0 -206
- package/dist/cjs/process-tree.cjs +0 -117
- package/dist/cjs/project-checkout-garbage.cjs +0 -219
- package/dist/cjs/project-mirror-fetch-policy.cjs +0 -82
- package/dist/cjs/project-mirror-refs-token.cjs +0 -85
- package/dist/cjs/project-workspace-state.cjs +0 -972
- package/dist/cjs/project-worktrees.cjs +0 -1713
- package/dist/cjs/pty-output-coalescer.cjs +0 -87
- package/dist/cjs/recovery-journal-protocol.cjs +0 -56
- package/dist/cjs/recovery-journal-runtime.cjs +0 -133
- package/dist/cjs/recovery-journal-thread.cjs +0 -9
- package/dist/cjs/recovery-journal.cjs +0 -742
- package/dist/cjs/recovery-output-window.cjs +0 -77
- package/dist/cjs/recovery-protocol.cjs +0 -31
- package/dist/cjs/recovery-store.cjs +0 -252
- package/dist/cjs/registry-auth.cjs +0 -310
- package/dist/cjs/repository-transition-policy.cjs +0 -49
- package/dist/cjs/runtime-version.cjs +0 -88
- package/dist/cjs/session-file-mutations.cjs +0 -61
- package/dist/cjs/supervisor.cjs +0 -147
- package/dist/cjs/three-way-merge.cjs +0 -346
- package/dist/cjs/working-tree-mirror.cjs +0 -1872
- package/dist/cjs/workspace-automatic-sync-policy.cjs +0 -79
- package/dist/cjs/workspace-branch-incarnation-policy.cjs +0 -37
- package/dist/cjs/workspace-command-sync-policy.cjs +0 -112
- package/dist/cjs/workspace-command-targets.cjs +0 -63
- package/dist/cjs/workspace-filesystem-executor-thread.cjs +0 -36
- package/dist/cjs/workspace-filesystem-executor.cjs +0 -327
- package/dist/cjs/workspace-filesystem-job-types.cjs +0 -144
- package/dist/cjs/workspace-filesystem-jobs.cjs +0 -59
- package/dist/cjs/workspace-git-sync.cjs +0 -3595
- package/dist/cjs/workspace-hydration-ledger.cjs +0 -83
- package/dist/cjs/workspace-hydration-merge.cjs +0 -448
- package/dist/cjs/workspace-hydration-recovery-state.cjs +0 -53
- package/dist/cjs/workspace-incident-state.cjs +0 -37
- package/dist/cjs/workspace-merge-projection.cjs +0 -628
- package/dist/cjs/workspace-mount-boundary.cjs +0 -71
- package/dist/cjs/workspace-mount-hold-fence.cjs +0 -120
- package/dist/cjs/workspace-mutation-gate.cjs +0 -127
- package/dist/cjs/workspace-path-move.cjs +0 -195
- package/dist/cjs/workspace-preserve-only-policy.cjs +0 -36
- package/dist/cjs/workspace-project-config-policy.cjs +0 -53
- package/dist/cjs/workspace-projection-ledger.cjs +0 -81
- package/dist/cjs/workspace-publication-evidence.cjs +0 -46
- package/dist/cjs/workspace-sync-coalescer.cjs +0 -58
- package/dist/mjs/atomic-rename.mjs +0 -261
- package/dist/mjs/browser-upload.mjs +0 -42
- package/dist/mjs/command-launcher.mjs +0 -393
- package/dist/mjs/control-command-policy.mjs +0 -146
- package/dist/mjs/git-blob-hash.mjs +0 -16
- package/dist/mjs/git-identity.mjs +0 -15
- package/dist/mjs/git-process-environment.mjs +0 -105
- package/dist/mjs/inline-output.mjs +0 -37
- package/dist/mjs/managed-paths.mjs +0 -174
- package/dist/mjs/plan-lint.mjs +0 -129
- package/dist/mjs/plan-parser.mjs +0 -94
- package/dist/mjs/plan-paths.mjs +0 -25
- package/dist/mjs/port-forward-client.mjs +0 -172
- package/dist/mjs/project-checkout-garbage.mjs +0 -178
- package/dist/mjs/project-mirror-fetch-policy.mjs +0 -56
- package/dist/mjs/project-mirror-refs-token.mjs +0 -53
- package/dist/mjs/project-workspace-state.mjs +0 -937
- package/dist/mjs/project-worktrees.mjs +0 -1657
- package/dist/mjs/pty-output-coalescer.mjs +0 -61
- package/dist/mjs/recovery-journal-protocol.mjs +0 -30
- package/dist/mjs/recovery-journal-runtime.mjs +0 -112
- package/dist/mjs/recovery-journal-thread.mjs +0 -8
- package/dist/mjs/recovery-journal.mjs +0 -694
- package/dist/mjs/recovery-output-window.mjs +0 -53
- package/dist/mjs/recovery-protocol.mjs +0 -6
- package/dist/mjs/recovery-store.mjs +0 -217
- package/dist/mjs/registry-auth.mjs +0 -269
- package/dist/mjs/repository-transition-policy.mjs +0 -22
- package/dist/mjs/runtime-version.mjs +0 -54
- package/dist/mjs/session-file-mutations.mjs +0 -37
- package/dist/mjs/supervisor.mjs +0 -114
- package/dist/mjs/three-way-merge.mjs +0 -318
- package/dist/mjs/working-tree-mirror.mjs +0 -1817
- package/dist/mjs/workspace-automatic-sync-policy.mjs +0 -48
- package/dist/mjs/workspace-branch-incarnation-policy.mjs +0 -13
- package/dist/mjs/workspace-command-sync-policy.mjs +0 -84
- package/dist/mjs/workspace-command-targets.mjs +0 -37
- package/dist/mjs/workspace-filesystem-executor-thread.mjs +0 -38
- package/dist/mjs/workspace-filesystem-executor.mjs +0 -287
- package/dist/mjs/workspace-filesystem-job-types.mjs +0 -116
- package/dist/mjs/workspace-filesystem-jobs.mjs +0 -55
- package/dist/mjs/workspace-git-sync.mjs +0 -3553
- package/dist/mjs/workspace-hydration-ledger.mjs +0 -58
- package/dist/mjs/workspace-hydration-merge.mjs +0 -414
- package/dist/mjs/workspace-hydration-recovery-state.mjs +0 -29
- package/dist/mjs/workspace-incident-state.mjs +0 -12
- package/dist/mjs/workspace-merge-projection.mjs +0 -594
- package/dist/mjs/workspace-mount-boundary.mjs +0 -37
- package/dist/mjs/workspace-mount-hold-fence.mjs +0 -95
- package/dist/mjs/workspace-mutation-gate.mjs +0 -103
- package/dist/mjs/workspace-path-move.mjs +0 -160
- package/dist/mjs/workspace-preserve-only-policy.mjs +0 -11
- package/dist/mjs/workspace-project-config-policy.mjs +0 -27
- package/dist/mjs/workspace-projection-ledger.mjs +0 -57
- package/dist/mjs/workspace-publication-evidence.mjs +0 -21
- package/dist/mjs/workspace-sync-coalescer.mjs +0 -34
- package/dist/types/atomic-rename.d.ts +0 -78
- package/dist/types/browser-upload.d.ts +0 -7
- package/dist/types/command-launcher.d.ts +0 -104
- package/dist/types/control-command-policy.d.ts +0 -53
- package/dist/types/git-blob-hash.d.ts +0 -10
- package/dist/types/git-identity.d.ts +0 -9
- package/dist/types/git-process-environment.d.ts +0 -9
- package/dist/types/inline-output.d.ts +0 -3
- package/dist/types/managed-paths.d.ts +0 -19
- package/dist/types/plan-lint.d.ts +0 -16
- package/dist/types/plan-parser.d.ts +0 -38
- package/dist/types/plan-paths.d.ts +0 -36
- package/dist/types/port-forward-client.d.ts +0 -8
- package/dist/types/project-checkout-garbage.d.ts +0 -86
- package/dist/types/project-mirror-fetch-policy.d.ts +0 -84
- package/dist/types/project-mirror-refs-token.d.ts +0 -53
- package/dist/types/project-workspace-state.d.ts +0 -188
- package/dist/types/project-worktrees.d.ts +0 -397
- package/dist/types/pty-output-coalescer.d.ts +0 -20
- package/dist/types/recovery-journal-protocol.d.ts +0 -35
- package/dist/types/recovery-journal-runtime.d.ts +0 -12
- package/dist/types/recovery-journal-stall-fixture.d.ts +0 -1
- package/dist/types/recovery-journal-thread.d.ts +0 -1
- package/dist/types/recovery-journal.d.ts +0 -248
- package/dist/types/recovery-output-window.d.ts +0 -19
- package/dist/types/recovery-protocol.d.ts +0 -59
- package/dist/types/recovery-store.d.ts +0 -52
- package/dist/types/registry-auth.d.ts +0 -47
- package/dist/types/repository-transition-policy.d.ts +0 -26
- package/dist/types/runtime-version.d.ts +0 -1
- package/dist/types/session-file-mutations.d.ts +0 -22
- package/dist/types/supervisor-daemonized-fixture.d.ts +0 -1
- package/dist/types/supervisor-launcher-cleanup-fixture.d.ts +0 -1
- package/dist/types/supervisor-signal-fixture.d.ts +0 -1
- package/dist/types/supervisor.d.ts +0 -23
- package/dist/types/three-way-merge.d.ts +0 -77
- package/dist/types/working-tree-mirror.d.ts +0 -424
- package/dist/types/workspace-automatic-sync-policy.d.ts +0 -57
- package/dist/types/workspace-branch-incarnation-policy.d.ts +0 -14
- package/dist/types/workspace-command-sync-policy.d.ts +0 -57
- package/dist/types/workspace-command-targets.d.ts +0 -37
- package/dist/types/workspace-filesystem-executor-thread.d.ts +0 -1
- package/dist/types/workspace-filesystem-executor.d.ts +0 -123
- package/dist/types/workspace-filesystem-job-types.d.ts +0 -302
- package/dist/types/workspace-filesystem-jobs.d.ts +0 -7
- package/dist/types/workspace-git-sync.d.ts +0 -514
- package/dist/types/workspace-hydration-ledger.d.ts +0 -76
- package/dist/types/workspace-hydration-merge.d.ts +0 -103
- package/dist/types/workspace-hydration-recovery-state.d.ts +0 -10
- package/dist/types/workspace-incident-state.d.ts +0 -19
- package/dist/types/workspace-merge-projection.d.ts +0 -69
- package/dist/types/workspace-mount-boundary.d.ts +0 -10
- package/dist/types/workspace-mount-hold-fence.d.ts +0 -42
- package/dist/types/workspace-mutation-gate.d.ts +0 -42
- package/dist/types/workspace-path-move.d.ts +0 -21
- package/dist/types/workspace-preserve-only-policy.d.ts +0 -15
- package/dist/types/workspace-project-config-policy.d.ts +0 -48
- package/dist/types/workspace-projection-ledger.d.ts +0 -59
- package/dist/types/workspace-publication-evidence.d.ts +0 -17
- package/dist/types/workspace-sync-coalescer.d.ts +0 -28
- /package/dist/types/{credential-authority-lock-fixture.d.ts → runtime/releases/main.d.ts} +0 -0
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import { type PreparedWorkingTreeMirror, type ProjectedWorkingTreeEntry, type WorkingTreeMirrorOverride, type WorkingTreeMirrorSelection } from "./working-tree-mirror";
|
|
3
|
-
/**
|
|
4
|
-
* Where a mount's bytes were read this cycle (docs/merge-hydration-design.md
|
|
5
|
-
* §2.1). `projectedCommit` is the commit whose subtree at the mount path is
|
|
6
|
-
* exactly what projection read: the projected head for a mirrored mount, the
|
|
7
|
-
* synthesized ours commit for a merge-projected one. `projectedFiles` is
|
|
8
|
-
* what the mirror or synthesis saw for each entry, or null when the mount was
|
|
9
|
-
* not read this cycle (its token was unchanged), in which case a changed
|
|
10
|
-
* file is recognized by hashing it against the projected blob.
|
|
11
|
-
*/
|
|
12
|
-
export type WorkspaceHydrationMergeBasis = {
|
|
13
|
-
projectedCommit: string;
|
|
14
|
-
projectedFiles: Record<string, ProjectedWorkingTreeEntry> | null;
|
|
15
|
-
/**
|
|
16
|
-
* Wall-clock time the projection finished reading. A projected stat whose
|
|
17
|
-
* timestamps fall within `RACY_PROJECTION_WINDOW_MS` of it is not trusted
|
|
18
|
-
* to prove the file unchanged (git's racy-clean rule: a rewrite of the
|
|
19
|
-
* same size in the same coarse timestamp tick leaves the stat intact), so
|
|
20
|
-
* such a file is hashed against the projected blob instead.
|
|
21
|
-
*/
|
|
22
|
-
readAtMs?: number;
|
|
23
|
-
};
|
|
24
|
-
export declare const RACY_PROJECTION_WINDOW_MS = 2000;
|
|
25
|
-
export type WorkspaceHydrationSkipReason = "hydration_merge_conflict" | "hydration_target_changed";
|
|
26
|
-
/** A mount merge hydration left at its previous receipt entry, and why. */
|
|
27
|
-
export type WorkspaceHydrationMountSkip = {
|
|
28
|
-
mountId: string;
|
|
29
|
-
reason: WorkspaceHydrationSkipReason;
|
|
30
|
-
paths: string[];
|
|
31
|
-
};
|
|
32
|
-
/** One path whose blob differs between the projected subtree (base) and the hydration head's subtree (theirs). */
|
|
33
|
-
export type WorkspaceSubtreeChange = {
|
|
34
|
-
base: {
|
|
35
|
-
mode: string;
|
|
36
|
-
objectId: string;
|
|
37
|
-
} | null;
|
|
38
|
-
theirs: {
|
|
39
|
-
mode: string;
|
|
40
|
-
objectId: string;
|
|
41
|
-
} | null;
|
|
42
|
-
};
|
|
43
|
-
export type WorkspaceHydrationMergeDecision = {
|
|
44
|
-
kind: "conflict";
|
|
45
|
-
paths: string[];
|
|
46
|
-
} | {
|
|
47
|
-
kind: "target_changed";
|
|
48
|
-
paths: string[];
|
|
49
|
-
} | {
|
|
50
|
-
kind: "apply";
|
|
51
|
-
selection: WorkingTreeMirrorSelection;
|
|
52
|
-
overrides: Map<string, WorkingTreeMirrorOverride>;
|
|
53
|
-
/** The target `lstat` (or absence) every mutated path must still show when it is mutated. */
|
|
54
|
-
expectations: Map<string, fs.Stats | null>;
|
|
55
|
-
/** Blob of the bytes each written or removed path held before hydration; the stale-rewrite detector's input. */
|
|
56
|
-
preBlobs: Map<string, string>;
|
|
57
|
-
/** Blob each path in `preBlobs` holds after hydration (null: removed); with `preBlobs`, the hydration ledger's record. */
|
|
58
|
-
postBlobs: Map<string, string | null>;
|
|
59
|
-
/**
|
|
60
|
-
* Bytes the ledger names that no commit holds (a merged file's previous
|
|
61
|
-
* and merged content), keyed by blob id, for the job to write into the
|
|
62
|
-
* clone's object store so a later projection can read them back.
|
|
63
|
-
*/
|
|
64
|
-
blobsToStore: Map<string, Buffer>;
|
|
65
|
-
/** Paths whose content was three-way merged. */
|
|
66
|
-
mergedPaths: string[];
|
|
67
|
-
/** Paths the checkout changed since projection that hydration leaves as they are. */
|
|
68
|
-
keptPaths: string[];
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Decide, per path the hydration head changed relative to what projection
|
|
72
|
-
* read, whether hydration writes theirs (the checkout is unchanged there),
|
|
73
|
-
* leaves the checkout alone (theirs did not change there), writes a
|
|
74
|
-
* three-way merge, or cannot proceed (docs/merge-hydration-design.md §2.2,
|
|
75
|
-
* §2.6). Every path the checkout changed since projection that the head did
|
|
76
|
-
* not change survives untouched, including files created since. Nothing is
|
|
77
|
-
* written here; the result drives `applyWorkingTreeMirror` under guards that
|
|
78
|
-
* re-check each path's `lstat` immediately before mutating it.
|
|
79
|
-
*/
|
|
80
|
-
export declare function decideWorkspaceHydrationMerge(input: {
|
|
81
|
-
prepared: PreparedWorkingTreeMirror;
|
|
82
|
-
changes: ReadonlyMap<string, WorkspaceSubtreeChange>;
|
|
83
|
-
projectedFiles: Readonly<Record<string, ProjectedWorkingTreeEntry>> | null;
|
|
84
|
-
readAtMs?: number;
|
|
85
|
-
/** Blob contents by object id, in one batch. */
|
|
86
|
-
readBaseBlobs: (objectIds: readonly string[]) => Map<string, Buffer>;
|
|
87
|
-
/** Paths marked -diff on either side must never enter the text merger. */
|
|
88
|
-
readBinaryPaths?: (relativePaths: readonly string[]) => ReadonlySet<string>;
|
|
89
|
-
}): WorkspaceHydrationMergeDecision;
|
|
90
|
-
/** Batch attribute reads, with NUL delimiters so arbitrary Git filenames stay intact. */
|
|
91
|
-
export declare function readHydrationBinaryPaths(input: {
|
|
92
|
-
checkoutRoot: string;
|
|
93
|
-
outerRoot: string;
|
|
94
|
-
relativePaths: readonly string[];
|
|
95
|
-
}): Set<string>;
|
|
96
|
-
/**
|
|
97
|
-
* Parse `git diff-tree -r -z --no-renames --raw <base tree> <theirs tree>`
|
|
98
|
-
* output into per-path changes. Records come in pairs: the status line
|
|
99
|
-
* (`:<base mode> <theirs mode> <base id> <theirs id> <status>`) and the path.
|
|
100
|
-
*/
|
|
101
|
-
export declare function parseWorkspaceSubtreeChanges(raw: Buffer): Map<string, WorkspaceSubtreeChange>;
|
|
102
|
-
/** The mount-relative path of a checkout entry as its absolute path, for diagnostics. */
|
|
103
|
-
export declare function describeHydrationSkipPaths(mountSourcePath: string, paths: readonly string[]): string;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** Wire evidence owned by the standalone worker package; no API runtime dependency. */
|
|
2
|
-
export type WorkerHydrationRecovery = {
|
|
3
|
-
transactionId: string;
|
|
4
|
-
transactionPath: string;
|
|
5
|
-
mountIds: string[];
|
|
6
|
-
previousHeads: Record<string, string>;
|
|
7
|
-
retainedPaths?: string[];
|
|
8
|
-
};
|
|
9
|
-
/** Extract durable recovery evidence even through executor/AggregateError wrapping. */
|
|
10
|
-
export declare function findHydrationRecovery(error: unknown): WorkerHydrationRecovery | undefined;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type WorkspaceIncidentUpdate = {
|
|
2
|
-
incidentId: string | null;
|
|
3
|
-
status: "remediating" | "waiting_for_worker" | "resolved" | "confirmed" | "reset" | null;
|
|
4
|
-
};
|
|
5
|
-
export declare function applyWorkspaceIncidentUpdate(currentIncidentId: string | null, update: WorkspaceIncidentUpdate): string | null;
|
|
6
|
-
/**
|
|
7
|
-
* Whether an incoming `workspace_config` is the full configuration a terminal
|
|
8
|
-
* incident update promised: the worker still holds an incident-deferred
|
|
9
|
-
* configuration, no incident is active any more, and the server did not ask
|
|
10
|
-
* for another deferral. Arrival of that configuration disarms the refresh
|
|
11
|
-
* watchdog; from then on the configuration's own generation checks and its
|
|
12
|
-
* failure close govern, so a legitimately long full configuration is never
|
|
13
|
-
* cut off mid-flight by the arrival timer.
|
|
14
|
-
*/
|
|
15
|
-
export declare function workspaceConfigurationRefreshesDeferredConfiguration(input: {
|
|
16
|
-
deferredIncidentId: string | null;
|
|
17
|
-
activeIncidentId: string | null;
|
|
18
|
-
requestedDeferredIncidentId: string | undefined;
|
|
19
|
-
}): boolean;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { type ProjectedWorkingTreeEntry, type WorkingTreeSourceMode } from "./working-tree-mirror";
|
|
2
|
-
import type { WorkspaceHydrationLedgerEntry } from "./workspace-hydration-ledger";
|
|
3
|
-
export type WorkspaceMergeProjectionSupport = {
|
|
4
|
-
supported: true;
|
|
5
|
-
} | {
|
|
6
|
-
supported: false;
|
|
7
|
-
error: string;
|
|
8
|
-
};
|
|
9
|
-
export type WorkspaceMergeProjectionMount = {
|
|
10
|
-
id: string;
|
|
11
|
-
sourcePath: string;
|
|
12
|
-
workspaceRelativePath: string;
|
|
13
|
-
sourceMode: WorkingTreeSourceMode;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* `projectedFiles` records what the synthesis read for every visible entry
|
|
17
|
-
* (merge hydration's basis for "changed since projection"). A `stale_rewrite`
|
|
18
|
-
* result means the checkout holds, at the listed paths, exactly the bytes the
|
|
19
|
-
* last hydration replaced; nothing was merged and the mount must stay pinned.
|
|
20
|
-
*/
|
|
21
|
-
export type WorkspaceMergeProjectionResult = {
|
|
22
|
-
kind: "clean";
|
|
23
|
-
resultTree: string;
|
|
24
|
-
oursCommit: string;
|
|
25
|
-
projectedFiles: Record<string, ProjectedWorkingTreeEntry>;
|
|
26
|
-
readAtMs: number;
|
|
27
|
-
/** Ledger paths whose checkout content moved on from both the replaced and the basis bytes (or that are gone). */
|
|
28
|
-
staleRewriteCleared: string[];
|
|
29
|
-
/**
|
|
30
|
-
* Ledger paths a process alive across their hydration rewrote, merged
|
|
31
|
-
* here against what that process read (docs/merge-hydration-design.md
|
|
32
|
-
* §3.1): the checkout still holds the process's bytes, so the mount must
|
|
33
|
-
* be hydrated from the merged result even where its receipt is current.
|
|
34
|
-
*/
|
|
35
|
-
ledgerMergedPaths: string[];
|
|
36
|
-
} | {
|
|
37
|
-
kind: "conflict";
|
|
38
|
-
oursCommit: string;
|
|
39
|
-
conflictPaths: string[];
|
|
40
|
-
error: string;
|
|
41
|
-
projectedFiles: Record<string, ProjectedWorkingTreeEntry>;
|
|
42
|
-
readAtMs: number;
|
|
43
|
-
staleRewriteCleared: string[];
|
|
44
|
-
ledgerMergedPaths: string[];
|
|
45
|
-
} | {
|
|
46
|
-
kind: "stale_rewrite";
|
|
47
|
-
paths: string[];
|
|
48
|
-
staleRewriteCleared: string[];
|
|
49
|
-
};
|
|
50
|
-
declare function gitVersionIsSupported(version: string): boolean;
|
|
51
|
-
export declare function workspaceMergeProjectionSupport(): WorkspaceMergeProjectionSupport;
|
|
52
|
-
export declare function mergeWorkspaceProjectionMount(input: {
|
|
53
|
-
workspacePath: string;
|
|
54
|
-
mount: WorkspaceMergeProjectionMount;
|
|
55
|
-
basisHead: string;
|
|
56
|
-
currentHead: string;
|
|
57
|
-
attemptId: string;
|
|
58
|
-
hydrationLedger?: Readonly<Record<string, WorkspaceHydrationLedgerEntry>>;
|
|
59
|
-
}): WorkspaceMergeProjectionResult;
|
|
60
|
-
export declare function materializeWorkspaceProjectionTree(input: {
|
|
61
|
-
workspacePath: string;
|
|
62
|
-
workspaceRelativePath: string;
|
|
63
|
-
resultTree: string;
|
|
64
|
-
}): void;
|
|
65
|
-
export declare const workspaceMergeProjectionTestHarness: {
|
|
66
|
-
gitVersionIsSupported: typeof gitVersionIsSupported;
|
|
67
|
-
resetSupportProbe(): void;
|
|
68
|
-
};
|
|
69
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validate every existing path component from a trusted root to a managed
|
|
3
|
-
* directory without following symlinks. Missing suffixes are allowed because
|
|
4
|
-
* hydration and path moves create them after this check.
|
|
5
|
-
*/
|
|
6
|
-
export declare function assertManagedDirectoryPath(input: {
|
|
7
|
-
trustedRoot: string;
|
|
8
|
-
candidate: string;
|
|
9
|
-
label: string;
|
|
10
|
-
}): void;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tracks the mounts whose bytes a workspace filesystem job is reading or
|
|
3
|
-
* writing on the executor thread. The sync engine takes a hold immediately
|
|
4
|
-
* after the busy observation that selected a mount, in the same synchronous
|
|
5
|
-
* stretch, and releases it when the job's result or failure arrives. Command
|
|
6
|
-
* admission waits on the fence before reserving a mount, so no tracked
|
|
7
|
-
* process, PTY or file operation can start in a mount while a job owns it,
|
|
8
|
-
* and no job can start on a mount a command already reserved (that mount was
|
|
9
|
-
* busy at the observation). Holds are counted per mount; overlapping holds
|
|
10
|
-
* (a recovery pass and a projection of the same mount cannot overlap under the
|
|
11
|
-
* mutation gate, but counting keeps the fence correct regardless) release in
|
|
12
|
-
* any order.
|
|
13
|
-
*/
|
|
14
|
-
export type WorkspaceMountHoldRelease = () => void;
|
|
15
|
-
export declare class WorkspaceMountHoldAbortedError extends Error {
|
|
16
|
-
constructor(reason: string);
|
|
17
|
-
}
|
|
18
|
-
export declare class WorkspaceMountHoldFence {
|
|
19
|
-
private readonly holds;
|
|
20
|
-
private readonly waiters;
|
|
21
|
-
private readonly now;
|
|
22
|
-
constructor(options?: {
|
|
23
|
-
now?: () => number;
|
|
24
|
-
});
|
|
25
|
-
/** Take one hold on every listed mount; the returned release is idempotent. */
|
|
26
|
-
hold(mountIds: readonly string[], description: string): WorkspaceMountHoldRelease;
|
|
27
|
-
isHeld(mountIds: readonly string[]): boolean;
|
|
28
|
-
/** Human-readable holder of the first held mount among `mountIds`, for diagnostics. */
|
|
29
|
-
describeHold(mountIds: readonly string[]): string | null;
|
|
30
|
-
/** Every held mount id, sorted, for status reporting. */
|
|
31
|
-
heldMountIds(): string[];
|
|
32
|
-
/**
|
|
33
|
-
* Resolves in the same turn as the release that leaves none of `mountIds`
|
|
34
|
-
* held, so the caller can re-check and reserve without an interleaving
|
|
35
|
-
* hold. Resolves immediately when nothing is held. Rejects with
|
|
36
|
-
* WorkspaceMountHoldAbortedError when `signal` aborts first.
|
|
37
|
-
*/
|
|
38
|
-
waitForRelease(mountIds: readonly string[], options?: {
|
|
39
|
-
signal?: AbortSignal;
|
|
40
|
-
}): Promise<void>;
|
|
41
|
-
private wake;
|
|
42
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export type WorkspaceMutationLease = () => void;
|
|
2
|
-
/**
|
|
3
|
-
* Coordinates project worktrees with the outer workspace Git clone.
|
|
4
|
-
*
|
|
5
|
-
* Ordinary worktree activity may overlap other ordinary activity, but a sync
|
|
6
|
-
* gets exclusive access. Once a sync is queued, later ordinary mutations wait
|
|
7
|
-
* behind it so a queued sync cannot be starved by later short mutations.
|
|
8
|
-
*
|
|
9
|
-
* Branch creation and deletion use their own lane: a branch mutation never
|
|
10
|
-
* waits behind a queued sync, only behind a sync that is already running.
|
|
11
|
-
* Every sync still gets exclusive access, so hydration cannot overlap a
|
|
12
|
-
* worktree being created or removed; the lane only decides ordering between
|
|
13
|
-
* cycles. Branch operations are short and rare, so the queued sync they
|
|
14
|
-
* step in front of waits at most their own duration. Without the lane a
|
|
15
|
-
* branch operation queued behind a backlog of syncs waited for every one of
|
|
16
|
-
* them, outlived the server's operation timeout, and then ran anyway against
|
|
17
|
-
* a request the server had already rolled back.
|
|
18
|
-
*
|
|
19
|
-
* Long-running project commands do not enter this gate; outer-workspace
|
|
20
|
-
* remediation commands do because they operate on the sync clone itself.
|
|
21
|
-
*/
|
|
22
|
-
export declare class WorkspaceMutationGate {
|
|
23
|
-
private activeMutations;
|
|
24
|
-
private syncActive;
|
|
25
|
-
private readonly waiters;
|
|
26
|
-
acquireMutation(): Promise<WorkspaceMutationLease>;
|
|
27
|
-
runMutation<T>(operation: () => Promise<T> | T): Promise<T>;
|
|
28
|
-
runSync<T>(operation: () => Promise<T> | T): Promise<T>;
|
|
29
|
-
/** A worktree create/delete lease; see the branch lane in the class comment. */
|
|
30
|
-
acquireBranchMutation(): Promise<WorkspaceMutationLease>;
|
|
31
|
-
runBranchMutation<T>(operation: () => Promise<T> | T): Promise<T>;
|
|
32
|
-
/**
|
|
33
|
-
* Operations a branch mutation requested now would wait for: the running
|
|
34
|
-
* sync, if any, plus branch mutations queued behind it. Zero means it runs
|
|
35
|
-
* at once. Ordinary waiters are not counted because the branch lane admits
|
|
36
|
-
* ahead of them.
|
|
37
|
-
*/
|
|
38
|
-
branchMutationQueuePosition(): number;
|
|
39
|
-
private drain;
|
|
40
|
-
private releaseMutation;
|
|
41
|
-
private releaseSync;
|
|
42
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type ProjectCheckoutPathMoveBranch = {
|
|
2
|
-
branchName: string;
|
|
3
|
-
outerWorkspaceRelativePath: string;
|
|
4
|
-
};
|
|
5
|
-
export declare function checkoutPathMovePublicationComplete(requiredMountIds: readonly string[], activeMountIds: ReadonlySet<string>): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Move the project checkout location without making its old root the only copy
|
|
8
|
-
* of dirty or ignored working state. The canonical outer tree receives the
|
|
9
|
-
* Git-visible projection, while the new root receives every non-.git byte so
|
|
10
|
-
* repository activation can reconstruct Git metadata without losing local
|
|
11
|
-
* files. Both copies are stable before the obsolete worktree root is removed.
|
|
12
|
-
*/
|
|
13
|
-
export declare function preserveProjectCheckoutPathMove(input: {
|
|
14
|
-
oldProjectRoot: string;
|
|
15
|
-
newProjectRoot: string;
|
|
16
|
-
projectsDurabilityRoot: string;
|
|
17
|
-
outerWorkspaceRoot: string;
|
|
18
|
-
branches: readonly ProjectCheckoutPathMoveBranch[];
|
|
19
|
-
}): {
|
|
20
|
-
preservedBranchNames: string[];
|
|
21
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type WorkerProjectBranchDisposition = "active" | "creator_local" | "preserve_only";
|
|
2
|
-
/** Name equality never grants creator authority across branch incarnations. */
|
|
3
|
-
export declare function creatorLocalProjectBranchIsAuthorized(input: {
|
|
4
|
-
pendingBranchId: string | undefined;
|
|
5
|
-
preserveOnlyBranchId: string | undefined;
|
|
6
|
-
}): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* A globally pending branch is executable only on the worker that durably
|
|
9
|
-
* recorded its local creation. Every other worker treats the same protocol
|
|
10
|
-
* entry as preservation metadata, never as a checkout target.
|
|
11
|
-
*/
|
|
12
|
-
export declare function workerProjectBranchDisposition(input: {
|
|
13
|
-
activeConfigured: boolean;
|
|
14
|
-
locallyPendingCreated: boolean;
|
|
15
|
-
}): WorkerProjectBranchDisposition;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
type ProjectTarget = {
|
|
2
|
-
type: "project";
|
|
3
|
-
projectId: string;
|
|
4
|
-
};
|
|
5
|
-
type WorkspaceTarget = {
|
|
6
|
-
type: "workspace";
|
|
7
|
-
rootProfile: "visible_projects" | "canonical_sync";
|
|
8
|
-
};
|
|
9
|
-
type ProjectConfiguration = {
|
|
10
|
-
projectId: string;
|
|
11
|
-
};
|
|
12
|
-
type ProjectConfigurationWithBranches = ProjectConfiguration & {
|
|
13
|
-
executionDisabled?: boolean;
|
|
14
|
-
branches: readonly {
|
|
15
|
-
branchName: string;
|
|
16
|
-
}[];
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Every executable checkout of a configuration whose reconciliation did not
|
|
20
|
-
* run. Frozen projects expose neither ready nor pending execution targets, so
|
|
21
|
-
* the report stays inside the server's executable checkout ledger.
|
|
22
|
-
*/
|
|
23
|
-
export declare function deferredProjectConfigurationPendingBranches(projects: readonly ProjectConfigurationWithBranches[]): Array<{
|
|
24
|
-
projectId: string;
|
|
25
|
-
branchName: string;
|
|
26
|
-
}>;
|
|
27
|
-
export type BusyProjectConfigurationChangeReason = "added" | "removed" | "initializing" | "changed";
|
|
28
|
-
export type BusyProjectConfigurationChange = {
|
|
29
|
-
projectId: string;
|
|
30
|
-
reason: BusyProjectConfigurationChangeReason;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Identify configuration changes that would touch a project while visible
|
|
34
|
-
* checkout activity is active or reserved. A visible-projects target covers
|
|
35
|
-
* every project; canonical-sync activity is isolated in the outer clone. The
|
|
36
|
-
* reason names why the busy project cannot take the configuration now, so a
|
|
37
|
-
* deferral can be diagnosed without reconstructing both generations.
|
|
38
|
-
*/
|
|
39
|
-
export declare function busyProjectConfigurationChanges<TProject extends ProjectConfiguration>(input: {
|
|
40
|
-
currentProjects: readonly TProject[];
|
|
41
|
-
incomingProjects: readonly TProject[];
|
|
42
|
-
activeTargets: Iterable<ProjectTarget | WorkspaceTarget>;
|
|
43
|
-
currentFingerprint: (project: TProject) => string;
|
|
44
|
-
incomingFingerprint: (project: TProject) => string;
|
|
45
|
-
currentProjectReady: (project: TProject) => boolean;
|
|
46
|
-
}): BusyProjectConfigurationChange[];
|
|
47
|
-
export declare function describeBusyProjectConfigurationChanges(changes: readonly BusyProjectConfigurationChange[]): string;
|
|
48
|
-
export {};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export type WorkspaceProjectionLedgerMount = {
|
|
2
|
-
id: string;
|
|
3
|
-
/** Durable logical incarnation; a re-created branch never matches its predecessor's record. */
|
|
4
|
-
hydrationIncarnationKey: string;
|
|
5
|
-
mutationToken?: () => string;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Remembers, per mount incarnation, the visible-mutation token observed when
|
|
9
|
-
* the mount was last projected into the outer clone by a completed cycle,
|
|
10
|
-
* together with that cycle's result.
|
|
11
|
-
*
|
|
12
|
-
* Two decisions read it. A cycle skips mirroring a mount whose token is
|
|
13
|
-
* unchanged, because its outer subtree already carries those bytes. A
|
|
14
|
-
* request that targets a project checkout is answered with the previous
|
|
15
|
-
* cycle's result, without running a cycle, when no mount's token moved since
|
|
16
|
-
* that cycle. Both are cross-cycle skips only; the within-cycle busy and
|
|
17
|
-
* token re-checks in the sync engine stay as they are.
|
|
18
|
-
*
|
|
19
|
-
* The ledger is reset whenever something other than a recorded visible
|
|
20
|
-
* mutation can change checkout bytes: workspace configuration, canonical
|
|
21
|
-
* reset, outer remediation, branch creation or deletion, and any cycle that
|
|
22
|
-
* failed or ended in a conflict.
|
|
23
|
-
*/
|
|
24
|
-
export declare class WorkspaceProjectionLedger<Result extends {
|
|
25
|
-
outcome: string;
|
|
26
|
-
}> {
|
|
27
|
-
private readonly projectedTokens;
|
|
28
|
-
private lastCycle;
|
|
29
|
-
private static recordKey;
|
|
30
|
-
get lastCycleResult(): Result | null;
|
|
31
|
-
lastProjectedToken(mount: {
|
|
32
|
-
id: string;
|
|
33
|
-
hydrationIncarnationKey: string;
|
|
34
|
-
}): string | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Record a completed cycle. `projectedMutationTokens` names the token each
|
|
37
|
-
* active mount carried when the cycle projected it; a mount absent from it
|
|
38
|
-
* keeps its earlier record. Any outcome that leaves the outer clone without
|
|
39
|
-
* a trustworthy projection clears the ledger.
|
|
40
|
-
*/
|
|
41
|
-
recordCycle(input: {
|
|
42
|
-
result: Result;
|
|
43
|
-
mounts: readonly WorkspaceProjectionLedgerMount[];
|
|
44
|
-
projectedMutationTokens: Readonly<Record<string, string>> | undefined;
|
|
45
|
-
}): void;
|
|
46
|
-
reset(): void;
|
|
47
|
-
/**
|
|
48
|
-
* The previous cycle's result when every request targets a configured
|
|
49
|
-
* mount and no mount's token moved since its recorded projection. A request
|
|
50
|
-
* without a target (a workspace-rooted command may touch any checkout), a
|
|
51
|
-
* mount without a token (a pending deletion), or pending deletion work all
|
|
52
|
-
* require a real cycle.
|
|
53
|
-
*/
|
|
54
|
-
answerFromLastCycle(input: {
|
|
55
|
-
targetMountIds: ReadonlyArray<string | null>;
|
|
56
|
-
mounts: readonly WorkspaceProjectionLedgerMount[];
|
|
57
|
-
pendingDeletions: boolean;
|
|
58
|
-
}): Result | null;
|
|
59
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type ProjectBranchPublicationEvidence = {
|
|
2
|
-
branchId: string;
|
|
3
|
-
projectId: string;
|
|
4
|
-
branchName: string;
|
|
5
|
-
};
|
|
6
|
-
/** Select only branch mounts that completed this synchronization cycle. */
|
|
7
|
-
export declare function activeProjectBranchNames(projectId: string, branchNames: readonly string[], activeMountIds: readonly string[]): string[];
|
|
8
|
-
/** Bind physical active mounts to the exact configured branch-row snapshot. */
|
|
9
|
-
export declare function activeProjectBranchPublicationEvidence(projects: readonly {
|
|
10
|
-
projectId: string;
|
|
11
|
-
executionDisabled?: boolean;
|
|
12
|
-
mirrorWritesDisabled?: boolean;
|
|
13
|
-
branches: readonly {
|
|
14
|
-
branchId: string;
|
|
15
|
-
branchName: string;
|
|
16
|
-
}[];
|
|
17
|
-
}[], activeMountIds: readonly string[]): ProjectBranchPublicationEvidence[];
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Batches ordinary workspace synchronization requests into one exclusive
|
|
3
|
-
* cycle each. A request that arrives while a batch is queued but not yet
|
|
4
|
-
* running joins that batch; a request that arrives while a batch is running
|
|
5
|
-
* opens the next one, because the running cycle may have selected its mounts
|
|
6
|
-
* before the request's command finished. Every request in a batch receives
|
|
7
|
-
* the same settlement, and the caller fans that out per attempt.
|
|
8
|
-
*
|
|
9
|
-
* Before this, every finished command queued its own full cycle behind every
|
|
10
|
-
* earlier one, so queue time grew without bound under a steady arrival rate
|
|
11
|
-
* even though each cycle finished in seconds.
|
|
12
|
-
*/
|
|
13
|
-
export declare class WorkspaceSyncCoalescer<Request, Settlement> {
|
|
14
|
-
private readonly options;
|
|
15
|
-
private pendingBatch;
|
|
16
|
-
private batchesStarted;
|
|
17
|
-
constructor(options: {
|
|
18
|
-
/** The exclusive sync lease; the batch body runs inside it. */
|
|
19
|
-
runExclusive: <T>(operation: () => Promise<T>) => Promise<T>;
|
|
20
|
-
/** Runs (or answers without running) one cycle for the whole batch. */
|
|
21
|
-
runBatch: (requests: readonly Request[]) => Promise<Settlement>;
|
|
22
|
-
});
|
|
23
|
-
/** Requests attached to the batch that has not started yet. */
|
|
24
|
-
get queuedRequestCount(): number;
|
|
25
|
-
/** Batches whose body has been entered, whether or not they ran a cycle. */
|
|
26
|
-
get startedBatchCount(): number;
|
|
27
|
-
request(request: Request): Promise<Settlement>;
|
|
28
|
-
}
|
|
File without changes
|