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