@camstack/system 1.1.49 → 1.1.51

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 (53) hide show
  1. package/dist/addon-runner.js +2 -2
  2. package/dist/addon-runner.mjs +2 -2
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +1 -1
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/device-manager/device-manager.addon.js +1 -1
  14. package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  15. package/dist/builtins/hub-forwarder/index.js +1 -1
  16. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  17. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  18. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  19. package/dist/builtins/local-network/local-network.addon.js +1 -1
  20. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  21. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  22. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  23. package/dist/builtins/platform-probe/coral-accelerators.d.ts +22 -0
  24. package/dist/builtins/platform-probe/index.js +67 -2
  25. package/dist/builtins/platform-probe/index.mjs +67 -2
  26. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  27. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  28. package/dist/builtins/snapshot/index.js +162 -12
  29. package/dist/builtins/snapshot/index.mjs +162 -12
  30. package/dist/builtins/snapshot/snapshot-media-handler.d.ts +38 -0
  31. package/dist/builtins/snapshot/snapshot.addon.d.ts +26 -0
  32. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  33. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  34. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
  35. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
  36. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  37. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  38. package/dist/builtins/system-config/system-config.addon.js +1 -1
  39. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  40. package/dist/builtins/winston-logging/index.js +1 -1
  41. package/dist/builtins/winston-logging/index.mjs +1 -1
  42. package/dist/{dist-8phgmJ6b.mjs → dist-BWQX9yUj.mjs} +162 -8
  43. package/dist/{dist-BDV1WKRg.js → dist-C3uHEBtP.js} +173 -7
  44. package/dist/index.d.ts +2 -0
  45. package/dist/index.js +37 -23
  46. package/dist/index.mjs +37 -24
  47. package/dist/kernel/addon-installer.d.ts +8 -0
  48. package/dist/kernel/deps/manifest-native-deps.d.ts +1 -1
  49. package/dist/kernel/deps/npm-command.d.ts +38 -0
  50. package/dist/kernel/hwaccel/hwaccel-resolver.d.ts +2 -0
  51. package/dist/{manifest-python-deps-B09I9ems.mjs → manifest-python-deps-BA6KA9If.mjs} +298 -127
  52. package/dist/{manifest-python-deps-DAA0ULwT.js → manifest-python-deps-CVcJ9hDX.js} +309 -126
  53. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { R as nodePin, X as streamQualityLabel, at as DeviceFeature, et as errMsg, q as snapshotCapability, st as DeviceType, tt as BaseAddon } from "../../dist-8phgmJ6b.mjs";
1
+ import { Q as streamQualityLabel, Y as snapshotCapability, lt as DeviceType, nt as errMsg, rt as BaseAddon, st as DeviceFeature, z as nodePin } from "../../dist-BWQX9yUj.mjs";
2
2
  import { execFile } from "node:child_process";
3
3
  //#region src/builtins/snapshot/snapshot-coalescing.ts
4
4
  /**
@@ -195,12 +195,102 @@ function raceForResult(promise, timeoutMs) {
195
195
  });
196
196
  }
197
197
  //#endregion
198
+ //#region src/builtins/snapshot/snapshot-media-handler.ts
199
+ /**
200
+ * Parse the handler-relative path (`/<deviceId>.jpg?query`) into a request.
201
+ * Returns null for a malformed / nested / non-numeric id so the handler answers
202
+ * 404 without ever reaching `getMedia`.
203
+ */
204
+ function parseSnapshotMediaRequest(url) {
205
+ const qIdx = url.indexOf("?");
206
+ const rawPath = qIdx === -1 ? url : url.slice(0, qIdx);
207
+ const query = qIdx === -1 ? "" : url.slice(qIdx + 1);
208
+ const segment = rawPath.replace(/^\/+/, "");
209
+ if (segment.length === 0 || segment.includes("/")) return null;
210
+ const idPart = segment.replace(/\.jpe?g$/i, "");
211
+ if (!/^\d+$/.test(idPart)) return null;
212
+ const deviceId = Number.parseInt(idPart, 10);
213
+ if (!Number.isSafeInteger(deviceId)) return null;
214
+ const params = new URLSearchParams(query);
215
+ const rawStream = params.get("streamId");
216
+ const streamId = rawStream !== null && rawStream.length > 0 ? rawStream : void 0;
217
+ const rawForce = params.get("force");
218
+ return {
219
+ deviceId,
220
+ streamId,
221
+ force: rawForce === "1" || rawForce === "true"
222
+ };
223
+ }
224
+ /**
225
+ * Create a data-plane handler that serves per-device snapshots as JPEG images.
226
+ * `deps.getMedia` is called once per request; null → 404, throw → 500. A
227
+ * conditional GET with a matching `If-None-Match` produces a 304.
228
+ */
229
+ function createSnapshotMediaHandler(deps) {
230
+ return async (req, res) => {
231
+ if (req.method !== "GET" && req.method !== "HEAD") {
232
+ res.writeHead(405, { allow: "GET, HEAD" }).end();
233
+ return;
234
+ }
235
+ const parsed = parseSnapshotMediaRequest(req.url ?? "/");
236
+ if (parsed === null) {
237
+ res.writeHead(404).end();
238
+ return;
239
+ }
240
+ let media;
241
+ try {
242
+ media = await deps.getMedia(parsed.deviceId, parsed.streamId, parsed.force);
243
+ } catch {
244
+ const body = "Internal server error";
245
+ res.writeHead(500, {
246
+ "content-type": "text/plain",
247
+ "content-length": String(Buffer.byteLength(body))
248
+ });
249
+ if (req.method === "HEAD") res.end();
250
+ else res.end(body);
251
+ return;
252
+ }
253
+ if (media === null) {
254
+ res.writeHead(404).end();
255
+ return;
256
+ }
257
+ const etag = `"${parsed.deviceId}-${media.capturedAt}"`;
258
+ const cacheControl = `private, max-age=${Math.max(0, Math.floor(media.maxAgeS))}`;
259
+ if (req.headers["if-none-match"] === etag) {
260
+ res.writeHead(304, {
261
+ etag,
262
+ "cache-control": cacheControl
263
+ }).end();
264
+ return;
265
+ }
266
+ res.writeHead(200, {
267
+ "content-type": media.contentType,
268
+ "cache-control": cacheControl,
269
+ etag,
270
+ "content-length": String(media.bytes.byteLength)
271
+ });
272
+ if (req.method === "HEAD") res.end();
273
+ else res.end(Buffer.from(media.bytes));
274
+ };
275
+ }
276
+ //#endregion
198
277
  //#region src/builtins/snapshot/snapshot.addon.ts
