@camstack/addon-export-alexa 1.2.5 → 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.
- package/dist/export-alexa.addon.js +1881 -1632
- package/dist/export-alexa.addon.mjs +1881 -1632
- package/package.json +1 -1
|
@@ -7669,16 +7669,23 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7669
7669
|
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7670
7670
|
* FRESH install:
|
|
7671
7671
|
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7672
|
-
* the appData volume. Right for small/durable data (
|
|
7672
|
+
* the appData volume. Right for small/durable data (logs, models).
|
|
7673
7673
|
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7674
7674
|
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7675
7675
|
* (recordings, event media) that should stay off the appData disk.
|
|
7676
|
+
* - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
|
|
7677
|
+
* `/backups` in the image) so archives live on their own mount rather than
|
|
7678
|
+
* filling the appData disk. Falls back to the data root when unset.
|
|
7676
7679
|
*
|
|
7677
7680
|
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7678
7681
|
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7679
7682
|
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7680
7683
|
*/
|
|
7681
|
-
defaultRoot: _enum([
|
|
7684
|
+
defaultRoot: _enum([
|
|
7685
|
+
"data",
|
|
7686
|
+
"media",
|
|
7687
|
+
"backup"
|
|
7688
|
+
]).optional()
|
|
7682
7689
|
});
|
|
7683
7690
|
var DecoderStatsSchema = object({
|
|
7684
7691
|
inputFps: number(),
|
|
@@ -9083,92 +9090,730 @@ var AccessoryKind = {
|
|
|
9083
9090
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
9084
9091
|
DeviceFeature.BatteryOperated;
|
|
9085
9092
|
/**
|
|
9086
|
-
*
|
|
9087
|
-
*
|
|
9088
|
-
*
|
|
9089
|
-
*
|
|
9090
|
-
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
9091
|
-
* their own slices.
|
|
9093
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
9094
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
9095
|
+
* language so a single drawing-plane editor and the providers stay
|
|
9096
|
+
* decoupled from each cap's storage.
|
|
9092
9097
|
*
|
|
9093
|
-
*
|
|
9094
|
-
*
|
|
9095
|
-
* `
|
|
9096
|
-
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
9097
|
-
* consumers reach the same data via the `device-state` cap router
|
|
9098
|
-
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
9098
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
9099
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
9100
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
9099
9101
|
*/
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
* stream-health, Reolink reads firmware push events, ONVIF tracks
|
|
9105
|
-
* ping responses. This cap intentionally does NOT prescribe which
|
|
9106
|
-
* signal drives the flag.
|
|
9107
|
-
*/
|
|
9108
|
-
online: boolean(),
|
|
9109
|
-
/** Ms epoch of the last `online` transition. Lets consumers tell
|
|
9110
|
-
* apart "just came online" from "still online". */
|
|
9111
|
-
lastChangedAt: number()
|
|
9102
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
9103
|
+
var MaskPointSchema = object({
|
|
9104
|
+
x: number(),
|
|
9105
|
+
y: number()
|
|
9112
9106
|
});
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9107
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
9108
|
+
var MaskRectShapeSchema = object({
|
|
9109
|
+
kind: literal("rect"),
|
|
9110
|
+
x: number(),
|
|
9111
|
+
y: number(),
|
|
9112
|
+
width: number(),
|
|
9113
|
+
height: number()
|
|
9114
|
+
});
|
|
9115
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
9116
|
+
var MaskPolygonShapeSchema = object({
|
|
9117
|
+
kind: literal("polygon"),
|
|
9118
|
+
points: array(MaskPointSchema)
|
|
9119
|
+
});
|
|
9120
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
9121
|
+
var MaskGridShapeSchema = object({
|
|
9122
|
+
kind: literal("grid"),
|
|
9123
|
+
gridWidth: number(),
|
|
9124
|
+
gridHeight: number(),
|
|
9125
|
+
cells: array(boolean())
|
|
9126
|
+
});
|
|
9127
|
+
discriminatedUnion("kind", [
|
|
9128
|
+
MaskRectShapeSchema,
|
|
9129
|
+
MaskPolygonShapeSchema,
|
|
9130
|
+
MaskGridShapeSchema,
|
|
9131
|
+
object({
|
|
9132
|
+
kind: literal("line"),
|
|
9133
|
+
points: array(MaskPointSchema)
|
|
9134
|
+
})
|
|
9135
|
+
]);
|
|
9136
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
9137
|
+
var MaskShapeKindSchema = _enum([
|
|
9138
|
+
"rect",
|
|
9139
|
+
"polygon",
|
|
9140
|
+
"grid",
|
|
9141
|
+
"line"
|
|
9142
|
+
]);
|
|
9143
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
9144
|
+
var MaskPolygonVerticesSchema = object({
|
|
9145
|
+
min: number(),
|
|
9146
|
+
max: number()
|
|
9147
|
+
});
|
|
9148
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
9149
|
+
var MaskGridDimsSchema = object({
|
|
9150
|
+
width: number(),
|
|
9151
|
+
height: number()
|
|
9116
9152
|
});
|
|
9117
9153
|
/**
|
|
9118
|
-
*
|
|
9119
|
-
* truth about what a device CAN do — which the kernel uses to:
|
|
9120
|
-
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
9121
|
-
* based on what the firmware actually advertises).
|
|
9122
|
-
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
9123
|
-
* `device-manager.listAll`.
|
|
9124
|
-
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
9125
|
-
* to register on the device's capability surface.
|
|
9154
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
9126
9155
|
*
|
|
9127
|
-
*
|
|
9128
|
-
*
|
|
9129
|
-
* accessory reconciliation). Consumers read via:
|
|
9130
|
-
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
9156
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
9157
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
9131
9158
|
*
|
|
9132
|
-
*
|
|
9133
|
-
*
|
|
9134
|
-
*
|
|
9159
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
9160
|
+
* `notification-center` module), hooked on the durable persistence
|
|
9161
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
9162
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
9163
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
9164
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
9165
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
9166
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
9167
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
9168
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
9169
|
+
* target kind's own caps/degrade engine).
|
|
9135
9170
|
*
|
|
9136
|
-
*
|
|
9137
|
-
*
|
|
9138
|
-
*
|
|
9139
|
-
*
|
|
9171
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
9172
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
9173
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
9174
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
9175
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
9176
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
9177
|
+
* P2+ (see spec §7).
|
|
9178
|
+
*
|
|
9179
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
9180
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
9181
|
+
* schema/interface drift is explicitly not repeated).
|
|
9140
9182
|
*/
|
|
9141
|
-
|
|
9183
|
+
/**
|
|
9184
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
9185
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
9186
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
9187
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
9188
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
9189
|
+
* change of a LINKED device, one row per linked camera)
|
|
9190
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
9191
|
+
* delivery / pick-up)
|
|
9192
|
+
*
|
|
9193
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
9194
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
9195
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
9196
|
+
* one trigger.
|
|
9197
|
+
*/
|
|
9198
|
+
var NcDeliverySchema = _enum([
|
|
9199
|
+
"immediate",
|
|
9200
|
+
"track-end",
|
|
9201
|
+
"device-event",
|
|
9202
|
+
"package-event"
|
|
9203
|
+
]);
|
|
9204
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
9205
|
+
var NcScheduleSchema = object({
|
|
9206
|
+
windows: array(object({
|
|
9207
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
9208
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
9209
|
+
startMinute: number().int().min(0).max(1439),
|
|
9210
|
+
endMinute: number().int().min(0).max(1439)
|
|
9211
|
+
})).min(1),
|
|
9212
|
+
/** IANA timezone; default = hub host timezone. */
|
|
9213
|
+
timezone: string().optional(),
|
|
9214
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
9215
|
+
invert: boolean().optional()
|
|
9216
|
+
});
|
|
9217
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
9218
|
+
var NcPlateMatcherSchema = object({
|
|
9219
|
+
values: array(string().min(1)).min(1),
|
|
9220
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9221
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9222
|
+
});
|
|
9223
|
+
/**
|
|
9224
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9225
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9226
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9227
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9228
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9229
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9230
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9231
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9232
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9233
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9234
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9235
|
+
*/
|
|
9236
|
+
var NcOccupancyConditionSchema = object({
|
|
9237
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9238
|
+
zoneId: string().optional(),
|
|
9239
|
+
/** Object class to count; absent = any class. */
|
|
9240
|
+
className: string().optional(),
|
|
9241
|
+
op: _enum([
|
|
9242
|
+
"became-occupied",
|
|
9243
|
+
"became-free",
|
|
9244
|
+
">=",
|
|
9245
|
+
"<="
|
|
9246
|
+
]).default("became-occupied"),
|
|
9247
|
+
count: number().int().min(0).default(1),
|
|
9248
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9249
|
+
});
|
|
9250
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9251
|
+
var NcZoneConditionSchema = object({
|
|
9252
|
+
ids: array(string().min(1)).min(1),
|
|
9253
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9254
|
+
match: _enum(["any", "all"]).default("any")
|
|
9255
|
+
});
|
|
9256
|
+
/**
|
|
9257
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9258
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9259
|
+
*/
|
|
9260
|
+
var NcConditionsSchema = object({
|
|
9261
|
+
/** Device scope — absent = all devices. */
|
|
9262
|
+
devices: array(number()).optional(),
|
|
9263
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9264
|
+
classes: array(string().min(1)).optional(),
|
|
9265
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9266
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9267
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9268
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9269
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9270
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9271
|
+
/** Veto zones — any hit fails the rule. */
|
|
9272
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
9142
9273
|
/**
|
|
9143
|
-
*
|
|
9144
|
-
*
|
|
9145
|
-
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
9146
|
-
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
9147
|
-
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9274
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9275
|
+
* (identity name / plate text / subclass).
|
|
9148
9276
|
*/
|
|
9149
|
-
|
|
9277
|
+
labelEquals: array(string().min(1)).optional(),
|
|
9150
9278
|
/**
|
|
9151
|
-
*
|
|
9152
|
-
*
|
|
9153
|
-
*
|
|
9279
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9280
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9281
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
9154
9282
|
*/
|
|
9155
|
-
|
|
9156
|
-
/**
|
|
9157
|
-
|
|
9158
|
-
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
9159
|
-
channelCount: number().nullable(),
|
|
9283
|
+
identities: array(string().min(1)).optional(),
|
|
9284
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9285
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
9160
9286
|
/**
|
|
9161
|
-
*
|
|
9162
|
-
*
|
|
9163
|
-
*
|
|
9164
|
-
*
|
|
9287
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9288
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9289
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9290
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
9165
9291
|
*/
|
|
9166
|
-
|
|
9292
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
9167
9293
|
/**
|
|
9168
|
-
*
|
|
9169
|
-
*
|
|
9170
|
-
*
|
|
9171
|
-
|
|
9294
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9295
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9296
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9297
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9298
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9299
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9300
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9301
|
+
*/
|
|
9302
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9303
|
+
/**
|
|
9304
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9305
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9306
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9307
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9308
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9309
|
+
*/
|
|
9310
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9311
|
+
/**
|
|
9312
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9313
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9314
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9315
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9316
|
+
* tracks carry `sensor`.
|
|
9317
|
+
*/
|
|
9318
|
+
source: _enum([
|
|
9319
|
+
"pipeline",
|
|
9320
|
+
"onboard",
|
|
9321
|
+
"sensor",
|
|
9322
|
+
"any"
|
|
9323
|
+
]).optional(),
|
|
9324
|
+
/**
|
|
9325
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9326
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9327
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9328
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9329
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9330
|
+
*
|
|
9331
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9332
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9333
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9334
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9335
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9336
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9337
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9338
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9339
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9340
|
+
* closed for it (an un-recognized subject).
|
|
9341
|
+
*/
|
|
9342
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9343
|
+
/**
|
|
9344
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9345
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9346
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9347
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9348
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9349
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9350
|
+
*/
|
|
9351
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9352
|
+
/**
|
|
9353
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9354
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9355
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9356
|
+
*/
|
|
9357
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9358
|
+
/**
|
|
9359
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9360
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9361
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9362
|
+
* on the package-event trigger).
|
|
9363
|
+
*/
|
|
9364
|
+
packagePhase: _enum([
|
|
9365
|
+
"delivered",
|
|
9366
|
+
"picked-up",
|
|
9367
|
+
"both"
|
|
9368
|
+
]).optional(),
|
|
9369
|
+
/**
|
|
9370
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9371
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9372
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9373
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9374
|
+
*/
|
|
9375
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9376
|
+
/**
|
|
9377
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9378
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9379
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9380
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9381
|
+
*/
|
|
9382
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9383
|
+
});
|
|
9384
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9385
|
+
var NcRuleTargetSchema = object({
|
|
9386
|
+
/** `notification-output` Target id. */
|
|
9387
|
+
targetId: string().min(1),
|
|
9388
|
+
/**
|
|
9389
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9390
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9391
|
+
* degrade engine drops what the backend can't render.
|
|
9392
|
+
*/
|
|
9393
|
+
params: record(string(), unknown()).optional()
|
|
9394
|
+
});
|
|
9395
|
+
/**
|
|
9396
|
+
* Media attachment policy (P1 still-image subset).
|
|
9397
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9398
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9399
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9400
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9401
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9402
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9403
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9404
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9405
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9406
|
+
* - `none` — no attachment.
|
|
9407
|
+
*/
|
|
9408
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9409
|
+
"best",
|
|
9410
|
+
"best-matching",
|
|
9411
|
+
"keyFrame",
|
|
9412
|
+
"none"
|
|
9413
|
+
]).default("best") });
|
|
9414
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9415
|
+
var NcThrottleSchema = object({
|
|
9416
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9417
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9418
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9419
|
+
});
|
|
9420
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9421
|
+
var NcRuleInputSchema = object({
|
|
9422
|
+
name: string().min(1).max(200),
|
|
9423
|
+
enabled: boolean().default(true),
|
|
9424
|
+
delivery: NcDeliverySchema,
|
|
9425
|
+
conditions: NcConditionsSchema.default({}),
|
|
9426
|
+
schedule: NcScheduleSchema.optional(),
|
|
9427
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9428
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9429
|
+
throttle: NcThrottleSchema.default({
|
|
9430
|
+
cooldownSec: 60,
|
|
9431
|
+
scope: "rule-device"
|
|
9432
|
+
}),
|
|
9433
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9434
|
+
template: object({
|
|
9435
|
+
title: string().max(500).optional(),
|
|
9436
|
+
body: string().max(2e3).optional()
|
|
9437
|
+
}).optional(),
|
|
9438
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9439
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9440
|
+
/**
|
|
9441
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9442
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9443
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9444
|
+
*/
|
|
9445
|
+
ownerUserId: string().optional()
|
|
9446
|
+
});
|
|
9447
|
+
/**
|
|
9448
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9449
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9450
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9451
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9452
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9453
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9454
|
+
* `updateRule` patch.
|
|
9455
|
+
*/
|
|
9456
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9457
|
+
/** A persisted rule. */
|
|
9458
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9459
|
+
id: string(),
|
|
9460
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9461
|
+
createdBy: string(),
|
|
9462
|
+
createdAt: number(),
|
|
9463
|
+
updatedAt: number(),
|
|
9464
|
+
/**
|
|
9465
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9466
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9467
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9468
|
+
*/
|
|
9469
|
+
disabledTargetIds: array(string()).default([])
|
|
9470
|
+
});
|
|
9471
|
+
var NcTestResultSchema = object({
|
|
9472
|
+
recordId: string(),
|
|
9473
|
+
recordKind: _enum([
|
|
9474
|
+
"object-event",
|
|
9475
|
+
"track",
|
|
9476
|
+
"device-event",
|
|
9477
|
+
"package-event"
|
|
9478
|
+
]),
|
|
9479
|
+
deviceId: number(),
|
|
9480
|
+
timestamp: number(),
|
|
9481
|
+
wouldFire: boolean(),
|
|
9482
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9483
|
+
failedCondition: string().optional(),
|
|
9484
|
+
className: string().optional(),
|
|
9485
|
+
label: string().optional()
|
|
9486
|
+
});
|
|
9487
|
+
var NcConditionDescriptorSchema = object({
|
|
9488
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9489
|
+
id: string(),
|
|
9490
|
+
group: _enum([
|
|
9491
|
+
"scope",
|
|
9492
|
+
"class",
|
|
9493
|
+
"zones",
|
|
9494
|
+
"quality",
|
|
9495
|
+
"label",
|
|
9496
|
+
"schedule",
|
|
9497
|
+
"device",
|
|
9498
|
+
"package",
|
|
9499
|
+
"occupancy"
|
|
9500
|
+
]),
|
|
9501
|
+
label: string(),
|
|
9502
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9503
|
+
valueType: _enum([
|
|
9504
|
+
"deviceIdList",
|
|
9505
|
+
"stringList",
|
|
9506
|
+
"number01",
|
|
9507
|
+
"number",
|
|
9508
|
+
"sourceSelect",
|
|
9509
|
+
"zoneSelection",
|
|
9510
|
+
"zoneIdList",
|
|
9511
|
+
"schedule",
|
|
9512
|
+
"plateMatcher",
|
|
9513
|
+
"packagePhase",
|
|
9514
|
+
"polygonDraw",
|
|
9515
|
+
"occupancy"
|
|
9516
|
+
]),
|
|
9517
|
+
operator: _enum([
|
|
9518
|
+
"in",
|
|
9519
|
+
"notIn",
|
|
9520
|
+
"anyOf",
|
|
9521
|
+
"allOf",
|
|
9522
|
+
"gte",
|
|
9523
|
+
"fuzzyIn",
|
|
9524
|
+
"withinSchedule"
|
|
9525
|
+
]),
|
|
9526
|
+
/** Which delivery kinds the condition applies to. */
|
|
9527
|
+
appliesTo: array(NcDeliverySchema),
|
|
9528
|
+
phase: string(),
|
|
9529
|
+
description: string().optional()
|
|
9530
|
+
});
|
|
9531
|
+
/**
|
|
9532
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9533
|
+
* durable outbox row's own status (single source of truth):
|
|
9534
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9535
|
+
* - `sent` — delivered (terminal)
|
|
9536
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9537
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9538
|
+
* the failure `error`)
|
|
9539
|
+
*
|
|
9540
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9541
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9542
|
+
*/
|
|
9543
|
+
var NcHistoryStatusSchema = _enum([
|
|
9544
|
+
"pending",
|
|
9545
|
+
"sent",
|
|
9546
|
+
"dead"
|
|
9547
|
+
]);
|
|
9548
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9549
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9550
|
+
"object-event",
|
|
9551
|
+
"track-end",
|
|
9552
|
+
"device-event",
|
|
9553
|
+
"package-event"
|
|
9554
|
+
]);
|
|
9555
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9556
|
+
var NcHistorySubjectSchema = object({
|
|
9557
|
+
className: string(),
|
|
9558
|
+
label: string().optional(),
|
|
9559
|
+
confidence: number().optional(),
|
|
9560
|
+
zones: array(string()),
|
|
9561
|
+
timestamp: number()
|
|
9562
|
+
});
|
|
9563
|
+
/**
|
|
9564
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9565
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9566
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9567
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9568
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9569
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9570
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9571
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9572
|
+
* P1 (admin scope only).
|
|
9573
|
+
*/
|
|
9574
|
+
var NcHistoryEntrySchema = object({
|
|
9575
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9576
|
+
id: string(),
|
|
9577
|
+
ruleId: string(),
|
|
9578
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9579
|
+
ruleName: string(),
|
|
9580
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9581
|
+
delivery: NcDeliverySchema,
|
|
9582
|
+
targetId: string(),
|
|
9583
|
+
deviceId: number(),
|
|
9584
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9585
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9586
|
+
recordId: string(),
|
|
9587
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9588
|
+
trackId: string().optional(),
|
|
9589
|
+
status: NcHistoryStatusSchema,
|
|
9590
|
+
/** Delivery attempts made so far. */
|
|
9591
|
+
attempts: number().int(),
|
|
9592
|
+
/** Fire time (outbox enqueue). */
|
|
9593
|
+
createdAt: number(),
|
|
9594
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9595
|
+
updatedAt: number(),
|
|
9596
|
+
/** Failure detail — present on a `dead` row. */
|
|
9597
|
+
error: string().optional(),
|
|
9598
|
+
subject: NcHistorySubjectSchema
|
|
9599
|
+
});
|
|
9600
|
+
/**
|
|
9601
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9602
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9603
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9604
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9605
|
+
*/
|
|
9606
|
+
var NcHistoryFilterSchema = object({
|
|
9607
|
+
ruleId: string().optional(),
|
|
9608
|
+
deviceId: number().optional(),
|
|
9609
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9610
|
+
since: number().optional(),
|
|
9611
|
+
until: number().optional(),
|
|
9612
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9613
|
+
});
|
|
9614
|
+
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 }), {
|
|
9615
|
+
kind: "mutation",
|
|
9616
|
+
auth: "admin",
|
|
9617
|
+
caller: "required"
|
|
9618
|
+
}), method(object({
|
|
9619
|
+
ruleId: string(),
|
|
9620
|
+
patch: NcRulePatchSchema
|
|
9621
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9622
|
+
kind: "mutation",
|
|
9623
|
+
auth: "admin",
|
|
9624
|
+
caller: "required"
|
|
9625
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9626
|
+
kind: "mutation",
|
|
9627
|
+
auth: "admin"
|
|
9628
|
+
}), method(object({
|
|
9629
|
+
ruleId: string(),
|
|
9630
|
+
enabled: boolean()
|
|
9631
|
+
}), object({ success: literal(true) }), {
|
|
9632
|
+
kind: "mutation",
|
|
9633
|
+
auth: "admin"
|
|
9634
|
+
}), method(object({
|
|
9635
|
+
rule: NcRuleInputSchema,
|
|
9636
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9637
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9638
|
+
kind: "mutation",
|
|
9639
|
+
auth: "admin"
|
|
9640
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9641
|
+
/**
|
|
9642
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9643
|
+
*
|
|
9644
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
9645
|
+
* §3.2/§3.3.
|
|
9646
|
+
*
|
|
9647
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
9648
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
9649
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
9650
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
9651
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
9652
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
9653
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
9654
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
9655
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
9656
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
9657
|
+
*
|
|
9658
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
9659
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
9660
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
9661
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
9662
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
9663
|
+
*/
|
|
9664
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
9665
|
+
var TimelapseTemplateSchema = object({
|
|
9666
|
+
title: string().max(500).optional(),
|
|
9667
|
+
body: string().max(2e3).optional()
|
|
9668
|
+
});
|
|
9669
|
+
var NameField = string().min(1).max(200);
|
|
9670
|
+
var DeviceIdsField = array(number()).min(1);
|
|
9671
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
9672
|
+
var FramerateField = number().int().min(1).max(60);
|
|
9673
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
9674
|
+
var PriorityField = number().int().min(1).max(5);
|
|
9675
|
+
/**
|
|
9676
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
9677
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
9678
|
+
* here (see the ownership note above).
|
|
9679
|
+
*/
|
|
9680
|
+
var TimelapseRuleInputSchema = object({
|
|
9681
|
+
name: NameField,
|
|
9682
|
+
enabled: boolean().default(true),
|
|
9683
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
9684
|
+
deviceIds: DeviceIdsField,
|
|
9685
|
+
/**
|
|
9686
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
9687
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
9688
|
+
* open clears the scratch, close assembles and delivers.
|
|
9689
|
+
*/
|
|
9690
|
+
schedule: NcScheduleSchema,
|
|
9691
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
9692
|
+
cadenceSec: CadenceSecField.default(15),
|
|
9693
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
9694
|
+
framerate: FramerateField.default(10),
|
|
9695
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
9696
|
+
targets: TargetsField,
|
|
9697
|
+
template: TimelapseTemplateSchema.optional(),
|
|
9698
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9699
|
+
priority: PriorityField.default(3)
|
|
9700
|
+
});
|
|
9701
|
+
object({
|
|
9702
|
+
name: NameField.optional(),
|
|
9703
|
+
enabled: boolean().optional(),
|
|
9704
|
+
deviceIds: DeviceIdsField.optional(),
|
|
9705
|
+
schedule: NcScheduleSchema.optional(),
|
|
9706
|
+
cadenceSec: CadenceSecField.optional(),
|
|
9707
|
+
framerate: FramerateField.optional(),
|
|
9708
|
+
targets: TargetsField.optional(),
|
|
9709
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
9710
|
+
priority: PriorityField.optional()
|
|
9711
|
+
});
|
|
9712
|
+
TimelapseRuleInputSchema.extend({
|
|
9713
|
+
id: string(),
|
|
9714
|
+
/**
|
|
9715
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
9716
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
9717
|
+
* resolved caller; never trusted from a client payload.
|
|
9718
|
+
*/
|
|
9719
|
+
ownerUserId: string().optional(),
|
|
9720
|
+
/**
|
|
9721
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
9722
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
9723
|
+
*/
|
|
9724
|
+
lastGeneratedAt: number().optional(),
|
|
9725
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
9726
|
+
createdBy: string(),
|
|
9727
|
+
createdAt: number(),
|
|
9728
|
+
updatedAt: number()
|
|
9729
|
+
});
|
|
9730
|
+
/**
|
|
9731
|
+
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
9732
|
+
* for every device, regardless of provider — the kernel needs a uniform
|
|
9733
|
+
* cap-keyed slice for the basic device flags every consumer expects to
|
|
9734
|
+
* read across processes (the `online` flag in particular). Driver-specific
|
|
9735
|
+
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
9736
|
+
* their own slices.
|
|
9737
|
+
*
|
|
9738
|
+
* Pattern is identical to `battery`: schema-bearing `runtimeState`,
|
|
9739
|
+
* empty `methods`, single change event. Reads land at
|
|
9740
|
+
* `runtimeState.getCapState('device-status')`; writes at
|
|
9741
|
+
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
9742
|
+
* consumers reach the same data via the `device-state` cap router
|
|
9743
|
+
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
9744
|
+
*/
|
|
9745
|
+
var DeviceStatusSchema = object({
|
|
9746
|
+
/**
|
|
9747
|
+
* Device-level liveness. Drivers flip via `markOnline(boolean)` on
|
|
9748
|
+
* `BaseDevice`. Provider semantics vary — RTSP aggregates broker
|
|
9749
|
+
* stream-health, Reolink reads firmware push events, ONVIF tracks
|
|
9750
|
+
* ping responses. This cap intentionally does NOT prescribe which
|
|
9751
|
+
* signal drives the flag.
|
|
9752
|
+
*/
|
|
9753
|
+
online: boolean(),
|
|
9754
|
+
/** Ms epoch of the last `online` transition. Lets consumers tell
|
|
9755
|
+
* apart "just came online" from "still online". */
|
|
9756
|
+
lastChangedAt: number()
|
|
9757
|
+
});
|
|
9758
|
+
object({
|
|
9759
|
+
deviceId: number(),
|
|
9760
|
+
status: DeviceStatusSchema
|
|
9761
|
+
});
|
|
9762
|
+
/**
|
|
9763
|
+
* Per-device feature/identity probe slice. Holds the runtime-resolved
|
|
9764
|
+
* truth about what a device CAN do — which the kernel uses to:
|
|
9765
|
+
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
9766
|
+
* based on what the firmware actually advertises).
|
|
9767
|
+
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
9768
|
+
* `device-manager.listAll`.
|
|
9769
|
+
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
9770
|
+
* to register on the device's capability surface.
|
|
9771
|
+
*
|
|
9772
|
+
* Auto-registered by `BaseDevice` for every device. Drivers populate the
|
|
9773
|
+
* slice from `onProbe()` (kernel calls it once after register, before
|
|
9774
|
+
* accessory reconciliation). Consumers read via:
|
|
9775
|
+
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
9776
|
+
*
|
|
9777
|
+
* `flags` is an open record so each driver carries its own keys without
|
|
9778
|
+
* a centralized schema bottleneck — Reolink writes `hasPtz/hasIntercom`,
|
|
9779
|
+
* Hikvision writes `hasSupplementalLight/hasAlarmIo`, etc.
|
|
9780
|
+
*
|
|
9781
|
+
* Replaces the older driver-local `deviceCache.has*` blob: the per-device
|
|
9782
|
+
* config is for operator-edited overrides + UI snapshots; runtime probe
|
|
9783
|
+
* results belong in runtime-state where the kernel handles persistence,
|
|
9784
|
+
* cross-process mirroring, and reactive updates.
|
|
9785
|
+
*/
|
|
9786
|
+
var FeatureProbeStatusSchema = object({
|
|
9787
|
+
/**
|
|
9788
|
+
* Driver-specific flag bag. Each driver picks its own key names — the
|
|
9789
|
+
* cap deliberately does NOT enforce a closed enum here. Reolink keys:
|
|
9790
|
+
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
9791
|
+
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
9792
|
+
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9793
|
+
*/
|
|
9794
|
+
flags: record(string(), unknown()),
|
|
9795
|
+
/**
|
|
9796
|
+
* Coarse driver-classification — lets cross-process consumers tell apart
|
|
9797
|
+
* cameras / battery-cams / NVRs without re-running the probe. `null`
|
|
9798
|
+
* before the first probe completes.
|
|
9799
|
+
*/
|
|
9800
|
+
deviceType: string().nullable(),
|
|
9801
|
+
/** Camera/firmware model string. `null` when the firmware doesn't expose it. */
|
|
9802
|
+
model: string().nullable(),
|
|
9803
|
+
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
9804
|
+
channelCount: number().nullable(),
|
|
9805
|
+
/**
|
|
9806
|
+
* Ms epoch of the last SUCCESSFUL probe. `0` before the first probe
|
|
9807
|
+
* completes — drivers' `getAccessoryChildren()` should treat zero as
|
|
9808
|
+
* "probe not done yet, return empty" so accessories aren't spawned
|
|
9809
|
+
* before the firmware is queried.
|
|
9810
|
+
*/
|
|
9811
|
+
lastProbedAt: number(),
|
|
9812
|
+
/**
|
|
9813
|
+
* Framework convention: every runtime-state slice carries this for the
|
|
9814
|
+
* createRuntimeStateBridge stale-check helper. We keep it in sync with
|
|
9815
|
+
* `lastProbedAt` on every write.
|
|
9816
|
+
*/
|
|
9172
9817
|
lastFetchedAt: number()
|
|
9173
9818
|
});
|
|
9174
9819
|
object({
|
|
@@ -12026,101 +12671,40 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
12026
12671
|
}), object({ details: array(DetailResultSchema) }).nullable(), { kind: "mutation" });
|
|
12027
12672
|
object({
|
|
12028
12673
|
detected: boolean(),
|
|
12029
|
-
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
12030
|
-
lastDetectedAt: number().nullable(),
|
|
12031
|
-
/**
|
|
12032
|
-
* Ms after which `detected` auto-reverts to false if no fresh push
|
|
12033
|
-
* arrives. Null means the provider leaves detected state until a
|
|
12034
|
-
* native "clear" event.
|
|
12035
|
-
*/
|
|
12036
|
-
autoClearAfterMs: number().nullable()
|
|
12037
|
-
});
|
|
12038
|
-
object({
|
|
12039
|
-
deviceId: number(),
|
|
12040
|
-
detected: boolean(),
|
|
12041
|
-
timestamp: number(),
|
|
12042
|
-
source: MotionSourceEnum,
|
|
12043
|
-
regions: array(MotionRegionSchema).readonly().optional()
|
|
12044
|
-
});
|
|
12045
|
-
DeviceType.Camera, DeviceType.Sensor, method(object({ deviceId: number() }), boolean());
|
|
12046
|
-
object({
|
|
12047
|
-
enabled: boolean(),
|
|
12048
|
-
/** Ms epoch of the last operator-driven change. */
|
|
12049
|
-
lastChangedAt: number()
|
|
12050
|
-
}).extend({
|
|
12051
|
-
/** Ms epoch of the last successful camera fetch (0 = never). */
|
|
12052
|
-
lastFetchedAt: number() });
|
|
12053
|
-
DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
12054
|
-
deviceId: number().int().nonnegative(),
|
|
12055
|
-
enabled: boolean()
|
|
12056
|
-
}), _void(), {
|
|
12057
|
-
kind: "mutation",
|
|
12058
|
-
auth: "admin"
|
|
12059
|
-
}), object({
|
|
12060
|
-
deviceId: number(),
|
|
12061
|
-
enabled: boolean(),
|
|
12062
|
-
lastChangedAt: number()
|
|
12063
|
-
});
|
|
12064
|
-
/**
|
|
12065
|
-
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
12066
|
-
* motion-zones, and the detection zones/lines editor all speak this one
|
|
12067
|
-
* language so a single drawing-plane editor and the providers stay
|
|
12068
|
-
* decoupled from each cap's storage.
|
|
12069
|
-
*
|
|
12070
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
12071
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
12072
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
12073
|
-
*/
|
|
12074
|
-
/** A normalized 0..1 point (top-left origin). */
|
|
12075
|
-
var MaskPointSchema = object({
|
|
12076
|
-
x: number(),
|
|
12077
|
-
y: number()
|
|
12078
|
-
});
|
|
12079
|
-
/** Axis-aligned rectangle (normalized 0..1). */
|
|
12080
|
-
var MaskRectShapeSchema = object({
|
|
12081
|
-
kind: literal("rect"),
|
|
12082
|
-
x: number(),
|
|
12083
|
-
y: number(),
|
|
12084
|
-
width: number(),
|
|
12085
|
-
height: number()
|
|
12086
|
-
});
|
|
12087
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
12088
|
-
var MaskPolygonShapeSchema = object({
|
|
12089
|
-
kind: literal("polygon"),
|
|
12090
|
-
points: array(MaskPointSchema)
|
|
12091
|
-
});
|
|
12092
|
-
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
12093
|
-
var MaskGridShapeSchema = object({
|
|
12094
|
-
kind: literal("grid"),
|
|
12095
|
-
gridWidth: number(),
|
|
12096
|
-
gridHeight: number(),
|
|
12097
|
-
cells: array(boolean())
|
|
12098
|
-
});
|
|
12099
|
-
discriminatedUnion("kind", [
|
|
12100
|
-
MaskRectShapeSchema,
|
|
12101
|
-
MaskPolygonShapeSchema,
|
|
12102
|
-
MaskGridShapeSchema,
|
|
12103
|
-
object({
|
|
12104
|
-
kind: literal("line"),
|
|
12105
|
-
points: array(MaskPointSchema)
|
|
12106
|
-
})
|
|
12107
|
-
]);
|
|
12108
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
12109
|
-
var MaskShapeKindSchema = _enum([
|
|
12110
|
-
"rect",
|
|
12111
|
-
"polygon",
|
|
12112
|
-
"grid",
|
|
12113
|
-
"line"
|
|
12114
|
-
]);
|
|
12115
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
12116
|
-
var MaskPolygonVerticesSchema = object({
|
|
12117
|
-
min: number(),
|
|
12118
|
-
max: number()
|
|
12674
|
+
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
12675
|
+
lastDetectedAt: number().nullable(),
|
|
12676
|
+
/**
|
|
12677
|
+
* Ms after which `detected` auto-reverts to false if no fresh push
|
|
12678
|
+
* arrives. Null means the provider leaves detected state until a
|
|
12679
|
+
* native "clear" event.
|
|
12680
|
+
*/
|
|
12681
|
+
autoClearAfterMs: number().nullable()
|
|
12119
12682
|
});
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
|
|
12123
|
-
|
|
12683
|
+
object({
|
|
12684
|
+
deviceId: number(),
|
|
12685
|
+
detected: boolean(),
|
|
12686
|
+
timestamp: number(),
|
|
12687
|
+
source: MotionSourceEnum,
|
|
12688
|
+
regions: array(MotionRegionSchema).readonly().optional()
|
|
12689
|
+
});
|
|
12690
|
+
DeviceType.Camera, DeviceType.Sensor, method(object({ deviceId: number() }), boolean());
|
|
12691
|
+
object({
|
|
12692
|
+
enabled: boolean(),
|
|
12693
|
+
/** Ms epoch of the last operator-driven change. */
|
|
12694
|
+
lastChangedAt: number()
|
|
12695
|
+
}).extend({
|
|
12696
|
+
/** Ms epoch of the last successful camera fetch (0 = never). */
|
|
12697
|
+
lastFetchedAt: number() });
|
|
12698
|
+
DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
12699
|
+
deviceId: number().int().nonnegative(),
|
|
12700
|
+
enabled: boolean()
|
|
12701
|
+
}), _void(), {
|
|
12702
|
+
kind: "mutation",
|
|
12703
|
+
auth: "admin"
|
|
12704
|
+
}), object({
|
|
12705
|
+
deviceId: number(),
|
|
12706
|
+
enabled: boolean(),
|
|
12707
|
+
lastChangedAt: number()
|
|
12124
12708
|
});
|
|
12125
12709
|
/**
|
|
12126
12710
|
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
@@ -14010,6 +14594,55 @@ method(object({
|
|
|
14010
14594
|
password: string()
|
|
14011
14595
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
14012
14596
|
/**
|
|
14597
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
14598
|
+
* NOT flow through the capability — they use the addon data plane
|
|
14599
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
14600
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
14601
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
14602
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
14603
|
+
*/
|
|
14604
|
+
var TerminalSessionInfoSchema = object({
|
|
14605
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
14606
|
+
sessionId: string(),
|
|
14607
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
14608
|
+
profileId: string(),
|
|
14609
|
+
/** Human-readable profile label for the UI session list. */
|
|
14610
|
+
label: string(),
|
|
14611
|
+
cols: number().int().positive(),
|
|
14612
|
+
rows: number().int().positive(),
|
|
14613
|
+
/** ms-epoch the session's pty was spawned. */
|
|
14614
|
+
startedAt: number()
|
|
14615
|
+
});
|
|
14616
|
+
/**
|
|
14617
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
14618
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
14619
|
+
* command string would be remote code execution as the server's user, so it is
|
|
14620
|
+
* deliberately not part of the contract.
|
|
14621
|
+
*/
|
|
14622
|
+
var TerminalProfileInfoSchema = object({
|
|
14623
|
+
profileId: string(),
|
|
14624
|
+
label: string(),
|
|
14625
|
+
description: string().optional()
|
|
14626
|
+
});
|
|
14627
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
14628
|
+
profileId: string(),
|
|
14629
|
+
cols: number().int().positive(),
|
|
14630
|
+
rows: number().int().positive()
|
|
14631
|
+
}), TerminalSessionInfoSchema, {
|
|
14632
|
+
kind: "mutation",
|
|
14633
|
+
auth: "admin"
|
|
14634
|
+
}), method(object({
|
|
14635
|
+
sessionId: string(),
|
|
14636
|
+
cols: number().int().positive(),
|
|
14637
|
+
rows: number().int().positive()
|
|
14638
|
+
}), _void(), {
|
|
14639
|
+
kind: "mutation",
|
|
14640
|
+
auth: "admin"
|
|
14641
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
14642
|
+
kind: "mutation",
|
|
14643
|
+
auth: "admin"
|
|
14644
|
+
});
|
|
14645
|
+
/**
|
|
14013
14646
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
14014
14647
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
14015
14648
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -14110,11 +14743,53 @@ var LocationStatSchema = object({
|
|
|
14110
14743
|
fileCount: number(),
|
|
14111
14744
|
present: boolean()
|
|
14112
14745
|
});
|
|
14746
|
+
/**
|
|
14747
|
+
* A backup schedule — the N:M "entry" that binds one cron cadence to a
|
|
14748
|
+
* SET of destination locations. Supersedes the per-location cron on
|
|
14749
|
+
* `BackupDestinationPolicy`: an operator creates a schedule, picks the
|
|
14750
|
+
* `backups` locations it should write to, and the orchestrator fans a
|
|
14751
|
+
* single archive out to all of them when the cron fires.
|
|
14752
|
+
*
|
|
14753
|
+
* `retentionCount` is per-schedule (D-decision 2026-07-28): every
|
|
14754
|
+
* location targeted by this schedule keeps this many archives from
|
|
14755
|
+
* this schedule's runs.
|
|
14756
|
+
*
|
|
14757
|
+
* `dataSources` optionally narrows which top-level state locations
|
|
14758
|
+
* (db, addons, tls, …) are archived; omitted = the orchestrator's
|
|
14759
|
+
* default full set.
|
|
14760
|
+
*/
|
|
14761
|
+
var BackupScheduleSchema = object({
|
|
14762
|
+
/** Stable id. Generated by the orchestrator on first upsert if absent. */
|
|
14763
|
+
id: string(),
|
|
14764
|
+
/** Operator-facing display name. */
|
|
14765
|
+
label: string(),
|
|
14766
|
+
/** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
|
|
14767
|
+
cron: string(),
|
|
14768
|
+
/** Master on/off toggle for the whole schedule. */
|
|
14769
|
+
enabled: boolean(),
|
|
14770
|
+
/** `backups`-location ids this schedule writes to (fan-out set). */
|
|
14771
|
+
locationIds: array(string()).readonly(),
|
|
14772
|
+
/** Archives kept per targeted location for this schedule. */
|
|
14773
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14774
|
+
/** Optional subset of source locations to include; omitted = all. */
|
|
14775
|
+
dataSources: array(string()).readonly().optional(),
|
|
14776
|
+
/** ms-epoch of last successful run. */
|
|
14777
|
+
lastRunAt: number().optional(),
|
|
14778
|
+
/** ms-epoch of next computed firing (read-only, filled on list). */
|
|
14779
|
+
nextRunAt: number().optional()
|
|
14780
|
+
});
|
|
14113
14781
|
method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
14114
14782
|
/** Subset of registered `backup-destination` addon ids to write to. */
|
|
14115
14783
|
destinations: array(string()).optional(),
|
|
14116
14784
|
locations: array(string()).optional(),
|
|
14117
|
-
label: string().optional()
|
|
14785
|
+
label: string().optional(),
|
|
14786
|
+
/**
|
|
14787
|
+
* Per-run retention override applied to every targeted
|
|
14788
|
+
* destination. Used by schedule-driven runs (per-entry
|
|
14789
|
+
* retention). Omitted = each destination's own policy
|
|
14790
|
+
* retention (manual runs).
|
|
14791
|
+
*/
|
|
14792
|
+
retentionCount: number().int().min(1).max(1e3).optional()
|
|
14118
14793
|
}).optional(), array(BackupEntrySchema).readonly(), {
|
|
14119
14794
|
kind: "mutation",
|
|
14120
14795
|
auth: "admin"
|
|
@@ -14163,7 +14838,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
14163
14838
|
ok: boolean(),
|
|
14164
14839
|
error: string().optional(),
|
|
14165
14840
|
nextRuns: array(number()).readonly()
|
|
14166
|
-
}))
|
|
14841
|
+
})), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
|
|
14842
|
+
id: string().optional(),
|
|
14843
|
+
label: string(),
|
|
14844
|
+
cron: string(),
|
|
14845
|
+
enabled: boolean(),
|
|
14846
|
+
locationIds: array(string()).readonly(),
|
|
14847
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14848
|
+
dataSources: array(string()).readonly().optional()
|
|
14849
|
+
}), BackupScheduleSchema, {
|
|
14850
|
+
kind: "mutation",
|
|
14851
|
+
auth: "admin"
|
|
14852
|
+
}), method(object({ id: string() }), _void(), {
|
|
14853
|
+
kind: "mutation",
|
|
14854
|
+
auth: "admin"
|
|
14855
|
+
});
|
|
14167
14856
|
/**
|
|
14168
14857
|
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
14169
14858
|
*
|
|
@@ -15226,1596 +15915,1108 @@ method(object({
|
|
|
15226
15915
|
active: boolean()
|
|
15227
15916
|
}), _void(), {
|
|
15228
15917
|
kind: "mutation",
|
|
15229
|
-
auth: "admin"
|
|
15230
|
-
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
15231
|
-
capName: string(),
|
|
15232
|
-
wrappers: array(string())
|
|
15233
|
-
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
15234
|
-
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
15235
|
-
live: SettingsSchemaWithValuesSchema.nullable()
|
|
15236
|
-
})), method(object({
|
|
15237
|
-
deviceId: number().int().nonnegative(),
|
|
15238
|
-
action: string().min(1),
|
|
15239
|
-
input: unknown()
|
|
15240
|
-
}), unknown(), { kind: "mutation" }), method(object({
|
|
15241
|
-
deviceId: number(),
|
|
15242
|
-
writerCapName: string(),
|
|
15243
|
-
writerAddonId: string(),
|
|
15244
|
-
key: string(),
|
|
15245
|
-
value: unknown()
|
|
15246
|
-
}), object({ success: literal(true) }), {
|
|
15247
|
-
kind: "mutation",
|
|
15248
|
-
auth: "admin"
|
|
15249
|
-
}), method(object({
|
|
15250
|
-
deviceId: number(),
|
|
15251
|
-
changes: array(object({
|
|
15252
|
-
writerCapName: string(),
|
|
15253
|
-
writerAddonId: string(),
|
|
15254
|
-
key: string(),
|
|
15255
|
-
value: unknown()
|
|
15256
|
-
}))
|
|
15257
|
-
}), object({
|
|
15258
|
-
success: literal(true),
|
|
15259
|
-
failures: array(object({
|
|
15260
|
-
writerCapName: string(),
|
|
15261
|
-
writerAddonId: string(),
|
|
15262
|
-
error: string()
|
|
15263
|
-
}))
|
|
15264
|
-
}), {
|
|
15265
|
-
kind: "mutation",
|
|
15266
|
-
auth: "admin"
|
|
15267
|
-
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
15268
|
-
kind: "mutation",
|
|
15269
|
-
auth: "admin"
|
|
15270
|
-
}), method(object({
|
|
15271
|
-
addonId: string(),
|
|
15272
|
-
candidate: DiscoveryCandidateSchema,
|
|
15273
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
15274
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15275
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15276
|
-
integrationId: string().optional()
|
|
15277
|
-
}), DeviceSummarySchema, {
|
|
15278
|
-
kind: "mutation",
|
|
15279
|
-
auth: "admin"
|
|
15280
|
-
}), method(object({
|
|
15281
|
-
addonId: string(),
|
|
15282
|
-
type: _enum(DeviceType)
|
|
15283
|
-
}), unknown().nullable()), method(object({
|
|
15284
|
-
addonId: string(),
|
|
15285
|
-
type: _enum(DeviceType),
|
|
15286
|
-
config: record(string(), unknown()),
|
|
15287
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
15288
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15289
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15290
|
-
integrationId: string().optional()
|
|
15291
|
-
}), DeviceSummarySchema, {
|
|
15292
|
-
kind: "mutation",
|
|
15293
|
-
auth: "admin"
|
|
15294
|
-
}), method(object({
|
|
15295
|
-
addonId: string(),
|
|
15296
|
-
type: _enum(DeviceType),
|
|
15297
|
-
key: string(),
|
|
15298
|
-
value: unknown(),
|
|
15299
|
-
formValues: record(string(), unknown()).optional()
|
|
15300
|
-
}), FieldProbeResultSchema, {
|
|
15301
|
-
kind: "mutation",
|
|
15302
|
-
auth: "admin"
|
|
15303
|
-
}), method(object({
|
|
15304
|
-
addonId: string(),
|
|
15305
|
-
integrationId: string()
|
|
15306
|
-
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
15307
|
-
addonId: string(),
|
|
15308
|
-
integrationId: string()
|
|
15309
|
-
}), AdoptionStatusSchema, {
|
|
15310
|
-
kind: "mutation",
|
|
15311
|
-
auth: "admin"
|
|
15312
|
-
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
15313
|
-
kind: "mutation",
|
|
15314
|
-
auth: "admin"
|
|
15315
|
-
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
15316
|
-
kind: "mutation",
|
|
15317
|
-
auth: "admin"
|
|
15318
|
-
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
15319
|
-
kind: "mutation",
|
|
15320
|
-
auth: "admin"
|
|
15321
|
-
}), method(object({}), object({ providers: array(object({
|
|
15322
|
-
addonId: string(),
|
|
15323
|
-
label: string()
|
|
15324
|
-
})).readonly() }), { auth: "admin" }), method(object({}), object({ groups: array(object({
|
|
15325
|
-
addonId: string(),
|
|
15326
|
-
label: string(),
|
|
15327
|
-
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
15328
|
-
error: string().nullable()
|
|
15329
|
-
})).readonly() }), {
|
|
15330
|
-
kind: "mutation",
|
|
15331
|
-
auth: "admin"
|
|
15332
|
-
}), method(object({
|
|
15333
|
-
addonId: string(),
|
|
15334
|
-
params: record(string(), unknown()).optional()
|
|
15335
|
-
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
15336
|
-
kind: "mutation",
|
|
15337
|
-
auth: "admin"
|
|
15338
|
-
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
15339
|
-
deviceId: number(),
|
|
15340
|
-
key: string(),
|
|
15341
|
-
value: unknown()
|
|
15342
|
-
}), FieldProbeResultSchema, {
|
|
15343
|
-
kind: "mutation",
|
|
15344
|
-
auth: "admin"
|
|
15345
|
-
}), method(object({
|
|
15346
|
-
deviceId: number(),
|
|
15347
|
-
caps: array(string()).readonly().optional()
|
|
15348
|
-
}), record(string(), unknown().nullable()));
|
|
15349
|
-
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
15350
|
-
deviceId: number(),
|
|
15351
|
-
capName: string()
|
|
15352
|
-
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
15353
|
-
deviceId: number(),
|
|
15354
|
-
capName: string(),
|
|
15355
|
-
slice: record(string(), unknown())
|
|
15356
|
-
}), _void(), { kind: "mutation" }), object({
|
|
15357
|
-
deviceId: number(),
|
|
15358
|
-
capName: string(),
|
|
15359
|
-
slice: record(string(), unknown())
|
|
15360
|
-
});
|
|
15361
|
-
/**
|
|
15362
|
-
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
15363
|
-
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
15364
|
-
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
15365
|
-
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
15366
|
-
* post-analysis enrichment-engine.
|
|
15367
|
-
*/
|
|
15368
|
-
var EmbeddingResultSchema = object({
|
|
15369
|
-
embedding: array(number()),
|
|
15370
|
-
inferenceMs: number()
|
|
15371
|
-
});
|
|
15372
|
-
var EmbeddingInfoSchema = object({
|
|
15373
|
-
modelId: string(),
|
|
15374
|
-
embeddingDim: number(),
|
|
15375
|
-
ready: boolean()
|
|
15376
|
-
});
|
|
15377
|
-
method(object({
|
|
15378
|
-
crop: _instanceof(Uint8Array),
|
|
15379
|
-
width: number(),
|
|
15380
|
-
height: number()
|
|
15381
|
-
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
15382
|
-
/**
|
|
15383
|
-
* filesystem-browse — per-node capability for browsing the node's local
|
|
15384
|
-
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
15385
|
-
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
15386
|
-
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
15387
|
-
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
15388
|
-
*/
|
|
15389
|
-
var DirEntrySchema = object({
|
|
15390
|
-
name: string(),
|
|
15391
|
-
path: string()
|
|
15392
|
-
});
|
|
15393
|
-
var BrowseResultSchema = object({
|
|
15394
|
-
path: string(),
|
|
15395
|
-
entries: array(DirEntrySchema).readonly(),
|
|
15396
|
-
freeBytes: number(),
|
|
15397
|
-
totalBytes: number()
|
|
15398
|
-
});
|
|
15399
|
-
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
15918
|
+
auth: "admin"
|
|
15919
|
+
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
15920
|
+
capName: string(),
|
|
15921
|
+
wrappers: array(string())
|
|
15922
|
+
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
15923
|
+
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
15924
|
+
live: SettingsSchemaWithValuesSchema.nullable()
|
|
15925
|
+
})), method(object({
|
|
15926
|
+
deviceId: number().int().nonnegative(),
|
|
15927
|
+
action: string().min(1),
|
|
15928
|
+
input: unknown()
|
|
15929
|
+
}), unknown(), { kind: "mutation" }), method(object({
|
|
15930
|
+
deviceId: number(),
|
|
15931
|
+
writerCapName: string(),
|
|
15932
|
+
writerAddonId: string(),
|
|
15933
|
+
key: string(),
|
|
15934
|
+
value: unknown()
|
|
15935
|
+
}), object({ success: literal(true) }), {
|
|
15400
15936
|
kind: "mutation",
|
|
15401
15937
|
auth: "admin"
|
|
15402
|
-
})
|
|
15403
|
-
|
|
15404
|
-
|
|
15405
|
-
|
|
15406
|
-
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
|
|
15410
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15411
|
-
*/
|
|
15412
|
-
var LlmUsageSchema = object({
|
|
15413
|
-
inputTokens: number(),
|
|
15414
|
-
outputTokens: number()
|
|
15415
|
-
});
|
|
15416
|
-
var LlmErrorCodeSchema = _enum([
|
|
15417
|
-
"timeout",
|
|
15418
|
-
"rate-limited",
|
|
15419
|
-
"auth",
|
|
15420
|
-
"refusal",
|
|
15421
|
-
"bad-request",
|
|
15422
|
-
"unavailable",
|
|
15423
|
-
"no-profile",
|
|
15424
|
-
"budget-exceeded",
|
|
15425
|
-
"adapter-error"
|
|
15426
|
-
]);
|
|
15427
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15428
|
-
ok: literal(true),
|
|
15429
|
-
text: string(),
|
|
15430
|
-
model: string(),
|
|
15431
|
-
usage: LlmUsageSchema,
|
|
15432
|
-
truncated: boolean(),
|
|
15433
|
-
latencyMs: number()
|
|
15938
|
+
}), method(object({
|
|
15939
|
+
deviceId: number(),
|
|
15940
|
+
changes: array(object({
|
|
15941
|
+
writerCapName: string(),
|
|
15942
|
+
writerAddonId: string(),
|
|
15943
|
+
key: string(),
|
|
15944
|
+
value: unknown()
|
|
15945
|
+
}))
|
|
15434
15946
|
}), object({
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15443
|
-
* notification-output.cap.ts:27-31 precedents).
|
|
15444
|
-
*/
|
|
15445
|
-
var LlmImageSchema = object({
|
|
15446
|
-
bytes: _instanceof(Uint8Array),
|
|
15447
|
-
mimeType: string()
|
|
15448
|
-
});
|
|
15449
|
-
var LlmGenerateBaseInputSchema = object({
|
|
15450
|
-
/** Collection routing (the notification-output posture). */
|
|
15451
|
-
addonId: string().optional(),
|
|
15452
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15453
|
-
profileId: string().optional(),
|
|
15454
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15455
|
-
consumer: string(),
|
|
15456
|
-
system: string().optional(),
|
|
15457
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15458
|
-
prompt: string(),
|
|
15459
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15460
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
15461
|
-
/** Per-call override of the profile default. */
|
|
15462
|
-
maxTokens: number().int().positive().optional(),
|
|
15463
|
-
temperature: number().optional()
|
|
15464
|
-
});
|
|
15465
|
-
/**
|
|
15466
|
-
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15467
|
-
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15468
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15469
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15470
|
-
* this only through the `llm` cap's methods.
|
|
15471
|
-
*
|
|
15472
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15473
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15474
|
-
* watchdog — operator decision #3).
|
|
15475
|
-
*/
|
|
15476
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15477
|
-
object({
|
|
15478
|
-
kind: literal("catalog"),
|
|
15479
|
-
catalogId: string()
|
|
15480
|
-
}),
|
|
15481
|
-
object({
|
|
15482
|
-
kind: literal("url"),
|
|
15483
|
-
url: string(),
|
|
15484
|
-
sha256: string().optional()
|
|
15485
|
-
}),
|
|
15486
|
-
object({
|
|
15487
|
-
kind: literal("path"),
|
|
15488
|
-
path: string()
|
|
15489
|
-
})
|
|
15490
|
-
]);
|
|
15491
|
-
var ManagedRuntimeConfigSchema = object({
|
|
15492
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
15493
|
-
nodeId: string(),
|
|
15494
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15495
|
-
engine: _enum(["llama-cpp"]),
|
|
15496
|
-
model: ManagedModelRefSchema,
|
|
15497
|
-
contextSize: number().int().default(4096),
|
|
15498
|
-
/** 0 = CPU-only. */
|
|
15499
|
-
gpuLayers: number().int().default(0),
|
|
15500
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15501
|
-
threads: number().int().optional(),
|
|
15502
|
-
/** Concurrent slots. */
|
|
15503
|
-
parallel: number().int().default(1),
|
|
15504
|
-
/** Else lazy: first generate boots it. */
|
|
15505
|
-
autoStart: boolean().default(false),
|
|
15506
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
15507
|
-
idleStopMinutes: number().int().default(30)
|
|
15508
|
-
});
|
|
15509
|
-
var LlmRuntimeStatusSchema = object({
|
|
15510
|
-
/** Status is ALWAYS node-qualified. */
|
|
15511
|
-
nodeId: string(),
|
|
15512
|
-
state: _enum([
|
|
15513
|
-
"stopped",
|
|
15514
|
-
"downloading",
|
|
15515
|
-
"starting",
|
|
15516
|
-
"ready",
|
|
15517
|
-
"crashed",
|
|
15518
|
-
"failed"
|
|
15519
|
-
]),
|
|
15520
|
-
pid: number().optional(),
|
|
15521
|
-
port: number().optional(),
|
|
15522
|
-
modelPath: string().optional(),
|
|
15523
|
-
modelId: string().optional(),
|
|
15524
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
15525
|
-
lastError: string().optional(),
|
|
15526
|
-
crashesInWindow: number(),
|
|
15527
|
-
/** Child RSS (sampled best-effort). */
|
|
15528
|
-
memoryBytes: number().optional(),
|
|
15529
|
-
vramBytes: number().optional()
|
|
15530
|
-
});
|
|
15531
|
-
var LlmNodeModelSchema = object({
|
|
15532
|
-
file: string(),
|
|
15533
|
-
sizeBytes: number(),
|
|
15534
|
-
catalogId: string().optional(),
|
|
15535
|
-
installedAt: number().optional()
|
|
15536
|
-
});
|
|
15537
|
-
var LlmRuntimeDiskUsageSchema = object({
|
|
15538
|
-
nodeId: string(),
|
|
15539
|
-
modelsBytes: number(),
|
|
15540
|
-
freeBytes: number().optional()
|
|
15541
|
-
});
|
|
15542
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
15543
|
-
images: array(LlmImageSchema).optional(),
|
|
15544
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
15545
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15546
|
-
timeoutMs: number().int().positive().optional()
|
|
15547
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15947
|
+
success: literal(true),
|
|
15948
|
+
failures: array(object({
|
|
15949
|
+
writerCapName: string(),
|
|
15950
|
+
writerAddonId: string(),
|
|
15951
|
+
error: string()
|
|
15952
|
+
}))
|
|
15953
|
+
}), {
|
|
15548
15954
|
kind: "mutation",
|
|
15549
15955
|
auth: "admin"
|
|
15550
|
-
}), method(object({}),
|
|
15956
|
+
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
15551
15957
|
kind: "mutation",
|
|
15552
15958
|
auth: "admin"
|
|
15553
|
-
}), method(object({
|
|
15959
|
+
}), method(object({
|
|
15960
|
+
addonId: string(),
|
|
15961
|
+
candidate: DiscoveryCandidateSchema,
|
|
15962
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
15963
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15964
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15965
|
+
integrationId: string().optional()
|
|
15966
|
+
}), DeviceSummarySchema, {
|
|
15554
15967
|
kind: "mutation",
|
|
15555
15968
|
auth: "admin"
|
|
15556
|
-
}), method(object({
|
|
15969
|
+
}), method(object({
|
|
15970
|
+
addonId: string(),
|
|
15971
|
+
type: _enum(DeviceType)
|
|
15972
|
+
}), unknown().nullable()), method(object({
|
|
15973
|
+
addonId: string(),
|
|
15974
|
+
type: _enum(DeviceType),
|
|
15975
|
+
config: record(string(), unknown()),
|
|
15976
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
15977
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15978
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15979
|
+
integrationId: string().optional()
|
|
15980
|
+
}), DeviceSummarySchema, {
|
|
15557
15981
|
kind: "mutation",
|
|
15558
15982
|
auth: "admin"
|
|
15559
|
-
}), method(object({
|
|
15560
|
-
/**
|
|
15561
|
-
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
15562
|
-
* methods concat-fan across providers; single-row methods route to ONE
|
|
15563
|
-
* provider by the `addonId` in the call input (the notification-output
|
|
15564
|
-
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15565
|
-
* (hub-placed); the cap stays open for future providers.
|
|
15566
|
-
*
|
|
15567
|
-
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15568
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15569
|
-
* write; a stored key NEVER round-trips to a client.
|
|
15570
|
-
*/
|
|
15571
|
-
var LlmProfileKindSchema = _enum([
|
|
15572
|
-
"openai-compatible",
|
|
15573
|
-
"openai",
|
|
15574
|
-
"anthropic",
|
|
15575
|
-
"google",
|
|
15576
|
-
"managed-local"
|
|
15577
|
-
]);
|
|
15578
|
-
var LlmProfileSchema = object({
|
|
15579
|
-
id: string(),
|
|
15580
|
-
name: string(),
|
|
15581
|
-
kind: LlmProfileKindSchema,
|
|
15582
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
15983
|
+
}), method(object({
|
|
15583
15984
|
addonId: string(),
|
|
15584
|
-
|
|
15585
|
-
|
|
15586
|
-
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
temperature: number().min(0).max(2).optional(),
|
|
15593
|
-
maxTokens: number().int().positive().optional(),
|
|
15594
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
15595
|
-
extraHeaders: record(string(), string()).optional(),
|
|
15596
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
15597
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15598
|
-
});
|
|
15599
|
-
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
15600
|
-
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
15601
|
-
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
15602
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
15603
|
-
var LlmProfileKindDescriptorSchema = object({
|
|
15604
|
-
kind: LlmProfileKindSchema,
|
|
15605
|
-
label: string(),
|
|
15606
|
-
icon: string(),
|
|
15607
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15985
|
+
type: _enum(DeviceType),
|
|
15986
|
+
key: string(),
|
|
15987
|
+
value: unknown(),
|
|
15988
|
+
formValues: record(string(), unknown()).optional()
|
|
15989
|
+
}), FieldProbeResultSchema, {
|
|
15990
|
+
kind: "mutation",
|
|
15991
|
+
auth: "admin"
|
|
15992
|
+
}), method(object({
|
|
15608
15993
|
addonId: string(),
|
|
15609
|
-
|
|
15610
|
-
})
|
|
15611
|
-
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
15612
|
-
var LlmDefaultSchema = object({
|
|
15613
|
-
selector: LlmDefaultSelectorSchema,
|
|
15614
|
-
profileId: string()
|
|
15615
|
-
});
|
|
15616
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
15617
|
-
var LlmUsageRollupSchema = object({
|
|
15618
|
-
day: string(),
|
|
15619
|
-
consumer: string(),
|
|
15620
|
-
profileId: string(),
|
|
15621
|
-
calls: number(),
|
|
15622
|
-
okCalls: number(),
|
|
15623
|
-
errorCalls: number(),
|
|
15624
|
-
inputTokens: number(),
|
|
15625
|
-
outputTokens: number(),
|
|
15626
|
-
avgLatencyMs: number()
|
|
15627
|
-
});
|
|
15628
|
-
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
15629
|
-
var ManagedModelCatalogEntrySchema = object({
|
|
15630
|
-
id: string(),
|
|
15631
|
-
label: string(),
|
|
15632
|
-
family: string(),
|
|
15633
|
-
purpose: _enum(["text", "vision"]),
|
|
15634
|
-
url: string(),
|
|
15635
|
-
sha256: string(),
|
|
15636
|
-
sizeBytes: number(),
|
|
15637
|
-
quantization: string(),
|
|
15638
|
-
/** Load-time guidance shown in the picker. */
|
|
15639
|
-
minRamBytes: number(),
|
|
15640
|
-
contextSizeDefault: number().int(),
|
|
15641
|
-
/** Vision models: companion projector file. */
|
|
15642
|
-
mmprojUrl: string().optional()
|
|
15643
|
-
});
|
|
15644
|
-
var LlmRuntimeNodeSchema = object({
|
|
15645
|
-
nodeId: string(),
|
|
15646
|
-
reachable: boolean(),
|
|
15647
|
-
status: LlmRuntimeStatusSchema.optional(),
|
|
15648
|
-
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15649
|
-
error: string().optional()
|
|
15650
|
-
});
|
|
15651
|
-
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
15652
|
-
var ProfileRefInputSchema = object({
|
|
15994
|
+
integrationId: string()
|
|
15995
|
+
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
15653
15996
|
addonId: string(),
|
|
15654
|
-
|
|
15655
|
-
})
|
|
15656
|
-
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
15997
|
+
integrationId: string()
|
|
15998
|
+
}), AdoptionStatusSchema, {
|
|
15657
15999
|
kind: "mutation",
|
|
15658
16000
|
auth: "admin"
|
|
15659
|
-
}), method(
|
|
16001
|
+
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
15660
16002
|
kind: "mutation",
|
|
15661
16003
|
auth: "admin"
|
|
15662
|
-
}), method(
|
|
16004
|
+
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
15663
16005
|
kind: "mutation",
|
|
15664
16006
|
auth: "admin"
|
|
15665
|
-
}), method(
|
|
15666
|
-
selector: LlmDefaultSelectorSchema,
|
|
15667
|
-
profileId: string().nullable()
|
|
15668
|
-
}), _void(), {
|
|
16007
|
+
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
15669
16008
|
kind: "mutation",
|
|
15670
16009
|
auth: "admin"
|
|
15671
|
-
}), method(object({
|
|
15672
|
-
|
|
15673
|
-
|
|
15674
|
-
|
|
15675
|
-
|
|
15676
|
-
|
|
15677
|
-
|
|
15678
|
-
|
|
15679
|
-
})
|
|
16010
|
+
}), method(object({}), object({ providers: array(object({
|
|
16011
|
+
addonId: string(),
|
|
16012
|
+
label: string()
|
|
16013
|
+
})).readonly() }), { auth: "admin" }), method(object({}), object({ groups: array(object({
|
|
16014
|
+
addonId: string(),
|
|
16015
|
+
label: string(),
|
|
16016
|
+
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
16017
|
+
error: string().nullable()
|
|
16018
|
+
})).readonly() }), {
|
|
15680
16019
|
kind: "mutation",
|
|
15681
16020
|
auth: "admin"
|
|
15682
16021
|
}), method(object({
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
}),
|
|
16022
|
+
addonId: string(),
|
|
16023
|
+
params: record(string(), unknown()).optional()
|
|
16024
|
+
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
15686
16025
|
kind: "mutation",
|
|
15687
16026
|
auth: "admin"
|
|
15688
|
-
}), method(
|
|
16027
|
+
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
16028
|
+
deviceId: number(),
|
|
16029
|
+
key: string(),
|
|
16030
|
+
value: unknown()
|
|
16031
|
+
}), FieldProbeResultSchema, {
|
|
15689
16032
|
kind: "mutation",
|
|
15690
16033
|
auth: "admin"
|
|
15691
|
-
}), method(
|
|
16034
|
+
}), method(object({
|
|
16035
|
+
deviceId: number(),
|
|
16036
|
+
caps: array(string()).readonly().optional()
|
|
16037
|
+
}), record(string(), unknown().nullable()));
|
|
16038
|
+
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
16039
|
+
deviceId: number(),
|
|
16040
|
+
capName: string()
|
|
16041
|
+
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
16042
|
+
deviceId: number(),
|
|
16043
|
+
capName: string(),
|
|
16044
|
+
slice: record(string(), unknown())
|
|
16045
|
+
}), _void(), { kind: "mutation" }), object({
|
|
16046
|
+
deviceId: number(),
|
|
16047
|
+
capName: string(),
|
|
16048
|
+
slice: record(string(), unknown())
|
|
16049
|
+
});
|
|
16050
|
+
/**
|
|
16051
|
+
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
16052
|
+
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
16053
|
+
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
16054
|
+
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
16055
|
+
* post-analysis enrichment-engine.
|
|
16056
|
+
*/
|
|
16057
|
+
var EmbeddingResultSchema = object({
|
|
16058
|
+
embedding: array(number()),
|
|
16059
|
+
inferenceMs: number()
|
|
16060
|
+
});
|
|
16061
|
+
var EmbeddingInfoSchema = object({
|
|
16062
|
+
modelId: string(),
|
|
16063
|
+
embeddingDim: number(),
|
|
16064
|
+
ready: boolean()
|
|
16065
|
+
});
|
|
16066
|
+
method(object({
|
|
16067
|
+
crop: _instanceof(Uint8Array),
|
|
16068
|
+
width: number(),
|
|
16069
|
+
height: number()
|
|
16070
|
+
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
16071
|
+
/**
|
|
16072
|
+
* filesystem-browse — per-node capability for browsing the node's local
|
|
16073
|
+
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
16074
|
+
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
16075
|
+
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
16076
|
+
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
16077
|
+
*/
|
|
16078
|
+
var DirEntrySchema = object({
|
|
16079
|
+
name: string(),
|
|
16080
|
+
path: string()
|
|
16081
|
+
});
|
|
16082
|
+
var BrowseResultSchema = object({
|
|
16083
|
+
path: string(),
|
|
16084
|
+
entries: array(DirEntrySchema).readonly(),
|
|
16085
|
+
freeBytes: number(),
|
|
16086
|
+
totalBytes: number()
|
|
16087
|
+
});
|
|
16088
|
+
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
15692
16089
|
kind: "mutation",
|
|
15693
16090
|
auth: "admin"
|
|
15694
16091
|
});
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
16092
|
+
/**
|
|
16093
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
16094
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
16095
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
16096
|
+
*
|
|
16097
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
16098
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
16099
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
16100
|
+
*/
|
|
16101
|
+
var LlmUsageSchema = object({
|
|
16102
|
+
inputTokens: number(),
|
|
16103
|
+
outputTokens: number()
|
|
16104
|
+
});
|
|
16105
|
+
var LlmErrorCodeSchema = _enum([
|
|
16106
|
+
"timeout",
|
|
16107
|
+
"rate-limited",
|
|
16108
|
+
"auth",
|
|
16109
|
+
"refusal",
|
|
16110
|
+
"bad-request",
|
|
16111
|
+
"unavailable",
|
|
16112
|
+
"no-profile",
|
|
16113
|
+
"budget-exceeded",
|
|
16114
|
+
"adapter-error"
|
|
15700
16115
|
]);
|
|
15701
|
-
var
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
16116
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
16117
|
+
ok: literal(true),
|
|
16118
|
+
text: string(),
|
|
16119
|
+
model: string(),
|
|
16120
|
+
usage: LlmUsageSchema,
|
|
16121
|
+
truncated: boolean(),
|
|
16122
|
+
latencyMs: number()
|
|
16123
|
+
}), object({
|
|
16124
|
+
ok: literal(false),
|
|
16125
|
+
code: LlmErrorCodeSchema,
|
|
15705
16126
|
message: string(),
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
});
|
|
15709
|
-
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
15710
|
-
scope: array(string()).optional(),
|
|
15711
|
-
level: LogLevelSchema.optional(),
|
|
15712
|
-
since: date().optional(),
|
|
15713
|
-
until: date().optional(),
|
|
15714
|
-
limit: number().optional(),
|
|
15715
|
-
tags: record(string(), string()).optional()
|
|
15716
|
-
}), array(LogEntrySchema).readonly());
|
|
16127
|
+
retryAfterMs: number().optional()
|
|
16128
|
+
})]);
|
|
15717
16129
|
/**
|
|
15718
|
-
* `
|
|
15719
|
-
*
|
|
15720
|
-
*
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
|
|
15736
|
-
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
*
|
|
15744
|
-
*
|
|
15745
|
-
*
|
|
15746
|
-
*
|
|
15747
|
-
*
|
|
15748
|
-
* Every contribution carries a `stage`:
|
|
15749
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
15750
|
-
* magic-link buttons; a future usernameless passkey).
|
|
15751
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
15752
|
-
* returned `factors` (passkey-as-2FA today).
|
|
16130
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
16131
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
16132
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
16133
|
+
*/
|
|
16134
|
+
var LlmImageSchema = object({
|
|
16135
|
+
bytes: _instanceof(Uint8Array),
|
|
16136
|
+
mimeType: string()
|
|
16137
|
+
});
|
|
16138
|
+
var LlmGenerateBaseInputSchema = object({
|
|
16139
|
+
/** Collection routing (the notification-output posture). */
|
|
16140
|
+
addonId: string().optional(),
|
|
16141
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
16142
|
+
profileId: string().optional(),
|
|
16143
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
16144
|
+
consumer: string(),
|
|
16145
|
+
system: string().optional(),
|
|
16146
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
16147
|
+
prompt: string(),
|
|
16148
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
16149
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
16150
|
+
/** Per-call override of the profile default. */
|
|
16151
|
+
maxTokens: number().int().positive().optional(),
|
|
16152
|
+
temperature: number().optional()
|
|
16153
|
+
});
|
|
16154
|
+
/**
|
|
16155
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
16156
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
16157
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
16158
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
16159
|
+
* this only through the `llm` cap's methods.
|
|
15753
16160
|
*
|
|
15754
|
-
*
|
|
15755
|
-
*
|
|
15756
|
-
*
|
|
16161
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
16162
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
16163
|
+
* watchdog — operator decision #3).
|
|
15757
16164
|
*/
|
|
15758
|
-
|
|
15759
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
15760
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
15761
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
16165
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15762
16166
|
object({
|
|
15763
|
-
kind: literal("
|
|
15764
|
-
|
|
15765
|
-
id: string(),
|
|
15766
|
-
/** Operator-facing button label. */
|
|
15767
|
-
label: string(),
|
|
15768
|
-
/** lucide-react icon name. */
|
|
15769
|
-
icon: string().optional(),
|
|
15770
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
15771
|
-
startUrl: string(),
|
|
15772
|
-
stage: LoginStageEnum
|
|
16167
|
+
kind: literal("catalog"),
|
|
16168
|
+
catalogId: string()
|
|
15773
16169
|
}),
|
|
15774
16170
|
object({
|
|
15775
|
-
kind: literal("
|
|
15776
|
-
|
|
15777
|
-
|
|
15778
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
15779
|
-
addonId: string(),
|
|
15780
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
15781
|
-
bundle: string(),
|
|
15782
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
15783
|
-
remote: WidgetRemoteSchema,
|
|
15784
|
-
stage: LoginStageEnum
|
|
16171
|
+
kind: literal("url"),
|
|
16172
|
+
url: string(),
|
|
16173
|
+
sha256: string().optional()
|
|
15785
16174
|
}),
|
|
15786
16175
|
object({
|
|
15787
|
-
kind: literal("
|
|
15788
|
-
|
|
15789
|
-
id: string(),
|
|
15790
|
-
/** Operator-facing button label. */
|
|
15791
|
-
label: string(),
|
|
15792
|
-
stage: LoginStageEnum,
|
|
15793
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
15794
|
-
rpId: string(),
|
|
15795
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
15796
|
-
origin: string().nullable()
|
|
16176
|
+
kind: literal("path"),
|
|
16177
|
+
path: string()
|
|
15797
16178
|
})
|
|
15798
16179
|
]);
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
|
-
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
|
|
15810
|
-
|
|
15811
|
-
|
|
15812
|
-
|
|
15813
|
-
|
|
15814
|
-
|
|
15815
|
-
|
|
15816
|
-
usedBytes: number(),
|
|
15817
|
-
availableBytes: number(),
|
|
15818
|
-
swapUsedBytes: number(),
|
|
15819
|
-
swapTotalBytes: number()
|
|
15820
|
-
});
|
|
15821
|
-
var DiskIoSnapshotSchema = object({
|
|
15822
|
-
readBytes: number(),
|
|
15823
|
-
writeBytes: number(),
|
|
15824
|
-
readOps: number(),
|
|
15825
|
-
writeOps: number(),
|
|
15826
|
-
timestampMs: number()
|
|
15827
|
-
});
|
|
15828
|
-
var NetworkIoSnapshotSchema = object({
|
|
15829
|
-
rxBytes: number(),
|
|
15830
|
-
txBytes: number(),
|
|
15831
|
-
rxPackets: number(),
|
|
15832
|
-
txPackets: number(),
|
|
15833
|
-
rxErrors: number(),
|
|
15834
|
-
txErrors: number(),
|
|
15835
|
-
timestampMs: number()
|
|
15836
|
-
});
|
|
15837
|
-
var MetricsGpuInfoSchema = object({
|
|
15838
|
-
utilization: number(),
|
|
15839
|
-
model: string(),
|
|
15840
|
-
memoryUsedBytes: number(),
|
|
15841
|
-
memoryTotalBytes: number(),
|
|
15842
|
-
temperature: number().nullable()
|
|
15843
|
-
});
|
|
15844
|
-
var ProcessResourceInfoSchema = object({
|
|
15845
|
-
openFds: number(),
|
|
15846
|
-
threadCount: number(),
|
|
15847
|
-
activeHandles: number(),
|
|
15848
|
-
activeRequests: number()
|
|
15849
|
-
});
|
|
15850
|
-
var PressureAvgsSchema = object({
|
|
15851
|
-
avg10: number(),
|
|
15852
|
-
avg60: number(),
|
|
15853
|
-
avg300: number()
|
|
15854
|
-
});
|
|
15855
|
-
var PressureInfoSchema = object({
|
|
15856
|
-
some: PressureAvgsSchema,
|
|
15857
|
-
full: PressureAvgsSchema.nullable()
|
|
15858
|
-
});
|
|
15859
|
-
var SystemResourceSnapshotSchema = object({
|
|
15860
|
-
cpu: CpuBreakdownSchema,
|
|
15861
|
-
memory: MemoryInfoSchema,
|
|
15862
|
-
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15863
|
-
network: NetworkIoSnapshotSchema,
|
|
15864
|
-
disk: DiskIoSnapshotSchema,
|
|
15865
|
-
pressure: object({
|
|
15866
|
-
cpu: PressureInfoSchema.nullable(),
|
|
15867
|
-
memory: PressureInfoSchema.nullable(),
|
|
15868
|
-
io: PressureInfoSchema.nullable()
|
|
15869
|
-
}),
|
|
15870
|
-
process: ProcessResourceInfoSchema,
|
|
15871
|
-
cpuTemperature: number().nullable(),
|
|
15872
|
-
timestampMs: number()
|
|
15873
|
-
});
|
|
15874
|
-
var DiskSpaceInfoSchema = object({
|
|
15875
|
-
path: string(),
|
|
15876
|
-
totalBytes: number(),
|
|
15877
|
-
usedBytes: number(),
|
|
15878
|
-
availableBytes: number(),
|
|
15879
|
-
percent: number()
|
|
15880
|
-
});
|
|
15881
|
-
var PidResourceStatsSchema = object({
|
|
15882
|
-
pid: number(),
|
|
15883
|
-
cpu: number(),
|
|
15884
|
-
memory: number(),
|
|
15885
|
-
/**
|
|
15886
|
-
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
15887
|
-
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
15888
|
-
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
15889
|
-
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
15890
|
-
* Undefined where /proc is unavailable (e.g. macOS).
|
|
15891
|
-
*/
|
|
15892
|
-
privateBytes: number().optional(),
|
|
15893
|
-
/**
|
|
15894
|
-
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
15895
|
-
* code shared copy-on-write across runners. Undefined on macOS.
|
|
15896
|
-
*/
|
|
15897
|
-
sharedBytes: number().optional()
|
|
16180
|
+
var ManagedRuntimeConfigSchema = object({
|
|
16181
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
16182
|
+
nodeId: string(),
|
|
16183
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
16184
|
+
engine: _enum(["llama-cpp"]),
|
|
16185
|
+
model: ManagedModelRefSchema,
|
|
16186
|
+
contextSize: number().int().default(4096),
|
|
16187
|
+
/** 0 = CPU-only. */
|
|
16188
|
+
gpuLayers: number().int().default(0),
|
|
16189
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
16190
|
+
threads: number().int().optional(),
|
|
16191
|
+
/** Concurrent slots. */
|
|
16192
|
+
parallel: number().int().default(1),
|
|
16193
|
+
/** Else lazy: first generate boots it. */
|
|
16194
|
+
autoStart: boolean().default(false),
|
|
16195
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
16196
|
+
idleStopMinutes: number().int().default(30)
|
|
15898
16197
|
});
|
|
15899
|
-
var
|
|
15900
|
-
|
|
16198
|
+
var LlmRuntimeStatusSchema = object({
|
|
16199
|
+
/** Status is ALWAYS node-qualified. */
|
|
15901
16200
|
nodeId: string(),
|
|
15902
|
-
role: _enum(["hub", "worker"]),
|
|
15903
|
-
pid: number(),
|
|
15904
16201
|
state: _enum([
|
|
15905
|
-
"starting",
|
|
15906
|
-
"running",
|
|
15907
|
-
"stopping",
|
|
15908
16202
|
"stopped",
|
|
15909
|
-
"
|
|
15910
|
-
|
|
15911
|
-
|
|
15912
|
-
|
|
15913
|
-
|
|
15914
|
-
pid: number(),
|
|
15915
|
-
ppid: number(),
|
|
15916
|
-
pgid: number(),
|
|
15917
|
-
classification: _enum([
|
|
15918
|
-
"root",
|
|
15919
|
-
"managed",
|
|
15920
|
-
"system",
|
|
15921
|
-
"ghost"
|
|
16203
|
+
"downloading",
|
|
16204
|
+
"starting",
|
|
16205
|
+
"ready",
|
|
16206
|
+
"crashed",
|
|
16207
|
+
"failed"
|
|
15922
16208
|
]),
|
|
15923
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
15924
|
-
addonId: string().nullable(),
|
|
15925
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15926
|
-
nodeId: string().nullable(),
|
|
15927
|
-
/** Truncated command line. */
|
|
15928
|
-
command: string(),
|
|
15929
|
-
cpuPercent: number(),
|
|
15930
|
-
memoryRssBytes: number(),
|
|
15931
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15932
|
-
uptimeSec: number(),
|
|
15933
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15934
|
-
orphaned: boolean()
|
|
15935
|
-
});
|
|
15936
|
-
var KillProcessInputSchema = object({
|
|
15937
|
-
pid: number(),
|
|
15938
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15939
|
-
force: boolean().optional()
|
|
15940
|
-
});
|
|
15941
|
-
var KillProcessResultSchema = object({
|
|
15942
|
-
success: boolean(),
|
|
15943
|
-
reason: string().optional(),
|
|
15944
|
-
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15945
|
-
});
|
|
15946
|
-
var DumpHeapSnapshotInputSchema = object({
|
|
15947
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
15948
|
-
addonId: string() });
|
|
15949
|
-
var DumpHeapSnapshotResultSchema = object({
|
|
15950
|
-
success: boolean(),
|
|
15951
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15952
|
-
path: string().optional(),
|
|
15953
|
-
/** Process pid that was signalled. */
|
|
15954
16209
|
pid: number().optional(),
|
|
15955
|
-
|
|
16210
|
+
port: number().optional(),
|
|
16211
|
+
modelPath: string().optional(),
|
|
16212
|
+
modelId: string().optional(),
|
|
16213
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
16214
|
+
lastError: string().optional(),
|
|
16215
|
+
crashesInWindow: number(),
|
|
16216
|
+
/** Child RSS (sampled best-effort). */
|
|
16217
|
+
memoryBytes: number().optional(),
|
|
16218
|
+
vramBytes: number().optional()
|
|
15956
16219
|
});
|
|
15957
|
-
var
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
diskPercent: number().optional(),
|
|
15963
|
-
temperature: number().optional(),
|
|
15964
|
-
gpuPercent: number().optional(),
|
|
15965
|
-
gpuMemoryPercent: number().optional()
|
|
16220
|
+
var LlmNodeModelSchema = object({
|
|
16221
|
+
file: string(),
|
|
16222
|
+
sizeBytes: number(),
|
|
16223
|
+
catalogId: string().optional(),
|
|
16224
|
+
installedAt: number().optional()
|
|
15966
16225
|
});
|
|
15967
|
-
|
|
16226
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
16227
|
+
nodeId: string(),
|
|
16228
|
+
modelsBytes: number(),
|
|
16229
|
+
freeBytes: number().optional()
|
|
16230
|
+
});
|
|
16231
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
16232
|
+
images: array(LlmImageSchema).optional(),
|
|
16233
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
16234
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
16235
|
+
timeoutMs: number().int().positive().optional()
|
|
16236
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15968
16237
|
kind: "mutation",
|
|
15969
16238
|
auth: "admin"
|
|
15970
|
-
}), method(
|
|
16239
|
+
}), method(object({}), _void(), {
|
|
15971
16240
|
kind: "mutation",
|
|
15972
16241
|
auth: "admin"
|
|
15973
|
-
})
|
|
15974
|
-
method(object({
|
|
15975
|
-
sourceUrl: string(),
|
|
15976
|
-
metadata: ModelConvertMetadataSchema,
|
|
15977
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15978
|
-
calibrationRef: string().optional(),
|
|
15979
|
-
sessionId: string().optional()
|
|
15980
|
-
}), ConvertResultSchema, {
|
|
16242
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15981
16243
|
kind: "mutation",
|
|
15982
|
-
auth: "admin"
|
|
15983
|
-
|
|
15984
|
-
});
|
|
15985
|
-
method(object({
|
|
15986
|
-
nodeId: string(),
|
|
15987
|
-
modelId: string(),
|
|
15988
|
-
format: _enum(MODEL_FORMATS),
|
|
15989
|
-
entry: ModelCatalogEntrySchema
|
|
15990
|
-
}), object({
|
|
15991
|
-
ok: boolean(),
|
|
15992
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15993
|
-
sha256: string(),
|
|
15994
|
-
bytes: number(),
|
|
15995
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15996
|
-
path: string()
|
|
15997
|
-
}), {
|
|
16244
|
+
auth: "admin"
|
|
16245
|
+
}), method(object({ file: string() }), _void(), {
|
|
15998
16246
|
kind: "mutation",
|
|
15999
16247
|
auth: "admin"
|
|
16000
|
-
});
|
|
16001
|
-
/**
|
|
16002
|
-
* `mqtt-broker` — broker-registry cap.
|
|
16003
|
-
*
|
|
16004
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
16005
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
16006
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
16007
|
-
* its OWN `mqtt.js` client.
|
|
16008
|
-
*
|
|
16009
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
16010
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
16011
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
16012
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
16013
|
-
* features anyway — give it the connection config, get out of the way.
|
|
16014
|
-
*
|
|
16015
|
-
* Consumer flow:
|
|
16016
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
16017
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
16018
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
16019
|
-
*
|
|
16020
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
16021
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
16022
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
16023
|
-
* spawned it.
|
|
16024
|
-
*/
|
|
16025
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
16248
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
16026
16249
|
/**
|
|
16027
|
-
*
|
|
16250
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
16251
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
16252
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
16253
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
16254
|
+
* (hub-placed); the cap stays open for future providers.
|
|
16028
16255
|
*
|
|
16029
|
-
*
|
|
16030
|
-
*
|
|
16031
|
-
*
|
|
16032
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
16033
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16256
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
16257
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
16258
|
+
* write; a stored key NEVER round-trips to a client.
|
|
16034
16259
|
*/
|
|
16035
|
-
var
|
|
16036
|
-
"
|
|
16037
|
-
"
|
|
16038
|
-
"
|
|
16039
|
-
"
|
|
16040
|
-
"
|
|
16260
|
+
var LlmProfileKindSchema = _enum([
|
|
16261
|
+
"openai-compatible",
|
|
16262
|
+
"openai",
|
|
16263
|
+
"anthropic",
|
|
16264
|
+
"google",
|
|
16265
|
+
"managed-local"
|
|
16041
16266
|
]);
|
|
16042
|
-
var
|
|
16267
|
+
var LlmProfileSchema = object({
|
|
16043
16268
|
id: string(),
|
|
16044
16269
|
name: string(),
|
|
16045
|
-
|
|
16046
|
-
|
|
16047
|
-
|
|
16048
|
-
|
|
16049
|
-
|
|
16050
|
-
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
|
|
16270
|
+
kind: LlmProfileKindSchema,
|
|
16271
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
16272
|
+
addonId: string(),
|
|
16273
|
+
enabled: boolean(),
|
|
16274
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
16275
|
+
model: string(),
|
|
16276
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
16277
|
+
baseUrl: string().optional(),
|
|
16278
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
16279
|
+
apiKey: string().optional(),
|
|
16280
|
+
supportsVision: boolean(),
|
|
16281
|
+
temperature: number().min(0).max(2).optional(),
|
|
16282
|
+
maxTokens: number().int().positive().optional(),
|
|
16283
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
16284
|
+
extraHeaders: record(string(), string()).optional(),
|
|
16285
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
16286
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
16054
16287
|
});
|
|
16055
|
-
/**
|
|
16056
|
-
*
|
|
16057
|
-
*
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
|
|
16065
|
-
|
|
16066
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
16067
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
16068
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
16069
|
-
* broker).
|
|
16070
|
-
*/
|
|
16071
|
-
clientIdPrefix: string().optional()
|
|
16288
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
16289
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
16290
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
16291
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
16292
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
16293
|
+
kind: LlmProfileKindSchema,
|
|
16294
|
+
label: string(),
|
|
16295
|
+
icon: string(),
|
|
16296
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16297
|
+
addonId: string(),
|
|
16298
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
16072
16299
|
});
|
|
16073
|
-
var
|
|
16074
|
-
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
password: string().optional(),
|
|
16078
|
-
clientIdPrefix: string().optional()
|
|
16300
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
16301
|
+
var LlmDefaultSchema = object({
|
|
16302
|
+
selector: LlmDefaultSelectorSchema,
|
|
16303
|
+
profileId: string()
|
|
16079
16304
|
});
|
|
16080
|
-
|
|
16081
|
-
var
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
|
|
16087
|
-
|
|
16088
|
-
|
|
16089
|
-
|
|
16090
|
-
|
|
16091
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
16092
|
-
allowAnonymous: boolean().default(false),
|
|
16093
|
-
/** Optional shared username/password for clients. */
|
|
16094
|
-
username: string().optional(),
|
|
16095
|
-
password: string().optional()
|
|
16305
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
16306
|
+
var LlmUsageRollupSchema = object({
|
|
16307
|
+
day: string(),
|
|
16308
|
+
consumer: string(),
|
|
16309
|
+
profileId: string(),
|
|
16310
|
+
calls: number(),
|
|
16311
|
+
okCalls: number(),
|
|
16312
|
+
errorCalls: number(),
|
|
16313
|
+
inputTokens: number(),
|
|
16314
|
+
outputTokens: number(),
|
|
16315
|
+
avgLatencyMs: number()
|
|
16096
16316
|
});
|
|
16097
|
-
|
|
16317
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
16318
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
16098
16319
|
id: string(),
|
|
16099
|
-
|
|
16100
|
-
|
|
16101
|
-
|
|
16102
|
-
brokerCount: number(),
|
|
16103
|
-
embeddedRunning: boolean()
|
|
16104
|
-
});
|
|
16105
|
-
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
|
|
16106
|
-
var NetworkEndpointSchema = object({
|
|
16320
|
+
label: string(),
|
|
16321
|
+
family: string(),
|
|
16322
|
+
purpose: _enum(["text", "vision"]),
|
|
16107
16323
|
url: string(),
|
|
16108
|
-
|
|
16109
|
-
|
|
16110
|
-
|
|
16324
|
+
sha256: string(),
|
|
16325
|
+
sizeBytes: number(),
|
|
16326
|
+
quantization: string(),
|
|
16327
|
+
/** Load-time guidance shown in the picker. */
|
|
16328
|
+
minRamBytes: number(),
|
|
16329
|
+
contextSizeDefault: number().int(),
|
|
16330
|
+
/** Vision models: companion projector file. */
|
|
16331
|
+
mmprojUrl: string().optional()
|
|
16111
16332
|
});
|
|
16112
|
-
var
|
|
16113
|
-
|
|
16114
|
-
|
|
16333
|
+
var LlmRuntimeNodeSchema = object({
|
|
16334
|
+
nodeId: string(),
|
|
16335
|
+
reachable: boolean(),
|
|
16336
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
16337
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
16115
16338
|
error: string().optional()
|
|
16116
16339
|
});
|
|
16117
|
-
|
|
16118
|
-
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
|
|
16122
|
-
|
|
16123
|
-
|
|
16124
|
-
|
|
16125
|
-
|
|
16126
|
-
|
|
16127
|
-
|
|
16128
|
-
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
16340
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
16341
|
+
var ProfileRefInputSchema = object({
|
|
16342
|
+
addonId: string(),
|
|
16343
|
+
profileId: string()
|
|
16344
|
+
});
|
|
16345
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
16346
|
+
kind: "mutation",
|
|
16347
|
+
auth: "admin"
|
|
16348
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16349
|
+
kind: "mutation",
|
|
16350
|
+
auth: "admin"
|
|
16351
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
16352
|
+
kind: "mutation",
|
|
16353
|
+
auth: "admin"
|
|
16354
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
16355
|
+
selector: LlmDefaultSelectorSchema,
|
|
16356
|
+
profileId: string().nullable()
|
|
16357
|
+
}), _void(), {
|
|
16358
|
+
kind: "mutation",
|
|
16359
|
+
auth: "admin"
|
|
16360
|
+
}), method(object({
|
|
16361
|
+
since: number().optional(),
|
|
16362
|
+
until: number().optional(),
|
|
16363
|
+
consumer: string().optional(),
|
|
16364
|
+
profileId: string().optional()
|
|
16365
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16366
|
+
nodeId: string(),
|
|
16367
|
+
model: ManagedModelRefSchema
|
|
16368
|
+
}), _void(), {
|
|
16369
|
+
kind: "mutation",
|
|
16370
|
+
auth: "admin"
|
|
16371
|
+
}), method(object({
|
|
16372
|
+
nodeId: string(),
|
|
16373
|
+
file: string()
|
|
16374
|
+
}), _void(), {
|
|
16375
|
+
kind: "mutation",
|
|
16376
|
+
auth: "admin"
|
|
16377
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16378
|
+
kind: "mutation",
|
|
16379
|
+
auth: "admin"
|
|
16380
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16381
|
+
kind: "mutation",
|
|
16382
|
+
auth: "admin"
|
|
16383
|
+
});
|
|
16384
|
+
var LogLevelSchema = _enum([
|
|
16385
|
+
"debug",
|
|
16386
|
+
"info",
|
|
16387
|
+
"warn",
|
|
16388
|
+
"error"
|
|
16389
|
+
]);
|
|
16390
|
+
var LogEntrySchema = object({
|
|
16391
|
+
timestamp: date(),
|
|
16392
|
+
level: LogLevelSchema,
|
|
16393
|
+
scope: array(string()),
|
|
16394
|
+
message: string(),
|
|
16395
|
+
meta: record(string(), unknown()).optional(),
|
|
16396
|
+
tags: record(string(), string()).optional()
|
|
16137
16397
|
});
|
|
16138
|
-
method(
|
|
16398
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
16399
|
+
scope: array(string()).optional(),
|
|
16400
|
+
level: LogLevelSchema.optional(),
|
|
16401
|
+
since: date().optional(),
|
|
16402
|
+
until: date().optional(),
|
|
16403
|
+
limit: number().optional(),
|
|
16404
|
+
tags: record(string(), string()).optional()
|
|
16405
|
+
}), array(LogEntrySchema).readonly());
|
|
16139
16406
|
/**
|
|
16140
|
-
*
|
|
16407
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
16408
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
16409
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
16410
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
16411
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
16412
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
16141
16413
|
*
|
|
16142
|
-
*
|
|
16143
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
16144
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
16145
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16146
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
16147
|
-
* message to what the kind supports — callers never special-case a service.
|
|
16414
|
+
* A contribution is a discriminated union on `kind`:
|
|
16148
16415
|
*
|
|
16149
|
-
*
|
|
16150
|
-
*
|
|
16151
|
-
* `
|
|
16152
|
-
*
|
|
16153
|
-
*
|
|
16154
|
-
* alternative would fork the UI per addon and cannot host the
|
|
16155
|
-
* discovery→adopt flow.
|
|
16156
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
16157
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
16158
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
16159
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
16160
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
16161
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
16162
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
16163
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
16164
|
-
* base64 fallback needed.
|
|
16416
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
16417
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16418
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
16419
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16420
|
+
* login page needs NO change.
|
|
16165
16421
|
*
|
|
16166
|
-
*
|
|
16167
|
-
*
|
|
16168
|
-
*
|
|
16169
|
-
|
|
16170
|
-
|
|
16171
|
-
*
|
|
16172
|
-
*
|
|
16173
|
-
|
|
16174
|
-
|
|
16175
|
-
|
|
16176
|
-
|
|
16177
|
-
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
*
|
|
16183
|
-
*
|
|
16184
|
-
*
|
|
16185
|
-
*
|
|
16422
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
16423
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
16424
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
16425
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
16426
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
16427
|
+
*
|
|
16428
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
16429
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
16430
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
16431
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
16432
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
16433
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
16434
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
16435
|
+
* decision.
|
|
16436
|
+
*
|
|
16437
|
+
* Every contribution carries a `stage`:
|
|
16438
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
16439
|
+
* magic-link buttons; a future usernameless passkey).
|
|
16440
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16441
|
+
* returned `factors` (passkey-as-2FA today).
|
|
16442
|
+
*
|
|
16443
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
16444
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
16445
|
+
* tRPC router.
|
|
16186
16446
|
*/
|
|
16187
|
-
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
|
|
16197
|
-
|
|
16447
|
+
/** When a login method renders in the two-phase login flow. */
|
|
16448
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
16449
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
16450
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
16451
|
+
object({
|
|
16452
|
+
kind: literal("redirect"),
|
|
16453
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
16454
|
+
id: string(),
|
|
16455
|
+
/** Operator-facing button label. */
|
|
16456
|
+
label: string(),
|
|
16457
|
+
/** lucide-react icon name. */
|
|
16458
|
+
icon: string().optional(),
|
|
16459
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
16460
|
+
startUrl: string(),
|
|
16461
|
+
stage: LoginStageEnum
|
|
16462
|
+
}),
|
|
16463
|
+
object({
|
|
16464
|
+
kind: literal("widget"),
|
|
16465
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
16466
|
+
id: string(),
|
|
16467
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
16468
|
+
addonId: string(),
|
|
16469
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
16470
|
+
bundle: string(),
|
|
16471
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
16472
|
+
remote: WidgetRemoteSchema,
|
|
16473
|
+
stage: LoginStageEnum
|
|
16474
|
+
}),
|
|
16475
|
+
object({
|
|
16476
|
+
kind: literal("passkey"),
|
|
16477
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
16478
|
+
id: string(),
|
|
16479
|
+
/** Operator-facing button label. */
|
|
16480
|
+
label: string(),
|
|
16481
|
+
stage: LoginStageEnum,
|
|
16482
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
16483
|
+
rpId: string(),
|
|
16484
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
16485
|
+
origin: string().nullable()
|
|
16486
|
+
})
|
|
16198
16487
|
]);
|
|
16199
|
-
|
|
16200
|
-
var
|
|
16201
|
-
|
|
16202
|
-
|
|
16203
|
-
|
|
16488
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
16489
|
+
var CpuBreakdownSchema = object({
|
|
16490
|
+
total: number(),
|
|
16491
|
+
user: number(),
|
|
16492
|
+
system: number(),
|
|
16493
|
+
irq: number(),
|
|
16494
|
+
nice: number(),
|
|
16495
|
+
loadAvg: tuple([
|
|
16496
|
+
number(),
|
|
16497
|
+
number(),
|
|
16498
|
+
number()
|
|
16499
|
+
]),
|
|
16500
|
+
cores: number()
|
|
16204
16501
|
});
|
|
16205
|
-
|
|
16206
|
-
|
|
16207
|
-
|
|
16208
|
-
|
|
16209
|
-
|
|
16210
|
-
|
|
16211
|
-
|
|
16212
|
-
|
|
16213
|
-
var
|
|
16214
|
-
|
|
16215
|
-
|
|
16216
|
-
|
|
16217
|
-
|
|
16218
|
-
|
|
16219
|
-
|
|
16220
|
-
|
|
16221
|
-
|
|
16222
|
-
|
|
16223
|
-
|
|
16224
|
-
|
|
16225
|
-
|
|
16226
|
-
|
|
16227
|
-
|
|
16502
|
+
var MemoryInfoSchema = object({
|
|
16503
|
+
percent: number(),
|
|
16504
|
+
totalBytes: number(),
|
|
16505
|
+
usedBytes: number(),
|
|
16506
|
+
availableBytes: number(),
|
|
16507
|
+
swapUsedBytes: number(),
|
|
16508
|
+
swapTotalBytes: number()
|
|
16509
|
+
});
|
|
16510
|
+
var DiskIoSnapshotSchema = object({
|
|
16511
|
+
readBytes: number(),
|
|
16512
|
+
writeBytes: number(),
|
|
16513
|
+
readOps: number(),
|
|
16514
|
+
writeOps: number(),
|
|
16515
|
+
timestampMs: number()
|
|
16516
|
+
});
|
|
16517
|
+
var NetworkIoSnapshotSchema = object({
|
|
16518
|
+
rxBytes: number(),
|
|
16519
|
+
txBytes: number(),
|
|
16520
|
+
rxPackets: number(),
|
|
16521
|
+
txPackets: number(),
|
|
16522
|
+
rxErrors: number(),
|
|
16523
|
+
txErrors: number(),
|
|
16524
|
+
timestampMs: number()
|
|
16525
|
+
});
|
|
16526
|
+
var MetricsGpuInfoSchema = object({
|
|
16527
|
+
utilization: number(),
|
|
16528
|
+
model: string(),
|
|
16529
|
+
memoryUsedBytes: number(),
|
|
16530
|
+
memoryTotalBytes: number(),
|
|
16531
|
+
temperature: number().nullable()
|
|
16532
|
+
});
|
|
16533
|
+
var ProcessResourceInfoSchema = object({
|
|
16534
|
+
openFds: number(),
|
|
16535
|
+
threadCount: number(),
|
|
16536
|
+
activeHandles: number(),
|
|
16537
|
+
activeRequests: number()
|
|
16228
16538
|
});
|
|
16229
|
-
|
|
16230
|
-
|
|
16231
|
-
|
|
16232
|
-
|
|
16233
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
16234
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
16235
|
-
flags: object({
|
|
16236
|
-
critical: boolean().optional(),
|
|
16237
|
-
silent: boolean().optional(),
|
|
16238
|
-
noPush: boolean().optional()
|
|
16239
|
-
}).optional(),
|
|
16240
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
16241
|
-
requires: array(string()).optional(),
|
|
16242
|
-
description: string().optional()
|
|
16539
|
+
var PressureAvgsSchema = object({
|
|
16540
|
+
avg10: number(),
|
|
16541
|
+
avg60: number(),
|
|
16542
|
+
avg300: number()
|
|
16243
16543
|
});
|
|
16244
|
-
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
|
|
16249
|
-
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
|
|
16253
|
-
|
|
16254
|
-
|
|
16544
|
+
var PressureInfoSchema = object({
|
|
16545
|
+
some: PressureAvgsSchema,
|
|
16546
|
+
full: PressureAvgsSchema.nullable()
|
|
16547
|
+
});
|
|
16548
|
+
var SystemResourceSnapshotSchema = object({
|
|
16549
|
+
cpu: CpuBreakdownSchema,
|
|
16550
|
+
memory: MemoryInfoSchema,
|
|
16551
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
16552
|
+
network: NetworkIoSnapshotSchema,
|
|
16553
|
+
disk: DiskIoSnapshotSchema,
|
|
16554
|
+
pressure: object({
|
|
16555
|
+
cpu: PressureInfoSchema.nullable(),
|
|
16556
|
+
memory: PressureInfoSchema.nullable(),
|
|
16557
|
+
io: PressureInfoSchema.nullable()
|
|
16255
16558
|
}),
|
|
16256
|
-
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
format: array(NotificationFormatSchema),
|
|
16260
|
-
clickUrl: boolean(),
|
|
16261
|
-
sound: boolean(),
|
|
16262
|
-
ttl: boolean(),
|
|
16263
|
-
bodyMaxLen: number().int().positive()
|
|
16559
|
+
process: ProcessResourceInfoSchema,
|
|
16560
|
+
cpuTemperature: number().nullable(),
|
|
16561
|
+
timestampMs: number()
|
|
16264
16562
|
});
|
|
16265
|
-
|
|
16266
|
-
|
|
16267
|
-
|
|
16268
|
-
|
|
16269
|
-
|
|
16270
|
-
|
|
16271
|
-
*/
|
|
16272
|
-
var ConfigSchemaPassthrough = unknown();
|
|
16273
|
-
var TargetKindSchema = object({
|
|
16274
|
-
kind: string(),
|
|
16275
|
-
label: string(),
|
|
16276
|
-
icon: string(),
|
|
16277
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16278
|
-
addonId: string(),
|
|
16279
|
-
configSchema: ConfigSchemaPassthrough,
|
|
16280
|
-
supportsDiscovery: boolean(),
|
|
16281
|
-
caps: TargetKindCapsSchema
|
|
16563
|
+
var DiskSpaceInfoSchema = object({
|
|
16564
|
+
path: string(),
|
|
16565
|
+
totalBytes: number(),
|
|
16566
|
+
usedBytes: number(),
|
|
16567
|
+
availableBytes: number(),
|
|
16568
|
+
percent: number()
|
|
16282
16569
|
});
|
|
16283
|
-
|
|
16284
|
-
|
|
16285
|
-
|
|
16286
|
-
|
|
16287
|
-
|
|
16288
|
-
|
|
16289
|
-
|
|
16290
|
-
|
|
16291
|
-
|
|
16570
|
+
var PidResourceStatsSchema = object({
|
|
16571
|
+
pid: number(),
|
|
16572
|
+
cpu: number(),
|
|
16573
|
+
memory: number(),
|
|
16574
|
+
/**
|
|
16575
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
16576
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
16577
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
16578
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
16579
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
16580
|
+
*/
|
|
16581
|
+
privateBytes: number().optional(),
|
|
16582
|
+
/**
|
|
16583
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
16584
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
16585
|
+
*/
|
|
16586
|
+
sharedBytes: number().optional()
|
|
16587
|
+
});
|
|
16588
|
+
var AddonInstanceSchema = object({
|
|
16292
16589
|
addonId: string(),
|
|
16293
|
-
|
|
16294
|
-
|
|
16590
|
+
nodeId: string(),
|
|
16591
|
+
role: _enum(["hub", "worker"]),
|
|
16592
|
+
pid: number(),
|
|
16593
|
+
state: _enum([
|
|
16594
|
+
"starting",
|
|
16595
|
+
"running",
|
|
16596
|
+
"stopping",
|
|
16597
|
+
"stopped",
|
|
16598
|
+
"crashed"
|
|
16599
|
+
]),
|
|
16600
|
+
uptimeSec: number()
|
|
16295
16601
|
});
|
|
16296
|
-
|
|
16297
|
-
|
|
16298
|
-
|
|
16299
|
-
|
|
16300
|
-
|
|
16602
|
+
var NodeProcessSchema = object({
|
|
16603
|
+
pid: number(),
|
|
16604
|
+
ppid: number(),
|
|
16605
|
+
pgid: number(),
|
|
16606
|
+
classification: _enum([
|
|
16607
|
+
"root",
|
|
16608
|
+
"managed",
|
|
16609
|
+
"system",
|
|
16610
|
+
"ghost"
|
|
16611
|
+
]),
|
|
16612
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
16613
|
+
addonId: string().nullable(),
|
|
16614
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
16615
|
+
nodeId: string().nullable(),
|
|
16616
|
+
/** Truncated command line. */
|
|
16617
|
+
command: string(),
|
|
16618
|
+
cpuPercent: number(),
|
|
16619
|
+
memoryRssBytes: number(),
|
|
16620
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
16621
|
+
uptimeSec: number(),
|
|
16622
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
16623
|
+
orphaned: boolean()
|
|
16301
16624
|
});
|
|
16302
|
-
|
|
16303
|
-
|
|
16304
|
-
|
|
16305
|
-
|
|
16306
|
-
attachmentsSent: number().int().nonnegative(),
|
|
16307
|
-
actionsSent: number().int().nonnegative(),
|
|
16308
|
-
truncated: boolean(),
|
|
16309
|
-
dropped: array(string())
|
|
16625
|
+
var KillProcessInputSchema = object({
|
|
16626
|
+
pid: number(),
|
|
16627
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
16628
|
+
force: boolean().optional()
|
|
16310
16629
|
});
|
|
16311
|
-
var
|
|
16630
|
+
var KillProcessResultSchema = object({
|
|
16312
16631
|
success: boolean(),
|
|
16313
|
-
|
|
16314
|
-
|
|
16632
|
+
reason: string().optional(),
|
|
16633
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
16634
|
+
});
|
|
16635
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
16636
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
16637
|
+
addonId: string() });
|
|
16638
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
16639
|
+
success: boolean(),
|
|
16640
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
16641
|
+
path: string().optional(),
|
|
16642
|
+
/** Process pid that was signalled. */
|
|
16643
|
+
pid: number().optional(),
|
|
16644
|
+
reason: string().optional()
|
|
16645
|
+
});
|
|
16646
|
+
var SystemMetricsSchema = object({
|
|
16647
|
+
cpuPercent: number(),
|
|
16648
|
+
memoryPercent: number(),
|
|
16649
|
+
memoryUsedMB: number(),
|
|
16650
|
+
memoryTotalMB: number(),
|
|
16651
|
+
diskPercent: number().optional(),
|
|
16652
|
+
temperature: number().optional(),
|
|
16653
|
+
gpuPercent: number().optional(),
|
|
16654
|
+
gpuMemoryPercent: number().optional()
|
|
16655
|
+
});
|
|
16656
|
+
method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string() }), DiskSpaceInfoSchema), method(_void(), MetricsGpuInfoSchema.nullable()), method(_void(), number().nullable()), method(object({ pids: array(number()) }), array(PidResourceStatsSchema)), method(_void(), array(AddonInstanceSchema).readonly()), method(object({ addonId: string() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(KillProcessInputSchema, KillProcessResultSchema, {
|
|
16657
|
+
kind: "mutation",
|
|
16658
|
+
auth: "admin"
|
|
16659
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
16660
|
+
kind: "mutation",
|
|
16661
|
+
auth: "admin"
|
|
16662
|
+
});
|
|
16663
|
+
method(object({
|
|
16664
|
+
sourceUrl: string(),
|
|
16665
|
+
metadata: ModelConvertMetadataSchema,
|
|
16666
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
16667
|
+
calibrationRef: string().optional(),
|
|
16668
|
+
sessionId: string().optional()
|
|
16669
|
+
}), ConvertResultSchema, {
|
|
16670
|
+
kind: "mutation",
|
|
16671
|
+
auth: "admin",
|
|
16672
|
+
timeoutMs: 6e5
|
|
16673
|
+
});
|
|
16674
|
+
method(object({
|
|
16675
|
+
nodeId: string(),
|
|
16676
|
+
modelId: string(),
|
|
16677
|
+
format: _enum(MODEL_FORMATS),
|
|
16678
|
+
entry: ModelCatalogEntrySchema
|
|
16679
|
+
}), object({
|
|
16680
|
+
ok: boolean(),
|
|
16681
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
16682
|
+
sha256: string(),
|
|
16683
|
+
bytes: number(),
|
|
16684
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
16685
|
+
path: string()
|
|
16686
|
+
}), {
|
|
16687
|
+
kind: "mutation",
|
|
16688
|
+
auth: "admin"
|
|
16315
16689
|
});
|
|
16316
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
16317
|
-
var TestResultSchema = SendResultSchema;
|
|
16318
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
16319
|
-
kind: string(),
|
|
16320
|
-
config: record(string(), unknown()).optional()
|
|
16321
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
16322
|
-
targetId: string(),
|
|
16323
|
-
notification: NotificationSchema
|
|
16324
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
16325
|
-
targetId: string(),
|
|
16326
|
-
sample: NotificationSchema.optional()
|
|
16327
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16328
|
-
targetId: string(),
|
|
16329
|
-
enabled: boolean()
|
|
16330
|
-
}), _void(), { kind: "mutation" });
|
|
16331
16690
|
/**
|
|
16332
|
-
*
|
|
16333
|
-
*
|
|
16334
|
-
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
16335
|
-
* (operator decisions D-1/D-2/D-3 are binding):
|
|
16691
|
+
* `mqtt-broker` — broker-registry cap.
|
|
16336
16692
|
*
|
|
16337
|
-
*
|
|
16338
|
-
*
|
|
16339
|
-
*
|
|
16340
|
-
*
|
|
16341
|
-
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
16342
|
-
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
16343
|
-
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
16344
|
-
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
16345
|
-
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
16346
|
-
* by id; per-backend params are a passthrough blob capped by the
|
|
16347
|
-
* target kind's own caps/degrade engine).
|
|
16693
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
16694
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
16695
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
16696
|
+
* its OWN `mqtt.js` client.
|
|
16348
16697
|
*
|
|
16349
|
-
*
|
|
16350
|
-
*
|
|
16351
|
-
*
|
|
16352
|
-
*
|
|
16353
|
-
*
|
|
16354
|
-
* private zones, per-recipient fan-out and the wider condition table are
|
|
16355
|
-
* P2+ (see spec §7).
|
|
16698
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
16699
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
16700
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
16701
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
16702
|
+
* features anyway — give it the connection config, get out of the way.
|
|
16356
16703
|
*
|
|
16357
|
-
*
|
|
16358
|
-
*
|
|
16359
|
-
*
|
|
16704
|
+
* Consumer flow:
|
|
16705
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
16706
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
16707
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
16708
|
+
*
|
|
16709
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
16710
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
16711
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
16712
|
+
* spawned it.
|
|
16360
16713
|
*/
|
|
16714
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
16361
16715
|
/**
|
|
16362
|
-
*
|
|
16363
|
-
* The value maps 1:1 onto the evaluated record kind:
|
|
16364
|
-
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
16365
|
-
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
16366
|
-
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
16367
|
-
* change of a LINKED device, one row per linked camera)
|
|
16368
|
-
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
16369
|
-
* delivery / pick-up)
|
|
16716
|
+
* Broker live-probe status.
|
|
16370
16717
|
*
|
|
16371
|
-
*
|
|
16372
|
-
*
|
|
16373
|
-
*
|
|
16374
|
-
*
|
|
16718
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
16719
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
16720
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
16721
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
16722
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16375
16723
|
*/
|
|
16376
|
-
var
|
|
16377
|
-
"
|
|
16378
|
-
"
|
|
16379
|
-
"
|
|
16380
|
-
"
|
|
16724
|
+
var BrokerStatusSchema$1 = _enum([
|
|
16725
|
+
"connected",
|
|
16726
|
+
"disconnected",
|
|
16727
|
+
"auth-failed",
|
|
16728
|
+
"unreachable",
|
|
16729
|
+
"tls-error"
|
|
16381
16730
|
]);
|
|
16382
|
-
|
|
16383
|
-
|
|
16384
|
-
|
|
16385
|
-
|
|
16386
|
-
|
|
16387
|
-
|
|
16388
|
-
|
|
16389
|
-
|
|
16390
|
-
/**
|
|
16391
|
-
|
|
16392
|
-
/**
|
|
16393
|
-
|
|
16394
|
-
});
|
|
16395
|
-
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
16396
|
-
var NcPlateMatcherSchema = object({
|
|
16397
|
-
values: array(string().min(1)).min(1),
|
|
16398
|
-
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
16399
|
-
maxDistance: number().int().min(0).max(3).default(1)
|
|
16400
|
-
});
|
|
16401
|
-
/**
|
|
16402
|
-
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
16403
|
-
* occupancy edge for a device — optionally narrowed to a single admin
|
|
16404
|
-
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
16405
|
-
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
16406
|
-
* - `became-free` — count crossed ≥ `count` → below it
|
|
16407
|
-
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
16408
|
-
* `sustainSeconds` requires the condition hold continuously that long
|
|
16409
|
-
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
16410
|
-
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
16411
|
-
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
16412
|
-
* (declared SQLite collection, reseeded on boot).
|
|
16413
|
-
*/
|
|
16414
|
-
var NcOccupancyConditionSchema = object({
|
|
16415
|
-
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
16416
|
-
zoneId: string().optional(),
|
|
16417
|
-
/** Object class to count; absent = any class. */
|
|
16418
|
-
className: string().optional(),
|
|
16419
|
-
op: _enum([
|
|
16420
|
-
"became-occupied",
|
|
16421
|
-
"became-free",
|
|
16422
|
-
">=",
|
|
16423
|
-
"<="
|
|
16424
|
-
]).default("became-occupied"),
|
|
16425
|
-
count: number().int().min(0).default(1),
|
|
16426
|
-
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
16427
|
-
});
|
|
16428
|
-
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
16429
|
-
var NcZoneConditionSchema = object({
|
|
16430
|
-
ids: array(string().min(1)).min(1),
|
|
16431
|
-
/** Quantifier over `ids` — at least one / every one visited. */
|
|
16432
|
-
match: _enum(["any", "all"]).default("any")
|
|
16433
|
-
});
|
|
16434
|
-
/**
|
|
16435
|
-
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
16436
|
-
* membership lists are OR within the list (spec §2.3).
|
|
16437
|
-
*/
|
|
16438
|
-
var NcConditionsSchema = object({
|
|
16439
|
-
/** Device scope — absent = all devices. */
|
|
16440
|
-
devices: array(number()).optional(),
|
|
16441
|
-
/** Detector class names (any overlap with the record's class set). */
|
|
16442
|
-
classes: array(string().min(1)).optional(),
|
|
16443
|
-
/** Veto classes — any overlap fails the rule. */
|
|
16444
|
-
classesExclude: array(string().min(1)).optional(),
|
|
16445
|
-
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
16446
|
-
minConfidence: number().min(0).max(1).optional(),
|
|
16447
|
-
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
16448
|
-
zones: NcZoneConditionSchema.optional(),
|
|
16449
|
-
/** Veto zones — any hit fails the rule. */
|
|
16450
|
-
zonesExclude: array(string().min(1)).optional(),
|
|
16451
|
-
/**
|
|
16452
|
-
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
16453
|
-
* (identity name / plate text / subclass).
|
|
16454
|
-
*/
|
|
16455
|
-
labelEquals: array(string().min(1)).optional(),
|
|
16456
|
-
/**
|
|
16457
|
-
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
16458
|
-
* `label` (the identity display name propagated by the face pipeline) —
|
|
16459
|
-
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
16460
|
-
*/
|
|
16461
|
-
identities: array(string().min(1)).optional(),
|
|
16462
|
-
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
16463
|
-
plates: NcPlateMatcherSchema.optional(),
|
|
16464
|
-
/**
|
|
16465
|
-
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
16466
|
-
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
16467
|
-
* identity display name). A record with NO label passes (nothing to
|
|
16468
|
-
* exclude), unlike the include variant which fails on an absent label.
|
|
16469
|
-
*/
|
|
16470
|
-
identitiesExclude: array(string().min(1)).optional(),
|
|
16471
|
-
/**
|
|
16472
|
-
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
16473
|
-
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
16474
|
-
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
16475
|
-
* close the value is threaded via the close-time info (the `Track` clone is
|
|
16476
|
-
* captured before the DB row is updated, so it would otherwise read stale).
|
|
16477
|
-
* Fails when the record carries no importance (never guess quality — the
|
|
16478
|
-
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
16479
|
-
*/
|
|
16480
|
-
minImportance: number().min(0).max(1).optional(),
|
|
16481
|
-
/**
|
|
16482
|
-
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
16483
|
-
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
16484
|
-
* lifespan, so a dwell condition never matches immediate delivery
|
|
16485
|
-
* (documented choice — the object-event record carries no `firstSeen`,
|
|
16486
|
-
* so dwell cannot be computed from what the subject actually carries).
|
|
16487
|
-
*/
|
|
16488
|
-
minDwellSeconds: number().min(0).optional(),
|
|
16489
|
-
/**
|
|
16490
|
-
* Detection provenance filter. `any` (default / absent) matches every
|
|
16491
|
-
* source; otherwise the subject's source must equal it. Legacy records
|
|
16492
|
-
* with no stamped source are treated as `pipeline`. The union spans both
|
|
16493
|
-
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
16494
|
-
* tracks carry `sensor`.
|
|
16495
|
-
*/
|
|
16496
|
-
source: _enum([
|
|
16497
|
-
"pipeline",
|
|
16498
|
-
"onboard",
|
|
16499
|
-
"sensor",
|
|
16500
|
-
"any"
|
|
16501
|
-
]).optional(),
|
|
16502
|
-
/**
|
|
16503
|
-
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
16504
|
-
* detector `minConfidence` (that gates the object-detection score; this
|
|
16505
|
-
* gates the recognition/OCR match score). Fails when the subject carries
|
|
16506
|
-
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
16507
|
-
* lives on the recognition result and reaches the subject at track close.
|
|
16508
|
-
*
|
|
16509
|
-
* What it measures precisely (plumbed at track close — the closer threads
|
|
16510
|
-
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
16511
|
-
* `importance`): the BEST recognition match confidence observed for the
|
|
16512
|
-
* label the track carries at close — for a face, the peak cosine similarity
|
|
16513
|
-
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
16514
|
-
* for a plate, the peak OCR read score of the best-held plate
|
|
16515
|
-
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
16516
|
-
* one track the higher of the two is used. A track that ended with no
|
|
16517
|
-
* confident identity/plate match carries no value, so the condition fails
|
|
16518
|
-
* closed for it (an un-recognized subject).
|
|
16519
|
-
*/
|
|
16520
|
-
minLabelConfidence: number().min(0).max(1).optional(),
|
|
16521
|
-
/**
|
|
16522
|
-
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
16523
|
-
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
16524
|
-
* against the token carried on the device-event subject (extracted from the
|
|
16525
|
-
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
16526
|
-
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
16527
|
-
* eventType, so gate those with {@link sensorKinds} instead.
|
|
16528
|
-
*/
|
|
16529
|
-
eventTypeTokens: array(string().min(1)).optional(),
|
|
16530
|
-
/**
|
|
16531
|
-
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
16532
|
-
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
16533
|
-
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
16534
|
-
*/
|
|
16535
|
-
sensorKinds: array(string().min(1)).optional(),
|
|
16536
|
-
/**
|
|
16537
|
-
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
16538
|
-
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
16539
|
-
* when the subject's phase does not match (a subject always carries a phase
|
|
16540
|
-
* on the package-event trigger).
|
|
16541
|
-
*/
|
|
16542
|
-
packagePhase: _enum([
|
|
16543
|
-
"delivered",
|
|
16544
|
-
"picked-up",
|
|
16545
|
-
"both"
|
|
16546
|
-
]).optional(),
|
|
16547
|
-
/**
|
|
16548
|
-
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
16549
|
-
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
16550
|
-
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
16551
|
-
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
16552
|
-
*/
|
|
16553
|
-
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
16554
|
-
/**
|
|
16555
|
-
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
16556
|
-
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
16557
|
-
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
16558
|
-
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
16559
|
-
*/
|
|
16560
|
-
occupancy: NcOccupancyConditionSchema.optional()
|
|
16561
|
-
});
|
|
16562
|
-
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
16563
|
-
var NcRuleTargetSchema = object({
|
|
16564
|
-
/** `notification-output` Target id. */
|
|
16565
|
-
targetId: string().min(1),
|
|
16566
|
-
/**
|
|
16567
|
-
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
16568
|
-
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
16569
|
-
* degrade engine drops what the backend can't render.
|
|
16570
|
-
*/
|
|
16571
|
-
params: record(string(), unknown()).optional()
|
|
16731
|
+
var BrokerInfoSchema = object({
|
|
16732
|
+
id: string(),
|
|
16733
|
+
name: string(),
|
|
16734
|
+
url: string(),
|
|
16735
|
+
kind: BrokerKindSchema,
|
|
16736
|
+
status: BrokerStatusSchema$1,
|
|
16737
|
+
latencyMs: number().nullable(),
|
|
16738
|
+
error: string().optional(),
|
|
16739
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
16740
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
16741
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
16742
|
+
lastCheckedAt: number().optional()
|
|
16572
16743
|
});
|
|
16573
16744
|
/**
|
|
16574
|
-
*
|
|
16575
|
-
*
|
|
16576
|
-
*
|
|
16577
|
-
*
|
|
16578
|
-
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
16579
|
-
* (or when the specific crop is missing) degrades to `best`, then
|
|
16580
|
-
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
16581
|
-
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
16582
|
-
* name), so the choice never drifts from the record that fired it.
|
|
16583
|
-
* - `keyFrame` — the clean scene frame (no subject box).
|
|
16584
|
-
* - `none` — no attachment.
|
|
16745
|
+
* Connection details — what a consumer needs to call
|
|
16746
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
16747
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
16748
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
16585
16749
|
*/
|
|
16586
|
-
var
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
"none"
|
|
16591
|
-
]).default("best") });
|
|
16592
|
-
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
16593
|
-
var NcThrottleSchema = object({
|
|
16594
|
-
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
16595
|
-
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
16596
|
-
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
16597
|
-
});
|
|
16598
|
-
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
16599
|
-
var NcRuleInputSchema = object({
|
|
16600
|
-
name: string().min(1).max(200),
|
|
16601
|
-
enabled: boolean().default(true),
|
|
16602
|
-
delivery: NcDeliverySchema,
|
|
16603
|
-
conditions: NcConditionsSchema.default({}),
|
|
16604
|
-
schedule: NcScheduleSchema.optional(),
|
|
16605
|
-
targets: array(NcRuleTargetSchema).min(1),
|
|
16606
|
-
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
16607
|
-
throttle: NcThrottleSchema.default({
|
|
16608
|
-
cooldownSec: 60,
|
|
16609
|
-
scope: "rule-device"
|
|
16610
|
-
}),
|
|
16611
|
-
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
16612
|
-
template: object({
|
|
16613
|
-
title: string().max(500).optional(),
|
|
16614
|
-
body: string().max(2e3).optional()
|
|
16615
|
-
}).optional(),
|
|
16616
|
-
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
16617
|
-
priority: number().int().min(1).max(5).default(3),
|
|
16750
|
+
var BrokerConnectionDetailsSchema = object({
|
|
16751
|
+
url: string(),
|
|
16752
|
+
username: string().optional(),
|
|
16753
|
+
password: string().optional(),
|
|
16618
16754
|
/**
|
|
16619
|
-
*
|
|
16620
|
-
*
|
|
16621
|
-
*
|
|
16755
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
16756
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
16757
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
16758
|
+
* broker).
|
|
16622
16759
|
*/
|
|
16623
|
-
|
|
16760
|
+
clientIdPrefix: string().optional()
|
|
16761
|
+
});
|
|
16762
|
+
var AddBrokerInputSchema = object({
|
|
16763
|
+
name: string().min(1),
|
|
16764
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
16765
|
+
username: string().optional(),
|
|
16766
|
+
password: string().optional(),
|
|
16767
|
+
clientIdPrefix: string().optional()
|
|
16768
|
+
});
|
|
16769
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
16770
|
+
var IdInputSchema = object({ id: string() });
|
|
16771
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
16772
|
+
ok: literal(true),
|
|
16773
|
+
latencyMs: number()
|
|
16774
|
+
}), object({
|
|
16775
|
+
ok: literal(false),
|
|
16776
|
+
error: string()
|
|
16777
|
+
})]);
|
|
16778
|
+
var StartEmbeddedInputSchema = object({
|
|
16779
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
16780
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
16781
|
+
allowAnonymous: boolean().default(false),
|
|
16782
|
+
/** Optional shared username/password for clients. */
|
|
16783
|
+
username: string().optional(),
|
|
16784
|
+
password: string().optional()
|
|
16785
|
+
});
|
|
16786
|
+
var StartEmbeddedResultSchema = object({
|
|
16787
|
+
id: string(),
|
|
16788
|
+
url: string()
|
|
16789
|
+
});
|
|
16790
|
+
var StatusSchema = object({
|
|
16791
|
+
brokerCount: number(),
|
|
16792
|
+
embeddedRunning: boolean()
|
|
16793
|
+
});
|
|
16794
|
+
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
|
|
16795
|
+
var NetworkEndpointSchema = object({
|
|
16796
|
+
url: string(),
|
|
16797
|
+
hostname: string(),
|
|
16798
|
+
port: number(),
|
|
16799
|
+
protocol: _enum(["http", "https"])
|
|
16800
|
+
});
|
|
16801
|
+
var NetworkAccessStatusSchema = object({
|
|
16802
|
+
connected: boolean(),
|
|
16803
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
16804
|
+
error: string().optional()
|
|
16624
16805
|
});
|
|
16625
16806
|
/**
|
|
16626
|
-
*
|
|
16627
|
-
*
|
|
16628
|
-
*
|
|
16629
|
-
*
|
|
16630
|
-
*
|
|
16631
|
-
*
|
|
16632
|
-
* `updateRule` patch.
|
|
16807
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
16808
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
16809
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
16810
|
+
* the originating provider config (mode + sourcePort) so the
|
|
16811
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
16812
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
16633
16813
|
*/
|
|
16634
|
-
var
|
|
16635
|
-
/** A persisted rule. */
|
|
16636
|
-
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
16637
|
-
id: string(),
|
|
16638
|
-
/** userId of the admin who created the rule (server-stamped caller). */
|
|
16639
|
-
createdBy: string(),
|
|
16640
|
-
createdAt: number(),
|
|
16641
|
-
updatedAt: number(),
|
|
16814
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
16642
16815
|
/**
|
|
16643
|
-
*
|
|
16644
|
-
*
|
|
16645
|
-
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
16816
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
16817
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
16646
16818
|
*/
|
|
16647
|
-
|
|
16648
|
-
|
|
16649
|
-
|
|
16650
|
-
|
|
16651
|
-
|
|
16652
|
-
|
|
16653
|
-
|
|
16654
|
-
"device-event",
|
|
16655
|
-
"package-event"
|
|
16656
|
-
]),
|
|
16657
|
-
deviceId: number(),
|
|
16658
|
-
timestamp: number(),
|
|
16659
|
-
wouldFire: boolean(),
|
|
16660
|
-
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
16661
|
-
failedCondition: string().optional(),
|
|
16662
|
-
className: string().optional(),
|
|
16663
|
-
label: string().optional()
|
|
16819
|
+
id: string(),
|
|
16820
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
16821
|
+
label: string(),
|
|
16822
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
16823
|
+
mode: string().optional(),
|
|
16824
|
+
/** Originating local port the ingress fronts (informational). */
|
|
16825
|
+
sourcePort: number().optional()
|
|
16664
16826
|
});
|
|
16665
|
-
|
|
16666
|
-
|
|
16827
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
16828
|
+
/**
|
|
16829
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
16830
|
+
*
|
|
16831
|
+
* Apprise-derived model (see
|
|
16832
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
16833
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
16834
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16835
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
16836
|
+
* message to what the kind supports — callers never special-case a service.
|
|
16837
|
+
*
|
|
16838
|
+
* DESIGN DECISIONS (locked):
|
|
16839
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
16840
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
16841
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
16842
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
16843
|
+
* alternative would fork the UI per addon and cannot host the
|
|
16844
|
+
* discovery→adopt flow.
|
|
16845
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
16846
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
16847
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
16848
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
16849
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
16850
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
16851
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
16852
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
16853
|
+
* base64 fallback needed.
|
|
16854
|
+
*
|
|
16855
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
16856
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
16857
|
+
* admin "Integrations" page.
|
|
16858
|
+
*/
|
|
16859
|
+
/**
|
|
16860
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
16861
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
16862
|
+
*/
|
|
16863
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
16864
|
+
"image",
|
|
16865
|
+
"video",
|
|
16866
|
+
"gif",
|
|
16867
|
+
"audio",
|
|
16868
|
+
"icon"
|
|
16869
|
+
]);
|
|
16870
|
+
/**
|
|
16871
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
16872
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
16873
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
16874
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
16875
|
+
*/
|
|
16876
|
+
var AttachmentSchema = object({
|
|
16877
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
16878
|
+
url: string().optional(),
|
|
16879
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
16880
|
+
mime: string().optional(),
|
|
16881
|
+
name: string().optional()
|
|
16882
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
16883
|
+
var NotificationFormatSchema = _enum([
|
|
16884
|
+
"text",
|
|
16885
|
+
"markdown",
|
|
16886
|
+
"html"
|
|
16887
|
+
]);
|
|
16888
|
+
/** A single tap-through action button. */
|
|
16889
|
+
var NotificationActionSchema = object({
|
|
16890
|
+
id: string(),
|
|
16891
|
+
label: string(),
|
|
16892
|
+
url: string().optional()
|
|
16893
|
+
});
|
|
16894
|
+
/**
|
|
16895
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
16896
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
16897
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
16898
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
16899
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
16900
|
+
* `priority` for that one target.
|
|
16901
|
+
*/
|
|
16902
|
+
var NotificationSchema = object({
|
|
16903
|
+
body: string(),
|
|
16904
|
+
title: string().optional(),
|
|
16905
|
+
format: NotificationFormatSchema.default("text"),
|
|
16906
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16907
|
+
level: string().optional(),
|
|
16908
|
+
attachments: array(AttachmentSchema).optional(),
|
|
16909
|
+
clickUrl: string().optional(),
|
|
16910
|
+
actions: array(NotificationActionSchema).optional(),
|
|
16911
|
+
sound: string().optional(),
|
|
16912
|
+
ttl: number().optional(),
|
|
16913
|
+
tag: string().optional(),
|
|
16914
|
+
deviceId: number().optional(),
|
|
16915
|
+
eventId: string().optional(),
|
|
16916
|
+
metadata: record(string(), unknown()).optional()
|
|
16917
|
+
});
|
|
16918
|
+
/** One declared native severity/priority level for a kind. */
|
|
16919
|
+
var TargetKindLevelSchema = object({
|
|
16667
16920
|
id: string(),
|
|
16668
|
-
group: _enum([
|
|
16669
|
-
"scope",
|
|
16670
|
-
"class",
|
|
16671
|
-
"zones",
|
|
16672
|
-
"quality",
|
|
16673
|
-
"label",
|
|
16674
|
-
"schedule",
|
|
16675
|
-
"device",
|
|
16676
|
-
"package",
|
|
16677
|
-
"occupancy"
|
|
16678
|
-
]),
|
|
16679
16921
|
label: string(),
|
|
16680
|
-
/**
|
|
16681
|
-
|
|
16682
|
-
|
|
16683
|
-
|
|
16684
|
-
|
|
16685
|
-
|
|
16686
|
-
|
|
16687
|
-
|
|
16688
|
-
|
|
16689
|
-
"schedule",
|
|
16690
|
-
"plateMatcher",
|
|
16691
|
-
"packagePhase",
|
|
16692
|
-
"polygonDraw",
|
|
16693
|
-
"occupancy"
|
|
16694
|
-
]),
|
|
16695
|
-
operator: _enum([
|
|
16696
|
-
"in",
|
|
16697
|
-
"notIn",
|
|
16698
|
-
"anyOf",
|
|
16699
|
-
"allOf",
|
|
16700
|
-
"gte",
|
|
16701
|
-
"fuzzyIn",
|
|
16702
|
-
"withinSchedule"
|
|
16703
|
-
]),
|
|
16704
|
-
/** Which delivery kinds the condition applies to. */
|
|
16705
|
-
appliesTo: array(NcDeliverySchema),
|
|
16706
|
-
phase: string(),
|
|
16922
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
16923
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
16924
|
+
flags: object({
|
|
16925
|
+
critical: boolean().optional(),
|
|
16926
|
+
silent: boolean().optional(),
|
|
16927
|
+
noPush: boolean().optional()
|
|
16928
|
+
}).optional(),
|
|
16929
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
16930
|
+
requires: array(string()).optional(),
|
|
16707
16931
|
description: string().optional()
|
|
16708
16932
|
});
|
|
16933
|
+
/** The full capability block consulted before dispatch. */
|
|
16934
|
+
var TargetKindCapsSchema = object({
|
|
16935
|
+
attachments: object({
|
|
16936
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
16937
|
+
mode: _enum([
|
|
16938
|
+
"url",
|
|
16939
|
+
"bytes",
|
|
16940
|
+
"both"
|
|
16941
|
+
]),
|
|
16942
|
+
max: number().int().nonnegative(),
|
|
16943
|
+
maxBytes: number().int().positive().optional()
|
|
16944
|
+
}),
|
|
16945
|
+
/** Max action buttons (0 = none). */
|
|
16946
|
+
actions: number().int().nonnegative(),
|
|
16947
|
+
levels: array(TargetKindLevelSchema),
|
|
16948
|
+
format: array(NotificationFormatSchema),
|
|
16949
|
+
clickUrl: boolean(),
|
|
16950
|
+
sound: boolean(),
|
|
16951
|
+
ttl: boolean(),
|
|
16952
|
+
bodyMaxLen: number().int().positive()
|
|
16953
|
+
});
|
|
16709
16954
|
/**
|
|
16710
|
-
*
|
|
16711
|
-
*
|
|
16712
|
-
*
|
|
16713
|
-
*
|
|
16714
|
-
*
|
|
16715
|
-
* backend rejection / a deleted target (terminal; carries
|
|
16716
|
-
* the failure `error`)
|
|
16717
|
-
*
|
|
16718
|
-
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
16719
|
-
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
16955
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
16956
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
16957
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
16958
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
16959
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
16720
16960
|
*/
|
|
16721
|
-
var
|
|
16722
|
-
|
|
16723
|
-
|
|
16724
|
-
|
|
16725
|
-
|
|
16726
|
-
/**
|
|
16727
|
-
|
|
16728
|
-
|
|
16729
|
-
|
|
16730
|
-
|
|
16731
|
-
"package-event"
|
|
16732
|
-
]);
|
|
16733
|
-
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
16734
|
-
var NcHistorySubjectSchema = object({
|
|
16735
|
-
className: string(),
|
|
16736
|
-
label: string().optional(),
|
|
16737
|
-
confidence: number().optional(),
|
|
16738
|
-
zones: array(string()),
|
|
16739
|
-
timestamp: number()
|
|
16961
|
+
var ConfigSchemaPassthrough = unknown();
|
|
16962
|
+
var TargetKindSchema = object({
|
|
16963
|
+
kind: string(),
|
|
16964
|
+
label: string(),
|
|
16965
|
+
icon: string(),
|
|
16966
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16967
|
+
addonId: string(),
|
|
16968
|
+
configSchema: ConfigSchemaPassthrough,
|
|
16969
|
+
supportsDiscovery: boolean(),
|
|
16970
|
+
caps: TargetKindCapsSchema
|
|
16740
16971
|
});
|
|
16741
16972
|
/**
|
|
16742
|
-
*
|
|
16743
|
-
*
|
|
16744
|
-
*
|
|
16745
|
-
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
16746
|
-
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
16747
|
-
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
16748
|
-
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
16749
|
-
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
16750
|
-
* P1 (admin scope only).
|
|
16973
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
16974
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
16975
|
+
* round-trip a stored secret to the UI.
|
|
16751
16976
|
*/
|
|
16752
|
-
var
|
|
16753
|
-
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
16977
|
+
var TargetSchema = object({
|
|
16754
16978
|
id: string(),
|
|
16755
|
-
|
|
16756
|
-
|
|
16757
|
-
|
|
16758
|
-
|
|
16759
|
-
|
|
16760
|
-
targetId: string(),
|
|
16761
|
-
deviceId: number(),
|
|
16762
|
-
recordKind: NcHistoryRecordKindSchema,
|
|
16763
|
-
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
16764
|
-
recordId: string(),
|
|
16765
|
-
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
16766
|
-
trackId: string().optional(),
|
|
16767
|
-
status: NcHistoryStatusSchema,
|
|
16768
|
-
/** Delivery attempts made so far. */
|
|
16769
|
-
attempts: number().int(),
|
|
16770
|
-
/** Fire time (outbox enqueue). */
|
|
16771
|
-
createdAt: number(),
|
|
16772
|
-
/** Last transition time (terminal for sent / dead). */
|
|
16773
|
-
updatedAt: number(),
|
|
16774
|
-
/** Failure detail — present on a `dead` row. */
|
|
16775
|
-
error: string().optional(),
|
|
16776
|
-
subject: NcHistorySubjectSchema
|
|
16979
|
+
name: string(),
|
|
16980
|
+
kind: string(),
|
|
16981
|
+
addonId: string(),
|
|
16982
|
+
enabled: boolean(),
|
|
16983
|
+
config: record(string(), unknown())
|
|
16777
16984
|
});
|
|
16778
|
-
/**
|
|
16779
|
-
|
|
16780
|
-
|
|
16781
|
-
|
|
16782
|
-
|
|
16783
|
-
*/
|
|
16784
|
-
var NcHistoryFilterSchema = object({
|
|
16785
|
-
ruleId: string().optional(),
|
|
16786
|
-
deviceId: number().optional(),
|
|
16787
|
-
status: NcHistoryStatusSchema.optional(),
|
|
16788
|
-
since: number().optional(),
|
|
16789
|
-
until: number().optional(),
|
|
16790
|
-
limit: number().int().min(1).max(500).default(100)
|
|
16985
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
16986
|
+
var DiscoveredTargetSchema = object({
|
|
16987
|
+
kind: string(),
|
|
16988
|
+
suggestedName: string(),
|
|
16989
|
+
config: record(string(), unknown())
|
|
16791
16990
|
});
|
|
16792
|
-
|
|
16793
|
-
|
|
16794
|
-
|
|
16795
|
-
|
|
16796
|
-
|
|
16797
|
-
|
|
16798
|
-
|
|
16799
|
-
|
|
16800
|
-
|
|
16801
|
-
|
|
16802
|
-
|
|
16803
|
-
|
|
16804
|
-
|
|
16805
|
-
|
|
16806
|
-
|
|
16807
|
-
|
|
16991
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
16992
|
+
var RenderedAsSchema = object({
|
|
16993
|
+
level: string(),
|
|
16994
|
+
format: NotificationFormatSchema,
|
|
16995
|
+
attachmentsSent: number().int().nonnegative(),
|
|
16996
|
+
actionsSent: number().int().nonnegative(),
|
|
16997
|
+
truncated: boolean(),
|
|
16998
|
+
dropped: array(string())
|
|
16999
|
+
});
|
|
17000
|
+
var SendResultSchema = object({
|
|
17001
|
+
success: boolean(),
|
|
17002
|
+
error: string().optional(),
|
|
17003
|
+
renderedAs: RenderedAsSchema.optional()
|
|
17004
|
+
});
|
|
17005
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
17006
|
+
var TestResultSchema = SendResultSchema;
|
|
17007
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
17008
|
+
kind: string(),
|
|
17009
|
+
config: record(string(), unknown()).optional()
|
|
17010
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
17011
|
+
targetId: string(),
|
|
17012
|
+
notification: NotificationSchema
|
|
17013
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
17014
|
+
targetId: string(),
|
|
17015
|
+
sample: NotificationSchema.optional()
|
|
17016
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
17017
|
+
targetId: string(),
|
|
16808
17018
|
enabled: boolean()
|
|
16809
|
-
}),
|
|
16810
|
-
kind: "mutation",
|
|
16811
|
-
auth: "admin"
|
|
16812
|
-
}), method(object({
|
|
16813
|
-
rule: NcRuleInputSchema,
|
|
16814
|
-
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
16815
|
-
}), object({ results: array(NcTestResultSchema) }), {
|
|
16816
|
-
kind: "mutation",
|
|
16817
|
-
auth: "admin"
|
|
16818
|
-
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
17019
|
+
}), _void(), { kind: "mutation" });
|
|
16819
17020
|
/**
|
|
16820
17021
|
* Zod schemas for persisted record types.
|
|
16821
17022
|
*
|
|
@@ -21826,6 +22027,12 @@ Object.freeze({
|
|
|
21826
22027
|
addonId: null,
|
|
21827
22028
|
access: "delete"
|
|
21828
22029
|
},
|
|
22030
|
+
"backup.deleteSchedule": {
|
|
22031
|
+
capName: "backup",
|
|
22032
|
+
capScope: "system",
|
|
22033
|
+
addonId: null,
|
|
22034
|
+
access: "delete"
|
|
22035
|
+
},
|
|
21829
22036
|
"backup.getEntries": {
|
|
21830
22037
|
capName: "backup",
|
|
21831
22038
|
capScope: "system",
|
|
@@ -21856,6 +22063,12 @@ Object.freeze({
|
|
|
21856
22063
|
addonId: null,
|
|
21857
22064
|
access: "view"
|
|
21858
22065
|
},
|
|
22066
|
+
"backup.listSchedules": {
|
|
22067
|
+
capName: "backup",
|
|
22068
|
+
capScope: "system",
|
|
22069
|
+
addonId: null,
|
|
22070
|
+
access: "view"
|
|
22071
|
+
},
|
|
21859
22072
|
"backup.previewSchedule": {
|
|
21860
22073
|
capName: "backup",
|
|
21861
22074
|
capScope: "system",
|
|
@@ -21880,6 +22093,12 @@ Object.freeze({
|
|
|
21880
22093
|
addonId: null,
|
|
21881
22094
|
access: "create"
|
|
21882
22095
|
},
|
|
22096
|
+
"backup.upsertSchedule": {
|
|
22097
|
+
capName: "backup",
|
|
22098
|
+
capScope: "system",
|
|
22099
|
+
addonId: null,
|
|
22100
|
+
access: "create"
|
|
22101
|
+
},
|
|
21883
22102
|
"battery.wakeForStream": {
|
|
21884
22103
|
capName: "battery",
|
|
21885
22104
|
capScope: "device",
|
|
@@ -25714,6 +25933,36 @@ Object.freeze({
|
|
|
25714
25933
|
addonId: null,
|
|
25715
25934
|
access: "create"
|
|
25716
25935
|
},
|
|
25936
|
+
"terminalSession.close": {
|
|
25937
|
+
capName: "terminal-session",
|
|
25938
|
+
capScope: "system",
|
|
25939
|
+
addonId: null,
|
|
25940
|
+
access: "create"
|
|
25941
|
+
},
|
|
25942
|
+
"terminalSession.listProfiles": {
|
|
25943
|
+
capName: "terminal-session",
|
|
25944
|
+
capScope: "system",
|
|
25945
|
+
addonId: null,
|
|
25946
|
+
access: "view"
|
|
25947
|
+
},
|
|
25948
|
+
"terminalSession.listSessions": {
|
|
25949
|
+
capName: "terminal-session",
|
|
25950
|
+
capScope: "system",
|
|
25951
|
+
addonId: null,
|
|
25952
|
+
access: "view"
|
|
25953
|
+
},
|
|
25954
|
+
"terminalSession.openSession": {
|
|
25955
|
+
capName: "terminal-session",
|
|
25956
|
+
capScope: "system",
|
|
25957
|
+
addonId: null,
|
|
25958
|
+
access: "create"
|
|
25959
|
+
},
|
|
25960
|
+
"terminalSession.resize": {
|
|
25961
|
+
capName: "terminal-session",
|
|
25962
|
+
capScope: "system",
|
|
25963
|
+
addonId: null,
|
|
25964
|
+
access: "create"
|
|
25965
|
+
},
|
|
25717
25966
|
"toast.onToast": {
|
|
25718
25967
|
capName: "toast",
|
|
25719
25968
|
capScope: "system",
|