@camstack/server 1.2.840 → 1.2.842

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 (111) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/api/oauth2/oauth2-routes.js +50 -6
  3. package/dist/api/trpc/generated-cap-routers.js +16 -0
  4. package/dist/core/addon/addon-registry.service.js +4 -0
  5. package/dist/core/addon/addon-route-request.js +18 -0
  6. package/dist/main.js +8 -5
  7. package/package.json +16 -8
  8. package/system/dist/addon-routes/addon-route-registry.d.ts +27 -1
  9. package/system/dist/addon-runner.js +7 -3
  10. package/system/dist/addon-runner.mjs +7 -3
  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/composer.addon.js +5 -5
  26. package/system/dist/builtins/composer/composer.addon.mjs +5 -5
  27. package/system/dist/builtins/console-logging/index.js +1 -1
  28. package/system/dist/builtins/console-logging/index.mjs +1 -1
  29. package/system/dist/builtins/core-blocks/composition-api.d.ts +2 -2
  30. package/system/dist/builtins/core-blocks/composition-sources.d.ts +9 -2
  31. package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +2 -0
  32. package/system/dist/builtins/core-blocks/core-blocks.addon.js +598 -395
  33. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +598 -395
  34. package/system/dist/builtins/core-blocks/fan-link-forward.d.ts +42 -0
  35. package/system/dist/builtins/core-blocks/fan-presets-service.d.ts +25 -39
  36. package/system/dist/builtins/core-blocks/fan-presets-wiring.d.ts +5 -3
  37. package/system/dist/builtins/core-blocks/migrations/helper-to-customize.d.ts +3 -1
  38. package/system/dist/builtins/core-blocks/power-source-service.d.ts +2 -0
  39. package/system/dist/builtins/core-blocks/timed-run/timed-run-service.d.ts +8 -2
  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-bindings-store.d.ts +8 -5
  43. package/system/dist/builtins/device-manager/device-manager.addon.js +116 -22
  44. package/system/dist/builtins/device-manager/device-manager.addon.mjs +116 -22
  45. package/system/dist/builtins/device-manager/device-row-store.d.ts +0 -52
  46. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  47. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  48. package/system/dist/builtins/keychain/index.js +4 -4
  49. package/system/dist/builtins/keychain/index.mjs +4 -4
  50. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  51. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  52. package/system/dist/builtins/local-auth/local-auth.addon.js +21 -7
  53. package/system/dist/builtins/local-auth/local-auth.addon.mjs +21 -7
  54. package/system/dist/builtins/local-auth/oauth-grants.d.ts +9 -1
  55. package/system/dist/builtins/local-auth/oauth-session-manager.d.ts +8 -0
  56. package/system/dist/builtins/local-auth/record-kinds.d.ts +2 -0
  57. package/system/dist/builtins/local-network/local-network.addon.js +3 -3
  58. package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
  59. package/system/dist/builtins/loki-logging/index.js +1 -1
  60. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  61. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  62. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  63. package/system/dist/builtins/platform-probe/index.js +1 -1
  64. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  65. package/system/dist/builtins/record-entries/index.js +1 -1
  66. package/system/dist/builtins/record-entries/index.mjs +1 -1
  67. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  68. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  69. package/system/dist/builtins/snapshot/index.js +1 -1
  70. package/system/dist/builtins/snapshot/index.mjs +1 -1
  71. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  72. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  73. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  74. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  75. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  76. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  77. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  78. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  79. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  80. package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
  81. package/system/dist/builtins/winston-logging/index.js +1 -1
  82. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  83. package/system/dist/{capture-engine-7E2O4-UN.js → capture-engine-DSrJUGYs.js} +1 -1
  84. package/system/dist/{capture-engine-B5IBWIRT.mjs → capture-engine-DySELkE_.mjs} +1 -1
  85. package/system/dist/{composition-sources-DLtc8lSL.js → composition-sources-CNfFz3Cz.js} +32 -5
  86. package/system/dist/{composition-sources-Cfqn4cly.mjs → composition-sources-DZ4E9FFU.mjs} +32 -5
  87. package/system/dist/{constants-DjsgCnZk.mjs → constants-BEXN_b1Y.mjs} +1 -1
  88. package/system/dist/{constants-Cc70YreG.js → constants-DkgFDCQ7.js} +1 -1
  89. package/system/dist/{device-ca-CVP5h3u1.mjs → device-ca-Dk_9f4MY.mjs} +1 -1
  90. package/system/dist/{device-ca-C6JqeFfK.js → device-ca-sYcSz-Fv.js} +1 -1
  91. package/system/dist/{dist-OmrC_RZs.mjs → dist-4jAoRtpT.mjs} +1700 -363
  92. package/system/dist/{dist-CLnTYKFn.js → dist-LQWK1_M4.js} +1753 -374
  93. package/system/dist/file-host-worker.js +1 -1
  94. package/system/dist/file-host-worker.mjs +1 -1
  95. package/system/dist/{hub-identity-CKQVXf4o.mjs → hub-identity-BxGHDga-.mjs} +1 -1
  96. package/system/dist/{hub-identity-TrZcnJkB.js → hub-identity-haC7V8-b.js} +1 -1
  97. package/system/dist/{hub-mdns-ciao-C8G0K1Z1.mjs → hub-mdns-ciao-Birwi8W5.mjs} +2 -2
  98. package/system/dist/{hub-mdns-ciao-ocg6suyX.js → hub-mdns-ciao-zxNvdRQz.js} +2 -2
  99. package/system/dist/index.d.ts +1 -1
  100. package/system/dist/index.js +63 -13
  101. package/system/dist/index.mjs +62 -14
  102. package/system/dist/kernel/moleculer/child-addon-call-dispatch.d.ts +1 -0
  103. package/system/dist/{legacy-integration-rows-door-BPkJUGaX.mjs → legacy-integration-rows-door-C-hOd-lt.mjs} +1 -1
  104. package/system/dist/{legacy-integration-rows-door-b6CUxtXX.js → legacy-integration-rows-door-CCtcCRjZ.js} +1 -1
  105. package/system/dist/{rename-composition-block-N7lslQJK.js → rename-composition-block-BCZeI3eY.js} +1 -1
  106. package/system/dist/{rename-composition-block-DPlsP1xF.mjs → rename-composition-block-YpAVqp4W.mjs} +1 -1
  107. package/system/dist/{restore-archive-Btc3H-Fg.mjs → restore-archive-BpC3y50e.mjs} +1 -1
  108. package/system/dist/{restore-archive-CcuEoEtj.js → restore-archive-D0Nyukhb.js} +1 -1
  109. package/system/dist/{wal-maintenance-g7yvxLMj.mjs → wal-maintenance-C7jLVFCw.mjs} +0 -0
  110. package/system/dist/{wal-maintenance-B2_uCEi5.js → wal-maintenance-CRiSNk0X.js} +0 -0
  111. package/system/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.842] - 2026-11-12
