@camstack/types 1.2.44 → 1.2.45

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/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_event_category = require("./event-category-BE4PDZ_3.js");
3
- const require_sleep = require("./sleep-eiC10_cX.js");
3
+ const require_sleep = require("./sleep-BOI-sVEA.js");
4
4
  const require_fmp4_box_splitter = require("./fmp4-box-splitter-BkWH7O3L.js");
5
5
  const require_enums = require("./enums.js");
6
6
  const require_err_msg = require("./err-msg-COpsHMw2.js");
@@ -12380,6 +12380,76 @@ var TrackFlagsSchema = zod.z.object({
12380
12380
  * `trained` without a re-fetch. */
12381
12381
  retrainStatus: RetrainStatusSchema
12382
12382
  });
12383
+ /**
12384
+ * WHICH tier a label occupies. The slot a label lands in is DECLARED by the
12385
+ * step that produced it (`StepDefinition.labelTier`), never inferred from the
12386
+ * text or the step's name.
12387
+ *
12388
+ * - `1` — a SUB-CLASS: finer than the macro class, still a taxonomy token.
12389
+ * `animal-type` (`dog`, `bird`), `vehicle-type` (`van`), and the root
12390
+ * detector's own raw class when it is finer than the macro it maps to.
12391
+ * - `2` — an INSTANCE: the finest thing said about this subject.
12392
+ * `species` (`Turdus migratorius`), `identity` (`Alice`), `plate-text`.
12393
+ *
12394
+ * The macro class itself (`person`, `vehicle`, `animal`, `package`, `face`,
12395
+ * `plate`, `audio`) is NOT a tier — it is `className`, and a macro token
12396
+ * offered for either label slot is refused (2026-08-07 rule; the refusal is
12397
+ * logged as `label tier collapse refused`).
12398
+ */
12399
+ var LabelTierSchema = zod.z.union([zod.z.literal(1), zod.z.literal(2)]);
12400
+ /**
12401
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
12402
+ * the step and model that produced it — which is what makes the write rule
12403
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
12404
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
12405
+ *
12406
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
12407
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
12408
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
12409
+ * that value has no provenance, and the write rule lets ANY properly-attributed
12410
+ * write of the same tier replace it regardless of score.
12411
+ */
12412
+ var LabelAttributionSchema = zod.z.object({
12413
+ stepId: zod.z.string(),
12414
+ modelId: zod.z.string().optional(),
12415
+ decidedAt: zod.z.number()
12416
+ });
12417
+ /**
12418
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
12419
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
12420
+ * track and its events always answer the same question the same way.
12421
+ *
12422
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
12423
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
12424
+ * is tier 2, and each carries its own score + attribution.
12425
+ *
12426
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
12427
+ * finest thing known. Before 4g the single `label` column held the finest
12428
+ * value, so a consumer that has not been updated reads the tier-1 slot and
12429
+ * shows nothing on a species-only row; that is why the migration puts every
12430
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
12431
+ * and why the read surfaces were changed in the same train.
12432
+ *
12433
+ * **Writing it.** The slots are independent, which is the whole point: a
12434
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
12435
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
12436
+ * higher score wins. One rule, one implementation — see
12437
+ * `pipeline/label-tier.ts` in addon-post-analysis.
12438
+ */
12439
+ var TieredLabelFields = {
12440
+ /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
12441
+ label: zod.z.string().optional(),
12442
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
12443
+ labelScore: zod.z.number().optional(),
12444
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
12445
+ labelMeta: LabelAttributionSchema.optional(),
12446
+ /** Tier 2 — the instance. See {@link LabelTierSchema}. */
12447
+ subLabel: zod.z.string().optional(),
12448
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
12449
+ subLabelScore: zod.z.number().optional(),
12450
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
12451
+ subLabelMeta: LabelAttributionSchema.optional()
12452
+ };
12383
12453
  /** Per-camera slice of a training-export estimate. */
