@camstack/server 1.2.807 → 1.2.808

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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.808] - 2026-11-08
11
+
12
+ ### Changed
13
+
14
+ - An infrared TV (media-player with a remote) now publishes its assumed power state as its own state, so the hero no longer shows State unknown and the power button is enabled
15
+
10
16
  ## [1.2.807] - 2026-11-08
11
17
 
12
18
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.807",
3
+ "version": "1.2.808",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -66,9 +66,7 @@
66
66
  ],
67
67
  "requires": {
68
68
  "addons": {
69
- "@camstack/addon-admin-ui": ">=1.2.615",
70
- "@camstack/addon-agent-ui": ">=1.2.343",
71
- "@camstack/addon-pipeline-orchestrator": ">=1.2.670"
69
+ "@camstack/addon-terminal": ">=0.1.162"
72
70
  },
73
71
  "wrapper": {
74
72
  "desktop": ">=0.0.1",
@@ -11527,7 +11527,11 @@ function createChildAddonCallDispatch(deps) {
11527
11527
  const method = call.method;
11528
11528
  if (method == null) throw new Error(`child-addon-call: addon "${addonId}" settings call missing method`);
11529
11529
  const addon = deps.getAddonInstance(addonId);
11530
- if (addon == null) throw new Error(`child-addon-call: addon "${addonId}" not loaded on this node`);
11530
+ if (addon == null) {
11531
+ const hosted = deps.listAddonIds?.() ?? [];
11532
+ const hostedText = hosted.length > 0 ? ` (this runner hosts: ${hosted.join(", ")})` : "";
11533
+ throw new Error(`child-addon-call: addon "${addonId}" is not loaded in this runner${hostedText} — address an addon by its own id, not its execution group`);
11534
+ }
11531
11535
  return dispatchSettings(addon, addonId, method, call.args ?? {});
11532
11536
  }
11533
11537
  case "data-planes": return deps.getDataPlanes(addonId);
@@ -12066,6 +12070,7 @@ async function main() {
12066
12070
  getRouteProvider: (addonId) => addonRouteProviders.get(addonId) ?? null,
12067
12071
  customActions: customActionRegistry,
12068
12072
  getAddonInstance: (addonId) => loadedAddonInstances.get(addonId) ?? null,
12073
+ listAddonIds: () => [...loadedAddonInstances.keys()],
12069
12074
  getDataPlanes: (addonId) => addonDataPlanes.get(addonId) ?? [],
12070
12075
  resolveSecretViews: (addonId, args) => (0, _camstack_types_addon.resolveSecretViewsIn)(args, addonSecrets.get(addonId))
12071
12076
  }));
@@ -11472,7 +11472,11 @@ function createChildAddonCallDispatch(deps) {
11472
11472
  const method = call.method;
11473
11473
  if (method == null) throw new Error(`child-addon-call: addon "${addonId}" settings call missing method`);
11474
11474
  const addon = deps.getAddonInstance(addonId);
11475
- if (addon == null) throw new Error(`child-addon-call: addon "${addonId}" not loaded on this node`);
11475
+ if (addon == null) {
11476
+ const hosted = deps.listAddonIds?.() ?? [];
11477
+ const hostedText = hosted.length > 0 ? ` (this runner hosts: ${hosted.join(", ")})` : "";
11478
+ throw new Error(`child-addon-call: addon "${addonId}" is not loaded in this runner${hostedText} — address an addon by its own id, not its execution group`);
11479
+ }
11476
11480
  return dispatchSettings(addon, addonId, method, call.args ?? {});
11477
11481
  }
11478
11482
  case "data-planes": return deps.getDataPlanes(addonId);
@@ -12011,6 +12015,7 @@ async function main() {
12011
12015
  getRouteProvider: (addonId) => addonRouteProviders.get(addonId) ?? null,
12012
12016
  customActions: customActionRegistry,
12013
12017
  getAddonInstance: (addonId) => loadedAddonInstances.get(addonId) ?? null,
12018
+ listAddonIds: () => [...loadedAddonInstances.keys()],
12014
12019
  getDataPlanes: (addonId) => addonDataPlanes.get(addonId) ?? [],
12015
12020
  resolveSecretViews: (addonId, args) => resolveSecretViewsIn(args, addonSecrets.get(addonId))
12016
12021
  }));