11
+
12
+ ### Added
13
+
14
+ - An addon route can be declared per instance: the hub serves it at /addon/<addonId>/instances/<instanceId>/<path>, and the address without an instance stays the default one
15
+ - An account can be linked to one instance of an integration: /api/oauth2/authorize takes instance= beside integration=, and the link, its tokens and oauthVerifyAccessToken name the instance
16
+
17
+ ## [1.2.841] - 2026-11-11
18
+
19
+ ### Changed
20
+
21
+ - fan-control gains the setOscillationAxis route.
22
+
10
23
  ## [1.2.840] - 2026-11-11
11
24
 
12
25
  ### Changed
@@ -25,6 +25,7 @@ const private_host_js_1 = require("./private-host.js");
25
25
  const VALUE_SAFE_QUERY_KEYS = [
26
26
  'response_type',
27
27
  'integration',
28
+ 'instance',
28
29
  'code_challenge_method',
29
30
  'client_id',
30
31
  ];
@@ -70,6 +71,36 @@ function describeAuthorizeCall(url, headers, hasSessionCookie) {
70
71
  hasSessionCookie,
71
72
  };
72
73
  }
74
+ /**
75
+ * Resolve the `instance` parameter against what the integration declared.
76
+ *
77
+ * The default instance is `null` here whichever way the caller spelled it
78
+ * (absent, empty, or the addon id), so a link stores ONE spelling of it. It is
79
+ * always accepted: it is the address third parties held before instances
80
+ * existed. Any other id must be one the integration declared.
81
+ */
82
+ function resolveInstanceParam(raw, policy) {
83
+ const values = raw === undefined ? [] : typeof raw === 'string' ? [raw] : raw;
84
+ const distinct = [...new Set(values.filter((v) => v !== ''))];
85
+ if (distinct.length > 1) {
86
+ return {
87
+ ok: false,
88
+ error: 'invalid_request — instance parameter repeated with conflicting values',
89
+ };
90
+ }
91
+ const [value] = distinct;
92
+ if (value === undefined)
93
+ return { ok: true, instance: null };
94
+ if (!(0, types_1.isAddonInstanceId)(value)) {
95
+ return { ok: false, error: 'invalid_request — instance is not a valid id' };
96
+ }
97
+ if (value === policy.addonId)
98
+ return { ok: true, instance: null };
99
+ const declared = (policy.instances ?? []).some((i) => i.id === value);
100
+ if (!declared)
101
+ return { ok: false, error: 'invalid_request — unknown instance' };
102
+ return { ok: true, instance: value };
103
+ }
73
104
  /** Longest caller-supplied `integration` value echoed back in an error. */
74
105
  const MAX_ECHOED_INTEGRATION_LEN = 100;