12384
12454
  var TrainingExportDeviceTotalsSchema = zod.z.object({
12385
12455
  deviceId: zod.z.number(),
@@ -12404,7 +12474,7 @@ var TrackSchema = zod.z.object({
12404
12474
  trackId: zod.z.string(),
12405
12475
  deviceId: zod.z.number(),
12406
12476
  className: zod.z.string(),
12407
- label: zod.z.string().optional(),
12477
+ ...TieredLabelFields,
12408
12478
  producingDeviceName: zod.z.string().optional(),
12409
12479
  /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
12410
12480
  source: TrackSourceSchema.optional(),
@@ -12525,7 +12595,7 @@ var ObjectEventSchema = zod.z.object({
12525
12595
  /** Omitted in slim projection. */
12526
12596
  trackId: zod.z.string().optional(),
12527
12597
  className: zod.z.string(),
12528
- label: zod.z.string().optional(),
12598
+ ...TieredLabelFields,
12529
12599
  /** Omitted in slim projection. */
12530
12600
  confidence: zod.z.number().optional(),
12531
12601
  /** Heavy JSON — omitted in slim projection. */
@@ -12606,6 +12676,173 @@ var MediaFileSchema = zod.z.object({
12606
12676
  * stored blob and a `?variant=thumb` rendering without fetching either.
12607
12677
  */
12608
12678
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
12679
+ /**
12680
+ * The MACRO tier of an annotation — a CLOSED set.
12681
+ *
12682
+ * This is what the exported detector predicts, so a typo here is a new class
12683
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
12684
+ * the whole point of the page is teaching the model things it does not know
12685
+ * yet, and constraining that vocabulary would make it useless.
12686
+ *
12687
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
12688
+ * `subLabel` is one of these values, in any casing, because once `person`
12689
+ * exists in both tiers "every person box" stops being answerable without
12690
+ * knowing every string anyone ever typed — and the damage is retroactive.
12691
+ */
12692
+ var RetrainMacroClassSchema = zod.z.enum([
12693
+ "person",
12694
+ "vehicle",
12695
+ "animal",
12696
+ "package",
12697
+ "face",
12698
+ "plate"
12699
+ ]);
12700
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
12701
+ var RetrainAnnotationKindSchema = zod.z.enum(["subject", "model_error"]);
12702
+ /** Did a human draw this box, or did the assist propose it? */
12703
+ var RetrainAnnotationSourceSchema = zod.z.enum(["operator", "assist"]);
12704
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
12705
+ var RetrainBboxSchema = zod.z.object({
12706
+ x: zod.z.number(),
12707
+ y: zod.z.number(),
12708
+ w: zod.z.number(),
12709
+ h: zod.z.number()
12710
+ });
12711
+ /**
12712
+ * One annotated subject.
12713
+ *
12714
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
12715
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
12716
+ * derived from it at export and never stored — storing them is how one feature
12717
+ * space ends up holding two crops of the same subject (D52).
12718
+ */
12719
+ var RetrainAnnotationSchema = zod.z.object({
12720
+ id: zod.z.string(),
12721
+ trackId: zod.z.string(),
12722
+ deviceId: zod.z.number(),
12723
+ /** The COPY in retrain storage — never the source track's media key. */
12724
+ mediaKey: zod.z.string(),
12725
+ bbox: RetrainBboxSchema,
12726
+ macroClass: RetrainMacroClassSchema,
12727
+ label: zod.z.string().optional(),
12728
+ subLabel: zod.z.string().optional(),
12729
+ kind: RetrainAnnotationKindSchema,
12730
+ source: RetrainAnnotationSourceSchema,
12731
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
12732
+ assistModelId: zod.z.string().optional(),
12733
+ assistScore: zod.z.number().optional(),
12734
+ exportedInBatch: zod.z.string().optional(),
12735
+ createdAt: zod.z.number()
12736
+ });
12737
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
12738
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
12739
+ id: true,
12740
+ trackId: true,
12741
+ deviceId: true,
12742
+ mediaKey: true,
12743
+ createdAt: true,
12744
+ exportedInBatch: true
12745
+ });
12746
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
12747
+ var RetrainTrackSchema = zod.z.object({
12748
+ trackId: zod.z.string(),
12749
+ deviceId: zod.z.number(),
12750
+ className: zod.z.string(),
12751
+ label: zod.z.string().optional(),
12752
+ firstSeen: zod.z.number(),
12753
+ lastSeen: zod.z.number(),
12754
+ /** How many frames the dataset already holds from this track. */
12755
+ frameCount: zod.z.number().int(),
12756
+ /** How many subjects have been annotated on those frames. `0` with
12757
+ * `frameCount: 0` is exactly "staging, still to work". */
12758
+ annotationCount: zod.z.number().int()
12759
+ });
12760
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
12761
+ var RetrainFrameCandidateSchema = zod.z.object({
12762
+ mediaKey: zod.z.string(),
12763
+ kind: MediaFileKindEnum,
12764
+ timestamp: zod.z.number(),
12765
+ sizeBytes: zod.z.number().int(),
12766
+ /** A copy of this original already exists — selecting it is free and cannot
12767
+ * fail, whatever became of the original. */
12768
+ copied: zod.z.boolean()
12769
+ });
12770
+ /** A frame the dataset OWNS: bytes copied at selection time. */
12771
+ var RetrainFrameSchema = zod.z.object({
12772
+ frameId: zod.z.string(),
12773
+ deviceId: zod.z.number(),
12774
+ trackId: zod.z.string(),
12775
+ /** Provenance only. It may already point at nothing — that is expected. */
12776
+ sourceMediaKey: zod.z.string(),
12777
+ sourceKind: MediaFileKindEnum,
12778
+ sizeBytes: zod.z.number().int(),
12779
+ width: zod.z.number().int(),
12780
+ height: zod.z.number().int(),
12781
+ copiedAt: zod.z.number()
12782
+ });
12783
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
12784
+ var RetrainCopyRefusalSchema = zod.z.enum([
12785
+ "source-missing",
12786
+ "unreadable-image",
12787
+ "write-failed"
12788
+ ]);
12789
+ var RetrainFrameSelectionSchema = zod.z.object({
12790
+ copied: zod.z.array(RetrainFrameSchema).readonly(),
12791
+ refused: zod.z.array(zod.z.object({
12792
+ sourceMediaKey: zod.z.string(),
12793
+ reason: RetrainCopyRefusalSchema
12794
+ })).readonly()
12795
+ });
12796
+ var RetrainFrameListSchema = zod.z.object({
12797
+ candidates: zod.z.array(RetrainFrameCandidateSchema).readonly(),
12798
+ copies: zod.z.array(RetrainFrameSchema).readonly(),
12799
+ /** What the page pre-selects — the native key frame when one survives. */
12800
+ autoPickMediaKey: zod.z.string().optional()
12801
+ });
12802
+ /** What the operator asked the assist to look for. */
12803
+ var RetrainAssistSubjectSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
12804
+ kind: zod.z.literal("package"),
12805
+ zone: RetrainBboxSchema.optional()
12806
+ }), zod.z.object({
12807
+ kind: zod.z.literal("objects"),
12808
+ modelId: zod.z.string(),
12809
+ minScore: zod.z.number().optional()
12810
+ })]);
12811
+ /**
12812
+ * The assist's answer — a discriminated union, because "the model saw nothing"
12813
+ * and "this node cannot run that model" lead to different next moves and a
12814
+ * nullable result cannot tell them apart.
12815
+ */
12816
+ var RetrainAssistResultSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
12817
+ kind: zod.z.literal("proposed"),
12818
+ modelId: zod.z.string(),
12819
+ stepId: zod.z.string(),
12820
+ minScore: zod.z.number(),
12821
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
12822
+ proposals: zod.z.array(RetrainAnnotationDraftSchema).readonly(),
12823
+ /** Returned by the runner but removed by the threshold. */
12824
+ belowThreshold: zod.z.number().int()
12825
+ }), zod.z.object({
12826
+ kind: zod.z.literal("refused"),
12827
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
12828
+ reason: zod.z.string(),
12829
+ detail: zod.z.string().optional()
12830
+ })]);
12831
+ /** The outcome of a lifecycle move owned by the retrain page. */
12832
+ var RetrainTransitionResultSchema = zod.z.object({
12833
+ trackId: zod.z.string(),
12834
+ /** Where the track ended up, whatever happened. */
12835
+ retrainStatus: RetrainStatusSchema,
12836
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
12837
+ changed: zod.z.boolean(),
12838
+ reason: zod.z.enum([
12839
+ "unknown-track",
12840
+ "no-frames-copied",
12841
+ "not-staging",
12842
+ "not-trained",
12843
+ "unchanged"
12844
+ ]).optional()
12845
+ });
12609
12846
  var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
