@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
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);
|
|
@@ -7856,6 +7912,8 @@ function isConfigurationContainer(key, array = false) {
|
|
|
7856
7912
|
});
|
|
7857
7913
|
}
|
|
7858
7914
|
function domainForPath(key) {
|
|
7915
|
+
const declared = Object.keys(CONFIGURATION_DOMAIN_VERSIONS).find((domain) => key === domain || key.startsWith(`${domain}.`));
|
|
7916
|
+
if (declared) return declared;
|
|
7859
7917
|
const parts = key.split(".");
|
|
7860
7918
|
return ["backend", "services", "desktop", "agents"].includes(parts[0]) ? parts.slice(0, 2).join(".") : parts[0];
|
|
7861
7919
|
}
|
|
@@ -8024,10 +8082,11 @@ function parseConfigurationYaml(source, context) {
|
|
|
8024
8082
|
return { document, value, digest: (0, import_node_crypto2.createHash)("sha256").update(source).digest("hex"), issues: validateDomains(value, context) };
|
|
8025
8083
|
}
|
|
8026
8084
|
function assertPrivateFile(file, fd) {
|
|
8027
|
-
const stat = fd === void 0 ? (0,
|
|
8085
|
+
const stat = fd === void 0 ? (0, import_node_fs5.lstatSync)(file) : (0, import_node_fs5.fstatSync)(fd);
|
|
8028
8086
|
if (!stat.isFile() || stat.isSymbolicLink() || stat.nlink !== 1) throw new ConfigurationError("CONFIG_FILE_NOT_PRIVATE_REGULAR");
|
|
8029
8087
|
if (typeof process.getuid === "function" && stat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_FILE_OWNER_MISMATCH");
|
|
8030
|
-
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);
|
|
8031
8090
|
if (stat.size > MAX_BYTES) throw new ConfigurationError("CONFIG_FILE_TOO_LARGE", [], { line: 1, column: 1 });
|
|
8032
8091
|
}
|
|
8033
8092
|
var ConfigurationStore = class {
|
|
@@ -8037,30 +8096,29 @@ var ConfigurationStore = class {
|
|
|
8037
8096
|
}
|
|
8038
8097
|
file;
|
|
8039
8098
|
read() {
|
|
8040
|
-
if (!(0,
|
|
8041
|
-
|
|
8042
|
-
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);
|
|
8043
8101
|
assertPrivateFile(this.file);
|
|
8044
|
-
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);
|
|
8045
8103
|
try {
|
|
8046
8104
|
assertPrivateFile(this.file, fd);
|
|
8047
|
-
return parseConfigurationYaml((0,
|
|
8105
|
+
return parseConfigurationYaml((0, import_node_fs5.readFileSync)(fd, "utf8"), this.context);
|
|
8048
8106
|
} finally {
|
|
8049
|
-
(0,
|
|
8107
|
+
(0, import_node_fs5.closeSync)(fd);
|
|
8050
8108
|
}
|
|
8051
8109
|
}
|
|
8052
8110
|
locked(run) {
|
|
8053
|
-
(0,
|
|
8054
|
-
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);
|
|
8055
8113
|
if (!dirStat.isDirectory() || dirStat.isSymbolicLink() || typeof process.getuid === "function" && dirStat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_ROOT_OWNER_MISMATCH");
|
|
8056
|
-
|
|
8057
|
-
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);
|
|
8058
8116
|
try {
|
|
8059
8117
|
assertPrivateFile(import_node_path4.default.join(this.context.configRoot, "settings.lock"), fd);
|
|
8060
8118
|
if (!(0, import_fs_native_extensions2.tryLock)(fd)) throw new ConfigurationError("CONFIG_WRITE_BUSY");
|
|
8061
8119
|
return run();
|
|
8062
8120
|
} finally {
|
|
8063
|
-
(0,
|
|
8121
|
+
(0, import_node_fs5.closeSync)(fd);
|
|
8064
8122
|
}
|
|
8065
8123
|
}
|
|
8066
8124
|
publish(document, previous, backupId) {
|
|
@@ -8070,41 +8128,35 @@ var ConfigurationStore = class {
|
|
|
8070
8128
|
const temporary = `${this.file}.${(0, import_node_crypto2.randomUUID)()}.tmp`;
|
|
8071
8129
|
if (previous !== void 0) {
|
|
8072
8130
|
const backupRoot = import_node_path4.default.join(this.context.configRoot, "config-backups");
|
|
8073
|
-
(0,
|
|
8074
|
-
|
|
8075
|
-
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);
|
|
8076
8133
|
const backup = import_node_path4.default.join(backupRoot, backupId ?? `${Date.now()}-${(0, import_node_crypto2.randomUUID)()}.yaml`);
|
|
8077
|
-
const fd2 = (0,
|
|
8134
|
+
const fd2 = (0, import_node_fs5.openSync)(backup, "wx", 384);
|
|
8078
8135
|
try {
|
|
8079
|
-
(0,
|
|
8080
|
-
(0,
|
|
8136
|
+
(0, import_node_fs5.writeFileSync)(fd2, previous);
|
|
8137
|
+
(0, import_node_fs5.fsyncSync)(fd2);
|
|
8081
8138
|
} finally {
|
|
8082
|
-
(0,
|
|
8139
|
+
(0, import_node_fs5.closeSync)(fd2);
|
|
8083
8140
|
}
|
|
8084
8141
|
}
|
|
8085
|
-
const fd = (0,
|
|
8142
|
+
const fd = (0, import_node_fs5.openSync)(temporary, "wx", 384);
|
|
8086
8143
|
try {
|
|
8087
|
-
(0,
|
|
8088
|
-
(0,
|
|
8144
|
+
(0, import_node_fs5.writeFileSync)(fd, source);
|
|
8145
|
+
(0, import_node_fs5.fsyncSync)(fd);
|
|
8089
8146
|
} finally {
|
|
8090
|
-
(0,
|
|
8147
|
+
(0, import_node_fs5.closeSync)(fd);
|
|
8091
8148
|
}
|
|
8092
8149
|
try {
|
|
8093
|
-
(0,
|
|
8094
|
-
|
|
8095
|
-
try {
|
|
8096
|
-
(0, import_node_fs4.fsyncSync)(parent);
|
|
8097
|
-
} finally {
|
|
8098
|
-
(0, import_node_fs4.closeSync)(parent);
|
|
8099
|
-
}
|
|
8150
|
+
(0, import_node_fs5.renameSync)(temporary, this.file);
|
|
8151
|
+
syncDirectory(this.context.configRoot);
|
|
8100
8152
|
} finally {
|
|
8101
|
-
if ((0,
|
|
8153
|
+
if ((0, import_node_fs5.existsSync)(temporary)) (0, import_node_fs5.unlinkSync)(temporary);
|
|
8102
8154
|
}
|
|
8103
8155
|
return checked;
|
|
8104
8156
|
}
|
|
8105
8157
|
initialize(value) {
|
|
8106
8158
|
return this.locked(() => {
|
|
8107
|
-
if ((0,
|
|
8159
|
+
if ((0, import_node_fs5.existsSync)(this.file)) throw new ConfigurationError("CONFIG_ALREADY_EXISTS");
|
|
8108
8160
|
validateEnvelope(value, this.context);
|
|
8109
8161
|
const issues = validateDomains(value, this.context);
|
|
8110
8162
|
if (Object.keys(issues).length) throw new ConfigurationError("CONFIG_VALIDATION_FAILED", Object.values(issues).flat().map((item) => item.path));
|
|
@@ -8144,9 +8196,9 @@ var ConfigurationStore = class {
|
|
|
8144
8196
|
}
|
|
8145
8197
|
backups() {
|
|
8146
8198
|
const root = import_node_path4.default.join(this.context.configRoot, "config-backups");
|
|
8147
|
-
if (!(0,
|
|
8199
|
+
if (!(0, import_node_fs5.existsSync)(root)) return [];
|
|
8148
8200
|
assertPrivateDirectory(root);
|
|
8149
|
-
return (0,
|
|
8201
|
+
return (0, import_node_fs5.readdirSync)(root).filter((id) => /^\d+-[a-f0-9-]+\.yaml$/.test(id)).sort().reverse().map((id) => {
|
|
8150
8202
|
try {
|
|
8151
8203
|
const backup = this.readBackup(id);
|
|
8152
8204
|
return { id, revision: backup.value.revision, schemaVersion: backup.value.schemaVersion, compatible: true };
|
|
@@ -8224,23 +8276,18 @@ var ConfigurationStore = class {
|
|
|
8224
8276
|
recordUpgrade(value) {
|
|
8225
8277
|
const file = import_node_path4.default.join(this.context.configRoot, "config-upgrade.json");
|
|
8226
8278
|
const temporary = `${file}.${(0, import_node_crypto2.randomUUID)()}.tmp`;
|
|
8227
|
-
const fd = (0,
|
|
8279
|
+
const fd = (0, import_node_fs5.openSync)(temporary, "wx", 384);
|
|
8228
8280
|
try {
|
|
8229
|
-
(0,
|
|
8230
|
-
(0,
|
|
8281
|
+
(0, import_node_fs5.writeFileSync)(fd, JSON.stringify(value, null, 2) + "\n");
|
|
8282
|
+
(0, import_node_fs5.fsyncSync)(fd);
|
|
8231
8283
|
} finally {
|
|
8232
|
-
(0,
|
|
8284
|
+
(0, import_node_fs5.closeSync)(fd);
|
|
8233
8285
|
}
|
|
8234
8286
|
try {
|
|
8235
|
-
(0,
|
|
8236
|
-
|
|
8237
|
-
try {
|
|
8238
|
-
(0, import_node_fs4.fsyncSync)(parent);
|
|
8239
|
-
} finally {
|
|
8240
|
-
(0, import_node_fs4.closeSync)(parent);
|
|
8241
|
-
}
|
|
8287
|
+
(0, import_node_fs5.renameSync)(temporary, file);
|
|
8288
|
+
syncDirectory(this.context.configRoot);
|
|
8242
8289
|
} finally {
|
|
8243
|
-
if ((0,
|
|
8290
|
+
if ((0, import_node_fs5.existsSync)(temporary)) (0, import_node_fs5.unlinkSync)(temporary);
|
|
8244
8291
|
}
|
|
8245
8292
|
}
|
|
8246
8293
|
upgrade(expected) {
|
|
@@ -8249,7 +8296,7 @@ var ConfigurationStore = class {
|
|
|
8249
8296
|
if (preview.expectedRevision !== expected.revision || preview.expectedDigest !== expected.digest) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
|
|
8250
8297
|
if (!preview.changed) {
|
|
8251
8298
|
const receiptFile = import_node_path4.default.join(this.context.configRoot, "config-upgrade.json");
|
|
8252
|
-
if ((0,
|
|
8299
|
+
if ((0, import_node_fs5.existsSync)(receiptFile)) {
|
|
8253
8300
|
const receipt = JSON.parse(readPrivateFile(receiptFile));
|
|
8254
8301
|
if (isConfigurationObject(receipt) && receipt.phase === "prepared" && receipt.plannedDigest === expected.digest)
|
|
8255
8302
|
this.recordUpgrade({ ...receipt, phase: "committed", savedRevision: expected.revision, digest: expected.digest });
|
|
@@ -8283,9 +8330,9 @@ var ConfigurationStore = class {
|
|
|
8283
8330
|
previous(keys) {
|
|
8284
8331
|
const current = this.read();
|
|
8285
8332
|
const root = import_node_path4.default.join(this.context.configRoot, "config-backups");
|
|
8286
|
-
if (!(0,
|
|
8333
|
+
if (!(0, import_node_fs5.existsSync)(root)) throw new ConfigurationError("CONFIG_BACKUP_UNAVAILABLE");
|
|
8287
8334
|
assertPrivateDirectory(root);
|
|
8288
|
-
const candidates = (0,
|
|
8335
|
+
const candidates = (0, import_node_fs5.readdirSync)(root).filter((file) => /^\d+-[a-f0-9-]+\.yaml$/.test(file)).sort().reverse();
|
|
8289
8336
|
for (const candidate of candidates) {
|
|
8290
8337
|
const file = import_node_path4.default.join(root, candidate);
|
|
8291
8338
|
const previous = parseConfigurationYaml(readPrivateFile(file), this.context);
|
|
@@ -8297,7 +8344,7 @@ var ConfigurationStore = class {
|
|
|
8297
8344
|
}
|
|
8298
8345
|
migrate(value, expected) {
|
|
8299
8346
|
return this.locked(() => {
|
|
8300
|
-
const current = (0,
|
|
8347
|
+
const current = (0, import_node_fs5.existsSync)(this.file) ? this.read() : null;
|
|
8301
8348
|
if (current ? !expected || current.value.revision !== expected.revision || current.digest !== expected.digest : expected !== null) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
|
|
8302
8349
|
validateEnvelope(value, this.context);
|
|
8303
8350
|
const issues = validateDomains(value, this.context);
|
|
@@ -8512,7 +8559,7 @@ function configurationPath(key, relativeDefault) {
|
|
|
8512
8559
|
|
|
8513
8560
|
// packages/config-node/src/app-server/runtime-release.ts
|
|
8514
8561
|
var import_node_crypto3 = require("node:crypto");
|
|
8515
|
-
var
|
|
8562
|
+
var import_node_fs6 = require("node:fs");
|
|
8516
8563
|
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
8517
8564
|
|
|
8518
8565
|
// packages/shared/src/app-server/types.ts
|
|
@@ -8536,7 +8583,7 @@ function installAppServerRuntimeRelease(options) {
|
|
|
8536
8583
|
throw new Error(`Invalid app-server releaseId: ${options.releaseId}`);
|
|
8537
8584
|
}
|
|
8538
8585
|
const sourceEntry = import_node_path7.default.resolve(options.entry);
|
|
8539
|
-
if (!(0,
|
|
8586
|
+
if (!(0, import_node_fs6.existsSync)(sourceEntry)) {
|
|
8540
8587
|
throw new Error(`App-server entry does not exist: ${sourceEntry}`);
|
|
8541
8588
|
}
|
|
8542
8589
|
const capability = readJsonFile(import_node_path7.default.join(import_node_path7.default.dirname(sourceEntry), "configuration-compatibility.json"));
|
|
@@ -8548,12 +8595,16 @@ function installAppServerRuntimeRelease(options) {
|
|
|
8548
8595
|
const releaseDir = import_node_path7.default.join(releasesDir, options.releaseId);
|
|
8549
8596
|
const tempReleaseDir = import_node_path7.default.join(releasesDir, `${options.releaseId}.tmp`);
|
|
8550
8597
|
const targetEntry = import_node_path7.default.join(tempReleaseDir, "app-server", "index.cjs");
|
|
8551
|
-
(0,
|
|
8552
|
-
(0,
|
|
8553
|
-
(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);
|
|
8554
8601
|
const nativeModules = import_node_path7.default.join(import_node_path7.default.dirname(sourceEntry), "node_modules");
|
|
8555
|
-
if (!(0,
|
|
8556
|
-
(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
|
+
});
|
|
8557
8608
|
const manifest = {
|
|
8558
8609
|
configuration: capability,
|
|
8559
8610
|
schemaVersion: APP_SERVER_RUNTIME_SCHEMA_VERSION,
|
|
@@ -8564,18 +8615,18 @@ function installAppServerRuntimeRelease(options) {
|
|
|
8564
8615
|
},
|
|
8565
8616
|
files: runtimeFiles(tempReleaseDir).map((file) => ({ path: file, sha256: sha256(import_node_path7.default.join(tempReleaseDir, file)) }))
|
|
8566
8617
|
};
|
|
8567
|
-
(0,
|
|
8618
|
+
(0, import_node_fs6.writeFileSync)(
|
|
8568
8619
|
import_node_path7.default.join(tempReleaseDir, "manifest.json"),
|
|
8569
8620
|
`${JSON.stringify(manifest, null, 2)}
|
|
8570
8621
|
`
|
|
8571
8622
|
);
|
|
8572
|
-
(0,
|
|
8573
|
-
(0,
|
|
8574
|
-
(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);
|
|
8575
8626
|
const currentPath = import_node_path7.default.join(runtimeRoot, "current.json");
|
|
8576
8627
|
const currentTemp = `${currentPath}.tmp`;
|
|
8577
|
-
(0,
|
|
8578
|
-
(0,
|
|
8628
|
+
(0, import_node_fs6.mkdirSync)(runtimeRoot, { recursive: true });
|
|
8629
|
+
(0, import_node_fs6.writeFileSync)(
|
|
8579
8630
|
currentTemp,
|
|
8580
8631
|
`${JSON.stringify(
|
|
8581
8632
|
{
|
|
@@ -8587,7 +8638,7 @@ function installAppServerRuntimeRelease(options) {
|
|
|
8587
8638
|
)}
|
|
8588
8639
|
`
|
|
8589
8640
|
);
|
|
8590
|
-
(0,
|
|
8641
|
+
(0, import_node_fs6.renameSync)(currentTemp, currentPath);
|
|
8591
8642
|
return {
|
|
8592
8643
|
source: "global",
|
|
8593
8644
|
releaseId: options.releaseId,
|
|
@@ -8598,13 +8649,13 @@ function installAppServerRuntimeRelease(options) {
|
|
|
8598
8649
|
}
|
|
8599
8650
|
function readJsonFile(filePath) {
|
|
8600
8651
|
try {
|
|
8601
|
-
return JSON.parse((0,
|
|
8652
|
+
return JSON.parse((0, import_node_fs6.readFileSync)(filePath, "utf8"));
|
|
8602
8653
|
} catch {
|
|
8603
8654
|
return null;
|
|
8604
8655
|
}
|
|
8605
8656
|
}
|
|
8606
8657
|
function sha256(filePath) {
|
|
8607
|
-
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");
|
|
8608
8659
|
}
|
|
8609
8660
|
function isSafeRelativePath(value) {
|
|
8610
8661
|
if (typeof value !== "string") {
|
|
@@ -8620,7 +8671,7 @@ function isSafeReleaseId(value) {
|
|
|
8620
8671
|
return isSafeRelativePath(value) && !String(value).includes("/") && !String(value).includes("\\");
|
|
8621
8672
|
}
|
|
8622
8673
|
function runtimeFiles(root, prefix = "") {
|
|
8623
|
-
return (0,
|
|
8674
|
+
return (0, import_node_fs6.readdirSync)(import_node_path7.default.join(root, prefix), { withFileTypes: true }).flatMap((entry) => {
|
|
8624
8675
|
const relative = import_node_path7.default.posix.join(prefix, entry.name);
|
|
8625
8676
|
if (entry.isSymbolicLink()) throw new Error("CONFIG_RUNTIME_SYMLINK_FORBIDDEN");
|
|
8626
8677
|
return entry.isDirectory() ? runtimeFiles(root, relative) : [relative];
|
|
@@ -8629,22 +8680,21 @@ function runtimeFiles(root, prefix = "") {
|
|
|
8629
8680
|
|
|
8630
8681
|
// packages/runweave-server/src/runtime.ts
|
|
8631
8682
|
var import_node_module = require("node:module");
|
|
8632
|
-
var
|
|
8633
|
-
var import_node_fs6 = require("node:fs");
|
|
8683
|
+
var import_node_fs7 = require("node:fs");
|
|
8634
8684
|
var import_node_crypto4 = require("node:crypto");
|
|
8635
8685
|
var import_node_path8 = __toESM(require("node:path"));
|
|
8636
|
-
var readJson = (file) => JSON.parse((0,
|
|
8686
|
+
var readJson = (file) => JSON.parse((0, import_node_fs7.readFileSync)(file, "utf8"));
|
|
8637
8687
|
function writeJson(file, value) {
|
|
8638
8688
|
const temporary = `${file}.${(0, import_node_crypto4.randomUUID)()}`;
|
|
8639
|
-
(0,
|
|
8689
|
+
(0, import_node_fs7.writeFileSync)(temporary, JSON.stringify(value, null, 2) + "\n", {
|
|
8640
8690
|
mode: 384
|
|
8641
8691
|
});
|
|
8642
|
-
(0,
|
|
8692
|
+
(0, import_node_fs7.renameSync)(temporary, file);
|
|
8643
8693
|
}
|
|
8644
8694
|
function processStart(pid) {
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8695
|
+
const identity = processStartIdentity(pid);
|
|
8696
|
+
if (!identity) throw new Error("Cannot identify Server process start time");
|
|
8697
|
+
return identity;
|
|
8648
8698
|
}
|
|
8649
8699
|
async function waitForAppServer() {
|
|
8650
8700
|
const deadline = Date.now() + 3e4;
|
|
@@ -8667,6 +8717,16 @@ async function waitForAppServer() {
|
|
|
8667
8717
|
throw new Error("App Server did not become healthy");
|
|
8668
8718
|
}
|
|
8669
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
|
+
}
|
|
8670
8730
|
delete process.env.RUNWEAVE_APP_SERVER_URL;
|
|
8671
8731
|
delete process.env.RUNWEAVE_APP_SERVER_TOKEN;
|
|
8672
8732
|
delete process.env.RUNWEAVE_HOOK_TOKEN;
|
|
@@ -8714,7 +8774,7 @@ async function runComponent(ctx, name) {
|
|
|
8714
8774
|
"node_modules/node-pty"
|
|
8715
8775
|
);
|
|
8716
8776
|
process.env.RUNWEAVE_RUNTIME_RELEASE_ID = ctx.manifest.version;
|
|
8717
|
-
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");
|
|
8718
8778
|
nativeRequire(import_node_path8.default.join(backend, "index.cjs"));
|
|
8719
8779
|
} else {
|
|
8720
8780
|
const entry = import_node_path8.default.join(ctx.release, "app-server/index.cjs");
|
|
@@ -8787,7 +8847,7 @@ async function runServerRuntime(args) {
|
|
|
8787
8847
|
await waitForAppServer();
|
|
8788
8848
|
}
|
|
8789
8849
|
const home = import_node_path8.default.join(context.configRoot, "server");
|
|
8790
|
-
(0,
|
|
8850
|
+
(0, import_node_fs7.mkdirSync)(home, { recursive: true, mode: 448 });
|
|
8791
8851
|
await runComponent({ home, release, manifest }, component);
|
|
8792
8852
|
});
|
|
8793
8853
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,M as n}from"./index-BPgmi_HT.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-BHHtOn_W.js";import{_ as i}from"./index-BPgmi_HT.js";import"./chunk-FMBD7UC4-D5wdm5pu.js";import"./chunk-YZCP3GAM-ISBm3jAD.js";import"./chunk-55IACEB6-npi1DjnI.js";import"./chunk-EDXVE4YY-6XoKXtpJ.js";import"./main-D9JUBZrL.js";import"./index-D9-cSGu-.js";import"./record-content-DBb8tU0P.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-BHHtOn_W.js";import{_ as i}from"./index-BPgmi_HT.js";import"./chunk-FMBD7UC4-D5wdm5pu.js";import"./chunk-YZCP3GAM-ISBm3jAD.js";import"./chunk-55IACEB6-npi1DjnI.js";import"./chunk-EDXVE4YY-6XoKXtpJ.js";import"./main-D9JUBZrL.js";import"./index-D9-cSGu-.js";import"./record-content-DBb8tU0P.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-DhVKaWIc.js";var e=4;function a(o){return r(o,e)}export{a as c};
|