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