12610
12847
  var MAX_EVENT_QUERY_LIMIT = 5e3;
12611
12848
  var DeviceEventQueryInput = zod.z.object({
@@ -12660,7 +12897,7 @@ var KeyEventSchema = zod.z.object({
12660
12897
  /** Track start time (firstSeen). */
12661
12898
  timestamp: zod.z.number(),
12662
12899
  className: zod.z.string(),
12663
- label: zod.z.string().optional(),
12900
+ ...TieredLabelFields,
12664
12901
  importance: zod.z.number(),
12665
12902
  /** Highest-confidence ObjectEvent id for the track (empty when none). */
12666
12903
  bestEventId: zod.z.string(),
@@ -13151,6 +13388,201 @@ var pipelineAnalyticsCapability = {
13151
13388
  kind: "query",
13152
13389
  auth: "admin"
13153
13390
  }),
13391
+ /**
13392
+ * The staging worklist for one camera, or for every camera that has one.
13393
+ *
13394
+ * Fetched ON DEMAND, over the staging set only — the page never scans
13395
+ * history, because making the working set small is the entire purpose of
13396
+ * the mark. Each row carries how many frames the dataset already holds from
13397
+ * the track and how many subjects were annotated on them, so
13398
+ * `frameCount: 0` reads as "still to work" without a second call per track.
13399
+ *
13400
+ * `auth: 'admin'`, unlike the viewer-level mark itself: marking a track is
13401
+ * curation you do while looking at it, but building the training set the
13402
+ * fleet's models are fine-tuned on is not.
13403
+ */
13404
+ listRetrainStaging: require_sleep.method(zod.z.object({
13405
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
13406
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
13407
+ * route it at one camera's owner, and "every camera" would stop being
13408
+ * expressible at all. */
13409
+ deviceIds: zod.z.array(zod.z.number()).optional(),
13410
+ limit: zod.z.number().int().min(1).max(500).optional()
13411
+ }), zod.z.array(RetrainTrackSchema).readonly(), {
13412
+ kind: "query",
13413
+ auth: "admin"
13414
+ }),
13415
+ /**
13416
+ * What a track can contribute, and what it already has.
13417
+ *
13418
+ * `candidates` are the track's whole, unannotated frames — index rows only,
13419
+ * so this is cheap. `copies` are the frames already inside the dataset, and
13420
+ * a candidate whose copy exists is marked `copied: true`: selecting it again
13421
+ * is free and CANNOT fail, whatever became of the original.
13422
+ *
13423
+ * A crop, a thumbnail and `fullFrameBoxed` are never candidates. The last
13424
+ * one matters most: it has the model's own rectangle burned into the pixels,
13425
+ * and a detector trained on it learns to find a green line.
13426
+ */
13427
+ listRetrainFrames: require_sleep.method(zod.z.object({ trackId: zod.z.string() }), RetrainFrameListSchema, {
13428
+ kind: "query",
13429
+ auth: "admin"
13430
+ }),
13431
+ /**
13432
+ * COPY-ON-SELECT — the write that makes `trained` safe to evict.
13433
+ *
13434
+ * Selecting a frame copies its bytes into retrain storage immediately: not
13435
+ * a reference, not a lease. Once the copy exists the dataset no longer
13436
+ * depends on the track's media, which is exactly what lets D81 hand a
13437
+ * `trained` track back to retention.
13438
+ *
13439
+ * The order inside is load-bearing and is pinned by a test: an EXISTING
13440
+ * copy is returned without touching the source, so an original that
13441
+ * evaporated blocks the selection of THAT ORIGINAL and never the copy
13442
+ * already taken. Every refusal comes back named — a dropped selection is
13443
+ * never silent, on the wire or in the log.
13444
+ */
13445
+ selectRetrainFrames: require_sleep.method(zod.z.object({
13446
+ deviceId: zod.z.number(),
13447
+ trackId: zod.z.string(),
13448
+ mediaKeys: zod.z.array(zod.z.string()).min(1)
13449
+ }), RetrainFrameSelectionSchema, {
13450
+ kind: "mutation",
13451
+ auth: "admin"
13452
+ }),
13453
+ /** Un-select a frame: its annotations go first, then the copy and its blob.
13454
+ * Deliberately destructive and deliberately explicit — it is the only way
13455
+ * a frame leaves the dataset before export. */
13456
+ deselectRetrainFrame: require_sleep.method(zod.z.object({
13457
+ deviceId: zod.z.number(),
13458
+ trackId: zod.z.string(),
13459
+ frameId: zod.z.string()
13460
+ }), zod.z.object({
13461
+ removed: zod.z.boolean(),
13462
+ removedAnnotations: zod.z.number().int()
13463
+ }), {
13464
+ kind: "mutation",
13465
+ auth: "admin"
13466
+ }),
13467
+ /**
13468
+ * The pixels of ONE copied frame, base64.
13469
+ *
13470
+ * Through the cap rather than a data plane because it is genuinely one
13471
+ * frame at a time, on demand, at human speed — the shape D9/D18 permit
13472
+ * (what they forbid is frames crossing a boundary at frame RATE). The
13473
+ * annotation canvas needs the image and its exact dimensions in the same
13474
+ * answer: a canvas that places a normalised box against a size it guessed
13475
+ * draws every box in the wrong place.
13476
+ */
13477
+ getRetrainFrameImage: require_sleep.method(zod.z.object({ frameId: zod.z.string() }), zod.z.object({
13478
+ base64: zod.z.string(),
13479
+ width: zod.z.number().int(),
13480
+ height: zod.z.number().int()
13481
+ }), {
13482
+ kind: "query",
13483
+ auth: "admin"
13484
+ }),
13485
+ /**
13486
+ * Ask the pipeline what it sees, as a PROPOSAL.
13487
+ *
13488
+ * Runs through `pipelineRunner.runStatelessStep` on the COPIED frame, and
13489
+ * every box comes back as a draft with `source: 'assist'` plus the model and
13490
+ * score that produced it. The operator confirms, edits, adds and deletes;
13491
+ * nothing is stored until `saveRetrainAnnotations`.
13492
+ *
13493
+ * For packages the request is `rfdetr-package` on the ZONE CROP at 0.35 —
13494
+ * never the whole frame, where a package detector at that threshold proposes
13495
+ * furniture. A package request with no zone is REFUSED rather than widened,
13496
+ * because the silent widening would look like a bad model for as long as
13497
+ * nobody checked which rectangle it ran on.
13498
+ */
13499
+ proposeRetrainAnnotations: require_sleep.method(zod.z.object({
13500
+ deviceId: zod.z.number(),
13501
+ trackId: zod.z.string(),
13502
+ frameId: zod.z.string(),
13503
+ subject: RetrainAssistSubjectSchema,
13504
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
13505
+ nodeId: zod.z.string().optional()
13506
+ }), RetrainAssistResultSchema, {
13507
+ kind: "mutation",
13508
+ auth: "admin"
13509
+ }),
13510
+ /** Every annotation on a track, oldest first. */
13511
+ listRetrainAnnotations: require_sleep.method(zod.z.object({ trackId: zod.z.string() }), zod.z.array(RetrainAnnotationSchema).readonly(), {
13512
+ kind: "query",
13513
+ auth: "admin"
13514
+ }),
13515
+ /**
13516
+ * Replace EVERY annotation on one frame with the supplied set.
13517
+ *
13518
+ * Whole-frame replacement, not per-box upsert: the unit of ground truth is
13519
+ * the frame, and "the operator deleted a box" must be the same durable
13520
+ * outcome as "the operator never drew it". A per-box patch would let a frame
13521
+ * keep a box the operator removed on a surface that only knew about the
13522
+ * boxes it sent.
13523
+ *
13524
+ * Refuses a macro class typed into `label` or `subLabel` — the tiers are
13525
+ * separate and the guard is at the WRITE, because a mixed taxonomy cannot
13526
+ * be un-mixed by reading it.
13527
+ */
13528
+ saveRetrainAnnotations: require_sleep.method(zod.z.object({
13529
+ deviceId: zod.z.number(),
13530
+ trackId: zod.z.string(),
13531
+ frameId: zod.z.string(),
13532
+ annotations: zod.z.array(RetrainAnnotationDraftSchema)
13533
+ }), zod.z.array(RetrainAnnotationSchema).readonly(), {
13534
+ kind: "mutation",
13535
+ auth: "admin"
13536
+ }),
13537
+ /**
13538
+ * Finish with a track: `staging → trained`. **The only writer of that
13539
+ * state** — D81 shipped the column with it deliberately unreachable.
13540
+ *
13541
+ * Refuses a track the dataset holds no copies from. `trained` un-pins the
13542
+ * track's media, so completing without a copy is a delete order for material
13543
+ * nothing ever extracted anything from; that refusal IS the safety argument
13544
+ * of D81, expressed as a precondition.
13545
+ */
13546
+ completeRetrainTrack: require_sleep.method(zod.z.object({
13547
+ deviceId: zod.z.number(),
13548
+ trackId: zod.z.string()
13549
+ }), RetrainTransitionResultSchema, {
13550
+ kind: "mutation",
13551
+ auth: "admin"
13552
+ }),
13553
+ /**
13554
+ * The deliberate return: `trained → staging`, for the rare case.
13555
+ *
13556
+ * The generic `setTrackFlags` toggle refuses this in both directions by
13557
+ * design (D81) — re-staging from a checkbox is how the same material gets
13558
+ * annotated twice under two ground truths. Doing it here means the operator
13559
+ * is looking at the annotations that already exist while they decide, and
13560
+ * those annotations are LEFT ALONE: "put this back" must not be a
13561
+ * destructive act wearing a navigational name.
13562
+ */
13563
+ restageRetrainTrack: require_sleep.method(zod.z.object({
13564
+ deviceId: zod.z.number(),
13565
+ trackId: zod.z.string()
13566
+ }), RetrainTransitionResultSchema, {
13567
+ kind: "mutation",
13568
+ auth: "admin"
13569
+ }),
13570
+ /**
13571
+ * Where to download the ANNOTATED dataset.
13572
+ *
13573
+ * The sibling of `getTrainingExportUrl` and deliberately not the same
13574
+ * archive: that one streams a marked track's stored media verbatim, this one
13575
+ * streams the retrain COPIES plus an `annotations.json` carrying, for every
13576
+ * subject, the canonical full-frame box AND the geometry derived for each
13577
+ * model shape (letterboxed root / zone-cropped package / subject-cropped
13578
+ * classifier). Derived at export, never stored — one box in, three shapes
13579
+ * out, so two crops of the same subject can never end up in one feature
13580
+ * space (D52).
13581
+ */
13582
+ getRetrainExportUrl: require_sleep.method(zod.z.object({ deviceIds: zod.z.array(zod.z.number()).optional() }), zod.z.object({ url: zod.z.string() }), {
13583
+ kind: "query",
13584
+ auth: "admin"
13585
+ }),
13154
13586
  getEventMedia: require_sleep.method(zod.z.object({
13155
13587
  eventId: zod.z.string(),
13156
13588
  kind: MediaFileKindEnum.optional()
@@ -13977,6 +14409,22 @@ var DetailResultSchema = zod.z.object({
13977
14409
  bbox: NativeCropBboxSchema.optional(),
13978
14410
  embedding: zod.z.string().optional(),
13979
14411
  label: zod.z.string().optional(),
14412
+ /**
14413
+ * The tier `label` occupies, copied VERBATIM from the producing step's
14414
+ * `StepDefinition.labelTier` (roadmap 4g). Present only when `label` is.
14415
+ *
14416
+ * It rides the wire rather than being resolved by the consumer because the
14417
+ * declaration lives with the step definition, which only the executing node
14418
+ * has: post-analysis holds no step registry, and re-deriving the tier from
14419
+ * `className` there would be exactly the inference this model exists to
14420
+ * forbid. A `label` that arrives WITHOUT this field is refused by the write
14421
+ * rule and logged (`label tier undeclared`) — an older runner therefore
14422
+ * stops enriching rather than guessing, which is why addon-pipeline is
14423
+ * deployed BEFORE addon-post-analysis.
14424
+ */
14425
+ labelTier: zod.z.union([zod.z.literal(1), zod.z.literal(2)]).optional(),
14426
+ /** Model that produced `label` — carried into the tier's attribution. */
14427
+ labelModelId: zod.z.string().optional(),
13980
14428
  alignedCropJpeg: zod.z.string().optional(),
13981
14429
  /** Face short side (px) measured on the NATIVE crop surface. The `bbox`
13982
14430
  * above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
@@ -31994,6 +32442,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
31994
32442
  addonId: null,
31995
32443
  access: "delete"
31996
32444
  },
32445
+ "pipelineAnalytics.completeRetrainTrack": {
32446
+ capName: "pipeline-analytics",
32447
+ capScope: "device",
32448
+ addonId: null,
32449
+ access: "create"
32450
+ },
31997
32451
  "pipelineAnalytics.deleteDeviceEvents": {
31998
32452
  capName: "pipeline-analytics",
31999
32453
  capScope: "device",
@@ -32006,6 +32460,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32006
32460
  addonId: null,
32007
32461
  access: "delete"
32008
32462
  },
32463
+ "pipelineAnalytics.deselectRetrainFrame": {
32464
+ capName: "pipeline-analytics",
32465
+ capScope: "device",
32466
+ addonId: null,
32467
+ access: "create"
32468
+ },
32009
32469
  "pipelineAnalytics.getActiveTracks": {
32010
32470
  capName: "pipeline-analytics",
32011
32471
  capScope: "device",
@@ -32066,6 +32526,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
32066
32526
  addonId: null,
32067
32527
  access: "view"
32068
32528
  },
32529
+ "pipelineAnalytics.getRetrainExportUrl": {
32530
+ capName: "pipeline-analytics",
32531
+ capScope: "device",
32532
+ addonId: null,
32533
+ access: "view"
32534
+ },
32535
+ "pipelineAnalytics.getRetrainFrameImage": {
32536
+ capName: "pipeline-analytics",
32537
+ capScope: "device",
32538
+ addonId: null,
32539
+ access: "view"
32540
+ },
32069
32541
  "pipelineAnalytics.getSensorEvents": {
32070
32542
  capName: "pipeline-analytics",
32071
32543
  capScope: "device",
@@ -32120,6 +32592,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
32120
32592
  addonId: null,
32121
32593
  access: "view"
32122
32594
  },
32595
+ "pipelineAnalytics.listRetrainAnnotations": {
32596
+ capName: "pipeline-analytics",
32597
+ capScope: "device",
32598
+ addonId: null,
32599
+ access: "view"
32600
+ },
32601
+ "pipelineAnalytics.listRetrainFrames": {
32602
+ capName: "pipeline-analytics",
32603
+ capScope: "device",
32604
+ addonId: null,
32605
+ access: "view"
32606
+ },
32607
+ "pipelineAnalytics.listRetrainStaging": {
32608
+ capName: "pipeline-analytics",
32609
+ capScope: "device",
32610
+ addonId: null,
32611
+ access: "view"
32612
+ },
32123
32613
  "pipelineAnalytics.listTrackMedia": {
32124
32614
  capName: "pipeline-analytics",
32125
32615
  capScope: "device",
@@ -32132,6 +32622,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32132
32622
  addonId: null,
32133
32623
  access: "view"
32134
32624
  },
32625
+ "pipelineAnalytics.proposeRetrainAnnotations": {
32626
+ capName: "pipeline-analytics",
32627
+ capScope: "device",
32628
+ addonId: null,
32629
+ access: "create"
32630
+ },
32135
32631
  "pipelineAnalytics.pruneEvents": {
32136
32632
  capName: "pipeline-analytics",
32137
32633
  capScope: "device",
@@ -32162,12 +32658,30 @@ var METHOD_ACCESS_MAP = Object.freeze({
32162
32658
  addonId: null,
32163
32659
  access: "create"
32164
32660
  },
32661
+ "pipelineAnalytics.restageRetrainTrack": {
32662
+ capName: "pipeline-analytics",
32663
+ capScope: "device",
32664
+ addonId: null,
32665
+ access: "create"
32666
+ },
32667
+ "pipelineAnalytics.saveRetrainAnnotations": {
32668
+ capName: "pipeline-analytics",
32669
+ capScope: "device",
32670
+ addonId: null,
32671
+ access: "create"
32672
+ },
32165
32673
  "pipelineAnalytics.searchObjectEvents": {
32166
32674
  capName: "pipeline-analytics",
32167
32675
  capScope: "device",
32168
32676
  addonId: null,
32169
32677
  access: "view"
32170
32678
  },
32679
+ "pipelineAnalytics.selectRetrainFrames": {
32680
+ capName: "pipeline-analytics",
32681
+ capScope: "device",
32682
+ addonId: null,
32683
+ access: "create"
32684
+ },
32171
32685
  "pipelineAnalytics.setTrackFlags": {
32172
32686
  capName: "pipeline-analytics",
32173
32687
  capScope: "device",
@@ -37799,7 +38313,9 @@ exports.IntercomStatusSchema = IntercomStatusSchema;
37799
38313
  exports.KNOWN_CAP_NAMES = KNOWN_CAP_NAMES;
37800
38314
  exports.KeyEventSchema = KeyEventSchema;
37801
38315
  exports.LOG_LEVEL_RANK = LOG_LEVEL_RANK;
38316
+ exports.LabelAttributionSchema = LabelAttributionSchema;
37802
38317
  exports.LabelDefinitionSchema = LabelDefinitionSchema;
38318
+ exports.LabelTierSchema = LabelTierSchema;
37803
38319
  exports.LawnMowerActivitySchema = LawnMowerActivitySchema;
37804
38320
  exports.LawnMowerControlStatusSchema = LawnMowerControlStatusSchema;
37805
38321
  exports.LinkedDeviceSchema = LinkedDeviceSchema;
@@ -38065,7 +38581,21 @@ exports.RelocateJobStateSchema = RelocateJobStateSchema;
38065
38581
  exports.RelocateMediaInputSchema = RelocateMediaInputSchema;
38066
38582
  exports.RenderedAsSchema = RenderedAsSchema;
38067
38583
  exports.ReportMotionInputSchema = ReportMotionInputSchema;
38584
+ exports.RetrainAnnotationDraftSchema = RetrainAnnotationDraftSchema;
38585
+ exports.RetrainAnnotationKindSchema = RetrainAnnotationKindSchema;
38586
+ exports.RetrainAnnotationSchema = RetrainAnnotationSchema;
38587
+ exports.RetrainAnnotationSourceSchema = RetrainAnnotationSourceSchema;
38588
+ exports.RetrainAssistResultSchema = RetrainAssistResultSchema;
38589
+ exports.RetrainAssistSubjectSchema = RetrainAssistSubjectSchema;
38590
+ exports.RetrainCopyRefusalSchema = RetrainCopyRefusalSchema;
38591
+ exports.RetrainFrameCandidateSchema = RetrainFrameCandidateSchema;
38592
+ exports.RetrainFrameListSchema = RetrainFrameListSchema;
38593
+ exports.RetrainFrameSchema = RetrainFrameSchema;
38594
+ exports.RetrainFrameSelectionSchema = RetrainFrameSelectionSchema;
38595
+ exports.RetrainMacroClassSchema = RetrainMacroClassSchema;
38068
38596
  exports.RetrainStatusSchema = RetrainStatusSchema;
38597
+ exports.RetrainTrackSchema = RetrainTrackSchema;
38598
+ exports.RetrainTransitionResultSchema = RetrainTransitionResultSchema;
38069
38599
  exports.RingBuffer = RingBuffer;
38070
38600
  exports.RtpSourceSchema = RtpSourceSchema;
38071
38601
  exports.RtspRestreamEntrySchema = RtspRestreamEntrySchema;