@camstack/server 1.2.822 → 1.2.824

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 (109) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/api/trpc/generated-cap-routers.js +0 -45
  3. package/package.json +11 -11
  4. package/system/dist/addon-runner.js +42 -15
  5. package/system/dist/addon-runner.mjs +43 -16
  6. package/system/dist/addon-utils.d.ts +1 -0
  7. package/system/dist/addon-utils.js +2 -0
  8. package/system/dist/addon-utils.mjs +2 -1
  9. package/system/dist/{agent-https-SGBI0xP8.js → agent-https-B2nqARmj.js} +1 -1
  10. package/system/dist/{agent-https-C4yxMErF.mjs → agent-https-BBO2OtNH.mjs} +1 -1
  11. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  12. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  13. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  14. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  15. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  16. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  17. package/system/dist/builtins/autotrack/index.js +1 -1
  18. package/system/dist/builtins/autotrack/index.mjs +1 -1
  19. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  20. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  21. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  22. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  23. package/system/dist/builtins/camera-grid/index.js +1 -1
  24. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  25. package/system/dist/builtins/composer/composed-device-set.d.ts +5 -1
  26. package/system/dist/builtins/composer/composed-device.d.ts +4 -0
  27. package/system/dist/builtins/composer/composed-name.d.ts +30 -0
  28. package/system/dist/builtins/composer/composer.addon.js +94 -6
  29. package/system/dist/builtins/composer/composer.addon.mjs +94 -6
  30. package/system/dist/builtins/composer/composer.d.ts +13 -0
  31. package/system/dist/builtins/console-logging/index.js +1 -1
  32. package/system/dist/builtins/console-logging/index.mjs +1 -1
  33. package/system/dist/builtins/core-blocks/actions-service.d.ts +8 -0
  34. package/system/dist/builtins/core-blocks/composition-api.d.ts +6 -0
  35. package/system/dist/builtins/core-blocks/core-blocks.addon.js +143 -23
  36. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +144 -24
  37. package/system/dist/builtins/core-blocks/record-kinds.d.ts +1 -0
  38. package/system/dist/builtins/core-blocks/rename-composition-block.d.ts +16 -0
  39. package/system/dist/builtins/core-blocks/sync-composed-device-name.d.ts +19 -0
  40. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  41. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  42. package/system/dist/builtins/device-manager/device-manager.addon.js +43 -4
  43. package/system/dist/builtins/device-manager/device-manager.addon.mjs +43 -4
  44. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  45. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  46. package/system/dist/builtins/keychain/index.js +4 -4
  47. package/system/dist/builtins/keychain/index.mjs +4 -4
  48. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  49. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  50. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  51. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  52. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  53. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  54. package/system/dist/builtins/loki-logging/index.js +1 -1
  55. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  56. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  57. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  58. package/system/dist/builtins/platform-probe/index.js +1 -1
  59. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  60. package/system/dist/builtins/record-entries/index.js +1 -1
  61. package/system/dist/builtins/record-entries/index.mjs +1 -1
  62. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  63. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  64. package/system/dist/builtins/snapshot/index.js +1 -1
  65. package/system/dist/builtins/snapshot/index.mjs +1 -1
  66. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  67. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  68. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  69. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  70. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  71. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  72. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  73. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  74. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  75. package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
  76. package/system/dist/builtins/winston-logging/index.js +1 -1
  77. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  78. package/system/dist/cap-call-scope-8eiugfLl.js +46 -0
  79. package/system/dist/cap-call-scope-Bic6Ekfw.mjs +30 -0
  80. package/system/dist/{capture-engine-BSjE-CQA.mjs → capture-engine-C-rHYVFq.mjs} +1 -1
  81. package/system/dist/{capture-engine-6MVUyUry.js → capture-engine-DP4HbT3W.js} +1 -1
  82. package/system/dist/{composition-sources-C8T9DRbZ.mjs → composition-sources-CL9JFN4y.mjs} +1 -1
  83. package/system/dist/{composition-sources-BBAOXZdC.js → composition-sources-CM9c_jAj.js} +1 -1
  84. package/system/dist/{constants-CReG6K4k.mjs → constants-DzGFnCKZ.mjs} +1 -1
  85. package/system/dist/{constants-v0g9--wN.js → constants-jk7JccZ0.js} +1 -1
  86. package/system/dist/{device-ca-BFcBTfff.js → device-ca-B7_R5WJh.js} +1 -1
  87. package/system/dist/{device-ca-cX8qUs2s.mjs → device-ca-DZ_OQiCc.mjs} +1 -1
  88. package/system/dist/{dist-DjBZ1HhF.mjs → dist-BgRMQHuL.mjs} +171 -184
  89. package/system/dist/{dist-C2czR9xK.js → dist-BpTL3uNe.js} +188 -183
  90. package/system/dist/file-host-worker.js +1 -1
  91. package/system/dist/file-host-worker.mjs +1 -1
  92. package/system/dist/{hub-mdns-ciao-Cnr8xiSd.mjs → hub-mdns-ciao-DIcBingB.mjs} +2 -2
  93. package/system/dist/{hub-mdns-ciao-CpCleue0.js → hub-mdns-ciao-DPUaYAD3.js} +2 -2
  94. package/system/dist/index.d.ts +1 -0
  95. package/system/dist/index.js +65 -42
  96. package/system/dist/index.mjs +64 -44
  97. package/system/dist/kernel/cap-call-scope.d.ts +10 -0
  98. package/system/dist/kernel/transport/cap-route-resolver.d.ts +27 -1
  99. package/system/dist/kernel/transport/child-cap-protocol.d.ts +1 -1
  100. package/system/dist/kernel/transport/parent-unowned-call.d.ts +0 -11
  101. package/system/dist/{legacy-integration-rows-door-CGajkVPh.mjs → legacy-integration-rows-door-1GnkpMgH.mjs} +1 -1
  102. package/system/dist/{legacy-integration-rows-door-DhW6mPZj.js → legacy-integration-rows-door-DYNePgj4.js} +1 -1
  103. package/system/dist/rename-composition-block-Cp0_nwAI.mjs +101 -0
  104. package/system/dist/rename-composition-block-Dn2z4fnA.js +112 -0
  105. package/system/dist/{restore-archive-eA7L58KT.mjs → restore-archive-B3FEpUfz.mjs} +1 -1
  106. package/system/dist/{restore-archive-BLab80kx.js → restore-archive-BGa5pdp9.js} +1 -1
  107. package/system/dist/{wal-maintenance-DeBxoOFh.mjs → wal-maintenance-BLWLlVfF.mjs} +0 -0
  108. package/system/dist/{wal-maintenance-DhnSF7K-.js → wal-maintenance-GWFxnSnE.js} +0 -0
  109. package/system/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.824] - 2026-11-10
