@camstack/addon-provider-reolink 1.2.11 → 1.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +2405 -2156
- package/dist/addon.mjs +2405 -2156
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -7727,16 +7727,23 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7727
7727
|
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7728
7728
|
* FRESH install:
|
|
7729
7729
|
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7730
|
-
* the appData volume. Right for small/durable data (
|
|
7730
|
+
* the appData volume. Right for small/durable data (logs, models).
|
|
7731
7731
|
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7732
7732
|
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7733
7733
|
* (recordings, event media) that should stay off the appData disk.
|
|
7734
|
+
* - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
|
|
7735
|
+
* `/backups` in the image) so archives live on their own mount rather than
|
|
7736
|
+
* filling the appData disk. Falls back to the data root when unset.
|
|
7734
7737
|
*
|
|
7735
7738
|
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7736
7739
|
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7737
7740
|
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7738
7741
|
*/
|
|
7739
|
-
defaultRoot: _enum([
|
|
7742
|
+
defaultRoot: _enum([
|
|
7743
|
+
"data",
|
|
7744
|
+
"media",
|
|
7745
|
+
"backup"
|
|
7746
|
+
]).optional()
|
|
7740
7747
|
});
|
|
7741
7748
|
var DecoderStatsSchema = object({
|
|
7742
7749
|
inputFps: number(),
|
|
@@ -9369,674 +9376,1312 @@ function createRuntimeStateBridge(params) {
|
|
|
9369
9376
|
};
|
|
9370
9377
|
}
|
|
9371
9378
|
/**
|
|
9372
|
-
*
|
|
9373
|
-
*
|
|
9374
|
-
*
|
|
9375
|
-
*
|
|
9376
|
-
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
9377
|
-
* their own slices.
|
|
9379
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
9380
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
9381
|
+
* language so a single drawing-plane editor and the providers stay
|
|
9382
|
+
* decoupled from each cap's storage.
|
|
9378
9383
|
*
|
|
9379
|
-
*
|
|
9380
|
-
*
|
|
9381
|
-
* `
|
|
9382
|
-
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
9383
|
-
* consumers reach the same data via the `device-state` cap router
|
|
9384
|
-
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
9384
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
9385
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
9386
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
9385
9387
|
*/
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9388
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
9389
|
+
var MaskPointSchema = object({
|
|
9390
|
+
x: number(),
|
|
9391
|
+
y: number()
|
|
9392
|
+
});
|
|
9393
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
9394
|
+
var MaskRectShapeSchema = object({
|
|
9395
|
+
kind: literal("rect"),
|
|
9396
|
+
x: number(),
|
|
9397
|
+
y: number(),
|
|
9398
|
+
width: number(),
|
|
9399
|
+
height: number()
|
|
9400
|
+
});
|
|
9401
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
9402
|
+
var MaskPolygonShapeSchema = object({
|
|
9403
|
+
kind: literal("polygon"),
|
|
9404
|
+
points: array(MaskPointSchema)
|
|
9405
|
+
});
|
|
9406
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
9407
|
+
var MaskGridShapeSchema = object({
|
|
9408
|
+
kind: literal("grid"),
|
|
9409
|
+
gridWidth: number(),
|
|
9410
|
+
gridHeight: number(),
|
|
9411
|
+
cells: array(boolean())
|
|
9412
|
+
});
|
|
9413
|
+
discriminatedUnion("kind", [
|
|
9414
|
+
MaskRectShapeSchema,
|
|
9415
|
+
MaskPolygonShapeSchema,
|
|
9416
|
+
MaskGridShapeSchema,
|
|
9417
|
+
object({
|
|
9418
|
+
kind: literal("line"),
|
|
9419
|
+
points: array(MaskPointSchema)
|
|
9420
|
+
})
|
|
9421
|
+
]);
|
|
9422
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
9423
|
+
var MaskShapeKindSchema = _enum([
|
|
9424
|
+
"rect",
|
|
9425
|
+
"polygon",
|
|
9426
|
+
"grid",
|
|
9427
|
+
"line"
|
|
9428
|
+
]);
|
|
9429
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
9430
|
+
var MaskPolygonVerticesSchema = object({
|
|
9431
|
+
min: number(),
|
|
9432
|
+
max: number()
|
|
9433
|
+
});
|
|
9434
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
9435
|
+
var MaskGridDimsSchema = object({
|
|
9436
|
+
width: number(),
|
|
9437
|
+
height: number()
|
|
9398
9438
|
});
|
|
9399
|
-
var deviceStatusCapability = {
|
|
9400
|
-
name: "device-status",
|
|
9401
|
-
scope: "device",
|
|
9402
|
-
deviceNative: true,
|
|
9403
|
-
mode: "singleton",
|
|
9404
|
-
methods: {},
|
|
9405
|
-
events: {
|
|
9406
|
-
/** Emitted when `online` transitions. Mirrors the semantics of
|
|
9407
|
-
* `battery.onStatusChanged`. */
|
|
9408
|
-
onStatusChanged: { data: object({
|
|
9409
|
-
deviceId: number(),
|
|
9410
|
-
status: DeviceStatusSchema
|
|
9411
|
-
}) } },
|
|
9412
|
-
status: {
|
|
9413
|
-
schema: DeviceStatusSchema,
|
|
9414
|
-
kind: "push"
|
|
9415
|
-
},
|
|
9416
|
-
runtimeState: DeviceStatusSchema
|
|
9417
|
-
};
|
|
9418
9439
|
/**
|
|
9419
|
-
*
|
|
9420
|
-
* truth about what a device CAN do — which the kernel uses to:
|
|
9421
|
-
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
9422
|
-
* based on what the firmware actually advertises).
|
|
9423
|
-
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
9424
|
-
* `device-manager.listAll`.
|
|
9425
|
-
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
9426
|
-
* to register on the device's capability surface.
|
|
9440
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
9427
9441
|
*
|
|
9428
|
-
*
|
|
9429
|
-
*
|
|
9430
|
-
* accessory reconciliation). Consumers read via:
|
|
9431
|
-
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
9442
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
9443
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
9432
9444
|
*
|
|
9433
|
-
*
|
|
9434
|
-
*
|
|
9435
|
-
*
|
|
9445
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
9446
|
+
* `notification-center` module), hooked on the durable persistence
|
|
9447
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
9448
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
9449
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
9450
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
9451
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
9452
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
9453
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
9454
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
9455
|
+
* target kind's own caps/degrade engine).
|
|
9436
9456
|
*
|
|
9437
|
-
*
|
|
9438
|
-
*
|
|
9439
|
-
*
|
|
9440
|
-
*
|
|
9457
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
9458
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
9459
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
9460
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
9461
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
9462
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
9463
|
+
* P2+ (see spec §7).
|
|
9464
|
+
*
|
|
9465
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
9466
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
9467
|
+
* schema/interface drift is explicitly not repeated).
|
|
9441
9468
|
*/
|
|
9442
|
-
|
|
9469
|
+
/**
|
|
9470
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
9471
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
9472
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
9473
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
9474
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
9475
|
+
* change of a LINKED device, one row per linked camera)
|
|
9476
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
9477
|
+
* delivery / pick-up)
|
|
9478
|
+
*
|
|
9479
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
9480
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
9481
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
9482
|
+
* one trigger.
|
|
9483
|
+
*/
|
|
9484
|
+
var NcDeliverySchema = _enum([
|
|
9485
|
+
"immediate",
|
|
9486
|
+
"track-end",
|
|
9487
|
+
"device-event",
|
|
9488
|
+
"package-event"
|
|
9489
|
+
]);
|
|
9490
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
9491
|
+
var NcScheduleSchema = object({
|
|
9492
|
+
windows: array(object({
|
|
9493
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
9494
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
9495
|
+
startMinute: number().int().min(0).max(1439),
|
|
9496
|
+
endMinute: number().int().min(0).max(1439)
|
|
9497
|
+
})).min(1),
|
|
9498
|
+
/** IANA timezone; default = hub host timezone. */
|
|
9499
|
+
timezone: string().optional(),
|
|
9500
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
9501
|
+
invert: boolean().optional()
|
|
9502
|
+
});
|
|
9503
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
9504
|
+
var NcPlateMatcherSchema = object({
|
|
9505
|
+
values: array(string().min(1)).min(1),
|
|
9506
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9507
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9508
|
+
});
|
|
9509
|
+
/**
|
|
9510
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9511
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9512
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9513
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9514
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9515
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9516
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9517
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9518
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9519
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9520
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9521
|
+
*/
|
|
9522
|
+
var NcOccupancyConditionSchema = object({
|
|
9523
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9524
|
+
zoneId: string().optional(),
|
|
9525
|
+
/** Object class to count; absent = any class. */
|
|
9526
|
+
className: string().optional(),
|
|
9527
|
+
op: _enum([
|
|
9528
|
+
"became-occupied",
|
|
9529
|
+
"became-free",
|
|
9530
|
+
">=",
|
|
9531
|
+
"<="
|
|
9532
|
+
]).default("became-occupied"),
|
|
9533
|
+
count: number().int().min(0).default(1),
|
|
9534
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9535
|
+
});
|
|
9536
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9537
|
+
var NcZoneConditionSchema = object({
|
|
9538
|
+
ids: array(string().min(1)).min(1),
|
|
9539
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9540
|
+
match: _enum(["any", "all"]).default("any")
|
|
9541
|
+
});
|
|
9542
|
+
/**
|
|
9543
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9544
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9545
|
+
*/
|
|
9546
|
+
var NcConditionsSchema = object({
|
|
9547
|
+
/** Device scope — absent = all devices. */
|
|
9548
|
+
devices: array(number()).optional(),
|
|
9549
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9550
|
+
classes: array(string().min(1)).optional(),
|
|
9551
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9552
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9553
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9554
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9555
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9556
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9557
|
+
/** Veto zones — any hit fails the rule. */
|
|
9558
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
9443
9559
|
/**
|
|
9444
|
-
*
|
|
9445
|
-
*
|
|
9446
|
-
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
9447
|
-
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
9448
|
-
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9560
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9561
|
+
* (identity name / plate text / subclass).
|
|
9449
9562
|
*/
|
|
9450
|
-
|
|
9563
|
+
labelEquals: array(string().min(1)).optional(),
|
|
9451
9564
|
/**
|
|
9452
|
-
*
|
|
9453
|
-
*
|
|
9454
|
-
*
|
|
9565
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9566
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9567
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
9455
9568
|
*/
|
|
9456
|
-
|
|
9457
|
-
/**
|
|
9458
|
-
|
|
9459
|
-
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
9460
|
-
channelCount: number().nullable(),
|
|
9569
|
+
identities: array(string().min(1)).optional(),
|
|
9570
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9571
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
9461
9572
|
/**
|
|
9462
|
-
*
|
|
9463
|
-
*
|
|
9464
|
-
*
|
|
9465
|
-
*
|
|
9573
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9574
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9575
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9576
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
9466
9577
|
*/
|
|
9467
|
-
|
|
9578
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
9468
9579
|
/**
|
|
9469
|
-
*
|
|
9470
|
-
*
|
|
9471
|
-
*
|
|
9580
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9581
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9582
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9583
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9584
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9585
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9586
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9472
9587
|
*/
|
|
9473
|
-
|
|
9588
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9589
|
+
/**
|
|
9590
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9591
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9592
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9593
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9594
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9595
|
+
*/
|
|
9596
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9597
|
+
/**
|
|
9598
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9599
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9600
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9601
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9602
|
+
* tracks carry `sensor`.
|
|
9603
|
+
*/
|
|
9604
|
+
source: _enum([
|
|
9605
|
+
"pipeline",
|
|
9606
|
+
"onboard",
|
|
9607
|
+
"sensor",
|
|
9608
|
+
"any"
|
|
9609
|
+
]).optional(),
|
|
9610
|
+
/**
|
|
9611
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9612
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9613
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9614
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9615
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9616
|
+
*
|
|
9617
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9618
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9619
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9620
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9621
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9622
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9623
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9624
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9625
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9626
|
+
* closed for it (an un-recognized subject).
|
|
9627
|
+
*/
|
|
9628
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9629
|
+
/**
|
|
9630
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9631
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9632
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9633
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9634
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9635
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9636
|
+
*/
|
|
9637
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9638
|
+
/**
|
|
9639
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9640
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9641
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9642
|
+
*/
|
|
9643
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9644
|
+
/**
|
|
9645
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9646
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9647
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9648
|
+
* on the package-event trigger).
|
|
9649
|
+
*/
|
|
9650
|
+
packagePhase: _enum([
|
|
9651
|
+
"delivered",
|
|
9652
|
+
"picked-up",
|
|
9653
|
+
"both"
|
|
9654
|
+
]).optional(),
|
|
9655
|
+
/**
|
|
9656
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9657
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9658
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9659
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9660
|
+
*/
|
|
9661
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9662
|
+
/**
|
|
9663
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9664
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9665
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9666
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9667
|
+
*/
|
|
9668
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9669
|
+
});
|
|
9670
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9671
|
+
var NcRuleTargetSchema = object({
|
|
9672
|
+
/** `notification-output` Target id. */
|
|
9673
|
+
targetId: string().min(1),
|
|
9674
|
+
/**
|
|
9675
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9676
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9677
|
+
* degrade engine drops what the backend can't render.
|
|
9678
|
+
*/
|
|
9679
|
+
params: record(string(), unknown()).optional()
|
|
9474
9680
|
});
|
|
9475
|
-
var featureProbeCapability = {
|
|
9476
|
-
name: "feature-probe",
|
|
9477
|
-
scope: "device",
|
|
9478
|
-
deviceNative: true,
|
|
9479
|
-
mode: "singleton",
|
|
9480
|
-
methods: {},
|
|
9481
|
-
events: {
|
|
9482
|
-
/** Fires whenever a fresh probe completes (kernel-driven `reprobe()`
|
|
9483
|
-
* or driver-initiated re-detect after a state change). */
|
|
9484
|
-
onProbeChanged: { data: object({
|
|
9485
|
-
deviceId: number(),
|
|
9486
|
-
status: FeatureProbeStatusSchema
|
|
9487
|
-
}) } },
|
|
9488
|
-
status: {
|
|
9489
|
-
schema: FeatureProbeStatusSchema,
|
|
9490
|
-
kind: "push"
|
|
9491
|
-
},
|
|
9492
|
-
runtimeState: FeatureProbeStatusSchema
|
|
9493
|
-
};
|
|
9494
9681
|
/**
|
|
9495
|
-
*
|
|
9496
|
-
*
|
|
9497
|
-
*
|
|
9498
|
-
*
|
|
9499
|
-
*
|
|
9500
|
-
*
|
|
9501
|
-
*
|
|
9682
|
+
* Media attachment policy (P1 still-image subset).
|
|
9683
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9684
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9685
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9686
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9687
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9688
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9689
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9690
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9691
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9692
|
+
* - `none` — no attachment.
|
|
9502
9693
|
*/
|
|
9503
|
-
var
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
/**
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9694
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9695
|
+
"best",
|
|
9696
|
+
"best-matching",
|
|
9697
|
+
"keyFrame",
|
|
9698
|
+
"none"
|
|
9699
|
+
]).default("best") });
|
|
9700
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9701
|
+
var NcThrottleSchema = object({
|
|
9702
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9703
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9704
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9705
|
+
});
|
|
9706
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9707
|
+
var NcRuleInputSchema = object({
|
|
9708
|
+
name: string().min(1).max(200),
|
|
9709
|
+
enabled: boolean().default(true),
|
|
9710
|
+
delivery: NcDeliverySchema,
|
|
9711
|
+
conditions: NcConditionsSchema.default({}),
|
|
9712
|
+
schedule: NcScheduleSchema.optional(),
|
|
9713
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9714
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9715
|
+
throttle: NcThrottleSchema.default({
|
|
9716
|
+
cooldownSec: 60,
|
|
9717
|
+
scope: "rule-device"
|
|
9718
|
+
}),
|
|
9719
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9720
|
+
template: object({
|
|
9721
|
+
title: string().max(500).optional(),
|
|
9722
|
+
body: string().max(2e3).optional()
|
|
9723
|
+
}).optional(),
|
|
9724
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9725
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9726
|
+
/**
|
|
9727
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9728
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9729
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9730
|
+
*/
|
|
9731
|
+
ownerUserId: string().optional()
|
|
9526
9732
|
});
|
|
9527
|
-
var airQualitySensorCapability = {
|
|
9528
|
-
name: "air-quality-sensor",
|
|
9529
|
-
scope: "device",
|
|
9530
|
-
deviceNative: true,
|
|
9531
|
-
mode: "singleton",
|
|
9532
|
-
deviceTypes: [DeviceType.Sensor],
|
|
9533
|
-
methods: {},
|
|
9534
|
-
status: {
|
|
9535
|
-
schema: AirQualitySensorStatusSchema,
|
|
9536
|
-
kind: "push"
|
|
9537
|
-
},
|
|
9538
|
-
runtimeState: AirQualitySensorStatusSchema
|
|
9539
|
-
};
|
|
9540
9733
|
/**
|
|
9541
|
-
*
|
|
9542
|
-
* `
|
|
9543
|
-
*
|
|
9544
|
-
*
|
|
9545
|
-
*
|
|
9546
|
-
*
|
|
9547
|
-
* `
|
|
9548
|
-
* service; it's NEVER persisted in the runtime slice or any event
|
|
9549
|
-
* payload. The presence of a required code is signalled by
|
|
9550
|
-
* `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
|
|
9551
|
-
* field without a slice fetch.
|
|
9552
|
-
*
|
|
9553
|
-
* `availableModes` mirrors HA's `supported_features`-derived arm
|
|
9554
|
-
* mode list — the UI renders only the buttons the panel accepts.
|
|
9734
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9735
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9736
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9737
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9738
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9739
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9740
|
+
* `updateRule` patch.
|
|
9555
9741
|
*/
|
|
9556
|
-
var
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
"disarming",
|
|
9565
|
-
"pending",
|
|
9566
|
-
"triggered"
|
|
9567
|
-
]);
|
|
9568
|
-
var AlarmArmModeSchema = _enum([
|
|
9569
|
-
"home",
|
|
9570
|
-
"away",
|
|
9571
|
-
"night",
|
|
9572
|
-
"vacation",
|
|
9573
|
-
"custom_bypass"
|
|
9574
|
-
]);
|
|
9575
|
-
var AlarmPanelStatusSchema = object({
|
|
9576
|
-
/** Current lifecycle state. */
|
|
9577
|
-
state: AlarmStateSchema,
|
|
9578
|
-
/** Subset of arm modes the panel accepts. UI renders one button per
|
|
9579
|
-
* mode in this list. */
|
|
9580
|
-
availableModes: array(AlarmArmModeSchema),
|
|
9581
|
-
/** Whether the panel requires a PIN on arm / disarm. Mirrors
|
|
9582
|
-
* `DeviceFeature.AlarmPinRequired` for slice consumers. */
|
|
9583
|
-
requiresCode: boolean(),
|
|
9584
|
-
/** Ms epoch when the slice was last updated. */
|
|
9585
|
-
lastChangedAt: number()
|
|
9586
|
-
});
|
|
9587
|
-
var alarmPanelCapability = {
|
|
9588
|
-
name: "alarm-panel",
|
|
9589
|
-
scope: "device",
|
|
9590
|
-
deviceNative: true,
|
|
9591
|
-
mode: "singleton",
|
|
9592
|
-
deviceTypes: [DeviceType.AlarmPanel],
|
|
9593
|
-
methods: {
|
|
9594
|
-
arm: method(object({
|
|
9595
|
-
deviceId: number().int().nonnegative(),
|
|
9596
|
-
mode: AlarmArmModeSchema,
|
|
9597
|
-
/** Optional PIN code. Required when `requiresCode === true`.
|
|
9598
|
-
* Passed through to the upstream service; never persisted. */
|
|
9599
|
-
code: string().min(1).optional()
|
|
9600
|
-
}), _void(), {
|
|
9601
|
-
kind: "mutation",
|
|
9602
|
-
auth: "admin"
|
|
9603
|
-
}),
|
|
9604
|
-
disarm: method(object({
|
|
9605
|
-
deviceId: number().int().nonnegative(),
|
|
9606
|
-
code: string().min(1).optional()
|
|
9607
|
-
}), _void(), {
|
|
9608
|
-
kind: "mutation",
|
|
9609
|
-
auth: "admin"
|
|
9610
|
-
}),
|
|
9611
|
-
/**
|
|
9612
|
-
* Force the panel into the `triggered` state — used by HA
|
|
9613
|
-
* automations to surface external sensor events through the panel
|
|
9614
|
-
* (e.g. a Reolink camera intrusion event firing the security
|
|
9615
|
-
* system). Provider rejects when the panel hardware doesn't
|
|
9616
|
-
* support a software-initiated trigger.
|
|
9617
|
-
*/
|
|
9618
|
-
trigger: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
9619
|
-
kind: "mutation",
|
|
9620
|
-
auth: "admin"
|
|
9621
|
-
})
|
|
9622
|
-
},
|
|
9623
|
-
status: {
|
|
9624
|
-
schema: AlarmPanelStatusSchema,
|
|
9625
|
-
kind: "push"
|
|
9626
|
-
},
|
|
9742
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9743
|
+
/** A persisted rule. */
|
|
9744
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9745
|
+
id: string(),
|
|
9746
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9747
|
+
createdBy: string(),
|
|
9748
|
+
createdAt: number(),
|
|
9749
|
+
updatedAt: number(),
|
|
9627
9750
|
/**
|
|
9628
|
-
*
|
|
9629
|
-
*
|
|
9630
|
-
*
|
|
9751
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9752
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9753
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9631
9754
|
*/
|
|
9632
|
-
|
|
9633
|
-
};
|
|
9634
|
-
/**
|
|
9635
|
-
* Ambient illuminance reading in lux. Drives Home Assistant `sensor`
|
|
9636
|
-
* entries with `device_class: illuminance`.
|
|
9637
|
-
*/
|
|
9638
|
-
var AmbientLightSensorStatusSchema = object({
|
|
9639
|
-
/** Current illuminance in lux (lx). */
|
|
9640
|
-
lux: number().min(0),
|
|
9641
|
-
/** Ms epoch when the slice was last updated. */
|
|
9642
|
-
lastFetchedAt: number(),
|
|
9643
|
-
/** Live display unit from the upstream source (e.g. HA
|
|
9644
|
-
* `attributes.unit_of_measurement`). The UI prefers this over the
|
|
9645
|
-
* role's canonical unit. Absent → fall back to the canonical unit. */
|
|
9646
|
-
unit: string().optional(),
|
|
9647
|
-
/** Suggested decimal places for numeric display.
|
|
9648
|
-
* Populated live from the upstream source when provided (e.g. HA
|
|
9649
|
-
* `attributes.suggested_display_precision`). Falls back to
|
|
9650
|
-
* auto-formatting when absent. */
|
|
9651
|
-
precision: number().int().min(0).max(10).optional()
|
|
9755
|
+
disabledTargetIds: array(string()).default([])
|
|
9652
9756
|
});
|
|
9653
|
-
var
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
var
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9757
|
+
var NcTestResultSchema = object({
|
|
9758
|
+
recordId: string(),
|
|
9759
|
+
recordKind: _enum([
|
|
9760
|
+
"object-event",
|
|
9761
|
+
"track",
|
|
9762
|
+
"device-event",
|
|
9763
|
+
"package-event"
|
|
9764
|
+
]),
|
|
9765
|
+
deviceId: number(),
|
|
9766
|
+
timestamp: number(),
|
|
9767
|
+
wouldFire: boolean(),
|
|
9768
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9769
|
+
failedCondition: string().optional(),
|
|
9770
|
+
className: string().optional(),
|
|
9771
|
+
label: string().optional()
|
|
9772
|
+
});
|
|
9773
|
+
var NcConditionDescriptorSchema = object({
|
|
9774
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9775
|
+
id: string(),
|
|
9776
|
+
group: _enum([
|
|
9777
|
+
"scope",
|
|
9778
|
+
"class",
|
|
9779
|
+
"zones",
|
|
9780
|
+
"quality",
|
|
9781
|
+
"label",
|
|
9782
|
+
"schedule",
|
|
9783
|
+
"device",
|
|
9784
|
+
"package",
|
|
9785
|
+
"occupancy"
|
|
9786
|
+
]),
|
|
9787
|
+
label: string(),
|
|
9788
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9789
|
+
valueType: _enum([
|
|
9790
|
+
"deviceIdList",
|
|
9791
|
+
"stringList",
|
|
9792
|
+
"number01",
|
|
9793
|
+
"number",
|
|
9794
|
+
"sourceSelect",
|
|
9795
|
+
"zoneSelection",
|
|
9796
|
+
"zoneIdList",
|
|
9797
|
+
"schedule",
|
|
9798
|
+
"plateMatcher",
|
|
9799
|
+
"packagePhase",
|
|
9800
|
+
"polygonDraw",
|
|
9801
|
+
"occupancy"
|
|
9802
|
+
]),
|
|
9803
|
+
operator: _enum([
|
|
9804
|
+
"in",
|
|
9805
|
+
"notIn",
|
|
9806
|
+
"anyOf",
|
|
9807
|
+
"allOf",
|
|
9808
|
+
"gte",
|
|
9809
|
+
"fuzzyIn",
|
|
9810
|
+
"withinSchedule"
|
|
9811
|
+
]),
|
|
9812
|
+
/** Which delivery kinds the condition applies to. */
|
|
9813
|
+
appliesTo: array(NcDeliverySchema),
|
|
9814
|
+
phase: string(),
|
|
9815
|
+
description: string().optional()
|
|
9677
9816
|
});
|
|
9678
9817
|
/**
|
|
9679
|
-
*
|
|
9680
|
-
*
|
|
9681
|
-
*
|
|
9682
|
-
*
|
|
9683
|
-
*
|
|
9684
|
-
*
|
|
9818
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9819
|
+
* durable outbox row's own status (single source of truth):
|
|
9820
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9821
|
+
* - `sent` — delivered (terminal)
|
|
9822
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9823
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9824
|
+
* the failure `error`)
|
|
9685
9825
|
*
|
|
9686
|
-
*
|
|
9687
|
-
* (
|
|
9688
|
-
* and the level history shifts forward.
|
|
9826
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9827
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9689
9828
|
*/
|
|
9690
|
-
var
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
}).nullable(),
|
|
9710
|
-
/** Per-class summary across the rolling window — keys are
|
|
9711
|
-
* `macroClass` strings (e.g. `dog_bark`, `speech`, `glass_break`). */
|
|
9712
|
-
byClass: array(AudioClassSummarySchema).readonly()
|
|
9829
|
+
var NcHistoryStatusSchema = _enum([
|
|
9830
|
+
"pending",
|
|
9831
|
+
"sent",
|
|
9832
|
+
"dead"
|
|
9833
|
+
]);
|
|
9834
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9835
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9836
|
+
"object-event",
|
|
9837
|
+
"track-end",
|
|
9838
|
+
"device-event",
|
|
9839
|
+
"package-event"
|
|
9840
|
+
]);
|
|
9841
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9842
|
+
var NcHistorySubjectSchema = object({
|
|
9843
|
+
className: string(),
|
|
9844
|
+
label: string().optional(),
|
|
9845
|
+
confidence: number().optional(),
|
|
9846
|
+
zones: array(string()),
|
|
9847
|
+
timestamp: number()
|
|
9713
9848
|
});
|
|
9714
9849
|
/**
|
|
9715
|
-
*
|
|
9716
|
-
*
|
|
9717
|
-
*
|
|
9718
|
-
*
|
|
9719
|
-
*
|
|
9850
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9851
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9852
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9853
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9854
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9855
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9856
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9857
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9858
|
+
* P1 (admin scope only).
|
|
9720
9859
|
*/
|
|
9721
|
-
var
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9860
|
+
var NcHistoryEntrySchema = object({
|
|
9861
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9862
|
+
id: string(),
|
|
9863
|
+
ruleId: string(),
|
|
9864
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9865
|
+
ruleName: string(),
|
|
9866
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9867
|
+
delivery: NcDeliverySchema,
|
|
9868
|
+
targetId: string(),
|
|
9869
|
+
deviceId: number(),
|
|
9870
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9871
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9872
|
+
recordId: string(),
|
|
9873
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9874
|
+
trackId: string().optional(),
|
|
9875
|
+
status: NcHistoryStatusSchema,
|
|
9876
|
+
/** Delivery attempts made so far. */
|
|
9877
|
+
attempts: number().int(),
|
|
9878
|
+
/** Fire time (outbox enqueue). */
|
|
9879
|
+
createdAt: number(),
|
|
9880
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9881
|
+
updatedAt: number(),
|
|
9882
|
+
/** Failure detail — present on a `dead` row. */
|
|
9883
|
+
error: string().optional(),
|
|
9884
|
+
subject: NcHistorySubjectSchema
|
|
9743
9885
|
});
|
|
9744
9886
|
/**
|
|
9745
|
-
*
|
|
9746
|
-
*
|
|
9747
|
-
* (
|
|
9748
|
-
*
|
|
9749
|
-
* a custom event subscription.
|
|
9887
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9888
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9889
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9890
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9750
9891
|
*/
|
|
9751
|
-
var
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9892
|
+
var NcHistoryFilterSchema = object({
|
|
9893
|
+
ruleId: string().optional(),
|
|
9894
|
+
deviceId: number().optional(),
|
|
9895
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9896
|
+
since: number().optional(),
|
|
9897
|
+
until: number().optional(),
|
|
9898
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9899
|
+
});
|
|
9900
|
+
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 }), {
|
|
9901
|
+
kind: "mutation",
|
|
9902
|
+
auth: "admin",
|
|
9903
|
+
caller: "required"
|
|
9904
|
+
}), method(object({
|
|
9905
|
+
ruleId: string(),
|
|
9906
|
+
patch: NcRulePatchSchema
|
|
9907
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9908
|
+
kind: "mutation",
|
|
9909
|
+
auth: "admin",
|
|
9910
|
+
caller: "required"
|
|
9911
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9912
|
+
kind: "mutation",
|
|
9913
|
+
auth: "admin"
|
|
9914
|
+
}), method(object({
|
|
9915
|
+
ruleId: string(),
|
|
9916
|
+
enabled: boolean()
|
|
9917
|
+
}), object({ success: literal(true) }), {
|
|
9918
|
+
kind: "mutation",
|
|
9919
|
+
auth: "admin"
|
|
9920
|
+
}), method(object({
|
|
9921
|
+
rule: NcRuleInputSchema,
|
|
9922
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9923
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9924
|
+
kind: "mutation",
|
|
9925
|
+
auth: "admin"
|
|
9926
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9784
9927
|
/**
|
|
9785
|
-
*
|
|
9786
|
-
* `DeviceType.Automation`. An automation is a trigger+condition+
|
|
9787
|
-
* action rule that can be enabled / disabled and manually fired
|
|
9788
|
-
* via the `trigger` method.
|
|
9928
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9789
9929
|
*
|
|
9790
|
-
*
|
|
9791
|
-
*
|
|
9792
|
-
*
|
|
9793
|
-
*
|
|
9930
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
9931
|
+
* §3.2/§3.3.
|
|
9932
|
+
*
|
|
9933
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
9934
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
9935
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
9936
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
9937
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
9938
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
9939
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
9940
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
9941
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
9942
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
9943
|
+
*
|
|
9944
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
9945
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
9946
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
9947
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
9948
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
9794
9949
|
*/
|
|
9795
|
-
var
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
/** Ms epoch when the slice was last updated. */
|
|
9807
|
-
lastChangedAt: number()
|
|
9808
|
-
});
|
|
9809
|
-
var automationControlCapability = {
|
|
9810
|
-
name: "automation-control",
|
|
9811
|
-
scope: "device",
|
|
9812
|
-
deviceNative: true,
|
|
9813
|
-
mode: "singleton",
|
|
9814
|
-
deviceTypes: [DeviceType.Automation],
|
|
9815
|
-
methods: {
|
|
9816
|
-
enable: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
9817
|
-
kind: "mutation",
|
|
9818
|
-
auth: "admin"
|
|
9819
|
-
}),
|
|
9820
|
-
disable: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
9821
|
-
kind: "mutation",
|
|
9822
|
-
auth: "admin"
|
|
9823
|
-
}),
|
|
9824
|
-
trigger: method(object({
|
|
9825
|
-
deviceId: number().int().nonnegative(),
|
|
9826
|
-
/** When true, fires the action block while bypassing the
|
|
9827
|
-
* automation's condition evaluation. Gated by
|
|
9828
|
-
* `DeviceFeature.AutomationSkipCondition`. */
|
|
9829
|
-
skipCondition: boolean().optional()
|
|
9830
|
-
}), _void(), {
|
|
9831
|
-
kind: "mutation",
|
|
9832
|
-
auth: "admin"
|
|
9833
|
-
})
|
|
9834
|
-
},
|
|
9835
|
-
status: {
|
|
9836
|
-
schema: AutomationControlStatusSchema,
|
|
9837
|
-
kind: "push"
|
|
9838
|
-
},
|
|
9839
|
-
/**
|
|
9840
|
-
* Runtime-state slice — mirrored by the kernel. UI automation tile
|
|
9841
|
-
* reads `enabled` (toggle) + `isRunning` (spinner) + `lastError`
|
|
9842
|
-
* (badge) directly.
|
|
9843
|
-
*/
|
|
9844
|
-
runtimeState: AutomationControlStatusSchema
|
|
9845
|
-
};
|
|
9950
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
9951
|
+
var TimelapseTemplateSchema = object({
|
|
9952
|
+
title: string().max(500).optional(),
|
|
9953
|
+
body: string().max(2e3).optional()
|
|
9954
|
+
});
|
|
9955
|
+
var NameField = string().min(1).max(200);
|
|
9956
|
+
var DeviceIdsField = array(number()).min(1);
|
|
9957
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
9958
|
+
var FramerateField = number().int().min(1).max(60);
|
|
9959
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
9960
|
+
var PriorityField = number().int().min(1).max(5);
|
|
9846
9961
|
/**
|
|
9847
|
-
*
|
|
9848
|
-
*
|
|
9849
|
-
*
|
|
9850
|
-
* battery" alerting on top — the cap deliberately does NOT enforce a
|
|
9851
|
-
* threshold.
|
|
9962
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
9963
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
9964
|
+
* here (see the ownership note above).
|
|
9852
9965
|
*/
|
|
9853
|
-
var
|
|
9854
|
-
|
|
9855
|
-
|
|
9966
|
+
var TimelapseRuleInputSchema = object({
|
|
9967
|
+
name: NameField,
|
|
9968
|
+
enabled: boolean().default(true),
|
|
9969
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
9970
|
+
deviceIds: DeviceIdsField,
|
|
9971
|
+
/**
|
|
9972
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
9973
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
9974
|
+
* open clears the scratch, close assembles and delivers.
|
|
9975
|
+
*/
|
|
9976
|
+
schedule: NcScheduleSchema,
|
|
9977
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
9978
|
+
cadenceSec: CadenceSecField.default(15),
|
|
9979
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
9980
|
+
framerate: FramerateField.default(10),
|
|
9981
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
9982
|
+
targets: TargetsField,
|
|
9983
|
+
template: TimelapseTemplateSchema.optional(),
|
|
9984
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9985
|
+
priority: PriorityField.default(3)
|
|
9986
|
+
});
|
|
9987
|
+
object({
|
|
9988
|
+
name: NameField.optional(),
|
|
9989
|
+
enabled: boolean().optional(),
|
|
9990
|
+
deviceIds: DeviceIdsField.optional(),
|
|
9991
|
+
schedule: NcScheduleSchema.optional(),
|
|
9992
|
+
cadenceSec: CadenceSecField.optional(),
|
|
9993
|
+
framerate: FramerateField.optional(),
|
|
9994
|
+
targets: TargetsField.optional(),
|
|
9995
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
9996
|
+
priority: PriorityField.optional()
|
|
9997
|
+
});
|
|
9998
|
+
TimelapseRuleInputSchema.extend({
|
|
9999
|
+
id: string(),
|
|
9856
10000
|
/**
|
|
9857
|
-
*
|
|
9858
|
-
*
|
|
9859
|
-
*
|
|
9860
|
-
* alone.
|
|
10001
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
10002
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
10003
|
+
* resolved caller; never trusted from a client payload.
|
|
9861
10004
|
*/
|
|
9862
|
-
|
|
9863
|
-
"dc",
|
|
9864
|
-
"solar",
|
|
9865
|
-
"none"
|
|
9866
|
-
]),
|
|
10005
|
+
ownerUserId: string().optional(),
|
|
9867
10006
|
/**
|
|
9868
|
-
*
|
|
9869
|
-
*
|
|
9870
|
-
* wakes the camera up and drains charge.
|
|
10007
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
10008
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
9871
10009
|
*/
|
|
9872
|
-
|
|
9873
|
-
/**
|
|
9874
|
-
|
|
10010
|
+
lastGeneratedAt: number().optional(),
|
|
10011
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
10012
|
+
createdBy: string(),
|
|
10013
|
+
createdAt: number(),
|
|
10014
|
+
updatedAt: number()
|
|
10015
|
+
});
|
|
10016
|
+
/**
|
|
10017
|
+
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
10018
|
+
* for every device, regardless of provider — the kernel needs a uniform
|
|
10019
|
+
* cap-keyed slice for the basic device flags every consumer expects to
|
|
10020
|
+
* read across processes (the `online` flag in particular). Driver-specific
|
|
10021
|
+
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
10022
|
+
* their own slices.
|
|
10023
|
+
*
|
|
10024
|
+
* Pattern is identical to `battery`: schema-bearing `runtimeState`,
|
|
10025
|
+
* empty `methods`, single change event. Reads land at
|
|
10026
|
+
* `runtimeState.getCapState('device-status')`; writes at
|
|
10027
|
+
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
10028
|
+
* consumers reach the same data via the `device-state` cap router
|
|
10029
|
+
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
10030
|
+
*/
|
|
10031
|
+
var DeviceStatusSchema = object({
|
|
9875
10032
|
/**
|
|
9876
|
-
*
|
|
9877
|
-
* `
|
|
9878
|
-
*
|
|
9879
|
-
*
|
|
9880
|
-
*
|
|
10033
|
+
* Device-level liveness. Drivers flip via `markOnline(boolean)` on
|
|
10034
|
+
* `BaseDevice`. Provider semantics vary — RTSP aggregates broker
|
|
10035
|
+
* stream-health, Reolink reads firmware push events, ONVIF tracks
|
|
10036
|
+
* ping responses. This cap intentionally does NOT prescribe which
|
|
10037
|
+
* signal drives the flag.
|
|
9881
10038
|
*/
|
|
9882
|
-
|
|
10039
|
+
online: boolean(),
|
|
10040
|
+
/** Ms epoch of the last `online` transition. Lets consumers tell
|
|
10041
|
+
* apart "just came online" from "still online". */
|
|
10042
|
+
lastChangedAt: number()
|
|
9883
10043
|
});
|
|
9884
|
-
var
|
|
9885
|
-
name: "
|
|
10044
|
+
var deviceStatusCapability = {
|
|
10045
|
+
name: "device-status",
|
|
9886
10046
|
scope: "device",
|
|
9887
10047
|
deviceNative: true,
|
|
9888
10048
|
mode: "singleton",
|
|
9889
|
-
|
|
9890
|
-
DeviceType.Camera,
|
|
9891
|
-
DeviceType.Sensor,
|
|
9892
|
-
DeviceType.Button,
|
|
9893
|
-
DeviceType.Switch
|
|
9894
|
-
],
|
|
9895
|
-
methods: {
|
|
9896
|
-
/**
|
|
9897
|
-
* Explicitly wake the camera from low-power sleep ahead of a
|
|
9898
|
-
* streaming session start. Consumers that initiate a stream
|
|
9899
|
-
* against a sleeping battery cam (HomeKit Secure Video, Alexa
|
|
9900
|
-
* RTCSession, snapshot wrappers) call this with a short timeout
|
|
9901
|
-
* before establishing the media pipeline — the broker's own
|
|
9902
|
-
* passive wake-on-dial works but adds 5–7 seconds to first-frame,
|
|
9903
|
-
* during which the consumer renders a black screen. Pre-waking
|
|
9904
|
-
* compresses that gap.
|
|
9905
|
-
*
|
|
9906
|
-
* Returns `awoke: true` when the firmware acknowledged the wake
|
|
9907
|
-
* before `timeoutMs`. Returns `awoke: false` when it timed out OR
|
|
9908
|
-
* the cap surface is unavailable (no Baichuan / firmware
|
|
9909
|
-
* channel); the caller should still attempt the stream — the
|
|
9910
|
-
* passive broker wake remains as fallback.
|
|
9911
|
-
*/
|
|
9912
|
-
wakeForStream: method(object({
|
|
9913
|
-
deviceId: number(),
|
|
9914
|
-
/** Bound on the wait. Sensible range 3000–10000ms. */
|
|
9915
|
-
timeoutMs: number().int().min(500).max(3e4).default(8e3)
|
|
9916
|
-
}), object({
|
|
9917
|
-
awoke: boolean(),
|
|
9918
|
-
durationMs: number()
|
|
9919
|
-
}), { kind: "mutation" }) },
|
|
10049
|
+
methods: {},
|
|
9920
10050
|
events: {
|
|
9921
|
-
/**
|
|
9922
|
-
*
|
|
9923
|
-
* poll observes a delta). The DeviceEventPropagator mirrors this
|
|
9924
|
-
* event on the parent chain — subscribing to a camera's source
|
|
9925
|
-
* receives battery events from child accessories automatically.
|
|
9926
|
-
*/
|
|
10051
|
+
/** Emitted when `online` transitions. Mirrors the semantics of
|
|
10052
|
+
* `battery.onStatusChanged`. */
|
|
9927
10053
|
onStatusChanged: { data: object({
|
|
9928
10054
|
deviceId: number(),
|
|
9929
|
-
status:
|
|
10055
|
+
status: DeviceStatusSchema
|
|
9930
10056
|
}) } },
|
|
9931
10057
|
status: {
|
|
9932
|
-
schema:
|
|
9933
|
-
kind: "push"
|
|
9934
|
-
empty: {
|
|
9935
|
-
percentage: 0,
|
|
9936
|
-
charging: "none",
|
|
9937
|
-
sleeping: false,
|
|
9938
|
-
lastUpdated: 0
|
|
9939
|
-
}
|
|
10058
|
+
schema: DeviceStatusSchema,
|
|
10059
|
+
kind: "push"
|
|
9940
10060
|
},
|
|
9941
|
-
|
|
9942
|
-
* Runtime-state slice — every provider that registers this cap
|
|
9943
|
-
* stores the same shape under `device.runtimeState[battery]`.
|
|
9944
|
-
* Cross-provider uniformity: a Reolink Argus, a Frigate sensor
|
|
9945
|
-
* proxy, an ONVIF battery cam all read/write the same keys.
|
|
9946
|
-
* Consumers (BatteryBadge, snapshot wrapper sleep gate) read once
|
|
9947
|
-
* via `device.runtimeState.getCapState('battery')` regardless of
|
|
9948
|
-
* the underlying driver.
|
|
9949
|
-
*/
|
|
9950
|
-
runtimeState: BatteryStatusSchema
|
|
10061
|
+
runtimeState: DeviceStatusSchema
|
|
9951
10062
|
};
|
|
9952
10063
|
/**
|
|
9953
|
-
*
|
|
9954
|
-
*
|
|
9955
|
-
*
|
|
9956
|
-
*
|
|
10064
|
+
* Per-device feature/identity probe slice. Holds the runtime-resolved
|
|
10065
|
+
* truth about what a device CAN do — which the kernel uses to:
|
|
10066
|
+
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
10067
|
+
* based on what the firmware actually advertises).
|
|
10068
|
+
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
10069
|
+
* `device-manager.listAll`.
|
|
10070
|
+
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
10071
|
+
* to register on the device's capability surface.
|
|
9957
10072
|
*
|
|
9958
|
-
*
|
|
9959
|
-
*
|
|
9960
|
-
*
|
|
9961
|
-
*
|
|
10073
|
+
* Auto-registered by `BaseDevice` for every device. Drivers populate the
|
|
10074
|
+
* slice from `onProbe()` (kernel calls it once after register, before
|
|
10075
|
+
* accessory reconciliation). Consumers read via:
|
|
10076
|
+
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
10077
|
+
*
|
|
10078
|
+
* `flags` is an open record so each driver carries its own keys without
|
|
10079
|
+
* a centralized schema bottleneck — Reolink writes `hasPtz/hasIntercom`,
|
|
10080
|
+
* Hikvision writes `hasSupplementalLight/hasAlarmIo`, etc.
|
|
10081
|
+
*
|
|
10082
|
+
* Replaces the older driver-local `deviceCache.has*` blob: the per-device
|
|
10083
|
+
* config is for operator-edited overrides + UI snapshots; runtime probe
|
|
10084
|
+
* results belong in runtime-state where the kernel handles persistence,
|
|
10085
|
+
* cross-process mirroring, and reactive updates.
|
|
9962
10086
|
*/
|
|
9963
|
-
var
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
10087
|
+
var FeatureProbeStatusSchema = object({
|
|
10088
|
+
/**
|
|
10089
|
+
* Driver-specific flag bag. Each driver picks its own key names — the
|
|
10090
|
+
* cap deliberately does NOT enforce a closed enum here. Reolink keys:
|
|
10091
|
+
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
10092
|
+
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
10093
|
+
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
10094
|
+
*/
|
|
10095
|
+
flags: record(string(), unknown()),
|
|
10096
|
+
/**
|
|
10097
|
+
* Coarse driver-classification — lets cross-process consumers tell apart
|
|
10098
|
+
* cameras / battery-cams / NVRs without re-running the probe. `null`
|
|
10099
|
+
* before the first probe completes.
|
|
10100
|
+
*/
|
|
10101
|
+
deviceType: string().nullable(),
|
|
10102
|
+
/** Camera/firmware model string. `null` when the firmware doesn't expose it. */
|
|
10103
|
+
model: string().nullable(),
|
|
10104
|
+
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
10105
|
+
channelCount: number().nullable(),
|
|
10106
|
+
/**
|
|
10107
|
+
* Ms epoch of the last SUCCESSFUL probe. `0` before the first probe
|
|
10108
|
+
* completes — drivers' `getAccessoryChildren()` should treat zero as
|
|
10109
|
+
* "probe not done yet, return empty" so accessories aren't spawned
|
|
10110
|
+
* before the firmware is queried.
|
|
10111
|
+
*/
|
|
10112
|
+
lastProbedAt: number(),
|
|
10113
|
+
/**
|
|
10114
|
+
* Framework convention: every runtime-state slice carries this for the
|
|
10115
|
+
* createRuntimeStateBridge stale-check helper. We keep it in sync with
|
|
10116
|
+
* `lastProbedAt` on every write.
|
|
10117
|
+
*/
|
|
10118
|
+
lastFetchedAt: number()
|
|
9967
10119
|
});
|
|
9968
|
-
var
|
|
9969
|
-
name: "
|
|
10120
|
+
var featureProbeCapability = {
|
|
10121
|
+
name: "feature-probe",
|
|
9970
10122
|
scope: "device",
|
|
9971
10123
|
deviceNative: true,
|
|
9972
10124
|
mode: "singleton",
|
|
9973
|
-
deviceTypes: [DeviceType.Sensor],
|
|
9974
10125
|
methods: {},
|
|
10126
|
+
events: {
|
|
10127
|
+
/** Fires whenever a fresh probe completes (kernel-driven `reprobe()`
|
|
10128
|
+
* or driver-initiated re-detect after a state change). */
|
|
10129
|
+
onProbeChanged: { data: object({
|
|
10130
|
+
deviceId: number(),
|
|
10131
|
+
status: FeatureProbeStatusSchema
|
|
10132
|
+
}) } },
|
|
9975
10133
|
status: {
|
|
9976
|
-
schema:
|
|
10134
|
+
schema: FeatureProbeStatusSchema,
|
|
9977
10135
|
kind: "push"
|
|
9978
10136
|
},
|
|
9979
|
-
runtimeState:
|
|
10137
|
+
runtimeState: FeatureProbeStatusSchema
|
|
9980
10138
|
};
|
|
9981
10139
|
/**
|
|
9982
|
-
*
|
|
9983
|
-
*
|
|
9984
|
-
*
|
|
9985
|
-
*
|
|
9986
|
-
*
|
|
9987
|
-
*
|
|
9988
|
-
*
|
|
9989
|
-
* that expose richer controls (color temperature, scenes, schedules)
|
|
9990
|
-
* should surface those via the device's `getSettingsUISchema()`
|
|
9991
|
-
* instead of bloating this cap.
|
|
10140
|
+
* Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
|
|
10141
|
+
* matter at PM2.5 / PM10, and a derived AQI index — all optional so
|
|
10142
|
+
* a single-metric source populates only what it observes. Mirrors
|
|
10143
|
+
* the HA `sensor` device_class set (`co2`, `volatile_organic_compounds`,
|
|
10144
|
+
* `pm25`, `pm10`, `aqi`) collapsed into one cap because a typical
|
|
10145
|
+
* air-quality node reports several of these together; modelling them
|
|
10146
|
+
* as siblings keeps a single timestamp + one slice subscription.
|
|
9992
10147
|
*/
|
|
9993
|
-
var
|
|
9994
|
-
/**
|
|
9995
|
-
|
|
9996
|
-
/**
|
|
9997
|
-
|
|
10148
|
+
var AirQualitySensorStatusSchema = object({
|
|
10149
|
+
/** Carbon dioxide concentration in ppm. */
|
|
10150
|
+
co2Ppm: number().min(0).optional(),
|
|
10151
|
+
/** Total volatile organic compounds in ppb. */
|
|
10152
|
+
vocPpb: number().min(0).optional(),
|
|
10153
|
+
/** Particulate matter ≤ 2.5 μm in µg/m³. */
|
|
10154
|
+
pm25: number().min(0).optional(),
|
|
10155
|
+
/** Particulate matter ≤ 10 μm in µg/m³. */
|
|
10156
|
+
pm10: number().min(0).optional(),
|
|
10157
|
+
/** Composite AQI value (typically 0..500). */
|
|
10158
|
+
aqi: number().optional(),
|
|
10159
|
+
/** Ms epoch when the slice was last updated. */
|
|
10160
|
+
lastFetchedAt: number(),
|
|
10161
|
+
/** Live display unit of the single metric this slice carries (e.g. HA
|
|
10162
|
+
* `attributes.unit_of_measurement` → 'ppm' / 'ppb' / 'µg/m³'). Each
|
|
10163
|
+
* upstream `sensor.*` entity surfaces ONE device_class, so one unit
|
|
10164
|
+
* per slice is unambiguous. */
|
|
10165
|
+
unit: string().optional(),
|
|
10166
|
+
/** Suggested decimal places for numeric display.
|
|
10167
|
+
* Populated live from the upstream source when provided (e.g. HA
|
|
10168
|
+
* `attributes.suggested_display_precision`). Falls back to
|
|
10169
|
+
* auto-formatting when absent. */
|
|
10170
|
+
precision: number().int().min(0).max(10).optional()
|
|
9998
10171
|
});
|
|
9999
|
-
var
|
|
10000
|
-
name: "
|
|
10172
|
+
var airQualitySensorCapability = {
|
|
10173
|
+
name: "air-quality-sensor",
|
|
10001
10174
|
scope: "device",
|
|
10002
10175
|
deviceNative: true,
|
|
10003
10176
|
mode: "singleton",
|
|
10004
|
-
deviceTypes: [DeviceType.
|
|
10005
|
-
methods: {
|
|
10006
|
-
deviceId: number().int().nonnegative(),
|
|
10007
|
-
percentage: number().min(0).max(100)
|
|
10008
|
-
}), _void(), {
|
|
10009
|
-
kind: "mutation",
|
|
10010
|
-
auth: "admin"
|
|
10011
|
-
}) },
|
|
10012
|
-
events: {
|
|
10013
|
-
/**
|
|
10014
|
-
* Emitted whenever the brightness changes — operator action OR
|
|
10015
|
-
* firmware push. Subscribers (UI sliders, automation engines) react
|
|
10016
|
-
* without polling.
|
|
10017
|
-
*/
|
|
10018
|
-
onBrightnessChanged: { data: object({
|
|
10019
|
-
deviceId: number(),
|
|
10020
|
-
percentage: number().min(0).max(100),
|
|
10021
|
-
lastChangedAt: number()
|
|
10022
|
-
}) } },
|
|
10177
|
+
deviceTypes: [DeviceType.Sensor],
|
|
10178
|
+
methods: {},
|
|
10023
10179
|
status: {
|
|
10024
|
-
schema:
|
|
10025
|
-
kind: "
|
|
10180
|
+
schema: AirQualitySensorStatusSchema,
|
|
10181
|
+
kind: "push"
|
|
10026
10182
|
},
|
|
10027
|
-
|
|
10028
|
-
* Runtime-state slice — the last applied brightness level, mirrored
|
|
10029
|
-
* by the kernel. Read via `device.state.brightness.value` so UI
|
|
10030
|
-
* sliders surface the current level without polling the provider.
|
|
10031
|
-
*/
|
|
10032
|
-
runtimeState: BrightnessStatusSchema
|
|
10183
|
+
runtimeState: AirQualitySensorStatusSchema
|
|
10033
10184
|
};
|
|
10034
|
-
/**
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10185
|
+
/**
|
|
10186
|
+
* Alarm-panel cap. Models HA `alarm_control_panel.*` on
|
|
10187
|
+
* `DeviceType.AlarmPanel`. State follows HA's canonical lifecycle
|
|
10188
|
+
* across disarmed / armed_(home|away|night|vacation|custom_bypass) /
|
|
10189
|
+
* arming / pending / triggered / disarming.
|
|
10190
|
+
*
|
|
10191
|
+
* Many panels require a PIN code on arm / disarm — the optional
|
|
10192
|
+
* `code` field on the methods passes it through to the upstream
|
|
10193
|
+
* service; it's NEVER persisted in the runtime slice or any event
|
|
10194
|
+
* payload. The presence of a required code is signalled by
|
|
10195
|
+
* `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
|
|
10196
|
+
* field without a slice fetch.
|
|
10197
|
+
*
|
|
10198
|
+
* `availableModes` mirrors HA's `supported_features`-derived arm
|
|
10199
|
+
* mode list — the UI renders only the buttons the panel accepts.
|
|
10200
|
+
*/
|
|
10201
|
+
var AlarmStateSchema = _enum([
|
|
10202
|
+
"disarmed",
|
|
10203
|
+
"armed_home",
|
|
10204
|
+
"armed_away",
|
|
10205
|
+
"armed_night",
|
|
10206
|
+
"armed_vacation",
|
|
10207
|
+
"armed_custom_bypass",
|
|
10208
|
+
"arming",
|
|
10209
|
+
"disarming",
|
|
10210
|
+
"pending",
|
|
10211
|
+
"triggered"
|
|
10212
|
+
]);
|
|
10213
|
+
var AlarmArmModeSchema = _enum([
|
|
10214
|
+
"home",
|
|
10215
|
+
"away",
|
|
10216
|
+
"night",
|
|
10217
|
+
"vacation",
|
|
10218
|
+
"custom_bypass"
|
|
10219
|
+
]);
|
|
10220
|
+
var AlarmPanelStatusSchema = object({
|
|
10221
|
+
/** Current lifecycle state. */
|
|
10222
|
+
state: AlarmStateSchema,
|
|
10223
|
+
/** Subset of arm modes the panel accepts. UI renders one button per
|
|
10224
|
+
* mode in this list. */
|
|
10225
|
+
availableModes: array(AlarmArmModeSchema),
|
|
10226
|
+
/** Whether the panel requires a PIN on arm / disarm. Mirrors
|
|
10227
|
+
* `DeviceFeature.AlarmPinRequired` for slice consumers. */
|
|
10228
|
+
requiresCode: boolean(),
|
|
10229
|
+
/** Ms epoch when the slice was last updated. */
|
|
10230
|
+
lastChangedAt: number()
|
|
10231
|
+
});
|
|
10232
|
+
var alarmPanelCapability = {
|
|
10233
|
+
name: "alarm-panel",
|
|
10234
|
+
scope: "device",
|
|
10235
|
+
deviceNative: true,
|
|
10236
|
+
mode: "singleton",
|
|
10237
|
+
deviceTypes: [DeviceType.AlarmPanel],
|
|
10238
|
+
methods: {
|
|
10239
|
+
arm: method(object({
|
|
10240
|
+
deviceId: number().int().nonnegative(),
|
|
10241
|
+
mode: AlarmArmModeSchema,
|
|
10242
|
+
/** Optional PIN code. Required when `requiresCode === true`.
|
|
10243
|
+
* Passed through to the upstream service; never persisted. */
|
|
10244
|
+
code: string().min(1).optional()
|
|
10245
|
+
}), _void(), {
|
|
10246
|
+
kind: "mutation",
|
|
10247
|
+
auth: "admin"
|
|
10248
|
+
}),
|
|
10249
|
+
disarm: method(object({
|
|
10250
|
+
deviceId: number().int().nonnegative(),
|
|
10251
|
+
code: string().min(1).optional()
|
|
10252
|
+
}), _void(), {
|
|
10253
|
+
kind: "mutation",
|
|
10254
|
+
auth: "admin"
|
|
10255
|
+
}),
|
|
10256
|
+
/**
|
|
10257
|
+
* Force the panel into the `triggered` state — used by HA
|
|
10258
|
+
* automations to surface external sensor events through the panel
|
|
10259
|
+
* (e.g. a Reolink camera intrusion event firing the security
|
|
10260
|
+
* system). Provider rejects when the panel hardware doesn't
|
|
10261
|
+
* support a software-initiated trigger.
|
|
10262
|
+
*/
|
|
10263
|
+
trigger: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
10264
|
+
kind: "mutation",
|
|
10265
|
+
auth: "admin"
|
|
10266
|
+
})
|
|
10267
|
+
},
|
|
10268
|
+
status: {
|
|
10269
|
+
schema: AlarmPanelStatusSchema,
|
|
10270
|
+
kind: "push"
|
|
10271
|
+
},
|
|
10272
|
+
/**
|
|
10273
|
+
* Runtime-state slice — mirrored by the kernel. UI panel reads the
|
|
10274
|
+
* full slice; renders an arm button per `availableModes` entry and
|
|
10275
|
+
* a PIN field iff `requiresCode === true`.
|
|
10276
|
+
*/
|
|
10277
|
+
runtimeState: AlarmPanelStatusSchema
|
|
10278
|
+
};
|
|
10279
|
+
/**
|
|
10280
|
+
* Ambient illuminance reading in lux. Drives Home Assistant `sensor`
|
|
10281
|
+
* entries with `device_class: illuminance`.
|
|
10282
|
+
*/
|
|
10283
|
+
var AmbientLightSensorStatusSchema = object({
|
|
10284
|
+
/** Current illuminance in lux (lx). */
|
|
10285
|
+
lux: number().min(0),
|
|
10286
|
+
/** Ms epoch when the slice was last updated. */
|
|
10287
|
+
lastFetchedAt: number(),
|
|
10288
|
+
/** Live display unit from the upstream source (e.g. HA
|
|
10289
|
+
* `attributes.unit_of_measurement`). The UI prefers this over the
|
|
10290
|
+
* role's canonical unit. Absent → fall back to the canonical unit. */
|
|
10291
|
+
unit: string().optional(),
|
|
10292
|
+
/** Suggested decimal places for numeric display.
|
|
10293
|
+
* Populated live from the upstream source when provided (e.g. HA
|
|
10294
|
+
* `attributes.suggested_display_precision`). Falls back to
|
|
10295
|
+
* auto-formatting when absent. */
|
|
10296
|
+
precision: number().int().min(0).max(10).optional()
|
|
10297
|
+
});
|
|
10298
|
+
var ambientLightSensorCapability = {
|
|
10299
|
+
name: "ambient-light-sensor",
|
|
10300
|
+
scope: "device",
|
|
10301
|
+
deviceNative: true,
|
|
10302
|
+
mode: "singleton",
|
|
10303
|
+
deviceTypes: [DeviceType.Sensor],
|
|
10304
|
+
methods: {},
|
|
10305
|
+
status: {
|
|
10306
|
+
schema: AmbientLightSensorStatusSchema,
|
|
10307
|
+
kind: "push"
|
|
10308
|
+
},
|
|
10309
|
+
runtimeState: AmbientLightSensorStatusSchema
|
|
10310
|
+
};
|
|
10311
|
+
/**
|
|
10312
|
+
* Per-class audio metrics aggregated over a sliding window.
|
|
10313
|
+
*/
|
|
10314
|
+
var AudioClassSummarySchema = object({
|
|
10315
|
+
className: string(),
|
|
10316
|
+
/** Number of windows (chunks) where this class was the top hit. */
|
|
10317
|
+
hits: number().int().nonnegative(),
|
|
10318
|
+
/** Mean score across those hits, clamped to [0,1]. */
|
|
10319
|
+
avgScore: number().min(0).max(1),
|
|
10320
|
+
/** Peak score in the window. */
|
|
10321
|
+
peakScore: number().min(0).max(1)
|
|
10322
|
+
});
|
|
10323
|
+
/**
|
|
10324
|
+
* Per-camera audio metrics snapshot — emitted by the analytics frame
|
|
10325
|
+
* handler on every `pipeline.audio-inference-result` event and
|
|
10326
|
+
* mirrored into the `audio-metrics` device-state slice. Symmetric
|
|
10327
|
+
* with `zone-analytics` snapshots for video — every consumer
|
|
10328
|
+
* (admin UI panel, automations, alert rules) reads via the
|
|
10329
|
+
* canonical `device.state.audioMetrics.value` reactive handle.
|
|
10330
|
+
*
|
|
10331
|
+
* Aggregates are computed over a rolling `windowSec` window
|
|
10332
|
+
* (default 60s). Past that window, classes drop out of `byClass`
|
|
10333
|
+
* and the level history shifts forward.
|
|
10334
|
+
*/
|
|
10335
|
+
var AudioMetricsSnapshotSchema = object({
|
|
10336
|
+
/** Wall-clock timestamp (ms) of the most recent audio window. */
|
|
10337
|
+
ts: number().int(),
|
|
10338
|
+
/** Sliding-window length (seconds) used for aggregation. */
|
|
10339
|
+
windowSec: number().int().positive(),
|
|
10340
|
+
/** Latest level reading from the most recent window. */
|
|
10341
|
+
level: object({
|
|
10342
|
+
rms: number(),
|
|
10343
|
+
dbfs: number()
|
|
10344
|
+
}),
|
|
10345
|
+
/** Peak dBFS observed across the rolling window. */
|
|
10346
|
+
peakDbfs: number(),
|
|
10347
|
+
/** Mean dBFS across the rolling window. */
|
|
10348
|
+
avgDbfs: number(),
|
|
10349
|
+
/** Most recent above-threshold classification, or null on silence. */
|
|
10350
|
+
current: object({
|
|
10351
|
+
className: string(),
|
|
10352
|
+
score: number().min(0).max(1),
|
|
10353
|
+
timestamp: number().int()
|
|
10354
|
+
}).nullable(),
|
|
10355
|
+
/** Per-class summary across the rolling window — keys are
|
|
10356
|
+
* `macroClass` strings (e.g. `dog_bark`, `speech`, `glass_break`). */
|
|
10357
|
+
byClass: array(AudioClassSummarySchema).readonly()
|
|
10358
|
+
});
|
|
10359
|
+
/**
|
|
10360
|
+
* Audio-metrics history payload — a series of `AudioMetricsHistoryPoint`
|
|
10361
|
+
* samples capped at `maxPoints` (default 1024). When the requested
|
|
10362
|
+
* `windowSec / sampleEveryMs` would exceed the cap, the provider
|
|
10363
|
+
* subsamples by bucketed averaging and reports the effective sample
|
|
10364
|
+
* spacing on `effectiveSampleEveryMs` so the UI can label the x-axis.
|
|
10365
|
+
*/
|
|
10366
|
+
var AudioMetricsHistorySchema = object({
|
|
10367
|
+
points: array(object({
|
|
10368
|
+
/** Wall-clock ms when this sample was recorded. */
|
|
10369
|
+
ts: number().int(),
|
|
10370
|
+
/** Instantaneous dBFS level at sample time. `null` for windows where
|
|
10371
|
+
* the source had no level reading (rare; happens at decode startup). */
|
|
10372
|
+
dbfs: number().nullable(),
|
|
10373
|
+
/** Rolling-window peak dBFS at sample time. Same window the live
|
|
10374
|
+
* snapshot reports. */
|
|
10375
|
+
peakDbfs: number(),
|
|
10376
|
+
/** Rolling-window mean dBFS at sample time. */
|
|
10377
|
+
avgDbfs: number(),
|
|
10378
|
+
/** Dominant above-threshold class at sample time, or null on silence. */
|
|
10379
|
+
topClass: string().nullable(),
|
|
10380
|
+
/** Score of the dominant class (`null` whenever `topClass` is null). */
|
|
10381
|
+
topScore: number().min(0).max(1).nullable()
|
|
10382
|
+
})).readonly(),
|
|
10383
|
+
/** Actual ms between adjacent samples after any subsampling. */
|
|
10384
|
+
effectiveSampleEveryMs: number().int().positive(),
|
|
10385
|
+
/** Wall-clock window covered by `points` (`points[N-1].ts - points[0].ts`),
|
|
10386
|
+
* or `0` when there's fewer than 2 samples. */
|
|
10387
|
+
windowMsActual: number().int().nonnegative()
|
|
10388
|
+
});
|
|
10389
|
+
/**
|
|
10390
|
+
* Audio Metrics capability — sliding-window aggregates over the
|
|
10391
|
+
* pipeline audio inference results. Hosted by `addon-pipeline-analytics`
|
|
10392
|
+
* (same addon that owns `zone-analytics`); the runtime-state slice
|
|
10393
|
+
* gives operators a live read on dB level + dominant classes without
|
|
10394
|
+
* a custom event subscription.
|
|
10395
|
+
*/
|
|
10396
|
+
var audioMetricsCapability = {
|
|
10397
|
+
name: "audio-metrics",
|
|
10398
|
+
scope: "device",
|
|
10399
|
+
mode: "singleton",
|
|
10400
|
+
deviceTypes: [DeviceType.Camera],
|
|
10401
|
+
methods: {
|
|
10402
|
+
/** Latest snapshot for this device. Null until the analytics
|
|
10403
|
+
* pipeline has processed at least one audio window. */
|
|
10404
|
+
getCurrentSnapshot: method(object({ deviceId: number() }), AudioMetricsSnapshotSchema.nullable()),
|
|
10405
|
+
/**
|
|
10406
|
+
* Time-series view of recent audio-metrics samples. The provider
|
|
10407
|
+
* keeps an in-memory ring of ~1Hz samples (matching the slice-
|
|
10408
|
+
* write rate) capped at `MAX_HISTORY_POINTS_KEPT` (provider-side).
|
|
10409
|
+
* `windowSec` selects how far back to read; `sampleEveryMs`
|
|
10410
|
+
* downsamples by bucketed averaging when finer than the kept
|
|
10411
|
+
* granularity. Empty `points` array on freshly-booted providers
|
|
10412
|
+
* with no audio yet — same convention as `getCurrentSnapshot`.
|
|
10413
|
+
*/
|
|
10414
|
+
getHistory: method(object({
|
|
10415
|
+
deviceId: number(),
|
|
10416
|
+
/** History window in seconds. Default 300 (5 minutes).
|
|
10417
|
+
* Provider clamps to its retention cap if larger. */
|
|
10418
|
+
windowSec: number().int().positive().optional(),
|
|
10419
|
+
/** Target sample interval in ms. Default 1000 (1 sample/second).
|
|
10420
|
+
* Provider clamps to natural sample rate if smaller, and
|
|
10421
|
+
* bucket-averages when bigger than the requested window
|
|
10422
|
+
* would produce more than `maxPoints` samples. */
|
|
10423
|
+
sampleEveryMs: number().int().positive().optional()
|
|
10424
|
+
}), AudioMetricsHistorySchema)
|
|
10425
|
+
},
|
|
10426
|
+
/** Reactive runtime-state mirror — live `device.state.audioMetrics.value`. */
|
|
10427
|
+
runtimeState: AudioMetricsSnapshotSchema
|
|
10428
|
+
};
|
|
10429
|
+
/**
|
|
10430
|
+
* Automation-control cap. Models HA `automation.*` entities on
|
|
10431
|
+
* `DeviceType.Automation`. An automation is a trigger+condition+
|
|
10432
|
+
* action rule that can be enabled / disabled and manually fired
|
|
10433
|
+
* via the `trigger` method.
|
|
10434
|
+
*
|
|
10435
|
+
* `trigger` accepts an optional `skipCondition` flag — when true,
|
|
10436
|
+
* the automation's action block runs WITHOUT evaluating its
|
|
10437
|
+
* condition block. Pair with `DeviceFeature.AutomationSkipCondition`
|
|
10438
|
+
* to gate the UI checkbox for the manual-trigger dialog.
|
|
10439
|
+
*/
|
|
10440
|
+
var AutomationControlStatusSchema = object({
|
|
10441
|
+
/** Whether the automation is currently enabled. Disabled automations
|
|
10442
|
+
* ignore their trigger block — manual `trigger` still works. */
|
|
10443
|
+
enabled: boolean(),
|
|
10444
|
+
/** Whether the automation is currently executing its action block. */
|
|
10445
|
+
isRunning: boolean(),
|
|
10446
|
+
/** Ms epoch of the last successful run. 0 when never run. */
|
|
10447
|
+
lastTriggeredAt: number(),
|
|
10448
|
+
/** Failure description from the last completed run. Null on success
|
|
10449
|
+
* or when never run. */
|
|
10450
|
+
lastError: string().nullable(),
|
|
10451
|
+
/** Ms epoch when the slice was last updated. */
|
|
10452
|
+
lastChangedAt: number()
|
|
10453
|
+
});
|
|
10454
|
+
var automationControlCapability = {
|
|
10455
|
+
name: "automation-control",
|
|
10456
|
+
scope: "device",
|
|
10457
|
+
deviceNative: true,
|
|
10458
|
+
mode: "singleton",
|
|
10459
|
+
deviceTypes: [DeviceType.Automation],
|
|
10460
|
+
methods: {
|
|
10461
|
+
enable: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
10462
|
+
kind: "mutation",
|
|
10463
|
+
auth: "admin"
|
|
10464
|
+
}),
|
|
10465
|
+
disable: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
10466
|
+
kind: "mutation",
|
|
10467
|
+
auth: "admin"
|
|
10468
|
+
}),
|
|
10469
|
+
trigger: method(object({
|
|
10470
|
+
deviceId: number().int().nonnegative(),
|
|
10471
|
+
/** When true, fires the action block while bypassing the
|
|
10472
|
+
* automation's condition evaluation. Gated by
|
|
10473
|
+
* `DeviceFeature.AutomationSkipCondition`. */
|
|
10474
|
+
skipCondition: boolean().optional()
|
|
10475
|
+
}), _void(), {
|
|
10476
|
+
kind: "mutation",
|
|
10477
|
+
auth: "admin"
|
|
10478
|
+
})
|
|
10479
|
+
},
|
|
10480
|
+
status: {
|
|
10481
|
+
schema: AutomationControlStatusSchema,
|
|
10482
|
+
kind: "push"
|
|
10483
|
+
},
|
|
10484
|
+
/**
|
|
10485
|
+
* Runtime-state slice — mirrored by the kernel. UI automation tile
|
|
10486
|
+
* reads `enabled` (toggle) + `isRunning` (spinner) + `lastError`
|
|
10487
|
+
* (badge) directly.
|
|
10488
|
+
*/
|
|
10489
|
+
runtimeState: AutomationControlStatusSchema
|
|
10490
|
+
};
|
|
10491
|
+
/**
|
|
10492
|
+
* Battery status snapshot. Emitted by providers whose device is
|
|
10493
|
+
* battery-operated (cameras with `DeviceFeature.BatteryOperated`,
|
|
10494
|
+
* future sensor/button accessories). Consumers build their own "low
|
|
10495
|
+
* battery" alerting on top — the cap deliberately does NOT enforce a
|
|
10496
|
+
* threshold.
|
|
10497
|
+
*/
|
|
10498
|
+
var BatteryStatusSchema = object({
|
|
10499
|
+
/** 0..100 inclusive. Firmware-reported. */
|
|
10500
|
+
percentage: number().min(0).max(100),
|
|
10501
|
+
/**
|
|
10502
|
+
* Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
|
|
10503
|
+
* Reolink-specific for the Solar Panel 2 accessory (will become
|
|
10504
|
+
* common on other battery cams). `'none'` means running on battery
|
|
10505
|
+
* alone.
|
|
10506
|
+
*/
|
|
10507
|
+
charging: _enum([
|
|
10508
|
+
"dc",
|
|
10509
|
+
"solar",
|
|
10510
|
+
"none"
|
|
10511
|
+
]),
|
|
10512
|
+
/**
|
|
10513
|
+
* True when the camera firmware has gone into low-power mode. Battery
|
|
10514
|
+
* providers MUST avoid polling during sleep — reading the battery
|
|
10515
|
+
* wakes the camera up and drains charge.
|
|
10516
|
+
*/
|
|
10517
|
+
sleeping: boolean(),
|
|
10518
|
+
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
10519
|
+
lastUpdated: number(),
|
|
10520
|
+
/**
|
|
10521
|
+
* True when the source is a BINARY low-battery indicator (HA
|
|
10522
|
+
* `binary_sensor` device_class=battery / `LOW_BAT`) that has no real
|
|
10523
|
+
* charge level — `percentage` is then a coarse stand-in (100 = normal,
|
|
10524
|
+
* sub-threshold = low). UI MUST render "Normal"/"Low" instead of a
|
|
10525
|
+
* misleading exact percentage. Absent/false → genuine 0–100 % reading.
|
|
10526
|
+
*/
|
|
10527
|
+
binary: boolean().optional()
|
|
10528
|
+
});
|
|
10529
|
+
var batteryCapability = {
|
|
10530
|
+
name: "battery",
|
|
10531
|
+
scope: "device",
|
|
10532
|
+
deviceNative: true,
|
|
10533
|
+
mode: "singleton",
|
|
10534
|
+
deviceTypes: [
|
|
10535
|
+
DeviceType.Camera,
|
|
10536
|
+
DeviceType.Sensor,
|
|
10537
|
+
DeviceType.Button,
|
|
10538
|
+
DeviceType.Switch
|
|
10539
|
+
],
|
|
10540
|
+
methods: {
|
|
10541
|
+
/**
|
|
10542
|
+
* Explicitly wake the camera from low-power sleep ahead of a
|
|
10543
|
+
* streaming session start. Consumers that initiate a stream
|
|
10544
|
+
* against a sleeping battery cam (HomeKit Secure Video, Alexa
|
|
10545
|
+
* RTCSession, snapshot wrappers) call this with a short timeout
|
|
10546
|
+
* before establishing the media pipeline — the broker's own
|
|
10547
|
+
* passive wake-on-dial works but adds 5–7 seconds to first-frame,
|
|
10548
|
+
* during which the consumer renders a black screen. Pre-waking
|
|
10549
|
+
* compresses that gap.
|
|
10550
|
+
*
|
|
10551
|
+
* Returns `awoke: true` when the firmware acknowledged the wake
|
|
10552
|
+
* before `timeoutMs`. Returns `awoke: false` when it timed out OR
|
|
10553
|
+
* the cap surface is unavailable (no Baichuan / firmware
|
|
10554
|
+
* channel); the caller should still attempt the stream — the
|
|
10555
|
+
* passive broker wake remains as fallback.
|
|
10556
|
+
*/
|
|
10557
|
+
wakeForStream: method(object({
|
|
10558
|
+
deviceId: number(),
|
|
10559
|
+
/** Bound on the wait. Sensible range 3000–10000ms. */
|
|
10560
|
+
timeoutMs: number().int().min(500).max(3e4).default(8e3)
|
|
10561
|
+
}), object({
|
|
10562
|
+
awoke: boolean(),
|
|
10563
|
+
durationMs: number()
|
|
10564
|
+
}), { kind: "mutation" }) },
|
|
10565
|
+
events: {
|
|
10566
|
+
/**
|
|
10567
|
+
* Emitted whenever the cached status changes (firmware push OR
|
|
10568
|
+
* poll observes a delta). The DeviceEventPropagator mirrors this
|
|
10569
|
+
* event on the parent chain — subscribing to a camera's source
|
|
10570
|
+
* receives battery events from child accessories automatically.
|
|
10571
|
+
*/
|
|
10572
|
+
onStatusChanged: { data: object({
|
|
10573
|
+
deviceId: number(),
|
|
10574
|
+
status: BatteryStatusSchema
|
|
10575
|
+
}) } },
|
|
10576
|
+
status: {
|
|
10577
|
+
schema: BatteryStatusSchema,
|
|
10578
|
+
kind: "push",
|
|
10579
|
+
empty: {
|
|
10580
|
+
percentage: 0,
|
|
10581
|
+
charging: "none",
|
|
10582
|
+
sleeping: false,
|
|
10583
|
+
lastUpdated: 0
|
|
10584
|
+
}
|
|
10585
|
+
},
|
|
10586
|
+
/**
|
|
10587
|
+
* Runtime-state slice — every provider that registers this cap
|
|
10588
|
+
* stores the same shape under `device.runtimeState[battery]`.
|
|
10589
|
+
* Cross-provider uniformity: a Reolink Argus, a Frigate sensor
|
|
10590
|
+
* proxy, an ONVIF battery cam all read/write the same keys.
|
|
10591
|
+
* Consumers (BatteryBadge, snapshot wrapper sleep gate) read once
|
|
10592
|
+
* via `device.runtimeState.getCapState('battery')` regardless of
|
|
10593
|
+
* the underlying driver.
|
|
10594
|
+
*/
|
|
10595
|
+
runtimeState: BatteryStatusSchema
|
|
10596
|
+
};
|
|
10597
|
+
/**
|
|
10598
|
+
* Generic boolean sensor — last-resort fallback when no domain-
|
|
10599
|
+
* specific binary cap fits (Home Assistant `binary_sensor` without a
|
|
10600
|
+
* known `device_class`, or a domain we haven't typed yet). Pure
|
|
10601
|
+
* pass-through: just the bool + timestamp. Push-driven.
|
|
10602
|
+
*
|
|
10603
|
+
* Prefer the typed alternatives (`contact`, `flood`, `smoke`,
|
|
10604
|
+
* `carbon-monoxide`, `gas`, `tamper`, `vibration`, `connectivity`,
|
|
10605
|
+
* `motion`) when the semantics match — export adapters render those
|
|
10606
|
+
* with the right HomeKit / Alexa display category.
|
|
10607
|
+
*/
|
|
10608
|
+
var BinaryStatusSchema = object({
|
|
10609
|
+
on: boolean(),
|
|
10610
|
+
/** Ms epoch of the last transition. 0 if never observed. */
|
|
10611
|
+
lastChangedAt: number()
|
|
10612
|
+
});
|
|
10613
|
+
var binaryCapability = {
|
|
10614
|
+
name: "binary",
|
|
10615
|
+
scope: "device",
|
|
10616
|
+
deviceNative: true,
|
|
10617
|
+
mode: "singleton",
|
|
10618
|
+
deviceTypes: [DeviceType.Sensor],
|
|
10619
|
+
methods: {},
|
|
10620
|
+
status: {
|
|
10621
|
+
schema: BinaryStatusSchema,
|
|
10622
|
+
kind: "push"
|
|
10623
|
+
},
|
|
10624
|
+
runtimeState: BinaryStatusSchema
|
|
10625
|
+
};
|
|
10626
|
+
/**
|
|
10627
|
+
* Dimmable-light brightness control. Co-exists with `switch` on the
|
|
10628
|
+
* same device — the switch toggles on/off, this cap sets the level
|
|
10629
|
+
* applied when the light is on. Drivers map their per-vendor dim
|
|
10630
|
+
* controls to this single-method surface.
|
|
10631
|
+
*
|
|
10632
|
+
* The cap is intentionally minimal: a single `setBrightness({deviceId,
|
|
10633
|
+
* percentage})` mutation plus the auto-injected `getStatus`. Drivers
|
|
10634
|
+
* that expose richer controls (color temperature, scenes, schedules)
|
|
10635
|
+
* should surface those via the device's `getSettingsUISchema()`
|
|
10636
|
+
* instead of bloating this cap.
|
|
10637
|
+
*/
|
|
10638
|
+
var BrightnessStatusSchema = object({
|
|
10639
|
+
/** Current level as 0..100 inclusive. Firmware-reported. */
|
|
10640
|
+
percentage: number().min(0).max(100),
|
|
10641
|
+
/** Ms epoch of the last operator-driven change. Useful for UI freshness. */
|
|
10642
|
+
lastChangedAt: number()
|
|
10643
|
+
});
|
|
10644
|
+
var brightnessCapability = {
|
|
10645
|
+
name: "brightness",
|
|
10646
|
+
scope: "device",
|
|
10647
|
+
deviceNative: true,
|
|
10648
|
+
mode: "singleton",
|
|
10649
|
+
deviceTypes: [DeviceType.Light],
|
|
10650
|
+
methods: { setBrightness: method(object({
|
|
10651
|
+
deviceId: number().int().nonnegative(),
|
|
10652
|
+
percentage: number().min(0).max(100)
|
|
10653
|
+
}), _void(), {
|
|
10654
|
+
kind: "mutation",
|
|
10655
|
+
auth: "admin"
|
|
10656
|
+
}) },
|
|
10657
|
+
events: {
|
|
10658
|
+
/**
|
|
10659
|
+
* Emitted whenever the brightness changes — operator action OR
|
|
10660
|
+
* firmware push. Subscribers (UI sliders, automation engines) react
|
|
10661
|
+
* without polling.
|
|
10662
|
+
*/
|
|
10663
|
+
onBrightnessChanged: { data: object({
|
|
10664
|
+
deviceId: number(),
|
|
10665
|
+
percentage: number().min(0).max(100),
|
|
10666
|
+
lastChangedAt: number()
|
|
10667
|
+
}) } },
|
|
10668
|
+
status: {
|
|
10669
|
+
schema: BrightnessStatusSchema,
|
|
10670
|
+
kind: "command-driven"
|
|
10671
|
+
},
|
|
10672
|
+
/**
|
|
10673
|
+
* Runtime-state slice — the last applied brightness level, mirrored
|
|
10674
|
+
* by the kernel. Read via `device.state.brightness.value` so UI
|
|
10675
|
+
* sliders surface the current level without polling the provider.
|
|
10676
|
+
*/
|
|
10677
|
+
runtimeState: BrightnessStatusSchema
|
|
10678
|
+
};
|
|
10679
|
+
/** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
|
|
10680
|
+
var StreamFormatSchema = _enum([
|
|
10681
|
+
"webrtc",
|
|
10682
|
+
"hls",
|
|
10683
|
+
"mjpeg",
|
|
10684
|
+
"rtsp"
|
|
10040
10685
|
]);
|
|
10041
10686
|
var RtspRestreamEntrySchema = object({
|
|
10042
10687
|
brokerId: string(),
|
|
@@ -13482,104 +14127,43 @@ var MotionTriggerStatusSchema = object({
|
|
|
13482
14127
|
/**
|
|
13483
14128
|
* Persistent slice mirrored across restarts. The provider writes here
|
|
13484
14129
|
* on every successful firmware fetch / setMotionTrigger push; the cap
|
|
13485
|
-
* router and admin-ui hero read straight from this snapshot via
|
|
13486
|
-
* `device.state.motionTrigger.value` instead of re-issuing a firmware
|
|
13487
|
-
* round-trip on every UI mount. `lastFetchedAt` lets the framework
|
|
13488
|
-
* helper (`createRuntimeStateBridge`) stale-check before deciding
|
|
13489
|
-
* whether to refresh from the camera.
|
|
13490
|
-
*/
|
|
13491
|
-
var MotionTriggerRuntimeStateSchema = MotionTriggerStatusSchema.extend({
|
|
13492
|
-
/** Ms epoch of the last successful camera fetch (0 = never). */
|
|
13493
|
-
lastFetchedAt: number() });
|
|
13494
|
-
var motionTriggerCapability = {
|
|
13495
|
-
name: "motion-trigger",
|
|
13496
|
-
scope: "device",
|
|
13497
|
-
deviceNative: true,
|
|
13498
|
-
mode: "singleton",
|
|
13499
|
-
deviceTypes: [
|
|
13500
|
-
DeviceType.Light,
|
|
13501
|
-
DeviceType.Siren,
|
|
13502
|
-
DeviceType.Switch
|
|
13503
|
-
],
|
|
13504
|
-
methods: { setMotionTrigger: method(object({
|
|
13505
|
-
deviceId: number().int().nonnegative(),
|
|
13506
|
-
enabled: boolean()
|
|
13507
|
-
}), _void(), {
|
|
13508
|
-
kind: "mutation",
|
|
13509
|
-
auth: "admin"
|
|
13510
|
-
}) },
|
|
13511
|
-
events: { onMotionTriggerChanged: { data: object({
|
|
13512
|
-
deviceId: number(),
|
|
13513
|
-
enabled: boolean(),
|
|
13514
|
-
lastChangedAt: number()
|
|
13515
|
-
}) } },
|
|
13516
|
-
status: {
|
|
13517
|
-
schema: MotionTriggerStatusSchema,
|
|
13518
|
-
kind: "command-driven"
|
|
13519
|
-
},
|
|
13520
|
-
runtimeState: MotionTriggerRuntimeStateSchema
|
|
13521
|
-
};
|
|
13522
|
-
/**
|
|
13523
|
-
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
13524
|
-
* motion-zones, and the detection zones/lines editor all speak this one
|
|
13525
|
-
* language so a single drawing-plane editor and the providers stay
|
|
13526
|
-
* decoupled from each cap's storage.
|
|
13527
|
-
*
|
|
13528
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
13529
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
13530
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
13531
|
-
*/
|
|
13532
|
-
/** A normalized 0..1 point (top-left origin). */
|
|
13533
|
-
var MaskPointSchema = object({
|
|
13534
|
-
x: number(),
|
|
13535
|
-
y: number()
|
|
13536
|
-
});
|
|
13537
|
-
/** Axis-aligned rectangle (normalized 0..1). */
|
|
13538
|
-
var MaskRectShapeSchema = object({
|
|
13539
|
-
kind: literal("rect"),
|
|
13540
|
-
x: number(),
|
|
13541
|
-
y: number(),
|
|
13542
|
-
width: number(),
|
|
13543
|
-
height: number()
|
|
13544
|
-
});
|
|
13545
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
13546
|
-
var MaskPolygonShapeSchema = object({
|
|
13547
|
-
kind: literal("polygon"),
|
|
13548
|
-
points: array(MaskPointSchema)
|
|
13549
|
-
});
|
|
13550
|
-
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
13551
|
-
var MaskGridShapeSchema = object({
|
|
13552
|
-
kind: literal("grid"),
|
|
13553
|
-
gridWidth: number(),
|
|
13554
|
-
gridHeight: number(),
|
|
13555
|
-
cells: array(boolean())
|
|
13556
|
-
});
|
|
13557
|
-
discriminatedUnion("kind", [
|
|
13558
|
-
MaskRectShapeSchema,
|
|
13559
|
-
MaskPolygonShapeSchema,
|
|
13560
|
-
MaskGridShapeSchema,
|
|
13561
|
-
object({
|
|
13562
|
-
kind: literal("line"),
|
|
13563
|
-
points: array(MaskPointSchema)
|
|
13564
|
-
})
|
|
13565
|
-
]);
|
|
13566
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
13567
|
-
var MaskShapeKindSchema = _enum([
|
|
13568
|
-
"rect",
|
|
13569
|
-
"polygon",
|
|
13570
|
-
"grid",
|
|
13571
|
-
"line"
|
|
13572
|
-
]);
|
|
13573
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
13574
|
-
var MaskPolygonVerticesSchema = object({
|
|
13575
|
-
min: number(),
|
|
13576
|
-
max: number()
|
|
13577
|
-
});
|
|
13578
|
-
/** Grid dimensions when a cap supports 'grid'. */
|
|
13579
|
-
var MaskGridDimsSchema = object({
|
|
13580
|
-
width: number(),
|
|
13581
|
-
height: number()
|
|
13582
|
-
});
|
|
14130
|
+
* router and admin-ui hero read straight from this snapshot via
|
|
14131
|
+
* `device.state.motionTrigger.value` instead of re-issuing a firmware
|
|
14132
|
+
* round-trip on every UI mount. `lastFetchedAt` lets the framework
|
|
14133
|
+
* helper (`createRuntimeStateBridge`) stale-check before deciding
|
|
14134
|
+
* whether to refresh from the camera.
|
|
14135
|
+
*/
|
|
14136
|
+
var MotionTriggerRuntimeStateSchema = MotionTriggerStatusSchema.extend({
|
|
14137
|
+
/** Ms epoch of the last successful camera fetch (0 = never). */
|
|
14138
|
+
lastFetchedAt: number() });
|
|
14139
|
+
var motionTriggerCapability = {
|
|
14140
|
+
name: "motion-trigger",
|
|
14141
|
+
scope: "device",
|
|
14142
|
+
deviceNative: true,
|
|
14143
|
+
mode: "singleton",
|
|
14144
|
+
deviceTypes: [
|
|
14145
|
+
DeviceType.Light,
|
|
14146
|
+
DeviceType.Siren,
|
|
14147
|
+
DeviceType.Switch
|
|
14148
|
+
],
|
|
14149
|
+
methods: { setMotionTrigger: method(object({
|
|
14150
|
+
deviceId: number().int().nonnegative(),
|
|
14151
|
+
enabled: boolean()
|
|
14152
|
+
}), _void(), {
|
|
14153
|
+
kind: "mutation",
|
|
14154
|
+
auth: "admin"
|
|
14155
|
+
}) },
|
|
14156
|
+
events: { onMotionTriggerChanged: { data: object({
|
|
14157
|
+
deviceId: number(),
|
|
14158
|
+
enabled: boolean(),
|
|
14159
|
+
lastChangedAt: number()
|
|
14160
|
+
}) } },
|
|
14161
|
+
status: {
|
|
14162
|
+
schema: MotionTriggerStatusSchema,
|
|
14163
|
+
kind: "command-driven"
|
|
14164
|
+
},
|
|
14165
|
+
runtimeState: MotionTriggerRuntimeStateSchema
|
|
14166
|
+
};
|
|
13583
14167
|
/**
|
|
13584
14168
|
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
13585
14169
|
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
@@ -17017,6 +17601,55 @@ method(object({
|
|
|
17017
17601
|
password: string()
|
|
17018
17602
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
17019
17603
|
/**
|
|
17604
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
17605
|
+
* NOT flow through the capability — they use the addon data plane
|
|
17606
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
17607
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
17608
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
17609
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
17610
|
+
*/
|
|
17611
|
+
var TerminalSessionInfoSchema = object({
|
|
17612
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
17613
|
+
sessionId: string(),
|
|
17614
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
17615
|
+
profileId: string(),
|
|
17616
|
+
/** Human-readable profile label for the UI session list. */
|
|
17617
|
+
label: string(),
|
|
17618
|
+
cols: number().int().positive(),
|
|
17619
|
+
rows: number().int().positive(),
|
|
17620
|
+
/** ms-epoch the session's pty was spawned. */
|
|
17621
|
+
startedAt: number()
|
|
17622
|
+
});
|
|
17623
|
+
/**
|
|
17624
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
17625
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
17626
|
+
* command string would be remote code execution as the server's user, so it is
|
|
17627
|
+
* deliberately not part of the contract.
|
|
17628
|
+
*/
|
|
17629
|
+
var TerminalProfileInfoSchema = object({
|
|
17630
|
+
profileId: string(),
|
|
17631
|
+
label: string(),
|
|
17632
|
+
description: string().optional()
|
|
17633
|
+
});
|
|
17634
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
17635
|
+
profileId: string(),
|
|
17636
|
+
cols: number().int().positive(),
|
|
17637
|
+
rows: number().int().positive()
|
|
17638
|
+
}), TerminalSessionInfoSchema, {
|
|
17639
|
+
kind: "mutation",
|
|
17640
|
+
auth: "admin"
|
|
17641
|
+
}), method(object({
|
|
17642
|
+
sessionId: string(),
|
|
17643
|
+
cols: number().int().positive(),
|
|
17644
|
+
rows: number().int().positive()
|
|
17645
|
+
}), _void(), {
|
|
17646
|
+
kind: "mutation",
|
|
17647
|
+
auth: "admin"
|
|
17648
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
17649
|
+
kind: "mutation",
|
|
17650
|
+
auth: "admin"
|
|
17651
|
+
});
|
|
17652
|
+
/**
|
|
17020
17653
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
17021
17654
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
17022
17655
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -17117,11 +17750,53 @@ var LocationStatSchema = object({
|
|
|
17117
17750
|
fileCount: number(),
|
|
17118
17751
|
present: boolean()
|
|
17119
17752
|
});
|
|
17753
|
+
/**
|
|
17754
|
+
* A backup schedule — the N:M "entry" that binds one cron cadence to a
|
|
17755
|
+
* SET of destination locations. Supersedes the per-location cron on
|
|
17756
|
+
* `BackupDestinationPolicy`: an operator creates a schedule, picks the
|
|
17757
|
+
* `backups` locations it should write to, and the orchestrator fans a
|
|
17758
|
+
* single archive out to all of them when the cron fires.
|
|
17759
|
+
*
|
|
17760
|
+
* `retentionCount` is per-schedule (D-decision 2026-07-28): every
|
|
17761
|
+
* location targeted by this schedule keeps this many archives from
|
|
17762
|
+
* this schedule's runs.
|
|
17763
|
+
*
|
|
17764
|
+
* `dataSources` optionally narrows which top-level state locations
|
|
17765
|
+
* (db, addons, tls, …) are archived; omitted = the orchestrator's
|
|
17766
|
+
* default full set.
|
|
17767
|
+
*/
|
|
17768
|
+
var BackupScheduleSchema = object({
|
|
17769
|
+
/** Stable id. Generated by the orchestrator on first upsert if absent. */
|
|
17770
|
+
id: string(),
|
|
17771
|
+
/** Operator-facing display name. */
|
|
17772
|
+
label: string(),
|
|
17773
|
+
/** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
|
|
17774
|
+
cron: string(),
|
|
17775
|
+
/** Master on/off toggle for the whole schedule. */
|
|
17776
|
+
enabled: boolean(),
|
|
17777
|
+
/** `backups`-location ids this schedule writes to (fan-out set). */
|
|
17778
|
+
locationIds: array(string()).readonly(),
|
|
17779
|
+
/** Archives kept per targeted location for this schedule. */
|
|
17780
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
17781
|
+
/** Optional subset of source locations to include; omitted = all. */
|
|
17782
|
+
dataSources: array(string()).readonly().optional(),
|
|
17783
|
+
/** ms-epoch of last successful run. */
|
|
17784
|
+
lastRunAt: number().optional(),
|
|
17785
|
+
/** ms-epoch of next computed firing (read-only, filled on list). */
|
|
17786
|
+
nextRunAt: number().optional()
|
|
17787
|
+
});
|
|
17120
17788
|
method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
17121
17789
|
/** Subset of registered `backup-destination` addon ids to write to. */
|
|
17122
17790
|
destinations: array(string()).optional(),
|
|
17123
17791
|
locations: array(string()).optional(),
|
|
17124
|
-
label: string().optional()
|
|
17792
|
+
label: string().optional(),
|
|
17793
|
+
/**
|
|
17794
|
+
* Per-run retention override applied to every targeted
|
|
17795
|
+
* destination. Used by schedule-driven runs (per-entry
|
|
17796
|
+
* retention). Omitted = each destination's own policy
|
|
17797
|
+
* retention (manual runs).
|
|
17798
|
+
*/
|
|
17799
|
+
retentionCount: number().int().min(1).max(1e3).optional()
|
|
17125
17800
|
}).optional(), array(BackupEntrySchema).readonly(), {
|
|
17126
17801
|
kind: "mutation",
|
|
17127
17802
|
auth: "admin"
|
|
@@ -17170,7 +17845,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
17170
17845
|
ok: boolean(),
|
|
17171
17846
|
error: string().optional(),
|
|
17172
17847
|
nextRuns: array(number()).readonly()
|
|
17173
|
-
}))
|
|
17848
|
+
})), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
|
|
17849
|
+
id: string().optional(),
|
|
17850
|
+
label: string(),
|
|
17851
|
+
cron: string(),
|
|
17852
|
+
enabled: boolean(),
|
|
17853
|
+
locationIds: array(string()).readonly(),
|
|
17854
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
17855
|
+
dataSources: array(string()).readonly().optional()
|
|
17856
|
+
}), BackupScheduleSchema, {
|
|
17857
|
+
kind: "mutation",
|
|
17858
|
+
auth: "admin"
|
|
17859
|
+
}), method(object({ id: string() }), _void(), {
|
|
17860
|
+
kind: "mutation",
|
|
17861
|
+
auth: "admin"
|
|
17862
|
+
});
|
|
17174
17863
|
/**
|
|
17175
17864
|
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
17176
17865
|
*
|
|
@@ -18198,1596 +18887,1108 @@ method(object({
|
|
|
18198
18887
|
active: boolean()
|
|
18199
18888
|
}), _void(), {
|
|
18200
18889
|
kind: "mutation",
|
|
18201
|
-
auth: "admin"
|
|
18202
|
-
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
18203
|
-
capName: string(),
|
|
18204
|
-
wrappers: array(string())
|
|
18205
|
-
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
18206
|
-
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
18207
|
-
live: SettingsSchemaWithValuesSchema.nullable()
|
|
18208
|
-
})), method(object({
|
|
18209
|
-
deviceId: number().int().nonnegative(),
|
|
18210
|
-
action: string().min(1),
|
|
18211
|
-
input: unknown()
|
|
18212
|
-
}), unknown(), { kind: "mutation" }), method(object({
|
|
18213
|
-
deviceId: number(),
|
|
18214
|
-
writerCapName: string(),
|
|
18215
|
-
writerAddonId: string(),
|
|
18216
|
-
key: string(),
|
|
18217
|
-
value: unknown()
|
|
18218
|
-
}), object({ success: literal(true) }), {
|
|
18219
|
-
kind: "mutation",
|
|
18220
|
-
auth: "admin"
|
|
18221
|
-
}), method(object({
|
|
18222
|
-
deviceId: number(),
|
|
18223
|
-
changes: array(object({
|
|
18224
|
-
writerCapName: string(),
|
|
18225
|
-
writerAddonId: string(),
|
|
18226
|
-
key: string(),
|
|
18227
|
-
value: unknown()
|
|
18228
|
-
}))
|
|
18229
|
-
}), object({
|
|
18230
|
-
success: literal(true),
|
|
18231
|
-
failures: array(object({
|
|
18232
|
-
writerCapName: string(),
|
|
18233
|
-
writerAddonId: string(),
|
|
18234
|
-
error: string()
|
|
18235
|
-
}))
|
|
18236
|
-
}), {
|
|
18237
|
-
kind: "mutation",
|
|
18238
|
-
auth: "admin"
|
|
18239
|
-
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
18240
|
-
kind: "mutation",
|
|
18241
|
-
auth: "admin"
|
|
18242
|
-
}), method(object({
|
|
18243
|
-
addonId: string(),
|
|
18244
|
-
candidate: DiscoveryCandidateSchema,
|
|
18245
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
18246
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
18247
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
18248
|
-
integrationId: string().optional()
|
|
18249
|
-
}), DeviceSummarySchema, {
|
|
18250
|
-
kind: "mutation",
|
|
18251
|
-
auth: "admin"
|
|
18252
|
-
}), method(object({
|
|
18253
|
-
addonId: string(),
|
|
18254
|
-
type: _enum(DeviceType)
|
|
18255
|
-
}), unknown().nullable()), method(object({
|
|
18256
|
-
addonId: string(),
|
|
18257
|
-
type: _enum(DeviceType),
|
|
18258
|
-
config: record(string(), unknown()),
|
|
18259
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
18260
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
18261
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
18262
|
-
integrationId: string().optional()
|
|
18263
|
-
}), DeviceSummarySchema, {
|
|
18264
|
-
kind: "mutation",
|
|
18265
|
-
auth: "admin"
|
|
18266
|
-
}), method(object({
|
|
18267
|
-
addonId: string(),
|
|
18268
|
-
type: _enum(DeviceType),
|
|
18269
|
-
key: string(),
|
|
18270
|
-
value: unknown(),
|
|
18271
|
-
formValues: record(string(), unknown()).optional()
|
|
18272
|
-
}), FieldProbeResultSchema, {
|
|
18273
|
-
kind: "mutation",
|
|
18274
|
-
auth: "admin"
|
|
18275
|
-
}), method(object({
|
|
18276
|
-
addonId: string(),
|
|
18277
|
-
integrationId: string()
|
|
18278
|
-
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
18279
|
-
addonId: string(),
|
|
18280
|
-
integrationId: string()
|
|
18281
|
-
}), AdoptionStatusSchema, {
|
|
18282
|
-
kind: "mutation",
|
|
18283
|
-
auth: "admin"
|
|
18284
|
-
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
18285
|
-
kind: "mutation",
|
|
18286
|
-
auth: "admin"
|
|
18287
|
-
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
18288
|
-
kind: "mutation",
|
|
18289
|
-
auth: "admin"
|
|
18290
|
-
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
18291
|
-
kind: "mutation",
|
|
18292
|
-
auth: "admin"
|
|
18293
|
-
}), method(object({}), object({ providers: array(object({
|
|
18294
|
-
addonId: string(),
|
|
18295
|
-
label: string()
|
|
18296
|
-
})).readonly() }), { auth: "admin" }), method(object({}), object({ groups: array(object({
|
|
18297
|
-
addonId: string(),
|
|
18298
|
-
label: string(),
|
|
18299
|
-
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
18300
|
-
error: string().nullable()
|
|
18301
|
-
})).readonly() }), {
|
|
18302
|
-
kind: "mutation",
|
|
18303
|
-
auth: "admin"
|
|
18304
|
-
}), method(object({
|
|
18305
|
-
addonId: string(),
|
|
18306
|
-
params: record(string(), unknown()).optional()
|
|
18307
|
-
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
18308
|
-
kind: "mutation",
|
|
18309
|
-
auth: "admin"
|
|
18310
|
-
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
18311
|
-
deviceId: number(),
|
|
18312
|
-
key: string(),
|
|
18313
|
-
value: unknown()
|
|
18314
|
-
}), FieldProbeResultSchema, {
|
|
18315
|
-
kind: "mutation",
|
|
18316
|
-
auth: "admin"
|
|
18317
|
-
}), method(object({
|
|
18318
|
-
deviceId: number(),
|
|
18319
|
-
caps: array(string()).readonly().optional()
|
|
18320
|
-
}), record(string(), unknown().nullable()));
|
|
18321
|
-
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
18322
|
-
deviceId: number(),
|
|
18323
|
-
capName: string()
|
|
18324
|
-
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
18325
|
-
deviceId: number(),
|
|
18326
|
-
capName: string(),
|
|
18327
|
-
slice: record(string(), unknown())
|
|
18328
|
-
}), _void(), { kind: "mutation" }), object({
|
|
18329
|
-
deviceId: number(),
|
|
18330
|
-
capName: string(),
|
|
18331
|
-
slice: record(string(), unknown())
|
|
18332
|
-
});
|
|
18333
|
-
/**
|
|
18334
|
-
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
18335
|
-
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
18336
|
-
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
18337
|
-
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
18338
|
-
* post-analysis enrichment-engine.
|
|
18339
|
-
*/
|
|
18340
|
-
var EmbeddingResultSchema = object({
|
|
18341
|
-
embedding: array(number()),
|
|
18342
|
-
inferenceMs: number()
|
|
18343
|
-
});
|
|
18344
|
-
var EmbeddingInfoSchema = object({
|
|
18345
|
-
modelId: string(),
|
|
18346
|
-
embeddingDim: number(),
|
|
18347
|
-
ready: boolean()
|
|
18348
|
-
});
|
|
18349
|
-
method(object({
|
|
18350
|
-
crop: _instanceof(Uint8Array),
|
|
18351
|
-
width: number(),
|
|
18352
|
-
height: number()
|
|
18353
|
-
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
18354
|
-
/**
|
|
18355
|
-
* filesystem-browse — per-node capability for browsing the node's local
|
|
18356
|
-
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
18357
|
-
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
18358
|
-
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
18359
|
-
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
18360
|
-
*/
|
|
18361
|
-
var DirEntrySchema = object({
|
|
18362
|
-
name: string(),
|
|
18363
|
-
path: string()
|
|
18364
|
-
});
|
|
18365
|
-
var BrowseResultSchema = object({
|
|
18366
|
-
path: string(),
|
|
18367
|
-
entries: array(DirEntrySchema).readonly(),
|
|
18368
|
-
freeBytes: number(),
|
|
18369
|
-
totalBytes: number()
|
|
18370
|
-
});
|
|
18371
|
-
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
18890
|
+
auth: "admin"
|
|
18891
|
+
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
18892
|
+
capName: string(),
|
|
18893
|
+
wrappers: array(string())
|
|
18894
|
+
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
18895
|
+
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
18896
|
+
live: SettingsSchemaWithValuesSchema.nullable()
|
|
18897
|
+
})), method(object({
|
|
18898
|
+
deviceId: number().int().nonnegative(),
|
|
18899
|
+
action: string().min(1),
|
|
18900
|
+
input: unknown()
|
|
18901
|
+
}), unknown(), { kind: "mutation" }), method(object({
|
|
18902
|
+
deviceId: number(),
|
|
18903
|
+
writerCapName: string(),
|
|
18904
|
+
writerAddonId: string(),
|
|
18905
|
+
key: string(),
|
|
18906
|
+
value: unknown()
|
|
18907
|
+
}), object({ success: literal(true) }), {
|
|
18372
18908
|
kind: "mutation",
|
|
18373
18909
|
auth: "admin"
|
|
18374
|
-
})
|
|
18375
|
-
|
|
18376
|
-
|
|
18377
|
-
|
|
18378
|
-
|
|
18379
|
-
|
|
18380
|
-
|
|
18381
|
-
|
|
18382
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
18383
|
-
*/
|
|
18384
|
-
var LlmUsageSchema = object({
|
|
18385
|
-
inputTokens: number(),
|
|
18386
|
-
outputTokens: number()
|
|
18387
|
-
});
|
|
18388
|
-
var LlmErrorCodeSchema = _enum([
|
|
18389
|
-
"timeout",
|
|
18390
|
-
"rate-limited",
|
|
18391
|
-
"auth",
|
|
18392
|
-
"refusal",
|
|
18393
|
-
"bad-request",
|
|
18394
|
-
"unavailable",
|
|
18395
|
-
"no-profile",
|
|
18396
|
-
"budget-exceeded",
|
|
18397
|
-
"adapter-error"
|
|
18398
|
-
]);
|
|
18399
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
18400
|
-
ok: literal(true),
|
|
18401
|
-
text: string(),
|
|
18402
|
-
model: string(),
|
|
18403
|
-
usage: LlmUsageSchema,
|
|
18404
|
-
truncated: boolean(),
|
|
18405
|
-
latencyMs: number()
|
|
18910
|
+
}), method(object({
|
|
18911
|
+
deviceId: number(),
|
|
18912
|
+
changes: array(object({
|
|
18913
|
+
writerCapName: string(),
|
|
18914
|
+
writerAddonId: string(),
|
|
18915
|
+
key: string(),
|
|
18916
|
+
value: unknown()
|
|
18917
|
+
}))
|
|
18406
18918
|
}), object({
|
|
18407
|
-
|
|
18408
|
-
|
|
18409
|
-
|
|
18410
|
-
|
|
18411
|
-
|
|
18412
|
-
|
|
18413
|
-
|
|
18414
|
-
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
18415
|
-
* notification-output.cap.ts:27-31 precedents).
|
|
18416
|
-
*/
|
|
18417
|
-
var LlmImageSchema = object({
|
|
18418
|
-
bytes: _instanceof(Uint8Array),
|
|
18419
|
-
mimeType: string()
|
|
18420
|
-
});
|
|
18421
|
-
var LlmGenerateBaseInputSchema = object({
|
|
18422
|
-
/** Collection routing (the notification-output posture). */
|
|
18423
|
-
addonId: string().optional(),
|
|
18424
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
18425
|
-
profileId: string().optional(),
|
|
18426
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
18427
|
-
consumer: string(),
|
|
18428
|
-
system: string().optional(),
|
|
18429
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
18430
|
-
prompt: string(),
|
|
18431
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
18432
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
18433
|
-
/** Per-call override of the profile default. */
|
|
18434
|
-
maxTokens: number().int().positive().optional(),
|
|
18435
|
-
temperature: number().optional()
|
|
18436
|
-
});
|
|
18437
|
-
/**
|
|
18438
|
-
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
18439
|
-
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
18440
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
18441
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
18442
|
-
* this only through the `llm` cap's methods.
|
|
18443
|
-
*
|
|
18444
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
18445
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
18446
|
-
* watchdog — operator decision #3).
|
|
18447
|
-
*/
|
|
18448
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
18449
|
-
object({
|
|
18450
|
-
kind: literal("catalog"),
|
|
18451
|
-
catalogId: string()
|
|
18452
|
-
}),
|
|
18453
|
-
object({
|
|
18454
|
-
kind: literal("url"),
|
|
18455
|
-
url: string(),
|
|
18456
|
-
sha256: string().optional()
|
|
18457
|
-
}),
|
|
18458
|
-
object({
|
|
18459
|
-
kind: literal("path"),
|
|
18460
|
-
path: string()
|
|
18461
|
-
})
|
|
18462
|
-
]);
|
|
18463
|
-
var ManagedRuntimeConfigSchema = object({
|
|
18464
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
18465
|
-
nodeId: string(),
|
|
18466
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
18467
|
-
engine: _enum(["llama-cpp"]),
|
|
18468
|
-
model: ManagedModelRefSchema,
|
|
18469
|
-
contextSize: number().int().default(4096),
|
|
18470
|
-
/** 0 = CPU-only. */
|
|
18471
|
-
gpuLayers: number().int().default(0),
|
|
18472
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
18473
|
-
threads: number().int().optional(),
|
|
18474
|
-
/** Concurrent slots. */
|
|
18475
|
-
parallel: number().int().default(1),
|
|
18476
|
-
/** Else lazy: first generate boots it. */
|
|
18477
|
-
autoStart: boolean().default(false),
|
|
18478
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
18479
|
-
idleStopMinutes: number().int().default(30)
|
|
18480
|
-
});
|
|
18481
|
-
var LlmRuntimeStatusSchema = object({
|
|
18482
|
-
/** Status is ALWAYS node-qualified. */
|
|
18483
|
-
nodeId: string(),
|
|
18484
|
-
state: _enum([
|
|
18485
|
-
"stopped",
|
|
18486
|
-
"downloading",
|
|
18487
|
-
"starting",
|
|
18488
|
-
"ready",
|
|
18489
|
-
"crashed",
|
|
18490
|
-
"failed"
|
|
18491
|
-
]),
|
|
18492
|
-
pid: number().optional(),
|
|
18493
|
-
port: number().optional(),
|
|
18494
|
-
modelPath: string().optional(),
|
|
18495
|
-
modelId: string().optional(),
|
|
18496
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
18497
|
-
lastError: string().optional(),
|
|
18498
|
-
crashesInWindow: number(),
|
|
18499
|
-
/** Child RSS (sampled best-effort). */
|
|
18500
|
-
memoryBytes: number().optional(),
|
|
18501
|
-
vramBytes: number().optional()
|
|
18502
|
-
});
|
|
18503
|
-
var LlmNodeModelSchema = object({
|
|
18504
|
-
file: string(),
|
|
18505
|
-
sizeBytes: number(),
|
|
18506
|
-
catalogId: string().optional(),
|
|
18507
|
-
installedAt: number().optional()
|
|
18508
|
-
});
|
|
18509
|
-
var LlmRuntimeDiskUsageSchema = object({
|
|
18510
|
-
nodeId: string(),
|
|
18511
|
-
modelsBytes: number(),
|
|
18512
|
-
freeBytes: number().optional()
|
|
18513
|
-
});
|
|
18514
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
18515
|
-
images: array(LlmImageSchema).optional(),
|
|
18516
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
18517
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
18518
|
-
timeoutMs: number().int().positive().optional()
|
|
18519
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
18919
|
+
success: literal(true),
|
|
18920
|
+
failures: array(object({
|
|
18921
|
+
writerCapName: string(),
|
|
18922
|
+
writerAddonId: string(),
|
|
18923
|
+
error: string()
|
|
18924
|
+
}))
|
|
18925
|
+
}), {
|
|
18520
18926
|
kind: "mutation",
|
|
18521
18927
|
auth: "admin"
|
|
18522
|
-
}), method(object({}),
|
|
18928
|
+
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
18523
18929
|
kind: "mutation",
|
|
18524
18930
|
auth: "admin"
|
|
18525
|
-
}), method(object({
|
|
18931
|
+
}), method(object({
|
|
18932
|
+
addonId: string(),
|
|
18933
|
+
candidate: DiscoveryCandidateSchema,
|
|
18934
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
18935
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
18936
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
18937
|
+
integrationId: string().optional()
|
|
18938
|
+
}), DeviceSummarySchema, {
|
|
18526
18939
|
kind: "mutation",
|
|
18527
18940
|
auth: "admin"
|
|
18528
|
-
}), method(object({
|
|
18941
|
+
}), method(object({
|
|
18942
|
+
addonId: string(),
|
|
18943
|
+
type: _enum(DeviceType)
|
|
18944
|
+
}), unknown().nullable()), method(object({
|
|
18945
|
+
addonId: string(),
|
|
18946
|
+
type: _enum(DeviceType),
|
|
18947
|
+
config: record(string(), unknown()),
|
|
18948
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
18949
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
18950
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
18951
|
+
integrationId: string().optional()
|
|
18952
|
+
}), DeviceSummarySchema, {
|
|
18529
18953
|
kind: "mutation",
|
|
18530
18954
|
auth: "admin"
|
|
18531
|
-
}), method(object({
|
|
18532
|
-
/**
|
|
18533
|
-
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
18534
|
-
* methods concat-fan across providers; single-row methods route to ONE
|
|
18535
|
-
* provider by the `addonId` in the call input (the notification-output
|
|
18536
|
-
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
18537
|
-
* (hub-placed); the cap stays open for future providers.
|
|
18538
|
-
*
|
|
18539
|
-
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
18540
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
18541
|
-
* write; a stored key NEVER round-trips to a client.
|
|
18542
|
-
*/
|
|
18543
|
-
var LlmProfileKindSchema = _enum([
|
|
18544
|
-
"openai-compatible",
|
|
18545
|
-
"openai",
|
|
18546
|
-
"anthropic",
|
|
18547
|
-
"google",
|
|
18548
|
-
"managed-local"
|
|
18549
|
-
]);
|
|
18550
|
-
var LlmProfileSchema = object({
|
|
18551
|
-
id: string(),
|
|
18552
|
-
name: string(),
|
|
18553
|
-
kind: LlmProfileKindSchema,
|
|
18554
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
18955
|
+
}), method(object({
|
|
18555
18956
|
addonId: string(),
|
|
18556
|
-
|
|
18557
|
-
|
|
18558
|
-
|
|
18559
|
-
|
|
18560
|
-
|
|
18561
|
-
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
temperature: number().min(0).max(2).optional(),
|
|
18565
|
-
maxTokens: number().int().positive().optional(),
|
|
18566
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
18567
|
-
extraHeaders: record(string(), string()).optional(),
|
|
18568
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
18569
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
18570
|
-
});
|
|
18571
|
-
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
18572
|
-
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
18573
|
-
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
18574
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
18575
|
-
var LlmProfileKindDescriptorSchema = object({
|
|
18576
|
-
kind: LlmProfileKindSchema,
|
|
18577
|
-
label: string(),
|
|
18578
|
-
icon: string(),
|
|
18579
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
18957
|
+
type: _enum(DeviceType),
|
|
18958
|
+
key: string(),
|
|
18959
|
+
value: unknown(),
|
|
18960
|
+
formValues: record(string(), unknown()).optional()
|
|
18961
|
+
}), FieldProbeResultSchema, {
|
|
18962
|
+
kind: "mutation",
|
|
18963
|
+
auth: "admin"
|
|
18964
|
+
}), method(object({
|
|
18580
18965
|
addonId: string(),
|
|
18581
|
-
|
|
18582
|
-
})
|
|
18583
|
-
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
18584
|
-
var LlmDefaultSchema = object({
|
|
18585
|
-
selector: LlmDefaultSelectorSchema,
|
|
18586
|
-
profileId: string()
|
|
18587
|
-
});
|
|
18588
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
18589
|
-
var LlmUsageRollupSchema = object({
|
|
18590
|
-
day: string(),
|
|
18591
|
-
consumer: string(),
|
|
18592
|
-
profileId: string(),
|
|
18593
|
-
calls: number(),
|
|
18594
|
-
okCalls: number(),
|
|
18595
|
-
errorCalls: number(),
|
|
18596
|
-
inputTokens: number(),
|
|
18597
|
-
outputTokens: number(),
|
|
18598
|
-
avgLatencyMs: number()
|
|
18599
|
-
});
|
|
18600
|
-
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
18601
|
-
var ManagedModelCatalogEntrySchema = object({
|
|
18602
|
-
id: string(),
|
|
18603
|
-
label: string(),
|
|
18604
|
-
family: string(),
|
|
18605
|
-
purpose: _enum(["text", "vision"]),
|
|
18606
|
-
url: string(),
|
|
18607
|
-
sha256: string(),
|
|
18608
|
-
sizeBytes: number(),
|
|
18609
|
-
quantization: string(),
|
|
18610
|
-
/** Load-time guidance shown in the picker. */
|
|
18611
|
-
minRamBytes: number(),
|
|
18612
|
-
contextSizeDefault: number().int(),
|
|
18613
|
-
/** Vision models: companion projector file. */
|
|
18614
|
-
mmprojUrl: string().optional()
|
|
18615
|
-
});
|
|
18616
|
-
var LlmRuntimeNodeSchema = object({
|
|
18617
|
-
nodeId: string(),
|
|
18618
|
-
reachable: boolean(),
|
|
18619
|
-
status: LlmRuntimeStatusSchema.optional(),
|
|
18620
|
-
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
18621
|
-
error: string().optional()
|
|
18622
|
-
});
|
|
18623
|
-
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
18624
|
-
var ProfileRefInputSchema = object({
|
|
18966
|
+
integrationId: string()
|
|
18967
|
+
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
18625
18968
|
addonId: string(),
|
|
18626
|
-
|
|
18627
|
-
})
|
|
18628
|
-
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
18969
|
+
integrationId: string()
|
|
18970
|
+
}), AdoptionStatusSchema, {
|
|
18629
18971
|
kind: "mutation",
|
|
18630
18972
|
auth: "admin"
|
|
18631
|
-
}), method(
|
|
18973
|
+
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
18632
18974
|
kind: "mutation",
|
|
18633
18975
|
auth: "admin"
|
|
18634
|
-
}), method(
|
|
18976
|
+
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
18635
18977
|
kind: "mutation",
|
|
18636
18978
|
auth: "admin"
|
|
18637
|
-
}), method(
|
|
18638
|
-
selector: LlmDefaultSelectorSchema,
|
|
18639
|
-
profileId: string().nullable()
|
|
18640
|
-
}), _void(), {
|
|
18979
|
+
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
18641
18980
|
kind: "mutation",
|
|
18642
18981
|
auth: "admin"
|
|
18643
|
-
}), method(object({
|
|
18644
|
-
|
|
18645
|
-
|
|
18646
|
-
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
|
|
18651
|
-
})
|
|
18982
|
+
}), method(object({}), object({ providers: array(object({
|
|
18983
|
+
addonId: string(),
|
|
18984
|
+
label: string()
|
|
18985
|
+
})).readonly() }), { auth: "admin" }), method(object({}), object({ groups: array(object({
|
|
18986
|
+
addonId: string(),
|
|
18987
|
+
label: string(),
|
|
18988
|
+
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
18989
|
+
error: string().nullable()
|
|
18990
|
+
})).readonly() }), {
|
|
18652
18991
|
kind: "mutation",
|
|
18653
18992
|
auth: "admin"
|
|
18654
18993
|
}), method(object({
|
|
18655
|
-
|
|
18656
|
-
|
|
18657
|
-
}),
|
|
18994
|
+
addonId: string(),
|
|
18995
|
+
params: record(string(), unknown()).optional()
|
|
18996
|
+
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
18658
18997
|
kind: "mutation",
|
|
18659
18998
|
auth: "admin"
|
|
18660
|
-
}), method(
|
|
18999
|
+
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
19000
|
+
deviceId: number(),
|
|
19001
|
+
key: string(),
|
|
19002
|
+
value: unknown()
|
|
19003
|
+
}), FieldProbeResultSchema, {
|
|
18661
19004
|
kind: "mutation",
|
|
18662
19005
|
auth: "admin"
|
|
18663
|
-
}), method(
|
|
19006
|
+
}), method(object({
|
|
19007
|
+
deviceId: number(),
|
|
19008
|
+
caps: array(string()).readonly().optional()
|
|
19009
|
+
}), record(string(), unknown().nullable()));
|
|
19010
|
+
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
19011
|
+
deviceId: number(),
|
|
19012
|
+
capName: string()
|
|
19013
|
+
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
19014
|
+
deviceId: number(),
|
|
19015
|
+
capName: string(),
|
|
19016
|
+
slice: record(string(), unknown())
|
|
19017
|
+
}), _void(), { kind: "mutation" }), object({
|
|
19018
|
+
deviceId: number(),
|
|
19019
|
+
capName: string(),
|
|
19020
|
+
slice: record(string(), unknown())
|
|
19021
|
+
});
|
|
19022
|
+
/**
|
|
19023
|
+
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
19024
|
+
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
19025
|
+
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
19026
|
+
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
19027
|
+
* post-analysis enrichment-engine.
|
|
19028
|
+
*/
|
|
19029
|
+
var EmbeddingResultSchema = object({
|
|
19030
|
+
embedding: array(number()),
|
|
19031
|
+
inferenceMs: number()
|
|
19032
|
+
});
|
|
19033
|
+
var EmbeddingInfoSchema = object({
|
|
19034
|
+
modelId: string(),
|
|
19035
|
+
embeddingDim: number(),
|
|
19036
|
+
ready: boolean()
|
|
19037
|
+
});
|
|
19038
|
+
method(object({
|
|
19039
|
+
crop: _instanceof(Uint8Array),
|
|
19040
|
+
width: number(),
|
|
19041
|
+
height: number()
|
|
19042
|
+
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
19043
|
+
/**
|
|
19044
|
+
* filesystem-browse — per-node capability for browsing the node's local
|
|
19045
|
+
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
19046
|
+
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
19047
|
+
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
19048
|
+
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
19049
|
+
*/
|
|
19050
|
+
var DirEntrySchema = object({
|
|
19051
|
+
name: string(),
|
|
19052
|
+
path: string()
|
|
19053
|
+
});
|
|
19054
|
+
var BrowseResultSchema = object({
|
|
19055
|
+
path: string(),
|
|
19056
|
+
entries: array(DirEntrySchema).readonly(),
|
|
19057
|
+
freeBytes: number(),
|
|
19058
|
+
totalBytes: number()
|
|
19059
|
+
});
|
|
19060
|
+
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
18664
19061
|
kind: "mutation",
|
|
18665
19062
|
auth: "admin"
|
|
18666
19063
|
});
|
|
18667
|
-
|
|
18668
|
-
|
|
18669
|
-
|
|
18670
|
-
|
|
18671
|
-
|
|
19064
|
+
/**
|
|
19065
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
19066
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
19067
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
19068
|
+
*
|
|
19069
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
19070
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
19071
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
19072
|
+
*/
|
|
19073
|
+
var LlmUsageSchema = object({
|
|
19074
|
+
inputTokens: number(),
|
|
19075
|
+
outputTokens: number()
|
|
19076
|
+
});
|
|
19077
|
+
var LlmErrorCodeSchema = _enum([
|
|
19078
|
+
"timeout",
|
|
19079
|
+
"rate-limited",
|
|
19080
|
+
"auth",
|
|
19081
|
+
"refusal",
|
|
19082
|
+
"bad-request",
|
|
19083
|
+
"unavailable",
|
|
19084
|
+
"no-profile",
|
|
19085
|
+
"budget-exceeded",
|
|
19086
|
+
"adapter-error"
|
|
18672
19087
|
]);
|
|
18673
|
-
var
|
|
18674
|
-
|
|
18675
|
-
|
|
18676
|
-
|
|
19088
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
19089
|
+
ok: literal(true),
|
|
19090
|
+
text: string(),
|
|
19091
|
+
model: string(),
|
|
19092
|
+
usage: LlmUsageSchema,
|
|
19093
|
+
truncated: boolean(),
|
|
19094
|
+
latencyMs: number()
|
|
19095
|
+
}), object({
|
|
19096
|
+
ok: literal(false),
|
|
19097
|
+
code: LlmErrorCodeSchema,
|
|
18677
19098
|
message: string(),
|
|
18678
|
-
|
|
18679
|
-
|
|
18680
|
-
});
|
|
18681
|
-
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
18682
|
-
scope: array(string()).optional(),
|
|
18683
|
-
level: LogLevelSchema.optional(),
|
|
18684
|
-
since: date().optional(),
|
|
18685
|
-
until: date().optional(),
|
|
18686
|
-
limit: number().optional(),
|
|
18687
|
-
tags: record(string(), string()).optional()
|
|
18688
|
-
}), array(LogEntrySchema).readonly());
|
|
19099
|
+
retryAfterMs: number().optional()
|
|
19100
|
+
})]);
|
|
18689
19101
|
/**
|
|
18690
|
-
* `
|
|
18691
|
-
*
|
|
18692
|
-
*
|
|
18693
|
-
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
|
|
18700
|
-
|
|
18701
|
-
|
|
18702
|
-
|
|
18703
|
-
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
|
|
18707
|
-
|
|
18708
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
|
|
18713
|
-
|
|
18714
|
-
|
|
18715
|
-
*
|
|
18716
|
-
*
|
|
18717
|
-
*
|
|
18718
|
-
*
|
|
18719
|
-
*
|
|
18720
|
-
* Every contribution carries a `stage`:
|
|
18721
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
18722
|
-
* magic-link buttons; a future usernameless passkey).
|
|
18723
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18724
|
-
* returned `factors` (passkey-as-2FA today).
|
|
19102
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
19103
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
19104
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
19105
|
+
*/
|
|
19106
|
+
var LlmImageSchema = object({
|
|
19107
|
+
bytes: _instanceof(Uint8Array),
|
|
19108
|
+
mimeType: string()
|
|
19109
|
+
});
|
|
19110
|
+
var LlmGenerateBaseInputSchema = object({
|
|
19111
|
+
/** Collection routing (the notification-output posture). */
|
|
19112
|
+
addonId: string().optional(),
|
|
19113
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
19114
|
+
profileId: string().optional(),
|
|
19115
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
19116
|
+
consumer: string(),
|
|
19117
|
+
system: string().optional(),
|
|
19118
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
19119
|
+
prompt: string(),
|
|
19120
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
19121
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
19122
|
+
/** Per-call override of the profile default. */
|
|
19123
|
+
maxTokens: number().int().positive().optional(),
|
|
19124
|
+
temperature: number().optional()
|
|
19125
|
+
});
|
|
19126
|
+
/**
|
|
19127
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
19128
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
19129
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
19130
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
19131
|
+
* this only through the `llm` cap's methods.
|
|
18725
19132
|
*
|
|
18726
|
-
*
|
|
18727
|
-
*
|
|
18728
|
-
*
|
|
19133
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
19134
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
19135
|
+
* watchdog — operator decision #3).
|
|
18729
19136
|
*/
|
|
18730
|
-
|
|
18731
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
18732
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
18733
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
19137
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
18734
19138
|
object({
|
|
18735
|
-
kind: literal("
|
|
18736
|
-
|
|
18737
|
-
id: string(),
|
|
18738
|
-
/** Operator-facing button label. */
|
|
18739
|
-
label: string(),
|
|
18740
|
-
/** lucide-react icon name. */
|
|
18741
|
-
icon: string().optional(),
|
|
18742
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
18743
|
-
startUrl: string(),
|
|
18744
|
-
stage: LoginStageEnum
|
|
19139
|
+
kind: literal("catalog"),
|
|
19140
|
+
catalogId: string()
|
|
18745
19141
|
}),
|
|
18746
19142
|
object({
|
|
18747
|
-
kind: literal("
|
|
18748
|
-
|
|
18749
|
-
|
|
18750
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
18751
|
-
addonId: string(),
|
|
18752
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
18753
|
-
bundle: string(),
|
|
18754
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
18755
|
-
remote: WidgetRemoteSchema,
|
|
18756
|
-
stage: LoginStageEnum
|
|
19143
|
+
kind: literal("url"),
|
|
19144
|
+
url: string(),
|
|
19145
|
+
sha256: string().optional()
|
|
18757
19146
|
}),
|
|
18758
19147
|
object({
|
|
18759
|
-
kind: literal("
|
|
18760
|
-
|
|
18761
|
-
id: string(),
|
|
18762
|
-
/** Operator-facing button label. */
|
|
18763
|
-
label: string(),
|
|
18764
|
-
stage: LoginStageEnum,
|
|
18765
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
18766
|
-
rpId: string(),
|
|
18767
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
18768
|
-
origin: string().nullable()
|
|
19148
|
+
kind: literal("path"),
|
|
19149
|
+
path: string()
|
|
18769
19150
|
})
|
|
18770
19151
|
]);
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18780
|
-
|
|
18781
|
-
|
|
18782
|
-
|
|
18783
|
-
|
|
18784
|
-
|
|
18785
|
-
|
|
18786
|
-
|
|
18787
|
-
|
|
18788
|
-
usedBytes: number(),
|
|
18789
|
-
availableBytes: number(),
|
|
18790
|
-
swapUsedBytes: number(),
|
|
18791
|
-
swapTotalBytes: number()
|
|
18792
|
-
});
|
|
18793
|
-
var DiskIoSnapshotSchema = object({
|
|
18794
|
-
readBytes: number(),
|
|
18795
|
-
writeBytes: number(),
|
|
18796
|
-
readOps: number(),
|
|
18797
|
-
writeOps: number(),
|
|
18798
|
-
timestampMs: number()
|
|
18799
|
-
});
|
|
18800
|
-
var NetworkIoSnapshotSchema = object({
|
|
18801
|
-
rxBytes: number(),
|
|
18802
|
-
txBytes: number(),
|
|
18803
|
-
rxPackets: number(),
|
|
18804
|
-
txPackets: number(),
|
|
18805
|
-
rxErrors: number(),
|
|
18806
|
-
txErrors: number(),
|
|
18807
|
-
timestampMs: number()
|
|
18808
|
-
});
|
|
18809
|
-
var MetricsGpuInfoSchema = object({
|
|
18810
|
-
utilization: number(),
|
|
18811
|
-
model: string(),
|
|
18812
|
-
memoryUsedBytes: number(),
|
|
18813
|
-
memoryTotalBytes: number(),
|
|
18814
|
-
temperature: number().nullable()
|
|
18815
|
-
});
|
|
18816
|
-
var ProcessResourceInfoSchema = object({
|
|
18817
|
-
openFds: number(),
|
|
18818
|
-
threadCount: number(),
|
|
18819
|
-
activeHandles: number(),
|
|
18820
|
-
activeRequests: number()
|
|
18821
|
-
});
|
|
18822
|
-
var PressureAvgsSchema = object({
|
|
18823
|
-
avg10: number(),
|
|
18824
|
-
avg60: number(),
|
|
18825
|
-
avg300: number()
|
|
18826
|
-
});
|
|
18827
|
-
var PressureInfoSchema = object({
|
|
18828
|
-
some: PressureAvgsSchema,
|
|
18829
|
-
full: PressureAvgsSchema.nullable()
|
|
18830
|
-
});
|
|
18831
|
-
var SystemResourceSnapshotSchema = object({
|
|
18832
|
-
cpu: CpuBreakdownSchema,
|
|
18833
|
-
memory: MemoryInfoSchema,
|
|
18834
|
-
gpu: MetricsGpuInfoSchema.nullable(),
|
|
18835
|
-
network: NetworkIoSnapshotSchema,
|
|
18836
|
-
disk: DiskIoSnapshotSchema,
|
|
18837
|
-
pressure: object({
|
|
18838
|
-
cpu: PressureInfoSchema.nullable(),
|
|
18839
|
-
memory: PressureInfoSchema.nullable(),
|
|
18840
|
-
io: PressureInfoSchema.nullable()
|
|
18841
|
-
}),
|
|
18842
|
-
process: ProcessResourceInfoSchema,
|
|
18843
|
-
cpuTemperature: number().nullable(),
|
|
18844
|
-
timestampMs: number()
|
|
18845
|
-
});
|
|
18846
|
-
var DiskSpaceInfoSchema = object({
|
|
18847
|
-
path: string(),
|
|
18848
|
-
totalBytes: number(),
|
|
18849
|
-
usedBytes: number(),
|
|
18850
|
-
availableBytes: number(),
|
|
18851
|
-
percent: number()
|
|
18852
|
-
});
|
|
18853
|
-
var PidResourceStatsSchema = object({
|
|
18854
|
-
pid: number(),
|
|
18855
|
-
cpu: number(),
|
|
18856
|
-
memory: number(),
|
|
18857
|
-
/**
|
|
18858
|
-
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
18859
|
-
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
18860
|
-
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
18861
|
-
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
18862
|
-
* Undefined where /proc is unavailable (e.g. macOS).
|
|
18863
|
-
*/
|
|
18864
|
-
privateBytes: number().optional(),
|
|
18865
|
-
/**
|
|
18866
|
-
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
18867
|
-
* code shared copy-on-write across runners. Undefined on macOS.
|
|
18868
|
-
*/
|
|
18869
|
-
sharedBytes: number().optional()
|
|
19152
|
+
var ManagedRuntimeConfigSchema = object({
|
|
19153
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
19154
|
+
nodeId: string(),
|
|
19155
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
19156
|
+
engine: _enum(["llama-cpp"]),
|
|
19157
|
+
model: ManagedModelRefSchema,
|
|
19158
|
+
contextSize: number().int().default(4096),
|
|
19159
|
+
/** 0 = CPU-only. */
|
|
19160
|
+
gpuLayers: number().int().default(0),
|
|
19161
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
19162
|
+
threads: number().int().optional(),
|
|
19163
|
+
/** Concurrent slots. */
|
|
19164
|
+
parallel: number().int().default(1),
|
|
19165
|
+
/** Else lazy: first generate boots it. */
|
|
19166
|
+
autoStart: boolean().default(false),
|
|
19167
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
19168
|
+
idleStopMinutes: number().int().default(30)
|
|
18870
19169
|
});
|
|
18871
|
-
var
|
|
18872
|
-
|
|
19170
|
+
var LlmRuntimeStatusSchema = object({
|
|
19171
|
+
/** Status is ALWAYS node-qualified. */
|
|
18873
19172
|
nodeId: string(),
|
|
18874
|
-
role: _enum(["hub", "worker"]),
|
|
18875
|
-
pid: number(),
|
|
18876
19173
|
state: _enum([
|
|
18877
|
-
"starting",
|
|
18878
|
-
"running",
|
|
18879
|
-
"stopping",
|
|
18880
19174
|
"stopped",
|
|
18881
|
-
"
|
|
18882
|
-
|
|
18883
|
-
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
pid: number(),
|
|
18887
|
-
ppid: number(),
|
|
18888
|
-
pgid: number(),
|
|
18889
|
-
classification: _enum([
|
|
18890
|
-
"root",
|
|
18891
|
-
"managed",
|
|
18892
|
-
"system",
|
|
18893
|
-
"ghost"
|
|
19175
|
+
"downloading",
|
|
19176
|
+
"starting",
|
|
19177
|
+
"ready",
|
|
19178
|
+
"crashed",
|
|
19179
|
+
"failed"
|
|
18894
19180
|
]),
|
|
18895
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
18896
|
-
addonId: string().nullable(),
|
|
18897
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
18898
|
-
nodeId: string().nullable(),
|
|
18899
|
-
/** Truncated command line. */
|
|
18900
|
-
command: string(),
|
|
18901
|
-
cpuPercent: number(),
|
|
18902
|
-
memoryRssBytes: number(),
|
|
18903
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
18904
|
-
uptimeSec: number(),
|
|
18905
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
18906
|
-
orphaned: boolean()
|
|
18907
|
-
});
|
|
18908
|
-
var KillProcessInputSchema = object({
|
|
18909
|
-
pid: number(),
|
|
18910
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
18911
|
-
force: boolean().optional()
|
|
18912
|
-
});
|
|
18913
|
-
var KillProcessResultSchema = object({
|
|
18914
|
-
success: boolean(),
|
|
18915
|
-
reason: string().optional(),
|
|
18916
|
-
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
18917
|
-
});
|
|
18918
|
-
var DumpHeapSnapshotInputSchema = object({
|
|
18919
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
18920
|
-
addonId: string() });
|
|
18921
|
-
var DumpHeapSnapshotResultSchema = object({
|
|
18922
|
-
success: boolean(),
|
|
18923
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
18924
|
-
path: string().optional(),
|
|
18925
|
-
/** Process pid that was signalled. */
|
|
18926
19181
|
pid: number().optional(),
|
|
18927
|
-
|
|
19182
|
+
port: number().optional(),
|
|
19183
|
+
modelPath: string().optional(),
|
|
19184
|
+
modelId: string().optional(),
|
|
19185
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
19186
|
+
lastError: string().optional(),
|
|
19187
|
+
crashesInWindow: number(),
|
|
19188
|
+
/** Child RSS (sampled best-effort). */
|
|
19189
|
+
memoryBytes: number().optional(),
|
|
19190
|
+
vramBytes: number().optional()
|
|
18928
19191
|
});
|
|
18929
|
-
var
|
|
18930
|
-
|
|
18931
|
-
|
|
18932
|
-
|
|
18933
|
-
|
|
18934
|
-
diskPercent: number().optional(),
|
|
18935
|
-
temperature: number().optional(),
|
|
18936
|
-
gpuPercent: number().optional(),
|
|
18937
|
-
gpuMemoryPercent: number().optional()
|
|
19192
|
+
var LlmNodeModelSchema = object({
|
|
19193
|
+
file: string(),
|
|
19194
|
+
sizeBytes: number(),
|
|
19195
|
+
catalogId: string().optional(),
|
|
19196
|
+
installedAt: number().optional()
|
|
18938
19197
|
});
|
|
18939
|
-
|
|
19198
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
19199
|
+
nodeId: string(),
|
|
19200
|
+
modelsBytes: number(),
|
|
19201
|
+
freeBytes: number().optional()
|
|
19202
|
+
});
|
|
19203
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
19204
|
+
images: array(LlmImageSchema).optional(),
|
|
19205
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
19206
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
19207
|
+
timeoutMs: number().int().positive().optional()
|
|
19208
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
18940
19209
|
kind: "mutation",
|
|
18941
19210
|
auth: "admin"
|
|
18942
|
-
}), method(
|
|
19211
|
+
}), method(object({}), _void(), {
|
|
18943
19212
|
kind: "mutation",
|
|
18944
19213
|
auth: "admin"
|
|
18945
|
-
})
|
|
18946
|
-
method(object({
|
|
18947
|
-
sourceUrl: string(),
|
|
18948
|
-
metadata: ModelConvertMetadataSchema,
|
|
18949
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
18950
|
-
calibrationRef: string().optional(),
|
|
18951
|
-
sessionId: string().optional()
|
|
18952
|
-
}), ConvertResultSchema, {
|
|
19214
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
18953
19215
|
kind: "mutation",
|
|
18954
|
-
auth: "admin"
|
|
18955
|
-
|
|
18956
|
-
});
|
|
18957
|
-
method(object({
|
|
18958
|
-
nodeId: string(),
|
|
18959
|
-
modelId: string(),
|
|
18960
|
-
format: _enum(MODEL_FORMATS),
|
|
18961
|
-
entry: ModelCatalogEntrySchema
|
|
18962
|
-
}), object({
|
|
18963
|
-
ok: boolean(),
|
|
18964
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
18965
|
-
sha256: string(),
|
|
18966
|
-
bytes: number(),
|
|
18967
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
18968
|
-
path: string()
|
|
18969
|
-
}), {
|
|
19216
|
+
auth: "admin"
|
|
19217
|
+
}), method(object({ file: string() }), _void(), {
|
|
18970
19218
|
kind: "mutation",
|
|
18971
19219
|
auth: "admin"
|
|
18972
|
-
});
|
|
18973
|
-
/**
|
|
18974
|
-
* `mqtt-broker` — broker-registry cap.
|
|
18975
|
-
*
|
|
18976
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
18977
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
18978
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
18979
|
-
* its OWN `mqtt.js` client.
|
|
18980
|
-
*
|
|
18981
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
18982
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
18983
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
18984
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
18985
|
-
* features anyway — give it the connection config, get out of the way.
|
|
18986
|
-
*
|
|
18987
|
-
* Consumer flow:
|
|
18988
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
18989
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
18990
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
18991
|
-
*
|
|
18992
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
18993
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
18994
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
18995
|
-
* spawned it.
|
|
18996
|
-
*/
|
|
18997
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
19220
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
18998
19221
|
/**
|
|
18999
|
-
*
|
|
19222
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
19223
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
19224
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
19225
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
19226
|
+
* (hub-placed); the cap stays open for future providers.
|
|
19000
19227
|
*
|
|
19001
|
-
*
|
|
19002
|
-
*
|
|
19003
|
-
*
|
|
19004
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
19005
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
19228
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
19229
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
19230
|
+
* write; a stored key NEVER round-trips to a client.
|
|
19006
19231
|
*/
|
|
19007
|
-
var
|
|
19008
|
-
"
|
|
19009
|
-
"
|
|
19010
|
-
"
|
|
19011
|
-
"
|
|
19012
|
-
"
|
|
19232
|
+
var LlmProfileKindSchema = _enum([
|
|
19233
|
+
"openai-compatible",
|
|
19234
|
+
"openai",
|
|
19235
|
+
"anthropic",
|
|
19236
|
+
"google",
|
|
19237
|
+
"managed-local"
|
|
19013
19238
|
]);
|
|
19014
|
-
var
|
|
19239
|
+
var LlmProfileSchema = object({
|
|
19015
19240
|
id: string(),
|
|
19016
19241
|
name: string(),
|
|
19017
|
-
|
|
19018
|
-
|
|
19019
|
-
|
|
19020
|
-
|
|
19021
|
-
|
|
19022
|
-
|
|
19023
|
-
|
|
19024
|
-
|
|
19025
|
-
|
|
19242
|
+
kind: LlmProfileKindSchema,
|
|
19243
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
19244
|
+
addonId: string(),
|
|
19245
|
+
enabled: boolean(),
|
|
19246
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
19247
|
+
model: string(),
|
|
19248
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
19249
|
+
baseUrl: string().optional(),
|
|
19250
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
19251
|
+
apiKey: string().optional(),
|
|
19252
|
+
supportsVision: boolean(),
|
|
19253
|
+
temperature: number().min(0).max(2).optional(),
|
|
19254
|
+
maxTokens: number().int().positive().optional(),
|
|
19255
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
19256
|
+
extraHeaders: record(string(), string()).optional(),
|
|
19257
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
19258
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
19026
19259
|
});
|
|
19027
|
-
/**
|
|
19028
|
-
*
|
|
19029
|
-
*
|
|
19030
|
-
|
|
19031
|
-
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
|
|
19038
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
19039
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
19040
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
19041
|
-
* broker).
|
|
19042
|
-
*/
|
|
19043
|
-
clientIdPrefix: string().optional()
|
|
19260
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
19261
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
19262
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
19263
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
19264
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
19265
|
+
kind: LlmProfileKindSchema,
|
|
19266
|
+
label: string(),
|
|
19267
|
+
icon: string(),
|
|
19268
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
19269
|
+
addonId: string(),
|
|
19270
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
19044
19271
|
});
|
|
19045
|
-
var
|
|
19046
|
-
|
|
19047
|
-
|
|
19048
|
-
|
|
19049
|
-
password: string().optional(),
|
|
19050
|
-
clientIdPrefix: string().optional()
|
|
19272
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
19273
|
+
var LlmDefaultSchema = object({
|
|
19274
|
+
selector: LlmDefaultSelectorSchema,
|
|
19275
|
+
profileId: string()
|
|
19051
19276
|
});
|
|
19052
|
-
|
|
19053
|
-
var
|
|
19054
|
-
|
|
19055
|
-
|
|
19056
|
-
|
|
19057
|
-
|
|
19058
|
-
|
|
19059
|
-
|
|
19060
|
-
|
|
19061
|
-
|
|
19062
|
-
|
|
19063
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
19064
|
-
allowAnonymous: boolean().default(false),
|
|
19065
|
-
/** Optional shared username/password for clients. */
|
|
19066
|
-
username: string().optional(),
|
|
19067
|
-
password: string().optional()
|
|
19277
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
19278
|
+
var LlmUsageRollupSchema = object({
|
|
19279
|
+
day: string(),
|
|
19280
|
+
consumer: string(),
|
|
19281
|
+
profileId: string(),
|
|
19282
|
+
calls: number(),
|
|
19283
|
+
okCalls: number(),
|
|
19284
|
+
errorCalls: number(),
|
|
19285
|
+
inputTokens: number(),
|
|
19286
|
+
outputTokens: number(),
|
|
19287
|
+
avgLatencyMs: number()
|
|
19068
19288
|
});
|
|
19069
|
-
|
|
19289
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
19290
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
19070
19291
|
id: string(),
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
brokerCount: number(),
|
|
19075
|
-
embeddedRunning: boolean()
|
|
19076
|
-
});
|
|
19077
|
-
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);
|
|
19078
|
-
var NetworkEndpointSchema = object({
|
|
19292
|
+
label: string(),
|
|
19293
|
+
family: string(),
|
|
19294
|
+
purpose: _enum(["text", "vision"]),
|
|
19079
19295
|
url: string(),
|
|
19080
|
-
|
|
19081
|
-
|
|
19082
|
-
|
|
19296
|
+
sha256: string(),
|
|
19297
|
+
sizeBytes: number(),
|
|
19298
|
+
quantization: string(),
|
|
19299
|
+
/** Load-time guidance shown in the picker. */
|
|
19300
|
+
minRamBytes: number(),
|
|
19301
|
+
contextSizeDefault: number().int(),
|
|
19302
|
+
/** Vision models: companion projector file. */
|
|
19303
|
+
mmprojUrl: string().optional()
|
|
19083
19304
|
});
|
|
19084
|
-
var
|
|
19085
|
-
|
|
19086
|
-
|
|
19305
|
+
var LlmRuntimeNodeSchema = object({
|
|
19306
|
+
nodeId: string(),
|
|
19307
|
+
reachable: boolean(),
|
|
19308
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
19309
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
19087
19310
|
error: string().optional()
|
|
19088
19311
|
});
|
|
19089
|
-
|
|
19090
|
-
|
|
19091
|
-
|
|
19092
|
-
|
|
19093
|
-
|
|
19094
|
-
|
|
19095
|
-
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
|
|
19107
|
-
|
|
19108
|
-
|
|
19312
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
19313
|
+
var ProfileRefInputSchema = object({
|
|
19314
|
+
addonId: string(),
|
|
19315
|
+
profileId: string()
|
|
19316
|
+
});
|
|
19317
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
19318
|
+
kind: "mutation",
|
|
19319
|
+
auth: "admin"
|
|
19320
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
19321
|
+
kind: "mutation",
|
|
19322
|
+
auth: "admin"
|
|
19323
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
19324
|
+
kind: "mutation",
|
|
19325
|
+
auth: "admin"
|
|
19326
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
19327
|
+
selector: LlmDefaultSelectorSchema,
|
|
19328
|
+
profileId: string().nullable()
|
|
19329
|
+
}), _void(), {
|
|
19330
|
+
kind: "mutation",
|
|
19331
|
+
auth: "admin"
|
|
19332
|
+
}), method(object({
|
|
19333
|
+
since: number().optional(),
|
|
19334
|
+
until: number().optional(),
|
|
19335
|
+
consumer: string().optional(),
|
|
19336
|
+
profileId: string().optional()
|
|
19337
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
19338
|
+
nodeId: string(),
|
|
19339
|
+
model: ManagedModelRefSchema
|
|
19340
|
+
}), _void(), {
|
|
19341
|
+
kind: "mutation",
|
|
19342
|
+
auth: "admin"
|
|
19343
|
+
}), method(object({
|
|
19344
|
+
nodeId: string(),
|
|
19345
|
+
file: string()
|
|
19346
|
+
}), _void(), {
|
|
19347
|
+
kind: "mutation",
|
|
19348
|
+
auth: "admin"
|
|
19349
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
19350
|
+
kind: "mutation",
|
|
19351
|
+
auth: "admin"
|
|
19352
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
19353
|
+
kind: "mutation",
|
|
19354
|
+
auth: "admin"
|
|
19355
|
+
});
|
|
19356
|
+
var LogLevelSchema = _enum([
|
|
19357
|
+
"debug",
|
|
19358
|
+
"info",
|
|
19359
|
+
"warn",
|
|
19360
|
+
"error"
|
|
19361
|
+
]);
|
|
19362
|
+
var LogEntrySchema = object({
|
|
19363
|
+
timestamp: date(),
|
|
19364
|
+
level: LogLevelSchema,
|
|
19365
|
+
scope: array(string()),
|
|
19366
|
+
message: string(),
|
|
19367
|
+
meta: record(string(), unknown()).optional(),
|
|
19368
|
+
tags: record(string(), string()).optional()
|
|
19109
19369
|
});
|
|
19110
|
-
method(
|
|
19370
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
19371
|
+
scope: array(string()).optional(),
|
|
19372
|
+
level: LogLevelSchema.optional(),
|
|
19373
|
+
since: date().optional(),
|
|
19374
|
+
until: date().optional(),
|
|
19375
|
+
limit: number().optional(),
|
|
19376
|
+
tags: record(string(), string()).optional()
|
|
19377
|
+
}), array(LogEntrySchema).readonly());
|
|
19111
19378
|
/**
|
|
19112
|
-
*
|
|
19379
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
19380
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
19381
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
19382
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
19383
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
19384
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
19113
19385
|
*
|
|
19114
|
-
*
|
|
19115
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
19116
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
19117
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
19118
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
19119
|
-
* message to what the kind supports — callers never special-case a service.
|
|
19386
|
+
* A contribution is a discriminated union on `kind`:
|
|
19120
19387
|
*
|
|
19121
|
-
*
|
|
19122
|
-
*
|
|
19123
|
-
* `
|
|
19124
|
-
*
|
|
19125
|
-
*
|
|
19126
|
-
* alternative would fork the UI per addon and cannot host the
|
|
19127
|
-
* discovery→adopt flow.
|
|
19128
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
19129
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
19130
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
19131
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
19132
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
19133
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
19134
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
19135
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
19136
|
-
* base64 fallback needed.
|
|
19388
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
19389
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
19390
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
19391
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19392
|
+
* login page needs NO change.
|
|
19137
19393
|
*
|
|
19138
|
-
*
|
|
19139
|
-
*
|
|
19140
|
-
*
|
|
19141
|
-
|
|
19142
|
-
|
|
19143
|
-
*
|
|
19144
|
-
*
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
*
|
|
19155
|
-
*
|
|
19156
|
-
*
|
|
19157
|
-
*
|
|
19394
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
19395
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
19396
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
19397
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
19398
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
19399
|
+
*
|
|
19400
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
19401
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
19402
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
19403
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
19404
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
19405
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
19406
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
19407
|
+
* decision.
|
|
19408
|
+
*
|
|
19409
|
+
* Every contribution carries a `stage`:
|
|
19410
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
19411
|
+
* magic-link buttons; a future usernameless passkey).
|
|
19412
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
19413
|
+
* returned `factors` (passkey-as-2FA today).
|
|
19414
|
+
*
|
|
19415
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
19416
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
19417
|
+
* tRPC router.
|
|
19158
19418
|
*/
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
19166
|
-
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19419
|
+
/** When a login method renders in the two-phase login flow. */
|
|
19420
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
19421
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
19422
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
19423
|
+
object({
|
|
19424
|
+
kind: literal("redirect"),
|
|
19425
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
19426
|
+
id: string(),
|
|
19427
|
+
/** Operator-facing button label. */
|
|
19428
|
+
label: string(),
|
|
19429
|
+
/** lucide-react icon name. */
|
|
19430
|
+
icon: string().optional(),
|
|
19431
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
19432
|
+
startUrl: string(),
|
|
19433
|
+
stage: LoginStageEnum
|
|
19434
|
+
}),
|
|
19435
|
+
object({
|
|
19436
|
+
kind: literal("widget"),
|
|
19437
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
19438
|
+
id: string(),
|
|
19439
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
19440
|
+
addonId: string(),
|
|
19441
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
19442
|
+
bundle: string(),
|
|
19443
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
19444
|
+
remote: WidgetRemoteSchema,
|
|
19445
|
+
stage: LoginStageEnum
|
|
19446
|
+
}),
|
|
19447
|
+
object({
|
|
19448
|
+
kind: literal("passkey"),
|
|
19449
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
19450
|
+
id: string(),
|
|
19451
|
+
/** Operator-facing button label. */
|
|
19452
|
+
label: string(),
|
|
19453
|
+
stage: LoginStageEnum,
|
|
19454
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
19455
|
+
rpId: string(),
|
|
19456
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
19457
|
+
origin: string().nullable()
|
|
19458
|
+
})
|
|
19170
19459
|
]);
|
|
19171
|
-
|
|
19172
|
-
var
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19460
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
19461
|
+
var CpuBreakdownSchema = object({
|
|
19462
|
+
total: number(),
|
|
19463
|
+
user: number(),
|
|
19464
|
+
system: number(),
|
|
19465
|
+
irq: number(),
|
|
19466
|
+
nice: number(),
|
|
19467
|
+
loadAvg: tuple([
|
|
19468
|
+
number(),
|
|
19469
|
+
number(),
|
|
19470
|
+
number()
|
|
19471
|
+
]),
|
|
19472
|
+
cores: number()
|
|
19176
19473
|
});
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
|
|
19184
|
-
|
|
19185
|
-
var
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
|
|
19190
|
-
|
|
19191
|
-
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
|
|
19197
|
-
|
|
19198
|
-
|
|
19199
|
-
|
|
19474
|
+
var MemoryInfoSchema = object({
|
|
19475
|
+
percent: number(),
|
|
19476
|
+
totalBytes: number(),
|
|
19477
|
+
usedBytes: number(),
|
|
19478
|
+
availableBytes: number(),
|
|
19479
|
+
swapUsedBytes: number(),
|
|
19480
|
+
swapTotalBytes: number()
|
|
19481
|
+
});
|
|
19482
|
+
var DiskIoSnapshotSchema = object({
|
|
19483
|
+
readBytes: number(),
|
|
19484
|
+
writeBytes: number(),
|
|
19485
|
+
readOps: number(),
|
|
19486
|
+
writeOps: number(),
|
|
19487
|
+
timestampMs: number()
|
|
19488
|
+
});
|
|
19489
|
+
var NetworkIoSnapshotSchema = object({
|
|
19490
|
+
rxBytes: number(),
|
|
19491
|
+
txBytes: number(),
|
|
19492
|
+
rxPackets: number(),
|
|
19493
|
+
txPackets: number(),
|
|
19494
|
+
rxErrors: number(),
|
|
19495
|
+
txErrors: number(),
|
|
19496
|
+
timestampMs: number()
|
|
19497
|
+
});
|
|
19498
|
+
var MetricsGpuInfoSchema = object({
|
|
19499
|
+
utilization: number(),
|
|
19500
|
+
model: string(),
|
|
19501
|
+
memoryUsedBytes: number(),
|
|
19502
|
+
memoryTotalBytes: number(),
|
|
19503
|
+
temperature: number().nullable()
|
|
19504
|
+
});
|
|
19505
|
+
var ProcessResourceInfoSchema = object({
|
|
19506
|
+
openFds: number(),
|
|
19507
|
+
threadCount: number(),
|
|
19508
|
+
activeHandles: number(),
|
|
19509
|
+
activeRequests: number()
|
|
19200
19510
|
});
|
|
19201
|
-
|
|
19202
|
-
|
|
19203
|
-
|
|
19204
|
-
|
|
19205
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
19206
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
19207
|
-
flags: object({
|
|
19208
|
-
critical: boolean().optional(),
|
|
19209
|
-
silent: boolean().optional(),
|
|
19210
|
-
noPush: boolean().optional()
|
|
19211
|
-
}).optional(),
|
|
19212
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
19213
|
-
requires: array(string()).optional(),
|
|
19214
|
-
description: string().optional()
|
|
19511
|
+
var PressureAvgsSchema = object({
|
|
19512
|
+
avg10: number(),
|
|
19513
|
+
avg60: number(),
|
|
19514
|
+
avg300: number()
|
|
19215
19515
|
});
|
|
19216
|
-
|
|
19217
|
-
|
|
19218
|
-
|
|
19219
|
-
|
|
19220
|
-
|
|
19221
|
-
|
|
19222
|
-
|
|
19223
|
-
|
|
19224
|
-
|
|
19225
|
-
|
|
19226
|
-
|
|
19516
|
+
var PressureInfoSchema = object({
|
|
19517
|
+
some: PressureAvgsSchema,
|
|
19518
|
+
full: PressureAvgsSchema.nullable()
|
|
19519
|
+
});
|
|
19520
|
+
var SystemResourceSnapshotSchema = object({
|
|
19521
|
+
cpu: CpuBreakdownSchema,
|
|
19522
|
+
memory: MemoryInfoSchema,
|
|
19523
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
19524
|
+
network: NetworkIoSnapshotSchema,
|
|
19525
|
+
disk: DiskIoSnapshotSchema,
|
|
19526
|
+
pressure: object({
|
|
19527
|
+
cpu: PressureInfoSchema.nullable(),
|
|
19528
|
+
memory: PressureInfoSchema.nullable(),
|
|
19529
|
+
io: PressureInfoSchema.nullable()
|
|
19227
19530
|
}),
|
|
19228
|
-
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
format: array(NotificationFormatSchema),
|
|
19232
|
-
clickUrl: boolean(),
|
|
19233
|
-
sound: boolean(),
|
|
19234
|
-
ttl: boolean(),
|
|
19235
|
-
bodyMaxLen: number().int().positive()
|
|
19531
|
+
process: ProcessResourceInfoSchema,
|
|
19532
|
+
cpuTemperature: number().nullable(),
|
|
19533
|
+
timestampMs: number()
|
|
19236
19534
|
});
|
|
19237
|
-
|
|
19238
|
-
|
|
19239
|
-
|
|
19240
|
-
|
|
19241
|
-
|
|
19242
|
-
|
|
19243
|
-
*/
|
|
19244
|
-
var ConfigSchemaPassthrough = unknown();
|
|
19245
|
-
var TargetKindSchema = object({
|
|
19246
|
-
kind: string(),
|
|
19247
|
-
label: string(),
|
|
19248
|
-
icon: string(),
|
|
19249
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
19250
|
-
addonId: string(),
|
|
19251
|
-
configSchema: ConfigSchemaPassthrough,
|
|
19252
|
-
supportsDiscovery: boolean(),
|
|
19253
|
-
caps: TargetKindCapsSchema
|
|
19535
|
+
var DiskSpaceInfoSchema = object({
|
|
19536
|
+
path: string(),
|
|
19537
|
+
totalBytes: number(),
|
|
19538
|
+
usedBytes: number(),
|
|
19539
|
+
availableBytes: number(),
|
|
19540
|
+
percent: number()
|
|
19254
19541
|
});
|
|
19255
|
-
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
|
|
19263
|
-
|
|
19542
|
+
var PidResourceStatsSchema = object({
|
|
19543
|
+
pid: number(),
|
|
19544
|
+
cpu: number(),
|
|
19545
|
+
memory: number(),
|
|
19546
|
+
/**
|
|
19547
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
19548
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
19549
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
19550
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
19551
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
19552
|
+
*/
|
|
19553
|
+
privateBytes: number().optional(),
|
|
19554
|
+
/**
|
|
19555
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
19556
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
19557
|
+
*/
|
|
19558
|
+
sharedBytes: number().optional()
|
|
19559
|
+
});
|
|
19560
|
+
var AddonInstanceSchema = object({
|
|
19264
19561
|
addonId: string(),
|
|
19265
|
-
|
|
19266
|
-
|
|
19562
|
+
nodeId: string(),
|
|
19563
|
+
role: _enum(["hub", "worker"]),
|
|
19564
|
+
pid: number(),
|
|
19565
|
+
state: _enum([
|
|
19566
|
+
"starting",
|
|
19567
|
+
"running",
|
|
19568
|
+
"stopping",
|
|
19569
|
+
"stopped",
|
|
19570
|
+
"crashed"
|
|
19571
|
+
]),
|
|
19572
|
+
uptimeSec: number()
|
|
19267
19573
|
});
|
|
19268
|
-
|
|
19269
|
-
|
|
19270
|
-
|
|
19271
|
-
|
|
19272
|
-
|
|
19574
|
+
var NodeProcessSchema = object({
|
|
19575
|
+
pid: number(),
|
|
19576
|
+
ppid: number(),
|
|
19577
|
+
pgid: number(),
|
|
19578
|
+
classification: _enum([
|
|
19579
|
+
"root",
|
|
19580
|
+
"managed",
|
|
19581
|
+
"system",
|
|
19582
|
+
"ghost"
|
|
19583
|
+
]),
|
|
19584
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
19585
|
+
addonId: string().nullable(),
|
|
19586
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
19587
|
+
nodeId: string().nullable(),
|
|
19588
|
+
/** Truncated command line. */
|
|
19589
|
+
command: string(),
|
|
19590
|
+
cpuPercent: number(),
|
|
19591
|
+
memoryRssBytes: number(),
|
|
19592
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
19593
|
+
uptimeSec: number(),
|
|
19594
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
19595
|
+
orphaned: boolean()
|
|
19273
19596
|
});
|
|
19274
|
-
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
|
|
19278
|
-
attachmentsSent: number().int().nonnegative(),
|
|
19279
|
-
actionsSent: number().int().nonnegative(),
|
|
19280
|
-
truncated: boolean(),
|
|
19281
|
-
dropped: array(string())
|
|
19597
|
+
var KillProcessInputSchema = object({
|
|
19598
|
+
pid: number(),
|
|
19599
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
19600
|
+
force: boolean().optional()
|
|
19282
19601
|
});
|
|
19283
|
-
var
|
|
19602
|
+
var KillProcessResultSchema = object({
|
|
19284
19603
|
success: boolean(),
|
|
19285
|
-
|
|
19286
|
-
|
|
19604
|
+
reason: string().optional(),
|
|
19605
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
19606
|
+
});
|
|
19607
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
19608
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
19609
|
+
addonId: string() });
|
|
19610
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
19611
|
+
success: boolean(),
|
|
19612
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
19613
|
+
path: string().optional(),
|
|
19614
|
+
/** Process pid that was signalled. */
|
|
19615
|
+
pid: number().optional(),
|
|
19616
|
+
reason: string().optional()
|
|
19617
|
+
});
|
|
19618
|
+
var SystemMetricsSchema = object({
|
|
19619
|
+
cpuPercent: number(),
|
|
19620
|
+
memoryPercent: number(),
|
|
19621
|
+
memoryUsedMB: number(),
|
|
19622
|
+
memoryTotalMB: number(),
|
|
19623
|
+
diskPercent: number().optional(),
|
|
19624
|
+
temperature: number().optional(),
|
|
19625
|
+
gpuPercent: number().optional(),
|
|
19626
|
+
gpuMemoryPercent: number().optional()
|
|
19627
|
+
});
|
|
19628
|
+
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, {
|
|
19629
|
+
kind: "mutation",
|
|
19630
|
+
auth: "admin"
|
|
19631
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
19632
|
+
kind: "mutation",
|
|
19633
|
+
auth: "admin"
|
|
19634
|
+
});
|
|
19635
|
+
method(object({
|
|
19636
|
+
sourceUrl: string(),
|
|
19637
|
+
metadata: ModelConvertMetadataSchema,
|
|
19638
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
19639
|
+
calibrationRef: string().optional(),
|
|
19640
|
+
sessionId: string().optional()
|
|
19641
|
+
}), ConvertResultSchema, {
|
|
19642
|
+
kind: "mutation",
|
|
19643
|
+
auth: "admin",
|
|
19644
|
+
timeoutMs: 6e5
|
|
19645
|
+
});
|
|
19646
|
+
method(object({
|
|
19647
|
+
nodeId: string(),
|
|
19648
|
+
modelId: string(),
|
|
19649
|
+
format: _enum(MODEL_FORMATS),
|
|
19650
|
+
entry: ModelCatalogEntrySchema
|
|
19651
|
+
}), object({
|
|
19652
|
+
ok: boolean(),
|
|
19653
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
19654
|
+
sha256: string(),
|
|
19655
|
+
bytes: number(),
|
|
19656
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
19657
|
+
path: string()
|
|
19658
|
+
}), {
|
|
19659
|
+
kind: "mutation",
|
|
19660
|
+
auth: "admin"
|
|
19287
19661
|
});
|
|
19288
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
19289
|
-
var TestResultSchema = SendResultSchema;
|
|
19290
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
19291
|
-
kind: string(),
|
|
19292
|
-
config: record(string(), unknown()).optional()
|
|
19293
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
19294
|
-
targetId: string(),
|
|
19295
|
-
notification: NotificationSchema
|
|
19296
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
19297
|
-
targetId: string(),
|
|
19298
|
-
sample: NotificationSchema.optional()
|
|
19299
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
19300
|
-
targetId: string(),
|
|
19301
|
-
enabled: boolean()
|
|
19302
|
-
}), _void(), { kind: "mutation" });
|
|
19303
19662
|
/**
|
|
19304
|
-
*
|
|
19305
|
-
*
|
|
19306
|
-
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
19307
|
-
* (operator decisions D-1/D-2/D-3 are binding):
|
|
19663
|
+
* `mqtt-broker` — broker-registry cap.
|
|
19308
19664
|
*
|
|
19309
|
-
*
|
|
19310
|
-
*
|
|
19311
|
-
*
|
|
19312
|
-
*
|
|
19313
|
-
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
19314
|
-
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
19315
|
-
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
19316
|
-
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
19317
|
-
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
19318
|
-
* by id; per-backend params are a passthrough blob capped by the
|
|
19319
|
-
* target kind's own caps/degrade engine).
|
|
19665
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
19666
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
19667
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
19668
|
+
* its OWN `mqtt.js` client.
|
|
19320
19669
|
*
|
|
19321
|
-
*
|
|
19322
|
-
*
|
|
19323
|
-
*
|
|
19324
|
-
*
|
|
19325
|
-
*
|
|
19326
|
-
* private zones, per-recipient fan-out and the wider condition table are
|
|
19327
|
-
* P2+ (see spec §7).
|
|
19670
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
19671
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
19672
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
19673
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
19674
|
+
* features anyway — give it the connection config, get out of the way.
|
|
19328
19675
|
*
|
|
19329
|
-
*
|
|
19330
|
-
*
|
|
19331
|
-
*
|
|
19676
|
+
* Consumer flow:
|
|
19677
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
19678
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
19679
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
19680
|
+
*
|
|
19681
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
19682
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
19683
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
19684
|
+
* spawned it.
|
|
19332
19685
|
*/
|
|
19686
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
19333
19687
|
/**
|
|
19334
|
-
*
|
|
19335
|
-
* The value maps 1:1 onto the evaluated record kind:
|
|
19336
|
-
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
19337
|
-
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
19338
|
-
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
19339
|
-
* change of a LINKED device, one row per linked camera)
|
|
19340
|
-
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
19341
|
-
* delivery / pick-up)
|
|
19688
|
+
* Broker live-probe status.
|
|
19342
19689
|
*
|
|
19343
|
-
*
|
|
19344
|
-
*
|
|
19345
|
-
*
|
|
19346
|
-
*
|
|
19690
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
19691
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
19692
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
19693
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
19694
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
19347
19695
|
*/
|
|
19348
|
-
var
|
|
19349
|
-
"
|
|
19350
|
-
"
|
|
19351
|
-
"
|
|
19352
|
-
"
|
|
19696
|
+
var BrokerStatusSchema$1 = _enum([
|
|
19697
|
+
"connected",
|
|
19698
|
+
"disconnected",
|
|
19699
|
+
"auth-failed",
|
|
19700
|
+
"unreachable",
|
|
19701
|
+
"tls-error"
|
|
19353
19702
|
]);
|
|
19354
|
-
|
|
19355
|
-
|
|
19356
|
-
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
/**
|
|
19363
|
-
|
|
19364
|
-
/**
|
|
19365
|
-
|
|
19366
|
-
});
|
|
19367
|
-
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
19368
|
-
var NcPlateMatcherSchema = object({
|
|
19369
|
-
values: array(string().min(1)).min(1),
|
|
19370
|
-
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
19371
|
-
maxDistance: number().int().min(0).max(3).default(1)
|
|
19372
|
-
});
|
|
19373
|
-
/**
|
|
19374
|
-
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
19375
|
-
* occupancy edge for a device — optionally narrowed to a single admin
|
|
19376
|
-
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
19377
|
-
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
19378
|
-
* - `became-free` — count crossed ≥ `count` → below it
|
|
19379
|
-
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
19380
|
-
* `sustainSeconds` requires the condition hold continuously that long
|
|
19381
|
-
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
19382
|
-
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
19383
|
-
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
19384
|
-
* (declared SQLite collection, reseeded on boot).
|
|
19385
|
-
*/
|
|
19386
|
-
var NcOccupancyConditionSchema = object({
|
|
19387
|
-
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
19388
|
-
zoneId: string().optional(),
|
|
19389
|
-
/** Object class to count; absent = any class. */
|
|
19390
|
-
className: string().optional(),
|
|
19391
|
-
op: _enum([
|
|
19392
|
-
"became-occupied",
|
|
19393
|
-
"became-free",
|
|
19394
|
-
">=",
|
|
19395
|
-
"<="
|
|
19396
|
-
]).default("became-occupied"),
|
|
19397
|
-
count: number().int().min(0).default(1),
|
|
19398
|
-
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
19399
|
-
});
|
|
19400
|
-
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
19401
|
-
var NcZoneConditionSchema = object({
|
|
19402
|
-
ids: array(string().min(1)).min(1),
|
|
19403
|
-
/** Quantifier over `ids` — at least one / every one visited. */
|
|
19404
|
-
match: _enum(["any", "all"]).default("any")
|
|
19405
|
-
});
|
|
19406
|
-
/**
|
|
19407
|
-
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
19408
|
-
* membership lists are OR within the list (spec §2.3).
|
|
19409
|
-
*/
|
|
19410
|
-
var NcConditionsSchema = object({
|
|
19411
|
-
/** Device scope — absent = all devices. */
|
|
19412
|
-
devices: array(number()).optional(),
|
|
19413
|
-
/** Detector class names (any overlap with the record's class set). */
|
|
19414
|
-
classes: array(string().min(1)).optional(),
|
|
19415
|
-
/** Veto classes — any overlap fails the rule. */
|
|
19416
|
-
classesExclude: array(string().min(1)).optional(),
|
|
19417
|
-
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
19418
|
-
minConfidence: number().min(0).max(1).optional(),
|
|
19419
|
-
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
19420
|
-
zones: NcZoneConditionSchema.optional(),
|
|
19421
|
-
/** Veto zones — any hit fails the rule. */
|
|
19422
|
-
zonesExclude: array(string().min(1)).optional(),
|
|
19423
|
-
/**
|
|
19424
|
-
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
19425
|
-
* (identity name / plate text / subclass).
|
|
19426
|
-
*/
|
|
19427
|
-
labelEquals: array(string().min(1)).optional(),
|
|
19428
|
-
/**
|
|
19429
|
-
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
19430
|
-
* `label` (the identity display name propagated by the face pipeline) —
|
|
19431
|
-
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
19432
|
-
*/
|
|
19433
|
-
identities: array(string().min(1)).optional(),
|
|
19434
|
-
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
19435
|
-
plates: NcPlateMatcherSchema.optional(),
|
|
19436
|
-
/**
|
|
19437
|
-
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
19438
|
-
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
19439
|
-
* identity display name). A record with NO label passes (nothing to
|
|
19440
|
-
* exclude), unlike the include variant which fails on an absent label.
|
|
19441
|
-
*/
|
|
19442
|
-
identitiesExclude: array(string().min(1)).optional(),
|
|
19443
|
-
/**
|
|
19444
|
-
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
19445
|
-
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
19446
|
-
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
19447
|
-
* close the value is threaded via the close-time info (the `Track` clone is
|
|
19448
|
-
* captured before the DB row is updated, so it would otherwise read stale).
|
|
19449
|
-
* Fails when the record carries no importance (never guess quality — the
|
|
19450
|
-
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
19451
|
-
*/
|
|
19452
|
-
minImportance: number().min(0).max(1).optional(),
|
|
19453
|
-
/**
|
|
19454
|
-
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
19455
|
-
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
19456
|
-
* lifespan, so a dwell condition never matches immediate delivery
|
|
19457
|
-
* (documented choice — the object-event record carries no `firstSeen`,
|
|
19458
|
-
* so dwell cannot be computed from what the subject actually carries).
|
|
19459
|
-
*/
|
|
19460
|
-
minDwellSeconds: number().min(0).optional(),
|
|
19461
|
-
/**
|
|
19462
|
-
* Detection provenance filter. `any` (default / absent) matches every
|
|
19463
|
-
* source; otherwise the subject's source must equal it. Legacy records
|
|
19464
|
-
* with no stamped source are treated as `pipeline`. The union spans both
|
|
19465
|
-
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
19466
|
-
* tracks carry `sensor`.
|
|
19467
|
-
*/
|
|
19468
|
-
source: _enum([
|
|
19469
|
-
"pipeline",
|
|
19470
|
-
"onboard",
|
|
19471
|
-
"sensor",
|
|
19472
|
-
"any"
|
|
19473
|
-
]).optional(),
|
|
19474
|
-
/**
|
|
19475
|
-
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
19476
|
-
* detector `minConfidence` (that gates the object-detection score; this
|
|
19477
|
-
* gates the recognition/OCR match score). Fails when the subject carries
|
|
19478
|
-
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
19479
|
-
* lives on the recognition result and reaches the subject at track close.
|
|
19480
|
-
*
|
|
19481
|
-
* What it measures precisely (plumbed at track close — the closer threads
|
|
19482
|
-
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
19483
|
-
* `importance`): the BEST recognition match confidence observed for the
|
|
19484
|
-
* label the track carries at close — for a face, the peak cosine similarity
|
|
19485
|
-
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
19486
|
-
* for a plate, the peak OCR read score of the best-held plate
|
|
19487
|
-
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
19488
|
-
* one track the higher of the two is used. A track that ended with no
|
|
19489
|
-
* confident identity/plate match carries no value, so the condition fails
|
|
19490
|
-
* closed for it (an un-recognized subject).
|
|
19491
|
-
*/
|
|
19492
|
-
minLabelConfidence: number().min(0).max(1).optional(),
|
|
19493
|
-
/**
|
|
19494
|
-
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
19495
|
-
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
19496
|
-
* against the token carried on the device-event subject (extracted from the
|
|
19497
|
-
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
19498
|
-
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
19499
|
-
* eventType, so gate those with {@link sensorKinds} instead.
|
|
19500
|
-
*/
|
|
19501
|
-
eventTypeTokens: array(string().min(1)).optional(),
|
|
19502
|
-
/**
|
|
19503
|
-
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
19504
|
-
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
19505
|
-
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
19506
|
-
*/
|
|
19507
|
-
sensorKinds: array(string().min(1)).optional(),
|
|
19508
|
-
/**
|
|
19509
|
-
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
19510
|
-
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
19511
|
-
* when the subject's phase does not match (a subject always carries a phase
|
|
19512
|
-
* on the package-event trigger).
|
|
19513
|
-
*/
|
|
19514
|
-
packagePhase: _enum([
|
|
19515
|
-
"delivered",
|
|
19516
|
-
"picked-up",
|
|
19517
|
-
"both"
|
|
19518
|
-
]).optional(),
|
|
19519
|
-
/**
|
|
19520
|
-
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
19521
|
-
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
19522
|
-
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
19523
|
-
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
19524
|
-
*/
|
|
19525
|
-
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
19526
|
-
/**
|
|
19527
|
-
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
19528
|
-
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
19529
|
-
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
19530
|
-
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
19531
|
-
*/
|
|
19532
|
-
occupancy: NcOccupancyConditionSchema.optional()
|
|
19533
|
-
});
|
|
19534
|
-
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
19535
|
-
var NcRuleTargetSchema = object({
|
|
19536
|
-
/** `notification-output` Target id. */
|
|
19537
|
-
targetId: string().min(1),
|
|
19538
|
-
/**
|
|
19539
|
-
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
19540
|
-
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
19541
|
-
* degrade engine drops what the backend can't render.
|
|
19542
|
-
*/
|
|
19543
|
-
params: record(string(), unknown()).optional()
|
|
19703
|
+
var BrokerInfoSchema = object({
|
|
19704
|
+
id: string(),
|
|
19705
|
+
name: string(),
|
|
19706
|
+
url: string(),
|
|
19707
|
+
kind: BrokerKindSchema,
|
|
19708
|
+
status: BrokerStatusSchema$1,
|
|
19709
|
+
latencyMs: number().nullable(),
|
|
19710
|
+
error: string().optional(),
|
|
19711
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
19712
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
19713
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
19714
|
+
lastCheckedAt: number().optional()
|
|
19544
19715
|
});
|
|
19545
19716
|
/**
|
|
19546
|
-
*
|
|
19547
|
-
*
|
|
19548
|
-
*
|
|
19549
|
-
*
|
|
19550
|
-
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
19551
|
-
* (or when the specific crop is missing) degrades to `best`, then
|
|
19552
|
-
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
19553
|
-
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
19554
|
-
* name), so the choice never drifts from the record that fired it.
|
|
19555
|
-
* - `keyFrame` — the clean scene frame (no subject box).
|
|
19556
|
-
* - `none` — no attachment.
|
|
19717
|
+
* Connection details — what a consumer needs to call
|
|
19718
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
19719
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
19720
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
19557
19721
|
*/
|
|
19558
|
-
var
|
|
19559
|
-
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
"none"
|
|
19563
|
-
]).default("best") });
|
|
19564
|
-
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
19565
|
-
var NcThrottleSchema = object({
|
|
19566
|
-
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
19567
|
-
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
19568
|
-
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
19569
|
-
});
|
|
19570
|
-
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
19571
|
-
var NcRuleInputSchema = object({
|
|
19572
|
-
name: string().min(1).max(200),
|
|
19573
|
-
enabled: boolean().default(true),
|
|
19574
|
-
delivery: NcDeliverySchema,
|
|
19575
|
-
conditions: NcConditionsSchema.default({}),
|
|
19576
|
-
schedule: NcScheduleSchema.optional(),
|
|
19577
|
-
targets: array(NcRuleTargetSchema).min(1),
|
|
19578
|
-
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
19579
|
-
throttle: NcThrottleSchema.default({
|
|
19580
|
-
cooldownSec: 60,
|
|
19581
|
-
scope: "rule-device"
|
|
19582
|
-
}),
|
|
19583
|
-
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
19584
|
-
template: object({
|
|
19585
|
-
title: string().max(500).optional(),
|
|
19586
|
-
body: string().max(2e3).optional()
|
|
19587
|
-
}).optional(),
|
|
19588
|
-
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
19589
|
-
priority: number().int().min(1).max(5).default(3),
|
|
19722
|
+
var BrokerConnectionDetailsSchema = object({
|
|
19723
|
+
url: string(),
|
|
19724
|
+
username: string().optional(),
|
|
19725
|
+
password: string().optional(),
|
|
19590
19726
|
/**
|
|
19591
|
-
*
|
|
19592
|
-
*
|
|
19593
|
-
*
|
|
19727
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
19728
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
19729
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
19730
|
+
* broker).
|
|
19594
19731
|
*/
|
|
19595
|
-
|
|
19732
|
+
clientIdPrefix: string().optional()
|
|
19733
|
+
});
|
|
19734
|
+
var AddBrokerInputSchema = object({
|
|
19735
|
+
name: string().min(1),
|
|
19736
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
19737
|
+
username: string().optional(),
|
|
19738
|
+
password: string().optional(),
|
|
19739
|
+
clientIdPrefix: string().optional()
|
|
19740
|
+
});
|
|
19741
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
19742
|
+
var IdInputSchema = object({ id: string() });
|
|
19743
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
19744
|
+
ok: literal(true),
|
|
19745
|
+
latencyMs: number()
|
|
19746
|
+
}), object({
|
|
19747
|
+
ok: literal(false),
|
|
19748
|
+
error: string()
|
|
19749
|
+
})]);
|
|
19750
|
+
var StartEmbeddedInputSchema = object({
|
|
19751
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
19752
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
19753
|
+
allowAnonymous: boolean().default(false),
|
|
19754
|
+
/** Optional shared username/password for clients. */
|
|
19755
|
+
username: string().optional(),
|
|
19756
|
+
password: string().optional()
|
|
19757
|
+
});
|
|
19758
|
+
var StartEmbeddedResultSchema = object({
|
|
19759
|
+
id: string(),
|
|
19760
|
+
url: string()
|
|
19761
|
+
});
|
|
19762
|
+
var StatusSchema = object({
|
|
19763
|
+
brokerCount: number(),
|
|
19764
|
+
embeddedRunning: boolean()
|
|
19765
|
+
});
|
|
19766
|
+
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);
|
|
19767
|
+
var NetworkEndpointSchema = object({
|
|
19768
|
+
url: string(),
|
|
19769
|
+
hostname: string(),
|
|
19770
|
+
port: number(),
|
|
19771
|
+
protocol: _enum(["http", "https"])
|
|
19772
|
+
});
|
|
19773
|
+
var NetworkAccessStatusSchema = object({
|
|
19774
|
+
connected: boolean(),
|
|
19775
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
19776
|
+
error: string().optional()
|
|
19596
19777
|
});
|
|
19597
19778
|
/**
|
|
19598
|
-
*
|
|
19599
|
-
*
|
|
19600
|
-
*
|
|
19601
|
-
*
|
|
19602
|
-
*
|
|
19603
|
-
*
|
|
19604
|
-
* `updateRule` patch.
|
|
19779
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
19780
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
19781
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
19782
|
+
* the originating provider config (mode + sourcePort) so the
|
|
19783
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
19784
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
19605
19785
|
*/
|
|
19606
|
-
var
|
|
19607
|
-
/** A persisted rule. */
|
|
19608
|
-
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
19609
|
-
id: string(),
|
|
19610
|
-
/** userId of the admin who created the rule (server-stamped caller). */
|
|
19611
|
-
createdBy: string(),
|
|
19612
|
-
createdAt: number(),
|
|
19613
|
-
updatedAt: number(),
|
|
19786
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
19614
19787
|
/**
|
|
19615
|
-
*
|
|
19616
|
-
*
|
|
19617
|
-
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
19788
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
19789
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
19618
19790
|
*/
|
|
19619
|
-
|
|
19620
|
-
|
|
19621
|
-
|
|
19622
|
-
|
|
19623
|
-
|
|
19624
|
-
|
|
19625
|
-
|
|
19626
|
-
"device-event",
|
|
19627
|
-
"package-event"
|
|
19628
|
-
]),
|
|
19629
|
-
deviceId: number(),
|
|
19630
|
-
timestamp: number(),
|
|
19631
|
-
wouldFire: boolean(),
|
|
19632
|
-
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
19633
|
-
failedCondition: string().optional(),
|
|
19634
|
-
className: string().optional(),
|
|
19635
|
-
label: string().optional()
|
|
19791
|
+
id: string(),
|
|
19792
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
19793
|
+
label: string(),
|
|
19794
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
19795
|
+
mode: string().optional(),
|
|
19796
|
+
/** Originating local port the ingress fronts (informational). */
|
|
19797
|
+
sourcePort: number().optional()
|
|
19636
19798
|
});
|
|
19637
|
-
|
|
19638
|
-
|
|
19799
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
19800
|
+
/**
|
|
19801
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
19802
|
+
*
|
|
19803
|
+
* Apprise-derived model (see
|
|
19804
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
19805
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
19806
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
19807
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
19808
|
+
* message to what the kind supports — callers never special-case a service.
|
|
19809
|
+
*
|
|
19810
|
+
* DESIGN DECISIONS (locked):
|
|
19811
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
19812
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
19813
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
19814
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
19815
|
+
* alternative would fork the UI per addon and cannot host the
|
|
19816
|
+
* discovery→adopt flow.
|
|
19817
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
19818
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
19819
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
19820
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
19821
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
19822
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
19823
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
19824
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
19825
|
+
* base64 fallback needed.
|
|
19826
|
+
*
|
|
19827
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
19828
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
19829
|
+
* admin "Integrations" page.
|
|
19830
|
+
*/
|
|
19831
|
+
/**
|
|
19832
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
19833
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
19834
|
+
*/
|
|
19835
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
19836
|
+
"image",
|
|
19837
|
+
"video",
|
|
19838
|
+
"gif",
|
|
19839
|
+
"audio",
|
|
19840
|
+
"icon"
|
|
19841
|
+
]);
|
|
19842
|
+
/**
|
|
19843
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
19844
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
19845
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
19846
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
19847
|
+
*/
|
|
19848
|
+
var AttachmentSchema = object({
|
|
19849
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
19850
|
+
url: string().optional(),
|
|
19851
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
19852
|
+
mime: string().optional(),
|
|
19853
|
+
name: string().optional()
|
|
19854
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
19855
|
+
var NotificationFormatSchema = _enum([
|
|
19856
|
+
"text",
|
|
19857
|
+
"markdown",
|
|
19858
|
+
"html"
|
|
19859
|
+
]);
|
|
19860
|
+
/** A single tap-through action button. */
|
|
19861
|
+
var NotificationActionSchema = object({
|
|
19862
|
+
id: string(),
|
|
19863
|
+
label: string(),
|
|
19864
|
+
url: string().optional()
|
|
19865
|
+
});
|
|
19866
|
+
/**
|
|
19867
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
19868
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
19869
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
19870
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
19871
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
19872
|
+
* `priority` for that one target.
|
|
19873
|
+
*/
|
|
19874
|
+
var NotificationSchema = object({
|
|
19875
|
+
body: string(),
|
|
19876
|
+
title: string().optional(),
|
|
19877
|
+
format: NotificationFormatSchema.default("text"),
|
|
19878
|
+
priority: number().int().min(1).max(5).default(3),
|
|
19879
|
+
level: string().optional(),
|
|
19880
|
+
attachments: array(AttachmentSchema).optional(),
|
|
19881
|
+
clickUrl: string().optional(),
|
|
19882
|
+
actions: array(NotificationActionSchema).optional(),
|
|
19883
|
+
sound: string().optional(),
|
|
19884
|
+
ttl: number().optional(),
|
|
19885
|
+
tag: string().optional(),
|
|
19886
|
+
deviceId: number().optional(),
|
|
19887
|
+
eventId: string().optional(),
|
|
19888
|
+
metadata: record(string(), unknown()).optional()
|
|
19889
|
+
});
|
|
19890
|
+
/** One declared native severity/priority level for a kind. */
|
|
19891
|
+
var TargetKindLevelSchema = object({
|
|
19639
19892
|
id: string(),
|
|
19640
|
-
group: _enum([
|
|
19641
|
-
"scope",
|
|
19642
|
-
"class",
|
|
19643
|
-
"zones",
|
|
19644
|
-
"quality",
|
|
19645
|
-
"label",
|
|
19646
|
-
"schedule",
|
|
19647
|
-
"device",
|
|
19648
|
-
"package",
|
|
19649
|
-
"occupancy"
|
|
19650
|
-
]),
|
|
19651
19893
|
label: string(),
|
|
19652
|
-
/**
|
|
19653
|
-
|
|
19654
|
-
|
|
19655
|
-
|
|
19656
|
-
|
|
19657
|
-
|
|
19658
|
-
|
|
19659
|
-
|
|
19660
|
-
|
|
19661
|
-
"schedule",
|
|
19662
|
-
"plateMatcher",
|
|
19663
|
-
"packagePhase",
|
|
19664
|
-
"polygonDraw",
|
|
19665
|
-
"occupancy"
|
|
19666
|
-
]),
|
|
19667
|
-
operator: _enum([
|
|
19668
|
-
"in",
|
|
19669
|
-
"notIn",
|
|
19670
|
-
"anyOf",
|
|
19671
|
-
"allOf",
|
|
19672
|
-
"gte",
|
|
19673
|
-
"fuzzyIn",
|
|
19674
|
-
"withinSchedule"
|
|
19675
|
-
]),
|
|
19676
|
-
/** Which delivery kinds the condition applies to. */
|
|
19677
|
-
appliesTo: array(NcDeliverySchema),
|
|
19678
|
-
phase: string(),
|
|
19894
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
19895
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
19896
|
+
flags: object({
|
|
19897
|
+
critical: boolean().optional(),
|
|
19898
|
+
silent: boolean().optional(),
|
|
19899
|
+
noPush: boolean().optional()
|
|
19900
|
+
}).optional(),
|
|
19901
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
19902
|
+
requires: array(string()).optional(),
|
|
19679
19903
|
description: string().optional()
|
|
19680
19904
|
});
|
|
19905
|
+
/** The full capability block consulted before dispatch. */
|
|
19906
|
+
var TargetKindCapsSchema = object({
|
|
19907
|
+
attachments: object({
|
|
19908
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
19909
|
+
mode: _enum([
|
|
19910
|
+
"url",
|
|
19911
|
+
"bytes",
|
|
19912
|
+
"both"
|
|
19913
|
+
]),
|
|
19914
|
+
max: number().int().nonnegative(),
|
|
19915
|
+
maxBytes: number().int().positive().optional()
|
|
19916
|
+
}),
|
|
19917
|
+
/** Max action buttons (0 = none). */
|
|
19918
|
+
actions: number().int().nonnegative(),
|
|
19919
|
+
levels: array(TargetKindLevelSchema),
|
|
19920
|
+
format: array(NotificationFormatSchema),
|
|
19921
|
+
clickUrl: boolean(),
|
|
19922
|
+
sound: boolean(),
|
|
19923
|
+
ttl: boolean(),
|
|
19924
|
+
bodyMaxLen: number().int().positive()
|
|
19925
|
+
});
|
|
19681
19926
|
/**
|
|
19682
|
-
*
|
|
19683
|
-
*
|
|
19684
|
-
*
|
|
19685
|
-
*
|
|
19686
|
-
*
|
|
19687
|
-
* backend rejection / a deleted target (terminal; carries
|
|
19688
|
-
* the failure `error`)
|
|
19689
|
-
*
|
|
19690
|
-
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
19691
|
-
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
19927
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
19928
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
19929
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
19930
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
19931
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
19692
19932
|
*/
|
|
19693
|
-
var
|
|
19694
|
-
|
|
19695
|
-
|
|
19696
|
-
|
|
19697
|
-
|
|
19698
|
-
/**
|
|
19699
|
-
|
|
19700
|
-
|
|
19701
|
-
|
|
19702
|
-
|
|
19703
|
-
"package-event"
|
|
19704
|
-
]);
|
|
19705
|
-
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
19706
|
-
var NcHistorySubjectSchema = object({
|
|
19707
|
-
className: string(),
|
|
19708
|
-
label: string().optional(),
|
|
19709
|
-
confidence: number().optional(),
|
|
19710
|
-
zones: array(string()),
|
|
19711
|
-
timestamp: number()
|
|
19933
|
+
var ConfigSchemaPassthrough = unknown();
|
|
19934
|
+
var TargetKindSchema = object({
|
|
19935
|
+
kind: string(),
|
|
19936
|
+
label: string(),
|
|
19937
|
+
icon: string(),
|
|
19938
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
19939
|
+
addonId: string(),
|
|
19940
|
+
configSchema: ConfigSchemaPassthrough,
|
|
19941
|
+
supportsDiscovery: boolean(),
|
|
19942
|
+
caps: TargetKindCapsSchema
|
|
19712
19943
|
});
|
|
19713
19944
|
/**
|
|
19714
|
-
*
|
|
19715
|
-
*
|
|
19716
|
-
*
|
|
19717
|
-
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
19718
|
-
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
19719
|
-
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
19720
|
-
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
19721
|
-
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
19722
|
-
* P1 (admin scope only).
|
|
19945
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
19946
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
19947
|
+
* round-trip a stored secret to the UI.
|
|
19723
19948
|
*/
|
|
19724
|
-
var
|
|
19725
|
-
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
19949
|
+
var TargetSchema = object({
|
|
19726
19950
|
id: string(),
|
|
19727
|
-
|
|
19728
|
-
|
|
19729
|
-
|
|
19730
|
-
|
|
19731
|
-
|
|
19732
|
-
targetId: string(),
|
|
19733
|
-
deviceId: number(),
|
|
19734
|
-
recordKind: NcHistoryRecordKindSchema,
|
|
19735
|
-
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
19736
|
-
recordId: string(),
|
|
19737
|
-
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
19738
|
-
trackId: string().optional(),
|
|
19739
|
-
status: NcHistoryStatusSchema,
|
|
19740
|
-
/** Delivery attempts made so far. */
|
|
19741
|
-
attempts: number().int(),
|
|
19742
|
-
/** Fire time (outbox enqueue). */
|
|
19743
|
-
createdAt: number(),
|
|
19744
|
-
/** Last transition time (terminal for sent / dead). */
|
|
19745
|
-
updatedAt: number(),
|
|
19746
|
-
/** Failure detail — present on a `dead` row. */
|
|
19747
|
-
error: string().optional(),
|
|
19748
|
-
subject: NcHistorySubjectSchema
|
|
19951
|
+
name: string(),
|
|
19952
|
+
kind: string(),
|
|
19953
|
+
addonId: string(),
|
|
19954
|
+
enabled: boolean(),
|
|
19955
|
+
config: record(string(), unknown())
|
|
19749
19956
|
});
|
|
19750
|
-
/**
|
|
19751
|
-
|
|
19752
|
-
|
|
19753
|
-
|
|
19754
|
-
|
|
19755
|
-
*/
|
|
19756
|
-
var NcHistoryFilterSchema = object({
|
|
19757
|
-
ruleId: string().optional(),
|
|
19758
|
-
deviceId: number().optional(),
|
|
19759
|
-
status: NcHistoryStatusSchema.optional(),
|
|
19760
|
-
since: number().optional(),
|
|
19761
|
-
until: number().optional(),
|
|
19762
|
-
limit: number().int().min(1).max(500).default(100)
|
|
19957
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
19958
|
+
var DiscoveredTargetSchema = object({
|
|
19959
|
+
kind: string(),
|
|
19960
|
+
suggestedName: string(),
|
|
19961
|
+
config: record(string(), unknown())
|
|
19763
19962
|
});
|
|
19764
|
-
|
|
19765
|
-
|
|
19766
|
-
|
|
19767
|
-
|
|
19768
|
-
|
|
19769
|
-
|
|
19770
|
-
|
|
19771
|
-
|
|
19772
|
-
|
|
19773
|
-
|
|
19774
|
-
|
|
19775
|
-
|
|
19776
|
-
|
|
19777
|
-
|
|
19778
|
-
|
|
19779
|
-
|
|
19963
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
19964
|
+
var RenderedAsSchema = object({
|
|
19965
|
+
level: string(),
|
|
19966
|
+
format: NotificationFormatSchema,
|
|
19967
|
+
attachmentsSent: number().int().nonnegative(),
|
|
19968
|
+
actionsSent: number().int().nonnegative(),
|
|
19969
|
+
truncated: boolean(),
|
|
19970
|
+
dropped: array(string())
|
|
19971
|
+
});
|
|
19972
|
+
var SendResultSchema = object({
|
|
19973
|
+
success: boolean(),
|
|
19974
|
+
error: string().optional(),
|
|
19975
|
+
renderedAs: RenderedAsSchema.optional()
|
|
19976
|
+
});
|
|
19977
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
19978
|
+
var TestResultSchema = SendResultSchema;
|
|
19979
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
19980
|
+
kind: string(),
|
|
19981
|
+
config: record(string(), unknown()).optional()
|
|
19982
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
19983
|
+
targetId: string(),
|
|
19984
|
+
notification: NotificationSchema
|
|
19985
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
19986
|
+
targetId: string(),
|
|
19987
|
+
sample: NotificationSchema.optional()
|
|
19988
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
19989
|
+
targetId: string(),
|
|
19780
19990
|
enabled: boolean()
|
|
19781
|
-
}),
|
|
19782
|
-
kind: "mutation",
|
|
19783
|
-
auth: "admin"
|
|
19784
|
-
}), method(object({
|
|
19785
|
-
rule: NcRuleInputSchema,
|
|
19786
|
-
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
19787
|
-
}), object({ results: array(NcTestResultSchema) }), {
|
|
19788
|
-
kind: "mutation",
|
|
19789
|
-
auth: "admin"
|
|
19790
|
-
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
19991
|
+
}), _void(), { kind: "mutation" });
|
|
19791
19992
|
/**
|
|
19792
19993
|
* Zod schemas for persisted record types.
|
|
19793
19994
|
*
|
|
@@ -25172,6 +25373,12 @@ Object.freeze({
|
|
|
25172
25373
|
addonId: null,
|
|
25173
25374
|
access: "delete"
|
|
25174
25375
|
},
|
|
25376
|
+
"backup.deleteSchedule": {
|
|
25377
|
+
capName: "backup",
|
|
25378
|
+
capScope: "system",
|
|
25379
|
+
addonId: null,
|
|
25380
|
+
access: "delete"
|
|
25381
|
+
},
|
|
25175
25382
|
"backup.getEntries": {
|
|
25176
25383
|
capName: "backup",
|
|
25177
25384
|
capScope: "system",
|
|
@@ -25202,6 +25409,12 @@ Object.freeze({
|
|
|
25202
25409
|
addonId: null,
|
|
25203
25410
|
access: "view"
|
|
25204
25411
|
},
|
|
25412
|
+
"backup.listSchedules": {
|
|
25413
|
+
capName: "backup",
|
|
25414
|
+
capScope: "system",
|
|
25415
|
+
addonId: null,
|
|
25416
|
+
access: "view"
|
|
25417
|
+
},
|
|
25205
25418
|
"backup.previewSchedule": {
|
|
25206
25419
|
capName: "backup",
|
|
25207
25420
|
capScope: "system",
|
|
@@ -25226,6 +25439,12 @@ Object.freeze({
|
|
|
25226
25439
|
addonId: null,
|
|
25227
25440
|
access: "create"
|
|
25228
25441
|
},
|
|
25442
|
+
"backup.upsertSchedule": {
|
|
25443
|
+
capName: "backup",
|
|
25444
|
+
capScope: "system",
|
|
25445
|
+
addonId: null,
|
|
25446
|
+
access: "create"
|
|
25447
|
+
},
|
|
25229
25448
|
"battery.wakeForStream": {
|
|
25230
25449
|
capName: "battery",
|
|
25231
25450
|
capScope: "device",
|
|
@@ -29060,6 +29279,36 @@ Object.freeze({
|
|
|
29060
29279
|
addonId: null,
|
|
29061
29280
|
access: "create"
|
|
29062
29281
|
},
|
|
29282
|
+
"terminalSession.close": {
|
|
29283
|
+
capName: "terminal-session",
|
|
29284
|
+
capScope: "system",
|
|
29285
|
+
addonId: null,
|
|
29286
|
+
access: "create"
|
|
29287
|
+
},
|
|
29288
|
+
"terminalSession.listProfiles": {
|
|
29289
|
+
capName: "terminal-session",
|
|
29290
|
+
capScope: "system",
|
|
29291
|
+
addonId: null,
|
|
29292
|
+
access: "view"
|
|
29293
|
+
},
|
|
29294
|
+
"terminalSession.listSessions": {
|
|
29295
|
+
capName: "terminal-session",
|
|
29296
|
+
capScope: "system",
|
|
29297
|
+
addonId: null,
|
|
29298
|
+
access: "view"
|
|
29299
|
+
},
|
|
29300
|
+
"terminalSession.openSession": {
|
|
29301
|
+
capName: "terminal-session",
|
|
29302
|
+
capScope: "system",
|
|
29303
|
+
addonId: null,
|
|
29304
|
+
access: "create"
|
|
29305
|
+
},
|
|
29306
|
+
"terminalSession.resize": {
|
|
29307
|
+
capName: "terminal-session",
|
|
29308
|
+
capScope: "system",
|
|
29309
|
+
addonId: null,
|
|
29310
|
+
access: "create"
|
|
29311
|
+
},
|
|
29063
29312
|
"toast.onToast": {
|
|
29064
29313
|
capName: "toast",
|
|
29065
29314
|
capScope: "system",
|