@camstack/server 1.2.743 → 1.2.744

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 (94) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/agent/main.js +4 -2
  3. package/package.json +4 -6
  4. package/system/dist/addon-runner.js +145 -76
  5. package/system/dist/addon-runner.mjs +145 -76
  6. package/system/dist/{agent-https-CTLbLv1Z.js → agent-https-BcxBTl03.js} +1 -1
  7. package/system/dist/{agent-https-BXFwvxco.mjs → agent-https-zLZqE2uf.mjs} +1 -1
  8. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  9. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  10. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  11. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  12. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  13. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  14. package/system/dist/builtins/autotrack/index.js +1 -1
  15. package/system/dist/builtins/autotrack/index.mjs +1 -1
  16. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  17. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  18. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  19. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  20. package/system/dist/builtins/camera-grid/index.js +1 -1
  21. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  22. package/system/dist/builtins/composer/composer.addon.js +3 -3
  23. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  24. package/system/dist/builtins/console-logging/index.js +1 -1
  25. package/system/dist/builtins/console-logging/index.mjs +1 -1
  26. package/system/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  27. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  28. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  29. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  30. package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
  31. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  32. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  33. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  34. package/system/dist/builtins/keychain/index.js +3 -3
  35. package/system/dist/builtins/keychain/index.mjs +3 -3
  36. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  37. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  38. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  39. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  40. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  41. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  42. package/system/dist/builtins/loki-logging/index.js +1 -1
  43. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  44. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  45. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  46. package/system/dist/builtins/platform-probe/index.js +1 -1
  47. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  48. package/system/dist/builtins/record-entries/index.js +1 -1
  49. package/system/dist/builtins/record-entries/index.mjs +1 -1
  50. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  51. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  52. package/system/dist/builtins/snapshot/index.js +1 -1
  53. package/system/dist/builtins/snapshot/index.mjs +1 -1
  54. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  55. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  56. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  57. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  58. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
  59. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
  60. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  61. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  62. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  63. package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
  64. package/system/dist/builtins/winston-logging/index.js +1 -1
  65. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  66. package/system/dist/{composition-sources-T2lA4x2c.js → composition-sources-B8hXkZdd.js} +1 -1
  67. package/system/dist/{composition-sources-BsdQWUId.mjs → composition-sources-Bc_D8LR5.mjs} +1 -1
  68. package/system/dist/{constants-3SpeBQ9e.mjs → constants-CBAenEIc.mjs} +1 -1
  69. package/system/dist/{constants-BrhaiRkm.js → constants-oztBWIpa.js} +1 -1
  70. package/system/dist/{device-ca-BCeNjQxi.js → device-ca-C5TjvqyB.js} +1 -1
  71. package/system/dist/{device-ca-Dp9VZmay.mjs → device-ca-DgEn-SoG.mjs} +1 -1
  72. package/system/dist/{dist-hoy7lFFU.js → dist-B0zmp3zn.js} +18 -2
  73. package/system/dist/{dist-CYQNDx7D.mjs → dist-Cdz0_zxq.mjs} +18 -2
  74. package/system/dist/file-host-worker.js +1 -1
  75. package/system/dist/file-host-worker.mjs +1 -1
  76. package/system/dist/{hub-mdns-ciao-Btg3hLbv.js → hub-mdns-ciao-DM_nVIFe.js} +2 -2
  77. package/system/dist/{hub-mdns-ciao-Bmgiu2PS.mjs → hub-mdns-ciao-nWSv_w8h.mjs} +2 -2
  78. package/system/dist/index.js +73 -11
  79. package/system/dist/index.mjs +73 -12
  80. package/system/dist/kernel/moleculer/runner-init-loop.d.ts +25 -0
  81. package/system/dist/kernel/transport/acting-addon.d.ts +17 -0
  82. package/system/dist/kernel/transport/child-cap-protocol.d.ts +12 -0
  83. package/system/dist/kernel/transport/index.d.ts +1 -0
  84. package/system/dist/kernel/transport/local-child-client.d.ts +2 -2
  85. package/system/dist/kernel/transport/local-child-registry.d.ts +7 -0
  86. package/system/dist/kernel/transport/runner-of-addon.d.ts +11 -0
  87. package/system/dist/migrations/hub/2026-11-02-records-owner-group-to-addon.d.ts +11 -0
  88. package/system/dist/{restore-archive-NPXKTdgW.js → restore-archive-CS-DPZ3U.js} +1 -1
  89. package/system/dist/{restore-archive-Da6R2OpB.mjs → restore-archive-gAzBMq-y.mjs} +1 -1
  90. package/system/dist/{retention-YUgpamYA.js → retention-CJ47t_51.js} +1 -1
  91. package/system/dist/{retention-BnRv1V1H.mjs → retention-Cfw9Jeyz.mjs} +1 -1
  92. package/system/dist/{wal-maintenance-B0jahuQG.js → wal-maintenance-BqyLi3Ko.js} +0 -0
  93. package/system/dist/{wal-maintenance-pDyTGZ-n.mjs → wal-maintenance-D8QmKPOV.mjs} +0 -0
  94. package/system/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ import type { RunnerRefusalReport } from "./runner-refusal.js";
