@camstack/addon-import-alexa 0.2.44 → 0.2.46

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 (3) hide show
  1. package/dist/addon.js +313 -181
  2. package/dist/addon.mjs +313 -181
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8161,6 +8161,21 @@ var RelocateJobSchema = object({
8161
8161
  bytesMoved: number().int(),
8162
8162
  /** Total files discovered up front; null while (or when) unknown. */
8163
8163
  filesTotal: number().int().nullable(),
8164
+ /**
8165
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8166
+ * made that nobody asked for, so it is reported where the operator reads the
8167
+ * job rather than only in a log line.
8168
+ *
8169
+ * A footage segment records its byte count in its own NAME, and the durable
8170
+ * hour row derives its aggregates from those names. A file that does not
8171
+ * match its name therefore makes the ledger's sums — and with them quota and
8172
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8173
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8174
+ *
8175
+ * Absent on lanes where the question has no meaning: a media blob's size is
8176
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8177
+ */
8178
+ rowsReconciled: number().int().nonnegative().optional(),
8164
8179
  startedAt: number(),
8165
8180
  finishedAt: number().nullable(),
8166
8181
  error: string().nullable()
@@ -8229,14 +8244,42 @@ var RelocateMediaInputSchema = object({
8229
8244
  /** Omitted = `move`, the pre-existing behaviour. */
8230
8245
  mode: MediaRelocateModeSchema.optional()
8231
8246
  });
8232
- /** How many rows still carry NO `locationId` — the population a repoint would
8233
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8234
- * value that permits a non-blocking `eventMedia` cutover. */
8235
- var UnstampedEventMediaCountSchema = object({
8236
- media: number().int().nonnegative(),
8237
- retrainFrames: number().int().nonnegative(),
8238
- total: number().int().nonnegative()
8247
+ /**
8248
+ * The unstamped population of ONE collection — split, because the gate and the
8249
+ * operator ask two different questions and only one of them has to be cheap.
8250
+ *
8251
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8252
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8253
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8254
+ * that matters — after a seal, when the population is empty.
8255
+ *
8256
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8257
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8258
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8259
+ * and useful answer: "there are some, and this read could not say how many"
8260
+ * still refuses the cutover, which is the whole job.
8261
+ */
8262
+ var UnstampedRowsSchema = object({
8263
+ present: boolean(),
8264
+ rows: number().int().nonnegative().nullable()
8239
8265
  });
8266
+ /**
8267
+ * How many rows still carry NO `locationId` — the population a repoint would
8268
+ * silently re-aim at a disk that does not hold their bytes.
8269
+ *
8270
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8271
+ * over. The gate opens on a measured absence and on nothing else; an unread
8272
+ * collection and an empty one are different facts, and this repo has already
8273
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8274
+ */
8275
+ var UnstampedEventMediaCountSchema = object({
8276
+ media: UnstampedRowsSchema,
8277
+ retrainFrames: UnstampedRowsSchema,
8278
+ /** True when EITHER collection holds one. The refusal reads this. */
8279
+ anyPresent: boolean(),
8280
+ /** Sum across both, or `null` when either lane could not be counted. */
8281
+ total: number().int().nonnegative().nullable()
8282
+ }).nullable();
8240
8283
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8241
8284
  /** The independently selectable logical storage classes — every class
8242
8285
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8347,6 +8390,10 @@ var StorageMigrationMoveProgressSchema = object({
8347
8390
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8348
8391
  filesTotal: number().int().nonnegative().nullable(),
8349
8392
  bytesMoved: number().int().nonnegative(),
8393
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8394
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8395
+ * rows would be the same failure as one that silently skipped them. */
8396
+ rowsReconciled: number().int().nonnegative().optional(),
8350
8397
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8351
8398
  * crash gets a new mover, and a rate computed from the migration's start
8352
8399
  * would silently average in the time nothing was running. */
@@ -13380,6 +13427,114 @@ method(object({
13380
13427
  height: number()
13381
13428
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13382
13429
  /**
13430
+ * `failure-contribution` — the capability an addon reports its OWN losses
13431
+ * through, per camera, with the denominator attached. It stores nothing.
13432
+ *
13433
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13434
+ *
13435
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13436
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13437
+ * copied: the contributor reports what it already knows, hub-main adds only
13438
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13439
+ * somebody to forget to edit.
13440
+ *
13441
+ * They are not merged, because their invariants are opposites:
13442
+ *
13443
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13444
+ * claim a camera cost nothing, which is a measurement nobody made;
13445
+ * - a `failure-contribution` zero is the **most valuable value on the
13446
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13447
+ * and it is exactly what an absent entry cannot say.
13448
+ *
13449
+ * Putting a loss counter on a cost entry would also break the reconciliation
13450
+ * that gives `load-contribution` its point: contributions are subtracted from
13451
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13452
+ * has no process.
13453
+ *
13454
+ * ## Why not a log line, since the counters already exist
13455
+ *
13456
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13457
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13458
+ * ends in a log line, and a log line is the thing the operator asked to stop
13459
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13460
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13461
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13462
+ * media blackout were both diagnosed. The counters stay; this is where they can
13463
+ * be READ.
13464
+ *
13465
+ * ## The rate is served with its denominator or not at all
13466
+ *
13467
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13468
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13469
+ * than yesterday" and was **flat across twelve hours** once divided by the
13470
+ * successes on the same path. A surface that publishes only the numerator
13471
+ * reproduces that mistake on every read.
13472
+ *
13473
+ * ## Shape
13474
+ *
13475
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13476
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13477
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13478
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13479
+ * a forked runner's entries reach hub-main over transport that already exists.
13480
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13481
+ * result through `system.getFailureContributions`.
13482
+ */
13483
+ var FailureReasonCountSchema = object({
13484
+ /**
13485
+ * Why the attempt did not land, in the contributor's own vocabulary —
13486
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13487
+ * strings that already appear in this repo's logs and, where one exists, the
13488
+ * same string the per-track `previewMissReason` records (D276): a second
13489
+ * vocabulary for the same loss would make the row and the counter
13490
+ * un-joinable.
13491
+ */
13492
+ reason: string(),
13493
+ count: number().int().nonnegative()
13494
+ });
13495
+ var FailureContributionSchema = object({
13496
+ /**
13497
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13498
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13499
+ * `unit` free: the families are owned by different addons and a shared enum
13500
+ * is a central list that rots invisibly.
13501
+ */
13502
+ family: string(),
13503
+ /**
13504
+ * The NUMERIC device id — the same value every log line carries as
13505
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13506
+ * cannot name the camera must not emit the entry, because a fleet total
13507
+ * cannot answer the only question anybody asks of this surface.
13508
+ */
13509
+ deviceId: number().int().positive(),
13510
+ /**
13511
+ * A second dimension inside the family: the model / step id for an inference
13512
+ * timeout, so "which camera AND which model" is one read. Absent when the
13513
+ * family has a single variant.
13514
+ */
13515
+ variant: string().optional(),
13516
+ /**
13517
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13518
+ * differencing two reads must drop the interval when it changes, because the
13519
+ * counter restarted from zero in a respawned runner. Same discipline as
13520
+ * `LoadContribution.startedAtMs`.
13521
+ */
13522
+ sinceMs: number(),
13523
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13524
+ atMs: number(),
13525
+ /**
13526
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13527
+ * window. A failure count published without it is the mistake this schema
13528
+ * exists to make impossible.
13529
+ */
13530
+ attempts: number().int().nonnegative(),
13531
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13532
+ succeeded: number().int().nonnegative(),
13533
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13534
+ reasons: array(FailureReasonCountSchema).readonly()
13535
+ });
13536
+ method(_void(), array(FailureContributionSchema).readonly());
13537
+ /**
13383
13538
  * filesystem-browse — per-node capability for browsing the node's local
13384
13539
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13385
13540
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13901,6 +14056,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13901
14056
  kind: "mutation",
13902
14057
  auth: "admin"
13903
14058
  });
14059
+ var LoadContributionSchema = object({
14060
+ role: _enum([
14061
+ "decode",
14062
+ "transcode",
14063
+ "recording",
14064
+ "streaming",
14065
+ "detection"
14066
+ ]),
14067
+ /**
14068
+ * The NUMERIC device id — the same value every log line carries as
14069
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14070
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
14071
+ * contributor that cannot name its camera must not emit the entry at all,
14072
+ * because an unnamed per-camera entry is indistinguishable from a shared one
14073
+ * and would quietly turn one camera's cost into everybody's.
14074
+ */
14075
+ deviceId: number().int().positive().nullable(),
14076
+ attribution: _enum([
14077
+ "measured",
14078
+ "accounted",
14079
+ "unattributable"
14080
+ ]),
14081
+ /**
14082
+ * What ONE entry is, in the contributor's own words — `615/high`,
14083
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14084
+ * family and inventing a common one would lose the only information that
14085
+ * makes two entries for the same camera distinguishable.
14086
+ */
14087
+ unit: string(),
14088
+ /**
14089
+ * The OS process this cost lives in, when there is one. Present so a
14090
+ * consumer can (a) tell two generations of the same unit apart across a
14091
+ * restart, and (b) subtract claimed processes from the node's process
14092
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14093
+ * process of its own.
14094
+ */
14095
+ pid: number().int().positive().optional(),
14096
+ /**
14097
+ * When this generation started. The pid's incarnation marker: a consumer
14098
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14099
+ * window when this changes, because the counter restarted from zero in a new
14100
+ * process.
14101
+ */
14102
+ startedAtMs: number().optional(),
14103
+ /**
14104
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14105
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
14106
+ * contribution is asked for.
14107
+ *
14108
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
14109
+ * needs a sampler, and a new per-node sampler is the defect half of
14110
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14111
+ * by whoever already keeps a history; a rate cannot be un-averaged.
14112
+ *
14113
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14114
+ * an entry with no process.
14115
+ */
14116
+ cpuSeconds: number().optional(),
14117
+ /** Resident bytes of this unit's process, same source and same rules. */
14118
+ rssBytes: number().optional()
14119
+ });
14120
+ method(_void(), array(LoadContributionSchema).readonly());
13904
14121
  /**
13905
14122
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13906
14123
  * through. It stores nothing.
@@ -13977,176 +14194,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13977
14194
  tags: record(string(), string()).optional()
13978
14195
  }), array(LogEntrySchema).readonly());
13979
14196
  /**
13980
- * `failure-contribution` — the capability an addon reports its OWN losses
13981
- * through, per camera, with the denominator attached. It stores nothing.
13982
- *
13983
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13984
- *
13985
- * `load-contribution` answers *what did this camera COST*. This answers *what
13986
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13987
- * copied: the contributor reports what it already knows, hub-main adds only
13988
- * `addonId`, nothing needs global knowledge, and there is no central list for
13989
- * somebody to forget to edit.
13990
- *
13991
- * They are not merged, because their invariants are opposites:
13992
- *
13993
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13994
- * claim a camera cost nothing, which is a measurement nobody made;
13995
- * - a `failure-contribution` zero is the **most valuable value on the
13996
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13997
- * and it is exactly what an absent entry cannot say.
13998
- *
13999
- * Putting a loss counter on a cost entry would also break the reconciliation
14000
- * that gives `load-contribution` its point: contributions are subtracted from
14001
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
14002
- * has no process.
14003
- *
14004
- * ## Why not a log line, since the counters already exist
14005
- *
14006
- * Several of these paths already counted themselves — `CaptureScheduler`'s
14007
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
14008
- * ends in a log line, and a log line is the thing the operator asked to stop
14009
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
14010
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
14011
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
14012
- * media blackout were both diagnosed. The counters stay; this is where they can
14013
- * be READ.
14014
- *
14015
- * ## The rate is served with its denominator or not at all
14016
- *
14017
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
14018
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
14019
- * than yesterday" and was **flat across twelve hours** once divided by the
14020
- * successes on the same path. A surface that publishes only the numerator
14021
- * reproduces that mistake on every read.
14022
- *
14023
- * ## Shape
14024
- *
14025
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
14026
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
14027
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
14028
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
14029
- * a forked runner's entries reach hub-main over transport that already exists.
14030
- * No new UDS message, no second registry (D3). The operator reads the assembled
14031
- * result through `system.getFailureContributions`.
14032
- */
14033
- var FailureReasonCountSchema = object({
14034
- /**
14035
- * Why the attempt did not land, in the contributor's own vocabulary —
14036
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
14037
- * strings that already appear in this repo's logs and, where one exists, the
14038
- * same string the per-track `previewMissReason` records (D276): a second
14039
- * vocabulary for the same loss would make the row and the counter
14040
- * un-joinable.
14041
- */
14042
- reason: string(),
14043
- count: number().int().nonnegative()
14044
- });
14045
- var FailureContributionSchema = object({
14046
- /**
14047
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
14048
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
14049
- * `unit` free: the families are owned by different addons and a shared enum
14050
- * is a central list that rots invisibly.
14051
- */
14052
- family: string(),
14053
- /**
14054
- * The NUMERIC device id — the same value every log line carries as
14055
- * `tags.deviceId`. Never nullable and never absent: a contributor that
14056
- * cannot name the camera must not emit the entry, because a fleet total
14057
- * cannot answer the only question anybody asks of this surface.
14058
- */
14059
- deviceId: number().int().positive(),
14060
- /**
14061
- * A second dimension inside the family: the model / step id for an inference
14062
- * timeout, so "which camera AND which model" is one read. Absent when the
14063
- * family has a single variant.
14064
- */
14065
- variant: string().optional(),
14066
- /**
14067
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
14068
- * differencing two reads must drop the interval when it changes, because the
14069
- * counter restarted from zero in a respawned runner. Same discipline as
14070
- * `LoadContribution.startedAtMs`.
14071
- */
14072
- sinceMs: number(),
14073
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
14074
- atMs: number(),
14075
- /**
14076
- * THE DENOMINATOR — every attempt on this path for this camera in the
14077
- * window. A failure count published without it is the mistake this schema
14078
- * exists to make impossible.
14079
- */
14080
- attempts: number().int().nonnegative(),
14081
- /** Attempts that landed. `attempts - succeeded` is the loss. */
14082
- succeeded: number().int().nonnegative(),
14083
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
14084
- reasons: array(FailureReasonCountSchema).readonly()
14085
- });
14086
- method(_void(), array(FailureContributionSchema).readonly());
14087
- var LoadContributionSchema = object({
14088
- role: _enum([
14089
- "decode",
14090
- "transcode",
14091
- "recording",
14092
- "streaming",
14093
- "detection"
14094
- ]),
14095
- /**
14096
- * The NUMERIC device id — the same value every log line carries as
14097
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14098
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
14099
- * contributor that cannot name its camera must not emit the entry at all,
14100
- * because an unnamed per-camera entry is indistinguishable from a shared one
14101
- * and would quietly turn one camera's cost into everybody's.
14102
- */
14103
- deviceId: number().int().positive().nullable(),
14104
- attribution: _enum([
14105
- "measured",
14106
- "accounted",
14107
- "unattributable"
14108
- ]),
14109
- /**
14110
- * What ONE entry is, in the contributor's own words — `615/high`,
14111
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14112
- * family and inventing a common one would lose the only information that
14113
- * makes two entries for the same camera distinguishable.
14114
- */
14115
- unit: string(),
14116
- /**
14117
- * The OS process this cost lives in, when there is one. Present so a
14118
- * consumer can (a) tell two generations of the same unit apart across a
14119
- * restart, and (b) subtract claimed processes from the node's process
14120
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14121
- * process of its own.
14122
- */
14123
- pid: number().int().positive().optional(),
14124
- /**
14125
- * When this generation started. The pid's incarnation marker: a consumer
14126
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14127
- * window when this changes, because the counter restarted from zero in a new
14128
- * process.
14129
- */
14130
- startedAtMs: number().optional(),
14131
- /**
14132
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14133
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
14134
- * contribution is asked for.
14135
- *
14136
- * Cumulative and not a rate on purpose: a rate needs a window, a window
14137
- * needs a sampler, and a new per-node sampler is the defect half of
14138
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14139
- * by whoever already keeps a history; a rate cannot be un-averaged.
14140
- *
14141
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14142
- * an entry with no process.
14143
- */
14144
- cpuSeconds: number().optional(),
14145
- /** Resident bytes of this unit's process, same source and same rules. */
14146
- rssBytes: number().optional()
14147
- });
14148
- method(_void(), array(LoadContributionSchema).readonly());
14149
- /**
14150
14197
  * `login-method` — collection cap through which auth addons contribute
14151
14198
  * their pre-auth login surfaces to the login page. This is the SINGLE,
14152
14199
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18884,12 +18931,53 @@ var MediaFileKindEnum = _enum([
18884
18931
  "keyFrameSmall",
18885
18932
  "thumbnailSmall"
18886
18933
  ]);
18934
+ /**
18935
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18936
+ * ARE — never the bytes themselves.
18937
+ *
18938
+ * ## Why `url` and not `base64`
18939
+ *
18940
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18941
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18942
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18943
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18944
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18945
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18946
+ *
18947
+ * `url` points at the `event-media` data plane
18948
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18949
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18950
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18951
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18952
+ * no less protected than they were inside a `view`-level cap response — see
18953
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18954
+ * (per-device scoping).
18955
+ *
18956
+ * The URL is built from the row's **stored** key, which is not always its
18957
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18958
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18959
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18960
+ *
18961
+ * ## `base64` is TRANSITIONAL and is going away
18962
+ *
18963
+ * It is still populated for one reason: the deployed viewer's track-detail
18964
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18965
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18966
+ * triangle — not as absence. Removing the field before that viewer ships is an
18967
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18968
+ * delete this line and the `withBytes` pass-through in
18969
+ * `analytics-query-facade.ts`; nothing else reads it.
18970
+ */
18887
18971
  var MediaFileSchema = object({
18888
18972
  key: string(),
18889
18973
  kind: MediaFileKindEnum,
18890
- base64: string(),
18891
18974
  sizeBytes: number(),
18892
18975
  timestamp: number()
18976
+ }).extend({
18977
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18978
+ url: string(),
18979
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18980
+ base64: string()
18893
18981
  });
18894
18982
  /**
18895
18983
  * One media row WITHOUT its bytes.
@@ -18901,7 +18989,9 @@ var MediaFileSchema = object({
18901
18989
  * blocks the whole view.
18902
18990
  *
18903
18991
  * `sizeBytes` is carried because it is what lets a client decide between the
18904
- * stored blob and a `?variant=thumb` rendering without fetching either.
18992
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18993
+ * `url` because a client that had to build the plane path itself is a second
18994
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18905
18995
  */
18906
18996
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18907
18997
  /**
@@ -19590,6 +19680,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19590
19680
  }), array(MediaFileSchema).readonly()), method(object({
19591
19681
  trackId: string(),
19592
19682
  deviceId: number()
19683
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19684
+ eventId: string(),
19685
+ deviceId: number()
19593
19686
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19594
19687
  kind: "mutation",
19595
19688
  auth: "admin"
@@ -24597,10 +24690,24 @@ var FaceClusterSchema = object({
24597
24690
  size: number().int(),
24598
24691
  cohesion: number()
24599
24692
  });
24693
+ /**
24694
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
24695
+ * are — never the bytes.
24696
+ *
24697
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
24698
+ * track/event contract) is still populated because a deployed viewer requires
24699
+ * the field to parse a row at all; this method has no such reader. Its ONE
24700
+ * caller is the admin UI's detail modal, which was building
24701
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
24702
+ * dialog already rendering its key FRAME from the `event-media` plane.
24703
+ *
24704
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
24705
+ * media key directly, so this needed no new plane and no new access decision.
24706
+ */
24600
24707
  var MediaFileLiteSchema$1 = object({
24601
24708
  key: string(),
24602
24709
  kind: string(),
24603
- base64: string(),
24710
+ url: string(),
24604
24711
  sizeBytes: number(),
24605
24712
  timestamp: number()
24606
24713
  });
@@ -27622,10 +27729,24 @@ var PlateInfoSchema = object({
27622
27729
  */
27623
27730
  cropUrl: string().optional()
27624
27731
  });
27732
+ /**
27733
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
27734
+ * are — never the bytes.
27735
+ *
27736
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
27737
+ * track/event contract) is still populated because a deployed viewer requires
27738
+ * the field to parse a row at all; this method has no such reader. Its ONE
27739
+ * caller is the admin UI's detail modal, which was building
27740
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
27741
+ * dialog already rendering its key FRAME from the `event-media` plane.
27742
+ *
27743
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
27744
+ * media key directly, so this needed no new plane and no new access decision.
27745
+ */
27625
27746
  var MediaFileLiteSchema = object({
27626
27747
  key: string(),
27627
27748
  kind: string(),
27628
- base64: string(),
27749
+ url: string(),
27629
27750
  sizeBytes: number(),
27630
27751
  timestamp: number()
27631
27752
  });
@@ -35522,6 +35643,12 @@ Object.freeze({
35522
35643
  addonId: null,
35523
35644
  access: "view"
35524
35645
  },
35646
+ "pipelineAnalytics.listEventMedia": {
35647
+ capName: "pipeline-analytics",
35648
+ capScope: "device",
35649
+ addonId: null,
35650
+ access: "view"
35651
+ },
35525
35652
  "pipelineAnalytics.listGroups": {
35526
35653
  capName: "pipeline-analytics",
35527
35654
  capScope: "device",
@@ -39145,6 +39272,11 @@ Object.freeze({
39145
39272
  form: "array",
39146
39273
  optional: false
39147
39274
  }],
39275
+ "pipelineAnalytics.listEventMedia": [{
39276
+ name: "deviceId",
39277
+ form: "single",
39278
+ optional: false
39279
+ }],
39148
39280
  "pipelineAnalytics.listGroups": [{
39149
39281
  name: "deviceIds",
39150
39282
  form: "array",
package/dist/addon.mjs CHANGED
@@ -8161,6 +8161,21 @@ var RelocateJobSchema = object({
8161
8161
  bytesMoved: number().int(),
8162
8162
  /** Total files discovered up front; null while (or when) unknown. */
8163
8163
  filesTotal: number().int().nullable(),
8164
+ /**
8165
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8166
+ * made that nobody asked for, so it is reported where the operator reads the
8167
+ * job rather than only in a log line.
8168
+ *
8169
+ * A footage segment records its byte count in its own NAME, and the durable
8170
+ * hour row derives its aggregates from those names. A file that does not
8171
+ * match its name therefore makes the ledger's sums — and with them quota and
8172
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8173
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8174
+ *
8175
+ * Absent on lanes where the question has no meaning: a media blob's size is
8176
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8177
+ */
8178
+ rowsReconciled: number().int().nonnegative().optional(),
8164
8179
  startedAt: number(),
8165
8180
  finishedAt: number().nullable(),
8166
8181
  error: string().nullable()
@@ -8229,14 +8244,42 @@ var RelocateMediaInputSchema = object({
8229
8244
  /** Omitted = `move`, the pre-existing behaviour. */
8230
8245
  mode: MediaRelocateModeSchema.optional()
8231
8246
  });
8232
- /** How many rows still carry NO `locationId` — the population a repoint would
8233
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8234
- * value that permits a non-blocking `eventMedia` cutover. */
8235
- var UnstampedEventMediaCountSchema = object({
8236
- media: number().int().nonnegative(),
8237
- retrainFrames: number().int().nonnegative(),
8238
- total: number().int().nonnegative()
8247
+ /**
8248
+ * The unstamped population of ONE collection — split, because the gate and the
8249
+ * operator ask two different questions and only one of them has to be cheap.
8250
+ *
8251
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8252
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8253
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8254
+ * that matters — after a seal, when the population is empty.
8255
+ *
8256
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8257
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8258
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8259
+ * and useful answer: "there are some, and this read could not say how many"
8260
+ * still refuses the cutover, which is the whole job.
8261
+ */
8262
+ var UnstampedRowsSchema = object({
8263
+ present: boolean(),
8264
+ rows: number().int().nonnegative().nullable()
8239
8265
  });
8266
+ /**
8267
+ * How many rows still carry NO `locationId` — the population a repoint would
8268
+ * silently re-aim at a disk that does not hold their bytes.
8269
+ *
8270
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8271
+ * over. The gate opens on a measured absence and on nothing else; an unread
8272
+ * collection and an empty one are different facts, and this repo has already
8273
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8274
+ */
8275
+ var UnstampedEventMediaCountSchema = object({
8276
+ media: UnstampedRowsSchema,
8277
+ retrainFrames: UnstampedRowsSchema,
8278
+ /** True when EITHER collection holds one. The refusal reads this. */
8279
+ anyPresent: boolean(),
8280
+ /** Sum across both, or `null` when either lane could not be counted. */
8281
+ total: number().int().nonnegative().nullable()
8282
+ }).nullable();
8240
8283
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8241
8284
  /** The independently selectable logical storage classes — every class
8242
8285
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8347,6 +8390,10 @@ var StorageMigrationMoveProgressSchema = object({
8347
8390
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8348
8391
  filesTotal: number().int().nonnegative().nullable(),
8349
8392
  bytesMoved: number().int().nonnegative(),
8393
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8394
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8395
+ * rows would be the same failure as one that silently skipped them. */
8396
+ rowsReconciled: number().int().nonnegative().optional(),
8350
8397
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8351
8398
  * crash gets a new mover, and a rate computed from the migration's start
8352
8399
  * would silently average in the time nothing was running. */
@@ -13380,6 +13427,114 @@ method(object({
13380
13427
  height: number()
13381
13428
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13382
13429
  /**
13430
+ * `failure-contribution` — the capability an addon reports its OWN losses
13431
+ * through, per camera, with the denominator attached. It stores nothing.
13432
+ *
13433
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13434
+ *
13435
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13436
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13437
+ * copied: the contributor reports what it already knows, hub-main adds only
13438
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13439
+ * somebody to forget to edit.
13440
+ *
13441
+ * They are not merged, because their invariants are opposites:
13442
+ *
13443
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13444
+ * claim a camera cost nothing, which is a measurement nobody made;
13445
+ * - a `failure-contribution` zero is the **most valuable value on the
13446
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13447
+ * and it is exactly what an absent entry cannot say.
13448
+ *
13449
+ * Putting a loss counter on a cost entry would also break the reconciliation
13450
+ * that gives `load-contribution` its point: contributions are subtracted from
13451
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13452
+ * has no process.
13453
+ *
13454
+ * ## Why not a log line, since the counters already exist
13455
+ *
13456
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13457
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13458
+ * ends in a log line, and a log line is the thing the operator asked to stop
13459
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13460
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13461
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13462
+ * media blackout were both diagnosed. The counters stay; this is where they can
13463
+ * be READ.
13464
+ *
13465
+ * ## The rate is served with its denominator or not at all
13466
+ *
13467
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13468
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13469
+ * than yesterday" and was **flat across twelve hours** once divided by the
13470
+ * successes on the same path. A surface that publishes only the numerator
13471
+ * reproduces that mistake on every read.
13472
+ *
13473
+ * ## Shape
13474
+ *
13475
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13476
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13477
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13478
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13479
+ * a forked runner's entries reach hub-main over transport that already exists.
13480
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13481
+ * result through `system.getFailureContributions`.
13482
+ */
13483
+ var FailureReasonCountSchema = object({
13484
+ /**
13485
+ * Why the attempt did not land, in the contributor's own vocabulary —
13486
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13487
+ * strings that already appear in this repo's logs and, where one exists, the
13488
+ * same string the per-track `previewMissReason` records (D276): a second
13489
+ * vocabulary for the same loss would make the row and the counter
13490
+ * un-joinable.
13491
+ */
13492
+ reason: string(),
13493
+ count: number().int().nonnegative()
13494
+ });
13495
+ var FailureContributionSchema = object({
13496
+ /**
13497
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13498
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13499
+ * `unit` free: the families are owned by different addons and a shared enum
13500
+ * is a central list that rots invisibly.
13501
+ */
13502
+ family: string(),
13503
+ /**
13504
+ * The NUMERIC device id — the same value every log line carries as
13505
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13506
+ * cannot name the camera must not emit the entry, because a fleet total
13507
+ * cannot answer the only question anybody asks of this surface.
13508
+ */
13509
+ deviceId: number().int().positive(),
13510
+ /**
13511
+ * A second dimension inside the family: the model / step id for an inference
13512
+ * timeout, so "which camera AND which model" is one read. Absent when the
13513
+ * family has a single variant.
13514
+ */
13515
+ variant: string().optional(),
13516
+ /**
13517
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13518
+ * differencing two reads must drop the interval when it changes, because the
13519
+ * counter restarted from zero in a respawned runner. Same discipline as
13520
+ * `LoadContribution.startedAtMs`.
13521
+ */
13522
+ sinceMs: number(),
13523
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13524
+ atMs: number(),
13525
+ /**
13526
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13527
+ * window. A failure count published without it is the mistake this schema
13528
+ * exists to make impossible.
13529
+ */
13530
+ attempts: number().int().nonnegative(),
13531
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13532
+ succeeded: number().int().nonnegative(),
13533
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13534
+ reasons: array(FailureReasonCountSchema).readonly()
13535
+ });
13536
+ method(_void(), array(FailureContributionSchema).readonly());
13537
+ /**
13383
13538
  * filesystem-browse — per-node capability for browsing the node's local
13384
13539
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13385
13540
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13901,6 +14056,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13901
14056
  kind: "mutation",
13902
14057
  auth: "admin"
13903
14058
  });
14059
+ var LoadContributionSchema = object({
14060
+ role: _enum([
14061
+ "decode",
14062
+ "transcode",
14063
+ "recording",
14064
+ "streaming",
14065
+ "detection"
14066
+ ]),
14067
+ /**
14068
+ * The NUMERIC device id — the same value every log line carries as
14069
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14070
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
14071
+ * contributor that cannot name its camera must not emit the entry at all,
14072
+ * because an unnamed per-camera entry is indistinguishable from a shared one
14073
+ * and would quietly turn one camera's cost into everybody's.
14074
+ */
14075
+ deviceId: number().int().positive().nullable(),
14076
+ attribution: _enum([
14077
+ "measured",
14078
+ "accounted",
14079
+ "unattributable"
14080
+ ]),
14081
+ /**
14082
+ * What ONE entry is, in the contributor's own words — `615/high`,
14083
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14084
+ * family and inventing a common one would lose the only information that
14085
+ * makes two entries for the same camera distinguishable.
14086
+ */
14087
+ unit: string(),
14088
+ /**
14089
+ * The OS process this cost lives in, when there is one. Present so a
14090
+ * consumer can (a) tell two generations of the same unit apart across a
14091
+ * restart, and (b) subtract claimed processes from the node's process
14092
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14093
+ * process of its own.
14094
+ */
14095
+ pid: number().int().positive().optional(),
14096
+ /**
14097
+ * When this generation started. The pid's incarnation marker: a consumer
14098
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14099
+ * window when this changes, because the counter restarted from zero in a new
14100
+ * process.
14101
+ */
14102
+ startedAtMs: number().optional(),
14103
+ /**
14104
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14105
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
14106
+ * contribution is asked for.
14107
+ *
14108
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
14109
+ * needs a sampler, and a new per-node sampler is the defect half of
14110
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14111
+ * by whoever already keeps a history; a rate cannot be un-averaged.
14112
+ *
14113
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14114
+ * an entry with no process.
14115
+ */
14116
+ cpuSeconds: number().optional(),
14117
+ /** Resident bytes of this unit's process, same source and same rules. */
14118
+ rssBytes: number().optional()
14119
+ });
14120
+ method(_void(), array(LoadContributionSchema).readonly());
13904
14121
  /**
13905
14122
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13906
14123
  * through. It stores nothing.
@@ -13977,176 +14194,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13977
14194
  tags: record(string(), string()).optional()
13978
14195
  }), array(LogEntrySchema).readonly());
13979
14196
  /**
13980
- * `failure-contribution` — the capability an addon reports its OWN losses
13981
- * through, per camera, with the denominator attached. It stores nothing.
13982
- *
13983
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13984
- *
13985
- * `load-contribution` answers *what did this camera COST*. This answers *what
13986
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13987
- * copied: the contributor reports what it already knows, hub-main adds only
13988
- * `addonId`, nothing needs global knowledge, and there is no central list for
13989
- * somebody to forget to edit.
13990
- *
13991
- * They are not merged, because their invariants are opposites:
13992
- *
13993
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13994
- * claim a camera cost nothing, which is a measurement nobody made;
13995
- * - a `failure-contribution` zero is the **most valuable value on the
13996
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13997
- * and it is exactly what an absent entry cannot say.
13998
- *
13999
- * Putting a loss counter on a cost entry would also break the reconciliation
14000
- * that gives `load-contribution` its point: contributions are subtracted from
14001
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
14002
- * has no process.
14003
- *
14004
- * ## Why not a log line, since the counters already exist
14005
- *
14006
- * Several of these paths already counted themselves — `CaptureScheduler`'s
14007
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
14008
- * ends in a log line, and a log line is the thing the operator asked to stop
14009
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
14010
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
14011
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
14012
- * media blackout were both diagnosed. The counters stay; this is where they can
14013
- * be READ.
14014
- *
14015
- * ## The rate is served with its denominator or not at all
14016
- *
14017
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
14018
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
14019
- * than yesterday" and was **flat across twelve hours** once divided by the
14020
- * successes on the same path. A surface that publishes only the numerator
14021
- * reproduces that mistake on every read.
14022
- *
14023
- * ## Shape
14024
- *
14025
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
14026
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
14027
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
14028
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
14029
- * a forked runner's entries reach hub-main over transport that already exists.
14030
- * No new UDS message, no second registry (D3). The operator reads the assembled
14031
- * result through `system.getFailureContributions`.
14032
- */
14033
- var FailureReasonCountSchema = object({
14034
- /**
14035
- * Why the attempt did not land, in the contributor's own vocabulary —
14036
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
14037
- * strings that already appear in this repo's logs and, where one exists, the
14038
- * same string the per-track `previewMissReason` records (D276): a second
14039
- * vocabulary for the same loss would make the row and the counter
14040
- * un-joinable.
14041
- */
14042
- reason: string(),
14043
- count: number().int().nonnegative()
14044
- });
14045
- var FailureContributionSchema = object({
14046
- /**
14047
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
14048
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
14049
- * `unit` free: the families are owned by different addons and a shared enum
14050
- * is a central list that rots invisibly.
14051
- */
14052
- family: string(),
14053
- /**
14054
- * The NUMERIC device id — the same value every log line carries as
14055
- * `tags.deviceId`. Never nullable and never absent: a contributor that
14056
- * cannot name the camera must not emit the entry, because a fleet total
14057
- * cannot answer the only question anybody asks of this surface.
14058
- */
14059
- deviceId: number().int().positive(),
14060
- /**
14061
- * A second dimension inside the family: the model / step id for an inference
14062
- * timeout, so "which camera AND which model" is one read. Absent when the
14063
- * family has a single variant.
14064
- */
14065
- variant: string().optional(),
14066
- /**
14067
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
14068
- * differencing two reads must drop the interval when it changes, because the
14069
- * counter restarted from zero in a respawned runner. Same discipline as
14070
- * `LoadContribution.startedAtMs`.
14071
- */
14072
- sinceMs: number(),
14073
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
14074
- atMs: number(),
14075
- /**
14076
- * THE DENOMINATOR — every attempt on this path for this camera in the
14077
- * window. A failure count published without it is the mistake this schema
14078
- * exists to make impossible.
14079
- */
14080
- attempts: number().int().nonnegative(),
14081
- /** Attempts that landed. `attempts - succeeded` is the loss. */
14082
- succeeded: number().int().nonnegative(),
14083
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
14084
- reasons: array(FailureReasonCountSchema).readonly()
14085
- });
14086
- method(_void(), array(FailureContributionSchema).readonly());
14087
- var LoadContributionSchema = object({
14088
- role: _enum([
14089
- "decode",
14090
- "transcode",
14091
- "recording",
14092
- "streaming",
14093
- "detection"
14094
- ]),
14095
- /**
14096
- * The NUMERIC device id — the same value every log line carries as
14097
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14098
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
14099
- * contributor that cannot name its camera must not emit the entry at all,
14100
- * because an unnamed per-camera entry is indistinguishable from a shared one
14101
- * and would quietly turn one camera's cost into everybody's.
14102
- */
14103
- deviceId: number().int().positive().nullable(),
14104
- attribution: _enum([
14105
- "measured",
14106
- "accounted",
14107
- "unattributable"
14108
- ]),
14109
- /**
14110
- * What ONE entry is, in the contributor's own words — `615/high`,
14111
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14112
- * family and inventing a common one would lose the only information that
14113
- * makes two entries for the same camera distinguishable.
14114
- */
14115
- unit: string(),
14116
- /**
14117
- * The OS process this cost lives in, when there is one. Present so a
14118
- * consumer can (a) tell two generations of the same unit apart across a
14119
- * restart, and (b) subtract claimed processes from the node's process
14120
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14121
- * process of its own.
14122
- */
14123
- pid: number().int().positive().optional(),
14124
- /**
14125
- * When this generation started. The pid's incarnation marker: a consumer
14126
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14127
- * window when this changes, because the counter restarted from zero in a new
14128
- * process.
14129
- */
14130
- startedAtMs: number().optional(),
14131
- /**
14132
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14133
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
14134
- * contribution is asked for.
14135
- *
14136
- * Cumulative and not a rate on purpose: a rate needs a window, a window
14137
- * needs a sampler, and a new per-node sampler is the defect half of
14138
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14139
- * by whoever already keeps a history; a rate cannot be un-averaged.
14140
- *
14141
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14142
- * an entry with no process.
14143
- */
14144
- cpuSeconds: number().optional(),
14145
- /** Resident bytes of this unit's process, same source and same rules. */
14146
- rssBytes: number().optional()
14147
- });
14148
- method(_void(), array(LoadContributionSchema).readonly());
14149
- /**
14150
14197
  * `login-method` — collection cap through which auth addons contribute
14151
14198
  * their pre-auth login surfaces to the login page. This is the SINGLE,
14152
14199
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18884,12 +18931,53 @@ var MediaFileKindEnum = _enum([
18884
18931
  "keyFrameSmall",
18885
18932
  "thumbnailSmall"
18886
18933
  ]);
18934
+ /**
18935
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18936
+ * ARE — never the bytes themselves.
18937
+ *
18938
+ * ## Why `url` and not `base64`
18939
+ *
18940
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18941
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18942
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18943
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18944
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18945
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18946
+ *
18947
+ * `url` points at the `event-media` data plane
18948
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18949
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18950
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18951
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18952
+ * no less protected than they were inside a `view`-level cap response — see
18953
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18954
+ * (per-device scoping).
18955
+ *
18956
+ * The URL is built from the row's **stored** key, which is not always its
18957
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18958
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18959
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18960
+ *
18961
+ * ## `base64` is TRANSITIONAL and is going away
18962
+ *
18963
+ * It is still populated for one reason: the deployed viewer's track-detail
18964
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18965
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18966
+ * triangle — not as absence. Removing the field before that viewer ships is an
18967
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18968
+ * delete this line and the `withBytes` pass-through in
18969
+ * `analytics-query-facade.ts`; nothing else reads it.
18970
+ */
18887
18971
  var MediaFileSchema = object({
18888
18972
  key: string(),
18889
18973
  kind: MediaFileKindEnum,
18890
- base64: string(),
18891
18974
  sizeBytes: number(),
18892
18975
  timestamp: number()
18976
+ }).extend({
18977
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18978
+ url: string(),
18979
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18980
+ base64: string()
18893
18981
  });
18894
18982
  /**
18895
18983
  * One media row WITHOUT its bytes.
@@ -18901,7 +18989,9 @@ var MediaFileSchema = object({
18901
18989
  * blocks the whole view.
18902
18990
  *
18903
18991
  * `sizeBytes` is carried because it is what lets a client decide between the
18904
- * stored blob and a `?variant=thumb` rendering without fetching either.
18992
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18993
+ * `url` because a client that had to build the plane path itself is a second
18994
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18905
18995
  */
18906
18996
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18907
18997
  /**
@@ -19590,6 +19680,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19590
19680
  }), array(MediaFileSchema).readonly()), method(object({
19591
19681
  trackId: string(),
19592
19682
  deviceId: number()
19683
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19684
+ eventId: string(),
19685
+ deviceId: number()
19593
19686
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19594
19687
  kind: "mutation",
19595
19688
  auth: "admin"
@@ -24597,10 +24690,24 @@ var FaceClusterSchema = object({
24597
24690
  size: number().int(),
24598
24691
  cohesion: number()
24599
24692
  });
24693
+ /**
24694
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
24695
+ * are — never the bytes.
24696
+ *
24697
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
24698
+ * track/event contract) is still populated because a deployed viewer requires
24699
+ * the field to parse a row at all; this method has no such reader. Its ONE
24700
+ * caller is the admin UI's detail modal, which was building
24701
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
24702
+ * dialog already rendering its key FRAME from the `event-media` plane.
24703
+ *
24704
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
24705
+ * media key directly, so this needed no new plane and no new access decision.
24706
+ */
24600
24707
  var MediaFileLiteSchema$1 = object({
24601
24708
  key: string(),
24602
24709
  kind: string(),
24603
- base64: string(),
24710
+ url: string(),
24604
24711
  sizeBytes: number(),
24605
24712
  timestamp: number()
24606
24713
  });
@@ -27622,10 +27729,24 @@ var PlateInfoSchema = object({
27622
27729
  */
27623
27730
  cropUrl: string().optional()
27624
27731
  });
27732
+ /**
27733
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
27734
+ * are — never the bytes.
27735
+ *
27736
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
27737
+ * track/event contract) is still populated because a deployed viewer requires
27738
+ * the field to parse a row at all; this method has no such reader. Its ONE
27739
+ * caller is the admin UI's detail modal, which was building
27740
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
27741
+ * dialog already rendering its key FRAME from the `event-media` plane.
27742
+ *
27743
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
27744
+ * media key directly, so this needed no new plane and no new access decision.
27745
+ */
27625
27746
  var MediaFileLiteSchema = object({
27626
27747
  key: string(),
27627
27748
  kind: string(),
27628
- base64: string(),
27749
+ url: string(),
27629
27750
  sizeBytes: number(),
27630
27751
  timestamp: number()
27631
27752
  });
@@ -35522,6 +35643,12 @@ Object.freeze({
35522
35643
  addonId: null,
35523
35644
  access: "view"
35524
35645
  },
35646
+ "pipelineAnalytics.listEventMedia": {
35647
+ capName: "pipeline-analytics",
35648
+ capScope: "device",
35649
+ addonId: null,
35650
+ access: "view"
35651
+ },
35525
35652
  "pipelineAnalytics.listGroups": {
35526
35653
  capName: "pipeline-analytics",
35527
35654
  capScope: "device",
@@ -39145,6 +39272,11 @@ Object.freeze({
39145
39272
  form: "array",
39146
39273
  optional: false
39147
39274
  }],
39275
+ "pipelineAnalytics.listEventMedia": [{
39276
+ name: "deviceId",
39277
+ form: "single",
39278
+ optional: false
39279
+ }],
39148
39280
  "pipelineAnalytics.listGroups": [{
39149
39281
  name: "deviceIds",
39150
39282
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-import-alexa",
3
- "version": "0.2.44",
3
+ "version": "0.2.46",
4
4
  "description": "Alexa device-import provider for CamStack — imports the smart-home devices in a user's Alexa account via the unofficial alexa-remote2 cookie/token client (the inverse of the Alexa exporter)",
5
5
  "keywords": [
6
6
  "camstack",