@camstack/server 1.2.848 → 1.2.850

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 (102) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/api/trpc/generated-cap-routers.js +9 -0
  3. package/package.json +15 -11
  4. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  5. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  6. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  7. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  8. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  9. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  10. package/system/dist/builtins/autotrack/index.js +1 -1
  11. package/system/dist/builtins/autotrack/index.mjs +1 -1
  12. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  13. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  14. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  15. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  16. package/system/dist/builtins/camera-grid/index.js +1 -1
  17. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  18. package/system/dist/builtins/composer/composer.addon.js +4 -4
  19. package/system/dist/builtins/composer/composer.addon.mjs +4 -4
  20. package/system/dist/builtins/console-logging/index.js +1 -1
  21. package/system/dist/builtins/console-logging/index.mjs +1 -1
  22. package/system/dist/builtins/core-blocks/actions-service.d.ts +13 -3
  23. package/system/dist/builtins/core-blocks/actions-store.d.ts +13 -7
  24. package/system/dist/builtins/core-blocks/actions-wiring.d.ts +10 -3
  25. package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +0 -1
  26. package/system/dist/builtins/core-blocks/core-blocks.addon.js +132 -71
  27. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +132 -71
  28. package/system/dist/builtins/core-blocks/scheduler/scheduler-service.d.ts +5 -1
  29. package/system/dist/builtins/core-blocks/scheduler/scheduler-wiring.d.ts +2 -1
  30. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  31. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  32. package/system/dist/builtins/device-manager/device-aggregation.d.ts +0 -25
  33. package/system/dist/builtins/device-manager/device-manager.addon.d.ts +0 -25
  34. package/system/dist/builtins/device-manager/device-manager.addon.js +191 -7
  35. package/system/dist/builtins/device-manager/device-manager.addon.mjs +191 -7
  36. package/system/dist/builtins/device-manager/export-name-fields.d.ts +39 -0
  37. package/system/dist/builtins/device-manager/transitions/transitions-wiring.d.ts +6 -1
  38. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  39. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  40. package/system/dist/builtins/keychain/index.js +4 -4
  41. package/system/dist/builtins/keychain/index.mjs +4 -4
  42. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  43. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  44. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  45. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  46. package/system/dist/builtins/local-network/local-network.addon.js +3 -3
  47. package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
  48. package/system/dist/builtins/loki-logging/index.js +1 -1
  49. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  50. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  51. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  52. package/system/dist/builtins/platform-probe/index.js +1 -1
  53. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  54. package/system/dist/builtins/record-entries/index.js +1 -1
  55. package/system/dist/builtins/record-entries/index.mjs +1 -1
  56. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  57. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  58. package/system/dist/builtins/snapshot/index.js +1 -1
  59. package/system/dist/builtins/snapshot/index.mjs +1 -1
  60. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  61. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  62. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  63. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  64. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  65. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  66. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  67. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  68. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  69. package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
  70. package/system/dist/builtins/winston-logging/index.js +1 -1
  71. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  72. package/system/dist/{capture-engine-CLow73VK.js → capture-engine-BM9nGdvv.js} +1 -1
  73. package/system/dist/{capture-engine-BDgAg1_L.mjs → capture-engine-Bshtl7Kd.mjs} +1 -1
  74. package/system/dist/{composition-sources-Xb2YACrP.js → composition-sources-63HlIklt.js} +1 -1
  75. package/system/dist/{composition-sources-PCla-eR3.mjs → composition-sources-CYpKKHtf.mjs} +1 -1
  76. package/system/dist/{constants-Cjv1STtI.mjs → constants-15k32igK.mjs} +1 -1
  77. package/system/dist/{constants-Crx9nPwX.js → constants-lHbp6u7t.js} +1 -1
  78. package/system/dist/{device-ca-D5bhkYRx.mjs → device-ca-BmKBCV_4.mjs} +1 -1
  79. package/system/dist/{device-ca-jaJY-9dh.js → device-ca-aB_rFHhZ.js} +1 -1
  80. package/system/dist/{dist-D9G24tL4.js → dist-DNDhIlAe.js} +2884 -2489
  81. package/system/dist/{dist-CUB8zpv-.mjs → dist-DY7OGObz.mjs} +2861 -2478
  82. package/system/dist/file-host-worker.js +1 -1
  83. package/system/dist/file-host-worker.mjs +1 -1
  84. package/system/dist/{hub-identity-0lAqqUXZ.mjs → hub-identity-BMz4OOYu.mjs} +1 -1
  85. package/system/dist/{hub-identity-D6Yzg92a.js → hub-identity-dcbGnvVX.js} +1 -1
  86. package/system/dist/{hub-mdns-ciao-dT75vFJK.mjs → hub-mdns-ciao-BOecE4tm.mjs} +2 -2
  87. package/system/dist/{hub-mdns-ciao-0vZomp05.js → hub-mdns-ciao-Y7YjcHQ4.js} +2 -2
  88. package/system/dist/index.js +36 -2505
  89. package/system/dist/index.mjs +36 -2505
  90. package/system/dist/kernel/bootstrap-config.d.ts +1 -2
  91. package/system/dist/kernel/capability-registry.d.ts +6 -2
  92. package/system/dist/{legacy-integration-rows-door-CkwpRASZ.mjs → legacy-integration-rows-door-87W9dzLF.mjs} +1 -1
  93. package/system/dist/{legacy-integration-rows-door-V0HNtga9.js → legacy-integration-rows-door-BQKarbeM.js} +1 -1
  94. package/system/dist/migrations/hub/2026-11-12-drop-retired-storage-leftovers.d.ts +16 -0
  95. package/system/dist/{rename-composition-block-CKO6KFN4.mjs → rename-composition-block-DOzzdV9v.mjs} +1 -1
  96. package/system/dist/{rename-composition-block-CmNS12Yh.js → rename-composition-block-p_8C4nY4.js} +1 -1
  97. package/system/dist/{restore-archive-DRyTaAb5.js → restore-archive-Bc-Xm8TB.js} +1 -1
  98. package/system/dist/{restore-archive-Cp8P5gxb.mjs → restore-archive-TpUr6_kg.mjs} +1 -1
  99. package/system/dist/{wal-maintenance-CyW12mpW.mjs → wal-maintenance-CE7-afh9.mjs} +0 -0
  100. package/system/dist/{wal-maintenance-EJcAHbIL.js → wal-maintenance-auHpWNP7.js} +0 -0
  101. package/system/package.json +1 -1
  102. package/system/dist/kernel/legacy-config-yaml.d.ts +0 -37
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-D9G24tL4.js");
3
+ const require_dist = require("../../dist-DNDhIlAe.js");
4
4
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
5
- const require_composition_sources = require("../../composition-sources-Xb2YACrP.js");
6
- const require_capture_engine = require("../../capture-engine-CLow73VK.js");
5
+ const require_composition_sources = require("../../composition-sources-63HlIklt.js");
6
+ const require_capture_engine = require("../../capture-engine-BM9nGdvv.js");
7
7
  const require_prefix_range = require("../../prefix-range-D_KueXbQ.js");