199
278
  /** Default cache window for non-battery cams (seconds). 10s feels live. */
200
279
  var NON_BATTERY_DEFAULT_MAX_AGE_S = 10;
201
280
  /** Default cache window for battery cams (seconds). 1h ≈ "don't wake the cam unless asked". */
202
281
  var BATTERY_DEFAULT_MAX_AGE_S = 3600;
203
282
  /**
283
+ * Effective per-device max cache age (seconds): the operator override
284
+ * (`snapshotMaxAgeS`) when a finite non-negative number, else the battery-aware
285
+ * default. Shared by the freshness gate (`getSnapshot`) and the HTTP endpoint's
286
+ * `Cache-Control: max-age` (so the browser/`expo-image` layer caches for exactly
287
+ * as long as the wrapper considers the frame fresh).
288
+ */
289
+ function effectiveMaxAgeS(prefs, isBattery) {
290
+ const def = isBattery ? BATTERY_DEFAULT_MAX_AGE_S : NON_BATTERY_DEFAULT_MAX_AGE_S;
291
+ return typeof prefs.snapshotMaxAgeS === "number" && prefs.snapshotMaxAgeS >= 0 ? prefs.snapshotMaxAgeS : def;
292
+ }
293
+ /**
204
294
  * SnapshotAddon — wrapper over the `snapshot` capability.
205
295
  *
206
296
  * Activated per-device (toggleable by user; default active). When active,
@@ -240,25 +330,86 @@ var SnapshotAddon = class SnapshotAddon extends BaseAddon {
240
330
  */
241
331
  ownerCache = null;
242
332
  static OWNER_CACHE_TTL_MS = 3e4;
333
+ /**
334
+ * Handle for the `/addon/snapshot/media/<deviceId>.jpg` HTTP data-plane
335
+ * endpoint (§3.1). Null when the host provides no `ctx.dataPlane` facility
336
+ * (the tRPC `getSnapshot` base64 surface still works — the endpoint is a
337
+ * strictly-additive delivery path). Disposed on shutdown.
338
+ */
339
+ mediaDataPlane = null;
243
340
  constructor() {
244
341
  super({ staleTtlMs: 6e4 });
245
342
  }
246
343
  async onInitialize() {
247
344
  this.ctx.logger.info("Snapshot wrapper initialized");
345
+ const provider = {
346
+ getSnapshot: (input) => this.getSnapshot(input),
347
+ invalidateCache: (input) => this.invalidateCache(input),
348
+ getDeviceSettingsContribution: (input) => this.buildDeviceSettingsContribution(input.deviceId),
349
+ getDeviceLiveContribution: async () => null,
350
+ applyDeviceSettingsPatch: (input) => this.saveDeviceSettingsPatch(input.deviceId, input.patch),
351
+ getStatus: async (input) => this.getStatus(input.deviceId),
352
+ getSnapshotOverview: (input) => this.getSnapshotOverview(input)
353
+ };
354
+ await this.serveMediaDataPlane();
248
355
  return [{
249
356
  capability: snapshotCapability,
250
- provider: {
251
- getSnapshot: (input) => this.getSnapshot(input),
252
- invalidateCache: (input) => this.invalidateCache(input),
253
- getDeviceSettingsContribution: (input) => this.buildDeviceSettingsContribution(input.deviceId),
254
- getDeviceLiveContribution: async () => null,
255
- applyDeviceSettingsPatch: (input) => this.saveDeviceSettingsPatch(input.deviceId, input.patch),
256
- getStatus: async (input) => this.getStatus(input.deviceId),
257
- getSnapshotOverview: (input) => this.getSnapshotOverview(input)
258
- }
357
+ provider
259
358
  }];
260
359
  }
