@runweave/server-linux-x64 0.1.4 → 0.1.5
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 +150 -150
- package/native.tar.gz +0 -0
- package/package.json +1 -1
- package/payload/app-server/build-info.json +4 -4
- package/payload/app-server/index.cjs +127 -95
- package/payload/app-server/index.cjs.map +1 -1
- package/payload/backend/activity-sqlite-worker.cjs +7593 -44
- package/payload/backend/build-info.json +4 -4
- package/payload/backend/dev-resources/control.cjs +211 -160
- package/payload/backend/index.cjs +210 -176
- package/payload/bin/runtime.cjs +22 -5
- package/payload/frontend/dist/assets/{_baseUniq-2DZJ97aQ.js → _baseUniq-Cca1dJQ9.js} +1 -1
- package/payload/frontend/dist/assets/{access-Jw5gZrYY.js → access-DUFDE5w4.js} +1 -1
- package/payload/frontend/dist/assets/{advanced-DRe-Doxo.js → advanced-COAr8Hid.js} +1 -1
- package/payload/frontend/dist/assets/{appearance-D1wpkdXT.js → appearance-DwT_3HyT.js} +1 -1
- package/payload/frontend/dist/assets/{arc-keTQ5uhA.js → arc-BiCpkEHN.js} +1 -1
- package/payload/frontend/dist/assets/{architectureDiagram-Q4EWVU46-BXbCJ77m.js → architectureDiagram-Q4EWVU46-DMulbydF.js} +1 -1
- package/payload/frontend/dist/assets/{blockDiagram-DXYQGD6D-De0Ki8tO.js → blockDiagram-DXYQGD6D-DP3EKW2h.js} +1 -1
- package/payload/frontend/dist/assets/{c4Diagram-AHTNJAMY-EfazoSVi.js → c4Diagram-AHTNJAMY-BLS8RP7a.js} +1 -1
- package/payload/frontend/dist/assets/channel-CKmnPCpJ.js +1 -0
- package/payload/frontend/dist/assets/{chunk-4BX2VUAB-BXCGPL07.js → chunk-4BX2VUAB-BUV-Uw18.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-4TB4RGXK-ByjQ1_yc.js → chunk-4TB4RGXK-94c9VfB5.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-55IACEB6-D-KjMbGJ.js → chunk-55IACEB6-RfLXGW3_.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-EDXVE4YY-tAgLMZ4w.js → chunk-EDXVE4YY-pPo_Q141.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-FMBD7UC4-D3J3ERtV.js → chunk-FMBD7UC4-DS6emz7j.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-OYMX7WX6-DZHtmvkW.js → chunk-OYMX7WX6-G-gZUTTY.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-QZHKN3VN-D6IIGd1d.js → chunk-QZHKN3VN-BTTlBOxb.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-YZCP3GAM-KD19-lMa.js → chunk-YZCP3GAM-BE7Nnglr.js} +1 -1
- package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-B50rK7Wd.js +1 -0
- package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-B50rK7Wd.js +1 -0
- package/payload/frontend/dist/assets/clone-Cgs355hK.js +1 -0
- package/payload/frontend/dist/assets/{connection-Cm6G1HOW.js → connection--S1gQxJQ.js} +1 -1
- package/payload/frontend/dist/assets/{connections-B8tSRWt9.js → connections-BKIzytUO.js} +1 -1
- package/payload/frontend/dist/assets/{cose-bilkent-S5V4N54A-AYXbL8jP.js → cose-bilkent-S5V4N54A-C0uj9jlE.js} +1 -1
- package/payload/frontend/dist/assets/{dagre-KV5264BT-DCunJ-sG.js → dagre-KV5264BT-C21BxT9x.js} +1 -1
- package/payload/frontend/dist/assets/{desktop-DnY652OH.js → desktop-BrFP7uD8.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-5BDNPKRD-Ch2b63ll.js → diagram-5BDNPKRD-Dm_Sv1fY.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-G4DWMVQ6-BAuc_Uar.js → diagram-G4DWMVQ6-CyBlXHYE.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-MMDJMWI5-DH8qMuDA.js → diagram-MMDJMWI5-DlzAJAhf.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-TYMM5635-BflD7Kjb.js → diagram-TYMM5635-BUHbMszI.js} +1 -1
- package/payload/frontend/dist/assets/{erDiagram-SMLLAGMA-BGzvzTP9.js → erDiagram-SMLLAGMA-B_KFaTkr.js} +1 -1
- package/payload/frontend/dist/assets/{flowDiagram-DWJPFMVM-BR4mXArp.js → flowDiagram-DWJPFMVM-Ci8c_uVM.js} +1 -1
- package/payload/frontend/dist/assets/{ganttDiagram-T4ZO3ILL-uXtJoz5O.js → ganttDiagram-T4ZO3ILL-CuX6Iq0t.js} +1 -1
- package/payload/frontend/dist/assets/{gitGraphDiagram-UUTBAWPF-BeLB68OO.js → gitGraphDiagram-UUTBAWPF-g07Rr7cC.js} +1 -1
- package/payload/frontend/dist/assets/{graph-DakNuFNs.js → graph-BFZFDWHT.js} +1 -1
- package/payload/frontend/dist/assets/{image-BICNaNq8.js → image-Bqf_JqcW.js} +1 -1
- package/payload/frontend/dist/assets/{index-Cf9Vl4GJ.js → index-CfimLLEm.js} +5 -5
- package/payload/frontend/dist/assets/{infoDiagram-42DDH7IO-CAGn0b04.js → infoDiagram-42DDH7IO-swg7grwk.js} +1 -1
- package/payload/frontend/dist/assets/{ishikawaDiagram-UXIWVN3A-fbaDUCpd.js → ishikawaDiagram-UXIWVN3A-9RP9c7cN.js} +1 -1
- package/payload/frontend/dist/assets/{journeyDiagram-VCZTEJTY-ZOmjleqG.js → journeyDiagram-VCZTEJTY-Bh523JBl.js} +1 -1
- package/payload/frontend/dist/assets/{kanban-definition-6JOO6SKY-BmODq4tv.js → kanban-definition-6JOO6SKY-BxGTS30A.js} +1 -1
- package/payload/frontend/dist/assets/{layout-CLfuo3Vs.js → layout-BA90oBmS.js} +1 -1
- package/payload/frontend/dist/assets/{linear-csTsZ7Al.js → linear-BVOBmfu-.js} +1 -1
- package/payload/frontend/dist/assets/{main-DwDuhfcr.js → main-wqeDvHCJ.js} +22 -22
- package/payload/frontend/dist/assets/{min-B4B7Rr4j.js → min-CTb5zZxd.js} +1 -1
- package/payload/frontend/dist/assets/{mindmap-definition-QFDTVHPH-CiV2UasH.js → mindmap-definition-QFDTVHPH-D77Oju5l.js} +1 -1
- package/payload/frontend/dist/assets/{monitoring-1_Fnxura.js → monitoring-BcgpwXyO.js} +1 -1
- package/payload/frontend/dist/assets/{notifications-VJaMbzoX.js → notifications-Cp6tD-Df.js} +1 -1
- package/payload/frontend/dist/assets/{pieDiagram-DEJITSTG-DwazVxKI.js → pieDiagram-DEJITSTG-Dp1SSOdP.js} +1 -1
- package/payload/frontend/dist/assets/{quadrantDiagram-34T5L4WZ-CAn9HHbO.js → quadrantDiagram-34T5L4WZ-D2_VBifB.js} +1 -1
- package/payload/frontend/dist/assets/{record-content-Bewq09_f.js → record-content-DawrQ3vI.js} +1 -1
- package/payload/frontend/dist/assets/{requirementDiagram-MS252O5E-CFot9peV.js → requirementDiagram-MS252O5E-CZUQO9c-.js} +1 -1
- package/payload/frontend/dist/assets/{sankeyDiagram-XADWPNL6-CdRX6WuA.js → sankeyDiagram-XADWPNL6-DMw6E77g.js} +1 -1
- package/payload/frontend/dist/assets/{sequenceDiagram-FGHM5R23-vRc1a5W1.js → sequenceDiagram-FGHM5R23-CCF4Uyr1.js} +1 -1
- package/payload/frontend/dist/assets/{stateDiagram-FHFEXIEX-Bxcr7s70.js → stateDiagram-FHFEXIEX-BrnJj_YC.js} +1 -1
- package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-i7xNd2ZA.js +1 -0
- package/payload/frontend/dist/assets/{status-9tZZeoV7.js → status-B-_-GXiJ.js} +1 -1
- package/payload/frontend/dist/assets/suiji-BB8bFtuh.js +1 -0
- package/payload/frontend/dist/assets/{svg-qpyWsADE.js → svg-DOzReQUk.js} +1 -1
- package/payload/frontend/dist/assets/{tabs-CwPtRQY0.js → tabs-1W6wgg8j.js} +1 -1
- package/payload/frontend/dist/assets/{timeline-definition-GMOUNBTQ-2mD2ePS6.js → timeline-definition-GMOUNBTQ-DTlM3m_q.js} +1 -1
- package/payload/frontend/dist/assets/{vennDiagram-DHZGUBPP-w4DbLykx.js → vennDiagram-DHZGUBPP-D_9TXuLu.js} +1 -1
- package/payload/frontend/dist/assets/{wardley-RL74JXVD-C3H8SQaZ.js → wardley-RL74JXVD-U4S2yDk_.js} +1 -1
- package/payload/frontend/dist/assets/{wardleyDiagram-NUSXRM2D-DEI0kC2c.js → wardleyDiagram-NUSXRM2D-BCUzTDXi.js} +1 -1
- package/payload/frontend/dist/assets/{xychartDiagram-5P7HB3ND-DDVlpQ28.js → xychartDiagram-5P7HB3ND-BksV4M9z.js} +1 -1
- package/payload/frontend/dist/build-info.json +4 -4
- package/payload/frontend/dist/companion.html +1 -1
- package/payload/frontend/dist/index.html +2 -2
- package/payload/server/index.cjs +165 -107
- package/payload/frontend/dist/assets/channel-CExZE0tD.js +0 -1
- package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-DNOAkizi.js +0 -1
- package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-DNOAkizi.js +0 -1
- package/payload/frontend/dist/assets/clone-CzOxlTa8.js +0 -1
- package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-YGvbZNwL.js +0 -1
- package/payload/frontend/dist/assets/suiji-DX2ioZ0I.js +0 -1
|
@@ -7322,12 +7322,12 @@ var require_dist = __commonJS({
|
|
|
7322
7322
|
var import_promises13 = __toESM(require("node:fs/promises"), 1);
|
|
7323
7323
|
var import_node_path29 = __toESM(require("node:path"), 1);
|
|
7324
7324
|
var import_node_os17 = __toESM(require("node:os"), 1);
|
|
7325
|
-
var
|
|
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_fs16 = 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
7333
|
var import_node_path28 = __toESM(require("node:path"), 1);
|
|
@@ -7493,7 +7493,7 @@ function publicManifest(manifest) {
|
|
|
7493
7493
|
}
|
|
7494
7494
|
|
|
7495
7495
|
// scripts/dev-session/services/index.mjs
|
|
7496
|
-
var
|
|
7496
|
+
var import_node_child_process8 = require("node:child_process");
|
|
7497
7497
|
var import_node_util4 = require("node:util");
|
|
7498
7498
|
|
|
7499
7499
|
// scripts/dev-session/registry.mjs
|
|
@@ -7873,7 +7873,7 @@ async function releaseSessionPortLeases(root, ports, sessionId) {
|
|
|
7873
7873
|
}
|
|
7874
7874
|
|
|
7875
7875
|
// scripts/dev-session/services/runtime.mjs
|
|
7876
|
-
var
|
|
7876
|
+
var import_node_child_process5 = require("node:child_process");
|
|
7877
7877
|
var import_promises5 = require("node:fs/promises");
|
|
7878
7878
|
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
7879
7879
|
var import_node_util2 = require("node:util");
|
|
@@ -8402,6 +8402,9 @@ __export(src_exports, {
|
|
|
8402
8402
|
acquireConfigurationOwner: () => acquireConfigurationOwner,
|
|
8403
8403
|
assertNewStableInstallation: () => assertNewStableInstallation,
|
|
8404
8404
|
assertOwnedPath: () => assertOwnedPath,
|
|
8405
|
+
assertPrivateDescriptor: () => assertPrivateDescriptor,
|
|
8406
|
+
assertPrivateDirectory: () => assertPrivateDirectory,
|
|
8407
|
+
assertWindowsPrivatePath: () => assertWindowsPrivatePath,
|
|
8405
8408
|
backupMigrationSources: () => backupMigrationSources,
|
|
8406
8409
|
canonicalPath: () => canonicalPath,
|
|
8407
8410
|
configuration: () => configuration,
|
|
@@ -8423,11 +8426,13 @@ __export(src_exports, {
|
|
|
8423
8426
|
parseEnvironmentFile: () => parseEnvironmentFile,
|
|
8424
8427
|
prepareInitialConfiguration: () => prepareInitialConfiguration,
|
|
8425
8428
|
prepareMigration: () => prepareMigration,
|
|
8429
|
+
processStartIdentity: () => processStartIdentity,
|
|
8426
8430
|
readInitialAuthFile: () => readInitialAuthFile,
|
|
8427
8431
|
readInstalledRuntimeBuild: () => readInstalledRuntimeBuild,
|
|
8428
8432
|
readLocalRuntimeStatusReport: () => readLocalRuntimeStatusReport,
|
|
8429
8433
|
readNativeHostRuntimeStatusReport: () => readNativeHostRuntimeStatusReport,
|
|
8430
8434
|
readNativeHostSharingEnabled: () => readNativeHostSharingEnabled,
|
|
8435
|
+
readPrivateFile: () => readPrivateFile,
|
|
8431
8436
|
readResearchMcpInstallation: () => readResearchMcpInstallation,
|
|
8432
8437
|
redactConfiguration: () => redactConfiguration,
|
|
8433
8438
|
registerStableConfigurationRoot: () => registerStableConfigurationRoot,
|
|
@@ -8441,6 +8446,7 @@ __export(src_exports, {
|
|
|
8441
8446
|
startLocalRuntimeStatusReporter: () => startLocalRuntimeStatusReporter,
|
|
8442
8447
|
startLocalServiceProcessReporter: () => startLocalServiceProcessReporter,
|
|
8443
8448
|
supportsConfiguration: () => supportsConfiguration,
|
|
8449
|
+
syncDirectory: () => syncDirectory,
|
|
8444
8450
|
validateDomains: () => validateDomains,
|
|
8445
8451
|
validateEnvelope: () => validateEnvelope,
|
|
8446
8452
|
validateLocalRuntimeStatusReport: () => validateLocalRuntimeStatusReport,
|
|
@@ -8468,21 +8474,57 @@ var ConfigurationError = class extends Error {
|
|
|
8468
8474
|
|
|
8469
8475
|
// packages/config-node/src/private-file.ts
|
|
8470
8476
|
var import_node_fs3 = require("node:fs");
|
|
8477
|
+
|
|
8478
|
+
// packages/config-node/src/windows-permissions.ts
|
|
8479
|
+
var import_node_child_process2 = require("node:child_process");
|
|
8480
|
+
function assertWindowsPrivatePath(file) {
|
|
8481
|
+
if (process.platform !== "win32") return;
|
|
8482
|
+
const script = `
|
|
8483
|
+
$ErrorActionPreference = 'Stop'
|
|
8484
|
+
# Use .NET directly: a parent pwsh may export a PSModulePath incompatible with Windows PowerShell.
|
|
8485
|
+
$acl = if ([IO.Directory]::Exists($env:RUNWEAVE_PRIVATE_PATH)) {
|
|
8486
|
+
[IO.Directory]::GetAccessControl($env:RUNWEAVE_PRIVATE_PATH)
|
|
8487
|
+
} else { [IO.File]::GetAccessControl($env:RUNWEAVE_PRIVATE_PATH) }
|
|
8488
|
+
$sid = [Security.Principal.WindowsIdentity]::GetCurrent().User
|
|
8489
|
+
$allowed = @($sid.Value, 'S-1-5-18', 'S-1-5-32-544')
|
|
8490
|
+
if ($acl.GetOwner([Security.Principal.SecurityIdentifier]).Value -notin $allowed) { throw 'owner' }
|
|
8491
|
+
foreach ($rule in $acl.GetAccessRules($true, $true, [Security.Principal.SecurityIdentifier])) {
|
|
8492
|
+
if ($rule.AccessControlType -eq 'Allow' -and $rule.IdentityReference.Value -notin $allowed) { throw 'access' }
|
|
8493
|
+
}
|
|
8494
|
+
`;
|
|
8495
|
+
try {
|
|
8496
|
+
(0, import_node_child_process2.execFileSync)("powershell.exe", ["-NoProfile", "-NonInteractive", "-EncodedCommand", Buffer.from(script, "utf16le").toString("base64")], {
|
|
8497
|
+
env: { ...process.env, RUNWEAVE_PRIVATE_PATH: file },
|
|
8498
|
+
stdio: "ignore",
|
|
8499
|
+
timeout: 1e4,
|
|
8500
|
+
windowsHide: true
|
|
8501
|
+
});
|
|
8502
|
+
} catch {
|
|
8503
|
+
throw new ConfigurationError("CONFIG_WINDOWS_ACL_NOT_PRIVATE", [file]);
|
|
8504
|
+
}
|
|
8505
|
+
}
|
|
8506
|
+
|
|
8507
|
+
// packages/config-node/src/private-file.ts
|
|
8471
8508
|
function assertPrivateDirectory(directory2) {
|
|
8472
8509
|
const stat = (0, import_node_fs3.lstatSync)(directory2);
|
|
8473
|
-
if (!stat.isDirectory() || stat.isSymbolicLink() || stat.mode & 63 || typeof process.getuid === "function" && stat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_ROOT_PERMISSIONS_INVALID");
|
|
8510
|
+
if (!stat.isDirectory() || stat.isSymbolicLink() || process.platform !== "win32" && stat.mode & 63 || typeof process.getuid === "function" && stat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_ROOT_PERMISSIONS_INVALID");
|
|
8511
|
+
assertWindowsPrivatePath(directory2);
|
|
8474
8512
|
}
|
|
8475
|
-
function assertPrivateDescriptor(fd, maxBytes = 1024 * 1024) {
|
|
8513
|
+
function assertPrivateDescriptor(fd, maxBytes = 1024 * 1024, file) {
|
|
8476
8514
|
const stat = (0, import_node_fs3.fstatSync)(fd);
|
|
8477
8515
|
if (!stat.isFile() || stat.nlink !== 1) throw new ConfigurationError("CONFIG_FILE_NOT_PRIVATE_REGULAR");
|
|
8478
8516
|
if (typeof process.getuid === "function" && stat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_FILE_OWNER_MISMATCH");
|
|
8479
|
-
if (stat.mode & 63) throw new ConfigurationError("CONFIG_FILE_PERMISSIONS_INVALID");
|
|
8517
|
+
if (process.platform !== "win32" && stat.mode & 63) throw new ConfigurationError("CONFIG_FILE_PERMISSIONS_INVALID");
|
|
8518
|
+
if (process.platform === "win32") {
|
|
8519
|
+
if (!file) throw new ConfigurationError("CONFIG_PRIVATE_PATH_REQUIRED");
|
|
8520
|
+
assertWindowsPrivatePath(file);
|
|
8521
|
+
}
|
|
8480
8522
|
if (stat.size > maxBytes) throw new ConfigurationError("CONFIG_FILE_TOO_LARGE");
|
|
8481
8523
|
}
|
|
8482
8524
|
function readPrivateFile(file, maxBytes = 1024 * 1024) {
|
|
8483
8525
|
const fd = (0, import_node_fs3.openSync)(file, import_node_fs3.constants.O_RDONLY | import_node_fs3.constants.O_NOFOLLOW);
|
|
8484
8526
|
try {
|
|
8485
|
-
assertPrivateDescriptor(fd, maxBytes);
|
|
8527
|
+
assertPrivateDescriptor(fd, maxBytes, file);
|
|
8486
8528
|
const source = (0, import_node_fs3.readFileSync)(fd, "utf8");
|
|
8487
8529
|
if (Buffer.byteLength(source) > maxBytes) throw new ConfigurationError("CONFIG_FILE_TOO_LARGE");
|
|
8488
8530
|
return source;
|
|
@@ -8563,15 +8605,40 @@ function assertOwnedPath(context, value) {
|
|
|
8563
8605
|
}
|
|
8564
8606
|
}
|
|
8565
8607
|
|
|
8566
|
-
// packages/config-node/src/
|
|
8608
|
+
// packages/config-node/src/platform.ts
|
|
8609
|
+
var import_node_child_process3 = require("node:child_process");
|
|
8567
8610
|
var import_node_fs5 = require("node:fs");
|
|
8611
|
+
function processStartIdentity(pid) {
|
|
8612
|
+
if (!Number.isSafeInteger(pid) || pid < 1) return null;
|
|
8613
|
+
try {
|
|
8614
|
+
return (0, import_node_child_process3.execFileSync)(
|
|
8615
|
+
process.platform === "win32" ? "powershell.exe" : "ps",
|
|
8616
|
+
process.platform === "win32" ? ["-NoProfile", "-NonInteractive", "-Command", `[Diagnostics.Process]::GetProcessById(${pid}).StartTime.ToUniversalTime().Ticks`] : ["-p", String(pid), "-o", "lstart="],
|
|
8617
|
+
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5e3, windowsHide: true }
|
|
8618
|
+
).trim() || null;
|
|
8619
|
+
} catch {
|
|
8620
|
+
return null;
|
|
8621
|
+
}
|
|
8622
|
+
}
|
|
8623
|
+
function syncDirectory(directory2) {
|
|
8624
|
+
if (process.platform === "win32") return;
|
|
8625
|
+
const fd = (0, import_node_fs5.openSync)(directory2, "r");
|
|
8626
|
+
try {
|
|
8627
|
+
(0, import_node_fs5.fsyncSync)(fd);
|
|
8628
|
+
} finally {
|
|
8629
|
+
(0, import_node_fs5.closeSync)(fd);
|
|
8630
|
+
}
|
|
8631
|
+
}
|
|
8632
|
+
|
|
8633
|
+
// packages/config-node/src/owner.ts
|
|
8634
|
+
var import_node_fs6 = require("node:fs");
|
|
8568
8635
|
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
8569
8636
|
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
8570
8637
|
var import_node_crypto2 = require("node:crypto");
|
|
8571
8638
|
var import_fs_native_extensions = require("fs-native-extensions");
|
|
8572
8639
|
function ownerDirectory(context) {
|
|
8573
8640
|
const directory2 = context.kind === "stable" ? import_node_path7.default.join(import_node_os5.default.userInfo().homedir, ".runweave", "runtime") : import_node_path7.default.join(context.configRoot, "runtime");
|
|
8574
|
-
(0,
|
|
8641
|
+
(0, import_node_fs6.mkdirSync)(directory2, { recursive: true, mode: 448 });
|
|
8575
8642
|
assertPrivateDirectory(import_node_path7.default.dirname(directory2));
|
|
8576
8643
|
assertPrivateDirectory(directory2);
|
|
8577
8644
|
return directory2;
|
|
@@ -8580,11 +8647,11 @@ function registerStableConfigurationRoot(context) {
|
|
|
8580
8647
|
if (context.kind !== "stable") return;
|
|
8581
8648
|
const directory2 = ownerDirectory(context);
|
|
8582
8649
|
const registry = import_node_path7.default.join(directory2, "stable-root.json");
|
|
8583
|
-
const registryFd = (0,
|
|
8650
|
+
const registryFd = (0, import_node_fs6.openSync)(import_node_path7.default.join(directory2, "stable-root.lock"), import_node_fs6.constants.O_CREAT | import_node_fs6.constants.O_RDWR | import_node_fs6.constants.O_NOFOLLOW, 384);
|
|
8584
8651
|
try {
|
|
8585
|
-
assertPrivateDescriptor(registryFd);
|
|
8652
|
+
assertPrivateDescriptor(registryFd, void 0, import_node_path7.default.join(directory2, "stable-root.lock"));
|
|
8586
8653
|
if (!(0, import_fs_native_extensions.tryLock)(registryFd)) throw new ConfigurationError("CONFIG_ROOT_REGISTRATION_BUSY");
|
|
8587
|
-
if ((0,
|
|
8654
|
+
if ((0, import_node_fs6.existsSync)(registry)) {
|
|
8588
8655
|
let stored;
|
|
8589
8656
|
try {
|
|
8590
8657
|
stored = JSON.parse(readPrivateFile(registry));
|
|
@@ -8594,34 +8661,29 @@ function registerStableConfigurationRoot(context) {
|
|
|
8594
8661
|
if (!stored || typeof stored !== "object" || !("root" in stored) || stored.root !== canonicalPath(context.configRoot)) throw new ConfigurationError("CONFIG_STABLE_ROOT_CONFLICT");
|
|
8595
8662
|
} else {
|
|
8596
8663
|
const temporary = `${registry}.${(0, import_node_crypto2.randomUUID)()}.tmp`;
|
|
8597
|
-
const file = (0,
|
|
8598
|
-
try {
|
|
8599
|
-
(0, import_node_fs5.writeFileSync)(file, JSON.stringify({ root: canonicalPath(context.configRoot) }));
|
|
8600
|
-
(0, import_node_fs5.fsyncSync)(file);
|
|
8601
|
-
} finally {
|
|
8602
|
-
(0, import_node_fs5.closeSync)(file);
|
|
8603
|
-
}
|
|
8604
|
-
(0, import_node_fs5.renameSync)(temporary, registry);
|
|
8605
|
-
const parent = (0, import_node_fs5.openSync)(directory2, "r");
|
|
8664
|
+
const file = (0, import_node_fs6.openSync)(temporary, "wx", 384);
|
|
8606
8665
|
try {
|
|
8607
|
-
(0,
|
|
8666
|
+
(0, import_node_fs6.writeFileSync)(file, JSON.stringify({ root: canonicalPath(context.configRoot) }));
|
|
8667
|
+
(0, import_node_fs6.fsyncSync)(file);
|
|
8608
8668
|
} finally {
|
|
8609
|
-
(0,
|
|
8669
|
+
(0, import_node_fs6.closeSync)(file);
|
|
8610
8670
|
}
|
|
8671
|
+
(0, import_node_fs6.renameSync)(temporary, registry);
|
|
8672
|
+
syncDirectory(directory2);
|
|
8611
8673
|
}
|
|
8612
8674
|
} finally {
|
|
8613
|
-
(0,
|
|
8675
|
+
(0, import_node_fs6.closeSync)(registryFd);
|
|
8614
8676
|
}
|
|
8615
8677
|
}
|
|
8616
8678
|
function withUpgradeGate(context, shared, run) {
|
|
8617
8679
|
const directory2 = ownerDirectory(context);
|
|
8618
|
-
const fd = (0,
|
|
8680
|
+
const fd = (0, import_node_fs6.openSync)(import_node_path7.default.join(directory2, "configuration-upgrade.lock"), import_node_fs6.constants.O_CREAT | import_node_fs6.constants.O_RDWR | import_node_fs6.constants.O_NOFOLLOW, 384);
|
|
8619
8681
|
try {
|
|
8620
|
-
assertPrivateDescriptor(fd);
|
|
8682
|
+
assertPrivateDescriptor(fd, void 0, import_node_path7.default.join(directory2, "configuration-upgrade.lock"));
|
|
8621
8683
|
if (!(0, import_fs_native_extensions.tryLock)(fd, 0, 0, { shared })) throw new ConfigurationError("CONFIG_UPGRADE_BUSY");
|
|
8622
8684
|
return run();
|
|
8623
8685
|
} finally {
|
|
8624
|
-
(0,
|
|
8686
|
+
(0, import_node_fs6.closeSync)(fd);
|
|
8625
8687
|
}
|
|
8626
8688
|
}
|
|
8627
8689
|
function withConfigurationUpgradeOwnership(context, run, ignoredRoles = []) {
|
|
@@ -8629,16 +8691,16 @@ function withConfigurationUpgradeOwnership(context, run, ignoredRoles = []) {
|
|
|
8629
8691
|
const directory2 = ownerDirectory(context);
|
|
8630
8692
|
const held = [];
|
|
8631
8693
|
try {
|
|
8632
|
-
for (const file of (0,
|
|
8694
|
+
for (const file of (0, import_node_fs6.readdirSync)(directory2).filter((name) => name.endsWith(".owner.lock"))) {
|
|
8633
8695
|
if (ignoredRoles.includes(file.replace(/\.owner\.lock$/, ""))) continue;
|
|
8634
|
-
const fd = (0,
|
|
8696
|
+
const fd = (0, import_node_fs6.openSync)(import_node_path7.default.join(directory2, file), import_node_fs6.constants.O_RDWR | import_node_fs6.constants.O_NOFOLLOW);
|
|
8635
8697
|
held.push(fd);
|
|
8636
|
-
assertPrivateDescriptor(fd);
|
|
8698
|
+
assertPrivateDescriptor(fd, void 0, import_node_path7.default.join(directory2, file));
|
|
8637
8699
|
if (!(0, import_fs_native_extensions.tryLock)(fd)) throw new ConfigurationError("CONFIG_UPGRADE_CONSUMER_RUNNING", [file.replace(/\.owner\.lock$/, "")]);
|
|
8638
8700
|
}
|
|
8639
8701
|
return run();
|
|
8640
8702
|
} finally {
|
|
8641
|
-
for (const fd of held) (0,
|
|
8703
|
+
for (const fd of held) (0, import_node_fs6.closeSync)(fd);
|
|
8642
8704
|
}
|
|
8643
8705
|
});
|
|
8644
8706
|
}
|
|
@@ -8647,16 +8709,16 @@ function acquireConfigurationOwner(context, role) {
|
|
|
8647
8709
|
}
|
|
8648
8710
|
function acquireOwner(context, role) {
|
|
8649
8711
|
const directory2 = ownerDirectory(context);
|
|
8650
|
-
const fd = (0,
|
|
8712
|
+
const fd = (0, import_node_fs6.openSync)(import_node_path7.default.join(directory2, `${role}.owner.lock`), import_node_fs6.constants.O_CREAT | import_node_fs6.constants.O_RDWR | import_node_fs6.constants.O_NOFOLLOW, 384);
|
|
8651
8713
|
let closed = false;
|
|
8652
8714
|
const release = () => {
|
|
8653
8715
|
if (!closed) {
|
|
8654
8716
|
closed = true;
|
|
8655
|
-
(0,
|
|
8717
|
+
(0, import_node_fs6.closeSync)(fd);
|
|
8656
8718
|
}
|
|
8657
8719
|
};
|
|
8658
8720
|
try {
|
|
8659
|
-
assertPrivateDescriptor(fd);
|
|
8721
|
+
assertPrivateDescriptor(fd, void 0, import_node_path7.default.join(directory2, `${role}.owner.lock`));
|
|
8660
8722
|
if (!(0, import_fs_native_extensions.tryLock)(fd)) throw new ConfigurationError("CONFIG_INSTANCE_ALREADY_RUNNING", [role]);
|
|
8661
8723
|
registerStableConfigurationRoot(context);
|
|
8662
8724
|
return { release };
|
|
@@ -8979,7 +9041,7 @@ function migrateConfigurationDocument(document) {
|
|
|
8979
9041
|
}
|
|
8980
9042
|
|
|
8981
9043
|
// packages/config-node/src/store.ts
|
|
8982
|
-
var
|
|
9044
|
+
var import_node_fs7 = require("node:fs");
|
|
8983
9045
|
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
8984
9046
|
var import_node_crypto3 = require("node:crypto");
|
|
8985
9047
|
var import_yaml = __toESM(require_dist(), 1);
|
|
@@ -9174,10 +9236,11 @@ function parseConfigurationYaml(source, context) {
|
|
|
9174
9236
|
return { document, value, digest: (0, import_node_crypto3.createHash)("sha256").update(source).digest("hex"), issues: validateDomains(value, context) };
|
|
9175
9237
|
}
|
|
9176
9238
|
function assertPrivateFile(file, fd) {
|
|
9177
|
-
const stat = fd === void 0 ? (0,
|
|
9239
|
+
const stat = fd === void 0 ? (0, import_node_fs7.lstatSync)(file) : (0, import_node_fs7.fstatSync)(fd);
|
|
9178
9240
|
if (!stat.isFile() || stat.isSymbolicLink() || stat.nlink !== 1) throw new ConfigurationError("CONFIG_FILE_NOT_PRIVATE_REGULAR");
|
|
9179
9241
|
if (typeof process.getuid === "function" && stat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_FILE_OWNER_MISMATCH");
|
|
9180
|
-
if ((stat.mode & 63) !== 0) throw new ConfigurationError("CONFIG_FILE_PERMISSIONS_INVALID");
|
|
9242
|
+
if (process.platform !== "win32" && (stat.mode & 63) !== 0) throw new ConfigurationError("CONFIG_FILE_PERMISSIONS_INVALID");
|
|
9243
|
+
assertWindowsPrivatePath(file);
|
|
9181
9244
|
if (stat.size > MAX_BYTES) throw new ConfigurationError("CONFIG_FILE_TOO_LARGE", [], { line: 1, column: 1 });
|
|
9182
9245
|
}
|
|
9183
9246
|
var ConfigurationStore = class {
|
|
@@ -9187,30 +9250,29 @@ var ConfigurationStore = class {
|
|
|
9187
9250
|
}
|
|
9188
9251
|
file;
|
|
9189
9252
|
read() {
|
|
9190
|
-
if (!(0,
|
|
9191
|
-
|
|
9192
|
-
if (!root.isDirectory() || root.isSymbolicLink() || root.mode & 63 || typeof process.getuid === "function" && root.uid !== process.getuid()) throw new ConfigurationError("CONFIG_ROOT_PERMISSIONS_INVALID");
|
|
9253
|
+
if (!(0, import_node_fs7.existsSync)(this.file)) throw new ConfigurationError("CONFIG_MIGRATION_REQUIRED");
|
|
9254
|
+
assertPrivateDirectory(this.context.configRoot);
|
|
9193
9255
|
assertPrivateFile(this.file);
|
|
9194
|
-
const fd = (0,
|
|
9256
|
+
const fd = (0, import_node_fs7.openSync)(this.file, import_node_fs7.constants.O_RDONLY | import_node_fs7.constants.O_NOFOLLOW);
|
|
9195
9257
|
try {
|
|
9196
9258
|
assertPrivateFile(this.file, fd);
|
|
9197
|
-
return parseConfigurationYaml((0,
|
|
9259
|
+
return parseConfigurationYaml((0, import_node_fs7.readFileSync)(fd, "utf8"), this.context);
|
|
9198
9260
|
} finally {
|
|
9199
|
-
(0,
|
|
9261
|
+
(0, import_node_fs7.closeSync)(fd);
|
|
9200
9262
|
}
|
|
9201
9263
|
}
|
|
9202
9264
|
locked(run) {
|
|
9203
|
-
(0,
|
|
9204
|
-
const dirStat = (0,
|
|
9265
|
+
(0, import_node_fs7.mkdirSync)(this.context.configRoot, { recursive: true, mode: 448 });
|
|
9266
|
+
const dirStat = (0, import_node_fs7.lstatSync)(this.context.configRoot);
|
|
9205
9267
|
if (!dirStat.isDirectory() || dirStat.isSymbolicLink() || typeof process.getuid === "function" && dirStat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_ROOT_OWNER_MISMATCH");
|
|
9206
|
-
|
|
9207
|
-
const fd = (0,
|
|
9268
|
+
assertPrivateDirectory(this.context.configRoot);
|
|
9269
|
+
const fd = (0, import_node_fs7.openSync)(import_node_path9.default.join(this.context.configRoot, "settings.lock"), import_node_fs7.constants.O_CREAT | import_node_fs7.constants.O_RDWR | import_node_fs7.constants.O_NOFOLLOW, 384);
|
|
9208
9270
|
try {
|
|
9209
9271
|
assertPrivateFile(import_node_path9.default.join(this.context.configRoot, "settings.lock"), fd);
|
|
9210
9272
|
if (!(0, import_fs_native_extensions2.tryLock)(fd)) throw new ConfigurationError("CONFIG_WRITE_BUSY");
|
|
9211
9273
|
return run();
|
|
9212
9274
|
} finally {
|
|
9213
|
-
(0,
|
|
9275
|
+
(0, import_node_fs7.closeSync)(fd);
|
|
9214
9276
|
}
|
|
9215
9277
|
}
|
|
9216
9278
|
publish(document, previous, backupId) {
|
|
@@ -9220,41 +9282,35 @@ var ConfigurationStore = class {
|
|
|
9220
9282
|
const temporary = `${this.file}.${(0, import_node_crypto3.randomUUID)()}.tmp`;
|
|
9221
9283
|
if (previous !== void 0) {
|
|
9222
9284
|
const backupRoot = import_node_path9.default.join(this.context.configRoot, "config-backups");
|
|
9223
|
-
(0,
|
|
9224
|
-
|
|
9225
|
-
if (!backupStat.isDirectory() || backupStat.isSymbolicLink() || backupStat.mode & 63 || typeof process.getuid === "function" && backupStat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_BACKUP_ROOT_INVALID");
|
|
9285
|
+
(0, import_node_fs7.mkdirSync)(backupRoot, { recursive: true, mode: 448 });
|
|
9286
|
+
assertPrivateDirectory(backupRoot);
|
|
9226
9287
|
const backup = import_node_path9.default.join(backupRoot, backupId ?? `${Date.now()}-${(0, import_node_crypto3.randomUUID)()}.yaml`);
|
|
9227
|
-
const fd2 = (0,
|
|
9288
|
+
const fd2 = (0, import_node_fs7.openSync)(backup, "wx", 384);
|
|
9228
9289
|
try {
|
|
9229
|
-
(0,
|
|
9230
|
-
(0,
|
|
9290
|
+
(0, import_node_fs7.writeFileSync)(fd2, previous);
|
|
9291
|
+
(0, import_node_fs7.fsyncSync)(fd2);
|
|
9231
9292
|
} finally {
|
|
9232
|
-
(0,
|
|
9293
|
+
(0, import_node_fs7.closeSync)(fd2);
|
|
9233
9294
|
}
|
|
9234
9295
|
}
|
|
9235
|
-
const fd = (0,
|
|
9296
|
+
const fd = (0, import_node_fs7.openSync)(temporary, "wx", 384);
|
|
9236
9297
|
try {
|
|
9237
|
-
(0,
|
|
9238
|
-
(0,
|
|
9298
|
+
(0, import_node_fs7.writeFileSync)(fd, source);
|
|
9299
|
+
(0, import_node_fs7.fsyncSync)(fd);
|
|
9239
9300
|
} finally {
|
|
9240
|
-
(0,
|
|
9301
|
+
(0, import_node_fs7.closeSync)(fd);
|
|
9241
9302
|
}
|
|
9242
9303
|
try {
|
|
9243
|
-
(0,
|
|
9244
|
-
|
|
9245
|
-
try {
|
|
9246
|
-
(0, import_node_fs6.fsyncSync)(parent);
|
|
9247
|
-
} finally {
|
|
9248
|
-
(0, import_node_fs6.closeSync)(parent);
|
|
9249
|
-
}
|
|
9304
|
+
(0, import_node_fs7.renameSync)(temporary, this.file);
|
|
9305
|
+
syncDirectory(this.context.configRoot);
|
|
9250
9306
|
} finally {
|
|
9251
|
-
if ((0,
|
|
9307
|
+
if ((0, import_node_fs7.existsSync)(temporary)) (0, import_node_fs7.unlinkSync)(temporary);
|
|
9252
9308
|
}
|
|
9253
9309
|
return checked;
|
|
9254
9310
|
}
|
|
9255
9311
|
initialize(value) {
|
|
9256
9312
|
return this.locked(() => {
|
|
9257
|
-
if ((0,
|
|
9313
|
+
if ((0, import_node_fs7.existsSync)(this.file)) throw new ConfigurationError("CONFIG_ALREADY_EXISTS");
|
|
9258
9314
|
validateEnvelope(value, this.context);
|
|
9259
9315
|
const issues = validateDomains(value, this.context);
|
|
9260
9316
|
if (Object.keys(issues).length) throw new ConfigurationError("CONFIG_VALIDATION_FAILED", Object.values(issues).flat().map((item) => item.path));
|
|
@@ -9294,9 +9350,9 @@ var ConfigurationStore = class {
|
|
|
9294
9350
|
}
|
|
9295
9351
|
backups() {
|
|
9296
9352
|
const root = import_node_path9.default.join(this.context.configRoot, "config-backups");
|
|
9297
|
-
if (!(0,
|
|
9353
|
+
if (!(0, import_node_fs7.existsSync)(root)) return [];
|
|
9298
9354
|
assertPrivateDirectory(root);
|
|
9299
|
-
return (0,
|
|
9355
|
+
return (0, import_node_fs7.readdirSync)(root).filter((id) => /^\d+-[a-f0-9-]+\.yaml$/.test(id)).sort().reverse().map((id) => {
|
|
9300
9356
|
try {
|
|
9301
9357
|
const backup = this.readBackup(id);
|
|
9302
9358
|
return { id, revision: backup.value.revision, schemaVersion: backup.value.schemaVersion, compatible: true };
|
|
@@ -9374,23 +9430,18 @@ var ConfigurationStore = class {
|
|
|
9374
9430
|
recordUpgrade(value) {
|
|
9375
9431
|
const file = import_node_path9.default.join(this.context.configRoot, "config-upgrade.json");
|
|
9376
9432
|
const temporary = `${file}.${(0, import_node_crypto3.randomUUID)()}.tmp`;
|
|
9377
|
-
const fd = (0,
|
|
9433
|
+
const fd = (0, import_node_fs7.openSync)(temporary, "wx", 384);
|
|
9378
9434
|
try {
|
|
9379
|
-
(0,
|
|
9380
|
-
(0,
|
|
9435
|
+
(0, import_node_fs7.writeFileSync)(fd, JSON.stringify(value, null, 2) + "\n");
|
|
9436
|
+
(0, import_node_fs7.fsyncSync)(fd);
|
|
9381
9437
|
} finally {
|
|
9382
|
-
(0,
|
|
9438
|
+
(0, import_node_fs7.closeSync)(fd);
|
|
9383
9439
|
}
|
|
9384
9440
|
try {
|
|
9385
|
-
(0,
|
|
9386
|
-
|
|
9387
|
-
try {
|
|
9388
|
-
(0, import_node_fs6.fsyncSync)(parent);
|
|
9389
|
-
} finally {
|
|
9390
|
-
(0, import_node_fs6.closeSync)(parent);
|
|
9391
|
-
}
|
|
9441
|
+
(0, import_node_fs7.renameSync)(temporary, file);
|
|
9442
|
+
syncDirectory(this.context.configRoot);
|
|
9392
9443
|
} finally {
|
|
9393
|
-
if ((0,
|
|
9444
|
+
if ((0, import_node_fs7.existsSync)(temporary)) (0, import_node_fs7.unlinkSync)(temporary);
|
|
9394
9445
|
}
|
|
9395
9446
|
}
|
|
9396
9447
|
upgrade(expected) {
|
|
@@ -9399,7 +9450,7 @@ var ConfigurationStore = class {
|
|
|
9399
9450
|
if (preview.expectedRevision !== expected.revision || preview.expectedDigest !== expected.digest) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
|
|
9400
9451
|
if (!preview.changed) {
|
|
9401
9452
|
const receiptFile = import_node_path9.default.join(this.context.configRoot, "config-upgrade.json");
|
|
9402
|
-
if ((0,
|
|
9453
|
+
if ((0, import_node_fs7.existsSync)(receiptFile)) {
|
|
9403
9454
|
const receipt = JSON.parse(readPrivateFile(receiptFile));
|
|
9404
9455
|
if (isConfigurationObject(receipt) && receipt.phase === "prepared" && receipt.plannedDigest === expected.digest)
|
|
9405
9456
|
this.recordUpgrade({ ...receipt, phase: "committed", savedRevision: expected.revision, digest: expected.digest });
|
|
@@ -9433,9 +9484,9 @@ var ConfigurationStore = class {
|
|
|
9433
9484
|
previous(keys) {
|
|
9434
9485
|
const current = this.read();
|
|
9435
9486
|
const root = import_node_path9.default.join(this.context.configRoot, "config-backups");
|
|
9436
|
-
if (!(0,
|
|
9487
|
+
if (!(0, import_node_fs7.existsSync)(root)) throw new ConfigurationError("CONFIG_BACKUP_UNAVAILABLE");
|
|
9437
9488
|
assertPrivateDirectory(root);
|
|
9438
|
-
const candidates = (0,
|
|
9489
|
+
const candidates = (0, import_node_fs7.readdirSync)(root).filter((file) => /^\d+-[a-f0-9-]+\.yaml$/.test(file)).sort().reverse();
|
|
9439
9490
|
for (const candidate of candidates) {
|
|
9440
9491
|
const file = import_node_path9.default.join(root, candidate);
|
|
9441
9492
|
const previous = parseConfigurationYaml(readPrivateFile(file), this.context);
|
|
@@ -9447,7 +9498,7 @@ var ConfigurationStore = class {
|
|
|
9447
9498
|
}
|
|
9448
9499
|
migrate(value, expected) {
|
|
9449
9500
|
return this.locked(() => {
|
|
9450
|
-
const current = (0,
|
|
9501
|
+
const current = (0, import_node_fs7.existsSync)(this.file) ? this.read() : null;
|
|
9451
9502
|
if (current ? !expected || current.value.revision !== expected.revision || current.digest !== expected.digest : expected !== null) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
|
|
9452
9503
|
validateEnvelope(value, this.context);
|
|
9453
9504
|
const issues = validateDomains(value, this.context);
|
|
@@ -9678,7 +9729,7 @@ function configurationPath(key, relativeDefault) {
|
|
|
9678
9729
|
}
|
|
9679
9730
|
|
|
9680
9731
|
// packages/config-node/src/migration.ts
|
|
9681
|
-
var
|
|
9732
|
+
var import_node_fs8 = require("node:fs");
|
|
9682
9733
|
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
9683
9734
|
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
9684
9735
|
var import_node_crypto4 = require("node:crypto");
|
|
@@ -9713,7 +9764,7 @@ function importEnvironment(value, environment) {
|
|
|
9713
9764
|
}
|
|
9714
9765
|
function prepareMigration(context, sources) {
|
|
9715
9766
|
const store = new ConfigurationStore(context);
|
|
9716
|
-
const initial = (0,
|
|
9767
|
+
const initial = (0, import_node_fs8.existsSync)(store.file) ? store.read().value : emptyConfiguration(context);
|
|
9717
9768
|
const value = structuredClone(initial);
|
|
9718
9769
|
const result = { value, sources: [], conflicts: [] };
|
|
9719
9770
|
const byDomain = /* @__PURE__ */ new Map();
|
|
@@ -9722,7 +9773,7 @@ function prepareMigration(context, sources) {
|
|
|
9722
9773
|
if (!import_node_path11.default.isAbsolute(source.file)) throw new ConfigurationError("CONFIG_SOURCE_PATH_REQUIRED");
|
|
9723
9774
|
assertMigrationSourceOwner(context, source.file);
|
|
9724
9775
|
if (migratedDomains.has(source.domain)) continue;
|
|
9725
|
-
const raw = (0,
|
|
9776
|
+
const raw = (0, import_node_fs8.readFileSync)(source.file, "utf8");
|
|
9726
9777
|
const digest = (0, import_node_crypto4.createHash)("sha256").update(raw).digest("hex");
|
|
9727
9778
|
const previous = byDomain.get(source.domain);
|
|
9728
9779
|
if (previous && previous !== digest) {
|
|
@@ -9813,39 +9864,39 @@ function migrationLeaves(value, prefix) {
|
|
|
9813
9864
|
return [[prefix, value]];
|
|
9814
9865
|
}
|
|
9815
9866
|
function backupMigrationSources(context, draft) {
|
|
9816
|
-
(0,
|
|
9867
|
+
(0, import_node_fs8.mkdirSync)(context.configRoot, { recursive: true, mode: 448 });
|
|
9817
9868
|
assertPrivateDirectory(context.configRoot);
|
|
9818
9869
|
const directory2 = import_node_path11.default.join(context.configRoot, "config-backups");
|
|
9819
|
-
(0,
|
|
9870
|
+
(0, import_node_fs8.mkdirSync)(directory2, { recursive: true, mode: 448 });
|
|
9820
9871
|
assertPrivateDirectory(directory2);
|
|
9821
9872
|
for (const source of draft.sources) {
|
|
9822
9873
|
assertMigrationSourceOwner(context, source.file);
|
|
9823
|
-
const raw = (0,
|
|
9874
|
+
const raw = (0, import_node_fs8.readFileSync)(source.file);
|
|
9824
9875
|
if ((0, import_node_crypto4.createHash)("sha256").update(raw).digest("hex") !== source.digest) throw new ConfigurationError("CONFIG_SOURCE_CHANGED");
|
|
9825
9876
|
const target = import_node_path11.default.join(directory2, `migration-${source.digest}.source`);
|
|
9826
|
-
if ((0,
|
|
9877
|
+
if ((0, import_node_fs8.existsSync)(target)) {
|
|
9827
9878
|
if ((0, import_node_crypto4.createHash)("sha256").update(readPrivateFile(target, raw.length)).digest("hex") !== source.digest) throw new ConfigurationError("CONFIG_BACKUP_INVALID");
|
|
9828
9879
|
continue;
|
|
9829
9880
|
}
|
|
9830
9881
|
const temporary = `${target}.${(0, import_node_crypto4.randomUUID)()}.tmp`;
|
|
9831
|
-
const fd2 = (0,
|
|
9882
|
+
const fd2 = (0, import_node_fs8.openSync)(temporary, "wx", 384);
|
|
9832
9883
|
try {
|
|
9833
|
-
(0,
|
|
9834
|
-
(0,
|
|
9884
|
+
(0, import_node_fs8.writeFileSync)(fd2, raw);
|
|
9885
|
+
(0, import_node_fs8.fsyncSync)(fd2);
|
|
9835
9886
|
} finally {
|
|
9836
|
-
(0,
|
|
9887
|
+
(0, import_node_fs8.closeSync)(fd2);
|
|
9837
9888
|
}
|
|
9838
9889
|
try {
|
|
9839
|
-
(0,
|
|
9890
|
+
(0, import_node_fs8.renameSync)(temporary, target);
|
|
9840
9891
|
} finally {
|
|
9841
|
-
if ((0,
|
|
9892
|
+
if ((0, import_node_fs8.existsSync)(temporary)) (0, import_node_fs8.unlinkSync)(temporary);
|
|
9842
9893
|
}
|
|
9843
9894
|
}
|
|
9844
|
-
const fd = (0,
|
|
9895
|
+
const fd = (0, import_node_fs8.openSync)(directory2, "r");
|
|
9845
9896
|
try {
|
|
9846
|
-
(0,
|
|
9897
|
+
(0, import_node_fs8.fsyncSync)(fd);
|
|
9847
9898
|
} finally {
|
|
9848
|
-
(0,
|
|
9899
|
+
(0, import_node_fs8.closeSync)(fd);
|
|
9849
9900
|
}
|
|
9850
9901
|
}
|
|
9851
9902
|
function assertMigrationSourceOwner(context, file) {
|
|
@@ -9902,7 +9953,7 @@ var ConfigurationDomain = class {
|
|
|
9902
9953
|
};
|
|
9903
9954
|
|
|
9904
9955
|
// packages/config-node/src/migration-discovery.ts
|
|
9905
|
-
var
|
|
9956
|
+
var import_node_fs9 = require("node:fs");
|
|
9906
9957
|
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
9907
9958
|
var import_node_os7 = __toESM(require("node:os"), 1);
|
|
9908
9959
|
var import_node_crypto5 = require("node:crypto");
|
|
@@ -9910,7 +9961,7 @@ function discoverMigrationSources(context, selected) {
|
|
|
9910
9961
|
const sources = [];
|
|
9911
9962
|
const add = (root, relative, domain, format = "json") => {
|
|
9912
9963
|
const file = import_node_path12.default.join(root, relative);
|
|
9913
|
-
if ((0,
|
|
9964
|
+
if ((0, import_node_fs9.existsSync)(file)) sources.push({ file, domain, format });
|
|
9914
9965
|
};
|
|
9915
9966
|
add(context.configRoot, "config.json", "cli");
|
|
9916
9967
|
add(context.configRoot, "snapshot-share/publish.env", "services.snapshotPublisher", "env");
|
|
@@ -9933,7 +9984,7 @@ function discoverMigrationSources(context, selected) {
|
|
|
9933
9984
|
function retainSelectedStorage(context, selected, draft) {
|
|
9934
9985
|
if (!selected.backendProfile || draft.value.migrations.storage) return;
|
|
9935
9986
|
const profile = selectedDirectory(context, selected.backendProfile);
|
|
9936
|
-
if (!(0,
|
|
9987
|
+
if (!(0, import_node_fs9.existsSync)(import_node_path12.default.join(profile, "auth-store.json"))) throw new ConfigurationError("CONFIG_SELECTED_PROFILE_UNVERIFIED");
|
|
9937
9988
|
const globalRoot = context.kind === "stable" ? import_node_path12.default.join(import_node_os7.default.userInfo().homedir, ".runweave") : import_node_path12.default.join(context.configRoot, "data");
|
|
9938
9989
|
const retained = {
|
|
9939
9990
|
"storage.browserProfileDirectory": profile,
|
|
@@ -9952,7 +10003,7 @@ function retainSelectedStorage(context, selected, draft) {
|
|
|
9952
10003
|
draft.value.migrations.storage = { id: `selected-profile:${digest}`, sourceDigest: digest };
|
|
9953
10004
|
}
|
|
9954
10005
|
function selectedDirectory(context, directory2) {
|
|
9955
|
-
if (!import_node_path12.default.isAbsolute(directory2) || !(0,
|
|
10006
|
+
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");
|
|
9956
10007
|
const result = canonicalPath(directory2);
|
|
9957
10008
|
assertOwnedPath(context, result);
|
|
9958
10009
|
return result;
|
|
@@ -9960,19 +10011,19 @@ function selectedDirectory(context, directory2) {
|
|
|
9960
10011
|
|
|
9961
10012
|
// packages/config-node/src/initialization.ts
|
|
9962
10013
|
var import_node_crypto6 = require("node:crypto");
|
|
9963
|
-
var
|
|
10014
|
+
var import_node_fs10 = require("node:fs");
|
|
9964
10015
|
var import_node_os8 = __toESM(require("node:os"), 1);
|
|
9965
10016
|
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
9966
10017
|
function assertNewStableInstallation(context, selected = {}) {
|
|
9967
10018
|
if (context.kind !== "stable") throw new ConfigurationError("CONFIG_STABLE_REQUIRED");
|
|
9968
|
-
if ((0,
|
|
10019
|
+
if ((0, import_node_fs10.existsSync)(import_node_path13.default.join(context.configRoot, "settings.yaml"))) throw new ConfigurationError("CONFIG_ALREADY_EXISTS");
|
|
9969
10020
|
const legacy = discoverMigrationSources(context, selected);
|
|
9970
10021
|
if (legacy.length) throw new ConfigurationError("CONFIG_MIGRATION_REQUIRED", legacy.map((source) => source.domain));
|
|
9971
10022
|
for (const root of [import_node_path13.default.join(context.configRoot, "browser-profile"), import_node_path13.default.join(import_node_os8.default.userInfo().homedir, ".browser-profile")]) {
|
|
9972
|
-
if (!(0,
|
|
9973
|
-
const children = (0,
|
|
10023
|
+
if (!(0, import_node_fs10.existsSync)(root)) continue;
|
|
10024
|
+
const children = (0, import_node_fs10.lstatSync)(root).isDirectory() ? [root, ...(0, import_node_fs10.readdirSync)(root).map((name) => import_node_path13.default.join(root, name))] : [root];
|
|
9974
10025
|
for (const directory2 of children) {
|
|
9975
|
-
if (["auth-store.json", "session-store.json", "terminal-session-store.json"].some((name) => (0,
|
|
10026
|
+
if (["auth-store.json", "session-store.json", "terminal-session-store.json"].some((name) => (0, import_node_fs10.existsSync)(import_node_path13.default.join(directory2, name)))) {
|
|
9976
10027
|
throw new ConfigurationError("CONFIG_MIGRATION_REQUIRED", ["backend.profile"]);
|
|
9977
10028
|
}
|
|
9978
10029
|
}
|
|
@@ -10027,14 +10078,14 @@ function prepareInitialConfiguration(context, auth) {
|
|
|
10027
10078
|
}
|
|
10028
10079
|
|
|
10029
10080
|
// packages/config-node/src/research-mcp.ts
|
|
10030
|
-
var
|
|
10081
|
+
var import_node_fs11 = require("node:fs");
|
|
10031
10082
|
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
10032
10083
|
function researchMcpHome() {
|
|
10033
10084
|
return import_node_path14.default.join(resolveConfigurationContext().configRoot, "research-mcp");
|
|
10034
10085
|
}
|
|
10035
10086
|
function readResearchMcpInstallation() {
|
|
10036
10087
|
const file = import_node_path14.default.join(researchMcpHome(), "installation.json");
|
|
10037
|
-
if (!(0,
|
|
10088
|
+
if (!(0, import_node_fs11.existsSync)(file)) return null;
|
|
10038
10089
|
const value = JSON.parse(readPrivateFile(file));
|
|
10039
10090
|
if (value.version !== 1 || value.instanceId !== resolveConfigurationContext().instanceId || typeof value.enabled !== "boolean" || !Number.isInteger(value.port) || value.port < 1 || value.port > 65535 || ![value.entry, value.node, value.cwd].every((v) => typeof v === "string" && import_node_path14.default.isAbsolute(v)) || typeof value.sourceRevision !== "string" || typeof value.releaseId !== "string" || !Number.isFinite(value.installedAt) || value.tunnel !== null && (!value.tunnel || !/^[a-zA-Z0-9_-]+$/.test(value.tunnel.profile) || ![value.tunnel.executable, value.tunnel.profileDir, value.tunnel.healthFile].every((v) => typeof v === "string" && import_node_path14.default.isAbsolute(v)))) {
|
|
10040
10091
|
throw new Error("Invalid research MCP installation identity");
|
|
@@ -10043,16 +10094,16 @@ function readResearchMcpInstallation() {
|
|
|
10043
10094
|
}
|
|
10044
10095
|
function writeResearchMcpInstallation(value) {
|
|
10045
10096
|
const home = researchMcpHome();
|
|
10046
|
-
(0,
|
|
10097
|
+
(0, import_node_fs11.mkdirSync)(home, { recursive: true, mode: 448 });
|
|
10047
10098
|
const file = import_node_path14.default.join(home, "installation.json");
|
|
10048
10099
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
10049
|
-
(0,
|
|
10100
|
+
(0, import_node_fs11.writeFileSync)(temporary, `${JSON.stringify(value, null, 2)}
|
|
10050
10101
|
`, { mode: 384 });
|
|
10051
|
-
(0,
|
|
10102
|
+
(0, import_node_fs11.renameSync)(temporary, file);
|
|
10052
10103
|
}
|
|
10053
10104
|
|
|
10054
10105
|
// packages/config-node/src/runtime-status.ts
|
|
10055
|
-
var
|
|
10106
|
+
var import_node_fs12 = require("node:fs");
|
|
10056
10107
|
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
10057
10108
|
var import_node_os9 = __toESM(require("node:os"), 1);
|
|
10058
10109
|
var import_node_crypto7 = require("node:crypto");
|
|
@@ -10137,14 +10188,14 @@ function validateLocalRuntimeStatusReport(value, source) {
|
|
|
10137
10188
|
function readNativeHostRuntimeStatusReport() {
|
|
10138
10189
|
const root = import_node_path15.default.join(import_node_os9.default.homedir(), "Library", "Application Support", "RemoteDesk");
|
|
10139
10190
|
const file = import_node_path15.default.join(root, "runtime-status.json");
|
|
10140
|
-
if (!(0,
|
|
10191
|
+
if (!(0, import_node_fs12.existsSync)(file)) return null;
|
|
10141
10192
|
assertPrivateDirectory(root);
|
|
10142
|
-
return { report: validateLocalRuntimeStatusReport(JSON.parse(readPrivateFile(file, 64 * 1024)), "remote-desktop-host"), receivedAt: (0,
|
|
10193
|
+
return { report: validateLocalRuntimeStatusReport(JSON.parse(readPrivateFile(file, 64 * 1024)), "remote-desktop-host"), receivedAt: (0, import_node_fs12.statSync)(file).mtimeMs };
|
|
10143
10194
|
}
|
|
10144
10195
|
function readNativeHostSharingEnabled() {
|
|
10145
10196
|
const root = import_node_path15.default.join(import_node_os9.default.homedir(), "Library", "Application Support", "RemoteDesk");
|
|
10146
10197
|
const file = import_node_path15.default.join(root, "local-host.json");
|
|
10147
|
-
if (!(0,
|
|
10198
|
+
if (!(0, import_node_fs12.existsSync)(file)) return false;
|
|
10148
10199
|
assertPrivateDirectory(root);
|
|
10149
10200
|
const value = JSON.parse(readPrivateFile(file, 16 * 1024));
|
|
10150
10201
|
if (value.schemaVersion !== 1 || typeof value.running !== "boolean") throw new Error("Invalid native Host sharing intent");
|
|
@@ -10157,16 +10208,16 @@ function startLocalRuntimeStatusReporter(source, report) {
|
|
|
10157
10208
|
let inFlight = null;
|
|
10158
10209
|
let latest = null;
|
|
10159
10210
|
const write = (snapshot, stopping = false) => {
|
|
10160
|
-
(0,
|
|
10211
|
+
(0, import_node_fs12.mkdirSync)(root, { recursive: true, mode: 448 });
|
|
10161
10212
|
assertPrivateDirectory(root);
|
|
10162
10213
|
if (snapshot.source.id !== source) throw new Error("Runtime status owner mismatch");
|
|
10163
10214
|
if (stopping) snapshot = { ...snapshot, observedAt: Date.now(), items: snapshot.items.map((item) => ({ ...item, state: "disabled", summary: "\u670D\u52A1\u5DF2\u6B63\u5E38\u505C\u6B62", recovery: null })) };
|
|
10164
10215
|
const temporary = `${file}.${(0, import_node_crypto7.randomUUID)()}.tmp`;
|
|
10165
10216
|
try {
|
|
10166
|
-
(0,
|
|
10167
|
-
(0,
|
|
10217
|
+
(0, import_node_fs12.writeFileSync)(temporary, JSON.stringify({ instanceId: configuration().context.instanceId, report: snapshot, stopped: stopping }), { mode: 384, flag: "wx" });
|
|
10218
|
+
(0, import_node_fs12.renameSync)(temporary, file);
|
|
10168
10219
|
} finally {
|
|
10169
|
-
(0,
|
|
10220
|
+
(0, import_node_fs12.rmSync)(temporary, { force: true });
|
|
10170
10221
|
}
|
|
10171
10222
|
};
|
|
10172
10223
|
const publish = () => {
|
|
@@ -10225,13 +10276,13 @@ function startLocalServiceProcessReporter(source, label, health) {
|
|
|
10225
10276
|
function readLocalRuntimeStatusReport(source) {
|
|
10226
10277
|
const root = directory();
|
|
10227
10278
|
const file = import_node_path15.default.join(root, `${source}.json`);
|
|
10228
|
-
if (!(0,
|
|
10279
|
+
if (!(0, import_node_fs12.existsSync)(file)) return null;
|
|
10229
10280
|
assertPrivateDirectory(root);
|
|
10230
10281
|
const value = JSON.parse(readPrivateFile(file, 256 * 1024));
|
|
10231
10282
|
if (value.instanceId !== configuration().context.instanceId) throw new Error("Local runtime status instance mismatch");
|
|
10232
10283
|
const report = validateLocalRuntimeStatusReport(value.report, source);
|
|
10233
10284
|
if (value.stopped === true && report.items.some((item) => item.state !== "disabled")) throw new Error("Invalid stopped owner report");
|
|
10234
|
-
return { report, receivedAt: (0,
|
|
10285
|
+
return { report, receivedAt: (0, import_node_fs12.statSync)(file).mtimeMs, stopped: value.stopped === true };
|
|
10235
10286
|
}
|
|
10236
10287
|
function readInstalledRuntimeBuild(entry) {
|
|
10237
10288
|
if (!entry || !import_node_path15.default.isAbsolute(entry)) return null;
|
|
@@ -10243,34 +10294,34 @@ function readInstalledRuntimeBuild(entry) {
|
|
|
10243
10294
|
const root = entry.slice(0, index);
|
|
10244
10295
|
const relative = entry.slice(index + marker.length).split(import_node_path15.default.sep).slice(1);
|
|
10245
10296
|
const pointer = import_node_path15.default.join(root, "current.json");
|
|
10246
|
-
if ((0,
|
|
10247
|
-
const selected = JSON.parse((0,
|
|
10297
|
+
if ((0, import_node_fs12.existsSync)(pointer)) {
|
|
10298
|
+
const selected = JSON.parse((0, import_node_fs12.readFileSync)(pointer, "utf8"));
|
|
10248
10299
|
if (!/^[a-zA-Z0-9._-]+$/.test(selected.releaseId) || [".", ".."].includes(selected.releaseId)) return null;
|
|
10249
10300
|
entry = import_node_path15.default.join(root, "releases", selected.releaseId, ...relative);
|
|
10250
10301
|
}
|
|
10251
10302
|
}
|
|
10252
|
-
fd = (0,
|
|
10303
|
+
fd = (0, import_node_fs12.openSync)(entry, "r");
|
|
10253
10304
|
const buffer = Buffer.alloc(8192);
|
|
10254
|
-
const length = (0,
|
|
10305
|
+
const length = (0, import_node_fs12.readSync)(fd, buffer, 0, buffer.length, 0);
|
|
10255
10306
|
const match = buffer.subarray(0, length).toString("utf8").split("\n", 1)[0]?.match(/var __RUNWEAVE_BUILD_INFO__=(\{.*\});/);
|
|
10256
10307
|
const metadata = import_node_path15.default.join(import_node_path15.default.dirname(entry), "release.json");
|
|
10257
|
-
const value = match ? JSON.parse(match[1]) : JSON.parse((0,
|
|
10308
|
+
const value = match ? JSON.parse(match[1]) : JSON.parse((0, import_node_fs12.readFileSync)((0, import_node_fs12.existsSync)(metadata) ? metadata : import_node_path15.default.join(import_node_path15.default.dirname(entry), "build-info.json"), "utf8"));
|
|
10258
10309
|
return typeof value.version === "string" && typeof value.buildId === "string" ? value : null;
|
|
10259
10310
|
} catch {
|
|
10260
10311
|
return null;
|
|
10261
10312
|
} finally {
|
|
10262
|
-
if (fd !== void 0) (0,
|
|
10313
|
+
if (fd !== void 0) (0, import_node_fs12.closeSync)(fd);
|
|
10263
10314
|
}
|
|
10264
10315
|
}
|
|
10265
10316
|
|
|
10266
10317
|
// scripts/lib/backend-health-auth.mjs
|
|
10267
10318
|
var import_node_net = require("node:net");
|
|
10268
|
-
var
|
|
10319
|
+
var import_node_fs13 = require("node:fs");
|
|
10269
10320
|
var import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
10270
10321
|
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
10271
|
-
var
|
|
10322
|
+
var import_node_child_process4 = require("node:child_process");
|
|
10272
10323
|
var import_node_util = require("node:util");
|
|
10273
|
-
var execFileAsync = (0, import_node_util.promisify)(
|
|
10324
|
+
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process4.execFile);
|
|
10274
10325
|
var FILE_NAME = "backend-health-binding.json";
|
|
10275
10326
|
async function readBackendHealthAuth(profileDir) {
|
|
10276
10327
|
let handle;
|
|
@@ -10280,7 +10331,7 @@ async function readBackendHealthAuth(profileDir) {
|
|
|
10280
10331
|
throw new Error("invalid Backend health profile directory");
|
|
10281
10332
|
handle = await import_promises4.default.open(
|
|
10282
10333
|
import_node_path16.default.join(profileDir, FILE_NAME),
|
|
10283
|
-
|
|
10334
|
+
import_node_fs13.constants.O_RDONLY | import_node_fs13.constants.O_NOFOLLOW
|
|
10284
10335
|
);
|
|
10285
10336
|
const stat = await handle.stat();
|
|
10286
10337
|
if (!stat.isFile() || stat.size > 16384 || (stat.mode & 63) !== 0 || stat.uid !== process.getuid?.()) {
|
|
@@ -10333,7 +10384,7 @@ async function readHealthProfileLock(profileDir) {
|
|
|
10333
10384
|
try {
|
|
10334
10385
|
handle = await import_promises4.default.open(
|
|
10335
10386
|
import_node_path16.default.join(profileDir, "backend.lock.json"),
|
|
10336
|
-
|
|
10387
|
+
import_node_fs13.constants.O_RDONLY | import_node_fs13.constants.O_NOFOLLOW
|
|
10337
10388
|
);
|
|
10338
10389
|
const stat = await handle.stat();
|
|
10339
10390
|
if (!stat.isFile() || (stat.mode & 63) !== 0 || stat.uid !== process.getuid?.() || stat.size > 65536) {
|
|
@@ -10494,7 +10545,7 @@ function isCanonicalLoopbackEndpoint(endpoint) {
|
|
|
10494
10545
|
}
|
|
10495
10546
|
|
|
10496
10547
|
// scripts/dev-session/services/runtime.mjs
|
|
10497
|
-
var execFileAsync2 = (0, import_node_util2.promisify)(
|
|
10548
|
+
var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process5.execFile);
|
|
10498
10549
|
function isProcessLive2(pid) {
|
|
10499
10550
|
try {
|
|
10500
10551
|
process.kill(pid, 0);
|
|
@@ -10505,7 +10556,7 @@ function isProcessLive2(pid) {
|
|
|
10505
10556
|
}
|
|
10506
10557
|
function readProcessSignature2(pid) {
|
|
10507
10558
|
try {
|
|
10508
|
-
return (0,
|
|
10559
|
+
return (0, import_node_child_process5.execFileSync)(
|
|
10509
10560
|
"ps",
|
|
10510
10561
|
["-p", String(pid), "-o", "lstart=", "-o", "command="],
|
|
10511
10562
|
{
|
|
@@ -10759,14 +10810,14 @@ async function reconcileBetaSessionServices(services) {
|
|
|
10759
10810
|
}
|
|
10760
10811
|
|
|
10761
10812
|
// scripts/dev-session/services/process-stop.mjs
|
|
10762
|
-
var
|
|
10813
|
+
var import_node_child_process6 = require("node:child_process");
|
|
10763
10814
|
var GRACE_MS = 5e3;
|
|
10764
10815
|
var FORCE_WAIT_MS = 2e3;
|
|
10765
10816
|
var POLL_MS = 100;
|
|
10766
10817
|
function readProcessGroupSnapshot() {
|
|
10767
10818
|
let output;
|
|
10768
10819
|
try {
|
|
10769
|
-
output = (0,
|
|
10820
|
+
output = (0, import_node_child_process6.execFileSync)("ps", ["-axo", "pid=,pgid=,stat="], {
|
|
10770
10821
|
encoding: "utf8",
|
|
10771
10822
|
timeout: 2e3
|
|
10772
10823
|
});
|
|
@@ -10851,12 +10902,12 @@ async function stopOwnedProcess(processInfo) {
|
|
|
10851
10902
|
}
|
|
10852
10903
|
|
|
10853
10904
|
// scripts/dev-session/services/beta.mjs
|
|
10854
|
-
var
|
|
10905
|
+
var import_node_child_process7 = require("node:child_process");
|
|
10855
10906
|
var import_node_util3 = require("node:util");
|
|
10856
|
-
var execFileAsync3 = (0, import_node_util3.promisify)(
|
|
10907
|
+
var execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process7.execFile);
|
|
10857
10908
|
|
|
10858
10909
|
// scripts/dev-session/services/index.mjs
|
|
10859
|
-
var execFileAsync4 = (0, import_node_util4.promisify)(
|
|
10910
|
+
var execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process8.execFile);
|
|
10860
10911
|
async function assertSessionServicesStoppable(services) {
|
|
10861
10912
|
const inspection = await inspectSessionServices(services);
|
|
10862
10913
|
const staleOwnedServices = [
|
|
@@ -11028,7 +11079,7 @@ var import_node_path23 = __toESM(require("node:path"), 1);
|
|
|
11028
11079
|
|
|
11029
11080
|
// scripts/dev-session/beta-pool/storage/files.mjs
|
|
11030
11081
|
var import_node_crypto8 = require("node:crypto");
|
|
11031
|
-
var
|
|
11082
|
+
var import_node_fs14 = require("node:fs");
|
|
11032
11083
|
var import_promises6 = __toESM(require("node:fs/promises"), 1);
|
|
11033
11084
|
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
11034
11085
|
function sameFileIdentity2(left, right) {
|
|
@@ -11076,7 +11127,7 @@ async function readRegularJson(filePath, allowedRoot) {
|
|
|
11076
11127
|
try {
|
|
11077
11128
|
handle = await import_promises6.default.open(
|
|
11078
11129
|
filePath,
|
|
11079
|
-
|
|
11130
|
+
import_node_fs14.constants.O_RDONLY | import_node_fs14.constants.O_NOFOLLOW
|
|
11080
11131
|
);
|
|
11081
11132
|
const before = await handle.stat();
|
|
11082
11133
|
if (!before.isFile()) {
|
|
@@ -11101,7 +11152,7 @@ async function atomicWriteJson2(filePath, value, allowedRoot) {
|
|
|
11101
11152
|
);
|
|
11102
11153
|
const handle = await import_promises6.default.open(
|
|
11103
11154
|
temporaryPath,
|
|
11104
|
-
|
|
11155
|
+
import_node_fs14.constants.O_WRONLY | import_node_fs14.constants.O_CREAT | import_node_fs14.constants.O_EXCL | import_node_fs14.constants.O_NOFOLLOW,
|
|
11105
11156
|
384
|
|
11106
11157
|
);
|
|
11107
11158
|
try {
|
|
@@ -11292,12 +11343,12 @@ async function releaseBetaSlotRecoveryClaim(recoveryClaim, paths) {
|
|
|
11292
11343
|
}
|
|
11293
11344
|
|
|
11294
11345
|
// scripts/dev-session/beta-pool/storage/paths.mjs
|
|
11295
|
-
var
|
|
11346
|
+
var import_node_fs15 = require("node:fs");
|
|
11296
11347
|
var import_node_os10 = __toESM(require("node:os"), 1);
|
|
11297
11348
|
var import_node_path21 = __toESM(require("node:path"), 1);
|
|
11298
11349
|
function isDirectory(filePath) {
|
|
11299
11350
|
try {
|
|
11300
|
-
return (0,
|
|
11351
|
+
return (0, import_node_fs15.lstatSync)(filePath).isDirectory();
|
|
11301
11352
|
} catch {
|
|
11302
11353
|
return false;
|
|
11303
11354
|
}
|
|
@@ -12102,7 +12153,7 @@ async function resolveBetaSlotRetentionTargets(homeDir, slotId) {
|
|
|
12102
12153
|
|
|
12103
12154
|
// scripts/dev-session/beta-pool/storage/index.mjs
|
|
12104
12155
|
var import_node_crypto10 = require("node:crypto");
|
|
12105
|
-
var
|
|
12156
|
+
var import_node_child_process9 = require("node:child_process");
|
|
12106
12157
|
var import_promises11 = __toESM(require("node:fs/promises"), 1);
|
|
12107
12158
|
var import_node_os15 = __toESM(require("node:os"), 1);
|
|
12108
12159
|
var import_node_path27 = __toESM(require("node:path"), 1);
|
|
@@ -12192,7 +12243,7 @@ async function recordBetaSlotRecoveryAttempt({
|
|
|
12192
12243
|
}
|
|
12193
12244
|
|
|
12194
12245
|
// scripts/dev-session/beta-pool/storage/index.mjs
|
|
12195
|
-
var execFileAsync5 = (0, import_node_util5.promisify)(
|
|
12246
|
+
var execFileAsync5 = (0, import_node_util5.promisify)(import_node_child_process9.execFile);
|
|
12196
12247
|
var MAX_UPDATE_LOGS = 5;
|
|
12197
12248
|
var MAX_UPDATE_LOG_BYTES = 64 * 1024 * 1024;
|
|
12198
12249
|
var MIN_PLANNED_WRITE_BYTES = 512 * 1024 * 1024;
|
|
@@ -12618,7 +12669,7 @@ async function readManifestObservation(lease) {
|
|
|
12618
12669
|
try {
|
|
12619
12670
|
handle = await import_promises12.default.open(
|
|
12620
12671
|
lease.ownerManifestPath,
|
|
12621
|
-
|
|
12672
|
+
import_node_fs16.constants.O_RDONLY | import_node_fs16.constants.O_NOFOLLOW
|
|
12622
12673
|
);
|
|
12623
12674
|
const opened = await handle.stat();
|
|
12624
12675
|
if (!opened.isFile()) {
|
|
@@ -13094,7 +13145,7 @@ function assertExpectedVersion(actual, expected) {
|
|
|
13094
13145
|
}
|
|
13095
13146
|
|
|
13096
13147
|
// scripts/dev-resources/snapshot.mjs
|
|
13097
|
-
var exec = (0, import_node_util6.promisify)(
|
|
13148
|
+
var exec = (0, import_node_util6.promisify)(import_node_child_process10.execFile);
|
|
13098
13149
|
var pythonEntry = (0, import_node_url.fileURLToPath)(
|
|
13099
13150
|
new URL("../ios-simulators/monitor.py", __IMPORT_META_URL__)
|
|
13100
13151
|
);
|
|
@@ -13384,7 +13435,7 @@ async function inspectResources({ generation, backendPid }) {
|
|
|
13384
13435
|
}
|
|
13385
13436
|
|
|
13386
13437
|
// scripts/dev-resources/operations.mjs
|
|
13387
|
-
var
|
|
13438
|
+
var import_node_child_process12 = require("node:child_process");
|
|
13388
13439
|
var import_node_os21 = __toESM(require("node:os"), 1);
|
|
13389
13440
|
|
|
13390
13441
|
// scripts/dev-session/services/beta-start-recovery.mjs
|
|
@@ -13660,12 +13711,12 @@ async function finalizeBetaSlotRelease(options) {
|
|
|
13660
13711
|
|
|
13661
13712
|
// scripts/dev-session/beta-pool/recovery/index.mjs
|
|
13662
13713
|
var import_node_crypto13 = require("node:crypto");
|
|
13663
|
-
var
|
|
13714
|
+
var import_node_child_process11 = require("node:child_process");
|
|
13664
13715
|
var import_promises14 = __toESM(require("node:fs/promises"), 1);
|
|
13665
13716
|
var import_node_os19 = __toESM(require("node:os"), 1);
|
|
13666
13717
|
var import_node_path31 = __toESM(require("node:path"), 1);
|
|
13667
13718
|
var import_node_util7 = require("node:util");
|
|
13668
|
-
var execFileAsync6 = (0, import_node_util7.promisify)(
|
|
13719
|
+
var execFileAsync6 = (0, import_node_util7.promisify)(import_node_child_process11.execFile);
|
|
13669
13720
|
function sleep(milliseconds) {
|
|
13670
13721
|
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
13671
13722
|
}
|
|
@@ -14136,7 +14187,7 @@ async function recoverBetaPoolSlot({
|
|
|
14136
14187
|
}
|
|
14137
14188
|
|
|
14138
14189
|
// scripts/beta/operations.mjs
|
|
14139
|
-
var
|
|
14190
|
+
var import_node_fs17 = require("node:fs");
|
|
14140
14191
|
var import_promises15 = __toESM(require("node:fs/promises"), 1);
|
|
14141
14192
|
var import_node_path32 = __toESM(require("node:path"), 1);
|
|
14142
14193
|
async function withBetaLock(paths, operation) {
|
|
@@ -14268,7 +14319,7 @@ async function quitBeta(paths) {
|
|
|
14268
14319
|
}
|
|
14269
14320
|
async function runAppServerCli(paths, command, sourceRevision = null) {
|
|
14270
14321
|
const cliEntry = paths.controlCliPath;
|
|
14271
|
-
if (!(0,
|
|
14322
|
+
if (!(0, import_node_fs17.existsSync)(cliEntry)) {
|
|
14272
14323
|
return { ok: false, code: 1, stderr: `missing CLI build: ${cliEntry}` };
|
|
14273
14324
|
}
|
|
14274
14325
|
return await runCapture(
|
|
@@ -14743,7 +14794,7 @@ async function releaseSimulator(request, context) {
|
|
|
14743
14794
|
if (resource.release.action !== request.action)
|
|
14744
14795
|
conflict("\u6E05\u7406\u6761\u4EF6\u5DF2\u53D8\u5316\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u65B0\u786E\u8BA4");
|
|
14745
14796
|
return await new Promise((resolve, reject) => {
|
|
14746
|
-
const child = (0,
|
|
14797
|
+
const child = (0, import_node_child_process12.spawn)("python3", ["-B", pythonEntry, "release"], {
|
|
14747
14798
|
stdio: ["pipe", "pipe", "ignore"]
|
|
14748
14799
|
});
|
|
14749
14800
|
let stdout = "";
|