@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.
Files changed (84) hide show
  1. package/manifest.json +156 -151
  2. package/native.tar.gz +0 -0
  3. package/package.json +1 -1
  4. package/payload/app-server/build-info.json +4 -4
  5. package/payload/app-server/index.cjs +191 -19
  6. package/payload/app-server/index.cjs.map +1 -1
  7. package/payload/backend/build-info.json +4 -4
  8. package/payload/backend/dev-resources/control.cjs +195 -20
  9. package/payload/backend/index.cjs +195 -19
  10. package/payload/backend/scheduled-tasks-sqlite-worker.cjs +11 -7
  11. package/payload/frontend/dist/assets/{_baseUniq-B6OtH5JH.js → _baseUniq-Z8S1OGl1.js} +1 -1
  12. package/payload/frontend/dist/assets/{access-CpH3nCnI.js → access-BkQls-gl.js} +1 -1
  13. package/payload/frontend/dist/assets/{advanced-U5MqNTD5.js → advanced-Cwuko7dT.js} +1 -1
  14. package/payload/frontend/dist/assets/{appearance-Cb8XjaOT.js → appearance-D1NbgiL9.js} +1 -1
  15. package/payload/frontend/dist/assets/{arc-CEnFQNMK.js → arc-yTzSLmPE.js} +1 -1
  16. package/payload/frontend/dist/assets/{architectureDiagram-Q4EWVU46-T438RyEG.js → architectureDiagram-Q4EWVU46-BvvnA771.js} +1 -1
  17. package/payload/frontend/dist/assets/{blockDiagram-DXYQGD6D-B6Mqb9og.js → blockDiagram-DXYQGD6D-4mSkYwEH.js} +1 -1
  18. package/payload/frontend/dist/assets/{c4Diagram-AHTNJAMY-CO3eA3hw.js → c4Diagram-AHTNJAMY-BFsQYjNJ.js} +1 -1
  19. package/payload/frontend/dist/assets/channel-DGu_xwRJ.js +1 -0
  20. package/payload/frontend/dist/assets/{chunk-4BX2VUAB-1vjsV_mH.js → chunk-4BX2VUAB-B4j2kD8S.js} +1 -1
  21. package/payload/frontend/dist/assets/{chunk-4TB4RGXK-CtMNFDLV.js → chunk-4TB4RGXK-BHHtOn_W.js} +1 -1
  22. package/payload/frontend/dist/assets/{chunk-55IACEB6-DVWWqMjZ.js → chunk-55IACEB6-npi1DjnI.js} +1 -1
  23. package/payload/frontend/dist/assets/{chunk-EDXVE4YY-BBf3C6eJ.js → chunk-EDXVE4YY-6XoKXtpJ.js} +1 -1
  24. package/payload/frontend/dist/assets/{chunk-FMBD7UC4-BUQfXSvf.js → chunk-FMBD7UC4-D5wdm5pu.js} +1 -1
  25. package/payload/frontend/dist/assets/{chunk-OYMX7WX6-DM1nFyON.js → chunk-OYMX7WX6-CdQRrw_z.js} +1 -1
  26. package/payload/frontend/dist/assets/{chunk-QZHKN3VN-Bz3CUNpU.js → chunk-QZHKN3VN-j-pcsMU1.js} +1 -1
  27. package/payload/frontend/dist/assets/{chunk-YZCP3GAM-Bb6CnKMv.js → chunk-YZCP3GAM-ISBm3jAD.js} +1 -1
  28. package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-Xx1qN_NY.js +1 -0
  29. package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-Xx1qN_NY.js +1 -0
  30. package/payload/frontend/dist/assets/clone-DdDT5GkX.js +1 -0
  31. package/payload/frontend/dist/assets/{connection-ChK196PA.js → connection-BL2ZiJKS.js} +1 -1
  32. package/payload/frontend/dist/assets/{connections-1OP6Izpn.js → connections-BuXymnab.js} +1 -1
  33. package/payload/frontend/dist/assets/{cose-bilkent-S5V4N54A-DvX1W1oQ.js → cose-bilkent-S5V4N54A-D3ioXA7D.js} +1 -1
  34. package/payload/frontend/dist/assets/{dagre-KV5264BT-BYV7l80W.js → dagre-KV5264BT-DjtjEtE5.js} +1 -1
  35. package/payload/frontend/dist/assets/{desktop-DKYPd_Z3.js → desktop-Du3Gd9LW.js} +1 -1
  36. package/payload/frontend/dist/assets/{diagram-5BDNPKRD-BU_VxMcA.js → diagram-5BDNPKRD-CtxPyS9C.js} +1 -1
  37. package/payload/frontend/dist/assets/{diagram-G4DWMVQ6-6jnkLcPr.js → diagram-G4DWMVQ6-ikqU0pq3.js} +1 -1
  38. package/payload/frontend/dist/assets/{diagram-MMDJMWI5-DAjbbS4T.js → diagram-MMDJMWI5-CoKNp7eo.js} +1 -1
  39. package/payload/frontend/dist/assets/{diagram-TYMM5635-p2T86-Pr.js → diagram-TYMM5635-7xoHFg4D.js} +1 -1
  40. package/payload/frontend/dist/assets/{erDiagram-SMLLAGMA-DcZPoxkO.js → erDiagram-SMLLAGMA-Da8Jm4bc.js} +1 -1
  41. package/payload/frontend/dist/assets/{flowDiagram-DWJPFMVM-CDB-5IUB.js → flowDiagram-DWJPFMVM-bcIflYKx.js} +1 -1
  42. package/payload/frontend/dist/assets/{ganttDiagram-T4ZO3ILL-imCnxO5S.js → ganttDiagram-T4ZO3ILL-CCSwpL4k.js} +1 -1
  43. package/payload/frontend/dist/assets/{gitGraphDiagram-UUTBAWPF-DW7bWVfm.js → gitGraphDiagram-UUTBAWPF-C5YN1uxh.js} +1 -1
  44. package/payload/frontend/dist/assets/{graph-rPoUAwm2.js → graph-DhVKaWIc.js} +1 -1
  45. package/payload/frontend/dist/assets/{image-pt4OUNUX.js → image-CAXFSZmt.js} +1 -1
  46. package/payload/frontend/dist/assets/{index-CpU0rt1e.js → index-BPgmi_HT.js} +5 -5
  47. package/payload/frontend/dist/assets/{infoDiagram-42DDH7IO-C6DYDEhQ.js → infoDiagram-42DDH7IO-CKUkVeJd.js} +1 -1
  48. package/payload/frontend/dist/assets/{ishikawaDiagram-UXIWVN3A-o3dlbDPW.js → ishikawaDiagram-UXIWVN3A-Cu6SCNrB.js} +1 -1
  49. package/payload/frontend/dist/assets/{journeyDiagram-VCZTEJTY-ukG3M2cI.js → journeyDiagram-VCZTEJTY-BJsUgp8J.js} +1 -1
  50. package/payload/frontend/dist/assets/{kanban-definition-6JOO6SKY-CzFLztFd.js → kanban-definition-6JOO6SKY-BGowhqfi.js} +1 -1
  51. package/payload/frontend/dist/assets/{layout-C8SEMYSj.js → layout-CunOX6M2.js} +1 -1
  52. package/payload/frontend/dist/assets/{linear-DY8vPita.js → linear-C_0D1AIt.js} +1 -1
  53. package/payload/frontend/dist/assets/{main-B_ifx48h.js → main-D9JUBZrL.js} +139 -139
  54. package/payload/frontend/dist/assets/{min-9StlgeN8.js → min-CYRFaNhC.js} +1 -1
  55. package/payload/frontend/dist/assets/{mindmap-definition-QFDTVHPH-CyJisFtS.js → mindmap-definition-QFDTVHPH-CC29vHKR.js} +1 -1
  56. package/payload/frontend/dist/assets/{monitoring-Bjm0etKL.js → monitoring-CSJEFZ4D.js} +1 -1
  57. package/payload/frontend/dist/assets/{notifications-DhRLCgMU.js → notifications-B6plZwi5.js} +1 -1
  58. package/payload/frontend/dist/assets/{pieDiagram-DEJITSTG-DHSht7rk.js → pieDiagram-DEJITSTG-ZPTChlGS.js} +1 -1
  59. package/payload/frontend/dist/assets/{quadrantDiagram-34T5L4WZ-92xIujrE.js → quadrantDiagram-34T5L4WZ-B4sL0Weo.js} +1 -1
  60. package/payload/frontend/dist/assets/{record-content-Cy_dPSdi.js → record-content-DBb8tU0P.js} +1 -1
  61. package/payload/frontend/dist/assets/{requirementDiagram-MS252O5E-CXuOqrNd.js → requirementDiagram-MS252O5E-Q2PHuGEG.js} +1 -1
  62. package/payload/frontend/dist/assets/{sankeyDiagram-XADWPNL6-DR-mjY0Y.js → sankeyDiagram-XADWPNL6-k8w1jlHT.js} +1 -1
  63. package/payload/frontend/dist/assets/{sequenceDiagram-FGHM5R23-DmmUpAoP.js → sequenceDiagram-FGHM5R23-0qPxopqC.js} +1 -1
  64. package/payload/frontend/dist/assets/{stateDiagram-FHFEXIEX-CKoqQ0-j.js → stateDiagram-FHFEXIEX-BHxYXi2c.js} +1 -1
  65. package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-s5VUMcqx.js +1 -0
  66. package/payload/frontend/dist/assets/{status-B__OyRqS.js → status-Zy2MW6gr.js} +1 -1
  67. package/payload/frontend/dist/assets/suiji-5pox13NE.js +1 -0
  68. package/payload/frontend/dist/assets/{svg-BpvEgtI3.js → svg-vmNZnz5w.js} +1 -1
  69. package/payload/frontend/dist/assets/{tabs-BjCNEXFA.js → tabs-C257BfM6.js} +1 -1
  70. package/payload/frontend/dist/assets/{timeline-definition-GMOUNBTQ-CHT2sQNz.js → timeline-definition-GMOUNBTQ-BC_3Dip2.js} +1 -1
  71. package/payload/frontend/dist/assets/{vennDiagram-DHZGUBPP-Bvnh5q4I.js → vennDiagram-DHZGUBPP-V_X88VPq.js} +1 -1
  72. package/payload/frontend/dist/assets/{wardley-RL74JXVD-DeQXKB6h.js → wardley-RL74JXVD-CflQhbCA.js} +1 -1
  73. package/payload/frontend/dist/assets/{wardleyDiagram-NUSXRM2D-jWo5oC0L.js → wardleyDiagram-NUSXRM2D-C75i3btX.js} +1 -1
  74. package/payload/frontend/dist/assets/{xychartDiagram-5P7HB3ND-Btji0cq9.js → xychartDiagram-5P7HB3ND-KIYpQyyi.js} +1 -1
  75. package/payload/frontend/dist/build-info.json +4 -4
  76. package/payload/frontend/dist/companion.html +1 -1
  77. package/payload/frontend/dist/index.html +2 -2
  78. package/payload/server/index.cjs +203 -19
  79. package/payload/frontend/dist/assets/channel-D7VgadXd.js +0 -1
  80. package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-DHRHkXVC.js +0 -1
  81. package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-DHRHkXVC.js +0 -1
  82. package/payload/frontend/dist/assets/clone-BzLTnNJj.js +0 -1
  83. package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-BfZc0BCX.js +0 -1
  84. package/payload/frontend/dist/assets/suiji-nz2Jwmpc.js +0 -1
