@camstack/addon-pipeline-orchestrator 1.2.257 → 1.2.258
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/_stub.js +2 -2
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-DGNougi5.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-y1ddVXzH.mjs} +2 -2
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BWAmGyYA.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-D34U1xfa.mjs +26 -0
- package/dist/{hostInit-DkYM1F8P.mjs → hostInit-3a_B-rGa.mjs} +2 -2
- package/dist/index.js +2184 -729
- package/dist/index.mjs +2184 -729
- package/dist/remoteEntry.js +1 -1
- package/package.json +1 -1
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-KOxZj_G5.mjs +0 -26
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-3sU_SREF.mjs +0 -26
package/dist/index.js
CHANGED
|
@@ -5391,7 +5391,7 @@ var ZodIssueCode = {
|
|
|
5391
5391
|
var ZodFirstPartyTypeKind;
|
|
5392
5392
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5393
5393
|
//#endregion
|
|
5394
|
-
//#region ../types/dist/sleep-
|
|
5394
|
+
//#region ../types/dist/sleep-BXv0ZcRa.mjs
|
|
5395
5395
|
/**
|
|
5396
5396
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5397
5397
|
* window to float samples (D455).
|
|
@@ -6192,6 +6192,40 @@ var BaseAddon = class {
|
|
|
6192
6192
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6193
6193
|
return keys.size > 0 ? projectStore(raw, keys, node) : raw;
|
|
6194
6194
|
}
|
|
6195
|
+
/**
|
|
6196
|
+
* Whether ONE global key of this addon's store was written, read three-way
|
|
6197
|
+
* (D651). For a question a hydrated view cannot answer: `getGlobalSettings`
|
|
6198
|
+
* reports `value ?? default`, so "the operator chose the default" and "nobody
|
|
6199
|
+
* chose" look the same, and a failed read looks like both. A `perNode` key is
|
|
6200
|
+
* not supported here: its stored name is scoped.
|
|
6201
|
+
*/
|
|
6202
|
+
async readStoredGlobalKey(key) {
|
|
6203
|
+
const read = this._ctx?.settings?.readAddonStoreResult;
|
|
6204
|
+
if (read === void 0) return {
|
|
6205
|
+
kind: "unreadable",
|
|
6206
|
+
reason: "three-way-read-unavailable"
|
|
6207
|
+
};
|
|
6208
|
+
let result;
|
|
6209
|
+
try {
|
|
6210
|
+
result = await read.call(this._ctx?.settings);
|
|
6211
|
+
} catch (err) {
|
|
6212
|
+
return {
|
|
6213
|
+
kind: "unreadable",
|
|
6214
|
+
reason: "store-read-failed",
|
|
6215
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6216
|
+
};
|
|
6217
|
+
}
|
|
6218
|
+
if (result.kind === "failed") return {
|
|
6219
|
+
kind: "unreadable",
|
|
6220
|
+
reason: "store-read-failed",
|
|
6221
|
+
error: result.error
|
|
6222
|
+
};
|
|
6223
|
+
if (result.kind === "missing" || !Object.prototype.hasOwnProperty.call(result.value, key)) return { kind: "absent" };
|
|
6224
|
+
return {
|
|
6225
|
+
kind: "present",
|
|
6226
|
+
value: result.value[key]
|
|
6227
|
+
};
|
|
6228
|
+
}
|
|
6195
6229
|
async updateGlobalSettings(patch, nodeId) {
|
|
6196
6230
|
const keys = this.perNodeKeys();
|
|
6197
6231
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
@@ -10319,6 +10353,43 @@ var LogChannelWindowSchema = object({
|
|
|
10319
10353
|
/** `null` = every camera. A non-empty list narrows to those numeric ids. */
|
|
10320
10354
|
deviceIds: array(number().int()).readonly().nullable()
|
|
10321
10355
|
});
|
|
10356
|
+
var ClipModelMetaSchema = object({
|
|
10357
|
+
/** The paired text encoder's catalog id (the embedding-encoder's text catalog). */
|
|
10358
|
+
textModelId: string().min(1),
|
|
10359
|
+
/** Output dimension of BOTH towers. A vector of any other length is refused. */
|
|
10360
|
+
embeddingDim: number().int().positive(),
|
|
10361
|
+
/**
|
|
10362
|
+
* The `vector-store` index this model's vectors live in. ONE feature space
|
|
10363
|
+
* per index: two models share an index only when their vectors are ranked
|
|
10364
|
+
* against each other, which for CLIP means never across families. MobileCLIP
|
|
10365
|
+
* S1 and S2 share `object-clip` for history (separated by the row's
|
|
10366
|
+
* `modelId`); any other model gets its own.
|
|
10367
|
+
*/
|
|
10368
|
+
vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
|
|
10369
|
+
/**
|
|
10370
|
+
* The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
|
|
10371
|
+
* must be unique per tokenizer: every model's siblings land in ONE flat
|
|
10372
|
+
* models directory, so two different tokenizers under the same name would
|
|
10373
|
+
* silently overwrite each other (whichever model downloaded last wins, and
|
|
10374
|
+
* the other one tokenises with the wrong vocabulary).
|
|
10375
|
+
*/
|
|
10376
|
+
tokenizerFile: string().min(1),
|
|
10377
|
+
/** Token window the text graph takes (SigLIP2: 64; CLIP BPE: 77). */
|
|
10378
|
+
contextLength: number().int().positive(),
|
|
10379
|
+
/** Id the tokenizer pads with. */
|
|
10380
|
+
padId: number().int().nonnegative(),
|
|
10381
|
+
/**
|
|
10382
|
+
* The search cosine floor at `strictness: 'loose'` — calibrated per model,
|
|
10383
|
+
* because cosine bands are a property of the model: 0.2 keeps 96% of matched
|
|
10384
|
+
* COCO caption-image pairs on MobileCLIP S1 and 2.7% on SigLIP2.
|
|
10385
|
+
*/
|
|
10386
|
+
searchMinScore: number().min(0).max(1)
|
|
10387
|
+
});
|
|
10388
|
+
var ClipSearchStrictnessSchema = _enum([
|
|
10389
|
+
"loose",
|
|
10390
|
+
"balanced",
|
|
10391
|
+
"strict"
|
|
10392
|
+
]);
|
|
10322
10393
|
var MODEL_FORMATS = [
|
|
10323
10394
|
"onnx",
|
|
10324
10395
|
"coreml",
|
|
@@ -10522,7 +10593,14 @@ var ModelCatalogEntrySchema = object({
|
|
|
10522
10593
|
* applies (Frigate / COCO public catalog). Set on a custom model whose raw
|
|
10523
10594
|
* labels already ARE the CamStack macros (Scrypted identity map).
|
|
10524
10595
|
*/
|
|
10525
|
-
classMap: DetectionCatalogClassMapSchema.optional()
|
|
10596
|
+
classMap: DetectionCatalogClassMapSchema.optional(),
|
|
10597
|
+
/**
|
|
10598
|
+
* The model's CLIP feature-space contract (text encoder, dimension, vector
|
|
10599
|
+
* index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
|
|
10600
|
+
* CLIP image encoder; its absence is what "not a CLIP model" means to the
|
|
10601
|
+
* embedding encoder and the semantic-search store (D649).
|
|
10602
|
+
*/
|
|
10603
|
+
clip: ClipModelMetaSchema.optional()
|
|
10526
10604
|
});
|
|
10527
10605
|
var ConvertTargetSchema = discriminatedUnion("format", [object({
|
|
10528
10606
|
format: literal("openvino"),
|
|
@@ -14797,6 +14875,13 @@ var LinkedDeviceSchema = object({
|
|
|
14797
14875
|
features: array(string()),
|
|
14798
14876
|
producesTrackedEvents: boolean().optional()
|
|
14799
14877
|
});
|
|
14878
|
+
/**
|
|
14879
|
+
* The `linked-devices` extension slot's editable value (D648): the operator's
|
|
14880
|
+
* pick list, exactly what `_linkedDeviceIds` persists. Tree children are NOT
|
|
14881
|
+
* in it — they are always linked and are not a pick.
|
|
14882
|
+
*/
|
|
14883
|
+
var LinkedDevicesSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
|
|
14884
|
+
DeviceType.Camera;
|
|
14800
14885
|
/** One camera's resolved linked set, tagged with the camera it belongs to.
|
|
14801
14886
|
* The batch answer needs the tag; the single-device answer already has it
|
|
14802
14887
|
* from the input, which is why `getLinkedDevices` keeps the untagged shape. */
|
|
@@ -15322,16 +15407,101 @@ var EmbeddingResultSchema = object({
|
|
|
15322
15407
|
embedding: array(number()),
|
|
15323
15408
|
inferenceMs: number()
|
|
15324
15409
|
});
|
|
15410
|
+
/** The two CLIP towers the encoder runs; a crash budget is kept per tower. */
|
|
15411
|
+
var EmbeddingTowerSchema = _enum(["image", "text"]);
|
|
15412
|
+
/**
|
|
15413
|
+
* A tower in the terminal `failed` state (D649, D6): it crashed or failed to
|
|
15414
|
+
* load `crashes` times within `windowMs`, and is refused by name until an
|
|
15415
|
+
* operator `resetFailedModels` or a model change — never on a timer.
|
|
15416
|
+
*
|
|
15417
|
+
* `nodeId` is the node whose tower failed. The state lives in THAT node's
|
|
15418
|
+
* encoder process (in memory — a runner respawn clears it), and one node's
|
|
15419
|
+
* answer says nothing about another's.
|
|
15420
|
+
*/
|
|
15421
|
+
var EmbeddingFailedModelSchema = object({
|
|
15422
|
+
modelId: string(),
|
|
15423
|
+
tower: EmbeddingTowerSchema,
|
|
15424
|
+
nodeId: string(),
|
|
15425
|
+
crashes: number(),
|
|
15426
|
+
windowMs: number(),
|
|
15427
|
+
sinceMs: number(),
|
|
15428
|
+
lastReason: string()
|
|
15429
|
+
});
|
|
15430
|
+
/**
|
|
15431
|
+
* A model whose REQUIREMENTS can never be met on this node (D649 round 5):
|
|
15432
|
+
* an id the catalog does not know, a model URL answering 404/410, a declared
|
|
15433
|
+
* sibling (the tokenizer) that is not there. After `attempts` failed builds
|
|
15434
|
+
* it is terminally `requirements-failed`, refused by name until an operator
|
|
15435
|
+
* `resetFailedModels` or a model change — the same exits as a crashed tower.
|
|
15436
|
+
*/
|
|
15437
|
+
var EmbeddingFailedRequirementSchema = object({
|
|
15438
|
+
modelId: string(),
|
|
15439
|
+
tower: EmbeddingTowerSchema,
|
|
15440
|
+
nodeId: string(),
|
|
15441
|
+
attempts: number(),
|
|
15442
|
+
sinceMs: number(),
|
|
15443
|
+
lastReason: string()
|
|
15444
|
+
});
|
|
15325
15445
|
var EmbeddingInfoSchema = object({
|
|
15326
15446
|
modelId: string(),
|
|
15327
15447
|
embeddingDim: number(),
|
|
15328
|
-
ready: boolean()
|
|
15329
|
-
|
|
15448
|
+
ready: boolean(),
|
|
15449
|
+
/**
|
|
15450
|
+
* The node that answered. Absent only from an encoder older than D649's
|
|
15451
|
+
* crash budget — whose `failedModels` is then UNKNOWN (D315), never "none".
|
|
15452
|
+
*/
|
|
15453
|
+
nodeId: string().optional(),
|
|
15454
|
+
/**
|
|
15455
|
+
* Towers in `failed` on the answering node, each row naming it. `undefined`
|
|
15456
|
+
* means the node could not say (pre-budget encoder); a node that has the
|
|
15457
|
+
* budget always answers an array, empty included.
|
|
15458
|
+
*/
|
|
15459
|
+
failedModels: array(EmbeddingFailedModelSchema).optional(),
|
|
15460
|
+
/** Models terminally `requirements-failed` on the answering node; same reading as above. */
|
|
15461
|
+
failedRequirements: array(EmbeddingFailedRequirementSchema).optional()
|
|
15462
|
+
});
|
|
15463
|
+
/**
|
|
15464
|
+
* The THREE codes an encoder refusal can carry (D649, D6). Same shape as
|
|
15465
|
+
* `VECTOR_INDEX_DIM_CONFLICT`: the code rides in the MESSAGE, because an
|
|
15466
|
+
* Error's own properties do not survive the UDS/tRPC hop and its message does,
|
|
15467
|
+
* and both sides go through the helpers below — the encoder builds the
|
|
15468
|
+
* refusal, the live detail plane classifies on it to count refusals per
|
|
15469
|
+
* camera instead of logging one warning per track. The bracketed token
|
|
15470
|
+
* carries the code, the model, the tower and the node so a consumer never
|
|
15471
|
+
* parses prose.
|
|
15472
|
+
*
|
|
15473
|
+
* - `EMBEDDING_MODEL_FAILED`: the tower crashed / failed to load past the crash
|
|
15474
|
+
* budget — terminal until `resetFailedModels` or a model change.
|
|
15475
|
+
* - `EMBEDDING_REQUIREMENTS_UNAVAILABLE`: files or runtime not there right now
|
|
15476
|
+
* (a download or Python that failed, or the cooldown after one) — the next
|
|
15477
|
+
* request past the cooldown tries again.
|
|
15478
|
+
* - `EMBEDDING_REQUIREMENTS_FAILED`: the requirements can never be met (unknown
|
|
15479
|
+
* id, 404/410, missing sibling) and the bounded attempts are spent —
|
|
15480
|
+
* terminal, same exits as a crashed tower.
|
|
15481
|
+
*/
|
|
15482
|
+
var EMBEDDING_MODEL_FAILED = "embedding-model-failed";
|
|
15483
|
+
var EMBEDDING_REQUIREMENTS_UNAVAILABLE = "embedding-requirements-unavailable";
|
|
15484
|
+
var EMBEDDING_REQUIREMENTS_FAILED = "embedding-requirements-failed";
|
|
15485
|
+
_enum([
|
|
15486
|
+
EMBEDDING_MODEL_FAILED,
|
|
15487
|
+
EMBEDDING_REQUIREMENTS_UNAVAILABLE,
|
|
15488
|
+
EMBEDDING_REQUIREMENTS_FAILED
|
|
15489
|
+
]);
|
|
15490
|
+
new RegExp(`\\[(${EMBEDDING_MODEL_FAILED}|${EMBEDDING_REQUIREMENTS_UNAVAILABLE}|${EMBEDDING_REQUIREMENTS_FAILED}) model=([^\\s\\]]+) tower=(image|text) node=([^\\s\\]]+)\\]`);
|
|
15330
15491
|
method(object({
|
|
15331
15492
|
crop: _instanceof(Uint8Array),
|
|
15332
15493
|
width: number(),
|
|
15333
15494
|
height: number()
|
|
15334
|
-
}), EmbeddingResultSchema, { auth: "admin" }), method(object({
|
|
15495
|
+
}), EmbeddingResultSchema, { auth: "admin" }), method(object({
|
|
15496
|
+
text: string(),
|
|
15497
|
+
modelId: string().min(1).optional()
|
|
15498
|
+
}), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" }), method(object({ modelId: string().min(1).optional() }), object({
|
|
15499
|
+
cleared: array(string()),
|
|
15500
|
+
nodeId: string()
|
|
15501
|
+
}), {
|
|
15502
|
+
kind: "mutation",
|
|
15503
|
+
auth: "admin"
|
|
15504
|
+
});
|
|
15335
15505
|
/**
|
|
15336
15506
|
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
15337
15507
|
* through, per camera, with the denominator attached. It stores nothing.
|
|
@@ -18737,7 +18907,12 @@ var NcMediaPolicySchema = object({
|
|
|
18737
18907
|
* the degrade engine, which drops the video and keeps the still.
|
|
18738
18908
|
*/
|
|
18739
18909
|
clip: boolean().optional(),
|
|
18740
|
-
/**
|
|
18910
|
+
/**
|
|
18911
|
+
* Seconds of footage BEFORE / AFTER the event instant. Absent =
|
|
18912
|
+
* {@link NC_CLIP_PRE_ROLL_DEFAULT_SEC} / {@link NC_CLIP_POST_ROLL_DEFAULT_SEC}
|
|
18913
|
+
* (4 / 6), resolved by the Notification Center at dispatch — deliberately not
|
|
18914
|
+
* a Zod default, so a rule that never chose keeps following the hub's.
|
|
18915
|
+
*/
|
|
18741
18916
|
clipPreRollSec: number().int().min(0).max(30).optional(),
|
|
18742
18917
|
clipPostRollSec: number().int().min(0).max(30).optional(),
|
|
18743
18918
|
/**
|
|
@@ -20115,6 +20290,163 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
20115
20290
|
});
|
|
20116
20291
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
20117
20292
|
/**
|
|
20293
|
+
* A model choice has a SCOPE, and a scope change has a workflow.
|
|
20294
|
+
*
|
|
20295
|
+
* ## The two scopes
|
|
20296
|
+
*
|
|
20297
|
+
* Almost every pipeline step's model is a **node** question: which build runs
|
|
20298
|
+
* fastest on THIS accelerator. Two nodes may legitimately answer differently —
|
|
20299
|
+
* a Coral runs the tflite SSD, a Mac runs the coreml YOLO — because the answers
|
|
20300
|
+
* are compared against nothing. They produce boxes, and a box is a box.
|
|
20301
|
+
*
|
|
20302
|
+
* Two steps are not like that. `face-embedding` and `clip-embedding` produce
|
|
20303
|
+
* **vectors that land in ONE shared index** (`identity_samples`,
|
|
20304
|
+
* `vec_object_clip`) and are ranked against each other by cosine similarity.
|
|
20305
|
+
* Cosine similarity between two encoders is not a weak signal, it is a
|
|
20306
|
+
* meaningless number — and nothing inside a vector can tell you it happened.
|
|
20307
|
+
* So for those two steps the model is a **cluster** question with exactly one
|
|
20308
|
+
* answer, stored in exactly one row.
|
|
20309
|
+
*
|
|
20310
|
+
* That is the same argument [D52](../../../../docs/decisions/adr-0052.md) makes
|
|
20311
|
+
* for the crop convention (`detail-crop.ts`), one level up: the crop decides
|
|
20312
|
+
* WHAT pixels the encoder sees, this decides WHICH encoder sees them. Both are
|
|
20313
|
+
* cluster-wide for the same reason and neither may become per-node.
|
|
20314
|
+
*
|
|
20315
|
+
* ## Why the registry lives here and not in the step catalog
|
|
20316
|
+
*
|
|
20317
|
+
* The scope itself is declared on the step, in
|
|
20318
|
+
* `detection-pipeline/registry/step-definitions.ts` (`StepDefinition.modelScope`)
|
|
20319
|
+
* — that is where a new step declares what kind of choice its model is. But the
|
|
20320
|
+
* catalog lives inside `addon-pipeline`, and three packages that must NOT
|
|
20321
|
+
* import an addon need to know the set: the orchestrator (which renders and
|
|
20322
|
+
* stores the row), post-analysis (which pins the row for a re-embed pass) and
|
|
20323
|
+
* admin-ui (which mirrors it). So the set is mirrored here, and
|
|
20324
|
+
* `scripts/check-cluster-model-scope.ts` fails the build when the two disagree.
|
|
20325
|
+
* A hand-copied key that stops matching is exactly how a setting silently stops
|
|
20326
|
+
* arriving while both sides still look correct.
|
|
20327
|
+
*
|
|
20328
|
+
* ## The defaults ARE today's behaviour
|
|
20329
|
+
*
|
|
20330
|
+
* {@link DEFAULT_CLUSTER_STEP_MODELS} reproduces the catalog `defaultModelId`
|
|
20331
|
+
* of both steps. Declaring the scope therefore changes nothing on the day it
|
|
20332
|
+
* ships: the cluster row starts out saying what every node was already doing.
|
|
20333
|
+
* Changing it is legitimate — that is what the knob is for — but it invalidates
|
|
20334
|
+
* the stored vectors of that surface, and must be followed by a re-embed pass
|
|
20335
|
+
* (`face-reembed-pass.ts`, `embedding-rebuild.ts`).
|
|
20336
|
+
*/
|
|
20337
|
+
/**
|
|
20338
|
+
* Why the orchestrator cannot say which model the operator chose for a
|
|
20339
|
+
* cluster-scoped step (D651).
|
|
20340
|
+
*/
|
|
20341
|
+
var CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS = [
|
|
20342
|
+
"owner-not-ready",
|
|
20343
|
+
"store-read-failed",
|
|
20344
|
+
"three-way-read-unavailable",
|
|
20345
|
+
"invalid-stored",
|
|
20346
|
+
"not-cluster-scoped"
|
|
20347
|
+
];
|
|
20348
|
+
/**
|
|
20349
|
+
* The cluster-scoped steps. Mirrored from the catalog's `modelScope: 'cluster'`
|
|
20350
|
+
* declarations and guarded by `scripts/check-cluster-model-scope.ts`.
|
|
20351
|
+
*/
|
|
20352
|
+
var CLUSTER_MODEL_SCOPED_STEPS = [{
|
|
20353
|
+
stepId: "face-embedding",
|
|
20354
|
+
label: "Face recognition model",
|
|
20355
|
+
defaultModelId: "auraface-r100",
|
|
20356
|
+
indexName: "the enrolled face gallery",
|
|
20357
|
+
options: [
|
|
20358
|
+
{
|
|
20359
|
+
id: "auraface-r100",
|
|
20360
|
+
label: "AuraFace R100"
|
|
20361
|
+
},
|
|
20362
|
+
{
|
|
20363
|
+
id: "arcface-r100",
|
|
20364
|
+
label: "ArcFace (ResNet34)"
|
|
20365
|
+
},
|
|
20366
|
+
{
|
|
20367
|
+
id: "inception-resnet-v1",
|
|
20368
|
+
label: "Inception ResNet V1"
|
|
20369
|
+
}
|
|
20370
|
+
]
|
|
20371
|
+
}, {
|
|
20372
|
+
stepId: "clip-embedding",
|
|
20373
|
+
label: "Semantic search model",
|
|
20374
|
+
defaultModelId: "mobileclip-s1",
|
|
20375
|
+
indexName: "the object semantic-search index",
|
|
20376
|
+
options: [
|
|
20377
|
+
{
|
|
20378
|
+
id: "mobileclip-s1",
|
|
20379
|
+
label: "MobileCLIP S1"
|
|
20380
|
+
},
|
|
20381
|
+
{
|
|
20382
|
+
id: "mobileclip-s2",
|
|
20383
|
+
label: "MobileCLIP S2"
|
|
20384
|
+
},
|
|
20385
|
+
{
|
|
20386
|
+
id: "siglip2-b16-224",
|
|
20387
|
+
label: "SigLIP2 B/16 (Apache-2.0)"
|
|
20388
|
+
}
|
|
20389
|
+
]
|
|
20390
|
+
}];
|
|
20391
|
+
/**
|
|
20392
|
+
* Store identity of the cluster row inside `pipeline-orchestrator`'s GLOBAL
|
|
20393
|
+
* (cluster-wide) settings — the same owner, and for the same reason, as the
|
|
20394
|
+
* detail-crop convention: hub-resident and neutral between the addons that
|
|
20395
|
+
* read it.
|
|
20396
|
+
*/
|
|
20397
|
+
var CLUSTER_MODEL_SECTION_ID = "cluster-step-models";
|
|
20398
|
+
/**
|
|
20399
|
+
* The settings key holding one step's cluster model choice.
|
|
20400
|
+
*
|
|
20401
|
+
* Step-qualified so the keys stay unique across the addon's whole schema, which
|
|
20402
|
+
* is what lets {@link pickClusterStepModels} walk every section instead of
|
|
20403
|
+
* trusting the section id.
|
|
20404
|
+
*/
|
|
20405
|
+
function clusterModelSettingKey(stepId) {
|
|
20406
|
+
return `clusterModel:${stepId}`;
|
|
20407
|
+
}
|
|
20408
|
+
Object.freeze(Object.fromEntries(CLUSTER_MODEL_SCOPED_STEPS.map((s) => [s.stepId, s.defaultModelId])));
|
|
20409
|
+
function interpretStoredClusterModel(raw) {
|
|
20410
|
+
if (raw === void 0 || raw === null || raw === "") return { kind: "absent" };
|
|
20411
|
+
if (typeof raw === "string") return {
|
|
20412
|
+
kind: "chosen",
|
|
20413
|
+
modelId: raw
|
|
20414
|
+
};
|
|
20415
|
+
return {
|
|
20416
|
+
kind: "invalid",
|
|
20417
|
+
value: raw
|
|
20418
|
+
};
|
|
20419
|
+
}
|
|
20420
|
+
var CLUSTER_STEP_SETTING_FIELDS = [{
|
|
20421
|
+
stepId: "face-embedding",
|
|
20422
|
+
key: "minLandmarkFaceSize",
|
|
20423
|
+
label: "Min face size for recognition (detection px)",
|
|
20424
|
+
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.",
|
|
20425
|
+
type: "slider",
|
|
20426
|
+
min: 0,
|
|
20427
|
+
max: 64,
|
|
20428
|
+
step: 2,
|
|
20429
|
+
default: 24
|
|
20430
|
+
}];
|
|
20431
|
+
function clusterStepSettingKey(stepId, fieldKey) {
|
|
20432
|
+
return `clusterStepSetting:${stepId}:${fieldKey}`;
|
|
20433
|
+
}
|
|
20434
|
+
var ClusterSettingNumberSchema = number().finite();
|
|
20435
|
+
function readClusterStepSettings(config) {
|
|
20436
|
+
const out = {};
|
|
20437
|
+
for (const field of CLUSTER_STEP_SETTING_FIELDS) {
|
|
20438
|
+
const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
|
|
20439
|
+
const value = parsed.success ? parsed.data : field.default;
|
|
20440
|
+
const existing = out[field.stepId] ?? {};
|
|
20441
|
+
out[field.stepId] = {
|
|
20442
|
+
...existing,
|
|
20443
|
+
[field.key]: value
|
|
20444
|
+
};
|
|
20445
|
+
}
|
|
20446
|
+
return out;
|
|
20447
|
+
}
|
|
20448
|
+
readClusterStepSettings({});
|
|
20449
|
+
/**
|
|
20118
20450
|
* pipeline-analytics — device-scoped wrapper cap. Refines raw
|
|
20119
20451
|
* per-frame detections emitted by the pipeline runner into tracked
|
|
20120
20452
|
* objects, per-kind event collections (motion / object / audio), and
|
|
@@ -20930,7 +21262,8 @@ var MediaFileKindEnum = _enum([
|
|
|
20930
21262
|
"thumbnailSmall",
|
|
20931
21263
|
"confirmationCrop",
|
|
20932
21264
|
"debugCrop",
|
|
20933
|
-
"sceneFrame"
|
|
21265
|
+
"sceneFrame",
|
|
21266
|
+
"lastSceneFrame"
|
|
20934
21267
|
]);
|
|
20935
21268
|
/**
|
|
20936
21269
|
* One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
|
|
@@ -21482,7 +21815,23 @@ var SearchObjectEventsInput = object({
|
|
|
21482
21815
|
until: number().optional(),
|
|
21483
21816
|
classFilter: string().optional(),
|
|
21484
21817
|
limit: number().default(50),
|
|
21485
|
-
|
|
21818
|
+
/**
|
|
21819
|
+
* An ABSOLUTE cosine floor. Optional since D649: a floor is a property of the
|
|
21820
|
+
* model (0.2 kept 96% of matched pairs on MobileCLIP S1 and 2.7% on SigLIP2),
|
|
21821
|
+
* so an absent one resolves to the searched model's own `searchMinScore`
|
|
21822
|
+
* scaled by `strictness`. A number sent here is honoured verbatim.
|
|
21823
|
+
*/
|
|
21824
|
+
minScore: number().min(0).max(1).optional(),
|
|
21825
|
+
/** Model-relative floor — see `resolveClipSearchMinScore`. Default `loose`. */
|
|
21826
|
+
strictness: ClipSearchStrictnessSchema.optional(),
|
|
21827
|
+
/**
|
|
21828
|
+
* Search THIS CLIP model's index instead of the cluster row's. Every index a
|
|
21829
|
+
* model ever wrote stays searchable until it is wiped (the MobileCLIP index
|
|
21830
|
+
* through a SigLIP2 cutover and its rollback window). An id with no CLIP
|
|
21831
|
+
* metadata is refused; an id other than the cluster row's is ADMIN-only
|
|
21832
|
+
* (`model-override-requires-admin`).
|
|
21833
|
+
*/
|
|
21834
|
+
modelId: string().min(1).optional()
|
|
21486
21835
|
});
|
|
21487
21836
|
var TrackCascadeCountsSchema = object({
|
|
21488
21837
|
/** Persisted track roots deleted (authoritative). */
|
|
@@ -21617,7 +21966,41 @@ var RebuildObjectEmbeddingsInput = object({
|
|
|
21617
21966
|
* comparable, so wiping and rebuilding is the only way to be sure every vector
|
|
21618
21967
|
* means the same thing.
|
|
21619
21968
|
*/
|
|
21620
|
-
var WipeObjectEmbeddingsResultSchema = object({
|
|
21969
|
+
var WipeObjectEmbeddingsResultSchema = object({
|
|
21970
|
+
deleted: number(),
|
|
21971
|
+
/**
|
|
21972
|
+
* CLIP indexes that could NOT be emptied (unreachable, or refused at their
|
|
21973
|
+
* dimension) — not a clean slate. Additive and optional (D649).
|
|
21974
|
+
*/
|
|
21975
|
+
failedIndexes: array(string()).optional()
|
|
21976
|
+
});
|
|
21977
|
+
/**
|
|
21978
|
+
* Why a rebuild did not start, BY NAME — ONE vocabulary for both gates in front
|
|
21979
|
+
* of a pass (D649 over D651). A bare `started: false` read the same for "the
|
|
21980
|
+
* stores are booting" and "the cluster row names a model with no CLIP
|
|
21981
|
+
* metadata", which need different fixes.
|
|
21982
|
+
* - `stores-unavailable` — the analytics stores or the API are not up yet.
|
|
21983
|
+
* - the owner's confirmation of the cluster model (D651, `ClusterPinConfirmer`):
|
|
21984
|
+
* a pass that rewrites an index needs two agreeing reads of the OWNER's
|
|
21985
|
+
* answer (`pipelineOrchestrator.getClusterModelChoice`) — a pass that cannot
|
|
21986
|
+
* name its model does not run (D54):
|
|
21987
|
+
* - the owner's own `unreadable` reasons (`owner-not-ready`,
|
|
21988
|
+
* `store-read-failed`, `three-way-read-unavailable`, `invalid-stored`,
|
|
21989
|
+
* `not-cluster-scoped`);
|
|
21990
|
+
* - `method-unavailable` — the orchestrator predates the method;
|
|
21991
|
+
* - `read-failed` — the call failed or answered something unparseable;
|
|
21992
|
+
* - `reads-disagree` — the two reads named different choices.
|
|
21993
|
+
* - `not-a-clip-model` — the CONFIRMED id has no CLIP metadata, so there is no
|
|
21994
|
+
* index to fill and no dimension to check against (D649).
|
|
21995
|
+
*/
|
|
21996
|
+
var RebuildObjectEmbeddingsRefusalSchema = _enum([
|
|
21997
|
+
"stores-unavailable",
|
|
21998
|
+
...CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS,
|
|
21999
|
+
"method-unavailable",
|
|
22000
|
+
"read-failed",
|
|
22001
|
+
"reads-disagree",
|
|
22002
|
+
"not-a-clip-model"
|
|
22003
|
+
]);
|
|
21621
22004
|
/**
|
|
21622
22005
|
* Acknowledgement that a rebuild STARTED.
|
|
21623
22006
|
*
|
|
@@ -21630,7 +22013,12 @@ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
|
|
|
21630
22013
|
var RebuildObjectEmbeddingsResultSchema = object({
|
|
21631
22014
|
started: boolean(),
|
|
21632
22015
|
/** True when a pass was already running; the new request is ignored. */
|
|
21633
|
-
alreadyRunning: boolean()
|
|
22016
|
+
alreadyRunning: boolean(),
|
|
22017
|
+
/** Present when the pass refused to start — see `RebuildObjectEmbeddingsRefusalSchema`. */
|
|
22018
|
+
refusal: RebuildObjectEmbeddingsRefusalSchema.optional(),
|
|
22019
|
+
/** The CLIP model the pass pinned, and the index it fills (when it started). */
|
|
22020
|
+
modelId: string().optional(),
|
|
22021
|
+
index: string().optional()
|
|
21634
22022
|
});
|
|
21635
22023
|
var RebuildStatusSchema = object({
|
|
21636
22024
|
running: boolean(),
|
|
@@ -21664,7 +22052,11 @@ var RebuildStatusSchema = object({
|
|
|
21664
22052
|
startedAtMs: number().nullable(),
|
|
21665
22053
|
finishedAtMs: number().nullable(),
|
|
21666
22054
|
/** Present when the pass ended by throwing. */
|
|
21667
|
-
error: string().nullable()
|
|
22055
|
+
error: string().nullable(),
|
|
22056
|
+
/** The CLIP model the current / last pass pinned (D54), `null` before any. */
|
|
22057
|
+
modelId: string().nullable(),
|
|
22058
|
+
/** The index that pass fills — `ClipModelMeta.vectorIndex` of `modelId` (D649). */
|
|
22059
|
+
index: string().nullable()
|
|
21668
22060
|
});
|
|
21669
22061
|
/**
|
|
21670
22062
|
* Acknowledgement that a debug-media reclaim STARTED.
|
|
@@ -21985,7 +22377,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
21985
22377
|
deviceId: number(),
|
|
21986
22378
|
ownerKind: MediaPresenceOwnerKindSchema,
|
|
21987
22379
|
ownerIds: array(string()).max(5e3)
|
|
21988
|
-
}), array(string()).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
22380
|
+
}), array(string()).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly(), { caller: "required" }), method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
21989
22381
|
kind: "mutation",
|
|
21990
22382
|
auth: "admin"
|
|
21991
22383
|
}), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
|
|
@@ -23256,6 +23648,17 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
|
|
|
23256
23648
|
hubHostnameOverride: string().optional()
|
|
23257
23649
|
})]).describe("Per-camera frame-source mode for the runner (P2c)");
|
|
23258
23650
|
/**
|
|
23651
|
+
* What ONE step runs with on ONE roster device for THIS camera (D650): the
|
|
23652
|
+
* device's per-(node,device) base with the camera's override for that device
|
|
23653
|
+
* on top — the same `override ?? base` merge the orchestrator applies to the
|
|
23654
|
+
* elected device (`applyDeviceProvisioning`). Absent `modelId` ⇒ the executor
|
|
23655
|
+
* resolves the device format's default, exactly as on the elected device.
|
|
23656
|
+
*/
|
|
23657
|
+
var RunnerJumpStepProvisioningSchema = object({
|
|
23658
|
+
modelId: string().optional(),
|
|
23659
|
+
settings: record(string(), unknown()).optional()
|
|
23660
|
+
});
|
|
23661
|
+
/**
|
|
23259
23662
|
* One ENABLED inference device on the runner's node, as the step-tree
|
|
23260
23663
|
* device-jump resolver sees it (phase 1). The orchestrator populates this
|
|
23261
23664
|
* roster on the attach payload whenever the camera is elected onto a specific
|
|
@@ -23267,7 +23670,16 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
|
|
|
23267
23670
|
var RunnerInferenceDeviceSchema = object({
|
|
23268
23671
|
deviceKey: string(),
|
|
23269
23672
|
weight: number().positive().default(1),
|
|
23270
|
-
maxSessions: number().int().positive().nullable().default(null)
|
|
23673
|
+
maxSessions: number().int().positive().nullable().default(null),
|
|
23674
|
+
/**
|
|
23675
|
+
* Per-step provisioning for this camera on THIS device (D650), keyed by step
|
|
23676
|
+
* id. A step the runner jumps here runs with these fields, never with the
|
|
23677
|
+
* elected device's: `modelId` / `settings` are REPLACED on the jumped subtree
|
|
23678
|
+
* (a step absent from the map runs with neither — the target format default).
|
|
23679
|
+
* Absent field ⇒ an orchestrator that predates D650: the jumped step keeps
|
|
23680
|
+
* the elected device's provisioning, as before.
|
|
23681
|
+
*/
|
|
23682
|
+
steps: record(string(), RunnerJumpStepProvisioningSchema).optional()
|
|
23271
23683
|
});
|
|
23272
23684
|
/**
|
|
23273
23685
|
* Camera assignment payload sent by `addon-pipeline-orchestrator` to a
|
|
@@ -24343,6 +24755,28 @@ var NodeInferenceDeviceSchema = object({
|
|
|
24343
24755
|
*/
|
|
24344
24756
|
exclusion: InferenceDeviceExclusionReasonSchema.nullable()
|
|
24345
24757
|
});
|
|
24758
|
+
/**
|
|
24759
|
+
* The operator's model choice for one cluster-scoped step, answered by the
|
|
24760
|
+
* addon that OWNS the `clusterModel:*` settings (D651). Three answers, never
|
|
24761
|
+
* folded: a written choice, a key nobody wrote (the cluster runs the default
|
|
24762
|
+
* BY ABSENCE), or no answer. A caller that rewrites an index acts only on the
|
|
24763
|
+
* first two, read twice and agreeing.
|
|
24764
|
+
*/
|
|
24765
|
+
var ClusterModelChoiceSchema = discriminatedUnion("kind", [
|
|
24766
|
+
object({
|
|
24767
|
+
kind: literal("stored"),
|
|
24768
|
+
modelId: string()
|
|
24769
|
+
}),
|
|
24770
|
+
object({
|
|
24771
|
+
kind: literal("absent"),
|
|
24772
|
+
defaultModelId: string()
|
|
24773
|
+
}),
|
|
24774
|
+
object({
|
|
24775
|
+
kind: literal("unreadable"),
|
|
24776
|
+
reason: _enum(CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS),
|
|
24777
|
+
error: string().optional()
|
|
24778
|
+
})
|
|
24779
|
+
]);
|
|
24346
24780
|
var NodeInferenceDevicesSchema = object({
|
|
24347
24781
|
nodeId: string(),
|
|
24348
24782
|
/** False when the node's platform-probe was unreachable (no live device set). */
|
|
@@ -24439,9 +24873,19 @@ var pipelineOrchestratorCapability = {
|
|
|
24439
24873
|
* Trigger a full rebalance pass. Iterates over all assigned cameras,
|
|
24440
24874
|
* recomputes the optimal agent for each one based on current load +
|
|
24441
24875
|
* hardware affinity, and migrates cameras whose current agent is no
|
|
24442
|
-
* longer optimal. Pinned cameras are never migrated.
|
|
24876
|
+
* longer optimal. Pinned cameras are never migrated. `skipped` names the
|
|
24877
|
+
* cameras the pass wanted to move and could not, with why — a target node
|
|
24878
|
+
* that has not answered its catalog / device health yet, or a device that
|
|
24879
|
+
* cannot run the camera's root (D650).
|
|
24443
24880
|
*/
|
|
24444
|
-
rebalance: method(_void(), object({
|
|
24881
|
+
rebalance: method(_void(), object({
|
|
24882
|
+
migrated: number(),
|
|
24883
|
+
skipped: array(object({
|
|
24884
|
+
deviceId: number(),
|
|
24885
|
+
targetNodeId: string(),
|
|
24886
|
+
reason: string()
|
|
24887
|
+
})).default([])
|
|
24888
|
+
}), {
|
|
24445
24889
|
kind: "mutation",
|
|
24446
24890
|
auth: "admin"
|
|
24447
24891
|
}),
|
|
@@ -24451,6 +24895,13 @@ var pipelineOrchestratorCapability = {
|
|
|
24451
24895
|
getPipelineAssignment: method(object({ deviceId: number() }), PipelineAssignmentSchema.nullable()),
|
|
24452
24896
|
/** Get per-agent load summaries used by the load balancer + dashboards. */
|
|
24453
24897
|
getAgentLoad: method(_void(), array(AgentLoadSummarySchema).readonly()),
|
|
24898
|
+
/**
|
|
24899
|
+
* The operator's STORED model choice for one cluster-scoped step (D651).
|
|
24900
|
+
* Read three-way from this addon's own store, only once its boot has
|
|
24901
|
+
* settled. Unlike `addonSettings.getGlobalSettings`, it never answers a
|
|
24902
|
+
* default as though someone chose it.
|
|
24903
|
+
*/
|
|
24904
|
+
getClusterModelChoice: method(object({ stepId: string() }), ClusterModelChoiceSchema),
|
|
24454
24905
|
/** Aggregate global metrics across the whole detection cluster. */
|
|
24455
24906
|
getGlobalMetrics: method(_void(), GlobalMetricsSchema),
|
|
24456
24907
|
/**
|
|
@@ -27003,6 +27454,167 @@ DeviceType.Camera, method(object({
|
|
|
27003
27454
|
auth: "protected"
|
|
27004
27455
|
});
|
|
27005
27456
|
/**
|
|
27457
|
+
* LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
|
|
27458
|
+
* valutatore puro del suo FRONTE.
|
|
27459
|
+
*
|
|
27460
|
+
* Viveva dentro il builtin virtual-doorbell
|
|
27461
|
+
* (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
|
|
27462
|
+
* predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
|
|
27463
|
+
* `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
|
|
27464
|
+
* tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
|
|
27465
|
+
* fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
|
|
27466
|
+
* SPOSTA qui e il doorbell la ri-esporta.
|
|
27467
|
+
*
|
|
27468
|
+
* ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
|
|
27469
|
+
* due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
|
|
27470
|
+
* regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
|
|
27471
|
+
* booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
|
|
27472
|
+
*/
|
|
27473
|
+
/**
|
|
27474
|
+
* Known binary / switch source caps → the boolean slice field whose
|
|
27475
|
+
* false→true rise counts as ACTIVE. Every entry is "fire on active".
|
|
27476
|
+
* Sensors whose "active" reading is not a plain boolean (presence's string
|
|
27477
|
+
* state, connectivity's connected flag) are deliberately excluded — a
|
|
27478
|
+
* reconnect is not a doorbell press, and it is not a recording either.
|
|
27479
|
+
*/
|
|
27480
|
+
var SOURCE_CAP_ACTIVE_FIELD = {
|
|
27481
|
+
contact: "entryOpen",
|
|
27482
|
+
binary: "on",
|
|
27483
|
+
switch: "on",
|
|
27484
|
+
motion: "detected",
|
|
27485
|
+
flood: "flooded",
|
|
27486
|
+
gas: "detected",
|
|
27487
|
+
smoke: "detected",
|
|
27488
|
+
"carbon-monoxide": "detected",
|
|
27489
|
+
vibration: "detected",
|
|
27490
|
+
tamper: "tampered"
|
|
27491
|
+
};
|
|
27492
|
+
object({
|
|
27493
|
+
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
27494
|
+
lastPressedAt: number().nullable(),
|
|
27495
|
+
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
27496
|
+
pressCountSinceStart: number()
|
|
27497
|
+
});
|
|
27498
|
+
object({
|
|
27499
|
+
deviceId: number(),
|
|
27500
|
+
timestamp: number()
|
|
27501
|
+
});
|
|
27502
|
+
/**
|
|
27503
|
+
* The `doorbell-source` extension slot's editable value (D648): the camera's
|
|
27504
|
+
* virtual-doorbell trigger devices, exactly what the wrapper's
|
|
27505
|
+
* `doorbellSources` persists (as `{ deviceId }` records).
|
|
27506
|
+
*/
|
|
27507
|
+
var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
|
|
27508
|
+
DeviceType.Camera;
|
|
27509
|
+
DeviceType.Button, DeviceType.Camera;
|
|
27510
|
+
var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
|
|
27511
|
+
DeviceType.Camera, DeviceType.Camera;
|
|
27512
|
+
/** A slot's editable value, discriminated on `slot`. */
|
|
27513
|
+
var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
|
|
27514
|
+
DeviceType.Camera;
|
|
27515
|
+
var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
|
|
27516
|
+
state: literal("unreachable"),
|
|
27517
|
+
reason: string()
|
|
27518
|
+
})]);
|
|
27519
|
+
/** One provider of slots — the D554 source-listing row. */
|
|
27520
|
+
var ExtensionSourceSchema = object({
|
|
27521
|
+
/** The routing prefix of every `slotRef` this provider serves. */
|
|
27522
|
+
source: string(),
|
|
27523
|
+
label: string(),
|
|
27524
|
+
/** Stamped by the dispatcher from the registry (D557). */
|
|
27525
|
+
addonId: string().optional(),
|
|
27526
|
+
availability: ExtensionSourceAvailabilitySchema
|
|
27527
|
+
});
|
|
27528
|
+
/**
|
|
27529
|
+
* How one picked source stands. `missing` — no such device (deleted, or an id
|
|
27530
|
+
* that never existed); `foreign` — a device the slot's owner cannot read from
|
|
27531
|
+
* (slice 2's cross-owner graft source); `unavailable` — it exists but is not a
|
|
27532
|
+
* valid source now (a container, which is never a pick). A source in any of
|
|
27533
|
+
* these states is SHOWN, never silently dropped or re-pointed.
|
|
27534
|
+
*/
|
|
27535
|
+
var ExtensionSourceHealthSchema = _enum([
|
|
27536
|
+
"ok",
|
|
27537
|
+
"missing",
|
|
27538
|
+
"foreign",
|
|
27539
|
+
"unavailable"
|
|
27540
|
+
]);
|
|
27541
|
+
var ExtensionSlotSourceSchema = object({
|
|
27542
|
+
deviceId: number().int(),
|
|
27543
|
+
/** The device's name, or null when it could not be resolved (`missing`). */
|
|
27544
|
+
name: string().nullable(),
|
|
27545
|
+
health: ExtensionSourceHealthSchema,
|
|
27546
|
+
detail: string().optional()
|
|
27547
|
+
});
|
|
27548
|
+
/**
|
|
27549
|
+
* A DIFFERENT authority that gates whether the slot's sources do anything —
|
|
27550
|
+
* reported read-only, named, never written through this contract (D62). The
|
|
27551
|
+
* virtual doorbell's sources ring only while the wrapper is bound to the
|
|
27552
|
+
* camera, and that binding belongs to `deviceManager.setWrapperActive`.
|
|
27553
|
+
* `unknown` means the gate could not be read; it is not "inactive" (D315).
|
|
27554
|
+
*/
|
|
27555
|
+
var ExtensionSlotActivationSchema = object({
|
|
27556
|
+
state: _enum([
|
|
27557
|
+
"active",
|
|
27558
|
+
"inactive",
|
|
27559
|
+
"unknown"
|
|
27560
|
+
]),
|
|
27561
|
+
authority: string(),
|
|
27562
|
+
detail: string().optional()
|
|
27563
|
+
});
|
|
27564
|
+
var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
|
|
27565
|
+
state: literal("ok"),
|
|
27566
|
+
/** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
|
|
27567
|
+
slotRef: string(),
|
|
27568
|
+
slot: ExtensionSlotIdSchema,
|
|
27569
|
+
/** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
|
|
27570
|
+
authority: string(),
|
|
27571
|
+
/** graft: its switch. association: null — removing every source is "off". */
|
|
27572
|
+
enabled: boolean().nullable(),
|
|
27573
|
+
/** graft: the cap registered on the host. association: null. */
|
|
27574
|
+
projects: string().nullable(),
|
|
27575
|
+
activation: ExtensionSlotActivationSchema.nullable(),
|
|
27576
|
+
value: ExtensionSlotValueSchema,
|
|
27577
|
+
sources: array(ExtensionSlotSourceSchema)
|
|
27578
|
+
}), object({
|
|
27579
|
+
state: literal("unreachable"),
|
|
27580
|
+
addonId: string(),
|
|
27581
|
+
reason: string()
|
|
27582
|
+
})]);
|
|
27583
|
+
var ExtensionCandidatesSchema = object({ candidates: array(object({
|
|
27584
|
+
deviceId: number().int(),
|
|
27585
|
+
name: string(),
|
|
27586
|
+
type: string(),
|
|
27587
|
+
location: string().nullable(),
|
|
27588
|
+
/** The container a child belongs to — "Spotlight 2" alone does not say which. */
|
|
27589
|
+
parentName: string().nullable(),
|
|
27590
|
+
/** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
|
|
27591
|
+
suggested: boolean(),
|
|
27592
|
+
/** Why it is suggested ("same location"), null when it is not. */
|
|
27593
|
+
reason: string().nullable()
|
|
27594
|
+
})) });
|
|
27595
|
+
/**
|
|
27596
|
+
* What a write did. `none` — applied in place. `host` / `parent` — the owner
|
|
27597
|
+
* reloaded the host (or, for an accessory child, its parent) because the
|
|
27598
|
+
* write changed what the host REGISTERS (a graft switched on or off, slice 2).
|
|
27599
|
+
*/
|
|
27600
|
+
var ExtensionSetResultSchema = object({
|
|
27601
|
+
applied: literal(true),
|
|
27602
|
+
reload: _enum([
|
|
27603
|
+
"none",
|
|
27604
|
+
"host",
|
|
27605
|
+
"parent"
|
|
27606
|
+
])
|
|
27607
|
+
});
|
|
27608
|
+
var ExtensionSlotRefInputSchema = object({
|
|
27609
|
+
deviceId: number().int(),
|
|
27610
|
+
slotRef: string().min(1)
|
|
27611
|
+
});
|
|
27612
|
+
var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
|
|
27613
|
+
method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
|
|
27614
|
+
kind: "mutation",
|
|
27615
|
+
auth: "admin"
|
|
27616
|
+
});
|
|
27617
|
+
/**
|
|
27006
27618
|
* Optional client-side hints sent at session creation to help the provider
|
|
27007
27619
|
* pick the best native source. All fields optional — a viewer that knows
|
|
27008
27620
|
* nothing still gets a sane default. (Relocated from the retired `webrtc`
|
|
@@ -28791,17 +29403,6 @@ object({
|
|
|
28791
29403
|
deviceId: number(),
|
|
28792
29404
|
status: DeviceStatusSchema
|
|
28793
29405
|
});
|
|
28794
|
-
object({
|
|
28795
|
-
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
28796
|
-
lastPressedAt: number().nullable(),
|
|
28797
|
-
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
28798
|
-
pressCountSinceStart: number()
|
|
28799
|
-
});
|
|
28800
|
-
object({
|
|
28801
|
-
deviceId: number(),
|
|
28802
|
-
timestamp: number()
|
|
28803
|
-
});
|
|
28804
|
-
DeviceType.Button, DeviceType.Camera;
|
|
28805
29406
|
/**
|
|
28806
29407
|
* Enum-state sensor — a string value picked from a finite option set.
|
|
28807
29408
|
* Drives HA `sensor` entries with `state_class: enum` (HVAC action
|
|
@@ -35654,42 +36255,6 @@ var zoneRulesCapability = {
|
|
|
35654
36255
|
durability: "restored"
|
|
35655
36256
|
};
|
|
35656
36257
|
/**
|
|
35657
|
-
* LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
|
|
35658
|
-
* valutatore puro del suo FRONTE.
|
|
35659
|
-
*
|
|
35660
|
-
* Viveva dentro il builtin virtual-doorbell
|
|
35661
|
-
* (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
|
|
35662
|
-
* predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
|
|
35663
|
-
* `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
|
|
35664
|
-
* tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
|
|
35665
|
-
* fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
|
|
35666
|
-
* SPOSTA qui e il doorbell la ri-esporta.
|
|
35667
|
-
*
|
|
35668
|
-
* ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
|
|
35669
|
-
* due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
|
|
35670
|
-
* regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
|
|
35671
|
-
* booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
|
|
35672
|
-
*/
|
|
35673
|
-
/**
|
|
35674
|
-
* Known binary / switch source caps → the boolean slice field whose
|
|
35675
|
-
* false→true rise counts as ACTIVE. Every entry is "fire on active".
|
|
35676
|
-
* Sensors whose "active" reading is not a plain boolean (presence's string
|
|
35677
|
-
* state, connectivity's connected flag) are deliberately excluded — a
|
|
35678
|
-
* reconnect is not a doorbell press, and it is not a recording either.
|
|
35679
|
-
*/
|
|
35680
|
-
var SOURCE_CAP_ACTIVE_FIELD = {
|
|
35681
|
-
contact: "entryOpen",
|
|
35682
|
-
binary: "on",
|
|
35683
|
-
switch: "on",
|
|
35684
|
-
motion: "detected",
|
|
35685
|
-
flood: "flooded",
|
|
35686
|
-
gas: "detected",
|
|
35687
|
-
smoke: "detected",
|
|
35688
|
-
"carbon-monoxide": "detected",
|
|
35689
|
-
vibration: "detected",
|
|
35690
|
-
tamper: "tampered"
|
|
35691
|
-
};
|
|
35692
|
-
/**
|
|
35693
36258
|
* Accessory device helpers — shared across drivers.
|
|
35694
36259
|
*
|
|
35695
36260
|
* Many vendor-specific drivers register accessory child devices on
|
|
@@ -38517,6 +39082,30 @@ Object.freeze({
|
|
|
38517
39082
|
addonId: null,
|
|
38518
39083
|
access: "create"
|
|
38519
39084
|
},
|
|
39085
|
+
"deviceExtension.listCandidates": {
|
|
39086
|
+
capName: "device-extension",
|
|
39087
|
+
capScope: "device",
|
|
39088
|
+
addonId: null,
|
|
39089
|
+
access: "view"
|
|
39090
|
+
},
|
|
39091
|
+
"deviceExtension.listSlots": {
|
|
39092
|
+
capName: "device-extension",
|
|
39093
|
+
capScope: "device",
|
|
39094
|
+
addonId: null,
|
|
39095
|
+
access: "view"
|
|
39096
|
+
},
|
|
39097
|
+
"deviceExtension.listSources": {
|
|
39098
|
+
capName: "device-extension",
|
|
39099
|
+
capScope: "device",
|
|
39100
|
+
addonId: null,
|
|
39101
|
+
access: "view"
|
|
39102
|
+
},
|
|
39103
|
+
"deviceExtension.setSlot": {
|
|
39104
|
+
capName: "device-extension",
|
|
39105
|
+
capScope: "device",
|
|
39106
|
+
addonId: null,
|
|
39107
|
+
access: "create"
|
|
39108
|
+
},
|
|
38520
39109
|
"deviceManager.addLocation": {
|
|
38521
39110
|
capName: "device-manager",
|
|
38522
39111
|
capScope: "system",
|
|
@@ -39267,6 +39856,12 @@ Object.freeze({
|
|
|
39267
39856
|
addonId: null,
|
|
39268
39857
|
access: "view"
|
|
39269
39858
|
},
|
|
39859
|
+
"embeddingEncoder.resetFailedModels": {
|
|
39860
|
+
capName: "embedding-encoder",
|
|
39861
|
+
capScope: "system",
|
|
39862
|
+
addonId: null,
|
|
39863
|
+
access: "delete"
|
|
39864
|
+
},
|
|
39270
39865
|
"enumSensor.getStatus": {
|
|
39271
39866
|
capName: "enum-sensor",
|
|
39272
39867
|
capScope: "device",
|
|
@@ -41601,6 +42196,12 @@ Object.freeze({
|
|
|
41601
42196
|
addonId: null,
|
|
41602
42197
|
access: "view"
|
|
41603
42198
|
},
|
|
42199
|
+
"pipelineOrchestrator.getClusterModelChoice": {
|
|
42200
|
+
capName: "pipeline-orchestrator",
|
|
42201
|
+
capScope: "system",
|
|
42202
|
+
addonId: null,
|
|
42203
|
+
access: "view"
|
|
42204
|
+
},
|
|
41604
42205
|
"pipelineOrchestrator.getDeviceLiveContribution": {
|
|
41605
42206
|
capName: "pipeline-orchestrator",
|
|
41606
42207
|
capScope: "system",
|
|
@@ -44426,6 +45027,26 @@ Object.freeze({
|
|
|
44426
45027
|
form: "single",
|
|
44427
45028
|
optional: false
|
|
44428
45029
|
}],
|
|
45030
|
+
"deviceExtension.listCandidates": [{
|
|
45031
|
+
name: "deviceId",
|
|
45032
|
+
form: "single",
|
|
45033
|
+
optional: false
|
|
45034
|
+
}],
|
|
45035
|
+
"deviceExtension.listSlots": [{
|
|
45036
|
+
name: "deviceId",
|
|
45037
|
+
form: "single",
|
|
45038
|
+
optional: false
|
|
45039
|
+
}],
|
|
45040
|
+
"deviceExtension.listSources": [{
|
|
45041
|
+
name: "deviceId",
|
|
45042
|
+
form: "single",
|
|
45043
|
+
optional: false
|
|
45044
|
+
}],
|
|
45045
|
+
"deviceExtension.setSlot": [{
|
|
45046
|
+
name: "deviceId",
|
|
45047
|
+
form: "single",
|
|
45048
|
+
optional: false
|
|
45049
|
+
}],
|
|
44429
45050
|
"deviceManager.adoptionRelease": [{
|
|
44430
45051
|
name: "camDeviceId",
|
|
44431
45052
|
form: "single",
|
|
@@ -46886,135 +47507,6 @@ TimelapseRuleInputSchema.extend({
|
|
|
46886
47507
|
updatedAt: number()
|
|
46887
47508
|
});
|
|
46888
47509
|
/**
|
|
46889
|
-
* A model choice has a SCOPE, and a scope change has a workflow.
|
|
46890
|
-
*
|
|
46891
|
-
* ## The two scopes
|
|
46892
|
-
*
|
|
46893
|
-
* Almost every pipeline step's model is a **node** question: which build runs
|
|
46894
|
-
* fastest on THIS accelerator. Two nodes may legitimately answer differently —
|
|
46895
|
-
* a Coral runs the tflite SSD, a Mac runs the coreml YOLO — because the answers
|
|
46896
|
-
* are compared against nothing. They produce boxes, and a box is a box.
|
|
46897
|
-
*
|
|
46898
|
-
* Two steps are not like that. `face-embedding` and `clip-embedding` produce
|
|
46899
|
-
* **vectors that land in ONE shared index** (`identity_samples`,
|
|
46900
|
-
* `vec_object_clip`) and are ranked against each other by cosine similarity.
|
|
46901
|
-
* Cosine similarity between two encoders is not a weak signal, it is a
|
|
46902
|
-
* meaningless number — and nothing inside a vector can tell you it happened.
|
|
46903
|
-
* So for those two steps the model is a **cluster** question with exactly one
|
|
46904
|
-
* answer, stored in exactly one row.
|
|
46905
|
-
*
|
|
46906
|
-
* That is the same argument [D52](../../../../docs/decisions/adr-0052.md) makes
|
|
46907
|
-
* for the crop convention (`detail-crop.ts`), one level up: the crop decides
|
|
46908
|
-
* WHAT pixels the encoder sees, this decides WHICH encoder sees them. Both are
|
|
46909
|
-
* cluster-wide for the same reason and neither may become per-node.
|
|
46910
|
-
*
|
|
46911
|
-
* ## Why the registry lives here and not in the step catalog
|
|
46912
|
-
*
|
|
46913
|
-
* The scope itself is declared on the step, in
|
|
46914
|
-
* `detection-pipeline/registry/step-definitions.ts` (`StepDefinition.modelScope`)
|
|
46915
|
-
* — that is where a new step declares what kind of choice its model is. But the
|
|
46916
|
-
* catalog lives inside `addon-pipeline`, and three packages that must NOT
|
|
46917
|
-
* import an addon need to know the set: the orchestrator (which renders and
|
|
46918
|
-
* stores the row), post-analysis (which pins the row for a re-embed pass) and
|
|
46919
|
-
* admin-ui (which mirrors it). So the set is mirrored here, and
|
|
46920
|
-
* `scripts/check-cluster-model-scope.ts` fails the build when the two disagree.
|
|
46921
|
-
* A hand-copied key that stops matching is exactly how a setting silently stops
|
|
46922
|
-
* arriving while both sides still look correct.
|
|
46923
|
-
*
|
|
46924
|
-
* ## The defaults ARE today's behaviour
|
|
46925
|
-
*
|
|
46926
|
-
* {@link DEFAULT_CLUSTER_STEP_MODELS} reproduces the catalog `defaultModelId`
|
|
46927
|
-
* of both steps. Declaring the scope therefore changes nothing on the day it
|
|
46928
|
-
* ships: the cluster row starts out saying what every node was already doing.
|
|
46929
|
-
* Changing it is legitimate — that is what the knob is for — but it invalidates
|
|
46930
|
-
* the stored vectors of that surface, and must be followed by a re-embed pass
|
|
46931
|
-
* (`face-reembed-pass.ts`, `embedding-rebuild.ts`).
|
|
46932
|
-
*/
|
|
46933
|
-
/**
|
|
46934
|
-
* The cluster-scoped steps. Mirrored from the catalog's `modelScope: 'cluster'`
|
|
46935
|
-
* declarations and guarded by `scripts/check-cluster-model-scope.ts`.
|
|
46936
|
-
*/
|
|
46937
|
-
var CLUSTER_MODEL_SCOPED_STEPS = [{
|
|
46938
|
-
stepId: "face-embedding",
|
|
46939
|
-
label: "Face recognition model",
|
|
46940
|
-
defaultModelId: "arcface-r100",
|
|
46941
|
-
indexName: "the enrolled face gallery",
|
|
46942
|
-
options: [
|
|
46943
|
-
{
|
|
46944
|
-
id: "arcface-r100",
|
|
46945
|
-
label: "ArcFace (ResNet34)"
|
|
46946
|
-
},
|
|
46947
|
-
{
|
|
46948
|
-
id: "auraface-r100",
|
|
46949
|
-
label: "AuraFace R100"
|
|
46950
|
-
},
|
|
46951
|
-
{
|
|
46952
|
-
id: "inception-resnet-v1",
|
|
46953
|
-
label: "Inception ResNet V1"
|
|
46954
|
-
}
|
|
46955
|
-
]
|
|
46956
|
-
}, {
|
|
46957
|
-
stepId: "clip-embedding",
|
|
46958
|
-
label: "Semantic search model",
|
|
46959
|
-
defaultModelId: "mobileclip-s1",
|
|
46960
|
-
indexName: "the object semantic-search index",
|
|
46961
|
-
options: [{
|
|
46962
|
-
id: "mobileclip-s1",
|
|
46963
|
-
label: "MobileCLIP S1"
|
|
46964
|
-
}, {
|
|
46965
|
-
id: "mobileclip-s2",
|
|
46966
|
-
label: "MobileCLIP S2"
|
|
46967
|
-
}]
|
|
46968
|
-
}];
|
|
46969
|
-
/**
|
|
46970
|
-
* Store identity of the cluster row inside `pipeline-orchestrator`'s GLOBAL
|
|
46971
|
-
* (cluster-wide) settings — the same owner, and for the same reason, as the
|
|
46972
|
-
* detail-crop convention: hub-resident and neutral between the addons that
|
|
46973
|
-
* read it.
|
|
46974
|
-
*/
|
|
46975
|
-
var CLUSTER_MODEL_SECTION_ID = "cluster-step-models";
|
|
46976
|
-
/**
|
|
46977
|
-
* The settings key holding one step's cluster model choice.
|
|
46978
|
-
*
|
|
46979
|
-
* Step-qualified so the keys stay unique across the addon's whole schema, which
|
|
46980
|
-
* is what lets {@link pickClusterStepModels} walk every section instead of
|
|
46981
|
-
* trusting the section id.
|
|
46982
|
-
*/
|
|
46983
|
-
function clusterModelSettingKey(stepId) {
|
|
46984
|
-
return `clusterModel:${stepId}`;
|
|
46985
|
-
}
|
|
46986
|
-
Object.freeze(Object.fromEntries(CLUSTER_MODEL_SCOPED_STEPS.map((s) => [s.stepId, s.defaultModelId])));
|
|
46987
|
-
string().min(1);
|
|
46988
|
-
var CLUSTER_STEP_SETTING_FIELDS = [{
|
|
46989
|
-
stepId: "face-embedding",
|
|
46990
|
-
key: "minLandmarkFaceSize",
|
|
46991
|
-
label: "Min face size for recognition (detection px)",
|
|
46992
|
-
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.",
|
|
46993
|
-
type: "slider",
|
|
46994
|
-
min: 0,
|
|
46995
|
-
max: 64,
|
|
46996
|
-
step: 2,
|
|
46997
|
-
default: 24
|
|
46998
|
-
}];
|
|
46999
|
-
function clusterStepSettingKey(stepId, fieldKey) {
|
|
47000
|
-
return `clusterStepSetting:${stepId}:${fieldKey}`;
|
|
47001
|
-
}
|
|
47002
|
-
var ClusterSettingNumberSchema = number().finite();
|
|
47003
|
-
function readClusterStepSettings(config) {
|
|
47004
|
-
const out = {};
|
|
47005
|
-
for (const field of CLUSTER_STEP_SETTING_FIELDS) {
|
|
47006
|
-
const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
|
|
47007
|
-
const value = parsed.success ? parsed.data : field.default;
|
|
47008
|
-
const existing = out[field.stepId] ?? {};
|
|
47009
|
-
out[field.stepId] = {
|
|
47010
|
-
...existing,
|
|
47011
|
-
[field.key]: value
|
|
47012
|
-
};
|
|
47013
|
-
}
|
|
47014
|
-
return out;
|
|
47015
|
-
}
|
|
47016
|
-
readClusterStepSettings({});
|
|
47017
|
-
/**
|
|
47018
47510
|
* THE detail-crop convention — the single derivation of the rectangle a
|
|
47019
47511
|
* detail/enrichment step (clip-embedding, face-detection, plate-detection…)
|
|
47020
47512
|
* is fed.
|
|
@@ -47358,6 +47850,63 @@ function deviceBackendToFormat(backend) {
|
|
|
47358
47850
|
return DEVICE_BACKEND_TO_FORMAT[backend] ?? "onnx";
|
|
47359
47851
|
}
|
|
47360
47852
|
//#endregion
|
|
47853
|
+
//#region src/cluster-model-choice.ts
|
|
47854
|
+
/**
|
|
47855
|
+
* The owner's answer to "which model did the operator choose for this
|
|
47856
|
+
* cluster-scoped step?" (D651 fix round 3).
|
|
47857
|
+
*
|
|
47858
|
+
* The orchestrator owns `clusterModel:*`: it renders the form and stores the
|
|
47859
|
+
* row. A consumer that REWRITES an index on this answer (the face re-embed,
|
|
47860
|
+
* the CLIP rebuild) must not read the orchestrator's private store layout,
|
|
47861
|
+
* and must not read its hydrated settings view either — that answers
|
|
47862
|
+
* `value ?? default`, so a default nobody chose and a failed read both look
|
|
47863
|
+
* like a choice. So the owner answers, from a three-way read of its own store.
|
|
47864
|
+
*
|
|
47865
|
+
* The stored VALUE is read with the runtime's own interpretation
|
|
47866
|
+
* (`interpretStoredClusterModel`, fix round 4): a cleared field (`null`, `''`)
|
|
47867
|
+
* is absent, any non-empty string is the choice — verbatim, as the runner pins
|
|
47868
|
+
* it — and only a non-string is `invalid-stored`. Checking the id against the
|
|
47869
|
+
* dropdown here would give one stored key two meanings: the runner deliberately
|
|
47870
|
+
* pins an id the catalog does not list (a custom encoder), so an owner that
|
|
47871
|
+
* called it invalid would refuse a pass on the very model the fleet is running.
|
|
47872
|
+
*/
|
|
47873
|
+
/**
|
|
47874
|
+
* Turn a three-way read of `clusterModel:<stepId>` into the cap answer.
|
|
47875
|
+
* `'owner-not-ready'` is the caller's statement that its boot has not settled.
|
|
47876
|
+
*/
|
|
47877
|
+
function decideClusterModelChoice(stepId, read) {
|
|
47878
|
+
const step = CLUSTER_MODEL_SCOPED_STEPS.find((s) => s.stepId === stepId);
|
|
47879
|
+
if (step === void 0) return {
|
|
47880
|
+
kind: "unreadable",
|
|
47881
|
+
reason: "not-cluster-scoped"
|
|
47882
|
+
};
|
|
47883
|
+
if (read === "owner-not-ready") return {
|
|
47884
|
+
kind: "unreadable",
|
|
47885
|
+
reason: "owner-not-ready"
|
|
47886
|
+
};
|
|
47887
|
+
if (read.kind === "unreadable") return read.error !== void 0 ? {
|
|
47888
|
+
kind: "unreadable",
|
|
47889
|
+
reason: read.reason,
|
|
47890
|
+
error: read.error
|
|
47891
|
+
} : {
|
|
47892
|
+
kind: "unreadable",
|
|
47893
|
+
reason: read.reason
|
|
47894
|
+
};
|
|
47895
|
+
const stored = interpretStoredClusterModel(read.kind === "absent" ? void 0 : read.value);
|
|
47896
|
+
if (stored.kind === "absent") return {
|
|
47897
|
+
kind: "absent",
|
|
47898
|
+
defaultModelId: step.defaultModelId
|
|
47899
|
+
};
|
|
47900
|
+
if (stored.kind === "chosen") return {
|
|
47901
|
+
kind: "stored",
|
|
47902
|
+
modelId: stored.modelId
|
|
47903
|
+
};
|
|
47904
|
+
return {
|
|
47905
|
+
kind: "unreadable",
|
|
47906
|
+
reason: "invalid-stored"
|
|
47907
|
+
};
|
|
47908
|
+
}
|
|
47909
|
+
//#endregion
|
|
47361
47910
|
//#region src/audio-load-balancer.ts
|
|
47362
47911
|
function balanceAudio(input) {
|
|
47363
47912
|
if (input.nodes.length === 0) return null;
|
|
@@ -48266,6 +48815,354 @@ function createDiskReconcileJobRunner(now = Date.now) {
|
|
|
48266
48815
|
};
|
|
48267
48816
|
}
|
|
48268
48817
|
//#endregion
|
|
48818
|
+
//#region src/pipeline-resolver.ts
|
|
48819
|
+
/**
|
|
48820
|
+
* The `package-detection` root step id. Zone-driven activation
|
|
48821
|
+
* ({@link applyPackageZoneActivation}) is keyed on it — the step has NO
|
|
48822
|
+
* user-facing toggle; a drawn package zone is the sole enable signal.
|
|
48823
|
+
*/
|
|
48824
|
+
var PACKAGE_DETECTION_STEP_ID = "package-detection";
|
|
48825
|
+
/**
|
|
48826
|
+
* The CAMERA ROOT: the always-on object-detection step every session's tracks
|
|
48827
|
+
* originate from. The ONE definition behind two gates that must agree (D650
|
|
48828
|
+
* round 4): the device election's root guard (`makeRootCapabilityGuard`)
|
|
48829
|
+
* excludes a device whose format cannot run it, and the attach backstop
|
|
48830
|
+
* (`ResolvedPipeline.droppedRoots`) refuses an attach that lost it. Any other
|
|
48831
|
+
* gated-on root the elected device cannot run (`segmentation`, an opt-in
|
|
48832
|
+
* refiner) is a logged skip, never a refusal: the election does not look at
|
|
48833
|
+
* it, so refusing on it left a camera pending forever.
|
|
48834
|
+
*
|
|
48835
|
+
* Mirrors the addon-pipeline step id — a cross-addon import is forbidden.
|
|
48836
|
+
*/
|
|
48837
|
+
var OBJECT_DETECTION_STEP_ID = "object-detection";
|
|
48838
|
+
/**
|
|
48839
|
+
* Zone-driven activation for the toggle-less `package-detection` root step.
|
|
48840
|
+
*
|
|
48841
|
+
* The step runs for a device IFF it has ≥1 package zone (an enabled
|
|
48842
|
+
* `package`-stage zone rule referencing geometry). There is deliberately NO
|
|
48843
|
+
* operator toggle — drawing a package zone IS the enable, removing every
|
|
48844
|
+
* package zone IS the disable. This gate reconciles the resolved step tree to
|
|
48845
|
+
* that rule:
|
|
48846
|
+
*
|
|
48847
|
+
* - `hasPackageZone` true → the step is ensured present as an ENABLED root
|
|
48848
|
+
* (a pre-existing node keeps its `modelId` / `settings` — e.g. a per-node
|
|
48849
|
+
* model choice); default-on where a zone is present.
|
|
48850
|
+
* - `hasPackageZone` false → any `package-detection` node is stripped so the
|
|
48851
|
+
* runner never dispatches it.
|
|
48852
|
+
*
|
|
48853
|
+
* `package-detection` is a ROOT (`inputClasses: null`) so it only ever appears
|
|
48854
|
+
* at the top level — no recursion into children needed. Every other step is
|
|
48855
|
+
* left untouched. Immutable: returns a fresh array only when a change applies.
|
|
48856
|
+
*/
|
|
48857
|
+
function applyPackageZoneActivation(steps, hasPackageZone) {
|
|
48858
|
+
const existing = steps.find((s) => s.addonId === PACKAGE_DETECTION_STEP_ID);
|
|
48859
|
+
if (!hasPackageZone) {
|
|
48860
|
+
if (!existing) return steps;
|
|
48861
|
+
return steps.filter((s) => s.addonId !== PACKAGE_DETECTION_STEP_ID);
|
|
48862
|
+
}
|
|
48863
|
+
if (existing) {
|
|
48864
|
+
if (existing.enabled === true) return steps;
|
|
48865
|
+
return steps.map((s) => s.addonId === "package-detection" ? {
|
|
48866
|
+
...s,
|
|
48867
|
+
enabled: true
|
|
48868
|
+
} : s);
|
|
48869
|
+
}
|
|
48870
|
+
const node = {
|
|
48871
|
+
addonId: PACKAGE_DETECTION_STEP_ID,
|
|
48872
|
+
enabled: true,
|
|
48873
|
+
children: []
|
|
48874
|
+
};
|
|
48875
|
+
return [...steps, node];
|
|
48876
|
+
}
|
|
48877
|
+
/**
|
|
48878
|
+
* Steps that are OFF by the per-camera gate DEFAULT (i.e. when the camera's
|
|
48879
|
+
* `stepToggles[addonId]` is unset). Mirrors each step's catalog
|
|
48880
|
+
* `enabledByDefault: false` — the heavy / opt-in classifiers + segmentation.
|
|
48881
|
+
*
|
|
48882
|
+
* The pure resolver derives the default gate from the LIVE catalog
|
|
48883
|
+
* (`addon.enabledByDefault ?? true`), so it stays correct if a future
|
|
48884
|
+
* default-off step ships. This literal set is the catalog-FREE fallback used
|
|
48885
|
+
* by the one-shot gating migration ({@link migrateStepGating}), which runs at
|
|
48886
|
+
* boot with no guaranteed live executor catalog. The two agree for every
|
|
48887
|
+
* step that exists today.
|
|
48888
|
+
*
|
|
48889
|
+
* `package-detection` is deliberately NOT listed — it is ZONE-driven
|
|
48890
|
+
* ({@link applyPackageZoneActivation}) and never governed by the gate.
|
|
48891
|
+
*/
|
|
48892
|
+
var DEFAULT_OFF_STEP_IDS = new Set([
|
|
48893
|
+
"animal-classifier",
|
|
48894
|
+
"bird-classifier",
|
|
48895
|
+
"vehicle-classifier",
|
|
48896
|
+
"segmentation"
|
|
48897
|
+
]);
|
|
48898
|
+
/**
|
|
48899
|
+
* Catalog-free default gate for `addonId` — `true` unless the step is in
|
|
48900
|
+
* {@link DEFAULT_OFF_STEP_IDS}. Used by the migration (no live catalog); the
|
|
48901
|
+
* resolver prefers the catalog's own `enabledByDefault ?? true`.
|
|
48902
|
+
*/
|
|
48903
|
+
function defaultStepGate(addonId) {
|
|
48904
|
+
return !DEFAULT_OFF_STEP_IDS.has(addonId);
|
|
48905
|
+
}
|
|
48906
|
+
/**
|
|
48907
|
+
* PROVISIONING presence for `(addon, format)` — the node "provides" the step
|
|
48908
|
+
* iff the catalog lists at least one model with a build for the node's engine
|
|
48909
|
+
* format. Byte-for-byte the same test the admin-ui matrices use
|
|
48910
|
+
* (`addon.models.some(m => Boolean(m.formats[fmt]))`). An absent `modelId`
|
|
48911
|
+
* on the resolved step is still "Auto" (the node resolves its own format
|
|
48912
|
+
* default) — provisioning does NOT require an operator-pinned model, only a
|
|
48913
|
+
* compatible model to EXIST for the format.
|
|
48914
|
+
*/
|
|
48915
|
+
function addonHasCompatibleModel(addon, format) {
|
|
48916
|
+
return (addon.models ?? []).some((m) => Boolean(m.formats[format]));
|
|
48917
|
+
}
|
|
48918
|
+
/**
|
|
48919
|
+
* A ROOT runs on the frame plane of the ELECTED device and is never jumped
|
|
48920
|
+
* (D650). Roots are the video steps with no `inputClasses`.
|
|
48921
|
+
*/
|
|
48922
|
+
function isVideoRoot(addon) {
|
|
48923
|
+
return (addon.inputClasses ?? []).length === 0;
|
|
48924
|
+
}
|
|
48925
|
+
/**
|
|
48926
|
+
* The per-DEVICE provisioning gate (D650). `null` = keep the step.
|
|
48927
|
+
*
|
|
48928
|
+
* - `audio-classifier` is NOT gated here at all. It never runs on an
|
|
48929
|
+
* inference pool — the audio-analyzer runs its own backend (YAMNet in an
|
|
48930
|
+
* embedded-Python subprocess, or Apple SoundAnalysis) — so an inference
|
|
48931
|
+
* format says nothing about whether it can run. Only enablement applies.
|
|
48932
|
+
* - A video ROOT needs a build for the ELECTED device's format — the runner
|
|
48933
|
+
* never jumps it, so a sibling accelerator that could run it is irrelevant.
|
|
48934
|
+
* - A detail step is kept when the elected format OR any format of the
|
|
48935
|
+
* node's jump roster (`jumpFormats` — the SAME enabled∧available devices
|
|
48936
|
+
* the runner jumps within) has a build: the runner's step-tree jump
|
|
48937
|
+
* (`pipeline-runner/device-jump.ts`) then places it.
|
|
48938
|
+
*/
|
|
48939
|
+
function unprovisionedReason(addon, electedFormat, jumpFormats) {
|
|
48940
|
+
if (addon.slot === "audio-classifier") return null;
|
|
48941
|
+
if (addonHasCompatibleModel(addon, electedFormat)) return null;
|
|
48942
|
+
if (isVideoRoot(addon)) return jumpFormats.some((f) => addonHasCompatibleModel(addon, f)) ? "root-not-runnable-on-elected-device" : "no-compatible-model";
|
|
48943
|
+
return jumpFormats.some((f) => addonHasCompatibleModel(addon, f)) ? null : "no-compatible-model";
|
|
48944
|
+
}
|
|
48945
|
+
/**
|
|
48946
|
+
* Device-aware resolver — the SINGLE per-camera gate + per-DEVICE skip check.
|
|
48947
|
+
*
|
|
48948
|
+
* Step `S` runs for camera `C` on device `D` ⇔
|
|
48949
|
+
* gate(C, S) — `stepToggles[S]` ?? `addon.enabledByDefault ?? true`
|
|
48950
|
+
* AND provided(D, S) — the catalog lists a model with a build for D's FORMAT
|
|
48951
|
+
* (a ROOT), or for D's format or any `jumpFormats`
|
|
48952
|
+
* entry (a detail step — the runner jumps it, D650);
|
|
48953
|
+
* `audio-classifier` is never format-gated (it runs
|
|
48954
|
+
* on the audio-analyzer's own backend)
|
|
48955
|
+
*
|
|
48956
|
+
* Enablement is the per-camera `stepToggles` authority ONLY. Provisioning
|
|
48957
|
+
* (`modelId` / `settings`) is NOT applied here — the returned tree carries bare
|
|
48958
|
+
* `{ addonId, enabled: true, children }` nodes; {@link applyDeviceProvisioning}
|
|
48959
|
+
* attaches model + settings at dispatch from the per-(node,device) base + the
|
|
48960
|
+
* per-camera-device override.
|
|
48961
|
+
*
|
|
48962
|
+
* A step gated ON that no device it may run on can serve is DROPPED and
|
|
48963
|
+
* recorded in `skipped` so the caller can surface a visible "gated on, no model
|
|
48964
|
+
* on this node" status at dispatch time.
|
|
48965
|
+
*
|
|
48966
|
+
* `package-detection` is excluded here — it is zone-driven
|
|
48967
|
+
* ({@link applyPackageZoneActivation}, applied by the caller).
|
|
48968
|
+
*
|
|
48969
|
+
* "Inference disabled for this camera" is NOT handled here — the caller
|
|
48970
|
+
* (resolvePipelineForDevice) consults the detection-pipeline binding and
|
|
48971
|
+
* short-circuits to an empty pipeline before invoking this resolver.
|
|
48972
|
+
*/
|
|
48973
|
+
function resolvePipelineWithSkips(cameraSettings, agentNodeId, deviceFormat, catalog, jumpFormats = []) {
|
|
48974
|
+
const cam = cameraSettings ?? {};
|
|
48975
|
+
const wholesale = cam.pipelineByAgent?.[agentNodeId];
|
|
48976
|
+
if (wholesale) return {
|
|
48977
|
+
config: {
|
|
48978
|
+
steps: mergeEnabledByDefaultSteps(wholesale.steps, catalog),
|
|
48979
|
+
audio: wholesale.audio ? {
|
|
48980
|
+
modelId: wholesale.audio.modelId,
|
|
48981
|
+
enabled: wholesale.audio.enabled
|
|
48982
|
+
} : null
|
|
48983
|
+
},
|
|
48984
|
+
skipped: [],
|
|
48985
|
+
droppedRoots: []
|
|
48986
|
+
};
|
|
48987
|
+
const toggles = cam.stepToggles ?? {};
|
|
48988
|
+
const format = deviceFormat;
|
|
48989
|
+
const enabled = [];
|
|
48990
|
+
const skipped = [];
|
|
48991
|
+
const droppedRoots = [];
|
|
48992
|
+
for (const slot of catalog.slots) for (const addon of slot.addons) {
|
|
48993
|
+
const addonId = addon.id;
|
|
48994
|
+
if (addonId === "package-detection") continue;
|
|
48995
|
+
if (!(toggles[addonId] ?? addon.enabledByDefault ?? true)) continue;
|
|
48996
|
+
const reason = unprovisionedReason(addon, format, jumpFormats);
|
|
48997
|
+
if (reason !== null) {
|
|
48998
|
+
skipped.push({
|
|
48999
|
+
addonId,
|
|
49000
|
+
reason
|
|
49001
|
+
});
|
|
49002
|
+
if (addonId === "object-detection") droppedRoots.push(addonId);
|
|
49003
|
+
continue;
|
|
49004
|
+
}
|
|
49005
|
+
enabled.push({ addonId });
|
|
49006
|
+
}
|
|
49007
|
+
const audioAddons = [];
|
|
49008
|
+
const videoAddons = [];
|
|
49009
|
+
for (const entry of enabled) {
|
|
49010
|
+
const meta = findInCatalog(catalog, entry.addonId);
|
|
49011
|
+
if (!meta) continue;
|
|
49012
|
+
if (meta.slot === "audio-classifier") audioAddons.push(entry);
|
|
49013
|
+
else videoAddons.push(entry);
|
|
49014
|
+
}
|
|
49015
|
+
return {
|
|
49016
|
+
config: {
|
|
49017
|
+
steps: buildTreeFromAddons(videoAddons, catalog),
|
|
49018
|
+
audio: audioAddons.length > 0 ? { enabled: true } : null
|
|
49019
|
+
},
|
|
49020
|
+
skipped,
|
|
49021
|
+
droppedRoots
|
|
49022
|
+
};
|
|
49023
|
+
}
|
|
49024
|
+
function findInCatalog(catalog, addonId) {
|
|
49025
|
+
for (const slot of catalog.slots) for (const addon of slot.addons) if (addon.id === addonId) return addon;
|
|
49026
|
+
return null;
|
|
49027
|
+
}
|
|
49028
|
+
/**
|
|
49029
|
+
* Compose a step tree from a flat list of enabled video addons using
|
|
49030
|
+
* catalog compatibility: an addon whose `inputClasses` overlaps a
|
|
49031
|
+
* candidate parent's `outputClasses` attaches as the parent's child.
|
|
49032
|
+
* Addons with `inputClasses` null/empty become roots.
|
|
49033
|
+
*
|
|
49034
|
+
* Multiple addons in the same slot with compatible inputClasses run in
|
|
49035
|
+
* parallel — they attach to the same parent as siblings. Example: two
|
|
49036
|
+
* classifiers (bird-classifier + animal-classifier) both accept 'animal'
|
|
49037
|
+
* → both attach to object-detection as siblings, both receive every
|
|
49038
|
+
* animal crop.
|
|
49039
|
+
*
|
|
49040
|
+
* Unparented leaves (inputClasses set, but no matching parent in the
|
|
49041
|
+
* enabled set) are DROPPED. The runner would have nothing to feed them
|
|
49042
|
+
* anyway — better silent drop than dispatching a dead step.
|
|
49043
|
+
*/
|
|
49044
|
+
function buildTreeFromAddons(enabled, catalog) {
|
|
49045
|
+
const bySlot = /* @__PURE__ */ new Map();
|
|
49046
|
+
for (const slot of catalog.slots) bySlot.set(slot.id, slot);
|
|
49047
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
49048
|
+
const metaById = /* @__PURE__ */ new Map();
|
|
49049
|
+
for (const { addonId } of enabled) {
|
|
49050
|
+
const meta = findInCatalog(catalog, addonId);
|
|
49051
|
+
if (!meta) continue;
|
|
49052
|
+
metaById.set(addonId, meta);
|
|
49053
|
+
nodes.set(addonId, {
|
|
49054
|
+
addonId,
|
|
49055
|
+
enabled: true,
|
|
49056
|
+
children: []
|
|
49057
|
+
});
|
|
49058
|
+
}
|
|
49059
|
+
const roots = [];
|
|
49060
|
+
for (const [addonId, node] of nodes) {
|
|
49061
|
+
const inputs = metaById.get(addonId).inputClasses;
|
|
49062
|
+
if (!inputs || inputs.length === 0) {
|
|
49063
|
+
roots.push(node);
|
|
49064
|
+
continue;
|
|
49065
|
+
}
|
|
49066
|
+
let parent = null;
|
|
49067
|
+
for (const [candidateId, candidateNode] of nodes) {
|
|
49068
|
+
if (candidateId === addonId) continue;
|
|
49069
|
+
if (metaById.get(candidateId).outputClasses.some((c) => inputs.includes(c))) {
|
|
49070
|
+
parent = candidateNode;
|
|
49071
|
+
break;
|
|
49072
|
+
}
|
|
49073
|
+
}
|
|
49074
|
+
if (parent) parent.children.push(node);
|
|
49075
|
+
}
|
|
49076
|
+
return roots;
|
|
49077
|
+
}
|
|
49078
|
+
/**
|
|
49079
|
+
* Back-fill catalog steps EXPLICITLY flagged `backfillIntoExistingOverrides`
|
|
49080
|
+
* but ENTIRELY ABSENT from an existing step tree — reconciles a stored
|
|
49081
|
+
* wholesale `pipelineByAgent` snapshot with genuinely-new default steps.
|
|
49082
|
+
*
|
|
49083
|
+
* Why it's needed: a `pipelineByAgent` wholesale override SNAPSHOTS the full
|
|
49084
|
+
* tree. A step introduced AFTER the snapshot (e.g. `clip-embedding` for object
|
|
49085
|
+
* semantic search) would otherwise never reach that camera.
|
|
49086
|
+
*
|
|
49087
|
+
* Why the flag (not `enabledByDefault`): absence-from-a-snapshot is ambiguous —
|
|
49088
|
+
* it can mean "predates this step" OR "operator deliberately pruned it". A
|
|
49089
|
+
* broad "back-fill every default-on step" would resurrect deliberate removals
|
|
49090
|
+
* of long-existing steps (face-detection, etc.), an operator-intent
|
|
49091
|
+
* regression. Only a step that opts in via `backfillIntoExistingOverrides`
|
|
49092
|
+
* (set on genuinely-new default steps ONLY) re-enters existing overrides.
|
|
49093
|
+
*
|
|
49094
|
+
* Non-destructive by design:
|
|
49095
|
+
* - Only steps whose id is absent from the WHOLE tree are added. A step the
|
|
49096
|
+
* operator has already seen — present anywhere, even `enabled: false` —
|
|
49097
|
+
* is left exactly as-is (its enabled flag is honoured).
|
|
49098
|
+
* - Only `backfillIntoExistingOverrides === true` addons are candidates.
|
|
49099
|
+
* Every other step (including long-standing default-on members) is left
|
|
49100
|
+
* untouched, so a deliberately-pruned override stays pruned.
|
|
49101
|
+
* - Audio-classifier addons are skipped — audio lives in
|
|
49102
|
+
* `CameraPipelineConfig.audio`, never in the video `steps` tree.
|
|
49103
|
+
* - A candidate attaches by catalog compat (its `inputClasses` overlap a
|
|
49104
|
+
* present node's `outputClasses`), mirroring {@link buildTreeFromAddons}.
|
|
49105
|
+
* A candidate with non-empty `inputClasses` and NO compatible parent is
|
|
49106
|
+
* dropped (never re-rooted) so a crop-scoped embedder never regresses to
|
|
49107
|
+
* running on the full frame. Empty `inputClasses` ⇒ a genuine root step.
|
|
49108
|
+
*/
|
|
49109
|
+
function mergeEnabledByDefaultSteps(steps, catalog) {
|
|
49110
|
+
if (steps.length === 0) return steps;
|
|
49111
|
+
const present = /* @__PURE__ */ new Set();
|
|
49112
|
+
const collect = (nodes) => {
|
|
49113
|
+
for (const n of nodes) {
|
|
49114
|
+
present.add(n.addonId);
|
|
49115
|
+
if (n.children?.length) collect(n.children);
|
|
49116
|
+
}
|
|
49117
|
+
};
|
|
49118
|
+
collect(steps);
|
|
49119
|
+
const catalogById = /* @__PURE__ */ new Map();
|
|
49120
|
+
for (const slot of catalog.slots) for (const addon of slot.addons) catalogById.set(addon.id, addon);
|
|
49121
|
+
const newRoots = [];
|
|
49122
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
49123
|
+
for (const slot of catalog.slots) {
|
|
49124
|
+
if (slot.id === "audio-classifier") continue;
|
|
49125
|
+
for (const addon of slot.addons) {
|
|
49126
|
+
if (addon.backfillIntoExistingOverrides !== true) continue;
|
|
49127
|
+
if (present.has(addon.id)) continue;
|
|
49128
|
+
const node = {
|
|
49129
|
+
addonId: addon.id,
|
|
49130
|
+
enabled: true,
|
|
49131
|
+
children: []
|
|
49132
|
+
};
|
|
49133
|
+
const inputs = addon.inputClasses;
|
|
49134
|
+
if (!inputs || inputs.length === 0) {
|
|
49135
|
+
newRoots.push(node);
|
|
49136
|
+
continue;
|
|
49137
|
+
}
|
|
49138
|
+
let parentId = null;
|
|
49139
|
+
for (const presentId of present) {
|
|
49140
|
+
const meta = catalogById.get(presentId);
|
|
49141
|
+
if (!meta) continue;
|
|
49142
|
+
if (meta.outputClasses.some((c) => inputs.includes(c))) {
|
|
49143
|
+
parentId = presentId;
|
|
49144
|
+
break;
|
|
49145
|
+
}
|
|
49146
|
+
}
|
|
49147
|
+
if (!parentId) continue;
|
|
49148
|
+
const list = childrenByParent.get(parentId) ?? [];
|
|
49149
|
+
list.push(node);
|
|
49150
|
+
childrenByParent.set(parentId, list);
|
|
49151
|
+
}
|
|
49152
|
+
}
|
|
49153
|
+
if (childrenByParent.size === 0 && newRoots.length === 0) return steps;
|
|
49154
|
+
const attach = (nodes) => nodes.map((n) => {
|
|
49155
|
+
const rebuiltChildren = attach(n.children ?? []);
|
|
49156
|
+
const extra = childrenByParent.get(n.addonId) ?? [];
|
|
49157
|
+
const mergedChildren = [...rebuiltChildren, ...extra];
|
|
49158
|
+
return mergedChildren.length > 0 ? {
|
|
49159
|
+
...n,
|
|
49160
|
+
children: mergedChildren
|
|
49161
|
+
} : n;
|
|
49162
|
+
});
|
|
49163
|
+
return [...attach(steps), ...newRoots];
|
|
49164
|
+
}
|
|
49165
|
+
//#endregion
|
|
48269
49166
|
//#region src/inference-device-model.ts
|
|
48270
49167
|
/**
|
|
48271
49168
|
* Per-device default object-detection model + deviceKey parsing for the
|
|
@@ -48291,20 +49188,14 @@ function createDiskReconcileJobRunner(now = Date.now) {
|
|
|
48291
49188
|
* gates (0/3 miss recovered at the current threshold).
|
|
48292
49189
|
*/
|
|
48293
49190
|
/**
|
|
48294
|
-
* The always-on object-detection ROOT step id. A camera session's tracks all
|
|
48295
|
-
* originate from this detector, so a device whose engine format can't run it
|
|
48296
|
-
* cannot host a camera root. Mirrors the addon-pipeline step id (cross-addon
|
|
48297
|
-
* import is forbidden — this is the same duplication rationale as the model
|
|
48298
|
-
* defaults above).
|
|
48299
|
-
*/
|
|
48300
|
-
var OBJECT_DETECTION_STEP_ID = "object-detection";
|
|
48301
|
-
/**
|
|
48302
49191
|
* Build the camera-root capability predicate for a node from its live catalog:
|
|
48303
49192
|
* `format → canHostCameraRoot`. A format can host a camera root iff the
|
|
48304
49193
|
* catalog lists at least one object-detection model with a build for that
|
|
48305
49194
|
* format — byte-for-byte the resolver's per-device skip-gate test for the root
|
|
48306
49195
|
* step (`addonHasCompatibleModel`), so a device is deemed eligible iff the root
|
|
48307
|
-
* would ACTUALLY provision on it.
|
|
49196
|
+
* would ACTUALLY provision on it. The root is {@link OBJECT_DETECTION_STEP_ID},
|
|
49197
|
+
* shared with the resolver's refusal backstop (`droppedRoots`) so the two gates
|
|
49198
|
+
* judge the same step (D650 round 4).
|
|
48308
49199
|
*
|
|
48309
49200
|
* Fails OPEN when the catalog has no object-detection slot at all (never
|
|
48310
49201
|
* observed in production) so a malformed/empty catalog never strands every
|
|
@@ -49824,16 +50715,18 @@ var CameraStatusService = class {
|
|
|
49824
50715
|
const audioAssignment = this.deps.getAudioAssignment(deviceId);
|
|
49825
50716
|
const audioNodeId = audioAssignment?.nodeId ?? null;
|
|
49826
50717
|
const audioPinned = audioAssignment?.pinned ?? false;
|
|
50718
|
+
const pinned = {
|
|
50719
|
+
detection: pipelineAssignment?.pinned ?? false,
|
|
50720
|
+
decoder: false,
|
|
50721
|
+
audio: audioPinned
|
|
50722
|
+
};
|
|
50723
|
+
const pendingReason = this.deps.getPendingReason(deviceId);
|
|
49827
50724
|
return {
|
|
49828
50725
|
pipelineAssignment,
|
|
49829
50726
|
detectionNodeId,
|
|
49830
50727
|
sourceNodeId,
|
|
49831
|
-
pinned
|
|
49832
|
-
|
|
49833
|
-
decoder: false,
|
|
49834
|
-
audio: audioPinned
|
|
49835
|
-
},
|
|
49836
|
-
detectionReason: pipelineAssignment !== null ? pipelineAssignment.reason : this.deps.hasCameraConfig(deviceId) ? `pending:${this.deps.getPendingReason(deviceId) ?? "pending"}` : this.deps.isSessionCamera(deviceId) ? "armed:on-motion" : void 0,
|
|
50728
|
+
pinned,
|
|
50729
|
+
detectionReason: pipelineAssignment !== null ? pipelineAssignment.reason : this.deps.hasCameraConfig(deviceId) ? `pending:${pendingReason ?? "pending"}` : this.deps.isSessionCamera(deviceId) ? pendingReason !== void 0 ? `pending:${pendingReason}` : "armed:on-motion" : void 0,
|
|
49837
50730
|
audioNodeId,
|
|
49838
50731
|
audioPinned
|
|
49839
50732
|
};
|
|
@@ -50689,48 +51582,6 @@ var DetectionBlindMonitor = class {
|
|
|
50689
51582
|
}
|
|
50690
51583
|
};
|
|
50691
51584
|
//#endregion
|
|
50692
|
-
//#region src/apply-device-provisioning.ts
|
|
50693
|
-
/**
|
|
50694
|
-
* Merge base then override for one step. Override keys win; undefined = inherit.
|
|
50695
|
-
* `jumpDeviceKey` (step-tree device jump, phase 1) is a per-(node,device) BASE
|
|
50696
|
-
* concept ONLY — the per-camera override never carries it (spec: per-camera jump
|
|
50697
|
-
* is out of scope), so it is taken from `base` verbatim.
|
|
50698
|
-
*/
|
|
50699
|
-
function resolveStep(base, override) {
|
|
50700
|
-
if (!base && !override) return void 0;
|
|
50701
|
-
const modelId = override?.modelId ?? base?.modelId;
|
|
50702
|
-
const settings = base?.settings || override?.settings ? {
|
|
50703
|
-
...base?.settings,
|
|
50704
|
-
...override?.settings
|
|
50705
|
-
} : void 0;
|
|
50706
|
-
const jumpDeviceKey = base?.jumpDeviceKey;
|
|
50707
|
-
return {
|
|
50708
|
-
...modelId !== void 0 ? { modelId } : {},
|
|
50709
|
-
...settings ? { settings } : {},
|
|
50710
|
-
...jumpDeviceKey !== void 0 ? { jumpDeviceKey } : {}
|
|
50711
|
-
};
|
|
50712
|
-
}
|
|
50713
|
-
/**
|
|
50714
|
-
* Attach modelId + settings onto each step from the per-(node,device) BASE and
|
|
50715
|
-
* the per-camera-device OVERRIDE. Pure/immutable; recurses into children. Empty
|
|
50716
|
-
* base+override ⇒ same reference.
|
|
50717
|
-
*/
|
|
50718
|
-
function applyDeviceProvisioning(steps, base, override) {
|
|
50719
|
-
if (Object.keys(base).length === 0 && Object.keys(override).length === 0) return steps;
|
|
50720
|
-
return steps.map((step) => {
|
|
50721
|
-
const cfg = resolveStep(base[step.addonId], override[step.addonId]);
|
|
50722
|
-
const children = step.children ? applyDeviceProvisioning(step.children, base, override) : step.children;
|
|
50723
|
-
if (!cfg && children === step.children) return step;
|
|
50724
|
-
return {
|
|
50725
|
-
...step,
|
|
50726
|
-
...cfg?.modelId !== void 0 ? { modelId: cfg.modelId } : {},
|
|
50727
|
-
...cfg?.settings ? { settings: cfg.settings } : {},
|
|
50728
|
-
...cfg?.jumpDeviceKey !== void 0 ? { jumpDeviceKey: cfg.jumpDeviceKey } : {},
|
|
50729
|
-
...children !== void 0 ? { children } : {}
|
|
50730
|
-
};
|
|
50731
|
-
});
|
|
50732
|
-
}
|
|
50733
|
-
//#endregion
|
|
50734
51585
|
//#region src/device-activity-source.ts
|
|
50735
51586
|
/** The source's own name on the wire. One constant, used by every emit + gate. */
|
|
50736
51587
|
var DEVICE_ACTIVITY_SOURCE = "device-activity";
|
|
@@ -52025,8 +52876,12 @@ var DetectionWiringController = class {
|
|
|
52025
52876
|
}
|
|
52026
52877
|
log.info("detection armed (session-time) — watching for motion", { meta: { motion: config.motionSources.join("+") } });
|
|
52027
52878
|
} else {
|
|
52028
|
-
const
|
|
52029
|
-
const
|
|
52879
|
+
const placeholderNode = this.deps.ledger.getAssignment(deviceId)?.agentNodeId ?? this.deps.localNodeId();
|
|
52880
|
+
const placeholder = await this.deps.settingsStore.resolvePipelineForDeviceIfCatalogCached(deviceId, placeholderNode, void 0, []);
|
|
52881
|
+
const pipelineConfig = placeholder.kind === "resolved" ? placeholder.config : {
|
|
52882
|
+
steps: [],
|
|
52883
|
+
audio: null
|
|
52884
|
+
};
|
|
52030
52885
|
const runnerConfig = buildRunnerConfig({
|
|
52031
52886
|
deviceId,
|
|
52032
52887
|
config,
|
|
@@ -52035,42 +52890,12 @@ var DetectionWiringController = class {
|
|
|
52035
52890
|
steps: pipelineConfig.steps,
|
|
52036
52891
|
audio: pipelineConfig.audio ?? null
|
|
52037
52892
|
});
|
|
52038
|
-
let dispatchedNodeId = null;
|
|
52039
52893
|
try {
|
|
52040
|
-
|
|
52041
|
-
if (result.kind === "assigned") dispatchedNodeId = result.agentNodeId;
|
|
52894
|
+
await this.deps.placement.dispatchCamera(runnerConfig);
|
|
52042
52895
|
} catch (err) {
|
|
52043
52896
|
const msg = errMsg$1(err);
|
|
52044
52897
|
log.error("dispatchCamera failed", { meta: { error: msg } });
|
|
52045
52898
|
}
|
|
52046
|
-
if (dispatchedNodeId && (dispatchedNodeId !== hydrateNodeId || (runnerConfig.steps?.length ?? 0) === 0)) try {
|
|
52047
|
-
const dispatchedDeviceKey = this.deps.ledger.getConfig(deviceId)?.deviceKey;
|
|
52048
|
-
const corrected = await this.deps.settingsStore.resolvePipelineForDevice(deviceId, dispatchedNodeId, dispatchedDeviceKey);
|
|
52049
|
-
const correctedBase = await this.deps.settingsStore.buildNodeInferenceDeviceSteps(dispatchedNodeId, dispatchedDeviceKey ?? "");
|
|
52050
|
-
const correctedOverride = dispatchedDeviceKey ? await this.deps.settingsStore.readCameraDeviceOverride(deviceId, dispatchedNodeId, dispatchedDeviceKey) : {};
|
|
52051
|
-
const correctedConfig = {
|
|
52052
|
-
...runnerConfig,
|
|
52053
|
-
...dispatchedDeviceKey ? { deviceKey: dispatchedDeviceKey } : {},
|
|
52054
|
-
steps: applyDeviceProvisioning(corrected.steps, correctedBase, correctedOverride),
|
|
52055
|
-
audio: corrected.audio ?? null
|
|
52056
|
-
};
|
|
52057
|
-
if (JSON.stringify({
|
|
52058
|
-
steps: runnerConfig.steps,
|
|
52059
|
-
audio: runnerConfig.audio ?? null
|
|
52060
|
-
}) !== JSON.stringify({
|
|
52061
|
-
steps: correctedConfig.steps,
|
|
52062
|
-
audio: correctedConfig.audio
|
|
52063
|
-
})) {
|
|
52064
|
-
await this.deps.attachOn(dispatchedNodeId, correctedConfig);
|
|
52065
|
-
this.deps.ledger.setConfig(deviceId, correctedConfig);
|
|
52066
|
-
log.info("startDetection: pipeline re-resolved after agent assignment", {
|
|
52067
|
-
tags: { nodeId: dispatchedNodeId },
|
|
52068
|
-
meta: { stepCount: corrected.steps.length }
|
|
52069
|
-
});
|
|
52070
|
-
}
|
|
52071
|
-
} catch (err) {
|
|
52072
|
-
log.warn("startDetection: post-dispatch re-resolve failed", { meta: { error: errMsg$1(err) } });
|
|
52073
|
-
}
|
|
52074
52899
|
}
|
|
52075
52900
|
try {
|
|
52076
52901
|
await this.deps.audio.resubscribe(deviceId, config);
|
|
@@ -52822,6 +53647,200 @@ async function migrateLegacyFlagsToBindings(deps) {
|
|
|
52822
53647
|
} });
|
|
52823
53648
|
}
|
|
52824
53649
|
//#endregion
|
|
53650
|
+
//#region src/apply-device-provisioning.ts
|
|
53651
|
+
/**
|
|
53652
|
+
* Merge base then override for one step. Override keys win; undefined = inherit.
|
|
53653
|
+
* `jumpDeviceKey` (step-tree device jump, phase 1) is a per-(node,device) BASE
|
|
53654
|
+
* concept ONLY — the per-camera override never carries it (spec: per-camera jump
|
|
53655
|
+
* is out of scope), so it is taken from `base` verbatim.
|
|
53656
|
+
*/
|
|
53657
|
+
function resolveStep(base, override) {
|
|
53658
|
+
if (!base && !override) return void 0;
|
|
53659
|
+
const modelId = override?.modelId ?? base?.modelId;
|
|
53660
|
+
const settings = base?.settings || override?.settings ? {
|
|
53661
|
+
...base?.settings,
|
|
53662
|
+
...override?.settings
|
|
53663
|
+
} : void 0;
|
|
53664
|
+
const jumpDeviceKey = base?.jumpDeviceKey;
|
|
53665
|
+
return {
|
|
53666
|
+
...modelId !== void 0 ? { modelId } : {},
|
|
53667
|
+
...settings ? { settings } : {},
|
|
53668
|
+
...jumpDeviceKey !== void 0 ? { jumpDeviceKey } : {}
|
|
53669
|
+
};
|
|
53670
|
+
}
|
|
53671
|
+
/**
|
|
53672
|
+
* Attach modelId + settings onto each step from the per-(node,device) BASE and
|
|
53673
|
+
* the per-camera-device OVERRIDE. Pure/immutable; recurses into children. Empty
|
|
53674
|
+
* base+override ⇒ same reference.
|
|
53675
|
+
*/
|
|
53676
|
+
function applyDeviceProvisioning(steps, base, override) {
|
|
53677
|
+
if (Object.keys(base).length === 0 && Object.keys(override).length === 0) return steps;
|
|
53678
|
+
return steps.map((step) => {
|
|
53679
|
+
const cfg = resolveStep(base[step.addonId], override[step.addonId]);
|
|
53680
|
+
const children = step.children ? applyDeviceProvisioning(step.children, base, override) : step.children;
|
|
53681
|
+
if (!cfg && children === step.children) return step;
|
|
53682
|
+
return {
|
|
53683
|
+
...step,
|
|
53684
|
+
...cfg?.modelId !== void 0 ? { modelId: cfg.modelId } : {},
|
|
53685
|
+
...cfg?.settings ? { settings: cfg.settings } : {},
|
|
53686
|
+
...cfg?.jumpDeviceKey !== void 0 ? { jumpDeviceKey: cfg.jumpDeviceKey } : {},
|
|
53687
|
+
...children !== void 0 ? { children } : {}
|
|
53688
|
+
};
|
|
53689
|
+
});
|
|
53690
|
+
}
|
|
53691
|
+
/**
|
|
53692
|
+
* What each step of `steps` would run with had the camera been elected onto
|
|
53693
|
+
* the device whose `base` / `override` these are — as a flat
|
|
53694
|
+
* `stepId → { modelId?, settings? }` map (D650). It IS
|
|
53695
|
+
* {@link applyDeviceProvisioning} over the same resolved tree, flattened, so a
|
|
53696
|
+
* jump target and the elected device are provisioned by one rule, and a value
|
|
53697
|
+
* the resolved tree already carries (a wholesale `pipelineByAgent` snapshot)
|
|
53698
|
+
* survives exactly as it would on the elected device. The runner REPLACES a
|
|
53699
|
+
* jumped subtree's `modelId` / `settings` with these, so the elected device's
|
|
53700
|
+
* base and override never follow a step across. `jumpDeviceKey` is dropped: it
|
|
53701
|
+
* names where a step leaves the ELECTED device for, and means nothing on the
|
|
53702
|
+
* target. A step with neither field is absent (it runs the format default).
|
|
53703
|
+
*/
|
|
53704
|
+
function provisionDeviceSteps(steps, base, override) {
|
|
53705
|
+
const out = {};
|
|
53706
|
+
const walk = (list) => {
|
|
53707
|
+
for (const step of list) {
|
|
53708
|
+
if (step.modelId !== void 0 || step.settings !== void 0) out[step.addonId] = {
|
|
53709
|
+
...step.modelId !== void 0 ? { modelId: step.modelId } : {},
|
|
53710
|
+
...step.settings !== void 0 ? { settings: step.settings } : {}
|
|
53711
|
+
};
|
|
53712
|
+
walk(step.children ?? []);
|
|
53713
|
+
}
|
|
53714
|
+
};
|
|
53715
|
+
walk(applyDeviceProvisioning(steps, base, override));
|
|
53716
|
+
return out;
|
|
53717
|
+
}
|
|
53718
|
+
//#endregion
|
|
53719
|
+
//#region src/jump-roster.ts
|
|
53720
|
+
/**
|
|
53721
|
+
* The roster (unprovisioned), or `undefined` when there is no jump to make: no
|
|
53722
|
+
* elected device, or fewer than two eligible devices on the node.
|
|
53723
|
+
*/
|
|
53724
|
+
function buildJumpRoster(input) {
|
|
53725
|
+
if (!input.deviceKey || Object.keys(input.eligible).length < 2) return void 0;
|
|
53726
|
+
return buildInferenceDeviceRoster(input.eligible, input.caps);
|
|
53727
|
+
}
|
|
53728
|
+
/** The roster devices a detail step may jump TO — every entry except the elected one. */
|
|
53729
|
+
function jumpTargetKeys(roster, electedDeviceKey) {
|
|
53730
|
+
return (roster ?? []).map((d) => d.deviceKey).filter((k) => k !== electedDeviceKey);
|
|
53731
|
+
}
|
|
53732
|
+
//#endregion
|
|
53733
|
+
//#region src/attach-pipeline.ts
|
|
53734
|
+
/**
|
|
53735
|
+
* The steps whose ELECTED-device base carries a manual `jumpDeviceKey` while
|
|
53736
|
+
* the camera has an override for that step on the elected device (D650). A
|
|
53737
|
+
* jumped step runs the TARGET's provisioning, so that override does not
|
|
53738
|
+
* travel with it — the operator must be told, not left to wonder.
|
|
53739
|
+
*/
|
|
53740
|
+
function manualJumpsLeavingOverride(base, override) {
|
|
53741
|
+
const out = [];
|
|
53742
|
+
for (const [stepId, cfg] of Object.entries(base)) {
|
|
53743
|
+
const jumpDeviceKey = cfg.jumpDeviceKey;
|
|
53744
|
+
if (jumpDeviceKey === void 0) continue;
|
|
53745
|
+
const own = override[stepId];
|
|
53746
|
+
if (own?.modelId === void 0 && own?.settings === void 0) continue;
|
|
53747
|
+
out.push({
|
|
53748
|
+
stepId,
|
|
53749
|
+
jumpDeviceKey
|
|
53750
|
+
});
|
|
53751
|
+
}
|
|
53752
|
+
return out;
|
|
53753
|
+
}
|
|
53754
|
+
/**
|
|
53755
|
+
* BLOCKING entry point: waits for the node's catalog (`resolvePipelineForDevice`
|
|
53756
|
+
* reconciles against the executor until it answers). For a FIRST placement —
|
|
53757
|
+
* a camera's first standing dispatch, an on-motion session, a re-attach —
|
|
53758
|
+
* where there is nothing better to attach than the real pipeline. See the
|
|
53759
|
+
* module header.
|
|
53760
|
+
*/
|
|
53761
|
+
async function resolveAttachPipeline(input, store) {
|
|
53762
|
+
const roster = buildJumpRoster({
|
|
53763
|
+
deviceKey: input.deviceKey,
|
|
53764
|
+
eligible: input.eligible,
|
|
53765
|
+
caps: input.caps
|
|
53766
|
+
});
|
|
53767
|
+
const resolved = await store.resolvePipelineForDeviceWithRoots(input.deviceId, input.nodeId, input.deviceKey, jumpTargetKeys(roster, input.deviceKey));
|
|
53768
|
+
if (resolved.droppedRoots.length > 0) return rootRefusal(input, resolved.droppedRoots);
|
|
53769
|
+
return {
|
|
53770
|
+
kind: "resolved",
|
|
53771
|
+
pipeline: await provisionAttachPipeline(input, roster, resolved.config, store)
|
|
53772
|
+
};
|
|
53773
|
+
}
|
|
53774
|
+
/**
|
|
53775
|
+
* NON-BLOCKING entry point: reads the node's catalog from the cache only, and
|
|
53776
|
+
* answers `catalog-unavailable` instead of waiting (D650 round 2). For the
|
|
53777
|
+
* RETRY and re-place paths — a pending retry, a remote-health re-place, a
|
|
53778
|
+
* rebalance migration — which run cameras serially in one sweep: one node
|
|
53779
|
+
* whose executor never answers must leave ITS camera pending, not hold every
|
|
53780
|
+
* camera behind it (D3, D49).
|
|
53781
|
+
*/
|
|
53782
|
+
async function resolveAttachPipelineIfCatalogCached(input, store) {
|
|
53783
|
+
const roster = buildJumpRoster({
|
|
53784
|
+
deviceKey: input.deviceKey,
|
|
53785
|
+
eligible: input.eligible,
|
|
53786
|
+
caps: input.caps
|
|
53787
|
+
});
|
|
53788
|
+
const outcome = await store.resolvePipelineForDeviceIfCatalogCached(input.deviceId, input.nodeId, input.deviceKey, jumpTargetKeys(roster, input.deviceKey));
|
|
53789
|
+
if (outcome.kind === "catalog-unavailable") return outcome;
|
|
53790
|
+
if (outcome.droppedRoots.length > 0) return rootRefusal(input, outcome.droppedRoots);
|
|
53791
|
+
return {
|
|
53792
|
+
kind: "resolved",
|
|
53793
|
+
pipeline: await provisionAttachPipeline(input, roster, outcome.config, store)
|
|
53794
|
+
};
|
|
53795
|
+
}
|
|
53796
|
+
function rootRefusal(input, droppedRoots) {
|
|
53797
|
+
return {
|
|
53798
|
+
kind: "root-refused",
|
|
53799
|
+
nodeId: input.nodeId,
|
|
53800
|
+
deviceKey: input.deviceKey,
|
|
53801
|
+
droppedRoots
|
|
53802
|
+
};
|
|
53803
|
+
}
|
|
53804
|
+
/** Steps 3 of the module header: provision the resolved structure. */
|
|
53805
|
+
async function provisionAttachPipeline(input, roster, resolved, store) {
|
|
53806
|
+
const { deviceId, nodeId, deviceKey } = input;
|
|
53807
|
+
const electedKey = deviceKey ?? "";
|
|
53808
|
+
const rosterKeys = (roster ?? []).map((d) => d.deviceKey);
|
|
53809
|
+
const sources = await store.readDeviceProvisioning(deviceId, nodeId, [...new Set([electedKey, ...rosterKeys])]);
|
|
53810
|
+
const elected = sources.get(electedKey);
|
|
53811
|
+
if (deviceKey && elected) {
|
|
53812
|
+
const left = manualJumpsLeavingOverride(elected.base, elected.override).filter((l) => rosterKeys.includes(l.jumpDeviceKey));
|
|
53813
|
+
if (left.length > 0) store.warnManualJumpsLeaveOverride(deviceId, nodeId, deviceKey, left);
|
|
53814
|
+
}
|
|
53815
|
+
const steps = applyDeviceProvisioning(resolved.steps, elected?.base ?? {}, elected?.override ?? {});
|
|
53816
|
+
const inferenceDevices = roster?.map((entry) => {
|
|
53817
|
+
const src = sources.get(entry.deviceKey);
|
|
53818
|
+
return {
|
|
53819
|
+
...entry,
|
|
53820
|
+
steps: provisionDeviceSteps(resolved.steps, src?.base ?? {}, src?.override ?? {})
|
|
53821
|
+
};
|
|
53822
|
+
});
|
|
53823
|
+
return {
|
|
53824
|
+
steps,
|
|
53825
|
+
audio: resolved.audio ?? null,
|
|
53826
|
+
...deviceKey ? { deviceKey } : {},
|
|
53827
|
+
...inferenceDevices ? { inferenceDevices } : {}
|
|
53828
|
+
};
|
|
53829
|
+
}
|
|
53830
|
+
/**
|
|
53831
|
+
* `config` with its pipeline REPLACED by `pipeline`. The four pipeline fields
|
|
53832
|
+
* are removed first, so a previous attach's `deviceKey` / roster never survives
|
|
53833
|
+
* a spread when the new pipeline has none (a migration to a single-device node,
|
|
53834
|
+
* a re-dispatch from a ledger config).
|
|
53835
|
+
*/
|
|
53836
|
+
function withAttachPipeline(config, pipeline) {
|
|
53837
|
+
const { deviceKey: _deviceKey, inferenceDevices: _inferenceDevices, steps: _steps, audio: _audio, ...rest } = config;
|
|
53838
|
+
return {
|
|
53839
|
+
...rest,
|
|
53840
|
+
...pipeline
|
|
53841
|
+
};
|
|
53842
|
+
}
|
|
53843
|
+
//#endregion
|
|
52825
53844
|
//#region src/dispatch-reconcile.ts
|
|
52826
53845
|
function runnerAttachmentKey(nodeId, deviceId) {
|
|
52827
53846
|
return `${nodeId}:${deviceId}`;
|
|
@@ -53112,6 +54131,32 @@ function selectRunnerFrameSource(input) {
|
|
|
53112
54131
|
//#region src/placement-service.ts
|
|
53113
54132
|
/** Key under which the orchestrator stores its per-device manual pin — shared with `readPipelinePin` (index.ts) and `handleNodeDisconnect` (`node-lifecycle-handler.ts`). */
|
|
53114
54133
|
var PREFERRED_AGENT_SETTING = "preferredAgent";
|
|
54134
|
+
/**
|
|
54135
|
+
* A load snapshot with this rebalance pass's own (re)assignments applied — at
|
|
54136
|
+
* node level, and per device so a device election in the same pass sees the
|
|
54137
|
+
* sessions the pass already gave each accelerator.
|
|
54138
|
+
*/
|
|
54139
|
+
function tallyLoad(load, nodeDelta, perDevice) {
|
|
54140
|
+
if (nodeDelta === 0 && (perDevice === void 0 || perDevice.size === 0)) return load;
|
|
54141
|
+
const known = new Set(load.devices.map((d) => d.deviceKey));
|
|
54142
|
+
const devices = [...load.devices.map((d) => {
|
|
54143
|
+
const delta = perDevice?.get(d.deviceKey) ?? 0;
|
|
54144
|
+
return delta === 0 ? d : {
|
|
54145
|
+
...d,
|
|
54146
|
+
attachedCameras: Math.max(0, d.attachedCameras + delta)
|
|
54147
|
+
};
|
|
54148
|
+
}), ...[...perDevice ?? /* @__PURE__ */ new Map()].filter(([deviceKey, delta]) => !known.has(deviceKey) && delta > 0).map(([deviceKey, delta]) => ({
|
|
54149
|
+
deviceKey,
|
|
54150
|
+
backend: deviceKey.split(":")[0] ?? deviceKey,
|
|
54151
|
+
attachedCameras: delta,
|
|
54152
|
+
queueDepthTotal: 0
|
|
54153
|
+
}))];
|
|
54154
|
+
return {
|
|
54155
|
+
...load,
|
|
54156
|
+
attachedCameras: Math.max(0, load.attachedCameras + nodeDelta),
|
|
54157
|
+
devices
|
|
54158
|
+
};
|
|
54159
|
+
}
|
|
53115
54160
|
var PlacementService = class {
|
|
53116
54161
|
deps;
|
|
53117
54162
|
/** True while an auto-rebalance pass is running (skip overlap). */
|
|
@@ -53149,7 +54194,116 @@ var PlacementService = class {
|
|
|
53149
54194
|
});
|
|
53150
54195
|
return usable;
|
|
53151
54196
|
}
|
|
54197
|
+
/**
|
|
54198
|
+
* Pick which of `nodeId`'s enabled inference devices a camera runs on, and
|
|
54199
|
+
* log why (`inference device selection` — one line per placement, the same
|
|
54200
|
+
* message as the on-motion path so one grep covers both). Returns the
|
|
54201
|
+
* eligibility inputs too: the attach pipeline is resolved against the SAME
|
|
54202
|
+
* roster the device was elected from.
|
|
54203
|
+
*/
|
|
54204
|
+
async electInferenceDevice(input) {
|
|
54205
|
+
const targetLoad = input.loads.find((load) => load.nodeId === input.nodeId);
|
|
54206
|
+
let eligible;
|
|
54207
|
+
if (input.read.kind === "await-catalog") eligible = await this.deps.getEligibleInferenceDevices(input.nodeId);
|
|
54208
|
+
else {
|
|
54209
|
+
const known = await this.deps.getEligibleInferenceDevicesIfCached(input.nodeId);
|
|
54210
|
+
if (known.kind === "unavailable") return known;
|
|
54211
|
+
eligible = known.eligible;
|
|
54212
|
+
}
|
|
54213
|
+
const caps = await this.deps.getInferenceDeviceCaps(input.nodeId);
|
|
54214
|
+
const pinnedDeviceKey = await this.deps.readPipelineDevicePin(input.deviceId);
|
|
54215
|
+
const selection = pickInferenceDevice({
|
|
54216
|
+
eligible,
|
|
54217
|
+
loads: targetLoad?.devices ?? [],
|
|
54218
|
+
caps,
|
|
54219
|
+
pinnedDeviceKey,
|
|
54220
|
+
currentDeviceKey: input.currentDeviceKey,
|
|
54221
|
+
rotation: this.deps.inferenceRotation
|
|
54222
|
+
});
|
|
54223
|
+
const deviceKey = selectedDeviceKey(selection);
|
|
54224
|
+
this.deps.ctx().logger.info("inference device selection", {
|
|
54225
|
+
tags: {
|
|
54226
|
+
deviceId: input.deviceId,
|
|
54227
|
+
nodeId: input.nodeId
|
|
54228
|
+
},
|
|
54229
|
+
meta: {
|
|
54230
|
+
path: input.path,
|
|
54231
|
+
eligible: selection.eligibleKeys,
|
|
54232
|
+
chosen: deviceKey ?? null,
|
|
54233
|
+
reason: selection.reason,
|
|
54234
|
+
...selection.kind === "selected" ? {
|
|
54235
|
+
tied: selection.tiedKeys,
|
|
54236
|
+
tieBreak: selection.tieBreak
|
|
54237
|
+
} : {},
|
|
54238
|
+
...pinnedDeviceKey ? { pin: pinnedDeviceKey } : {}
|
|
54239
|
+
}
|
|
54240
|
+
});
|
|
54241
|
+
return {
|
|
54242
|
+
kind: "elected",
|
|
54243
|
+
deviceKey,
|
|
54244
|
+
eligible,
|
|
54245
|
+
caps
|
|
54246
|
+
};
|
|
54247
|
+
}
|
|
54248
|
+
/**
|
|
54249
|
+
* Elect a device on `nodeId` and resolve the camera's attach pipeline for
|
|
54250
|
+
* it — the whole placement decision, for a first placement (`await-catalog`)
|
|
54251
|
+
* or a re-place (`cached-catalog`, never waits). Nothing is attached here.
|
|
54252
|
+
*/
|
|
54253
|
+
async resolvePlacement(input) {
|
|
54254
|
+
const election = await this.electInferenceDevice(input);
|
|
54255
|
+
if (election.kind === "unavailable") return election;
|
|
54256
|
+
const attachInput = {
|
|
54257
|
+
deviceId: input.deviceId,
|
|
54258
|
+
nodeId: input.nodeId,
|
|
54259
|
+
deviceKey: election.deviceKey,
|
|
54260
|
+
eligible: election.eligible,
|
|
54261
|
+
caps: election.caps
|
|
54262
|
+
};
|
|
54263
|
+
if (input.read.kind === "await-catalog") return resolveAttachPipeline(attachInput, this.deps.settingsStore);
|
|
54264
|
+
const outcome = await resolveAttachPipelineIfCatalogCached(attachInput, this.deps.settingsStore);
|
|
54265
|
+
if (outcome.kind === "catalog-unavailable") return {
|
|
54266
|
+
kind: "unavailable",
|
|
54267
|
+
nodeId: outcome.nodeId,
|
|
54268
|
+
what: "catalog"
|
|
54269
|
+
};
|
|
54270
|
+
return outcome;
|
|
54271
|
+
}
|
|
54272
|
+
/**
|
|
54273
|
+
* Re-resolve a camera's attach pipeline on the device it is ALREADY
|
|
54274
|
+
* elected onto (`deviceKey` from its ledger config; absent ⇒ default pool)
|
|
54275
|
+
* — the entry for every path that replaces the steps of a live attach
|
|
54276
|
+
* without re-electing (executor readiness, a package-zone change). Goes
|
|
54277
|
+
* through the same {@link resolveAttachPipeline} as a dispatch (D650).
|
|
54278
|
+
*/
|
|
54279
|
+
async resolveAttachPipelineOnDevice(input) {
|
|
54280
|
+
const [eligible, caps] = await Promise.all([this.deps.getEligibleInferenceDevices(input.nodeId), this.deps.getInferenceDeviceCaps(input.nodeId)]);
|
|
54281
|
+
return resolveAttachPipeline({
|
|
54282
|
+
...input,
|
|
54283
|
+
eligible,
|
|
54284
|
+
caps
|
|
54285
|
+
}, this.deps.settingsStore);
|
|
54286
|
+
}
|
|
54287
|
+
/**
|
|
54288
|
+
* FIRST placement of a standing camera: waits for the chosen node's catalog
|
|
54289
|
+
* (the resolve reconciles against its executor until it answers). Callers:
|
|
54290
|
+
* `startDetection`'s standing path — one camera, nothing to attach instead.
|
|
54291
|
+
*/
|
|
53152
54292
|
async dispatchCamera(runnerConfig) {
|
|
54293
|
+
return this.placeCamera(runnerConfig, { kind: "await-catalog" });
|
|
54294
|
+
}
|
|
54295
|
+
/**
|
|
54296
|
+
* RE-placement from the ledger — the pending-retry sweep and the
|
|
54297
|
+
* remote-health re-place (D650 round 2). NEVER waits for a node: the
|
|
54298
|
+
* catalog is read from the cache only, and a node that has not answered
|
|
54299
|
+
* leaves THIS camera pending (`catalog-unavailable:<nodeId>`) for the next
|
|
54300
|
+
* round, instead of holding every camera after it in a serial sweep behind
|
|
54301
|
+
* one wedged executor (D3, D49).
|
|
54302
|
+
*/
|
|
54303
|
+
async redispatchCamera(runnerConfig) {
|
|
54304
|
+
return this.placeCamera(runnerConfig, { kind: "cached-catalog" });
|
|
54305
|
+
}
|
|
54306
|
+
async placeCamera(runnerConfig, catalog) {
|
|
53153
54307
|
if (!this.deps.ctx()) throw new Error("PipelineOrchestrator: dispatchCamera called before initialize");
|
|
53154
54308
|
if (this.deps.maintenancePaused?.() === true) return {
|
|
53155
54309
|
success: true,
|
|
@@ -53202,45 +54356,30 @@ var PlacementService = class {
|
|
|
53202
54356
|
reason = decision.reason;
|
|
53203
54357
|
dispatchScore = decision.score;
|
|
53204
54358
|
}
|
|
53205
|
-
const
|
|
53206
|
-
|
|
53207
|
-
|
|
53208
|
-
|
|
53209
|
-
const selection = pickInferenceDevice({
|
|
53210
|
-
eligible: eligibleDevices,
|
|
53211
|
-
loads: targetLoad?.devices ?? [],
|
|
53212
|
-
caps: deviceCaps,
|
|
53213
|
-
pinnedDeviceKey,
|
|
54359
|
+
const placement = await this.resolvePlacement({
|
|
54360
|
+
deviceId: runnerConfig.deviceId,
|
|
54361
|
+
nodeId: targetNodeId,
|
|
54362
|
+
loads,
|
|
53214
54363
|
currentDeviceKey,
|
|
53215
|
-
|
|
54364
|
+
path: "standing",
|
|
54365
|
+
read: catalog
|
|
53216
54366
|
});
|
|
53217
|
-
|
|
53218
|
-
|
|
53219
|
-
|
|
53220
|
-
|
|
53221
|
-
|
|
53222
|
-
}
|
|
53223
|
-
|
|
53224
|
-
|
|
53225
|
-
|
|
53226
|
-
|
|
53227
|
-
|
|
53228
|
-
|
|
53229
|
-
|
|
53230
|
-
|
|
53231
|
-
|
|
53232
|
-
|
|
53233
|
-
}
|
|
53234
|
-
});
|
|
53235
|
-
const deviceBase = await this.deps.settingsStore.buildNodeInferenceDeviceSteps(targetNodeId, deviceKey ?? "");
|
|
53236
|
-
const deviceOverride = deviceKey ? await this.deps.settingsStore.readCameraDeviceOverride(runnerConfig.deviceId, targetNodeId, deviceKey) : {};
|
|
53237
|
-
const inferenceDevices = deviceKey && Object.keys(eligibleDevices).length >= 2 ? buildInferenceDeviceRoster(eligibleDevices, deviceCaps) : void 0;
|
|
53238
|
-
const attachConfig = {
|
|
53239
|
-
...runnerConfig,
|
|
53240
|
-
...deviceKey ? { deviceKey } : {},
|
|
53241
|
-
...inferenceDevices ? { inferenceDevices } : {},
|
|
53242
|
-
...runnerConfig.steps ? { steps: applyDeviceProvisioning(runnerConfig.steps, deviceBase, deviceOverride) } : {}
|
|
53243
|
-
};
|
|
54367
|
+
if (placement.kind === "unavailable") {
|
|
54368
|
+
this.leavePendingUnanswered(runnerConfig.deviceId, placement.nodeId, placement.what);
|
|
54369
|
+
return {
|
|
54370
|
+
success: true,
|
|
54371
|
+
kind: "pending"
|
|
54372
|
+
};
|
|
54373
|
+
}
|
|
54374
|
+
if (placement.kind === "root-refused") {
|
|
54375
|
+
this.leavePendingRootRefused(runnerConfig.deviceId, placement);
|
|
54376
|
+
return {
|
|
54377
|
+
success: true,
|
|
54378
|
+
kind: "pending"
|
|
54379
|
+
};
|
|
54380
|
+
}
|
|
54381
|
+
const pipeline = placement.pipeline;
|
|
54382
|
+
const attachConfig = withAttachPipeline(runnerConfig, pipeline);
|
|
53244
54383
|
const dispatchGuard = this.deps.ledger.markDispatching(runnerConfig.deviceId);
|
|
53245
54384
|
try {
|
|
53246
54385
|
await this.attachOn(targetNodeId, attachConfig);
|
|
@@ -53463,18 +54602,17 @@ var PlacementService = class {
|
|
|
53463
54602
|
const nodeCaps = await this.deps.settingsStore.buildNodeCaps();
|
|
53464
54603
|
const nodeWeights = await this.deps.settingsStore.buildNodeWeights();
|
|
53465
54604
|
const attachedDelta = /* @__PURE__ */ new Map();
|
|
53466
|
-
const
|
|
54605
|
+
const deviceDelta = /* @__PURE__ */ new Map();
|
|
54606
|
+
const bumpAttached = (nodeId, by, deviceKey) => {
|
|
53467
54607
|
attachedDelta.set(nodeId, (attachedDelta.get(nodeId) ?? 0) + by);
|
|
54608
|
+
if (deviceKey === void 0) return;
|
|
54609
|
+
const perDevice = deviceDelta.get(nodeId) ?? /* @__PURE__ */ new Map();
|
|
54610
|
+
perDevice.set(deviceKey, (perDevice.get(deviceKey) ?? 0) + by);
|
|
54611
|
+
deviceDelta.set(nodeId, perDevice);
|
|
53468
54612
|
};
|
|
53469
|
-
const talliedLoads = () => loads.map((load) =>
|
|
53470
|
-
const delta = attachedDelta.get(load.nodeId) ?? 0;
|
|
53471
|
-
if (delta === 0) return load;
|
|
53472
|
-
return {
|
|
53473
|
-
...load,
|
|
53474
|
-
attachedCameras: Math.max(0, load.attachedCameras + delta)
|
|
53475
|
-
};
|
|
53476
|
-
});
|
|
54613
|
+
const talliedLoads = () => loads.map((load) => tallyLoad(load, attachedDelta.get(load.nodeId) ?? 0, deviceDelta.get(load.nodeId)));
|
|
53477
54614
|
let migrated = 0;
|
|
54615
|
+
const skipped = [];
|
|
53478
54616
|
for (const [deviceId, config] of this.deps.ledger.configEntries()) {
|
|
53479
54617
|
if (this.deps.isIdleSessionCamera(deviceId)) continue;
|
|
53480
54618
|
const current = this.deps.ledger.getAssignment(deviceId);
|
|
@@ -53499,6 +54637,28 @@ var PlacementService = class {
|
|
|
53499
54637
|
const targetLoad = tallied.find((l) => l.nodeId === decision.agentNodeId);
|
|
53500
54638
|
if (currentLoad && targetLoad && capacityImprovement(currentLoad, targetLoad, nodeWeights) < minImprovement) continue;
|
|
53501
54639
|
}
|
|
54640
|
+
const placement = await this.resolvePlacement({
|
|
54641
|
+
deviceId,
|
|
54642
|
+
nodeId: decision.agentNodeId,
|
|
54643
|
+
loads: talliedLoads(),
|
|
54644
|
+
currentDeviceKey: null,
|
|
54645
|
+
path: "rebalance",
|
|
54646
|
+
read: { kind: "cached-catalog" }
|
|
54647
|
+
});
|
|
54648
|
+
if (placement.kind !== "resolved") {
|
|
54649
|
+
const reason = placement.kind === "root-refused" ? `root-unrunnable:${placement.nodeId}/${placement.deviceKey ?? "default-pool"}` : `${placement.what}-unavailable:${placement.nodeId}`;
|
|
54650
|
+
skipped.push({
|
|
54651
|
+
deviceId,
|
|
54652
|
+
targetNodeId: decision.agentNodeId,
|
|
54653
|
+
reason
|
|
54654
|
+
});
|
|
54655
|
+
if (current) this.noteMigrationSkipped(deviceId, current.agentNodeId, decision.agentNodeId, reason);
|
|
54656
|
+
else if (placement.kind === "root-refused") this.leavePendingRootRefused(deviceId, placement);
|
|
54657
|
+
else this.leavePendingUnanswered(deviceId, placement.nodeId, placement.what);
|
|
54658
|
+
continue;
|
|
54659
|
+
}
|
|
54660
|
+
this.migrationSkips.delete(deviceId);
|
|
54661
|
+
const targetConfig = withAttachPipeline(config, placement.pipeline);
|
|
53502
54662
|
if (current) {
|
|
53503
54663
|
await this.detachOn(current.agentNodeId, deviceId).catch((err) => {
|
|
53504
54664
|
const msg = errMsg$1(err);
|
|
@@ -53507,19 +54667,13 @@ var PlacementService = class {
|
|
|
53507
54667
|
meta: { error: msg }
|
|
53508
54668
|
});
|
|
53509
54669
|
});
|
|
53510
|
-
bumpAttached(current.agentNodeId, -1);
|
|
54670
|
+
bumpAttached(current.agentNodeId, -1, config.deviceKey);
|
|
53511
54671
|
}
|
|
53512
|
-
const reResolved = await this.deps.settingsStore.resolvePipelineForDevice(deviceId, decision.agentNodeId);
|
|
53513
|
-
const targetConfig = reResolved.steps.length > 0 ? {
|
|
53514
|
-
...config,
|
|
53515
|
-
steps: reResolved.steps,
|
|
53516
|
-
audio: reResolved.audio ?? null
|
|
53517
|
-
} : config;
|
|
53518
54672
|
this.deps.ledger.setConfig(deviceId, targetConfig);
|
|
53519
54673
|
const dispatchGuard = this.deps.ledger.markDispatching(deviceId);
|
|
53520
54674
|
try {
|
|
53521
54675
|
await this.attachOn(decision.agentNodeId, targetConfig);
|
|
53522
|
-
bumpAttached(decision.agentNodeId, 1);
|
|
54676
|
+
bumpAttached(decision.agentNodeId, 1, targetConfig.deviceKey);
|
|
53523
54677
|
this.deps.ledger.recordAssignment(deviceId, decision.agentNodeId, "rebalance", false);
|
|
53524
54678
|
} finally {
|
|
53525
54679
|
dispatchGuard.dispose();
|
|
@@ -53527,7 +54681,10 @@ var PlacementService = class {
|
|
|
53527
54681
|
migrated++;
|
|
53528
54682
|
}
|
|
53529
54683
|
ctx.logger.info("rebalance: migrated cameras", { meta: { migrated } });
|
|
53530
|
-
return {
|
|
54684
|
+
return {
|
|
54685
|
+
migrated,
|
|
54686
|
+
skipped
|
|
54687
|
+
};
|
|
53531
54688
|
}
|
|
53532
54689
|
getPipelineAssignments() {
|
|
53533
54690
|
return this.deps.ledger.listAssignments();
|
|
@@ -53706,6 +54863,71 @@ var PlacementService = class {
|
|
|
53706
54863
|
};
|
|
53707
54864
|
}
|
|
53708
54865
|
/**
|
|
54866
|
+
* A re-place found the node it chose has never answered what the placement
|
|
54867
|
+
* needs (its catalog, or its device probe + pool health): the camera stays
|
|
54868
|
+
* pending with the node NAMED, and the line fires once per change of pending
|
|
54869
|
+
* state — a sweep re-finding the same unanswering node every tick is not
|
|
54870
|
+
* news, a camera newly stuck on it (or on another node) is.
|
|
54871
|
+
*/
|
|
54872
|
+
leavePendingUnanswered(deviceId, nodeId, what) {
|
|
54873
|
+
const reason = what === "catalog" ? `catalog-unavailable:${nodeId}` : `device-health-unavailable:${nodeId}`;
|
|
54874
|
+
if (!this.setPendingIfChanged(deviceId, reason)) return;
|
|
54875
|
+
this.deps.ctx().logger.warn("camera left pending — the chosen node has not answered", {
|
|
54876
|
+
tags: {
|
|
54877
|
+
deviceId,
|
|
54878
|
+
nodeId
|
|
54879
|
+
},
|
|
54880
|
+
meta: {
|
|
54881
|
+
reason,
|
|
54882
|
+
hint: "a re-place never waits for a node; the next retry round places it once the node answers"
|
|
54883
|
+
}
|
|
54884
|
+
});
|
|
54885
|
+
}
|
|
54886
|
+
/**
|
|
54887
|
+
* The NAMED refusal of a root-less attach (D650 round 3): the elected
|
|
54888
|
+
* device cannot run a gated-on root of the camera, so the attach would
|
|
54889
|
+
* detect nothing and — once its assignment were recorded — nothing would
|
|
54890
|
+
* re-place it. The camera stays pending instead, once-per-change logged.
|
|
54891
|
+
*/
|
|
54892
|
+
leavePendingRootRefused(deviceId, refusal) {
|
|
54893
|
+
const reason = `root-unrunnable:${refusal.nodeId}/${refusal.deviceKey ?? "default-pool"}`;
|
|
54894
|
+
if (!this.setPendingIfChanged(deviceId, reason)) return;
|
|
54895
|
+
this.deps.ctx().logger.error("attach refused — the elected device cannot run the camera root; camera left pending", {
|
|
54896
|
+
tags: {
|
|
54897
|
+
deviceId,
|
|
54898
|
+
nodeId: refusal.nodeId
|
|
54899
|
+
},
|
|
54900
|
+
meta: {
|
|
54901
|
+
reason,
|
|
54902
|
+
deviceKey: refusal.deviceKey ?? null,
|
|
54903
|
+
droppedRoots: refusal.droppedRoots.join(","),
|
|
54904
|
+
hint: "the root is never jumped: enable a device on this node whose format ships the root model, or disable the device that cannot"
|
|
54905
|
+
}
|
|
54906
|
+
});
|
|
54907
|
+
}
|
|
54908
|
+
/** Last migration-skip reason per camera — the info line fires once per change. */
|
|
54909
|
+
migrationSkips = /* @__PURE__ */ new Map();
|
|
54910
|
+
noteMigrationSkipped(deviceId, sourceNodeId, targetNodeId, reason) {
|
|
54911
|
+
if (this.migrationSkips.get(deviceId) === reason) return;
|
|
54912
|
+
this.migrationSkips.set(deviceId, reason);
|
|
54913
|
+
this.deps.ctx().logger.info("rebalance: migration skipped — camera stays on its source", {
|
|
54914
|
+
tags: {
|
|
54915
|
+
deviceId,
|
|
54916
|
+
nodeId: targetNodeId
|
|
54917
|
+
},
|
|
54918
|
+
meta: {
|
|
54919
|
+
sourceNodeId,
|
|
54920
|
+
reason
|
|
54921
|
+
}
|
|
54922
|
+
});
|
|
54923
|
+
}
|
|
54924
|
+
/** Record `reason`; `true` when it differs from the camera's previous pending reason. */
|
|
54925
|
+
setPendingIfChanged(deviceId, reason) {
|
|
54926
|
+
const prior = this.deps.ledger.getPendingReason(deviceId);
|
|
54927
|
+
this.deps.ledger.setPendingReason(deviceId, reason);
|
|
54928
|
+
return prior !== reason;
|
|
54929
|
+
}
|
|
54930
|
+
/**
|
|
53709
54931
|
* Normalizes the `decision.kind === 'pending'` → `setPendingReason` +
|
|
53710
54932
|
* `warn` half shared by `dispatchCamera`/`unassignPipeline`/`rebalance`
|
|
53711
54933
|
* (smell #12). Each call site keeps its own bail (return / fall-through /
|
|
@@ -53962,13 +55184,16 @@ var NodeLifecycleHandler = class {
|
|
|
53962
55184
|
for (const deviceId of candidates) {
|
|
53963
55185
|
const cached = this.deps.ledger.getConfig(deviceId);
|
|
53964
55186
|
if (!cached) continue;
|
|
53965
|
-
|
|
53966
|
-
|
|
53967
|
-
|
|
53968
|
-
|
|
53969
|
-
|
|
53970
|
-
|
|
53971
|
-
|
|
55187
|
+
if (this.isUnplacedPlaceholder(deviceId, cached, nodeId)) continue;
|
|
55188
|
+
const outcome = await this.deps.resolveAttachPipeline({
|
|
55189
|
+
deviceId,
|
|
55190
|
+
nodeId,
|
|
55191
|
+
deviceKey: cached.deviceKey
|
|
55192
|
+
});
|
|
55193
|
+
if (this.refusedReattach(deviceId, nodeId, outcome)) continue;
|
|
55194
|
+
const pipeline = outcome.pipeline;
|
|
55195
|
+
if (pipeline.steps.length === 0) continue;
|
|
55196
|
+
const next = withAttachPipeline(cached, pipeline);
|
|
53972
55197
|
this.deps.ledger.setConfig(deviceId, next);
|
|
53973
55198
|
affected.push({
|
|
53974
55199
|
deviceId,
|
|
@@ -54021,6 +55246,43 @@ var NodeLifecycleHandler = class {
|
|
|
54021
55246
|
}
|
|
54022
55247
|
}
|
|
54023
55248
|
/**
|
|
55249
|
+
* A re-attach whose elected device cannot run the camera's root is REFUSED
|
|
55250
|
+
* (D650 round 3): the live attach is left as it is rather than replaced by
|
|
55251
|
+
* one that detects nothing. Said once per pass, with the roots.
|
|
55252
|
+
*/
|
|
55253
|
+
refusedReattach(deviceId, nodeId, outcome) {
|
|
55254
|
+
if (outcome.kind !== "root-refused") return false;
|
|
55255
|
+
this.deps.logger.error("re-attach refused — the elected device cannot run the camera root", {
|
|
55256
|
+
tags: {
|
|
55257
|
+
deviceId,
|
|
55258
|
+
nodeId
|
|
55259
|
+
},
|
|
55260
|
+
meta: {
|
|
55261
|
+
deviceKey: outcome.deviceKey ?? null,
|
|
55262
|
+
droppedRoots: outcome.droppedRoots.join(",")
|
|
55263
|
+
}
|
|
55264
|
+
});
|
|
55265
|
+
return true;
|
|
55266
|
+
}
|
|
55267
|
+
/**
|
|
55268
|
+
* A ledger config with no assignment AND no elected device is the standing
|
|
55269
|
+
* path's PLACEHOLDER (D650 round 2): a camera the balancer has not placed,
|
|
55270
|
+
* hydrated before any election. Attaching it here would place it on this
|
|
55271
|
+
* node behind the balancer's back, on no device — the pending-retry sweep
|
|
55272
|
+
* owns it. Skipped, and said so.
|
|
55273
|
+
*/
|
|
55274
|
+
isUnplacedPlaceholder(deviceId, cached, nodeId) {
|
|
55275
|
+
if (this.deps.ledger.hasAssignment(deviceId) || cached.deviceKey !== void 0) return false;
|
|
55276
|
+
this.deps.logger.info("readiness: skipped an unplaced placeholder config", {
|
|
55277
|
+
tags: {
|
|
55278
|
+
deviceId,
|
|
55279
|
+
nodeId
|
|
55280
|
+
},
|
|
55281
|
+
meta: { reason: "no assignment and no elected device — the pending-retry sweep places it" }
|
|
55282
|
+
});
|
|
55283
|
+
return true;
|
|
55284
|
+
}
|
|
55285
|
+
/**
|
|
54024
55286
|
* Walk every cached RunnerCameraConfig and re-attach any whose stored
|
|
54025
55287
|
* `steps` are empty AND whose latest resolve produces a non-empty
|
|
54026
55288
|
* pipeline. Catches the "camera dispatched mid-readiness" race where
|
|
@@ -54031,13 +55293,16 @@ var NodeLifecycleHandler = class {
|
|
|
54031
55293
|
for (const [deviceId, cached] of this.deps.ledger.configEntries()) {
|
|
54032
55294
|
if ((cached.steps?.length ?? 0) > 0) continue;
|
|
54033
55295
|
if ((this.deps.ledger.getAssignment(deviceId)?.agentNodeId ?? this.deps.localNodeId()) !== nodeId) continue;
|
|
54034
|
-
|
|
54035
|
-
|
|
54036
|
-
|
|
54037
|
-
|
|
54038
|
-
|
|
54039
|
-
|
|
54040
|
-
|
|
55296
|
+
if (this.isUnplacedPlaceholder(deviceId, cached, nodeId)) continue;
|
|
55297
|
+
const outcome = await this.deps.resolveAttachPipeline({
|
|
55298
|
+
deviceId,
|
|
55299
|
+
nodeId,
|
|
55300
|
+
deviceKey: cached.deviceKey
|
|
55301
|
+
});
|
|
55302
|
+
if (this.refusedReattach(deviceId, nodeId, outcome)) continue;
|
|
55303
|
+
const pipeline = outcome.pipeline;
|
|
55304
|
+
if (pipeline.steps.length === 0) continue;
|
|
55305
|
+
const next = withAttachPipeline(cached, pipeline);
|
|
54041
55306
|
this.deps.ledger.setConfig(deviceId, next);
|
|
54042
55307
|
try {
|
|
54043
55308
|
await this.deps.attachOn(nodeId, next);
|
|
@@ -55420,9 +56685,11 @@ function wireOrchestratorSubscriptions(deps) {
|
|
|
55420
56685
|
});
|
|
55421
56686
|
const unsubFrameTracked = deps.eventBus.subscribe({ category: EventCategory.PipelineAnalyticsFrameTracked }, (event) => {
|
|
55422
56687
|
if (!isEvent(event, EventCategory.PipelineAnalyticsFrameTracked)) return;
|
|
55423
|
-
if (event.data.hasLiveTrack !== true) return;
|
|
55424
56688
|
const deviceId = event.data.deviceId;
|
|
55425
56689
|
if (typeof deviceId !== "number") return;
|
|
56690
|
+
const liveTrackCount = event.data.liveTrackCount;
|
|
56691
|
+
if (typeof liveTrackCount === "number") deps.noteSessionTrackedFrame(deviceId, liveTrackCount);
|
|
56692
|
+
if (event.data.hasLiveTrack !== true) return;
|
|
55426
56693
|
deps.noteSessionSubjectPresent(deviceId);
|
|
55427
56694
|
});
|
|
55428
56695
|
const unsubMotionAnalysis = deps.eventBus.subscribe({ category: EventCategory.MotionAnalysis }, (event) => {
|
|
@@ -55564,303 +56831,54 @@ var PackageZoneGate = class {
|
|
|
55564
56831
|
}
|
|
55565
56832
|
};
|
|
55566
56833
|
//#endregion
|
|
55567
|
-
//#region src/
|
|
55568
|
-
/**
|
|
55569
|
-
*
|
|
55570
|
-
*
|
|
55571
|
-
*
|
|
55572
|
-
|
|
55573
|
-
|
|
55574
|
-
|
|
55575
|
-
*
|
|
55576
|
-
*
|
|
55577
|
-
|
|
55578
|
-
|
|
55579
|
-
|
|
55580
|
-
|
|
55581
|
-
|
|
55582
|
-
|
|
55583
|
-
|
|
55584
|
-
|
|
55585
|
-
|
|
55586
|
-
|
|
55587
|
-
|
|
55588
|
-
|
|
55589
|
-
* `package-detection` is a ROOT (`inputClasses: null`) so it only ever appears
|
|
55590
|
-
* at the top level — no recursion into children needed. Every other step is
|
|
55591
|
-
* left untouched. Immutable: returns a fresh array only when a change applies.
|
|
55592
|
-
*/
|
|
55593
|
-
function applyPackageZoneActivation(steps, hasPackageZone) {
|
|
55594
|
-
const existing = steps.find((s) => s.addonId === PACKAGE_DETECTION_STEP_ID);
|
|
55595
|
-
if (!hasPackageZone) {
|
|
55596
|
-
if (!existing) return steps;
|
|
55597
|
-
return steps.filter((s) => s.addonId !== PACKAGE_DETECTION_STEP_ID);
|
|
55598
|
-
}
|
|
55599
|
-
if (existing) {
|
|
55600
|
-
if (existing.enabled === true) return steps;
|
|
55601
|
-
return steps.map((s) => s.addonId === "package-detection" ? {
|
|
55602
|
-
...s,
|
|
55603
|
-
enabled: true
|
|
55604
|
-
} : s);
|
|
55605
|
-
}
|
|
55606
|
-
const node = {
|
|
55607
|
-
addonId: PACKAGE_DETECTION_STEP_ID,
|
|
55608
|
-
enabled: true,
|
|
55609
|
-
children: []
|
|
55610
|
-
};
|
|
55611
|
-
return [...steps, node];
|
|
55612
|
-
}
|
|
55613
|
-
/**
|
|
55614
|
-
* Steps that are OFF by the per-camera gate DEFAULT (i.e. when the camera's
|
|
55615
|
-
* `stepToggles[addonId]` is unset). Mirrors each step's catalog
|
|
55616
|
-
* `enabledByDefault: false` — the heavy / opt-in classifiers + segmentation.
|
|
55617
|
-
*
|
|
55618
|
-
* The pure resolver derives the default gate from the LIVE catalog
|
|
55619
|
-
* (`addon.enabledByDefault ?? true`), so it stays correct if a future
|
|
55620
|
-
* default-off step ships. This literal set is the catalog-FREE fallback used
|
|
55621
|
-
* by the one-shot gating migration ({@link migrateStepGating}), which runs at
|
|
55622
|
-
* boot with no guaranteed live executor catalog. The two agree for every
|
|
55623
|
-
* step that exists today.
|
|
55624
|
-
*
|
|
55625
|
-
* `package-detection` is deliberately NOT listed — it is ZONE-driven
|
|
55626
|
-
* ({@link applyPackageZoneActivation}) and never governed by the gate.
|
|
55627
|
-
*/
|
|
55628
|
-
var DEFAULT_OFF_STEP_IDS = new Set([
|
|
55629
|
-
"animal-classifier",
|
|
55630
|
-
"bird-classifier",
|
|
55631
|
-
"vehicle-classifier",
|
|
55632
|
-
"segmentation"
|
|
55633
|
-
]);
|
|
55634
|
-
/**
|
|
55635
|
-
* Catalog-free default gate for `addonId` — `true` unless the step is in
|
|
55636
|
-
* {@link DEFAULT_OFF_STEP_IDS}. Used by the migration (no live catalog); the
|
|
55637
|
-
* resolver prefers the catalog's own `enabledByDefault ?? true`.
|
|
55638
|
-
*/
|
|
55639
|
-
function defaultStepGate(addonId) {
|
|
55640
|
-
return !DEFAULT_OFF_STEP_IDS.has(addonId);
|
|
55641
|
-
}
|
|
55642
|
-
/**
|
|
55643
|
-
* PROVISIONING presence for `(addon, format)` — the node "provides" the step
|
|
55644
|
-
* iff the catalog lists at least one model with a build for the node's engine
|
|
55645
|
-
* format. Byte-for-byte the same test the admin-ui matrices use
|
|
55646
|
-
* (`addon.models.some(m => Boolean(m.formats[fmt]))`). An absent `modelId`
|
|
55647
|
-
* on the resolved step is still "Auto" (the node resolves its own format
|
|
55648
|
-
* default) — provisioning does NOT require an operator-pinned model, only a
|
|
55649
|
-
* compatible model to EXIST for the format.
|
|
55650
|
-
*/
|
|
55651
|
-
function addonHasCompatibleModel(addon, format) {
|
|
55652
|
-
return (addon.models ?? []).some((m) => Boolean(m.formats[format]));
|
|
55653
|
-
}
|
|
55654
|
-
/**
|
|
55655
|
-
* Device-aware resolver — the SINGLE per-camera gate + per-DEVICE skip check.
|
|
55656
|
-
*
|
|
55657
|
-
* Step `S` runs for camera `C` on device `D` ⇔
|
|
55658
|
-
* gate(C, S) — `stepToggles[S]` ?? `addon.enabledByDefault ?? true`
|
|
55659
|
-
* AND provided(D, S) — the catalog lists a model with a build for D's FORMAT
|
|
55660
|
-
*
|
|
55661
|
-
* Enablement is the per-camera `stepToggles` authority ONLY. Provisioning
|
|
55662
|
-
* (`modelId` / `settings`) is NOT applied here — the returned tree carries bare
|
|
55663
|
-
* `{ addonId, enabled: true, children }` nodes; {@link applyDeviceProvisioning}
|
|
55664
|
-
* attaches model + settings at dispatch from the per-(node,device) base + the
|
|
55665
|
-
* per-camera-device override.
|
|
55666
|
-
*
|
|
55667
|
-
* A step gated ON but with NO compatible model for the DEVICE's format is
|
|
55668
|
-
* DROPPED and recorded in `skipped` so the caller can surface a visible "gated
|
|
55669
|
-
* on, no model on this device" status at dispatch time.
|
|
55670
|
-
*
|
|
55671
|
-
* `package-detection` is excluded here — it is zone-driven
|
|
55672
|
-
* ({@link applyPackageZoneActivation}, applied by the caller).
|
|
55673
|
-
*
|
|
55674
|
-
* "Inference disabled for this camera" is NOT handled here — the caller
|
|
55675
|
-
* (resolvePipelineForDevice) consults the detection-pipeline binding and
|
|
55676
|
-
* short-circuits to an empty pipeline before invoking this resolver.
|
|
55677
|
-
*/
|
|
55678
|
-
function resolvePipelineWithSkips(cameraSettings, agentNodeId, deviceFormat, catalog) {
|
|
55679
|
-
const cam = cameraSettings ?? {};
|
|
55680
|
-
const wholesale = cam.pipelineByAgent?.[agentNodeId];
|
|
55681
|
-
if (wholesale) return {
|
|
55682
|
-
config: {
|
|
55683
|
-
steps: mergeEnabledByDefaultSteps(wholesale.steps, catalog),
|
|
55684
|
-
audio: wholesale.audio ? {
|
|
55685
|
-
modelId: wholesale.audio.modelId,
|
|
55686
|
-
enabled: wholesale.audio.enabled
|
|
55687
|
-
} : null
|
|
55688
|
-
},
|
|
55689
|
-
skipped: []
|
|
55690
|
-
};
|
|
55691
|
-
const toggles = cam.stepToggles ?? {};
|
|
55692
|
-
const format = deviceFormat;
|
|
55693
|
-
const enabled = [];
|
|
55694
|
-
const skipped = [];
|
|
55695
|
-
for (const slot of catalog.slots) for (const addon of slot.addons) {
|
|
55696
|
-
const addonId = addon.id;
|
|
55697
|
-
if (addonId === "package-detection") continue;
|
|
55698
|
-
if (!(toggles[addonId] ?? addon.enabledByDefault ?? true)) continue;
|
|
55699
|
-
if (!addonHasCompatibleModel(addon, format)) {
|
|
55700
|
-
skipped.push({
|
|
55701
|
-
addonId,
|
|
55702
|
-
reason: "no-compatible-model"
|
|
55703
|
-
});
|
|
55704
|
-
continue;
|
|
55705
|
-
}
|
|
55706
|
-
enabled.push({ addonId });
|
|
55707
|
-
}
|
|
55708
|
-
const audioAddons = [];
|
|
55709
|
-
const videoAddons = [];
|
|
55710
|
-
for (const entry of enabled) {
|
|
55711
|
-
const meta = findInCatalog(catalog, entry.addonId);
|
|
55712
|
-
if (!meta) continue;
|
|
55713
|
-
if (meta.slot === "audio-classifier") audioAddons.push(entry);
|
|
55714
|
-
else videoAddons.push(entry);
|
|
55715
|
-
}
|
|
55716
|
-
return {
|
|
55717
|
-
config: {
|
|
55718
|
-
steps: buildTreeFromAddons(videoAddons, catalog),
|
|
55719
|
-
audio: audioAddons.length > 0 ? { enabled: true } : null
|
|
55720
|
-
},
|
|
55721
|
-
skipped
|
|
55722
|
-
};
|
|
55723
|
-
}
|
|
55724
|
-
function findInCatalog(catalog, addonId) {
|
|
55725
|
-
for (const slot of catalog.slots) for (const addon of slot.addons) if (addon.id === addonId) return addon;
|
|
55726
|
-
return null;
|
|
55727
|
-
}
|
|
55728
|
-
/**
|
|
55729
|
-
* Compose a step tree from a flat list of enabled video addons using
|
|
55730
|
-
* catalog compatibility: an addon whose `inputClasses` overlaps a
|
|
55731
|
-
* candidate parent's `outputClasses` attaches as the parent's child.
|
|
55732
|
-
* Addons with `inputClasses` null/empty become roots.
|
|
55733
|
-
*
|
|
55734
|
-
* Multiple addons in the same slot with compatible inputClasses run in
|
|
55735
|
-
* parallel — they attach to the same parent as siblings. Example: two
|
|
55736
|
-
* classifiers (bird-classifier + animal-classifier) both accept 'animal'
|
|
55737
|
-
* → both attach to object-detection as siblings, both receive every
|
|
55738
|
-
* animal crop.
|
|
55739
|
-
*
|
|
55740
|
-
* Unparented leaves (inputClasses set, but no matching parent in the
|
|
55741
|
-
* enabled set) are DROPPED. The runner would have nothing to feed them
|
|
55742
|
-
* anyway — better silent drop than dispatching a dead step.
|
|
55743
|
-
*/
|
|
55744
|
-
function buildTreeFromAddons(enabled, catalog) {
|
|
55745
|
-
const bySlot = /* @__PURE__ */ new Map();
|
|
55746
|
-
for (const slot of catalog.slots) bySlot.set(slot.id, slot);
|
|
55747
|
-
const nodes = /* @__PURE__ */ new Map();
|
|
55748
|
-
const metaById = /* @__PURE__ */ new Map();
|
|
55749
|
-
for (const { addonId } of enabled) {
|
|
55750
|
-
const meta = findInCatalog(catalog, addonId);
|
|
55751
|
-
if (!meta) continue;
|
|
55752
|
-
metaById.set(addonId, meta);
|
|
55753
|
-
nodes.set(addonId, {
|
|
55754
|
-
addonId,
|
|
55755
|
-
enabled: true,
|
|
55756
|
-
children: []
|
|
56834
|
+
//#region src/package-zone-reattach.ts
|
|
56835
|
+
/**
|
|
56836
|
+
* Re-attach a placed camera after its `package` zone rules changed.
|
|
56837
|
+
*
|
|
56838
|
+
* A package zone flips the toggle-less `package-detection` root on or off
|
|
56839
|
+
* (`applyPackageZoneActivation`), which changes the step TREE, so the live
|
|
56840
|
+
* attach must be re-resolved rather than wait for the next natural attach.
|
|
56841
|
+
* It goes through the one owner of an attach's steps (D650) on the device the
|
|
56842
|
+
* camera is already elected onto — a bare re-resolve here used to gate on the
|
|
56843
|
+
* node DEFAULT format and drop the device's provisioning and jump roster.
|
|
56844
|
+
*/
|
|
56845
|
+
/** No-op for a camera that is not placed or has no ledger config. Never throws. */
|
|
56846
|
+
async function reattachAfterPackageZoneChange(deps, deviceId) {
|
|
56847
|
+
const assignment = deps.ledger.getAssignment(deviceId);
|
|
56848
|
+
const cached = deps.ledger.getConfig(deviceId);
|
|
56849
|
+
if (!assignment || !cached) return;
|
|
56850
|
+
const nodeId = assignment.agentNodeId;
|
|
56851
|
+
try {
|
|
56852
|
+
const outcome = await deps.resolveAttachPipeline({
|
|
56853
|
+
deviceId,
|
|
56854
|
+
nodeId,
|
|
56855
|
+
deviceKey: cached.deviceKey
|
|
55757
56856
|
});
|
|
55758
|
-
|
|
55759
|
-
|
|
55760
|
-
|
|
55761
|
-
|
|
55762
|
-
|
|
55763
|
-
|
|
55764
|
-
|
|
55765
|
-
|
|
55766
|
-
|
|
55767
|
-
for (const [candidateId, candidateNode] of nodes) {
|
|
55768
|
-
if (candidateId === addonId) continue;
|
|
55769
|
-
if (metaById.get(candidateId).outputClasses.some((c) => inputs.includes(c))) {
|
|
55770
|
-
parent = candidateNode;
|
|
55771
|
-
break;
|
|
55772
|
-
}
|
|
55773
|
-
}
|
|
55774
|
-
if (parent) parent.children.push(node);
|
|
55775
|
-
}
|
|
55776
|
-
return roots;
|
|
55777
|
-
}
|
|
55778
|
-
/**
|
|
55779
|
-
* Back-fill catalog steps EXPLICITLY flagged `backfillIntoExistingOverrides`
|
|
55780
|
-
* but ENTIRELY ABSENT from an existing step tree — reconciles a stored
|
|
55781
|
-
* wholesale `pipelineByAgent` snapshot with genuinely-new default steps.
|
|
55782
|
-
*
|
|
55783
|
-
* Why it's needed: a `pipelineByAgent` wholesale override SNAPSHOTS the full
|
|
55784
|
-
* tree. A step introduced AFTER the snapshot (e.g. `clip-embedding` for object
|
|
55785
|
-
* semantic search) would otherwise never reach that camera.
|
|
55786
|
-
*
|
|
55787
|
-
* Why the flag (not `enabledByDefault`): absence-from-a-snapshot is ambiguous —
|
|
55788
|
-
* it can mean "predates this step" OR "operator deliberately pruned it". A
|
|
55789
|
-
* broad "back-fill every default-on step" would resurrect deliberate removals
|
|
55790
|
-
* of long-existing steps (face-detection, etc.), an operator-intent
|
|
55791
|
-
* regression. Only a step that opts in via `backfillIntoExistingOverrides`
|
|
55792
|
-
* (set on genuinely-new default steps ONLY) re-enters existing overrides.
|
|
55793
|
-
*
|
|
55794
|
-
* Non-destructive by design:
|
|
55795
|
-
* - Only steps whose id is absent from the WHOLE tree are added. A step the
|
|
55796
|
-
* operator has already seen — present anywhere, even `enabled: false` —
|
|
55797
|
-
* is left exactly as-is (its enabled flag is honoured).
|
|
55798
|
-
* - Only `backfillIntoExistingOverrides === true` addons are candidates.
|
|
55799
|
-
* Every other step (including long-standing default-on members) is left
|
|
55800
|
-
* untouched, so a deliberately-pruned override stays pruned.
|
|
55801
|
-
* - Audio-classifier addons are skipped — audio lives in
|
|
55802
|
-
* `CameraPipelineConfig.audio`, never in the video `steps` tree.
|
|
55803
|
-
* - A candidate attaches by catalog compat (its `inputClasses` overlap a
|
|
55804
|
-
* present node's `outputClasses`), mirroring {@link buildTreeFromAddons}.
|
|
55805
|
-
* A candidate with non-empty `inputClasses` and NO compatible parent is
|
|
55806
|
-
* dropped (never re-rooted) so a crop-scoped embedder never regresses to
|
|
55807
|
-
* running on the full frame. Empty `inputClasses` ⇒ a genuine root step.
|
|
55808
|
-
*/
|
|
55809
|
-
function mergeEnabledByDefaultSteps(steps, catalog) {
|
|
55810
|
-
if (steps.length === 0) return steps;
|
|
55811
|
-
const present = /* @__PURE__ */ new Set();
|
|
55812
|
-
const collect = (nodes) => {
|
|
55813
|
-
for (const n of nodes) {
|
|
55814
|
-
present.add(n.addonId);
|
|
55815
|
-
if (n.children?.length) collect(n.children);
|
|
55816
|
-
}
|
|
55817
|
-
};
|
|
55818
|
-
collect(steps);
|
|
55819
|
-
const catalogById = /* @__PURE__ */ new Map();
|
|
55820
|
-
for (const slot of catalog.slots) for (const addon of slot.addons) catalogById.set(addon.id, addon);
|
|
55821
|
-
const newRoots = [];
|
|
55822
|
-
const childrenByParent = /* @__PURE__ */ new Map();
|
|
55823
|
-
for (const slot of catalog.slots) {
|
|
55824
|
-
if (slot.id === "audio-classifier") continue;
|
|
55825
|
-
for (const addon of slot.addons) {
|
|
55826
|
-
if (addon.backfillIntoExistingOverrides !== true) continue;
|
|
55827
|
-
if (present.has(addon.id)) continue;
|
|
55828
|
-
const node = {
|
|
55829
|
-
addonId: addon.id,
|
|
55830
|
-
enabled: true,
|
|
55831
|
-
children: []
|
|
55832
|
-
};
|
|
55833
|
-
const inputs = addon.inputClasses;
|
|
55834
|
-
if (!inputs || inputs.length === 0) {
|
|
55835
|
-
newRoots.push(node);
|
|
55836
|
-
continue;
|
|
55837
|
-
}
|
|
55838
|
-
let parentId = null;
|
|
55839
|
-
for (const presentId of present) {
|
|
55840
|
-
const meta = catalogById.get(presentId);
|
|
55841
|
-
if (!meta) continue;
|
|
55842
|
-
if (meta.outputClasses.some((c) => inputs.includes(c))) {
|
|
55843
|
-
parentId = presentId;
|
|
55844
|
-
break;
|
|
56857
|
+
if (outcome.kind === "root-refused") {
|
|
56858
|
+
deps.logger.error("package zone-rule re-attach refused — the elected device cannot run the camera root", {
|
|
56859
|
+
tags: {
|
|
56860
|
+
deviceId,
|
|
56861
|
+
nodeId
|
|
56862
|
+
},
|
|
56863
|
+
meta: {
|
|
56864
|
+
deviceKey: outcome.deviceKey ?? null,
|
|
56865
|
+
droppedRoots: outcome.droppedRoots.join(",")
|
|
55845
56866
|
}
|
|
55846
|
-
}
|
|
55847
|
-
|
|
55848
|
-
const list = childrenByParent.get(parentId) ?? [];
|
|
55849
|
-
list.push(node);
|
|
55850
|
-
childrenByParent.set(parentId, list);
|
|
56867
|
+
});
|
|
56868
|
+
return;
|
|
55851
56869
|
}
|
|
56870
|
+
const next = withAttachPipeline(cached, outcome.pipeline);
|
|
56871
|
+
deps.ledger.setConfig(deviceId, next);
|
|
56872
|
+
await deps.attachOn(nodeId, next);
|
|
56873
|
+
} catch (err) {
|
|
56874
|
+
deps.logger.warn("package zone-rule change re-dispatch failed", {
|
|
56875
|
+
tags: {
|
|
56876
|
+
deviceId,
|
|
56877
|
+
nodeId
|
|
56878
|
+
},
|
|
56879
|
+
meta: { error: errMsg$1(err) }
|
|
56880
|
+
});
|
|
55852
56881
|
}
|
|
55853
|
-
if (childrenByParent.size === 0 && newRoots.length === 0) return steps;
|
|
55854
|
-
const attach = (nodes) => nodes.map((n) => {
|
|
55855
|
-
const rebuiltChildren = attach(n.children ?? []);
|
|
55856
|
-
const extra = childrenByParent.get(n.addonId) ?? [];
|
|
55857
|
-
const mergedChildren = [...rebuiltChildren, ...extra];
|
|
55858
|
-
return mergedChildren.length > 0 ? {
|
|
55859
|
-
...n,
|
|
55860
|
-
children: mergedChildren
|
|
55861
|
-
} : n;
|
|
55862
|
-
});
|
|
55863
|
-
return [...attach(steps), ...newRoots];
|
|
55864
56882
|
}
|
|
55865
56883
|
//#endregion
|
|
55866
56884
|
//#region src/node-step-settings-fold.ts
|
|
@@ -56091,6 +57109,10 @@ var PipelineSettingsStore = class PipelineSettingsStore {
|
|
|
56091
57109
|
this.deps = deps;
|
|
56092
57110
|
}
|
|
56093
57111
|
disposed = false;
|
|
57112
|
+
/** Whether `dispose()` has run — a `null` catalog from a bounded wait means "not answered" only while this is false. */
|
|
57113
|
+
isDisposed() {
|
|
57114
|
+
return this.disposed;
|
|
57115
|
+
}
|
|
56094
57116
|
/** Called once from the addon's `onShutdown()`. Idempotent. */
|
|
56095
57117
|
dispose() {
|
|
56096
57118
|
this.disposed = true;
|
|
@@ -56382,35 +57404,140 @@ var PipelineSettingsStore = class PipelineSettingsStore {
|
|
|
56382
57404
|
}
|
|
56383
57405
|
catalogCache = /* @__PURE__ */ new Map();
|
|
56384
57406
|
/**
|
|
56385
|
-
*
|
|
56386
|
-
*
|
|
56387
|
-
*
|
|
56388
|
-
*
|
|
57407
|
+
* A node's `PipelineSchema`: the cached answer when fresh, else ONE live
|
|
57408
|
+
* `getSchema` RPC (bounded by the transport's request timeout, not by this
|
|
57409
|
+
* store). `null` when that read fails. Unlike {@link waitForAgentAndCatalog}
|
|
57410
|
+
* it does not retry; unlike {@link peekCatalogForAgent} it DOES wait for the
|
|
57411
|
+
* node — use the peek on any path that must never wait.
|
|
56389
57412
|
*/
|
|
56390
57413
|
async getCatalogForNode(nodeId) {
|
|
56391
57414
|
return this.getCatalogForAgent(nodeId);
|
|
56392
57415
|
}
|
|
57416
|
+
/**
|
|
57417
|
+
* The node's catalog for a LIVE eligibility read, in one of two explicit
|
|
57418
|
+
* modes (D650 round 3, bounded in the pre-ship review):
|
|
57419
|
+
* - `unbounded` — WAIT until the node's executor answers, the same
|
|
57420
|
+
* loss-proof reconcile the resolve uses ({@link awaitExecutorCatalog}).
|
|
57421
|
+
* For a FIRST placement, which will wait for this catalog to resolve its
|
|
57422
|
+
* pipeline anyway: electing against it too keeps the root guard from
|
|
57423
|
+
* failing open. `null` only when the store is disposed mid-wait.
|
|
57424
|
+
* - `one-round` — ONE reconcile round (one `getSchema`, no acquire wait).
|
|
57425
|
+
* `null` means "not answered". For a read nothing waits on — a background
|
|
57426
|
+
* refresher — where the unbounded form is a loop that outlives the node
|
|
57427
|
+
* it is asking (D3): a `getSchema` plus a 30 s acquire per round and a
|
|
57428
|
+
* WARN every round, for as long as the key is held.
|
|
57429
|
+
*/
|
|
57430
|
+
async awaitCatalogForNode(nodeId, wait) {
|
|
57431
|
+
return this.awaitExecutorCatalog(nodeId, wait === "one-round" ? { maxRounds: 1 } : {});
|
|
57432
|
+
}
|
|
57433
|
+
/**
|
|
57434
|
+
* Per-node catalog generation. {@link invalidateCatalog} bumps it; a
|
|
57435
|
+
* refresh records its answer only if the generation it started under is
|
|
57436
|
+
* still current, so a read that began BEFORE an invalidation can never
|
|
57437
|
+
* re-install the catalog the invalidation just removed.
|
|
57438
|
+
*/
|
|
57439
|
+
catalogGeneration = /* @__PURE__ */ new Map();
|
|
57440
|
+
/** Bumped by a full {@link invalidateCatalog}; part of every node's generation. */
|
|
57441
|
+
catalogEpoch = 0;
|
|
57442
|
+
catalogGenerationOf(nodeId) {
|
|
57443
|
+
return `${this.catalogEpoch}:${this.catalogGeneration.get(nodeId) ?? 0}`;
|
|
57444
|
+
}
|
|
57445
|
+
/** Nodes whose last catalog read FAILED — the warn fires once per failing stretch. */
|
|
57446
|
+
catalogReadFailing = /* @__PURE__ */ new Set();
|
|
57447
|
+
/** Nodes being served a catalog past its TTL — the warn fires once per stale stretch. */
|
|
57448
|
+
catalogServedStale = /* @__PURE__ */ new Set();
|
|
57449
|
+
/** Nodes with a background catalog refresh in flight (single-flight per node). */
|
|
57450
|
+
catalogRefreshInFlight = /* @__PURE__ */ new Set();
|
|
57451
|
+
/**
|
|
57452
|
+
* A catalog served this far past its TTL is WORTH a warn: its background
|
|
57453
|
+
* refresh has not landed in ten refresh windows. Below this, serving past
|
|
57454
|
+
* the TTL is by construction — the re-place sweep runs every 60 s against a
|
|
57455
|
+
* 30 s TTL, so every round finds the entry expired and refreshes it behind
|
|
57456
|
+
* the read — and a line per round said nothing (pre-ship review, M5).
|
|
57457
|
+
*/
|
|
57458
|
+
static CATALOG_STALE_WARN_MS = 5 * 6e4;
|
|
57459
|
+
/**
|
|
57460
|
+
* Cache-only catalog read — NEVER awaits the node (D650 round 2). Serves
|
|
57461
|
+
* the last answer the node gave, even past its TTL (a stale catalog is a
|
|
57462
|
+
* structure that was true a minute ago; its absence is a camera left
|
|
57463
|
+
* pending), and starts ONE background {@link getCatalogForAgent} when the
|
|
57464
|
+
* entry is missing or expired, so the next caller sees a fresh answer.
|
|
57465
|
+
* Returns `null` only when the node has never answered.
|
|
57466
|
+
*/
|
|
57467
|
+
peekCatalogForAgent(nodeId) {
|
|
57468
|
+
const hit = this.catalogCache.get(`${nodeId}::*`);
|
|
57469
|
+
const ageMs = hit === void 0 ? null : Date.now() - hit.at;
|
|
57470
|
+
const fresh = ageMs !== null && ageMs < PipelineSettingsStore.CATALOG_CACHE_TTL_MS;
|
|
57471
|
+
if (fresh) this.catalogServedStale.delete(nodeId);
|
|
57472
|
+
else if (ageMs !== null && ageMs >= PipelineSettingsStore.CATALOG_STALE_WARN_MS && !this.catalogServedStale.has(nodeId)) {
|
|
57473
|
+
this.catalogServedStale.add(nodeId);
|
|
57474
|
+
this.deps.logger.warn("serving a node catalog long past its TTL — its refresh has not landed", {
|
|
57475
|
+
tags: { nodeId },
|
|
57476
|
+
meta: {
|
|
57477
|
+
ageMs,
|
|
57478
|
+
ttlMs: PipelineSettingsStore.CATALOG_CACHE_TTL_MS,
|
|
57479
|
+
warnAfterMs: PipelineSettingsStore.CATALOG_STALE_WARN_MS
|
|
57480
|
+
}
|
|
57481
|
+
});
|
|
57482
|
+
}
|
|
57483
|
+
if (!fresh && !this.catalogRefreshInFlight.has(nodeId)) {
|
|
57484
|
+
this.catalogRefreshInFlight.add(nodeId);
|
|
57485
|
+
this.getCatalogForAgent(nodeId).finally(() => {
|
|
57486
|
+
this.catalogRefreshInFlight.delete(nodeId);
|
|
57487
|
+
});
|
|
57488
|
+
}
|
|
57489
|
+
return hit?.schema ?? null;
|
|
57490
|
+
}
|
|
57491
|
+
/**
|
|
57492
|
+
* How many times one {@link getCatalogForAgent} call re-reads after its
|
|
57493
|
+
* answer was fenced out by an invalidation, before it gives up (`null`, which
|
|
57494
|
+
* the callers treat as "not answered"). Invalidations come from readiness
|
|
57495
|
+
* epochs and operator resets — a bound, not a budget.
|
|
57496
|
+
*/
|
|
57497
|
+
static CATALOG_FENCE_REREADS = 3;
|
|
56393
57498
|
async getCatalogForAgent(nodeId) {
|
|
56394
57499
|
const api = this.deps.api();
|
|
56395
57500
|
if (!api) return null;
|
|
56396
57501
|
const engineKey = `${nodeId}::*`;
|
|
56397
|
-
|
|
56398
|
-
|
|
56399
|
-
|
|
56400
|
-
|
|
56401
|
-
const
|
|
56402
|
-
|
|
56403
|
-
|
|
56404
|
-
|
|
56405
|
-
})
|
|
56406
|
-
|
|
56407
|
-
|
|
56408
|
-
|
|
57502
|
+
for (let reread = 0; !this.disposed; reread++) {
|
|
57503
|
+
const now = Date.now();
|
|
57504
|
+
const hit = this.catalogCache.get(engineKey);
|
|
57505
|
+
if (hit && now - hit.at < PipelineSettingsStore.CATALOG_CACHE_TTL_MS) return hit.schema;
|
|
57506
|
+
const generation = this.catalogGenerationOf(nodeId);
|
|
57507
|
+
let schema;
|
|
57508
|
+
try {
|
|
57509
|
+
schema = await api.pipelineExecutor.getSchema.query({ nodeId });
|
|
57510
|
+
} catch (err) {
|
|
57511
|
+
if (!this.catalogReadFailing.has(nodeId)) {
|
|
57512
|
+
this.catalogReadFailing.add(nodeId);
|
|
57513
|
+
this.deps.logger.warn("node catalog read failed — placements on it wait or stay pending", {
|
|
57514
|
+
tags: { nodeId },
|
|
57515
|
+
meta: { error: errMsg$1(err) }
|
|
57516
|
+
});
|
|
57517
|
+
}
|
|
57518
|
+
return null;
|
|
57519
|
+
}
|
|
57520
|
+
if (this.catalogReadFailing.delete(nodeId)) this.deps.logger.info("node catalog read recovered", { tags: { nodeId } });
|
|
57521
|
+
if (this.catalogGenerationOf(nodeId) === generation) {
|
|
57522
|
+
this.catalogCache.set(engineKey, {
|
|
57523
|
+
schema,
|
|
57524
|
+
at: now
|
|
57525
|
+
});
|
|
57526
|
+
return schema;
|
|
57527
|
+
}
|
|
57528
|
+
if (reread >= PipelineSettingsStore.CATALOG_FENCE_REREADS) {
|
|
57529
|
+
this.deps.logger.warn("node catalog read fenced repeatedly — giving up this read", {
|
|
57530
|
+
tags: { nodeId },
|
|
57531
|
+
meta: { rereads: reread }
|
|
57532
|
+
});
|
|
57533
|
+
return null;
|
|
57534
|
+
}
|
|
57535
|
+
this.deps.logger.info("node catalog read fenced by an invalidation — re-reading", {
|
|
56409
57536
|
tags: { nodeId },
|
|
56410
|
-
meta: {
|
|
57537
|
+
meta: { reread: reread + 1 }
|
|
56411
57538
|
});
|
|
56412
|
-
return null;
|
|
56413
57539
|
}
|
|
57540
|
+
return null;
|
|
56414
57541
|
}
|
|
56415
57542
|
/**
|
|
56416
57543
|
* Consolidated catalog-cache invalidation (smell #21). Omit `nodeId` for
|
|
@@ -56422,9 +57549,11 @@ var PipelineSettingsStore = class PipelineSettingsStore {
|
|
|
56422
57549
|
*/
|
|
56423
57550
|
invalidateCatalog(nodeId) {
|
|
56424
57551
|
if (nodeId === void 0) {
|
|
57552
|
+
this.catalogEpoch++;
|
|
56425
57553
|
this.catalogCache.clear();
|
|
56426
57554
|
return;
|
|
56427
57555
|
}
|
|
57556
|
+
this.catalogGeneration.set(nodeId, (this.catalogGeneration.get(nodeId) ?? 0) + 1);
|
|
56428
57557
|
for (const key of Array.from(this.catalogCache.keys())) if (key.startsWith(`${nodeId}::`)) this.catalogCache.delete(key);
|
|
56429
57558
|
}
|
|
56430
57559
|
/**
|
|
@@ -56496,8 +57625,40 @@ var PipelineSettingsStore = class PipelineSettingsStore {
|
|
|
56496
57625
|
*
|
|
56497
57626
|
* Everything else (boot ordering, catalog cold-start, transient cap
|
|
56498
57627
|
* registration delay) loops with backoff until the catalog responds.
|
|
57628
|
+
*
|
|
57629
|
+
* `jumpDeviceKeys` (D650) are the node's OTHER enabled devices the runner
|
|
57630
|
+
* may jump a detail step to — `jumpTargetKeys(roster)` of the SAME roster the
|
|
57631
|
+
* attach carries. A detail step the elected device cannot run is kept when
|
|
57632
|
+
* one of them can; empty ⇒ the elected format alone decides.
|
|
57633
|
+
*/
|
|
57634
|
+
async resolvePipelineForDevice(deviceId, agentNodeIdOverride, deviceKey, jumpDeviceKeys = []) {
|
|
57635
|
+
const outcome = await this.resolvePipelineWithCatalog(deviceId, agentNodeIdOverride, deviceKey, jumpDeviceKeys, { kind: "await" });
|
|
57636
|
+
if (outcome.kind === "resolved") return outcome.config;
|
|
57637
|
+
throw new Error(`PipelineSettingsStore.resolvePipelineForDevice: catalog unavailable for "${outcome.nodeId}"`);
|
|
57638
|
+
}
|
|
57639
|
+
/**
|
|
57640
|
+
* {@link resolvePipelineForDevice} with the gated-on roots the elected device
|
|
57641
|
+
* cannot run (D650 round 3) — what an attach needs to refuse a camera whose
|
|
57642
|
+
* own detector would not run. Waits for the catalog exactly as it does.
|
|
57643
|
+
*/
|
|
57644
|
+
async resolvePipelineForDeviceWithRoots(deviceId, agentNodeId, deviceKey, jumpDeviceKeys) {
|
|
57645
|
+
const outcome = await this.resolvePipelineWithCatalog(deviceId, agentNodeId, deviceKey, jumpDeviceKeys, { kind: "await" });
|
|
57646
|
+
if (outcome.kind === "resolved") return outcome;
|
|
57647
|
+
throw new Error(`PipelineSettingsStore.resolvePipelineForDeviceWithRoots: catalog unavailable for "${outcome.nodeId}"`);
|
|
57648
|
+
}
|
|
57649
|
+
/**
|
|
57650
|
+
* The NON-BLOCKING sibling of {@link resolvePipelineForDevice} (D650 round
|
|
57651
|
+
* 2): the same resolution, but the node's catalog is read from the cache
|
|
57652
|
+
* only ({@link peekCatalogForAgent}). A cold or unanswering node yields
|
|
57653
|
+
* `catalog-unavailable` instead of a wait — the RETRY / re-place paths call
|
|
57654
|
+
* this, so one wedged executor can never hold a sweep (D3: no waiting for a
|
|
57655
|
+
* node; D49: never gate on a fallible read). A cold cache also starts one
|
|
57656
|
+
* background refresh, so the next retry round finds the catalog.
|
|
56499
57657
|
*/
|
|
56500
|
-
async
|
|
57658
|
+
async resolvePipelineForDeviceIfCatalogCached(deviceId, agentNodeId, deviceKey, jumpDeviceKeys) {
|
|
57659
|
+
return this.resolvePipelineWithCatalog(deviceId, agentNodeId, deviceKey, jumpDeviceKeys, { kind: "cached" });
|
|
57660
|
+
}
|
|
57661
|
+
async resolvePipelineWithCatalog(deviceId, agentNodeIdOverride, deviceKey, jumpDeviceKeys, catalogRead) {
|
|
56501
57662
|
const agentNodeId = agentNodeIdOverride ?? this.deps.getAssignmentNode(deviceId);
|
|
56502
57663
|
if (!agentNodeId) throw new Error(`PipelineSettingsStore.resolvePipelineForDevice: no node resolvable for device ${deviceId}`);
|
|
56503
57664
|
if (!await this.isDetectionPipelineActive(deviceId)) {
|
|
@@ -56509,33 +57670,57 @@ var PipelineSettingsStore = class PipelineSettingsStore {
|
|
|
56509
57670
|
meta: { reason: "detection-pipeline binding inactive" }
|
|
56510
57671
|
});
|
|
56511
57672
|
return {
|
|
56512
|
-
|
|
56513
|
-
|
|
57673
|
+
kind: "resolved",
|
|
57674
|
+
config: {
|
|
57675
|
+
steps: [],
|
|
57676
|
+
audio: null
|
|
57677
|
+
},
|
|
57678
|
+
droppedRoots: []
|
|
56514
57679
|
};
|
|
56515
57680
|
}
|
|
56516
57681
|
const hasPackageZone = await this.deps.hasPackageZone(deviceId);
|
|
56517
57682
|
const cam = (await this.readCameraSettingsMap())[String(deviceId)] ?? null;
|
|
56518
57683
|
const wholesale = cam?.pipelineByAgent?.[agentNodeId];
|
|
56519
57684
|
if (wholesale) {
|
|
56520
|
-
const catalog = await this.getCatalogForAgent(agentNodeId);
|
|
57685
|
+
const catalog = catalogRead.kind === "await" ? await this.getCatalogForAgent(agentNodeId) : this.peekCatalogForAgent(agentNodeId);
|
|
56521
57686
|
const baseSteps = catalog ? mergeEnabledByDefaultSteps(wholesale.steps, catalog) : wholesale.steps;
|
|
56522
57687
|
return {
|
|
56523
|
-
|
|
56524
|
-
|
|
56525
|
-
|
|
56526
|
-
|
|
56527
|
-
|
|
57688
|
+
kind: "resolved",
|
|
57689
|
+
droppedRoots: [],
|
|
57690
|
+
config: {
|
|
57691
|
+
steps: baseSteps.length > 0 ? applyPackageZoneActivation(baseSteps, hasPackageZone) : baseSteps,
|
|
57692
|
+
audio: wholesale.audio ? {
|
|
57693
|
+
modelId: wholesale.audio.modelId,
|
|
57694
|
+
enabled: wholesale.audio.enabled
|
|
57695
|
+
} : null
|
|
57696
|
+
}
|
|
57697
|
+
};
|
|
57698
|
+
}
|
|
57699
|
+
let catalog;
|
|
57700
|
+
if (catalogRead.kind === "await") catalog = (await this.waitForAgentAndCatalog(agentNodeId)).catalog;
|
|
57701
|
+
else {
|
|
57702
|
+
const cached = this.peekCatalogForAgent(agentNodeId);
|
|
57703
|
+
if (!cached) return {
|
|
57704
|
+
kind: "catalog-unavailable",
|
|
57705
|
+
nodeId: agentNodeId
|
|
56528
57706
|
};
|
|
57707
|
+
catalog = cached;
|
|
56529
57708
|
}
|
|
56530
|
-
const { catalog } = await this.waitForAgentAndCatalog(agentNodeId);
|
|
56531
57709
|
const deviceFormat = deviceKey ? parseDeviceKey(deviceKey).format : catalog.selectedEngine.format;
|
|
56532
|
-
const
|
|
57710
|
+
const jumpFormats = [...new Set(jumpDeviceKeys.map((k) => parseDeviceKey(k).format))];
|
|
57711
|
+
const { config: resolvedBase, skipped, droppedRoots } = resolvePipelineWithSkips(cam, agentNodeId, deviceFormat, catalog, jumpFormats);
|
|
56533
57712
|
if (skipped.length > 0) this.deps.logger.warn("pipeline steps gated on but not provisioned on this node — skipped", {
|
|
56534
57713
|
tags: {
|
|
56535
57714
|
deviceId,
|
|
56536
57715
|
nodeId: agentNodeId
|
|
56537
57716
|
},
|
|
56538
|
-
meta: {
|
|
57717
|
+
meta: {
|
|
57718
|
+
skipped: skipped.map((s) => `${s.addonId}:${s.reason}`).join(","),
|
|
57719
|
+
electedDeviceKey: deviceKey ?? null,
|
|
57720
|
+
electedFormat: deviceFormat,
|
|
57721
|
+
jumpDeviceKeys: jumpDeviceKeys.join(","),
|
|
57722
|
+
why: "no enabled device of this node the step may run on ships a build for it (a root must run on the elected device; a detail step on the elected device or a jump-roster device)"
|
|
57723
|
+
}
|
|
56539
57724
|
});
|
|
56540
57725
|
const resolved = {
|
|
56541
57726
|
...resolvedBase,
|
|
@@ -56552,7 +57737,11 @@ var PipelineSettingsStore = class PipelineSettingsStore {
|
|
|
56552
57737
|
catalogSlotCount: catalog.slots?.length ?? 0
|
|
56553
57738
|
}
|
|
56554
57739
|
});
|
|
56555
|
-
return
|
|
57740
|
+
return {
|
|
57741
|
+
kind: "resolved",
|
|
57742
|
+
config: resolved,
|
|
57743
|
+
droppedRoots
|
|
57744
|
+
};
|
|
56556
57745
|
}
|
|
56557
57746
|
/**
|
|
56558
57747
|
* Loss-proof `pipeline-executor` gate (D8 — reconcile against the
|
|
@@ -56686,6 +57875,56 @@ var PipelineSettingsStore = class PipelineSettingsStore {
|
|
|
56686
57875
|
return foldNodeStepSettings((await this.agentSettingsState.get())[nodeId]?.inferenceDevices, deviceKey);
|
|
56687
57876
|
}
|
|
56688
57877
|
/**
|
|
57878
|
+
* The provisioning SOURCES of every device an attach may run a step on
|
|
57879
|
+
* (D650): for each requested `deviceKey`, its per-(node,device) base (the
|
|
57880
|
+
* same fold as {@link buildNodeInferenceDeviceSteps}) and the camera's
|
|
57881
|
+
* override for that device (the same slot as {@link readCameraDeviceOverride}).
|
|
57882
|
+
* ONE read of each blob for the whole set — the elected device and every
|
|
57883
|
+
* jump target — instead of two reads per device. `''` is the default pool:
|
|
57884
|
+
* its base is the node's folded settings and it has no camera override.
|
|
57885
|
+
*/
|
|
57886
|
+
async readDeviceProvisioning(deviceId, nodeId, deviceKeys) {
|
|
57887
|
+
const [agentBlob, cameraMap] = await Promise.all([this.agentSettingsState.get(), this.readCameraSettingsMap()]);
|
|
57888
|
+
const devices = agentBlob[nodeId]?.inferenceDevices;
|
|
57889
|
+
const byDevice = cameraMap[String(deviceId)]?.stepOverridesByDevice?.[nodeId];
|
|
57890
|
+
const out = /* @__PURE__ */ new Map();
|
|
57891
|
+
for (const deviceKey of deviceKeys) {
|
|
57892
|
+
const override = deviceKey === "" ? void 0 : byDevice?.[deviceKey];
|
|
57893
|
+
out.set(deviceKey, {
|
|
57894
|
+
base: foldNodeStepSettings(devices, deviceKey),
|
|
57895
|
+
override: override ? { ...override } : {}
|
|
57896
|
+
});
|
|
57897
|
+
}
|
|
57898
|
+
return out;
|
|
57899
|
+
}
|
|
57900
|
+
/** `${deviceId}:${stepId}` pairs already warned by {@link warnManualJumpsLeaveOverride}. */
|
|
57901
|
+
warnedManualJumpOverride = /* @__PURE__ */ new Set();
|
|
57902
|
+
/**
|
|
57903
|
+
* WARN, once per (camera, step), that an operator `jumpDeviceKey` sends a
|
|
57904
|
+
* step off the elected device while the camera has an override for that
|
|
57905
|
+
* step ON the elected device (D650): the jumped step runs the TARGET's
|
|
57906
|
+
* provisioning, so that override is not applied when the jump is taken.
|
|
57907
|
+
*/
|
|
57908
|
+
warnManualJumpsLeaveOverride(deviceId, nodeId, electedDeviceKey, steps) {
|
|
57909
|
+
for (const { stepId, jumpDeviceKey } of steps) {
|
|
57910
|
+
const key = `${deviceId}:${stepId}`;
|
|
57911
|
+
if (this.warnedManualJumpOverride.has(key)) continue;
|
|
57912
|
+
this.warnedManualJumpOverride.add(key);
|
|
57913
|
+
this.deps.logger.warn("manual jumpDeviceKey leaves an elected-device override behind — the jumped step runs the target device provisioning", {
|
|
57914
|
+
tags: {
|
|
57915
|
+
deviceId,
|
|
57916
|
+
nodeId
|
|
57917
|
+
},
|
|
57918
|
+
meta: {
|
|
57919
|
+
step: stepId,
|
|
57920
|
+
electedDeviceKey,
|
|
57921
|
+
jumpDeviceKey,
|
|
57922
|
+
hint: `move the camera's override for ${stepId} to ${jumpDeviceKey}, or drop the jumpDeviceKey`
|
|
57923
|
+
}
|
|
57924
|
+
});
|
|
57925
|
+
}
|
|
57926
|
+
}
|
|
57927
|
+
/**
|
|
56689
57928
|
* Structural runtime check for `CameraPipelineConfig`. Persisted JSON
|
|
56690
57929
|
* may be stale or partial across upgrades, so we gate reads on shape
|
|
56691
57930
|
* rather than trusting the raw object. False = silently ignore that
|
|
@@ -57475,7 +58714,7 @@ var ReconcileController = class ReconcileController {
|
|
|
57475
58714
|
const cfg = this.deps.ledger.getConfig(deviceId);
|
|
57476
58715
|
if (!cfg) continue;
|
|
57477
58716
|
try {
|
|
57478
|
-
const result = await this.deps.
|
|
58717
|
+
const result = await this.deps.redispatchCamera(cfg);
|
|
57479
58718
|
retried++;
|
|
57480
58719
|
if (result.kind === "pending") stillPending++;
|
|
57481
58720
|
} catch (err) {
|
|
@@ -57586,7 +58825,7 @@ var ReconcileController = class ReconcileController {
|
|
|
57586
58825
|
});
|
|
57587
58826
|
});
|
|
57588
58827
|
this.deps.ledger.dropAssignment(deviceId, "silent");
|
|
57589
|
-
await this.deps.
|
|
58828
|
+
await this.deps.redispatchCamera(cfg).catch((err) => {
|
|
57590
58829
|
this.deps.logger.warn("remote-health re-dispatch failed", {
|
|
57591
58830
|
tags: { deviceId },
|
|
57592
58831
|
meta: { error: errMsg$1(err) }
|
|
@@ -58069,7 +59308,7 @@ var TtlMemo = class {
|
|
|
58069
59308
|
});
|
|
58070
59309
|
if (entry && at - entry.readAt < this.ttlMs) return entry.value;
|
|
58071
59310
|
try {
|
|
58072
|
-
return await this.read(key);
|
|
59311
|
+
return await this.read(key, "miss");
|
|
58073
59312
|
} catch (err) {
|
|
58074
59313
|
if (entry) return entry.value;
|
|
58075
59314
|
throw err;
|
|
@@ -58101,7 +59340,7 @@ var TtlMemo = class {
|
|
|
58101
59340
|
ageMs: at - entry.readAt
|
|
58102
59341
|
};
|
|
58103
59342
|
const fallback = this.lastKnown.get(key);
|
|
58104
|
-
const pending = this.read(key);
|
|
59343
|
+
const pending = this.read(key, "miss");
|
|
58105
59344
|
if (fallback === void 0) return {
|
|
58106
59345
|
value: await pending,
|
|
58107
59346
|
stale: false,
|
|
@@ -58140,7 +59379,7 @@ var TtlMemo = class {
|
|
|
58140
59379
|
* is what re-warms a key immediately after {@link invalidate}.
|
|
58141
59380
|
*/
|
|
58142
59381
|
async refresh(key) {
|
|
58143
|
-
await this.read(key).catch(() => void 0);
|
|
59382
|
+
await this.read(key, "refresh").catch(() => void 0);
|
|
58144
59383
|
}
|
|
58145
59384
|
/**
|
|
58146
59385
|
* Re-read every key still in use and drop the ones nobody has asked for in
|
|
@@ -58166,12 +59405,16 @@ var TtlMemo = class {
|
|
|
58166
59405
|
this.generations.clear();
|
|
58167
59406
|
this.lastKnown.clear();
|
|
58168
59407
|
}
|
|
58169
|
-
/**
|
|
58170
|
-
read
|
|
59408
|
+
/**
|
|
59409
|
+
* One shared in-flight read per key; stores the result on success. A
|
|
59410
|
+
* refresh that finds a miss's read in flight joins it — the waiting caller
|
|
59411
|
+
* chose to wait, and the refresher never awaits the promise it is handed.
|
|
59412
|
+
*/
|
|
59413
|
+
read(key, mode) {
|
|
58171
59414
|
const existing = this.inFlight.get(key);
|
|
58172
59415
|
if (existing) return existing;
|
|
58173
59416
|
const generation = this.generations.get(key) ?? 0;
|
|
58174
|
-
const pending = this.opts.load(key).then((value) => {
|
|
59417
|
+
const pending = this.opts.load(key, mode).then((value) => {
|
|
58175
59418
|
const at = this.now();
|
|
58176
59419
|
const stored = {
|
|
58177
59420
|
value,
|
|
@@ -58365,6 +59608,23 @@ var SessionDispatchController = class {
|
|
|
58365
59608
|
*/
|
|
58366
59609
|
motionWatchByDevice = /* @__PURE__ */ new Map();
|
|
58367
59610
|
/**
|
|
59611
|
+
* The last session REFUSAL per camera (D650 rounds 3–4): the elected device
|
|
59612
|
+
* could not run the camera root, so no session opened and nothing was
|
|
59613
|
+
* recorded. Two readers:
|
|
59614
|
+
* - the refusal line fires once per CHANGE of this entry, not on every
|
|
59615
|
+
* motion edge (a camera re-elected onto the same device every few
|
|
59616
|
+
* seconds is one fact, not a log storm);
|
|
59617
|
+
* - the camera status reads it through {@link refusalReason} and shows
|
|
59618
|
+
* `pending:<reason>` in `reasons.detection`, where a STANDING camera's
|
|
59619
|
+
* pending reason already appears — an armed camera whose every session
|
|
59620
|
+
* is refused must not look like a healthy one waiting for motion.
|
|
59621
|
+
* Deliberately NOT the ledger's `pendingReasons`: an entry there counts as a
|
|
59622
|
+
* standing attach in {@link handleSessionMotion} and would freeze the camera
|
|
59623
|
+
* idle — the trap `isIdleSessionCamera` (index.ts) flags. Cleared when a
|
|
59624
|
+
* session opens and when the camera's detection is stopped.
|
|
59625
|
+
*/
|
|
59626
|
+
sessionRefusals = /* @__PURE__ */ new Map();
|
|
59627
|
+
/**
|
|
58368
59628
|
* Per-device wall-clock of the last frame on which the tracker still had a
|
|
58369
59629
|
* subject — ANY tracked object, moving or stopped — while a session was
|
|
58370
59630
|
* active. The session-hold's only liveness input.
|
|
@@ -58385,6 +59645,15 @@ var SessionDispatchController = class {
|
|
|
58385
59645
|
*/
|
|
58386
59646
|
lastSubjectSeenAt = /* @__PURE__ */ new Map();
|
|
58387
59647
|
/**
|
|
59648
|
+
* Per-device count of objects the TRACKER held on the last tracked frame of
|
|
59649
|
+
* the active session — moving OR still (D652). Diagnostics only: it decides
|
|
59650
|
+
* nothing. {@link lastSubjectSeenAt} is presence as the HOLD sees it, which
|
|
59651
|
+
* the producer's stillness valve deliberately subtracts a still subject from;
|
|
59652
|
+
* this is what lets a close say whether it ended tracks the tracker still
|
|
59653
|
+
* had. Fed by {@link noteTrackedFrame}; pruned with the session.
|
|
59654
|
+
*/
|
|
59655
|
+
lastLiveTrackCount = /* @__PURE__ */ new Map();
|
|
59656
|
+
/**
|
|
58388
59657
|
* Per-device count of "motion refired while the session was already
|
|
58389
59658
|
* active" no-ops since the current session was dispatched. Drives the
|
|
58390
59659
|
* SAMPLED debug line in the dispatch path: on a busy camera the refire
|
|
@@ -58410,7 +59679,7 @@ var SessionDispatchController = class {
|
|
|
58410
59679
|
agentLoads = new TtlMemo({ load: () => this.deps.loadService.collectAgentLoad({ onlyEnabled: true }) });
|
|
58411
59680
|
nodeCaps = new TtlMemo({ load: () => this.deps.settingsStore.buildNodeCaps() });
|
|
58412
59681
|
nodeWeights = new TtlMemo({ load: () => this.deps.settingsStore.buildNodeWeights() });
|
|
58413
|
-
eligibleInferenceDevices = new TtlMemo({ load: (nodeId) => this.deps.getEligibleInferenceDevices(nodeId) });
|
|
59682
|
+
eligibleInferenceDevices = new TtlMemo({ load: (nodeId, read) => this.deps.getEligibleInferenceDevices(nodeId, read === "refresh" ? "one-round" : "await-catalog") });
|
|
58414
59683
|
inferenceDeviceCaps = new TtlMemo({ load: (nodeId) => this.deps.getInferenceDeviceCaps(nodeId) });
|
|
58415
59684
|
/** Background refresher for {@link agentLoads} et al. Null until first use. */
|
|
58416
59685
|
balancerRefreshTimer = null;
|
|
@@ -58505,6 +59774,17 @@ var SessionDispatchController = class {
|
|
|
58505
59774
|
this.lastSubjectSeenAt.set(deviceId, at);
|
|
58506
59775
|
}
|
|
58507
59776
|
/**
|
|
59777
|
+
* Record how many objects the tracker held on this frame — the count the
|
|
59778
|
+
* close line reports as `liveTracks` (D652). Every tracked frame, not only
|
|
59779
|
+
* the ones that hold the session: a still subject is exactly the case that
|
|
59780
|
+
* stops holding it. No-op without an active session, which also bounds the
|
|
59781
|
+
* map. Telemetry-lossy (D8): a dropped frame leaves the previous count.
|
|
59782
|
+
*/
|
|
59783
|
+
noteTrackedFrame(deviceId, liveTrackCount) {
|
|
59784
|
+
if (!this.sessionRegistry.has(deviceId)) return;
|
|
59785
|
+
this.lastLiveTrackCount.set(deviceId, liveTrackCount);
|
|
59786
|
+
}
|
|
59787
|
+
/**
|
|
58508
59788
|
* `sessionRegistry.has(deviceId)` — the closure other controllers (Task 3's
|
|
58509
59789
|
* standing-machinery guards, `index.ts`'s `isIdleSessionCamera`) consume
|
|
58510
59790
|
* instead of reaching into `sessionRegistry` directly.
|
|
@@ -58551,6 +59831,7 @@ var SessionDispatchController = class {
|
|
|
58551
59831
|
this.deps.dropAssignment(deviceId, "silent");
|
|
58552
59832
|
this.sessionRegistry.deregister(deviceId);
|
|
58553
59833
|
this.lastSubjectSeenAt.delete(deviceId);
|
|
59834
|
+
this.lastLiveTrackCount.delete(deviceId);
|
|
58554
59835
|
this.notePlacementChanged();
|
|
58555
59836
|
});
|
|
58556
59837
|
}
|
|
@@ -58789,11 +60070,34 @@ var SessionDispatchController = class {
|
|
|
58789
60070
|
}
|
|
58790
60071
|
});
|
|
58791
60072
|
const deviceSelectedAt = Date.now();
|
|
58792
|
-
const
|
|
58793
|
-
|
|
58794
|
-
|
|
58795
|
-
|
|
58796
|
-
|
|
60073
|
+
const outcome = await resolveAttachPipeline({
|
|
60074
|
+
deviceId,
|
|
60075
|
+
nodeId: targetNodeId,
|
|
60076
|
+
deviceKey,
|
|
60077
|
+
eligible: enabledDevices,
|
|
60078
|
+
caps: deviceCaps
|
|
60079
|
+
}, this.deps.settingsStore);
|
|
60080
|
+
if (outcome.kind === "root-refused") {
|
|
60081
|
+
const reason = `root-unrunnable:${targetNodeId}/${outcome.deviceKey ?? "default-pool"}`;
|
|
60082
|
+
if (this.sessionRefusals.get(deviceId) !== reason) {
|
|
60083
|
+
this.sessionRefusals.set(deviceId, reason);
|
|
60084
|
+
log.error("detection session refused — the elected device cannot run the camera root", {
|
|
60085
|
+
tags: {
|
|
60086
|
+
deviceId,
|
|
60087
|
+
nodeId: targetNodeId
|
|
60088
|
+
},
|
|
60089
|
+
meta: {
|
|
60090
|
+
reason,
|
|
60091
|
+
deviceKey: outcome.deviceKey ?? null,
|
|
60092
|
+
droppedRoots: outcome.droppedRoots.join(","),
|
|
60093
|
+
hint: "the root is never jumped: enable a device on this node whose format ships the root model, or disable the device that cannot; said once until the refusal changes"
|
|
60094
|
+
}
|
|
60095
|
+
});
|
|
60096
|
+
}
|
|
60097
|
+
releaseGuard();
|
|
60098
|
+
return null;
|
|
60099
|
+
}
|
|
60100
|
+
const pipeline = outcome.pipeline;
|
|
58797
60101
|
const zones = await this.deps.listZones(deviceId);
|
|
58798
60102
|
const sessionDetectionFps = detectionFpsForTrigger(config, trigger);
|
|
58799
60103
|
if (sessionDetectionFps !== config.detectionFps) log.info("session opened at the device-activity rate", { meta: {
|
|
@@ -58803,8 +60107,8 @@ var SessionDispatchController = class {
|
|
|
58803
60107
|
} });
|
|
58804
60108
|
const sessionConfig = {
|
|
58805
60109
|
deviceId,
|
|
58806
|
-
...deviceKey ? { deviceKey } : {},
|
|
58807
|
-
...inferenceDevices ? { inferenceDevices } : {},
|
|
60110
|
+
...pipeline.deviceKey ? { deviceKey: pipeline.deviceKey } : {},
|
|
60111
|
+
...pipeline.inferenceDevices ? { inferenceDevices: pipeline.inferenceDevices } : {},
|
|
58808
60112
|
motionCooldownMs: config.motionCooldownMs,
|
|
58809
60113
|
motionFps: config.motionFps,
|
|
58810
60114
|
detectionFps: sessionDetectionFps,
|
|
@@ -58812,8 +60116,8 @@ var SessionDispatchController = class {
|
|
|
58812
60116
|
detectionStreamId: config.detectionStreamId,
|
|
58813
60117
|
motionSources: [],
|
|
58814
60118
|
pipelineEnabled: config.pipelineEnabled,
|
|
58815
|
-
steps,
|
|
58816
|
-
audio:
|
|
60119
|
+
steps: pipeline.steps,
|
|
60120
|
+
audio: pipeline.audio,
|
|
58817
60121
|
zones,
|
|
58818
60122
|
detectionMode: "always-on",
|
|
58819
60123
|
audioMode: config.audioMode,
|
|
@@ -58832,6 +60136,13 @@ var SessionDispatchController = class {
|
|
|
58832
60136
|
attachedAt = Date.now();
|
|
58833
60137
|
this.deps.recordAssignment(deviceId, targetNodeId, decision.reason, decision.reason === "manual");
|
|
58834
60138
|
this.sessionRegistry.register(deviceId, targetNodeId, Date.now(), deviceKey);
|
|
60139
|
+
if (this.sessionRefusals.delete(deviceId)) log.info("detection session refusal cleared — a session opened", {
|
|
60140
|
+
tags: {
|
|
60141
|
+
deviceId,
|
|
60142
|
+
nodeId: targetNodeId
|
|
60143
|
+
},
|
|
60144
|
+
meta: deviceKey ? { deviceKey } : {}
|
|
60145
|
+
});
|
|
58835
60146
|
this.recheck?.noteSessionDispatched(deviceId, targetNodeId, sessionConfig);
|
|
58836
60147
|
log.info("detection session: dispatched on motion", {
|
|
58837
60148
|
tags: {
|
|
@@ -58840,9 +60151,7 @@ var SessionDispatchController = class {
|
|
|
58840
60151
|
},
|
|
58841
60152
|
meta: {
|
|
58842
60153
|
reason: decision.reason,
|
|
58843
|
-
...deviceKey ? { deviceKey } : {}
|
|
58844
|
-
...Object.keys(deviceBase).length > 0 ? { deviceBase } : {},
|
|
58845
|
-
...Object.keys(deviceOverride).length > 0 ? { deviceOverride } : {}
|
|
60154
|
+
...deviceKey ? { deviceKey } : {}
|
|
58846
60155
|
}
|
|
58847
60156
|
});
|
|
58848
60157
|
} finally {
|
|
@@ -59006,6 +60315,8 @@ var SessionDispatchController = class {
|
|
|
59006
60315
|
this.deps.dropAssignment(deviceId, "unassigned");
|
|
59007
60316
|
this.sessionRegistry.deregister(deviceId);
|
|
59008
60317
|
this.lastSubjectSeenAt.delete(deviceId);
|
|
60318
|
+
const liveTracks = this.lastLiveTrackCount.get(deviceId) ?? null;
|
|
60319
|
+
this.lastLiveTrackCount.delete(deviceId);
|
|
59009
60320
|
this.activeRefireCountByDevice.delete(deviceId);
|
|
59010
60321
|
this.notePlacementChanged();
|
|
59011
60322
|
const { openForMs, sinceSubjectSeenMs, maxHoldMs } = observed;
|
|
@@ -59016,6 +60327,7 @@ var SessionDispatchController = class {
|
|
|
59016
60327
|
openForMs,
|
|
59017
60328
|
sinceSubjectSeenMs,
|
|
59018
60329
|
subjectPresent,
|
|
60330
|
+
liveTracks,
|
|
59019
60331
|
maxHoldMs,
|
|
59020
60332
|
minOpenMs: MIN_SESSION_OPEN_MS,
|
|
59021
60333
|
subjectStaleMs: SUBJECT_PRESENT_STALE_MS
|
|
@@ -59027,6 +60339,17 @@ var SessionDispatchController = class {
|
|
|
59027
60339
|
});
|
|
59028
60340
|
return;
|
|
59029
60341
|
}
|
|
60342
|
+
if (liveTracks !== null && liveTracks > 0) {
|
|
60343
|
+
const designedValve = sinceSubjectSeenMs !== null;
|
|
60344
|
+
const line = reason === "motion_cleared" ? "detection session: closed on motion clear while the tracker was still tracking a subject — its live tracks end here" : "detection session: closed after motion cooldown while the tracker was still tracking a subject — its live tracks end here";
|
|
60345
|
+
const extras = {
|
|
60346
|
+
tags: { nodeId: session.nodeId },
|
|
60347
|
+
meta
|
|
60348
|
+
};
|
|
60349
|
+
if (designedValve) log.info(line, extras);
|
|
60350
|
+
else log.warn(line, extras);
|
|
60351
|
+
return;
|
|
60352
|
+
}
|
|
59030
60353
|
log.info(reason === "motion_cleared" ? "detection session: closed on motion clear" : "detection session: closed after motion cooldown", {
|
|
59031
60354
|
tags: { nodeId: session.nodeId },
|
|
59032
60355
|
meta
|
|
@@ -59072,6 +60395,14 @@ var SessionDispatchController = class {
|
|
|
59072
60395
|
* down too, since it reads `sessionRegistry` fresh at the top of this same
|
|
59073
60396
|
* callback).
|
|
59074
60397
|
*/
|
|
60398
|
+
/**
|
|
60399
|
+
* Why this camera's LAST on-motion session was refused, or `undefined` when
|
|
60400
|
+
* it was not (or a session has opened since). The camera status renders it
|
|
60401
|
+
* as `pending:<reason>` — see `sessionRefusals`.
|
|
60402
|
+
*/
|
|
60403
|
+
refusalReason(deviceId) {
|
|
60404
|
+
return this.sessionRefusals.get(deviceId);
|
|
60405
|
+
}
|
|
59075
60406
|
async stopForDevice(deviceId) {
|
|
59076
60407
|
await this.sessionLocks.run(deviceId, async () => {
|
|
59077
60408
|
const session = this.sessionRegistry.get(deviceId);
|
|
@@ -59091,6 +60422,8 @@ var SessionDispatchController = class {
|
|
|
59091
60422
|
}
|
|
59092
60423
|
this.deps.dropActiveDetection(deviceId);
|
|
59093
60424
|
this.lastSubjectSeenAt.delete(deviceId);
|
|
60425
|
+
this.lastLiveTrackCount.delete(deviceId);
|
|
60426
|
+
this.sessionRefusals.delete(deviceId);
|
|
59094
60427
|
this.recheck?.forget(deviceId);
|
|
59095
60428
|
});
|
|
59096
60429
|
const watchNodeId = this.motionWatchByDevice.get(deviceId);
|
|
@@ -59131,6 +60464,8 @@ var SessionDispatchController = class {
|
|
|
59131
60464
|
this.sessionRegistry.clear();
|
|
59132
60465
|
this.motionWatchByDevice.clear();
|
|
59133
60466
|
this.lastSubjectSeenAt.clear();
|
|
60467
|
+
this.lastLiveTrackCount.clear();
|
|
60468
|
+
this.sessionRefusals.clear();
|
|
59134
60469
|
if (this.balancerRefreshTimer !== null) {
|
|
59135
60470
|
clearInterval(this.balancerRefreshTimer);
|
|
59136
60471
|
this.balancerRefreshTimer = null;
|
|
@@ -60100,7 +61435,8 @@ async function buildOrchestratorControllers(deps) {
|
|
|
60100
61435
|
watchdog: () => pipelineWatchdog,
|
|
60101
61436
|
localNodeId: () => localNodeId,
|
|
60102
61437
|
readPipelinePin: (deviceId) => deps.readPipelinePin(deviceId),
|
|
60103
|
-
getEligibleInferenceDevices: (nodeId) => deps.getEligibleInferenceDevices(nodeId),
|
|
61438
|
+
getEligibleInferenceDevices: (nodeId) => deps.getEligibleInferenceDevices(nodeId, "await-catalog"),
|
|
61439
|
+
getEligibleInferenceDevicesIfCached: (nodeId) => deps.getEligibleInferenceDevicesIfCached(nodeId),
|
|
60104
61440
|
isNodeInferenceUsable: (nodeId) => deps.isNodeInferenceUsable(nodeId),
|
|
60105
61441
|
getInferenceDeviceCaps: (nodeId) => deps.getInferenceDeviceCaps(nodeId),
|
|
60106
61442
|
readPipelineDevicePin: (deviceId) => deps.readPipelineDevicePin(deviceId),
|
|
@@ -60136,7 +61472,7 @@ async function buildOrchestratorControllers(deps) {
|
|
|
60136
61472
|
},
|
|
60137
61473
|
listZones: async (deviceId) => await zonesProvider?.listZones({ deviceId }) ?? [],
|
|
60138
61474
|
readPipelinePin: (deviceId) => deps.readPipelinePin(deviceId),
|
|
60139
|
-
getEligibleInferenceDevices: (nodeId) => deps.getEligibleInferenceDevices(nodeId),
|
|
61475
|
+
getEligibleInferenceDevices: (nodeId, read) => deps.getEligibleInferenceDevices(nodeId, read),
|
|
60140
61476
|
isNodeInferenceUsable: (nodeId) => deps.isNodeInferenceUsable(nodeId),
|
|
60141
61477
|
getInferenceDeviceCaps: (nodeId) => deps.getInferenceDeviceCaps(nodeId),
|
|
60142
61478
|
readPipelineDevicePin: (deviceId) => deps.readPipelineDevicePin(deviceId),
|
|
@@ -60179,7 +61515,7 @@ async function buildOrchestratorControllers(deps) {
|
|
|
60179
61515
|
getAudioAssignment: (deviceId) => audio.getAssignment(deviceId),
|
|
60180
61516
|
getCameraConfig: (deviceId) => ledger.getConfig(deviceId),
|
|
60181
61517
|
hasCameraConfig: (deviceId) => ledger.hasConfig(deviceId),
|
|
60182
|
-
getPendingReason: (deviceId) => ledger.getPendingReason(deviceId),
|
|
61518
|
+
getPendingReason: (deviceId) => ledger.getPendingReason(deviceId) ?? session.refusalReason(deviceId),
|
|
60183
61519
|
assignSource: (deviceId) => topology.assignSource(deviceId),
|
|
60184
61520
|
listAssignedDeviceIds: () => [...new Set([...ledger.listAssignedDeviceIds(), ...detectionWiring.activeDeviceIds()])],
|
|
60185
61521
|
isSessionCamera: (deviceId) => deps.isSessionCamera(deviceId),
|
|
@@ -60197,7 +61533,7 @@ async function buildOrchestratorControllers(deps) {
|
|
|
60197
61533
|
logger: deps.ctx().logger,
|
|
60198
61534
|
handleDeviceRegistered: (deviceId) => deps.handleDeviceRegistered(deviceId),
|
|
60199
61535
|
handleDeviceUnregistered: (deviceId) => deps.handleDeviceUnregistered(deviceId),
|
|
60200
|
-
|
|
61536
|
+
redispatchCamera: (config) => placement.redispatchCamera(config),
|
|
60201
61537
|
detachOn: (nodeId, deviceId) => deps.detachOn(nodeId, deviceId),
|
|
60202
61538
|
localNodeId: () => localNodeId,
|
|
60203
61539
|
activeDeviceIds: () => detectionWiring.activeDeviceIds(),
|
|
@@ -60227,6 +61563,7 @@ async function buildOrchestratorControllers(deps) {
|
|
|
60227
61563
|
loadService,
|
|
60228
61564
|
settingsStore,
|
|
60229
61565
|
attachOn: (nodeId, config) => deps.attachOn(nodeId, config),
|
|
61566
|
+
resolveAttachPipeline: (input) => placement.resolveAttachPipelineOnDevice(input),
|
|
60230
61567
|
rebalance: (opts) => deps.rebalance(opts),
|
|
60231
61568
|
scheduleReconcile: () => reconcile.scheduleReconcile(),
|
|
60232
61569
|
schedulePendingRetry: () => reconcile.schedulePendingRetry(),
|
|
@@ -60245,6 +61582,7 @@ async function buildOrchestratorControllers(deps) {
|
|
|
60245
61582
|
if (!nodeId.includes("/")) topology.removeKnownRunnerNode(nodeId);
|
|
60246
61583
|
nodeLifecycle.unsubscribeDetectionPipelineReadiness(nodeId);
|
|
60247
61584
|
audio.markNodeOffline(nodeId);
|
|
61585
|
+
deps.forgetInferenceDeviceProbe(nodeId);
|
|
60248
61586
|
nodeLifecycle.handleNodeDisconnect(nodeId).catch((err) => {
|
|
60249
61587
|
const msg = errMsg$1(err);
|
|
60250
61588
|
deps.ctx().logger.error("failover after disconnect failed", {
|
|
@@ -60360,26 +61698,12 @@ async function buildOrchestratorControllers(deps) {
|
|
|
60360
61698
|
fetchDevice: (deviceId) => deps.ctx().fetchDevice(deviceId),
|
|
60361
61699
|
onRulesChanged: (deviceId, stage) => {
|
|
60362
61700
|
if (stage !== "package") return;
|
|
60363
|
-
|
|
60364
|
-
|
|
60365
|
-
|
|
60366
|
-
|
|
60367
|
-
|
|
60368
|
-
|
|
60369
|
-
steps: resolved.steps,
|
|
60370
|
-
audio: resolved.audio ?? null
|
|
60371
|
-
};
|
|
60372
|
-
ledger.setConfig(deviceId, next);
|
|
60373
|
-
return deps.attachOn(assignment.agentNodeId, next);
|
|
60374
|
-
}).catch((err) => {
|
|
60375
|
-
deps.ctx().logger.warn("package zone-rule change re-dispatch failed", {
|
|
60376
|
-
tags: {
|
|
60377
|
-
deviceId,
|
|
60378
|
-
nodeId: assignment.agentNodeId
|
|
60379
|
-
},
|
|
60380
|
-
meta: { error: errMsg$1(err) }
|
|
60381
|
-
});
|
|
60382
|
-
});
|
|
61701
|
+
reattachAfterPackageZoneChange({
|
|
61702
|
+
ledger,
|
|
61703
|
+
resolveAttachPipeline: (input) => placement.resolveAttachPipelineOnDevice(input),
|
|
61704
|
+
attachOn: (nodeId, config) => deps.attachOn(nodeId, config),
|
|
61705
|
+
logger: deps.ctx().logger
|
|
61706
|
+
}, deviceId);
|
|
60383
61707
|
}
|
|
60384
61708
|
});
|
|
60385
61709
|
zoneRulesProviderRef = zoneRulesProvider;
|
|
@@ -60443,6 +61767,7 @@ async function buildOrchestratorControllers(deps) {
|
|
|
60443
61767
|
getActiveDetectionConfig: (deviceId) => detectionWiring.getActiveDetectionConfig(deviceId),
|
|
60444
61768
|
handleSessionMotion: (deviceId, detected, emittedAt) => session.handleSessionMotion(deviceId, detected, emittedAt),
|
|
60445
61769
|
noteSessionSubjectPresent: (deviceId) => session.noteSubjectPresent(deviceId),
|
|
61770
|
+
noteSessionTrackedFrame: (deviceId, liveTrackCount) => session.noteTrackedFrame(deviceId, liveTrackCount),
|
|
60446
61771
|
noteWatchdogSignal: (deviceId, stage) => pipelineWatchdog?.noteSignal(deviceId, stage)
|
|
60447
61772
|
});
|
|
60448
61773
|
reconcile.scheduleReconcile();
|
|
@@ -61167,6 +62492,15 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
61167
62492
|
/** This node's Moleculer nodeId (from this.ctx.kernel.localNodeId). */
|
|
61168
62493
|
localNodeId = "hub";
|
|
61169
62494
|
/**
|
|
62495
|
+
* A shutdown latch for {@link getClusterModelChoice} (D651): cleared on the
|
|
62496
|
+
* first line of `onShutdown`, so an owner that is tearing down stops
|
|
62497
|
+
* answering. Set at the end of `onInitialize`; it is also false before that,
|
|
62498
|
+
* but nothing can call the method then — the cap provider is registered
|
|
62499
|
+
* from what `onInitialize` RETURNS, so the pre-init state is unreachable and
|
|
62500
|
+
* not a claim this flag makes.
|
|
62501
|
+
*/
|
|
62502
|
+
clusterModelChoiceReady = false;
|
|
62503
|
+
/**
|
|
61170
62504
|
* Single owner of the shared placement state (`assignments`/`cameraConfigs`/
|
|
61171
62505
|
* `pendingReasons`/`dispatchingDevices`) — see `placement-ledger.ts` (S6
|
|
61172
62506
|
* extraction). Constructed FIRST in `onInitialize` (several other
|
|
@@ -61411,7 +62745,9 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
61411
62745
|
attachOn: (nodeId, config) => this.attachOn(nodeId, config),
|
|
61412
62746
|
detachOn: (nodeId, deviceId) => this.detachOn(nodeId, deviceId),
|
|
61413
62747
|
readPipelinePin: (deviceId) => this.readPipelinePin(deviceId),
|
|
61414
|
-
getEligibleInferenceDevices: (nodeId) => this.resolveEligibleInferenceDevices(nodeId),
|
|
62748
|
+
getEligibleInferenceDevices: (nodeId, read) => this.resolveEligibleInferenceDevices(nodeId, read),
|
|
62749
|
+
getEligibleInferenceDevicesIfCached: (nodeId) => this.resolveEligibleInferenceDevicesIfCached(nodeId),
|
|
62750
|
+
forgetInferenceDeviceProbe: (nodeId) => this.forgetInferenceDeviceProbe(nodeId),
|
|
61415
62751
|
isNodeInferenceUsable: (nodeId) => this.isNodeInferenceUsable(nodeId),
|
|
61416
62752
|
getInferenceDeviceCaps: (nodeId) => this.getInferenceDeviceCaps(nodeId),
|
|
61417
62753
|
readPipelineDevicePin: (deviceId) => this.readPipelineDevicePin(deviceId),
|
|
@@ -61438,7 +62774,6 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
61438
62774
|
state: this.state.bind(this),
|
|
61439
62775
|
rebalance: (opts) => this.rebalance(opts),
|
|
61440
62776
|
setCameraPipelineForAgent: (input) => this.setCameraPipelineForAgent(input),
|
|
61441
|
-
dispatchCamera: (config) => this.dispatchCamera(config),
|
|
61442
62777
|
maintenancePaused: () => this.storageMigrationLeaseId !== null,
|
|
61443
62778
|
setTopology: (topology) => {
|
|
61444
62779
|
this.topology = topology;
|
|
@@ -61483,6 +62818,8 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
61483
62818
|
this.autoRebalanceTimer = controllers.autoRebalanceTimer;
|
|
61484
62819
|
this.nodeStressLts = controllers.nodeStressLts;
|
|
61485
62820
|
this.nodeStressLtsTimer = controllers.nodeStressLtsTimer;
|
|
62821
|
+
const widgetsProvider = { listWidgets: async () => pipelineOrchestratorWidgets };
|
|
62822
|
+
this.clusterModelChoiceReady = true;
|
|
61486
62823
|
return {
|
|
61487
62824
|
providers: [
|
|
61488
62825
|
{
|
|
@@ -61503,7 +62840,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
61503
62840
|
},
|
|
61504
62841
|
{
|
|
61505
62842
|
capability: addonWidgetsSourceCapability,
|
|
61506
|
-
provider:
|
|
62843
|
+
provider: widgetsProvider
|
|
61507
62844
|
},
|
|
61508
62845
|
{
|
|
61509
62846
|
capability: viewerUiCapability,
|
|
@@ -61552,6 +62889,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
61552
62889
|
};
|
|
61553
62890
|
}
|
|
61554
62891
|
async onShutdown() {
|
|
62892
|
+
this.clusterModelChoiceReady = false;
|
|
61555
62893
|
this.audio.beginShutdown();
|
|
61556
62894
|
this.session.shutdown();
|
|
61557
62895
|
if (this.pendingRetryTimer !== null) {
|
|
@@ -61697,6 +63035,16 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
61697
63035
|
* a server restart that rehydrates assignments from disk without
|
|
61698
63036
|
* re-dispatching).
|
|
61699
63037
|
*/
|
|
63038
|
+
/**
|
|
63039
|
+
* The operator's stored model choice for a cluster-scoped step (D651).
|
|
63040
|
+
* Answers `owner-not-ready` from the first line of `onShutdown`: an owner
|
|
63041
|
+
* that is tearing down must not answer at all. (Before `onInitialize`
|
|
63042
|
+
* returns nobody can reach this method — see `clusterModelChoiceReady`.)
|
|
63043
|
+
*/
|
|
63044
|
+
async getClusterModelChoice(input) {
|
|
63045
|
+
if (!this.clusterModelChoiceReady) return decideClusterModelChoice(input.stepId, "owner-not-ready");
|
|
63046
|
+
return decideClusterModelChoice(input.stepId, await this.readStoredGlobalKey(clusterModelSettingKey(input.stepId)));
|
|
63047
|
+
}
|
|
61700
63048
|
async getAgentLoad() {
|
|
61701
63049
|
await this.loadService.refreshDecodeHwaccels();
|
|
61702
63050
|
await this.loadService.collectAgentLoad();
|
|
@@ -61813,6 +63161,14 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
61813
63161
|
async evaluateRemoteAssignmentHealth() {
|
|
61814
63162
|
return this.reconcile.evaluateRemoteAssignmentHealth();
|
|
61815
63163
|
}
|
|
63164
|
+
/**
|
|
63165
|
+
* Thin seam onto `ReconcileController.retryPendingDispatches` — the same
|
|
63166
|
+
* `protected` pattern, for `pending-retry-catalog-wedge.spec.ts` to run one
|
|
63167
|
+
* sweep and bound it.
|
|
63168
|
+
*/
|
|
63169
|
+
async retryPendingDispatches() {
|
|
63170
|
+
return this.reconcile.retryPendingDispatches();
|
|
63171
|
+
}
|
|
61816
63172
|
async getCapabilityBindings(input) {
|
|
61817
63173
|
if (!this.ctx?.settings) return {};
|
|
61818
63174
|
return this.settingsStore.getCapabilityBindings(input.nodeId);
|
|
@@ -61895,6 +63251,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
61895
63251
|
success: true,
|
|
61896
63252
|
removed: false
|
|
61897
63253
|
};
|
|
63254
|
+
this.forgetInferenceDeviceProbe(input.agentNodeId);
|
|
61898
63255
|
await this.topology.refreshNodeCapabilities();
|
|
61899
63256
|
this.ctx.logger.info("agentSettings entry removed", { tags: { nodeId: input.agentNodeId } });
|
|
61900
63257
|
return {
|
|
@@ -62096,12 +63453,110 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
62096
63453
|
* the runner uses its single default accelerator. NEVER throws (an
|
|
62097
63454
|
* unreachable probe yields no eligible devices).
|
|
62098
63455
|
*/
|
|
62099
|
-
async resolveEligibleInferenceDevices(nodeId) {
|
|
62100
|
-
const
|
|
62101
|
-
|
|
62102
|
-
|
|
62103
|
-
const catalog = await this.settingsStore.
|
|
62104
|
-
|
|
63456
|
+
async resolveEligibleInferenceDevices(nodeId, read) {
|
|
63457
|
+
const [probe, poolHealth] = await Promise.all([this.probeNodeInferenceDevices(nodeId), this.probeNodeInferenceDeviceHealth(nodeId)]);
|
|
63458
|
+
this.noteInferenceDeviceProbe(nodeId, probe, poolHealth);
|
|
63459
|
+
const probed = probe.probed;
|
|
63460
|
+
const catalog = await this.settingsStore.awaitCatalogForNode(nodeId, read === "one-round" ? "one-round" : "unbounded");
|
|
63461
|
+
if (catalog === null && read === "one-round" && !this.settingsStore.isDisposed()) {
|
|
63462
|
+
this.ctx.logger.debug("inference device eligibility: node catalog not answered in one round — last answer kept", {
|
|
63463
|
+
tags: { nodeId },
|
|
63464
|
+
meta: { nodeId }
|
|
63465
|
+
});
|
|
63466
|
+
throw new Error(`inference device eligibility: node "${nodeId}" catalog not answered`);
|
|
63467
|
+
}
|
|
63468
|
+
return this.electableDevices(nodeId, probed, catalog);
|
|
63469
|
+
}
|
|
63470
|
+
/**
|
|
63471
|
+
* Forget a node's last device probe (pre-ship review, M4). Called when the
|
|
63472
|
+
* node leaves (`AgentOffline`) and when the operator removes its settings: a
|
|
63473
|
+
* node that comes back with a different accelerator set must be probed
|
|
63474
|
+
* again, not elected against the list it left with.
|
|
63475
|
+
*/
|
|
63476
|
+
forgetInferenceDeviceProbe(nodeId) {
|
|
63477
|
+
if (!this.lastInferenceDeviceProbe.delete(nodeId)) return;
|
|
63478
|
+
this.ctx.logger.info("inference device probe forgotten — the node left", {
|
|
63479
|
+
tags: { nodeId },
|
|
63480
|
+
meta: { nodeId }
|
|
63481
|
+
});
|
|
63482
|
+
}
|
|
63483
|
+
/**
|
|
63484
|
+
* The NON-BLOCKING sibling of {@link resolveEligibleInferenceDevices}, for
|
|
63485
|
+
* the RE-place paths (D650 round 3). Makes no live call to the node: the
|
|
63486
|
+
* device list and the pool health are the last ones it answered, the
|
|
63487
|
+
* catalog is the cached one. A node that has never answered any of them is
|
|
63488
|
+
* `unavailable` — the camera stays pending, named, and ONE background
|
|
63489
|
+
* refresh per node is started so the next round can place it. A cold cache
|
|
63490
|
+
* never fails open here: failing open on a re-place is how a camera gets
|
|
63491
|
+
* attached with no root.
|
|
63492
|
+
*/
|
|
63493
|
+
async resolveEligibleInferenceDevicesIfCached(nodeId) {
|
|
63494
|
+
const known = this.lastInferenceDeviceProbe.get(nodeId);
|
|
63495
|
+
if (known === void 0) {
|
|
63496
|
+
this.refreshInferenceDeviceProbe(nodeId);
|
|
63497
|
+
return {
|
|
63498
|
+
kind: "unavailable",
|
|
63499
|
+
nodeId,
|
|
63500
|
+
what: "device-health"
|
|
63501
|
+
};
|
|
63502
|
+
}
|
|
63503
|
+
const catalog = this.settingsStore.peekCatalogForAgent(nodeId);
|
|
63504
|
+
if (catalog === null) return {
|
|
63505
|
+
kind: "unavailable",
|
|
63506
|
+
nodeId,
|
|
63507
|
+
what: "catalog"
|
|
63508
|
+
};
|
|
63509
|
+
this.refreshInferenceDeviceProbe(nodeId);
|
|
63510
|
+
return {
|
|
63511
|
+
kind: "eligible",
|
|
63512
|
+
eligible: await this.electableDevices(nodeId, known, catalog)
|
|
63513
|
+
};
|
|
63514
|
+
}
|
|
63515
|
+
/**
|
|
63516
|
+
* The last device list each node's probe returned — what the re-place paths
|
|
63517
|
+
* elect against, with the pool-health mirror that probe updated. Written
|
|
63518
|
+
* when a probe COMPLETES, so a cold entry means "the node's probe has never
|
|
63519
|
+
* come back", never "came back with nothing".
|
|
63520
|
+
*/
|
|
63521
|
+
lastInferenceDeviceProbe = /* @__PURE__ */ new Map();
|
|
63522
|
+
/** Nodes with a background device probe in flight (single-flight per node). */
|
|
63523
|
+
inferenceProbeInFlight = /* @__PURE__ */ new Set();
|
|
63524
|
+
refreshInferenceDeviceProbe(nodeId) {
|
|
63525
|
+
if (this.inferenceProbeInFlight.has(nodeId)) return;
|
|
63526
|
+
this.inferenceProbeInFlight.add(nodeId);
|
|
63527
|
+
Promise.all([this.probeNodeInferenceDevices(nodeId), this.probeNodeInferenceDeviceHealth(nodeId)]).then(([probe, poolHealth]) => this.noteInferenceDeviceProbe(nodeId, probe, poolHealth)).finally(() => {
|
|
63528
|
+
this.inferenceProbeInFlight.delete(nodeId);
|
|
63529
|
+
});
|
|
63530
|
+
}
|
|
63531
|
+
/**
|
|
63532
|
+
* Fold one COMPLETED probe into the pool-health mirror and the last-known
|
|
63533
|
+
* list. "Completed" means the node ANSWERED: a probe that could not reach
|
|
63534
|
+
* it (`reachable: false`) changes nothing (D49, round 4) — its empty device
|
|
63535
|
+
* list is not an answer, and recording it as one both wiped a good
|
|
63536
|
+
* last-known list and turned a never-answered node into an "answered with
|
|
63537
|
+
* nothing" one, so `device-health-unavailable` stopped firing after a single
|
|
63538
|
+
* failure. A health read that failed (`null`) changes no verdict in the
|
|
63539
|
+
* mirror either, but it did come back — a node whose read never comes back
|
|
63540
|
+
* at all is the one a re-place must not wait on, and that node never reaches
|
|
63541
|
+
* this line.
|
|
63542
|
+
*/
|
|
63543
|
+
noteInferenceDeviceProbe(nodeId, probe, poolHealth) {
|
|
63544
|
+
if (!probe.reachable) {
|
|
63545
|
+
this.ctx.logger.debug("inference device probe unreachable — last known device list kept", {
|
|
63546
|
+
tags: { nodeId },
|
|
63547
|
+
meta: {
|
|
63548
|
+
nodeId,
|
|
63549
|
+
known: this.lastInferenceDeviceProbe.has(nodeId)
|
|
63550
|
+
}
|
|
63551
|
+
});
|
|
63552
|
+
return;
|
|
63553
|
+
}
|
|
63554
|
+
this.noteInferenceDeviceHealth(nodeId, poolHealth, probe.probed.map((d) => d.key));
|
|
63555
|
+
this.lastInferenceDeviceProbe.set(nodeId, probe.probed);
|
|
63556
|
+
}
|
|
63557
|
+
/** Eligibility from a device list + catalog; records usability like every dispatch read. */
|
|
63558
|
+
async electableDevices(nodeId, probed, catalog) {
|
|
63559
|
+
const eligibility = resolveInferenceDeviceEligibility(probed, (await this.settingsStore.readAgentSettingsMap())[nodeId]?.inferenceDevices ?? {}, catalog ? makeRootCapabilityGuard(catalog) : void 0, (deviceKey) => this.inferenceDeviceUsability.isUsable(nodeId, deviceKey));
|
|
62105
63560
|
const { eligible, excluded } = eligibility;
|
|
62106
63561
|
this.logInferenceDeviceShrinkage(nodeId, eligible, excluded);
|
|
62107
63562
|
this.noteNodeInferenceUsability(nodeId, resolveNodeInferenceUsability(eligibility));
|