8
8
  const require_prefix_walk = require("../../prefix-walk-Dv6MLZlM.js");
9
9
  const require_cap_call_scope = require("../../cap-call-scope-8eiugfLl.js");
@@ -3100,6 +3100,7 @@ var ActionsService = class {
3100
3100
  /** Last run START per action — the throttle's memory. */
3101
3101
  lastStartedAt = /* @__PURE__ */ new Map();
3102
3102
  maxRunMs;
3103
+ boundCaps;
3103
3104
  stopGraceMs;
3104
3105
  constructor(deps) {
3105
3106
  this.store = deps.store;
@@ -3113,16 +3114,11 @@ var ActionsService = class {
3113
3114
  this.maxRunMs = deps.maxRunMs ?? 36e5;
3114
3115
  this.stopGraceMs = deps.stopGraceMs ?? STOP_GRACE_MS;
3115
3116
  this.units = deps.units ?? require_dist.capUnitResolver(require_dist.ALL_CAPABILITY_DEFINITIONS);
3117
+ this.boundCaps = deps.boundCaps;
3116
3118
  this.targets = new require_dist.ActionTargetResolver(deps.directory, deps.logger);
3117
3119
  this.templates = deps.templates;
3118
3120
  this.conditions = deps.conditions;
3119
3121
  }
3120
- /** One-shot at boot: stored steps written before D983 are rewritten to the target shape. */
3121
- async migrateTargets() {
3122
- const moved = await this.store.migrateLegacyTargets();
3123
- if (moved > 0) this.logger.info("internal actions rewritten to the target shape", { meta: { moved } });
3124
- return moved;
3125
- }
3126
3122
  /** A device was added, removed, moved or re-bound: forget the cached domains. */
3127
3123
  invalidateTargets() {
3128
3124
  this.targets.invalidate();
@@ -3521,6 +3517,7 @@ var ActionsService = class {
3521
3517
  }
3522
3518
  async create(input) {
3523
3519
  this.requireWithinCeiling(input.action.steps, input.action.name);
3520
+ await this.requireOffered(input.action.steps, input.action.name);
3524
3521
  const { steps, warnings } = this.normalizeSteps(input.action.steps, input.action.name);
3525
3522
  const action = await this.store.create({
3526
3523
  ...input.action,
@@ -3537,10 +3534,10 @@ var ActionsService = class {
3537
3534
  }
3538
3535
  async update(input) {
3539
3536
  await this.requireInternal(input.actionId);
3540
- const existing = await this.store.get(input.actionId);
3541
- if (existing === null) throw new require_dist.ActionError("not-found", `no action "${input.actionId}"`);
3542
3537
  const patch = input.action;
3538
+ const existing = await this.existingForUpdate(input.actionId, patch);
3543
3539
  if (patch.steps !== void 0) this.requireWithinCeiling(patch.steps, patch.name ?? existing.name);
3540
+ if (patch.steps !== void 0) await this.requireOffered(patch.steps, patch.name ?? existing.name);
3544
3541
  const { steps, warnings } = this.normalizeSteps(patch.steps ?? existing.steps ?? [], patch.name ?? existing.name);
3545
3542
  const action = await this.store.update(input.actionId, {
3546
3543
  name: patch.name ?? existing.name,
@@ -3554,6 +3551,47 @@ var ActionsService = class {
3554
3551
  ...warnings.length > 0 ? { warnings } : {}
3555
3552
  };
3556
3553
  }
3554
+ /**
3555
+ * The action an update patches. A stored row that no longer parses (steps
3556
+ * from an older shape) is not read: a save carrying a whole new body — name
3557
+ * and steps — overwrites it under the same id, which is how the operator
3558
+ * converts it from the editor. A partial patch of such a row is refused.
3559
+ */
3560
+ async existingForUpdate(actionId, patch) {
3561
+ const existing = await this.store.get(actionId);
3562
+ if (existing !== null) return existing;
3563
+ if (!await this.store.exists(actionId)) throw new require_dist.ActionError("not-found", `no action "${actionId}"`);
3564
+ if (patch.name === void 0 || patch.steps === void 0) throw new require_dist.ActionError("invalid-steps", `"${actionId}" is stored in a shape this version no longer reads — save it with a name and its steps`);
3565
+ this.logger.info("internal action rewritten over a stored body that no longer parses", { meta: { actionId } });
3566
+ return {
3567
+ id: actionId,
3568
+ name: patch.name,
3569
+ addonId: require_dist.CORE_BLOCKS_ADDON_ID,
3570
+ source: "internal",
3571
+ readOnly: false,
3572
+ steps: patch.steps,
3573
+ status: require_dist.IDLE_ACTION_STATUS
3574
+ };
3575
+ }
3576
+ /** A step naming a device whose own bindings lack its action's cap is refused at save (D12). */
3577
+ async requireOffered(steps, actionName) {
3578
+ try {
3579
+ await require_dist.assertStepsOffered(steps, this.boundCaps);
3580
+ } catch (err) {
3581
+ if (err instanceof require_dist.VocabActionError) {
3582
+ this.logger.warn("action save refused — a device does not offer the action", {
3583
+ ...err.deviceId === void 0 ? {} : { tags: { deviceId: err.deviceId } },
3584
+ meta: {
3585
+ action: actionName,
3586
+ actionId: err.actionId,
3587
+ reason: err.reason
3588
+ }
3589
+ });
3590
+ throw new require_dist.ActionError("invalid-steps", err.message);
3591
+ }
3592
+ throw err;
3593
+ }
3594
+ }
3557
3595
  /** An action whose waits alone exceed the run ceiling could never finish: refuse the save. */
3558
3596
  requireWithinCeiling(steps, actionName) {
3559
3597
  const total = require_dist.actionWaitTotalMs(steps);
@@ -3664,11 +3702,13 @@ function uuidOf(actionId) {
3664
3702
  var ActionsStore = class ActionsStore {
3665
3703
  actions;
3666
3704
  links;
3705
+ logger;
3667
3706
  now;
3668
3707
  newId;
3669
3708
  constructor(options) {
3670
3709
  this.actions = options.actions;
3671
3710
  this.links = options.links;
3711
+ this.logger = options.logger;
3672
3712
  this.now = options.now ?? Date.now;
3673
3713
  this.newId = options.newId ?? node_crypto.randomUUID;
3674
3714
  }
@@ -3679,52 +3719,50 @@ var ActionsStore = class ActionsStore {
3679
3719
  addonId: require_dist.CORE_BLOCKS_ADDON_ID,
3680
3720
  source: "internal",
3681
3721
  readOnly: false,
3682
- steps: require_dist.normalizeStepTargets(body.steps),
3722
+ steps: body.steps,
3683
3723
  ...body.variables === void 0 ? {} : { variables: body.variables },
3684
3724
  ...body.minDelaySec === void 0 || body.minDelaySec === 0 ? {} : { minDelaySec: body.minDelaySec },
3685
3725
  status: require_dist.IDLE_ACTION_STATUS
3686
3726
  };
3687
3727
  }
3688
- async list() {
3689
- const out = [];
3690
- let cursor;
3691
- do {
3692
- const page = await this.actions.query({ ...cursor === void 0 ? {} : { cursor } });
3693
- for (const row of page.records) out.push(ActionsStore.entryOf(row.id, row.data));
3694
- cursor = page.nextCursor ?? void 0;
3695
- } while (cursor !== void 0);
3696
- return out;
3697
- }
3698
3728
  /**
3699
- * One-shot, idempotent rewrite (D983): every row whose steps still carry the
3700
- * pre-target `deviceId` is stored again in the new shape. Returns how many
3701
- * rows moved. A row already in the new shape is left untouched.
3729
+ * A stored row is served only while it still parses. A row written under an
3730
+ * older step shape (a `cap` step, from before steps were stored by action id)
3731
+ * is skipped and logged, so it cannot break the list or reach a run; it stays
3732
+ * on disk until the operator saves the action again from the editor, which
3733
+ * overwrites it without reading its steps (`update`).
3702
3734
  */
3703
- async migrateLegacyTargets() {
3704
- let moved = 0;
3735
+ readable(id, data) {
3736
+ const parsed = ActionRowBodySchema.safeParse(data);
3737
+ if (parsed.success) return ActionsStore.entryOf(id, parsed.data);
3738
+ this.logger?.warn("internal action skipped — its stored body no longer parses; save it again", { meta: {
3739
+ actionId: require_dist.internalActionId(id),
3740
+ reason: parsed.error.issues.slice(0, 3).map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")
3741
+ } });
3742
+ return null;
3743
+ }
3744
+ async list() {
3745
+ const out = [];
3705
3746
  let cursor;
3706
3747
  do {
3707
3748
  const page = await this.actions.query({ ...cursor === void 0 ? {} : { cursor } });
3708
3749
  for (const row of page.records) {
3709
- if (!row.data.steps.some((s) => s.kind === "cap" && s.deviceId !== void 0)) continue;
3710
- const steps = require_dist.normalizeStepTargets(row.data.steps);
3711
- await this.actions.put({
3712
- id: row.id,
3713
- data: {
3714
- ...row.data,
3715
- steps
3716
- }
3717
- });
3718
- moved += 1;
3750
+ const entry = this.readable(row.id, row.data);
3751
+ if (entry !== null) out.push(entry);
3719
3752
  }
3720
3753
  cursor = page.nextCursor ?? void 0;
3721
3754
  } while (cursor !== void 0);
3722
- return moved;
3755
+ return out;
3723
3756
  }
3724
3757
  async get(actionId) {
3725
3758
  if (!require_dist.isInternalActionId(actionId)) return null;
3726
3759
  const row = await this.actions.get(uuidOf(actionId));
3727
- return row === null ? null : ActionsStore.entryOf(row.id, row.data);
3760
+ return row === null ? null : this.readable(row.id, row.data);
3761
+ }
3762
+ /** Whether a row is stored under this id, readable or not. */
3763
+ async exists(actionId) {
3764
+ if (!require_dist.isInternalActionId(actionId)) return false;
3765
+ return await this.actions.get(uuidOf(actionId)) !== null;
3728
3766
  }
3729
3767
  async create(input) {
3730
3768
  const id = this.newId();
@@ -3922,8 +3960,20 @@ function invokeCapOver(api) {
3922
3960
  };
3923
3961
  }
3924
3962
  /**
3925
- * The device registry as the target resolver reads it: the per-binding walk
3926
- * (`listDeviceIdsByCaps`, D12/D13) and the slim listing for type and room.
3963
+ * What each named device offers, from its OWN binding map (`getBindingsBatch`,
3964
+ * D12): one batched read of just the devices a step names, by cap name (D13).
3965
+ */
3966
+ function boundCapsOver(api) {
3967
+ return { boundCapsOf: async (deviceIds) => {
3968
+ const current = api();
3969
+ if (current === void 0) throw new Error("core-blocks: no ctx.api on this node — device bindings cannot be read");
3970
+ const rows = await current.deviceManager.getBindingsBatch.query({ deviceIds: [...deviceIds] });
3971
+ return new Map(rows.map((row) => [row.deviceId, row.entries.map((entry) => entry.capName)]));
3972
+ } };
3973
+ }
3974
+ /**
3975
+ * The device registry as the target resolver reads it: the devices bound to a
3976
+ * cap (`listDeviceIdsByCaps`, D13) and the slim listing for type and room.
3927
3977
  */
3928
3978
  function directoryOver(api) {
3929
3979
  const need = () => {
@@ -3954,11 +4004,13 @@ function buildActionsRuntime(deps) {
3954
4004
  const service = new ActionsService({
3955
4005
  store: new ActionsStore({
3956
4006
  actions: deps.records.kind(coreBlocksRecordKinds.actions),
3957
- links: deps.records.kind(coreBlocksRecordKinds["action-links"])
4007
+ links: deps.records.kind(coreBlocksRecordKinds["action-links"]),
4008
+ logger: deps.logger.child("actions-store")
3958
4009
  }),
3959
4010
  ledger,
3960
4011
  sources: sourcesOver(deps.api),
3961
4012
  directory: deps.directory ?? directoryOver(deps.api),
4013
+ boundCaps: deps.boundCaps ?? boundCapsOver(deps.api),
3962
4014
  invokeCap: invokeCapOver(deps.api),
3963
4015
  templates: templateDoorOver(deps.api),
3964
4016
  conditions: conditionDoorOver(deps.api),
@@ -4834,17 +4886,16 @@ var HoldManager = class {
4834
4886
  async syncTargets(scheduler, run, point) {
4835
4887
  const wanted = /* @__PURE__ */ new Map();
4836
4888
  for (const step of point.steps) {
4837
- if (step.kind !== "cap") continue;
4838
- const normalized = require_dist.normalizeCapStep(step);
4839
- if (normalized.actionId === void 0) continue;
4889
+ if (step.kind !== "command") continue;
4840
4890
  const resolved = require_dist.resolveStepArgs(step.args ?? {}, {}, () => void 0);
4841
4891
  const args = isPlainRecord$1(resolved) ? resolved : {};
4842
- const effect = require_dist.actionEffect(normalized.actionId, args);
4892
+ const effect = require_dist.actionEffect(step.actionId, args);
4843
4893
  if (effect === null) continue;
4894
+ const call = require_dist.vocabCall(step.actionId, args);
4844
4895
  let deviceIds;
4845
4896
  try {
4846
- deviceIds = (await this.deps.targets.resolve(normalized.target, normalized.actionId, {}, {
4847
- actionId: normalized.actionId,
4897
+ deviceIds = (await this.deps.targets.resolve(step.target, step.actionId, {}, {
4898
+ actionId: step.actionId,
4848
4899
  owner: `scheduler:${scheduler.id}`
4849
4900
  })).deviceIds;
4850
4901
  } catch (err) {
@@ -4861,9 +4912,9 @@ var HoldManager = class {
4861
4912
  wanted.set(key, known !== void 0 && known.value === effect.value ? known : {
4862
4913
  key,
4863
4914
  deviceId,
4864
- cap: step.cap,
4865
- method: step.method,
4866
- args,
4915
+ cap: call.cap,
4916
+ method: call.method,
4917
+ args: call.args,
4867
4918
  field: effect.field,
4868
4919
  value: effect.value,
4869
4920
  status: "pending",
@@ -5301,14 +5352,12 @@ var SchedulerEngine = class {
5301
5352
  async holdSources(s, point) {
5302
5353
  const out = [];
5303
5354
  for (const step of point.steps) {
5304
- if (step.kind !== "cap") continue;
5305
- const normalized = require_dist.normalizeCapStep(step);
5306
- if (normalized.actionId === void 0) continue;
5307
- const effect = require_dist.actionEffect(normalized.actionId, step.args);
5355
+ if (step.kind !== "command") continue;
5356
+ const effect = require_dist.actionEffect(step.actionId, step.args);
5308
5357
  if (effect === null) continue;
5309
5358
  try {
5310
- const resolved = await this.deps.targets.resolve(normalized.target, normalized.actionId, {}, {
5311
- actionId: normalized.actionId,
5359
+ const resolved = await this.deps.targets.resolve(step.target, step.actionId, {}, {
5360
+ actionId: step.actionId,
5312
5361
  owner: `scheduler:${s.id}`
5313
5362
  });
5314
5363
  for (const deviceId of resolved.deviceIds) out.push({
@@ -5648,8 +5697,29 @@ var SchedulersService = class {
5648
5697
  } });
5649
5698
  throw new require_dist.SchedulerError("invalid-scheduler", message);
5650
5699
  }
5700
+ await this.requireOffered(prepared);
5651
5701
  return prepared;
5652
5702
  }
5703
+ /** A step naming a device whose own bindings lack its action's cap is refused at save (D12). */
5704
+ async requireOffered(scheduler) {
5705
+ const steps = scheduler.profiles.flatMap((p) => p.points.flatMap((point) => point.steps));
5706
+ try {
5707
+ await require_dist.assertStepsOffered(steps, this.deps.boundCaps);
5708
+ } catch (err) {
5709
+ if (err instanceof require_dist.VocabActionError) {
5710
+ this.deps.logger.warn("scheduler save refused — a device does not offer the action", {
5711
+ ...err.deviceId === void 0 ? {} : { tags: { deviceId: err.deviceId } },
5712
+ meta: {
5713
+ scheduler: scheduler.name,
5714
+ actionId: err.actionId,
5715
+ reason: err.reason
5716
+ }
5717
+ });
5718
+ throw new require_dist.SchedulerError("invalid-scheduler", err.message);
5719
+ }
5720
+ throw err;
5721
+ }
5722
+ }
5653
5723
  async create(input) {
5654
5724
  const prepared = await this.prepare(input.scheduler);
5655
5725
  const scheduler = await this.deps.store.create(prepared);
@@ -5786,15 +5856,13 @@ var SchedulersService = class {
5786
5856
  if (point.mode !== "hold") continue;
5787
5857
  const effects = [];
5788
5858
  for (const step of point.steps) {
5789
- if (step.kind !== "cap") continue;
5790
- const normalized = require_dist.normalizeCapStep(step);
5791
- if (normalized.actionId === void 0) continue;
5859
+ if (step.kind !== "command") continue;
5792
5860
  const resolved = require_dist.resolveStepArgs(step.args ?? {}, {}, () => void 0);
5793
- const effect = require_dist.actionEffect(normalized.actionId, isPlainRecord(resolved) ? resolved : {});
5861
+ const effect = require_dist.actionEffect(step.actionId, isPlainRecord(resolved) ? resolved : {});
5794
5862
  if (effect === null) continue;
5795
5863
  try {
5796
- const { deviceIds } = await this.deps.targets.resolve(normalized.target, normalized.actionId, {}, {
5797
- actionId: normalized.actionId,
5864
+ const { deviceIds } = await this.deps.targets.resolve(step.target, step.actionId, {}, {
5865
+ actionId: step.actionId,
5798
5866
  owner: "scheduler-conflicts"
5799
5867
  });
5800
5868
  for (const deviceId of deviceIds) effects.push({
@@ -5980,6 +6048,7 @@ function buildSchedulersRuntime(deps) {
5980
6048
  ledger: deps.ledger,
5981
6049
  host,
5982
6050
  targets,
6051
+ boundCaps: deps.boundCaps ?? boundCapsOver(deps.api),
5983
6052
  units: require_dist.capUnitResolver(require_dist.ALL_CAPABILITY_DEFINITIONS),
5984
6053
  logger: deps.logger.child("schedulers")
5985
6054
  });
@@ -9106,7 +9175,6 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
9106
9175
  this.schedulers = schedulers;
9107
9176
  armSchedulerEngine(schedulers.engine, this.ctx.logger.child("scheduler"), { isDisposed: () => this.disposed });
9108
9177
  this.sweepRunsLedger();
9109
- this.migrateActionTargets();
9110
9178
  this.remoteRuntime = this.buildRemote(records);
9111
9179
  this.fanPresets = this.buildFanPresets();
9112
9180
  this.installDeviceCallRedirect();
@@ -9584,13 +9652,6 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
9584
9652
  this.ctx.logger.warn("runs ledger sweep failed — orphan rows stay until the next start", { meta: { error: err instanceof Error ? err.message : String(err) } });
9585
9653
  }
9586
9654
  }
9587
- async migrateActionTargets() {
9588
- try {
9589
- await this.actions?.service.migrateTargets();
9590
- } catch (err) {
9591
- this.ctx.logger.warn("internal actions could not be rewritten to the target shape — they are still read as it", { meta: { error: err instanceof Error ? err.message : String(err) } });
9592
- }
9593
- }
9594
9655
  requireStore() {
9595
9656
  if (this.store === null) throw new Error("core-blocks: not initialized");
9596
9657
  return this.store;