@camstack/addon-mqtt-broker 1.2.4 → 1.2.6

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.
@@ -44,7 +44,7 @@ let crypto$10 = __toESM(crypto$1, 1);
44
44
  crypto$1 = __toESM(crypto$1);
45
45
  let node_fs = require("node:fs");
46
46
  let node_path = require("node:path");
47
- //#region ../types/dist/event-category-D4HJq7Mw.mjs
47
+ //#region ../types/dist/event-category-BLcNejAE.mjs
48
48
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
49
49
  EventCategory["SystemBoot"] = "system.boot";
50
50
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -194,9 +194,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
194
194
  EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
195
195
  EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
196
196
  EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
197
- /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
198
- * thumb is a scrub gap the recorder's keyframe backfill covers. */
199
- EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
200
197
  /** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
201
198
  * progress bar the client reconciles via `recordingExport.getExport`. */
202
199
  EventCategory["RecordingExportProgress"] = "recording.export.progress";
@@ -6861,7 +6858,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
6861
6858
  patch: record(string(), unknown())
6862
6859
  }), object({ success: literal(true) });
6863
6860
  object({ deviceId: number() }), unknown().nullable();
6864
- /** Shorthand to define a method schema */
6865
6861
  function method(input, output, options) {
6866
6862
  return {
6867
6863
  input,
@@ -6869,6 +6865,7 @@ function method(input, output, options) {
6869
6865
  kind: options?.kind ?? "query",
6870
6866
  auth: options?.auth ?? "protected",
6871
6867
  ...options?.access !== void 0 ? { access: options.access } : {},
6868
+ ...options?.caller !== void 0 ? { caller: options.caller } : {},
6872
6869
  timeoutMs: options?.timeoutMs
6873
6870
  };
6874
6871
  }
@@ -7550,16 +7547,23 @@ var StorageLocationDeclarationSchema = object({
7550
7547
  * Which node root the seeded `<id>:default` instance is placed under on a
7551
7548
  * FRESH install:
7552
7549
  * - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
7553
- * the appData volume. Right for small/durable data (backups, logs, models).
7550
+ * the appData volume. Right for small/durable data (logs, models).
7554
7551
  * - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
7555
7552
  * env is set, else falls back to the data root. Right for bulky, hot media
7556
7553
  * (recordings, event media) that should stay off the appData disk.
7554
+ * - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
7555
+ * `/backups` in the image) so archives live on their own mount rather than
7556
+ * filling the appData disk. Falls back to the data root when unset.
7557
7557
  *
7558
7558
  * Only affects the seeded default's `basePath`; operators can repoint any
7559
7559
  * location afterwards, and a `defaultsTo` slot inherits its parent's root
7560
7560
  * regardless of this field. Absent (the common case) is treated as `'data'`.
7561
7561
  */
7562
- defaultRoot: _enum(["data", "media"]).optional()
7562
+ defaultRoot: _enum([
7563
+ "data",
7564
+ "media",
7565
+ "backup"
7566
+ ]).optional()
7563
7567
  });