75
106
  /**
@@ -166,6 +197,9 @@ function validateAuthorizeQuery(q, knownIntegrations, pendingAddons = []) {
166
197
  diagnostics,
167
198
  };
168
199
  }
200
+ const instance = resolveInstanceParam(q.instance, policy);
201
+ if (!instance.ok)
202
+ return { ok: false, status: 400, error: instance.error };
169
203
  if (!q.redirect_uri)
170
204
  return { ok: false, status: 400, error: 'invalid_request — redirect_uri required' };
171
205
  if (!q.state)
@@ -182,6 +216,7 @@ function validateAuthorizeQuery(q, knownIntegrations, pendingAddons = []) {
182
216
  return {
183
217
  ok: true,
184
218
  integration: param.value,
219
+ instance: instance.instance,
185
220
  redirectUri: q.redirect_uri,
186
221
  state: q.state,
187
222
  codeChallenge: challenge,
@@ -320,14 +355,20 @@ function refuseUnauthenticated(request, reply, logger, call, reason) {
320
355
  async function readIntegrationRegistry(registry) {
321
356
  const entries = registry.getCollectionEntries('oauth-integration');
322
357
  const descriptors = new Map();
323
- for (const [, provider] of entries) {
358
+ const policies = new Map();
359
+ for (const [addonId, provider] of entries) {
324
360
  const descriptor = await provider.getDescriptor();
325
361
  descriptors.set(descriptor.integrationId, descriptor);
362
+ policies.set(descriptor.integrationId, {
363
+ addonId,
364
+ ...(descriptor.requiresPkce !== undefined ? { requiresPkce: descriptor.requiresPkce } : {}),
365
+ ...(descriptor.instances !== undefined ? { instances: descriptor.instances } : {}),
366
+ });
326
367
  }
327
368
  const pendingAddons = registry
328
369
  .getManifestDeclarers('oauth-integration')
329
370
  .filter((addonId) => !registry.hasProvider('oauth-integration', addonId));
330
- return { descriptors, pendingAddons };
371
+ return { descriptors, policies, pendingAddons };
331
372
  }
332
373
  function registerOauth2Routes(fastify, deps) {
333
374
  // Form bodies (consent POST, token POST): parsed object for these routes, raw
@@ -352,9 +393,9 @@ function registerOauth2Routes(fastify, deps) {
352
393
  if (!registry) {
353
394
  return answerRefusal(request, reply, 503, { error: 'service_unavailable' }, 'unavailable');
354
395
  }
355
- const { descriptors, pendingAddons } = await readIntegrationRegistry(registry);
396
+ const { descriptors, policies, pendingAddons } = await readIntegrationRegistry(registry);
356
397
  const query = request.query;
357
- const v = validateAuthorizeQuery(query, descriptors, pendingAddons);
398
+ const v = validateAuthorizeQuery(query, policies, pendingAddons);
358
399
  if (!v.ok) {
359
400
  return refuseAuthorize(request, reply, deps.logger, 'GET', call, v);
360
401
  }
@@ -387,6 +428,7 @@ function registerOauth2Routes(fastify, deps) {
387
428
  redirectUri: v.redirectUri,
388
429
  hidden: {
389
430
  integration: v.integration,
431
+ ...(v.instance !== null ? { instance: v.instance } : {}),
390
432
  redirect_uri: v.redirectUri,
391
433
  state: v.state,
392
434
  response_type: 'code',
@@ -448,11 +490,12 @@ function registerOauth2Routes(fastify, deps) {
448
490
  if (!registry) {
449
491
  return answerRefusal(request, reply, 503, { error: 'service_unavailable' }, 'unavailable');
450
492
  }
451
- const { descriptors, pendingAddons } = await readIntegrationRegistry(registry);
493
+ const { descriptors, policies, pendingAddons } = await readIntegrationRegistry(registry);
452
494
  const body = request.body;
453
495
  const formQuery = {
454
496
  response_type: body.response_type,
455
497
  integration: body.integration,
498
+ instance: body.instance,
456
499
  redirect_uri: body.redirect_uri,
457
500
  state: body.state,
458
501
  code_challenge: body.code_challenge,
@@ -460,7 +503,7 @@ function registerOauth2Routes(fastify, deps) {
460
503
  };
461
504
  // Re-validated, not trusted: the hidden fields came back from a browser
462
505
  // and every one of them is attacker-editable.
463
- const v = validateAuthorizeQuery(formQuery, descriptors, pendingAddons);
506
+ const v = validateAuthorizeQuery(formQuery, policies, pendingAddons);
464
507
  if (!v.ok) {
465
508
  return refuseAuthorize(request, reply, deps.logger, 'POST', call, v);
466
509
  }
@@ -487,6 +530,7 @@ function registerOauth2Routes(fastify, deps) {
487
530
  }
488
531
  const { code } = await userMgmt.oauthIssueCode({
489
532
  integrationId: v.integration,
533
+ ...(v.instance !== null ? { instanceId: v.instance } : {}),
490
534
  userId: tokenInfo.userId,
491
535
  username: tokenInfo.username,
492
536
  scopes: descriptor.requestedScopes,
@@ -5242,6 +5242,22 @@ function createCapRouter_fanControl(getProvider, createRemoteProxy) {
5242
5242
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
5243
5243
  return fn.call(p, methodInput);
5244
5244
  }),
5245
+ setOscillationAxis: trpc_middleware_js_1.protectedProcedure
5246
+ .input(types_66.fanControlCapability.methods.setOscillationAxis.input.loose())
5247
+ .output(types_66.fanControlCapability.methods.setOscillationAxis.output)
5248
+ .mutation(async ({ input, ctx }) => {
5249
+ const { nodeId, ...methodInput } = input;
5250
+ const p = resolveProvider('fan-control', nodeId, () => getProvider(ctx), createRemoteProxy);
5251
+ const fn = p.setOscillationAxis;
5252
+ if (typeof fn !== 'function') {
5253
+ throw new server_1.TRPCError({
5254
+ code: 'NOT_IMPLEMENTED',
5255
+ message: 'Capability "fan-control" provider does not implement "setOscillationAxis"',
5256
+ });
5257
+ }
5258
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
5259
+ return fn.call(p, methodInput);
5260
+ }),
5245
5261
  });
5246
5262
  }
5247
5263
  function createCapRouter_fanPresets(getProvider, createRemoteProxy) {
@@ -37,6 +37,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.AddonRegistryService = void 0;
38
38
  exports.shouldEvictMissingOnDisk = shouldEvictMissingOnDisk;
39
39
  exports.addonUpdatePayload = addonUpdatePayload;
40
+ exports.parseSerializableRouteDescriptors = parseSerializableRouteDescriptors;
40
41
  exports.parseDataPlaneEndpoints = parseDataPlaneEndpoints;
41
42
  exports.shouldEmitProviderRegisteredReady = shouldEmitProviderRegisteredReady;
42
43
  const addon_process_view_js_1 = require("./addon-process-view.js");
@@ -190,6 +191,7 @@ function parseSerializableRouteDescriptors(raw) {
190
191
  access: asRouteAccess(Reflect.get(entry, 'access')),
191
192
  ...(typeof description === 'string' ? { description } : {}),
192
193
  ...(rateLimit !== undefined ? { rateLimit } : {}),
194
+ ...(Reflect.get(entry, 'perInstance') === true ? { perInstance: true } : {}),
193
195
  };
194
196
  });
195
197
  }
@@ -2917,6 +2919,7 @@ class AddonRegistryService {
2917
2919
  access: route.access,
2918
2920
  ...(route.description !== undefined ? { description: route.description } : {}),
2919
2921
  ...(route.rateLimit !== undefined ? { rateLimit: route.rateLimit } : {}),
2922
+ ...(route.perInstance === true ? { perInstance: true } : {}),
2920
2923
  handler: async (req, reply) => {
2921
2924
  const envelope = await invoker.invoke({
2922
2925
  method: route.method,
@@ -2927,6 +2930,7 @@ class AddonRegistryService {
2927
2930
  query: req.query,
2928
2931
  body: req.body,
2929
2932
  headers: req.headers,
2933
+ ...(req.instanceId !== undefined ? { instanceId: req.instanceId } : {}),
2930
2934
  ...(req.user ? { user: req.user } : {}),
2931
2935
  ...(req.scopedToken !== undefined ? { scopedToken: req.scopedToken } : {}),
2932
2936
  });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildAddonRouteRequest = buildAddonRouteRequest;
4
+ /**
5
+ * The request an addon route handler receives. One builder for the public and
6
+ * the authenticated branch of the catch-all, so the instance the registry
7
+ * resolved reaches the handler on both.
8
+ */
9
+ function buildAddonRouteRequest(input) {
10
+ return {
11
+ params: input.params,
12
+ query: input.query,
13
+ body: input.body,
14
+ headers: input.headers,
15
+ ...(input.instanceId !== undefined ? { instanceId: input.instanceId } : {}),
16
+ ...input.caller,
17
+ };
18
+ }
package/dist/main.js CHANGED
@@ -96,6 +96,7 @@ const trpc_error_principal_1 = require("./api/trpc/trpc-error-principal");
96
96
  const ws_request_census_1 = require("./api/trpc/ws-request-census");
