@camstack/types 1.2.358 → 1.2.360

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.
@@ -6,7 +6,7 @@
6
6
  * scope+access check inside `protectedProcedure` (see
7
7
  * `server/backend/src/api/trpc/trpc.middleware.ts`).
8
8
  *
9
- * Coverage: 1300 method paths across 170 capabilities.
9
+ * Coverage: 1303 method paths across 170 capabilities.
10
10
  */
11
11
  import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
12
12
  export interface MethodAccessRecord {
@@ -6,7 +6,7 @@
6
6
  * system-scope cap that takes a deviceId was previously never device-filtered
7
7
  * — see the generator header).
8
8
  *
9
- * Coverage: 519 methods carry a device reference, of which
9
+ * Coverage: 520 methods carry a device reference, of which
10
10
  * 165 are on SYSTEM-scope caps.
11
11
  *
12
12
  * Top-level fields, number arrays, and one-level arrays of objects carrying
@@ -99,7 +99,7 @@ export interface SystemProxy {
99
99
  readonly recordingArchive: Pick<InferProvider<typeof recordingArchiveCapability>, 'getAvailabilityBatch' | 'getDaysWithRecordingsBatch' | 'getStorageUsage' | 'listOpsLog' | 'pauseForStorageMigration' | 'resumeForStorageMigration' | 'refreshStorageLocationsForMigration' | 'startStorageMigrationMove' | 'getStorageMigrationMoveStatus' | 'cancelStorageMigrationMove' | 'relocateFootage' | 'listRelocateJobs' | 'getRelocateResidue' | 'reconcileLedgerAgainstDisk' | 'cancelRelocateJob' | 'planStorageRebalance' | 'startStorageRebalance' | 'getPlacement' | 'setDevicePlacement'>;
100
100
  readonly recordingExport: Pick<InferProvider<typeof recordingExportCapability>, 'createExport' | 'getExport' | 'cancelExport' | 'deleteExport' | 'getDownloadUrl' | 'readExportBytes'>;
101
101
  readonly serverManagement: Pick<InferProvider<typeof serverManagementCapability>, 'getServerPackageStatus' | 'checkServerUpdate' | 'applyServerUpdate' | 'rollbackServerUpdate' | 'restartServer'>;
102
- readonly settingsStore: Pick<InferProvider<typeof settingsStoreCapability>, 'get' | 'set' | 'query' | 'upsert' | 'insert' | 'insertMany' | 'update' | 'delete' | 'deleteWhere' | 'updateWhere' | 'count' | 'aggregate' | 'histogram' | 'isEmpty' | 'declareCollection'>;
102
+ readonly settingsStore: Pick<InferProvider<typeof settingsStoreCapability>, 'get' | 'set' | 'query' | 'upsert' | 'insert' | 'insertMany' | 'transact' | 'update' | 'delete' | 'deleteWhere' | 'updateWhere' | 'count' | 'aggregate' | 'histogram' | 'isEmpty' | 'declareCollection'>;
103
103
  readonly storage: Pick<InferProvider<typeof storageCapability>, 'resolve' | 'write' | 'read' | 'exists' | 'list' | 'delete' | 'getAvailableSpace' | 'beginUpload' | 'writeChunk' | 'finalizeUpload' | 'abortUpload' | 'beginDownload' | 'readChunk' | 'endDownload' | 'listLocations' | 'listLocationDeclarations' | 'upsertLocation' | 'deleteLocation' | 'listDrainProgress' | 'testLocation' | 'listProviders' | 'testConfig'>;
104
104
  readonly storageMigration: Pick<InferProvider<typeof storageMigrationCapability>, 'plan' | 'start' | 'status' | 'cancel' | 'movers' | 'residue' | 'drain' | 'cleanupStart' | 'cleanupStatus' | 'cleanupCancel' | 'history'>;
105
105
  readonly streamBroker: Pick<InferProvider<typeof streamBrokerCapability>, 'fetchEventMedia' | 'listAllCameraStreams' | 'listAllProfileSlots' | 'getBrokerStats' | 'probeStream' | 'listClients' | 'getLiveViewerCounts' | 'killClient' | 'getStreamUrl' | 'getStreamWithCodec' | 'releaseStreamWithCodec' | 'acquireEgressTranscode' | 'releaseEgressTranscode' | 'subscribeAudioChunks' | 'pullAudioChunks' | 'unsubscribeAudioChunks' | 'setPreBufferDuration' | 'getPreBufferInfo' | 'getRtspPort' | 'getAllRtspEntries' | 'getRtspEntry' | 'regenerateRtspToken' | 'setRtspEnabled' | 'isRtspEnabled'>;
package/dist/index.d.ts CHANGED
@@ -51,6 +51,7 @@ export { collectHydratedFieldEntries, collectHydratedFieldValues, hydrateSchema,
51
51
  export { collectKeychainStoredKeys, collectSecretConfigKeys, isKeychainStoredField, isSecretConfigField, REDACTED_SECRET, schemaDeclaresAnyField, } from './interfaces/config-ui-secrets.js';
52
52
  export * from './keychain/index.js';
53
53
  export * from './training/index.js';
54
+ export * from './retrain-review.js';
54
55
  export { mergeSecretStatePaths, parseSecretStatePath, type SecretNode, type SecretTree, secretTreeFromPaths, secretTreeFromSchema, } from './addon/secret-paths.js';
55
56
  export { collectSecretMarkerRefs, KeychainWriteRefusedError, type ResolvedSecrets, resolveSecretMarkers, type SecretWriteInput, type SecretWriteResult, transformSecretWrite, type UnresolvedReason, type UnresolvedSecret, } from './addon/secret-settings-view.js';
56
57
  export type * from './interfaces/context.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-CEqsJkV5.js");
2
+ const require_sleep = require("./sleep-BBXNq778.js");
3
3
  const require_event_category = require("./event-category-T43rdQWR.js");
4
4
  const require_composition = require("./composition-DCYnv4I6.js");
5
5
  const require_node_color = require("./node-color.js");
@@ -1925,6 +1925,213 @@ function parseTrainingEventLine(line) {
1925
1925
  return parsed.success ? parsed.data : null;
1926
1926
  }
1927
1927
  //#endregion
1928
+ //#region src/retrain-review.ts
1929
+ /** Every status, in the order a summary lists them. */
1930
+ var RETRAIN_REVIEW_STATUSES = [
1931
+ "unchanged",
1932
+ "adjusted",
1933
+ "reclassified",
1934
+ "added",
1935
+ "removed",
1936
+ "model-error"
1937
+ ];
1938
+ /**
1939
+ * Two boxes overlapping at least this much are the same subject when a legacy
1940
+ * row (no origin) is matched against a proposal. Deliberately loose: a legacy
1941
+ * row is judged on evidence that is no longer exact.
1942
+ */
1943
+ var RETRAIN_REVIEW_MATCH_IOU = .5;
1944
+ /**
1945
+ * A kept box overlapping its origin at least this much is `unchanged`; below it
1946
+ * the rectangle was moved or resized on purpose (`adjusted`). Not 1.0: the
1947
+ * canvas rounds, and a box dragged by one pixel and dragged back is not an edit.
1948
+ */
1949
+ var RETRAIN_REVIEW_ADJUSTED_IOU = .95;
1950
+ /** Two boxes this close on every edge are the same rectangle (an exact match). */
1951
+ var EXACT_EDGE_EPSILON = 1e-6;
1952
+ var optLabel = (label) => label !== void 0 ? { label } : {};
1953
+ /** Intersection over union of two normalised rectangles. */
1954
+ function retrainBoxIou(a, b) {
1955
+ const inter = Math.max(0, Math.min(a.x + a.w, b.x + b.w) - Math.max(a.x, b.x)) * Math.max(0, Math.min(a.y + a.h, b.y + b.h) - Math.max(a.y, b.y));
1956
+ const union = a.w * a.h + b.w * b.h - inter;
1957
+ return union > 0 ? inter / union : 0;
1958
+ }
1959
+ function sameRect(a, b) {
1960
+ return Math.abs(a.x - b.x) <= EXACT_EDGE_EPSILON && Math.abs(a.y - b.y) <= EXACT_EDGE_EPSILON && Math.abs(a.w - b.w) <= EXACT_EDGE_EPSILON && Math.abs(a.h - b.h) <= EXACT_EDGE_EPSILON;
1961
+ }
1962
+ function labelField(value) {
1963
+ return value?.trim() ?? "";
1964
+ }
1965
+ /** Kept box versus its baseline: class/label first, then geometry. */
1966
+ function compareKept(saved, baseline, adjustedIou) {
1967
+ const iou = retrainBoxIou(saved.bbox, baseline.bbox);
1968
+ if (saved.macroClass !== baseline.macroClass || labelField(saved.label) !== labelField(baseline.label)) return {
1969
+ status: "reclassified",
1970
+ iou
1971
+ };
1972
+ return {
1973
+ status: iou < adjustedIou ? "adjusted" : "unchanged",
1974
+ iou
1975
+ };
1976
+ }
1977
+ /**
1978
+ * Pair legacy rows with proposals: exact rectangles first, then by descending
1979
+ * overlap, one proposal per row. Greedy on a sorted list so the result does not
1980
+ * depend on the order the rows were listed in.
1981
+ */
1982
+ function pairLegacy(saved, legacyIndexes, origins, matchIou) {
1983
+ const candidates = [];
1984
+ for (const savedIndex of legacyIndexes) {
1985
+ const box = saved[savedIndex];
1986
+ if (box === void 0) continue;
1987
+ origins.forEach((origin, originIndex) => {
1988
+ const exact = sameRect(box.bbox, origin.bbox);
1989
+ const iou = exact ? 1 : retrainBoxIou(box.bbox, origin.bbox);
1990
+ if (exact || iou >= matchIou) candidates.push({
1991
+ savedIndex,
1992
+ originIndex,
1993
+ iou,
1994
+ exact
1995
+ });
1996
+ });
1997
+ }
1998
+ candidates.sort((a, b) => Number(b.exact) - Number(a.exact) || b.iou - a.iou);
1999
+ const pairs = /* @__PURE__ */ new Map();
2000
+ const takenOrigins = /* @__PURE__ */ new Set();
2001
+ for (const c of candidates) {
2002
+ if (pairs.has(c.savedIndex) || takenOrigins.has(c.originIndex)) continue;
2003
+ pairs.set(c.savedIndex, c.originIndex);
2004
+ takenOrigins.add(c.originIndex);
2005
+ }
2006
+ return pairs;
2007
+ }
2008
+ /**
2009
+ * Classify what the operator did on ONE frame.
2010
+ *
2011
+ * @param saved the frame's saved boxes.
2012
+ * @param origins the proposals known now (the pipeline's boxes, re-derived) —
2013
+ * consulted ONLY for rows that carry no origin snapshot.
2014
+ * @param dismissed the proposals the operator deleted, with their snapshots.
2015
+ */
2016
+ function classifyRetrainReview(saved, origins, dismissed, opts = {}) {
2017
+ const matchIou = opts.matchIou ?? .5;
2018
+ const adjustedIou = opts.adjustedIou ?? .95;
2019
+ const claimedRefs = /* @__PURE__ */ new Set();
2020
+ const boxes = [];
2021
+ const legacyIndexes = [];
2022
+ saved.forEach((box, index) => {
2023
+ if (box.origin === null) legacyIndexes.push(index);
2024
+ else claimedRefs.add(box.origin.ref);
2025
+ });
2026
+ for (const entry of dismissed) claimedRefs.add(entry.ref);
2027
+ const legacyPairs = pairLegacy(saved, legacyIndexes, origins, matchIou);
2028
+ for (const originIndex of legacyPairs.values()) {
2029
+ const origin = origins[originIndex];
2030
+ if (origin !== void 0) claimedRefs.add(origin.ref);
2031
+ }
2032
+ saved.forEach((box, index) => {
2033
+ const exactBaseline = box.origin;
2034
+ const pairedOrigin = exactBaseline === null ? origins[legacyPairs.get(index) ?? -1] : void 0;
2035
+ const baseline = exactBaseline ?? pairedOrigin ?? null;
2036
+ const approximate = exactBaseline === null;
2037
+ if (box.kind === "model_error") {
2038
+ boxes.push({
2039
+ ref: box.id,
2040
+ savedId: box.id,
2041
+ status: "model-error",
2042
+ approximate: false,
2043
+ macroClass: box.macroClass,
2044
+ ...optLabel(box.label),
2045
+ ...baseline !== null ? {
2046
+ origin: baseline,
2047
+ iou: retrainBoxIou(box.bbox, baseline.bbox)
2048
+ } : {}
2049
+ });
2050
+ return;
2051
+ }
2052
+ if (baseline === null || baseline.source === "operator") {
2053
+ boxes.push({
2054
+ ref: box.id,
2055
+ savedId: box.id,
2056
+ status: "added",
2057
+ approximate: approximate && baseline === null,
2058
+ macroClass: box.macroClass,
2059
+ ...optLabel(box.label),
2060
+ ...baseline !== null ? { origin: baseline } : {}
2061
+ });
2062
+ return;
2063
+ }
2064
+ const verdict = compareKept(box, baseline, adjustedIou);
2065
+ boxes.push({
2066
+ ref: box.id,
2067
+ savedId: box.id,
2068
+ status: verdict.status,
2069
+ approximate,
2070
+ macroClass: box.macroClass,
2071
+ ...optLabel(box.label),
2072
+ origin: baseline,
2073
+ iou: verdict.iou
2074
+ });
2075
+ });
2076
+ for (const entry of dismissed) boxes.push({
2077
+ ref: entry.ref,
2078
+ status: "removed",
2079
+ approximate: false,
2080
+ macroClass: entry.snapshot.macroClass,
2081
+ ...optLabel(entry.snapshot.label),
2082
+ origin: entry.snapshot
2083
+ });
2084
+ if (opts.inferRemoved === true) for (const origin of origins) {
2085
+ if (claimedRefs.has(origin.ref)) continue;
2086
+ boxes.push({
2087
+ ref: origin.ref,
2088
+ status: "removed",
2089
+ approximate: true,
2090
+ macroClass: origin.macroClass,
2091
+ ...optLabel(origin.label),
2092
+ origin
2093
+ });
2094
+ }
2095
+ return {
2096
+ boxes,
2097
+ approximate: boxes.some((b) => b.approximate)
2098
+ };
2099
+ }
2100
+ /** Counts per status, plus the totals a list row shows. */
2101
+ function summarizeReview(review) {
2102
+ const counts = {
2103
+ unchanged: 0,
2104
+ adjusted: 0,
2105
+ reclassified: 0,
2106
+ added: 0,
2107
+ removed: 0,
2108
+ "model-error": 0
2109
+ };
2110
+ for (const box of review.boxes) counts[box.status] += 1;
2111
+ return {
2112
+ counts,
2113
+ total: review.boxes.length,
2114
+ changed: review.boxes.length - counts.unchanged,
2115
+ approximate: review.approximate
2116
+ };
2117
+ }
2118
+ /** The prefix of the error a stale `expectedRevision` save is refused with. */
2119
+ var RETRAIN_REVISION_CONFLICT = "retrain-revision-conflict";
2120
+ /** The message a refused save carries — `parseRetrainRevisionConflict` reads it back. */
2121
+ function retrainRevisionConflictMessage(frameId, conflict) {
2122
+ return `${RETRAIN_REVISION_CONFLICT}: frame ${frameId} moved on — it is at revision ${String(conflict.currentRevision)}, the save expected ${String(conflict.expectedRevision)} (current=${String(conflict.currentRevision)} expected=${String(conflict.expectedRevision)})`;
2123
+ }
2124
+ /** The conflict an error message names, or `null` when it is some other error. */
2125
+ function parseRetrainRevisionConflict(message) {
2126
+ if (!message.includes("retrain-revision-conflict")) return null;
2127
+ const match = /current=(\d+) expected=(\d+)/.exec(message);
2128
+ if (match?.[1] === void 0 || match[2] === void 0) return null;
2129
+ return {
2130
+ currentRevision: Number(match[1]),
2131
+ expectedRevision: Number(match[2])
2132
+ };
2133
+ }
2134
+ //#endregion
1928
2135
  //#region src/interfaces/birth-decision-ledger.ts
1929
2136
  /**
1930
2137
  * Birth-decision ledger — one durable row per track-birth VERDICT (D409).
@@ -12459,6 +12666,38 @@ var BulkRecordSchema = zod.z.object({
12459
12666
  data: zod.z.record(zod.z.string(), zod.z.unknown())
12460
12667
  });
12461
12668
  /**
12669
+ * One write inside a {@link settingsStoreCapability.methods.transact} call.
12670
+ * Only the three that a "replace this set, bump that revision" write needs.
12671
+ */
12672
+ var TransactOpSchema = zod.z.discriminatedUnion("op", [
12673
+ zod.z.object({
12674
+ op: zod.z.literal("deleteWhere"),
12675
+ collection: zod.z.string(),
12676
+ filter: MutationFilterSchema
12677
+ }),
12678
+ zod.z.object({
12679
+ op: zod.z.literal("insertMany"),
12680
+ collection: zod.z.string(),
12681
+ records: zod.z.array(BulkRecordSchema).readonly()
12682
+ }),
12683
+ zod.z.object({
12684
+ op: zod.z.literal("update"),
12685
+ collection: zod.z.string(),
12686
+ id: zod.z.string(),
12687
+ data: zod.z.record(zod.z.string(), zod.z.unknown())
12688
+ })
12689
+ ]);
12690
+ /**
12691
+ * The precondition of a transaction: the row `key` of `collection` must hold
12692
+ * `equals` in `column`, read INSIDE the transaction.
12693
+ */
12694
+ var TransactGuardSchema = zod.z.object({
12695
+ collection: zod.z.string(),
12696
+ key: zod.z.string(),
12697
+ column: zod.z.string(),
12698
+ equals: zod.z.unknown()
12699
+ });
12700
+ /**
12462
12701
  * Column declaration for a structured (SQL-backed) collection.
12463
12702
  *
12464
12703
  * Logical types — the backend translates each to the matching SQLite
@@ -12683,6 +12922,36 @@ id: zod.z.union([zod.z.string(), zod.z.number()]) }), {
12683
12922
  kind: "mutation",
12684
12923
  auth: "admin"
12685
12924
  }),
12925
+ /**
12926
+ * Several writes, ONE transaction, behind an optional precondition.
12927
+ *
12928
+ * The multi-collection twin of {@link insertMany}: a write that has to move
12929
+ * a set of rows in one collection AND a revision in another cannot be
12930
+ * expressed as separate calls without a window in which a reader (or a
12931
+ * crash) sees half of it. The retrain annotation save replaces a frame's
12932
+ * rows, its dismissed set and its revision this way.
12933
+ *
12934
+ * `guard`, when given, is read inside the transaction: if the row is
12935
+ * missing or its column differs from `equals`, NOTHING is written and the
12936
+ * answer is `{ applied: false, current }` with what was found — the
12937
+ * compare-and-set a revisioned write needs, with no second reader able to
12938
+ * slip between the check and the writes.
12939
+ *
12940
+ * **All or nothing**, like {@link insertMany}: a throw in any op rolls the
12941
+ * whole call back. Ops run in the order given (delete before insert to
12942
+ * replace a set). `namespace` applies to every collection named.
12943
+ */
12944
+ transact: require_sleep.method(zod.z.object({
12945
+ namespace: zod.z.string().optional(),
12946
+ guard: TransactGuardSchema.optional(),
12947
+ ops: zod.z.array(TransactOpSchema).readonly()
12948
+ }), zod.z.object({
12949
+ applied: zod.z.boolean(),
12950
+ current: zod.z.unknown().optional()
12951
+ }), {
12952
+ kind: "mutation",
12953
+ auth: "admin"
12954
+ }),
12686
12955
  /** Update an existing record by ID. */
12687
12956
  update: require_sleep.method(zod.z.object({
12688
12957
  namespace: zod.z.string().optional(),
@@ -12969,6 +13238,18 @@ id: zod.z.union([zod.z.string(), zod.z.number()]) }), {
12969
13238
  kind: "mutation",
12970
13239
  auth: "admin"
12971
13240
  }),
13241
+ /** Several writes in ONE transaction behind an optional guard; see the door. */
13242
+ transact: require_sleep.method(zod.z.object({
13243
+ namespace: zod.z.string().optional(),
13244
+ guard: TransactGuardSchema.optional(),
13245
+ ops: zod.z.array(TransactOpSchema).readonly()
13246
+ }), zod.z.object({
13247
+ applied: zod.z.boolean(),
13248
+ current: zod.z.unknown().optional()
13249
+ }), {
13250
+ kind: "mutation",
13251
+ auth: "admin"
13252
+ }),
12972
13253
  /** Update an existing record by ID. */
12973
13254
  update: require_sleep.method(zod.z.object({
12974
13255
  namespace: zod.z.string().optional(),
@@ -25664,6 +25945,59 @@ var RetrainBboxSchema = zod.z.object({
25664
25945
  h: zod.z.number()
25665
25946
  });
25666
25947
  /**
25948
+ * What a box LOOKED LIKE when it was offered, snapshotted at the moment the
25949
+ * operator accepted it. The saved row keeps only the final rectangle; this is
25950
+ * the other half of the pair, and the pair is what says whether the operator
25951
+ * accepted, nudged, relabelled or replaced a proposal (`retrain-review.ts`).
25952
+ *
25953
+ * `ref` names the proposal inside its frame: `pipeline:<trackId>` for a box the
25954
+ * live pipeline drew, `assist:<n>` for the n-th box of a detector or LLM run,
25955
+ * and anything unique for an operator-drawn box (`operator:<n>`). Re-derived
25956
+ * pipeline boxes carry the same ref every time, which is what lets a dismissal
25957
+ * stay dismissed.
25958
+ */
25959
+ var RetrainOriginSchema = zod.z.object({
25960
+ source: RetrainAnnotationSourceSchema,
25961
+ ref: zod.z.string().min(1),
25962
+ bbox: RetrainBboxSchema,
25963
+ macroClass: RetrainMacroClassSchema,
25964
+ label: zod.z.string().optional(),
25965
+ score: zod.z.number().optional(),
25966
+ modelId: zod.z.string().optional()
25967
+ });
25968
+ /**
25969
+ * A proposal the operator deleted. Durable on the frame, so a deleted pipeline
25970
+ * box does not come back as a draft every time the frame is reopened, and so
25971
+ * the deletion itself is a recorded fact rather than an absence.
25972
+ */
25973
+ var RetrainDismissedSchema = zod.z.object({
25974
+ ref: zod.z.string().min(1),
25975
+ snapshot: RetrainOriginSchema
25976
+ });
25977
+ /** What the operator did with a proposal (see `retrain-review.ts`). */
25978
+ var RetrainReviewStatusSchema = zod.z.enum(RETRAIN_REVIEW_STATUSES);
25979
+ var RetrainBoxReviewSchema = zod.z.object({
25980
+ ref: zod.z.string(),
25981
+ savedId: zod.z.string().optional(),
25982
+ status: RetrainReviewStatusSchema,
25983
+ /** The baseline was re-derived, not snapshotted (a pre-origin row). */
25984
+ approximate: zod.z.boolean(),
25985
+ origin: RetrainOriginSchema.optional(),
25986
+ /** The class / label the box carries NOW (a removed box: its origin's). Absent on an older hub. */
25987
+ macroClass: RetrainMacroClassSchema.optional(),
25988
+ label: zod.z.string().optional(),
25989
+ iou: zod.z.number().optional()
25990
+ });
25991
+ var RetrainFrameReviewSchema = zod.z.object({
25992
+ boxes: zod.z.array(RetrainBoxReviewSchema).readonly(),
25993
+ summary: zod.z.object({
25994
+ counts: zod.z.record(RetrainReviewStatusSchema, zod.z.number().int()),
25995
+ total: zod.z.number().int(),
25996
+ changed: zod.z.number().int(),
25997
+ approximate: zod.z.boolean()
25998
+ })
25999
+ });
26000
+ /**
25667
26001
  * One annotated subject.
25668
26002
  *
25669
26003
  * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
@@ -25687,6 +26021,9 @@ var RetrainAnnotationSchema = zod.z.object({
25687
26021
  /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
25688
26022
  assistModelId: zod.z.string().optional(),
25689
26023
  assistScore: zod.z.number().optional(),
26024
+ /** The proposal this box started from, snapshotted at accept time. `null` on
26025
+ * a row saved before origins existed; absent on a draft nobody snapshotted. */
26026
+ origin: RetrainOriginSchema.nullable().optional(),
25690
26027
  exportedInBatch: zod.z.string().optional(),
25691
26028
  createdAt: zod.z.number()
25692
26029
  });
@@ -25779,7 +26116,19 @@ var RetrainFrameSchema = zod.z.object({
25779
26116
  * empty when nothing the track store holds can be placed on it. */
25780
26117
  pipelineBoxes: zod.z.array(RetrainPipelineBoxSchema).readonly().optional(),
25781
26118
  /** The named collections this frame belongs to. Present on list answers. */
25782
- collectionIds: zod.z.array(zod.z.string()).readonly().optional()
26119
+ collectionIds: zod.z.array(zod.z.string()).readonly().optional(),
26120
+ /** Bumped by every annotation save. A save that names a stale
26121
+ * `expectedRevision` is refused, so two surfaces cannot overwrite each other. */
26122
+ revision: zod.z.number().int().optional(),
26123
+ /** Proposals the operator deleted — never re-seeded as drafts. */
26124
+ dismissed: zod.z.array(RetrainDismissedSchema).readonly().optional(),
26125
+ /** What the operator did with the proposals, computed by the server. */
26126
+ review: RetrainFrameReviewSchema.optional(),
26127
+ /** The frame's pixels over the admin data plane (full size). Fetch with the
26128
+ * admin bearer token; relative to the hub root. */
26129
+ imageUrl: zod.z.string().optional(),
26130
+ /** The same, as a ~480 px thumbnail for grids. */
26131
+ thumbnailUrl: zod.z.string().optional()
25783
26132
  });
25784
26133
  /** Why a copy-on-select could not be honoured — named, never a silent skip. */
25785
26134
  var RetrainCopyRefusalSchema = zod.z.enum([
@@ -27375,6 +27724,11 @@ var pipelineAnalyticsCapability = {
27375
27724
  /**
27376
27725
  * The pixels of ONE copied frame, base64.
27377
27726
  *
27727
+ * @deprecated Use `RetrainFrame.imageUrl` / `thumbnailUrl` (the admin
27728
+ * `retrain-frame` data plane, D613). A base64 envelope holds the frame
27729
+ * whole in the producer AND the caller, and a grid of tiles paid that for
27730
+ * every tile. Kept for one release for callers that cannot fetch a URL.
27731
+ *
27378
27732
  * Through the cap rather than a data plane because it is genuinely one
27379
27733
  * frame at a time, on demand, at human speed — the shape D9/D18 permit
27380
27734
  * (what they forbid is frames crossing a boundary at frame RATE). The
@@ -27437,18 +27791,59 @@ var pipelineAnalyticsCapability = {
27437
27791
  * Refuses a macro class typed into `label` or `subLabel` — the tiers are
27438
27792
  * separate and the guard is at the WRITE, because a mixed taxonomy cannot
27439
27793
  * be un-mixed by reading it.
27794
+ *
27795
+ * ATOMIC and REVISIONED: the replaced rows, the frame's `dismissed` set and
27796
+ * its `revision` move in one transaction, guarded by the revision the
27797
+ * caller saw. A stale `expectedRevision` writes nothing and throws
27798
+ * `retrain-revision-conflict` (parse it with `parseRetrainRevisionConflict`);
27799
+ * the UI and an MCP agent no longer overwrite each other silently.
27440
27800
  */
27441
27801
  saveRetrainAnnotations: require_sleep.method(zod.z.object({
27442
27802
  deviceId: zod.z.number(),
27443
27803
  /** The frame's track, when it has one — checked against the frame. */
27444
27804
  trackId: zod.z.string().optional(),
27445
27805
  frameId: zod.z.string(),
27446
- annotations: zod.z.array(RetrainAnnotationDraftSchema)
27806
+ annotations: zod.z.array(RetrainAnnotationDraftSchema),
27807
+ /** The frame's `revision` the caller saw. A different current revision
27808
+ * refuses the save with a `retrain-revision-conflict` error
27809
+ * (`parseRetrainRevisionConflict`). Absent ⇒ last write wins. */
27810
+ expectedRevision: zod.z.number().int().optional(),
27811
+ /** The proposals the operator deleted. Absent ⇒ keep the frame's
27812
+ * current set; present ⇒ replace it (an empty array un-dismisses). */
27813
+ dismissed: zod.z.array(RetrainDismissedSchema).optional()
27447
27814
  }), zod.z.array(RetrainAnnotationSchema).readonly(), {
27448
27815
  kind: "mutation",
27449
27816
  auth: "admin"
27450
27817
  }),
27451
27818
  /**
27819
+ * Give annotations saved BEFORE origins existed the origin a caller
27820
+ * reconstructed for them (the MCP `track_review_backfill_origin` tool
27821
+ * matches each row to the pipeline box it equals).
27822
+ *
27823
+ * Writes `origin` and nothing else: ids, creation time and the export stamp
27824
+ * are untouched (a re-save through `saveRetrainAnnotations` would reset all
27825
+ * three). A row that already has an origin is SKIPPED — a snapshot taken at
27826
+ * accept time is evidence, a reconstruction is a guess. Atomic and
27827
+ * revision-guarded like the save; bumps the frame's `revision`.
27828
+ */
27829
+ backfillRetrainOrigins: require_sleep.method(zod.z.object({
27830
+ deviceId: zod.z.number(),
27831
+ trackId: zod.z.string().optional(),
27832
+ frameId: zod.z.string(),
27833
+ expectedRevision: zod.z.number().int().optional(),
27834
+ origins: zod.z.array(zod.z.object({
27835
+ annotationId: zod.z.string(),
27836
+ origin: RetrainOriginSchema
27837
+ })).min(1).max(500)
27838
+ }), zod.z.object({
27839
+ updated: zod.z.number().int(),
27840
+ skipped: zod.z.number().int(),
27841
+ revision: zod.z.number().int()
27842
+ }), {
27843
+ kind: "mutation",
27844
+ auth: "admin"
27845
+ }),
27846
+ /**
27452
27847
  * Finish with a track: `staging → trained`. **The only writer of that
27453
27848
  * state** — D81 shipped the column with it deliberately unreachable.
27454
27849
  *
@@ -55633,6 +56028,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
55633
56028
  addonId: null,
55634
56029
  access: "create"
55635
56030
  },
56031
+ "dataStoreProvider.transact": {
56032
+ capName: "data-store-provider",
56033
+ capScope: "system",
56034
+ addonId: null,
56035
+ access: "create"
56036
+ },
55636
56037
  "dataStoreProvider.update": {
55637
56038
  capName: "data-store-provider",
55638
56039
  capScope: "system",
@@ -58477,6 +58878,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
58477
58878
  addonId: null,
58478
58879
  access: "create"
58479
58880
  },
58881
+ "pipelineAnalytics.backfillRetrainOrigins": {
58882
+ capName: "pipeline-analytics",
58883
+ capScope: "device",
58884
+ addonId: null,
58885
+ access: "create"
58886
+ },
58480
58887
  "pipelineAnalytics.cancelRelocateMedia": {
58481
58888
  capName: "pipeline-analytics",
58482
58889
  capScope: "device",
@@ -60469,6 +60876,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
60469
60876
  addonId: null,
60470
60877
  access: "create"
60471
60878
  },
60879
+ "settingsStore.transact": {
60880
+ capName: "settings-store",
60881
+ capScope: "system",
60882
+ addonId: null,
60883
+ access: "create"
60884
+ },
60472
60885
  "settingsStore.update": {
60473
60886
  capName: "settings-store",
60474
60887
  capScope: "system",
@@ -68205,6 +68618,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
68205
68618
  form: "single",
68206
68619
  optional: false
68207
68620
  }],
68621
+ "pipelineAnalytics.backfillRetrainOrigins": [{
68622
+ name: "deviceId",
68623
+ form: "single",
68624
+ optional: false
68625
+ }],
68208
68626
  "pipelineAnalytics.clearTrackRelation": [{
68209
68627
  name: "deviceId",
68210
68628
  form: "single",
@@ -70715,6 +71133,7 @@ function createSystemProxy(api) {
70715
71133
  upsert: (input) => dispatch("settingsStore", "upsert", "mutation", input),
70716
71134
  insert: (input) => dispatch("settingsStore", "insert", "mutation", input),
70717
71135
  insertMany: (input) => dispatch("settingsStore", "insertMany", "mutation", input),
71136
+ transact: (input) => dispatch("settingsStore", "transact", "mutation", input),
70718
71137
  update: (input) => dispatch("settingsStore", "update", "mutation", input),
70719
71138
  delete: (input) => dispatch("settingsStore", "delete", "mutation", input),
70720
71139
  deleteWhere: (input) => dispatch("settingsStore", "deleteWhere", "mutation", input),
@@ -80574,6 +80993,10 @@ exports.REMOVED_MODEL_IDS = REMOVED_MODEL_IDS;
80574
80993
  exports.RESERVED_BINDING_NAMES = require_composition.RESERVED_BINDING_NAMES;
80575
80994
  exports.RESERVED_COLLECTION_SOURCES = RESERVED_COLLECTION_SOURCES;
80576
80995
  exports.RESTORED_CAP_NAMES = RESTORED_CAP_NAMES;
80996
+ exports.RETRAIN_REVIEW_ADJUSTED_IOU = RETRAIN_REVIEW_ADJUSTED_IOU;
80997
+ exports.RETRAIN_REVIEW_MATCH_IOU = RETRAIN_REVIEW_MATCH_IOU;
80998
+ exports.RETRAIN_REVIEW_STATUSES = RETRAIN_REVIEW_STATUSES;
80999
+ exports.RETRAIN_REVISION_CONFLICT = RETRAIN_REVISION_CONFLICT;
80577
81000
  exports.REVALIDATE_AFTER_MS = require_sleep.REVALIDATE_AFTER_MS;
80578
81001
  exports.ROOM_EXAMPLE_MOTION_SOURCES = ROOM_EXAMPLE_MOTION_SOURCES;
80579
81002
  exports.ROOM_EXAMPLE_TEMPERATURE_SOURCES = ROOM_EXAMPLE_TEMPERATURE_SOURCES;
@@ -80661,6 +81084,7 @@ exports.RetrainArchiveTargetSchema = RetrainArchiveTargetSchema;
80661
81084
  exports.RetrainAssistProfileSchema = RetrainAssistProfileSchema;
80662
81085
  exports.RetrainAssistResultSchema = RetrainAssistResultSchema;
80663
81086
  exports.RetrainAssistSubjectSchema = RetrainAssistSubjectSchema;
81087
+ exports.RetrainBoxReviewSchema = RetrainBoxReviewSchema;
80664
81088
  exports.RetrainCollectionCreateResultSchema = RetrainCollectionCreateResultSchema;
80665
81089
  exports.RetrainCollectionRenameResultSchema = RetrainCollectionRenameResultSchema;
80666
81090
  exports.RetrainCollectionSchema = RetrainCollectionSchema;
@@ -80673,11 +81097,13 @@ exports.RetrainCorpusPageSchema = RetrainCorpusPageSchema;
80673
81097
  exports.RetrainDatasetSelectionSchema = RetrainDatasetSelectionSchema;
80674
81098
  exports.RetrainDatasetStatsSchema = RetrainDatasetStatsSchema;
80675
81099
  exports.RetrainDatasetVersionSchema = RetrainDatasetVersionSchema;
81100
+ exports.RetrainDismissedSchema = RetrainDismissedSchema;
80676
81101
  exports.RetrainExportFilterSchema = RetrainExportFilterSchema;
80677
81102
  exports.RetrainExportLayoutSchema = RetrainExportLayoutSchema;
80678
81103
  exports.RetrainFrameCandidateSchema = RetrainFrameCandidateSchema;
80679
81104
  exports.RetrainFrameListSchema = RetrainFrameListSchema;
80680
81105
  exports.RetrainFrameOriginSchema = RetrainFrameOriginSchema;
81106
+ exports.RetrainFrameReviewSchema = RetrainFrameReviewSchema;
80681
81107
  exports.RetrainFrameSchema = RetrainFrameSchema;
80682
81108
  exports.RetrainFrameSelectionSchema = RetrainFrameSelectionSchema;
80683
81109
  exports.RetrainFrameWorkStateSchema = RetrainFrameWorkStateSchema;
@@ -80685,7 +81111,9 @@ exports.RetrainLlmAssistResultSchema = RetrainLlmAssistResultSchema;
80685
81111
  exports.RetrainLlmProposalSchema = RetrainLlmProposalSchema;
80686
81112
  exports.RetrainLlmReviewSchema = RetrainLlmReviewSchema;
80687
81113
  exports.RetrainMacroClassSchema = RetrainMacroClassSchema;
81114
+ exports.RetrainOriginSchema = RetrainOriginSchema;
80688
81115
  exports.RetrainPipelineBoxSchema = RetrainPipelineBoxSchema;
81116
+ exports.RetrainReviewStatusSchema = RetrainReviewStatusSchema;
80689
81117
  exports.RetrainStatusSchema = RetrainStatusSchema;
80690
81118
  exports.RetrainTrackSchema = RetrainTrackSchema;
80691
81119
  exports.RetrainTrainingCorpusResolveResultSchema = RetrainTrainingCorpusResolveResultSchema;
@@ -81126,6 +81554,7 @@ exports.checkRoleAddress = checkRoleAddress;
81126
81554
  exports.classifyBearerPrincipal = classifyBearerPrincipal;
81127
81555
  exports.classifyCamerasForBenchmark = classifyCamerasForBenchmark;
81128
81556
  exports.classifyInferenceHardware = classifyInferenceHardware;
81557
+ exports.classifyRetrainReview = classifyRetrainReview;
81129
81558
  exports.classifySecretWrite = require_sleep.classifySecretWrite;
81130
81559
  exports.classifyStream = classifyStream;
81131
81560
  exports.classifyStreams = classifyStreams;
@@ -81544,6 +81973,7 @@ exports.parseMediaOwnerKey = parseMediaOwnerKey;
81544
81973
  exports.parseOccupancyScope = parseOccupancyScope;
81545
81974
  exports.parseProcStatus = parseProcStatus;
81546
81975
  exports.parseProfileBrokerId = require_sleep.parseProfileBrokerId;
81976
+ exports.parseRetrainRevisionConflict = parseRetrainRevisionConflict;
81547
81977
  exports.parseRuleSection = parseRuleSection;
81548
81978
  exports.parseSecretRef = require_sleep.parseSecretRef;
81549
81979
  exports.parseSecretStatePath = require_sleep.parseSecretStatePath;
@@ -81660,6 +82090,8 @@ exports.resolveVariantModelId = resolveVariantModelId;
81660
82090
  exports.resolveViewableDeviceIds = resolveViewableDeviceIds;
81661
82091
  exports.resultCellKey = resultCellKey;
81662
82092
  exports.resultStandings = resultStandings;
82093
+ exports.retrainBoxIou = retrainBoxIou;
82094
+ exports.retrainRevisionConflictMessage = retrainRevisionConflictMessage;
81663
82095
  exports.roleSpec = roleSpec;
81664
82096
  exports.roomCompositionExample = roomCompositionExample;
81665
82097
  exports.rootSuppliesOf = rootSuppliesOf;
@@ -81741,6 +82173,7 @@ exports.strippedOfLegacyReadOnly = strippedOfLegacyReadOnly;
81741
82173
  exports.subKindsOf = subKindsOf;
81742
82174
  exports.summarisePrivacyAudio = summarisePrivacyAudio;
81743
82175
  exports.summarizeEffectiveScope = summarizeEffectiveScope;
82176
+ exports.summarizeReview = summarizeReview;
81744
82177
  exports.supplyFor = supplyFor;
81745
82178
  exports.supportedRuntimes = supportedRuntimes;
81746
82179
  exports.switchCapability = switchCapability;