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