97
97
  const ws_slow_consumer_guard_js_1 = require("./api/trpc/ws-slow-consumer-guard.js");
98
98
  const addon_route_auth_js_1 = require("./auth/addon-route-auth.js");
99
+ const addon_route_request_js_1 = require("./core/addon/addon-route-request.js");
99
100
  const addon_route_share_gate_js_1 = require("./auth/addon-route-share-gate.js");
100
101
  const auth_network_policy_js_1 = require("./auth/auth-network-policy.js");
101
102
  const hub_sessions_js_1 = require("./auth/hub-sessions.js");
@@ -1220,23 +1221,25 @@ async function bootstrap() {
1220
1221
  return reply.status(auth.status).send({ error: auth.error });
1221
1222
  // NOTE: the handler call used to sit INSIDE the JWT try, so a throw
1222
1223
  // from an addon's own route handler was reported as `401 Invalid token`.
1223
- const addonRequest = {
1224
+ const addonRequest = (0, addon_route_request_js_1.buildAddonRouteRequest)({
1224
1225
  params: match.params,
1225
1226
  query,
1226
1227
  body: request.body,
1227
1228
  headers,
1228
- ...(0, addon_route_auth_js_1.addonRouteCaller)(auth.principal),
1229
- };
1229
+ instanceId: match.instanceId,
1230
+ caller: (0, addon_route_auth_js_1.addonRouteCaller)(auth.principal),
1231
+ });
1230
1232
  const addonReply = buildAddonReply(reply);
1231
1233
  return match.route.handler(addonRequest, addonReply);
1232
1234
  }
