@camstack/addon-pipeline 1.2.199 → 1.2.201
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/audio-analyzer/index.js +2 -2
- package/dist/audio-analyzer/index.mjs +2 -2
- package/dist/{default-detection-model-O1uBusV2.mjs → default-detection-model-fUMLQHB2.mjs} +1 -1
- package/dist/{default-detection-model-CMe44Kid.js → default-detection-model-nKgB-_mg.js} +1 -1
- package/dist/detection-pipeline/index.js +5 -5
- package/dist/detection-pipeline/index.mjs +4 -4
- package/dist/{dist-DmCrC2yx.js → dist-Bd875pfj.js} +912 -606
- package/dist/{dist-B23u1tmN.mjs → dist-D2jcEuZD.mjs} +865 -607
- package/dist/{lazy-sharp-DBHsD2lh.js → lazy-sharp-B4KrLp0u.js} +1 -1
- package/dist/motion-wasm/index.js +2 -2
- package/dist/motion-wasm/index.mjs +1 -1
- package/dist/{node-D1MLn6oV.mjs → node-CmfXSgr3.mjs} +420 -381
- package/dist/{node-DCSTbt6C.js → node-dwhLC9Fh.js} +423 -378
- package/dist/pipeline-runner/index.js +8 -7
- package/dist/pipeline-runner/index.mjs +7 -6
- package/dist/{process-memory-9lvvhHym.js → process-memory-BDRJK5Vq.js} +1 -1
- package/dist/{process-memory-P24NTDb1.mjs → process-memory-CH5qO7AX.mjs} +1 -1
- package/dist/recorder/index.js +1208 -1015
- package/dist/recorder/index.mjs +1203 -1010
- package/dist/restream-intent-B1Difcnq.js +313 -0
- package/dist/restream-intent-DWe2kInY.mjs +248 -0
- package/dist/{prebuffer-DmBYRQWg.mjs → retire-root-keys-Csb8z2f3.js} +12 -64
- package/dist/{prebuffer-DqdeLSsk.js → retire-root-keys-DZvlso2l.mjs} +1 -99
- package/dist/{segment-demux-js-Bm0woPkn.mjs → segment-demux-js-BHTuEBhC.mjs} +1 -1
- package/dist/{segment-demux-js-Ck_F5bsO.js → segment-demux-js-cmfLROII.js} +1 -1
- package/dist/session-decode/decode-worker-child.js +25 -5
- package/dist/session-decode/decode-worker-child.mjs +24 -4
- package/dist/stream-broker/_stub.js +2 -2
- package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-Sq93hI-g.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-DZcCQR5t.mjs} +3 -3
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CrzkEz67.mjs +26 -0
- package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Dj_qoc1e.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-cYr6Swud.mjs} +1 -1
- package/dist/stream-broker/demux-worker-child.js +1 -1
- package/dist/stream-broker/demux-worker-child.mjs +1 -1
- package/dist/stream-broker/{hostInit-COt259tU.mjs → hostInit-CZt5Lq_M.mjs} +3 -3
- package/dist/stream-broker/index.js +181 -48
- package/dist/stream-broker/index.mjs +172 -39
- package/dist/stream-broker/remoteEntry.js +1 -1
- package/dist/{worker-protocol-c1r1Yddg.js → worker-protocol--PcFsRrE.js} +1 -1
- package/dist/{worker-protocol-BxpGZ0Dt.mjs → worker-protocol-D4GyRNnY.mjs} +1 -1
- package/package.json +5 -1
- package/dist/restream-intent-B4BXZra7.mjs +0 -72
- package/dist/restream-intent-Cv9x3jmu.js +0 -89
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BcjLrxhF.mjs +0 -26
|
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
24
|
let node_crypto = require("node:crypto");
|
|
25
|
-
//#region ../types/dist/event-category-
|
|
25
|
+
//#region ../types/dist/event-category-CnLqLOKs.mjs
|
|
26
26
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
27
27
|
EventCategory["SystemBoot"] = "system.boot";
|
|
28
28
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -217,6 +217,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
217
217
|
EventCategory["ProcessCrashed"] = "process.crashed";
|
|
218
218
|
EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
|
|
219
219
|
EventCategory["ProcessRestarted"] = "process.restarted";
|
|
220
|
+
/**
|
|
221
|
+
* The SET of storage locations changed — one was created, edited, enabled,
|
|
222
|
+
* disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
|
|
223
|
+
*
|
|
224
|
+
* Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
|
|
225
|
+
* it must also converge on its own periodic path, because a dropped event
|
|
226
|
+
* must not leave a node writing to yesterday's disk set forever. It exists
|
|
227
|
+
* because there was NO signal at all — an operator who added a second
|
|
228
|
+
* recordings disk in the admin UI got nothing, and the recorder kept its
|
|
229
|
+
* resolved locations until something else happened to re-resolve them
|
|
230
|
+
* (D387). Payload `StorageLocationsChangedPayload`.
|
|
231
|
+
*/
|
|
232
|
+
EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
|
|
220
233
|
EventCategory["RecordingStarted"] = "recording.started";
|
|
221
234
|
EventCategory["RecordingStopped"] = "recording.stopped";
|
|
222
235
|
EventCategory["RecordingError"] = "recording.error";
|
|
@@ -8617,362 +8630,6 @@ var CameraSwitchGroupSchema = object({
|
|
|
8617
8630
|
fetchedAt: number()
|
|
8618
8631
|
});
|
|
8619
8632
|
/**
|
|
8620
|
-
* Per-component log CHANNELS — the gate a hot path consults, and the registry
|
|
8621
|
-
* an addon declares its channels in.
|
|
8622
|
-
*
|
|
8623
|
-
* ## Two axes, deliberately separated
|
|
8624
|
-
*
|
|
8625
|
-
* - **DECLARATION** — which channels exist. Only the addon knows:
|
|
8626
|
-
* `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
|
|
8627
|
-
* baichuan/handshake. A hand-wired central list rots at the first addition,
|
|
8628
|
-
* and rots silently. So a channel is declared where it is consulted, and the
|
|
8629
|
-
* `log-channels` capability enumerates the declarations.
|
|
8630
|
-
* - **VALUE** — at which level, for which scope, until when. That stays ONE
|
|
8631
|
-
* thing: the logging settings document on the `system` cap. Two authorities
|
|
8632
|
-
* over the values is the exact defect
|
|
8633
|
-
* `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
|
|
8634
|
-
* remove; re-introducing it from the cure side would be grotesque.
|
|
8635
|
-
*
|
|
8636
|
-
* Nothing in this file reads a clock, an env var or a store. The registry is
|
|
8637
|
-
* a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
|
|
8638
|
-
* the hot path with a value somebody actually read, and by
|
|
8639
|
-
* {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
|
|
8640
|
-
* never reaches here, so it can neither disarm an armed channel nor arm a
|
|
8641
|
-
* disarmed one (D49).
|
|
8642
|
-
*
|
|
8643
|
-
* ## The canonical call shape
|
|
8644
|
-
*
|
|
8645
|
-
* ```ts
|
|
8646
|
-
* if (CH_RTP.on && CH_RTP.wants(deviceId)) {
|
|
8647
|
-
* CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
|
|
8648
|
-
* }
|
|
8649
|
-
* ```
|
|
8650
|
-
*
|
|
8651
|
-
* `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
|
|
8652
|
-
* read. Disarmed, a call site costs one load and one branch, and the `extras`
|
|
8653
|
-
* object literal is never constructed because it lives inside the branch. It
|
|
8654
|
-
* is the same shape already proven in production at `stream-broker.ts:1650`,
|
|
8655
|
-
* and the same discipline `LoggingGate.allowsDestination` uses for the
|
|
8656
|
-
* destination floor (measured at 1.93 ns/call when off).
|
|
8657
|
-
*
|
|
8658
|
-
* ## Why a channel emits at `info`
|
|
8659
|
-
*
|
|
8660
|
-
* `loki-logging.addon.ts` pins the destination default at `info` and
|
|
8661
|
-
* `loki-destination.ts` drops everything below it, so a line emitted at
|
|
8662
|
-
* `debug` never reaches Loki and the hub's in-memory ring only holds ~35
|
|
8663
|
-
* minutes. A diagnostic that cannot be read an hour later is worse than no
|
|
8664
|
-
* diagnostic, because it looks done. {@link LogChannelGate.log} therefore
|
|
8665
|
-
* emits at the channel's declared level, whose schema floor is `info`.
|
|
8666
|
-
*/
|
|
8667
|
-
/**
|
|
8668
|
-
* The level a channel writes at once armed.
|
|
8669
|
-
*
|
|
8670
|
-
* `debug` is absent ON PURPOSE and not by omission: below `info` the line does
|
|
8671
|
-
* not leave the process for Loki, and the whole point of arming a channel is
|
|
8672
|
-
* to read it later.
|
|
8673
|
-
*/
|
|
8674
|
-
var LogChannelLevelSchema = _enum([
|
|
8675
|
-
"info",
|
|
8676
|
-
"warn",
|
|
8677
|
-
"error"
|
|
8678
|
-
]);
|
|
8679
|
-
/**
|
|
8680
|
-
* What an addon declares about one channel. No value, no state — a
|
|
8681
|
-
* declaration is inert.
|
|
8682
|
-
*/
|
|
8683
|
-
var LogChannelDescriptorSchema = object({
|
|
8684
|
-
/**
|
|
8685
|
-
* Dotted `area.thing`, unique across the workspace. `area` is conventionally
|
|
8686
|
-
* the addon's short name so an operator reading a channel list can tell who
|
|
8687
|
-
* owns it without a second lookup.
|
|
8688
|
-
*/
|
|
8689
|
-
name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
|
|
8690
|
-
/** One sentence: what the operator will SEE after arming it. */
|
|
8691
|
-
description: string().min(1),
|
|
8692
|
-
/** The level its lines are emitted at. Never below `info`. */
|
|
8693
|
-
defaultLevel: LogChannelLevelSchema,
|
|
8694
|
-
/**
|
|
8695
|
-
* Whether this channel can be narrowed to a camera.
|
|
8696
|
-
*
|
|
8697
|
-
* `true` is a PROMISE with two halves, and both must hold: the gate is
|
|
8698
|
-
* consulted with the numeric device id, AND every line the channel admits
|
|
8699
|
-
* carries `tags: { deviceId }` with that same numeric id. The second half is
|
|
8700
|
-
* what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
|
|
8701
|
-
* keeps `deviceId` out of the stream labels for cardinality, so the tag in
|
|
8702
|
-
* the body is the only way to filter.
|
|
8703
|
-
*
|
|
8704
|
-
* A channel whose lines carry the device only in `meta` (or not at all) is
|
|
8705
|
-
* declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
|
|
8706
|
-
* the operator narrows to one camera, sees nothing, and concludes the code
|
|
8707
|
-
* path was never taken.
|
|
8708
|
-
*/
|
|
8709
|
-
perDevice: boolean()
|
|
8710
|
-
});
|
|
8711
|
-
/**
|
|
8712
|
-
* An armed window over one channel, as the document hands it to a mirror.
|
|
8713
|
-
*
|
|
8714
|
-
* A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
|
|
8715
|
-
* expires by itself, which is the one failure a boolean cannot avoid.
|
|
8716
|
-
*/
|
|
8717
|
-
var LogChannelWindowSchema = object({
|
|
8718
|
-
channel: string().min(1),
|
|
8719
|
-
/** Epoch ms the window closes at. */
|
|
8720
|
-
armedUntilMs: number(),
|
|
8721
|
-
/** `null` = every camera. A non-empty list narrows to those numeric ids. */
|
|
8722
|
-
deviceIds: array(number().int()).readonly().nullable()
|
|
8723
|
-
});
|
|
8724
|
-
/**
|
|
8725
|
-
* The gate a hot path holds.
|
|
8726
|
-
*
|
|
8727
|
-
* Obtain it ONCE — at module scope or in a constructor — and keep the
|
|
8728
|
-
* reference. Looking a channel up by name per line would put a Map lookup on
|
|
8729
|
-
* the path this class exists to keep free.
|
|
8730
|
-
*/
|
|
8731
|
-
var LogChannelGate = class {
|
|
8732
|
-
descriptor;
|
|
8733
|
-
/**
|
|
8734
|
-
* HOT PATH GUARD. A plain data FIELD, and it must stay one.
|
|
8735
|
-
*
|
|
8736
|
-
* `log-channel.spec.ts` asserts the property descriptor has no getter and
|
|
8737
|
-
* booby-traps the device set, so turning this into an accessor — or reading
|
|
8738
|
-
* anything before it — fails the spec instead of taxing every line the
|
|
8739
|
-
* process emits.
|
|
8740
|
-
*/
|
|
8741
|
-
on = false;
|
|
8742
|
-
/** `null` while armed for every camera. Never read while `on` is false. */
|
|
8743
|
-
devices = null;
|
|
8744
|
-
level;
|
|
8745
|
-
closesAtMs = 0;
|
|
8746
|
-
constructor(descriptor) {
|
|
8747
|
-
this.descriptor = descriptor;
|
|
8748
|
-
this.level = descriptor.defaultLevel;
|
|
8749
|
-
}
|
|
8750
|
-
/** Epoch ms this channel disarms itself at. 0 when disarmed. */
|
|
8751
|
-
get armedUntilMs() {
|
|
8752
|
-
return this.on ? this.closesAtMs : 0;
|
|
8753
|
-
}
|
|
8754
|
-
/**
|
|
8755
|
-
* Does this channel want a line about `deviceId`?
|
|
8756
|
-
*
|
|
8757
|
-
* Call it only behind `gate.on &&`. On its own it is still correct — the
|
|
8758
|
-
* guard is repeated inside — but the point of the prefix is that a disarmed
|
|
8759
|
-
* channel must not pay the call at all.
|
|
8760
|
-
*/
|
|
8761
|
-
wants(deviceId) {
|
|
8762
|
-
if (!this.on) return false;
|
|
8763
|
-
return this.devices === null || this.devices.has(deviceId);
|
|
8764
|
-
}
|
|
8765
|
-
/**
|
|
8766
|
-
* Emit one line on this channel, at the channel's declared level.
|
|
8767
|
-
*
|
|
8768
|
-
* The channel name is added as `tags.logChannel` so LogQL can select the
|
|
8769
|
-
* channel without matching on the message text, and whatever `tags` the
|
|
8770
|
-
* caller passed — `deviceId` above all — is preserved.
|
|
8771
|
-
*/
|
|
8772
|
-
log(logger, message, extras) {
|
|
8773
|
-
if (!this.on) return;
|
|
8774
|
-
const tags = {
|
|
8775
|
-
...extras.tags,
|
|
8776
|
-
logChannel: this.descriptor.name
|
|
8777
|
-
};
|
|
8778
|
-
const line = {
|
|
8779
|
-
...extras,
|
|
8780
|
-
tags
|
|
8781
|
-
};
|
|
8782
|
-
if (this.level === "error") logger.error(message, line);
|
|
8783
|
-
else if (this.level === "warn") logger.warn(message, line);
|
|
8784
|
-
else logger.info(message, line);
|
|
8785
|
-
}
|
|
8786
|
-
/**
|
|
8787
|
-
* Arm (or RE-arm, restarting) this channel. Off the hot path only.
|
|
8788
|
-
*
|
|
8789
|
-
* An empty `deviceIds` list is treated as "every camera" rather than "no
|
|
8790
|
-
* camera": a window that matches nothing is indistinguishable from a
|
|
8791
|
-
* disarmed one, and the operator who asked for it would wait for lines that
|
|
8792
|
-
* can never come.
|
|
8793
|
-
*/
|
|
8794
|
-
arm(window) {
|
|
8795
|
-
const ids = window.deviceIds;
|
|
8796
|
-
this.devices = ids === null || ids.length === 0 ? null : new Set(ids);
|
|
8797
|
-
this.closesAtMs = window.armedUntilMs;
|
|
8798
|
-
this.on = true;
|
|
8799
|
-
}
|
|
8800
|
-
/** Disarm. Off the hot path only. */
|
|
8801
|
-
disarm() {
|
|
8802
|
-
this.on = false;
|
|
8803
|
-
this.devices = null;
|
|
8804
|
-
this.closesAtMs = 0;
|
|
8805
|
-
}
|
|
8806
|
-
};
|
|
8807
|
-
/**
|
|
8808
|
-
* Every channel this PROCESS declares, and the mirror of what is armed on it.
|
|
8809
|
-
*
|
|
8810
|
-
* One per process. A forked runner has its own, and it is refreshed through
|
|
8811
|
-
* the `log-channels` capability by the hub that owns the document — the
|
|
8812
|
-
* registry never reaches for a value itself.
|
|
8813
|
-
*/
|
|
8814
|
-
var LogChannelRegistry = class {
|
|
8815
|
-
gates = /* @__PURE__ */ new Map();
|
|
8816
|
-
/**
|
|
8817
|
-
* Declare a channel and get its gate.
|
|
8818
|
-
*
|
|
8819
|
-
* A duplicate name throws. Two declarations of one name is a programming
|
|
8820
|
-
* error, not a merge: the operator would arm one and the other would stay
|
|
8821
|
-
* dark, which is the dead-knob shape (D62) with an extra step.
|
|
8822
|
-
*/
|
|
8823
|
-
declare(descriptor) {
|
|
8824
|
-
const parsed = LogChannelDescriptorSchema.parse(descriptor);
|
|
8825
|
-
if (this.gates.get(parsed.name) !== void 0) throw new Error(`log channel "${parsed.name}" is already declared in this process — two declarations of one name is a programming error, not a merge`);
|
|
8826
|
-
const gate = new LogChannelGate(parsed);
|
|
8827
|
-
this.gates.set(parsed.name, gate);
|
|
8828
|
-
return gate;
|
|
8829
|
-
}
|
|
8830
|
-
/** The declarations, sorted by name so a list is stable to read and diff. */
|
|
8831
|
-
list() {
|
|
8832
|
-
return [...this.gates.values()].map((gate) => gate.descriptor).sort((a, b) => a.name.localeCompare(b.name));
|
|
8833
|
-
}
|
|
8834
|
-
/** The gate for a declared channel, or `undefined`. */
|
|
8835
|
-
gate(name) {
|
|
8836
|
-
return this.gates.get(name);
|
|
8837
|
-
}
|
|
8838
|
-
/**
|
|
8839
|
-
* Apply the FULL set of armed windows. Off the hot path.
|
|
8840
|
-
*
|
|
8841
|
-
* Full, not incremental, and that is the whole design: the document is the
|
|
8842
|
-
* authority, so a channel the document does not name is disarmed here. An
|
|
8843
|
-
* incremental apply would let a disarm get lost in transit and leave a
|
|
8844
|
-
* channel running that nobody can see is running.
|
|
8845
|
-
*
|
|
8846
|
-
* A window already past its deadline is ignored rather than armed — a
|
|
8847
|
-
* restore that re-armed an expired window would make a forgotten diagnostic
|
|
8848
|
-
* immortal across restarts.
|
|
8849
|
-
*
|
|
8850
|
-
* Returns the names it could not place, so the caller can log them: a
|
|
8851
|
-
* channel named in the document that this process does not declare is
|
|
8852
|
-
* either a typo or an addon that has not booted yet, and both deserve a
|
|
8853
|
-
* line rather than silence.
|
|
8854
|
-
*/
|
|
8855
|
-
apply(windows, nowMs) {
|
|
8856
|
-
const wanted = /* @__PURE__ */ new Map();
|
|
8857
|
-
const unknown = [];
|
|
8858
|
-
for (const window of windows) {
|
|
8859
|
-
if (window.armedUntilMs <= nowMs) continue;
|
|
8860
|
-
if (!this.gates.has(window.channel)) {
|
|
8861
|
-
unknown.push(window.channel);
|
|
8862
|
-
continue;
|
|
8863
|
-
}
|
|
8864
|
-
wanted.set(window.channel, window);
|
|
8865
|
-
}
|
|
8866
|
-
for (const [name, gate] of this.gates) {
|
|
8867
|
-
const window = wanted.get(name);
|
|
8868
|
-
if (window === void 0) gate.disarm();
|
|
8869
|
-
else gate.arm(window);
|
|
8870
|
-
}
|
|
8871
|
-
return unknown;
|
|
8872
|
-
}
|
|
8873
|
-
/**
|
|
8874
|
-
* Disarm whatever has run out. Called on a timer, NEVER from a log path — a
|
|
8875
|
-
* diagnostic that adds a `Date.now()` to the path it is measuring measures
|
|
8876
|
-
* itself.
|
|
8877
|
-
*
|
|
8878
|
-
* Returns the names it closed, so the caller can write the one line that
|
|
8879
|
-
* says a window ended and stops "it went quiet" from reading as "the branch
|
|
8880
|
-
* was not taken".
|
|
8881
|
-
*/
|
|
8882
|
-
tick(nowMs) {
|
|
8883
|
-
const closed = [];
|
|
8884
|
-
for (const [name, gate] of this.gates) if (gate.on && gate.armedUntilMs <= nowMs) {
|
|
8885
|
-
gate.disarm();
|
|
8886
|
-
closed.push(name);
|
|
8887
|
-
}
|
|
8888
|
-
return closed;
|
|
8889
|
-
}
|
|
8890
|
-
/** The channels armed right now, as the document would describe them. */
|
|
8891
|
-
armed() {
|
|
8892
|
-
const out = [];
|
|
8893
|
-
for (const [name, gate] of this.gates) if (gate.on) out.push({
|
|
8894
|
-
channel: name,
|
|
8895
|
-
armedUntilMs: gate.armedUntilMs,
|
|
8896
|
-
deviceIds: null
|
|
8897
|
-
});
|
|
8898
|
-
return out;
|
|
8899
|
-
}
|
|
8900
|
-
};
|
|
8901
|
-
/**
|
|
8902
|
-
* Process-wide holder for the {@link LogChannelRegistry}.
|
|
8903
|
-
*
|
|
8904
|
-
* Three call sites that never meet need the SAME instance: the hot paths that
|
|
8905
|
-
* declare a gate at module scope, the `log-channels` provider that enumerates
|
|
8906
|
-
* the declarations for the hub, and the same provider applying the windows the
|
|
8907
|
-
* document hands down. A registry built inside any one of them would be
|
|
8908
|
-
* refreshed and collected — the shape of a knob that never does anything.
|
|
8909
|
-
*
|
|
8910
|
-
* Same idiom as `logging-gate.singleton.ts` and
|
|
8911
|
-
* `http-request-census.singleton.ts`.
|
|
8912
|
-
*/
|
|
8913
|
-
var instance = null;
|
|
8914
|
-
/** The process-wide log channel registry. Created empty on first use. */
|
|
8915
|
-
function getLogChannelRegistry() {
|
|
8916
|
-
instance ??= new LogChannelRegistry();
|
|
8917
|
-
return instance;
|
|
8918
|
-
}
|
|
8919
|
-
/**
|
|
8920
|
-
* Declare a channel on the process-wide registry and get its gate.
|
|
8921
|
-
*
|
|
8922
|
-
* The one call an addon makes. Keep the returned gate in a module-scope
|
|
8923
|
-
* `const`: looking a channel up by name per line would put a Map lookup on
|
|
8924
|
-
* exactly the path this mechanism exists to keep free.
|
|
8925
|
-
*
|
|
8926
|
-
* `scripts/check-log-channel-gated.ts` reads these call sites. It pairs the
|
|
8927
|
-
* declared name with the binding it is assigned to and refuses to let a
|
|
8928
|
-
* channel ship that no `<binding>.on` anywhere consults — a declared channel
|
|
8929
|
-
* nobody reads is a knob the operator turns with nothing happening, forever,
|
|
8930
|
-
* and without a line. That is D62, and this repo has now shipped it three
|
|
8931
|
-
* times (`audioThresholdDbfs`, the HA entities with no source, the second
|
|
8932
|
-
* per-camera switch that wrote a store nobody read).
|
|
8933
|
-
*/
|
|
8934
|
-
function declareLogChannel(descriptor) {
|
|
8935
|
-
return getLogChannelRegistry().declare(descriptor);
|
|
8936
|
-
}
|
|
8937
|
-
/**
|
|
8938
|
-
* Build the `log-channels` provider for this process.
|
|
8939
|
-
*
|
|
8940
|
-
* `logger` is used ONLY off the hot path — for the arm/expiry lines — so a
|
|
8941
|
-
* channel that is never armed costs this module nothing but a timer.
|
|
8942
|
-
*/
|
|
8943
|
-
function createLogChannelsProvider(logger, options = {}) {
|
|
8944
|
-
const registry = getLogChannelRegistry();
|
|
8945
|
-
const now = options.now ?? Date.now;
|
|
8946
|
-
const tickMs = options.tickMs ?? 5e3;
|
|
8947
|
-
const timer = setInterval(() => {
|
|
8948
|
-
const closed = registry.tick(now());
|
|
8949
|
-
for (const name of closed) logger.info("log channel window closed", {
|
|
8950
|
-
tags: { logChannel: name },
|
|
8951
|
-
meta: { channel: name }
|
|
8952
|
-
});
|
|
8953
|
-
}, tickMs);
|
|
8954
|
-
timer.unref?.();
|
|
8955
|
-
return {
|
|
8956
|
-
list: () => registry.list(),
|
|
8957
|
-
apply: (input) => {
|
|
8958
|
-
const unknown = registry.apply(input.windows, now());
|
|
8959
|
-
const armed = registry.armed();
|
|
8960
|
-
logger.info("log channels applied", { meta: {
|
|
8961
|
-
armed: armed.map((window) => window.channel),
|
|
8962
|
-
unknown,
|
|
8963
|
-
declared: registry.list().length
|
|
8964
|
-
} });
|
|
8965
|
-
return {
|
|
8966
|
-
armed: armed.length,
|
|
8967
|
-
unknown
|
|
8968
|
-
};
|
|
8969
|
-
},
|
|
8970
|
-
stop: () => {
|
|
8971
|
-
clearInterval(timer);
|
|
8972
|
-
}
|
|
8973
|
-
};
|
|
8974
|
-
}
|
|
8975
|
-
/**
|
|
8976
8633
|
* Ops-log — the durable, append-only operations audit shared by the
|
|
8977
8634
|
* recordings and events management surfaces.
|
|
8978
8635
|
*
|
|
@@ -10087,6 +9744,110 @@ var StorageCleanupJobSchema = object({
|
|
|
10087
9744
|
});
|
|
10088
9745
|
var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
|
|
10089
9746
|
/**
|
|
9747
|
+
* The storage-location STATE MODEL (D385) — one typed state, one policy module.
|
|
9748
|
+
*
|
|
9749
|
+
* A location's state used to be split across two authorities: the typed
|
|
9750
|
+
* `enabled` field (THE write switch since D383) and an untyped `config.readOnly`
|
|
9751
|
+
* key. They did not mean the same thing — `enabled: false` was still evicted
|
|
9752
|
+
* under disk pressure while `config.readOnly` was deliberately excluded — and
|
|
9753
|
+
* neither name said which. Every consumer re-derived the difference, and the
|
|
9754
|
+
* three questions that actually matter were answered in six places.
|
|
9755
|
+
*
|
|
9756
|
+
* This module is the ONLY place in the repo allowed to interpret the state. It
|
|
9757
|
+
* answers three questions and nothing else:
|
|
9758
|
+
*
|
|
9759
|
+
* - may this location be WRITTEN to? {@link modeMayWrite}
|
|
9760
|
+
* - may this location be READ? {@link modeMayRead}
|
|
9761
|
+
* - what is its eviction policy? {@link evictionPolicyForMode}
|
|
9762
|
+
*
|
|
9763
|
+
* | mode | write | read | eviction |
|
|
9764
|
+
* | ---------- | ----- | ---- | ------------------------------ |
|
|
9765
|
+
* | `active` | yes | yes | `normal` (pressure + usage cap) |
|
|
9766
|
+
* | `readonly` | no | yes | `never` |
|
|
9767
|
+
* | `drain` | no | yes | `drain` (paced, until empty) |
|
|
9768
|
+
* | `disabled` | no | no | `never` |
|
|
9769
|
+
*
|
|
9770
|
+
* `scripts/check-storage-location-mode-single-owner.ts` fails the build when
|
|
9771
|
+
* anything outside this module reads `config['readOnly']` or compares `enabled`
|
|
9772
|
+
* directly. A rule nothing checks has already been broken somewhere.
|
|
9773
|
+
*/
|
|
9774
|
+
var STORAGE_LOCATION_MODES = [
|
|
9775
|
+
"active",
|
|
9776
|
+
"readonly",
|
|
9777
|
+
"drain",
|
|
9778
|
+
"disabled"
|
|
9779
|
+
];
|
|
9780
|
+
/**
|
|
9781
|
+
* The one typed state of a storage location. Authoritative Zod schema — the TS
|
|
9782
|
+
* alias below is `z.infer<>` of it, never a second spelling.
|
|
9783
|
+
*/
|
|
9784
|
+
var StorageLocationModeSchema = _enum(STORAGE_LOCATION_MODES);
|
|
9785
|
+
_enum([
|
|
9786
|
+
"normal",
|
|
9787
|
+
"never",
|
|
9788
|
+
"drain"
|
|
9789
|
+
]);
|
|
9790
|
+
/** Is this mode a write target? Only `active` is. */
|
|
9791
|
+
function modeMayWrite(mode) {
|
|
9792
|
+
return mode === "active";
|
|
9793
|
+
}
|
|
9794
|
+
/** May this mode be read (playback, timeline, scrub, relocate source)? */
|
|
9795
|
+
function modeMayRead(mode) {
|
|
9796
|
+
return mode !== "disabled";
|
|
9797
|
+
}
|
|
9798
|
+
/** What eviction may do here. See {@link StorageEvictionPolicy}. */
|
|
9799
|
+
function evictionPolicyForMode(mode) {
|
|
9800
|
+
switch (mode) {
|
|
9801
|
+
case "active": return "normal";
|
|
9802
|
+
case "drain": return "drain";
|
|
9803
|
+
case "readonly":
|
|
9804
|
+
case "disabled": return "never";
|
|
9805
|
+
}
|
|
9806
|
+
}
|
|
9807
|
+
/**
|
|
9808
|
+
* The mode a LEGACY row implies, or `null` when it implies nothing — the row is
|
|
9809
|
+
* already stamped, or it carried neither flag.
|
|
9810
|
+
*
|
|
9811
|
+
* Both legacy flags fold to `readonly`, which is the CONSERVATIVE direction: a
|
|
9812
|
+
* state change must never start deleting footage on its own, and it must never
|
|
9813
|
+
* make footage that was still being served disappear. `enabled: false` used to
|
|
9814
|
+
* leave the location evictable under pressure; folding it to `readonly` stops
|
|
9815
|
+
* that, which is a strictly safer answer than the one it replaces.
|
|
9816
|
+
*/
|
|
9817
|
+
function legacyModeOf(location) {
|
|
9818
|
+
if (location.mode !== void 0) return null;
|
|
9819
|
+
if (location.config["readOnly"] === true) return "readonly";
|
|
9820
|
+
if (location.enabled === false) return "readonly";
|
|
9821
|
+
return null;
|
|
9822
|
+
}
|
|
9823
|
+
/**
|
|
9824
|
+
* The state of a location, stamped or folded. THE one interpretation: a row
|
|
9825
|
+
* that predates D385 is never ambiguous, and a stamped `mode` always wins over
|
|
9826
|
+
* whatever the legacy pair still says.
|
|
9827
|
+
*/
|
|
9828
|
+
function resolveLocationMode(location) {
|
|
9829
|
+
return (isStorageLocationMode(location.mode) ? location.mode : void 0) ?? legacyModeOf(location) ?? "active";
|
|
9830
|
+
}
|
|
9831
|
+
/** Is this one of the four states? The stamped value crosses a wire, and a
|
|
9832
|
+
* value nobody defined must not be rendered as if it were a state. */
|
|
9833
|
+
function isStorageLocationMode(value) {
|
|
9834
|
+
return STORAGE_LOCATION_MODES.some((mode) => mode === value);
|
|
9835
|
+
}
|
|
9836
|
+
/** May this location be written to? */
|
|
9837
|
+
function mayWriteToLocation(location) {
|
|
9838
|
+
return modeMayWrite(resolveLocationMode(location));
|
|
9839
|
+
}
|
|
9840
|
+
/** May this location be read? A `disabled` one may not — and that is an
|
|
9841
|
+
* operator CHOICE, which callers must report as unavailable rather than as an
|
|
9842
|
+
* unknown-location fault. */
|
|
9843
|
+
function mayReadLocation(location) {
|
|
9844
|
+
return modeMayRead(resolveLocationMode(location));
|
|
9845
|
+
}
|
|
9846
|
+
/** What eviction may do to this location. */
|
|
9847
|
+
function evictionPolicyOfLocation(location) {
|
|
9848
|
+
return evictionPolicyForMode(resolveLocationMode(location));
|
|
9849
|
+
}
|
|
9850
|
+
/**
|
|
10090
9851
|
* `StorageLocationType` — an addon-declared id that identifies the *kind* of
|
|
10091
9852
|
* storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
|
|
10092
9853
|
* so the persisted record schema and the consumer-facing cap can both consume it
|
|
@@ -10111,8 +9872,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
|
|
|
10111
9872
|
* `STORAGE_LOCATION_CARDINALITY` map has been removed.
|
|
10112
9873
|
*
|
|
10113
9874
|
* `id` is a stable namespaced string of the form `<type>:<slug>`.
|
|
10114
|
-
* The
|
|
10115
|
-
*
|
|
9875
|
+
* The seed names its first instance `<type>:default` — a NAME, not a flag.
|
|
9876
|
+
* There is no default location any more (D383): `enabled` is the whole write
|
|
9877
|
+
* model, and a bare type ref resolves to the sole location of the type, or —
|
|
9878
|
+
* transitionally, only while legacy NULL-stamped rows exist — to the row whose
|
|
9879
|
+
* slug is `default`.
|
|
10116
9880
|
*
|
|
10117
9881
|
* `isSystem` is a legacy persisted flag. Seed still creates the initial
|
|
10118
9882
|
* `<type>:default` locations; the flag is no longer a lock, a badge, or a
|
|
@@ -10133,23 +9897,37 @@ var StorageLocationSchema = object({
|
|
|
10133
9897
|
* flag at upsert time, not here (the schema is provider-agnostic).
|
|
10134
9898
|
*/
|
|
10135
9899
|
nodeId: string().optional(),
|
|
10136
|
-
isDefault: boolean().default(false),
|
|
10137
9900
|
isSystem: boolean().default(false),
|
|
10138
9901
|
/**
|
|
10139
|
-
*
|
|
10140
|
-
*
|
|
10141
|
-
*
|
|
10142
|
-
*
|
|
10143
|
-
*
|
|
9902
|
+
* THE write switch, and the only one (D383). `enabled: true` means every
|
|
9903
|
+
* consumer that chooses a write target for this type may write here, and all
|
|
9904
|
+
* enabled locations of a type are used TOGETHER; `false` means read-only —
|
|
9905
|
+
* still read, still played back, still age-swept, still drained, never
|
|
9906
|
+
* written.
|
|
10144
9907
|
*
|
|
10145
|
-
* OPTIONAL
|
|
10146
|
-
*
|
|
10147
|
-
*
|
|
10148
|
-
*
|
|
10149
|
-
*
|
|
10150
|
-
*
|
|
9908
|
+
* OPTIONAL only for the wire: an upsert that omits it means "leave what is
|
|
9909
|
+
* stored" on an update and "born inert unless it is the first location of its
|
|
9910
|
+
* type" on a create. On a PERSISTED row absence is legacy and it means
|
|
9911
|
+
* enabled — {@link isLocationEnabled} is the one place that says so, and the
|
|
9912
|
+
* orchestrator stamps every flagless row `true` once at hydrate so absence
|
|
9913
|
+
* stops existing rather than being re-derived on every read.
|
|
10151
9914
|
*/
|
|
10152
9915
|
enabled: boolean().optional(),
|
|
9916
|
+
/**
|
|
9917
|
+
* THE state of this location (D385), and the only authority on what may be
|
|
9918
|
+
* written, read or evicted here. Interpreted in exactly one place —
|
|
9919
|
+
* `storage-location-mode.ts` — which also folds the legacy
|
|
9920
|
+
* `enabled` / `config.readOnly` pair into a mode so an old row is never
|
|
9921
|
+
* ambiguous.
|
|
9922
|
+
*
|
|
9923
|
+
* OPTIONAL only for the wire and for rows written before D385: absence is
|
|
9924
|
+
* resolved by `resolveLocationMode`, and the orchestrator stamps every
|
|
9925
|
+
* unstamped row ONCE at hydrate so absence stops existing rather than being
|
|
9926
|
+
* re-derived on every read. `enabled` survives one release as a DERIVED
|
|
9927
|
+
* mirror (`mode === 'active'`); `withLocationMode` is the only writer of
|
|
9928
|
+
* either, so the two cannot disagree.
|
|
9929
|
+
*/
|
|
9930
|
+
mode: StorageLocationModeSchema.optional(),
|
|
10153
9931
|
/** COMPUTED at read time by the orchestrator (statfs of the backing volume
|
|
10154
9932
|
* for node-local locations it can reach) — never persisted, absent when the
|
|
10155
9933
|
* volume is remote/unreachable. The single capacity truth every UI reads. */
|
|
@@ -10157,13 +9935,66 @@ var StorageLocationSchema = object({
|
|
|
10157
9935
|
totalBytes: number(),
|
|
10158
9936
|
availableBytes: number()
|
|
10159
9937
|
}).nullable().optional(),
|
|
9938
|
+
/**
|
|
9939
|
+
* How much of that volume CamStack ITSELF holds on this location (D388) —
|
|
9940
|
+
* COMPUTED at read time from the `storage-occupancy` providers' own figures,
|
|
9941
|
+
* never persisted, never a filesystem walk.
|
|
9942
|
+
*
|
|
9943
|
+
* **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
|
|
9944
|
+
* location yet — nobody stores here, the owning addon is down, or the first
|
|
9945
|
+
* refresh has not completed. A UI must omit the segment rather than draw it
|
|
9946
|
+
* at zero, which would claim we occupy nothing (D315). It is an OBJECT and
|
|
9947
|
+
* not a bare number precisely so that a `?? 0` on the consuming side has to
|
|
9948
|
+
* be spelled out loud instead of appearing by accident.
|
|
9949
|
+
*
|
|
9950
|
+
* `measuredAtMs` is the OLDEST contributing measurement, so it is honest
|
|
9951
|
+
* about the whole figure rather than about its freshest part.
|
|
9952
|
+
*/
|
|
9953
|
+
owned: object({
|
|
9954
|
+
bytes: number().int().nonnegative(),
|
|
9955
|
+
measuredAtMs: number().int().nonnegative()
|
|
9956
|
+
}).optional(),
|
|
10160
9957
|
createdAt: number(),
|
|
10161
9958
|
updatedAt: number()
|
|
10162
9959
|
});
|
|
9960
|
+
object({ isDefault: boolean().optional() });
|
|
9961
|
+
/**
|
|
9962
|
+
* Bytes in one GB, for every storage figure an operator types.
|
|
9963
|
+
*
|
|
9964
|
+
* BINARY (1024³), everywhere. The repo had both: the orchestrator's
|
|
9965
|
+
* `maxUsedGb` → bytes conversion used 1024³ while the recorder's placement
|
|
9966
|
+
* headroom used 10⁹ for the SAME stored key, so a location with a cap set was
|
|
9967
|
+
* silently 7.4% off depending on which side of the pipe asked. The persisted
|
|
9968
|
+
* values were entered against the binary unit and the admin UI reads it, so
|
|
9969
|
+
* that is the one that stays. Every GB knob — `maxUsedGb`, `minFreeGb` —
|
|
9970
|
+
* converts through {@link gbToBytes} and nowhere else.
|
|
9971
|
+
*/
|
|
9972
|
+
var STORAGE_BYTES_PER_GB = 1024 ** 3;
|
|
9973
|
+
/** GB → bytes, binary. Fractional GB is admitted and floored. */
|
|
9974
|
+
function gbToBytes(gb) {
|
|
9975
|
+
return Math.floor(gb * STORAGE_BYTES_PER_GB);
|
|
9976
|
+
}
|
|
9977
|
+
/**
|
|
9978
|
+
* How far a `drain` has got (D386) — the read a UI renders, and nothing more.
|
|
9979
|
+
*
|
|
9980
|
+
* `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
|
|
9981
|
+
* OBSERVED and is `null` when it has observed none. Never a fabricated date: a
|
|
9982
|
+
* drain with no observed growth has no honest ETA, and inventing one is how an
|
|
9983
|
+
* operator learns not to believe the screen.
|
|
9984
|
+
*/
|
|
9985
|
+
var StorageDrainProgressSchema = object({
|
|
9986
|
+
locationId: string(),
|
|
9987
|
+
startedAtMs: number(),
|
|
9988
|
+
startBytes: number(),
|
|
9989
|
+
bytesRemaining: number(),
|
|
9990
|
+
drained: boolean(),
|
|
9991
|
+
estimatedEmptyAtMs: number().nullable()
|
|
9992
|
+
});
|
|
10163
9993
|
/**
|
|
10164
9994
|
* Reference accepted by consumer-facing `api.storage.*` calls.
|
|
10165
9995
|
* Either:
|
|
10166
|
-
* - a `StorageLocationType` (e.g. `'backups'`) →
|
|
9996
|
+
* - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
|
|
9997
|
+
* (transitionally, the `<type>:default`-slugged row when several exist)
|
|
10167
9998
|
* - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
|
|
10168
9999
|
*
|
|
10169
10000
|
* The orchestrator's `resolveRef(ref)` handles both cases.
|
|
@@ -10340,6 +10171,362 @@ var DecoderSessionConfigSchema = object({
|
|
|
10340
10171
|
debug: boolean().optional()
|
|
10341
10172
|
});
|
|
10342
10173
|
/**
|
|
10174
|
+
* Per-component log CHANNELS — the gate a hot path consults, and the registry
|
|
10175
|
+
* an addon declares its channels in.
|
|
10176
|
+
*
|
|
10177
|
+
* ## Two axes, deliberately separated
|
|
10178
|
+
*
|
|
10179
|
+
* - **DECLARATION** — which channels exist. Only the addon knows:
|
|
10180
|
+
* `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
|
|
10181
|
+
* baichuan/handshake. A hand-wired central list rots at the first addition,
|
|
10182
|
+
* and rots silently. So a channel is declared where it is consulted, and the
|
|
10183
|
+
* `log-channels` capability enumerates the declarations.
|
|
10184
|
+
* - **VALUE** — at which level, for which scope, until when. That stays ONE
|
|
10185
|
+
* thing: the logging settings document on the `system` cap. Two authorities
|
|
10186
|
+
* over the values is the exact defect
|
|
10187
|
+
* `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
|
|
10188
|
+
* remove; re-introducing it from the cure side would be grotesque.
|
|
10189
|
+
*
|
|
10190
|
+
* Nothing in this file reads a clock, an env var or a store. The registry is
|
|
10191
|
+
* a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
|
|
10192
|
+
* the hot path with a value somebody actually read, and by
|
|
10193
|
+
* {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
|
|
10194
|
+
* never reaches here, so it can neither disarm an armed channel nor arm a
|
|
10195
|
+
* disarmed one (D49).
|
|
10196
|
+
*
|
|
10197
|
+
* ## The canonical call shape
|
|
10198
|
+
*
|
|
10199
|
+
* ```ts
|
|
10200
|
+
* if (CH_RTP.on && CH_RTP.wants(deviceId)) {
|
|
10201
|
+
* CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
|
|
10202
|
+
* }
|
|
10203
|
+
* ```
|
|
10204
|
+
*
|
|
10205
|
+
* `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
|
|
10206
|
+
* read. Disarmed, a call site costs one load and one branch, and the `extras`
|
|
10207
|
+
* object literal is never constructed because it lives inside the branch. It
|
|
10208
|
+
* is the same shape already proven in production at `stream-broker.ts:1650`,
|
|
10209
|
+
* and the same discipline `LoggingGate.allowsDestination` uses for the
|
|
10210
|
+
* destination floor (measured at 1.93 ns/call when off).
|
|
10211
|
+
*
|
|
10212
|
+
* ## Why a channel emits at `info`
|
|
10213
|
+
*
|
|
10214
|
+
* `loki-logging.addon.ts` pins the destination default at `info` and
|
|
10215
|
+
* `loki-destination.ts` drops everything below it, so a line emitted at
|
|
10216
|
+
* `debug` never reaches Loki and the hub's in-memory ring only holds ~35
|
|
10217
|
+
* minutes. A diagnostic that cannot be read an hour later is worse than no
|
|
10218
|
+
* diagnostic, because it looks done. {@link LogChannelGate.log} therefore
|
|
10219
|
+
* emits at the channel's declared level, whose schema floor is `info`.
|
|
10220
|
+
*/
|
|
10221
|
+
/**
|
|
10222
|
+
* The level a channel writes at once armed.
|
|
10223
|
+
*
|
|
10224
|
+
* `debug` is absent ON PURPOSE and not by omission: below `info` the line does
|
|
10225
|
+
* not leave the process for Loki, and the whole point of arming a channel is
|
|
10226
|
+
* to read it later.
|
|
10227
|
+
*/
|
|
10228
|
+
var LogChannelLevelSchema = _enum([
|
|
10229
|
+
"info",
|
|
10230
|
+
"warn",
|
|
10231
|
+
"error"
|
|
10232
|
+
]);
|
|
10233
|
+
/**
|
|
10234
|
+
* What an addon declares about one channel. No value, no state — a
|
|
10235
|
+
* declaration is inert.
|
|
10236
|
+
*/
|
|
10237
|
+
var LogChannelDescriptorSchema = object({
|
|
10238
|
+
/**
|
|
10239
|
+
* Dotted `area.thing`, unique across the workspace. `area` is conventionally
|
|
10240
|
+
* the addon's short name so an operator reading a channel list can tell who
|
|
10241
|
+
* owns it without a second lookup.
|
|
10242
|
+
*/
|
|
10243
|
+
name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
|
|
10244
|
+
/** One sentence: what the operator will SEE after arming it. */
|
|
10245
|
+
description: string().min(1),
|
|
10246
|
+
/** The level its lines are emitted at. Never below `info`. */
|
|
10247
|
+
defaultLevel: LogChannelLevelSchema,
|
|
10248
|
+
/**
|
|
10249
|
+
* Whether this channel can be narrowed to a camera.
|
|
10250
|
+
*
|
|
10251
|
+
* `true` is a PROMISE with two halves, and both must hold: the gate is
|
|
10252
|
+
* consulted with the numeric device id, AND every line the channel admits
|
|
10253
|
+
* carries `tags: { deviceId }` with that same numeric id. The second half is
|
|
10254
|
+
* what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
|
|
10255
|
+
* keeps `deviceId` out of the stream labels for cardinality, so the tag in
|
|
10256
|
+
* the body is the only way to filter.
|
|
10257
|
+
*
|
|
10258
|
+
* A channel whose lines carry the device only in `meta` (or not at all) is
|
|
10259
|
+
* declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
|
|
10260
|
+
* the operator narrows to one camera, sees nothing, and concludes the code
|
|
10261
|
+
* path was never taken.
|
|
10262
|
+
*/
|
|
10263
|
+
perDevice: boolean()
|
|
10264
|
+
});
|
|
10265
|
+
/**
|
|
10266
|
+
* An armed window over one channel, as the document hands it to a mirror.
|
|
10267
|
+
*
|
|
10268
|
+
* A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
|
|
10269
|
+
* expires by itself, which is the one failure a boolean cannot avoid.
|
|
10270
|
+
*/
|
|
10271
|
+
var LogChannelWindowSchema = object({
|
|
10272
|
+
channel: string().min(1),
|
|
10273
|
+
/** Epoch ms the window closes at. */
|
|
10274
|
+
armedUntilMs: number(),
|
|
10275
|
+
/** `null` = every camera. A non-empty list narrows to those numeric ids. */
|
|
10276
|
+
deviceIds: array(number().int()).readonly().nullable()
|
|
10277
|
+
});
|
|
10278
|
+
/**
|
|
10279
|
+
* The gate a hot path holds.
|
|
10280
|
+
*
|
|
10281
|
+
* Obtain it ONCE — at module scope or in a constructor — and keep the
|
|
10282
|
+
* reference. Looking a channel up by name per line would put a Map lookup on
|
|
10283
|
+
* the path this class exists to keep free.
|
|
10284
|
+
*/
|
|
10285
|
+
var LogChannelGate = class {
|
|
10286
|
+
descriptor;
|
|
10287
|
+
/**
|
|
10288
|
+
* HOT PATH GUARD. A plain data FIELD, and it must stay one.
|
|
10289
|
+
*
|
|
10290
|
+
* `log-channel.spec.ts` asserts the property descriptor has no getter and
|
|
10291
|
+
* booby-traps the device set, so turning this into an accessor — or reading
|
|
10292
|
+
* anything before it — fails the spec instead of taxing every line the
|
|
10293
|
+
* process emits.
|
|
10294
|
+
*/
|
|
10295
|
+
on = false;
|
|
10296
|
+
/** `null` while armed for every camera. Never read while `on` is false. */
|
|
10297
|
+
devices = null;
|
|
10298
|
+
level;
|
|
10299
|
+
closesAtMs = 0;
|
|
10300
|
+
constructor(descriptor) {
|
|
10301
|
+
this.descriptor = descriptor;
|
|
10302
|
+
this.level = descriptor.defaultLevel;
|
|
10303
|
+
}
|
|
10304
|
+
/** Epoch ms this channel disarms itself at. 0 when disarmed. */
|
|
10305
|
+
get armedUntilMs() {
|
|
10306
|
+
return this.on ? this.closesAtMs : 0;
|
|
10307
|
+
}
|
|
10308
|
+
/**
|
|
10309
|
+
* Does this channel want a line about `deviceId`?
|
|
10310
|
+
*
|
|
10311
|
+
* Call it only behind `gate.on &&`. On its own it is still correct — the
|
|
10312
|
+
* guard is repeated inside — but the point of the prefix is that a disarmed
|
|
10313
|
+
* channel must not pay the call at all.
|
|
10314
|
+
*/
|
|
10315
|
+
wants(deviceId) {
|
|
10316
|
+
if (!this.on) return false;
|
|
10317
|
+
return this.devices === null || this.devices.has(deviceId);
|
|
10318
|
+
}
|
|
10319
|
+
/**
|
|
10320
|
+
* Emit one line on this channel, at the channel's declared level.
|
|
10321
|
+
*
|
|
10322
|
+
* The channel name is added as `tags.logChannel` so LogQL can select the
|
|
10323
|
+
* channel without matching on the message text, and whatever `tags` the
|
|
10324
|
+
* caller passed — `deviceId` above all — is preserved.
|
|
10325
|
+
*/
|
|
10326
|
+
log(logger, message, extras) {
|
|
10327
|
+
if (!this.on) return;
|
|
10328
|
+
const tags = {
|
|
10329
|
+
...extras.tags,
|
|
10330
|
+
logChannel: this.descriptor.name
|
|
10331
|
+
};
|
|
10332
|
+
const line = {
|
|
10333
|
+
...extras,
|
|
10334
|
+
tags
|
|
10335
|
+
};
|
|
10336
|
+
if (this.level === "error") logger.error(message, line);
|
|
10337
|
+
else if (this.level === "warn") logger.warn(message, line);
|
|
10338
|
+
else logger.info(message, line);
|
|
10339
|
+
}
|
|
10340
|
+
/**
|
|
10341
|
+
* Arm (or RE-arm, restarting) this channel. Off the hot path only.
|
|
10342
|
+
*
|
|
10343
|
+
* An empty `deviceIds` list is treated as "every camera" rather than "no
|
|
10344
|
+
* camera": a window that matches nothing is indistinguishable from a
|
|
10345
|
+
* disarmed one, and the operator who asked for it would wait for lines that
|
|
10346
|
+
* can never come.
|
|
10347
|
+
*/
|
|
10348
|
+
arm(window) {
|
|
10349
|
+
const ids = window.deviceIds;
|
|
10350
|
+
this.devices = ids === null || ids.length === 0 ? null : new Set(ids);
|
|
10351
|
+
this.closesAtMs = window.armedUntilMs;
|
|
10352
|
+
this.on = true;
|
|
10353
|
+
}
|
|
10354
|
+
/** Disarm. Off the hot path only. */
|
|
10355
|
+
disarm() {
|
|
10356
|
+
this.on = false;
|
|
10357
|
+
this.devices = null;
|
|
10358
|
+
this.closesAtMs = 0;
|
|
10359
|
+
}
|
|
10360
|
+
};
|
|
10361
|
+
/**
|
|
10362
|
+
* Every channel this PROCESS declares, and the mirror of what is armed on it.
|
|
10363
|
+
*
|
|
10364
|
+
* One per process. A forked runner has its own, and it is refreshed through
|
|
10365
|
+
* the `log-channels` capability by the hub that owns the document — the
|
|
10366
|
+
* registry never reaches for a value itself.
|
|
10367
|
+
*/
|
|
10368
|
+
var LogChannelRegistry = class {
|
|
10369
|
+
gates = /* @__PURE__ */ new Map();
|
|
10370
|
+
/**
|
|
10371
|
+
* Declare a channel and get its gate.
|
|
10372
|
+
*
|
|
10373
|
+
* A duplicate name throws. Two declarations of one name is a programming
|
|
10374
|
+
* error, not a merge: the operator would arm one and the other would stay
|
|
10375
|
+
* dark, which is the dead-knob shape (D62) with an extra step.
|
|
10376
|
+
*/
|
|
10377
|
+
declare(descriptor) {
|
|
10378
|
+
const parsed = LogChannelDescriptorSchema.parse(descriptor);
|
|
10379
|
+
if (this.gates.get(parsed.name) !== void 0) throw new Error(`log channel "${parsed.name}" is already declared in this process — two declarations of one name is a programming error, not a merge`);
|
|
10380
|
+
const gate = new LogChannelGate(parsed);
|
|
10381
|
+
this.gates.set(parsed.name, gate);
|
|
10382
|
+
return gate;
|
|
10383
|
+
}
|
|
10384
|
+
/** The declarations, sorted by name so a list is stable to read and diff. */
|
|
10385
|
+
list() {
|
|
10386
|
+
return [...this.gates.values()].map((gate) => gate.descriptor).sort((a, b) => a.name.localeCompare(b.name));
|
|
10387
|
+
}
|
|
10388
|
+
/** The gate for a declared channel, or `undefined`. */
|
|
10389
|
+
gate(name) {
|
|
10390
|
+
return this.gates.get(name);
|
|
10391
|
+
}
|
|
10392
|
+
/**
|
|
10393
|
+
* Apply the FULL set of armed windows. Off the hot path.
|
|
10394
|
+
*
|
|
10395
|
+
* Full, not incremental, and that is the whole design: the document is the
|
|
10396
|
+
* authority, so a channel the document does not name is disarmed here. An
|
|
10397
|
+
* incremental apply would let a disarm get lost in transit and leave a
|
|
10398
|
+
* channel running that nobody can see is running.
|
|
10399
|
+
*
|
|
10400
|
+
* A window already past its deadline is ignored rather than armed — a
|
|
10401
|
+
* restore that re-armed an expired window would make a forgotten diagnostic
|
|
10402
|
+
* immortal across restarts.
|
|
10403
|
+
*
|
|
10404
|
+
* Returns the names it could not place, so the caller can log them: a
|
|
10405
|
+
* channel named in the document that this process does not declare is
|
|
10406
|
+
* either a typo or an addon that has not booted yet, and both deserve a
|
|
10407
|
+
* line rather than silence.
|
|
10408
|
+
*/
|
|
10409
|
+
apply(windows, nowMs) {
|
|
10410
|
+
const wanted = /* @__PURE__ */ new Map();
|
|
10411
|
+
const unknown = [];
|
|
10412
|
+
for (const window of windows) {
|
|
10413
|
+
if (window.armedUntilMs <= nowMs) continue;
|
|
10414
|
+
if (!this.gates.has(window.channel)) {
|
|
10415
|
+
unknown.push(window.channel);
|
|
10416
|
+
continue;
|
|
10417
|
+
}
|
|
10418
|
+
wanted.set(window.channel, window);
|
|
10419
|
+
}
|
|
10420
|
+
for (const [name, gate] of this.gates) {
|
|
10421
|
+
const window = wanted.get(name);
|
|
10422
|
+
if (window === void 0) gate.disarm();
|
|
10423
|
+
else gate.arm(window);
|
|
10424
|
+
}
|
|
10425
|
+
return unknown;
|
|
10426
|
+
}
|
|
10427
|
+
/**
|
|
10428
|
+
* Disarm whatever has run out. Called on a timer, NEVER from a log path — a
|
|
10429
|
+
* diagnostic that adds a `Date.now()` to the path it is measuring measures
|
|
10430
|
+
* itself.
|
|
10431
|
+
*
|
|
10432
|
+
* Returns the names it closed, so the caller can write the one line that
|
|
10433
|
+
* says a window ended and stops "it went quiet" from reading as "the branch
|
|
10434
|
+
* was not taken".
|
|
10435
|
+
*/
|
|
10436
|
+
tick(nowMs) {
|
|
10437
|
+
const closed = [];
|
|
10438
|
+
for (const [name, gate] of this.gates) if (gate.on && gate.armedUntilMs <= nowMs) {
|
|
10439
|
+
gate.disarm();
|
|
10440
|
+
closed.push(name);
|
|
10441
|
+
}
|
|
10442
|
+
return closed;
|
|
10443
|
+
}
|
|
10444
|
+
/** The channels armed right now, as the document would describe them. */
|
|
10445
|
+
armed() {
|
|
10446
|
+
const out = [];
|
|
10447
|
+
for (const [name, gate] of this.gates) if (gate.on) out.push({
|
|
10448
|
+
channel: name,
|
|
10449
|
+
armedUntilMs: gate.armedUntilMs,
|
|
10450
|
+
deviceIds: null
|
|
10451
|
+
});
|
|
10452
|
+
return out;
|
|
10453
|
+
}
|
|
10454
|
+
};
|
|
10455
|
+
/**
|
|
10456
|
+
* Process-wide holder for the {@link LogChannelRegistry}.
|
|
10457
|
+
*
|
|
10458
|
+
* Three call sites that never meet need the SAME instance: the hot paths that
|
|
10459
|
+
* declare a gate at module scope, the `log-channels` provider that enumerates
|
|
10460
|
+
* the declarations for the hub, and the same provider applying the windows the
|
|
10461
|
+
* document hands down. A registry built inside any one of them would be
|
|
10462
|
+
* refreshed and collected — the shape of a knob that never does anything.
|
|
10463
|
+
*
|
|
10464
|
+
* Same idiom as `logging-gate.singleton.ts` and
|
|
10465
|
+
* `http-request-census.singleton.ts`.
|
|
10466
|
+
*/
|
|
10467
|
+
var instance = null;
|
|
10468
|
+
/** The process-wide log channel registry. Created empty on first use. */
|
|
10469
|
+
function getLogChannelRegistry() {
|
|
10470
|
+
instance ??= new LogChannelRegistry();
|
|
10471
|
+
return instance;
|
|
10472
|
+
}
|
|
10473
|
+
/**
|
|
10474
|
+
* Declare a channel on the process-wide registry and get its gate.
|
|
10475
|
+
*
|
|
10476
|
+
* The one call an addon makes. Keep the returned gate in a module-scope
|
|
10477
|
+
* `const`: looking a channel up by name per line would put a Map lookup on
|
|
10478
|
+
* exactly the path this mechanism exists to keep free.
|
|
10479
|
+
*
|
|
10480
|
+
* `scripts/check-log-channel-gated.ts` reads these call sites. It pairs the
|
|
10481
|
+
* declared name with the binding it is assigned to and refuses to let a
|
|
10482
|
+
* channel ship that no `<binding>.on` anywhere consults — a declared channel
|
|
10483
|
+
* nobody reads is a knob the operator turns with nothing happening, forever,
|
|
10484
|
+
* and without a line. That is D62, and this repo has now shipped it three
|
|
10485
|
+
* times (`audioThresholdDbfs`, the HA entities with no source, the second
|
|
10486
|
+
* per-camera switch that wrote a store nobody read).
|
|
10487
|
+
*/
|
|
10488
|
+
function declareLogChannel(descriptor) {
|
|
10489
|
+
return getLogChannelRegistry().declare(descriptor);
|
|
10490
|
+
}
|
|
10491
|
+
/**
|
|
10492
|
+
* Build the `log-channels` provider for this process.
|
|
10493
|
+
*
|
|
10494
|
+
* `logger` is used ONLY off the hot path — for the arm/expiry lines — so a
|
|
10495
|
+
* channel that is never armed costs this module nothing but a timer.
|
|
10496
|
+
*/
|
|
10497
|
+
function createLogChannelsProvider(logger, options = {}) {
|
|
10498
|
+
const registry = getLogChannelRegistry();
|
|
10499
|
+
const now = options.now ?? Date.now;
|
|
10500
|
+
const tickMs = options.tickMs ?? 5e3;
|
|
10501
|
+
const timer = setInterval(() => {
|
|
10502
|
+
const closed = registry.tick(now());
|
|
10503
|
+
for (const name of closed) logger.info("log channel window closed", {
|
|
10504
|
+
tags: { logChannel: name },
|
|
10505
|
+
meta: { channel: name }
|
|
10506
|
+
});
|
|
10507
|
+
}, tickMs);
|
|
10508
|
+
timer.unref?.();
|
|
10509
|
+
return {
|
|
10510
|
+
list: () => registry.list(),
|
|
10511
|
+
apply: (input) => {
|
|
10512
|
+
const unknown = registry.apply(input.windows, now());
|
|
10513
|
+
const armed = registry.armed();
|
|
10514
|
+
logger.info("log channels applied", { meta: {
|
|
10515
|
+
armed: armed.map((window) => window.channel),
|
|
10516
|
+
unknown,
|
|
10517
|
+
declared: registry.list().length
|
|
10518
|
+
} });
|
|
10519
|
+
return {
|
|
10520
|
+
armed: armed.length,
|
|
10521
|
+
unknown
|
|
10522
|
+
};
|
|
10523
|
+
},
|
|
10524
|
+
stop: () => {
|
|
10525
|
+
clearInterval(timer);
|
|
10526
|
+
}
|
|
10527
|
+
};
|
|
10528
|
+
}
|
|
10529
|
+
/**
|
|
10343
10530
|
* Distinct (device, family, variant) counters one instance will hold.
|
|
10344
10531
|
*
|
|
10345
10532
|
* A large fleet x the handful of families any single addon reports, with
|
|
@@ -24331,7 +24518,7 @@ method(object({
|
|
|
24331
24518
|
downloadId: string(),
|
|
24332
24519
|
offset: number(),
|
|
24333
24520
|
length: number()
|
|
24334
|
-
}), _instanceof(Uint8Array)), method(object({ downloadId: string() }), _void(), { kind: "mutation" }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(
|
|
24521
|
+
}), _instanceof(Uint8Array)), method(object({ downloadId: string() }), _void(), { kind: "mutation" }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
|
|
24335
24522
|
createdAt: true,
|
|
24336
24523
|
updatedAt: true
|
|
24337
24524
|
}), StorageLocationSchema, {
|
|
@@ -24343,7 +24530,7 @@ method(object({
|
|
|
24343
24530
|
}), _void(), {
|
|
24344
24531
|
kind: "mutation",
|
|
24345
24532
|
auth: "admin"
|
|
24346
|
-
}), method(object({ id: string() }), object({
|
|
24533
|
+
}), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
|
|
24347
24534
|
ok: boolean(),
|
|
24348
24535
|
error: string().optional()
|
|
24349
24536
|
}), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
|
|
@@ -24435,6 +24622,71 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
|
|
|
24435
24622
|
kind: "mutation",
|
|
24436
24623
|
auth: "admin"
|
|
24437
24624
|
}), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
|
|
24625
|
+
/**
|
|
24626
|
+
* `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
|
|
24627
|
+
* location (D388).
|
|
24628
|
+
*
|
|
24629
|
+
* ## Why this is not `storage-evictable`
|
|
24630
|
+
*
|
|
24631
|
+
* `storage-evictable.getEvictableUsage` looks like the same question and is
|
|
24632
|
+
* not, in two ways that both matter and both bite hardest on the locations an
|
|
24633
|
+
* operator most wants a figure for:
|
|
24634
|
+
*
|
|
24635
|
+
* - it reports the whole eviction DOMAIN, not the location. `recordings:default`
|
|
24636
|
+
* and `recordingsLow:default` deliberately share one root and evict as one
|
|
24637
|
+
* oldest-first pool, so both answer with the SAME combined total. As an
|
|
24638
|
+
* occupancy figure that double-counts the disk.
|
|
24639
|
+
* - it reports ZERO for a location whose eviction policy is `never` (D385) —
|
|
24640
|
+
* a `readonly` or `disabled` disk. Those are exactly the disks an operator
|
|
24641
|
+
* is retiring and staring at.
|
|
24642
|
+
*
|
|
24643
|
+
* So this is its own contract with its own quantity, and the quantity is
|
|
24644
|
+
* OCCUPIED: every byte the addon holds on that location, whether or not it
|
|
24645
|
+
* would ever be willing to delete it. A provider that can only answer
|
|
24646
|
+
* "evictable" must not register here — a number that silently means different
|
|
24647
|
+
* things per class is worse than no number.
|
|
24648
|
+
*
|
|
24649
|
+
* ## Absence is an answer
|
|
24650
|
+
*
|
|
24651
|
+
* A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
|
|
24652
|
+
* stamps `StorageLocation.owned` only for locations it has a report for, and
|
|
24653
|
+
* the field is an OBJECT rather than a bare number so that a `?? 0` on the
|
|
24654
|
+
* consuming side has to be written out loud instead of appearing by accident.
|
|
24655
|
+
*
|
|
24656
|
+
* `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
|
|
24657
|
+
* a public client surface. Clients read the stamped `StorageLocation.owned`.
|
|
24658
|
+
*/
|
|
24659
|
+
/** One provider's occupancy answer for one location. */
|
|
24660
|
+
var StorageOccupancyReportSchema = object({
|
|
24661
|
+
locationId: string(),
|
|
24662
|
+
/** Bytes this provider holds on THAT location — not its eviction domain, and
|
|
24663
|
+
* not net of what it is willing to delete. */
|
|
24664
|
+
ownedBytes: number().int().nonnegative(),
|
|
24665
|
+
/** When the provider last actually measured this. The orchestrator carries it
|
|
24666
|
+
* through so a UI can say how old the figure is instead of implying "now". */
|
|
24667
|
+
measuredAtMs: number().int().nonnegative()
|
|
24668
|
+
});
|
|
24669
|
+
var storageOccupancyCapability = {
|
|
24670
|
+
name: "storage-occupancy",
|
|
24671
|
+
scope: "system",
|
|
24672
|
+
mode: "collection",
|
|
24673
|
+
internal: true,
|
|
24674
|
+
methods: {
|
|
24675
|
+
/**
|
|
24676
|
+
* Occupancy for the given locations, in ONE round trip.
|
|
24677
|
+
*
|
|
24678
|
+
* A provider answers only for the locations it actually holds bytes on and
|
|
24679
|
+
* OMITS the rest — an omitted location is "I hold nothing measurable here",
|
|
24680
|
+
* which the orchestrator merges as a contribution of nothing rather than as
|
|
24681
|
+
* a claim that the location is empty. Only a location no provider reports
|
|
24682
|
+
* at all stays unknown.
|
|
24683
|
+
*
|
|
24684
|
+
* This must be CHEAP and must never walk a filesystem: it is on the admin
|
|
24685
|
+
* UI's `listLocations` path. The owner keeps its own figure fresh (D224) and
|
|
24686
|
+
* answers from what it already has.
|
|
24687
|
+
*/
|
|
24688
|
+
getOccupancy: method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" }) }
|
|
24689
|
+
};
|
|
24438
24690
|
var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
|
|
24439
24691
|
providerId: string().min(1),
|
|
24440
24692
|
displayName: string().min(1),
|
|
@@ -26217,39 +26469,6 @@ onStatusChanged: { data: object({
|
|
|
26217
26469
|
* whether persisting is worth a SQLite commit. */
|
|
26218
26470
|
volatileStateFields: ["lastUpdated"]
|
|
26219
26471
|
};
|
|
26220
|
-
/**
|
|
26221
|
-
* Network-link snapshot. Same shape for every provider (a Reolink wifi
|
|
26222
|
-
* camera, a Home Assistant device with a signal-strength sensor, a Tapo
|
|
26223
|
-
* plug): one slice under `device.runtimeState['network-link']`, one badge,
|
|
26224
|
-
* one Home Assistant projection.
|
|
26225
|
-
*/
|
|
26226
|
-
var NetworkLinkStatusSchema = object({
|
|
26227
|
-
/** The link the device is on. `'unknown'` = not read yet, not "no link". */
|
|
26228
|
-
type: _enum([
|
|
26229
|
-
"wifi",
|
|
26230
|
-
"ethernet",
|
|
26231
|
-
"cellular",
|
|
26232
|
-
"unknown"
|
|
26233
|
-
]),
|
|
26234
|
-
/**
|
|
26235
|
-
* Link quality, 0..100 inclusive, normalised by the provider from whatever
|
|
26236
|
-
* the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
|
|
26237
|
-
* KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
|
|
26238
|
-
* one whose reading has not landed must not be drawn at 0 %. Consumers
|
|
26239
|
-
* SKIP a null rather than coerce it.
|
|
26240
|
-
*/
|
|
26241
|
-
signalPercent: number().min(0).max(100).nullable(),
|
|
26242
|
-
/** Raw received signal strength in dBm, when the firmware reports one. */
|
|
26243
|
-
rssiDbm: number().optional(),
|
|
26244
|
-
/** Network name of a wireless link, when the firmware reports it. */
|
|
26245
|
-
ssid: string().optional(),
|
|
26246
|
-
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
26247
|
-
lastUpdated: number()
|
|
26248
|
-
});
|
|
26249
|
-
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.Light, DeviceType.Lock, DeviceType.Siren, object({
|
|
26250
|
-
deviceId: number(),
|
|
26251
|
-
status: NetworkLinkStatusSchema
|
|
26252
|
-
});
|
|
26253
26472
|
object({
|
|
26254
26473
|
on: boolean(),
|
|
26255
26474
|
/** Ms epoch of the last transition. 0 if never observed. */
|
|
@@ -28603,6 +28822,236 @@ DeviceType.Camera, method(object({
|
|
|
28603
28822
|
detection: NativeDetectionSchema
|
|
28604
28823
|
});
|
|
28605
28824
|
/**
|
|
28825
|
+
* `navigation` — a device-scoped capability that natively expresses the FULL
|
|
28826
|
+
* navigation / action surface of a robot that DRIVES ITSELF and carries an
|
|
28827
|
+
* on-board camera (the Dreame robot-vacuum camera is the first provider).
|
|
28828
|
+
*
|
|
28829
|
+
* Why a NEW cap rather than overloading `ptz`:
|
|
28830
|
+
* - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
|
|
28831
|
+
* robot vacuum has no gimbal — the whole chassis drives, turns and spins.
|
|
28832
|
+
* The two are different physical models: PTZ is absolute-position + presets,
|
|
28833
|
+
* navigation is momentary drive nudges + discrete robot ACTIONS
|
|
28834
|
+
* (dock / spot-clean / follow-pet / go-to-point / …).
|
|
28835
|
+
* - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
|
|
28836
|
+
* the reverse:
|
|
28837
|
+
* 1. a native CamStack navigation panel (data-driven from `listActions`
|
|
28838
|
+
* / `getOptions`), and
|
|
28839
|
+
* 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
|
|
28840
|
+
* robot camera shows up in the existing PTZ control path without every
|
|
28841
|
+
* PTZ provider learning about robots. The mapping lives in the adapter,
|
|
28842
|
+
* not here (see the addon design note):
|
|
28843
|
+
* ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
|
|
28844
|
+
* ptz.stop() → navigation.stop()
|
|
28845
|
+
* ptz.goHome() → navigation.runAction('goHome')
|
|
28846
|
+
* ptz.getPresets() → navigation.listActions() (id→preset)
|
|
28847
|
+
* ptz.goToPreset(id) → navigation.runAction(id)
|
|
28848
|
+
*
|
|
28849
|
+
* ## Continuous drive
|
|
28850
|
+
*
|
|
28851
|
+
* `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
|
|
28852
|
+
* sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
|
|
28853
|
+
* one `stop()` on release — exactly like the robot app's remote-drive joystick.
|
|
28854
|
+
* The provider forwards EACH `move` to one drive write; it must NOT debounce or
|
|
28855
|
+
* coalesce them. The UI owns the cadence.
|
|
28856
|
+
*
|
|
28857
|
+
* ## The action dictionary
|
|
28858
|
+
*
|
|
28859
|
+
* The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
|
|
28860
|
+
* are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
|
|
28861
|
+
* carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
|
|
28862
|
+
* native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
|
|
28863
|
+
* vendor-specific list. `kind: 'action'` entries are triggered with
|
|
28864
|
+
* `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
|
|
28865
|
+
* (the entry carries the `soundId` to pass). The general primitives — `move`,
|
|
28866
|
+
* `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
|
|
28867
|
+
*
|
|
28868
|
+
* NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
|
|
28869
|
+
* `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
|
|
28870
|
+
* that the currently-published `@apocaliss92/nodedreame` already exposes on
|
|
28871
|
+
* every device handle. A future nodedreame publish adds a typed
|
|
28872
|
+
* `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
|
|
28873
|
+
* provider can then swap the raw calls for the typed methods with no change to
|
|
28874
|
+
* THIS contract.
|
|
28875
|
+
*/
|
|
28876
|
+
/**
|
|
28877
|
+
* A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
|
|
28878
|
+
* keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
|
|
28879
|
+
* halts it.
|
|
28880
|
+
*
|
|
28881
|
+
* - `pan` — turn: negative = left, positive = right, 0 = straight.
|
|
28882
|
+
* - `tilt` — throttle: positive = forward, negative = spin / turn-around.
|
|
28883
|
+
* - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
|
|
28884
|
+
* vector by it (drivers without proportional drive ignore it).
|
|
28885
|
+
*
|
|
28886
|
+
* `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
|
|
28887
|
+
* axis alone; an all-undefined nudge is a no-op.
|
|
28888
|
+
*/
|
|
28889
|
+
var NavigationMoveCommandSchema = object({
|
|
28890
|
+
pan: number().min(-1).max(1).optional(),
|
|
28891
|
+
tilt: number().min(-1).max(1).optional(),
|
|
28892
|
+
speed: number().min(0).max(1).optional()
|
|
28893
|
+
});
|
|
28894
|
+
/**
|
|
28895
|
+
* The enumerated discrete actions a navigation-capable robot can perform via
|
|
28896
|
+
* `runAction`. This is the CLOSED vocabulary; a given device advertises the
|
|
28897
|
+
* subset it supports through `listActions`. Sounds are NOT here — they go through
|
|
28898
|
+
* `playSound` (see the `sound` dictionary entries).
|
|
28899
|
+
*/
|
|
28900
|
+
var NavigationActionIdSchema = _enum([
|
|
28901
|
+
"goHome",
|
|
28902
|
+
"locate",
|
|
28903
|
+
"spotClean",
|
|
28904
|
+
"findPet",
|
|
28905
|
+
"personFollow",
|
|
28906
|
+
"stop",
|
|
28907
|
+
"startClean",
|
|
28908
|
+
"pauseClean",
|
|
28909
|
+
"dockWash",
|
|
28910
|
+
"autoEmpty",
|
|
28911
|
+
"flashOn",
|
|
28912
|
+
"flashOff"
|
|
28913
|
+
]);
|
|
28914
|
+
/** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
|
|
28915
|
+
var NavigationEntryKindSchema = _enum(["action", "sound"]);
|
|
28916
|
+
/**
|
|
28917
|
+
* One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
|
|
28918
|
+
* native panel and the PTZ mimic render as a button.
|
|
28919
|
+
*
|
|
28920
|
+
* - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
|
|
28921
|
+
* (pass to `runAction`); for `kind:'sound'` it is a namespaced id
|
|
28922
|
+
* (`sound:meow`) whose `soundId` is passed to `playSound`.
|
|
28923
|
+
* - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
|
|
28924
|
+
* - `label` — operator-facing English label.
|
|
28925
|
+
* - `soundId` — wire sound id, present only on `kind:'sound'` entries.
|
|
28926
|
+
* - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
|
|
28927
|
+
* PTZ render ONLY enabled entries. Data-driven: the provider
|
|
28928
|
+
* flips it from config, never by editing code.
|
|
28929
|
+
*/
|
|
28930
|
+
var NavigationActionEntrySchema = object({
|
|
28931
|
+
id: string(),
|
|
28932
|
+
kind: NavigationEntryKindSchema,
|
|
28933
|
+
label: string(),
|
|
28934
|
+
icon: string(),
|
|
28935
|
+
/** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
|
|
28936
|
+
soundId: number().int().optional(),
|
|
28937
|
+
/** Per-device feature flag — render this entry only when true. */
|
|
28938
|
+
enabled: boolean()
|
|
28939
|
+
});
|
|
28940
|
+
/** Coordinates for `goToPoint` — a point on the robot's live map. */
|
|
28941
|
+
var NavigationPointSchema = object({
|
|
28942
|
+
x: number(),
|
|
28943
|
+
y: number()
|
|
28944
|
+
});
|
|
28945
|
+
/**
|
|
28946
|
+
* Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
|
|
28947
|
+
* The cap reports which are enabled so the UI / PTZ render only the controls
|
|
28948
|
+
* that are turned on for THIS device. Data-driven: the provider derives these
|
|
28949
|
+
* from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
|
|
28950
|
+
* live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
|
|
28951
|
+
* that are not dictionary entries.
|
|
28952
|
+
*
|
|
28953
|
+
* - `move` / `stop` — the momentary drive joystick.
|
|
28954
|
+
* - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
|
|
28955
|
+
* map-coordinate plumbing is wired.
|
|
28956
|
+
* - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
|
|
28957
|
+
* - `playSound` — the sound buttons (dictionary `kind:'sound'`).
|
|
28958
|
+
* - `light` — the on/off fill-light toggle (works anytime).
|
|
28959
|
+
* - `lightMode` — the auto/manual selector + manual level slider (a
|
|
28960
|
+
* camera-service control; needs an active stream).
|
|
28961
|
+
*/
|
|
28962
|
+
var NavigationFeaturesSchema = object({
|
|
28963
|
+
move: boolean(),
|
|
28964
|
+
stop: boolean(),
|
|
28965
|
+
goToPoint: boolean(),
|
|
28966
|
+
runAction: boolean(),
|
|
28967
|
+
playSound: boolean(),
|
|
28968
|
+
light: boolean(),
|
|
28969
|
+
lightMode: boolean()
|
|
28970
|
+
});
|
|
28971
|
+
/** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
|
|
28972
|
+
var NavigationLightModeSchema = _enum(["auto", "manual"]);
|
|
28973
|
+
/**
|
|
28974
|
+
* Live navigation state so the UI can reflect what the robot is doing:
|
|
28975
|
+
* - `mode` — coarse activity (idle / cleaning / following / …).
|
|
28976
|
+
* - `following` — person/pet follow is currently armed.
|
|
28977
|
+
* - `flash` — the on-camera fill light is on.
|
|
28978
|
+
* - `lightMode` — auto vs manual fill-light mode.
|
|
28979
|
+
* - `lightLevel` — manual fill-light level (40..100); meaningful when
|
|
28980
|
+
* `lightMode === 'manual'`.
|
|
28981
|
+
*/
|
|
28982
|
+
var NavigationStatusSchema = object({
|
|
28983
|
+
mode: _enum([
|
|
28984
|
+
"idle",
|
|
28985
|
+
"cleaning",
|
|
28986
|
+
"spot",
|
|
28987
|
+
"following",
|
|
28988
|
+
"goto",
|
|
28989
|
+
"returning",
|
|
28990
|
+
"paused",
|
|
28991
|
+
"unknown"
|
|
28992
|
+
]),
|
|
28993
|
+
following: boolean(),
|
|
28994
|
+
flash: boolean(),
|
|
28995
|
+
lightMode: NavigationLightModeSchema,
|
|
28996
|
+
lightLevel: number().min(40).max(100),
|
|
28997
|
+
/** Ms epoch when the slice was last updated. */
|
|
28998
|
+
lastChangedAt: number()
|
|
28999
|
+
});
|
|
29000
|
+
NavigationStatusSchema.extend({ lastFetchedAt: number() });
|
|
29001
|
+
DeviceType.Camera, method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), array(NavigationActionEntrySchema)), method(object({
|
|
29002
|
+
deviceId: number(),
|
|
29003
|
+
actionId: NavigationActionIdSchema
|
|
29004
|
+
}), _void(), { kind: "mutation" }), method(object({
|
|
29005
|
+
deviceId: number(),
|
|
29006
|
+
soundId: number().int()
|
|
29007
|
+
}), _void(), { kind: "mutation" }), method(object({
|
|
29008
|
+
deviceId: number(),
|
|
29009
|
+
on: boolean()
|
|
29010
|
+
}), _void(), { kind: "mutation" }), method(object({
|
|
29011
|
+
deviceId: number(),
|
|
29012
|
+
mode: NavigationLightModeSchema,
|
|
29013
|
+
level: number().min(40).max(100).optional()
|
|
29014
|
+
}), _void(), { kind: "mutation" }), method(object({
|
|
29015
|
+
deviceId: number(),
|
|
29016
|
+
level: number().min(40).max(100)
|
|
29017
|
+
}), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), NavigationFeaturesSchema), object({
|
|
29018
|
+
deviceId: number(),
|
|
29019
|
+
status: NavigationStatusSchema
|
|
29020
|
+
});
|
|
29021
|
+
/**
|
|
29022
|
+
* Network-link snapshot. Same shape for every provider (a Reolink wifi
|
|
29023
|
+
* camera, a Home Assistant device with a signal-strength sensor, a Tapo
|
|
29024
|
+
* plug): one slice under `device.runtimeState['network-link']`, one badge,
|
|
29025
|
+
* one Home Assistant projection.
|
|
29026
|
+
*/
|
|
29027
|
+
var NetworkLinkStatusSchema = object({
|
|
29028
|
+
/** The link the device is on. `'unknown'` = not read yet, not "no link". */
|
|
29029
|
+
type: _enum([
|
|
29030
|
+
"wifi",
|
|
29031
|
+
"ethernet",
|
|
29032
|
+
"cellular",
|
|
29033
|
+
"unknown"
|
|
29034
|
+
]),
|
|
29035
|
+
/**
|
|
29036
|
+
* Link quality, 0..100 inclusive, normalised by the provider from whatever
|
|
29037
|
+
* the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
|
|
29038
|
+
* KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
|
|
29039
|
+
* one whose reading has not landed must not be drawn at 0 %. Consumers
|
|
29040
|
+
* SKIP a null rather than coerce it.
|
|
29041
|
+
*/
|
|
29042
|
+
signalPercent: number().min(0).max(100).nullable(),
|
|
29043
|
+
/** Raw received signal strength in dBm, when the firmware reports one. */
|
|
29044
|
+
rssiDbm: number().optional(),
|
|
29045
|
+
/** Network name of a wireless link, when the firmware reports it. */
|
|
29046
|
+
ssid: string().optional(),
|
|
29047
|
+
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
29048
|
+
lastUpdated: number()
|
|
29049
|
+
});
|
|
29050
|
+
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.Light, DeviceType.Lock, DeviceType.Siren, object({
|
|
29051
|
+
deviceId: number(),
|
|
29052
|
+
status: NetworkLinkStatusSchema
|
|
29053
|
+
});
|
|
29054
|
+
/**
|
|
28606
29055
|
* network-quality — system-scoped singleton capability tracking RTT,
|
|
28607
29056
|
* jitter, and observed/peak bandwidth per device + per client.
|
|
28608
29057
|
*
|
|
@@ -29844,203 +30293,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), PtzAutotrackStatusSche
|
|
|
29844
30293
|
deviceId: number(),
|
|
29845
30294
|
status: PtzAutotrackStatusSchema
|
|
29846
30295
|
});
|
|
29847
|
-
/**
|
|
29848
|
-
* `navigation` — a device-scoped capability that natively expresses the FULL
|
|
29849
|
-
* navigation / action surface of a robot that DRIVES ITSELF and carries an
|
|
29850
|
-
* on-board camera (the Dreame robot-vacuum camera is the first provider).
|
|
29851
|
-
*
|
|
29852
|
-
* Why a NEW cap rather than overloading `ptz`:
|
|
29853
|
-
* - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
|
|
29854
|
-
* robot vacuum has no gimbal — the whole chassis drives, turns and spins.
|
|
29855
|
-
* The two are different physical models: PTZ is absolute-position + presets,
|
|
29856
|
-
* navigation is momentary drive nudges + discrete robot ACTIONS
|
|
29857
|
-
* (dock / spot-clean / follow-pet / go-to-point / …).
|
|
29858
|
-
* - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
|
|
29859
|
-
* the reverse:
|
|
29860
|
-
* 1. a native CamStack navigation panel (data-driven from `listActions`
|
|
29861
|
-
* / `getOptions`), and
|
|
29862
|
-
* 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
|
|
29863
|
-
* robot camera shows up in the existing PTZ control path without every
|
|
29864
|
-
* PTZ provider learning about robots. The mapping lives in the adapter,
|
|
29865
|
-
* not here (see the addon design note):
|
|
29866
|
-
* ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
|
|
29867
|
-
* ptz.stop() → navigation.stop()
|
|
29868
|
-
* ptz.goHome() → navigation.runAction('goHome')
|
|
29869
|
-
* ptz.getPresets() → navigation.listActions() (id→preset)
|
|
29870
|
-
* ptz.goToPreset(id) → navigation.runAction(id)
|
|
29871
|
-
*
|
|
29872
|
-
* ## Continuous drive
|
|
29873
|
-
*
|
|
29874
|
-
* `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
|
|
29875
|
-
* sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
|
|
29876
|
-
* one `stop()` on release — exactly like the robot app's remote-drive joystick.
|
|
29877
|
-
* The provider forwards EACH `move` to one drive write; it must NOT debounce or
|
|
29878
|
-
* coalesce them. The UI owns the cadence.
|
|
29879
|
-
*
|
|
29880
|
-
* ## The action dictionary
|
|
29881
|
-
*
|
|
29882
|
-
* The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
|
|
29883
|
-
* are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
|
|
29884
|
-
* carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
|
|
29885
|
-
* native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
|
|
29886
|
-
* vendor-specific list. `kind: 'action'` entries are triggered with
|
|
29887
|
-
* `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
|
|
29888
|
-
* (the entry carries the `soundId` to pass). The general primitives — `move`,
|
|
29889
|
-
* `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
|
|
29890
|
-
*
|
|
29891
|
-
* NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
|
|
29892
|
-
* `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
|
|
29893
|
-
* that the currently-published `@apocaliss92/nodedreame` already exposes on
|
|
29894
|
-
* every device handle. A future nodedreame publish adds a typed
|
|
29895
|
-
* `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
|
|
29896
|
-
* provider can then swap the raw calls for the typed methods with no change to
|
|
29897
|
-
* THIS contract.
|
|
29898
|
-
*/
|
|
29899
|
-
/**
|
|
29900
|
-
* A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
|
|
29901
|
-
* keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
|
|
29902
|
-
* halts it.
|
|
29903
|
-
*
|
|
29904
|
-
* - `pan` — turn: negative = left, positive = right, 0 = straight.
|
|
29905
|
-
* - `tilt` — throttle: positive = forward, negative = spin / turn-around.
|
|
29906
|
-
* - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
|
|
29907
|
-
* vector by it (drivers without proportional drive ignore it).
|
|
29908
|
-
*
|
|
29909
|
-
* `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
|
|
29910
|
-
* axis alone; an all-undefined nudge is a no-op.
|
|
29911
|
-
*/
|
|
29912
|
-
var NavigationMoveCommandSchema = object({
|
|
29913
|
-
pan: number().min(-1).max(1).optional(),
|
|
29914
|
-
tilt: number().min(-1).max(1).optional(),
|
|
29915
|
-
speed: number().min(0).max(1).optional()
|
|
29916
|
-
});
|
|
29917
|
-
/**
|
|
29918
|
-
* The enumerated discrete actions a navigation-capable robot can perform via
|
|
29919
|
-
* `runAction`. This is the CLOSED vocabulary; a given device advertises the
|
|
29920
|
-
* subset it supports through `listActions`. Sounds are NOT here — they go through
|
|
29921
|
-
* `playSound` (see the `sound` dictionary entries).
|
|
29922
|
-
*/
|
|
29923
|
-
var NavigationActionIdSchema = _enum([
|
|
29924
|
-
"goHome",
|
|
29925
|
-
"locate",
|
|
29926
|
-
"spotClean",
|
|
29927
|
-
"findPet",
|
|
29928
|
-
"personFollow",
|
|
29929
|
-
"stop",
|
|
29930
|
-
"startClean",
|
|
29931
|
-
"pauseClean",
|
|
29932
|
-
"dockWash",
|
|
29933
|
-
"autoEmpty",
|
|
29934
|
-
"flashOn",
|
|
29935
|
-
"flashOff"
|
|
29936
|
-
]);
|
|
29937
|
-
/** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
|
|
29938
|
-
var NavigationEntryKindSchema = _enum(["action", "sound"]);
|
|
29939
|
-
/**
|
|
29940
|
-
* One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
|
|
29941
|
-
* native panel and the PTZ mimic render as a button.
|
|
29942
|
-
*
|
|
29943
|
-
* - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
|
|
29944
|
-
* (pass to `runAction`); for `kind:'sound'` it is a namespaced id
|
|
29945
|
-
* (`sound:meow`) whose `soundId` is passed to `playSound`.
|
|
29946
|
-
* - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
|
|
29947
|
-
* - `label` — operator-facing English label.
|
|
29948
|
-
* - `soundId` — wire sound id, present only on `kind:'sound'` entries.
|
|
29949
|
-
* - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
|
|
29950
|
-
* PTZ render ONLY enabled entries. Data-driven: the provider
|
|
29951
|
-
* flips it from config, never by editing code.
|
|
29952
|
-
*/
|
|
29953
|
-
var NavigationActionEntrySchema = object({
|
|
29954
|
-
id: string(),
|
|
29955
|
-
kind: NavigationEntryKindSchema,
|
|
29956
|
-
label: string(),
|
|
29957
|
-
icon: string(),
|
|
29958
|
-
/** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
|
|
29959
|
-
soundId: number().int().optional(),
|
|
29960
|
-
/** Per-device feature flag — render this entry only when true. */
|
|
29961
|
-
enabled: boolean()
|
|
29962
|
-
});
|
|
29963
|
-
/** Coordinates for `goToPoint` — a point on the robot's live map. */
|
|
29964
|
-
var NavigationPointSchema = object({
|
|
29965
|
-
x: number(),
|
|
29966
|
-
y: number()
|
|
29967
|
-
});
|
|
29968
|
-
/**
|
|
29969
|
-
* Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
|
|
29970
|
-
* The cap reports which are enabled so the UI / PTZ render only the controls
|
|
29971
|
-
* that are turned on for THIS device. Data-driven: the provider derives these
|
|
29972
|
-
* from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
|
|
29973
|
-
* live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
|
|
29974
|
-
* that are not dictionary entries.
|
|
29975
|
-
*
|
|
29976
|
-
* - `move` / `stop` — the momentary drive joystick.
|
|
29977
|
-
* - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
|
|
29978
|
-
* map-coordinate plumbing is wired.
|
|
29979
|
-
* - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
|
|
29980
|
-
* - `playSound` — the sound buttons (dictionary `kind:'sound'`).
|
|
29981
|
-
* - `light` — the on/off fill-light toggle (works anytime).
|
|
29982
|
-
* - `lightMode` — the auto/manual selector + manual level slider (a
|
|
29983
|
-
* camera-service control; needs an active stream).
|
|
29984
|
-
*/
|
|
29985
|
-
var NavigationFeaturesSchema = object({
|
|
29986
|
-
move: boolean(),
|
|
29987
|
-
stop: boolean(),
|
|
29988
|
-
goToPoint: boolean(),
|
|
29989
|
-
runAction: boolean(),
|
|
29990
|
-
playSound: boolean(),
|
|
29991
|
-
light: boolean(),
|
|
29992
|
-
lightMode: boolean()
|
|
29993
|
-
});
|
|
29994
|
-
/** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
|
|
29995
|
-
var NavigationLightModeSchema = _enum(["auto", "manual"]);
|
|
29996
|
-
/**
|
|
29997
|
-
* Live navigation state so the UI can reflect what the robot is doing:
|
|
29998
|
-
* - `mode` — coarse activity (idle / cleaning / following / …).
|
|
29999
|
-
* - `following` — person/pet follow is currently armed.
|
|
30000
|
-
* - `flash` — the on-camera fill light is on.
|
|
30001
|
-
* - `lightMode` — auto vs manual fill-light mode.
|
|
30002
|
-
* - `lightLevel` — manual fill-light level (40..100); meaningful when
|
|
30003
|
-
* `lightMode === 'manual'`.
|
|
30004
|
-
*/
|
|
30005
|
-
var NavigationStatusSchema = object({
|
|
30006
|
-
mode: _enum([
|
|
30007
|
-
"idle",
|
|
30008
|
-
"cleaning",
|
|
30009
|
-
"spot",
|
|
30010
|
-
"following",
|
|
30011
|
-
"goto",
|
|
30012
|
-
"returning",
|
|
30013
|
-
"paused",
|
|
30014
|
-
"unknown"
|
|
30015
|
-
]),
|
|
30016
|
-
following: boolean(),
|
|
30017
|
-
flash: boolean(),
|
|
30018
|
-
lightMode: NavigationLightModeSchema,
|
|
30019
|
-
lightLevel: number().min(40).max(100),
|
|
30020
|
-
/** Ms epoch when the slice was last updated. */
|
|
30021
|
-
lastChangedAt: number()
|
|
30022
|
-
});
|
|
30023
|
-
NavigationStatusSchema.extend({ lastFetchedAt: number() });
|
|
30024
|
-
DeviceType.Camera, method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), array(NavigationActionEntrySchema)), method(object({
|
|
30025
|
-
deviceId: number(),
|
|
30026
|
-
actionId: NavigationActionIdSchema
|
|
30027
|
-
}), _void(), { kind: "mutation" }), method(object({
|
|
30028
|
-
deviceId: number(),
|
|
30029
|
-
soundId: number().int()
|
|
30030
|
-
}), _void(), { kind: "mutation" }), method(object({
|
|
30031
|
-
deviceId: number(),
|
|
30032
|
-
on: boolean()
|
|
30033
|
-
}), _void(), { kind: "mutation" }), method(object({
|
|
30034
|
-
deviceId: number(),
|
|
30035
|
-
mode: NavigationLightModeSchema,
|
|
30036
|
-
level: number().min(40).max(100).optional()
|
|
30037
|
-
}), _void(), { kind: "mutation" }), method(object({
|
|
30038
|
-
deviceId: number(),
|
|
30039
|
-
level: number().min(40).max(100)
|
|
30040
|
-
}), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), NavigationFeaturesSchema), object({
|
|
30041
|
-
deviceId: number(),
|
|
30042
|
-
status: NavigationStatusSchema
|
|
30043
|
-
});
|
|
30044
30296
|
DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
|
|
30045
30297
|
kind: "mutation",
|
|
30046
30298
|
auth: "admin"
|
|
@@ -37763,13 +38015,13 @@ Object.freeze({
|
|
|
37763
38015
|
addonId: null,
|
|
37764
38016
|
access: "view"
|
|
37765
38017
|
},
|
|
37766
|
-
"storage.
|
|
38018
|
+
"storage.list": {
|
|
37767
38019
|
capName: "storage",
|
|
37768
38020
|
capScope: "system",
|
|
37769
38021
|
addonId: null,
|
|
37770
38022
|
access: "view"
|
|
37771
38023
|
},
|
|
37772
|
-
"storage.
|
|
38024
|
+
"storage.listDrainProgress": {
|
|
37773
38025
|
capName: "storage",
|
|
37774
38026
|
capScope: "system",
|
|
37775
38027
|
addonId: null,
|
|
@@ -37919,6 +38171,12 @@ Object.freeze({
|
|
|
37919
38171
|
addonId: null,
|
|
37920
38172
|
access: "view"
|
|
37921
38173
|
},
|
|
38174
|
+
"storageOccupancy.getOccupancy": {
|
|
38175
|
+
capName: "storage-occupancy",
|
|
38176
|
+
capScope: "system",
|
|
38177
|
+
addonId: null,
|
|
38178
|
+
access: "view"
|
|
38179
|
+
},
|
|
37922
38180
|
"storageProvider.abortUpload": {
|
|
37923
38181
|
capName: "storage-provider",
|
|
37924
38182
|
capScope: "system",
|
|
@@ -42802,12 +43060,30 @@ Object.defineProperty(exports, "evaluateZoneRules", {
|
|
|
42802
43060
|
return evaluateZoneRules;
|
|
42803
43061
|
}
|
|
42804
43062
|
});
|
|
43063
|
+
Object.defineProperty(exports, "evictionPolicyForMode", {
|
|
43064
|
+
enumerable: true,
|
|
43065
|
+
get: function() {
|
|
43066
|
+
return evictionPolicyForMode;
|
|
43067
|
+
}
|
|
43068
|
+
});
|
|
43069
|
+
Object.defineProperty(exports, "evictionPolicyOfLocation", {
|
|
43070
|
+
enumerable: true,
|
|
43071
|
+
get: function() {
|
|
43072
|
+
return evictionPolicyOfLocation;
|
|
43073
|
+
}
|
|
43074
|
+
});
|
|
42805
43075
|
Object.defineProperty(exports, "failureContributionCapability", {
|
|
42806
43076
|
enumerable: true,
|
|
42807
43077
|
get: function() {
|
|
42808
43078
|
return failureContributionCapability;
|
|
42809
43079
|
}
|
|
42810
43080
|
});
|
|
43081
|
+
Object.defineProperty(exports, "gbToBytes", {
|
|
43082
|
+
enumerable: true,
|
|
43083
|
+
get: function() {
|
|
43084
|
+
return gbToBytes;
|
|
43085
|
+
}
|
|
43086
|
+
});
|
|
42811
43087
|
Object.defineProperty(exports, "hfModelUrl", {
|
|
42812
43088
|
enumerable: true,
|
|
42813
43089
|
get: function() {
|
|
@@ -42898,12 +43174,30 @@ Object.defineProperty(exports, "maskUrlCredentials", {
|
|
|
42898
43174
|
return maskUrlCredentials;
|
|
42899
43175
|
}
|
|
42900
43176
|
});
|
|
43177
|
+
Object.defineProperty(exports, "mayReadLocation", {
|
|
43178
|
+
enumerable: true,
|
|
43179
|
+
get: function() {
|
|
43180
|
+
return mayReadLocation;
|
|
43181
|
+
}
|
|
43182
|
+
});
|
|
43183
|
+
Object.defineProperty(exports, "mayWriteToLocation", {
|
|
43184
|
+
enumerable: true,
|
|
43185
|
+
get: function() {
|
|
43186
|
+
return mayWriteToLocation;
|
|
43187
|
+
}
|
|
43188
|
+
});
|
|
42901
43189
|
Object.defineProperty(exports, "migrateLegacyDeviceSignalConfig", {
|
|
42902
43190
|
enumerable: true,
|
|
42903
43191
|
get: function() {
|
|
42904
43192
|
return migrateLegacyDeviceSignalConfig;
|
|
42905
43193
|
}
|
|
42906
43194
|
});
|
|
43195
|
+
Object.defineProperty(exports, "modeMayWrite", {
|
|
43196
|
+
enumerable: true,
|
|
43197
|
+
get: function() {
|
|
43198
|
+
return modeMayWrite;
|
|
43199
|
+
}
|
|
43200
|
+
});
|
|
42907
43201
|
Object.defineProperty(exports, "motionDetectionCapability", {
|
|
42908
43202
|
enumerable: true,
|
|
42909
43203
|
get: function() {
|
|
@@ -43030,6 +43324,12 @@ Object.defineProperty(exports, "resolveEgressDecodeHwAccel", {
|
|
|
43030
43324
|
return resolveEgressDecodeHwAccel;
|
|
43031
43325
|
}
|
|
43032
43326
|
});
|
|
43327
|
+
Object.defineProperty(exports, "resolveLocationMode", {
|
|
43328
|
+
enumerable: true,
|
|
43329
|
+
get: function() {
|
|
43330
|
+
return resolveLocationMode;
|
|
43331
|
+
}
|
|
43332
|
+
});
|
|
43033
43333
|
Object.defineProperty(exports, "resolvePoolMemoryPolicy", {
|
|
43034
43334
|
enumerable: true,
|
|
43035
43335
|
get: function() {
|
|
@@ -43066,6 +43366,12 @@ Object.defineProperty(exports, "storageEvictableCapability", {
|
|
|
43066
43366
|
return storageEvictableCapability;
|
|
43067
43367
|
}
|
|
43068
43368
|
});
|
|
43369
|
+
Object.defineProperty(exports, "storageOccupancyCapability", {
|
|
43370
|
+
enumerable: true,
|
|
43371
|
+
get: function() {
|
|
43372
|
+
return storageOccupancyCapability;
|
|
43373
|
+
}
|
|
43374
|
+
});
|
|
43069
43375
|
Object.defineProperty(exports, "streamBrokerCapability", {
|
|
43070
43376
|
enumerable: true,
|
|
43071
43377
|
get: function() {
|