7564
7568
  var DecoderStatsSchema = object({
7565
7569
  inputFps: number(),
@@ -8222,6 +8226,59 @@ for (const l of AUDIO_MACRO_LABELS) {
8222
8226
  /** The complete taxonomy dictionary, keyed by kind. */
8223
8227
  var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8224
8228
  /**
8229
+ * Notification-Center taxonomy — the fixed vocabulary the NC rule editor
8230
+ * offers as pickers instead of free text. Derived (never hand-listed) from the
8231
+ * single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
8232
+ * taxonomy surface (timeline, filters, event page).
8233
+ *
8234
+ * Three buckets, mapped onto the rule editor's `stringList` conditions:
8235
+ * - `videoClasses` → detection classes (person / vehicle / animal + subs)
8236
+ * for the `classes` / `classesExclude` conditions.
8237
+ * - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
8238
+ * the same class picker, grouped under an Audio header.
8239
+ * - `labels` → sensor + control taxonomy kinds (doorbell / contact /
8240
+ * lock / …) for the `sensorKinds` device-event condition.
8241
+ *
8242
+ * Each entry carries `parentKind` so the client can group video subs under
8243
+ * their macro and sensor/control kinds under their category. This surface is
8244
+ * served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
8245
+ * method, no codegen — so it ships train-free with an addon deploy.
8246
+ */
8247
+ /** One selectable taxonomy value: a stable kind id + display label + parent. */
8248
+ var NcTaxonomyEntrySchema = object({
8249
+ /** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
8250
+ kind: string(),
8251
+ /** English fallback label (the UI translates via the event-kind i18n key). */
8252
+ label: string(),
8253
+ /** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
8254
+ parentKind: string().nullable()
8255
+ });
8256
+ object({
8257
+ videoClasses: array(NcTaxonomyEntrySchema),
8258
+ audioKinds: array(NcTaxonomyEntrySchema),
8259
+ labels: array(NcTaxonomyEntrySchema)
8260
+ });
8261
+ function toEntry(kind, label, parentKind) {
8262
+ return {
8263
+ kind,
8264
+ label,
8265
+ parentKind
8266
+ };
8267
+ }
8268
+ /**
8269
+ * Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
8270
+ * (macros before their subs), which the client relies on for stable grouping.
8271
+ */
8272
+ function buildNcTaxonomy() {
8273
+ const all = Object.values(EVENT_TAXONOMY);
8274
+ return {
8275
+ videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
8276
+ audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
8277
+ labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
8278
+ };
8279
+ }
8280
+ Object.freeze(buildNcTaxonomy());
8281
+ /**
8225
8282
  * Error types for the safe expression engine. Two distinct classes so callers
8226
8283
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
8227
8284
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -8857,6 +8914,644 @@ var AccessoryKind = {
8857
8914
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
8858
8915
  DeviceFeature.BatteryOperated;
8859
8916
  /**
8917
+ * Shared geometry vocabulary for on-frame shape caps — privacy-mask,
8918
+ * motion-zones, and the detection zones/lines editor all speak this one
8919
+ * language so a single drawing-plane editor and the providers stay
8920
+ * decoupled from each cap's storage.
8921
+ *
8922
+ * All coordinates are normalized 0..1 of the camera frame (top-left
8923
+ * origin). Each cap composes the SUBSET of shape kinds it supports and
8924
+ * advertises it via `supportedShapes` in its `getOptions`.
8925
+ */
8926
+ /** A normalized 0..1 point (top-left origin). */
8927
+ var MaskPointSchema = object({
8928
+ x: number(),
8929
+ y: number()
8930
+ });
8931
+ /** Axis-aligned rectangle (normalized 0..1). */
8932
+ var MaskRectShapeSchema = object({
8933
+ kind: literal("rect"),
8934
+ x: number(),
8935
+ y: number(),
8936
+ width: number(),
8937
+ height: number()
8938
+ });
8939
+ /** Free polygon — an ordered list of normalized vertices (≥3). */
8940
+ var MaskPolygonShapeSchema = object({
8941
+ kind: literal("polygon"),
8942
+ points: array(MaskPointSchema)
8943
+ });
8944
+ /** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
8945
+ var MaskGridShapeSchema = object({
8946
+ kind: literal("grid"),
8947
+ gridWidth: number(),
8948
+ gridHeight: number(),
8949
+ cells: array(boolean())
8950
+ });
8951
+ discriminatedUnion("kind", [
8952
+ MaskRectShapeSchema,
8953
+ MaskPolygonShapeSchema,
8954
+ MaskGridShapeSchema,
8955
+ object({
8956
+ kind: literal("line"),
8957
+ points: array(MaskPointSchema)
8958
+ })
8959
+ ]);
8960
+ /** Every shape-kind discriminant, for `supportedShapes` advertisement. */
8961
+ var MaskShapeKindSchema = _enum([
8962
+ "rect",
8963
+ "polygon",
8964
+ "grid",
8965
+ "line"
8966
+ ]);
8967
+ /** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
8968
+ var MaskPolygonVerticesSchema = object({
8969
+ min: number(),
8970
+ max: number()
8971
+ });
8972
+ /** Grid dimensions when a cap supports 'grid'. */
8973
+ var MaskGridDimsSchema = object({
8974
+ width: number(),
8975
+ height: number()
8976
+ });
8977
+ /**
8978
+ * notification-rules — the Notification Center rule surface (P1 core).
8979
+ *
8980
+ * Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
8981
+ * (operator decisions D-1/D-2/D-3 are binding):
8982
+ *
8983
+ * - D-2: rule EVALUATION lives in `addon-post-analysis` (the
8984
+ * `notification-center` module), hooked on the durable persistence
8985
+ * moments (object-event insert, TrackCloser.closeExpired) with a
8986
+ * persisted outbox + retry — never the lossy telemetry bus (D8).
8987
+ * - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
8988
+ * FIRST persisted detection matching the conditions (per-track dedup,
8989
+ * `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
8990
+ * `delivery: 'track-end'` evaluates the finalized track record at close.
8991
+ * - DISPATCH stays behind `notification-output` (rules reference targets
8992
+ * by id; per-backend params are a passthrough blob capped by the
8993
+ * target kind's own caps/degrade engine).
8994
+ *
8995
+ * P1 scope: admin-authored rules only (`createdBy` stamped from the
8996
+ * server-injected caller identity — the first `caller: 'required'`
8997
+ * adopter). The P1 condition subset is: devices, classes(+exclude),
8998
+ * minConfidence, admin zones (any/all + exclude), weekly schedule
8999
+ * windows, and the optional label/identity/plate matchers. User rules,
9000
+ * private zones, per-recipient fan-out and the wider condition table are
9001
+ * P2+ (see spec §7).
9002
+ *
9003
+ * All schemas here are the single source of truth — `NcRule` etc. are
9004
+ * `z.infer` exports; no duplicate interfaces (the advanced-notifier
9005
+ * schema/interface drift is explicitly not repeated).
9006
+ */
9007
+ /**
9008
+ * D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
9009
+ * The value maps 1:1 onto the evaluated record kind:
9010
+ * - `immediate` ↔ object-event persist (lowest-latency detection burst)
9011
+ * - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
9012
+ * - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
9013
+ * change of a LINKED device, one row per linked camera)
9014
+ * - `package-event` ↔ PackageDropDetector object-event insert (a `package`
9015
+ * delivery / pick-up)
9016
+ *
9017
+ * `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
9018
+ * `package-event` are pure trigger kinds (no urgency dimension). Extending
9019
+ * this one field keeps the schema additive — a rule still declares exactly
9020
+ * one trigger.
9021
+ */
9022
+ var NcDeliverySchema = _enum([
9023
+ "immediate",
9024
+ "track-end",
9025
+ "device-event",
9026
+ "package-event"
9027
+ ]);
9028
+ /** Weekly schedule — OR of windows; absence on the rule = always active. */
9029
+ var NcScheduleSchema = object({
9030
+ windows: array(object({
9031
+ /** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
9032
+ days: array(number().int().min(0).max(6)).min(1),
9033
+ startMinute: number().int().min(0).max(1439),
9034
+ endMinute: number().int().min(0).max(1439)
9035
+ })).min(1),
9036
+ /** IANA timezone; default = hub host timezone. */
9037
+ timezone: string().optional(),
9038
+ /** Active OUTSIDE the windows (e.g. "only outside business hours"). */
9039
+ invert: boolean().optional()
9040
+ });
9041
+ /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
9042
+ var NcPlateMatcherSchema = object({
9043
+ values: array(string().min(1)).min(1),
9044
+ /** Max Levenshtein distance after normalization (uppercase alphanumeric). */
9045
+ maxDistance: number().int().min(0).max(3).default(1)
9046
+ });
9047
+ /**
9048
+ * Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
9049
+ * occupancy edge for a device — optionally narrowed to a single admin
9050
+ * `zoneId` and/or object `className`. `op` selects the edge/threshold:
9051
+ * - `became-occupied` (default) — count crossed 0 → ≥ `count`
9052
+ * - `became-free` — count crossed ≥ `count` → below it
9053
+ * - `>=` / `<=` — count is at/over or at/under `count`
9054
+ * `sustainSeconds` requires the condition hold continuously that long
9055
+ * before firing (debounces flicker; 0 = fire on the first matching edge).
9056
+ * Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
9057
+ * the condition never matches. Confirmed edge-state survives addon restarts
9058
+ * (declared SQLite collection, reseeded on boot).
9059
+ */
9060
+ var NcOccupancyConditionSchema = object({
9061
+ /** Admin zone id to scope the count to; absent = whole-frame occupancy. */
9062
+ zoneId: string().optional(),
9063
+ /** Object class to count; absent = any class. */
9064
+ className: string().optional(),
9065
+ op: _enum([
9066
+ "became-occupied",
9067
+ "became-free",
9068
+ ">=",
9069
+ "<="
9070
+ ]).default("became-occupied"),
9071
+ count: number().int().min(0).default(1),
9072
+ sustainSeconds: number().int().min(0).max(3600).default(15)
9073
+ });
9074
+ /** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
9075
+ var NcZoneConditionSchema = object({
9076
+ ids: array(string().min(1)).min(1),
9077
+ /** Quantifier over `ids` — at least one / every one visited. */
9078
+ match: _enum(["any", "all"]).default("any")
9079
+ });
9080
+ /**
9081
+ * The P1 condition set — a flat AND of groups; absent group = pass;
9082
+ * membership lists are OR within the list (spec §2.3).
9083
+ */
9084
+ var NcConditionsSchema = object({
9085
+ /** Device scope — absent = all devices. */
9086
+ devices: array(number()).optional(),
9087
+ /** Detector class names (any overlap with the record's class set). */
9088
+ classes: array(string().min(1)).optional(),
9089
+ /** Veto classes — any overlap fails the rule. */
9090
+ classesExclude: array(string().min(1)).optional(),
9091
+ /** Minimum detection confidence 0–1 (fails when the record has none). */
9092
+ minConfidence: number().min(0).max(1).optional(),
9093
+ /** Admin zone membership over event `zones` / track `zonesVisited`. */
9094
+ zones: NcZoneConditionSchema.optional(),
9095
+ /** Veto zones — any hit fails the rule. */
9096
+ zonesExclude: array(string().min(1)).optional(),
9097
+ /**
9098
+ * Exact (case-insensitive) match on the record's collapsed `label`
9099
+ * (identity name / plate text / subclass).
9100
+ */
9101
+ labelEquals: array(string().min(1)).optional(),
9102
+ /**
9103
+ * Identity matcher. P1 boundary: matched against the record's collapsed
9104
+ * `label` (the identity display name propagated by the face pipeline) —
9105
+ * identity-ID matching rides in P2 when identity ids reach the record.
9106
+ */
9107
+ identities: array(string().min(1)).optional(),
9108
+ /** Fuzzy plate matcher against the record's `label` (plate text). */
9109
+ plates: NcPlateMatcherSchema.optional(),
9110
+ /**
9111
+ * Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
9112
+ * Same P1 boundary: matched against the record's collapsed `label` (the
9113
+ * identity display name). A record with NO label passes (nothing to
9114
+ * exclude), unlike the include variant which fails on an absent label.
9115
+ */
9116
+ identitiesExclude: array(string().min(1)).optional(),
9117
+ /**
9118
+ * Minimum server-computed key-event importance in [0,1] (`Track.importance`).
9119
+ * TRACK-END only: importance is scored at track close, so it does not exist
9120
+ * at immediate / object-event evaluation time (see catalog `appliesTo`). At
9121
+ * close the value is threaded via the close-time info (the `Track` clone is
9122
+ * captured before the DB row is updated, so it would otherwise read stale).
9123
+ * Fails when the record carries no importance (never guess quality — the
9124
+ * `minConfidence` precedent). MVP cut: a single scalar threshold.
9125
+ */
9126
+ minImportance: number().min(0).max(1).optional(),
9127
+ /**
9128
+ * Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
9129
+ * TRACK-END only: an `immediate` / object-event subject has no closed
9130
+ * lifespan, so a dwell condition never matches immediate delivery
9131
+ * (documented choice — the object-event record carries no `firstSeen`,
9132
+ * so dwell cannot be computed from what the subject actually carries).
9133
+ */
9134
+ minDwellSeconds: number().min(0).optional(),
9135
+ /**
9136
+ * Detection provenance filter. `any` (default / absent) matches every
9137
+ * source; otherwise the subject's source must equal it. Legacy records
9138
+ * with no stamped source are treated as `pipeline`. The union spans both
9139
+ * record kinds — object events carry `pipeline` | `onboard`, synthetic
9140
+ * tracks carry `sensor`.
9141
+ */
9142
+ source: _enum([
9143
+ "pipeline",
9144
+ "onboard",
9145
+ "sensor",
9146
+ "any"
9147
+ ]).optional(),
9148
+ /**
9149
+ * Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
9150
+ * detector `minConfidence` (that gates the object-detection score; this
9151
+ * gates the recognition/OCR match score). Fails when the subject carries
9152
+ * no label-match confidence (never guess). TRACK-END only: the confidence
9153
+ * lives on the recognition result and reaches the subject at track close.
9154
+ *
9155
+ * What it measures precisely (plumbed at track close — the closer threads
9156
+ * the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
9157
+ * `importance`): the BEST recognition match confidence observed for the
9158
+ * label the track carries at close — for a face, the peak cosine similarity
9159
+ * of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
9160
+ * for a plate, the peak OCR read score of the best-held plate
9161
+ * (`plateText.confidence`). When BOTH a face and a plate were recognized on
9162
+ * one track the higher of the two is used. A track that ended with no
9163
+ * confident identity/plate match carries no value, so the condition fails
9164
+ * closed for it (an un-recognized subject).
9165
+ */
9166
+ minLabelConfidence: number().min(0).max(1).optional(),
9167
+ /**
9168
+ * DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
9169
+ * e.g. a doorbell `press` / `press_long`) — matched case-insensitively
9170
+ * against the token carried on the device-event subject (extracted from the
9171
+ * event-emitter runtime slice's `lastEvent.eventType`). Fails when the
9172
+ * subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
9173
+ * eventType, so gate those with {@link sensorKinds} instead.
9174
+ */
9175
+ eventTypeTokens: array(string().min(1)).optional(),
9176
+ /**
9177
+ * DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
9178
+ * `contact`, `button`, `device-event`) — matched against the persisted
9179
+ * `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
9180
+ */
9181
+ sensorKinds: array(string().min(1)).optional(),
9182
+ /**
9183
+ * PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
9184
+ * (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
9185
+ * when the subject's phase does not match (a subject always carries a phase
9186
+ * on the package-event trigger).
9187
+ */
9188
+ packagePhase: _enum([
9189
+ "delivered",
9190
+ "picked-up",
9191
+ "both"
9192
+ ]).optional(),
9193
+ /**
9194
+ * PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
9195
+ * (MaskShape vocabulary). A record passes when its bbox overlaps ANY
9196
+ * listed polygon (ZoneEngine membership semantics). Evaluated only when
9197
+ * the subject carries a bbox; absent bbox ⇒ the condition FAILS.
9198
+ */
9199
+ customZones: array(MaskPolygonShapeSchema).optional(),
9200
+ /**
9201
+ * DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
9202
+ * (optionally zone/class-scoped) occupancy count crosses the configured
9203
+ * threshold and holds for `sustainSeconds`. Fail-closed on missing
9204
+ * substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
9205
+ */
9206
+ occupancy: NcOccupancyConditionSchema.optional()
9207
+ });
9208
+ /** One delivery target: a `notification-output` Target ref + passthrough params. */
9209
+ var NcRuleTargetSchema = object({
9210
+ /** `notification-output` Target id. */
9211
+ targetId: string().min(1),
9212
+ /**
9213
+ * Per-backend passthrough. Recognized keys are mapped onto the canonical
9214
+ * Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
9215
+ * degrade engine drops what the backend can't render.
9216
+ */
9217
+ params: record(string(), unknown()).optional()
9218
+ });
9219
+ /**
9220
+ * Media attachment policy (P1 still-image subset).
9221
+ * - `best` — the best AVAILABLE subject image at dispatch time (D-3).
9222
+ * - `best-matching` — the media that explains WHY the rule fired: a rule
9223
+ * matched on identities attaches the subject's `faceCrop`, one matched on
9224
+ * plates attaches the `plateCrop`; a rule with no identity/plate condition
9225
+ * (or when the specific crop is missing) degrades to `best`, then
9226
+ * `keyFrame`, then no attachment — never delaying the send. The matched
9227
+ * condition summary is frozen on the outbox row at enqueue (like the rule
9228
+ * name), so the choice never drifts from the record that fired it.
9229
+ * - `keyFrame` — the clean scene frame (no subject box).
9230
+ * - `none` — no attachment.
9231
+ */
9232
+ var NcMediaPolicySchema = object({ attach: _enum([
9233
+ "best",
9234
+ "best-matching",
9235
+ "keyFrame",
9236
+ "none"
9237
+ ]).default("best") });
9238
+ /** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
9239
+ var NcThrottleSchema = object({
9240
+ cooldownSec: number().int().min(0).max(86400).default(60),
9241
+ /** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
9242
+ scope: _enum(["rule", "rule-device"]).default("rule-device")
9243
+ });
9244
+ /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
9245
+ var NcRuleInputSchema = object({
9246
+ name: string().min(1).max(200),
9247
+ enabled: boolean().default(true),
9248
+ delivery: NcDeliverySchema,
9249
+ conditions: NcConditionsSchema.default({}),
9250
+ schedule: NcScheduleSchema.optional(),
9251
+ targets: array(NcRuleTargetSchema).min(1),
9252
+ media: NcMediaPolicySchema.default({ attach: "best" }),
9253
+ throttle: NcThrottleSchema.default({
9254
+ cooldownSec: 60,
9255
+ scope: "rule-device"
9256
+ }),
9257
+ /** `{{var}}` templating over camera/class/label/zones/confidence/time. */
9258
+ template: object({
9259
+ title: string().max(500).optional(),
9260
+ body: string().max(2e3).optional()
9261
+ }).optional(),
9262
+ /** Canonical notification priority ordinal (1..5); per-target overridable. */
9263
+ priority: number().int().min(1).max(5).default(3),
9264
+ /**
9265
+ * Ownership/visibility key. Absent = admin/global rule (unchanged legacy
9266
+ * behaviour, visible to all, read-only in the viewer). Present = personal
9267
+ * rule owned by this userId. Server-stamped; never trusted from a client.
9268
+ */
9269
+ ownerUserId: string().optional()
9270
+ });
9271
+ /**
9272
+ * Partial patch for `updateRule` — any subset of the input fields, plus the
9273
+ * persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
9274
+ * NOT a client-authored input field (it lives on the persisted rule, not the
9275
+ * input), so it is added here explicitly to let the store's per-target opt-out
9276
+ * toggle round-trip through the shared `update` path. Viewer opt-out mutations
9277
+ * still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
9278
+ * `updateRule` patch.
9279
+ */
9280
+ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
9281
+ /** A persisted rule. */
9282
+ var NcRuleSchema = NcRuleInputSchema.extend({
9283
+ id: string(),
9284
+ /** userId of the admin who created the rule (server-stamped caller). */
9285
+ createdBy: string(),
9286
+ createdAt: number(),
9287
+ updatedAt: number(),
9288
+ /**
9289
+ * Per-target opt-out set. A targetId here is suppressed for THIS rule at
9290
+ * send time. Only a target's OWNER may add/remove its id (server-checked
9291
+ * in `nc.setRuleTargetEnabled`). Defaults to empty.
9292
+ */
9293
+ disabledTargetIds: array(string()).default([])
9294
+ });
9295
+ var NcTestResultSchema = object({
9296
+ recordId: string(),
9297
+ recordKind: _enum([
9298
+ "object-event",
9299
+ "track",
9300
+ "device-event",
9301
+ "package-event"
9302
+ ]),
9303
+ deviceId: number(),
9304
+ timestamp: number(),
9305
+ wouldFire: boolean(),
9306
+ /** Condition id that failed (first failing group), when `wouldFire` is false. */
9307
+ failedCondition: string().optional(),
9308
+ className: string().optional(),
9309
+ label: string().optional()
9310
+ });
9311
+ var NcConditionDescriptorSchema = object({
9312
+ /** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
9313
+ id: string(),
9314
+ group: _enum([
9315
+ "scope",
9316
+ "class",
9317
+ "zones",
9318
+ "quality",
9319
+ "label",
9320
+ "schedule",
9321
+ "device",
9322
+ "package",
9323
+ "occupancy"
9324
+ ]),
9325
+ label: string(),
9326
+ /** Editor widget the UI renders — never hardcode per-condition forms. */
9327
+ valueType: _enum([
9328
+ "deviceIdList",
9329
+ "stringList",
9330
+ "number01",
9331
+ "number",
9332
+ "sourceSelect",
9333
+ "zoneSelection",
9334
+ "zoneIdList",
9335
+ "schedule",
9336
+ "plateMatcher",
9337
+ "packagePhase",
9338
+ "polygonDraw",
9339
+ "occupancy"
9340
+ ]),
9341
+ operator: _enum([
9342
+ "in",
9343
+ "notIn",
9344
+ "anyOf",
9345
+ "allOf",
9346
+ "gte",
9347
+ "fuzzyIn",
9348
+ "withinSchedule"
9349
+ ]),
9350
+ /** Which delivery kinds the condition applies to. */
9351
+ appliesTo: array(NcDeliverySchema),
9352
+ phase: string(),
9353
+ description: string().optional()
9354
+ });
9355
+ /**
9356
+ * The delivery lifecycle status of a history row — a straight read of the
9357
+ * durable outbox row's own status (single source of truth):
9358
+ * - `pending` — enqueued, in-flight or retrying with backoff
9359
+ * - `sent` — delivered (terminal)
9360
+ * - `dead` — dead-lettered after exhausting retries / a permanent
9361
+ * backend rejection / a deleted target (terminal; carries
9362
+ * the failure `error`)
9363
+ *
9364
+ * P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
9365
+ * user dimension (quiet hours / snooze) and are additive when they land.
9366
+ */
9367
+ var NcHistoryStatusSchema = _enum([
9368
+ "pending",
9369
+ "sent",
9370
+ "dead"
9371
+ ]);
9372
+ /** The evaluated record kind a history row descends from (one per trigger). */
9373
+ var NcHistoryRecordKindSchema = _enum([
9374
+ "object-event",
9375
+ "track-end",
9376
+ "device-event",
9377
+ "package-event"
9378
+ ]);
9379
+ /** Subject summary frozen on the row at fire time (survives rule/record edits). */
9380
+ var NcHistorySubjectSchema = object({
9381
+ className: string(),
9382
+ label: string().optional(),
9383
+ confidence: number().optional(),
9384
+ zones: array(string()),
9385
+ timestamp: number()
9386
+ });
9387
+ /**
9388
+ * One delivery-history row. This is a read-only VIEW over the durable
9389
+ * outbox row (single source of truth — the same row the drain loop drives;
9390
+ * NO second write path, so history can never drift from delivery state).
9391
+ * The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
9392
+ * `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
9393
+ * (fire) / `updatedAt` (last transition), `status` + `error` are the
9394
+ * lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
9395
+ * enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
9396
+ * P1 (admin scope only).
9397
+ */
9398
+ var NcHistoryEntrySchema = object({
9399
+ /** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
9400
+ id: string(),
9401
+ ruleId: string(),
9402
+ /** Rule name frozen at fire time (outlives a later rename / delete). */
9403
+ ruleName: string(),
9404
+ /** The rule urgency/trigger that produced this delivery. */
9405
+ delivery: NcDeliverySchema,
9406
+ targetId: string(),
9407
+ deviceId: number(),
9408
+ recordKind: NcHistoryRecordKindSchema,
9409
+ /** Event / track ref of the evaluated record (§3.2 `eventRef`). */
9410
+ recordId: string(),
9411
+ /** Present for track-scoped deliveries (object-event / track-end). */
9412
+ trackId: string().optional(),
9413
+ status: NcHistoryStatusSchema,
9414
+ /** Delivery attempts made so far. */
9415
+ attempts: number().int(),
9416
+ /** Fire time (outbox enqueue). */
9417
+ createdAt: number(),
9418
+ /** Last transition time (terminal for sent / dead). */
9419
+ updatedAt: number(),
9420
+ /** Failure detail — present on a `dead` row. */
9421
+ error: string().optional(),
9422
+ subject: NcHistorySubjectSchema
9423
+ });
9424
+ /**
9425
+ * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
9426
+ * AND; absent = unbounded on that axis. `since`/`until` bound the fire time
9427
+ * (`createdAt`, epoch ms, inclusive). `limit` is clamped to
9428
+ * {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
9429
+ */
9430
+ var NcHistoryFilterSchema = object({
9431
+ ruleId: string().optional(),
9432
+ deviceId: number().optional(),
9433
+ status: NcHistoryStatusSchema.optional(),
9434
+ since: number().optional(),
9435
+ until: number().optional(),
9436
+ limit: number().int().min(1).max(500).default(100)
9437
+ });
9438
+ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), method(object({ ruleId: string() }), object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }), method(object({ rule: NcRuleInputSchema }), object({ rule: NcRuleSchema }), {
9439
+ kind: "mutation",
9440
+ auth: "admin",
9441
+ caller: "required"
9442
+ }), method(object({
9443
+ ruleId: string(),
9444
+ patch: NcRulePatchSchema
9445
+ }), object({ rule: NcRuleSchema }), {
9446
+ kind: "mutation",
9447
+ auth: "admin",
9448
+ caller: "required"
9449
+ }), method(object({ ruleId: string() }), object({ success: literal(true) }), {
9450
+ kind: "mutation",
9451
+ auth: "admin"
9452
+ }), method(object({
9453
+ ruleId: string(),
9454
+ enabled: boolean()
9455
+ }), object({ success: literal(true) }), {
9456
+ kind: "mutation",
9457
+ auth: "admin"
9458
+ }), method(object({
9459
+ rule: NcRuleInputSchema,
9460
+ lookbackMinutes: number().int().min(1).max(1440).default(60)
9461
+ }), object({ results: array(NcTestResultSchema) }), {
9462
+ kind: "mutation",
9463
+ auth: "admin"
9464
+ }), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
9465
+ /**
9466
+ * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
9467
+ *
9468
+ * Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
9469
+ * §3.2/§3.3.
9470
+ *
9471
+ * Deliberately NOT a capability definition and NOT an `NcRule`:
9472
+ * - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
9473
+ * timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
9474
+ * record, and produces a video it assembled itself — so it rides no
9475
+ * delivery-enum member (the enum is frozen) and no cap method. This file is
9476
+ * a plain typed schema; it does NOT go through `npm run codegen`.
9477
+ * - It shares only the delivery leg (`notification-output.send`) and the
9478
+ * persistence/ownership patterns with the Notification Center, reusing
9479
+ * {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
9480
+ * and {@link NcRuleTargetSchema} (target ref + passthrough params).
9481
+ *
9482
+ * Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
9483
+ * `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
9484
+ * {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
9485
+ * carry them, so a forged client payload can never claim or re-own a rule
9486
+ * (Zod strips unknown keys). The store stamps them from the resolved caller.
9487
+ */
9488
+ /** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
9489
+ var TimelapseTemplateSchema = object({
9490
+ title: string().max(500).optional(),
9491
+ body: string().max(2e3).optional()
9492
+ });
9493
+ var NameField = string().min(1).max(200);
9494
+ var DeviceIdsField = array(number()).min(1);
9495
+ var CadenceSecField = number().int().min(2).max(3600);
9496
+ var FramerateField = number().int().min(1).max(60);
9497
+ var TargetsField = array(NcRuleTargetSchema).min(1);
9498
+ var PriorityField = number().int().min(1).max(5);
9499
+ /**
9500
+ * Client-supplied timelapse-rule fields. The server stamps id / createdBy /
9501
+ * createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
9502
+ * here (see the ownership note above).
9503
+ */
9504
+ var TimelapseRuleInputSchema = object({
9505
+ name: NameField,
9506
+ enabled: boolean().default(true),
9507
+ /** Cameras sampled by this rule — one scratch dir + one artifact per device. */
9508
+ deviceIds: DeviceIdsField,
9509
+ /**
9510
+ * Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
9511
+ * means "always active"): a timelapse is defined by its window boundaries —
9512
+ * open clears the scratch, close assembles and delivers.
9513
+ */
9514
+ schedule: NcScheduleSchema,
9515
+ /** Force-snapshot cadence inside the window, seconds (predecessor parity). */
9516
+ cadenceSec: CadenceSecField.default(15),
9517
+ /** Output frames per second of the assembled mp4 (predecessor parity). */
9518
+ framerate: FramerateField.default(10),
9519
+ /** `notification-output` targets the finished video/thumbnail is sent to. */
9520
+ targets: TargetsField,
9521
+ template: TimelapseTemplateSchema.optional(),
9522
+ /** Canonical notification priority ordinal (1..5); per-target overridable. */
9523
+ priority: PriorityField.default(3)
9524
+ });
9525
+ object({
9526
+ name: NameField.optional(),
9527
+ enabled: boolean().optional(),
9528
+ deviceIds: DeviceIdsField.optional(),
9529
+ schedule: NcScheduleSchema.optional(),
9530
+ cadenceSec: CadenceSecField.optional(),
9531
+ framerate: FramerateField.optional(),
9532
+ targets: TargetsField.optional(),
9533
+ template: TimelapseTemplateSchema.nullable().optional(),
9534
+ priority: PriorityField.optional()
9535
+ });
9536
+ TimelapseRuleInputSchema.extend({
9537
+ id: string(),
9538
+ /**
9539
+ * Ownership/visibility key. Absent = admin/global rule (visible to all).
9540
+ * Present = personal rule owned by this userId. Server-stamped from the
9541
+ * resolved caller; never trusted from a client payload.
9542
+ */
9543
+ ownerUserId: string().optional(),
9544
+ /**
9545
+ * Epoch-ms of the last successful generation — the 1-hour re-generation
9546
+ * guard's durable state (predecessor parity). Absent = never generated.
9547
+ */
9548
+ lastGeneratedAt: number().optional(),
9549
+ /** userId of the caller who created the rule (server-stamped). */
9550
+ createdBy: string(),
9551
+ createdAt: number(),
9552
+ updatedAt: number()
9553
+ });
9554
+ /**
8860
9555
  * Generic device-level status snapshot. Auto-registered by `BaseDevice`
8861
9556
  * for every device, regardless of provider — the kernel needs a uniform
8862
9557
  * cap-keyed slice for the basic device flags every consumer expects to
@@ -10930,6 +11625,22 @@ var CameraMetricsSchema = object({
10930
11625
  ])
10931
11626
  });
10932
11627
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
11628
+ /**
11629
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
11630
+ * within the frame, so the executor can re-cut a leaf child ROI at native
11631
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
11632
+ */
11633
+ var NativeCropRefSchema = object({
11634
+ /** Handle keying the retained native surface (node-pinned to its owner). */
11635
+ handle: FrameHandleSchema,
11636
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
11637
+ cropFrameSpace: object({
11638
+ x: number(),
11639
+ y: number(),
11640
+ w: number(),
11641
+ h: number()
11642
+ })
11643
+ });
10933
11644
  var ModelFormatSchema$1 = _enum([
10934
11645
  "onnx",
10935
11646
  "coreml",
@@ -11205,7 +11916,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
11205
11916
  * Omitted ⇒ the runner's default device (current single-engine
11206
11917
  * behaviour). Selects WHICH device pool of the node runs the call.
11207
11918
  */
11208
- deviceKey: string().optional()
11919
+ deviceKey: string().optional(),
11920
+ /**
11921
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
11922
+ * when the parent crop was resolved from the frame's retained NATIVE
11923
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
11924
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
11925
+ * resolution from that surface — the SAME quality path faces already
11926
+ * had — instead of the downscaled parent tile. `handle` keys the native
11927
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
11928
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
11929
+ * the executor's crop-normalized child ROI back into frame-normalized
11930
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
11931
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
11932
+ * (today's behaviour on the fallback path).
11933
+ */
11934
+ nativeCropRef: NativeCropRefSchema.optional()
11209
11935
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
11210
11936
  engine: PipelineEngineChoiceSchema.optional(),
11211
11937
  steps: array(PipelineStepInputSchema).min(1),
@@ -11421,7 +12147,11 @@ var DetailResultSchema = object({
11421
12147
  bbox: NativeCropBboxSchema.optional(),
11422
12148
  embedding: string().optional(),
11423
12149
  label: string().optional(),
11424
- alignedCropJpeg: string().optional()
12150
+ alignedCropJpeg: string().optional(),
12151
+ /** Face short side (px) measured on the NATIVE crop surface. The `bbox`
12152
+ * above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
12153
+ * consumers MUST prefer this when present (2026-07-22 native-gate fix). */
12154
+ nativeFaceShortSidePx: number().optional()
11425
12155
  });
11426
12156
  /**
11427
12157
  * Per-camera tunable ranges + defaults. Single source of truth used
@@ -11435,6 +12165,12 @@ var motionCooldownMsField = {
11435
12165
  default: 3e4,
11436
12166
  step: 500
11437
12167
  };
12168
+ var maxSessionHoldMsField = {
12169
+ min: 0,
12170
+ max: 6e5,
12171
+ default: 12e4,
12172
+ step: 5e3
12173
+ };
11438
12174
  var motionFpsField = {
11439
12175
  min: 1,
11440
12176
  max: 30,
@@ -11582,6 +12318,19 @@ var RunnerCameraConfigSchema = object({
11582
12318
  "on-motion"
11583
12319
  ]).default("always-on"),
11584
12320
  motionCooldownMs: number().min(motionCooldownMsField.min).default(motionCooldownMsField.default),
12321
+ /**
12322
+ * Orchestrator-side on-motion session-hold cap (ms). While an on-motion
12323
+ * detection session is active and ≥1 confirmed non-stationary track is
12324
+ * still live, the orchestrator keeps the session open past
12325
+ * `motionCooldownMs` (a slowly-moving subject can stop re-triggering the
12326
+ * camera's VMD yet is still being tracked frame-to-frame) — up to this many
12327
+ * ms since the session opened, after which it closes regardless. `0`
12328
+ * disables the hold (legacy cooldown-only teardown). Not consumed by the
12329
+ * runner itself — carried here so it shares the per-camera device-settings
12330
+ * surface with `motionCooldownMs`; the orchestrator reads it off the
12331
+ * resolved `CameraDetectionConfig`.
12332
+ */
12333
+ maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
11585
12334
  motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
11586
12335
  detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
11587
12336
  motionStreamId: string(),
@@ -11671,7 +12420,7 @@ var RunnerCameraConfigSchema = object({
11671
12420
  */
11672
12421
  inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
11673
12422
  });
11674
- motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
12423
+ motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
11675
12424
  /**
11676
12425
  * Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
11677
12426
  * load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
@@ -11782,77 +12531,16 @@ DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
11782
12531
  lastChangedAt: number()
11783
12532
  });
11784
12533
  /**
11785
- * Shared geometry vocabulary for on-frame shape caps privacy-mask,
11786
- * motion-zones, and the detection zones/lines editor all speak this one
11787
- * language so a single drawing-plane editor and the providers stay
11788
- * decoupled from each cap's storage.
11789
- *
11790
- * All coordinates are normalized 0..1 of the camera frame (top-left
11791
- * origin). Each cap composes the SUBSET of shape kinds it supports and
11792
- * advertises it via `supportedShapes` in its `getOptions`.
12534
+ * Motion-zones share the same MaskShape vocabulary as privacy-mask — the
12535
+ * on-camera motion-detection mask is a single `grid` region (a row-major
12536
+ * boolean cell lattice the camera's onboard VMD evaluates). Composing it as
12537
+ * a region keeps one drawing-plane model across all geometry caps.
11793
12538
  */
11794
- /** A normalized 0..1 point (top-left origin). */
11795
- var MaskPointSchema = object({
11796
- x: number(),
11797
- y: number()
11798
- });
11799
- /** Axis-aligned rectangle (normalized 0..1). */
11800
- var MaskRectShapeSchema = object({
11801
- kind: literal("rect"),
11802
- x: number(),
11803
- y: number(),
11804
- width: number(),
11805
- height: number()
11806
- });
11807
- /** Free polygon — an ordered list of normalized vertices (≥3). */
11808
- var MaskPolygonShapeSchema = object({
11809
- kind: literal("polygon"),
11810
- points: array(MaskPointSchema)
11811
- });
11812
- /** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
11813
- var MaskGridShapeSchema = object({
11814
- kind: literal("grid"),
11815
- gridWidth: number(),
11816
- gridHeight: number(),
11817
- cells: array(boolean())
11818
- });
11819
- discriminatedUnion("kind", [
11820
- MaskRectShapeSchema,
11821
- MaskPolygonShapeSchema,
11822
- MaskGridShapeSchema,
11823
- object({
11824
- kind: literal("line"),
11825
- points: array(MaskPointSchema)
11826
- })
11827
- ]);
11828
- /** Every shape-kind discriminant, for `supportedShapes` advertisement. */
11829
- var MaskShapeKindSchema = _enum([
11830
- "rect",
11831
- "polygon",
11832
- "grid",
11833
- "line"
11834
- ]);
11835
- /** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
11836
- var MaskPolygonVerticesSchema = object({
11837
- min: number(),
11838
- max: number()
11839
- });
11840
- /** Grid dimensions when a cap supports 'grid'. */
11841
- var MaskGridDimsSchema = object({
11842
- width: number(),
11843
- height: number()
11844
- });
11845
- /**
11846
- * Motion-zones share the same MaskShape vocabulary as privacy-mask — the
11847
- * on-camera motion-detection mask is a single `grid` region (a row-major
11848
- * boolean cell lattice the camera's onboard VMD evaluates). Composing it as
11849
- * a region keeps one drawing-plane model across all geometry caps.
11850
- */
11851
- /** A motion-zone region — exactly one boolean cell grid today. */
11852
- var MotionZoneRegionSchema = object({
11853
- id: number(),
11854
- enabled: boolean(),
11855
- shape: MaskGridShapeSchema
12539
+ /** A motion-zone region exactly one boolean cell grid today. */
12540
+ var MotionZoneRegionSchema = object({
12541
+ id: number(),
12542
+ enabled: boolean(),
12543
+ shape: MaskGridShapeSchema
11856
12544
  });
11857
12545
  object({
11858
12546
  enabled: boolean(),
@@ -13525,94 +14213,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
13525
14213
  bundleUrl: string()
13526
14214
  });
13527
14215
  method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
13528
- var NotificationRuleConditionsSchema = object({
13529
- deviceIds: array(number()).readonly().optional(),
13530
- classNames: array(string()).readonly().optional(),
13531
- zoneIds: array(string()).readonly().optional(),
13532
- minConfidence: number().optional(),
13533
- source: _enum([
13534
- "pipeline",
13535
- "onboard",
13536
- "any"
13537
- ]).optional(),
13538
- schedule: object({
13539
- days: array(number()).readonly(),
13540
- startHour: number(),
13541
- endHour: number()
13542
- }).optional(),
13543
- cooldownSeconds: number().optional(),
13544
- minDwellSeconds: number().optional(),
13545
- /** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
13546
- * carrying a matching `data.eventType` string pass this condition. Rules without this field are
13547
- * unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
13548
- eventTypeTokens: array(string()).readonly().optional(),
13549
- /** Match detections whose CLIP image embedding is semantically similar to this free-text
13550
- * description. Requires the embedding-encoder cap to have pre-warmed the text vector.
13551
- * `minSimilarity` is the cosine similarity threshold in [0, 1]. */
13552
- clipDescription: object({
13553
- text: string().min(1),
13554
- minSimilarity: number().min(0).max(1)
13555
- }).optional(),
13556
- /** Match events whose recognized-entity label (face identity name or plate
13557
- * vehicle name, propagated onto `event.data.label`) is one of these values.
13558
- * Empty/absent → unaffected (back-compat). Enables "notify me when <named
13559
- * vehicle/person> is seen". */
13560
- labels: array(string()).readonly().optional()
13561
- });
13562
- var NotificationRuleTemplateSchema = object({
13563
- title: string(),
13564
- body: string(),
13565
- imageMode: _enum([
13566
- "crop",
13567
- "annotated",
13568
- "full",
13569
- "none"
13570
- ])
13571
- });
13572
- var NotificationRuleSchema = object({
13573
- id: string(),
13574
- name: string(),
13575
- enabled: boolean(),
13576
- eventTypes: array(string()).readonly(),
13577
- conditions: NotificationRuleConditionsSchema,
13578
- outputs: array(string()).readonly(),
13579
- template: NotificationRuleTemplateSchema.optional(),
13580
- priority: _enum([
13581
- "low",
13582
- "normal",
13583
- "high",
13584
- "critical"
13585
- ])
13586
- });
13587
- var NotificationTestResultSchema = object({
13588
- ruleId: string(),
13589
- eventId: string(),
13590
- timestamp: number(),
13591
- wouldFire: boolean(),
13592
- reason: string().optional()
13593
- });
13594
- var NotificationHistoryEntrySchema = object({
13595
- id: string(),
13596
- ruleId: string(),
13597
- ruleName: string(),
13598
- eventId: string(),
13599
- timestamp: number(),
13600
- outputs: array(string()).readonly(),
13601
- success: boolean(),
13602
- error: string().optional(),
13603
- deviceId: number().optional()
13604
- });
13605
- var NotificationHistoryFilterSchema = object({
13606
- ruleId: string().optional(),
13607
- deviceId: number().optional(),
13608
- from: number().optional(),
13609
- to: number().optional(),
13610
- limit: number().optional()
13611
- });
13612
- method(_void(), object({ rules: array(NotificationRuleSchema).readonly() })), method(object({ rule: NotificationRuleSchema }), object({ success: literal(true) }), { kind: "mutation" }), method(object({ ruleId: string() }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
13613
- ruleId: string(),
13614
- lookbackMinutes: number()
13615
- }), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
13616
14216
  /**
13617
14217
  * Alerts capability — collection-based internal alert system.
13618
14218
  *
@@ -13799,88 +14399,54 @@ method(object({
13799
14399
  password: string()
13800
14400
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
13801
14401
  /**
13802
- * `login-method` collection cap through which auth addons contribute
13803
- * their pre-auth login surfaces to the login page. This is the SINGLE,
13804
- * generic mechanism that supersedes the dead `auth.listProviders` reader:
13805
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
13806
- * `login-method` provider and the PUBLIC `auth.listLoginMethods`
13807
- * procedure aggregates them for the unauthenticated login page.
13808
- *
13809
- * A contribution is a discriminated union on `kind`:
13810
- *
13811
- * - `redirect` — a declarative button. The login page renders a generic
13812
- * button that navigates to `startUrl` (an addon-owned HTTP route).
13813
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
13814
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
13815
- * login page needs NO change.
13816
- *
13817
- * - `widget` — a Module-Federation widget the login page mounts (via
13818
- * `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
13819
- * stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
13820
- * mechanism kept for future use; no shipped addon uses it on the login
13821
- * page (the passkey ceremony below runs natively in the shell instead).
13822
- *
13823
- * - `passkey` — a declarative WebAuthn ceremony the shell renders
13824
- * natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
13825
- * a remotely-loaded bundle). Carries the addon's effective `rpId` /
13826
- * `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
13827
- * can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
13828
- * fetching any remote code pre-auth. Contribution stays unconditional —
13829
- * enrollment state is never leaked pre-auth; visibility is a shell
13830
- * decision.
13831
- *
13832
- * Every contribution carries a `stage`:
13833
- * - `primary` — shown on the first credentials screen (OIDC /
13834
- * magic-link buttons; a future usernameless passkey).
13835
- * - `second-factor` — shown AFTER the password leg, gated on the
13836
- * returned `factors` (passkey-as-2FA today).
13837
- *
13838
- * `mount: skip` — the cap is read server-side by the core auth router
13839
- * (`registry.getCollection('login-method')`), never mounted as its own
13840
- * tRPC router.
14402
+ * A live terminal session hosted by the provider addon. Output and input do
14403
+ * NOT flow through the capability they use the addon data plane
14404
+ * (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
14405
+ * terminal output must be ordered and lossless. The event bus is telemetry and
14406
+ * may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
14407
+ * permanently until a full repaint. The capability owns only lifecycle.
13841
14408
  */
13842
- /** When a login method renders in the two-phase login flow. */
13843
- var LoginStageEnum = _enum(["primary", "second-factor"]);
13844
- /** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
13845
- var LoginMethodContributionSchema = discriminatedUnion("kind", [
13846
- object({
13847
- kind: literal("redirect"),
13848
- /** Stable id within the login-method set (e.g. `auth-oidc/google`). */
13849
- id: string(),
13850
- /** Operator-facing button label. */
13851
- label: string(),
13852
- /** lucide-react icon name. */
13853
- icon: string().optional(),
13854
- /** Addon-owned HTTP route the button navigates to (GET). */
13855
- startUrl: string(),
13856
- stage: LoginStageEnum
13857
- }),
13858
- object({
13859
- kind: literal("widget"),
13860
- /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
13861
- id: string(),
13862
- /** Owning addon id — drives the public bundle URL + the MF namespace. */
13863
- addonId: string(),
13864
- /** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
13865
- bundle: string(),
13866
- /** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
13867
- remote: WidgetRemoteSchema,
13868
- stage: LoginStageEnum
13869
- }),
13870
- object({
13871
- kind: literal("passkey"),
13872
- /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
13873
- id: string(),
13874
- /** Operator-facing button label. */
13875
- label: string(),
13876
- stage: LoginStageEnum,
13877
- /** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
13878
- rpId: string(),
13879
- /** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
13880
- origin: string().nullable()
13881
- })
13882
- ]);
13883
- method(_void(), array(LoginMethodContributionSchema).readonly());
14409
+ var TerminalSessionInfoSchema = object({
14410
+ /** Opaque session id minted by the provider on `openSession`. */
14411
+ sessionId: string(),
14412
+ /** The pre-declared profile this session runs (never a free-form command). */
14413
+ profileId: string(),
14414
+ /** Human-readable profile label for the UI session list. */
14415
+ label: string(),
14416
+ cols: number().int().positive(),
14417
+ rows: number().int().positive(),
14418
+ /** ms-epoch the session's pty was spawned. */
14419
+ startedAt: number()
14420
+ });
14421
+ /**
14422
+ * A profile the operator may open — a pre-declared, allowlisted program
14423
+ * (`monitor` → `btm`). The capability accepts only these ids; a free-form
14424
+ * command string would be remote code execution as the server's user, so it is
14425
+ * deliberately not part of the contract.
14426
+ */
14427
+ var TerminalProfileInfoSchema = object({
14428
+ profileId: string(),
14429
+ label: string(),
14430
+ description: string().optional()
14431
+ });
14432
+ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
14433
+ profileId: string(),
14434
+ cols: number().int().positive(),
14435
+ rows: number().int().positive()
14436
+ }), TerminalSessionInfoSchema, {
14437
+ kind: "mutation",
14438
+ auth: "admin"
14439
+ }), method(object({
14440
+ sessionId: string(),
14441
+ cols: number().int().positive(),
14442
+ rows: number().int().positive()
14443
+ }), _void(), {
14444
+ kind: "mutation",
14445
+ auth: "admin"
14446
+ }), method(object({ sessionId: string() }), _void(), {
14447
+ kind: "mutation",
14448
+ auth: "admin"
14449
+ });
13884
14450
  /**
13885
14451
  * Orchestrator-side destination metadata. The orchestrator computes
13886
14452
  * `id = <addonId>:<subId>` from its provider lookup so consumers
@@ -13982,11 +14548,53 @@ var LocationStatSchema = object({
13982
14548
  fileCount: number(),
13983
14549
  present: boolean()
13984
14550
  });
14551
+ /**
14552
+ * A backup schedule — the N:M "entry" that binds one cron cadence to a
14553
+ * SET of destination locations. Supersedes the per-location cron on
14554
+ * `BackupDestinationPolicy`: an operator creates a schedule, picks the
14555
+ * `backups` locations it should write to, and the orchestrator fans a
14556
+ * single archive out to all of them when the cron fires.
14557
+ *
14558
+ * `retentionCount` is per-schedule (D-decision 2026-07-28): every
14559
+ * location targeted by this schedule keeps this many archives from
14560
+ * this schedule's runs.
14561
+ *
14562
+ * `dataSources` optionally narrows which top-level state locations
14563
+ * (db, addons, tls, …) are archived; omitted = the orchestrator's
14564
+ * default full set.
14565
+ */
14566
+ var BackupScheduleSchema = object({
14567
+ /** Stable id. Generated by the orchestrator on first upsert if absent. */
14568
+ id: string(),
14569
+ /** Operator-facing display name. */
14570
+ label: string(),
14571
+ /** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
14572
+ cron: string(),
14573
+ /** Master on/off toggle for the whole schedule. */
14574
+ enabled: boolean(),
14575
+ /** `backups`-location ids this schedule writes to (fan-out set). */
14576
+ locationIds: array(string()).readonly(),
14577
+ /** Archives kept per targeted location for this schedule. */
14578
+ retentionCount: number().int().min(1).max(1e3),
14579
+ /** Optional subset of source locations to include; omitted = all. */
14580
+ dataSources: array(string()).readonly().optional(),
14581
+ /** ms-epoch of last successful run. */
14582
+ lastRunAt: number().optional(),
14583
+ /** ms-epoch of next computed firing (read-only, filled on list). */
14584
+ nextRunAt: number().optional()
14585
+ });
13985
14586
  method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
