@camstack/addon-pipeline 1.2.5 → 1.2.7

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.
Files changed (32) hide show
  1. package/dist/audio-analyzer/index.js +1 -1
  2. package/dist/audio-analyzer/index.mjs +1 -1
  3. package/dist/detection-pipeline/index.js +499 -30
  4. package/dist/detection-pipeline/index.mjs +493 -24
  5. package/dist/{dist-ZB-B8UrH.mjs → dist-BwyGTnMu.mjs} +306 -3
  6. package/dist/{dist-CtQsET1Q.js → dist-CAT3VF7A.js} +306 -3
  7. package/dist/motion-wasm/index.js +1 -1
  8. package/dist/motion-wasm/index.mjs +1 -1
  9. package/dist/pipeline-runner/index.js +30 -15
  10. package/dist/pipeline-runner/index.mjs +30 -15
  11. package/dist/recorder/index.js +1 -1
  12. package/dist/recorder/index.mjs +1 -1
  13. package/dist/{step-definitions-DrRnEQPM.js → step-definitions-BPEExRug.js} +70 -2
  14. package/dist/{step-definitions-BKJI5CXI.mjs → step-definitions-DN1obXS7.mjs} +70 -2
  15. package/dist/stream-broker/_stub.js +1 -1
  16. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-DPvS4Ex7.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-BtN6sZcL.mjs} +1 -1
  17. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-D34ivtL2.mjs +26 -0
  18. package/dist/stream-broker/{hostInit-CG0IeE_e.mjs → hostInit-BIZvt2bk.mjs} +1 -1
  19. package/dist/stream-broker/index.js +35 -6
  20. package/dist/stream-broker/index.mjs +35 -6
  21. package/dist/stream-broker/remoteEntry.js +1 -1
  22. package/embed-dist/assets/{MaskShapeCanvas-DI4BY7W2-C-rkQ2rg.js → MaskShapeCanvas-DI4BY7W2-3uL2OmvC.js} +1 -1
  23. package/embed-dist/assets/{MotionZonesSettings-NcxxQN8r-BtbCLveu.js → MotionZonesSettings-NcxxQN8r-JkIkJTeI.js} +1 -1
  24. package/embed-dist/assets/{PrivacyMaskSettings-APgPLF7p-C9CEgSlA.js → PrivacyMaskSettings-APgPLF7p-AKGABxQk.js} +1 -1
  25. package/embed-dist/assets/{index-CgJ1frQY.js → index-DfcKIHhA.js} +14 -14
  26. package/embed-dist/index.html +1 -1
  27. package/package.json +1 -1
  28. package/python/postprocessors/ctc.py +228 -4
  29. package/python/postprocessors/test_ctc.py +312 -0
  30. package/python/postprocessors/testdata/ctc_degenerate_lowres_logits.npy.gz.b64 +1 -0
  31. package/python/postprocessors/testdata/ctc_dwro309_logits.npy.gz.b64 +1 -0
  32. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CQC_f4Yv.mjs +0 -26
@@ -6915,7 +6915,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
6915
6915
  patch: record(string(), unknown())
6916
6916
  }), object({ success: literal(true) });
6917
6917
  object({ deviceId: number() }), unknown().nullable();
6918
- /** Shorthand to define a method schema */
6919
6918
  function method(input, output, options) {
6920
6919
  return {
6921
6920
  input,
@@ -6923,6 +6922,7 @@ function method(input, output, options) {
6923
6922
  kind: options?.kind ?? "query",
6924
6923
  auth: options?.auth ?? "protected",
6925
6924
  ...options?.access !== void 0 ? { access: options.access } : {},
6925
+ ...options?.caller !== void 0 ? { caller: options.caller } : {},
6926
6926
  timeoutMs: options?.timeoutMs
6927
6927
  };
6928
6928
  }
@@ -11731,6 +11731,22 @@ var CameraMetricsSchema = object({
11731
11731
  ])
11732
11732
  });
11733
11733
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
11734
+ /**
11735
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
11736
+ * within the frame, so the executor can re-cut a leaf child ROI at native
11737
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
11738
+ */
11739
+ var NativeCropRefSchema = object({
11740
+ /** Handle keying the retained native surface (node-pinned to its owner). */
11741
+ handle: FrameHandleSchema,
11742
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
11743
+ cropFrameSpace: object({
11744
+ x: number(),
11745
+ y: number(),
11746
+ w: number(),
11747
+ h: number()
11748
+ })
11749
+ });
11734
11750
  var ModelFormatSchema$1 = _enum([
11735
11751
  "onnx",
11736
11752
  "coreml",
@@ -12104,7 +12120,22 @@ var pipelineExecutorCapability = {
12104
12120
  * Omitted ⇒ the runner's default device (current single-engine
12105
12121
  * behaviour). Selects WHICH device pool of the node runs the call.
12106
12122
  */
12107
- deviceKey: string().optional()
12123
+ deviceKey: string().optional(),
12124
+ /**
12125
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
12126
+ * when the parent crop was resolved from the frame's retained NATIVE
12127
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
12128
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
12129
+ * resolution from that surface — the SAME quality path faces already
12130
+ * had — instead of the downscaled parent tile. `handle` keys the native
12131
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
12132
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
12133
+ * the executor's crop-normalized child ROI back into frame-normalized
12134
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
12135
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
12136
+ * (today's behaviour on the fallback path).
12137
+ */
12138
+ nativeCropRef: NativeCropRefSchema.optional()
12108
12139
  }), PipelineRunResultBridge, { kind: "mutation" }),