1233
1235
  // Public route — no auth required
1234
- const addonRequest = {
1236
+ const addonRequest = (0, addon_route_request_js_1.buildAddonRouteRequest)({
1235
1237
  params: match.params,
1236
1238
  query,
1237
1239
  body: request.body,
1238
1240
  headers,
1239
- };
1241
+ instanceId: match.instanceId,
1242
+ });
1240
1243
  const addonReply = buildAddonReply(reply);
1241
1244
  return match.route.handler(addonRequest, addonReply);
1242
1245
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.840",
3
+ "version": "1.2.842",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -66,8 +66,16 @@
66
66
  ],
67
67
  "requires": {
68
68
  "addons": {
69
- "@camstack/addon-pipeline-orchestrator": ">=1.2.681",
70
- "@camstack/addon-provider-reolink": ">=1.2.239"
69
+ "@camstack/addon-admin-ui": ">=1.2.646",
70
+ "@camstack/addon-agent-ui": ">=1.2.367",
71
+ "@camstack/addon-matter-broker": ">=0.2.168",
72
+ "@camstack/addon-post-analysis": ">=1.2.694",
73
+ "@camstack/addon-provider-bosch": ">=0.1.53",
74
+ "@camstack/addon-provider-esphome": ">=0.1.19",
75
+ "@camstack/addon-provider-homeassistant": ">=1.2.681",
76
+ "@camstack/addon-provider-homematic": ">=1.2.191",
77
+ "@camstack/addon-provider-mqtt-ha": ">=0.1.46",
78
+ "@camstack/addon-provider-unraid": ">=0.2.164"
71
79
  },
72
80
  "wrapper": {
73
81
  "desktop": ">=0.0.1",
@@ -76,19 +84,19 @@
76
84
  }
77
85
  },
78
86
  "dependencies": {
79
- "@camstack/addon-admin-ui": "1.2.644",
80
- "@camstack/addon-agent-ui": "1.2.365",
87
+ "@camstack/addon-admin-ui": "1.2.646",
88
+ "@camstack/addon-agent-ui": "1.2.367",
81
89
  "@camstack/addon-auth": "1.2.182",
82
90
  "@camstack/addon-benchmark": "1.2.313",
83
91
  "@camstack/addon-decoder-nodeav": "1.2.149",
84
92
  "@camstack/addon-notifiers": "1.2.637",
85
93
  "@camstack/addon-pipeline": "1.2.650",
86
94
  "@camstack/addon-pipeline-orchestrator": "1.2.681",
87
- "@camstack/addon-post-analysis": "1.2.693",
95
+ "@camstack/addon-post-analysis": "1.2.694",
88
96
  "@camstack/develop": "0.1.52",
89
97
  "@camstack/sdk": "1.2.157",
90
- "@camstack/types": "1.2.548",
91
- "@camstack/ui-library": "1.2.425",
98
+ "@camstack/types": "1.2.550",
99
+ "@camstack/ui-library": "1.2.427",
92
100
  "@fastify/compress": "^9.0.0",
93
101
  "@fastify/cookie": "^11.0.2",
94
102
  "@fastify/cors": "^11.2.0",
@@ -1,10 +1,35 @@
1
- import type { IAddonHttpRoute, IAddonRouteProvider } from "@camstack/types";
1
+ import { type IAddonHttpRoute, type IAddonRouteProvider } from "@camstack/types";
2
2
  interface RouteMatch {
3
3
  readonly route: IAddonHttpRoute;
4
4
  readonly addonId: string;
5
5
  readonly params: Record<string, string>;
6
+ /**
7
+ * The instance a `perInstance` route was asked for: the path's instance
8
+ * segment, or the addon id (the default instance) when the path has none.
9
+ * Absent for a route that is not per-instance.
10
+ */
11
+ readonly instanceId?: string;
12
+ }
13
+ /** The path segment that introduces an instance id: `/addon/<addonId>/instances/<instanceId>/…`. */
14
+ export declare const ADDON_INSTANCE_SEGMENT = "instances";
15
+ /** A request path read as "this addon, this instance, this route path". */
16
+ export interface AddonInstancePath {
17
+ readonly instanceId: string;
18
+ /** The same path with the instance segment removed: `/addon/<addonId>/<rest>`. */
19
+ readonly routePath: string;
6
20
  }
7
21
  /**
22
+ * The ONE reading of an instance in an addon path (planning#415).
23
+ * `/addon/<addonId>/instances/<instanceId>/<rest>` names that instance; any
24
+ * other path under the addon names the default instance, whose id is the
25
+ * addon id. The form without the segment is permanent: it is the address
26
+ * third parties hold for the default instance.
27
+ *
28
+ * `null` when the path is not under this addon, or carries an instance
29
+ * segment whose id is not a plain id.
30
+ */
31
+ export declare function resolveAddonInstancePath(addonId: string, path: string): AddonInstancePath | null;
32
+ /**
8
33
  * Registry for dynamic HTTP routes registered by addons.
9
34
  * Framework-agnostic — the server HTTP layer queries this registry to dispatch requests.
10
35
  */
@@ -32,6 +57,7 @@ export declare class AddonRouteRegistry {
32
57
  path: string;
33
58
  access: string;
34
59
  description?: string;
60
+ perInstance?: boolean;
35
61
  }>;
36
62
  }