11
+
12
+ ### Changed
13
+
14
+ - Notification rules and buttons run existing Actions; the notification-centre sequence methods are gone
15
+
16
+ ## [1.2.823] - 2026-11-09
17
+
18
+ ### Changed
19
+
20
+ - Rebuilt against updated dependencies.
21
+
10
22
  ## [1.2.822] - 2026-11-09
11
23
 
12
24
  ### Changed
@@ -7849,51 +7849,6 @@ function createCapRouter_notificationRules(getProvider, createRemoteProxy) {
7849
7849
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
7850
7850
  return p.setRuleEnabled(methodInput);
7851
7851
  }),
7852
- listSequences: trpc_middleware_js_1.adminProcedure
7853
- .input(types_107.notificationRulesCapability.methods.listSequences.input.loose())
7854
- .output(types_107.notificationRulesCapability.methods.listSequences.output)
7855
- .query(async ({ input, ctx }) => {
7856
- const { nodeId, ...methodInput } = input;
7857
- const p = resolveProvider('notification-rules', nodeId, () => getProvider(ctx), createRemoteProxy);
7858
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
7859
- return p.listSequences(methodInput);
7860
- }),
7861
- getSequence: trpc_middleware_js_1.adminProcedure
7862
- .input(types_107.notificationRulesCapability.methods.getSequence.input.loose())
7863
- .output(types_107.notificationRulesCapability.methods.getSequence.output)
7864
- .query(async ({ input, ctx }) => {
7865
- const { nodeId, ...methodInput } = input;
7866
- const p = resolveProvider('notification-rules', nodeId, () => getProvider(ctx), createRemoteProxy);
7867
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
7868
- return p.getSequence(methodInput);
7869
- }),
7870
- createSequence: trpc_middleware_js_1.adminProcedure
7871
- .input(types_107.notificationRulesCapability.methods.createSequence.input.loose())
7872
- .output(types_107.notificationRulesCapability.methods.createSequence.output)
7873
- .mutation(async ({ input, ctx }) => {
7874
- const { nodeId, ...methodInput } = input;
7875
- const p = resolveProvider('notification-rules', nodeId, () => getProvider(ctx), createRemoteProxy);
7876
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
7877
- return p.createSequence(methodInput);
7878
- }),
7879
- updateSequence: trpc_middleware_js_1.adminProcedure
7880
- .input(types_107.notificationRulesCapability.methods.updateSequence.input.loose())
7881
- .output(types_107.notificationRulesCapability.methods.updateSequence.output)
7882
- .mutation(async ({ input, ctx }) => {
7883
- const { nodeId, ...methodInput } = input;
7884
- const p = resolveProvider('notification-rules', nodeId, () => getProvider(ctx), createRemoteProxy);
7885
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
7886
- return p.updateSequence(methodInput);
7887
- }),
7888
- deleteSequence: trpc_middleware_js_1.adminProcedure
7889
- .input(types_107.notificationRulesCapability.methods.deleteSequence.input.loose())
7890
- .output(types_107.notificationRulesCapability.methods.deleteSequence.output)
7891
- .mutation(async ({ input, ctx }) => {
7892
- const { nodeId, ...methodInput } = input;
7893
- const p = resolveProvider('notification-rules', nodeId, () => getProvider(ctx), createRemoteProxy);
7894
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
7895
- return p.deleteSequence(methodInput);
7896
- }),
7897
7852
  getClipRetentionAsks: trpc_middleware_js_1.adminProcedure
7898
7853
  .input(types_107.notificationRulesCapability.methods.getClipRetentionAsks.input.loose())
7899
7854
  .output(types_107.notificationRulesCapability.methods.getClipRetentionAsks.output)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.822",
3
+ "version": "1.2.824",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -66,10 +66,10 @@
66
66
  ],
