@camstack/addon-auth 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{dist-D1pCpeFq.js → dist-B294R-hF.js} +2300 -2051
- package/dist/{dist-BMyVeNla.mjs → dist-BgeghE4T.mjs} +2300 -2051
- package/dist/magic-link/auth-magic-link.addon.js +1 -1
- package/dist/magic-link/auth-magic-link.addon.mjs +1 -1
- package/dist/oidc/auth-oidc.addon.js +1 -1
- package/dist/oidc/auth-oidc.addon.mjs +1 -1
- package/dist/webauthn/_stub.js +1 -1
- package/dist/webauthn/{_virtual_mf-localSharedImportMap___mfe_internal__addon_auth_webauthn_widgets-Bsc2vpvj.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_auth_webauthn_widgets-DlF0sYEj.mjs} +3 -3
- package/dist/webauthn/_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DJRJwp0e.mjs +26 -0
- package/dist/webauthn/auth-webauthn.addon.js +1 -1
- package/dist/webauthn/auth-webauthn.addon.mjs +1 -1
- package/dist/webauthn/{hostInit-DZ3Vsvv5.mjs → hostInit-T3tDo_Q0.mjs} +3 -3
- package/dist/webauthn/remoteEntry.js +1 -1
- package/package.json +1 -1
- package/dist/webauthn/_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CJL0YiKn.mjs +0 -26
|
@@ -7630,16 +7630,23 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7630
7630
|
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7631
7631
|
* FRESH install:
|
|
7632
7632
|
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7633
|
-
* the appData volume. Right for small/durable data (
|
|
7633
|
+
* the appData volume. Right for small/durable data (logs, models).
|
|
7634
7634
|
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7635
7635
|
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7636
7636
|
* (recordings, event media) that should stay off the appData disk.
|
|
7637
|
+
* - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
|
|
7638
|
+
* `/backups` in the image) so archives live on their own mount rather than
|
|
7639
|
+
* filling the appData disk. Falls back to the data root when unset.
|
|
7637
7640
|
*
|
|
7638
7641
|
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7639
7642
|
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7640
7643
|
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7641
7644
|
*/
|
|
7642
|
-
defaultRoot: _enum([
|
|
7645
|
+
defaultRoot: _enum([
|
|
7646
|
+
"data",
|
|
7647
|
+
"media",
|
|
7648
|
+
"backup"
|
|
7649
|
+
]).optional()
|
|
7643
7650
|
});
|
|
7644
7651
|
var DecoderStatsSchema = object({
|
|
7645
7652
|
inputFps: number(),
|
|
@@ -8990,398 +8997,1036 @@ var AccessoryKind = {
|
|
|
8990
8997
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
8991
8998
|
DeviceFeature.BatteryOperated;
|
|
8992
8999
|
/**
|
|
8993
|
-
*
|
|
8994
|
-
*
|
|
8995
|
-
*
|
|
8996
|
-
*
|
|
8997
|
-
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
8998
|
-
* their own slices.
|
|
9000
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
9001
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
9002
|
+
* language so a single drawing-plane editor and the providers stay
|
|
9003
|
+
* decoupled from each cap's storage.
|
|
8999
9004
|
*
|
|
9000
|
-
*
|
|
9001
|
-
*
|
|
9002
|
-
* `
|
|
9003
|
-
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
9004
|
-
* consumers reach the same data via the `device-state` cap router
|
|
9005
|
-
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
9005
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
9006
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
9007
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
9006
9008
|
*/
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
* stream-health, Reolink reads firmware push events, ONVIF tracks
|
|
9012
|
-
* ping responses. This cap intentionally does NOT prescribe which
|
|
9013
|
-
* signal drives the flag.
|
|
9014
|
-
*/
|
|
9015
|
-
online: boolean(),
|
|
9016
|
-
/** Ms epoch of the last `online` transition. Lets consumers tell
|
|
9017
|
-
* apart "just came online" from "still online". */
|
|
9018
|
-
lastChangedAt: number()
|
|
9009
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
9010
|
+
var MaskPointSchema = object({
|
|
9011
|
+
x: number(),
|
|
9012
|
+
y: number()
|
|
9019
9013
|
});
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9014
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
9015
|
+
var MaskRectShapeSchema = object({
|
|
9016
|
+
kind: literal("rect"),
|
|
9017
|
+
x: number(),
|
|
9018
|
+
y: number(),
|
|
9019
|
+
width: number(),
|
|
9020
|
+
height: number()
|
|
9021
|
+
});
|
|
9022
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
9023
|
+
var MaskPolygonShapeSchema = object({
|
|
9024
|
+
kind: literal("polygon"),
|
|
9025
|
+
points: array(MaskPointSchema)
|
|
9026
|
+
});
|
|
9027
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
9028
|
+
var MaskGridShapeSchema = object({
|
|
9029
|
+
kind: literal("grid"),
|
|
9030
|
+
gridWidth: number(),
|
|
9031
|
+
gridHeight: number(),
|
|
9032
|
+
cells: array(boolean())
|
|
9033
|
+
});
|
|
9034
|
+
discriminatedUnion("kind", [
|
|
9035
|
+
MaskRectShapeSchema,
|
|
9036
|
+
MaskPolygonShapeSchema,
|
|
9037
|
+
MaskGridShapeSchema,
|
|
9038
|
+
object({
|
|
9039
|
+
kind: literal("line"),
|
|
9040
|
+
points: array(MaskPointSchema)
|
|
9041
|
+
})
|
|
9042
|
+
]);
|
|
9043
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
9044
|
+
var MaskShapeKindSchema = _enum([
|
|
9045
|
+
"rect",
|
|
9046
|
+
"polygon",
|
|
9047
|
+
"grid",
|
|
9048
|
+
"line"
|
|
9049
|
+
]);
|
|
9050
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
9051
|
+
var MaskPolygonVerticesSchema = object({
|
|
9052
|
+
min: number(),
|
|
9053
|
+
max: number()
|
|
9054
|
+
});
|
|
9055
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
9056
|
+
var MaskGridDimsSchema = object({
|
|
9057
|
+
width: number(),
|
|
9058
|
+
height: number()
|
|
9023
9059
|
});
|
|
9024
9060
|
/**
|
|
9025
|
-
*
|
|
9026
|
-
* truth about what a device CAN do — which the kernel uses to:
|
|
9027
|
-
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
9028
|
-
* based on what the firmware actually advertises).
|
|
9029
|
-
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
9030
|
-
* `device-manager.listAll`.
|
|
9031
|
-
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
9032
|
-
* to register on the device's capability surface.
|
|
9061
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
9033
9062
|
*
|
|
9034
|
-
*
|
|
9035
|
-
*
|
|
9036
|
-
* accessory reconciliation). Consumers read via:
|
|
9037
|
-
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
9063
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
9064
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
9038
9065
|
*
|
|
9039
|
-
*
|
|
9040
|
-
*
|
|
9041
|
-
*
|
|
9066
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
9067
|
+
* `notification-center` module), hooked on the durable persistence
|
|
9068
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
9069
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
9070
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
9071
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
9072
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
9073
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
9074
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
9075
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
9076
|
+
* target kind's own caps/degrade engine).
|
|
9042
9077
|
*
|
|
9043
|
-
*
|
|
9044
|
-
*
|
|
9045
|
-
*
|
|
9046
|
-
*
|
|
9078
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
9079
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
9080
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
9081
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
9082
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
9083
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
9084
|
+
* P2+ (see spec §7).
|
|
9085
|
+
*
|
|
9086
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
9087
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
9088
|
+
* schema/interface drift is explicitly not repeated).
|
|
9047
9089
|
*/
|
|
9048
|
-
|
|
9090
|
+
/**
|
|
9091
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
9092
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
9093
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
9094
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
9095
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
9096
|
+
* change of a LINKED device, one row per linked camera)
|
|
9097
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
9098
|
+
* delivery / pick-up)
|
|
9099
|
+
*
|
|
9100
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
9101
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
9102
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
9103
|
+
* one trigger.
|
|
9104
|
+
*/
|
|
9105
|
+
var NcDeliverySchema = _enum([
|
|
9106
|
+
"immediate",
|
|
9107
|
+
"track-end",
|
|
9108
|
+
"device-event",
|
|
9109
|
+
"package-event"
|
|
9110
|
+
]);
|
|
9111
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
9112
|
+
var NcScheduleSchema = object({
|
|
9113
|
+
windows: array(object({
|
|
9114
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
9115
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
9116
|
+
startMinute: number().int().min(0).max(1439),
|
|
9117
|
+
endMinute: number().int().min(0).max(1439)
|
|
9118
|
+
})).min(1),
|
|
9119
|
+
/** IANA timezone; default = hub host timezone. */
|
|
9120
|
+
timezone: string().optional(),
|
|
9121
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
9122
|
+
invert: boolean().optional()
|
|
9123
|
+
});
|
|
9124
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
9125
|
+
var NcPlateMatcherSchema = object({
|
|
9126
|
+
values: array(string().min(1)).min(1),
|
|
9127
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9128
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9129
|
+
});
|
|
9130
|
+
/**
|
|
9131
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9132
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9133
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9134
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9135
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9136
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9137
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9138
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9139
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9140
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9141
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9142
|
+
*/
|
|
9143
|
+
var NcOccupancyConditionSchema = object({
|
|
9144
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9145
|
+
zoneId: string().optional(),
|
|
9146
|
+
/** Object class to count; absent = any class. */
|
|
9147
|
+
className: string().optional(),
|
|
9148
|
+
op: _enum([
|
|
9149
|
+
"became-occupied",
|
|
9150
|
+
"became-free",
|
|
9151
|
+
">=",
|
|
9152
|
+
"<="
|
|
9153
|
+
]).default("became-occupied"),
|
|
9154
|
+
count: number().int().min(0).default(1),
|
|
9155
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9156
|
+
});
|
|
9157
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9158
|
+
var NcZoneConditionSchema = object({
|
|
9159
|
+
ids: array(string().min(1)).min(1),
|
|
9160
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9161
|
+
match: _enum(["any", "all"]).default("any")
|
|
9162
|
+
});
|
|
9163
|
+
/**
|
|
9164
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9165
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9166
|
+
*/
|
|
9167
|
+
var NcConditionsSchema = object({
|
|
9168
|
+
/** Device scope — absent = all devices. */
|
|
9169
|
+
devices: array(number()).optional(),
|
|
9170
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9171
|
+
classes: array(string().min(1)).optional(),
|
|
9172
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9173
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9174
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9175
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9176
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9177
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9178
|
+
/** Veto zones — any hit fails the rule. */
|
|
9179
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
9049
9180
|
/**
|
|
9050
|
-
*
|
|
9051
|
-
*
|
|
9052
|
-
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
9053
|
-
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
9054
|
-
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9181
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9182
|
+
* (identity name / plate text / subclass).
|
|
9055
9183
|
*/
|
|
9056
|
-
|
|
9184
|
+
labelEquals: array(string().min(1)).optional(),
|
|
9057
9185
|
/**
|
|
9058
|
-
*
|
|
9059
|
-
*
|
|
9060
|
-
*
|
|
9186
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9187
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9188
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
9061
9189
|
*/
|
|
9062
|
-
|
|
9063
|
-
/**
|
|
9064
|
-
|
|
9065
|
-
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
9066
|
-
channelCount: number().nullable(),
|
|
9190
|
+
identities: array(string().min(1)).optional(),
|
|
9191
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9192
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
9067
9193
|
/**
|
|
9068
|
-
*
|
|
9069
|
-
*
|
|
9070
|
-
*
|
|
9071
|
-
*
|
|
9194
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9195
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9196
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9197
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
9072
9198
|
*/
|
|
9073
|
-
|
|
9199
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
9074
9200
|
/**
|
|
9075
|
-
*
|
|
9076
|
-
*
|
|
9077
|
-
*
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9201
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9202
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9203
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9204
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9205
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9206
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9207
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9208
|
+
*/
|
|
9209
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9210
|
+
/**
|
|
9211
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9212
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9213
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9214
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9215
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9216
|
+
*/
|
|
9217
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9218
|
+
/**
|
|
9219
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9220
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9221
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9222
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9223
|
+
* tracks carry `sensor`.
|
|
9224
|
+
*/
|
|
9225
|
+
source: _enum([
|
|
9226
|
+
"pipeline",
|
|
9227
|
+
"onboard",
|
|
9228
|
+
"sensor",
|
|
9229
|
+
"any"
|
|
9230
|
+
]).optional(),
|
|
9231
|
+
/**
|
|
9232
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9233
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9234
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9235
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9236
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9237
|
+
*
|
|
9238
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9239
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9240
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9241
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9242
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9243
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9244
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9245
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9246
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9247
|
+
* closed for it (an un-recognized subject).
|
|
9248
|
+
*/
|
|
9249
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9250
|
+
/**
|
|
9251
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9252
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9253
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9254
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9255
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9256
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9257
|
+
*/
|
|
9258
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9259
|
+
/**
|
|
9260
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9261
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9262
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9263
|
+
*/
|
|
9264
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9265
|
+
/**
|
|
9266
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9267
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9268
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9269
|
+
* on the package-event trigger).
|
|
9270
|
+
*/
|
|
9271
|
+
packagePhase: _enum([
|
|
9272
|
+
"delivered",
|
|
9273
|
+
"picked-up",
|
|
9274
|
+
"both"
|
|
9275
|
+
]).optional(),
|
|
9276
|
+
/**
|
|
9277
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9278
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9279
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9280
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9281
|
+
*/
|
|
9282
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9283
|
+
/**
|
|
9284
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9285
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9286
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9287
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9288
|
+
*/
|
|
9289
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9084
9290
|
});
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
aqi: number().optional(),
|
|
9096
|
-
/** Ms epoch when the slice was last updated. */
|
|
9097
|
-
lastFetchedAt: number(),
|
|
9098
|
-
/** Live display unit of the single metric this slice carries (e.g. HA
|
|
9099
|
-
* `attributes.unit_of_measurement` → 'ppm' / 'ppb' / 'µg/m³'). Each
|
|
9100
|
-
* upstream `sensor.*` entity surfaces ONE device_class, so one unit
|
|
9101
|
-
* per slice is unambiguous. */
|
|
9102
|
-
unit: string().optional(),
|
|
9103
|
-
/** Suggested decimal places for numeric display.
|
|
9104
|
-
* Populated live from the upstream source when provided (e.g. HA
|
|
9105
|
-
* `attributes.suggested_display_precision`). Falls back to
|
|
9106
|
-
* auto-formatting when absent. */
|
|
9107
|
-
precision: number().int().min(0).max(10).optional()
|
|
9291
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9292
|
+
var NcRuleTargetSchema = object({
|
|
9293
|
+
/** `notification-output` Target id. */
|
|
9294
|
+
targetId: string().min(1),
|
|
9295
|
+
/**
|
|
9296
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9297
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9298
|
+
* degrade engine drops what the backend can't render.
|
|
9299
|
+
*/
|
|
9300
|
+
params: record(string(), unknown()).optional()
|
|
9108
9301
|
});
|
|
9109
|
-
DeviceType.Sensor;
|
|
9110
9302
|
/**
|
|
9111
|
-
*
|
|
9112
|
-
* `
|
|
9113
|
-
*
|
|
9114
|
-
*
|
|
9115
|
-
*
|
|
9116
|
-
*
|
|
9117
|
-
*
|
|
9118
|
-
*
|
|
9119
|
-
*
|
|
9120
|
-
* `
|
|
9121
|
-
*
|
|
9122
|
-
*
|
|
9123
|
-
* `availableModes` mirrors HA's `supported_features`-derived arm
|
|
9124
|
-
* mode list — the UI renders only the buttons the panel accepts.
|
|
9303
|
+
* Media attachment policy (P1 still-image subset).
|
|
9304
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9305
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9306
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9307
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9308
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9309
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9310
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9311
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9312
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9313
|
+
* - `none` — no attachment.
|
|
9125
9314
|
*/
|
|
9126
|
-
var
|
|
9127
|
-
"
|
|
9128
|
-
"
|
|
9129
|
-
"
|
|
9130
|
-
"
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
"
|
|
9137
|
-
]);
|
|
9138
|
-
var AlarmArmModeSchema = _enum([
|
|
9139
|
-
"home",
|
|
9140
|
-
"away",
|
|
9141
|
-
"night",
|
|
9142
|
-
"vacation",
|
|
9143
|
-
"custom_bypass"
|
|
9144
|
-
]);
|
|
9145
|
-
object({
|
|
9146
|
-
/** Current lifecycle state. */
|
|
9147
|
-
state: AlarmStateSchema,
|
|
9148
|
-
/** Subset of arm modes the panel accepts. UI renders one button per
|
|
9149
|
-
* mode in this list. */
|
|
9150
|
-
availableModes: array(AlarmArmModeSchema),
|
|
9151
|
-
/** Whether the panel requires a PIN on arm / disarm. Mirrors
|
|
9152
|
-
* `DeviceFeature.AlarmPinRequired` for slice consumers. */
|
|
9153
|
-
requiresCode: boolean(),
|
|
9154
|
-
/** Ms epoch when the slice was last updated. */
|
|
9155
|
-
lastChangedAt: number()
|
|
9156
|
-
});
|
|
9157
|
-
DeviceType.AlarmPanel, method(object({
|
|
9158
|
-
deviceId: number().int().nonnegative(),
|
|
9159
|
-
mode: AlarmArmModeSchema,
|
|
9160
|
-
/** Optional PIN code. Required when `requiresCode === true`.
|
|
9161
|
-
* Passed through to the upstream service; never persisted. */
|
|
9162
|
-
code: string().min(1).optional()
|
|
9163
|
-
}), _void(), {
|
|
9164
|
-
kind: "mutation",
|
|
9165
|
-
auth: "admin"
|
|
9166
|
-
}), method(object({
|
|
9167
|
-
deviceId: number().int().nonnegative(),
|
|
9168
|
-
code: string().min(1).optional()
|
|
9169
|
-
}), _void(), {
|
|
9170
|
-
kind: "mutation",
|
|
9171
|
-
auth: "admin"
|
|
9172
|
-
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
9173
|
-
kind: "mutation",
|
|
9174
|
-
auth: "admin"
|
|
9315
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9316
|
+
"best",
|
|
9317
|
+
"best-matching",
|
|
9318
|
+
"keyFrame",
|
|
9319
|
+
"none"
|
|
9320
|
+
]).default("best") });
|
|
9321
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9322
|
+
var NcThrottleSchema = object({
|
|
9323
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9324
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9325
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9175
9326
|
});
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9327
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9328
|
+
var NcRuleInputSchema = object({
|
|
9329
|
+
name: string().min(1).max(200),
|
|
9330
|
+
enabled: boolean().default(true),
|
|
9331
|
+
delivery: NcDeliverySchema,
|
|
9332
|
+
conditions: NcConditionsSchema.default({}),
|
|
9333
|
+
schedule: NcScheduleSchema.optional(),
|
|
9334
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9335
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9336
|
+
throttle: NcThrottleSchema.default({
|
|
9337
|
+
cooldownSec: 60,
|
|
9338
|
+
scope: "rule-device"
|
|
9339
|
+
}),
|
|
9340
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9341
|
+
template: object({
|
|
9342
|
+
title: string().max(500).optional(),
|
|
9343
|
+
body: string().max(2e3).optional()
|
|
9344
|
+
}).optional(),
|
|
9345
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9346
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9347
|
+
/**
|
|
9348
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9349
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9350
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9351
|
+
*/
|
|
9352
|
+
ownerUserId: string().optional()
|
|
9190
9353
|
});
|
|
9191
|
-
DeviceType.Sensor;
|
|
9192
9354
|
/**
|
|
9193
|
-
*
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9355
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9356
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9357
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9358
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9359
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9360
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9361
|
+
* `updateRule` patch.
|
|
9362
|
+
*/
|
|
9363
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9364
|
+
/** A persisted rule. */
|
|
9365
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9366
|
+
id: string(),
|
|
9367
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9368
|
+
createdBy: string(),
|
|
9369
|
+
createdAt: number(),
|
|
9370
|
+
updatedAt: number(),
|
|
9371
|
+
/**
|
|
9372
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9373
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9374
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9375
|
+
*/
|
|
9376
|
+
disabledTargetIds: array(string()).default([])
|
|
9377
|
+
});
|
|
9378
|
+
var NcTestResultSchema = object({
|
|
9379
|
+
recordId: string(),
|
|
9380
|
+
recordKind: _enum([
|
|
9381
|
+
"object-event",
|
|
9382
|
+
"track",
|
|
9383
|
+
"device-event",
|
|
9384
|
+
"package-event"
|
|
9385
|
+
]),
|
|
9386
|
+
deviceId: number(),
|
|
9387
|
+
timestamp: number(),
|
|
9388
|
+
wouldFire: boolean(),
|
|
9389
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9390
|
+
failedCondition: string().optional(),
|
|
9391
|
+
className: string().optional(),
|
|
9392
|
+
label: string().optional()
|
|
9393
|
+
});
|
|
9394
|
+
var NcConditionDescriptorSchema = object({
|
|
9395
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9396
|
+
id: string(),
|
|
9397
|
+
group: _enum([
|
|
9398
|
+
"scope",
|
|
9399
|
+
"class",
|
|
9400
|
+
"zones",
|
|
9401
|
+
"quality",
|
|
9402
|
+
"label",
|
|
9403
|
+
"schedule",
|
|
9404
|
+
"device",
|
|
9405
|
+
"package",
|
|
9406
|
+
"occupancy"
|
|
9407
|
+
]),
|
|
9408
|
+
label: string(),
|
|
9409
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9410
|
+
valueType: _enum([
|
|
9411
|
+
"deviceIdList",
|
|
9412
|
+
"stringList",
|
|
9413
|
+
"number01",
|
|
9414
|
+
"number",
|
|
9415
|
+
"sourceSelect",
|
|
9416
|
+
"zoneSelection",
|
|
9417
|
+
"zoneIdList",
|
|
9418
|
+
"schedule",
|
|
9419
|
+
"plateMatcher",
|
|
9420
|
+
"packagePhase",
|
|
9421
|
+
"polygonDraw",
|
|
9422
|
+
"occupancy"
|
|
9423
|
+
]),
|
|
9424
|
+
operator: _enum([
|
|
9425
|
+
"in",
|
|
9426
|
+
"notIn",
|
|
9427
|
+
"anyOf",
|
|
9428
|
+
"allOf",
|
|
9429
|
+
"gte",
|
|
9430
|
+
"fuzzyIn",
|
|
9431
|
+
"withinSchedule"
|
|
9432
|
+
]),
|
|
9433
|
+
/** Which delivery kinds the condition applies to. */
|
|
9434
|
+
appliesTo: array(NcDeliverySchema),
|
|
9435
|
+
phase: string(),
|
|
9436
|
+
description: string().optional()
|
|
9203
9437
|
});
|
|
9204
9438
|
/**
|
|
9205
|
-
*
|
|
9206
|
-
*
|
|
9207
|
-
*
|
|
9208
|
-
*
|
|
9209
|
-
*
|
|
9210
|
-
*
|
|
9439
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9440
|
+
* durable outbox row's own status (single source of truth):
|
|
9441
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9442
|
+
* - `sent` — delivered (terminal)
|
|
9443
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9444
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9445
|
+
* the failure `error`)
|
|
9211
9446
|
*
|
|
9212
|
-
*
|
|
9213
|
-
* (
|
|
9214
|
-
* and the level history shifts forward.
|
|
9447
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9448
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9215
9449
|
*/
|
|
9216
|
-
var
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
}).nullable(),
|
|
9236
|
-
/** Per-class summary across the rolling window — keys are
|
|
9237
|
-
* `macroClass` strings (e.g. `dog_bark`, `speech`, `glass_break`). */
|
|
9238
|
-
byClass: array(AudioClassSummarySchema).readonly()
|
|
9450
|
+
var NcHistoryStatusSchema = _enum([
|
|
9451
|
+
"pending",
|
|
9452
|
+
"sent",
|
|
9453
|
+
"dead"
|
|
9454
|
+
]);
|
|
9455
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9456
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9457
|
+
"object-event",
|
|
9458
|
+
"track-end",
|
|
9459
|
+
"device-event",
|
|
9460
|
+
"package-event"
|
|
9461
|
+
]);
|
|
9462
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9463
|
+
var NcHistorySubjectSchema = object({
|
|
9464
|
+
className: string(),
|
|
9465
|
+
label: string().optional(),
|
|
9466
|
+
confidence: number().optional(),
|
|
9467
|
+
zones: array(string()),
|
|
9468
|
+
timestamp: number()
|
|
9239
9469
|
});
|
|
9240
9470
|
/**
|
|
9241
|
-
*
|
|
9242
|
-
*
|
|
9243
|
-
*
|
|
9244
|
-
*
|
|
9245
|
-
*
|
|
9471
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9472
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9473
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9474
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9475
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9476
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9477
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9478
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9479
|
+
* P1 (admin scope only).
|
|
9246
9480
|
*/
|
|
9247
|
-
var
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
peakDbfs: number(),
|
|
9257
|
-
/** Rolling-window mean dBFS at sample time. */
|
|
9258
|
-
avgDbfs: number(),
|
|
9259
|
-
/** Dominant above-threshold class at sample time, or null on silence. */
|
|
9260
|
-
topClass: string().nullable(),
|
|
9261
|
-
/** Score of the dominant class (`null` whenever `topClass` is null). */
|
|
9262
|
-
topScore: number().min(0).max(1).nullable()
|
|
9263
|
-
})).readonly(),
|
|
9264
|
-
/** Actual ms between adjacent samples after any subsampling. */
|
|
9265
|
-
effectiveSampleEveryMs: number().int().positive(),
|
|
9266
|
-
/** Wall-clock window covered by `points` (`points[N-1].ts - points[0].ts`),
|
|
9267
|
-
* or `0` when there's fewer than 2 samples. */
|
|
9268
|
-
windowMsActual: number().int().nonnegative()
|
|
9269
|
-
});
|
|
9270
|
-
DeviceType.Camera, method(object({ deviceId: number() }), AudioMetricsSnapshotSchema.nullable()), method(object({
|
|
9481
|
+
var NcHistoryEntrySchema = object({
|
|
9482
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9483
|
+
id: string(),
|
|
9484
|
+
ruleId: string(),
|
|
9485
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9486
|
+
ruleName: string(),
|
|
9487
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9488
|
+
delivery: NcDeliverySchema,
|
|
9489
|
+
targetId: string(),
|
|
9271
9490
|
deviceId: number(),
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
/**
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
/**
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
/** Ms epoch of the last successful run. 0 when never run. */
|
|
9288
|
-
lastTriggeredAt: number(),
|
|
9289
|
-
/** Failure description from the last completed run. Null on success
|
|
9290
|
-
* or when never run. */
|
|
9291
|
-
lastError: string().nullable(),
|
|
9292
|
-
/** Ms epoch when the slice was last updated. */
|
|
9293
|
-
lastChangedAt: number()
|
|
9491
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9492
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9493
|
+
recordId: string(),
|
|
9494
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9495
|
+
trackId: string().optional(),
|
|
9496
|
+
status: NcHistoryStatusSchema,
|
|
9497
|
+
/** Delivery attempts made so far. */
|
|
9498
|
+
attempts: number().int(),
|
|
9499
|
+
/** Fire time (outbox enqueue). */
|
|
9500
|
+
createdAt: number(),
|
|
9501
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9502
|
+
updatedAt: number(),
|
|
9503
|
+
/** Failure detail — present on a `dead` row. */
|
|
9504
|
+
error: string().optional(),
|
|
9505
|
+
subject: NcHistorySubjectSchema
|
|
9294
9506
|
});
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
9507
|
+
/**
|
|
9508
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9509
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9510
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9511
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9512
|
+
*/
|
|
9513
|
+
var NcHistoryFilterSchema = object({
|
|
9514
|
+
ruleId: string().optional(),
|
|
9515
|
+
deviceId: number().optional(),
|
|
9516
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9517
|
+
since: number().optional(),
|
|
9518
|
+
until: number().optional(),
|
|
9519
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9520
|
+
});
|
|
9521
|
+
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 }), {
|
|
9299
9522
|
kind: "mutation",
|
|
9300
|
-
auth: "admin"
|
|
9523
|
+
auth: "admin",
|
|
9524
|
+
caller: "required"
|
|
9301
9525
|
}), method(object({
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9526
|
+
ruleId: string(),
|
|
9527
|
+
patch: NcRulePatchSchema
|
|
9528
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9529
|
+
kind: "mutation",
|
|
9530
|
+
auth: "admin",
|
|
9531
|
+
caller: "required"
|
|
9532
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9308
9533
|
kind: "mutation",
|
|
9309
9534
|
auth: "admin"
|
|
9310
|
-
})
|
|
9535
|
+
}), method(object({
|
|
9536
|
+
ruleId: string(),
|
|
9537
|
+
enabled: boolean()
|
|
9538
|
+
}), object({ success: literal(true) }), {
|
|
9539
|
+
kind: "mutation",
|
|
9540
|
+
auth: "admin"
|
|
9541
|
+
}), method(object({
|
|
9542
|
+
rule: NcRuleInputSchema,
|
|
9543
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9544
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9545
|
+
kind: "mutation",
|
|
9546
|
+
auth: "admin"
|
|
9547
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9311
9548
|
/**
|
|
9312
|
-
*
|
|
9313
|
-
*
|
|
9314
|
-
*
|
|
9315
|
-
*
|
|
9316
|
-
*
|
|
9549
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9550
|
+
*
|
|
9551
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
9552
|
+
* §3.2/§3.3.
|
|
9553
|
+
*
|
|
9554
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
9555
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
9556
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
9557
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
9558
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
9559
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
9560
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
9561
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
9562
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
9563
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
9564
|
+
*
|
|
9565
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
9566
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
9567
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
9568
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
9569
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
9317
9570
|
*/
|
|
9318
|
-
var
|
|
9319
|
-
|
|
9320
|
-
|
|
9571
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
9572
|
+
var TimelapseTemplateSchema = object({
|
|
9573
|
+
title: string().max(500).optional(),
|
|
9574
|
+
body: string().max(2e3).optional()
|
|
9575
|
+
});
|
|
9576
|
+
var NameField = string().min(1).max(200);
|
|
9577
|
+
var DeviceIdsField = array(number()).min(1);
|
|
9578
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
9579
|
+
var FramerateField = number().int().min(1).max(60);
|
|
9580
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
9581
|
+
var PriorityField = number().int().min(1).max(5);
|
|
9582
|
+
/**
|
|
9583
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
9584
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
9585
|
+
* here (see the ownership note above).
|
|
9586
|
+
*/
|
|
9587
|
+
var TimelapseRuleInputSchema = object({
|
|
9588
|
+
name: NameField,
|
|
9589
|
+
enabled: boolean().default(true),
|
|
9590
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
9591
|
+
deviceIds: DeviceIdsField,
|
|
9321
9592
|
/**
|
|
9322
|
-
*
|
|
9323
|
-
*
|
|
9324
|
-
*
|
|
9325
|
-
* alone.
|
|
9593
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
9594
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
9595
|
+
* open clears the scratch, close assembles and delivers.
|
|
9326
9596
|
*/
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
9597
|
+
schedule: NcScheduleSchema,
|
|
9598
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
9599
|
+
cadenceSec: CadenceSecField.default(15),
|
|
9600
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
9601
|
+
framerate: FramerateField.default(10),
|
|
9602
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
9603
|
+
targets: TargetsField,
|
|
9604
|
+
template: TimelapseTemplateSchema.optional(),
|
|
9605
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9606
|
+
priority: PriorityField.default(3)
|
|
9607
|
+
});
|
|
9608
|
+
object({
|
|
9609
|
+
name: NameField.optional(),
|
|
9610
|
+
enabled: boolean().optional(),
|
|
9611
|
+
deviceIds: DeviceIdsField.optional(),
|
|
9612
|
+
schedule: NcScheduleSchema.optional(),
|
|
9613
|
+
cadenceSec: CadenceSecField.optional(),
|
|
9614
|
+
framerate: FramerateField.optional(),
|
|
9615
|
+
targets: TargetsField.optional(),
|
|
9616
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
9617
|
+
priority: PriorityField.optional()
|
|
9618
|
+
});
|
|
9619
|
+
TimelapseRuleInputSchema.extend({
|
|
9620
|
+
id: string(),
|
|
9332
9621
|
/**
|
|
9333
|
-
*
|
|
9334
|
-
*
|
|
9335
|
-
*
|
|
9622
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
9623
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
9624
|
+
* resolved caller; never trusted from a client payload.
|
|
9336
9625
|
*/
|
|
9337
|
-
|
|
9338
|
-
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
9339
|
-
lastUpdated: number(),
|
|
9626
|
+
ownerUserId: string().optional(),
|
|
9340
9627
|
/**
|
|
9341
|
-
*
|
|
9342
|
-
*
|
|
9343
|
-
* charge level — `percentage` is then a coarse stand-in (100 = normal,
|
|
9344
|
-
* sub-threshold = low). UI MUST render "Normal"/"Low" instead of a
|
|
9345
|
-
* misleading exact percentage. Absent/false → genuine 0–100 % reading.
|
|
9628
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
9629
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
9346
9630
|
*/
|
|
9347
|
-
|
|
9631
|
+
lastGeneratedAt: number().optional(),
|
|
9632
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
9633
|
+
createdBy: string(),
|
|
9634
|
+
createdAt: number(),
|
|
9635
|
+
updatedAt: number()
|
|
9348
9636
|
});
|
|
9349
|
-
|
|
9637
|
+
/**
|
|
9638
|
+
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
9639
|
+
* for every device, regardless of provider — the kernel needs a uniform
|
|
9640
|
+
* cap-keyed slice for the basic device flags every consumer expects to
|
|
9641
|
+
* read across processes (the `online` flag in particular). Driver-specific
|
|
9642
|
+
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
9643
|
+
* their own slices.
|
|
9644
|
+
*
|
|
9645
|
+
* Pattern is identical to `battery`: schema-bearing `runtimeState`,
|
|
9646
|
+
* empty `methods`, single change event. Reads land at
|
|
9647
|
+
* `runtimeState.getCapState('device-status')`; writes at
|
|
9648
|
+
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
9649
|
+
* consumers reach the same data via the `device-state` cap router
|
|
9650
|
+
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
9651
|
+
*/
|
|
9652
|
+
var DeviceStatusSchema = object({
|
|
9653
|
+
/**
|
|
9654
|
+
* Device-level liveness. Drivers flip via `markOnline(boolean)` on
|
|
9655
|
+
* `BaseDevice`. Provider semantics vary — RTSP aggregates broker
|
|
9656
|
+
* stream-health, Reolink reads firmware push events, ONVIF tracks
|
|
9657
|
+
* ping responses. This cap intentionally does NOT prescribe which
|
|
9658
|
+
* signal drives the flag.
|
|
9659
|
+
*/
|
|
9660
|
+
online: boolean(),
|
|
9661
|
+
/** Ms epoch of the last `online` transition. Lets consumers tell
|
|
9662
|
+
* apart "just came online" from "still online". */
|
|
9663
|
+
lastChangedAt: number()
|
|
9664
|
+
});
|
|
9665
|
+
object({
|
|
9350
9666
|
deviceId: number(),
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9667
|
+
status: DeviceStatusSchema
|
|
9668
|
+
});
|
|
9669
|
+
/**
|
|
9670
|
+
* Per-device feature/identity probe slice. Holds the runtime-resolved
|
|
9671
|
+
* truth about what a device CAN do — which the kernel uses to:
|
|
9672
|
+
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
9673
|
+
* based on what the firmware actually advertises).
|
|
9674
|
+
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
9675
|
+
* `device-manager.listAll`.
|
|
9676
|
+
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
9677
|
+
* to register on the device's capability surface.
|
|
9678
|
+
*
|
|
9679
|
+
* Auto-registered by `BaseDevice` for every device. Drivers populate the
|
|
9680
|
+
* slice from `onProbe()` (kernel calls it once after register, before
|
|
9681
|
+
* accessory reconciliation). Consumers read via:
|
|
9682
|
+
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
9683
|
+
*
|
|
9684
|
+
* `flags` is an open record so each driver carries its own keys without
|
|
9685
|
+
* a centralized schema bottleneck — Reolink writes `hasPtz/hasIntercom`,
|
|
9686
|
+
* Hikvision writes `hasSupplementalLight/hasAlarmIo`, etc.
|
|
9687
|
+
*
|
|
9688
|
+
* Replaces the older driver-local `deviceCache.has*` blob: the per-device
|
|
9689
|
+
* config is for operator-edited overrides + UI snapshots; runtime probe
|
|
9690
|
+
* results belong in runtime-state where the kernel handles persistence,
|
|
9691
|
+
* cross-process mirroring, and reactive updates.
|
|
9692
|
+
*/
|
|
9693
|
+
var FeatureProbeStatusSchema = object({
|
|
9694
|
+
/**
|
|
9695
|
+
* Driver-specific flag bag. Each driver picks its own key names — the
|
|
9696
|
+
* cap deliberately does NOT enforce a closed enum here. Reolink keys:
|
|
9697
|
+
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
9698
|
+
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
9699
|
+
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9700
|
+
*/
|
|
9701
|
+
flags: record(string(), unknown()),
|
|
9702
|
+
/**
|
|
9703
|
+
* Coarse driver-classification — lets cross-process consumers tell apart
|
|
9704
|
+
* cameras / battery-cams / NVRs without re-running the probe. `null`
|
|
9705
|
+
* before the first probe completes.
|
|
9706
|
+
*/
|
|
9707
|
+
deviceType: string().nullable(),
|
|
9708
|
+
/** Camera/firmware model string. `null` when the firmware doesn't expose it. */
|
|
9709
|
+
model: string().nullable(),
|
|
9710
|
+
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
9711
|
+
channelCount: number().nullable(),
|
|
9712
|
+
/**
|
|
9713
|
+
* Ms epoch of the last SUCCESSFUL probe. `0` before the first probe
|
|
9714
|
+
* completes — drivers' `getAccessoryChildren()` should treat zero as
|
|
9715
|
+
* "probe not done yet, return empty" so accessories aren't spawned
|
|
9716
|
+
* before the firmware is queried.
|
|
9717
|
+
*/
|
|
9718
|
+
lastProbedAt: number(),
|
|
9719
|
+
/**
|
|
9720
|
+
* Framework convention: every runtime-state slice carries this for the
|
|
9721
|
+
* createRuntimeStateBridge stale-check helper. We keep it in sync with
|
|
9722
|
+
* `lastProbedAt` on every write.
|
|
9723
|
+
*/
|
|
9724
|
+
lastFetchedAt: number()
|
|
9725
|
+
});
|
|
9726
|
+
object({
|
|
9357
9727
|
deviceId: number(),
|
|
9358
|
-
status:
|
|
9728
|
+
status: FeatureProbeStatusSchema
|
|
9359
9729
|
});
|
|
9360
9730
|
object({
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9731
|
+
/** Carbon dioxide concentration in ppm. */
|
|
9732
|
+
co2Ppm: number().min(0).optional(),
|
|
9733
|
+
/** Total volatile organic compounds in ppb. */
|
|
9734
|
+
vocPpb: number().min(0).optional(),
|
|
9735
|
+
/** Particulate matter ≤ 2.5 μm in µg/m³. */
|
|
9736
|
+
pm25: number().min(0).optional(),
|
|
9737
|
+
/** Particulate matter ≤ 10 μm in µg/m³. */
|
|
9738
|
+
pm10: number().min(0).optional(),
|
|
9739
|
+
/** Composite AQI value (typically 0..500). */
|
|
9740
|
+
aqi: number().optional(),
|
|
9741
|
+
/** Ms epoch when the slice was last updated. */
|
|
9742
|
+
lastFetchedAt: number(),
|
|
9743
|
+
/** Live display unit of the single metric this slice carries (e.g. HA
|
|
9744
|
+
* `attributes.unit_of_measurement` → 'ppm' / 'ppb' / 'µg/m³'). Each
|
|
9745
|
+
* upstream `sensor.*` entity surfaces ONE device_class, so one unit
|
|
9746
|
+
* per slice is unambiguous. */
|
|
9747
|
+
unit: string().optional(),
|
|
9748
|
+
/** Suggested decimal places for numeric display.
|
|
9749
|
+
* Populated live from the upstream source when provided (e.g. HA
|
|
9750
|
+
* `attributes.suggested_display_precision`). Falls back to
|
|
9751
|
+
* auto-formatting when absent. */
|
|
9752
|
+
precision: number().int().min(0).max(10).optional()
|
|
9364
9753
|
});
|
|
9365
9754
|
DeviceType.Sensor;
|
|
9755
|
+
/**
|
|
9756
|
+
* Alarm-panel cap. Models HA `alarm_control_panel.*` on
|
|
9757
|
+
* `DeviceType.AlarmPanel`. State follows HA's canonical lifecycle
|
|
9758
|
+
* across disarmed / armed_(home|away|night|vacation|custom_bypass) /
|
|
9759
|
+
* arming / pending / triggered / disarming.
|
|
9760
|
+
*
|
|
9761
|
+
* Many panels require a PIN code on arm / disarm — the optional
|
|
9762
|
+
* `code` field on the methods passes it through to the upstream
|
|
9763
|
+
* service; it's NEVER persisted in the runtime slice or any event
|
|
9764
|
+
* payload. The presence of a required code is signalled by
|
|
9765
|
+
* `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
|
|
9766
|
+
* field without a slice fetch.
|
|
9767
|
+
*
|
|
9768
|
+
* `availableModes` mirrors HA's `supported_features`-derived arm
|
|
9769
|
+
* mode list — the UI renders only the buttons the panel accepts.
|
|
9770
|
+
*/
|
|
9771
|
+
var AlarmStateSchema = _enum([
|
|
9772
|
+
"disarmed",
|
|
9773
|
+
"armed_home",
|
|
9774
|
+
"armed_away",
|
|
9775
|
+
"armed_night",
|
|
9776
|
+
"armed_vacation",
|
|
9777
|
+
"armed_custom_bypass",
|
|
9778
|
+
"arming",
|
|
9779
|
+
"disarming",
|
|
9780
|
+
"pending",
|
|
9781
|
+
"triggered"
|
|
9782
|
+
]);
|
|
9783
|
+
var AlarmArmModeSchema = _enum([
|
|
9784
|
+
"home",
|
|
9785
|
+
"away",
|
|
9786
|
+
"night",
|
|
9787
|
+
"vacation",
|
|
9788
|
+
"custom_bypass"
|
|
9789
|
+
]);
|
|
9366
9790
|
object({
|
|
9367
|
-
/** Current
|
|
9368
|
-
|
|
9369
|
-
/**
|
|
9791
|
+
/** Current lifecycle state. */
|
|
9792
|
+
state: AlarmStateSchema,
|
|
9793
|
+
/** Subset of arm modes the panel accepts. UI renders one button per
|
|
9794
|
+
* mode in this list. */
|
|
9795
|
+
availableModes: array(AlarmArmModeSchema),
|
|
9796
|
+
/** Whether the panel requires a PIN on arm / disarm. Mirrors
|
|
9797
|
+
* `DeviceFeature.AlarmPinRequired` for slice consumers. */
|
|
9798
|
+
requiresCode: boolean(),
|
|
9799
|
+
/** Ms epoch when the slice was last updated. */
|
|
9370
9800
|
lastChangedAt: number()
|
|
9371
9801
|
});
|
|
9372
|
-
DeviceType.
|
|
9802
|
+
DeviceType.AlarmPanel, method(object({
|
|
9373
9803
|
deviceId: number().int().nonnegative(),
|
|
9374
|
-
|
|
9804
|
+
mode: AlarmArmModeSchema,
|
|
9805
|
+
/** Optional PIN code. Required when `requiresCode === true`.
|
|
9806
|
+
* Passed through to the upstream service; never persisted. */
|
|
9807
|
+
code: string().min(1).optional()
|
|
9375
9808
|
}), _void(), {
|
|
9376
9809
|
kind: "mutation",
|
|
9377
9810
|
auth: "admin"
|
|
9378
|
-
}), object({
|
|
9379
|
-
deviceId: number(),
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9811
|
+
}), method(object({
|
|
9812
|
+
deviceId: number().int().nonnegative(),
|
|
9813
|
+
code: string().min(1).optional()
|
|
9814
|
+
}), _void(), {
|
|
9815
|
+
kind: "mutation",
|
|
9816
|
+
auth: "admin"
|
|
9817
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
9818
|
+
kind: "mutation",
|
|
9819
|
+
auth: "admin"
|
|
9820
|
+
});
|
|
9821
|
+
object({
|
|
9822
|
+
/** Current illuminance in lux (lx). */
|
|
9823
|
+
lux: number().min(0),
|
|
9824
|
+
/** Ms epoch when the slice was last updated. */
|
|
9825
|
+
lastFetchedAt: number(),
|
|
9826
|
+
/** Live display unit from the upstream source (e.g. HA
|
|
9827
|
+
* `attributes.unit_of_measurement`). The UI prefers this over the
|
|
9828
|
+
* role's canonical unit. Absent → fall back to the canonical unit. */
|
|
9829
|
+
unit: string().optional(),
|
|
9830
|
+
/** Suggested decimal places for numeric display.
|
|
9831
|
+
* Populated live from the upstream source when provided (e.g. HA
|
|
9832
|
+
* `attributes.suggested_display_precision`). Falls back to
|
|
9833
|
+
* auto-formatting when absent. */
|
|
9834
|
+
precision: number().int().min(0).max(10).optional()
|
|
9835
|
+
});
|
|
9836
|
+
DeviceType.Sensor;
|
|
9837
|
+
/**
|
|
9838
|
+
* Per-class audio metrics aggregated over a sliding window.
|
|
9839
|
+
*/
|
|
9840
|
+
var AudioClassSummarySchema = object({
|
|
9841
|
+
className: string(),
|
|
9842
|
+
/** Number of windows (chunks) where this class was the top hit. */
|
|
9843
|
+
hits: number().int().nonnegative(),
|
|
9844
|
+
/** Mean score across those hits, clamped to [0,1]. */
|
|
9845
|
+
avgScore: number().min(0).max(1),
|
|
9846
|
+
/** Peak score in the window. */
|
|
9847
|
+
peakScore: number().min(0).max(1)
|
|
9848
|
+
});
|
|
9849
|
+
/**
|
|
9850
|
+
* Per-camera audio metrics snapshot — emitted by the analytics frame
|
|
9851
|
+
* handler on every `pipeline.audio-inference-result` event and
|
|
9852
|
+
* mirrored into the `audio-metrics` device-state slice. Symmetric
|
|
9853
|
+
* with `zone-analytics` snapshots for video — every consumer
|
|
9854
|
+
* (admin UI panel, automations, alert rules) reads via the
|
|
9855
|
+
* canonical `device.state.audioMetrics.value` reactive handle.
|
|
9856
|
+
*
|
|
9857
|
+
* Aggregates are computed over a rolling `windowSec` window
|
|
9858
|
+
* (default 60s). Past that window, classes drop out of `byClass`
|
|
9859
|
+
* and the level history shifts forward.
|
|
9860
|
+
*/
|
|
9861
|
+
var AudioMetricsSnapshotSchema = object({
|
|
9862
|
+
/** Wall-clock timestamp (ms) of the most recent audio window. */
|
|
9863
|
+
ts: number().int(),
|
|
9864
|
+
/** Sliding-window length (seconds) used for aggregation. */
|
|
9865
|
+
windowSec: number().int().positive(),
|
|
9866
|
+
/** Latest level reading from the most recent window. */
|
|
9867
|
+
level: object({
|
|
9868
|
+
rms: number(),
|
|
9869
|
+
dbfs: number()
|
|
9870
|
+
}),
|
|
9871
|
+
/** Peak dBFS observed across the rolling window. */
|
|
9872
|
+
peakDbfs: number(),
|
|
9873
|
+
/** Mean dBFS across the rolling window. */
|
|
9874
|
+
avgDbfs: number(),
|
|
9875
|
+
/** Most recent above-threshold classification, or null on silence. */
|
|
9876
|
+
current: object({
|
|
9877
|
+
className: string(),
|
|
9878
|
+
score: number().min(0).max(1),
|
|
9879
|
+
timestamp: number().int()
|
|
9880
|
+
}).nullable(),
|
|
9881
|
+
/** Per-class summary across the rolling window — keys are
|
|
9882
|
+
* `macroClass` strings (e.g. `dog_bark`, `speech`, `glass_break`). */
|
|
9883
|
+
byClass: array(AudioClassSummarySchema).readonly()
|
|
9884
|
+
});
|
|
9885
|
+
/**
|
|
9886
|
+
* Audio-metrics history payload — a series of `AudioMetricsHistoryPoint`
|
|
9887
|
+
* samples capped at `maxPoints` (default 1024). When the requested
|
|
9888
|
+
* `windowSec / sampleEveryMs` would exceed the cap, the provider
|
|
9889
|
+
* subsamples by bucketed averaging and reports the effective sample
|
|
9890
|
+
* spacing on `effectiveSampleEveryMs` so the UI can label the x-axis.
|
|
9891
|
+
*/
|
|
9892
|
+
var AudioMetricsHistorySchema = object({
|
|
9893
|
+
points: array(object({
|
|
9894
|
+
/** Wall-clock ms when this sample was recorded. */
|
|
9895
|
+
ts: number().int(),
|
|
9896
|
+
/** Instantaneous dBFS level at sample time. `null` for windows where
|
|
9897
|
+
* the source had no level reading (rare; happens at decode startup). */
|
|
9898
|
+
dbfs: number().nullable(),
|
|
9899
|
+
/** Rolling-window peak dBFS at sample time. Same window the live
|
|
9900
|
+
* snapshot reports. */
|
|
9901
|
+
peakDbfs: number(),
|
|
9902
|
+
/** Rolling-window mean dBFS at sample time. */
|
|
9903
|
+
avgDbfs: number(),
|
|
9904
|
+
/** Dominant above-threshold class at sample time, or null on silence. */
|
|
9905
|
+
topClass: string().nullable(),
|
|
9906
|
+
/** Score of the dominant class (`null` whenever `topClass` is null). */
|
|
9907
|
+
topScore: number().min(0).max(1).nullable()
|
|
9908
|
+
})).readonly(),
|
|
9909
|
+
/** Actual ms between adjacent samples after any subsampling. */
|
|
9910
|
+
effectiveSampleEveryMs: number().int().positive(),
|
|
9911
|
+
/** Wall-clock window covered by `points` (`points[N-1].ts - points[0].ts`),
|
|
9912
|
+
* or `0` when there's fewer than 2 samples. */
|
|
9913
|
+
windowMsActual: number().int().nonnegative()
|
|
9914
|
+
});
|
|
9915
|
+
DeviceType.Camera, method(object({ deviceId: number() }), AudioMetricsSnapshotSchema.nullable()), method(object({
|
|
9916
|
+
deviceId: number(),
|
|
9917
|
+
/** History window in seconds. Default 300 (5 minutes).
|
|
9918
|
+
* Provider clamps to its retention cap if larger. */
|
|
9919
|
+
windowSec: number().int().positive().optional(),
|
|
9920
|
+
/** Target sample interval in ms. Default 1000 (1 sample/second).
|
|
9921
|
+
* Provider clamps to natural sample rate if smaller, and
|
|
9922
|
+
* bucket-averages when bigger than the requested window
|
|
9923
|
+
* would produce more than `maxPoints` samples. */
|
|
9924
|
+
sampleEveryMs: number().int().positive().optional()
|
|
9925
|
+
}), AudioMetricsHistorySchema);
|
|
9926
|
+
object({
|
|
9927
|
+
/** Whether the automation is currently enabled. Disabled automations
|
|
9928
|
+
* ignore their trigger block — manual `trigger` still works. */
|
|
9929
|
+
enabled: boolean(),
|
|
9930
|
+
/** Whether the automation is currently executing its action block. */
|
|
9931
|
+
isRunning: boolean(),
|
|
9932
|
+
/** Ms epoch of the last successful run. 0 when never run. */
|
|
9933
|
+
lastTriggeredAt: number(),
|
|
9934
|
+
/** Failure description from the last completed run. Null on success
|
|
9935
|
+
* or when never run. */
|
|
9936
|
+
lastError: string().nullable(),
|
|
9937
|
+
/** Ms epoch when the slice was last updated. */
|
|
9938
|
+
lastChangedAt: number()
|
|
9939
|
+
});
|
|
9940
|
+
DeviceType.Automation, method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
9941
|
+
kind: "mutation",
|
|
9942
|
+
auth: "admin"
|
|
9943
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
9944
|
+
kind: "mutation",
|
|
9945
|
+
auth: "admin"
|
|
9946
|
+
}), method(object({
|
|
9947
|
+
deviceId: number().int().nonnegative(),
|
|
9948
|
+
/** When true, fires the action block while bypassing the
|
|
9949
|
+
* automation's condition evaluation. Gated by
|
|
9950
|
+
* `DeviceFeature.AutomationSkipCondition`. */
|
|
9951
|
+
skipCondition: boolean().optional()
|
|
9952
|
+
}), _void(), {
|
|
9953
|
+
kind: "mutation",
|
|
9954
|
+
auth: "admin"
|
|
9955
|
+
});
|
|
9956
|
+
/**
|
|
9957
|
+
* Battery status snapshot. Emitted by providers whose device is
|
|
9958
|
+
* battery-operated (cameras with `DeviceFeature.BatteryOperated`,
|
|
9959
|
+
* future sensor/button accessories). Consumers build their own "low
|
|
9960
|
+
* battery" alerting on top — the cap deliberately does NOT enforce a
|
|
9961
|
+
* threshold.
|
|
9962
|
+
*/
|
|
9963
|
+
var BatteryStatusSchema = object({
|
|
9964
|
+
/** 0..100 inclusive. Firmware-reported. */
|
|
9965
|
+
percentage: number().min(0).max(100),
|
|
9966
|
+
/**
|
|
9967
|
+
* Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
|
|
9968
|
+
* Reolink-specific for the Solar Panel 2 accessory (will become
|
|
9969
|
+
* common on other battery cams). `'none'` means running on battery
|
|
9970
|
+
* alone.
|
|
9971
|
+
*/
|
|
9972
|
+
charging: _enum([
|
|
9973
|
+
"dc",
|
|
9974
|
+
"solar",
|
|
9975
|
+
"none"
|
|
9976
|
+
]),
|
|
9977
|
+
/**
|
|
9978
|
+
* True when the camera firmware has gone into low-power mode. Battery
|
|
9979
|
+
* providers MUST avoid polling during sleep — reading the battery
|
|
9980
|
+
* wakes the camera up and drains charge.
|
|
9981
|
+
*/
|
|
9982
|
+
sleeping: boolean(),
|
|
9983
|
+
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
9984
|
+
lastUpdated: number(),
|
|
9985
|
+
/**
|
|
9986
|
+
* True when the source is a BINARY low-battery indicator (HA
|
|
9987
|
+
* `binary_sensor` device_class=battery / `LOW_BAT`) that has no real
|
|
9988
|
+
* charge level — `percentage` is then a coarse stand-in (100 = normal,
|
|
9989
|
+
* sub-threshold = low). UI MUST render "Normal"/"Low" instead of a
|
|
9990
|
+
* misleading exact percentage. Absent/false → genuine 0–100 % reading.
|
|
9991
|
+
*/
|
|
9992
|
+
binary: boolean().optional()
|
|
9993
|
+
});
|
|
9994
|
+
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, method(object({
|
|
9995
|
+
deviceId: number(),
|
|
9996
|
+
/** Bound on the wait. Sensible range 3000–10000ms. */
|
|
9997
|
+
timeoutMs: number().int().min(500).max(3e4).default(8e3)
|
|
9998
|
+
}), object({
|
|
9999
|
+
awoke: boolean(),
|
|
10000
|
+
durationMs: number()
|
|
10001
|
+
}), { kind: "mutation" }), object({
|
|
10002
|
+
deviceId: number(),
|
|
10003
|
+
status: BatteryStatusSchema
|
|
10004
|
+
});
|
|
10005
|
+
object({
|
|
10006
|
+
on: boolean(),
|
|
10007
|
+
/** Ms epoch of the last transition. 0 if never observed. */
|
|
10008
|
+
lastChangedAt: number()
|
|
10009
|
+
});
|
|
10010
|
+
DeviceType.Sensor;
|
|
10011
|
+
object({
|
|
10012
|
+
/** Current level as 0..100 inclusive. Firmware-reported. */
|
|
10013
|
+
percentage: number().min(0).max(100),
|
|
10014
|
+
/** Ms epoch of the last operator-driven change. Useful for UI freshness. */
|
|
10015
|
+
lastChangedAt: number()
|
|
10016
|
+
});
|
|
10017
|
+
DeviceType.Light, method(object({
|
|
10018
|
+
deviceId: number().int().nonnegative(),
|
|
10019
|
+
percentage: number().min(0).max(100)
|
|
10020
|
+
}), _void(), {
|
|
10021
|
+
kind: "mutation",
|
|
10022
|
+
auth: "admin"
|
|
10023
|
+
}), object({
|
|
10024
|
+
deviceId: number(),
|
|
10025
|
+
percentage: number().min(0).max(100),
|
|
10026
|
+
lastChangedAt: number()
|
|
10027
|
+
});
|
|
10028
|
+
/** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
|
|
10029
|
+
var StreamFormatSchema = _enum([
|
|
9385
10030
|
"webrtc",
|
|
9386
10031
|
"hls",
|
|
9387
10032
|
"mjpeg",
|
|
@@ -11969,84 +12614,23 @@ DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
|
11969
12614
|
lastChangedAt: number()
|
|
11970
12615
|
});
|
|
11971
12616
|
/**
|
|
11972
|
-
*
|
|
11973
|
-
* motion-
|
|
11974
|
-
*
|
|
11975
|
-
*
|
|
11976
|
-
*
|
|
11977
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
11978
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
11979
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
12617
|
+
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
12618
|
+
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
12619
|
+
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
12620
|
+
* a region keeps one drawing-plane model across all geometry caps.
|
|
11980
12621
|
*/
|
|
11981
|
-
/** A
|
|
11982
|
-
var
|
|
11983
|
-
|
|
11984
|
-
|
|
12622
|
+
/** A motion-zone region — exactly one boolean cell grid today. */
|
|
12623
|
+
var MotionZoneRegionSchema = object({
|
|
12624
|
+
id: number(),
|
|
12625
|
+
enabled: boolean(),
|
|
12626
|
+
shape: MaskGridShapeSchema
|
|
11985
12627
|
});
|
|
11986
|
-
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
|
|
11991
|
-
|
|
11992
|
-
height: number()
|
|
11993
|
-
});
|
|
11994
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
11995
|
-
var MaskPolygonShapeSchema = object({
|
|
11996
|
-
kind: literal("polygon"),
|
|
11997
|
-
points: array(MaskPointSchema)
|
|
11998
|
-
});
|
|
11999
|
-
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
12000
|
-
var MaskGridShapeSchema = object({
|
|
12001
|
-
kind: literal("grid"),
|
|
12002
|
-
gridWidth: number(),
|
|
12003
|
-
gridHeight: number(),
|
|
12004
|
-
cells: array(boolean())
|
|
12005
|
-
});
|
|
12006
|
-
discriminatedUnion("kind", [
|
|
12007
|
-
MaskRectShapeSchema,
|
|
12008
|
-
MaskPolygonShapeSchema,
|
|
12009
|
-
MaskGridShapeSchema,
|
|
12010
|
-
object({
|
|
12011
|
-
kind: literal("line"),
|
|
12012
|
-
points: array(MaskPointSchema)
|
|
12013
|
-
})
|
|
12014
|
-
]);
|
|
12015
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
12016
|
-
var MaskShapeKindSchema = _enum([
|
|
12017
|
-
"rect",
|
|
12018
|
-
"polygon",
|
|
12019
|
-
"grid",
|
|
12020
|
-
"line"
|
|
12021
|
-
]);
|
|
12022
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
12023
|
-
var MaskPolygonVerticesSchema = object({
|
|
12024
|
-
min: number(),
|
|
12025
|
-
max: number()
|
|
12026
|
-
});
|
|
12027
|
-
/** Grid dimensions when a cap supports 'grid'. */
|
|
12028
|
-
var MaskGridDimsSchema = object({
|
|
12029
|
-
width: number(),
|
|
12030
|
-
height: number()
|
|
12031
|
-
});
|
|
12032
|
-
/**
|
|
12033
|
-
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
12034
|
-
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
12035
|
-
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
12036
|
-
* a region keeps one drawing-plane model across all geometry caps.
|
|
12037
|
-
*/
|
|
12038
|
-
/** A motion-zone region — exactly one boolean cell grid today. */
|
|
12039
|
-
var MotionZoneRegionSchema = object({
|
|
12040
|
-
id: number(),
|
|
12041
|
-
enabled: boolean(),
|
|
12042
|
-
shape: MaskGridShapeSchema
|
|
12043
|
-
});
|
|
12044
|
-
object({
|
|
12045
|
-
enabled: boolean(),
|
|
12046
|
-
sensitivity: number(),
|
|
12047
|
-
/** Grid region(s). Today exactly one `grid` shape. */
|
|
12048
|
-
regions: array(MotionZoneRegionSchema),
|
|
12049
|
-
lastFetchedAt: number()
|
|
12628
|
+
object({
|
|
12629
|
+
enabled: boolean(),
|
|
12630
|
+
sensitivity: number(),
|
|
12631
|
+
/** Grid region(s). Today exactly one `grid` shape. */
|
|
12632
|
+
regions: array(MotionZoneRegionSchema),
|
|
12633
|
+
lastFetchedAt: number()
|
|
12050
12634
|
});
|
|
12051
12635
|
/** Per-camera availability — grid dims are fixed per camera model; the UI
|
|
12052
12636
|
* sizes its editor from `grid`. */
|
|
@@ -13936,6 +14520,55 @@ var authProviderCapability = {
|
|
|
13936
14520
|
mount: { kind: "skip" }
|
|
13937
14521
|
};
|
|
13938
14522
|
/**
|
|
14523
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
14524
|
+
* NOT flow through the capability — they use the addon data plane
|
|
14525
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
14526
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
14527
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
14528
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
14529
|
+
*/
|
|
14530
|
+
var TerminalSessionInfoSchema = object({
|
|
14531
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
14532
|
+
sessionId: string(),
|
|
14533
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
14534
|
+
profileId: string(),
|
|
14535
|
+
/** Human-readable profile label for the UI session list. */
|
|
14536
|
+
label: string(),
|
|
14537
|
+
cols: number().int().positive(),
|
|
14538
|
+
rows: number().int().positive(),
|
|
14539
|
+
/** ms-epoch the session's pty was spawned. */
|
|
14540
|
+
startedAt: number()
|
|
14541
|
+
});
|
|
14542
|
+
/**
|
|
14543
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
14544
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
14545
|
+
* command string would be remote code execution as the server's user, so it is
|
|
14546
|
+
* deliberately not part of the contract.
|
|
14547
|
+
*/
|
|
14548
|
+
var TerminalProfileInfoSchema = object({
|
|
14549
|
+
profileId: string(),
|
|
14550
|
+
label: string(),
|
|
14551
|
+
description: string().optional()
|
|
14552
|
+
});
|
|
14553
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
14554
|
+
profileId: string(),
|
|
14555
|
+
cols: number().int().positive(),
|
|
14556
|
+
rows: number().int().positive()
|
|
14557
|
+
}), TerminalSessionInfoSchema, {
|
|
14558
|
+
kind: "mutation",
|
|
14559
|
+
auth: "admin"
|
|
14560
|
+
}), method(object({
|
|
14561
|
+
sessionId: string(),
|
|
14562
|
+
cols: number().int().positive(),
|
|
14563
|
+
rows: number().int().positive()
|
|
14564
|
+
}), _void(), {
|
|
14565
|
+
kind: "mutation",
|
|
14566
|
+
auth: "admin"
|
|
14567
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
14568
|
+
kind: "mutation",
|
|
14569
|
+
auth: "admin"
|
|
14570
|
+
});
|
|
14571
|
+
/**
|
|
13939
14572
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
13940
14573
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
13941
14574
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -14036,11 +14669,53 @@ var LocationStatSchema = object({
|
|
|
14036
14669
|
fileCount: number(),
|
|
14037
14670
|
present: boolean()
|
|
14038
14671
|
});
|
|
14672
|
+
/**
|
|
14673
|
+
* A backup schedule — the N:M "entry" that binds one cron cadence to a
|
|
14674
|
+
* SET of destination locations. Supersedes the per-location cron on
|
|
14675
|
+
* `BackupDestinationPolicy`: an operator creates a schedule, picks the
|
|
14676
|
+
* `backups` locations it should write to, and the orchestrator fans a
|
|
14677
|
+
* single archive out to all of them when the cron fires.
|
|
14678
|
+
*
|
|
14679
|
+
* `retentionCount` is per-schedule (D-decision 2026-07-28): every
|
|
14680
|
+
* location targeted by this schedule keeps this many archives from
|
|
14681
|
+
* this schedule's runs.
|
|
14682
|
+
*
|
|
14683
|
+
* `dataSources` optionally narrows which top-level state locations
|
|
14684
|
+
* (db, addons, tls, …) are archived; omitted = the orchestrator's
|
|
14685
|
+
* default full set.
|
|
14686
|
+
*/
|
|
14687
|
+
var BackupScheduleSchema = object({
|
|
14688
|
+
/** Stable id. Generated by the orchestrator on first upsert if absent. */
|
|
14689
|
+
id: string(),
|
|
14690
|
+
/** Operator-facing display name. */
|
|
14691
|
+
label: string(),
|
|
14692
|
+
/** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
|
|
14693
|
+
cron: string(),
|
|
14694
|
+
/** Master on/off toggle for the whole schedule. */
|
|
14695
|
+
enabled: boolean(),
|
|
14696
|
+
/** `backups`-location ids this schedule writes to (fan-out set). */
|
|
14697
|
+
locationIds: array(string()).readonly(),
|
|
14698
|
+
/** Archives kept per targeted location for this schedule. */
|
|
14699
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14700
|
+
/** Optional subset of source locations to include; omitted = all. */
|
|
14701
|
+
dataSources: array(string()).readonly().optional(),
|
|
14702
|
+
/** ms-epoch of last successful run. */
|
|
14703
|
+
lastRunAt: number().optional(),
|
|
14704
|
+
/** ms-epoch of next computed firing (read-only, filled on list). */
|
|
14705
|
+
nextRunAt: number().optional()
|
|
14706
|
+
});
|
|
14039
14707
|
method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
14040
14708
|
/** Subset of registered `backup-destination` addon ids to write to. */
|
|
14041
14709
|
destinations: array(string()).optional(),
|
|
14042
14710
|
locations: array(string()).optional(),
|
|
14043
|
-
label: string().optional()
|
|
14711
|
+
label: string().optional(),
|
|
14712
|
+
/**
|
|
14713
|
+
* Per-run retention override applied to every targeted
|
|
14714
|
+
* destination. Used by schedule-driven runs (per-entry
|
|
14715
|
+
* retention). Omitted = each destination's own policy
|
|
14716
|
+
* retention (manual runs).
|
|
14717
|
+
*/
|
|
14718
|
+
retentionCount: number().int().min(1).max(1e3).optional()
|
|
14044
14719
|
}).optional(), array(BackupEntrySchema).readonly(), {
|
|
14045
14720
|
kind: "mutation",
|
|
14046
14721
|
auth: "admin"
|
|
@@ -14089,7 +14764,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
14089
14764
|
ok: boolean(),
|
|
14090
14765
|
error: string().optional(),
|
|
14091
14766
|
nextRuns: array(number()).readonly()
|
|
14092
|
-
}))
|
|
14767
|
+
})), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
|
|
14768
|
+
id: string().optional(),
|
|
14769
|
+
label: string(),
|
|
14770
|
+
cron: string(),
|
|
14771
|
+
enabled: boolean(),
|
|
14772
|
+
locationIds: array(string()).readonly(),
|
|
14773
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14774
|
+
dataSources: array(string()).readonly().optional()
|
|
14775
|
+
}), BackupScheduleSchema, {
|
|
14776
|
+
kind: "mutation",
|
|
14777
|
+
auth: "admin"
|
|
14778
|
+
}), method(object({ id: string() }), _void(), {
|
|
14779
|
+
kind: "mutation",
|
|
14780
|
+
auth: "admin"
|
|
14781
|
+
});
|
|
14093
14782
|
/**
|
|
14094
14783
|
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
14095
14784
|
*
|
|
@@ -14922,1787 +15611,1299 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
14922
15611
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
14923
15612
|
var DevicePersistConfigPayloadSchema = object({
|
|
14924
15613
|
deviceId: number(),
|
|
14925
|
-
data: record(string(), unknown())
|
|
14926
|
-
});
|
|
14927
|
-
method(object({
|
|
14928
|
-
addonId: string(),
|
|
14929
|
-
stableId: string()
|
|
14930
|
-
}), 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({
|
|
14931
|
-
deviceId: number(),
|
|
14932
|
-
name: string()
|
|
14933
|
-
}), _void(), {
|
|
14934
|
-
kind: "mutation",
|
|
14935
|
-
auth: "admin"
|
|
14936
|
-
}), method(object({
|
|
14937
|
-
deviceId: number(),
|
|
14938
|
-
location: string().nullable()
|
|
14939
|
-
}), _void(), {
|
|
14940
|
-
kind: "mutation",
|
|
14941
|
-
auth: "admin"
|
|
14942
|
-
}), method(object({
|
|
14943
|
-
deviceId: number(),
|
|
14944
|
-
type: _enum(DeviceType)
|
|
14945
|
-
}), _void(), {
|
|
14946
|
-
kind: "mutation",
|
|
14947
|
-
auth: "admin"
|
|
14948
|
-
}), method(object({
|
|
14949
|
-
deviceId: number(),
|
|
14950
|
-
integrationId: string()
|
|
14951
|
-
}), _void(), {
|
|
14952
|
-
kind: "mutation",
|
|
14953
|
-
auth: "admin"
|
|
14954
|
-
}), method(object({
|
|
14955
|
-
deviceId: number(),
|
|
14956
|
-
linkDeviceId: number().nullable()
|
|
14957
|
-
}), _void(), {
|
|
14958
|
-
kind: "mutation",
|
|
14959
|
-
auth: "admin"
|
|
14960
|
-
}), method(object({
|
|
14961
|
-
deviceId: number(),
|
|
14962
|
-
primaryChildEntityId: string().nullable()
|
|
14963
|
-
}), _void(), {
|
|
14964
|
-
kind: "mutation",
|
|
14965
|
-
auth: "admin"
|
|
14966
|
-
}), method(object({
|
|
14967
|
-
deviceId: number(),
|
|
14968
|
-
childLayout: array(ChildLayoutEntrySchema).readonly()
|
|
14969
|
-
}), _void(), {
|
|
14970
|
-
kind: "mutation",
|
|
14971
|
-
auth: "admin"
|
|
14972
|
-
}), method(object({
|
|
14973
|
-
deviceId: number(),
|
|
14974
|
-
deviceLinks: array(DeviceLinkSchema).readonly()
|
|
14975
|
-
}), _void(), {
|
|
14976
|
-
kind: "mutation",
|
|
14977
|
-
auth: "admin"
|
|
14978
|
-
}), method(object({
|
|
14979
|
-
deviceId: number(),
|
|
14980
|
-
display: DeviceDisplayOverrideSchema.nullable()
|
|
14981
|
-
}), _void(), {
|
|
14982
|
-
kind: "mutation",
|
|
14983
|
-
auth: "admin"
|
|
14984
|
-
}), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
|
|
14985
|
-
kind: "mutation",
|
|
14986
|
-
auth: "admin"
|
|
14987
|
-
}), method(object({
|
|
14988
|
-
deviceId: number(),
|
|
14989
|
-
includeSynthesizable: boolean().optional()
|
|
14990
|
-
}), object({ caps: array(object({
|
|
14991
|
-
cap: string(),
|
|
14992
|
-
fields: array(object({
|
|
14993
|
-
path: string(),
|
|
14994
|
-
kind: _enum([
|
|
14995
|
-
"string",
|
|
14996
|
-
"number",
|
|
14997
|
-
"boolean",
|
|
14998
|
-
"enum"
|
|
14999
|
-
]),
|
|
15000
|
-
enumValues: array(string()).optional(),
|
|
15001
|
-
item: boolean().optional()
|
|
15002
|
-
})).readonly(),
|
|
15003
|
-
itemArray: object({
|
|
15004
|
-
path: string(),
|
|
15005
|
-
keyField: string()
|
|
15006
|
-
}).optional()
|
|
15007
|
-
})).readonly() }), { kind: "query" }), method(object({
|
|
15008
|
-
deviceId: number(),
|
|
15009
|
-
role: string().nullable()
|
|
15010
|
-
}), _void(), {
|
|
15011
|
-
kind: "mutation",
|
|
15012
|
-
auth: "admin"
|
|
15013
|
-
}), method(object({
|
|
15014
|
-
deviceId: number(),
|
|
15015
|
-
name: string().optional(),
|
|
15016
|
-
location: string().nullable().optional(),
|
|
15017
|
-
type: _enum(DeviceType).optional(),
|
|
15018
|
-
integrationId: string().optional(),
|
|
15019
|
-
linkDeviceId: number().nullable().optional(),
|
|
15020
|
-
role: string().nullable().optional()
|
|
15021
|
-
}), _void(), {
|
|
15022
|
-
kind: "mutation",
|
|
15023
|
-
auth: "admin"
|
|
15024
|
-
}), method(object({
|
|
15025
|
-
deviceId: number(),
|
|
15026
|
-
patch: record(string(), unknown())
|
|
15027
|
-
}), _void(), {
|
|
15028
|
-
kind: "mutation",
|
|
15029
|
-
auth: "admin"
|
|
15030
|
-
}), method(_void(), array(string())), method(object({ name: string() }), _void(), {
|
|
15031
|
-
kind: "mutation",
|
|
15032
|
-
auth: "admin"
|
|
15033
|
-
}), method(object({
|
|
15034
|
-
name: string(),
|
|
15035
|
-
cascade: boolean().optional()
|
|
15036
|
-
}), _void(), {
|
|
15037
|
-
kind: "mutation",
|
|
15038
|
-
auth: "admin"
|
|
15039
|
-
}), method(object({
|
|
15040
|
-
deviceId: number(),
|
|
15041
|
-
disabled: boolean()
|
|
15042
|
-
}), _void(), {
|
|
15043
|
-
kind: "mutation",
|
|
15044
|
-
auth: "admin"
|
|
15045
|
-
}), 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({
|
|
15046
|
-
mode: DeviceLinkModeSchema,
|
|
15047
|
-
devices: array(LinkedDeviceSchema)
|
|
15048
|
-
})), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
|
|
15049
|
-
deviceId: number(),
|
|
15050
|
-
values: record(string(), unknown())
|
|
15051
|
-
}), object({ success: literal(true) }), {
|
|
15052
|
-
kind: "mutation",
|
|
15053
|
-
auth: "admin"
|
|
15054
|
-
}), method(object({ deviceId: number() }), object({ success: literal(true) }), {
|
|
15055
|
-
kind: "mutation",
|
|
15056
|
-
auth: "admin"
|
|
15057
|
-
}), method(object({ deviceId: number() }), object({ success: literal(true) }), {
|
|
15058
|
-
kind: "mutation",
|
|
15059
|
-
auth: "admin"
|
|
15060
|
-
}), method(object({ deviceId: number() }), object({ success: literal(true) }), {
|
|
15061
|
-
kind: "mutation",
|
|
15062
|
-
auth: "admin"
|
|
15063
|
-
}), method(object({ integrationId: string() }), object({ removed: number() }), {
|
|
15064
|
-
kind: "mutation",
|
|
15065
|
-
auth: "admin"
|
|
15066
|
-
}), method(object({ deviceId: number() }), record(string(), string().nullable())), method(object({
|
|
15067
|
-
deviceId: number(),
|
|
15068
|
-
profileMap: record(string(), string().nullable())
|
|
15069
|
-
}), object({ success: literal(true) }), {
|
|
15070
|
-
kind: "mutation",
|
|
15071
|
-
auth: "admin"
|
|
15072
|
-
}), method(object({ deviceId: number() }), array(StreamProbeResultSchema), {
|
|
15073
|
-
kind: "mutation",
|
|
15074
|
-
auth: "admin"
|
|
15075
|
-
}), method(object({ deviceId: number() }), object({
|
|
15076
|
-
deviceId: number(),
|
|
15077
|
-
entries: array(object({
|
|
15078
|
-
capName: string(),
|
|
15079
|
-
kind: _enum([
|
|
15080
|
-
"native",
|
|
15081
|
-
"wrapped",
|
|
15082
|
-
"linked"
|
|
15083
|
-
]),
|
|
15084
|
-
providerAddonId: string(),
|
|
15085
|
-
providerNodeId: string(),
|
|
15086
|
-
nativeAddonId: string()
|
|
15087
|
-
}))
|
|
15088
|
-
})), method(object({}), array(object({
|
|
15089
|
-
deviceId: number(),
|
|
15090
|
-
entries: array(object({
|
|
15091
|
-
capName: string(),
|
|
15092
|
-
kind: _enum([
|
|
15093
|
-
"native",
|
|
15094
|
-
"wrapped",
|
|
15095
|
-
"linked"
|
|
15096
|
-
]),
|
|
15097
|
-
providerAddonId: string(),
|
|
15098
|
-
providerNodeId: string(),
|
|
15099
|
-
nativeAddonId: string()
|
|
15100
|
-
}))
|
|
15101
|
-
}))), method(object({
|
|
15102
|
-
deviceId: number(),
|
|
15103
|
-
capName: string(),
|
|
15104
|
-
wrapperAddonId: string(),
|
|
15105
|
-
active: boolean()
|
|
15106
|
-
}), _void(), {
|
|
15107
|
-
kind: "mutation",
|
|
15108
|
-
auth: "admin"
|
|
15109
|
-
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
15110
|
-
capName: string(),
|
|
15111
|
-
wrappers: array(string())
|
|
15112
|
-
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
15113
|
-
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
15114
|
-
live: SettingsSchemaWithValuesSchema.nullable()
|
|
15115
|
-
})), method(object({
|
|
15116
|
-
deviceId: number().int().nonnegative(),
|
|
15117
|
-
action: string().min(1),
|
|
15118
|
-
input: unknown()
|
|
15119
|
-
}), unknown(), { kind: "mutation" }), method(object({
|
|
15120
|
-
deviceId: number(),
|
|
15121
|
-
writerCapName: string(),
|
|
15122
|
-
writerAddonId: string(),
|
|
15123
|
-
key: string(),
|
|
15124
|
-
value: unknown()
|
|
15125
|
-
}), object({ success: literal(true) }), {
|
|
15126
|
-
kind: "mutation",
|
|
15127
|
-
auth: "admin"
|
|
15128
|
-
}), method(object({
|
|
15129
|
-
deviceId: number(),
|
|
15130
|
-
changes: array(object({
|
|
15131
|
-
writerCapName: string(),
|
|
15132
|
-
writerAddonId: string(),
|
|
15133
|
-
key: string(),
|
|
15134
|
-
value: unknown()
|
|
15135
|
-
}))
|
|
15136
|
-
}), object({
|
|
15137
|
-
success: literal(true),
|
|
15138
|
-
failures: array(object({
|
|
15139
|
-
writerCapName: string(),
|
|
15140
|
-
writerAddonId: string(),
|
|
15141
|
-
error: string()
|
|
15142
|
-
}))
|
|
15143
|
-
}), {
|
|
15144
|
-
kind: "mutation",
|
|
15145
|
-
auth: "admin"
|
|
15146
|
-
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
15147
|
-
kind: "mutation",
|
|
15148
|
-
auth: "admin"
|
|
15149
|
-
}), method(object({
|
|
15150
|
-
addonId: string(),
|
|
15151
|
-
candidate: DiscoveryCandidateSchema,
|
|
15152
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
15153
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15154
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15155
|
-
integrationId: string().optional()
|
|
15156
|
-
}), DeviceSummarySchema, {
|
|
15157
|
-
kind: "mutation",
|
|
15158
|
-
auth: "admin"
|
|
15159
|
-
}), method(object({
|
|
15160
|
-
addonId: string(),
|
|
15161
|
-
type: _enum(DeviceType)
|
|
15162
|
-
}), unknown().nullable()), method(object({
|
|
15163
|
-
addonId: string(),
|
|
15164
|
-
type: _enum(DeviceType),
|
|
15165
|
-
config: record(string(), unknown()),
|
|
15166
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
15167
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15168
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15169
|
-
integrationId: string().optional()
|
|
15170
|
-
}), DeviceSummarySchema, {
|
|
15171
|
-
kind: "mutation",
|
|
15172
|
-
auth: "admin"
|
|
15173
|
-
}), method(object({
|
|
15174
|
-
addonId: string(),
|
|
15175
|
-
type: _enum(DeviceType),
|
|
15176
|
-
key: string(),
|
|
15177
|
-
value: unknown(),
|
|
15178
|
-
formValues: record(string(), unknown()).optional()
|
|
15179
|
-
}), FieldProbeResultSchema, {
|
|
15180
|
-
kind: "mutation",
|
|
15181
|
-
auth: "admin"
|
|
15182
|
-
}), method(object({
|
|
15183
|
-
addonId: string(),
|
|
15184
|
-
integrationId: string()
|
|
15185
|
-
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
15614
|
+
data: record(string(), unknown())
|
|
15615
|
+
});
|
|
15616
|
+
method(object({
|
|
15186
15617
|
addonId: string(),
|
|
15187
|
-
|
|
15188
|
-
}),
|
|
15618
|
+
stableId: string()
|
|
15619
|
+
}), 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({
|
|
15620
|
+
deviceId: number(),
|
|
15621
|
+
name: string()
|
|
15622
|
+
}), _void(), {
|
|
15189
15623
|
kind: "mutation",
|
|
15190
15624
|
auth: "admin"
|
|
15191
|
-
}), method(
|
|
15625
|
+
}), method(object({
|
|
15626
|
+
deviceId: number(),
|
|
15627
|
+
location: string().nullable()
|
|
15628
|
+
}), _void(), {
|
|
15192
15629
|
kind: "mutation",
|
|
15193
15630
|
auth: "admin"
|
|
15194
|
-
}), method(
|
|
15631
|
+
}), method(object({
|
|
15632
|
+
deviceId: number(),
|
|
15633
|
+
type: _enum(DeviceType)
|
|
15634
|
+
}), _void(), {
|
|
15195
15635
|
kind: "mutation",
|
|
15196
15636
|
auth: "admin"
|
|
15197
|
-
}), method(
|
|
15637
|
+
}), method(object({
|
|
15638
|
+
deviceId: number(),
|
|
15639
|
+
integrationId: string()
|
|
15640
|
+
}), _void(), {
|
|
15198
15641
|
kind: "mutation",
|
|
15199
15642
|
auth: "admin"
|
|
15200
|
-
}), method(object({
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
})
|
|
15204
|
-
addonId: string(),
|
|
15205
|
-
label: string(),
|
|
15206
|
-
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
15207
|
-
error: string().nullable()
|
|
15208
|
-
})).readonly() }), {
|
|
15643
|
+
}), method(object({
|
|
15644
|
+
deviceId: number(),
|
|
15645
|
+
linkDeviceId: number().nullable()
|
|
15646
|
+
}), _void(), {
|
|
15209
15647
|
kind: "mutation",
|
|
15210
15648
|
auth: "admin"
|
|
15211
15649
|
}), method(object({
|
|
15212
|
-
|
|
15213
|
-
|
|
15214
|
-
}),
|
|
15650
|
+
deviceId: number(),
|
|
15651
|
+
primaryChildEntityId: string().nullable()
|
|
15652
|
+
}), _void(), {
|
|
15215
15653
|
kind: "mutation",
|
|
15216
15654
|
auth: "admin"
|
|
15217
|
-
}), method(object({
|
|
15655
|
+
}), method(object({
|
|
15218
15656
|
deviceId: number(),
|
|
15219
|
-
|
|
15220
|
-
|
|
15221
|
-
}), FieldProbeResultSchema, {
|
|
15657
|
+
childLayout: array(ChildLayoutEntrySchema).readonly()
|
|
15658
|
+
}), _void(), {
|
|
15222
15659
|
kind: "mutation",
|
|
15223
15660
|
auth: "admin"
|
|
15224
15661
|
}), method(object({
|
|
15225
15662
|
deviceId: number(),
|
|
15226
|
-
|
|
15227
|
-
}),
|
|
15228
|
-
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
15229
|
-
deviceId: number(),
|
|
15230
|
-
capName: string()
|
|
15231
|
-
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
15232
|
-
deviceId: number(),
|
|
15233
|
-
capName: string(),
|
|
15234
|
-
slice: record(string(), unknown())
|
|
15235
|
-
}), _void(), { kind: "mutation" }), object({
|
|
15236
|
-
deviceId: number(),
|
|
15237
|
-
capName: string(),
|
|
15238
|
-
slice: record(string(), unknown())
|
|
15239
|
-
});
|
|
15240
|
-
/**
|
|
15241
|
-
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
15242
|
-
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
15243
|
-
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
15244
|
-
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
15245
|
-
* post-analysis enrichment-engine.
|
|
15246
|
-
*/
|
|
15247
|
-
var EmbeddingResultSchema = object({
|
|
15248
|
-
embedding: array(number()),
|
|
15249
|
-
inferenceMs: number()
|
|
15250
|
-
});
|
|
15251
|
-
var EmbeddingInfoSchema = object({
|
|
15252
|
-
modelId: string(),
|
|
15253
|
-
embeddingDim: number(),
|
|
15254
|
-
ready: boolean()
|
|
15255
|
-
});
|
|
15256
|
-
method(object({
|
|
15257
|
-
crop: _instanceof(Uint8Array),
|
|
15258
|
-
width: number(),
|
|
15259
|
-
height: number()
|
|
15260
|
-
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
15261
|
-
/**
|
|
15262
|
-
* filesystem-browse — per-node capability for browsing the node's local
|
|
15263
|
-
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
15264
|
-
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
15265
|
-
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
15266
|
-
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
15267
|
-
*/
|
|
15268
|
-
var DirEntrySchema = object({
|
|
15269
|
-
name: string(),
|
|
15270
|
-
path: string()
|
|
15271
|
-
});
|
|
15272
|
-
var BrowseResultSchema = object({
|
|
15273
|
-
path: string(),
|
|
15274
|
-
entries: array(DirEntrySchema).readonly(),
|
|
15275
|
-
freeBytes: number(),
|
|
15276
|
-
totalBytes: number()
|
|
15277
|
-
});
|
|
15278
|
-
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
15663
|
+
deviceLinks: array(DeviceLinkSchema).readonly()
|
|
15664
|
+
}), _void(), {
|
|
15279
15665
|
kind: "mutation",
|
|
15280
15666
|
auth: "admin"
|
|
15281
|
-
})
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
* caps stay wire-compatible without a circular cap→cap import.
|
|
15286
|
-
*
|
|
15287
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15288
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
15289
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15290
|
-
*/
|
|
15291
|
-
var LlmUsageSchema = object({
|
|
15292
|
-
inputTokens: number(),
|
|
15293
|
-
outputTokens: number()
|
|
15294
|
-
});
|
|
15295
|
-
var LlmErrorCodeSchema = _enum([
|
|
15296
|
-
"timeout",
|
|
15297
|
-
"rate-limited",
|
|
15298
|
-
"auth",
|
|
15299
|
-
"refusal",
|
|
15300
|
-
"bad-request",
|
|
15301
|
-
"unavailable",
|
|
15302
|
-
"no-profile",
|
|
15303
|
-
"budget-exceeded",
|
|
15304
|
-
"adapter-error"
|
|
15305
|
-
]);
|
|
15306
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15307
|
-
ok: literal(true),
|
|
15308
|
-
text: string(),
|
|
15309
|
-
model: string(),
|
|
15310
|
-
usage: LlmUsageSchema,
|
|
15311
|
-
truncated: boolean(),
|
|
15312
|
-
latencyMs: number()
|
|
15313
|
-
}), object({
|
|
15314
|
-
ok: literal(false),
|
|
15315
|
-
code: LlmErrorCodeSchema,
|
|
15316
|
-
message: string(),
|
|
15317
|
-
retryAfterMs: number().optional()
|
|
15318
|
-
})]);
|
|
15319
|
-
/**
|
|
15320
|
-
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15321
|
-
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15322
|
-
* notification-output.cap.ts:27-31 precedents).
|
|
15323
|
-
*/
|
|
15324
|
-
var LlmImageSchema = object({
|
|
15325
|
-
bytes: _instanceof(Uint8Array),
|
|
15326
|
-
mimeType: string()
|
|
15327
|
-
});
|
|
15328
|
-
var LlmGenerateBaseInputSchema = object({
|
|
15329
|
-
/** Collection routing (the notification-output posture). */
|
|
15330
|
-
addonId: string().optional(),
|
|
15331
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15332
|
-
profileId: string().optional(),
|
|
15333
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15334
|
-
consumer: string(),
|
|
15335
|
-
system: string().optional(),
|
|
15336
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15337
|
-
prompt: string(),
|
|
15338
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15339
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
15340
|
-
/** Per-call override of the profile default. */
|
|
15341
|
-
maxTokens: number().int().positive().optional(),
|
|
15342
|
-
temperature: number().optional()
|
|
15343
|
-
});
|
|
15344
|
-
/**
|
|
15345
|
-
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15346
|
-
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15347
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15348
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15349
|
-
* this only through the `llm` cap's methods.
|
|
15350
|
-
*
|
|
15351
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15352
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15353
|
-
* watchdog — operator decision #3).
|
|
15354
|
-
*/
|
|
15355
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15356
|
-
object({
|
|
15357
|
-
kind: literal("catalog"),
|
|
15358
|
-
catalogId: string()
|
|
15359
|
-
}),
|
|
15360
|
-
object({
|
|
15361
|
-
kind: literal("url"),
|
|
15362
|
-
url: string(),
|
|
15363
|
-
sha256: string().optional()
|
|
15364
|
-
}),
|
|
15365
|
-
object({
|
|
15366
|
-
kind: literal("path"),
|
|
15367
|
-
path: string()
|
|
15368
|
-
})
|
|
15369
|
-
]);
|
|
15370
|
-
var ManagedRuntimeConfigSchema = object({
|
|
15371
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
15372
|
-
nodeId: string(),
|
|
15373
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15374
|
-
engine: _enum(["llama-cpp"]),
|
|
15375
|
-
model: ManagedModelRefSchema,
|
|
15376
|
-
contextSize: number().int().default(4096),
|
|
15377
|
-
/** 0 = CPU-only. */
|
|
15378
|
-
gpuLayers: number().int().default(0),
|
|
15379
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15380
|
-
threads: number().int().optional(),
|
|
15381
|
-
/** Concurrent slots. */
|
|
15382
|
-
parallel: number().int().default(1),
|
|
15383
|
-
/** Else lazy: first generate boots it. */
|
|
15384
|
-
autoStart: boolean().default(false),
|
|
15385
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
15386
|
-
idleStopMinutes: number().int().default(30)
|
|
15387
|
-
});
|
|
15388
|
-
var LlmRuntimeStatusSchema = object({
|
|
15389
|
-
/** Status is ALWAYS node-qualified. */
|
|
15390
|
-
nodeId: string(),
|
|
15391
|
-
state: _enum([
|
|
15392
|
-
"stopped",
|
|
15393
|
-
"downloading",
|
|
15394
|
-
"starting",
|
|
15395
|
-
"ready",
|
|
15396
|
-
"crashed",
|
|
15397
|
-
"failed"
|
|
15398
|
-
]),
|
|
15399
|
-
pid: number().optional(),
|
|
15400
|
-
port: number().optional(),
|
|
15401
|
-
modelPath: string().optional(),
|
|
15402
|
-
modelId: string().optional(),
|
|
15403
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
15404
|
-
lastError: string().optional(),
|
|
15405
|
-
crashesInWindow: number(),
|
|
15406
|
-
/** Child RSS (sampled best-effort). */
|
|
15407
|
-
memoryBytes: number().optional(),
|
|
15408
|
-
vramBytes: number().optional()
|
|
15409
|
-
});
|
|
15410
|
-
var LlmNodeModelSchema = object({
|
|
15411
|
-
file: string(),
|
|
15412
|
-
sizeBytes: number(),
|
|
15413
|
-
catalogId: string().optional(),
|
|
15414
|
-
installedAt: number().optional()
|
|
15415
|
-
});
|
|
15416
|
-
var LlmRuntimeDiskUsageSchema = object({
|
|
15417
|
-
nodeId: string(),
|
|
15418
|
-
modelsBytes: number(),
|
|
15419
|
-
freeBytes: number().optional()
|
|
15420
|
-
});
|
|
15421
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
15422
|
-
images: array(LlmImageSchema).optional(),
|
|
15423
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
15424
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15425
|
-
timeoutMs: number().int().positive().optional()
|
|
15426
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15667
|
+
}), method(object({
|
|
15668
|
+
deviceId: number(),
|
|
15669
|
+
display: DeviceDisplayOverrideSchema.nullable()
|
|
15670
|
+
}), _void(), {
|
|
15427
15671
|
kind: "mutation",
|
|
15428
15672
|
auth: "admin"
|
|
15429
|
-
}), method(object({}), _void(), {
|
|
15673
|
+
}), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
|
|
15430
15674
|
kind: "mutation",
|
|
15431
15675
|
auth: "admin"
|
|
15432
|
-
}), method(object({
|
|
15676
|
+
}), method(object({
|
|
15677
|
+
deviceId: number(),
|
|
15678
|
+
includeSynthesizable: boolean().optional()
|
|
15679
|
+
}), object({ caps: array(object({
|
|
15680
|
+
cap: string(),
|
|
15681
|
+
fields: array(object({
|
|
15682
|
+
path: string(),
|
|
15683
|
+
kind: _enum([
|
|
15684
|
+
"string",
|
|
15685
|
+
"number",
|
|
15686
|
+
"boolean",
|
|
15687
|
+
"enum"
|
|
15688
|
+
]),
|
|
15689
|
+
enumValues: array(string()).optional(),
|
|
15690
|
+
item: boolean().optional()
|
|
15691
|
+
})).readonly(),
|
|
15692
|
+
itemArray: object({
|
|
15693
|
+
path: string(),
|
|
15694
|
+
keyField: string()
|
|
15695
|
+
}).optional()
|
|
15696
|
+
})).readonly() }), { kind: "query" }), method(object({
|
|
15697
|
+
deviceId: number(),
|
|
15698
|
+
role: string().nullable()
|
|
15699
|
+
}), _void(), {
|
|
15433
15700
|
kind: "mutation",
|
|
15434
15701
|
auth: "admin"
|
|
15435
|
-
}), method(object({
|
|
15702
|
+
}), method(object({
|
|
15703
|
+
deviceId: number(),
|
|
15704
|
+
name: string().optional(),
|
|
15705
|
+
location: string().nullable().optional(),
|
|
15706
|
+
type: _enum(DeviceType).optional(),
|
|
15707
|
+
integrationId: string().optional(),
|
|
15708
|
+
linkDeviceId: number().nullable().optional(),
|
|
15709
|
+
role: string().nullable().optional()
|
|
15710
|
+
}), _void(), {
|
|
15436
15711
|
kind: "mutation",
|
|
15437
15712
|
auth: "admin"
|
|
15438
|
-
}), method(object({
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
* write; a stored key NEVER round-trips to a client.
|
|
15449
|
-
*/
|
|
15450
|
-
var LlmProfileKindSchema = _enum([
|
|
15451
|
-
"openai-compatible",
|
|
15452
|
-
"openai",
|
|
15453
|
-
"anthropic",
|
|
15454
|
-
"google",
|
|
15455
|
-
"managed-local"
|
|
15456
|
-
]);
|
|
15457
|
-
var LlmProfileSchema = object({
|
|
15458
|
-
id: string(),
|
|
15713
|
+
}), method(object({
|
|
15714
|
+
deviceId: number(),
|
|
15715
|
+
patch: record(string(), unknown())
|
|
15716
|
+
}), _void(), {
|
|
15717
|
+
kind: "mutation",
|
|
15718
|
+
auth: "admin"
|
|
15719
|
+
}), method(_void(), array(string())), method(object({ name: string() }), _void(), {
|
|
15720
|
+
kind: "mutation",
|
|
15721
|
+
auth: "admin"
|
|
15722
|
+
}), method(object({
|
|
15459
15723
|
name: string(),
|
|
15460
|
-
|
|
15461
|
-
|
|
15462
|
-
|
|
15463
|
-
|
|
15464
|
-
|
|
15465
|
-
|
|
15466
|
-
|
|
15467
|
-
|
|
15468
|
-
|
|
15469
|
-
|
|
15470
|
-
|
|
15471
|
-
|
|
15472
|
-
|
|
15473
|
-
|
|
15474
|
-
|
|
15475
|
-
|
|
15476
|
-
|
|
15477
|
-
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
|
|
15481
|
-
|
|
15482
|
-
|
|
15483
|
-
kind:
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
})
|
|
15495
|
-
|
|
15496
|
-
|
|
15497
|
-
|
|
15498
|
-
|
|
15499
|
-
|
|
15500
|
-
|
|
15501
|
-
|
|
15502
|
-
|
|
15503
|
-
|
|
15504
|
-
|
|
15505
|
-
|
|
15506
|
-
|
|
15507
|
-
|
|
15508
|
-
|
|
15509
|
-
|
|
15510
|
-
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
|
|
15514
|
-
|
|
15515
|
-
|
|
15516
|
-
|
|
15517
|
-
|
|
15518
|
-
|
|
15519
|
-
|
|
15520
|
-
|
|
15521
|
-
|
|
15522
|
-
|
|
15523
|
-
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
})
|
|
15535
|
-
|
|
15724
|
+
cascade: boolean().optional()
|
|
15725
|
+
}), _void(), {
|
|
15726
|
+
kind: "mutation",
|
|
15727
|
+
auth: "admin"
|
|
15728
|
+
}), method(object({
|
|
15729
|
+
deviceId: number(),
|
|
15730
|
+
disabled: boolean()
|
|
15731
|
+
}), _void(), {
|
|
15732
|
+
kind: "mutation",
|
|
15733
|
+
auth: "admin"
|
|
15734
|
+
}), 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({
|
|
15735
|
+
mode: DeviceLinkModeSchema,
|
|
15736
|
+
devices: array(LinkedDeviceSchema)
|
|
15737
|
+
})), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
|
|
15738
|
+
deviceId: number(),
|
|
15739
|
+
values: record(string(), unknown())
|
|
15740
|
+
}), object({ success: literal(true) }), {
|
|
15741
|
+
kind: "mutation",
|
|
15742
|
+
auth: "admin"
|
|
15743
|
+
}), method(object({ deviceId: number() }), object({ success: literal(true) }), {
|
|
15744
|
+
kind: "mutation",
|
|
15745
|
+
auth: "admin"
|
|
15746
|
+
}), method(object({ deviceId: number() }), object({ success: literal(true) }), {
|
|
15747
|
+
kind: "mutation",
|
|
15748
|
+
auth: "admin"
|
|
15749
|
+
}), method(object({ deviceId: number() }), object({ success: literal(true) }), {
|
|
15750
|
+
kind: "mutation",
|
|
15751
|
+
auth: "admin"
|
|
15752
|
+
}), method(object({ integrationId: string() }), object({ removed: number() }), {
|
|
15753
|
+
kind: "mutation",
|
|
15754
|
+
auth: "admin"
|
|
15755
|
+
}), method(object({ deviceId: number() }), record(string(), string().nullable())), method(object({
|
|
15756
|
+
deviceId: number(),
|
|
15757
|
+
profileMap: record(string(), string().nullable())
|
|
15758
|
+
}), object({ success: literal(true) }), {
|
|
15759
|
+
kind: "mutation",
|
|
15760
|
+
auth: "admin"
|
|
15761
|
+
}), method(object({ deviceId: number() }), array(StreamProbeResultSchema), {
|
|
15762
|
+
kind: "mutation",
|
|
15763
|
+
auth: "admin"
|
|
15764
|
+
}), method(object({ deviceId: number() }), object({
|
|
15765
|
+
deviceId: number(),
|
|
15766
|
+
entries: array(object({
|
|
15767
|
+
capName: string(),
|
|
15768
|
+
kind: _enum([
|
|
15769
|
+
"native",
|
|
15770
|
+
"wrapped",
|
|
15771
|
+
"linked"
|
|
15772
|
+
]),
|
|
15773
|
+
providerAddonId: string(),
|
|
15774
|
+
providerNodeId: string(),
|
|
15775
|
+
nativeAddonId: string()
|
|
15776
|
+
}))
|
|
15777
|
+
})), method(object({}), array(object({
|
|
15778
|
+
deviceId: number(),
|
|
15779
|
+
entries: array(object({
|
|
15780
|
+
capName: string(),
|
|
15781
|
+
kind: _enum([
|
|
15782
|
+
"native",
|
|
15783
|
+
"wrapped",
|
|
15784
|
+
"linked"
|
|
15785
|
+
]),
|
|
15786
|
+
providerAddonId: string(),
|
|
15787
|
+
providerNodeId: string(),
|
|
15788
|
+
nativeAddonId: string()
|
|
15789
|
+
}))
|
|
15790
|
+
}))), method(object({
|
|
15791
|
+
deviceId: number(),
|
|
15792
|
+
capName: string(),
|
|
15793
|
+
wrapperAddonId: string(),
|
|
15794
|
+
active: boolean()
|
|
15795
|
+
}), _void(), {
|
|
15796
|
+
kind: "mutation",
|
|
15797
|
+
auth: "admin"
|
|
15798
|
+
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
15799
|
+
capName: string(),
|
|
15800
|
+
wrappers: array(string())
|
|
15801
|
+
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
15802
|
+
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
15803
|
+
live: SettingsSchemaWithValuesSchema.nullable()
|
|
15804
|
+
})), method(object({
|
|
15805
|
+
deviceId: number().int().nonnegative(),
|
|
15806
|
+
action: string().min(1),
|
|
15807
|
+
input: unknown()
|
|
15808
|
+
}), unknown(), { kind: "mutation" }), method(object({
|
|
15809
|
+
deviceId: number(),
|
|
15810
|
+
writerCapName: string(),
|
|
15811
|
+
writerAddonId: string(),
|
|
15812
|
+
key: string(),
|
|
15813
|
+
value: unknown()
|
|
15814
|
+
}), object({ success: literal(true) }), {
|
|
15815
|
+
kind: "mutation",
|
|
15816
|
+
auth: "admin"
|
|
15817
|
+
}), method(object({
|
|
15818
|
+
deviceId: number(),
|
|
15819
|
+
changes: array(object({
|
|
15820
|
+
writerCapName: string(),
|
|
15821
|
+
writerAddonId: string(),
|
|
15822
|
+
key: string(),
|
|
15823
|
+
value: unknown()
|
|
15824
|
+
}))
|
|
15825
|
+
}), object({
|
|
15826
|
+
success: literal(true),
|
|
15827
|
+
failures: array(object({
|
|
15828
|
+
writerCapName: string(),
|
|
15829
|
+
writerAddonId: string(),
|
|
15830
|
+
error: string()
|
|
15831
|
+
}))
|
|
15832
|
+
}), {
|
|
15833
|
+
kind: "mutation",
|
|
15834
|
+
auth: "admin"
|
|
15835
|
+
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
15536
15836
|
kind: "mutation",
|
|
15537
15837
|
auth: "admin"
|
|
15538
|
-
}), method(
|
|
15838
|
+
}), method(object({
|
|
15839
|
+
addonId: string(),
|
|
15840
|
+
candidate: DiscoveryCandidateSchema,
|
|
15841
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
15842
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15843
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15844
|
+
integrationId: string().optional()
|
|
15845
|
+
}), DeviceSummarySchema, {
|
|
15539
15846
|
kind: "mutation",
|
|
15540
15847
|
auth: "admin"
|
|
15541
|
-
}), method(
|
|
15848
|
+
}), method(object({
|
|
15849
|
+
addonId: string(),
|
|
15850
|
+
type: _enum(DeviceType)
|
|
15851
|
+
}), unknown().nullable()), method(object({
|
|
15852
|
+
addonId: string(),
|
|
15853
|
+
type: _enum(DeviceType),
|
|
15854
|
+
config: record(string(), unknown()),
|
|
15855
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
15856
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15857
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15858
|
+
integrationId: string().optional()
|
|
15859
|
+
}), DeviceSummarySchema, {
|
|
15542
15860
|
kind: "mutation",
|
|
15543
15861
|
auth: "admin"
|
|
15544
|
-
}), method(
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15862
|
+
}), method(object({
|
|
15863
|
+
addonId: string(),
|
|
15864
|
+
type: _enum(DeviceType),
|
|
15865
|
+
key: string(),
|
|
15866
|
+
value: unknown(),
|
|
15867
|
+
formValues: record(string(), unknown()).optional()
|
|
15868
|
+
}), FieldProbeResultSchema, {
|
|
15548
15869
|
kind: "mutation",
|
|
15549
15870
|
auth: "admin"
|
|
15550
15871
|
}), method(object({
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15872
|
+
addonId: string(),
|
|
15873
|
+
integrationId: string()
|
|
15874
|
+
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
15875
|
+
addonId: string(),
|
|
15876
|
+
integrationId: string()
|
|
15877
|
+
}), AdoptionStatusSchema, {
|
|
15878
|
+
kind: "mutation",
|
|
15879
|
+
auth: "admin"
|
|
15880
|
+
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
15881
|
+
kind: "mutation",
|
|
15882
|
+
auth: "admin"
|
|
15883
|
+
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
15884
|
+
kind: "mutation",
|
|
15885
|
+
auth: "admin"
|
|
15886
|
+
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
15887
|
+
kind: "mutation",
|
|
15888
|
+
auth: "admin"
|
|
15889
|
+
}), method(object({}), object({ providers: array(object({
|
|
15890
|
+
addonId: string(),
|
|
15891
|
+
label: string()
|
|
15892
|
+
})).readonly() }), { auth: "admin" }), method(object({}), object({ groups: array(object({
|
|
15893
|
+
addonId: string(),
|
|
15894
|
+
label: string(),
|
|
15895
|
+
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
15896
|
+
error: string().nullable()
|
|
15897
|
+
})).readonly() }), {
|
|
15559
15898
|
kind: "mutation",
|
|
15560
15899
|
auth: "admin"
|
|
15561
15900
|
}), method(object({
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
}),
|
|
15901
|
+
addonId: string(),
|
|
15902
|
+
params: record(string(), unknown()).optional()
|
|
15903
|
+
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
15565
15904
|
kind: "mutation",
|
|
15566
15905
|
auth: "admin"
|
|
15567
|
-
}), method(
|
|
15906
|
+
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
15907
|
+
deviceId: number(),
|
|
15908
|
+
key: string(),
|
|
15909
|
+
value: unknown()
|
|
15910
|
+
}), FieldProbeResultSchema, {
|
|
15568
15911
|
kind: "mutation",
|
|
15569
15912
|
auth: "admin"
|
|
15570
|
-
}), method(
|
|
15913
|
+
}), method(object({
|
|
15914
|
+
deviceId: number(),
|
|
15915
|
+
caps: array(string()).readonly().optional()
|
|
15916
|
+
}), record(string(), unknown().nullable()));
|
|
15917
|
+
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
15918
|
+
deviceId: number(),
|
|
15919
|
+
capName: string()
|
|
15920
|
+
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
15921
|
+
deviceId: number(),
|
|
15922
|
+
capName: string(),
|
|
15923
|
+
slice: record(string(), unknown())
|
|
15924
|
+
}), _void(), { kind: "mutation" }), object({
|
|
15925
|
+
deviceId: number(),
|
|
15926
|
+
capName: string(),
|
|
15927
|
+
slice: record(string(), unknown())
|
|
15928
|
+
});
|
|
15929
|
+
/**
|
|
15930
|
+
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
15931
|
+
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
15932
|
+
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
15933
|
+
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
15934
|
+
* post-analysis enrichment-engine.
|
|
15935
|
+
*/
|
|
15936
|
+
var EmbeddingResultSchema = object({
|
|
15937
|
+
embedding: array(number()),
|
|
15938
|
+
inferenceMs: number()
|
|
15939
|
+
});
|
|
15940
|
+
var EmbeddingInfoSchema = object({
|
|
15941
|
+
modelId: string(),
|
|
15942
|
+
embeddingDim: number(),
|
|
15943
|
+
ready: boolean()
|
|
15944
|
+
});
|
|
15945
|
+
method(object({
|
|
15946
|
+
crop: _instanceof(Uint8Array),
|
|
15947
|
+
width: number(),
|
|
15948
|
+
height: number()
|
|
15949
|
+
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
15950
|
+
/**
|
|
15951
|
+
* filesystem-browse — per-node capability for browsing the node's local
|
|
15952
|
+
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
15953
|
+
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
15954
|
+
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
15955
|
+
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
15956
|
+
*/
|
|
15957
|
+
var DirEntrySchema = object({
|
|
15958
|
+
name: string(),
|
|
15959
|
+
path: string()
|
|
15960
|
+
});
|
|
15961
|
+
var BrowseResultSchema = object({
|
|
15962
|
+
path: string(),
|
|
15963
|
+
entries: array(DirEntrySchema).readonly(),
|
|
15964
|
+
freeBytes: number(),
|
|
15965
|
+
totalBytes: number()
|
|
15966
|
+
});
|
|
15967
|
+
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
15571
15968
|
kind: "mutation",
|
|
15572
15969
|
auth: "admin"
|
|
15573
15970
|
});
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15577
|
-
|
|
15578
|
-
|
|
15971
|
+
/**
|
|
15972
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15973
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15974
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
15975
|
+
*
|
|
15976
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15977
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
15978
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15979
|
+
*/
|
|
15980
|
+
var LlmUsageSchema = object({
|
|
15981
|
+
inputTokens: number(),
|
|
15982
|
+
outputTokens: number()
|
|
15983
|
+
});
|
|
15984
|
+
var LlmErrorCodeSchema = _enum([
|
|
15985
|
+
"timeout",
|
|
15986
|
+
"rate-limited",
|
|
15987
|
+
"auth",
|
|
15988
|
+
"refusal",
|
|
15989
|
+
"bad-request",
|
|
15990
|
+
"unavailable",
|
|
15991
|
+
"no-profile",
|
|
15992
|
+
"budget-exceeded",
|
|
15993
|
+
"adapter-error"
|
|
15579
15994
|
]);
|
|
15580
|
-
var
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15995
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15996
|
+
ok: literal(true),
|
|
15997
|
+
text: string(),
|
|
15998
|
+
model: string(),
|
|
15999
|
+
usage: LlmUsageSchema,
|
|
16000
|
+
truncated: boolean(),
|
|
16001
|
+
latencyMs: number()
|
|
16002
|
+
}), object({
|
|
16003
|
+
ok: literal(false),
|
|
16004
|
+
code: LlmErrorCodeSchema,
|
|
15584
16005
|
message: string(),
|
|
15585
|
-
|
|
15586
|
-
|
|
16006
|
+
retryAfterMs: number().optional()
|
|
16007
|
+
})]);
|
|
16008
|
+
/**
|
|
16009
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
16010
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
16011
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
16012
|
+
*/
|
|
16013
|
+
var LlmImageSchema = object({
|
|
16014
|
+
bytes: _instanceof(Uint8Array),
|
|
16015
|
+
mimeType: string()
|
|
16016
|
+
});
|
|
16017
|
+
var LlmGenerateBaseInputSchema = object({
|
|
16018
|
+
/** Collection routing (the notification-output posture). */
|
|
16019
|
+
addonId: string().optional(),
|
|
16020
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
16021
|
+
profileId: string().optional(),
|
|
16022
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
16023
|
+
consumer: string(),
|
|
16024
|
+
system: string().optional(),
|
|
16025
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
16026
|
+
prompt: string(),
|
|
16027
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
16028
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
16029
|
+
/** Per-call override of the profile default. */
|
|
16030
|
+
maxTokens: number().int().positive().optional(),
|
|
16031
|
+
temperature: number().optional()
|
|
15587
16032
|
});
|
|
15588
|
-
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
15589
|
-
scope: array(string()).optional(),
|
|
15590
|
-
level: LogLevelSchema.optional(),
|
|
15591
|
-
since: date().optional(),
|
|
15592
|
-
until: date().optional(),
|
|
15593
|
-
limit: number().optional(),
|
|
15594
|
-
tags: record(string(), string()).optional()
|
|
15595
|
-
}), array(LogEntrySchema).readonly());
|
|
15596
16033
|
/**
|
|
15597
|
-
* `
|
|
15598
|
-
*
|
|
15599
|
-
*
|
|
15600
|
-
*
|
|
15601
|
-
*
|
|
15602
|
-
* procedure aggregates them for the unauthenticated login page.
|
|
15603
|
-
*
|
|
15604
|
-
* A contribution is a discriminated union on `kind`:
|
|
15605
|
-
*
|
|
15606
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
15607
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
15608
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
15609
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
15610
|
-
* login page needs NO change.
|
|
15611
|
-
*
|
|
15612
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
15613
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
15614
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
15615
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
15616
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
15617
|
-
*
|
|
15618
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
15619
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
15620
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
15621
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
15622
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
15623
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
15624
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
15625
|
-
* decision.
|
|
15626
|
-
*
|
|
15627
|
-
* Every contribution carries a `stage`:
|
|
15628
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
15629
|
-
* magic-link buttons; a future usernameless passkey).
|
|
15630
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
15631
|
-
* returned `factors` (passkey-as-2FA today).
|
|
16034
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
16035
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
16036
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
16037
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
16038
|
+
* this only through the `llm` cap's methods.
|
|
15632
16039
|
*
|
|
15633
|
-
*
|
|
15634
|
-
*
|
|
15635
|
-
*
|
|
16040
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
16041
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
16042
|
+
* watchdog — operator decision #3).
|
|
15636
16043
|
*/
|
|
15637
|
-
|
|
15638
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
15639
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
15640
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
16044
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15641
16045
|
object({
|
|
15642
|
-
kind: literal("
|
|
15643
|
-
|
|
15644
|
-
id: string(),
|
|
15645
|
-
/** Operator-facing button label. */
|
|
15646
|
-
label: string(),
|
|
15647
|
-
/** lucide-react icon name. */
|
|
15648
|
-
icon: string().optional(),
|
|
15649
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
15650
|
-
startUrl: string(),
|
|
15651
|
-
stage: LoginStageEnum
|
|
16046
|
+
kind: literal("catalog"),
|
|
16047
|
+
catalogId: string()
|
|
15652
16048
|
}),
|
|
15653
16049
|
object({
|
|
15654
|
-
kind: literal("
|
|
15655
|
-
|
|
15656
|
-
|
|
15657
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
15658
|
-
addonId: string(),
|
|
15659
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
15660
|
-
bundle: string(),
|
|
15661
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
15662
|
-
remote: WidgetRemoteSchema,
|
|
15663
|
-
stage: LoginStageEnum
|
|
16050
|
+
kind: literal("url"),
|
|
16051
|
+
url: string(),
|
|
16052
|
+
sha256: string().optional()
|
|
15664
16053
|
}),
|
|
15665
16054
|
object({
|
|
15666
|
-
kind: literal("
|
|
15667
|
-
|
|
15668
|
-
id: string(),
|
|
15669
|
-
/** Operator-facing button label. */
|
|
15670
|
-
label: string(),
|
|
15671
|
-
stage: LoginStageEnum,
|
|
15672
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
15673
|
-
rpId: string(),
|
|
15674
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
15675
|
-
origin: string().nullable()
|
|
16055
|
+
kind: literal("path"),
|
|
16056
|
+
path: string()
|
|
15676
16057
|
})
|
|
15677
16058
|
]);
|
|
15678
|
-
var
|
|
15679
|
-
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
|
|
15686
|
-
|
|
15687
|
-
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
number(),
|
|
15696
|
-
number()
|
|
15697
|
-
]),
|
|
15698
|
-
cores: number()
|
|
15699
|
-
});
|
|
15700
|
-
var MemoryInfoSchema = object({
|
|
15701
|
-
percent: number(),
|
|
15702
|
-
totalBytes: number(),
|
|
15703
|
-
usedBytes: number(),
|
|
15704
|
-
availableBytes: number(),
|
|
15705
|
-
swapUsedBytes: number(),
|
|
15706
|
-
swapTotalBytes: number()
|
|
15707
|
-
});
|
|
15708
|
-
var DiskIoSnapshotSchema = object({
|
|
15709
|
-
readBytes: number(),
|
|
15710
|
-
writeBytes: number(),
|
|
15711
|
-
readOps: number(),
|
|
15712
|
-
writeOps: number(),
|
|
15713
|
-
timestampMs: number()
|
|
15714
|
-
});
|
|
15715
|
-
var NetworkIoSnapshotSchema = object({
|
|
15716
|
-
rxBytes: number(),
|
|
15717
|
-
txBytes: number(),
|
|
15718
|
-
rxPackets: number(),
|
|
15719
|
-
txPackets: number(),
|
|
15720
|
-
rxErrors: number(),
|
|
15721
|
-
txErrors: number(),
|
|
15722
|
-
timestampMs: number()
|
|
15723
|
-
});
|
|
15724
|
-
var MetricsGpuInfoSchema = object({
|
|
15725
|
-
utilization: number(),
|
|
15726
|
-
model: string(),
|
|
15727
|
-
memoryUsedBytes: number(),
|
|
15728
|
-
memoryTotalBytes: number(),
|
|
15729
|
-
temperature: number().nullable()
|
|
15730
|
-
});
|
|
15731
|
-
var ProcessResourceInfoSchema = object({
|
|
15732
|
-
openFds: number(),
|
|
15733
|
-
threadCount: number(),
|
|
15734
|
-
activeHandles: number(),
|
|
15735
|
-
activeRequests: number()
|
|
15736
|
-
});
|
|
15737
|
-
var PressureAvgsSchema = object({
|
|
15738
|
-
avg10: number(),
|
|
15739
|
-
avg60: number(),
|
|
15740
|
-
avg300: number()
|
|
15741
|
-
});
|
|
15742
|
-
var PressureInfoSchema = object({
|
|
15743
|
-
some: PressureAvgsSchema,
|
|
15744
|
-
full: PressureAvgsSchema.nullable()
|
|
15745
|
-
});
|
|
15746
|
-
var SystemResourceSnapshotSchema = object({
|
|
15747
|
-
cpu: CpuBreakdownSchema,
|
|
15748
|
-
memory: MemoryInfoSchema,
|
|
15749
|
-
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15750
|
-
network: NetworkIoSnapshotSchema,
|
|
15751
|
-
disk: DiskIoSnapshotSchema,
|
|
15752
|
-
pressure: object({
|
|
15753
|
-
cpu: PressureInfoSchema.nullable(),
|
|
15754
|
-
memory: PressureInfoSchema.nullable(),
|
|
15755
|
-
io: PressureInfoSchema.nullable()
|
|
15756
|
-
}),
|
|
15757
|
-
process: ProcessResourceInfoSchema,
|
|
15758
|
-
cpuTemperature: number().nullable(),
|
|
15759
|
-
timestampMs: number()
|
|
15760
|
-
});
|
|
15761
|
-
var DiskSpaceInfoSchema = object({
|
|
15762
|
-
path: string(),
|
|
15763
|
-
totalBytes: number(),
|
|
15764
|
-
usedBytes: number(),
|
|
15765
|
-
availableBytes: number(),
|
|
15766
|
-
percent: number()
|
|
15767
|
-
});
|
|
15768
|
-
var PidResourceStatsSchema = object({
|
|
15769
|
-
pid: number(),
|
|
15770
|
-
cpu: number(),
|
|
15771
|
-
memory: number(),
|
|
15772
|
-
/**
|
|
15773
|
-
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
15774
|
-
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
15775
|
-
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
15776
|
-
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
15777
|
-
* Undefined where /proc is unavailable (e.g. macOS).
|
|
15778
|
-
*/
|
|
15779
|
-
privateBytes: number().optional(),
|
|
15780
|
-
/**
|
|
15781
|
-
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
15782
|
-
* code shared copy-on-write across runners. Undefined on macOS.
|
|
15783
|
-
*/
|
|
15784
|
-
sharedBytes: number().optional()
|
|
16059
|
+
var ManagedRuntimeConfigSchema = object({
|
|
16060
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
16061
|
+
nodeId: string(),
|
|
16062
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
16063
|
+
engine: _enum(["llama-cpp"]),
|
|
16064
|
+
model: ManagedModelRefSchema,
|
|
16065
|
+
contextSize: number().int().default(4096),
|
|
16066
|
+
/** 0 = CPU-only. */
|
|
16067
|
+
gpuLayers: number().int().default(0),
|
|
16068
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
16069
|
+
threads: number().int().optional(),
|
|
16070
|
+
/** Concurrent slots. */
|
|
16071
|
+
parallel: number().int().default(1),
|
|
16072
|
+
/** Else lazy: first generate boots it. */
|
|
16073
|
+
autoStart: boolean().default(false),
|
|
16074
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
16075
|
+
idleStopMinutes: number().int().default(30)
|
|
15785
16076
|
});
|
|
15786
|
-
var
|
|
15787
|
-
|
|
16077
|
+
var LlmRuntimeStatusSchema = object({
|
|
16078
|
+
/** Status is ALWAYS node-qualified. */
|
|
15788
16079
|
nodeId: string(),
|
|
15789
|
-
role: _enum(["hub", "worker"]),
|
|
15790
|
-
pid: number(),
|
|
15791
16080
|
state: _enum([
|
|
15792
|
-
"starting",
|
|
15793
|
-
"running",
|
|
15794
|
-
"stopping",
|
|
15795
16081
|
"stopped",
|
|
15796
|
-
"
|
|
15797
|
-
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
pid: number(),
|
|
15802
|
-
ppid: number(),
|
|
15803
|
-
pgid: number(),
|
|
15804
|
-
classification: _enum([
|
|
15805
|
-
"root",
|
|
15806
|
-
"managed",
|
|
15807
|
-
"system",
|
|
15808
|
-
"ghost"
|
|
16082
|
+
"downloading",
|
|
16083
|
+
"starting",
|
|
16084
|
+
"ready",
|
|
16085
|
+
"crashed",
|
|
16086
|
+
"failed"
|
|
15809
16087
|
]),
|
|
15810
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
15811
|
-
addonId: string().nullable(),
|
|
15812
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15813
|
-
nodeId: string().nullable(),
|
|
15814
|
-
/** Truncated command line. */
|
|
15815
|
-
command: string(),
|
|
15816
|
-
cpuPercent: number(),
|
|
15817
|
-
memoryRssBytes: number(),
|
|
15818
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15819
|
-
uptimeSec: number(),
|
|
15820
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15821
|
-
orphaned: boolean()
|
|
15822
|
-
});
|
|
15823
|
-
var KillProcessInputSchema = object({
|
|
15824
|
-
pid: number(),
|
|
15825
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15826
|
-
force: boolean().optional()
|
|
15827
|
-
});
|
|
15828
|
-
var KillProcessResultSchema = object({
|
|
15829
|
-
success: boolean(),
|
|
15830
|
-
reason: string().optional(),
|
|
15831
|
-
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15832
|
-
});
|
|
15833
|
-
var DumpHeapSnapshotInputSchema = object({
|
|
15834
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
15835
|
-
addonId: string() });
|
|
15836
|
-
var DumpHeapSnapshotResultSchema = object({
|
|
15837
|
-
success: boolean(),
|
|
15838
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15839
|
-
path: string().optional(),
|
|
15840
|
-
/** Process pid that was signalled. */
|
|
15841
16088
|
pid: number().optional(),
|
|
15842
|
-
|
|
16089
|
+
port: number().optional(),
|
|
16090
|
+
modelPath: string().optional(),
|
|
16091
|
+
modelId: string().optional(),
|
|
16092
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
16093
|
+
lastError: string().optional(),
|
|
16094
|
+
crashesInWindow: number(),
|
|
16095
|
+
/** Child RSS (sampled best-effort). */
|
|
16096
|
+
memoryBytes: number().optional(),
|
|
16097
|
+
vramBytes: number().optional()
|
|
15843
16098
|
});
|
|
15844
|
-
var
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
|
|
15850
|
-
|
|
15851
|
-
|
|
15852
|
-
|
|
16099
|
+
var LlmNodeModelSchema = object({
|
|
16100
|
+
file: string(),
|
|
16101
|
+
sizeBytes: number(),
|
|
16102
|
+
catalogId: string().optional(),
|
|
16103
|
+
installedAt: number().optional()
|
|
16104
|
+
});
|
|
16105
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
16106
|
+
nodeId: string(),
|
|
16107
|
+
modelsBytes: number(),
|
|
16108
|
+
freeBytes: number().optional()
|
|
15853
16109
|
});
|
|
15854
|
-
method(
|
|
16110
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
16111
|
+
images: array(LlmImageSchema).optional(),
|
|
16112
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
16113
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
16114
|
+
timeoutMs: number().int().positive().optional()
|
|
16115
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15855
16116
|
kind: "mutation",
|
|
15856
16117
|
auth: "admin"
|
|
15857
|
-
}), method(
|
|
16118
|
+
}), method(object({}), _void(), {
|
|
15858
16119
|
kind: "mutation",
|
|
15859
16120
|
auth: "admin"
|
|
15860
|
-
})
|
|
15861
|
-
method(object({
|
|
15862
|
-
sourceUrl: string(),
|
|
15863
|
-
metadata: ModelConvertMetadataSchema,
|
|
15864
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15865
|
-
calibrationRef: string().optional(),
|
|
15866
|
-
sessionId: string().optional()
|
|
15867
|
-
}), ConvertResultSchema, {
|
|
16121
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15868
16122
|
kind: "mutation",
|
|
15869
|
-
auth: "admin"
|
|
15870
|
-
|
|
15871
|
-
});
|
|
15872
|
-
method(object({
|
|
15873
|
-
nodeId: string(),
|
|
15874
|
-
modelId: string(),
|
|
15875
|
-
format: _enum(MODEL_FORMATS),
|
|
15876
|
-
entry: ModelCatalogEntrySchema
|
|
15877
|
-
}), object({
|
|
15878
|
-
ok: boolean(),
|
|
15879
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15880
|
-
sha256: string(),
|
|
15881
|
-
bytes: number(),
|
|
15882
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15883
|
-
path: string()
|
|
15884
|
-
}), {
|
|
16123
|
+
auth: "admin"
|
|
16124
|
+
}), method(object({ file: string() }), _void(), {
|
|
15885
16125
|
kind: "mutation",
|
|
15886
16126
|
auth: "admin"
|
|
15887
|
-
});
|
|
15888
|
-
/**
|
|
15889
|
-
* `mqtt-broker` — broker-registry cap.
|
|
15890
|
-
*
|
|
15891
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15892
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15893
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
15894
|
-
* its OWN `mqtt.js` client.
|
|
15895
|
-
*
|
|
15896
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15897
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15898
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
15899
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15900
|
-
* features anyway — give it the connection config, get out of the way.
|
|
15901
|
-
*
|
|
15902
|
-
* Consumer flow:
|
|
15903
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
15904
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
15905
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
15906
|
-
*
|
|
15907
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
15908
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
15909
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
15910
|
-
* spawned it.
|
|
15911
|
-
*/
|
|
15912
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
16127
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15913
16128
|
/**
|
|
15914
|
-
*
|
|
16129
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
16130
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
16131
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
16132
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
16133
|
+
* (hub-placed); the cap stays open for future providers.
|
|
15915
16134
|
*
|
|
15916
|
-
*
|
|
15917
|
-
*
|
|
15918
|
-
*
|
|
15919
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
15920
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16135
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
16136
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
16137
|
+
* write; a stored key NEVER round-trips to a client.
|
|
15921
16138
|
*/
|
|
15922
|
-
var
|
|
15923
|
-
"
|
|
15924
|
-
"
|
|
15925
|
-
"
|
|
15926
|
-
"
|
|
15927
|
-
"
|
|
16139
|
+
var LlmProfileKindSchema = _enum([
|
|
16140
|
+
"openai-compatible",
|
|
16141
|
+
"openai",
|
|
16142
|
+
"anthropic",
|
|
16143
|
+
"google",
|
|
16144
|
+
"managed-local"
|
|
15928
16145
|
]);
|
|
15929
|
-
var
|
|
16146
|
+
var LlmProfileSchema = object({
|
|
15930
16147
|
id: string(),
|
|
15931
16148
|
name: string(),
|
|
15932
|
-
|
|
15933
|
-
|
|
15934
|
-
|
|
15935
|
-
|
|
15936
|
-
|
|
15937
|
-
|
|
15938
|
-
|
|
15939
|
-
|
|
15940
|
-
|
|
16149
|
+
kind: LlmProfileKindSchema,
|
|
16150
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
16151
|
+
addonId: string(),
|
|
16152
|
+
enabled: boolean(),
|
|
16153
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
16154
|
+
model: string(),
|
|
16155
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
16156
|
+
baseUrl: string().optional(),
|
|
16157
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
16158
|
+
apiKey: string().optional(),
|
|
16159
|
+
supportsVision: boolean(),
|
|
16160
|
+
temperature: number().min(0).max(2).optional(),
|
|
16161
|
+
maxTokens: number().int().positive().optional(),
|
|
16162
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
16163
|
+
extraHeaders: record(string(), string()).optional(),
|
|
16164
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
16165
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15941
16166
|
});
|
|
15942
|
-
/**
|
|
15943
|
-
*
|
|
15944
|
-
*
|
|
15945
|
-
|
|
15946
|
-
|
|
15947
|
-
|
|
15948
|
-
|
|
15949
|
-
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
15954
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
15955
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
15956
|
-
* broker).
|
|
15957
|
-
*/
|
|
15958
|
-
clientIdPrefix: string().optional()
|
|
16167
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
16168
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
16169
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
16170
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
16171
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
16172
|
+
kind: LlmProfileKindSchema,
|
|
16173
|
+
label: string(),
|
|
16174
|
+
icon: string(),
|
|
16175
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16176
|
+
addonId: string(),
|
|
16177
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
15959
16178
|
});
|
|
15960
|
-
var
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
15964
|
-
password: string().optional(),
|
|
15965
|
-
clientIdPrefix: string().optional()
|
|
16179
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
16180
|
+
var LlmDefaultSchema = object({
|
|
16181
|
+
selector: LlmDefaultSelectorSchema,
|
|
16182
|
+
profileId: string()
|
|
15966
16183
|
});
|
|
15967
|
-
|
|
15968
|
-
var
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
15979
|
-
allowAnonymous: boolean().default(false),
|
|
15980
|
-
/** Optional shared username/password for clients. */
|
|
15981
|
-
username: string().optional(),
|
|
15982
|
-
password: string().optional()
|
|
16184
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
16185
|
+
var LlmUsageRollupSchema = object({
|
|
16186
|
+
day: string(),
|
|
16187
|
+
consumer: string(),
|
|
16188
|
+
profileId: string(),
|
|
16189
|
+
calls: number(),
|
|
16190
|
+
okCalls: number(),
|
|
16191
|
+
errorCalls: number(),
|
|
16192
|
+
inputTokens: number(),
|
|
16193
|
+
outputTokens: number(),
|
|
16194
|
+
avgLatencyMs: number()
|
|
15983
16195
|
});
|
|
15984
|
-
|
|
16196
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
16197
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
15985
16198
|
id: string(),
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
brokerCount: number(),
|
|
15990
|
-
embeddedRunning: boolean()
|
|
15991
|
-
});
|
|
15992
|
-
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);
|
|
15993
|
-
var NetworkEndpointSchema = object({
|
|
16199
|
+
label: string(),
|
|
16200
|
+
family: string(),
|
|
16201
|
+
purpose: _enum(["text", "vision"]),
|
|
15994
16202
|
url: string(),
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
16203
|
+
sha256: string(),
|
|
16204
|
+
sizeBytes: number(),
|
|
16205
|
+
quantization: string(),
|
|
16206
|
+
/** Load-time guidance shown in the picker. */
|
|
16207
|
+
minRamBytes: number(),
|
|
16208
|
+
contextSizeDefault: number().int(),
|
|
16209
|
+
/** Vision models: companion projector file. */
|
|
16210
|
+
mmprojUrl: string().optional()
|
|
15998
16211
|
});
|
|
15999
|
-
var
|
|
16000
|
-
|
|
16001
|
-
|
|
16212
|
+
var LlmRuntimeNodeSchema = object({
|
|
16213
|
+
nodeId: string(),
|
|
16214
|
+
reachable: boolean(),
|
|
16215
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
16216
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
16002
16217
|
error: string().optional()
|
|
16003
16218
|
});
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
|
|
16015
|
-
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
|
|
16022
|
-
|
|
16023
|
-
|
|
16219
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
16220
|
+
var ProfileRefInputSchema = object({
|
|
16221
|
+
addonId: string(),
|
|
16222
|
+
profileId: string()
|
|
16223
|
+
});
|
|
16224
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
16225
|
+
kind: "mutation",
|
|
16226
|
+
auth: "admin"
|
|
16227
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16228
|
+
kind: "mutation",
|
|
16229
|
+
auth: "admin"
|
|
16230
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
16231
|
+
kind: "mutation",
|
|
16232
|
+
auth: "admin"
|
|
16233
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
16234
|
+
selector: LlmDefaultSelectorSchema,
|
|
16235
|
+
profileId: string().nullable()
|
|
16236
|
+
}), _void(), {
|
|
16237
|
+
kind: "mutation",
|
|
16238
|
+
auth: "admin"
|
|
16239
|
+
}), method(object({
|
|
16240
|
+
since: number().optional(),
|
|
16241
|
+
until: number().optional(),
|
|
16242
|
+
consumer: string().optional(),
|
|
16243
|
+
profileId: string().optional()
|
|
16244
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16245
|
+
nodeId: string(),
|
|
16246
|
+
model: ManagedModelRefSchema
|
|
16247
|
+
}), _void(), {
|
|
16248
|
+
kind: "mutation",
|
|
16249
|
+
auth: "admin"
|
|
16250
|
+
}), method(object({
|
|
16251
|
+
nodeId: string(),
|
|
16252
|
+
file: string()
|
|
16253
|
+
}), _void(), {
|
|
16254
|
+
kind: "mutation",
|
|
16255
|
+
auth: "admin"
|
|
16256
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16257
|
+
kind: "mutation",
|
|
16258
|
+
auth: "admin"
|
|
16259
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16260
|
+
kind: "mutation",
|
|
16261
|
+
auth: "admin"
|
|
16262
|
+
});
|
|
16263
|
+
var LogLevelSchema = _enum([
|
|
16264
|
+
"debug",
|
|
16265
|
+
"info",
|
|
16266
|
+
"warn",
|
|
16267
|
+
"error"
|
|
16268
|
+
]);
|
|
16269
|
+
var LogEntrySchema = object({
|
|
16270
|
+
timestamp: date(),
|
|
16271
|
+
level: LogLevelSchema,
|
|
16272
|
+
scope: array(string()),
|
|
16273
|
+
message: string(),
|
|
16274
|
+
meta: record(string(), unknown()).optional(),
|
|
16275
|
+
tags: record(string(), string()).optional()
|
|
16024
16276
|
});
|
|
16025
|
-
method(
|
|
16277
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
16278
|
+
scope: array(string()).optional(),
|
|
16279
|
+
level: LogLevelSchema.optional(),
|
|
16280
|
+
since: date().optional(),
|
|
16281
|
+
until: date().optional(),
|
|
16282
|
+
limit: number().optional(),
|
|
16283
|
+
tags: record(string(), string()).optional()
|
|
16284
|
+
}), array(LogEntrySchema).readonly());
|
|
16026
16285
|
/**
|
|
16027
|
-
*
|
|
16286
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
16287
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
16288
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
16289
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
16290
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
16291
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
16028
16292
|
*
|
|
16029
|
-
*
|
|
16030
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
16031
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
16032
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16033
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
16034
|
-
* message to what the kind supports — callers never special-case a service.
|
|
16293
|
+
* A contribution is a discriminated union on `kind`:
|
|
16035
16294
|
*
|
|
16036
|
-
*
|
|
16037
|
-
*
|
|
16038
|
-
* `
|
|
16039
|
-
*
|
|
16040
|
-
*
|
|
16041
|
-
* alternative would fork the UI per addon and cannot host the
|
|
16042
|
-
* discovery→adopt flow.
|
|
16043
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
16044
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
16045
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
16046
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
16047
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
16048
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
16049
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
16050
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
16051
|
-
* base64 fallback needed.
|
|
16295
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
16296
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16297
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
16298
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16299
|
+
* login page needs NO change.
|
|
16052
16300
|
*
|
|
16053
|
-
*
|
|
16054
|
-
*
|
|
16055
|
-
*
|
|
16056
|
-
|
|
16057
|
-
|
|
16058
|
-
*
|
|
16059
|
-
*
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
|
|
16065
|
-
|
|
16066
|
-
|
|
16067
|
-
|
|
16068
|
-
|
|
16069
|
-
*
|
|
16070
|
-
*
|
|
16071
|
-
*
|
|
16072
|
-
*
|
|
16301
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
16302
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
16303
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
16304
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
16305
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
16306
|
+
*
|
|
16307
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
16308
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
16309
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
16310
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
16311
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
16312
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
16313
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
16314
|
+
* decision.
|
|
16315
|
+
*
|
|
16316
|
+
* Every contribution carries a `stage`:
|
|
16317
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
16318
|
+
* magic-link buttons; a future usernameless passkey).
|
|
16319
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16320
|
+
* returned `factors` (passkey-as-2FA today).
|
|
16321
|
+
*
|
|
16322
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
16323
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
16324
|
+
* tRPC router.
|
|
16073
16325
|
*/
|
|
16074
|
-
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
|
|
16078
|
-
|
|
16079
|
-
|
|
16080
|
-
|
|
16081
|
-
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
-
|
|
16326
|
+
/** When a login method renders in the two-phase login flow. */
|
|
16327
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
16328
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
16329
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
16330
|
+
object({
|
|
16331
|
+
kind: literal("redirect"),
|
|
16332
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
16333
|
+
id: string(),
|
|
16334
|
+
/** Operator-facing button label. */
|
|
16335
|
+
label: string(),
|
|
16336
|
+
/** lucide-react icon name. */
|
|
16337
|
+
icon: string().optional(),
|
|
16338
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
16339
|
+
startUrl: string(),
|
|
16340
|
+
stage: LoginStageEnum
|
|
16341
|
+
}),
|
|
16342
|
+
object({
|
|
16343
|
+
kind: literal("widget"),
|
|
16344
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
16345
|
+
id: string(),
|
|
16346
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
16347
|
+
addonId: string(),
|
|
16348
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
16349
|
+
bundle: string(),
|
|
16350
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
16351
|
+
remote: WidgetRemoteSchema,
|
|
16352
|
+
stage: LoginStageEnum
|
|
16353
|
+
}),
|
|
16354
|
+
object({
|
|
16355
|
+
kind: literal("passkey"),
|
|
16356
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
16357
|
+
id: string(),
|
|
16358
|
+
/** Operator-facing button label. */
|
|
16359
|
+
label: string(),
|
|
16360
|
+
stage: LoginStageEnum,
|
|
16361
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
16362
|
+
rpId: string(),
|
|
16363
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
16364
|
+
origin: string().nullable()
|
|
16365
|
+
})
|
|
16085
16366
|
]);
|
|
16086
|
-
|
|
16087
|
-
|
|
16088
|
-
|
|
16089
|
-
|
|
16090
|
-
|
|
16367
|
+
var loginMethodCapability = {
|
|
16368
|
+
name: "login-method",
|
|
16369
|
+
scope: "system",
|
|
16370
|
+
mode: "collection",
|
|
16371
|
+
internal: true,
|
|
16372
|
+
methods: { getLoginMethods: method(_void(), array(LoginMethodContributionSchema).readonly()) },
|
|
16373
|
+
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
16374
|
+
mount: { kind: "skip" }
|
|
16375
|
+
};
|
|
16376
|
+
var CpuBreakdownSchema = object({
|
|
16377
|
+
total: number(),
|
|
16378
|
+
user: number(),
|
|
16379
|
+
system: number(),
|
|
16380
|
+
irq: number(),
|
|
16381
|
+
nice: number(),
|
|
16382
|
+
loadAvg: tuple([
|
|
16383
|
+
number(),
|
|
16384
|
+
number(),
|
|
16385
|
+
number()
|
|
16386
|
+
]),
|
|
16387
|
+
cores: number()
|
|
16091
16388
|
});
|
|
16092
|
-
|
|
16093
|
-
|
|
16094
|
-
|
|
16095
|
-
|
|
16096
|
-
|
|
16097
|
-
|
|
16098
|
-
|
|
16099
|
-
|
|
16100
|
-
var
|
|
16101
|
-
|
|
16102
|
-
|
|
16103
|
-
|
|
16104
|
-
|
|
16105
|
-
|
|
16106
|
-
|
|
16107
|
-
|
|
16108
|
-
|
|
16109
|
-
|
|
16110
|
-
|
|
16111
|
-
|
|
16112
|
-
|
|
16113
|
-
|
|
16114
|
-
|
|
16389
|
+
var MemoryInfoSchema = object({
|
|
16390
|
+
percent: number(),
|
|
16391
|
+
totalBytes: number(),
|
|
16392
|
+
usedBytes: number(),
|
|
16393
|
+
availableBytes: number(),
|
|
16394
|
+
swapUsedBytes: number(),
|
|
16395
|
+
swapTotalBytes: number()
|
|
16396
|
+
});
|
|
16397
|
+
var DiskIoSnapshotSchema = object({
|
|
16398
|
+
readBytes: number(),
|
|
16399
|
+
writeBytes: number(),
|
|
16400
|
+
readOps: number(),
|
|
16401
|
+
writeOps: number(),
|
|
16402
|
+
timestampMs: number()
|
|
16403
|
+
});
|
|
16404
|
+
var NetworkIoSnapshotSchema = object({
|
|
16405
|
+
rxBytes: number(),
|
|
16406
|
+
txBytes: number(),
|
|
16407
|
+
rxPackets: number(),
|
|
16408
|
+
txPackets: number(),
|
|
16409
|
+
rxErrors: number(),
|
|
16410
|
+
txErrors: number(),
|
|
16411
|
+
timestampMs: number()
|
|
16412
|
+
});
|
|
16413
|
+
var MetricsGpuInfoSchema = object({
|
|
16414
|
+
utilization: number(),
|
|
16415
|
+
model: string(),
|
|
16416
|
+
memoryUsedBytes: number(),
|
|
16417
|
+
memoryTotalBytes: number(),
|
|
16418
|
+
temperature: number().nullable()
|
|
16419
|
+
});
|
|
16420
|
+
var ProcessResourceInfoSchema = object({
|
|
16421
|
+
openFds: number(),
|
|
16422
|
+
threadCount: number(),
|
|
16423
|
+
activeHandles: number(),
|
|
16424
|
+
activeRequests: number()
|
|
16115
16425
|
});
|
|
16116
|
-
|
|
16117
|
-
|
|
16118
|
-
|
|
16119
|
-
|
|
16120
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
16121
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
16122
|
-
flags: object({
|
|
16123
|
-
critical: boolean().optional(),
|
|
16124
|
-
silent: boolean().optional(),
|
|
16125
|
-
noPush: boolean().optional()
|
|
16126
|
-
}).optional(),
|
|
16127
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
16128
|
-
requires: array(string()).optional(),
|
|
16129
|
-
description: string().optional()
|
|
16426
|
+
var PressureAvgsSchema = object({
|
|
16427
|
+
avg10: number(),
|
|
16428
|
+
avg60: number(),
|
|
16429
|
+
avg300: number()
|
|
16130
16430
|
});
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
|
|
16140
|
-
|
|
16141
|
-
|
|
16431
|
+
var PressureInfoSchema = object({
|
|
16432
|
+
some: PressureAvgsSchema,
|
|
16433
|
+
full: PressureAvgsSchema.nullable()
|
|
16434
|
+
});
|
|
16435
|
+
var SystemResourceSnapshotSchema = object({
|
|
16436
|
+
cpu: CpuBreakdownSchema,
|
|
16437
|
+
memory: MemoryInfoSchema,
|
|
16438
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
16439
|
+
network: NetworkIoSnapshotSchema,
|
|
16440
|
+
disk: DiskIoSnapshotSchema,
|
|
16441
|
+
pressure: object({
|
|
16442
|
+
cpu: PressureInfoSchema.nullable(),
|
|
16443
|
+
memory: PressureInfoSchema.nullable(),
|
|
16444
|
+
io: PressureInfoSchema.nullable()
|
|
16142
16445
|
}),
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
format: array(NotificationFormatSchema),
|
|
16147
|
-
clickUrl: boolean(),
|
|
16148
|
-
sound: boolean(),
|
|
16149
|
-
ttl: boolean(),
|
|
16150
|
-
bodyMaxLen: number().int().positive()
|
|
16446
|
+
process: ProcessResourceInfoSchema,
|
|
16447
|
+
cpuTemperature: number().nullable(),
|
|
16448
|
+
timestampMs: number()
|
|
16151
16449
|
});
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16155
|
-
|
|
16156
|
-
|
|
16157
|
-
|
|
16158
|
-
*/
|
|
16159
|
-
var ConfigSchemaPassthrough = unknown();
|
|
16160
|
-
var TargetKindSchema = object({
|
|
16161
|
-
kind: string(),
|
|
16162
|
-
label: string(),
|
|
16163
|
-
icon: string(),
|
|
16164
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16165
|
-
addonId: string(),
|
|
16166
|
-
configSchema: ConfigSchemaPassthrough,
|
|
16167
|
-
supportsDiscovery: boolean(),
|
|
16168
|
-
caps: TargetKindCapsSchema
|
|
16450
|
+
var DiskSpaceInfoSchema = object({
|
|
16451
|
+
path: string(),
|
|
16452
|
+
totalBytes: number(),
|
|
16453
|
+
usedBytes: number(),
|
|
16454
|
+
availableBytes: number(),
|
|
16455
|
+
percent: number()
|
|
16169
16456
|
});
|
|
16170
|
-
|
|
16171
|
-
|
|
16172
|
-
|
|
16173
|
-
|
|
16174
|
-
|
|
16175
|
-
|
|
16176
|
-
|
|
16177
|
-
|
|
16178
|
-
|
|
16457
|
+
var PidResourceStatsSchema = object({
|
|
16458
|
+
pid: number(),
|
|
16459
|
+
cpu: number(),
|
|
16460
|
+
memory: number(),
|
|
16461
|
+
/**
|
|
16462
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
16463
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
16464
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
16465
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
16466
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
16467
|
+
*/
|
|
16468
|
+
privateBytes: number().optional(),
|
|
16469
|
+
/**
|
|
16470
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
16471
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
16472
|
+
*/
|
|
16473
|
+
sharedBytes: number().optional()
|
|
16474
|
+
});
|
|
16475
|
+
var AddonInstanceSchema = object({
|
|
16179
16476
|
addonId: string(),
|
|
16180
|
-
|
|
16181
|
-
|
|
16477
|
+
nodeId: string(),
|
|
16478
|
+
role: _enum(["hub", "worker"]),
|
|
16479
|
+
pid: number(),
|
|
16480
|
+
state: _enum([
|
|
16481
|
+
"starting",
|
|
16482
|
+
"running",
|
|
16483
|
+
"stopping",
|
|
16484
|
+
"stopped",
|
|
16485
|
+
"crashed"
|
|
16486
|
+
]),
|
|
16487
|
+
uptimeSec: number()
|
|
16182
16488
|
});
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
|
|
16489
|
+
var NodeProcessSchema = object({
|
|
16490
|
+
pid: number(),
|
|
16491
|
+
ppid: number(),
|
|
16492
|
+
pgid: number(),
|
|
16493
|
+
classification: _enum([
|
|
16494
|
+
"root",
|
|
16495
|
+
"managed",
|
|
16496
|
+
"system",
|
|
16497
|
+
"ghost"
|
|
16498
|
+
]),
|
|
16499
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
16500
|
+
addonId: string().nullable(),
|
|
16501
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
16502
|
+
nodeId: string().nullable(),
|
|
16503
|
+
/** Truncated command line. */
|
|
16504
|
+
command: string(),
|
|
16505
|
+
cpuPercent: number(),
|
|
16506
|
+
memoryRssBytes: number(),
|
|
16507
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
16508
|
+
uptimeSec: number(),
|
|
16509
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
16510
|
+
orphaned: boolean()
|
|
16188
16511
|
});
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
attachmentsSent: number().int().nonnegative(),
|
|
16194
|
-
actionsSent: number().int().nonnegative(),
|
|
16195
|
-
truncated: boolean(),
|
|
16196
|
-
dropped: array(string())
|
|
16512
|
+
var KillProcessInputSchema = object({
|
|
16513
|
+
pid: number(),
|
|
16514
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
16515
|
+
force: boolean().optional()
|
|
16197
16516
|
});
|
|
16198
|
-
var
|
|
16517
|
+
var KillProcessResultSchema = object({
|
|
16199
16518
|
success: boolean(),
|
|
16200
|
-
|
|
16201
|
-
|
|
16519
|
+
reason: string().optional(),
|
|
16520
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
16521
|
+
});
|
|
16522
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
16523
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
16524
|
+
addonId: string() });
|
|
16525
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
16526
|
+
success: boolean(),
|
|
16527
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
16528
|
+
path: string().optional(),
|
|
16529
|
+
/** Process pid that was signalled. */
|
|
16530
|
+
pid: number().optional(),
|
|
16531
|
+
reason: string().optional()
|
|
16532
|
+
});
|
|
16533
|
+
var SystemMetricsSchema = object({
|
|
16534
|
+
cpuPercent: number(),
|
|
16535
|
+
memoryPercent: number(),
|
|
16536
|
+
memoryUsedMB: number(),
|
|
16537
|
+
memoryTotalMB: number(),
|
|
16538
|
+
diskPercent: number().optional(),
|
|
16539
|
+
temperature: number().optional(),
|
|
16540
|
+
gpuPercent: number().optional(),
|
|
16541
|
+
gpuMemoryPercent: number().optional()
|
|
16542
|
+
});
|
|
16543
|
+
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, {
|
|
16544
|
+
kind: "mutation",
|
|
16545
|
+
auth: "admin"
|
|
16546
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
16547
|
+
kind: "mutation",
|
|
16548
|
+
auth: "admin"
|
|
16549
|
+
});
|
|
16550
|
+
method(object({
|
|
16551
|
+
sourceUrl: string(),
|
|
16552
|
+
metadata: ModelConvertMetadataSchema,
|
|
16553
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
16554
|
+
calibrationRef: string().optional(),
|
|
16555
|
+
sessionId: string().optional()
|
|
16556
|
+
}), ConvertResultSchema, {
|
|
16557
|
+
kind: "mutation",
|
|
16558
|
+
auth: "admin",
|
|
16559
|
+
timeoutMs: 6e5
|
|
16560
|
+
});
|
|
16561
|
+
method(object({
|
|
16562
|
+
nodeId: string(),
|
|
16563
|
+
modelId: string(),
|
|
16564
|
+
format: _enum(MODEL_FORMATS),
|
|
16565
|
+
entry: ModelCatalogEntrySchema
|
|
16566
|
+
}), object({
|
|
16567
|
+
ok: boolean(),
|
|
16568
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
16569
|
+
sha256: string(),
|
|
16570
|
+
bytes: number(),
|
|
16571
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
16572
|
+
path: string()
|
|
16573
|
+
}), {
|
|
16574
|
+
kind: "mutation",
|
|
16575
|
+
auth: "admin"
|
|
16202
16576
|
});
|
|
16203
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
16204
|
-
var TestResultSchema = SendResultSchema;
|
|
16205
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
16206
|
-
kind: string(),
|
|
16207
|
-
config: record(string(), unknown()).optional()
|
|
16208
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
16209
|
-
targetId: string(),
|
|
16210
|
-
notification: NotificationSchema
|
|
16211
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
16212
|
-
targetId: string(),
|
|
16213
|
-
sample: NotificationSchema.optional()
|
|
16214
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16215
|
-
targetId: string(),
|
|
16216
|
-
enabled: boolean()
|
|
16217
|
-
}), _void(), { kind: "mutation" });
|
|
16218
16577
|
/**
|
|
16219
|
-
*
|
|
16220
|
-
*
|
|
16221
|
-
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
16222
|
-
* (operator decisions D-1/D-2/D-3 are binding):
|
|
16578
|
+
* `mqtt-broker` — broker-registry cap.
|
|
16223
16579
|
*
|
|
16224
|
-
*
|
|
16225
|
-
*
|
|
16226
|
-
*
|
|
16227
|
-
*
|
|
16228
|
-
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
16229
|
-
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
16230
|
-
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
16231
|
-
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
16232
|
-
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
16233
|
-
* by id; per-backend params are a passthrough blob capped by the
|
|
16234
|
-
* target kind's own caps/degrade engine).
|
|
16580
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
16581
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
16582
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
16583
|
+
* its OWN `mqtt.js` client.
|
|
16235
16584
|
*
|
|
16236
|
-
*
|
|
16237
|
-
*
|
|
16238
|
-
*
|
|
16239
|
-
*
|
|
16240
|
-
*
|
|
16241
|
-
* private zones, per-recipient fan-out and the wider condition table are
|
|
16242
|
-
* P2+ (see spec §7).
|
|
16585
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
16586
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
16587
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
16588
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
16589
|
+
* features anyway — give it the connection config, get out of the way.
|
|
16243
16590
|
*
|
|
16244
|
-
*
|
|
16245
|
-
*
|
|
16246
|
-
*
|
|
16591
|
+
* Consumer flow:
|
|
16592
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
16593
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
16594
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
16595
|
+
*
|
|
16596
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
16597
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
16598
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
16599
|
+
* spawned it.
|
|
16247
16600
|
*/
|
|
16601
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
16248
16602
|
/**
|
|
16249
|
-
*
|
|
16250
|
-
* The value maps 1:1 onto the evaluated record kind:
|
|
16251
|
-
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
16252
|
-
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
16253
|
-
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
16254
|
-
* change of a LINKED device, one row per linked camera)
|
|
16255
|
-
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
16256
|
-
* delivery / pick-up)
|
|
16603
|
+
* Broker live-probe status.
|
|
16257
16604
|
*
|
|
16258
|
-
*
|
|
16259
|
-
*
|
|
16260
|
-
*
|
|
16261
|
-
*
|
|
16605
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
16606
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
16607
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
16608
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
16609
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16262
16610
|
*/
|
|
16263
|
-
var
|
|
16264
|
-
"
|
|
16265
|
-
"
|
|
16266
|
-
"
|
|
16267
|
-
"
|
|
16611
|
+
var BrokerStatusSchema$1 = _enum([
|
|
16612
|
+
"connected",
|
|
16613
|
+
"disconnected",
|
|
16614
|
+
"auth-failed",
|
|
16615
|
+
"unreachable",
|
|
16616
|
+
"tls-error"
|
|
16268
16617
|
]);
|
|
16269
|
-
|
|
16270
|
-
|
|
16271
|
-
|
|
16272
|
-
|
|
16273
|
-
|
|
16274
|
-
|
|
16275
|
-
|
|
16276
|
-
|
|
16277
|
-
/**
|
|
16278
|
-
|
|
16279
|
-
/**
|
|
16280
|
-
|
|
16281
|
-
});
|
|
16282
|
-
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
16283
|
-
var NcPlateMatcherSchema = object({
|
|
16284
|
-
values: array(string().min(1)).min(1),
|
|
16285
|
-
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
16286
|
-
maxDistance: number().int().min(0).max(3).default(1)
|
|
16287
|
-
});
|
|
16288
|
-
/**
|
|
16289
|
-
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
16290
|
-
* occupancy edge for a device — optionally narrowed to a single admin
|
|
16291
|
-
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
16292
|
-
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
16293
|
-
* - `became-free` — count crossed ≥ `count` → below it
|
|
16294
|
-
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
16295
|
-
* `sustainSeconds` requires the condition hold continuously that long
|
|
16296
|
-
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
16297
|
-
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
16298
|
-
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
16299
|
-
* (declared SQLite collection, reseeded on boot).
|
|
16300
|
-
*/
|
|
16301
|
-
var NcOccupancyConditionSchema = object({
|
|
16302
|
-
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
16303
|
-
zoneId: string().optional(),
|
|
16304
|
-
/** Object class to count; absent = any class. */
|
|
16305
|
-
className: string().optional(),
|
|
16306
|
-
op: _enum([
|
|
16307
|
-
"became-occupied",
|
|
16308
|
-
"became-free",
|
|
16309
|
-
">=",
|
|
16310
|
-
"<="
|
|
16311
|
-
]).default("became-occupied"),
|
|
16312
|
-
count: number().int().min(0).default(1),
|
|
16313
|
-
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
16314
|
-
});
|
|
16315
|
-
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
16316
|
-
var NcZoneConditionSchema = object({
|
|
16317
|
-
ids: array(string().min(1)).min(1),
|
|
16318
|
-
/** Quantifier over `ids` — at least one / every one visited. */
|
|
16319
|
-
match: _enum(["any", "all"]).default("any")
|
|
16320
|
-
});
|
|
16321
|
-
/**
|
|
16322
|
-
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
16323
|
-
* membership lists are OR within the list (spec §2.3).
|
|
16324
|
-
*/
|
|
16325
|
-
var NcConditionsSchema = object({
|
|
16326
|
-
/** Device scope — absent = all devices. */
|
|
16327
|
-
devices: array(number()).optional(),
|
|
16328
|
-
/** Detector class names (any overlap with the record's class set). */
|
|
16329
|
-
classes: array(string().min(1)).optional(),
|
|
16330
|
-
/** Veto classes — any overlap fails the rule. */
|
|
16331
|
-
classesExclude: array(string().min(1)).optional(),
|
|
16332
|
-
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
16333
|
-
minConfidence: number().min(0).max(1).optional(),
|
|
16334
|
-
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
16335
|
-
zones: NcZoneConditionSchema.optional(),
|
|
16336
|
-
/** Veto zones — any hit fails the rule. */
|
|
16337
|
-
zonesExclude: array(string().min(1)).optional(),
|
|
16338
|
-
/**
|
|
16339
|
-
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
16340
|
-
* (identity name / plate text / subclass).
|
|
16341
|
-
*/
|
|
16342
|
-
labelEquals: array(string().min(1)).optional(),
|
|
16343
|
-
/**
|
|
16344
|
-
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
16345
|
-
* `label` (the identity display name propagated by the face pipeline) —
|
|
16346
|
-
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
16347
|
-
*/
|
|
16348
|
-
identities: array(string().min(1)).optional(),
|
|
16349
|
-
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
16350
|
-
plates: NcPlateMatcherSchema.optional(),
|
|
16351
|
-
/**
|
|
16352
|
-
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
16353
|
-
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
16354
|
-
* identity display name). A record with NO label passes (nothing to
|
|
16355
|
-
* exclude), unlike the include variant which fails on an absent label.
|
|
16356
|
-
*/
|
|
16357
|
-
identitiesExclude: array(string().min(1)).optional(),
|
|
16358
|
-
/**
|
|
16359
|
-
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
16360
|
-
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
16361
|
-
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
16362
|
-
* close the value is threaded via the close-time info (the `Track` clone is
|
|
16363
|
-
* captured before the DB row is updated, so it would otherwise read stale).
|
|
16364
|
-
* Fails when the record carries no importance (never guess quality — the
|
|
16365
|
-
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
16366
|
-
*/
|
|
16367
|
-
minImportance: number().min(0).max(1).optional(),
|
|
16368
|
-
/**
|
|
16369
|
-
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
16370
|
-
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
16371
|
-
* lifespan, so a dwell condition never matches immediate delivery
|
|
16372
|
-
* (documented choice — the object-event record carries no `firstSeen`,
|
|
16373
|
-
* so dwell cannot be computed from what the subject actually carries).
|
|
16374
|
-
*/
|
|
16375
|
-
minDwellSeconds: number().min(0).optional(),
|
|
16376
|
-
/**
|
|
16377
|
-
* Detection provenance filter. `any` (default / absent) matches every
|
|
16378
|
-
* source; otherwise the subject's source must equal it. Legacy records
|
|
16379
|
-
* with no stamped source are treated as `pipeline`. The union spans both
|
|
16380
|
-
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
16381
|
-
* tracks carry `sensor`.
|
|
16382
|
-
*/
|
|
16383
|
-
source: _enum([
|
|
16384
|
-
"pipeline",
|
|
16385
|
-
"onboard",
|
|
16386
|
-
"sensor",
|
|
16387
|
-
"any"
|
|
16388
|
-
]).optional(),
|
|
16389
|
-
/**
|
|
16390
|
-
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
16391
|
-
* detector `minConfidence` (that gates the object-detection score; this
|
|
16392
|
-
* gates the recognition/OCR match score). Fails when the subject carries
|
|
16393
|
-
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
16394
|
-
* lives on the recognition result and reaches the subject at track close.
|
|
16395
|
-
*
|
|
16396
|
-
* What it measures precisely (plumbed at track close — the closer threads
|
|
16397
|
-
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
16398
|
-
* `importance`): the BEST recognition match confidence observed for the
|
|
16399
|
-
* label the track carries at close — for a face, the peak cosine similarity
|
|
16400
|
-
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
16401
|
-
* for a plate, the peak OCR read score of the best-held plate
|
|
16402
|
-
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
16403
|
-
* one track the higher of the two is used. A track that ended with no
|
|
16404
|
-
* confident identity/plate match carries no value, so the condition fails
|
|
16405
|
-
* closed for it (an un-recognized subject).
|
|
16406
|
-
*/
|
|
16407
|
-
minLabelConfidence: number().min(0).max(1).optional(),
|
|
16408
|
-
/**
|
|
16409
|
-
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
16410
|
-
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
16411
|
-
* against the token carried on the device-event subject (extracted from the
|
|
16412
|
-
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
16413
|
-
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
16414
|
-
* eventType, so gate those with {@link sensorKinds} instead.
|
|
16415
|
-
*/
|
|
16416
|
-
eventTypeTokens: array(string().min(1)).optional(),
|
|
16417
|
-
/**
|
|
16418
|
-
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
16419
|
-
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
16420
|
-
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
16421
|
-
*/
|
|
16422
|
-
sensorKinds: array(string().min(1)).optional(),
|
|
16423
|
-
/**
|
|
16424
|
-
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
16425
|
-
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
16426
|
-
* when the subject's phase does not match (a subject always carries a phase
|
|
16427
|
-
* on the package-event trigger).
|
|
16428
|
-
*/
|
|
16429
|
-
packagePhase: _enum([
|
|
16430
|
-
"delivered",
|
|
16431
|
-
"picked-up",
|
|
16432
|
-
"both"
|
|
16433
|
-
]).optional(),
|
|
16434
|
-
/**
|
|
16435
|
-
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
16436
|
-
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
16437
|
-
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
16438
|
-
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
16439
|
-
*/
|
|
16440
|
-
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
16441
|
-
/**
|
|
16442
|
-
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
16443
|
-
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
16444
|
-
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
16445
|
-
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
16446
|
-
*/
|
|
16447
|
-
occupancy: NcOccupancyConditionSchema.optional()
|
|
16448
|
-
});
|
|
16449
|
-
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
16450
|
-
var NcRuleTargetSchema = object({
|
|
16451
|
-
/** `notification-output` Target id. */
|
|
16452
|
-
targetId: string().min(1),
|
|
16453
|
-
/**
|
|
16454
|
-
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
16455
|
-
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
16456
|
-
* degrade engine drops what the backend can't render.
|
|
16457
|
-
*/
|
|
16458
|
-
params: record(string(), unknown()).optional()
|
|
16618
|
+
var BrokerInfoSchema = object({
|
|
16619
|
+
id: string(),
|
|
16620
|
+
name: string(),
|
|
16621
|
+
url: string(),
|
|
16622
|
+
kind: BrokerKindSchema,
|
|
16623
|
+
status: BrokerStatusSchema$1,
|
|
16624
|
+
latencyMs: number().nullable(),
|
|
16625
|
+
error: string().optional(),
|
|
16626
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
16627
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
16628
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
16629
|
+
lastCheckedAt: number().optional()
|
|
16459
16630
|
});
|
|
16460
16631
|
/**
|
|
16461
|
-
*
|
|
16462
|
-
*
|
|
16463
|
-
*
|
|
16464
|
-
*
|
|
16465
|
-
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
16466
|
-
* (or when the specific crop is missing) degrades to `best`, then
|
|
16467
|
-
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
16468
|
-
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
16469
|
-
* name), so the choice never drifts from the record that fired it.
|
|
16470
|
-
* - `keyFrame` — the clean scene frame (no subject box).
|
|
16471
|
-
* - `none` — no attachment.
|
|
16632
|
+
* Connection details — what a consumer needs to call
|
|
16633
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
16634
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
16635
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
16472
16636
|
*/
|
|
16473
|
-
var
|
|
16474
|
-
|
|
16475
|
-
|
|
16476
|
-
|
|
16477
|
-
"none"
|
|
16478
|
-
]).default("best") });
|
|
16479
|
-
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
16480
|
-
var NcThrottleSchema = object({
|
|
16481
|
-
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
16482
|
-
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
16483
|
-
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
16484
|
-
});
|
|
16485
|
-
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
16486
|
-
var NcRuleInputSchema = object({
|
|
16487
|
-
name: string().min(1).max(200),
|
|
16488
|
-
enabled: boolean().default(true),
|
|
16489
|
-
delivery: NcDeliverySchema,
|
|
16490
|
-
conditions: NcConditionsSchema.default({}),
|
|
16491
|
-
schedule: NcScheduleSchema.optional(),
|
|
16492
|
-
targets: array(NcRuleTargetSchema).min(1),
|
|
16493
|
-
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
16494
|
-
throttle: NcThrottleSchema.default({
|
|
16495
|
-
cooldownSec: 60,
|
|
16496
|
-
scope: "rule-device"
|
|
16497
|
-
}),
|
|
16498
|
-
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
16499
|
-
template: object({
|
|
16500
|
-
title: string().max(500).optional(),
|
|
16501
|
-
body: string().max(2e3).optional()
|
|
16502
|
-
}).optional(),
|
|
16503
|
-
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
16504
|
-
priority: number().int().min(1).max(5).default(3),
|
|
16637
|
+
var BrokerConnectionDetailsSchema = object({
|
|
16638
|
+
url: string(),
|
|
16639
|
+
username: string().optional(),
|
|
16640
|
+
password: string().optional(),
|
|
16505
16641
|
/**
|
|
16506
|
-
*
|
|
16507
|
-
*
|
|
16508
|
-
*
|
|
16642
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
16643
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
16644
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
16645
|
+
* broker).
|
|
16509
16646
|
*/
|
|
16510
|
-
|
|
16647
|
+
clientIdPrefix: string().optional()
|
|
16648
|
+
});
|
|
16649
|
+
var AddBrokerInputSchema = object({
|
|
16650
|
+
name: string().min(1),
|
|
16651
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
16652
|
+
username: string().optional(),
|
|
16653
|
+
password: string().optional(),
|
|
16654
|
+
clientIdPrefix: string().optional()
|
|
16655
|
+
});
|
|
16656
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
16657
|
+
var IdInputSchema = object({ id: string() });
|
|
16658
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
16659
|
+
ok: literal(true),
|
|
16660
|
+
latencyMs: number()
|
|
16661
|
+
}), object({
|
|
16662
|
+
ok: literal(false),
|
|
16663
|
+
error: string()
|
|
16664
|
+
})]);
|
|
16665
|
+
var StartEmbeddedInputSchema = object({
|
|
16666
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
16667
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
16668
|
+
allowAnonymous: boolean().default(false),
|
|
16669
|
+
/** Optional shared username/password for clients. */
|
|
16670
|
+
username: string().optional(),
|
|
16671
|
+
password: string().optional()
|
|
16672
|
+
});
|
|
16673
|
+
var StartEmbeddedResultSchema = object({
|
|
16674
|
+
id: string(),
|
|
16675
|
+
url: string()
|
|
16676
|
+
});
|
|
16677
|
+
var StatusSchema = object({
|
|
16678
|
+
brokerCount: number(),
|
|
16679
|
+
embeddedRunning: boolean()
|
|
16680
|
+
});
|
|
16681
|
+
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);
|
|
16682
|
+
var NetworkEndpointSchema = object({
|
|
16683
|
+
url: string(),
|
|
16684
|
+
hostname: string(),
|
|
16685
|
+
port: number(),
|
|
16686
|
+
protocol: _enum(["http", "https"])
|
|
16687
|
+
});
|
|
16688
|
+
var NetworkAccessStatusSchema = object({
|
|
16689
|
+
connected: boolean(),
|
|
16690
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
16691
|
+
error: string().optional()
|
|
16511
16692
|
});
|
|
16512
16693
|
/**
|
|
16513
|
-
*
|
|
16514
|
-
*
|
|
16515
|
-
*
|
|
16516
|
-
*
|
|
16517
|
-
*
|
|
16518
|
-
*
|
|
16519
|
-
* `updateRule` patch.
|
|
16694
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
16695
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
16696
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
16697
|
+
* the originating provider config (mode + sourcePort) so the
|
|
16698
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
16699
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
16520
16700
|
*/
|
|
16521
|
-
var
|
|
16522
|
-
/** A persisted rule. */
|
|
16523
|
-
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
16524
|
-
id: string(),
|
|
16525
|
-
/** userId of the admin who created the rule (server-stamped caller). */
|
|
16526
|
-
createdBy: string(),
|
|
16527
|
-
createdAt: number(),
|
|
16528
|
-
updatedAt: number(),
|
|
16701
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
16529
16702
|
/**
|
|
16530
|
-
*
|
|
16531
|
-
*
|
|
16532
|
-
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
16703
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
16704
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
16533
16705
|
*/
|
|
16534
|
-
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
|
|
16539
|
-
|
|
16540
|
-
|
|
16541
|
-
"device-event",
|
|
16542
|
-
"package-event"
|
|
16543
|
-
]),
|
|
16544
|
-
deviceId: number(),
|
|
16545
|
-
timestamp: number(),
|
|
16546
|
-
wouldFire: boolean(),
|
|
16547
|
-
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
16548
|
-
failedCondition: string().optional(),
|
|
16549
|
-
className: string().optional(),
|
|
16550
|
-
label: string().optional()
|
|
16706
|
+
id: string(),
|
|
16707
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
16708
|
+
label: string(),
|
|
16709
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
16710
|
+
mode: string().optional(),
|
|
16711
|
+
/** Originating local port the ingress fronts (informational). */
|
|
16712
|
+
sourcePort: number().optional()
|
|
16551
16713
|
});
|
|
16552
|
-
|
|
16553
|
-
|
|
16714
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
16715
|
+
/**
|
|
16716
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
16717
|
+
*
|
|
16718
|
+
* Apprise-derived model (see
|
|
16719
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
16720
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
16721
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16722
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
16723
|
+
* message to what the kind supports — callers never special-case a service.
|
|
16724
|
+
*
|
|
16725
|
+
* DESIGN DECISIONS (locked):
|
|
16726
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
16727
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
16728
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
16729
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
16730
|
+
* alternative would fork the UI per addon and cannot host the
|
|
16731
|
+
* discovery→adopt flow.
|
|
16732
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
16733
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
16734
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
16735
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
16736
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
16737
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
16738
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
16739
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
16740
|
+
* base64 fallback needed.
|
|
16741
|
+
*
|
|
16742
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
16743
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
16744
|
+
* admin "Integrations" page.
|
|
16745
|
+
*/
|
|
16746
|
+
/**
|
|
16747
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
16748
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
16749
|
+
*/
|
|
16750
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
16751
|
+
"image",
|
|
16752
|
+
"video",
|
|
16753
|
+
"gif",
|
|
16754
|
+
"audio",
|
|
16755
|
+
"icon"
|
|
16756
|
+
]);
|
|
16757
|
+
/**
|
|
16758
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
16759
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
16760
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
16761
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
16762
|
+
*/
|
|
16763
|
+
var AttachmentSchema = object({
|
|
16764
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
16765
|
+
url: string().optional(),
|
|
16766
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
16767
|
+
mime: string().optional(),
|
|
16768
|
+
name: string().optional()
|
|
16769
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
16770
|
+
var NotificationFormatSchema = _enum([
|
|
16771
|
+
"text",
|
|
16772
|
+
"markdown",
|
|
16773
|
+
"html"
|
|
16774
|
+
]);
|
|
16775
|
+
/** A single tap-through action button. */
|
|
16776
|
+
var NotificationActionSchema = object({
|
|
16777
|
+
id: string(),
|
|
16778
|
+
label: string(),
|
|
16779
|
+
url: string().optional()
|
|
16780
|
+
});
|
|
16781
|
+
/**
|
|
16782
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
16783
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
16784
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
16785
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
16786
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
16787
|
+
* `priority` for that one target.
|
|
16788
|
+
*/
|
|
16789
|
+
var NotificationSchema = object({
|
|
16790
|
+
body: string(),
|
|
16791
|
+
title: string().optional(),
|
|
16792
|
+
format: NotificationFormatSchema.default("text"),
|
|
16793
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16794
|
+
level: string().optional(),
|
|
16795
|
+
attachments: array(AttachmentSchema).optional(),
|
|
16796
|
+
clickUrl: string().optional(),
|
|
16797
|
+
actions: array(NotificationActionSchema).optional(),
|
|
16798
|
+
sound: string().optional(),
|
|
16799
|
+
ttl: number().optional(),
|
|
16800
|
+
tag: string().optional(),
|
|
16801
|
+
deviceId: number().optional(),
|
|
16802
|
+
eventId: string().optional(),
|
|
16803
|
+
metadata: record(string(), unknown()).optional()
|
|
16804
|
+
});
|
|
16805
|
+
/** One declared native severity/priority level for a kind. */
|
|
16806
|
+
var TargetKindLevelSchema = object({
|
|
16554
16807
|
id: string(),
|
|
16555
|
-
group: _enum([
|
|
16556
|
-
"scope",
|
|
16557
|
-
"class",
|
|
16558
|
-
"zones",
|
|
16559
|
-
"quality",
|
|
16560
|
-
"label",
|
|
16561
|
-
"schedule",
|
|
16562
|
-
"device",
|
|
16563
|
-
"package",
|
|
16564
|
-
"occupancy"
|
|
16565
|
-
]),
|
|
16566
16808
|
label: string(),
|
|
16567
|
-
/**
|
|
16568
|
-
|
|
16569
|
-
|
|
16570
|
-
|
|
16571
|
-
|
|
16572
|
-
|
|
16573
|
-
|
|
16574
|
-
|
|
16575
|
-
|
|
16576
|
-
"schedule",
|
|
16577
|
-
"plateMatcher",
|
|
16578
|
-
"packagePhase",
|
|
16579
|
-
"polygonDraw",
|
|
16580
|
-
"occupancy"
|
|
16581
|
-
]),
|
|
16582
|
-
operator: _enum([
|
|
16583
|
-
"in",
|
|
16584
|
-
"notIn",
|
|
16585
|
-
"anyOf",
|
|
16586
|
-
"allOf",
|
|
16587
|
-
"gte",
|
|
16588
|
-
"fuzzyIn",
|
|
16589
|
-
"withinSchedule"
|
|
16590
|
-
]),
|
|
16591
|
-
/** Which delivery kinds the condition applies to. */
|
|
16592
|
-
appliesTo: array(NcDeliverySchema),
|
|
16593
|
-
phase: string(),
|
|
16809
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
16810
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
16811
|
+
flags: object({
|
|
16812
|
+
critical: boolean().optional(),
|
|
16813
|
+
silent: boolean().optional(),
|
|
16814
|
+
noPush: boolean().optional()
|
|
16815
|
+
}).optional(),
|
|
16816
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
16817
|
+
requires: array(string()).optional(),
|
|
16594
16818
|
description: string().optional()
|
|
16595
16819
|
});
|
|
16820
|
+
/** The full capability block consulted before dispatch. */
|
|
16821
|
+
var TargetKindCapsSchema = object({
|
|
16822
|
+
attachments: object({
|
|
16823
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
16824
|
+
mode: _enum([
|
|
16825
|
+
"url",
|
|
16826
|
+
"bytes",
|
|
16827
|
+
"both"
|
|
16828
|
+
]),
|
|
16829
|
+
max: number().int().nonnegative(),
|
|
16830
|
+
maxBytes: number().int().positive().optional()
|
|
16831
|
+
}),
|
|
16832
|
+
/** Max action buttons (0 = none). */
|
|
16833
|
+
actions: number().int().nonnegative(),
|
|
16834
|
+
levels: array(TargetKindLevelSchema),
|
|
16835
|
+
format: array(NotificationFormatSchema),
|
|
16836
|
+
clickUrl: boolean(),
|
|
16837
|
+
sound: boolean(),
|
|
16838
|
+
ttl: boolean(),
|
|
16839
|
+
bodyMaxLen: number().int().positive()
|
|
16840
|
+
});
|
|
16596
16841
|
/**
|
|
16597
|
-
*
|
|
16598
|
-
*
|
|
16599
|
-
*
|
|
16600
|
-
*
|
|
16601
|
-
*
|
|
16602
|
-
* backend rejection / a deleted target (terminal; carries
|
|
16603
|
-
* the failure `error`)
|
|
16604
|
-
*
|
|
16605
|
-
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
16606
|
-
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
16842
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
16843
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
16844
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
16845
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
16846
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
16607
16847
|
*/
|
|
16608
|
-
var
|
|
16609
|
-
|
|
16610
|
-
|
|
16611
|
-
|
|
16612
|
-
|
|
16613
|
-
/**
|
|
16614
|
-
|
|
16615
|
-
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
"package-event"
|
|
16619
|
-
]);
|
|
16620
|
-
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
16621
|
-
var NcHistorySubjectSchema = object({
|
|
16622
|
-
className: string(),
|
|
16623
|
-
label: string().optional(),
|
|
16624
|
-
confidence: number().optional(),
|
|
16625
|
-
zones: array(string()),
|
|
16626
|
-
timestamp: number()
|
|
16848
|
+
var ConfigSchemaPassthrough = unknown();
|
|
16849
|
+
var TargetKindSchema = object({
|
|
16850
|
+
kind: string(),
|
|
16851
|
+
label: string(),
|
|
16852
|
+
icon: string(),
|
|
16853
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16854
|
+
addonId: string(),
|
|
16855
|
+
configSchema: ConfigSchemaPassthrough,
|
|
16856
|
+
supportsDiscovery: boolean(),
|
|
16857
|
+
caps: TargetKindCapsSchema
|
|
16627
16858
|
});
|
|
16628
16859
|
/**
|
|
16629
|
-
*
|
|
16630
|
-
*
|
|
16631
|
-
*
|
|
16632
|
-
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
16633
|
-
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
16634
|
-
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
16635
|
-
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
16636
|
-
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
16637
|
-
* P1 (admin scope only).
|
|
16860
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
16861
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
16862
|
+
* round-trip a stored secret to the UI.
|
|
16638
16863
|
*/
|
|
16639
|
-
var
|
|
16640
|
-
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
16864
|
+
var TargetSchema = object({
|
|
16641
16865
|
id: string(),
|
|
16642
|
-
|
|
16643
|
-
|
|
16644
|
-
|
|
16645
|
-
|
|
16646
|
-
|
|
16647
|
-
targetId: string(),
|
|
16648
|
-
deviceId: number(),
|
|
16649
|
-
recordKind: NcHistoryRecordKindSchema,
|
|
16650
|
-
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
16651
|
-
recordId: string(),
|
|
16652
|
-
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
16653
|
-
trackId: string().optional(),
|
|
16654
|
-
status: NcHistoryStatusSchema,
|
|
16655
|
-
/** Delivery attempts made so far. */
|
|
16656
|
-
attempts: number().int(),
|
|
16657
|
-
/** Fire time (outbox enqueue). */
|
|
16658
|
-
createdAt: number(),
|
|
16659
|
-
/** Last transition time (terminal for sent / dead). */
|
|
16660
|
-
updatedAt: number(),
|
|
16661
|
-
/** Failure detail — present on a `dead` row. */
|
|
16662
|
-
error: string().optional(),
|
|
16663
|
-
subject: NcHistorySubjectSchema
|
|
16866
|
+
name: string(),
|
|
16867
|
+
kind: string(),
|
|
16868
|
+
addonId: string(),
|
|
16869
|
+
enabled: boolean(),
|
|
16870
|
+
config: record(string(), unknown())
|
|
16664
16871
|
});
|
|
16665
|
-
/**
|
|
16666
|
-
|
|
16667
|
-
|
|
16668
|
-
|
|
16669
|
-
|
|
16670
|
-
*/
|
|
16671
|
-
var NcHistoryFilterSchema = object({
|
|
16672
|
-
ruleId: string().optional(),
|
|
16673
|
-
deviceId: number().optional(),
|
|
16674
|
-
status: NcHistoryStatusSchema.optional(),
|
|
16675
|
-
since: number().optional(),
|
|
16676
|
-
until: number().optional(),
|
|
16677
|
-
limit: number().int().min(1).max(500).default(100)
|
|
16872
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
16873
|
+
var DiscoveredTargetSchema = object({
|
|
16874
|
+
kind: string(),
|
|
16875
|
+
suggestedName: string(),
|
|
16876
|
+
config: record(string(), unknown())
|
|
16678
16877
|
});
|
|
16679
|
-
|
|
16680
|
-
|
|
16681
|
-
|
|
16682
|
-
|
|
16683
|
-
|
|
16684
|
-
|
|
16685
|
-
|
|
16686
|
-
|
|
16687
|
-
|
|
16688
|
-
|
|
16689
|
-
|
|
16690
|
-
|
|
16691
|
-
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
|
|
16878
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
16879
|
+
var RenderedAsSchema = object({
|
|
16880
|
+
level: string(),
|
|
16881
|
+
format: NotificationFormatSchema,
|
|
16882
|
+
attachmentsSent: number().int().nonnegative(),
|
|
16883
|
+
actionsSent: number().int().nonnegative(),
|
|
16884
|
+
truncated: boolean(),
|
|
16885
|
+
dropped: array(string())
|
|
16886
|
+
});
|
|
16887
|
+
var SendResultSchema = object({
|
|
16888
|
+
success: boolean(),
|
|
16889
|
+
error: string().optional(),
|
|
16890
|
+
renderedAs: RenderedAsSchema.optional()
|
|
16891
|
+
});
|
|
16892
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
16893
|
+
var TestResultSchema = SendResultSchema;
|
|
16894
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
16895
|
+
kind: string(),
|
|
16896
|
+
config: record(string(), unknown()).optional()
|
|
16897
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
16898
|
+
targetId: string(),
|
|
16899
|
+
notification: NotificationSchema
|
|
16900
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
16901
|
+
targetId: string(),
|
|
16902
|
+
sample: NotificationSchema.optional()
|
|
16903
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16904
|
+
targetId: string(),
|
|
16695
16905
|
enabled: boolean()
|
|
16696
|
-
}),
|
|
16697
|
-
kind: "mutation",
|
|
16698
|
-
auth: "admin"
|
|
16699
|
-
}), method(object({
|
|
16700
|
-
rule: NcRuleInputSchema,
|
|
16701
|
-
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
16702
|
-
}), object({ results: array(NcTestResultSchema) }), {
|
|
16703
|
-
kind: "mutation",
|
|
16704
|
-
auth: "admin"
|
|
16705
|
-
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
16906
|
+
}), _void(), { kind: "mutation" });
|
|
16706
16907
|
/**
|
|
16707
16908
|
* Zod schemas for persisted record types.
|
|
16708
16909
|
*
|
|
@@ -21724,6 +21925,12 @@ Object.freeze({
|
|
|
21724
21925
|
addonId: null,
|
|
21725
21926
|
access: "delete"
|
|
21726
21927
|
},
|
|
21928
|
+
"backup.deleteSchedule": {
|
|
21929
|
+
capName: "backup",
|
|
21930
|
+
capScope: "system",
|
|
21931
|
+
addonId: null,
|
|
21932
|
+
access: "delete"
|
|
21933
|
+
},
|
|
21727
21934
|
"backup.getEntries": {
|
|
21728
21935
|
capName: "backup",
|
|
21729
21936
|
capScope: "system",
|
|
@@ -21754,6 +21961,12 @@ Object.freeze({
|
|
|
21754
21961
|
addonId: null,
|
|
21755
21962
|
access: "view"
|
|
21756
21963
|
},
|
|
21964
|
+
"backup.listSchedules": {
|
|
21965
|
+
capName: "backup",
|
|
21966
|
+
capScope: "system",
|
|
21967
|
+
addonId: null,
|
|
21968
|
+
access: "view"
|
|
21969
|
+
},
|
|
21757
21970
|
"backup.previewSchedule": {
|
|
21758
21971
|
capName: "backup",
|
|
21759
21972
|
capScope: "system",
|
|
@@ -21778,6 +21991,12 @@ Object.freeze({
|
|
|
21778
21991
|
addonId: null,
|
|
21779
21992
|
access: "create"
|
|
21780
21993
|
},
|
|
21994
|
+
"backup.upsertSchedule": {
|
|
21995
|
+
capName: "backup",
|
|
21996
|
+
capScope: "system",
|
|
21997
|
+
addonId: null,
|
|
21998
|
+
access: "create"
|
|
21999
|
+
},
|
|
21781
22000
|
"battery.wakeForStream": {
|
|
21782
22001
|
capName: "battery",
|
|
21783
22002
|
capScope: "device",
|
|
@@ -25612,6 +25831,36 @@ Object.freeze({
|
|
|
25612
25831
|
addonId: null,
|
|
25613
25832
|
access: "create"
|
|
25614
25833
|
},
|
|
25834
|
+
"terminalSession.close": {
|
|
25835
|
+
capName: "terminal-session",
|
|
25836
|
+
capScope: "system",
|
|
25837
|
+
addonId: null,
|
|
25838
|
+
access: "create"
|
|
25839
|
+
},
|
|
25840
|
+
"terminalSession.listProfiles": {
|
|
25841
|
+
capName: "terminal-session",
|
|
25842
|
+
capScope: "system",
|
|
25843
|
+
addonId: null,
|
|
25844
|
+
access: "view"
|
|
25845
|
+
},
|
|
25846
|
+
"terminalSession.listSessions": {
|
|
25847
|
+
capName: "terminal-session",
|
|
25848
|
+
capScope: "system",
|
|
25849
|
+
addonId: null,
|
|
25850
|
+
access: "view"
|
|
25851
|
+
},
|
|
25852
|
+
"terminalSession.openSession": {
|
|
25853
|
+
capName: "terminal-session",
|
|
25854
|
+
capScope: "system",
|
|
25855
|
+
addonId: null,
|
|
25856
|
+
access: "create"
|
|
25857
|
+
},
|
|
25858
|
+
"terminalSession.resize": {
|
|
25859
|
+
capName: "terminal-session",
|
|
25860
|
+
capScope: "system",
|
|
25861
|
+
addonId: null,
|
|
25862
|
+
access: "create"
|
|
25863
|
+
},
|
|
25615
25864
|
"toast.onToast": {
|
|
25616
25865
|
capName: "toast",
|
|
25617
25866
|
capScope: "system",
|