@camstack/system 1.2.60 → 1.2.61

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 (55) hide show
  1. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  2. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  3. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/alerts/alerts.addon.js +1 -1
  6. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  7. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  8. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  9. package/dist/builtins/console-logging/index.js +1 -1
  10. package/dist/builtins/console-logging/index.mjs +1 -1
  11. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  12. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  13. package/dist/builtins/device-manager/device-manager.addon.js +1 -1
  14. package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  15. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  16. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  17. package/dist/builtins/hub-forwarder/index.js +1 -1
  18. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  19. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  20. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  21. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  22. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  23. package/dist/builtins/local-network/local-network.addon.js +1 -1
  24. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  25. package/dist/builtins/loki-logging/index.js +1 -1
  26. package/dist/builtins/loki-logging/index.mjs +1 -1
  27. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  28. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  29. package/dist/builtins/platform-probe/index.js +1 -1
  30. package/dist/builtins/platform-probe/index.mjs +1 -1
  31. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  32. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  33. package/dist/builtins/snapshot/index.js +1 -1
  34. package/dist/builtins/snapshot/index.mjs +1 -1
  35. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  36. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  37. package/dist/builtins/sqlite-storage/prefix-range.d.ts +50 -0
  38. package/dist/builtins/sqlite-storage/query-bounds.d.ts +116 -0
  39. package/dist/builtins/sqlite-storage/sqlite-pragmas.d.ts +12 -0
  40. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +38 -2
  41. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +281 -19
  42. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +281 -19
  43. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  44. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  45. package/dist/builtins/system-config/system-config.addon.js +1 -1
  46. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  47. package/dist/builtins/winston-logging/index.js +1 -1
  48. package/dist/builtins/winston-logging/index.mjs +1 -1
  49. package/dist/{dist-Cis_iV-u.js → dist-BN681PgO.js} +501 -3
  50. package/dist/{dist-C5XpOjbI.mjs → dist-L6QPJWsr.mjs} +501 -3
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.js +131 -9
  53. package/dist/index.mjs +126 -9
  54. package/dist/kernel/heap-watch.d.ts +48 -1
  55. package/package.json +1 -1
@@ -13026,6 +13026,60 @@ var TrackFlagsSchema = z.object({
13026
13026
  * `trained` without a re-fetch. */
13027
13027
  retrainStatus: RetrainStatusSchema
13028
13028
  });
13029
+ z.union([z.literal(1), z.literal(2)]);
13030
+ /**
13031
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
13032
+ * the step and model that produced it — which is what makes the write rule
13033
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
13034
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
13035
+ *
13036
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
13037
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
13038
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
13039
+ * that value has no provenance, and the write rule lets ANY properly-attributed
13040
+ * write of the same tier replace it regardless of score.
13041
+ */
13042
+ var LabelAttributionSchema = z.object({
13043
+ stepId: z.string(),
13044
+ modelId: z.string().optional(),
13045
+ decidedAt: z.number()
13046
+ });
13047
+ /**
13048
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
13049
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
13050
+ * track and its events always answer the same question the same way.
13051
+ *
13052
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
13053
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
13054
+ * is tier 2, and each carries its own score + attribution.
13055
+ *
13056
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
13057
+ * finest thing known. Before 4g the single `label` column held the finest
13058
+ * value, so a consumer that has not been updated reads the tier-1 slot and
13059
+ * shows nothing on a species-only row; that is why the migration puts every
13060
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
13061
+ * and why the read surfaces were changed in the same train.
13062
+ *
13063
+ * **Writing it.** The slots are independent, which is the whole point: a
13064
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
13065
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
13066
+ * higher score wins. One rule, one implementation — see
13067
+ * `pipeline/label-tier.ts` in addon-post-analysis.
13068
+ */
13069
+ var TieredLabelFields = {
13070
+ /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
13071
+ label: z.string().optional(),
13072
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
13073
+ labelScore: z.number().optional(),
13074
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
13075
+ labelMeta: LabelAttributionSchema.optional(),
13076
+ /** Tier 2 — the instance. See {@link LabelTierSchema}. */
13077
+ subLabel: z.string().optional(),
13078
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
13079
+ subLabelScore: z.number().optional(),
13080
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
13081
+ subLabelMeta: LabelAttributionSchema.optional()
13082
+ };
13029
13083
  /** Per-camera slice of a training-export estimate. */