12109
12140
  /**
12110
12141
  * Batched run — N raw frames packed into one cap call. The provider
@@ -12374,7 +12405,11 @@ var DetailResultSchema = object({
12374
12405
  bbox: NativeCropBboxSchema.optional(),
12375
12406
  embedding: string().optional(),
12376
12407
  label: string().optional(),
12377
- alignedCropJpeg: string().optional()
12408
+ alignedCropJpeg: string().optional(),
12409
+ /** Face short side (px) measured on the NATIVE crop surface. The `bbox`
12410
+ * above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
12411
+ * consumers MUST prefer this when present (2026-07-22 native-gate fix). */
12412
+ nativeFaceShortSidePx: number().optional()
12378
12413
  });
12379
12414
  /**
12380
12415
  * Per-camera tunable ranges + defaults. Single source of truth used
@@ -17041,6 +17076,226 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
17041
17076
  enabled: boolean()
17042
17077
  }), _void(), { kind: "mutation" });
17043
17078
  /**
17079
+ * notification-rules — the Notification Center rule surface (P1 core).
17080
+ *
17081
+ * Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
17082
+ * (operator decisions D-1/D-2/D-3 are binding):
17083
+ *
17084
+ * - D-2: rule EVALUATION lives in `addon-post-analysis` (the
17085
+ * `notification-center` module), hooked on the durable persistence
17086
+ * moments (object-event insert, TrackCloser.closeExpired) with a
17087
+ * persisted outbox + retry — never the lossy telemetry bus (D8).
17088
+ * - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
17089
+ * FIRST persisted detection matching the conditions (per-track dedup,
17090
+ * `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
17091
+ * `delivery: 'track-end'` evaluates the finalized track record at close.
17092
+ * - DISPATCH stays behind `notification-output` (rules reference targets
17093
+ * by id; per-backend params are a passthrough blob capped by the
17094
+ * target kind's own caps/degrade engine).
17095
+ *
17096
+ * P1 scope: admin-authored rules only (`createdBy` stamped from the
17097
+ * server-injected caller identity — the first `caller: 'required'`
17098
+ * adopter). The P1 condition subset is: devices, classes(+exclude),
17099
+ * minConfidence, admin zones (any/all + exclude), weekly schedule
17100
+ * windows, and the optional label/identity/plate matchers. User rules,
17101
+ * private zones, per-recipient fan-out and the wider condition table are
17102
+ * P2+ (see spec §7).
17103
+ *
17104
+ * All schemas here are the single source of truth — `NcRule` etc. are
17105
+ * `z.infer` exports; no duplicate interfaces (the advanced-notifier
17106
+ * schema/interface drift is explicitly not repeated).
17107
+ */
17108
+ /** D-3: the urgency of a rule — which persistence moment evaluates it. */
17109
+ var NcDeliverySchema = _enum(["immediate", "track-end"]);
17110
+ /** Weekly schedule — OR of windows; absence on the rule = always active. */
17111
+ var NcScheduleSchema = object({
17112
+ windows: array(object({
17113
+ /** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
17114
+ days: array(number().int().min(0).max(6)).min(1),
17115
+ startMinute: number().int().min(0).max(1439),
17116
+ endMinute: number().int().min(0).max(1439)
17117
+ })).min(1),
17118
+ /** IANA timezone; default = hub host timezone. */
17119
+ timezone: string().optional(),
17120
+ /** Active OUTSIDE the windows (e.g. "only outside business hours"). */
17121
+ invert: boolean().optional()
17122
+ });
17123
+ /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
17124
+ var NcPlateMatcherSchema = object({
17125
+ values: array(string().min(1)).min(1),
17126
+ /** Max Levenshtein distance after normalization (uppercase alphanumeric). */
17127
+ maxDistance: number().int().min(0).max(3).default(1)
17128
+ });
17129
+ /** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
17130
+ var NcZoneConditionSchema = object({
17131
+ ids: array(string().min(1)).min(1),
17132
+ /** Quantifier over `ids` — at least one / every one visited. */
17133
+ match: _enum(["any", "all"]).default("any")
17134
+ });
17135
+ /**
17136
+ * The P1 condition set — a flat AND of groups; absent group = pass;
17137
+ * membership lists are OR within the list (spec §2.3).
17138
+ */
17139
+ var NcConditionsSchema = object({
17140
+ /** Device scope — absent = all devices. */
17141
+ devices: array(number()).optional(),
17142
+ /** Detector class names (any overlap with the record's class set). */
17143
+ classes: array(string().min(1)).optional(),
17144
+ /** Veto classes — any overlap fails the rule. */
17145
+ classesExclude: array(string().min(1)).optional(),
17146
+ /** Minimum detection confidence 0–1 (fails when the record has none). */
17147
+ minConfidence: number().min(0).max(1).optional(),
17148
+ /** Admin zone membership over event `zones` / track `zonesVisited`. */
17149
+ zones: NcZoneConditionSchema.optional(),
17150
+ /** Veto zones — any hit fails the rule. */
17151
+ zonesExclude: array(string().min(1)).optional(),
17152
+ /**
17153
+ * Exact (case-insensitive) match on the record's collapsed `label`
17154
+ * (identity name / plate text / subclass).
17155
+ */
17156
+ labelEquals: array(string().min(1)).optional(),
17157
+ /**
17158
+ * Identity matcher. P1 boundary: matched against the record's collapsed
17159
+ * `label` (the identity display name propagated by the face pipeline) —
17160
+ * identity-ID matching rides in P2 when identity ids reach the record.
17161
+ */
17162
+ identities: array(string().min(1)).optional(),
17163
+ /** Fuzzy plate matcher against the record's `label` (plate text). */
17164
+ plates: NcPlateMatcherSchema.optional()
17165
+ });
17166
+ /** One delivery target: a `notification-output` Target ref + passthrough params. */
17167
+ var NcRuleTargetSchema = object({
17168
+ /** `notification-output` Target id. */
17169
+ targetId: string().min(1),
17170
+ /**
17171
+ * Per-backend passthrough. Recognized keys are mapped onto the canonical
17172
+ * Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
17173
+ * degrade engine drops what the backend can't render.
17174
+ */
17175
+ params: record(string(), unknown()).optional()
17176
+ });
17177
+ /**
17178
+ * Media attachment policy (P1 still-image subset). `best` = the best
17179
+ * AVAILABLE media at dispatch time (D-3); `best-matching` (track-end
17180
+ * condition-best) is deferred — operator open point.
17181
+ */
17182
+ var NcMediaPolicySchema = object({ attach: _enum([
17183
+ "best",
17184
+ "keyFrame",
17185
+ "none"
17186
+ ]).default("best") });
17187
+ /** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
17188
+ var NcThrottleSchema = object({
17189
+ cooldownSec: number().int().min(0).max(86400).default(60),
17190
+ /** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
17191
+ scope: _enum(["rule", "rule-device"]).default("rule-device")
17192
+ });
17193
+ /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
17194
+ var NcRuleInputSchema = object({
17195
+ name: string().min(1).max(200),
17196
+ enabled: boolean().default(true),
17197
+ delivery: NcDeliverySchema,
17198
+ conditions: NcConditionsSchema.default({}),
17199
+ schedule: NcScheduleSchema.optional(),
17200
+ targets: array(NcRuleTargetSchema).min(1),
17201
+ media: NcMediaPolicySchema.default({ attach: "best" }),
17202
+ throttle: NcThrottleSchema.default({
17203
+ cooldownSec: 60,
17204
+ scope: "rule-device"
17205
+ }),
17206
+ /** `{{var}}` templating over camera/class/label/zones/confidence/time. */
17207
+ template: object({
17208
+ title: string().max(500).optional(),
17209
+ body: string().max(2e3).optional()
17210
+ }).optional(),
17211
+ /** Canonical notification priority ordinal (1..5); per-target overridable. */
17212
+ priority: number().int().min(1).max(5).default(3)
17213
+ });
17214
+ /** Partial patch for `updateRule` — any subset of the input fields. */
17215
+ var NcRulePatchSchema = NcRuleInputSchema.partial();
17216
+ /** A persisted rule. */
17217
+ var NcRuleSchema = NcRuleInputSchema.extend({
17218
+ id: string(),
17219
+ /** userId of the admin who created the rule (server-stamped caller). */
17220
+ createdBy: string(),
17221
+ createdAt: number(),
17222
+ updatedAt: number()
17223
+ });
17224
+ var NcTestResultSchema = object({
17225
+ recordId: string(),
17226
+ recordKind: _enum(["object-event", "track"]),
17227
+ deviceId: number(),
17228
+ timestamp: number(),
17229
+ wouldFire: boolean(),
17230
+ /** Condition id that failed (first failing group), when `wouldFire` is false. */
17231
+ failedCondition: string().optional(),
17232
+ className: string().optional(),
17233
+ label: string().optional()
17234
+ });
17235
+ var NcConditionDescriptorSchema = object({
17236
+ /** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
17237
+ id: string(),
17238
+ group: _enum([
17239
+ "scope",
17240
+ "class",
17241
+ "zones",
17242
+ "quality",
17243
+ "label",
17244
+ "schedule"
17245
+ ]),
17246
+ label: string(),
17247
+ /** Editor widget the UI renders — never hardcode per-condition forms. */
17248
+ valueType: _enum([
17249
+ "deviceIdList",
17250
+ "stringList",
17251
+ "number01",
17252
+ "zoneSelection",
17253
+ "zoneIdList",
17254
+ "schedule",
17255
+ "plateMatcher"
17256
+ ]),
17257
+ operator: _enum([
17258
+ "in",
17259
+ "notIn",
17260
+ "anyOf",
17261
+ "allOf",
17262
+ "gte",
17263
+ "fuzzyIn",
17264
+ "withinSchedule"
17265
+ ]),
17266
+ /** Which delivery kinds the condition applies to. */
17267
+ appliesTo: array(NcDeliverySchema),
17268
+ phase: string(),
17269
+ description: string().optional()
17270
+ });
17271
+ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), method(object({ ruleId: string() }), object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }), method(object({ rule: NcRuleInputSchema }), object({ rule: NcRuleSchema }), {
17272
+ kind: "mutation",
17273
+ auth: "admin",
17274
+ caller: "required"
17275
+ }), method(object({
17276
+ ruleId: string(),
17277
+ patch: NcRulePatchSchema
17278
+ }), object({ rule: NcRuleSchema }), {
17279
+ kind: "mutation",
17280
+ auth: "admin",
17281
+ caller: "required"
17282
+ }), method(object({ ruleId: string() }), object({ success: literal(true) }), {
17283
+ kind: "mutation",
17284
+ auth: "admin"
17285
+ }), method(object({
17286
+ ruleId: string(),
17287
+ enabled: boolean()
17288
+ }), object({ success: literal(true) }), {
17289
+ kind: "mutation",
17290
+ auth: "admin"
17291
+ }), method(object({
17292
+ rule: NcRuleInputSchema,
17293
+ lookbackMinutes: number().int().min(1).max(1440).default(60)
17294
+ }), object({ results: array(NcTestResultSchema) }), {
17295
+ kind: "mutation",
17296
+ auth: "admin"
17297
+ }), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) }));
17298
+ /**
17044
17299
  * Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
17045
17300
  * surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
17046
17301
  * caps stay wire-compatible without a circular cap→cap import.
@@ -24585,6 +24840,54 @@ Object.freeze({
24585
24840
  addonId: null,
24586
24841
  access: "create"
24587
24842
  },
24843
+ "notificationRules.createRule": {
24844
+ capName: "notification-rules",
24845
+ capScope: "system",
24846
+ addonId: null,
24847
+ access: "create"
24848
+ },
24849
+ "notificationRules.deleteRule": {
24850
+ capName: "notification-rules",
24851
+ capScope: "system",
24852
+ addonId: null,
24853
+ access: "delete"
24854
+ },
24855
+ "notificationRules.getConditionCatalog": {
24856
+ capName: "notification-rules",
24857
+ capScope: "system",
24858
+ addonId: null,
24859
+ access: "view"
24860
+ },
24861
+ "notificationRules.getRule": {
24862
+ capName: "notification-rules",
24863
+ capScope: "system",
24864
+ addonId: null,
24865
+ access: "view"
24866
+ },
24867
+ "notificationRules.listRules": {
24868
+ capName: "notification-rules",
24869
+ capScope: "system",
24870
+ addonId: null,
24871
+ access: "view"
24872
+ },
24873
+ "notificationRules.setRuleEnabled": {
24874
+ capName: "notification-rules",
24875
+ capScope: "system",
24876
+ addonId: null,
24877
+ access: "create"
24878
+ },
24879
+ "notificationRules.testRule": {
24880
+ capName: "notification-rules",
24881
+ capScope: "system",
24882
+ addonId: null,
24883
+ access: "create"
24884
+ },
24885
+ "notificationRules.updateRule": {
24886
+ capName: "notification-rules",
24887
+ capScope: "system",
24888
+ addonId: null,
24889
+ access: "create"
24890
+ },
24588
24891
  "notifier.cancel": {
24589
24892
  capName: "notifier",
24590
24893
  capScope: "device",
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_dist = require("../dist-CtQsET1Q.js");
5
+ const require_dist = require("../dist-CAT3VF7A.js");
6
6
  let node_fs = require("node:fs");
7
7
  let node_path = require("node:path");
8
8
  //#region src/motion-wasm/wasm-motion-detector.ts
@@ -1,4 +1,4 @@
1
- import { A as motionDetectionCapability, J as hydrateSchema, K as DeviceType, T as evaluateZoneRules, U as BaseAddon } from "../dist-ZB-B8UrH.mjs";
1
+ import { A as motionDetectionCapability, J as hydrateSchema, K as DeviceType, T as evaluateZoneRules, U as BaseAddon } from "../dist-BwyGTnMu.mjs";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  //#region src/motion-wasm/wasm-motion-detector.ts
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../chunk-D6vf50IK.js");
6
- const require_dist = require("../dist-CtQsET1Q.js");
6
+ const require_dist = require("../dist-CAT3VF7A.js");
7
7
  const require_remote_restream = require("../remote-restream-CO36Sr30.js");
8
8
  const require_sheet_geometry = require("../sheet-geometry-BR-ip0CP.js");
9
9
  const require_worker_protocol = require("../worker-protocol-DextwlTX.js");
10
- const require_step_definitions = require("../step-definitions-DrRnEQPM.js");
10
+ const require_step_definitions = require("../step-definitions-BPEExRug.js");
11
11
  let node_child_process = require("node:child_process");
12
12
  let node_url = require("node:url");
13
13
  let sharp = require("sharp");
@@ -1284,15 +1284,20 @@ var RETAINED_FRAME_BUDGET_BYTES = (() => {
1284
1284
  /**
1285
1285
  * How many of each device's MOST RECENT frames are protected from a busy
1286
1286
  * neighbour's budget eviction. Sized to cover the late two-plane / cross-process
1287
- * enrichment horizon (~150-500 ms): 6 frames 0.6 s @10 fps of guaranteed
1288
- * survival for every active camera. Read ONCE from
1289
- * `CAMSTACK_SESSION_RETAIN_FLOOR`; `0` disables the floor (pure global FIFO the
1290
- * pre-2026-07-19 behaviour). The hard byte ceiling always overrides the floor,
1291
- * so this can never push retention past {@link RETAINED_FRAME_BUDGET_BYTES}.
1287
+ * enrichment horizon (~150-500 ms) at the REAL delivered rate: the store writes
1288
+ * every DELIVERED rgb frame, and a high-fps camera delivers ~25 fps (observed on
1289
+ * the 4K outdoor cams), so the old floor of 6 protected only ~240 ms there and
1290
+ * its late captures hit "frame recycled before resolve" (2026-07-22 triage —
1291
+ * missing thumbnails/firstFrames concentrated on exactly those cameras).
1292
+ * 16 frames ≈ 0.64 s @25 fps (1.6 s @10 fps). Only ACTIVE cameras hold frames,
1293
+ * so the worst-case protected footprint stays well inside the byte budget for
1294
+ * realistic concurrency (4 active cams ≈ 44 MB of 96); the hard ceiling always
1295
+ * overrides the floor regardless. Read ONCE from `CAMSTACK_SESSION_RETAIN_FLOOR`;
1296
+ * `0` disables the floor (pure global FIFO — the pre-2026-07-19 behaviour).
1292
1297
  */