13986
14587
  /** Subset of registered `backup-destination` addon ids to write to. */
13987
14588
  destinations: array(string()).optional(),
13988
14589
  locations: array(string()).optional(),
13989
- label: string().optional()
14590
+ label: string().optional(),
14591
+ /**
14592
+ * Per-run retention override applied to every targeted
14593
+ * destination. Used by schedule-driven runs (per-entry
14594
+ * retention). Omitted = each destination's own policy
14595
+ * retention (manual runs).
14596
+ */
14597
+ retentionCount: number().int().min(1).max(1e3).optional()
13990
14598
  }).optional(), array(BackupEntrySchema).readonly(), {
13991
14599
  kind: "mutation",
13992
14600
  auth: "admin"
@@ -14035,7 +14643,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
14035
14643
  ok: boolean(),
14036
14644
  error: string().optional(),
14037
14645
  nextRuns: array(number()).readonly()
14038
- }));
14646
+ })), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
14647
+ id: string().optional(),
14648
+ label: string(),
14649
+ cron: string(),
14650
+ enabled: boolean(),
14651
+ locationIds: array(string()).readonly(),
14652
+ retentionCount: number().int().min(1).max(1e3),
14653
+ dataSources: array(string()).readonly().optional()
14654
+ }), BackupScheduleSchema, {
14655
+ kind: "mutation",
14656
+ auth: "admin"
14657
+ }), method(object({ id: string() }), _void(), {
14658
+ kind: "mutation",
14659
+ auth: "admin"
14660
+ });
14039
14661
  /**
14040
14662
  * `broker` — unified pub/sub broker registry, system-scoped collection.
14041
14663
  *
@@ -15274,35 +15896,410 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
15274
15896
  kind: "mutation",
15275
15897
  auth: "admin"
15276
15898
  });
15277
- var LogLevelSchema = _enum([
15278
- "debug",
15279
- "info",
15280
- "warn",
15281
- "error"
15282
- ]);
15283
- var LogEntrySchema = object({
15284
- timestamp: date(),
15285
- level: LogLevelSchema,
15286
- scope: array(string()),
15287
- message: string(),
15288
- meta: record(string(), unknown()).optional(),
15289
- tags: record(string(), string()).optional()
15899
+ /**
15900
+ * Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
15901
+ * surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
15902
+ * caps stay wire-compatible without a circular cap→cap import.
15903
+ *
15904
+ * Errors are a discriminated-union RESULT, never thrown: the shape survives
15905
+ * every transport tier structurally, and failed calls still write usage rows.
15906
+ * Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
15907
+ */
15908
+ var LlmUsageSchema = object({
15909
+ inputTokens: number(),
15910
+ outputTokens: number()
15290
15911
  });
