@runweave/server-darwin-arm64 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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
|
-
"buildId": "
|
|
4
|
-
"sourceRevision": "
|
|
3
|
+
"buildId": "20261101T045618982Z-f866322b",
|
|
4
|
+
"sourceRevision": "f866322b32d9c3896ed3c60bc387f1184a104614",
|
|
5
5
|
"sourceDirty": false,
|
|
6
|
-
"builtAt": "2026-11-
|
|
7
|
-
"contentSha256": "
|
|
6
|
+
"builtAt": "2026-11-01T04:56:18.982Z",
|
|
7
|
+
"contentSha256": "7d801b392a13c8b17518e8b86264ea4e7871b14af52661e67a799d98d311fe04"
|
|
8
8
|
}
|
|
@@ -8393,6 +8393,7 @@ __export(src_exports, {
|
|
|
8393
8393
|
APP_SERVER_CONFIGURATION_COMPATIBILITY: () => APP_SERVER_CONFIGURATION_COMPATIBILITY,
|
|
8394
8394
|
BACKEND_CORE_CONFIGURATION_DOMAINS: () => BACKEND_CORE_CONFIGURATION_DOMAINS,
|
|
8395
8395
|
CONFIGURATION_COMPATIBILITY: () => CONFIGURATION_COMPATIBILITY,
|
|
8396
|
+
CONFIGURATION_VERSION_MIGRATIONS: () => CONFIGURATION_VERSION_MIGRATIONS,
|
|
8396
8397
|
ConfigurationDomain: () => ConfigurationDomain,
|
|
8397
8398
|
ConfigurationError: () => ConfigurationError,
|
|
8398
8399
|
ConfigurationRuntime: () => ConfigurationRuntime,
|
|
@@ -8416,6 +8417,7 @@ __export(src_exports, {
|
|
|
8416
8417
|
importEnvironment: () => importEnvironment,
|
|
8417
8418
|
initializeConfiguration: () => initializeConfiguration,
|
|
8418
8419
|
isConfigurationContainer: () => isConfigurationContainer,
|
|
8420
|
+
migrateConfigurationDocument: () => migrateConfigurationDocument,
|
|
8419
8421
|
migrationPreview: () => migrationPreview,
|
|
8420
8422
|
parseConfigurationYaml: () => parseConfigurationYaml,
|
|
8421
8423
|
parseEnvironmentFile: () => parseEnvironmentFile,
|
|
@@ -8443,6 +8445,7 @@ __export(src_exports, {
|
|
|
8443
8445
|
validateEnvelope: () => validateEnvelope,
|
|
8444
8446
|
validateLocalRuntimeStatusReport: () => validateLocalRuntimeStatusReport,
|
|
8445
8447
|
withConfigurationArguments: () => withConfigurationArguments,
|
|
8448
|
+
withConfigurationUpgradeOwnership: () => withConfigurationUpgradeOwnership,
|
|
8446
8449
|
writeResearchMcpInstallation: () => writeResearchMcpInstallation
|
|
8447
8450
|
});
|
|
8448
8451
|
|
|
@@ -8610,7 +8613,39 @@ function registerStableConfigurationRoot(context) {
|
|
|
8610
8613
|
(0, import_node_fs5.closeSync)(registryFd);
|
|
8611
8614
|
}
|
|
8612
8615
|
}
|
|
8616
|
+
function withUpgradeGate(context, shared, run) {
|
|
8617
|
+
const directory2 = ownerDirectory(context);
|
|
8618
|
+
const fd = (0, import_node_fs5.openSync)(import_node_path7.default.join(directory2, "configuration-upgrade.lock"), import_node_fs5.constants.O_CREAT | import_node_fs5.constants.O_RDWR | import_node_fs5.constants.O_NOFOLLOW, 384);
|
|
8619
|
+
try {
|
|
8620
|
+
assertPrivateDescriptor(fd);
|
|
8621
|
+
if (!(0, import_fs_native_extensions.tryLock)(fd, 0, 0, { shared })) throw new ConfigurationError("CONFIG_UPGRADE_BUSY");
|
|
8622
|
+
return run();
|
|
8623
|
+
} finally {
|
|
8624
|
+
(0, import_node_fs5.closeSync)(fd);
|
|
8625
|
+
}
|
|
8626
|
+
}
|
|
8627
|
+
function withConfigurationUpgradeOwnership(context, run, ignoredRoles = []) {
|
|
8628
|
+
return withUpgradeGate(context, false, () => {
|
|
8629
|
+
const directory2 = ownerDirectory(context);
|
|
8630
|
+
const held = [];
|
|
8631
|
+
try {
|
|
8632
|
+
for (const file of (0, import_node_fs5.readdirSync)(directory2).filter((name) => name.endsWith(".owner.lock"))) {
|
|
8633
|
+
if (ignoredRoles.includes(file.replace(/\.owner\.lock$/, ""))) continue;
|
|
8634
|
+
const fd = (0, import_node_fs5.openSync)(import_node_path7.default.join(directory2, file), import_node_fs5.constants.O_RDWR | import_node_fs5.constants.O_NOFOLLOW);
|
|
8635
|
+
held.push(fd);
|
|
8636
|
+
assertPrivateDescriptor(fd);
|
|
8637
|
+
if (!(0, import_fs_native_extensions.tryLock)(fd)) throw new ConfigurationError("CONFIG_UPGRADE_CONSUMER_RUNNING", [file.replace(/\.owner\.lock$/, "")]);
|
|
8638
|
+
}
|
|
8639
|
+
return run();
|
|
8640
|
+
} finally {
|
|
8641
|
+
for (const fd of held) (0, import_node_fs5.closeSync)(fd);
|
|
8642
|
+
}
|
|
8643
|
+
});
|
|
8644
|
+
}
|
|
8613
8645
|
function acquireConfigurationOwner(context, role) {
|
|
8646
|
+
return withUpgradeGate(context, true, () => acquireOwner(context, role));
|
|
8647
|
+
}
|
|
8648
|
+
function acquireOwner(context, role) {
|
|
8614
8649
|
const directory2 = ownerDirectory(context);
|
|
8615
8650
|
const fd = (0, import_node_fs5.openSync)(import_node_path7.default.join(directory2, `${role}.owner.lock`), import_node_fs5.constants.O_CREAT | import_node_fs5.constants.O_RDWR | import_node_fs5.constants.O_NOFOLLOW, 384);
|
|
8616
8651
|
let closed = false;
|
|
@@ -8631,13 +8666,6 @@ function acquireConfigurationOwner(context, role) {
|
|
|
8631
8666
|
}
|
|
8632
8667
|
}
|
|
8633
8668
|
|
|
8634
|
-
// packages/config-node/src/store.ts
|
|
8635
|
-
var import_node_fs6 = require("node:fs");
|
|
8636
|
-
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
8637
|
-
var import_node_crypto3 = require("node:crypto");
|
|
8638
|
-
var import_yaml = __toESM(require_dist(), 1);
|
|
8639
|
-
var import_fs_native_extensions2 = require("fs-native-extensions");
|
|
8640
|
-
|
|
8641
8669
|
// packages/shared/src/configuration/fields.ts
|
|
8642
8670
|
var CONFIGURATION_FIELDS = [
|
|
8643
8671
|
{ "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"] },
|
|
@@ -8810,14 +8838,18 @@ var CONFIGURATION_FIELDS = [
|
|
|
8810
8838
|
];
|
|
8811
8839
|
|
|
8812
8840
|
// packages/shared/src/configuration/compatibility.ts
|
|
8841
|
+
var CONFIGURATION_SCHEMA_VERSION = 1;
|
|
8842
|
+
var CONFIGURATION_DOMAIN_VERSIONS = Object.fromEntries(
|
|
8843
|
+
[...new Set(CONFIGURATION_FIELDS.map((field) => field.domain))].map((domain) => [domain, 1])
|
|
8844
|
+
);
|
|
8813
8845
|
var CONFIGURATION_COMPATIBILITY = {
|
|
8814
8846
|
format: "runweave-yaml",
|
|
8815
|
-
schemaVersions: [
|
|
8816
|
-
domainVersions: Object.fromEntries(
|
|
8847
|
+
schemaVersions: [CONFIGURATION_SCHEMA_VERSION],
|
|
8848
|
+
domainVersions: Object.fromEntries(Object.entries(CONFIGURATION_DOMAIN_VERSIONS).map(([domain, version]) => [domain, [version]]))
|
|
8817
8849
|
};
|
|
8818
8850
|
var APP_SERVER_CONFIGURATION_COMPATIBILITY = {
|
|
8819
8851
|
...CONFIGURATION_COMPATIBILITY,
|
|
8820
|
-
domainVersions: Object.fromEntries(["appServer", "agents.codex", "agents.traex"].map((domain) => [domain, [
|
|
8852
|
+
domainVersions: Object.fromEntries(["appServer", "agents.codex", "agents.traex"].map((domain) => [domain, [CONFIGURATION_DOMAIN_VERSIONS[domain]]]))
|
|
8821
8853
|
};
|
|
8822
8854
|
function supportsConfiguration(target, value) {
|
|
8823
8855
|
if (!target || typeof target !== "object") return false;
|
|
@@ -8893,6 +8925,66 @@ function configurationPathSegment(key) {
|
|
|
8893
8925
|
return key.replace(/\\/g, "\\\\").replace(/\./g, "\\.");
|
|
8894
8926
|
}
|
|
8895
8927
|
|
|
8928
|
+
// packages/config-node/src/version-migrations.ts
|
|
8929
|
+
var CONFIGURATION_VERSION_MIGRATIONS = [];
|
|
8930
|
+
function migrateConfigurationDocument(document) {
|
|
8931
|
+
const steps = [];
|
|
8932
|
+
const ids = /* @__PURE__ */ new Set();
|
|
8933
|
+
const edges = /* @__PURE__ */ new Set();
|
|
8934
|
+
for (const step of CONFIGURATION_VERSION_MIGRATIONS) {
|
|
8935
|
+
const edge = `${step.domain ?? "$schema"}:${step.from}`;
|
|
8936
|
+
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)) {
|
|
8937
|
+
throw new ConfigurationError("CONFIG_UPGRADE_REGISTRY_INVALID");
|
|
8938
|
+
}
|
|
8939
|
+
ids.add(step.id);
|
|
8940
|
+
edges.add(edge);
|
|
8941
|
+
}
|
|
8942
|
+
const advance = (domain, target) => {
|
|
8943
|
+
const versionPath = domain ? ["domainVersions", domain] : ["schemaVersion"];
|
|
8944
|
+
let version = Number(document.getIn(versionPath) ?? 1);
|
|
8945
|
+
if (version > target) throw new ConfigurationError("CONFIG_UPGRADE_FUTURE_VERSION", [domain ?? "schemaVersion"]);
|
|
8946
|
+
while (version < target) {
|
|
8947
|
+
const step = CONFIGURATION_VERSION_MIGRATIONS.find((item) => item.domain === domain && item.from === version);
|
|
8948
|
+
if (!step) throw new ConfigurationError("CONFIG_UPGRADE_PATH_MISSING", [domain ?? "schemaVersion"]);
|
|
8949
|
+
const before = document.toJS();
|
|
8950
|
+
try {
|
|
8951
|
+
step.migrate(document);
|
|
8952
|
+
} catch {
|
|
8953
|
+
throw new ConfigurationError("CONFIG_UPGRADE_STEP_FAILED", [step.id]);
|
|
8954
|
+
}
|
|
8955
|
+
const after = document.toJS();
|
|
8956
|
+
for (const key of ["schemaVersion", "revision", "kind", "instanceId", "domainVersions", "migrations"]) {
|
|
8957
|
+
if (JSON.stringify(before[key]) !== JSON.stringify(after[key])) throw new ConfigurationError("CONFIG_UPGRADE_METADATA_CHANGED", [step.id]);
|
|
8958
|
+
}
|
|
8959
|
+
if (domain) {
|
|
8960
|
+
const strip = (value) => {
|
|
8961
|
+
const copy = structuredClone(value);
|
|
8962
|
+
const parts = domain.split(".");
|
|
8963
|
+
let parent = copy;
|
|
8964
|
+
for (const key of parts.slice(0, -1)) parent = parent[key] ?? {};
|
|
8965
|
+
delete parent[parts.at(-1)];
|
|
8966
|
+
return copy;
|
|
8967
|
+
};
|
|
8968
|
+
if (JSON.stringify(strip(before)) !== JSON.stringify(strip(after))) throw new ConfigurationError("CONFIG_UPGRADE_SCOPE_CHANGED", [step.id]);
|
|
8969
|
+
}
|
|
8970
|
+
document.setIn(versionPath, step.to);
|
|
8971
|
+
document.setIn(["migrations", `version:${step.id}`], { from: step.from, to: step.to, domain: domain ?? "$schema" });
|
|
8972
|
+
steps.push(step.id);
|
|
8973
|
+
version = step.to;
|
|
8974
|
+
}
|
|
8975
|
+
};
|
|
8976
|
+
advance(void 0, CONFIGURATION_SCHEMA_VERSION);
|
|
8977
|
+
for (const [domain, target] of Object.entries(CONFIGURATION_DOMAIN_VERSIONS)) advance(domain, target);
|
|
8978
|
+
return steps;
|
|
8979
|
+
}
|
|
8980
|
+
|
|
8981
|
+
// packages/config-node/src/store.ts
|
|
8982
|
+
var import_node_fs6 = require("node:fs");
|
|
8983
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
8984
|
+
var import_node_crypto3 = require("node:crypto");
|
|
8985
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
8986
|
+
var import_fs_native_extensions2 = require("fs-native-extensions");
|
|
8987
|
+
|
|
8896
8988
|
// packages/config-node/src/validation.ts
|
|
8897
8989
|
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
8898
8990
|
var patterns = CONFIGURATION_FIELDS.map((field) => ({ field, segments: field.path.replace(/\[\]/g, ".#").split(".") }));
|
|
@@ -8917,7 +9009,7 @@ function domainForPath(key) {
|
|
|
8917
9009
|
}
|
|
8918
9010
|
function validateEnvelope(value, context) {
|
|
8919
9011
|
if (!isConfigurationObject(value)) throw new ConfigurationError("CONFIG_ROOT_INVALID");
|
|
8920
|
-
if (value.schemaVersion !==
|
|
9012
|
+
if (value.schemaVersion !== CONFIGURATION_SCHEMA_VERSION) throw new ConfigurationError("CONFIG_SCHEMA_UNSUPPORTED");
|
|
8921
9013
|
if (!Number.isSafeInteger(value.revision) || Number(value.revision) < 0) throw new ConfigurationError("CONFIG_REVISION_INVALID");
|
|
8922
9014
|
if (value.kind !== context.kind || value.instanceId !== context.instanceId) throw new ConfigurationError("CONFIG_IDENTITY_MISMATCH");
|
|
8923
9015
|
if (!isConfigurationObject(value.domainVersions) || !isConfigurationObject(value.migrations)) throw new ConfigurationError("CONFIG_METADATA_INVALID");
|
|
@@ -8939,7 +9031,7 @@ function validateDomains(value, context) {
|
|
|
8939
9031
|
if (["schemaVersion", "revision", "kind", "instanceId", "domainVersions", "migrations"].includes(key.split(".")[0])) continue;
|
|
8940
9032
|
const domain = domainForPath(key);
|
|
8941
9033
|
if (domain === "agents.team") continue;
|
|
8942
|
-
if (value.domainVersions[domain] !== void 0 && value.domainVersions[domain] !==
|
|
9034
|
+
if (value.domainVersions[domain] !== void 0 && value.domainVersions[domain] !== CONFIGURATION_DOMAIN_VERSIONS[domain]) {
|
|
8943
9035
|
issue(key, "CONFIG_DOMAIN_VERSION_UNSUPPORTED");
|
|
8944
9036
|
continue;
|
|
8945
9037
|
}
|
|
@@ -9014,7 +9106,7 @@ function validateDomains(value, context) {
|
|
|
9014
9106
|
}
|
|
9015
9107
|
for (const [domain, version] of Object.entries(value.domainVersions)) {
|
|
9016
9108
|
if (domain === "agents.team") continue;
|
|
9017
|
-
if (version !==
|
|
9109
|
+
if (version !== CONFIGURATION_DOMAIN_VERSIONS[domain] && !result[domain]) result[domain] = [{ path: domain, code: "CONFIG_DOMAIN_VERSION_UNSUPPORTED" }];
|
|
9018
9110
|
}
|
|
9019
9111
|
return result;
|
|
9020
9112
|
}
|
|
@@ -9119,7 +9211,7 @@ var ConfigurationStore = class {
|
|
|
9119
9211
|
(0, import_node_fs6.closeSync)(fd);
|
|
9120
9212
|
}
|
|
9121
9213
|
}
|
|
9122
|
-
publish(document, previous) {
|
|
9214
|
+
publish(document, previous, backupId) {
|
|
9123
9215
|
const source = document.toString({ lineWidth: 0 });
|
|
9124
9216
|
const checked = parseConfigurationYaml(source, this.context);
|
|
9125
9217
|
registerStableConfigurationRoot(this.context);
|
|
@@ -9129,7 +9221,7 @@ var ConfigurationStore = class {
|
|
|
9129
9221
|
(0, import_node_fs6.mkdirSync)(backupRoot, { recursive: true, mode: 448 });
|
|
9130
9222
|
const backupStat = (0, import_node_fs6.lstatSync)(backupRoot);
|
|
9131
9223
|
if (!backupStat.isDirectory() || backupStat.isSymbolicLink() || backupStat.mode & 63 || typeof process.getuid === "function" && backupStat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_BACKUP_ROOT_INVALID");
|
|
9132
|
-
const backup = import_node_path9.default.join(backupRoot, `${Date.now()}-${(0, import_node_crypto3.randomUUID)()}.yaml`);
|
|
9224
|
+
const backup = import_node_path9.default.join(backupRoot, backupId ?? `${Date.now()}-${(0, import_node_crypto3.randomUUID)()}.yaml`);
|
|
9133
9225
|
const fd2 = (0, import_node_fs6.openSync)(backup, "wx", 384);
|
|
9134
9226
|
try {
|
|
9135
9227
|
(0, import_node_fs6.writeFileSync)(fd2, previous);
|
|
@@ -9176,7 +9268,7 @@ var ConfigurationStore = class {
|
|
|
9176
9268
|
const segments = configurationPathSegments(key);
|
|
9177
9269
|
if (!segments.length || segments.some((part) => !part || unsafeKeys.has(part))) throw new ConfigurationError("CONFIG_FIELD_INVALID");
|
|
9178
9270
|
const domain = domainForPath(key);
|
|
9179
|
-
if (current.value.domainVersions[domain] !== void 0 && current.value.domainVersions[domain] !==
|
|
9271
|
+
if (current.value.domainVersions[domain] !== void 0 && current.value.domainVersions[domain] !== CONFIGURATION_DOMAIN_VERSIONS[domain]) throw new ConfigurationError("CONFIG_DOMAIN_VERSION_UNSUPPORTED", [domain]);
|
|
9180
9272
|
const field = fieldForPath(key);
|
|
9181
9273
|
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]);
|
|
9182
9274
|
if (options.remote && (!field || !field.remote)) throw new ConfigurationError("CONFIG_FIELD_FORBIDDEN", [key]);
|
|
@@ -9186,7 +9278,7 @@ var ConfigurationStore = class {
|
|
|
9186
9278
|
for (const segment of segments) target.push((0, import_yaml.isSeq)(current.document.getIn(target, true)) && /^\d+$/.test(segment) ? Number(segment) : segment);
|
|
9187
9279
|
if (!field && value === null) current.document.deleteIn(target);
|
|
9188
9280
|
else current.document.setIn(target, value);
|
|
9189
|
-
current.document.setIn(["domainVersions", domain],
|
|
9281
|
+
current.document.setIn(["domainVersions", domain], CONFIGURATION_DOMAIN_VERSIONS[domain]);
|
|
9190
9282
|
domains.add(domain);
|
|
9191
9283
|
}
|
|
9192
9284
|
const revision = Math.max(current.value.revision, options.minimumRevision ?? 0) + 1;
|
|
@@ -9224,7 +9316,7 @@ var ConfigurationStore = class {
|
|
|
9224
9316
|
const source = readPrivateFile(this.file);
|
|
9225
9317
|
const { value } = parseYamlDocument(source);
|
|
9226
9318
|
if (!isConfigurationObject(value) || !Number.isSafeInteger(value.schemaVersion) || Number(value.schemaVersion) < 1) throw new ConfigurationError("CONFIG_SCHEMA_INVALID");
|
|
9227
|
-
validateEnvelope({ ...value, schemaVersion:
|
|
9319
|
+
validateEnvelope({ ...value, schemaVersion: CONFIGURATION_SCHEMA_VERSION }, this.context);
|
|
9228
9320
|
const backup = this.readBackup(id);
|
|
9229
9321
|
const before = new Map(flattenConfiguration(value));
|
|
9230
9322
|
const after = new Map(flattenConfiguration(backup.value));
|
|
@@ -9243,6 +9335,89 @@ var ConfigurationStore = class {
|
|
|
9243
9335
|
previewRestore(id) {
|
|
9244
9336
|
return this.prepareRestore(id).preview;
|
|
9245
9337
|
}
|
|
9338
|
+
/** Upgrade control plane only; business readers must use read(). */
|
|
9339
|
+
readUpgradeSource() {
|
|
9340
|
+
assertPrivateDirectory(this.context.configRoot);
|
|
9341
|
+
const source = readPrivateFile(this.file);
|
|
9342
|
+
const { document, value } = parseYamlDocument(source);
|
|
9343
|
+
if (!isConfigurationObject(value) || !Number.isSafeInteger(value.schemaVersion) || Number(value.schemaVersion) < 1) throw new ConfigurationError("CONFIG_SCHEMA_INVALID");
|
|
9344
|
+
validateEnvelope({ ...value, schemaVersion: CONFIGURATION_SCHEMA_VERSION }, this.context);
|
|
9345
|
+
return { source, document, value, digest: (0, import_node_crypto3.createHash)("sha256").update(source).digest("hex") };
|
|
9346
|
+
}
|
|
9347
|
+
prepareUpgrade() {
|
|
9348
|
+
const { source, document, value, digest } = this.readUpgradeSource();
|
|
9349
|
+
const original = value;
|
|
9350
|
+
const expectedDigest = digest;
|
|
9351
|
+
const steps = migrateConfigurationDocument(document);
|
|
9352
|
+
const next = parseConfigurationYaml(document.toString({ lineWidth: 0 }), this.context);
|
|
9353
|
+
const failures = Object.values(next.issues).flat();
|
|
9354
|
+
if (failures.length) throw new ConfigurationError("CONFIG_VALIDATION_FAILED", failures.map((issue) => issue.path));
|
|
9355
|
+
const before = new Map(flattenConfiguration(original));
|
|
9356
|
+
const after = new Map(flattenConfiguration(next.value));
|
|
9357
|
+
const changedFields = [.../* @__PURE__ */ new Set([...before.keys(), ...after.keys()])].filter((key) => JSON.stringify(before.get(key)) !== JSON.stringify(after.get(key))).sort();
|
|
9358
|
+
const preview = {
|
|
9359
|
+
expectedRevision: original.revision,
|
|
9360
|
+
expectedDigest,
|
|
9361
|
+
source: { schemaVersion: original.schemaVersion, domainVersions: original.domainVersions },
|
|
9362
|
+
target: { schemaVersion: next.value.schemaVersion, domainVersions: { ...CONFIGURATION_DOMAIN_VERSIONS, ...next.value.domainVersions } },
|
|
9363
|
+
steps,
|
|
9364
|
+
changedFields,
|
|
9365
|
+
changed: changedFields.length > 0
|
|
9366
|
+
};
|
|
9367
|
+
return { source, document, preview };
|
|
9368
|
+
}
|
|
9369
|
+
previewUpgrade() {
|
|
9370
|
+
return this.prepareUpgrade().preview;
|
|
9371
|
+
}
|
|
9372
|
+
recordUpgrade(value) {
|
|
9373
|
+
const file = import_node_path9.default.join(this.context.configRoot, "config-upgrade.json");
|
|
9374
|
+
const temporary = `${file}.${(0, import_node_crypto3.randomUUID)()}.tmp`;
|
|
9375
|
+
const fd = (0, import_node_fs6.openSync)(temporary, "wx", 384);
|
|
9376
|
+
try {
|
|
9377
|
+
(0, import_node_fs6.writeFileSync)(fd, JSON.stringify(value, null, 2) + "\n");
|
|
9378
|
+
(0, import_node_fs6.fsyncSync)(fd);
|
|
9379
|
+
} finally {
|
|
9380
|
+
(0, import_node_fs6.closeSync)(fd);
|
|
9381
|
+
}
|
|
9382
|
+
try {
|
|
9383
|
+
(0, import_node_fs6.renameSync)(temporary, file);
|
|
9384
|
+
const parent = (0, import_node_fs6.openSync)(this.context.configRoot, "r");
|
|
9385
|
+
try {
|
|
9386
|
+
(0, import_node_fs6.fsyncSync)(parent);
|
|
9387
|
+
} finally {
|
|
9388
|
+
(0, import_node_fs6.closeSync)(parent);
|
|
9389
|
+
}
|
|
9390
|
+
} finally {
|
|
9391
|
+
if ((0, import_node_fs6.existsSync)(temporary)) (0, import_node_fs6.unlinkSync)(temporary);
|
|
9392
|
+
}
|
|
9393
|
+
}
|
|
9394
|
+
upgrade(expected) {
|
|
9395
|
+
return this.locked(() => {
|
|
9396
|
+
const { source, document, preview } = this.prepareUpgrade();
|
|
9397
|
+
if (preview.expectedRevision !== expected.revision || preview.expectedDigest !== expected.digest) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
|
|
9398
|
+
if (!preview.changed) {
|
|
9399
|
+
const receiptFile = import_node_path9.default.join(this.context.configRoot, "config-upgrade.json");
|
|
9400
|
+
if ((0, import_node_fs6.existsSync)(receiptFile)) {
|
|
9401
|
+
const receipt = JSON.parse(readPrivateFile(receiptFile));
|
|
9402
|
+
if (isConfigurationObject(receipt) && receipt.phase === "prepared" && receipt.plannedDigest === expected.digest)
|
|
9403
|
+
this.recordUpgrade({ ...receipt, phase: "committed", savedRevision: expected.revision, digest: expected.digest });
|
|
9404
|
+
}
|
|
9405
|
+
return { ...preview, savedRevision: expected.revision, digest: expected.digest };
|
|
9406
|
+
}
|
|
9407
|
+
return withConfigurationUpgradeOwnership(this.context, () => {
|
|
9408
|
+
const revision = expected.revision + 1;
|
|
9409
|
+
if (!Number.isSafeInteger(revision)) throw new ConfigurationError("CONFIG_REVISION_INVALID");
|
|
9410
|
+
document.set("revision", revision);
|
|
9411
|
+
const backupId = `${Date.now()}-${(0, import_node_crypto3.randomUUID)()}.yaml`;
|
|
9412
|
+
const plannedDigest = (0, import_node_crypto3.createHash)("sha256").update(document.toString({ lineWidth: 0 })).digest("hex");
|
|
9413
|
+
this.recordUpgrade({ ...preview, backupId, plannedDigest, phase: "prepared" });
|
|
9414
|
+
const next = this.publish(document, source, backupId);
|
|
9415
|
+
const result = { ...preview, savedRevision: next.value.revision, digest: next.digest, backupId };
|
|
9416
|
+
this.recordUpgrade({ ...result, phase: "committed" });
|
|
9417
|
+
return result;
|
|
9418
|
+
});
|
|
9419
|
+
});
|
|
9420
|
+
}
|
|
9246
9421
|
restoreBackup(id, expected) {
|
|
9247
9422
|
return this.locked(() => {
|
|
9248
9423
|
const { source, backup, preview } = this.prepareRestore(id);
|
|
@@ -9287,7 +9462,7 @@ var ConfigurationStore = class {
|
|
|
9287
9462
|
}
|
|
9288
9463
|
};
|
|
9289
9464
|
function emptyConfiguration(context) {
|
|
9290
|
-
return { schemaVersion:
|
|
9465
|
+
return { schemaVersion: CONFIGURATION_SCHEMA_VERSION, revision: 0, kind: context.kind, instanceId: context.instanceId, domainVersions: {}, migrations: {} };
|
|
9291
9466
|
}
|
|
9292
9467
|
function setConfigurationValue(target, key, value) {
|
|
9293
9468
|
const parts = configurationPathSegments(key);
|
|
@@ -9301,7 +9476,7 @@ function setConfigurationValue(target, key, value) {
|
|
|
9301
9476
|
const last = parts.at(-1);
|
|
9302
9477
|
if (unsafeKeys.has(last)) throw new ConfigurationError("CONFIG_FIELD_INVALID");
|
|
9303
9478
|
current[last] = value;
|
|
9304
|
-
target.domainVersions[domainForPath(key)] = 1;
|
|
9479
|
+
target.domainVersions[domainForPath(key)] = CONFIGURATION_DOMAIN_VERSIONS[domainForPath(key)] ?? 1;
|
|
9305
9480
|
}
|
|
9306
9481
|
|
|
9307
9482
|
// packages/config-node/src/runtime.ts
|