360
+ /**
361
+ * Serve the per-device snapshot image endpoint on the addon data-plane
362
+ * (§3.1). Delivery: `GET /addon/snapshot/media/<deviceId>.jpg` → raw JPEG with
363
+ * `ETag` + `Cache-Control: private, max-age=<device maxAgeS>`, so a grid is N
364
+ * independent `<Image>` tiles served from the coalesced server cache (no
365
+ * base64 tax, no batch head-of-line blocking, browser/`expo-image` caching for
366
+ * free). Best-effort: a host without a `dataPlane` facility keeps the tRPC
367
+ * base64 path.
368
+ */
369
+ async serveMediaDataPlane() {
370
+ const handler = createSnapshotMediaHandler({ getMedia: (deviceId, streamId, force) => this.resolveSnapshotMedia(deviceId, streamId, force) });
371
+ try {
372
+ this.mediaDataPlane = await this.ctx.dataPlane?.serve({
373
+ prefix: "media",
374
+ access: "authenticated",
375
+ handler
376
+ }) ?? null;
377
+ this.ctx.logger.info("snapshot media data-plane served", { meta: { baseUrl: this.mediaDataPlane ? `/addon/${this.ctx.id}/media` : "(no dataPlane facility)" } });
378
+ } catch (err) {
379
+ this.ctx.logger.warn("snapshot media data-plane failed to serve", { meta: { error: errMsg(err) } });
380
+ this.mediaDataPlane = null;
381
+ }
382
+ }
383
+ /**
384
+ * Resolve a device (+ optional stream, + force) to renderable JPEG bytes for
385
+ * the HTTP endpoint. Runs the same coalesced capture ladder as the tRPC
386
+ * `getSnapshot` (so every consumer shares one upstream pull), then decodes the
387
+ * base64 cache into raw bytes and stamps the frame identity: `capturedAt` from
388
+ * the cache entry (matching the ETag `getSnapshotOverview` advertises) and the
389
+ * effective per-device `maxAgeS` for `Cache-Control`. Null → 404.
390
+ */
391
+ async resolveSnapshotMedia(deviceId, streamId, force) {
392
+ const image = await this.getSnapshot({
393
+ deviceId,
394
+ ...streamId !== void 0 ? { streamId } : {},
395
+ force
396
+ });
397
+ if (!image) return null;
398
+ const capturedAt = this.cache.get(deviceId)?.ts ?? Date.now();
399
+ const prefs = await this.readDeviceSettings(deviceId).catch(() => ({}));
400
+ const isBattery = (await this.lookupDeviceMeta(deviceId))?.isBattery ?? false;
401
+ return {
402
+ bytes: Buffer.from(image.base64, "base64"),
403
+ contentType: image.contentType,
404
+ capturedAt,
405
+ maxAgeS: effectiveMaxAgeS(prefs, isBattery)
406
+ };
407
+ }
261
408
  async onShutdown() {
409
+ if (this.mediaDataPlane) {
410
+ await this.mediaDataPlane.dispose().catch(() => void 0);
411
+ this.mediaDataPlane = null;
412
+ }
262
413
  this.cache.clear();
263
414
  this.captureFlight.clear();
264
415
  this.ownerCache = null;
@@ -311,8 +462,7 @@ var SnapshotAddon = class SnapshotAddon extends BaseAddon {
311
462
  tags: { deviceId },
312
463
  meta: { stream: effectiveStreamId ?? "auto" }
313
464
  });