1293
1298
  var RETAINED_FRAME_PER_DEVICE_FLOOR = (() => {
1294
1299
  const raw = Number(process.env["CAMSTACK_SESSION_RETAIN_FLOOR"]);
1295
- return Number.isFinite(raw) && raw >= 0 ? Math.floor(raw) : 6;
1300
+ return Number.isFinite(raw) && raw >= 0 ? Math.floor(raw) : 16;
1296
1301
  })();
1297
1302
  /** Opaque RAM-key prefix stamped into a retained frame's `FrameHandle.shmId`. */
1298
1303
  var RETAINED_FRAME_KEY_PREFIX = "ram:";
@@ -2210,14 +2215,18 @@ function toDetailResult(detection, stepId, crop) {
2210
2215
  bbox: mapBboxToFrameSpace(detection.bbox, crop),
2211
2216
  ...detection.embedding !== void 0 ? { embedding: encodeEmbeddingBase64(detection.embedding) } : {},
2212
2217
  ...label !== void 0 ? { label } : {},
2213
- ...detection.faceAlignedCrop !== void 0 ? { alignedCropJpeg: detection.faceAlignedCrop } : {}
2218
+ ...detection.faceAlignedCrop !== void 0 ? { alignedCropJpeg: detection.faceAlignedCrop } : {},
2219
+ ...detection.nativeFaceShortSidePx !== void 0 ? { nativeFaceShortSidePx: detection.nativeFaceShortSidePx } : {}
2214
2220
  };