67
67
  "requires": {
68
68
  "addons": {
69
- "@camstack/addon-admin-ui": ">=1.2.629",
70
- "@camstack/addon-agent-ui": ">=1.2.354",
71
- "@camstack/addon-post-analysis": ">=1.2.689",
72
- "@camstack/addon-provider-bosch": ">=0.1.46"
69
+ "@camstack/addon-admin-ui": ">=1.2.631",
70
+ "@camstack/addon-agent-ui": ">=1.2.356",
71
+ "@camstack/addon-pipeline-orchestrator": ">=1.2.676",
72
+ "@camstack/addon-post-analysis": ">=1.2.690"
73
73
  },
74
74
  "wrapper": {
75
75
  "desktop": ">=0.0.1",
@@ -78,19 +78,19 @@
78
78
  }
79
79
  },
80
80
  "dependencies": {
81
- "@camstack/addon-admin-ui": "1.2.629",
82
- "@camstack/addon-agent-ui": "1.2.354",
81
+ "@camstack/addon-admin-ui": "1.2.631",
82
+ "@camstack/addon-agent-ui": "1.2.356",
83
83
  "@camstack/addon-auth": "1.2.180",
84
84
  "@camstack/addon-benchmark": "1.2.312",
85
85
  "@camstack/addon-decoder-nodeav": "1.2.149",
86
86
  "@camstack/addon-notifiers": "1.2.635",
87
87
  "@camstack/addon-pipeline": "1.2.648",
88
- "@camstack/addon-pipeline-orchestrator": "1.2.675",
89
- "@camstack/addon-post-analysis": "1.2.689",
88
+ "@camstack/addon-pipeline-orchestrator": "1.2.676",
89
+ "@camstack/addon-post-analysis": "1.2.690",
90
90
  "@camstack/develop": "0.1.51",
91
91
  "@camstack/sdk": "1.2.157",
92
- "@camstack/types": "1.2.536",
93
- "@camstack/ui-library": "1.2.413",
92
+ "@camstack/types": "1.2.538",
93
+ "@camstack/ui-library": "1.2.415",
94
94
  "@fastify/compress": "^9.0.0",
95
95
  "@fastify/cookie": "^11.0.2",
96
96
  "@fastify/cors": "^11.2.0",
@@ -38,6 +38,7 @@ let node_perf_hooks = require("node:perf_hooks");
38
38
  let node_vm = require("node:vm");
39
39
  node_vm = __toESM(node_vm);
40
40
  let node_fs_promises = require("node:fs/promises");
41
+ let node_async_hooks = require("node:async_hooks");
41
42
  let _trpc_client = require("@trpc/client");
42
43
  let _camstack_types_node = require("@camstack/types/node");
43
44
  let node_http = require("node:http");
@@ -2922,6 +2923,25 @@ function startRunnerHeapWatch(options) {
2922
2923
  return startHeapWatch(options.label, options.sink, intervalMs, reclaimOptions, void 0, void 0, true, rssBudget);
2923
2924
  }
2924
2925
  //#endregion
2926
+ //#region src/kernel/cap-call-scope.ts
2927
+ /**
2928
+ * The command-origin claim of the cap call currently running (D1022).
2929
+ *
2930
+ * A provider method is invoked with its args only — the claim rides out of band,
2931
+ * the same way `commandOrigin` puts it on a tRPC call. The dispatch that is about
2932
+ * to call the provider enters this scope, and the provider reads it back with
2933
+ * {@link readCommandOrigin}. The store does not cross a process: the parent copies
2934
+ * the claim onto the child `cap-call`, and the child enters the scope again.
2935
+ */
2936
+ var scope = new node_async_hooks.AsyncLocalStorage();
2937
+ /**
2938
+ * Run `fn` as a cap call whose context is `context` (`commandOrigin(claim).context`,
2939
+ * or the raw `op.context`). `undefined` is a call that carried no claim.
2940
+ */
2941
+ function runWithCapCallContext(context, fn) {
2942
+ return scope.run(context, fn);
2943
+ }
2944
+ //#endregion
2925
2945
  //#region src/kernel/transport/cap-action-name.ts
2926
2946
  /**
2927
2947
  * cap-action-name.ts — single source of truth for Moleculer cap
@@ -5096,7 +5116,8 @@ var LocalChildClient = class {
5096
5116
  args,
5097
5117
  ...msg.deviceId !== void 0 ? { deviceId: msg.deviceId } : {},
5098
5118
  ...msg.addonId !== void 0 ? { addonId: msg.addonId } : {},
5099
- ...msg.callerAddonId !== void 0 ? { callerAddonId: msg.callerAddonId } : {}
5119
+ ...msg.callerAddonId !== void 0 ? { callerAddonId: msg.callerAddonId } : {},
5120
+ ...msg.origin !== void 0 ? { origin: msg.origin } : {}
5100
5121
  });
5101
5122
  if (payload !== void 0 && result !== void 0) return new PayloadReply(void 0, packPayload(result));
5102
5123
  return result;
@@ -6504,18 +6525,22 @@ function createBrokerDeviceManagerApi(opts) {
6504
6525
  create: async (stableId, DeviceClass, config, parentDeviceId = null, initialMeta = void 0) => {
6505
6526
  const id = await deviceApi.allocateDeviceId(stableId);
6506
6527
  if (initialMeta) {
6507
- if (initialMeta.name !== void 0) await callDeviceManager(api, "setName", {
6508
- deviceId: id,
6509
- name: initialMeta.name
6510
- }).catch((err) => {
6511
- opts.logger.warn("create: setName pre-seed failed", {
6512
- tags: {
6513
- stableId,
6514
- deviceId: id
6515
- },
6516
- meta: { error: err instanceof Error ? err.message : String(err) }
6528
+ if (initialMeta.name !== void 0) {
6529
+ const systemName = stableId.startsWith(_camstack_types_addon.COMPOSED_DEVICE_STABLE_ID_PREFIX);
6530
+ await callDeviceManager(api, "setName", {
6531
+ deviceId: id,
6532
+ name: initialMeta.name,
6533
+ ...systemName ? { stampUserNamed: false } : {}
6534
+ }).catch((err) => {
6535
+ opts.logger.warn("create: setName pre-seed failed", {
6536
+ tags: {
6537
+ stableId,
6538
+ deviceId: id
6539
+ },
6540
+ meta: { error: err instanceof Error ? err.message : String(err) }
6541
+ });
6517
6542
  });
6518
- });
6543
+ }
6519
6544
  if (initialMeta.location !== void 0) await callDeviceManager(api, "setLocation", {
6520
6545
  deviceId: id,
6521
6546
  location: initialMeta.location
@@ -6633,10 +6658,11 @@ function createBrokerDeviceManagerApi(opts) {
6633
6658
  });
6634
6659
  return id;
6635
6660
  },
6636
- setName: async (deviceId, name) => {
6661
+ setName: async (deviceId, name, write) => {
6637
6662
  await callDeviceManager(api, "setName", {
6638
6663
  deviceId,
6639
- name
6664
+ name,
6665
+ ...write?.stampUserNamed === false ? { stampUserNamed: false } : {}
6640
6666
  });
6641
6667
  },
6642
6668
  setLocation: async (deviceId, location) => {
@@ -11633,7 +11659,8 @@ function createChildCapDispatch(deps) {
11633
11659
  if (deps.isProviderOptionalMethod(capName, method)) throw new Error(`${CAP_METHOD_NOT_IMPLEMENTED}: '${capName}.${method}' is declared optional and this provider does not serve it`);
11634
11660
  throw new Error(`child-cap-dispatch: method '${method}' not found on provider '${capName}'`);
11635
11661
  }
11636
- return await fn.call(provider, args);
11662
+ const run = () => fn.call(provider, args);
11663
+ return await (call.origin === void 0 ? run() : runWithCapCallContext((0, _camstack_types_addon.commandOrigin)(call.origin).context, run));
11637
11664
  };
11638
11665
  }
11639
11666
  /**
@@ -1,5 +1,5 @@
1
1
  import { register } from "node:module";
2
- import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, CAP_METHOD_TIMEOUTS_MS, COLLECTION_ARRAY_METHODS, DATAPLANE_SECRET_HEADER, DEVICE_CHILDREN_BATCH_MAX, DeviceType, DisposerChain, ErrorI18nPayloadSchema, EventCategory, MIGRATION_API_VERSION, PEER_BYTES_CHUNK_BYTES, PEER_BYTES_MAX_OUTSTANDING, PEER_BYTES_STALL_MS, PEER_BYTES_TICKET_TTL_MS, ReadinessRegistry, ReadinessTimeoutError, addonSliceHandleApi, asJsonObject, asString, collectZodSecretPaths, createDebugEmitter, createDeviceProxy, createEventBusSliceSource, createRecordsAccess, createSecretsAccess, describeCustomActions, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, findMigrationsBlocked, isCollectionArrayMethodName, isProviderOptionalMethodName, maskUrlCredentials, nodeIdOfScopedKey, normalizeAddonInitResult, readCommandOrigin, readErrorI18n, readNodePin, resolveDeviceSettings, resolveSecretViewsIn, scopeKey, scrubKnownSecrets, withCapInputDefaults } from "@camstack/types/addon";
2
+ import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, CAP_METHOD_TIMEOUTS_MS, COLLECTION_ARRAY_METHODS, COMPOSED_DEVICE_STABLE_ID_PREFIX, DATAPLANE_SECRET_HEADER, DEVICE_CHILDREN_BATCH_MAX, DeviceType, DisposerChain, ErrorI18nPayloadSchema, EventCategory, MIGRATION_API_VERSION, PEER_BYTES_CHUNK_BYTES, PEER_BYTES_MAX_OUTSTANDING, PEER_BYTES_STALL_MS, PEER_BYTES_TICKET_TTL_MS, ReadinessRegistry, ReadinessTimeoutError, addonSliceHandleApi, asJsonObject, asString, collectZodSecretPaths, commandOrigin, createDebugEmitter, createDeviceProxy, createEventBusSliceSource, createRecordsAccess, createSecretsAccess, describeCustomActions, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, findMigrationsBlocked, isCollectionArrayMethodName, isProviderOptionalMethodName, maskUrlCredentials, nodeIdOfScopedKey, normalizeAddonInitResult, readCommandOrigin, readErrorI18n, readNodePin, resolveDeviceSettings, resolveSecretViewsIn, scopeKey, scrubKnownSecrets, withCapInputDefaults } from "@camstack/types/addon";
3
3
  import * as fs$1 from "node:fs";
4
4
  import fs, { createReadStream, createWriteStream, existsSync, readFileSync, readdirSync } from "node:fs";
5
5
  import * as path from "node:path";
@@ -15,6 +15,7 @@ import * as v8 from "node:v8";
15
15
  import { monitorEventLoopDelay } from "node:perf_hooks";
16
16
  import * as vm from "node:vm";
17
17
  import { mkdir, rm, stat, unlink } from "node:fs/promises";
18
+ import { AsyncLocalStorage } from "node:async_hooks";
18
19
  import { TRPCClientError, createTRPCClient } from "@trpc/client";
19
20
  import { EDGETPU_LIB_ENV, chooseEdgetpuDelegate, declaresEdgetpuDelegate, ensureBinary, ensureEdgetpuDelegate, ensureFfmpeg, ensurePython, installPythonPackages, installPythonRequirements, nodeDataRootFromEnv } from "@camstack/types/node";
20
21
  import { createServer as createServer$1, request } from "node:http";
@@ -2867,6 +2868,25 @@ function startRunnerHeapWatch(options) {
2867
2868
  return startHeapWatch(options.label, options.sink, intervalMs, reclaimOptions, void 0, void 0, true, rssBudget);
2868
2869
  }
2869
2870
  //#endregion
2871
+ //#region src/kernel/cap-call-scope.ts
2872
+ /**
2873
+ * The command-origin claim of the cap call currently running (D1022).
2874
+ *
2875
+ * A provider method is invoked with its args only — the claim rides out of band,
2876
+ * the same way `commandOrigin` puts it on a tRPC call. The dispatch that is about
2877
+ * to call the provider enters this scope, and the provider reads it back with
2878
+ * {@link readCommandOrigin}. The store does not cross a process: the parent copies
2879
+ * the claim onto the child `cap-call`, and the child enters the scope again.
2880
+ */
2881
+ var scope = new AsyncLocalStorage();
2882
+ /**
2883
+ * Run `fn` as a cap call whose context is `context` (`commandOrigin(claim).context`,
2884
+ * or the raw `op.context`). `undefined` is a call that carried no claim.
2885
+ */
2886
+ function runWithCapCallContext(context, fn) {
2887
+ return scope.run(context, fn);
2888
+ }
2889
+ //#endregion
2870
2890
  //#region src/kernel/transport/cap-action-name.ts
2871
2891
  /**
2872
2892
  * cap-action-name.ts — single source of truth for Moleculer cap
@@ -5041,7 +5061,8 @@ var LocalChildClient = class {
5041
5061
  args,
5042
5062
  ...msg.deviceId !== void 0 ? { deviceId: msg.deviceId } : {},
5043
5063
  ...msg.addonId !== void 0 ? { addonId: msg.addonId } : {},
5044
- ...msg.callerAddonId !== void 0 ? { callerAddonId: msg.callerAddonId } : {}
5064
+ ...msg.callerAddonId !== void 0 ? { callerAddonId: msg.callerAddonId } : {},
5065
+ ...msg.origin !== void 0 ? { origin: msg.origin } : {}
5045
5066
  });
5046
5067
  if (payload !== void 0 && result !== void 0) return new PayloadReply(void 0, packPayload(result));
5047
5068
  return result;
@@ -6449,18 +6470,22 @@ function createBrokerDeviceManagerApi(opts) {
6449
6470
  create: async (stableId, DeviceClass, config, parentDeviceId = null, initialMeta = void 0) => {
6450
6471
  const id = await deviceApi.allocateDeviceId(stableId);
6451
6472
  if (initialMeta) {
6452
- if (initialMeta.name !== void 0) await callDeviceManager(api, "setName", {
6453
- deviceId: id,
6454
- name: initialMeta.name
6455
- }).catch((err) => {
6456
- opts.logger.warn("create: setName pre-seed failed", {
6457
- tags: {
6458
- stableId,
6459
- deviceId: id
6460
- },
6461
- meta: { error: err instanceof Error ? err.message : String(err) }
6473
+ if (initialMeta.name !== void 0) {
6474
+ const systemName = stableId.startsWith(COMPOSED_DEVICE_STABLE_ID_PREFIX);
6475
+ await callDeviceManager(api, "setName", {
6476
+ deviceId: id,
6477
+ name: initialMeta.name,
6478
+ ...systemName ? { stampUserNamed: false } : {}
6479
+ }).catch((err) => {
6480
+ opts.logger.warn("create: setName pre-seed failed", {
6481
+ tags: {
6482
+ stableId,
6483
+ deviceId: id
6484
+ },
6485
+ meta: { error: err instanceof Error ? err.message : String(err) }
6486
+ });
6462
6487
  });
6463
- });
6488
+ }
6464
6489
  if (initialMeta.location !== void 0) await callDeviceManager(api, "setLocation", {
6465
6490
  deviceId: id,
6466
6491
  location: initialMeta.location
@@ -6578,10 +6603,11 @@ function createBrokerDeviceManagerApi(opts) {
6578
6603
  });
6579
6604
  return id;
6580
6605
  },
6581
- setName: async (deviceId, name) => {
6606
+ setName: async (deviceId, name, write) => {
6582
6607
  await callDeviceManager(api, "setName", {
6583
6608
  deviceId,
6584
- name
6609
+ name,
6610
+ ...write?.stampUserNamed === false ? { stampUserNamed: false } : {}
6585
6611
  });
6586
6612
  },
6587
6613
  setLocation: async (deviceId, location) => {
@@ -11578,7 +11604,8 @@ function createChildCapDispatch(deps) {
11578
11604
  if (deps.isProviderOptionalMethod(capName, method)) throw new Error(`${CAP_METHOD_NOT_IMPLEMENTED}: '${capName}.${method}' is declared optional and this provider does not serve it`);
11579
11605
  throw new Error(`child-cap-dispatch: method '${method}' not found on provider '${capName}'`);
11580
11606
  }
11581
- return await fn.call(provider, args);
11607
+ const run = () => fn.call(provider, args);
11608
+ return await (call.origin === void 0 ? run() : runWithCapCallContext(commandOrigin(call.origin).context, run));
11582
11609
  };
11583
11610
  }
11584
11611
  /**
@@ -21,3 +21,4 @@ export { parseRangeHeader, contentTypeFor, type ByteRange } from "./http/authent
21
21
  export { CustomActionRegistry } from "./kernel/custom-action-registry.js";
22
22
  export { attributeStall, STALL_REPORT_MS, STALL_TICK_MS, startEventLoopStallMonitor, type StallVerdict } from "./kernel/event-loop-stall-monitor.js";
23
23
  export { renderCourtesyJpeg, renderCourtesyOverlayJpeg, courtesyCacheKey, COURTESY_DEFAULT_WIDTH, type CourtesyReason, type CourtesyFrameSpec } from "./builtins/snapshot/snapshot-courtesy.js";
24
+ export { readCurrentCommandOrigin } from "./kernel/cap-call-scope.js";
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./chunk-Cek0wNdY.js");
3
+ const require_cap_call_scope = require("./cap-call-scope-8eiugfLl.js");
3
4
  const require_custom_action_registry = require("./custom-action-registry-CmWpSeMS.js");
4
5
  const require_snapshot_courtesy = require("./snapshot-courtesy-D_C5-nC0.js");
5
6
  exports.COURTESY_DEFAULT_WIDTH = require_snapshot_courtesy.COURTESY_DEFAULT_WIDTH;
@@ -21,6 +22,7 @@ exports.getModelFilePath = require_custom_action_registry.getModelFilePath;
21
22
  exports.isModelDownloadHttpError = require_custom_action_registry.isModelDownloadHttpError;
22
23
  exports.isModelDownloaded = require_custom_action_registry.isModelDownloaded;
23
24
  exports.parseRangeHeader = require_custom_action_registry.parseRangeHeader;
25
+ exports.readCurrentCommandOrigin = require_cap_call_scope.readCurrentCommandOrigin;
24
26
  exports.renderCourtesyJpeg = require_snapshot_courtesy.renderCourtesyJpeg;
25
27
  exports.renderCourtesyOverlayJpeg = require_snapshot_courtesy.renderCourtesyOverlayJpeg;
26
28
  exports.resolveFormatRevision = require_custom_action_registry.resolveFormatRevision;
@@ -1,3 +1,4 @@
1
+ import { n as readCurrentCommandOrigin } from "./cap-call-scope-Bic6Ekfw.mjs";
1
2
  import { C as isModelDownloaded, S as isModelDownloadHttpError, _ as downloadFile, a as startEventLoopStallMonitor, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, p as ModelDownloadHttpError, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-B9zFBNVa.mjs";
2
3
  import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg, t as COURTESY_DEFAULT_WIDTH } from "./snapshot-courtesy-CyFs1M3I.mjs";
3
- export { COURTESY_DEFAULT_WIDTH, CustomActionRegistry, ModelDownloadHttpError, ModelDownloadService, STALL_REPORT_MS, STALL_TICK_MS, adoptModelRevisions, attributeStall, collectModelFiles, contentTypeFor, courtesyCacheKey, createFileDataPlaneHandler, deleteModelFromDisk, downloadFile, ensureModel, getModelFilePath, isModelDownloadHttpError, isModelDownloaded, parseRangeHeader, renderCourtesyJpeg, renderCourtesyOverlayJpeg, resolveFormatRevision, startEventLoopStallMonitor };
4
+ export { COURTESY_DEFAULT_WIDTH, CustomActionRegistry, ModelDownloadHttpError, ModelDownloadService, STALL_REPORT_MS, STALL_TICK_MS, adoptModelRevisions, attributeStall, collectModelFiles, contentTypeFor, courtesyCacheKey, createFileDataPlaneHandler, deleteModelFromDisk, downloadFile, ensureModel, getModelFilePath, isModelDownloadHttpError, isModelDownloaded, parseRangeHeader, readCurrentCommandOrigin, renderCourtesyJpeg, renderCourtesyOverlayJpeg, resolveFormatRevision, startEventLoopStallMonitor };
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-C2czR9xK.js");
2
+ const require_dist = require("./dist-BpTL3uNe.js");
3
3
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
4
4
  let zod = require("zod");
5
5
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { sc as defineRecordKinds } from "./dist-DjBZ1HhF.mjs";
1
+ import { cc as defineRecordKinds } from "./dist-BgRMQHuL.mjs";
2
2
  import { C as backdatedNotBefore, S as withUtcTimeEncoding, _ as NameConstraints, a as KeyUsageFlags, c as Pkcs10CertificateRequest, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, g as GeneralSubtrees, h as GeneralSubtree, i as Extension, l as Pkcs10CertificateRequestGenerator, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension, u as SubjectAlternativeNameExtension, v as GeneralName, x as AsnConvert } from "./x509.es-BRiJgOvu.mjs";
3
3
  import { z } from "zod";
4
4
  import { X509Certificate, createHash, createPrivateKey, randomBytes, webcrypto } from "node:crypto";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-C2czR9xK.js");
6
+ const require_dist = require("../../dist-BpTL3uNe.js");
7
7
  const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let node_fs = require("node:fs");
@@ -1,4 +1,4 @@
1
- import { gn as addonPagesCapability, il as EventCategory, nl as errMsg, os as BaseAddon } from "../../dist-DjBZ1HhF.mjs";
1
+ import { _n as addonPagesCapability, al as errMsg, sl as EventCategory, ss as BaseAddon } from "../../dist-BgRMQHuL.mjs";
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as fs$1 from "node:fs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-C2czR9xK.js");
6
+ const require_dist = require("../../dist-BpTL3uNe.js");
7
7
  const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let node_fs = require("node:fs");
@@ -1,4 +1,4 @@
1
- import { il as EventCategory, nl as errMsg, os as BaseAddon, vn as addonWidgetsCapability } from "../../dist-DjBZ1HhF.mjs";
1
+ import { al as errMsg, sl as EventCategory, ss as BaseAddon, yn as addonWidgetsCapability } from "../../dist-BgRMQHuL.mjs";
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as fs$1 from "node:fs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-C2czR9xK.js");
6
+ const require_dist = require("../../dist-BpTL3uNe.js");
7
7
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
8
8
  const require_log_redactor = require("../../log-redactor-BhIEMaG9.js");
9
9
  let node_fs = require("node:fs");
@@ -1,4 +1,4 @@
1
- import { $r as isAlertEpisodeSeverity, Qr as isAlertEpisodeOpen, bn as alertEpisodePayload, f as AlertSchema, il as EventCategory, nc as createEvent, nl as errMsg, os as BaseAddon, sc as defineRecordKinds, w as CORE_BLOCK_ADDON_PREFIX, xn as alertsCapability, yn as alertEpisodeId } from "../../dist-DjBZ1HhF.mjs";
1
+ import { $r as isAlertEpisodeOpen, Sn as alertsCapability, T as CORE_BLOCK_ADDON_PREFIX, al as errMsg, bn as alertEpisodeId, cc as defineRecordKinds, ei as isAlertEpisodeSeverity, p as AlertSchema, rc as createEvent, sl as EventCategory, ss as BaseAddon, xn as alertEpisodePayload } from "../../dist-BgRMQHuL.mjs";
2
2
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
3
3
  import { a as redactLogText } from "../../log-redactor-XLDrPzOi.mjs";
4
4
  import * as fs$1 from "node:fs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-C2czR9xK.js");
6
+ const require_dist = require("../../dist-BpTL3uNe.js");
7
7
  let zod = require("zod");
8
8
  //#region src/builtins/autotrack/autotrack-config.ts
9
9
  var DEFAULT_AUTOTRACK_LOOP_CONFIG = {
@@ -1,4 +1,4 @@
1
- import { En as bareAddonId, bc as isEvent, il as EventCategory, nl as errMsg, os as BaseAddon, ot as FIRST_LEVEL_MACRO_CLASSES, sa as ptzAutotrackCapability } from "../../dist-DjBZ1HhF.mjs";
1
+ import { Dn as bareAddonId, al as errMsg, ca as ptzAutotrackCapability, sl as EventCategory, ss as BaseAddon, st as FIRST_LEVEL_MACRO_CLASSES, xc as isEvent } from "../../dist-BgRMQHuL.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/builtins/autotrack/autotrack-config.ts
4
4
  var DEFAULT_AUTOTRACK_LOOP_CONFIG = {
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-C2czR9xK.js");
6
+ const require_dist = require("../../dist-BpTL3uNe.js");
7
7
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
8
- const require_restore_archive = require("../../restore-archive-BLab80kx.js");
8
+ const require_restore_archive = require("../../restore-archive-BGa5pdp9.js");
9
9
  let node_crypto = require("node:crypto");
10
10
  let node_fs = require("node:fs");
11
11
  node_fs = require_chunk.__toESM(node_fs);
@@ -1,6 +1,6 @@
1
- import { $a as storageOccupancyCapability, Mc as nodePin, Ti as mayWriteToLocation, Tn as backupCapability, il as EventCategory, os as BaseAddon, qc as toNodeId } from "../../dist-DjBZ1HhF.mjs";
1
+ import { Ei as mayWriteToLocation, En as backupCapability, Nc as nodePin, Yc as toNodeId, eo as storageOccupancyCapability, sl as EventCategory, ss as BaseAddon } from "../../dist-BgRMQHuL.mjs";
2
2
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
3
- import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-eA7L58KT.mjs";
3
+ import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-B3FEpUfz.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import * as fs$1 from "node:fs";
6
6
  import * as path$1 from "node:path";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-C2czR9xK.js");
6
+ const require_dist = require("../../dist-BpTL3uNe.js");
7
7
  const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
8
8
  let zod = require("zod");
9
9
  //#region src/builtins/calendars/calendar-color.ts
@@ -1,4 +1,4 @@
1
- import { E as CalendarPreferencesSchema, Fn as calendarsCapability, os as BaseAddon, sc as defineRecordKinds } from "../../dist-DjBZ1HhF.mjs";
1
+ import { D as CalendarPreferencesSchema, In as calendarsCapability, cc as defineRecordKinds, ss as BaseAddon } from "../../dist-BgRMQHuL.mjs";
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/builtins/calendars/calendar-color.ts
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-C2czR9xK.js");
6
+ const require_dist = require("../../dist-BpTL3uNe.js");
7
7
  let zod = require("zod");
8
8
  let node_crypto = require("node:crypto");
9
9
  let _camstack_types_node = require("@camstack/types/node");
@@ -1,4 +1,4 @@
1
- import { $c as DeviceFeature, As as RecordIntegrationInstances, Dt as MOTION_CLOSE_AFTER_MS, En as bareAddonId, Fo as buildFfmpegArgs, In as cameraGridLayoutCapability, Oi as memoizePinnedFfmpeg, Pi as motionCapability, Yr as integrationInstancesCapability, Z as DeclaredDevices, gc as hydrateSchema, h as BaseDevice, il as EventCategory, lr as declarationOwnerNodeId, nc as createEvent, nl as errMsg, oc as defineEntryKind, os as BaseAddon, qa as snapshotCapability, tl as DeviceType, to as streamCatalogCapability, xc as isInstanceEnabled, z as DERIVED_CAMERA_SILENCED_CAP_NAMES } from "../../dist-DjBZ1HhF.mjs";
1
+ import { B as DERIVED_CAMERA_SILENCED_CAP_NAMES, Dn as bareAddonId, Fi as motionCapability, Io as buildFfmpegArgs, Ja as snapshotCapability, Ln as cameraGridLayoutCapability, Ot as MOTION_CLOSE_AFTER_MS, Q as DeclaredDevices, Sc as isInstanceEnabled, Xr as integrationInstancesCapability, _c as hydrateSchema, al as errMsg, g as BaseDevice, il as DeviceType, js as RecordIntegrationInstances, ki as memoizePinnedFfmpeg, nl as DeviceFeature, no as streamCatalogCapability, rc as createEvent, sc as defineEntryKind, sl as EventCategory, ss as BaseAddon, ur as declarationOwnerNodeId } from "../../dist-BgRMQHuL.mjs";
2
2
  import { z } from "zod";
3
3
  import { createHash } from "node:crypto";
4
4
  import { FfmpegProcess } from "@camstack/types/node";
@@ -16,8 +16,12 @@ import { type DeviceDeclaration, type IScopedLogger } from "@camstack/types";
16
16
  import type { ComposedDeviceHandle } from "./composed-device.js";
17
17
  import type { ComposerDerivedSpec, PlannedBlock } from "./composer-plan.js";
18
18
  import type { PersistedComposedRow } from "./composition-declarations.js";
19
+ /** `stampUserNamed` marks an operator write. Absent is a system copy of the block name. */
20
+ export interface ComposerDeviceNameWrite {
21
+ readonly stampUserNamed: boolean;
22
+ }
19
23
  export interface ComposerDevicePorts {
20
- setName(deviceId: number, name: string): Promise<void>;
24
+ setName(deviceId: number, name: string, write?: ComposerDeviceNameWrite): Promise<void>;
21
25
  decommission(deviceId: number): Promise<void>;
22
26
  applyDerivedSpec(deviceId: number, derived: ComposerDerivedSpec): Promise<void>;
23
27
  }
@@ -5,6 +5,8 @@ import type { SlicePatch } from "./slice-assembler.js";
5
5
  declare const COMPOSED_DEVICE_CONFIG_SCHEMA: z.ZodObject<Record<string, never>>;
6
6
  export interface ComposedDeviceHandle extends ComposedWriteTarget {
7
7
  readonly name: string;
8
+ /** True once an operator renamed this device. Absent on test doubles that predate the flag. */
9
+ readonly userNamed?: boolean;
8
10
  /** Copies a source reading's quantity onto this device (D944). Optional so test doubles stay small. */
9
11
  adoptQuantity?(quantity: ReadingQuantity): Promise<void>;
10
12
  /** Publishes the features the device's bound caps stand for (`featuresOfBoundCaps`). Optional so test doubles stay small. */
@@ -19,6 +21,8 @@ export declare class ComposedDevice extends BaseDevice<typeof COMPOSED_DEVICE_CO
19
21
  private readonly derivesWater;
20
22
  /** The `consumables` items the composition last wrote — the derived water item is added to these. */
21
23
  private composedItems;
24
+ /** The row's flag, read at use: a restart loads it with the meta, and a system rename never sets it. */
25
+ get userNamed(): boolean;
22
26
  get features(): readonly DeviceFeature[];
23
27
  syncBoundFeatures(features: readonly DeviceFeature[]): void;
24
28
  constructor(ctx: DeviceContext, type: DeviceType, caps: readonly CapabilityDefinition[]);
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Which name wins when a user-named composed device and its block disagree.
3
+ *
4
+ * Both operator renames write both sides: the device page writes the block,
5
+ * the composition editor writes the device. A mismatch is a write that did
6
+ * not land. The device row has no name-change time, so the two failures look
7
+ * the same once nothing is remembered:
8
+ *
9
+ * - a device-page rename whose block write failed (the device name is newer);
10
+ * - an editor rename whose device write failed (the block name is newer).
11
+ *
12
+ * A restart remembers nothing. The handle was just built from the row, so its
13
+ * name is the stored one, and that name wins — copying the block onto a row
14
+ * the operator named was the bug. While this process remembers the previous
15
+ * apply, a block whose name changed keeps it, and the stamped device write is
16
+ * retried (`nameOwed`) until it lands. `setName` does not update the live
17
+ * handle, so the handle still showing the old name after that write is stale,
18
+ * not a newer device-page rename. A device-page rename whose block write
19
+ * failed is repaired on the restart that rebuilds the handle from the row.
20
+ */
21
+ export type ComposedNameAuthority = "device" | "block";
22
+ export interface RememberedCompositionName {
23
+ /** The name the previous apply decided. Null when that row's name was unreadable. */
24
+ readonly appliedName: string | null;
25
+ /** The block name at the previous apply. Null when that row's name was unreadable. */
26
+ readonly blockName: string | null;
27
+ /** A block name whose device write has not landed yet. */
28
+ readonly nameOwed: string | null;
29
+ }
30
+ export declare function composedNameAuthority(deviceName: string, blockName: string, remembered: RememberedCompositionName | null): ComposedNameAuthority;