@camstack/system 1.2.461 → 1.2.463

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 (104) hide show
  1. package/dist/addon-runner.js +21 -276
  2. package/dist/addon-runner.mjs +21 -276
  3. package/dist/{agent-https-Iw3RSQup.mjs → agent-https-B9gbXoJI.mjs} +1 -1
  4. package/dist/{agent-https-Dnr_nIVx.js → agent-https-DhFIbEwN.js} +1 -1
  5. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  8. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  9. package/dist/builtins/alerts/alerts.addon.js +1 -1
  10. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  11. package/dist/builtins/autotrack/index.js +1 -1
  12. package/dist/builtins/autotrack/index.mjs +1 -1
  13. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +1 -3
  14. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +51 -502
  15. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +51 -502
  16. package/dist/builtins/backup-orchestrator/destination-policy.d.ts +5 -21
  17. package/dist/builtins/backup-orchestrator/record-kinds.d.ts +0 -2
  18. package/dist/builtins/backup-orchestrator/schedule-store.d.ts +5 -13
  19. package/dist/builtins/backup-orchestrator/seed-marker-store.d.ts +9 -19
  20. package/dist/builtins/calendars/calendars.addon.js +1 -1
  21. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  22. package/dist/builtins/camera-grid/index.js +1 -1
  23. package/dist/builtins/camera-grid/index.mjs +1 -1
  24. package/dist/builtins/cluster-agent/record-kinds.d.ts +0 -1
  25. package/dist/builtins/composer/composer.addon.js +2 -2
  26. package/dist/builtins/composer/composer.addon.mjs +2 -2
  27. package/dist/builtins/console-logging/index.js +1 -1
  28. package/dist/builtins/console-logging/index.mjs +1 -1
  29. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  30. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  31. package/dist/builtins/device-history/device-history.addon.js +1 -1
  32. package/dist/builtins/device-history/device-history.addon.mjs +1 -1
  33. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  34. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  35. package/dist/builtins/hub-forwarder/index.js +1 -1
  36. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  37. package/dist/builtins/keychain/index.js +3 -3
  38. package/dist/builtins/keychain/index.mjs +3 -3
  39. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  40. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  41. package/dist/builtins/local-auth/auth-schema.d.ts +2 -12
  42. package/dist/builtins/local-auth/local-auth.addon.js +52 -191
  43. package/dist/builtins/local-auth/local-auth.addon.mjs +52 -191
  44. package/dist/builtins/local-auth/oauth-session-manager.d.ts +13 -4
  45. package/dist/builtins/local-auth/record-kinds.d.ts +1 -1
  46. package/dist/builtins/local-network/local-network.addon.js +2 -2
  47. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  48. package/dist/builtins/loki-logging/index.js +1 -1
  49. package/dist/builtins/loki-logging/index.mjs +1 -1
  50. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  51. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  52. package/dist/builtins/platform-probe/index.js +1 -1
  53. package/dist/builtins/platform-probe/index.mjs +1 -1
  54. package/dist/builtins/record-entries/index.js +1 -1
  55. package/dist/builtins/record-entries/index.mjs +1 -1
  56. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  57. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  58. package/dist/builtins/snapshot/index.js +1 -1
  59. package/dist/builtins/snapshot/index.mjs +1 -1
  60. package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +0 -9
  61. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  62. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  63. package/dist/builtins/sqlite-storage/index.js +1 -1
  64. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  65. package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +0 -8
  66. package/dist/builtins/sqlite-storage/records/records-sql.d.ts +0 -2
  67. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +0 -28
  68. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +1 -2
  69. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +6 -170
  70. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +6 -170
  71. package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +3 -17
  72. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  73. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  74. package/dist/builtins/system-config/system-config.addon.js +3 -3
  75. package/dist/builtins/system-config/system-config.addon.mjs +3 -3
  76. package/dist/builtins/winston-logging/index.js +1 -1
  77. package/dist/builtins/winston-logging/index.mjs +1 -1
  78. package/dist/{composition-sources-DNRZWR1j.mjs → composition-sources-CGtooHSL.mjs} +1 -1
  79. package/dist/{composition-sources-b0e_2I-D.js → composition-sources-oXvmbMHX.js} +1 -1
  80. package/dist/{constants-6OeJiZgi.js → constants-5mrGZxwS.js} +1 -1
  81. package/dist/{constants-BnkOdj9Q.mjs → constants-CdutnpL9.mjs} +1 -1
  82. package/dist/{device-ca-CPTDs--d.js → device-ca-B3xUzps7.js} +1 -1
  83. package/dist/{device-ca-Bnkw8GyU.mjs → device-ca-DZHKlZlD.mjs} +1 -1
  84. package/dist/{dist-Wy8cTxg6.mjs → dist-C2OBCa-A.mjs} +40 -80
  85. package/dist/{dist-Bn-RNanh.js → dist-D9aw_d0G.js} +39 -91
  86. package/dist/file-host-worker.js +1 -1
  87. package/dist/file-host-worker.mjs +1 -1
  88. package/dist/{hub-mdns-ciao-CJu0nhla.mjs → hub-mdns-ciao-Bm09NrMS.mjs} +2 -2
  89. package/dist/{hub-mdns-ciao-CTBTlia4.js → hub-mdns-ciao-CFlhVKK6.js} +2 -2
  90. package/dist/index.d.ts +1 -1
  91. package/dist/index.js +88 -240
  92. package/dist/index.mjs +89 -236
  93. package/dist/kernel/index.d.ts +0 -1
  94. package/dist/kernel/moleculer/runner-addon-settings.d.ts +1 -6
  95. package/dist/kernel/moleculer/runner-device-settings.d.ts +2 -2
  96. package/dist/{restore-archive-DM1OBYq4.js → restore-archive-6zkRREHO.js} +1 -1
  97. package/dist/{restore-archive-CM23Pq9B.mjs → restore-archive-CSOR_tyN.mjs} +1 -1
  98. package/dist/{retired-settings-keys-D_VwZiDt.js → retired-settings-keys-CGUqX-Oz.js} +0 -6
  99. package/dist/{retired-settings-keys-Bhwe4ymb.mjs → retired-settings-keys-C_Kjp-Bj.mjs} +1 -1
  100. package/dist/{wal-maintenance-Bj_MmDkr.mjs → wal-maintenance-Dg6IzSgz.mjs} +0 -0
  101. package/dist/{wal-maintenance-CaJjuLHq.js → wal-maintenance-jXcOxm2T.js} +0 -0
  102. package/package.json +1 -1
  103. package/dist/builtins/sqlite-storage/retired-collections.d.ts +0 -146
  104. package/dist/kernel/legacy-blob-guard.d.ts +0 -63
