@camstack/addon-pipeline 1.2.11 → 1.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audio-analyzer/index.js +1 -1
- package/dist/audio-analyzer/index.mjs +1 -1
- package/dist/detection-pipeline/index.js +2 -2
- package/dist/detection-pipeline/index.mjs +2 -2
- package/dist/{dist-DNjy_sr4.js → dist-BUd2xSjP.js} +2243 -2075
- package/dist/{dist-owmpaeIY.mjs → dist-DuI0Ypuu.mjs} +2243 -2075
- package/dist/{fmp4-keyframes-BzTPoPVn.js → fmp4-keyframes-5s8T9Mng.js} +42 -7
- package/dist/{fmp4-keyframes-qOgJBjMO.mjs → fmp4-keyframes-CV0X1mGy.mjs} +37 -12
- package/dist/motion-wasm/index.js +1 -1
- package/dist/motion-wasm/index.mjs +1 -1
- package/dist/pipeline-runner/index.js +2 -2
- package/dist/pipeline-runner/index.mjs +2 -2
- package/dist/recorder/index.js +183 -49
- package/dist/recorder/index.mjs +183 -49
- package/dist/{step-definitions-C2bNlww3.js → step-definitions-Ck4_6GKK.js} +1 -1
- package/dist/{step-definitions-CkvctwuS.mjs → step-definitions-DqNWVeYB.mjs} +1 -1
- package/dist/stream-broker/_stub.js +2 -2
- package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CkiyBstP.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-5EJfCCjk.mjs} +2 -2
- package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DHQsa56B.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BDeEvhV5.mjs} +1 -1
- package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js--zEZtV2N.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BGtpZkgz.mjs} +1 -1
- package/dist/stream-broker/{hostInit-BC07ueda.mjs → hostInit-QaJMh7Ec.mjs} +2 -2
- package/dist/stream-broker/index.js +1186 -337
- package/dist/stream-broker/index.mjs +1187 -338
- package/dist/stream-broker/remoteEntry.js +1 -1
- package/embed-dist/assets/{MaskShapeCanvas-DI4BY7W2-CftzR7Pj.js → MaskShapeCanvas-DI4BY7W2-Di-nvxaR.js} +1 -1
- package/embed-dist/assets/{MotionZonesSettings-NcxxQN8r-DPgVIdEn.js → MotionZonesSettings-NcxxQN8r-C6Nj76Lm.js} +1 -1
- package/embed-dist/assets/{PrivacyMaskSettings-APgPLF7p-D0HqiXHW.js → PrivacyMaskSettings-APgPLF7p-DwVoJunF.js} +1 -1
- package/embed-dist/assets/index-CtDVz0vI.js +116 -0
- package/embed-dist/index.html +1 -1
- package/package.json +1 -1
- package/embed-dist/assets/index-DRtbV_en.js +0 -116
|
@@ -9451,397 +9451,1035 @@ var AccessoryKind = {
|
|
|
9451
9451
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
9452
9452
|
DeviceFeature.BatteryOperated;
|
|
9453
9453
|
/**
|
|
9454
|
-
*
|
|
9455
|
-
*
|
|
9456
|
-
*
|
|
9457
|
-
*
|
|
9458
|
-
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
9459
|
-
* their own slices.
|
|
9454
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
9455
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
9456
|
+
* language so a single drawing-plane editor and the providers stay
|
|
9457
|
+
* decoupled from each cap's storage.
|
|
9460
9458
|
*
|
|
9461
|
-
*
|
|
9462
|
-
*
|
|
9463
|
-
* `
|
|
9464
|
-
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
9465
|
-
* consumers reach the same data via the `device-state` cap router
|
|
9466
|
-
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
9459
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
9460
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
9461
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
9467
9462
|
*/
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
* stream-health, Reolink reads firmware push events, ONVIF tracks
|
|
9473
|
-
* ping responses. This cap intentionally does NOT prescribe which
|
|
9474
|
-
* signal drives the flag.
|
|
9475
|
-
*/
|
|
9476
|
-
online: boolean(),
|
|
9477
|
-
/** Ms epoch of the last `online` transition. Lets consumers tell
|
|
9478
|
-
* apart "just came online" from "still online". */
|
|
9479
|
-
lastChangedAt: number()
|
|
9463
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
9464
|
+
var MaskPointSchema = object({
|
|
9465
|
+
x: number(),
|
|
9466
|
+
y: number()
|
|
9480
9467
|
});
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9468
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
9469
|
+
var MaskRectShapeSchema = object({
|
|
9470
|
+
kind: literal("rect"),
|
|
9471
|
+
x: number(),
|
|
9472
|
+
y: number(),
|
|
9473
|
+
width: number(),
|
|
9474
|
+
height: number()
|
|
9475
|
+
});
|
|
9476
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
9477
|
+
var MaskPolygonShapeSchema = object({
|
|
9478
|
+
kind: literal("polygon"),
|
|
9479
|
+
points: array(MaskPointSchema)
|
|
9480
|
+
});
|
|
9481
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
9482
|
+
var MaskGridShapeSchema = object({
|
|
9483
|
+
kind: literal("grid"),
|
|
9484
|
+
gridWidth: number(),
|
|
9485
|
+
gridHeight: number(),
|
|
9486
|
+
cells: array(boolean())
|
|
9487
|
+
});
|
|
9488
|
+
discriminatedUnion("kind", [
|
|
9489
|
+
MaskRectShapeSchema,
|
|
9490
|
+
MaskPolygonShapeSchema,
|
|
9491
|
+
MaskGridShapeSchema,
|
|
9492
|
+
object({
|
|
9493
|
+
kind: literal("line"),
|
|
9494
|
+
points: array(MaskPointSchema)
|
|
9495
|
+
})
|
|
9496
|
+
]);
|
|
9497
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
9498
|
+
var MaskShapeKindSchema = _enum([
|
|
9499
|
+
"rect",
|
|
9500
|
+
"polygon",
|
|
9501
|
+
"grid",
|
|
9502
|
+
"line"
|
|
9503
|
+
]);
|
|
9504
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
9505
|
+
var MaskPolygonVerticesSchema = object({
|
|
9506
|
+
min: number(),
|
|
9507
|
+
max: number()
|
|
9508
|
+
});
|
|
9509
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
9510
|
+
var MaskGridDimsSchema = object({
|
|
9511
|
+
width: number(),
|
|
9512
|
+
height: number()
|
|
9484
9513
|
});
|
|
9485
9514
|
/**
|
|
9486
|
-
*
|
|
9487
|
-
* truth about what a device CAN do — which the kernel uses to:
|
|
9488
|
-
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
9489
|
-
* based on what the firmware actually advertises).
|
|
9490
|
-
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
9491
|
-
* `device-manager.listAll`.
|
|
9492
|
-
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
9493
|
-
* to register on the device's capability surface.
|
|
9515
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
9494
9516
|
*
|
|
9495
|
-
*
|
|
9496
|
-
*
|
|
9497
|
-
* accessory reconciliation). Consumers read via:
|
|
9498
|
-
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
9517
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
9518
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
9499
9519
|
*
|
|
9500
|
-
*
|
|
9501
|
-
*
|
|
9502
|
-
*
|
|
9520
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
9521
|
+
* `notification-center` module), hooked on the durable persistence
|
|
9522
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
9523
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
9524
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
9525
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
9526
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
9527
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
9528
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
9529
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
9530
|
+
* target kind's own caps/degrade engine).
|
|
9503
9531
|
*
|
|
9504
|
-
*
|
|
9505
|
-
*
|
|
9506
|
-
*
|
|
9507
|
-
*
|
|
9532
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
9533
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
9534
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
9535
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
9536
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
9537
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
9538
|
+
* P2+ (see spec §7).
|
|
9539
|
+
*
|
|
9540
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
9541
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
9542
|
+
* schema/interface drift is explicitly not repeated).
|
|
9508
9543
|
*/
|
|
9509
|
-
|
|
9544
|
+
/**
|
|
9545
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
9546
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
9547
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
9548
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
9549
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
9550
|
+
* change of a LINKED device, one row per linked camera)
|
|
9551
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
9552
|
+
* delivery / pick-up)
|
|
9553
|
+
*
|
|
9554
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
9555
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
9556
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
9557
|
+
* one trigger.
|
|
9558
|
+
*/
|
|
9559
|
+
var NcDeliverySchema = _enum([
|
|
9560
|
+
"immediate",
|
|
9561
|
+
"track-end",
|
|
9562
|
+
"device-event",
|
|
9563
|
+
"package-event"
|
|
9564
|
+
]);
|
|
9565
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
9566
|
+
var NcScheduleSchema = object({
|
|
9567
|
+
windows: array(object({
|
|
9568
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
9569
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
9570
|
+
startMinute: number().int().min(0).max(1439),
|
|
9571
|
+
endMinute: number().int().min(0).max(1439)
|
|
9572
|
+
})).min(1),
|
|
9573
|
+
/** IANA timezone; default = hub host timezone. */
|
|
9574
|
+
timezone: string().optional(),
|
|
9575
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
9576
|
+
invert: boolean().optional()
|
|
9577
|
+
});
|
|
9578
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
9579
|
+
var NcPlateMatcherSchema = object({
|
|
9580
|
+
values: array(string().min(1)).min(1),
|
|
9581
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9582
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9583
|
+
});
|
|
9584
|
+
/**
|
|
9585
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9586
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9587
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9588
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9589
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9590
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9591
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9592
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9593
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9594
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9595
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9596
|
+
*/
|
|
9597
|
+
var NcOccupancyConditionSchema = object({
|
|
9598
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9599
|
+
zoneId: string().optional(),
|
|
9600
|
+
/** Object class to count; absent = any class. */
|
|
9601
|
+
className: string().optional(),
|
|
9602
|
+
op: _enum([
|
|
9603
|
+
"became-occupied",
|
|
9604
|
+
"became-free",
|
|
9605
|
+
">=",
|
|
9606
|
+
"<="
|
|
9607
|
+
]).default("became-occupied"),
|
|
9608
|
+
count: number().int().min(0).default(1),
|
|
9609
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9610
|
+
});
|
|
9611
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9612
|
+
var NcZoneConditionSchema = object({
|
|
9613
|
+
ids: array(string().min(1)).min(1),
|
|
9614
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9615
|
+
match: _enum(["any", "all"]).default("any")
|
|
9616
|
+
});
|
|
9617
|
+
/**
|
|
9618
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9619
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9620
|
+
*/
|
|
9621
|
+
var NcConditionsSchema = object({
|
|
9622
|
+
/** Device scope — absent = all devices. */
|
|
9623
|
+
devices: array(number()).optional(),
|
|
9624
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9625
|
+
classes: array(string().min(1)).optional(),
|
|
9626
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9627
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9628
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9629
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9630
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9631
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9632
|
+
/** Veto zones — any hit fails the rule. */
|
|
9633
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
9510
9634
|
/**
|
|
9511
|
-
*
|
|
9512
|
-
*
|
|
9513
|
-
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
9514
|
-
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
9515
|
-
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9635
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9636
|
+
* (identity name / plate text / subclass).
|
|
9516
9637
|
*/
|
|
9517
|
-
|
|
9638
|
+
labelEquals: array(string().min(1)).optional(),
|
|
9518
9639
|
/**
|
|
9519
|
-
*
|
|
9520
|
-
*
|
|
9521
|
-
*
|
|
9640
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9641
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9642
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
9522
9643
|
*/
|
|
9523
|
-
|
|
9524
|
-
/**
|
|
9525
|
-
|
|
9526
|
-
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
9527
|
-
channelCount: number().nullable(),
|
|
9644
|
+
identities: array(string().min(1)).optional(),
|
|
9645
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9646
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
9528
9647
|
/**
|
|
9529
|
-
*
|
|
9530
|
-
*
|
|
9531
|
-
*
|
|
9532
|
-
*
|
|
9648
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9649
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9650
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9651
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
9533
9652
|
*/
|
|
9534
|
-
|
|
9653
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
9535
9654
|
/**
|
|
9536
|
-
*
|
|
9537
|
-
*
|
|
9538
|
-
*
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9655
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9656
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9657
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9658
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9659
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9660
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9661
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9662
|
+
*/
|
|
9663
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9664
|
+
/**
|
|
9665
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9666
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9667
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9668
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9669
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9670
|
+
*/
|
|
9671
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9672
|
+
/**
|
|
9673
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9674
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9675
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9676
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9677
|
+
* tracks carry `sensor`.
|
|
9678
|
+
*/
|
|
9679
|
+
source: _enum([
|
|
9680
|
+
"pipeline",
|
|
9681
|
+
"onboard",
|
|
9682
|
+
"sensor",
|
|
9683
|
+
"any"
|
|
9684
|
+
]).optional(),
|
|
9685
|
+
/**
|
|
9686
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9687
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9688
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9689
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9690
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9691
|
+
*
|
|
9692
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9693
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9694
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9695
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9696
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9697
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9698
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9699
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9700
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9701
|
+
* closed for it (an un-recognized subject).
|
|
9702
|
+
*/
|
|
9703
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9704
|
+
/**
|
|
9705
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9706
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9707
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9708
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9709
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9710
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9711
|
+
*/
|
|
9712
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9713
|
+
/**
|
|
9714
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9715
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9716
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9717
|
+
*/
|
|
9718
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9719
|
+
/**
|
|
9720
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9721
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9722
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9723
|
+
* on the package-event trigger).
|
|
9724
|
+
*/
|
|
9725
|
+
packagePhase: _enum([
|
|
9726
|
+
"delivered",
|
|
9727
|
+
"picked-up",
|
|
9728
|
+
"both"
|
|
9729
|
+
]).optional(),
|
|
9730
|
+
/**
|
|
9731
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9732
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9733
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9734
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9735
|
+
*/
|
|
9736
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9737
|
+
/**
|
|
9738
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9739
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9740
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9741
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9742
|
+
*/
|
|
9743
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9545
9744
|
});
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
aqi: number().optional(),
|
|
9557
|
-
/** Ms epoch when the slice was last updated. */
|
|
9558
|
-
lastFetchedAt: number(),
|
|
9559
|
-
/** Live display unit of the single metric this slice carries (e.g. HA
|
|
9560
|
-
* `attributes.unit_of_measurement` → 'ppm' / 'ppb' / 'µg/m³'). Each
|
|
9561
|
-
* upstream `sensor.*` entity surfaces ONE device_class, so one unit
|
|
9562
|
-
* per slice is unambiguous. */
|
|
9563
|
-
unit: string().optional(),
|
|
9564
|
-
/** Suggested decimal places for numeric display.
|
|
9565
|
-
* Populated live from the upstream source when provided (e.g. HA
|
|
9566
|
-
* `attributes.suggested_display_precision`). Falls back to
|
|
9567
|
-
* auto-formatting when absent. */
|
|
9568
|
-
precision: number().int().min(0).max(10).optional()
|
|
9745
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9746
|
+
var NcRuleTargetSchema = object({
|
|
9747
|
+
/** `notification-output` Target id. */
|
|
9748
|
+
targetId: string().min(1),
|
|
9749
|
+
/**
|
|
9750
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9751
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9752
|
+
* degrade engine drops what the backend can't render.
|
|
9753
|
+
*/
|
|
9754
|
+
params: record(string(), unknown()).optional()
|
|
9569
9755
|
});
|
|
9570
|
-
DeviceType.Sensor;
|
|
9571
9756
|
/**
|
|
9572
|
-
*
|
|
9573
|
-
* `
|
|
9574
|
-
*
|
|
9575
|
-
*
|
|
9576
|
-
*
|
|
9577
|
-
*
|
|
9578
|
-
*
|
|
9579
|
-
*
|
|
9580
|
-
*
|
|
9581
|
-
* `
|
|
9582
|
-
*
|
|
9583
|
-
*
|
|
9584
|
-
* `availableModes` mirrors HA's `supported_features`-derived arm
|
|
9585
|
-
* mode list — the UI renders only the buttons the panel accepts.
|
|
9757
|
+
* Media attachment policy (P1 still-image subset).
|
|
9758
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9759
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9760
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9761
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9762
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9763
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9764
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9765
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9766
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9767
|
+
* - `none` — no attachment.
|
|
9586
9768
|
*/
|
|
9587
|
-
var
|
|
9588
|
-
"
|
|
9589
|
-
"
|
|
9590
|
-
"
|
|
9591
|
-
"
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
"
|
|
9598
|
-
]);
|
|
9599
|
-
var AlarmArmModeSchema = _enum([
|
|
9600
|
-
"home",
|
|
9601
|
-
"away",
|
|
9602
|
-
"night",
|
|
9603
|
-
"vacation",
|
|
9604
|
-
"custom_bypass"
|
|
9605
|
-
]);
|
|
9606
|
-
object({
|
|
9607
|
-
/** Current lifecycle state. */
|
|
9608
|
-
state: AlarmStateSchema,
|
|
9609
|
-
/** Subset of arm modes the panel accepts. UI renders one button per
|
|
9610
|
-
* mode in this list. */
|
|
9611
|
-
availableModes: array(AlarmArmModeSchema),
|
|
9612
|
-
/** Whether the panel requires a PIN on arm / disarm. Mirrors
|
|
9613
|
-
* `DeviceFeature.AlarmPinRequired` for slice consumers. */
|
|
9614
|
-
requiresCode: boolean(),
|
|
9615
|
-
/** Ms epoch when the slice was last updated. */
|
|
9616
|
-
lastChangedAt: number()
|
|
9617
|
-
});
|
|
9618
|
-
DeviceType.AlarmPanel, method(object({
|
|
9619
|
-
deviceId: number().int().nonnegative(),
|
|
9620
|
-
mode: AlarmArmModeSchema,
|
|
9621
|
-
/** Optional PIN code. Required when `requiresCode === true`.
|
|
9622
|
-
* Passed through to the upstream service; never persisted. */
|
|
9623
|
-
code: string().min(1).optional()
|
|
9624
|
-
}), _void(), {
|
|
9625
|
-
kind: "mutation",
|
|
9626
|
-
auth: "admin"
|
|
9627
|
-
}), method(object({
|
|
9628
|
-
deviceId: number().int().nonnegative(),
|
|
9629
|
-
code: string().min(1).optional()
|
|
9630
|
-
}), _void(), {
|
|
9631
|
-
kind: "mutation",
|
|
9632
|
-
auth: "admin"
|
|
9633
|
-
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
9634
|
-
kind: "mutation",
|
|
9635
|
-
auth: "admin"
|
|
9769
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9770
|
+
"best",
|
|
9771
|
+
"best-matching",
|
|
9772
|
+
"keyFrame",
|
|
9773
|
+
"none"
|
|
9774
|
+
]).default("best") });
|
|
9775
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9776
|
+
var NcThrottleSchema = object({
|
|
9777
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9778
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9779
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9636
9780
|
});
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9781
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9782
|
+
var NcRuleInputSchema = object({
|
|
9783
|
+
name: string().min(1).max(200),
|
|
9784
|
+
enabled: boolean().default(true),
|
|
9785
|
+
delivery: NcDeliverySchema,
|
|
9786
|
+
conditions: NcConditionsSchema.default({}),
|
|
9787
|
+
schedule: NcScheduleSchema.optional(),
|
|
9788
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9789
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9790
|
+
throttle: NcThrottleSchema.default({
|
|
9791
|
+
cooldownSec: 60,
|
|
9792
|
+
scope: "rule-device"
|
|
9793
|
+
}),
|
|
9794
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9795
|
+
template: object({
|
|
9796
|
+
title: string().max(500).optional(),
|
|
9797
|
+
body: string().max(2e3).optional()
|
|
9798
|
+
}).optional(),
|
|
9799
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9800
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9801
|
+
/**
|
|
9802
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9803
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9804
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9805
|
+
*/
|
|
9806
|
+
ownerUserId: string().optional()
|
|
9651
9807
|
});
|
|
9652
|
-
DeviceType.Sensor;
|
|
9653
9808
|
/**
|
|
9654
|
-
*
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9809
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9810
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9811
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9812
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9813
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9814
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9815
|
+
* `updateRule` patch.
|
|
9816
|
+
*/
|
|
9817
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9818
|
+
/** A persisted rule. */
|
|
9819
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9820
|
+
id: string(),
|
|
9821
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9822
|
+
createdBy: string(),
|
|
9823
|
+
createdAt: number(),
|
|
9824
|
+
updatedAt: number(),
|
|
9825
|
+
/**
|
|
9826
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9827
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9828
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9829
|
+
*/
|
|
9830
|
+
disabledTargetIds: array(string()).default([])
|
|
9831
|
+
});
|
|
9832
|
+
var NcTestResultSchema = object({
|
|
9833
|
+
recordId: string(),
|
|
9834
|
+
recordKind: _enum([
|
|
9835
|
+
"object-event",
|
|
9836
|
+
"track",
|
|
9837
|
+
"device-event",
|
|
9838
|
+
"package-event"
|
|
9839
|
+
]),
|
|
9840
|
+
deviceId: number(),
|
|
9841
|
+
timestamp: number(),
|
|
9842
|
+
wouldFire: boolean(),
|
|
9843
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9844
|
+
failedCondition: string().optional(),
|
|
9845
|
+
className: string().optional(),
|
|
9846
|
+
label: string().optional()
|
|
9847
|
+
});
|
|
9848
|
+
var NcConditionDescriptorSchema = object({
|
|
9849
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9850
|
+
id: string(),
|
|
9851
|
+
group: _enum([
|
|
9852
|
+
"scope",
|
|
9853
|
+
"class",
|
|
9854
|
+
"zones",
|
|
9855
|
+
"quality",
|
|
9856
|
+
"label",
|
|
9857
|
+
"schedule",
|
|
9858
|
+
"device",
|
|
9859
|
+
"package",
|
|
9860
|
+
"occupancy"
|
|
9861
|
+
]),
|
|
9862
|
+
label: string(),
|
|
9863
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9864
|
+
valueType: _enum([
|
|
9865
|
+
"deviceIdList",
|
|
9866
|
+
"stringList",
|
|
9867
|
+
"number01",
|
|
9868
|
+
"number",
|
|
9869
|
+
"sourceSelect",
|
|
9870
|
+
"zoneSelection",
|
|
9871
|
+
"zoneIdList",
|
|
9872
|
+
"schedule",
|
|
9873
|
+
"plateMatcher",
|
|
9874
|
+
"packagePhase",
|
|
9875
|
+
"polygonDraw",
|
|
9876
|
+
"occupancy"
|
|
9877
|
+
]),
|
|
9878
|
+
operator: _enum([
|
|
9879
|
+
"in",
|
|
9880
|
+
"notIn",
|
|
9881
|
+
"anyOf",
|
|
9882
|
+
"allOf",
|
|
9883
|
+
"gte",
|
|
9884
|
+
"fuzzyIn",
|
|
9885
|
+
"withinSchedule"
|
|
9886
|
+
]),
|
|
9887
|
+
/** Which delivery kinds the condition applies to. */
|
|
9888
|
+
appliesTo: array(NcDeliverySchema),
|
|
9889
|
+
phase: string(),
|
|
9890
|
+
description: string().optional()
|
|
9664
9891
|
});
|
|
9665
9892
|
/**
|
|
9666
|
-
*
|
|
9667
|
-
*
|
|
9668
|
-
*
|
|
9669
|
-
*
|
|
9670
|
-
*
|
|
9671
|
-
*
|
|
9893
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9894
|
+
* durable outbox row's own status (single source of truth):
|
|
9895
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9896
|
+
* - `sent` — delivered (terminal)
|
|
9897
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9898
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9899
|
+
* the failure `error`)
|
|
9672
9900
|
*
|
|
9673
|
-
*
|
|
9674
|
-
* (
|
|
9675
|
-
* and the level history shifts forward.
|
|
9901
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9902
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9676
9903
|
*/
|
|
9677
|
-
var
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
}).nullable(),
|
|
9697
|
-
/** Per-class summary across the rolling window — keys are
|
|
9698
|
-
* `macroClass` strings (e.g. `dog_bark`, `speech`, `glass_break`). */
|
|
9699
|
-
byClass: array(AudioClassSummarySchema).readonly()
|
|
9904
|
+
var NcHistoryStatusSchema = _enum([
|
|
9905
|
+
"pending",
|
|
9906
|
+
"sent",
|
|
9907
|
+
"dead"
|
|
9908
|
+
]);
|
|
9909
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9910
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9911
|
+
"object-event",
|
|
9912
|
+
"track-end",
|
|
9913
|
+
"device-event",
|
|
9914
|
+
"package-event"
|
|
9915
|
+
]);
|
|
9916
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9917
|
+
var NcHistorySubjectSchema = object({
|
|
9918
|
+
className: string(),
|
|
9919
|
+
label: string().optional(),
|
|
9920
|
+
confidence: number().optional(),
|
|
9921
|
+
zones: array(string()),
|
|
9922
|
+
timestamp: number()
|
|
9700
9923
|
});
|
|
9701
9924
|
/**
|
|
9702
|
-
*
|
|
9703
|
-
*
|
|
9704
|
-
*
|
|
9705
|
-
*
|
|
9706
|
-
*
|
|
9925
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9926
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9927
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9928
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9929
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9930
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9931
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9932
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9933
|
+
* P1 (admin scope only).
|
|
9707
9934
|
*/
|
|
9708
|
-
var
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
peakDbfs: number(),
|
|
9718
|
-
/** Rolling-window mean dBFS at sample time. */
|
|
9719
|
-
avgDbfs: number(),
|
|
9720
|
-
/** Dominant above-threshold class at sample time, or null on silence. */
|
|
9721
|
-
topClass: string().nullable(),
|
|
9722
|
-
/** Score of the dominant class (`null` whenever `topClass` is null). */
|
|
9723
|
-
topScore: number().min(0).max(1).nullable()
|
|
9724
|
-
})).readonly(),
|
|
9725
|
-
/** Actual ms between adjacent samples after any subsampling. */
|
|
9726
|
-
effectiveSampleEveryMs: number().int().positive(),
|
|
9727
|
-
/** Wall-clock window covered by `points` (`points[N-1].ts - points[0].ts`),
|
|
9728
|
-
* or `0` when there's fewer than 2 samples. */
|
|
9729
|
-
windowMsActual: number().int().nonnegative()
|
|
9730
|
-
});
|
|
9731
|
-
DeviceType.Camera, method(object({ deviceId: number() }), AudioMetricsSnapshotSchema.nullable()), method(object({
|
|
9935
|
+
var NcHistoryEntrySchema = object({
|
|
9936
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9937
|
+
id: string(),
|
|
9938
|
+
ruleId: string(),
|
|
9939
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9940
|
+
ruleName: string(),
|
|
9941
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9942
|
+
delivery: NcDeliverySchema,
|
|
9943
|
+
targetId: string(),
|
|
9732
9944
|
deviceId: number(),
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
/**
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
/**
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
/** Ms epoch of the last successful run. 0 when never run. */
|
|
9749
|
-
lastTriggeredAt: number(),
|
|
9750
|
-
/** Failure description from the last completed run. Null on success
|
|
9751
|
-
* or when never run. */
|
|
9752
|
-
lastError: string().nullable(),
|
|
9753
|
-
/** Ms epoch when the slice was last updated. */
|
|
9754
|
-
lastChangedAt: number()
|
|
9945
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9946
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9947
|
+
recordId: string(),
|
|
9948
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9949
|
+
trackId: string().optional(),
|
|
9950
|
+
status: NcHistoryStatusSchema,
|
|
9951
|
+
/** Delivery attempts made so far. */
|
|
9952
|
+
attempts: number().int(),
|
|
9953
|
+
/** Fire time (outbox enqueue). */
|
|
9954
|
+
createdAt: number(),
|
|
9955
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9956
|
+
updatedAt: number(),
|
|
9957
|
+
/** Failure detail — present on a `dead` row. */
|
|
9958
|
+
error: string().optional(),
|
|
9959
|
+
subject: NcHistorySubjectSchema
|
|
9755
9960
|
});
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9961
|
+
/**
|
|
9962
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9963
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9964
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9965
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9966
|
+
*/
|
|
9967
|
+
var NcHistoryFilterSchema = object({
|
|
9968
|
+
ruleId: string().optional(),
|
|
9969
|
+
deviceId: number().optional(),
|
|
9970
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9971
|
+
since: number().optional(),
|
|
9972
|
+
until: number().optional(),
|
|
9973
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9974
|
+
});
|
|
9975
|
+
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 }), {
|
|
9760
9976
|
kind: "mutation",
|
|
9761
|
-
auth: "admin"
|
|
9977
|
+
auth: "admin",
|
|
9978
|
+
caller: "required"
|
|
9762
9979
|
}), method(object({
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9980
|
+
ruleId: string(),
|
|
9981
|
+
patch: NcRulePatchSchema
|
|
9982
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9983
|
+
kind: "mutation",
|
|
9984
|
+
auth: "admin",
|
|
9985
|
+
caller: "required"
|
|
9986
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9987
|
+
kind: "mutation",
|
|
9988
|
+
auth: "admin"
|
|
9989
|
+
}), method(object({
|
|
9990
|
+
ruleId: string(),
|
|
9991
|
+
enabled: boolean()
|
|
9992
|
+
}), object({ success: literal(true) }), {
|
|
9993
|
+
kind: "mutation",
|
|
9994
|
+
auth: "admin"
|
|
9995
|
+
}), method(object({
|
|
9996
|
+
rule: NcRuleInputSchema,
|
|
9997
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9998
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9769
9999
|
kind: "mutation",
|
|
9770
10000
|
auth: "admin"
|
|
10001
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
10002
|
+
/**
|
|
10003
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
10004
|
+
*
|
|
10005
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
10006
|
+
* §3.2/§3.3.
|
|
10007
|
+
*
|
|
10008
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
10009
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
10010
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
10011
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
10012
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
10013
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
10014
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
10015
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
10016
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
10017
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
10018
|
+
*
|
|
10019
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
10020
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
10021
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
10022
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
10023
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
10024
|
+
*/
|
|
10025
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
10026
|
+
var TimelapseTemplateSchema = object({
|
|
10027
|
+
title: string().max(500).optional(),
|
|
10028
|
+
body: string().max(2e3).optional()
|
|
10029
|
+
});
|
|
10030
|
+
var NameField = string().min(1).max(200);
|
|
10031
|
+
var DeviceIdsField = array(number()).min(1);
|
|
10032
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
10033
|
+
var FramerateField = number().int().min(1).max(60);
|
|
10034
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
10035
|
+
var PriorityField = number().int().min(1).max(5);
|
|
10036
|
+
/**
|
|
10037
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
10038
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
10039
|
+
* here (see the ownership note above).
|
|
10040
|
+
*/
|
|
10041
|
+
var TimelapseRuleInputSchema = object({
|
|
10042
|
+
name: NameField,
|
|
10043
|
+
enabled: boolean().default(true),
|
|
10044
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
10045
|
+
deviceIds: DeviceIdsField,
|
|
10046
|
+
/**
|
|
10047
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
10048
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
10049
|
+
* open clears the scratch, close assembles and delivers.
|
|
10050
|
+
*/
|
|
10051
|
+
schedule: NcScheduleSchema,
|
|
10052
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
10053
|
+
cadenceSec: CadenceSecField.default(15),
|
|
10054
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
10055
|
+
framerate: FramerateField.default(10),
|
|
10056
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
10057
|
+
targets: TargetsField,
|
|
10058
|
+
template: TimelapseTemplateSchema.optional(),
|
|
10059
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
10060
|
+
priority: PriorityField.default(3)
|
|
10061
|
+
});
|
|
10062
|
+
object({
|
|
10063
|
+
name: NameField.optional(),
|
|
10064
|
+
enabled: boolean().optional(),
|
|
10065
|
+
deviceIds: DeviceIdsField.optional(),
|
|
10066
|
+
schedule: NcScheduleSchema.optional(),
|
|
10067
|
+
cadenceSec: CadenceSecField.optional(),
|
|
10068
|
+
framerate: FramerateField.optional(),
|
|
10069
|
+
targets: TargetsField.optional(),
|
|
10070
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
10071
|
+
priority: PriorityField.optional()
|
|
10072
|
+
});
|
|
10073
|
+
TimelapseRuleInputSchema.extend({
|
|
10074
|
+
id: string(),
|
|
10075
|
+
/**
|
|
10076
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
10077
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
10078
|
+
* resolved caller; never trusted from a client payload.
|
|
10079
|
+
*/
|
|
10080
|
+
ownerUserId: string().optional(),
|
|
10081
|
+
/**
|
|
10082
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
10083
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
10084
|
+
*/
|
|
10085
|
+
lastGeneratedAt: number().optional(),
|
|
10086
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
10087
|
+
createdBy: string(),
|
|
10088
|
+
createdAt: number(),
|
|
10089
|
+
updatedAt: number()
|
|
9771
10090
|
});
|
|
9772
10091
|
/**
|
|
9773
|
-
*
|
|
9774
|
-
*
|
|
9775
|
-
*
|
|
9776
|
-
*
|
|
9777
|
-
*
|
|
10092
|
+
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
10093
|
+
* for every device, regardless of provider — the kernel needs a uniform
|
|
10094
|
+
* cap-keyed slice for the basic device flags every consumer expects to
|
|
10095
|
+
* read across processes (the `online` flag in particular). Driver-specific
|
|
10096
|
+
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
10097
|
+
* their own slices.
|
|
10098
|
+
*
|
|
10099
|
+
* Pattern is identical to `battery`: schema-bearing `runtimeState`,
|
|
10100
|
+
* empty `methods`, single change event. Reads land at
|
|
10101
|
+
* `runtimeState.getCapState('device-status')`; writes at
|
|
10102
|
+
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
10103
|
+
* consumers reach the same data via the `device-state` cap router
|
|
10104
|
+
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
9778
10105
|
*/
|
|
9779
|
-
var
|
|
9780
|
-
/** 0..100 inclusive. Firmware-reported. */
|
|
9781
|
-
percentage: number().min(0).max(100),
|
|
10106
|
+
var DeviceStatusSchema = object({
|
|
9782
10107
|
/**
|
|
9783
|
-
*
|
|
9784
|
-
*
|
|
9785
|
-
*
|
|
9786
|
-
*
|
|
10108
|
+
* Device-level liveness. Drivers flip via `markOnline(boolean)` on
|
|
10109
|
+
* `BaseDevice`. Provider semantics vary — RTSP aggregates broker
|
|
10110
|
+
* stream-health, Reolink reads firmware push events, ONVIF tracks
|
|
10111
|
+
* ping responses. This cap intentionally does NOT prescribe which
|
|
10112
|
+
* signal drives the flag.
|
|
9787
10113
|
*/
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
10114
|
+
online: boolean(),
|
|
10115
|
+
/** Ms epoch of the last `online` transition. Lets consumers tell
|
|
10116
|
+
* apart "just came online" from "still online". */
|
|
10117
|
+
lastChangedAt: number()
|
|
10118
|
+
});
|
|
10119
|
+
object({
|
|
10120
|
+
deviceId: number(),
|
|
10121
|
+
status: DeviceStatusSchema
|
|
10122
|
+
});
|
|
10123
|
+
/**
|
|
10124
|
+
* Per-device feature/identity probe slice. Holds the runtime-resolved
|
|
10125
|
+
* truth about what a device CAN do — which the kernel uses to:
|
|
10126
|
+
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
10127
|
+
* based on what the firmware actually advertises).
|
|
10128
|
+
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
10129
|
+
* `device-manager.listAll`.
|
|
10130
|
+
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
10131
|
+
* to register on the device's capability surface.
|
|
10132
|
+
*
|
|
10133
|
+
* Auto-registered by `BaseDevice` for every device. Drivers populate the
|
|
10134
|
+
* slice from `onProbe()` (kernel calls it once after register, before
|
|
10135
|
+
* accessory reconciliation). Consumers read via:
|
|
10136
|
+
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
10137
|
+
*
|
|
10138
|
+
* `flags` is an open record so each driver carries its own keys without
|
|
10139
|
+
* a centralized schema bottleneck — Reolink writes `hasPtz/hasIntercom`,
|
|
10140
|
+
* Hikvision writes `hasSupplementalLight/hasAlarmIo`, etc.
|
|
10141
|
+
*
|
|
10142
|
+
* Replaces the older driver-local `deviceCache.has*` blob: the per-device
|
|
10143
|
+
* config is for operator-edited overrides + UI snapshots; runtime probe
|
|
10144
|
+
* results belong in runtime-state where the kernel handles persistence,
|
|
10145
|
+
* cross-process mirroring, and reactive updates.
|
|
10146
|
+
*/
|
|
10147
|
+
var FeatureProbeStatusSchema = object({
|
|
9793
10148
|
/**
|
|
9794
|
-
*
|
|
9795
|
-
*
|
|
9796
|
-
*
|
|
10149
|
+
* Driver-specific flag bag. Each driver picks its own key names — the
|
|
10150
|
+
* cap deliberately does NOT enforce a closed enum here. Reolink keys:
|
|
10151
|
+
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
10152
|
+
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
10153
|
+
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9797
10154
|
*/
|
|
9798
|
-
|
|
9799
|
-
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
9800
|
-
lastUpdated: number(),
|
|
10155
|
+
flags: record(string(), unknown()),
|
|
9801
10156
|
/**
|
|
9802
|
-
*
|
|
9803
|
-
*
|
|
9804
|
-
*
|
|
9805
|
-
* sub-threshold = low). UI MUST render "Normal"/"Low" instead of a
|
|
9806
|
-
* misleading exact percentage. Absent/false → genuine 0–100 % reading.
|
|
10157
|
+
* Coarse driver-classification — lets cross-process consumers tell apart
|
|
10158
|
+
* cameras / battery-cams / NVRs without re-running the probe. `null`
|
|
10159
|
+
* before the first probe completes.
|
|
9807
10160
|
*/
|
|
9808
|
-
|
|
10161
|
+
deviceType: string().nullable(),
|
|
10162
|
+
/** Camera/firmware model string. `null` when the firmware doesn't expose it. */
|
|
10163
|
+
model: string().nullable(),
|
|
10164
|
+
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
10165
|
+
channelCount: number().nullable(),
|
|
10166
|
+
/**
|
|
10167
|
+
* Ms epoch of the last SUCCESSFUL probe. `0` before the first probe
|
|
10168
|
+
* completes — drivers' `getAccessoryChildren()` should treat zero as
|
|
10169
|
+
* "probe not done yet, return empty" so accessories aren't spawned
|
|
10170
|
+
* before the firmware is queried.
|
|
10171
|
+
*/
|
|
10172
|
+
lastProbedAt: number(),
|
|
10173
|
+
/**
|
|
10174
|
+
* Framework convention: every runtime-state slice carries this for the
|
|
10175
|
+
* createRuntimeStateBridge stale-check helper. We keep it in sync with
|
|
10176
|
+
* `lastProbedAt` on every write.
|
|
10177
|
+
*/
|
|
10178
|
+
lastFetchedAt: number()
|
|
9809
10179
|
});
|
|
9810
|
-
|
|
9811
|
-
deviceId: number(),
|
|
9812
|
-
/** Bound on the wait. Sensible range 3000–10000ms. */
|
|
9813
|
-
timeoutMs: number().int().min(500).max(3e4).default(8e3)
|
|
9814
|
-
}), object({
|
|
9815
|
-
awoke: boolean(),
|
|
9816
|
-
durationMs: number()
|
|
9817
|
-
}), { kind: "mutation" }), object({
|
|
10180
|
+
object({
|
|
9818
10181
|
deviceId: number(),
|
|
9819
|
-
status:
|
|
10182
|
+
status: FeatureProbeStatusSchema
|
|
9820
10183
|
});
|
|
9821
10184
|
object({
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
10185
|
+
/** Carbon dioxide concentration in ppm. */
|
|
10186
|
+
co2Ppm: number().min(0).optional(),
|
|
10187
|
+
/** Total volatile organic compounds in ppb. */
|
|
10188
|
+
vocPpb: number().min(0).optional(),
|
|
10189
|
+
/** Particulate matter ≤ 2.5 μm in µg/m³. */
|
|
10190
|
+
pm25: number().min(0).optional(),
|
|
10191
|
+
/** Particulate matter ≤ 10 μm in µg/m³. */
|
|
10192
|
+
pm10: number().min(0).optional(),
|
|
10193
|
+
/** Composite AQI value (typically 0..500). */
|
|
10194
|
+
aqi: number().optional(),
|
|
10195
|
+
/** Ms epoch when the slice was last updated. */
|
|
10196
|
+
lastFetchedAt: number(),
|
|
10197
|
+
/** Live display unit of the single metric this slice carries (e.g. HA
|
|
10198
|
+
* `attributes.unit_of_measurement` → 'ppm' / 'ppb' / 'µg/m³'). Each
|
|
10199
|
+
* upstream `sensor.*` entity surfaces ONE device_class, so one unit
|
|
10200
|
+
* per slice is unambiguous. */
|
|
10201
|
+
unit: string().optional(),
|
|
10202
|
+
/** Suggested decimal places for numeric display.
|
|
10203
|
+
* Populated live from the upstream source when provided (e.g. HA
|
|
10204
|
+
* `attributes.suggested_display_precision`). Falls back to
|
|
10205
|
+
* auto-formatting when absent. */
|
|
10206
|
+
precision: number().int().min(0).max(10).optional()
|
|
9825
10207
|
});
|
|
9826
10208
|
DeviceType.Sensor;
|
|
10209
|
+
/**
|
|
10210
|
+
* Alarm-panel cap. Models HA `alarm_control_panel.*` on
|
|
10211
|
+
* `DeviceType.AlarmPanel`. State follows HA's canonical lifecycle
|
|
10212
|
+
* across disarmed / armed_(home|away|night|vacation|custom_bypass) /
|
|
10213
|
+
* arming / pending / triggered / disarming.
|
|
10214
|
+
*
|
|
10215
|
+
* Many panels require a PIN code on arm / disarm — the optional
|
|
10216
|
+
* `code` field on the methods passes it through to the upstream
|
|
10217
|
+
* service; it's NEVER persisted in the runtime slice or any event
|
|
10218
|
+
* payload. The presence of a required code is signalled by
|
|
10219
|
+
* `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
|
|
10220
|
+
* field without a slice fetch.
|
|
10221
|
+
*
|
|
10222
|
+
* `availableModes` mirrors HA's `supported_features`-derived arm
|
|
10223
|
+
* mode list — the UI renders only the buttons the panel accepts.
|
|
10224
|
+
*/
|
|
10225
|
+
var AlarmStateSchema = _enum([
|
|
10226
|
+
"disarmed",
|
|
10227
|
+
"armed_home",
|
|
10228
|
+
"armed_away",
|
|
10229
|
+
"armed_night",
|
|
10230
|
+
"armed_vacation",
|
|
10231
|
+
"armed_custom_bypass",
|
|
10232
|
+
"arming",
|
|
10233
|
+
"disarming",
|
|
10234
|
+
"pending",
|
|
10235
|
+
"triggered"
|
|
10236
|
+
]);
|
|
10237
|
+
var AlarmArmModeSchema = _enum([
|
|
10238
|
+
"home",
|
|
10239
|
+
"away",
|
|
10240
|
+
"night",
|
|
10241
|
+
"vacation",
|
|
10242
|
+
"custom_bypass"
|
|
10243
|
+
]);
|
|
9827
10244
|
object({
|
|
9828
|
-
/** Current
|
|
9829
|
-
|
|
9830
|
-
/**
|
|
10245
|
+
/** Current lifecycle state. */
|
|
10246
|
+
state: AlarmStateSchema,
|
|
10247
|
+
/** Subset of arm modes the panel accepts. UI renders one button per
|
|
10248
|
+
* mode in this list. */
|
|
10249
|
+
availableModes: array(AlarmArmModeSchema),
|
|
10250
|
+
/** Whether the panel requires a PIN on arm / disarm. Mirrors
|
|
10251
|
+
* `DeviceFeature.AlarmPinRequired` for slice consumers. */
|
|
10252
|
+
requiresCode: boolean(),
|
|
10253
|
+
/** Ms epoch when the slice was last updated. */
|
|
9831
10254
|
lastChangedAt: number()
|
|
9832
10255
|
});
|
|
9833
|
-
DeviceType.
|
|
10256
|
+
DeviceType.AlarmPanel, method(object({
|
|
9834
10257
|
deviceId: number().int().nonnegative(),
|
|
9835
|
-
|
|
10258
|
+
mode: AlarmArmModeSchema,
|
|
10259
|
+
/** Optional PIN code. Required when `requiresCode === true`.
|
|
10260
|
+
* Passed through to the upstream service; never persisted. */
|
|
10261
|
+
code: string().min(1).optional()
|
|
9836
10262
|
}), _void(), {
|
|
9837
10263
|
kind: "mutation",
|
|
9838
10264
|
auth: "admin"
|
|
9839
|
-
}), object({
|
|
9840
|
-
deviceId: number(),
|
|
9841
|
-
|
|
9842
|
-
|
|
10265
|
+
}), method(object({
|
|
10266
|
+
deviceId: number().int().nonnegative(),
|
|
10267
|
+
code: string().min(1).optional()
|
|
10268
|
+
}), _void(), {
|
|
10269
|
+
kind: "mutation",
|
|
10270
|
+
auth: "admin"
|
|
10271
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
10272
|
+
kind: "mutation",
|
|
10273
|
+
auth: "admin"
|
|
9843
10274
|
});
|
|
9844
|
-
|
|
10275
|
+
object({
|
|
10276
|
+
/** Current illuminance in lux (lx). */
|
|
10277
|
+
lux: number().min(0),
|
|
10278
|
+
/** Ms epoch when the slice was last updated. */
|
|
10279
|
+
lastFetchedAt: number(),
|
|
10280
|
+
/** Live display unit from the upstream source (e.g. HA
|
|
10281
|
+
* `attributes.unit_of_measurement`). The UI prefers this over the
|
|
10282
|
+
* role's canonical unit. Absent → fall back to the canonical unit. */
|
|
10283
|
+
unit: string().optional(),
|
|
10284
|
+
/** Suggested decimal places for numeric display.
|
|
10285
|
+
* Populated live from the upstream source when provided (e.g. HA
|
|
10286
|
+
* `attributes.suggested_display_precision`). Falls back to
|
|
10287
|
+
* auto-formatting when absent. */
|
|
10288
|
+
precision: number().int().min(0).max(10).optional()
|
|
10289
|
+
});
|
|
10290
|
+
DeviceType.Sensor;
|
|
10291
|
+
/**
|
|
10292
|
+
* Per-class audio metrics aggregated over a sliding window.
|
|
10293
|
+
*/
|
|
10294
|
+
var AudioClassSummarySchema = object({
|
|
10295
|
+
className: string(),
|
|
10296
|
+
/** Number of windows (chunks) where this class was the top hit. */
|
|
10297
|
+
hits: number().int().nonnegative(),
|
|
10298
|
+
/** Mean score across those hits, clamped to [0,1]. */
|
|
10299
|
+
avgScore: number().min(0).max(1),
|
|
10300
|
+
/** Peak score in the window. */
|
|
10301
|
+
peakScore: number().min(0).max(1)
|
|
10302
|
+
});
|
|
10303
|
+
/**
|
|
10304
|
+
* Per-camera audio metrics snapshot — emitted by the analytics frame
|
|
10305
|
+
* handler on every `pipeline.audio-inference-result` event and
|
|
10306
|
+
* mirrored into the `audio-metrics` device-state slice. Symmetric
|
|
10307
|
+
* with `zone-analytics` snapshots for video — every consumer
|
|
10308
|
+
* (admin UI panel, automations, alert rules) reads via the
|
|
10309
|
+
* canonical `device.state.audioMetrics.value` reactive handle.
|
|
10310
|
+
*
|
|
10311
|
+
* Aggregates are computed over a rolling `windowSec` window
|
|
10312
|
+
* (default 60s). Past that window, classes drop out of `byClass`
|
|
10313
|
+
* and the level history shifts forward.
|
|
10314
|
+
*/
|
|
10315
|
+
var AudioMetricsSnapshotSchema = object({
|
|
10316
|
+
/** Wall-clock timestamp (ms) of the most recent audio window. */
|
|
10317
|
+
ts: number().int(),
|
|
10318
|
+
/** Sliding-window length (seconds) used for aggregation. */
|
|
10319
|
+
windowSec: number().int().positive(),
|
|
10320
|
+
/** Latest level reading from the most recent window. */
|
|
10321
|
+
level: object({
|
|
10322
|
+
rms: number(),
|
|
10323
|
+
dbfs: number()
|
|
10324
|
+
}),
|
|
10325
|
+
/** Peak dBFS observed across the rolling window. */
|
|
10326
|
+
peakDbfs: number(),
|
|
10327
|
+
/** Mean dBFS across the rolling window. */
|
|
10328
|
+
avgDbfs: number(),
|
|
10329
|
+
/** Most recent above-threshold classification, or null on silence. */
|
|
10330
|
+
current: object({
|
|
10331
|
+
className: string(),
|
|
10332
|
+
score: number().min(0).max(1),
|
|
10333
|
+
timestamp: number().int()
|
|
10334
|
+
}).nullable(),
|
|
10335
|
+
/** Per-class summary across the rolling window — keys are
|
|
10336
|
+
* `macroClass` strings (e.g. `dog_bark`, `speech`, `glass_break`). */
|
|
10337
|
+
byClass: array(AudioClassSummarySchema).readonly()
|
|
10338
|
+
});
|
|
10339
|
+
/**
|
|
10340
|
+
* Audio-metrics history payload — a series of `AudioMetricsHistoryPoint`
|
|
10341
|
+
* samples capped at `maxPoints` (default 1024). When the requested
|
|
10342
|
+
* `windowSec / sampleEveryMs` would exceed the cap, the provider
|
|
10343
|
+
* subsamples by bucketed averaging and reports the effective sample
|
|
10344
|
+
* spacing on `effectiveSampleEveryMs` so the UI can label the x-axis.
|
|
10345
|
+
*/
|
|
10346
|
+
var AudioMetricsHistorySchema = object({
|
|
10347
|
+
points: array(object({
|
|
10348
|
+
/** Wall-clock ms when this sample was recorded. */
|
|
10349
|
+
ts: number().int(),
|
|
10350
|
+
/** Instantaneous dBFS level at sample time. `null` for windows where
|
|
10351
|
+
* the source had no level reading (rare; happens at decode startup). */
|
|
10352
|
+
dbfs: number().nullable(),
|
|
10353
|
+
/** Rolling-window peak dBFS at sample time. Same window the live
|
|
10354
|
+
* snapshot reports. */
|
|
10355
|
+
peakDbfs: number(),
|
|
10356
|
+
/** Rolling-window mean dBFS at sample time. */
|
|
10357
|
+
avgDbfs: number(),
|
|
10358
|
+
/** Dominant above-threshold class at sample time, or null on silence. */
|
|
10359
|
+
topClass: string().nullable(),
|
|
10360
|
+
/** Score of the dominant class (`null` whenever `topClass` is null). */
|
|
10361
|
+
topScore: number().min(0).max(1).nullable()
|
|
10362
|
+
})).readonly(),
|
|
10363
|
+
/** Actual ms between adjacent samples after any subsampling. */
|
|
10364
|
+
effectiveSampleEveryMs: number().int().positive(),
|
|
10365
|
+
/** Wall-clock window covered by `points` (`points[N-1].ts - points[0].ts`),
|
|
10366
|
+
* or `0` when there's fewer than 2 samples. */
|
|
10367
|
+
windowMsActual: number().int().nonnegative()
|
|
10368
|
+
});
|
|
10369
|
+
DeviceType.Camera, method(object({ deviceId: number() }), AudioMetricsSnapshotSchema.nullable()), method(object({
|
|
10370
|
+
deviceId: number(),
|
|
10371
|
+
/** History window in seconds. Default 300 (5 minutes).
|
|
10372
|
+
* Provider clamps to its retention cap if larger. */
|
|
10373
|
+
windowSec: number().int().positive().optional(),
|
|
10374
|
+
/** Target sample interval in ms. Default 1000 (1 sample/second).
|
|
10375
|
+
* Provider clamps to natural sample rate if smaller, and
|
|
10376
|
+
* bucket-averages when bigger than the requested window
|
|
10377
|
+
* would produce more than `maxPoints` samples. */
|
|
10378
|
+
sampleEveryMs: number().int().positive().optional()
|
|
10379
|
+
}), AudioMetricsHistorySchema);
|
|
10380
|
+
object({
|
|
10381
|
+
/** Whether the automation is currently enabled. Disabled automations
|
|
10382
|
+
* ignore their trigger block — manual `trigger` still works. */
|
|
10383
|
+
enabled: boolean(),
|
|
10384
|
+
/** Whether the automation is currently executing its action block. */
|
|
10385
|
+
isRunning: boolean(),
|
|
10386
|
+
/** Ms epoch of the last successful run. 0 when never run. */
|
|
10387
|
+
lastTriggeredAt: number(),
|
|
10388
|
+
/** Failure description from the last completed run. Null on success
|
|
10389
|
+
* or when never run. */
|
|
10390
|
+
lastError: string().nullable(),
|
|
10391
|
+
/** Ms epoch when the slice was last updated. */
|
|
10392
|
+
lastChangedAt: number()
|
|
10393
|
+
});
|
|
10394
|
+
DeviceType.Automation, method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
10395
|
+
kind: "mutation",
|
|
10396
|
+
auth: "admin"
|
|
10397
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
10398
|
+
kind: "mutation",
|
|
10399
|
+
auth: "admin"
|
|
10400
|
+
}), method(object({
|
|
10401
|
+
deviceId: number().int().nonnegative(),
|
|
10402
|
+
/** When true, fires the action block while bypassing the
|
|
10403
|
+
* automation's condition evaluation. Gated by
|
|
10404
|
+
* `DeviceFeature.AutomationSkipCondition`. */
|
|
10405
|
+
skipCondition: boolean().optional()
|
|
10406
|
+
}), _void(), {
|
|
10407
|
+
kind: "mutation",
|
|
10408
|
+
auth: "admin"
|
|
10409
|
+
});
|
|
10410
|
+
/**
|
|
10411
|
+
* Battery status snapshot. Emitted by providers whose device is
|
|
10412
|
+
* battery-operated (cameras with `DeviceFeature.BatteryOperated`,
|
|
10413
|
+
* future sensor/button accessories). Consumers build their own "low
|
|
10414
|
+
* battery" alerting on top — the cap deliberately does NOT enforce a
|
|
10415
|
+
* threshold.
|
|
10416
|
+
*/
|
|
10417
|
+
var BatteryStatusSchema = object({
|
|
10418
|
+
/** 0..100 inclusive. Firmware-reported. */
|
|
10419
|
+
percentage: number().min(0).max(100),
|
|
10420
|
+
/**
|
|
10421
|
+
* Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
|
|
10422
|
+
* Reolink-specific for the Solar Panel 2 accessory (will become
|
|
10423
|
+
* common on other battery cams). `'none'` means running on battery
|
|
10424
|
+
* alone.
|
|
10425
|
+
*/
|
|
10426
|
+
charging: _enum([
|
|
10427
|
+
"dc",
|
|
10428
|
+
"solar",
|
|
10429
|
+
"none"
|
|
10430
|
+
]),
|
|
10431
|
+
/**
|
|
10432
|
+
* True when the camera firmware has gone into low-power mode. Battery
|
|
10433
|
+
* providers MUST avoid polling during sleep — reading the battery
|
|
10434
|
+
* wakes the camera up and drains charge.
|
|
10435
|
+
*/
|
|
10436
|
+
sleeping: boolean(),
|
|
10437
|
+
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
10438
|
+
lastUpdated: number(),
|
|
10439
|
+
/**
|
|
10440
|
+
* True when the source is a BINARY low-battery indicator (HA
|
|
10441
|
+
* `binary_sensor` device_class=battery / `LOW_BAT`) that has no real
|
|
10442
|
+
* charge level — `percentage` is then a coarse stand-in (100 = normal,
|
|
10443
|
+
* sub-threshold = low). UI MUST render "Normal"/"Low" instead of a
|
|
10444
|
+
* misleading exact percentage. Absent/false → genuine 0–100 % reading.
|
|
10445
|
+
*/
|
|
10446
|
+
binary: boolean().optional()
|
|
10447
|
+
});
|
|
10448
|
+
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, method(object({
|
|
10449
|
+
deviceId: number(),
|
|
10450
|
+
/** Bound on the wait. Sensible range 3000–10000ms. */
|
|
10451
|
+
timeoutMs: number().int().min(500).max(3e4).default(8e3)
|
|
10452
|
+
}), object({
|
|
10453
|
+
awoke: boolean(),
|
|
10454
|
+
durationMs: number()
|
|
10455
|
+
}), { kind: "mutation" }), object({
|
|
10456
|
+
deviceId: number(),
|
|
10457
|
+
status: BatteryStatusSchema
|
|
10458
|
+
});
|
|
10459
|
+
object({
|
|
10460
|
+
on: boolean(),
|
|
10461
|
+
/** Ms epoch of the last transition. 0 if never observed. */
|
|
10462
|
+
lastChangedAt: number()
|
|
10463
|
+
});
|
|
10464
|
+
DeviceType.Sensor;
|
|
10465
|
+
object({
|
|
10466
|
+
/** Current level as 0..100 inclusive. Firmware-reported. */
|
|
10467
|
+
percentage: number().min(0).max(100),
|
|
10468
|
+
/** Ms epoch of the last operator-driven change. Useful for UI freshness. */
|
|
10469
|
+
lastChangedAt: number()
|
|
10470
|
+
});
|
|
10471
|
+
DeviceType.Light, method(object({
|
|
10472
|
+
deviceId: number().int().nonnegative(),
|
|
10473
|
+
percentage: number().min(0).max(100)
|
|
10474
|
+
}), _void(), {
|
|
10475
|
+
kind: "mutation",
|
|
10476
|
+
auth: "admin"
|
|
10477
|
+
}), object({
|
|
10478
|
+
deviceId: number(),
|
|
10479
|
+
percentage: number().min(0).max(100),
|
|
10480
|
+
lastChangedAt: number()
|
|
10481
|
+
});
|
|
10482
|
+
/** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
|
|
9845
10483
|
var StreamFormatSchema = _enum([
|
|
9846
10484
|
"webrtc",
|
|
9847
10485
|
"hls",
|
|
@@ -12878,84 +13516,23 @@ DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
|
12878
13516
|
lastChangedAt: number()
|
|
12879
13517
|
});
|
|
12880
13518
|
/**
|
|
12881
|
-
*
|
|
12882
|
-
* motion-
|
|
12883
|
-
*
|
|
12884
|
-
*
|
|
12885
|
-
*
|
|
12886
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
12887
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
12888
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
13519
|
+
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
13520
|
+
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
13521
|
+
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
13522
|
+
* a region keeps one drawing-plane model across all geometry caps.
|
|
12889
13523
|
*/
|
|
12890
|
-
/** A
|
|
12891
|
-
var
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
/** Axis-aligned rectangle (normalized 0..1). */
|
|
12896
|
-
var MaskRectShapeSchema = object({
|
|
12897
|
-
kind: literal("rect"),
|
|
12898
|
-
x: number(),
|
|
12899
|
-
y: number(),
|
|
12900
|
-
width: number(),
|
|
12901
|
-
height: number()
|
|
12902
|
-
});
|
|
12903
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
12904
|
-
var MaskPolygonShapeSchema = object({
|
|
12905
|
-
kind: literal("polygon"),
|
|
12906
|
-
points: array(MaskPointSchema)
|
|
13524
|
+
/** A motion-zone region — exactly one boolean cell grid today. */
|
|
13525
|
+
var MotionZoneRegionSchema = object({
|
|
13526
|
+
id: number(),
|
|
13527
|
+
enabled: boolean(),
|
|
13528
|
+
shape: MaskGridShapeSchema
|
|
12907
13529
|
});
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
});
|
|
12915
|
-
discriminatedUnion("kind", [
|
|
12916
|
-
MaskRectShapeSchema,
|
|
12917
|
-
MaskPolygonShapeSchema,
|
|
12918
|
-
MaskGridShapeSchema,
|
|
12919
|
-
object({
|
|
12920
|
-
kind: literal("line"),
|
|
12921
|
-
points: array(MaskPointSchema)
|
|
12922
|
-
})
|
|
12923
|
-
]);
|
|
12924
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
12925
|
-
var MaskShapeKindSchema = _enum([
|
|
12926
|
-
"rect",
|
|
12927
|
-
"polygon",
|
|
12928
|
-
"grid",
|
|
12929
|
-
"line"
|
|
12930
|
-
]);
|
|
12931
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
12932
|
-
var MaskPolygonVerticesSchema = object({
|
|
12933
|
-
min: number(),
|
|
12934
|
-
max: number()
|
|
12935
|
-
});
|
|
12936
|
-
/** Grid dimensions when a cap supports 'grid'. */
|
|
12937
|
-
var MaskGridDimsSchema = object({
|
|
12938
|
-
width: number(),
|
|
12939
|
-
height: number()
|
|
12940
|
-
});
|
|
12941
|
-
/**
|
|
12942
|
-
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
12943
|
-
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
12944
|
-
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
12945
|
-
* a region keeps one drawing-plane model across all geometry caps.
|
|
12946
|
-
*/
|
|
12947
|
-
/** A motion-zone region — exactly one boolean cell grid today. */
|
|
12948
|
-
var MotionZoneRegionSchema = object({
|
|
12949
|
-
id: number(),
|
|
12950
|
-
enabled: boolean(),
|
|
12951
|
-
shape: MaskGridShapeSchema
|
|
12952
|
-
});
|
|
12953
|
-
object({
|
|
12954
|
-
enabled: boolean(),
|
|
12955
|
-
sensitivity: number(),
|
|
12956
|
-
/** Grid region(s). Today exactly one `grid` shape. */
|
|
12957
|
-
regions: array(MotionZoneRegionSchema),
|
|
12958
|
-
lastFetchedAt: number()
|
|
13530
|
+
object({
|
|
13531
|
+
enabled: boolean(),
|
|
13532
|
+
sensitivity: number(),
|
|
13533
|
+
/** Grid region(s). Today exactly one `grid` shape. */
|
|
13534
|
+
regions: array(MotionZoneRegionSchema),
|
|
13535
|
+
lastFetchedAt: number()
|
|
12959
13536
|
});
|
|
12960
13537
|
/** Per-camera availability — grid dims are fixed per camera model; the UI
|
|
12961
13538
|
* sizes its editor from `grid`. */
|
|
@@ -14965,6 +15542,55 @@ method(object({
|
|
|
14965
15542
|
password: string()
|
|
14966
15543
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
14967
15544
|
/**
|
|
15545
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
15546
|
+
* NOT flow through the capability — they use the addon data plane
|
|
15547
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
15548
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
15549
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
15550
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
15551
|
+
*/
|
|
15552
|
+
var TerminalSessionInfoSchema = object({
|
|
15553
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
15554
|
+
sessionId: string(),
|
|
15555
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
15556
|
+
profileId: string(),
|
|
15557
|
+
/** Human-readable profile label for the UI session list. */
|
|
15558
|
+
label: string(),
|
|
15559
|
+
cols: number().int().positive(),
|
|
15560
|
+
rows: number().int().positive(),
|
|
15561
|
+
/** ms-epoch the session's pty was spawned. */
|
|
15562
|
+
startedAt: number()
|
|
15563
|
+
});
|
|
15564
|
+
/**
|
|
15565
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
15566
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
15567
|
+
* command string would be remote code execution as the server's user, so it is
|
|
15568
|
+
* deliberately not part of the contract.
|
|
15569
|
+
*/
|
|
15570
|
+
var TerminalProfileInfoSchema = object({
|
|
15571
|
+
profileId: string(),
|
|
15572
|
+
label: string(),
|
|
15573
|
+
description: string().optional()
|
|
15574
|
+
});
|
|
15575
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
15576
|
+
profileId: string(),
|
|
15577
|
+
cols: number().int().positive(),
|
|
15578
|
+
rows: number().int().positive()
|
|
15579
|
+
}), TerminalSessionInfoSchema, {
|
|
15580
|
+
kind: "mutation",
|
|
15581
|
+
auth: "admin"
|
|
15582
|
+
}), method(object({
|
|
15583
|
+
sessionId: string(),
|
|
15584
|
+
cols: number().int().positive(),
|
|
15585
|
+
rows: number().int().positive()
|
|
15586
|
+
}), _void(), {
|
|
15587
|
+
kind: "mutation",
|
|
15588
|
+
auth: "admin"
|
|
15589
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
15590
|
+
kind: "mutation",
|
|
15591
|
+
auth: "admin"
|
|
15592
|
+
});
|
|
15593
|
+
/**
|
|
14968
15594
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
14969
15595
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
14970
15596
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -15974,1809 +16600,1321 @@ var StreamProbeResultSchema = object({
|
|
|
15974
16600
|
codec: string().optional(),
|
|
15975
16601
|
fps: number().optional(),
|
|
15976
16602
|
bitrateKbps: number().optional()
|
|
15977
|
-
});
|
|
15978
|
-
var DeviceRegisterPayloadSchema = object({
|
|
15979
|
-
addonId: string(),
|
|
15980
|
-
stableId: string(),
|
|
15981
|
-
/** Pre-allocated numeric id from `allocateDeviceId`. The hub persists
|
|
15982
|
-
* it alongside the meta record; callers never invent this value. */
|
|
15983
|
-
id: number(),
|
|
15984
|
-
type: string(),
|
|
15985
|
-
name: string(),
|
|
15986
|
-
/** Operator-organisational location label. Optional on register —
|
|
15987
|
-
* the hub seeds `null` when omitted. */
|
|
15988
|
-
location: string().nullable().optional(),
|
|
15989
|
-
/** Soft-disabled flag. Optional on register — the hub seeds `false`. */
|
|
15990
|
-
disabled: boolean().optional(),
|
|
15991
|
-
parentDeviceId: number().nullable(),
|
|
15992
|
-
/** Optional semantic role — see `DeviceRole`. Driver authors pass this
|
|
15993
|
-
* at register time when the device is an accessory with a known role. */
|
|
15994
|
-
role: string().nullable().optional(),
|
|
15995
|
-
/** Snapshot of `device.features` at registration time. Persisted in
|
|
15996
|
-
* `DeviceMeta` so the hub can answer `getDevice` for forked-worker
|
|
15997
|
-
* devices with the right `DeviceFeature[]` even when the live
|
|
15998
|
-
* instance lives on a remote node. Re-published on every register
|
|
15999
|
-
* call (workers re-register on init), so probe-driven updates
|
|
16000
|
-
* (e.g. PTZ flag flipping after the abilities probe) propagate. */
|
|
16001
|
-
features: array(string()).optional(),
|
|
16002
|
-
config: record(string(), unknown())
|
|
16003
|
-
});
|
|
16004
|
-
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
16005
|
-
var DevicePersistConfigPayloadSchema = object({
|
|
16006
|
-
deviceId: number(),
|
|
16007
|
-
data: record(string(), unknown())
|
|
16008
|
-
});
|
|
16009
|
-
method(object({
|
|
16010
|
-
addonId: string(),
|
|
16011
|
-
stableId: string()
|
|
16012
|
-
}), object({ id: number() }), { kind: "mutation" }), method(DeviceRegisterPayloadSchema, _void(), { kind: "mutation" }), method(DeviceRemovePayloadSchema, _void(), { kind: "mutation" }), method(DevicePersistConfigPayloadSchema, _void(), { kind: "mutation" }), method(object({ deviceId: number() }), record(string(), unknown())), method(object({ deviceId: number() }), record(string(), unknown())), method(object({ deviceId: number() }), DeviceMetaSchema.nullable()), method(object({
|
|
16013
|
-
deviceId: number(),
|
|
16014
|
-
name: string()
|
|
16015
|
-
}), _void(), {
|
|
16016
|
-
kind: "mutation",
|
|
16017
|
-
auth: "admin"
|
|
16018
|
-
}), method(object({
|
|
16019
|
-
deviceId: number(),
|
|
16020
|
-
location: string().nullable()
|
|
16021
|
-
}), _void(), {
|
|
16022
|
-
kind: "mutation",
|
|
16023
|
-
auth: "admin"
|
|
16024
|
-
}), method(object({
|
|
16025
|
-
deviceId: number(),
|
|
16026
|
-
type: _enum(DeviceType)
|
|
16027
|
-
}), _void(), {
|
|
16028
|
-
kind: "mutation",
|
|
16029
|
-
auth: "admin"
|
|
16030
|
-
}), method(object({
|
|
16031
|
-
deviceId: number(),
|
|
16032
|
-
integrationId: string()
|
|
16033
|
-
}), _void(), {
|
|
16034
|
-
kind: "mutation",
|
|
16035
|
-
auth: "admin"
|
|
16036
|
-
}), method(object({
|
|
16037
|
-
deviceId: number(),
|
|
16038
|
-
linkDeviceId: number().nullable()
|
|
16039
|
-
}), _void(), {
|
|
16040
|
-
kind: "mutation",
|
|
16041
|
-
auth: "admin"
|
|
16042
|
-
}), method(object({
|
|
16043
|
-
deviceId: number(),
|
|
16044
|
-
primaryChildEntityId: string().nullable()
|
|
16045
|
-
}), _void(), {
|
|
16046
|
-
kind: "mutation",
|
|
16047
|
-
auth: "admin"
|
|
16048
|
-
}), method(object({
|
|
16049
|
-
deviceId: number(),
|
|
16050
|
-
childLayout: array(ChildLayoutEntrySchema).readonly()
|
|
16051
|
-
}), _void(), {
|
|
16052
|
-
kind: "mutation",
|
|
16053
|
-
auth: "admin"
|
|
16054
|
-
}), method(object({
|
|
16055
|
-
deviceId: number(),
|
|
16056
|
-
deviceLinks: array(DeviceLinkSchema).readonly()
|
|
16057
|
-
}), _void(), {
|
|
16058
|
-
kind: "mutation",
|
|
16059
|
-
auth: "admin"
|
|
16060
|
-
}), method(object({
|
|
16061
|
-
deviceId: number(),
|
|
16062
|
-
display: DeviceDisplayOverrideSchema.nullable()
|
|
16063
|
-
}), _void(), {
|
|
16064
|
-
kind: "mutation",
|
|
16065
|
-
auth: "admin"
|
|
16066
|
-
}), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
|
|
16067
|
-
kind: "mutation",
|
|
16068
|
-
auth: "admin"
|
|
16069
|
-
}), method(object({
|
|
16070
|
-
deviceId: number(),
|
|
16071
|
-
includeSynthesizable: boolean().optional()
|
|
16072
|
-
}), object({ caps: array(object({
|
|
16073
|
-
cap: string(),
|
|
16074
|
-
fields: array(object({
|
|
16075
|
-
path: string(),
|
|
16076
|
-
kind: _enum([
|
|
16077
|
-
"string",
|
|
16078
|
-
"number",
|
|
16079
|
-
"boolean",
|
|
16080
|
-
"enum"
|
|
16081
|
-
]),
|
|
16082
|
-
enumValues: array(string()).optional(),
|
|
16083
|
-
item: boolean().optional()
|
|
16084
|
-
})).readonly(),
|
|
16085
|
-
itemArray: object({
|
|
16086
|
-
path: string(),
|
|
16087
|
-
keyField: string()
|
|
16088
|
-
}).optional()
|
|
16089
|
-
})).readonly() }), { kind: "query" }), method(object({
|
|
16090
|
-
deviceId: number(),
|
|
16091
|
-
role: string().nullable()
|
|
16092
|
-
}), _void(), {
|
|
16093
|
-
kind: "mutation",
|
|
16094
|
-
auth: "admin"
|
|
16095
|
-
}), method(object({
|
|
16096
|
-
deviceId: number(),
|
|
16097
|
-
name: string().optional(),
|
|
16098
|
-
location: string().nullable().optional(),
|
|
16099
|
-
type: _enum(DeviceType).optional(),
|
|
16100
|
-
integrationId: string().optional(),
|
|
16101
|
-
linkDeviceId: number().nullable().optional(),
|
|
16102
|
-
role: string().nullable().optional()
|
|
16103
|
-
}), _void(), {
|
|
16104
|
-
kind: "mutation",
|
|
16105
|
-
auth: "admin"
|
|
16106
|
-
}), method(object({
|
|
16107
|
-
deviceId: number(),
|
|
16108
|
-
patch: record(string(), unknown())
|
|
16109
|
-
}), _void(), {
|
|
16110
|
-
kind: "mutation",
|
|
16111
|
-
auth: "admin"
|
|
16112
|
-
}), method(_void(), array(string())), method(object({ name: string() }), _void(), {
|
|
16113
|
-
kind: "mutation",
|
|
16114
|
-
auth: "admin"
|
|
16115
|
-
}), method(object({
|
|
16116
|
-
name: string(),
|
|
16117
|
-
cascade: boolean().optional()
|
|
16118
|
-
}), _void(), {
|
|
16119
|
-
kind: "mutation",
|
|
16120
|
-
auth: "admin"
|
|
16121
|
-
}), method(object({
|
|
16122
|
-
deviceId: number(),
|
|
16123
|
-
disabled: boolean()
|
|
16124
|
-
}), _void(), {
|
|
16125
|
-
kind: "mutation",
|
|
16126
|
-
auth: "admin"
|
|
16127
|
-
}), method(object({ addonId: string() }), array(SavedDeviceRowSchema)), method(object({ addonId: string().optional() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
|
|
16128
|
-
mode: DeviceLinkModeSchema,
|
|
16129
|
-
devices: array(LinkedDeviceSchema)
|
|
16130
|
-
})), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
|
|
16131
|
-
deviceId: number(),
|
|
16132
|
-
values: record(string(), unknown())
|
|
16133
|
-
}), object({ success: literal(true) }), {
|
|
16134
|
-
kind: "mutation",
|
|
16135
|
-
auth: "admin"
|
|
16136
|
-
}), method(object({ deviceId: number() }), object({ success: literal(true) }), {
|
|
16137
|
-
kind: "mutation",
|
|
16138
|
-
auth: "admin"
|
|
16139
|
-
}), method(object({ deviceId: number() }), object({ success: literal(true) }), {
|
|
16140
|
-
kind: "mutation",
|
|
16141
|
-
auth: "admin"
|
|
16142
|
-
}), method(object({ deviceId: number() }), object({ success: literal(true) }), {
|
|
16143
|
-
kind: "mutation",
|
|
16144
|
-
auth: "admin"
|
|
16145
|
-
}), method(object({ integrationId: string() }), object({ removed: number() }), {
|
|
16146
|
-
kind: "mutation",
|
|
16147
|
-
auth: "admin"
|
|
16148
|
-
}), method(object({ deviceId: number() }), record(string(), string().nullable())), method(object({
|
|
16149
|
-
deviceId: number(),
|
|
16150
|
-
profileMap: record(string(), string().nullable())
|
|
16151
|
-
}), object({ success: literal(true) }), {
|
|
16152
|
-
kind: "mutation",
|
|
16153
|
-
auth: "admin"
|
|
16154
|
-
}), method(object({ deviceId: number() }), array(StreamProbeResultSchema), {
|
|
16155
|
-
kind: "mutation",
|
|
16156
|
-
auth: "admin"
|
|
16157
|
-
}), method(object({ deviceId: number() }), object({
|
|
16158
|
-
deviceId: number(),
|
|
16159
|
-
entries: array(object({
|
|
16160
|
-
capName: string(),
|
|
16161
|
-
kind: _enum([
|
|
16162
|
-
"native",
|
|
16163
|
-
"wrapped",
|
|
16164
|
-
"linked"
|
|
16165
|
-
]),
|
|
16166
|
-
providerAddonId: string(),
|
|
16167
|
-
providerNodeId: string(),
|
|
16168
|
-
nativeAddonId: string()
|
|
16169
|
-
}))
|
|
16170
|
-
})), method(object({}), array(object({
|
|
16171
|
-
deviceId: number(),
|
|
16172
|
-
entries: array(object({
|
|
16173
|
-
capName: string(),
|
|
16174
|
-
kind: _enum([
|
|
16175
|
-
"native",
|
|
16176
|
-
"wrapped",
|
|
16177
|
-
"linked"
|
|
16178
|
-
]),
|
|
16179
|
-
providerAddonId: string(),
|
|
16180
|
-
providerNodeId: string(),
|
|
16181
|
-
nativeAddonId: string()
|
|
16182
|
-
}))
|
|
16183
|
-
}))), method(object({
|
|
16184
|
-
deviceId: number(),
|
|
16185
|
-
capName: string(),
|
|
16186
|
-
wrapperAddonId: string(),
|
|
16187
|
-
active: boolean()
|
|
16188
|
-
}), _void(), {
|
|
16189
|
-
kind: "mutation",
|
|
16190
|
-
auth: "admin"
|
|
16191
|
-
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
16192
|
-
capName: string(),
|
|
16193
|
-
wrappers: array(string())
|
|
16194
|
-
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
16195
|
-
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
16196
|
-
live: SettingsSchemaWithValuesSchema.nullable()
|
|
16197
|
-
})), method(object({
|
|
16198
|
-
deviceId: number().int().nonnegative(),
|
|
16199
|
-
action: string().min(1),
|
|
16200
|
-
input: unknown()
|
|
16201
|
-
}), unknown(), { kind: "mutation" }), method(object({
|
|
16202
|
-
deviceId: number(),
|
|
16203
|
-
writerCapName: string(),
|
|
16204
|
-
writerAddonId: string(),
|
|
16205
|
-
key: string(),
|
|
16206
|
-
value: unknown()
|
|
16207
|
-
}), object({ success: literal(true) }), {
|
|
16208
|
-
kind: "mutation",
|
|
16209
|
-
auth: "admin"
|
|
16210
|
-
}), method(object({
|
|
16211
|
-
deviceId: number(),
|
|
16212
|
-
changes: array(object({
|
|
16213
|
-
writerCapName: string(),
|
|
16214
|
-
writerAddonId: string(),
|
|
16215
|
-
key: string(),
|
|
16216
|
-
value: unknown()
|
|
16217
|
-
}))
|
|
16218
|
-
}), object({
|
|
16219
|
-
success: literal(true),
|
|
16220
|
-
failures: array(object({
|
|
16221
|
-
writerCapName: string(),
|
|
16222
|
-
writerAddonId: string(),
|
|
16223
|
-
error: string()
|
|
16224
|
-
}))
|
|
16225
|
-
}), {
|
|
16226
|
-
kind: "mutation",
|
|
16227
|
-
auth: "admin"
|
|
16228
|
-
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
16229
|
-
kind: "mutation",
|
|
16230
|
-
auth: "admin"
|
|
16231
|
-
}), method(object({
|
|
16232
|
-
addonId: string(),
|
|
16233
|
-
candidate: DiscoveryCandidateSchema,
|
|
16234
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
16235
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
16236
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
16237
|
-
integrationId: string().optional()
|
|
16238
|
-
}), DeviceSummarySchema, {
|
|
16239
|
-
kind: "mutation",
|
|
16240
|
-
auth: "admin"
|
|
16241
|
-
}), method(object({
|
|
16242
|
-
addonId: string(),
|
|
16243
|
-
type: _enum(DeviceType)
|
|
16244
|
-
}), unknown().nullable()), method(object({
|
|
16245
|
-
addonId: string(),
|
|
16246
|
-
type: _enum(DeviceType),
|
|
16247
|
-
config: record(string(), unknown()),
|
|
16248
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
16249
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
16250
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
16251
|
-
integrationId: string().optional()
|
|
16252
|
-
}), DeviceSummarySchema, {
|
|
16253
|
-
kind: "mutation",
|
|
16254
|
-
auth: "admin"
|
|
16255
|
-
}), method(object({
|
|
16256
|
-
addonId: string(),
|
|
16257
|
-
type: _enum(DeviceType),
|
|
16258
|
-
key: string(),
|
|
16259
|
-
value: unknown(),
|
|
16260
|
-
formValues: record(string(), unknown()).optional()
|
|
16261
|
-
}), FieldProbeResultSchema, {
|
|
16262
|
-
kind: "mutation",
|
|
16263
|
-
auth: "admin"
|
|
16264
|
-
}), method(object({
|
|
16265
|
-
addonId: string(),
|
|
16266
|
-
integrationId: string()
|
|
16267
|
-
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
16268
|
-
addonId: string(),
|
|
16269
|
-
integrationId: string()
|
|
16270
|
-
}), AdoptionStatusSchema, {
|
|
16271
|
-
kind: "mutation",
|
|
16272
|
-
auth: "admin"
|
|
16273
|
-
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
16274
|
-
kind: "mutation",
|
|
16275
|
-
auth: "admin"
|
|
16276
|
-
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
16277
|
-
kind: "mutation",
|
|
16278
|
-
auth: "admin"
|
|
16279
|
-
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
16280
|
-
kind: "mutation",
|
|
16281
|
-
auth: "admin"
|
|
16282
|
-
}), method(object({}), object({ providers: array(object({
|
|
16603
|
+
});
|
|
16604
|
+
var DeviceRegisterPayloadSchema = object({
|
|
16283
16605
|
addonId: string(),
|
|
16284
|
-
|
|
16285
|
-
|
|
16606
|
+
stableId: string(),
|
|
16607
|
+
/** Pre-allocated numeric id from `allocateDeviceId`. The hub persists
|
|
16608
|
+
* it alongside the meta record; callers never invent this value. */
|
|
16609
|
+
id: number(),
|
|
16610
|
+
type: string(),
|
|
16611
|
+
name: string(),
|
|
16612
|
+
/** Operator-organisational location label. Optional on register —
|
|
16613
|
+
* the hub seeds `null` when omitted. */
|
|
16614
|
+
location: string().nullable().optional(),
|
|
16615
|
+
/** Soft-disabled flag. Optional on register — the hub seeds `false`. */
|
|
16616
|
+
disabled: boolean().optional(),
|
|
16617
|
+
parentDeviceId: number().nullable(),
|
|
16618
|
+
/** Optional semantic role — see `DeviceRole`. Driver authors pass this
|
|
16619
|
+
* at register time when the device is an accessory with a known role. */
|
|
16620
|
+
role: string().nullable().optional(),
|
|
16621
|
+
/** Snapshot of `device.features` at registration time. Persisted in
|
|
16622
|
+
* `DeviceMeta` so the hub can answer `getDevice` for forked-worker
|
|
16623
|
+
* devices with the right `DeviceFeature[]` even when the live
|
|
16624
|
+
* instance lives on a remote node. Re-published on every register
|
|
16625
|
+
* call (workers re-register on init), so probe-driven updates
|
|
16626
|
+
* (e.g. PTZ flag flipping after the abilities probe) propagate. */
|
|
16627
|
+
features: array(string()).optional(),
|
|
16628
|
+
config: record(string(), unknown())
|
|
16629
|
+
});
|
|
16630
|
+
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
16631
|
+
var DevicePersistConfigPayloadSchema = object({
|
|
16632
|
+
deviceId: number(),
|
|
16633
|
+
data: record(string(), unknown())
|
|
16634
|
+
});
|
|
16635
|
+
method(object({
|
|
16286
16636
|
addonId: string(),
|
|
16287
|
-
|
|
16288
|
-
|
|
16289
|
-
|
|
16290
|
-
|
|
16637
|
+
stableId: string()
|
|
16638
|
+
}), object({ id: number() }), { kind: "mutation" }), method(DeviceRegisterPayloadSchema, _void(), { kind: "mutation" }), method(DeviceRemovePayloadSchema, _void(), { kind: "mutation" }), method(DevicePersistConfigPayloadSchema, _void(), { kind: "mutation" }), method(object({ deviceId: number() }), record(string(), unknown())), method(object({ deviceId: number() }), record(string(), unknown())), method(object({ deviceId: number() }), DeviceMetaSchema.nullable()), method(object({
|
|
16639
|
+
deviceId: number(),
|
|
16640
|
+
name: string()
|
|
16641
|
+
}), _void(), {
|
|
16291
16642
|
kind: "mutation",
|
|
16292
16643
|
auth: "admin"
|
|
16293
16644
|
}), method(object({
|
|
16294
|
-
addonId: string(),
|
|
16295
|
-
params: record(string(), unknown()).optional()
|
|
16296
|
-
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
16297
|
-
kind: "mutation",
|
|
16298
|
-
auth: "admin"
|
|
16299
|
-
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
16300
16645
|
deviceId: number(),
|
|
16301
|
-
|
|
16302
|
-
|
|
16303
|
-
}), FieldProbeResultSchema, {
|
|
16646
|
+
location: string().nullable()
|
|
16647
|
+
}), _void(), {
|
|
16304
16648
|
kind: "mutation",
|
|
16305
16649
|
auth: "admin"
|
|
16306
16650
|
}), method(object({
|
|
16307
16651
|
deviceId: number(),
|
|
16308
|
-
|
|
16309
|
-
}),
|
|
16310
|
-
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
16311
|
-
deviceId: number(),
|
|
16312
|
-
capName: string()
|
|
16313
|
-
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
16314
|
-
deviceId: number(),
|
|
16315
|
-
capName: string(),
|
|
16316
|
-
slice: record(string(), unknown())
|
|
16317
|
-
}), _void(), { kind: "mutation" }), object({
|
|
16318
|
-
deviceId: number(),
|
|
16319
|
-
capName: string(),
|
|
16320
|
-
slice: record(string(), unknown())
|
|
16321
|
-
});
|
|
16322
|
-
/**
|
|
16323
|
-
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
16324
|
-
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
16325
|
-
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
16326
|
-
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
16327
|
-
* post-analysis enrichment-engine.
|
|
16328
|
-
*/
|
|
16329
|
-
var EmbeddingResultSchema = object({
|
|
16330
|
-
embedding: array(number()),
|
|
16331
|
-
inferenceMs: number()
|
|
16332
|
-
});
|
|
16333
|
-
var EmbeddingInfoSchema = object({
|
|
16334
|
-
modelId: string(),
|
|
16335
|
-
embeddingDim: number(),
|
|
16336
|
-
ready: boolean()
|
|
16337
|
-
});
|
|
16338
|
-
method(object({
|
|
16339
|
-
crop: _instanceof(Uint8Array),
|
|
16340
|
-
width: number(),
|
|
16341
|
-
height: number()
|
|
16342
|
-
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
16343
|
-
/**
|
|
16344
|
-
* filesystem-browse — per-node capability for browsing the node's local
|
|
16345
|
-
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
16346
|
-
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
16347
|
-
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
16348
|
-
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
16349
|
-
*/
|
|
16350
|
-
var DirEntrySchema = object({
|
|
16351
|
-
name: string(),
|
|
16352
|
-
path: string()
|
|
16353
|
-
});
|
|
16354
|
-
var BrowseResultSchema = object({
|
|
16355
|
-
path: string(),
|
|
16356
|
-
entries: array(DirEntrySchema).readonly(),
|
|
16357
|
-
freeBytes: number(),
|
|
16358
|
-
totalBytes: number()
|
|
16359
|
-
});
|
|
16360
|
-
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
16652
|
+
type: _enum(DeviceType)
|
|
16653
|
+
}), _void(), {
|
|
16361
16654
|
kind: "mutation",
|
|
16362
|
-
auth: "admin"
|
|
16363
|
-
})
|
|
16364
|
-
|
|
16365
|
-
|
|
16366
|
-
|
|
16367
|
-
* caps stay wire-compatible without a circular cap→cap import.
|
|
16368
|
-
*
|
|
16369
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
16370
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
16371
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
16372
|
-
*/
|
|
16373
|
-
var LlmUsageSchema = object({
|
|
16374
|
-
inputTokens: number(),
|
|
16375
|
-
outputTokens: number()
|
|
16376
|
-
});
|
|
16377
|
-
var LlmErrorCodeSchema = _enum([
|
|
16378
|
-
"timeout",
|
|
16379
|
-
"rate-limited",
|
|
16380
|
-
"auth",
|
|
16381
|
-
"refusal",
|
|
16382
|
-
"bad-request",
|
|
16383
|
-
"unavailable",
|
|
16384
|
-
"no-profile",
|
|
16385
|
-
"budget-exceeded",
|
|
16386
|
-
"adapter-error"
|
|
16387
|
-
]);
|
|
16388
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
16389
|
-
ok: literal(true),
|
|
16390
|
-
text: string(),
|
|
16391
|
-
model: string(),
|
|
16392
|
-
usage: LlmUsageSchema,
|
|
16393
|
-
truncated: boolean(),
|
|
16394
|
-
latencyMs: number()
|
|
16395
|
-
}), object({
|
|
16396
|
-
ok: literal(false),
|
|
16397
|
-
code: LlmErrorCodeSchema,
|
|
16398
|
-
message: string(),
|
|
16399
|
-
retryAfterMs: number().optional()
|
|
16400
|
-
})]);
|
|
16401
|
-
/**
|
|
16402
|
-
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
16403
|
-
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
16404
|
-
* notification-output.cap.ts:27-31 precedents).
|
|
16405
|
-
*/
|
|
16406
|
-
var LlmImageSchema = object({
|
|
16407
|
-
bytes: _instanceof(Uint8Array),
|
|
16408
|
-
mimeType: string()
|
|
16409
|
-
});
|
|
16410
|
-
var LlmGenerateBaseInputSchema = object({
|
|
16411
|
-
/** Collection routing (the notification-output posture). */
|
|
16412
|
-
addonId: string().optional(),
|
|
16413
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
16414
|
-
profileId: string().optional(),
|
|
16415
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
16416
|
-
consumer: string(),
|
|
16417
|
-
system: string().optional(),
|
|
16418
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
16419
|
-
prompt: string(),
|
|
16420
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
16421
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
16422
|
-
/** Per-call override of the profile default. */
|
|
16423
|
-
maxTokens: number().int().positive().optional(),
|
|
16424
|
-
temperature: number().optional()
|
|
16425
|
-
});
|
|
16426
|
-
/**
|
|
16427
|
-
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
16428
|
-
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
16429
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
16430
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
16431
|
-
* this only through the `llm` cap's methods.
|
|
16432
|
-
*
|
|
16433
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
16434
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
16435
|
-
* watchdog — operator decision #3).
|
|
16436
|
-
*/
|
|
16437
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
16438
|
-
object({
|
|
16439
|
-
kind: literal("catalog"),
|
|
16440
|
-
catalogId: string()
|
|
16441
|
-
}),
|
|
16442
|
-
object({
|
|
16443
|
-
kind: literal("url"),
|
|
16444
|
-
url: string(),
|
|
16445
|
-
sha256: string().optional()
|
|
16446
|
-
}),
|
|
16447
|
-
object({
|
|
16448
|
-
kind: literal("path"),
|
|
16449
|
-
path: string()
|
|
16450
|
-
})
|
|
16451
|
-
]);
|
|
16452
|
-
var ManagedRuntimeConfigSchema = object({
|
|
16453
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
16454
|
-
nodeId: string(),
|
|
16455
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
16456
|
-
engine: _enum(["llama-cpp"]),
|
|
16457
|
-
model: ManagedModelRefSchema,
|
|
16458
|
-
contextSize: number().int().default(4096),
|
|
16459
|
-
/** 0 = CPU-only. */
|
|
16460
|
-
gpuLayers: number().int().default(0),
|
|
16461
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
16462
|
-
threads: number().int().optional(),
|
|
16463
|
-
/** Concurrent slots. */
|
|
16464
|
-
parallel: number().int().default(1),
|
|
16465
|
-
/** Else lazy: first generate boots it. */
|
|
16466
|
-
autoStart: boolean().default(false),
|
|
16467
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
16468
|
-
idleStopMinutes: number().int().default(30)
|
|
16469
|
-
});
|
|
16470
|
-
var LlmRuntimeStatusSchema = object({
|
|
16471
|
-
/** Status is ALWAYS node-qualified. */
|
|
16472
|
-
nodeId: string(),
|
|
16473
|
-
state: _enum([
|
|
16474
|
-
"stopped",
|
|
16475
|
-
"downloading",
|
|
16476
|
-
"starting",
|
|
16477
|
-
"ready",
|
|
16478
|
-
"crashed",
|
|
16479
|
-
"failed"
|
|
16480
|
-
]),
|
|
16481
|
-
pid: number().optional(),
|
|
16482
|
-
port: number().optional(),
|
|
16483
|
-
modelPath: string().optional(),
|
|
16484
|
-
modelId: string().optional(),
|
|
16485
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
16486
|
-
lastError: string().optional(),
|
|
16487
|
-
crashesInWindow: number(),
|
|
16488
|
-
/** Child RSS (sampled best-effort). */
|
|
16489
|
-
memoryBytes: number().optional(),
|
|
16490
|
-
vramBytes: number().optional()
|
|
16491
|
-
});
|
|
16492
|
-
var LlmNodeModelSchema = object({
|
|
16493
|
-
file: string(),
|
|
16494
|
-
sizeBytes: number(),
|
|
16495
|
-
catalogId: string().optional(),
|
|
16496
|
-
installedAt: number().optional()
|
|
16497
|
-
});
|
|
16498
|
-
var LlmRuntimeDiskUsageSchema = object({
|
|
16499
|
-
nodeId: string(),
|
|
16500
|
-
modelsBytes: number(),
|
|
16501
|
-
freeBytes: number().optional()
|
|
16502
|
-
});
|
|
16503
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
16504
|
-
images: array(LlmImageSchema).optional(),
|
|
16505
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
16506
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
16507
|
-
timeoutMs: number().int().positive().optional()
|
|
16508
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
16655
|
+
auth: "admin"
|
|
16656
|
+
}), method(object({
|
|
16657
|
+
deviceId: number(),
|
|
16658
|
+
integrationId: string()
|
|
16659
|
+
}), _void(), {
|
|
16509
16660
|
kind: "mutation",
|
|
16510
16661
|
auth: "admin"
|
|
16511
|
-
}), method(object({
|
|
16662
|
+
}), method(object({
|
|
16663
|
+
deviceId: number(),
|
|
16664
|
+
linkDeviceId: number().nullable()
|
|
16665
|
+
}), _void(), {
|
|
16512
16666
|
kind: "mutation",
|
|
16513
16667
|
auth: "admin"
|
|
16514
|
-
}), method(object({
|
|
16668
|
+
}), method(object({
|
|
16669
|
+
deviceId: number(),
|
|
16670
|
+
primaryChildEntityId: string().nullable()
|
|
16671
|
+
}), _void(), {
|
|
16515
16672
|
kind: "mutation",
|
|
16516
16673
|
auth: "admin"
|
|
16517
|
-
}), method(object({
|
|
16674
|
+
}), method(object({
|
|
16675
|
+
deviceId: number(),
|
|
16676
|
+
childLayout: array(ChildLayoutEntrySchema).readonly()
|
|
16677
|
+
}), _void(), {
|
|
16518
16678
|
kind: "mutation",
|
|
16519
16679
|
auth: "admin"
|
|
16520
|
-
}), method(object({
|
|
16521
|
-
|
|
16522
|
-
|
|
16523
|
-
|
|
16524
|
-
|
|
16525
|
-
|
|
16526
|
-
|
|
16527
|
-
|
|
16528
|
-
|
|
16529
|
-
|
|
16530
|
-
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
"
|
|
16534
|
-
"
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
|
|
16539
|
-
|
|
16540
|
-
|
|
16680
|
+
}), method(object({
|
|
16681
|
+
deviceId: number(),
|
|
16682
|
+
deviceLinks: array(DeviceLinkSchema).readonly()
|
|
16683
|
+
}), _void(), {
|
|
16684
|
+
kind: "mutation",
|
|
16685
|
+
auth: "admin"
|
|
16686
|
+
}), method(object({
|
|
16687
|
+
deviceId: number(),
|
|
16688
|
+
display: DeviceDisplayOverrideSchema.nullable()
|
|
16689
|
+
}), _void(), {
|
|
16690
|
+
kind: "mutation",
|
|
16691
|
+
auth: "admin"
|
|
16692
|
+
}), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
|
|
16693
|
+
kind: "mutation",
|
|
16694
|
+
auth: "admin"
|
|
16695
|
+
}), method(object({
|
|
16696
|
+
deviceId: number(),
|
|
16697
|
+
includeSynthesizable: boolean().optional()
|
|
16698
|
+
}), object({ caps: array(object({
|
|
16699
|
+
cap: string(),
|
|
16700
|
+
fields: array(object({
|
|
16701
|
+
path: string(),
|
|
16702
|
+
kind: _enum([
|
|
16703
|
+
"string",
|
|
16704
|
+
"number",
|
|
16705
|
+
"boolean",
|
|
16706
|
+
"enum"
|
|
16707
|
+
]),
|
|
16708
|
+
enumValues: array(string()).optional(),
|
|
16709
|
+
item: boolean().optional()
|
|
16710
|
+
})).readonly(),
|
|
16711
|
+
itemArray: object({
|
|
16712
|
+
path: string(),
|
|
16713
|
+
keyField: string()
|
|
16714
|
+
}).optional()
|
|
16715
|
+
})).readonly() }), { kind: "query" }), method(object({
|
|
16716
|
+
deviceId: number(),
|
|
16717
|
+
role: string().nullable()
|
|
16718
|
+
}), _void(), {
|
|
16719
|
+
kind: "mutation",
|
|
16720
|
+
auth: "admin"
|
|
16721
|
+
}), method(object({
|
|
16722
|
+
deviceId: number(),
|
|
16723
|
+
name: string().optional(),
|
|
16724
|
+
location: string().nullable().optional(),
|
|
16725
|
+
type: _enum(DeviceType).optional(),
|
|
16726
|
+
integrationId: string().optional(),
|
|
16727
|
+
linkDeviceId: number().nullable().optional(),
|
|
16728
|
+
role: string().nullable().optional()
|
|
16729
|
+
}), _void(), {
|
|
16730
|
+
kind: "mutation",
|
|
16731
|
+
auth: "admin"
|
|
16732
|
+
}), method(object({
|
|
16733
|
+
deviceId: number(),
|
|
16734
|
+
patch: record(string(), unknown())
|
|
16735
|
+
}), _void(), {
|
|
16736
|
+
kind: "mutation",
|
|
16737
|
+
auth: "admin"
|
|
16738
|
+
}), method(_void(), array(string())), method(object({ name: string() }), _void(), {
|
|
16739
|
+
kind: "mutation",
|
|
16740
|
+
auth: "admin"
|
|
16741
|
+
}), method(object({
|
|
16541
16742
|
name: string(),
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
|
|
16550
|
-
|
|
16551
|
-
|
|
16552
|
-
|
|
16553
|
-
|
|
16554
|
-
|
|
16555
|
-
|
|
16556
|
-
|
|
16557
|
-
|
|
16558
|
-
|
|
16559
|
-
|
|
16560
|
-
|
|
16561
|
-
|
|
16562
|
-
|
|
16563
|
-
|
|
16564
|
-
|
|
16565
|
-
kind:
|
|
16566
|
-
|
|
16567
|
-
|
|
16568
|
-
|
|
16569
|
-
|
|
16570
|
-
|
|
16571
|
-
|
|
16572
|
-
|
|
16573
|
-
|
|
16574
|
-
|
|
16575
|
-
|
|
16576
|
-
})
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
|
|
16594
|
-
|
|
16595
|
-
|
|
16596
|
-
|
|
16597
|
-
|
|
16598
|
-
|
|
16599
|
-
|
|
16600
|
-
|
|
16601
|
-
|
|
16602
|
-
|
|
16603
|
-
|
|
16604
|
-
|
|
16605
|
-
|
|
16606
|
-
|
|
16607
|
-
|
|
16608
|
-
|
|
16609
|
-
|
|
16610
|
-
|
|
16611
|
-
|
|
16612
|
-
|
|
16613
|
-
|
|
16614
|
-
|
|
16615
|
-
|
|
16616
|
-
})
|
|
16617
|
-
|
|
16743
|
+
cascade: boolean().optional()
|
|
16744
|
+
}), _void(), {
|
|
16745
|
+
kind: "mutation",
|
|
16746
|
+
auth: "admin"
|
|
16747
|
+
}), method(object({
|
|
16748
|
+
deviceId: number(),
|
|
16749
|
+
disabled: boolean()
|
|
16750
|
+
}), _void(), {
|
|
16751
|
+
kind: "mutation",
|
|
16752
|
+
auth: "admin"
|
|
16753
|
+
}), method(object({ addonId: string() }), array(SavedDeviceRowSchema)), method(object({ addonId: string().optional() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
|
|
16754
|
+
mode: DeviceLinkModeSchema,
|
|
16755
|
+
devices: array(LinkedDeviceSchema)
|
|
16756
|
+
})), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
|
|
16757
|
+
deviceId: number(),
|
|
16758
|
+
values: record(string(), unknown())
|
|
16759
|
+
}), object({ success: literal(true) }), {
|
|
16760
|
+
kind: "mutation",
|
|
16761
|
+
auth: "admin"
|
|
16762
|
+
}), method(object({ deviceId: number() }), object({ success: literal(true) }), {
|
|
16763
|
+
kind: "mutation",
|
|
16764
|
+
auth: "admin"
|
|
16765
|
+
}), method(object({ deviceId: number() }), object({ success: literal(true) }), {
|
|
16766
|
+
kind: "mutation",
|
|
16767
|
+
auth: "admin"
|
|
16768
|
+
}), method(object({ deviceId: number() }), object({ success: literal(true) }), {
|
|
16769
|
+
kind: "mutation",
|
|
16770
|
+
auth: "admin"
|
|
16771
|
+
}), method(object({ integrationId: string() }), object({ removed: number() }), {
|
|
16772
|
+
kind: "mutation",
|
|
16773
|
+
auth: "admin"
|
|
16774
|
+
}), method(object({ deviceId: number() }), record(string(), string().nullable())), method(object({
|
|
16775
|
+
deviceId: number(),
|
|
16776
|
+
profileMap: record(string(), string().nullable())
|
|
16777
|
+
}), object({ success: literal(true) }), {
|
|
16778
|
+
kind: "mutation",
|
|
16779
|
+
auth: "admin"
|
|
16780
|
+
}), method(object({ deviceId: number() }), array(StreamProbeResultSchema), {
|
|
16781
|
+
kind: "mutation",
|
|
16782
|
+
auth: "admin"
|
|
16783
|
+
}), method(object({ deviceId: number() }), object({
|
|
16784
|
+
deviceId: number(),
|
|
16785
|
+
entries: array(object({
|
|
16786
|
+
capName: string(),
|
|
16787
|
+
kind: _enum([
|
|
16788
|
+
"native",
|
|
16789
|
+
"wrapped",
|
|
16790
|
+
"linked"
|
|
16791
|
+
]),
|
|
16792
|
+
providerAddonId: string(),
|
|
16793
|
+
providerNodeId: string(),
|
|
16794
|
+
nativeAddonId: string()
|
|
16795
|
+
}))
|
|
16796
|
+
})), method(object({}), array(object({
|
|
16797
|
+
deviceId: number(),
|
|
16798
|
+
entries: array(object({
|
|
16799
|
+
capName: string(),
|
|
16800
|
+
kind: _enum([
|
|
16801
|
+
"native",
|
|
16802
|
+
"wrapped",
|
|
16803
|
+
"linked"
|
|
16804
|
+
]),
|
|
16805
|
+
providerAddonId: string(),
|
|
16806
|
+
providerNodeId: string(),
|
|
16807
|
+
nativeAddonId: string()
|
|
16808
|
+
}))
|
|
16809
|
+
}))), method(object({
|
|
16810
|
+
deviceId: number(),
|
|
16811
|
+
capName: string(),
|
|
16812
|
+
wrapperAddonId: string(),
|
|
16813
|
+
active: boolean()
|
|
16814
|
+
}), _void(), {
|
|
16815
|
+
kind: "mutation",
|
|
16816
|
+
auth: "admin"
|
|
16817
|
+
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
16818
|
+
capName: string(),
|
|
16819
|
+
wrappers: array(string())
|
|
16820
|
+
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
16821
|
+
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
16822
|
+
live: SettingsSchemaWithValuesSchema.nullable()
|
|
16823
|
+
})), method(object({
|
|
16824
|
+
deviceId: number().int().nonnegative(),
|
|
16825
|
+
action: string().min(1),
|
|
16826
|
+
input: unknown()
|
|
16827
|
+
}), unknown(), { kind: "mutation" }), method(object({
|
|
16828
|
+
deviceId: number(),
|
|
16829
|
+
writerCapName: string(),
|
|
16830
|
+
writerAddonId: string(),
|
|
16831
|
+
key: string(),
|
|
16832
|
+
value: unknown()
|
|
16833
|
+
}), object({ success: literal(true) }), {
|
|
16618
16834
|
kind: "mutation",
|
|
16619
16835
|
auth: "admin"
|
|
16620
|
-
}), method(
|
|
16836
|
+
}), method(object({
|
|
16837
|
+
deviceId: number(),
|
|
16838
|
+
changes: array(object({
|
|
16839
|
+
writerCapName: string(),
|
|
16840
|
+
writerAddonId: string(),
|
|
16841
|
+
key: string(),
|
|
16842
|
+
value: unknown()
|
|
16843
|
+
}))
|
|
16844
|
+
}), object({
|
|
16845
|
+
success: literal(true),
|
|
16846
|
+
failures: array(object({
|
|
16847
|
+
writerCapName: string(),
|
|
16848
|
+
writerAddonId: string(),
|
|
16849
|
+
error: string()
|
|
16850
|
+
}))
|
|
16851
|
+
}), {
|
|
16621
16852
|
kind: "mutation",
|
|
16622
16853
|
auth: "admin"
|
|
16623
|
-
}), method(
|
|
16854
|
+
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
16624
16855
|
kind: "mutation",
|
|
16625
16856
|
auth: "admin"
|
|
16626
|
-
}), method(
|
|
16627
|
-
|
|
16628
|
-
|
|
16629
|
-
|
|
16857
|
+
}), method(object({
|
|
16858
|
+
addonId: string(),
|
|
16859
|
+
candidate: DiscoveryCandidateSchema,
|
|
16860
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
16861
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
16862
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
16863
|
+
integrationId: string().optional()
|
|
16864
|
+
}), DeviceSummarySchema, {
|
|
16630
16865
|
kind: "mutation",
|
|
16631
16866
|
auth: "admin"
|
|
16632
16867
|
}), method(object({
|
|
16633
|
-
|
|
16634
|
-
|
|
16635
|
-
|
|
16636
|
-
|
|
16637
|
-
|
|
16638
|
-
|
|
16639
|
-
|
|
16640
|
-
|
|
16868
|
+
addonId: string(),
|
|
16869
|
+
type: _enum(DeviceType)
|
|
16870
|
+
}), unknown().nullable()), method(object({
|
|
16871
|
+
addonId: string(),
|
|
16872
|
+
type: _enum(DeviceType),
|
|
16873
|
+
config: record(string(), unknown()),
|
|
16874
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
16875
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
16876
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
16877
|
+
integrationId: string().optional()
|
|
16878
|
+
}), DeviceSummarySchema, {
|
|
16641
16879
|
kind: "mutation",
|
|
16642
16880
|
auth: "admin"
|
|
16643
16881
|
}), method(object({
|
|
16644
|
-
|
|
16645
|
-
|
|
16646
|
-
|
|
16882
|
+
addonId: string(),
|
|
16883
|
+
type: _enum(DeviceType),
|
|
16884
|
+
key: string(),
|
|
16885
|
+
value: unknown(),
|
|
16886
|
+
formValues: record(string(), unknown()).optional()
|
|
16887
|
+
}), FieldProbeResultSchema, {
|
|
16647
16888
|
kind: "mutation",
|
|
16648
16889
|
auth: "admin"
|
|
16649
|
-
}), method(
|
|
16890
|
+
}), method(object({
|
|
16891
|
+
addonId: string(),
|
|
16892
|
+
integrationId: string()
|
|
16893
|
+
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
16894
|
+
addonId: string(),
|
|
16895
|
+
integrationId: string()
|
|
16896
|
+
}), AdoptionStatusSchema, {
|
|
16650
16897
|
kind: "mutation",
|
|
16651
16898
|
auth: "admin"
|
|
16652
|
-
}), method(
|
|
16899
|
+
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
16900
|
+
kind: "mutation",
|
|
16901
|
+
auth: "admin"
|
|
16902
|
+
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
16903
|
+
kind: "mutation",
|
|
16904
|
+
auth: "admin"
|
|
16905
|
+
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
16906
|
+
kind: "mutation",
|
|
16907
|
+
auth: "admin"
|
|
16908
|
+
}), method(object({}), object({ providers: array(object({
|
|
16909
|
+
addonId: string(),
|
|
16910
|
+
label: string()
|
|
16911
|
+
})).readonly() }), { auth: "admin" }), method(object({}), object({ groups: array(object({
|
|
16912
|
+
addonId: string(),
|
|
16913
|
+
label: string(),
|
|
16914
|
+
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
16915
|
+
error: string().nullable()
|
|
16916
|
+
})).readonly() }), {
|
|
16917
|
+
kind: "mutation",
|
|
16918
|
+
auth: "admin"
|
|
16919
|
+
}), method(object({
|
|
16920
|
+
addonId: string(),
|
|
16921
|
+
params: record(string(), unknown()).optional()
|
|
16922
|
+
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
16923
|
+
kind: "mutation",
|
|
16924
|
+
auth: "admin"
|
|
16925
|
+
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
16926
|
+
deviceId: number(),
|
|
16927
|
+
key: string(),
|
|
16928
|
+
value: unknown()
|
|
16929
|
+
}), FieldProbeResultSchema, {
|
|
16653
16930
|
kind: "mutation",
|
|
16654
16931
|
auth: "admin"
|
|
16932
|
+
}), method(object({
|
|
16933
|
+
deviceId: number(),
|
|
16934
|
+
caps: array(string()).readonly().optional()
|
|
16935
|
+
}), record(string(), unknown().nullable()));
|
|
16936
|
+
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
16937
|
+
deviceId: number(),
|
|
16938
|
+
capName: string()
|
|
16939
|
+
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
16940
|
+
deviceId: number(),
|
|
16941
|
+
capName: string(),
|
|
16942
|
+
slice: record(string(), unknown())
|
|
16943
|
+
}), _void(), { kind: "mutation" }), object({
|
|
16944
|
+
deviceId: number(),
|
|
16945
|
+
capName: string(),
|
|
16946
|
+
slice: record(string(), unknown())
|
|
16655
16947
|
});
|
|
16656
|
-
|
|
16657
|
-
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
16661
|
-
|
|
16662
|
-
|
|
16663
|
-
|
|
16664
|
-
|
|
16665
|
-
|
|
16666
|
-
message: string(),
|
|
16667
|
-
meta: record(string(), unknown()).optional(),
|
|
16668
|
-
tags: record(string(), string()).optional()
|
|
16948
|
+
/**
|
|
16949
|
+
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
16950
|
+
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
16951
|
+
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
16952
|
+
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
16953
|
+
* post-analysis enrichment-engine.
|
|
16954
|
+
*/
|
|
16955
|
+
var EmbeddingResultSchema = object({
|
|
16956
|
+
embedding: array(number()),
|
|
16957
|
+
inferenceMs: number()
|
|
16669
16958
|
});
|
|
16670
|
-
|
|
16671
|
-
|
|
16672
|
-
|
|
16673
|
-
|
|
16674
|
-
|
|
16675
|
-
|
|
16676
|
-
|
|
16677
|
-
|
|
16959
|
+
var EmbeddingInfoSchema = object({
|
|
16960
|
+
modelId: string(),
|
|
16961
|
+
embeddingDim: number(),
|
|
16962
|
+
ready: boolean()
|
|
16963
|
+
});
|
|
16964
|
+
method(object({
|
|
16965
|
+
crop: _instanceof(Uint8Array),
|
|
16966
|
+
width: number(),
|
|
16967
|
+
height: number()
|
|
16968
|
+
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
16678
16969
|
/**
|
|
16679
|
-
*
|
|
16680
|
-
*
|
|
16681
|
-
*
|
|
16682
|
-
*
|
|
16683
|
-
*
|
|
16684
|
-
|
|
16685
|
-
|
|
16686
|
-
|
|
16687
|
-
|
|
16688
|
-
|
|
16689
|
-
|
|
16690
|
-
|
|
16691
|
-
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
|
|
16695
|
-
|
|
16696
|
-
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
*
|
|
16701
|
-
*
|
|
16702
|
-
*
|
|
16703
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
16704
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
16705
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
16706
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
16707
|
-
* decision.
|
|
16970
|
+
* filesystem-browse — per-node capability for browsing the node's local
|
|
16971
|
+
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
16972
|
+
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
16973
|
+
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
16974
|
+
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
16975
|
+
*/
|
|
16976
|
+
var DirEntrySchema = object({
|
|
16977
|
+
name: string(),
|
|
16978
|
+
path: string()
|
|
16979
|
+
});
|
|
16980
|
+
var BrowseResultSchema = object({
|
|
16981
|
+
path: string(),
|
|
16982
|
+
entries: array(DirEntrySchema).readonly(),
|
|
16983
|
+
freeBytes: number(),
|
|
16984
|
+
totalBytes: number()
|
|
16985
|
+
});
|
|
16986
|
+
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
16987
|
+
kind: "mutation",
|
|
16988
|
+
auth: "admin"
|
|
16989
|
+
});
|
|
16990
|
+
/**
|
|
16991
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
16992
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
16993
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
16708
16994
|
*
|
|
16709
|
-
*
|
|
16710
|
-
*
|
|
16711
|
-
*
|
|
16712
|
-
|
|
16713
|
-
|
|
16995
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
16996
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
16997
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
16998
|
+
*/
|
|
16999
|
+
var LlmUsageSchema = object({
|
|
17000
|
+
inputTokens: number(),
|
|
17001
|
+
outputTokens: number()
|
|
17002
|
+
});
|
|
17003
|
+
var LlmErrorCodeSchema = _enum([
|
|
17004
|
+
"timeout",
|
|
17005
|
+
"rate-limited",
|
|
17006
|
+
"auth",
|
|
17007
|
+
"refusal",
|
|
17008
|
+
"bad-request",
|
|
17009
|
+
"unavailable",
|
|
17010
|
+
"no-profile",
|
|
17011
|
+
"budget-exceeded",
|
|
17012
|
+
"adapter-error"
|
|
17013
|
+
]);
|
|
17014
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
17015
|
+
ok: literal(true),
|
|
17016
|
+
text: string(),
|
|
17017
|
+
model: string(),
|
|
17018
|
+
usage: LlmUsageSchema,
|
|
17019
|
+
truncated: boolean(),
|
|
17020
|
+
latencyMs: number()
|
|
17021
|
+
}), object({
|
|
17022
|
+
ok: literal(false),
|
|
17023
|
+
code: LlmErrorCodeSchema,
|
|
17024
|
+
message: string(),
|
|
17025
|
+
retryAfterMs: number().optional()
|
|
17026
|
+
})]);
|
|
17027
|
+
/**
|
|
17028
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
17029
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
17030
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
17031
|
+
*/
|
|
17032
|
+
var LlmImageSchema = object({
|
|
17033
|
+
bytes: _instanceof(Uint8Array),
|
|
17034
|
+
mimeType: string()
|
|
17035
|
+
});
|
|
17036
|
+
var LlmGenerateBaseInputSchema = object({
|
|
17037
|
+
/** Collection routing (the notification-output posture). */
|
|
17038
|
+
addonId: string().optional(),
|
|
17039
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
17040
|
+
profileId: string().optional(),
|
|
17041
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
17042
|
+
consumer: string(),
|
|
17043
|
+
system: string().optional(),
|
|
17044
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
17045
|
+
prompt: string(),
|
|
17046
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
17047
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
17048
|
+
/** Per-call override of the profile default. */
|
|
17049
|
+
maxTokens: number().int().positive().optional(),
|
|
17050
|
+
temperature: number().optional()
|
|
17051
|
+
});
|
|
17052
|
+
/**
|
|
17053
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
17054
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
17055
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
17056
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
17057
|
+
* this only through the `llm` cap's methods.
|
|
16714
17058
|
*
|
|
16715
|
-
*
|
|
16716
|
-
*
|
|
16717
|
-
*
|
|
17059
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
17060
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
17061
|
+
* watchdog — operator decision #3).
|
|
16718
17062
|
*/
|
|
16719
|
-
|
|
16720
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
16721
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
16722
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
17063
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
16723
17064
|
object({
|
|
16724
|
-
kind: literal("
|
|
16725
|
-
|
|
16726
|
-
id: string(),
|
|
16727
|
-
/** Operator-facing button label. */
|
|
16728
|
-
label: string(),
|
|
16729
|
-
/** lucide-react icon name. */
|
|
16730
|
-
icon: string().optional(),
|
|
16731
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
16732
|
-
startUrl: string(),
|
|
16733
|
-
stage: LoginStageEnum
|
|
17065
|
+
kind: literal("catalog"),
|
|
17066
|
+
catalogId: string()
|
|
16734
17067
|
}),
|
|
16735
17068
|
object({
|
|
16736
|
-
kind: literal("
|
|
16737
|
-
|
|
16738
|
-
|
|
16739
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
16740
|
-
addonId: string(),
|
|
16741
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
16742
|
-
bundle: string(),
|
|
16743
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
16744
|
-
remote: WidgetRemoteSchema,
|
|
16745
|
-
stage: LoginStageEnum
|
|
17069
|
+
kind: literal("url"),
|
|
17070
|
+
url: string(),
|
|
17071
|
+
sha256: string().optional()
|
|
16746
17072
|
}),
|
|
16747
17073
|
object({
|
|
16748
|
-
kind: literal("
|
|
16749
|
-
|
|
16750
|
-
id: string(),
|
|
16751
|
-
/** Operator-facing button label. */
|
|
16752
|
-
label: string(),
|
|
16753
|
-
stage: LoginStageEnum,
|
|
16754
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
16755
|
-
rpId: string(),
|
|
16756
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
16757
|
-
origin: string().nullable()
|
|
17074
|
+
kind: literal("path"),
|
|
17075
|
+
path: string()
|
|
16758
17076
|
})
|
|
16759
17077
|
]);
|
|
16760
|
-
|
|
16761
|
-
|
|
16762
|
-
|
|
16763
|
-
|
|
16764
|
-
|
|
16765
|
-
|
|
16766
|
-
|
|
16767
|
-
|
|
16768
|
-
|
|
16769
|
-
|
|
16770
|
-
|
|
16771
|
-
|
|
16772
|
-
|
|
16773
|
-
|
|
16774
|
-
|
|
16775
|
-
|
|
16776
|
-
|
|
16777
|
-
usedBytes: number(),
|
|
16778
|
-
availableBytes: number(),
|
|
16779
|
-
swapUsedBytes: number(),
|
|
16780
|
-
swapTotalBytes: number()
|
|
16781
|
-
});
|
|
16782
|
-
var DiskIoSnapshotSchema = object({
|
|
16783
|
-
readBytes: number(),
|
|
16784
|
-
writeBytes: number(),
|
|
16785
|
-
readOps: number(),
|
|
16786
|
-
writeOps: number(),
|
|
16787
|
-
timestampMs: number()
|
|
16788
|
-
});
|
|
16789
|
-
var NetworkIoSnapshotSchema = object({
|
|
16790
|
-
rxBytes: number(),
|
|
16791
|
-
txBytes: number(),
|
|
16792
|
-
rxPackets: number(),
|
|
16793
|
-
txPackets: number(),
|
|
16794
|
-
rxErrors: number(),
|
|
16795
|
-
txErrors: number(),
|
|
16796
|
-
timestampMs: number()
|
|
16797
|
-
});
|
|
16798
|
-
var MetricsGpuInfoSchema = object({
|
|
16799
|
-
utilization: number(),
|
|
16800
|
-
model: string(),
|
|
16801
|
-
memoryUsedBytes: number(),
|
|
16802
|
-
memoryTotalBytes: number(),
|
|
16803
|
-
temperature: number().nullable()
|
|
16804
|
-
});
|
|
16805
|
-
var ProcessResourceInfoSchema = object({
|
|
16806
|
-
openFds: number(),
|
|
16807
|
-
threadCount: number(),
|
|
16808
|
-
activeHandles: number(),
|
|
16809
|
-
activeRequests: number()
|
|
16810
|
-
});
|
|
16811
|
-
var PressureAvgsSchema = object({
|
|
16812
|
-
avg10: number(),
|
|
16813
|
-
avg60: number(),
|
|
16814
|
-
avg300: number()
|
|
16815
|
-
});
|
|
16816
|
-
var PressureInfoSchema = object({
|
|
16817
|
-
some: PressureAvgsSchema,
|
|
16818
|
-
full: PressureAvgsSchema.nullable()
|
|
16819
|
-
});
|
|
16820
|
-
var SystemResourceSnapshotSchema = object({
|
|
16821
|
-
cpu: CpuBreakdownSchema,
|
|
16822
|
-
memory: MemoryInfoSchema,
|
|
16823
|
-
gpu: MetricsGpuInfoSchema.nullable(),
|
|
16824
|
-
network: NetworkIoSnapshotSchema,
|
|
16825
|
-
disk: DiskIoSnapshotSchema,
|
|
16826
|
-
pressure: object({
|
|
16827
|
-
cpu: PressureInfoSchema.nullable(),
|
|
16828
|
-
memory: PressureInfoSchema.nullable(),
|
|
16829
|
-
io: PressureInfoSchema.nullable()
|
|
16830
|
-
}),
|
|
16831
|
-
process: ProcessResourceInfoSchema,
|
|
16832
|
-
cpuTemperature: number().nullable(),
|
|
16833
|
-
timestampMs: number()
|
|
16834
|
-
});
|
|
16835
|
-
var DiskSpaceInfoSchema = object({
|
|
16836
|
-
path: string(),
|
|
16837
|
-
totalBytes: number(),
|
|
16838
|
-
usedBytes: number(),
|
|
16839
|
-
availableBytes: number(),
|
|
16840
|
-
percent: number()
|
|
16841
|
-
});
|
|
16842
|
-
var PidResourceStatsSchema = object({
|
|
16843
|
-
pid: number(),
|
|
16844
|
-
cpu: number(),
|
|
16845
|
-
memory: number(),
|
|
16846
|
-
/**
|
|
16847
|
-
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
16848
|
-
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
16849
|
-
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
16850
|
-
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
16851
|
-
* Undefined where /proc is unavailable (e.g. macOS).
|
|
16852
|
-
*/
|
|
16853
|
-
privateBytes: number().optional(),
|
|
16854
|
-
/**
|
|
16855
|
-
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
16856
|
-
* code shared copy-on-write across runners. Undefined on macOS.
|
|
16857
|
-
*/
|
|
16858
|
-
sharedBytes: number().optional()
|
|
17078
|
+
var ManagedRuntimeConfigSchema = object({
|
|
17079
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
17080
|
+
nodeId: string(),
|
|
17081
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
17082
|
+
engine: _enum(["llama-cpp"]),
|
|
17083
|
+
model: ManagedModelRefSchema,
|
|
17084
|
+
contextSize: number().int().default(4096),
|
|
17085
|
+
/** 0 = CPU-only. */
|
|
17086
|
+
gpuLayers: number().int().default(0),
|
|
17087
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
17088
|
+
threads: number().int().optional(),
|
|
17089
|
+
/** Concurrent slots. */
|
|
17090
|
+
parallel: number().int().default(1),
|
|
17091
|
+
/** Else lazy: first generate boots it. */
|
|
17092
|
+
autoStart: boolean().default(false),
|
|
17093
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
17094
|
+
idleStopMinutes: number().int().default(30)
|
|
16859
17095
|
});
|
|
16860
|
-
var
|
|
16861
|
-
|
|
17096
|
+
var LlmRuntimeStatusSchema = object({
|
|
17097
|
+
/** Status is ALWAYS node-qualified. */
|
|
16862
17098
|
nodeId: string(),
|
|
16863
|
-
role: _enum(["hub", "worker"]),
|
|
16864
|
-
pid: number(),
|
|
16865
17099
|
state: _enum([
|
|
16866
|
-
"starting",
|
|
16867
|
-
"running",
|
|
16868
|
-
"stopping",
|
|
16869
17100
|
"stopped",
|
|
16870
|
-
"
|
|
16871
|
-
|
|
16872
|
-
|
|
16873
|
-
|
|
16874
|
-
|
|
16875
|
-
|
|
16876
|
-
ppid: number(),
|
|
16877
|
-
pgid: number(),
|
|
16878
|
-
classification: _enum([
|
|
16879
|
-
"root",
|
|
16880
|
-
"managed",
|
|
16881
|
-
"system",
|
|
16882
|
-
"ghost"
|
|
16883
|
-
]),
|
|
16884
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
16885
|
-
addonId: string().nullable(),
|
|
16886
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
16887
|
-
nodeId: string().nullable(),
|
|
16888
|
-
/** Truncated command line. */
|
|
16889
|
-
command: string(),
|
|
16890
|
-
cpuPercent: number(),
|
|
16891
|
-
memoryRssBytes: number(),
|
|
16892
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
16893
|
-
uptimeSec: number(),
|
|
16894
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
16895
|
-
orphaned: boolean()
|
|
16896
|
-
});
|
|
16897
|
-
var KillProcessInputSchema = object({
|
|
16898
|
-
pid: number(),
|
|
16899
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
16900
|
-
force: boolean().optional()
|
|
16901
|
-
});
|
|
16902
|
-
var KillProcessResultSchema = object({
|
|
16903
|
-
success: boolean(),
|
|
16904
|
-
reason: string().optional(),
|
|
16905
|
-
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
16906
|
-
});
|
|
16907
|
-
var DumpHeapSnapshotInputSchema = object({
|
|
16908
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
16909
|
-
addonId: string() });
|
|
16910
|
-
var DumpHeapSnapshotResultSchema = object({
|
|
16911
|
-
success: boolean(),
|
|
16912
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
16913
|
-
path: string().optional(),
|
|
16914
|
-
/** Process pid that was signalled. */
|
|
17101
|
+
"downloading",
|
|
17102
|
+
"starting",
|
|
17103
|
+
"ready",
|
|
17104
|
+
"crashed",
|
|
17105
|
+
"failed"
|
|
17106
|
+
]),
|
|
16915
17107
|
pid: number().optional(),
|
|
16916
|
-
|
|
17108
|
+
port: number().optional(),
|
|
17109
|
+
modelPath: string().optional(),
|
|
17110
|
+
modelId: string().optional(),
|
|
17111
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
17112
|
+
lastError: string().optional(),
|
|
17113
|
+
crashesInWindow: number(),
|
|
17114
|
+
/** Child RSS (sampled best-effort). */
|
|
17115
|
+
memoryBytes: number().optional(),
|
|
17116
|
+
vramBytes: number().optional()
|
|
16917
17117
|
});
|
|
16918
|
-
var
|
|
16919
|
-
|
|
16920
|
-
|
|
16921
|
-
|
|
16922
|
-
|
|
16923
|
-
diskPercent: number().optional(),
|
|
16924
|
-
temperature: number().optional(),
|
|
16925
|
-
gpuPercent: number().optional(),
|
|
16926
|
-
gpuMemoryPercent: number().optional()
|
|
17118
|
+
var LlmNodeModelSchema = object({
|
|
17119
|
+
file: string(),
|
|
17120
|
+
sizeBytes: number(),
|
|
17121
|
+
catalogId: string().optional(),
|
|
17122
|
+
installedAt: number().optional()
|
|
16927
17123
|
});
|
|
16928
|
-
|
|
17124
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
17125
|
+
nodeId: string(),
|
|
17126
|
+
modelsBytes: number(),
|
|
17127
|
+
freeBytes: number().optional()
|
|
17128
|
+
});
|
|
17129
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
17130
|
+
images: array(LlmImageSchema).optional(),
|
|
17131
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
17132
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
17133
|
+
timeoutMs: number().int().positive().optional()
|
|
17134
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
16929
17135
|
kind: "mutation",
|
|
16930
17136
|
auth: "admin"
|
|
16931
|
-
}), method(
|
|
17137
|
+
}), method(object({}), _void(), {
|
|
16932
17138
|
kind: "mutation",
|
|
16933
17139
|
auth: "admin"
|
|
16934
|
-
})
|
|
16935
|
-
method(object({
|
|
16936
|
-
sourceUrl: string(),
|
|
16937
|
-
metadata: ModelConvertMetadataSchema,
|
|
16938
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
16939
|
-
calibrationRef: string().optional(),
|
|
16940
|
-
sessionId: string().optional()
|
|
16941
|
-
}), ConvertResultSchema, {
|
|
17140
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
16942
17141
|
kind: "mutation",
|
|
16943
|
-
auth: "admin"
|
|
16944
|
-
|
|
16945
|
-
});
|
|
16946
|
-
method(object({
|
|
16947
|
-
nodeId: string(),
|
|
16948
|
-
modelId: string(),
|
|
16949
|
-
format: _enum(MODEL_FORMATS),
|
|
16950
|
-
entry: ModelCatalogEntrySchema
|
|
16951
|
-
}), object({
|
|
16952
|
-
ok: boolean(),
|
|
16953
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
16954
|
-
sha256: string(),
|
|
16955
|
-
bytes: number(),
|
|
16956
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
16957
|
-
path: string()
|
|
16958
|
-
}), {
|
|
17142
|
+
auth: "admin"
|
|
17143
|
+
}), method(object({ file: string() }), _void(), {
|
|
16959
17144
|
kind: "mutation",
|
|
16960
17145
|
auth: "admin"
|
|
16961
|
-
});
|
|
16962
|
-
/**
|
|
16963
|
-
* `mqtt-broker` — broker-registry cap.
|
|
16964
|
-
*
|
|
16965
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
16966
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
16967
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
16968
|
-
* its OWN `mqtt.js` client.
|
|
16969
|
-
*
|
|
16970
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
16971
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
16972
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
16973
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
16974
|
-
* features anyway — give it the connection config, get out of the way.
|
|
16975
|
-
*
|
|
16976
|
-
* Consumer flow:
|
|
16977
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
16978
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
16979
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
16980
|
-
*
|
|
16981
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
16982
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
16983
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
16984
|
-
* spawned it.
|
|
16985
|
-
*/
|
|
16986
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
17146
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
16987
17147
|
/**
|
|
16988
|
-
*
|
|
17148
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
17149
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
17150
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
17151
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
17152
|
+
* (hub-placed); the cap stays open for future providers.
|
|
16989
17153
|
*
|
|
16990
|
-
*
|
|
16991
|
-
*
|
|
16992
|
-
*
|
|
16993
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
16994
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
17154
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
17155
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
17156
|
+
* write; a stored key NEVER round-trips to a client.
|
|
16995
17157
|
*/
|
|
16996
|
-
var
|
|
16997
|
-
"
|
|
16998
|
-
"
|
|
16999
|
-
"
|
|
17000
|
-
"
|
|
17001
|
-
"
|
|
17158
|
+
var LlmProfileKindSchema = _enum([
|
|
17159
|
+
"openai-compatible",
|
|
17160
|
+
"openai",
|
|
17161
|
+
"anthropic",
|
|
17162
|
+
"google",
|
|
17163
|
+
"managed-local"
|
|
17002
17164
|
]);
|
|
17003
|
-
var
|
|
17165
|
+
var LlmProfileSchema = object({
|
|
17004
17166
|
id: string(),
|
|
17005
17167
|
name: string(),
|
|
17006
|
-
|
|
17007
|
-
|
|
17008
|
-
|
|
17009
|
-
|
|
17010
|
-
|
|
17011
|
-
|
|
17012
|
-
|
|
17013
|
-
|
|
17014
|
-
|
|
17168
|
+
kind: LlmProfileKindSchema,
|
|
17169
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
17170
|
+
addonId: string(),
|
|
17171
|
+
enabled: boolean(),
|
|
17172
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
17173
|
+
model: string(),
|
|
17174
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
17175
|
+
baseUrl: string().optional(),
|
|
17176
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
17177
|
+
apiKey: string().optional(),
|
|
17178
|
+
supportsVision: boolean(),
|
|
17179
|
+
temperature: number().min(0).max(2).optional(),
|
|
17180
|
+
maxTokens: number().int().positive().optional(),
|
|
17181
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
17182
|
+
extraHeaders: record(string(), string()).optional(),
|
|
17183
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
17184
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
17015
17185
|
});
|
|
17016
|
-
/**
|
|
17017
|
-
*
|
|
17018
|
-
*
|
|
17019
|
-
|
|
17020
|
-
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
|
|
17024
|
-
|
|
17025
|
-
|
|
17026
|
-
|
|
17027
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
17028
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
17029
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
17030
|
-
* broker).
|
|
17031
|
-
*/
|
|
17032
|
-
clientIdPrefix: string().optional()
|
|
17186
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
17187
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
17188
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
17189
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
17190
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
17191
|
+
kind: LlmProfileKindSchema,
|
|
17192
|
+
label: string(),
|
|
17193
|
+
icon: string(),
|
|
17194
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
17195
|
+
addonId: string(),
|
|
17196
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
17033
17197
|
});
|
|
17034
|
-
var
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17038
|
-
password: string().optional(),
|
|
17039
|
-
clientIdPrefix: string().optional()
|
|
17198
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
17199
|
+
var LlmDefaultSchema = object({
|
|
17200
|
+
selector: LlmDefaultSelectorSchema,
|
|
17201
|
+
profileId: string()
|
|
17040
17202
|
});
|
|
17041
|
-
|
|
17042
|
-
var
|
|
17043
|
-
|
|
17044
|
-
|
|
17045
|
-
|
|
17046
|
-
|
|
17047
|
-
|
|
17048
|
-
|
|
17049
|
-
|
|
17050
|
-
|
|
17051
|
-
|
|
17052
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
17053
|
-
allowAnonymous: boolean().default(false),
|
|
17054
|
-
/** Optional shared username/password for clients. */
|
|
17055
|
-
username: string().optional(),
|
|
17056
|
-
password: string().optional()
|
|
17203
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
17204
|
+
var LlmUsageRollupSchema = object({
|
|
17205
|
+
day: string(),
|
|
17206
|
+
consumer: string(),
|
|
17207
|
+
profileId: string(),
|
|
17208
|
+
calls: number(),
|
|
17209
|
+
okCalls: number(),
|
|
17210
|
+
errorCalls: number(),
|
|
17211
|
+
inputTokens: number(),
|
|
17212
|
+
outputTokens: number(),
|
|
17213
|
+
avgLatencyMs: number()
|
|
17057
17214
|
});
|
|
17058
|
-
|
|
17215
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
17216
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
17059
17217
|
id: string(),
|
|
17060
|
-
|
|
17061
|
-
|
|
17062
|
-
|
|
17063
|
-
brokerCount: number(),
|
|
17064
|
-
embeddedRunning: boolean()
|
|
17065
|
-
});
|
|
17066
|
-
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);
|
|
17067
|
-
var NetworkEndpointSchema = object({
|
|
17218
|
+
label: string(),
|
|
17219
|
+
family: string(),
|
|
17220
|
+
purpose: _enum(["text", "vision"]),
|
|
17068
17221
|
url: string(),
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
17222
|
+
sha256: string(),
|
|
17223
|
+
sizeBytes: number(),
|
|
17224
|
+
quantization: string(),
|
|
17225
|
+
/** Load-time guidance shown in the picker. */
|
|
17226
|
+
minRamBytes: number(),
|
|
17227
|
+
contextSizeDefault: number().int(),
|
|
17228
|
+
/** Vision models: companion projector file. */
|
|
17229
|
+
mmprojUrl: string().optional()
|
|
17072
17230
|
});
|
|
17073
|
-
var
|
|
17074
|
-
|
|
17075
|
-
|
|
17231
|
+
var LlmRuntimeNodeSchema = object({
|
|
17232
|
+
nodeId: string(),
|
|
17233
|
+
reachable: boolean(),
|
|
17234
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
17235
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
17076
17236
|
error: string().optional()
|
|
17077
17237
|
});
|
|
17078
|
-
|
|
17079
|
-
|
|
17080
|
-
|
|
17081
|
-
|
|
17082
|
-
|
|
17083
|
-
|
|
17084
|
-
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
|
|
17088
|
-
|
|
17089
|
-
|
|
17090
|
-
|
|
17091
|
-
|
|
17092
|
-
|
|
17093
|
-
|
|
17094
|
-
|
|
17095
|
-
|
|
17096
|
-
|
|
17097
|
-
|
|
17238
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
17239
|
+
var ProfileRefInputSchema = object({
|
|
17240
|
+
addonId: string(),
|
|
17241
|
+
profileId: string()
|
|
17242
|
+
});
|
|
17243
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
17244
|
+
kind: "mutation",
|
|
17245
|
+
auth: "admin"
|
|
17246
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
17247
|
+
kind: "mutation",
|
|
17248
|
+
auth: "admin"
|
|
17249
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
17250
|
+
kind: "mutation",
|
|
17251
|
+
auth: "admin"
|
|
17252
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
17253
|
+
selector: LlmDefaultSelectorSchema,
|
|
17254
|
+
profileId: string().nullable()
|
|
17255
|
+
}), _void(), {
|
|
17256
|
+
kind: "mutation",
|
|
17257
|
+
auth: "admin"
|
|
17258
|
+
}), method(object({
|
|
17259
|
+
since: number().optional(),
|
|
17260
|
+
until: number().optional(),
|
|
17261
|
+
consumer: string().optional(),
|
|
17262
|
+
profileId: string().optional()
|
|
17263
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
17264
|
+
nodeId: string(),
|
|
17265
|
+
model: ManagedModelRefSchema
|
|
17266
|
+
}), _void(), {
|
|
17267
|
+
kind: "mutation",
|
|
17268
|
+
auth: "admin"
|
|
17269
|
+
}), method(object({
|
|
17270
|
+
nodeId: string(),
|
|
17271
|
+
file: string()
|
|
17272
|
+
}), _void(), {
|
|
17273
|
+
kind: "mutation",
|
|
17274
|
+
auth: "admin"
|
|
17275
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
17276
|
+
kind: "mutation",
|
|
17277
|
+
auth: "admin"
|
|
17278
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
17279
|
+
kind: "mutation",
|
|
17280
|
+
auth: "admin"
|
|
17281
|
+
});
|
|
17282
|
+
var LogLevelSchema = _enum([
|
|
17283
|
+
"debug",
|
|
17284
|
+
"info",
|
|
17285
|
+
"warn",
|
|
17286
|
+
"error"
|
|
17287
|
+
]);
|
|
17288
|
+
var LogEntrySchema = object({
|
|
17289
|
+
timestamp: date(),
|
|
17290
|
+
level: LogLevelSchema,
|
|
17291
|
+
scope: array(string()),
|
|
17292
|
+
message: string(),
|
|
17293
|
+
meta: record(string(), unknown()).optional(),
|
|
17294
|
+
tags: record(string(), string()).optional()
|
|
17098
17295
|
});
|
|
17099
|
-
method(
|
|
17296
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
17297
|
+
scope: array(string()).optional(),
|
|
17298
|
+
level: LogLevelSchema.optional(),
|
|
17299
|
+
since: date().optional(),
|
|
17300
|
+
until: date().optional(),
|
|
17301
|
+
limit: number().optional(),
|
|
17302
|
+
tags: record(string(), string()).optional()
|
|
17303
|
+
}), array(LogEntrySchema).readonly());
|
|
17100
17304
|
/**
|
|
17101
|
-
*
|
|
17305
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
17306
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
17307
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
17308
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
17309
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
17310
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
17102
17311
|
*
|
|
17103
|
-
*
|
|
17104
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
17105
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
17106
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
17107
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
17108
|
-
* message to what the kind supports — callers never special-case a service.
|
|
17312
|
+
* A contribution is a discriminated union on `kind`:
|
|
17109
17313
|
*
|
|
17110
|
-
*
|
|
17111
|
-
*
|
|
17112
|
-
* `
|
|
17113
|
-
*
|
|
17114
|
-
*
|
|
17115
|
-
* alternative would fork the UI per addon and cannot host the
|
|
17116
|
-
* discovery→adopt flow.
|
|
17117
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
17118
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
17119
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
17120
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
17121
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
17122
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
17123
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
17124
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
17125
|
-
* base64 fallback needed.
|
|
17314
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
17315
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
17316
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
17317
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
17318
|
+
* login page needs NO change.
|
|
17126
17319
|
*
|
|
17127
|
-
*
|
|
17128
|
-
*
|
|
17129
|
-
*
|
|
17130
|
-
|
|
17131
|
-
|
|
17132
|
-
*
|
|
17133
|
-
*
|
|
17134
|
-
|
|
17135
|
-
|
|
17136
|
-
|
|
17137
|
-
|
|
17138
|
-
|
|
17139
|
-
|
|
17140
|
-
|
|
17141
|
-
|
|
17142
|
-
|
|
17143
|
-
*
|
|
17144
|
-
*
|
|
17145
|
-
*
|
|
17146
|
-
*
|
|
17320
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
17321
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
17322
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
17323
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
17324
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
17325
|
+
*
|
|
17326
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
17327
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
17328
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
17329
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
17330
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
17331
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
17332
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
17333
|
+
* decision.
|
|
17334
|
+
*
|
|
17335
|
+
* Every contribution carries a `stage`:
|
|
17336
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
17337
|
+
* magic-link buttons; a future usernameless passkey).
|
|
17338
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
17339
|
+
* returned `factors` (passkey-as-2FA today).
|
|
17340
|
+
*
|
|
17341
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
17342
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
17343
|
+
* tRPC router.
|
|
17147
17344
|
*/
|
|
17148
|
-
|
|
17149
|
-
|
|
17150
|
-
|
|
17151
|
-
|
|
17152
|
-
|
|
17153
|
-
|
|
17154
|
-
|
|
17155
|
-
|
|
17156
|
-
|
|
17157
|
-
|
|
17158
|
-
|
|
17345
|
+
/** When a login method renders in the two-phase login flow. */
|
|
17346
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
17347
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
17348
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
17349
|
+
object({
|
|
17350
|
+
kind: literal("redirect"),
|
|
17351
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
17352
|
+
id: string(),
|
|
17353
|
+
/** Operator-facing button label. */
|
|
17354
|
+
label: string(),
|
|
17355
|
+
/** lucide-react icon name. */
|
|
17356
|
+
icon: string().optional(),
|
|
17357
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
17358
|
+
startUrl: string(),
|
|
17359
|
+
stage: LoginStageEnum
|
|
17360
|
+
}),
|
|
17361
|
+
object({
|
|
17362
|
+
kind: literal("widget"),
|
|
17363
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
17364
|
+
id: string(),
|
|
17365
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
17366
|
+
addonId: string(),
|
|
17367
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
17368
|
+
bundle: string(),
|
|
17369
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
17370
|
+
remote: WidgetRemoteSchema,
|
|
17371
|
+
stage: LoginStageEnum
|
|
17372
|
+
}),
|
|
17373
|
+
object({
|
|
17374
|
+
kind: literal("passkey"),
|
|
17375
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
17376
|
+
id: string(),
|
|
17377
|
+
/** Operator-facing button label. */
|
|
17378
|
+
label: string(),
|
|
17379
|
+
stage: LoginStageEnum,
|
|
17380
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
17381
|
+
rpId: string(),
|
|
17382
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
17383
|
+
origin: string().nullable()
|
|
17384
|
+
})
|
|
17159
17385
|
]);
|
|
17160
|
-
|
|
17161
|
-
var
|
|
17162
|
-
|
|
17163
|
-
|
|
17164
|
-
|
|
17386
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
17387
|
+
var CpuBreakdownSchema = object({
|
|
17388
|
+
total: number(),
|
|
17389
|
+
user: number(),
|
|
17390
|
+
system: number(),
|
|
17391
|
+
irq: number(),
|
|
17392
|
+
nice: number(),
|
|
17393
|
+
loadAvg: tuple([
|
|
17394
|
+
number(),
|
|
17395
|
+
number(),
|
|
17396
|
+
number()
|
|
17397
|
+
]),
|
|
17398
|
+
cores: number()
|
|
17399
|
+
});
|
|
17400
|
+
var MemoryInfoSchema = object({
|
|
17401
|
+
percent: number(),
|
|
17402
|
+
totalBytes: number(),
|
|
17403
|
+
usedBytes: number(),
|
|
17404
|
+
availableBytes: number(),
|
|
17405
|
+
swapUsedBytes: number(),
|
|
17406
|
+
swapTotalBytes: number()
|
|
17407
|
+
});
|
|
17408
|
+
var DiskIoSnapshotSchema = object({
|
|
17409
|
+
readBytes: number(),
|
|
17410
|
+
writeBytes: number(),
|
|
17411
|
+
readOps: number(),
|
|
17412
|
+
writeOps: number(),
|
|
17413
|
+
timestampMs: number()
|
|
17414
|
+
});
|
|
17415
|
+
var NetworkIoSnapshotSchema = object({
|
|
17416
|
+
rxBytes: number(),
|
|
17417
|
+
txBytes: number(),
|
|
17418
|
+
rxPackets: number(),
|
|
17419
|
+
txPackets: number(),
|
|
17420
|
+
rxErrors: number(),
|
|
17421
|
+
txErrors: number(),
|
|
17422
|
+
timestampMs: number()
|
|
17423
|
+
});
|
|
17424
|
+
var MetricsGpuInfoSchema = object({
|
|
17425
|
+
utilization: number(),
|
|
17426
|
+
model: string(),
|
|
17427
|
+
memoryUsedBytes: number(),
|
|
17428
|
+
memoryTotalBytes: number(),
|
|
17429
|
+
temperature: number().nullable()
|
|
17430
|
+
});
|
|
17431
|
+
var ProcessResourceInfoSchema = object({
|
|
17432
|
+
openFds: number(),
|
|
17433
|
+
threadCount: number(),
|
|
17434
|
+
activeHandles: number(),
|
|
17435
|
+
activeRequests: number()
|
|
17165
17436
|
});
|
|
17166
|
-
|
|
17167
|
-
|
|
17168
|
-
|
|
17169
|
-
|
|
17170
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
17171
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
17172
|
-
* `priority` for that one target.
|
|
17173
|
-
*/
|
|
17174
|
-
var NotificationSchema = object({
|
|
17175
|
-
body: string(),
|
|
17176
|
-
title: string().optional(),
|
|
17177
|
-
format: NotificationFormatSchema.default("text"),
|
|
17178
|
-
priority: number().int().min(1).max(5).default(3),
|
|
17179
|
-
level: string().optional(),
|
|
17180
|
-
attachments: array(AttachmentSchema).optional(),
|
|
17181
|
-
clickUrl: string().optional(),
|
|
17182
|
-
actions: array(NotificationActionSchema).optional(),
|
|
17183
|
-
sound: string().optional(),
|
|
17184
|
-
ttl: number().optional(),
|
|
17185
|
-
tag: string().optional(),
|
|
17186
|
-
deviceId: number().optional(),
|
|
17187
|
-
eventId: string().optional(),
|
|
17188
|
-
metadata: record(string(), unknown()).optional()
|
|
17437
|
+
var PressureAvgsSchema = object({
|
|
17438
|
+
avg10: number(),
|
|
17439
|
+
avg60: number(),
|
|
17440
|
+
avg300: number()
|
|
17189
17441
|
});
|
|
17190
|
-
|
|
17191
|
-
|
|
17192
|
-
|
|
17193
|
-
label: string(),
|
|
17194
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
17195
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
17196
|
-
flags: object({
|
|
17197
|
-
critical: boolean().optional(),
|
|
17198
|
-
silent: boolean().optional(),
|
|
17199
|
-
noPush: boolean().optional()
|
|
17200
|
-
}).optional(),
|
|
17201
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
17202
|
-
requires: array(string()).optional(),
|
|
17203
|
-
description: string().optional()
|
|
17442
|
+
var PressureInfoSchema = object({
|
|
17443
|
+
some: PressureAvgsSchema,
|
|
17444
|
+
full: PressureAvgsSchema.nullable()
|
|
17204
17445
|
});
|
|
17205
|
-
|
|
17206
|
-
|
|
17207
|
-
|
|
17208
|
-
|
|
17209
|
-
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
|
|
17215
|
-
maxBytes: number().int().positive().optional()
|
|
17446
|
+
var SystemResourceSnapshotSchema = object({
|
|
17447
|
+
cpu: CpuBreakdownSchema,
|
|
17448
|
+
memory: MemoryInfoSchema,
|
|
17449
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
17450
|
+
network: NetworkIoSnapshotSchema,
|
|
17451
|
+
disk: DiskIoSnapshotSchema,
|
|
17452
|
+
pressure: object({
|
|
17453
|
+
cpu: PressureInfoSchema.nullable(),
|
|
17454
|
+
memory: PressureInfoSchema.nullable(),
|
|
17455
|
+
io: PressureInfoSchema.nullable()
|
|
17216
17456
|
}),
|
|
17217
|
-
|
|
17218
|
-
|
|
17219
|
-
|
|
17220
|
-
format: array(NotificationFormatSchema),
|
|
17221
|
-
clickUrl: boolean(),
|
|
17222
|
-
sound: boolean(),
|
|
17223
|
-
ttl: boolean(),
|
|
17224
|
-
bodyMaxLen: number().int().positive()
|
|
17457
|
+
process: ProcessResourceInfoSchema,
|
|
17458
|
+
cpuTemperature: number().nullable(),
|
|
17459
|
+
timestampMs: number()
|
|
17225
17460
|
});
|
|
17226
|
-
|
|
17227
|
-
|
|
17228
|
-
|
|
17229
|
-
|
|
17230
|
-
|
|
17231
|
-
|
|
17232
|
-
*/
|
|
17233
|
-
var ConfigSchemaPassthrough = unknown();
|
|
17234
|
-
var TargetKindSchema = object({
|
|
17235
|
-
kind: string(),
|
|
17236
|
-
label: string(),
|
|
17237
|
-
icon: string(),
|
|
17238
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
17239
|
-
addonId: string(),
|
|
17240
|
-
configSchema: ConfigSchemaPassthrough,
|
|
17241
|
-
supportsDiscovery: boolean(),
|
|
17242
|
-
caps: TargetKindCapsSchema
|
|
17461
|
+
var DiskSpaceInfoSchema = object({
|
|
17462
|
+
path: string(),
|
|
17463
|
+
totalBytes: number(),
|
|
17464
|
+
usedBytes: number(),
|
|
17465
|
+
availableBytes: number(),
|
|
17466
|
+
percent: number()
|
|
17243
17467
|
});
|
|
17244
|
-
|
|
17245
|
-
|
|
17246
|
-
|
|
17247
|
-
|
|
17248
|
-
|
|
17249
|
-
|
|
17250
|
-
|
|
17251
|
-
|
|
17252
|
-
|
|
17468
|
+
var PidResourceStatsSchema = object({
|
|
17469
|
+
pid: number(),
|
|
17470
|
+
cpu: number(),
|
|
17471
|
+
memory: number(),
|
|
17472
|
+
/**
|
|
17473
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
17474
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
17475
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
17476
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
17477
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
17478
|
+
*/
|
|
17479
|
+
privateBytes: number().optional(),
|
|
17480
|
+
/**
|
|
17481
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
17482
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
17483
|
+
*/
|
|
17484
|
+
sharedBytes: number().optional()
|
|
17485
|
+
});
|
|
17486
|
+
var AddonInstanceSchema = object({
|
|
17253
17487
|
addonId: string(),
|
|
17254
|
-
|
|
17255
|
-
|
|
17488
|
+
nodeId: string(),
|
|
17489
|
+
role: _enum(["hub", "worker"]),
|
|
17490
|
+
pid: number(),
|
|
17491
|
+
state: _enum([
|
|
17492
|
+
"starting",
|
|
17493
|
+
"running",
|
|
17494
|
+
"stopping",
|
|
17495
|
+
"stopped",
|
|
17496
|
+
"crashed"
|
|
17497
|
+
]),
|
|
17498
|
+
uptimeSec: number()
|
|
17256
17499
|
});
|
|
17257
|
-
|
|
17258
|
-
|
|
17259
|
-
|
|
17260
|
-
|
|
17261
|
-
|
|
17500
|
+
var NodeProcessSchema = object({
|
|
17501
|
+
pid: number(),
|
|
17502
|
+
ppid: number(),
|
|
17503
|
+
pgid: number(),
|
|
17504
|
+
classification: _enum([
|
|
17505
|
+
"root",
|
|
17506
|
+
"managed",
|
|
17507
|
+
"system",
|
|
17508
|
+
"ghost"
|
|
17509
|
+
]),
|
|
17510
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
17511
|
+
addonId: string().nullable(),
|
|
17512
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
17513
|
+
nodeId: string().nullable(),
|
|
17514
|
+
/** Truncated command line. */
|
|
17515
|
+
command: string(),
|
|
17516
|
+
cpuPercent: number(),
|
|
17517
|
+
memoryRssBytes: number(),
|
|
17518
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
17519
|
+
uptimeSec: number(),
|
|
17520
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
17521
|
+
orphaned: boolean()
|
|
17262
17522
|
});
|
|
17263
|
-
|
|
17264
|
-
|
|
17265
|
-
|
|
17266
|
-
|
|
17267
|
-
attachmentsSent: number().int().nonnegative(),
|
|
17268
|
-
actionsSent: number().int().nonnegative(),
|
|
17269
|
-
truncated: boolean(),
|
|
17270
|
-
dropped: array(string())
|
|
17523
|
+
var KillProcessInputSchema = object({
|
|
17524
|
+
pid: number(),
|
|
17525
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
17526
|
+
force: boolean().optional()
|
|
17271
17527
|
});
|
|
17272
|
-
var
|
|
17528
|
+
var KillProcessResultSchema = object({
|
|
17273
17529
|
success: boolean(),
|
|
17274
|
-
|
|
17275
|
-
|
|
17530
|
+
reason: string().optional(),
|
|
17531
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
17532
|
+
});
|
|
17533
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
17534
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
17535
|
+
addonId: string() });
|
|
17536
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
17537
|
+
success: boolean(),
|
|
17538
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
17539
|
+
path: string().optional(),
|
|
17540
|
+
/** Process pid that was signalled. */
|
|
17541
|
+
pid: number().optional(),
|
|
17542
|
+
reason: string().optional()
|
|
17543
|
+
});
|
|
17544
|
+
var SystemMetricsSchema = object({
|
|
17545
|
+
cpuPercent: number(),
|
|
17546
|
+
memoryPercent: number(),
|
|
17547
|
+
memoryUsedMB: number(),
|
|
17548
|
+
memoryTotalMB: number(),
|
|
17549
|
+
diskPercent: number().optional(),
|
|
17550
|
+
temperature: number().optional(),
|
|
17551
|
+
gpuPercent: number().optional(),
|
|
17552
|
+
gpuMemoryPercent: number().optional()
|
|
17553
|
+
});
|
|
17554
|
+
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, {
|
|
17555
|
+
kind: "mutation",
|
|
17556
|
+
auth: "admin"
|
|
17557
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
17558
|
+
kind: "mutation",
|
|
17559
|
+
auth: "admin"
|
|
17560
|
+
});
|
|
17561
|
+
method(object({
|
|
17562
|
+
sourceUrl: string(),
|
|
17563
|
+
metadata: ModelConvertMetadataSchema,
|
|
17564
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
17565
|
+
calibrationRef: string().optional(),
|
|
17566
|
+
sessionId: string().optional()
|
|
17567
|
+
}), ConvertResultSchema, {
|
|
17568
|
+
kind: "mutation",
|
|
17569
|
+
auth: "admin",
|
|
17570
|
+
timeoutMs: 6e5
|
|
17571
|
+
});
|
|
17572
|
+
method(object({
|
|
17573
|
+
nodeId: string(),
|
|
17574
|
+
modelId: string(),
|
|
17575
|
+
format: _enum(MODEL_FORMATS),
|
|
17576
|
+
entry: ModelCatalogEntrySchema
|
|
17577
|
+
}), object({
|
|
17578
|
+
ok: boolean(),
|
|
17579
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
17580
|
+
sha256: string(),
|
|
17581
|
+
bytes: number(),
|
|
17582
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
17583
|
+
path: string()
|
|
17584
|
+
}), {
|
|
17585
|
+
kind: "mutation",
|
|
17586
|
+
auth: "admin"
|
|
17276
17587
|
});
|
|
17277
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
17278
|
-
var TestResultSchema = SendResultSchema;
|
|
17279
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
17280
|
-
kind: string(),
|
|
17281
|
-
config: record(string(), unknown()).optional()
|
|
17282
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
17283
|
-
targetId: string(),
|
|
17284
|
-
notification: NotificationSchema
|
|
17285
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
17286
|
-
targetId: string(),
|
|
17287
|
-
sample: NotificationSchema.optional()
|
|
17288
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
17289
|
-
targetId: string(),
|
|
17290
|
-
enabled: boolean()
|
|
17291
|
-
}), _void(), { kind: "mutation" });
|
|
17292
17588
|
/**
|
|
17293
|
-
*
|
|
17589
|
+
* `mqtt-broker` — broker-registry cap.
|
|
17294
17590
|
*
|
|
17295
|
-
*
|
|
17296
|
-
* (
|
|
17591
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
17592
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
17593
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
17594
|
+
* its OWN `mqtt.js` client.
|
|
17297
17595
|
*
|
|
17298
|
-
*
|
|
17299
|
-
*
|
|
17300
|
-
*
|
|
17301
|
-
*
|
|
17302
|
-
*
|
|
17303
|
-
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
17304
|
-
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
17305
|
-
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
17306
|
-
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
17307
|
-
* by id; per-backend params are a passthrough blob capped by the
|
|
17308
|
-
* target kind's own caps/degrade engine).
|
|
17596
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
17597
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
17598
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
17599
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
17600
|
+
* features anyway — give it the connection config, get out of the way.
|
|
17309
17601
|
*
|
|
17310
|
-
*
|
|
17311
|
-
*
|
|
17312
|
-
*
|
|
17313
|
-
*
|
|
17314
|
-
* windows, and the optional label/identity/plate matchers. User rules,
|
|
17315
|
-
* private zones, per-recipient fan-out and the wider condition table are
|
|
17316
|
-
* P2+ (see spec §7).
|
|
17602
|
+
* Consumer flow:
|
|
17603
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
17604
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
17605
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
17317
17606
|
*
|
|
17318
|
-
*
|
|
17319
|
-
*
|
|
17320
|
-
*
|
|
17607
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
17608
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
17609
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
17610
|
+
* spawned it.
|
|
17321
17611
|
*/
|
|
17612
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
17322
17613
|
/**
|
|
17323
|
-
*
|
|
17324
|
-
* The value maps 1:1 onto the evaluated record kind:
|
|
17325
|
-
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
17326
|
-
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
17327
|
-
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
17328
|
-
* change of a LINKED device, one row per linked camera)
|
|
17329
|
-
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
17330
|
-
* delivery / pick-up)
|
|
17614
|
+
* Broker live-probe status.
|
|
17331
17615
|
*
|
|
17332
|
-
*
|
|
17333
|
-
*
|
|
17334
|
-
*
|
|
17335
|
-
*
|
|
17616
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
17617
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
17618
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
17619
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
17620
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
17336
17621
|
*/
|
|
17337
|
-
var
|
|
17338
|
-
"
|
|
17339
|
-
"
|
|
17340
|
-
"
|
|
17341
|
-
"
|
|
17622
|
+
var BrokerStatusSchema$1 = _enum([
|
|
17623
|
+
"connected",
|
|
17624
|
+
"disconnected",
|
|
17625
|
+
"auth-failed",
|
|
17626
|
+
"unreachable",
|
|
17627
|
+
"tls-error"
|
|
17342
17628
|
]);
|
|
17343
|
-
|
|
17344
|
-
|
|
17345
|
-
|
|
17346
|
-
|
|
17347
|
-
|
|
17348
|
-
|
|
17349
|
-
|
|
17350
|
-
|
|
17351
|
-
/**
|
|
17352
|
-
|
|
17353
|
-
/**
|
|
17354
|
-
|
|
17355
|
-
});
|
|
17356
|
-
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
17357
|
-
var NcPlateMatcherSchema = object({
|
|
17358
|
-
values: array(string().min(1)).min(1),
|
|
17359
|
-
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
17360
|
-
maxDistance: number().int().min(0).max(3).default(1)
|
|
17361
|
-
});
|
|
17362
|
-
/**
|
|
17363
|
-
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
17364
|
-
* occupancy edge for a device — optionally narrowed to a single admin
|
|
17365
|
-
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
17366
|
-
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
17367
|
-
* - `became-free` — count crossed ≥ `count` → below it
|
|
17368
|
-
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
17369
|
-
* `sustainSeconds` requires the condition hold continuously that long
|
|
17370
|
-
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
17371
|
-
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
17372
|
-
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
17373
|
-
* (declared SQLite collection, reseeded on boot).
|
|
17374
|
-
*/
|
|
17375
|
-
var NcOccupancyConditionSchema = object({
|
|
17376
|
-
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
17377
|
-
zoneId: string().optional(),
|
|
17378
|
-
/** Object class to count; absent = any class. */
|
|
17379
|
-
className: string().optional(),
|
|
17380
|
-
op: _enum([
|
|
17381
|
-
"became-occupied",
|
|
17382
|
-
"became-free",
|
|
17383
|
-
">=",
|
|
17384
|
-
"<="
|
|
17385
|
-
]).default("became-occupied"),
|
|
17386
|
-
count: number().int().min(0).default(1),
|
|
17387
|
-
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
17388
|
-
});
|
|
17389
|
-
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
17390
|
-
var NcZoneConditionSchema = object({
|
|
17391
|
-
ids: array(string().min(1)).min(1),
|
|
17392
|
-
/** Quantifier over `ids` — at least one / every one visited. */
|
|
17393
|
-
match: _enum(["any", "all"]).default("any")
|
|
17394
|
-
});
|
|
17395
|
-
/**
|
|
17396
|
-
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
17397
|
-
* membership lists are OR within the list (spec §2.3).
|
|
17398
|
-
*/
|
|
17399
|
-
var NcConditionsSchema = object({
|
|
17400
|
-
/** Device scope — absent = all devices. */
|
|
17401
|
-
devices: array(number()).optional(),
|
|
17402
|
-
/** Detector class names (any overlap with the record's class set). */
|
|
17403
|
-
classes: array(string().min(1)).optional(),
|
|
17404
|
-
/** Veto classes — any overlap fails the rule. */
|
|
17405
|
-
classesExclude: array(string().min(1)).optional(),
|
|
17406
|
-
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
17407
|
-
minConfidence: number().min(0).max(1).optional(),
|
|
17408
|
-
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
17409
|
-
zones: NcZoneConditionSchema.optional(),
|
|
17410
|
-
/** Veto zones — any hit fails the rule. */
|
|
17411
|
-
zonesExclude: array(string().min(1)).optional(),
|
|
17412
|
-
/**
|
|
17413
|
-
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
17414
|
-
* (identity name / plate text / subclass).
|
|
17415
|
-
*/
|
|
17416
|
-
labelEquals: array(string().min(1)).optional(),
|
|
17417
|
-
/**
|
|
17418
|
-
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
17419
|
-
* `label` (the identity display name propagated by the face pipeline) —
|
|
17420
|
-
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
17421
|
-
*/
|
|
17422
|
-
identities: array(string().min(1)).optional(),
|
|
17423
|
-
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
17424
|
-
plates: NcPlateMatcherSchema.optional(),
|
|
17425
|
-
/**
|
|
17426
|
-
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
17427
|
-
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
17428
|
-
* identity display name). A record with NO label passes (nothing to
|
|
17429
|
-
* exclude), unlike the include variant which fails on an absent label.
|
|
17430
|
-
*/
|
|
17431
|
-
identitiesExclude: array(string().min(1)).optional(),
|
|
17432
|
-
/**
|
|
17433
|
-
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
17434
|
-
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
17435
|
-
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
17436
|
-
* close the value is threaded via the close-time info (the `Track` clone is
|
|
17437
|
-
* captured before the DB row is updated, so it would otherwise read stale).
|
|
17438
|
-
* Fails when the record carries no importance (never guess quality — the
|
|
17439
|
-
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
17440
|
-
*/
|
|
17441
|
-
minImportance: number().min(0).max(1).optional(),
|
|
17442
|
-
/**
|
|
17443
|
-
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
17444
|
-
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
17445
|
-
* lifespan, so a dwell condition never matches immediate delivery
|
|
17446
|
-
* (documented choice — the object-event record carries no `firstSeen`,
|
|
17447
|
-
* so dwell cannot be computed from what the subject actually carries).
|
|
17448
|
-
*/
|
|
17449
|
-
minDwellSeconds: number().min(0).optional(),
|
|
17450
|
-
/**
|
|
17451
|
-
* Detection provenance filter. `any` (default / absent) matches every
|
|
17452
|
-
* source; otherwise the subject's source must equal it. Legacy records
|
|
17453
|
-
* with no stamped source are treated as `pipeline`. The union spans both
|
|
17454
|
-
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
17455
|
-
* tracks carry `sensor`.
|
|
17456
|
-
*/
|
|
17457
|
-
source: _enum([
|
|
17458
|
-
"pipeline",
|
|
17459
|
-
"onboard",
|
|
17460
|
-
"sensor",
|
|
17461
|
-
"any"
|
|
17462
|
-
]).optional(),
|
|
17463
|
-
/**
|
|
17464
|
-
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
17465
|
-
* detector `minConfidence` (that gates the object-detection score; this
|
|
17466
|
-
* gates the recognition/OCR match score). Fails when the subject carries
|
|
17467
|
-
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
17468
|
-
* lives on the recognition result and reaches the subject at track close.
|
|
17469
|
-
*
|
|
17470
|
-
* What it measures precisely (plumbed at track close — the closer threads
|
|
17471
|
-
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
17472
|
-
* `importance`): the BEST recognition match confidence observed for the
|
|
17473
|
-
* label the track carries at close — for a face, the peak cosine similarity
|
|
17474
|
-
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
17475
|
-
* for a plate, the peak OCR read score of the best-held plate
|
|
17476
|
-
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
17477
|
-
* one track the higher of the two is used. A track that ended with no
|
|
17478
|
-
* confident identity/plate match carries no value, so the condition fails
|
|
17479
|
-
* closed for it (an un-recognized subject).
|
|
17480
|
-
*/
|
|
17481
|
-
minLabelConfidence: number().min(0).max(1).optional(),
|
|
17482
|
-
/**
|
|
17483
|
-
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
17484
|
-
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
17485
|
-
* against the token carried on the device-event subject (extracted from the
|
|
17486
|
-
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
17487
|
-
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
17488
|
-
* eventType, so gate those with {@link sensorKinds} instead.
|
|
17489
|
-
*/
|
|
17490
|
-
eventTypeTokens: array(string().min(1)).optional(),
|
|
17491
|
-
/**
|
|
17492
|
-
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
17493
|
-
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
17494
|
-
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
17495
|
-
*/
|
|
17496
|
-
sensorKinds: array(string().min(1)).optional(),
|
|
17497
|
-
/**
|
|
17498
|
-
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
17499
|
-
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
17500
|
-
* when the subject's phase does not match (a subject always carries a phase
|
|
17501
|
-
* on the package-event trigger).
|
|
17502
|
-
*/
|
|
17503
|
-
packagePhase: _enum([
|
|
17504
|
-
"delivered",
|
|
17505
|
-
"picked-up",
|
|
17506
|
-
"both"
|
|
17507
|
-
]).optional(),
|
|
17508
|
-
/**
|
|
17509
|
-
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
17510
|
-
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
17511
|
-
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
17512
|
-
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
17513
|
-
*/
|
|
17514
|
-
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
17515
|
-
/**
|
|
17516
|
-
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
17517
|
-
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
17518
|
-
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
17519
|
-
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
17520
|
-
*/
|
|
17521
|
-
occupancy: NcOccupancyConditionSchema.optional()
|
|
17629
|
+
var BrokerInfoSchema = object({
|
|
17630
|
+
id: string(),
|
|
17631
|
+
name: string(),
|
|
17632
|
+
url: string(),
|
|
17633
|
+
kind: BrokerKindSchema,
|
|
17634
|
+
status: BrokerStatusSchema$1,
|
|
17635
|
+
latencyMs: number().nullable(),
|
|
17636
|
+
error: string().optional(),
|
|
17637
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
17638
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
17639
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
17640
|
+
lastCheckedAt: number().optional()
|
|
17522
17641
|
});
|
|
17523
|
-
/**
|
|
17524
|
-
|
|
17525
|
-
|
|
17526
|
-
|
|
17642
|
+
/**
|
|
17643
|
+
* Connection details — what a consumer needs to call
|
|
17644
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
17645
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
17646
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
17647
|
+
*/
|
|
17648
|
+
var BrokerConnectionDetailsSchema = object({
|
|
17649
|
+
url: string(),
|
|
17650
|
+
username: string().optional(),
|
|
17651
|
+
password: string().optional(),
|
|
17527
17652
|
/**
|
|
17528
|
-
*
|
|
17529
|
-
*
|
|
17530
|
-
*
|
|
17653
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
17654
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
17655
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
17656
|
+
* broker).
|
|
17531
17657
|
*/
|
|
17532
|
-
|
|
17658
|
+
clientIdPrefix: string().optional()
|
|
17659
|
+
});
|
|
17660
|
+
var AddBrokerInputSchema = object({
|
|
17661
|
+
name: string().min(1),
|
|
17662
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
17663
|
+
username: string().optional(),
|
|
17664
|
+
password: string().optional(),
|
|
17665
|
+
clientIdPrefix: string().optional()
|
|
17666
|
+
});
|
|
17667
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
17668
|
+
var IdInputSchema = object({ id: string() });
|
|
17669
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
17670
|
+
ok: literal(true),
|
|
17671
|
+
latencyMs: number()
|
|
17672
|
+
}), object({
|
|
17673
|
+
ok: literal(false),
|
|
17674
|
+
error: string()
|
|
17675
|
+
})]);
|
|
17676
|
+
var StartEmbeddedInputSchema = object({
|
|
17677
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
17678
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
17679
|
+
allowAnonymous: boolean().default(false),
|
|
17680
|
+
/** Optional shared username/password for clients. */
|
|
17681
|
+
username: string().optional(),
|
|
17682
|
+
password: string().optional()
|
|
17683
|
+
});
|
|
17684
|
+
var StartEmbeddedResultSchema = object({
|
|
17685
|
+
id: string(),
|
|
17686
|
+
url: string()
|
|
17687
|
+
});
|
|
17688
|
+
var StatusSchema = object({
|
|
17689
|
+
brokerCount: number(),
|
|
17690
|
+
embeddedRunning: boolean()
|
|
17691
|
+
});
|
|
17692
|
+
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);
|
|
17693
|
+
var NetworkEndpointSchema = object({
|
|
17694
|
+
url: string(),
|
|
17695
|
+
hostname: string(),
|
|
17696
|
+
port: number(),
|
|
17697
|
+
protocol: _enum(["http", "https"])
|
|
17698
|
+
});
|
|
17699
|
+
var NetworkAccessStatusSchema = object({
|
|
17700
|
+
connected: boolean(),
|
|
17701
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
17702
|
+
error: string().optional()
|
|
17533
17703
|
});
|
|
17534
17704
|
/**
|
|
17535
|
-
*
|
|
17536
|
-
*
|
|
17537
|
-
*
|
|
17538
|
-
*
|
|
17539
|
-
*
|
|
17540
|
-
*
|
|
17541
|
-
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
17542
|
-
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
17543
|
-
* name), so the choice never drifts from the record that fired it.
|
|
17544
|
-
* - `keyFrame` — the clean scene frame (no subject box).
|
|
17545
|
-
* - `none` — no attachment.
|
|
17705
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
17706
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
17707
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
17708
|
+
* the originating provider config (mode + sourcePort) so the
|
|
17709
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
17710
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
17546
17711
|
*/
|
|
17547
|
-
var
|
|
17548
|
-
"best",
|
|
17549
|
-
"best-matching",
|
|
17550
|
-
"keyFrame",
|
|
17551
|
-
"none"
|
|
17552
|
-
]).default("best") });
|
|
17553
|
-
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
17554
|
-
var NcThrottleSchema = object({
|
|
17555
|
-
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
17556
|
-
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
17557
|
-
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
17558
|
-
});
|
|
17559
|
-
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
17560
|
-
var NcRuleInputSchema = object({
|
|
17561
|
-
name: string().min(1).max(200),
|
|
17562
|
-
enabled: boolean().default(true),
|
|
17563
|
-
delivery: NcDeliverySchema,
|
|
17564
|
-
conditions: NcConditionsSchema.default({}),
|
|
17565
|
-
schedule: NcScheduleSchema.optional(),
|
|
17566
|
-
targets: array(NcRuleTargetSchema).min(1),
|
|
17567
|
-
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
17568
|
-
throttle: NcThrottleSchema.default({
|
|
17569
|
-
cooldownSec: 60,
|
|
17570
|
-
scope: "rule-device"
|
|
17571
|
-
}),
|
|
17572
|
-
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
17573
|
-
template: object({
|
|
17574
|
-
title: string().max(500).optional(),
|
|
17575
|
-
body: string().max(2e3).optional()
|
|
17576
|
-
}).optional(),
|
|
17577
|
-
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
17578
|
-
priority: number().int().min(1).max(5).default(3),
|
|
17712
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
17579
17713
|
/**
|
|
17580
|
-
*
|
|
17581
|
-
*
|
|
17582
|
-
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
17714
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
17715
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
17583
17716
|
*/
|
|
17584
|
-
|
|
17717
|
+
id: string(),
|
|
17718
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
17719
|
+
label: string(),
|
|
17720
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
17721
|
+
mode: string().optional(),
|
|
17722
|
+
/** Originating local port the ingress fronts (informational). */
|
|
17723
|
+
sourcePort: number().optional()
|
|
17585
17724
|
});
|
|
17725
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
17586
17726
|
/**
|
|
17587
|
-
*
|
|
17588
|
-
*
|
|
17589
|
-
*
|
|
17590
|
-
*
|
|
17591
|
-
*
|
|
17592
|
-
*
|
|
17593
|
-
* `
|
|
17727
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
17728
|
+
*
|
|
17729
|
+
* Apprise-derived model (see
|
|
17730
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
17731
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
17732
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
17733
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
17734
|
+
* message to what the kind supports — callers never special-case a service.
|
|
17735
|
+
*
|
|
17736
|
+
* DESIGN DECISIONS (locked):
|
|
17737
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
17738
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
17739
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
17740
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
17741
|
+
* alternative would fork the UI per addon and cannot host the
|
|
17742
|
+
* discovery→adopt flow.
|
|
17743
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
17744
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
17745
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
17746
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
17747
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
17748
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
17749
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
17750
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
17751
|
+
* base64 fallback needed.
|
|
17752
|
+
*
|
|
17753
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
17754
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
17755
|
+
* admin "Integrations" page.
|
|
17594
17756
|
*/
|
|
17595
|
-
|
|
17596
|
-
|
|
17597
|
-
|
|
17757
|
+
/**
|
|
17758
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
17759
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
17760
|
+
*/
|
|
17761
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
17762
|
+
"image",
|
|
17763
|
+
"video",
|
|
17764
|
+
"gif",
|
|
17765
|
+
"audio",
|
|
17766
|
+
"icon"
|
|
17767
|
+
]);
|
|
17768
|
+
/**
|
|
17769
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
17770
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
17771
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
17772
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
17773
|
+
*/
|
|
17774
|
+
var AttachmentSchema = object({
|
|
17775
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
17776
|
+
url: string().optional(),
|
|
17777
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
17778
|
+
mime: string().optional(),
|
|
17779
|
+
name: string().optional()
|
|
17780
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
17781
|
+
var NotificationFormatSchema = _enum([
|
|
17782
|
+
"text",
|
|
17783
|
+
"markdown",
|
|
17784
|
+
"html"
|
|
17785
|
+
]);
|
|
17786
|
+
/** A single tap-through action button. */
|
|
17787
|
+
var NotificationActionSchema = object({
|
|
17598
17788
|
id: string(),
|
|
17599
|
-
|
|
17600
|
-
|
|
17601
|
-
createdAt: number(),
|
|
17602
|
-
updatedAt: number(),
|
|
17603
|
-
/**
|
|
17604
|
-
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
17605
|
-
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
17606
|
-
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
17607
|
-
*/
|
|
17608
|
-
disabledTargetIds: array(string()).default([])
|
|
17789
|
+
label: string(),
|
|
17790
|
+
url: string().optional()
|
|
17609
17791
|
});
|
|
17610
|
-
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
17614
|
-
|
|
17615
|
-
|
|
17616
|
-
|
|
17617
|
-
|
|
17618
|
-
|
|
17619
|
-
|
|
17620
|
-
|
|
17621
|
-
|
|
17622
|
-
|
|
17623
|
-
|
|
17624
|
-
|
|
17792
|
+
/**
|
|
17793
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
17794
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
17795
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
17796
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
17797
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
17798
|
+
* `priority` for that one target.
|
|
17799
|
+
*/
|
|
17800
|
+
var NotificationSchema = object({
|
|
17801
|
+
body: string(),
|
|
17802
|
+
title: string().optional(),
|
|
17803
|
+
format: NotificationFormatSchema.default("text"),
|
|
17804
|
+
priority: number().int().min(1).max(5).default(3),
|
|
17805
|
+
level: string().optional(),
|
|
17806
|
+
attachments: array(AttachmentSchema).optional(),
|
|
17807
|
+
clickUrl: string().optional(),
|
|
17808
|
+
actions: array(NotificationActionSchema).optional(),
|
|
17809
|
+
sound: string().optional(),
|
|
17810
|
+
ttl: number().optional(),
|
|
17811
|
+
tag: string().optional(),
|
|
17812
|
+
deviceId: number().optional(),
|
|
17813
|
+
eventId: string().optional(),
|
|
17814
|
+
metadata: record(string(), unknown()).optional()
|
|
17625
17815
|
});
|
|
17626
|
-
|
|
17627
|
-
|
|
17816
|
+
/** One declared native severity/priority level for a kind. */
|
|
17817
|
+
var TargetKindLevelSchema = object({
|
|
17628
17818
|
id: string(),
|
|
17629
|
-
group: _enum([
|
|
17630
|
-
"scope",
|
|
17631
|
-
"class",
|
|
17632
|
-
"zones",
|
|
17633
|
-
"quality",
|
|
17634
|
-
"label",
|
|
17635
|
-
"schedule",
|
|
17636
|
-
"device",
|
|
17637
|
-
"package",
|
|
17638
|
-
"occupancy"
|
|
17639
|
-
]),
|
|
17640
17819
|
label: string(),
|
|
17641
|
-
/**
|
|
17642
|
-
|
|
17643
|
-
|
|
17644
|
-
|
|
17645
|
-
|
|
17646
|
-
|
|
17647
|
-
|
|
17648
|
-
|
|
17649
|
-
|
|
17650
|
-
"schedule",
|
|
17651
|
-
"plateMatcher",
|
|
17652
|
-
"packagePhase",
|
|
17653
|
-
"polygonDraw",
|
|
17654
|
-
"occupancy"
|
|
17655
|
-
]),
|
|
17656
|
-
operator: _enum([
|
|
17657
|
-
"in",
|
|
17658
|
-
"notIn",
|
|
17659
|
-
"anyOf",
|
|
17660
|
-
"allOf",
|
|
17661
|
-
"gte",
|
|
17662
|
-
"fuzzyIn",
|
|
17663
|
-
"withinSchedule"
|
|
17664
|
-
]),
|
|
17665
|
-
/** Which delivery kinds the condition applies to. */
|
|
17666
|
-
appliesTo: array(NcDeliverySchema),
|
|
17667
|
-
phase: string(),
|
|
17820
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
17821
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
17822
|
+
flags: object({
|
|
17823
|
+
critical: boolean().optional(),
|
|
17824
|
+
silent: boolean().optional(),
|
|
17825
|
+
noPush: boolean().optional()
|
|
17826
|
+
}).optional(),
|
|
17827
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
17828
|
+
requires: array(string()).optional(),
|
|
17668
17829
|
description: string().optional()
|
|
17669
17830
|
});
|
|
17831
|
+
/** The full capability block consulted before dispatch. */
|
|
17832
|
+
var TargetKindCapsSchema = object({
|
|
17833
|
+
attachments: object({
|
|
17834
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
17835
|
+
mode: _enum([
|
|
17836
|
+
"url",
|
|
17837
|
+
"bytes",
|
|
17838
|
+
"both"
|
|
17839
|
+
]),
|
|
17840
|
+
max: number().int().nonnegative(),
|
|
17841
|
+
maxBytes: number().int().positive().optional()
|
|
17842
|
+
}),
|
|
17843
|
+
/** Max action buttons (0 = none). */
|
|
17844
|
+
actions: number().int().nonnegative(),
|
|
17845
|
+
levels: array(TargetKindLevelSchema),
|
|
17846
|
+
format: array(NotificationFormatSchema),
|
|
17847
|
+
clickUrl: boolean(),
|
|
17848
|
+
sound: boolean(),
|
|
17849
|
+
ttl: boolean(),
|
|
17850
|
+
bodyMaxLen: number().int().positive()
|
|
17851
|
+
});
|
|
17670
17852
|
/**
|
|
17671
|
-
*
|
|
17672
|
-
*
|
|
17673
|
-
*
|
|
17674
|
-
*
|
|
17675
|
-
*
|
|
17676
|
-
* backend rejection / a deleted target (terminal; carries
|
|
17677
|
-
* the failure `error`)
|
|
17678
|
-
*
|
|
17679
|
-
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
17680
|
-
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
17853
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
17854
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
17855
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
17856
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
17857
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
17681
17858
|
*/
|
|
17682
|
-
var
|
|
17683
|
-
|
|
17684
|
-
|
|
17685
|
-
|
|
17686
|
-
|
|
17687
|
-
/**
|
|
17688
|
-
|
|
17689
|
-
|
|
17690
|
-
|
|
17691
|
-
|
|
17692
|
-
"package-event"
|
|
17693
|
-
]);
|
|
17694
|
-
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
17695
|
-
var NcHistorySubjectSchema = object({
|
|
17696
|
-
className: string(),
|
|
17697
|
-
label: string().optional(),
|
|
17698
|
-
confidence: number().optional(),
|
|
17699
|
-
zones: array(string()),
|
|
17700
|
-
timestamp: number()
|
|
17859
|
+
var ConfigSchemaPassthrough = unknown();
|
|
17860
|
+
var TargetKindSchema = object({
|
|
17861
|
+
kind: string(),
|
|
17862
|
+
label: string(),
|
|
17863
|
+
icon: string(),
|
|
17864
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
17865
|
+
addonId: string(),
|
|
17866
|
+
configSchema: ConfigSchemaPassthrough,
|
|
17867
|
+
supportsDiscovery: boolean(),
|
|
17868
|
+
caps: TargetKindCapsSchema
|
|
17701
17869
|
});
|
|
17702
17870
|
/**
|
|
17703
|
-
*
|
|
17704
|
-
*
|
|
17705
|
-
*
|
|
17706
|
-
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
17707
|
-
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
17708
|
-
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
17709
|
-
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
17710
|
-
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
17711
|
-
* P1 (admin scope only).
|
|
17871
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
17872
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
17873
|
+
* round-trip a stored secret to the UI.
|
|
17712
17874
|
*/
|
|
17713
|
-
var
|
|
17714
|
-
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
17875
|
+
var TargetSchema = object({
|
|
17715
17876
|
id: string(),
|
|
17716
|
-
|
|
17717
|
-
|
|
17718
|
-
|
|
17719
|
-
|
|
17720
|
-
|
|
17721
|
-
targetId: string(),
|
|
17722
|
-
deviceId: number(),
|
|
17723
|
-
recordKind: NcHistoryRecordKindSchema,
|
|
17724
|
-
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
17725
|
-
recordId: string(),
|
|
17726
|
-
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
17727
|
-
trackId: string().optional(),
|
|
17728
|
-
status: NcHistoryStatusSchema,
|
|
17729
|
-
/** Delivery attempts made so far. */
|
|
17730
|
-
attempts: number().int(),
|
|
17731
|
-
/** Fire time (outbox enqueue). */
|
|
17732
|
-
createdAt: number(),
|
|
17733
|
-
/** Last transition time (terminal for sent / dead). */
|
|
17734
|
-
updatedAt: number(),
|
|
17735
|
-
/** Failure detail — present on a `dead` row. */
|
|
17736
|
-
error: string().optional(),
|
|
17737
|
-
subject: NcHistorySubjectSchema
|
|
17877
|
+
name: string(),
|
|
17878
|
+
kind: string(),
|
|
17879
|
+
addonId: string(),
|
|
17880
|
+
enabled: boolean(),
|
|
17881
|
+
config: record(string(), unknown())
|
|
17738
17882
|
});
|
|
17739
|
-
/**
|
|
17740
|
-
|
|
17741
|
-
|
|
17742
|
-
|
|
17743
|
-
|
|
17744
|
-
*/
|
|
17745
|
-
var NcHistoryFilterSchema = object({
|
|
17746
|
-
ruleId: string().optional(),
|
|
17747
|
-
deviceId: number().optional(),
|
|
17748
|
-
status: NcHistoryStatusSchema.optional(),
|
|
17749
|
-
since: number().optional(),
|
|
17750
|
-
until: number().optional(),
|
|
17751
|
-
limit: number().int().min(1).max(500).default(100)
|
|
17883
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
17884
|
+
var DiscoveredTargetSchema = object({
|
|
17885
|
+
kind: string(),
|
|
17886
|
+
suggestedName: string(),
|
|
17887
|
+
config: record(string(), unknown())
|
|
17752
17888
|
});
|
|
17753
|
-
|
|
17754
|
-
|
|
17755
|
-
|
|
17756
|
-
|
|
17757
|
-
|
|
17758
|
-
|
|
17759
|
-
|
|
17760
|
-
|
|
17761
|
-
|
|
17762
|
-
|
|
17763
|
-
|
|
17764
|
-
|
|
17765
|
-
|
|
17766
|
-
|
|
17767
|
-
|
|
17768
|
-
|
|
17889
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
17890
|
+
var RenderedAsSchema = object({
|
|
17891
|
+
level: string(),
|
|
17892
|
+
format: NotificationFormatSchema,
|
|
17893
|
+
attachmentsSent: number().int().nonnegative(),
|
|
17894
|
+
actionsSent: number().int().nonnegative(),
|
|
17895
|
+
truncated: boolean(),
|
|
17896
|
+
dropped: array(string())
|
|
17897
|
+
});
|
|
17898
|
+
var SendResultSchema = object({
|
|
17899
|
+
success: boolean(),
|
|
17900
|
+
error: string().optional(),
|
|
17901
|
+
renderedAs: RenderedAsSchema.optional()
|
|
17902
|
+
});
|
|
17903
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
17904
|
+
var TestResultSchema = SendResultSchema;
|
|
17905
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
17906
|
+
kind: string(),
|
|
17907
|
+
config: record(string(), unknown()).optional()
|
|
17908
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
17909
|
+
targetId: string(),
|
|
17910
|
+
notification: NotificationSchema
|
|
17911
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
17912
|
+
targetId: string(),
|
|
17913
|
+
sample: NotificationSchema.optional()
|
|
17914
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
17915
|
+
targetId: string(),
|
|
17769
17916
|
enabled: boolean()
|
|
17770
|
-
}),
|
|
17771
|
-
kind: "mutation",
|
|
17772
|
-
auth: "admin"
|
|
17773
|
-
}), method(object({
|
|
17774
|
-
rule: NcRuleInputSchema,
|
|
17775
|
-
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
17776
|
-
}), object({ results: array(NcTestResultSchema) }), {
|
|
17777
|
-
kind: "mutation",
|
|
17778
|
-
auth: "admin"
|
|
17779
|
-
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
17917
|
+
}), _void(), { kind: "mutation" });
|
|
17780
17918
|
/**
|
|
17781
17919
|
* Zod schemas for persisted record types.
|
|
17782
17920
|
*
|
|
@@ -26827,6 +26965,36 @@ Object.freeze({
|
|
|
26827
26965
|
addonId: null,
|
|
26828
26966
|
access: "create"
|
|
26829
26967
|
},
|
|
26968
|
+
"terminalSession.close": {
|
|
26969
|
+
capName: "terminal-session",
|
|
26970
|
+
capScope: "system",
|
|
26971
|
+
addonId: null,
|
|
26972
|
+
access: "create"
|
|
26973
|
+
},
|
|
26974
|
+
"terminalSession.listProfiles": {
|
|
26975
|
+
capName: "terminal-session",
|
|
26976
|
+
capScope: "system",
|
|
26977
|
+
addonId: null,
|
|
26978
|
+
access: "view"
|
|
26979
|
+
},
|
|
26980
|
+
"terminalSession.listSessions": {
|
|
26981
|
+
capName: "terminal-session",
|
|
26982
|
+
capScope: "system",
|
|
26983
|
+
addonId: null,
|
|
26984
|
+
access: "view"
|
|
26985
|
+
},
|
|
26986
|
+
"terminalSession.openSession": {
|
|
26987
|
+
capName: "terminal-session",
|
|
26988
|
+
capScope: "system",
|
|
26989
|
+
addonId: null,
|
|
26990
|
+
access: "create"
|
|
26991
|
+
},
|
|
26992
|
+
"terminalSession.resize": {
|
|
26993
|
+
capName: "terminal-session",
|
|
26994
|
+
capScope: "system",
|
|
26995
|
+
addonId: null,
|
|
26996
|
+
access: "create"
|
|
26997
|
+
},
|
|
26830
26998
|
"toast.onToast": {
|
|
26831
26999
|
capName: "toast",
|
|
26832
27000
|
capScope: "system",
|