2
+ export interface RunnerInitEntry {
3
+ readonly spec: {
4
+ readonly addonId: string;
5
+ };
6
+ }
7
+ export interface BlockedAddon {
8
+ readonly addonId: string;
9
+ readonly migrationIds: readonly string[];
10
+ }
11
+ export interface RunnerInitPorts<E extends RunnerInitEntry> {
12
+ /** Initialise one addon; throws what its `initialize()` threw. */
13
+ init(entry: E): Promise<void>;
14
+ /** Say that an addon is blocked by its migrations (the caller logs with `tags: { addonId }`). */
15
+ blocked(addonId: string, migrationIds: readonly string[]): void;
16
+ /** An init failure that is not a blocked-migrations one: reports it and exits. */
17
+ fatal(entry: E, err: unknown): never;
18
+ }
19
+ export interface RunnerInitResult {
20
+ readonly initialised: number;
21
+ readonly blocked: readonly BlockedAddon[];
22
+ }
23
+ export declare function runAddonInits<E extends RunnerInitEntry>(entries: readonly E[], ports: RunnerInitPorts<E>): Promise<RunnerInitResult>;
24
+ /** The refusal a runner leaves with when every member was blocked; null when none was. */
25
+ export declare function allBlockedRefusal(blocked: readonly BlockedAddon[]): RunnerRefusalReport | null;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The addon a grouped child acts for (the records owner).
3
+ *
4
+ * A grouped runner is stamped with its GROUP id by the transport, and the group can change when
5
+ * the grouping does; the data of the caps below is keyed by the ADDON, which never changes. The
6
+ * child therefore claims the addon it acts for, and the parent checks the claim against its own
7
+ * runner map before it stamps the call with it.
8
+ */
9
+ /** The caps whose rows and secret refs are keyed by the calling ADDON, not by its runner. */
10
+ export declare const ADDON_KEYED_CAPS: readonly string[];
11
+ /** A child claimed an addon its runner does not host. Typed so a caller can tell it from a crash. */
12
+ export declare class ActingAddonRefusedError extends Error {
13
+ readonly runnerId: string;
14
+ readonly claimedAddonId: string;
15
+ readonly code = "acting-addon-not-hosted";
16
+ constructor(runnerId: string, claimedAddonId: string);
17
+ }
@@ -89,6 +89,14 @@ export interface CapCallOutMessage {
89
89
  readonly kind: "cap-call-out";
90
90
  readonly capName: string;
91
91
  readonly method: string;
92
+ /**
93
+ * The addon this call acts FOR, claimed by a child that hosts several (a grouped runner is
94
+ * stamped with its group id, which says nothing about WHICH member is calling). The parent
95
+ * trusts it only when its own runner map says this runner hosts that addon, and otherwise
96
+ * refuses the call (`ActingAddonRefusedError`). Used for the caps whose data is keyed by the
97
+ * addon, which never changes, unlike the group (`records`).
98
+ */
99
+ readonly actingAddonId?: string;
92
100
  readonly args?: unknown;
93
101
  readonly hints?: CapRoutingHints;
94
102
  readonly deviceId?: number;
@@ -303,5 +311,9 @@ export interface RegisteredChild {
303
311
  }
304
312
  /** Arguments to route a cap method call (the `cap-call` message minus its discriminant). */
305
313
  export type CapCallInput = Omit<CapCallMessage, "kind">;
314
+ /** A call a child sends out: the routed input plus the addon it acts for. */
315
+ export type ChildCallOutInput = CapCallInput & {
316
+ readonly actingAddonId?: string;
317
+ };
306
318
  /** Arguments to route an addon-level call (the `addon-call` message minus its discriminant). */
307
319
  export type AddonCallInput = Omit<AddonCallMessage, "kind">;
@@ -10,6 +10,7 @@ export { PeerAnsweredError } from "./peer-answered-error.js";
10
10
  export { UdsLocalTransportServer, UdsLocalTransportClient } from "./uds-local-transport.js";
11
11
  export { createLocalTransport } from "./create-local-transport.js";
12
12
  export type { ChildCapDescriptor, RegisterMessage, ChildLogMessage, ChildEventMessage, ChildToParentRequest, CapCallMessage, CapCallInput, CapCallOutMessage, AddonCallMessage, AddonCallInput, AddonCallTarget, AddonSettingsMethod, ParentToChildRequest, RegisteredChild, EventInterestMessage, SetLogLevelMessage } from "./child-cap-protocol.js";
13
+ export { RunnerOfAddon } from "./runner-of-addon.js";
13
14
  export { LocalChildRegistry, afterWorkerOnlineAnnounce, UDS_NO_ROUTE_PREFIX } from "./local-child-registry.js";
14
15
  export type { LocalChildRegistryOptions, LocalChildRegistryLogger, ChildLifecycleEvents } from "./local-child-registry.js";
15
16
  export type { LocalChildClientOptions, AddonCallHandler } from "./local-child-client.js";
@@ -1,5 +1,5 @@
1
1
  import type { ChildCustomActionCatalogs, IReadinessRegistryRecord, SystemEvent } from "@camstack/types";
2
- import type { AddonCallInput, CapCallInput, ChildCapDescriptor, ChildLogMessage } from "./child-cap-protocol.js";
2
+ import type { AddonCallInput, CapCallInput, ChildCallOutInput, ChildCapDescriptor, ChildLogMessage } from "./child-cap-protocol.js";
3
3
  export interface LocalChildClientOptions {
4
4
  /** Parent node id — selects the UDS endpoint this child connects to. */
5
5
  readonly nodeId: string;
@@ -193,7 +193,7 @@ export declare class LocalChildClient {
193
193
  * to its `onUnownedCall` fallback (the cluster CapabilityRegistry in
194
194
  * production). Throws if called before `start()`.
195
195
  */
196
- callOut(input: CapCallInput): Promise<unknown>;
196
+ callOut(input: ChildCallOutInput): Promise<unknown>;
197
197
  /** Disconnect from the parent. Safe to call before `start()` (no-op) and idempotent. */
198
198
  close(): Promise<void>;
199
199
  }
@@ -650,5 +650,12 @@ export declare class LocalChildRegistry {
650
650
  /** `WorkerOffline` for the LIVE connection's close (a superseded close never reaches here). */
651
651
  private announceOffline;
652
652
  private emitLifecycle;
653
+ /**
654
+ * The caller stamp of a `cap-call-out`. A claim (`actingAddonId`) is checked against the
655
+ * runner map the parent built at spawn (`resolveChildIdForAddon`, identity for a solo runner):
656
+ * a runner that does not host the addon is refused. Only the caps keyed by the ADDON
657
+ * (`ADDON_KEYED_CAPS`) use the verified addon id; every other cap keeps the runner stamp.
658
+ */
659
+ private callerStampOf;
653
660
  private onConnection;
654
661
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The agent's runner -> addons map, filled where a spawn plan computes each addon's runner id
3
+ * (`resolveRunnerId`) and read by the agent's `LocalChildRegistry` to verify which addon a grouped
4
+ * runner acts for. An addon never planned here resolves to itself, as on the hub.
5
+ */
6
+ export declare class RunnerOfAddon {
7
+ private readonly byAddon;
8
+ /** Remember the plan and hand the runner id back, so the call site stays one expression. */
9
+ record(addonId: string, runnerId: string): string;
10
+ resolve: (addonId: string) => string;
11
+ }
@@ -0,0 +1,11 @@
1
+ import type { HubSqlMigration } from "../../builtins/sqlite-storage/migrations/migration-types.js";
2
+ export declare const RECORDS_OWNER_GROUP_TO_ADDON_MIGRATION_ID = "hub/2026-11-02-records-owner-group-to-addon";
3
+ interface GroupKind {
4
+ readonly group: string;
5
+ readonly kind: string;
6
+ readonly addonId: string;
7
+ }
8
+ /** Every (group, kind) a grouped addon declared; solo-runner addons were always stamped by id. */
9
+ export declare const GROUPED_RECORD_KINDS: readonly GroupKind[];
10
+ export declare const RECORDS_OWNER_GROUP_TO_ADDON_MIGRATION: HubSqlMigration;
11
+ export {};
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-hoy7lFFU.js");
2
+ const require_dist = require("./dist-B0zmp3zn.js");
3
3
  let zod = require("zod");
4
4
  let node_crypto = require("node:crypto");
5
5
  let buffer = require("buffer");
@@ -1,4 +1,4 @@
1
- import { G as DataStoreDatabaseSchema, M as DATABASE_SNAPSHOT_SUFFIX, us as defineRecordKinds } from "./dist-CYQNDx7D.mjs";
1
+ import { G as DataStoreDatabaseSchema, M as DATABASE_SNAPSHOT_SUFFIX, us as defineRecordKinds } from "./dist-Cdz0_zxq.mjs";
2
2
  import { z } from "zod";
3
3
  import { createCipheriv, createDecipheriv, createHash, createPrivateKey, createPublicKey, diffieHellman, generateKeyPairSync, hkdfSync, randomBytes } from "node:crypto";
4
4
  import { Buffer as Buffer$1 } from "buffer";
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-hoy7lFFU.js");
1
+ const require_dist = require("./dist-B0zmp3zn.js");
2
2
  //#region src/builtins/device-history/store/series-registry.ts
3
3
  function subjectIdOf(subject) {
4
4
  return subject.kind === "device" ? `d:${subject.deviceId}` : `n:${subject.nodeId}`;
@@ -1,4 +1,4 @@
1
- import { ec as DeviceType, gs as historyItemFieldPath, wo as HISTORY_DEFAULT_MIN_INTERVAL_MS } from "./dist-CYQNDx7D.mjs";
1
+ import { ec as DeviceType, gs as historyItemFieldPath, wo as HISTORY_DEFAULT_MIN_INTERVAL_MS } from "./dist-Cdz0_zxq.mjs";
2
2
  //#region src/builtins/device-history/store/series-registry.ts
3
3
  function subjectIdOf(subject) {
4
4
  return subject.kind === "device" ? `d:${subject.deviceId}` : `n:${subject.nodeId}`;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.743",
3
+ "version": "1.2.744",
4
4
  "description": "CamStack builtins — shipped inside @camstack/server (generated, do not edit)",
5
5
  "license": "MIT",
6
6
  "camstack": {