13030
13084
  var TrainingExportDeviceTotalsSchema = z.object({
13031
13085
  deviceId: z.number(),
@@ -13050,7 +13104,7 @@ var TrackSchema = z.object({
13050
13104
  trackId: z.string(),
13051
13105
  deviceId: z.number(),
13052
13106
  className: z.string(),
13053
- label: z.string().optional(),
13107
+ ...TieredLabelFields,
13054
13108
  producingDeviceName: z.string().optional(),
13055
13109
  /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
13056
13110
  source: TrackSourceSchema.optional(),
@@ -13171,7 +13225,7 @@ var ObjectEventSchema = z.object({
13171
13225
  /** Omitted in slim projection. */
13172
13226
  trackId: z.string().optional(),
13173
13227
  className: z.string(),
13174
- label: z.string().optional(),
13228
+ ...TieredLabelFields,
13175
13229
  /** Omitted in slim projection. */
13176
13230
  confidence: z.number().optional(),
13177
13231
  /** Heavy JSON — omitted in slim projection. */
@@ -13252,6 +13306,173 @@ var MediaFileSchema = z.object({
13252
13306
  * stored blob and a `?variant=thumb` rendering without fetching either.
13253
13307
  */
13254
13308
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
13309
+ /**
13310
+ * The MACRO tier of an annotation — a CLOSED set.
13311
+ *
13312
+ * This is what the exported detector predicts, so a typo here is a new class
13313
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
13314
+ * the whole point of the page is teaching the model things it does not know
13315
+ * yet, and constraining that vocabulary would make it useless.
13316
+ *
13317
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
13318
+ * `subLabel` is one of these values, in any casing, because once `person`
13319
+ * exists in both tiers "every person box" stops being answerable without
13320
+ * knowing every string anyone ever typed — and the damage is retroactive.
13321
+ */
13322
+ var RetrainMacroClassSchema = z.enum([
13323
+ "person",
13324
+ "vehicle",
13325
+ "animal",
13326
+ "package",
13327
+ "face",
13328
+ "plate"
13329
+ ]);
13330
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
13331
+ var RetrainAnnotationKindSchema = z.enum(["subject", "model_error"]);
13332
+ /** Did a human draw this box, or did the assist propose it? */
13333
+ var RetrainAnnotationSourceSchema = z.enum(["operator", "assist"]);
13334
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
13335
+ var RetrainBboxSchema = z.object({
13336
+ x: z.number(),
13337
+ y: z.number(),
13338
+ w: z.number(),
13339
+ h: z.number()
13340
+ });
13341
+ /**
13342
+ * One annotated subject.
13343
+ *
13344
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
13345
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
13346
+ * derived from it at export and never stored — storing them is how one feature
13347
+ * space ends up holding two crops of the same subject (D52).
13348
+ */
13349
+ var RetrainAnnotationSchema = z.object({
13350
+ id: z.string(),
13351
+ trackId: z.string(),
13352
+ deviceId: z.number(),
13353
+ /** The COPY in retrain storage — never the source track's media key. */
13354
+ mediaKey: z.string(),
13355
+ bbox: RetrainBboxSchema,
13356
+ macroClass: RetrainMacroClassSchema,
13357
+ label: z.string().optional(),
13358
+ subLabel: z.string().optional(),
13359
+ kind: RetrainAnnotationKindSchema,
13360
+ source: RetrainAnnotationSourceSchema,
13361
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
13362
+ assistModelId: z.string().optional(),
13363
+ assistScore: z.number().optional(),
13364
+ exportedInBatch: z.string().optional(),
13365
+ createdAt: z.number()
13366
+ });
13367
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
13368
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
13369
+ id: true,
13370
+ trackId: true,
13371
+ deviceId: true,
13372
+ mediaKey: true,
13373
+ createdAt: true,
13374
+ exportedInBatch: true
13375
+ });
13376
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
13377
+ var RetrainTrackSchema = z.object({
13378
+ trackId: z.string(),
13379
+ deviceId: z.number(),
13380
+ className: z.string(),
13381
+ label: z.string().optional(),
13382
+ firstSeen: z.number(),
13383
+ lastSeen: z.number(),
13384
+ /** How many frames the dataset already holds from this track. */
13385
+ frameCount: z.number().int(),
13386
+ /** How many subjects have been annotated on those frames. `0` with
13387
+ * `frameCount: 0` is exactly "staging, still to work". */
13388
+ annotationCount: z.number().int()
13389
+ });
13390
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
13391
+ var RetrainFrameCandidateSchema = z.object({
13392
+ mediaKey: z.string(),
13393
+ kind: MediaFileKindEnum,
13394
+ timestamp: z.number(),
13395
+ sizeBytes: z.number().int(),
13396
+ /** A copy of this original already exists — selecting it is free and cannot
13397
+ * fail, whatever became of the original. */
13398
+ copied: z.boolean()
13399
+ });
13400
+ /** A frame the dataset OWNS: bytes copied at selection time. */
13401
+ var RetrainFrameSchema = z.object({
13402
+ frameId: z.string(),
13403
+ deviceId: z.number(),
13404
+ trackId: z.string(),
13405
+ /** Provenance only. It may already point at nothing — that is expected. */
13406
+ sourceMediaKey: z.string(),
13407
+ sourceKind: MediaFileKindEnum,
13408
+ sizeBytes: z.number().int(),
13409
+ width: z.number().int(),
13410
+ height: z.number().int(),
13411
+ copiedAt: z.number()
13412
+ });
13413
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
13414
+ var RetrainCopyRefusalSchema = z.enum([
13415
+ "source-missing",
13416
+ "unreadable-image",
13417
+ "write-failed"
13418
+ ]);
13419
+ var RetrainFrameSelectionSchema = z.object({
13420
+ copied: z.array(RetrainFrameSchema).readonly(),
13421
+ refused: z.array(z.object({
13422
+ sourceMediaKey: z.string(),
13423
+ reason: RetrainCopyRefusalSchema
13424
+ })).readonly()
13425
+ });
13426
+ var RetrainFrameListSchema = z.object({
13427
+ candidates: z.array(RetrainFrameCandidateSchema).readonly(),
13428
+ copies: z.array(RetrainFrameSchema).readonly(),
13429
+ /** What the page pre-selects — the native key frame when one survives. */
13430
+ autoPickMediaKey: z.string().optional()
13431
+ });
13432
+ /** What the operator asked the assist to look for. */
13433
+ var RetrainAssistSubjectSchema = z.discriminatedUnion("kind", [z.object({
13434
+ kind: z.literal("package"),
13435
+ zone: RetrainBboxSchema.optional()
13436
+ }), z.object({
13437
+ kind: z.literal("objects"),
13438
+ modelId: z.string(),
13439
+ minScore: z.number().optional()
13440
+ })]);
13441
+ /**
13442
+ * The assist's answer — a discriminated union, because "the model saw nothing"
13443
+ * and "this node cannot run that model" lead to different next moves and a
13444
+ * nullable result cannot tell them apart.
13445
+ */
13446
+ var RetrainAssistResultSchema = z.discriminatedUnion("kind", [z.object({
13447
+ kind: z.literal("proposed"),
13448
+ modelId: z.string(),
13449
+ stepId: z.string(),
13450
+ minScore: z.number(),
13451
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
13452
+ proposals: z.array(RetrainAnnotationDraftSchema).readonly(),
13453
+ /** Returned by the runner but removed by the threshold. */
13454
+ belowThreshold: z.number().int()
13455
+ }), z.object({
13456
+ kind: z.literal("refused"),
13457
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
13458
+ reason: z.string(),
13459
+ detail: z.string().optional()
13460
+ })]);
13461
+ /** The outcome of a lifecycle move owned by the retrain page. */
13462
+ var RetrainTransitionResultSchema = z.object({
13463
+ trackId: z.string(),
13464
+ /** Where the track ended up, whatever happened. */
13465
+ retrainStatus: RetrainStatusSchema,
13466
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
13467
+ changed: z.boolean(),
13468
+ reason: z.enum([
13469
+ "unknown-track",
13470
+ "no-frames-copied",
13471
+ "not-staging",
13472
+ "not-trained",
13473
+ "unchanged"
13474
+ ]).optional()
13475
+ });
13255
13476
  var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
13256
13477
  var MAX_EVENT_QUERY_LIMIT = 5e3;
13257
13478
  var DeviceEventQueryInput = z.object({
@@ -13306,7 +13527,7 @@ var KeyEventSchema = z.object({
13306
13527
  /** Track start time (firstSeen). */
13307
13528
  timestamp: z.number(),
13308
13529
  className: z.string(),
13309
- label: z.string().optional(),
13530
+ ...TieredLabelFields,
13310
13531
  importance: z.number(),
13311
13532
  /** Highest-confidence ObjectEvent id for the track (empty when none). */
13312
13533
  bestEventId: z.string(),
@@ -13797,6 +14018,201 @@ var pipelineAnalyticsCapability = {
13797
14018
  kind: "query",
13798
14019
  auth: "admin"
13799
14020
  }),
14021
+ /**
14022
+ * The staging worklist for one camera, or for every camera that has one.
14023
+ *
14024
+ * Fetched ON DEMAND, over the staging set only — the page never scans
14025
+ * history, because making the working set small is the entire purpose of
14026
+ * the mark. Each row carries how many frames the dataset already holds from
14027
+ * the track and how many subjects were annotated on them, so
14028
+ * `frameCount: 0` reads as "still to work" without a second call per track.
14029
+ *
14030
+ * `auth: 'admin'`, unlike the viewer-level mark itself: marking a track is
14031
+ * curation you do while looking at it, but building the training set the
14032
+ * fleet's models are fine-tuned on is not.
14033
+ */
14034
+ listRetrainStaging: method(z.object({
14035
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
14036
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
14037
+ * route it at one camera's owner, and "every camera" would stop being
14038
+ * expressible at all. */
14039
+ deviceIds: z.array(z.number()).optional(),
14040
+ limit: z.number().int().min(1).max(500).optional()
14041
+ }), z.array(RetrainTrackSchema).readonly(), {
14042
+ kind: "query",
14043
+ auth: "admin"
14044
+ }),
14045
+ /**
14046
+ * What a track can contribute, and what it already has.
14047
+ *
14048
+ * `candidates` are the track's whole, unannotated frames — index rows only,
14049
+ * so this is cheap. `copies` are the frames already inside the dataset, and
14050
+ * a candidate whose copy exists is marked `copied: true`: selecting it again
14051
+ * is free and CANNOT fail, whatever became of the original.
14052
+ *
14053
+ * A crop, a thumbnail and `fullFrameBoxed` are never candidates. The last
14054
+ * one matters most: it has the model's own rectangle burned into the pixels,
14055
+ * and a detector trained on it learns to find a green line.
14056
+ */
14057
+ listRetrainFrames: method(z.object({ trackId: z.string() }), RetrainFrameListSchema, {
14058
+ kind: "query",
14059
+ auth: "admin"
14060
+ }),
14061
+ /**
14062
+ * COPY-ON-SELECT — the write that makes `trained` safe to evict.
14063
+ *
14064
+ * Selecting a frame copies its bytes into retrain storage immediately: not
14065
+ * a reference, not a lease. Once the copy exists the dataset no longer
14066
+ * depends on the track's media, which is exactly what lets D81 hand a
14067
+ * `trained` track back to retention.
14068
+ *
14069
+ * The order inside is load-bearing and is pinned by a test: an EXISTING
14070
+ * copy is returned without touching the source, so an original that
14071
+ * evaporated blocks the selection of THAT ORIGINAL and never the copy
14072
+ * already taken. Every refusal comes back named — a dropped selection is
14073
+ * never silent, on the wire or in the log.
14074
+ */
14075
+ selectRetrainFrames: method(z.object({
14076
+ deviceId: z.number(),
14077
+ trackId: z.string(),
14078
+ mediaKeys: z.array(z.string()).min(1)
14079
+ }), RetrainFrameSelectionSchema, {
14080
+ kind: "mutation",
14081
+ auth: "admin"
14082
+ }),
14083
+ /** Un-select a frame: its annotations go first, then the copy and its blob.
14084
+ * Deliberately destructive and deliberately explicit — it is the only way
14085
+ * a frame leaves the dataset before export. */
14086
+ deselectRetrainFrame: method(z.object({
14087
+ deviceId: z.number(),
14088
+ trackId: z.string(),
14089
+ frameId: z.string()
14090
+ }), z.object({
14091
+ removed: z.boolean(),
14092
+ removedAnnotations: z.number().int()
14093
+ }), {
14094
+ kind: "mutation",
14095
+ auth: "admin"
14096
+ }),
14097
+ /**
14098
+ * The pixels of ONE copied frame, base64.
14099
+ *
14100
+ * Through the cap rather than a data plane because it is genuinely one
14101
+ * frame at a time, on demand, at human speed — the shape D9/D18 permit
14102
+ * (what they forbid is frames crossing a boundary at frame RATE). The
14103
+ * annotation canvas needs the image and its exact dimensions in the same
14104
+ * answer: a canvas that places a normalised box against a size it guessed
14105
+ * draws every box in the wrong place.
14106
+ */
14107
+ getRetrainFrameImage: method(z.object({ frameId: z.string() }), z.object({
14108
+ base64: z.string(),
14109
+ width: z.number().int(),
14110
+ height: z.number().int()
14111
+ }), {
14112
+ kind: "query",
14113
+ auth: "admin"
14114
+ }),
14115
+ /**
14116
+ * Ask the pipeline what it sees, as a PROPOSAL.
14117
+ *
14118
+ * Runs through `pipelineRunner.runStatelessStep` on the COPIED frame, and
14119
+ * every box comes back as a draft with `source: 'assist'` plus the model and
14120
+ * score that produced it. The operator confirms, edits, adds and deletes;
14121
+ * nothing is stored until `saveRetrainAnnotations`.
14122
+ *
14123
+ * For packages the request is `rfdetr-package` on the ZONE CROP at 0.35 —
14124
+ * never the whole frame, where a package detector at that threshold proposes
14125
+ * furniture. A package request with no zone is REFUSED rather than widened,
14126
+ * because the silent widening would look like a bad model for as long as
14127
+ * nobody checked which rectangle it ran on.
14128
+ */
14129
+ proposeRetrainAnnotations: method(z.object({
14130
+ deviceId: z.number(),
14131
+ trackId: z.string(),
14132
+ frameId: z.string(),
14133
+ subject: RetrainAssistSubjectSchema,
14134
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
14135
+ nodeId: z.string().optional()
14136
+ }), RetrainAssistResultSchema, {
14137
+ kind: "mutation",
14138
+ auth: "admin"
14139
+ }),
14140
+ /** Every annotation on a track, oldest first. */
14141
+ listRetrainAnnotations: method(z.object({ trackId: z.string() }), z.array(RetrainAnnotationSchema).readonly(), {
14142
+ kind: "query",
14143
+ auth: "admin"
14144
+ }),
14145
+ /**
14146
+ * Replace EVERY annotation on one frame with the supplied set.
14147
+ *
14148
+ * Whole-frame replacement, not per-box upsert: the unit of ground truth is
14149
+ * the frame, and "the operator deleted a box" must be the same durable
14150
+ * outcome as "the operator never drew it". A per-box patch would let a frame
14151
+ * keep a box the operator removed on a surface that only knew about the
14152
+ * boxes it sent.
14153
+ *
14154
+ * Refuses a macro class typed into `label` or `subLabel` — the tiers are
14155
+ * separate and the guard is at the WRITE, because a mixed taxonomy cannot
14156
+ * be un-mixed by reading it.
14157
+ */
14158
+ saveRetrainAnnotations: method(z.object({
14159
+ deviceId: z.number(),
14160
+ trackId: z.string(),
14161
+ frameId: z.string(),
14162
+ annotations: z.array(RetrainAnnotationDraftSchema)
14163
+ }), z.array(RetrainAnnotationSchema).readonly(), {
14164
+ kind: "mutation",
14165
+ auth: "admin"
14166
+ }),
14167
+ /**
14168
+ * Finish with a track: `staging → trained`. **The only writer of that
14169
+ * state** — D81 shipped the column with it deliberately unreachable.
14170
+ *
14171
+ * Refuses a track the dataset holds no copies from. `trained` un-pins the
14172
+ * track's media, so completing without a copy is a delete order for material
14173
+ * nothing ever extracted anything from; that refusal IS the safety argument
14174
+ * of D81, expressed as a precondition.
14175
+ */
14176
+ completeRetrainTrack: method(z.object({
14177
+ deviceId: z.number(),
14178
+ trackId: z.string()
14179
+ }), RetrainTransitionResultSchema, {
14180
+ kind: "mutation",
14181
+ auth: "admin"
14182
+ }),
14183
+ /**
14184
+ * The deliberate return: `trained → staging`, for the rare case.
14185
+ *
14186
+ * The generic `setTrackFlags` toggle refuses this in both directions by
14187
+ * design (D81) — re-staging from a checkbox is how the same material gets
14188
+ * annotated twice under two ground truths. Doing it here means the operator
14189
+ * is looking at the annotations that already exist while they decide, and
14190
+ * those annotations are LEFT ALONE: "put this back" must not be a
14191
+ * destructive act wearing a navigational name.
14192
+ */
14193
+ restageRetrainTrack: method(z.object({
14194
+ deviceId: z.number(),
14195
+ trackId: z.string()
14196
+ }), RetrainTransitionResultSchema, {
14197
+ kind: "mutation",
14198
+ auth: "admin"
14199
+ }),
14200
+ /**
14201
+ * Where to download the ANNOTATED dataset.
14202
+ *
14203
+ * The sibling of `getTrainingExportUrl` and deliberately not the same
14204
+ * archive: that one streams a marked track's stored media verbatim, this one
14205
+ * streams the retrain COPIES plus an `annotations.json` carrying, for every
14206
+ * subject, the canonical full-frame box AND the geometry derived for each
14207
+ * model shape (letterboxed root / zone-cropped package / subject-cropped
14208
+ * classifier). Derived at export, never stored — one box in, three shapes
14209
+ * out, so two crops of the same subject can never end up in one feature
14210
+ * space (D52).
14211
+ */
14212
+ getRetrainExportUrl: method(z.object({ deviceIds: z.array(z.number()).optional() }), z.object({ url: z.string() }), {
14213
+ kind: "query",
14214
+ auth: "admin"
14215
+ }),
13800
14216
  getEventMedia: method(z.object({
13801
14217
  eventId: z.string(),
13802
14218
  kind: MediaFileKindEnum.optional()
@@ -14614,6 +15030,22 @@ var DetailResultSchema = z.object({
14614
15030
  bbox: NativeCropBboxSchema.optional(),
14615
15031
  embedding: z.string().optional(),
14616
15032
  label: z.string().optional(),
15033
+ /**
15034
+ * The tier `label` occupies, copied VERBATIM from the producing step's
15035
+ * `StepDefinition.labelTier` (roadmap 4g). Present only when `label` is.
15036
+ *
15037
+ * It rides the wire rather than being resolved by the consumer because the
15038
+ * declaration lives with the step definition, which only the executing node
15039
+ * has: post-analysis holds no step registry, and re-deriving the tier from
15040
+ * `className` there would be exactly the inference this model exists to
15041
+ * forbid. A `label` that arrives WITHOUT this field is refused by the write
15042
+ * rule and logged (`label tier undeclared`) — an older runner therefore
15043
+ * stops enriching rather than guessing, which is why addon-pipeline is
15044
+ * deployed BEFORE addon-post-analysis.
15045
+ */
15046
+ labelTier: z.union([z.literal(1), z.literal(2)]).optional(),
15047
+ /** Model that produced `label` — carried into the tier's attribution. */
15048
+ labelModelId: z.string().optional(),
14617
15049
  alignedCropJpeg: z.string().optional(),
14618
15050
  /** Face short side (px) measured on the NATIVE crop surface. The `bbox`
14619
15051
  * above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
@@ -29171,6 +29603,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
29171
29603
  addonId: null,
29172
29604
  access: "delete"
29173
29605
  },
29606
+ "pipelineAnalytics.completeRetrainTrack": {
29607
+ capName: "pipeline-analytics",
29608
+ capScope: "device",
29609
+ addonId: null,
29610
+ access: "create"
29611
+ },
29174
29612
  "pipelineAnalytics.deleteDeviceEvents": {
29175
29613
  capName: "pipeline-analytics",
29176
29614
  capScope: "device",
@@ -29183,6 +29621,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
29183
29621
  addonId: null,
29184
29622
  access: "delete"
29185
29623
  },
29624
+ "pipelineAnalytics.deselectRetrainFrame": {
29625
+ capName: "pipeline-analytics",
29626
+ capScope: "device",
29627
+ addonId: null,
29628
+ access: "create"
29629
+ },
29186
29630
  "pipelineAnalytics.getActiveTracks": {
29187
29631
  capName: "pipeline-analytics",
29188
29632
  capScope: "device",
@@ -29243,6 +29687,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
29243
29687
  addonId: null,
29244
29688
  access: "view"
29245
29689
  },
29690
+ "pipelineAnalytics.getRetrainExportUrl": {
29691
+ capName: "pipeline-analytics",
29692
+ capScope: "device",
29693
+ addonId: null,
29694
+ access: "view"
29695
+ },
29696
+ "pipelineAnalytics.getRetrainFrameImage": {
29697
+ capName: "pipeline-analytics",
29698
+ capScope: "device",
29699
+ addonId: null,
29700
+ access: "view"
29701
+ },
29246
29702
  "pipelineAnalytics.getSensorEvents": {
29247
29703
  capName: "pipeline-analytics",
29248
29704
  capScope: "device",
@@ -29297,6 +29753,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
29297
29753
  addonId: null,
29298
29754
  access: "view"
29299
29755
  },
29756
+ "pipelineAnalytics.listRetrainAnnotations": {
29757
+ capName: "pipeline-analytics",
29758
+ capScope: "device",
29759
+ addonId: null,
29760
+ access: "view"
29761
+ },
29762
+ "pipelineAnalytics.listRetrainFrames": {
29763
+ capName: "pipeline-analytics",
29764
+ capScope: "device",
29765
+ addonId: null,
29766
+ access: "view"
29767
+ },
29768
+ "pipelineAnalytics.listRetrainStaging": {
29769
+ capName: "pipeline-analytics",
29770
+ capScope: "device",
29771
+ addonId: null,
29772
+ access: "view"
29773
+ },
29300
29774
  "pipelineAnalytics.listTrackMedia": {
29301
29775
  capName: "pipeline-analytics",
29302
29776
  capScope: "device",
@@ -29309,6 +29783,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
29309
29783
  addonId: null,
29310
29784
  access: "view"
29311
29785
  },
29786
+ "pipelineAnalytics.proposeRetrainAnnotations": {
29787
+ capName: "pipeline-analytics",
29788
+ capScope: "device",
29789
+ addonId: null,
29790
+ access: "create"
29791
+ },
29312
29792
  "pipelineAnalytics.pruneEvents": {
29313
29793
  capName: "pipeline-analytics",
29314
29794
  capScope: "device",
@@ -29339,12 +29819,30 @@ var METHOD_ACCESS_MAP = Object.freeze({
29339
29819
  addonId: null,
29340
29820
  access: "create"
29341
29821
  },
29822
+ "pipelineAnalytics.restageRetrainTrack": {
29823
+ capName: "pipeline-analytics",
29824
+ capScope: "device",
29825
+ addonId: null,
29826
+ access: "create"
29827
+ },
29828
+ "pipelineAnalytics.saveRetrainAnnotations": {
29829
+ capName: "pipeline-analytics",
29830
+ capScope: "device",
29831
+ addonId: null,
29832
+ access: "create"
29833
+ },
29342
29834
  "pipelineAnalytics.searchObjectEvents": {
29343
29835
  capName: "pipeline-analytics",
29344
29836
  capScope: "device",
29345
29837
  addonId: null,
29346
29838
  access: "view"
29347
29839
  },
29840
+ "pipelineAnalytics.selectRetrainFrames": {
29841
+ capName: "pipeline-analytics",
29842
+ capScope: "device",
29843
+ addonId: null,
29844
+ access: "create"
29845
+ },
29348
29846
  "pipelineAnalytics.setTrackFlags": {
29349
29847
  capName: "pipeline-analytics",
29350
29848
  capScope: "device",
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { startHeapWatch, buildHeapSample, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, } from './kernel/heap-watch.js';
2
- export type { HeapSample, HeapWatchSink } from './kernel/heap-watch.js';
1
+ export { startHeapWatch, buildHeapSample, createV8Reclaimer, shouldReclaim, strandedMb, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, HEAP_RECLAIM_TRIGGER_MB, HEAP_RECLAIM_MIN_INTERVAL_MS, } from './kernel/heap-watch.js';
2
+ export type { HeapSample, HeapWatchSink, HeapReclaimer, HeapReclaimOptions, } from './kernel/heap-watch.js';
3
3
  export { ensureBinary, downloadBinary, findInPath, getPlatformInfo, buildBinaryPath, ensureFfmpeg, getFfmpegDownloadUrl, ensurePython, installPythonPackages, installPythonRequirements, getPythonDownloadUrl, PYTHON_VERSION, } from '@camstack/types/node';
4
4
  export type { PlatformInfo } from '@camstack/types/node';
5
5
  export { ALL_CAPABILITY_DEFINITIONS, METHOD_ACCESS_MAP, expandCapMethods, isArrayOutputSchema, isCollectionArrayMethod, addonSettingsCapability, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, } from '@camstack/types';