@camstack/addon-provider-hikvision 1.2.22 → 1.2.23
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 +639 -65
- package/dist/addon.mjs +639 -65
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -5404,12 +5404,6 @@ Object.fromEntries([
|
|
|
5404
5404
|
icon: "shapes",
|
|
5405
5405
|
order: 38
|
|
5406
5406
|
},
|
|
5407
|
-
{
|
|
5408
|
-
id: "scenes",
|
|
5409
|
-
label: "Scenes",
|
|
5410
|
-
icon: "scan-eye",
|
|
5411
|
-
order: 36
|
|
5412
|
-
},
|
|
5413
5407
|
{
|
|
5414
5408
|
id: "analytics",
|
|
5415
5409
|
label: "Analytics",
|
|
@@ -11105,6 +11099,8 @@ var QueryFilterSchema = object({
|
|
|
11105
11099
|
where: record(string(), unknown()).optional(),
|
|
11106
11100
|
whereIn: record(string(), array(unknown())).optional(),
|
|
11107
11101
|
whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
|
|
11102
|
+
/** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
|
|
11103
|
+
whereNot: record(string(), unknown()).optional(),
|
|
11108
11104
|
orderBy: object({
|
|
11109
11105
|
field: string(),
|
|
11110
11106
|
direction: _enum(["asc", "desc"])
|
|
@@ -11124,7 +11120,8 @@ var QueryFilterSchema = object({
|
|
|
11124
11120
|
var MutationFilterSchema = object({
|
|
11125
11121
|
where: record(string(), unknown()).optional(),
|
|
11126
11122
|
whereIn: record(string(), array(unknown())).optional(),
|
|
11127
|
-
whereBetween: record(string(), tuple([unknown(), unknown()])).optional()
|
|
11123
|
+
whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
|
|
11124
|
+
whereNot: record(string(), unknown()).optional()
|
|
11128
11125
|
});
|
|
11129
11126
|
/** A single stored record: `{ id, data }`. */
|
|
11130
11127
|
var SettingsRecordSchema = object({
|
|
@@ -12643,6 +12640,17 @@ var LlmImageSchema = object({
|
|
|
12643
12640
|
bytes: _instanceof(Uint8Array),
|
|
12644
12641
|
mimeType: string()
|
|
12645
12642
|
});
|
|
12643
|
+
/**
|
|
12644
|
+
* Retry policy. `enabled: false` is NOT the same as `maxAttempts: 1` in intent —
|
|
12645
|
+
* the flag is what a consumer table flips, the count is what the operator tunes.
|
|
12646
|
+
* A retry doubles the wall time of a call, so the two gates that run inside a
|
|
12647
|
+
* notification's budget keep it off (see `CONSUMER_RETRY_POLICY` in addon-ai).
|
|
12648
|
+
*/
|
|
12649
|
+
var LlmRetryPolicySchema = object({
|
|
12650
|
+
enabled: boolean().default(false),
|
|
12651
|
+
/** Total attempts INCLUDING the first. 1 = no retry. */
|
|
12652
|
+
maxAttempts: number().int().min(1).max(5).default(1)
|
|
12653
|
+
});
|
|
12646
12654
|
var LlmGenerateBaseInputSchema = object({
|
|
12647
12655
|
/** Collection routing (the notification-output posture). */
|
|
12648
12656
|
addonId: string().optional(),
|
|
@@ -12657,7 +12665,28 @@ var LlmGenerateBaseInputSchema = object({
|
|
|
12657
12665
|
jsonSchema: record(string(), unknown()).optional(),
|
|
12658
12666
|
/** Per-call override of the profile default. */
|
|
12659
12667
|
maxTokens: number().int().positive().optional(),
|
|
12660
|
-
temperature: number().optional()
|
|
12668
|
+
temperature: number().optional(),
|
|
12669
|
+
/** Per-call override of the profile default (nucleus sampling). */
|
|
12670
|
+
topP: number().min(0).max(1).optional(),
|
|
12671
|
+
/** Per-call override of the profile default (top-k sampling). */
|
|
12672
|
+
topK: number().int().positive().optional(),
|
|
12673
|
+
/** Per-call override of `profile.timeoutMs` — the total generation bound. */
|
|
12674
|
+
timeoutMs: number().int().positive().optional(),
|
|
12675
|
+
/** Per-call override; beats both the consumer table and the profile. */
|
|
12676
|
+
retry: LlmRetryPolicySchema.optional(),
|
|
12677
|
+
/**
|
|
12678
|
+
* Caller-minted id that makes this generation CANCELLABLE.
|
|
12679
|
+
*
|
|
12680
|
+
* Without it a caller that stops waiting cannot stop the work: the gates race
|
|
12681
|
+
* the call against 8 s and free their own slot when the timer wins, while the
|
|
12682
|
+
* generation upstream keeps running to `profile.timeoutMs` — 60 s by default,
|
|
12683
|
+
* on a single-threaded local model. The per-camera bound then counts WAITS,
|
|
12684
|
+
* not generations, and the real load is unbounded.
|
|
12685
|
+
*
|
|
12686
|
+
* `AbortSignal` cannot cross a process boundary; an id can. Pass one here and
|
|
12687
|
+
* `llm.cancel({ requestId })` tears the socket down.
|
|
12688
|
+
*/
|
|
12689
|
+
requestId: string().optional()
|
|
12661
12690
|
});
|
|
12662
12691
|
/**
|
|
12663
12692
|
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
@@ -12670,6 +12699,18 @@ var LlmGenerateBaseInputSchema = object({
|
|
|
12670
12699
|
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
12671
12700
|
* watchdog — operator decision #3).
|
|
12672
12701
|
*/
|
|
12702
|
+
/**
|
|
12703
|
+
* A companion artifact that MUST land beside the main GGUF: the `mmproj`
|
|
12704
|
+
* projector of a vision model, or shards 2..N of a split GGUF. Carried on the
|
|
12705
|
+
* REF rather than looked up at install time, so what the operator approved in
|
|
12706
|
+
* the preview is exactly what the node downloads.
|
|
12707
|
+
*/
|
|
12708
|
+
var ManagedModelExtraFileSchema = object({
|
|
12709
|
+
url: string(),
|
|
12710
|
+
filename: string(),
|
|
12711
|
+
sizeBytes: number(),
|
|
12712
|
+
sha256: string().optional()
|
|
12713
|
+
});
|
|
12673
12714
|
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
12674
12715
|
object({
|
|
12675
12716
|
kind: literal("catalog"),
|
|
@@ -12678,7 +12719,11 @@ var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
|
12678
12719
|
object({
|
|
12679
12720
|
kind: literal("url"),
|
|
12680
12721
|
url: string(),
|
|
12681
|
-
sha256: string().optional()
|
|
12722
|
+
sha256: string().optional(),
|
|
12723
|
+
/** Picker/status label; the file basename when absent. */
|
|
12724
|
+
label: string().optional(),
|
|
12725
|
+
sizeBytes: number().optional(),
|
|
12726
|
+
extraFiles: array(ManagedModelExtraFileSchema).optional()
|
|
12682
12727
|
}),
|
|
12683
12728
|
object({
|
|
12684
12729
|
kind: literal("path"),
|
|
@@ -12696,13 +12741,82 @@ var ManagedRuntimeConfigSchema = object({
|
|
|
12696
12741
|
gpuLayers: number().int().default(0),
|
|
12697
12742
|
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
12698
12743
|
threads: number().int().optional(),
|
|
12699
|
-
/** Concurrent slots. */
|
|
12744
|
+
/** Concurrent slots (`--parallel`). */
|
|
12700
12745
|
parallel: number().int().default(1),
|
|
12746
|
+
/** Logical batch size (`-b`). Larger = faster prompt ingest, more RAM. */
|
|
12747
|
+
batchSize: number().int().positive().optional(),
|
|
12748
|
+
/** Physical batch / micro-batch (`-ub`). */
|
|
12749
|
+
ubatchSize: number().int().positive().optional(),
|
|
12750
|
+
/**
|
|
12751
|
+
* `--flash-attn`. Cuts KV-cache memory on the backends that implement it and
|
|
12752
|
+
* is a no-op elsewhere, so it is offered rather than assumed.
|
|
12753
|
+
*/
|
|
12754
|
+
flashAttention: boolean().default(false),
|
|
12755
|
+
/**
|
|
12756
|
+
* `--mlock`. Pins the weights in RAM so the OS cannot page them out mid
|
|
12757
|
+
* inference. Costs the full model size in resident memory — which is exactly
|
|
12758
|
+
* what the RAM budget is counting.
|
|
12759
|
+
*/
|
|
12760
|
+
mlock: boolean().default(false),
|
|
12761
|
+
/**
|
|
12762
|
+
* `--no-mmap`. Reads the whole GGUF up front instead of mapping it. Slower to
|
|
12763
|
+
* start, but avoids the page-fault stalls a network or spinning-disk model
|
|
12764
|
+
* store produces on every first token.
|
|
12765
|
+
*/
|
|
12766
|
+
noMmap: boolean().default(false),
|
|
12767
|
+
/** `--cache-type-k` / `--cache-type-v` — quantising the KV cache is the
|
|
12768
|
+
* cheapest way to fit a longer context in the same RAM. */
|
|
12769
|
+
cacheTypeK: _enum([
|
|
12770
|
+
"f32",
|
|
12771
|
+
"f16",
|
|
12772
|
+
"q8_0",
|
|
12773
|
+
"q5_1",
|
|
12774
|
+
"q5_0",
|
|
12775
|
+
"q4_1",
|
|
12776
|
+
"q4_0"
|
|
12777
|
+
]).optional(),
|
|
12778
|
+
cacheTypeV: _enum([
|
|
12779
|
+
"f32",
|
|
12780
|
+
"f16",
|
|
12781
|
+
"q8_0",
|
|
12782
|
+
"q5_1",
|
|
12783
|
+
"q5_0",
|
|
12784
|
+
"q4_1",
|
|
12785
|
+
"q4_0"
|
|
12786
|
+
]).optional(),
|
|
12787
|
+
/**
|
|
12788
|
+
* Escape hatch for llama-server flags this schema does NOT model — `--jinja`
|
|
12789
|
+
* (which most vision chat templates need and some language-only models
|
|
12790
|
+
* dislike), `--cont-batching`, `--rope-scaling`, …
|
|
12791
|
+
*
|
|
12792
|
+
* It is NOT a second place to set the flags above. A token that collides
|
|
12793
|
+
* with a typed field is REJECTED at start, naming the field that owns it
|
|
12794
|
+
* (`assertNoOwnedFlags`), because two knobs writing the same argv is exactly
|
|
12795
|
+
* the "two switches that disagree" failure this repo has already shipped
|
|
12796
|
+
* twice (D62).
|
|
12797
|
+
*/
|
|
12798
|
+
extraArgs: array(string()).default([]),
|
|
12701
12799
|
/** Else lazy: first generate boots it. */
|
|
12702
12800
|
autoStart: boolean().default(false),
|
|
12703
12801
|
/** 0 = never; frees RAM after quiet periods. */
|
|
12704
12802
|
idleStopMinutes: number().int().default(30)
|
|
12705
12803
|
});
|
|
12804
|
+
/**
|
|
12805
|
+
* Where a multi-GB install currently is. A single 0..1 fraction cannot answer
|
|
12806
|
+
* "is it stuck?" for an install that is three files (shards + mmproj) followed
|
|
12807
|
+
* by a sha256 pass over 22 GB — during which the fraction sat at 1.0 and the
|
|
12808
|
+
* node looked hung. Phase + file + bytes is the smallest shape that does.
|
|
12809
|
+
*/
|
|
12810
|
+
var LlmDownloadProgressSchema = object({
|
|
12811
|
+
phase: _enum(["downloading", "verifying"]),
|
|
12812
|
+
/** The artifact currently moving, e.g. `mmproj-F16.gguf`. */
|
|
12813
|
+
file: string(),
|
|
12814
|
+
fileIndex: number().int(),
|
|
12815
|
+
fileCount: number().int(),
|
|
12816
|
+
/** Across the WHOLE install, not the current file. */
|
|
12817
|
+
downloadedBytes: number(),
|
|
12818
|
+
totalBytes: number().optional()
|
|
12819
|
+
});
|
|
12706
12820
|
var LlmRuntimeStatusSchema = object({
|
|
12707
12821
|
/** Status is ALWAYS node-qualified. */
|
|
12708
12822
|
nodeId: string(),
|
|
@@ -12719,6 +12833,8 @@ var LlmRuntimeStatusSchema = object({
|
|
|
12719
12833
|
modelPath: string().optional(),
|
|
12720
12834
|
modelId: string().optional(),
|
|
12721
12835
|
downloadProgress: number().min(0).max(1).optional(),
|
|
12836
|
+
/** Detail behind `downloadProgress`; present for the same lifetime. */
|
|
12837
|
+
download: LlmDownloadProgressSchema.optional(),
|
|
12722
12838
|
lastError: string().optional(),
|
|
12723
12839
|
crashesInWindow: number(),
|
|
12724
12840
|
/** Child RSS (sampled best-effort). */
|
|
@@ -12729,7 +12845,14 @@ var LlmNodeModelSchema = object({
|
|
|
12729
12845
|
file: string(),
|
|
12730
12846
|
sizeBytes: number(),
|
|
12731
12847
|
catalogId: string().optional(),
|
|
12732
|
-
installedAt: number().optional()
|
|
12848
|
+
installedAt: number().optional(),
|
|
12849
|
+
/**
|
|
12850
|
+
* Absolute path on the node. Present so a file that is on disk but matches
|
|
12851
|
+
* no catalog entry — a custom Hugging Face install, or a GGUF the operator
|
|
12852
|
+
* copied in by hand — is still SELECTABLE, as a `{kind:'path'}` ref. Without
|
|
12853
|
+
* it the picker could list such a file and do nothing with it.
|
|
12854
|
+
*/
|
|
12855
|
+
path: string().optional()
|
|
12733
12856
|
});
|
|
12734
12857
|
var LlmRuntimeDiskUsageSchema = object({
|
|
12735
12858
|
nodeId: string(),
|
|
@@ -12785,10 +12908,47 @@ var LlmProfileSchema = object({
|
|
|
12785
12908
|
baseUrl: string().optional(),
|
|
12786
12909
|
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
12787
12910
|
apiKey: string().optional(),
|
|
12911
|
+
/** Vision on/off. A vision call against a `false` profile is REFUSED, never
|
|
12912
|
+
* degraded to text — that shipped once and produced a confident answer to a
|
|
12913
|
+
* question about a picture nobody sent. */
|
|
12788
12914
|
supportsVision: boolean(),
|
|
12789
12915
|
temperature: number().min(0).max(2).optional(),
|
|
12916
|
+
/** Nucleus sampling. Every wire we speak has it. */
|
|
12917
|
+
topP: number().min(0).max(1).optional(),
|
|
12918
|
+
/** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
|
|
12919
|
+
* wire does, and the client drops it there (measured: the request body gets
|
|
12920
|
+
* `top_p` and no `top_k`). The profile editor hides the field wherever it
|
|
12921
|
+
* would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
|
|
12922
|
+
topK: number().int().positive().optional(),
|
|
12790
12923
|
maxTokens: number().int().positive().optional(),
|
|
12924
|
+
/** Prompt context window. Advisory for cloud kinds (they enforce their own);
|
|
12925
|
+
* for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
|
|
12926
|
+
* the model with, so it is the one field that changes a PROCESS. */
|
|
12927
|
+
contextLength: number().int().positive().optional(),
|
|
12928
|
+
/** Default system prompt. A caller's `system` REPLACES it (never appends —
|
|
12929
|
+
* two system prompts fighting is worse than either alone). */
|
|
12930
|
+
systemPrompt: string().optional(),
|
|
12931
|
+
/** Total generation bound — the only one a unary call has. */
|
|
12791
12932
|
timeoutMs: number().int().positive().default(6e4),
|
|
12933
|
+
/** The TCP handshake only — "is the port even open". NOT the wait for
|
|
12934
|
+
* response headers: on the LM Studio / llama-server wire those are written
|
|
12935
|
+
* once the model has finished loading, so they belong to the bound below. */
|
|
12936
|
+
connectTimeoutMs: number().int().positive().default(1e4),
|
|
12937
|
+
/** Accepted, but no output yet — response headers included, because a cold
|
|
12938
|
+
* GPU load is exactly what happens before them. */
|
|
12939
|
+
firstTokenTimeoutMs: number().int().positive().default(12e4),
|
|
12940
|
+
/** Output started then stopped. */
|
|
12941
|
+
idleTimeoutMs: number().int().positive().default(6e4),
|
|
12942
|
+
/** Profile-level default. The per-consumer table and a per-call override
|
|
12943
|
+
* both beat it — see `resolveRetryPolicy`. */
|
|
12944
|
+
retry: LlmRetryPolicySchema.default({
|
|
12945
|
+
enabled: false,
|
|
12946
|
+
maxAttempts: 1
|
|
12947
|
+
}),
|
|
12948
|
+
/** Whether this profile may use tools. The tool-call plumbing rides the
|
|
12949
|
+
* library; the REGISTRY of callable tools is ours and is empty in v1, so a
|
|
12950
|
+
* `true` here buys the wiring, not behaviour, until tools are registered. */
|
|
12951
|
+
toolsEnabled: boolean().default(false),
|
|
12792
12952
|
extraHeaders: record(string(), string()).optional(),
|
|
12793
12953
|
/** kind === 'managed-local' only (spec §4). */
|
|
12794
12954
|
runtime: ManagedRuntimeConfigSchema.optional()
|
|
@@ -12838,6 +12998,36 @@ var ManagedModelCatalogEntrySchema = object({
|
|
|
12838
12998
|
/** Vision models: companion projector file. */
|
|
12839
12999
|
mmprojUrl: string().optional()
|
|
12840
13000
|
});
|
|
13001
|
+
/**
|
|
13002
|
+
* The outcome of turning one operator-typed Hugging Face reference into a
|
|
13003
|
+
* download plan. A RESULT, never a throw: "this repo has 24 quantizations and
|
|
13004
|
+
* I will not pick for you" is a normal answer the UI has to render, not an
|
|
13005
|
+
* exception.
|
|
13006
|
+
*
|
|
13007
|
+
* `candidates` is the whole reason the refusal is usable — every string in it
|
|
13008
|
+
* is a tag that resolves when pasted back as `<org>/<repo>:<TAG>`.
|
|
13009
|
+
*/
|
|
13010
|
+
var HfModelResolutionSchema = discriminatedUnion("ok", [object({
|
|
13011
|
+
ok: literal(true),
|
|
13012
|
+
/** Ready to hand to `installModel` unchanged. */
|
|
13013
|
+
model: ManagedModelRefSchema,
|
|
13014
|
+
label: string(),
|
|
13015
|
+
repo: string(),
|
|
13016
|
+
quantization: string(),
|
|
13017
|
+
purpose: _enum(["text", "vision"]),
|
|
13018
|
+
totalBytes: number(),
|
|
13019
|
+
/** mmproj + shards, for the preview: an operator approving 23 GB should
|
|
13020
|
+
* see that 0.9 GB of it is a projector they did not name. */
|
|
13021
|
+
extraFilenames: array(string())
|
|
13022
|
+
}), object({
|
|
13023
|
+
ok: literal(false),
|
|
13024
|
+
code: string(),
|
|
13025
|
+
message: string(),
|
|
13026
|
+
candidates: array(string()).optional(),
|
|
13027
|
+
/** Set when the refusal was only the ceiling: re-calling with
|
|
13028
|
+
* `maxBytes: requiredBytes` is the operator's explicit override. */
|
|
13029
|
+
requiredBytes: number().optional()
|
|
13030
|
+
})]);
|
|
12841
13031
|
var LlmRuntimeNodeSchema = object({
|
|
12842
13032
|
nodeId: string(),
|
|
12843
13033
|
reachable: boolean(),
|
|
@@ -12850,7 +13040,10 @@ var ProfileRefInputSchema = object({
|
|
|
12850
13040
|
addonId: string(),
|
|
12851
13041
|
profileId: string()
|
|
12852
13042
|
});
|
|
12853
|
-
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({
|
|
13043
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({
|
|
13044
|
+
addonId: string().optional(),
|
|
13045
|
+
requestId: string()
|
|
13046
|
+
}), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
12854
13047
|
kind: "mutation",
|
|
12855
13048
|
auth: "admin"
|
|
12856
13049
|
}), method(ProfileRefInputSchema, _void(), {
|
|
@@ -12871,6 +13064,15 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
|
|
|
12871
13064
|
consumer: string().optional(),
|
|
12872
13065
|
profileId: string().optional()
|
|
12873
13066
|
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
13067
|
+
/** `https://huggingface.co/<org>/<repo>/resolve/main/<f>.gguf`,
|
|
13068
|
+
* `<org>/<repo>/<f>.gguf`, `<org>/<repo>` or `<org>/<repo>:<QUANT>`. */
|
|
13069
|
+
ref: string(),
|
|
13070
|
+
/** Explicit ceiling override, in bytes. Absent = the built-in ceiling. */
|
|
13071
|
+
maxBytes: number().positive().optional()
|
|
13072
|
+
}), HfModelResolutionSchema, {
|
|
13073
|
+
kind: "mutation",
|
|
13074
|
+
auth: "admin"
|
|
13075
|
+
}), method(object({
|
|
12874
13076
|
nodeId: string(),
|
|
12875
13077
|
model: ManagedModelRefSchema
|
|
12876
13078
|
}), _void(), {
|
|
@@ -14624,28 +14826,36 @@ var NcOccupancyConditionSchema = object({
|
|
|
14624
14826
|
/**
|
|
14625
14827
|
* Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
|
|
14626
14828
|
*
|
|
14627
|
-
*
|
|
14628
|
-
*
|
|
14629
|
-
*
|
|
14630
|
-
*
|
|
14631
|
-
*
|
|
14632
|
-
*
|
|
14633
|
-
*
|
|
14634
|
-
*
|
|
14635
|
-
*
|
|
14636
|
-
*
|
|
14637
|
-
*
|
|
14638
|
-
*
|
|
14639
|
-
*
|
|
14640
|
-
*
|
|
14641
|
-
*
|
|
14642
|
-
*
|
|
14643
|
-
*
|
|
14644
|
-
*
|
|
14645
|
-
*
|
|
14646
|
-
*
|
|
14647
|
-
*
|
|
14648
|
-
* `
|
|
14829
|
+
* **TWO EXCLUSIVE MODES** (operator decision 2026-08-14, D157). Which one a
|
|
14830
|
+
* rule is in is not a stored field — it is WHICH FILTER the rule carries, so
|
|
14831
|
+
* there is no second switch that can disagree with the first and every rule
|
|
14832
|
+
* authored before the decision migrates for free (`audioModeOf`):
|
|
14833
|
+
*
|
|
14834
|
+
* - **LABEL mode — `labels` present.** The rule fires on the FIRST frame the
|
|
14835
|
+
* classifier labels with one of them. No window, no percentage:
|
|
14836
|
+
* `hitPercent` and `samplingSeconds` are ignored, and the rule's own
|
|
14837
|
+
* `throttle` cooldown is the only brake. The per-label confidence floor is
|
|
14838
|
+
* the analyzer's (`classificationMinScore`, per device) — a label only
|
|
14839
|
+
* reaches this condition if the classifier was already confident enough.
|
|
14840
|
+
* - **LEVEL mode — `dbThreshold` present, no labels.** The sampling window IS
|
|
14841
|
+
* the condition: at least `hitPercent`% of the samples over
|
|
14842
|
+
* `samplingSeconds` must be at or above `dbThreshold` dBFS (see
|
|
14843
|
+
* {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale). The window
|
|
14844
|
+
* must be FULL before it can match — a window open for two of its ten
|
|
14845
|
+
* seconds is 100% of nothing.
|
|
14846
|
+
*
|
|
14847
|
+
* **Why label mode has no window.** It had one, and it never fired: the
|
|
14848
|
+
* analyzer emits ~1 audio frame per second but YAMNet only LABELS one to three
|
|
14849
|
+
* of them per episode, even through continuous crying. The measured maximum
|
|
14850
|
+
* `hitPercent` over the whole live history was 40 — under the shipped default
|
|
14851
|
+
* of 60, so a label rule could not fire at all, ever. A percentage of frames is
|
|
14852
|
+
* the wrong question to ask of a sparse classifier.
|
|
14853
|
+
*
|
|
14854
|
+
* **Fail-closed when NEITHER is given** — every sample would be a trivial hit
|
|
14855
|
+
* and the rule would fire on silence. The schema cannot express "exactly one
|
|
14856
|
+
* of" without becoming a ZodEffects the cap path would have to special-case, so
|
|
14857
|
+
* the exclusivity is enforced where every editor writes (`patchAudio`) and a
|
|
14858
|
+
* legacy rule carrying both resolves to LABEL (the mode that fires).
|
|
14649
14859
|
*
|
|
14650
14860
|
* Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
|
|
14651
14861
|
* `audio-*` ids). Both spellings are accepted — the matcher normalizes the
|
|
@@ -14653,13 +14863,13 @@ var NcOccupancyConditionSchema = object({
|
|
|
14653
14863
|
* an operator who typed `dog` mean the same thing.
|
|
14654
14864
|
*/
|
|
14655
14865
|
var NcAudioConditionSchema = object({
|
|
14656
|
-
/**
|
|
14866
|
+
/** LABEL MODE: audio macro labels. Present ⇒ fires on the first labelled frame. */
|
|
14657
14867
|
labels: array(string().min(1)).min(1).optional(),
|
|
14658
|
-
/**
|
|
14868
|
+
/** LEVEL MODE: floor in dBFS (negative-going, `0` = full scale). */
|
|
14659
14869
|
dbThreshold: number().min(-96).max(0).optional(),
|
|
14660
|
-
/**
|
|
14870
|
+
/** LEVEL MODE ONLY: percentage of the window's samples that must be hits (1–100). */
|
|
14661
14871
|
hitPercent: number().int().min(1).max(100).default(60),
|
|
14662
|
-
/**
|
|
14872
|
+
/** LEVEL MODE ONLY: length of the sampling window in seconds. */
|
|
14663
14873
|
samplingSeconds: number().int().min(1).max(300).default(10)
|
|
14664
14874
|
});
|
|
14665
14875
|
/**
|
|
@@ -14797,13 +15007,81 @@ var NcRuleActionsSchema = object({
|
|
|
14797
15007
|
*/
|
|
14798
15008
|
buttons: array(NcRuleNotificationButtonSchema).max(8).optional()
|
|
14799
15009
|
});
|
|
15010
|
+
/**
|
|
15011
|
+
* "This rule applies only while `deviceId` is in one of `states`."
|
|
15012
|
+
*
|
|
15013
|
+
* The states are the DEVICE's own vocabulary — `AlarmState` for a panel,
|
|
15014
|
+
* `on`/`off` for a switch — not a normalised set, because normalising would
|
|
15015
|
+
* make the condition lie about devices whose states have no equivalent.
|
|
15016
|
+
*
|
|
15017
|
+
* An unreadable state does NOT match: see the engine's fail-closed gate. A
|
|
15018
|
+
* condition that fired on "I could not read it" would be worse than no gate.
|
|
15019
|
+
*/
|
|
15020
|
+
var NcDeviceStateConditionSchema = object({
|
|
15021
|
+
deviceId: number().int(),
|
|
15022
|
+
/** Any of these matches. */
|
|
15023
|
+
states: array(string().min(1)).min(1)
|
|
15024
|
+
});
|
|
15025
|
+
/**
|
|
15026
|
+
* "This rule applies only while scene `sceneId` is `matched` / `diverged`."
|
|
15027
|
+
*
|
|
15028
|
+
* A GATE, not a trigger. `occupancy` and `audio` each DISCRIMINATE their rule —
|
|
15029
|
+
* carrying one makes the rule fire on that subject and nothing else. Scene is
|
|
15030
|
+
* the other shape entirely, the `deviceState` shape: it narrows a rule that
|
|
15031
|
+
* already has a trigger ("tell me about a person at the front door, but only
|
|
15032
|
+
* while the bin is still out"). That is why it composes with every delivery
|
|
15033
|
+
* instead of owning one, and why no new `NcDelivery` member and no new subject
|
|
15034
|
+
* kind exist for it — see D159.
|
|
15035
|
+
*
|
|
15036
|
+
* ── Identity ───────────────────────────────────────────────────────────────
|
|
15037
|
+
* `sceneId` is `SceneMonitor.id`, a `randomUUID()` minted by `createScene` —
|
|
15038
|
+
* globally unique, so it needs no device to disambiguate it. `deviceId` is
|
|
15039
|
+
* carried as a HINT for the editor and for the log line, never as part of the
|
|
15040
|
+
* lookup key: a rule whose hint drifted must still gate correctly.
|
|
15041
|
+
*
|
|
15042
|
+
* ── Which boolean ──────────────────────────────────────────────────────────
|
|
15043
|
+
* `latched` ABSENT means "whatever the scene itself says" — `SceneMonitor.emit`
|
|
15044
|
+
* already declares which boolean drives notification rules, and a second knob
|
|
15045
|
+
* that could disagree with it is exactly the D62 failure. Set it only to
|
|
15046
|
+
* override one rule against the scene's own default.
|
|
15047
|
+
*
|
|
15048
|
+
* - LIVE reading (`emit`/`latched` resolve to live): passes iff
|
|
15049
|
+
* `verdict === requiredState`. `unknown` — no reference for this light, view
|
|
15050
|
+
* shifted, no snapshot — passes NEITHER. A scene that cannot judge is not
|
|
15051
|
+
* evidence, in either direction.
|
|
15052
|
+
* - LATCHED reading: passes iff `latched === (requiredState === 'diverged')`.
|
|
15053
|
+
* The latch is a durable fact about the past ("it has diverged since I armed
|
|
15054
|
+
* it"), so a camera that has gone dark does not clear it — that is the whole
|
|
15055
|
+
* reason the operator asked for a latch.
|
|
15056
|
+
*
|
|
15057
|
+
* The gate reads an in-memory mirror (`NcSceneStateCache`) refreshed OFF the
|
|
15058
|
+
* event path, never the cap: D49. A mirror that has never loaded, or a scene it
|
|
15059
|
+
* does not carry, reads absent and the rule does NOT fire — fail closed, and
|
|
15060
|
+
* said out loud in the log rather than dropped in silence.
|
|
15061
|
+
*/
|
|
15062
|
+
var NcSceneConditionSchema = object({
|
|
15063
|
+
/** `SceneMonitor.id` — the uuid the cap mints. The whole lookup key. */
|
|
15064
|
+
sceneId: string().min(1),
|
|
15065
|
+
/** The camera the scene lives on. A hint for the editor and the log line. */
|
|
15066
|
+
deviceId: number().int().optional(),
|
|
15067
|
+
/** The state the scene must be in for the rule to fire. */
|
|
15068
|
+
requiredState: _enum(["matched", "diverged"]),
|
|
15069
|
+
/**
|
|
15070
|
+
* Read the LATCH (`true`) or the LIVE verdict (`false`). Absent = follow the
|
|
15071
|
+
* scene's own `emit` field, which is the only place that decision belongs.
|
|
15072
|
+
*/
|
|
15073
|
+
latched: boolean().optional()
|
|
15074
|
+
});
|
|
14800
15075
|
var NcConditionsSchema = object({
|
|
14801
15076
|
/** Gate on ANOTHER device's current state (the alarm armed, a switch on). */
|
|
14802
|
-
deviceState:
|
|
14803
|
-
|
|
14804
|
-
|
|
14805
|
-
|
|
14806
|
-
|
|
15077
|
+
deviceState: NcDeviceStateConditionSchema.optional(),
|
|
15078
|
+
/**
|
|
15079
|
+
* Gate on a SCENE's state — "only while the bin is still out". Composes with
|
|
15080
|
+
* every trigger (detection, occupancy, audio, sensor, package, track-end);
|
|
15081
|
+
* unlike `occupancy`/`audio` it discriminates nothing. See
|
|
15082
|
+
* {@link NcSceneCondition} and D159.
|
|
15083
|
+
*/
|
|
15084
|
+
scene: NcSceneConditionSchema.optional(),
|
|
14807
15085
|
/** Device scope — absent = all devices. */
|
|
14808
15086
|
devices: array(number()).optional(),
|
|
14809
15087
|
/** Detector class names (any overlap with the record's class set). */
|
|
@@ -15441,6 +15719,7 @@ var NcConditionDescriptorSchema = object({
|
|
|
15441
15719
|
"occupancy",
|
|
15442
15720
|
"audio",
|
|
15443
15721
|
"deviceState",
|
|
15722
|
+
"scene",
|
|
15444
15723
|
"systemEvent"
|
|
15445
15724
|
]),
|
|
15446
15725
|
operator: _enum([
|
|
@@ -16918,7 +17197,10 @@ var RecentTracksQueryInput = object({
|
|
|
16918
17197
|
* Encodes the (lastSeen, trackId) sort position — treat as opaque. */
|
|
16919
17198
|
cursor: string().optional(),
|
|
16920
17199
|
/** See {@link TrackProjectionSchema}. Default `full`. */
|
|
16921
|
-
projection: TrackProjectionSchema.optional()
|
|
17200
|
+
projection: TrackProjectionSchema.optional(),
|
|
17201
|
+
/** Include stationary-promoted rows (parked objects). Default false: the
|
|
17202
|
+
* feed lists passages; parking records live on the stationary registry. */
|
|
17203
|
+
includeStationary: boolean().optional()
|
|
16922
17204
|
});
|
|
16923
17205
|
var RecentTracksPageSchema = object({
|
|
16924
17206
|
/** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
|
|
@@ -17136,7 +17418,11 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
17136
17418
|
zone: TrackZoneFilterSchema.optional(),
|
|
17137
17419
|
/** See {@link TrackProjectionSchema}. Default `full` (backward
|
|
17138
17420
|
* compatible — omitting the field keeps today's exact behaviour). */
|
|
17139
|
-
projection: TrackProjectionSchema.optional()
|
|
17421
|
+
projection: TrackProjectionSchema.optional(),
|
|
17422
|
+
/** Include stationary-promoted rows (parked objects handed to the
|
|
17423
|
+
* stationary registry). Default false: the timeline lists passages,
|
|
17424
|
+
* not parking records (operator decision, 2026-08-15). */
|
|
17425
|
+
includeStationary: boolean().optional()
|
|
17140
17426
|
}), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
|
|
17141
17427
|
kind: "mutation",
|
|
17142
17428
|
auth: "admin"
|
|
@@ -17300,11 +17586,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
17300
17586
|
auth: "admin"
|
|
17301
17587
|
}), method(object({
|
|
17302
17588
|
eventId: string(),
|
|
17303
|
-
kind: MediaFileKindEnum.optional()
|
|
17589
|
+
kind: MediaFileKindEnum.optional(),
|
|
17590
|
+
deviceId: number()
|
|
17304
17591
|
}), array(MediaFileSchema).readonly()), method(object({
|
|
17305
17592
|
trackId: string(),
|
|
17306
|
-
kinds: array(MediaFileKindEnum).optional()
|
|
17307
|
-
|
|
17593
|
+
kinds: array(MediaFileKindEnum).optional(),
|
|
17594
|
+
deviceId: number()
|
|
17595
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
17596
|
+
trackId: string(),
|
|
17597
|
+
deviceId: number()
|
|
17598
|
+
}), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
17308
17599
|
kind: "mutation",
|
|
17309
17600
|
auth: "admin"
|
|
17310
17601
|
}), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
|
|
@@ -18004,6 +18295,17 @@ var maxSessionHoldMsField = {
|
|
|
18004
18295
|
default: 12e4,
|
|
18005
18296
|
step: 5e3
|
|
18006
18297
|
};
|
|
18298
|
+
/**
|
|
18299
|
+
* Quiet period that closes an `audioMode: 'on-motion'` audio window. Floor of
|
|
18300
|
+
* 5s so a rearm can never degenerate into per-event stream churn; default 90s
|
|
18301
|
+
* comfortably outlives the gap between two PIR wakes on a battery camera.
|
|
18302
|
+
*/
|
|
18303
|
+
var audioMotionWindowMsField = {
|
|
18304
|
+
min: 5e3,
|
|
18305
|
+
max: 6e5,
|
|
18306
|
+
default: 9e4,
|
|
18307
|
+
step: 5e3
|
|
18308
|
+
};
|
|
18007
18309
|
var motionFpsField = {
|
|
18008
18310
|
min: 1,
|
|
18009
18311
|
max: 30,
|
|
@@ -18180,6 +18482,27 @@ var RunnerCameraConfigSchema = object({
|
|
|
18180
18482
|
* resolved `CameraDetectionConfig`.
|
|
18181
18483
|
*/
|
|
18182
18484
|
maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
|
|
18485
|
+
/**
|
|
18486
|
+
* Orchestrator-side quiet period (ms) that closes an `audioMode:
|
|
18487
|
+
* 'on-motion'` audio window, measured from the LAST motion event.
|
|
18488
|
+
*
|
|
18489
|
+
* This exists because the falling edge cannot be relied on. Camera-native
|
|
18490
|
+
* providers emit motion as a RISING EDGE ONLY (Reolink's Baichuan push and
|
|
18491
|
+
* its email-push SMTP path both emit `detected: true` and never the
|
|
18492
|
+
* counterpart); only the frame-diff analyzer emits falls. So on an
|
|
18493
|
+
* onboard-only camera a window that closed only on `detected: false` never
|
|
18494
|
+
* closed at all, and `on-motion` silently behaved as `always-on` — on a
|
|
18495
|
+
* battery camera, the one failure mode the mode exists to prevent.
|
|
18496
|
+
*
|
|
18497
|
+
* Every motion event rearms this timer WITHOUT restarting the stream, so a
|
|
18498
|
+
* burst of re-fires costs nothing. A falling edge, when one does arrive,
|
|
18499
|
+
* still closes earlier via `motionCooldownMs` — whichever comes first wins.
|
|
18500
|
+
*
|
|
18501
|
+
* Not consumed by the runner: carried here so it shares the per-camera
|
|
18502
|
+
* device-settings surface with `motionCooldownMs`, exactly like
|
|
18503
|
+
* `maxSessionHoldMs`.
|
|
18504
|
+
*/
|
|
18505
|
+
audioMotionWindowMs: number().min(audioMotionWindowMsField.min).max(audioMotionWindowMsField.max).optional(),
|
|
18183
18506
|
motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
|
|
18184
18507
|
detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
|
|
18185
18508
|
motionStreamId: string(),
|
|
@@ -18275,7 +18598,7 @@ var RunnerCameraConfigSchema = object({
|
|
|
18275
18598
|
*/
|
|
18276
18599
|
inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
|
|
18277
18600
|
});
|
|
18278
|
-
motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
|
|
18601
|
+
motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, audioMotionWindowMsField.min, audioMotionWindowMsField.max, audioMotionWindowMsField.step, audioMotionWindowMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
|
|
18279
18602
|
/**
|
|
18280
18603
|
* Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
|
|
18281
18604
|
* load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
|
|
@@ -19380,7 +19703,16 @@ targets: array(object({
|
|
|
19380
19703
|
/** A sleeping battery camera: the frame is deliberately stale and will
|
|
19381
19704
|
* NOT refresh in the background. A surface should say so rather than
|
|
19382
19705
|
* present it as current. */
|
|
19383
|
-
sleeping: boolean()
|
|
19706
|
+
sleeping: boolean(),
|
|
19707
|
+
/** Current device state rendered over the cached frame. State images
|
|
19708
|
+
* remain authoritative even when their photographic background is
|
|
19709
|
+
* old; null means the link must carry a current camera frame. */
|
|
19710
|
+
stateReason: _enum([
|
|
19711
|
+
"disabled",
|
|
19712
|
+
"sleeping",
|
|
19713
|
+
"unreachable",
|
|
19714
|
+
"waking"
|
|
19715
|
+
]).nullable()
|
|
19384
19716
|
})))
|
|
19385
19717
|
},
|
|
19386
19718
|
status: {
|
|
@@ -21040,6 +21372,25 @@ var BatteryStatusSchema = object({
|
|
|
21040
21372
|
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
21041
21373
|
lastUpdated: number(),
|
|
21042
21374
|
/**
|
|
21375
|
+
* Ms epoch of the last time the device PROVED it was reachable — a
|
|
21376
|
+
* completed firmware round-trip, an observed wake, or an inbound push
|
|
21377
|
+
* (firmware event, email). `0`/absent = never since this slice was born.
|
|
21378
|
+
*
|
|
21379
|
+
* This is the ONLY input that separates "asleep" from "gone", and it is
|
|
21380
|
+
* fed exclusively by PASSIVE signals: nothing may write it by reaching
|
|
21381
|
+
* for the radio, because a poll that confirms reachability is the same
|
|
21382
|
+
* poll that drains the battery. See {@link deriveBatteryPresence} — the
|
|
21383
|
+
* single derivation every consumer must use; no surface computes its own.
|
|
21384
|
+
*
|
|
21385
|
+
* It is deliberately NOT a clock in the
|
|
21386
|
+
* `scripts/check-runtime-state-durability.ts` sense: it is the
|
|
21387
|
+
* observation itself, and it is the only thing a 30-hour silence is
|
|
21388
|
+
* visible in. Writers quantise it (see `CONTACT_WRITE_QUANTUM_MS` in the
|
|
21389
|
+
* Reolink provider) so a value that means "recently" cannot cost a
|
|
21390
|
+
* SQLite commit per round-trip.
|
|
21391
|
+
*/
|
|
21392
|
+
lastContactAt: number().optional(),
|
|
21393
|
+
/**
|
|
21043
21394
|
* True when the source is a BINARY low-battery indicator (HA
|
|
21044
21395
|
* `binary_sensor` device_class=battery / `LOW_BAT`) that has no real
|
|
21045
21396
|
* charge level — `percentage` is then a coarse stand-in (100 = normal,
|
|
@@ -26571,10 +26922,22 @@ method(object({
|
|
|
26571
26922
|
* thing except the comparator: `similarity` (CLIP cosine at the same ROI coords
|
|
26572
26923
|
* vs condition-tagged references) and `llm` (vision-LLM judgment over the crop).
|
|
26573
26924
|
*
|
|
26574
|
-
*
|
|
26575
|
-
*
|
|
26576
|
-
*
|
|
26577
|
-
*
|
|
26925
|
+
* **No `deviceConfig`, deliberately.** This shipped as the D14 widget archetype,
|
|
26926
|
+
* which put a "Scenes" tab on one camera's detail page. That is the wrong shape
|
|
26927
|
+
* for the thing: a scene is a standing question about the property ("is the bin
|
|
26928
|
+
* still out"), and the operator's question is "which of my scenes have tripped",
|
|
26929
|
+
* across every camera at once — not "what does camera 617 think". Buried one
|
|
26930
|
+
* camera deep it also could not be found. The surface is now a top-level admin
|
|
26931
|
+
* page (`/scenes`, `pages/Scenes.tsx`) that lists every scene on every camera and
|
|
26932
|
+
* picks the camera inside the create flow, the same shape Events and Faces have.
|
|
26933
|
+
*
|
|
26934
|
+
* The consequence to keep in mind: `host/scene-monitor-editor` is gone from
|
|
26935
|
+
* `HOST_WIDGETS` too. `scripts/check-host-widget-resolves.ts` asserts BOTH
|
|
26936
|
+
* directions, so a registration nobody declares fails exactly as loudly as a
|
|
26937
|
+
* declaration nobody registers. The editor is imported directly by the page.
|
|
26938
|
+
*
|
|
26939
|
+
* `status.kind:'push'` — the engine pushes on every hysteresis flip /
|
|
26940
|
+
* availability change; consumers never poll.
|
|
26578
26941
|
*/
|
|
26579
26942
|
/** Extensible condition tag. Seeded 'day' | 'ir' (the two variants the operator
|
|
26580
26943
|
* captures) plus 'night' | 'dawn' | 'dusk' from the resolver's sun-times band.
|
|
@@ -26585,6 +26948,33 @@ method(object({
|
|
|
26585
26948
|
* as `unknown`, never guessed. A day reference scored against an IR frame
|
|
26586
26949
|
* collapses the cosine and would latch a false alarm every single night. */
|
|
26587
26950
|
var SceneConditionSchema = string();
|
|
26951
|
+
/**
|
|
26952
|
+
* What a scene does when the CURRENT light has no reference of its own.
|
|
26953
|
+
*
|
|
26954
|
+
* The lighting variants are not equally likely to exist. Almost every operator
|
|
26955
|
+
* captures daylight and then never stands outside at 22:00 to capture IR, and a
|
|
26956
|
+
* scene that is only ever going to be asked about a daytime question ("is the
|
|
26957
|
+
* bin still on the kerb at 08:00") does not need a night reference at all. The
|
|
26958
|
+
* night half must therefore be OPTIONAL, and optional means the scene keeps
|
|
26959
|
+
* working without it rather than degrading into a permanent complaint.
|
|
26960
|
+
*
|
|
26961
|
+
* - `skip` (default) — the check in that light is not made. Not a verdict, not
|
|
26962
|
+
* an alarm, not even an `unknown`: the live state simply stays whatever the
|
|
26963
|
+
* last covered light left it at, the latch is untouched, and the hysteresis
|
|
26964
|
+
* run is neither spent nor cleared. The scene resumes by itself at first
|
|
26965
|
+
* light. This is the only behaviour under which "I never captured IR" is a
|
|
26966
|
+
* configuration choice instead of a nightly fault.
|
|
26967
|
+
* - `judge-anyway` — score against the OTHER conditions' references. Available
|
|
26968
|
+
* for cameras whose IR frame is close enough to daylight (a floodlit
|
|
26969
|
+
* driveway, an always-white-light doorbell), and wrong for everything else:
|
|
26970
|
+
* cross-condition cosines are not comparable, so a day reference against a
|
|
26971
|
+
* true IR frame collapses and the scene reports a theft at 21:40.
|
|
26972
|
+
*
|
|
26973
|
+
* Never applies when the scene has NO comparable reference at all — that is
|
|
26974
|
+
* "not armed yet", it is reported as `no-reference-for-condition`, and silence
|
|
26975
|
+
* there would hide a scene the operator never finished setting up.
|
|
26976
|
+
*/
|
|
26977
|
+
var SceneUncoveredPolicySchema = _enum(["skip", "judge-anyway"]);
|
|
26588
26978
|
/** `matched` = the baseline is what we see; `diverged` = it demonstrably is not;
|
|
26589
26979
|
* `unknown` = we cannot judge (no reference for this condition, encoder model
|
|
26590
26980
|
* changed, view shifted, no snapshot). `unknown` is a real value, not a null,
|
|
@@ -26640,6 +27030,9 @@ var SceneCheckSchema = discriminatedUnion("mode", [object({
|
|
|
26640
27030
|
hysteresisCount: number().int().positive()
|
|
26641
27031
|
})]);
|
|
26642
27032
|
var SCENE_DEFAULT_ANCHOR_THRESHOLD = .85;
|
|
27033
|
+
/** Night is OPTIONAL. A scene with only a daylight reference sits the IR hours
|
|
27034
|
+
* out in silence rather than reporting a fault every night. */
|
|
27035
|
+
var SCENE_DEFAULT_UNCOVERED_POLICY = "skip";
|
|
26643
27036
|
/**
|
|
26644
27037
|
* Vision-model adjudication of a candidate flip. Field names deliberately
|
|
26645
27038
|
* mirror `NcConfirmSchema` so an operator meets one vocabulary, not two.
|
|
@@ -26706,6 +27099,21 @@ var SceneMonitorSchema = object({
|
|
|
26706
27099
|
* automation can react to the bin coming back without the operator's own
|
|
26707
27100
|
* alarm silently clearing itself. */
|
|
26708
27101
|
autoRestore: boolean().default(false),
|
|
27102
|
+
/** What to do when the current light has no reference of its own. See
|
|
27103
|
+
* {@link SceneUncoveredPolicySchema} — the default makes night OPTIONAL. */
|
|
27104
|
+
onUncoveredCondition: SceneUncoveredPolicySchema.default(SCENE_DEFAULT_UNCOVERED_POLICY),
|
|
27105
|
+
/**
|
|
27106
|
+
* The light whose checks are currently being SAT OUT under
|
|
27107
|
+
* `onUncoveredCondition: 'skip'` — `null` when the scene is checking normally.
|
|
27108
|
+
*
|
|
27109
|
+
* Engine-reported and advisory only: it moves no verdict, no latch and no
|
|
27110
|
+
* hysteresis. It exists so the card can say *"night (IR) — checks paused,
|
|
27111
|
+
* nothing captured in this light"* in the same calm voice as the coverage
|
|
27112
|
+
* line, because the alternative is a scene that silently stops answering
|
|
27113
|
+
* after sunset with nothing anywhere saying why. A skipped check must never
|
|
27114
|
+
* read as a broken one.
|
|
27115
|
+
*/
|
|
27116
|
+
suspendedCondition: SceneConditionSchema.nullable().default(null),
|
|
26709
27117
|
/** Named cause when `verdict === 'unknown'`. */
|
|
26710
27118
|
unavailable: SceneUnavailableSchema.nullable(),
|
|
26711
27119
|
/** Conditions that have at least one comparable reference — the coverage line
|
|
@@ -26723,12 +27131,6 @@ var sceneMonitorCapability = {
|
|
|
26723
27131
|
kind: "wrapper",
|
|
26724
27132
|
defaultActive: true,
|
|
26725
27133
|
deviceTypes: [DeviceType.Camera],
|
|
26726
|
-
deviceConfig: { ui: {
|
|
26727
|
-
kind: "widget",
|
|
26728
|
-
widgetId: "host/scene-monitor-editor",
|
|
26729
|
-
tab: "scenes",
|
|
26730
|
-
label: "Scenes"
|
|
26731
|
-
} },
|
|
26732
27134
|
methods: {
|
|
26733
27135
|
listScenes: method(object({ deviceId: number() }), SceneMonitorStatusSchema),
|
|
26734
27136
|
createScene: method(object({
|
|
@@ -26765,6 +27167,7 @@ var sceneMonitorCapability = {
|
|
|
26765
27167
|
minObservationSpacingSec: number().int().min(0).max(3600).optional(),
|
|
26766
27168
|
anchorThreshold: number().min(0).max(1).optional(),
|
|
26767
27169
|
autoRestore: boolean().optional(),
|
|
27170
|
+
onUncoveredCondition: SceneUncoveredPolicySchema.optional(),
|
|
26768
27171
|
/** `null` clears the vision-model adjudicator. */
|
|
26769
27172
|
confirm: SceneConfirmSchema.nullable().optional()
|
|
26770
27173
|
})
|
|
@@ -27069,13 +27472,63 @@ var CamStreamDescriptorSchema = object({
|
|
|
27069
27472
|
* set of stream descriptors it can offer for the device, synchronously, so the
|
|
27070
27473
|
* broker can reconcile its registry against the authoritative provider state.
|
|
27071
27474
|
*/
|
|
27475
|
+
/**
|
|
27476
|
+
* The catalog as a DURABLE fact rather than a live answer.
|
|
27477
|
+
*
|
|
27478
|
+
* A battery camera's descriptors are profile-stable — they change when the
|
|
27479
|
+
* operator rewrites an encoder profile, not minute to minute — but building
|
|
27480
|
+
* them costs a Baichuan login, which on a sleeping Argus IS a wake. So the
|
|
27481
|
+
* provider is allowed to build them exactly once per profile and must serve
|
|
27482
|
+
* every later pull from a cache.
|
|
27483
|
+
*
|
|
27484
|
+
* Holding that cache only in RAM is what turned a restart into an outage. The
|
|
27485
|
+
* runner comes back with the camera asleep, `buildStreamCatalogUncached`
|
|
27486
|
+
* correctly refuses to wake it, the pull answers `[]`, the broker has no
|
|
27487
|
+
* cam-stream entry to build a broker from, and `webrtcSession.handleOffer`
|
|
27488
|
+
* fails with a flat "No broker for stream" — for as long as the camera sleeps,
|
|
27489
|
+
* which on a battery cam is most of the day. The camera was fine. The stream
|
|
27490
|
+
* was unreachable because the process had forgotten what the camera offers.
|
|
27491
|
+
*
|
|
27492
|
+
* Declaring it here puts it in `device-runtime-state`, the kernel's canonical
|
|
27493
|
+
* declared collection, with the same `restored` durability `battery` uses for
|
|
27494
|
+
* the same reason: the last known value is the only value there is while the
|
|
27495
|
+
* device is asleep. The broker's brokers are therefore always DEFINABLE — it
|
|
27496
|
+
* is the DIAL that wakes a camera, never the catalog (D173).
|
|
27497
|
+
*/
|
|
27498
|
+
var StreamCatalogStateSchema = object({
|
|
27499
|
+
/** The descriptors as last built from a real camera response. Never a guess:
|
|
27500
|
+
* a failed or refused build writes NOTHING, so a restored catalog is always
|
|
27501
|
+
* one the camera itself once produced. */
|
|
27502
|
+
descriptors: array(CamStreamDescriptorSchema),
|
|
27503
|
+
/** Ms epoch of the build that produced {@link descriptors}. Lets the wake
|
|
27504
|
+
* path decide whether the camera's own awake window is worth spending on a
|
|
27505
|
+
* re-read. */
|
|
27506
|
+
lastFetchedAt: number()
|
|
27507
|
+
});
|
|
27072
27508
|
var streamCatalogCapability = {
|
|
27073
27509
|
name: "stream-catalog",
|
|
27074
27510
|
scope: "device",
|
|
27075
27511
|
deviceNative: true,
|
|
27076
27512
|
mode: "singleton",
|
|
27077
27513
|
deviceTypes: [DeviceType.Camera],
|
|
27078
|
-
methods: { getCatalog: method(object({ deviceId: number().int().nonnegative() }), array(CamStreamDescriptorSchema).readonly()) }
|
|
27514
|
+
methods: { getCatalog: method(object({ deviceId: number().int().nonnegative() }), array(CamStreamDescriptorSchema).readonly()) },
|
|
27515
|
+
runtimeState: StreamCatalogStateSchema,
|
|
27516
|
+
/**
|
|
27517
|
+
* Runtime-state durability: **restored** — see the schema doc. A cold
|
|
27518
|
+
* catalog on a sleeping battery camera is not a slow first frame, it is a
|
|
27519
|
+
* camera that cannot be watched at all until it happens to wake.
|
|
27520
|
+
*
|
|
27521
|
+
* Churn is nil by construction: the slice is written only by a SUCCESSFUL
|
|
27522
|
+
* build, and a build only runs when there is no cached copy (or the copy is
|
|
27523
|
+
* a day old and the camera is awake anyway).
|
|
27524
|
+
*
|
|
27525
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
27526
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
27527
|
+
*/
|
|
27528
|
+
durability: "restored",
|
|
27529
|
+
/** Clock field: written, but excluded from the compare that decides whether
|
|
27530
|
+
* persisting is worth a SQLite commit — the descriptors are the value. */
|
|
27531
|
+
volatileStateFields: ["lastFetchedAt"]
|
|
27079
27532
|
};
|
|
27080
27533
|
/** One of the camera's stream profiles. */
|
|
27081
27534
|
var StreamProfileSchema = _enum([
|
|
@@ -27528,12 +27981,64 @@ var NetworkAddressSchema = object({
|
|
|
27528
27981
|
family: string(),
|
|
27529
27982
|
internal: boolean()
|
|
27530
27983
|
});
|
|
27984
|
+
/**
|
|
27985
|
+
* Provenance of the site coordinates, and the whole reason this is not just two
|
|
27986
|
+
* numbers.
|
|
27987
|
+
*
|
|
27988
|
+
* - `operator-set` — a human typed it, or accepted a detection. Authoritative;
|
|
27989
|
+
* nothing overwrites it.
|
|
27990
|
+
* - `derived-from-ip` — the hub geolocated its own public IP once, because a
|
|
27991
|
+
* default that is right to a few kilometres beats the coarse UTC clock split
|
|
27992
|
+
* the sun-times consumers otherwise fall back to.
|
|
27993
|
+
*
|
|
27994
|
+
* The UI shows which one it is. An operator who cannot tell a guess from their
|
|
27995
|
+
* own input will eventually trust the guess.
|
|
27996
|
+
*/
|
|
27997
|
+
var SiteLocationSourceSchema = _enum(["operator-set", "derived-from-ip"]);
|
|
27998
|
+
/**
|
|
27999
|
+
* The read shape: the location plus the honest state of the one-shot derivation.
|
|
28000
|
+
*
|
|
28001
|
+
* `derivationAttemptedAt` is what makes the "one call, ever" contract
|
|
28002
|
+
* inspectable. When it is set and `location` is null, the geo-IP lookup ran and
|
|
28003
|
+
* failed; the hub will NOT try again on its own — the fallback is declared
|
|
28004
|
+
* (consumers degrade to their own last resort) and the operator either types the
|
|
28005
|
+
* coordinates or presses detect.
|
|
28006
|
+
*/
|
|
28007
|
+
var SiteLocationStatusSchema = object({
|
|
28008
|
+
location: object({
|
|
28009
|
+
/** WGS84 decimal degrees. */
|
|
28010
|
+
latitude: number().min(-90).max(90),
|
|
28011
|
+
longitude: number().min(-180).max(180),
|
|
28012
|
+
source: SiteLocationSourceSchema,
|
|
28013
|
+
/** Epoch ms the value was last written. */
|
|
28014
|
+
updatedAt: number(),
|
|
28015
|
+
/**
|
|
28016
|
+
* Human-readable place the geo-IP service reported ("Napoli, IT"). Display
|
|
28017
|
+
* only — never parsed, never matched on. Absent for an operator-typed value.
|
|
28018
|
+
*/
|
|
28019
|
+
label: string().optional()
|
|
28020
|
+
}).nullable(),
|
|
28021
|
+
derivationAttemptedAt: number().nullable(),
|
|
28022
|
+
/** Why the last derivation failed, for the UI to show instead of a shrug. */
|
|
28023
|
+
derivationError: string().nullable()
|
|
28024
|
+
});
|
|
28025
|
+
/** `null` clears the location and re-arms nothing — the derivation stays spent. */
|
|
28026
|
+
var SetSiteLocationInputSchema = object({
|
|
28027
|
+
latitude: number().min(-90).max(90),
|
|
28028
|
+
longitude: number().min(-180).max(180)
|
|
28029
|
+
}).nullable();
|
|
27531
28030
|
method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string(), unknown()), _null(), {
|
|
27532
28031
|
kind: "mutation",
|
|
27533
28032
|
auth: "admin"
|
|
27534
28033
|
}), method(_void(), _void(), {
|
|
27535
28034
|
kind: "mutation",
|
|
27536
28035
|
auth: "admin"
|
|
28036
|
+
}), method(_void(), SiteLocationStatusSchema), method(SetSiteLocationInputSchema, SiteLocationStatusSchema, {
|
|
28037
|
+
kind: "mutation",
|
|
28038
|
+
auth: "admin"
|
|
28039
|
+
}), method(_void(), SiteLocationStatusSchema, {
|
|
28040
|
+
kind: "mutation",
|
|
28041
|
+
auth: "admin"
|
|
27537
28042
|
});
|
|
27538
28043
|
/**
|
|
27539
28044
|
* Tamper / case-open detection sensor. Drives Home Assistant
|
|
@@ -28887,6 +29392,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
28887
29392
|
sceneMonitor: sceneMonitorCapability,
|
|
28888
29393
|
scriptRunner: scriptRunnerCapability,
|
|
28889
29394
|
smoke: smokeCapability,
|
|
29395
|
+
streamCatalog: streamCatalogCapability,
|
|
28890
29396
|
streamParams: streamParamsCapability,
|
|
28891
29397
|
switch: switchCapability,
|
|
28892
29398
|
tamper: tamperCapability,
|
|
@@ -29540,6 +30046,15 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
29540
30046
|
labels: ["probe not implemented"]
|
|
29541
30047
|
};
|
|
29542
30048
|
}
|
|
30049
|
+
/**
|
|
30050
|
+
* Top-level devices restored at once in {@link onRestoreDevices}.
|
|
30051
|
+
*
|
|
30052
|
+
* Four covers the fleets this ships to without turning a boot into a burst a
|
|
30053
|
+
* camera NVR answers with a refusal. A provider whose upstream is a single
|
|
30054
|
+
* session with a serial command channel (a Baichuan hub, an NVR that
|
|
30055
|
+
* serialises ISAPI) should lower it; nothing needs to raise it.
|
|
30056
|
+
*/
|
|
30057
|
+
restoreConcurrency = 4;
|
|
29543
30058
|
async restoreDevices(savedDevices) {
|
|
29544
30059
|
await this.onRestoreDevices(savedDevices);
|
|
29545
30060
|
if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
|
|
@@ -29571,15 +30086,15 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
29571
30086
|
*/
|
|
29572
30087
|
async onRestoreDevices(savedDevices) {
|
|
29573
30088
|
const restored = /* @__PURE__ */ new Set();
|
|
29574
|
-
|
|
29575
|
-
|
|
30089
|
+
const topLevel = savedDevices.filter((saved) => saved.parentDeviceId === null);
|
|
30090
|
+
const restoreOne = async (saved) => {
|
|
29576
30091
|
const Class = this.deviceClasses[saved.type];
|
|
29577
30092
|
if (!Class) {
|
|
29578
30093
|
this.ctx.logger.warn("No device class registered for restored type — skipping", {
|
|
29579
30094
|
tags: { stableId: saved.stableId },
|
|
29580
30095
|
meta: { type: saved.type }
|
|
29581
30096
|
});
|
|
29582
|
-
|
|
30097
|
+
return;
|
|
29583
30098
|
}
|
|
29584
30099
|
try {
|
|
29585
30100
|
await this.ctx.kernel.devices.create(saved.stableId, Class, {});
|
|
@@ -29593,7 +30108,15 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
29593
30108
|
}
|
|
29594
30109
|
});
|
|
29595
30110
|
}
|
|
29596
|
-
}
|
|
30111
|
+
};
|
|
30112
|
+
let nextTopLevel = 0;
|
|
30113
|
+
await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
|
|
30114
|
+
for (;;) {
|
|
30115
|
+
const saved = topLevel[nextTopLevel++];
|
|
30116
|
+
if (saved === void 0) return;
|
|
30117
|
+
await restoreOne(saved);
|
|
30118
|
+
}
|
|
30119
|
+
}));
|
|
29597
30120
|
const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
|
|
29598
30121
|
for (const saved of childRows) {
|
|
29599
30122
|
const Class = this.deviceClasses[saved.type];
|
|
@@ -31815,6 +32338,12 @@ Object.freeze({
|
|
|
31815
32338
|
addonId: null,
|
|
31816
32339
|
access: "create"
|
|
31817
32340
|
},
|
|
32341
|
+
"llm.cancel": {
|
|
32342
|
+
capName: "llm",
|
|
32343
|
+
capScope: "system",
|
|
32344
|
+
addonId: null,
|
|
32345
|
+
access: "create"
|
|
32346
|
+
},
|
|
31818
32347
|
"llm.deleteModel": {
|
|
31819
32348
|
capName: "llm",
|
|
31820
32349
|
capScope: "system",
|
|
@@ -31899,6 +32428,12 @@ Object.freeze({
|
|
|
31899
32428
|
addonId: null,
|
|
31900
32429
|
access: "view"
|
|
31901
32430
|
},
|
|
32431
|
+
"llm.resolveModelRef": {
|
|
32432
|
+
capName: "llm",
|
|
32433
|
+
capScope: "system",
|
|
32434
|
+
addonId: null,
|
|
32435
|
+
access: "create"
|
|
32436
|
+
},
|
|
31902
32437
|
"llm.setDefault": {
|
|
31903
32438
|
capName: "llm",
|
|
31904
32439
|
capScope: "system",
|
|
@@ -34749,6 +35284,12 @@ Object.freeze({
|
|
|
34749
35284
|
addonId: null,
|
|
34750
35285
|
access: "create"
|
|
34751
35286
|
},
|
|
35287
|
+
"system.detectSiteLocation": {
|
|
35288
|
+
capName: "system",
|
|
35289
|
+
capScope: "system",
|
|
35290
|
+
addonId: null,
|
|
35291
|
+
access: "create"
|
|
35292
|
+
},
|
|
34752
35293
|
"system.featureFlags": {
|
|
34753
35294
|
capName: "system",
|
|
34754
35295
|
capScope: "system",
|
|
@@ -34767,6 +35308,12 @@ Object.freeze({
|
|
|
34767
35308
|
addonId: null,
|
|
34768
35309
|
access: "view"
|
|
34769
35310
|
},
|
|
35311
|
+
"system.getSiteLocation": {
|
|
35312
|
+
capName: "system",
|
|
35313
|
+
capScope: "system",
|
|
35314
|
+
addonId: null,
|
|
35315
|
+
access: "view"
|
|
35316
|
+
},
|
|
34770
35317
|
"system.health": {
|
|
34771
35318
|
capName: "system",
|
|
34772
35319
|
capScope: "system",
|
|
@@ -34791,6 +35338,12 @@ Object.freeze({
|
|
|
34791
35338
|
addonId: null,
|
|
34792
35339
|
access: "create"
|
|
34793
35340
|
},
|
|
35341
|
+
"system.setSiteLocation": {
|
|
35342
|
+
capName: "system",
|
|
35343
|
+
capScope: "system",
|
|
35344
|
+
addonId: null,
|
|
35345
|
+
access: "create"
|
|
35346
|
+
},
|
|
34794
35347
|
"terminalSession.adoptLegacyMonitor": {
|
|
34795
35348
|
capName: "terminal-session",
|
|
34796
35349
|
capScope: "system",
|
|
@@ -36273,6 +36826,11 @@ Object.freeze({
|
|
|
36273
36826
|
form: "single",
|
|
36274
36827
|
optional: false
|
|
36275
36828
|
}],
|
|
36829
|
+
"pipelineAnalytics.getEventMedia": [{
|
|
36830
|
+
name: "deviceId",
|
|
36831
|
+
form: "single",
|
|
36832
|
+
optional: false
|
|
36833
|
+
}],
|
|
36276
36834
|
"pipelineAnalytics.getKeyEvents": [{
|
|
36277
36835
|
name: "deviceId",
|
|
36278
36836
|
form: "single",
|
|
@@ -36303,6 +36861,11 @@ Object.freeze({
|
|
|
36303
36861
|
form: "single",
|
|
36304
36862
|
optional: false
|
|
36305
36863
|
}],
|
|
36864
|
+
"pipelineAnalytics.getTrackMedia": [{
|
|
36865
|
+
name: "deviceId",
|
|
36866
|
+
form: "single",
|
|
36867
|
+
optional: false
|
|
36868
|
+
}],
|
|
36306
36869
|
"pipelineAnalytics.getTrainingExportSummary": [{
|
|
36307
36870
|
name: "deviceIds",
|
|
36308
36871
|
form: "array",
|
|
@@ -36338,6 +36901,11 @@ Object.freeze({
|
|
|
36338
36901
|
form: "array",
|
|
36339
36902
|
optional: true
|
|
36340
36903
|
}],
|
|
36904
|
+
"pipelineAnalytics.listTrackMedia": [{
|
|
36905
|
+
name: "deviceId",
|
|
36906
|
+
form: "single",
|
|
36907
|
+
optional: false
|
|
36908
|
+
}],
|
|
36341
36909
|
"pipelineAnalytics.listTracks": [{
|
|
36342
36910
|
name: "deviceId",
|
|
36343
36911
|
form: "single",
|
|
@@ -36778,6 +37346,12 @@ Object.freeze({
|
|
|
36778
37346
|
form: "single",
|
|
36779
37347
|
optional: false
|
|
36780
37348
|
}],
|
|
37349
|
+
"snapshot.getSnapshotLinks": [{
|
|
37350
|
+
name: "targets",
|
|
37351
|
+
form: "object-array",
|
|
37352
|
+
optional: false,
|
|
37353
|
+
itemField: "deviceId"
|
|
37354
|
+
}],
|
|
36781
37355
|
"snapshot.getSnapshotOverview": [{
|
|
36782
37356
|
name: "deviceIds",
|
|
36783
37357
|
form: "array",
|