@runweave/server-darwin-x64 0.1.2 → 0.1.3
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 +156 -151
- 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 +191 -19
- package/payload/app-server/index.cjs.map +1 -1
- package/payload/backend/build-info.json +4 -4
- package/payload/backend/dev-resources/control.cjs +195 -20
- package/payload/backend/index.cjs +195 -19
- package/payload/backend/scheduled-tasks-sqlite-worker.cjs +11 -7
- package/payload/frontend/dist/assets/{_baseUniq-B6OtH5JH.js → _baseUniq-Z8S1OGl1.js} +1 -1
- package/payload/frontend/dist/assets/{access-CpH3nCnI.js → access-BkQls-gl.js} +1 -1
- package/payload/frontend/dist/assets/{advanced-U5MqNTD5.js → advanced-Cwuko7dT.js} +1 -1
- package/payload/frontend/dist/assets/{appearance-Cb8XjaOT.js → appearance-D1NbgiL9.js} +1 -1
- package/payload/frontend/dist/assets/{arc-CEnFQNMK.js → arc-yTzSLmPE.js} +1 -1
- package/payload/frontend/dist/assets/{architectureDiagram-Q4EWVU46-T438RyEG.js → architectureDiagram-Q4EWVU46-BvvnA771.js} +1 -1
- package/payload/frontend/dist/assets/{blockDiagram-DXYQGD6D-B6Mqb9og.js → blockDiagram-DXYQGD6D-4mSkYwEH.js} +1 -1
- package/payload/frontend/dist/assets/{c4Diagram-AHTNJAMY-CO3eA3hw.js → c4Diagram-AHTNJAMY-BFsQYjNJ.js} +1 -1
- package/payload/frontend/dist/assets/channel-DGu_xwRJ.js +1 -0
- package/payload/frontend/dist/assets/{chunk-4BX2VUAB-1vjsV_mH.js → chunk-4BX2VUAB-B4j2kD8S.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-4TB4RGXK-CtMNFDLV.js → chunk-4TB4RGXK-BHHtOn_W.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-55IACEB6-DVWWqMjZ.js → chunk-55IACEB6-npi1DjnI.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-EDXVE4YY-BBf3C6eJ.js → chunk-EDXVE4YY-6XoKXtpJ.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-FMBD7UC4-BUQfXSvf.js → chunk-FMBD7UC4-D5wdm5pu.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-OYMX7WX6-DM1nFyON.js → chunk-OYMX7WX6-CdQRrw_z.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-QZHKN3VN-Bz3CUNpU.js → chunk-QZHKN3VN-j-pcsMU1.js} +1 -1
- package/payload/frontend/dist/assets/{chunk-YZCP3GAM-Bb6CnKMv.js → chunk-YZCP3GAM-ISBm3jAD.js} +1 -1
- package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-Xx1qN_NY.js +1 -0
- package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-Xx1qN_NY.js +1 -0
- package/payload/frontend/dist/assets/clone-DdDT5GkX.js +1 -0
- package/payload/frontend/dist/assets/{connection-ChK196PA.js → connection-BL2ZiJKS.js} +1 -1
- package/payload/frontend/dist/assets/{connections-1OP6Izpn.js → connections-BuXymnab.js} +1 -1
- package/payload/frontend/dist/assets/{cose-bilkent-S5V4N54A-DvX1W1oQ.js → cose-bilkent-S5V4N54A-D3ioXA7D.js} +1 -1
- package/payload/frontend/dist/assets/{dagre-KV5264BT-BYV7l80W.js → dagre-KV5264BT-DjtjEtE5.js} +1 -1
- package/payload/frontend/dist/assets/{desktop-DKYPd_Z3.js → desktop-Du3Gd9LW.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-5BDNPKRD-BU_VxMcA.js → diagram-5BDNPKRD-CtxPyS9C.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-G4DWMVQ6-6jnkLcPr.js → diagram-G4DWMVQ6-ikqU0pq3.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-MMDJMWI5-DAjbbS4T.js → diagram-MMDJMWI5-CoKNp7eo.js} +1 -1
- package/payload/frontend/dist/assets/{diagram-TYMM5635-p2T86-Pr.js → diagram-TYMM5635-7xoHFg4D.js} +1 -1
- package/payload/frontend/dist/assets/{erDiagram-SMLLAGMA-DcZPoxkO.js → erDiagram-SMLLAGMA-Da8Jm4bc.js} +1 -1
- package/payload/frontend/dist/assets/{flowDiagram-DWJPFMVM-CDB-5IUB.js → flowDiagram-DWJPFMVM-bcIflYKx.js} +1 -1
- package/payload/frontend/dist/assets/{ganttDiagram-T4ZO3ILL-imCnxO5S.js → ganttDiagram-T4ZO3ILL-CCSwpL4k.js} +1 -1
- package/payload/frontend/dist/assets/{gitGraphDiagram-UUTBAWPF-DW7bWVfm.js → gitGraphDiagram-UUTBAWPF-C5YN1uxh.js} +1 -1
- package/payload/frontend/dist/assets/{graph-rPoUAwm2.js → graph-DhVKaWIc.js} +1 -1
- package/payload/frontend/dist/assets/{image-pt4OUNUX.js → image-CAXFSZmt.js} +1 -1
- package/payload/frontend/dist/assets/{index-CpU0rt1e.js → index-BPgmi_HT.js} +5 -5
- package/payload/frontend/dist/assets/{infoDiagram-42DDH7IO-C6DYDEhQ.js → infoDiagram-42DDH7IO-CKUkVeJd.js} +1 -1
- package/payload/frontend/dist/assets/{ishikawaDiagram-UXIWVN3A-o3dlbDPW.js → ishikawaDiagram-UXIWVN3A-Cu6SCNrB.js} +1 -1
- package/payload/frontend/dist/assets/{journeyDiagram-VCZTEJTY-ukG3M2cI.js → journeyDiagram-VCZTEJTY-BJsUgp8J.js} +1 -1
- package/payload/frontend/dist/assets/{kanban-definition-6JOO6SKY-CzFLztFd.js → kanban-definition-6JOO6SKY-BGowhqfi.js} +1 -1
- package/payload/frontend/dist/assets/{layout-C8SEMYSj.js → layout-CunOX6M2.js} +1 -1
- package/payload/frontend/dist/assets/{linear-DY8vPita.js → linear-C_0D1AIt.js} +1 -1
- package/payload/frontend/dist/assets/{main-B_ifx48h.js → main-D9JUBZrL.js} +139 -139
- package/payload/frontend/dist/assets/{min-9StlgeN8.js → min-CYRFaNhC.js} +1 -1
- package/payload/frontend/dist/assets/{mindmap-definition-QFDTVHPH-CyJisFtS.js → mindmap-definition-QFDTVHPH-CC29vHKR.js} +1 -1
- package/payload/frontend/dist/assets/{monitoring-Bjm0etKL.js → monitoring-CSJEFZ4D.js} +1 -1
- package/payload/frontend/dist/assets/{notifications-DhRLCgMU.js → notifications-B6plZwi5.js} +1 -1
- package/payload/frontend/dist/assets/{pieDiagram-DEJITSTG-DHSht7rk.js → pieDiagram-DEJITSTG-ZPTChlGS.js} +1 -1
- package/payload/frontend/dist/assets/{quadrantDiagram-34T5L4WZ-92xIujrE.js → quadrantDiagram-34T5L4WZ-B4sL0Weo.js} +1 -1
- package/payload/frontend/dist/assets/{record-content-Cy_dPSdi.js → record-content-DBb8tU0P.js} +1 -1
- package/payload/frontend/dist/assets/{requirementDiagram-MS252O5E-CXuOqrNd.js → requirementDiagram-MS252O5E-Q2PHuGEG.js} +1 -1
- package/payload/frontend/dist/assets/{sankeyDiagram-XADWPNL6-DR-mjY0Y.js → sankeyDiagram-XADWPNL6-k8w1jlHT.js} +1 -1
- package/payload/frontend/dist/assets/{sequenceDiagram-FGHM5R23-DmmUpAoP.js → sequenceDiagram-FGHM5R23-0qPxopqC.js} +1 -1
- package/payload/frontend/dist/assets/{stateDiagram-FHFEXIEX-CKoqQ0-j.js → stateDiagram-FHFEXIEX-BHxYXi2c.js} +1 -1
- package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-s5VUMcqx.js +1 -0
- package/payload/frontend/dist/assets/{status-B__OyRqS.js → status-Zy2MW6gr.js} +1 -1
- package/payload/frontend/dist/assets/suiji-5pox13NE.js +1 -0
- package/payload/frontend/dist/assets/{svg-BpvEgtI3.js → svg-vmNZnz5w.js} +1 -1
- package/payload/frontend/dist/assets/{tabs-BjCNEXFA.js → tabs-C257BfM6.js} +1 -1
- package/payload/frontend/dist/assets/{timeline-definition-GMOUNBTQ-CHT2sQNz.js → timeline-definition-GMOUNBTQ-BC_3Dip2.js} +1 -1
- package/payload/frontend/dist/assets/{vennDiagram-DHZGUBPP-Bvnh5q4I.js → vennDiagram-DHZGUBPP-V_X88VPq.js} +1 -1
- package/payload/frontend/dist/assets/{wardley-RL74JXVD-DeQXKB6h.js → wardley-RL74JXVD-CflQhbCA.js} +1 -1
- package/payload/frontend/dist/assets/{wardleyDiagram-NUSXRM2D-jWo5oC0L.js → wardleyDiagram-NUSXRM2D-C75i3btX.js} +1 -1
- package/payload/frontend/dist/assets/{xychartDiagram-5P7HB3ND-Btji0cq9.js → xychartDiagram-5P7HB3ND-KIYpQyyi.js} +1 -1
- package/payload/frontend/dist/build-info.json +4 -4
- package/payload/frontend/dist/companion.html +1 -1
- package/payload/frontend/dist/index.html +2 -2
- package/payload/server/index.cjs +203 -19
- package/payload/frontend/dist/assets/channel-D7VgadXd.js +0 -1
- package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-DHRHkXVC.js +0 -1
- package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-DHRHkXVC.js +0 -1
- package/payload/frontend/dist/assets/clone-BzLTnNJj.js +0 -1
- package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-BfZc0BCX.js +0 -1
- package/payload/frontend/dist/assets/suiji-nz2Jwmpc.js +0 -1
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
|
-
"buildId": "
|
|
4
|
-
"sourceRevision": "
|
|
3
|
+
"buildId": "20261101T045659465Z-f866322b",
|
|
4
|
+
"sourceRevision": "f866322b32d9c3896ed3c60bc387f1184a104614",
|
|
5
5
|
"sourceDirty": false,
|
|
6
|
-
"builtAt": "2026-11-
|
|
7
|
-
"contentSha256": "
|
|
6
|
+
"builtAt": "2026-11-01T04:56:59.465Z",
|
|
7
|
+
"contentSha256": "a601618f713f08277371b4f143be99ed25c2380cff89952b97460e1862f1d399"
|
|
8
8
|
}
|
|
@@ -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":"20261101T045659465Z-f866322b","sourceRevision":"f866322b32d9c3896ed3c60bc387f1184a104614","sourceDirty":false,"builtAt":"2026-11-01T04:56:59.465Z","contentSha256":"a601618f713f08277371b4f143be99ed25c2380cff89952b97460e1862f1d399"};
|
|
2
2
|
const __IMPORT_META_URL__ = require('url').pathToFileURL(__filename).href;
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -34696,7 +34696,39 @@ function registerStableConfigurationRoot(context) {
|
|
|
34696
34696
|
(0, import_node_fs6.closeSync)(registryFd);
|
|
34697
34697
|
}
|
|
34698
34698
|
}
|
|
34699
|
+
function withUpgradeGate(context, shared, run) {
|
|
34700
|
+
const directory = ownerDirectory(context);
|
|
34701
|
+
const fd = (0, import_node_fs6.openSync)(import_node_path4.default.join(directory, "configuration-upgrade.lock"), import_node_fs6.constants.O_CREAT | import_node_fs6.constants.O_RDWR | import_node_fs6.constants.O_NOFOLLOW, 384);
|
|
34702
|
+
try {
|
|
34703
|
+
assertPrivateDescriptor(fd);
|
|
34704
|
+
if (!(0, import_fs_native_extensions.tryLock)(fd, 0, 0, { shared })) throw new ConfigurationError("CONFIG_UPGRADE_BUSY");
|
|
34705
|
+
return run();
|
|
34706
|
+
} finally {
|
|
34707
|
+
(0, import_node_fs6.closeSync)(fd);
|
|
34708
|
+
}
|
|
34709
|
+
}
|
|
34710
|
+
function withConfigurationUpgradeOwnership(context, run, ignoredRoles = []) {
|
|
34711
|
+
return withUpgradeGate(context, false, () => {
|
|
34712
|
+
const directory = ownerDirectory(context);
|
|
34713
|
+
const held = [];
|
|
34714
|
+
try {
|
|
34715
|
+
for (const file of (0, import_node_fs6.readdirSync)(directory).filter((name) => name.endsWith(".owner.lock"))) {
|
|
34716
|
+
if (ignoredRoles.includes(file.replace(/\.owner\.lock$/, ""))) continue;
|
|
34717
|
+
const fd = (0, import_node_fs6.openSync)(import_node_path4.default.join(directory, file), import_node_fs6.constants.O_RDWR | import_node_fs6.constants.O_NOFOLLOW);
|
|
34718
|
+
held.push(fd);
|
|
34719
|
+
assertPrivateDescriptor(fd);
|
|
34720
|
+
if (!(0, import_fs_native_extensions.tryLock)(fd)) throw new ConfigurationError("CONFIG_UPGRADE_CONSUMER_RUNNING", [file.replace(/\.owner\.lock$/, "")]);
|
|
34721
|
+
}
|
|
34722
|
+
return run();
|
|
34723
|
+
} finally {
|
|
34724
|
+
for (const fd of held) (0, import_node_fs6.closeSync)(fd);
|
|
34725
|
+
}
|
|
34726
|
+
});
|
|
34727
|
+
}
|
|
34699
34728
|
function acquireConfigurationOwner(context, role) {
|
|
34729
|
+
return withUpgradeGate(context, true, () => acquireOwner(context, role));
|
|
34730
|
+
}
|
|
34731
|
+
function acquireOwner(context, role) {
|
|
34700
34732
|
const directory = ownerDirectory(context);
|
|
34701
34733
|
const fd = (0, import_node_fs6.openSync)(import_node_path4.default.join(directory, `${role}.owner.lock`), import_node_fs6.constants.O_CREAT | import_node_fs6.constants.O_RDWR | import_node_fs6.constants.O_NOFOLLOW, 384);
|
|
34702
34734
|
let closed = false;
|
|
@@ -34717,13 +34749,6 @@ function acquireConfigurationOwner(context, role) {
|
|
|
34717
34749
|
}
|
|
34718
34750
|
}
|
|
34719
34751
|
|
|
34720
|
-
// packages/config-node/src/store.ts
|
|
34721
|
-
var import_node_fs7 = require("node:fs");
|
|
34722
|
-
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
34723
|
-
var import_node_crypto4 = require("node:crypto");
|
|
34724
|
-
var import_yaml = __toESM(require_dist(), 1);
|
|
34725
|
-
var import_fs_native_extensions2 = require("fs-native-extensions");
|
|
34726
|
-
|
|
34727
34752
|
// packages/shared/src/configuration/fields.ts
|
|
34728
34753
|
var CONFIGURATION_FIELDS = [
|
|
34729
34754
|
{ "path": "screenRecording.analysis.enabled", "type": "boolean", "domain": "screenRecording.analysis", "sensitive": false, "remote": false, "apply": "reload", "description": "\u542F\u7528\u672C\u673A\u5C4F\u5E55\u4E8B\u9879\u5206\u6790\uFF0C\u9ED8\u8BA4\u5173\u95ED", "environmentKeys": [], "owner": "backend/screen-recording-analysis", "scope": "instance", "storage": "settings.yaml", "default": { "value": false }, "migrationSources": ["new-field:no-legacy-source"] },
|
|
@@ -34896,14 +34921,18 @@ var CONFIGURATION_FIELDS = [
|
|
|
34896
34921
|
];
|
|
34897
34922
|
|
|
34898
34923
|
// packages/shared/src/configuration/compatibility.ts
|
|
34924
|
+
var CONFIGURATION_SCHEMA_VERSION = 1;
|
|
34925
|
+
var CONFIGURATION_DOMAIN_VERSIONS = Object.fromEntries(
|
|
34926
|
+
[...new Set(CONFIGURATION_FIELDS.map((field) => field.domain))].map((domain) => [domain, 1])
|
|
34927
|
+
);
|
|
34899
34928
|
var CONFIGURATION_COMPATIBILITY = {
|
|
34900
34929
|
format: "runweave-yaml",
|
|
34901
|
-
schemaVersions: [
|
|
34902
|
-
domainVersions: Object.fromEntries(
|
|
34930
|
+
schemaVersions: [CONFIGURATION_SCHEMA_VERSION],
|
|
34931
|
+
domainVersions: Object.fromEntries(Object.entries(CONFIGURATION_DOMAIN_VERSIONS).map(([domain, version]) => [domain, [version]]))
|
|
34903
34932
|
};
|
|
34904
34933
|
var APP_SERVER_CONFIGURATION_COMPATIBILITY = {
|
|
34905
34934
|
...CONFIGURATION_COMPATIBILITY,
|
|
34906
|
-
domainVersions: Object.fromEntries(["appServer", "agents.codex", "agents.traex"].map((domain) => [domain, [
|
|
34935
|
+
domainVersions: Object.fromEntries(["appServer", "agents.codex", "agents.traex"].map((domain) => [domain, [CONFIGURATION_DOMAIN_VERSIONS[domain]]]))
|
|
34907
34936
|
};
|
|
34908
34937
|
function supportsConfiguration(target, value) {
|
|
34909
34938
|
if (!target || typeof target !== "object") return false;
|
|
@@ -34979,6 +35008,66 @@ function configurationPathSegment(key) {
|
|
|
34979
35008
|
return key.replace(/\\/g, "\\\\").replace(/\./g, "\\.");
|
|
34980
35009
|
}
|
|
34981
35010
|
|
|
35011
|
+
// packages/config-node/src/version-migrations.ts
|
|
35012
|
+
var CONFIGURATION_VERSION_MIGRATIONS = [];
|
|
35013
|
+
function migrateConfigurationDocument(document2) {
|
|
35014
|
+
const steps = [];
|
|
35015
|
+
const ids = /* @__PURE__ */ new Set();
|
|
35016
|
+
const edges = /* @__PURE__ */ new Set();
|
|
35017
|
+
for (const step of CONFIGURATION_VERSION_MIGRATIONS) {
|
|
35018
|
+
const edge = `${step.domain ?? "$schema"}:${step.from}`;
|
|
35019
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]+$/.test(step.id) || ids.has(step.id) || edges.has(edge) || !Number.isSafeInteger(step.from) || step.from < 1 || step.to !== step.from + 1 || step.domain !== void 0 && !Object.hasOwn(CONFIGURATION_DOMAIN_VERSIONS, step.domain) || step.to > (step.domain ? CONFIGURATION_DOMAIN_VERSIONS[step.domain] : CONFIGURATION_SCHEMA_VERSION)) {
|
|
35020
|
+
throw new ConfigurationError("CONFIG_UPGRADE_REGISTRY_INVALID");
|
|
35021
|
+
}
|
|
35022
|
+
ids.add(step.id);
|
|
35023
|
+
edges.add(edge);
|
|
35024
|
+
}
|
|
35025
|
+
const advance = (domain, target) => {
|
|
35026
|
+
const versionPath = domain ? ["domainVersions", domain] : ["schemaVersion"];
|
|
35027
|
+
let version = Number(document2.getIn(versionPath) ?? 1);
|
|
35028
|
+
if (version > target) throw new ConfigurationError("CONFIG_UPGRADE_FUTURE_VERSION", [domain ?? "schemaVersion"]);
|
|
35029
|
+
while (version < target) {
|
|
35030
|
+
const step = CONFIGURATION_VERSION_MIGRATIONS.find((item) => item.domain === domain && item.from === version);
|
|
35031
|
+
if (!step) throw new ConfigurationError("CONFIG_UPGRADE_PATH_MISSING", [domain ?? "schemaVersion"]);
|
|
35032
|
+
const before = document2.toJS();
|
|
35033
|
+
try {
|
|
35034
|
+
step.migrate(document2);
|
|
35035
|
+
} catch {
|
|
35036
|
+
throw new ConfigurationError("CONFIG_UPGRADE_STEP_FAILED", [step.id]);
|
|
35037
|
+
}
|
|
35038
|
+
const after = document2.toJS();
|
|
35039
|
+
for (const key of ["schemaVersion", "revision", "kind", "instanceId", "domainVersions", "migrations"]) {
|
|
35040
|
+
if (JSON.stringify(before[key]) !== JSON.stringify(after[key])) throw new ConfigurationError("CONFIG_UPGRADE_METADATA_CHANGED", [step.id]);
|
|
35041
|
+
}
|
|
35042
|
+
if (domain) {
|
|
35043
|
+
const strip = (value) => {
|
|
35044
|
+
const copy = structuredClone(value);
|
|
35045
|
+
const parts = domain.split(".");
|
|
35046
|
+
let parent = copy;
|
|
35047
|
+
for (const key of parts.slice(0, -1)) parent = parent[key] ?? {};
|
|
35048
|
+
delete parent[parts.at(-1)];
|
|
35049
|
+
return copy;
|
|
35050
|
+
};
|
|
35051
|
+
if (JSON.stringify(strip(before)) !== JSON.stringify(strip(after))) throw new ConfigurationError("CONFIG_UPGRADE_SCOPE_CHANGED", [step.id]);
|
|
35052
|
+
}
|
|
35053
|
+
document2.setIn(versionPath, step.to);
|
|
35054
|
+
document2.setIn(["migrations", `version:${step.id}`], { from: step.from, to: step.to, domain: domain ?? "$schema" });
|
|
35055
|
+
steps.push(step.id);
|
|
35056
|
+
version = step.to;
|
|
35057
|
+
}
|
|
35058
|
+
};
|
|
35059
|
+
advance(void 0, CONFIGURATION_SCHEMA_VERSION);
|
|
35060
|
+
for (const [domain, target] of Object.entries(CONFIGURATION_DOMAIN_VERSIONS)) advance(domain, target);
|
|
35061
|
+
return steps;
|
|
35062
|
+
}
|
|
35063
|
+
|
|
35064
|
+
// packages/config-node/src/store.ts
|
|
35065
|
+
var import_node_fs7 = require("node:fs");
|
|
35066
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
35067
|
+
var import_node_crypto4 = require("node:crypto");
|
|
35068
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
35069
|
+
var import_fs_native_extensions2 = require("fs-native-extensions");
|
|
35070
|
+
|
|
34982
35071
|
// packages/config-node/src/validation.ts
|
|
34983
35072
|
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
34984
35073
|
var patterns = CONFIGURATION_FIELDS.map((field) => ({ field, segments: field.path.replace(/\[\]/g, ".#").split(".") }));
|
|
@@ -35002,7 +35091,7 @@ function domainForPath(key) {
|
|
|
35002
35091
|
}
|
|
35003
35092
|
function validateEnvelope(value, context) {
|
|
35004
35093
|
if (!isConfigurationObject(value)) throw new ConfigurationError("CONFIG_ROOT_INVALID");
|
|
35005
|
-
if (value.schemaVersion !==
|
|
35094
|
+
if (value.schemaVersion !== CONFIGURATION_SCHEMA_VERSION) throw new ConfigurationError("CONFIG_SCHEMA_UNSUPPORTED");
|
|
35006
35095
|
if (!Number.isSafeInteger(value.revision) || Number(value.revision) < 0) throw new ConfigurationError("CONFIG_REVISION_INVALID");
|
|
35007
35096
|
if (value.kind !== context.kind || value.instanceId !== context.instanceId) throw new ConfigurationError("CONFIG_IDENTITY_MISMATCH");
|
|
35008
35097
|
if (!isConfigurationObject(value.domainVersions) || !isConfigurationObject(value.migrations)) throw new ConfigurationError("CONFIG_METADATA_INVALID");
|
|
@@ -35024,7 +35113,7 @@ function validateDomains(value, context) {
|
|
|
35024
35113
|
if (["schemaVersion", "revision", "kind", "instanceId", "domainVersions", "migrations"].includes(key.split(".")[0])) continue;
|
|
35025
35114
|
const domain = domainForPath(key);
|
|
35026
35115
|
if (domain === "agents.team") continue;
|
|
35027
|
-
if (value.domainVersions[domain] !== void 0 && value.domainVersions[domain] !==
|
|
35116
|
+
if (value.domainVersions[domain] !== void 0 && value.domainVersions[domain] !== CONFIGURATION_DOMAIN_VERSIONS[domain]) {
|
|
35028
35117
|
issue(key, "CONFIG_DOMAIN_VERSION_UNSUPPORTED");
|
|
35029
35118
|
continue;
|
|
35030
35119
|
}
|
|
@@ -35099,7 +35188,7 @@ function validateDomains(value, context) {
|
|
|
35099
35188
|
}
|
|
35100
35189
|
for (const [domain, version] of Object.entries(value.domainVersions)) {
|
|
35101
35190
|
if (domain === "agents.team") continue;
|
|
35102
|
-
if (version !==
|
|
35191
|
+
if (version !== CONFIGURATION_DOMAIN_VERSIONS[domain] && !result[domain]) result[domain] = [{ path: domain, code: "CONFIG_DOMAIN_VERSION_UNSUPPORTED" }];
|
|
35103
35192
|
}
|
|
35104
35193
|
return result;
|
|
35105
35194
|
}
|
|
@@ -35204,7 +35293,7 @@ var ConfigurationStore = class {
|
|
|
35204
35293
|
(0, import_node_fs7.closeSync)(fd);
|
|
35205
35294
|
}
|
|
35206
35295
|
}
|
|
35207
|
-
publish(document2, previous) {
|
|
35296
|
+
publish(document2, previous, backupId) {
|
|
35208
35297
|
const source = document2.toString({ lineWidth: 0 });
|
|
35209
35298
|
const checked = parseConfigurationYaml(source, this.context);
|
|
35210
35299
|
registerStableConfigurationRoot(this.context);
|
|
@@ -35214,7 +35303,7 @@ var ConfigurationStore = class {
|
|
|
35214
35303
|
(0, import_node_fs7.mkdirSync)(backupRoot, { recursive: true, mode: 448 });
|
|
35215
35304
|
const backupStat = (0, import_node_fs7.lstatSync)(backupRoot);
|
|
35216
35305
|
if (!backupStat.isDirectory() || backupStat.isSymbolicLink() || backupStat.mode & 63 || typeof process.getuid === "function" && backupStat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_BACKUP_ROOT_INVALID");
|
|
35217
|
-
const backup = import_node_path6.default.join(backupRoot, `${Date.now()}-${(0, import_node_crypto4.randomUUID)()}.yaml`);
|
|
35306
|
+
const backup = import_node_path6.default.join(backupRoot, backupId ?? `${Date.now()}-${(0, import_node_crypto4.randomUUID)()}.yaml`);
|
|
35218
35307
|
const fd2 = (0, import_node_fs7.openSync)(backup, "wx", 384);
|
|
35219
35308
|
try {
|
|
35220
35309
|
(0, import_node_fs7.writeFileSync)(fd2, previous);
|
|
@@ -35261,7 +35350,7 @@ var ConfigurationStore = class {
|
|
|
35261
35350
|
const segments = configurationPathSegments(key);
|
|
35262
35351
|
if (!segments.length || segments.some((part) => !part || unsafeKeys.has(part))) throw new ConfigurationError("CONFIG_FIELD_INVALID");
|
|
35263
35352
|
const domain = domainForPath(key);
|
|
35264
|
-
if (current.value.domainVersions[domain] !== void 0 && current.value.domainVersions[domain] !==
|
|
35353
|
+
if (current.value.domainVersions[domain] !== void 0 && current.value.domainVersions[domain] !== CONFIGURATION_DOMAIN_VERSIONS[domain]) throw new ConfigurationError("CONFIG_DOMAIN_VERSION_UNSUPPORTED", [domain]);
|
|
35265
35354
|
const field = fieldForPath(key);
|
|
35266
35355
|
if (!field && !(isConfigurationObject(value) && isConfigurationContainer(key)) && !(Array.isArray(value) && isConfigurationContainer(key, true)) && !(value === null && (isConfigurationContainer(key) || isConfigurationContainer(key, true)))) throw new ConfigurationError("CONFIG_FIELD_UNKNOWN", [key]);
|
|
35267
35356
|
if (options.remote && (!field || !field.remote)) throw new ConfigurationError("CONFIG_FIELD_FORBIDDEN", [key]);
|
|
@@ -35271,7 +35360,7 @@ var ConfigurationStore = class {
|
|
|
35271
35360
|
for (const segment of segments) target.push((0, import_yaml.isSeq)(current.document.getIn(target, true)) && /^\d+$/.test(segment) ? Number(segment) : segment);
|
|
35272
35361
|
if (!field && value === null) current.document.deleteIn(target);
|
|
35273
35362
|
else current.document.setIn(target, value);
|
|
35274
|
-
current.document.setIn(["domainVersions", domain],
|
|
35363
|
+
current.document.setIn(["domainVersions", domain], CONFIGURATION_DOMAIN_VERSIONS[domain]);
|
|
35275
35364
|
domains.add(domain);
|
|
35276
35365
|
}
|
|
35277
35366
|
const revision = Math.max(current.value.revision, options.minimumRevision ?? 0) + 1;
|
|
@@ -35309,7 +35398,7 @@ var ConfigurationStore = class {
|
|
|
35309
35398
|
const source = readPrivateFile(this.file);
|
|
35310
35399
|
const { value } = parseYamlDocument(source);
|
|
35311
35400
|
if (!isConfigurationObject(value) || !Number.isSafeInteger(value.schemaVersion) || Number(value.schemaVersion) < 1) throw new ConfigurationError("CONFIG_SCHEMA_INVALID");
|
|
35312
|
-
validateEnvelope({ ...value, schemaVersion:
|
|
35401
|
+
validateEnvelope({ ...value, schemaVersion: CONFIGURATION_SCHEMA_VERSION }, this.context);
|
|
35313
35402
|
const backup = this.readBackup(id);
|
|
35314
35403
|
const before = new Map(flattenConfiguration(value));
|
|
35315
35404
|
const after = new Map(flattenConfiguration(backup.value));
|
|
@@ -35328,6 +35417,89 @@ var ConfigurationStore = class {
|
|
|
35328
35417
|
previewRestore(id) {
|
|
35329
35418
|
return this.prepareRestore(id).preview;
|
|
35330
35419
|
}
|
|
35420
|
+
/** Upgrade control plane only; business readers must use read(). */
|
|
35421
|
+
readUpgradeSource() {
|
|
35422
|
+
assertPrivateDirectory(this.context.configRoot);
|
|
35423
|
+
const source = readPrivateFile(this.file);
|
|
35424
|
+
const { document: document2, value } = parseYamlDocument(source);
|
|
35425
|
+
if (!isConfigurationObject(value) || !Number.isSafeInteger(value.schemaVersion) || Number(value.schemaVersion) < 1) throw new ConfigurationError("CONFIG_SCHEMA_INVALID");
|
|
35426
|
+
validateEnvelope({ ...value, schemaVersion: CONFIGURATION_SCHEMA_VERSION }, this.context);
|
|
35427
|
+
return { source, document: document2, value, digest: (0, import_node_crypto4.createHash)("sha256").update(source).digest("hex") };
|
|
35428
|
+
}
|
|
35429
|
+
prepareUpgrade() {
|
|
35430
|
+
const { source, document: document2, value, digest } = this.readUpgradeSource();
|
|
35431
|
+
const original = value;
|
|
35432
|
+
const expectedDigest = digest;
|
|
35433
|
+
const steps = migrateConfigurationDocument(document2);
|
|
35434
|
+
const next = parseConfigurationYaml(document2.toString({ lineWidth: 0 }), this.context);
|
|
35435
|
+
const failures = Object.values(next.issues).flat();
|
|
35436
|
+
if (failures.length) throw new ConfigurationError("CONFIG_VALIDATION_FAILED", failures.map((issue) => issue.path));
|
|
35437
|
+
const before = new Map(flattenConfiguration(original));
|
|
35438
|
+
const after = new Map(flattenConfiguration(next.value));
|
|
35439
|
+
const changedFields = [.../* @__PURE__ */ new Set([...before.keys(), ...after.keys()])].filter((key) => JSON.stringify(before.get(key)) !== JSON.stringify(after.get(key))).sort();
|
|
35440
|
+
const preview = {
|
|
35441
|
+
expectedRevision: original.revision,
|
|
35442
|
+
expectedDigest,
|
|
35443
|
+
source: { schemaVersion: original.schemaVersion, domainVersions: original.domainVersions },
|
|
35444
|
+
target: { schemaVersion: next.value.schemaVersion, domainVersions: { ...CONFIGURATION_DOMAIN_VERSIONS, ...next.value.domainVersions } },
|
|
35445
|
+
steps,
|
|
35446
|
+
changedFields,
|
|
35447
|
+
changed: changedFields.length > 0
|
|
35448
|
+
};
|
|
35449
|
+
return { source, document: document2, preview };
|
|
35450
|
+
}
|
|
35451
|
+
previewUpgrade() {
|
|
35452
|
+
return this.prepareUpgrade().preview;
|
|
35453
|
+
}
|
|
35454
|
+
recordUpgrade(value) {
|
|
35455
|
+
const file = import_node_path6.default.join(this.context.configRoot, "config-upgrade.json");
|
|
35456
|
+
const temporary = `${file}.${(0, import_node_crypto4.randomUUID)()}.tmp`;
|
|
35457
|
+
const fd = (0, import_node_fs7.openSync)(temporary, "wx", 384);
|
|
35458
|
+
try {
|
|
35459
|
+
(0, import_node_fs7.writeFileSync)(fd, JSON.stringify(value, null, 2) + "\n");
|
|
35460
|
+
(0, import_node_fs7.fsyncSync)(fd);
|
|
35461
|
+
} finally {
|
|
35462
|
+
(0, import_node_fs7.closeSync)(fd);
|
|
35463
|
+
}
|
|
35464
|
+
try {
|
|
35465
|
+
(0, import_node_fs7.renameSync)(temporary, file);
|
|
35466
|
+
const parent = (0, import_node_fs7.openSync)(this.context.configRoot, "r");
|
|
35467
|
+
try {
|
|
35468
|
+
(0, import_node_fs7.fsyncSync)(parent);
|
|
35469
|
+
} finally {
|
|
35470
|
+
(0, import_node_fs7.closeSync)(parent);
|
|
35471
|
+
}
|
|
35472
|
+
} finally {
|
|
35473
|
+
if ((0, import_node_fs7.existsSync)(temporary)) (0, import_node_fs7.unlinkSync)(temporary);
|
|
35474
|
+
}
|
|
35475
|
+
}
|
|
35476
|
+
upgrade(expected) {
|
|
35477
|
+
return this.locked(() => {
|
|
35478
|
+
const { source, document: document2, preview } = this.prepareUpgrade();
|
|
35479
|
+
if (preview.expectedRevision !== expected.revision || preview.expectedDigest !== expected.digest) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
|
|
35480
|
+
if (!preview.changed) {
|
|
35481
|
+
const receiptFile = import_node_path6.default.join(this.context.configRoot, "config-upgrade.json");
|
|
35482
|
+
if ((0, import_node_fs7.existsSync)(receiptFile)) {
|
|
35483
|
+
const receipt = JSON.parse(readPrivateFile(receiptFile));
|
|
35484
|
+
if (isConfigurationObject(receipt) && receipt.phase === "prepared" && receipt.plannedDigest === expected.digest)
|
|
35485
|
+
this.recordUpgrade({ ...receipt, phase: "committed", savedRevision: expected.revision, digest: expected.digest });
|
|
35486
|
+
}
|
|
35487
|
+
return { ...preview, savedRevision: expected.revision, digest: expected.digest };
|
|
35488
|
+
}
|
|
35489
|
+
return withConfigurationUpgradeOwnership(this.context, () => {
|
|
35490
|
+
const revision = expected.revision + 1;
|
|
35491
|
+
if (!Number.isSafeInteger(revision)) throw new ConfigurationError("CONFIG_REVISION_INVALID");
|
|
35492
|
+
document2.set("revision", revision);
|
|
35493
|
+
const backupId = `${Date.now()}-${(0, import_node_crypto4.randomUUID)()}.yaml`;
|
|
35494
|
+
const plannedDigest = (0, import_node_crypto4.createHash)("sha256").update(document2.toString({ lineWidth: 0 })).digest("hex");
|
|
35495
|
+
this.recordUpgrade({ ...preview, backupId, plannedDigest, phase: "prepared" });
|
|
35496
|
+
const next = this.publish(document2, source, backupId);
|
|
35497
|
+
const result = { ...preview, savedRevision: next.value.revision, digest: next.digest, backupId };
|
|
35498
|
+
this.recordUpgrade({ ...result, phase: "committed" });
|
|
35499
|
+
return result;
|
|
35500
|
+
});
|
|
35501
|
+
});
|
|
35502
|
+
}
|
|
35331
35503
|
restoreBackup(id, expected) {
|
|
35332
35504
|
return this.locked(() => {
|
|
35333
35505
|
const { source, backup, preview } = this.prepareRestore(id);
|