@camstack/addon-provider-rtsp 1.2.96 → 1.2.98
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.
- package/dist/addon.js +182 -24
- package/dist/addon.mjs +182 -24
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -7327,6 +7327,23 @@ function errMsg(err) {
|
|
|
7327
7327
|
if (typeof err === "string") return err;
|
|
7328
7328
|
return String(err);
|
|
7329
7329
|
}
|
|
7330
|
+
new Set([
|
|
7331
|
+
"track",
|
|
7332
|
+
"summary",
|
|
7333
|
+
"face",
|
|
7334
|
+
"identity",
|
|
7335
|
+
"plate",
|
|
7336
|
+
"vehicle",
|
|
7337
|
+
"scene",
|
|
7338
|
+
"motion",
|
|
7339
|
+
"object",
|
|
7340
|
+
"audio"
|
|
7341
|
+
]);
|
|
7342
|
+
new Set([
|
|
7343
|
+
"motion",
|
|
7344
|
+
"object",
|
|
7345
|
+
"audio"
|
|
7346
|
+
]);
|
|
7330
7347
|
var EncodeProfileSchema = object({
|
|
7331
7348
|
video: object({
|
|
7332
7349
|
codec: _enum([
|
|
@@ -12559,8 +12576,17 @@ method(object({
|
|
|
12559
12576
|
}), array(SettingsRecordSchema).readonly()), method(object({
|
|
12560
12577
|
namespace: string().optional(),
|
|
12561
12578
|
collection: string(),
|
|
12562
|
-
record:
|
|
12563
|
-
|
|
12579
|
+
record: object({
|
|
12580
|
+
id: string().optional(),
|
|
12581
|
+
data: record(string(), unknown())
|
|
12582
|
+
})
|
|
12583
|
+
}), object({
|
|
12584
|
+
/**
|
|
12585
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
12586
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
12587
|
+
* primary key — which is the only place an auto key is knowable.
|
|
12588
|
+
*/
|
|
12589
|
+
id: union([string(), number()]) }), { kind: "mutation" }), method(object({
|
|
12564
12590
|
namespace: string().optional(),
|
|
12565
12591
|
collection: string(),
|
|
12566
12592
|
records: array(BulkRecordSchema).readonly()
|
|
@@ -12669,8 +12695,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
|
|
|
12669
12695
|
}), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
|
|
12670
12696
|
namespace: string().optional(),
|
|
12671
12697
|
collection: string(),
|
|
12672
|
-
record:
|
|
12673
|
-
|
|
12698
|
+
record: object({
|
|
12699
|
+
id: string().optional(),
|
|
12700
|
+
data: record(string(), unknown())
|
|
12701
|
+
})
|
|
12702
|
+
}), object({
|
|
12703
|
+
/**
|
|
12704
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
12705
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
12706
|
+
* primary key — which is the only place an auto key is knowable.
|
|
12707
|
+
*/
|
|
12708
|
+
id: union([string(), number()]) }), {
|
|
12674
12709
|
kind: "mutation",
|
|
12675
12710
|
auth: "admin"
|
|
12676
12711
|
}), method(object({
|
|
@@ -19578,7 +19613,20 @@ var TrackSchema = object({
|
|
|
19578
19613
|
...TrackRetrainFields
|
|
19579
19614
|
});
|
|
19580
19615
|
var BaseEventFields = {
|
|
19581
|
-
|
|
19616
|
+
/**
|
|
19617
|
+
* A SQLite ROWID, assigned by the database (D474).
|
|
19618
|
+
*
|
|
19619
|
+
* Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
|
|
19620
|
+
* TWICE per row, in the row and in the primary-key index, across 2.1 million
|
|
19621
|
+
* motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
|
|
19622
|
+
* the rowid: the table itself is that B-tree, so the index stops existing
|
|
19623
|
+
* rather than getting smaller. No shorter string does that.
|
|
19624
|
+
*
|
|
19625
|
+
* Defined once here for all three event kinds, which is why they move
|
|
19626
|
+
* together: a per-table migration would have forked this and
|
|
19627
|
+
* `COMMON_BASE_COLUMNS` and reunited them two stages later.
|
|
19628
|
+
*/
|
|
19629
|
+
id: number().int(),
|
|
19582
19630
|
deviceId: number(),
|
|
19583
19631
|
timestamp: number()
|
|
19584
19632
|
};
|
|
@@ -19597,7 +19645,34 @@ var MotionEventSchema = object({
|
|
|
19597
19645
|
/** Omitted in slim projection. */
|
|
19598
19646
|
frameHeight: number().optional(),
|
|
19599
19647
|
/** Populated by B5 (recording playback URL for this event). */
|
|
19600
|
-
mediaUrl: string().optional()
|
|
19648
|
+
mediaUrl: string().optional(),
|
|
19649
|
+
/**
|
|
19650
|
+
* One row per motion EPISODE, not one per push (D475). `null` while the
|
|
19651
|
+
* episode is still open — a further rising edge extends it in place rather
|
|
19652
|
+
* than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
|
|
19653
|
+
* (the span from the first rising edge to the LAST one, deliberately NOT
|
|
19654
|
+
* `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
|
|
19655
|
+
* movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
|
|
19656
|
+
* motion for an instantaneous trigger).
|
|
19657
|
+
*
|
|
19658
|
+
* **Absent** (not merely `null`) on a row written before D475 — that means
|
|
19659
|
+
* "closed the old way, before this column existed", never "still open".
|
|
19660
|
+
* Nothing in this codebase may read an absent `durationMs` as an open
|
|
19661
|
+
* episode; only `null` means open.
|
|
19662
|
+
*/
|
|
19663
|
+
durationMs: number().nullable().optional(),
|
|
19664
|
+
/**
|
|
19665
|
+
* Ms offsets from `timestamp` (the episode's own first rising edge, so the
|
|
19666
|
+
* first entry is always `0`) of every genuine off→on transition the
|
|
19667
|
+
* episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
|
|
19668
|
+
* push: a firmware source that keepalives at ~1 Hz for the whole burst
|
|
19669
|
+
* (Reolink, Hikvision) produces exactly one edge; a source that reports an
|
|
19670
|
+
* explicit `false` mid-episode and then resumes before the quiet window
|
|
19671
|
+
* elapses produces another. Stored compactly — see `motion-edge-codec.ts`
|
|
19672
|
+
* — and decoded back to this shape on read. Absent/empty on a legacy row,
|
|
19673
|
+
* which must never be read as "no episode happened here".
|
|
19674
|
+
*/
|
|
19675
|
+
edges: array(number()).readonly().optional()
|
|
19601
19676
|
});
|
|
19602
19677
|
/**
|
|
19603
19678
|
* Which detection SOURCE produced an object event. `pipeline` = the ML
|
|
@@ -19652,6 +19727,23 @@ var ObjectEventSchema = object({
|
|
|
19652
19727
|
* includes it (it is light). Absent on rows written before this field.
|
|
19653
19728
|
*/
|
|
19654
19729
|
frameId: string().optional(),
|
|
19730
|
+
/**
|
|
19731
|
+
* A PRODUCER-chosen key that makes a synthetic event's emission idempotent
|
|
19732
|
+
* (D474).
|
|
19733
|
+
*
|
|
19734
|
+
* Only the package detector writes it, and it exists because the event id
|
|
19735
|
+
* stopped being choosable: the delivery and pick-up rows used to BE their
|
|
19736
|
+
* dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
|
|
19737
|
+
* second delivery for this entry" survived a restart. An `INTEGER` rowid is
|
|
19738
|
+
* assigned by SQLite, so that key had to move off the primary key rather
|
|
19739
|
+
* than be dropped — a detector that cannot recognise its own row re-delivers
|
|
19740
|
+
* every parcel on every boot.
|
|
19741
|
+
*
|
|
19742
|
+
* Absent on every other object event, and on every row written before this
|
|
19743
|
+
* field. Never a substitute for `id`: it is unique per (producer, occasion),
|
|
19744
|
+
* not per row, and nothing addresses a row by it.
|
|
19745
|
+
*/
|
|
19746
|
+
idempotencyKey: string().optional(),
|
|
19655
19747
|
/** Omitted in slim projection. */
|
|
19656
19748
|
trackId: string().optional(),
|
|
19657
19749
|
className: string(),
|
|
@@ -20754,6 +20846,14 @@ var NativeCropResultSchema = object({
|
|
|
20754
20846
|
* set `encodeJpeg: true`; `bytes` is then absent.
|
|
20755
20847
|
*/
|
|
20756
20848
|
jpeg: string().optional(),
|
|
20849
|
+
/**
|
|
20850
|
+
* The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
|
|
20851
|
+
* `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
|
|
20852
|
+
* `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
|
|
20853
|
+
* `bytes` above has crossed this boundary as a `Uint8Array` all along — so
|
|
20854
|
+
* base64 was buying nothing but a multi-megabyte string in the relay's heap.
|
|
20855
|
+
*/
|
|
20856
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
20757
20857
|
width: number().int().positive(),
|
|
20758
20858
|
height: number().int().positive(),
|
|
20759
20859
|
/**
|
|
@@ -20820,7 +20920,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
|
|
|
20820
20920
|
})]);
|
|
20821
20921
|
/** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
|
|
20822
20922
|
var ParkedTrackFrameSchema = object({
|
|
20823
|
-
|
|
20923
|
+
/**
|
|
20924
|
+
* Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
|
|
20925
|
+
* `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
|
|
20926
|
+
* Exactly one of the two is present.
|
|
20927
|
+
*/
|
|
20928
|
+
jpeg: string().optional(),
|
|
20929
|
+
/** The same JPEG as bytes, for a caller that declared it reads them (D462). */
|
|
20930
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
20824
20931
|
width: number().int().positive(),
|
|
20825
20932
|
height: number().int().positive(),
|
|
20826
20933
|
/** The frame instant the parcel shows (the caller's clock, echoed back). */
|
|
@@ -21407,6 +21514,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
21407
21514
|
bbox: NativeCropBboxSchema,
|
|
21408
21515
|
maxWidth: number().int().positive().optional(),
|
|
21409
21516
|
/**
|
|
21517
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
21518
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
21519
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
21520
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
21521
|
+
*/
|
|
21522
|
+
acceptJpegBytes: boolean().optional(),
|
|
21523
|
+
/**
|
|
21410
21524
|
* When `true`, the runner encodes the resolved crop to JPEG ON THE
|
|
21411
21525
|
* OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
|
|
21412
21526
|
* Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
|
|
@@ -21474,7 +21588,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
21474
21588
|
}), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
|
|
21475
21589
|
deviceId: number(),
|
|
21476
21590
|
trackId: string(),
|
|
21477
|
-
kind: ParkedFrameKindSchema
|
|
21591
|
+
kind: ParkedFrameKindSchema,
|
|
21592
|
+
/**
|
|
21593
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
21594
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
21595
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
21596
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
21597
|
+
*/
|
|
21598
|
+
acceptJpegBytes: boolean().optional()
|
|
21478
21599
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
21479
21600
|
deviceId: number(),
|
|
21480
21601
|
trackId: string()
|
|
@@ -27984,26 +28105,59 @@ authKey: string().optional() }), object({
|
|
|
27984
28105
|
/** Human-readable error when `ok: false`. */
|
|
27985
28106
|
error: string().optional()
|
|
27986
28107
|
}), { kind: "mutation" });
|
|
27987
|
-
/**
|
|
27988
|
-
* Hardware / firmware motion sensor cap — binary detected state plus
|
|
27989
|
-
* a timestamp of the last observation. Distinct from
|
|
27990
|
-
* `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
|
|
27991
|
-
* `motion` is the lightweight readout from on-camera motion (Reolink
|
|
27992
|
-
* `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
|
|
27993
|
-
*
|
|
27994
|
-
* Native-motion providers also fan out to `detection.camera-native`
|
|
27995
|
-
* with `source: 'onboard'` so cross-cutting system services
|
|
27996
|
-
* (alert-center, advanced-notifier) can subscribe once and receive
|
|
27997
|
-
* motion from every camera.
|
|
27998
|
-
*/
|
|
27999
28108
|
var MotionStatusSchema = object({
|
|
28000
28109
|
detected: boolean(),
|
|
28001
28110
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
28002
28111
|
lastDetectedAt: number().nullable(),
|
|
28003
28112
|
/**
|
|
28004
|
-
*
|
|
28005
|
-
*
|
|
28006
|
-
*
|
|
28113
|
+
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
|
|
28114
|
+
* `null` while false and on every `Sensor` device (D475) — see that
|
|
28115
|
+
* constant's doc for the one-authority rule.
|
|
28116
|
+
*
|
|
28117
|
+
* ## Reading this field still arms nothing
|
|
28118
|
+
*
|
|
28119
|
+
* It reads like an instruction to the consumer ("revert after N ms if
|
|
28120
|
+
* no fresh push arrives") and it is not one: nothing in this repo reads
|
|
28121
|
+
* the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
|
|
28122
|
+
* close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
|
|
28123
|
+
* imported constant, not as a read of `device.state.motion.value`, so this
|
|
28124
|
+
* field stays what it always was: DESCRIPTIVE output, mirroring an answer
|
|
28125
|
+
* computed elsewhere. Building a self-clear timer out of a READ of this
|
|
28126
|
+
* field would add a second falling-edge authority beside whichever one
|
|
28127
|
+
* already owns the device, and two that can disagree are worse than one.
|
|
28128
|
+
* Consumers that need a falling edge SHAPED differently — held open across
|
|
28129
|
+
* a flapping source — debounce on their own side and say so, as
|
|
28130
|
+
* `addon-export-alexa/src/motion-clear-hold.ts` and
|
|
28131
|
+
* `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
|
|
28132
|
+
*
|
|
28133
|
+
* ## Who writes it
|
|
28134
|
+
*
|
|
28135
|
+
* - **Cameras** — the runner's phase machine, `active → watching` on
|
|
28136
|
+
* `cooldown_expired`, which then writes this slice with
|
|
28137
|
+
* `detected: false` (`handlePhaseChanged` in
|
|
28138
|
+
* `pipeline-runner/index.ts`). It produces the FALLING edge, which
|
|
28139
|
+
* matters most for the sources that only ever push a rising one:
|
|
28140
|
+
* Reolink emits `MotionOnMotionChanged { detected: true }` and never
|
|
28141
|
+
* a false.
|
|
28142
|
+
* - **Sensors** (Home Assistant binary sensors, Homematic) — the
|
|
28143
|
+
* provider pushes the false itself, from the upstream system's own
|
|
28144
|
+
* state change. No phase machine is involved.
|
|
28145
|
+
*
|
|
28146
|
+
* ### The phase machine is CANONICAL, not sole — and that is a defect
|
|
28147
|
+
*
|
|
28148
|
+
* An earlier revision of this docblock (mine, 2026-09-12) claimed the
|
|
28149
|
+
* phase machine is the sole writer for a camera. It is not.
|
|
28150
|
+
* `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
|
|
28151
|
+
* `setCapSlice(motionCapability, …)` on their own rising edge, and
|
|
28152
|
+
* Hikvision's comment says why: it read THIS docblock, agreed the
|
|
28153
|
+
* runner is canonical, and wrote anyway to avoid per-tick churn. So
|
|
28154
|
+
* two authorities can disagree about one slice, which this repo
|
|
28155
|
+
* forbids, and the doc said otherwise — which is worse than saying
|
|
28156
|
+
* nothing, because it reads as verification.
|
|
28157
|
+
*
|
|
28158
|
+
* This predates D475 and is not fixed there: the fix touches every
|
|
28159
|
+
* camera provider. Recorded in D475's Consequences. Do not restore the
|
|
28160
|
+
* "sole writer" wording without also removing the other writers.
|
|
28007
28161
|
*/
|
|
28008
28162
|
autoClearAfterMs: number().nullable()
|
|
28009
28163
|
});
|
|
@@ -28073,7 +28227,11 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
28073
28227
|
*/
|
|
28074
28228
|
runtimeState: MotionStatusSchema,
|
|
28075
28229
|
/**
|
|
28076
|
-
* Runtime-state durability: **session** —
|
|
28230
|
+
* Runtime-state durability: **session** — every writer of this slice
|
|
28231
|
+
* writes only on an EDGE, so a restored `detected: true` would stay
|
|
28232
|
+
* frozen until the next one instead of being corrected. The next edge
|
|
28233
|
+
* re-publishes the real state. (On who the writers are, and why there
|
|
28234
|
+
* is more than one, see `autoClearAfterMs` above.)
|
|
28077
28235
|
*
|
|
28078
28236
|
* See `RuntimeStateDurability`. Enforced by
|
|
28079
28237
|
* `scripts/check-runtime-state-durability.ts`.
|
package/dist/addon.mjs
CHANGED
|
@@ -7303,6 +7303,23 @@ function errMsg(err) {
|
|
|
7303
7303
|
if (typeof err === "string") return err;
|
|
7304
7304
|
return String(err);
|
|
7305
7305
|
}
|
|
7306
|
+
new Set([
|
|
7307
|
+
"track",
|
|
7308
|
+
"summary",
|
|
7309
|
+
"face",
|
|
7310
|
+
"identity",
|
|
7311
|
+
"plate",
|
|
7312
|
+
"vehicle",
|
|
7313
|
+
"scene",
|
|
7314
|
+
"motion",
|
|
7315
|
+
"object",
|
|
7316
|
+
"audio"
|
|
7317
|
+
]);
|
|
7318
|
+
new Set([
|
|
7319
|
+
"motion",
|
|
7320
|
+
"object",
|
|
7321
|
+
"audio"
|
|
7322
|
+
]);
|
|
7306
7323
|
var EncodeProfileSchema = object({
|
|
7307
7324
|
video: object({
|
|
7308
7325
|
codec: _enum([
|
|
@@ -12535,8 +12552,17 @@ method(object({
|
|
|
12535
12552
|
}), array(SettingsRecordSchema).readonly()), method(object({
|
|
12536
12553
|
namespace: string().optional(),
|
|
12537
12554
|
collection: string(),
|
|
12538
|
-
record:
|
|
12539
|
-
|
|
12555
|
+
record: object({
|
|
12556
|
+
id: string().optional(),
|
|
12557
|
+
data: record(string(), unknown())
|
|
12558
|
+
})
|
|
12559
|
+
}), object({
|
|
12560
|
+
/**
|
|
12561
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
12562
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
12563
|
+
* primary key — which is the only place an auto key is knowable.
|
|
12564
|
+
*/
|
|
12565
|
+
id: union([string(), number()]) }), { kind: "mutation" }), method(object({
|
|
12540
12566
|
namespace: string().optional(),
|
|
12541
12567
|
collection: string(),
|
|
12542
12568
|
records: array(BulkRecordSchema).readonly()
|
|
@@ -12645,8 +12671,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
|
|
|
12645
12671
|
}), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
|
|
12646
12672
|
namespace: string().optional(),
|
|
12647
12673
|
collection: string(),
|
|
12648
|
-
record:
|
|
12649
|
-
|
|
12674
|
+
record: object({
|
|
12675
|
+
id: string().optional(),
|
|
12676
|
+
data: record(string(), unknown())
|
|
12677
|
+
})
|
|
12678
|
+
}), object({
|
|
12679
|
+
/**
|
|
12680
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
12681
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
12682
|
+
* primary key — which is the only place an auto key is knowable.
|
|
12683
|
+
*/
|
|
12684
|
+
id: union([string(), number()]) }), {
|
|
12650
12685
|
kind: "mutation",
|
|
12651
12686
|
auth: "admin"
|
|
12652
12687
|
}), method(object({
|
|
@@ -19554,7 +19589,20 @@ var TrackSchema = object({
|
|
|
19554
19589
|
...TrackRetrainFields
|
|
19555
19590
|
});
|
|
19556
19591
|
var BaseEventFields = {
|
|
19557
|
-
|
|
19592
|
+
/**
|
|
19593
|
+
* A SQLite ROWID, assigned by the database (D474).
|
|
19594
|
+
*
|
|
19595
|
+
* Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
|
|
19596
|
+
* TWICE per row, in the row and in the primary-key index, across 2.1 million
|
|
19597
|
+
* motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
|
|
19598
|
+
* the rowid: the table itself is that B-tree, so the index stops existing
|
|
19599
|
+
* rather than getting smaller. No shorter string does that.
|
|
19600
|
+
*
|
|
19601
|
+
* Defined once here for all three event kinds, which is why they move
|
|
19602
|
+
* together: a per-table migration would have forked this and
|
|
19603
|
+
* `COMMON_BASE_COLUMNS` and reunited them two stages later.
|
|
19604
|
+
*/
|
|
19605
|
+
id: number().int(),
|
|
19558
19606
|
deviceId: number(),
|
|
19559
19607
|
timestamp: number()
|
|
19560
19608
|
};
|
|
@@ -19573,7 +19621,34 @@ var MotionEventSchema = object({
|
|
|
19573
19621
|
/** Omitted in slim projection. */
|
|
19574
19622
|
frameHeight: number().optional(),
|
|
19575
19623
|
/** Populated by B5 (recording playback URL for this event). */
|
|
19576
|
-
mediaUrl: string().optional()
|
|
19624
|
+
mediaUrl: string().optional(),
|
|
19625
|
+
/**
|
|
19626
|
+
* One row per motion EPISODE, not one per push (D475). `null` while the
|
|
19627
|
+
* episode is still open — a further rising edge extends it in place rather
|
|
19628
|
+
* than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
|
|
19629
|
+
* (the span from the first rising edge to the LAST one, deliberately NOT
|
|
19630
|
+
* `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
|
|
19631
|
+
* movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
|
|
19632
|
+
* motion for an instantaneous trigger).
|
|
19633
|
+
*
|
|
19634
|
+
* **Absent** (not merely `null`) on a row written before D475 — that means
|
|
19635
|
+
* "closed the old way, before this column existed", never "still open".
|
|
19636
|
+
* Nothing in this codebase may read an absent `durationMs` as an open
|
|
19637
|
+
* episode; only `null` means open.
|
|
19638
|
+
*/
|
|
19639
|
+
durationMs: number().nullable().optional(),
|
|
19640
|
+
/**
|
|
19641
|
+
* Ms offsets from `timestamp` (the episode's own first rising edge, so the
|
|
19642
|
+
* first entry is always `0`) of every genuine off→on transition the
|
|
19643
|
+
* episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
|
|
19644
|
+
* push: a firmware source that keepalives at ~1 Hz for the whole burst
|
|
19645
|
+
* (Reolink, Hikvision) produces exactly one edge; a source that reports an
|
|
19646
|
+
* explicit `false` mid-episode and then resumes before the quiet window
|
|
19647
|
+
* elapses produces another. Stored compactly — see `motion-edge-codec.ts`
|
|
19648
|
+
* — and decoded back to this shape on read. Absent/empty on a legacy row,
|
|
19649
|
+
* which must never be read as "no episode happened here".
|
|
19650
|
+
*/
|
|
19651
|
+
edges: array(number()).readonly().optional()
|
|
19577
19652
|
});
|
|
19578
19653
|
/**
|
|
19579
19654
|
* Which detection SOURCE produced an object event. `pipeline` = the ML
|
|
@@ -19628,6 +19703,23 @@ var ObjectEventSchema = object({
|
|
|
19628
19703
|
* includes it (it is light). Absent on rows written before this field.
|
|
19629
19704
|
*/
|
|
19630
19705
|
frameId: string().optional(),
|
|
19706
|
+
/**
|
|
19707
|
+
* A PRODUCER-chosen key that makes a synthetic event's emission idempotent
|
|
19708
|
+
* (D474).
|
|
19709
|
+
*
|
|
19710
|
+
* Only the package detector writes it, and it exists because the event id
|
|
19711
|
+
* stopped being choosable: the delivery and pick-up rows used to BE their
|
|
19712
|
+
* dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
|
|
19713
|
+
* second delivery for this entry" survived a restart. An `INTEGER` rowid is
|
|
19714
|
+
* assigned by SQLite, so that key had to move off the primary key rather
|
|
19715
|
+
* than be dropped — a detector that cannot recognise its own row re-delivers
|
|
19716
|
+
* every parcel on every boot.
|
|
19717
|
+
*
|
|
19718
|
+
* Absent on every other object event, and on every row written before this
|
|
19719
|
+
* field. Never a substitute for `id`: it is unique per (producer, occasion),
|
|
19720
|
+
* not per row, and nothing addresses a row by it.
|
|
19721
|
+
*/
|
|
19722
|
+
idempotencyKey: string().optional(),
|
|
19631
19723
|
/** Omitted in slim projection. */
|
|
19632
19724
|
trackId: string().optional(),
|
|
19633
19725
|
className: string(),
|
|
@@ -20730,6 +20822,14 @@ var NativeCropResultSchema = object({
|
|
|
20730
20822
|
* set `encodeJpeg: true`; `bytes` is then absent.
|
|
20731
20823
|
*/
|
|
20732
20824
|
jpeg: string().optional(),
|
|
20825
|
+
/**
|
|
20826
|
+
* The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
|
|
20827
|
+
* `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
|
|
20828
|
+
* `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
|
|
20829
|
+
* `bytes` above has crossed this boundary as a `Uint8Array` all along — so
|
|
20830
|
+
* base64 was buying nothing but a multi-megabyte string in the relay's heap.
|
|
20831
|
+
*/
|
|
20832
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
20733
20833
|
width: number().int().positive(),
|
|
20734
20834
|
height: number().int().positive(),
|
|
20735
20835
|
/**
|
|
@@ -20796,7 +20896,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
|
|
|
20796
20896
|
})]);
|
|
20797
20897
|
/** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
|
|
20798
20898
|
var ParkedTrackFrameSchema = object({
|
|
20799
|
-
|
|
20899
|
+
/**
|
|
20900
|
+
* Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
|
|
20901
|
+
* `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
|
|
20902
|
+
* Exactly one of the two is present.
|
|
20903
|
+
*/
|
|
20904
|
+
jpeg: string().optional(),
|
|
20905
|
+
/** The same JPEG as bytes, for a caller that declared it reads them (D462). */
|
|
20906
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
20800
20907
|
width: number().int().positive(),
|
|
20801
20908
|
height: number().int().positive(),
|
|
20802
20909
|
/** The frame instant the parcel shows (the caller's clock, echoed back). */
|
|
@@ -21383,6 +21490,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
21383
21490
|
bbox: NativeCropBboxSchema,
|
|
21384
21491
|
maxWidth: number().int().positive().optional(),
|
|
21385
21492
|
/**
|
|
21493
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
21494
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
21495
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
21496
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
21497
|
+
*/
|
|
21498
|
+
acceptJpegBytes: boolean().optional(),
|
|
21499
|
+
/**
|
|
21386
21500
|
* When `true`, the runner encodes the resolved crop to JPEG ON THE
|
|
21387
21501
|
* OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
|
|
21388
21502
|
* Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
|
|
@@ -21450,7 +21564,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
21450
21564
|
}), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
|
|
21451
21565
|
deviceId: number(),
|
|
21452
21566
|
trackId: string(),
|
|
21453
|
-
kind: ParkedFrameKindSchema
|
|
21567
|
+
kind: ParkedFrameKindSchema,
|
|
21568
|
+
/**
|
|
21569
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
21570
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
21571
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
21572
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
21573
|
+
*/
|
|
21574
|
+
acceptJpegBytes: boolean().optional()
|
|
21454
21575
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
21455
21576
|
deviceId: number(),
|
|
21456
21577
|
trackId: string()
|
|
@@ -27960,26 +28081,59 @@ authKey: string().optional() }), object({
|
|
|
27960
28081
|
/** Human-readable error when `ok: false`. */
|
|
27961
28082
|
error: string().optional()
|
|
27962
28083
|
}), { kind: "mutation" });
|
|
27963
|
-
/**
|
|
27964
|
-
* Hardware / firmware motion sensor cap — binary detected state plus
|
|
27965
|
-
* a timestamp of the last observation. Distinct from
|
|
27966
|
-
* `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
|
|
27967
|
-
* `motion` is the lightweight readout from on-camera motion (Reolink
|
|
27968
|
-
* `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
|
|
27969
|
-
*
|
|
27970
|
-
* Native-motion providers also fan out to `detection.camera-native`
|
|
27971
|
-
* with `source: 'onboard'` so cross-cutting system services
|
|
27972
|
-
* (alert-center, advanced-notifier) can subscribe once and receive
|
|
27973
|
-
* motion from every camera.
|
|
27974
|
-
*/
|
|
27975
28084
|
var MotionStatusSchema = object({
|
|
27976
28085
|
detected: boolean(),
|
|
27977
28086
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
27978
28087
|
lastDetectedAt: number().nullable(),
|
|
27979
28088
|
/**
|
|
27980
|
-
*
|
|
27981
|
-
*
|
|
27982
|
-
*
|
|
28089
|
+
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
|
|
28090
|
+
* `null` while false and on every `Sensor` device (D475) — see that
|
|
28091
|
+
* constant's doc for the one-authority rule.
|
|
28092
|
+
*
|
|
28093
|
+
* ## Reading this field still arms nothing
|
|
28094
|
+
*
|
|
28095
|
+
* It reads like an instruction to the consumer ("revert after N ms if
|
|
28096
|
+
* no fresh push arrives") and it is not one: nothing in this repo reads
|
|
28097
|
+
* the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
|
|
28098
|
+
* close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
|
|
28099
|
+
* imported constant, not as a read of `device.state.motion.value`, so this
|
|
28100
|
+
* field stays what it always was: DESCRIPTIVE output, mirroring an answer
|
|
28101
|
+
* computed elsewhere. Building a self-clear timer out of a READ of this
|
|
28102
|
+
* field would add a second falling-edge authority beside whichever one
|
|
28103
|
+
* already owns the device, and two that can disagree are worse than one.
|
|
28104
|
+
* Consumers that need a falling edge SHAPED differently — held open across
|
|
28105
|
+
* a flapping source — debounce on their own side and say so, as
|
|
28106
|
+
* `addon-export-alexa/src/motion-clear-hold.ts` and
|
|
28107
|
+
* `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
|
|
28108
|
+
*
|
|
28109
|
+
* ## Who writes it
|
|
28110
|
+
*
|
|
28111
|
+
* - **Cameras** — the runner's phase machine, `active → watching` on
|
|
28112
|
+
* `cooldown_expired`, which then writes this slice with
|
|
28113
|
+
* `detected: false` (`handlePhaseChanged` in
|
|
28114
|
+
* `pipeline-runner/index.ts`). It produces the FALLING edge, which
|
|
28115
|
+
* matters most for the sources that only ever push a rising one:
|
|
28116
|
+
* Reolink emits `MotionOnMotionChanged { detected: true }` and never
|
|
28117
|
+
* a false.
|
|
28118
|
+
* - **Sensors** (Home Assistant binary sensors, Homematic) — the
|
|
28119
|
+
* provider pushes the false itself, from the upstream system's own
|
|
28120
|
+
* state change. No phase machine is involved.
|
|
28121
|
+
*
|
|
28122
|
+
* ### The phase machine is CANONICAL, not sole — and that is a defect
|
|
28123
|
+
*
|
|
28124
|
+
* An earlier revision of this docblock (mine, 2026-09-12) claimed the
|
|
28125
|
+
* phase machine is the sole writer for a camera. It is not.
|
|
28126
|
+
* `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
|
|
28127
|
+
* `setCapSlice(motionCapability, …)` on their own rising edge, and
|
|
28128
|
+
* Hikvision's comment says why: it read THIS docblock, agreed the
|
|
28129
|
+
* runner is canonical, and wrote anyway to avoid per-tick churn. So
|
|
28130
|
+
* two authorities can disagree about one slice, which this repo
|
|
28131
|
+
* forbids, and the doc said otherwise — which is worse than saying
|
|
28132
|
+
* nothing, because it reads as verification.
|
|
28133
|
+
*
|
|
28134
|
+
* This predates D475 and is not fixed there: the fix touches every
|
|
28135
|
+
* camera provider. Recorded in D475's Consequences. Do not restore the
|
|
28136
|
+
* "sole writer" wording without also removing the other writers.
|
|
27983
28137
|
*/
|
|
27984
28138
|
autoClearAfterMs: number().nullable()
|
|
27985
28139
|
});
|
|
@@ -28049,7 +28203,11 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
28049
28203
|
*/
|
|
28050
28204
|
runtimeState: MotionStatusSchema,
|
|
28051
28205
|
/**
|
|
28052
|
-
* Runtime-state durability: **session** —
|
|
28206
|
+
* Runtime-state durability: **session** — every writer of this slice
|
|
28207
|
+
* writes only on an EDGE, so a restored `detected: true` would stay
|
|
28208
|
+
* frozen until the next one instead of being corrected. The next edge
|
|
28209
|
+
* re-publishes the real state. (On who the writers are, and why there
|
|
28210
|
+
* is more than one, see `autoClearAfterMs` above.)
|
|
28053
28211
|
*
|
|
28054
28212
|
* See `RuntimeStateDurability`. Enforced by
|
|
28055
28213
|
* `scripts/check-runtime-state-durability.ts`.
|