314
- const defaultMaxAgeS = isBatteryDevice ? BATTERY_DEFAULT_MAX_AGE_S : NON_BATTERY_DEFAULT_MAX_AGE_S;
315
- const effectiveMaxAgeMs = (typeof prefs.snapshotMaxAgeS === "number" && prefs.snapshotMaxAgeS >= 0 ? prefs.snapshotMaxAgeS : defaultMaxAgeS) * 1e3;
465
+ const effectiveMaxAgeMs = effectiveMaxAgeS(prefs, isBatteryDevice) * 1e3;
316
466
  const decision = decideSnapshotServe({
317
467
  now,
318
468
  cachedAt: hit?.ts ?? null,
@@ -0,0 +1,38 @@
1
+ import { DataPlaneHandler } from '@camstack/types';
2
+ /** A renderable snapshot frame resolved for one device. */
3
+ export interface SnapshotMedia {
4
+ /** Raw image bytes (already decoded from the wrapper's base64 cache). */
5
+ readonly bytes: Uint8Array;
6
+ /** MIME type — practically always `image/jpeg`. */
7
+ readonly contentType: string;
8
+ /** Epoch ms of the cached capture — drives the ETag and frame identity. */
9
+ readonly capturedAt: number;
10
+ /** Effective per-device max cache age (seconds) → `Cache-Control: max-age`. */
11
+ readonly maxAgeS: number;
12
+ }
13
+ export interface SnapshotMediaHandlerDeps {
14
+ /**
15
+ * Resolve a device (+ optional stream, + force) to a renderable frame. Runs
16
+ * the wrapper's coalesced capture ladder; returns null when no frame can be
17
+ * produced (→ 404). Throwing produces an opaque 500 (caller logs).
18
+ */
19
+ readonly getMedia: (deviceId: number, streamId: string | undefined, force: boolean) => Promise<SnapshotMedia | null>;
20
+ }
21
+ /** Parsed `/<deviceId>[.jpg][?streamId=…&force=1]` request. */
22
+ export interface SnapshotMediaRequest {
23
+ readonly deviceId: number;
24
+ readonly streamId: string | undefined;
25
+ readonly force: boolean;
26
+ }
27
+ /**
28
+ * Parse the handler-relative path (`/<deviceId>.jpg?query`) into a request.
29
+ * Returns null for a malformed / nested / non-numeric id so the handler answers
30
+ * 404 without ever reaching `getMedia`.
31
+ */
32
+ export declare function parseSnapshotMediaRequest(url: string): SnapshotMediaRequest | null;
33
+ /**
34
+ * Create a data-plane handler that serves per-device snapshots as JPEG images.
35
+ * `deps.getMedia` is called once per request; null → 404, throw → 500. A
36
+ * conditional GET with a matching `If-None-Match` produces a 304.
37
+ */
38
+ export declare function createSnapshotMediaHandler(deps: SnapshotMediaHandlerDeps): DataPlaneHandler;
@@ -50,8 +50,34 @@ export declare class SnapshotAddon extends BaseAddon<SnapshotAddonConfig> {
50
50
  */
51
51
  private ownerCache;
52
52
  private static readonly OWNER_CACHE_TTL_MS;
53
+ /**
54
+ * Handle for the `/addon/snapshot/media/<deviceId>.jpg` HTTP data-plane
55
+ * endpoint (§3.1). Null when the host provides no `ctx.dataPlane` facility
56
+ * (the tRPC `getSnapshot` base64 surface still works — the endpoint is a
57
+ * strictly-additive delivery path). Disposed on shutdown.
58
+ */
59
+ private mediaDataPlane;
53
60
  constructor();
54
61
  protected onInitialize(): Promise<ProviderRegistration[]>;
62
+ /**
63
+ * Serve the per-device snapshot image endpoint on the addon data-plane
64
+ * (§3.1). Delivery: `GET /addon/snapshot/media/<deviceId>.jpg` → raw JPEG with
65
+ * `ETag` + `Cache-Control: private, max-age=<device maxAgeS>`, so a grid is N
66
+ * independent `<Image>` tiles served from the coalesced server cache (no
67
+ * base64 tax, no batch head-of-line blocking, browser/`expo-image` caching for
68
+ * free). Best-effort: a host without a `dataPlane` facility keeps the tRPC
69
+ * base64 path.
70
+ */
71
+ private serveMediaDataPlane;
72
+ /**
73
+ * Resolve a device (+ optional stream, + force) to renderable JPEG bytes for
74
+ * the HTTP endpoint. Runs the same coalesced capture ladder as the tRPC
75
+ * `getSnapshot` (so every consumer shares one upstream pull), then decodes the
76
+ * base64 cache into raw bytes and stamps the frame identity: `capturedAt` from
77
+ * the cache entry (matching the ETag `getSnapshotOverview` advertises) and the
78
+ * effective per-device `maxAgeS` for `Cache-Control`. Null → 404.
79
+ */
80
+ private resolveSnapshotMedia;
55
81
  protected onShutdown(): Promise<void>;
56
82
  /**
57
83
  * Drop the cached ingest owner whenever addon-level settings change —
@@ -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-BDV1WKRg.js");
6
+ const require_dist = require("../../dist-C3uHEBtP.js");
7
7
  let node_fs = require("node:fs");
8
8
  node_fs = require_chunk.__toESM(node_fs);
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { E as filesystemBrowseCapability, Y as storageProviderCapability, tt as BaseAddon } from "../../dist-8phgmJ6b.mjs";
1
+ import { D as filesystemBrowseCapability, Z as storageProviderCapability, rt as BaseAddon } from "../../dist-BWQX9yUj.mjs";
2
2
  import * as fs from "node:fs";
3
3
  import * as path$1 from "node:path";
4
4
  import { basename, dirname, join, resolve, sep } from "node:path";
@@ -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-BDV1WKRg.js");
6
+ const require_dist = require("../../dist-C3uHEBtP.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let better_sqlite3 = require("better-sqlite3");
9
9
  better_sqlite3 = require_chunk.__toESM(better_sqlite3);
@@ -1,4 +1,4 @@
1
- import { K as settingsStoreCapability, St as parseJsonUnknown, et as errMsg, ft as asJsonObject, s as RUNTIME_DEFAULTS, tt as BaseAddon } from "../../dist-8phgmJ6b.mjs";
1
+ import { Ct as parseJsonUnknown, J as settingsStoreCapability, nt as errMsg, pt as asJsonObject, rt as BaseAddon, s as RUNTIME_DEFAULTS } from "../../dist-BWQX9yUj.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import Database from "better-sqlite3";
4
4
  //#region src/builtins/sqlite-storage/sqlite-settings-backend.ts
@@ -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-BDV1WKRg.js");
6
+ const require_dist = require("../../dist-C3uHEBtP.js");
7
7
  let node_path = require("node:path");
8
8
  node_path = require_chunk.__toESM(node_path);
9
9
  let node_fs_promises = require("node:fs/promises");
@@ -1,4 +1,4 @@
1
- import { J as storageCapability, tt as BaseAddon, u as StorageLocationTypeSchema, xt as parseJsonObject } from "../../dist-8phgmJ6b.mjs";
1
+ import { St as parseJsonObject, X as storageCapability, rt as BaseAddon, u as StorageLocationTypeSchema } from "../../dist-BWQX9yUj.mjs";
2
2
  import * as path$1 from "node:path";
3
3
  import * as fs from "node:fs/promises";
4
4
  import { buildStorageLocationRegistry } from "@camstack/system";
@@ -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-BDV1WKRg.js");
6
+ const require_dist = require("../../dist-C3uHEBtP.js");
7
7
  //#region src/builtins/system-config/system-config.addon.ts
8
8
  /**
9
9
  * Built-in `system-config` addon — Phase 4 of the settings redesign.
@@ -1,4 +1,4 @@
1
- import { et as errMsg, tt as BaseAddon, yt as hydrateSchema } from "../../dist-8phgmJ6b.mjs";
1
+ import { bt as hydrateSchema, nt as errMsg, rt as BaseAddon } from "../../dist-BWQX9yUj.mjs";
2
2
  //#region src/builtins/system-config/system-config.addon.ts
3
3
  /**
4
4
  * Built-in `system-config` addon — Phase 4 of the settings redesign.
@@ -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-BDV1WKRg.js");
6
+ const require_dist = require("../../dist-C3uHEBtP.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  let node_path = require("node:path");
9
9
  node_path = require_chunk.__toESM(node_path);
@@ -1,4 +1,4 @@
1
- import { F as logDestinationCapability, tt as BaseAddon } from "../../dist-8phgmJ6b.mjs";
1
+ import { I as logDestinationCapability, rt as BaseAddon } from "../../dist-BWQX9yUj.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  import * as path$1 from "node:path";
4
4
  import path from "node:path";
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- //#region ../types/dist/sleep-DkhOVOjW.mjs
2
+ //#region ../types/dist/event-category-CFZs3jI4.mjs
3
3
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4
4
  EventCategory["SystemBoot"] = "system.boot";
5
5
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -430,6 +430,14 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
430
430
  EventCategory["PipelineAnalyticsDetectionEvent"] = "pipeline-analytics.detection-event";
431
431
  EventCategory["PipelineAnalyticsFrameTracked"] = "pipeline-analytics.frame-tracked";
432
432
  /**
433
+ * Fired by `addon-post-analysis` when a parked (stationary) object appears
434
+ * (a track was promoted to a stationary-registry entry) or departs (the
435
+ * object moved / was removed). Telemetry (D8): lossy, drives a UI refresh of
436
+ * the dedicated "Stationary" section — never the live event feed. Payload:
437
+ * `{ deviceId, entryId, className, phase:'appeared'|'departed', timestamp }`.
438
+ */
439
+ EventCategory["PipelineAnalyticsStationaryChanged"] = "pipeline-analytics.stationary-changed";
440
+ /**
433
441
  * Fired by `addon-post-analysis` whenever a gallery face row changes:
434
442
  * `kind:'buffered'` a new detected face was persisted, `'assigned'` /
435
443
  * `'unassigned'` its identity link changed, `'deleted'` the row was
@@ -2980,6 +2988,15 @@ var ModelCatalogEntrySchema = z.object({
2980
2988
  width: z.number(),
2981
2989
  height: z.number()
2982
2990
  }),
2991
+ /**
2992
+ * Channel count of the model input tensor. Omit ⇒ 3 (RGB), the default for
2993
+ * every detector / classifier / embedder. Set to 1 for a grayscale CTC text
2994
+ * recognizer (EasyOCR VGG plate-OCR: input `[N,1,H,W]`) so the preprocess
2995
+ * feeds a single-channel, EasyOCR-normalized tensor instead of the default
2996
+ * 3-channel RGB one. Threaded through `PoolModelConfig.inputChannels` to the
2997
+ * Python inference pool.
2998
+ */
2999
+ inputChannels: z.number().int().positive().optional(),
2983
3000
  labels: z.array(LabelDefinitionSchema).readonly(),
2984
3001
  inputLayout: z.enum(["nchw", "nhwc"]).optional(),
2985
3002
  inputNormalization: z.enum([
@@ -2989,6 +3006,16 @@ var ModelCatalogEntrySchema = z.object({
2989
3006
  ]).optional(),
2990
3007
  preprocessMode: z.enum(["letterbox", "resize"]).optional(),
2991
3008
  /**
3009
+ * Per-MODEL postprocessor override. Absent ⇒ the step's own
3010
+ * `StepDefinition.postprocessor` applies (the normal case — every model in a
3011
+ * step shares its decode). Set it when a step hosts models with DIFFERENT raw
3012
+ * output layouts under one slot: e.g. object-detection is `'yolo'` by default,
3013
+ * but a Coral SSD MobileNet build emits the `TFLite_Detection_PostProcess`
3014
+ * 4-tensor layout and needs `'ssd'`. Threaded into `PoolModelConfig.postprocessor`
3015
+ * by the engine factory (`modelEntry.postprocessor ?? def.postprocessor`).
3016
+ */
3017
+ postprocessor: z.custom().optional(),
3018
+ /**
2992
3019
  * When true, the executor produces a landmark-aligned crop (similarity warp
2993
3020
  * onto the canonical template) before this step runs, instead of a plain
2994
3021
  * axis-aligned bbox crop. Required for face-recognition embedders (ArcFace):
@@ -7980,7 +8007,8 @@ var EngineProvisioningSchema = z.object({
7980
8007
  runtimeId: z.enum([
7981
8008
  "onnx",
7982
8009
  "openvino",
7983
- "coreml"
8010
+ "coreml",
8011
+ "edgetpu"
7984
8012
  ]).nullable(),
7985
8013
  device: z.string().nullable(),
7986
8014
  state: z.enum([
@@ -10806,6 +10834,36 @@ var ZoneScopeBreakdownSchema = PerScopeBreakdownSchema.extend({
10806
10834
  * with the per-track detail panel and live overlay. */
10807
10835
  trackIds: z.array(z.string()).readonly()
10808
10836
  });
10837
+ /**
10838
+ * A parked ("stationary") object surfaced alongside occupancy — an object that
10839
+ * settled and stopped moving. It is NO LONGER a tracked object (the tracker was
10840
+ * told to forget it so it stops re-spawning tracks/events), but it IS still
10841
+ * physically present, so it keeps counting toward `frame` occupancy and is
10842
+ * listed here so the UI can show it in a dedicated "Stationary" section instead
10843
+ * of flooding the live event feed.
10844
+ */
10845
+ var StationaryObjectSchema = z.object({
10846
+ id: z.string(),
10847
+ className: z.string(),
10848
+ bbox: z.object({
10849
+ x: z.number(),
10850
+ y: z.number(),
10851
+ w: z.number(),
10852
+ h: z.number()
10853
+ }),
10854
+ frameWidth: z.number().int().nonnegative(),
10855
+ frameHeight: z.number().int().nonnegative(),
10856
+ /** When the source track was first seen. */
10857
+ firstSeenAt: z.number().int(),
10858
+ /** When the object was recognised as parked (promotion time). */
10859
+ becameStationaryAt: z.number().int(),
10860
+ /** Last frame a detection confirmed the object is still there. */
10861
+ lastConfirmedAt: z.number().int(),
10862
+ /** Enrichment label carried from the source track (identity / plate). */
10863
+ label: z.string().optional(),
10864
+ /** Native-resolution key-frame media key for the parked object's best image. */
10865
+ keyFrameMediaKey: z.string().optional()
10866
+ });
10809
10867
  var CameraOccupancySnapshotSchema = z.object({
10810
10868
  /** Frame timestamp of the inference result that produced this snapshot. */
10811
10869
  ts: z.number().int(),
@@ -10814,10 +10872,15 @@ var CameraOccupancySnapshotSchema = z.object({
10814
10872
  frameHeight: z.number().int().nonnegative(),
10815
10873
  /** Per-zone breakdown — one entry per defined zone (user + onboard). */
10816
10874
  zones: z.array(ZoneScopeBreakdownSchema).readonly(),
10817
- /** Frame-wide aggregate (everywhere, regardless of zone membership). */
10875
+ /** Frame-wide aggregate (everywhere, regardless of zone membership).
10876
+ * INCLUDES currently-confirmed stationary objects (they are still present). */
10818
10877
  frame: PerScopeBreakdownSchema,
10819
10878
  /** Detections that landed outside every zone. Empty when no zones defined. */
10820
- unzoned: PerScopeBreakdownSchema
10879
+ unzoned: PerScopeBreakdownSchema,
10880
+ /** Parked objects on this camera (additive — absent on legacy snapshots).
10881
+ * Surfaced separately so the UI shows them in a dedicated section rather
10882
+ * than as repeated tracks/events. */
10883
+ stationaryObjects: z.array(StationaryObjectSchema).readonly().optional()
10821
10884
  });
10822
10885
  /**
10823
10886
  * Time-series resolution. The history methods return one bucket per
@@ -12801,6 +12864,64 @@ function looseSchema(schema) {
12801
12864
  const loose = schema.loose;
12802
12865
  return typeof loose === "function" ? loose.call(schema) : schema;
12803
12866
  }
12867
+ /**
12868
+ * Derive a COLLECTION-cap routing `addonId` from a NON-array mutation input
12869
+ * when the caller did NOT supply the top-level `{ addonId }` selector.
12870
+ *
12871
+ * Background: a `scope:'system', mode:'collection'` cap fans its ARRAY methods
12872
+ * (`listTargets`, `listTargetKinds`, …) across every provider, but routes each
12873
+ * single-object method (`send` / CRUD) to ONE provider. The runtime router
12874
+ * strips a TOP-LEVEL `addonId` selector and routes it via
12875
+ * `getProviderByAddonId`; absent that selector it falls through to the FIRST
12876
+ * registered provider — which misroutes (or hard-crashes on a partial provider)
12877
+ * when the target is owned by a DIFFERENT provider. See
12878
+ * `notification-output.cap.ts` (`Target.addonId` / `TargetKind.addonId` are
12879
+ * "stamped by each provider so the concat-fanned catalog stays routable").
12880
+ *
12881
+ * That routing `addonId` is ALREADY carried inside the mutation payload the
12882
+ * caller sends — e.g. `upsertTarget({ target: { …, addonId } })`. This helper
12883
+ * recovers it: it scans the input's DIRECT child object properties (bounded to
12884
+ * one level, first match wins) for a string `addonId`. Mirrors the child-side
12885
+ * `extractArgsAddonId` fallback in `child-cap-dispatch.ts`, which reads a
12886
+ * top-level `addonId` off the raw args; this covers the one-level-nested case
12887
+ * the top-level scan misses.
12888
+ *
12889
+ * Only used for non-array collection methods (array fan-out is never rerouted),
12890
+ * so it can never collapse a catalog aggregation onto a single provider. `null`
12891
+ * / non-object inputs yield `undefined` (fall back to the first provider,
12892
+ * preserving single-provider and id-only-payload back-compat).
12893
+ */
12894
+ function extractNestedAddonId(input) {
12895
+ if (input === null || typeof input !== "object") return void 0;
12896
+ for (const value of Object.values(input)) if (value !== null && typeof value === "object") {
12897
+ const nested = value.addonId;
12898
+ if (typeof nested === "string") return nested;
12899
+ }
12900
+ }
12901
+ /**
12902
+ * True when an OBJECT input schema declares a top-level `addonId` field.
12903
+ *
12904
+ * Such a cap method routes explicitly via the top-level `{ addonId }` selector
12905
+ * (the `llm.generate` / `deleteProfile` posture). The runtime router therefore
12906
+ * MUST NOT also fall back to {@link extractNestedAddonId} for it — that would
12907
+ * let an incidental nested `addonId` (e.g. a key inside a free-form `jsonSchema`
12908
+ * record) hijack routing. Nested recovery is reserved for methods whose input
12909
+ * carries NO top-level selector but embeds the owning `addonId` inside a domain
12910
+ * entity (`upsertTarget({ target: { addonId } })`, `upsertProfile({ profile })`).
12911
+ *
12912
+ * Accepts both Zod 4 (`.shape` / `_def.shape`) and legacy shapes; returns false
12913
+ * for non-object schemas.
12914
+ */
12915
+ function objectInputDeclaresAddonId(schema) {
12916
+ if (schema === null || typeof schema !== "object" && typeof schema !== "function") return false;
12917
+ const direct = schema.shape;
12918
+ const shape = direct !== void 0 && direct !== null ? direct : resolveDefShape(schema._def?.shape);
12919
+ return shape !== void 0 && shape !== null && typeof shape === "object" && Object.prototype.hasOwnProperty.call(shape, "addonId");
12920
+ }
12921
+ /** `_def.shape` may be a thunk (Zod defers object-shape evaluation) or a plain record. */
12922
+ function resolveDefShape(defShape) {
12923
+ return typeof defShape === "function" ? defShape() : defShape;
12924
+ }
12804
12925
  /** Auth level → base-procedure key. `superAdmin` collapses to `admin`. */
12805
12926
  function procedureAuthKey(auth) {
12806
12927
  if (auth === "public") return "public";
@@ -15531,6 +15652,22 @@ var TrackSnapshotSchema = z.object({
15531
15652
  /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
15532
15653
  mediaKey: z.string()
15533
15654
  });
15655
+ /**
15656
+ * One audio-classification label heard on the track's camera while the
15657
+ * track was alive, aggregated per label. An "episode" is one persisted
15658
+ * audio event (the confident-classification path: score ≥ the device's
15659
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
15660
+ * one 32 ms inference chunk, so counts stay human-scaled.
15661
+ */
15662
+ var TrackAudioLabelSchema = z.object({
15663
+ label: z.string(),
15664
+ /** Highest classification score observed across the label's episodes. */
15665
+ peakScore: z.number(),
15666
+ /** Number of coalesced audio-event episodes carrying this label. */
15667
+ count: z.number(),
15668
+ firstAt: z.number(),
15669
+ lastAt: z.number()
15670
+ });
15534
15671
  var TrackSchema = z.object({
15535
15672
  trackId: z.string(),
15536
15673
  deviceId: z.number(),
@@ -15562,7 +15699,11 @@ var TrackSchema = z.object({
15562
15699
  bestEventId: z.string().optional(),
15563
15700
  /** Tag of the importance sub-signal that dominated the score
15564
15701
  * (identity|dwell|proximity|class|confidence|travel|zone). */
15565
- importanceReason: z.string().optional()
15702
+ importanceReason: z.string().optional(),
15703
+ /** Audio-classification labels heard on the camera during the track's
15704
+ * life (score ≥ device `classificationMinScore`), aggregated per label.
15705
+ * Absent on legacy rows / tracks with no confident audio. */
15706
+ audioLabels: z.array(TrackAudioLabelSchema).readonly().optional()
15566
15707
  });
15567
15708
  var BaseEventFields = {
15568
15709
  id: z.string(),
@@ -17811,7 +17952,15 @@ var webrtcSessionCapability = {
17811
17952
  */
17812
17953
  disableIpv6: z.boolean().optional(),
17813
17954
  /** Subscriber attribution. See `createSession` for the contract. */
17814
- consumerAttribution: BrokerConsumerAttributionSchema.optional()
17955
+ consumerAttribution: BrokerConsumerAttributionSchema.optional(),
17956
+ /**
17957
+ * Client-side stream hints (viewport, downlink) — same contract as
17958
+ * `createSession.hints`. Client-offer viewers (the RN viewer's
17959
+ * `WebrtcLiveSession`) negotiate via `handleOffer`, so without this
17960
+ * field their hints were silently stripped by the schema and the
17961
+ * adaptive ladder started blind on the client's display size.
17962
+ */
17963
+ hints: webrtcClientHintsSchema.optional()
17815
17964
  }), z.object({
17816
17965
  sessionId: z.string(),
17817
17966
  sdpAnswer: z.string()
@@ -20139,6 +20288,10 @@ var GpuInfoSchema = z.object({
20139
20288
  memoryMB: z.number().optional()
20140
20289
  });
20141
20290
  var NpuInfoSchema = z.object({ type: z.enum(["apple-ane", "intel-npu"]) });
20291
+ var CoralInfoSchema = z.object({
20292
+ type: z.literal("coral-edgetpu"),
20293
+ bus: z.string().optional()
20294
+ });
20142
20295
  var HardwareInfoSchema = z.object({
20143
20296
  platform: HardwarePlatformSchema,
20144
20297
  arch: HardwareArchSchema,
@@ -20147,7 +20300,8 @@ var HardwareInfoSchema = z.object({
20147
20300
  totalRAM_MB: z.number(),
20148
20301
  availableRAM_MB: z.number(),
20149
20302
  gpu: GpuInfoSchema.nullable(),
20150
- npu: NpuInfoSchema.nullable()
20303
+ npu: NpuInfoSchema.nullable(),
20304
+ coral: CoralInfoSchema.nullable().optional()
20151
20305
  });
20152
20306
  var PlatformScoreSchema = z.object({
20153
20307
  runtime: z.enum(["node", "python"]),
@@ -26172,4 +26326,4 @@ function scoreRuntimes(hw) {
26172
26326
  };
26173
26327
  }
26174
26328
  //#endregion
26175
- export { validateExpressionSource as $, isObjectInput as A, parseStreamParamsFormPatch as B, enumerateItemArrayFields as C, readinessKey as Ct, getByPath as D, filesystemBrowseCapability as E, sleep as Et, logDestinationCapability as F, setByPath as G, procedureAuthKey as H, looseSchema as I, storageCapability as J, settingsStoreCapability as K, metricsProviderCapability as L, kebabToCamel as M, lifecycleJobSchema as N, isArrayOutputSchema as O, localNetworkCapability as P, userManagementCapability as Q, nodePin as R, deviceStatusCapability as S, parseJsonUnknown as St, evaluateLinkExpression as T, scopeKey as Tt, readNodePin as U, platformProbeCapability as V, scoreRuntimes as W, streamQualityLabel as X, storageProviderCapability as Y, toExpressionValue as Z, authProviderCapability as _, emitReadiness as _t, DeviceStatusSchema as a, DeviceFeature as at, deviceManagerCapability as b, isDeviceConfigCap as bt, STREAM_PROFILE_META as c, EventCategory as ct, UserRecordSchema as d, WELL_KNOWN_TAB_MAP as dt, errMsg as et, addonPagesCapability as f, asJsonObject as ft, applyTransform as g, emitDownForOwnedCaps as gt, alertsCapability as h, createEvent as ht, CAP_NAMES_WITH_STATUS as i, DEVICE_STATUS_METHOD as it, isVoidInput as j, isCollectionArrayMethod as k, ScopedTokenSchema as l, ReadinessRegistry as lt, addonWidgetsCapability as m, asString as mt, AlertSchema as n, DATAPLANE_SECRET_HEADER as nt, METHOD_ACCESS_MAP as o, DeviceRole as ot, addonSettingsCapability as p, asNumber as pt, snapshotCapability as q, ApiKeyRecordSchema as r, DEVICE_SETTINGS_CONTRIBUTION_METHODS as rt, RUNTIME_DEFAULTS as s, DeviceType as st, ALL_CAPABILITY_DEFINITIONS as t, BaseAddon as tt, StorageLocationTypeSchema as u, ReadinessTimeoutError as ut, backupCapability as v, expandCapMethods as vt, enumerateSchemaFields as w, resolveCapMount as wt, deviceStateCapability as x, parseJsonObject as xt, buildStreamParamsConfigSchema as y, hydrateSchema as yt, normalizeUnit as z };
26329
+ export { toExpressionValue as $, isCollectionArrayMethod as A, normalizeUnit as B, enumerateItemArrayFields as C, parseJsonUnknown as Ct, filesystemBrowseCapability as D, sleep as Dt, extractNestedAddonId as E, scopeKey as Et, localNetworkCapability as F, readNodePin as G, parseStreamParamsFormPatch as H, logDestinationCapability as I, settingsStoreCapability as J, scoreRuntimes as K, looseSchema as L, isVoidInput as M, kebabToCamel as N, getByPath as O, EventCategory as Ot, lifecycleJobSchema as P, streamQualityLabel as Q, metricsProviderCapability as R, deviceStatusCapability as S, parseJsonObject as St, evaluateLinkExpression as T, resolveCapMount as Tt, platformProbeCapability as U, objectInputDeclaresAddonId as V, procedureAuthKey as W, storageCapability as X, snapshotCapability as Y, storageProviderCapability as Z, authProviderCapability as _, emitDownForOwnedCaps as _t, DeviceStatusSchema as a, DEVICE_SETTINGS_CONTRIBUTION_METHODS as at, deviceManagerCapability as b, hydrateSchema as bt, STREAM_PROFILE_META as c, DeviceRole as ct, UserRecordSchema as d, ReadinessTimeoutError as dt, userManagementCapability as et, addonPagesCapability as f, WELL_KNOWN_TAB_MAP as ft, applyTransform as g, createEvent as gt, alertsCapability as h, asString as ht, CAP_NAMES_WITH_STATUS as i, DATAPLANE_SECRET_HEADER as it, isObjectInput as j, isArrayOutputSchema as k, ScopedTokenSchema as l, DeviceType as lt, addonWidgetsCapability as m, asNumber as mt, AlertSchema as n, errMsg as nt, METHOD_ACCESS_MAP as o, DEVICE_STATUS_METHOD as ot, addonSettingsCapability as p, asJsonObject as pt, setByPath as q, ApiKeyRecordSchema as r, BaseAddon as rt, RUNTIME_DEFAULTS as s, DeviceFeature as st, ALL_CAPABILITY_DEFINITIONS as t, validateExpressionSource as tt, StorageLocationTypeSchema as u, ReadinessRegistry as ut, backupCapability as v, emitReadiness as vt, enumerateSchemaFields as w, readinessKey as wt, deviceStateCapability as x, isDeviceConfigCap as xt, buildStreamParamsConfigSchema as y, expandCapMethods as yt, nodePin as z };