@camstack/addon-provider-dreame 0.2.5 → 0.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/addon.js +2405 -2156
- package/dist/addon.mjs +2405 -2156
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -7570,16 +7570,23 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7570
7570
|
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7571
7571
|
* FRESH install:
|
|
7572
7572
|
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7573
|
-
* the appData volume. Right for small/durable data (
|
|
7573
|
+
* the appData volume. Right for small/durable data (logs, models).
|
|
7574
7574
|
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7575
7575
|
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7576
7576
|
* (recordings, event media) that should stay off the appData disk.
|
|
7577
|
+
* - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
|
|
7578
|
+
* `/backups` in the image) so archives live on their own mount rather than
|
|
7579
|
+
* filling the appData disk. Falls back to the data root when unset.
|
|
7577
7580
|
*
|
|
7578
7581
|
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7579
7582
|
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7580
7583
|
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7581
7584
|
*/
|
|
7582
|
-
defaultRoot: _enum([
|
|
7585
|
+
defaultRoot: _enum([
|
|
7586
|
+
"data",
|
|
7587
|
+
"media",
|
|
7588
|
+
"backup"
|
|
7589
|
+
]).optional()
|
|
7583
7590
|
});
|
|
7584
7591
|
var DecoderStatsSchema = object({
|
|
7585
7592
|
inputFps: number(),
|
|
@@ -9173,674 +9180,1312 @@ function shallowEqual(a, b) {
|
|
|
9173
9180
|
return true;
|
|
9174
9181
|
}
|
|
9175
9182
|
/**
|
|
9176
|
-
*
|
|
9177
|
-
*
|
|
9178
|
-
*
|
|
9179
|
-
*
|
|
9180
|
-
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
9181
|
-
* their own slices.
|
|
9183
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
9184
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
9185
|
+
* language so a single drawing-plane editor and the providers stay
|
|
9186
|
+
* decoupled from each cap's storage.
|
|
9182
9187
|
*
|
|
9183
|
-
*
|
|
9184
|
-
*
|
|
9185
|
-
* `
|
|
9186
|
-
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
9187
|
-
* consumers reach the same data via the `device-state` cap router
|
|
9188
|
-
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
9188
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
9189
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
9190
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
9189
9191
|
*/
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9192
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
9193
|
+
var MaskPointSchema = object({
|
|
9194
|
+
x: number(),
|
|
9195
|
+
y: number()
|
|
9196
|
+
});
|
|
9197
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
9198
|
+
var MaskRectShapeSchema = object({
|
|
9199
|
+
kind: literal("rect"),
|
|
9200
|
+
x: number(),
|
|
9201
|
+
y: number(),
|
|
9202
|
+
width: number(),
|
|
9203
|
+
height: number()
|
|
9204
|
+
});
|
|
9205
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
9206
|
+
var MaskPolygonShapeSchema = object({
|
|
9207
|
+
kind: literal("polygon"),
|
|
9208
|
+
points: array(MaskPointSchema)
|
|
9209
|
+
});
|
|
9210
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
9211
|
+
var MaskGridShapeSchema = object({
|
|
9212
|
+
kind: literal("grid"),
|
|
9213
|
+
gridWidth: number(),
|
|
9214
|
+
gridHeight: number(),
|
|
9215
|
+
cells: array(boolean())
|
|
9216
|
+
});
|
|
9217
|
+
discriminatedUnion("kind", [
|
|
9218
|
+
MaskRectShapeSchema,
|
|
9219
|
+
MaskPolygonShapeSchema,
|
|
9220
|
+
MaskGridShapeSchema,
|
|
9221
|
+
object({
|
|
9222
|
+
kind: literal("line"),
|
|
9223
|
+
points: array(MaskPointSchema)
|
|
9224
|
+
})
|
|
9225
|
+
]);
|
|
9226
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
9227
|
+
var MaskShapeKindSchema = _enum([
|
|
9228
|
+
"rect",
|
|
9229
|
+
"polygon",
|
|
9230
|
+
"grid",
|
|
9231
|
+
"line"
|
|
9232
|
+
]);
|
|
9233
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
9234
|
+
var MaskPolygonVerticesSchema = object({
|
|
9235
|
+
min: number(),
|
|
9236
|
+
max: number()
|
|
9237
|
+
});
|
|
9238
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
9239
|
+
var MaskGridDimsSchema = object({
|
|
9240
|
+
width: number(),
|
|
9241
|
+
height: number()
|
|
9202
9242
|
});
|
|
9203
|
-
var deviceStatusCapability = {
|
|
9204
|
-
name: "device-status",
|
|
9205
|
-
scope: "device",
|
|
9206
|
-
deviceNative: true,
|
|
9207
|
-
mode: "singleton",
|
|
9208
|
-
methods: {},
|
|
9209
|
-
events: {
|
|
9210
|
-
/** Emitted when `online` transitions. Mirrors the semantics of
|
|
9211
|
-
* `battery.onStatusChanged`. */
|
|
9212
|
-
onStatusChanged: { data: object({
|
|
9213
|
-
deviceId: number(),
|
|
9214
|
-
status: DeviceStatusSchema
|
|
9215
|
-
}) } },
|
|
9216
|
-
status: {
|
|
9217
|
-
schema: DeviceStatusSchema,
|
|
9218
|
-
kind: "push"
|
|
9219
|
-
},
|
|
9220
|
-
runtimeState: DeviceStatusSchema
|
|
9221
|
-
};
|
|
9222
9243
|
/**
|
|
9223
|
-
*
|
|
9224
|
-
* truth about what a device CAN do — which the kernel uses to:
|
|
9225
|
-
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
9226
|
-
* based on what the firmware actually advertises).
|
|
9227
|
-
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
9228
|
-
* `device-manager.listAll`.
|
|
9229
|
-
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
9230
|
-
* to register on the device's capability surface.
|
|
9244
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
9231
9245
|
*
|
|
9232
|
-
*
|
|
9233
|
-
*
|
|
9234
|
-
* accessory reconciliation). Consumers read via:
|
|
9235
|
-
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
9246
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
9247
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
9236
9248
|
*
|
|
9237
|
-
*
|
|
9238
|
-
*
|
|
9239
|
-
*
|
|
9249
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
9250
|
+
* `notification-center` module), hooked on the durable persistence
|
|
9251
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
9252
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
9253
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
9254
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
9255
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
9256
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
9257
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
9258
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
9259
|
+
* target kind's own caps/degrade engine).
|
|
9240
9260
|
*
|
|
9241
|
-
*
|
|
9242
|
-
*
|
|
9243
|
-
*
|
|
9244
|
-
*
|
|
9261
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
9262
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
9263
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
9264
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
9265
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
9266
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
9267
|
+
* P2+ (see spec §7).
|
|
9268
|
+
*
|
|
9269
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
9270
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
9271
|
+
* schema/interface drift is explicitly not repeated).
|
|
9245
9272
|
*/
|
|
9246
|
-
|
|
9273
|
+
/**
|
|
9274
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
9275
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
9276
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
9277
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
9278
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
9279
|
+
* change of a LINKED device, one row per linked camera)
|
|
9280
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
9281
|
+
* delivery / pick-up)
|
|
9282
|
+
*
|
|
9283
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
9284
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
9285
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
9286
|
+
* one trigger.
|
|
9287
|
+
*/
|
|
9288
|
+
var NcDeliverySchema = _enum([
|
|
9289
|
+
"immediate",
|
|
9290
|
+
"track-end",
|
|
9291
|
+
"device-event",
|
|
9292
|
+
"package-event"
|
|
9293
|
+
]);
|
|
9294
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
9295
|
+
var NcScheduleSchema = object({
|
|
9296
|
+
windows: array(object({
|
|
9297
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
9298
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
9299
|
+
startMinute: number().int().min(0).max(1439),
|
|
9300
|
+
endMinute: number().int().min(0).max(1439)
|
|
9301
|
+
})).min(1),
|
|
9302
|
+
/** IANA timezone; default = hub host timezone. */
|
|
9303
|
+
timezone: string().optional(),
|
|
9304
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
9305
|
+
invert: boolean().optional()
|
|
9306
|
+
});
|
|
9307
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
9308
|
+
var NcPlateMatcherSchema = object({
|
|
9309
|
+
values: array(string().min(1)).min(1),
|
|
9310
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9311
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9312
|
+
});
|
|
9313
|
+
/**
|
|
9314
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9315
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9316
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9317
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9318
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9319
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9320
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9321
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9322
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9323
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9324
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9325
|
+
*/
|
|
9326
|
+
var NcOccupancyConditionSchema = object({
|
|
9327
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9328
|
+
zoneId: string().optional(),
|
|
9329
|
+
/** Object class to count; absent = any class. */
|
|
9330
|
+
className: string().optional(),
|
|
9331
|
+
op: _enum([
|
|
9332
|
+
"became-occupied",
|
|
9333
|
+
"became-free",
|
|
9334
|
+
">=",
|
|
9335
|
+
"<="
|
|
9336
|
+
]).default("became-occupied"),
|
|
9337
|
+
count: number().int().min(0).default(1),
|
|
9338
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9339
|
+
});
|
|
9340
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9341
|
+
var NcZoneConditionSchema = object({
|
|
9342
|
+
ids: array(string().min(1)).min(1),
|
|
9343
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9344
|
+
match: _enum(["any", "all"]).default("any")
|
|
9345
|
+
});
|
|
9346
|
+
/**
|
|
9347
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9348
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9349
|
+
*/
|
|
9350
|
+
var NcConditionsSchema = object({
|
|
9351
|
+
/** Device scope — absent = all devices. */
|
|
9352
|
+
devices: array(number()).optional(),
|
|
9353
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9354
|
+
classes: array(string().min(1)).optional(),
|
|
9355
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9356
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9357
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9358
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9359
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9360
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9361
|
+
/** Veto zones — any hit fails the rule. */
|
|
9362
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
9247
9363
|
/**
|
|
9248
|
-
*
|
|
9249
|
-
*
|
|
9250
|
-
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
9251
|
-
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
9252
|
-
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9364
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9365
|
+
* (identity name / plate text / subclass).
|
|
9253
9366
|
*/
|
|
9254
|
-
|
|
9367
|
+
labelEquals: array(string().min(1)).optional(),
|
|
9255
9368
|
/**
|
|
9256
|
-
*
|
|
9257
|
-
*
|
|
9258
|
-
*
|
|
9369
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9370
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9371
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
9259
9372
|
*/
|
|
9260
|
-
|
|
9261
|
-
/**
|
|
9262
|
-
|
|
9263
|
-
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
9264
|
-
channelCount: number().nullable(),
|
|
9373
|
+
identities: array(string().min(1)).optional(),
|
|
9374
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9375
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
9265
9376
|
/**
|
|
9266
|
-
*
|
|
9267
|
-
*
|
|
9268
|
-
*
|
|
9269
|
-
*
|
|
9377
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9378
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9379
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9380
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
9270
9381
|
*/
|
|
9271
|
-
|
|
9382
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
9272
9383
|
/**
|
|
9273
|
-
*
|
|
9274
|
-
*
|
|
9275
|
-
*
|
|
9384
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9385
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9386
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9387
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9388
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9389
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9390
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9276
9391
|
*/
|
|
9277
|
-
|
|
9392
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9393
|
+
/**
|
|
9394
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9395
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9396
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9397
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9398
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9399
|
+
*/
|
|
9400
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9401
|
+
/**
|
|
9402
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9403
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9404
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9405
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9406
|
+
* tracks carry `sensor`.
|
|
9407
|
+
*/
|
|
9408
|
+
source: _enum([
|
|
9409
|
+
"pipeline",
|
|
9410
|
+
"onboard",
|
|
9411
|
+
"sensor",
|
|
9412
|
+
"any"
|
|
9413
|
+
]).optional(),
|
|
9414
|
+
/**
|
|
9415
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9416
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9417
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9418
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9419
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9420
|
+
*
|
|
9421
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9422
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9423
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9424
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9425
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9426
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9427
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9428
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9429
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9430
|
+
* closed for it (an un-recognized subject).
|
|
9431
|
+
*/
|
|
9432
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9433
|
+
/**
|
|
9434
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9435
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9436
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9437
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9438
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9439
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9440
|
+
*/
|
|
9441
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9442
|
+
/**
|
|
9443
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9444
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9445
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9446
|
+
*/
|
|
9447
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9448
|
+
/**
|
|
9449
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9450
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9451
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9452
|
+
* on the package-event trigger).
|
|
9453
|
+
*/
|
|
9454
|
+
packagePhase: _enum([
|
|
9455
|
+
"delivered",
|
|
9456
|
+
"picked-up",
|
|
9457
|
+
"both"
|
|
9458
|
+
]).optional(),
|
|
9459
|
+
/**
|
|
9460
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9461
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9462
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9463
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9464
|
+
*/
|
|
9465
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9466
|
+
/**
|
|
9467
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9468
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9469
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9470
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9471
|
+
*/
|
|
9472
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9473
|
+
});
|
|
9474
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9475
|
+
var NcRuleTargetSchema = object({
|
|
9476
|
+
/** `notification-output` Target id. */
|
|
9477
|
+
targetId: string().min(1),
|
|
9478
|
+
/**
|
|
9479
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9480
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9481
|
+
* degrade engine drops what the backend can't render.
|
|
9482
|
+
*/
|
|
9483
|
+
params: record(string(), unknown()).optional()
|
|
9278
9484
|
});
|
|
9279
|
-
var featureProbeCapability = {
|
|
9280
|
-
name: "feature-probe",
|
|
9281
|
-
scope: "device",
|
|
9282
|
-
deviceNative: true,
|
|
9283
|
-
mode: "singleton",
|
|
9284
|
-
methods: {},
|
|
9285
|
-
events: {
|
|
9286
|
-
/** Fires whenever a fresh probe completes (kernel-driven `reprobe()`
|
|
9287
|
-
* or driver-initiated re-detect after a state change). */
|
|
9288
|
-
onProbeChanged: { data: object({
|
|
9289
|
-
deviceId: number(),
|
|
9290
|
-
status: FeatureProbeStatusSchema
|
|
9291
|
-
}) } },
|
|
9292
|
-
status: {
|
|
9293
|
-
schema: FeatureProbeStatusSchema,
|
|
9294
|
-
kind: "push"
|
|
9295
|
-
},
|
|
9296
|
-
runtimeState: FeatureProbeStatusSchema
|
|
9297
|
-
};
|
|
9298
9485
|
/**
|
|
9299
|
-
*
|
|
9300
|
-
*
|
|
9301
|
-
*
|
|
9302
|
-
*
|
|
9303
|
-
*
|
|
9304
|
-
*
|
|
9305
|
-
*
|
|
9486
|
+
* Media attachment policy (P1 still-image subset).
|
|
9487
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9488
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9489
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9490
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9491
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9492
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9493
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9494
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9495
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9496
|
+
* - `none` — no attachment.
|
|
9306
9497
|
*/
|
|
9307
|
-
var
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
|
|
9316
|
-
/**
|
|
9317
|
-
|
|
9318
|
-
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
|
|
9498
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9499
|
+
"best",
|
|
9500
|
+
"best-matching",
|
|
9501
|
+
"keyFrame",
|
|
9502
|
+
"none"
|
|
9503
|
+
]).default("best") });
|
|
9504
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9505
|
+
var NcThrottleSchema = object({
|
|
9506
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9507
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9508
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9509
|
+
});
|
|
9510
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9511
|
+
var NcRuleInputSchema = object({
|
|
9512
|
+
name: string().min(1).max(200),
|
|
9513
|
+
enabled: boolean().default(true),
|
|
9514
|
+
delivery: NcDeliverySchema,
|
|
9515
|
+
conditions: NcConditionsSchema.default({}),
|
|
9516
|
+
schedule: NcScheduleSchema.optional(),
|
|
9517
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9518
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9519
|
+
throttle: NcThrottleSchema.default({
|
|
9520
|
+
cooldownSec: 60,
|
|
9521
|
+
scope: "rule-device"
|
|
9522
|
+
}),
|
|
9523
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9524
|
+
template: object({
|
|
9525
|
+
title: string().max(500).optional(),
|
|
9526
|
+
body: string().max(2e3).optional()
|
|
9527
|
+
}).optional(),
|
|
9528
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9529
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9530
|
+
/**
|
|
9531
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9532
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9533
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9534
|
+
*/
|
|
9535
|
+
ownerUserId: string().optional()
|
|
9330
9536
|
});
|
|
9331
|
-
var airQualitySensorCapability = {
|
|
9332
|
-
name: "air-quality-sensor",
|
|
9333
|
-
scope: "device",
|
|
9334
|
-
deviceNative: true,
|
|
9335
|
-
mode: "singleton",
|
|
9336
|
-
deviceTypes: [DeviceType.Sensor],
|
|
9337
|
-
methods: {},
|
|
9338
|
-
status: {
|
|
9339
|
-
schema: AirQualitySensorStatusSchema,
|
|
9340
|
-
kind: "push"
|
|
9341
|
-
},
|
|
9342
|
-
runtimeState: AirQualitySensorStatusSchema
|
|
9343
|
-
};
|
|
9344
9537
|
/**
|
|
9345
|
-
*
|
|
9346
|
-
* `
|
|
9347
|
-
*
|
|
9348
|
-
*
|
|
9349
|
-
*
|
|
9350
|
-
*
|
|
9351
|
-
* `
|
|
9352
|
-
* service; it's NEVER persisted in the runtime slice or any event
|
|
9353
|
-
* payload. The presence of a required code is signalled by
|
|
9354
|
-
* `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
|
|
9355
|
-
* field without a slice fetch.
|
|
9356
|
-
*
|
|
9357
|
-
* `availableModes` mirrors HA's `supported_features`-derived arm
|
|
9358
|
-
* mode list — the UI renders only the buttons the panel accepts.
|
|
9538
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9539
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9540
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9541
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9542
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9543
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9544
|
+
* `updateRule` patch.
|
|
9359
9545
|
*/
|
|
9360
|
-
var
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
"disarming",
|
|
9369
|
-
"pending",
|
|
9370
|
-
"triggered"
|
|
9371
|
-
]);
|
|
9372
|
-
var AlarmArmModeSchema = _enum([
|
|
9373
|
-
"home",
|
|
9374
|
-
"away",
|
|
9375
|
-
"night",
|
|
9376
|
-
"vacation",
|
|
9377
|
-
"custom_bypass"
|
|
9378
|
-
]);
|
|
9379
|
-
var AlarmPanelStatusSchema = object({
|
|
9380
|
-
/** Current lifecycle state. */
|
|
9381
|
-
state: AlarmStateSchema,
|
|
9382
|
-
/** Subset of arm modes the panel accepts. UI renders one button per
|
|
9383
|
-
* mode in this list. */
|
|
9384
|
-
availableModes: array(AlarmArmModeSchema),
|
|
9385
|
-
/** Whether the panel requires a PIN on arm / disarm. Mirrors
|
|
9386
|
-
* `DeviceFeature.AlarmPinRequired` for slice consumers. */
|
|
9387
|
-
requiresCode: boolean(),
|
|
9388
|
-
/** Ms epoch when the slice was last updated. */
|
|
9389
|
-
lastChangedAt: number()
|
|
9390
|
-
});
|
|
9391
|
-
var alarmPanelCapability = {
|
|
9392
|
-
name: "alarm-panel",
|
|
9393
|
-
scope: "device",
|
|
9394
|
-
deviceNative: true,
|
|
9395
|
-
mode: "singleton",
|
|
9396
|
-
deviceTypes: [DeviceType.AlarmPanel],
|
|
9397
|
-
methods: {
|
|
9398
|
-
arm: method(object({
|
|
9399
|
-
deviceId: number().int().nonnegative(),
|
|
9400
|
-
mode: AlarmArmModeSchema,
|
|
9401
|
-
/** Optional PIN code. Required when `requiresCode === true`.
|
|
9402
|
-
* Passed through to the upstream service; never persisted. */
|
|
9403
|
-
code: string().min(1).optional()
|
|
9404
|
-
}), _void(), {
|
|
9405
|
-
kind: "mutation",
|
|
9406
|
-
auth: "admin"
|
|
9407
|
-
}),
|
|
9408
|
-
disarm: method(object({
|
|
9409
|
-
deviceId: number().int().nonnegative(),
|
|
9410
|
-
code: string().min(1).optional()
|
|
9411
|
-
}), _void(), {
|
|
9412
|
-
kind: "mutation",
|
|
9413
|
-
auth: "admin"
|
|
9414
|
-
}),
|
|
9415
|
-
/**
|
|
9416
|
-
* Force the panel into the `triggered` state — used by HA
|
|
9417
|
-
* automations to surface external sensor events through the panel
|
|
9418
|
-
* (e.g. a Reolink camera intrusion event firing the security
|
|
9419
|
-
* system). Provider rejects when the panel hardware doesn't
|
|
9420
|
-
* support a software-initiated trigger.
|
|
9421
|
-
*/
|
|
9422
|
-
trigger: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
9423
|
-
kind: "mutation",
|
|
9424
|
-
auth: "admin"
|
|
9425
|
-
})
|
|
9426
|
-
},
|
|
9427
|
-
status: {
|
|
9428
|
-
schema: AlarmPanelStatusSchema,
|
|
9429
|
-
kind: "push"
|
|
9430
|
-
},
|
|
9546
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9547
|
+
/** A persisted rule. */
|
|
9548
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9549
|
+
id: string(),
|
|
9550
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9551
|
+
createdBy: string(),
|
|
9552
|
+
createdAt: number(),
|
|
9553
|
+
updatedAt: number(),
|
|
9431
9554
|
/**
|
|
9432
|
-
*
|
|
9433
|
-
*
|
|
9434
|
-
*
|
|
9555
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9556
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9557
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9435
9558
|
*/
|
|
9436
|
-
|
|
9437
|
-
};
|
|
9438
|
-
/**
|
|
9439
|
-
* Ambient illuminance reading in lux. Drives Home Assistant `sensor`
|
|
9440
|
-
* entries with `device_class: illuminance`.
|
|
9441
|
-
*/
|
|
9442
|
-
var AmbientLightSensorStatusSchema = object({
|
|
9443
|
-
/** Current illuminance in lux (lx). */
|
|
9444
|
-
lux: number().min(0),
|
|
9445
|
-
/** Ms epoch when the slice was last updated. */
|
|
9446
|
-
lastFetchedAt: number(),
|
|
9447
|
-
/** Live display unit from the upstream source (e.g. HA
|
|
9448
|
-
* `attributes.unit_of_measurement`). The UI prefers this over the
|
|
9449
|
-
* role's canonical unit. Absent → fall back to the canonical unit. */
|
|
9450
|
-
unit: string().optional(),
|
|
9451
|
-
/** Suggested decimal places for numeric display.
|
|
9452
|
-
* Populated live from the upstream source when provided (e.g. HA
|
|
9453
|
-
* `attributes.suggested_display_precision`). Falls back to
|
|
9454
|
-
* auto-formatting when absent. */
|
|
9455
|
-
precision: number().int().min(0).max(10).optional()
|
|
9559
|
+
disabledTargetIds: array(string()).default([])
|
|
9456
9560
|
});
|
|
9457
|
-
var
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
var
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9561
|
+
var NcTestResultSchema = object({
|
|
9562
|
+
recordId: string(),
|
|
9563
|
+
recordKind: _enum([
|
|
9564
|
+
"object-event",
|
|
9565
|
+
"track",
|
|
9566
|
+
"device-event",
|
|
9567
|
+
"package-event"
|
|
9568
|
+
]),
|
|
9569
|
+
deviceId: number(),
|
|
9570
|
+
timestamp: number(),
|
|
9571
|
+
wouldFire: boolean(),
|
|
9572
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9573
|
+
failedCondition: string().optional(),
|
|
9574
|
+
className: string().optional(),
|
|
9575
|
+
label: string().optional()
|
|
9576
|
+
});
|
|
9577
|
+
var NcConditionDescriptorSchema = object({
|
|
9578
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9579
|
+
id: string(),
|
|
9580
|
+
group: _enum([
|
|
9581
|
+
"scope",
|
|
9582
|
+
"class",
|
|
9583
|
+
"zones",
|
|
9584
|
+
"quality",
|
|
9585
|
+
"label",
|
|
9586
|
+
"schedule",
|
|
9587
|
+
"device",
|
|
9588
|
+
"package",
|
|
9589
|
+
"occupancy"
|
|
9590
|
+
]),
|
|
9591
|
+
label: string(),
|
|
9592
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9593
|
+
valueType: _enum([
|
|
9594
|
+
"deviceIdList",
|
|
9595
|
+
"stringList",
|
|
9596
|
+
"number01",
|
|
9597
|
+
"number",
|
|
9598
|
+
"sourceSelect",
|
|
9599
|
+
"zoneSelection",
|
|
9600
|
+
"zoneIdList",
|
|
9601
|
+
"schedule",
|
|
9602
|
+
"plateMatcher",
|
|
9603
|
+
"packagePhase",
|
|
9604
|
+
"polygonDraw",
|
|
9605
|
+
"occupancy"
|
|
9606
|
+
]),
|
|
9607
|
+
operator: _enum([
|
|
9608
|
+
"in",
|
|
9609
|
+
"notIn",
|
|
9610
|
+
"anyOf",
|
|
9611
|
+
"allOf",
|
|
9612
|
+
"gte",
|
|
9613
|
+
"fuzzyIn",
|
|
9614
|
+
"withinSchedule"
|
|
9615
|
+
]),
|
|
9616
|
+
/** Which delivery kinds the condition applies to. */
|
|
9617
|
+
appliesTo: array(NcDeliverySchema),
|
|
9618
|
+
phase: string(),
|
|
9619
|
+
description: string().optional()
|
|
9481
9620
|
});
|
|
9482
9621
|
/**
|
|
9483
|
-
*
|
|
9484
|
-
*
|
|
9485
|
-
*
|
|
9486
|
-
*
|
|
9487
|
-
*
|
|
9488
|
-
*
|
|
9622
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9623
|
+
* durable outbox row's own status (single source of truth):
|
|
9624
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9625
|
+
* - `sent` — delivered (terminal)
|
|
9626
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9627
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9628
|
+
* the failure `error`)
|
|
9489
9629
|
*
|
|
9490
|
-
*
|
|
9491
|
-
* (
|
|
9492
|
-
* and the level history shifts forward.
|
|
9630
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9631
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9493
9632
|
*/
|
|
9494
|
-
var
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
}).nullable(),
|
|
9514
|
-
/** Per-class summary across the rolling window — keys are
|
|
9515
|
-
* `macroClass` strings (e.g. `dog_bark`, `speech`, `glass_break`). */
|
|
9516
|
-
byClass: array(AudioClassSummarySchema).readonly()
|
|
9633
|
+
var NcHistoryStatusSchema = _enum([
|
|
9634
|
+
"pending",
|
|
9635
|
+
"sent",
|
|
9636
|
+
"dead"
|
|
9637
|
+
]);
|
|
9638
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9639
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9640
|
+
"object-event",
|
|
9641
|
+
"track-end",
|
|
9642
|
+
"device-event",
|
|
9643
|
+
"package-event"
|
|
9644
|
+
]);
|
|
9645
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9646
|
+
var NcHistorySubjectSchema = object({
|
|
9647
|
+
className: string(),
|
|
9648
|
+
label: string().optional(),
|
|
9649
|
+
confidence: number().optional(),
|
|
9650
|
+
zones: array(string()),
|
|
9651
|
+
timestamp: number()
|
|
9517
9652
|
});
|
|
9518
9653
|
/**
|
|
9519
|
-
*
|
|
9520
|
-
*
|
|
9521
|
-
*
|
|
9522
|
-
*
|
|
9523
|
-
*
|
|
9654
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9655
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9656
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9657
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9658
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9659
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9660
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9661
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9662
|
+
* P1 (admin scope only).
|
|
9524
9663
|
*/
|
|
9525
|
-
var
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9664
|
+
var NcHistoryEntrySchema = object({
|
|
9665
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9666
|
+
id: string(),
|
|
9667
|
+
ruleId: string(),
|
|
9668
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9669
|
+
ruleName: string(),
|
|
9670
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9671
|
+
delivery: NcDeliverySchema,
|
|
9672
|
+
targetId: string(),
|
|
9673
|
+
deviceId: number(),
|
|
9674
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9675
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9676
|
+
recordId: string(),
|
|
9677
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9678
|
+
trackId: string().optional(),
|
|
9679
|
+
status: NcHistoryStatusSchema,
|
|
9680
|
+
/** Delivery attempts made so far. */
|
|
9681
|
+
attempts: number().int(),
|
|
9682
|
+
/** Fire time (outbox enqueue). */
|
|
9683
|
+
createdAt: number(),
|
|
9684
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9685
|
+
updatedAt: number(),
|
|
9686
|
+
/** Failure detail — present on a `dead` row. */
|
|
9687
|
+
error: string().optional(),
|
|
9688
|
+
subject: NcHistorySubjectSchema
|
|
9547
9689
|
});
|
|
9548
9690
|
/**
|
|
9549
|
-
*
|
|
9550
|
-
*
|
|
9551
|
-
* (
|
|
9552
|
-
*
|
|
9553
|
-
* a custom event subscription.
|
|
9691
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9692
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9693
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9694
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9554
9695
|
*/
|
|
9555
|
-
var
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9696
|
+
var NcHistoryFilterSchema = object({
|
|
9697
|
+
ruleId: string().optional(),
|
|
9698
|
+
deviceId: number().optional(),
|
|
9699
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9700
|
+
since: number().optional(),
|
|
9701
|
+
until: number().optional(),
|
|
9702
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9703
|
+
});
|
|
9704
|
+
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 }), {
|
|
9705
|
+
kind: "mutation",
|
|
9706
|
+
auth: "admin",
|
|
9707
|
+
caller: "required"
|
|
9708
|
+
}), method(object({
|
|
9709
|
+
ruleId: string(),
|
|
9710
|
+
patch: NcRulePatchSchema
|
|
9711
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9712
|
+
kind: "mutation",
|
|
9713
|
+
auth: "admin",
|
|
9714
|
+
caller: "required"
|
|
9715
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9716
|
+
kind: "mutation",
|
|
9717
|
+
auth: "admin"
|
|
9718
|
+
}), method(object({
|
|
9719
|
+
ruleId: string(),
|
|
9720
|
+
enabled: boolean()
|
|
9721
|
+
}), object({ success: literal(true) }), {
|
|
9722
|
+
kind: "mutation",
|
|
9723
|
+
auth: "admin"
|
|
9724
|
+
}), method(object({
|
|
9725
|
+
rule: NcRuleInputSchema,
|
|
9726
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9727
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9728
|
+
kind: "mutation",
|
|
9729
|
+
auth: "admin"
|
|
9730
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9588
9731
|
/**
|
|
9589
|
-
*
|
|
9590
|
-
* `DeviceType.Automation`. An automation is a trigger+condition+
|
|
9591
|
-
* action rule that can be enabled / disabled and manually fired
|
|
9592
|
-
* via the `trigger` method.
|
|
9732
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9593
9733
|
*
|
|
9594
|
-
*
|
|
9595
|
-
*
|
|
9596
|
-
*
|
|
9597
|
-
*
|
|
9734
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
9735
|
+
* §3.2/§3.3.
|
|
9736
|
+
*
|
|
9737
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
9738
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
9739
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
9740
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
9741
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
9742
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
9743
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
9744
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
9745
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
9746
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
9747
|
+
*
|
|
9748
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
9749
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
9750
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
9751
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
9752
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
9598
9753
|
*/
|
|
9599
|
-
var
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
/** Ms epoch when the slice was last updated. */
|
|
9611
|
-
lastChangedAt: number()
|
|
9612
|
-
});
|
|
9613
|
-
var automationControlCapability = {
|
|
9614
|
-
name: "automation-control",
|
|
9615
|
-
scope: "device",
|
|
9616
|
-
deviceNative: true,
|
|
9617
|
-
mode: "singleton",
|
|
9618
|
-
deviceTypes: [DeviceType.Automation],
|
|
9619
|
-
methods: {
|
|
9620
|
-
enable: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
9621
|
-
kind: "mutation",
|
|
9622
|
-
auth: "admin"
|
|
9623
|
-
}),
|
|
9624
|
-
disable: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
9625
|
-
kind: "mutation",
|
|
9626
|
-
auth: "admin"
|
|
9627
|
-
}),
|
|
9628
|
-
trigger: method(object({
|
|
9629
|
-
deviceId: number().int().nonnegative(),
|
|
9630
|
-
/** When true, fires the action block while bypassing the
|
|
9631
|
-
* automation's condition evaluation. Gated by
|
|
9632
|
-
* `DeviceFeature.AutomationSkipCondition`. */
|
|
9633
|
-
skipCondition: boolean().optional()
|
|
9634
|
-
}), _void(), {
|
|
9635
|
-
kind: "mutation",
|
|
9636
|
-
auth: "admin"
|
|
9637
|
-
})
|
|
9638
|
-
},
|
|
9639
|
-
status: {
|
|
9640
|
-
schema: AutomationControlStatusSchema,
|
|
9641
|
-
kind: "push"
|
|
9642
|
-
},
|
|
9643
|
-
/**
|
|
9644
|
-
* Runtime-state slice — mirrored by the kernel. UI automation tile
|
|
9645
|
-
* reads `enabled` (toggle) + `isRunning` (spinner) + `lastError`
|
|
9646
|
-
* (badge) directly.
|
|
9647
|
-
*/
|
|
9648
|
-
runtimeState: AutomationControlStatusSchema
|
|
9649
|
-
};
|
|
9754
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
9755
|
+
var TimelapseTemplateSchema = object({
|
|
9756
|
+
title: string().max(500).optional(),
|
|
9757
|
+
body: string().max(2e3).optional()
|
|
9758
|
+
});
|
|
9759
|
+
var NameField = string().min(1).max(200);
|
|
9760
|
+
var DeviceIdsField = array(number()).min(1);
|
|
9761
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
9762
|
+
var FramerateField = number().int().min(1).max(60);
|
|
9763
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
9764
|
+
var PriorityField = number().int().min(1).max(5);
|
|
9650
9765
|
/**
|
|
9651
|
-
*
|
|
9652
|
-
*
|
|
9653
|
-
*
|
|
9654
|
-
* battery" alerting on top — the cap deliberately does NOT enforce a
|
|
9655
|
-
* threshold.
|
|
9766
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
9767
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
9768
|
+
* here (see the ownership note above).
|
|
9656
9769
|
*/
|
|
9657
|
-
var
|
|
9658
|
-
|
|
9659
|
-
|
|
9770
|
+
var TimelapseRuleInputSchema = object({
|
|
9771
|
+
name: NameField,
|
|
9772
|
+
enabled: boolean().default(true),
|
|
9773
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
9774
|
+
deviceIds: DeviceIdsField,
|
|
9775
|
+
/**
|
|
9776
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
9777
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
9778
|
+
* open clears the scratch, close assembles and delivers.
|
|
9779
|
+
*/
|
|
9780
|
+
schedule: NcScheduleSchema,
|
|
9781
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
9782
|
+
cadenceSec: CadenceSecField.default(15),
|
|
9783
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
9784
|
+
framerate: FramerateField.default(10),
|
|
9785
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
9786
|
+
targets: TargetsField,
|
|
9787
|
+
template: TimelapseTemplateSchema.optional(),
|
|
9788
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9789
|
+
priority: PriorityField.default(3)
|
|
9790
|
+
});
|
|
9791
|
+
object({
|
|
9792
|
+
name: NameField.optional(),
|
|
9793
|
+
enabled: boolean().optional(),
|
|
9794
|
+
deviceIds: DeviceIdsField.optional(),
|
|
9795
|
+
schedule: NcScheduleSchema.optional(),
|
|
9796
|
+
cadenceSec: CadenceSecField.optional(),
|
|
9797
|
+
framerate: FramerateField.optional(),
|
|
9798
|
+
targets: TargetsField.optional(),
|
|
9799
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
9800
|
+
priority: PriorityField.optional()
|
|
9801
|
+
});
|
|
9802
|
+
TimelapseRuleInputSchema.extend({
|
|
9803
|
+
id: string(),
|
|
9660
9804
|
/**
|
|
9661
|
-
*
|
|
9662
|
-
*
|
|
9663
|
-
*
|
|
9664
|
-
* alone.
|
|
9805
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
9806
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
9807
|
+
* resolved caller; never trusted from a client payload.
|
|
9665
9808
|
*/
|
|
9666
|
-
|
|
9667
|
-
"dc",
|
|
9668
|
-
"solar",
|
|
9669
|
-
"none"
|
|
9670
|
-
]),
|
|
9809
|
+
ownerUserId: string().optional(),
|
|
9671
9810
|
/**
|
|
9672
|
-
*
|
|
9673
|
-
*
|
|
9674
|
-
* wakes the camera up and drains charge.
|
|
9811
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
9812
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
9675
9813
|
*/
|
|
9676
|
-
|
|
9677
|
-
/**
|
|
9678
|
-
|
|
9814
|
+
lastGeneratedAt: number().optional(),
|
|
9815
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
9816
|
+
createdBy: string(),
|
|
9817
|
+
createdAt: number(),
|
|
9818
|
+
updatedAt: number()
|
|
9819
|
+
});
|
|
9820
|
+
/**
|
|
9821
|
+
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
9822
|
+
* for every device, regardless of provider — the kernel needs a uniform
|
|
9823
|
+
* cap-keyed slice for the basic device flags every consumer expects to
|
|
9824
|
+
* read across processes (the `online` flag in particular). Driver-specific
|
|
9825
|
+
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
9826
|
+
* their own slices.
|
|
9827
|
+
*
|
|
9828
|
+
* Pattern is identical to `battery`: schema-bearing `runtimeState`,
|
|
9829
|
+
* empty `methods`, single change event. Reads land at
|
|
9830
|
+
* `runtimeState.getCapState('device-status')`; writes at
|
|
9831
|
+
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
9832
|
+
* consumers reach the same data via the `device-state` cap router
|
|
9833
|
+
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
9834
|
+
*/
|
|
9835
|
+
var DeviceStatusSchema = object({
|
|
9679
9836
|
/**
|
|
9680
|
-
*
|
|
9681
|
-
* `
|
|
9682
|
-
*
|
|
9683
|
-
*
|
|
9684
|
-
*
|
|
9837
|
+
* Device-level liveness. Drivers flip via `markOnline(boolean)` on
|
|
9838
|
+
* `BaseDevice`. Provider semantics vary — RTSP aggregates broker
|
|
9839
|
+
* stream-health, Reolink reads firmware push events, ONVIF tracks
|
|
9840
|
+
* ping responses. This cap intentionally does NOT prescribe which
|
|
9841
|
+
* signal drives the flag.
|
|
9685
9842
|
*/
|
|
9686
|
-
|
|
9843
|
+
online: boolean(),
|
|
9844
|
+
/** Ms epoch of the last `online` transition. Lets consumers tell
|
|
9845
|
+
* apart "just came online" from "still online". */
|
|
9846
|
+
lastChangedAt: number()
|
|
9687
9847
|
});
|
|
9688
|
-
var
|
|
9689
|
-
name: "
|
|
9848
|
+
var deviceStatusCapability = {
|
|
9849
|
+
name: "device-status",
|
|
9690
9850
|
scope: "device",
|
|
9691
9851
|
deviceNative: true,
|
|
9692
9852
|
mode: "singleton",
|
|
9693
|
-
|
|
9694
|
-
DeviceType.Camera,
|
|
9695
|
-
DeviceType.Sensor,
|
|
9696
|
-
DeviceType.Button,
|
|
9697
|
-
DeviceType.Switch
|
|
9698
|
-
],
|
|
9699
|
-
methods: {
|
|
9700
|
-
/**
|
|
9701
|
-
* Explicitly wake the camera from low-power sleep ahead of a
|
|
9702
|
-
* streaming session start. Consumers that initiate a stream
|
|
9703
|
-
* against a sleeping battery cam (HomeKit Secure Video, Alexa
|
|
9704
|
-
* RTCSession, snapshot wrappers) call this with a short timeout
|
|
9705
|
-
* before establishing the media pipeline — the broker's own
|
|
9706
|
-
* passive wake-on-dial works but adds 5–7 seconds to first-frame,
|
|
9707
|
-
* during which the consumer renders a black screen. Pre-waking
|
|
9708
|
-
* compresses that gap.
|
|
9709
|
-
*
|
|
9710
|
-
* Returns `awoke: true` when the firmware acknowledged the wake
|
|
9711
|
-
* before `timeoutMs`. Returns `awoke: false` when it timed out OR
|
|
9712
|
-
* the cap surface is unavailable (no Baichuan / firmware
|
|
9713
|
-
* channel); the caller should still attempt the stream — the
|
|
9714
|
-
* passive broker wake remains as fallback.
|
|
9715
|
-
*/
|
|
9716
|
-
wakeForStream: method(object({
|
|
9717
|
-
deviceId: number(),
|
|
9718
|
-
/** Bound on the wait. Sensible range 3000–10000ms. */
|
|
9719
|
-
timeoutMs: number().int().min(500).max(3e4).default(8e3)
|
|
9720
|
-
}), object({
|
|
9721
|
-
awoke: boolean(),
|
|
9722
|
-
durationMs: number()
|
|
9723
|
-
}), { kind: "mutation" }) },
|
|
9853
|
+
methods: {},
|
|
9724
9854
|
events: {
|
|
9725
|
-
/**
|
|
9726
|
-
*
|
|
9727
|
-
* poll observes a delta). The DeviceEventPropagator mirrors this
|
|
9728
|
-
* event on the parent chain — subscribing to a camera's source
|
|
9729
|
-
* receives battery events from child accessories automatically.
|
|
9730
|
-
*/
|
|
9855
|
+
/** Emitted when `online` transitions. Mirrors the semantics of
|
|
9856
|
+
* `battery.onStatusChanged`. */
|
|
9731
9857
|
onStatusChanged: { data: object({
|
|
9732
9858
|
deviceId: number(),
|
|
9733
|
-
status:
|
|
9859
|
+
status: DeviceStatusSchema
|
|
9734
9860
|
}) } },
|
|
9735
9861
|
status: {
|
|
9736
|
-
schema:
|
|
9737
|
-
kind: "push"
|
|
9738
|
-
empty: {
|
|
9739
|
-
percentage: 0,
|
|
9740
|
-
charging: "none",
|
|
9741
|
-
sleeping: false,
|
|
9742
|
-
lastUpdated: 0
|
|
9743
|
-
}
|
|
9862
|
+
schema: DeviceStatusSchema,
|
|
9863
|
+
kind: "push"
|
|
9744
9864
|
},
|
|
9745
|
-
|
|
9746
|
-
* Runtime-state slice — every provider that registers this cap
|
|
9747
|
-
* stores the same shape under `device.runtimeState[battery]`.
|
|
9748
|
-
* Cross-provider uniformity: a Reolink Argus, a Frigate sensor
|
|
9749
|
-
* proxy, an ONVIF battery cam all read/write the same keys.
|
|
9750
|
-
* Consumers (BatteryBadge, snapshot wrapper sleep gate) read once
|
|
9751
|
-
* via `device.runtimeState.getCapState('battery')` regardless of
|
|
9752
|
-
* the underlying driver.
|
|
9753
|
-
*/
|
|
9754
|
-
runtimeState: BatteryStatusSchema
|
|
9865
|
+
runtimeState: DeviceStatusSchema
|
|
9755
9866
|
};
|
|
9756
9867
|
/**
|
|
9757
|
-
*
|
|
9758
|
-
*
|
|
9759
|
-
*
|
|
9760
|
-
*
|
|
9868
|
+
* Per-device feature/identity probe slice. Holds the runtime-resolved
|
|
9869
|
+
* truth about what a device CAN do — which the kernel uses to:
|
|
9870
|
+
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
9871
|
+
* based on what the firmware actually advertises).
|
|
9872
|
+
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
9873
|
+
* `device-manager.listAll`.
|
|
9874
|
+
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
9875
|
+
* to register on the device's capability surface.
|
|
9761
9876
|
*
|
|
9762
|
-
*
|
|
9763
|
-
*
|
|
9764
|
-
*
|
|
9765
|
-
*
|
|
9877
|
+
* Auto-registered by `BaseDevice` for every device. Drivers populate the
|
|
9878
|
+
* slice from `onProbe()` (kernel calls it once after register, before
|
|
9879
|
+
* accessory reconciliation). Consumers read via:
|
|
9880
|
+
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
9881
|
+
*
|
|
9882
|
+
* `flags` is an open record so each driver carries its own keys without
|
|
9883
|
+
* a centralized schema bottleneck — Reolink writes `hasPtz/hasIntercom`,
|
|
9884
|
+
* Hikvision writes `hasSupplementalLight/hasAlarmIo`, etc.
|
|
9885
|
+
*
|
|
9886
|
+
* Replaces the older driver-local `deviceCache.has*` blob: the per-device
|
|
9887
|
+
* config is for operator-edited overrides + UI snapshots; runtime probe
|
|
9888
|
+
* results belong in runtime-state where the kernel handles persistence,
|
|
9889
|
+
* cross-process mirroring, and reactive updates.
|
|
9766
9890
|
*/
|
|
9767
|
-
var
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9891
|
+
var FeatureProbeStatusSchema = object({
|
|
9892
|
+
/**
|
|
9893
|
+
* Driver-specific flag bag. Each driver picks its own key names — the
|
|
9894
|
+
* cap deliberately does NOT enforce a closed enum here. Reolink keys:
|
|
9895
|
+
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
9896
|
+
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
9897
|
+
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9898
|
+
*/
|
|
9899
|
+
flags: record(string(), unknown()),
|
|
9900
|
+
/**
|
|
9901
|
+
* Coarse driver-classification — lets cross-process consumers tell apart
|
|
9902
|
+
* cameras / battery-cams / NVRs without re-running the probe. `null`
|
|
9903
|
+
* before the first probe completes.
|
|
9904
|
+
*/
|
|
9905
|
+
deviceType: string().nullable(),
|
|
9906
|
+
/** Camera/firmware model string. `null` when the firmware doesn't expose it. */
|
|
9907
|
+
model: string().nullable(),
|
|
9908
|
+
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
9909
|
+
channelCount: number().nullable(),
|
|
9910
|
+
/**
|
|
9911
|
+
* Ms epoch of the last SUCCESSFUL probe. `0` before the first probe
|
|
9912
|
+
* completes — drivers' `getAccessoryChildren()` should treat zero as
|
|
9913
|
+
* "probe not done yet, return empty" so accessories aren't spawned
|
|
9914
|
+
* before the firmware is queried.
|
|
9915
|
+
*/
|
|
9916
|
+
lastProbedAt: number(),
|
|
9917
|
+
/**
|
|
9918
|
+
* Framework convention: every runtime-state slice carries this for the
|
|
9919
|
+
* createRuntimeStateBridge stale-check helper. We keep it in sync with
|
|
9920
|
+
* `lastProbedAt` on every write.
|
|
9921
|
+
*/
|
|
9922
|
+
lastFetchedAt: number()
|
|
9771
9923
|
});
|
|
9772
|
-
var
|
|
9773
|
-
name: "
|
|
9924
|
+
var featureProbeCapability = {
|
|
9925
|
+
name: "feature-probe",
|
|
9774
9926
|
scope: "device",
|
|
9775
9927
|
deviceNative: true,
|
|
9776
9928
|
mode: "singleton",
|
|
9777
|
-
deviceTypes: [DeviceType.Sensor],
|
|
9778
9929
|
methods: {},
|
|
9930
|
+
events: {
|
|
9931
|
+
/** Fires whenever a fresh probe completes (kernel-driven `reprobe()`
|
|
9932
|
+
* or driver-initiated re-detect after a state change). */
|
|
9933
|
+
onProbeChanged: { data: object({
|
|
9934
|
+
deviceId: number(),
|
|
9935
|
+
status: FeatureProbeStatusSchema
|
|
9936
|
+
}) } },
|
|
9779
9937
|
status: {
|
|
9780
|
-
schema:
|
|
9938
|
+
schema: FeatureProbeStatusSchema,
|
|
9781
9939
|
kind: "push"
|
|
9782
9940
|
},
|
|
9783
|
-
runtimeState:
|
|
9941
|
+
runtimeState: FeatureProbeStatusSchema
|
|
9784
9942
|
};
|
|
9785
9943
|
/**
|
|
9786
|
-
*
|
|
9787
|
-
*
|
|
9788
|
-
*
|
|
9789
|
-
*
|
|
9790
|
-
*
|
|
9791
|
-
*
|
|
9792
|
-
*
|
|
9793
|
-
* that expose richer controls (color temperature, scenes, schedules)
|
|
9794
|
-
* should surface those via the device's `getSettingsUISchema()`
|
|
9795
|
-
* instead of bloating this cap.
|
|
9944
|
+
* Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
|
|
9945
|
+
* matter at PM2.5 / PM10, and a derived AQI index — all optional so
|
|
9946
|
+
* a single-metric source populates only what it observes. Mirrors
|
|
9947
|
+
* the HA `sensor` device_class set (`co2`, `volatile_organic_compounds`,
|
|
9948
|
+
* `pm25`, `pm10`, `aqi`) collapsed into one cap because a typical
|
|
9949
|
+
* air-quality node reports several of these together; modelling them
|
|
9950
|
+
* as siblings keeps a single timestamp + one slice subscription.
|
|
9796
9951
|
*/
|
|
9797
|
-
var
|
|
9798
|
-
/**
|
|
9799
|
-
|
|
9800
|
-
/**
|
|
9801
|
-
|
|
9952
|
+
var AirQualitySensorStatusSchema = object({
|
|
9953
|
+
/** Carbon dioxide concentration in ppm. */
|
|
9954
|
+
co2Ppm: number().min(0).optional(),
|
|
9955
|
+
/** Total volatile organic compounds in ppb. */
|
|
9956
|
+
vocPpb: number().min(0).optional(),
|
|
9957
|
+
/** Particulate matter ≤ 2.5 μm in µg/m³. */
|
|
9958
|
+
pm25: number().min(0).optional(),
|
|
9959
|
+
/** Particulate matter ≤ 10 μm in µg/m³. */
|
|
9960
|
+
pm10: number().min(0).optional(),
|
|
9961
|
+
/** Composite AQI value (typically 0..500). */
|
|
9962
|
+
aqi: number().optional(),
|
|
9963
|
+
/** Ms epoch when the slice was last updated. */
|
|
9964
|
+
lastFetchedAt: number(),
|
|
9965
|
+
/** Live display unit of the single metric this slice carries (e.g. HA
|
|
9966
|
+
* `attributes.unit_of_measurement` → 'ppm' / 'ppb' / 'µg/m³'). Each
|
|
9967
|
+
* upstream `sensor.*` entity surfaces ONE device_class, so one unit
|
|
9968
|
+
* per slice is unambiguous. */
|
|
9969
|
+
unit: string().optional(),
|
|
9970
|
+
/** Suggested decimal places for numeric display.
|
|
9971
|
+
* Populated live from the upstream source when provided (e.g. HA
|
|
9972
|
+
* `attributes.suggested_display_precision`). Falls back to
|
|
9973
|
+
* auto-formatting when absent. */
|
|
9974
|
+
precision: number().int().min(0).max(10).optional()
|
|
9802
9975
|
});
|
|
9803
|
-
var
|
|
9804
|
-
name: "
|
|
9976
|
+
var airQualitySensorCapability = {
|
|
9977
|
+
name: "air-quality-sensor",
|
|
9805
9978
|
scope: "device",
|
|
9806
9979
|
deviceNative: true,
|
|
9807
9980
|
mode: "singleton",
|
|
9808
|
-
deviceTypes: [DeviceType.
|
|
9809
|
-
methods: {
|
|
9810
|
-
deviceId: number().int().nonnegative(),
|
|
9811
|
-
percentage: number().min(0).max(100)
|
|
9812
|
-
}), _void(), {
|
|
9813
|
-
kind: "mutation",
|
|
9814
|
-
auth: "admin"
|
|
9815
|
-
}) },
|
|
9816
|
-
events: {
|
|
9817
|
-
/**
|
|
9818
|
-
* Emitted whenever the brightness changes — operator action OR
|
|
9819
|
-
* firmware push. Subscribers (UI sliders, automation engines) react
|
|
9820
|
-
* without polling.
|
|
9821
|
-
*/
|
|
9822
|
-
onBrightnessChanged: { data: object({
|
|
9823
|
-
deviceId: number(),
|
|
9824
|
-
percentage: number().min(0).max(100),
|
|
9825
|
-
lastChangedAt: number()
|
|
9826
|
-
}) } },
|
|
9981
|
+
deviceTypes: [DeviceType.Sensor],
|
|
9982
|
+
methods: {},
|
|
9827
9983
|
status: {
|
|
9828
|
-
schema:
|
|
9829
|
-
kind: "
|
|
9984
|
+
schema: AirQualitySensorStatusSchema,
|
|
9985
|
+
kind: "push"
|
|
9830
9986
|
},
|
|
9831
|
-
|
|
9832
|
-
* Runtime-state slice — the last applied brightness level, mirrored
|
|
9833
|
-
* by the kernel. Read via `device.state.brightness.value` so UI
|
|
9834
|
-
* sliders surface the current level without polling the provider.
|
|
9835
|
-
*/
|
|
9836
|
-
runtimeState: BrightnessStatusSchema
|
|
9987
|
+
runtimeState: AirQualitySensorStatusSchema
|
|
9837
9988
|
};
|
|
9838
|
-
/**
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9989
|
+
/**
|
|
9990
|
+
* Alarm-panel cap. Models HA `alarm_control_panel.*` on
|
|
9991
|
+
* `DeviceType.AlarmPanel`. State follows HA's canonical lifecycle
|
|
9992
|
+
* across disarmed / armed_(home|away|night|vacation|custom_bypass) /
|
|
9993
|
+
* arming / pending / triggered / disarming.
|
|
9994
|
+
*
|
|
9995
|
+
* Many panels require a PIN code on arm / disarm — the optional
|
|
9996
|
+
* `code` field on the methods passes it through to the upstream
|
|
9997
|
+
* service; it's NEVER persisted in the runtime slice or any event
|
|
9998
|
+
* payload. The presence of a required code is signalled by
|
|
9999
|
+
* `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
|
|
10000
|
+
* field without a slice fetch.
|
|
10001
|
+
*
|
|
10002
|
+
* `availableModes` mirrors HA's `supported_features`-derived arm
|
|
10003
|
+
* mode list — the UI renders only the buttons the panel accepts.
|
|
10004
|
+
*/
|
|
10005
|
+
var AlarmStateSchema = _enum([
|
|
10006
|
+
"disarmed",
|
|
10007
|
+
"armed_home",
|
|
10008
|
+
"armed_away",
|
|
10009
|
+
"armed_night",
|
|
10010
|
+
"armed_vacation",
|
|
10011
|
+
"armed_custom_bypass",
|
|
10012
|
+
"arming",
|
|
10013
|
+
"disarming",
|
|
10014
|
+
"pending",
|
|
10015
|
+
"triggered"
|
|
10016
|
+
]);
|
|
10017
|
+
var AlarmArmModeSchema = _enum([
|
|
10018
|
+
"home",
|
|
10019
|
+
"away",
|
|
10020
|
+
"night",
|
|
10021
|
+
"vacation",
|
|
10022
|
+
"custom_bypass"
|
|
10023
|
+
]);
|
|
10024
|
+
var AlarmPanelStatusSchema = object({
|
|
10025
|
+
/** Current lifecycle state. */
|
|
10026
|
+
state: AlarmStateSchema,
|
|
10027
|
+
/** Subset of arm modes the panel accepts. UI renders one button per
|
|
10028
|
+
* mode in this list. */
|
|
10029
|
+
availableModes: array(AlarmArmModeSchema),
|
|
10030
|
+
/** Whether the panel requires a PIN on arm / disarm. Mirrors
|
|
10031
|
+
* `DeviceFeature.AlarmPinRequired` for slice consumers. */
|
|
10032
|
+
requiresCode: boolean(),
|
|
10033
|
+
/** Ms epoch when the slice was last updated. */
|
|
10034
|
+
lastChangedAt: number()
|
|
10035
|
+
});
|
|
10036
|
+
var alarmPanelCapability = {
|
|
10037
|
+
name: "alarm-panel",
|
|
10038
|
+
scope: "device",
|
|
10039
|
+
deviceNative: true,
|
|
10040
|
+
mode: "singleton",
|
|
10041
|
+
deviceTypes: [DeviceType.AlarmPanel],
|
|
10042
|
+
methods: {
|
|
10043
|
+
arm: method(object({
|
|
10044
|
+
deviceId: number().int().nonnegative(),
|
|
10045
|
+
mode: AlarmArmModeSchema,
|
|
10046
|
+
/** Optional PIN code. Required when `requiresCode === true`.
|
|
10047
|
+
* Passed through to the upstream service; never persisted. */
|
|
10048
|
+
code: string().min(1).optional()
|
|
10049
|
+
}), _void(), {
|
|
10050
|
+
kind: "mutation",
|
|
10051
|
+
auth: "admin"
|
|
10052
|
+
}),
|
|
10053
|
+
disarm: method(object({
|
|
10054
|
+
deviceId: number().int().nonnegative(),
|
|
10055
|
+
code: string().min(1).optional()
|
|
10056
|
+
}), _void(), {
|
|
10057
|
+
kind: "mutation",
|
|
10058
|
+
auth: "admin"
|
|
10059
|
+
}),
|
|
10060
|
+
/**
|
|
10061
|
+
* Force the panel into the `triggered` state — used by HA
|
|
10062
|
+
* automations to surface external sensor events through the panel
|
|
10063
|
+
* (e.g. a Reolink camera intrusion event firing the security
|
|
10064
|
+
* system). Provider rejects when the panel hardware doesn't
|
|
10065
|
+
* support a software-initiated trigger.
|
|
10066
|
+
*/
|
|
10067
|
+
trigger: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
10068
|
+
kind: "mutation",
|
|
10069
|
+
auth: "admin"
|
|
10070
|
+
})
|
|
10071
|
+
},
|
|
10072
|
+
status: {
|
|
10073
|
+
schema: AlarmPanelStatusSchema,
|
|
10074
|
+
kind: "push"
|
|
10075
|
+
},
|
|
10076
|
+
/**
|
|
10077
|
+
* Runtime-state slice — mirrored by the kernel. UI panel reads the
|
|
10078
|
+
* full slice; renders an arm button per `availableModes` entry and
|
|
10079
|
+
* a PIN field iff `requiresCode === true`.
|
|
10080
|
+
*/
|
|
10081
|
+
runtimeState: AlarmPanelStatusSchema
|
|
10082
|
+
};
|
|
10083
|
+
/**
|
|
10084
|
+
* Ambient illuminance reading in lux. Drives Home Assistant `sensor`
|
|
10085
|
+
* entries with `device_class: illuminance`.
|
|
10086
|
+
*/
|
|
10087
|
+
var AmbientLightSensorStatusSchema = object({
|
|
10088
|
+
/** Current illuminance in lux (lx). */
|
|
10089
|
+
lux: number().min(0),
|
|
10090
|
+
/** Ms epoch when the slice was last updated. */
|
|
10091
|
+
lastFetchedAt: number(),
|
|
10092
|
+
/** Live display unit from the upstream source (e.g. HA
|
|
10093
|
+
* `attributes.unit_of_measurement`). The UI prefers this over the
|
|
10094
|
+
* role's canonical unit. Absent → fall back to the canonical unit. */
|
|
10095
|
+
unit: string().optional(),
|
|
10096
|
+
/** Suggested decimal places for numeric display.
|
|
10097
|
+
* Populated live from the upstream source when provided (e.g. HA
|
|
10098
|
+
* `attributes.suggested_display_precision`). Falls back to
|
|
10099
|
+
* auto-formatting when absent. */
|
|
10100
|
+
precision: number().int().min(0).max(10).optional()
|
|
10101
|
+
});
|
|
10102
|
+
var ambientLightSensorCapability = {
|
|
10103
|
+
name: "ambient-light-sensor",
|
|
10104
|
+
scope: "device",
|
|
10105
|
+
deviceNative: true,
|
|
10106
|
+
mode: "singleton",
|
|
10107
|
+
deviceTypes: [DeviceType.Sensor],
|
|
10108
|
+
methods: {},
|
|
10109
|
+
status: {
|
|
10110
|
+
schema: AmbientLightSensorStatusSchema,
|
|
10111
|
+
kind: "push"
|
|
10112
|
+
},
|
|
10113
|
+
runtimeState: AmbientLightSensorStatusSchema
|
|
10114
|
+
};
|
|
10115
|
+
/**
|
|
10116
|
+
* Per-class audio metrics aggregated over a sliding window.
|
|
10117
|
+
*/
|
|
10118
|
+
var AudioClassSummarySchema = object({
|
|
10119
|
+
className: string(),
|
|
10120
|
+
/** Number of windows (chunks) where this class was the top hit. */
|
|
10121
|
+
hits: number().int().nonnegative(),
|
|
10122
|
+
/** Mean score across those hits, clamped to [0,1]. */
|
|
10123
|
+
avgScore: number().min(0).max(1),
|
|
10124
|
+
/** Peak score in the window. */
|
|
10125
|
+
peakScore: number().min(0).max(1)
|
|
10126
|
+
});
|
|
10127
|
+
/**
|
|
10128
|
+
* Per-camera audio metrics snapshot — emitted by the analytics frame
|
|
10129
|
+
* handler on every `pipeline.audio-inference-result` event and
|
|
10130
|
+
* mirrored into the `audio-metrics` device-state slice. Symmetric
|
|
10131
|
+
* with `zone-analytics` snapshots for video — every consumer
|
|
10132
|
+
* (admin UI panel, automations, alert rules) reads via the
|
|
10133
|
+
* canonical `device.state.audioMetrics.value` reactive handle.
|
|
10134
|
+
*
|
|
10135
|
+
* Aggregates are computed over a rolling `windowSec` window
|
|
10136
|
+
* (default 60s). Past that window, classes drop out of `byClass`
|
|
10137
|
+
* and the level history shifts forward.
|
|
10138
|
+
*/
|
|
10139
|
+
var AudioMetricsSnapshotSchema = object({
|
|
10140
|
+
/** Wall-clock timestamp (ms) of the most recent audio window. */
|
|
10141
|
+
ts: number().int(),
|
|
10142
|
+
/** Sliding-window length (seconds) used for aggregation. */
|
|
10143
|
+
windowSec: number().int().positive(),
|
|
10144
|
+
/** Latest level reading from the most recent window. */
|
|
10145
|
+
level: object({
|
|
10146
|
+
rms: number(),
|
|
10147
|
+
dbfs: number()
|
|
10148
|
+
}),
|
|
10149
|
+
/** Peak dBFS observed across the rolling window. */
|
|
10150
|
+
peakDbfs: number(),
|
|
10151
|
+
/** Mean dBFS across the rolling window. */
|
|
10152
|
+
avgDbfs: number(),
|
|
10153
|
+
/** Most recent above-threshold classification, or null on silence. */
|
|
10154
|
+
current: object({
|
|
10155
|
+
className: string(),
|
|
10156
|
+
score: number().min(0).max(1),
|
|
10157
|
+
timestamp: number().int()
|
|
10158
|
+
}).nullable(),
|
|
10159
|
+
/** Per-class summary across the rolling window — keys are
|
|
10160
|
+
* `macroClass` strings (e.g. `dog_bark`, `speech`, `glass_break`). */
|
|
10161
|
+
byClass: array(AudioClassSummarySchema).readonly()
|
|
10162
|
+
});
|
|
10163
|
+
/**
|
|
10164
|
+
* Audio-metrics history payload — a series of `AudioMetricsHistoryPoint`
|
|
10165
|
+
* samples capped at `maxPoints` (default 1024). When the requested
|
|
10166
|
+
* `windowSec / sampleEveryMs` would exceed the cap, the provider
|
|
10167
|
+
* subsamples by bucketed averaging and reports the effective sample
|
|
10168
|
+
* spacing on `effectiveSampleEveryMs` so the UI can label the x-axis.
|
|
10169
|
+
*/
|
|
10170
|
+
var AudioMetricsHistorySchema = object({
|
|
10171
|
+
points: array(object({
|
|
10172
|
+
/** Wall-clock ms when this sample was recorded. */
|
|
10173
|
+
ts: number().int(),
|
|
10174
|
+
/** Instantaneous dBFS level at sample time. `null` for windows where
|
|
10175
|
+
* the source had no level reading (rare; happens at decode startup). */
|
|
10176
|
+
dbfs: number().nullable(),
|
|
10177
|
+
/** Rolling-window peak dBFS at sample time. Same window the live
|
|
10178
|
+
* snapshot reports. */
|
|
10179
|
+
peakDbfs: number(),
|
|
10180
|
+
/** Rolling-window mean dBFS at sample time. */
|
|
10181
|
+
avgDbfs: number(),
|
|
10182
|
+
/** Dominant above-threshold class at sample time, or null on silence. */
|
|
10183
|
+
topClass: string().nullable(),
|
|
10184
|
+
/** Score of the dominant class (`null` whenever `topClass` is null). */
|
|
10185
|
+
topScore: number().min(0).max(1).nullable()
|
|
10186
|
+
})).readonly(),
|
|
10187
|
+
/** Actual ms between adjacent samples after any subsampling. */
|
|
10188
|
+
effectiveSampleEveryMs: number().int().positive(),
|
|
10189
|
+
/** Wall-clock window covered by `points` (`points[N-1].ts - points[0].ts`),
|
|
10190
|
+
* or `0` when there's fewer than 2 samples. */
|
|
10191
|
+
windowMsActual: number().int().nonnegative()
|
|
10192
|
+
});
|
|
10193
|
+
/**
|
|
10194
|
+
* Audio Metrics capability — sliding-window aggregates over the
|
|
10195
|
+
* pipeline audio inference results. Hosted by `addon-pipeline-analytics`
|
|
10196
|
+
* (same addon that owns `zone-analytics`); the runtime-state slice
|
|
10197
|
+
* gives operators a live read on dB level + dominant classes without
|
|
10198
|
+
* a custom event subscription.
|
|
10199
|
+
*/
|
|
10200
|
+
var audioMetricsCapability = {
|
|
10201
|
+
name: "audio-metrics",
|
|
10202
|
+
scope: "device",
|
|
10203
|
+
mode: "singleton",
|
|
10204
|
+
deviceTypes: [DeviceType.Camera],
|
|
10205
|
+
methods: {
|
|
10206
|
+
/** Latest snapshot for this device. Null until the analytics
|
|
10207
|
+
* pipeline has processed at least one audio window. */
|
|
10208
|
+
getCurrentSnapshot: method(object({ deviceId: number() }), AudioMetricsSnapshotSchema.nullable()),
|
|
10209
|
+
/**
|
|
10210
|
+
* Time-series view of recent audio-metrics samples. The provider
|
|
10211
|
+
* keeps an in-memory ring of ~1Hz samples (matching the slice-
|
|
10212
|
+
* write rate) capped at `MAX_HISTORY_POINTS_KEPT` (provider-side).
|
|
10213
|
+
* `windowSec` selects how far back to read; `sampleEveryMs`
|
|
10214
|
+
* downsamples by bucketed averaging when finer than the kept
|
|
10215
|
+
* granularity. Empty `points` array on freshly-booted providers
|
|
10216
|
+
* with no audio yet — same convention as `getCurrentSnapshot`.
|
|
10217
|
+
*/
|
|
10218
|
+
getHistory: method(object({
|
|
10219
|
+
deviceId: number(),
|
|
10220
|
+
/** History window in seconds. Default 300 (5 minutes).
|
|
10221
|
+
* Provider clamps to its retention cap if larger. */
|
|
10222
|
+
windowSec: number().int().positive().optional(),
|
|
10223
|
+
/** Target sample interval in ms. Default 1000 (1 sample/second).
|
|
10224
|
+
* Provider clamps to natural sample rate if smaller, and
|
|
10225
|
+
* bucket-averages when bigger than the requested window
|
|
10226
|
+
* would produce more than `maxPoints` samples. */
|
|
10227
|
+
sampleEveryMs: number().int().positive().optional()
|
|
10228
|
+
}), AudioMetricsHistorySchema)
|
|
10229
|
+
},
|
|
10230
|
+
/** Reactive runtime-state mirror — live `device.state.audioMetrics.value`. */
|
|
10231
|
+
runtimeState: AudioMetricsSnapshotSchema
|
|
10232
|
+
};
|
|
10233
|
+
/**
|
|
10234
|
+
* Automation-control cap. Models HA `automation.*` entities on
|
|
10235
|
+
* `DeviceType.Automation`. An automation is a trigger+condition+
|
|
10236
|
+
* action rule that can be enabled / disabled and manually fired
|
|
10237
|
+
* via the `trigger` method.
|
|
10238
|
+
*
|
|
10239
|
+
* `trigger` accepts an optional `skipCondition` flag — when true,
|
|
10240
|
+
* the automation's action block runs WITHOUT evaluating its
|
|
10241
|
+
* condition block. Pair with `DeviceFeature.AutomationSkipCondition`
|
|
10242
|
+
* to gate the UI checkbox for the manual-trigger dialog.
|
|
10243
|
+
*/
|
|
10244
|
+
var AutomationControlStatusSchema = object({
|
|
10245
|
+
/** Whether the automation is currently enabled. Disabled automations
|
|
10246
|
+
* ignore their trigger block — manual `trigger` still works. */
|
|
10247
|
+
enabled: boolean(),
|
|
10248
|
+
/** Whether the automation is currently executing its action block. */
|
|
10249
|
+
isRunning: boolean(),
|
|
10250
|
+
/** Ms epoch of the last successful run. 0 when never run. */
|
|
10251
|
+
lastTriggeredAt: number(),
|
|
10252
|
+
/** Failure description from the last completed run. Null on success
|
|
10253
|
+
* or when never run. */
|
|
10254
|
+
lastError: string().nullable(),
|
|
10255
|
+
/** Ms epoch when the slice was last updated. */
|
|
10256
|
+
lastChangedAt: number()
|
|
10257
|
+
});
|
|
10258
|
+
var automationControlCapability = {
|
|
10259
|
+
name: "automation-control",
|
|
10260
|
+
scope: "device",
|
|
10261
|
+
deviceNative: true,
|
|
10262
|
+
mode: "singleton",
|
|
10263
|
+
deviceTypes: [DeviceType.Automation],
|
|
10264
|
+
methods: {
|
|
10265
|
+
enable: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
10266
|
+
kind: "mutation",
|
|
10267
|
+
auth: "admin"
|
|
10268
|
+
}),
|
|
10269
|
+
disable: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
10270
|
+
kind: "mutation",
|
|
10271
|
+
auth: "admin"
|
|
10272
|
+
}),
|
|
10273
|
+
trigger: method(object({
|
|
10274
|
+
deviceId: number().int().nonnegative(),
|
|
10275
|
+
/** When true, fires the action block while bypassing the
|
|
10276
|
+
* automation's condition evaluation. Gated by
|
|
10277
|
+
* `DeviceFeature.AutomationSkipCondition`. */
|
|
10278
|
+
skipCondition: boolean().optional()
|
|
10279
|
+
}), _void(), {
|
|
10280
|
+
kind: "mutation",
|
|
10281
|
+
auth: "admin"
|
|
10282
|
+
})
|
|
10283
|
+
},
|
|
10284
|
+
status: {
|
|
10285
|
+
schema: AutomationControlStatusSchema,
|
|
10286
|
+
kind: "push"
|
|
10287
|
+
},
|
|
10288
|
+
/**
|
|
10289
|
+
* Runtime-state slice — mirrored by the kernel. UI automation tile
|
|
10290
|
+
* reads `enabled` (toggle) + `isRunning` (spinner) + `lastError`
|
|
10291
|
+
* (badge) directly.
|
|
10292
|
+
*/
|
|
10293
|
+
runtimeState: AutomationControlStatusSchema
|
|
10294
|
+
};
|
|
10295
|
+
/**
|
|
10296
|
+
* Battery status snapshot. Emitted by providers whose device is
|
|
10297
|
+
* battery-operated (cameras with `DeviceFeature.BatteryOperated`,
|
|
10298
|
+
* future sensor/button accessories). Consumers build their own "low
|
|
10299
|
+
* battery" alerting on top — the cap deliberately does NOT enforce a
|
|
10300
|
+
* threshold.
|
|
10301
|
+
*/
|
|
10302
|
+
var BatteryStatusSchema = object({
|
|
10303
|
+
/** 0..100 inclusive. Firmware-reported. */
|
|
10304
|
+
percentage: number().min(0).max(100),
|
|
10305
|
+
/**
|
|
10306
|
+
* Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
|
|
10307
|
+
* Reolink-specific for the Solar Panel 2 accessory (will become
|
|
10308
|
+
* common on other battery cams). `'none'` means running on battery
|
|
10309
|
+
* alone.
|
|
10310
|
+
*/
|
|
10311
|
+
charging: _enum([
|
|
10312
|
+
"dc",
|
|
10313
|
+
"solar",
|
|
10314
|
+
"none"
|
|
10315
|
+
]),
|
|
10316
|
+
/**
|
|
10317
|
+
* True when the camera firmware has gone into low-power mode. Battery
|
|
10318
|
+
* providers MUST avoid polling during sleep — reading the battery
|
|
10319
|
+
* wakes the camera up and drains charge.
|
|
10320
|
+
*/
|
|
10321
|
+
sleeping: boolean(),
|
|
10322
|
+
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
10323
|
+
lastUpdated: number(),
|
|
10324
|
+
/**
|
|
10325
|
+
* True when the source is a BINARY low-battery indicator (HA
|
|
10326
|
+
* `binary_sensor` device_class=battery / `LOW_BAT`) that has no real
|
|
10327
|
+
* charge level — `percentage` is then a coarse stand-in (100 = normal,
|
|
10328
|
+
* sub-threshold = low). UI MUST render "Normal"/"Low" instead of a
|
|
10329
|
+
* misleading exact percentage. Absent/false → genuine 0–100 % reading.
|
|
10330
|
+
*/
|
|
10331
|
+
binary: boolean().optional()
|
|
10332
|
+
});
|
|
10333
|
+
var batteryCapability = {
|
|
10334
|
+
name: "battery",
|
|
10335
|
+
scope: "device",
|
|
10336
|
+
deviceNative: true,
|
|
10337
|
+
mode: "singleton",
|
|
10338
|
+
deviceTypes: [
|
|
10339
|
+
DeviceType.Camera,
|
|
10340
|
+
DeviceType.Sensor,
|
|
10341
|
+
DeviceType.Button,
|
|
10342
|
+
DeviceType.Switch
|
|
10343
|
+
],
|
|
10344
|
+
methods: {
|
|
10345
|
+
/**
|
|
10346
|
+
* Explicitly wake the camera from low-power sleep ahead of a
|
|
10347
|
+
* streaming session start. Consumers that initiate a stream
|
|
10348
|
+
* against a sleeping battery cam (HomeKit Secure Video, Alexa
|
|
10349
|
+
* RTCSession, snapshot wrappers) call this with a short timeout
|
|
10350
|
+
* before establishing the media pipeline — the broker's own
|
|
10351
|
+
* passive wake-on-dial works but adds 5–7 seconds to first-frame,
|
|
10352
|
+
* during which the consumer renders a black screen. Pre-waking
|
|
10353
|
+
* compresses that gap.
|
|
10354
|
+
*
|
|
10355
|
+
* Returns `awoke: true` when the firmware acknowledged the wake
|
|
10356
|
+
* before `timeoutMs`. Returns `awoke: false` when it timed out OR
|
|
10357
|
+
* the cap surface is unavailable (no Baichuan / firmware
|
|
10358
|
+
* channel); the caller should still attempt the stream — the
|
|
10359
|
+
* passive broker wake remains as fallback.
|
|
10360
|
+
*/
|
|
10361
|
+
wakeForStream: method(object({
|
|
10362
|
+
deviceId: number(),
|
|
10363
|
+
/** Bound on the wait. Sensible range 3000–10000ms. */
|
|
10364
|
+
timeoutMs: number().int().min(500).max(3e4).default(8e3)
|
|
10365
|
+
}), object({
|
|
10366
|
+
awoke: boolean(),
|
|
10367
|
+
durationMs: number()
|
|
10368
|
+
}), { kind: "mutation" }) },
|
|
10369
|
+
events: {
|
|
10370
|
+
/**
|
|
10371
|
+
* Emitted whenever the cached status changes (firmware push OR
|
|
10372
|
+
* poll observes a delta). The DeviceEventPropagator mirrors this
|
|
10373
|
+
* event on the parent chain — subscribing to a camera's source
|
|
10374
|
+
* receives battery events from child accessories automatically.
|
|
10375
|
+
*/
|
|
10376
|
+
onStatusChanged: { data: object({
|
|
10377
|
+
deviceId: number(),
|
|
10378
|
+
status: BatteryStatusSchema
|
|
10379
|
+
}) } },
|
|
10380
|
+
status: {
|
|
10381
|
+
schema: BatteryStatusSchema,
|
|
10382
|
+
kind: "push",
|
|
10383
|
+
empty: {
|
|
10384
|
+
percentage: 0,
|
|
10385
|
+
charging: "none",
|
|
10386
|
+
sleeping: false,
|
|
10387
|
+
lastUpdated: 0
|
|
10388
|
+
}
|
|
10389
|
+
},
|
|
10390
|
+
/**
|
|
10391
|
+
* Runtime-state slice — every provider that registers this cap
|
|
10392
|
+
* stores the same shape under `device.runtimeState[battery]`.
|
|
10393
|
+
* Cross-provider uniformity: a Reolink Argus, a Frigate sensor
|
|
10394
|
+
* proxy, an ONVIF battery cam all read/write the same keys.
|
|
10395
|
+
* Consumers (BatteryBadge, snapshot wrapper sleep gate) read once
|
|
10396
|
+
* via `device.runtimeState.getCapState('battery')` regardless of
|
|
10397
|
+
* the underlying driver.
|
|
10398
|
+
*/
|
|
10399
|
+
runtimeState: BatteryStatusSchema
|
|
10400
|
+
};
|
|
10401
|
+
/**
|
|
10402
|
+
* Generic boolean sensor — last-resort fallback when no domain-
|
|
10403
|
+
* specific binary cap fits (Home Assistant `binary_sensor` without a
|
|
10404
|
+
* known `device_class`, or a domain we haven't typed yet). Pure
|
|
10405
|
+
* pass-through: just the bool + timestamp. Push-driven.
|
|
10406
|
+
*
|
|
10407
|
+
* Prefer the typed alternatives (`contact`, `flood`, `smoke`,
|
|
10408
|
+
* `carbon-monoxide`, `gas`, `tamper`, `vibration`, `connectivity`,
|
|
10409
|
+
* `motion`) when the semantics match — export adapters render those
|
|
10410
|
+
* with the right HomeKit / Alexa display category.
|
|
10411
|
+
*/
|
|
10412
|
+
var BinaryStatusSchema = object({
|
|
10413
|
+
on: boolean(),
|
|
10414
|
+
/** Ms epoch of the last transition. 0 if never observed. */
|
|
10415
|
+
lastChangedAt: number()
|
|
10416
|
+
});
|
|
10417
|
+
var binaryCapability = {
|
|
10418
|
+
name: "binary",
|
|
10419
|
+
scope: "device",
|
|
10420
|
+
deviceNative: true,
|
|
10421
|
+
mode: "singleton",
|
|
10422
|
+
deviceTypes: [DeviceType.Sensor],
|
|
10423
|
+
methods: {},
|
|
10424
|
+
status: {
|
|
10425
|
+
schema: BinaryStatusSchema,
|
|
10426
|
+
kind: "push"
|
|
10427
|
+
},
|
|
10428
|
+
runtimeState: BinaryStatusSchema
|
|
10429
|
+
};
|
|
10430
|
+
/**
|
|
10431
|
+
* Dimmable-light brightness control. Co-exists with `switch` on the
|
|
10432
|
+
* same device — the switch toggles on/off, this cap sets the level
|
|
10433
|
+
* applied when the light is on. Drivers map their per-vendor dim
|
|
10434
|
+
* controls to this single-method surface.
|
|
10435
|
+
*
|
|
10436
|
+
* The cap is intentionally minimal: a single `setBrightness({deviceId,
|
|
10437
|
+
* percentage})` mutation plus the auto-injected `getStatus`. Drivers
|
|
10438
|
+
* that expose richer controls (color temperature, scenes, schedules)
|
|
10439
|
+
* should surface those via the device's `getSettingsUISchema()`
|
|
10440
|
+
* instead of bloating this cap.
|
|
10441
|
+
*/
|
|
10442
|
+
var BrightnessStatusSchema = object({
|
|
10443
|
+
/** Current level as 0..100 inclusive. Firmware-reported. */
|
|
10444
|
+
percentage: number().min(0).max(100),
|
|
10445
|
+
/** Ms epoch of the last operator-driven change. Useful for UI freshness. */
|
|
10446
|
+
lastChangedAt: number()
|
|
10447
|
+
});
|
|
10448
|
+
var brightnessCapability = {
|
|
10449
|
+
name: "brightness",
|
|
10450
|
+
scope: "device",
|
|
10451
|
+
deviceNative: true,
|
|
10452
|
+
mode: "singleton",
|
|
10453
|
+
deviceTypes: [DeviceType.Light],
|
|
10454
|
+
methods: { setBrightness: method(object({
|
|
10455
|
+
deviceId: number().int().nonnegative(),
|
|
10456
|
+
percentage: number().min(0).max(100)
|
|
10457
|
+
}), _void(), {
|
|
10458
|
+
kind: "mutation",
|
|
10459
|
+
auth: "admin"
|
|
10460
|
+
}) },
|
|
10461
|
+
events: {
|
|
10462
|
+
/**
|
|
10463
|
+
* Emitted whenever the brightness changes — operator action OR
|
|
10464
|
+
* firmware push. Subscribers (UI sliders, automation engines) react
|
|
10465
|
+
* without polling.
|
|
10466
|
+
*/
|
|
10467
|
+
onBrightnessChanged: { data: object({
|
|
10468
|
+
deviceId: number(),
|
|
10469
|
+
percentage: number().min(0).max(100),
|
|
10470
|
+
lastChangedAt: number()
|
|
10471
|
+
}) } },
|
|
10472
|
+
status: {
|
|
10473
|
+
schema: BrightnessStatusSchema,
|
|
10474
|
+
kind: "command-driven"
|
|
10475
|
+
},
|
|
10476
|
+
/**
|
|
10477
|
+
* Runtime-state slice — the last applied brightness level, mirrored
|
|
10478
|
+
* by the kernel. Read via `device.state.brightness.value` so UI
|
|
10479
|
+
* sliders surface the current level without polling the provider.
|
|
10480
|
+
*/
|
|
10481
|
+
runtimeState: BrightnessStatusSchema
|
|
10482
|
+
};
|
|
10483
|
+
/** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
|
|
10484
|
+
var StreamFormatSchema = _enum([
|
|
10485
|
+
"webrtc",
|
|
10486
|
+
"hls",
|
|
10487
|
+
"mjpeg",
|
|
10488
|
+
"rtsp"
|
|
9844
10489
|
]);
|
|
9845
10490
|
var RtspRestreamEntrySchema = object({
|
|
9846
10491
|
brokerId: string(),
|
|
@@ -13286,104 +13931,43 @@ var MotionTriggerStatusSchema = object({
|
|
|
13286
13931
|
/**
|
|
13287
13932
|
* Persistent slice mirrored across restarts. The provider writes here
|
|
13288
13933
|
* on every successful firmware fetch / setMotionTrigger push; the cap
|
|
13289
|
-
* router and admin-ui hero read straight from this snapshot via
|
|
13290
|
-
* `device.state.motionTrigger.value` instead of re-issuing a firmware
|
|
13291
|
-
* round-trip on every UI mount. `lastFetchedAt` lets the framework
|
|
13292
|
-
* helper (`createRuntimeStateBridge`) stale-check before deciding
|
|
13293
|
-
* whether to refresh from the camera.
|
|
13294
|
-
*/
|
|
13295
|
-
var MotionTriggerRuntimeStateSchema = MotionTriggerStatusSchema.extend({
|
|
13296
|
-
/** Ms epoch of the last successful camera fetch (0 = never). */
|
|
13297
|
-
lastFetchedAt: number() });
|
|
13298
|
-
var motionTriggerCapability = {
|
|
13299
|
-
name: "motion-trigger",
|
|
13300
|
-
scope: "device",
|
|
13301
|
-
deviceNative: true,
|
|
13302
|
-
mode: "singleton",
|
|
13303
|
-
deviceTypes: [
|
|
13304
|
-
DeviceType.Light,
|
|
13305
|
-
DeviceType.Siren,
|
|
13306
|
-
DeviceType.Switch
|
|
13307
|
-
],
|
|
13308
|
-
methods: { setMotionTrigger: method(object({
|
|
13309
|
-
deviceId: number().int().nonnegative(),
|
|
13310
|
-
enabled: boolean()
|
|
13311
|
-
}), _void(), {
|
|
13312
|
-
kind: "mutation",
|
|
13313
|
-
auth: "admin"
|
|
13314
|
-
}) },
|
|
13315
|
-
events: { onMotionTriggerChanged: { data: object({
|
|
13316
|
-
deviceId: number(),
|
|
13317
|
-
enabled: boolean(),
|
|
13318
|
-
lastChangedAt: number()
|
|
13319
|
-
}) } },
|
|
13320
|
-
status: {
|
|
13321
|
-
schema: MotionTriggerStatusSchema,
|
|
13322
|
-
kind: "command-driven"
|
|
13323
|
-
},
|
|
13324
|
-
runtimeState: MotionTriggerRuntimeStateSchema
|
|
13325
|
-
};
|
|
13326
|
-
/**
|
|
13327
|
-
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
13328
|
-
* motion-zones, and the detection zones/lines editor all speak this one
|
|
13329
|
-
* language so a single drawing-plane editor and the providers stay
|
|
13330
|
-
* decoupled from each cap's storage.
|
|
13331
|
-
*
|
|
13332
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
13333
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
13334
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
13335
|
-
*/
|
|
13336
|
-
/** A normalized 0..1 point (top-left origin). */
|
|
13337
|
-
var MaskPointSchema = object({
|
|
13338
|
-
x: number(),
|
|
13339
|
-
y: number()
|
|
13340
|
-
});
|
|
13341
|
-
/** Axis-aligned rectangle (normalized 0..1). */
|
|
13342
|
-
var MaskRectShapeSchema = object({
|
|
13343
|
-
kind: literal("rect"),
|
|
13344
|
-
x: number(),
|
|
13345
|
-
y: number(),
|
|
13346
|
-
width: number(),
|
|
13347
|
-
height: number()
|
|
13348
|
-
});
|
|
13349
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
13350
|
-
var MaskPolygonShapeSchema = object({
|
|
13351
|
-
kind: literal("polygon"),
|
|
13352
|
-
points: array(MaskPointSchema)
|
|
13353
|
-
});
|
|
13354
|
-
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
13355
|
-
var MaskGridShapeSchema = object({
|
|
13356
|
-
kind: literal("grid"),
|
|
13357
|
-
gridWidth: number(),
|
|
13358
|
-
gridHeight: number(),
|
|
13359
|
-
cells: array(boolean())
|
|
13360
|
-
});
|
|
13361
|
-
discriminatedUnion("kind", [
|
|
13362
|
-
MaskRectShapeSchema,
|
|
13363
|
-
MaskPolygonShapeSchema,
|
|
13364
|
-
MaskGridShapeSchema,
|
|
13365
|
-
object({
|
|
13366
|
-
kind: literal("line"),
|
|
13367
|
-
points: array(MaskPointSchema)
|
|
13368
|
-
})
|
|
13369
|
-
]);
|
|
13370
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
13371
|
-
var MaskShapeKindSchema = _enum([
|
|
13372
|
-
"rect",
|
|
13373
|
-
"polygon",
|
|
13374
|
-
"grid",
|
|
13375
|
-
"line"
|
|
13376
|
-
]);
|
|
13377
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
13378
|
-
var MaskPolygonVerticesSchema = object({
|
|
13379
|
-
min: number(),
|
|
13380
|
-
max: number()
|
|
13381
|
-
});
|
|
13382
|
-
/** Grid dimensions when a cap supports 'grid'. */
|
|
13383
|
-
var MaskGridDimsSchema = object({
|
|
13384
|
-
width: number(),
|
|
13385
|
-
height: number()
|
|
13386
|
-
});
|
|
13934
|
+
* router and admin-ui hero read straight from this snapshot via
|
|
13935
|
+
* `device.state.motionTrigger.value` instead of re-issuing a firmware
|
|
13936
|
+
* round-trip on every UI mount. `lastFetchedAt` lets the framework
|
|
13937
|
+
* helper (`createRuntimeStateBridge`) stale-check before deciding
|
|
13938
|
+
* whether to refresh from the camera.
|
|
13939
|
+
*/
|
|
13940
|
+
var MotionTriggerRuntimeStateSchema = MotionTriggerStatusSchema.extend({
|
|
13941
|
+
/** Ms epoch of the last successful camera fetch (0 = never). */
|
|
13942
|
+
lastFetchedAt: number() });
|
|
13943
|
+
var motionTriggerCapability = {
|
|
13944
|
+
name: "motion-trigger",
|
|
13945
|
+
scope: "device",
|
|
13946
|
+
deviceNative: true,
|
|
13947
|
+
mode: "singleton",
|
|
13948
|
+
deviceTypes: [
|
|
13949
|
+
DeviceType.Light,
|
|
13950
|
+
DeviceType.Siren,
|
|
13951
|
+
DeviceType.Switch
|
|
13952
|
+
],
|
|
13953
|
+
methods: { setMotionTrigger: method(object({
|
|
13954
|
+
deviceId: number().int().nonnegative(),
|
|
13955
|
+
enabled: boolean()
|
|
13956
|
+
}), _void(), {
|
|
13957
|
+
kind: "mutation",
|
|
13958
|
+
auth: "admin"
|
|
13959
|
+
}) },
|
|
13960
|
+
events: { onMotionTriggerChanged: { data: object({
|
|
13961
|
+
deviceId: number(),
|
|
13962
|
+
enabled: boolean(),
|
|
13963
|
+
lastChangedAt: number()
|
|
13964
|
+
}) } },
|
|
13965
|
+
status: {
|
|
13966
|
+
schema: MotionTriggerStatusSchema,
|
|
13967
|
+
kind: "command-driven"
|
|
13968
|
+
},
|
|
13969
|
+
runtimeState: MotionTriggerRuntimeStateSchema
|
|
13970
|
+
};
|
|
13387
13971
|
/**
|
|
13388
13972
|
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
13389
13973
|
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
@@ -16821,6 +17405,55 @@ method(object({
|
|
|
16821
17405
|
password: string()
|
|
16822
17406
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
16823
17407
|
/**
|
|
17408
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
17409
|
+
* NOT flow through the capability — they use the addon data plane
|
|
17410
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
17411
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
17412
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
17413
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
17414
|
+
*/
|
|
17415
|
+
var TerminalSessionInfoSchema = object({
|
|
17416
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
17417
|
+
sessionId: string(),
|
|
17418
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
17419
|
+
profileId: string(),
|
|
17420
|
+
/** Human-readable profile label for the UI session list. */
|
|
17421
|
+
label: string(),
|
|
17422
|
+
cols: number().int().positive(),
|
|
17423
|
+
rows: number().int().positive(),
|
|
17424
|
+
/** ms-epoch the session's pty was spawned. */
|
|
17425
|
+
startedAt: number()
|
|
17426
|
+
});
|
|
17427
|
+
/**
|
|
17428
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
17429
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
17430
|
+
* command string would be remote code execution as the server's user, so it is
|
|
17431
|
+
* deliberately not part of the contract.
|
|
17432
|
+
*/
|
|
17433
|
+
var TerminalProfileInfoSchema = object({
|
|
17434
|
+
profileId: string(),
|
|
17435
|
+
label: string(),
|
|
17436
|
+
description: string().optional()
|
|
17437
|
+
});
|
|
17438
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
17439
|
+
profileId: string(),
|
|
17440
|
+
cols: number().int().positive(),
|
|
17441
|
+
rows: number().int().positive()
|
|
17442
|
+
}), TerminalSessionInfoSchema, {
|
|
17443
|
+
kind: "mutation",
|
|
17444
|
+
auth: "admin"
|
|
17445
|
+
}), method(object({
|
|
17446
|
+
sessionId: string(),
|
|
17447
|
+
cols: number().int().positive(),
|
|
17448
|
+
rows: number().int().positive()
|
|
17449
|
+
}), _void(), {
|
|
17450
|
+
kind: "mutation",
|
|
17451
|
+
auth: "admin"
|
|
17452
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
17453
|
+
kind: "mutation",
|
|
17454
|
+
auth: "admin"
|
|
17455
|
+
});
|
|
17456
|
+
/**
|
|
16824
17457
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
16825
17458
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
16826
17459
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -16921,11 +17554,53 @@ var LocationStatSchema = object({
|
|
|
16921
17554
|
fileCount: number(),
|
|
16922
17555
|
present: boolean()
|
|
16923
17556
|
});
|
|
17557
|
+
/**
|
|
17558
|
+
* A backup schedule — the N:M "entry" that binds one cron cadence to a
|
|
17559
|
+
* SET of destination locations. Supersedes the per-location cron on
|
|
17560
|
+
* `BackupDestinationPolicy`: an operator creates a schedule, picks the
|
|
17561
|
+
* `backups` locations it should write to, and the orchestrator fans a
|
|
17562
|
+
* single archive out to all of them when the cron fires.
|
|
17563
|
+
*
|
|
17564
|
+
* `retentionCount` is per-schedule (D-decision 2026-07-28): every
|
|
17565
|
+
* location targeted by this schedule keeps this many archives from
|
|
17566
|
+
* this schedule's runs.
|
|
17567
|
+
*
|
|
17568
|
+
* `dataSources` optionally narrows which top-level state locations
|
|
17569
|
+
* (db, addons, tls, …) are archived; omitted = the orchestrator's
|
|
17570
|
+
* default full set.
|
|
17571
|
+
*/
|
|
17572
|
+
var BackupScheduleSchema = object({
|
|
17573
|
+
/** Stable id. Generated by the orchestrator on first upsert if absent. */
|
|
17574
|
+
id: string(),
|
|
17575
|
+
/** Operator-facing display name. */
|
|
17576
|
+
label: string(),
|
|
17577
|
+
/** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
|
|
17578
|
+
cron: string(),
|
|
17579
|
+
/** Master on/off toggle for the whole schedule. */
|
|
17580
|
+
enabled: boolean(),
|
|
17581
|
+
/** `backups`-location ids this schedule writes to (fan-out set). */
|
|
17582
|
+
locationIds: array(string()).readonly(),
|
|
17583
|
+
/** Archives kept per targeted location for this schedule. */
|
|
17584
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
17585
|
+
/** Optional subset of source locations to include; omitted = all. */
|
|
17586
|
+
dataSources: array(string()).readonly().optional(),
|
|
17587
|
+
/** ms-epoch of last successful run. */
|
|
17588
|
+
lastRunAt: number().optional(),
|
|
17589
|
+
/** ms-epoch of next computed firing (read-only, filled on list). */
|
|
17590
|
+
nextRunAt: number().optional()
|
|
17591
|
+
});
|
|
16924
17592
|
method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
16925
17593
|
/** Subset of registered `backup-destination` addon ids to write to. */
|
|
16926
17594
|
destinations: array(string()).optional(),
|
|
16927
17595
|
locations: array(string()).optional(),
|
|
16928
|
-
label: string().optional()
|
|
17596
|
+
label: string().optional(),
|
|
17597
|
+
/**
|
|
17598
|
+
* Per-run retention override applied to every targeted
|
|
17599
|
+
* destination. Used by schedule-driven runs (per-entry
|
|
17600
|
+
* retention). Omitted = each destination's own policy
|
|
17601
|
+
* retention (manual runs).
|
|
17602
|
+
*/
|
|
17603
|
+
retentionCount: number().int().min(1).max(1e3).optional()
|
|
16929
17604
|
}).optional(), array(BackupEntrySchema).readonly(), {
|
|
16930
17605
|
kind: "mutation",
|
|
16931
17606
|
auth: "admin"
|
|
@@ -16974,7 +17649,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
16974
17649
|
ok: boolean(),
|
|
16975
17650
|
error: string().optional(),
|
|
16976
17651
|
nextRuns: array(number()).readonly()
|
|
16977
|
-
}))
|
|
17652
|
+
})), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
|
|
17653
|
+
id: string().optional(),
|
|
17654
|
+
label: string(),
|
|
17655
|
+
cron: string(),
|
|
17656
|
+
enabled: boolean(),
|
|
17657
|
+
locationIds: array(string()).readonly(),
|
|
17658
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
17659
|
+
dataSources: array(string()).readonly().optional()
|
|
17660
|
+
}), BackupScheduleSchema, {
|
|
17661
|
+
kind: "mutation",
|
|
17662
|
+
auth: "admin"
|
|
17663
|
+
}), method(object({ id: string() }), _void(), {
|
|
17664
|
+
kind: "mutation",
|
|
17665
|
+
auth: "admin"
|
|
17666
|
+
});
|
|
16978
17667
|
/**
|
|
16979
17668
|
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
16980
17669
|
*
|
|
@@ -18007,1596 +18696,1108 @@ method(object({
|
|
|
18007
18696
|
active: boolean()
|
|
18008
18697
|
}), _void(), {
|
|
18009
18698
|
kind: "mutation",
|
|
18010
|
-
auth: "admin"
|
|
18011
|
-
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
18012
|
-
capName: string(),
|
|
18013
|
-
wrappers: array(string())
|
|
18014
|
-
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
18015
|
-
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
18016
|
-
live: SettingsSchemaWithValuesSchema.nullable()
|
|
18017
|
-
})), method(object({
|
|
18018
|
-
deviceId: number().int().nonnegative(),
|
|
18019
|
-
action: string().min(1),
|
|
18020
|
-
input: unknown()
|
|
18021
|
-
}), unknown(), { kind: "mutation" }), method(object({
|
|
18022
|
-
deviceId: number(),
|
|
18023
|
-
writerCapName: string(),
|
|
18024
|
-
writerAddonId: string(),
|
|
18025
|
-
key: string(),
|
|
18026
|
-
value: unknown()
|
|
18027
|
-
}), object({ success: literal(true) }), {
|
|
18028
|
-
kind: "mutation",
|
|
18029
|
-
auth: "admin"
|
|
18030
|
-
}), method(object({
|
|
18031
|
-
deviceId: number(),
|
|
18032
|
-
changes: array(object({
|
|
18033
|
-
writerCapName: string(),
|
|
18034
|
-
writerAddonId: string(),
|
|
18035
|
-
key: string(),
|
|
18036
|
-
value: unknown()
|
|
18037
|
-
}))
|
|
18038
|
-
}), object({
|
|
18039
|
-
success: literal(true),
|
|
18040
|
-
failures: array(object({
|
|
18041
|
-
writerCapName: string(),
|
|
18042
|
-
writerAddonId: string(),
|
|
18043
|
-
error: string()
|
|
18044
|
-
}))
|
|
18045
|
-
}), {
|
|
18046
|
-
kind: "mutation",
|
|
18047
|
-
auth: "admin"
|
|
18048
|
-
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
18049
|
-
kind: "mutation",
|
|
18050
|
-
auth: "admin"
|
|
18051
|
-
}), method(object({
|
|
18052
|
-
addonId: string(),
|
|
18053
|
-
candidate: DiscoveryCandidateSchema,
|
|
18054
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
18055
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
18056
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
18057
|
-
integrationId: string().optional()
|
|
18058
|
-
}), DeviceSummarySchema, {
|
|
18059
|
-
kind: "mutation",
|
|
18060
|
-
auth: "admin"
|
|
18061
|
-
}), method(object({
|
|
18062
|
-
addonId: string(),
|
|
18063
|
-
type: _enum(DeviceType)
|
|
18064
|
-
}), unknown().nullable()), method(object({
|
|
18065
|
-
addonId: string(),
|
|
18066
|
-
type: _enum(DeviceType),
|
|
18067
|
-
config: record(string(), unknown()),
|
|
18068
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
18069
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
18070
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
18071
|
-
integrationId: string().optional()
|
|
18072
|
-
}), DeviceSummarySchema, {
|
|
18073
|
-
kind: "mutation",
|
|
18074
|
-
auth: "admin"
|
|
18075
|
-
}), method(object({
|
|
18076
|
-
addonId: string(),
|
|
18077
|
-
type: _enum(DeviceType),
|
|
18078
|
-
key: string(),
|
|
18079
|
-
value: unknown(),
|
|
18080
|
-
formValues: record(string(), unknown()).optional()
|
|
18081
|
-
}), FieldProbeResultSchema, {
|
|
18082
|
-
kind: "mutation",
|
|
18083
|
-
auth: "admin"
|
|
18084
|
-
}), method(object({
|
|
18085
|
-
addonId: string(),
|
|
18086
|
-
integrationId: string()
|
|
18087
|
-
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
18088
|
-
addonId: string(),
|
|
18089
|
-
integrationId: string()
|
|
18090
|
-
}), AdoptionStatusSchema, {
|
|
18091
|
-
kind: "mutation",
|
|
18092
|
-
auth: "admin"
|
|
18093
|
-
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
18094
|
-
kind: "mutation",
|
|
18095
|
-
auth: "admin"
|
|
18096
|
-
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
18097
|
-
kind: "mutation",
|
|
18098
|
-
auth: "admin"
|
|
18099
|
-
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
18100
|
-
kind: "mutation",
|
|
18101
|
-
auth: "admin"
|
|
18102
|
-
}), method(object({}), object({ providers: array(object({
|
|
18103
|
-
addonId: string(),
|
|
18104
|
-
label: string()
|
|
18105
|
-
})).readonly() }), { auth: "admin" }), method(object({}), object({ groups: array(object({
|
|
18106
|
-
addonId: string(),
|
|
18107
|
-
label: string(),
|
|
18108
|
-
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
18109
|
-
error: string().nullable()
|
|
18110
|
-
})).readonly() }), {
|
|
18111
|
-
kind: "mutation",
|
|
18112
|
-
auth: "admin"
|
|
18113
|
-
}), method(object({
|
|
18114
|
-
addonId: string(),
|
|
18115
|
-
params: record(string(), unknown()).optional()
|
|
18116
|
-
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
18117
|
-
kind: "mutation",
|
|
18118
|
-
auth: "admin"
|
|
18119
|
-
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
18120
|
-
deviceId: number(),
|
|
18121
|
-
key: string(),
|
|
18122
|
-
value: unknown()
|
|
18123
|
-
}), FieldProbeResultSchema, {
|
|
18124
|
-
kind: "mutation",
|
|
18125
|
-
auth: "admin"
|
|
18126
|
-
}), method(object({
|
|
18127
|
-
deviceId: number(),
|
|
18128
|
-
caps: array(string()).readonly().optional()
|
|
18129
|
-
}), record(string(), unknown().nullable()));
|
|
18130
|
-
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
18131
|
-
deviceId: number(),
|
|
18132
|
-
capName: string()
|
|
18133
|
-
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
18134
|
-
deviceId: number(),
|
|
18135
|
-
capName: string(),
|
|
18136
|
-
slice: record(string(), unknown())
|
|
18137
|
-
}), _void(), { kind: "mutation" }), object({
|
|
18138
|
-
deviceId: number(),
|
|
18139
|
-
capName: string(),
|
|
18140
|
-
slice: record(string(), unknown())
|
|
18141
|
-
});
|
|
18142
|
-
/**
|
|
18143
|
-
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
18144
|
-
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
18145
|
-
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
18146
|
-
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
18147
|
-
* post-analysis enrichment-engine.
|
|
18148
|
-
*/
|
|
18149
|
-
var EmbeddingResultSchema = object({
|
|
18150
|
-
embedding: array(number()),
|
|
18151
|
-
inferenceMs: number()
|
|
18152
|
-
});
|
|
18153
|
-
var EmbeddingInfoSchema = object({
|
|
18154
|
-
modelId: string(),
|
|
18155
|
-
embeddingDim: number(),
|
|
18156
|
-
ready: boolean()
|
|
18157
|
-
});
|
|
18158
|
-
method(object({
|
|
18159
|
-
crop: _instanceof(Uint8Array),
|
|
18160
|
-
width: number(),
|
|
18161
|
-
height: number()
|
|
18162
|
-
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
18163
|
-
/**
|
|
18164
|
-
* filesystem-browse — per-node capability for browsing the node's local
|
|
18165
|
-
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
18166
|
-
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
18167
|
-
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
18168
|
-
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
18169
|
-
*/
|
|
18170
|
-
var DirEntrySchema = object({
|
|
18171
|
-
name: string(),
|
|
18172
|
-
path: string()
|
|
18173
|
-
});
|
|
18174
|
-
var BrowseResultSchema = object({
|
|
18175
|
-
path: string(),
|
|
18176
|
-
entries: array(DirEntrySchema).readonly(),
|
|
18177
|
-
freeBytes: number(),
|
|
18178
|
-
totalBytes: number()
|
|
18179
|
-
});
|
|
18180
|
-
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
18699
|
+
auth: "admin"
|
|
18700
|
+
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
18701
|
+
capName: string(),
|
|
18702
|
+
wrappers: array(string())
|
|
18703
|
+
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
18704
|
+
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
18705
|
+
live: SettingsSchemaWithValuesSchema.nullable()
|
|
18706
|
+
})), method(object({
|
|
18707
|
+
deviceId: number().int().nonnegative(),
|
|
18708
|
+
action: string().min(1),
|
|
18709
|
+
input: unknown()
|
|
18710
|
+
}), unknown(), { kind: "mutation" }), method(object({
|
|
18711
|
+
deviceId: number(),
|
|
18712
|
+
writerCapName: string(),
|
|
18713
|
+
writerAddonId: string(),
|
|
18714
|
+
key: string(),
|
|
18715
|
+
value: unknown()
|
|
18716
|
+
}), object({ success: literal(true) }), {
|
|
18181
18717
|
kind: "mutation",
|
|
18182
18718
|
auth: "admin"
|
|
18183
|
-
})
|
|
18184
|
-
|
|
18185
|
-
|
|
18186
|
-
|
|
18187
|
-
|
|
18188
|
-
|
|
18189
|
-
|
|
18190
|
-
|
|
18191
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
18192
|
-
*/
|
|
18193
|
-
var LlmUsageSchema = object({
|
|
18194
|
-
inputTokens: number(),
|
|
18195
|
-
outputTokens: number()
|
|
18196
|
-
});
|
|
18197
|
-
var LlmErrorCodeSchema = _enum([
|
|
18198
|
-
"timeout",
|
|
18199
|
-
"rate-limited",
|
|
18200
|
-
"auth",
|
|
18201
|
-
"refusal",
|
|
18202
|
-
"bad-request",
|
|
18203
|
-
"unavailable",
|
|
18204
|
-
"no-profile",
|
|
18205
|
-
"budget-exceeded",
|
|
18206
|
-
"adapter-error"
|
|
18207
|
-
]);
|
|
18208
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
18209
|
-
ok: literal(true),
|
|
18210
|
-
text: string(),
|
|
18211
|
-
model: string(),
|
|
18212
|
-
usage: LlmUsageSchema,
|
|
18213
|
-
truncated: boolean(),
|
|
18214
|
-
latencyMs: number()
|
|
18719
|
+
}), method(object({
|
|
18720
|
+
deviceId: number(),
|
|
18721
|
+
changes: array(object({
|
|
18722
|
+
writerCapName: string(),
|
|
18723
|
+
writerAddonId: string(),
|
|
18724
|
+
key: string(),
|
|
18725
|
+
value: unknown()
|
|
18726
|
+
}))
|
|
18215
18727
|
}), object({
|
|
18216
|
-
|
|
18217
|
-
|
|
18218
|
-
|
|
18219
|
-
|
|
18220
|
-
|
|
18221
|
-
|
|
18222
|
-
|
|
18223
|
-
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
18224
|
-
* notification-output.cap.ts:27-31 precedents).
|
|
18225
|
-
*/
|
|
18226
|
-
var LlmImageSchema = object({
|
|
18227
|
-
bytes: _instanceof(Uint8Array),
|
|
18228
|
-
mimeType: string()
|
|
18229
|
-
});
|
|
18230
|
-
var LlmGenerateBaseInputSchema = object({
|
|
18231
|
-
/** Collection routing (the notification-output posture). */
|
|
18232
|
-
addonId: string().optional(),
|
|
18233
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
18234
|
-
profileId: string().optional(),
|
|
18235
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
18236
|
-
consumer: string(),
|
|
18237
|
-
system: string().optional(),
|
|
18238
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
18239
|
-
prompt: string(),
|
|
18240
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
18241
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
18242
|
-
/** Per-call override of the profile default. */
|
|
18243
|
-
maxTokens: number().int().positive().optional(),
|
|
18244
|
-
temperature: number().optional()
|
|
18245
|
-
});
|
|
18246
|
-
/**
|
|
18247
|
-
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
18248
|
-
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
18249
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
18250
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
18251
|
-
* this only through the `llm` cap's methods.
|
|
18252
|
-
*
|
|
18253
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
18254
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
18255
|
-
* watchdog — operator decision #3).
|
|
18256
|
-
*/
|
|
18257
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
18258
|
-
object({
|
|
18259
|
-
kind: literal("catalog"),
|
|
18260
|
-
catalogId: string()
|
|
18261
|
-
}),
|
|
18262
|
-
object({
|
|
18263
|
-
kind: literal("url"),
|
|
18264
|
-
url: string(),
|
|
18265
|
-
sha256: string().optional()
|
|
18266
|
-
}),
|
|
18267
|
-
object({
|
|
18268
|
-
kind: literal("path"),
|
|
18269
|
-
path: string()
|
|
18270
|
-
})
|
|
18271
|
-
]);
|
|
18272
|
-
var ManagedRuntimeConfigSchema = object({
|
|
18273
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
18274
|
-
nodeId: string(),
|
|
18275
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
18276
|
-
engine: _enum(["llama-cpp"]),
|
|
18277
|
-
model: ManagedModelRefSchema,
|
|
18278
|
-
contextSize: number().int().default(4096),
|
|
18279
|
-
/** 0 = CPU-only. */
|
|
18280
|
-
gpuLayers: number().int().default(0),
|
|
18281
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
18282
|
-
threads: number().int().optional(),
|
|
18283
|
-
/** Concurrent slots. */
|
|
18284
|
-
parallel: number().int().default(1),
|
|
18285
|
-
/** Else lazy: first generate boots it. */
|
|
18286
|
-
autoStart: boolean().default(false),
|
|
18287
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
18288
|
-
idleStopMinutes: number().int().default(30)
|
|
18289
|
-
});
|
|
18290
|
-
var LlmRuntimeStatusSchema = object({
|
|
18291
|
-
/** Status is ALWAYS node-qualified. */
|
|
18292
|
-
nodeId: string(),
|
|
18293
|
-
state: _enum([
|
|
18294
|
-
"stopped",
|
|
18295
|
-
"downloading",
|
|
18296
|
-
"starting",
|
|
18297
|
-
"ready",
|
|
18298
|
-
"crashed",
|
|
18299
|
-
"failed"
|
|
18300
|
-
]),
|
|
18301
|
-
pid: number().optional(),
|
|
18302
|
-
port: number().optional(),
|
|
18303
|
-
modelPath: string().optional(),
|
|
18304
|
-
modelId: string().optional(),
|
|
18305
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
18306
|
-
lastError: string().optional(),
|
|
18307
|
-
crashesInWindow: number(),
|
|
18308
|
-
/** Child RSS (sampled best-effort). */
|
|
18309
|
-
memoryBytes: number().optional(),
|
|
18310
|
-
vramBytes: number().optional()
|
|
18311
|
-
});
|
|
18312
|
-
var LlmNodeModelSchema = object({
|
|
18313
|
-
file: string(),
|
|
18314
|
-
sizeBytes: number(),
|
|
18315
|
-
catalogId: string().optional(),
|
|
18316
|
-
installedAt: number().optional()
|
|
18317
|
-
});
|
|
18318
|
-
var LlmRuntimeDiskUsageSchema = object({
|
|
18319
|
-
nodeId: string(),
|
|
18320
|
-
modelsBytes: number(),
|
|
18321
|
-
freeBytes: number().optional()
|
|
18322
|
-
});
|
|
18323
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
18324
|
-
images: array(LlmImageSchema).optional(),
|
|
18325
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
18326
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
18327
|
-
timeoutMs: number().int().positive().optional()
|
|
18328
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
18728
|
+
success: literal(true),
|
|
18729
|
+
failures: array(object({
|
|
18730
|
+
writerCapName: string(),
|
|
18731
|
+
writerAddonId: string(),
|
|
18732
|
+
error: string()
|
|
18733
|
+
}))
|
|
18734
|
+
}), {
|
|
18329
18735
|
kind: "mutation",
|
|
18330
18736
|
auth: "admin"
|
|
18331
|
-
}), method(object({}),
|
|
18737
|
+
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
18332
18738
|
kind: "mutation",
|
|
18333
18739
|
auth: "admin"
|
|
18334
|
-
}), method(object({
|
|
18740
|
+
}), method(object({
|
|
18741
|
+
addonId: string(),
|
|
18742
|
+
candidate: DiscoveryCandidateSchema,
|
|
18743
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
18744
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
18745
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
18746
|
+
integrationId: string().optional()
|
|
18747
|
+
}), DeviceSummarySchema, {
|
|
18335
18748
|
kind: "mutation",
|
|
18336
18749
|
auth: "admin"
|
|
18337
|
-
}), method(object({
|
|
18750
|
+
}), method(object({
|
|
18751
|
+
addonId: string(),
|
|
18752
|
+
type: _enum(DeviceType)
|
|
18753
|
+
}), unknown().nullable()), method(object({
|
|
18754
|
+
addonId: string(),
|
|
18755
|
+
type: _enum(DeviceType),
|
|
18756
|
+
config: record(string(), unknown()),
|
|
18757
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
18758
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
18759
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
18760
|
+
integrationId: string().optional()
|
|
18761
|
+
}), DeviceSummarySchema, {
|
|
18338
18762
|
kind: "mutation",
|
|
18339
18763
|
auth: "admin"
|
|
18340
|
-
}), method(object({
|
|
18341
|
-
/**
|
|
18342
|
-
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
18343
|
-
* methods concat-fan across providers; single-row methods route to ONE
|
|
18344
|
-
* provider by the `addonId` in the call input (the notification-output
|
|
18345
|
-
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
18346
|
-
* (hub-placed); the cap stays open for future providers.
|
|
18347
|
-
*
|
|
18348
|
-
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
18349
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
18350
|
-
* write; a stored key NEVER round-trips to a client.
|
|
18351
|
-
*/
|
|
18352
|
-
var LlmProfileKindSchema = _enum([
|
|
18353
|
-
"openai-compatible",
|
|
18354
|
-
"openai",
|
|
18355
|
-
"anthropic",
|
|
18356
|
-
"google",
|
|
18357
|
-
"managed-local"
|
|
18358
|
-
]);
|
|
18359
|
-
var LlmProfileSchema = object({
|
|
18360
|
-
id: string(),
|
|
18361
|
-
name: string(),
|
|
18362
|
-
kind: LlmProfileKindSchema,
|
|
18363
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
18764
|
+
}), method(object({
|
|
18364
18765
|
addonId: string(),
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
|
|
18368
|
-
|
|
18369
|
-
|
|
18370
|
-
|
|
18371
|
-
|
|
18372
|
-
|
|
18373
|
-
temperature: number().min(0).max(2).optional(),
|
|
18374
|
-
maxTokens: number().int().positive().optional(),
|
|
18375
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
18376
|
-
extraHeaders: record(string(), string()).optional(),
|
|
18377
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
18378
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
18379
|
-
});
|
|
18380
|
-
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
18381
|
-
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
18382
|
-
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
18383
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
18384
|
-
var LlmProfileKindDescriptorSchema = object({
|
|
18385
|
-
kind: LlmProfileKindSchema,
|
|
18386
|
-
label: string(),
|
|
18387
|
-
icon: string(),
|
|
18388
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
18766
|
+
type: _enum(DeviceType),
|
|
18767
|
+
key: string(),
|
|
18768
|
+
value: unknown(),
|
|
18769
|
+
formValues: record(string(), unknown()).optional()
|
|
18770
|
+
}), FieldProbeResultSchema, {
|
|
18771
|
+
kind: "mutation",
|
|
18772
|
+
auth: "admin"
|
|
18773
|
+
}), method(object({
|
|
18389
18774
|
addonId: string(),
|
|
18390
|
-
|
|
18391
|
-
})
|
|
18392
|
-
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
18393
|
-
var LlmDefaultSchema = object({
|
|
18394
|
-
selector: LlmDefaultSelectorSchema,
|
|
18395
|
-
profileId: string()
|
|
18396
|
-
});
|
|
18397
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
18398
|
-
var LlmUsageRollupSchema = object({
|
|
18399
|
-
day: string(),
|
|
18400
|
-
consumer: string(),
|
|
18401
|
-
profileId: string(),
|
|
18402
|
-
calls: number(),
|
|
18403
|
-
okCalls: number(),
|
|
18404
|
-
errorCalls: number(),
|
|
18405
|
-
inputTokens: number(),
|
|
18406
|
-
outputTokens: number(),
|
|
18407
|
-
avgLatencyMs: number()
|
|
18408
|
-
});
|
|
18409
|
-
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
18410
|
-
var ManagedModelCatalogEntrySchema = object({
|
|
18411
|
-
id: string(),
|
|
18412
|
-
label: string(),
|
|
18413
|
-
family: string(),
|
|
18414
|
-
purpose: _enum(["text", "vision"]),
|
|
18415
|
-
url: string(),
|
|
18416
|
-
sha256: string(),
|
|
18417
|
-
sizeBytes: number(),
|
|
18418
|
-
quantization: string(),
|
|
18419
|
-
/** Load-time guidance shown in the picker. */
|
|
18420
|
-
minRamBytes: number(),
|
|
18421
|
-
contextSizeDefault: number().int(),
|
|
18422
|
-
/** Vision models: companion projector file. */
|
|
18423
|
-
mmprojUrl: string().optional()
|
|
18424
|
-
});
|
|
18425
|
-
var LlmRuntimeNodeSchema = object({
|
|
18426
|
-
nodeId: string(),
|
|
18427
|
-
reachable: boolean(),
|
|
18428
|
-
status: LlmRuntimeStatusSchema.optional(),
|
|
18429
|
-
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
18430
|
-
error: string().optional()
|
|
18431
|
-
});
|
|
18432
|
-
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
18433
|
-
var ProfileRefInputSchema = object({
|
|
18775
|
+
integrationId: string()
|
|
18776
|
+
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
18434
18777
|
addonId: string(),
|
|
18435
|
-
|
|
18436
|
-
})
|
|
18437
|
-
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
18778
|
+
integrationId: string()
|
|
18779
|
+
}), AdoptionStatusSchema, {
|
|
18438
18780
|
kind: "mutation",
|
|
18439
18781
|
auth: "admin"
|
|
18440
|
-
}), method(
|
|
18782
|
+
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
18441
18783
|
kind: "mutation",
|
|
18442
18784
|
auth: "admin"
|
|
18443
|
-
}), method(
|
|
18785
|
+
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
18444
18786
|
kind: "mutation",
|
|
18445
18787
|
auth: "admin"
|
|
18446
|
-
}), method(
|
|
18447
|
-
selector: LlmDefaultSelectorSchema,
|
|
18448
|
-
profileId: string().nullable()
|
|
18449
|
-
}), _void(), {
|
|
18788
|
+
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
18450
18789
|
kind: "mutation",
|
|
18451
18790
|
auth: "admin"
|
|
18452
|
-
}), method(object({
|
|
18453
|
-
|
|
18454
|
-
|
|
18455
|
-
|
|
18456
|
-
|
|
18457
|
-
|
|
18458
|
-
|
|
18459
|
-
|
|
18460
|
-
})
|
|
18791
|
+
}), method(object({}), object({ providers: array(object({
|
|
18792
|
+
addonId: string(),
|
|
18793
|
+
label: string()
|
|
18794
|
+
})).readonly() }), { auth: "admin" }), method(object({}), object({ groups: array(object({
|
|
18795
|
+
addonId: string(),
|
|
18796
|
+
label: string(),
|
|
18797
|
+
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
18798
|
+
error: string().nullable()
|
|
18799
|
+
})).readonly() }), {
|
|
18461
18800
|
kind: "mutation",
|
|
18462
18801
|
auth: "admin"
|
|
18463
18802
|
}), method(object({
|
|
18464
|
-
|
|
18465
|
-
|
|
18466
|
-
}),
|
|
18803
|
+
addonId: string(),
|
|
18804
|
+
params: record(string(), unknown()).optional()
|
|
18805
|
+
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
18467
18806
|
kind: "mutation",
|
|
18468
18807
|
auth: "admin"
|
|
18469
|
-
}), method(
|
|
18808
|
+
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
18809
|
+
deviceId: number(),
|
|
18810
|
+
key: string(),
|
|
18811
|
+
value: unknown()
|
|
18812
|
+
}), FieldProbeResultSchema, {
|
|
18470
18813
|
kind: "mutation",
|
|
18471
18814
|
auth: "admin"
|
|
18472
|
-
}), method(
|
|
18815
|
+
}), method(object({
|
|
18816
|
+
deviceId: number(),
|
|
18817
|
+
caps: array(string()).readonly().optional()
|
|
18818
|
+
}), record(string(), unknown().nullable()));
|
|
18819
|
+
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
18820
|
+
deviceId: number(),
|
|
18821
|
+
capName: string()
|
|
18822
|
+
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
18823
|
+
deviceId: number(),
|
|
18824
|
+
capName: string(),
|
|
18825
|
+
slice: record(string(), unknown())
|
|
18826
|
+
}), _void(), { kind: "mutation" }), object({
|
|
18827
|
+
deviceId: number(),
|
|
18828
|
+
capName: string(),
|
|
18829
|
+
slice: record(string(), unknown())
|
|
18830
|
+
});
|
|
18831
|
+
/**
|
|
18832
|
+
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
18833
|
+
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
18834
|
+
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
18835
|
+
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
18836
|
+
* post-analysis enrichment-engine.
|
|
18837
|
+
*/
|
|
18838
|
+
var EmbeddingResultSchema = object({
|
|
18839
|
+
embedding: array(number()),
|
|
18840
|
+
inferenceMs: number()
|
|
18841
|
+
});
|
|
18842
|
+
var EmbeddingInfoSchema = object({
|
|
18843
|
+
modelId: string(),
|
|
18844
|
+
embeddingDim: number(),
|
|
18845
|
+
ready: boolean()
|
|
18846
|
+
});
|
|
18847
|
+
method(object({
|
|
18848
|
+
crop: _instanceof(Uint8Array),
|
|
18849
|
+
width: number(),
|
|
18850
|
+
height: number()
|
|
18851
|
+
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
18852
|
+
/**
|
|
18853
|
+
* filesystem-browse — per-node capability for browsing the node's local
|
|
18854
|
+
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
18855
|
+
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
18856
|
+
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
18857
|
+
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
18858
|
+
*/
|
|
18859
|
+
var DirEntrySchema = object({
|
|
18860
|
+
name: string(),
|
|
18861
|
+
path: string()
|
|
18862
|
+
});
|
|
18863
|
+
var BrowseResultSchema = object({
|
|
18864
|
+
path: string(),
|
|
18865
|
+
entries: array(DirEntrySchema).readonly(),
|
|
18866
|
+
freeBytes: number(),
|
|
18867
|
+
totalBytes: number()
|
|
18868
|
+
});
|
|
18869
|
+
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
18473
18870
|
kind: "mutation",
|
|
18474
18871
|
auth: "admin"
|
|
18475
18872
|
});
|
|
18476
|
-
|
|
18477
|
-
|
|
18478
|
-
|
|
18479
|
-
|
|
18480
|
-
|
|
18873
|
+
/**
|
|
18874
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
18875
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
18876
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
18877
|
+
*
|
|
18878
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
18879
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
18880
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
18881
|
+
*/
|
|
18882
|
+
var LlmUsageSchema = object({
|
|
18883
|
+
inputTokens: number(),
|
|
18884
|
+
outputTokens: number()
|
|
18885
|
+
});
|
|
18886
|
+
var LlmErrorCodeSchema = _enum([
|
|
18887
|
+
"timeout",
|
|
18888
|
+
"rate-limited",
|
|
18889
|
+
"auth",
|
|
18890
|
+
"refusal",
|
|
18891
|
+
"bad-request",
|
|
18892
|
+
"unavailable",
|
|
18893
|
+
"no-profile",
|
|
18894
|
+
"budget-exceeded",
|
|
18895
|
+
"adapter-error"
|
|
18481
18896
|
]);
|
|
18482
|
-
var
|
|
18483
|
-
|
|
18484
|
-
|
|
18485
|
-
|
|
18897
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
18898
|
+
ok: literal(true),
|
|
18899
|
+
text: string(),
|
|
18900
|
+
model: string(),
|
|
18901
|
+
usage: LlmUsageSchema,
|
|
18902
|
+
truncated: boolean(),
|
|
18903
|
+
latencyMs: number()
|
|
18904
|
+
}), object({
|
|
18905
|
+
ok: literal(false),
|
|
18906
|
+
code: LlmErrorCodeSchema,
|
|
18486
18907
|
message: string(),
|
|
18487
|
-
|
|
18488
|
-
|
|
18489
|
-
});
|
|
18490
|
-
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
18491
|
-
scope: array(string()).optional(),
|
|
18492
|
-
level: LogLevelSchema.optional(),
|
|
18493
|
-
since: date().optional(),
|
|
18494
|
-
until: date().optional(),
|
|
18495
|
-
limit: number().optional(),
|
|
18496
|
-
tags: record(string(), string()).optional()
|
|
18497
|
-
}), array(LogEntrySchema).readonly());
|
|
18908
|
+
retryAfterMs: number().optional()
|
|
18909
|
+
})]);
|
|
18498
18910
|
/**
|
|
18499
|
-
* `
|
|
18500
|
-
*
|
|
18501
|
-
*
|
|
18502
|
-
|
|
18503
|
-
|
|
18504
|
-
|
|
18505
|
-
|
|
18506
|
-
|
|
18507
|
-
|
|
18508
|
-
|
|
18509
|
-
|
|
18510
|
-
|
|
18511
|
-
|
|
18512
|
-
|
|
18513
|
-
|
|
18514
|
-
|
|
18515
|
-
|
|
18516
|
-
|
|
18517
|
-
|
|
18518
|
-
|
|
18519
|
-
|
|
18520
|
-
|
|
18521
|
-
|
|
18522
|
-
|
|
18523
|
-
|
|
18524
|
-
*
|
|
18525
|
-
*
|
|
18526
|
-
*
|
|
18527
|
-
*
|
|
18528
|
-
*
|
|
18529
|
-
* Every contribution carries a `stage`:
|
|
18530
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
18531
|
-
* magic-link buttons; a future usernameless passkey).
|
|
18532
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18533
|
-
* returned `factors` (passkey-as-2FA today).
|
|
18911
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
18912
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
18913
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
18914
|
+
*/
|
|
18915
|
+
var LlmImageSchema = object({
|
|
18916
|
+
bytes: _instanceof(Uint8Array),
|
|
18917
|
+
mimeType: string()
|
|
18918
|
+
});
|
|
18919
|
+
var LlmGenerateBaseInputSchema = object({
|
|
18920
|
+
/** Collection routing (the notification-output posture). */
|
|
18921
|
+
addonId: string().optional(),
|
|
18922
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
18923
|
+
profileId: string().optional(),
|
|
18924
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
18925
|
+
consumer: string(),
|
|
18926
|
+
system: string().optional(),
|
|
18927
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
18928
|
+
prompt: string(),
|
|
18929
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
18930
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
18931
|
+
/** Per-call override of the profile default. */
|
|
18932
|
+
maxTokens: number().int().positive().optional(),
|
|
18933
|
+
temperature: number().optional()
|
|
18934
|
+
});
|
|
18935
|
+
/**
|
|
18936
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
18937
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
18938
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
18939
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
18940
|
+
* this only through the `llm` cap's methods.
|
|
18534
18941
|
*
|
|
18535
|
-
*
|
|
18536
|
-
*
|
|
18537
|
-
*
|
|
18942
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
18943
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
18944
|
+
* watchdog — operator decision #3).
|
|
18538
18945
|
*/
|
|
18539
|
-
|
|
18540
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
18541
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
18542
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
18946
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
18543
18947
|
object({
|
|
18544
|
-
kind: literal("
|
|
18545
|
-
|
|
18546
|
-
id: string(),
|
|
18547
|
-
/** Operator-facing button label. */
|
|
18548
|
-
label: string(),
|
|
18549
|
-
/** lucide-react icon name. */
|
|
18550
|
-
icon: string().optional(),
|
|
18551
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
18552
|
-
startUrl: string(),
|
|
18553
|
-
stage: LoginStageEnum
|
|
18948
|
+
kind: literal("catalog"),
|
|
18949
|
+
catalogId: string()
|
|
18554
18950
|
}),
|
|
18555
18951
|
object({
|
|
18556
|
-
kind: literal("
|
|
18557
|
-
|
|
18558
|
-
|
|
18559
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
18560
|
-
addonId: string(),
|
|
18561
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
18562
|
-
bundle: string(),
|
|
18563
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
18564
|
-
remote: WidgetRemoteSchema,
|
|
18565
|
-
stage: LoginStageEnum
|
|
18952
|
+
kind: literal("url"),
|
|
18953
|
+
url: string(),
|
|
18954
|
+
sha256: string().optional()
|
|
18566
18955
|
}),
|
|
18567
18956
|
object({
|
|
18568
|
-
kind: literal("
|
|
18569
|
-
|
|
18570
|
-
id: string(),
|
|
18571
|
-
/** Operator-facing button label. */
|
|
18572
|
-
label: string(),
|
|
18573
|
-
stage: LoginStageEnum,
|
|
18574
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
18575
|
-
rpId: string(),
|
|
18576
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
18577
|
-
origin: string().nullable()
|
|
18957
|
+
kind: literal("path"),
|
|
18958
|
+
path: string()
|
|
18578
18959
|
})
|
|
18579
18960
|
]);
|
|
18580
|
-
|
|
18581
|
-
|
|
18582
|
-
|
|
18583
|
-
|
|
18584
|
-
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
|
|
18588
|
-
|
|
18589
|
-
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
|
|
18597
|
-
usedBytes: number(),
|
|
18598
|
-
availableBytes: number(),
|
|
18599
|
-
swapUsedBytes: number(),
|
|
18600
|
-
swapTotalBytes: number()
|
|
18601
|
-
});
|
|
18602
|
-
var DiskIoSnapshotSchema = object({
|
|
18603
|
-
readBytes: number(),
|
|
18604
|
-
writeBytes: number(),
|
|
18605
|
-
readOps: number(),
|
|
18606
|
-
writeOps: number(),
|
|
18607
|
-
timestampMs: number()
|
|
18608
|
-
});
|
|
18609
|
-
var NetworkIoSnapshotSchema = object({
|
|
18610
|
-
rxBytes: number(),
|
|
18611
|
-
txBytes: number(),
|
|
18612
|
-
rxPackets: number(),
|
|
18613
|
-
txPackets: number(),
|
|
18614
|
-
rxErrors: number(),
|
|
18615
|
-
txErrors: number(),
|
|
18616
|
-
timestampMs: number()
|
|
18617
|
-
});
|
|
18618
|
-
var MetricsGpuInfoSchema = object({
|
|
18619
|
-
utilization: number(),
|
|
18620
|
-
model: string(),
|
|
18621
|
-
memoryUsedBytes: number(),
|
|
18622
|
-
memoryTotalBytes: number(),
|
|
18623
|
-
temperature: number().nullable()
|
|
18624
|
-
});
|
|
18625
|
-
var ProcessResourceInfoSchema = object({
|
|
18626
|
-
openFds: number(),
|
|
18627
|
-
threadCount: number(),
|
|
18628
|
-
activeHandles: number(),
|
|
18629
|
-
activeRequests: number()
|
|
18630
|
-
});
|
|
18631
|
-
var PressureAvgsSchema = object({
|
|
18632
|
-
avg10: number(),
|
|
18633
|
-
avg60: number(),
|
|
18634
|
-
avg300: number()
|
|
18635
|
-
});
|
|
18636
|
-
var PressureInfoSchema = object({
|
|
18637
|
-
some: PressureAvgsSchema,
|
|
18638
|
-
full: PressureAvgsSchema.nullable()
|
|
18639
|
-
});
|
|
18640
|
-
var SystemResourceSnapshotSchema = object({
|
|
18641
|
-
cpu: CpuBreakdownSchema,
|
|
18642
|
-
memory: MemoryInfoSchema,
|
|
18643
|
-
gpu: MetricsGpuInfoSchema.nullable(),
|
|
18644
|
-
network: NetworkIoSnapshotSchema,
|
|
18645
|
-
disk: DiskIoSnapshotSchema,
|
|
18646
|
-
pressure: object({
|
|
18647
|
-
cpu: PressureInfoSchema.nullable(),
|
|
18648
|
-
memory: PressureInfoSchema.nullable(),
|
|
18649
|
-
io: PressureInfoSchema.nullable()
|
|
18650
|
-
}),
|
|
18651
|
-
process: ProcessResourceInfoSchema,
|
|
18652
|
-
cpuTemperature: number().nullable(),
|
|
18653
|
-
timestampMs: number()
|
|
18654
|
-
});
|
|
18655
|
-
var DiskSpaceInfoSchema = object({
|
|
18656
|
-
path: string(),
|
|
18657
|
-
totalBytes: number(),
|
|
18658
|
-
usedBytes: number(),
|
|
18659
|
-
availableBytes: number(),
|
|
18660
|
-
percent: number()
|
|
18661
|
-
});
|
|
18662
|
-
var PidResourceStatsSchema = object({
|
|
18663
|
-
pid: number(),
|
|
18664
|
-
cpu: number(),
|
|
18665
|
-
memory: number(),
|
|
18666
|
-
/**
|
|
18667
|
-
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
18668
|
-
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
18669
|
-
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
18670
|
-
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
18671
|
-
* Undefined where /proc is unavailable (e.g. macOS).
|
|
18672
|
-
*/
|
|
18673
|
-
privateBytes: number().optional(),
|
|
18674
|
-
/**
|
|
18675
|
-
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
18676
|
-
* code shared copy-on-write across runners. Undefined on macOS.
|
|
18677
|
-
*/
|
|
18678
|
-
sharedBytes: number().optional()
|
|
18961
|
+
var ManagedRuntimeConfigSchema = object({
|
|
18962
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
18963
|
+
nodeId: string(),
|
|
18964
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
18965
|
+
engine: _enum(["llama-cpp"]),
|
|
18966
|
+
model: ManagedModelRefSchema,
|
|
18967
|
+
contextSize: number().int().default(4096),
|
|
18968
|
+
/** 0 = CPU-only. */
|
|
18969
|
+
gpuLayers: number().int().default(0),
|
|
18970
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
18971
|
+
threads: number().int().optional(),
|
|
18972
|
+
/** Concurrent slots. */
|
|
18973
|
+
parallel: number().int().default(1),
|
|
18974
|
+
/** Else lazy: first generate boots it. */
|
|
18975
|
+
autoStart: boolean().default(false),
|
|
18976
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
18977
|
+
idleStopMinutes: number().int().default(30)
|
|
18679
18978
|
});
|
|
18680
|
-
var
|
|
18681
|
-
|
|
18979
|
+
var LlmRuntimeStatusSchema = object({
|
|
18980
|
+
/** Status is ALWAYS node-qualified. */
|
|
18682
18981
|
nodeId: string(),
|
|
18683
|
-
role: _enum(["hub", "worker"]),
|
|
18684
|
-
pid: number(),
|
|
18685
18982
|
state: _enum([
|
|
18686
|
-
"starting",
|
|
18687
|
-
"running",
|
|
18688
|
-
"stopping",
|
|
18689
18983
|
"stopped",
|
|
18690
|
-
"
|
|
18691
|
-
|
|
18692
|
-
|
|
18693
|
-
|
|
18694
|
-
|
|
18695
|
-
pid: number(),
|
|
18696
|
-
ppid: number(),
|
|
18697
|
-
pgid: number(),
|
|
18698
|
-
classification: _enum([
|
|
18699
|
-
"root",
|
|
18700
|
-
"managed",
|
|
18701
|
-
"system",
|
|
18702
|
-
"ghost"
|
|
18984
|
+
"downloading",
|
|
18985
|
+
"starting",
|
|
18986
|
+
"ready",
|
|
18987
|
+
"crashed",
|
|
18988
|
+
"failed"
|
|
18703
18989
|
]),
|
|
18704
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
18705
|
-
addonId: string().nullable(),
|
|
18706
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
18707
|
-
nodeId: string().nullable(),
|
|
18708
|
-
/** Truncated command line. */
|
|
18709
|
-
command: string(),
|
|
18710
|
-
cpuPercent: number(),
|
|
18711
|
-
memoryRssBytes: number(),
|
|
18712
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
18713
|
-
uptimeSec: number(),
|
|
18714
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
18715
|
-
orphaned: boolean()
|
|
18716
|
-
});
|
|
18717
|
-
var KillProcessInputSchema = object({
|
|
18718
|
-
pid: number(),
|
|
18719
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
18720
|
-
force: boolean().optional()
|
|
18721
|
-
});
|
|
18722
|
-
var KillProcessResultSchema = object({
|
|
18723
|
-
success: boolean(),
|
|
18724
|
-
reason: string().optional(),
|
|
18725
|
-
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
18726
|
-
});
|
|
18727
|
-
var DumpHeapSnapshotInputSchema = object({
|
|
18728
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
18729
|
-
addonId: string() });
|
|
18730
|
-
var DumpHeapSnapshotResultSchema = object({
|
|
18731
|
-
success: boolean(),
|
|
18732
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
18733
|
-
path: string().optional(),
|
|
18734
|
-
/** Process pid that was signalled. */
|
|
18735
18990
|
pid: number().optional(),
|
|
18736
|
-
|
|
18991
|
+
port: number().optional(),
|
|
18992
|
+
modelPath: string().optional(),
|
|
18993
|
+
modelId: string().optional(),
|
|
18994
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
18995
|
+
lastError: string().optional(),
|
|
18996
|
+
crashesInWindow: number(),
|
|
18997
|
+
/** Child RSS (sampled best-effort). */
|
|
18998
|
+
memoryBytes: number().optional(),
|
|
18999
|
+
vramBytes: number().optional()
|
|
18737
19000
|
});
|
|
18738
|
-
var
|
|
18739
|
-
|
|
18740
|
-
|
|
18741
|
-
|
|
18742
|
-
|
|
18743
|
-
diskPercent: number().optional(),
|
|
18744
|
-
temperature: number().optional(),
|
|
18745
|
-
gpuPercent: number().optional(),
|
|
18746
|
-
gpuMemoryPercent: number().optional()
|
|
19001
|
+
var LlmNodeModelSchema = object({
|
|
19002
|
+
file: string(),
|
|
19003
|
+
sizeBytes: number(),
|
|
19004
|
+
catalogId: string().optional(),
|
|
19005
|
+
installedAt: number().optional()
|
|
18747
19006
|
});
|
|
18748
|
-
|
|
19007
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
19008
|
+
nodeId: string(),
|
|
19009
|
+
modelsBytes: number(),
|
|
19010
|
+
freeBytes: number().optional()
|
|
19011
|
+
});
|
|
19012
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
19013
|
+
images: array(LlmImageSchema).optional(),
|
|
19014
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
19015
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
19016
|
+
timeoutMs: number().int().positive().optional()
|
|
19017
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
18749
19018
|
kind: "mutation",
|
|
18750
19019
|
auth: "admin"
|
|
18751
|
-
}), method(
|
|
19020
|
+
}), method(object({}), _void(), {
|
|
18752
19021
|
kind: "mutation",
|
|
18753
19022
|
auth: "admin"
|
|
18754
|
-
})
|
|
18755
|
-
method(object({
|
|
18756
|
-
sourceUrl: string(),
|
|
18757
|
-
metadata: ModelConvertMetadataSchema,
|
|
18758
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
18759
|
-
calibrationRef: string().optional(),
|
|
18760
|
-
sessionId: string().optional()
|
|
18761
|
-
}), ConvertResultSchema, {
|
|
19023
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
18762
19024
|
kind: "mutation",
|
|
18763
|
-
auth: "admin"
|
|
18764
|
-
|
|
18765
|
-
});
|
|
18766
|
-
method(object({
|
|
18767
|
-
nodeId: string(),
|
|
18768
|
-
modelId: string(),
|
|
18769
|
-
format: _enum(MODEL_FORMATS),
|
|
18770
|
-
entry: ModelCatalogEntrySchema
|
|
18771
|
-
}), object({
|
|
18772
|
-
ok: boolean(),
|
|
18773
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
18774
|
-
sha256: string(),
|
|
18775
|
-
bytes: number(),
|
|
18776
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
18777
|
-
path: string()
|
|
18778
|
-
}), {
|
|
19025
|
+
auth: "admin"
|
|
19026
|
+
}), method(object({ file: string() }), _void(), {
|
|
18779
19027
|
kind: "mutation",
|
|
18780
19028
|
auth: "admin"
|
|
18781
|
-
});
|
|
18782
|
-
/**
|
|
18783
|
-
* `mqtt-broker` — broker-registry cap.
|
|
18784
|
-
*
|
|
18785
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
18786
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
18787
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
18788
|
-
* its OWN `mqtt.js` client.
|
|
18789
|
-
*
|
|
18790
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
18791
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
18792
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
18793
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
18794
|
-
* features anyway — give it the connection config, get out of the way.
|
|
18795
|
-
*
|
|
18796
|
-
* Consumer flow:
|
|
18797
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
18798
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
18799
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
18800
|
-
*
|
|
18801
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
18802
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
18803
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
18804
|
-
* spawned it.
|
|
18805
|
-
*/
|
|
18806
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
19029
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
18807
19030
|
/**
|
|
18808
|
-
*
|
|
19031
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
19032
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
19033
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
19034
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
19035
|
+
* (hub-placed); the cap stays open for future providers.
|
|
18809
19036
|
*
|
|
18810
|
-
*
|
|
18811
|
-
*
|
|
18812
|
-
*
|
|
18813
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
18814
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
19037
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
19038
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
19039
|
+
* write; a stored key NEVER round-trips to a client.
|
|
18815
19040
|
*/
|
|
18816
|
-
var
|
|
18817
|
-
"
|
|
18818
|
-
"
|
|
18819
|
-
"
|
|
18820
|
-
"
|
|
18821
|
-
"
|
|
19041
|
+
var LlmProfileKindSchema = _enum([
|
|
19042
|
+
"openai-compatible",
|
|
19043
|
+
"openai",
|
|
19044
|
+
"anthropic",
|
|
19045
|
+
"google",
|
|
19046
|
+
"managed-local"
|
|
18822
19047
|
]);
|
|
18823
|
-
var
|
|
19048
|
+
var LlmProfileSchema = object({
|
|
18824
19049
|
id: string(),
|
|
18825
19050
|
name: string(),
|
|
18826
|
-
|
|
18827
|
-
|
|
18828
|
-
|
|
18829
|
-
|
|
18830
|
-
|
|
18831
|
-
|
|
18832
|
-
|
|
18833
|
-
|
|
18834
|
-
|
|
19051
|
+
kind: LlmProfileKindSchema,
|
|
19052
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
19053
|
+
addonId: string(),
|
|
19054
|
+
enabled: boolean(),
|
|
19055
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
19056
|
+
model: string(),
|
|
19057
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
19058
|
+
baseUrl: string().optional(),
|
|
19059
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
19060
|
+
apiKey: string().optional(),
|
|
19061
|
+
supportsVision: boolean(),
|
|
19062
|
+
temperature: number().min(0).max(2).optional(),
|
|
19063
|
+
maxTokens: number().int().positive().optional(),
|
|
19064
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
19065
|
+
extraHeaders: record(string(), string()).optional(),
|
|
19066
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
19067
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
18835
19068
|
});
|
|
18836
|
-
/**
|
|
18837
|
-
*
|
|
18838
|
-
*
|
|
18839
|
-
|
|
18840
|
-
|
|
18841
|
-
|
|
18842
|
-
|
|
18843
|
-
|
|
18844
|
-
|
|
18845
|
-
|
|
18846
|
-
|
|
18847
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
18848
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
18849
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
18850
|
-
* broker).
|
|
18851
|
-
*/
|
|
18852
|
-
clientIdPrefix: string().optional()
|
|
19069
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
19070
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
19071
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
19072
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
19073
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
19074
|
+
kind: LlmProfileKindSchema,
|
|
19075
|
+
label: string(),
|
|
19076
|
+
icon: string(),
|
|
19077
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
19078
|
+
addonId: string(),
|
|
19079
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
18853
19080
|
});
|
|
18854
|
-
var
|
|
18855
|
-
|
|
18856
|
-
|
|
18857
|
-
|
|
18858
|
-
password: string().optional(),
|
|
18859
|
-
clientIdPrefix: string().optional()
|
|
19081
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
19082
|
+
var LlmDefaultSchema = object({
|
|
19083
|
+
selector: LlmDefaultSelectorSchema,
|
|
19084
|
+
profileId: string()
|
|
18860
19085
|
});
|
|
18861
|
-
|
|
18862
|
-
var
|
|
18863
|
-
|
|
18864
|
-
|
|
18865
|
-
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
18872
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
18873
|
-
allowAnonymous: boolean().default(false),
|
|
18874
|
-
/** Optional shared username/password for clients. */
|
|
18875
|
-
username: string().optional(),
|
|
18876
|
-
password: string().optional()
|
|
19086
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
19087
|
+
var LlmUsageRollupSchema = object({
|
|
19088
|
+
day: string(),
|
|
19089
|
+
consumer: string(),
|
|
19090
|
+
profileId: string(),
|
|
19091
|
+
calls: number(),
|
|
19092
|
+
okCalls: number(),
|
|
19093
|
+
errorCalls: number(),
|
|
19094
|
+
inputTokens: number(),
|
|
19095
|
+
outputTokens: number(),
|
|
19096
|
+
avgLatencyMs: number()
|
|
18877
19097
|
});
|
|
18878
|
-
|
|
19098
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
19099
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
18879
19100
|
id: string(),
|
|
18880
|
-
|
|
18881
|
-
|
|
18882
|
-
|
|
18883
|
-
brokerCount: number(),
|
|
18884
|
-
embeddedRunning: boolean()
|
|
18885
|
-
});
|
|
18886
|
-
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);
|
|
18887
|
-
var NetworkEndpointSchema = object({
|
|
19101
|
+
label: string(),
|
|
19102
|
+
family: string(),
|
|
19103
|
+
purpose: _enum(["text", "vision"]),
|
|
18888
19104
|
url: string(),
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
|
|
19105
|
+
sha256: string(),
|
|
19106
|
+
sizeBytes: number(),
|
|
19107
|
+
quantization: string(),
|
|
19108
|
+
/** Load-time guidance shown in the picker. */
|
|
19109
|
+
minRamBytes: number(),
|
|
19110
|
+
contextSizeDefault: number().int(),
|
|
19111
|
+
/** Vision models: companion projector file. */
|
|
19112
|
+
mmprojUrl: string().optional()
|
|
18892
19113
|
});
|
|
18893
|
-
var
|
|
18894
|
-
|
|
18895
|
-
|
|
19114
|
+
var LlmRuntimeNodeSchema = object({
|
|
19115
|
+
nodeId: string(),
|
|
19116
|
+
reachable: boolean(),
|
|
19117
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
19118
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
18896
19119
|
error: string().optional()
|
|
18897
19120
|
});
|
|
18898
|
-
|
|
18899
|
-
|
|
18900
|
-
|
|
18901
|
-
|
|
18902
|
-
|
|
18903
|
-
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
19121
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
19122
|
+
var ProfileRefInputSchema = object({
|
|
19123
|
+
addonId: string(),
|
|
19124
|
+
profileId: string()
|
|
19125
|
+
});
|
|
19126
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
19127
|
+
kind: "mutation",
|
|
19128
|
+
auth: "admin"
|
|
19129
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
19130
|
+
kind: "mutation",
|
|
19131
|
+
auth: "admin"
|
|
19132
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
19133
|
+
kind: "mutation",
|
|
19134
|
+
auth: "admin"
|
|
19135
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
19136
|
+
selector: LlmDefaultSelectorSchema,
|
|
19137
|
+
profileId: string().nullable()
|
|
19138
|
+
}), _void(), {
|
|
19139
|
+
kind: "mutation",
|
|
19140
|
+
auth: "admin"
|
|
19141
|
+
}), method(object({
|
|
19142
|
+
since: number().optional(),
|
|
19143
|
+
until: number().optional(),
|
|
19144
|
+
consumer: string().optional(),
|
|
19145
|
+
profileId: string().optional()
|
|
19146
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
19147
|
+
nodeId: string(),
|
|
19148
|
+
model: ManagedModelRefSchema
|
|
19149
|
+
}), _void(), {
|
|
19150
|
+
kind: "mutation",
|
|
19151
|
+
auth: "admin"
|
|
19152
|
+
}), method(object({
|
|
19153
|
+
nodeId: string(),
|
|
19154
|
+
file: string()
|
|
19155
|
+
}), _void(), {
|
|
19156
|
+
kind: "mutation",
|
|
19157
|
+
auth: "admin"
|
|
19158
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
19159
|
+
kind: "mutation",
|
|
19160
|
+
auth: "admin"
|
|
19161
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
19162
|
+
kind: "mutation",
|
|
19163
|
+
auth: "admin"
|
|
19164
|
+
});
|
|
19165
|
+
var LogLevelSchema = _enum([
|
|
19166
|
+
"debug",
|
|
19167
|
+
"info",
|
|
19168
|
+
"warn",
|
|
19169
|
+
"error"
|
|
19170
|
+
]);
|
|
19171
|
+
var LogEntrySchema = object({
|
|
19172
|
+
timestamp: date(),
|
|
19173
|
+
level: LogLevelSchema,
|
|
19174
|
+
scope: array(string()),
|
|
19175
|
+
message: string(),
|
|
19176
|
+
meta: record(string(), unknown()).optional(),
|
|
19177
|
+
tags: record(string(), string()).optional()
|
|
18918
19178
|
});
|
|
18919
|
-
method(
|
|
19179
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
19180
|
+
scope: array(string()).optional(),
|
|
19181
|
+
level: LogLevelSchema.optional(),
|
|
19182
|
+
since: date().optional(),
|
|
19183
|
+
until: date().optional(),
|
|
19184
|
+
limit: number().optional(),
|
|
19185
|
+
tags: record(string(), string()).optional()
|
|
19186
|
+
}), array(LogEntrySchema).readonly());
|
|
18920
19187
|
/**
|
|
18921
|
-
*
|
|
19188
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
19189
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
19190
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
19191
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
19192
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
19193
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
18922
19194
|
*
|
|
18923
|
-
*
|
|
18924
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
18925
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
18926
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
18927
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
18928
|
-
* message to what the kind supports — callers never special-case a service.
|
|
19195
|
+
* A contribution is a discriminated union on `kind`:
|
|
18929
19196
|
*
|
|
18930
|
-
*
|
|
18931
|
-
*
|
|
18932
|
-
* `
|
|
18933
|
-
*
|
|
18934
|
-
*
|
|
18935
|
-
* alternative would fork the UI per addon and cannot host the
|
|
18936
|
-
* discovery→adopt flow.
|
|
18937
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
18938
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
18939
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
18940
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
18941
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
18942
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
18943
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
18944
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
18945
|
-
* base64 fallback needed.
|
|
19197
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
19198
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
19199
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
19200
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19201
|
+
* login page needs NO change.
|
|
18946
19202
|
*
|
|
18947
|
-
*
|
|
18948
|
-
*
|
|
18949
|
-
*
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
*
|
|
18953
|
-
*
|
|
18954
|
-
|
|
18955
|
-
|
|
18956
|
-
|
|
18957
|
-
|
|
18958
|
-
|
|
18959
|
-
|
|
18960
|
-
|
|
18961
|
-
|
|
18962
|
-
|
|
18963
|
-
*
|
|
18964
|
-
*
|
|
18965
|
-
*
|
|
18966
|
-
*
|
|
19203
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
19204
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
19205
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
19206
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
19207
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
19208
|
+
*
|
|
19209
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
19210
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
19211
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
19212
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
19213
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
19214
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
19215
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
19216
|
+
* decision.
|
|
19217
|
+
*
|
|
19218
|
+
* Every contribution carries a `stage`:
|
|
19219
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
19220
|
+
* magic-link buttons; a future usernameless passkey).
|
|
19221
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
19222
|
+
* returned `factors` (passkey-as-2FA today).
|
|
19223
|
+
*
|
|
19224
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
19225
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
19226
|
+
* tRPC router.
|
|
18967
19227
|
*/
|
|
18968
|
-
|
|
18969
|
-
|
|
18970
|
-
|
|
18971
|
-
|
|
18972
|
-
|
|
18973
|
-
|
|
18974
|
-
|
|
18975
|
-
|
|
18976
|
-
|
|
18977
|
-
|
|
18978
|
-
|
|
19228
|
+
/** When a login method renders in the two-phase login flow. */
|
|
19229
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
19230
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
19231
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
19232
|
+
object({
|
|
19233
|
+
kind: literal("redirect"),
|
|
19234
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
19235
|
+
id: string(),
|
|
19236
|
+
/** Operator-facing button label. */
|
|
19237
|
+
label: string(),
|
|
19238
|
+
/** lucide-react icon name. */
|
|
19239
|
+
icon: string().optional(),
|
|
19240
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
19241
|
+
startUrl: string(),
|
|
19242
|
+
stage: LoginStageEnum
|
|
19243
|
+
}),
|
|
19244
|
+
object({
|
|
19245
|
+
kind: literal("widget"),
|
|
19246
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
19247
|
+
id: string(),
|
|
19248
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
19249
|
+
addonId: string(),
|
|
19250
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
19251
|
+
bundle: string(),
|
|
19252
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
19253
|
+
remote: WidgetRemoteSchema,
|
|
19254
|
+
stage: LoginStageEnum
|
|
19255
|
+
}),
|
|
19256
|
+
object({
|
|
19257
|
+
kind: literal("passkey"),
|
|
19258
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
19259
|
+
id: string(),
|
|
19260
|
+
/** Operator-facing button label. */
|
|
19261
|
+
label: string(),
|
|
19262
|
+
stage: LoginStageEnum,
|
|
19263
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
19264
|
+
rpId: string(),
|
|
19265
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
19266
|
+
origin: string().nullable()
|
|
19267
|
+
})
|
|
18979
19268
|
]);
|
|
18980
|
-
|
|
18981
|
-
var
|
|
18982
|
-
|
|
18983
|
-
|
|
18984
|
-
|
|
19269
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
19270
|
+
var CpuBreakdownSchema = object({
|
|
19271
|
+
total: number(),
|
|
19272
|
+
user: number(),
|
|
19273
|
+
system: number(),
|
|
19274
|
+
irq: number(),
|
|
19275
|
+
nice: number(),
|
|
19276
|
+
loadAvg: tuple([
|
|
19277
|
+
number(),
|
|
19278
|
+
number(),
|
|
19279
|
+
number()
|
|
19280
|
+
]),
|
|
19281
|
+
cores: number()
|
|
18985
19282
|
});
|
|
18986
|
-
|
|
18987
|
-
|
|
18988
|
-
|
|
18989
|
-
|
|
18990
|
-
|
|
18991
|
-
|
|
18992
|
-
|
|
18993
|
-
|
|
18994
|
-
var
|
|
18995
|
-
|
|
18996
|
-
|
|
18997
|
-
|
|
18998
|
-
|
|
18999
|
-
|
|
19000
|
-
|
|
19001
|
-
|
|
19002
|
-
|
|
19003
|
-
|
|
19004
|
-
|
|
19005
|
-
|
|
19006
|
-
|
|
19007
|
-
|
|
19008
|
-
|
|
19283
|
+
var MemoryInfoSchema = object({
|
|
19284
|
+
percent: number(),
|
|
19285
|
+
totalBytes: number(),
|
|
19286
|
+
usedBytes: number(),
|
|
19287
|
+
availableBytes: number(),
|
|
19288
|
+
swapUsedBytes: number(),
|
|
19289
|
+
swapTotalBytes: number()
|
|
19290
|
+
});
|
|
19291
|
+
var DiskIoSnapshotSchema = object({
|
|
19292
|
+
readBytes: number(),
|
|
19293
|
+
writeBytes: number(),
|
|
19294
|
+
readOps: number(),
|
|
19295
|
+
writeOps: number(),
|
|
19296
|
+
timestampMs: number()
|
|
19297
|
+
});
|
|
19298
|
+
var NetworkIoSnapshotSchema = object({
|
|
19299
|
+
rxBytes: number(),
|
|
19300
|
+
txBytes: number(),
|
|
19301
|
+
rxPackets: number(),
|
|
19302
|
+
txPackets: number(),
|
|
19303
|
+
rxErrors: number(),
|
|
19304
|
+
txErrors: number(),
|
|
19305
|
+
timestampMs: number()
|
|
19306
|
+
});
|
|
19307
|
+
var MetricsGpuInfoSchema = object({
|
|
19308
|
+
utilization: number(),
|
|
19309
|
+
model: string(),
|
|
19310
|
+
memoryUsedBytes: number(),
|
|
19311
|
+
memoryTotalBytes: number(),
|
|
19312
|
+
temperature: number().nullable()
|
|
19313
|
+
});
|
|
19314
|
+
var ProcessResourceInfoSchema = object({
|
|
19315
|
+
openFds: number(),
|
|
19316
|
+
threadCount: number(),
|
|
19317
|
+
activeHandles: number(),
|
|
19318
|
+
activeRequests: number()
|
|
19009
19319
|
});
|
|
19010
|
-
|
|
19011
|
-
|
|
19012
|
-
|
|
19013
|
-
|
|
19014
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
19015
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
19016
|
-
flags: object({
|
|
19017
|
-
critical: boolean().optional(),
|
|
19018
|
-
silent: boolean().optional(),
|
|
19019
|
-
noPush: boolean().optional()
|
|
19020
|
-
}).optional(),
|
|
19021
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
19022
|
-
requires: array(string()).optional(),
|
|
19023
|
-
description: string().optional()
|
|
19320
|
+
var PressureAvgsSchema = object({
|
|
19321
|
+
avg10: number(),
|
|
19322
|
+
avg60: number(),
|
|
19323
|
+
avg300: number()
|
|
19024
19324
|
});
|
|
19025
|
-
|
|
19026
|
-
|
|
19027
|
-
|
|
19028
|
-
|
|
19029
|
-
|
|
19030
|
-
|
|
19031
|
-
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
|
|
19035
|
-
|
|
19325
|
+
var PressureInfoSchema = object({
|
|
19326
|
+
some: PressureAvgsSchema,
|
|
19327
|
+
full: PressureAvgsSchema.nullable()
|
|
19328
|
+
});
|
|
19329
|
+
var SystemResourceSnapshotSchema = object({
|
|
19330
|
+
cpu: CpuBreakdownSchema,
|
|
19331
|
+
memory: MemoryInfoSchema,
|
|
19332
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
19333
|
+
network: NetworkIoSnapshotSchema,
|
|
19334
|
+
disk: DiskIoSnapshotSchema,
|
|
19335
|
+
pressure: object({
|
|
19336
|
+
cpu: PressureInfoSchema.nullable(),
|
|
19337
|
+
memory: PressureInfoSchema.nullable(),
|
|
19338
|
+
io: PressureInfoSchema.nullable()
|
|
19036
19339
|
}),
|
|
19037
|
-
|
|
19038
|
-
|
|
19039
|
-
|
|
19040
|
-
format: array(NotificationFormatSchema),
|
|
19041
|
-
clickUrl: boolean(),
|
|
19042
|
-
sound: boolean(),
|
|
19043
|
-
ttl: boolean(),
|
|
19044
|
-
bodyMaxLen: number().int().positive()
|
|
19340
|
+
process: ProcessResourceInfoSchema,
|
|
19341
|
+
cpuTemperature: number().nullable(),
|
|
19342
|
+
timestampMs: number()
|
|
19045
19343
|
});
|
|
19046
|
-
|
|
19047
|
-
|
|
19048
|
-
|
|
19049
|
-
|
|
19050
|
-
|
|
19051
|
-
|
|
19052
|
-
*/
|
|
19053
|
-
var ConfigSchemaPassthrough = unknown();
|
|
19054
|
-
var TargetKindSchema = object({
|
|
19055
|
-
kind: string(),
|
|
19056
|
-
label: string(),
|
|
19057
|
-
icon: string(),
|
|
19058
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
19059
|
-
addonId: string(),
|
|
19060
|
-
configSchema: ConfigSchemaPassthrough,
|
|
19061
|
-
supportsDiscovery: boolean(),
|
|
19062
|
-
caps: TargetKindCapsSchema
|
|
19344
|
+
var DiskSpaceInfoSchema = object({
|
|
19345
|
+
path: string(),
|
|
19346
|
+
totalBytes: number(),
|
|
19347
|
+
usedBytes: number(),
|
|
19348
|
+
availableBytes: number(),
|
|
19349
|
+
percent: number()
|
|
19063
19350
|
});
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19351
|
+
var PidResourceStatsSchema = object({
|
|
19352
|
+
pid: number(),
|
|
19353
|
+
cpu: number(),
|
|
19354
|
+
memory: number(),
|
|
19355
|
+
/**
|
|
19356
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
19357
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
19358
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
19359
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
19360
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
19361
|
+
*/
|
|
19362
|
+
privateBytes: number().optional(),
|
|
19363
|
+
/**
|
|
19364
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
19365
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
19366
|
+
*/
|
|
19367
|
+
sharedBytes: number().optional()
|
|
19368
|
+
});
|
|
19369
|
+
var AddonInstanceSchema = object({
|
|
19073
19370
|
addonId: string(),
|
|
19074
|
-
|
|
19075
|
-
|
|
19371
|
+
nodeId: string(),
|
|
19372
|
+
role: _enum(["hub", "worker"]),
|
|
19373
|
+
pid: number(),
|
|
19374
|
+
state: _enum([
|
|
19375
|
+
"starting",
|
|
19376
|
+
"running",
|
|
19377
|
+
"stopping",
|
|
19378
|
+
"stopped",
|
|
19379
|
+
"crashed"
|
|
19380
|
+
]),
|
|
19381
|
+
uptimeSec: number()
|
|
19076
19382
|
});
|
|
19077
|
-
|
|
19078
|
-
|
|
19079
|
-
|
|
19080
|
-
|
|
19081
|
-
|
|
19383
|
+
var NodeProcessSchema = object({
|
|
19384
|
+
pid: number(),
|
|
19385
|
+
ppid: number(),
|
|
19386
|
+
pgid: number(),
|
|
19387
|
+
classification: _enum([
|
|
19388
|
+
"root",
|
|
19389
|
+
"managed",
|
|
19390
|
+
"system",
|
|
19391
|
+
"ghost"
|
|
19392
|
+
]),
|
|
19393
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
19394
|
+
addonId: string().nullable(),
|
|
19395
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
19396
|
+
nodeId: string().nullable(),
|
|
19397
|
+
/** Truncated command line. */
|
|
19398
|
+
command: string(),
|
|
19399
|
+
cpuPercent: number(),
|
|
19400
|
+
memoryRssBytes: number(),
|
|
19401
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
19402
|
+
uptimeSec: number(),
|
|
19403
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
19404
|
+
orphaned: boolean()
|
|
19082
19405
|
});
|
|
19083
|
-
|
|
19084
|
-
|
|
19085
|
-
|
|
19086
|
-
|
|
19087
|
-
attachmentsSent: number().int().nonnegative(),
|
|
19088
|
-
actionsSent: number().int().nonnegative(),
|
|
19089
|
-
truncated: boolean(),
|
|
19090
|
-
dropped: array(string())
|
|
19406
|
+
var KillProcessInputSchema = object({
|
|
19407
|
+
pid: number(),
|
|
19408
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
19409
|
+
force: boolean().optional()
|
|
19091
19410
|
});
|
|
19092
|
-
var
|
|
19411
|
+
var KillProcessResultSchema = object({
|
|
19093
19412
|
success: boolean(),
|
|
19094
|
-
|
|
19095
|
-
|
|
19413
|
+
reason: string().optional(),
|
|
19414
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
19415
|
+
});
|
|
19416
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
19417
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
19418
|
+
addonId: string() });
|
|
19419
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
19420
|
+
success: boolean(),
|
|
19421
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
19422
|
+
path: string().optional(),
|
|
19423
|
+
/** Process pid that was signalled. */
|
|
19424
|
+
pid: number().optional(),
|
|
19425
|
+
reason: string().optional()
|
|
19426
|
+
});
|
|
19427
|
+
var SystemMetricsSchema = object({
|
|
19428
|
+
cpuPercent: number(),
|
|
19429
|
+
memoryPercent: number(),
|
|
19430
|
+
memoryUsedMB: number(),
|
|
19431
|
+
memoryTotalMB: number(),
|
|
19432
|
+
diskPercent: number().optional(),
|
|
19433
|
+
temperature: number().optional(),
|
|
19434
|
+
gpuPercent: number().optional(),
|
|
19435
|
+
gpuMemoryPercent: number().optional()
|
|
19436
|
+
});
|
|
19437
|
+
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, {
|
|
19438
|
+
kind: "mutation",
|
|
19439
|
+
auth: "admin"
|
|
19440
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
19441
|
+
kind: "mutation",
|
|
19442
|
+
auth: "admin"
|
|
19443
|
+
});
|
|
19444
|
+
method(object({
|
|
19445
|
+
sourceUrl: string(),
|
|
19446
|
+
metadata: ModelConvertMetadataSchema,
|
|
19447
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
19448
|
+
calibrationRef: string().optional(),
|
|
19449
|
+
sessionId: string().optional()
|
|
19450
|
+
}), ConvertResultSchema, {
|
|
19451
|
+
kind: "mutation",
|
|
19452
|
+
auth: "admin",
|
|
19453
|
+
timeoutMs: 6e5
|
|
19454
|
+
});
|
|
19455
|
+
method(object({
|
|
19456
|
+
nodeId: string(),
|
|
19457
|
+
modelId: string(),
|
|
19458
|
+
format: _enum(MODEL_FORMATS),
|
|
19459
|
+
entry: ModelCatalogEntrySchema
|
|
19460
|
+
}), object({
|
|
19461
|
+
ok: boolean(),
|
|
19462
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
19463
|
+
sha256: string(),
|
|
19464
|
+
bytes: number(),
|
|
19465
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
19466
|
+
path: string()
|
|
19467
|
+
}), {
|
|
19468
|
+
kind: "mutation",
|
|
19469
|
+
auth: "admin"
|
|
19096
19470
|
});
|
|
19097
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
19098
|
-
var TestResultSchema = SendResultSchema;
|
|
19099
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
19100
|
-
kind: string(),
|
|
19101
|
-
config: record(string(), unknown()).optional()
|
|
19102
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
19103
|
-
targetId: string(),
|
|
19104
|
-
notification: NotificationSchema
|
|
19105
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
19106
|
-
targetId: string(),
|
|
19107
|
-
sample: NotificationSchema.optional()
|
|
19108
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
19109
|
-
targetId: string(),
|
|
19110
|
-
enabled: boolean()
|
|
19111
|
-
}), _void(), { kind: "mutation" });
|
|
19112
19471
|
/**
|
|
19113
|
-
*
|
|
19114
|
-
*
|
|
19115
|
-
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
19116
|
-
* (operator decisions D-1/D-2/D-3 are binding):
|
|
19472
|
+
* `mqtt-broker` — broker-registry cap.
|
|
19117
19473
|
*
|
|
19118
|
-
*
|
|
19119
|
-
*
|
|
19120
|
-
*
|
|
19121
|
-
*
|
|
19122
|
-
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
19123
|
-
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
19124
|
-
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
19125
|
-
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
19126
|
-
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
19127
|
-
* by id; per-backend params are a passthrough blob capped by the
|
|
19128
|
-
* target kind's own caps/degrade engine).
|
|
19474
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
19475
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
19476
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
19477
|
+
* its OWN `mqtt.js` client.
|
|
19129
19478
|
*
|
|
19130
|
-
*
|
|
19131
|
-
*
|
|
19132
|
-
*
|
|
19133
|
-
*
|
|
19134
|
-
*
|
|
19135
|
-
* private zones, per-recipient fan-out and the wider condition table are
|
|
19136
|
-
* P2+ (see spec §7).
|
|
19479
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
19480
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
19481
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
19482
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
19483
|
+
* features anyway — give it the connection config, get out of the way.
|
|
19137
19484
|
*
|
|
19138
|
-
*
|
|
19139
|
-
*
|
|
19140
|
-
*
|
|
19485
|
+
* Consumer flow:
|
|
19486
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
19487
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
19488
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
19489
|
+
*
|
|
19490
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
19491
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
19492
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
19493
|
+
* spawned it.
|
|
19141
19494
|
*/
|
|
19495
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
19142
19496
|
/**
|
|
19143
|
-
*
|
|
19144
|
-
* The value maps 1:1 onto the evaluated record kind:
|
|
19145
|
-
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
19146
|
-
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
19147
|
-
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
19148
|
-
* change of a LINKED device, one row per linked camera)
|
|
19149
|
-
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
19150
|
-
* delivery / pick-up)
|
|
19497
|
+
* Broker live-probe status.
|
|
19151
19498
|
*
|
|
19152
|
-
*
|
|
19153
|
-
*
|
|
19154
|
-
*
|
|
19155
|
-
*
|
|
19499
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
19500
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
19501
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
19502
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
19503
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
19156
19504
|
*/
|
|
19157
|
-
var
|
|
19158
|
-
"
|
|
19159
|
-
"
|
|
19160
|
-
"
|
|
19161
|
-
"
|
|
19505
|
+
var BrokerStatusSchema$1 = _enum([
|
|
19506
|
+
"connected",
|
|
19507
|
+
"disconnected",
|
|
19508
|
+
"auth-failed",
|
|
19509
|
+
"unreachable",
|
|
19510
|
+
"tls-error"
|
|
19162
19511
|
]);
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
19166
|
-
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
/**
|
|
19172
|
-
|
|
19173
|
-
/**
|
|
19174
|
-
|
|
19175
|
-
});
|
|
19176
|
-
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
19177
|
-
var NcPlateMatcherSchema = object({
|
|
19178
|
-
values: array(string().min(1)).min(1),
|
|
19179
|
-
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
19180
|
-
maxDistance: number().int().min(0).max(3).default(1)
|
|
19181
|
-
});
|
|
19182
|
-
/**
|
|
19183
|
-
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
19184
|
-
* occupancy edge for a device — optionally narrowed to a single admin
|
|
19185
|
-
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
19186
|
-
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
19187
|
-
* - `became-free` — count crossed ≥ `count` → below it
|
|
19188
|
-
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
19189
|
-
* `sustainSeconds` requires the condition hold continuously that long
|
|
19190
|
-
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
19191
|
-
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
19192
|
-
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
19193
|
-
* (declared SQLite collection, reseeded on boot).
|
|
19194
|
-
*/
|
|
19195
|
-
var NcOccupancyConditionSchema = object({
|
|
19196
|
-
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
19197
|
-
zoneId: string().optional(),
|
|
19198
|
-
/** Object class to count; absent = any class. */
|
|
19199
|
-
className: string().optional(),
|
|
19200
|
-
op: _enum([
|
|
19201
|
-
"became-occupied",
|
|
19202
|
-
"became-free",
|
|
19203
|
-
">=",
|
|
19204
|
-
"<="
|
|
19205
|
-
]).default("became-occupied"),
|
|
19206
|
-
count: number().int().min(0).default(1),
|
|
19207
|
-
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
19208
|
-
});
|
|
19209
|
-
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
19210
|
-
var NcZoneConditionSchema = object({
|
|
19211
|
-
ids: array(string().min(1)).min(1),
|
|
19212
|
-
/** Quantifier over `ids` — at least one / every one visited. */
|
|
19213
|
-
match: _enum(["any", "all"]).default("any")
|
|
19214
|
-
});
|
|
19215
|
-
/**
|
|
19216
|
-
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
19217
|
-
* membership lists are OR within the list (spec §2.3).
|
|
19218
|
-
*/
|
|
19219
|
-
var NcConditionsSchema = object({
|
|
19220
|
-
/** Device scope — absent = all devices. */
|
|
19221
|
-
devices: array(number()).optional(),
|
|
19222
|
-
/** Detector class names (any overlap with the record's class set). */
|
|
19223
|
-
classes: array(string().min(1)).optional(),
|
|
19224
|
-
/** Veto classes — any overlap fails the rule. */
|
|
19225
|
-
classesExclude: array(string().min(1)).optional(),
|
|
19226
|
-
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
19227
|
-
minConfidence: number().min(0).max(1).optional(),
|
|
19228
|
-
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
19229
|
-
zones: NcZoneConditionSchema.optional(),
|
|
19230
|
-
/** Veto zones — any hit fails the rule. */
|
|
19231
|
-
zonesExclude: array(string().min(1)).optional(),
|
|
19232
|
-
/**
|
|
19233
|
-
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
19234
|
-
* (identity name / plate text / subclass).
|
|
19235
|
-
*/
|
|
19236
|
-
labelEquals: array(string().min(1)).optional(),
|
|
19237
|
-
/**
|
|
19238
|
-
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
19239
|
-
* `label` (the identity display name propagated by the face pipeline) —
|
|
19240
|
-
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
19241
|
-
*/
|
|
19242
|
-
identities: array(string().min(1)).optional(),
|
|
19243
|
-
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
19244
|
-
plates: NcPlateMatcherSchema.optional(),
|
|
19245
|
-
/**
|
|
19246
|
-
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
19247
|
-
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
19248
|
-
* identity display name). A record with NO label passes (nothing to
|
|
19249
|
-
* exclude), unlike the include variant which fails on an absent label.
|
|
19250
|
-
*/
|
|
19251
|
-
identitiesExclude: array(string().min(1)).optional(),
|
|
19252
|
-
/**
|
|
19253
|
-
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
19254
|
-
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
19255
|
-
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
19256
|
-
* close the value is threaded via the close-time info (the `Track` clone is
|
|
19257
|
-
* captured before the DB row is updated, so it would otherwise read stale).
|
|
19258
|
-
* Fails when the record carries no importance (never guess quality — the
|
|
19259
|
-
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
19260
|
-
*/
|
|
19261
|
-
minImportance: number().min(0).max(1).optional(),
|
|
19262
|
-
/**
|
|
19263
|
-
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
19264
|
-
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
19265
|
-
* lifespan, so a dwell condition never matches immediate delivery
|
|
19266
|
-
* (documented choice — the object-event record carries no `firstSeen`,
|
|
19267
|
-
* so dwell cannot be computed from what the subject actually carries).
|
|
19268
|
-
*/
|
|
19269
|
-
minDwellSeconds: number().min(0).optional(),
|
|
19270
|
-
/**
|
|
19271
|
-
* Detection provenance filter. `any` (default / absent) matches every
|
|
19272
|
-
* source; otherwise the subject's source must equal it. Legacy records
|
|
19273
|
-
* with no stamped source are treated as `pipeline`. The union spans both
|
|
19274
|
-
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
19275
|
-
* tracks carry `sensor`.
|
|
19276
|
-
*/
|
|
19277
|
-
source: _enum([
|
|
19278
|
-
"pipeline",
|
|
19279
|
-
"onboard",
|
|
19280
|
-
"sensor",
|
|
19281
|
-
"any"
|
|
19282
|
-
]).optional(),
|
|
19283
|
-
/**
|
|
19284
|
-
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
19285
|
-
* detector `minConfidence` (that gates the object-detection score; this
|
|
19286
|
-
* gates the recognition/OCR match score). Fails when the subject carries
|
|
19287
|
-
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
19288
|
-
* lives on the recognition result and reaches the subject at track close.
|
|
19289
|
-
*
|
|
19290
|
-
* What it measures precisely (plumbed at track close — the closer threads
|
|
19291
|
-
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
19292
|
-
* `importance`): the BEST recognition match confidence observed for the
|
|
19293
|
-
* label the track carries at close — for a face, the peak cosine similarity
|
|
19294
|
-
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
19295
|
-
* for a plate, the peak OCR read score of the best-held plate
|
|
19296
|
-
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
19297
|
-
* one track the higher of the two is used. A track that ended with no
|
|
19298
|
-
* confident identity/plate match carries no value, so the condition fails
|
|
19299
|
-
* closed for it (an un-recognized subject).
|
|
19300
|
-
*/
|
|
19301
|
-
minLabelConfidence: number().min(0).max(1).optional(),
|
|
19302
|
-
/**
|
|
19303
|
-
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
19304
|
-
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
19305
|
-
* against the token carried on the device-event subject (extracted from the
|
|
19306
|
-
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
19307
|
-
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
19308
|
-
* eventType, so gate those with {@link sensorKinds} instead.
|
|
19309
|
-
*/
|
|
19310
|
-
eventTypeTokens: array(string().min(1)).optional(),
|
|
19311
|
-
/**
|
|
19312
|
-
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
19313
|
-
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
19314
|
-
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
19315
|
-
*/
|
|
19316
|
-
sensorKinds: array(string().min(1)).optional(),
|
|
19317
|
-
/**
|
|
19318
|
-
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
19319
|
-
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
19320
|
-
* when the subject's phase does not match (a subject always carries a phase
|
|
19321
|
-
* on the package-event trigger).
|
|
19322
|
-
*/
|
|
19323
|
-
packagePhase: _enum([
|
|
19324
|
-
"delivered",
|
|
19325
|
-
"picked-up",
|
|
19326
|
-
"both"
|
|
19327
|
-
]).optional(),
|
|
19328
|
-
/**
|
|
19329
|
-
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
19330
|
-
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
19331
|
-
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
19332
|
-
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
19333
|
-
*/
|
|
19334
|
-
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
19335
|
-
/**
|
|
19336
|
-
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
19337
|
-
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
19338
|
-
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
19339
|
-
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
19340
|
-
*/
|
|
19341
|
-
occupancy: NcOccupancyConditionSchema.optional()
|
|
19342
|
-
});
|
|
19343
|
-
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
19344
|
-
var NcRuleTargetSchema = object({
|
|
19345
|
-
/** `notification-output` Target id. */
|
|
19346
|
-
targetId: string().min(1),
|
|
19347
|
-
/**
|
|
19348
|
-
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
19349
|
-
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
19350
|
-
* degrade engine drops what the backend can't render.
|
|
19351
|
-
*/
|
|
19352
|
-
params: record(string(), unknown()).optional()
|
|
19512
|
+
var BrokerInfoSchema = object({
|
|
19513
|
+
id: string(),
|
|
19514
|
+
name: string(),
|
|
19515
|
+
url: string(),
|
|
19516
|
+
kind: BrokerKindSchema,
|
|
19517
|
+
status: BrokerStatusSchema$1,
|
|
19518
|
+
latencyMs: number().nullable(),
|
|
19519
|
+
error: string().optional(),
|
|
19520
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
19521
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
19522
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
19523
|
+
lastCheckedAt: number().optional()
|
|
19353
19524
|
});
|
|
19354
19525
|
/**
|
|
19355
|
-
*
|
|
19356
|
-
*
|
|
19357
|
-
*
|
|
19358
|
-
*
|
|
19359
|
-
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
19360
|
-
* (or when the specific crop is missing) degrades to `best`, then
|
|
19361
|
-
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
19362
|
-
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
19363
|
-
* name), so the choice never drifts from the record that fired it.
|
|
19364
|
-
* - `keyFrame` — the clean scene frame (no subject box).
|
|
19365
|
-
* - `none` — no attachment.
|
|
19526
|
+
* Connection details — what a consumer needs to call
|
|
19527
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
19528
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
19529
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
19366
19530
|
*/
|
|
19367
|
-
var
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
"none"
|
|
19372
|
-
]).default("best") });
|
|
19373
|
-
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
19374
|
-
var NcThrottleSchema = object({
|
|
19375
|
-
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
19376
|
-
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
19377
|
-
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
19378
|
-
});
|
|
19379
|
-
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
19380
|
-
var NcRuleInputSchema = object({
|
|
19381
|
-
name: string().min(1).max(200),
|
|
19382
|
-
enabled: boolean().default(true),
|
|
19383
|
-
delivery: NcDeliverySchema,
|
|
19384
|
-
conditions: NcConditionsSchema.default({}),
|
|
19385
|
-
schedule: NcScheduleSchema.optional(),
|
|
19386
|
-
targets: array(NcRuleTargetSchema).min(1),
|
|
19387
|
-
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
19388
|
-
throttle: NcThrottleSchema.default({
|
|
19389
|
-
cooldownSec: 60,
|
|
19390
|
-
scope: "rule-device"
|
|
19391
|
-
}),
|
|
19392
|
-
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
19393
|
-
template: object({
|
|
19394
|
-
title: string().max(500).optional(),
|
|
19395
|
-
body: string().max(2e3).optional()
|
|
19396
|
-
}).optional(),
|
|
19397
|
-
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
19398
|
-
priority: number().int().min(1).max(5).default(3),
|
|
19531
|
+
var BrokerConnectionDetailsSchema = object({
|
|
19532
|
+
url: string(),
|
|
19533
|
+
username: string().optional(),
|
|
19534
|
+
password: string().optional(),
|
|
19399
19535
|
/**
|
|
19400
|
-
*
|
|
19401
|
-
*
|
|
19402
|
-
*
|
|
19536
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
19537
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
19538
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
19539
|
+
* broker).
|
|
19403
19540
|
*/
|
|
19404
|
-
|
|
19541
|
+
clientIdPrefix: string().optional()
|
|
19542
|
+
});
|
|
19543
|
+
var AddBrokerInputSchema = object({
|
|
19544
|
+
name: string().min(1),
|
|
19545
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
19546
|
+
username: string().optional(),
|
|
19547
|
+
password: string().optional(),
|
|
19548
|
+
clientIdPrefix: string().optional()
|
|
19549
|
+
});
|
|
19550
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
19551
|
+
var IdInputSchema = object({ id: string() });
|
|
19552
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
19553
|
+
ok: literal(true),
|
|
19554
|
+
latencyMs: number()
|
|
19555
|
+
}), object({
|
|
19556
|
+
ok: literal(false),
|
|
19557
|
+
error: string()
|
|
19558
|
+
})]);
|
|
19559
|
+
var StartEmbeddedInputSchema = object({
|
|
19560
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
19561
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
19562
|
+
allowAnonymous: boolean().default(false),
|
|
19563
|
+
/** Optional shared username/password for clients. */
|
|
19564
|
+
username: string().optional(),
|
|
19565
|
+
password: string().optional()
|
|
19566
|
+
});
|
|
19567
|
+
var StartEmbeddedResultSchema = object({
|
|
19568
|
+
id: string(),
|
|
19569
|
+
url: string()
|
|
19570
|
+
});
|
|
19571
|
+
var StatusSchema = object({
|
|
19572
|
+
brokerCount: number(),
|
|
19573
|
+
embeddedRunning: boolean()
|
|
19574
|
+
});
|
|
19575
|
+
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);
|
|
19576
|
+
var NetworkEndpointSchema = object({
|
|
19577
|
+
url: string(),
|
|
19578
|
+
hostname: string(),
|
|
19579
|
+
port: number(),
|
|
19580
|
+
protocol: _enum(["http", "https"])
|
|
19581
|
+
});
|
|
19582
|
+
var NetworkAccessStatusSchema = object({
|
|
19583
|
+
connected: boolean(),
|
|
19584
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
19585
|
+
error: string().optional()
|
|
19405
19586
|
});
|
|
19406
19587
|
/**
|
|
19407
|
-
*
|
|
19408
|
-
*
|
|
19409
|
-
*
|
|
19410
|
-
*
|
|
19411
|
-
*
|
|
19412
|
-
*
|
|
19413
|
-
* `updateRule` patch.
|
|
19588
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
19589
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
19590
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
19591
|
+
* the originating provider config (mode + sourcePort) so the
|
|
19592
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
19593
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
19414
19594
|
*/
|
|
19415
|
-
var
|
|
19416
|
-
/** A persisted rule. */
|
|
19417
|
-
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
19418
|
-
id: string(),
|
|
19419
|
-
/** userId of the admin who created the rule (server-stamped caller). */
|
|
19420
|
-
createdBy: string(),
|
|
19421
|
-
createdAt: number(),
|
|
19422
|
-
updatedAt: number(),
|
|
19595
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
19423
19596
|
/**
|
|
19424
|
-
*
|
|
19425
|
-
*
|
|
19426
|
-
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
19597
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
19598
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
19427
19599
|
*/
|
|
19428
|
-
|
|
19429
|
-
|
|
19430
|
-
|
|
19431
|
-
|
|
19432
|
-
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
"device-event",
|
|
19436
|
-
"package-event"
|
|
19437
|
-
]),
|
|
19438
|
-
deviceId: number(),
|
|
19439
|
-
timestamp: number(),
|
|
19440
|
-
wouldFire: boolean(),
|
|
19441
|
-
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
19442
|
-
failedCondition: string().optional(),
|
|
19443
|
-
className: string().optional(),
|
|
19444
|
-
label: string().optional()
|
|
19600
|
+
id: string(),
|
|
19601
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
19602
|
+
label: string(),
|
|
19603
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
19604
|
+
mode: string().optional(),
|
|
19605
|
+
/** Originating local port the ingress fronts (informational). */
|
|
19606
|
+
sourcePort: number().optional()
|
|
19445
19607
|
});
|
|
19446
|
-
|
|
19447
|
-
|
|
19608
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
19609
|
+
/**
|
|
19610
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
19611
|
+
*
|
|
19612
|
+
* Apprise-derived model (see
|
|
19613
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
19614
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
19615
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
19616
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
19617
|
+
* message to what the kind supports — callers never special-case a service.
|
|
19618
|
+
*
|
|
19619
|
+
* DESIGN DECISIONS (locked):
|
|
19620
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
19621
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
19622
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
19623
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
19624
|
+
* alternative would fork the UI per addon and cannot host the
|
|
19625
|
+
* discovery→adopt flow.
|
|
19626
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
19627
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
19628
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
19629
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
19630
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
19631
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
19632
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
19633
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
19634
|
+
* base64 fallback needed.
|
|
19635
|
+
*
|
|
19636
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
19637
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
19638
|
+
* admin "Integrations" page.
|
|
19639
|
+
*/
|
|
19640
|
+
/**
|
|
19641
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
19642
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
19643
|
+
*/
|
|
19644
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
19645
|
+
"image",
|
|
19646
|
+
"video",
|
|
19647
|
+
"gif",
|
|
19648
|
+
"audio",
|
|
19649
|
+
"icon"
|
|
19650
|
+
]);
|
|
19651
|
+
/**
|
|
19652
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
19653
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
19654
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
19655
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
19656
|
+
*/
|
|
19657
|
+
var AttachmentSchema = object({
|
|
19658
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
19659
|
+
url: string().optional(),
|
|
19660
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
19661
|
+
mime: string().optional(),
|
|
19662
|
+
name: string().optional()
|
|
19663
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
19664
|
+
var NotificationFormatSchema = _enum([
|
|
19665
|
+
"text",
|
|
19666
|
+
"markdown",
|
|
19667
|
+
"html"
|
|
19668
|
+
]);
|
|
19669
|
+
/** A single tap-through action button. */
|
|
19670
|
+
var NotificationActionSchema = object({
|
|
19671
|
+
id: string(),
|
|
19672
|
+
label: string(),
|
|
19673
|
+
url: string().optional()
|
|
19674
|
+
});
|
|
19675
|
+
/**
|
|
19676
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
19677
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
19678
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
19679
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
19680
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
19681
|
+
* `priority` for that one target.
|
|
19682
|
+
*/
|
|
19683
|
+
var NotificationSchema = object({
|
|
19684
|
+
body: string(),
|
|
19685
|
+
title: string().optional(),
|
|
19686
|
+
format: NotificationFormatSchema.default("text"),
|
|
19687
|
+
priority: number().int().min(1).max(5).default(3),
|
|
19688
|
+
level: string().optional(),
|
|
19689
|
+
attachments: array(AttachmentSchema).optional(),
|
|
19690
|
+
clickUrl: string().optional(),
|
|
19691
|
+
actions: array(NotificationActionSchema).optional(),
|
|
19692
|
+
sound: string().optional(),
|
|
19693
|
+
ttl: number().optional(),
|
|
19694
|
+
tag: string().optional(),
|
|
19695
|
+
deviceId: number().optional(),
|
|
19696
|
+
eventId: string().optional(),
|
|
19697
|
+
metadata: record(string(), unknown()).optional()
|
|
19698
|
+
});
|
|
19699
|
+
/** One declared native severity/priority level for a kind. */
|
|
19700
|
+
var TargetKindLevelSchema = object({
|
|
19448
19701
|
id: string(),
|
|
19449
|
-
group: _enum([
|
|
19450
|
-
"scope",
|
|
19451
|
-
"class",
|
|
19452
|
-
"zones",
|
|
19453
|
-
"quality",
|
|
19454
|
-
"label",
|
|
19455
|
-
"schedule",
|
|
19456
|
-
"device",
|
|
19457
|
-
"package",
|
|
19458
|
-
"occupancy"
|
|
19459
|
-
]),
|
|
19460
19702
|
label: string(),
|
|
19461
|
-
/**
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19469
|
-
|
|
19470
|
-
"schedule",
|
|
19471
|
-
"plateMatcher",
|
|
19472
|
-
"packagePhase",
|
|
19473
|
-
"polygonDraw",
|
|
19474
|
-
"occupancy"
|
|
19475
|
-
]),
|
|
19476
|
-
operator: _enum([
|
|
19477
|
-
"in",
|
|
19478
|
-
"notIn",
|
|
19479
|
-
"anyOf",
|
|
19480
|
-
"allOf",
|
|
19481
|
-
"gte",
|
|
19482
|
-
"fuzzyIn",
|
|
19483
|
-
"withinSchedule"
|
|
19484
|
-
]),
|
|
19485
|
-
/** Which delivery kinds the condition applies to. */
|
|
19486
|
-
appliesTo: array(NcDeliverySchema),
|
|
19487
|
-
phase: string(),
|
|
19703
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
19704
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
19705
|
+
flags: object({
|
|
19706
|
+
critical: boolean().optional(),
|
|
19707
|
+
silent: boolean().optional(),
|
|
19708
|
+
noPush: boolean().optional()
|
|
19709
|
+
}).optional(),
|
|
19710
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
19711
|
+
requires: array(string()).optional(),
|
|
19488
19712
|
description: string().optional()
|
|
19489
19713
|
});
|
|
19714
|
+
/** The full capability block consulted before dispatch. */
|
|
19715
|
+
var TargetKindCapsSchema = object({
|
|
19716
|
+
attachments: object({
|
|
19717
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
19718
|
+
mode: _enum([
|
|
19719
|
+
"url",
|
|
19720
|
+
"bytes",
|
|
19721
|
+
"both"
|
|
19722
|
+
]),
|
|
19723
|
+
max: number().int().nonnegative(),
|
|
19724
|
+
maxBytes: number().int().positive().optional()
|
|
19725
|
+
}),
|
|
19726
|
+
/** Max action buttons (0 = none). */
|
|
19727
|
+
actions: number().int().nonnegative(),
|
|
19728
|
+
levels: array(TargetKindLevelSchema),
|
|
19729
|
+
format: array(NotificationFormatSchema),
|
|
19730
|
+
clickUrl: boolean(),
|
|
19731
|
+
sound: boolean(),
|
|
19732
|
+
ttl: boolean(),
|
|
19733
|
+
bodyMaxLen: number().int().positive()
|
|
19734
|
+
});
|
|
19490
19735
|
/**
|
|
19491
|
-
*
|
|
19492
|
-
*
|
|
19493
|
-
*
|
|
19494
|
-
*
|
|
19495
|
-
*
|
|
19496
|
-
* backend rejection / a deleted target (terminal; carries
|
|
19497
|
-
* the failure `error`)
|
|
19498
|
-
*
|
|
19499
|
-
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
19500
|
-
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
19736
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
19737
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
19738
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
19739
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
19740
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
19501
19741
|
*/
|
|
19502
|
-
var
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
|
|
19506
|
-
|
|
19507
|
-
/**
|
|
19508
|
-
|
|
19509
|
-
|
|
19510
|
-
|
|
19511
|
-
|
|
19512
|
-
"package-event"
|
|
19513
|
-
]);
|
|
19514
|
-
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
19515
|
-
var NcHistorySubjectSchema = object({
|
|
19516
|
-
className: string(),
|
|
19517
|
-
label: string().optional(),
|
|
19518
|
-
confidence: number().optional(),
|
|
19519
|
-
zones: array(string()),
|
|
19520
|
-
timestamp: number()
|
|
19742
|
+
var ConfigSchemaPassthrough = unknown();
|
|
19743
|
+
var TargetKindSchema = object({
|
|
19744
|
+
kind: string(),
|
|
19745
|
+
label: string(),
|
|
19746
|
+
icon: string(),
|
|
19747
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
19748
|
+
addonId: string(),
|
|
19749
|
+
configSchema: ConfigSchemaPassthrough,
|
|
19750
|
+
supportsDiscovery: boolean(),
|
|
19751
|
+
caps: TargetKindCapsSchema
|
|
19521
19752
|
});
|
|
19522
19753
|
/**
|
|
19523
|
-
*
|
|
19524
|
-
*
|
|
19525
|
-
*
|
|
19526
|
-
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
19527
|
-
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
19528
|
-
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
19529
|
-
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
19530
|
-
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
19531
|
-
* P1 (admin scope only).
|
|
19754
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
19755
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
19756
|
+
* round-trip a stored secret to the UI.
|
|
19532
19757
|
*/
|
|
19533
|
-
var
|
|
19534
|
-
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
19758
|
+
var TargetSchema = object({
|
|
19535
19759
|
id: string(),
|
|
19536
|
-
|
|
19537
|
-
|
|
19538
|
-
|
|
19539
|
-
|
|
19540
|
-
|
|
19541
|
-
targetId: string(),
|
|
19542
|
-
deviceId: number(),
|
|
19543
|
-
recordKind: NcHistoryRecordKindSchema,
|
|
19544
|
-
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
19545
|
-
recordId: string(),
|
|
19546
|
-
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
19547
|
-
trackId: string().optional(),
|
|
19548
|
-
status: NcHistoryStatusSchema,
|
|
19549
|
-
/** Delivery attempts made so far. */
|
|
19550
|
-
attempts: number().int(),
|
|
19551
|
-
/** Fire time (outbox enqueue). */
|
|
19552
|
-
createdAt: number(),
|
|
19553
|
-
/** Last transition time (terminal for sent / dead). */
|
|
19554
|
-
updatedAt: number(),
|
|
19555
|
-
/** Failure detail — present on a `dead` row. */
|
|
19556
|
-
error: string().optional(),
|
|
19557
|
-
subject: NcHistorySubjectSchema
|
|
19760
|
+
name: string(),
|
|
19761
|
+
kind: string(),
|
|
19762
|
+
addonId: string(),
|
|
19763
|
+
enabled: boolean(),
|
|
19764
|
+
config: record(string(), unknown())
|
|
19558
19765
|
});
|
|
19559
|
-
/**
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19563
|
-
|
|
19564
|
-
*/
|
|
19565
|
-
var NcHistoryFilterSchema = object({
|
|
19566
|
-
ruleId: string().optional(),
|
|
19567
|
-
deviceId: number().optional(),
|
|
19568
|
-
status: NcHistoryStatusSchema.optional(),
|
|
19569
|
-
since: number().optional(),
|
|
19570
|
-
until: number().optional(),
|
|
19571
|
-
limit: number().int().min(1).max(500).default(100)
|
|
19766
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
19767
|
+
var DiscoveredTargetSchema = object({
|
|
19768
|
+
kind: string(),
|
|
19769
|
+
suggestedName: string(),
|
|
19770
|
+
config: record(string(), unknown())
|
|
19572
19771
|
});
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19578
|
-
|
|
19579
|
-
|
|
19580
|
-
|
|
19581
|
-
|
|
19582
|
-
|
|
19583
|
-
|
|
19584
|
-
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
|
|
19588
|
-
|
|
19772
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
19773
|
+
var RenderedAsSchema = object({
|
|
19774
|
+
level: string(),
|
|
19775
|
+
format: NotificationFormatSchema,
|
|
19776
|
+
attachmentsSent: number().int().nonnegative(),
|
|
19777
|
+
actionsSent: number().int().nonnegative(),
|
|
19778
|
+
truncated: boolean(),
|
|
19779
|
+
dropped: array(string())
|
|
19780
|
+
});
|
|
19781
|
+
var SendResultSchema = object({
|
|
19782
|
+
success: boolean(),
|
|
19783
|
+
error: string().optional(),
|
|
19784
|
+
renderedAs: RenderedAsSchema.optional()
|
|
19785
|
+
});
|
|
19786
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
19787
|
+
var TestResultSchema = SendResultSchema;
|
|
19788
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
19789
|
+
kind: string(),
|
|
19790
|
+
config: record(string(), unknown()).optional()
|
|
19791
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
19792
|
+
targetId: string(),
|
|
19793
|
+
notification: NotificationSchema
|
|
19794
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
19795
|
+
targetId: string(),
|
|
19796
|
+
sample: NotificationSchema.optional()
|
|
19797
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
19798
|
+
targetId: string(),
|
|
19589
19799
|
enabled: boolean()
|
|
19590
|
-
}),
|
|
19591
|
-
kind: "mutation",
|
|
19592
|
-
auth: "admin"
|
|
19593
|
-
}), method(object({
|
|
19594
|
-
rule: NcRuleInputSchema,
|
|
19595
|
-
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
19596
|
-
}), object({ results: array(NcTestResultSchema) }), {
|
|
19597
|
-
kind: "mutation",
|
|
19598
|
-
auth: "admin"
|
|
19599
|
-
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
19800
|
+
}), _void(), { kind: "mutation" });
|
|
19600
19801
|
/**
|
|
19601
19802
|
* Zod schemas for persisted record types.
|
|
19602
19803
|
*
|
|
@@ -24618,6 +24819,12 @@ Object.freeze({
|
|
|
24618
24819
|
addonId: null,
|
|
24619
24820
|
access: "delete"
|
|
24620
24821
|
},
|
|
24822
|
+
"backup.deleteSchedule": {
|
|
24823
|
+
capName: "backup",
|
|
24824
|
+
capScope: "system",
|
|
24825
|
+
addonId: null,
|
|
24826
|
+
access: "delete"
|
|
24827
|
+
},
|
|
24621
24828
|
"backup.getEntries": {
|
|
24622
24829
|
capName: "backup",
|
|
24623
24830
|
capScope: "system",
|
|
@@ -24648,6 +24855,12 @@ Object.freeze({
|
|
|
24648
24855
|
addonId: null,
|
|
24649
24856
|
access: "view"
|
|
24650
24857
|
},
|
|
24858
|
+
"backup.listSchedules": {
|
|
24859
|
+
capName: "backup",
|
|
24860
|
+
capScope: "system",
|
|
24861
|
+
addonId: null,
|
|
24862
|
+
access: "view"
|
|
24863
|
+
},
|
|
24651
24864
|
"backup.previewSchedule": {
|
|
24652
24865
|
capName: "backup",
|
|
24653
24866
|
capScope: "system",
|
|
@@ -24672,6 +24885,12 @@ Object.freeze({
|
|
|
24672
24885
|
addonId: null,
|
|
24673
24886
|
access: "create"
|
|
24674
24887
|
},
|
|
24888
|
+
"backup.upsertSchedule": {
|
|
24889
|
+
capName: "backup",
|
|
24890
|
+
capScope: "system",
|
|
24891
|
+
addonId: null,
|
|
24892
|
+
access: "create"
|
|
24893
|
+
},
|
|
24675
24894
|
"battery.wakeForStream": {
|
|
24676
24895
|
capName: "battery",
|
|
24677
24896
|
capScope: "device",
|
|
@@ -28506,6 +28725,36 @@ Object.freeze({
|
|
|
28506
28725
|
addonId: null,
|
|
28507
28726
|
access: "create"
|
|
28508
28727
|
},
|
|
28728
|
+
"terminalSession.close": {
|
|
28729
|
+
capName: "terminal-session",
|
|
28730
|
+
capScope: "system",
|
|
28731
|
+
addonId: null,
|
|
28732
|
+
access: "create"
|
|
28733
|
+
},
|
|
28734
|
+
"terminalSession.listProfiles": {
|
|
28735
|
+
capName: "terminal-session",
|
|
28736
|
+
capScope: "system",
|
|
28737
|
+
addonId: null,
|
|
28738
|
+
access: "view"
|
|
28739
|
+
},
|
|
28740
|
+
"terminalSession.listSessions": {
|
|
28741
|
+
capName: "terminal-session",
|
|
28742
|
+
capScope: "system",
|
|
28743
|
+
addonId: null,
|
|
28744
|
+
access: "view"
|
|
28745
|
+
},
|
|
28746
|
+
"terminalSession.openSession": {
|
|
28747
|
+
capName: "terminal-session",
|
|
28748
|
+
capScope: "system",
|
|
28749
|
+
addonId: null,
|
|
28750
|
+
access: "create"
|
|
28751
|
+
},
|
|
28752
|
+
"terminalSession.resize": {
|
|
28753
|
+
capName: "terminal-session",
|
|
28754
|
+
capScope: "system",
|
|
28755
|
+
addonId: null,
|
|
28756
|
+
access: "create"
|
|
28757
|
+
},
|
|
28509
28758
|
"toast.onToast": {
|
|
28510
28759
|
capName: "toast",
|
|
28511
28760
|
capScope: "system",
|