@runweave/server-linux-x64 0.1.6 → 0.1.7
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/manifest.json +514 -14
- package/native.tar.gz +0 -0
- package/package.json +1 -1
- package/payload/app-server/build-info.json +3 -3
- package/payload/app-server/index.cjs +1 -1
- package/payload/backend/build-info.json +4 -4
- package/payload/backend/dev-resources/control.cjs +280 -239
- package/payload/backend/index.cjs +2742 -2217
- package/payload/frontend/dist/build-info.json +3 -3
- package/payload/frontend/dist/companion.html +1 -1
- package/payload/frontend/dist/index.html +1 -1
- package/payload/pty-host/index.cjs +20125 -0
- package/payload/server/index.cjs +8 -0
|
@@ -106,17 +106,17 @@ var require_visit = __commonJS({
|
|
|
106
106
|
visit.BREAK = BREAK;
|
|
107
107
|
visit.SKIP = SKIP;
|
|
108
108
|
visit.REMOVE = REMOVE;
|
|
109
|
-
function visit_(key, node, visitor,
|
|
110
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
109
|
+
function visit_(key, node, visitor, path35) {
|
|
110
|
+
const ctrl = callVisitor(key, node, visitor, path35);
|
|
111
111
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
112
|
-
replaceNode(key,
|
|
113
|
-
return visit_(key, ctrl, visitor,
|
|
112
|
+
replaceNode(key, path35, ctrl);
|
|
113
|
+
return visit_(key, ctrl, visitor, path35);
|
|
114
114
|
}
|
|
115
115
|
if (typeof ctrl !== "symbol") {
|
|
116
116
|
if (identity.isCollection(node)) {
|
|
117
|
-
|
|
117
|
+
path35 = Object.freeze(path35.concat(node));
|
|
118
118
|
for (let i = 0; i < node.items.length; ++i) {
|
|
119
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
119
|
+
const ci = visit_(i, node.items[i], visitor, path35);
|
|
120
120
|
if (typeof ci === "number")
|
|
121
121
|
i = ci - 1;
|
|
122
122
|
else if (ci === BREAK)
|
|
@@ -127,13 +127,13 @@ var require_visit = __commonJS({
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
} else if (identity.isPair(node)) {
|
|
130
|
-
|
|
131
|
-
const ck = visit_("key", node.key, visitor,
|
|
130
|
+
path35 = Object.freeze(path35.concat(node));
|
|
131
|
+
const ck = visit_("key", node.key, visitor, path35);
|
|
132
132
|
if (ck === BREAK)
|
|
133
133
|
return BREAK;
|
|
134
134
|
else if (ck === REMOVE)
|
|
135
135
|
node.key = null;
|
|
136
|
-
const cv = visit_("value", node.value, visitor,
|
|
136
|
+
const cv = visit_("value", node.value, visitor, path35);
|
|
137
137
|
if (cv === BREAK)
|
|
138
138
|
return BREAK;
|
|
139
139
|
else if (cv === REMOVE)
|
|
@@ -154,17 +154,17 @@ var require_visit = __commonJS({
|
|
|
154
154
|
visitAsync.BREAK = BREAK;
|
|
155
155
|
visitAsync.SKIP = SKIP;
|
|
156
156
|
visitAsync.REMOVE = REMOVE;
|
|
157
|
-
async function visitAsync_(key, node, visitor,
|
|
158
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
157
|
+
async function visitAsync_(key, node, visitor, path35) {
|
|
158
|
+
const ctrl = await callVisitor(key, node, visitor, path35);
|
|
159
159
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
160
|
-
replaceNode(key,
|
|
161
|
-
return visitAsync_(key, ctrl, visitor,
|
|
160
|
+
replaceNode(key, path35, ctrl);
|
|
161
|
+
return visitAsync_(key, ctrl, visitor, path35);
|
|
162
162
|
}
|
|
163
163
|
if (typeof ctrl !== "symbol") {
|
|
164
164
|
if (identity.isCollection(node)) {
|
|
165
|
-
|
|
165
|
+
path35 = Object.freeze(path35.concat(node));
|
|
166
166
|
for (let i = 0; i < node.items.length; ++i) {
|
|
167
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
167
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path35);
|
|
168
168
|
if (typeof ci === "number")
|
|
169
169
|
i = ci - 1;
|
|
170
170
|
else if (ci === BREAK)
|
|
@@ -175,13 +175,13 @@ var require_visit = __commonJS({
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
} else if (identity.isPair(node)) {
|
|
178
|
-
|
|
179
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
178
|
+
path35 = Object.freeze(path35.concat(node));
|
|
179
|
+
const ck = await visitAsync_("key", node.key, visitor, path35);
|
|
180
180
|
if (ck === BREAK)
|
|
181
181
|
return BREAK;
|
|
182
182
|
else if (ck === REMOVE)
|
|
183
183
|
node.key = null;
|
|
184
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
184
|
+
const cv = await visitAsync_("value", node.value, visitor, path35);
|
|
185
185
|
if (cv === BREAK)
|
|
186
186
|
return BREAK;
|
|
187
187
|
else if (cv === REMOVE)
|
|
@@ -208,23 +208,23 @@ var require_visit = __commonJS({
|
|
|
208
208
|
}
|
|
209
209
|
return visitor;
|
|
210
210
|
}
|
|
211
|
-
function callVisitor(key, node, visitor,
|
|
211
|
+
function callVisitor(key, node, visitor, path35) {
|
|
212
212
|
if (typeof visitor === "function")
|
|
213
|
-
return visitor(key, node,
|
|
213
|
+
return visitor(key, node, path35);
|
|
214
214
|
if (identity.isMap(node))
|
|
215
|
-
return visitor.Map?.(key, node,
|
|
215
|
+
return visitor.Map?.(key, node, path35);
|
|
216
216
|
if (identity.isSeq(node))
|
|
217
|
-
return visitor.Seq?.(key, node,
|
|
217
|
+
return visitor.Seq?.(key, node, path35);
|
|
218
218
|
if (identity.isPair(node))
|
|
219
|
-
return visitor.Pair?.(key, node,
|
|
219
|
+
return visitor.Pair?.(key, node, path35);
|
|
220
220
|
if (identity.isScalar(node))
|
|
221
|
-
return visitor.Scalar?.(key, node,
|
|
221
|
+
return visitor.Scalar?.(key, node, path35);
|
|
222
222
|
if (identity.isAlias(node))
|
|
223
|
-
return visitor.Alias?.(key, node,
|
|
223
|
+
return visitor.Alias?.(key, node, path35);
|
|
224
224
|
return void 0;
|
|
225
225
|
}
|
|
226
|
-
function replaceNode(key,
|
|
227
|
-
const parent =
|
|
226
|
+
function replaceNode(key, path35, node) {
|
|
227
|
+
const parent = path35[path35.length - 1];
|
|
228
228
|
if (identity.isCollection(parent)) {
|
|
229
229
|
parent.items[key] = node;
|
|
230
230
|
} else if (identity.isPair(parent)) {
|
|
@@ -832,10 +832,10 @@ var require_Collection = __commonJS({
|
|
|
832
832
|
var createNode = require_createNode();
|
|
833
833
|
var identity = require_identity();
|
|
834
834
|
var Node = require_Node();
|
|
835
|
-
function collectionFromPath(schema,
|
|
835
|
+
function collectionFromPath(schema, path35, value) {
|
|
836
836
|
let v = value;
|
|
837
|
-
for (let i =
|
|
838
|
-
const k =
|
|
837
|
+
for (let i = path35.length - 1; i >= 0; --i) {
|
|
838
|
+
const k = path35[i];
|
|
839
839
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
840
840
|
const a = [];
|
|
841
841
|
a[k] = v;
|
|
@@ -854,7 +854,7 @@ var require_Collection = __commonJS({
|
|
|
854
854
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
855
855
|
});
|
|
856
856
|
}
|
|
857
|
-
var isEmptyPath = (
|
|
857
|
+
var isEmptyPath = (path35) => path35 == null || typeof path35 === "object" && !!path35[Symbol.iterator]().next().done;
|
|
858
858
|
var Collection = class extends Node.NodeBase {
|
|
859
859
|
constructor(type, schema) {
|
|
860
860
|
super(type);
|
|
@@ -884,11 +884,11 @@ var require_Collection = __commonJS({
|
|
|
884
884
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
885
885
|
* that already exists in the map.
|
|
886
886
|
*/
|
|
887
|
-
addIn(
|
|
888
|
-
if (isEmptyPath(
|
|
887
|
+
addIn(path35, value) {
|
|
888
|
+
if (isEmptyPath(path35))
|
|
889
889
|
this.add(value);
|
|
890
890
|
else {
|
|
891
|
-
const [key, ...rest] =
|
|
891
|
+
const [key, ...rest] = path35;
|
|
892
892
|
const node = this.get(key, true);
|
|
893
893
|
if (identity.isCollection(node))
|
|
894
894
|
node.addIn(rest, value);
|
|
@@ -902,8 +902,8 @@ var require_Collection = __commonJS({
|
|
|
902
902
|
* Removes a value from the collection.
|
|
903
903
|
* @returns `true` if the item was found and removed.
|
|
904
904
|
*/
|
|
905
|
-
deleteIn(
|
|
906
|
-
const [key, ...rest] =
|
|
905
|
+
deleteIn(path35) {
|
|
906
|
+
const [key, ...rest] = path35;
|
|
907
907
|
if (rest.length === 0)
|
|
908
908
|
return this.delete(key);
|
|
909
909
|
const node = this.get(key, true);
|
|
@@ -917,8 +917,8 @@ var require_Collection = __commonJS({
|
|
|
917
917
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
918
918
|
* `true` (collections are always returned intact).
|
|
919
919
|
*/
|
|
920
|
-
getIn(
|
|
921
|
-
const [key, ...rest] =
|
|
920
|
+
getIn(path35, keepScalar) {
|
|
921
|
+
const [key, ...rest] = path35;
|
|
922
922
|
const node = this.get(key, true);
|
|
923
923
|
if (rest.length === 0)
|
|
924
924
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -936,8 +936,8 @@ var require_Collection = __commonJS({
|
|
|
936
936
|
/**
|
|
937
937
|
* Checks if the collection includes a value with the key `key`.
|
|
938
938
|
*/
|
|
939
|
-
hasIn(
|
|
940
|
-
const [key, ...rest] =
|
|
939
|
+
hasIn(path35) {
|
|
940
|
+
const [key, ...rest] = path35;
|
|
941
941
|
if (rest.length === 0)
|
|
942
942
|
return this.has(key);
|
|
943
943
|
const node = this.get(key, true);
|
|
@@ -947,8 +947,8 @@ var require_Collection = __commonJS({
|
|
|
947
947
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
948
948
|
* boolean to add/remove the item from the set.
|
|
949
949
|
*/
|
|
950
|
-
setIn(
|
|
951
|
-
const [key, ...rest] =
|
|
950
|
+
setIn(path35, value) {
|
|
951
|
+
const [key, ...rest] = path35;
|
|
952
952
|
if (rest.length === 0) {
|
|
953
953
|
this.set(key, value);
|
|
954
954
|
} else {
|
|
@@ -3452,9 +3452,9 @@ var require_Document = __commonJS({
|
|
|
3452
3452
|
this.contents.add(value);
|
|
3453
3453
|
}
|
|
3454
3454
|
/** Adds a value to the document. */
|
|
3455
|
-
addIn(
|
|
3455
|
+
addIn(path35, value) {
|
|
3456
3456
|
if (assertCollection(this.contents))
|
|
3457
|
-
this.contents.addIn(
|
|
3457
|
+
this.contents.addIn(path35, value);
|
|
3458
3458
|
}
|
|
3459
3459
|
/**
|
|
3460
3460
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3529,14 +3529,14 @@ var require_Document = __commonJS({
|
|
|
3529
3529
|
* Removes a value from the document.
|
|
3530
3530
|
* @returns `true` if the item was found and removed.
|
|
3531
3531
|
*/
|
|
3532
|
-
deleteIn(
|
|
3533
|
-
if (Collection.isEmptyPath(
|
|
3532
|
+
deleteIn(path35) {
|
|
3533
|
+
if (Collection.isEmptyPath(path35)) {
|
|
3534
3534
|
if (this.contents == null)
|
|
3535
3535
|
return false;
|
|
3536
3536
|
this.contents = null;
|
|
3537
3537
|
return true;
|
|
3538
3538
|
}
|
|
3539
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3539
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path35) : false;
|
|
3540
3540
|
}
|
|
3541
3541
|
/**
|
|
3542
3542
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3551,10 +3551,10 @@ var require_Document = __commonJS({
|
|
|
3551
3551
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3552
3552
|
* `true` (collections are always returned intact).
|
|
3553
3553
|
*/
|
|
3554
|
-
getIn(
|
|
3555
|
-
if (Collection.isEmptyPath(
|
|
3554
|
+
getIn(path35, keepScalar) {
|
|
3555
|
+
if (Collection.isEmptyPath(path35))
|
|
3556
3556
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3557
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3557
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path35, keepScalar) : void 0;
|
|
3558
3558
|
}
|
|
3559
3559
|
/**
|
|
3560
3560
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3565,10 +3565,10 @@ var require_Document = __commonJS({
|
|
|
3565
3565
|
/**
|
|
3566
3566
|
* Checks if the document includes a value at `path`.
|
|
3567
3567
|
*/
|
|
3568
|
-
hasIn(
|
|
3569
|
-
if (Collection.isEmptyPath(
|
|
3568
|
+
hasIn(path35) {
|
|
3569
|
+
if (Collection.isEmptyPath(path35))
|
|
3570
3570
|
return this.contents !== void 0;
|
|
3571
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3571
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path35) : false;
|
|
3572
3572
|
}
|
|
3573
3573
|
/**
|
|
3574
3574
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3585,13 +3585,13 @@ var require_Document = __commonJS({
|
|
|
3585
3585
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3586
3586
|
* boolean to add/remove the item from the set.
|
|
3587
3587
|
*/
|
|
3588
|
-
setIn(
|
|
3589
|
-
if (Collection.isEmptyPath(
|
|
3588
|
+
setIn(path35, value) {
|
|
3589
|
+
if (Collection.isEmptyPath(path35)) {
|
|
3590
3590
|
this.contents = value;
|
|
3591
3591
|
} else if (this.contents == null) {
|
|
3592
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3592
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path35), value);
|
|
3593
3593
|
} else if (assertCollection(this.contents)) {
|
|
3594
|
-
this.contents.setIn(
|
|
3594
|
+
this.contents.setIn(path35, value);
|
|
3595
3595
|
}
|
|
3596
3596
|
}
|
|
3597
3597
|
/**
|
|
@@ -5543,9 +5543,9 @@ var require_cst_visit = __commonJS({
|
|
|
5543
5543
|
visit.BREAK = BREAK;
|
|
5544
5544
|
visit.SKIP = SKIP;
|
|
5545
5545
|
visit.REMOVE = REMOVE;
|
|
5546
|
-
visit.itemAtPath = (cst,
|
|
5546
|
+
visit.itemAtPath = (cst, path35) => {
|
|
5547
5547
|
let item = cst;
|
|
5548
|
-
for (const [field, index] of
|
|
5548
|
+
for (const [field, index] of path35) {
|
|
5549
5549
|
const tok = item?.[field];
|
|
5550
5550
|
if (tok && "items" in tok) {
|
|
5551
5551
|
item = tok.items[index];
|
|
@@ -5554,23 +5554,23 @@ var require_cst_visit = __commonJS({
|
|
|
5554
5554
|
}
|
|
5555
5555
|
return item;
|
|
5556
5556
|
};
|
|
5557
|
-
visit.parentCollection = (cst,
|
|
5558
|
-
const parent = visit.itemAtPath(cst,
|
|
5559
|
-
const field =
|
|
5557
|
+
visit.parentCollection = (cst, path35) => {
|
|
5558
|
+
const parent = visit.itemAtPath(cst, path35.slice(0, -1));
|
|
5559
|
+
const field = path35[path35.length - 1][0];
|
|
5560
5560
|
const coll = parent?.[field];
|
|
5561
5561
|
if (coll && "items" in coll)
|
|
5562
5562
|
return coll;
|
|
5563
5563
|
throw new Error("Parent collection not found");
|
|
5564
5564
|
};
|
|
5565
|
-
function _visit(
|
|
5566
|
-
let ctrl = visitor(item,
|
|
5565
|
+
function _visit(path35, item, visitor) {
|
|
5566
|
+
let ctrl = visitor(item, path35);
|
|
5567
5567
|
if (typeof ctrl === "symbol")
|
|
5568
5568
|
return ctrl;
|
|
5569
5569
|
for (const field of ["key", "value"]) {
|
|
5570
5570
|
const token = item[field];
|
|
5571
5571
|
if (token && "items" in token) {
|
|
5572
5572
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5573
|
-
const ci = _visit(Object.freeze(
|
|
5573
|
+
const ci = _visit(Object.freeze(path35.concat([[field, i]])), token.items[i], visitor);
|
|
5574
5574
|
if (typeof ci === "number")
|
|
5575
5575
|
i = ci - 1;
|
|
5576
5576
|
else if (ci === BREAK)
|
|
@@ -5581,10 +5581,10 @@ var require_cst_visit = __commonJS({
|
|
|
5581
5581
|
}
|
|
5582
5582
|
}
|
|
5583
5583
|
if (typeof ctrl === "function" && field === "key")
|
|
5584
|
-
ctrl = ctrl(item,
|
|
5584
|
+
ctrl = ctrl(item, path35);
|
|
5585
5585
|
}
|
|
5586
5586
|
}
|
|
5587
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5587
|
+
return typeof ctrl === "function" ? ctrl(item, path35) : ctrl;
|
|
5588
5588
|
}
|
|
5589
5589
|
exports2.visit = visit;
|
|
5590
5590
|
}
|
|
@@ -7320,17 +7320,17 @@ var require_dist = __commonJS({
|
|
|
7320
7320
|
|
|
7321
7321
|
// scripts/dev-resources/snapshot.mjs
|
|
7322
7322
|
var import_promises13 = __toESM(require("node:fs/promises"), 1);
|
|
7323
|
-
var
|
|
7323
|
+
var import_node_path30 = __toESM(require("node:path"), 1);
|
|
7324
7324
|
var import_node_os17 = __toESM(require("node:os"), 1);
|
|
7325
7325
|
var import_node_child_process10 = require("node:child_process");
|
|
7326
7326
|
var import_node_util6 = require("node:util");
|
|
7327
7327
|
var import_node_url = require("node:url");
|
|
7328
7328
|
|
|
7329
7329
|
// scripts/dev-session/beta-pool/projection.mjs
|
|
7330
|
-
var
|
|
7330
|
+
var import_node_fs17 = require("node:fs");
|
|
7331
7331
|
var import_promises12 = __toESM(require("node:fs/promises"), 1);
|
|
7332
7332
|
var import_node_os16 = __toESM(require("node:os"), 1);
|
|
7333
|
-
var
|
|
7333
|
+
var import_node_path29 = __toESM(require("node:path"), 1);
|
|
7334
7334
|
|
|
7335
7335
|
// scripts/dev-session/contracts.mjs
|
|
7336
7336
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
@@ -7875,7 +7875,7 @@ async function releaseSessionPortLeases(root, ports, sessionId) {
|
|
|
7875
7875
|
// scripts/dev-session/services/runtime.mjs
|
|
7876
7876
|
var import_node_child_process5 = require("node:child_process");
|
|
7877
7877
|
var import_promises5 = require("node:fs/promises");
|
|
7878
|
-
var
|
|
7878
|
+
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
7879
7879
|
var import_node_util2 = require("node:util");
|
|
7880
7880
|
|
|
7881
7881
|
// scripts/beta/state.mjs
|
|
@@ -8400,6 +8400,7 @@ __export(src_exports, {
|
|
|
8400
8400
|
ConfigurationStore: () => ConfigurationStore,
|
|
8401
8401
|
LOCAL_RUNTIME_STATUS_SOURCES: () => LOCAL_RUNTIME_STATUS_SOURCES,
|
|
8402
8402
|
acquireConfigurationOwner: () => acquireConfigurationOwner,
|
|
8403
|
+
activateWindowsServerRelease: () => activateWindowsServerRelease,
|
|
8403
8404
|
assertNewStableInstallation: () => assertNewStableInstallation,
|
|
8404
8405
|
assertOwnedPath: () => assertOwnedPath,
|
|
8405
8406
|
assertPrivateDescriptor: () => assertPrivateDescriptor,
|
|
@@ -8437,6 +8438,7 @@ __export(src_exports, {
|
|
|
8437
8438
|
redactConfiguration: () => redactConfiguration,
|
|
8438
8439
|
registerStableConfigurationRoot: () => registerStableConfigurationRoot,
|
|
8439
8440
|
researchMcpHome: () => researchMcpHome,
|
|
8441
|
+
resolveActiveServerRelease: () => resolveActiveServerRelease,
|
|
8440
8442
|
resolveConfigurationContext: () => resolveConfigurationContext,
|
|
8441
8443
|
resolveConfigurationValue: () => resolveConfigurationValue,
|
|
8442
8444
|
retainSelectedStorage: () => retainSelectedStorage,
|
|
@@ -9403,9 +9405,9 @@ var ConfigurationStore = class {
|
|
|
9403
9405
|
return { source, document, value, digest: (0, import_node_crypto3.createHash)("sha256").update(source).digest("hex") };
|
|
9404
9406
|
}
|
|
9405
9407
|
prepareUpgrade() {
|
|
9406
|
-
const { source, document, value, digest } = this.readUpgradeSource();
|
|
9408
|
+
const { source, document, value, digest: digest2 } = this.readUpgradeSource();
|
|
9407
9409
|
const original = value;
|
|
9408
|
-
const expectedDigest =
|
|
9410
|
+
const expectedDigest = digest2;
|
|
9409
9411
|
const steps = migrateConfigurationDocument(document);
|
|
9410
9412
|
const next = parseConfigurationYaml(document.toString({ lineWidth: 0 }), this.context);
|
|
9411
9413
|
const failures = Object.values(next.issues).flat();
|
|
@@ -9774,13 +9776,13 @@ function prepareMigration(context, sources) {
|
|
|
9774
9776
|
assertMigrationSourceOwner(context, source.file);
|
|
9775
9777
|
if (migratedDomains.has(source.domain)) continue;
|
|
9776
9778
|
const raw = (0, import_node_fs8.readFileSync)(source.file, "utf8");
|
|
9777
|
-
const
|
|
9779
|
+
const digest2 = (0, import_node_crypto4.createHash)("sha256").update(raw).digest("hex");
|
|
9778
9780
|
const previous = byDomain.get(source.domain);
|
|
9779
|
-
if (previous && previous !==
|
|
9781
|
+
if (previous && previous !== digest2) {
|
|
9780
9782
|
result.conflicts.push(source.domain);
|
|
9781
9783
|
continue;
|
|
9782
9784
|
}
|
|
9783
|
-
byDomain.set(source.domain,
|
|
9785
|
+
byDomain.set(source.domain, digest2);
|
|
9784
9786
|
const draft = emptyConfiguration(context);
|
|
9785
9787
|
if (source.format === "env") importEnvironment(draft, parseEnvironmentFile(raw));
|
|
9786
9788
|
else {
|
|
@@ -9848,8 +9850,8 @@ function prepareMigration(context, sources) {
|
|
|
9848
9850
|
continue;
|
|
9849
9851
|
}
|
|
9850
9852
|
for (const [key, entry] of changes) setConfigurationValue(value, key, entry);
|
|
9851
|
-
value.migrations[source.domain] = { id: `${source.domain}:${
|
|
9852
|
-
result.sources.push({ file: source.file, digest, domain: source.domain });
|
|
9853
|
+
value.migrations[source.domain] = { id: `${source.domain}:${digest2}`, sourceDigest: digest2 };
|
|
9854
|
+
result.sources.push({ file: source.file, digest: digest2, domain: source.domain });
|
|
9853
9855
|
}
|
|
9854
9856
|
const issues = validateDomains(value, context);
|
|
9855
9857
|
const touched = new Set(result.sources.map((source) => domainForPath(source.domain)));
|
|
@@ -9999,8 +10001,8 @@ function retainSelectedStorage(context, selected, draft) {
|
|
|
9999
10001
|
"logging.backendDirectory": import_node_path12.default.join(profile, "logs", "backend")
|
|
10000
10002
|
};
|
|
10001
10003
|
for (const [key, value] of Object.entries(retained)) if (readConfigurationPath(draft.value, key) == null) setConfigurationValue(draft.value, key, value);
|
|
10002
|
-
const
|
|
10003
|
-
draft.value.migrations.storage = { id: `selected-profile:${
|
|
10004
|
+
const digest2 = (0, import_node_crypto5.createHash)("sha256").update(JSON.stringify(draft.value.storage)).digest("hex");
|
|
10005
|
+
draft.value.migrations.storage = { id: `selected-profile:${digest2}`, sourceDigest: digest2 };
|
|
10004
10006
|
}
|
|
10005
10007
|
function selectedDirectory(context, directory2) {
|
|
10006
10008
|
if (!import_node_path12.default.isAbsolute(directory2) || !(0, import_node_fs9.existsSync)(directory2) || !(0, import_node_fs9.statSync)(directory2).isDirectory()) throw new ConfigurationError("CONFIG_SOURCE_DIRECTORY_INVALID");
|
|
@@ -10314,11 +10316,50 @@ function readInstalledRuntimeBuild(entry) {
|
|
|
10314
10316
|
}
|
|
10315
10317
|
}
|
|
10316
10318
|
|
|
10319
|
+
// packages/config-node/src/server/active-release.ts
|
|
10320
|
+
var import_node_crypto8 = require("node:crypto");
|
|
10321
|
+
var import_node_fs13 = require("node:fs");
|
|
10322
|
+
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
10323
|
+
function resolveActiveServerRelease(home) {
|
|
10324
|
+
const pointer = import_node_path16.default.join(home, "active-release.json");
|
|
10325
|
+
if (process.platform === "win32" && (0, import_node_fs13.existsSync)(pointer)) {
|
|
10326
|
+
const value = JSON.parse(readPrivateFile(pointer, 16384));
|
|
10327
|
+
if (value.schemaVersion !== 1 || !/^releases\/[a-zA-Z0-9._-]+$/.test(value.release) || !/^[a-f0-9]{64}$/.test(value.manifestDigest) || !value.transactionId)
|
|
10328
|
+
throw new Error("SERVER_POINTER_INVALID");
|
|
10329
|
+
const release2 = (0, import_node_fs13.realpathSync)(import_node_path16.default.join(home, value.release));
|
|
10330
|
+
if (import_node_path16.default.dirname(release2) !== (0, import_node_fs13.realpathSync)(import_node_path16.default.join(home, "releases")) || digest(release2) !== value.manifestDigest)
|
|
10331
|
+
throw new Error("SERVER_POINTER_INVALID");
|
|
10332
|
+
return release2;
|
|
10333
|
+
}
|
|
10334
|
+
const legacy = import_node_path16.default.join(home, "current");
|
|
10335
|
+
if (!(0, import_node_fs13.existsSync)(legacy)) return void 0;
|
|
10336
|
+
const release = (0, import_node_fs13.realpathSync)(legacy);
|
|
10337
|
+
if (import_node_path16.default.dirname(release) !== (0, import_node_fs13.realpathSync)(import_node_path16.default.join(home, "releases"))) throw new Error("SERVER_POINTER_INVALID");
|
|
10338
|
+
return release;
|
|
10339
|
+
}
|
|
10340
|
+
function digest(release) {
|
|
10341
|
+
return (0, import_node_crypto8.createHash)("sha256").update((0, import_node_fs13.readFileSync)(import_node_path16.default.join(release, "server-manifest.json"))).digest("hex");
|
|
10342
|
+
}
|
|
10343
|
+
function activateWindowsServerRelease(home, release, transactionId = (0, import_node_crypto8.randomUUID)()) {
|
|
10344
|
+
release = (0, import_node_fs13.realpathSync)(release);
|
|
10345
|
+
if (import_node_path16.default.dirname(release) !== (0, import_node_fs13.realpathSync)(import_node_path16.default.join(home, "releases"))) throw new Error("SERVER_POINTER_INVALID");
|
|
10346
|
+
const pointer = import_node_path16.default.join(home, "active-release.json");
|
|
10347
|
+
const temporary = `${pointer}.${(0, import_node_crypto8.randomUUID)()}`;
|
|
10348
|
+
const fd = (0, import_node_fs13.openSync)(temporary, "wx", 384);
|
|
10349
|
+
try {
|
|
10350
|
+
(0, import_node_fs13.writeFileSync)(fd, JSON.stringify({ schemaVersion: 1, release: `releases/${import_node_path16.default.basename(release)}`, manifestDigest: digest(release), transactionId }) + "\n");
|
|
10351
|
+
(0, import_node_fs13.fsyncSync)(fd);
|
|
10352
|
+
} finally {
|
|
10353
|
+
(0, import_node_fs13.closeSync)(fd);
|
|
10354
|
+
}
|
|
10355
|
+
(0, import_node_fs13.renameSync)(temporary, pointer);
|
|
10356
|
+
}
|
|
10357
|
+
|
|
10317
10358
|
// scripts/lib/backend-health-auth.mjs
|
|
10318
10359
|
var import_node_net = require("node:net");
|
|
10319
|
-
var
|
|
10360
|
+
var import_node_fs14 = require("node:fs");
|
|
10320
10361
|
var import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
10321
|
-
var
|
|
10362
|
+
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
10322
10363
|
var import_node_child_process4 = require("node:child_process");
|
|
10323
10364
|
var import_node_util = require("node:util");
|
|
10324
10365
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process4.execFile);
|
|
@@ -10330,8 +10371,8 @@ async function readBackendHealthAuth(profileDir) {
|
|
|
10330
10371
|
if (!directory2.isDirectory() || directory2.isSymbolicLink())
|
|
10331
10372
|
throw new Error("invalid Backend health profile directory");
|
|
10332
10373
|
handle = await import_promises4.default.open(
|
|
10333
|
-
|
|
10334
|
-
|
|
10374
|
+
import_node_path17.default.join(profileDir, FILE_NAME),
|
|
10375
|
+
import_node_fs14.constants.O_RDONLY | import_node_fs14.constants.O_NOFOLLOW
|
|
10335
10376
|
);
|
|
10336
10377
|
const stat = await handle.stat();
|
|
10337
10378
|
if (!stat.isFile() || stat.size > 16384 || (stat.mode & 63) !== 0 || stat.uid !== process.getuid?.()) {
|
|
@@ -10345,7 +10386,7 @@ async function readBackendHealthAuth(profileDir) {
|
|
|
10345
10386
|
if (!(config.ownerDevSessionId === null || typeof config.ownerDevSessionId === "string") || typeof config.configRoot !== "string") throw new Error("invalid Backend health binding");
|
|
10346
10387
|
const context = src_exports.resolveConfigurationContext({ args: ["--instance", config.ownerDevSessionId ?? "stable", "--config-dir", config.configRoot] });
|
|
10347
10388
|
const snapshot = new src_exports.ConfigurationStore(context).read();
|
|
10348
|
-
const ownedProfile = snapshot.value.storage?.browserProfileDirectory ??
|
|
10389
|
+
const ownedProfile = snapshot.value.storage?.browserProfileDirectory ?? import_node_path17.default.join(context.configRoot, "data", "backend");
|
|
10349
10390
|
if (src_exports.canonicalPath(profileDir) !== src_exports.canonicalPath(ownedProfile) || snapshot.issues["backend.tunnelAuth"]?.length) throw new Error("Backend health binding mismatch");
|
|
10350
10391
|
const token = snapshot.value.backend?.tunnelAuth?.token ?? null;
|
|
10351
10392
|
if (token !== null && typeof token !== "string") throw new Error("invalid Backend health credential");
|
|
@@ -10383,8 +10424,8 @@ async function readHealthProfileLock(profileDir) {
|
|
|
10383
10424
|
let handle;
|
|
10384
10425
|
try {
|
|
10385
10426
|
handle = await import_promises4.default.open(
|
|
10386
|
-
|
|
10387
|
-
|
|
10427
|
+
import_node_path17.default.join(profileDir, "backend.lock.json"),
|
|
10428
|
+
import_node_fs14.constants.O_RDONLY | import_node_fs14.constants.O_NOFOLLOW
|
|
10388
10429
|
);
|
|
10389
10430
|
const stat = await handle.stat();
|
|
10390
10431
|
if (!stat.isFile() || (stat.mode & 63) !== 0 || stat.uid !== process.getuid?.() || stat.size > 65536) {
|
|
@@ -10503,7 +10544,7 @@ function healthListenerMatchesEndpoint(name, family, target) {
|
|
|
10503
10544
|
}
|
|
10504
10545
|
|
|
10505
10546
|
// scripts/dev-session/services/beta-reconciliation-paths.mjs
|
|
10506
|
-
var
|
|
10547
|
+
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
10507
10548
|
function resolveBetaReconciliationPaths(services) {
|
|
10508
10549
|
const beta = services.beta;
|
|
10509
10550
|
const pooledBeta = /^pool-0[1-5]$/.test(beta?.instanceId ?? "");
|
|
@@ -10522,7 +10563,7 @@ function resolveBetaReconciliationPaths(services) {
|
|
|
10522
10563
|
} catch {
|
|
10523
10564
|
return null;
|
|
10524
10565
|
}
|
|
10525
|
-
const homeDir =
|
|
10566
|
+
const homeDir = import_node_path18.default.resolve(beta.userDataDir, "../../../../..");
|
|
10526
10567
|
const paths = resolveBetaPaths(
|
|
10527
10568
|
beta.betaControl.cwd,
|
|
10528
10569
|
homeDir,
|
|
@@ -10631,7 +10672,7 @@ async function inspectBackendHandshake(service) {
|
|
|
10631
10672
|
}
|
|
10632
10673
|
const health = await fetchHealthJson(
|
|
10633
10674
|
`${service.url}/health`,
|
|
10634
|
-
|
|
10675
|
+
import_node_path19.default.dirname(service.lockPath)
|
|
10635
10676
|
);
|
|
10636
10677
|
const expectedDevSessionId = service.ownerDevSessionId ?? null;
|
|
10637
10678
|
if (health?.status !== "ok" || health.service !== "runweave-backend" || health.serviceInstanceId !== service.serviceInstanceId || (health.devSessionId ?? null) !== expectedDevSessionId || health.sourceRevision !== service.sourceRevision || health.resourceNamespace !== service.resourceNamespace || health.protocolVersion !== service.protocolVersion || !hasCapabilities(health.capabilities, service.capabilities)) {
|
|
@@ -10701,7 +10742,7 @@ async function reconcileBetaSessionServices(services) {
|
|
|
10701
10742
|
readJson2(backend.lockPath),
|
|
10702
10743
|
fetchHealthJson(
|
|
10703
10744
|
`${status.backend.baseUrl}/health`,
|
|
10704
|
-
|
|
10745
|
+
import_node_path19.default.dirname(backend.lockPath)
|
|
10705
10746
|
),
|
|
10706
10747
|
readJson2(appServer.lockPath),
|
|
10707
10748
|
fetchHealthJson(`${status.appServer.baseUrl}/healthz`)
|
|
@@ -11075,18 +11116,18 @@ async function inspectSessionServices(services) {
|
|
|
11075
11116
|
// scripts/dev-session/beta-pool/core.mjs
|
|
11076
11117
|
var import_promises9 = __toESM(require("node:fs/promises"), 1);
|
|
11077
11118
|
var import_node_os11 = __toESM(require("node:os"), 1);
|
|
11078
|
-
var
|
|
11119
|
+
var import_node_path24 = __toESM(require("node:path"), 1);
|
|
11079
11120
|
|
|
11080
11121
|
// scripts/dev-session/beta-pool/storage/files.mjs
|
|
11081
|
-
var
|
|
11082
|
-
var
|
|
11122
|
+
var import_node_crypto9 = require("node:crypto");
|
|
11123
|
+
var import_node_fs15 = require("node:fs");
|
|
11083
11124
|
var import_promises6 = __toESM(require("node:fs/promises"), 1);
|
|
11084
|
-
var
|
|
11125
|
+
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
11085
11126
|
function sameFileIdentity2(left, right) {
|
|
11086
11127
|
return left.dev === right.dev && left.ino === right.ino;
|
|
11087
11128
|
}
|
|
11088
11129
|
async function ensureDirectory(directory2, allowedRoot) {
|
|
11089
|
-
const root =
|
|
11130
|
+
const root = import_node_path20.default.resolve(allowedRoot);
|
|
11090
11131
|
const target = assertPathInside(root, directory2, "Beta pool directory");
|
|
11091
11132
|
const existingRoot = await import_promises6.default.lstat(root).catch((error) => {
|
|
11092
11133
|
if (error?.code === "ENOENT") {
|
|
@@ -11108,10 +11149,10 @@ async function ensureDirectory(directory2, allowedRoot) {
|
|
|
11108
11149
|
}
|
|
11109
11150
|
await import_promises6.default.chmod(root, 448);
|
|
11110
11151
|
await import_promises6.default.mkdir(target, { recursive: true, mode: 448 });
|
|
11111
|
-
const relative =
|
|
11152
|
+
const relative = import_node_path20.default.relative(root, target);
|
|
11112
11153
|
let current = root;
|
|
11113
|
-
for (const component of relative ? relative.split(
|
|
11114
|
-
current =
|
|
11154
|
+
for (const component of relative ? relative.split(import_node_path20.default.sep) : []) {
|
|
11155
|
+
current = import_node_path20.default.join(current, component);
|
|
11115
11156
|
const stats = await import_promises6.default.lstat(current);
|
|
11116
11157
|
if (!stats.isDirectory() || stats.isSymbolicLink()) {
|
|
11117
11158
|
throw new DevSessionError("Beta pool path must not contain symlinks", 4, {
|
|
@@ -11127,7 +11168,7 @@ async function readRegularJson(filePath, allowedRoot) {
|
|
|
11127
11168
|
try {
|
|
11128
11169
|
handle = await import_promises6.default.open(
|
|
11129
11170
|
filePath,
|
|
11130
|
-
|
|
11171
|
+
import_node_fs15.constants.O_RDONLY | import_node_fs15.constants.O_NOFOLLOW
|
|
11131
11172
|
);
|
|
11132
11173
|
const before = await handle.stat();
|
|
11133
11174
|
if (!before.isFile()) {
|
|
@@ -11144,15 +11185,15 @@ async function readRegularJson(filePath, allowedRoot) {
|
|
|
11144
11185
|
}
|
|
11145
11186
|
}
|
|
11146
11187
|
async function atomicWriteJson2(filePath, value, allowedRoot) {
|
|
11147
|
-
const directory2 =
|
|
11188
|
+
const directory2 = import_node_path20.default.dirname(filePath);
|
|
11148
11189
|
await ensureDirectory(directory2, allowedRoot);
|
|
11149
|
-
const temporaryPath =
|
|
11190
|
+
const temporaryPath = import_node_path20.default.join(
|
|
11150
11191
|
directory2,
|
|
11151
|
-
`.${
|
|
11192
|
+
`.${import_node_path20.default.basename(filePath)}.${(0, import_node_crypto9.randomUUID)()}.tmp`
|
|
11152
11193
|
);
|
|
11153
11194
|
const handle = await import_promises6.default.open(
|
|
11154
11195
|
temporaryPath,
|
|
11155
|
-
|
|
11196
|
+
import_node_fs15.constants.O_WRONLY | import_node_fs15.constants.O_CREAT | import_node_fs15.constants.O_EXCL | import_node_fs15.constants.O_NOFOLLOW,
|
|
11156
11197
|
384
|
|
11157
11198
|
);
|
|
11158
11199
|
try {
|
|
@@ -11166,9 +11207,9 @@ async function atomicWriteJson2(filePath, value, allowedRoot) {
|
|
|
11166
11207
|
}
|
|
11167
11208
|
|
|
11168
11209
|
// scripts/dev-session/beta-pool/recovery/claim.mjs
|
|
11169
|
-
var
|
|
11210
|
+
var import_node_crypto10 = require("node:crypto");
|
|
11170
11211
|
var import_promises7 = __toESM(require("node:fs/promises"), 1);
|
|
11171
|
-
var
|
|
11212
|
+
var import_node_path21 = __toESM(require("node:path"), 1);
|
|
11172
11213
|
var RECOVERY_CLAIM_SCHEMA_VERSION = 1;
|
|
11173
11214
|
var RELEASE_GUARD_TIMEOUT_MS = 1e3;
|
|
11174
11215
|
function validateRecoveryClaim(value, slotId) {
|
|
@@ -11188,7 +11229,7 @@ async function releaseTransitionGuard(guardPath, guardStats, slotId) {
|
|
|
11188
11229
|
}
|
|
11189
11230
|
async function withTransitionGuard(slotId, paths, waitForRelease, callback) {
|
|
11190
11231
|
await ensureDirectory(paths.recoveryClaimsDir, paths.poolRoot);
|
|
11191
|
-
const guardPath =
|
|
11232
|
+
const guardPath = import_node_path21.default.join(paths.recoveryClaimsDir, `.${slotId}.transition`);
|
|
11192
11233
|
const deadline = Date.now() + RELEASE_GUARD_TIMEOUT_MS;
|
|
11193
11234
|
for (; ; ) {
|
|
11194
11235
|
try {
|
|
@@ -11218,7 +11259,7 @@ async function readClaimGeneration(claimPath, slotId, paths) {
|
|
|
11218
11259
|
throw new Error("claim is not a regular directory");
|
|
11219
11260
|
}
|
|
11220
11261
|
const { value, stats: ownerStats } = await readRegularJson(
|
|
11221
|
-
|
|
11262
|
+
import_node_path21.default.join(claimPath, "owner.json"),
|
|
11222
11263
|
paths.recoveryClaimsDir
|
|
11223
11264
|
);
|
|
11224
11265
|
const claim = validateRecoveryClaim(value, slotId);
|
|
@@ -11242,7 +11283,7 @@ function ownerIsProvenAbsent(claim) {
|
|
|
11242
11283
|
}
|
|
11243
11284
|
async function acquireBetaSlotRecoveryClaim(slotId, paths) {
|
|
11244
11285
|
return await withTransitionGuard(slotId, paths, false, async () => {
|
|
11245
|
-
const claimPath =
|
|
11286
|
+
const claimPath = import_node_path21.default.join(paths.recoveryClaimsDir, `${slotId}.lock`);
|
|
11246
11287
|
const existing = await import_promises7.default.lstat(claimPath).catch((error) => {
|
|
11247
11288
|
if (error?.code === "ENOENT") return null;
|
|
11248
11289
|
throw error;
|
|
@@ -11262,9 +11303,9 @@ async function acquireBetaSlotRecoveryClaim(slotId, paths) {
|
|
|
11262
11303
|
if (!rechecked || !sameClaimGeneration(current, rechecked) || !ownerIsProvenAbsent(rechecked.claim)) {
|
|
11263
11304
|
return null;
|
|
11264
11305
|
}
|
|
11265
|
-
const stalePath =
|
|
11306
|
+
const stalePath = import_node_path21.default.join(
|
|
11266
11307
|
paths.recoveryClaimsDir,
|
|
11267
|
-
`.${slotId}.${(0,
|
|
11308
|
+
`.${slotId}.${(0, import_node_crypto10.randomUUID)()}.stale`
|
|
11268
11309
|
);
|
|
11269
11310
|
await import_promises7.default.rename(claimPath, stalePath);
|
|
11270
11311
|
const moved = await readClaimGeneration(stalePath, slotId, paths);
|
|
@@ -11280,20 +11321,20 @@ async function acquireBetaSlotRecoveryClaim(slotId, paths) {
|
|
|
11280
11321
|
const claim = {
|
|
11281
11322
|
schemaVersion: RECOVERY_CLAIM_SCHEMA_VERSION,
|
|
11282
11323
|
slotId,
|
|
11283
|
-
claimNonce: (0,
|
|
11324
|
+
claimNonce: (0, import_node_crypto10.randomUUID)(),
|
|
11284
11325
|
pid: process.pid,
|
|
11285
11326
|
processSignature: readProcessSignature2(process.pid),
|
|
11286
11327
|
acquiredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
11287
11328
|
};
|
|
11288
11329
|
validateRecoveryClaim(claim, slotId);
|
|
11289
|
-
const candidatePath =
|
|
11330
|
+
const candidatePath = import_node_path21.default.join(
|
|
11290
11331
|
paths.recoveryClaimsDir,
|
|
11291
11332
|
`.${slotId}.${claim.claimNonce}.tmp`
|
|
11292
11333
|
);
|
|
11293
11334
|
await import_promises7.default.mkdir(candidatePath, { mode: 448 });
|
|
11294
11335
|
try {
|
|
11295
11336
|
await atomicWriteJson2(
|
|
11296
|
-
|
|
11337
|
+
import_node_path21.default.join(candidatePath, "owner.json"),
|
|
11297
11338
|
claim,
|
|
11298
11339
|
candidatePath
|
|
11299
11340
|
);
|
|
@@ -11316,7 +11357,7 @@ async function acquireBetaSlotRecoveryClaim(slotId, paths) {
|
|
|
11316
11357
|
async function releaseBetaSlotRecoveryClaim(recoveryClaim, paths) {
|
|
11317
11358
|
const slotId = recoveryClaim.claim.slotId;
|
|
11318
11359
|
return await withTransitionGuard(slotId, paths, true, async () => {
|
|
11319
|
-
const claimPath =
|
|
11360
|
+
const claimPath = import_node_path21.default.join(paths.recoveryClaimsDir, `${slotId}.lock`);
|
|
11320
11361
|
const current = await readClaimGeneration(claimPath, slotId, paths);
|
|
11321
11362
|
if (recoveryClaim.claimPath !== claimPath || !sameClaimGeneration(recoveryClaim, current) || current.claim.pid !== process.pid || current.claim.processSignature !== readProcessSignature2(process.pid)) {
|
|
11322
11363
|
throw new DevSessionError(
|
|
@@ -11325,7 +11366,7 @@ async function releaseBetaSlotRecoveryClaim(recoveryClaim, paths) {
|
|
|
11325
11366
|
{ slotId }
|
|
11326
11367
|
);
|
|
11327
11368
|
}
|
|
11328
|
-
const releasedPath =
|
|
11369
|
+
const releasedPath = import_node_path21.default.join(
|
|
11329
11370
|
paths.recoveryClaimsDir,
|
|
11330
11371
|
`.${slotId}.${current.claim.claimNonce}.released`
|
|
11331
11372
|
);
|
|
@@ -11343,12 +11384,12 @@ async function releaseBetaSlotRecoveryClaim(recoveryClaim, paths) {
|
|
|
11343
11384
|
}
|
|
11344
11385
|
|
|
11345
11386
|
// scripts/dev-session/beta-pool/storage/paths.mjs
|
|
11346
|
-
var
|
|
11387
|
+
var import_node_fs16 = require("node:fs");
|
|
11347
11388
|
var import_node_os10 = __toESM(require("node:os"), 1);
|
|
11348
|
-
var
|
|
11389
|
+
var import_node_path22 = __toESM(require("node:path"), 1);
|
|
11349
11390
|
function isDirectory(filePath) {
|
|
11350
11391
|
try {
|
|
11351
|
-
return (0,
|
|
11392
|
+
return (0, import_node_fs16.lstatSync)(filePath).isDirectory();
|
|
11352
11393
|
} catch {
|
|
11353
11394
|
return false;
|
|
11354
11395
|
}
|
|
@@ -11358,11 +11399,11 @@ function buildPoolPaths(root, betaRoot, extra = {}) {
|
|
|
11358
11399
|
...extra,
|
|
11359
11400
|
betaRoot,
|
|
11360
11401
|
poolRoot: root,
|
|
11361
|
-
leasesDir:
|
|
11362
|
-
recoveryClaimsDir:
|
|
11363
|
-
metadataDir:
|
|
11364
|
-
quarantineDir:
|
|
11365
|
-
legacyInstancesQuarantineDir:
|
|
11402
|
+
leasesDir: import_node_path22.default.join(root, "leases"),
|
|
11403
|
+
recoveryClaimsDir: import_node_path22.default.join(root, "recovery-claims"),
|
|
11404
|
+
metadataDir: import_node_path22.default.join(root, "metadata"),
|
|
11405
|
+
quarantineDir: import_node_path22.default.join(root, "quarantine"),
|
|
11406
|
+
legacyInstancesQuarantineDir: import_node_path22.default.join(
|
|
11366
11407
|
root,
|
|
11367
11408
|
"quarantine",
|
|
11368
11409
|
"legacy-instances"
|
|
@@ -11370,23 +11411,23 @@ function buildPoolPaths(root, betaRoot, extra = {}) {
|
|
|
11370
11411
|
};
|
|
11371
11412
|
}
|
|
11372
11413
|
function resolveBetaPoolStoragePaths(homeDir = import_node_os10.default.homedir()) {
|
|
11373
|
-
const controlRoot =
|
|
11374
|
-
const canonicalPoolRoot =
|
|
11375
|
-
const legacyBetaRoot =
|
|
11414
|
+
const controlRoot = import_node_path22.default.join(homeDir, ".runweave");
|
|
11415
|
+
const canonicalPoolRoot = import_node_path22.default.join(controlRoot, "beta-pool");
|
|
11416
|
+
const legacyBetaRoot = import_node_path22.default.join(
|
|
11376
11417
|
homeDir,
|
|
11377
11418
|
"Library",
|
|
11378
11419
|
"Application Support",
|
|
11379
11420
|
"Runweave Beta"
|
|
11380
11421
|
);
|
|
11381
|
-
const legacyPoolRoot =
|
|
11422
|
+
const legacyPoolRoot = import_node_path22.default.join(legacyBetaRoot, "pool");
|
|
11382
11423
|
return {
|
|
11383
11424
|
homeDir,
|
|
11384
11425
|
controlRoot,
|
|
11385
11426
|
canonicalPoolRoot,
|
|
11386
11427
|
legacyBetaRoot,
|
|
11387
11428
|
legacyPoolRoot,
|
|
11388
|
-
migrationRoot:
|
|
11389
|
-
migrationLockPath:
|
|
11429
|
+
migrationRoot: import_node_path22.default.join(controlRoot, "beta-pool-migrations"),
|
|
11430
|
+
migrationLockPath: import_node_path22.default.join(controlRoot, ".beta-pool-migration.lock")
|
|
11390
11431
|
};
|
|
11391
11432
|
}
|
|
11392
11433
|
function resolveCanonicalBetaPoolPaths(homeDir = import_node_os10.default.homedir()) {
|
|
@@ -11417,7 +11458,7 @@ function resolveEffectiveBetaPoolPaths(homeDir = import_node_os10.default.homedi
|
|
|
11417
11458
|
|
|
11418
11459
|
// scripts/dev-session/beta-pool/storage/support.mjs
|
|
11419
11460
|
var import_promises8 = __toESM(require("node:fs/promises"), 1);
|
|
11420
|
-
var
|
|
11461
|
+
var import_node_path23 = __toESM(require("node:path"), 1);
|
|
11421
11462
|
var STORAGE_SCHEMA_VERSION = 1;
|
|
11422
11463
|
var STORAGE_KIND = "beta-pool-control-plane-v1";
|
|
11423
11464
|
async function lstat2(filePath) {
|
|
@@ -11455,7 +11496,7 @@ async function inspectLegacyActivity(paths) {
|
|
|
11455
11496
|
} else {
|
|
11456
11497
|
for (const entry of leaseEntries) {
|
|
11457
11498
|
blockers.push(`legacy-lease:${entry}`);
|
|
11458
|
-
const lease = await readJson3(
|
|
11499
|
+
const lease = await readJson3(import_node_path23.default.join(paths.leasesDir, entry));
|
|
11459
11500
|
if (lease?.ownerSessionId) {
|
|
11460
11501
|
owners.push({
|
|
11461
11502
|
slotId: lease.slotId ?? entry.replace(/\.lock$/, ""),
|
|
@@ -11492,7 +11533,7 @@ async function inspectBetaPoolStorage({ homeDir } = {}) {
|
|
|
11492
11533
|
const storage = resolveBetaPoolStoragePaths(homeDir);
|
|
11493
11534
|
const canonicalStats = await lstat2(storage.canonicalPoolRoot);
|
|
11494
11535
|
const canonicalDirectory = canonicalStats?.isDirectory() ?? false;
|
|
11495
|
-
const canonicalMarker = canonicalDirectory ? await readJson3(
|
|
11536
|
+
const canonicalMarker = canonicalDirectory ? await readJson3(import_node_path23.default.join(storage.canonicalPoolRoot, "storage.json")) : null;
|
|
11496
11537
|
if (canonicalStats?.isSymbolicLink()) {
|
|
11497
11538
|
return storageDetails(storage, "conflict", ["canonical-root-symlink"]);
|
|
11498
11539
|
}
|
|
@@ -11578,7 +11619,7 @@ async function findPendingMigrations(storage) {
|
|
|
11578
11619
|
}
|
|
11579
11620
|
const pending = [];
|
|
11580
11621
|
for (const entry of entries) {
|
|
11581
|
-
const journalPath =
|
|
11622
|
+
const journalPath = import_node_path23.default.join(storage.migrationRoot, entry, "journal.json");
|
|
11582
11623
|
const journal = await readJson3(journalPath);
|
|
11583
11624
|
if (journal?.schemaVersion === 1 && journal.migrationId === entry && !["completed", "rolled_back"].includes(journal.state)) {
|
|
11584
11625
|
pending.push(journal);
|
|
@@ -11650,7 +11691,7 @@ function isPidLive2(pid) {
|
|
|
11650
11691
|
}
|
|
11651
11692
|
}
|
|
11652
11693
|
function validateBetaSlotLease(value, slotId) {
|
|
11653
|
-
const valid = value?.schemaVersion === LEASE_SCHEMA_VERSION && value.slotId === slotId && typeof value.leaseNonce === "string" && value.leaseNonce.length > 0 && typeof value.ownerSessionId === "string" && typeof value.ownerSourceRoot === "string" &&
|
|
11694
|
+
const valid = value?.schemaVersion === LEASE_SCHEMA_VERSION && value.slotId === slotId && typeof value.leaseNonce === "string" && value.leaseNonce.length > 0 && typeof value.ownerSessionId === "string" && typeof value.ownerSourceRoot === "string" && import_node_path24.default.isAbsolute(value.ownerSourceRoot) && typeof value.ownerRevision === "string" && typeof value.ownerManifestPath === "string" && import_node_path24.default.isAbsolute(value.ownerManifestPath) && Number.isInteger(value.allocatorPid) && value.allocatorPid > 0 && typeof value.acquiredAt === "string" && Number.isFinite(Date.parse(value.acquiredAt));
|
|
11654
11695
|
if (!valid) {
|
|
11655
11696
|
throw new DevSessionError("Beta slot lease is corrupt or unsupported", 5, {
|
|
11656
11697
|
slotId,
|
|
@@ -11660,7 +11701,7 @@ function validateBetaSlotLease(value, slotId) {
|
|
|
11660
11701
|
return value;
|
|
11661
11702
|
}
|
|
11662
11703
|
async function inspectSlot(slotId, paths) {
|
|
11663
|
-
const leasePath =
|
|
11704
|
+
const leasePath = import_node_path24.default.join(paths.leasesDir, `${slotId}.lock`);
|
|
11664
11705
|
try {
|
|
11665
11706
|
const { value } = await readRegularJson(leasePath, paths.poolRoot);
|
|
11666
11707
|
const lease = validateBetaSlotLease(value, slotId);
|
|
@@ -11740,7 +11781,7 @@ async function assertBetaSlotLease({
|
|
|
11740
11781
|
}) {
|
|
11741
11782
|
assertBetaSlotId(slotId);
|
|
11742
11783
|
const paths = resolveBetaPoolPaths(homeDir);
|
|
11743
|
-
const leasePath =
|
|
11784
|
+
const leasePath = import_node_path24.default.join(paths.leasesDir, `${slotId}.lock`);
|
|
11744
11785
|
let read;
|
|
11745
11786
|
try {
|
|
11746
11787
|
read = await readRegularJson(leasePath, paths.poolRoot);
|
|
@@ -11778,20 +11819,20 @@ async function releaseBetaSlotLease(identity) {
|
|
|
11778
11819
|
|
|
11779
11820
|
// scripts/dev-session/beta-pool/process-inspection.mjs
|
|
11780
11821
|
var import_node_os12 = __toESM(require("node:os"), 1);
|
|
11781
|
-
var
|
|
11822
|
+
var import_node_path25 = __toESM(require("node:path"), 1);
|
|
11782
11823
|
async function inspectBetaSlotProcessSafety(slotId, homeDir = import_node_os12.default.homedir()) {
|
|
11783
11824
|
const targets = resolveBetaUpdateTargets(homeDir, slotId);
|
|
11784
11825
|
const [desktop, backend, appServer, references] = await Promise.all([
|
|
11785
11826
|
inspectRecordedProcessState(
|
|
11786
|
-
|
|
11827
|
+
import_node_path25.default.join(targets.userData, "beta-desktop-status.json"),
|
|
11787
11828
|
["app", "pid"]
|
|
11788
11829
|
),
|
|
11789
11830
|
inspectRecordedProcessState(
|
|
11790
|
-
|
|
11831
|
+
import_node_path25.default.join(targets.userData, "browser-profile", "backend.lock.json"),
|
|
11791
11832
|
["pid"]
|
|
11792
11833
|
),
|
|
11793
11834
|
inspectRecordedProcessState(
|
|
11794
|
-
|
|
11835
|
+
import_node_path25.default.join(targets.appServerHome, "app-server.lock.json"),
|
|
11795
11836
|
["pid"]
|
|
11796
11837
|
),
|
|
11797
11838
|
inspectProcessReferences([
|
|
@@ -11825,7 +11866,7 @@ async function betaSlotProcessesAreAbsent(slotId, homeDir = import_node_os12.def
|
|
|
11825
11866
|
// scripts/dev-session/beta-pool/retention.mjs
|
|
11826
11867
|
var import_promises10 = __toESM(require("node:fs/promises"), 1);
|
|
11827
11868
|
var import_node_os13 = __toESM(require("node:os"), 1);
|
|
11828
|
-
var
|
|
11869
|
+
var import_node_path26 = __toESM(require("node:path"), 1);
|
|
11829
11870
|
async function lstatOptional(targetPath) {
|
|
11830
11871
|
try {
|
|
11831
11872
|
return await import_promises10.default.lstat(targetPath);
|
|
@@ -11843,8 +11884,8 @@ function retentionStateError(message, details) {
|
|
|
11843
11884
|
});
|
|
11844
11885
|
}
|
|
11845
11886
|
async function validateBetaRuntimeReleaseAllowlist(runtimeHome, previousReleaseId) {
|
|
11846
|
-
const pointerPath =
|
|
11847
|
-
const releasesDir =
|
|
11887
|
+
const pointerPath = import_node_path26.default.join(runtimeHome, "current.json");
|
|
11888
|
+
const releasesDir = import_node_path26.default.join(runtimeHome, "releases");
|
|
11848
11889
|
const pointerExists = await lstatOptional(pointerPath);
|
|
11849
11890
|
const releasesExist = await lstatOptional(releasesDir);
|
|
11850
11891
|
if (!pointerExists && !releasesExist) {
|
|
@@ -11886,7 +11927,7 @@ async function validateBetaRuntimeReleaseAllowlist(runtimeHome, previousReleaseI
|
|
|
11886
11927
|
allowlist.add(previousReleaseId);
|
|
11887
11928
|
}
|
|
11888
11929
|
for (const releaseId of allowlist) {
|
|
11889
|
-
const releasePath =
|
|
11930
|
+
const releasePath = import_node_path26.default.join(releasesDir, releaseId);
|
|
11890
11931
|
const stats = await lstatOptional(releasePath);
|
|
11891
11932
|
if (!stats || !stats.isDirectory() || stats.isSymbolicLink()) {
|
|
11892
11933
|
throw retentionStateError(
|
|
@@ -11924,7 +11965,7 @@ async function readBetaSlotWarmState(targets, slotId) {
|
|
|
11924
11965
|
}
|
|
11925
11966
|
}
|
|
11926
11967
|
async function readEffectiveWarmState(targets, slotId) {
|
|
11927
|
-
const pendingPath =
|
|
11968
|
+
const pendingPath = import_node_path26.default.join(
|
|
11928
11969
|
targets.instanceRoot,
|
|
11929
11970
|
"diagnostics",
|
|
11930
11971
|
"pending.json"
|
|
@@ -11973,7 +12014,7 @@ async function validateAppBackupReferences({
|
|
|
11973
12014
|
applicationsDir
|
|
11974
12015
|
}) {
|
|
11975
12016
|
const referencedBackup = state?.previous?.app?.backupPath ?? null;
|
|
11976
|
-
const backupPrefix =
|
|
12017
|
+
const backupPrefix = import_node_path26.default.basename(
|
|
11977
12018
|
resolveBetaAppBackupPrefix(slotId, applicationsDir)
|
|
11978
12019
|
);
|
|
11979
12020
|
const isRollbackEntry = (entry) => entry === backupPrefix || entry.startsWith(`${backupPrefix}-`) && /^\d+$/.test(entry.slice(backupPrefix.length + 1));
|
|
@@ -11987,8 +12028,8 @@ async function validateAppBackupReferences({
|
|
|
11987
12028
|
}
|
|
11988
12029
|
applicationEntries = [];
|
|
11989
12030
|
}
|
|
11990
|
-
const backupPaths = applicationEntries.filter(isRollbackEntry).map((entry) =>
|
|
11991
|
-
const legacyBackupPaths = applicationEntries.filter((entry) => entry.startsWith(legacyBackupPrefix)).map((entry) =>
|
|
12031
|
+
const backupPaths = applicationEntries.filter(isRollbackEntry).map((entry) => import_node_path26.default.join(applicationsDir, entry));
|
|
12032
|
+
const legacyBackupPaths = applicationEntries.filter((entry) => entry.startsWith(legacyBackupPrefix)).map((entry) => import_node_path26.default.join(applicationsDir, entry));
|
|
11992
12033
|
const allBackupPaths = [...backupPaths, ...legacyBackupPaths];
|
|
11993
12034
|
if (allBackupPaths.length > 0 && !referencedBackup) {
|
|
11994
12035
|
throw retentionStateError("Beta app previous pointer is missing", {
|
|
@@ -11998,8 +12039,8 @@ async function validateAppBackupReferences({
|
|
|
11998
12039
|
}
|
|
11999
12040
|
let referenceKind = null;
|
|
12000
12041
|
if (referencedBackup && state?.previous?.app?.exists === true) {
|
|
12001
|
-
const resolvedBackup =
|
|
12002
|
-
if (
|
|
12042
|
+
const resolvedBackup = import_node_path26.default.resolve(referencedBackup);
|
|
12043
|
+
if (import_node_path26.default.basename(referencedBackup).startsWith(legacyBackupPrefix)) {
|
|
12003
12044
|
if (!legacyBackupPaths.includes(resolvedBackup)) {
|
|
12004
12045
|
throw retentionStateError(
|
|
12005
12046
|
"Beta legacy app previous pointer is invalid",
|
|
@@ -12009,8 +12050,8 @@ async function validateAppBackupReferences({
|
|
|
12009
12050
|
}
|
|
12010
12051
|
);
|
|
12011
12052
|
}
|
|
12012
|
-
const suffix =
|
|
12013
|
-
const migratedBackup =
|
|
12053
|
+
const suffix = import_node_path26.default.basename(resolvedBackup).slice(legacyBackupPrefix.length);
|
|
12054
|
+
const migratedBackup = import_node_path26.default.join(
|
|
12014
12055
|
applicationsDir,
|
|
12015
12056
|
`${backupPrefix}${suffix}`
|
|
12016
12057
|
);
|
|
@@ -12021,7 +12062,7 @@ async function validateAppBackupReferences({
|
|
|
12021
12062
|
});
|
|
12022
12063
|
}
|
|
12023
12064
|
referenceKind = "legacy";
|
|
12024
|
-
} else if (!backupPaths.includes(resolvedBackup) || !
|
|
12065
|
+
} else if (!backupPaths.includes(resolvedBackup) || !import_node_path26.default.basename(referencedBackup).startsWith(backupPrefix)) {
|
|
12025
12066
|
throw retentionStateError("Beta app previous pointer is invalid", {
|
|
12026
12067
|
slotId,
|
|
12027
12068
|
referencedBackup
|
|
@@ -12051,7 +12092,7 @@ async function validateBetaSlotRetentionState({
|
|
|
12051
12092
|
const [desktopAllowlist, appServerAllowlist] = await Promise.all([
|
|
12052
12093
|
validateBetaRuntimeReleaseAllowlist(targets.runtimeHome, desktopPrevious),
|
|
12053
12094
|
validateBetaRuntimeReleaseAllowlist(
|
|
12054
|
-
|
|
12095
|
+
import_node_path26.default.join(targets.appServerHome, "runtime"),
|
|
12055
12096
|
appServerPrevious
|
|
12056
12097
|
)
|
|
12057
12098
|
]);
|
|
@@ -12070,7 +12111,7 @@ async function validateBetaSlotRetentionState({
|
|
|
12070
12111
|
};
|
|
12071
12112
|
}
|
|
12072
12113
|
async function assertNoBetaSlotSymlinkComponents(rootPath, targetPath) {
|
|
12073
|
-
const root =
|
|
12114
|
+
const root = import_node_path26.default.resolve(rootPath);
|
|
12074
12115
|
const target = assertPathInside(root, targetPath, "Beta controlled path");
|
|
12075
12116
|
const rootStats = await import_promises10.default.lstat(root).catch((error) => {
|
|
12076
12117
|
if (error?.code === "ENOENT") {
|
|
@@ -12084,11 +12125,11 @@ async function assertNoBetaSlotSymlinkComponents(rootPath, targetPath) {
|
|
|
12084
12125
|
});
|
|
12085
12126
|
}
|
|
12086
12127
|
let current = root;
|
|
12087
|
-
for (const component of
|
|
12128
|
+
for (const component of import_node_path26.default.relative(root, target).split(import_node_path26.default.sep)) {
|
|
12088
12129
|
if (!component) {
|
|
12089
12130
|
continue;
|
|
12090
12131
|
}
|
|
12091
|
-
current =
|
|
12132
|
+
current = import_node_path26.default.join(current, component);
|
|
12092
12133
|
const stats = await import_promises10.default.lstat(current).catch((error) => {
|
|
12093
12134
|
if (error?.code === "ENOENT") {
|
|
12094
12135
|
return null;
|
|
@@ -12114,8 +12155,8 @@ async function inspectBetaSlotRetentionSafety({
|
|
|
12114
12155
|
const targets = await resolveBetaSlotRetentionTargets(homeDir, slotId);
|
|
12115
12156
|
await assertNoBetaSlotSymlinkComponents(homeDir, targets.runtimeHome);
|
|
12116
12157
|
await assertNoBetaSlotSymlinkComponents(
|
|
12117
|
-
|
|
12118
|
-
|
|
12158
|
+
import_node_path26.default.join(homeDir, ".runweave"),
|
|
12159
|
+
import_node_path26.default.join(targets.appServerHome, "runtime")
|
|
12119
12160
|
);
|
|
12120
12161
|
const effective = await readEffectiveWarmState(targets, slotId);
|
|
12121
12162
|
await validateBetaSlotRetentionState({
|
|
@@ -12152,16 +12193,16 @@ async function resolveBetaSlotRetentionTargets(homeDir, slotId) {
|
|
|
12152
12193
|
}
|
|
12153
12194
|
|
|
12154
12195
|
// scripts/dev-session/beta-pool/storage/index.mjs
|
|
12155
|
-
var
|
|
12196
|
+
var import_node_crypto11 = require("node:crypto");
|
|
12156
12197
|
var import_node_child_process9 = require("node:child_process");
|
|
12157
12198
|
var import_promises11 = __toESM(require("node:fs/promises"), 1);
|
|
12158
12199
|
var import_node_os15 = __toESM(require("node:os"), 1);
|
|
12159
|
-
var
|
|
12200
|
+
var import_node_path28 = __toESM(require("node:path"), 1);
|
|
12160
12201
|
var import_node_util5 = require("node:util");
|
|
12161
12202
|
|
|
12162
12203
|
// scripts/dev-session/beta-pool/metadata.mjs
|
|
12163
12204
|
var import_node_os14 = __toESM(require("node:os"), 1);
|
|
12164
|
-
var
|
|
12205
|
+
var import_node_path27 = __toESM(require("node:path"), 1);
|
|
12165
12206
|
async function recordBetaSlotRelease({
|
|
12166
12207
|
slotId,
|
|
12167
12208
|
revision,
|
|
@@ -12171,7 +12212,7 @@ async function recordBetaSlotRelease({
|
|
|
12171
12212
|
homeDir = import_node_os14.default.homedir()
|
|
12172
12213
|
}) {
|
|
12173
12214
|
const paths = resolveBetaPoolPaths(homeDir);
|
|
12174
|
-
const metadataPath =
|
|
12215
|
+
const metadataPath = import_node_path27.default.join(
|
|
12175
12216
|
paths.metadataDir,
|
|
12176
12217
|
`${assertBetaSlotId(slotId)}.json`
|
|
12177
12218
|
);
|
|
@@ -12200,7 +12241,7 @@ async function readBetaSlotMetadata(slotId, { homeDir = import_node_os14.default
|
|
|
12200
12241
|
const paths = resolveBetaPoolPaths(homeDir);
|
|
12201
12242
|
try {
|
|
12202
12243
|
const { value } = await readRegularJson(
|
|
12203
|
-
|
|
12244
|
+
import_node_path27.default.join(paths.metadataDir, `${assertBetaSlotId(slotId)}.json`),
|
|
12204
12245
|
paths.poolRoot
|
|
12205
12246
|
);
|
|
12206
12247
|
if (!value || typeof value !== "object" || ![1, 2].includes(value.schemaVersion) || value.slotId !== slotId) {
|
|
@@ -12227,7 +12268,7 @@ async function recordBetaSlotRecoveryAttempt({
|
|
|
12227
12268
|
const current = await readBetaSlotMetadata(slotId, { homeDir });
|
|
12228
12269
|
const paths = resolveBetaPoolPaths(homeDir);
|
|
12229
12270
|
await atomicWriteJson2(
|
|
12230
|
-
|
|
12271
|
+
import_node_path27.default.join(paths.metadataDir, `${assertBetaSlotId(slotId)}.json`),
|
|
12231
12272
|
{
|
|
12232
12273
|
...current ?? {},
|
|
12233
12274
|
schemaVersion: 2,
|
|
@@ -12250,7 +12291,7 @@ var MIN_PLANNED_WRITE_BYTES = 512 * 1024 * 1024;
|
|
|
12250
12291
|
var BACKEND_CONNECTION_SETTINGS_FILES = ["agent-provider-catalogs.json"];
|
|
12251
12292
|
var LAUNCH_SERVICES_REGISTER = "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister";
|
|
12252
12293
|
async function unregisterApplicationPath(appPath, applicationsDir) {
|
|
12253
|
-
if (process.platform !== "darwin" ||
|
|
12294
|
+
if (process.platform !== "darwin" || import_node_path28.default.resolve(applicationsDir) !== "/Applications") {
|
|
12254
12295
|
return false;
|
|
12255
12296
|
}
|
|
12256
12297
|
return await execFileAsync5(LAUNCH_SERVICES_REGISTER, ["-u", appPath]).then(() => true).catch(() => false);
|
|
@@ -12278,19 +12319,19 @@ async function calculatePathBytes(targetPath, rejectSymlink = true) {
|
|
|
12278
12319
|
}
|
|
12279
12320
|
let bytes = 0;
|
|
12280
12321
|
for (const entry of await import_promises11.default.readdir(targetPath)) {
|
|
12281
|
-
bytes += await calculatePathBytes(
|
|
12322
|
+
bytes += await calculatePathBytes(import_node_path28.default.join(targetPath, entry), false);
|
|
12282
12323
|
}
|
|
12283
12324
|
return bytes;
|
|
12284
12325
|
}
|
|
12285
12326
|
async function pruneRuntime(runtimeHome, previousReleaseId, validated = null) {
|
|
12286
|
-
const releasesDir =
|
|
12327
|
+
const releasesDir = import_node_path28.default.join(runtimeHome, "releases");
|
|
12287
12328
|
const allowlist = validated ?? await validateBetaRuntimeReleaseAllowlist(runtimeHome, previousReleaseId);
|
|
12288
12329
|
let cleanedBytes = 0;
|
|
12289
12330
|
for (const entry of await import_promises11.default.readdir(releasesDir).catch(() => [])) {
|
|
12290
12331
|
if (allowlist.has(entry)) {
|
|
12291
12332
|
continue;
|
|
12292
12333
|
}
|
|
12293
|
-
const target =
|
|
12334
|
+
const target = import_node_path28.default.join(releasesDir, entry);
|
|
12294
12335
|
cleanedBytes += await calculatePathBytes(target);
|
|
12295
12336
|
await import_promises11.default.rm(target, { recursive: true, force: true });
|
|
12296
12337
|
}
|
|
@@ -12301,13 +12342,13 @@ async function collectSharedRuntimeReleaseReferences(homeDir, slotId, runtimeHom
|
|
|
12301
12342
|
for (const otherSlotId of BETA_SLOT_IDS) {
|
|
12302
12343
|
if (otherSlotId === slotId) continue;
|
|
12303
12344
|
const otherTargets = await resolveBetaSlotRetentionTargets(homeDir, otherSlotId);
|
|
12304
|
-
if (
|
|
12345
|
+
if (import_node_path28.default.resolve(resolveRuntimeHome(otherTargets)) !== import_node_path28.default.resolve(runtimeHome)) continue;
|
|
12305
12346
|
const otherState = await readBetaSlotWarmState(otherTargets, otherSlotId);
|
|
12306
12347
|
if (otherState?.[releaseField]) retained.add(otherState[releaseField]);
|
|
12307
12348
|
if (otherState?.devSessionId === otherState?.previous?.devSessionId && otherState?.previous?.[releaseField]) {
|
|
12308
12349
|
retained.add(otherState.previous[releaseField]);
|
|
12309
12350
|
}
|
|
12310
|
-
const pendingPath =
|
|
12351
|
+
const pendingPath = import_node_path28.default.join(otherTargets.instanceRoot, "diagnostics", "pending.json");
|
|
12311
12352
|
const pendingStats = await import_promises11.default.lstat(pendingPath).catch((error) => {
|
|
12312
12353
|
if (error?.code === "ENOENT") return null;
|
|
12313
12354
|
throw error;
|
|
@@ -12330,7 +12371,7 @@ async function collectSharedRuntimeReleaseReferences(homeDir, slotId, runtimeHom
|
|
|
12330
12371
|
async function pruneLogs(logDir) {
|
|
12331
12372
|
const entries = [];
|
|
12332
12373
|
for (const entry of await import_promises11.default.readdir(logDir).catch(() => [])) {
|
|
12333
|
-
const filePath =
|
|
12374
|
+
const filePath = import_node_path28.default.join(logDir, entry);
|
|
12334
12375
|
const stats = await import_promises11.default.lstat(filePath);
|
|
12335
12376
|
if (stats.isFile() && !stats.isSymbolicLink()) {
|
|
12336
12377
|
entries.push({ filePath, mtimeMs: stats.mtimeMs, size: stats.size });
|
|
@@ -12353,7 +12394,7 @@ async function pruneArtifacts(artifactsRoot, allowlist) {
|
|
|
12353
12394
|
const artifactMatch = /^runweave-runtime-(.+?)(?:\.zip)?$/.exec(entry);
|
|
12354
12395
|
const releaseId = artifactMatch?.[1] ?? entry;
|
|
12355
12396
|
if (allowlist.has(releaseId)) continue;
|
|
12356
|
-
const target =
|
|
12397
|
+
const target = import_node_path28.default.join(artifactsRoot, entry);
|
|
12357
12398
|
cleanedBytes += await calculatePathBytes(target);
|
|
12358
12399
|
await import_promises11.default.rm(target, { recursive: true, force: true });
|
|
12359
12400
|
}
|
|
@@ -12367,10 +12408,10 @@ async function applyBetaSlotRetention({
|
|
|
12367
12408
|
const targets = await resolveBetaSlotRetentionTargets(homeDir, slotId);
|
|
12368
12409
|
await assertNoBetaSlotSymlinkComponents(homeDir, targets.runtimeHome);
|
|
12369
12410
|
await assertNoBetaSlotSymlinkComponents(
|
|
12370
|
-
|
|
12371
|
-
|
|
12411
|
+
import_node_path28.default.join(homeDir, ".runweave"),
|
|
12412
|
+
import_node_path28.default.join(targets.appServerHome, "runtime")
|
|
12372
12413
|
);
|
|
12373
|
-
const pendingPath =
|
|
12414
|
+
const pendingPath = import_node_path28.default.join(
|
|
12374
12415
|
targets.instanceRoot,
|
|
12375
12416
|
"diagnostics",
|
|
12376
12417
|
"pending.json"
|
|
@@ -12428,9 +12469,9 @@ async function applyBetaSlotRetention({
|
|
|
12428
12469
|
let appBackupMigrated = false;
|
|
12429
12470
|
let launchServicesUnregistered = 0;
|
|
12430
12471
|
if (referenceKind === "legacy") {
|
|
12431
|
-
const resolvedLegacyBackup =
|
|
12432
|
-
const suffix =
|
|
12433
|
-
const migratedBackup =
|
|
12472
|
+
const resolvedLegacyBackup = import_node_path28.default.resolve(referencedBackup);
|
|
12473
|
+
const suffix = import_node_path28.default.basename(resolvedLegacyBackup).slice(legacyBackupPrefix.length);
|
|
12474
|
+
const migratedBackup = import_node_path28.default.join(
|
|
12434
12475
|
applicationsDir,
|
|
12435
12476
|
`${backupPrefix}${suffix}`
|
|
12436
12477
|
);
|
|
@@ -12454,15 +12495,15 @@ async function applyBetaSlotRetention({
|
|
|
12454
12495
|
referencedBackup = migratedBackup;
|
|
12455
12496
|
backupPaths.push(migratedBackup);
|
|
12456
12497
|
legacyBackupPaths = legacyBackupPaths.filter(
|
|
12457
|
-
(entry) =>
|
|
12498
|
+
(entry) => import_node_path28.default.resolve(entry) !== resolvedLegacyBackup
|
|
12458
12499
|
);
|
|
12459
12500
|
appBackupMigrated = true;
|
|
12460
12501
|
}
|
|
12461
12502
|
const allBackupPaths = [...backupPaths, ...legacyBackupPaths];
|
|
12462
|
-
const appServerRuntimeHome =
|
|
12503
|
+
const appServerRuntimeHome = import_node_path28.default.join(targets.appServerHome, "runtime");
|
|
12463
12504
|
const [sharedDesktopAllowlist, sharedAppServerAllowlist] = await Promise.all([
|
|
12464
12505
|
collectSharedRuntimeReleaseReferences(homeDir, slotId, targets.runtimeHome, desktopAllowlist, "runtimeReleaseId", (other) => other.runtimeHome),
|
|
12465
|
-
collectSharedRuntimeReleaseReferences(homeDir, slotId, appServerRuntimeHome, appServerAllowlist, "appServerReleaseId", (other) =>
|
|
12506
|
+
collectSharedRuntimeReleaseReferences(homeDir, slotId, appServerRuntimeHome, appServerAllowlist, "appServerReleaseId", (other) => import_node_path28.default.join(other.appServerHome, "runtime"))
|
|
12466
12507
|
]);
|
|
12467
12508
|
const [desktopRuntime, appServerRuntime, logs] = await Promise.all([
|
|
12468
12509
|
pruneRuntime(targets.runtimeHome, desktopPrevious, sharedDesktopAllowlist),
|
|
@@ -12471,16 +12512,16 @@ async function applyBetaSlotRetention({
|
|
|
12471
12512
|
appServerPrevious,
|
|
12472
12513
|
sharedAppServerAllowlist
|
|
12473
12514
|
),
|
|
12474
|
-
pruneLogs(
|
|
12515
|
+
pruneLogs(import_node_path28.default.join(targets.instanceRoot, "diagnostics", "logs"))
|
|
12475
12516
|
]);
|
|
12476
|
-
const artifactsRoot =
|
|
12517
|
+
const artifactsRoot = import_node_path28.default.join(targets.instanceRoot, "runtime-artifacts");
|
|
12477
12518
|
const artifacts = await pruneArtifacts(artifactsRoot, desktopAllowlist);
|
|
12478
12519
|
let appBackupCleanedBytes = 0;
|
|
12479
12520
|
for (const backupPath of allBackupPaths) {
|
|
12480
|
-
if (referencedBackup &&
|
|
12521
|
+
if (referencedBackup && import_node_path28.default.resolve(backupPath) === import_node_path28.default.resolve(referencedBackup)) {
|
|
12481
12522
|
continue;
|
|
12482
12523
|
}
|
|
12483
|
-
if (
|
|
12524
|
+
if (import_node_path28.default.basename(backupPath).startsWith(legacyBackupPrefix) && await unregisterApplicationPath(backupPath, applicationsDir)) {
|
|
12484
12525
|
launchServicesUnregistered += 1;
|
|
12485
12526
|
}
|
|
12486
12527
|
appBackupCleanedBytes += await calculatePathBytes(backupPath);
|
|
@@ -12514,7 +12555,7 @@ async function assertSafeMutableRoot(targetPath, allowedRoot) {
|
|
|
12514
12555
|
async function readBackendConnectionSettings(userData, instanceRoot) {
|
|
12515
12556
|
const files = [];
|
|
12516
12557
|
for (const fileName of BACKEND_CONNECTION_SETTINGS_FILES) {
|
|
12517
|
-
const filePath =
|
|
12558
|
+
const filePath = import_node_path28.default.join(userData, "browser-profile", fileName);
|
|
12518
12559
|
await assertNoBetaSlotSymlinkComponents(instanceRoot, filePath);
|
|
12519
12560
|
const stats = await import_promises11.default.lstat(filePath).catch((error) => {
|
|
12520
12561
|
if (error?.code === "ENOENT") {
|
|
@@ -12540,10 +12581,10 @@ async function restoreBackendConnectionSettings(userData, files) {
|
|
|
12540
12581
|
if (files.length === 0) {
|
|
12541
12582
|
return;
|
|
12542
12583
|
}
|
|
12543
|
-
const profileDir =
|
|
12584
|
+
const profileDir = import_node_path28.default.join(userData, "browser-profile");
|
|
12544
12585
|
await import_promises11.default.mkdir(profileDir, { recursive: true, mode: 448 });
|
|
12545
12586
|
for (const file of files) {
|
|
12546
|
-
await import_promises11.default.writeFile(
|
|
12587
|
+
await import_promises11.default.writeFile(import_node_path28.default.join(profileDir, file.fileName), file.contents, {
|
|
12547
12588
|
mode: 384
|
|
12548
12589
|
});
|
|
12549
12590
|
}
|
|
@@ -12557,7 +12598,7 @@ async function resetBetaSlotMutableState({
|
|
|
12557
12598
|
const targets = resolveBetaUpdateTargets(homeDir, assertBetaSlotId(slotId));
|
|
12558
12599
|
await assertNoBetaSlotSymlinkComponents(homeDir, targets.instanceRoot);
|
|
12559
12600
|
await assertNoBetaSlotSymlinkComponents(
|
|
12560
|
-
|
|
12601
|
+
import_node_path28.default.join(homeDir, ".runweave"),
|
|
12561
12602
|
targets.appServerHome
|
|
12562
12603
|
);
|
|
12563
12604
|
const userData = await assertSafeMutableRoot(
|
|
@@ -12566,9 +12607,9 @@ async function resetBetaSlotMutableState({
|
|
|
12566
12607
|
);
|
|
12567
12608
|
const backendConnectionSettings = preserveBackendConnectionSettings ? await readBackendConnectionSettings(userData, targets.instanceRoot) : [];
|
|
12568
12609
|
await import_promises11.default.mkdir(targets.instanceRoot, { recursive: true, mode: 448 });
|
|
12569
|
-
const resetPath =
|
|
12610
|
+
const resetPath = import_node_path28.default.join(
|
|
12570
12611
|
targets.instanceRoot,
|
|
12571
|
-
`.user-data.reset-${(0,
|
|
12612
|
+
`.user-data.reset-${(0, import_node_crypto11.randomUUID)()}`
|
|
12572
12613
|
);
|
|
12573
12614
|
if (await import_promises11.default.lstat(userData).catch(() => null)) {
|
|
12574
12615
|
await import_promises11.default.rename(userData, resetPath);
|
|
@@ -12579,7 +12620,7 @@ async function resetBetaSlotMutableState({
|
|
|
12579
12620
|
await import_promises11.default.rm(resetPath, { recursive: true, force: true });
|
|
12580
12621
|
for (const entry of await import_promises11.default.readdir(targets.instanceRoot)) {
|
|
12581
12622
|
if (entry.startsWith(".user-data.reset-")) {
|
|
12582
|
-
await import_promises11.default.rm(
|
|
12623
|
+
await import_promises11.default.rm(import_node_path28.default.join(targets.instanceRoot, entry), {
|
|
12583
12624
|
recursive: true,
|
|
12584
12625
|
force: true
|
|
12585
12626
|
});
|
|
@@ -12587,33 +12628,33 @@ async function resetBetaSlotMutableState({
|
|
|
12587
12628
|
}
|
|
12588
12629
|
const appServerHome = await assertSafeMutableRoot(
|
|
12589
12630
|
targets.appServerHome,
|
|
12590
|
-
|
|
12631
|
+
import_node_path28.default.join(homeDir, ".runweave", "app-server-beta")
|
|
12591
12632
|
);
|
|
12592
12633
|
await import_promises11.default.mkdir(appServerHome, { recursive: true, mode: 448 });
|
|
12593
12634
|
for (const entry of await import_promises11.default.readdir(appServerHome)) {
|
|
12594
12635
|
if (entry === "runtime") {
|
|
12595
|
-
const runtimeStats = await import_promises11.default.lstat(
|
|
12636
|
+
const runtimeStats = await import_promises11.default.lstat(import_node_path28.default.join(appServerHome, entry));
|
|
12596
12637
|
if (!runtimeStats.isDirectory() || runtimeStats.isSymbolicLink()) {
|
|
12597
12638
|
throw new DevSessionError(
|
|
12598
12639
|
"Beta App Server runtime must be a regular directory",
|
|
12599
12640
|
5,
|
|
12600
|
-
{ path:
|
|
12641
|
+
{ path: import_node_path28.default.join(appServerHome, entry) }
|
|
12601
12642
|
);
|
|
12602
12643
|
}
|
|
12603
12644
|
continue;
|
|
12604
12645
|
}
|
|
12605
|
-
await import_promises11.default.rm(
|
|
12646
|
+
await import_promises11.default.rm(import_node_path28.default.join(appServerHome, entry), {
|
|
12606
12647
|
recursive: true,
|
|
12607
12648
|
force: true
|
|
12608
12649
|
});
|
|
12609
12650
|
}
|
|
12610
12651
|
for (const temporaryPath of [
|
|
12611
|
-
|
|
12612
|
-
|
|
12613
|
-
|
|
12614
|
-
|
|
12615
|
-
|
|
12616
|
-
|
|
12652
|
+
import_node_path28.default.join(targets.instanceRoot, "build"),
|
|
12653
|
+
import_node_path28.default.join(targets.instanceRoot, "runtime-artifacts"),
|
|
12654
|
+
import_node_path28.default.join(targets.instanceRoot, "control"),
|
|
12655
|
+
import_node_path28.default.join(targets.instanceRoot, "pending.json"),
|
|
12656
|
+
import_node_path28.default.join(targets.instanceRoot, "diagnostics", "pending.json"),
|
|
12657
|
+
import_node_path28.default.join(targets.instanceRoot, "update.lock")
|
|
12617
12658
|
]) {
|
|
12618
12659
|
await import_promises11.default.rm(temporaryPath, { recursive: true, force: true });
|
|
12619
12660
|
}
|
|
@@ -12630,7 +12671,7 @@ async function resetBetaSlotMutableState({
|
|
|
12630
12671
|
async function readLease(slotId, paths) {
|
|
12631
12672
|
try {
|
|
12632
12673
|
const { value, stats } = await readRegularJson(
|
|
12633
|
-
|
|
12674
|
+
import_node_path29.default.join(paths.leasesDir, `${slotId}.lock`),
|
|
12634
12675
|
paths.poolRoot
|
|
12635
12676
|
);
|
|
12636
12677
|
return {
|
|
@@ -12648,7 +12689,7 @@ async function readLease(slotId, paths) {
|
|
|
12648
12689
|
failureReason: null
|
|
12649
12690
|
};
|
|
12650
12691
|
}
|
|
12651
|
-
const stats = await import_promises12.default.lstat(
|
|
12692
|
+
const stats = await import_promises12.default.lstat(import_node_path29.default.join(paths.leasesDir, `${slotId}.lock`)).catch(() => null);
|
|
12652
12693
|
return {
|
|
12653
12694
|
state: "corrupt",
|
|
12654
12695
|
value: null,
|
|
@@ -12669,7 +12710,7 @@ async function readManifestObservation(lease) {
|
|
|
12669
12710
|
try {
|
|
12670
12711
|
handle = await import_promises12.default.open(
|
|
12671
12712
|
lease.ownerManifestPath,
|
|
12672
|
-
|
|
12713
|
+
import_node_fs17.constants.O_RDONLY | import_node_fs17.constants.O_NOFOLLOW
|
|
12673
12714
|
);
|
|
12674
12715
|
const opened = await handle.stat();
|
|
12675
12716
|
if (!opened.isFile()) {
|
|
@@ -13109,9 +13150,9 @@ async function inspectBetaPool({
|
|
|
13109
13150
|
}
|
|
13110
13151
|
|
|
13111
13152
|
// scripts/dev-resources/identity.mjs
|
|
13112
|
-
var
|
|
13153
|
+
var import_node_crypto12 = require("node:crypto");
|
|
13113
13154
|
function ownershipVersion(generation, identity) {
|
|
13114
|
-
return (0,
|
|
13155
|
+
return (0, import_node_crypto12.createHash)("sha256").update(JSON.stringify([generation, identity])).digest("hex");
|
|
13115
13156
|
}
|
|
13116
13157
|
function sessionIdentity(manifest) {
|
|
13117
13158
|
return [
|
|
@@ -13234,7 +13275,7 @@ function manifestOwner(manifest) {
|
|
|
13234
13275
|
return {
|
|
13235
13276
|
id: manifest.devSessionId,
|
|
13236
13277
|
task: manifest.profile,
|
|
13237
|
-
worktree:
|
|
13278
|
+
worktree: import_node_path30.default.basename(manifest.source.root),
|
|
13238
13279
|
startedAt: manifest.createdAt ?? null,
|
|
13239
13280
|
lastActivityAt: null
|
|
13240
13281
|
};
|
|
@@ -13256,7 +13297,7 @@ async function inspectSessions(generation, backendPid) {
|
|
|
13256
13297
|
for (const entry of entries.slice(0, 2048)) {
|
|
13257
13298
|
if (entry.name.startsWith(".")) continue;
|
|
13258
13299
|
try {
|
|
13259
|
-
const manifestPath =
|
|
13300
|
+
const manifestPath = import_node_path30.default.join(root, entry.name, "manifest.json");
|
|
13260
13301
|
const stat = await import_promises13.default.lstat(manifestPath);
|
|
13261
13302
|
if (!entry.isDirectory() || stat.isSymbolicLink() || stat.size > 1024 * 1024)
|
|
13262
13303
|
throw new Error("\u4E0D\u5B89\u5168\u7684 manifest");
|
|
@@ -13339,7 +13380,7 @@ async function desktopSnapshot(generation, backendPid) {
|
|
|
13339
13380
|
resource.owner = {
|
|
13340
13381
|
id: slot.lease.owner.sessionId,
|
|
13341
13382
|
task: null,
|
|
13342
|
-
worktree:
|
|
13383
|
+
worktree: import_node_path30.default.basename(slot.lease.owner.sourceRoot),
|
|
13343
13384
|
startedAt: slot.lease.acquiredAt,
|
|
13344
13385
|
lastActivityAt: null
|
|
13345
13386
|
};
|
|
@@ -13440,12 +13481,12 @@ var import_node_os21 = __toESM(require("node:os"), 1);
|
|
|
13440
13481
|
|
|
13441
13482
|
// scripts/dev-session/services/beta-start-recovery.mjs
|
|
13442
13483
|
var import_node_os20 = __toESM(require("node:os"), 1);
|
|
13443
|
-
var
|
|
13484
|
+
var import_node_path34 = __toESM(require("node:path"), 1);
|
|
13444
13485
|
|
|
13445
13486
|
// scripts/dev-session/beta-pool/lifecycle.mjs
|
|
13446
|
-
var
|
|
13487
|
+
var import_node_crypto13 = require("node:crypto");
|
|
13447
13488
|
var import_node_os18 = __toESM(require("node:os"), 1);
|
|
13448
|
-
var
|
|
13489
|
+
var import_node_path31 = __toESM(require("node:path"), 1);
|
|
13449
13490
|
var RELEASE_FAILURE_CHECKPOINTS = /* @__PURE__ */ new Set([
|
|
13450
13491
|
"after_reset",
|
|
13451
13492
|
"after_metadata",
|
|
@@ -13492,7 +13533,7 @@ function createBetaPoolRecoveryReceipt({
|
|
|
13492
13533
|
releasedLease = false,
|
|
13493
13534
|
quarantinedLeasePath = null,
|
|
13494
13535
|
failureReason = null,
|
|
13495
|
-
attemptId = (0,
|
|
13536
|
+
attemptId = (0, import_node_crypto13.randomUUID)(),
|
|
13496
13537
|
attemptedAt = (/* @__PURE__ */ new Date()).toISOString(),
|
|
13497
13538
|
completedAt = null,
|
|
13498
13539
|
phase = null
|
|
@@ -13532,7 +13573,7 @@ async function writeOwnerManifest(lease, manifest, receipt, state, failure) {
|
|
|
13532
13573
|
poolRecovery: receipt,
|
|
13533
13574
|
failure
|
|
13534
13575
|
},
|
|
13535
|
-
|
|
13576
|
+
import_node_path31.default.dirname(lease.ownerManifestPath)
|
|
13536
13577
|
);
|
|
13537
13578
|
}
|
|
13538
13579
|
async function finalizeBetaSlotReleaseClaimed({
|
|
@@ -13710,11 +13751,11 @@ async function finalizeBetaSlotRelease(options) {
|
|
|
13710
13751
|
}
|
|
13711
13752
|
|
|
13712
13753
|
// scripts/dev-session/beta-pool/recovery/index.mjs
|
|
13713
|
-
var
|
|
13754
|
+
var import_node_crypto14 = require("node:crypto");
|
|
13714
13755
|
var import_node_child_process11 = require("node:child_process");
|
|
13715
13756
|
var import_promises14 = __toESM(require("node:fs/promises"), 1);
|
|
13716
13757
|
var import_node_os19 = __toESM(require("node:os"), 1);
|
|
13717
|
-
var
|
|
13758
|
+
var import_node_path32 = __toESM(require("node:path"), 1);
|
|
13718
13759
|
var import_node_util7 = require("node:util");
|
|
13719
13760
|
var execFileAsync6 = (0, import_node_util7.promisify)(import_node_child_process11.execFile);
|
|
13720
13761
|
function sleep(milliseconds) {
|
|
@@ -13722,7 +13763,7 @@ function sleep(milliseconds) {
|
|
|
13722
13763
|
}
|
|
13723
13764
|
async function readLease2(slotId, paths, homeDir) {
|
|
13724
13765
|
const raw = await readRegularJson(
|
|
13725
|
-
|
|
13766
|
+
import_node_path32.default.join(paths.leasesDir, `${slotId}.lock`),
|
|
13726
13767
|
paths.poolRoot
|
|
13727
13768
|
);
|
|
13728
13769
|
const ownerSessionId = raw.value?.ownerSessionId;
|
|
@@ -13745,7 +13786,7 @@ async function readOwnerManifest(lease) {
|
|
|
13745
13786
|
return validateManifest(
|
|
13746
13787
|
(await readRegularJson(
|
|
13747
13788
|
lease.ownerManifestPath,
|
|
13748
|
-
|
|
13789
|
+
import_node_path32.default.dirname(lease.ownerManifestPath)
|
|
13749
13790
|
)).value
|
|
13750
13791
|
);
|
|
13751
13792
|
} catch (error) {
|
|
@@ -13775,7 +13816,7 @@ async function stopRecordedDedicatedServices(manifest, lease, homeDir, stopBetaC
|
|
|
13775
13816
|
}
|
|
13776
13817
|
}
|
|
13777
13818
|
const sourceRoot = manifest.source?.root;
|
|
13778
|
-
if (typeof sourceRoot !== "string" || !
|
|
13819
|
+
if (typeof sourceRoot !== "string" || !import_node_path32.default.isAbsolute(sourceRoot)) {
|
|
13779
13820
|
throw new DevSessionError(
|
|
13780
13821
|
"Beta recovery manifest source root is invalid",
|
|
13781
13822
|
5,
|
|
@@ -13784,7 +13825,7 @@ async function stopRecordedDedicatedServices(manifest, lease, homeDir, stopBetaC
|
|
|
13784
13825
|
}
|
|
13785
13826
|
);
|
|
13786
13827
|
}
|
|
13787
|
-
const controlScript =
|
|
13828
|
+
const controlScript = import_node_path32.default.join(
|
|
13788
13829
|
sourceRoot,
|
|
13789
13830
|
"scripts",
|
|
13790
13831
|
"beta",
|
|
@@ -13826,13 +13867,13 @@ async function stopRecordedDedicatedServices(manifest, lease, homeDir, stopBetaC
|
|
|
13826
13867
|
return stoppedServices;
|
|
13827
13868
|
}
|
|
13828
13869
|
function ownerSessionLockEnv(lease) {
|
|
13829
|
-
const sessionDir =
|
|
13830
|
-
if (
|
|
13870
|
+
const sessionDir = import_node_path32.default.dirname(lease.ownerManifestPath);
|
|
13871
|
+
if (import_node_path32.default.basename(lease.ownerManifestPath) !== "manifest.json" || import_node_path32.default.basename(sessionDir) !== lease.ownerSessionId) {
|
|
13831
13872
|
return null;
|
|
13832
13873
|
}
|
|
13833
13874
|
return {
|
|
13834
13875
|
...process.env,
|
|
13835
|
-
RUNWEAVE_DEV_SESSION_HOME:
|
|
13876
|
+
RUNWEAVE_DEV_SESSION_HOME: import_node_path32.default.dirname(sessionDir)
|
|
13836
13877
|
};
|
|
13837
13878
|
}
|
|
13838
13879
|
async function persistNonMutatingReceipt(receipt, homeDir) {
|
|
@@ -13851,7 +13892,7 @@ async function quarantineCorruptLease({
|
|
|
13851
13892
|
applicationsDir,
|
|
13852
13893
|
paths
|
|
13853
13894
|
}) {
|
|
13854
|
-
const leasePath =
|
|
13895
|
+
const leasePath = import_node_path32.default.join(paths.leasesDir, `${slot.slotId}.lock`);
|
|
13855
13896
|
const initialStats = await import_promises14.default.lstat(leasePath).catch(() => null);
|
|
13856
13897
|
let leaseQuarantined = false;
|
|
13857
13898
|
let quarantinedLeasePath = null;
|
|
@@ -13900,10 +13941,10 @@ async function quarantineCorruptLease({
|
|
|
13900
13941
|
{ slotId: slot.slotId }
|
|
13901
13942
|
);
|
|
13902
13943
|
}
|
|
13903
|
-
const operationId = (0,
|
|
13904
|
-
const operationDir =
|
|
13944
|
+
const operationId = (0, import_node_crypto14.randomUUID)();
|
|
13945
|
+
const operationDir = import_node_path32.default.join(paths.quarantineDir, operationId);
|
|
13905
13946
|
await import_promises14.default.mkdir(operationDir, { recursive: true, mode: 448 });
|
|
13906
|
-
quarantinedLeasePath =
|
|
13947
|
+
quarantinedLeasePath = import_node_path32.default.join(operationDir, "lease.json");
|
|
13907
13948
|
const pending = {
|
|
13908
13949
|
...base,
|
|
13909
13950
|
phase: "release_pending",
|
|
@@ -13916,7 +13957,7 @@ async function quarantineCorruptLease({
|
|
|
13916
13957
|
homeDir
|
|
13917
13958
|
});
|
|
13918
13959
|
await atomicWriteJson2(
|
|
13919
|
-
|
|
13960
|
+
import_node_path32.default.join(operationDir, "operation.json"),
|
|
13920
13961
|
{ receipt: pending, cleanupSummary: { ...reset, retention } },
|
|
13921
13962
|
paths.quarantineDir
|
|
13922
13963
|
);
|
|
@@ -13930,7 +13971,7 @@ async function quarantineCorruptLease({
|
|
|
13930
13971
|
quarantinedLeasePath
|
|
13931
13972
|
};
|
|
13932
13973
|
await atomicWriteJson2(
|
|
13933
|
-
|
|
13974
|
+
import_node_path32.default.join(operationDir, "operation.json"),
|
|
13934
13975
|
{ receipt: completed, cleanupSummary: { ...reset, retention } },
|
|
13935
13976
|
paths.quarantineDir
|
|
13936
13977
|
);
|
|
@@ -14187,15 +14228,15 @@ async function recoverBetaPoolSlot({
|
|
|
14187
14228
|
}
|
|
14188
14229
|
|
|
14189
14230
|
// scripts/beta/operations.mjs
|
|
14190
|
-
var
|
|
14231
|
+
var import_node_fs18 = require("node:fs");
|
|
14191
14232
|
var import_promises15 = __toESM(require("node:fs/promises"), 1);
|
|
14192
|
-
var
|
|
14233
|
+
var import_node_path33 = __toESM(require("node:path"), 1);
|
|
14193
14234
|
async function withBetaLock(paths, operation) {
|
|
14194
|
-
const lockPaths = [
|
|
14235
|
+
const lockPaths = [import_node_path33.default.join(paths.instanceRoot, "update.lock")];
|
|
14195
14236
|
const handles = [];
|
|
14196
14237
|
try {
|
|
14197
14238
|
for (const lockPath of lockPaths) {
|
|
14198
|
-
await import_promises15.default.mkdir(
|
|
14239
|
+
await import_promises15.default.mkdir(import_node_path33.default.dirname(lockPath), { recursive: true });
|
|
14199
14240
|
let handle;
|
|
14200
14241
|
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
14201
14242
|
try {
|
|
@@ -14238,7 +14279,7 @@ function buildUpdateEnv(paths, gitHead, appBackupPath = paths.appBackupPath, sha
|
|
|
14238
14279
|
BROWSER_PROFILE_DIR: paths.profileDir,
|
|
14239
14280
|
RUNWEAVE_CLI_BUNDLE_OUTFILE: paths.controlCliPath,
|
|
14240
14281
|
RUNWEAVE_APP_BACKUP_PATH: appBackupPath,
|
|
14241
|
-
RUNWEAVE_APP_SERVER_CLOUD_SYNC_DIR: sharedAppServer ?
|
|
14282
|
+
RUNWEAVE_APP_SERVER_CLOUD_SYNC_DIR: sharedAppServer ? import_node_path33.default.join(sharedAppServer.homeDir, "cloud-sync") : paths.appServerCloudSyncDir,
|
|
14242
14283
|
RUNWEAVE_APP_SERVER_HOME: sharedAppServer?.homeDir ?? paths.appServerHome,
|
|
14243
14284
|
RUNWEAVE_WHISTLE_PORTS: paths.slotId ? [0, 1, 2].map((index) => 18100 + Number(paths.slotId.slice(-2)) * 10 + index).join(",") : process.env.RUNWEAVE_WHISTLE_PORTS || "18081,18082,18083",
|
|
14244
14285
|
RUNWEAVE_DESKTOP_STATE_DIR: paths.userData,
|
|
@@ -14319,7 +14360,7 @@ async function quitBeta(paths) {
|
|
|
14319
14360
|
}
|
|
14320
14361
|
async function runAppServerCli(paths, command, sourceRevision = null) {
|
|
14321
14362
|
const cliEntry = paths.controlCliPath;
|
|
14322
|
-
if (!(0,
|
|
14363
|
+
if (!(0, import_node_fs18.existsSync)(cliEntry)) {
|
|
14323
14364
|
return { ok: false, code: 1, stderr: `missing CLI build: ${cliEntry}` };
|
|
14324
14365
|
}
|
|
14325
14366
|
return await runCapture(
|
|
@@ -14377,7 +14418,7 @@ async function cleanupIncompleteBetaStart(manifest, { homeDir = import_node_os20
|
|
|
14377
14418
|
);
|
|
14378
14419
|
}
|
|
14379
14420
|
const backendLock = await readJson(
|
|
14380
|
-
|
|
14421
|
+
import_node_path34.default.join(paths.profileDir, "backend.lock.json")
|
|
14381
14422
|
);
|
|
14382
14423
|
if (backendLock && isPidLive(backendLock.pid) && backendLock.devSessionId !== manifest.devSessionId) {
|
|
14383
14424
|
throw new DevSessionError(
|