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