@camstack/addon-tailscale 1.2.97 → 1.2.99

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.
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  enumerable: true
25
25
  }) : target, mod));
26
26
  //#endregion
27
- const require_dist = require("../dist-7OI0Ghkt.js");
27
+ const require_dist = require("../dist-BOzLlTTG.js");
28
28
  let node_child_process = require("node:child_process");
29
29
  let node_util = require("node:util");
30
30
  let node_fs = require("node:fs");
@@ -1,4 +1,4 @@
1
- import { a as EventCategory, i as BaseAddon, n as networkAccessCapability, r as BOOT_RECOVERY_BACKOFF_MS, t as meshNetworkCapability } from "../dist-OQPhLetZ.mjs";
1
+ import { a as EventCategory, i as BaseAddon, n as networkAccessCapability, r as BOOT_RECOVERY_BACKOFF_MS, t as meshNetworkCapability } from "../dist-mGk9oSvk.mjs";
2
2
  import { execFile, spawn } from "node:child_process";
3
3
  import { promisify } from "node:util";
4
4
  import * as fs from "node:fs";
@@ -7320,6 +7320,23 @@ var BOOT_RECOVERY_BACKOFF_MS = [
7320
7320
  60 * 6e4,
7321
7321
  90 * 6e4
7322
7322
  ];