15291
- method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
15292
- scope: array(string()).optional(),
15293
- level: LogLevelSchema.optional(),
15294
- since: date().optional(),
15295
- until: date().optional(),
15296
- limit: number().optional(),
15297
- tags: record(string(), string()).optional()
15298
- }), array(LogEntrySchema).readonly());
15299
- var CpuBreakdownSchema = object({
15300
- total: number(),
15301
- user: number(),
15302
- system: number(),
15303
- irq: number(),
15304
- nice: number(),
15305
- loadAvg: tuple([
15912
+ var LlmErrorCodeSchema = _enum([
15913
+ "timeout",
15914
+ "rate-limited",
15915
+ "auth",
15916
+ "refusal",
15917
+ "bad-request",
15918
+ "unavailable",
15919
+ "no-profile",
15920
+ "budget-exceeded",
15921
+ "adapter-error"
15922
+ ]);
15923
+ var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
15924
+ ok: literal(true),
15925
+ text: string(),
15926
+ model: string(),
15927
+ usage: LlmUsageSchema,
15928
+ truncated: boolean(),
15929
+ latencyMs: number()
15930
+ }), object({
15931
+ ok: literal(false),
15932
+ code: LlmErrorCodeSchema,
15933
+ message: string(),
15934
+ retryAfterMs: number().optional()
15935
+ })]);
15936
+ /**
15937
+ * `Uint8Array` is the sanctioned binary convention — superjson + the UDS
15938
+ * MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
15939
+ * notification-output.cap.ts:27-31 precedents).
15940
+ */
15941
+ var LlmImageSchema = object({
15942
+ bytes: _instanceof(Uint8Array),
15943
+ mimeType: string()
15944
+ });
15945
+ var LlmGenerateBaseInputSchema = object({
15946
+ /** Collection routing (the notification-output posture). */
15947
+ addonId: string().optional(),
15948
+ /** Explicit profile; else the resolution chain (spec §3). */
15949
+ profileId: string().optional(),
15950
+ /** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
15951
+ consumer: string(),
15952
+ system: string().optional(),
15953
+ /** v1: single-turn. `messages[]` is a v2 additive field. */
15954
+ prompt: string(),
15955
+ /** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
15956
+ jsonSchema: record(string(), unknown()).optional(),
15957
+ /** Per-call override of the profile default. */
15958
+ maxTokens: number().int().positive().optional(),
15959
+ temperature: number().optional()
15960
+ });
15961
+ /**
15962
+ * `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
15963
+ * on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
15964
+ * a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
15965
+ * cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
15966
+ * this only through the `llm` cap's methods.
15967
+ *
15968
+ * One running llama-server child per node in v1 (models are RAM-heavy).
15969
+ * Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
15970
+ * watchdog — operator decision #3).
15971
+ */
15972
+ var ManagedModelRefSchema = discriminatedUnion("kind", [
15973
+ object({
15974
+ kind: literal("catalog"),
15975
+ catalogId: string()
15976
+ }),
15977
+ object({
15978
+ kind: literal("url"),
15979
+ url: string(),
15980
+ sha256: string().optional()
15981
+ }),
15982
+ object({
15983
+ kind: literal("path"),
15984
+ path: string()
15985
+ })
15986
+ ]);
15987
+ var ManagedRuntimeConfigSchema = object({
15988
+ /** WHERE the runtime lives — hub or any agent. */
15989
+ nodeId: string(),
15990
+ /** Closed for v1; 'ollama' is a v2 candidate. */
15991
+ engine: _enum(["llama-cpp"]),
15992
+ model: ManagedModelRefSchema,
15993
+ contextSize: number().int().default(4096),
15994
+ /** 0 = CPU-only. */
15995
+ gpuLayers: number().int().default(0),
15996
+ /** Default: cpus-2, clamped ≥1 (resolved node-side). */
15997
+ threads: number().int().optional(),
15998
+ /** Concurrent slots. */
15999
+ parallel: number().int().default(1),
16000
+ /** Else lazy: first generate boots it. */
16001
+ autoStart: boolean().default(false),
16002
+ /** 0 = never; frees RAM after quiet periods. */
16003
+ idleStopMinutes: number().int().default(30)
16004
+ });
16005
+ var LlmRuntimeStatusSchema = object({
16006
+ /** Status is ALWAYS node-qualified. */
16007
+ nodeId: string(),
16008
+ state: _enum([
16009
+ "stopped",
16010
+ "downloading",
16011
+ "starting",
16012
+ "ready",
16013
+ "crashed",
16014
+ "failed"
16015
+ ]),
16016
+ pid: number().optional(),
16017
+ port: number().optional(),
16018
+ modelPath: string().optional(),
16019
+ modelId: string().optional(),
16020
+ downloadProgress: number().min(0).max(1).optional(),
16021
+ lastError: string().optional(),
16022
+ crashesInWindow: number(),
16023
+ /** Child RSS (sampled best-effort). */
16024
+ memoryBytes: number().optional(),
16025
+ vramBytes: number().optional()
16026
+ });
16027
+ var LlmNodeModelSchema = object({
16028
+ file: string(),
16029
+ sizeBytes: number(),
16030
+ catalogId: string().optional(),
16031
+ installedAt: number().optional()
16032
+ });
16033
+ var LlmRuntimeDiskUsageSchema = object({
16034
+ nodeId: string(),
16035
+ modelsBytes: number(),
16036
+ freeBytes: number().optional()
16037
+ });
16038
+ method(LlmGenerateBaseInputSchema.extend({
16039
+ images: array(LlmImageSchema).optional(),
16040
+ runtime: ManagedRuntimeConfigSchema,
16041
+ /** The managed profile's timeout, threaded by the hub provider. */
16042
+ timeoutMs: number().int().positive().optional()
16043
+ }), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
16044
+ kind: "mutation",
16045
+ auth: "admin"
16046
+ }), method(object({}), _void(), {
16047
+ kind: "mutation",
16048
+ auth: "admin"
16049
+ }), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
16050
+ kind: "mutation",
16051
+ auth: "admin"
16052
+ }), method(object({ file: string() }), _void(), {
16053
+ kind: "mutation",
16054
+ auth: "admin"
16055
+ }), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
16056
+ /**
16057
+ * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
16058
+ * methods concat-fan across providers; single-row methods route to ONE
16059
+ * provider by the `addonId` in the call input (the notification-output
16060
+ * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
16061
+ * (hub-placed); the cap stays open for future providers.
16062
+ *
16063
+ * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
16064
+ * `apiKey` is a password field — providers REDACT it on read and merge on
16065
+ * write; a stored key NEVER round-trips to a client.
16066
+ */
16067
+ var LlmProfileKindSchema = _enum([
16068
+ "openai-compatible",
16069
+ "openai",
16070
+ "anthropic",
16071
+ "google",
16072
+ "managed-local"
16073
+ ]);
16074
+ var LlmProfileSchema = object({
16075
+ id: string(),
16076
+ name: string(),
16077
+ kind: LlmProfileKindSchema,
16078
+ /** Stamped by the provider — keeps the fanned catalog routable. */
16079
+ addonId: string(),
16080
+ enabled: boolean(),
16081
+ /** Vendor model id, or the managed runtime's loaded model. */
16082
+ model: string(),
16083
+ /** Required for openai-compatible; override for cloud kinds. */
16084
+ baseUrl: string().optional(),
16085
+ /** ConfigUISchema type:'password' — never round-trips (spec §5). */
16086
+ apiKey: string().optional(),
16087
+ supportsVision: boolean(),
16088
+ temperature: number().min(0).max(2).optional(),
16089
+ maxTokens: number().int().positive().optional(),
16090
+ timeoutMs: number().int().positive().default(6e4),
16091
+ extraHeaders: record(string(), string()).optional(),
16092
+ /** kind === 'managed-local' only (spec §4). */
16093
+ runtime: ManagedRuntimeConfigSchema.optional()
16094
+ });
16095
+ /** ConfigUISchema tree passed through untyped on the wire (the
16096
+ * notification-output `ConfigSchemaPassthrough` precedent at
16097
+ * notification-output.cap.ts:151); the exported TS type re-tightens it. */
16098
+ var ConfigSchemaPassthrough$1 = unknown();
16099
+ var LlmProfileKindDescriptorSchema = object({
16100
+ kind: LlmProfileKindSchema,
16101
+ label: string(),
16102
+ icon: string(),
16103
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
16104
+ addonId: string(),
16105
+ configSchema: ConfigSchemaPassthrough$1
16106
+ });
16107
+ var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
16108
+ var LlmDefaultSchema = object({
16109
+ selector: LlmDefaultSelectorSchema,
16110
+ profileId: string()
16111
+ });
16112
+ /** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
16113
+ var LlmUsageRollupSchema = object({
16114
+ day: string(),
16115
+ consumer: string(),
16116
+ profileId: string(),
16117
+ calls: number(),
16118
+ okCalls: number(),
16119
+ errorCalls: number(),
16120
+ inputTokens: number(),
16121
+ outputTokens: number(),
16122
+ avgLatencyMs: number()
16123
+ });
16124
+ /** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
16125
+ var ManagedModelCatalogEntrySchema = object({
16126
+ id: string(),
16127
+ label: string(),
16128
+ family: string(),
16129
+ purpose: _enum(["text", "vision"]),
16130
+ url: string(),
16131
+ sha256: string(),
16132
+ sizeBytes: number(),
16133
+ quantization: string(),
16134
+ /** Load-time guidance shown in the picker. */
16135
+ minRamBytes: number(),
16136
+ contextSizeDefault: number().int(),
16137
+ /** Vision models: companion projector file. */
16138
+ mmprojUrl: string().optional()
16139
+ });
16140
+ var LlmRuntimeNodeSchema = object({
16141
+ nodeId: string(),
16142
+ reachable: boolean(),
16143
+ status: LlmRuntimeStatusSchema.optional(),
16144
+ disk: LlmRuntimeDiskUsageSchema.optional(),
16145
+ error: string().optional()
16146
+ });
16147
+ var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
16148
+ var ProfileRefInputSchema = object({
16149
+ addonId: string(),
16150
+ profileId: string()
16151
+ });
16152
+ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
16153
+ kind: "mutation",
16154
+ auth: "admin"
16155
+ }), method(ProfileRefInputSchema, _void(), {
16156
+ kind: "mutation",
16157
+ auth: "admin"
16158
+ }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
16159
+ kind: "mutation",
16160
+ auth: "admin"
16161
+ }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
16162
+ selector: LlmDefaultSelectorSchema,
16163
+ profileId: string().nullable()
16164
+ }), _void(), {
16165
+ kind: "mutation",
16166
+ auth: "admin"
16167
+ }), method(object({
16168
+ since: number().optional(),
16169
+ until: number().optional(),
16170
+ consumer: string().optional(),
16171
+ profileId: string().optional()
16172
+ }), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
16173
+ nodeId: string(),
16174
+ model: ManagedModelRefSchema
16175
+ }), _void(), {
16176
+ kind: "mutation",
16177
+ auth: "admin"
16178
+ }), method(object({
16179
+ nodeId: string(),
16180
+ file: string()
16181
+ }), _void(), {
16182
+ kind: "mutation",
16183
+ auth: "admin"
16184
+ }), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
16185
+ kind: "mutation",
16186
+ auth: "admin"
16187
+ }), method(ProfileRefInputSchema, _void(), {
16188
+ kind: "mutation",
16189
+ auth: "admin"
16190
+ });
16191
+ var LogLevelSchema = _enum([
16192
+ "debug",
16193
+ "info",
16194
+ "warn",
16195
+ "error"
16196
+ ]);
16197
+ var LogEntrySchema = object({
16198
+ timestamp: date(),
16199
+ level: LogLevelSchema,
16200
+ scope: array(string()),
16201
+ message: string(),
16202
+ meta: record(string(), unknown()).optional(),
16203
+ tags: record(string(), string()).optional()
16204
+ });
16205
+ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
16206
+ scope: array(string()).optional(),
16207
+ level: LogLevelSchema.optional(),
16208
+ since: date().optional(),
16209
+ until: date().optional(),
16210
+ limit: number().optional(),
16211
+ tags: record(string(), string()).optional()
16212
+ }), array(LogEntrySchema).readonly());
16213
+ /**
16214
+ * `login-method` — collection cap through which auth addons contribute
16215
+ * their pre-auth login surfaces to the login page. This is the SINGLE,
16216
+ * generic mechanism that supersedes the dead `auth.listProviders` reader:
16217
+ * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
16218
+ * `login-method` provider and the PUBLIC `auth.listLoginMethods`
16219
+ * procedure aggregates them for the unauthenticated login page.
16220
+ *
16221
+ * A contribution is a discriminated union on `kind`:
16222
+ *
16223
+ * - `redirect` — a declarative button. The login page renders a generic
16224
+ * button that navigates to `startUrl` (an addon-owned HTTP route).
16225
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
16226
+ * ZERO shell-side JS. A future SSO addon plugs in the same way — the
16227
+ * login page needs NO change.
16228
+ *
16229
+ * - `widget` — a Module-Federation widget the login page mounts (via
16230
+ * `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
16231
+ * stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
16232
+ * mechanism kept for future use; no shipped addon uses it on the login
16233
+ * page (the passkey ceremony below runs natively in the shell instead).
16234
+ *
16235
+ * - `passkey` — a declarative WebAuthn ceremony the shell renders
16236
+ * natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
16237
+ * a remotely-loaded bundle). Carries the addon's effective `rpId` /
16238
+ * `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
16239
+ * can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
16240
+ * fetching any remote code pre-auth. Contribution stays unconditional —
16241
+ * enrollment state is never leaked pre-auth; visibility is a shell
16242
+ * decision.
16243
+ *
16244
+ * Every contribution carries a `stage`:
16245
+ * - `primary` — shown on the first credentials screen (OIDC /
16246
+ * magic-link buttons; a future usernameless passkey).
16247
+ * - `second-factor` — shown AFTER the password leg, gated on the
16248
+ * returned `factors` (passkey-as-2FA today).
16249
+ *
16250
+ * `mount: skip` — the cap is read server-side by the core auth router
16251
+ * (`registry.getCollection('login-method')`), never mounted as its own
16252
+ * tRPC router.
16253
+ */
16254
+ /** When a login method renders in the two-phase login flow. */
16255
+ var LoginStageEnum = _enum(["primary", "second-factor"]);
16256
+ /** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
16257
+ var LoginMethodContributionSchema = discriminatedUnion("kind", [
16258
+ object({
16259
+ kind: literal("redirect"),
16260
+ /** Stable id within the login-method set (e.g. `auth-oidc/google`). */
16261
+ id: string(),
16262
+ /** Operator-facing button label. */
16263
+ label: string(),
16264
+ /** lucide-react icon name. */
16265
+ icon: string().optional(),
16266
+ /** Addon-owned HTTP route the button navigates to (GET). */
16267
+ startUrl: string(),
16268
+ stage: LoginStageEnum
16269
+ }),
16270
+ object({
16271
+ kind: literal("widget"),
16272
+ /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
16273
+ id: string(),
16274
+ /** Owning addon id — drives the public bundle URL + the MF namespace. */
16275
+ addonId: string(),
16276
+ /** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
16277
+ bundle: string(),
16278
+ /** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
16279
+ remote: WidgetRemoteSchema,
16280
+ stage: LoginStageEnum
16281
+ }),
16282
+ object({
16283
+ kind: literal("passkey"),
16284
+ /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
16285
+ id: string(),
16286
+ /** Operator-facing button label. */
16287
+ label: string(),
16288
+ stage: LoginStageEnum,
16289
+ /** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
16290
+ rpId: string(),
16291
+ /** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
16292
+ origin: string().nullable()
16293
+ })
16294
+ ]);
16295
+ method(_void(), array(LoginMethodContributionSchema).readonly());
16296
+ var CpuBreakdownSchema = object({
16297
+ total: number(),
16298
+ user: number(),
16299
+ system: number(),
16300
+ irq: number(),
16301
+ nice: number(),
16302
+ loadAvg: tuple([
15306
16303
  number(),
15307
16304
  number(),
15308
16305
  number()
@@ -15476,668 +16473,376 @@ method(object({
15476
16473
  targets: array(ConvertTargetSchema).min(1).readonly(),
15477
16474
  calibrationRef: string().optional(),
15478
16475
  sessionId: string().optional()
15479
- }), ConvertResultSchema, {
15480
- kind: "mutation",
15481
- auth: "admin",
15482
- timeoutMs: 6e5
15483
- });
15484
- method(object({
15485
- nodeId: string(),
15486
- modelId: string(),
15487
- format: _enum(MODEL_FORMATS),
15488
- entry: ModelCatalogEntrySchema
15489
- }), object({
15490
- ok: boolean(),
15491
- /** sha256 of the staged tarball (empty for a hub-local no-op). */
15492
- sha256: string(),
15493
- bytes: number(),
15494
- /** The target node's modelsDir the artifact landed in. */
15495
- path: string()
15496
- }), {
15497
- kind: "mutation",
15498
- auth: "admin"
15499
- });
15500
- /**
15501
- * `mqtt-broker` — broker-registry cap.
15502
- *
15503
- * NOT a pub/sub proxy. The cap exposes (a) a registry of configured
15504
- * MQTT brokers (external + optionally an embedded `aedes`-backed one)
15505
- * and (b) the connection details a consumer addon needs to spin up
15506
- * its OWN `mqtt.js` client.
15507
- *
15508
- * Why: pub/sub routing over the system event-bus loses fidelity
15509
- * (callback shape, QoS guarantees, will/retain semantics) and adds
15510
- * refcount bookkeeping that addons would rather own themselves. The
15511
- * canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
15512
- * features anyway — give it the connection config, get out of the way.
15513
- *
15514
- * Consumer flow:
15515
- * const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
15516
- * const client = mqtt.connect(cfg.url, { username: cfg.username, … })
15517
- * client.subscribe('zigbee2mqtt/+')
15518
- *
15519
- * Collection mode: multiple brokers (e.g. one local mosquitto + one
15520
- * cloud bridge). The "embedded" entry (when present) is just another
15521
- * broker in the registry — its lifecycle is owned by the addon that
15522
- * spawned it.
15523
- */
15524
- var BrokerKindSchema = _enum(["external", "embedded"]);
15525
- /**
15526
- * Broker live-probe status.
15527
- *
15528
- * - `connected` — last probe completed a clean CONNACK
15529
- * - `disconnected` — no probe has run yet (cold cache)
15530
- * - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
15531
- * - `unreachable` — TCP connect timed out / refused
15532
- * - `tls-error` — TLS handshake failed (cert / SNI / cipher)
15533
- */
15534
- var BrokerStatusSchema$1 = _enum([
15535
- "connected",
15536
- "disconnected",
15537
- "auth-failed",
15538
- "unreachable",
15539
- "tls-error"
15540
- ]);
15541
- var BrokerInfoSchema = object({
15542
- id: string(),
15543
- name: string(),
15544
- url: string(),
15545
- kind: BrokerKindSchema,
15546
- status: BrokerStatusSchema$1,
15547
- latencyMs: number().nullable(),
15548
- error: string().optional(),
15549
- /** Embedded brokers only: number of MQTT clients currently connected. */
15550
- connectedClients: number().int().nonnegative().optional(),
15551
- /** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
15552
- lastCheckedAt: number().optional()
15553
- });
15554
- /**
15555
- * Connection details — what a consumer needs to call
15556
- * `mqtt.connect(url, options)`. We split URL + credentials so the
15557
- * consumer can pass them as `mqtt.connect(url, { username, password })`
15558
- * instead of stuffing creds into the URL (which leaks them into logs).
15559
- */
15560
- var BrokerConnectionDetailsSchema = object({
15561
- url: string(),
15562
- username: string().optional(),
15563
- password: string().optional(),
15564
- /**
15565
- * Suggested prefix for `clientId`. Each consumer should suffix this
15566
- * with its own discriminator (addon id, instance id) so reconnects
15567
- * don't kick each other off (MQTT spec: clientId must be unique per
15568
- * broker).
15569
- */
15570
- clientIdPrefix: string().optional()
15571
- });
15572
- var AddBrokerInputSchema = object({
15573
- name: string().min(1),
15574
- url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
15575
- username: string().optional(),
15576
- password: string().optional(),
15577
- clientIdPrefix: string().optional()
15578
- });
15579
- var AddBrokerResultSchema = object({ id: string() });
15580
- var IdInputSchema = object({ id: string() });
15581
- var TestResultSchema$1 = discriminatedUnion("ok", [object({
15582
- ok: literal(true),
15583
- latencyMs: number()
15584
- }), object({
15585
- ok: literal(false),
15586
- error: string()
15587
- })]);
15588
- var StartEmbeddedInputSchema = object({
15589
- port: number().int().min(1).max(65535).default(1883),
15590
- /** Allow anonymous connect (no username/password). Default: false. */
15591
- allowAnonymous: boolean().default(false),
15592
- /** Optional shared username/password for clients. */
15593
- username: string().optional(),
15594
- password: string().optional()
15595
- });
15596
- var StartEmbeddedResultSchema = object({
15597
- id: string(),
15598
- url: string()
15599
- });
15600
- var StatusSchema = object({
15601
- brokerCount: number(),
15602
- embeddedRunning: boolean()
15603
- });
15604
- var mqttBrokerCapability = {
15605
- name: "mqtt-broker",
15606
- scope: "system",
15607
- mode: "collection",
15608
- providerKind: "broker",
15609
- status: {
15610
- schema: StatusSchema,
15611
- kind: "poll"
15612
- },
15613
- methods: {
15614
- listBrokers: method(_void(), array(BrokerInfoSchema)),
15615
- getBrokerConfig: method(IdInputSchema, BrokerConnectionDetailsSchema),
15616
- addBroker: method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }),
15617
- removeBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
15618
- testConnection: method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }),
15619
- startEmbeddedBroker: method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }),
15620
- stopEmbeddedBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
15621
- getStatus: method(_void(), StatusSchema)
15622
- }
15623
- };
15624
- var NetworkEndpointSchema = object({
15625
- url: string(),
15626
- hostname: string(),
15627
- port: number(),
15628
- protocol: _enum(["http", "https"])
15629
- });
15630
- var NetworkAccessStatusSchema = object({
15631
- connected: boolean(),
15632
- endpoint: NetworkEndpointSchema.nullable(),
15633
- error: string().optional()
16476
+ }), ConvertResultSchema, {
16477
+ kind: "mutation",
16478
+ auth: "admin",
16479
+ timeoutMs: 6e5
15634
16480
  });