@@ -7489,13 +7489,35 @@ function registerStableConfigurationRoot(context) {
7489
7489
  (0, import_node_fs3.closeSync)(registryFd);
7490
7490
  }
7491
7491
  }
7492
-
7493
- // packages/config-node/src/store.ts
7494
- var import_node_fs4 = require("node:fs");
7495
- var import_node_path4 = __toESM(require("node:path"), 1);
7496
- var import_node_crypto2 = require("node:crypto");
7497
- var import_yaml = __toESM(require_dist(), 1);
7498
- var import_fs_native_extensions2 = require("fs-native-extensions");
7492
+ function withUpgradeGate(context, shared, run) {
7493
+ const directory = ownerDirectory(context);
7494
+ const fd = (0, import_node_fs3.openSync)(import_node_path2.default.join(directory, "configuration-upgrade.lock"), import_node_fs3.constants.O_CREAT | import_node_fs3.constants.O_RDWR | import_node_fs3.constants.O_NOFOLLOW, 384);
7495
+ try {
7496
+ assertPrivateDescriptor(fd);
7497
+ if (!(0, import_fs_native_extensions.tryLock)(fd, 0, 0, { shared })) throw new ConfigurationError("CONFIG_UPGRADE_BUSY");
7498
+ return run();
7499
+ } finally {
7500
+ (0, import_node_fs3.closeSync)(fd);
7501
+ }
7502
+ }
7503
+ function withConfigurationUpgradeOwnership(context, run, ignoredRoles = []) {
7504
+ return withUpgradeGate(context, false, () => {
7505
+ const directory = ownerDirectory(context);
7506
+ const held = [];
7507
+ try {
7508
+ for (const file of (0, import_node_fs3.readdirSync)(directory).filter((name) => name.endsWith(".owner.lock"))) {
7509
+ if (ignoredRoles.includes(file.replace(/\.owner\.lock$/, ""))) continue;
7510
+ const fd = (0, import_node_fs3.openSync)(import_node_path2.default.join(directory, file), import_node_fs3.constants.O_RDWR | import_node_fs3.constants.O_NOFOLLOW);
7511
+ held.push(fd);
7512
+ assertPrivateDescriptor(fd);
7513
+ if (!(0, import_fs_native_extensions.tryLock)(fd)) throw new ConfigurationError("CONFIG_UPGRADE_CONSUMER_RUNNING", [file.replace(/\.owner\.lock$/, "")]);
7514
+ }
7515
+ return run();
7516
+ } finally {
7517
+ for (const fd of held) (0, import_node_fs3.closeSync)(fd);
7518
+ }
7519
+ });
7520
+ }
7499
7521
 