7323
+ new Set([
7324
+ "track",
7325
+ "summary",
7326
+ "face",
7327
+ "identity",
7328
+ "plate",
7329
+ "vehicle",
7330
+ "scene",
7331
+ "motion",
7332
+ "object",
7333
+ "audio"
7334
+ ]);
7335
+ new Set([
7336
+ "motion",
7337
+ "object",
7338
+ "audio"
7339
+ ]);
7323
7340
  var EncodeProfileSchema = object({
7324
7341
  video: object({
7325
7342
  codec: _enum([
@@ -12418,8 +12435,17 @@ method(object({
12418
12435
  }), array(SettingsRecordSchema).readonly()), method(object({
12419
12436
  namespace: string().optional(),
12420
12437
  collection: string(),
12421
- record: SettingsRecordSchema
12422
- }), _void(), { kind: "mutation" }), method(object({
12438
+ record: object({
12439
+ id: string().optional(),
12440
+ data: record(string(), unknown())
12441
+ })
12442
+ }), object({
12443
+ /**
12444
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
12445
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
12446
+ * primary key — which is the only place an auto key is knowable.
12447
+ */
12448
+ id: union([string(), number()]) }), { kind: "mutation" }), method(object({
12423
12449
  namespace: string().optional(),
12424
12450
  collection: string(),
12425
12451
  records: array(BulkRecordSchema).readonly()
@@ -12528,8 +12554,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
12528
12554
  }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
12529
12555
  namespace: string().optional(),
12530
12556
  collection: string(),
12531
- record: SettingsRecordSchema
12532
- }), _void(), {
12557
+ record: object({
12558
+ id: string().optional(),
12559
+ data: record(string(), unknown())
12560
+ })
12561
+ }), object({
12562
+ /**
12563
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
12564
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
12565
+ * primary key — which is the only place an auto key is knowable.
12566
+ */
12567
+ id: union([string(), number()]) }), {
12533
12568
  kind: "mutation",
12534
12569
  auth: "admin"
12535
12570
  }), method(object({
@@ -19188,7 +19223,20 @@ var TrackSchema = object({
19188
19223
  ...TrackRetrainFields
19189
19224
  });
19190
19225
  var BaseEventFields = {
19191
- id: string(),
19226
+ /**
19227
+ * A SQLite ROWID, assigned by the database (D474).
19228
+ *
19229
+ * Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
19230
+ * TWICE per row, in the row and in the primary-key index, across 2.1 million
19231
+ * motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
19232
+ * the rowid: the table itself is that B-tree, so the index stops existing
19233
+ * rather than getting smaller. No shorter string does that.
19234
+ *
19235
+ * Defined once here for all three event kinds, which is why they move
19236
+ * together: a per-table migration would have forked this and
19237
+ * `COMMON_BASE_COLUMNS` and reunited them two stages later.
19238
+ */
19239
+ id: number().int(),
19192
19240
  deviceId: number(),
19193
19241
  timestamp: number()
19194
19242
  };
@@ -19207,7 +19255,34 @@ var MotionEventSchema = object({
19207
19255
  /** Omitted in slim projection. */
19208
19256
  frameHeight: number().optional(),
19209
19257
  /** Populated by B5 (recording playback URL for this event). */
19210
- mediaUrl: string().optional()
19258
+ mediaUrl: string().optional(),
19259
+ /**
19260
+ * One row per motion EPISODE, not one per push (D475). `null` while the
19261
+ * episode is still open — a further rising edge extends it in place rather
19262
+ * than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
19263
+ * (the span from the first rising edge to the LAST one, deliberately NOT
19264
+ * `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
19265
+ * movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
19266
+ * motion for an instantaneous trigger).
19267
+ *
19268
+ * **Absent** (not merely `null`) on a row written before D475 — that means
19269
+ * "closed the old way, before this column existed", never "still open".
19270
+ * Nothing in this codebase may read an absent `durationMs` as an open
19271
+ * episode; only `null` means open.
19272
+ */
19273
+ durationMs: number().nullable().optional(),
19274
+ /**
19275
+ * Ms offsets from `timestamp` (the episode's own first rising edge, so the
19276
+ * first entry is always `0`) of every genuine off→on transition the
19277
+ * episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
19278
+ * push: a firmware source that keepalives at ~1 Hz for the whole burst
19279
+ * (Reolink, Hikvision) produces exactly one edge; a source that reports an
19280
+ * explicit `false` mid-episode and then resumes before the quiet window
19281
+ * elapses produces another. Stored compactly — see `motion-edge-codec.ts`
19282
+ * — and decoded back to this shape on read. Absent/empty on a legacy row,
19283
+ * which must never be read as "no episode happened here".
19284
+ */
19285
+ edges: array(number()).readonly().optional()
19211
19286
  });
19212
19287
  /**
19213
19288
  * Which detection SOURCE produced an object event. `pipeline` = the ML
@@ -19262,6 +19337,23 @@ var ObjectEventSchema = object({
19262
19337
  * includes it (it is light). Absent on rows written before this field.
19263
19338
  */
19264
19339
  frameId: string().optional(),
19340
+ /**
19341
+ * A PRODUCER-chosen key that makes a synthetic event's emission idempotent
19342
+ * (D474).
19343
+ *
19344
+ * Only the package detector writes it, and it exists because the event id
19345
+ * stopped being choosable: the delivery and pick-up rows used to BE their
19346
+ * dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
19347
+ * second delivery for this entry" survived a restart. An `INTEGER` rowid is
19348
+ * assigned by SQLite, so that key had to move off the primary key rather
19349
+ * than be dropped — a detector that cannot recognise its own row re-delivers
19350
+ * every parcel on every boot.
19351
+ *
19352
+ * Absent on every other object event, and on every row written before this
19353
+ * field. Never a substitute for `id`: it is unique per (producer, occasion),
19354
+ * not per row, and nothing addresses a row by it.
19355
+ */
19356
+ idempotencyKey: string().optional(),
19265
19357
  /** Omitted in slim projection. */
19266
19358
  trackId: string().optional(),
19267
19359
  className: string(),
@@ -26389,9 +26481,54 @@ object({
26389
26481
  /** Ms epoch of the last detected-true observation. Null if never detected. */
26390
26482
  lastDetectedAt: number().nullable(),
26391
26483
  /**
26392
- * Ms after which `detected` auto-reverts to false if no fresh push
26393
- * arrives. Null means the provider leaves detected state until a
26394
- * native "clear" event.
26484
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
26485
+ * `null` while false and on every `Sensor` device (D475) — see that
26486
+ * constant's doc for the one-authority rule.
26487
+ *
26488
+ * ## Reading this field still arms nothing
26489
+ *
26490
+ * It reads like an instruction to the consumer ("revert after N ms if
26491
+ * no fresh push arrives") and it is not one: nothing in this repo reads
26492
+ * the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
26493
+ * close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
26494
+ * imported constant, not as a read of `device.state.motion.value`, so this
26495
+ * field stays what it always was: DESCRIPTIVE output, mirroring an answer
26496
+ * computed elsewhere. Building a self-clear timer out of a READ of this
26497
+ * field would add a second falling-edge authority beside whichever one
26498
+ * already owns the device, and two that can disagree are worse than one.
26499
+ * Consumers that need a falling edge SHAPED differently — held open across
26500
+ * a flapping source — debounce on their own side and say so, as
26501
+ * `addon-export-alexa/src/motion-clear-hold.ts` and
26502
+ * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
26503
+ *
26504
+ * ## Who writes it
26505
+ *
26506
+ * - **Cameras** — the runner's phase machine, `active → watching` on
26507
+ * `cooldown_expired`, which then writes this slice with
26508
+ * `detected: false` (`handlePhaseChanged` in
26509
+ * `pipeline-runner/index.ts`). It produces the FALLING edge, which
26510
+ * matters most for the sources that only ever push a rising one:
26511
+ * Reolink emits `MotionOnMotionChanged { detected: true }` and never
26512
+ * a false.
26513
+ * - **Sensors** (Home Assistant binary sensors, Homematic) — the
26514
+ * provider pushes the false itself, from the upstream system's own
26515
+ * state change. No phase machine is involved.
26516
+ *
26517
+ * ### The phase machine is CANONICAL, not sole — and that is a defect
26518
+ *
26519
+ * An earlier revision of this docblock (mine, 2026-09-12) claimed the
26520
+ * phase machine is the sole writer for a camera. It is not.
26521
+ * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
26522
+ * `setCapSlice(motionCapability, …)` on their own rising edge, and
26523
+ * Hikvision's comment says why: it read THIS docblock, agreed the
26524
+ * runner is canonical, and wrote anyway to avoid per-tick churn. So
26525
+ * two authorities can disagree about one slice, which this repo
26526
+ * forbids, and the doc said otherwise — which is worse than saying
26527
+ * nothing, because it reads as verification.
26528
+ *
26529
+ * This predates D475 and is not fixed there: the fix touches every
26530
+ * camera provider. Recorded in D475's Consequences. Do not restore the
26531
+ * "sole writer" wording without also removing the other writers.
26395
26532
  */
26396
26533
  autoClearAfterMs: number().nullable()
26397
26534
  });
@@ -7320,6 +7320,23 @@ var BOOT_RECOVERY_BACKOFF_MS = [
7320
7320
  60 * 6e4,
7321
7321
  90 * 6e4
7322
7322
  ];
7323
+ new Set([
7324
+ "track",
7325
+ "summary",
7326
+ "face",
7327
+ "identity",
7328
+ "plate",
7329
+ "vehicle",
7330
+ "scene",
7331
+ "motion",
7332
+ "object",
7333
+ "audio"
7334
+ ]);
7335
+ new Set([
7336
+ "motion",
7337
+ "object",
7338
+ "audio"
7339
+ ]);
7323
7340
  var EncodeProfileSchema = object({
7324
7341
  video: object({
7325
7342
  codec: _enum([
@@ -12418,8 +12435,17 @@ method(object({
12418
12435
  }), array(SettingsRecordSchema).readonly()), method(object({
12419
12436
  namespace: string().optional(),
12420
12437
  collection: string(),
12421
- record: SettingsRecordSchema
12422
- }), _void(), { kind: "mutation" }), method(object({
12438
+ record: object({
12439
+ id: string().optional(),
12440
+ data: record(string(), unknown())
12441
+ })
12442
+ }), object({
12443
+ /**
12444
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
12445
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
12446
+ * primary key — which is the only place an auto key is knowable.
12447
+ */
12448
+ id: union([string(), number()]) }), { kind: "mutation" }), method(object({
12423
12449
  namespace: string().optional(),
12424
12450
  collection: string(),
12425
12451
  records: array(BulkRecordSchema).readonly()
@@ -12528,8 +12554,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
12528
12554
  }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
12529
12555
  namespace: string().optional(),
12530
12556
  collection: string(),
12531
- record: SettingsRecordSchema
12532
- }), _void(), {
12557
+ record: object({
12558
+ id: string().optional(),
12559
+ data: record(string(), unknown())
12560
+ })
12561
+ }), object({
12562
+ /**
12563
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
12564
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
12565
+ * primary key — which is the only place an auto key is knowable.
12566
+ */
12567
+ id: union([string(), number()]) }), {
12533
12568
  kind: "mutation",
12534
12569
  auth: "admin"
12535
12570
  }), method(object({
@@ -19188,7 +19223,20 @@ var TrackSchema = object({
19188
19223
  ...TrackRetrainFields
19189
19224
  });
19190
19225
  var BaseEventFields = {
19191
- id: string(),
19226
+ /**
19227
+ * A SQLite ROWID, assigned by the database (D474).
19228
+ *
19229
+ * Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
19230
+ * TWICE per row, in the row and in the primary-key index, across 2.1 million
19231
+ * motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
19232
+ * the rowid: the table itself is that B-tree, so the index stops existing
19233
+ * rather than getting smaller. No shorter string does that.
19234
+ *
19235
+ * Defined once here for all three event kinds, which is why they move
19236
+ * together: a per-table migration would have forked this and
19237
+ * `COMMON_BASE_COLUMNS` and reunited them two stages later.
19238
+ */
19239
+ id: number().int(),
19192
19240
  deviceId: number(),
19193
19241
  timestamp: number()
19194
19242
  };
@@ -19207,7 +19255,34 @@ var MotionEventSchema = object({
19207
19255
  /** Omitted in slim projection. */
19208
19256
  frameHeight: number().optional(),
19209
19257
  /** Populated by B5 (recording playback URL for this event). */
19210
- mediaUrl: string().optional()
19258
+ mediaUrl: string().optional(),
19259
+ /**
19260
+ * One row per motion EPISODE, not one per push (D475). `null` while the
19261
+ * episode is still open — a further rising edge extends it in place rather
19262
+ * than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
19263
+ * (the span from the first rising edge to the LAST one, deliberately NOT
19264
+ * `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
19265
+ * movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
19266
+ * motion for an instantaneous trigger).
19267
+ *
19268
+ * **Absent** (not merely `null`) on a row written before D475 — that means
19269
+ * "closed the old way, before this column existed", never "still open".
19270
+ * Nothing in this codebase may read an absent `durationMs` as an open
19271
+ * episode; only `null` means open.
19272
+ */
19273
+ durationMs: number().nullable().optional(),
19274
+ /**
19275
+ * Ms offsets from `timestamp` (the episode's own first rising edge, so the
19276
+ * first entry is always `0`) of every genuine off→on transition the
19277
+ * episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
19278
+ * push: a firmware source that keepalives at ~1 Hz for the whole burst
19279
+ * (Reolink, Hikvision) produces exactly one edge; a source that reports an
19280
+ * explicit `false` mid-episode and then resumes before the quiet window
19281
+ * elapses produces another. Stored compactly — see `motion-edge-codec.ts`
19282
+ * — and decoded back to this shape on read. Absent/empty on a legacy row,
19283
+ * which must never be read as "no episode happened here".
19284
+ */
19285
+ edges: array(number()).readonly().optional()
19211
19286
  });
19212
19287
  /**
19213
19288
  * Which detection SOURCE produced an object event. `pipeline` = the ML
@@ -19262,6 +19337,23 @@ var ObjectEventSchema = object({
19262
19337
  * includes it (it is light). Absent on rows written before this field.
19263
19338
  */
19264
19339
  frameId: string().optional(),
19340
+ /**
19341
+ * A PRODUCER-chosen key that makes a synthetic event's emission idempotent
19342
+ * (D474).
19343
+ *
19344
+ * Only the package detector writes it, and it exists because the event id
19345
+ * stopped being choosable: the delivery and pick-up rows used to BE their
19346
+ * dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
19347
+ * second delivery for this entry" survived a restart. An `INTEGER` rowid is
19348
+ * assigned by SQLite, so that key had to move off the primary key rather
19349
+ * than be dropped — a detector that cannot recognise its own row re-delivers
19350
+ * every parcel on every boot.
19351
+ *
19352
+ * Absent on every other object event, and on every row written before this
19353
+ * field. Never a substitute for `id`: it is unique per (producer, occasion),
19354
+ * not per row, and nothing addresses a row by it.
19355
+ */
19356
+ idempotencyKey: string().optional(),
19265
19357
  /** Omitted in slim projection. */
19266
19358
  trackId: string().optional(),
19267
19359
  className: string(),
@@ -26389,9 +26481,54 @@ object({
26389
26481
  /** Ms epoch of the last detected-true observation. Null if never detected. */
26390
26482
  lastDetectedAt: number().nullable(),
26391
26483
  /**
26392
- * Ms after which `detected` auto-reverts to false if no fresh push
26393
- * arrives. Null means the provider leaves detected state until a
26394
- * native "clear" event.
26484
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
26485
+ * `null` while false and on every `Sensor` device (D475) — see that
26486
+ * constant's doc for the one-authority rule.
26487
+ *
26488
+ * ## Reading this field still arms nothing
26489
+ *
26490
+ * It reads like an instruction to the consumer ("revert after N ms if
26491
+ * no fresh push arrives") and it is not one: nothing in this repo reads
26492
+ * the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
26493
+ * close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
26494
+ * imported constant, not as a read of `device.state.motion.value`, so this
26495
+ * field stays what it always was: DESCRIPTIVE output, mirroring an answer
26496
+ * computed elsewhere. Building a self-clear timer out of a READ of this
26497
+ * field would add a second falling-edge authority beside whichever one
26498
+ * already owns the device, and two that can disagree are worse than one.
26499
+ * Consumers that need a falling edge SHAPED differently — held open across
26500
+ * a flapping source — debounce on their own side and say so, as
26501
+ * `addon-export-alexa/src/motion-clear-hold.ts` and
26502
+ * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
26503
+ *
26504
+ * ## Who writes it
26505
+ *
26506
+ * - **Cameras** — the runner's phase machine, `active → watching` on
26507
+ * `cooldown_expired`, which then writes this slice with
26508
+ * `detected: false` (`handlePhaseChanged` in
26509
+ * `pipeline-runner/index.ts`). It produces the FALLING edge, which
26510
+ * matters most for the sources that only ever push a rising one:
26511
+ * Reolink emits `MotionOnMotionChanged { detected: true }` and never
26512
+ * a false.
26513
+ * - **Sensors** (Home Assistant binary sensors, Homematic) — the
26514
+ * provider pushes the false itself, from the upstream system's own
26515
+ * state change. No phase machine is involved.
26516
+ *
26517
+ * ### The phase machine is CANONICAL, not sole — and that is a defect
26518
+ *
26519
+ * An earlier revision of this docblock (mine, 2026-09-12) claimed the
26520
+ * phase machine is the sole writer for a camera. It is not.
26521
+ * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
26522
+ * `setCapSlice(motionCapability, …)` on their own rising edge, and
26523
+ * Hikvision's comment says why: it read THIS docblock, agreed the
26524
+ * runner is canonical, and wrote anyway to avoid per-tick churn. So
26525
+ * two authorities can disagree about one slice, which this repo
26526
+ * forbids, and the doc said otherwise — which is worse than saying
26527
+ * nothing, because it reads as verification.
26528
+ *
26529
+ * This predates D475 and is not fixed there: the fix touches every
26530
+ * camera provider. Recorded in D475's Consequences. Do not restore the
26531
+ * "sole writer" wording without also removing the other writers.
26395
26532
  */
26396
26533
  autoClearAfterMs: number().nullable()
26397
26534
  });
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_dist = require("../dist-7OI0Ghkt.js");
5
+ const require_dist = require("../dist-BOzLlTTG.js");
6
6
  let node_crypto = require("node:crypto");
7
7
  let node_child_process = require("node:child_process");
8
8
  //#region src/ingress/tailscale-cli.ts
@@ -1,4 +1,4 @@
1
- import { a as EventCategory, i as BaseAddon, n as networkAccessCapability } from "../dist-OQPhLetZ.mjs";
1
+ import { a as EventCategory, i as BaseAddon, n as networkAccessCapability } from "../dist-mGk9oSvk.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { execFile } from "node:child_process";
4
4
  import { promisify } from "node:util";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-tailscale",
3
- "version": "1.2.97",
3
+ "version": "1.2.99",
4
4
  "description": "Tailscale bundle for CamStack — joins the host to a tailnet (client) and exposes the hub via Serve/Funnel (ingress). Multi-entry npm package shipping 2 addons under a single bundle.",
5
5
  "keywords": [
6
6
  "camstack",