@runweave/server-linux-x64 0.1.4 → 0.1.6
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 +155 -155
- 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 +2936 -1988
- package/payload/bin/runtime.cjs +22 -5
- package/payload/frontend/dist/assets/{_baseUniq-2DZJ97aQ.js → _baseUniq-i1Ki3twP.js} +1 -1
- package/payload/frontend/dist/assets/{access-Jw5gZrYY.js → access-DK9V0f3W.js} +1 -1
- package/payload/frontend/dist/assets/{advanced-DRe-Doxo.js → advanced-B13lWv1d.js} +1 -1
- package/payload/frontend/dist/assets/{appearance-D1wpkdXT.js → appearance-DumRYmkD.js} +1 -1
- package/payload/frontend/dist/assets/{arc-keTQ5uhA.js → arc-HKn3_xyV.js} +1 -1
- package/payload/frontend/dist/assets/{architectureDiagram-Q4EWVU46-BXbCJ77m.js → architectureDiagram-Q4EWVU46-C09x7b94.js} +1 -1
- package/payload/frontend/dist/assets/{blockDiagram-DXYQGD6D-De0Ki8tO.js → blockDiagram-DXYQGD6D-CFLFTR6d.js} +1 -1
- package/payload/frontend/dist/assets/{c4Diagram-AHTNJAMY-EfazoSVi.js → c4Diagram-AHTNJAMY-8P8Q-xqC.js} +1 -1
- package/payload/frontend/dist/assets/channel-CuSisha8.js +1 -0
- package/payload/frontend/dist/assets/{chunk-4BX2VUAB-BXCGPL07.js → chunk-4BX2VUAB-B1KEkTal.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-4TB4RGXK-ByjQ1_yc.js → chunk-4TB4RGXK-Bu_Z47kJ.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-55IACEB6-D-KjMbGJ.js → chunk-55IACEB6-xzHVCHyi.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-EDXVE4YY-tAgLMZ4w.js → chunk-EDXVE4YY-h3HAW06h.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-FMBD7UC4-D3J3ERtV.js → chunk-FMBD7UC4-CQ4faPSh.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-OYMX7WX6-DZHtmvkW.js → chunk-OYMX7WX6-CubmLoGT.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-QZHKN3VN-D6IIGd1d.js → chunk-QZHKN3VN-xk0zKNja.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-YZCP3GAM-KD19-lMa.js → chunk-YZCP3GAM-CHpTv8sd.js} +1 -1
- package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-ClJkT7PY.js +1 -0
- package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-ClJkT7PY.js +1 -0
- package/payload/frontend/dist/assets/clone-CPcyXi9g.js +1 -0
- package/payload/frontend/dist/assets/{connection-Cm6G1HOW.js → connection-BhcgnOMb.js} +1 -1
- package/payload/frontend/dist/assets/{connections-B8tSRWt9.js → connections-A7InZw2T.js} +1 -1
- package/payload/frontend/dist/assets/{cose-bilkent-S5V4N54A-AYXbL8jP.js → cose-bilkent-S5V4N54A-CQn27vi_.js} +1 -1
- package/payload/frontend/dist/assets/{dagre-KV5264BT-DCunJ-sG.js → dagre-KV5264BT-CClOwB9v.js} +1 -1
- package/payload/frontend/dist/assets/{desktop-DnY652OH.js → desktop-BgryfXXM.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-5BDNPKRD-Ch2b63ll.js → diagram-5BDNPKRD-DcUJOAmV.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-G4DWMVQ6-BAuc_Uar.js → diagram-G4DWMVQ6-DdabmTwk.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-MMDJMWI5-DH8qMuDA.js → diagram-MMDJMWI5-DmcxjBIk.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-TYMM5635-BflD7Kjb.js → diagram-TYMM5635-BUSpXaiN.js} +1 -1
- package/payload/frontend/dist/assets/{erDiagram-SMLLAGMA-BGzvzTP9.js → erDiagram-SMLLAGMA-vkAXcv5_.js} +1 -1
- package/payload/frontend/dist/assets/{flowDiagram-DWJPFMVM-BR4mXArp.js → flowDiagram-DWJPFMVM-BHDU7BUJ.js} +1 -1
- package/payload/frontend/dist/assets/{ganttDiagram-T4ZO3ILL-uXtJoz5O.js → ganttDiagram-T4ZO3ILL-C3lAG7_6.js} +1 -1
- package/payload/frontend/dist/assets/{gitGraphDiagram-UUTBAWPF-BeLB68OO.js → gitGraphDiagram-UUTBAWPF-DHLyYJf7.js} +1 -1
- package/payload/frontend/dist/assets/{graph-DakNuFNs.js → graph-Bp5bIzXM.js} +1 -1
- package/payload/frontend/dist/assets/{image-BICNaNq8.js → image-DkcKNLTV.js} +1 -1
- package/payload/frontend/dist/assets/index-BUS7FSlk.js +458 -0
- package/payload/frontend/dist/assets/{infoDiagram-42DDH7IO-CAGn0b04.js → infoDiagram-42DDH7IO-CVp9zvmA.js} +1 -1
- package/payload/frontend/dist/assets/{ishikawaDiagram-UXIWVN3A-fbaDUCpd.js → ishikawaDiagram-UXIWVN3A-D07QPX3O.js} +1 -1
- package/payload/frontend/dist/assets/{journeyDiagram-VCZTEJTY-ZOmjleqG.js → journeyDiagram-VCZTEJTY-D-iZPDHM.js} +1 -1
- package/payload/frontend/dist/assets/{kanban-definition-6JOO6SKY-BmODq4tv.js → kanban-definition-6JOO6SKY-BR4eWb08.js} +1 -1
- package/payload/frontend/dist/assets/{layout-CLfuo3Vs.js → layout-Cyv0DyJm.js} +1 -1
- package/payload/frontend/dist/assets/{linear-csTsZ7Al.js → linear-D5M7Pvj1.js} +1 -1
- package/payload/frontend/dist/assets/{main-DwDuhfcr.js → main-BDBhLSX2.js} +151 -151
- package/payload/frontend/dist/assets/main-Cg6Oo1xK.css +33 -0
- package/payload/frontend/dist/assets/{min-B4B7Rr4j.js → min-BFlloFGg.js} +1 -1
- package/payload/frontend/dist/assets/{mindmap-definition-QFDTVHPH-CiV2UasH.js → mindmap-definition-QFDTVHPH-AKUF178o.js} +1 -1
- package/payload/frontend/dist/assets/{monitoring-1_Fnxura.js → monitoring-B2okceCB.js} +1 -1
- package/payload/frontend/dist/assets/{notifications-VJaMbzoX.js → notifications-0lql4_qJ.js} +1 -1
- package/payload/frontend/dist/assets/{pieDiagram-DEJITSTG-DwazVxKI.js → pieDiagram-DEJITSTG-CRiHmwn7.js} +1 -1
- package/payload/frontend/dist/assets/{quadrantDiagram-34T5L4WZ-CAn9HHbO.js → quadrantDiagram-34T5L4WZ-CzXrq7IJ.js} +1 -1
- package/payload/frontend/dist/assets/{record-content-Bewq09_f.js → record-content-DTCQKbEj.js} +1 -1
- package/payload/frontend/dist/assets/{requirementDiagram-MS252O5E-CFot9peV.js → requirementDiagram-MS252O5E-Bbn5ulLV.js} +1 -1
- package/payload/frontend/dist/assets/{sankeyDiagram-XADWPNL6-CdRX6WuA.js → sankeyDiagram-XADWPNL6-D9ZZ46pQ.js} +1 -1
- package/payload/frontend/dist/assets/{sequenceDiagram-FGHM5R23-vRc1a5W1.js → sequenceDiagram-FGHM5R23-DxOP2gDa.js} +1 -1
- package/payload/frontend/dist/assets/{stateDiagram-FHFEXIEX-Bxcr7s70.js → stateDiagram-FHFEXIEX-NF_Qq5Cq.js} +1 -1
- package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-DhdOfEAv.js +1 -0
- package/payload/frontend/dist/assets/{status-9tZZeoV7.js → status-2U71YpVe.js} +1 -1
- package/payload/frontend/dist/assets/suiji-DXtfgwxj.js +1 -0
- package/payload/frontend/dist/assets/{svg-qpyWsADE.js → svg-DpI3GSCw.js} +1 -1
- package/payload/frontend/dist/assets/{tabs-CwPtRQY0.js → tabs-CYKuiiHg.js} +1 -1
- package/payload/frontend/dist/assets/{timeline-definition-GMOUNBTQ-2mD2ePS6.js → timeline-definition-GMOUNBTQ-ChEZSNF_.js} +1 -1
- package/payload/frontend/dist/assets/{vennDiagram-DHZGUBPP-w4DbLykx.js → vennDiagram-DHZGUBPP-Ch26SNbB.js} +1 -1
- package/payload/frontend/dist/assets/{wardley-RL74JXVD-C3H8SQaZ.js → wardley-RL74JXVD-D0ap5vv0.js} +1 -1
- package/payload/frontend/dist/assets/{wardleyDiagram-NUSXRM2D-DEI0kC2c.js → wardleyDiagram-NUSXRM2D-btdjsmHO.js} +1 -1
- package/payload/frontend/dist/assets/{xychartDiagram-5P7HB3ND-DDVlpQ28.js → xychartDiagram-5P7HB3ND-CklPtFGT.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 +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/index-Cf9Vl4GJ.js +0 -458
- package/payload/frontend/dist/assets/main-DtzgJZEf.css +0 -33
- package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-YGvbZNwL.js +0 -1
- package/payload/frontend/dist/assets/suiji-DX2ioZ0I.js +0 -1
package/payload/server/index.cjs
CHANGED
|
@@ -7347,21 +7347,57 @@ var ConfigurationError = class extends Error {
|
|
|
7347
7347
|
|
|
7348
7348
|
// packages/config-node/src/private-file.ts
|
|
7349
7349
|
var import_node_fs = require("node:fs");
|
|
7350
|
+
|
|
7351
|
+
// packages/config-node/src/windows-permissions.ts
|
|
7352
|
+
var import_node_child_process = require("node:child_process");
|
|
7353
|
+
function assertWindowsPrivatePath(file) {
|
|
7354
|
+
if (process.platform !== "win32") return;
|
|
7355
|
+
const script = `
|
|
7356
|
+
$ErrorActionPreference = 'Stop'
|
|
7357
|
+
# Use .NET directly: a parent pwsh may export a PSModulePath incompatible with Windows PowerShell.
|
|
7358
|
+
$acl = if ([IO.Directory]::Exists($env:RUNWEAVE_PRIVATE_PATH)) {
|
|
7359
|
+
[IO.Directory]::GetAccessControl($env:RUNWEAVE_PRIVATE_PATH)
|
|
7360
|
+
} else { [IO.File]::GetAccessControl($env:RUNWEAVE_PRIVATE_PATH) }
|
|
7361
|
+
$sid = [Security.Principal.WindowsIdentity]::GetCurrent().User
|
|
7362
|
+
$allowed = @($sid.Value, 'S-1-5-18', 'S-1-5-32-544')
|
|
7363
|
+
if ($acl.GetOwner([Security.Principal.SecurityIdentifier]).Value -notin $allowed) { throw 'owner' }
|
|
7364
|
+
foreach ($rule in $acl.GetAccessRules($true, $true, [Security.Principal.SecurityIdentifier])) {
|
|
7365
|
+
if ($rule.AccessControlType -eq 'Allow' -and $rule.IdentityReference.Value -notin $allowed) { throw 'access' }
|
|
7366
|
+
}
|
|
7367
|
+
`;
|
|
7368
|
+
try {
|
|
7369
|
+
(0, import_node_child_process.execFileSync)("powershell.exe", ["-NoProfile", "-NonInteractive", "-EncodedCommand", Buffer.from(script, "utf16le").toString("base64")], {
|
|
7370
|
+
env: { ...process.env, RUNWEAVE_PRIVATE_PATH: file },
|
|
7371
|
+
stdio: "ignore",
|
|
7372
|
+
timeout: 1e4,
|
|
7373
|
+
windowsHide: true
|
|
7374
|
+
});
|
|
7375
|
+
} catch {
|
|
7376
|
+
throw new ConfigurationError("CONFIG_WINDOWS_ACL_NOT_PRIVATE", [file]);
|
|
7377
|
+
}
|
|
7378
|
+
}
|
|
7379
|
+
|
|
7380
|
+
// packages/config-node/src/private-file.ts
|
|
7350
7381
|
function assertPrivateDirectory(directory) {
|
|
7351
7382
|
const stat = (0, import_node_fs.lstatSync)(directory);
|
|
7352
|
-
if (!stat.isDirectory() || stat.isSymbolicLink() || stat.mode & 63 || typeof process.getuid === "function" && stat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_ROOT_PERMISSIONS_INVALID");
|
|
7383
|
+
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");
|
|
7384
|
+
assertWindowsPrivatePath(directory);
|
|
7353
7385
|
}
|
|
7354
|
-
function assertPrivateDescriptor(fd, maxBytes = 1024 * 1024) {
|
|
7386
|
+
function assertPrivateDescriptor(fd, maxBytes = 1024 * 1024, file) {
|
|
7355
7387
|
const stat = (0, import_node_fs.fstatSync)(fd);
|
|
7356
7388
|
if (!stat.isFile() || stat.nlink !== 1) throw new ConfigurationError("CONFIG_FILE_NOT_PRIVATE_REGULAR");
|
|
7357
7389
|
if (typeof process.getuid === "function" && stat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_FILE_OWNER_MISMATCH");
|
|
7358
|
-
if (stat.mode & 63) throw new ConfigurationError("CONFIG_FILE_PERMISSIONS_INVALID");
|
|
7390
|
+
if (process.platform !== "win32" && stat.mode & 63) throw new ConfigurationError("CONFIG_FILE_PERMISSIONS_INVALID");
|
|
7391
|
+
if (process.platform === "win32") {
|
|
7392
|
+
if (!file) throw new ConfigurationError("CONFIG_PRIVATE_PATH_REQUIRED");
|
|
7393
|
+
assertWindowsPrivatePath(file);
|
|
7394
|
+
}
|
|
7359
7395
|
if (stat.size > maxBytes) throw new ConfigurationError("CONFIG_FILE_TOO_LARGE");
|
|
7360
7396
|
}
|
|
7361
7397
|
function readPrivateFile(file, maxBytes = 1024 * 1024) {
|
|
7362
7398
|
const fd = (0, import_node_fs.openSync)(file, import_node_fs.constants.O_RDONLY | import_node_fs.constants.O_NOFOLLOW);
|
|
7363
7399
|
try {
|
|
7364
|
-
assertPrivateDescriptor(fd, maxBytes);
|
|
7400
|
+
assertPrivateDescriptor(fd, maxBytes, file);
|
|
7365
7401
|
const source = (0, import_node_fs.readFileSync)(fd, "utf8");
|
|
7366
7402
|
if (Buffer.byteLength(source) > maxBytes) throw new ConfigurationError("CONFIG_FILE_TOO_LARGE");
|
|
7367
7403
|
return source;
|
|
@@ -7439,15 +7475,40 @@ function assertOwnedPath(context, value) {
|
|
|
7439
7475
|
}
|
|
7440
7476
|
}
|
|
7441
7477
|
|
|
7442
|
-
// packages/config-node/src/
|
|
7478
|
+
// packages/config-node/src/platform.ts
|
|
7479
|
+
var import_node_child_process2 = require("node:child_process");
|
|
7443
7480
|
var import_node_fs3 = require("node:fs");
|
|
7481
|
+
function processStartIdentity(pid) {
|
|
7482
|
+
if (!Number.isSafeInteger(pid) || pid < 1) return null;
|
|
7483
|
+
try {
|
|
7484
|
+
return (0, import_node_child_process2.execFileSync)(
|
|
7485
|
+
process.platform === "win32" ? "powershell.exe" : "ps",
|
|
7486
|
+
process.platform === "win32" ? ["-NoProfile", "-NonInteractive", "-Command", `[Diagnostics.Process]::GetProcessById(${pid}).StartTime.ToUniversalTime().Ticks`] : ["-p", String(pid), "-o", "lstart="],
|
|
7487
|
+
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5e3, windowsHide: true }
|
|
7488
|
+
).trim() || null;
|
|
7489
|
+
} catch {
|
|
7490
|
+
return null;
|
|
7491
|
+
}
|
|
7492
|
+
}
|
|
7493
|
+
function syncDirectory(directory) {
|
|
7494
|
+
if (process.platform === "win32") return;
|
|
7495
|
+
const fd = (0, import_node_fs3.openSync)(directory, "r");
|
|
7496
|
+
try {
|
|
7497
|
+
(0, import_node_fs3.fsyncSync)(fd);
|
|
7498
|
+
} finally {
|
|
7499
|
+
(0, import_node_fs3.closeSync)(fd);
|
|
7500
|
+
}
|
|
7501
|
+
}
|
|
7502
|
+
|
|
7503
|
+
// packages/config-node/src/owner.ts
|
|
7504
|
+
var import_node_fs4 = require("node:fs");
|
|
7444
7505
|
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
7445
7506
|
var import_node_os2 = __toESM(require("node:os"), 1);
|
|
7446
7507
|
var import_node_crypto = require("node:crypto");
|
|
7447
7508
|
var import_fs_native_extensions = require("fs-native-extensions");
|
|
7448
7509
|
function ownerDirectory(context) {
|
|
7449
7510
|
const directory = context.kind === "stable" ? import_node_path2.default.join(import_node_os2.default.userInfo().homedir, ".runweave", "runtime") : import_node_path2.default.join(context.configRoot, "runtime");
|
|
7450
|
-
(0,
|
|
7511
|
+
(0, import_node_fs4.mkdirSync)(directory, { recursive: true, mode: 448 });
|
|
7451
7512
|
assertPrivateDirectory(import_node_path2.default.dirname(directory));
|
|
7452
7513
|
assertPrivateDirectory(directory);
|
|
7453
7514
|
return directory;
|
|
@@ -7456,11 +7517,11 @@ function registerStableConfigurationRoot(context) {
|
|
|
7456
7517
|
if (context.kind !== "stable") return;
|
|
7457
7518
|
const directory = ownerDirectory(context);
|
|
7458
7519
|
const registry = import_node_path2.default.join(directory, "stable-root.json");
|
|
7459
|
-
const registryFd = (0,
|
|
7520
|
+
const registryFd = (0, import_node_fs4.openSync)(import_node_path2.default.join(directory, "stable-root.lock"), import_node_fs4.constants.O_CREAT | import_node_fs4.constants.O_RDWR | import_node_fs4.constants.O_NOFOLLOW, 384);
|
|
7460
7521
|
try {
|
|
7461
|
-
assertPrivateDescriptor(registryFd);
|
|
7522
|
+
assertPrivateDescriptor(registryFd, void 0, import_node_path2.default.join(directory, "stable-root.lock"));
|
|
7462
7523
|
if (!(0, import_fs_native_extensions.tryLock)(registryFd)) throw new ConfigurationError("CONFIG_ROOT_REGISTRATION_BUSY");
|
|
7463
|
-
if ((0,
|
|
7524
|
+
if ((0, import_node_fs4.existsSync)(registry)) {
|
|
7464
7525
|
let stored;
|
|
7465
7526
|
try {
|
|
7466
7527
|
stored = JSON.parse(readPrivateFile(registry));
|
|
@@ -7470,34 +7531,29 @@ function registerStableConfigurationRoot(context) {
|
|
|
7470
7531
|
if (!stored || typeof stored !== "object" || !("root" in stored) || stored.root !== canonicalPath(context.configRoot)) throw new ConfigurationError("CONFIG_STABLE_ROOT_CONFLICT");
|
|
7471
7532
|
} else {
|
|
7472
7533
|
const temporary = `${registry}.${(0, import_node_crypto.randomUUID)()}.tmp`;
|
|
7473
|
-
const file = (0,
|
|
7474
|
-
try {
|
|
7475
|
-
(0, import_node_fs3.writeFileSync)(file, JSON.stringify({ root: canonicalPath(context.configRoot) }));
|
|
7476
|
-
(0, import_node_fs3.fsyncSync)(file);
|
|
7477
|
-
} finally {
|
|
7478
|
-
(0, import_node_fs3.closeSync)(file);
|
|
7479
|
-
}
|
|
7480
|
-
(0, import_node_fs3.renameSync)(temporary, registry);
|
|
7481
|
-
const parent = (0, import_node_fs3.openSync)(directory, "r");
|
|
7534
|
+
const file = (0, import_node_fs4.openSync)(temporary, "wx", 384);
|
|
7482
7535
|
try {
|
|
7483
|
-
(0,
|
|
7536
|
+
(0, import_node_fs4.writeFileSync)(file, JSON.stringify({ root: canonicalPath(context.configRoot) }));
|
|
7537
|
+
(0, import_node_fs4.fsyncSync)(file);
|
|
7484
7538
|
} finally {
|
|
7485
|
-
(0,
|
|
7539
|
+
(0, import_node_fs4.closeSync)(file);
|
|
7486
7540
|
}
|
|
7541
|
+
(0, import_node_fs4.renameSync)(temporary, registry);
|
|
7542
|
+
syncDirectory(directory);
|
|
7487
7543
|
}
|
|
7488
7544
|
} finally {
|
|
7489
|
-
(0,
|
|
7545
|
+
(0, import_node_fs4.closeSync)(registryFd);
|
|
7490
7546
|
}
|
|
7491
7547
|
}
|
|
7492
7548
|
function withUpgradeGate(context, shared, run) {
|
|
7493
7549
|
const directory = ownerDirectory(context);
|
|
7494
|
-
const fd = (0,
|
|
7550
|
+
const fd = (0, import_node_fs4.openSync)(import_node_path2.default.join(directory, "configuration-upgrade.lock"), import_node_fs4.constants.O_CREAT | import_node_fs4.constants.O_RDWR | import_node_fs4.constants.O_NOFOLLOW, 384);
|
|
7495
7551
|
try {
|
|
7496
|
-
assertPrivateDescriptor(fd);
|
|
7552
|
+
assertPrivateDescriptor(fd, void 0, import_node_path2.default.join(directory, "configuration-upgrade.lock"));
|
|
7497
7553
|
if (!(0, import_fs_native_extensions.tryLock)(fd, 0, 0, { shared })) throw new ConfigurationError("CONFIG_UPGRADE_BUSY");
|
|
7498
7554
|
return run();
|
|
7499
7555
|
} finally {
|
|
7500
|
-
(0,
|
|
7556
|
+
(0, import_node_fs4.closeSync)(fd);
|
|
7501
7557
|
}
|
|
7502
7558
|
}
|
|
7503
7559
|
function withConfigurationUpgradeOwnership(context, run, ignoredRoles = []) {
|
|
@@ -7505,16 +7561,16 @@ function withConfigurationUpgradeOwnership(context, run, ignoredRoles = []) {
|
|
|
7505
7561
|
const directory = ownerDirectory(context);
|
|
7506
7562
|
const held = [];
|
|
7507
7563
|
try {
|
|
7508
|
-
for (const file of (0,
|
|
7564
|
+
for (const file of (0, import_node_fs4.readdirSync)(directory).filter((name) => name.endsWith(".owner.lock"))) {
|
|
7509
7565
|
if (ignoredRoles.includes(file.replace(/\.owner\.lock$/, ""))) continue;
|
|
7510
|
-
const fd = (0,
|
|
7566
|
+
const fd = (0, import_node_fs4.openSync)(import_node_path2.default.join(directory, file), import_node_fs4.constants.O_RDWR | import_node_fs4.constants.O_NOFOLLOW);
|
|
7511
7567
|
held.push(fd);
|
|
7512
|
-
assertPrivateDescriptor(fd);
|
|
7568
|
+
assertPrivateDescriptor(fd, void 0, import_node_path2.default.join(directory, file));
|
|
7513
7569
|
if (!(0, import_fs_native_extensions.tryLock)(fd)) throw new ConfigurationError("CONFIG_UPGRADE_CONSUMER_RUNNING", [file.replace(/\.owner\.lock$/, "")]);
|
|
7514
7570
|
}
|
|
7515
7571
|
return run();
|
|
7516
7572
|
} finally {
|
|
7517
|
-
for (const fd of held) (0,
|
|
7573
|
+
for (const fd of held) (0, import_node_fs4.closeSync)(fd);
|
|
7518
7574
|
}
|
|
7519
7575
|
});
|
|
7520
7576
|
}
|
|
@@ -7832,7 +7888,7 @@ function migrateConfigurationDocument(document) {
|
|
|
7832
7888
|
}
|
|
7833
7889
|
|
|
7834
7890
|
// packages/config-node/src/store.ts
|
|
7835
|
-
var
|
|
7891
|
+
var import_node_fs5 = require("node:fs");
|
|
7836
7892
|
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
7837
7893
|
var import_node_crypto2 = require("node:crypto");
|
|
7838
7894
|
var import_yaml = __toESM(require_dist(), 1);
|
|
@@ -8026,10 +8082,11 @@ function parseConfigurationYaml(source, context) {
|
|
|
8026
8082
|
return { document, value, digest: (0, import_node_crypto2.createHash)("sha256").update(source).digest("hex"), issues: validateDomains(value, context) };
|
|
8027
8083
|
}
|
|
8028
8084
|
function assertPrivateFile(file, fd) {
|
|
8029
|
-
const stat = fd === void 0 ? (0,
|
|
8085
|
+
const stat = fd === void 0 ? (0, import_node_fs5.lstatSync)(file) : (0, import_node_fs5.fstatSync)(fd);
|
|
8030
8086
|
if (!stat.isFile() || stat.isSymbolicLink() || stat.nlink !== 1) throw new ConfigurationError("CONFIG_FILE_NOT_PRIVATE_REGULAR");
|
|
8031
8087
|
if (typeof process.getuid === "function" && stat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_FILE_OWNER_MISMATCH");
|
|
8032
|
-
if ((stat.mode & 63) !== 0) throw new ConfigurationError("CONFIG_FILE_PERMISSIONS_INVALID");
|
|
8088
|
+
if (process.platform !== "win32" && (stat.mode & 63) !== 0) throw new ConfigurationError("CONFIG_FILE_PERMISSIONS_INVALID");
|
|
8089
|
+
assertWindowsPrivatePath(file);
|
|
8033
8090
|
if (stat.size > MAX_BYTES) throw new ConfigurationError("CONFIG_FILE_TOO_LARGE", [], { line: 1, column: 1 });
|
|
8034
8091
|
}
|
|
8035
8092
|
var ConfigurationStore = class {
|
|
@@ -8039,30 +8096,29 @@ var ConfigurationStore = class {
|
|
|
8039
8096
|
}
|
|
8040
8097
|
file;
|
|
8041
8098
|
read() {
|
|
8042
|
-
if (!(0,
|
|
8043
|
-
|
|
8044
|
-
if (!root.isDirectory() || root.isSymbolicLink() || root.mode & 63 || typeof process.getuid === "function" && root.uid !== process.getuid()) throw new ConfigurationError("CONFIG_ROOT_PERMISSIONS_INVALID");
|
|
8099
|
+
if (!(0, import_node_fs5.existsSync)(this.file)) throw new ConfigurationError("CONFIG_MIGRATION_REQUIRED");
|
|
8100
|
+
assertPrivateDirectory(this.context.configRoot);
|
|
8045
8101
|
assertPrivateFile(this.file);
|
|
8046
|
-
const fd = (0,
|
|
8102
|
+
const fd = (0, import_node_fs5.openSync)(this.file, import_node_fs5.constants.O_RDONLY | import_node_fs5.constants.O_NOFOLLOW);
|
|
8047
8103
|
try {
|
|
8048
8104
|
assertPrivateFile(this.file, fd);
|
|
8049
|
-
return parseConfigurationYaml((0,
|
|
8105
|
+
return parseConfigurationYaml((0, import_node_fs5.readFileSync)(fd, "utf8"), this.context);
|
|
8050
8106
|
} finally {
|
|
8051
|
-
(0,
|
|
8107
|
+
(0, import_node_fs5.closeSync)(fd);
|
|
8052
8108
|
}
|
|
8053
8109
|
}
|
|
8054
8110
|
locked(run) {
|
|
8055
|
-
(0,
|
|
8056
|
-
const dirStat = (0,
|
|
8111
|
+
(0, import_node_fs5.mkdirSync)(this.context.configRoot, { recursive: true, mode: 448 });
|
|
8112
|
+
const dirStat = (0, import_node_fs5.lstatSync)(this.context.configRoot);
|
|
8057
8113
|
if (!dirStat.isDirectory() || dirStat.isSymbolicLink() || typeof process.getuid === "function" && dirStat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_ROOT_OWNER_MISMATCH");
|
|
8058
|
-
|
|
8059
|
-
const fd = (0,
|
|
8114
|
+
assertPrivateDirectory(this.context.configRoot);
|
|
8115
|
+
const fd = (0, import_node_fs5.openSync)(import_node_path4.default.join(this.context.configRoot, "settings.lock"), import_node_fs5.constants.O_CREAT | import_node_fs5.constants.O_RDWR | import_node_fs5.constants.O_NOFOLLOW, 384);
|
|
8060
8116
|
try {
|
|
8061
8117
|
assertPrivateFile(import_node_path4.default.join(this.context.configRoot, "settings.lock"), fd);
|
|
8062
8118
|
if (!(0, import_fs_native_extensions2.tryLock)(fd)) throw new ConfigurationError("CONFIG_WRITE_BUSY");
|
|
8063
8119
|
return run();
|
|
8064
8120
|
} finally {
|
|
8065
|
-
(0,
|
|
8121
|
+
(0, import_node_fs5.closeSync)(fd);
|
|
8066
8122
|
}
|
|
8067
8123
|
}
|
|
8068
8124
|
publish(document, previous, backupId) {
|
|
@@ -8072,41 +8128,35 @@ var ConfigurationStore = class {
|
|
|
8072
8128
|
const temporary = `${this.file}.${(0, import_node_crypto2.randomUUID)()}.tmp`;
|
|
8073
8129
|
if (previous !== void 0) {
|
|
8074
8130
|
const backupRoot = import_node_path4.default.join(this.context.configRoot, "config-backups");
|
|
8075
|
-
(0,
|
|
8076
|
-
|
|
8077
|
-
if (!backupStat.isDirectory() || backupStat.isSymbolicLink() || backupStat.mode & 63 || typeof process.getuid === "function" && backupStat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_BACKUP_ROOT_INVALID");
|
|
8131
|
+
(0, import_node_fs5.mkdirSync)(backupRoot, { recursive: true, mode: 448 });
|
|
8132
|
+
assertPrivateDirectory(backupRoot);
|
|
8078
8133
|
const backup = import_node_path4.default.join(backupRoot, backupId ?? `${Date.now()}-${(0, import_node_crypto2.randomUUID)()}.yaml`);
|
|
8079
|
-
const fd2 = (0,
|
|
8134
|
+
const fd2 = (0, import_node_fs5.openSync)(backup, "wx", 384);
|
|
8080
8135
|
try {
|
|
8081
|
-
(0,
|
|
8082
|
-
(0,
|
|
8136
|
+
(0, import_node_fs5.writeFileSync)(fd2, previous);
|
|
8137
|
+
(0, import_node_fs5.fsyncSync)(fd2);
|
|
8083
8138
|
} finally {
|
|
8084
|
-
(0,
|
|
8139
|
+
(0, import_node_fs5.closeSync)(fd2);
|
|
8085
8140
|
}
|
|
8086
8141
|
}
|
|
8087
|
-
const fd = (0,
|
|
8142
|
+
const fd = (0, import_node_fs5.openSync)(temporary, "wx", 384);
|
|
8088
8143
|
try {
|
|
8089
|
-
(0,
|
|
8090
|
-
(0,
|
|
8144
|
+
(0, import_node_fs5.writeFileSync)(fd, source);
|
|
8145
|
+
(0, import_node_fs5.fsyncSync)(fd);
|
|
8091
8146
|
} finally {
|
|
8092
|
-
(0,
|
|
8147
|
+
(0, import_node_fs5.closeSync)(fd);
|
|
8093
8148
|
}
|
|
8094
8149
|
try {
|
|
8095
|
-
(0,
|
|
8096
|
-
|
|
8097
|
-
try {
|
|
8098
|
-
(0, import_node_fs4.fsyncSync)(parent);
|
|
8099
|
-
} finally {
|
|
8100
|
-
(0, import_node_fs4.closeSync)(parent);
|
|
8101
|
-
}
|
|
8150
|
+
(0, import_node_fs5.renameSync)(temporary, this.file);
|
|
8151
|
+
syncDirectory(this.context.configRoot);
|
|
8102
8152
|
} finally {
|
|
8103
|
-
if ((0,
|
|
8153
|
+
if ((0, import_node_fs5.existsSync)(temporary)) (0, import_node_fs5.unlinkSync)(temporary);
|
|
8104
8154
|
}
|
|
8105
8155
|
return checked;
|
|
8106
8156
|
}
|
|
8107
8157
|
initialize(value) {
|
|
8108
8158
|
return this.locked(() => {
|
|
8109
|
-
if ((0,
|
|
8159
|
+
if ((0, import_node_fs5.existsSync)(this.file)) throw new ConfigurationError("CONFIG_ALREADY_EXISTS");
|
|
8110
8160
|
validateEnvelope(value, this.context);
|
|
8111
8161
|
const issues = validateDomains(value, this.context);
|
|
8112
8162
|
if (Object.keys(issues).length) throw new ConfigurationError("CONFIG_VALIDATION_FAILED", Object.values(issues).flat().map((item) => item.path));
|
|
@@ -8146,9 +8196,9 @@ var ConfigurationStore = class {
|
|
|
8146
8196
|
}
|
|
8147
8197
|
backups() {
|
|
8148
8198
|
const root = import_node_path4.default.join(this.context.configRoot, "config-backups");
|
|
8149
|
-
if (!(0,
|
|
8199
|
+
if (!(0, import_node_fs5.existsSync)(root)) return [];
|
|
8150
8200
|
assertPrivateDirectory(root);
|
|
8151
|
-
return (0,
|
|
8201
|
+
return (0, import_node_fs5.readdirSync)(root).filter((id) => /^\d+-[a-f0-9-]+\.yaml$/.test(id)).sort().reverse().map((id) => {
|
|
8152
8202
|
try {
|
|
8153
8203
|
const backup = this.readBackup(id);
|
|
8154
8204
|
return { id, revision: backup.value.revision, schemaVersion: backup.value.schemaVersion, compatible: true };
|
|
@@ -8226,23 +8276,18 @@ var ConfigurationStore = class {
|
|
|
8226
8276
|
recordUpgrade(value) {
|
|
8227
8277
|
const file = import_node_path4.default.join(this.context.configRoot, "config-upgrade.json");
|
|
8228
8278
|
const temporary = `${file}.${(0, import_node_crypto2.randomUUID)()}.tmp`;
|
|
8229
|
-
const fd = (0,
|
|
8279
|
+
const fd = (0, import_node_fs5.openSync)(temporary, "wx", 384);
|
|
8230
8280
|
try {
|
|
8231
|
-
(0,
|
|
8232
|
-
(0,
|
|
8281
|
+
(0, import_node_fs5.writeFileSync)(fd, JSON.stringify(value, null, 2) + "\n");
|
|
8282
|
+
(0, import_node_fs5.fsyncSync)(fd);
|
|
8233
8283
|
} finally {
|
|
8234
|
-
(0,
|
|
8284
|
+
(0, import_node_fs5.closeSync)(fd);
|
|
8235
8285
|
}
|
|
8236
8286
|
try {
|
|
8237
|
-
(0,
|
|
8238
|
-
|
|
8239
|
-
try {
|
|
8240
|
-
(0, import_node_fs4.fsyncSync)(parent);
|
|
8241
|
-
} finally {
|
|
8242
|
-
(0, import_node_fs4.closeSync)(parent);
|
|
8243
|
-
}
|
|
8287
|
+
(0, import_node_fs5.renameSync)(temporary, file);
|
|
8288
|
+
syncDirectory(this.context.configRoot);
|
|
8244
8289
|
} finally {
|
|
8245
|
-
if ((0,
|
|
8290
|
+
if ((0, import_node_fs5.existsSync)(temporary)) (0, import_node_fs5.unlinkSync)(temporary);
|
|
8246
8291
|
}
|
|
8247
8292
|
}
|
|
8248
8293
|
upgrade(expected) {
|
|
@@ -8251,7 +8296,7 @@ var ConfigurationStore = class {
|
|
|
8251
8296
|
if (preview.expectedRevision !== expected.revision || preview.expectedDigest !== expected.digest) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
|
|
8252
8297
|
if (!preview.changed) {
|
|
8253
8298
|
const receiptFile = import_node_path4.default.join(this.context.configRoot, "config-upgrade.json");
|
|
8254
|
-
if ((0,
|
|
8299
|
+
if ((0, import_node_fs5.existsSync)(receiptFile)) {
|
|
8255
8300
|
const receipt = JSON.parse(readPrivateFile(receiptFile));
|
|
8256
8301
|
if (isConfigurationObject(receipt) && receipt.phase === "prepared" && receipt.plannedDigest === expected.digest)
|
|
8257
8302
|
this.recordUpgrade({ ...receipt, phase: "committed", savedRevision: expected.revision, digest: expected.digest });
|
|
@@ -8285,9 +8330,9 @@ var ConfigurationStore = class {
|
|
|
8285
8330
|
previous(keys) {
|
|
8286
8331
|
const current = this.read();
|
|
8287
8332
|
const root = import_node_path4.default.join(this.context.configRoot, "config-backups");
|
|
8288
|
-
if (!(0,
|
|
8333
|
+
if (!(0, import_node_fs5.existsSync)(root)) throw new ConfigurationError("CONFIG_BACKUP_UNAVAILABLE");
|
|
8289
8334
|
assertPrivateDirectory(root);
|
|
8290
|
-
const candidates = (0,
|
|
8335
|
+
const candidates = (0, import_node_fs5.readdirSync)(root).filter((file) => /^\d+-[a-f0-9-]+\.yaml$/.test(file)).sort().reverse();
|
|
8291
8336
|
for (const candidate of candidates) {
|
|
8292
8337
|
const file = import_node_path4.default.join(root, candidate);
|
|
8293
8338
|
const previous = parseConfigurationYaml(readPrivateFile(file), this.context);
|
|
@@ -8299,7 +8344,7 @@ var ConfigurationStore = class {
|
|
|
8299
8344
|
}
|
|
8300
8345
|
migrate(value, expected) {
|
|
8301
8346
|
return this.locked(() => {
|
|
8302
|
-
const current = (0,
|
|
8347
|
+
const current = (0, import_node_fs5.existsSync)(this.file) ? this.read() : null;
|
|
8303
8348
|
if (current ? !expected || current.value.revision !== expected.revision || current.digest !== expected.digest : expected !== null) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
|
|
8304
8349
|
validateEnvelope(value, this.context);
|
|
8305
8350
|
const issues = validateDomains(value, this.context);
|
|
@@ -8514,7 +8559,7 @@ function configurationPath(key, relativeDefault) {
|
|
|
8514
8559
|
|
|
8515
8560
|
// packages/config-node/src/app-server/runtime-release.ts
|
|
8516
8561
|
var import_node_crypto3 = require("node:crypto");
|
|
8517
|
-
var
|
|
8562
|
+
var import_node_fs6 = require("node:fs");
|
|
8518
8563
|
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
8519
8564
|
|
|
8520
8565
|
// packages/shared/src/app-server/types.ts
|
|
@@ -8538,7 +8583,7 @@ function installAppServerRuntimeRelease(options) {
|
|
|
8538
8583
|
throw new Error(`Invalid app-server releaseId: ${options.releaseId}`);
|
|
8539
8584
|
}
|
|
8540
8585
|
const sourceEntry = import_node_path7.default.resolve(options.entry);
|
|
8541
|
-
if (!(0,
|
|
8586
|
+
if (!(0, import_node_fs6.existsSync)(sourceEntry)) {
|
|
8542
8587
|
throw new Error(`App-server entry does not exist: ${sourceEntry}`);
|
|
8543
8588
|
}
|
|
8544
8589
|
const capability = readJsonFile(import_node_path7.default.join(import_node_path7.default.dirname(sourceEntry), "configuration-compatibility.json"));
|
|
@@ -8550,12 +8595,16 @@ function installAppServerRuntimeRelease(options) {
|
|
|
8550
8595
|
const releaseDir = import_node_path7.default.join(releasesDir, options.releaseId);
|
|
8551
8596
|
const tempReleaseDir = import_node_path7.default.join(releasesDir, `${options.releaseId}.tmp`);
|
|
8552
8597
|
const targetEntry = import_node_path7.default.join(tempReleaseDir, "app-server", "index.cjs");
|
|
8553
|
-
(0,
|
|
8554
|
-
(0,
|
|
8555
|
-
(0,
|
|
8598
|
+
(0, import_node_fs6.rmSync)(tempReleaseDir, { recursive: true, force: true });
|
|
8599
|
+
(0, import_node_fs6.mkdirSync)(import_node_path7.default.dirname(targetEntry), { recursive: true });
|
|
8600
|
+
(0, import_node_fs6.cpSync)(sourceEntry, targetEntry);
|
|
8556
8601
|
const nativeModules = import_node_path7.default.join(import_node_path7.default.dirname(sourceEntry), "node_modules");
|
|
8557
|
-
if (!(0,
|
|
8558
|
-
(0,
|
|
8602
|
+
if (!(0, import_node_fs6.existsSync)(nativeModules)) throw new Error("CONFIG_NATIVE_LOCK_RUNTIME_MISSING");
|
|
8603
|
+
(0, import_node_fs6.cpSync)(nativeModules, import_node_path7.default.join(import_node_path7.default.dirname(targetEntry), "node_modules"), {
|
|
8604
|
+
recursive: true,
|
|
8605
|
+
// Avoid Node 22's native recursive-copy crash on Windows Unicode paths.
|
|
8606
|
+
...process.platform === "win32" ? { filter: () => true } : {}
|
|
8607
|
+
});
|
|
8559
8608
|
const manifest = {
|
|
8560
8609
|
configuration: capability,
|
|
8561
8610
|
schemaVersion: APP_SERVER_RUNTIME_SCHEMA_VERSION,
|
|
@@ -8566,18 +8615,18 @@ function installAppServerRuntimeRelease(options) {
|
|
|
8566
8615
|
},
|
|
8567
8616
|
files: runtimeFiles(tempReleaseDir).map((file) => ({ path: file, sha256: sha256(import_node_path7.default.join(tempReleaseDir, file)) }))
|
|
8568
8617
|
};
|
|
8569
|
-
(0,
|
|
8618
|
+
(0, import_node_fs6.writeFileSync)(
|
|
8570
8619
|
import_node_path7.default.join(tempReleaseDir, "manifest.json"),
|
|
8571
8620
|
`${JSON.stringify(manifest, null, 2)}
|
|
8572
8621
|
`
|
|
8573
8622
|
);
|
|
8574
|
-
(0,
|
|
8575
|
-
(0,
|
|
8576
|
-
(0,
|
|
8623
|
+
(0, import_node_fs6.mkdirSync)(releasesDir, { recursive: true });
|
|
8624
|
+
(0, import_node_fs6.rmSync)(releaseDir, { recursive: true, force: true });
|
|
8625
|
+
(0, import_node_fs6.renameSync)(tempReleaseDir, releaseDir);
|
|
8577
8626
|
const currentPath = import_node_path7.default.join(runtimeRoot, "current.json");
|
|
8578
8627
|
const currentTemp = `${currentPath}.tmp`;
|
|
8579
|
-
(0,
|
|
8580
|
-
(0,
|
|
8628
|
+
(0, import_node_fs6.mkdirSync)(runtimeRoot, { recursive: true });
|
|
8629
|
+
(0, import_node_fs6.writeFileSync)(
|
|
8581
8630
|
currentTemp,
|
|
8582
8631
|
`${JSON.stringify(
|
|
8583
8632
|
{
|
|
@@ -8589,7 +8638,7 @@ function installAppServerRuntimeRelease(options) {
|
|
|
8589
8638
|
)}
|
|
8590
8639
|
`
|
|
8591
8640
|
);
|
|
8592
|
-
(0,
|
|
8641
|
+
(0, import_node_fs6.renameSync)(currentTemp, currentPath);
|
|
8593
8642
|
return {
|
|
8594
8643
|
source: "global",
|
|
8595
8644
|
releaseId: options.releaseId,
|
|
@@ -8600,13 +8649,13 @@ function installAppServerRuntimeRelease(options) {
|
|
|
8600
8649
|
}
|
|
8601
8650
|
function readJsonFile(filePath) {
|
|
8602
8651
|
try {
|
|
8603
|
-
return JSON.parse((0,
|
|
8652
|
+
return JSON.parse((0, import_node_fs6.readFileSync)(filePath, "utf8"));
|
|
8604
8653
|
} catch {
|
|
8605
8654
|
return null;
|
|
8606
8655
|
}
|
|
8607
8656
|
}
|
|
8608
8657
|
function sha256(filePath) {
|
|
8609
|
-
return (0, import_node_crypto3.createHash)("sha256").update((0,
|
|
8658
|
+
return (0, import_node_crypto3.createHash)("sha256").update((0, import_node_fs6.readFileSync)(filePath)).digest("hex");
|
|
8610
8659
|
}
|
|
8611
8660
|
function isSafeRelativePath(value) {
|
|
8612
8661
|
if (typeof value !== "string") {
|
|
@@ -8622,7 +8671,7 @@ function isSafeReleaseId(value) {
|
|
|
8622
8671
|
return isSafeRelativePath(value) && !String(value).includes("/") && !String(value).includes("\\");
|
|
8623
8672
|
}
|
|
8624
8673
|
function runtimeFiles(root, prefix = "") {
|
|
8625
|
-
return (0,
|
|
8674
|
+
return (0, import_node_fs6.readdirSync)(import_node_path7.default.join(root, prefix), { withFileTypes: true }).flatMap((entry) => {
|
|
8626
8675
|
const relative = import_node_path7.default.posix.join(prefix, entry.name);
|
|
8627
8676
|
if (entry.isSymbolicLink()) throw new Error("CONFIG_RUNTIME_SYMLINK_FORBIDDEN");
|
|
8628
8677
|
return entry.isDirectory() ? runtimeFiles(root, relative) : [relative];
|
|
@@ -8631,22 +8680,21 @@ function runtimeFiles(root, prefix = "") {
|
|
|
8631
8680
|
|
|
8632
8681
|
// packages/runweave-server/src/runtime.ts
|
|
8633
8682
|
var import_node_module = require("node:module");
|
|
8634
|
-
var
|
|
8635
|
-
var import_node_fs6 = require("node:fs");
|
|
8683
|
+
var import_node_fs7 = require("node:fs");
|
|
8636
8684
|
var import_node_crypto4 = require("node:crypto");
|
|
8637
8685
|
var import_node_path8 = __toESM(require("node:path"));
|
|
8638
|
-
var readJson = (file) => JSON.parse((0,
|
|
8686
|
+
var readJson = (file) => JSON.parse((0, import_node_fs7.readFileSync)(file, "utf8"));
|
|
8639
8687
|
function writeJson(file, value) {
|
|
8640
8688
|
const temporary = `${file}.${(0, import_node_crypto4.randomUUID)()}`;
|
|
8641
|
-
(0,
|
|
8689
|
+
(0, import_node_fs7.writeFileSync)(temporary, JSON.stringify(value, null, 2) + "\n", {
|
|
8642
8690
|
mode: 384
|
|
8643
8691
|
});
|
|
8644
|
-
(0,
|
|
8692
|
+
(0, import_node_fs7.renameSync)(temporary, file);
|
|
8645
8693
|
}
|
|
8646
8694
|
function processStart(pid) {
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8695
|
+
const identity = processStartIdentity(pid);
|
|
8696
|
+
if (!identity) throw new Error("Cannot identify Server process start time");
|
|
8697
|
+
return identity;
|
|
8650
8698
|
}
|
|
8651
8699
|
async function waitForAppServer() {
|
|
8652
8700
|
const deadline = Date.now() + 3e4;
|
|
@@ -8669,6 +8717,16 @@ async function waitForAppServer() {
|
|
|
8669
8717
|
throw new Error("App Server did not become healthy");
|
|
8670
8718
|
}
|
|
8671
8719
|
async function runComponent(ctx, name) {
|
|
8720
|
+
if (process.platform === "win32") {
|
|
8721
|
+
const shutdown = () => {
|
|
8722
|
+
if (process.listenerCount("SIGTERM") === 0) process.exit(0);
|
|
8723
|
+
process.emit("SIGTERM");
|
|
8724
|
+
};
|
|
8725
|
+
process.on("message", (message) => {
|
|
8726
|
+
if (message === "runweave:shutdown") shutdown();
|
|
8727
|
+
});
|
|
8728
|
+
process.once("disconnect", shutdown);
|
|
8729
|
+
}
|
|
8672
8730
|
delete process.env.RUNWEAVE_APP_SERVER_URL;
|
|
8673
8731
|
delete process.env.RUNWEAVE_APP_SERVER_TOKEN;
|
|
8674
8732
|
delete process.env.RUNWEAVE_HOOK_TOKEN;
|
|
@@ -8716,7 +8774,7 @@ async function runComponent(ctx, name) {
|
|
|
8716
8774
|
"node_modules/node-pty"
|
|
8717
8775
|
);
|
|
8718
8776
|
process.env.RUNWEAVE_RUNTIME_RELEASE_ID = ctx.manifest.version;
|
|
8719
|
-
process.env.RUNWEAVE_CLI_BIN = import_node_path8.default.join(ctx.home, "rw");
|
|
8777
|
+
process.env.RUNWEAVE_CLI_BIN = import_node_path8.default.join(ctx.home, process.platform === "win32" ? "rw.cmd" : "rw");
|
|
8720
8778
|
nativeRequire(import_node_path8.default.join(backend, "index.cjs"));
|
|
8721
8779
|
} else {
|
|
8722
8780
|
const entry = import_node_path8.default.join(ctx.release, "app-server/index.cjs");
|
|
@@ -8789,7 +8847,7 @@ async function runServerRuntime(args) {
|
|
|
8789
8847
|
await waitForAppServer();
|
|
8790
8848
|
}
|
|
8791
8849
|
const home = import_node_path8.default.join(context.configRoot, "server");
|
|
8792
|
-
(0,
|
|
8850
|
+
(0, import_node_fs7.mkdirSync)(home, { recursive: true, mode: 448 });
|
|
8793
8851
|
await runComponent({ home, release, manifest }, component);
|
|
8794
8852
|
});
|
|
8795
8853
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,M as n}from"./index-Cf9Vl4GJ.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-4TB4RGXK-ByjQ1_yc.js";import{_ as i}from"./index-Cf9Vl4GJ.js";import"./chunk-FMBD7UC4-D3J3ERtV.js";import"./chunk-YZCP3GAM-KD19-lMa.js";import"./chunk-55IACEB6-D-KjMbGJ.js";import"./chunk-EDXVE4YY-tAgLMZ4w.js";import"./main-DwDuhfcr.js";import"./index-D9-cSGu-.js";import"./record-content-Bewq09_f.js";var b={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{b as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-4TB4RGXK-ByjQ1_yc.js";import{_ as i}from"./index-Cf9Vl4GJ.js";import"./chunk-FMBD7UC4-D3J3ERtV.js";import"./chunk-YZCP3GAM-KD19-lMa.js";import"./chunk-55IACEB6-D-KjMbGJ.js";import"./chunk-EDXVE4YY-tAgLMZ4w.js";import"./main-DwDuhfcr.js";import"./index-D9-cSGu-.js";import"./record-content-Bewq09_f.js";var b={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{b as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as r}from"./graph-DakNuFNs.js";var e=4;function a(o){return r(o,e)}export{a as c};
|