15635
- /**
15636
- * Optional, richer endpoint shape returned by providers that expose
15637
- * MORE than one ingress concurrently (Tailscale Ingress with mixed
15638
- * serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
15639
- * the originating provider config (mode + sourcePort) so the
15640
- * orchestrator UI can label rows distinctly. Providers that expose only
15641
- * one endpoint just omit `listEndpoints` from their provider impl.
15642
- */
15643
- var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
15644
- /**
15645
- * Stable id within the provider typically `<mode>-<sourcePort>` so
15646
- * the orchestrator can dedupe across `listEndpoints` polls.
15647
- */
15648
- id: string(),
15649
- /** Operator-facing label (mirrors `MeshEndpoint.label`). */
15650
- label: string(),
15651
- /** Optional provider-specific mode tag, used for icon/colour in admin UI. */
15652
- mode: string().optional(),
15653
- /** Originating local port the ingress fronts (informational). */
15654
- sourcePort: number().optional()
16481
+ method(object({
16482
+ nodeId: string(),
16483
+ modelId: string(),
16484
+ format: _enum(MODEL_FORMATS),
16485
+ entry: ModelCatalogEntrySchema
16486
+ }), object({
16487
+ ok: boolean(),
16488
+ /** sha256 of the staged tarball (empty for a hub-local no-op). */
16489
+ sha256: string(),
16490
+ bytes: number(),
16491
+ /** The target node's modelsDir the artifact landed in. */
16492
+ path: string()
16493
+ }), {
16494
+ kind: "mutation",
16495
+ auth: "admin"
15655
16496
  });
