@camstack/server 1.2.932 → 1.2.934

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 (45) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/api/trpc/generated-cap-routers.js +20 -0
  3. package/package.json +8 -7
  4. package/system/dist/addon-utils.mjs +1 -1
  5. package/system/dist/{base-device-IuM1AwXZ.mjs → base-device-Bwiblqmn.mjs} +1 -1
  6. package/system/dist/{base-device-2sL1DMm1.js → base-device-C1z4zYGR.js} +1 -1
  7. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +3 -3
  8. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +4 -4
  9. package/system/dist/builtins/alerts/alerts.addon.js +2 -2
  10. package/system/dist/builtins/alerts/alerts.addon.mjs +4 -4
  11. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +4 -4
  12. package/system/dist/builtins/camera-grid/index.js +2 -2
  13. package/system/dist/builtins/camera-grid/index.mjs +2 -2
  14. package/system/dist/builtins/composer/composer.addon.js +5 -5
  15. package/system/dist/builtins/composer/composer.addon.mjs +5 -5
  16. package/system/dist/builtins/core-blocks/cap-links.d.ts +34 -0
  17. package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +4 -0
  18. package/system/dist/builtins/core-blocks/core-blocks.addon.js +282 -8
  19. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +282 -8
  20. package/system/dist/builtins/device-manager/device-manager.addon.js +18 -4
  21. package/system/dist/builtins/device-manager/device-manager.addon.mjs +18 -4
  22. package/system/dist/builtins/local-auth/local-auth.addon.mjs +3 -3
  23. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  24. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +9 -9
  25. package/system/dist/builtins/platform-probe/index.mjs +9 -9
  26. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +19 -19
  27. package/system/dist/builtins/system-config/system-config.addon.mjs +113 -113
  28. package/system/dist/{composition-sources-BEUWn2s_.mjs → composition-sources-B0QW4g86.mjs} +2 -2
  29. package/system/dist/{composition-sources-acfR4hDq.js → composition-sources-BtUx1MfU.js} +2 -2
  30. package/system/dist/{coral-accelerators-zTMTEd-8.mjs → coral-accelerators-BKcXP59c.mjs} +6 -6
  31. package/system/dist/{core-blocks.cap-BRPsLAij.mjs → core-blocks.cap-CnwBuf7E.mjs} +1524 -1267
  32. package/system/dist/{core-blocks.cap-BMeMCBrx.js → core-blocks.cap-DlEuHq-S.js} +1555 -1268
  33. package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
  34. package/system/dist/{error.cap-CSM_SRfR.mjs → error.cap-5zNPAgU2.mjs} +19 -2
  35. package/system/dist/{error.cap-DBhgPeWK.js → error.cap-BCqzFlo2.js} +24 -1
  36. package/system/dist/{hub-identity-_IOgPJ00.mjs → hub-identity-DjMN9Ac2.mjs} +9 -9
  37. package/system/dist/{hub-mdns-ciao-Dk7ts_Uk.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +1 -1
  38. package/system/dist/index.js +2 -2
  39. package/system/dist/index.mjs +214 -214
  40. package/system/dist/{prefix-walk-ifwg_ukx.mjs → prefix-walk-CRnbYJcC.mjs} +2 -2
  41. package/system/dist/{prefix-walk-BkMxoXpL.js → prefix-walk-DD1BM923.js} +2 -2
  42. package/system/dist/{rename-composition-block-BJsL58Ih.js → rename-composition-block-BRgyBO25.js} +20 -2
  43. package/system/dist/{rename-composition-block-OAtErZgq.mjs → rename-composition-block-BYRBlx-V.mjs} +20 -2
  44. package/system/dist/{restore-archive-kSFNjkWY.mjs → restore-archive-CjAyKpgX.mjs} +93 -93
  45. package/system/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import * as fs from "node:fs";
2
+ import * as fs$1 from "node:fs";
3
3
  import { createReadStream, promises } from "node:fs";
4
4
  import * as path$1 from "node:path";
5
5
  import path from "node:path";
@@ -159,7 +159,7 @@ var HOSTED_MODEL_REVISIONS = {
159
159
  //#endregion
160
160
  //#region src/download/model-downloader.ts
161
161
  function isNonEmptyFile(filePath) {
162
- return fs.existsSync(filePath) && fs.statSync(filePath).size > 0;
162
+ return fs$1.existsSync(filePath) && fs$1.statSync(filePath).size > 0;
163
163
  }
164
164
  /**
165
165
  * Sibling files of a single-file (non-directory) format — extra files the
@@ -269,11 +269,11 @@ function resolveRedirectUrl(current, location) {
269
269
  return new URL(location, current);
270
270
  }
271
271
  async function downloadFile(url, destPath, onProgressOrOptions) {
272
- if (fs.existsSync(destPath)) return destPath;
272
+ if (fs$1.existsSync(destPath)) return destPath;
273
273
  const opts = normalizeDownloadOptions(onProgressOrOptions);
274
274
  const fetchImpl = opts.fetchImpl ?? fetch;
275
275
  const maxRedirects = opts.maxRedirects ?? DEFAULT_MAX_REDIRECTS;
276
- fs.mkdirSync(path$1.dirname(destPath), { recursive: true });
276
+ fs$1.mkdirSync(path$1.dirname(destPath), { recursive: true });
277
277
  const tmpPath = destPath + ".downloading";
278
278
  try {
279
279
  let current = url;
@@ -315,7 +315,7 @@ async function downloadFile(url, destPath, onProgressOrOptions) {
315
315
  if (!response.body) throw new Error(`No response body from ${url}`);
316
316
  const total = parseInt(response.headers.get("content-length") ?? "0", 10);
317
317
  let downloaded = 0;
318
- const fileStream = fs.createWriteStream(tmpPath);
318
+ const fileStream = fs$1.createWriteStream(tmpPath);
319
319
  const reader = response.body.getReader();
320
320
  try {
321
321
  for (;;) {
@@ -333,11 +333,11 @@ async function downloadFile(url, destPath, onProgressOrOptions) {
333
333
  fileStream.on("error", reject);
334
334
  });
335
335
  }
336
- fs.renameSync(tmpPath, destPath);
336
+ fs$1.renameSync(tmpPath, destPath);
337
337
  return destPath;
338
338
  } catch (err) {
339
339
  try {
340
- fs.unlinkSync(tmpPath);
340
+ fs$1.unlinkSync(tmpPath);
341
341
  } catch {}
342
342
  throw err;
343
343
  }
@@ -368,12 +368,12 @@ async function downloadModel(options) {
368
368
  const { url, fallbackUrls = [], destDir, filename, expectedSha256, onProgress } = options;
369
369
  const fname = filename ?? url.split("/").pop() ?? "model.bin";
370
370
  const destPath = path$1.join(destDir, fname);
371
- if (fs.existsSync(destPath)) return {
371
+ if (fs$1.existsSync(destPath)) return {
372
372
  filePath: destPath,
373
373
  downloadedBytes: 0,
374
374
  fromCache: true
375
375
  };
376
- fs.mkdirSync(destDir, { recursive: true });
376
+ fs$1.mkdirSync(destDir, { recursive: true });
377
377
  const urls = [url, ...fallbackUrls];
378
378
  let lastError = null;
379
379
  for (const tryUrl of urls) try {
@@ -381,25 +381,25 @@ async function downloadModel(options) {
381
381
  if (expectedSha256) {
382
382
  const hash = await computeSha256(destPath);
383
383
  if (hash !== expectedSha256) {
384
- fs.unlinkSync(destPath);
384
+ fs$1.unlinkSync(destPath);
385
385
  throw new Error(`SHA256 mismatch: expected ${expectedSha256}, got ${hash}`);
386
386
  }
387
387
  }
388
388
  return {
389
389
  filePath: destPath,
390
- downloadedBytes: fs.statSync(destPath).size,
390
+ downloadedBytes: fs$1.statSync(destPath).size,
391
391
  fromCache: false
392
392
  };
393
393
  } catch (e) {
394
394
  lastError = e;
395
- if (fs.existsSync(destPath)) fs.unlinkSync(destPath);
395
+ if (fs$1.existsSync(destPath)) fs$1.unlinkSync(destPath);
396
396
  }
397
397
  throw lastError ?? /* @__PURE__ */ new Error(`Failed to download model from ${url}`);
398
398
  }
399
399
  async function computeSha256(filePath) {
400
400
  return new Promise((resolve, reject) => {
401
401
  const hash = createHash("sha256");
402
- const stream = fs.createReadStream(filePath);
402
+ const stream = fs$1.createReadStream(filePath);
403
403
  stream.on("data", (chunk) => hash.update(chunk));
404
404
  stream.on("end", () => resolve(hash.digest("hex")));
405
405
  stream.on("error", reject);
@@ -424,28 +424,28 @@ async function downloadDirectory(url, destDir, knownFiles, onProgress) {
424
424
  fileUrl: `https://huggingface.co/${repo}/resolve/main/${dirPath}/${f}`
425
425
  }));
426
426
  const tmpDir = destDir + ".downloading";
427
- fs.rmSync(tmpDir, {
427
+ fs$1.rmSync(tmpDir, {
428
428
  recursive: true,
429
429
  force: true
430
430
  });
431
- fs.mkdirSync(tmpDir, { recursive: true });
431
+ fs$1.mkdirSync(tmpDir, { recursive: true });
432
432
  let totalDownloaded = 0;
433
433
  try {
434
434
  for (const file of files) {
435
435
  const destPath = path$1.join(tmpDir, file.relativePath);
436
- fs.mkdirSync(path$1.dirname(destPath), { recursive: true });
436
+ fs$1.mkdirSync(path$1.dirname(destPath), { recursive: true });
437
437
  await downloadFile(file.fileUrl, destPath, (downloaded, _total) => {
438
438
  onProgress?.(totalDownloaded + downloaded, void 0);
439
439
  });
440
- totalDownloaded += fs.statSync(destPath).size;
440
+ totalDownloaded += fs$1.statSync(destPath).size;
441
441
  }
442
- fs.rmSync(destDir, {
442
+ fs$1.rmSync(destDir, {
443
443
  recursive: true,
444
444
  force: true
445
445
  });
446
- fs.renameSync(tmpDir, destDir);
446
+ fs$1.renameSync(tmpDir, destDir);
447
447
  } catch (err) {
448
- fs.rmSync(tmpDir, {
448
+ fs$1.rmSync(tmpDir, {
449
449
  recursive: true,
450
450
  force: true
451
451
  });
@@ -477,7 +477,7 @@ function revisionRecordPath(modelPath) {
477
477
  }
478
478
  function readRevisionRecord(modelPath) {
479
479
  try {
480
- return fs.readFileSync(revisionRecordPath(modelPath), "utf8").trim();
480
+ return fs$1.readFileSync(revisionRecordPath(modelPath), "utf8").trim();
481
481
  } catch {
482
482
  return null;
483
483
  }
@@ -541,8 +541,8 @@ function writeRevisionRecord(modelPath, revision) {
541
541
  if (revision === void 0) return;
542
542
  const record = revisionRecordPath(modelPath);
543
543
  const tmp = `${record}.tmp`;
544
- fs.writeFileSync(tmp, `${revision}\n`);
545
- fs.renameSync(tmp, record);
544
+ fs$1.writeFileSync(tmp, `${revision}\n`);
545
+ fs$1.renameSync(tmp, record);
546
546
  }
547
547
  /**
548
548
  * Prove an unrecorded (or differently recorded) copy current by hashing its
@@ -562,9 +562,9 @@ async function adoptByHash(modelsDir, modelPath, formatEntry) {
562
562
  }
563
563
  /** True when every file of the format is on disk, whatever revision it holds. */
564
564
  function isCompleteCopy(modelsDir, modelPath, formatEntry) {
565
- if (!fs.existsSync(modelPath)) return false;
566
- if (formatEntry.isDirectory) return fs.existsSync(path$1.join(modelPath, "Manifest.json"));
567
- if (fs.statSync(modelPath).size <= 0) return false;
565
+ if (!fs$1.existsSync(modelPath)) return false;
566
+ if (formatEntry.isDirectory) return fs$1.existsSync(path$1.join(modelPath, "Manifest.json"));
567
+ if (fs$1.statSync(modelPath).size <= 0) return false;
568
568
  return siblingFilesFor(formatEntry).every((f) => isNonEmptyFile(path$1.join(modelsDir, f)));
569
569
  }
570
570
  /**
@@ -586,14 +586,14 @@ async function replaceSingleFileFormat(url, modelPath, modelsDir, siblings, onPr
586
586
  }));
587
587
  try {
588
588
  for (const [i, part] of parts.entries()) {
589
- fs.rmSync(part.staged, { force: true });
589
+ fs$1.rmSync(part.staged, { force: true });
590
590
  await downloadFile(part.url, part.staged, i === 0 ? (downloaded, total) => onProgress?.(downloaded, total === 0 ? void 0 : total) : void 0);
591
591
  }
592
592
  } catch (err) {
593
- for (const part of parts) fs.rmSync(part.staged, { force: true });
593
+ for (const part of parts) fs$1.rmSync(part.staged, { force: true });
594
594
  throw err;
595
595
  }
596
- for (const part of parts) fs.renameSync(part.staged, part.dest);
596
+ for (const part of parts) fs$1.renameSync(part.staged, part.dest);
597
597
  }
598
598
  /**
599
599
  * Resolve a `ModelCatalogEntry` against `modelsDir`: download model file
@@ -608,14 +608,14 @@ async function ensureModel(modelsDir, entry, format, onProgress) {
608
608
  const modelPath = path$1.join(modelsDir, filename);
609
609
  const siblings = siblingFilesFor(formatEntry);
610
610
  let outdated = false;
611
- if (fs.existsSync(modelPath)) if (formatEntry.isDirectory && !fs.existsSync(path$1.join(modelPath, "Manifest.json"))) fs.rmSync(modelPath, {
611
+ if (fs$1.existsSync(modelPath)) if (formatEntry.isDirectory && !fs$1.existsSync(path$1.join(modelPath, "Manifest.json"))) fs$1.rmSync(modelPath, {
612
612
  recursive: true,
613
613
  force: true
614
614
  });
615
615
  else if (siblings.some((f) => !isNonEmptyFile(path$1.join(modelsDir, f)))) outdated = !isCurrentRevision(modelPath, formatEntry) && !await adoptByHash(modelsDir, modelPath, formatEntry);
616
616
  else if (isCurrentRevision(modelPath, formatEntry) || await adoptByHash(modelsDir, modelPath, formatEntry)) return modelPath;
617
617
  else outdated = true;
618
- fs.mkdirSync(modelsDir, { recursive: true });
618
+ fs$1.mkdirSync(modelsDir, { recursive: true });
619
619
  if (formatEntry.isDirectory) await downloadDirectory(formatEntry.url, modelPath, formatEntry.files, onProgress);
620
620
  else if (outdated) await replaceSingleFileFormat(formatEntry.url, modelPath, modelsDir, siblings, onProgress);
621
621
  else {
@@ -673,25 +673,25 @@ function isModelDownloaded(modelsDir, entry, format) {
673
673
  const formatEntry = entry.formats[format];
674
674
  if (!formatEntry) return false;
675
675
  const modelPath = getModelFilePath(modelsDir, entry, format);
676
- if (!modelPath || !fs.existsSync(modelPath)) return false;
676
+ if (!modelPath || !fs$1.existsSync(modelPath)) return false;
677
677
  if (!isCurrentRevision(modelPath, formatEntry)) return false;
678
678
  return isCompleteCopy(modelsDir, modelPath, formatEntry);
679
679
  }
680
680
  /** Remove the on-disk model file/directory. Returns true if something was deleted. */
681
681
  function deleteModelFromDisk(modelsDir, entry, format) {
682
682
  const modelPath = getModelFilePath(modelsDir, entry, format);
683
- if (!modelPath || !fs.existsSync(modelPath)) return false;
684
- fs.rmSync(revisionRecordPath(modelPath), { force: true });
683
+ if (!modelPath || !fs$1.existsSync(modelPath)) return false;
684
+ fs$1.rmSync(revisionRecordPath(modelPath), { force: true });
685
685
  const formatEntry = entry.formats[format];
686
- if (formatEntry?.isDirectory) fs.rmSync(modelPath, {
686
+ if (formatEntry?.isDirectory) fs$1.rmSync(modelPath, {
687
687
  recursive: true,
688
688
  force: true
689
689
  });
690
690
  else {
691
- fs.unlinkSync(modelPath);
691
+ fs$1.unlinkSync(modelPath);
692
692
  if (formatEntry) for (const sibling of siblingFilesFor(formatEntry)) {
693
693
  const sibPath = path$1.join(modelsDir, sibling);
694
- if (fs.existsSync(sibPath)) fs.unlinkSync(sibPath);
694
+ if (fs$1.existsSync(sibPath)) fs$1.unlinkSync(sibPath);
695
695
  }
696
696
  }
697
697
  return true;
@@ -2192,7 +2192,24 @@ var CompositionPassthroughFeatureSchema = /* @__PURE__ */ z.object({
2192
2192
  enabled: /* @__PURE__ */ z.boolean().optional(),
2193
2193
  source: CompositionSourceRefSchema
2194
2194
  });
2195
- var CompositionFeatureSchema = /* @__PURE__ */ z.discriminatedUnion("kind", [CompositionFieldsFeatureSchema, CompositionPassthroughFeatureSchema]);
2195
+ /**
2196
+ * `capLink` (D1076): a whole capability, or a slot of it, served by ONE source
2197
+ * device. `linkId` names the link the cap declares in `customize.links`;
2198
+ * nothing is stored per field. A `project` link is expanded into claims at plan
2199
+ * time; a `reference` link writes nothing.
2200
+ */
2201
+ var CompositionCapLinkFeatureSchema = /* @__PURE__ */ z.object({
2202
+ kind: /* @__PURE__ */ z.literal("capLink"),
2203
+ cap: /* @__PURE__ */ z.string().min(1),
2204
+ linkId: /* @__PURE__ */ z.string().min(1),
2205
+ enabled: /* @__PURE__ */ z.boolean().optional(),
2206
+ source: CompositionSourceRefSchema
2207
+ });
2208
+ var CompositionFeatureSchema = /* @__PURE__ */ z.discriminatedUnion("kind", [
2209
+ CompositionFieldsFeatureSchema,
2210
+ CompositionPassthroughFeatureSchema,
2211
+ CompositionCapLinkFeatureSchema
2212
+ ]);
2196
2213
  /** Only an explicit `false` disables a feature; omitted preserves the existing wire default. */
2197
2214
  function compositionFeatureEnabled(feature) {
2198
2215
  return feature.enabled !== false;
@@ -3420,4 +3437,4 @@ listFaultTypes: /* @__PURE__ */ method(ListFaultTypesInputSchema, FaultTypesSche
3420
3437
  }
3421
3438
  };
3422
3439
  //#endregion
3423
- export { planResetTier as $, compositionItemFieldPath as A, helperMembers as B, CompositionFieldReadSchema as C, composedDeviceRef as D, canonicalStoredBlockTarget as E, featureSources as F, HISTORY_FAST_MS as G, isHistoryHelper as H, fieldReads as I, MINUTE_MS as J, HISTORY_SLOW_MS as K, isForwardInputRef as L, compositionSliceKey as M, compositionSourceKey as N, composedDeviceStableId as O, featureFieldEntries as P, openStatistic as Q, COMPOSED_DEVICE_STABLE_ID_PREFIX as R, COMPOSITION_ITEM_ARRAY_PATH as S, CompositionSchema as T, DAY_MS as U, isEngineHostedHelper as V, DEFAULT_HISTORY_RETENTION as W, nextLocalMidnight as X, historyRetentionFromSettings as Y, openReset as Z, groupTemplate as _, evaluateDwell as _t, sameHelperBody as a, cloneStatefulExpressionMemory as at, refused as b, isIdentifier as c, evaluateStatefulExpressionCall as ct, signedToken as d, compileExpressionSafe as dt, planStatisticTier as et, unsignedToken as f, EXPRESSION_IDENTIFIER_RE as ft, sharedColorModes as g, evaluateCount as gt, runFanOut as h, disarmRoseMemory as ht, compileHelper as i, integrateReading as it, compositionReadKey as j, compositionFeatureEnabled as k, linearExpr as l, toExpressionValue as lt, fanOutTargets as m, EXPRESSION_BUILTINS as mt, ERROR_STATUS_COLD as n, evaluateDerivative as nt, constantExpr as o, createStatefulExpressionMemory as ot, declaredSeriesKind as p, MAX_EXPRESSION_SOURCE_LENGTH as pt, HOUR_MS as q, errorCapability as r, evaluateStatistic as rt, dwellExpr as s, evaluateExpressionSource as st, DeviceFaultSchema as t, statisticCadenceMs as tt, overrideExpr as u, validateExpressionSource as ut, compositionFieldAt as v, CompositionFieldSourceSchema as w, COMPOSER_ADDON_ID as x, problem as y, HelperMemberSchema as z };
3440
+ export { openStatistic as $, compositionItemFieldPath as A, helperMembers as B, CompositionFieldReadSchema as C, composedDeviceRef as D, canonicalStoredBlockTarget as E, featureSources as F, DEFAULT_HISTORY_RETENTION as G, isHistoryHelper as H, fieldReads as I, HOUR_MS as J, HISTORY_FAST_MS as K, isForwardInputRef as L, compositionSliceKey as M, compositionSourceKey as N, composedDeviceStableId as O, featureFieldEntries as P, openReset as Q, COMPOSED_DEVICE_STABLE_ID_PREFIX as R, COMPOSITION_ITEM_ARRAY_PATH as S, CompositionSchema as T, CompositionSourceRefSchema as U, isEngineHostedHelper as V, DAY_MS as W, historyRetentionFromSettings as X, MINUTE_MS as Y, nextLocalMidnight as Z, groupTemplate as _, evaluateCount as _t, sameHelperBody as a, integrateReading as at, refused as b, isIdentifier as c, evaluateExpressionSource as ct, signedToken as d, validateExpressionSource as dt, planResetTier as et, unsignedToken as f, compileExpressionSafe as ft, sharedColorModes as g, disarmRoseMemory as gt, runFanOut as h, EXPRESSION_BUILTINS as ht, compileHelper as i, evaluateStatistic as it, compositionReadKey as j, compositionFeatureEnabled as k, linearExpr as l, evaluateStatefulExpressionCall as lt, fanOutTargets as m, MAX_EXPRESSION_SOURCE_LENGTH as mt, ERROR_STATUS_COLD as n, statisticCadenceMs as nt, constantExpr as o, cloneStatefulExpressionMemory as ot, declaredSeriesKind as p, EXPRESSION_IDENTIFIER_RE as pt, HISTORY_SLOW_MS as q, errorCapability as r, evaluateDerivative as rt, dwellExpr as s, createStatefulExpressionMemory as st, DeviceFaultSchema as t, planStatisticTier as tt, overrideExpr as u, toExpressionValue as ut, compositionFieldAt as v, evaluateDwell as vt, CompositionFieldSourceSchema as w, COMPOSER_ADDON_ID as x, problem as y, HelperMemberSchema as z };
@@ -2192,7 +2192,24 @@ var CompositionPassthroughFeatureSchema = /* @__PURE__ */ zod.z.object({
2192
2192
  enabled: /* @__PURE__ */ zod.z.boolean().optional(),
2193
2193
  source: CompositionSourceRefSchema
2194
2194
  });
2195
- var CompositionFeatureSchema = /* @__PURE__ */ zod.z.discriminatedUnion("kind", [CompositionFieldsFeatureSchema, CompositionPassthroughFeatureSchema]);
2195
+ /**
2196
+ * `capLink` (D1076): a whole capability, or a slot of it, served by ONE source
2197
+ * device. `linkId` names the link the cap declares in `customize.links`;
2198
+ * nothing is stored per field. A `project` link is expanded into claims at plan
2199
+ * time; a `reference` link writes nothing.
2200
+ */
2201
+ var CompositionCapLinkFeatureSchema = /* @__PURE__ */ zod.z.object({
2202
+ kind: /* @__PURE__ */ zod.z.literal("capLink"),
2203
+ cap: /* @__PURE__ */ zod.z.string().min(1),
2204
+ linkId: /* @__PURE__ */ zod.z.string().min(1),
2205
+ enabled: /* @__PURE__ */ zod.z.boolean().optional(),
2206
+ source: CompositionSourceRefSchema
2207
+ });
2208
+ var CompositionFeatureSchema = /* @__PURE__ */ zod.z.discriminatedUnion("kind", [
2209
+ CompositionFieldsFeatureSchema,
2210
+ CompositionPassthroughFeatureSchema,
2211
+ CompositionCapLinkFeatureSchema
2212
+ ]);
2196
2213
  /** Only an explicit `false` disables a feature; omitted preserves the existing wire default. */
2197
2214
  function compositionFeatureEnabled(feature) {
2198
2215
  return feature.enabled !== false;
@@ -3456,6 +3473,12 @@ Object.defineProperty(exports, "CompositionSchema", {
3456
3473
  return CompositionSchema;
3457
3474
  }
3458
3475
  });
3476
+ Object.defineProperty(exports, "CompositionSourceRefSchema", {
3477
+ enumerable: true,
3478
+ get: function() {
3479
+ return CompositionSourceRefSchema;
3480
+ }
3481
+ });
3459
3482
  Object.defineProperty(exports, "DAY_MS", {
3460
3483
  enumerable: true,
3461
3484
  get: function() {
@@ -4,7 +4,7 @@ import { z } from "zod";
4
4
  import { X509Certificate, createHash, createPrivateKey, randomBytes, webcrypto } from "node:crypto";
5
5
  import { writeOwnerOnlyFileSync } from "@camstack/types/node";
6
6
  import { isIP } from "node:net";
7
- import * as fs from "node:fs";
7
+ import * as fs$1 from "node:fs";
8
8
  import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
9
9
  import * as path$1 from "node:path";
10
10
  import { join } from "node:path";
@@ -1067,7 +1067,7 @@ var HUB_IDENTITY_RELATIVE = `tls/${HUB_IDENTITY_FILE}`;
1067
1067
  function readHubIdFile(file) {
1068
1068
  let parsed;
1069
1069
  try {
1070
- parsed = JSON.parse(fs.readFileSync(file, "utf8"));
1070
+ parsed = JSON.parse(fs$1.readFileSync(file, "utf8"));
1071
1071
  } catch (err) {
1072
1072
  return {
1073
1073
  hubId: null,
@@ -1094,18 +1094,18 @@ function identityPath(dataDir) {
1094
1094
  function writeHubIdFile(file, hubId) {
1095
1095
  const tmp = `${file}.${process.pid}.tmp`;
1096
1096
  try {
1097
- fs.mkdirSync(path$1.dirname(file), { recursive: true });
1098
- fs.writeFileSync(tmp, `${JSON.stringify({ hubId }, null, 2)}\n`);
1099
- fs.linkSync(tmp, file);
1097
+ fs$1.mkdirSync(path$1.dirname(file), { recursive: true });
1098
+ fs$1.writeFileSync(tmp, `${JSON.stringify({ hubId }, null, 2)}\n`);
1099
+ fs$1.linkSync(tmp, file);
1100
1100
  } catch (err) {
1101
- if (fs.existsSync(file)) return readHubIdFile(file);
1101
+ if (fs$1.existsSync(file)) return readHubIdFile(file);
1102
1102
  return {
1103
1103
  hubId: null,
1104
1104
  created: false,
1105
1105
  problem: `could not write ${file}: ${err instanceof Error ? err.message : String(err)}`
1106
1106
  };
1107
1107
  } finally {
1108
- fs.rmSync(tmp, { force: true });
1108
+ fs$1.rmSync(tmp, { force: true });
1109
1109
  }
1110
1110
  return {
1111
1111
  hubId,
@@ -1119,9 +1119,9 @@ function writeHubIdFile(file, hubId) {
1119
1119
  */
1120
1120
  function loadOrCreateHubId(dataDir) {
1121
1121
  const file = identityPath(dataDir);
1122
- if (fs.existsSync(file)) return readHubIdFile(file);
1122
+ if (fs$1.existsSync(file)) return readHubIdFile(file);
1123
1123
  const legacy = path$1.join(dataDir, HUB_IDENTITY_FILE);
1124
- if (fs.existsSync(legacy)) {
1124
+ if (fs$1.existsSync(legacy)) {
1125
1125
  const read = readHubIdFile(legacy);
1126
1126
  if (read.hubId === null) return read;
1127
1127
  if (writeHubIdFile(file, read.hubId).hubId === null) return read;
@@ -1,7 +1,7 @@
1
1
  import { o as __toESM } from "./chunk-CNf5ZN-e.mjs";
2
2
  import { t as userError } from "./camstack-error-viZYfcj9.mjs";
3
3
  import { f as X509Certificate$1 } from "./x509.es-BRiJgOvu.mjs";
4
- import { A as evaluateExistingCert, C as localCaCommonName, F as isConstrainedCa, L as permitsIdentity, S as loadCa, b as generateCa, j as reasonRequiresNewCa, w as collectCertIdentity, x as issueLeaf, z as readNameConstraints } from "./hub-identity-_IOgPJ00.mjs";
4
+ import { A as evaluateExistingCert, C as localCaCommonName, F as isConstrainedCa, L as permitsIdentity, S as loadCa, b as generateCa, j as reasonRequiresNewCa, w as collectCertIdentity, x as issueLeaf, z as readNameConstraints } from "./hub-identity-DjMN9Ac2.mjs";
5
5
  import { X509Certificate, createPrivateKey } from "node:crypto";
6
6
  import { writeOwnerOnlyFileSync } from "@camstack/types/node";
7
7
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -2,14 +2,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-Cek0wNdY.js");
3
3
  const require_base_addon = require("./base-addon-DD5dIfcZ.js");
4
4
  const require_scoped_settings = require("./scoped-settings-CylSSq_8.js");
5
- const require_rename_composition_block = require("./rename-composition-block-BJsL58Ih.js");
5
+ const require_rename_composition_block = require("./rename-composition-block-BRgyBO25.js");
6
6
  const require_camstack_error = require("./camstack-error-DJ-TUAi1.js");
7
7
  const require_capability_definition = require("./capability-definition-HCmTem8c.js");
8
8
  const require_record_kind = require("./record-kind-DoBfYHCs.js");
9
9
  const require_wal_maintenance = require("./wal-maintenance-DyrebYKF.js");
10
10
  const require_device_certificate = require("./device-certificate-CguVACQO.js");
11
11
  const require_addon_settings_cap = require("./addon-settings.cap-DAiE0Nb0.js");
12
- const require_prefix_walk = require("./prefix-walk-BkMxoXpL.js");
12
+ const require_prefix_walk = require("./prefix-walk-DD1BM923.js");
13
13
  const require_network_access_cap = require("./network-access.cap-B5TWLDCC.js");
14
14
  const require_constants = require("./constants-C860Y6U4.js");
15
15
  const require_addon_id = require("./addon-id-Di0lNJ89.js");