7500
7522
  // packages/shared/src/configuration/fields.ts
7501
7523
  var CONFIGURATION_FIELDS = [
@@ -7669,14 +7691,18 @@ var CONFIGURATION_FIELDS = [
7669
7691
  ];
7670
7692
 
7671
7693
  // packages/shared/src/configuration/compatibility.ts
7694
+ var CONFIGURATION_SCHEMA_VERSION = 1;
7695
+ var CONFIGURATION_DOMAIN_VERSIONS = Object.fromEntries(
7696
+ [...new Set(CONFIGURATION_FIELDS.map((field) => field.domain))].map((domain) => [domain, 1])
7697
+ );
7672
7698
  var CONFIGURATION_COMPATIBILITY = {
7673
7699
  format: "runweave-yaml",
7674
- schemaVersions: [1],
7675
- domainVersions: Object.fromEntries([...new Set(CONFIGURATION_FIELDS.map((field) => field.domain))].map((domain) => [domain, [1]]))
7700
+ schemaVersions: [CONFIGURATION_SCHEMA_VERSION],
7701
+ domainVersions: Object.fromEntries(Object.entries(CONFIGURATION_DOMAIN_VERSIONS).map(([domain, version]) => [domain, [version]]))
7676
7702
  };
7677
7703
  var APP_SERVER_CONFIGURATION_COMPATIBILITY = {
7678
7704
  ...CONFIGURATION_COMPATIBILITY,
7679
- domainVersions: Object.fromEntries(["appServer", "agents.codex", "agents.traex"].map((domain) => [domain, [1]]))
7705
+ domainVersions: Object.fromEntries(["appServer", "agents.codex", "agents.traex"].map((domain) => [domain, [CONFIGURATION_DOMAIN_VERSIONS[domain]]]))
7680
7706
  };
7681
7707
  function supportsConfiguration(target, value) {
7682
7708
  if (!target || typeof target !== "object") return false;
@@ -7752,6 +7778,66 @@ function configurationPathSegment(key) {
7752
7778
  return key.replace(/\\/g, "\\\\").replace(/\./g, "\\.");
7753
7779
  }
7754
7780
 
7781
+ // packages/config-node/src/version-migrations.ts
7782
+ var CONFIGURATION_VERSION_MIGRATIONS = [];
7783
+ function migrateConfigurationDocument(document) {
7784
+ const steps = [];
7785
+ const ids = /* @__PURE__ */ new Set();
7786
+ const edges = /* @__PURE__ */ new Set();
7787
+ for (const step of CONFIGURATION_VERSION_MIGRATIONS) {
7788
+ const edge = `${step.domain ?? "$schema"}:${step.from}`;
7789
+ 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)) {
7790
+ throw new ConfigurationError("CONFIG_UPGRADE_REGISTRY_INVALID");
7791
+ }
7792
+ ids.add(step.id);
7793
+ edges.add(edge);
7794
+ }
7795
+ const advance = (domain, target) => {
7796
+ const versionPath = domain ? ["domainVersions", domain] : ["schemaVersion"];
7797
+ let version = Number(document.getIn(versionPath) ?? 1);
7798
+ if (version > target) throw new ConfigurationError("CONFIG_UPGRADE_FUTURE_VERSION", [domain ?? "schemaVersion"]);
7799
+ while (version < target) {
7800
+ const step = CONFIGURATION_VERSION_MIGRATIONS.find((item) => item.domain === domain && item.from === version);
7801
+ if (!step) throw new ConfigurationError("CONFIG_UPGRADE_PATH_MISSING", [domain ?? "schemaVersion"]);
7802
+ const before = document.toJS();
7803
+ try {
7804
+ step.migrate(document);
7805
+ } catch {
7806
+ throw new ConfigurationError("CONFIG_UPGRADE_STEP_FAILED", [step.id]);
7807
+ }
7808
+ const after = document.toJS();
7809
+ for (const key of ["schemaVersion", "revision", "kind", "instanceId", "domainVersions", "migrations"]) {
7810
+ if (JSON.stringify(before[key]) !== JSON.stringify(after[key])) throw new ConfigurationError("CONFIG_UPGRADE_METADATA_CHANGED", [step.id]);
7811
+ }
7812
+ if (domain) {
7813
+ const strip = (value) => {
7814
+ const copy = structuredClone(value);
7815
+ const parts = domain.split(".");
7816
+ let parent = copy;
7817
+ for (const key of parts.slice(0, -1)) parent = parent[key] ?? {};
7818
+ delete parent[parts.at(-1)];
7819
+ return copy;
7820
+ };
7821
+ if (JSON.stringify(strip(before)) !== JSON.stringify(strip(after))) throw new ConfigurationError("CONFIG_UPGRADE_SCOPE_CHANGED", [step.id]);
7822
+ }
7823
+ document.setIn(versionPath, step.to);
7824
+ document.setIn(["migrations", `version:${step.id}`], { from: step.from, to: step.to, domain: domain ?? "$schema" });
7825
+ steps.push(step.id);
7826
+ version = step.to;
7827
+ }
7828
+ };
7829
+ advance(void 0, CONFIGURATION_SCHEMA_VERSION);
7830
+ for (const [domain, target] of Object.entries(CONFIGURATION_DOMAIN_VERSIONS)) advance(domain, target);
7831
+ return steps;
7832
+ }
7833
+
7834
+ // packages/config-node/src/store.ts
7835
+ var import_node_fs4 = require("node:fs");
7836
+ var import_node_path4 = __toESM(require("node:path"), 1);
7837
+ var import_node_crypto2 = require("node:crypto");
7838
+ var import_yaml = __toESM(require_dist(), 1);
7839
+ var import_fs_native_extensions2 = require("fs-native-extensions");
7840
+
7755
7841
  // packages/config-node/src/validation.ts