15656
- method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
15657
16497
  /**
15658
- * notification-outputcanonical, capability-gated notification delivery.
16498
+ * `mqtt-broker`broker-registry cap.
15659
16499
  *
15660
- * Apprise-derived model (see
15661
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
15662
- * callers emit ONE canonical `Notification`; each provider declares a
15663
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
15664
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
15665
- * message to what the kind supports — callers never special-case a service.
16500
+ * NOT a pub/sub proxy. The cap exposes (a) a registry of configured
16501
+ * MQTT brokers (external + optionally an embedded `aedes`-backed one)
16502
+ * and (b) the connection details a consumer addon needs to spin up
16503
+ * its OWN `mqtt.js` client.
15666
16504
  *
15667
- * DESIGN DECISIONS (locked):
15668
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
15669
- * `setTargetEnabled`), each provider persisting via the `settings-store`
15670
- * cap. Rationale: the admin UI needs one uniform surface across the
15671
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
15672
- * alternative would fork the UI per addon and cannot host the
15673
- * discovery→adopt flow.
15674
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
15675
- * the generated cap-mount auto-`concatCollection`-fans them across every
15676
- * registered provider (notifiers addon + HA addon) so one catalog is
15677
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
15678
- * `addonId` the generated collection router extracts from the call input.
15679
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
15680
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
15681
- * `storage` / `storage-provider` / `recording` caps over the same path. No
15682
- * base64 fallback needed.
16505
+ * Why: pub/sub routing over the system event-bus loses fidelity
16506
+ * (callback shape, QoS guarantees, will/retain semantics) and adds
16507
+ * refcount bookkeeping that addons would rather own themselves. The
16508
+ * canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
16509
+ * features anyway — give it the connection config, get out of the way.
15683
16510
  *
15684
- * TODO (deferred, closed-set change — separate decision): add
15685
- * `providerKind: 'notify'` so notification providers surface on the unified
15686
- * admin "Integrations" page.
15687
- */
15688
- /**
15689
- * Zentik-derived typed-media enum the superset across every kind. Each
15690
- * adapter picks what it supports and the degrade engine filters the rest.
16511
+ * Consumer flow:
16512
+ * const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
16513
+ * const client = mqtt.connect(cfg.url, { username: cfg.username, … })
16514
+ * client.subscribe('zigbee2mqtt/+')
16515
+ *
16516
+ * Collection mode: multiple brokers (e.g. one local mosquitto + one
16517
+ * cloud bridge). The "embedded" entry (when present) is just another
16518
+ * broker in the registry — its lifecycle is owned by the addon that
16519
+ * spawned it.
15691
16520
  */
15692
- var AttachmentMediaTypeSchema = _enum([
15693
- "image",
15694
- "video",
15695
- "gif",
15696
- "audio",
15697
- "icon"
15698
- ]);
16521
+ var BrokerKindSchema = _enum(["external", "embedded"]);
15699
16522
  /**
15700
- * A single attachment. Exactly one of `url` (remote source, most adapters
15701
- * prefer this) or `bytes` (inline source; required for Pushover-style
15702
- * bytes-only kinds) MUST be present the degrade engine expresses a
15703
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
16523
+ * Broker live-probe status.
16524
+ *
16525
+ * - `connected` last probe completed a clean CONNACK
16526
+ * - `disconnected` no probe has run yet (cold cache)
16527
+ * - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
16528
+ * - `unreachable` — TCP connect timed out / refused
16529
+ * - `tls-error` — TLS handshake failed (cert / SNI / cipher)
15704
16530
  */
15705
- var AttachmentSchema = object({
15706
- mediaType: AttachmentMediaTypeSchema,
15707
- url: string().optional(),
15708
- bytes: _instanceof(Uint8Array).optional(),
15709
- mime: string().optional(),
15710
- name: string().optional()
15711
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
15712
- var NotificationFormatSchema = _enum([
15713
- "text",
15714
- "markdown",
15715
- "html"
16531
+ var BrokerStatusSchema$1 = _enum([
16532
+ "connected",
16533
+ "disconnected",
16534
+ "auth-failed",
16535
+ "unreachable",
16536
+ "tls-error"
15716
16537
  ]);
15717
- /** A single tap-through action button. */
15718
- var NotificationActionSchema = object({
15719
- id: string(),
15720
- label: string(),
15721
- url: string().optional()
15722
- });
15723
- /**
15724
- * The canonical notification. `body` is the only hard field (Apprise model).
15725
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
15726
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
15727
- * the adapter maps this ordinal onto its native level. `level?` is an
15728
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
15729
- * `priority` for that one target.
15730
- */
15731
- var NotificationSchema = object({
15732
- body: string(),
15733
- title: string().optional(),
15734
- format: NotificationFormatSchema.default("text"),
15735
- priority: number().int().min(1).max(5).default(3),
15736
- level: string().optional(),
15737
- attachments: array(AttachmentSchema).optional(),
15738
- clickUrl: string().optional(),
15739
- actions: array(NotificationActionSchema).optional(),
15740
- sound: string().optional(),
15741
- ttl: number().optional(),
15742
- tag: string().optional(),
15743
- deviceId: number().optional(),
15744
- eventId: string().optional(),
15745
- metadata: record(string(), unknown()).optional()
15746
- });
15747
- /** One declared native severity/priority level for a kind. */
15748
- var TargetKindLevelSchema = object({
15749
- id: string(),
15750
- label: string(),
15751
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
15752
- ordinal: number().int().min(1).max(5).nullable(),
15753
- flags: object({
15754
- critical: boolean().optional(),
15755
- silent: boolean().optional(),
15756
- noPush: boolean().optional()
15757
- }).optional(),
15758
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
15759
- requires: array(string()).optional(),
15760
- description: string().optional()
15761
- });
15762
- /** The full capability block consulted before dispatch. */
15763
- var TargetKindCapsSchema = object({
15764
- attachments: object({
15765
- mediaTypes: array(AttachmentMediaTypeSchema),
15766
- mode: _enum([
15767
- "url",
15768
- "bytes",
15769
- "both"
15770
- ]),
15771
- max: number().int().nonnegative(),
15772
- maxBytes: number().int().positive().optional()
15773
- }),
15774
- /** Max action buttons (0 = none). */
15775
- actions: number().int().nonnegative(),
15776
- levels: array(TargetKindLevelSchema),
15777
- format: array(NotificationFormatSchema),
15778
- clickUrl: boolean(),
15779
- sound: boolean(),
15780
- ttl: boolean(),
15781
- bodyMaxLen: number().int().positive()
15782
- });
15783
- /**
15784
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
15785
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
15786
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
15787
- * the union is large and not meant for runtime validation here; the exported
15788
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
15789
- */
15790
- var ConfigSchemaPassthrough$1 = unknown();
15791
- var TargetKindSchema = object({
15792
- kind: string(),
15793
- label: string(),
15794
- icon: string(),
15795
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
15796
- addonId: string(),
15797
- configSchema: ConfigSchemaPassthrough$1,
15798
- supportsDiscovery: boolean(),
15799
- caps: TargetKindCapsSchema
15800
- });
15801
- /**
15802
- * A persisted target. `config` holds secrets; providers REDACT secret fields
15803
- * (return a presence marker only) when serving `listTargets` — never
15804
- * round-trip a stored secret to the UI.
15805
- */
15806
- var TargetSchema = object({
16538
+ var BrokerInfoSchema = object({
15807
16539
  id: string(),
15808
16540
  name: string(),
15809
- kind: string(),
15810
- addonId: string(),
15811
- enabled: boolean(),
15812
- config: record(string(), unknown())
15813
- });
15814
- /** A discovery-surfaced candidate (config is partial + non-secret). */
15815
- var DiscoveredTargetSchema = object({
15816
- kind: string(),
15817
- suggestedName: string(),
15818
- config: record(string(), unknown())
15819
- });
15820
- /** The degrade engine's report — what was resolved / dropped / degraded. */
15821
- var RenderedAsSchema = object({
15822
- level: string(),
15823
- format: NotificationFormatSchema,
15824
- attachmentsSent: number().int().nonnegative(),
15825
- actionsSent: number().int().nonnegative(),
15826
- truncated: boolean(),
15827
- dropped: array(string())
15828
- });
15829
- var SendResultSchema = object({
15830
- success: boolean(),
15831
- error: string().optional(),
15832
- renderedAs: RenderedAsSchema.optional()
15833
- });
15834
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
15835
- var TestResultSchema = SendResultSchema;
15836
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
15837
- kind: string(),
15838
- config: record(string(), unknown()).optional()
15839
- }), array(DiscoveredTargetSchema)), method(object({
15840
- targetId: string(),
15841
- notification: NotificationSchema
15842
- }), SendResultSchema, { kind: "mutation" }), method(object({
15843
- targetId: string(),
15844
- sample: NotificationSchema.optional()
15845
- }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
15846
- targetId: string(),
15847
- enabled: boolean()
15848
- }), _void(), { kind: "mutation" });
16541
+ url: string(),
16542
+ kind: BrokerKindSchema,
16543
+ status: BrokerStatusSchema$1,
16544
+ latencyMs: number().nullable(),
16545
+ error: string().optional(),
16546
+ /** Embedded brokers only: number of MQTT clients currently connected. */
16547
+ connectedClients: number().int().nonnegative().optional(),
16548
+ /** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
16549
+ lastCheckedAt: number().optional()
16550
+ });
15849
16551
  /**
15850
- * Shared LLM generate contracts imported by BOTH `llm.cap.ts` (consumer
15851
- * surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
15852
- * caps stay wire-compatible without a circular cap→cap import.
15853
- *
15854
- * Errors are a discriminated-union RESULT, never thrown: the shape survives
15855
- * every transport tier structurally, and failed calls still write usage rows.
15856
- * Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
16552
+ * Connection details what a consumer needs to call
16553
+ * `mqtt.connect(url, options)`. We split URL + credentials so the
16554
+ * consumer can pass them as `mqtt.connect(url, { username, password })`
16555
+ * instead of stuffing creds into the URL (which leaks them into logs).
15857
16556
  */
15858
- var LlmUsageSchema = object({
15859
- inputTokens: number(),
15860
- outputTokens: number()
16557
+ var BrokerConnectionDetailsSchema = object({
16558
+ url: string(),
16559
+ username: string().optional(),
16560
+ password: string().optional(),
16561
+ /**
16562
+ * Suggested prefix for `clientId`. Each consumer should suffix this
16563
+ * with its own discriminator (addon id, instance id) so reconnects
16564
+ * don't kick each other off (MQTT spec: clientId must be unique per
16565
+ * broker).
16566
+ */
16567
+ clientIdPrefix: string().optional()
15861
16568
  });
15862
- var LlmErrorCodeSchema = _enum([
15863
- "timeout",
15864
- "rate-limited",
15865
- "auth",
15866
- "refusal",
15867
- "bad-request",
15868
- "unavailable",
15869
- "no-profile",
15870
- "budget-exceeded",
15871
- "adapter-error"
15872
- ]);
15873
- var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
16569
+ var AddBrokerInputSchema = object({
16570
+ name: string().min(1),
16571
+ url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
16572
+ username: string().optional(),
16573
+ password: string().optional(),
16574
+ clientIdPrefix: string().optional()
16575
+ });
16576
+ var AddBrokerResultSchema = object({ id: string() });
16577
+ var IdInputSchema = object({ id: string() });
16578
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
15874
16579
  ok: literal(true),
15875
- text: string(),
15876
- model: string(),
15877
- usage: LlmUsageSchema,
15878
- truncated: boolean(),
15879
16580
  latencyMs: number()
15880
16581
  }), object({
15881
16582
  ok: literal(false),
15882
- code: LlmErrorCodeSchema,
15883
- message: string(),
15884
- retryAfterMs: number().optional()
16583
+ error: string()
15885
16584
  })]);
