@ricsam/r5d-worker 0.0.136 → 0.0.138
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 -7537
- 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 +328 -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 +17 -0
- package/dist/types/runtime/daemon.d.ts +8 -0
- package/dist/types/runtime/executor.d.ts +35 -0
- package/dist/types/runtime/index.d.ts +5 -0
- package/dist/types/runtime/protocol.d.ts +544 -0
- package/dist/types/runtime/pty.d.ts +30 -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/storage.d.ts +21 -0
- package/dist/types/runtime/test-harness.d.ts +53 -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 -7511
- 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 -3450
- package/dist/cjs/workspace-hydration-ledger.cjs +0 -66
- package/dist/cjs/workspace-hydration-merge.cjs +0 -433
- 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 -467
- 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 -3407
- package/dist/mjs/workspace-hydration-ledger.mjs +0 -42
- package/dist/mjs/workspace-hydration-merge.mjs +0 -399
- 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 -433
- 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-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 -288
- package/dist/types/workspace-filesystem-jobs.d.ts +0 -7
- package/dist/types/workspace-git-sync.d.ts +0 -495
- package/dist/types/workspace-hydration-ledger.d.ts +0 -43
- package/dist/types/workspace-hydration-merge.d.ts +0 -95
- 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 -60
- 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/adapter.d.ts} +0 -0
- /package/dist/types/{recovery-journal-stall-fixture.d.ts → runtime/releases/main.d.ts} +0 -0
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var workspace_mutation_gate_exports = {};
|
|
20
|
-
__export(workspace_mutation_gate_exports, {
|
|
21
|
-
WorkspaceMutationGate: () => WorkspaceMutationGate
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(workspace_mutation_gate_exports);
|
|
24
|
-
class WorkspaceMutationGate {
|
|
25
|
-
activeMutations = 0;
|
|
26
|
-
syncActive = false;
|
|
27
|
-
waiters = [];
|
|
28
|
-
acquireMutation() {
|
|
29
|
-
return new Promise((resolve) => {
|
|
30
|
-
this.waiters.push({ kind: "mutation", resolve });
|
|
31
|
-
this.drain();
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
async runMutation(operation) {
|
|
35
|
-
const release = await this.acquireMutation();
|
|
36
|
-
try {
|
|
37
|
-
return await operation();
|
|
38
|
-
} finally {
|
|
39
|
-
release();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
async runSync(operation) {
|
|
43
|
-
const release = await new Promise((resolve) => {
|
|
44
|
-
this.waiters.push({ kind: "sync", resolve });
|
|
45
|
-
this.drain();
|
|
46
|
-
});
|
|
47
|
-
try {
|
|
48
|
-
return await operation();
|
|
49
|
-
} finally {
|
|
50
|
-
release();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/** A worktree create/delete lease; see the branch lane in the class comment. */
|
|
54
|
-
acquireBranchMutation() {
|
|
55
|
-
return new Promise((resolve) => {
|
|
56
|
-
this.waiters.push({ kind: "branch", resolve });
|
|
57
|
-
this.drain();
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
async runBranchMutation(operation) {
|
|
61
|
-
const release = await this.acquireBranchMutation();
|
|
62
|
-
try {
|
|
63
|
-
return await operation();
|
|
64
|
-
} finally {
|
|
65
|
-
release();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Operations a branch mutation requested now would wait for: the running
|
|
70
|
-
* sync, if any, plus branch mutations queued behind it. Zero means it runs
|
|
71
|
-
* at once. Ordinary waiters are not counted because the branch lane admits
|
|
72
|
-
* ahead of them.
|
|
73
|
-
*/
|
|
74
|
-
branchMutationQueuePosition() {
|
|
75
|
-
if (!this.syncActive) return 0;
|
|
76
|
-
return 1 + this.waiters.filter((waiter) => waiter.kind === "branch").length;
|
|
77
|
-
}
|
|
78
|
-
drain() {
|
|
79
|
-
if (this.syncActive || this.waiters.length === 0) return;
|
|
80
|
-
for (let index = 0; index < this.waiters.length; ) {
|
|
81
|
-
const waiter = this.waiters[index];
|
|
82
|
-
if (waiter?.kind !== "branch") {
|
|
83
|
-
index += 1;
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
this.waiters.splice(index, 1);
|
|
87
|
-
this.activeMutations += 1;
|
|
88
|
-
waiter.resolve(this.releaseMutation());
|
|
89
|
-
}
|
|
90
|
-
const first = this.waiters[0];
|
|
91
|
-
if (first?.kind === "sync") {
|
|
92
|
-
if (this.activeMutations > 0) return;
|
|
93
|
-
this.waiters.shift();
|
|
94
|
-
this.syncActive = true;
|
|
95
|
-
first.resolve(this.releaseSync());
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
while (this.waiters[0]?.kind === "mutation") {
|
|
99
|
-
const waiter = this.waiters.shift();
|
|
100
|
-
if (!waiter || waiter.kind !== "mutation") break;
|
|
101
|
-
this.activeMutations += 1;
|
|
102
|
-
waiter.resolve(this.releaseMutation());
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
releaseMutation() {
|
|
106
|
-
let released = false;
|
|
107
|
-
return () => {
|
|
108
|
-
if (released) return;
|
|
109
|
-
released = true;
|
|
110
|
-
this.activeMutations -= 1;
|
|
111
|
-
this.drain();
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
releaseSync() {
|
|
115
|
-
let released = false;
|
|
116
|
-
return () => {
|
|
117
|
-
if (released) return;
|
|
118
|
-
released = true;
|
|
119
|
-
this.syncActive = false;
|
|
120
|
-
this.drain();
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
-
0 && (module.exports = {
|
|
126
|
-
WorkspaceMutationGate
|
|
127
|
-
});
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var workspace_path_move_exports = {};
|
|
30
|
-
__export(workspace_path_move_exports, {
|
|
31
|
-
checkoutPathMovePublicationComplete: () => checkoutPathMovePublicationComplete,
|
|
32
|
-
preserveProjectCheckoutPathMove: () => preserveProjectCheckoutPathMove
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(workspace_path_move_exports);
|
|
35
|
-
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
36
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
37
|
-
var import_node_crypto = require("node:crypto");
|
|
38
|
-
var import_project_worktrees = require("./project-worktrees.cjs");
|
|
39
|
-
var import_managed_paths = require("./managed-paths.cjs");
|
|
40
|
-
var import_working_tree_mirror = require("./working-tree-mirror.cjs");
|
|
41
|
-
var import_workspace_mount_boundary = require("./workspace-mount-boundary.cjs");
|
|
42
|
-
function checkoutPathMovePublicationComplete(requiredMountIds, activeMountIds) {
|
|
43
|
-
return requiredMountIds.length > 0 && requiredMountIds.every((mountId) => activeMountIds.has(mountId));
|
|
44
|
-
}
|
|
45
|
-
function pathIsInside(root, candidate) {
|
|
46
|
-
const relative = import_node_path.default.relative(import_node_path.default.resolve(root), import_node_path.default.resolve(candidate));
|
|
47
|
-
return relative !== "" && relative !== ".." && !relative.startsWith(`..${import_node_path.default.sep}`) && !import_node_path.default.isAbsolute(relative);
|
|
48
|
-
}
|
|
49
|
-
function fsyncTree(targetPath) {
|
|
50
|
-
const stat = import_node_fs.default.lstatSync(targetPath);
|
|
51
|
-
if (stat.isSymbolicLink()) return;
|
|
52
|
-
if (stat.isDirectory()) {
|
|
53
|
-
for (const entry of import_node_fs.default.readdirSync(targetPath).sort()) fsyncTree(import_node_path.default.join(targetPath, entry));
|
|
54
|
-
}
|
|
55
|
-
if (!stat.isDirectory() && !stat.isFile()) return;
|
|
56
|
-
const descriptor = import_node_fs.default.openSync(targetPath, "r");
|
|
57
|
-
try {
|
|
58
|
-
import_node_fs.default.fsyncSync(descriptor);
|
|
59
|
-
} finally {
|
|
60
|
-
import_node_fs.default.closeSync(descriptor);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function fsyncDirectory(directoryPath) {
|
|
64
|
-
const descriptor = import_node_fs.default.openSync(directoryPath, "r");
|
|
65
|
-
try {
|
|
66
|
-
import_node_fs.default.fsyncSync(descriptor);
|
|
67
|
-
} finally {
|
|
68
|
-
import_node_fs.default.closeSync(descriptor);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function fsyncAncestorsToRoot(targetPath, durabilityRoot) {
|
|
72
|
-
const root = import_node_path.default.resolve(durabilityRoot);
|
|
73
|
-
let current = import_node_path.default.dirname(import_node_path.default.resolve(targetPath));
|
|
74
|
-
while (true) {
|
|
75
|
-
if (import_node_fs.default.existsSync(current)) {
|
|
76
|
-
const status = import_node_fs.default.lstatSync(current);
|
|
77
|
-
if (!status.isDirectory() || status.isSymbolicLink()) {
|
|
78
|
-
throw new Error(`Project checkout path move durability boundary is not a regular directory: ${current}`);
|
|
79
|
-
}
|
|
80
|
-
fsyncDirectory(current);
|
|
81
|
-
}
|
|
82
|
-
if (current === root) return;
|
|
83
|
-
const parent = import_node_path.default.dirname(current);
|
|
84
|
-
if (parent === current) throw new Error(`Project checkout path move escapes durability root ${root}`);
|
|
85
|
-
current = parent;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function stableTree(targetPath, durabilityRoot) {
|
|
89
|
-
fsyncTree(targetPath);
|
|
90
|
-
fsyncAncestorsToRoot(targetPath, durabilityRoot);
|
|
91
|
-
}
|
|
92
|
-
function directoryEntryExists(targetPath) {
|
|
93
|
-
try {
|
|
94
|
-
import_node_fs.default.lstatSync(targetPath);
|
|
95
|
-
return true;
|
|
96
|
-
} catch (error) {
|
|
97
|
-
if (error.code === "ENOENT") return false;
|
|
98
|
-
throw error;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function retiredCheckoutPath(projectsDurabilityRoot, oldProjectRoot) {
|
|
102
|
-
const storageRoot = import_node_path.default.join(projectsDurabilityRoot, ".r5d-retired-checkouts");
|
|
103
|
-
const digest = (0, import_node_crypto.createHash)("sha256").update(oldProjectRoot).digest("hex");
|
|
104
|
-
return { storageRoot, retiredRoot: import_node_path.default.join(storageRoot, digest) };
|
|
105
|
-
}
|
|
106
|
-
function removeRetiredCheckout(retiredRoot, storageRoot) {
|
|
107
|
-
if (!directoryEntryExists(retiredRoot)) return;
|
|
108
|
-
import_node_fs.default.rmSync(retiredRoot, { recursive: true, force: true });
|
|
109
|
-
fsyncDirectory(storageRoot);
|
|
110
|
-
}
|
|
111
|
-
function preserveProjectCheckoutPathMove(input) {
|
|
112
|
-
const oldProjectRoot = import_node_path.default.resolve(input.oldProjectRoot);
|
|
113
|
-
const newProjectRoot = import_node_path.default.resolve(input.newProjectRoot);
|
|
114
|
-
const projectsDurabilityRoot = import_node_path.default.resolve(input.projectsDurabilityRoot);
|
|
115
|
-
const outerWorkspaceRoot = import_node_path.default.resolve(input.outerWorkspaceRoot);
|
|
116
|
-
if (oldProjectRoot === newProjectRoot || pathIsInside(oldProjectRoot, newProjectRoot) || pathIsInside(newProjectRoot, oldProjectRoot)) {
|
|
117
|
-
throw new Error("Project checkout path move roots overlap");
|
|
118
|
-
}
|
|
119
|
-
const branchNames = input.branches.map(({ branchName }) => branchName);
|
|
120
|
-
if (branchNames.length === 0 || new Set(branchNames).size !== branchNames.length) {
|
|
121
|
-
throw new Error("Project checkout path move requires unique branches");
|
|
122
|
-
}
|
|
123
|
-
(0, import_workspace_mount_boundary.assertManagedDirectoryPath)({
|
|
124
|
-
trustedRoot: projectsDurabilityRoot,
|
|
125
|
-
candidate: oldProjectRoot,
|
|
126
|
-
label: "Old project checkout root"
|
|
127
|
-
});
|
|
128
|
-
(0, import_workspace_mount_boundary.assertManagedDirectoryPath)({
|
|
129
|
-
trustedRoot: projectsDurabilityRoot,
|
|
130
|
-
candidate: newProjectRoot,
|
|
131
|
-
label: "New project checkout root"
|
|
132
|
-
});
|
|
133
|
-
for (const branchName of branchNames) (0, import_managed_paths.validateManagedBranchName)(branchName);
|
|
134
|
-
if (directoryEntryExists(oldProjectRoot)) {
|
|
135
|
-
(0, import_working_tree_mirror.assertWorkingTreeHasNoPortableGitMetadataAliases)(oldProjectRoot);
|
|
136
|
-
}
|
|
137
|
-
const { storageRoot: retirementStorageRoot, retiredRoot } = retiredCheckoutPath(projectsDurabilityRoot, oldProjectRoot);
|
|
138
|
-
(0, import_workspace_mount_boundary.assertManagedDirectoryPath)({
|
|
139
|
-
trustedRoot: projectsDurabilityRoot,
|
|
140
|
-
candidate: retirementStorageRoot,
|
|
141
|
-
label: "Retired project checkout storage"
|
|
142
|
-
});
|
|
143
|
-
import_node_fs.default.mkdirSync(retirementStorageRoot, { recursive: true, mode: 448 });
|
|
144
|
-
(0, import_workspace_mount_boundary.assertManagedDirectoryPath)({
|
|
145
|
-
trustedRoot: projectsDurabilityRoot,
|
|
146
|
-
candidate: retirementStorageRoot,
|
|
147
|
-
label: "Retired project checkout storage"
|
|
148
|
-
});
|
|
149
|
-
fsyncDirectory(retirementStorageRoot);
|
|
150
|
-
fsyncDirectory(projectsDurabilityRoot);
|
|
151
|
-
(0, import_workspace_mount_boundary.assertManagedDirectoryPath)({
|
|
152
|
-
trustedRoot: projectsDurabilityRoot,
|
|
153
|
-
candidate: retiredRoot,
|
|
154
|
-
label: "Retired project checkout"
|
|
155
|
-
});
|
|
156
|
-
removeRetiredCheckout(retiredRoot, retirementStorageRoot);
|
|
157
|
-
if (!directoryEntryExists(oldProjectRoot)) return { preservedBranchNames: [] };
|
|
158
|
-
const preservedBranchNames = [];
|
|
159
|
-
for (const branch of input.branches) {
|
|
160
|
-
(0, import_managed_paths.validateManagedBranchName)(branch.branchName);
|
|
161
|
-
const oldBranchPath = import_node_path.default.join(oldProjectRoot, ...branch.branchName.split("/"));
|
|
162
|
-
if (!import_node_fs.default.existsSync(oldBranchPath)) continue;
|
|
163
|
-
const newBranchPath = import_node_path.default.join(newProjectRoot, ...branch.branchName.split("/"));
|
|
164
|
-
const outerBranchPath = import_node_path.default.resolve(outerWorkspaceRoot, ...branch.outerWorkspaceRelativePath.replace(/\\/g, "/").split("/"));
|
|
165
|
-
if (!pathIsInside(outerWorkspaceRoot, outerBranchPath)) {
|
|
166
|
-
throw new Error(`Project checkout path move escapes the outer workspace: ${branch.outerWorkspaceRelativePath}`);
|
|
167
|
-
}
|
|
168
|
-
(0, import_workspace_mount_boundary.assertManagedDirectoryPath)({ trustedRoot: projectsDurabilityRoot, candidate: oldBranchPath, label: "Old project checkout branch" });
|
|
169
|
-
(0, import_workspace_mount_boundary.assertManagedDirectoryPath)({ trustedRoot: projectsDurabilityRoot, candidate: newBranchPath, label: "New project checkout branch" });
|
|
170
|
-
(0, import_workspace_mount_boundary.assertManagedDirectoryPath)({ trustedRoot: outerWorkspaceRoot, candidate: outerBranchPath, label: "Outer workspace branch" });
|
|
171
|
-
(0, import_working_tree_mirror.mirrorWorkingTree)({ sourceRoot: oldBranchPath, targetRoot: outerBranchPath, sourceMode: "git", deletionMode: "all" });
|
|
172
|
-
(0, import_working_tree_mirror.mirrorWorkingTree)({ sourceRoot: oldBranchPath, targetRoot: newBranchPath, sourceMode: "all", deletionMode: "all" });
|
|
173
|
-
(0, import_workspace_mount_boundary.assertManagedDirectoryPath)({ trustedRoot: projectsDurabilityRoot, candidate: newBranchPath, label: "New project checkout branch" });
|
|
174
|
-
(0, import_workspace_mount_boundary.assertManagedDirectoryPath)({ trustedRoot: outerWorkspaceRoot, candidate: outerBranchPath, label: "Outer workspace branch" });
|
|
175
|
-
stableTree(outerBranchPath, outerWorkspaceRoot);
|
|
176
|
-
stableTree(newBranchPath, projectsDurabilityRoot);
|
|
177
|
-
preservedBranchNames.push(branch.branchName);
|
|
178
|
-
}
|
|
179
|
-
for (const branchName of branchNames) {
|
|
180
|
-
const checkoutPath = import_node_path.default.join(oldProjectRoot, ...branchName.split("/"));
|
|
181
|
-
if (import_node_fs.default.existsSync(checkoutPath) && (0, import_project_worktrees.projectWorktreeOperationInProgress)(checkoutPath)) {
|
|
182
|
-
throw new Error(`Project branch ${branchName} has an in-progress Git operation`);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
import_node_fs.default.renameSync(oldProjectRoot, retiredRoot);
|
|
186
|
-
fsyncAncestorsToRoot(oldProjectRoot, projectsDurabilityRoot);
|
|
187
|
-
fsyncDirectory(retirementStorageRoot);
|
|
188
|
-
removeRetiredCheckout(retiredRoot, retirementStorageRoot);
|
|
189
|
-
return { preservedBranchNames: preservedBranchNames.sort() };
|
|
190
|
-
}
|
|
191
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
192
|
-
0 && (module.exports = {
|
|
193
|
-
checkoutPathMovePublicationComplete,
|
|
194
|
-
preserveProjectCheckoutPathMove
|
|
195
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var workspace_preserve_only_policy_exports = {};
|
|
20
|
-
__export(workspace_preserve_only_policy_exports, {
|
|
21
|
-
creatorLocalProjectBranchIsAuthorized: () => creatorLocalProjectBranchIsAuthorized,
|
|
22
|
-
workerProjectBranchDisposition: () => workerProjectBranchDisposition
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(workspace_preserve_only_policy_exports);
|
|
25
|
-
function creatorLocalProjectBranchIsAuthorized(input) {
|
|
26
|
-
return Boolean(input.pendingBranchId && (!input.preserveOnlyBranchId || input.pendingBranchId === input.preserveOnlyBranchId));
|
|
27
|
-
}
|
|
28
|
-
function workerProjectBranchDisposition(input) {
|
|
29
|
-
if (input.activeConfigured) return "active";
|
|
30
|
-
return input.locallyPendingCreated ? "creator_local" : "preserve_only";
|
|
31
|
-
}
|
|
32
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
-
0 && (module.exports = {
|
|
34
|
-
creatorLocalProjectBranchIsAuthorized,
|
|
35
|
-
workerProjectBranchDisposition
|
|
36
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var workspace_project_config_policy_exports = {};
|
|
20
|
-
__export(workspace_project_config_policy_exports, {
|
|
21
|
-
busyProjectConfigurationChanges: () => busyProjectConfigurationChanges,
|
|
22
|
-
deferredProjectConfigurationPendingBranches: () => deferredProjectConfigurationPendingBranches,
|
|
23
|
-
describeBusyProjectConfigurationChanges: () => describeBusyProjectConfigurationChanges
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(workspace_project_config_policy_exports);
|
|
26
|
-
function deferredProjectConfigurationPendingBranches(projects) {
|
|
27
|
-
return projects.filter((project) => !project.executionDisabled).flatMap((project) => project.branches.map(({ branchName }) => ({ projectId: project.projectId, branchName }))).sort((left, right) => left.projectId.localeCompare(right.projectId) || left.branchName.localeCompare(right.branchName));
|
|
28
|
-
}
|
|
29
|
-
function busyProjectConfigurationChanges(input) {
|
|
30
|
-
const currentById = new Map(input.currentProjects.map((project) => [project.projectId, project]));
|
|
31
|
-
const incomingById = new Map(input.incomingProjects.map((project) => [project.projectId, project]));
|
|
32
|
-
const targets = [...input.activeTargets];
|
|
33
|
-
const busyProjectIds = targets.some((target) => target.type === "workspace" && target.rootProfile === "visible_projects") ? /* @__PURE__ */ new Set([...currentById.keys(), ...incomingById.keys()]) : new Set(targets.flatMap((target) => target.type === "project" ? [target.projectId] : []));
|
|
34
|
-
return [...busyProjectIds].flatMap((projectId) => {
|
|
35
|
-
const current = currentById.get(projectId);
|
|
36
|
-
const incoming = incomingById.get(projectId);
|
|
37
|
-
if (!current && !incoming) return [];
|
|
38
|
-
if (!current) return [{ projectId, reason: "added" }];
|
|
39
|
-
if (!incoming) return [{ projectId, reason: "removed" }];
|
|
40
|
-
if (!input.currentProjectReady(current)) return [{ projectId, reason: "initializing" }];
|
|
41
|
-
if (input.currentFingerprint(current) !== input.incomingFingerprint(incoming)) return [{ projectId, reason: "changed" }];
|
|
42
|
-
return [];
|
|
43
|
-
}).sort((left, right) => left.projectId.localeCompare(right.projectId));
|
|
44
|
-
}
|
|
45
|
-
function describeBusyProjectConfigurationChanges(changes) {
|
|
46
|
-
return changes.map(({ projectId, reason }) => `${projectId} (${reason})`).join(", ");
|
|
47
|
-
}
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
busyProjectConfigurationChanges,
|
|
51
|
-
deferredProjectConfigurationPendingBranches,
|
|
52
|
-
describeBusyProjectConfigurationChanges
|
|
53
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var workspace_projection_ledger_exports = {};
|
|
20
|
-
__export(workspace_projection_ledger_exports, {
|
|
21
|
-
WorkspaceProjectionLedger: () => WorkspaceProjectionLedger
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(workspace_projection_ledger_exports);
|
|
24
|
-
const RETAINED_OUTCOMES = /* @__PURE__ */ new Set(["no_change", "updated", "published", "large_diff_blocked"]);
|
|
25
|
-
class WorkspaceProjectionLedger {
|
|
26
|
-
projectedTokens = /* @__PURE__ */ new Map();
|
|
27
|
-
lastCycle = null;
|
|
28
|
-
static recordKey(mount) {
|
|
29
|
-
return `${mount.hydrationIncarnationKey}\0${mount.id}`;
|
|
30
|
-
}
|
|
31
|
-
get lastCycleResult() {
|
|
32
|
-
return this.lastCycle;
|
|
33
|
-
}
|
|
34
|
-
lastProjectedToken(mount) {
|
|
35
|
-
return this.projectedTokens.get(WorkspaceProjectionLedger.recordKey(mount));
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Record a completed cycle. `projectedMutationTokens` names the token each
|
|
39
|
-
* active mount carried when the cycle projected it; a mount absent from it
|
|
40
|
-
* keeps its earlier record. Any outcome that leaves the outer clone without
|
|
41
|
-
* a trustworthy projection clears the ledger.
|
|
42
|
-
*/
|
|
43
|
-
recordCycle(input) {
|
|
44
|
-
if (!RETAINED_OUTCOMES.has(input.result.outcome)) {
|
|
45
|
-
this.reset();
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const mountsById = new Map(input.mounts.map((mount) => [mount.id, mount]));
|
|
49
|
-
for (const [mountId, token] of Object.entries(input.projectedMutationTokens ?? {})) {
|
|
50
|
-
const mount = mountsById.get(mountId);
|
|
51
|
-
if (mount) this.projectedTokens.set(WorkspaceProjectionLedger.recordKey(mount), token);
|
|
52
|
-
}
|
|
53
|
-
this.lastCycle = input.result;
|
|
54
|
-
}
|
|
55
|
-
reset() {
|
|
56
|
-
this.projectedTokens.clear();
|
|
57
|
-
this.lastCycle = null;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* The previous cycle's result when every request targets a configured
|
|
61
|
-
* mount and no mount's token moved since its recorded projection. A request
|
|
62
|
-
* without a target (a workspace-rooted command may touch any checkout), a
|
|
63
|
-
* mount without a token (a pending deletion), or pending deletion work all
|
|
64
|
-
* require a real cycle.
|
|
65
|
-
*/
|
|
66
|
-
answerFromLastCycle(input) {
|
|
67
|
-
if (!this.lastCycle || input.pendingDeletions || input.targetMountIds.length === 0) return null;
|
|
68
|
-
const mountIds = new Set(input.mounts.map(({ id }) => id));
|
|
69
|
-
if (!input.targetMountIds.every((mountId) => mountId !== null && mountIds.has(mountId))) return null;
|
|
70
|
-
for (const mount of input.mounts) {
|
|
71
|
-
if (!mount.mutationToken) return null;
|
|
72
|
-
const recorded = this.projectedTokens.get(WorkspaceProjectionLedger.recordKey(mount));
|
|
73
|
-
if (recorded === void 0 || recorded !== mount.mutationToken()) return null;
|
|
74
|
-
}
|
|
75
|
-
return this.lastCycle;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
-
0 && (module.exports = {
|
|
80
|
-
WorkspaceProjectionLedger
|
|
81
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var workspace_publication_evidence_exports = {};
|
|
20
|
-
__export(workspace_publication_evidence_exports, {
|
|
21
|
-
activeProjectBranchNames: () => activeProjectBranchNames,
|
|
22
|
-
activeProjectBranchPublicationEvidence: () => activeProjectBranchPublicationEvidence
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(workspace_publication_evidence_exports);
|
|
25
|
-
function projectBranchMountId(projectId, branchName) {
|
|
26
|
-
return `project:${projectId}:${encodeURIComponent(branchName)}`;
|
|
27
|
-
}
|
|
28
|
-
function activeProjectBranchNames(projectId, branchNames, activeMountIds) {
|
|
29
|
-
const active = new Set(activeMountIds);
|
|
30
|
-
return [...branchNames].filter((branchName) => active.has(projectBranchMountId(projectId, branchName))).sort((left, right) => left.localeCompare(right));
|
|
31
|
-
}
|
|
32
|
-
function activeProjectBranchPublicationEvidence(projects, activeMountIds) {
|
|
33
|
-
const active = new Set(activeMountIds);
|
|
34
|
-
return projects.flatMap(
|
|
35
|
-
(project) => project.executionDisabled || project.mirrorWritesDisabled ? [] : project.branches.flatMap(
|
|
36
|
-
(branch) => active.has(projectBranchMountId(project.projectId, branch.branchName)) ? [{ branchId: branch.branchId, projectId: project.projectId, branchName: branch.branchName }] : []
|
|
37
|
-
)
|
|
38
|
-
).sort(
|
|
39
|
-
(left, right) => left.projectId.localeCompare(right.projectId) || left.branchName.localeCompare(right.branchName) || left.branchId.localeCompare(right.branchId)
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 && (module.exports = {
|
|
44
|
-
activeProjectBranchNames,
|
|
45
|
-
activeProjectBranchPublicationEvidence
|
|
46
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var workspace_sync_coalescer_exports = {};
|
|
20
|
-
__export(workspace_sync_coalescer_exports, {
|
|
21
|
-
WorkspaceSyncCoalescer: () => WorkspaceSyncCoalescer
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(workspace_sync_coalescer_exports);
|
|
24
|
-
class WorkspaceSyncCoalescer {
|
|
25
|
-
constructor(options) {
|
|
26
|
-
this.options = options;
|
|
27
|
-
}
|
|
28
|
-
options;
|
|
29
|
-
pendingBatch = null;
|
|
30
|
-
batchesStarted = 0;
|
|
31
|
-
/** Requests attached to the batch that has not started yet. */
|
|
32
|
-
get queuedRequestCount() {
|
|
33
|
-
return this.pendingBatch?.requests.length ?? 0;
|
|
34
|
-
}
|
|
35
|
-
/** Batches whose body has been entered, whether or not they ran a cycle. */
|
|
36
|
-
get startedBatchCount() {
|
|
37
|
-
return this.batchesStarted;
|
|
38
|
-
}
|
|
39
|
-
request(request) {
|
|
40
|
-
const queued = this.pendingBatch;
|
|
41
|
-
if (queued) {
|
|
42
|
-
queued.requests.push(request);
|
|
43
|
-
return queued.settlement;
|
|
44
|
-
}
|
|
45
|
-
const batch = { requests: [request], settlement: Promise.resolve() };
|
|
46
|
-
this.pendingBatch = batch;
|
|
47
|
-
batch.settlement = this.options.runExclusive(async () => {
|
|
48
|
-
if (this.pendingBatch === batch) this.pendingBatch = null;
|
|
49
|
-
this.batchesStarted += 1;
|
|
50
|
-
return await this.options.runBatch(batch.requests);
|
|
51
|
-
});
|
|
52
|
-
return batch.settlement;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
-
0 && (module.exports = {
|
|
57
|
-
WorkspaceSyncCoalescer
|
|
58
|
-
});
|