2215
2221
  }
2216
2222
  async function resolveCrop(deps, input) {
2217
2223
  if (input.frameHandle) {
2218
2224
  const normalized = normalizeRect(padAndClampFrameBbox(input.parent.bbox, input.frameHandle.width, input.frameHandle.height), input.frameHandle.width, input.frameHandle.height);
2219
2225
  const native = await deps.getNativeCrop(input.deviceId, input.frameHandle, normalized);
2220
- if (native) return native;
2226
+ if (native) return {
2227
+ ...native,
2228
+ source: "native"
2229
+ };
2221
2230
  }
2222
2231
  if (input.cropJpeg) {
2223
2232
  const jpeg = Buffer.from(input.cropJpeg, "base64");
@@ -2230,7 +2239,8 @@ async function resolveCrop(deps, input) {
2230
2239
  jpeg,
2231
2240
  width,
2232
2241
  height,
2233
- frameSpace: input.parent.bbox
2242
+ frameSpace: input.parent.bbox,
2243
+ source: "fallback"
2234
2244
  };
2235
2245
  }
2236
2246
  return null;
@@ -2258,10 +2268,14 @@ async function runDetailSubtree(deps, input) {
2258
2268
  const steps = requested === void 0 ? matched : matched.map((step) => pruneChildStepsToRequested(step, requested));
2259
2269
  const crop = await resolveCrop(deps, input);
2260
2270
  if (!crop) return null;
2271
+ const nativeCropRef = input.frameHandle !== void 0 && crop.source === "native" ? {
2272
+ handle: input.frameHandle,
2273
+ cropFrameSpace: crop.frameSpace
2274
+ } : void 0;
2261
2275
  const details = [];
2262
2276
  for (const step of steps) {
2263
2277
  const deviceKey = deps.resolveStepDevice?.(input.deviceId, step);
2264
- const result = await deps.runPipeline([step], crop.jpeg, input.deviceId, deviceKey);
2278
+ const result = await deps.runPipeline([step], crop.jpeg, input.deviceId, deviceKey, nativeCropRef);
2265
2279
  if (!result) continue;
2266
2280
  for (const detection of result.detections) details.push(toDetailResult(detection, step.addonId, crop));
2267
2281
  }
@@ -3367,7 +3381,7 @@ var PipelineRunnerAddon = class extends require_dist.BaseAddon {
3367
3381
  return runDetailSubtree({
3368
3382
  resolveChildSteps: (deviceId, parentClassName, filter) => this.resolveDetailChildSteps(deviceId, parentClassName, filter),
3369
3383
  getNativeCrop: (deviceId, handle, paddedBbox) => this.getNativeCropForDetail(deviceId, handle, paddedBbox),
3370
- runPipeline: (steps, imageJpeg, deviceId, deviceKey) => this.runDetailPipeline(steps, imageJpeg, deviceId, deviceKey),
3384
+ runPipeline: (steps, imageJpeg, deviceId, deviceKey, nativeCropRef) => this.runDetailPipeline(steps, imageJpeg, deviceId, deviceKey, nativeCropRef),
3371
3385
  resolveStepDevice: (deviceId, step) => this.resolveDetailStepDevice(deviceId, step)
3372
3386
  }, input);
3373
3387
  }
@@ -3519,7 +3533,7 @@ var PipelineRunnerAddon = class extends require_dist.BaseAddon {
3519
3533
  })();
3520
3534
  }
