@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* runweave:build-info */var __RUNWEAVE_BUILD_INFO__={"version":"0.1.0","buildId":"
|
|
1
|
+
/* runweave:build-info */var __RUNWEAVE_BUILD_INFO__={"version":"0.1.0","buildId":"20261108T004031551Z-168d13f1","sourceRevision":"168d13f138a29af9055863e4ccec018125af5644","sourceDirty":false,"builtAt":"2026-11-08T00:40:31.551Z","contentSha256":"9d35815d7ecbf345ce1ff15eaae37eb2b88f6df5289e67f3991b156aac3e2c62"};
|
|
2
2
|
const __IMPORT_META_URL__ = require('url').pathToFileURL(__filename).href;
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -25745,13 +25745,13 @@ var require_view = __commonJS({
|
|
|
25745
25745
|
View.prototype.resolve = function resolve2(dir, file) {
|
|
25746
25746
|
var ext = this.ext;
|
|
25747
25747
|
var path22 = join(dir, file);
|
|
25748
|
-
var
|
|
25749
|
-
if (
|
|
25748
|
+
var stat3 = tryStat(path22);
|
|
25749
|
+
if (stat3 && stat3.isFile()) {
|
|
25750
25750
|
return path22;
|
|
25751
25751
|
}
|
|
25752
25752
|
path22 = join(dir, basename(file, ext), "index" + ext);
|
|
25753
|
-
|
|
25754
|
-
if (
|
|
25753
|
+
stat3 = tryStat(path22);
|
|
25754
|
+
if (stat3 && stat3.isFile()) {
|
|
25755
25755
|
return path22;
|
|
25756
25756
|
}
|
|
25757
25757
|
};
|
|
@@ -26021,9 +26021,9 @@ var require_etag = __commonJS({
|
|
|
26021
26021
|
}
|
|
26022
26022
|
return obj && typeof obj === "object" && "ctime" in obj && toString.call(obj.ctime) === "[object Date]" && "mtime" in obj && toString.call(obj.mtime) === "[object Date]" && "ino" in obj && typeof obj.ino === "number" && "size" in obj && typeof obj.size === "number";
|
|
26023
26023
|
}
|
|
26024
|
-
function stattag(
|
|
26025
|
-
var mtime =
|
|
26026
|
-
var size =
|
|
26024
|
+
function stattag(stat3) {
|
|
26025
|
+
var mtime = stat3.mtime.getTime().toString(16);
|
|
26026
|
+
var size = stat3.size.toString(16);
|
|
26027
26027
|
return '"' + size + "-" + mtime + '"';
|
|
26028
26028
|
}
|
|
26029
26029
|
}
|
|
@@ -26636,8 +26636,8 @@ var require_send = __commonJS({
|
|
|
26636
26636
|
this.sendFile(path22);
|
|
26637
26637
|
return res;
|
|
26638
26638
|
};
|
|
26639
|
-
SendStream.prototype.send = function send3(path22,
|
|
26640
|
-
var len =
|
|
26639
|
+
SendStream.prototype.send = function send3(path22, stat3) {
|
|
26640
|
+
var len = stat3.size;
|
|
26641
26641
|
var options = this.options;
|
|
26642
26642
|
var opts = {};
|
|
26643
26643
|
var res = this.res;
|
|
@@ -26649,7 +26649,7 @@ var require_send = __commonJS({
|
|
|
26649
26649
|
return;
|
|
26650
26650
|
}
|
|
26651
26651
|
debug('pipe "%s"', path22);
|
|
26652
|
-
this.setHeader(path22,
|
|
26652
|
+
this.setHeader(path22, stat3);
|
|
26653
26653
|
this.type(path22);
|
|
26654
26654
|
if (this.isConditionalGET()) {
|
|
26655
26655
|
if (this.isPreconditionFailure()) {
|
|
@@ -26705,14 +26705,14 @@ var require_send = __commonJS({
|
|
|
26705
26705
|
var i = 0;
|
|
26706
26706
|
var self = this;
|
|
26707
26707
|
debug('stat "%s"', path22);
|
|
26708
|
-
fs.stat(path22, function onstat(err,
|
|
26708
|
+
fs.stat(path22, function onstat(err, stat3) {
|
|
26709
26709
|
if (err && err.code === "ENOENT" && !extname(path22) && path22[path22.length - 1] !== sep) {
|
|
26710
26710
|
return next(err);
|
|
26711
26711
|
}
|
|
26712
26712
|
if (err) return self.onStatError(err);
|
|
26713
|
-
if (
|
|
26714
|
-
self.emit("file", path22,
|
|
26715
|
-
self.send(path22,
|
|
26713
|
+
if (stat3.isDirectory()) return self.redirect(path22);
|
|
26714
|
+
self.emit("file", path22, stat3);
|
|
26715
|
+
self.send(path22, stat3);
|
|
26716
26716
|
});
|
|
26717
26717
|
function next(err) {
|
|
26718
26718
|
if (self._extensions.length <= i) {
|
|
@@ -26720,11 +26720,11 @@ var require_send = __commonJS({
|
|
|
26720
26720
|
}
|
|
26721
26721
|
var p = path22 + "." + self._extensions[i++];
|
|
26722
26722
|
debug('stat "%s"', p);
|
|
26723
|
-
fs.stat(p, function(err2,
|
|
26723
|
+
fs.stat(p, function(err2, stat3) {
|
|
26724
26724
|
if (err2) return next(err2);
|
|
26725
|
-
if (
|
|
26726
|
-
self.emit("file", p,
|
|
26727
|
-
self.send(p,
|
|
26725
|
+
if (stat3.isDirectory()) return next();
|
|
26726
|
+
self.emit("file", p, stat3);
|
|
26727
|
+
self.send(p, stat3);
|
|
26728
26728
|
});
|
|
26729
26729
|
}
|
|
26730
26730
|
};
|
|
@@ -26738,11 +26738,11 @@ var require_send = __commonJS({
|
|
|
26738
26738
|
}
|
|
26739
26739
|
var p = join(path22, self._index[i]);
|
|
26740
26740
|
debug('stat "%s"', p);
|
|
26741
|
-
fs.stat(p, function(err2,
|
|
26741
|
+
fs.stat(p, function(err2, stat3) {
|
|
26742
26742
|
if (err2) return next(err2);
|
|
26743
|
-
if (
|
|
26744
|
-
self.emit("file", p,
|
|
26745
|
-
self.send(p,
|
|
26743
|
+
if (stat3.isDirectory()) return next();
|
|
26744
|
+
self.emit("file", p, stat3);
|
|
26745
|
+
self.send(p, stat3);
|
|
26746
26746
|
});
|
|
26747
26747
|
}
|
|
26748
26748
|
next();
|
|
@@ -26777,9 +26777,9 @@ var require_send = __commonJS({
|
|
|
26777
26777
|
debug("content-type %s", type2);
|
|
26778
26778
|
res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
|
|
26779
26779
|
};
|
|
26780
|
-
SendStream.prototype.setHeader = function setHeader(path22,
|
|
26780
|
+
SendStream.prototype.setHeader = function setHeader(path22, stat3) {
|
|
26781
26781
|
var res = this.res;
|
|
26782
|
-
this.emit("headers", res, path22,
|
|
26782
|
+
this.emit("headers", res, path22, stat3);
|
|
26783
26783
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
26784
26784
|
debug("accept ranges");
|
|
26785
26785
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -26793,12 +26793,12 @@ var require_send = __commonJS({
|
|
|
26793
26793
|
res.setHeader("Cache-Control", cacheControl);
|
|
26794
26794
|
}
|
|
26795
26795
|
if (this._lastModified && !res.getHeader("Last-Modified")) {
|
|
26796
|
-
var modified =
|
|
26796
|
+
var modified = stat3.mtime.toUTCString();
|
|
26797
26797
|
debug("modified %s", modified);
|
|
26798
26798
|
res.setHeader("Last-Modified", modified);
|
|
26799
26799
|
}
|
|
26800
26800
|
if (this._etag && !res.getHeader("ETag")) {
|
|
26801
|
-
var val = etag(
|
|
26801
|
+
var val = etag(stat3);
|
|
26802
26802
|
debug("etag %s", val);
|
|
26803
26803
|
res.setHeader("ETag", val);
|
|
26804
26804
|
}
|
|
@@ -33560,16 +33560,16 @@ async function scanConversationSource(file, consume, signal) {
|
|
|
33560
33560
|
try {
|
|
33561
33561
|
if (await (0, import_promises.realpath)(file) !== file) return null;
|
|
33562
33562
|
handle = await (0, import_promises.open)(file, import_node_fs2.constants.O_RDONLY | import_node_fs2.constants.O_NOFOLLOW);
|
|
33563
|
-
const
|
|
33564
|
-
if (!
|
|
33563
|
+
const stat3 = await handle.stat();
|
|
33564
|
+
if (!stat3.isFile()) return null;
|
|
33565
33565
|
const windowBytes = 64 * 1024 * 1024;
|
|
33566
|
-
const truncated =
|
|
33566
|
+
const truncated = stat3.size > windowBytes;
|
|
33567
33567
|
let partial = truncated;
|
|
33568
33568
|
const chunk = Buffer.alloc(256 * 1024);
|
|
33569
33569
|
const ranges = truncated ? [
|
|
33570
|
-
{ start: 0, end: Math.min(chunk.length,
|
|
33571
|
-
{ start:
|
|
33572
|
-
] : [{ start: 0, end:
|
|
33570
|
+
{ start: 0, end: Math.min(chunk.length, stat3.size), header: true },
|
|
33571
|
+
{ start: stat3.size - windowBytes, end: stat3.size, header: false }
|
|
33572
|
+
] : [{ start: 0, end: stat3.size, header: false }];
|
|
33573
33573
|
for (const range of ranges) {
|
|
33574
33574
|
let position = range.start;
|
|
33575
33575
|
let lineOffset = position;
|
|
@@ -34557,21 +34557,57 @@ var ConfigurationError = class extends Error {
|
|
|
34557
34557
|
|
|
34558
34558
|
// packages/config-node/src/private-file.ts
|
|
34559
34559
|
var import_node_fs4 = require("node:fs");
|
|
34560
|
+
|
|
34561
|
+
// packages/config-node/src/windows-permissions.ts
|
|
34562
|
+
var import_node_child_process = require("node:child_process");
|
|
34563
|
+
function assertWindowsPrivatePath(file) {
|
|
34564
|
+
if (process.platform !== "win32") return;
|
|
34565
|
+
const script = `
|
|
34566
|
+
$ErrorActionPreference = 'Stop'
|
|
34567
|
+
# Use .NET directly: a parent pwsh may export a PSModulePath incompatible with Windows PowerShell.
|
|
34568
|
+
$acl = if ([IO.Directory]::Exists($env:RUNWEAVE_PRIVATE_PATH)) {
|
|
34569
|
+
[IO.Directory]::GetAccessControl($env:RUNWEAVE_PRIVATE_PATH)
|
|
34570
|
+
} else { [IO.File]::GetAccessControl($env:RUNWEAVE_PRIVATE_PATH) }
|
|
34571
|
+
$sid = [Security.Principal.WindowsIdentity]::GetCurrent().User
|
|
34572
|
+
$allowed = @($sid.Value, 'S-1-5-18', 'S-1-5-32-544')
|
|
34573
|
+
if ($acl.GetOwner([Security.Principal.SecurityIdentifier]).Value -notin $allowed) { throw 'owner' }
|
|
34574
|
+
foreach ($rule in $acl.GetAccessRules($true, $true, [Security.Principal.SecurityIdentifier])) {
|
|
34575
|
+
if ($rule.AccessControlType -eq 'Allow' -and $rule.IdentityReference.Value -notin $allowed) { throw 'access' }
|
|
34576
|
+
}
|
|
34577
|
+
`;
|
|
34578
|
+
try {
|
|
34579
|
+
(0, import_node_child_process.execFileSync)("powershell.exe", ["-NoProfile", "-NonInteractive", "-EncodedCommand", Buffer.from(script, "utf16le").toString("base64")], {
|
|
34580
|
+
env: { ...process.env, RUNWEAVE_PRIVATE_PATH: file },
|
|
34581
|
+
stdio: "ignore",
|
|
34582
|
+
timeout: 1e4,
|
|
34583
|
+
windowsHide: true
|
|
34584
|
+
});
|
|
34585
|
+
} catch {
|
|
34586
|
+
throw new ConfigurationError("CONFIG_WINDOWS_ACL_NOT_PRIVATE", [file]);
|
|
34587
|
+
}
|
|
34588
|
+
}
|
|
34589
|
+
|
|
34590
|
+
// packages/config-node/src/private-file.ts
|
|
34560
34591
|
function assertPrivateDirectory(directory) {
|
|
34561
|
-
const
|
|
34562
|
-
if (!
|
|
34592
|
+
const stat3 = (0, import_node_fs4.lstatSync)(directory);
|
|
34593
|
+
if (!stat3.isDirectory() || stat3.isSymbolicLink() || process.platform !== "win32" && stat3.mode & 63 || typeof process.getuid === "function" && stat3.uid !== process.getuid()) throw new ConfigurationError("CONFIG_ROOT_PERMISSIONS_INVALID");
|
|
34594
|
+
assertWindowsPrivatePath(directory);
|
|
34563
34595
|
}
|
|
34564
|
-
function assertPrivateDescriptor(fd, maxBytes = 1024 * 1024) {
|
|
34565
|
-
const
|
|
34566
|
-
if (!
|
|
34567
|
-
if (typeof process.getuid === "function" &&
|
|
34568
|
-
if (
|
|
34569
|
-
if (
|
|
34596
|
+
function assertPrivateDescriptor(fd, maxBytes = 1024 * 1024, file) {
|
|
34597
|
+
const stat3 = (0, import_node_fs4.fstatSync)(fd);
|
|
34598
|
+
if (!stat3.isFile() || stat3.nlink !== 1) throw new ConfigurationError("CONFIG_FILE_NOT_PRIVATE_REGULAR");
|
|
34599
|
+
if (typeof process.getuid === "function" && stat3.uid !== process.getuid()) throw new ConfigurationError("CONFIG_FILE_OWNER_MISMATCH");
|
|
34600
|
+
if (process.platform !== "win32" && stat3.mode & 63) throw new ConfigurationError("CONFIG_FILE_PERMISSIONS_INVALID");
|
|
34601
|
+
if (process.platform === "win32") {
|
|
34602
|
+
if (!file) throw new ConfigurationError("CONFIG_PRIVATE_PATH_REQUIRED");
|
|
34603
|
+
assertWindowsPrivatePath(file);
|
|
34604
|
+
}
|
|
34605
|
+
if (stat3.size > maxBytes) throw new ConfigurationError("CONFIG_FILE_TOO_LARGE");
|
|
34570
34606
|
}
|
|
34571
34607
|
function readPrivateFile(file, maxBytes = 1024 * 1024) {
|
|
34572
34608
|
const fd = (0, import_node_fs4.openSync)(file, import_node_fs4.constants.O_RDONLY | import_node_fs4.constants.O_NOFOLLOW);
|
|
34573
34609
|
try {
|
|
34574
|
-
assertPrivateDescriptor(fd, maxBytes);
|
|
34610
|
+
assertPrivateDescriptor(fd, maxBytes, file);
|
|
34575
34611
|
const source = (0, import_node_fs4.readFileSync)(fd, "utf8");
|
|
34576
34612
|
if (Buffer.byteLength(source) > maxBytes) throw new ConfigurationError("CONFIG_FILE_TOO_LARGE");
|
|
34577
34613
|
return source;
|
|
@@ -34646,15 +34682,27 @@ function assertOwnedPath(context, value) {
|
|
|
34646
34682
|
}
|
|
34647
34683
|
}
|
|
34648
34684
|
|
|
34649
|
-
// packages/config-node/src/
|
|
34685
|
+
// packages/config-node/src/platform.ts
|
|
34650
34686
|
var import_node_fs6 = require("node:fs");
|
|
34687
|
+
function syncDirectory(directory) {
|
|
34688
|
+
if (process.platform === "win32") return;
|
|
34689
|
+
const fd = (0, import_node_fs6.openSync)(directory, "r");
|
|
34690
|
+
try {
|
|
34691
|
+
(0, import_node_fs6.fsyncSync)(fd);
|
|
34692
|
+
} finally {
|
|
34693
|
+
(0, import_node_fs6.closeSync)(fd);
|
|
34694
|
+
}
|
|
34695
|
+
}
|
|
34696
|
+
|
|
34697
|
+
// packages/config-node/src/owner.ts
|
|
34698
|
+
var import_node_fs7 = require("node:fs");
|
|
34651
34699
|
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
34652
34700
|
var import_node_os2 = __toESM(require("node:os"), 1);
|
|
34653
34701
|
var import_node_crypto3 = require("node:crypto");
|
|
34654
34702
|
var import_fs_native_extensions = require("fs-native-extensions");
|
|
34655
34703
|
function ownerDirectory(context) {
|
|
34656
34704
|
const directory = context.kind === "stable" ? import_node_path4.default.join(import_node_os2.default.userInfo().homedir, ".runweave", "runtime") : import_node_path4.default.join(context.configRoot, "runtime");
|
|
34657
|
-
(0,
|
|
34705
|
+
(0, import_node_fs7.mkdirSync)(directory, { recursive: true, mode: 448 });
|
|
34658
34706
|
assertPrivateDirectory(import_node_path4.default.dirname(directory));
|
|
34659
34707
|
assertPrivateDirectory(directory);
|
|
34660
34708
|
return directory;
|
|
@@ -34663,11 +34711,11 @@ function registerStableConfigurationRoot(context) {
|
|
|
34663
34711
|
if (context.kind !== "stable") return;
|
|
34664
34712
|
const directory = ownerDirectory(context);
|
|
34665
34713
|
const registry = import_node_path4.default.join(directory, "stable-root.json");
|
|
34666
|
-
const registryFd = (0,
|
|
34714
|
+
const registryFd = (0, import_node_fs7.openSync)(import_node_path4.default.join(directory, "stable-root.lock"), import_node_fs7.constants.O_CREAT | import_node_fs7.constants.O_RDWR | import_node_fs7.constants.O_NOFOLLOW, 384);
|
|
34667
34715
|
try {
|
|
34668
|
-
assertPrivateDescriptor(registryFd);
|
|
34716
|
+
assertPrivateDescriptor(registryFd, void 0, import_node_path4.default.join(directory, "stable-root.lock"));
|
|
34669
34717
|
if (!(0, import_fs_native_extensions.tryLock)(registryFd)) throw new ConfigurationError("CONFIG_ROOT_REGISTRATION_BUSY");
|
|
34670
|
-
if ((0,
|
|
34718
|
+
if ((0, import_node_fs7.existsSync)(registry)) {
|
|
34671
34719
|
let stored;
|
|
34672
34720
|
try {
|
|
34673
34721
|
stored = JSON.parse(readPrivateFile(registry));
|
|
@@ -34677,34 +34725,29 @@ function registerStableConfigurationRoot(context) {
|
|
|
34677
34725
|
if (!stored || typeof stored !== "object" || !("root" in stored) || stored.root !== canonicalPath(context.configRoot)) throw new ConfigurationError("CONFIG_STABLE_ROOT_CONFLICT");
|
|
34678
34726
|
} else {
|
|
34679
34727
|
const temporary = `${registry}.${(0, import_node_crypto3.randomUUID)()}.tmp`;
|
|
34680
|
-
const file = (0,
|
|
34728
|
+
const file = (0, import_node_fs7.openSync)(temporary, "wx", 384);
|
|
34681
34729
|
try {
|
|
34682
|
-
(0,
|
|
34683
|
-
(0,
|
|
34730
|
+
(0, import_node_fs7.writeFileSync)(file, JSON.stringify({ root: canonicalPath(context.configRoot) }));
|
|
34731
|
+
(0, import_node_fs7.fsyncSync)(file);
|
|
34684
34732
|
} finally {
|
|
34685
|
-
(0,
|
|
34686
|
-
}
|
|
34687
|
-
(0, import_node_fs6.renameSync)(temporary, registry);
|
|
34688
|
-
const parent = (0, import_node_fs6.openSync)(directory, "r");
|
|
34689
|
-
try {
|
|
34690
|
-
(0, import_node_fs6.fsyncSync)(parent);
|
|
34691
|
-
} finally {
|
|
34692
|
-
(0, import_node_fs6.closeSync)(parent);
|
|
34733
|
+
(0, import_node_fs7.closeSync)(file);
|
|
34693
34734
|
}
|
|
34735
|
+
(0, import_node_fs7.renameSync)(temporary, registry);
|
|
34736
|
+
syncDirectory(directory);
|
|
34694
34737
|
}
|
|
34695
34738
|
} finally {
|
|
34696
|
-
(0,
|
|
34739
|
+
(0, import_node_fs7.closeSync)(registryFd);
|
|
34697
34740
|
}
|
|
34698
34741
|
}
|
|
34699
34742
|
function withUpgradeGate(context, shared, run) {
|
|
34700
34743
|
const directory = ownerDirectory(context);
|
|
34701
|
-
const fd = (0,
|
|
34744
|
+
const fd = (0, import_node_fs7.openSync)(import_node_path4.default.join(directory, "configuration-upgrade.lock"), import_node_fs7.constants.O_CREAT | import_node_fs7.constants.O_RDWR | import_node_fs7.constants.O_NOFOLLOW, 384);
|
|
34702
34745
|
try {
|
|
34703
|
-
assertPrivateDescriptor(fd);
|
|
34746
|
+
assertPrivateDescriptor(fd, void 0, import_node_path4.default.join(directory, "configuration-upgrade.lock"));
|
|
34704
34747
|
if (!(0, import_fs_native_extensions.tryLock)(fd, 0, 0, { shared })) throw new ConfigurationError("CONFIG_UPGRADE_BUSY");
|
|
34705
34748
|
return run();
|
|
34706
34749
|
} finally {
|
|
34707
|
-
(0,
|
|
34750
|
+
(0, import_node_fs7.closeSync)(fd);
|
|
34708
34751
|
}
|
|
34709
34752
|
}
|
|
34710
34753
|
function withConfigurationUpgradeOwnership(context, run, ignoredRoles = []) {
|
|
@@ -34712,16 +34755,16 @@ function withConfigurationUpgradeOwnership(context, run, ignoredRoles = []) {
|
|
|
34712
34755
|
const directory = ownerDirectory(context);
|
|
34713
34756
|
const held = [];
|
|
34714
34757
|
try {
|
|
34715
|
-
for (const file of (0,
|
|
34758
|
+
for (const file of (0, import_node_fs7.readdirSync)(directory).filter((name) => name.endsWith(".owner.lock"))) {
|
|
34716
34759
|
if (ignoredRoles.includes(file.replace(/\.owner\.lock$/, ""))) continue;
|
|
34717
|
-
const fd = (0,
|
|
34760
|
+
const fd = (0, import_node_fs7.openSync)(import_node_path4.default.join(directory, file), import_node_fs7.constants.O_RDWR | import_node_fs7.constants.O_NOFOLLOW);
|
|
34718
34761
|
held.push(fd);
|
|
34719
|
-
assertPrivateDescriptor(fd);
|
|
34762
|
+
assertPrivateDescriptor(fd, void 0, import_node_path4.default.join(directory, file));
|
|
34720
34763
|
if (!(0, import_fs_native_extensions.tryLock)(fd)) throw new ConfigurationError("CONFIG_UPGRADE_CONSUMER_RUNNING", [file.replace(/\.owner\.lock$/, "")]);
|
|
34721
34764
|
}
|
|
34722
34765
|
return run();
|
|
34723
34766
|
} finally {
|
|
34724
|
-
for (const fd of held) (0,
|
|
34767
|
+
for (const fd of held) (0, import_node_fs7.closeSync)(fd);
|
|
34725
34768
|
}
|
|
34726
34769
|
});
|
|
34727
34770
|
}
|
|
@@ -34730,16 +34773,16 @@ function acquireConfigurationOwner(context, role) {
|
|
|
34730
34773
|
}
|
|
34731
34774
|
function acquireOwner(context, role) {
|
|
34732
34775
|
const directory = ownerDirectory(context);
|
|
34733
|
-
const fd = (0,
|
|
34776
|
+
const fd = (0, import_node_fs7.openSync)(import_node_path4.default.join(directory, `${role}.owner.lock`), import_node_fs7.constants.O_CREAT | import_node_fs7.constants.O_RDWR | import_node_fs7.constants.O_NOFOLLOW, 384);
|
|
34734
34777
|
let closed = false;
|
|
34735
34778
|
const release = () => {
|
|
34736
34779
|
if (!closed) {
|
|
34737
34780
|
closed = true;
|
|
34738
|
-
(0,
|
|
34781
|
+
(0, import_node_fs7.closeSync)(fd);
|
|
34739
34782
|
}
|
|
34740
34783
|
};
|
|
34741
34784
|
try {
|
|
34742
|
-
assertPrivateDescriptor(fd);
|
|
34785
|
+
assertPrivateDescriptor(fd, void 0, import_node_path4.default.join(directory, `${role}.owner.lock`));
|
|
34743
34786
|
if (!(0, import_fs_native_extensions.tryLock)(fd)) throw new ConfigurationError("CONFIG_INSTANCE_ALREADY_RUNNING", [role]);
|
|
34744
34787
|
registerStableConfigurationRoot(context);
|
|
34745
34788
|
return { release };
|
|
@@ -35062,7 +35105,7 @@ function migrateConfigurationDocument(document2) {
|
|
|
35062
35105
|
}
|
|
35063
35106
|
|
|
35064
35107
|
// packages/config-node/src/store.ts
|
|
35065
|
-
var
|
|
35108
|
+
var import_node_fs8 = require("node:fs");
|
|
35066
35109
|
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
35067
35110
|
var import_node_crypto4 = require("node:crypto");
|
|
35068
35111
|
var import_yaml = __toESM(require_dist(), 1);
|
|
@@ -35086,6 +35129,8 @@ function isConfigurationContainer(key, array = false) {
|
|
|
35086
35129
|
});
|
|
35087
35130
|
}
|
|
35088
35131
|
function domainForPath(key) {
|
|
35132
|
+
const declared = Object.keys(CONFIGURATION_DOMAIN_VERSIONS).find((domain) => key === domain || key.startsWith(`${domain}.`));
|
|
35133
|
+
if (declared) return declared;
|
|
35089
35134
|
const parts = key.split(".");
|
|
35090
35135
|
return ["backend", "services", "desktop", "agents"].includes(parts[0]) ? parts.slice(0, 2).join(".") : parts[0];
|
|
35091
35136
|
}
|
|
@@ -35254,11 +35299,12 @@ function parseConfigurationYaml(source, context) {
|
|
|
35254
35299
|
return { document: document2, value, digest: (0, import_node_crypto4.createHash)("sha256").update(source).digest("hex"), issues: validateDomains(value, context) };
|
|
35255
35300
|
}
|
|
35256
35301
|
function assertPrivateFile(file, fd) {
|
|
35257
|
-
const
|
|
35258
|
-
if (!
|
|
35259
|
-
if (typeof process.getuid === "function" &&
|
|
35260
|
-
if ((
|
|
35261
|
-
|
|
35302
|
+
const stat3 = fd === void 0 ? (0, import_node_fs8.lstatSync)(file) : (0, import_node_fs8.fstatSync)(fd);
|
|
35303
|
+
if (!stat3.isFile() || stat3.isSymbolicLink() || stat3.nlink !== 1) throw new ConfigurationError("CONFIG_FILE_NOT_PRIVATE_REGULAR");
|
|
35304
|
+
if (typeof process.getuid === "function" && stat3.uid !== process.getuid()) throw new ConfigurationError("CONFIG_FILE_OWNER_MISMATCH");
|
|
35305
|
+
if (process.platform !== "win32" && (stat3.mode & 63) !== 0) throw new ConfigurationError("CONFIG_FILE_PERMISSIONS_INVALID");
|
|
35306
|
+
assertWindowsPrivatePath(file);
|
|
35307
|
+
if (stat3.size > MAX_BYTES) throw new ConfigurationError("CONFIG_FILE_TOO_LARGE", [], { line: 1, column: 1 });
|
|
35262
35308
|
}
|
|
35263
35309
|
var ConfigurationStore = class {
|
|
35264
35310
|
constructor(context) {
|
|
@@ -35267,30 +35313,29 @@ var ConfigurationStore = class {
|
|
|
35267
35313
|
}
|
|
35268
35314
|
file;
|
|
35269
35315
|
read() {
|
|
35270
|
-
if (!(0,
|
|
35271
|
-
|
|
35272
|
-
if (!root.isDirectory() || root.isSymbolicLink() || root.mode & 63 || typeof process.getuid === "function" && root.uid !== process.getuid()) throw new ConfigurationError("CONFIG_ROOT_PERMISSIONS_INVALID");
|
|
35316
|
+
if (!(0, import_node_fs8.existsSync)(this.file)) throw new ConfigurationError("CONFIG_MIGRATION_REQUIRED");
|
|
35317
|
+
assertPrivateDirectory(this.context.configRoot);
|
|
35273
35318
|
assertPrivateFile(this.file);
|
|
35274
|
-
const fd = (0,
|
|
35319
|
+
const fd = (0, import_node_fs8.openSync)(this.file, import_node_fs8.constants.O_RDONLY | import_node_fs8.constants.O_NOFOLLOW);
|
|
35275
35320
|
try {
|
|
35276
35321
|
assertPrivateFile(this.file, fd);
|
|
35277
|
-
return parseConfigurationYaml((0,
|
|
35322
|
+
return parseConfigurationYaml((0, import_node_fs8.readFileSync)(fd, "utf8"), this.context);
|
|
35278
35323
|
} finally {
|
|
35279
|
-
(0,
|
|
35324
|
+
(0, import_node_fs8.closeSync)(fd);
|
|
35280
35325
|
}
|
|
35281
35326
|
}
|
|
35282
35327
|
locked(run) {
|
|
35283
|
-
(0,
|
|
35284
|
-
const dirStat = (0,
|
|
35328
|
+
(0, import_node_fs8.mkdirSync)(this.context.configRoot, { recursive: true, mode: 448 });
|
|
35329
|
+
const dirStat = (0, import_node_fs8.lstatSync)(this.context.configRoot);
|
|
35285
35330
|
if (!dirStat.isDirectory() || dirStat.isSymbolicLink() || typeof process.getuid === "function" && dirStat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_ROOT_OWNER_MISMATCH");
|
|
35286
|
-
|
|
35287
|
-
const fd = (0,
|
|
35331
|
+
assertPrivateDirectory(this.context.configRoot);
|
|
35332
|
+
const fd = (0, import_node_fs8.openSync)(import_node_path6.default.join(this.context.configRoot, "settings.lock"), import_node_fs8.constants.O_CREAT | import_node_fs8.constants.O_RDWR | import_node_fs8.constants.O_NOFOLLOW, 384);
|
|
35288
35333
|
try {
|
|
35289
35334
|
assertPrivateFile(import_node_path6.default.join(this.context.configRoot, "settings.lock"), fd);
|
|
35290
35335
|
if (!(0, import_fs_native_extensions2.tryLock)(fd)) throw new ConfigurationError("CONFIG_WRITE_BUSY");
|
|
35291
35336
|
return run();
|
|
35292
35337
|
} finally {
|
|
35293
|
-
(0,
|
|
35338
|
+
(0, import_node_fs8.closeSync)(fd);
|
|
35294
35339
|
}
|
|
35295
35340
|
}
|
|
35296
35341
|
publish(document2, previous, backupId) {
|
|
@@ -35300,41 +35345,35 @@ var ConfigurationStore = class {
|
|
|
35300
35345
|
const temporary = `${this.file}.${(0, import_node_crypto4.randomUUID)()}.tmp`;
|
|
35301
35346
|
if (previous !== void 0) {
|
|
35302
35347
|
const backupRoot = import_node_path6.default.join(this.context.configRoot, "config-backups");
|
|
35303
|
-
(0,
|
|
35304
|
-
|
|
35305
|
-
if (!backupStat.isDirectory() || backupStat.isSymbolicLink() || backupStat.mode & 63 || typeof process.getuid === "function" && backupStat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_BACKUP_ROOT_INVALID");
|
|
35348
|
+
(0, import_node_fs8.mkdirSync)(backupRoot, { recursive: true, mode: 448 });
|
|
35349
|
+
assertPrivateDirectory(backupRoot);
|
|
35306
35350
|
const backup = import_node_path6.default.join(backupRoot, backupId ?? `${Date.now()}-${(0, import_node_crypto4.randomUUID)()}.yaml`);
|
|
35307
|
-
const fd2 = (0,
|
|
35351
|
+
const fd2 = (0, import_node_fs8.openSync)(backup, "wx", 384);
|
|
35308
35352
|
try {
|
|
35309
|
-
(0,
|
|
35310
|
-
(0,
|
|
35353
|
+
(0, import_node_fs8.writeFileSync)(fd2, previous);
|
|
35354
|
+
(0, import_node_fs8.fsyncSync)(fd2);
|
|
35311
35355
|
} finally {
|
|
35312
|
-
(0,
|
|
35356
|
+
(0, import_node_fs8.closeSync)(fd2);
|
|
35313
35357
|
}
|
|
35314
35358
|
}
|
|
35315
|
-
const fd = (0,
|
|
35359
|
+
const fd = (0, import_node_fs8.openSync)(temporary, "wx", 384);
|
|
35316
35360
|
try {
|
|
35317
|
-
(0,
|
|
35318
|
-
(0,
|
|
35361
|
+
(0, import_node_fs8.writeFileSync)(fd, source);
|
|
35362
|
+
(0, import_node_fs8.fsyncSync)(fd);
|
|
35319
35363
|
} finally {
|
|
35320
|
-
(0,
|
|
35364
|
+
(0, import_node_fs8.closeSync)(fd);
|
|
35321
35365
|
}
|
|
35322
35366
|
try {
|
|
35323
|
-
(0,
|
|
35324
|
-
|
|
35325
|
-
try {
|
|
35326
|
-
(0, import_node_fs7.fsyncSync)(parent);
|
|
35327
|
-
} finally {
|
|
35328
|
-
(0, import_node_fs7.closeSync)(parent);
|
|
35329
|
-
}
|
|
35367
|
+
(0, import_node_fs8.renameSync)(temporary, this.file);
|
|
35368
|
+
syncDirectory(this.context.configRoot);
|
|
35330
35369
|
} finally {
|
|
35331
|
-
if ((0,
|
|
35370
|
+
if ((0, import_node_fs8.existsSync)(temporary)) (0, import_node_fs8.unlinkSync)(temporary);
|
|
35332
35371
|
}
|
|
35333
35372
|
return checked;
|
|
35334
35373
|
}
|
|
35335
35374
|
initialize(value) {
|
|
35336
35375
|
return this.locked(() => {
|
|
35337
|
-
if ((0,
|
|
35376
|
+
if ((0, import_node_fs8.existsSync)(this.file)) throw new ConfigurationError("CONFIG_ALREADY_EXISTS");
|
|
35338
35377
|
validateEnvelope(value, this.context);
|
|
35339
35378
|
const issues = validateDomains(value, this.context);
|
|
35340
35379
|
if (Object.keys(issues).length) throw new ConfigurationError("CONFIG_VALIDATION_FAILED", Object.values(issues).flat().map((item) => item.path));
|
|
@@ -35374,9 +35413,9 @@ var ConfigurationStore = class {
|
|
|
35374
35413
|
}
|
|
35375
35414
|
backups() {
|
|
35376
35415
|
const root = import_node_path6.default.join(this.context.configRoot, "config-backups");
|
|
35377
|
-
if (!(0,
|
|
35416
|
+
if (!(0, import_node_fs8.existsSync)(root)) return [];
|
|
35378
35417
|
assertPrivateDirectory(root);
|
|
35379
|
-
return (0,
|
|
35418
|
+
return (0, import_node_fs8.readdirSync)(root).filter((id) => /^\d+-[a-f0-9-]+\.yaml$/.test(id)).sort().reverse().map((id) => {
|
|
35380
35419
|
try {
|
|
35381
35420
|
const backup = this.readBackup(id);
|
|
35382
35421
|
return { id, revision: backup.value.revision, schemaVersion: backup.value.schemaVersion, compatible: true };
|
|
@@ -35454,23 +35493,18 @@ var ConfigurationStore = class {
|
|
|
35454
35493
|
recordUpgrade(value) {
|
|
35455
35494
|
const file = import_node_path6.default.join(this.context.configRoot, "config-upgrade.json");
|
|
35456
35495
|
const temporary = `${file}.${(0, import_node_crypto4.randomUUID)()}.tmp`;
|
|
35457
|
-
const fd = (0,
|
|
35496
|
+
const fd = (0, import_node_fs8.openSync)(temporary, "wx", 384);
|
|
35458
35497
|
try {
|
|
35459
|
-
(0,
|
|
35460
|
-
(0,
|
|
35498
|
+
(0, import_node_fs8.writeFileSync)(fd, JSON.stringify(value, null, 2) + "\n");
|
|
35499
|
+
(0, import_node_fs8.fsyncSync)(fd);
|
|
35461
35500
|
} finally {
|
|
35462
|
-
(0,
|
|
35501
|
+
(0, import_node_fs8.closeSync)(fd);
|
|
35463
35502
|
}
|
|
35464
35503
|
try {
|
|
35465
|
-
(0,
|
|
35466
|
-
|
|
35467
|
-
try {
|
|
35468
|
-
(0, import_node_fs7.fsyncSync)(parent);
|
|
35469
|
-
} finally {
|
|
35470
|
-
(0, import_node_fs7.closeSync)(parent);
|
|
35471
|
-
}
|
|
35504
|
+
(0, import_node_fs8.renameSync)(temporary, file);
|
|
35505
|
+
syncDirectory(this.context.configRoot);
|
|
35472
35506
|
} finally {
|
|
35473
|
-
if ((0,
|
|
35507
|
+
if ((0, import_node_fs8.existsSync)(temporary)) (0, import_node_fs8.unlinkSync)(temporary);
|
|
35474
35508
|
}
|
|
35475
35509
|
}
|
|
35476
35510
|
upgrade(expected) {
|
|
@@ -35479,7 +35513,7 @@ var ConfigurationStore = class {
|
|
|
35479
35513
|
if (preview.expectedRevision !== expected.revision || preview.expectedDigest !== expected.digest) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
|
|
35480
35514
|
if (!preview.changed) {
|
|
35481
35515
|
const receiptFile = import_node_path6.default.join(this.context.configRoot, "config-upgrade.json");
|
|
35482
|
-
if ((0,
|
|
35516
|
+
if ((0, import_node_fs8.existsSync)(receiptFile)) {
|
|
35483
35517
|
const receipt = JSON.parse(readPrivateFile(receiptFile));
|
|
35484
35518
|
if (isConfigurationObject(receipt) && receipt.phase === "prepared" && receipt.plannedDigest === expected.digest)
|
|
35485
35519
|
this.recordUpgrade({ ...receipt, phase: "committed", savedRevision: expected.revision, digest: expected.digest });
|
|
@@ -35513,9 +35547,9 @@ var ConfigurationStore = class {
|
|
|
35513
35547
|
previous(keys) {
|
|
35514
35548
|
const current = this.read();
|
|
35515
35549
|
const root = import_node_path6.default.join(this.context.configRoot, "config-backups");
|
|
35516
|
-
if (!(0,
|
|
35550
|
+
if (!(0, import_node_fs8.existsSync)(root)) throw new ConfigurationError("CONFIG_BACKUP_UNAVAILABLE");
|
|
35517
35551
|
assertPrivateDirectory(root);
|
|
35518
|
-
const candidates = (0,
|
|
35552
|
+
const candidates = (0, import_node_fs8.readdirSync)(root).filter((file) => /^\d+-[a-f0-9-]+\.yaml$/.test(file)).sort().reverse();
|
|
35519
35553
|
for (const candidate of candidates) {
|
|
35520
35554
|
const file = import_node_path6.default.join(root, candidate);
|
|
35521
35555
|
const previous = parseConfigurationYaml(readPrivateFile(file), this.context);
|
|
@@ -35527,7 +35561,7 @@ var ConfigurationStore = class {
|
|
|
35527
35561
|
}
|
|
35528
35562
|
migrate(value, expected) {
|
|
35529
35563
|
return this.locked(() => {
|
|
35530
|
-
const current = (0,
|
|
35564
|
+
const current = (0, import_node_fs8.existsSync)(this.file) ? this.read() : null;
|
|
35531
35565
|
if (current ? !expected || current.value.revision !== expected.revision || current.digest !== expected.digest : expected !== null) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
|
|
35532
35566
|
validateEnvelope(value, this.context);
|
|
35533
35567
|
const issues = validateDomains(value, this.context);
|
|
@@ -35741,7 +35775,7 @@ function configurationPath(key, relativeDefault) {
|
|
|
35741
35775
|
}
|
|
35742
35776
|
|
|
35743
35777
|
// packages/config-node/src/runtime-status.ts
|
|
35744
|
-
var
|
|
35778
|
+
var import_node_fs9 = require("node:fs");
|
|
35745
35779
|
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
35746
35780
|
|
|
35747
35781
|
// packages/shared/src/monitoring/runtime-version.ts
|
|
@@ -35794,23 +35828,23 @@ function readInstalledRuntimeBuild(entry) {
|
|
|
35794
35828
|
const root = entry.slice(0, index);
|
|
35795
35829
|
const relative = entry.slice(index + marker.length).split(import_node_path8.default.sep).slice(1);
|
|
35796
35830
|
const pointer = import_node_path8.default.join(root, "current.json");
|
|
35797
|
-
if ((0,
|
|
35798
|
-
const selected = JSON.parse((0,
|
|
35831
|
+
if ((0, import_node_fs9.existsSync)(pointer)) {
|
|
35832
|
+
const selected = JSON.parse((0, import_node_fs9.readFileSync)(pointer, "utf8"));
|
|
35799
35833
|
if (!/^[a-zA-Z0-9._-]+$/.test(selected.releaseId) || [".", ".."].includes(selected.releaseId)) return null;
|
|
35800
35834
|
entry = import_node_path8.default.join(root, "releases", selected.releaseId, ...relative);
|
|
35801
35835
|
}
|
|
35802
35836
|
}
|
|
35803
|
-
fd = (0,
|
|
35837
|
+
fd = (0, import_node_fs9.openSync)(entry, "r");
|
|
35804
35838
|
const buffer = Buffer.alloc(8192);
|
|
35805
|
-
const length = (0,
|
|
35839
|
+
const length = (0, import_node_fs9.readSync)(fd, buffer, 0, buffer.length, 0);
|
|
35806
35840
|
const match = buffer.subarray(0, length).toString("utf8").split("\n", 1)[0]?.match(/var __RUNWEAVE_BUILD_INFO__=(\{.*\});/);
|
|
35807
35841
|
const metadata = import_node_path8.default.join(import_node_path8.default.dirname(entry), "release.json");
|
|
35808
|
-
const value = match ? JSON.parse(match[1]) : JSON.parse((0,
|
|
35842
|
+
const value = match ? JSON.parse(match[1]) : JSON.parse((0, import_node_fs9.readFileSync)((0, import_node_fs9.existsSync)(metadata) ? metadata : import_node_path8.default.join(import_node_path8.default.dirname(entry), "build-info.json"), "utf8"));
|
|
35809
35843
|
return typeof value.version === "string" && typeof value.buildId === "string" ? value : null;
|
|
35810
35844
|
} catch {
|
|
35811
35845
|
return null;
|
|
35812
35846
|
} finally {
|
|
35813
|
-
if (fd !== void 0) (0,
|
|
35847
|
+
if (fd !== void 0) (0, import_node_fs9.closeSync)(fd);
|
|
35814
35848
|
}
|
|
35815
35849
|
}
|
|
35816
35850
|
|
|
@@ -35910,8 +35944,8 @@ var PiSessionReader = class {
|
|
|
35910
35944
|
try {
|
|
35911
35945
|
if (await (0, import_promises4.realpath)(file) !== file) return null;
|
|
35912
35946
|
handle = await (0, import_promises4.open)(file, "r");
|
|
35913
|
-
const
|
|
35914
|
-
if (!
|
|
35947
|
+
const stat3 = await handle.stat();
|
|
35948
|
+
if (!stat3.isFile() || stat3.size > 64 * 1024 * 1024) return null;
|
|
35915
35949
|
const content = await handle.readFile("utf8");
|
|
35916
35950
|
const lines = content.split("\n");
|
|
35917
35951
|
lines.pop();
|
|
@@ -36041,7 +36075,7 @@ ${entry.summary}`
|
|
|
36041
36075
|
preview,
|
|
36042
36076
|
status: status === "running" ? "active" : status === "idle" ? "idle" : "notLoaded",
|
|
36043
36077
|
createdAt: String(header.timestamp ?? ""),
|
|
36044
|
-
updatedAt: new Date(
|
|
36078
|
+
updatedAt: new Date(stat3.mtimeMs).toISOString(),
|
|
36045
36079
|
turns
|
|
36046
36080
|
},
|
|
36047
36081
|
latest
|
|
@@ -36408,15 +36442,15 @@ var ThreadPreviewReader = class {
|
|
|
36408
36442
|
}
|
|
36409
36443
|
const handle = await (0, import_promises6.open)(file, "r");
|
|
36410
36444
|
try {
|
|
36411
|
-
const
|
|
36412
|
-
if (!
|
|
36445
|
+
const stat3 = await handle.stat();
|
|
36446
|
+
if (!stat3.isFile()) {
|
|
36413
36447
|
entry.ready = false;
|
|
36414
36448
|
entry.availability = "source_missing";
|
|
36415
36449
|
return;
|
|
36416
36450
|
}
|
|
36417
|
-
if (entry.file !== file || entry.inode !==
|
|
36451
|
+
if (entry.file !== file || entry.inode !== stat3.ino || stat3.size < entry.offset) {
|
|
36418
36452
|
entry.file = file;
|
|
36419
|
-
entry.inode =
|
|
36453
|
+
entry.inode = stat3.ino;
|
|
36420
36454
|
entry.offset = 0;
|
|
36421
36455
|
entry.pending = Buffer.alloc(0);
|
|
36422
36456
|
entry.skippingLine = false;
|
|
@@ -36428,11 +36462,11 @@ var ThreadPreviewReader = class {
|
|
|
36428
36462
|
entry.leaf = null;
|
|
36429
36463
|
entry.piCursor = null;
|
|
36430
36464
|
}
|
|
36431
|
-
const buffer = Buffer.alloc(Math.min(READ_BYTES,
|
|
36465
|
+
const buffer = Buffer.alloc(Math.min(READ_BYTES, stat3.size - entry.offset));
|
|
36432
36466
|
const { bytesRead } = await handle.read(buffer, 0, buffer.length, entry.offset);
|
|
36433
36467
|
entry.offset += bytesRead;
|
|
36434
36468
|
this.consume(entry, buffer.subarray(0, bytesRead));
|
|
36435
|
-
if (entry.offset <
|
|
36469
|
+
if (entry.offset < stat3.size) {
|
|
36436
36470
|
this.queued.add(entry);
|
|
36437
36471
|
return;
|
|
36438
36472
|
}
|
|
@@ -36938,8 +36972,8 @@ var CodexQuotaService = class {
|
|
|
36938
36972
|
};
|
|
36939
36973
|
|
|
36940
36974
|
// app-server/src/codex/client.ts
|
|
36941
|
-
var
|
|
36942
|
-
var
|
|
36975
|
+
var import_node_child_process2 = require("node:child_process");
|
|
36976
|
+
var import_node_fs10 = require("node:fs");
|
|
36943
36977
|
var import_node_os4 = __toESM(require("node:os"), 1);
|
|
36944
36978
|
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
36945
36979
|
|
|
@@ -37200,7 +37234,7 @@ var CodexAppServerClient = class {
|
|
|
37200
37234
|
this.stdoutBuffer = "";
|
|
37201
37235
|
this.stderrBuffer = "";
|
|
37202
37236
|
const launchPlan = resolveCodexLaunchPlan(process.env);
|
|
37203
|
-
this.child = (0,
|
|
37237
|
+
this.child = (0, import_node_child_process2.spawn)(launchPlan.command, launchPlan.args, {
|
|
37204
37238
|
env: buildCodexProcessEnv(process.env, launchPlan),
|
|
37205
37239
|
stdio: ["pipe", "pipe", "pipe"]
|
|
37206
37240
|
});
|
|
@@ -37329,7 +37363,7 @@ function resolveCodexBinaryCandidates(env) {
|
|
|
37329
37363
|
}
|
|
37330
37364
|
function resolveNvmCodexCandidates(nodeVersionsDir) {
|
|
37331
37365
|
try {
|
|
37332
|
-
return (0,
|
|
37366
|
+
return (0, import_node_fs10.readdirSync)(nodeVersionsDir).map((entry) => import_node_path15.default.join(nodeVersionsDir, entry, "bin", "codex")).sort((left, right) => readMtimeMs(right) - readMtimeMs(left));
|
|
37333
37367
|
} catch {
|
|
37334
37368
|
return [];
|
|
37335
37369
|
}
|
|
@@ -37353,6 +37387,7 @@ var import_promises9 = require("node:fs/promises");
|
|
|
37353
37387
|
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
37354
37388
|
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
37355
37389
|
var ROLLOUT_TAIL_BYTES = 1024 * 1024;
|
|
37390
|
+
var ROLLOUT_LOOKBACK_BYTES = 64 * ROLLOUT_TAIL_BYTES;
|
|
37356
37391
|
var TERMINAL_LIFECYCLE_TYPES = /* @__PURE__ */ new Set([
|
|
37357
37392
|
"task_started",
|
|
37358
37393
|
"task_complete",
|
|
@@ -37378,13 +37413,11 @@ var CodexRolloutLifecycleReader = class {
|
|
|
37378
37413
|
}
|
|
37379
37414
|
try {
|
|
37380
37415
|
const previous = this.snapshots.get(threadId);
|
|
37381
|
-
const
|
|
37382
|
-
if (tail.content === null) return previous.lifecycle;
|
|
37383
|
-
const lifecycle = parseLatestLifecycle(tail.content);
|
|
37416
|
+
const snapshot = await readFileLifecycle(filePath, previous);
|
|
37384
37417
|
this.snapshots.delete(threadId);
|
|
37385
|
-
this.snapshots.set(threadId,
|
|
37418
|
+
this.snapshots.set(threadId, snapshot);
|
|
37386
37419
|
if (this.snapshots.size > 128) this.snapshots.delete(this.snapshots.keys().next().value);
|
|
37387
|
-
return lifecycle;
|
|
37420
|
+
return snapshot.lifecycle;
|
|
37388
37421
|
} catch {
|
|
37389
37422
|
this.threadPaths.delete(threadId);
|
|
37390
37423
|
this.snapshots.delete(threadId);
|
|
@@ -37417,21 +37450,32 @@ var CodexRolloutLifecycleReader = class {
|
|
|
37417
37450
|
return this.threadPaths.get(threadId) ?? [...this.threadPaths].find(([id]) => id.endsWith(`-${threadId}`))?.[1] ?? null;
|
|
37418
37451
|
}
|
|
37419
37452
|
};
|
|
37420
|
-
async function
|
|
37453
|
+
async function readFileLifecycle(filePath, previous) {
|
|
37421
37454
|
const handle = await (0, import_promises9.open)(filePath, "r");
|
|
37422
37455
|
try {
|
|
37423
37456
|
const { size, dev, ino, mtimeMs, ctimeMs } = await handle.stat();
|
|
37424
37457
|
const signature = `${filePath}:${dev}:${ino}:${size}:${mtimeMs}:${ctimeMs}`;
|
|
37425
|
-
if (signature ===
|
|
37426
|
-
const
|
|
37427
|
-
|
|
37428
|
-
|
|
37429
|
-
|
|
37430
|
-
|
|
37431
|
-
|
|
37432
|
-
|
|
37433
|
-
|
|
37434
|
-
|
|
37458
|
+
if (signature === previous?.signature) return previous;
|
|
37459
|
+
const floor = Math.max(0, size - ROLLOUT_LOOKBACK_BYTES);
|
|
37460
|
+
let end = size;
|
|
37461
|
+
let suffix = Buffer.alloc(0);
|
|
37462
|
+
let lifecycle = null;
|
|
37463
|
+
while (end > floor && !lifecycle) {
|
|
37464
|
+
const start = Math.max(floor, end - ROLLOUT_TAIL_BYTES);
|
|
37465
|
+
const buffer = Buffer.alloc(end - start);
|
|
37466
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.length, start);
|
|
37467
|
+
if (bytesRead !== buffer.length) return { signature, lifecycle: null };
|
|
37468
|
+
const value = Buffer.concat([buffer, suffix]);
|
|
37469
|
+
const boundary = start > 0 ? value.indexOf(10) : -1;
|
|
37470
|
+
const complete = start === 0 ? value : boundary < 0 ? Buffer.alloc(0) : value.subarray(boundary + 1);
|
|
37471
|
+
lifecycle = parseLatestLifecycle(complete.toString("utf8"));
|
|
37472
|
+
suffix = boundary >= 0 && boundary < ROLLOUT_TAIL_BYTES ? Buffer.from(value.subarray(0, boundary + 1)) : Buffer.alloc(0);
|
|
37473
|
+
end = start;
|
|
37474
|
+
}
|
|
37475
|
+
const current = await (0, import_promises9.stat)(filePath);
|
|
37476
|
+
if (current.dev !== dev || current.ino !== ino || current.size !== size || current.mtimeMs !== mtimeMs || current.ctimeMs !== ctimeMs)
|
|
37477
|
+
return { signature, lifecycle: null };
|
|
37478
|
+
return { signature, lifecycle };
|
|
37435
37479
|
} finally {
|
|
37436
37480
|
await handle.close();
|
|
37437
37481
|
}
|
|
@@ -37629,6 +37673,7 @@ var AgentThreadStatusReconciler = class {
|
|
|
37629
37673
|
collectCandidates() {
|
|
37630
37674
|
const cutoff = Date.now() - ACTIVE_WINDOW_MS;
|
|
37631
37675
|
return this.options.eventCenter.getStateStore().listThreads({ limit: 1e4 }).filter((thread) => RECONCILED_AGENTS.has(thread.agent)).filter((thread) => !thread.threadId.startsWith("unknown-thread:")).filter((thread) => {
|
|
37676
|
+
if (thread.status === "running") return true;
|
|
37632
37677
|
const lastActivityAtMs = Date.parse(thread.lastActivityAt);
|
|
37633
37678
|
return !Number.isFinite(lastActivityAtMs) || lastActivityAtMs >= cutoff;
|
|
37634
37679
|
}).sort(
|
|
@@ -37664,8 +37709,19 @@ var AgentThreadStatusReconciler = class {
|
|
|
37664
37709
|
const lifecycle2 = await this.options.codexRolloutLifecycleReader.readLatestLifecycle(
|
|
37665
37710
|
thread.threadId
|
|
37666
37711
|
);
|
|
37712
|
+
if (lifecycle2?.status === "running" && (thread.status === "running" || !isOlderThanThreadProjection(lifecycle2.timestamp, thread))) {
|
|
37713
|
+
return {
|
|
37714
|
+
status: "running",
|
|
37715
|
+
lifecycleType: `rollout:${lifecycle2.type}`,
|
|
37716
|
+
lifecycleCursor: lifecycle2.cursor,
|
|
37717
|
+
detailStatus: null,
|
|
37718
|
+
preview: null,
|
|
37719
|
+
turnId: lifecycle2.turnId
|
|
37720
|
+
};
|
|
37721
|
+
}
|
|
37667
37722
|
const sameObservedFailure = lifecycle2?.error && thread.status === "idle" && thread.lastLifecycleType === `rollout:${lifecycle2.type}` && thread.lastLifecycleCursor === lifecycle2.cursor;
|
|
37668
|
-
|
|
37723
|
+
const followsObservedStart = lifecycle2 && thread.lastLifecycleType === "rollout:task_started" && newerRolloutCursor(lifecycle2.cursor, thread.lastLifecycleCursor);
|
|
37724
|
+
if (lifecycle2?.status === "idle" && (!isOlderThanThreadProjection(lifecycle2.timestamp, thread) || sameObservedFailure || followsObservedStart) && // A terminal error is a fact even if a Hook already marked the thread
|
|
37669
37725
|
// idle, or thread/read still reports active. Never adopt an old turn.
|
|
37670
37726
|
(lifecycle2.error || thread.status === "running" && status !== "active")) {
|
|
37671
37727
|
return {
|
|
@@ -37784,6 +37840,11 @@ var AgentThreadStatusReconciler = class {
|
|
|
37784
37840
|
});
|
|
37785
37841
|
}
|
|
37786
37842
|
};
|
|
37843
|
+
function newerRolloutCursor(current, previous) {
|
|
37844
|
+
const currentOrdinal = current.match(/^rollout:(\d+)$/)?.[1];
|
|
37845
|
+
const previousOrdinal = previous?.match(/^rollout:(\d+)$/)?.[1];
|
|
37846
|
+
return Boolean(currentOrdinal && previousOrdinal && BigInt(currentOrdinal) > BigInt(previousOrdinal));
|
|
37847
|
+
}
|
|
37787
37848
|
function isOlderThanThreadProjection(observedAt, thread) {
|
|
37788
37849
|
const observedAtMs = Date.parse(observedAt);
|
|
37789
37850
|
const projectedAtMs = Date.parse(thread.updatedAt);
|