@@ -34,12 +34,22 @@ export declare class CoreBlocksAddon extends BaseAddon {
34
34
  private buildPowerSource;
35
35
  private powerSourceDevices;
36
36
  private buildRemote;
37
+ /** A driver's native media-player cap reads the device; the composer's own native holds no reading. */
38
+ private hasNativeMediaPlayer;
37
39
  /**
38
40
  * Precedence at DISPATCH (D963, D984): the redirect lives in the registry, so it
39
41
  * holds for every caller. ONE slot, so the authorities compose: the remote's
40
42
  * media-player redirect (when the remote runs) and the lock's door gate.
41
43
  */
42
44
  private installDeviceCallRedirect;
45
+ /**
46
+ * The remote writes each of its devices' `media-player` slice itself: seeded
47
+ * once at boot (never awaited), refreshed when a device registers, a config
48
+ * is saved, a send lands, or a device that feeds the assumed state changes (its
49
+ * running-state, or the switch of its linked plug). Our own slice write is a
50
+ * `media-player` event, not one of those inputs, so it cannot loop.
51
+ */
52
+ private armRemoteSlices;
43
53
  private seedGate;
44
54
  private deviceNames;
45
55
  /** The linked door sensor's name, read from the stored customization on a refusal only. */
@@ -5653,6 +5653,10 @@ var RemoteService = class {
5653
5653
  deps;
5654
5654
  now;
5655
5655
  sleep;
5656
+ /** Remote devices seen so far, and the plug each one waits on: who an input event affects. */
5657
+ plugOf = /* @__PURE__ */ new Map();
5658
+ sliceRuns = /* @__PURE__ */ new Map();
5659
+ slicePending = /* @__PURE__ */ new Set();
5656
5660
  constructor(deps) {
5657
5661
  this.deps = deps;
5658
5662
  this.now = deps.now ?? Date.now;
@@ -5671,6 +5675,7 @@ var RemoteService = class {
5671
5675
  detail: `no template "${config.layoutTemplateId}"`
5672
5676
  };
5673
5677
  await this.deps.store.write(deviceId, config);
5678
+ await this.refreshSlice(deviceId);
5674
5679
  return { status: "saved" };
5675
5680
  };
5676
5681
  listCommands = async ({ deviceId }) => {
@@ -5703,6 +5708,60 @@ var RemoteService = class {
5703
5708
  return this.run(deviceId, config, role, repeat);
5704
5709
  };
5705
5710
  /**
5711
+ * Writes the device's `media-player` slice from `assumedStatus`, but only
5712
+ * when the remote is what answers for it: a media player, no native source
5713
+ * (`hasNative`), and a power state the remote knows. Overlapping calls for a
5714
+ * device coalesce: one run in flight, one more pending. A failed write is
5715
+ * logged, never thrown — the next input change or send is the retry (D3).
5716
+ */
5717
+ refreshSlice(deviceId) {
5718
+ const running = this.sliceRuns.get(deviceId);
5719
+ if (running !== void 0) {
5720
+ this.slicePending.add(deviceId);
5721
+ return running;
5722
+ }
5723
+ const run = this.drainSlice(deviceId).finally(() => {
5724
+ this.sliceRuns.delete(deviceId);
5725
+ });
5726
+ this.sliceRuns.set(deviceId, run);
5727
+ return run;
5728
+ }
5729
+ async drainSlice(deviceId) {
5730
+ do {
5731
+ this.slicePending.delete(deviceId);
5732
+ await this.writeSlice(deviceId);
5733
+ } while (this.slicePending.has(deviceId));
5734
+ }
5735
+ async writeSlice(deviceId) {
5736
+ try {
5737
+ if (this.deps.hasNative(deviceId)) return;
5738
+ if (!await this.deps.isMediaPlayer(deviceId)) return;
5739
+ this.plugOf.set(deviceId, await this.deps.plugDeviceOf(deviceId));
5740
+ const status = await this.statusOf(deviceId, false);
5741
+ if (status === null) return;
5742
+ await this.deps.slice.publish(deviceId, status);
5743
+ } catch (err) {
5744
+ this.deps.logger.warn("remote: the media-player slice could not be written", {
5745
+ tags: { deviceId },
5746
+ meta: { error: errorText(err) }
5747
+ });
5748
+ }
5749
+ }
5750
+ /** Boot: every remote device. */
5751
+ async refreshSlices() {
5752
+ for (const deviceId of await this.deps.slice.devices()) await this.refreshSlice(deviceId);
5753
+ }
5754
+ /**
5755
+ * A device's state changed: refresh the remote devices it feeds — the TV
5756
+ * itself (its running-state) and every TV whose linked plug it is. Any other
5757
+ * device costs no read.
5758
+ */
5759
+ async onInputChanged(deviceId) {
5760
+ const affected = [];
5761
+ for (const [tv, plug] of this.plugOf) if (tv === deviceId || plug === deviceId) affected.push(tv);
5762
+ await Promise.all(affected.map((tv) => this.refreshSlice(tv)));
5763
+ }
5764
+ /**
5706
5765
  * What the remote ASSUMES (the last power and mute it sent), or null when it
5707
5766
  * knows neither. No plug, no running-state: that is `assumedStatus`.
5708
5767
  */
@@ -5713,7 +5772,7 @@ var RemoteService = class {
5713
5772
  const assumedFields = [];
5714
5773
  if (kept.power !== null) assumedFields.push("state");
5715
5774
  if (kept.muted !== null) assumedFields.push("isMuted");
5716
- return this.statusOf({
5775
+ return this.buildStatus({
5717
5776
  state: kept.power?.state ?? "standby",
5718
5777
  assumedFields,
5719
5778
  muted: kept.muted?.value ?? null,
@@ -5729,8 +5788,12 @@ var RemoteService = class {
5729
5788
  * the assumption, and only while the device may be on.
5730
5789
  */
5731
5790
  async assumedStatus(deviceId) {
5791
+ return this.statusOf(deviceId, true);
5792
+ }
5793
+ /** `forget`: whether a plug that is off drops the kept power guess (a read's side effect). */
5794
+ async statusOf(deviceId, forget) {
5732
5795
  const kept = await this.readAssumed(deviceId);
5733
- const truth = await this.powerTruth(deviceId);
5796
+ const truth = await this.powerTruth(deviceId, forget);
5734
5797
  if (truth === null) return null;
5735
5798
  const assumedFields = truth.assumed ? ["state"] : [];
5736
5799
  const state = truth.state;
@@ -5738,7 +5801,7 @@ var RemoteService = class {
5738
5801
  const mute = state === "off" ? null : kept.muted ?? null;
5739
5802
  if (mute !== null) assumedFields.push("isMuted");
5740
5803
  const config = await this.deps.store.read(deviceId);
5741
- return this.statusOf({
5804
+ return this.buildStatus({
5742
5805
  state,
5743
5806
  assumedFields,
5744
5807
  muted: mute?.value ?? null,
@@ -5746,7 +5809,7 @@ var RemoteService = class {
5746
5809
  sources: config.customButtons.map((b) => b.name)
5747
5810
  });
5748
5811
  }
5749
- statusOf(input) {
5812
+ buildStatus(input) {
5750
5813
  return {
5751
5814
  state: input.state,
5752
5815
  stateSource: input.assumedFields.length > 0 ? "assumed" : "reported",
@@ -5796,7 +5859,7 @@ var RemoteService = class {
5796
5859
  * standby; on contradicts an assumed `off`, which is dropped); then the
5797
5860
  * remote's own assumption; a plug on with nothing sent is `standby`.
5798
5861
  */
5799
- async powerTruth(deviceId) {
5862
+ async powerTruth(deviceId, forget = true) {
5800
5863
  const running = await this.deps.runningState(deviceId);
5801
5864
  if (running !== null) return {
5802
5865
  state: running ? "on" : "off",
@@ -5806,7 +5869,7 @@ var RemoteService = class {
5806
5869
  const plug = await this.deps.plugOn(deviceId);
5807
5870
  const kept = await this.readAssumed(deviceId);
5808
5871
  if (plug === false) {
5809
- if (kept.power !== null) await this.deps.assumptions.write(deviceId, {
5872
+ if (forget && kept.power !== null) await this.deps.assumptions.write(deviceId, {
5810
5873
  ...kept,
5811
5874
  power: null
5812
5875
  });
@@ -5864,6 +5927,7 @@ var RemoteService = class {
5864
5927
  at: this.now()
5865
5928
  }
5866
5929
  });
5930
+ await this.refreshSlice(deviceId);
5867
5931
  }
5868
5932
  return result;
5869
5933
  }
@@ -5916,6 +5980,7 @@ var RemoteService = class {
5916
5980
  }
5917
5981
  }
5918
5982
  await this.moveAssumption(deviceId, role, wantsState);
5983
+ await this.refreshSlice(deviceId);
5919
5984
  return {
5920
5985
  status: "sent",
5921
5986
  sends: times
@@ -6232,6 +6297,76 @@ function reportedStatusOver(api, logger) {
6232
6297
  }
6233
6298
  };
6234
6299
  }
6300
+ /** The cap whose runtime slice the remote writes for a device no native source reads. */
6301
+ var MEDIA_PLAYER_CAP = "media-player";
6302
+ /** A slice says the same when only its change stamp moved. */
6303
+ function sameStatus(a, b) {
6304
+ return JSON.stringify({
6305
+ ...a,
6306
+ lastChangedAt: 0
6307
+ }) === JSON.stringify({
6308
+ ...b,
6309
+ lastChangedAt: 0
6310
+ });
6311
+ }
6312
+ /**
6313
+ * The standard runtime-state path (`deviceState.setCapSlice`, the entry every
6314
+ * `setCapState` reaches). The current slice is read back from the hub, never
6315
+ * kept here, so a write that would change nothing is skipped without a cache.
6316
+ */
6317
+ function remoteSliceWriterOver(settings, api) {
6318
+ return {
6319
+ devices: async () => {
6320
+ const ids = await settings.listDeviceStoreIds();
6321
+ if (ids.length === 0) return [];
6322
+ const rows = await settings.readDeviceStoreBatch(ids);
6323
+ const carrying = [];
6324
+ for (const [deviceId, row] of rows) if (require_dist.RemoteConfigSchema.safeParse(row["remote"]).success) carrying.push(deviceId);
6325
+ return carrying;
6326
+ },
6327
+ publish: async (deviceId, status) => {
6328
+ const current = api();
6329
+ if (current === void 0) throw new Error("no ctx.api on this node");
6330
+ const kept = require_dist.MediaPlayerStatusSchema.safeParse(await current.deviceState.getCapSlice.query({
6331
+ deviceId,
6332
+ capName: MEDIA_PLAYER_CAP
6333
+ }));
6334
+ if (kept.success && sameStatus(kept.data, status)) return;
6335
+ await current.deviceState.setCapSlice.mutate({
6336
+ deviceId,
6337
+ capName: MEDIA_PLAYER_CAP,
6338
+ slice: { ...status }
6339
+ });
6340
+ }
6341
+ };
6342
+ }
6343
+ /** The device of the linked plug (`power-source`), null when none is linked or it errors. */
6344
+ function plugDeviceOver(api) {
6345
+ return async (deviceId) => {
6346
+ const current = api();
6347
+ if (current === void 0) return null;
6348
+ try {
6349
+ const parsed = require_dist.PowerSourceInfoSchema.safeParse(await current.powerSource.getStatus.query({ deviceId }));
6350
+ return parsed.success && parsed.data.linked ? parsed.data.switchDeviceId : null;
6351
+ } catch {
6352
+ return null;
6353
+ }
6354
+ };
6355
+ }
6356
+ /** The caps whose change can move the assumed state: the plug's switch and a running-state. */
6357
+ var REMOTE_SLICE_INPUT_CAPS = new Set(["switch", "running-state"]);
6358
+ /**
6359
+ * Seeds every remote device's slice ONCE at boot. No retry timer (D3): a read
6360
+ * that fails changes nothing, and `DeviceRegistered` and the input events
6361
+ * re-drive the refresh.
6362
+ */
6363
+ async function seedRemoteSlices(remote, logger) {
6364
+ try {
6365
+ await remote.refreshSlices();
6366
+ } catch (error) {
6367
+ logger.warn("remote: the media-player slices could not be seeded at boot", { meta: { error: error instanceof Error ? error.message : String(error) } });
6368
+ }
6369
+ }
6235
6370
  function buildRemoteRuntime(deps) {
6236
6371
  const templateRows = deps.records.kind(coreBlocksRecordKinds.templates);
6237
6372
  return {
@@ -6251,6 +6386,9 @@ function buildRemoteRuntime(deps) {
6251
6386
  runningState: runningStateOver(deps.api, deps.logger.child("remote")),
6252
6387
  plugOn: plugOnOver(deps.api, deps.logger.child("remote")),
6253
6388
  assumptions: remoteAssumptionStoreOver(deps.settings, deps.logger.child("remote")),
6389
+ slice: remoteSliceWriterOver(deps.settings, deps.api),
6390
+ hasNative: deps.hasNative,
6391
+ plugDeviceOf: plugDeviceOver(deps.api),
6254
6392
  logger: deps.logger.child("remote"),
6255
6393
  ...deps.sleep === void 0 ? {} : { sleep: deps.sleep },
6256
6394
  ...deps.now === void 0 ? {} : { now: deps.now }
@@ -7686,6 +7824,7 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
7686
7824
  this.remoteRuntime = this.buildRemote(records);
7687
7825
  this.fanPresets = this.buildFanPresets();
7688
7826
  this.installDeviceCallRedirect();
7827
+ this.armRemoteSlices();
7689
7828
  const timedRun = buildTimedRunService({
7690
7829
  records,
7691
7830
  settings: () => this.ctx.settings,
@@ -7794,9 +7933,15 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
7794
7933
  records,
7795
7934
  settings,
7796
7935
  api: () => this.ctx.api,
7797
- logger: this.ctx.logger
7936
+ logger: this.ctx.logger,
7937
+ hasNative: (deviceId) => this.hasNativeMediaPlayer(deviceId)
7798
7938
  });
7799
7939
  }
7940
+ /** A driver's native media-player cap reads the device; the composer's own native holds no reading. */
7941
+ hasNativeMediaPlayer(deviceId) {
7942
+ const owner = this.ctx.kernel?.capabilityRegistry?.getNativeAddonId("media-player", deviceId);
7943
+ return owner !== void 0 && owner !== null && owner !== "composer";
7944
+ }
7800
7945
  /**
7801
7946
  * Precedence at DISPATCH (D963, D984): the redirect lives in the registry, so it
7802
7947
  * holds for every caller. ONE slot, so the authorities compose: the remote's
@@ -7818,13 +7963,30 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
7818
7963
  const runtime = this.remoteRuntime;
7819
7964
  registry.setDeviceCallRedirect(composeRedirects([...runtime === null ? [] : [remoteCallRedirect({
7820
7965
  remote: runtime.remote,
7821
- hasNative: (deviceId) => {
7822
- const owner = registry.getNativeAddonId("media-player", deviceId);
7823
- return owner !== null && owner !== "composer";
7824
- },
7966
+ hasNative: (deviceId) => this.hasNativeMediaPlayer(deviceId),
7825
7967
  logger: this.ctx.logger.child("remote")
7826
7968
  })], gate.redirect()]));
7827
7969
  }
7970
+ /**
7971
+ * The remote writes each of its devices' `media-player` slice itself: seeded
7972
+ * once at boot (never awaited), refreshed when a device registers, a config
7973
+ * is saved, a send lands, or a device that feeds the assumed state changes (its
7974
+ * running-state, or the switch of its linked plug). Our own slice write is a
7975
+ * `media-player` event, not one of those inputs, so it cannot loop.
7976
+ */
7977
+ armRemoteSlices() {
7978
+ const remote = this.remoteRuntime?.remote;
7979
+ if (remote === void 0) return;
7980
+ seedRemoteSlices(remote, this.ctx.logger.child("remote"));
7981
+ this.subscribe({ category: require_dist.EventCategory.DeviceRegistered }, (event) => {
7982
+ const deviceId = require_composition_sources.isRecord(event.data) ? event.data["deviceId"] : void 0;
7983
+ if (typeof deviceId === "number") remote.refreshSlice(deviceId);
7984
+ });
7985
+ this.subscribe({ category: require_dist.EventCategory.DeviceStateChanged }, (event) => {
7986
+ const data = require_composition_sources.parseDeviceStateChanged(event.data);
7987
+ if (data !== null && REMOTE_SLICE_INPUT_CAPS.has(data.capName)) remote.onInputChanged(data.deviceId);
7988
+ });
7989
+ }
7828
7990
  seedGate(gate) {
7829
7991
  const api = this.ctx.api;
7830
7992
  if (!api) return;
@@ -1,6 +1,6 @@
1
1
  import { $ as EMPTY_AUTOMATION_STATE, $i as proposeRunningThreshold, $n as coreBlockSourceKind, $r as isInternalActionId, A as ControlStatusSchema, Ai as normalizeActionUnits, Bn as checkTemplatePayload, C as CORE_BLOCKS_ADDON_ID, Cc as secretTreeFromSchema, Co as composedDeviceRef, Er as evaluateWhenTree, Et as MediaPlayerStatusSchema, Fa as stableIdMapOf, Fs as collectSecretMarkerRefs, Ft as PowerSourceInfoSchema, Gi as planComposition, Gn as compileScalarOverride, Gt as RemoteConfigSchema, Hn as collectWhenMirrorSources, Hs as defineRecordKinds, Ic as EventCategory$1, In as capUnitResolver, J as DeclaredDevices, Ja as timedRunLimitOf, Ji as powerSourceLinkOfComposition, Jn as compositionSourceRefs, Ka as templateCapability, Ko as BaseAddon, Kt as RunningStateStatusSchema, Li as occurrenceOn, Mi as normalizeCoreBlockWrite, Nc as DeviceType$1, Ni as normalizeStepTargets, No as helperMembers, Nr as fanPresetsCapability, O as ConditionMirror, Oc as transformSecretWrite, On as buildActionSteps, Oo as compositionSourceKey, Pc as errMsg$1, Po as historyRetentionFromSettings, Qn as coreBlockIdFromAddonId, R as DEFAULT_HOLD_OVERRIDE, S as COMPOSER_RUNNER_ID, Sa as schedulersCapability, Vt as REMOTE_MEDIA_COMMANDS, Wr as internalActionId, Wt as RemoteAssumedStateSchema, Xa as timedRunQuickRun, Xi as problemsBlockSave, Xn as coreBlockAddonId, Xs as hydrateSchema, Xt as SchedulerError, Ya as timedRunMaxIn, Za as timedRunSeconds, Zn as coreBlockComposition, Zt as SchedulerSchema, aa as remoteLayoutComponentsCapability, ac as isSecretMarker, an as SwitchStatusSchema, ba as runSteps, bc as resolveSecretMarkers, c as ActionError, co as weekdayOfLocalDate, d as ActionVariableSchema, da as resolveCoreBlockFiles, dn as actionSourceCapability, do as zoneOnlySite, eo as validateComposition, er as coreBlocksCapability, et as EMPTY_REMOTE_ASSUMED_STATE, fn as actionWaitTotalMs, fr as describeComposableCaps, gt as INTERNAL_ACTION_PREFIX, ht as IDLE_ACTION_STATUS, ia as remoteCapability, ii as kebabToCamel, ir as customRole, it as FanControlStatusSchema, j as CoreBlockSchema, ja as siteFor, ji as normalizeCapStep, ki as nextOccurrence, kn as buildCapabilityLookup, l as ActionStepSchema, m as BUILTIN_REMOTE_COMPONENTS, mi as lockDoorLinkOfComposition, mn as addonIdOfActionId, mo as DAY_MS, n as ACTION_TARGET_INVALIDATION_EVENTS, no as validateSchedulerInput, nt as FAN_CAPTURE_FIELDS, oa as replacedFieldKeys, on as TemplateKindSchema, ot as FanPresetSchema, p as AutomationStateDocSchema, pn as actionsCapability, po as CompositionSchema, qa as timedRunCapability, qi as powerSourceCapability, rr as customKeyOfRole, s as ALL_CAPABILITY_DEFINITIONS, sa as resolveActionVariables, sc as isSecretRefOwnedBy, so as vocabActionIdFor, tt as EMPTY_REMOTE_CONFIG, u as ActionTargetResolver, ua as resolveCoreBlockEntry, ui as localDateOf, un as actionEffect, va as resolveStepArgs, w as CORE_BLOCK_ADDON_PREFIX, xn as appendTrace, yo as HelperMemberSchema, zs as defineAddonMigrations, zt as QuantityUnitError } from "../../dist-CogtCQxu.mjs";
2
2
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
3
- import { i as parseDeviceStateChanged, t as describeCompositionSources } from "../../composition-sources-BhM6G9QT.mjs";
3
+ import { i as parseDeviceStateChanged, r as isRecord$1, t as describeCompositionSources } from "../../composition-sources-BhM6G9QT.mjs";
4
4
  import { i as capSeriesKey } from "../../capture-engine-CnVIcnyN.mjs";
5
5
  import { t as prefixRange } from "../../prefix-range-Dl0znowN.mjs";
6
6
  import { n as unwrapStoredValue, t as loadPrefixed } from "../../prefix-walk-DAOBSyH1.mjs";
@@ -5647,6 +5647,10 @@ var RemoteService = class {
5647
5647
  deps;
5648
5648
  now;
5649
5649
  sleep;
5650
+ /** Remote devices seen so far, and the plug each one waits on: who an input event affects. */
5651
+ plugOf = /* @__PURE__ */ new Map();
5652
+ sliceRuns = /* @__PURE__ */ new Map();
5653
+ slicePending = /* @__PURE__ */ new Set();
5650
5654
  constructor(deps) {
5651
5655
  this.deps = deps;
5652
5656
  this.now = deps.now ?? Date.now;
@@ -5665,6 +5669,7 @@ var RemoteService = class {
5665
5669
  detail: `no template "${config.layoutTemplateId}"`
5666
5670
  };
5667
5671
  await this.deps.store.write(deviceId, config);
5672
+ await this.refreshSlice(deviceId);
5668
5673
  return { status: "saved" };
5669
5674
  };
5670
5675
  listCommands = async ({ deviceId }) => {
@@ -5697,6 +5702,60 @@ var RemoteService = class {
5697
5702
  return this.run(deviceId, config, role, repeat);
5698
5703
  };
5699
5704
  /**
5705
+ * Writes the device's `media-player` slice from `assumedStatus`, but only
5706
+ * when the remote is what answers for it: a media player, no native source
5707
+ * (`hasNative`), and a power state the remote knows. Overlapping calls for a
5708
+ * device coalesce: one run in flight, one more pending. A failed write is
5709
+ * logged, never thrown — the next input change or send is the retry (D3).
5710
+ */
5711
+ refreshSlice(deviceId) {
5712
+ const running = this.sliceRuns.get(deviceId);
5713
+ if (running !== void 0) {
5714
+ this.slicePending.add(deviceId);
5715
+ return running;
5716
+ }
5717
+ const run = this.drainSlice(deviceId).finally(() => {
5718
+ this.sliceRuns.delete(deviceId);
5719
+ });
5720
+ this.sliceRuns.set(deviceId, run);
5721
+ return run;
5722
+ }
5723
+ async drainSlice(deviceId) {
5724
+ do {
5725
+ this.slicePending.delete(deviceId);
5726
+ await this.writeSlice(deviceId);
5727
+ } while (this.slicePending.has(deviceId));
5728
+ }
5729
+ async writeSlice(deviceId) {
5730
+ try {
5731
+ if (this.deps.hasNative(deviceId)) return;
5732
+ if (!await this.deps.isMediaPlayer(deviceId)) return;
5733
+ this.plugOf.set(deviceId, await this.deps.plugDeviceOf(deviceId));
5734
+ const status = await this.statusOf(deviceId, false);
5735
+ if (status === null) return;
5736
+ await this.deps.slice.publish(deviceId, status);
5737
+ } catch (err) {
5738
+ this.deps.logger.warn("remote: the media-player slice could not be written", {
5739
+ tags: { deviceId },
5740
+ meta: { error: errorText(err) }
5741
+ });
5742
+ }
5743
+ }
5744
+ /** Boot: every remote device. */
5745
+ async refreshSlices() {
5746
+ for (const deviceId of await this.deps.slice.devices()) await this.refreshSlice(deviceId);
5747
+ }
5748
+ /**
5749
+ * A device's state changed: refresh the remote devices it feeds — the TV
5750
+ * itself (its running-state) and every TV whose linked plug it is. Any other
5751
+ * device costs no read.
5752
+ */
5753
+ async onInputChanged(deviceId) {
5754
+ const affected = [];
5755
+ for (const [tv, plug] of this.plugOf) if (tv === deviceId || plug === deviceId) affected.push(tv);
5756
+ await Promise.all(affected.map((tv) => this.refreshSlice(tv)));
5757
+ }
5758
+ /**
5700
5759
  * What the remote ASSUMES (the last power and mute it sent), or null when it
5701
5760
  * knows neither. No plug, no running-state: that is `assumedStatus`.
5702
5761
  */
@@ -5707,7 +5766,7 @@ var RemoteService = class {
5707
5766
  const assumedFields = [];
5708
5767
  if (kept.power !== null) assumedFields.push("state");
5709
5768
  if (kept.muted !== null) assumedFields.push("isMuted");
5710
- return this.statusOf({
5769
+ return this.buildStatus({
5711
5770
  state: kept.power?.state ?? "standby",
5712
5771
  assumedFields,
5713
5772
  muted: kept.muted?.value ?? null,
@@ -5723,8 +5782,12 @@ var RemoteService = class {
5723
5782
  * the assumption, and only while the device may be on.
5724
5783
  */
5725
5784
  async assumedStatus(deviceId) {
5785
+ return this.statusOf(deviceId, true);
5786
+ }
5787
+ /** `forget`: whether a plug that is off drops the kept power guess (a read's side effect). */
5788
+ async statusOf(deviceId, forget) {
5726
5789
  const kept = await this.readAssumed(deviceId);
5727
- const truth = await this.powerTruth(deviceId);
5790
+ const truth = await this.powerTruth(deviceId, forget);
5728
5791
  if (truth === null) return null;
5729
5792
  const assumedFields = truth.assumed ? ["state"] : [];
5730
5793
  const state = truth.state;
@@ -5732,7 +5795,7 @@ var RemoteService = class {
5732
5795
  const mute = state === "off" ? null : kept.muted ?? null;
5733
5796
  if (mute !== null) assumedFields.push("isMuted");
5734
5797
  const config = await this.deps.store.read(deviceId);
5735
- return this.statusOf({
5798
+ return this.buildStatus({
5736
5799
  state,
5737
5800
  assumedFields,
5738
5801
  muted: mute?.value ?? null,
@@ -5740,7 +5803,7 @@ var RemoteService = class {
5740
5803
  sources: config.customButtons.map((b) => b.name)
5741
5804
  });
5742
5805
  }
5743
- statusOf(input) {
5806
+ buildStatus(input) {
5744
5807
  return {
5745
5808
  state: input.state,
5746
5809
  stateSource: input.assumedFields.length > 0 ? "assumed" : "reported",
@@ -5790,7 +5853,7 @@ var RemoteService = class {
5790
5853
  * standby; on contradicts an assumed `off`, which is dropped); then the
5791
5854
  * remote's own assumption; a plug on with nothing sent is `standby`.
5792
5855
  */
5793
- async powerTruth(deviceId) {
5856
+ async powerTruth(deviceId, forget = true) {
5794
5857
  const running = await this.deps.runningState(deviceId);
5795
5858
  if (running !== null) return {
5796
5859
  state: running ? "on" : "off",
@@ -5800,7 +5863,7 @@ var RemoteService = class {
5800
5863
  const plug = await this.deps.plugOn(deviceId);
5801
5864
  const kept = await this.readAssumed(deviceId);
5802
5865
  if (plug === false) {
5803
- if (kept.power !== null) await this.deps.assumptions.write(deviceId, {
5866
+ if (forget && kept.power !== null) await this.deps.assumptions.write(deviceId, {
5804
5867
  ...kept,
5805
5868
  power: null
5806
5869
  });
@@ -5858,6 +5921,7 @@ var RemoteService = class {
5858
5921
  at: this.now()
5859
5922
  }
5860
5923
  });
5924
+ await this.refreshSlice(deviceId);
5861
5925
  }
5862
5926
  return result;
5863
5927
  }
@@ -5910,6 +5974,7 @@ var RemoteService = class {
5910
5974
  }
5911
5975
  }
5912
5976
  await this.moveAssumption(deviceId, role, wantsState);
5977
+ await this.refreshSlice(deviceId);
5913
5978
  return {
5914
5979
  status: "sent",
5915
5980
  sends: times
@@ -6226,6 +6291,76 @@ function reportedStatusOver(api, logger) {
6226
6291
  }
6227
6292
  };
6228
6293
  }
6294
+ /** The cap whose runtime slice the remote writes for a device no native source reads. */
6295
+ var MEDIA_PLAYER_CAP = "media-player";
6296
+ /** A slice says the same when only its change stamp moved. */
6297
+ function sameStatus(a, b) {
6298
+ return JSON.stringify({
6299
+ ...a,
6300
+ lastChangedAt: 0
6301
+ }) === JSON.stringify({
6302
+ ...b,
6303
+ lastChangedAt: 0
6304
+ });
6305
+ }
6306
+ /**
6307
+ * The standard runtime-state path (`deviceState.setCapSlice`, the entry every
6308
+ * `setCapState` reaches). The current slice is read back from the hub, never
6309
+ * kept here, so a write that would change nothing is skipped without a cache.
6310
+ */
6311
+ function remoteSliceWriterOver(settings, api) {
6312
+ return {
6313
+ devices: async () => {
6314
+ const ids = await settings.listDeviceStoreIds();
6315
+ if (ids.length === 0) return [];
6316
+ const rows = await settings.readDeviceStoreBatch(ids);
6317
+ const carrying = [];
6318
+ for (const [deviceId, row] of rows) if (RemoteConfigSchema.safeParse(row["remote"]).success) carrying.push(deviceId);
6319
+ return carrying;
6320
+ },
6321
+ publish: async (deviceId, status) => {
6322
+ const current = api();
6323
+ if (current === void 0) throw new Error("no ctx.api on this node");
6324
+ const kept = MediaPlayerStatusSchema.safeParse(await current.deviceState.getCapSlice.query({
6325
+ deviceId,
6326
+ capName: MEDIA_PLAYER_CAP
6327
+ }));
6328
+ if (kept.success && sameStatus(kept.data, status)) return;
6329
+ await current.deviceState.setCapSlice.mutate({
6330
+ deviceId,
6331
+ capName: MEDIA_PLAYER_CAP,
6332
+ slice: { ...status }
6333
+ });
6334
+ }
6335
+ };
6336
+ }
6337
+ /** The device of the linked plug (`power-source`), null when none is linked or it errors. */
6338
+ function plugDeviceOver(api) {
6339
+ return async (deviceId) => {
6340
+ const current = api();
6341
+ if (current === void 0) return null;
6342
+ try {
6343
+ const parsed = PowerSourceInfoSchema.safeParse(await current.powerSource.getStatus.query({ deviceId }));
6344
+ return parsed.success && parsed.data.linked ? parsed.data.switchDeviceId : null;
6345
+ } catch {
6346
+ return null;
6347
+ }
6348
+ };
6349
+ }
6350
+ /** The caps whose change can move the assumed state: the plug's switch and a running-state. */
6351
+ var REMOTE_SLICE_INPUT_CAPS = new Set(["switch", "running-state"]);
6352
+ /**
6353
+ * Seeds every remote device's slice ONCE at boot. No retry timer (D3): a read
6354
+ * that fails changes nothing, and `DeviceRegistered` and the input events
6355
+ * re-drive the refresh.
6356
+ */
6357
+ async function seedRemoteSlices(remote, logger) {
6358
+ try {
6359
+ await remote.refreshSlices();
6360
+ } catch (error) {
6361
+ logger.warn("remote: the media-player slices could not be seeded at boot", { meta: { error: error instanceof Error ? error.message : String(error) } });
6362
+ }
6363
+ }
6229
6364
  function buildRemoteRuntime(deps) {
6230
6365
  const templateRows = deps.records.kind(coreBlocksRecordKinds.templates);
6231
6366
  return {
@@ -6245,6 +6380,9 @@ function buildRemoteRuntime(deps) {
6245
6380
  runningState: runningStateOver(deps.api, deps.logger.child("remote")),
6246
6381
  plugOn: plugOnOver(deps.api, deps.logger.child("remote")),
6247
6382
  assumptions: remoteAssumptionStoreOver(deps.settings, deps.logger.child("remote")),
6383
+ slice: remoteSliceWriterOver(deps.settings, deps.api),
6384
+ hasNative: deps.hasNative,
6385
+ plugDeviceOf: plugDeviceOver(deps.api),
6248
6386
  logger: deps.logger.child("remote"),
6249
6387
  ...deps.sleep === void 0 ? {} : { sleep: deps.sleep },
6250
6388
  ...deps.now === void 0 ? {} : { now: deps.now }
@@ -7680,6 +7818,7 @@ var CoreBlocksAddon = class extends BaseAddon {
7680
7818
  this.remoteRuntime = this.buildRemote(records);
7681
7819
  this.fanPresets = this.buildFanPresets();
7682
7820
  this.installDeviceCallRedirect();
7821
+ this.armRemoteSlices();
7683
7822
  const timedRun = buildTimedRunService({
7684
7823
  records,
7685
7824
  settings: () => this.ctx.settings,
@@ -7788,9 +7927,15 @@ var CoreBlocksAddon = class extends BaseAddon {
7788
7927
  records,
7789
7928
  settings,
7790
7929
  api: () => this.ctx.api,
7791
- logger: this.ctx.logger
7930
+ logger: this.ctx.logger,
7931
+ hasNative: (deviceId) => this.hasNativeMediaPlayer(deviceId)
7792
7932
  });
7793
7933
  }
7934
+ /** A driver's native media-player cap reads the device; the composer's own native holds no reading. */
7935
+ hasNativeMediaPlayer(deviceId) {
7936
+ const owner = this.ctx.kernel?.capabilityRegistry?.getNativeAddonId("media-player", deviceId);
7937
+ return owner !== void 0 && owner !== null && owner !== "composer";
7938
+ }
7794
7939
  /**
7795
7940
  * Precedence at DISPATCH (D963, D984): the redirect lives in the registry, so it
7796
7941
  * holds for every caller. ONE slot, so the authorities compose: the remote's
@@ -7812,13 +7957,30 @@ var CoreBlocksAddon = class extends BaseAddon {
7812
7957
  const runtime = this.remoteRuntime;
7813
7958
  registry.setDeviceCallRedirect(composeRedirects([...runtime === null ? [] : [remoteCallRedirect({
7814
7959
  remote: runtime.remote,
7815
- hasNative: (deviceId) => {
7816
- const owner = registry.getNativeAddonId("media-player", deviceId);
7817
- return owner !== null && owner !== "composer";
7818
- },
7960
+ hasNative: (deviceId) => this.hasNativeMediaPlayer(deviceId),
7819
7961
  logger: this.ctx.logger.child("remote")
7820
7962
  })], gate.redirect()]));
7821
7963
  }
7964
+ /**
7965
+ * The remote writes each of its devices' `media-player` slice itself: seeded
7966
+ * once at boot (never awaited), refreshed when a device registers, a config
7967
+ * is saved, a send lands, or a device that feeds the assumed state changes (its
7968
+ * running-state, or the switch of its linked plug). Our own slice write is a
7969
+ * `media-player` event, not one of those inputs, so it cannot loop.
7970
+ */
7971
+ armRemoteSlices() {
7972
+ const remote = this.remoteRuntime?.remote;
7973
+ if (remote === void 0) return;
7974
+ seedRemoteSlices(remote, this.ctx.logger.child("remote"));
7975
+ this.subscribe({ category: EventCategory$1.DeviceRegistered }, (event) => {
7976
+ const deviceId = isRecord$1(event.data) ? event.data["deviceId"] : void 0;
7977
+ if (typeof deviceId === "number") remote.refreshSlice(deviceId);
7978
+ });
7979
+ this.subscribe({ category: EventCategory$1.DeviceStateChanged }, (event) => {
7980
+ const data = parseDeviceStateChanged(event.data);
7981
+ if (data !== null && REMOTE_SLICE_INPUT_CAPS.has(data.capName)) remote.onInputChanged(data.deviceId);
7982
+ });
7983
+ }
7822
7984
  seedGate(gate) {
7823
7985
  const api = this.ctx.api;
7824
7986
  if (!api) return;
@@ -36,9 +36,28 @@ export interface RemoteAssumptionStore {
36
36
  read(deviceId: number): Promise<RemoteAssumedState | null>;
37
37
  write(deviceId: number, state: RemoteAssumedState): Promise<void>;
38
38
  }
39
+ /**
40
+ * The device's `media-player` runtime slice, written through the standard
41
+ * runtime-state path. The slice is a PROJECTION of `assumedStatus` — the one
42
+ * computation `getStatus` is also answered from — so there is no second cache.
43
+ */
44
+ export interface RemoteSliceWriter {
45
+ /** The devices that carry a remote configuration. */
46
+ devices(): Promise<readonly number[]>;
47
+ /** Writes the slice; a no-op when it already says the same. */
48
+ publish(deviceId: number, status: MediaPlayerStatus): Promise<void>;
49
+ }
39
50
  export interface RemoteServiceDeps {
40
51
  readonly store: RemoteConfigStore;
41
52
  readonly assumptions: RemoteAssumptionStore;
53
+ readonly slice: RemoteSliceWriter;
54
+ /**
55
+ * Whether a driver's native media-player cap reads the device — the SAME
56
+ * predicate the dispatch redirect uses. Such a device never gets an assumed slice.
57
+ */
58
+ hasNative(deviceId: number): boolean;
59
+ /** The device of the linked plug, or null when none is linked. */
60
+ plugDeviceOf(deviceId: number): Promise<number | null>;
42
61
  /** Runs the action a role is bound to. Throws when the call fails. */
43
62
  invoke(call: CapCall): Promise<void>;
44
63
  templateExists(templateId: string): Promise<boolean>;
@@ -60,6 +79,10 @@ export declare class RemoteService implements IRemoteProvider {
60
79
  private readonly deps;
61
80
  private readonly now;
62
81
  private readonly sleep;
82
+ /** Remote devices seen so far, and the plug each one waits on: who an input event affects. */
83
+ private readonly plugOf;
84
+ private readonly sliceRuns;
85
+ private readonly slicePending;
63
86
  constructor(deps: RemoteServiceDeps);
64
87
  readonly getConfig: IRemoteProvider["getConfig"];
65
88
  readonly setConfig: IRemoteProvider["setConfig"];
@@ -67,6 +90,24 @@ export declare class RemoteService implements IRemoteProvider {
67
90
  readonly sendCommand: IRemoteProvider["sendCommand"];
68
91
  readonly sendMediaCommand: IRemoteProvider["sendMediaCommand"];
69
92
  /**
93
+ * Writes the device's `media-player` slice from `assumedStatus`, but only
94
+ * when the remote is what answers for it: a media player, no native source
95
+ * (`hasNative`), and a power state the remote knows. Overlapping calls for a
96
+ * device coalesce: one run in flight, one more pending. A failed write is
97
+ * logged, never thrown — the next input change or send is the retry (D3).
98
+ */
99
+ refreshSlice(deviceId: number): Promise<void>;
100
+ private drainSlice;
101
+ private writeSlice;
102
+ /** Boot: every remote device. */
103
+ refreshSlices(): Promise<void>;
104
+ /**
105
+ * A device's state changed: refresh the remote devices it feeds — the TV
106
+ * itself (its running-state) and every TV whose linked plug it is. Any other
107
+ * device costs no read.
108
+ */
109
+ onInputChanged(deviceId: number): Promise<void>;
110
+ /**
70
111
  * What the remote ASSUMES (the last power and mute it sent), or null when it
71
112
  * knows neither. No plug, no running-state: that is `assumedStatus`.
72
113
  */
@@ -79,7 +120,9 @@ export declare class RemoteService implements IRemoteProvider {
79
120
  * the assumption, and only while the device may be on.
80
121
  */
81
122
  assumedStatus(deviceId: number): Promise<MediaPlayerStatus | null>;
123
+ /** `forget`: whether a plug that is off drops the kept power guess (a read's side effect). */
82
124
  private statusOf;
125
+ private buildStatus;
83
126
  private mediaRole;
84
127
  /** A role is reachable when bound, or when a toggle `power` stands for `power_on` / `power_off`. */
85
128
  private isBound;
@@ -10,7 +10,7 @@
10
10
  * addon.
11
11
  */
12
12
  import { type AddonApi, type AddonContext, type IScopedLogger, type MediaPlayerStatus, type RecordsAccess } from "@camstack/types";
13
- import { RemoteService, type RemoteAssumptionStore, type RemoteConfigStore } from "./remote-service.js";
13
+ import { RemoteService, type RemoteAssumptionStore, type RemoteConfigStore, type RemoteSliceWriter } from "./remote-service.js";
14
14
  import { TemplatesService, type TemplateUsage } from "./templates-service.js";
15
15
  /** The key of the device's settings store that holds its remote configuration. */
16
16
  export declare const REMOTE_STORE_KEY = "remote";
@@ -22,6 +22,8 @@ export interface RemoteRuntimeDeps {
22
22
  readonly settings: DeviceSettings;
23
23
  readonly api: () => AddonApi | undefined;
24
24
  readonly logger: IScopedLogger;
25
+ /** Whether a driver's native media-player cap reads the device (the redirect's predicate). */
26
+ readonly hasNative: (deviceId: number) => boolean;
25
27
  /** The wait between two sends of a repeat; a spec drives it. */
26
28
  readonly sleep?: (ms: number) => Promise<void>;
27
29
  readonly now?: () => number;
@@ -53,5 +55,21 @@ export declare function templateUsageOver(settings: Pick<DeviceSettings, "listDe
53
55
  * reading and must not be fed back as one.
54
56
  */
55
57
  export declare function reportedStatusOver(api: () => AddonApi | undefined, logger: IScopedLogger): (deviceId: number) => Promise<MediaPlayerStatus | null>;
58
+ /**
59
+ * The standard runtime-state path (`deviceState.setCapSlice`, the entry every
60
+ * `setCapState` reaches). The current slice is read back from the hub, never
61
+ * kept here, so a write that would change nothing is skipped without a cache.
62
+ */
63
+ export declare function remoteSliceWriterOver(settings: Pick<DeviceSettings, "readDeviceStoreBatch" | "listDeviceStoreIds">, api: () => AddonApi | undefined): RemoteSliceWriter;
64
+ /** The device of the linked plug (`power-source`), null when none is linked or it errors. */
65
+ export declare function plugDeviceOver(api: () => AddonApi | undefined): (deviceId: number) => Promise<number | null>;
66
+ /** The caps whose change can move the assumed state: the plug's switch and a running-state. */
67
+ export declare const REMOTE_SLICE_INPUT_CAPS: ReadonlySet<string>;
68
+ /**
69
+ * Seeds every remote device's slice ONCE at boot. No retry timer (D3): a read
70
+ * that fails changes nothing, and `DeviceRegistered` and the input events
71
+ * re-drive the refresh.
72
+ */
73
+ export declare function seedRemoteSlices(remote: Pick<RemoteService, "refreshSlices">, logger: IScopedLogger): Promise<void>;
56
74
  export declare function buildRemoteRuntime(deps: RemoteRuntimeDeps): RemoteRuntime;
57
75
  export {};
@@ -29,6 +29,8 @@ export interface ChildAddonCallDispatchDeps {
29
29
  customActions: CustomActionRegistry;
30
30
  /** Resolve the loaded addon instance by id — used for the `settings` surface. */
31
31
  getAddonInstance: (addonId: string) => ICamstackAddon | null;
32
+ /** Ids of every addon this runner hosts — named in the refusal for an addon it does not. */
33
+ listAddonIds?: () => readonly string[];
32
34
  /** Resolve an addon's live HTTP data-plane endpoints (published by its
33
35
  * `ctx.dataPlane` facility). Empty when the addon serves no data-plane. */
34
36
  getDataPlanes: (addonId: string) => readonly AddonDataPlaneEndpoint[];
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.807",
3
+ "version": "1.2.808",
4
4
  "description": "CamStack builtins — shipped inside @camstack/server (generated, do not edit)",
5
5
  "license": "MIT",
6
6
  "camstack": {