@camstack/system 1.2.304 → 1.2.306
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-runner.js +1 -1
- package/dist/addon-runner.mjs +1 -1
- package/dist/addon-utils.d.ts +1 -1
- package/dist/addon-utils.js +3 -1
- package/dist/addon-utils.mjs +2 -2
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
- package/dist/builtins/device-manager/device-extension-linked-slot.d.ts +27 -0
- package/dist/builtins/device-manager/device-linked-devices.d.ts +55 -13
- package/dist/builtins/device-manager/device-manager.addon.js +324 -136
- package/dist/builtins/device-manager/device-manager.addon.mjs +324 -136
- package/dist/builtins/doorbell/binding-mirror.d.ts +37 -7
- package/dist/builtins/doorbell/doorbell-extension-slot.d.ts +66 -0
- package/dist/builtins/doorbell/virtual-doorbell.addon.d.ts +17 -36
- package/dist/builtins/doorbell/virtual-doorbell.addon.js +320 -124
- package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +320 -124
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +1 -1
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{child-cap-dispatch-C1c3rWaX.mjs → child-cap-dispatch-BCJjUtXV.mjs} +9 -1
- package/dist/{child-cap-dispatch-De5_HcvR.js → child-cap-dispatch-Be8e2cBP.js} +9 -1
- package/dist/{dist-Duqf80QM.mjs → dist-CLfJMMdf.mjs} +1056 -349
- package/dist/{dist-C571Y95Z.js → dist-vecbhDzu.js} +1079 -354
- package/dist/download/model-downloader.d.ts +15 -0
- package/dist/{event-loop-stall-monitor-GPrVvx14.mjs → event-loop-stall-monitor-EXjzIxDz.mjs} +25 -3
- package/dist/{event-loop-stall-monitor-CAsHdMwP.js → event-loop-stall-monitor-ey4mbofz.js} +36 -2
- package/dist/index.js +21 -3
- package/dist/index.mjs +21 -3
- package/dist/kernel/config-manager.d.ts +3 -1
- package/dist/{retired-settings-keys-0j8rNoa8.js → retired-settings-keys-Bm2p0Rot.js} +1 -1
- package/dist/{retired-settings-keys-CeO_dBHU.mjs → retired-settings-keys-C1ODcdnr.mjs} +1 -1
- package/package.json +7 -1
- package/dist/builtins/device-manager/device-store-sections.d.ts +0 -26
|
@@ -691,7 +691,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
691
691
|
return EventCategory;
|
|
692
692
|
}({});
|
|
693
693
|
//#endregion
|
|
694
|
-
//#region ../types/dist/sleep-
|
|
694
|
+
//#region ../types/dist/sleep-DC-wdyeS.mjs
|
|
695
695
|
/**
|
|
696
696
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
697
697
|
* window to float samples (D455).
|
|
@@ -1493,6 +1493,40 @@ var BaseAddon = class {
|
|
|
1493
1493
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
1494
1494
|
return keys.size > 0 ? projectStore(raw, keys, node) : raw;
|
|
1495
1495
|
}
|
|
1496
|
+
/**
|
|
1497
|
+
* Whether ONE global key of this addon's store was written, read three-way
|
|
1498
|
+
* (D651). For a question a hydrated view cannot answer: `getGlobalSettings`
|
|
1499
|
+
* reports `value ?? default`, so "the operator chose the default" and "nobody
|
|
1500
|
+
* chose" look the same, and a failed read looks like both. A `perNode` key is
|
|
1501
|
+
* not supported here: its stored name is scoped.
|
|
1502
|
+
*/
|
|
1503
|
+
async readStoredGlobalKey(key) {
|
|
1504
|
+
const read = this._ctx?.settings?.readAddonStoreResult;
|
|
1505
|
+
if (read === void 0) return {
|
|
1506
|
+
kind: "unreadable",
|
|
1507
|
+
reason: "three-way-read-unavailable"
|
|
1508
|
+
};
|
|
1509
|
+
let result;
|
|
1510
|
+
try {
|
|
1511
|
+
result = await read.call(this._ctx?.settings);
|
|
1512
|
+
} catch (err) {
|
|
1513
|
+
return {
|
|
1514
|
+
kind: "unreadable",
|
|
1515
|
+
reason: "store-read-failed",
|
|
1516
|
+
error: err instanceof Error ? err.message : String(err)
|
|
1517
|
+
};
|
|
1518
|
+
}
|
|
1519
|
+
if (result.kind === "failed") return {
|
|
1520
|
+
kind: "unreadable",
|
|
1521
|
+
reason: "store-read-failed",
|
|
1522
|
+
error: result.error
|
|
1523
|
+
};
|
|
1524
|
+
if (result.kind === "missing" || !Object.prototype.hasOwnProperty.call(result.value, key)) return { kind: "absent" };
|
|
1525
|
+
return {
|
|
1526
|
+
kind: "present",
|
|
1527
|
+
value: result.value[key]
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1496
1530
|
async updateGlobalSettings(patch, nodeId) {
|
|
1497
1531
|
const keys = this.perNodeKeys();
|
|
1498
1532
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
@@ -6389,6 +6423,43 @@ function reducePoints(points, bucketMs, origin) {
|
|
|
6389
6423
|
}
|
|
6390
6424
|
return [...buckets.values()].toSorted((a, b) => a.atMs - b.atMs);
|
|
6391
6425
|
}
|
|
6426
|
+
var ClipModelMetaSchema = zod.z.object({
|
|
6427
|
+
/** The paired text encoder's catalog id (the embedding-encoder's text catalog). */
|
|
6428
|
+
textModelId: zod.z.string().min(1),
|
|
6429
|
+
/** Output dimension of BOTH towers. A vector of any other length is refused. */
|
|
6430
|
+
embeddingDim: zod.z.number().int().positive(),
|
|
6431
|
+
/**
|
|
6432
|
+
* The `vector-store` index this model's vectors live in. ONE feature space
|
|
6433
|
+
* per index: two models share an index only when their vectors are ranked
|
|
6434
|
+
* against each other, which for CLIP means never across families. MobileCLIP
|
|
6435
|
+
* S1 and S2 share `object-clip` for history (separated by the row's
|
|
6436
|
+
* `modelId`); any other model gets its own.
|
|
6437
|
+
*/
|
|
6438
|
+
vectorIndex: zod.z.string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
|
|
6439
|
+
/**
|
|
6440
|
+
* The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
|
|
6441
|
+
* must be unique per tokenizer: every model's siblings land in ONE flat
|
|
6442
|
+
* models directory, so two different tokenizers under the same name would
|
|
6443
|
+
* silently overwrite each other (whichever model downloaded last wins, and
|
|
6444
|
+
* the other one tokenises with the wrong vocabulary).
|
|
6445
|
+
*/
|
|
6446
|
+
tokenizerFile: zod.z.string().min(1),
|
|
6447
|
+
/** Token window the text graph takes (SigLIP2: 64; CLIP BPE: 77). */
|
|
6448
|
+
contextLength: zod.z.number().int().positive(),
|
|
6449
|
+
/** Id the tokenizer pads with. */
|
|
6450
|
+
padId: zod.z.number().int().nonnegative(),
|
|
6451
|
+
/**
|
|
6452
|
+
* The search cosine floor at `strictness: 'loose'` — calibrated per model,
|
|
6453
|
+
* because cosine bands are a property of the model: 0.2 keeps 96% of matched
|
|
6454
|
+
* COCO caption-image pairs on MobileCLIP S1 and 2.7% on SigLIP2.
|
|
6455
|
+
*/
|
|
6456
|
+
searchMinScore: zod.z.number().min(0).max(1)
|
|
6457
|
+
});
|
|
6458
|
+
var ClipSearchStrictnessSchema = zod.z.enum([
|
|
6459
|
+
"loose",
|
|
6460
|
+
"balanced",
|
|
6461
|
+
"strict"
|
|
6462
|
+
]);
|
|
6392
6463
|
var MODEL_FORMATS = [
|
|
6393
6464
|
"onnx",
|
|
6394
6465
|
"coreml",
|
|
@@ -6592,7 +6663,14 @@ var ModelCatalogEntrySchema = zod.z.object({
|
|
|
6592
6663
|
* applies (Frigate / COCO public catalog). Set on a custom model whose raw
|
|
6593
6664
|
* labels already ARE the CamStack macros (Scrypted identity map).
|
|
6594
6665
|
*/
|
|
6595
|
-
classMap: DetectionCatalogClassMapSchema.optional()
|
|
6666
|
+
classMap: DetectionCatalogClassMapSchema.optional(),
|
|
6667
|
+
/**
|
|
6668
|
+
* The model's CLIP feature-space contract (text encoder, dimension, vector
|
|
6669
|
+
* index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
|
|
6670
|
+
* CLIP image encoder; its absence is what "not a CLIP model" means to the
|
|
6671
|
+
* embedding encoder and the semantic-search store (D649).
|
|
6672
|
+
*/
|
|
6673
|
+
clip: ClipModelMetaSchema.optional()
|
|
6596
6674
|
});
|
|
6597
6675
|
var ConvertTargetSchema = zod.z.discriminatedUnion("format", [zod.z.object({
|
|
6598
6676
|
format: zod.z.literal("openvino"),
|
|
@@ -12617,6 +12695,42 @@ var LinkedDeviceSchema = zod.z.object({
|
|
|
12617
12695
|
features: zod.z.array(zod.z.string()),
|
|
12618
12696
|
producesTrackedEvents: zod.z.boolean().optional()
|
|
12619
12697
|
});
|
|
12698
|
+
/**
|
|
12699
|
+
* The `linked-devices` extension slot's editable value (D648): the operator's
|
|
12700
|
+
* pick list, exactly what `_linkedDeviceIds` persists. Tree children are NOT
|
|
12701
|
+
* in it — they are always linked and are not a pick.
|
|
12702
|
+
*
|
|
12703
|
+
* `trackedDeviceIds` (D655) is the tracked-event opt-in, exactly what
|
|
12704
|
+
* `_linkedDeviceTrackedIds` persists: which linked devices materialize a
|
|
12705
|
+
* synthetic tracked event on the camera. A read always carries it AS STORED
|
|
12706
|
+
* (an absent key reads as `[]`, which is what the resolver makes of it —
|
|
12707
|
+
* NONE). On a write it is optional: absent leaves the opt-in untouched, so a
|
|
12708
|
+
* card built before D655 cannot erase it by saving the pick list. A present
|
|
12709
|
+
* list REPLACES the opt-in; each id must be a pick, a device the camera links
|
|
12710
|
+
* by structure (the row's `impliedSources`: tree children, a picked
|
|
12711
|
+
* container's child) or already stored — so what was read can always be
|
|
12712
|
+
* written back unchanged, and a NEW opt-in outside the linked set is refused.
|
|
12713
|
+
*/
|
|
12714
|
+
var LinkedDevicesSlotValueSchema = zod.z.object({
|
|
12715
|
+
deviceIds: zod.z.array(zod.z.number().int().positive()),
|
|
12716
|
+
trackedDeviceIds: zod.z.array(zod.z.number().int().positive()).optional()
|
|
12717
|
+
});
|
|
12718
|
+
/**
|
|
12719
|
+
* The `linked-devices` slot — a camera's companion devices, owned by the
|
|
12720
|
+
* device manager over `_linkedDeviceIds` (D648, D356). Any device may be a
|
|
12721
|
+
* source except a container (its children are picked in its place) and the
|
|
12722
|
+
* camera itself.
|
|
12723
|
+
*/
|
|
12724
|
+
var LINKED_DEVICES_SLOT = {
|
|
12725
|
+
id: "linked-devices",
|
|
12726
|
+
label: "Linked devices",
|
|
12727
|
+
description: "Companion devices of this camera: their controls appear with it, and the ones you opt in produce tracked events on it.",
|
|
12728
|
+
shape: "association",
|
|
12729
|
+
hostDeviceTypes: [DeviceType.Camera],
|
|
12730
|
+
sourceCaps: "any",
|
|
12731
|
+
cardinality: "many",
|
|
12732
|
+
value: LinkedDevicesSlotValueSchema
|
|
12733
|
+
};
|
|
12620
12734
|
/** One camera's resolved linked set, tagged with the camera it belongs to.
|
|
12621
12735
|
* The batch answer needs the tag; the single-device answer already has it
|
|
12622
12736
|
* from the input, which is why `getLinkedDevices` keeps the untagged shape. */
|
|
@@ -12766,7 +12880,7 @@ var deviceManagerCapability = {
|
|
|
12766
12880
|
name: "device-manager",
|
|
12767
12881
|
scope: "system",
|
|
12768
12882
|
mode: "singleton",
|
|
12769
|
-
|
|
12883
|
+
extensionSlots: [LINKED_DEVICES_SLOT],
|
|
12770
12884
|
methods: {
|
|
12771
12885
|
/** Reserve (or re-resolve) a progressive numeric id for `(addonId, stableId)`.
|
|
12772
12886
|
* Idempotent: returns the existing id if one is already persisted for the
|
|
@@ -13269,11 +13383,12 @@ var deviceManagerCapability = {
|
|
|
13269
13383
|
/**
|
|
13270
13384
|
* Resolve the devices LINKED to a camera — the single policy authority
|
|
13271
13385
|
* both consumers call (viewer devices panel + pipeline-analytics event
|
|
13272
|
-
* kinds/ingest). Device-tree children are ALWAYS included
|
|
13273
|
-
*
|
|
13274
|
-
*
|
|
13275
|
-
* camera itself; deduped.
|
|
13276
|
-
*
|
|
13386
|
+
* kinds/ingest). Device-tree children are ALWAYS included, plus the
|
|
13387
|
+
* operator's persisted pick list (`mode` is always `manual` since D356:
|
|
13388
|
+
* same-location devices are suggested by the picker, never linked on
|
|
13389
|
+
* their own). Excludes the camera itself; deduped. The list is written by
|
|
13390
|
+
* the `linked-devices` extension slot over `_linkedDeviceIds` (see the
|
|
13391
|
+
* module docblock).
|
|
13277
13392
|
*/
|
|
13278
13393
|
getLinkedDevices: method(zod.z.object({ deviceId: zod.z.number() }), zod.z.object({
|
|
13279
13394
|
mode: LinkedDevicesModeSchema,
|
|
@@ -13818,11 +13933,98 @@ var EmbeddingResultSchema = zod.z.object({
|
|
|
13818
13933
|
embedding: zod.z.array(zod.z.number()),
|
|
13819
13934
|
inferenceMs: zod.z.number()
|
|
13820
13935
|
});
|
|
13936
|
+
/** The two CLIP towers the encoder runs; a crash budget is kept per tower. */
|
|
13937
|
+
var EmbeddingTowerSchema = zod.z.enum(["image", "text"]);
|
|
13938
|
+
/**
|
|
13939
|
+
* A tower in the terminal `failed` state (D649, D6): it crashed or failed to
|
|
13940
|
+
* load `crashes` times within `windowMs`, and is refused by name until an
|
|
13941
|
+
* operator `resetFailedModels` or a model change — never on a timer.
|
|
13942
|
+
*
|
|
13943
|
+
* `nodeId` is the node whose tower failed. The state lives in THAT node's
|
|
13944
|
+
* encoder process (in memory — a runner respawn clears it), and one node's
|
|
13945
|
+
* answer says nothing about another's.
|
|
13946
|
+
*/
|
|
13947
|
+
var EmbeddingFailedModelSchema = zod.z.object({
|
|
13948
|
+
modelId: zod.z.string(),
|
|
13949
|
+
tower: EmbeddingTowerSchema,
|
|
13950
|
+
nodeId: zod.z.string(),
|
|
13951
|
+
crashes: zod.z.number(),
|
|
13952
|
+
windowMs: zod.z.number(),
|
|
13953
|
+
sinceMs: zod.z.number(),
|
|
13954
|
+
lastReason: zod.z.string()
|
|
13955
|
+
});
|
|
13956
|
+
/**
|
|
13957
|
+
* A model whose REQUIREMENTS can never be met on this node (D649 round 5):
|
|
13958
|
+
* an id the catalog does not know, a model URL answering 404/410, a declared
|
|
13959
|
+
* sibling (the tokenizer) that is not there. After `attempts` failed builds
|
|
13960
|
+
* it is terminally `requirements-failed`, refused by name until an operator
|
|
13961
|
+
* `resetFailedModels` or a model change — the same exits as a crashed tower.
|
|
13962
|
+
*/
|
|
13963
|
+
var EmbeddingFailedRequirementSchema = zod.z.object({
|
|
13964
|
+
modelId: zod.z.string(),
|
|
13965
|
+
tower: EmbeddingTowerSchema,
|
|
13966
|
+
nodeId: zod.z.string(),
|
|
13967
|
+
attempts: zod.z.number(),
|
|
13968
|
+
sinceMs: zod.z.number(),
|
|
13969
|
+
lastReason: zod.z.string()
|
|
13970
|
+
});
|
|
13821
13971
|
var EmbeddingInfoSchema = zod.z.object({
|
|
13822
13972
|
modelId: zod.z.string(),
|
|
13823
13973
|
embeddingDim: zod.z.number(),
|
|
13824
|
-
ready: zod.z.boolean()
|
|
13825
|
-
|
|
13974
|
+
ready: zod.z.boolean(),
|
|
13975
|
+
/**
|
|
13976
|
+
* The node that answered. Absent only from an encoder older than D649's
|
|
13977
|
+
* crash budget — whose `failedModels` is then UNKNOWN (D315), never "none".
|
|
13978
|
+
*/
|
|
13979
|
+
nodeId: zod.z.string().optional(),
|
|
13980
|
+
/**
|
|
13981
|
+
* Towers in `failed` on the answering node, each row naming it. `undefined`
|
|
13982
|
+
* means the node could not say (pre-budget encoder); a node that has the
|
|
13983
|
+
* budget always answers an array, empty included.
|
|
13984
|
+
*/
|
|
13985
|
+
failedModels: zod.z.array(EmbeddingFailedModelSchema).optional(),
|
|
13986
|
+
/** Models terminally `requirements-failed` on the answering node; same reading as above. */
|
|
13987
|
+
failedRequirements: zod.z.array(EmbeddingFailedRequirementSchema).optional()
|
|
13988
|
+
});
|
|
13989
|
+
/**
|
|
13990
|
+
* The THREE codes an encoder refusal can carry (D649, D6). Same shape as
|
|
13991
|
+
* `VECTOR_INDEX_DIM_CONFLICT`: the code rides in the MESSAGE, because an
|
|
13992
|
+
* Error's own properties do not survive the UDS/tRPC hop and its message does,
|
|
13993
|
+
* and both sides go through the helpers below — the encoder builds the
|
|
13994
|
+
* refusal, the live detail plane classifies on it to count refusals per
|
|
13995
|
+
* camera instead of logging one warning per track. The bracketed token
|
|
13996
|
+
* carries the code, the model, the tower and the node so a consumer never
|
|
13997
|
+
* parses prose.
|
|
13998
|
+
*
|
|
13999
|
+
* - `EMBEDDING_MODEL_FAILED`: the tower crashed / failed to load past the crash
|
|
14000
|
+
* budget — terminal until `resetFailedModels` or a model change.
|
|
14001
|
+
* - `EMBEDDING_REQUIREMENTS_UNAVAILABLE`: files or runtime not there right now
|
|
14002
|
+
* (a download or Python that failed, or the cooldown after one) — the next
|
|
14003
|
+
* request past the cooldown tries again.
|
|
14004
|
+
* - `EMBEDDING_REQUIREMENTS_FAILED`: the requirements can never be met (unknown
|
|
14005
|
+
* id, 404/410, missing sibling) and the bounded attempts are spent —
|
|
14006
|
+
* terminal, same exits as a crashed tower.
|
|
14007
|
+
*/
|
|
14008
|
+
var EMBEDDING_MODEL_FAILED = "embedding-model-failed";
|
|
14009
|
+
var EMBEDDING_REQUIREMENTS_UNAVAILABLE = "embedding-requirements-unavailable";
|
|
14010
|
+
var EMBEDDING_REQUIREMENTS_FAILED = "embedding-requirements-failed";
|
|
14011
|
+
zod.z.enum([
|
|
14012
|
+
EMBEDDING_MODEL_FAILED,
|
|
14013
|
+
EMBEDDING_REQUIREMENTS_UNAVAILABLE,
|
|
14014
|
+
EMBEDDING_REQUIREMENTS_FAILED
|
|
14015
|
+
]);
|
|
14016
|
+
new RegExp(`\\[(${EMBEDDING_MODEL_FAILED}|${EMBEDDING_REQUIREMENTS_UNAVAILABLE}|${EMBEDDING_REQUIREMENTS_FAILED}) model=([^\\s\\]]+) tower=(image|text) node=([^\\s\\]]+)\\]`);
|
|
14017
|
+
/**
|
|
14018
|
+
* ONE provider per node (`placement: any-node`), addressed like every global
|
|
14019
|
+
* collection: the codegen injects a `{ nodeId?, addonId? }` selector on the
|
|
14020
|
+
* void methods and lifts a top-level `nodeId` off the object ones. A call
|
|
14021
|
+
* that names no node is answered by the HUB's provider — never by a merge
|
|
14022
|
+
* across nodes, because no global collection fans out across nodes (only the
|
|
14023
|
+
* providers of one node are `concatCollection`-fanned). So a fleet view of
|
|
14024
|
+
* `failedModels` is one `getInfo({ nodeId })` per node, and every answer
|
|
14025
|
+
* names the node it came from (D649 round 4); a node that cannot be asked is
|
|
14026
|
+
* UNKNOWN to the reader, never "no failures" (D315).
|
|
14027
|
+
*/
|
|
13826
14028
|
var embeddingEncoderCapability = {
|
|
13827
14029
|
name: "embedding-encoder",
|
|
13828
14030
|
scope: "system",
|
|
@@ -13841,8 +14043,30 @@ var embeddingEncoderCapability = {
|
|
|
13841
14043
|
width: zod.z.number(),
|
|
13842
14044
|
height: zod.z.number()
|
|
13843
14045
|
}), EmbeddingResultSchema, { auth: "admin" }),
|
|
13844
|
-
|
|
13845
|
-
|
|
14046
|
+
/**
|
|
14047
|
+
* `modelId` (a CLIP IMAGE model id, whose catalog `clip.textModelId` names
|
|
14048
|
+
* the text tower) encodes in that model's space; absent, the cluster row's
|
|
14049
|
+
* `clip-embedding` model — the space every writer is in (D649).
|
|
14050
|
+
*/
|
|
14051
|
+
encodeText: method(zod.z.object({
|
|
14052
|
+
text: zod.z.string(),
|
|
14053
|
+
modelId: zod.z.string().min(1).optional()
|
|
14054
|
+
}), EmbeddingResultSchema, { auth: "admin" }),
|
|
14055
|
+
/** Answers for ONE node — the `nodeId` selector's, else the hub's. */
|
|
14056
|
+
getInfo: method(zod.z.void(), EmbeddingInfoSchema, { auth: "admin" }),
|
|
14057
|
+
/**
|
|
14058
|
+
* The operator's explicit clear of the `failed` state (one model, or all)
|
|
14059
|
+
* on ONE node — pass `nodeId` for an agent; the result names the node it
|
|
14060
|
+
* cleared. The only way out besides a model change: a crashing tower is
|
|
14061
|
+
* not retried on a timer.
|
|
14062
|
+
*/
|
|
14063
|
+
resetFailedModels: method(zod.z.object({ modelId: zod.z.string().min(1).optional() }), zod.z.object({
|
|
14064
|
+
cleared: zod.z.array(zod.z.string()),
|
|
14065
|
+
nodeId: zod.z.string()
|
|
14066
|
+
}), {
|
|
14067
|
+
kind: "mutation",
|
|
14068
|
+
auth: "admin"
|
|
14069
|
+
})
|
|
13846
14070
|
}
|
|
13847
14071
|
};
|
|
13848
14072
|
/**
|
|
@@ -17637,7 +17861,12 @@ var NcMediaPolicySchema = zod.z.object({
|
|
|
17637
17861
|
* the degrade engine, which drops the video and keeps the still.
|
|
17638
17862
|
*/
|
|
17639
17863
|
clip: zod.z.boolean().optional(),
|
|
17640
|
-
/**
|
|
17864
|
+
/**
|
|
17865
|
+
* Seconds of footage BEFORE / AFTER the event instant. Absent =
|
|
17866
|
+
* {@link NC_CLIP_PRE_ROLL_DEFAULT_SEC} / {@link NC_CLIP_POST_ROLL_DEFAULT_SEC}
|
|
17867
|
+
* (4 / 6), resolved by the Notification Center at dispatch — deliberately not
|
|
17868
|
+
* a Zod default, so a rule that never chose keeps following the hub's.
|
|
17869
|
+
*/
|
|
17641
17870
|
clipPreRollSec: zod.z.number().int().min(0).max(30).optional(),
|
|
17642
17871
|
clipPostRollSec: zod.z.number().int().min(0).max(30).optional(),
|
|
17643
17872
|
/**
|
|
@@ -19212,6 +19441,130 @@ var oauthIntegrationCapability = {
|
|
|
19212
19441
|
getDescriptor: method(zod.z.void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
|
|
19213
19442
|
};
|
|
19214
19443
|
/**
|
|
19444
|
+
* A model choice has a SCOPE, and a scope change has a workflow.
|
|
19445
|
+
*
|
|
19446
|
+
* ## The two scopes
|
|
19447
|
+
*
|
|
19448
|
+
* Almost every pipeline step's model is a **node** question: which build runs
|
|
19449
|
+
* fastest on THIS accelerator. Two nodes may legitimately answer differently —
|
|
19450
|
+
* a Coral runs the tflite SSD, a Mac runs the coreml YOLO — because the answers
|
|
19451
|
+
* are compared against nothing. They produce boxes, and a box is a box.
|
|
19452
|
+
*
|
|
19453
|
+
* Two steps are not like that. `face-embedding` and `clip-embedding` produce
|
|
19454
|
+
* **vectors that land in ONE shared index** (`identity_samples`,
|
|
19455
|
+
* `vec_object_clip`) and are ranked against each other by cosine similarity.
|
|
19456
|
+
* Cosine similarity between two encoders is not a weak signal, it is a
|
|
19457
|
+
* meaningless number — and nothing inside a vector can tell you it happened.
|
|
19458
|
+
* So for those two steps the model is a **cluster** question with exactly one
|
|
19459
|
+
* answer, stored in exactly one row.
|
|
19460
|
+
*
|
|
19461
|
+
* That is the same argument [D52](../../../../docs/decisions/adr-0052.md) makes
|
|
19462
|
+
* for the crop convention (`detail-crop.ts`), one level up: the crop decides
|
|
19463
|
+
* WHAT pixels the encoder sees, this decides WHICH encoder sees them. Both are
|
|
19464
|
+
* cluster-wide for the same reason and neither may become per-node.
|
|
19465
|
+
*
|
|
19466
|
+
* ## Why the registry lives here and not in the step catalog
|
|
19467
|
+
*
|
|
19468
|
+
* The scope itself is declared on the step, in
|
|
19469
|
+
* `detection-pipeline/registry/step-definitions.ts` (`StepDefinition.modelScope`)
|
|
19470
|
+
* — that is where a new step declares what kind of choice its model is. But the
|
|
19471
|
+
* catalog lives inside `addon-pipeline`, and three packages that must NOT
|
|
19472
|
+
* import an addon need to know the set: the orchestrator (which renders and
|
|
19473
|
+
* stores the row), post-analysis (which pins the row for a re-embed pass) and
|
|
19474
|
+
* admin-ui (which mirrors it). So the set is mirrored here, and
|
|
19475
|
+
* `scripts/check-cluster-model-scope.ts` fails the build when the two disagree.
|
|
19476
|
+
* A hand-copied key that stops matching is exactly how a setting silently stops
|
|
19477
|
+
* arriving while both sides still look correct.
|
|
19478
|
+
*
|
|
19479
|
+
* ## The defaults ARE today's behaviour
|
|
19480
|
+
*
|
|
19481
|
+
* {@link DEFAULT_CLUSTER_STEP_MODELS} reproduces the catalog `defaultModelId`
|
|
19482
|
+
* of both steps. Declaring the scope therefore changes nothing on the day it
|
|
19483
|
+
* ships: the cluster row starts out saying what every node was already doing.
|
|
19484
|
+
* Changing it is legitimate — that is what the knob is for — but it invalidates
|
|
19485
|
+
* the stored vectors of that surface, and must be followed by a re-embed pass
|
|
19486
|
+
* (`face-reembed-pass.ts`, `embedding-rebuild.ts`).
|
|
19487
|
+
*/
|
|
19488
|
+
/**
|
|
19489
|
+
* Why the orchestrator cannot say which model the operator chose for a
|
|
19490
|
+
* cluster-scoped step (D651).
|
|
19491
|
+
*/
|
|
19492
|
+
var CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS = [
|
|
19493
|
+
"owner-not-ready",
|
|
19494
|
+
"store-read-failed",
|
|
19495
|
+
"three-way-read-unavailable",
|
|
19496
|
+
"invalid-stored",
|
|
19497
|
+
"not-cluster-scoped"
|
|
19498
|
+
];
|
|
19499
|
+
Object.freeze(Object.fromEntries([{
|
|
19500
|
+
stepId: "face-embedding",
|
|
19501
|
+
label: "Face recognition model",
|
|
19502
|
+
defaultModelId: "auraface-r100",
|
|
19503
|
+
indexName: "the enrolled face gallery",
|
|
19504
|
+
options: [
|
|
19505
|
+
{
|
|
19506
|
+
id: "auraface-r100",
|
|
19507
|
+
label: "AuraFace R100"
|
|
19508
|
+
},
|
|
19509
|
+
{
|
|
19510
|
+
id: "arcface-r100",
|
|
19511
|
+
label: "ArcFace (ResNet34)"
|
|
19512
|
+
},
|
|
19513
|
+
{
|
|
19514
|
+
id: "inception-resnet-v1",
|
|
19515
|
+
label: "Inception ResNet V1"
|
|
19516
|
+
}
|
|
19517
|
+
]
|
|
19518
|
+
}, {
|
|
19519
|
+
stepId: "clip-embedding",
|
|
19520
|
+
label: "Semantic search model",
|
|
19521
|
+
defaultModelId: "mobileclip-s1",
|
|
19522
|
+
indexName: "the object semantic-search index",
|
|
19523
|
+
options: [
|
|
19524
|
+
{
|
|
19525
|
+
id: "mobileclip-s1",
|
|
19526
|
+
label: "MobileCLIP S1"
|
|
19527
|
+
},
|
|
19528
|
+
{
|
|
19529
|
+
id: "mobileclip-s2",
|
|
19530
|
+
label: "MobileCLIP S2"
|
|
19531
|
+
},
|
|
19532
|
+
{
|
|
19533
|
+
id: "siglip2-b16-224",
|
|
19534
|
+
label: "SigLIP2 B/16 (Apache-2.0)"
|
|
19535
|
+
}
|
|
19536
|
+
]
|
|
19537
|
+
}].map((s) => [s.stepId, s.defaultModelId])));
|
|
19538
|
+
var CLUSTER_STEP_SETTING_FIELDS = [{
|
|
19539
|
+
stepId: "face-embedding",
|
|
19540
|
+
key: "minLandmarkFaceSize",
|
|
19541
|
+
label: "Min face size for recognition (detection px)",
|
|
19542
|
+
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.",
|
|
19543
|
+
type: "slider",
|
|
19544
|
+
min: 0,
|
|
19545
|
+
max: 64,
|
|
19546
|
+
step: 2,
|
|
19547
|
+
default: 24
|
|
19548
|
+
}];
|
|
19549
|
+
function clusterStepSettingKey(stepId, fieldKey) {
|
|
19550
|
+
return `clusterStepSetting:${stepId}:${fieldKey}`;
|
|
19551
|
+
}
|
|
19552
|
+
var ClusterSettingNumberSchema = zod.z.number().finite();
|
|
19553
|
+
function readClusterStepSettings(config) {
|
|
19554
|
+
const out = {};
|
|
19555
|
+
for (const field of CLUSTER_STEP_SETTING_FIELDS) {
|
|
19556
|
+
const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
|
|
19557
|
+
const value = parsed.success ? parsed.data : field.default;
|
|
19558
|
+
const existing = out[field.stepId] ?? {};
|
|
19559
|
+
out[field.stepId] = {
|
|
19560
|
+
...existing,
|
|
19561
|
+
[field.key]: value
|
|
19562
|
+
};
|
|
19563
|
+
}
|
|
19564
|
+
return out;
|
|
19565
|
+
}
|
|
19566
|
+
readClusterStepSettings({});
|
|
19567
|
+
/**
|
|
19215
19568
|
* pipeline-analytics — device-scoped wrapper cap. Refines raw
|
|
19216
19569
|
* per-frame detections emitted by the pipeline runner into tracked
|
|
19217
19570
|
* objects, per-kind event collections (motion / object / audio), and
|
|
@@ -20035,7 +20388,8 @@ var MediaFileKindEnum = zod.z.enum([
|
|
|
20035
20388
|
"thumbnailSmall",
|
|
20036
20389
|
"confirmationCrop",
|
|
20037
20390
|
"debugCrop",
|
|
20038
|
-
"sceneFrame"
|
|
20391
|
+
"sceneFrame",
|
|
20392
|
+
"lastSceneFrame"
|
|
20039
20393
|
]);
|
|
20040
20394
|
/**
|
|
20041
20395
|
* One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
|
|
@@ -20597,7 +20951,23 @@ var SearchObjectEventsInput = zod.z.object({
|
|
|
20597
20951
|
until: zod.z.number().optional(),
|
|
20598
20952
|
classFilter: zod.z.string().optional(),
|
|
20599
20953
|
limit: zod.z.number().default(50),
|
|
20600
|
-
|
|
20954
|
+
/**
|
|
20955
|
+
* An ABSOLUTE cosine floor. Optional since D649: a floor is a property of the
|
|
20956
|
+
* model (0.2 kept 96% of matched pairs on MobileCLIP S1 and 2.7% on SigLIP2),
|
|
20957
|
+
* so an absent one resolves to the searched model's own `searchMinScore`
|
|
20958
|
+
* scaled by `strictness`. A number sent here is honoured verbatim.
|
|
20959
|
+
*/
|
|
20960
|
+
minScore: zod.z.number().min(0).max(1).optional(),
|
|
20961
|
+
/** Model-relative floor — see `resolveClipSearchMinScore`. Default `loose`. */
|
|
20962
|
+
strictness: ClipSearchStrictnessSchema.optional(),
|
|
20963
|
+
/**
|
|
20964
|
+
* Search THIS CLIP model's index instead of the cluster row's. Every index a
|
|
20965
|
+
* model ever wrote stays searchable until it is wiped (the MobileCLIP index
|
|
20966
|
+
* through a SigLIP2 cutover and its rollback window). An id with no CLIP
|
|
20967
|
+
* metadata is refused; an id other than the cluster row's is ADMIN-only
|
|
20968
|
+
* (`model-override-requires-admin`).
|
|
20969
|
+
*/
|
|
20970
|
+
modelId: zod.z.string().min(1).optional()
|
|
20601
20971
|
});
|
|
20602
20972
|
var TrackCascadeCountsSchema = zod.z.object({
|
|
20603
20973
|
/** Persisted track roots deleted (authoritative). */
|
|
@@ -20732,7 +21102,41 @@ var RebuildObjectEmbeddingsInput = zod.z.object({
|
|
|
20732
21102
|
* comparable, so wiping and rebuilding is the only way to be sure every vector
|
|
20733
21103
|
* means the same thing.
|
|
20734
21104
|
*/
|
|
20735
|
-
var WipeObjectEmbeddingsResultSchema = zod.z.object({
|
|
21105
|
+
var WipeObjectEmbeddingsResultSchema = zod.z.object({
|
|
21106
|
+
deleted: zod.z.number(),
|
|
21107
|
+
/**
|
|
21108
|
+
* CLIP indexes that could NOT be emptied (unreachable, or refused at their
|
|
21109
|
+
* dimension) — not a clean slate. Additive and optional (D649).
|
|
21110
|
+
*/
|
|
21111
|
+
failedIndexes: zod.z.array(zod.z.string()).optional()
|
|
21112
|
+
});
|
|
21113
|
+
/**
|
|
21114
|
+
* Why a rebuild did not start, BY NAME — ONE vocabulary for both gates in front
|
|
21115
|
+
* of a pass (D649 over D651). A bare `started: false` read the same for "the
|
|
21116
|
+
* stores are booting" and "the cluster row names a model with no CLIP
|
|
21117
|
+
* metadata", which need different fixes.
|
|
21118
|
+
* - `stores-unavailable` — the analytics stores or the API are not up yet.
|
|
21119
|
+
* - the owner's confirmation of the cluster model (D651, `ClusterPinConfirmer`):
|
|
21120
|
+
* a pass that rewrites an index needs two agreeing reads of the OWNER's
|
|
21121
|
+
* answer (`pipelineOrchestrator.getClusterModelChoice`) — a pass that cannot
|
|
21122
|
+
* name its model does not run (D54):
|
|
21123
|
+
* - the owner's own `unreadable` reasons (`owner-not-ready`,
|
|
21124
|
+
* `store-read-failed`, `three-way-read-unavailable`, `invalid-stored`,
|
|
21125
|
+
* `not-cluster-scoped`);
|
|
21126
|
+
* - `method-unavailable` — the orchestrator predates the method;
|
|
21127
|
+
* - `read-failed` — the call failed or answered something unparseable;
|
|
21128
|
+
* - `reads-disagree` — the two reads named different choices.
|
|
21129
|
+
* - `not-a-clip-model` — the CONFIRMED id has no CLIP metadata, so there is no
|
|
21130
|
+
* index to fill and no dimension to check against (D649).
|
|
21131
|
+
*/
|
|
21132
|
+
var RebuildObjectEmbeddingsRefusalSchema = zod.z.enum([
|
|
21133
|
+
"stores-unavailable",
|
|
21134
|
+
...CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS,
|
|
21135
|
+
"method-unavailable",
|
|
21136
|
+
"read-failed",
|
|
21137
|
+
"reads-disagree",
|
|
21138
|
+
"not-a-clip-model"
|
|
21139
|
+
]);
|
|
20736
21140
|
/**
|
|
20737
21141
|
* Acknowledgement that a rebuild STARTED.
|
|
20738
21142
|
*
|
|
@@ -20745,7 +21149,12 @@ var WipeObjectEmbeddingsResultSchema = zod.z.object({ deleted: zod.z.number() })
|
|
|
20745
21149
|
var RebuildObjectEmbeddingsResultSchema = zod.z.object({
|
|
20746
21150
|
started: zod.z.boolean(),
|
|
20747
21151
|
/** True when a pass was already running; the new request is ignored. */
|
|
20748
|
-
alreadyRunning: zod.z.boolean()
|
|
21152
|
+
alreadyRunning: zod.z.boolean(),
|
|
21153
|
+
/** Present when the pass refused to start — see `RebuildObjectEmbeddingsRefusalSchema`. */
|
|
21154
|
+
refusal: RebuildObjectEmbeddingsRefusalSchema.optional(),
|
|
21155
|
+
/** The CLIP model the pass pinned, and the index it fills (when it started). */
|
|
21156
|
+
modelId: zod.z.string().optional(),
|
|
21157
|
+
index: zod.z.string().optional()
|
|
20749
21158
|
});
|
|
20750
21159
|
var RebuildStatusSchema = zod.z.object({
|
|
20751
21160
|
running: zod.z.boolean(),
|
|
@@ -20779,7 +21188,11 @@ var RebuildStatusSchema = zod.z.object({
|
|
|
20779
21188
|
startedAtMs: zod.z.number().nullable(),
|
|
20780
21189
|
finishedAtMs: zod.z.number().nullable(),
|
|
20781
21190
|
/** Present when the pass ended by throwing. */
|
|
20782
|
-
error: zod.z.string().nullable()
|
|
21191
|
+
error: zod.z.string().nullable(),
|
|
21192
|
+
/** The CLIP model the current / last pass pinned (D54), `null` before any. */
|
|
21193
|
+
modelId: zod.z.string().nullable(),
|
|
21194
|
+
/** The index that pass fills — `ClipModelMeta.vectorIndex` of `modelId` (D649). */
|
|
21195
|
+
index: zod.z.string().nullable()
|
|
20783
21196
|
});
|
|
20784
21197
|
/**
|
|
20785
21198
|
* Acknowledgement that a debug-media reclaim STARTED.
|
|
@@ -21723,7 +22136,7 @@ var pipelineAnalyticsCapability = {
|
|
|
21723
22136
|
* ObjectEvents by trackId. Returns up to `limit` events scored ≥
|
|
21724
22137
|
* `minScore`, sorted descending by score.
|
|
21725
22138
|
*/
|
|
21726
|
-
searchObjectEvents: method(SearchObjectEventsInput, zod.z.array(ScoredObjectEventSchema).readonly()),
|
|
22139
|
+
searchObjectEvents: method(SearchObjectEventsInput, zod.z.array(ScoredObjectEventSchema).readonly(), { caller: "required" }),
|
|
21727
22140
|
wipeObjectEmbeddings: method(zod.z.object({}), WipeObjectEmbeddingsResultSchema, {
|
|
21728
22141
|
kind: "mutation",
|
|
21729
22142
|
auth: "admin"
|
|
@@ -22365,7 +22778,14 @@ var pipelineExecutorCapability = {
|
|
|
22365
22778
|
*/
|
|
22366
22779
|
inferCached: method(zod.z.object({
|
|
22367
22780
|
stepId: zod.z.string(),
|
|
22368
|
-
frameId: zod.z.number().int()
|
|
22781
|
+
frameId: zod.z.number().int(),
|
|
22782
|
+
/**
|
|
22783
|
+
* The model to time — REQUIRED (D658). Without it the pool answered the
|
|
22784
|
+
* step's ACTIVE variant (the first loaded after boot), so a benchmark
|
|
22785
|
+
* of model B silently timed model A. Callers pass the `rootModelId`
|
|
22786
|
+
* their warmup `runPipeline` reported: the model that actually ran.
|
|
22787
|
+
*/
|
|
22788
|
+
modelId: zod.z.string().min(1)
|
|
22369
22789
|
}), zod.z.record(zod.z.string(), zod.z.unknown()), { kind: "mutation" }),
|
|
22370
22790
|
/**
|
|
22371
22791
|
* Release a cached frame from the Python pool's memory.
|
|
@@ -23017,6 +23437,17 @@ var RunnerFrameSourceSchema = zod.z.discriminatedUnion("kind", [zod.z.object({ k
|
|
|
23017
23437
|
hubHostnameOverride: zod.z.string().optional()
|
|
23018
23438
|
})]).describe("Per-camera frame-source mode for the runner (P2c)");
|
|
23019
23439
|
/**
|
|
23440
|
+
* What ONE step runs with on ONE roster device for THIS camera (D650): the
|
|
23441
|
+
* device's per-(node,device) base with the camera's override for that device
|
|
23442
|
+
* on top — the same `override ?? base` merge the orchestrator applies to the
|
|
23443
|
+
* elected device (`applyDeviceProvisioning`). Absent `modelId` ⇒ the executor
|
|
23444
|
+
* resolves the device format's default, exactly as on the elected device.
|
|
23445
|
+
*/
|
|
23446
|
+
var RunnerJumpStepProvisioningSchema = zod.z.object({
|
|
23447
|
+
modelId: zod.z.string().optional(),
|
|
23448
|
+
settings: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
23449
|
+
});
|
|
23450
|
+
/**
|
|
23020
23451
|
* One ENABLED inference device on the runner's node, as the step-tree
|
|
23021
23452
|
* device-jump resolver sees it (phase 1). The orchestrator populates this
|
|
23022
23453
|
* roster on the attach payload whenever the camera is elected onto a specific
|
|
@@ -23028,7 +23459,16 @@ var RunnerFrameSourceSchema = zod.z.discriminatedUnion("kind", [zod.z.object({ k
|
|
|
23028
23459
|
var RunnerInferenceDeviceSchema = zod.z.object({
|
|
23029
23460
|
deviceKey: zod.z.string(),
|
|
23030
23461
|
weight: zod.z.number().positive().default(1),
|
|
23031
|
-
maxSessions: zod.z.number().int().positive().nullable().default(null)
|
|
23462
|
+
maxSessions: zod.z.number().int().positive().nullable().default(null),
|
|
23463
|
+
/**
|
|
23464
|
+
* Per-step provisioning for this camera on THIS device (D650), keyed by step
|
|
23465
|
+
* id. A step the runner jumps here runs with these fields, never with the
|
|
23466
|
+
* elected device's: `modelId` / `settings` are REPLACED on the jumped subtree
|
|
23467
|
+
* (a step absent from the map runs with neither — the target format default).
|
|
23468
|
+
* Absent field ⇒ an orchestrator that predates D650: the jumped step keeps
|
|
23469
|
+
* the elected device's provisioning, as before.
|
|
23470
|
+
*/
|
|
23471
|
+
steps: zod.z.record(zod.z.string(), RunnerJumpStepProvisioningSchema).optional()
|
|
23032
23472
|
});
|
|
23033
23473
|
/**
|
|
23034
23474
|
* Camera assignment payload sent by `addon-pipeline-orchestrator` to a
|
|
@@ -24125,6 +24565,28 @@ var NodeInferenceDeviceSchema = zod.z.object({
|
|
|
24125
24565
|
*/
|
|
24126
24566
|
exclusion: InferenceDeviceExclusionReasonSchema.nullable()
|
|
24127
24567
|
});
|
|
24568
|
+
/**
|
|
24569
|
+
* The operator's model choice for one cluster-scoped step, answered by the
|
|
24570
|
+
* addon that OWNS the `clusterModel:*` settings (D651). Three answers, never
|
|
24571
|
+
* folded: a written choice, a key nobody wrote (the cluster runs the default
|
|
24572
|
+
* BY ABSENCE), or no answer. A caller that rewrites an index acts only on the
|
|
24573
|
+
* first two, read twice and agreeing.
|
|
24574
|
+
*/
|
|
24575
|
+
var ClusterModelChoiceSchema = zod.z.discriminatedUnion("kind", [
|
|
24576
|
+
zod.z.object({
|
|
24577
|
+
kind: zod.z.literal("stored"),
|
|
24578
|
+
modelId: zod.z.string()
|
|
24579
|
+
}),
|
|
24580
|
+
zod.z.object({
|
|
24581
|
+
kind: zod.z.literal("absent"),
|
|
24582
|
+
defaultModelId: zod.z.string()
|
|
24583
|
+
}),
|
|
24584
|
+
zod.z.object({
|
|
24585
|
+
kind: zod.z.literal("unreadable"),
|
|
24586
|
+
reason: zod.z.enum(CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS),
|
|
24587
|
+
error: zod.z.string().optional()
|
|
24588
|
+
})
|
|
24589
|
+
]);
|
|
24128
24590
|
var NodeInferenceDevicesSchema = zod.z.object({
|
|
24129
24591
|
nodeId: zod.z.string(),
|
|
24130
24592
|
/** False when the node's platform-probe was unreachable (no live device set). */
|
|
@@ -24221,9 +24683,19 @@ var pipelineOrchestratorCapability = {
|
|
|
24221
24683
|
* Trigger a full rebalance pass. Iterates over all assigned cameras,
|
|
24222
24684
|
* recomputes the optimal agent for each one based on current load +
|
|
24223
24685
|
* hardware affinity, and migrates cameras whose current agent is no
|
|
24224
|
-
* longer optimal. Pinned cameras are never migrated.
|
|
24225
|
-
|
|
24226
|
-
|
|
24686
|
+
* longer optimal. Pinned cameras are never migrated. `skipped` names the
|
|
24687
|
+
* cameras the pass wanted to move and could not, with why — a target node
|
|
24688
|
+
* that has not answered its catalog / device health yet, or a device that
|
|
24689
|
+
* cannot run the camera's root (D650).
|
|
24690
|
+
*/
|
|
24691
|
+
rebalance: method(zod.z.void(), zod.z.object({
|
|
24692
|
+
migrated: zod.z.number(),
|
|
24693
|
+
skipped: zod.z.array(zod.z.object({
|
|
24694
|
+
deviceId: zod.z.number(),
|
|
24695
|
+
targetNodeId: zod.z.string(),
|
|
24696
|
+
reason: zod.z.string()
|
|
24697
|
+
})).default([])
|
|
24698
|
+
}), {
|
|
24227
24699
|
kind: "mutation",
|
|
24228
24700
|
auth: "admin"
|
|
24229
24701
|
}),
|
|
@@ -24233,6 +24705,13 @@ var pipelineOrchestratorCapability = {
|
|
|
24233
24705
|
getPipelineAssignment: method(zod.z.object({ deviceId: zod.z.number() }), PipelineAssignmentSchema.nullable()),
|
|
24234
24706
|
/** Get per-agent load summaries used by the load balancer + dashboards. */
|
|
24235
24707
|
getAgentLoad: method(zod.z.void(), zod.z.array(AgentLoadSummarySchema).readonly()),
|
|
24708
|
+
/**
|
|
24709
|
+
* The operator's STORED model choice for one cluster-scoped step (D651).
|
|
24710
|
+
* Read three-way from this addon's own store, only once its boot has
|
|
24711
|
+
* settled. Unlike `addonSettings.getGlobalSettings`, it never answers a
|
|
24712
|
+
* default as though someone chose it.
|
|
24713
|
+
*/
|
|
24714
|
+
getClusterModelChoice: method(zod.z.object({ stepId: zod.z.string() }), ClusterModelChoiceSchema),
|
|
24236
24715
|
/** Aggregate global metrics across the whole detection cluster. */
|
|
24237
24716
|
getGlobalMetrics: method(zod.z.void(), GlobalMetricsSchema),
|
|
24238
24717
|
/**
|
|
@@ -26703,6 +27182,20 @@ var VectorScanResultSchema = zod.z.object({
|
|
|
26703
27182
|
*/
|
|
26704
27183
|
nextCursor: zod.z.number().int().nonnegative().nullable()
|
|
26705
27184
|
});
|
|
27185
|
+
/**
|
|
27186
|
+
* The ONE error code for "this index exists at another dimension; refusing to
|
|
27187
|
+
* redeclare it" (D649). It rides in the MESSAGE — an Error's own properties do
|
|
27188
|
+
* not survive the UDS/tRPC hop, its message does — and both sides go through
|
|
27189
|
+
* the helpers below, never a copied phrase: a consumer that must tell "this
|
|
27190
|
+
* index can never hold my vectors" from "the provider is unreachable" (a
|
|
27191
|
+
* delete counts the first as nothing-to-delete and the second as still
|
|
27192
|
+
* present) otherwise breaks silently the day the wording changes.
|
|
27193
|
+
*/
|
|
27194
|
+
var VECTOR_INDEX_DIM_CONFLICT = "vector-index-dim-conflict";
|
|
27195
|
+
/** The provider's refusal, carrying {@link VECTOR_INDEX_DIM_CONFLICT}. */
|
|
27196
|
+
function vectorIndexDimConflictError(index, declaredDim, requestedDim) {
|
|
27197
|
+
return /* @__PURE__ */ new Error(`[${VECTOR_INDEX_DIM_CONFLICT}] vector-store: index "${index}" is declared with dim ${String(declaredDim)}; refusing to redeclare as ${String(requestedDim)}`);
|
|
27198
|
+
}
|
|
26706
27199
|
var VectorStatsInputSchema = zod.z.object({ index: zod.z.string() });
|
|
26707
27200
|
var VectorStatsResultSchema = zod.z.object({
|
|
26708
27201
|
/** Provider id, so an operator can tell brute force from an ANN index. */
|
|
@@ -27561,6 +28054,411 @@ var videoclipsCapability = {
|
|
|
27561
28054
|
}
|
|
27562
28055
|
};
|
|
27563
28056
|
/**
|
|
28057
|
+
* LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
|
|
28058
|
+
* valutatore puro del suo FRONTE.
|
|
28059
|
+
*
|
|
28060
|
+
* Viveva dentro il builtin virtual-doorbell
|
|
28061
|
+
* (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
|
|
28062
|
+
* predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
|
|
28063
|
+
* `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
|
|
28064
|
+
* tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
|
|
28065
|
+
* fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
|
|
28066
|
+
* SPOSTA qui e il doorbell la ri-esporta.
|
|
28067
|
+
*
|
|
28068
|
+
* ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
|
|
28069
|
+
* due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
|
|
28070
|
+
* regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
|
|
28071
|
+
* booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
|
|
28072
|
+
*/
|
|
28073
|
+
/**
|
|
28074
|
+
* Known binary / switch source caps → the boolean slice field whose
|
|
28075
|
+
* false→true rise counts as ACTIVE. Every entry is "fire on active".
|
|
28076
|
+
* Sensors whose "active" reading is not a plain boolean (presence's string
|
|
28077
|
+
* state, connectivity's connected flag) are deliberately excluded — a
|
|
28078
|
+
* reconnect is not a doorbell press, and it is not a recording either.
|
|
28079
|
+
*/
|
|
28080
|
+
var SOURCE_CAP_ACTIVE_FIELD = {
|
|
28081
|
+
contact: "entryOpen",
|
|
28082
|
+
binary: "on",
|
|
28083
|
+
switch: "on",
|
|
28084
|
+
motion: "detected",
|
|
28085
|
+
flood: "flooded",
|
|
28086
|
+
gas: "detected",
|
|
28087
|
+
smoke: "detected",
|
|
28088
|
+
"carbon-monoxide": "detected",
|
|
28089
|
+
vibration: "detected",
|
|
28090
|
+
tamper: "tampered"
|
|
28091
|
+
};
|
|
28092
|
+
/**
|
|
28093
|
+
* The same caps → the slice field carrying the ms-epoch timestamp of the
|
|
28094
|
+
* last transition. Every source cap MUST appear here (guarded by a spec):
|
|
28095
|
+
* without a transition timestamp the evaluator cannot tell a genuine rise
|
|
28096
|
+
* from a boot-time hydration when the FIRST slice it ever sees is already
|
|
28097
|
+
* active, and errs towards silence — swallowing the rise.
|
|
28098
|
+
*
|
|
28099
|
+
* These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
|
|
28100
|
+
* provider derives them from `state.last_changed`, so they survive our own
|
|
28101
|
+
* restarts and correctly read as "hours ago" for a state that has been
|
|
28102
|
+
* active for hours. `motion` names its rise timestamp `lastDetectedAt`.
|
|
28103
|
+
*/
|
|
28104
|
+
var SOURCE_CAP_CHANGED_AT_FIELD = {
|
|
28105
|
+
contact: "lastChangedAt",
|
|
28106
|
+
binary: "lastChangedAt",
|
|
28107
|
+
switch: "lastChangedAt",
|
|
28108
|
+
motion: "lastDetectedAt",
|
|
28109
|
+
flood: "lastChangedAt",
|
|
28110
|
+
gas: "lastChangedAt",
|
|
28111
|
+
smoke: "lastChangedAt",
|
|
28112
|
+
"carbon-monoxide": "lastChangedAt",
|
|
28113
|
+
vibration: "lastChangedAt",
|
|
28114
|
+
tamper: "lastChangedAt"
|
|
28115
|
+
};
|
|
28116
|
+
/** Cap names whose presence in a device's bindings qualify it as a source. */
|
|
28117
|
+
var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
|
|
28118
|
+
/** True when a cap is a recognised binary/switch source. */
|
|
28119
|
+
function isSourceCap(capName) {
|
|
28120
|
+
return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
|
|
28121
|
+
}
|
|
28122
|
+
/** Extract the "active" boolean a source cap's slice carries, or null when
|
|
28123
|
+
* the cap is unknown or the field is missing / non-boolean. */
|
|
28124
|
+
function sliceActiveValue(capName, slice) {
|
|
28125
|
+
const field = SOURCE_CAP_ACTIVE_FIELD[capName];
|
|
28126
|
+
if (field === void 0) return null;
|
|
28127
|
+
const raw = slice[field];
|
|
28128
|
+
return typeof raw === "boolean" ? raw : null;
|
|
28129
|
+
}
|
|
28130
|
+
/** Ms-epoch transition timestamp a source cap's slice carries, or null when
|
|
28131
|
+
* it is absent, non-numeric or the zero "never observed" sentinel. */
|
|
28132
|
+
function sliceChangedAt(capName, slice) {
|
|
28133
|
+
const field = SOURCE_CAP_CHANGED_AT_FIELD[capName];
|
|
28134
|
+
if (field === void 0) return null;
|
|
28135
|
+
const raw = slice[field];
|
|
28136
|
+
if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return null;
|
|
28137
|
+
return raw;
|
|
28138
|
+
}
|
|
28139
|
+
/**
|
|
28140
|
+
* How recent a source's own transition timestamp must be for a FIRST
|
|
28141
|
+
* sighting that is already active to count as a genuine rise rather than a
|
|
28142
|
+
* hydration of long-standing state.
|
|
28143
|
+
*/
|
|
28144
|
+
var DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = 3e4;
|
|
28145
|
+
/**
|
|
28146
|
+
* IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
|
|
28147
|
+
* porta `prior`, `nowMs` e il proprio `startedAtMs`.
|
|
28148
|
+
*
|
|
28149
|
+
* Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
|
|
28150
|
+
* fronte solo se il timestamp UPSTREAM della transizione è posteriore a
|
|
28151
|
+
* `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
|
|
28152
|
+
* servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
|
|
28153
|
+
* stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
|
|
28154
|
+
* iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
|
|
28155
|
+
* adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
|
|
28156
|
+
* SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
|
|
28157
|
+
*/
|
|
28158
|
+
function evaluateSensorEdge(input) {
|
|
28159
|
+
const value = sliceActiveValue(input.capName, input.slice);
|
|
28160
|
+
if (value === null) return {
|
|
28161
|
+
edge: "none",
|
|
28162
|
+
value: null,
|
|
28163
|
+
reason: isSourceCap(input.capName) ? "non-boolean-value" : "unknown-cap"
|
|
28164
|
+
};
|
|
28165
|
+
if (input.prior === void 0) {
|
|
28166
|
+
if (!value) return {
|
|
28167
|
+
edge: "none",
|
|
28168
|
+
value,
|
|
28169
|
+
reason: "baseline-seeded-inactive"
|
|
28170
|
+
};
|
|
28171
|
+
const changedAt = sliceChangedAt(input.capName, input.slice);
|
|
28172
|
+
const floor = Math.max(input.startedAtMs, input.nowMs - input.firstSightingFreshnessMs);
|
|
28173
|
+
if (changedAt === null || changedAt < floor) return {
|
|
28174
|
+
edge: "none",
|
|
28175
|
+
value,
|
|
28176
|
+
reason: "baseline-seeded-stale-active"
|
|
28177
|
+
};
|
|
28178
|
+
return {
|
|
28179
|
+
edge: "rising",
|
|
28180
|
+
value: true
|
|
28181
|
+
};
|
|
28182
|
+
}
|
|
28183
|
+
if (input.prior === value) return {
|
|
28184
|
+
edge: "none",
|
|
28185
|
+
value,
|
|
28186
|
+
reason: "no-change"
|
|
28187
|
+
};
|
|
28188
|
+
if (!value) return {
|
|
28189
|
+
edge: "none",
|
|
28190
|
+
value,
|
|
28191
|
+
reason: "falling-edge"
|
|
28192
|
+
};
|
|
28193
|
+
return {
|
|
28194
|
+
edge: "rising",
|
|
28195
|
+
value: true
|
|
28196
|
+
};
|
|
28197
|
+
}
|
|
28198
|
+
/**
|
|
28199
|
+
* Doorbell button cap. Two kinds of providers coexist behind this cap
|
|
28200
|
+
* name (same pattern as `snapshot`):
|
|
28201
|
+
*
|
|
28202
|
+
* - **Native** providers: registered per-device by device-driver
|
|
28203
|
+
* addons via `ctx.registerNativeCap` — either on a
|
|
28204
|
+
* `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
|
|
28205
|
+
* or directly on the camera (Reolink registers at camera level).
|
|
28206
|
+
* Emits an `onPressed` event every time the firmware pushes a
|
|
28207
|
+
* ring; status tracks the last press and a pressCount since start
|
|
28208
|
+
* (diagnostic).
|
|
28209
|
+
*
|
|
28210
|
+
* - **Wrapper** provider: the `virtual-doorbell` system builtin
|
|
28211
|
+
* (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
|
|
28212
|
+
* device (contact / switch / event-emitter …) into a doorbell for
|
|
28213
|
+
* a camera. `defaultActive: false` — the operator explicitly binds
|
|
28214
|
+
* it per camera in the device-bindings UI, then picks the source
|
|
28215
|
+
* device + trigger in the per-device settings.
|
|
28216
|
+
*
|
|
28217
|
+
* The DeviceEventPropagator re-emits `onPressed` on the camera parent
|
|
28218
|
+
* — subscribers listening at the camera level receive ring events
|
|
28219
|
+
* with `via[]` populated. No code on the parent needed.
|
|
28220
|
+
*/
|
|
28221
|
+
var DoorbellStatusSchema = zod.z.object({
|
|
28222
|
+
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
28223
|
+
lastPressedAt: zod.z.number().nullable(),
|
|
28224
|
+
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
28225
|
+
pressCountSinceStart: zod.z.number()
|
|
28226
|
+
});
|
|
28227
|
+
var DoorbellPressEventSchema = zod.z.object({
|
|
28228
|
+
deviceId: zod.z.number(),
|
|
28229
|
+
timestamp: zod.z.number()
|
|
28230
|
+
});
|
|
28231
|
+
/**
|
|
28232
|
+
* The `doorbell-source` extension slot's editable value (D648): the camera's
|
|
28233
|
+
* virtual-doorbell trigger devices, exactly what the wrapper's
|
|
28234
|
+
* `doorbellSources` persists (as `{ deviceId }` records).
|
|
28235
|
+
*/
|
|
28236
|
+
var DoorbellSourceSlotValueSchema = zod.z.object({ deviceIds: zod.z.array(zod.z.number().int().positive()) });
|
|
28237
|
+
/**
|
|
28238
|
+
* The `doorbell-source` slot — which devices ring this camera's VIRTUAL
|
|
28239
|
+
* doorbell, owned by the `virtual-doorbell` wrapper over its
|
|
28240
|
+
* `doorbellSources` store (D648). A source rings when one of its
|
|
28241
|
+
* `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
|
|
28242
|
+
* different authority (`deviceManager.setWrapperActive`, D62) — the slot
|
|
28243
|
+
* reports it, it never writes it.
|
|
28244
|
+
*/
|
|
28245
|
+
var DOORBELL_SOURCE_SLOT = {
|
|
28246
|
+
id: "doorbell-source",
|
|
28247
|
+
label: "Doorbell trigger devices",
|
|
28248
|
+
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.",
|
|
28249
|
+
shape: "association",
|
|
28250
|
+
hostDeviceTypes: [DeviceType.Camera],
|
|
28251
|
+
sourceCaps: SOURCE_CAPS,
|
|
28252
|
+
cardinality: "many",
|
|
28253
|
+
value: DoorbellSourceSlotValueSchema
|
|
28254
|
+
};
|
|
28255
|
+
var doorbellCapability = {
|
|
28256
|
+
name: "doorbell",
|
|
28257
|
+
scope: "device",
|
|
28258
|
+
deviceNative: true,
|
|
28259
|
+
mode: "singleton",
|
|
28260
|
+
kind: "wrapper",
|
|
28261
|
+
defaultActive: false,
|
|
28262
|
+
deviceTypes: [DeviceType.Button, DeviceType.Camera],
|
|
28263
|
+
extensionSlots: [DOORBELL_SOURCE_SLOT],
|
|
28264
|
+
methods: {},
|
|
28265
|
+
events: {
|
|
28266
|
+
/**
|
|
28267
|
+
* Fires once per physical press. Reolink delivers via Baichuan
|
|
28268
|
+
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
28269
|
+
* release/duration — it's a pulse.
|
|
28270
|
+
*/
|
|
28271
|
+
onPressed: { data: DoorbellPressEventSchema } },
|
|
28272
|
+
status: {
|
|
28273
|
+
schema: DoorbellStatusSchema,
|
|
28274
|
+
kind: "push"
|
|
28275
|
+
},
|
|
28276
|
+
/**
|
|
28277
|
+
* Runtime-state slice — last press timestamp + lifetime press count.
|
|
28278
|
+
* Mirrored by the kernel and readable via
|
|
28279
|
+
* `device.state.doorbell.value`. UIs can show "last ring 5m ago"
|
|
28280
|
+
* without subscribing.
|
|
28281
|
+
*/
|
|
28282
|
+
runtimeState: DoorbellStatusSchema,
|
|
28283
|
+
/**
|
|
28284
|
+
* 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.
|
|
28285
|
+
*
|
|
28286
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
28287
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
28288
|
+
*/
|
|
28289
|
+
durability: "restored"
|
|
28290
|
+
};
|
|
28291
|
+
var ExtensionSlotIdSchema = zod.z.enum(["doorbell-source", "linked-devices"]);
|
|
28292
|
+
var EXTENSION_SLOTS = {
|
|
28293
|
+
"doorbell-source": {
|
|
28294
|
+
descriptor: DOORBELL_SOURCE_SLOT,
|
|
28295
|
+
declaringCap: "doorbell",
|
|
28296
|
+
hostDeviceTypes: [DeviceType.Camera]
|
|
28297
|
+
},
|
|
28298
|
+
"linked-devices": {
|
|
28299
|
+
descriptor: LINKED_DEVICES_SLOT,
|
|
28300
|
+
declaringCap: "device-manager",
|
|
28301
|
+
hostDeviceTypes: [DeviceType.Camera]
|
|
28302
|
+
}
|
|
28303
|
+
};
|
|
28304
|
+
/** A slot's editable value, discriminated on `slot`. */
|
|
28305
|
+
var ExtensionSlotValueSchema = zod.z.discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: zod.z.literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: zod.z.literal("linked-devices") })]);
|
|
28306
|
+
/** Every device type at least one slot is offered on — `device-extension`'s `deviceTypes`. */
|
|
28307
|
+
var EXTENSION_HOST_DEVICE_TYPES = [DeviceType.Camera];
|
|
28308
|
+
var ExtensionSourceAvailabilitySchema = zod.z.discriminatedUnion("state", [zod.z.object({ state: zod.z.literal("ok") }), zod.z.object({
|
|
28309
|
+
state: zod.z.literal("unreachable"),
|
|
28310
|
+
reason: zod.z.string()
|
|
28311
|
+
})]);
|
|
28312
|
+
/** One provider of slots — the D554 source-listing row. */
|
|
28313
|
+
var ExtensionSourceSchema = zod.z.object({
|
|
28314
|
+
/** The routing prefix of every `slotRef` this provider serves. */
|
|
28315
|
+
source: zod.z.string(),
|
|
28316
|
+
label: zod.z.string(),
|
|
28317
|
+
/** Stamped by the dispatcher from the registry (D557). */
|
|
28318
|
+
addonId: zod.z.string().optional(),
|
|
28319
|
+
availability: ExtensionSourceAvailabilitySchema
|
|
28320
|
+
});
|
|
28321
|
+
/**
|
|
28322
|
+
* How one picked source stands. `missing` — no such device (deleted, or an id
|
|
28323
|
+
* that never existed); `foreign` — a device the slot's owner cannot read from
|
|
28324
|
+
* (slice 2's cross-owner graft source); `unavailable` — it exists but is not a
|
|
28325
|
+
* valid source now (a container, which is never a pick). A source in any of
|
|
28326
|
+
* these states is SHOWN, never silently dropped or re-pointed.
|
|
28327
|
+
*/
|
|
28328
|
+
var ExtensionSourceHealthSchema = zod.z.enum([
|
|
28329
|
+
"ok",
|
|
28330
|
+
"missing",
|
|
28331
|
+
"foreign",
|
|
28332
|
+
"unavailable"
|
|
28333
|
+
]);
|
|
28334
|
+
var ExtensionSlotSourceSchema = zod.z.object({
|
|
28335
|
+
deviceId: zod.z.number().int(),
|
|
28336
|
+
/** The device's name, or null when it could not be resolved (`missing`). */
|
|
28337
|
+
name: zod.z.string().nullable(),
|
|
28338
|
+
health: ExtensionSourceHealthSchema,
|
|
28339
|
+
detail: zod.z.string().optional()
|
|
28340
|
+
});
|
|
28341
|
+
/**
|
|
28342
|
+
* A DIFFERENT authority that gates whether the slot's sources do anything —
|
|
28343
|
+
* reported read-only, named, never written through this contract (D62). The
|
|
28344
|
+
* virtual doorbell's sources ring only while the wrapper is bound to the
|
|
28345
|
+
* camera, and that binding belongs to `deviceManager.setWrapperActive`.
|
|
28346
|
+
* `unknown` means the gate could not be read; it is not "inactive" (D315).
|
|
28347
|
+
*/
|
|
28348
|
+
var ExtensionSlotActivationSchema = zod.z.object({
|
|
28349
|
+
state: zod.z.enum([
|
|
28350
|
+
"active",
|
|
28351
|
+
"inactive",
|
|
28352
|
+
"unknown"
|
|
28353
|
+
]),
|
|
28354
|
+
authority: zod.z.string(),
|
|
28355
|
+
detail: zod.z.string().optional()
|
|
28356
|
+
});
|
|
28357
|
+
/** One slot of one device, as its owner reads it from its own store. */
|
|
28358
|
+
var ExtensionSlotStateSchema = zod.z.object({
|
|
28359
|
+
state: zod.z.literal("ok"),
|
|
28360
|
+
/** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
|
|
28361
|
+
slotRef: zod.z.string(),
|
|
28362
|
+
slot: ExtensionSlotIdSchema,
|
|
28363
|
+
/** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
|
|
28364
|
+
authority: zod.z.string(),
|
|
28365
|
+
/** graft: its switch. association: null — removing every source is "off". */
|
|
28366
|
+
enabled: zod.z.boolean().nullable(),
|
|
28367
|
+
/** graft: the cap registered on the host. association: null. */
|
|
28368
|
+
projects: zod.z.string().nullable(),
|
|
28369
|
+
activation: ExtensionSlotActivationSchema.nullable(),
|
|
28370
|
+
value: ExtensionSlotValueSchema,
|
|
28371
|
+
sources: zod.z.array(ExtensionSlotSourceSchema),
|
|
28372
|
+
/**
|
|
28373
|
+
* Devices the owner links to the host ON ITS OWN, by structure, and that
|
|
28374
|
+
* are therefore not in `value` (D655): a camera's device-tree children, and
|
|
28375
|
+
* the child a picked container stands for (D356 — a container is never a
|
|
28376
|
+
* pick, its children are). Read-only; the editor shows them and may offer
|
|
28377
|
+
* per-device options on them (the linked-devices tracked-event opt-in).
|
|
28378
|
+
* Absent when the owner links nothing beyond the picks, and from an owner
|
|
28379
|
+
* older than D655.
|
|
28380
|
+
*/
|
|
28381
|
+
impliedSources: zod.z.array(ExtensionSlotSourceSchema).optional()
|
|
28382
|
+
});
|
|
28383
|
+
/**
|
|
28384
|
+
* A provider that could not answer `listSlots` at all. It could not name its
|
|
28385
|
+
* own slots, so the row names the ADDON and carries the refusal verbatim.
|
|
28386
|
+
* Written by the dispatcher, never by a provider.
|
|
28387
|
+
*/
|
|
28388
|
+
var ExtensionSlotUnreachableSchema = zod.z.object({
|
|
28389
|
+
state: zod.z.literal("unreachable"),
|
|
28390
|
+
addonId: zod.z.string(),
|
|
28391
|
+
reason: zod.z.string()
|
|
28392
|
+
});
|
|
28393
|
+
var ExtensionSlotRowSchema = zod.z.discriminatedUnion("state", [ExtensionSlotStateSchema, ExtensionSlotUnreachableSchema]);
|
|
28394
|
+
/** One device the slot's editor may offer as a source. */
|
|
28395
|
+
var ExtensionCandidateSchema = zod.z.object({
|
|
28396
|
+
deviceId: zod.z.number().int(),
|
|
28397
|
+
name: zod.z.string(),
|
|
28398
|
+
type: zod.z.string(),
|
|
28399
|
+
location: zod.z.string().nullable(),
|
|
28400
|
+
/** The container a child belongs to — "Spotlight 2" alone does not say which. */
|
|
28401
|
+
parentName: zod.z.string().nullable(),
|
|
28402
|
+
/** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
|
|
28403
|
+
suggested: zod.z.boolean(),
|
|
28404
|
+
/** Why it is suggested ("same location"), null when it is not. */
|
|
28405
|
+
reason: zod.z.string().nullable()
|
|
28406
|
+
});
|
|
28407
|
+
var ExtensionCandidatesSchema = zod.z.object({ candidates: zod.z.array(ExtensionCandidateSchema) });
|
|
28408
|
+
/**
|
|
28409
|
+
* What a write did. `none` — applied in place. `host` / `parent` — the owner
|
|
28410
|
+
* reloaded the host (or, for an accessory child, its parent) because the
|
|
28411
|
+
* write changed what the host REGISTERS (a graft switched on or off, slice 2).
|
|
28412
|
+
*/
|
|
28413
|
+
var ExtensionSetResultSchema = zod.z.object({
|
|
28414
|
+
applied: zod.z.literal(true),
|
|
28415
|
+
reload: zod.z.enum([
|
|
28416
|
+
"none",
|
|
28417
|
+
"host",
|
|
28418
|
+
"parent"
|
|
28419
|
+
])
|
|
28420
|
+
});
|
|
28421
|
+
var ExtensionSlotRefInputSchema = zod.z.object({
|
|
28422
|
+
deviceId: zod.z.number().int(),
|
|
28423
|
+
slotRef: zod.z.string().min(1)
|
|
28424
|
+
});
|
|
28425
|
+
var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
|
|
28426
|
+
var deviceExtensionCapability = {
|
|
28427
|
+
name: "device-extension",
|
|
28428
|
+
scope: "device",
|
|
28429
|
+
mode: "collection",
|
|
28430
|
+
kind: "wrapper",
|
|
28431
|
+
defaultActive: true,
|
|
28432
|
+
deviceTypes: EXTENSION_HOST_DEVICE_TYPES,
|
|
28433
|
+
deviceConfig: { ui: {
|
|
28434
|
+
kind: "widget",
|
|
28435
|
+
widgetId: "host/extensions-panel",
|
|
28436
|
+
tab: "general",
|
|
28437
|
+
label: "Extensions",
|
|
28438
|
+
order: 72
|
|
28439
|
+
} },
|
|
28440
|
+
methods: {
|
|
28441
|
+
/** One row per slot owner — the D554 source listing `slotRef` routes by. */
|
|
28442
|
+
listSources: method(zod.z.object({ deviceId: zod.z.number().int() }), zod.z.array(ExtensionSourceSchema)),
|
|
28443
|
+
/**
|
|
28444
|
+
* Every slot this device is offered, read by each owner from its own
|
|
28445
|
+
* store. A provider that throws is ONE `unreachable` row (D554.4).
|
|
28446
|
+
*/
|
|
28447
|
+
listSlots: method(zod.z.object({ deviceId: zod.z.number().int() }), zod.z.array(ExtensionSlotRowSchema)),
|
|
28448
|
+
/** The devices the slot's editor may offer, suggestions pre-marked (D356). */
|
|
28449
|
+
listCandidates: method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema),
|
|
28450
|
+
/**
|
|
28451
|
+
* Write one slot through its owner's EXISTING write path. The owner
|
|
28452
|
+
* validates (a container is never a linked device, a camera is never its
|
|
28453
|
+
* own source) and refuses by name before persisting.
|
|
28454
|
+
*/
|
|
28455
|
+
setSlot: method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
|
|
28456
|
+
kind: "mutation",
|
|
28457
|
+
auth: "admin"
|
|
28458
|
+
})
|
|
28459
|
+
}
|
|
28460
|
+
};
|
|
28461
|
+
/**
|
|
27564
28462
|
* Optional client-side hints sent at session creation to help the provider
|
|
27565
28463
|
* pick the best native source. All fields optional — a viewer that knows
|
|
27566
28464
|
* nothing still gets a sane default. (Relocated from the retired `webrtc`
|
|
@@ -30461,75 +31359,6 @@ onStatusChanged: { data: zod.z.object({
|
|
|
30461
31359
|
volatileStateFields: ["lastChangedAt"]
|
|
30462
31360
|
};
|
|
30463
31361
|
/**
|
|
30464
|
-
* Doorbell button cap. Two kinds of providers coexist behind this cap
|
|
30465
|
-
* name (same pattern as `snapshot`):
|
|
30466
|
-
*
|
|
30467
|
-
* - **Native** providers: registered per-device by device-driver
|
|
30468
|
-
* addons via `ctx.registerNativeCap` — either on a
|
|
30469
|
-
* `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
|
|
30470
|
-
* or directly on the camera (Reolink registers at camera level).
|
|
30471
|
-
* Emits an `onPressed` event every time the firmware pushes a
|
|
30472
|
-
* ring; status tracks the last press and a pressCount since start
|
|
30473
|
-
* (diagnostic).
|
|
30474
|
-
*
|
|
30475
|
-
* - **Wrapper** provider: the `virtual-doorbell` system builtin
|
|
30476
|
-
* (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
|
|
30477
|
-
* device (contact / switch / event-emitter …) into a doorbell for
|
|
30478
|
-
* a camera. `defaultActive: false` — the operator explicitly binds
|
|
30479
|
-
* it per camera in the device-bindings UI, then picks the source
|
|
30480
|
-
* device + trigger in the per-device settings.
|
|
30481
|
-
*
|
|
30482
|
-
* The DeviceEventPropagator re-emits `onPressed` on the camera parent
|
|
30483
|
-
* — subscribers listening at the camera level receive ring events
|
|
30484
|
-
* with `via[]` populated. No code on the parent needed.
|
|
30485
|
-
*/
|
|
30486
|
-
var DoorbellStatusSchema = zod.z.object({
|
|
30487
|
-
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
30488
|
-
lastPressedAt: zod.z.number().nullable(),
|
|
30489
|
-
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
30490
|
-
pressCountSinceStart: zod.z.number()
|
|
30491
|
-
});
|
|
30492
|
-
var DoorbellPressEventSchema = zod.z.object({
|
|
30493
|
-
deviceId: zod.z.number(),
|
|
30494
|
-
timestamp: zod.z.number()
|
|
30495
|
-
});
|
|
30496
|
-
var doorbellCapability = {
|
|
30497
|
-
name: "doorbell",
|
|
30498
|
-
scope: "device",
|
|
30499
|
-
deviceNative: true,
|
|
30500
|
-
mode: "singleton",
|
|
30501
|
-
kind: "wrapper",
|
|
30502
|
-
defaultActive: false,
|
|
30503
|
-
deviceTypes: [DeviceType.Button, DeviceType.Camera],
|
|
30504
|
-
exposesDeviceSettings: true,
|
|
30505
|
-
methods: {},
|
|
30506
|
-
events: {
|
|
30507
|
-
/**
|
|
30508
|
-
* Fires once per physical press. Reolink delivers via Baichuan
|
|
30509
|
-
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
30510
|
-
* release/duration — it's a pulse.
|
|
30511
|
-
*/
|
|
30512
|
-
onPressed: { data: DoorbellPressEventSchema } },
|
|
30513
|
-
status: {
|
|
30514
|
-
schema: DoorbellStatusSchema,
|
|
30515
|
-
kind: "push"
|
|
30516
|
-
},
|
|
30517
|
-
/**
|
|
30518
|
-
* Runtime-state slice — last press timestamp + lifetime press count.
|
|
30519
|
-
* Mirrored by the kernel and readable via
|
|
30520
|
-
* `device.state.doorbell.value`. UIs can show "last ring 5m ago"
|
|
30521
|
-
* without subscribing.
|
|
30522
|
-
*/
|
|
30523
|
-
runtimeState: DoorbellStatusSchema,
|
|
30524
|
-
/**
|
|
30525
|
-
* 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.
|
|
30526
|
-
*
|
|
30527
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
30528
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
30529
|
-
*/
|
|
30530
|
-
durability: "restored"
|
|
30531
|
-
};
|
|
30532
|
-
/**
|
|
30533
31362
|
* Enum-state sensor — a string value picked from a finite option set.
|
|
30534
31363
|
* Drives HA `sensor` entries with `state_class: enum` (HVAC action
|
|
30535
31364
|
* states, weather conditions, contact-source channels, mode strings).
|
|
@@ -40684,168 +41513,87 @@ var zoneRulesCapability = {
|
|
|
40684
41513
|
*/
|
|
40685
41514
|
durability: "restored"
|
|
40686
41515
|
};
|
|
40687
|
-
|
|
40688
|
-
|
|
40689
|
-
* valutatore puro del suo FRONTE.
|
|
40690
|
-
*
|
|
40691
|
-
* Viveva dentro il builtin virtual-doorbell
|
|
40692
|
-
* (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
|
|
40693
|
-
* predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
|
|
40694
|
-
* `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
|
|
40695
|
-
* tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
|
|
40696
|
-
* fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
|
|
40697
|
-
* SPOSTA qui e il doorbell la ri-esporta.
|
|
40698
|
-
*
|
|
40699
|
-
* ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
|
|
40700
|
-
* due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
|
|
40701
|
-
* regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
|
|
40702
|
-
* booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
|
|
40703
|
-
*/
|
|
40704
|
-
/**
|
|
40705
|
-
* Known binary / switch source caps → the boolean slice field whose
|
|
40706
|
-
* false→true rise counts as ACTIVE. Every entry is "fire on active".
|
|
40707
|
-
* Sensors whose "active" reading is not a plain boolean (presence's string
|
|
40708
|
-
* state, connectivity's connected flag) are deliberately excluded — a
|
|
40709
|
-
* reconnect is not a doorbell press, and it is not a recording either.
|
|
40710
|
-
*/
|
|
40711
|
-
var SOURCE_CAP_ACTIVE_FIELD = {
|
|
40712
|
-
contact: "entryOpen",
|
|
40713
|
-
binary: "on",
|
|
40714
|
-
switch: "on",
|
|
40715
|
-
motion: "detected",
|
|
40716
|
-
flood: "flooded",
|
|
40717
|
-
gas: "detected",
|
|
40718
|
-
smoke: "detected",
|
|
40719
|
-
"carbon-monoxide": "detected",
|
|
40720
|
-
vibration: "detected",
|
|
40721
|
-
tamper: "tampered"
|
|
40722
|
-
};
|
|
40723
|
-
/**
|
|
40724
|
-
* The same caps → the slice field carrying the ms-epoch timestamp of the
|
|
40725
|
-
* last transition. Every source cap MUST appear here (guarded by a spec):
|
|
40726
|
-
* without a transition timestamp the evaluator cannot tell a genuine rise
|
|
40727
|
-
* from a boot-time hydration when the FIRST slice it ever sees is already
|
|
40728
|
-
* active, and errs towards silence — swallowing the rise.
|
|
40729
|
-
*
|
|
40730
|
-
* These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
|
|
40731
|
-
* provider derives them from `state.last_changed`, so they survive our own
|
|
40732
|
-
* restarts and correctly read as "hours ago" for a state that has been
|
|
40733
|
-
* active for hours. `motion` names its rise timestamp `lastDetectedAt`.
|
|
40734
|
-
*/
|
|
40735
|
-
var SOURCE_CAP_CHANGED_AT_FIELD = {
|
|
40736
|
-
contact: "lastChangedAt",
|
|
40737
|
-
binary: "lastChangedAt",
|
|
40738
|
-
switch: "lastChangedAt",
|
|
40739
|
-
motion: "lastDetectedAt",
|
|
40740
|
-
flood: "lastChangedAt",
|
|
40741
|
-
gas: "lastChangedAt",
|
|
40742
|
-
smoke: "lastChangedAt",
|
|
40743
|
-
"carbon-monoxide": "lastChangedAt",
|
|
40744
|
-
vibration: "lastChangedAt",
|
|
40745
|
-
tamper: "lastChangedAt"
|
|
40746
|
-
};
|
|
40747
|
-
/** Cap names whose presence in a device's bindings qualify it as a source. */
|
|
40748
|
-
var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
|
|
40749
|
-
/**
|
|
40750
|
-
* Device `type` values (from `DeviceType`) that can host a binary/switch
|
|
40751
|
-
* source cap. Used by the camera's `device-multiselect` picker as the
|
|
40752
|
-
* CLIENT-SIDE filter, alongside `SOURCE_CAPS`.
|
|
40753
|
-
*
|
|
40754
|
-
* Why types and not caps alone: the shared picker filters
|
|
40755
|
-
* `deviceManager.listAll` rows client-side, and those rows carry only the
|
|
40756
|
-
* device's advertised `features` — NOT its registered cap list. On the live
|
|
40757
|
-
* cluster binary sensors and switches advertise EMPTY features (features
|
|
40758
|
-
* mirror only a handful of caps like `motion-trigger`), so a caps-only
|
|
40759
|
-
* filter matched against `features` would list nothing (the very bug this
|
|
40760
|
-
* replaced, which relied on the now-empty `getAllBindings`). Matching by
|
|
40761
|
-
* `type` is the reliable client-side signal; the union with `SOURCE_CAPS`
|
|
40762
|
-
* still captures any device that DOES advertise a source-cap feature.
|
|
40763
|
-
* `sensor` covers contact/motion/flood/gas/smoke/CO/vibration/tamper,
|
|
40764
|
-
* `switch` covers switches, `control` covers generic binary actuators.
|
|
40765
|
-
*/
|
|
40766
|
-
var SOURCE_DEVICE_TYPES = [
|
|
40767
|
-
"sensor",
|
|
40768
|
-
"switch",
|
|
40769
|
-
"control"
|
|
40770
|
-
];
|
|
40771
|
-
/** True when a cap is a recognised binary/switch source. */
|
|
40772
|
-
function isSourceCap(capName) {
|
|
40773
|
-
return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
|
|
41516
|
+
function isValueOf(slot, value) {
|
|
41517
|
+
return value.slot === slot;
|
|
40774
41518
|
}
|
|
40775
|
-
/**
|
|
40776
|
-
|
|
40777
|
-
|
|
40778
|
-
|
|
40779
|
-
|
|
40780
|
-
|
|
40781
|
-
|
|
41519
|
+
/** Bind slot `slot` to its owner's functions. See the module docblock. */
|
|
41520
|
+
function defineExtensionSlotProvider(slot, impl) {
|
|
41521
|
+
return {
|
|
41522
|
+
slot,
|
|
41523
|
+
list: async (deviceId) => {
|
|
41524
|
+
const listing = await impl.list(deviceId);
|
|
41525
|
+
if (listing === null) return null;
|
|
41526
|
+
const value = listing.value;
|
|
41527
|
+
return {
|
|
41528
|
+
...listing,
|
|
41529
|
+
value
|
|
41530
|
+
};
|
|
41531
|
+
},
|
|
41532
|
+
set: async (deviceId, value) => {
|
|
41533
|
+
if (!isValueOf(slot, value)) throw new Error(`device-extension: a "${value.slot}" value was sent to slot "${slot}" — refused`);
|
|
41534
|
+
return await impl.set(deviceId, value);
|
|
41535
|
+
},
|
|
41536
|
+
candidates: (deviceId) => impl.candidates(deviceId)
|
|
41537
|
+
};
|
|
40782
41538
|
}
|
|
40783
|
-
/**
|
|
40784
|
-
|
|
40785
|
-
|
|
40786
|
-
const field = SOURCE_CAP_CHANGED_AT_FIELD[capName];
|
|
40787
|
-
if (field === void 0) return null;
|
|
40788
|
-
const raw = slice[field];
|
|
40789
|
-
if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return null;
|
|
40790
|
-
return raw;
|
|
41539
|
+
/** `<source>:<slotId>`. */
|
|
41540
|
+
function extensionSlotRef(source, slot) {
|
|
41541
|
+
return `${source}:${slot}`;
|
|
40791
41542
|
}
|
|
40792
|
-
/**
|
|
40793
|
-
|
|
40794
|
-
|
|
40795
|
-
|
|
40796
|
-
|
|
40797
|
-
|
|
40798
|
-
|
|
40799
|
-
|
|
40800
|
-
|
|
40801
|
-
|
|
40802
|
-
|
|
40803
|
-
* fronte solo se il timestamp UPSTREAM della transizione è posteriore a
|
|
40804
|
-
* `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
|
|
40805
|
-
* servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
|
|
40806
|
-
* stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
|
|
40807
|
-
* iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
|
|
40808
|
-
* adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
|
|
40809
|
-
* SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
|
|
40810
|
-
*/
|
|
40811
|
-
function evaluateSensorEdge(input) {
|
|
40812
|
-
const value = sliceActiveValue(input.capName, input.slice);
|
|
40813
|
-
if (value === null) return {
|
|
40814
|
-
edge: "none",
|
|
40815
|
-
value: null,
|
|
40816
|
-
reason: isSourceCap(input.capName) ? "non-boolean-value" : "unknown-cap"
|
|
40817
|
-
};
|
|
40818
|
-
if (input.prior === void 0) {
|
|
40819
|
-
if (!value) return {
|
|
40820
|
-
edge: "none",
|
|
40821
|
-
value,
|
|
40822
|
-
reason: "baseline-seeded-inactive"
|
|
40823
|
-
};
|
|
40824
|
-
const changedAt = sliceChangedAt(input.capName, input.slice);
|
|
40825
|
-
const floor = Math.max(input.startedAtMs, input.nowMs - input.firstSightingFreshnessMs);
|
|
40826
|
-
if (changedAt === null || changedAt < floor) return {
|
|
40827
|
-
edge: "none",
|
|
40828
|
-
value,
|
|
40829
|
-
reason: "baseline-seeded-stale-active"
|
|
40830
|
-
};
|
|
40831
|
-
return {
|
|
40832
|
-
edge: "rising",
|
|
40833
|
-
value: true
|
|
40834
|
-
};
|
|
40835
|
-
}
|
|
40836
|
-
if (input.prior === value) return {
|
|
40837
|
-
edge: "none",
|
|
40838
|
-
value,
|
|
40839
|
-
reason: "no-change"
|
|
40840
|
-
};
|
|
40841
|
-
if (!value) return {
|
|
40842
|
-
edge: "none",
|
|
40843
|
-
value,
|
|
40844
|
-
reason: "falling-edge"
|
|
41543
|
+
/** Build the `device-extension` provider one owner registers. */
|
|
41544
|
+
function createDeviceExtensionProvider(options) {
|
|
41545
|
+
const { source, label, slots, hostTypeOf, logger } = options;
|
|
41546
|
+
const offered = (slot, hostType) => hostType !== null && EXTENSION_SLOTS[slot].hostDeviceTypes.some((t) => t === hostType);
|
|
41547
|
+
const resolve = async (deviceId, slotRef) => {
|
|
41548
|
+
const prefix = `${source}:`;
|
|
41549
|
+
const slot = slotRef.startsWith(prefix) ? slots.find((s) => s.slot === slotRef.slice(prefix.length)) : void 0;
|
|
41550
|
+
if (slot === void 0) throw new Error(`device-extension: "${slotRef}" is not a slot of "${source}" — it serves ${slots.map((s) => extensionSlotRef(source, s.slot)).join(", ") || "(none)"}`);
|
|
41551
|
+
const hostType = await hostTypeOf(deviceId);
|
|
41552
|
+
if (!offered(slot.slot, hostType)) throw new Error(`device-extension: slot "${slot.slot}" is not offered on device ${deviceId} (type ${hostType ?? "unknown"}; offered on ${EXTENSION_SLOTS[slot.slot].hostDeviceTypes.join(", ")})`);
|
|
41553
|
+
return slot;
|
|
40845
41554
|
};
|
|
40846
41555
|
return {
|
|
40847
|
-
|
|
40848
|
-
|
|
41556
|
+
listSources: async () => [{
|
|
41557
|
+
source,
|
|
41558
|
+
label,
|
|
41559
|
+
availability: { state: "ok" }
|
|
41560
|
+
}],
|
|
41561
|
+
listSlots: async (input) => {
|
|
41562
|
+
const hostType = await hostTypeOf(input.deviceId);
|
|
41563
|
+
const rows = [];
|
|
41564
|
+
for (const slot of slots) {
|
|
41565
|
+
if (!offered(slot.slot, hostType)) continue;
|
|
41566
|
+
const listing = await slot.list(input.deviceId);
|
|
41567
|
+
if (listing === null) continue;
|
|
41568
|
+
rows.push({
|
|
41569
|
+
state: "ok",
|
|
41570
|
+
slotRef: extensionSlotRef(source, slot.slot),
|
|
41571
|
+
slot: slot.slot,
|
|
41572
|
+
authority: listing.authority,
|
|
41573
|
+
enabled: listing.enabled,
|
|
41574
|
+
projects: EXTENSION_SLOTS[slot.slot].descriptor.projects ?? null,
|
|
41575
|
+
activation: listing.activation,
|
|
41576
|
+
value: listing.value,
|
|
41577
|
+
sources: [...listing.sources],
|
|
41578
|
+
...listing.impliedSources !== void 0 ? { impliedSources: [...listing.impliedSources] } : {}
|
|
41579
|
+
});
|
|
41580
|
+
}
|
|
41581
|
+
return rows;
|
|
41582
|
+
},
|
|
41583
|
+
listCandidates: async (input) => {
|
|
41584
|
+
return { candidates: [...await (await resolve(input.deviceId, input.slotRef)).candidates(input.deviceId)] };
|
|
41585
|
+
},
|
|
41586
|
+
setSlot: async (input) => {
|
|
41587
|
+
const result = await (await resolve(input.deviceId, input.slotRef)).set(input.deviceId, input.value);
|
|
41588
|
+
logger.info("device-extension: slot written", {
|
|
41589
|
+
tags: { deviceId: input.deviceId },
|
|
41590
|
+
meta: {
|
|
41591
|
+
slotRef: input.slotRef,
|
|
41592
|
+
reload: result.reload
|
|
41593
|
+
}
|
|
41594
|
+
});
|
|
41595
|
+
return result;
|
|
41596
|
+
}
|
|
40849
41597
|
};
|
|
40850
41598
|
}
|
|
40851
41599
|
/**
|
|
@@ -43741,6 +44489,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
43741
44489
|
deviceAdoptionCapability,
|
|
43742
44490
|
deviceDiscoveryCapability,
|
|
43743
44491
|
deviceExportCapability,
|
|
44492
|
+
deviceExtensionCapability,
|
|
43744
44493
|
deviceManagerCapability,
|
|
43745
44494
|
deviceOpsCapability,
|
|
43746
44495
|
deviceProviderCapability,
|
|
@@ -45289,6 +46038,30 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
45289
46038
|
addonId: null,
|
|
45290
46039
|
access: "create"
|
|
45291
46040
|
},
|
|
46041
|
+
"deviceExtension.listCandidates": {
|
|
46042
|
+
capName: "device-extension",
|
|
46043
|
+
capScope: "device",
|
|
46044
|
+
addonId: null,
|
|
46045
|
+
access: "view"
|
|
46046
|
+
},
|
|
46047
|
+
"deviceExtension.listSlots": {
|
|
46048
|
+
capName: "device-extension",
|
|
46049
|
+
capScope: "device",
|
|
46050
|
+
addonId: null,
|
|
46051
|
+
access: "view"
|
|
46052
|
+
},
|
|
46053
|
+
"deviceExtension.listSources": {
|
|
46054
|
+
capName: "device-extension",
|
|
46055
|
+
capScope: "device",
|
|
46056
|
+
addonId: null,
|
|
46057
|
+
access: "view"
|
|
46058
|
+
},
|
|
46059
|
+
"deviceExtension.setSlot": {
|
|
46060
|
+
capName: "device-extension",
|
|
46061
|
+
capScope: "device",
|
|
46062
|
+
addonId: null,
|
|
46063
|
+
access: "create"
|
|
46064
|
+
},
|
|
45292
46065
|
"deviceManager.addLocation": {
|
|
45293
46066
|
capName: "device-manager",
|
|
45294
46067
|
capScope: "system",
|
|
@@ -45361,12 +46134,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
45361
46134
|
addonId: null,
|
|
45362
46135
|
access: "create"
|
|
45363
46136
|
},
|
|
45364
|
-
"deviceManager.applyDeviceSettingsPatch": {
|
|
45365
|
-
capName: "device-manager",
|
|
45366
|
-
capScope: "system",
|
|
45367
|
-
addonId: null,
|
|
45368
|
-
access: "create"
|
|
45369
|
-
},
|
|
45370
46137
|
"deviceManager.applyInitialMeta": {
|
|
45371
46138
|
capName: "device-manager",
|
|
45372
46139
|
capScope: "system",
|
|
@@ -45469,12 +46236,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
45469
46236
|
addonId: null,
|
|
45470
46237
|
access: "view"
|
|
45471
46238
|
},
|
|
45472
|
-
"deviceManager.getDeviceLiveContribution": {
|
|
45473
|
-
capName: "device-manager",
|
|
45474
|
-
capScope: "system",
|
|
45475
|
-
addonId: null,
|
|
45476
|
-
access: "view"
|
|
45477
|
-
},
|
|
45478
46239
|
"deviceManager.getDeviceLiveInfoAggregate": {
|
|
45479
46240
|
capName: "device-manager",
|
|
45480
46241
|
capScope: "system",
|
|
@@ -45487,12 +46248,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
45487
46248
|
addonId: null,
|
|
45488
46249
|
access: "view"
|
|
45489
46250
|
},
|
|
45490
|
-
"deviceManager.getDeviceSettingsContribution": {
|
|
45491
|
-
capName: "device-manager",
|
|
45492
|
-
capScope: "system",
|
|
45493
|
-
addonId: null,
|
|
45494
|
-
access: "view"
|
|
45495
|
-
},
|
|
45496
46251
|
"deviceManager.getDeviceStatusAggregate": {
|
|
45497
46252
|
capName: "device-manager",
|
|
45498
46253
|
capScope: "system",
|
|
@@ -45997,24 +46752,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
45997
46752
|
addonId: null,
|
|
45998
46753
|
access: "view"
|
|
45999
46754
|
},
|
|
46000
|
-
"doorbell.applyDeviceSettingsPatch": {
|
|
46001
|
-
capName: "doorbell",
|
|
46002
|
-
capScope: "device",
|
|
46003
|
-
addonId: null,
|
|
46004
|
-
access: "create"
|
|
46005
|
-
},
|
|
46006
|
-
"doorbell.getDeviceLiveContribution": {
|
|
46007
|
-
capName: "doorbell",
|
|
46008
|
-
capScope: "device",
|
|
46009
|
-
addonId: null,
|
|
46010
|
-
access: "view"
|
|
46011
|
-
},
|
|
46012
|
-
"doorbell.getDeviceSettingsContribution": {
|
|
46013
|
-
capName: "doorbell",
|
|
46014
|
-
capScope: "device",
|
|
46015
|
-
addonId: null,
|
|
46016
|
-
access: "view"
|
|
46017
|
-
},
|
|
46018
46755
|
"doorbell.getStatus": {
|
|
46019
46756
|
capName: "doorbell",
|
|
46020
46757
|
capScope: "device",
|
|
@@ -46039,6 +46776,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
46039
46776
|
addonId: null,
|
|
46040
46777
|
access: "view"
|
|
46041
46778
|
},
|
|
46779
|
+
"embeddingEncoder.resetFailedModels": {
|
|
46780
|
+
capName: "embedding-encoder",
|
|
46781
|
+
capScope: "system",
|
|
46782
|
+
addonId: null,
|
|
46783
|
+
access: "delete"
|
|
46784
|
+
},
|
|
46042
46785
|
"enumSensor.getStatus": {
|
|
46043
46786
|
capName: "enum-sensor",
|
|
46044
46787
|
capScope: "device",
|
|
@@ -48373,6 +49116,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
48373
49116
|
addonId: null,
|
|
48374
49117
|
access: "view"
|
|
48375
49118
|
},
|
|
49119
|
+
"pipelineOrchestrator.getClusterModelChoice": {
|
|
49120
|
+
capName: "pipeline-orchestrator",
|
|
49121
|
+
capScope: "system",
|
|
49122
|
+
addonId: null,
|
|
49123
|
+
access: "view"
|
|
49124
|
+
},
|
|
48376
49125
|
"pipelineOrchestrator.getDeviceLiveContribution": {
|
|
48377
49126
|
capName: "pipeline-orchestrator",
|
|
48378
49127
|
capScope: "system",
|
|
@@ -51198,6 +51947,26 @@ Object.freeze({
|
|
|
51198
51947
|
form: "single",
|
|
51199
51948
|
optional: false
|
|
51200
51949
|
}],
|
|
51950
|
+
"deviceExtension.listCandidates": [{
|
|
51951
|
+
name: "deviceId",
|
|
51952
|
+
form: "single",
|
|
51953
|
+
optional: false
|
|
51954
|
+
}],
|
|
51955
|
+
"deviceExtension.listSlots": [{
|
|
51956
|
+
name: "deviceId",
|
|
51957
|
+
form: "single",
|
|
51958
|
+
optional: false
|
|
51959
|
+
}],
|
|
51960
|
+
"deviceExtension.listSources": [{
|
|
51961
|
+
name: "deviceId",
|
|
51962
|
+
form: "single",
|
|
51963
|
+
optional: false
|
|
51964
|
+
}],
|
|
51965
|
+
"deviceExtension.setSlot": [{
|
|
51966
|
+
name: "deviceId",
|
|
51967
|
+
form: "single",
|
|
51968
|
+
optional: false
|
|
51969
|
+
}],
|
|
51201
51970
|
"deviceManager.adoptionRelease": [{
|
|
51202
51971
|
name: "camDeviceId",
|
|
51203
51972
|
form: "single",
|
|
@@ -53957,68 +54726,6 @@ TimelapseRuleInputSchema.extend({
|
|
|
53957
54726
|
createdAt: zod.z.number(),
|
|
53958
54727
|
updatedAt: zod.z.number()
|
|
53959
54728
|
});
|
|
53960
|
-
Object.freeze(Object.fromEntries([{
|
|
53961
|
-
stepId: "face-embedding",
|
|
53962
|
-
label: "Face recognition model",
|
|
53963
|
-
defaultModelId: "arcface-r100",
|
|
53964
|
-
indexName: "the enrolled face gallery",
|
|
53965
|
-
options: [
|
|
53966
|
-
{
|
|
53967
|
-
id: "arcface-r100",
|
|
53968
|
-
label: "ArcFace (ResNet34)"
|
|
53969
|
-
},
|
|
53970
|
-
{
|
|
53971
|
-
id: "auraface-r100",
|
|
53972
|
-
label: "AuraFace R100"
|
|
53973
|
-
},
|
|
53974
|
-
{
|
|
53975
|
-
id: "inception-resnet-v1",
|
|
53976
|
-
label: "Inception ResNet V1"
|
|
53977
|
-
}
|
|
53978
|
-
]
|
|
53979
|
-
}, {
|
|
53980
|
-
stepId: "clip-embedding",
|
|
53981
|
-
label: "Semantic search model",
|
|
53982
|
-
defaultModelId: "mobileclip-s1",
|
|
53983
|
-
indexName: "the object semantic-search index",
|
|
53984
|
-
options: [{
|
|
53985
|
-
id: "mobileclip-s1",
|
|
53986
|
-
label: "MobileCLIP S1"
|
|
53987
|
-
}, {
|
|
53988
|
-
id: "mobileclip-s2",
|
|
53989
|
-
label: "MobileCLIP S2"
|
|
53990
|
-
}]
|
|
53991
|
-
}].map((s) => [s.stepId, s.defaultModelId])));
|
|
53992
|
-
zod.z.string().min(1);
|
|
53993
|
-
var CLUSTER_STEP_SETTING_FIELDS = [{
|
|
53994
|
-
stepId: "face-embedding",
|
|
53995
|
-
key: "minLandmarkFaceSize",
|
|
53996
|
-
label: "Min face size for recognition (detection px)",
|
|
53997
|
-
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.",
|
|
53998
|
-
type: "slider",
|
|
53999
|
-
min: 0,
|
|
54000
|
-
max: 64,
|
|
54001
|
-
step: 2,
|
|
54002
|
-
default: 24
|
|
54003
|
-
}];
|
|
54004
|
-
function clusterStepSettingKey(stepId, fieldKey) {
|
|
54005
|
-
return `clusterStepSetting:${stepId}:${fieldKey}`;
|
|
54006
|
-
}
|
|
54007
|
-
var ClusterSettingNumberSchema = zod.z.number().finite();
|
|
54008
|
-
function readClusterStepSettings(config) {
|
|
54009
|
-
const out = {};
|
|
54010
|
-
for (const field of CLUSTER_STEP_SETTING_FIELDS) {
|
|
54011
|
-
const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
|
|
54012
|
-
const value = parsed.success ? parsed.data : field.default;
|
|
54013
|
-
const existing = out[field.stepId] ?? {};
|
|
54014
|
-
out[field.stepId] = {
|
|
54015
|
-
...existing,
|
|
54016
|
-
[field.key]: value
|
|
54017
|
-
};
|
|
54018
|
-
}
|
|
54019
|
-
return out;
|
|
54020
|
-
}
|
|
54021
|
-
readClusterStepSettings({});
|
|
54022
54729
|
zod.z.object({
|
|
54023
54730
|
/**
|
|
54024
54731
|
* Fraction of the box's own size added on EACH side before cutting.
|
|
@@ -54591,12 +55298,6 @@ Object.defineProperty(exports, "SOURCE_CAPS", {
|
|
|
54591
55298
|
return SOURCE_CAPS;
|
|
54592
55299
|
}
|
|
54593
55300
|
});
|
|
54594
|
-
Object.defineProperty(exports, "SOURCE_DEVICE_TYPES", {
|
|
54595
|
-
enumerable: true,
|
|
54596
|
-
get: function() {
|
|
54597
|
-
return SOURCE_DEVICE_TYPES;
|
|
54598
|
-
}
|
|
54599
|
-
});
|
|
54600
55301
|
Object.defineProperty(exports, "STORAGE_ACCESS_FALLBACK", {
|
|
54601
55302
|
enumerable: true,
|
|
54602
55303
|
get: function() {
|
|
@@ -54759,6 +55460,12 @@ Object.defineProperty(exports, "coreBlocksCapability", {
|
|
|
54759
55460
|
return coreBlocksCapability;
|
|
54760
55461
|
}
|
|
54761
55462
|
});
|
|
55463
|
+
Object.defineProperty(exports, "createDeviceExtensionProvider", {
|
|
55464
|
+
enumerable: true,
|
|
55465
|
+
get: function() {
|
|
55466
|
+
return createDeviceExtensionProvider;
|
|
55467
|
+
}
|
|
55468
|
+
});
|
|
54762
55469
|
Object.defineProperty(exports, "createEvent", {
|
|
54763
55470
|
enumerable: true,
|
|
54764
55471
|
get: function() {
|
|
@@ -54783,12 +55490,24 @@ Object.defineProperty(exports, "decodeVectorBase64", {
|
|
|
54783
55490
|
return decodeVectorBase64;
|
|
54784
55491
|
}
|
|
54785
55492
|
});
|
|
55493
|
+
Object.defineProperty(exports, "defineExtensionSlotProvider", {
|
|
55494
|
+
enumerable: true,
|
|
55495
|
+
get: function() {
|
|
55496
|
+
return defineExtensionSlotProvider;
|
|
55497
|
+
}
|
|
55498
|
+
});
|
|
54786
55499
|
Object.defineProperty(exports, "deriveBatteryPresence", {
|
|
54787
55500
|
enumerable: true,
|
|
54788
55501
|
get: function() {
|
|
54789
55502
|
return deriveBatteryPresence;
|
|
54790
55503
|
}
|
|
54791
55504
|
});
|
|
55505
|
+
Object.defineProperty(exports, "deviceExtensionCapability", {
|
|
55506
|
+
enumerable: true,
|
|
55507
|
+
get: function() {
|
|
55508
|
+
return deviceExtensionCapability;
|
|
55509
|
+
}
|
|
55510
|
+
});
|
|
54792
55511
|
Object.defineProperty(exports, "deviceManagerCapability", {
|
|
54793
55512
|
enumerable: true,
|
|
54794
55513
|
get: function() {
|
|
@@ -55245,6 +55964,12 @@ Object.defineProperty(exports, "vectorDimFromBase64", {
|
|
|
55245
55964
|
return vectorDimFromBase64;
|
|
55246
55965
|
}
|
|
55247
55966
|
});
|
|
55967
|
+
Object.defineProperty(exports, "vectorIndexDimConflictError", {
|
|
55968
|
+
enumerable: true,
|
|
55969
|
+
get: function() {
|
|
55970
|
+
return vectorIndexDimConflictError;
|
|
55971
|
+
}
|
|
55972
|
+
});
|
|
55248
55973
|
Object.defineProperty(exports, "vectorStoreCapability", {
|
|
55249
55974
|
enumerable: true,
|
|
55250
55975
|
get: function() {
|