@camstack/addon-provider-amcrest 0.2.121 → 0.2.122
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 +2963 -1097
- package/dist/addon.mjs +2963 -1097
- package/package.json +2 -1
package/dist/addon.js
CHANGED
|
@@ -5373,7 +5373,7 @@ var ZodIssueCode = {
|
|
|
5373
5373
|
var ZodFirstPartyTypeKind;
|
|
5374
5374
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5375
5375
|
//#endregion
|
|
5376
|
-
//#region ../types/dist/sleep-
|
|
5376
|
+
//#region ../types/dist/sleep-DC-wdyeS.mjs
|
|
5377
5377
|
/**
|
|
5378
5378
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5379
5379
|
* window to float samples (D455).
|
|
@@ -6158,6 +6158,40 @@ var BaseAddon = class {
|
|
|
6158
6158
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6159
6159
|
return keys.size > 0 ? projectStore(raw, keys, node) : raw;
|
|
6160
6160
|
}
|
|
6161
|
+
/**
|
|
6162
|
+
* Whether ONE global key of this addon's store was written, read three-way
|
|
6163
|
+
* (D651). For a question a hydrated view cannot answer: `getGlobalSettings`
|
|
6164
|
+
* reports `value ?? default`, so "the operator chose the default" and "nobody
|
|
6165
|
+
* chose" look the same, and a failed read looks like both. A `perNode` key is
|
|
6166
|
+
* not supported here: its stored name is scoped.
|
|
6167
|
+
*/
|
|
6168
|
+
async readStoredGlobalKey(key) {
|
|
6169
|
+
const read = this._ctx?.settings?.readAddonStoreResult;
|
|
6170
|
+
if (read === void 0) return {
|
|
6171
|
+
kind: "unreadable",
|
|
6172
|
+
reason: "three-way-read-unavailable"
|
|
6173
|
+
};
|
|
6174
|
+
let result;
|
|
6175
|
+
try {
|
|
6176
|
+
result = await read.call(this._ctx?.settings);
|
|
6177
|
+
} catch (err) {
|
|
6178
|
+
return {
|
|
6179
|
+
kind: "unreadable",
|
|
6180
|
+
reason: "store-read-failed",
|
|
6181
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6182
|
+
};
|
|
6183
|
+
}
|
|
6184
|
+
if (result.kind === "failed") return {
|
|
6185
|
+
kind: "unreadable",
|
|
6186
|
+
reason: "store-read-failed",
|
|
6187
|
+
error: result.error
|
|
6188
|
+
};
|
|
6189
|
+
if (result.kind === "missing" || !Object.prototype.hasOwnProperty.call(result.value, key)) return { kind: "absent" };
|
|
6190
|
+
return {
|
|
6191
|
+
kind: "present",
|
|
6192
|
+
value: result.value[key]
|
|
6193
|
+
};
|
|
6194
|
+
}
|
|
6161
6195
|
async updateGlobalSettings(patch, nodeId) {
|
|
6162
6196
|
const keys = this.perNodeKeys();
|
|
6163
6197
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
@@ -9404,6 +9438,43 @@ var LogChannelWindowSchema = object({
|
|
|
9404
9438
|
/** `null` = every camera. A non-empty list narrows to those numeric ids. */
|
|
9405
9439
|
deviceIds: array(number().int()).readonly().nullable()
|
|
9406
9440
|
});
|
|
9441
|
+
var ClipModelMetaSchema = object({
|
|
9442
|
+
/** The paired text encoder's catalog id (the embedding-encoder's text catalog). */
|
|
9443
|
+
textModelId: string().min(1),
|
|
9444
|
+
/** Output dimension of BOTH towers. A vector of any other length is refused. */
|
|
9445
|
+
embeddingDim: number().int().positive(),
|
|
9446
|
+
/**
|
|
9447
|
+
* The `vector-store` index this model's vectors live in. ONE feature space
|
|
9448
|
+
* per index: two models share an index only when their vectors are ranked
|
|
9449
|
+
* against each other, which for CLIP means never across families. MobileCLIP
|
|
9450
|
+
* S1 and S2 share `object-clip` for history (separated by the row's
|
|
9451
|
+
* `modelId`); any other model gets its own.
|
|
9452
|
+
*/
|
|
9453
|
+
vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
|
|
9454
|
+
/**
|
|
9455
|
+
* The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
|
|
9456
|
+
* must be unique per tokenizer: every model's siblings land in ONE flat
|
|
9457
|
+
* models directory, so two different tokenizers under the same name would
|
|
9458
|
+
* silently overwrite each other (whichever model downloaded last wins, and
|
|
9459
|
+
* the other one tokenises with the wrong vocabulary).
|
|
9460
|
+
*/
|
|
9461
|
+
tokenizerFile: string().min(1),
|
|
9462
|
+
/** Token window the text graph takes (SigLIP2: 64; CLIP BPE: 77). */
|
|
9463
|
+
contextLength: number().int().positive(),
|
|
9464
|
+
/** Id the tokenizer pads with. */
|
|
9465
|
+
padId: number().int().nonnegative(),
|
|
9466
|
+
/**
|
|
9467
|
+
* The search cosine floor at `strictness: 'loose'` — calibrated per model,
|
|
9468
|
+
* because cosine bands are a property of the model: 0.2 keeps 96% of matched
|
|
9469
|
+
* COCO caption-image pairs on MobileCLIP S1 and 2.7% on SigLIP2.
|
|
9470
|
+
*/
|
|
9471
|
+
searchMinScore: number().min(0).max(1)
|
|
9472
|
+
});
|
|
9473
|
+
var ClipSearchStrictnessSchema = _enum([
|
|
9474
|
+
"loose",
|
|
9475
|
+
"balanced",
|
|
9476
|
+
"strict"
|
|
9477
|
+
]);
|
|
9407
9478
|
var MODEL_FORMATS = [
|
|
9408
9479
|
"onnx",
|
|
9409
9480
|
"coreml",
|
|
@@ -9432,7 +9503,7 @@ var ModelFormatEntrySchema = object({
|
|
|
9432
9503
|
/** Multi-file payload (directory members or sibling files). */
|
|
9433
9504
|
files: array(string()).readonly().optional(),
|
|
9434
9505
|
/** Runtime(s) that can use this format. If omitted, inferred from ModelFormat key */
|
|
9435
|
-
runtimes: array(_enum(["
|
|
9506
|
+
runtimes: array(_enum(["python"])).readonly().optional()
|
|
9436
9507
|
});
|
|
9437
9508
|
/**
|
|
9438
9509
|
* Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
|
|
@@ -9493,6 +9564,48 @@ var ModelProviderIdSchema = _enum([
|
|
|
9493
9564
|
"scrypted",
|
|
9494
9565
|
"custom"
|
|
9495
9566
|
]);
|
|
9567
|
+
/**
|
|
9568
|
+
* The licence of a model, as a record rather than a bare SPDX string: a
|
|
9569
|
+
* permissive CODE licence routinely sits on top of restrictive WEIGHTS or
|
|
9570
|
+
* DATA, and the obligations (attribution, modification notices, source offers)
|
|
9571
|
+
* are per upstream. A persisted custom-model row written when this field was a
|
|
9572
|
+
* string still parses — the string is lifted into `{ weights }`.
|
|
9573
|
+
*
|
|
9574
|
+
* Every licence surface (the admin "Models and licenses" page,
|
|
9575
|
+
* `THIRD_PARTY_MODELS.md`, the Hugging Face model table) is GENERATED from
|
|
9576
|
+
* these records by `scripts/gen-model-licenses.ts` (D661).
|
|
9577
|
+
*/
|
|
9578
|
+
var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { weights: value } : value, object({
|
|
9579
|
+
/** SPDX id of the WEIGHTS' terms, a `LicenseRef-*` for non-SPDX terms, or `UNKNOWN`. */
|
|
9580
|
+
weights: string().min(1),
|
|
9581
|
+
/** SPDX id of the upstream code that defines / trained the network. */
|
|
9582
|
+
code: string().min(1).optional(),
|
|
9583
|
+
/** Training data whose terms add obligations (attribution, non-commercial). */
|
|
9584
|
+
data: object({
|
|
9585
|
+
name: string().min(1),
|
|
9586
|
+
terms: string().min(1),
|
|
9587
|
+
url: string().url().optional()
|
|
9588
|
+
}).optional(),
|
|
9589
|
+
/** The project the weights come from. Required on built-in entries (guard). */
|
|
9590
|
+
upstream: object({
|
|
9591
|
+
name: string().min(1),
|
|
9592
|
+
url: string().url()
|
|
9593
|
+
}).optional(),
|
|
9594
|
+
/** Where the licence text governing the weights is published. */
|
|
9595
|
+
url: string().url().optional(),
|
|
9596
|
+
/** Attribution the licence REQUIRES, verbatim. */
|
|
9597
|
+
attribution: string().min(1).optional(),
|
|
9598
|
+
/** What CamStack changed. Required when `hosting` is `camstack-hf` (guard). */
|
|
9599
|
+
modifications: string().min(1).optional(),
|
|
9600
|
+
/** Who serves the file a node downloads. */
|
|
9601
|
+
hosting: _enum([
|
|
9602
|
+
"camstack-hf",
|
|
9603
|
+
"third-party",
|
|
9604
|
+
"built-in"
|
|
9605
|
+
]).optional(),
|
|
9606
|
+
/** True when the weights or their data forbid commercial use. */
|
|
9607
|
+
nonCommercial: boolean().optional()
|
|
9608
|
+
}));
|
|
9496
9609
|
var ModelCatalogEntrySchema = object({
|
|
9497
9610
|
id: string(),
|
|
9498
9611
|
name: string(),
|
|
@@ -9513,10 +9626,17 @@ var ModelCatalogEntrySchema = object({
|
|
|
9513
9626
|
inputChannels: number().int().positive().optional(),
|
|
9514
9627
|
labels: array(LabelDefinitionSchema).readonly(),
|
|
9515
9628
|
inputLayout: _enum(["nchw", "nhwc"]).optional(),
|
|
9629
|
+
/**
|
|
9630
|
+
* `'scrfd'` applies InsightFace's SCRFD input contract, `(x - 127.5) / 128`
|
|
9631
|
+
* (upstream `insightface/model_zoo/scrfd.py`), instead of the historical
|
|
9632
|
+
* plain `/255`. Measured against COCO GT: 188 → 196 faces found on the
|
|
9633
|
+
* `scrfd-2.5g` catalog entry (2026-09-26 model-replacement spike, §2.4-2).
|
|
9634
|
+
*/
|
|
9516
9635
|
inputNormalization: _enum([
|
|
9517
9636
|
"zero-one",
|
|
9518
9637
|
"imagenet",
|
|
9519
|
-
"none"
|
|
9638
|
+
"none",
|
|
9639
|
+
"scrfd"
|
|
9520
9640
|
]).optional(),
|
|
9521
9641
|
/**
|
|
9522
9642
|
* The model already applies softmax IN-GRAPH — its raw output is a
|
|
@@ -9541,6 +9661,16 @@ var ModelCatalogEntrySchema = object({
|
|
|
9541
9661
|
*/
|
|
9542
9662
|
postprocessor: custom().optional(),
|
|
9543
9663
|
/**
|
|
9664
|
+
* Per-MODEL default confidence floor. Absent ⇒ the step's
|
|
9665
|
+
* `StepDefinition.defaultConfidence` applies. A score is a property of one
|
|
9666
|
+
* model's output scale, not of the step slot it sits in: YuNet's
|
|
9667
|
+
* `sqrt(cls·obj)` is not SCRFD's score, and inheriting SCRFD's 0.5 filled the
|
|
9668
|
+
* face gallery with wheels and hands (D662, amends D645). An operator's
|
|
9669
|
+
* explicit value still wins over it. Resolved in ONE place —
|
|
9670
|
+
* `addon-pipeline/.../registry/effective-confidence.ts`.
|
|
9671
|
+
*/
|
|
9672
|
+
defaultConfidence: number().min(0).max(1).optional(),
|
|
9673
|
+
/**
|
|
9544
9674
|
* When true, the executor produces a landmark-aligned crop (similarity warp
|
|
9545
9675
|
* onto the canonical template) before this step runs, instead of a plain
|
|
9546
9676
|
* axis-aligned bbox crop. Required for face-recognition embedders (ArcFace):
|
|
@@ -9574,11 +9704,11 @@ var ModelCatalogEntrySchema = object({
|
|
|
9574
9704
|
p95LatencyMs: record(string(), number()).optional()
|
|
9575
9705
|
}).optional(),
|
|
9576
9706
|
/**
|
|
9577
|
-
*
|
|
9578
|
-
*
|
|
9579
|
-
*
|
|
9707
|
+
* The model's licence record — see {@link ModelLicenseSchema}. Optional in
|
|
9708
|
+
* the schema (a custom model's author may state none); REQUIRED and complete
|
|
9709
|
+
* on every built-in catalog entry (`scripts/check-catalog-licence.ts`).
|
|
9580
9710
|
*/
|
|
9581
|
-
license:
|
|
9711
|
+
license: ModelLicenseSchema.optional(),
|
|
9582
9712
|
/**
|
|
9583
9713
|
* Variant-selector grouping. The UI groups models by `family` + `tier` and
|
|
9584
9714
|
* offers `precision` / `optimization` as variant axes WITHIN a tier — so all
|
|
@@ -9600,7 +9730,14 @@ var ModelCatalogEntrySchema = object({
|
|
|
9600
9730
|
* applies (Frigate / COCO public catalog). Set on a custom model whose raw
|
|
9601
9731
|
* labels already ARE the CamStack macros (Scrypted identity map).
|
|
9602
9732
|
*/
|
|
9603
|
-
classMap: DetectionCatalogClassMapSchema.optional()
|
|
9733
|
+
classMap: DetectionCatalogClassMapSchema.optional(),
|
|
9734
|
+
/**
|
|
9735
|
+
* The model's CLIP feature-space contract (text encoder, dimension, vector
|
|
9736
|
+
* index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
|
|
9737
|
+
* CLIP image encoder; its absence is what "not a CLIP model" means to the
|
|
9738
|
+
* embedding encoder and the semantic-search store (D649).
|
|
9739
|
+
*/
|
|
9740
|
+
clip: ClipModelMetaSchema.optional()
|
|
9604
9741
|
});
|
|
9605
9742
|
var ConvertTargetSchema = discriminatedUnion("format", [object({
|
|
9606
9743
|
format: literal("openvino"),
|
|
@@ -9618,7 +9755,8 @@ var ModelConvertMetadataSchema = object({
|
|
|
9618
9755
|
inputNormalization: _enum([
|
|
9619
9756
|
"zero-one",
|
|
9620
9757
|
"imagenet",
|
|
9621
|
-
"none"
|
|
9758
|
+
"none",
|
|
9759
|
+
"scrfd"
|
|
9622
9760
|
]).optional(),
|
|
9623
9761
|
preprocessMode: _enum(["letterbox", "resize"]).optional(),
|
|
9624
9762
|
outputFormat: _enum([
|
|
@@ -9665,23 +9803,6 @@ var ExpressionEvalError = class extends Error {
|
|
|
9665
9803
|
this.name = "ExpressionEvalError";
|
|
9666
9804
|
}
|
|
9667
9805
|
};
|
|
9668
|
-
/**
|
|
9669
|
-
* Frozen, null-prototype builtin function table for the expression engine
|
|
9670
|
-
* (spec §4 rule 4). The table is the SOLE surface of callable functions: the
|
|
9671
|
-
* parser rejects any callee not in it, and the evaluator gates each call on an
|
|
9672
|
-
* own-property check against it.
|
|
9673
|
-
*
|
|
9674
|
-
* Because the object has a NULL prototype AND is `Object.freeze`d:
|
|
9675
|
-
* - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
|
|
9676
|
-
* - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
|
|
9677
|
-
* (there is no `Object.prototype` in the chain), so those names are not
|
|
9678
|
-
* callable — they are simply "unknown function" at parse time.
|
|
9679
|
-
*
|
|
9680
|
-
* Every numeric argument is validated as a finite number and every numeric
|
|
9681
|
-
* RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
|
|
9682
|
-
* (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
|
|
9683
|
-
* closed rather than emitting a garbage value.
|
|
9684
|
-
*/
|
|
9685
9806
|
function asFiniteNumber(value, name, index) {
|
|
9686
9807
|
if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
|
|
9687
9808
|
return value;
|
|
@@ -9697,6 +9818,10 @@ function finiteResult(value, name) {
|
|
|
9697
9818
|
function allFiniteNumbers(args, name) {
|
|
9698
9819
|
return args.map((a, idx) => asFiniteNumber(a, name, idx));
|
|
9699
9820
|
}
|
|
9821
|
+
function asBoolean$1(value, name, index) {
|
|
9822
|
+
if (typeof value !== "boolean") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a boolean`);
|
|
9823
|
+
return value;
|
|
9824
|
+
}
|
|
9700
9825
|
var INF = Number.POSITIVE_INFINITY;
|
|
9701
9826
|
var table = {
|
|
9702
9827
|
min: {
|
|
@@ -9797,6 +9922,40 @@ var table = {
|
|
|
9797
9922
|
if (from === to) return x;
|
|
9798
9923
|
throw new ExpressionEvalError("convert: unit conversion table not installed");
|
|
9799
9924
|
}
|
|
9925
|
+
},
|
|
9926
|
+
any: {
|
|
9927
|
+
minArgs: 1,
|
|
9928
|
+
maxArgs: INF,
|
|
9929
|
+
apply: (args) => args.map((a, i) => asBoolean$1(a, "any", i)).some((b) => b)
|
|
9930
|
+
},
|
|
9931
|
+
all: {
|
|
9932
|
+
minArgs: 1,
|
|
9933
|
+
maxArgs: INF,
|
|
9934
|
+
apply: (args) => args.map((a, i) => asBoolean$1(a, "all", i)).every((b) => b)
|
|
9935
|
+
},
|
|
9936
|
+
within: {
|
|
9937
|
+
minArgs: 2,
|
|
9938
|
+
maxArgs: 2,
|
|
9939
|
+
apply: (args, hooks) => {
|
|
9940
|
+
const windowMs = asFiniteNumber(args[1], "within", 1);
|
|
9941
|
+
if (windowMs < 0) throw new ExpressionEvalError("within: the window must not be negative");
|
|
9942
|
+
const at = args[0];
|
|
9943
|
+
if (at === null) return false;
|
|
9944
|
+
const ts = asFiniteNumber(at, "within", 0);
|
|
9945
|
+
const now = hooks.now;
|
|
9946
|
+
if (now === void 0 || !Number.isFinite(now)) throw new ExpressionEvalError("within: no clock was supplied to this evaluation");
|
|
9947
|
+
const inside = now - ts <= windowMs;
|
|
9948
|
+
if (inside) hooks.noteDeadline?.(ts + windowMs + 1);
|
|
9949
|
+
return inside;
|
|
9950
|
+
}
|
|
9951
|
+
},
|
|
9952
|
+
latest: {
|
|
9953
|
+
minArgs: 1,
|
|
9954
|
+
maxArgs: INF,
|
|
9955
|
+
apply: (args) => {
|
|
9956
|
+
const present = args.flatMap((a, i) => a === null ? [] : [asFiniteNumber(a, "latest", i)]);
|
|
9957
|
+
return present.length === 0 ? null : finiteResult(Math.max(...present), "latest");
|
|
9958
|
+
}
|
|
9800
9959
|
}
|
|
9801
9960
|
};
|
|
9802
9961
|
Object.freeze(Object.assign(Object.create(null), table));
|
|
@@ -10411,7 +10570,7 @@ var AutomationActionSchema = discriminatedUnion("kind", [
|
|
|
10411
10570
|
code: string().min(1).max(2e4)
|
|
10412
10571
|
})
|
|
10413
10572
|
]);
|
|
10414
|
-
object({
|
|
10573
|
+
var AutomationRecipeSchema = object({
|
|
10415
10574
|
triggers: array(AutomationTriggerSchema),
|
|
10416
10575
|
conditions: AutomationConditionSchema.optional(),
|
|
10417
10576
|
actions: array(AutomationActionSchema)
|
|
@@ -10879,12 +11038,32 @@ var AudioClassificationLabelSchema = object({
|
|
|
10879
11038
|
originalClass: string().optional(),
|
|
10880
11039
|
score: number()
|
|
10881
11040
|
});
|
|
11041
|
+
/**
|
|
11042
|
+
* Did the classifier RUN on this window? (D660)
|
|
11043
|
+
*
|
|
11044
|
+
* `classified` with no labels means the model heard nothing above the
|
|
11045
|
+
* camera's floor. `not-classified` means nobody listened — and until D660 the
|
|
11046
|
+
* two were the same shape (`classification` absent), so a window the global
|
|
11047
|
+
* busy gate threw away read downstream exactly like a quiet one (D393).
|
|
11048
|
+
*/
|
|
11049
|
+
var AudioClassifyOutcomeSchema = discriminatedUnion("state", [object({ state: literal("classified") }), object({
|
|
11050
|
+
state: literal("not-classified"),
|
|
11051
|
+
reason: _enum([
|
|
11052
|
+
"superseded",
|
|
11053
|
+
"error",
|
|
11054
|
+
"timeout",
|
|
11055
|
+
"disposed"
|
|
11056
|
+
])
|
|
11057
|
+
})]);
|
|
10882
11058
|
var AudioAnalysisResultSchema = object({
|
|
10883
11059
|
level: AudioLevelSchema,
|
|
11060
|
+
/** Labels at or above the camera's floor. Absent = none — read `classifyOutcome` to know whether the model ran at all. */
|
|
10884
11061
|
classification: object({
|
|
10885
11062
|
labels: array(AudioClassificationLabelSchema).readonly(),
|
|
10886
11063
|
inferenceMs: number()
|
|
10887
11064
|
}).optional(),
|
|
11065
|
+
/** Whether the classifier ran on this window (D660). */
|
|
11066
|
+
classifyOutcome: AudioClassifyOutcomeSchema,
|
|
10888
11067
|
timestamp: number()
|
|
10889
11068
|
});
|
|
10890
11069
|
var AudioAnalysisSettingsSchema = object({
|
|
@@ -12544,6 +12723,195 @@ var cameraStreamsCapability = {
|
|
|
12544
12723
|
*/
|
|
12545
12724
|
durability: "session"
|
|
12546
12725
|
};
|
|
12726
|
+
/** A composed device's stableId is this prefix plus the block id. */
|
|
12727
|
+
var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
|
|
12728
|
+
/** Longest snippet a `code` source may carry (slice 4). */
|
|
12729
|
+
var MAX_COMPOSITION_CODE_LENGTH = 2e4;
|
|
12730
|
+
var CompositionSourceRefSchema = object({
|
|
12731
|
+
/** The owning addon; `stableId` is unique only within it. */
|
|
12732
|
+
addonId: string().min(1),
|
|
12733
|
+
stableId: string().min(1)
|
|
12734
|
+
});
|
|
12735
|
+
/** One field of one capability of one source device. */
|
|
12736
|
+
var CompositionFieldReadSchema = object({
|
|
12737
|
+
source: CompositionSourceRefSchema,
|
|
12738
|
+
cap: string().min(1),
|
|
12739
|
+
/** Dotted path into the source cap's runtime-state slice. */
|
|
12740
|
+
fieldPath: string().min(1)
|
|
12741
|
+
});
|
|
12742
|
+
/** `from`: copy one source field verbatim. It is also an expression's `from` binding. */
|
|
12743
|
+
var CompositionFromSourceSchema = CompositionFieldReadSchema.extend({ kind: literal("from") });
|
|
12744
|
+
var CompositionBindingSchema = discriminatedUnion("kind", [CompositionFromSourceSchema, object({
|
|
12745
|
+
kind: literal("literal"),
|
|
12746
|
+
value: union([
|
|
12747
|
+
string(),
|
|
12748
|
+
number(),
|
|
12749
|
+
boolean(),
|
|
12750
|
+
_null()
|
|
12751
|
+
])
|
|
12752
|
+
})]);
|
|
12753
|
+
/**
|
|
12754
|
+
* `expression`: a formula over named bindings, in the salvaged expression
|
|
12755
|
+
* engine. Validated at parse by the SAME function every other consumer runs,
|
|
12756
|
+
* so the editor and the store cannot disagree.
|
|
12757
|
+
*/
|
|
12758
|
+
var CompositionExpressionSourceSchema = object({
|
|
12759
|
+
kind: literal("expression"),
|
|
12760
|
+
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
12761
|
+
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), CompositionBindingSchema)
|
|
12762
|
+
}).superRefine((src, ctx) => {
|
|
12763
|
+
const err = validateExpressionSource(src);
|
|
12764
|
+
if (err !== null) ctx.addIssue({
|
|
12765
|
+
code: "custom",
|
|
12766
|
+
message: err,
|
|
12767
|
+
path: ["expr"]
|
|
12768
|
+
});
|
|
12769
|
+
});
|
|
12770
|
+
/** `code`: RESERVED for slice 4 (own runner, one-way eject). */
|
|
12771
|
+
var CompositionCodeSourceSchema = object({
|
|
12772
|
+
kind: literal("code"),
|
|
12773
|
+
code: string().min(1).max(MAX_COMPOSITION_CODE_LENGTH)
|
|
12774
|
+
});
|
|
12775
|
+
var CompositionFieldSourceSchema = discriminatedUnion("kind", [
|
|
12776
|
+
CompositionFromSourceSchema,
|
|
12777
|
+
CompositionExpressionSourceSchema,
|
|
12778
|
+
CompositionCodeSourceSchema
|
|
12779
|
+
]);
|
|
12780
|
+
var CompositionCommandTargetSchema = discriminatedUnion("kind", [object({
|
|
12781
|
+
kind: literal("forward"),
|
|
12782
|
+
source: CompositionSourceRefSchema,
|
|
12783
|
+
cap: string().min(1),
|
|
12784
|
+
method: string().min(1)
|
|
12785
|
+
}), CompositionCodeSourceSchema]);
|
|
12786
|
+
var CompositionFeatureSchema = discriminatedUnion("kind", [object({
|
|
12787
|
+
kind: literal("fields"),
|
|
12788
|
+
cap: string().min(1),
|
|
12789
|
+
fields: record(string().min(1), CompositionFieldSourceSchema).refine((fields) => Object.keys(fields).length <= 32, { message: `at most 32 fields per capability` }),
|
|
12790
|
+
/** RESERVED for slice 3; refused by the validator when non-empty. */
|
|
12791
|
+
commands: record(string().min(1), CompositionCommandTargetSchema).optional()
|
|
12792
|
+
}), object({
|
|
12793
|
+
kind: literal("passthrough"),
|
|
12794
|
+
cap: string().min(1),
|
|
12795
|
+
source: CompositionSourceRefSchema
|
|
12796
|
+
})]);
|
|
12797
|
+
var CompositionSchema = object({
|
|
12798
|
+
target: discriminatedUnion("kind", [object({
|
|
12799
|
+
kind: literal("new"),
|
|
12800
|
+
type: _enum(DeviceType),
|
|
12801
|
+
role: _enum(DeviceRole).optional()
|
|
12802
|
+
}), object({
|
|
12803
|
+
kind: literal("existing"),
|
|
12804
|
+
device: CompositionSourceRefSchema
|
|
12805
|
+
})]),
|
|
12806
|
+
features: array(CompositionFeatureSchema).min(1).max(16)
|
|
12807
|
+
}).superRefine((composition, ctx) => {
|
|
12808
|
+
const seen = /* @__PURE__ */ new Set();
|
|
12809
|
+
composition.features.forEach((feature, index) => {
|
|
12810
|
+
if (seen.has(feature.cap)) ctx.addIssue({
|
|
12811
|
+
code: "custom",
|
|
12812
|
+
message: `capability \`${feature.cap}\` is composed twice — one feature per capability`,
|
|
12813
|
+
path: [
|
|
12814
|
+
"features",
|
|
12815
|
+
index,
|
|
12816
|
+
"cap"
|
|
12817
|
+
]
|
|
12818
|
+
});
|
|
12819
|
+
seen.add(feature.cap);
|
|
12820
|
+
});
|
|
12821
|
+
});
|
|
12822
|
+
/** One refusal, named (D391). `path` points into the composition, e.g. `features[0].fields.celsius`. */
|
|
12823
|
+
var CompositionProblemSchema = object({
|
|
12824
|
+
code: _enum([
|
|
12825
|
+
"reserved-variant",
|
|
12826
|
+
"unknown-capability",
|
|
12827
|
+
"not-composable",
|
|
12828
|
+
"wrong-device-type",
|
|
12829
|
+
"has-commands",
|
|
12830
|
+
"unknown-field",
|
|
12831
|
+
"nested-field",
|
|
12832
|
+
"missing-field",
|
|
12833
|
+
"kind-mismatch",
|
|
12834
|
+
"may-be-null",
|
|
12835
|
+
"source-missing",
|
|
12836
|
+
"source-unreadable",
|
|
12837
|
+
"source-capability-missing",
|
|
12838
|
+
"source-field-unknown",
|
|
12839
|
+
"expression-invalid",
|
|
12840
|
+
"cycle",
|
|
12841
|
+
"duplicate-target"
|
|
12842
|
+
]),
|
|
12843
|
+
path: string(),
|
|
12844
|
+
message: string()
|
|
12845
|
+
});
|
|
12846
|
+
var CompositionFieldKindSchema = _enum([
|
|
12847
|
+
"string",
|
|
12848
|
+
"number",
|
|
12849
|
+
"boolean",
|
|
12850
|
+
"enum"
|
|
12851
|
+
]);
|
|
12852
|
+
/** How a field says "unavailable": `null` when its schema allows it, else the device goes offline (D393). */
|
|
12853
|
+
var CompositionUnavailableModeSchema = _enum(["null", "offline"]);
|
|
12854
|
+
/**
|
|
12855
|
+
* `derived` reads a source · `clock` reads only `now`, recomputed when a sibling
|
|
12856
|
+
* field of its cap changes value · `constant` reads nothing, computed once.
|
|
12857
|
+
*/
|
|
12858
|
+
var CompositionFieldRoleSchema = _enum([
|
|
12859
|
+
"derived",
|
|
12860
|
+
"clock",
|
|
12861
|
+
"constant"
|
|
12862
|
+
]);
|
|
12863
|
+
var CompositionFieldPlanSchema = object({
|
|
12864
|
+
cap: string(),
|
|
12865
|
+
path: string(),
|
|
12866
|
+
/** Index into `composition.features` this field's capability came from —
|
|
12867
|
+
* lets a source/cycle problem name its path as `features[N].fields.<path>`
|
|
12868
|
+
* (the same convention `planComposition`'s own problems already use). */
|
|
12869
|
+
featureIndex: number().int().nonnegative(),
|
|
12870
|
+
kind: CompositionFieldKindSchema,
|
|
12871
|
+
nullable: boolean(),
|
|
12872
|
+
required: boolean(),
|
|
12873
|
+
unavailable: CompositionUnavailableModeSchema,
|
|
12874
|
+
role: CompositionFieldRoleSchema,
|
|
12875
|
+
source: CompositionFieldSourceSchema,
|
|
12876
|
+
reads: array(CompositionFieldReadSchema)
|
|
12877
|
+
});
|
|
12878
|
+
var CompositionValidationSchema = object({
|
|
12879
|
+
ok: boolean(),
|
|
12880
|
+
problems: array(CompositionProblemSchema),
|
|
12881
|
+
fields: array(CompositionFieldPlanSchema)
|
|
12882
|
+
});
|
|
12883
|
+
/** Mirrors `CoreBlockStatus`, pinned by `core-blocks-source.spec.ts` (Task 11). */
|
|
12884
|
+
var CompositionRunStatusSchema = _enum([
|
|
12885
|
+
"stopped",
|
|
12886
|
+
"starting",
|
|
12887
|
+
"running",
|
|
12888
|
+
"failed"
|
|
12889
|
+
]);
|
|
12890
|
+
var CompositionFieldStateKindSchema = _enum([
|
|
12891
|
+
"fresh",
|
|
12892
|
+
"stale",
|
|
12893
|
+
"unavailable"
|
|
12894
|
+
]);
|
|
12895
|
+
var CompositionFieldStateSchema = object({
|
|
12896
|
+
cap: string(),
|
|
12897
|
+
path: string(),
|
|
12898
|
+
state: CompositionFieldStateKindSchema,
|
|
12899
|
+
/** `null` whenever `state === 'unavailable'`; never a plausible stand-in (D393). */
|
|
12900
|
+
value: union([
|
|
12901
|
+
string(),
|
|
12902
|
+
number(),
|
|
12903
|
+
boolean(),
|
|
12904
|
+
_null()
|
|
12905
|
+
]),
|
|
12906
|
+
reason: string().optional()
|
|
12907
|
+
});
|
|
12908
|
+
var CompositionBlockStateSchema = object({
|
|
12909
|
+
blockId: string(),
|
|
12910
|
+
deviceId: number().nullable(),
|
|
12911
|
+
status: CompositionRunStatusSchema,
|
|
12912
|
+
reason: string().optional(),
|
|
12913
|
+
fields: array(CompositionFieldStateSchema)
|
|
12914
|
+
});
|
|
12547
12915
|
/** Where a block runs. The operator chooses — a block driving a device on an
|
|
12548
12916
|
* agent is the reason placement is not fixed to the hub. */
|
|
12549
12917
|
var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
|
|
@@ -12570,6 +12938,30 @@ var CoreBlockInputSchema = object({
|
|
|
12570
12938
|
*/
|
|
12571
12939
|
integrationId: string().optional()
|
|
12572
12940
|
});
|
|
12941
|
+
/**
|
|
12942
|
+
* What a block IS (D659). Absent means `code` — every row stored before this
|
|
12943
|
+
* union keeps working unchanged.
|
|
12944
|
+
* - `code`: the TypeScript in `code`, compiled and run in its own runner;
|
|
12945
|
+
* - `recipe`: RESERVED (automations), stored shape only; refused at run by name;
|
|
12946
|
+
* - `composition`: declarative, run by the shared `composer`; `code` is `''`.
|
|
12947
|
+
*/
|
|
12948
|
+
var CoreBlockSourceSchema = discriminatedUnion("kind", [
|
|
12949
|
+
object({ kind: literal("code") }),
|
|
12950
|
+
object({
|
|
12951
|
+
kind: literal("recipe"),
|
|
12952
|
+
recipe: AutomationRecipeSchema
|
|
12953
|
+
}),
|
|
12954
|
+
object({
|
|
12955
|
+
kind: literal("composition"),
|
|
12956
|
+
composition: CompositionSchema
|
|
12957
|
+
})
|
|
12958
|
+
]);
|
|
12959
|
+
/** The client-authored half of a composition block. No `code`, no placement (hub-only; Phase 7). */
|
|
12960
|
+
var CompositionBlockInputSchema = object({
|
|
12961
|
+
name: string().min(1).max(120),
|
|
12962
|
+
enabled: boolean(),
|
|
12963
|
+
composition: CompositionSchema
|
|
12964
|
+
});
|
|
12573
12965
|
/** A stored block. */
|
|
12574
12966
|
var CoreBlockSchema = CoreBlockInputSchema.extend({
|
|
12575
12967
|
id: string(),
|
|
@@ -12585,8 +12977,38 @@ var CoreBlockSchema = CoreBlockInputSchema.extend({
|
|
|
12585
12977
|
*/
|
|
12586
12978
|
lastError: string().optional(),
|
|
12587
12979
|
/** Ms epoch of the last state change. */
|
|
12588
|
-
lastChangedAt: number()
|
|
12980
|
+
lastChangedAt: number(),
|
|
12981
|
+
/** What the block is. Absent means `code` (D659). */
|
|
12982
|
+
source: CoreBlockSourceSchema.optional()
|
|
12983
|
+
});
|
|
12984
|
+
/** A stored composition block and what the composer says about it. */
|
|
12985
|
+
var CompositionViewSchema = object({
|
|
12986
|
+
block: CoreBlockSchema,
|
|
12987
|
+
state: discriminatedUnion("kind", [object({
|
|
12988
|
+
kind: literal("answered"),
|
|
12989
|
+
state: CompositionBlockStateSchema.nullable()
|
|
12990
|
+
}), object({
|
|
12991
|
+
kind: literal("unreachable"),
|
|
12992
|
+
error: string()
|
|
12993
|
+
})])
|
|
12994
|
+
});
|
|
12995
|
+
/**
|
|
12996
|
+
* A read of the stored compositions. `not-loaded` while the `core_blocks`
|
|
12997
|
+
* table has not been READ: an empty answer then would make "not yet known"
|
|
12998
|
+
* look like "none", and invite the operator to recreate what exists (D315).
|
|
12999
|
+
*/
|
|
13000
|
+
var CompositionsNotLoadedSchema = object({
|
|
13001
|
+
state: literal("not-loaded"),
|
|
13002
|
+
reason: string()
|
|
12589
13003
|
});
|
|
13004
|
+
var CompositionListReadSchema = discriminatedUnion("state", [object({
|
|
13005
|
+
state: literal("loaded"),
|
|
13006
|
+
views: array(CompositionViewSchema)
|
|
13007
|
+
}), CompositionsNotLoadedSchema]);
|
|
13008
|
+
var CompositionGetReadSchema = discriminatedUnion("state", [object({
|
|
13009
|
+
state: literal("loaded"),
|
|
13010
|
+
view: CompositionViewSchema.nullable()
|
|
13011
|
+
}), CompositionsNotLoadedSchema]);
|
|
12590
13012
|
/** What a compile attempt produced. */
|
|
12591
13013
|
var CoreBlockCompileResultSchema = object({
|
|
12592
13014
|
ok: boolean(),
|
|
@@ -12624,7 +13046,72 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
12624
13046
|
}), method(object({}), object({ libs: array(object({
|
|
12625
13047
|
filePath: string(),
|
|
12626
13048
|
content: string()
|
|
12627
|
-
})) }), { auth: "admin" })
|
|
13049
|
+
})) }), { auth: "admin" }), method(object({ block: CompositionBlockInputSchema }), object({ block: CoreBlockSchema }), {
|
|
13050
|
+
kind: "mutation",
|
|
13051
|
+
auth: "admin",
|
|
13052
|
+
caller: "required"
|
|
13053
|
+
}), method(object({
|
|
13054
|
+
blockId: string(),
|
|
13055
|
+
expectedUpdatedAt: number(),
|
|
13056
|
+
block: CompositionBlockInputSchema.partial()
|
|
13057
|
+
}), object({ block: CoreBlockSchema }), {
|
|
13058
|
+
kind: "mutation",
|
|
13059
|
+
auth: "admin",
|
|
13060
|
+
caller: "required"
|
|
13061
|
+
}), method(object({ blockId: string() }), CompositionGetReadSchema, { auth: "admin" }), method(object({}), CompositionListReadSchema, { auth: "admin" }), method(object({
|
|
13062
|
+
composition: CompositionSchema,
|
|
13063
|
+
blockId: string().optional()
|
|
13064
|
+
}), CompositionValidationSchema, {
|
|
13065
|
+
kind: "mutation",
|
|
13066
|
+
auth: "admin",
|
|
13067
|
+
access: "view"
|
|
13068
|
+
});
|
|
13069
|
+
var ComposerBlockSchema = object({
|
|
13070
|
+
id: string().min(1),
|
|
13071
|
+
name: string().min(1).max(120),
|
|
13072
|
+
enabled: boolean(),
|
|
13073
|
+
updatedAt: number(),
|
|
13074
|
+
composition: CompositionSchema
|
|
13075
|
+
});
|
|
13076
|
+
/**
|
|
13077
|
+
* A stored composition row that no longer PARSES — a schema a release
|
|
13078
|
+
* tightened, a row written by a newer build. Sent by id so the composer keeps
|
|
13079
|
+
* its device as a placeholder and reports the block `failed` naming the parse
|
|
13080
|
+
* error. Leaving it out would read, twice, exactly like a delete (D49).
|
|
13081
|
+
*/
|
|
13082
|
+
var ComposerUnreadableBlockSchema = object({
|
|
13083
|
+
id: string().min(1),
|
|
13084
|
+
/** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
|
|
13085
|
+
name: string().nullable(),
|
|
13086
|
+
/** The parse error, in the operator's words. */
|
|
13087
|
+
error: string()
|
|
13088
|
+
});
|
|
13089
|
+
method(object({
|
|
13090
|
+
/** The shared Blocks integration; null until `core-blocks` has reconciled it. */
|
|
13091
|
+
integrationId: string().nullable(),
|
|
13092
|
+
/** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
|
|
13093
|
+
storeLoaded: boolean(),
|
|
13094
|
+
blocks: array(ComposerBlockSchema),
|
|
13095
|
+
/** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
|
|
13096
|
+
restartBlockIds: array(string()),
|
|
13097
|
+
/** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
|
|
13098
|
+
unreadableBlocks: array(ComposerUnreadableBlockSchema)
|
|
13099
|
+
}), object({
|
|
13100
|
+
blocks: array(object({
|
|
13101
|
+
blockId: string(),
|
|
13102
|
+
status: CompositionRunStatusSchema,
|
|
13103
|
+
reason: string().optional()
|
|
13104
|
+
})),
|
|
13105
|
+
/**
|
|
13106
|
+
* False when the composer declared and withdrew NOTHING (store not loaded,
|
|
13107
|
+
* integration unknown, its own rows unread or read empty once). An empty
|
|
13108
|
+
* apply the caller owes is paid off only by one the composer acted on (D49).
|
|
13109
|
+
*/
|
|
13110
|
+
acted: boolean()
|
|
13111
|
+
}), {
|
|
13112
|
+
kind: "mutation",
|
|
13113
|
+
auth: "admin"
|
|
13114
|
+
}), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
|
|
12628
13115
|
/**
|
|
12629
13116
|
* `custom-model-registry` — collection cap exposing operator-registered
|
|
12630
13117
|
* custom detection models. Each provider (today: `addon-model-studio`)
|
|
@@ -14220,6 +14707,27 @@ var LinkedDeviceSchema = object({
|
|
|
14220
14707
|
features: array(string()),
|
|
14221
14708
|
producesTrackedEvents: boolean().optional()
|
|
14222
14709
|
});
|
|
14710
|
+
/**
|
|
14711
|
+
* The `linked-devices` extension slot's editable value (D648): the operator's
|
|
14712
|
+
* pick list, exactly what `_linkedDeviceIds` persists. Tree children are NOT
|
|
14713
|
+
* in it — they are always linked and are not a pick.
|
|
14714
|
+
*
|
|
14715
|
+
* `trackedDeviceIds` (D655) is the tracked-event opt-in, exactly what
|
|
14716
|
+
* `_linkedDeviceTrackedIds` persists: which linked devices materialize a
|
|
14717
|
+
* synthetic tracked event on the camera. A read always carries it AS STORED
|
|
14718
|
+
* (an absent key reads as `[]`, which is what the resolver makes of it —
|
|
14719
|
+
* NONE). On a write it is optional: absent leaves the opt-in untouched, so a
|
|
14720
|
+
* card built before D655 cannot erase it by saving the pick list. A present
|
|
14721
|
+
* list REPLACES the opt-in; each id must be a pick, a device the camera links
|
|
14722
|
+
* by structure (the row's `impliedSources`: tree children, a picked
|
|
14723
|
+
* container's child) or already stored — so what was read can always be
|
|
14724
|
+
* written back unchanged, and a NEW opt-in outside the linked set is refused.
|
|
14725
|
+
*/
|
|
14726
|
+
var LinkedDevicesSlotValueSchema = object({
|
|
14727
|
+
deviceIds: array(number().int().positive()),
|
|
14728
|
+
trackedDeviceIds: array(number().int().positive()).optional()
|
|
14729
|
+
});
|
|
14730
|
+
DeviceType.Camera;
|
|
14223
14731
|
/** One camera's resolved linked set, tagged with the camera it belongs to.
|
|
14224
14732
|
* The batch answer needs the tag; the single-device answer already has it
|
|
14225
14733
|
* from the input, which is why `getLinkedDevices` keeps the untagged shape. */
|
|
@@ -14745,16 +15253,101 @@ var EmbeddingResultSchema = object({
|
|
|
14745
15253
|
embedding: array(number()),
|
|
14746
15254
|
inferenceMs: number()
|
|
14747
15255
|
});
|
|
15256
|
+
/** The two CLIP towers the encoder runs; a crash budget is kept per tower. */
|
|
15257
|
+
var EmbeddingTowerSchema = _enum(["image", "text"]);
|
|
15258
|
+
/**
|
|
15259
|
+
* A tower in the terminal `failed` state (D649, D6): it crashed or failed to
|
|
15260
|
+
* load `crashes` times within `windowMs`, and is refused by name until an
|
|
15261
|
+
* operator `resetFailedModels` or a model change — never on a timer.
|
|
15262
|
+
*
|
|
15263
|
+
* `nodeId` is the node whose tower failed. The state lives in THAT node's
|
|
15264
|
+
* encoder process (in memory — a runner respawn clears it), and one node's
|
|
15265
|
+
* answer says nothing about another's.
|
|
15266
|
+
*/
|
|
15267
|
+
var EmbeddingFailedModelSchema = object({
|
|
15268
|
+
modelId: string(),
|
|
15269
|
+
tower: EmbeddingTowerSchema,
|
|
15270
|
+
nodeId: string(),
|
|
15271
|
+
crashes: number(),
|
|
15272
|
+
windowMs: number(),
|
|
15273
|
+
sinceMs: number(),
|
|
15274
|
+
lastReason: string()
|
|
15275
|
+
});
|
|
15276
|
+
/**
|
|
15277
|
+
* A model whose REQUIREMENTS can never be met on this node (D649 round 5):
|
|
15278
|
+
* an id the catalog does not know, a model URL answering 404/410, a declared
|
|
15279
|
+
* sibling (the tokenizer) that is not there. After `attempts` failed builds
|
|
15280
|
+
* it is terminally `requirements-failed`, refused by name until an operator
|
|
15281
|
+
* `resetFailedModels` or a model change — the same exits as a crashed tower.
|
|
15282
|
+
*/
|
|
15283
|
+
var EmbeddingFailedRequirementSchema = object({
|
|
15284
|
+
modelId: string(),
|
|
15285
|
+
tower: EmbeddingTowerSchema,
|
|
15286
|
+
nodeId: string(),
|
|
15287
|
+
attempts: number(),
|
|
15288
|
+
sinceMs: number(),
|
|
15289
|
+
lastReason: string()
|
|
15290
|
+
});
|
|
14748
15291
|
var EmbeddingInfoSchema = object({
|
|
14749
15292
|
modelId: string(),
|
|
14750
15293
|
embeddingDim: number(),
|
|
14751
|
-
ready: boolean()
|
|
14752
|
-
|
|
15294
|
+
ready: boolean(),
|
|
15295
|
+
/**
|
|
15296
|
+
* The node that answered. Absent only from an encoder older than D649's
|
|
15297
|
+
* crash budget — whose `failedModels` is then UNKNOWN (D315), never "none".
|
|
15298
|
+
*/
|
|
15299
|
+
nodeId: string().optional(),
|
|
15300
|
+
/**
|
|
15301
|
+
* Towers in `failed` on the answering node, each row naming it. `undefined`
|
|
15302
|
+
* means the node could not say (pre-budget encoder); a node that has the
|
|
15303
|
+
* budget always answers an array, empty included.
|
|
15304
|
+
*/
|
|
15305
|
+
failedModels: array(EmbeddingFailedModelSchema).optional(),
|
|
15306
|
+
/** Models terminally `requirements-failed` on the answering node; same reading as above. */
|
|
15307
|
+
failedRequirements: array(EmbeddingFailedRequirementSchema).optional()
|
|
15308
|
+
});
|
|
15309
|
+
/**
|
|
15310
|
+
* The THREE codes an encoder refusal can carry (D649, D6). Same shape as
|
|
15311
|
+
* `VECTOR_INDEX_DIM_CONFLICT`: the code rides in the MESSAGE, because an
|
|
15312
|
+
* Error's own properties do not survive the UDS/tRPC hop and its message does,
|
|
15313
|
+
* and both sides go through the helpers below — the encoder builds the
|
|
15314
|
+
* refusal, the live detail plane classifies on it to count refusals per
|
|
15315
|
+
* camera instead of logging one warning per track. The bracketed token
|
|
15316
|
+
* carries the code, the model, the tower and the node so a consumer never
|
|
15317
|
+
* parses prose.
|
|
15318
|
+
*
|
|
15319
|
+
* - `EMBEDDING_MODEL_FAILED`: the tower crashed / failed to load past the crash
|
|
15320
|
+
* budget — terminal until `resetFailedModels` or a model change.
|
|
15321
|
+
* - `EMBEDDING_REQUIREMENTS_UNAVAILABLE`: files or runtime not there right now
|
|
15322
|
+
* (a download or Python that failed, or the cooldown after one) — the next
|
|
15323
|
+
* request past the cooldown tries again.
|
|
15324
|
+
* - `EMBEDDING_REQUIREMENTS_FAILED`: the requirements can never be met (unknown
|
|
15325
|
+
* id, 404/410, missing sibling) and the bounded attempts are spent —
|
|
15326
|
+
* terminal, same exits as a crashed tower.
|
|
15327
|
+
*/
|
|
15328
|
+
var EMBEDDING_MODEL_FAILED = "embedding-model-failed";
|
|
15329
|
+
var EMBEDDING_REQUIREMENTS_UNAVAILABLE = "embedding-requirements-unavailable";
|
|
15330
|
+
var EMBEDDING_REQUIREMENTS_FAILED = "embedding-requirements-failed";
|
|
15331
|
+
_enum([
|
|
15332
|
+
EMBEDDING_MODEL_FAILED,
|
|
15333
|
+
EMBEDDING_REQUIREMENTS_UNAVAILABLE,
|
|
15334
|
+
EMBEDDING_REQUIREMENTS_FAILED
|
|
15335
|
+
]);
|
|
15336
|
+
new RegExp(`\\[(${EMBEDDING_MODEL_FAILED}|${EMBEDDING_REQUIREMENTS_UNAVAILABLE}|${EMBEDDING_REQUIREMENTS_FAILED}) model=([^\\s\\]]+) tower=(image|text) node=([^\\s\\]]+)\\]`);
|
|
14753
15337
|
method(object({
|
|
14754
15338
|
crop: _instanceof(Uint8Array),
|
|
14755
15339
|
width: number(),
|
|
14756
15340
|
height: number()
|
|
14757
|
-
}), EmbeddingResultSchema, { auth: "admin" }), method(object({
|
|
15341
|
+
}), EmbeddingResultSchema, { auth: "admin" }), method(object({
|
|
15342
|
+
text: string(),
|
|
15343
|
+
modelId: string().min(1).optional()
|
|
15344
|
+
}), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" }), method(object({ modelId: string().min(1).optional() }), object({
|
|
15345
|
+
cleared: array(string()),
|
|
15346
|
+
nodeId: string()
|
|
15347
|
+
}), {
|
|
15348
|
+
kind: "mutation",
|
|
15349
|
+
auth: "admin"
|
|
15350
|
+
});
|
|
14758
15351
|
/**
|
|
14759
15352
|
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
14760
15353
|
* through, per camera, with the denominator attached. It stores nothing.
|
|
@@ -17437,6 +18030,9 @@ var NcSystemEventKindSchema = _enum([
|
|
|
17437
18030
|
"device-battery-normal",
|
|
17438
18031
|
"device-consumable-low",
|
|
17439
18032
|
"device-consumable-normal",
|
|
18033
|
+
"device-tank-low",
|
|
18034
|
+
"device-tank-full",
|
|
18035
|
+
"device-tank-normal",
|
|
17440
18036
|
"stream-online",
|
|
17441
18037
|
"stream-offline",
|
|
17442
18038
|
"node-online",
|
|
@@ -17474,6 +18070,29 @@ var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
|
|
|
17474
18070
|
]);
|
|
17475
18071
|
NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
|
|
17476
18072
|
/**
|
|
18073
|
+
* The panel's transitions, as ONE list.
|
|
18074
|
+
*
|
|
18075
|
+
* Named here rather than spelled out at each of the four sites that need them
|
|
18076
|
+
* (the emitter, the intake, the editor group, the combined-notification gate),
|
|
18077
|
+
* because a transition added to the enum and forgotten at one of them is an
|
|
18078
|
+
* alarm state nobody can be notified about. That is exactly what this list
|
|
18079
|
+
* failed to prevent while it held three: `alarm-arming` was the fourth.
|
|
18080
|
+
*
|
|
18081
|
+
* In LIFECYCLE order, which is the order an editor lists them in and the order
|
|
18082
|
+
* a person experiences them — not the order they were added.
|
|
18083
|
+
*/
|
|
18084
|
+
var NC_ALARM_SYSTEM_EVENT_KINDS = [
|
|
18085
|
+
"alarm-arm-refused",
|
|
18086
|
+
"alarm-check-failed",
|
|
18087
|
+
"alarm-arming",
|
|
18088
|
+
"alarm-armed",
|
|
18089
|
+
"alarm-pending",
|
|
18090
|
+
"alarm-triggered",
|
|
18091
|
+
"alarm-rearmed",
|
|
18092
|
+
"alarm-sensor-bypass",
|
|
18093
|
+
"alarm-disarmed"
|
|
18094
|
+
];
|
|
18095
|
+
/**
|
|
17477
18096
|
* One coherent system-event condition. `kinds` is the required opt-in safety
|
|
17478
18097
|
* gate; the remaining lists are optional narrowing filters relevant to the
|
|
17479
18098
|
* selected kinds.
|
|
@@ -17507,7 +18126,22 @@ var NcSystemEventConditionSchema = object({
|
|
|
17507
18126
|
*/
|
|
17508
18127
|
excludeDeviceIds: array(number().int()).min(1).optional(),
|
|
17509
18128
|
nodeIds: array(string().min(1)).min(1).optional(),
|
|
17510
|
-
packageNames: array(string().min(1)).min(1).optional()
|
|
18129
|
+
packageNames: array(string().min(1)).min(1).optional(),
|
|
18130
|
+
/**
|
|
18131
|
+
* At or below this remaining-life %, a consumable is LOW for THIS rule
|
|
18132
|
+
* (D642). Absent = {@link NC_CONSUMABLE_LOW_PERCENT_DEFAULT}; at most
|
|
18133
|
+
* {@link NC_CONSUMABLE_LOW_PERCENT_MAX}, so every episode can recover. Scoped to the
|
|
18134
|
+
* consumable kinds (`systemEventFilterApplies`) and to the device-events
|
|
18135
|
+
* family; ignored on every other kind.
|
|
18136
|
+
*
|
|
18137
|
+
* It is a property of the RULE because the operator decided so: a rule at
|
|
18138
|
+
* 25 must be told about a filter at 20 %, a rule at 10 must not. The hub
|
|
18139
|
+
* keeps one episode per (threshold, device, item) — its own hysteresis, its
|
|
18140
|
+
* own reminder — and a rule hears only the episode judged at ITS threshold,
|
|
18141
|
+
* exactly as an occupancy rule hears only the edge of its own count. A
|
|
18142
|
+
* provider's own `replace` verdict is low at every threshold.
|
|
18143
|
+
*/
|
|
18144
|
+
consumableLowPercent: number().int().min(1).max(95).optional()
|
|
17511
18145
|
});
|
|
17512
18146
|
/** Hard ceiling on a window (24h). A snooze that could not expire would be an
|
|
17513
18147
|
* outage the operator asked for once and forgot. */
|
|
@@ -17525,6 +18159,25 @@ var NcScheduleSchema = object({
|
|
|
17525
18159
|
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
17526
18160
|
invert: boolean().optional()
|
|
17527
18161
|
});
|
|
18162
|
+
/**
|
|
18163
|
+
* How a system-event rule of the `device-events` or `system` family speaks
|
|
18164
|
+
* (D647): at once, per event (`instant`, the only behaviour before D647), or
|
|
18165
|
+
* as a STATE SUMMARY at the end of each window of `schedule`.
|
|
18166
|
+
*/
|
|
18167
|
+
var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
|
|
18168
|
+
/**
|
|
18169
|
+
* `summary`: the rule sends NOTHING per event. When a window of `schedule`
|
|
18170
|
+
* CLOSES, it sends one notification with the current state of its kinds
|
|
18171
|
+
* (low batteries, consumables to replace, devices offline, updates
|
|
18172
|
+
* available, ...), after its own filters. Nothing to report sends nothing.
|
|
18173
|
+
* The schedule is the ordinary `NcSchedule` (weekly windows, IANA timezone,
|
|
18174
|
+
* midnight crossing); the send time is each window's END. Refused on the
|
|
18175
|
+
* `alarm` family, which stays instant (`systemEventDeliveryProblems`).
|
|
18176
|
+
*/
|
|
18177
|
+
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
|
|
18178
|
+
mode: literal("summary"),
|
|
18179
|
+
schedule: NcScheduleSchema
|
|
18180
|
+
})]);
|
|
17528
18181
|
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
17529
18182
|
var NcPlateMatcherSchema = object({
|
|
17530
18183
|
/**
|
|
@@ -17650,6 +18303,16 @@ var NcCrossingSchema = _enum([
|
|
|
17650
18303
|
"exit",
|
|
17651
18304
|
"any"
|
|
17652
18305
|
]);
|
|
18306
|
+
/**
|
|
18307
|
+
* Which edge of a BOOLEAN sensor fires a device-event rule (D640).
|
|
18308
|
+
* - `raised` — the sensor went high: water detected, smoke, open, tampered.
|
|
18309
|
+
* - `cleared` — it went back: dry, clear, closed.
|
|
18310
|
+
* - absent — both edges, which is what every rule authored before this did.
|
|
18311
|
+
*
|
|
18312
|
+
* There is no third member for "both": absence already says it, and a value
|
|
18313
|
+
* that means the same as absence is a second way to write one rule.
|
|
18314
|
+
*/
|
|
18315
|
+
var NcSensorTransitionSchema = _enum(["raised", "cleared"]);
|
|
17653
18316
|
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
17654
18317
|
var NcZoneConditionSchema = object({
|
|
17655
18318
|
ids: array(string().min(1)).min(1),
|
|
@@ -17839,6 +18502,20 @@ var NcConditionsSchema = object({
|
|
|
17839
18502
|
scene: NcSceneConditionSchema.optional(),
|
|
17840
18503
|
/** Device scope — absent = all devices. */
|
|
17841
18504
|
devices: array(number()).optional(),
|
|
18505
|
+
/**
|
|
18506
|
+
* Device EXCLUSION (D641) — "every device except these". Judged on the SAME
|
|
18507
|
+
* subject ids {@link devices} is judged on (the camera, the sensor that
|
|
18508
|
+
* fired, a linked set's sensor and row cameras), so a sensor fanned out per
|
|
18509
|
+
* linked camera is excluded exactly where an include would have tested it.
|
|
18510
|
+
* `min(1)`: an empty exclusion excludes nothing and is written as absent.
|
|
18511
|
+
*
|
|
18512
|
+
* Not for `system-event` rules — those carry their own
|
|
18513
|
+
* `systemEvent.excludeDeviceIds` (D636), and the hub refuses this key there.
|
|
18514
|
+
* Editors present the two lists as ONE field (All | Only these | All except
|
|
18515
|
+
* these); the engine evaluates each independently, so a legacy rule
|
|
18516
|
+
* carrying both still means "these, minus those".
|
|
18517
|
+
*/
|
|
18518
|
+
devicesExclude: array(number()).min(1).optional(),
|
|
17842
18519
|
/** Detector class names (any overlap with the record's class set). */
|
|
17843
18520
|
classes: array(string().min(1)).optional(),
|
|
17844
18521
|
/** Veto classes — any overlap fails the rule. */
|
|
@@ -17972,6 +18649,16 @@ var NcConditionsSchema = object({
|
|
|
17972
18649
|
*/
|
|
17973
18650
|
sensorKinds: array(string().min(1)).optional(),
|
|
17974
18651
|
/**
|
|
18652
|
+
* DEVICE-EVENT only (D640). Fire on one edge of a boolean sensor —
|
|
18653
|
+
* {@link NcSensorTransitionSchema}. Which field of the slice means "raised"
|
|
18654
|
+
* is `@camstack/types` → `notification/sensor-raised.ts`. A reading the
|
|
18655
|
+
* engine cannot place (a kind with no raise, an unreadable slice) PASSES:
|
|
18656
|
+
* the condition fails open towards notifying, never towards silence. Editors
|
|
18657
|
+
* offer it only when every chosen {@link sensorKinds} member has a raise
|
|
18658
|
+
* (`sensorTransitionOffered`), and the hub refuses it on any other delivery.
|
|
18659
|
+
*/
|
|
18660
|
+
sensorTransition: NcSensorTransitionSchema.optional(),
|
|
18661
|
+
/**
|
|
17975
18662
|
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
17976
18663
|
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
17977
18664
|
* when the subject's phase does not match (a subject always carries a phase
|
|
@@ -18104,7 +18791,12 @@ var NcMediaPolicySchema = object({
|
|
|
18104
18791
|
* the degrade engine, which drops the video and keeps the still.
|
|
18105
18792
|
*/
|
|
18106
18793
|
clip: boolean().optional(),
|
|
18107
|
-
/**
|
|
18794
|
+
/**
|
|
18795
|
+
* Seconds of footage BEFORE / AFTER the event instant. Absent =
|
|
18796
|
+
* {@link NC_CLIP_PRE_ROLL_DEFAULT_SEC} / {@link NC_CLIP_POST_ROLL_DEFAULT_SEC}
|
|
18797
|
+
* (4 / 6), resolved by the Notification Center at dispatch — deliberately not
|
|
18798
|
+
* a Zod default, so a rule that never chose keeps following the hub's.
|
|
18799
|
+
*/
|
|
18108
18800
|
clipPreRollSec: number().int().min(0).max(30).optional(),
|
|
18109
18801
|
clipPostRollSec: number().int().min(0).max(30).optional(),
|
|
18110
18802
|
/**
|
|
@@ -18226,6 +18918,16 @@ var NcRuleInputSchema = object({
|
|
|
18226
18918
|
delivery: NcDeliverySchema,
|
|
18227
18919
|
conditions: NcConditionsSchema.default({}),
|
|
18228
18920
|
schedule: NcScheduleSchema.optional(),
|
|
18921
|
+
/**
|
|
18922
|
+
* A `device-events` / `system` rule's delivery (D647): absent or `instant`
|
|
18923
|
+
* is a notification per event; `summary` is one state summary per closed
|
|
18924
|
+
* window of its schedule. `.optional()` and never defaulted: absent must
|
|
18925
|
+
* keep meaning what every rule authored before D647 meant, with no
|
|
18926
|
+
* migration. Top-level rather than inside `conditions.systemEvent`, so a
|
|
18927
|
+
* client that does not know it (an older viewer re-sending `conditions`
|
|
18928
|
+
* whole) leaves it standing through the store's patch merge.
|
|
18929
|
+
*/
|
|
18930
|
+
systemEventDelivery: NcSystemEventDeliverySchema.optional(),
|
|
18229
18931
|
/** May be empty when `targetUsers` addresses at least one user — the
|
|
18230
18932
|
* "at least one addressee" invariant is enforced by the provider, because
|
|
18231
18933
|
* a cross-field refine here would break `NcRulePatchSchema.partial()`. */
|
|
@@ -18454,6 +19156,28 @@ var NcRuleSchema = NcRuleInputSchema.extend({
|
|
|
18454
19156
|
*/
|
|
18455
19157
|
disabledTargetIds: array(string()).default([])
|
|
18456
19158
|
});
|
|
19159
|
+
/** One section of a previewed state summary. `unavailable` = its state could not be read. */
|
|
19160
|
+
var NcStateSummaryPreviewSectionSchema = object({
|
|
19161
|
+
id: string(),
|
|
19162
|
+
status: _enum(["read", "unavailable"]),
|
|
19163
|
+
items: number().int().nonnegative(),
|
|
19164
|
+
reason: string().optional()
|
|
19165
|
+
});
|
|
19166
|
+
/**
|
|
19167
|
+
* The summary a rule would send now. `empty` = nothing to report and every
|
|
19168
|
+
* section read: such a summary is NOT sent. `dropped` counts the open states
|
|
19169
|
+
* the rule's own filters (or a camera mute) left out, by reason.
|
|
19170
|
+
* `excludedGroups` names the kind groups selected that have no state to report
|
|
19171
|
+
* (backups & exports).
|
|
19172
|
+
*/
|
|
19173
|
+
var NcStateSummaryPreviewSchema = object({
|
|
19174
|
+
empty: boolean(),
|
|
19175
|
+
count: number().int().nonnegative(),
|
|
19176
|
+
text: string(),
|
|
19177
|
+
sections: array(NcStateSummaryPreviewSectionSchema),
|
|
19178
|
+
dropped: record(string(), number().int().nonnegative()),
|
|
19179
|
+
excludedGroups: array(string())
|
|
19180
|
+
});
|
|
18457
19181
|
var NcTestResultSchema = object({
|
|
18458
19182
|
recordId: string(),
|
|
18459
19183
|
recordKind: _enum([
|
|
@@ -18471,9 +19195,29 @@ var NcTestResultSchema = object({
|
|
|
18471
19195
|
className: string().optional(),
|
|
18472
19196
|
label: string().optional()
|
|
18473
19197
|
});
|
|
18474
|
-
/** The
|
|
18475
|
-
*
|
|
19198
|
+
/** The rule kinds, as data. `NcRuleKind` in `notification/rule-kinds.ts` is
|
|
19199
|
+
* `z.infer` of this schema — one shape, no twin. `mixed` is DERIVED
|
|
19200
|
+
* (a stored system rule whose kinds span families, D637) and never authored. */
|
|
18476
19201
|
var NcRuleKindSchema = _enum([
|
|
19202
|
+
"detection",
|
|
19203
|
+
"sensor",
|
|
19204
|
+
"occupancy",
|
|
19205
|
+
"sound",
|
|
19206
|
+
"device-events",
|
|
19207
|
+
"system",
|
|
19208
|
+
"alarm",
|
|
19209
|
+
"mixed"
|
|
19210
|
+
]);
|
|
19211
|
+
/**
|
|
19212
|
+
* The kinds a SERVED template-variable descriptor may name: the five that
|
|
19213
|
+
* existed before D637, frozen. `getTemplateCatalog` ships `kinds` to every
|
|
19214
|
+
* installed viewer, and a viewer at `@camstack/types` 1.2.25x parses them with a
|
|
19215
|
+
* strict five-member enum — one `device-events` in one descriptor fails the
|
|
19216
|
+
* whole catalog parse. So the WIRE says `system`, and the MATCH widens it:
|
|
19217
|
+
* `templateVarKindApplies` reads a `system` descriptor as applying to every
|
|
19218
|
+
* system rule kind (`device-events`, `system`, `alarm`, `mixed`).
|
|
19219
|
+
*/
|
|
19220
|
+
var NcTemplateVarKindSchema = _enum([
|
|
18477
19221
|
"detection",
|
|
18478
19222
|
"sensor",
|
|
18479
19223
|
"occupancy",
|
|
@@ -18511,7 +19255,7 @@ var NcTemplateVarGroupSchema = _enum([
|
|
|
18511
19255
|
*
|
|
18512
19256
|
* `families` / `fields` / `kinds` / `deliveries` / `systemEventKinds` say WHERE
|
|
18513
19257
|
* it has a value; absent = no restriction on that axis. `systemEventKinds` is
|
|
18514
|
-
* read only for a
|
|
19258
|
+
* read only for a system-event rule (any family, or `mixed`). `dynamic` declares a FAMILY of names
|
|
18515
19259
|
* (`count_<class>`): the descriptor's `name` is the example member.
|
|
18516
19260
|
*/
|
|
18517
19261
|
var NcTemplateVarDescriptorSchema = object({
|
|
@@ -18522,9 +19266,16 @@ var NcTemplateVarDescriptorSchema = object({
|
|
|
18522
19266
|
group: NcTemplateVarGroupSchema,
|
|
18523
19267
|
families: array(NcTemplateFamilySchema).min(1),
|
|
18524
19268
|
fields: array(NcTemplateFieldSchema).optional(),
|
|
18525
|
-
kinds: array(
|
|
19269
|
+
kinds: array(NcTemplateVarKindSchema).optional(),
|
|
18526
19270
|
deliveries: array(NcDeliverySchema).optional(),
|
|
18527
19271
|
systemEventKinds: array(NcSystemEventKindSchema).optional(),
|
|
19272
|
+
/**
|
|
19273
|
+
* Which system-event DELIVERY has a value for it (D647). Absent = an
|
|
19274
|
+
* instant row only when the descriptor names `systemEventKinds` (a
|
|
19275
|
+
* per-event fact: a summary row has no single device), and both otherwise.
|
|
19276
|
+
* `['summary']` marks the state-summary vocabulary (`{{summaryText}}`, ...).
|
|
19277
|
+
*/
|
|
19278
|
+
systemEventDeliveries: array(NcSystemEventDeliveryModeSchema).optional(),
|
|
18528
19279
|
dynamic: object({
|
|
18529
19280
|
prefix: literal("count_"),
|
|
18530
19281
|
from: literal("classes")
|
|
@@ -18537,7 +19288,9 @@ var NcTemplatePreviewInputSchema = object({
|
|
|
18537
19288
|
field: NcTemplateFieldSchema,
|
|
18538
19289
|
kind: NcRuleKindSchema.optional(),
|
|
18539
19290
|
delivery: NcDeliverySchema.optional(),
|
|
18540
|
-
systemEventKinds: array(NcSystemEventKindSchema).optional()
|
|
19291
|
+
systemEventKinds: array(NcSystemEventKindSchema).optional(),
|
|
19292
|
+
/** The rule's system-event delivery (D647); absent = instant. */
|
|
19293
|
+
systemEventDelivery: NcSystemEventDeliveryModeSchema.optional()
|
|
18541
19294
|
}),
|
|
18542
19295
|
template: object({
|
|
18543
19296
|
title: string().max(500).optional(),
|
|
@@ -18570,6 +19323,7 @@ var NcConditionDescriptorSchema = object({
|
|
|
18570
19323
|
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
18571
19324
|
valueType: _enum([
|
|
18572
19325
|
"deviceIdList",
|
|
19326
|
+
"deviceIdExcludeList",
|
|
18573
19327
|
"stringList",
|
|
18574
19328
|
"number01",
|
|
18575
19329
|
"number",
|
|
@@ -18580,6 +19334,7 @@ var NcConditionDescriptorSchema = object({
|
|
|
18580
19334
|
"plateMatcher",
|
|
18581
19335
|
"packagePhase",
|
|
18582
19336
|
"crossingSelect",
|
|
19337
|
+
"sensorTransition",
|
|
18583
19338
|
"polygonDraw",
|
|
18584
19339
|
"occupancy",
|
|
18585
19340
|
"audio",
|
|
@@ -18730,6 +19485,28 @@ var NcHistoryFilterSchema = object({
|
|
|
18730
19485
|
limit: number().int().min(1).max(500).default(100)
|
|
18731
19486
|
});
|
|
18732
19487
|
/**
|
|
19488
|
+
* Every rule's last run, in one answer.
|
|
19489
|
+
*
|
|
19490
|
+
* A rule ABSENT from `runs` produced no delivery inside `horizonMs` — how far
|
|
19491
|
+
* back this answer looked, in ms before the hub's now. It is the outbox prune
|
|
19492
|
+
* window (7 days by default, operator-configurable), NARROWED when the read hit
|
|
19493
|
+
* its row bound: the answer never claims a window it did not read. `null` means
|
|
19494
|
+
* the operator keeps the outbox forever AND the read reached its end, so absent
|
|
19495
|
+
* means "never on record". A UI derives its "not in the last N days" from this
|
|
19496
|
+
* value, never from a constant — and only when the call ANSWERED (D315).
|
|
19497
|
+
*/
|
|
19498
|
+
var NcRuleLastRunsSchema = object({
|
|
19499
|
+
runs: array(object({
|
|
19500
|
+
ruleId: string(),
|
|
19501
|
+
/** Fire time of the newest row (`createdAt`, epoch ms). */
|
|
19502
|
+
lastAt: number(),
|
|
19503
|
+
status: NcHistoryStatusSchema,
|
|
19504
|
+
/** The camera/device of that row (a digest row files under its first camera). */
|
|
19505
|
+
deviceId: number()
|
|
19506
|
+
})),
|
|
19507
|
+
horizonMs: number().nonnegative().nullable()
|
|
19508
|
+
});
|
|
19509
|
+
/**
|
|
18733
19510
|
* What a snooze covers. Broader scopes win when several overlap, so one window
|
|
18734
19511
|
* leaves ONE digest rather than a rule snooze and a whole-feed snooze both
|
|
18735
19512
|
* summarising the same silence.
|
|
@@ -18910,6 +19687,14 @@ var NcAlarmModeCoverageSchema = object({
|
|
|
18910
19687
|
/** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
|
|
18911
19688
|
deviceIds: array(number().int()),
|
|
18912
19689
|
/**
|
|
19690
|
+
* D641: the ids NOT covered although `allDevices` is true — every unscoped
|
|
19691
|
+
* covering rule EXCLUDES them (`conditions.devicesExclude`) and no named rule
|
|
19692
|
+
* covers them. Always `[]` when `allDevices` is false. Excluded by the rules,
|
|
19693
|
+
* which is not the same as skipped by a switch: never in `skippedDevices`.
|
|
19694
|
+
* Defaulted so an answer computed before this field parses as "none".
|
|
19695
|
+
*/
|
|
19696
|
+
allDevicesExcept: array(number().int()).default([]),
|
|
19697
|
+
/**
|
|
18913
19698
|
* Devices this mode NAMES but cannot actually arm, each with the switch that
|
|
18914
19699
|
* excludes it.
|
|
18915
19700
|
*
|
|
@@ -19039,13 +19824,17 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
19039
19824
|
}), object({ results: array(NcTestResultSchema) }), {
|
|
19040
19825
|
kind: "mutation",
|
|
19041
19826
|
auth: "admin"
|
|
19827
|
+
}), method(object({ rule: NcRuleInputSchema }), NcStateSummaryPreviewSchema, {
|
|
19828
|
+
kind: "mutation",
|
|
19829
|
+
auth: "admin",
|
|
19830
|
+
access: "view"
|
|
19042
19831
|
}), method(object({}), object({
|
|
19043
19832
|
catalog: array(NcConditionDescriptorSchema),
|
|
19044
19833
|
taxonomy: NcTaxonomySchema.optional()
|
|
19045
19834
|
})), method(object({}), object({ vars: array(NcTemplateVarDescriptorSchema) })), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
|
|
19046
19835
|
kind: "mutation",
|
|
19047
19836
|
access: "view"
|
|
19048
|
-
}), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
|
|
19837
|
+
}), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({}), NcRuleLastRunsSchema, { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
|
|
19049
19838
|
kind: "mutation",
|
|
19050
19839
|
caller: "required"
|
|
19051
19840
|
}), method(object({ snoozeId: string() }), object({ success: literal(true) }), {
|
|
@@ -19385,645 +20174,129 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
19385
20174
|
});
|
|
19386
20175
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
19387
20176
|
/**
|
|
19388
|
-
*
|
|
19389
|
-
*
|
|
19390
|
-
*
|
|
19391
|
-
|
|
19392
|
-
|
|
19393
|
-
|
|
19394
|
-
|
|
19395
|
-
|
|
19396
|
-
|
|
19397
|
-
|
|
19398
|
-
|
|
19399
|
-
|
|
19400
|
-
|
|
19401
|
-
|
|
19402
|
-
|
|
19403
|
-
|
|
19404
|
-
|
|
19405
|
-
|
|
19406
|
-
|
|
19407
|
-
|
|
19408
|
-
|
|
19409
|
-
|
|
19410
|
-
|
|
19411
|
-
|
|
19412
|
-
|
|
19413
|
-
|
|
19414
|
-
|
|
19415
|
-
|
|
19416
|
-
|
|
19417
|
-
|
|
19418
|
-
|
|
19419
|
-
|
|
19420
|
-
|
|
19421
|
-
|
|
19422
|
-
*
|
|
19423
|
-
*
|
|
19424
|
-
*
|
|
19425
|
-
|
|
19426
|
-
|
|
19427
|
-
|
|
19428
|
-
|
|
19429
|
-
|
|
19430
|
-
|
|
19431
|
-
|
|
19432
|
-
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
|
|
19437
|
-
"
|
|
19438
|
-
"
|
|
19439
|
-
"
|
|
19440
|
-
"
|
|
19441
|
-
"
|
|
19442
|
-
]
|
|
19443
|
-
|
|
19444
|
-
"
|
|
19445
|
-
"
|
|
19446
|
-
"
|
|
19447
|
-
"
|
|
19448
|
-
|
|
19449
|
-
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
|
|
19458
|
-
|
|
19459
|
-
|
|
19460
|
-
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19469
|
-
|
|
19470
|
-
|
|
19471
|
-
|
|
19472
|
-
|
|
19473
|
-
|
|
19474
|
-
|
|
19475
|
-
|
|
19476
|
-
|
|
19477
|
-
|
|
19478
|
-
|
|
19479
|
-
|
|
19480
|
-
|
|
19481
|
-
|
|
19482
|
-
|
|
19483
|
-
|
|
19484
|
-
|
|
19485
|
-
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
|
|
19492
|
-
|
|
19493
|
-
|
|
19494
|
-
|
|
19495
|
-
|
|
19496
|
-
|
|
19497
|
-
|
|
19498
|
-
}
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
|
|
19502
|
-
}
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
|
|
19506
|
-
|
|
19507
|
-
|
|
19508
|
-
|
|
19509
|
-
|
|
19510
|
-
|
|
19511
|
-
models: array(PipelineModelOptionSchema).readonly(),
|
|
19512
|
-
defaultModelId: string(),
|
|
19513
|
-
defaultModelIdByFormat: record(string(), string()).optional(),
|
|
19514
|
-
enabledByDefault: boolean().optional(),
|
|
19515
|
-
backfillIntoExistingOverrides: boolean().optional(),
|
|
19516
|
-
defaultConfidence: number(),
|
|
19517
|
-
group: string().optional(),
|
|
19518
|
-
configSchema: array(ConfigFieldBridge).readonly().optional()
|
|
19519
|
-
});
|
|
19520
|
-
var PipelineSlotSchemaSchema = object({
|
|
19521
|
-
id: PipelineSlotSchema,
|
|
19522
|
-
label: string(),
|
|
19523
|
-
priority: number(),
|
|
19524
|
-
parentSlot: PipelineSlotSchema.nullable(),
|
|
19525
|
-
addons: array(PipelineAddonSchemaSchema).readonly()
|
|
19526
|
-
});
|
|
19527
|
-
var PipelineSchemaSchema = object({
|
|
19528
|
-
availableEngines: array(AvailableEngineSchema).readonly(),
|
|
19529
|
-
selectedEngine: PipelineEngineChoiceSchema,
|
|
19530
|
-
slots: array(PipelineSlotSchemaSchema).readonly()
|
|
19531
|
-
});
|
|
19532
|
-
var EngineProvisioningSchema = object({
|
|
19533
|
-
runtimeId: _enum([
|
|
19534
|
-
"onnx",
|
|
19535
|
-
"openvino",
|
|
19536
|
-
"coreml",
|
|
19537
|
-
"edgetpu"
|
|
19538
|
-
]).nullable(),
|
|
19539
|
-
device: string().nullable(),
|
|
19540
|
-
state: _enum([
|
|
19541
|
-
"idle",
|
|
19542
|
-
"installing",
|
|
19543
|
-
"verifying",
|
|
19544
|
-
"ready",
|
|
19545
|
-
"failed"
|
|
19546
|
-
]),
|
|
19547
|
-
progress: number().optional(),
|
|
19548
|
-
error: string().optional(),
|
|
19549
|
-
nextRetryAt: number().optional(),
|
|
19550
|
-
/**
|
|
19551
|
-
* Gate A (config-correctness gate at engine change): human-readable
|
|
19552
|
-
* config issues surfaced EAGERLY when the node's engine changes — model
|
|
19553
|
-
* substitutions ("chose X, running Y") and zero-build steps ("no model
|
|
19554
|
-
* has a <format> build"). Additive/optional: informational only, never
|
|
19555
|
-
* enforced here — `assertEngineReady` (readiness) still gates inference.
|
|
19556
|
-
* Absent/empty when the node-default tree resolves cleanly.
|
|
19557
|
-
*/
|
|
19558
|
-
configIssues: array(string()).optional()
|
|
19559
|
-
});
|
|
19560
|
-
var PipelineStepInputSchema = lazy(() => object({
|
|
19561
|
-
addonId: string(),
|
|
19562
|
-
modelId: string().optional(),
|
|
19563
|
-
enabled: boolean().default(true),
|
|
19564
|
-
children: array(PipelineStepInputSchema).optional(),
|
|
19565
|
-
settings: record(string(), unknown()).optional(),
|
|
19566
|
-
jumpDeviceKey: string().optional()
|
|
19567
|
-
}));
|
|
19568
|
-
var ModelSubstitutionSchema = object({
|
|
19569
|
-
addonId: string(),
|
|
19570
|
-
chosen: string(),
|
|
19571
|
-
running: string(),
|
|
19572
|
-
format: string()
|
|
19573
|
-
});
|
|
19574
|
-
var PipelineValidationIssueSchema = object({
|
|
19575
|
-
addonId: string(),
|
|
19576
|
-
kind: _enum(["unknown-addon", "no-format-build"]),
|
|
19577
|
-
detail: string()
|
|
19578
|
-
});
|
|
19579
|
-
var PipelineValidationResultSchema = object({
|
|
19580
|
-
ok: boolean(),
|
|
19581
|
-
issues: array(PipelineValidationIssueSchema).readonly(),
|
|
19582
|
-
substitutions: array(ModelSubstitutionSchema).readonly(),
|
|
19583
|
-
/** The node's `currentEngine.format` this validation ran against. */
|
|
19584
|
-
format: string()
|
|
19585
|
-
});
|
|
19586
|
-
var ReferenceImageEntrySchema = object({
|
|
19587
|
-
filename: string(),
|
|
19588
|
-
stepIds: array(string()).readonly().optional()
|
|
19589
|
-
});
|
|
19590
|
-
var ReferenceImageBodySchema = object({
|
|
19591
|
-
base64: string(),
|
|
19592
|
-
filename: string()
|
|
19593
|
-
});
|
|
19594
|
-
var ReferenceAudioEntrySchema = object({
|
|
19595
|
-
filename: string(),
|
|
19596
|
-
sizeKb: number()
|
|
19597
|
-
});
|
|
19598
|
-
var ReferenceAudioBodySchema = object({ base64: string() });
|
|
19599
|
-
var AudioBackendSchema = object({
|
|
19600
|
-
id: string(),
|
|
19601
|
-
name: string(),
|
|
19602
|
-
description: string(),
|
|
19603
|
-
available: boolean(),
|
|
19604
|
-
/**
|
|
19605
|
-
* Raw classifier labels this backend can emit (e.g. YAMNet's
|
|
19606
|
-
* 521-class set or Apple SoundAnalysis's 303-class set). Used by
|
|
19607
|
-
* the benchmark UI to populate the `enabledMicroClasses` filter
|
|
19608
|
-
* specific to the selected backend without a separate fetch.
|
|
19609
|
-
*/
|
|
19610
|
-
rawLabels: array(string()).readonly().optional()
|
|
19611
|
-
});
|
|
19612
|
-
var AudioCapabilitiesSchema = object({
|
|
19613
|
-
activeBackend: string(),
|
|
19614
|
-
availableBackends: array(AudioBackendSchema).readonly(),
|
|
19615
|
-
sampleRate: number(),
|
|
19616
|
-
chunkDurationMs: number()
|
|
19617
|
-
});
|
|
19618
|
-
var DownloadModelResultSchema = object({
|
|
19619
|
-
filePath: string(),
|
|
19620
|
-
sizeMB: number(),
|
|
19621
|
-
durationMs: number()
|
|
19622
|
-
});
|
|
19623
|
-
/**
|
|
19624
|
-
* Wrapper carrying a single test run's result. Replaces the legacy
|
|
19625
|
-
* ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
|
|
19626
|
-
* canonical `AudioResult` from the Phase 6 output rework: one
|
|
19627
|
-
* `AudioDetection` per class above `minScore`, top-N candidates in
|
|
19628
|
-
* `debug.alternateLabels['audio-classifier']`, per-source timings in
|
|
19629
|
-
* `debug.stepTimings`. The outer `success`/`error` fields stay so the
|
|
19630
|
-
* benchmark UI can still report a clean failure when the classifier
|
|
19631
|
-
* cap isn't available.
|
|
19632
|
-
*/
|
|
19633
|
-
var AudioTestResultSchema = object({
|
|
19634
|
-
success: boolean(),
|
|
19635
|
-
error: string().optional(),
|
|
19636
|
-
frame: custom().optional()
|
|
19637
|
-
});
|
|
19638
|
-
var PipelineConfigBridge = custom();
|
|
19639
|
-
var ConfigUISchemaBridge = custom();
|
|
19640
|
-
var ConfigUISchemaNullableBridge = custom();
|
|
19641
|
-
var InferenceCapabilitiesBridge = custom();
|
|
19642
|
-
var ModelAvailabilityListBridge = custom();
|
|
19643
|
-
var PipelineRunResultBridge = custom();
|
|
19644
|
-
method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
|
|
19645
|
-
modelId: string(),
|
|
19646
|
-
settings: record(string(), unknown()).readonly()
|
|
19647
|
-
}))), method(object({ steps: record(string(), object({
|
|
19648
|
-
modelId: string(),
|
|
19649
|
-
settings: record(string(), unknown()).readonly()
|
|
19650
|
-
})) }), object({ success: literal(true) }), {
|
|
19651
|
-
kind: "mutation",
|
|
19652
|
-
auth: "admin"
|
|
19653
|
-
}), method(object({ nodeId: string() }), object({
|
|
19654
|
-
success: literal(true),
|
|
19655
|
-
clearedDevices: number()
|
|
19656
|
-
}), {
|
|
19657
|
-
kind: "mutation",
|
|
19658
|
-
auth: "admin"
|
|
19659
|
-
}), method(object({ nodeId: string() }), object({ unhealthy: array(object({
|
|
19660
|
-
/** `<backend>:<device>`, e.g. `openvino:gpu`. */
|
|
19661
|
-
deviceKey: string(),
|
|
19662
|
-
/**
|
|
19663
|
-
* `failed` — the per-device restart budget is exhausted; no pool
|
|
19664
|
-
* will be spawned until an operator re-arms it or the runner
|
|
19665
|
-
* respawns. `backoff` — under budget, waiting out the backoff (or
|
|
19666
|
-
* a cached pool observed dead and not yet condemned).
|
|
19667
|
-
*/
|
|
19668
|
-
state: _enum(["failed", "backoff"]),
|
|
19669
|
-
/** Epoch ms of the death that produced this state. */
|
|
19670
|
-
since: number(),
|
|
19671
|
-
/** Pool deaths inside the current window. */
|
|
19672
|
-
deaths: number(),
|
|
19673
|
-
/** The last death's message. */
|
|
19674
|
-
lastError: string()
|
|
19675
|
-
})).readonly() })), method(object({
|
|
19676
|
-
nodeId: string(),
|
|
19677
|
-
deviceKey: string()
|
|
19678
|
-
}), object({ rearmed: boolean() }), {
|
|
19679
|
-
kind: "mutation",
|
|
19680
|
-
auth: "admin"
|
|
19681
|
-
}), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({ steps: array(PipelineStepInputSchema) }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
|
|
19682
|
-
name: string(),
|
|
19683
|
-
steps: array(PipelineTemplateStepSchema).readonly(),
|
|
19684
|
-
engine: PipelineEngineChoiceSchema
|
|
19685
|
-
}), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
|
|
19686
|
-
id: string(),
|
|
19687
|
-
name: string().optional(),
|
|
19688
|
-
steps: array(PipelineTemplateStepSchema).readonly().optional()
|
|
19689
|
-
}), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
|
|
19690
|
-
addonId: string(),
|
|
19691
|
-
modelId: string(),
|
|
19692
|
-
format: ModelFormatSchema$1
|
|
19693
|
-
}), DownloadModelResultSchema, { kind: "mutation" }), method(object({
|
|
19694
|
-
addonId: string(),
|
|
19695
|
-
modelId: string(),
|
|
19696
|
-
format: ModelFormatSchema$1
|
|
19697
|
-
}), object({ success: literal(true) }), { kind: "mutation" }), method(object({
|
|
19698
|
-
engine: PipelineEngineChoiceSchema.optional(),
|
|
19699
|
-
steps: array(PipelineStepInputSchema).min(1),
|
|
19700
|
-
frame: FrameInputSchema.optional(),
|
|
19701
|
-
/**
|
|
19702
|
-
* Process-local lazy frame. Valid only when caller and provider resolve
|
|
19703
|
-
* in the same execution-group process; split/cross-node callers use
|
|
19704
|
-
* `frame`/`image` inline compatibility instead.
|
|
19705
|
-
*/
|
|
19706
|
-
frameRef: FrameRefSchema.optional(),
|
|
19707
|
-
/**
|
|
19708
|
-
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
19709
|
-
* the decoded pixels live in. One more member of the one-of
|
|
19710
|
-
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
19711
|
-
*/
|
|
19712
|
-
frameHandle: FrameHandleSchema.optional(),
|
|
19713
|
-
imageBase64: string().optional(),
|
|
19714
|
-
/**
|
|
19715
|
-
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
19716
|
-
* hops (hub → forked worker via Moleculer MsgPack) because it
|
|
19717
|
-
* skips the 33% base64 overhead + the per-call base64 decode on
|
|
19718
|
-
* the detection-pipeline worker. Callers can pass either; exactly
|
|
19719
|
-
* one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
|
|
19720
|
-
*/
|
|
19721
|
-
image: _instanceof(Uint8Array).optional(),
|
|
19722
|
-
referenceImage: string().optional(),
|
|
19723
|
-
deviceId: number().optional(),
|
|
19724
|
-
sessionId: string().optional(),
|
|
19725
|
-
/**
|
|
19726
|
-
* Execution plane. 'full' (default) runs the whole tree — benchmark,
|
|
19727
|
-
* reference-image, and detail-subtree calls. 'frame' is the live
|
|
19728
|
-
* per-frame dispatch: ONLY root-plane steps run; crop children
|
|
19729
|
-
* (inputClasses ≠ null) are skipped and served per-track via
|
|
19730
|
-
* pipelineRunner.runDetailSubtree (two-plane design).
|
|
19731
|
-
*/
|
|
19732
|
-
plane: _enum(["full", "frame"]).optional(),
|
|
19733
|
-
/**
|
|
19734
|
-
* Inference-device selector (Phase 2 multi-device). Format
|
|
19735
|
-
* `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
|
|
19736
|
-
* Omitted ⇒ the runner's default device (current single-engine
|
|
19737
|
-
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
19738
|
-
*/
|
|
19739
|
-
deviceKey: string().optional(),
|
|
19740
|
-
/**
|
|
19741
|
-
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
19742
|
-
* when the parent crop was resolved from the frame's retained NATIVE
|
|
19743
|
-
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
19744
|
-
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
19745
|
-
* resolution from that surface — the SAME quality path faces already
|
|
19746
|
-
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
19747
|
-
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
19748
|
-
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
19749
|
-
* the executor's crop-normalized child ROI back into frame-normalized
|
|
19750
|
-
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
19751
|
-
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
19752
|
-
* (today's behaviour on the fallback path).
|
|
19753
|
-
*/
|
|
19754
|
-
nativeCropRef: NativeCropRefSchema.optional()
|
|
19755
|
-
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
19756
|
-
engine: PipelineEngineChoiceSchema.optional(),
|
|
19757
|
-
steps: array(PipelineStepInputSchema).min(1),
|
|
19758
|
-
frames: array(FrameInputSchema).min(1).max(255),
|
|
19759
|
-
deviceId: number().optional(),
|
|
19760
|
-
sessionId: string().optional(),
|
|
19761
|
-
/**
|
|
19762
|
-
* Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
|
|
19763
|
-
* the batch to the Python pool's bench preprocess cache
|
|
19764
|
-
* (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
|
|
19765
|
-
* preprocessed ONCE and every later inference is a pure-inference cache
|
|
19766
|
-
* hit — the sustained-throughput run measures inference, not
|
|
19767
|
-
* decode+preprocess+infer. Omitted/0 for live frames (all different →
|
|
19768
|
-
* full preprocess every call, correct). Fresh per sustained run;
|
|
19769
|
-
* released via `uncacheFrame`.
|
|
19770
|
-
*/
|
|
19771
|
-
frameId: number().int().nonnegative().optional(),
|
|
19772
|
-
/** Inference-device selector (Phase 2 multi-device); see runPipeline. */
|
|
19773
|
-
deviceKey: string().optional()
|
|
19774
|
-
}), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
|
|
19775
|
-
data: _instanceof(Uint8Array),
|
|
19776
|
-
width: number().int().positive(),
|
|
19777
|
-
height: number().int().positive(),
|
|
19778
|
-
format: _enum([
|
|
19779
|
-
"rgb",
|
|
19780
|
-
"bgr",
|
|
19781
|
-
"gray"
|
|
19782
|
-
])
|
|
19783
|
-
}), object({
|
|
19784
|
-
frameId: number(),
|
|
19785
|
-
width: number(),
|
|
19786
|
-
height: number()
|
|
19787
|
-
}), { kind: "mutation" }), method(object({
|
|
19788
|
-
stepId: string(),
|
|
19789
|
-
frameId: number().int()
|
|
19790
|
-
}), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
|
|
19791
|
-
batchMode: string(),
|
|
19792
|
-
windowMs: number(),
|
|
19793
|
-
maxBatchSize: number(),
|
|
19794
|
-
concurrency: number()
|
|
19795
|
-
})), method(_void(), array(object({
|
|
19796
|
-
engineKey: string(),
|
|
19797
|
-
engine: PipelineEngineChoiceSchema,
|
|
19798
|
-
modelsLoaded: array(string()).readonly(),
|
|
19799
|
-
inUseByCameras: array(number()).readonly(),
|
|
19800
|
-
/**
|
|
19801
|
-
* Origin of this resident factory.
|
|
19802
|
-
* - `runtime` — main camera-serving engine (no idle TTL).
|
|
19803
|
-
* - `warm-override` — benchmark/test override held in the warm
|
|
19804
|
-
* cache; auto-disposed after the idle TTL.
|
|
19805
|
-
* - `device-pool` — a concurrent per-device pool (Phase 2
|
|
19806
|
-
* multi-device, keyed by `deviceKey`) resolved
|
|
19807
|
-
* via `resolveDeviceFactory`. Runs alongside the
|
|
19808
|
-
* `runtime` engine on a DIFFERENT accelerator
|
|
19809
|
-
* (NPU / iGPU / Coral) — this is how the
|
|
19810
|
-
* Engines tab shows all pools running at once.
|
|
19811
|
-
*/
|
|
19812
|
-
kind: _enum([
|
|
19813
|
-
"runtime",
|
|
19814
|
-
"warm-override",
|
|
19815
|
-
"device-pool"
|
|
19816
|
-
]),
|
|
19817
|
-
/** Native pid of the underlying Python pool (null when no pool). */
|
|
19818
|
-
poolPid: number().nullable(),
|
|
19819
|
-
/** ms since this factory was last used (null when not warm-tracked). */
|
|
19820
|
-
idleMs: number().nullable(),
|
|
19821
|
-
/** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
|
|
19822
|
-
idleTtlMs: number().nullable()
|
|
19823
|
-
})).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
|
|
19824
|
-
kind: "mutation",
|
|
19825
|
-
auth: "admin"
|
|
19826
|
-
}), method(object({
|
|
19827
|
-
engine: PipelineEngineChoiceSchema,
|
|
19828
|
-
force: boolean().optional()
|
|
19829
|
-
}), object({
|
|
19830
|
-
success: boolean(),
|
|
19831
|
-
reason: string().optional()
|
|
19832
|
-
}), {
|
|
19833
|
-
kind: "mutation",
|
|
19834
|
-
auth: "admin"
|
|
19835
|
-
}), method(_void(), array(ReferenceImageEntrySchema).readonly()), method(object({ filename: string() }), ReferenceImageBodySchema.nullable()), method(_void(), array(ReferenceAudioEntrySchema).readonly()), method(object({ filename: string() }), ReferenceAudioBodySchema.nullable()), method(_void(), AudioCapabilitiesSchema), method(object({
|
|
19836
|
-
addonId: string(),
|
|
19837
|
-
modelId: string(),
|
|
19838
|
-
filename: string().optional(),
|
|
19839
|
-
settings: record(string(), unknown()).optional()
|
|
19840
|
-
}), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
|
|
19841
|
-
/**
|
|
19842
|
-
* Per-stage gating mode applied to the zones a rule references.
|
|
19843
|
-
*
|
|
19844
|
-
* - `include`: the rule contributes to a **whitelist** for its stage.
|
|
19845
|
-
* When at least one `include` rule fires for a stage, only entities
|
|
19846
|
-
* inside one of those zones pass that stage.
|
|
19847
|
-
* - `exclude`: the rule contributes to a **blacklist** for its stage.
|
|
19848
|
-
* Entities inside one of those zones are dropped at that stage.
|
|
19849
|
-
*
|
|
19850
|
-
* `monitor`-style observation (count without filtering) is not a rule
|
|
19851
|
-
* mode — zones without any matching rule are observed naturally by
|
|
19852
|
-
* `zone-analytics` (live snapshot + history), so an "I just want to
|
|
19853
|
-
* count, not filter" use case needs no rule at all.
|
|
19854
|
-
*/
|
|
19855
|
-
var ZoneRuleModeEnum = _enum(["include", "exclude"]);
|
|
19856
|
-
/**
|
|
19857
|
-
* Per-consumer rule that references existing zones (geometry) and
|
|
19858
|
-
* defines how a specific pipeline stage should treat them. Each
|
|
19859
|
-
* consumer addon owns its own `ZoneRule[]` array in its per-device
|
|
19860
|
-
* settings:
|
|
19861
|
-
*
|
|
19862
|
-
* - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
|
|
19863
|
-
* - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
|
|
19864
|
-
* - future: notification rules, audio gating, etc.
|
|
19865
|
-
*
|
|
19866
|
-
* One rule applies to N zones (`zoneIds[]`) so the operator can
|
|
19867
|
-
* express "ignore motion in ALL of {garden, street}" with a single
|
|
19868
|
-
* rule. `classFilter` narrows the rule to specific object classes —
|
|
19869
|
-
* "drop person detections in the street, but keep cars" is one
|
|
19870
|
-
* `exclude` rule with `classFilter: ['person']`.
|
|
19871
|
-
*
|
|
19872
|
-
* `enabled` is a soft toggle — the operator can keep the rule
|
|
19873
|
-
* configured but inert without deleting it.
|
|
19874
|
-
*/
|
|
19875
|
-
var ZoneRuleSchema = object({
|
|
19876
|
-
/** Stable rule id — survives edits, used by the UI for diffing. */
|
|
19877
|
-
id: string(),
|
|
19878
|
-
/** Optional human-readable label rendered in the rule editor. */
|
|
19879
|
-
name: string().optional(),
|
|
19880
|
-
/** Zones this rule targets. The rule's `mode` applies to ALL
|
|
19881
|
-
* listed zones (OR-set: a detection in any one of them counts).
|
|
19882
|
-
* At least one zone id required — a rule with no targets is a
|
|
19883
|
-
* configuration mistake and the form validator rejects it. */
|
|
19884
|
-
zoneIds: array(string()).min(1).readonly(),
|
|
19885
|
-
mode: ZoneRuleModeEnum,
|
|
19886
|
-
/**
|
|
19887
|
-
* Class names this rule applies to. Empty / undefined ⇒ rule
|
|
19888
|
-
* applies to every class. Class strings match the `macroClass`
|
|
19889
|
-
* field on detections (e.g. `person`, `car`, `dog`).
|
|
19890
|
-
*/
|
|
19891
|
-
classFilter: array(string()).readonly().optional(),
|
|
19892
|
-
/**
|
|
19893
|
-
* Minimum bbox/mask overlap (0–1) with any of the rule's zones
|
|
19894
|
-
* required to consider an entity "in the zone". Defaults to the
|
|
19895
|
-
* consumer's stage default when omitted. Kept for back-compat with
|
|
19896
|
-
* existing per-rule overrides; new operators pick the value via
|
|
19897
|
-
* `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
|
|
19898
|
-
* set, the lower-level engine reads it as a 0–1 fraction.
|
|
19899
|
-
*/
|
|
19900
|
-
overlapThreshold: number().min(0).max(1).optional(),
|
|
19901
|
-
/**
|
|
19902
|
-
* Operator-friendly version of `overlapThreshold` — the percentage
|
|
19903
|
-
* of the detection's bbox that must lie inside the zone for the
|
|
19904
|
-
* rule to match. Documented default is 85%; the engine substitutes
|
|
19905
|
-
* that when the field is omitted (kept optional so existing rules
|
|
19906
|
-
* stored without it stay valid).
|
|
19907
|
-
*
|
|
19908
|
-
* When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
|
|
19909
|
-
* rule, the engine prefers `bboxInclusionPct` because it's the
|
|
19910
|
-
* field exposed in the UI. Internally both feed the same gate.
|
|
19911
|
-
*/
|
|
19912
|
-
bboxInclusionPct: number().min(0).max(100).optional(),
|
|
19913
|
-
/**
|
|
19914
|
-
* When `true` and a detection has a segmentation mask, use the
|
|
19915
|
-
* mask for overlap instead of the bbox. Detection-stage only;
|
|
19916
|
-
* motion rules ignore this field.
|
|
19917
|
-
*/
|
|
19918
|
-
preferMask: boolean().optional(),
|
|
19919
|
-
/**
|
|
19920
|
-
* Soft-toggle: `false` disables the rule without deleting it.
|
|
19921
|
-
* Defaults to `true` so operators creating a rule via the UI
|
|
19922
|
-
* see it active immediately.
|
|
19923
|
-
*/
|
|
19924
|
-
enabled: boolean().default(true)
|
|
19925
|
-
});
|
|
19926
|
-
array(ZoneRuleSchema).readonly();
|
|
19927
|
-
/**
|
|
19928
|
-
* Zone — pure geometry + identity. NO filtering behaviour.
|
|
19929
|
-
*
|
|
19930
|
-
* Zones describe **where** in the frame the operator wants to flag
|
|
19931
|
-
* something; consumer-owned {@link ZoneRule} arrays describe **how**
|
|
19932
|
-
* each pipeline stage uses them. Splitting the two means a single
|
|
19933
|
-
* polygon "Driveway" can simultaneously back a motion-exclude rule,
|
|
19934
|
-
* a detection-include rule on `['car']`, and an occupancy aggregate
|
|
19935
|
-
* — without three duplicated polygons.
|
|
19936
|
-
*
|
|
19937
|
-
* Owned by the orchestrator addon (provider) and mirrored into the
|
|
19938
|
-
* `zones` device-state slice on every mutation. Consumers
|
|
19939
|
-
* (motion-wasm, pipeline-executor, analytics, admin UI) read either
|
|
19940
|
-
* via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
|
|
19941
|
-
* mirror with `onChanged`).
|
|
19942
|
-
*
|
|
19943
|
-
* Coordinates are normalised fractions of the frame (0–1) so zones
|
|
19944
|
-
* survive resolution changes and stream profile switches.
|
|
19945
|
-
*
|
|
19946
|
-
* `kind` discriminates between full polygons (closed regions used
|
|
19947
|
-
* for intrusion / occupancy filters) and tripwires (open 2-point
|
|
19948
|
-
* line segments used for cross events). Onboard / firmware-reported
|
|
19949
|
-
* zones (Reolink, ONVIF) are out of scope for now — see the deferred
|
|
19950
|
-
* task list.
|
|
19951
|
-
*/
|
|
19952
|
-
var ZoneKindEnum = _enum(["polygon", "tripwire"]);
|
|
19953
|
-
/** Polygon vertex in fraction-of-frame coordinates (0–1). */
|
|
19954
|
-
var PolygonPointSchema = object({
|
|
19955
|
-
x: number(),
|
|
19956
|
-
y: number()
|
|
19957
|
-
});
|
|
19958
|
-
/** A camera detection zone — pure geometry/identity. */
|
|
19959
|
-
var ZoneSchema = object({
|
|
19960
|
-
id: string(),
|
|
19961
|
-
name: string(),
|
|
19962
|
-
kind: ZoneKindEnum.default("polygon"),
|
|
19963
|
-
/** Polygon vertices, fraction of frame (0–1). */
|
|
19964
|
-
polygon: array(PolygonPointSchema).readonly(),
|
|
19965
|
-
/** Visual color for UI rendering. */
|
|
19966
|
-
color: string().default("#3b82f6")
|
|
19967
|
-
});
|
|
19968
|
-
/**
|
|
19969
|
-
* Zones capability — per-camera CRUD over polygon detection zones.
|
|
19970
|
-
*
|
|
19971
|
-
* Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
|
|
19972
|
-
* to per-device settings and mirrors into the `zones` device-state
|
|
19973
|
-
* slice on every mutation, so downstream consumers can subscribe via
|
|
19974
|
-
* `dev.state.zones.onChanged`.
|
|
19975
|
-
*
|
|
19976
|
-
* The cap surface only handles geometry + identity; filtering
|
|
19977
|
-
* behaviour (per-class, include/exclude, threshold) lives in the
|
|
19978
|
-
* consumer addons' rule arrays — see `ZoneRuleSchema` exported from
|
|
19979
|
-
* `capabilities/schemas/zone-rule.js`.
|
|
19980
|
-
*/
|
|
19981
|
-
var zonesCapability = {
|
|
19982
|
-
name: "zones",
|
|
19983
|
-
scope: "device",
|
|
19984
|
-
mode: "singleton",
|
|
19985
|
-
deviceTypes: [DeviceType.Camera],
|
|
19986
|
-
methods: {
|
|
19987
|
-
listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
|
|
19988
|
-
addZone: method(object({
|
|
19989
|
-
deviceId: number(),
|
|
19990
|
-
zone: ZoneSchema
|
|
19991
|
-
}), _void(), {
|
|
19992
|
-
kind: "mutation",
|
|
19993
|
-
auth: "admin"
|
|
19994
|
-
}),
|
|
19995
|
-
removeZone: method(object({
|
|
19996
|
-
deviceId: number(),
|
|
19997
|
-
zoneId: string()
|
|
19998
|
-
}), _void(), {
|
|
19999
|
-
kind: "mutation",
|
|
20000
|
-
auth: "admin"
|
|
20001
|
-
}),
|
|
20002
|
-
updateZone: method(object({
|
|
20003
|
-
deviceId: number(),
|
|
20004
|
-
zone: ZoneSchema
|
|
20005
|
-
}), _void(), {
|
|
20006
|
-
kind: "mutation",
|
|
20007
|
-
auth: "admin"
|
|
20008
|
-
})
|
|
20009
|
-
},
|
|
20010
|
-
/**
|
|
20011
|
-
* Runtime-state slice — the live zone catalogue mirrored by the
|
|
20012
|
-
* orchestrator on every CRUD mutation. Consumers read via
|
|
20013
|
-
* `device.state.zones.value` / `.watch(...)` without round-tripping
|
|
20014
|
-
* the cap, and the codegen DeviceProxy auto-wires the reactive
|
|
20015
|
-
* handle. Slice shape is `{ zones: Zone[] }` so future extensions
|
|
20016
|
-
* (e.g. zone groupings) can sit alongside the polygon list.
|
|
20017
|
-
*/
|
|
20018
|
-
runtimeState: object({ zones: array(ZoneSchema).readonly() }),
|
|
20019
|
-
/**
|
|
20020
|
-
* Runtime-state durability: **restored** — written only on operator mutation, so a camera that never had one has nothing to re-derive from. This is the slice `zone-mirror-hydration.ts` exists to paper over.
|
|
20021
|
-
*
|
|
20022
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
20023
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
20024
|
-
*/
|
|
20025
|
-
durability: "restored"
|
|
20026
|
-
};
|
|
20177
|
+
* A model choice has a SCOPE, and a scope change has a workflow.
|
|
20178
|
+
*
|
|
20179
|
+
* ## The two scopes
|
|
20180
|
+
*
|
|
20181
|
+
* Almost every pipeline step's model is a **node** question: which build runs
|
|
20182
|
+
* fastest on THIS accelerator. Two nodes may legitimately answer differently —
|
|
20183
|
+
* a Coral runs the tflite SSD, a Mac runs the coreml YOLO — because the answers
|
|
20184
|
+
* are compared against nothing. They produce boxes, and a box is a box.
|
|
20185
|
+
*
|
|
20186
|
+
* Two steps are not like that. `face-embedding` and `clip-embedding` produce
|
|
20187
|
+
* **vectors that land in ONE shared index** (`identity_samples`,
|
|
20188
|
+
* `vec_object_clip`) and are ranked against each other by cosine similarity.
|
|
20189
|
+
* Cosine similarity between two encoders is not a weak signal, it is a
|
|
20190
|
+
* meaningless number — and nothing inside a vector can tell you it happened.
|
|
20191
|
+
* So for those two steps the model is a **cluster** question with exactly one
|
|
20192
|
+
* answer, stored in exactly one row.
|
|
20193
|
+
*
|
|
20194
|
+
* That is the same argument [D52](../../../../docs/decisions/adr-0052.md) makes
|
|
20195
|
+
* for the crop convention (`detail-crop.ts`), one level up: the crop decides
|
|
20196
|
+
* WHAT pixels the encoder sees, this decides WHICH encoder sees them. Both are
|
|
20197
|
+
* cluster-wide for the same reason and neither may become per-node.
|
|
20198
|
+
*
|
|
20199
|
+
* ## Why the registry lives here and not in the step catalog
|
|
20200
|
+
*
|
|
20201
|
+
* The scope itself is declared on the step, in
|
|
20202
|
+
* `detection-pipeline/registry/step-definitions.ts` (`StepDefinition.modelScope`)
|
|
20203
|
+
* — that is where a new step declares what kind of choice its model is. But the
|
|
20204
|
+
* catalog lives inside `addon-pipeline`, and three packages that must NOT
|
|
20205
|
+
* import an addon need to know the set: the orchestrator (which renders and
|
|
20206
|
+
* stores the row), post-analysis (which pins the row for a re-embed pass) and
|
|
20207
|
+
* admin-ui (which mirrors it). So the set is mirrored here, and
|
|
20208
|
+
* `scripts/check-cluster-model-scope.ts` fails the build when the two disagree.
|
|
20209
|
+
* A hand-copied key that stops matching is exactly how a setting silently stops
|
|
20210
|
+
* arriving while both sides still look correct.
|
|
20211
|
+
*
|
|
20212
|
+
* ## The defaults ARE today's behaviour
|
|
20213
|
+
*
|
|
20214
|
+
* {@link DEFAULT_CLUSTER_STEP_MODELS} reproduces the catalog `defaultModelId`
|
|
20215
|
+
* of both steps. Declaring the scope therefore changes nothing on the day it
|
|
20216
|
+
* ships: the cluster row starts out saying what every node was already doing.
|
|
20217
|
+
* Changing it is legitimate — that is what the knob is for — but it invalidates
|
|
20218
|
+
* the stored vectors of that surface, and must be followed by a re-embed pass
|
|
20219
|
+
* (`face-reembed-pass.ts`, `embedding-rebuild.ts`).
|
|
20220
|
+
*/
|
|
20221
|
+
/**
|
|
20222
|
+
* Why the orchestrator cannot say which model the operator chose for a
|
|
20223
|
+
* cluster-scoped step (D651).
|
|
20224
|
+
*/
|
|
20225
|
+
var CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS = [
|
|
20226
|
+
"owner-not-ready",
|
|
20227
|
+
"store-read-failed",
|
|
20228
|
+
"three-way-read-unavailable",
|
|
20229
|
+
"invalid-stored",
|
|
20230
|
+
"not-cluster-scoped"
|
|
20231
|
+
];
|
|
20232
|
+
Object.freeze(Object.fromEntries([{
|
|
20233
|
+
stepId: "face-embedding",
|
|
20234
|
+
label: "Face recognition model",
|
|
20235
|
+
defaultModelId: "auraface-r100",
|
|
20236
|
+
indexName: "the enrolled face gallery",
|
|
20237
|
+
options: [
|
|
20238
|
+
{
|
|
20239
|
+
id: "auraface-r100",
|
|
20240
|
+
label: "AuraFace R100"
|
|
20241
|
+
},
|
|
20242
|
+
{
|
|
20243
|
+
id: "arcface-r100",
|
|
20244
|
+
label: "ArcFace (ResNet34)"
|
|
20245
|
+
},
|
|
20246
|
+
{
|
|
20247
|
+
id: "inception-resnet-v1",
|
|
20248
|
+
label: "Inception ResNet V1"
|
|
20249
|
+
}
|
|
20250
|
+
]
|
|
20251
|
+
}, {
|
|
20252
|
+
stepId: "clip-embedding",
|
|
20253
|
+
label: "Semantic search model",
|
|
20254
|
+
defaultModelId: "mobileclip-s1",
|
|
20255
|
+
indexName: "the object semantic-search index",
|
|
20256
|
+
options: [
|
|
20257
|
+
{
|
|
20258
|
+
id: "mobileclip-s1",
|
|
20259
|
+
label: "MobileCLIP S1"
|
|
20260
|
+
},
|
|
20261
|
+
{
|
|
20262
|
+
id: "mobileclip-s2",
|
|
20263
|
+
label: "MobileCLIP S2"
|
|
20264
|
+
},
|
|
20265
|
+
{
|
|
20266
|
+
id: "siglip2-b16-224",
|
|
20267
|
+
label: "SigLIP2 B/16 (Apache-2.0)"
|
|
20268
|
+
}
|
|
20269
|
+
]
|
|
20270
|
+
}].map((s) => [s.stepId, s.defaultModelId])));
|
|
20271
|
+
var CLUSTER_STEP_SETTING_FIELDS = [{
|
|
20272
|
+
stepId: "face-embedding",
|
|
20273
|
+
key: "minLandmarkFaceSize",
|
|
20274
|
+
label: "Min face size for recognition (detection px)",
|
|
20275
|
+
description: "Refuse to embed a face smaller than this IN THE DETECTION FRAME. Applies to every node — the enrolled gallery is one index, and two admission floors would fill it from two policies. 0 disables the gate.",
|
|
20276
|
+
type: "slider",
|
|
20277
|
+
min: 0,
|
|
20278
|
+
max: 64,
|
|
20279
|
+
step: 2,
|
|
20280
|
+
default: 24
|
|
20281
|
+
}];
|
|
20282
|
+
function clusterStepSettingKey(stepId, fieldKey) {
|
|
20283
|
+
return `clusterStepSetting:${stepId}:${fieldKey}`;
|
|
20284
|
+
}
|
|
20285
|
+
var ClusterSettingNumberSchema = number().finite();
|
|
20286
|
+
function readClusterStepSettings(config) {
|
|
20287
|
+
const out = {};
|
|
20288
|
+
for (const field of CLUSTER_STEP_SETTING_FIELDS) {
|
|
20289
|
+
const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
|
|
20290
|
+
const value = parsed.success ? parsed.data : field.default;
|
|
20291
|
+
const existing = out[field.stepId] ?? {};
|
|
20292
|
+
out[field.stepId] = {
|
|
20293
|
+
...existing,
|
|
20294
|
+
[field.key]: value
|
|
20295
|
+
};
|
|
20296
|
+
}
|
|
20297
|
+
return out;
|
|
20298
|
+
}
|
|
20299
|
+
readClusterStepSettings({});
|
|
20027
20300
|
/**
|
|
20028
20301
|
* pipeline-analytics — device-scoped wrapper cap. Refines raw
|
|
20029
20302
|
* per-frame detections emitted by the pipeline runner into tracked
|
|
@@ -20595,6 +20868,22 @@ var TrackSchema = object({
|
|
|
20595
20868
|
* omit it. Render nothing when absent.
|
|
20596
20869
|
*/
|
|
20597
20870
|
previewMissReason: string().optional(),
|
|
20871
|
+
/**
|
|
20872
|
+
* The ROOT model that produced this track — the `FrameResult.rootModelId` of
|
|
20873
|
+
* the frame it was BORN on (D646). What a later replay compares against, so
|
|
20874
|
+
* "the original model" is named rather than assumed. A birth fact: never
|
|
20875
|
+
* rewritten by a later frame. **Absent ≠ unknown-model**: a row from before
|
|
20876
|
+
* the column, and a track the camera's own detector produced, carry none.
|
|
20877
|
+
*/
|
|
20878
|
+
modelId: string().optional(),
|
|
20879
|
+
/**
|
|
20880
|
+
* Size (px) of the detection frame this track's `positions[].bbox` live in —
|
|
20881
|
+
* the frame it was born on, else the camera's latest analysis frame at
|
|
20882
|
+
* persist time. Divide a position by these to normalise it. Absent when the
|
|
20883
|
+
* size was never known.
|
|
20884
|
+
*/
|
|
20885
|
+
frameWidth: number().optional(),
|
|
20886
|
+
frameHeight: number().optional(),
|
|
20598
20887
|
...TrackFlagFields,
|
|
20599
20888
|
...TrackRetrainFields
|
|
20600
20889
|
});
|
|
@@ -20806,6 +21095,13 @@ var AudioEventSchema = object({
|
|
|
20806
21095
|
originalClass: string().optional(),
|
|
20807
21096
|
score: number()
|
|
20808
21097
|
}).optional(),
|
|
21098
|
+
/**
|
|
21099
|
+
* Whether the classifier RAN on the window behind this row (D660). Absent
|
|
21100
|
+
* on rows written before D660 — unknown, NOT classified: until then a
|
|
21101
|
+
* window the analyzer's busy gate threw away was stored exactly like one
|
|
21102
|
+
* that heard nothing above the floor.
|
|
21103
|
+
*/
|
|
21104
|
+
classifyOutcome: AudioClassifyOutcomeSchema.optional(),
|
|
20809
21105
|
/** Populated by B5 (recording playback URL for this event). */
|
|
20810
21106
|
mediaUrl: string().optional()
|
|
20811
21107
|
});
|
|
@@ -20824,7 +21120,8 @@ var MediaFileKindEnum = _enum([
|
|
|
20824
21120
|
"thumbnailSmall",
|
|
20825
21121
|
"confirmationCrop",
|
|
20826
21122
|
"debugCrop",
|
|
20827
|
-
"sceneFrame"
|
|
21123
|
+
"sceneFrame",
|
|
21124
|
+
"lastSceneFrame"
|
|
20828
21125
|
]);
|
|
20829
21126
|
/**
|
|
20830
21127
|
* One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
|
|
@@ -21376,7 +21673,23 @@ var SearchObjectEventsInput = object({
|
|
|
21376
21673
|
until: number().optional(),
|
|
21377
21674
|
classFilter: string().optional(),
|
|
21378
21675
|
limit: number().default(50),
|
|
21379
|
-
|
|
21676
|
+
/**
|
|
21677
|
+
* An ABSOLUTE cosine floor. Optional since D649: a floor is a property of the
|
|
21678
|
+
* model (0.2 kept 96% of matched pairs on MobileCLIP S1 and 2.7% on SigLIP2),
|
|
21679
|
+
* so an absent one resolves to the searched model's own `searchMinScore`
|
|
21680
|
+
* scaled by `strictness`. A number sent here is honoured verbatim.
|
|
21681
|
+
*/
|
|
21682
|
+
minScore: number().min(0).max(1).optional(),
|
|
21683
|
+
/** Model-relative floor — see `resolveClipSearchMinScore`. Default `loose`. */
|
|
21684
|
+
strictness: ClipSearchStrictnessSchema.optional(),
|
|
21685
|
+
/**
|
|
21686
|
+
* Search THIS CLIP model's index instead of the cluster row's. Every index a
|
|
21687
|
+
* model ever wrote stays searchable until it is wiped (the MobileCLIP index
|
|
21688
|
+
* through a SigLIP2 cutover and its rollback window). An id with no CLIP
|
|
21689
|
+
* metadata is refused; an id other than the cluster row's is ADMIN-only
|
|
21690
|
+
* (`model-override-requires-admin`).
|
|
21691
|
+
*/
|
|
21692
|
+
modelId: string().min(1).optional()
|
|
21380
21693
|
});
|
|
21381
21694
|
var TrackCascadeCountsSchema = object({
|
|
21382
21695
|
/** Persisted track roots deleted (authoritative). */
|
|
@@ -21501,7 +21814,15 @@ var RebuildObjectEmbeddingsInput = object({
|
|
|
21501
21814
|
* force is logged at start and finish so a deliberately slow pass reads
|
|
21502
21815
|
* differently from a stalled one.
|
|
21503
21816
|
*/
|
|
21504
|
-
pacingMs: number().int().nonnegative().optional()
|
|
21817
|
+
pacingMs: number().int().nonnegative().optional(),
|
|
21818
|
+
/**
|
|
21819
|
+
* Re-embed ONLY the tracks whose vector is ALREADY in the pinned model's
|
|
21820
|
+
* space (D664) — the in-space skip inverted. It exists to redo vectors
|
|
21821
|
+
* written from the wrong box, which a normal pass would skip as done
|
|
21822
|
+
* forever. Requires `maxTracks`: a forced pass without a bound is refused
|
|
21823
|
+
* (`force-requires-max-tracks`).
|
|
21824
|
+
*/
|
|
21825
|
+
force: boolean().optional()
|
|
21505
21826
|
});
|
|
21506
21827
|
/**
|
|
21507
21828
|
* Result of emptying the CLIP index.
|
|
@@ -21511,7 +21832,43 @@ var RebuildObjectEmbeddingsInput = object({
|
|
|
21511
21832
|
* comparable, so wiping and rebuilding is the only way to be sure every vector
|
|
21512
21833
|
* means the same thing.
|
|
21513
21834
|
*/
|
|
21514
|
-
var WipeObjectEmbeddingsResultSchema = object({
|
|
21835
|
+
var WipeObjectEmbeddingsResultSchema = object({
|
|
21836
|
+
deleted: number(),
|
|
21837
|
+
/**
|
|
21838
|
+
* CLIP indexes that could NOT be emptied (unreachable, or refused at their
|
|
21839
|
+
* dimension) — not a clean slate. Additive and optional (D649).
|
|
21840
|
+
*/
|
|
21841
|
+
failedIndexes: array(string()).optional()
|
|
21842
|
+
});
|
|
21843
|
+
/**
|
|
21844
|
+
* Why a rebuild did not start, BY NAME — ONE vocabulary for both gates in front
|
|
21845
|
+
* of a pass (D649 over D651). A bare `started: false` read the same for "the
|
|
21846
|
+
* stores are booting" and "the cluster row names a model with no CLIP
|
|
21847
|
+
* metadata", which need different fixes.
|
|
21848
|
+
* - `stores-unavailable` — the analytics stores or the API are not up yet.
|
|
21849
|
+
* - the owner's confirmation of the cluster model (D651, `ClusterPinConfirmer`):
|
|
21850
|
+
* a pass that rewrites an index needs two agreeing reads of the OWNER's
|
|
21851
|
+
* answer (`pipelineOrchestrator.getClusterModelChoice`) — a pass that cannot
|
|
21852
|
+
* name its model does not run (D54):
|
|
21853
|
+
* - the owner's own `unreadable` reasons (`owner-not-ready`,
|
|
21854
|
+
* `store-read-failed`, `three-way-read-unavailable`, `invalid-stored`,
|
|
21855
|
+
* `not-cluster-scoped`);
|
|
21856
|
+
* - `method-unavailable` — the orchestrator predates the method;
|
|
21857
|
+
* - `read-failed` — the call failed or answered something unparseable;
|
|
21858
|
+
* - `reads-disagree` — the two reads named different choices.
|
|
21859
|
+
* - `not-a-clip-model` — the CONFIRMED id has no CLIP metadata, so there is no
|
|
21860
|
+
* index to fill and no dimension to check against (D649).
|
|
21861
|
+
* - `force-requires-max-tracks` — `force: true` with no `maxTracks` (D664).
|
|
21862
|
+
*/
|
|
21863
|
+
var RebuildObjectEmbeddingsRefusalSchema = _enum([
|
|
21864
|
+
"stores-unavailable",
|
|
21865
|
+
...CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS,
|
|
21866
|
+
"method-unavailable",
|
|
21867
|
+
"read-failed",
|
|
21868
|
+
"reads-disagree",
|
|
21869
|
+
"not-a-clip-model",
|
|
21870
|
+
"force-requires-max-tracks"
|
|
21871
|
+
]);
|
|
21515
21872
|
/**
|
|
21516
21873
|
* Acknowledgement that a rebuild STARTED.
|
|
21517
21874
|
*
|
|
@@ -21524,17 +21881,43 @@ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
|
|
|
21524
21881
|
var RebuildObjectEmbeddingsResultSchema = object({
|
|
21525
21882
|
started: boolean(),
|
|
21526
21883
|
/** True when a pass was already running; the new request is ignored. */
|
|
21527
|
-
alreadyRunning: boolean()
|
|
21884
|
+
alreadyRunning: boolean(),
|
|
21885
|
+
/** Present when the pass refused to start — see `RebuildObjectEmbeddingsRefusalSchema`. */
|
|
21886
|
+
refusal: RebuildObjectEmbeddingsRefusalSchema.optional(),
|
|
21887
|
+
/** The CLIP model the pass pinned, and the index it fills (when it started). */
|
|
21888
|
+
modelId: string().optional(),
|
|
21889
|
+
index: string().optional()
|
|
21528
21890
|
});
|
|
21529
21891
|
var RebuildStatusSchema = object({
|
|
21530
21892
|
running: boolean(),
|
|
21531
21893
|
scanned: number(),
|
|
21532
21894
|
rebuilt: number(),
|
|
21533
|
-
/** Tracks whose key frame is gone — nothing to re-embed from.
|
|
21895
|
+
/** Tracks whose key frame is gone — nothing to re-embed from. Pixels ONLY:
|
|
21896
|
+
* `missingEvent` is its own field since D664, never summed in. */
|
|
21534
21897
|
missingKeyFrame: number(),
|
|
21535
|
-
/** Tracks with no
|
|
21898
|
+
/** Tracks with no object event at all (D664). */
|
|
21899
|
+
missingEvent: number(),
|
|
21900
|
+
/** Tracks with no box measured on the pixels to cut — see `boxSource.refused`. */
|
|
21536
21901
|
missingBbox: number(),
|
|
21537
21902
|
/**
|
|
21903
|
+
* Which rule placed each judged track's box (D664): the key frame row's own
|
|
21904
|
+
* `subjectBox`, `track.positions` at exactly its instant (older key frames),
|
|
21905
|
+
* the event box (a key frame recovered from the recording, at the event's
|
|
21906
|
+
* instant), or `refused` by name — the reasons are in the tagged log lines.
|
|
21907
|
+
*/
|
|
21908
|
+
boxSource: object({
|
|
21909
|
+
subjectBox: number(),
|
|
21910
|
+
positions: number(),
|
|
21911
|
+
event: number(),
|
|
21912
|
+
refused: number()
|
|
21913
|
+
}),
|
|
21914
|
+
/** Tracks skipped because their vector is already in the pinned space. */
|
|
21915
|
+
alreadyInSpace: number(),
|
|
21916
|
+
/** Whether the current / last pass was a `force` pass; `null` before any (D664). */
|
|
21917
|
+
force: boolean().nullable(),
|
|
21918
|
+
/** In-space tracks a `force` pass selected for re-embedding. */
|
|
21919
|
+
forcedInSpace: number(),
|
|
21920
|
+
/**
|
|
21538
21921
|
* Tracks an executing node REFUSED rather than broke on — an unreadable key
|
|
21539
21922
|
* frame, a step that threw. Separate from `failed` because the remedy is
|
|
21540
21923
|
* different, and because a whole camera silently contributing zero vectors
|
|
@@ -21558,7 +21941,11 @@ var RebuildStatusSchema = object({
|
|
|
21558
21941
|
startedAtMs: number().nullable(),
|
|
21559
21942
|
finishedAtMs: number().nullable(),
|
|
21560
21943
|
/** Present when the pass ended by throwing. */
|
|
21561
|
-
error: string().nullable()
|
|
21944
|
+
error: string().nullable(),
|
|
21945
|
+
/** The CLIP model the current / last pass pinned (D54), `null` before any. */
|
|
21946
|
+
modelId: string().nullable(),
|
|
21947
|
+
/** The index that pass fills — `ClipModelMeta.vectorIndex` of `modelId` (D649). */
|
|
21948
|
+
index: string().nullable()
|
|
21562
21949
|
});
|
|
21563
21950
|
/**
|
|
21564
21951
|
* Acknowledgement that a debug-media reclaim STARTED.
|
|
@@ -21601,24 +21988,6 @@ var MediaReclaimStatusSchema = object({
|
|
|
21601
21988
|
finishedAtMs: number().nullable(),
|
|
21602
21989
|
error: string().nullable()
|
|
21603
21990
|
});
|
|
21604
|
-
var ReplayFrameInputSchema = object({
|
|
21605
|
-
timestamp: number(),
|
|
21606
|
-
frame: PipelineRunResultBridge
|
|
21607
|
-
});
|
|
21608
|
-
var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
|
|
21609
|
-
className: string(),
|
|
21610
|
-
firstSeenMs: number(),
|
|
21611
|
-
lastSeenMs: number(),
|
|
21612
|
-
/** Bbox of the track's FIRST matched detection, pixel-space in the clip's
|
|
21613
|
-
* frame — a representative box for the diff's `(className, window, IoU)`
|
|
21614
|
-
* pairing (`replay-diff.ts`). A replay does not need the full per-frame
|
|
21615
|
-
* trajectory production's `Track.positions` keeps. */
|
|
21616
|
-
bbox: BoundingBoxSchema,
|
|
21617
|
-
/** How many of the input frames this track matched a real detection on
|
|
21618
|
-
* (never a coasted/extrapolated frame) — the replay's own signal for "how
|
|
21619
|
-
* solid is this track", cheaper than re-deriving it from a trajectory. */
|
|
21620
|
-
framesMatched: number().int()
|
|
21621
|
-
})).readonly() });
|
|
21622
21991
|
/**
|
|
21623
21992
|
* The long-term series a camera produces. A closed union so a typo cannot
|
|
21624
21993
|
* invent one, and the ONE declaration of it — the addon's `AnalyticsLtsSeries`
|
|
@@ -21832,108 +22201,578 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
21832
22201
|
}), {
|
|
21833
22202
|
kind: "mutation",
|
|
21834
22203
|
auth: "admin"
|
|
21835
|
-
}), method(object({ frameId: string() }), object({
|
|
21836
|
-
base64: string(),
|
|
21837
|
-
width: number().int(),
|
|
21838
|
-
height: number().int()
|
|
22204
|
+
}), method(object({ frameId: string() }), object({
|
|
22205
|
+
base64: string(),
|
|
22206
|
+
width: number().int(),
|
|
22207
|
+
height: number().int()
|
|
22208
|
+
}), {
|
|
22209
|
+
kind: "query",
|
|
22210
|
+
auth: "admin"
|
|
22211
|
+
}), method(object({
|
|
22212
|
+
deviceId: number(),
|
|
22213
|
+
trackId: string(),
|
|
22214
|
+
frameId: string(),
|
|
22215
|
+
subject: RetrainAssistSubjectSchema,
|
|
22216
|
+
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
22217
|
+
nodeId: string().optional()
|
|
22218
|
+
}), RetrainAssistResultSchema, {
|
|
22219
|
+
kind: "mutation",
|
|
22220
|
+
auth: "admin"
|
|
22221
|
+
}), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
|
|
22222
|
+
kind: "query",
|
|
22223
|
+
auth: "admin"
|
|
22224
|
+
}), method(object({
|
|
22225
|
+
deviceId: number(),
|
|
22226
|
+
trackId: string(),
|
|
22227
|
+
frameId: string(),
|
|
22228
|
+
annotations: array(RetrainAnnotationDraftSchema)
|
|
22229
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
22230
|
+
kind: "mutation",
|
|
22231
|
+
auth: "admin"
|
|
22232
|
+
}), method(object({
|
|
22233
|
+
deviceId: number(),
|
|
22234
|
+
trackId: string()
|
|
22235
|
+
}), RetrainTransitionResultSchema, {
|
|
22236
|
+
kind: "mutation",
|
|
22237
|
+
auth: "admin"
|
|
22238
|
+
}), method(object({
|
|
22239
|
+
deviceId: number(),
|
|
22240
|
+
trackId: string()
|
|
22241
|
+
}), RetrainTransitionResultSchema, {
|
|
22242
|
+
kind: "mutation",
|
|
22243
|
+
auth: "admin"
|
|
22244
|
+
}), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
22245
|
+
kind: "query",
|
|
22246
|
+
auth: "admin"
|
|
22247
|
+
}), method(object({
|
|
22248
|
+
/** Which of the three event tables owns the row. */
|
|
22249
|
+
ownerType: EventOwnerTypeSchema,
|
|
22250
|
+
/** The event's rowid in that table (D474: an event id is a number). */
|
|
22251
|
+
eventId: number().int(),
|
|
22252
|
+
kind: MediaFileKindEnum.optional(),
|
|
22253
|
+
deviceId: number()
|
|
22254
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
22255
|
+
trackId: string(),
|
|
22256
|
+
kinds: array(MediaFileKindEnum).optional(),
|
|
22257
|
+
deviceId: number()
|
|
22258
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
22259
|
+
trackId: string(),
|
|
22260
|
+
deviceId: number()
|
|
22261
|
+
}), array(MediaFileInfoSchema).readonly()), method(object({
|
|
22262
|
+
ownerType: EventOwnerTypeSchema,
|
|
22263
|
+
eventId: number().int(),
|
|
22264
|
+
deviceId: number()
|
|
22265
|
+
}), array(MediaFileInfoSchema).readonly()), method(object({
|
|
22266
|
+
deviceId: number(),
|
|
22267
|
+
ownerKind: MediaPresenceOwnerKindSchema,
|
|
22268
|
+
ownerIds: array(string()).max(5e3)
|
|
22269
|
+
}), array(string()).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly(), { caller: "required" }), method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
22270
|
+
kind: "mutation",
|
|
22271
|
+
auth: "admin"
|
|
22272
|
+
}), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
|
|
22273
|
+
kind: "mutation",
|
|
22274
|
+
auth: "admin"
|
|
22275
|
+
}), method(object({}), RebuildStatusSchema), object({
|
|
22276
|
+
deviceId: number(),
|
|
22277
|
+
timestamp: number(),
|
|
22278
|
+
frameWidth: number(),
|
|
22279
|
+
frameHeight: number(),
|
|
22280
|
+
detections: array(OverlayDetectionSchema).readonly()
|
|
22281
|
+
}), object({
|
|
22282
|
+
deviceId: number(),
|
|
22283
|
+
trackId: string(),
|
|
22284
|
+
className: string()
|
|
22285
|
+
}), object({
|
|
22286
|
+
deviceId: number(),
|
|
22287
|
+
trackId: string(),
|
|
22288
|
+
className: string(),
|
|
22289
|
+
durationMs: number()
|
|
22290
|
+
}), object({
|
|
22291
|
+
deviceId: number(),
|
|
22292
|
+
kind: EventKindSchema,
|
|
22293
|
+
eventId: string(),
|
|
22294
|
+
timestamp: number()
|
|
22295
|
+
});
|
|
22296
|
+
/**
|
|
22297
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
22298
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
22299
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
22300
|
+
*/
|
|
22301
|
+
var NativeCropRefSchema = object({
|
|
22302
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
22303
|
+
handle: FrameHandleSchema,
|
|
22304
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
22305
|
+
cropFrameSpace: object({
|
|
22306
|
+
x: number(),
|
|
22307
|
+
y: number(),
|
|
22308
|
+
w: number(),
|
|
22309
|
+
h: number()
|
|
22310
|
+
})
|
|
22311
|
+
});
|
|
22312
|
+
object({
|
|
22313
|
+
crop: object({
|
|
22314
|
+
left: number(),
|
|
22315
|
+
top: number(),
|
|
22316
|
+
width: number().positive(),
|
|
22317
|
+
height: number().positive()
|
|
22318
|
+
}).optional(),
|
|
22319
|
+
content: object({
|
|
22320
|
+
width: number().int().positive(),
|
|
22321
|
+
height: number().int().positive()
|
|
22322
|
+
}),
|
|
22323
|
+
fit: _enum(["stretch", "contain"]),
|
|
22324
|
+
format: _enum([
|
|
22325
|
+
"rgb",
|
|
22326
|
+
"gray",
|
|
22327
|
+
"jpeg"
|
|
22328
|
+
])
|
|
22329
|
+
});
|
|
22330
|
+
/**
|
|
22331
|
+
* Process-local frame identity. It is serializable so it can ride an in-process
|
|
22332
|
+
* capability call, but `registryId` deliberately prevents resolution in any
|
|
22333
|
+
* other process or execution group.
|
|
22334
|
+
*/
|
|
22335
|
+
var FrameRefSchema = object({
|
|
22336
|
+
registryId: string().min(1),
|
|
22337
|
+
id: string().min(1),
|
|
22338
|
+
width: number().int().positive(),
|
|
22339
|
+
height: number().int().positive(),
|
|
22340
|
+
format: _enum(["rgb", "gray"]),
|
|
22341
|
+
timestamp: number(),
|
|
22342
|
+
capturedAt: number().optional()
|
|
22343
|
+
});
|
|
22344
|
+
var ModelFormatSchema$1 = _enum([
|
|
22345
|
+
"onnx",
|
|
22346
|
+
"coreml",
|
|
22347
|
+
"openvino",
|
|
22348
|
+
"tflite",
|
|
22349
|
+
"pt",
|
|
22350
|
+
"gguf"
|
|
22351
|
+
]);
|
|
22352
|
+
var PipelineSlotSchema = _enum([
|
|
22353
|
+
"detector",
|
|
22354
|
+
"cropper",
|
|
22355
|
+
"classifier",
|
|
22356
|
+
"refiner",
|
|
22357
|
+
"audio-classifier"
|
|
22358
|
+
]);
|
|
22359
|
+
var PipelineEngineChoiceSchema = object({
|
|
22360
|
+
runtime: literal("python"),
|
|
22361
|
+
backend: string(),
|
|
22362
|
+
format: ModelFormatSchema$1,
|
|
22363
|
+
device: string().optional()
|
|
22364
|
+
});
|
|
22365
|
+
/**
|
|
22366
|
+
* One pool's resolved provisioning (`getEffectiveTuning`). `numWorkers` is the
|
|
22367
|
+
* knob that lifts a saturated pool (`inference-devices.md`); `concurrency` is
|
|
22368
|
+
* per-worker in-flight requests. `deviceKey` echoes the pool asked about —
|
|
22369
|
+
* `null` for the node-default pool.
|
|
22370
|
+
*/
|
|
22371
|
+
var EffectiveTuningSchema = object({
|
|
22372
|
+
deviceKey: string().nullable(),
|
|
22373
|
+
runtime: string(),
|
|
22374
|
+
batchMode: string(),
|
|
22375
|
+
windowMs: number(),
|
|
22376
|
+
maxBatchSize: number(),
|
|
22377
|
+
concurrency: number(),
|
|
22378
|
+
numWorkers: number()
|
|
22379
|
+
});
|
|
22380
|
+
var AvailableEngineSchema = object({
|
|
22381
|
+
engine: PipelineEngineChoiceSchema,
|
|
22382
|
+
devices: array(object({
|
|
22383
|
+
id: string(),
|
|
22384
|
+
label: string(),
|
|
22385
|
+
description: string().optional()
|
|
22386
|
+
})).readonly(),
|
|
22387
|
+
defaultDevice: string()
|
|
22388
|
+
});
|
|
22389
|
+
var PipelineDefaultStepSchema = lazy(() => object({
|
|
22390
|
+
addonId: string(),
|
|
22391
|
+
addonName: string(),
|
|
22392
|
+
slot: PipelineSlotSchema,
|
|
22393
|
+
inputClasses: array(string()).readonly(),
|
|
22394
|
+
outputClasses: array(string()).readonly(),
|
|
22395
|
+
enabled: boolean(),
|
|
22396
|
+
modelId: string(),
|
|
22397
|
+
children: array(PipelineDefaultStepSchema).readonly(),
|
|
22398
|
+
group: string().optional(),
|
|
22399
|
+
settings: record(string(), unknown()).optional()
|
|
22400
|
+
}));
|
|
22401
|
+
var PipelineTemplateStepSchema = lazy(() => object({
|
|
22402
|
+
addonId: string(),
|
|
22403
|
+
enabled: boolean(),
|
|
22404
|
+
modelId: string(),
|
|
22405
|
+
children: array(PipelineTemplateStepSchema).readonly(),
|
|
22406
|
+
settings: record(string(), unknown()).optional()
|
|
22407
|
+
}));
|
|
22408
|
+
var PipelineTemplateSchema$1 = object({
|
|
22409
|
+
id: string(),
|
|
22410
|
+
name: string(),
|
|
22411
|
+
createdAt: string(),
|
|
22412
|
+
updatedAt: string(),
|
|
22413
|
+
engine: PipelineEngineChoiceSchema,
|
|
22414
|
+
steps: array(PipelineTemplateStepSchema).readonly()
|
|
22415
|
+
});
|
|
22416
|
+
var PipelineModelOptionSchema = object({
|
|
22417
|
+
id: string(),
|
|
22418
|
+
name: string(),
|
|
22419
|
+
formats: record(string(), object({
|
|
22420
|
+
downloaded: boolean(),
|
|
22421
|
+
sizeMB: number()
|
|
22422
|
+
})),
|
|
22423
|
+
group: ModelVariantGroupSchema.optional(),
|
|
22424
|
+
legacy: boolean().optional(),
|
|
22425
|
+
provider: ModelProviderIdSchema.optional(),
|
|
22426
|
+
defaultConfidence: number().optional()
|
|
22427
|
+
});
|
|
22428
|
+
var ConfigFieldBridge = custom();
|
|
22429
|
+
var PipelineAddonSchemaSchema = object({
|
|
22430
|
+
id: string(),
|
|
22431
|
+
name: string(),
|
|
22432
|
+
slot: PipelineSlotSchema,
|
|
22433
|
+
inputClasses: array(string()).readonly(),
|
|
22434
|
+
outputClasses: array(string()).readonly(),
|
|
22435
|
+
childSlots: array(PipelineSlotSchema).readonly(),
|
|
22436
|
+
models: array(PipelineModelOptionSchema).readonly(),
|
|
22437
|
+
defaultModelId: string(),
|
|
22438
|
+
defaultModelIdByFormat: record(string(), string()).optional(),
|
|
22439
|
+
enabledByDefault: boolean().optional(),
|
|
22440
|
+
backfillIntoExistingOverrides: boolean().optional(),
|
|
22441
|
+
defaultConfidence: number(),
|
|
22442
|
+
group: string().optional(),
|
|
22443
|
+
configSchema: array(ConfigFieldBridge).readonly().optional()
|
|
22444
|
+
});
|
|
22445
|
+
var PipelineSlotSchemaSchema = object({
|
|
22446
|
+
id: PipelineSlotSchema,
|
|
22447
|
+
label: string(),
|
|
22448
|
+
priority: number(),
|
|
22449
|
+
parentSlot: PipelineSlotSchema.nullable(),
|
|
22450
|
+
addons: array(PipelineAddonSchemaSchema).readonly()
|
|
22451
|
+
});
|
|
22452
|
+
var PipelineSchemaSchema = object({
|
|
22453
|
+
availableEngines: array(AvailableEngineSchema).readonly(),
|
|
22454
|
+
selectedEngine: PipelineEngineChoiceSchema,
|
|
22455
|
+
slots: array(PipelineSlotSchemaSchema).readonly()
|
|
22456
|
+
});
|
|
22457
|
+
var EngineProvisioningSchema = object({
|
|
22458
|
+
runtimeId: _enum([
|
|
22459
|
+
"onnx",
|
|
22460
|
+
"openvino",
|
|
22461
|
+
"coreml",
|
|
22462
|
+
"edgetpu"
|
|
22463
|
+
]).nullable(),
|
|
22464
|
+
device: string().nullable(),
|
|
22465
|
+
state: _enum([
|
|
22466
|
+
"idle",
|
|
22467
|
+
"installing",
|
|
22468
|
+
"verifying",
|
|
22469
|
+
"ready",
|
|
22470
|
+
"failed"
|
|
22471
|
+
]),
|
|
22472
|
+
progress: number().optional(),
|
|
22473
|
+
error: string().optional(),
|
|
22474
|
+
nextRetryAt: number().optional(),
|
|
22475
|
+
/**
|
|
22476
|
+
* Gate A (config-correctness gate at engine change): human-readable
|
|
22477
|
+
* config issues surfaced EAGERLY when the node's engine changes — model
|
|
22478
|
+
* substitutions ("chose X, running Y") and zero-build steps ("no model
|
|
22479
|
+
* has a <format> build"). Additive/optional: informational only, never
|
|
22480
|
+
* enforced here — `assertEngineReady` (readiness) still gates inference.
|
|
22481
|
+
* Absent/empty when the node-default tree resolves cleanly.
|
|
22482
|
+
*/
|
|
22483
|
+
configIssues: array(string()).optional()
|
|
22484
|
+
});
|
|
22485
|
+
var PipelineStepInputSchema = lazy(() => object({
|
|
22486
|
+
addonId: string(),
|
|
22487
|
+
modelId: string().optional(),
|
|
22488
|
+
enabled: boolean().default(true),
|
|
22489
|
+
children: array(PipelineStepInputSchema).optional(),
|
|
22490
|
+
settings: record(string(), unknown()).optional(),
|
|
22491
|
+
jumpDeviceKey: string().optional()
|
|
22492
|
+
}));
|
|
22493
|
+
var ModelSubstitutionSchema = object({
|
|
22494
|
+
addonId: string(),
|
|
22495
|
+
chosen: string(),
|
|
22496
|
+
running: string(),
|
|
22497
|
+
format: string()
|
|
22498
|
+
});
|
|
22499
|
+
var PipelineValidationIssueSchema = object({
|
|
22500
|
+
addonId: string(),
|
|
22501
|
+
kind: _enum([
|
|
22502
|
+
"unknown-addon",
|
|
22503
|
+
"no-format-build",
|
|
22504
|
+
"unknown-device"
|
|
22505
|
+
]),
|
|
22506
|
+
detail: string()
|
|
22507
|
+
});
|
|
22508
|
+
var PipelineValidationResultSchema = object({
|
|
22509
|
+
ok: boolean(),
|
|
22510
|
+
issues: array(PipelineValidationIssueSchema).readonly(),
|
|
22511
|
+
substitutions: array(ModelSubstitutionSchema).readonly(),
|
|
22512
|
+
/** The node's `currentEngine.format` this validation ran against. */
|
|
22513
|
+
format: string()
|
|
22514
|
+
});
|
|
22515
|
+
var ReferenceImageEntrySchema = object({
|
|
22516
|
+
filename: string(),
|
|
22517
|
+
stepIds: array(string()).readonly().optional()
|
|
22518
|
+
});
|
|
22519
|
+
var ReferenceImageBodySchema = object({
|
|
22520
|
+
base64: string(),
|
|
22521
|
+
filename: string()
|
|
22522
|
+
});
|
|
22523
|
+
var ReferenceAudioEntrySchema = object({
|
|
22524
|
+
filename: string(),
|
|
22525
|
+
sizeKb: number()
|
|
22526
|
+
});
|
|
22527
|
+
var ReferenceAudioBodySchema = object({ base64: string() });
|
|
22528
|
+
var AudioBackendSchema = object({
|
|
22529
|
+
id: string(),
|
|
22530
|
+
name: string(),
|
|
22531
|
+
description: string(),
|
|
22532
|
+
available: boolean(),
|
|
22533
|
+
/**
|
|
22534
|
+
* Raw classifier labels this backend can emit (e.g. YAMNet's
|
|
22535
|
+
* 521-class set or Apple SoundAnalysis's 303-class set). Used by
|
|
22536
|
+
* the benchmark UI to populate the `enabledMicroClasses` filter
|
|
22537
|
+
* specific to the selected backend without a separate fetch.
|
|
22538
|
+
*/
|
|
22539
|
+
rawLabels: array(string()).readonly().optional()
|
|
22540
|
+
});
|
|
22541
|
+
var AudioCapabilitiesSchema = object({
|
|
22542
|
+
activeBackend: string(),
|
|
22543
|
+
availableBackends: array(AudioBackendSchema).readonly(),
|
|
22544
|
+
sampleRate: number(),
|
|
22545
|
+
chunkDurationMs: number()
|
|
22546
|
+
});
|
|
22547
|
+
var DownloadModelResultSchema = object({
|
|
22548
|
+
filePath: string(),
|
|
22549
|
+
sizeMB: number(),
|
|
22550
|
+
durationMs: number()
|
|
22551
|
+
});
|
|
22552
|
+
/**
|
|
22553
|
+
* Wrapper carrying a single test run's result. Replaces the legacy
|
|
22554
|
+
* ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
|
|
22555
|
+
* canonical `AudioResult` from the Phase 6 output rework: one
|
|
22556
|
+
* `AudioDetection` per class above `minScore`, top-N candidates in
|
|
22557
|
+
* `debug.alternateLabels['audio-classifier']`, per-source timings in
|
|
22558
|
+
* `debug.stepTimings`. The outer `success`/`error` fields stay so the
|
|
22559
|
+
* benchmark UI can still report a clean failure when the classifier
|
|
22560
|
+
* cap isn't available.
|
|
22561
|
+
*/
|
|
22562
|
+
var AudioTestResultSchema = object({
|
|
22563
|
+
success: boolean(),
|
|
22564
|
+
error: string().optional(),
|
|
22565
|
+
frame: custom().optional()
|
|
22566
|
+
});
|
|
22567
|
+
var PipelineConfigBridge = custom();
|
|
22568
|
+
var ConfigUISchemaBridge = custom();
|
|
22569
|
+
var ConfigUISchemaNullableBridge = custom();
|
|
22570
|
+
var InferenceCapabilitiesBridge = custom();
|
|
22571
|
+
var ModelAvailabilityListBridge = custom();
|
|
22572
|
+
var PipelineRunResultBridge = custom();
|
|
22573
|
+
method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
|
|
22574
|
+
modelId: string(),
|
|
22575
|
+
settings: record(string(), unknown()).readonly()
|
|
22576
|
+
}))), method(object({ steps: record(string(), object({
|
|
22577
|
+
modelId: string(),
|
|
22578
|
+
settings: record(string(), unknown()).readonly()
|
|
22579
|
+
})) }), object({ success: literal(true) }), {
|
|
22580
|
+
kind: "mutation",
|
|
22581
|
+
auth: "admin"
|
|
22582
|
+
}), method(object({ nodeId: string() }), object({
|
|
22583
|
+
success: literal(true),
|
|
22584
|
+
clearedDevices: number()
|
|
21839
22585
|
}), {
|
|
21840
|
-
kind: "query",
|
|
21841
|
-
auth: "admin"
|
|
21842
|
-
}), method(object({
|
|
21843
|
-
deviceId: number(),
|
|
21844
|
-
trackId: string(),
|
|
21845
|
-
frameId: string(),
|
|
21846
|
-
subject: RetrainAssistSubjectSchema,
|
|
21847
|
-
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
21848
|
-
nodeId: string().optional()
|
|
21849
|
-
}), RetrainAssistResultSchema, {
|
|
21850
|
-
kind: "mutation",
|
|
21851
|
-
auth: "admin"
|
|
21852
|
-
}), method(object({
|
|
21853
|
-
deviceId: number(),
|
|
21854
|
-
source: DetectionSourceSchema,
|
|
21855
|
-
zones: array(ZoneSchema).readonly().optional(),
|
|
21856
|
-
detectionRules: array(ZoneRuleSchema).readonly().optional(),
|
|
21857
|
-
zoneMembershipMinOverlap: number().min(0).max(1).optional(),
|
|
21858
|
-
frames: array(ReplayFrameInputSchema).min(1)
|
|
21859
|
-
}), RunReplayFrameProcessorResultSchema, {
|
|
21860
|
-
kind: "mutation",
|
|
21861
|
-
auth: "admin"
|
|
21862
|
-
}), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
|
|
21863
|
-
kind: "query",
|
|
21864
|
-
auth: "admin"
|
|
21865
|
-
}), method(object({
|
|
21866
|
-
deviceId: number(),
|
|
21867
|
-
trackId: string(),
|
|
21868
|
-
frameId: string(),
|
|
21869
|
-
annotations: array(RetrainAnnotationDraftSchema)
|
|
21870
|
-
}), array(RetrainAnnotationSchema).readonly(), {
|
|
21871
22586
|
kind: "mutation",
|
|
21872
22587
|
auth: "admin"
|
|
21873
|
-
}), method(object({
|
|
21874
|
-
|
|
21875
|
-
|
|
21876
|
-
|
|
22588
|
+
}), method(object({ nodeId: string() }), object({ unhealthy: array(object({
|
|
22589
|
+
/** `<backend>:<device>`, e.g. `openvino:gpu`. */
|
|
22590
|
+
deviceKey: string(),
|
|
22591
|
+
/**
|
|
22592
|
+
* `failed` — the per-device restart budget is exhausted; no pool
|
|
22593
|
+
* will be spawned until an operator re-arms it or the runner
|
|
22594
|
+
* respawns. `backoff` — under budget, waiting out the backoff (or
|
|
22595
|
+
* a cached pool observed dead and not yet condemned).
|
|
22596
|
+
*/
|
|
22597
|
+
state: _enum(["failed", "backoff"]),
|
|
22598
|
+
/** Epoch ms of the death that produced this state. */
|
|
22599
|
+
since: number(),
|
|
22600
|
+
/** Pool deaths inside the current window. */
|
|
22601
|
+
deaths: number(),
|
|
22602
|
+
/** The last death's message. */
|
|
22603
|
+
lastError: string()
|
|
22604
|
+
})).readonly() })), method(object({
|
|
22605
|
+
nodeId: string(),
|
|
22606
|
+
deviceKey: string()
|
|
22607
|
+
}), object({ rearmed: boolean() }), {
|
|
21877
22608
|
kind: "mutation",
|
|
21878
22609
|
auth: "admin"
|
|
21879
|
-
}), method(object({
|
|
21880
|
-
|
|
21881
|
-
|
|
21882
|
-
}),
|
|
22610
|
+
}), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({
|
|
22611
|
+
steps: array(PipelineStepInputSchema),
|
|
22612
|
+
deviceKey: string().optional()
|
|
22613
|
+
}), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
|
|
22614
|
+
name: string(),
|
|
22615
|
+
steps: array(PipelineTemplateStepSchema).readonly(),
|
|
22616
|
+
engine: PipelineEngineChoiceSchema
|
|
22617
|
+
}), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
|
|
22618
|
+
id: string(),
|
|
22619
|
+
name: string().optional(),
|
|
22620
|
+
steps: array(PipelineTemplateStepSchema).readonly().optional()
|
|
22621
|
+
}), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
|
|
22622
|
+
addonId: string(),
|
|
22623
|
+
modelId: string(),
|
|
22624
|
+
format: ModelFormatSchema$1
|
|
22625
|
+
}), DownloadModelResultSchema, { kind: "mutation" }), method(object({
|
|
22626
|
+
addonId: string(),
|
|
22627
|
+
modelId: string(),
|
|
22628
|
+
format: ModelFormatSchema$1
|
|
22629
|
+
}), object({ success: literal(true) }), { kind: "mutation" }), method(object({
|
|
22630
|
+
steps: array(PipelineStepInputSchema).min(1),
|
|
22631
|
+
frame: FrameInputSchema.optional(),
|
|
22632
|
+
/**
|
|
22633
|
+
* Process-local lazy frame. Valid only when caller and provider resolve
|
|
22634
|
+
* in the same execution-group process; split/cross-node callers use
|
|
22635
|
+
* `frame`/`image` inline compatibility instead.
|
|
22636
|
+
*/
|
|
22637
|
+
frameRef: FrameRefSchema.optional(),
|
|
22638
|
+
/**
|
|
22639
|
+
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
22640
|
+
* the decoded pixels live in. One more member of the one-of
|
|
22641
|
+
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
22642
|
+
*/
|
|
22643
|
+
frameHandle: FrameHandleSchema.optional(),
|
|
22644
|
+
imageBase64: string().optional(),
|
|
22645
|
+
/**
|
|
22646
|
+
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
22647
|
+
* hops (hub → forked worker via Moleculer MsgPack) because it
|
|
22648
|
+
* skips the 33% base64 overhead + the per-call base64 decode on
|
|
22649
|
+
* the detection-pipeline worker. Callers can pass either; exactly
|
|
22650
|
+
* one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
|
|
22651
|
+
*/
|
|
22652
|
+
image: _instanceof(Uint8Array).optional(),
|
|
22653
|
+
referenceImage: string().optional(),
|
|
22654
|
+
deviceId: number().optional(),
|
|
22655
|
+
sessionId: string().optional(),
|
|
22656
|
+
/**
|
|
22657
|
+
* Execution plane. 'full' (default) runs the whole tree — benchmark,
|
|
22658
|
+
* reference-image, and detail-subtree calls. 'frame' is the live
|
|
22659
|
+
* per-frame dispatch: ONLY root-plane steps run; crop children
|
|
22660
|
+
* (inputClasses ≠ null) are skipped and served per-track via
|
|
22661
|
+
* pipelineRunner.runDetailSubtree (two-plane design).
|
|
22662
|
+
*/
|
|
22663
|
+
plane: _enum(["full", "frame"]).optional(),
|
|
22664
|
+
/**
|
|
22665
|
+
* Inference-device selector (Phase 2 multi-device). Format
|
|
22666
|
+
* `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
|
|
22667
|
+
* Omitted ⇒ the runner's default device (current single-engine
|
|
22668
|
+
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
22669
|
+
*/
|
|
22670
|
+
deviceKey: string().optional(),
|
|
22671
|
+
/**
|
|
22672
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
22673
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
22674
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
22675
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
22676
|
+
* resolution from that surface — the SAME quality path faces already
|
|
22677
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
22678
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
22679
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
22680
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
22681
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
22682
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
22683
|
+
* (today's behaviour on the fallback path).
|
|
22684
|
+
*/
|
|
22685
|
+
nativeCropRef: NativeCropRefSchema.optional(),
|
|
22686
|
+
/**
|
|
22687
|
+
* Offline REPLAY of stored media for `deviceId` (D56, D646): the
|
|
22688
|
+
* camera's zone gate and overrides apply as live, every executing
|
|
22689
|
+
* step runs EXACTLY the model it names on the `deviceKey` pool it
|
|
22690
|
+
* names or the call refuses (`model-not-servable` /
|
|
22691
|
+
* `device-not-servable`), and nothing reaches the camera's live
|
|
22692
|
+
* trace stream. Absent ⇒ unchanged behaviour.
|
|
22693
|
+
*/
|
|
22694
|
+
replay: literal(true).optional()
|
|
22695
|
+
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
22696
|
+
steps: array(PipelineStepInputSchema).min(1),
|
|
22697
|
+
frames: array(FrameInputSchema).min(1).max(255),
|
|
22698
|
+
deviceId: number().optional(),
|
|
22699
|
+
sessionId: string().optional(),
|
|
22700
|
+
/**
|
|
22701
|
+
* Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
|
|
22702
|
+
* the batch to the Python pool's bench preprocess cache
|
|
22703
|
+
* (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
|
|
22704
|
+
* preprocessed ONCE and every later inference is a pure-inference cache
|
|
22705
|
+
* hit — the sustained-throughput run measures inference, not
|
|
22706
|
+
* decode+preprocess+infer. Omitted/0 for live frames (all different →
|
|
22707
|
+
* full preprocess every call, correct). Fresh per sustained run;
|
|
22708
|
+
* released via `uncacheFrame`.
|
|
22709
|
+
*/
|
|
22710
|
+
frameId: number().int().nonnegative().optional(),
|
|
22711
|
+
/** Inference-device selector (Phase 2 multi-device); see runPipeline. */
|
|
22712
|
+
deviceKey: string().optional()
|
|
22713
|
+
}), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
|
|
22714
|
+
data: _instanceof(Uint8Array),
|
|
22715
|
+
width: number().int().positive(),
|
|
22716
|
+
height: number().int().positive(),
|
|
22717
|
+
format: _enum([
|
|
22718
|
+
"rgb",
|
|
22719
|
+
"bgr",
|
|
22720
|
+
"gray"
|
|
22721
|
+
])
|
|
22722
|
+
}), object({
|
|
22723
|
+
frameId: number(),
|
|
22724
|
+
width: number(),
|
|
22725
|
+
height: number()
|
|
22726
|
+
}), { kind: "mutation" }), method(object({
|
|
22727
|
+
stepId: string(),
|
|
22728
|
+
frameId: number().int(),
|
|
22729
|
+
/**
|
|
22730
|
+
* The model to time — REQUIRED (D658). Without it the pool answered the
|
|
22731
|
+
* step's ACTIVE variant (the first loaded after boot), so a benchmark
|
|
22732
|
+
* of model B silently timed model A. Callers pass the `rootModelId`
|
|
22733
|
+
* their warmup `runPipeline` reported: the model that actually ran.
|
|
22734
|
+
*/
|
|
22735
|
+
modelId: string().min(1)
|
|
22736
|
+
}), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(object({ deviceKey: string().optional() }), EffectiveTuningSchema), method(_void(), array(object({
|
|
22737
|
+
engineKey: string(),
|
|
22738
|
+
engine: PipelineEngineChoiceSchema,
|
|
22739
|
+
modelsLoaded: array(string()).readonly(),
|
|
22740
|
+
inUseByCameras: array(number()).readonly(),
|
|
22741
|
+
/**
|
|
22742
|
+
* Origin of this resident factory.
|
|
22743
|
+
* - `runtime` — main camera-serving engine (no idle TTL).
|
|
22744
|
+
* - `device-pool` — a concurrent per-device pool (Phase 2
|
|
22745
|
+
* multi-device, keyed by `deviceKey`) resolved
|
|
22746
|
+
* via `resolveDeviceFactory`. Runs alongside the
|
|
22747
|
+
* `runtime` engine on a DIFFERENT accelerator
|
|
22748
|
+
* (NPU / iGPU / Coral) — this is how the
|
|
22749
|
+
* Engines tab shows all pools running at once.
|
|
22750
|
+
*/
|
|
22751
|
+
kind: _enum(["runtime", "device-pool"]),
|
|
22752
|
+
/** Native pid of the underlying Python pool (null when no pool). */
|
|
22753
|
+
poolPid: number().nullable(),
|
|
22754
|
+
/** ms since this factory was last used (null when not warm-tracked). */
|
|
22755
|
+
idleMs: number().nullable(),
|
|
22756
|
+
/** Idle TTL after which the factory self-evicts (null when not applicable). */
|
|
22757
|
+
idleTtlMs: number().nullable()
|
|
22758
|
+
})).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
|
|
21883
22759
|
kind: "mutation",
|
|
21884
22760
|
auth: "admin"
|
|
21885
|
-
}), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
21886
|
-
kind: "query",
|
|
21887
|
-
auth: "admin"
|
|
21888
22761
|
}), method(object({
|
|
21889
|
-
|
|
21890
|
-
|
|
21891
|
-
|
|
21892
|
-
|
|
21893
|
-
|
|
21894
|
-
|
|
21895
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
21896
|
-
trackId: string(),
|
|
21897
|
-
kinds: array(MediaFileKindEnum).optional(),
|
|
21898
|
-
deviceId: number()
|
|
21899
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
21900
|
-
trackId: string(),
|
|
21901
|
-
deviceId: number()
|
|
21902
|
-
}), array(MediaFileInfoSchema).readonly()), method(object({
|
|
21903
|
-
ownerType: EventOwnerTypeSchema,
|
|
21904
|
-
eventId: number().int(),
|
|
21905
|
-
deviceId: number()
|
|
21906
|
-
}), array(MediaFileInfoSchema).readonly()), method(object({
|
|
21907
|
-
deviceId: number(),
|
|
21908
|
-
ownerKind: MediaPresenceOwnerKindSchema,
|
|
21909
|
-
ownerIds: array(string()).max(5e3)
|
|
21910
|
-
}), array(string()).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
21911
|
-
kind: "mutation",
|
|
21912
|
-
auth: "admin"
|
|
21913
|
-
}), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
|
|
22762
|
+
engine: PipelineEngineChoiceSchema,
|
|
22763
|
+
force: boolean().optional()
|
|
22764
|
+
}), object({
|
|
22765
|
+
success: boolean(),
|
|
22766
|
+
reason: string().optional()
|
|
22767
|
+
}), {
|
|
21914
22768
|
kind: "mutation",
|
|
21915
22769
|
auth: "admin"
|
|
21916
|
-
}), method(object({}),
|
|
21917
|
-
|
|
21918
|
-
|
|
21919
|
-
|
|
21920
|
-
|
|
21921
|
-
|
|
21922
|
-
}), object({
|
|
21923
|
-
deviceId: number(),
|
|
21924
|
-
trackId: string(),
|
|
21925
|
-
className: string()
|
|
21926
|
-
}), object({
|
|
21927
|
-
deviceId: number(),
|
|
21928
|
-
trackId: string(),
|
|
21929
|
-
className: string(),
|
|
21930
|
-
durationMs: number()
|
|
21931
|
-
}), object({
|
|
21932
|
-
deviceId: number(),
|
|
21933
|
-
kind: EventKindSchema,
|
|
21934
|
-
eventId: string(),
|
|
21935
|
-
timestamp: number()
|
|
21936
|
-
});
|
|
22770
|
+
}), method(_void(), array(ReferenceImageEntrySchema).readonly()), method(object({ filename: string() }), ReferenceImageBodySchema.nullable()), method(_void(), array(ReferenceAudioEntrySchema).readonly()), method(object({ filename: string() }), ReferenceAudioBodySchema.nullable()), method(_void(), AudioCapabilitiesSchema), method(object({
|
|
22771
|
+
addonId: string(),
|
|
22772
|
+
modelId: string(),
|
|
22773
|
+
filename: string().optional(),
|
|
22774
|
+
settings: record(string(), unknown()).optional()
|
|
22775
|
+
}), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
|
|
21937
22776
|
object({
|
|
21938
22777
|
activeCameras: number(),
|
|
21939
22778
|
throttledCameras: number(),
|
|
@@ -21959,6 +22798,106 @@ var CameraMetricsSchema = object({
|
|
|
21959
22798
|
});
|
|
21960
22799
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
21961
22800
|
/**
|
|
22801
|
+
* Zone — pure geometry + identity. NO filtering behaviour.
|
|
22802
|
+
*
|
|
22803
|
+
* Zones describe **where** in the frame the operator wants to flag
|
|
22804
|
+
* something; consumer-owned {@link ZoneRule} arrays describe **how**
|
|
22805
|
+
* each pipeline stage uses them. Splitting the two means a single
|
|
22806
|
+
* polygon "Driveway" can simultaneously back a motion-exclude rule,
|
|
22807
|
+
* a detection-include rule on `['car']`, and an occupancy aggregate
|
|
22808
|
+
* — without three duplicated polygons.
|
|
22809
|
+
*
|
|
22810
|
+
* Owned by the orchestrator addon (provider) and mirrored into the
|
|
22811
|
+
* `zones` device-state slice on every mutation. Consumers
|
|
22812
|
+
* (motion-wasm, pipeline-executor, analytics, admin UI) read either
|
|
22813
|
+
* via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
|
|
22814
|
+
* mirror with `onChanged`).
|
|
22815
|
+
*
|
|
22816
|
+
* Coordinates are normalised fractions of the frame (0–1) so zones
|
|
22817
|
+
* survive resolution changes and stream profile switches.
|
|
22818
|
+
*
|
|
22819
|
+
* `kind` discriminates between full polygons (closed regions used
|
|
22820
|
+
* for intrusion / occupancy filters) and tripwires (open 2-point
|
|
22821
|
+
* line segments used for cross events). Onboard / firmware-reported
|
|
22822
|
+
* zones (Reolink, ONVIF) are out of scope for now — see the deferred
|
|
22823
|
+
* task list.
|
|
22824
|
+
*/
|
|
22825
|
+
var ZoneKindEnum = _enum(["polygon", "tripwire"]);
|
|
22826
|
+
/** Polygon vertex in fraction-of-frame coordinates (0–1). */
|
|
22827
|
+
var PolygonPointSchema = object({
|
|
22828
|
+
x: number(),
|
|
22829
|
+
y: number()
|
|
22830
|
+
});
|
|
22831
|
+
/** A camera detection zone — pure geometry/identity. */
|
|
22832
|
+
var ZoneSchema = object({
|
|
22833
|
+
id: string(),
|
|
22834
|
+
name: string(),
|
|
22835
|
+
kind: ZoneKindEnum.default("polygon"),
|
|
22836
|
+
/** Polygon vertices, fraction of frame (0–1). */
|
|
22837
|
+
polygon: array(PolygonPointSchema).readonly(),
|
|
22838
|
+
/** Visual color for UI rendering. */
|
|
22839
|
+
color: string().default("#3b82f6")
|
|
22840
|
+
});
|
|
22841
|
+
/**
|
|
22842
|
+
* Zones capability — per-camera CRUD over polygon detection zones.
|
|
22843
|
+
*
|
|
22844
|
+
* Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
|
|
22845
|
+
* to per-device settings and mirrors into the `zones` device-state
|
|
22846
|
+
* slice on every mutation, so downstream consumers can subscribe via
|
|
22847
|
+
* `dev.state.zones.onChanged`.
|
|
22848
|
+
*
|
|
22849
|
+
* The cap surface only handles geometry + identity; filtering
|
|
22850
|
+
* behaviour (per-class, include/exclude, threshold) lives in the
|
|
22851
|
+
* consumer addons' rule arrays — see `ZoneRuleSchema` exported from
|
|
22852
|
+
* `capabilities/schemas/zone-rule.js`.
|
|
22853
|
+
*/
|
|
22854
|
+
var zonesCapability = {
|
|
22855
|
+
name: "zones",
|
|
22856
|
+
scope: "device",
|
|
22857
|
+
mode: "singleton",
|
|
22858
|
+
deviceTypes: [DeviceType.Camera],
|
|
22859
|
+
methods: {
|
|
22860
|
+
listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
|
|
22861
|
+
addZone: method(object({
|
|
22862
|
+
deviceId: number(),
|
|
22863
|
+
zone: ZoneSchema
|
|
22864
|
+
}), _void(), {
|
|
22865
|
+
kind: "mutation",
|
|
22866
|
+
auth: "admin"
|
|
22867
|
+
}),
|
|
22868
|
+
removeZone: method(object({
|
|
22869
|
+
deviceId: number(),
|
|
22870
|
+
zoneId: string()
|
|
22871
|
+
}), _void(), {
|
|
22872
|
+
kind: "mutation",
|
|
22873
|
+
auth: "admin"
|
|
22874
|
+
}),
|
|
22875
|
+
updateZone: method(object({
|
|
22876
|
+
deviceId: number(),
|
|
22877
|
+
zone: ZoneSchema
|
|
22878
|
+
}), _void(), {
|
|
22879
|
+
kind: "mutation",
|
|
22880
|
+
auth: "admin"
|
|
22881
|
+
})
|
|
22882
|
+
},
|
|
22883
|
+
/**
|
|
22884
|
+
* Runtime-state slice — the live zone catalogue mirrored by the
|
|
22885
|
+
* orchestrator on every CRUD mutation. Consumers read via
|
|
22886
|
+
* `device.state.zones.value` / `.watch(...)` without round-tripping
|
|
22887
|
+
* the cap, and the codegen DeviceProxy auto-wires the reactive
|
|
22888
|
+
* handle. Slice shape is `{ zones: Zone[] }` so future extensions
|
|
22889
|
+
* (e.g. zone groupings) can sit alongside the polygon list.
|
|
22890
|
+
*/
|
|
22891
|
+
runtimeState: object({ zones: array(ZoneSchema).readonly() }),
|
|
22892
|
+
/**
|
|
22893
|
+
* Runtime-state durability: **restored** — written only on operator mutation, so a camera that never had one has nothing to re-derive from. This is the slice `zone-mirror-hydration.ts` exists to paper over.
|
|
22894
|
+
*
|
|
22895
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
22896
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
22897
|
+
*/
|
|
22898
|
+
durability: "restored"
|
|
22899
|
+
};
|
|
22900
|
+
/**
|
|
21962
22901
|
* A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
|
|
21963
22902
|
* decode worker resolves it against the RETAINED native frame's real pixel dims,
|
|
21964
22903
|
* so the caller supplies only the detection-res bbox divided by the detection
|
|
@@ -22145,7 +23084,17 @@ var DetailResultSchema = object({
|
|
|
22145
23084
|
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
22146
23085
|
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
22147
23086
|
* consumers MUST prefer this when present (2026-07-22 native-gate fix). */
|
|
22148
|
-
nativeFaceShortSidePx: number().optional()
|
|
23087
|
+
nativeFaceShortSidePx: number().optional(),
|
|
23088
|
+
/**
|
|
23089
|
+
* The five facial landmarks of a `face` detail, in the SAME frame space as
|
|
23090
|
+
* `bbox` (D644). Additive and optional: post-analysis stores them beside the
|
|
23091
|
+
* face's source frame so a future alignment can be re-derived exactly; a
|
|
23092
|
+
* runner that predates the field sends none and the face is stored without.
|
|
23093
|
+
*/
|
|
23094
|
+
landmarks: array(object({
|
|
23095
|
+
x: number(),
|
|
23096
|
+
y: number()
|
|
23097
|
+
})).optional()
|
|
22149
23098
|
});
|
|
22150
23099
|
/**
|
|
22151
23100
|
* Why an executing node REFUSED a stateless step run (`runStatelessStep`).
|
|
@@ -22400,6 +23349,17 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
|
|
|
22400
23349
|
hubHostnameOverride: string().optional()
|
|
22401
23350
|
})]).describe("Per-camera frame-source mode for the runner (P2c)");
|
|
22402
23351
|
/**
|
|
23352
|
+
* What ONE step runs with on ONE roster device for THIS camera (D650): the
|
|
23353
|
+
* device's per-(node,device) base with the camera's override for that device
|
|
23354
|
+
* on top — the same `override ?? base` merge the orchestrator applies to the
|
|
23355
|
+
* elected device (`applyDeviceProvisioning`). Absent `modelId` ⇒ the executor
|
|
23356
|
+
* resolves the device format's default, exactly as on the elected device.
|
|
23357
|
+
*/
|
|
23358
|
+
var RunnerJumpStepProvisioningSchema = object({
|
|
23359
|
+
modelId: string().optional(),
|
|
23360
|
+
settings: record(string(), unknown()).optional()
|
|
23361
|
+
});
|
|
23362
|
+
/**
|
|
22403
23363
|
* One ENABLED inference device on the runner's node, as the step-tree
|
|
22404
23364
|
* device-jump resolver sees it (phase 1). The orchestrator populates this
|
|
22405
23365
|
* roster on the attach payload whenever the camera is elected onto a specific
|
|
@@ -22411,7 +23371,16 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
|
|
|
22411
23371
|
var RunnerInferenceDeviceSchema = object({
|
|
22412
23372
|
deviceKey: string(),
|
|
22413
23373
|
weight: number().positive().default(1),
|
|
22414
|
-
maxSessions: number().int().positive().nullable().default(null)
|
|
23374
|
+
maxSessions: number().int().positive().nullable().default(null),
|
|
23375
|
+
/**
|
|
23376
|
+
* Per-step provisioning for this camera on THIS device (D650), keyed by step
|
|
23377
|
+
* id. A step the runner jumps here runs with these fields, never with the
|
|
23378
|
+
* elected device's: `modelId` / `settings` are REPLACED on the jumped subtree
|
|
23379
|
+
* (a step absent from the map runs with neither — the target format default).
|
|
23380
|
+
* Absent field ⇒ an orchestrator that predates D650: the jumped step keeps
|
|
23381
|
+
* the elected device's provisioning, as before.
|
|
23382
|
+
*/
|
|
23383
|
+
steps: record(string(), RunnerJumpStepProvisioningSchema).optional()
|
|
22415
23384
|
});
|
|
22416
23385
|
/**
|
|
22417
23386
|
* Camera assignment payload sent by `addon-pipeline-orchestrator` to a
|
|
@@ -23286,6 +24255,28 @@ var NodeInferenceDeviceSchema = object({
|
|
|
23286
24255
|
*/
|
|
23287
24256
|
exclusion: InferenceDeviceExclusionReasonSchema.nullable()
|
|
23288
24257
|
});
|
|
24258
|
+
/**
|
|
24259
|
+
* The operator's model choice for one cluster-scoped step, answered by the
|
|
24260
|
+
* addon that OWNS the `clusterModel:*` settings (D651). Three answers, never
|
|
24261
|
+
* folded: a written choice, a key nobody wrote (the cluster runs the default
|
|
24262
|
+
* BY ABSENCE), or no answer. A caller that rewrites an index acts only on the
|
|
24263
|
+
* first two, read twice and agreeing.
|
|
24264
|
+
*/
|
|
24265
|
+
var ClusterModelChoiceSchema = discriminatedUnion("kind", [
|
|
24266
|
+
object({
|
|
24267
|
+
kind: literal("stored"),
|
|
24268
|
+
modelId: string()
|
|
24269
|
+
}),
|
|
24270
|
+
object({
|
|
24271
|
+
kind: literal("absent"),
|
|
24272
|
+
defaultModelId: string()
|
|
24273
|
+
}),
|
|
24274
|
+
object({
|
|
24275
|
+
kind: literal("unreadable"),
|
|
24276
|
+
reason: _enum(CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS),
|
|
24277
|
+
error: string().optional()
|
|
24278
|
+
})
|
|
24279
|
+
]);
|
|
23289
24280
|
var NodeInferenceDevicesSchema = object({
|
|
23290
24281
|
nodeId: string(),
|
|
23291
24282
|
/** False when the node's platform-probe was unreachable (no live device set). */
|
|
@@ -23313,10 +24304,17 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
|
|
|
23313
24304
|
}), object({ success: literal(true) }), {
|
|
23314
24305
|
kind: "mutation",
|
|
23315
24306
|
auth: "admin"
|
|
23316
|
-
}), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({
|
|
24307
|
+
}), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({
|
|
24308
|
+
migrated: number(),
|
|
24309
|
+
skipped: array(object({
|
|
24310
|
+
deviceId: number(),
|
|
24311
|
+
targetNodeId: string(),
|
|
24312
|
+
reason: string()
|
|
24313
|
+
})).default([])
|
|
24314
|
+
}), {
|
|
23317
24315
|
kind: "mutation",
|
|
23318
24316
|
auth: "admin"
|
|
23319
|
-
}), method(_void(), array(PipelineAssignmentSchema).readonly()), method(object({ deviceId: number() }), PipelineAssignmentSchema.nullable()), method(_void(), array(AgentLoadSummarySchema).readonly()), method(_void(), GlobalMetricsSchema), method(object({ deviceId: number() }), CameraMetricsSchema.nullable()), method(object({ nodeId: string() }), CapabilityBindingsSchema), method(object({
|
|
24317
|
+
}), method(_void(), array(PipelineAssignmentSchema).readonly()), method(object({ deviceId: number() }), PipelineAssignmentSchema.nullable()), method(_void(), array(AgentLoadSummarySchema).readonly()), method(object({ stepId: string() }), ClusterModelChoiceSchema), method(_void(), GlobalMetricsSchema), method(object({ deviceId: number() }), CameraMetricsSchema.nullable()), method(object({ nodeId: string() }), CapabilityBindingsSchema), method(object({
|
|
23320
24318
|
nodeId: string(),
|
|
23321
24319
|
capName: string(),
|
|
23322
24320
|
addonId: string()
|
|
@@ -23531,7 +24529,11 @@ function buildDescriptor(capName, kind) {
|
|
|
23531
24529
|
icon: legacyIcon(t.iconId)
|
|
23532
24530
|
};
|
|
23533
24531
|
}
|
|
23534
|
-
|
|
24532
|
+
/**
|
|
24533
|
+
* Sensor / control cap name → static event-kind descriptor. A linked device
|
|
24534
|
+
* contributes one entry per bound cap present in this map.
|
|
24535
|
+
*/
|
|
24536
|
+
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
23535
24537
|
/**
|
|
23536
24538
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
23537
24539
|
* package lifecycle (runtime-updatable node packages).
|
|
@@ -26154,6 +27156,254 @@ var CLIP_PLAYBACK_OPTIONS = {
|
|
|
26154
27156
|
}
|
|
26155
27157
|
};
|
|
26156
27158
|
/**
|
|
27159
|
+
* LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
|
|
27160
|
+
* valutatore puro del suo FRONTE.
|
|
27161
|
+
*
|
|
27162
|
+
* Viveva dentro il builtin virtual-doorbell
|
|
27163
|
+
* (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
|
|
27164
|
+
* predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
|
|
27165
|
+
* `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
|
|
27166
|
+
* tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
|
|
27167
|
+
* fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
|
|
27168
|
+
* SPOSTA qui e il doorbell la ri-esporta.
|
|
27169
|
+
*
|
|
27170
|
+
* ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
|
|
27171
|
+
* due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
|
|
27172
|
+
* regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
|
|
27173
|
+
* booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
|
|
27174
|
+
*/
|
|
27175
|
+
/**
|
|
27176
|
+
* Known binary / switch source caps → the boolean slice field whose
|
|
27177
|
+
* false→true rise counts as ACTIVE. Every entry is "fire on active".
|
|
27178
|
+
* Sensors whose "active" reading is not a plain boolean (presence's string
|
|
27179
|
+
* state, connectivity's connected flag) are deliberately excluded — a
|
|
27180
|
+
* reconnect is not a doorbell press, and it is not a recording either.
|
|
27181
|
+
*/
|
|
27182
|
+
var SOURCE_CAP_ACTIVE_FIELD = {
|
|
27183
|
+
contact: "entryOpen",
|
|
27184
|
+
binary: "on",
|
|
27185
|
+
switch: "on",
|
|
27186
|
+
motion: "detected",
|
|
27187
|
+
flood: "flooded",
|
|
27188
|
+
gas: "detected",
|
|
27189
|
+
smoke: "detected",
|
|
27190
|
+
"carbon-monoxide": "detected",
|
|
27191
|
+
vibration: "detected",
|
|
27192
|
+
tamper: "tampered"
|
|
27193
|
+
};
|
|
27194
|
+
/** Cap names whose presence in a device's bindings qualify it as a source. */
|
|
27195
|
+
var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
|
|
27196
|
+
/**
|
|
27197
|
+
* Doorbell button cap. Two kinds of providers coexist behind this cap
|
|
27198
|
+
* name (same pattern as `snapshot`):
|
|
27199
|
+
*
|
|
27200
|
+
* - **Native** providers: registered per-device by device-driver
|
|
27201
|
+
* addons via `ctx.registerNativeCap` — either on a
|
|
27202
|
+
* `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
|
|
27203
|
+
* or directly on the camera (Reolink registers at camera level).
|
|
27204
|
+
* Emits an `onPressed` event every time the firmware pushes a
|
|
27205
|
+
* ring; status tracks the last press and a pressCount since start
|
|
27206
|
+
* (diagnostic).
|
|
27207
|
+
*
|
|
27208
|
+
* - **Wrapper** provider: the `virtual-doorbell` system builtin
|
|
27209
|
+
* (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
|
|
27210
|
+
* device (contact / switch / event-emitter …) into a doorbell for
|
|
27211
|
+
* a camera. `defaultActive: false` — the operator explicitly binds
|
|
27212
|
+
* it per camera in the device-bindings UI, then picks the source
|
|
27213
|
+
* device + trigger in the per-device settings.
|
|
27214
|
+
*
|
|
27215
|
+
* The DeviceEventPropagator re-emits `onPressed` on the camera parent
|
|
27216
|
+
* — subscribers listening at the camera level receive ring events
|
|
27217
|
+
* with `via[]` populated. No code on the parent needed.
|
|
27218
|
+
*/
|
|
27219
|
+
var DoorbellStatusSchema = object({
|
|
27220
|
+
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
27221
|
+
lastPressedAt: number().nullable(),
|
|
27222
|
+
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
27223
|
+
pressCountSinceStart: number()
|
|
27224
|
+
});
|
|
27225
|
+
var DoorbellPressEventSchema = object({
|
|
27226
|
+
deviceId: number(),
|
|
27227
|
+
timestamp: number()
|
|
27228
|
+
});
|
|
27229
|
+
/**
|
|
27230
|
+
* The `doorbell-source` extension slot's editable value (D648): the camera's
|
|
27231
|
+
* virtual-doorbell trigger devices, exactly what the wrapper's
|
|
27232
|
+
* `doorbellSources` persists (as `{ deviceId }` records).
|
|
27233
|
+
*/
|
|
27234
|
+
var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
|
|
27235
|
+
/**
|
|
27236
|
+
* The `doorbell-source` slot — which devices ring this camera's VIRTUAL
|
|
27237
|
+
* doorbell, owned by the `virtual-doorbell` wrapper over its
|
|
27238
|
+
* `doorbellSources` store (D648). A source rings when one of its
|
|
27239
|
+
* `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
|
|
27240
|
+
* different authority (`deviceManager.setWrapperActive`, D62) — the slot
|
|
27241
|
+
* reports it, it never writes it.
|
|
27242
|
+
*/
|
|
27243
|
+
var DOORBELL_SOURCE_SLOT = {
|
|
27244
|
+
id: "doorbell-source",
|
|
27245
|
+
label: "Doorbell trigger devices",
|
|
27246
|
+
description: "Any of these becoming active rings this camera's virtual doorbell: a binary sensor when it goes active, a switch when it turns on.",
|
|
27247
|
+
shape: "association",
|
|
27248
|
+
hostDeviceTypes: [DeviceType.Camera],
|
|
27249
|
+
sourceCaps: SOURCE_CAPS,
|
|
27250
|
+
cardinality: "many",
|
|
27251
|
+
value: DoorbellSourceSlotValueSchema
|
|
27252
|
+
};
|
|
27253
|
+
var doorbellCapability = {
|
|
27254
|
+
name: "doorbell",
|
|
27255
|
+
scope: "device",
|
|
27256
|
+
deviceNative: true,
|
|
27257
|
+
mode: "singleton",
|
|
27258
|
+
kind: "wrapper",
|
|
27259
|
+
defaultActive: false,
|
|
27260
|
+
deviceTypes: [DeviceType.Button, DeviceType.Camera],
|
|
27261
|
+
extensionSlots: [DOORBELL_SOURCE_SLOT],
|
|
27262
|
+
methods: {},
|
|
27263
|
+
events: {
|
|
27264
|
+
/**
|
|
27265
|
+
* Fires once per physical press. Reolink delivers via Baichuan
|
|
27266
|
+
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
27267
|
+
* release/duration — it's a pulse.
|
|
27268
|
+
*/
|
|
27269
|
+
onPressed: { data: DoorbellPressEventSchema } },
|
|
27270
|
+
status: {
|
|
27271
|
+
schema: DoorbellStatusSchema,
|
|
27272
|
+
kind: "push"
|
|
27273
|
+
},
|
|
27274
|
+
/**
|
|
27275
|
+
* Runtime-state slice — last press timestamp + lifetime press count.
|
|
27276
|
+
* Mirrored by the kernel and readable via
|
|
27277
|
+
* `device.state.doorbell.value`. UIs can show "last ring 5m ago"
|
|
27278
|
+
* without subscribing.
|
|
27279
|
+
*/
|
|
27280
|
+
runtimeState: DoorbellStatusSchema,
|
|
27281
|
+
/**
|
|
27282
|
+
* Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
|
|
27283
|
+
*
|
|
27284
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
27285
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
27286
|
+
*/
|
|
27287
|
+
durability: "restored"
|
|
27288
|
+
};
|
|
27289
|
+
var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
|
|
27290
|
+
DeviceType.Camera, DeviceType.Camera;
|
|
27291
|
+
/** A slot's editable value, discriminated on `slot`. */
|
|
27292
|
+
var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
|
|
27293
|
+
DeviceType.Camera;
|
|
27294
|
+
var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
|
|
27295
|
+
state: literal("unreachable"),
|
|
27296
|
+
reason: string()
|
|
27297
|
+
})]);
|
|
27298
|
+
/** One provider of slots — the D554 source-listing row. */
|
|
27299
|
+
var ExtensionSourceSchema = object({
|
|
27300
|
+
/** The routing prefix of every `slotRef` this provider serves. */
|
|
27301
|
+
source: string(),
|
|
27302
|
+
label: string(),
|
|
27303
|
+
/** Stamped by the dispatcher from the registry (D557). */
|
|
27304
|
+
addonId: string().optional(),
|
|
27305
|
+
availability: ExtensionSourceAvailabilitySchema
|
|
27306
|
+
});
|
|
27307
|
+
/**
|
|
27308
|
+
* How one picked source stands. `missing` — no such device (deleted, or an id
|
|
27309
|
+
* that never existed); `foreign` — a device the slot's owner cannot read from
|
|
27310
|
+
* (slice 2's cross-owner graft source); `unavailable` — it exists but is not a
|
|
27311
|
+
* valid source now (a container, which is never a pick). A source in any of
|
|
27312
|
+
* these states is SHOWN, never silently dropped or re-pointed.
|
|
27313
|
+
*/
|
|
27314
|
+
var ExtensionSourceHealthSchema = _enum([
|
|
27315
|
+
"ok",
|
|
27316
|
+
"missing",
|
|
27317
|
+
"foreign",
|
|
27318
|
+
"unavailable"
|
|
27319
|
+
]);
|
|
27320
|
+
var ExtensionSlotSourceSchema = object({
|
|
27321
|
+
deviceId: number().int(),
|
|
27322
|
+
/** The device's name, or null when it could not be resolved (`missing`). */
|
|
27323
|
+
name: string().nullable(),
|
|
27324
|
+
health: ExtensionSourceHealthSchema,
|
|
27325
|
+
detail: string().optional()
|
|
27326
|
+
});
|
|
27327
|
+
/**
|
|
27328
|
+
* A DIFFERENT authority that gates whether the slot's sources do anything —
|
|
27329
|
+
* reported read-only, named, never written through this contract (D62). The
|
|
27330
|
+
* virtual doorbell's sources ring only while the wrapper is bound to the
|
|
27331
|
+
* camera, and that binding belongs to `deviceManager.setWrapperActive`.
|
|
27332
|
+
* `unknown` means the gate could not be read; it is not "inactive" (D315).
|
|
27333
|
+
*/
|
|
27334
|
+
var ExtensionSlotActivationSchema = object({
|
|
27335
|
+
state: _enum([
|
|
27336
|
+
"active",
|
|
27337
|
+
"inactive",
|
|
27338
|
+
"unknown"
|
|
27339
|
+
]),
|
|
27340
|
+
authority: string(),
|
|
27341
|
+
detail: string().optional()
|
|
27342
|
+
});
|
|
27343
|
+
var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
|
|
27344
|
+
state: literal("ok"),
|
|
27345
|
+
/** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
|
|
27346
|
+
slotRef: string(),
|
|
27347
|
+
slot: ExtensionSlotIdSchema,
|
|
27348
|
+
/** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
|
|
27349
|
+
authority: string(),
|
|
27350
|
+
/** graft: its switch. association: null — removing every source is "off". */
|
|
27351
|
+
enabled: boolean().nullable(),
|
|
27352
|
+
/** graft: the cap registered on the host. association: null. */
|
|
27353
|
+
projects: string().nullable(),
|
|
27354
|
+
activation: ExtensionSlotActivationSchema.nullable(),
|
|
27355
|
+
value: ExtensionSlotValueSchema,
|
|
27356
|
+
sources: array(ExtensionSlotSourceSchema),
|
|
27357
|
+
/**
|
|
27358
|
+
* Devices the owner links to the host ON ITS OWN, by structure, and that
|
|
27359
|
+
* are therefore not in `value` (D655): a camera's device-tree children, and
|
|
27360
|
+
* the child a picked container stands for (D356 — a container is never a
|
|
27361
|
+
* pick, its children are). Read-only; the editor shows them and may offer
|
|
27362
|
+
* per-device options on them (the linked-devices tracked-event opt-in).
|
|
27363
|
+
* Absent when the owner links nothing beyond the picks, and from an owner
|
|
27364
|
+
* older than D655.
|
|
27365
|
+
*/
|
|
27366
|
+
impliedSources: array(ExtensionSlotSourceSchema).optional()
|
|
27367
|
+
}), object({
|
|
27368
|
+
state: literal("unreachable"),
|
|
27369
|
+
addonId: string(),
|
|
27370
|
+
reason: string()
|
|
27371
|
+
})]);
|
|
27372
|
+
var ExtensionCandidatesSchema = object({ candidates: array(object({
|
|
27373
|
+
deviceId: number().int(),
|
|
27374
|
+
name: string(),
|
|
27375
|
+
type: string(),
|
|
27376
|
+
location: string().nullable(),
|
|
27377
|
+
/** The container a child belongs to — "Spotlight 2" alone does not say which. */
|
|
27378
|
+
parentName: string().nullable(),
|
|
27379
|
+
/** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
|
|
27380
|
+
suggested: boolean(),
|
|
27381
|
+
/** Why it is suggested ("same location"), null when it is not. */
|
|
27382
|
+
reason: string().nullable()
|
|
27383
|
+
})) });
|
|
27384
|
+
/**
|
|
27385
|
+
* What a write did. `none` — applied in place. `host` / `parent` — the owner
|
|
27386
|
+
* reloaded the host (or, for an accessory child, its parent) because the
|
|
27387
|
+
* write changed what the host REGISTERS (a graft switched on or off, slice 2).
|
|
27388
|
+
*/
|
|
27389
|
+
var ExtensionSetResultSchema = object({
|
|
27390
|
+
applied: literal(true),
|
|
27391
|
+
reload: _enum([
|
|
27392
|
+
"none",
|
|
27393
|
+
"host",
|
|
27394
|
+
"parent"
|
|
27395
|
+
])
|
|
27396
|
+
});
|
|
27397
|
+
var ExtensionSlotRefInputSchema = object({
|
|
27398
|
+
deviceId: number().int(),
|
|
27399
|
+
slotRef: string().min(1)
|
|
27400
|
+
});
|
|
27401
|
+
var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
|
|
27402
|
+
method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
|
|
27403
|
+
kind: "mutation",
|
|
27404
|
+
auth: "admin"
|
|
27405
|
+
});
|
|
27406
|
+
/**
|
|
26157
27407
|
* Optional client-side hints sent at session creation to help the provider
|
|
26158
27408
|
* pick the best native source. All fields optional — a viewer that knows
|
|
26159
27409
|
* nothing still gets a sane default. (Relocated from the retired `webrtc`
|
|
@@ -28179,12 +29429,20 @@ reset: method(object({
|
|
|
28179
29429
|
},
|
|
28180
29430
|
runtimeState: ConsumablesStatusSchema.extend({ lastFetchedAt: number() }),
|
|
28181
29431
|
/**
|
|
28182
|
-
* Runtime-state durability: **
|
|
29432
|
+
* Runtime-state durability: **restored** — nothing else holds the value
|
|
29433
|
+
* (D642). A consumable can often be read only in a device's wake window (the
|
|
29434
|
+
* Dreame mower's CMS counters answer only while it charges), so a restart
|
|
29435
|
+
* that wiped the slice left the panel empty and the alerts blind until the
|
|
29436
|
+
* next wake — 2026-09-26, mower 503 idle with `items: []`. A restored item is
|
|
29437
|
+
* the previous observation, not a claim about now; the provider overwrites it
|
|
29438
|
+
* the moment it reads the device again.
|
|
28183
29439
|
*
|
|
28184
29440
|
* See `RuntimeStateDurability`. Enforced by
|
|
28185
29441
|
* `scripts/check-runtime-state-durability.ts`.
|
|
28186
29442
|
*/
|
|
28187
|
-
durability: "
|
|
29443
|
+
durability: "restored",
|
|
29444
|
+
/** Clocks, not content: a re-read that changed no item costs no commit. */
|
|
29445
|
+
volatileStateFields: ["lastChangedAt", "lastFetchedAt"]
|
|
28188
29446
|
};
|
|
28189
29447
|
/**
|
|
28190
29448
|
* Door / window / opening / garage / valve contact sensor. Boolean
|
|
@@ -28573,75 +29831,6 @@ onStatusChanged: { data: object({
|
|
|
28573
29831
|
volatileStateFields: ["lastChangedAt"]
|
|
28574
29832
|
};
|
|
28575
29833
|
/**
|
|
28576
|
-
* Doorbell button cap. Two kinds of providers coexist behind this cap
|
|
28577
|
-
* name (same pattern as `snapshot`):
|
|
28578
|
-
*
|
|
28579
|
-
* - **Native** providers: registered per-device by device-driver
|
|
28580
|
-
* addons via `ctx.registerNativeCap` — either on a
|
|
28581
|
-
* `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
|
|
28582
|
-
* or directly on the camera (Reolink registers at camera level).
|
|
28583
|
-
* Emits an `onPressed` event every time the firmware pushes a
|
|
28584
|
-
* ring; status tracks the last press and a pressCount since start
|
|
28585
|
-
* (diagnostic).
|
|
28586
|
-
*
|
|
28587
|
-
* - **Wrapper** provider: the `virtual-doorbell` system builtin
|
|
28588
|
-
* (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
|
|
28589
|
-
* device (contact / switch / event-emitter …) into a doorbell for
|
|
28590
|
-
* a camera. `defaultActive: false` — the operator explicitly binds
|
|
28591
|
-
* it per camera in the device-bindings UI, then picks the source
|
|
28592
|
-
* device + trigger in the per-device settings.
|
|
28593
|
-
*
|
|
28594
|
-
* The DeviceEventPropagator re-emits `onPressed` on the camera parent
|
|
28595
|
-
* — subscribers listening at the camera level receive ring events
|
|
28596
|
-
* with `via[]` populated. No code on the parent needed.
|
|
28597
|
-
*/
|
|
28598
|
-
var DoorbellStatusSchema = object({
|
|
28599
|
-
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
28600
|
-
lastPressedAt: number().nullable(),
|
|
28601
|
-
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
28602
|
-
pressCountSinceStart: number()
|
|
28603
|
-
});
|
|
28604
|
-
var DoorbellPressEventSchema = object({
|
|
28605
|
-
deviceId: number(),
|
|
28606
|
-
timestamp: number()
|
|
28607
|
-
});
|
|
28608
|
-
var doorbellCapability = {
|
|
28609
|
-
name: "doorbell",
|
|
28610
|
-
scope: "device",
|
|
28611
|
-
deviceNative: true,
|
|
28612
|
-
mode: "singleton",
|
|
28613
|
-
kind: "wrapper",
|
|
28614
|
-
defaultActive: false,
|
|
28615
|
-
deviceTypes: [DeviceType.Button, DeviceType.Camera],
|
|
28616
|
-
exposesDeviceSettings: true,
|
|
28617
|
-
methods: {},
|
|
28618
|
-
events: {
|
|
28619
|
-
/**
|
|
28620
|
-
* Fires once per physical press. Reolink delivers via Baichuan
|
|
28621
|
-
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
28622
|
-
* release/duration — it's a pulse.
|
|
28623
|
-
*/
|
|
28624
|
-
onPressed: { data: DoorbellPressEventSchema } },
|
|
28625
|
-
status: {
|
|
28626
|
-
schema: DoorbellStatusSchema,
|
|
28627
|
-
kind: "push"
|
|
28628
|
-
},
|
|
28629
|
-
/**
|
|
28630
|
-
* Runtime-state slice — last press timestamp + lifetime press count.
|
|
28631
|
-
* Mirrored by the kernel and readable via
|
|
28632
|
-
* `device.state.doorbell.value`. UIs can show "last ring 5m ago"
|
|
28633
|
-
* without subscribing.
|
|
28634
|
-
*/
|
|
28635
|
-
runtimeState: DoorbellStatusSchema,
|
|
28636
|
-
/**
|
|
28637
|
-
* Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
|
|
28638
|
-
*
|
|
28639
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
28640
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
28641
|
-
*/
|
|
28642
|
-
durability: "restored"
|
|
28643
|
-
};
|
|
28644
|
-
/**
|
|
28645
29834
|
* Enum-state sensor — a string value picked from a finite option set.
|
|
28646
29835
|
* Drives HA `sensor` entries with `state_class: enum` (HVAC action
|
|
28647
29836
|
* states, weather conditions, contact-source channels, mode strings).
|
|
@@ -31745,7 +32934,30 @@ var RenameNodeResultSchema = object({
|
|
|
31745
32934
|
nodeId: string(),
|
|
31746
32935
|
name: string()
|
|
31747
32936
|
});
|
|
31748
|
-
|
|
32937
|
+
/**
|
|
32938
|
+
* The cheap node list. A consumer's rule for a STORED node id (a rule's
|
|
32939
|
+
* `nodeIds`) that is missing from `nodes`, whatever `complete` says: render it
|
|
32940
|
+
* as a removable chip labelled unknown, never drop it (D49). Even a complete
|
|
32941
|
+
* list omits a node that joined and left between two history captures, so a
|
|
32942
|
+
* missing id means "not known to the hub", never "removed". Only the operator
|
|
32943
|
+
* removes it.
|
|
32944
|
+
*
|
|
32945
|
+
* `complete` changes only the WORDING: `false` = no history read has ever
|
|
32946
|
+
* answered, so the list may be missing offline nodes the hub does know (D315).
|
|
32947
|
+
*
|
|
32948
|
+
* `name` is the history row's name (≤ 30 s behind a rename), or the id when
|
|
32949
|
+
* the history has none.
|
|
32950
|
+
*/
|
|
32951
|
+
var NodeDirectorySchema = object({
|
|
32952
|
+
nodes: array(object({
|
|
32953
|
+
id: string(),
|
|
32954
|
+
name: string(),
|
|
32955
|
+
isHub: boolean(),
|
|
32956
|
+
isOnline: boolean()
|
|
32957
|
+
})).readonly(),
|
|
32958
|
+
complete: boolean()
|
|
32959
|
+
});
|
|
32960
|
+
method(_void(), array(TopologyNodeSchema).readonly(), { auth: "admin" }), method(_void(), NodeDirectorySchema, { auth: "admin" }), method(NodeAddonInputSchema, SuccessSchema, {
|
|
31749
32961
|
kind: "mutation",
|
|
31750
32962
|
auth: "admin"
|
|
31751
32963
|
}), method(NodeAddonInputSchema, SuccessSchema, {
|
|
@@ -32684,7 +33896,7 @@ var HardwareInfoSchema = object({
|
|
|
32684
33896
|
coral: CoralInfoSchema.nullable().optional()
|
|
32685
33897
|
});
|
|
32686
33898
|
var PlatformScoreSchema = object({
|
|
32687
|
-
runtime:
|
|
33899
|
+
runtime: literal("python"),
|
|
32688
33900
|
backend: string(),
|
|
32689
33901
|
format: _enum([
|
|
32690
33902
|
"onnx",
|
|
@@ -32721,7 +33933,7 @@ var ModelRequirementSchema = object({
|
|
|
32721
33933
|
});
|
|
32722
33934
|
var ResolvedInferenceConfigSchema = object({
|
|
32723
33935
|
modelId: string(),
|
|
32724
|
-
runtime:
|
|
33936
|
+
runtime: literal("python"),
|
|
32725
33937
|
backend: string(),
|
|
32726
33938
|
format: ModelFormatSchema,
|
|
32727
33939
|
reason: string()
|
|
@@ -35506,6 +36718,92 @@ var sceneMonitorCapability = {
|
|
|
35506
36718
|
durability: "session"
|
|
35507
36719
|
};
|
|
35508
36720
|
/**
|
|
36721
|
+
* Per-stage gating mode applied to the zones a rule references.
|
|
36722
|
+
*
|
|
36723
|
+
* - `include`: the rule contributes to a **whitelist** for its stage.
|
|
36724
|
+
* When at least one `include` rule fires for a stage, only entities
|
|
36725
|
+
* inside one of those zones pass that stage.
|
|
36726
|
+
* - `exclude`: the rule contributes to a **blacklist** for its stage.
|
|
36727
|
+
* Entities inside one of those zones are dropped at that stage.
|
|
36728
|
+
*
|
|
36729
|
+
* `monitor`-style observation (count without filtering) is not a rule
|
|
36730
|
+
* mode — zones without any matching rule are observed naturally by
|
|
36731
|
+
* `zone-analytics` (live snapshot + history), so an "I just want to
|
|
36732
|
+
* count, not filter" use case needs no rule at all.
|
|
36733
|
+
*/
|
|
36734
|
+
var ZoneRuleModeEnum = _enum(["include", "exclude"]);
|
|
36735
|
+
/**
|
|
36736
|
+
* Per-consumer rule that references existing zones (geometry) and
|
|
36737
|
+
* defines how a specific pipeline stage should treat them. Each
|
|
36738
|
+
* consumer addon owns its own `ZoneRule[]` array in its per-device
|
|
36739
|
+
* settings:
|
|
36740
|
+
*
|
|
36741
|
+
* - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
|
|
36742
|
+
* - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
|
|
36743
|
+
* - future: notification rules, audio gating, etc.
|
|
36744
|
+
*
|
|
36745
|
+
* One rule applies to N zones (`zoneIds[]`) so the operator can
|
|
36746
|
+
* express "ignore motion in ALL of {garden, street}" with a single
|
|
36747
|
+
* rule. `classFilter` narrows the rule to specific object classes —
|
|
36748
|
+
* "drop person detections in the street, but keep cars" is one
|
|
36749
|
+
* `exclude` rule with `classFilter: ['person']`.
|
|
36750
|
+
*
|
|
36751
|
+
* `enabled` is a soft toggle — the operator can keep the rule
|
|
36752
|
+
* configured but inert without deleting it.
|
|
36753
|
+
*/
|
|
36754
|
+
var ZoneRuleSchema = object({
|
|
36755
|
+
/** Stable rule id — survives edits, used by the UI for diffing. */
|
|
36756
|
+
id: string(),
|
|
36757
|
+
/** Optional human-readable label rendered in the rule editor. */
|
|
36758
|
+
name: string().optional(),
|
|
36759
|
+
/** Zones this rule targets. The rule's `mode` applies to ALL
|
|
36760
|
+
* listed zones (OR-set: a detection in any one of them counts).
|
|
36761
|
+
* At least one zone id required — a rule with no targets is a
|
|
36762
|
+
* configuration mistake and the form validator rejects it. */
|
|
36763
|
+
zoneIds: array(string()).min(1).readonly(),
|
|
36764
|
+
mode: ZoneRuleModeEnum,
|
|
36765
|
+
/**
|
|
36766
|
+
* Class names this rule applies to. Empty / undefined ⇒ rule
|
|
36767
|
+
* applies to every class. Class strings match the `macroClass`
|
|
36768
|
+
* field on detections (e.g. `person`, `car`, `dog`).
|
|
36769
|
+
*/
|
|
36770
|
+
classFilter: array(string()).readonly().optional(),
|
|
36771
|
+
/**
|
|
36772
|
+
* Minimum bbox/mask overlap (0–1) with any of the rule's zones
|
|
36773
|
+
* required to consider an entity "in the zone". Defaults to the
|
|
36774
|
+
* consumer's stage default when omitted. Kept for back-compat with
|
|
36775
|
+
* existing per-rule overrides; new operators pick the value via
|
|
36776
|
+
* `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
|
|
36777
|
+
* set, the lower-level engine reads it as a 0–1 fraction.
|
|
36778
|
+
*/
|
|
36779
|
+
overlapThreshold: number().min(0).max(1).optional(),
|
|
36780
|
+
/**
|
|
36781
|
+
* Operator-friendly version of `overlapThreshold` — the percentage
|
|
36782
|
+
* of the detection's bbox that must lie inside the zone for the
|
|
36783
|
+
* rule to match. Documented default is 85%; the engine substitutes
|
|
36784
|
+
* that when the field is omitted (kept optional so existing rules
|
|
36785
|
+
* stored without it stay valid).
|
|
36786
|
+
*
|
|
36787
|
+
* When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
|
|
36788
|
+
* rule, the engine prefers `bboxInclusionPct` because it's the
|
|
36789
|
+
* field exposed in the UI. Internally both feed the same gate.
|
|
36790
|
+
*/
|
|
36791
|
+
bboxInclusionPct: number().min(0).max(100).optional(),
|
|
36792
|
+
/**
|
|
36793
|
+
* When `true` and a detection has a segmentation mask, use the
|
|
36794
|
+
* mask for overlap instead of the bbox. Detection-stage only;
|
|
36795
|
+
* motion rules ignore this field.
|
|
36796
|
+
*/
|
|
36797
|
+
preferMask: boolean().optional(),
|
|
36798
|
+
/**
|
|
36799
|
+
* Soft-toggle: `false` disables the rule without deleting it.
|
|
36800
|
+
* Defaults to `true` so operators creating a rule via the UI
|
|
36801
|
+
* see it active immediately.
|
|
36802
|
+
*/
|
|
36803
|
+
enabled: boolean().default(true)
|
|
36804
|
+
});
|
|
36805
|
+
array(ZoneRuleSchema).readonly();
|
|
36806
|
+
/**
|
|
35509
36807
|
* Script-runner cap. Models HA `script.*` entities on
|
|
35510
36808
|
* `DeviceType.Script`. A Script is a pre-recorded action sequence
|
|
35511
36809
|
* that can be invoked imperatively — optionally with a variables
|
|
@@ -37706,6 +39004,38 @@ var zoneRulesCapability = {
|
|
|
37706
39004
|
*/
|
|
37707
39005
|
durability: "restored"
|
|
37708
39006
|
};
|
|
39007
|
+
var NUMBER = {
|
|
39008
|
+
kind: "fixed",
|
|
39009
|
+
result: ["number"]
|
|
39010
|
+
};
|
|
39011
|
+
var BOOLEAN = {
|
|
39012
|
+
kind: "fixed",
|
|
39013
|
+
result: ["boolean"]
|
|
39014
|
+
};
|
|
39015
|
+
Object.freeze({
|
|
39016
|
+
min: NUMBER,
|
|
39017
|
+
max: NUMBER,
|
|
39018
|
+
abs: NUMBER,
|
|
39019
|
+
floor: NUMBER,
|
|
39020
|
+
ceil: NUMBER,
|
|
39021
|
+
sqrt: NUMBER,
|
|
39022
|
+
round: NUMBER,
|
|
39023
|
+
pow: NUMBER,
|
|
39024
|
+
clamp: NUMBER,
|
|
39025
|
+
avg: NUMBER,
|
|
39026
|
+
sum: NUMBER,
|
|
39027
|
+
age: NUMBER,
|
|
39028
|
+
convert: NUMBER,
|
|
39029
|
+
coalesce: { kind: "coalesce" },
|
|
39030
|
+
any: BOOLEAN,
|
|
39031
|
+
all: BOOLEAN,
|
|
39032
|
+
within: BOOLEAN,
|
|
39033
|
+
latest: {
|
|
39034
|
+
kind: "fixed",
|
|
39035
|
+
result: ["number", "null"]
|
|
39036
|
+
}
|
|
39037
|
+
});
|
|
39038
|
+
`${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
|
|
37709
39039
|
/**
|
|
37710
39040
|
* Accessory device helpers — shared across drivers.
|
|
37711
39041
|
*
|
|
@@ -41678,6 +43008,18 @@ Object.freeze({
|
|
|
41678
43008
|
addonId: null,
|
|
41679
43009
|
access: "create"
|
|
41680
43010
|
},
|
|
43011
|
+
"composer.applyBlocks": {
|
|
43012
|
+
capName: "composer",
|
|
43013
|
+
capScope: "system",
|
|
43014
|
+
addonId: null,
|
|
43015
|
+
access: "create"
|
|
43016
|
+
},
|
|
43017
|
+
"composer.getStates": {
|
|
43018
|
+
capName: "composer",
|
|
43019
|
+
capScope: "system",
|
|
43020
|
+
addonId: null,
|
|
43021
|
+
access: "view"
|
|
43022
|
+
},
|
|
41681
43023
|
"connectionTest.describeTest": {
|
|
41682
43024
|
capName: "connection-test",
|
|
41683
43025
|
capScope: "system",
|
|
@@ -41738,6 +43080,12 @@ Object.freeze({
|
|
|
41738
43080
|
addonId: null,
|
|
41739
43081
|
access: "create"
|
|
41740
43082
|
},
|
|
43083
|
+
"coreBlocks.createComposition": {
|
|
43084
|
+
capName: "core-blocks",
|
|
43085
|
+
capScope: "system",
|
|
43086
|
+
addonId: null,
|
|
43087
|
+
access: "create"
|
|
43088
|
+
},
|
|
41741
43089
|
"coreBlocks.delete": {
|
|
41742
43090
|
capName: "core-blocks",
|
|
41743
43091
|
capScope: "system",
|
|
@@ -41750,6 +43098,12 @@ Object.freeze({
|
|
|
41750
43098
|
addonId: null,
|
|
41751
43099
|
access: "view"
|
|
41752
43100
|
},
|
|
43101
|
+
"coreBlocks.getComposition": {
|
|
43102
|
+
capName: "core-blocks",
|
|
43103
|
+
capScope: "system",
|
|
43104
|
+
addonId: null,
|
|
43105
|
+
access: "view"
|
|
43106
|
+
},
|
|
41753
43107
|
"coreBlocks.getTypeDefs": {
|
|
41754
43108
|
capName: "core-blocks",
|
|
41755
43109
|
capScope: "system",
|
|
@@ -41762,6 +43116,12 @@ Object.freeze({
|
|
|
41762
43116
|
addonId: null,
|
|
41763
43117
|
access: "view"
|
|
41764
43118
|
},
|
|
43119
|
+
"coreBlocks.listCompositions": {
|
|
43120
|
+
capName: "core-blocks",
|
|
43121
|
+
capScope: "system",
|
|
43122
|
+
addonId: null,
|
|
43123
|
+
access: "view"
|
|
43124
|
+
},
|
|
41765
43125
|
"coreBlocks.restart": {
|
|
41766
43126
|
capName: "core-blocks",
|
|
41767
43127
|
capScope: "system",
|
|
@@ -41780,6 +43140,18 @@ Object.freeze({
|
|
|
41780
43140
|
addonId: null,
|
|
41781
43141
|
access: "create"
|
|
41782
43142
|
},
|
|
43143
|
+
"coreBlocks.updateComposition": {
|
|
43144
|
+
capName: "core-blocks",
|
|
43145
|
+
capScope: "system",
|
|
43146
|
+
addonId: null,
|
|
43147
|
+
access: "create"
|
|
43148
|
+
},
|
|
43149
|
+
"coreBlocks.validateComposition": {
|
|
43150
|
+
capName: "core-blocks",
|
|
43151
|
+
capScope: "system",
|
|
43152
|
+
addonId: null,
|
|
43153
|
+
access: "view"
|
|
43154
|
+
},
|
|
41783
43155
|
"cover.close": {
|
|
41784
43156
|
capName: "cover",
|
|
41785
43157
|
capScope: "device",
|
|
@@ -42170,6 +43542,30 @@ Object.freeze({
|
|
|
42170
43542
|
addonId: null,
|
|
42171
43543
|
access: "create"
|
|
42172
43544
|
},
|
|
43545
|
+
"deviceExtension.listCandidates": {
|
|
43546
|
+
capName: "device-extension",
|
|
43547
|
+
capScope: "device",
|
|
43548
|
+
addonId: null,
|
|
43549
|
+
access: "view"
|
|
43550
|
+
},
|
|
43551
|
+
"deviceExtension.listSlots": {
|
|
43552
|
+
capName: "device-extension",
|
|
43553
|
+
capScope: "device",
|
|
43554
|
+
addonId: null,
|
|
43555
|
+
access: "view"
|
|
43556
|
+
},
|
|
43557
|
+
"deviceExtension.listSources": {
|
|
43558
|
+
capName: "device-extension",
|
|
43559
|
+
capScope: "device",
|
|
43560
|
+
addonId: null,
|
|
43561
|
+
access: "view"
|
|
43562
|
+
},
|
|
43563
|
+
"deviceExtension.setSlot": {
|
|
43564
|
+
capName: "device-extension",
|
|
43565
|
+
capScope: "device",
|
|
43566
|
+
addonId: null,
|
|
43567
|
+
access: "create"
|
|
43568
|
+
},
|
|
42173
43569
|
"deviceManager.addLocation": {
|
|
42174
43570
|
capName: "device-manager",
|
|
42175
43571
|
capScope: "system",
|
|
@@ -42242,12 +43638,6 @@ Object.freeze({
|
|
|
42242
43638
|
addonId: null,
|
|
42243
43639
|
access: "create"
|
|
42244
43640
|
},
|
|
42245
|
-
"deviceManager.applyDeviceSettingsPatch": {
|
|
42246
|
-
capName: "device-manager",
|
|
42247
|
-
capScope: "system",
|
|
42248
|
-
addonId: null,
|
|
42249
|
-
access: "create"
|
|
42250
|
-
},
|
|
42251
43641
|
"deviceManager.applyInitialMeta": {
|
|
42252
43642
|
capName: "device-manager",
|
|
42253
43643
|
capScope: "system",
|
|
@@ -42350,12 +43740,6 @@ Object.freeze({
|
|
|
42350
43740
|
addonId: null,
|
|
42351
43741
|
access: "view"
|
|
42352
43742
|
},
|
|
42353
|
-
"deviceManager.getDeviceLiveContribution": {
|
|
42354
|
-
capName: "device-manager",
|
|
42355
|
-
capScope: "system",
|
|
42356
|
-
addonId: null,
|
|
42357
|
-
access: "view"
|
|
42358
|
-
},
|
|
42359
43743
|
"deviceManager.getDeviceLiveInfoAggregate": {
|
|
42360
43744
|
capName: "device-manager",
|
|
42361
43745
|
capScope: "system",
|
|
@@ -42368,12 +43752,6 @@ Object.freeze({
|
|
|
42368
43752
|
addonId: null,
|
|
42369
43753
|
access: "view"
|
|
42370
43754
|
},
|
|
42371
|
-
"deviceManager.getDeviceSettingsContribution": {
|
|
42372
|
-
capName: "device-manager",
|
|
42373
|
-
capScope: "system",
|
|
42374
|
-
addonId: null,
|
|
42375
|
-
access: "view"
|
|
42376
|
-
},
|
|
42377
43755
|
"deviceManager.getDeviceStatusAggregate": {
|
|
42378
43756
|
capName: "device-manager",
|
|
42379
43757
|
capScope: "system",
|
|
@@ -42878,24 +44256,6 @@ Object.freeze({
|
|
|
42878
44256
|
addonId: null,
|
|
42879
44257
|
access: "view"
|
|
42880
44258
|
},
|
|
42881
|
-
"doorbell.applyDeviceSettingsPatch": {
|
|
42882
|
-
capName: "doorbell",
|
|
42883
|
-
capScope: "device",
|
|
42884
|
-
addonId: null,
|
|
42885
|
-
access: "create"
|
|
42886
|
-
},
|
|
42887
|
-
"doorbell.getDeviceLiveContribution": {
|
|
42888
|
-
capName: "doorbell",
|
|
42889
|
-
capScope: "device",
|
|
42890
|
-
addonId: null,
|
|
42891
|
-
access: "view"
|
|
42892
|
-
},
|
|
42893
|
-
"doorbell.getDeviceSettingsContribution": {
|
|
42894
|
-
capName: "doorbell",
|
|
42895
|
-
capScope: "device",
|
|
42896
|
-
addonId: null,
|
|
42897
|
-
access: "view"
|
|
42898
|
-
},
|
|
42899
44259
|
"doorbell.getStatus": {
|
|
42900
44260
|
capName: "doorbell",
|
|
42901
44261
|
capScope: "device",
|
|
@@ -42920,6 +44280,12 @@ Object.freeze({
|
|
|
42920
44280
|
addonId: null,
|
|
42921
44281
|
access: "view"
|
|
42922
44282
|
},
|
|
44283
|
+
"embeddingEncoder.resetFailedModels": {
|
|
44284
|
+
capName: "embedding-encoder",
|
|
44285
|
+
capScope: "system",
|
|
44286
|
+
addonId: null,
|
|
44287
|
+
access: "delete"
|
|
44288
|
+
},
|
|
42923
44289
|
"enumSensor.getStatus": {
|
|
42924
44290
|
capName: "enum-sensor",
|
|
42925
44291
|
capScope: "device",
|
|
@@ -44102,6 +45468,12 @@ Object.freeze({
|
|
|
44102
45468
|
addonId: null,
|
|
44103
45469
|
access: "create"
|
|
44104
45470
|
},
|
|
45471
|
+
"nodes.directory": {
|
|
45472
|
+
capName: "nodes",
|
|
45473
|
+
capScope: "system",
|
|
45474
|
+
addonId: null,
|
|
45475
|
+
access: "view"
|
|
45476
|
+
},
|
|
44105
45477
|
"nodes.executeQuery": {
|
|
44106
45478
|
capName: "nodes",
|
|
44107
45479
|
capScope: "system",
|
|
@@ -44270,6 +45642,12 @@ Object.freeze({
|
|
|
44270
45642
|
addonId: null,
|
|
44271
45643
|
access: "view"
|
|
44272
45644
|
},
|
|
45645
|
+
"notificationRules.getRuleLastRuns": {
|
|
45646
|
+
capName: "notification-rules",
|
|
45647
|
+
capScope: "system",
|
|
45648
|
+
addonId: null,
|
|
45649
|
+
access: "view"
|
|
45650
|
+
},
|
|
44273
45651
|
"notificationRules.getTemplateCatalog": {
|
|
44274
45652
|
capName: "notification-rules",
|
|
44275
45653
|
capScope: "system",
|
|
@@ -44294,6 +45672,12 @@ Object.freeze({
|
|
|
44294
45672
|
addonId: null,
|
|
44295
45673
|
access: "view"
|
|
44296
45674
|
},
|
|
45675
|
+
"notificationRules.previewStateSummary": {
|
|
45676
|
+
capName: "notification-rules",
|
|
45677
|
+
capScope: "system",
|
|
45678
|
+
addonId: null,
|
|
45679
|
+
access: "view"
|
|
45680
|
+
},
|
|
44297
45681
|
"notificationRules.previewTemplate": {
|
|
44298
45682
|
capName: "notification-rules",
|
|
44299
45683
|
capScope: "system",
|
|
@@ -44870,12 +46254,6 @@ Object.freeze({
|
|
|
44870
46254
|
addonId: null,
|
|
44871
46255
|
access: "create"
|
|
44872
46256
|
},
|
|
44873
|
-
"pipelineAnalytics.runReplayFrameProcessor": {
|
|
44874
|
-
capName: "pipeline-analytics",
|
|
44875
|
-
capScope: "device",
|
|
44876
|
-
addonId: null,
|
|
44877
|
-
access: "create"
|
|
44878
|
-
},
|
|
44879
46257
|
"pipelineAnalytics.saveRetrainAnnotations": {
|
|
44880
46258
|
capName: "pipeline-analytics",
|
|
44881
46259
|
capScope: "device",
|
|
@@ -45242,6 +46620,12 @@ Object.freeze({
|
|
|
45242
46620
|
addonId: null,
|
|
45243
46621
|
access: "view"
|
|
45244
46622
|
},
|
|
46623
|
+
"pipelineOrchestrator.getClusterModelChoice": {
|
|
46624
|
+
capName: "pipeline-orchestrator",
|
|
46625
|
+
capScope: "system",
|
|
46626
|
+
addonId: null,
|
|
46627
|
+
access: "view"
|
|
46628
|
+
},
|
|
45245
46629
|
"pipelineOrchestrator.getDeviceLiveContribution": {
|
|
45246
46630
|
capName: "pipeline-orchestrator",
|
|
45247
46631
|
capScope: "system",
|
|
@@ -48067,6 +49451,26 @@ Object.freeze({
|
|
|
48067
49451
|
form: "single",
|
|
48068
49452
|
optional: false
|
|
48069
49453
|
}],
|
|
49454
|
+
"deviceExtension.listCandidates": [{
|
|
49455
|
+
name: "deviceId",
|
|
49456
|
+
form: "single",
|
|
49457
|
+
optional: false
|
|
49458
|
+
}],
|
|
49459
|
+
"deviceExtension.listSlots": [{
|
|
49460
|
+
name: "deviceId",
|
|
49461
|
+
form: "single",
|
|
49462
|
+
optional: false
|
|
49463
|
+
}],
|
|
49464
|
+
"deviceExtension.listSources": [{
|
|
49465
|
+
name: "deviceId",
|
|
49466
|
+
form: "single",
|
|
49467
|
+
optional: false
|
|
49468
|
+
}],
|
|
49469
|
+
"deviceExtension.setSlot": [{
|
|
49470
|
+
name: "deviceId",
|
|
49471
|
+
form: "single",
|
|
49472
|
+
optional: false
|
|
49473
|
+
}],
|
|
48070
49474
|
"deviceManager.adoptionRelease": [{
|
|
48071
49475
|
name: "camDeviceId",
|
|
48072
49476
|
form: "single",
|
|
@@ -48973,11 +50377,6 @@ Object.freeze({
|
|
|
48973
50377
|
form: "single",
|
|
48974
50378
|
optional: false
|
|
48975
50379
|
}],
|
|
48976
|
-
"pipelineAnalytics.runReplayFrameProcessor": [{
|
|
48977
|
-
name: "deviceId",
|
|
48978
|
-
form: "single",
|
|
48979
|
-
optional: false
|
|
48980
|
-
}],
|
|
48981
50380
|
"pipelineAnalytics.saveRetrainAnnotations": [{
|
|
48982
50381
|
name: "deviceId",
|
|
48983
50382
|
form: "single",
|
|
@@ -49866,11 +51265,232 @@ var NC_AUDIO_DEFAULTS = {
|
|
|
49866
51265
|
samplingSeconds: 10
|
|
49867
51266
|
};
|
|
49868
51267
|
new Set(["devices", "classes"]);
|
|
51268
|
+
/**
|
|
51269
|
+
* WHICH narrowing filter speaks about WHICH system-event kind — one predicate,
|
|
51270
|
+
* consumed by the rule ENGINE and by every rule EDITOR.
|
|
51271
|
+
*
|
|
51272
|
+
* ── The failure this file exists for ───────────────────────────────────────
|
|
51273
|
+
* `NcSystemEventConditionSchema` carries four optional narrowing lists
|
|
51274
|
+
* (`deviceIds`, `deviceTypes`, `nodeIds`, `packageNames`) beside a required
|
|
51275
|
+
* `kinds` gate. They are not four filters over one vocabulary: each belongs to
|
|
51276
|
+
* a FAMILY of kinds and is meaningless outside it. A node going away has no
|
|
51277
|
+
* device type; a completed export has no package; `stream-offline` deliberately
|
|
51278
|
+
* carries no device type at all (a stream belongs to a camera by construction).
|
|
51279
|
+
*
|
|
51280
|
+
* The engine applied all four to every kind, so a filter from one family failed
|
|
51281
|
+
* a kind from another family CLOSED. The operator's live rule "Eventi di
|
|
51282
|
+
* sistema" selected eleven kinds and set `deviceTypes: ['camera']` — the only
|
|
51283
|
+
* way to say "only my cameras" about the two liveness kinds — and NINE of the
|
|
51284
|
+
* eleven silently stopped being deliverable. Four days of history contained
|
|
51285
|
+
* `device-online` and `device-offline` and nothing else, across a window in
|
|
51286
|
+
* which agents were restarted and addons were updated.
|
|
51287
|
+
*
|
|
51288
|
+
* Both editors already computed this scoping, to decide which filter boxes to
|
|
51289
|
+
* render; the cap's own docblock already promised it ("Narrow a `device-*` kind
|
|
51290
|
+
* to these device TYPES"). Only the engine disagreed, and it disagreed in the
|
|
51291
|
+
* destructive direction. So the rule is stated ONCE, here, and the engine and
|
|
51292
|
+
* the editors are readers of it rather than three independent authors.
|
|
51293
|
+
*
|
|
51294
|
+
* ── The direction ─────────────────────────────────────────────────────────
|
|
51295
|
+
* Out of family ⇒ the filter is IGNORED, never fail-closed. An editor that
|
|
51296
|
+
* hides a box has already told the operator this filter does not speak about
|
|
51297
|
+
* these kinds, so honouring it as an exclusion contradicts the only
|
|
51298
|
+
* explanation the operator was ever given. Inside its family the filter still
|
|
51299
|
+
* narrows, and still fails CLOSED on a subject that cannot produce the identity
|
|
51300
|
+
* it tests (a device the mirror cannot name is not evidence of a camera).
|
|
51301
|
+
*/
|
|
51302
|
+
/**
|
|
51303
|
+
* Every filter, for the callers that must cover all of them (guards, tests).
|
|
51304
|
+
*
|
|
51305
|
+
* `consumableLowPercent` (D642) is not a list but it is a filter in exactly
|
|
51306
|
+
* this sense: it belongs to a family of kinds (the consumable pair) and the
|
|
51307
|
+
* engine consults it only there. It differs in one way the readers must know —
|
|
51308
|
+
* its ABSENCE is not "no narrowing" but the default threshold, because a
|
|
51309
|
+
* consumable episode is always judged at SOME threshold.
|
|
51310
|
+
*/
|
|
51311
|
+
var NC_SYSTEM_EVENT_FILTER_KEYS = [
|
|
51312
|
+
"deviceIds",
|
|
51313
|
+
"deviceTypes",
|
|
51314
|
+
"nodeIds",
|
|
51315
|
+
"packageNames",
|
|
51316
|
+
"consumableLowPercent"
|
|
51317
|
+
];
|
|
51318
|
+
new Map(Object.entries({
|
|
51319
|
+
"device-online": "device-events",
|
|
51320
|
+
"device-offline": "device-events",
|
|
51321
|
+
"device-disabled": "device-events",
|
|
51322
|
+
"device-enabled": "device-events",
|
|
51323
|
+
"device-battery-low": "device-events",
|
|
51324
|
+
"device-battery-normal": "device-events",
|
|
51325
|
+
"device-consumable-low": "device-events",
|
|
51326
|
+
"device-consumable-normal": "device-events",
|
|
51327
|
+
"device-tank-low": "device-events",
|
|
51328
|
+
"device-tank-full": "device-events",
|
|
51329
|
+
"device-tank-normal": "device-events",
|
|
51330
|
+
"stream-online": "device-events",
|
|
51331
|
+
"stream-offline": "device-events",
|
|
51332
|
+
"detection-blind": "device-events",
|
|
51333
|
+
"node-online": "system",
|
|
51334
|
+
"node-offline": "system",
|
|
51335
|
+
"node-inference-unavailable": "system",
|
|
51336
|
+
"addon-crash-loop": "system",
|
|
51337
|
+
"addon-update-available": "system",
|
|
51338
|
+
"addon-updated": "system",
|
|
51339
|
+
"server-update-available": "system",
|
|
51340
|
+
"server-updated": "system",
|
|
51341
|
+
"wrapper-update-available": "system",
|
|
51342
|
+
"backup-completed": "system",
|
|
51343
|
+
"export-completed": "system",
|
|
51344
|
+
"alarm-triggered": "alarm",
|
|
51345
|
+
"alarm-armed": "alarm",
|
|
51346
|
+
"alarm-disarmed": "alarm",
|
|
51347
|
+
"alarm-arming": "alarm",
|
|
51348
|
+
"alarm-arm-refused": "alarm",
|
|
51349
|
+
"alarm-pending": "alarm",
|
|
51350
|
+
"alarm-rearmed": "alarm",
|
|
51351
|
+
"alarm-sensor-bypass": "alarm",
|
|
51352
|
+
"alarm-check-failed": "alarm",
|
|
51353
|
+
"camera-online": null,
|
|
51354
|
+
"camera-offline": null,
|
|
51355
|
+
"camera-disabled": null,
|
|
51356
|
+
"camera-enabled": null
|
|
51357
|
+
}));
|
|
51358
|
+
[...NC_SYSTEM_EVENT_FILTER_KEYS];
|
|
51359
|
+
var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
|
|
51360
|
+
{
|
|
51361
|
+
id: "device-state",
|
|
51362
|
+
family: "device-events",
|
|
51363
|
+
label: "Device state",
|
|
51364
|
+
kinds: [
|
|
51365
|
+
"device-offline",
|
|
51366
|
+
"device-online",
|
|
51367
|
+
"device-disabled",
|
|
51368
|
+
"device-enabled"
|
|
51369
|
+
]
|
|
51370
|
+
},
|
|
51371
|
+
{
|
|
51372
|
+
id: "streams",
|
|
51373
|
+
family: "device-events",
|
|
51374
|
+
label: "Streams",
|
|
51375
|
+
kinds: ["stream-offline", "stream-online"]
|
|
51376
|
+
},
|
|
51377
|
+
{
|
|
51378
|
+
id: "battery",
|
|
51379
|
+
family: "device-events",
|
|
51380
|
+
label: "Battery",
|
|
51381
|
+
kinds: ["device-battery-low", "device-battery-normal"]
|
|
51382
|
+
},
|
|
51383
|
+
{
|
|
51384
|
+
id: "consumables",
|
|
51385
|
+
family: "device-events",
|
|
51386
|
+
label: "Consumables",
|
|
51387
|
+
kinds: ["device-consumable-low", "device-consumable-normal"]
|
|
51388
|
+
},
|
|
51389
|
+
{
|
|
51390
|
+
id: "tanks",
|
|
51391
|
+
family: "device-events",
|
|
51392
|
+
label: "Tanks",
|
|
51393
|
+
kinds: [
|
|
51394
|
+
"device-tank-low",
|
|
51395
|
+
"device-tank-full",
|
|
51396
|
+
"device-tank-normal"
|
|
51397
|
+
]
|
|
51398
|
+
},
|
|
51399
|
+
{
|
|
51400
|
+
id: "detection-blind",
|
|
51401
|
+
family: "device-events",
|
|
51402
|
+
label: "Detecting nothing",
|
|
51403
|
+
kinds: ["detection-blind"]
|
|
51404
|
+
},
|
|
51405
|
+
{
|
|
51406
|
+
id: "nodes",
|
|
51407
|
+
family: "system",
|
|
51408
|
+
label: "Nodes",
|
|
51409
|
+
kinds: [
|
|
51410
|
+
"node-offline",
|
|
51411
|
+
"node-online",
|
|
51412
|
+
"node-inference-unavailable"
|
|
51413
|
+
]
|
|
51414
|
+
},
|
|
51415
|
+
{
|
|
51416
|
+
id: "addons",
|
|
51417
|
+
family: "system",
|
|
51418
|
+
label: "Addons",
|
|
51419
|
+
kinds: [
|
|
51420
|
+
"addon-crash-loop",
|
|
51421
|
+
"addon-update-available",
|
|
51422
|
+
"addon-updated"
|
|
51423
|
+
]
|
|
51424
|
+
},
|
|
51425
|
+
{
|
|
51426
|
+
id: "updates",
|
|
51427
|
+
family: "system",
|
|
51428
|
+
label: "Server & container updates",
|
|
51429
|
+
kinds: [
|
|
51430
|
+
"server-update-available",
|
|
51431
|
+
"server-updated",
|
|
51432
|
+
"wrapper-update-available"
|
|
51433
|
+
]
|
|
51434
|
+
},
|
|
51435
|
+
{
|
|
51436
|
+
id: "backups-exports",
|
|
51437
|
+
family: "system",
|
|
51438
|
+
label: "Backups & exports",
|
|
51439
|
+
kinds: ["backup-completed", "export-completed"]
|
|
51440
|
+
},
|
|
51441
|
+
{
|
|
51442
|
+
id: "alarm",
|
|
51443
|
+
family: "alarm",
|
|
51444
|
+
label: "Alarm",
|
|
51445
|
+
kinds: NC_ALARM_SYSTEM_EVENT_KINDS
|
|
51446
|
+
}
|
|
51447
|
+
];
|
|
51448
|
+
function systemEventKindsOfFamily(family) {
|
|
51449
|
+
return NC_SYSTEM_EVENT_KIND_GROUP_SPECS.filter((g) => g.family === family).flatMap((g) => g.kinds);
|
|
51450
|
+
}
|
|
49869
51451
|
NC_AUDIO_DEFAULTS.hitPercent, NC_AUDIO_DEFAULTS.samplingSeconds;
|
|
51452
|
+
/**
|
|
51453
|
+
* WHICH WAY A BOOLEAN SENSOR MOVED — read off the one slice a sensor event
|
|
51454
|
+
* persists (D640 "a sensor rule fires on the raise, the clear, or both").
|
|
51455
|
+
*
|
|
51456
|
+
* A device-event rule over a flood sensor notified on BOTH edges: water
|
|
51457
|
+
* detected, and back to dry. `NcConditions.sensorTransition` lets the rule
|
|
51458
|
+
* name one edge; this file answers, for one `SensorEvent`, which edge it is.
|
|
51459
|
+
*
|
|
51460
|
+
* NOT A SECOND TABLE. The "which boolean of this cap counts as HIGH" question
|
|
51461
|
+
* already has one answer, `SOURCE_CAP_ACTIVE_FIELD`
|
|
51462
|
+
* (`catalogs/sensor-active-state.ts`, the doorbell's and the recorder's edge
|
|
51463
|
+
* table), and a sensor event names its kind, not its cap. So the table here is
|
|
51464
|
+
* DERIVED: event kind → cap (`EVENT_KIND_BY_CAP`) → that cap's active field.
|
|
51465
|
+
* Only kinds whose taxonomy category is `sensor` take part — a switch has an
|
|
51466
|
+
* `on` boolean too, but "it triggers / it clears" is not a sentence about a
|
|
51467
|
+
* light, and offering it there would be a knob with a misleading label.
|
|
51468
|
+
* `presence` is a WORD (`home` / `not_home` / a zone), not a boolean, and is
|
|
51469
|
+
* absent from the source table, so it is absent here.
|
|
51470
|
+
*
|
|
51471
|
+
* `undefined` = never guessed: a kind with no raise (a doorbell press, a
|
|
51472
|
+
* button, a cover), or a slice whose field is missing or not a boolean. The
|
|
51473
|
+
* engine then does NOT filter — a flood alert must not go silent because one
|
|
51474
|
+
* read came back unreadable (the same stance as the alarm's `sensorEdgeOf`).
|
|
51475
|
+
*
|
|
51476
|
+
* Pure, RN-safe: the viewer imports the support rule from here.
|
|
51477
|
+
*/
|
|
51478
|
+
/** Event kind → the boolean field of its cap slice that means "raised". */
|
|
51479
|
+
var NC_SENSOR_RAISED_FIELD_BY_KIND = Object.freeze(Object.fromEntries(Object.entries(EVENT_KIND_BY_CAP).flatMap(([capName, descriptor]) => {
|
|
51480
|
+
const field = SOURCE_CAP_ACTIVE_FIELD[capName];
|
|
51481
|
+
if (field === void 0 || descriptor.category !== "sensor") return [];
|
|
51482
|
+
return [[descriptor.kind, field]];
|
|
51483
|
+
})));
|
|
51484
|
+
Object.freeze(Object.keys(NC_SENSOR_RAISED_FIELD_BY_KIND));
|
|
49870
51485
|
var RULE_BODY_ONLY = ["body"];
|
|
49871
51486
|
var RULE_TEXT = ["title", "body"];
|
|
49872
51487
|
var BATTERY = ["device-battery-low", "device-battery-normal"];
|
|
49873
51488
|
var CONSUMABLE = ["device-consumable-low", "device-consumable-normal"];
|
|
51489
|
+
var TANK = [
|
|
51490
|
+
"device-tank-low",
|
|
51491
|
+
"device-tank-full",
|
|
51492
|
+
"device-tank-normal"
|
|
51493
|
+
];
|
|
49874
51494
|
var UPDATES = [
|
|
49875
51495
|
"addon-update-available",
|
|
49876
51496
|
"server-update-available",
|
|
@@ -49896,12 +51516,189 @@ var DEVICE_EVENTS = [
|
|
|
49896
51516
|
"device-enabled",
|
|
49897
51517
|
...BATTERY,
|
|
49898
51518
|
...CONSUMABLE,
|
|
51519
|
+
...TANK,
|
|
49899
51520
|
"stream-online",
|
|
49900
51521
|
"stream-offline",
|
|
49901
51522
|
"detection-blind",
|
|
49902
51523
|
...ALARM
|
|
49903
51524
|
];
|
|
49904
|
-
|
|
51525
|
+
/** Every kind a summary may speak about — the two summarisable families. */
|
|
51526
|
+
var SUMMARISABLE = [...systemEventKindsOfFamily("device-events"), ...systemEventKindsOfFamily("system")];
|
|
51527
|
+
/** One per summary SECTION (`NC_STATE_SUMMARY_SECTIONS` in the notification
|
|
51528
|
+
* centre): the section's lines, offered when one of its kinds is selected. */
|
|
51529
|
+
var STATE_SUMMARY_SECTION_VARS = [
|
|
51530
|
+
{
|
|
51531
|
+
name: "summaryDevices",
|
|
51532
|
+
label: "Summary: devices offline / switched off",
|
|
51533
|
+
example: "Garage — offline since 07:12",
|
|
51534
|
+
kinds: [
|
|
51535
|
+
"device-offline",
|
|
51536
|
+
"device-online",
|
|
51537
|
+
"device-disabled",
|
|
51538
|
+
"device-enabled"
|
|
51539
|
+
]
|
|
51540
|
+
},
|
|
51541
|
+
{
|
|
51542
|
+
name: "summaryStreams",
|
|
51543
|
+
label: "Summary: streams offline",
|
|
51544
|
+
example: "Ingresso (high) — since 06:40",
|
|
51545
|
+
kinds: ["stream-offline", "stream-online"]
|
|
51546
|
+
},
|
|
51547
|
+
{
|
|
51548
|
+
name: "summaryBattery",
|
|
51549
|
+
label: "Summary: low batteries",
|
|
51550
|
+
example: "Sensore porta — 8 %",
|
|
51551
|
+
kinds: BATTERY
|
|
51552
|
+
},
|
|
51553
|
+
{
|
|
51554
|
+
name: "summaryConsumables",
|
|
51555
|
+
label: "Summary: consumables",
|
|
51556
|
+
example: "Robot — filter 10 %",
|
|
51557
|
+
kinds: CONSUMABLE
|
|
51558
|
+
},
|
|
51559
|
+
{
|
|
51560
|
+
name: "summaryTanks",
|
|
51561
|
+
label: "Summary: tanks",
|
|
51562
|
+
example: "Robot — clean water low",
|
|
51563
|
+
kinds: TANK
|
|
51564
|
+
},
|
|
51565
|
+
{
|
|
51566
|
+
name: "summaryDetection",
|
|
51567
|
+
label: "Summary: cameras detecting nothing",
|
|
51568
|
+
example: "Ingresso — since 05:10",
|
|
51569
|
+
kinds: ["detection-blind"]
|
|
51570
|
+
},
|
|
51571
|
+
{
|
|
51572
|
+
name: "summaryNodes",
|
|
51573
|
+
label: "Summary: nodes",
|
|
51574
|
+
example: "little-unraid — offline since 03:00",
|
|
51575
|
+
kinds: [
|
|
51576
|
+
"node-offline",
|
|
51577
|
+
"node-online",
|
|
51578
|
+
"node-inference-unavailable"
|
|
51579
|
+
]
|
|
51580
|
+
},
|
|
51581
|
+
{
|
|
51582
|
+
name: "summaryAddons",
|
|
51583
|
+
label: "Summary: addons",
|
|
51584
|
+
example: "@camstack/addon-recorder 1.2.3 → 1.2.4",
|
|
51585
|
+
kinds: [
|
|
51586
|
+
"addon-crash-loop",
|
|
51587
|
+
"addon-update-available",
|
|
51588
|
+
"addon-updated"
|
|
51589
|
+
]
|
|
51590
|
+
},
|
|
51591
|
+
{
|
|
51592
|
+
name: "summaryUpdates",
|
|
51593
|
+
label: "Summary: server & container updates",
|
|
51594
|
+
example: "server 1.2.377 → 1.2.378",
|
|
51595
|
+
kinds: [
|
|
51596
|
+
"server-update-available",
|
|
51597
|
+
"server-updated",
|
|
51598
|
+
"wrapper-update-available"
|
|
51599
|
+
]
|
|
51600
|
+
}
|
|
51601
|
+
];
|
|
51602
|
+
var STATE_SUMMARY_VARS = [
|
|
51603
|
+
{
|
|
51604
|
+
name: "summaryText",
|
|
51605
|
+
label: "Summary: every section",
|
|
51606
|
+
description: "One block per section with something to report, one line per item.",
|
|
51607
|
+
example: "Batterie scariche: Sensore porta — 8 %",
|
|
51608
|
+
group: "system",
|
|
51609
|
+
families: ["rule"],
|
|
51610
|
+
fields: [...RULE_TEXT],
|
|
51611
|
+
kinds: ["system"],
|
|
51612
|
+
systemEventKinds: [...SUMMARISABLE],
|
|
51613
|
+
systemEventDeliveries: ["summary"]
|
|
51614
|
+
},
|
|
51615
|
+
{
|
|
51616
|
+
name: "summaryCount",
|
|
51617
|
+
label: "Summary: items reported",
|
|
51618
|
+
example: "3",
|
|
51619
|
+
group: "system",
|
|
51620
|
+
families: ["rule"],
|
|
51621
|
+
fields: [...RULE_TEXT],
|
|
51622
|
+
kinds: ["system"],
|
|
51623
|
+
systemEventKinds: [...SUMMARISABLE],
|
|
51624
|
+
systemEventDeliveries: ["summary"]
|
|
51625
|
+
},
|
|
51626
|
+
...STATE_SUMMARY_SECTION_VARS.map((v) => ({
|
|
51627
|
+
name: v.name,
|
|
51628
|
+
label: v.label,
|
|
51629
|
+
example: v.example,
|
|
51630
|
+
group: "system",
|
|
51631
|
+
families: ["rule"],
|
|
51632
|
+
fields: [...RULE_TEXT],
|
|
51633
|
+
kinds: ["system"],
|
|
51634
|
+
systemEventKinds: [...v.kinds],
|
|
51635
|
+
systemEventDeliveries: ["summary"]
|
|
51636
|
+
}))
|
|
51637
|
+
];
|
|
51638
|
+
[
|
|
51639
|
+
[...DEVICE_EVENTS],
|
|
51640
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
51641
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
51642
|
+
[...RULE_TEXT],
|
|
51643
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
51644
|
+
([...RULE_TEXT], [...PACKAGE_UPDATES]),
|
|
51645
|
+
[...RULE_TEXT],
|
|
51646
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
51647
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
51648
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
51649
|
+
[...RULE_TEXT],
|
|
51650
|
+
[...RULE_TEXT],
|
|
51651
|
+
[...RULE_TEXT],
|
|
51652
|
+
[...RULE_TEXT],
|
|
51653
|
+
[...RULE_TEXT],
|
|
51654
|
+
[...RULE_TEXT],
|
|
51655
|
+
[...RULE_TEXT],
|
|
51656
|
+
[...RULE_TEXT],
|
|
51657
|
+
[...RULE_BODY_ONLY],
|
|
51658
|
+
[...RULE_TEXT],
|
|
51659
|
+
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
51660
|
+
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
51661
|
+
([...RULE_TEXT], [...BATTERY, ...CONSUMABLE]),
|
|
51662
|
+
([...RULE_TEXT], [...CONSUMABLE]),
|
|
51663
|
+
([...RULE_TEXT], [...TANK]),
|
|
51664
|
+
[...RULE_TEXT],
|
|
51665
|
+
([...RULE_TEXT], [...UPDATES]),
|
|
51666
|
+
([...RULE_TEXT], [...UPDATES]),
|
|
51667
|
+
[...RULE_TEXT],
|
|
51668
|
+
[...RULE_TEXT],
|
|
51669
|
+
[...RULE_TEXT],
|
|
51670
|
+
([...RULE_TEXT], [...UPDATES]),
|
|
51671
|
+
([...RULE_TEXT], [...PACKAGE_UPDATES]),
|
|
51672
|
+
([...RULE_TEXT], [...PACKAGE_UPDATES]),
|
|
51673
|
+
([...RULE_TEXT], [...UPDATES]),
|
|
51674
|
+
([...RULE_TEXT], [...UPDATES]),
|
|
51675
|
+
([...RULE_TEXT], [...PACKAGE_UPDATES]),
|
|
51676
|
+
[...RULE_TEXT],
|
|
51677
|
+
[...RULE_TEXT],
|
|
51678
|
+
[...RULE_TEXT],
|
|
51679
|
+
[...RULE_TEXT],
|
|
51680
|
+
[...RULE_TEXT],
|
|
51681
|
+
[...RULE_TEXT],
|
|
51682
|
+
[...RULE_TEXT],
|
|
51683
|
+
[...RULE_TEXT],
|
|
51684
|
+
[...RULE_TEXT],
|
|
51685
|
+
[...RULE_TEXT],
|
|
51686
|
+
[...RULE_TEXT],
|
|
51687
|
+
[...RULE_TEXT],
|
|
51688
|
+
[...RULE_TEXT],
|
|
51689
|
+
[...RULE_TEXT],
|
|
51690
|
+
[...RULE_TEXT],
|
|
51691
|
+
[...RULE_TEXT],
|
|
51692
|
+
[...RULE_TEXT],
|
|
51693
|
+
[...RULE_TEXT],
|
|
51694
|
+
[...RULE_TEXT],
|
|
51695
|
+
[...RULE_TEXT],
|
|
51696
|
+
[...RULE_TEXT],
|
|
51697
|
+
[...RULE_TEXT],
|
|
51698
|
+
[...RULE_TEXT],
|
|
51699
|
+
[...RULE_TEXT],
|
|
51700
|
+
...STATE_SUMMARY_VARS
|
|
51701
|
+
];
|
|
49905
51702
|
/**
|
|
49906
51703
|
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
49907
51704
|
*
|
|
@@ -50133,68 +51930,6 @@ TimelapseRuleInputSchema.extend({
|
|
|
50133
51930
|
createdAt: number(),
|
|
50134
51931
|
updatedAt: number()
|
|
50135
51932
|
});
|
|
50136
|
-
Object.freeze(Object.fromEntries([{
|
|
50137
|
-
stepId: "face-embedding",
|
|
50138
|
-
label: "Face recognition model",
|
|
50139
|
-
defaultModelId: "arcface-r100",
|
|
50140
|
-
indexName: "the enrolled face gallery",
|
|
50141
|
-
options: [
|
|
50142
|
-
{
|
|
50143
|
-
id: "arcface-r100",
|
|
50144
|
-
label: "ArcFace (ResNet34)"
|
|
50145
|
-
},
|
|
50146
|
-
{
|
|
50147
|
-
id: "auraface-r100",
|
|
50148
|
-
label: "AuraFace R100"
|
|
50149
|
-
},
|
|
50150
|
-
{
|
|
50151
|
-
id: "inception-resnet-v1",
|
|
50152
|
-
label: "Inception ResNet V1"
|
|
50153
|
-
}
|
|
50154
|
-
]
|
|
50155
|
-
}, {
|
|
50156
|
-
stepId: "clip-embedding",
|
|
50157
|
-
label: "Semantic search model",
|
|
50158
|
-
defaultModelId: "mobileclip-s1",
|
|
50159
|
-
indexName: "the object semantic-search index",
|
|
50160
|
-
options: [{
|
|
50161
|
-
id: "mobileclip-s1",
|
|
50162
|
-
label: "MobileCLIP S1"
|
|
50163
|
-
}, {
|
|
50164
|
-
id: "mobileclip-s2",
|
|
50165
|
-
label: "MobileCLIP S2"
|
|
50166
|
-
}]
|
|
50167
|
-
}].map((s) => [s.stepId, s.defaultModelId])));
|
|
50168
|
-
string().min(1);
|
|
50169
|
-
var CLUSTER_STEP_SETTING_FIELDS = [{
|
|
50170
|
-
stepId: "face-embedding",
|
|
50171
|
-
key: "minLandmarkFaceSize",
|
|
50172
|
-
label: "Min face size for recognition (detection px)",
|
|
50173
|
-
description: "Refuse to embed a face smaller than this IN THE DETECTION FRAME. Applies to every node — the enrolled gallery is one index, and two admission floors would fill it from two policies. 0 disables the gate.",
|
|
50174
|
-
type: "slider",
|
|
50175
|
-
min: 0,
|
|
50176
|
-
max: 64,
|
|
50177
|
-
step: 2,
|
|
50178
|
-
default: 24
|
|
50179
|
-
}];
|
|
50180
|
-
function clusterStepSettingKey(stepId, fieldKey) {
|
|
50181
|
-
return `clusterStepSetting:${stepId}:${fieldKey}`;
|
|
50182
|
-
}
|
|
50183
|
-
var ClusterSettingNumberSchema = number().finite();
|
|
50184
|
-
function readClusterStepSettings(config) {
|
|
50185
|
-
const out = {};
|
|
50186
|
-
for (const field of CLUSTER_STEP_SETTING_FIELDS) {
|
|
50187
|
-
const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
|
|
50188
|
-
const value = parsed.success ? parsed.data : field.default;
|
|
50189
|
-
const existing = out[field.stepId] ?? {};
|
|
50190
|
-
out[field.stepId] = {
|
|
50191
|
-
...existing,
|
|
50192
|
-
[field.key]: value
|
|
50193
|
-
};
|
|
50194
|
-
}
|
|
50195
|
-
return out;
|
|
50196
|
-
}
|
|
50197
|
-
readClusterStepSettings({});
|
|
50198
51933
|
object({
|
|
50199
51934
|
/**
|
|
50200
51935
|
* Fraction of the box's own size added on EACH side before cutting.
|
|
@@ -50438,6 +52173,232 @@ function buildAuthHeader(input) {
|
|
|
50438
52173
|
return `Digest ${parts.join(", ")}`;
|
|
50439
52174
|
}
|
|
50440
52175
|
//#endregion
|
|
52176
|
+
//#region src/event-stream-parts.ts
|
|
52177
|
+
var CRLF_CRLF = Buffer.from("\r\n\r\n", "latin1");
|
|
52178
|
+
var LF_LF = Buffer.from("\n\n", "latin1");
|
|
52179
|
+
var CLOSE_SUFFIX = "--";
|
|
52180
|
+
var CONTENT_LENGTH_RE = /^content-length\s*:\s*(\d+)\s*$/im;
|
|
52181
|
+
var HEARTBEAT_RE = /^(?:code=)?heartbeat(?:;|$)/i;
|
|
52182
|
+
/**
|
|
52183
|
+
* Carve every complete part out of `input`.
|
|
52184
|
+
*
|
|
52185
|
+
* `preambleConsumed` is per STREAM, not per call: RFC 1521's preamble is the
|
|
52186
|
+
* bytes before the first boundary, once. Discarding a leading fragment on every
|
|
52187
|
+
* call threw away every part on 2026-09-04 (see the pump test).
|
|
52188
|
+
*/
|
|
52189
|
+
function readCompleteParts(input, dashBoundary, preambleConsumed) {
|
|
52190
|
+
const buf = Buffer.from(input.buffer, input.byteOffset, input.byteLength);
|
|
52191
|
+
const marker = Buffer.from(dashBoundary, "latin1");
|
|
52192
|
+
const items = [];
|
|
52193
|
+
let pos = 0;
|
|
52194
|
+
if (!preambleConsumed) {
|
|
52195
|
+
const first = buf.indexOf(marker);
|
|
52196
|
+
if (first < 0) return {
|
|
52197
|
+
items,
|
|
52198
|
+
rest: input,
|
|
52199
|
+
preambleConsumed: false
|
|
52200
|
+
};
|
|
52201
|
+
pos = first;
|
|
52202
|
+
}
|
|
52203
|
+
for (;;) {
|
|
52204
|
+
pos = skipLineBreaks(buf, pos);
|
|
52205
|
+
const boundaryAt = buf.indexOf(marker, pos);
|
|
52206
|
+
if (boundaryAt < 0) break;
|
|
52207
|
+
if (boundaryAt > pos) {
|
|
52208
|
+
items.push({
|
|
52209
|
+
kind: "junk",
|
|
52210
|
+
bytes: Buffer.from(buf.subarray(pos, boundaryAt))
|
|
52211
|
+
});
|
|
52212
|
+
pos = boundaryAt;
|
|
52213
|
+
}
|
|
52214
|
+
const part = readPartAt(buf, pos, marker);
|
|
52215
|
+
if (part === null) break;
|
|
52216
|
+
if (part.kind === "part") items.push({
|
|
52217
|
+
kind: "part",
|
|
52218
|
+
body: part.body
|
|
52219
|
+
});
|
|
52220
|
+
pos = part.next;
|
|
52221
|
+
}
|
|
52222
|
+
return {
|
|
52223
|
+
items,
|
|
52224
|
+
rest: Buffer.from(buf.subarray(pos)),
|
|
52225
|
+
preambleConsumed: true
|
|
52226
|
+
};
|
|
52227
|
+
}
|
|
52228
|
+
/** Read the part whose boundary starts at `at`, or null when it is not complete yet. */
|
|
52229
|
+
function readPartAt(buf, at, marker) {
|
|
52230
|
+
const afterMarker = at + marker.length;
|
|
52231
|
+
if (buf.length < afterMarker + 2) return null;
|
|
52232
|
+
if (buf.toString("latin1", afterMarker, afterMarker + 2) === CLOSE_SUFFIX) return {
|
|
52233
|
+
kind: "close",
|
|
52234
|
+
next: afterMarker + 2
|
|
52235
|
+
};
|
|
52236
|
+
const nextMarker = buf.indexOf(marker, afterMarker);
|
|
52237
|
+
const terminator = findHeaderTerminator(buf, afterMarker);
|
|
52238
|
+
const headerEnd = terminator?.at ?? -1;
|
|
52239
|
+
if (!(headerEnd >= 0 && (nextMarker < 0 || headerEnd < nextMarker))) {
|
|
52240
|
+
if (nextMarker < 0) return null;
|
|
52241
|
+
return {
|
|
52242
|
+
kind: "part",
|
|
52243
|
+
body: Buffer.from(buf.subarray(afterMarker, nextMarker)),
|
|
52244
|
+
next: nextMarker
|
|
52245
|
+
};
|
|
52246
|
+
}
|
|
52247
|
+
const bodyStart = headerEnd + (terminator?.length ?? 0);
|
|
52248
|
+
const contentLength = parseContentLength(buf.toString("latin1", afterMarker, headerEnd));
|
|
52249
|
+
if (contentLength === null) {
|
|
52250
|
+
if (nextMarker < 0) return null;
|
|
52251
|
+
return {
|
|
52252
|
+
kind: "part",
|
|
52253
|
+
body: Buffer.from(buf.subarray(bodyStart, nextMarker)),
|
|
52254
|
+
next: nextMarker
|
|
52255
|
+
};
|
|
52256
|
+
}
|
|
52257
|
+
const bodyEnd = bodyStart + contentLength;
|
|
52258
|
+
if (nextMarker >= 0 && nextMarker < bodyEnd) return {
|
|
52259
|
+
kind: "part",
|
|
52260
|
+
body: Buffer.from(buf.subarray(bodyStart, nextMarker)),
|
|
52261
|
+
next: nextMarker
|
|
52262
|
+
};
|
|
52263
|
+
if (buf.length < bodyEnd) return null;
|
|
52264
|
+
return {
|
|
52265
|
+
kind: "part",
|
|
52266
|
+
body: Buffer.from(buf.subarray(bodyStart, bodyEnd)),
|
|
52267
|
+
next: bodyEnd
|
|
52268
|
+
};
|
|
52269
|
+
}
|
|
52270
|
+
/**
|
|
52271
|
+
* The blank line that ends a part's headers: CRLFCRLF by the spec, bare LFLF
|
|
52272
|
+
* from a firmware that writes Unix line ends. Accepting only CRLF would drop a
|
|
52273
|
+
* bare-LF part into the no-header branch, which waits for the next boundary —
|
|
52274
|
+
* the very lag D669 removes, back in silence.
|
|
52275
|
+
*/
|
|
52276
|
+
function findHeaderTerminator(buf, from) {
|
|
52277
|
+
const crlf = buf.indexOf(CRLF_CRLF, from);
|
|
52278
|
+
const lf = buf.indexOf(LF_LF, from);
|
|
52279
|
+
if (crlf < 0 && lf < 0) return null;
|
|
52280
|
+
if (lf < 0 || crlf >= 0 && crlf < lf) return {
|
|
52281
|
+
at: crlf,
|
|
52282
|
+
length: CRLF_CRLF.length
|
|
52283
|
+
};
|
|
52284
|
+
return {
|
|
52285
|
+
at: lf,
|
|
52286
|
+
length: LF_LF.length
|
|
52287
|
+
};
|
|
52288
|
+
}
|
|
52289
|
+
function parseContentLength(headers) {
|
|
52290
|
+
const m = CONTENT_LENGTH_RE.exec(headers);
|
|
52291
|
+
if (!m) return null;
|
|
52292
|
+
const n = Number.parseInt(m[1], 10);
|
|
52293
|
+
return Number.isSafeInteger(n) ? n : null;
|
|
52294
|
+
}
|
|
52295
|
+
function skipLineBreaks(buf, from) {
|
|
52296
|
+
let i = from;
|
|
52297
|
+
while (i < buf.length && (buf[i] === 13 || buf[i] === 10)) i++;
|
|
52298
|
+
return i;
|
|
52299
|
+
}
|
|
52300
|
+
function concatBytes(a, b) {
|
|
52301
|
+
const out = new Uint8Array(a.byteLength + b.byteLength);
|
|
52302
|
+
out.set(a, 0);
|
|
52303
|
+
out.set(b, a.byteLength);
|
|
52304
|
+
return out;
|
|
52305
|
+
}
|
|
52306
|
+
/**
|
|
52307
|
+
* A `heartbeat=N` keep-alive part: the bare body `Heartbeat` (or, on some
|
|
52308
|
+
* firmwares, `Code=Heartbeat`). It proves the stream is alive and is never an
|
|
52309
|
+
* event.
|
|
52310
|
+
*/
|
|
52311
|
+
function isHeartbeat(bodyText) {
|
|
52312
|
+
return HEARTBEAT_RE.test(bodyText);
|
|
52313
|
+
}
|
|
52314
|
+
function classify(item, observedAt) {
|
|
52315
|
+
if (item.kind === "junk") return {
|
|
52316
|
+
kind: "unparsed",
|
|
52317
|
+
reason: "block",
|
|
52318
|
+
preview: Buffer.from(item.bytes).toString("utf8").slice(0, 160)
|
|
52319
|
+
};
|
|
52320
|
+
const bodyText = Buffer.from(item.body).toString("utf8").trim();
|
|
52321
|
+
if (isHeartbeat(bodyText)) return { kind: "heartbeat" };
|
|
52322
|
+
const event = parseAmcrestEventBody(bodyText, observedAt);
|
|
52323
|
+
if (event === null) return {
|
|
52324
|
+
kind: "unparsed",
|
|
52325
|
+
reason: "body",
|
|
52326
|
+
preview: bodyText.slice(0, 160)
|
|
52327
|
+
};
|
|
52328
|
+
return {
|
|
52329
|
+
kind: "event",
|
|
52330
|
+
event
|
|
52331
|
+
};
|
|
52332
|
+
}
|
|
52333
|
+
/** Bytes kept from the END of the buffer when the cap trips — enough to hold a
|
|
52334
|
+
* whole part plus the boundary that frames it. */
|
|
52335
|
+
var EVENT_STREAM_BUFFER_RETAIN_BYTES = 65536;
|
|
52336
|
+
/**
|
|
52337
|
+
* Pump the attach stream: every chunk is appended to the carry buffer and
|
|
52338
|
+
* every part it completes is delivered before the next chunk is awaited.
|
|
52339
|
+
*
|
|
52340
|
+
* `onBytes` names every chunk except one that carried nothing but complete
|
|
52341
|
+
* heartbeats — at `heartbeat=5` those would be twelve lines a minute of
|
|
52342
|
+
* nothing, and the stream's liveness is not what that line is for.
|
|
52343
|
+
*/
|
|
52344
|
+
async function pumpEventStream(stream, boundary, handlers) {
|
|
52345
|
+
const dashBoundary = `--${boundary}`;
|
|
52346
|
+
let buffered = new Uint8Array(0);
|
|
52347
|
+
let preambleConsumed = false;
|
|
52348
|
+
try {
|
|
52349
|
+
for await (const chunk of stream) {
|
|
52350
|
+
const value = chunk instanceof Uint8Array ? chunk : new Uint8Array(0);
|
|
52351
|
+
if (value.byteLength === 0) continue;
|
|
52352
|
+
const observedAt = Date.now();
|
|
52353
|
+
const read = readCompleteParts(concatBytes(buffered, value), dashBoundary, preambleConsumed);
|
|
52354
|
+
buffered = read.rest;
|
|
52355
|
+
preambleConsumed = read.preambleConsumed;
|
|
52356
|
+
if (buffered.byteLength > 1048576) {
|
|
52357
|
+
handlers.onBufferOverflow?.(buffered.byteLength - EVENT_STREAM_BUFFER_RETAIN_BYTES, new TextDecoder().decode(buffered.slice(0, 120)));
|
|
52358
|
+
buffered = buffered.slice(buffered.byteLength - EVENT_STREAM_BUFFER_RETAIN_BYTES);
|
|
52359
|
+
preambleConsumed = false;
|
|
52360
|
+
}
|
|
52361
|
+
const deliveries = read.items.map((item) => classify(item, observedAt));
|
|
52362
|
+
if (!(deliveries.length > 0 && buffered.byteLength === 0 && deliveries.every((d) => d.kind === "heartbeat"))) handlers.onBytes?.(value.byteLength, new TextDecoder().decode(value.slice(0, 120)));
|
|
52363
|
+
for (const d of deliveries) if (d.kind === "event") handlers.onEvent(d.event);
|
|
52364
|
+
else if (d.kind === "unparsed") handlers.onUnparsedBlock?.(d.reason, d.preview);
|
|
52365
|
+
}
|
|
52366
|
+
} finally {
|
|
52367
|
+
stream.destroy();
|
|
52368
|
+
}
|
|
52369
|
+
}
|
|
52370
|
+
/**
|
|
52371
|
+
* Parse a Dahua event block body. The salient line is a `;`-delimited
|
|
52372
|
+
* key=value list, e.g. `Code=VideoMotion;action=Start;index=0`. A
|
|
52373
|
+
* trailing multi-line `data={…}` JSON blob (present on some firmwares) is
|
|
52374
|
+
* ignored — motion needs only code/action/index. Returns null when no
|
|
52375
|
+
* `Code=` line is present.
|
|
52376
|
+
*
|
|
52377
|
+
* `observedAt` is when the chunk that COMPLETED the part arrived — with parts
|
|
52378
|
+
* delivered on completion, that is when the camera sent it.
|
|
52379
|
+
*/
|
|
52380
|
+
function parseAmcrestEventBody(body, observedAt) {
|
|
52381
|
+
const codeLine = body.split(/\r?\n/).find((l) => l.includes("Code=")) ?? "";
|
|
52382
|
+
if (!codeLine) return null;
|
|
52383
|
+
const fields = /* @__PURE__ */ new Map();
|
|
52384
|
+
for (const pair of codeLine.split(";")) {
|
|
52385
|
+
const eq = pair.indexOf("=");
|
|
52386
|
+
if (eq < 0) continue;
|
|
52387
|
+
fields.set(pair.slice(0, eq).trim().toLowerCase(), pair.slice(eq + 1).trim());
|
|
52388
|
+
}
|
|
52389
|
+
const code = fields.get("code");
|
|
52390
|
+
const action = fields.get("action");
|
|
52391
|
+
if (!code || !action) return null;
|
|
52392
|
+
const indexRaw = fields.get("index");
|
|
52393
|
+
return {
|
|
52394
|
+
observedAt,
|
|
52395
|
+
code,
|
|
52396
|
+
action,
|
|
52397
|
+
index: indexRaw !== void 0 && /^\d+$/.test(indexRaw) ? Number.parseInt(indexRaw, 10) : null,
|
|
52398
|
+
raw: body
|
|
52399
|
+
};
|
|
52400
|
+
}
|
|
52401
|
+
//#endregion
|
|
50441
52402
|
//#region src/amcrest-cgi-client.ts
|
|
50442
52403
|
/**
|
|
50443
52404
|
* Thin HTTP-Digest client for the Amcrest/Dahua CGI surface. One instance
|
|
@@ -50722,7 +52683,7 @@ var AmcrestCgiClient = class AmcrestCgiClient {
|
|
|
50722
52683
|
* as `setConfig`), e.g. `'[VideoMotion]'` or `'[All]'`.
|
|
50723
52684
|
*/
|
|
50724
52685
|
async openEventStream(codes, signal) {
|
|
50725
|
-
const path =
|
|
52686
|
+
const path = eventStreamPath(codes);
|
|
50726
52687
|
const first = await this.dialEventStream(path, signal);
|
|
50727
52688
|
if (first.res.statusCode !== 401) return first;
|
|
50728
52689
|
first.res.resume();
|
|
@@ -50854,6 +52815,10 @@ var AmcrestCgiClient = class AmcrestCgiClient {
|
|
|
50854
52815
|
}));
|
|
50855
52816
|
}
|
|
50856
52817
|
};
|
|
52818
|
+
/** The attach path — `codes` unescaped, because Dahua requires the literal `[...]`. */
|
|
52819
|
+
function eventStreamPath(codes) {
|
|
52820
|
+
return `/cgi-bin/eventManager.cgi?action=attach&codes=${codes}&heartbeat=5`;
|
|
52821
|
+
}
|
|
50857
52822
|
/**
|
|
50858
52823
|
* Subscribe to a camera's Dahua CGI event-manager attach stream. Returns
|
|
50859
52824
|
* an `AbortController` — `controller.abort()` tears the subscription
|
|
@@ -50863,7 +52828,8 @@ var AmcrestCgiClient = class AmcrestCgiClient {
|
|
|
50863
52828
|
* providers read the same way.
|
|
50864
52829
|
*
|
|
50865
52830
|
* Unlike Hikvision's XML alert stream, Dahua parts are `text/plain`
|
|
50866
|
-
* key=value blocks
|
|
52831
|
+
* key=value blocks, read and projected in `event-stream-parts.ts`. A part is
|
|
52832
|
+
* delivered when it is complete, never when the next one begins (D669).
|
|
50867
52833
|
*/
|
|
50868
52834
|
function subscribeAmcrestEvents(client, codes, handlers) {
|
|
50869
52835
|
const controller = new AbortController();
|
|
@@ -50895,115 +52861,6 @@ function parseBoundary(contentType) {
|
|
|
50895
52861
|
const m = /boundary\s*=\s*"?([^";\s]+)"?/i.exec(contentType);
|
|
50896
52862
|
return m ? m[1].trim() : null;
|
|
50897
52863
|
}
|
|
50898
|
-
async function pumpEventStream(stream, boundary, handlers) {
|
|
50899
|
-
const dashBoundary = `--${boundary}`;
|
|
50900
|
-
let bufferedBytes = new Uint8Array(0);
|
|
50901
|
-
let preambleConsumed = false;
|
|
50902
|
-
try {
|
|
50903
|
-
for await (const chunk of stream) {
|
|
50904
|
-
const value = chunk instanceof Uint8Array ? chunk : new Uint8Array(0);
|
|
50905
|
-
if (value.byteLength === 0) continue;
|
|
50906
|
-
handlers.onBytes?.(value.byteLength, new TextDecoder().decode(value.slice(0, 120)));
|
|
50907
|
-
bufferedBytes = concatBytes(bufferedBytes, value);
|
|
50908
|
-
const parts = splitOnBoundary(bufferedBytes, dashBoundary, preambleConsumed);
|
|
50909
|
-
if (parts.blocks.length > 0 || parts.tail !== bufferedBytes) preambleConsumed = true;
|
|
50910
|
-
bufferedBytes = parts.tail;
|
|
50911
|
-
for (const block of parts.blocks) {
|
|
50912
|
-
const parsed = parseMultipartBlock(block);
|
|
50913
|
-
if (!parsed) {
|
|
50914
|
-
handlers.onUnparsedBlock?.("block", new TextDecoder().decode(block).slice(0, 160));
|
|
50915
|
-
continue;
|
|
50916
|
-
}
|
|
50917
|
-
const ev = parseAmcrestEventBody(parsed.bodyText);
|
|
50918
|
-
if (!ev) {
|
|
50919
|
-
handlers.onUnparsedBlock?.("body", parsed.bodyText.slice(0, 160));
|
|
50920
|
-
continue;
|
|
50921
|
-
}
|
|
50922
|
-
handlers.onEvent(ev);
|
|
50923
|
-
}
|
|
50924
|
-
}
|
|
50925
|
-
} finally {
|
|
50926
|
-
stream.destroy();
|
|
50927
|
-
}
|
|
50928
|
-
}
|
|
50929
|
-
function concatBytes(a, b) {
|
|
50930
|
-
const out = new Uint8Array(a.byteLength + b.byteLength);
|
|
50931
|
-
out.set(a, 0);
|
|
50932
|
-
out.set(b, a.byteLength);
|
|
50933
|
-
return out;
|
|
50934
|
-
}
|
|
50935
|
-
/**
|
|
50936
|
-
* Split the running buffer on the multipart boundary.
|
|
50937
|
-
*
|
|
50938
|
-
* `preambleConsumed` is NOT optional bookkeeping. RFC 1521 says the bytes before
|
|
50939
|
-
* the FIRST boundary are a preamble to discard — but that is true exactly once
|
|
50940
|
-
* per stream. This function used to `shift()` unconditionally on every pump
|
|
50941
|
-
* cycle, and from the second cycle on the leading fragment is not a preamble at
|
|
50942
|
-
* all: it is the body of the part the newly-arrived boundary just CLOSED. So
|
|
50943
|
-
* every completed block was thrown away as preamble, `blocks` came back empty
|
|
50944
|
-
* forever, and the caller's loop never ran — no event, and no dropped-block
|
|
50945
|
-
* warning either, because there was nothing in the array to warn about.
|
|
50946
|
-
*
|
|
50947
|
-
* Cost of that one line: this camera's onboard motion never reached the
|
|
50948
|
-
* pipeline. It streamed video fine, reported `enabled: true`, held an
|
|
50949
|
-
* ESTABLISHED socket, and delivered `--myboundary` chunks that were parsed into
|
|
50950
|
-
* nothing. Two hand-rolled probes against the same camera worked throughout —
|
|
50951
|
-
* because they regex the raw lines and never split on the boundary at all.
|
|
50952
|
-
*/
|
|
50953
|
-
function splitOnBoundary(buf, dashBoundary, preambleConsumed) {
|
|
50954
|
-
const parts = Buffer.from(buf).toString("binary").split(dashBoundary);
|
|
50955
|
-
if (parts.length <= 1) return {
|
|
50956
|
-
blocks: [],
|
|
50957
|
-
tail: buf
|
|
50958
|
-
};
|
|
50959
|
-
const tail = Buffer.from(parts.pop(), "binary");
|
|
50960
|
-
if (!preambleConsumed) parts.shift();
|
|
50961
|
-
return {
|
|
50962
|
-
blocks: parts.filter((p) => p.length > 0 && !p.startsWith("--")).map((p) => Buffer.from(p, "binary")),
|
|
50963
|
-
tail
|
|
50964
|
-
};
|
|
50965
|
-
}
|
|
50966
|
-
function parseMultipartBlock(block) {
|
|
50967
|
-
let start = 0;
|
|
50968
|
-
while (start < block.length && (block[start] === 13 || block[start] === 10)) start++;
|
|
50969
|
-
const headerEnd = findHeaderEnd(block, start);
|
|
50970
|
-
const bodyStart = headerEnd < 0 ? start : headerEnd + 4;
|
|
50971
|
-
const bodySlice = block.subarray(bodyStart);
|
|
50972
|
-
return { bodyText: Buffer.from(bodySlice).toString("utf8").replace(/\r?\n--$/m, "").trim() };
|
|
50973
|
-
}
|
|
50974
|
-
function findHeaderEnd(buf, from) {
|
|
50975
|
-
for (let i = from; i + 3 < buf.length; i++) if (buf[i] === 13 && buf[i + 1] === 10 && buf[i + 2] === 13 && buf[i + 3] === 10) return i;
|
|
50976
|
-
return -1;
|
|
50977
|
-
}
|
|
50978
|
-
/**
|
|
50979
|
-
* Parse a Dahua event block body. The salient line is a `;`-delimited
|
|
50980
|
-
* key=value list, e.g. `Code=VideoMotion;action=Start;index=0`. A
|
|
50981
|
-
* trailing multi-line `data={…}` JSON blob (present on some firmwares) is
|
|
50982
|
-
* ignored — motion needs only code/action/index. Returns null when no
|
|
50983
|
-
* `Code=` line is present (e.g. an empty heartbeat frame).
|
|
50984
|
-
*/
|
|
50985
|
-
function parseAmcrestEventBody(body) {
|
|
50986
|
-
const codeLine = body.split(/\r?\n/).find((l) => l.includes("Code=")) ?? "";
|
|
50987
|
-
if (!codeLine) return null;
|
|
50988
|
-
const fields = /* @__PURE__ */ new Map();
|
|
50989
|
-
for (const pair of codeLine.split(";")) {
|
|
50990
|
-
const eq = pair.indexOf("=");
|
|
50991
|
-
if (eq < 0) continue;
|
|
50992
|
-
fields.set(pair.slice(0, eq).trim().toLowerCase(), pair.slice(eq + 1).trim());
|
|
50993
|
-
}
|
|
50994
|
-
const code = fields.get("code");
|
|
50995
|
-
const action = fields.get("action");
|
|
50996
|
-
if (!code || !action) return null;
|
|
50997
|
-
const indexRaw = fields.get("index");
|
|
50998
|
-
const index = indexRaw !== void 0 && /^\d+$/.test(indexRaw) ? Number.parseInt(indexRaw, 10) : null;
|
|
50999
|
-
return {
|
|
51000
|
-
observedAt: Date.now(),
|
|
51001
|
-
code,
|
|
51002
|
-
action,
|
|
51003
|
-
index,
|
|
51004
|
-
raw: body
|
|
51005
|
-
};
|
|
51006
|
-
}
|
|
51007
52864
|
var DAY_NIGHT_NATIVE_TO_CAP = {
|
|
51008
52865
|
Brightness: "auto",
|
|
51009
52866
|
Color: "day",
|
|
@@ -52504,6 +54361,15 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
|
|
|
52504
54361
|
}
|
|
52505
54362
|
});
|
|
52506
54363
|
},
|
|
54364
|
+
onBufferOverflow: (droppedBytes, preview) => {
|
|
54365
|
+
this.ctx.logger.warn("amcrest: event stream buffer hit its cap — discarded the head, resyncing on the next boundary", {
|
|
54366
|
+
tags: { deviceId: this.id },
|
|
54367
|
+
meta: {
|
|
54368
|
+
droppedBytes,
|
|
54369
|
+
preview
|
|
54370
|
+
}
|
|
54371
|
+
});
|
|
54372
|
+
},
|
|
52507
54373
|
onUnparsedBlock: (reason, preview) => {
|
|
52508
54374
|
this.ctx.logger.warn("amcrest: event block dropped — could not be parsed", {
|
|
52509
54375
|
tags: { deviceId: this.id },
|