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