@runweave/server-linux-x64 0.1.3 → 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 +160 -160
- 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 +222 -161
- 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 +213 -160
- package/payload/backend/evolution-sqlite-worker.cjs +58 -1
- package/payload/backend/index.cjs +3101 -2196
- package/payload/bin/runtime.cjs +22 -5
- package/payload/frontend/dist/assets/{_baseUniq-Z8S1OGl1.js → _baseUniq-Cca1dJQ9.js} +1 -1
- package/payload/frontend/dist/assets/{access-BkQls-gl.js → access-DUFDE5w4.js} +1 -1
- package/payload/frontend/dist/assets/{advanced-Cwuko7dT.js → advanced-COAr8Hid.js} +1 -1
- package/payload/frontend/dist/assets/{appearance-D1NbgiL9.js → appearance-DwT_3HyT.js} +1 -1
- package/payload/frontend/dist/assets/{arc-yTzSLmPE.js → arc-BiCpkEHN.js} +1 -1
- package/payload/frontend/dist/assets/{architectureDiagram-Q4EWVU46-BvvnA771.js → architectureDiagram-Q4EWVU46-DMulbydF.js} +1 -1
- package/payload/frontend/dist/assets/{blockDiagram-DXYQGD6D-4mSkYwEH.js → blockDiagram-DXYQGD6D-DP3EKW2h.js} +1 -1
- package/payload/frontend/dist/assets/{c4Diagram-AHTNJAMY-BFsQYjNJ.js → c4Diagram-AHTNJAMY-BLS8RP7a.js} +1 -1
- package/payload/frontend/dist/assets/channel-CKmnPCpJ.js +1 -0
- package/payload/frontend/dist/assets/{chunk-4BX2VUAB-B4j2kD8S.js → chunk-4BX2VUAB-BUV-Uw18.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-4TB4RGXK-BHHtOn_W.js → chunk-4TB4RGXK-94c9VfB5.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-55IACEB6-npi1DjnI.js → chunk-55IACEB6-RfLXGW3_.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-EDXVE4YY-6XoKXtpJ.js → chunk-EDXVE4YY-pPo_Q141.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-FMBD7UC4-D5wdm5pu.js → chunk-FMBD7UC4-DS6emz7j.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-OYMX7WX6-CdQRrw_z.js → chunk-OYMX7WX6-G-gZUTTY.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-QZHKN3VN-j-pcsMU1.js → chunk-QZHKN3VN-BTTlBOxb.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-YZCP3GAM-ISBm3jAD.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--S1gQxJQ.js +12 -0
- package/payload/frontend/dist/assets/{connections-BuXymnab.js → connections-BKIzytUO.js} +1 -1
- package/payload/frontend/dist/assets/{cose-bilkent-S5V4N54A-D3ioXA7D.js → cose-bilkent-S5V4N54A-C0uj9jlE.js} +1 -1
- package/payload/frontend/dist/assets/{dagre-KV5264BT-DjtjEtE5.js → dagre-KV5264BT-C21BxT9x.js} +1 -1
- package/payload/frontend/dist/assets/{desktop-Du3Gd9LW.js → desktop-BrFP7uD8.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-5BDNPKRD-CtxPyS9C.js → diagram-5BDNPKRD-Dm_Sv1fY.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-G4DWMVQ6-ikqU0pq3.js → diagram-G4DWMVQ6-CyBlXHYE.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-MMDJMWI5-CoKNp7eo.js → diagram-MMDJMWI5-DlzAJAhf.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-TYMM5635-7xoHFg4D.js → diagram-TYMM5635-BUHbMszI.js} +1 -1
- package/payload/frontend/dist/assets/{erDiagram-SMLLAGMA-Da8Jm4bc.js → erDiagram-SMLLAGMA-B_KFaTkr.js} +1 -1
- package/payload/frontend/dist/assets/{flowDiagram-DWJPFMVM-bcIflYKx.js → flowDiagram-DWJPFMVM-Ci8c_uVM.js} +1 -1
- package/payload/frontend/dist/assets/{ganttDiagram-T4ZO3ILL-CCSwpL4k.js → ganttDiagram-T4ZO3ILL-CuX6Iq0t.js} +1 -1
- package/payload/frontend/dist/assets/{gitGraphDiagram-UUTBAWPF-C5YN1uxh.js → gitGraphDiagram-UUTBAWPF-g07Rr7cC.js} +1 -1
- package/payload/frontend/dist/assets/{graph-DhVKaWIc.js → graph-BFZFDWHT.js} +1 -1
- package/payload/frontend/dist/assets/{image-CAXFSZmt.js → image-Bqf_JqcW.js} +1 -1
- package/payload/frontend/dist/assets/{index-BPgmi_HT.js → index-CfimLLEm.js} +92 -89
- package/payload/frontend/dist/assets/{infoDiagram-42DDH7IO-CKUkVeJd.js → infoDiagram-42DDH7IO-swg7grwk.js} +1 -1
- package/payload/frontend/dist/assets/{ishikawaDiagram-UXIWVN3A-Cu6SCNrB.js → ishikawaDiagram-UXIWVN3A-9RP9c7cN.js} +1 -1
- package/payload/frontend/dist/assets/{journeyDiagram-VCZTEJTY-BJsUgp8J.js → journeyDiagram-VCZTEJTY-Bh523JBl.js} +1 -1
- package/payload/frontend/dist/assets/{kanban-definition-6JOO6SKY-BGowhqfi.js → kanban-definition-6JOO6SKY-BxGTS30A.js} +1 -1
- package/payload/frontend/dist/assets/{layout-CunOX6M2.js → layout-BA90oBmS.js} +1 -1
- package/payload/frontend/dist/assets/{linear-C_0D1AIt.js → linear-BVOBmfu-.js} +1 -1
- package/payload/frontend/dist/assets/main-DtzgJZEf.css +33 -0
- package/payload/frontend/dist/assets/{main-D9JUBZrL.js → main-wqeDvHCJ.js} +154 -151
- package/payload/frontend/dist/assets/{min-CYRFaNhC.js → min-CTb5zZxd.js} +1 -1
- package/payload/frontend/dist/assets/{mindmap-definition-QFDTVHPH-CC29vHKR.js → mindmap-definition-QFDTVHPH-D77Oju5l.js} +1 -1
- package/payload/frontend/dist/assets/{monitoring-CSJEFZ4D.js → monitoring-BcgpwXyO.js} +1 -1
- package/payload/frontend/dist/assets/{notifications-B6plZwi5.js → notifications-Cp6tD-Df.js} +1 -1
- package/payload/frontend/dist/assets/{pieDiagram-DEJITSTG-ZPTChlGS.js → pieDiagram-DEJITSTG-Dp1SSOdP.js} +1 -1
- package/payload/frontend/dist/assets/{quadrantDiagram-34T5L4WZ-B4sL0Weo.js → quadrantDiagram-34T5L4WZ-D2_VBifB.js} +1 -1
- package/payload/frontend/dist/assets/{record-content-DBb8tU0P.js → record-content-DawrQ3vI.js} +1 -1
- package/payload/frontend/dist/assets/{requirementDiagram-MS252O5E-Q2PHuGEG.js → requirementDiagram-MS252O5E-CZUQO9c-.js} +1 -1
- package/payload/frontend/dist/assets/{sankeyDiagram-XADWPNL6-k8w1jlHT.js → sankeyDiagram-XADWPNL6-DMw6E77g.js} +1 -1
- package/payload/frontend/dist/assets/{sequenceDiagram-FGHM5R23-0qPxopqC.js → sequenceDiagram-FGHM5R23-CCF4Uyr1.js} +1 -1
- package/payload/frontend/dist/assets/{stateDiagram-FHFEXIEX-BHxYXi2c.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-Zy2MW6gr.js → status-B-_-GXiJ.js} +1 -1
- package/payload/frontend/dist/assets/suiji-BB8bFtuh.js +1 -0
- package/payload/frontend/dist/assets/{svg-vmNZnz5w.js → svg-DOzReQUk.js} +1 -1
- package/payload/frontend/dist/assets/{tabs-C257BfM6.js → tabs-1W6wgg8j.js} +1 -1
- package/payload/frontend/dist/assets/{timeline-definition-GMOUNBTQ-BC_3Dip2.js → timeline-definition-GMOUNBTQ-DTlM3m_q.js} +1 -1
- package/payload/frontend/dist/assets/{vennDiagram-DHZGUBPP-V_X88VPq.js → vennDiagram-DHZGUBPP-D_9TXuLu.js} +1 -1
- package/payload/frontend/dist/assets/{wardley-RL74JXVD-CflQhbCA.js → wardley-RL74JXVD-U4S2yDk_.js} +1 -1
- package/payload/frontend/dist/assets/{wardleyDiagram-NUSXRM2D-C75i3btX.js → wardleyDiagram-NUSXRM2D-BCUzTDXi.js} +1 -1
- package/payload/frontend/dist/assets/{xychartDiagram-5P7HB3ND-KIYpQyyi.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 +3 -3
- package/payload/server/index.cjs +167 -107
- package/payload/frontend/dist/assets/channel-DGu_xwRJ.js +0 -1
- package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-Xx1qN_NY.js +0 -1
- package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-Xx1qN_NY.js +0 -1
- package/payload/frontend/dist/assets/clone-DdDT5GkX.js +0 -1
- package/payload/frontend/dist/assets/connection-BL2ZiJKS.js +0 -12
- package/payload/frontend/dist/assets/main-C-ZLrzMh.css +0 -33
- package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-s5VUMcqx.js +0 -1
- package/payload/frontend/dist/assets/suiji-5pox13NE.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);
|
|
@@ -9004,6 +9066,8 @@ function isConfigurationContainer(key, array = false) {
|
|
|
9004
9066
|
});
|
|
9005
9067
|
}
|
|
9006
9068
|
function domainForPath(key) {
|
|
9069
|
+
const declared = Object.keys(CONFIGURATION_DOMAIN_VERSIONS).find((domain) => key === domain || key.startsWith(`${domain}.`));
|
|
9070
|
+
if (declared) return declared;
|
|
9007
9071
|
const parts = key.split(".");
|
|
9008
9072
|
return ["backend", "services", "desktop", "agents"].includes(parts[0]) ? parts.slice(0, 2).join(".") : parts[0];
|
|
9009
9073
|
}
|
|
@@ -9172,10 +9236,11 @@ function parseConfigurationYaml(source, context) {
|
|
|
9172
9236
|
return { document, value, digest: (0, import_node_crypto3.createHash)("sha256").update(source).digest("hex"), issues: validateDomains(value, context) };
|
|
9173
9237
|
}
|
|
9174
9238
|
function assertPrivateFile(file, fd) {
|
|
9175
|
-
const stat = fd === void 0 ? (0,
|
|
9239
|
+
const stat = fd === void 0 ? (0, import_node_fs7.lstatSync)(file) : (0, import_node_fs7.fstatSync)(fd);
|
|
9176
9240
|
if (!stat.isFile() || stat.isSymbolicLink() || stat.nlink !== 1) throw new ConfigurationError("CONFIG_FILE_NOT_PRIVATE_REGULAR");
|
|
9177
9241
|
if (typeof process.getuid === "function" && stat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_FILE_OWNER_MISMATCH");
|
|
9178
|
-
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);
|
|
9179
9244
|
if (stat.size > MAX_BYTES) throw new ConfigurationError("CONFIG_FILE_TOO_LARGE", [], { line: 1, column: 1 });
|
|
9180
9245
|
}
|
|
9181
9246
|
var ConfigurationStore = class {
|
|
@@ -9185,30 +9250,29 @@ var ConfigurationStore = class {
|
|
|
9185
9250
|
}
|
|
9186
9251
|
file;
|
|
9187
9252
|
read() {
|
|
9188
|
-
if (!(0,
|
|
9189
|
-
|
|
9190
|
-
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);
|
|
9191
9255
|
assertPrivateFile(this.file);
|
|
9192
|
-
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);
|
|
9193
9257
|
try {
|
|
9194
9258
|
assertPrivateFile(this.file, fd);
|
|
9195
|
-
return parseConfigurationYaml((0,
|
|
9259
|
+
return parseConfigurationYaml((0, import_node_fs7.readFileSync)(fd, "utf8"), this.context);
|
|
9196
9260
|
} finally {
|
|
9197
|
-
(0,
|
|
9261
|
+
(0, import_node_fs7.closeSync)(fd);
|
|
9198
9262
|
}
|
|
9199
9263
|
}
|
|
9200
9264
|
locked(run) {
|
|
9201
|
-
(0,
|
|
9202
|
-
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);
|
|
9203
9267
|
if (!dirStat.isDirectory() || dirStat.isSymbolicLink() || typeof process.getuid === "function" && dirStat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_ROOT_OWNER_MISMATCH");
|
|
9204
|
-
|
|
9205
|
-
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);
|
|
9206
9270
|
try {
|
|
9207
9271
|
assertPrivateFile(import_node_path9.default.join(this.context.configRoot, "settings.lock"), fd);
|
|
9208
9272
|
if (!(0, import_fs_native_extensions2.tryLock)(fd)) throw new ConfigurationError("CONFIG_WRITE_BUSY");
|
|
9209
9273
|
return run();
|
|
9210
9274
|
} finally {
|
|
9211
|
-
(0,
|
|
9275
|
+
(0, import_node_fs7.closeSync)(fd);
|
|
9212
9276
|
}
|
|
9213
9277
|
}
|
|
9214
9278
|
publish(document, previous, backupId) {
|
|
@@ -9218,41 +9282,35 @@ var ConfigurationStore = class {
|
|
|
9218
9282
|
const temporary = `${this.file}.${(0, import_node_crypto3.randomUUID)()}.tmp`;
|
|
9219
9283
|
if (previous !== void 0) {
|
|
9220
9284
|
const backupRoot = import_node_path9.default.join(this.context.configRoot, "config-backups");
|
|
9221
|
-
(0,
|
|
9222
|
-
|
|
9223
|
-
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);
|
|
9224
9287
|
const backup = import_node_path9.default.join(backupRoot, backupId ?? `${Date.now()}-${(0, import_node_crypto3.randomUUID)()}.yaml`);
|
|
9225
|
-
const fd2 = (0,
|
|
9288
|
+
const fd2 = (0, import_node_fs7.openSync)(backup, "wx", 384);
|
|
9226
9289
|
try {
|
|
9227
|
-
(0,
|
|
9228
|
-
(0,
|
|
9290
|
+
(0, import_node_fs7.writeFileSync)(fd2, previous);
|
|
9291
|
+
(0, import_node_fs7.fsyncSync)(fd2);
|
|
9229
9292
|
} finally {
|
|
9230
|
-
(0,
|
|
9293
|
+
(0, import_node_fs7.closeSync)(fd2);
|
|
9231
9294
|
}
|
|
9232
9295
|
}
|
|
9233
|
-
const fd = (0,
|
|
9296
|
+
const fd = (0, import_node_fs7.openSync)(temporary, "wx", 384);
|
|
9234
9297
|
try {
|
|
9235
|
-
(0,
|
|
9236
|
-
(0,
|
|
9298
|
+
(0, import_node_fs7.writeFileSync)(fd, source);
|
|
9299
|
+
(0, import_node_fs7.fsyncSync)(fd);
|
|
9237
9300
|
} finally {
|
|
9238
|
-
(0,
|
|
9301
|
+
(0, import_node_fs7.closeSync)(fd);
|
|
9239
9302
|
}
|
|
9240
9303
|
try {
|
|
9241
|
-
(0,
|
|
9242
|
-
|
|
9243
|
-
try {
|
|
9244
|
-
(0, import_node_fs6.fsyncSync)(parent);
|
|
9245
|
-
} finally {
|
|
9246
|
-
(0, import_node_fs6.closeSync)(parent);
|
|
9247
|
-
}
|
|
9304
|
+
(0, import_node_fs7.renameSync)(temporary, this.file);
|
|
9305
|
+
syncDirectory(this.context.configRoot);
|
|
9248
9306
|
} finally {
|
|
9249
|
-
if ((0,
|
|
9307
|
+
if ((0, import_node_fs7.existsSync)(temporary)) (0, import_node_fs7.unlinkSync)(temporary);
|
|
9250
9308
|
}
|
|
9251
9309
|
return checked;
|
|
9252
9310
|
}
|
|
9253
9311
|
initialize(value) {
|
|
9254
9312
|
return this.locked(() => {
|
|
9255
|
-
if ((0,
|
|
9313
|
+
if ((0, import_node_fs7.existsSync)(this.file)) throw new ConfigurationError("CONFIG_ALREADY_EXISTS");
|
|
9256
9314
|
validateEnvelope(value, this.context);
|
|
9257
9315
|
const issues = validateDomains(value, this.context);
|
|
9258
9316
|
if (Object.keys(issues).length) throw new ConfigurationError("CONFIG_VALIDATION_FAILED", Object.values(issues).flat().map((item) => item.path));
|
|
@@ -9292,9 +9350,9 @@ var ConfigurationStore = class {
|
|
|
9292
9350
|
}
|
|
9293
9351
|
backups() {
|
|
9294
9352
|
const root = import_node_path9.default.join(this.context.configRoot, "config-backups");
|
|
9295
|
-
if (!(0,
|
|
9353
|
+
if (!(0, import_node_fs7.existsSync)(root)) return [];
|
|
9296
9354
|
assertPrivateDirectory(root);
|
|
9297
|
-
return (0,
|
|
9355
|
+
return (0, import_node_fs7.readdirSync)(root).filter((id) => /^\d+-[a-f0-9-]+\.yaml$/.test(id)).sort().reverse().map((id) => {
|
|
9298
9356
|
try {
|
|
9299
9357
|
const backup = this.readBackup(id);
|
|
9300
9358
|
return { id, revision: backup.value.revision, schemaVersion: backup.value.schemaVersion, compatible: true };
|
|
@@ -9372,23 +9430,18 @@ var ConfigurationStore = class {
|
|
|
9372
9430
|
recordUpgrade(value) {
|
|
9373
9431
|
const file = import_node_path9.default.join(this.context.configRoot, "config-upgrade.json");
|
|
9374
9432
|
const temporary = `${file}.${(0, import_node_crypto3.randomUUID)()}.tmp`;
|
|
9375
|
-
const fd = (0,
|
|
9433
|
+
const fd = (0, import_node_fs7.openSync)(temporary, "wx", 384);
|
|
9376
9434
|
try {
|
|
9377
|
-
(0,
|
|
9378
|
-
(0,
|
|
9435
|
+
(0, import_node_fs7.writeFileSync)(fd, JSON.stringify(value, null, 2) + "\n");
|
|
9436
|
+
(0, import_node_fs7.fsyncSync)(fd);
|
|
9379
9437
|
} finally {
|
|
9380
|
-
(0,
|
|
9438
|
+
(0, import_node_fs7.closeSync)(fd);
|
|
9381
9439
|
}
|
|
9382
9440
|
try {
|
|
9383
|
-
(0,
|
|
9384
|
-
|
|
9385
|
-
try {
|
|
9386
|
-
(0, import_node_fs6.fsyncSync)(parent);
|
|
9387
|
-
} finally {
|
|
9388
|
-
(0, import_node_fs6.closeSync)(parent);
|
|
9389
|
-
}
|
|
9441
|
+
(0, import_node_fs7.renameSync)(temporary, file);
|
|
9442
|
+
syncDirectory(this.context.configRoot);
|
|
9390
9443
|
} finally {
|
|
9391
|
-
if ((0,
|
|
9444
|
+
if ((0, import_node_fs7.existsSync)(temporary)) (0, import_node_fs7.unlinkSync)(temporary);
|
|
9392
9445
|
}
|
|
9393
9446
|
}
|
|
9394
9447
|
upgrade(expected) {
|
|
@@ -9397,7 +9450,7 @@ var ConfigurationStore = class {
|
|
|
9397
9450
|
if (preview.expectedRevision !== expected.revision || preview.expectedDigest !== expected.digest) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
|
|
9398
9451
|
if (!preview.changed) {
|
|
9399
9452
|
const receiptFile = import_node_path9.default.join(this.context.configRoot, "config-upgrade.json");
|
|
9400
|
-
if ((0,
|
|
9453
|
+
if ((0, import_node_fs7.existsSync)(receiptFile)) {
|
|
9401
9454
|
const receipt = JSON.parse(readPrivateFile(receiptFile));
|
|
9402
9455
|
if (isConfigurationObject(receipt) && receipt.phase === "prepared" && receipt.plannedDigest === expected.digest)
|
|
9403
9456
|
this.recordUpgrade({ ...receipt, phase: "committed", savedRevision: expected.revision, digest: expected.digest });
|
|
@@ -9431,9 +9484,9 @@ var ConfigurationStore = class {
|
|
|
9431
9484
|
previous(keys) {
|
|
9432
9485
|
const current = this.read();
|
|
9433
9486
|
const root = import_node_path9.default.join(this.context.configRoot, "config-backups");
|
|
9434
|
-
if (!(0,
|
|
9487
|
+
if (!(0, import_node_fs7.existsSync)(root)) throw new ConfigurationError("CONFIG_BACKUP_UNAVAILABLE");
|
|
9435
9488
|
assertPrivateDirectory(root);
|
|
9436
|
-
const candidates = (0,
|
|
9489
|
+
const candidates = (0, import_node_fs7.readdirSync)(root).filter((file) => /^\d+-[a-f0-9-]+\.yaml$/.test(file)).sort().reverse();
|
|
9437
9490
|
for (const candidate of candidates) {
|
|
9438
9491
|
const file = import_node_path9.default.join(root, candidate);
|
|
9439
9492
|
const previous = parseConfigurationYaml(readPrivateFile(file), this.context);
|
|
@@ -9445,7 +9498,7 @@ var ConfigurationStore = class {
|
|
|
9445
9498
|
}
|
|
9446
9499
|
migrate(value, expected) {
|
|
9447
9500
|
return this.locked(() => {
|
|
9448
|
-
const current = (0,
|
|
9501
|
+
const current = (0, import_node_fs7.existsSync)(this.file) ? this.read() : null;
|
|
9449
9502
|
if (current ? !expected || current.value.revision !== expected.revision || current.digest !== expected.digest : expected !== null) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
|
|
9450
9503
|
validateEnvelope(value, this.context);
|
|
9451
9504
|
const issues = validateDomains(value, this.context);
|
|
@@ -9676,7 +9729,7 @@ function configurationPath(key, relativeDefault) {
|
|
|
9676
9729
|
}
|
|
9677
9730
|
|
|
9678
9731
|
// packages/config-node/src/migration.ts
|
|
9679
|
-
var
|
|
9732
|
+
var import_node_fs8 = require("node:fs");
|
|
9680
9733
|
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
9681
9734
|
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
9682
9735
|
var import_node_crypto4 = require("node:crypto");
|
|
@@ -9711,7 +9764,7 @@ function importEnvironment(value, environment) {
|
|
|
9711
9764
|
}
|
|
9712
9765
|
function prepareMigration(context, sources) {
|
|
9713
9766
|
const store = new ConfigurationStore(context);
|
|
9714
|
-
const initial = (0,
|
|
9767
|
+
const initial = (0, import_node_fs8.existsSync)(store.file) ? store.read().value : emptyConfiguration(context);
|
|
9715
9768
|
const value = structuredClone(initial);
|
|
9716
9769
|
const result = { value, sources: [], conflicts: [] };
|
|
9717
9770
|
const byDomain = /* @__PURE__ */ new Map();
|
|
@@ -9720,7 +9773,7 @@ function prepareMigration(context, sources) {
|
|
|
9720
9773
|
if (!import_node_path11.default.isAbsolute(source.file)) throw new ConfigurationError("CONFIG_SOURCE_PATH_REQUIRED");
|
|
9721
9774
|
assertMigrationSourceOwner(context, source.file);
|
|
9722
9775
|
if (migratedDomains.has(source.domain)) continue;
|
|
9723
|
-
const raw = (0,
|
|
9776
|
+
const raw = (0, import_node_fs8.readFileSync)(source.file, "utf8");
|
|
9724
9777
|
const digest = (0, import_node_crypto4.createHash)("sha256").update(raw).digest("hex");
|
|
9725
9778
|
const previous = byDomain.get(source.domain);
|
|
9726
9779
|
if (previous && previous !== digest) {
|
|
@@ -9811,39 +9864,39 @@ function migrationLeaves(value, prefix) {
|
|
|
9811
9864
|
return [[prefix, value]];
|
|
9812
9865
|
}
|
|
9813
9866
|
function backupMigrationSources(context, draft) {
|
|
9814
|
-
(0,
|
|
9867
|
+
(0, import_node_fs8.mkdirSync)(context.configRoot, { recursive: true, mode: 448 });
|
|
9815
9868
|
assertPrivateDirectory(context.configRoot);
|
|
9816
9869
|
const directory2 = import_node_path11.default.join(context.configRoot, "config-backups");
|
|
9817
|
-
(0,
|
|
9870
|
+
(0, import_node_fs8.mkdirSync)(directory2, { recursive: true, mode: 448 });
|
|
9818
9871
|
assertPrivateDirectory(directory2);
|
|
9819
9872
|
for (const source of draft.sources) {
|
|
9820
9873
|
assertMigrationSourceOwner(context, source.file);
|
|
9821
|
-
const raw = (0,
|
|
9874
|
+
const raw = (0, import_node_fs8.readFileSync)(source.file);
|
|
9822
9875
|
if ((0, import_node_crypto4.createHash)("sha256").update(raw).digest("hex") !== source.digest) throw new ConfigurationError("CONFIG_SOURCE_CHANGED");
|
|
9823
9876
|
const target = import_node_path11.default.join(directory2, `migration-${source.digest}.source`);
|
|
9824
|
-
if ((0,
|
|
9877
|
+
if ((0, import_node_fs8.existsSync)(target)) {
|
|
9825
9878
|
if ((0, import_node_crypto4.createHash)("sha256").update(readPrivateFile(target, raw.length)).digest("hex") !== source.digest) throw new ConfigurationError("CONFIG_BACKUP_INVALID");
|
|
9826
9879
|
continue;
|
|
9827
9880
|
}
|
|
9828
9881
|
const temporary = `${target}.${(0, import_node_crypto4.randomUUID)()}.tmp`;
|
|
9829
|
-
const fd2 = (0,
|
|
9882
|
+
const fd2 = (0, import_node_fs8.openSync)(temporary, "wx", 384);
|
|
9830
9883
|
try {
|
|
9831
|
-
(0,
|
|
9832
|
-
(0,
|
|
9884
|
+
(0, import_node_fs8.writeFileSync)(fd2, raw);
|
|
9885
|
+
(0, import_node_fs8.fsyncSync)(fd2);
|
|
9833
9886
|
} finally {
|
|
9834
|
-
(0,
|
|
9887
|
+
(0, import_node_fs8.closeSync)(fd2);
|
|
9835
9888
|
}
|
|
9836
9889
|
try {
|
|
9837
|
-
(0,
|
|
9890
|
+
(0, import_node_fs8.renameSync)(temporary, target);
|
|
9838
9891
|
} finally {
|
|
9839
|
-
if ((0,
|
|
9892
|
+
if ((0, import_node_fs8.existsSync)(temporary)) (0, import_node_fs8.unlinkSync)(temporary);
|
|
9840
9893
|
}
|
|
9841
9894
|
}
|
|
9842
|
-
const fd = (0,
|
|
9895
|
+
const fd = (0, import_node_fs8.openSync)(directory2, "r");
|
|
9843
9896
|
try {
|
|
9844
|
-
(0,
|
|
9897
|
+
(0, import_node_fs8.fsyncSync)(fd);
|
|
9845
9898
|
} finally {
|
|
9846
|
-
(0,
|
|
9899
|
+
(0, import_node_fs8.closeSync)(fd);
|
|
9847
9900
|
}
|
|
9848
9901
|
}
|
|
9849
9902
|
function assertMigrationSourceOwner(context, file) {
|
|
@@ -9900,7 +9953,7 @@ var ConfigurationDomain = class {
|
|
|
9900
9953
|
};
|
|
9901
9954
|
|
|
9902
9955
|
// packages/config-node/src/migration-discovery.ts
|
|
9903
|
-
var
|
|
9956
|
+
var import_node_fs9 = require("node:fs");
|
|
9904
9957
|
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
9905
9958
|
var import_node_os7 = __toESM(require("node:os"), 1);
|
|
9906
9959
|
var import_node_crypto5 = require("node:crypto");
|
|
@@ -9908,7 +9961,7 @@ function discoverMigrationSources(context, selected) {
|
|
|
9908
9961
|
const sources = [];
|
|
9909
9962
|
const add = (root, relative, domain, format = "json") => {
|
|
9910
9963
|
const file = import_node_path12.default.join(root, relative);
|
|
9911
|
-
if ((0,
|
|
9964
|
+
if ((0, import_node_fs9.existsSync)(file)) sources.push({ file, domain, format });
|
|
9912
9965
|
};
|
|
9913
9966
|
add(context.configRoot, "config.json", "cli");
|
|
9914
9967
|
add(context.configRoot, "snapshot-share/publish.env", "services.snapshotPublisher", "env");
|
|
@@ -9931,7 +9984,7 @@ function discoverMigrationSources(context, selected) {
|
|
|
9931
9984
|
function retainSelectedStorage(context, selected, draft) {
|
|
9932
9985
|
if (!selected.backendProfile || draft.value.migrations.storage) return;
|
|
9933
9986
|
const profile = selectedDirectory(context, selected.backendProfile);
|
|
9934
|
-
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");
|
|
9935
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");
|
|
9936
9989
|
const retained = {
|
|
9937
9990
|
"storage.browserProfileDirectory": profile,
|
|
@@ -9950,7 +10003,7 @@ function retainSelectedStorage(context, selected, draft) {
|
|
|
9950
10003
|
draft.value.migrations.storage = { id: `selected-profile:${digest}`, sourceDigest: digest };
|
|
9951
10004
|
}
|
|
9952
10005
|
function selectedDirectory(context, directory2) {
|
|
9953
|
-
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");
|
|
9954
10007
|
const result = canonicalPath(directory2);
|
|
9955
10008
|
assertOwnedPath(context, result);
|
|
9956
10009
|
return result;
|
|
@@ -9958,19 +10011,19 @@ function selectedDirectory(context, directory2) {
|
|
|
9958
10011
|
|
|
9959
10012
|
// packages/config-node/src/initialization.ts
|
|
9960
10013
|
var import_node_crypto6 = require("node:crypto");
|
|
9961
|
-
var
|
|
10014
|
+
var import_node_fs10 = require("node:fs");
|
|
9962
10015
|
var import_node_os8 = __toESM(require("node:os"), 1);
|
|
9963
10016
|
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
9964
10017
|
function assertNewStableInstallation(context, selected = {}) {
|
|
9965
10018
|
if (context.kind !== "stable") throw new ConfigurationError("CONFIG_STABLE_REQUIRED");
|
|
9966
|
-
if ((0,
|
|
10019
|
+
if ((0, import_node_fs10.existsSync)(import_node_path13.default.join(context.configRoot, "settings.yaml"))) throw new ConfigurationError("CONFIG_ALREADY_EXISTS");
|
|
9967
10020
|
const legacy = discoverMigrationSources(context, selected);
|
|
9968
10021
|
if (legacy.length) throw new ConfigurationError("CONFIG_MIGRATION_REQUIRED", legacy.map((source) => source.domain));
|
|
9969
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")]) {
|
|
9970
|
-
if (!(0,
|
|
9971
|
-
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];
|
|
9972
10025
|
for (const directory2 of children) {
|
|
9973
|
-
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)))) {
|
|
9974
10027
|
throw new ConfigurationError("CONFIG_MIGRATION_REQUIRED", ["backend.profile"]);
|
|
9975
10028
|
}
|
|
9976
10029
|
}
|
|
@@ -10025,14 +10078,14 @@ function prepareInitialConfiguration(context, auth) {
|
|
|
10025
10078
|
}
|
|
10026
10079
|
|
|
10027
10080
|
// packages/config-node/src/research-mcp.ts
|
|
10028
|
-
var
|
|
10081
|
+
var import_node_fs11 = require("node:fs");
|
|
10029
10082
|
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
10030
10083
|
function researchMcpHome() {
|
|
10031
10084
|
return import_node_path14.default.join(resolveConfigurationContext().configRoot, "research-mcp");
|
|
10032
10085
|
}
|
|
10033
10086
|
function readResearchMcpInstallation() {
|
|
10034
10087
|
const file = import_node_path14.default.join(researchMcpHome(), "installation.json");
|
|
10035
|
-
if (!(0,
|
|
10088
|
+
if (!(0, import_node_fs11.existsSync)(file)) return null;
|
|
10036
10089
|
const value = JSON.parse(readPrivateFile(file));
|
|
10037
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)))) {
|
|
10038
10091
|
throw new Error("Invalid research MCP installation identity");
|
|
@@ -10041,16 +10094,16 @@ function readResearchMcpInstallation() {
|
|
|
10041
10094
|
}
|
|
10042
10095
|
function writeResearchMcpInstallation(value) {
|
|
10043
10096
|
const home = researchMcpHome();
|
|
10044
|
-
(0,
|
|
10097
|
+
(0, import_node_fs11.mkdirSync)(home, { recursive: true, mode: 448 });
|
|
10045
10098
|
const file = import_node_path14.default.join(home, "installation.json");
|
|
10046
10099
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
10047
|
-
(0,
|
|
10100
|
+
(0, import_node_fs11.writeFileSync)(temporary, `${JSON.stringify(value, null, 2)}
|
|
10048
10101
|
`, { mode: 384 });
|
|
10049
|
-
(0,
|
|
10102
|
+
(0, import_node_fs11.renameSync)(temporary, file);
|
|
10050
10103
|
}
|
|
10051
10104
|
|
|
10052
10105
|
// packages/config-node/src/runtime-status.ts
|
|
10053
|
-
var
|
|
10106
|
+
var import_node_fs12 = require("node:fs");
|
|
10054
10107
|
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
10055
10108
|
var import_node_os9 = __toESM(require("node:os"), 1);
|
|
10056
10109
|
var import_node_crypto7 = require("node:crypto");
|
|
@@ -10135,14 +10188,14 @@ function validateLocalRuntimeStatusReport(value, source) {
|
|
|
10135
10188
|
function readNativeHostRuntimeStatusReport() {
|
|
10136
10189
|
const root = import_node_path15.default.join(import_node_os9.default.homedir(), "Library", "Application Support", "RemoteDesk");
|
|
10137
10190
|
const file = import_node_path15.default.join(root, "runtime-status.json");
|
|
10138
|
-
if (!(0,
|
|
10191
|
+
if (!(0, import_node_fs12.existsSync)(file)) return null;
|
|
10139
10192
|
assertPrivateDirectory(root);
|
|
10140
|
-
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 };
|
|
10141
10194
|
}
|
|
10142
10195
|
function readNativeHostSharingEnabled() {
|
|
10143
10196
|
const root = import_node_path15.default.join(import_node_os9.default.homedir(), "Library", "Application Support", "RemoteDesk");
|
|
10144
10197
|
const file = import_node_path15.default.join(root, "local-host.json");
|
|
10145
|
-
if (!(0,
|
|
10198
|
+
if (!(0, import_node_fs12.existsSync)(file)) return false;
|
|
10146
10199
|
assertPrivateDirectory(root);
|
|
10147
10200
|
const value = JSON.parse(readPrivateFile(file, 16 * 1024));
|
|
10148
10201
|
if (value.schemaVersion !== 1 || typeof value.running !== "boolean") throw new Error("Invalid native Host sharing intent");
|
|
@@ -10155,16 +10208,16 @@ function startLocalRuntimeStatusReporter(source, report) {
|
|
|
10155
10208
|
let inFlight = null;
|
|
10156
10209
|
let latest = null;
|
|
10157
10210
|
const write = (snapshot, stopping = false) => {
|
|
10158
|
-
(0,
|
|
10211
|
+
(0, import_node_fs12.mkdirSync)(root, { recursive: true, mode: 448 });
|
|
10159
10212
|
assertPrivateDirectory(root);
|
|
10160
10213
|
if (snapshot.source.id !== source) throw new Error("Runtime status owner mismatch");
|
|
10161
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 })) };
|
|
10162
10215
|
const temporary = `${file}.${(0, import_node_crypto7.randomUUID)()}.tmp`;
|
|
10163
10216
|
try {
|
|
10164
|
-
(0,
|
|
10165
|
-
(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);
|
|
10166
10219
|
} finally {
|
|
10167
|
-
(0,
|
|
10220
|
+
(0, import_node_fs12.rmSync)(temporary, { force: true });
|
|
10168
10221
|
}
|
|
10169
10222
|
};
|
|
10170
10223
|
const publish = () => {
|
|
@@ -10223,13 +10276,13 @@ function startLocalServiceProcessReporter(source, label, health) {
|
|
|
10223
10276
|
function readLocalRuntimeStatusReport(source) {
|
|
10224
10277
|
const root = directory();
|
|
10225
10278
|
const file = import_node_path15.default.join(root, `${source}.json`);
|
|
10226
|
-
if (!(0,
|
|
10279
|
+
if (!(0, import_node_fs12.existsSync)(file)) return null;
|
|
10227
10280
|
assertPrivateDirectory(root);
|
|
10228
10281
|
const value = JSON.parse(readPrivateFile(file, 256 * 1024));
|
|
10229
10282
|
if (value.instanceId !== configuration().context.instanceId) throw new Error("Local runtime status instance mismatch");
|
|
10230
10283
|
const report = validateLocalRuntimeStatusReport(value.report, source);
|
|
10231
10284
|
if (value.stopped === true && report.items.some((item) => item.state !== "disabled")) throw new Error("Invalid stopped owner report");
|
|
10232
|
-
return { report, receivedAt: (0,
|
|
10285
|
+
return { report, receivedAt: (0, import_node_fs12.statSync)(file).mtimeMs, stopped: value.stopped === true };
|
|
10233
10286
|
}
|
|
10234
10287
|
function readInstalledRuntimeBuild(entry) {
|
|
10235
10288
|
if (!entry || !import_node_path15.default.isAbsolute(entry)) return null;
|
|
@@ -10241,34 +10294,34 @@ function readInstalledRuntimeBuild(entry) {
|
|
|
10241
10294
|
const root = entry.slice(0, index);
|
|
10242
10295
|
const relative = entry.slice(index + marker.length).split(import_node_path15.default.sep).slice(1);
|
|
10243
10296
|
const pointer = import_node_path15.default.join(root, "current.json");
|
|
10244
|
-
if ((0,
|
|
10245
|
-
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"));
|
|
10246
10299
|
if (!/^[a-zA-Z0-9._-]+$/.test(selected.releaseId) || [".", ".."].includes(selected.releaseId)) return null;
|
|
10247
10300
|
entry = import_node_path15.default.join(root, "releases", selected.releaseId, ...relative);
|
|
10248
10301
|
}
|
|
10249
10302
|
}
|
|
10250
|
-
fd = (0,
|
|
10303
|
+
fd = (0, import_node_fs12.openSync)(entry, "r");
|
|
10251
10304
|
const buffer = Buffer.alloc(8192);
|
|
10252
|
-
const length = (0,
|
|
10305
|
+
const length = (0, import_node_fs12.readSync)(fd, buffer, 0, buffer.length, 0);
|
|
10253
10306
|
const match = buffer.subarray(0, length).toString("utf8").split("\n", 1)[0]?.match(/var __RUNWEAVE_BUILD_INFO__=(\{.*\});/);
|
|
10254
10307
|
const metadata = import_node_path15.default.join(import_node_path15.default.dirname(entry), "release.json");
|
|
10255
|
-
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"));
|
|
10256
10309
|
return typeof value.version === "string" && typeof value.buildId === "string" ? value : null;
|
|
10257
10310
|
} catch {
|
|
10258
10311
|
return null;
|
|
10259
10312
|
} finally {
|
|
10260
|
-
if (fd !== void 0) (0,
|
|
10313
|
+
if (fd !== void 0) (0, import_node_fs12.closeSync)(fd);
|
|
10261
10314
|
}
|
|
10262
10315
|
}
|
|
10263
10316
|
|
|
10264
10317
|
// scripts/lib/backend-health-auth.mjs
|
|
10265
10318
|
var import_node_net = require("node:net");
|
|
10266
|
-
var
|
|
10319
|
+
var import_node_fs13 = require("node:fs");
|
|
10267
10320
|
var import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
10268
10321
|
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
10269
|
-
var
|
|
10322
|
+
var import_node_child_process4 = require("node:child_process");
|
|
10270
10323
|
var import_node_util = require("node:util");
|
|
10271
|
-
var execFileAsync = (0, import_node_util.promisify)(
|
|
10324
|
+
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process4.execFile);
|
|
10272
10325
|
var FILE_NAME = "backend-health-binding.json";
|
|
10273
10326
|
async function readBackendHealthAuth(profileDir) {
|
|
10274
10327
|
let handle;
|
|
@@ -10278,7 +10331,7 @@ async function readBackendHealthAuth(profileDir) {
|
|
|
10278
10331
|
throw new Error("invalid Backend health profile directory");
|
|
10279
10332
|
handle = await import_promises4.default.open(
|
|
10280
10333
|
import_node_path16.default.join(profileDir, FILE_NAME),
|
|
10281
|
-
|
|
10334
|
+
import_node_fs13.constants.O_RDONLY | import_node_fs13.constants.O_NOFOLLOW
|
|
10282
10335
|
);
|
|
10283
10336
|
const stat = await handle.stat();
|
|
10284
10337
|
if (!stat.isFile() || stat.size > 16384 || (stat.mode & 63) !== 0 || stat.uid !== process.getuid?.()) {
|
|
@@ -10331,7 +10384,7 @@ async function readHealthProfileLock(profileDir) {
|
|
|
10331
10384
|
try {
|
|
10332
10385
|
handle = await import_promises4.default.open(
|
|
10333
10386
|
import_node_path16.default.join(profileDir, "backend.lock.json"),
|
|
10334
|
-
|
|
10387
|
+
import_node_fs13.constants.O_RDONLY | import_node_fs13.constants.O_NOFOLLOW
|
|
10335
10388
|
);
|
|
10336
10389
|
const stat = await handle.stat();
|
|
10337
10390
|
if (!stat.isFile() || (stat.mode & 63) !== 0 || stat.uid !== process.getuid?.() || stat.size > 65536) {
|
|
@@ -10492,7 +10545,7 @@ function isCanonicalLoopbackEndpoint(endpoint) {
|
|
|
10492
10545
|
}
|
|
10493
10546
|
|
|
10494
10547
|
// scripts/dev-session/services/runtime.mjs
|
|
10495
|
-
var execFileAsync2 = (0, import_node_util2.promisify)(
|
|
10548
|
+
var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process5.execFile);
|
|
10496
10549
|
function isProcessLive2(pid) {
|
|
10497
10550
|
try {
|
|
10498
10551
|
process.kill(pid, 0);
|
|
@@ -10503,7 +10556,7 @@ function isProcessLive2(pid) {
|
|
|
10503
10556
|
}
|
|
10504
10557
|
function readProcessSignature2(pid) {
|
|
10505
10558
|
try {
|
|
10506
|
-
return (0,
|
|
10559
|
+
return (0, import_node_child_process5.execFileSync)(
|
|
10507
10560
|
"ps",
|
|
10508
10561
|
["-p", String(pid), "-o", "lstart=", "-o", "command="],
|
|
10509
10562
|
{
|
|
@@ -10757,14 +10810,14 @@ async function reconcileBetaSessionServices(services) {
|
|
|
10757
10810
|
}
|
|
10758
10811
|
|
|
10759
10812
|
// scripts/dev-session/services/process-stop.mjs
|
|
10760
|
-
var
|
|
10813
|
+
var import_node_child_process6 = require("node:child_process");
|
|
10761
10814
|
var GRACE_MS = 5e3;
|
|
10762
10815
|
var FORCE_WAIT_MS = 2e3;
|
|
10763
10816
|
var POLL_MS = 100;
|
|
10764
10817
|
function readProcessGroupSnapshot() {
|
|
10765
10818
|
let output;
|
|
10766
10819
|
try {
|
|
10767
|
-
output = (0,
|
|
10820
|
+
output = (0, import_node_child_process6.execFileSync)("ps", ["-axo", "pid=,pgid=,stat="], {
|
|
10768
10821
|
encoding: "utf8",
|
|
10769
10822
|
timeout: 2e3
|
|
10770
10823
|
});
|
|
@@ -10849,12 +10902,12 @@ async function stopOwnedProcess(processInfo) {
|
|
|
10849
10902
|
}
|
|
10850
10903
|
|
|
10851
10904
|
// scripts/dev-session/services/beta.mjs
|
|
10852
|
-
var
|
|
10905
|
+
var import_node_child_process7 = require("node:child_process");
|
|
10853
10906
|
var import_node_util3 = require("node:util");
|
|
10854
|
-
var execFileAsync3 = (0, import_node_util3.promisify)(
|
|
10907
|
+
var execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process7.execFile);
|
|
10855
10908
|
|
|
10856
10909
|
// scripts/dev-session/services/index.mjs
|
|
10857
|
-
var execFileAsync4 = (0, import_node_util4.promisify)(
|
|
10910
|
+
var execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process8.execFile);
|
|
10858
10911
|
async function assertSessionServicesStoppable(services) {
|
|
10859
10912
|
const inspection = await inspectSessionServices(services);
|
|
10860
10913
|
const staleOwnedServices = [
|
|
@@ -11026,7 +11079,7 @@ var import_node_path23 = __toESM(require("node:path"), 1);
|
|
|
11026
11079
|
|
|
11027
11080
|
// scripts/dev-session/beta-pool/storage/files.mjs
|
|
11028
11081
|
var import_node_crypto8 = require("node:crypto");
|
|
11029
|
-
var
|
|
11082
|
+
var import_node_fs14 = require("node:fs");
|
|
11030
11083
|
var import_promises6 = __toESM(require("node:fs/promises"), 1);
|
|
11031
11084
|
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
11032
11085
|
function sameFileIdentity2(left, right) {
|
|
@@ -11074,7 +11127,7 @@ async function readRegularJson(filePath, allowedRoot) {
|
|
|
11074
11127
|
try {
|
|
11075
11128
|
handle = await import_promises6.default.open(
|
|
11076
11129
|
filePath,
|
|
11077
|
-
|
|
11130
|
+
import_node_fs14.constants.O_RDONLY | import_node_fs14.constants.O_NOFOLLOW
|
|
11078
11131
|
);
|
|
11079
11132
|
const before = await handle.stat();
|
|
11080
11133
|
if (!before.isFile()) {
|
|
@@ -11099,7 +11152,7 @@ async function atomicWriteJson2(filePath, value, allowedRoot) {
|
|
|
11099
11152
|
);
|
|
11100
11153
|
const handle = await import_promises6.default.open(
|
|
11101
11154
|
temporaryPath,
|
|
11102
|
-
|
|
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,
|
|
11103
11156
|
384
|
|
11104
11157
|
);
|
|
11105
11158
|
try {
|
|
@@ -11290,12 +11343,12 @@ async function releaseBetaSlotRecoveryClaim(recoveryClaim, paths) {
|
|
|
11290
11343
|
}
|
|
11291
11344
|
|
|
11292
11345
|
// scripts/dev-session/beta-pool/storage/paths.mjs
|
|
11293
|
-
var
|
|
11346
|
+
var import_node_fs15 = require("node:fs");
|
|
11294
11347
|
var import_node_os10 = __toESM(require("node:os"), 1);
|
|
11295
11348
|
var import_node_path21 = __toESM(require("node:path"), 1);
|
|
11296
11349
|
function isDirectory(filePath) {
|
|
11297
11350
|
try {
|
|
11298
|
-
return (0,
|
|
11351
|
+
return (0, import_node_fs15.lstatSync)(filePath).isDirectory();
|
|
11299
11352
|
} catch {
|
|
11300
11353
|
return false;
|
|
11301
11354
|
}
|
|
@@ -12100,7 +12153,7 @@ async function resolveBetaSlotRetentionTargets(homeDir, slotId) {
|
|
|
12100
12153
|
|
|
12101
12154
|
// scripts/dev-session/beta-pool/storage/index.mjs
|
|
12102
12155
|
var import_node_crypto10 = require("node:crypto");
|
|
12103
|
-
var
|
|
12156
|
+
var import_node_child_process9 = require("node:child_process");
|
|
12104
12157
|
var import_promises11 = __toESM(require("node:fs/promises"), 1);
|
|
12105
12158
|
var import_node_os15 = __toESM(require("node:os"), 1);
|
|
12106
12159
|
var import_node_path27 = __toESM(require("node:path"), 1);
|
|
@@ -12190,7 +12243,7 @@ async function recordBetaSlotRecoveryAttempt({
|
|
|
12190
12243
|
}
|
|
12191
12244
|
|
|
12192
12245
|
// scripts/dev-session/beta-pool/storage/index.mjs
|
|
12193
|
-
var execFileAsync5 = (0, import_node_util5.promisify)(
|
|
12246
|
+
var execFileAsync5 = (0, import_node_util5.promisify)(import_node_child_process9.execFile);
|
|
12194
12247
|
var MAX_UPDATE_LOGS = 5;
|
|
12195
12248
|
var MAX_UPDATE_LOG_BYTES = 64 * 1024 * 1024;
|
|
12196
12249
|
var MIN_PLANNED_WRITE_BYTES = 512 * 1024 * 1024;
|
|
@@ -12616,7 +12669,7 @@ async function readManifestObservation(lease) {
|
|
|
12616
12669
|
try {
|
|
12617
12670
|
handle = await import_promises12.default.open(
|
|
12618
12671
|
lease.ownerManifestPath,
|
|
12619
|
-
|
|
12672
|
+
import_node_fs16.constants.O_RDONLY | import_node_fs16.constants.O_NOFOLLOW
|
|
12620
12673
|
);
|
|
12621
12674
|
const opened = await handle.stat();
|
|
12622
12675
|
if (!opened.isFile()) {
|
|
@@ -13092,7 +13145,7 @@ function assertExpectedVersion(actual, expected) {
|
|
|
13092
13145
|
}
|
|
13093
13146
|
|
|
13094
13147
|
// scripts/dev-resources/snapshot.mjs
|
|
13095
|
-
var exec = (0, import_node_util6.promisify)(
|
|
13148
|
+
var exec = (0, import_node_util6.promisify)(import_node_child_process10.execFile);
|
|
13096
13149
|
var pythonEntry = (0, import_node_url.fileURLToPath)(
|
|
13097
13150
|
new URL("../ios-simulators/monitor.py", __IMPORT_META_URL__)
|
|
13098
13151
|
);
|
|
@@ -13382,7 +13435,7 @@ async function inspectResources({ generation, backendPid }) {
|
|
|
13382
13435
|
}
|
|
13383
13436
|
|
|
13384
13437
|
// scripts/dev-resources/operations.mjs
|
|
13385
|
-
var
|
|
13438
|
+
var import_node_child_process12 = require("node:child_process");
|
|
13386
13439
|
var import_node_os21 = __toESM(require("node:os"), 1);
|
|
13387
13440
|
|
|
13388
13441
|
// scripts/dev-session/services/beta-start-recovery.mjs
|
|
@@ -13658,12 +13711,12 @@ async function finalizeBetaSlotRelease(options) {
|
|
|
13658
13711
|
|
|
13659
13712
|
// scripts/dev-session/beta-pool/recovery/index.mjs
|
|
13660
13713
|
var import_node_crypto13 = require("node:crypto");
|
|
13661
|
-
var
|
|
13714
|
+
var import_node_child_process11 = require("node:child_process");
|
|
13662
13715
|
var import_promises14 = __toESM(require("node:fs/promises"), 1);
|
|
13663
13716
|
var import_node_os19 = __toESM(require("node:os"), 1);
|
|
13664
13717
|
var import_node_path31 = __toESM(require("node:path"), 1);
|
|
13665
13718
|
var import_node_util7 = require("node:util");
|
|
13666
|
-
var execFileAsync6 = (0, import_node_util7.promisify)(
|
|
13719
|
+
var execFileAsync6 = (0, import_node_util7.promisify)(import_node_child_process11.execFile);
|
|
13667
13720
|
function sleep(milliseconds) {
|
|
13668
13721
|
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
13669
13722
|
}
|
|
@@ -14134,7 +14187,7 @@ async function recoverBetaPoolSlot({
|
|
|
14134
14187
|
}
|
|
14135
14188
|
|
|
14136
14189
|
// scripts/beta/operations.mjs
|
|
14137
|
-
var
|
|
14190
|
+
var import_node_fs17 = require("node:fs");
|
|
14138
14191
|
var import_promises15 = __toESM(require("node:fs/promises"), 1);
|
|
14139
14192
|
var import_node_path32 = __toESM(require("node:path"), 1);
|
|
14140
14193
|
async function withBetaLock(paths, operation) {
|
|
@@ -14266,7 +14319,7 @@ async function quitBeta(paths) {
|
|
|
14266
14319
|
}
|
|
14267
14320
|
async function runAppServerCli(paths, command, sourceRevision = null) {
|
|
14268
14321
|
const cliEntry = paths.controlCliPath;
|
|
14269
|
-
if (!(0,
|
|
14322
|
+
if (!(0, import_node_fs17.existsSync)(cliEntry)) {
|
|
14270
14323
|
return { ok: false, code: 1, stderr: `missing CLI build: ${cliEntry}` };
|
|
14271
14324
|
}
|
|
14272
14325
|
return await runCapture(
|
|
@@ -14741,7 +14794,7 @@ async function releaseSimulator(request, context) {
|
|
|
14741
14794
|
if (resource.release.action !== request.action)
|
|
14742
14795
|
conflict("\u6E05\u7406\u6761\u4EF6\u5DF2\u53D8\u5316\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u65B0\u786E\u8BA4");
|
|
14743
14796
|
return await new Promise((resolve, reject) => {
|
|
14744
|
-
const child = (0,
|
|
14797
|
+
const child = (0, import_node_child_process12.spawn)("python3", ["-B", pythonEntry, "release"], {
|
|
14745
14798
|
stdio: ["pipe", "pipe", "ignore"]
|
|
14746
14799
|
});
|
|
14747
14800
|
let stdout = "";
|