37
63
  export {};
@@ -6429,9 +6429,9 @@ function createBrokerDeviceManagerApi(opts) {
6429
6429
  linkDeviceId,
6430
6430
  ...isFirstSpawn && spec.meta.name !== void 0 ? { name: spec.meta.name } : {},
6431
6431
  ...isFirstSpawn && spec.meta.location !== void 0 ? { location: spec.meta.location } : {},
6432
+ ...(isFirstSpawn || existingMeta?.role == null) && spec.meta.role !== void 0 ? { role: spec.meta.role } : {},
6432
6433
  ...spec.meta.type !== void 0 ? { type: spec.meta.type } : {},
6433
- ...integrationId !== void 0 ? { integrationId } : {},
6434
- ...spec.meta.role !== void 0 ? { role: spec.meta.role } : {}
6434
+ ...integrationId !== void 0 ? { integrationId } : {}
6435
6435
  }).catch((err) => {
6436
6436
  opts.logger.warn("spawnAccessoryChild: applyInitialMeta pre-seed failed", {
6437
6437
  tags: {
@@ -6717,6 +6717,7 @@ function createBrokerDeviceManagerApi(opts) {
6717
6717
  type: device.type,
6718
6718
  name: device.name,
6719
6719
  parentDeviceId: device.parentDeviceId,
6720
+ ...device.role !== void 0 ? { role: device.role } : {},
6720
6721
  features: [...device.features],
6721
6722
  config: {},
6722
6723
  secretConfigPaths: declaredSecretConfigPaths(device)
@@ -6738,6 +6739,7 @@ function createBrokerDeviceManagerApi(opts) {
6738
6739
  type: device.type,
6739
6740
  name: device.name,
6740
6741
  parentDeviceId: device.parentDeviceId,
6742
+ ...device.role !== void 0 ? { role: device.role } : {},
6741
6743
  features: [...device.features],
6742
6744
  config: {},
6743
6745
  secretConfigPaths: declaredSecretConfigPaths(device)
@@ -11492,12 +11494,14 @@ function toSerializableRoute(route) {
11492
11494
  const access = route["access"];
11493
11495
  const description = route["description"];
11494
11496
  const rateLimit = route["rateLimit"];
11497
+ const perInstance = route["perInstance"];
11495
11498
  return {
11496
11499
  method,
11497
11500
  path,
11498
11501
  ...typeof access === "string" ? { access } : {},
11499
11502
  ...typeof description === "string" ? { description } : {},
11500
- ...typeof rateLimit === "string" ? { rateLimit } : {}
11503
+ ...typeof rateLimit === "string" ? { rateLimit } : {},
11504
+ ...perInstance === true ? { perInstance } : {}
11501
11505
  };
11502
11506
  }
11503
11507
  /** A scoped-settings call names its scope and capability; a call without them is a bug. */
@@ -6374,9 +6374,9 @@ function createBrokerDeviceManagerApi(opts) {
6374
6374
  linkDeviceId,
6375
6375
  ...isFirstSpawn && spec.meta.name !== void 0 ? { name: spec.meta.name } : {},
6376
6376
  ...isFirstSpawn && spec.meta.location !== void 0 ? { location: spec.meta.location } : {},
6377
+ ...(isFirstSpawn || existingMeta?.role == null) && spec.meta.role !== void 0 ? { role: spec.meta.role } : {},
6377
6378
  ...spec.meta.type !== void 0 ? { type: spec.meta.type } : {},
6378
- ...integrationId !== void 0 ? { integrationId } : {},
6379
- ...spec.meta.role !== void 0 ? { role: spec.meta.role } : {}
6379
+ ...integrationId !== void 0 ? { integrationId } : {}
6380
6380
  }).catch((err) => {
6381
6381
  opts.logger.warn("spawnAccessoryChild: applyInitialMeta pre-seed failed", {
6382
6382
  tags: {
@@ -6662,6 +6662,7 @@ function createBrokerDeviceManagerApi(opts) {
6662
6662
  type: device.type,
6663
6663
  name: device.name,
6664
6664
  parentDeviceId: device.parentDeviceId,
6665
+ ...device.role !== void 0 ? { role: device.role } : {},
6665
6666
  features: [...device.features],
6666
6667
  config: {},
6667
6668
  secretConfigPaths: declaredSecretConfigPaths(device)
@@ -6683,6 +6684,7 @@ function createBrokerDeviceManagerApi(opts) {
6683
6684
  type: device.type,
6684
6685
  name: device.name,
6685
6686
  parentDeviceId: device.parentDeviceId,
6687
+ ...device.role !== void 0 ? { role: device.role } : {},
6686
6688
  features: [...device.features],
6687
6689
  config: {},
6688
6690
  secretConfigPaths: declaredSecretConfigPaths(device)
@@ -11437,12 +11439,14 @@ function toSerializableRoute(route) {
11437
11439
  const access = route["access"];
11438
11440
  const description = route["description"];
11439
11441
  const rateLimit = route["rateLimit"];
11442
+ const perInstance = route["perInstance"];
11440
11443
  return {
11441
11444
  method,
11442
11445
  path,
11443
11446
  ...typeof access === "string" ? { access } : {},
11444
11447
  ...typeof description === "string" ? { description } : {},
11445
- ...typeof rateLimit === "string" ? { rateLimit } : {}
11448
+ ...typeof rateLimit === "string" ? { rateLimit } : {},
11449
+ ...perInstance === true ? { perInstance } : {}
11446
11450
  };
11447
11451
  }
11448
11452
  /** A scoped-settings call names its scope and capability; a call without them is a bug. */
@@ -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-CLnTYKFn.js");
6
+ const require_dist = require("../../dist-LQWK1_M4.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 { hl as EventCategory, hs as BaseAddon, pl as errMsg, yn as addonPagesCapability } from "../../dist-OmrC_RZs.mjs";
1
+ import { Sl as EventCategory, Ss as BaseAddon, bl as errMsg, bn as addonPagesCapability } from "../../dist-4jAoRtpT.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-CLnTYKFn.js");
6
+ const require_dist = require("../../dist-LQWK1_M4.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 { hl as EventCategory, hs as BaseAddon, pl as errMsg, xn as addonWidgetsCapability } from "../../dist-OmrC_RZs.mjs";
1
+ import { Sl as EventCategory, Sn as addonWidgetsCapability, Ss as BaseAddon, bl as errMsg } from "../../dist-4jAoRtpT.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-CLnTYKFn.js");
6
+ const require_dist = require("../../dist-LQWK1_M4.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 { Cn as alertEpisodePayload, Sn as alertEpisodeId, T as CORE_BLOCK_ADDON_PREFIX, dc as createEvent, gc as defineRecordKinds, hl as EventCategory, hs as BaseAddon, ni as isAlertEpisodeOpen, p as AlertSchema, pl as errMsg, ri as isAlertEpisodeSeverity, wn as alertsCapability } from "../../dist-OmrC_RZs.mjs";
1
+ import { Cc as defineRecordKinds, Cn as alertEpisodeId, Sl as EventCategory, Ss as BaseAddon, T as CORE_BLOCK_ADDON_PREFIX, Tn as alertsCapability, bl as errMsg, ci as isAlertEpisodeOpen, li as isAlertEpisodeSeverity, p as AlertSchema, vc as createEvent, wn as alertEpisodePayload } from "../../dist-4jAoRtpT.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-CLnTYKFn.js");
6
+ const require_dist = require("../../dist-LQWK1_M4.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 { hl as EventCategory, hs as BaseAddon, kc as isEvent, kn as bareAddonId, lt as FIRST_LEVEL_MACRO_CLASSES, pa as ptzAutotrackCapability, pl as errMsg } from "../../dist-OmrC_RZs.mjs";
1
+ import { An as bareAddonId, Ic as isEvent, Sl as EventCategory, Ss as BaseAddon, ba as ptzAutotrackCapability, bl as errMsg, ut as FIRST_LEVEL_MACRO_CLASSES } from "../../dist-4jAoRtpT.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-CLnTYKFn.js");
6
+ const require_dist = require("../../dist-LQWK1_M4.js");
7
7
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
8
- const require_restore_archive = require("../../restore-archive-CcuEoEtj.js");
8
+ const require_restore_archive = require("../../restore-archive-D0Nyukhb.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 { Ai as mayWriteToLocation, On as backupCapability, Vc as nodePin, hl as EventCategory, hs as BaseAddon, rl as toNodeId, so as storageOccupancyCapability } from "../../dist-OmrC_RZs.mjs";
1
+ import { Ii as mayWriteToLocation, Jc as nodePin, Sl as EventCategory, Ss as BaseAddon, kn as backupCapability, mo as storageOccupancyCapability, ul as toNodeId } from "../../dist-4jAoRtpT.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-Btc3H-Fg.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-BpC3y50e.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-CLnTYKFn.js");
6
+ const require_dist = require("../../dist-LQWK1_M4.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 { D as CalendarPreferencesSchema, Rn as calendarsCapability, gc as defineRecordKinds, hs as BaseAddon } from "../../dist-OmrC_RZs.mjs";
1
+ import { Cc as defineRecordKinds, D as CalendarPreferencesSchema, Ss as BaseAddon, zn as calendarsCapability } from "../../dist-4jAoRtpT.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-CLnTYKFn.js");
6
+ const require_dist = require("../../dist-LQWK1_M4.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 { $r as integrationInstancesCapability, Ac as isInstanceEnabled, At as MOTION_CLOSE_AFTER_MS, B as DERIVED_CAMERA_SILENCED_CAP_NAMES, Ni as memoizePinnedFfmpeg, Tc as hydrateSchema, Uo as buildFfmpegArgs, dc as createEvent, et as DeclaredDevices, fl as DeviceType, fr as declarationOwnerNodeId, g as BaseDevice, hc as defineEntryKind, hl as EventCategory, hs as BaseAddon, kn as bareAddonId, lo as streamCatalogCapability, pl as errMsg, to as snapshotCapability, ul as DeviceFeature, zi as motionCapability, zn as cameraGridLayoutCapability, zs as RecordIntegrationInstances } from "../../dist-OmrC_RZs.mjs";
1
+ import { $ as DeclaredDevices, An as bareAddonId, Bn as cameraGridLayoutCapability, Gi as motionCapability, Ks as RecordIntegrationInstances, Lc as isInstanceEnabled, Mc as hydrateSchema, Sc as defineEntryKind, Sl as EventCategory, Ss as BaseAddon, Xo as buildFfmpegArgs, _l as DeviceFeature, bl as errMsg, co as snapshotCapability, g as BaseDevice, go as streamCatalogCapability, gr as declarationOwnerNodeId, ii as integrationInstancesCapability, jt as MOTION_CLOSE_AFTER_MS, vc as createEvent, yl as DeviceType, z as DERIVED_CAMERA_SILENCED_CAP_NAMES, zi as memoizePinnedFfmpeg } from "../../dist-4jAoRtpT.mjs";
2
2
  import { z } from "zod";
3
3
  import { createHash } from "node:crypto";
4
4
  import { FfmpegProcess } from "@camstack/types/node";
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CLnTYKFn.js");
7
- const require_composition_sources = require("../../composition-sources-DLtc8lSL.js");
8
- const require_capture_engine = require("../../capture-engine-7E2O4-UN.js");
6
+ const require_dist = require("../../dist-LQWK1_M4.js");
7
+ const require_composition_sources = require("../../composition-sources-CNfFz3Cz.js");
8
+ const require_capture_engine = require("../../capture-engine-DSrJUGYs.js");
9
9
  const require_retention = require("../../retention-BcOSL6b9.js");
10
- const require_rename_composition_block = require("../../rename-composition-block-N7lslQJK.js");
10
+ const require_rename_composition_block = require("../../rename-composition-block-BCZeI3eY.js");
11
11
  let zod = require("zod");
12
12
  //#region src/builtins/composer/actuator-invoke.ts
13
13
  /**
@@ -121,7 +121,6 @@ var GROUP_COMMAND_TYPES = new Set([
121
121
  require_dist.DeviceType.Valve,
122
122
  require_dist.DeviceType.Lock,
123
123
  require_dist.DeviceType.MediaPlayer,
124
- require_dist.DeviceType.Thermostat,
125
124
  require_dist.DeviceType.Climate
126
125
  ]);
127
126
  /** A call's arguments without the keys the caller left undefined. */
@@ -2317,6 +2316,7 @@ function evaluateFields(host, keys, now, timerDriven = false) {
2317
2316
  source: record.plan.source,
2318
2317
  read,
2319
2318
  now,
2319
+ targetKind: record.plan.kind,
2320
2320
  stateful: {
2321
2321
  currentOutput: currentOutput(record),
2322
2322
  expressionMemory: candidateMemory,