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