15886
- /**
15887
- * `Uint8Array` is the sanctioned binary convention — superjson + the UDS
15888
- * MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
15889
- * notification-output.cap.ts:27-31 precedents).
15890
- */
15891
- var LlmImageSchema = object({
15892
- bytes: _instanceof(Uint8Array),
15893
- mimeType: string()
16585
+ var StartEmbeddedInputSchema = object({
16586
+ port: number().int().min(1).max(65535).default(1883),
16587
+ /** Allow anonymous connect (no username/password). Default: false. */
16588
+ allowAnonymous: boolean().default(false),
16589
+ /** Optional shared username/password for clients. */
16590
+ username: string().optional(),
16591
+ password: string().optional()
15894
16592
  });
15895
- var LlmGenerateBaseInputSchema = object({
15896
- /** Collection routing (the notification-output posture). */
15897
- addonId: string().optional(),
15898
- /** Explicit profile; else the resolution chain (spec §3). */
15899
- profileId: string().optional(),
15900
- /** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
15901
- consumer: string(),
15902
- system: string().optional(),
15903
- /** v1: single-turn. `messages[]` is a v2 additive field. */
15904
- prompt: string(),
15905
- /** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
15906
- jsonSchema: record(string(), unknown()).optional(),
15907
- /** Per-call override of the profile default. */
15908
- maxTokens: number().int().positive().optional(),
15909
- temperature: number().optional()
16593
+ var StartEmbeddedResultSchema = object({
16594
+ id: string(),
16595
+ url: string()
15910
16596
  });
15911
- /**
15912
- * `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
15913
- * on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
15914
- * a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
15915
- * cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
15916
- * this only through the `llm` cap's methods.
15917
- *
15918
- * One running llama-server child per node in v1 (models are RAM-heavy).
15919
- * Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
15920
- * watchdog — operator decision #3).
15921
- */
15922
- var ManagedModelRefSchema = discriminatedUnion("kind", [
15923
- object({
15924
- kind: literal("catalog"),
15925
- catalogId: string()
15926
- }),
15927
- object({
15928
- kind: literal("url"),
15929
- url: string(),
15930
- sha256: string().optional()
15931
- }),
15932
- object({
15933
- kind: literal("path"),
15934
- path: string()
15935
- })
15936
- ]);
15937
- var ManagedRuntimeConfigSchema = object({
15938
- /** WHERE the runtime lives — hub or any agent. */
15939
- nodeId: string(),
15940
- /** Closed for v1; 'ollama' is a v2 candidate. */
15941
- engine: _enum(["llama-cpp"]),
15942
- model: ManagedModelRefSchema,
15943
- contextSize: number().int().default(4096),
15944
- /** 0 = CPU-only. */
15945
- gpuLayers: number().int().default(0),
15946
- /** Default: cpus-2, clamped ≥1 (resolved node-side). */
15947
- threads: number().int().optional(),
15948
- /** Concurrent slots. */
15949
- parallel: number().int().default(1),
15950
- /** Else lazy: first generate boots it. */
15951
- autoStart: boolean().default(false),
15952
- /** 0 = never; frees RAM after quiet periods. */
15953
- idleStopMinutes: number().int().default(30)
16597
+ var StatusSchema = object({
16598
+ brokerCount: number(),
16599
+ embeddedRunning: boolean()
15954
16600
  });
15955
- var LlmRuntimeStatusSchema = object({
15956
- /** Status is ALWAYS node-qualified. */
15957
- nodeId: string(),
15958
- state: _enum([
15959
- "stopped",
15960
- "downloading",
15961
- "starting",
15962
- "ready",
15963
- "crashed",
15964
- "failed"
15965
- ]),
15966
- pid: number().optional(),
15967
- port: number().optional(),
15968
- modelPath: string().optional(),
15969
- modelId: string().optional(),
15970
- downloadProgress: number().min(0).max(1).optional(),
15971
- lastError: string().optional(),
15972
- crashesInWindow: number(),
15973
- /** Child RSS (sampled best-effort). */
15974
- memoryBytes: number().optional(),
15975
- vramBytes: number().optional()
16601
+ var mqttBrokerCapability = {
16602
+ name: "mqtt-broker",
16603
+ scope: "system",
16604
+ mode: "collection",
16605
+ providerKind: "broker",
16606
+ status: {
16607
+ schema: StatusSchema,
16608
+ kind: "poll"
16609
+ },
16610
+ methods: {
16611
+ listBrokers: method(_void(), array(BrokerInfoSchema)),
16612
+ getBrokerConfig: method(IdInputSchema, BrokerConnectionDetailsSchema),
16613
+ addBroker: method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }),
16614
+ removeBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
16615
+ testConnection: method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }),
16616
+ startEmbeddedBroker: method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }),
16617
+ stopEmbeddedBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
16618
+ getStatus: method(_void(), StatusSchema)
16619
+ }
16620
+ };
16621
+ var NetworkEndpointSchema = object({
16622
+ url: string(),
16623
+ hostname: string(),
16624
+ port: number(),
16625
+ protocol: _enum(["http", "https"])
15976
16626
  });
15977
- var LlmNodeModelSchema = object({
15978
- file: string(),
15979
- sizeBytes: number(),
15980
- catalogId: string().optional(),
15981
- installedAt: number().optional()
16627
+ var NetworkAccessStatusSchema = object({
16628
+ connected: boolean(),
16629
+ endpoint: NetworkEndpointSchema.nullable(),
16630
+ error: string().optional()
15982
16631
  });
15983
- var LlmRuntimeDiskUsageSchema = object({
15984
- nodeId: string(),
15985
- modelsBytes: number(),
15986
- freeBytes: number().optional()
16632
+ /**
16633
+ * Optional, richer endpoint shape returned by providers that expose
16634
+ * MORE than one ingress concurrently (Tailscale Ingress with mixed
16635
+ * serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
16636
+ * the originating provider config (mode + sourcePort) so the
16637
+ * orchestrator UI can label rows distinctly. Providers that expose only
16638
+ * one endpoint just omit `listEndpoints` from their provider impl.
16639
+ */
16640
+ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
16641
+ /**
16642
+ * Stable id within the provider — typically `<mode>-<sourcePort>` so
16643
+ * the orchestrator can dedupe across `listEndpoints` polls.
16644
+ */
16645
+ id: string(),
16646
+ /** Operator-facing label (mirrors `MeshEndpoint.label`). */
16647
+ label: string(),
16648
+ /** Optional provider-specific mode tag, used for icon/colour in admin UI. */
16649
+ mode: string().optional(),
16650
+ /** Originating local port the ingress fronts (informational). */
16651
+ sourcePort: number().optional()
15987
16652
  });
15988
- method(LlmGenerateBaseInputSchema.extend({
15989
- images: array(LlmImageSchema).optional(),
15990
- runtime: ManagedRuntimeConfigSchema,
15991
- /** The managed profile's timeout, threaded by the hub provider. */
15992
- timeoutMs: number().int().positive().optional()
15993
- }), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
15994
- kind: "mutation",
15995
- auth: "admin"
15996
- }), method(object({}), _void(), {
15997
- kind: "mutation",
15998
- auth: "admin"
15999
- }), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
16000
- kind: "mutation",
16001
- auth: "admin"
16002
- }), method(object({ file: string() }), _void(), {
16003
- kind: "mutation",
16004
- auth: "admin"
16005
- }), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
16653
+ method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
16006
16654
  /**
16007
- * `llm`consumer-facing LLM surface (spec §1-§3). Collection-mode: array
16008
- * methods concat-fan across providers; single-row methods route to ONE
16009
- * provider by the `addonId` in the call input (the notification-output
16010
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
16011
- * (hub-placed); the cap stays open for future providers.
16655
+ * notification-outputcanonical, capability-gated notification delivery.
16656
+ *
16657
+ * Apprise-derived model (see
16658
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
16659
+ * callers emit ONE canonical `Notification`; each provider declares a
16660
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
16661
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
16662
+ * message to what the kind supports — callers never special-case a service.
16663
+ *
16664
+ * DESIGN DECISIONS (locked):
16665
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
16666
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
16667
+ * cap. Rationale: the admin UI needs one uniform surface across the
16668
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
16669
+ * alternative would fork the UI per addon and cannot host the
16670
+ * discovery→adopt flow.
16671
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
16672
+ * the generated cap-mount auto-`concatCollection`-fans them across every
16673
+ * registered provider (notifiers addon + HA addon) so one catalog is
16674
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
16675
+ * `addonId` the generated collection router extracts from the call input.
16676
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
16677
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
16678
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
16679
+ * base64 fallback needed.
16012
16680
  *
16013
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
16014
- * `apiKey` is a password field — providers REDACT it on read and merge on
16015
- * write; a stored key NEVER round-trips to a client.
16681
+ * TODO (deferred, closed-set change separate decision): add
16682
+ * `providerKind: 'notify'` so notification providers surface on the unified
16683
+ * admin "Integrations" page.
16016
16684
  */
16017
- var LlmProfileKindSchema = _enum([
16018
- "openai-compatible",
16019
- "openai",
16020
- "anthropic",
16021
- "google",
16022
- "managed-local"
16685
+ /**
16686
+ * Zentik-derived typed-media enum — the superset across every kind. Each
16687
+ * adapter picks what it supports and the degrade engine filters the rest.
16688
+ */
16689
+ var AttachmentMediaTypeSchema = _enum([
16690
+ "image",
16691
+ "video",
16692
+ "gif",
16693
+ "audio",
16694
+ "icon"
16023
16695
  ]);
16024
- var LlmProfileSchema = object({
16696
+ /**
16697
+ * A single attachment. Exactly one of `url` (remote source, most adapters
16698
+ * prefer this) or `bytes` (inline source; required for Pushover-style
16699
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
16700
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
16701
+ */
16702
+ var AttachmentSchema = object({
16703
+ mediaType: AttachmentMediaTypeSchema,
16704
+ url: string().optional(),
16705
+ bytes: _instanceof(Uint8Array).optional(),
16706
+ mime: string().optional(),
16707
+ name: string().optional()
16708
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
16709
+ var NotificationFormatSchema = _enum([
16710
+ "text",
16711
+ "markdown",
16712
+ "html"
16713
+ ]);
16714
+ /** A single tap-through action button. */
16715
+ var NotificationActionSchema = object({
16025
16716
  id: string(),
16026
- name: string(),
16027
- kind: LlmProfileKindSchema,
16028
- /** Stamped by the provider — keeps the fanned catalog routable. */
16029
- addonId: string(),
16030
- enabled: boolean(),
16031
- /** Vendor model id, or the managed runtime's loaded model. */
16032
- model: string(),
16033
- /** Required for openai-compatible; override for cloud kinds. */
16034
- baseUrl: string().optional(),
16035
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
16036
- apiKey: string().optional(),
16037
- supportsVision: boolean(),
16038
- temperature: number().min(0).max(2).optional(),
16039
- maxTokens: number().int().positive().optional(),
16040
- timeoutMs: number().int().positive().default(6e4),
16041
- extraHeaders: record(string(), string()).optional(),
16042
- /** kind === 'managed-local' only (spec §4). */
16043
- runtime: ManagedRuntimeConfigSchema.optional()
16717
+ label: string(),
16718
+ url: string().optional()
16044
16719
  });
16045
- /** ConfigUISchema tree passed through untyped on the wire (the
16046
- * notification-output `ConfigSchemaPassthrough` precedent at
16047
- * notification-output.cap.ts:151); the exported TS type re-tightens it. */
16720
+ /**
16721
+ * The canonical notification. `body` is the only hard field (Apprise model).
16722
+ * `priority` is a 5-level ORDINAL (1=lowest 3=normal(default) 5=urgent),
16723
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
16724
+ * the adapter maps this ordinal onto its native level. `level?` is an
16725
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
16726
+ * `priority` for that one target.
16727
+ */
16728
+ var NotificationSchema = object({
16729
+ body: string(),
16730
+ title: string().optional(),
16731
+ format: NotificationFormatSchema.default("text"),
16732
+ priority: number().int().min(1).max(5).default(3),
16733
+ level: string().optional(),
16734
+ attachments: array(AttachmentSchema).optional(),
16735
+ clickUrl: string().optional(),
16736
+ actions: array(NotificationActionSchema).optional(),
16737
+ sound: string().optional(),
16738
+ ttl: number().optional(),
16739
+ tag: string().optional(),
16740
+ deviceId: number().optional(),
16741
+ eventId: string().optional(),
16742
+ metadata: record(string(), unknown()).optional()
16743
+ });
16744
+ /** One declared native severity/priority level for a kind. */
16745
+ var TargetKindLevelSchema = object({
16746
+ id: string(),
16747
+ label: string(),
16748
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
16749
+ ordinal: number().int().min(1).max(5).nullable(),
16750
+ flags: object({
16751
+ critical: boolean().optional(),
16752
+ silent: boolean().optional(),
16753
+ noPush: boolean().optional()
16754
+ }).optional(),
16755
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
16756
+ requires: array(string()).optional(),
16757
+ description: string().optional()
16758
+ });
16759
+ /** The full capability block consulted before dispatch. */
16760
+ var TargetKindCapsSchema = object({
16761
+ attachments: object({
16762
+ mediaTypes: array(AttachmentMediaTypeSchema),
16763
+ mode: _enum([
16764
+ "url",
16765
+ "bytes",
16766
+ "both"
16767
+ ]),
16768
+ max: number().int().nonnegative(),
16769
+ maxBytes: number().int().positive().optional()
16770
+ }),
16771
+ /** Max action buttons (0 = none). */
16772
+ actions: number().int().nonnegative(),
16773
+ levels: array(TargetKindLevelSchema),
16774
+ format: array(NotificationFormatSchema),
16775
+ clickUrl: boolean(),
16776
+ sound: boolean(),
16777
+ ttl: boolean(),
16778
+ bodyMaxLen: number().int().positive()
16779
+ });
16780
+ /**
16781
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
16782
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
16783
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
16784
+ * the union is large and not meant for runtime validation here; the exported
16785
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
16786
+ */
16048
16787
  var ConfigSchemaPassthrough = unknown();
16049
- var LlmProfileKindDescriptorSchema = object({
16050
- kind: LlmProfileKindSchema,
16788
+ var TargetKindSchema = object({
16789
+ kind: string(),
16051
16790
  label: string(),
16052
16791
  icon: string(),
16053
16792
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
16054
16793
  addonId: string(),
16055
- configSchema: ConfigSchemaPassthrough
16056
- });
16057
- var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
16058
- var LlmDefaultSchema = object({
16059
- selector: LlmDefaultSelectorSchema,
16060
- profileId: string()
16061
- });
16062
- /** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
16063
- var LlmUsageRollupSchema = object({
16064
- day: string(),
16065
- consumer: string(),
16066
- profileId: string(),
16067
- calls: number(),
16068
- okCalls: number(),
16069
- errorCalls: number(),
16070
- inputTokens: number(),
16071
- outputTokens: number(),
16072
- avgLatencyMs: number()
16794
+ configSchema: ConfigSchemaPassthrough,
16795
+ supportsDiscovery: boolean(),
16796
+ caps: TargetKindCapsSchema
16073
16797
  });
16074
- /** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
16075
- var ManagedModelCatalogEntrySchema = object({
16798
+ /**
16799
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
16800
+ * (return a presence marker only) when serving `listTargets` — never
16801
+ * round-trip a stored secret to the UI.
16802
+ */
16803
+ var TargetSchema = object({
16076
16804
  id: string(),
16077
- label: string(),
16078
- family: string(),
16079
- purpose: _enum(["text", "vision"]),
16080
- url: string(),
16081
- sha256: string(),
16082
- sizeBytes: number(),
16083
- quantization: string(),
16084
- /** Load-time guidance shown in the picker. */
16085
- minRamBytes: number(),
16086
- contextSizeDefault: number().int(),
16087
- /** Vision models: companion projector file. */
16088
- mmprojUrl: string().optional()
16089
- });
16090
- var LlmRuntimeNodeSchema = object({
16091
- nodeId: string(),
16092
- reachable: boolean(),
16093
- status: LlmRuntimeStatusSchema.optional(),
16094
- disk: LlmRuntimeDiskUsageSchema.optional(),
16095
- error: string().optional()
16096
- });
16097
- var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
16098
- var ProfileRefInputSchema = object({
16805
+ name: string(),
16806
+ kind: string(),
16099
16807
  addonId: string(),
16100
- profileId: string()
16808
+ enabled: boolean(),
16809
+ config: record(string(), unknown())
16101
16810
  });
16102
- method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
16103
- kind: "mutation",
16104
- auth: "admin"
16105
- }), method(ProfileRefInputSchema, _void(), {
16106
- kind: "mutation",
16107
- auth: "admin"
16108
- }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
16109
- kind: "mutation",
16110
- auth: "admin"
16111
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
16112
- selector: LlmDefaultSelectorSchema,
16113
- profileId: string().nullable()
16114
- }), _void(), {
16115
- kind: "mutation",
16116
- auth: "admin"
16117
- }), method(object({
16118
- since: number().optional(),
16119
- until: number().optional(),
16120
- consumer: string().optional(),
16121
- profileId: string().optional()
16122
- }), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
16123
- nodeId: string(),
16124
- model: ManagedModelRefSchema
16125
- }), _void(), {
16126
- kind: "mutation",
16127
- auth: "admin"
16128
- }), method(object({
16129
- nodeId: string(),
16130
- file: string()
16131
- }), _void(), {
16132
- kind: "mutation",
16133
- auth: "admin"
16134
- }), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
16135
- kind: "mutation",
16136
- auth: "admin"
16137
- }), method(ProfileRefInputSchema, _void(), {
16138
- kind: "mutation",
16139
- auth: "admin"
16811
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
16812
+ var DiscoveredTargetSchema = object({
16813
+ kind: string(),
16814
+ suggestedName: string(),
16815
+ config: record(string(), unknown())
16816
+ });
16817
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
16818
+ var RenderedAsSchema = object({
16819
+ level: string(),
16820
+ format: NotificationFormatSchema,
16821
+ attachmentsSent: number().int().nonnegative(),
16822
+ actionsSent: number().int().nonnegative(),
16823
+ truncated: boolean(),
16824
+ dropped: array(string())
16825
+ });
16826
+ var SendResultSchema = object({
16827
+ success: boolean(),
16828
+ error: string().optional(),
16829
+ renderedAs: RenderedAsSchema.optional()
16140
16830
  });
16831
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
16832
+ var TestResultSchema = SendResultSchema;
16833
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
16834
+ kind: string(),
16835
+ config: record(string(), unknown()).optional()
16836
+ }), array(DiscoveredTargetSchema)), method(object({
16837
+ targetId: string(),
16838
+ notification: NotificationSchema
16839
+ }), SendResultSchema, { kind: "mutation" }), method(object({
16840
+ targetId: string(),
16841
+ sample: NotificationSchema.optional()
16842
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
16843
+ targetId: string(),
16844
+ enabled: boolean()
16845
+ }), _void(), { kind: "mutation" });
16141
16846
  /**
16142
16847
  * Zod schemas for persisted record types.
16143
16848
  *
@@ -16823,7 +17528,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16823
17528
  }), method(object({
16824
17529
  eventId: string(),
16825
17530
  kind: MediaFileKindEnum.optional()
16826
- }), array(MediaFileSchema).readonly()), method(object({ trackId: string() }), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
17531
+ }), array(MediaFileSchema).readonly()), method(object({
17532
+ trackId: string(),
17533
+ kinds: array(MediaFileKindEnum).optional()
17534
+ }), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
16827
17535
  deviceId: number(),
16828
17536
  timestamp: number(),
16829
17537
  frameWidth: number(),
@@ -16844,76 +17552,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16844
17552
  eventId: string(),
16845
17553
  timestamp: number()
16846
17554
  });
16847
- /**
16848
- * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16849
- * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16850
- * caps into per-camera event-kind descriptors.
16851
- *
16852
- * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16853
- * is NOT duplicated here — every entry is derived from the single
16854
- * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16855
- * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16856
- * control cap means adding one line here (and a taxonomy entry); the anti-
16857
- * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16858
- * eventful cap is missing.
16859
- */
16860
- /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16861
- var LEGACY_ICON = {
16862
- motion: "motion",
16863
- audio: "audio",
16864
- person: "person",
16865
- vehicle: "vehicle",
16866
- animal: "animal",
16867
- package: "package",
16868
- door: "door",
16869
- pir: "pir",
16870
- smoke: "smoke",
16871
- water: "water",
16872
- button: "button",
16873
- generic: "generic",
16874
- gas: "smoke",
16875
- vibration: "generic",
16876
- tamper: "generic",
16877
- presence: "person",
16878
- lock: "generic",
16879
- siren: "generic",
16880
- switch: "generic",
16881
- doorbell: "button"
16882
- };
16883
- function legacyIcon(iconId) {
16884
- return LEGACY_ICON[iconId] ?? "generic";
16885
- }
16886
- /**
16887
- * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16888
- * The anti-drift guard cross-checks this against the eventful caps declared
16889
- * in `packages/types/src/capabilities/*.cap.ts`.
16890
- */
16891
- var CAP_TO_KIND = {
16892
- contact: "contact",
16893
- motion: "motion-sensor",
16894
- smoke: "smoke",
16895
- flood: "flood",
16896
- gas: "gas",
16897
- "carbon-monoxide": "carbon-monoxide",
16898
- vibration: "vibration",
16899
- tamper: "tamper",
16900
- presence: "presence",
16901
- "enum-sensor": "enum-sensor",
16902
- "event-emitter": "device-event",
16903
- "lock-control": "lock",
16904
- switch: "switch",
16905
- button: "button",
16906
- doorbell: "doorbell"
16907
- };
16908
- function buildDescriptor(capName, kind) {
16909
- const t = EVENT_TAXONOMY[kind];
16910
- if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16911
- return {
16912
- ...t,
16913
- icon: legacyIcon(t.iconId)
16914
- };
16915
- }
16916
- Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16917
17555
  var CameraPipelineConfigSchema = object({
16918
17556
  engine: PipelineEngineChoiceSchema.optional(),
16919
17557
  steps: array(PipelineStepInputSchema).readonly(),
@@ -17399,6 +18037,76 @@ method(object({
17399
18037
  auth: "admin"
17400
18038
  });
17401
18039
  /**
18040
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
18041
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
18042
+ * caps into per-camera event-kind descriptors.
18043
+ *
18044
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
18045
+ * is NOT duplicated here — every entry is derived from the single
18046
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
18047
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
18048
+ * control cap means adding one line here (and a taxonomy entry); the anti-
18049
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
18050
+ * eventful cap is missing.
18051
+ */
18052
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
18053
+ var LEGACY_ICON = {
18054
+ motion: "motion",
18055
+ audio: "audio",
18056
+ person: "person",
18057
+ vehicle: "vehicle",
18058
+ animal: "animal",
18059
+ package: "package",
18060
+ door: "door",
18061
+ pir: "pir",
18062
+ smoke: "smoke",
18063
+ water: "water",
18064
+ button: "button",
18065
+ generic: "generic",
18066
+ gas: "smoke",
18067
+ vibration: "generic",
18068
+ tamper: "generic",
18069
+ presence: "person",
18070
+ lock: "generic",
18071
+ siren: "generic",
18072
+ switch: "generic",
18073
+ doorbell: "button"
18074
+ };
18075
+ function legacyIcon(iconId) {
18076
+ return LEGACY_ICON[iconId] ?? "generic";
18077
+ }
18078
+ /**
18079
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
18080
+ * The anti-drift guard cross-checks this against the eventful caps declared
18081
+ * in `packages/types/src/capabilities/*.cap.ts`.
18082
+ */
18083
+ var CAP_TO_KIND = {
18084
+ contact: "contact",
18085
+ motion: "motion-sensor",
18086
+ smoke: "smoke",
18087
+ flood: "flood",
18088
+ gas: "gas",
18089
+ "carbon-monoxide": "carbon-monoxide",
18090
+ vibration: "vibration",
18091
+ tamper: "tamper",
18092
+ presence: "presence",
18093
+ "enum-sensor": "enum-sensor",
18094
+ "event-emitter": "device-event",
18095
+ "lock-control": "lock",
18096
+ switch: "switch",
18097
+ button: "button",
18098
+ doorbell: "doorbell"
18099
+ };
18100
+ function buildDescriptor(capName, kind) {
18101
+ const t = EVENT_TAXONOMY[kind];
18102
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
18103
+ return {
18104
+ ...t,
18105
+ icon: legacyIcon(t.iconId)
18106
+ };
18107
+ }
18108
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
18109
+ /**
17402
18110
  * server-management — per-NODE singleton capability for a node's ROOT
17403
18111
  * package lifecycle (runtime-updatable node packages).
17404
18112
  *
@@ -18853,7 +19561,28 @@ var FaceInfoSchema = object({
18853
19561
  * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
18854
19562
  * track produced no key frame (e.g. native/onboard source) — the UI falls
18855
19563
  * back to the inline `base64` face crop. */
18856
- keyFrameMediaKey: string().optional()
19564
+ keyFrameMediaKey: string().optional(),
19565
+ /** Winning identity-match cosine (0..1) for this face's track, when an
19566
+ * identity was auto-confirmed. Lets the UI surface WHY a face was assigned
19567
+ * (confidence badge / low-confidence audit). Absent on legacy rows and on
19568
+ * faces that were never auto-recognized. */
19569
+ bestMatchScore: number().optional(),
19570
+ /** Native-scale face short side (px) at recognition time, when the runner
19571
+ * measured it. Lets the UI flag low-resolution auto-assignments. Absent on
19572
+ * legacy rows / runners that reported no native measure. */
19573
+ nativeFaceShortSidePx: number().optional(),
19574
+ /** SUGGESTED identity for this face — a plausible-but-not-confident match that
19575
+ * MISSED auto-assignment (cosine in the suggestion band, or above threshold
19576
+ * but blocked only by the recognition size floor). Mutually exclusive with
19577
+ * `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
19578
+ * UNASSIGNED and everything else keeps treating it as unrecognized — the UI
19579
+ * merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
19580
+ * on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
19581
+ suggestedIdentityId: string().optional(),
19582
+ /** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
19583
+ * same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
19584
+ * badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
19585
+ suggestedMatchScore: number().optional()
18857
19586
  });
18858
19587
  var FaceFilterEnum = _enum([
18859
19588
  "unassigned",
@@ -20896,36 +21625,6 @@ Object.freeze({
20896
21625
  addonId: null,
20897
21626
  access: "view"
20898
21627
  },
20899
- "advancedNotifier.deleteRule": {
20900
- capName: "advanced-notifier",
20901
- capScope: "system",
20902
- addonId: null,
20903
- access: "delete"
20904
- },
20905
- "advancedNotifier.getHistory": {
20906
- capName: "advanced-notifier",
20907
- capScope: "system",
20908
- addonId: null,
20909
- access: "view"
20910
- },
20911
- "advancedNotifier.getRules": {
20912
- capName: "advanced-notifier",
20913
- capScope: "system",
20914
- addonId: null,
20915
- access: "view"
20916
- },
20917
- "advancedNotifier.testRule": {
20918
- capName: "advanced-notifier",
20919
- capScope: "system",
20920
- addonId: null,
20921
- access: "create"
20922
- },
20923
- "advancedNotifier.upsertRule": {
20924
- capName: "advanced-notifier",
20925
- capScope: "system",
20926
- addonId: null,
20927
- access: "create"
20928
- },
20929
21628
  "alarmPanel.arm": {
20930
21629
  capName: "alarm-panel",
20931
21630
  capScope: "device",
@@ -21148,6 +21847,12 @@ Object.freeze({
21148
21847
  addonId: null,
21149
21848
  access: "delete"
21150
21849
  },
21850
+ "backup.deleteSchedule": {
21851
+ capName: "backup",
21852
+ capScope: "system",
21853
+ addonId: null,
21854
+ access: "delete"
21855
+ },
21151
21856
  "backup.getEntries": {
21152
21857
  capName: "backup",
21153
21858
  capScope: "system",
@@ -21178,6 +21883,12 @@ Object.freeze({
21178
21883
  addonId: null,
21179
21884
  access: "view"
21180
21885
  },
21886
+ "backup.listSchedules": {
21887
+ capName: "backup",
21888
+ capScope: "system",
21889
+ addonId: null,
21890
+ access: "view"
21891
+ },
21181
21892
  "backup.previewSchedule": {
21182
21893
  capName: "backup",
21183
21894
  capScope: "system",
@@ -21202,6 +21913,12 @@ Object.freeze({
21202
21913
  addonId: null,
21203
21914
  access: "create"
21204
21915
  },
21916
+ "backup.upsertSchedule": {
21917
+ capName: "backup",
21918
+ capScope: "system",
21919
+ addonId: null,
21920
+ access: "create"
21921
+ },
21205
21922
  "battery.wakeForStream": {
21206
21923
  capName: "battery",
21207
21924
  capScope: "device",
@@ -23230,6 +23947,60 @@ Object.freeze({
23230
23947
  addonId: null,
23231
23948
  access: "create"
23232
23949
  },
23950
+ "notificationRules.createRule": {
23951
+ capName: "notification-rules",
23952
+ capScope: "system",
23953
+ addonId: null,
23954
+ access: "create"
23955
+ },
23956
+ "notificationRules.deleteRule": {
23957
+ capName: "notification-rules",
23958
+ capScope: "system",
23959
+ addonId: null,
23960
+ access: "delete"
23961
+ },
23962
+ "notificationRules.getConditionCatalog": {
23963
+ capName: "notification-rules",
23964
+ capScope: "system",
23965
+ addonId: null,
23966
+ access: "view"
23967
+ },
23968
+ "notificationRules.getHistory": {
23969
+ capName: "notification-rules",
23970
+ capScope: "system",
23971
+ addonId: null,
23972
+ access: "view"
23973
+ },
23974
+ "notificationRules.getRule": {
23975
+ capName: "notification-rules",
23976
+ capScope: "system",
23977
+ addonId: null,
23978
+ access: "view"
23979
+ },
23980
+ "notificationRules.listRules": {
23981
+ capName: "notification-rules",
23982
+ capScope: "system",
23983
+ addonId: null,
23984
+ access: "view"
23985
+ },
23986
+ "notificationRules.setRuleEnabled": {
23987
+ capName: "notification-rules",
23988
+ capScope: "system",
23989
+ addonId: null,
23990
+ access: "create"
23991
+ },
23992
+ "notificationRules.testRule": {
23993
+ capName: "notification-rules",
23994
+ capScope: "system",
23995
+ addonId: null,
23996
+ access: "create"
23997
+ },
23998
+ "notificationRules.updateRule": {
23999
+ capName: "notification-rules",
24000
+ capScope: "system",
24001
+ addonId: null,
24002
+ access: "create"
24003
+ },
23233
24004
  "notifier.cancel": {
23234
24005
  capName: "notifier",
23235
24006
  capScope: "device",
@@ -24982,6 +25753,36 @@ Object.freeze({
24982
25753
  addonId: null,
24983
25754
  access: "create"
24984
25755
  },
25756
+ "terminalSession.close": {
25757
+ capName: "terminal-session",
25758
+ capScope: "system",
25759
+ addonId: null,
25760
+ access: "create"
25761
+ },
25762
+ "terminalSession.listProfiles": {
25763
+ capName: "terminal-session",
25764
+ capScope: "system",
25765
+ addonId: null,
25766
+ access: "view"
25767
+ },
25768
+ "terminalSession.listSessions": {
25769
+ capName: "terminal-session",
25770
+ capScope: "system",
25771
+ addonId: null,
25772
+ access: "view"
25773
+ },
25774
+ "terminalSession.openSession": {
25775
+ capName: "terminal-session",
25776
+ capScope: "system",
25777
+ addonId: null,
25778
+ access: "create"
25779
+ },
25780
+ "terminalSession.resize": {
25781
+ capName: "terminal-session",
25782
+ capScope: "system",
25783
+ addonId: null,
25784
+ access: "create"
25785
+ },
24985
25786
  "toast.onToast": {
24986
25787
  capName: "toast",
24987
25788
  capScope: "system",