@camstack/addon-agent-ui 1.2.102 → 1.2.104

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 (2) hide show
  1. package/dist/addon.js +147 -10
  2. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -7306,6 +7306,23 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
7306
7306
  action: string().min(1),
7307
7307
  input: unknown()
7308
7308
  }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
7309
+ new Set([
7310
+ "track",
7311
+ "summary",
7312
+ "face",
7313
+ "identity",
7314
+ "plate",
7315
+ "vehicle",
7316
+ "scene",
7317
+ "motion",
7318
+ "object",
7319
+ "audio"
7320
+ ]);
7321
+ new Set([
7322
+ "motion",
7323
+ "object",
7324
+ "audio"
7325
+ ]);
7309
7326
  var EncodeProfileSchema = object({
7310
7327
  video: object({
7311
7328
  codec: _enum([
@@ -12404,8 +12421,17 @@ method(object({
12404
12421
  }), array(SettingsRecordSchema).readonly()), method(object({
12405
12422
  namespace: string().optional(),
12406
12423
  collection: string(),
12407
- record: SettingsRecordSchema
12408
- }), _void(), { kind: "mutation" }), method(object({
12424
+ record: object({
12425
+ id: string().optional(),
12426
+ data: record(string(), unknown())
12427
+ })
12428
+ }), object({
12429
+ /**
12430
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
12431
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
12432
+ * primary key — which is the only place an auto key is knowable.
12433
+ */
12434
+ id: union([string(), number()]) }), { kind: "mutation" }), method(object({
12409
12435
  namespace: string().optional(),
12410
12436
  collection: string(),
12411
12437
  records: array(BulkRecordSchema).readonly()
@@ -12514,8 +12540,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
12514
12540
  }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
12515
12541
  namespace: string().optional(),
12516
12542
  collection: string(),
12517
- record: SettingsRecordSchema
12518
- }), _void(), {
12543
+ record: object({
12544
+ id: string().optional(),
12545
+ data: record(string(), unknown())
12546
+ })
12547
+ }), object({
12548
+ /**
12549
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
12550
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
12551
+ * primary key — which is the only place an auto key is knowable.
12552
+ */
12553
+ id: union([string(), number()]) }), {
12519
12554
  kind: "mutation",
12520
12555
  auth: "admin"
12521
12556
  }), method(object({
@@ -19157,7 +19192,20 @@ var TrackSchema = object({
19157
19192
  ...TrackRetrainFields
19158
19193
  });
19159
19194
  var BaseEventFields = {
19160
- id: string(),
19195
+ /**
19196
+ * A SQLite ROWID, assigned by the database (D474).
19197
+ *
19198
+ * Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
19199
+ * TWICE per row, in the row and in the primary-key index, across 2.1 million
19200
+ * motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
19201
+ * the rowid: the table itself is that B-tree, so the index stops existing
19202
+ * rather than getting smaller. No shorter string does that.
19203
+ *
19204
+ * Defined once here for all three event kinds, which is why they move
19205
+ * together: a per-table migration would have forked this and
19206
+ * `COMMON_BASE_COLUMNS` and reunited them two stages later.
19207
+ */
19208
+ id: number().int(),
19161
19209
  deviceId: number(),
19162
19210
  timestamp: number()
19163
19211
  };
@@ -19176,7 +19224,34 @@ var MotionEventSchema = object({
19176
19224
  /** Omitted in slim projection. */
19177
19225
  frameHeight: number().optional(),
19178
19226
  /** Populated by B5 (recording playback URL for this event). */
19179
- mediaUrl: string().optional()
19227
+ mediaUrl: string().optional(),
19228
+ /**
19229
+ * One row per motion EPISODE, not one per push (D475). `null` while the
19230
+ * episode is still open — a further rising edge extends it in place rather
19231
+ * than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
19232
+ * (the span from the first rising edge to the LAST one, deliberately NOT
19233
+ * `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
19234
+ * movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
19235
+ * motion for an instantaneous trigger).
19236
+ *
19237
+ * **Absent** (not merely `null`) on a row written before D475 — that means
19238
+ * "closed the old way, before this column existed", never "still open".
19239
+ * Nothing in this codebase may read an absent `durationMs` as an open
19240
+ * episode; only `null` means open.
19241
+ */
19242
+ durationMs: number().nullable().optional(),
19243
+ /**
19244
+ * Ms offsets from `timestamp` (the episode's own first rising edge, so the
19245
+ * first entry is always `0`) of every genuine off→on transition the
19246
+ * episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
19247
+ * push: a firmware source that keepalives at ~1 Hz for the whole burst
19248
+ * (Reolink, Hikvision) produces exactly one edge; a source that reports an
19249
+ * explicit `false` mid-episode and then resumes before the quiet window
19250
+ * elapses produces another. Stored compactly — see `motion-edge-codec.ts`
19251
+ * — and decoded back to this shape on read. Absent/empty on a legacy row,
19252
+ * which must never be read as "no episode happened here".
19253
+ */
19254
+ edges: array(number()).readonly().optional()
19180
19255
  });
19181
19256
  /**
19182
19257
  * Which detection SOURCE produced an object event. `pipeline` = the ML
@@ -19231,6 +19306,23 @@ var ObjectEventSchema = object({
19231
19306
  * includes it (it is light). Absent on rows written before this field.
19232
19307
  */
19233
19308
  frameId: string().optional(),
19309
+ /**
19310
+ * A PRODUCER-chosen key that makes a synthetic event's emission idempotent
19311
+ * (D474).
19312
+ *
19313
+ * Only the package detector writes it, and it exists because the event id
19314
+ * stopped being choosable: the delivery and pick-up rows used to BE their
19315
+ * dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
19316
+ * second delivery for this entry" survived a restart. An `INTEGER` rowid is
19317
+ * assigned by SQLite, so that key had to move off the primary key rather
19318
+ * than be dropped — a detector that cannot recognise its own row re-delivers
19319
+ * every parcel on every boot.
19320
+ *
19321
+ * Absent on every other object event, and on every row written before this
19322
+ * field. Never a substitute for `id`: it is unique per (producer, occasion),
19323
+ * not per row, and nothing addresses a row by it.
19324
+ */
19325
+ idempotencyKey: string().optional(),
19234
19326
  /** Omitted in slim projection. */
19235
19327
  trackId: string().optional(),
19236
19328
  className: string(),
@@ -26297,9 +26389,54 @@ object({
26297
26389
  /** Ms epoch of the last detected-true observation. Null if never detected. */
26298
26390
  lastDetectedAt: number().nullable(),
26299
26391
  /**
26300
- * Ms after which `detected` auto-reverts to false if no fresh push
26301
- * arrives. Null means the provider leaves detected state until a
26302
- * native "clear" event.
26392
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
26393
+ * `null` while false and on every `Sensor` device (D475) — see that
26394
+ * constant's doc for the one-authority rule.
26395
+ *
26396
+ * ## Reading this field still arms nothing
26397
+ *
26398
+ * It reads like an instruction to the consumer ("revert after N ms if
26399
+ * no fresh push arrives") and it is not one: nothing in this repo reads
26400
+ * the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
26401
+ * close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
26402
+ * imported constant, not as a read of `device.state.motion.value`, so this
26403
+ * field stays what it always was: DESCRIPTIVE output, mirroring an answer
26404
+ * computed elsewhere. Building a self-clear timer out of a READ of this
26405
+ * field would add a second falling-edge authority beside whichever one
26406
+ * already owns the device, and two that can disagree are worse than one.
26407
+ * Consumers that need a falling edge SHAPED differently — held open across
26408
+ * a flapping source — debounce on their own side and say so, as
26409
+ * `addon-export-alexa/src/motion-clear-hold.ts` and
26410
+ * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
26411
+ *
26412
+ * ## Who writes it
26413
+ *
26414
+ * - **Cameras** — the runner's phase machine, `active → watching` on
26415
+ * `cooldown_expired`, which then writes this slice with
26416
+ * `detected: false` (`handlePhaseChanged` in
26417
+ * `pipeline-runner/index.ts`). It produces the FALLING edge, which
26418
+ * matters most for the sources that only ever push a rising one:
26419
+ * Reolink emits `MotionOnMotionChanged { detected: true }` and never
26420
+ * a false.
26421
+ * - **Sensors** (Home Assistant binary sensors, Homematic) — the
26422
+ * provider pushes the false itself, from the upstream system's own
26423
+ * state change. No phase machine is involved.
26424
+ *
26425
+ * ### The phase machine is CANONICAL, not sole — and that is a defect
26426
+ *
26427
+ * An earlier revision of this docblock (mine, 2026-09-12) claimed the
26428
+ * phase machine is the sole writer for a camera. It is not.
26429
+ * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
26430
+ * `setCapSlice(motionCapability, …)` on their own rising edge, and
26431
+ * Hikvision's comment says why: it read THIS docblock, agreed the
26432
+ * runner is canonical, and wrote anyway to avoid per-tick churn. So
26433
+ * two authorities can disagree about one slice, which this repo
26434
+ * forbids, and the doc said otherwise — which is worse than saying
26435
+ * nothing, because it reads as verification.
26436
+ *
26437
+ * This predates D475 and is not fixed there: the fix touches every
26438
+ * camera provider. Recorded in D475's Consequences. Do not restore the
26439
+ * "sole writer" wording without also removing the other writers.
26303
26440
  */
26304
26441
  autoClearAfterMs: number().nullable()
26305
26442
  });
@@ -38997,7 +39134,7 @@ var AgentUIAddon = class extends BaseAddon {
38997
39134
  capability: adminUiCapability,
38998
39135
  provider: {
38999
39136
  getStaticDir: async () => ({ staticDir: path.resolve(__dirname) }),
39000
- getVersion: async () => ({ version: "1.2.102" })
39137
+ getVersion: async () => ({ version: "1.2.104" })
39001
39138
  }
39002
39139
  }];
39003
39140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-agent-ui",
3
- "version": "1.2.102",
3
+ "version": "1.2.104",
4
4
  "description": "Agent UI — lightweight status dashboard served by every agent node",
5
5
  "keywords": [
6
6
  "camstack",