7756
7842
  var import_node_path3 = __toESM(require("node:path"), 1);
7757
7843
  var patterns = CONFIGURATION_FIELDS.map((field) => ({ field, segments: field.path.replace(/\[\]/g, ".#").split(".") }));
@@ -7775,7 +7861,7 @@ function domainForPath(key) {
7775
7861
  }
7776
7862
  function validateEnvelope(value, context) {
7777
7863
  if (!isConfigurationObject(value)) throw new ConfigurationError("CONFIG_ROOT_INVALID");
7778
- if (value.schemaVersion !== 1) throw new ConfigurationError("CONFIG_SCHEMA_UNSUPPORTED");
7864
+ if (value.schemaVersion !== CONFIGURATION_SCHEMA_VERSION) throw new ConfigurationError("CONFIG_SCHEMA_UNSUPPORTED");
7779
7865
  if (!Number.isSafeInteger(value.revision) || Number(value.revision) < 0) throw new ConfigurationError("CONFIG_REVISION_INVALID");
7780
7866
  if (value.kind !== context.kind || value.instanceId !== context.instanceId) throw new ConfigurationError("CONFIG_IDENTITY_MISMATCH");
7781
7867
  if (!isConfigurationObject(value.domainVersions) || !isConfigurationObject(value.migrations)) throw new ConfigurationError("CONFIG_METADATA_INVALID");
@@ -7797,7 +7883,7 @@ function validateDomains(value, context) {
7797
7883
  if (["schemaVersion", "revision", "kind", "instanceId", "domainVersions", "migrations"].includes(key.split(".")[0])) continue;
7798
7884
  const domain = domainForPath(key);
7799
7885
  if (domain === "agents.team") continue;
7800
- if (value.domainVersions[domain] !== void 0 && value.domainVersions[domain] !== 1) {
7886
+ if (value.domainVersions[domain] !== void 0 && value.domainVersions[domain] !== CONFIGURATION_DOMAIN_VERSIONS[domain]) {
7801
7887
  issue(key, "CONFIG_DOMAIN_VERSION_UNSUPPORTED");
7802
7888
  continue;
7803
7889
  }
@@ -7872,7 +7958,7 @@ function validateDomains(value, context) {
7872
7958
  }
7873
7959
  for (const [domain, version] of Object.entries(value.domainVersions)) {
7874
7960
  if (domain === "agents.team") continue;
7875
- if (version !== 1 && !result[domain]) result[domain] = [{ path: domain, code: "CONFIG_DOMAIN_VERSION_UNSUPPORTED" }];
7961
+ if (version !== CONFIGURATION_DOMAIN_VERSIONS[domain] && !result[domain]) result[domain] = [{ path: domain, code: "CONFIG_DOMAIN_VERSION_UNSUPPORTED" }];
7876
7962
  }
7877
7963
  return result;
7878
7964
  }
@@ -7977,7 +8063,7 @@ var ConfigurationStore = class {
7977
8063
  (0, import_node_fs4.closeSync)(fd);
7978
8064
  }
7979
8065
  }
7980
- publish(document, previous) {
8066
+ publish(document, previous, backupId) {
7981
8067
  const source = document.toString({ lineWidth: 0 });
7982
8068
  const checked = parseConfigurationYaml(source, this.context);
7983
8069
  registerStableConfigurationRoot(this.context);
@@ -7987,7 +8073,7 @@ var ConfigurationStore = class {
7987
8073
  (0, import_node_fs4.mkdirSync)(backupRoot, { recursive: true, mode: 448 });
7988
8074
  const backupStat = (0, import_node_fs4.lstatSync)(backupRoot);
7989
8075
  if (!backupStat.isDirectory() || backupStat.isSymbolicLink() || backupStat.mode & 63 || typeof process.getuid === "function" && backupStat.uid !== process.getuid()) throw new ConfigurationError("CONFIG_BACKUP_ROOT_INVALID");
7990
- const backup = import_node_path4.default.join(backupRoot, `${Date.now()}-${(0, import_node_crypto2.randomUUID)()}.yaml`);
8076
+ const backup = import_node_path4.default.join(backupRoot, backupId ?? `${Date.now()}-${(0, import_node_crypto2.randomUUID)()}.yaml`);
7991
8077
  const fd2 = (0, import_node_fs4.openSync)(backup, "wx", 384);
7992
8078
  try {
7993
8079
  (0, import_node_fs4.writeFileSync)(fd2, previous);
@@ -8034,7 +8120,7 @@ var ConfigurationStore = class {
8034
8120
  const segments = configurationPathSegments(key);
8035
8121
  if (!segments.length || segments.some((part) => !part || unsafeKeys.has(part))) throw new ConfigurationError("CONFIG_FIELD_INVALID");
8036
8122
  const domain = domainForPath(key);
8037
- if (current.value.domainVersions[domain] !== void 0 && current.value.domainVersions[domain] !== 1) throw new ConfigurationError("CONFIG_DOMAIN_VERSION_UNSUPPORTED", [domain]);
8123
+ if (current.value.domainVersions[domain] !== void 0 && current.value.domainVersions[domain] !== CONFIGURATION_DOMAIN_VERSIONS[domain]) throw new ConfigurationError("CONFIG_DOMAIN_VERSION_UNSUPPORTED", [domain]);
8038
8124
  const field = fieldForPath(key);
8039
8125
  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]);
8040
8126
  if (options.remote && (!field || !field.remote)) throw new ConfigurationError("CONFIG_FIELD_FORBIDDEN", [key]);
@@ -8044,7 +8130,7 @@ var ConfigurationStore = class {
8044
8130
  for (const segment of segments) target.push((0, import_yaml.isSeq)(current.document.getIn(target, true)) && /^\d+$/.test(segment) ? Number(segment) : segment);
8045
8131
  if (!field && value === null) current.document.deleteIn(target);
8046
8132
  else current.document.setIn(target, value);
8047
- current.document.setIn(["domainVersions", domain], 1);
8133
+ current.document.setIn(["domainVersions", domain], CONFIGURATION_DOMAIN_VERSIONS[domain]);
8048
8134
  domains.add(domain);
8049
8135
  }
8050
8136
  const revision = Math.max(current.value.revision, options.minimumRevision ?? 0) + 1;
@@ -8082,7 +8168,7 @@ var ConfigurationStore = class {
8082
8168
  const source = readPrivateFile(this.file);
8083
8169
  const { value } = parseYamlDocument(source);
8084
8170
  if (!isConfigurationObject(value) || !Number.isSafeInteger(value.schemaVersion) || Number(value.schemaVersion) < 1) throw new ConfigurationError("CONFIG_SCHEMA_INVALID");
8085
- validateEnvelope({ ...value, schemaVersion: 1 }, this.context);
8171
+ validateEnvelope({ ...value, schemaVersion: CONFIGURATION_SCHEMA_VERSION }, this.context);
8086
8172
  const backup = this.readBackup(id);
8087
8173
  const before = new Map(flattenConfiguration(value));
8088
8174
  const after = new Map(flattenConfiguration(backup.value));
@@ -8101,6 +8187,89 @@ var ConfigurationStore = class {
8101
8187
  previewRestore(id) {
8102
8188
  return this.prepareRestore(id).preview;
8103
8189
  }
8190
+ /** Upgrade control plane only; business readers must use read(). */
8191
+ readUpgradeSource() {
8192
+ assertPrivateDirectory(this.context.configRoot);
8193
+ const source = readPrivateFile(this.file);
8194
+ const { document, value } = parseYamlDocument(source);
8195
+ if (!isConfigurationObject(value) || !Number.isSafeInteger(value.schemaVersion) || Number(value.schemaVersion) < 1) throw new ConfigurationError("CONFIG_SCHEMA_INVALID");
8196
+ validateEnvelope({ ...value, schemaVersion: CONFIGURATION_SCHEMA_VERSION }, this.context);
8197
+ return { source, document, value, digest: (0, import_node_crypto2.createHash)("sha256").update(source).digest("hex") };
8198
+ }
8199
+ prepareUpgrade() {
8200
+ const { source, document, value, digest } = this.readUpgradeSource();
8201
+ const original = value;
8202
+ const expectedDigest = digest;
8203
+ const steps = migrateConfigurationDocument(document);
8204
+ const next = parseConfigurationYaml(document.toString({ lineWidth: 0 }), this.context);
8205
+ const failures = Object.values(next.issues).flat();
8206
+ if (failures.length) throw new ConfigurationError("CONFIG_VALIDATION_FAILED", failures.map((issue) => issue.path));
8207
+ const before = new Map(flattenConfiguration(original));
8208
+ const after = new Map(flattenConfiguration(next.value));
8209
+ const changedFields = [.../* @__PURE__ */ new Set([...before.keys(), ...after.keys()])].filter((key) => JSON.stringify(before.get(key)) !== JSON.stringify(after.get(key))).sort();
8210
+ const preview = {
8211
+ expectedRevision: original.revision,
8212
+ expectedDigest,
8213
+ source: { schemaVersion: original.schemaVersion, domainVersions: original.domainVersions },
8214
+ target: { schemaVersion: next.value.schemaVersion, domainVersions: { ...CONFIGURATION_DOMAIN_VERSIONS, ...next.value.domainVersions } },
8215
+ steps,
8216
+ changedFields,
8217
+ changed: changedFields.length > 0
8218
+ };
8219
+ return { source, document, preview };
8220
+ }
8221
+ previewUpgrade() {
8222
+ return this.prepareUpgrade().preview;
8223
+ }
8224
+ recordUpgrade(value) {
8225
+ const file = import_node_path4.default.join(this.context.configRoot, "config-upgrade.json");
8226
+ const temporary = `${file}.${(0, import_node_crypto2.randomUUID)()}.tmp`;
8227
+ const fd = (0, import_node_fs4.openSync)(temporary, "wx", 384);
8228
+ try {
8229
+ (0, import_node_fs4.writeFileSync)(fd, JSON.stringify(value, null, 2) + "\n");
8230
+ (0, import_node_fs4.fsyncSync)(fd);
8231
+ } finally {
8232
+ (0, import_node_fs4.closeSync)(fd);
8233
+ }
8234
+ try {
8235
+ (0, import_node_fs4.renameSync)(temporary, file);
8236
+ const parent = (0, import_node_fs4.openSync)(this.context.configRoot, "r");
8237
+ try {
8238
+ (0, import_node_fs4.fsyncSync)(parent);
8239
+ } finally {
8240
+ (0, import_node_fs4.closeSync)(parent);
8241
+ }
8242
+ } finally {
8243
+ if ((0, import_node_fs4.existsSync)(temporary)) (0, import_node_fs4.unlinkSync)(temporary);
8244
+ }
8245
+ }
8246
+ upgrade(expected) {
8247
+ return this.locked(() => {
8248
+ const { source, document, preview } = this.prepareUpgrade();
8249
+ if (preview.expectedRevision !== expected.revision || preview.expectedDigest !== expected.digest) throw new ConfigurationError("CONFIG_REVISION_CONFLICT");
8250
+ if (!preview.changed) {
8251
+ const receiptFile = import_node_path4.default.join(this.context.configRoot, "config-upgrade.json");
8252
+ if ((0, import_node_fs4.existsSync)(receiptFile)) {
8253
+ const receipt = JSON.parse(readPrivateFile(receiptFile));
8254
+ if (isConfigurationObject(receipt) && receipt.phase === "prepared" && receipt.plannedDigest === expected.digest)
8255
+ this.recordUpgrade({ ...receipt, phase: "committed", savedRevision: expected.revision, digest: expected.digest });
8256
+ }
8257
+ return { ...preview, savedRevision: expected.revision, digest: expected.digest };
8258
+ }
8259
+ return withConfigurationUpgradeOwnership(this.context, () => {
8260
+ const revision = expected.revision + 1;
8261
+ if (!Number.isSafeInteger(revision)) throw new ConfigurationError("CONFIG_REVISION_INVALID");
8262
+ document.set("revision", revision);
8263
+ const backupId = `${Date.now()}-${(0, import_node_crypto2.randomUUID)()}.yaml`;
8264
+ const plannedDigest = (0, import_node_crypto2.createHash)("sha256").update(document.toString({ lineWidth: 0 })).digest("hex");
8265
+ this.recordUpgrade({ ...preview, backupId, plannedDigest, phase: "prepared" });
8266
+ const next = this.publish(document, source, backupId);
8267
+ const result = { ...preview, savedRevision: next.value.revision, digest: next.digest, backupId };
8268
+ this.recordUpgrade({ ...result, phase: "committed" });
8269
+ return result;
8270
+ });
8271
+ });
8272
+ }
8104
8273
  restoreBackup(id, expected) {
8105
8274
  return this.locked(() => {
8106
8275
  const { source, backup, preview } = this.prepareRestore(id);
@@ -8579,6 +8748,21 @@ async function runServerRuntime(args) {
8579
8748
  if (process.platform === "linux" && !process.report.getReport().header.glibcVersionRuntime)
8580
8749
  throw new Error("Linux glibc is required");
8581
8750
  const [command, component] = args;
8751
+ if (command === "config-plan" || command === "config-apply") {
8752
+ const store = new ConfigurationStore(context);
8753
+ const preview = store.previewUpgrade();
8754
+ const appCapability = readJson(import_node_path8.default.join(release, "app-server/configuration-compatibility.json"));
8755
+ if (!supportsConfiguration(appCapability, preview.target)) throw new Error("CONFIG_UPGRADE_APP_SERVER_INCOMPATIBLE");
8756
+ if (command === "config-plan") {
8757
+ process.stdout.write(JSON.stringify(preview) + "\n");
8758
+ } else {
8759
+ const revision = configurationOption("expected-revision", args);
8760
+ const digest = configurationOption("expected-digest", args);
8761
+ if (revision === void 0 || !Number.isSafeInteger(Number(revision)) || Number(revision) < 0 || !/^[a-f0-9]{64}$/.test(digest ?? "")) throw new Error("CONFIG_UPGRADE_PREVIEW_REQUIRED");
8762
+ process.stdout.write(JSON.stringify(store.upgrade({ revision: Number(revision), digest })) + "\n");
8763
+ }
8764
+ return;
8765
+ }
8582
8766
  if (command === "inspect") {
8583
8767
  const requireNative = (0, import_node_module.createRequire)(
8584
8768
  import_node_path8.default.join(release, "backend/index.cjs")
@@ -8609,7 +8793,7 @@ async function runServerRuntime(args) {
8609
8793
  }
8610
8794
  if (require.main === module)
8611
8795
  void runServerRuntime(process.argv.slice(2)).catch((error) => {
8612
- process.stderr.write(`${error.message}
8796
+ process.stderr.write(error instanceof ConfigurationError ? JSON.stringify({ code: error.code, fields: error.fields, location: error.location }) + "\n" : `${error.message}
8613
8797
  `);
8614
8798
  process.exitCode = 1;
8615
8799
  });
@@ -1 +0,0 @@
1
- import{U as a,M as n}from"./index-CpU0rt1e.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as e,C as t}from"./chunk-4TB4RGXK-CtMNFDLV.js";import{_ as i}from"./index-CpU0rt1e.js";import"./chunk-FMBD7UC4-BUQfXSvf.js";import"./chunk-YZCP3GAM-Bb6CnKMv.js";import"./chunk-55IACEB6-DVWWqMjZ.js";import"./chunk-EDXVE4YY-BBf3C6eJ.js";import"./main-B_ifx48h.js";import"./index-D9-cSGu-.js";import"./record-content-Cy_dPSdi.js";var b={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{b as diagram};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as e,C as t}from"./chunk-4TB4RGXK-CtMNFDLV.js";import{_ as i}from"./index-CpU0rt1e.js";import"./chunk-FMBD7UC4-BUQfXSvf.js";import"./chunk-YZCP3GAM-Bb6CnKMv.js";import"./chunk-55IACEB6-DVWWqMjZ.js";import"./chunk-EDXVE4YY-BBf3C6eJ.js";import"./main-B_ifx48h.js";import"./index-D9-cSGu-.js";import"./record-content-Cy_dPSdi.js";var b={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{b as diagram};
@@ -1 +0,0 @@
1
- import{b as r}from"./graph-rPoUAwm2.js";var e=4;function a(o){return r(o,e)}export{a as c};
@@ -1 +0,0 @@
1
- import{s as r,b as e,a,S as s}from"./chunk-OYMX7WX6-DM1nFyON.js";import{_ as i}from"./index-CpU0rt1e.js";import"./chunk-55IACEB6-DVWWqMjZ.js";import"./chunk-EDXVE4YY-BBf3C6eJ.js";import"./index-D9-cSGu-.js";import"./main-B_ifx48h.js";import"./record-content-Cy_dPSdi.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram};
@@ -1 +0,0 @@
1
- import{j as t}from"./index-D9-cSGu-.js";import o from"./connection-ChK196PA.js";import"./main-B_ifx48h.js";import"./record-content-Cy_dPSdi.js";function n(){return t.jsx(o,{accountOnly:!0})}export{n as default};