@@ -22,7 +22,7 @@ export interface RunnerSettingsClient {
22
22
  };
23
23
  }
24
24
  /** The door slice the per-device store needs, over a tRPC client. */
25
- export declare function doorOverClient(client: RunnerSettingsClient, before?: () => Promise<void>): DeviceSettingsDoor;
25
+ export declare function doorOverClient(client: RunnerSettingsClient): DeviceSettingsDoor;
26
26
  /** The per-device methods of a runner's `ctx.settings`. */
27
27
  export interface RunnerDeviceSettingsView {
28
28
  readDeviceStore(deviceId: number): Promise<Record<string, unknown>>;
@@ -36,4 +36,4 @@ export interface RunnerDeviceSettingsView {
36
36
  * runner has none — every call then THROWS: a store that could not be asked
37
37
  * is not an empty one.
38
38
  */
39
- export declare function createRunnerDeviceSettings(client: RunnerSettingsClient | undefined, addonId: string, before?: () => Promise<void>): RunnerDeviceSettingsView;
39
+ export declare function createRunnerDeviceSettings(client: RunnerSettingsClient | undefined, addonId: string): RunnerDeviceSettingsView;
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-Bn-RNanh.js");
2
+ const require_dist = require("./dist-D9aw_d0G.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 { Gi as defineRecordKinds, N as DataStoreDatabaseSchema, S as DATABASE_SNAPSHOT_SUFFIX } from "./dist-Wy8cTxg6.mjs";
1
+ import { N as DataStoreDatabaseSchema, S as DATABASE_SNAPSHOT_SUFFIX, Ui as defineRecordKinds } from "./dist-C2OBCa-A.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";
@@ -353,12 +353,6 @@ function errText(err) {
353
353
  return err instanceof Error ? err.message : String(err);
354
354
  }
355
355
  //#endregion
356
- Object.defineProperty(exports, "RETIRED_SETTINGS_KEYS", {
357
- enumerable: true,
358
- get: function() {
359
- return RETIRED_SETTINGS_KEYS;
360
- }
361
- });
362
356
  Object.defineProperty(exports, "purgeRetiredSettingsKeys", {
363
357
  enumerable: true,
364
358
  get: function() {
@@ -353,4 +353,4 @@ function errText(err) {
353
353
  return err instanceof Error ? err.message : String(err);
354
354
  }
355
355
  //#endregion
356
- export { retiredKeyStoreOf as i, purgeRetiredSettingsKeys as n, purgeRetiredSettingsRows as r, RETIRED_SETTINGS_KEYS as t };
356
+ export { purgeRetiredSettingsRows as n, retiredKeyStoreOf as r, purgeRetiredSettingsKeys as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.461",
3
+ "version": "1.2.463",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",
@@ -1,146 +0,0 @@
1
- /**
2
- * Retired COLLECTIONS — the boot-time drop of dead tables.
3
- *
4
- * ## Why this is not the retired-key purge
5
- *
6
- * `retired-settings-keys.ts` handles two shapes of dead configuration: keys
7
- * inside a live row, and whole rows inside a live collection. Neither can
8
- * express the third shape — a whole TABLE whose owning code is gone. Deleting
9
- * its rows would leave the table, and the table is what makes a reader believe
10
- * the feature still exists: `devices` and `device_settings_kv` sat in the
11
- * schema of every hub, described by their own `@durable` records, next to a
12
- * fleet of 974 cameras none of which had ever been written there.
13
- *
14
- * ## Where it runs: EVERY node, unlike the key purge
15
- *
16
- * The retired keys live in the hub-central settings store, so cleaning them
17
- * anywhere else is work that can never find anything — hence
18
- * `settingsStoreIsAuthoritativeHere`. A retired table is the opposite: it was
19
- * materialised by a `declareCollection` that ran inside whatever engine the
20
- * declaring code booted next to, so every node that ever ran that code has its
21
- * own copy. This purge is therefore NOT role-gated — and it takes no `env`
22
- * parameter at all, where its sibling does, so that the gate cannot be added
23
- * back by copying a signature.
24
- *
25
- * ## Contract
26
- *
27
- * - **Idempotent.** An absent table plans nothing, drops nothing, logs nothing.
28
- * - **Loud exactly once per drop**, and the line carries the row count. An
29
- * empty drop is `info`; a drop that destroyed rows is `warn`, because
30
- * "nothing read this" is a claim about the code and the number is the only
31
- * evidence of what it cost on this machine.
32
- * - **A fault never blocks boot.** A drop that throws is warned about and the
33
- * next spec still runs; the next boot retries.
34
- *
35
- * ## Adding a collection
36
- *
37
- * Only add a table whose declaring code you have DELETED in the same change.
38
- * A table listed here while something still declares it is dropped at every
39
- * boot and recreated moments later — a churn no test would catch. Worse than
40
- * churn, in fact: the purge is not role-gated, so a live table added here is
41
- * dropped **on the hub too**, at every boot, and the rows are reported only
42
- * after they are gone. `scripts/check-retired-collections-are-dead.ts` now
43
- * refuses any entry that still appears in `docs/reference/storage.md`.
44
- *
45
- * ## What this list can NOT retire: a whole node's store
46
- *
47
- * On 2026-09-01 agents stopped booting a `data-store-provider` of their own
48
- * (`server/backend/src/agent/agent-infra-capabilities.ts`). It looks like a
49
- * deletion that should retire its tables. It is not, for two independent
50
- * reasons, and both are worth writing down because the next session will reach
51
- * for this file first:
52
- *
53
- * 1. **Every table an agent held is a table the hub still declares.**
54
- * `addon-settings`, `storage_locations`, `system-settings`, `sections`,
55
- * `provider-settings`, the `device-*` family, `alerts`, `vec_indexes` and
56
- * each `<addonId>:addon-settings` variant are all live on the hub. Listing
57
- * any of them here drops the HUB's copy — see the guard.
58
- * 2. **The purge runs inside the engine's boot, and the agent no longer boots
59
- * one.** Nothing on that node would execute the drop even if a name were
60
- * safe to add. This is not hypothetical: the `macmini` node's leftover
61
- * store still carries `devices` and `device_settings_kv` — the two tables
62
- * D183 retired — because its engine has not booted since 2026-05-09.
63
- *
64
- * The agent's leftover `camstack.db` is therefore inert, not resurrectable: no
65
- * engine opens it and no code reads it. Its disposal is an operator decision,
66
- * not a boot-time one, and it is recorded in the ADR rather than automated
67
- * here — this module drops TABLES, and deleting somebody's database file is a
68
- * different kind of act.
69
- */
70
- import type { OwnedSqliteFile } from "./owned-sqlite-file.js";
71
- import type { RetiredKeyLogger } from "./retired-settings-keys.js";
72
- import type { DroppedTable, SqliteSettingsBackend } from "./sqlite-settings-backend.js";
73
- /** One retired-table declaration. */
74
- export interface RetiredCollectionSpec {
75
- /**
76
- * The table name as it exists on disk. These tables are NOT namespaced —
77
- * the retired code declared them bare — so this is the literal name, not a
78
- * `<namespace>:<collection>` pair to be resolved.
79
- */
80
- readonly collection: string;
81
- /** The code that used to own it — reported, never used to address it. */
82
- readonly owner: string;
83
- /** Why it is dead. Cited in the log line, not re-derived at the call site. */
84
- readonly reason: string;
85
- }
86
- /** What one drop destroyed. */
87
- export interface RetiredCollectionDrop {
88
- readonly collection: string;
89
- readonly owner: string;
90
- /** Rows the table held. Zero is the expected case and is still reported. */
91
- readonly rows: number;
92
- }
93
- /** The engine access the purge needs. Narrow on purpose — trivially fakeable. */
94
- export interface RetiredCollectionStore {
95
- /** Drop `collection`, or answer `null` when it is not there. Throws on fault. */
96
- drop(collection: string): Promise<DroppedTable | null>;
97
- }
98
- /**
99
- * The dead tables.
100
- *
101
- * `devices` / `device_settings_kv` — the device half of the
102
- * integration-registry ([D183](../../../../../docs/decisions/adr-0183.md)).
103
- * The registry's INTEGRATION half is live (`integrations`,
104
- * `integration_settings`); its device half never had a production caller and
105
- * never had a row. The fleet lives in `device-manager:devices`, under numeric
106
- * ids, while these tables key on `dev_NNNN` — the two id-spaces could not be
107
- * reconciled even if something had wanted to.
108
- *
109
- * `pipeline-analytics:track-groups` / `:track-group-members` — the co-moving
110
- * GROUP entity. It shipped on 2026-08-24 and was kill-switched the same day
111
- * (duplicate sealed rows made Library → Gruppi unusable); the operator decided
112
- * on 2026-09-01 to delete it rather than re-open it. The clusterer, the live
113
- * buffer, the sealer, the query, the two cap methods and the two custom
114
- * actions are gone, so nothing declares these tables any more. The group-owned
115
- * MEDIA rows are NOT here — they live in the shared `pipeline-analytics:media`
116
- * and are collected by the orphan audit through `RETIRED_OWNER_KINDS`.
117
- *
118
- * `pipeline-analytics:summaries` / `:summary-members` — the session SUMMARY,
119
- * the entity that grouped tracks by proximity at birth (D489) and split them
120
- * when they walked apart (D490). Its production path was switched off on
121
- * 2026-09-16 and the operator decided on 2026-09-29 to delete it (D680): the
122
- * sealer, the store, the group shot, the three cap methods and the digest's
123
- * `groups` reading are gone, so nothing declares these tables. The group
124
- * shots were `summary`-owned rows in `pipeline-analytics:media` and go the
125
- * same way as the group entity's — through `RETIRED_OWNER_KINDS`.
126
- */
127
- export declare const RETIRED_COLLECTIONS: readonly RetiredCollectionSpec[];
128
- /**
129
- * Adapt the SQLite engine to {@link RetiredCollectionStore}.
130
- *
131
- * The DDL itself is the engine's — it owns the handle and the memos a drop has
132
- * to evict. This module owns only the list and the reporting.
133
- */
134
- export declare function retiredCollectionStoreOf(backend: SqliteSettingsBackend): RetiredCollectionStore;
135
- /**
136
- * The same adapter over an {@link OwnedSqliteFile} — the purge runs against
137
- * EVERY open database file (D851), and a file served by a worker answers the
138
- * drop through its thread.
139
- */
140
- export declare function retiredCollectionStoreOfFile(file: OwnedSqliteFile): RetiredCollectionStore;
141
- /**
142
- * Drop every retired table that is still present. Returns one entry per table
143
- * actually dropped — empty when the schema is already clean, which is the
144
- * steady state after the first boot that ran it.
145
- */
146
- export declare function purgeRetiredCollections(store: RetiredCollectionStore, logger: RetiredKeyLogger, specs?: readonly RetiredCollectionSpec[]): Promise<readonly RetiredCollectionDrop[]>;
@@ -1,63 +0,0 @@
1
- /**
2
- * The boot guard of the D870 cut-over: an addon never starts on `absent`.
3
- *
4
- * Until `scripts/hub/migrate-device-store.ts --copy` has run, a forked addon's
5
- * settings still sit in its per-addon blobs (`<addonId>:addon-devices`,
6
- * `<addonId>:addon-settings` / `root`) while the standard rows are empty. New
7
- * code reads only the standard rows, so it would run on "no settings" - every
8
- * camera unconfigured, recording off, with nothing in a log. Instead the addon
9
- * REFUSES to start, and says why.
10
- *
11
- * Reads of an unwritten scoped table answer absent and create nothing, so the
12
- * guard costs two counts and a `get` on a hub that never had blobs, and it goes
13
- * quiet by itself once `--drop` removed the old tables.
14
- */
15
- import type { IScopedLogger } from "@camstack/types";
16
- import { AddonRefusedError } from "./addon-refused-error.js";
17
- /** Is `key` of `addonId` a root key that was retired (and must not be migrated)? */
18
- export declare function isRetiredRootKey(addonId: string, key: string): boolean;
19
- /** The client calls the guard uses. */
20
- export interface LegacyGuardClient {
21
- readonly query: {
22
- query(input: {
23
- namespace?: string;
24
- collection: string;
25
- filter?: {
26
- whereBetween: Record<string, [string, string]>;
27
- orderBy: {
28
- field: string;
29
- direction: "asc" | "desc";
30
- };
31
- limit: number;
32
- };
33
- }): Promise<unknown>;
34
- };
35
- readonly get: {
36
- query(input: {
37
- namespace: string;
38
- collection: string;
39
- key: string;
40
- }): Promise<unknown>;
41
- };
42
- readonly count: {
43
- query(input: {
44
- namespace?: string;
45
- collection: string;
46
- filter?: {
47
- whereBetween: Record<string, [string, string]>;
48
- };
49
- }): Promise<unknown>;
50
- };
51
- }
52
- /** Stable `code` of the D870 refusal. */
53
- export declare const UNMIGRATED_SETTINGS_CODE = "unmigrated-settings";
54
- /** The remedy the refusal (and the update pre-flight) names. */
55
- export declare const UNMIGRATED_SETTINGS_REMEDY = "Run scripts/hub/migrate-device-store.ts --copy --apply (D870), then restart the addon.";
56
- export declare class UnmigratedSettingsError extends AddonRefusedError {
57
- constructor(addonId: string, what: string);
58
- }
59
- /**
60
- * THROWS when the addon has blob settings and the standard store has none of
61
- * its own. A store that cannot be asked also throws: it is not "no blobs".
62
- */
63
- export declare function assertLegacyBlobsMigrated(client: LegacyGuardClient, addonId: string, logger: IScopedLogger): Promise<void>;