3521
3535
  /** Real `runPipeline` dep: node-local `pipelineExecutor.runPipeline` on the `'full'` plane. */
3522
- async runDetailPipeline(steps, imageJpeg, deviceId, stepDeviceKey) {
3536
+ async runDetailPipeline(steps, imageJpeg, deviceId, stepDeviceKey, nativeCropRef) {
3523
3537
  const api = this.ctxIfReady?.api;
3524
3538
  if (!api) return null;
3525
3539
  const detailDeviceKey = stepDeviceKey ?? this.attached.get(deviceId)?.config?.deviceKey;
@@ -3529,7 +3543,8 @@ var PipelineRunnerAddon = class extends require_dist.BaseAddon {
3529
3543
  image: new Uint8Array(imageJpeg),
3530
3544
  deviceId,
3531
3545
  ...detailDeviceKey ? { deviceKey: detailDeviceKey } : {},
3532
- plane: "full"
3546
+ plane: "full",
3547
+ ...nativeCropRef ? { nativeCropRef } : {}
3533
3548
  });
3534
3549
  } catch (err) {
3535
3550
  this.ctxIfReady?.logger.warn("runDetailSubtree: runPipeline failed", {
@@ -1,8 +1,8 @@
1
- import { H as errMsg, N as pipelineRunnerCapability, S as defineCustomActions, U as BaseAddon, b as customAction, ct as number, dt as string, it as boolean, j as nodePin, lt as object, nt as _enum, ot as lazy, pt as EventCategory, q as createEvent, rt as array, s as DEVICE_BACKEND_TO_FORMAT } from "../dist-ZB-B8UrH.mjs";
1
+ import { H as errMsg, N as pipelineRunnerCapability, S as defineCustomActions, U as BaseAddon, b as customAction, ct as number, dt as string, it as boolean, j as nodePin, lt as object, nt as _enum, ot as lazy, pt as EventCategory, q as createEvent, rt as array, s as DEVICE_BACKEND_TO_FORMAT } from "../dist-BwyGTnMu.mjs";
2
2
  import { n as profileForStreamId, t as isRemoteRestream } from "../remote-restream-BeHi78PZ.mjs";
3
3
  import { r as resolveHubHostname } from "../sheet-geometry-DcpuGTCm.mjs";
4
4
  import { t as isWorkerReply } from "../worker-protocol-D7RzZIla.mjs";
5
- import { a as getStepDefinition } from "../step-definitions-BKJI5CXI.mjs";
5
+ import { a as getStepDefinition } from "../step-definitions-DN1obXS7.mjs";
6
6
  import { fork } from "node:child_process";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import sharp from "sharp";
@@ -1278,15 +1278,20 @@ var RETAINED_FRAME_BUDGET_BYTES = (() => {
1278
1278
  /**
1279
1279
  * How many of each device's MOST RECENT frames are protected from a busy
1280
1280
  * neighbour's budget eviction. Sized to cover the late two-plane / cross-process
1281
- * enrichment horizon (~150-500 ms): 6 frames 0.6 s @10 fps of guaranteed
1282
- * survival for every active camera. Read ONCE from
1283
- * `CAMSTACK_SESSION_RETAIN_FLOOR`; `0` disables the floor (pure global FIFO the
1284
- * pre-2026-07-19 behaviour). The hard byte ceiling always overrides the floor,
1285
- * so this can never push retention past {@link RETAINED_FRAME_BUDGET_BYTES}.
1281
+ * enrichment horizon (~150-500 ms) at the REAL delivered rate: the store writes
1282
+ * every DELIVERED rgb frame, and a high-fps camera delivers ~25 fps (observed on
1283
+ * the 4K outdoor cams), so the old floor of 6 protected only ~240 ms there and
1284
+ * its late captures hit "frame recycled before resolve" (2026-07-22 triage —
1285
+ * missing thumbnails/firstFrames concentrated on exactly those cameras).
1286
+ * 16 frames ≈ 0.64 s @25 fps (1.6 s @10 fps). Only ACTIVE cameras hold frames,
1287
+ * so the worst-case protected footprint stays well inside the byte budget for
1288
+ * realistic concurrency (4 active cams ≈ 44 MB of 96); the hard ceiling always
1289
+ * overrides the floor regardless. Read ONCE from `CAMSTACK_SESSION_RETAIN_FLOOR`;
1290
+ * `0` disables the floor (pure global FIFO — the pre-2026-07-19 behaviour).
1286
1291
  */
1287
1292
  var RETAINED_FRAME_PER_DEVICE_FLOOR = (() => {
1288
1293
  const raw = Number(process.env["CAMSTACK_SESSION_RETAIN_FLOOR"]);
1289
- return Number.isFinite(raw) && raw >= 0 ? Math.floor(raw) : 6;
1294
+ return Number.isFinite(raw) && raw >= 0 ? Math.floor(raw) : 16;
1290
1295
  })();
1291
1296
  /** Opaque RAM-key prefix stamped into a retained frame's `FrameHandle.shmId`. */
1292
1297
  var RETAINED_FRAME_KEY_PREFIX = "ram:";
@@ -2204,14 +2209,18 @@ function toDetailResult(detection, stepId, crop) {
2204
2209
  bbox: mapBboxToFrameSpace(detection.bbox, crop),
2205
2210
  ...detection.embedding !== void 0 ? { embedding: encodeEmbeddingBase64(detection.embedding) } : {},
2206
2211
  ...label !== void 0 ? { label } : {},
2207
- ...detection.faceAlignedCrop !== void 0 ? { alignedCropJpeg: detection.faceAlignedCrop } : {}
2212
+ ...detection.faceAlignedCrop !== void 0 ? { alignedCropJpeg: detection.faceAlignedCrop } : {},
2213
+ ...detection.nativeFaceShortSidePx !== void 0 ? { nativeFaceShortSidePx: detection.nativeFaceShortSidePx } : {}
2208
2214
  };
2209
2215
  }
2210
2216
  async function resolveCrop(deps, input) {
2211
2217
  if (input.frameHandle) {
2212
2218
  const normalized = normalizeRect(padAndClampFrameBbox(input.parent.bbox, input.frameHandle.width, input.frameHandle.height), input.frameHandle.width, input.frameHandle.height);
2213
2219
  const native = await deps.getNativeCrop(input.deviceId, input.frameHandle, normalized);
2214
- if (native) return native;
2220
+ if (native) return {
2221
+ ...native,
2222
+ source: "native"
2223
+ };
2215
2224
  }
2216
2225
  if (input.cropJpeg) {
2217
2226
  const jpeg = Buffer.from(input.cropJpeg, "base64");
@@ -2224,7 +2233,8 @@ async function resolveCrop(deps, input) {
2224
2233
  jpeg,
2225
2234
  width,
2226
2235
  height,
2227
- frameSpace: input.parent.bbox
2236
+ frameSpace: input.parent.bbox,
2237
+ source: "fallback"
2228
2238
  };
2229
2239
  }
2230
2240
  return null;
@@ -2252,10 +2262,14 @@ async function runDetailSubtree(deps, input) {
2252
2262
  const steps = requested === void 0 ? matched : matched.map((step) => pruneChildStepsToRequested(step, requested));
2253
2263
  const crop = await resolveCrop(deps, input);
2254
2264
  if (!crop) return null;
2265
+ const nativeCropRef = input.frameHandle !== void 0 && crop.source === "native" ? {
2266
+ handle: input.frameHandle,
2267
+ cropFrameSpace: crop.frameSpace
2268
+ } : void 0;
2255
2269
  const details = [];
2256
2270
  for (const step of steps) {
2257
2271
  const deviceKey = deps.resolveStepDevice?.(input.deviceId, step);
2258
- const result = await deps.runPipeline([step], crop.jpeg, input.deviceId, deviceKey);
2272
+ const result = await deps.runPipeline([step], crop.jpeg, input.deviceId, deviceKey, nativeCropRef);
2259
2273
  if (!result) continue;
2260
2274
  for (const detection of result.detections) details.push(toDetailResult(detection, step.addonId, crop));
2261
2275
  }
@@ -3361,7 +3375,7 @@ var PipelineRunnerAddon = class extends BaseAddon {
3361
3375
  return runDetailSubtree({
3362
3376
  resolveChildSteps: (deviceId, parentClassName, filter) => this.resolveDetailChildSteps(deviceId, parentClassName, filter),
3363
3377
  getNativeCrop: (deviceId, handle, paddedBbox) => this.getNativeCropForDetail(deviceId, handle, paddedBbox),
3364
- runPipeline: (steps, imageJpeg, deviceId, deviceKey) => this.runDetailPipeline(steps, imageJpeg, deviceId, deviceKey),
3378
+ runPipeline: (steps, imageJpeg, deviceId, deviceKey, nativeCropRef) => this.runDetailPipeline(steps, imageJpeg, deviceId, deviceKey, nativeCropRef),
3365
3379
  resolveStepDevice: (deviceId, step) => this.resolveDetailStepDevice(deviceId, step)
3366
3380
  }, input);
3367
3381
  }
@@ -3513,7 +3527,7 @@ var PipelineRunnerAddon = class extends BaseAddon {
3513
3527
  })();
3514
3528
  }
3515
3529
  /** Real `runPipeline` dep: node-local `pipelineExecutor.runPipeline` on the `'full'` plane. */
3516
- async runDetailPipeline(steps, imageJpeg, deviceId, stepDeviceKey) {
3530
+ async runDetailPipeline(steps, imageJpeg, deviceId, stepDeviceKey, nativeCropRef) {
3517
3531
  const api = this.ctxIfReady?.api;
3518
3532
  if (!api) return null;
3519
3533
  const detailDeviceKey = stepDeviceKey ?? this.attached.get(deviceId)?.config?.deviceKey;
@@ -3523,7 +3537,8 @@ var PipelineRunnerAddon = class extends BaseAddon {
3523
3537
  image: new Uint8Array(imageJpeg),
3524
3538
  deviceId,
3525
3539
  ...detailDeviceKey ? { deviceKey: detailDeviceKey } : {},
3526
- plane: "full"
3540
+ plane: "full",
3541
+ ...nativeCropRef ? { nativeCropRef } : {}
3527
3542
  });
3528
3543
  } catch (err) {
3529
3544
  this.ctxIfReady?.logger.warn("runDetailSubtree: runPipeline failed", {
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("../chunk-D6vf50IK.js");
2
- const require_dist = require("../dist-CtQsET1Q.js");
2
+ const require_dist = require("../dist-CAT3VF7A.js");
3
3
  const require_sheet_geometry = require("../sheet-geometry-BR-ip0CP.js");
4
4
  const require_model_download_service_Cp9f4dk6 = require("../model-download-service-Cp9f4dk6-Dv-oFwjN.js");
5
5
  let node_child_process = require("node:child_process");
@@ -1,4 +1,4 @@
1
- import { F as recordingExportCapability, H as errMsg, I as resolveScrubThumbnailGeometry, J as hydrateSchema, K as DeviceType, P as recordingCapability, R as storageEvictableCapability, U as BaseAddon, Y as isEvent, c as EVENT_PAD_MS, dt as string, et as selectAssignedProfileSlots, f as OpsLogEntrySchema, j as nodePin, k as migrateConfigToBands, p as RecordingConfigSchema, pt as EventCategory, rt as array, u as ExportRecordSchema, ut as record } from "../dist-ZB-B8UrH.mjs";
1
+ import { F as recordingExportCapability, H as errMsg, I as resolveScrubThumbnailGeometry, J as hydrateSchema, K as DeviceType, P as recordingCapability, R as storageEvictableCapability, U as BaseAddon, Y as isEvent, c as EVENT_PAD_MS, dt as string, et as selectAssignedProfileSlots, f as OpsLogEntrySchema, j as nodePin, k as migrateConfigToBands, p as RecordingConfigSchema, pt as EventCategory, rt as array, u as ExportRecordSchema, ut as record } from "../dist-BwyGTnMu.mjs";
2
2
  import { n as computeSheetGeometry, r as resolveHubHostname, t as allTilePlacements } from "../sheet-geometry-DcpuGTCm.mjs";
3
3
  import { n as createFileDataPlaneHandler, s as parseRangeHeader, t as contentTypeFor } from "../model-download-service-Cp9f4dk6-CwUb5v3Y.mjs";
4
4
  import { spawn } from "node:child_process";