@camstack/addon-export-alexa 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/export-alexa.addon.js +1881 -1632
- package/dist/export-alexa.addon.mjs +1881 -1632
- package/package.json +1 -1
|
@@ -7643,16 +7643,23 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7643
7643
|
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7644
7644
|
* FRESH install:
|
|
7645
7645
|
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7646
|
-
* the appData volume. Right for small/durable data (
|
|
7646
|
+
* the appData volume. Right for small/durable data (logs, models).
|
|
7647
7647
|
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7648
7648
|
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7649
7649
|
* (recordings, event media) that should stay off the appData disk.
|
|
7650
|
+
* - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
|
|
7651
|
+
* `/backups` in the image) so archives live on their own mount rather than
|
|
7652
|
+
* filling the appData disk. Falls back to the data root when unset.
|
|
7650
7653
|
*
|
|
7651
7654
|
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7652
7655
|
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7653
7656
|
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7654
7657
|
*/
|
|
7655
|
-
defaultRoot: _enum([
|
|
7658
|
+
defaultRoot: _enum([
|
|
7659
|
+
"data",
|
|
7660
|
+
"media",
|
|
7661
|
+
"backup"
|
|
7662
|
+
]).optional()
|
|
7656
7663
|
});
|
|
7657
7664
|
var DecoderStatsSchema = object({
|
|
7658
7665
|
inputFps: number(),
|
|
@@ -9057,92 +9064,730 @@ var AccessoryKind = {
|
|
|
9057
9064
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
9058
9065
|
DeviceFeature.BatteryOperated;
|
|
9059
9066
|
/**
|
|
9060
|
-
*
|
|
9061
|
-
*
|
|
9062
|
-
*
|
|
9063
|
-
*
|
|
9064
|
-
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
9065
|
-
* their own slices.
|
|
9067
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
9068
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
9069
|
+
* language so a single drawing-plane editor and the providers stay
|
|
9070
|
+
* decoupled from each cap's storage.
|
|
9066
9071
|
*
|
|
9067
|
-
*
|
|
9068
|
-
*
|
|
9069
|
-
* `
|
|
9070
|
-
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
9071
|
-
* consumers reach the same data via the `device-state` cap router
|
|
9072
|
-
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
9072
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
9073
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
9074
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
9073
9075
|
*/
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
|
|
9078
|
-
* stream-health, Reolink reads firmware push events, ONVIF tracks
|
|
9079
|
-
* ping responses. This cap intentionally does NOT prescribe which
|
|
9080
|
-
* signal drives the flag.
|
|
9081
|
-
*/
|
|
9082
|
-
online: boolean(),
|
|
9083
|
-
/** Ms epoch of the last `online` transition. Lets consumers tell
|
|
9084
|
-
* apart "just came online" from "still online". */
|
|
9085
|
-
lastChangedAt: number()
|
|
9076
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
9077
|
+
var MaskPointSchema = object({
|
|
9078
|
+
x: number(),
|
|
9079
|
+
y: number()
|
|
9086
9080
|
});
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9081
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
9082
|
+
var MaskRectShapeSchema = object({
|
|
9083
|
+
kind: literal("rect"),
|
|
9084
|
+
x: number(),
|
|
9085
|
+
y: number(),
|
|
9086
|
+
width: number(),
|
|
9087
|
+
height: number()
|
|
9088
|
+
});
|
|
9089
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
9090
|
+
var MaskPolygonShapeSchema = object({
|
|
9091
|
+
kind: literal("polygon"),
|
|
9092
|
+
points: array(MaskPointSchema)
|
|
9093
|
+
});
|
|
9094
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
9095
|
+
var MaskGridShapeSchema = object({
|
|
9096
|
+
kind: literal("grid"),
|
|
9097
|
+
gridWidth: number(),
|
|
9098
|
+
gridHeight: number(),
|
|
9099
|
+
cells: array(boolean())
|
|
9100
|
+
});
|
|
9101
|
+
discriminatedUnion("kind", [
|
|
9102
|
+
MaskRectShapeSchema,
|
|
9103
|
+
MaskPolygonShapeSchema,
|
|
9104
|
+
MaskGridShapeSchema,
|
|
9105
|
+
object({
|
|
9106
|
+
kind: literal("line"),
|
|
9107
|
+
points: array(MaskPointSchema)
|
|
9108
|
+
})
|
|
9109
|
+
]);
|
|
9110
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
9111
|
+
var MaskShapeKindSchema = _enum([
|
|
9112
|
+
"rect",
|
|
9113
|
+
"polygon",
|
|
9114
|
+
"grid",
|
|
9115
|
+
"line"
|
|
9116
|
+
]);
|
|
9117
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
9118
|
+
var MaskPolygonVerticesSchema = object({
|
|
9119
|
+
min: number(),
|
|
9120
|
+
max: number()
|
|
9121
|
+
});
|
|
9122
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
9123
|
+
var MaskGridDimsSchema = object({
|
|
9124
|
+
width: number(),
|
|
9125
|
+
height: number()
|
|
9090
9126
|
});
|
|
9091
9127
|
/**
|
|
9092
|
-
*
|
|
9093
|
-
* truth about what a device CAN do — which the kernel uses to:
|
|
9094
|
-
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
9095
|
-
* based on what the firmware actually advertises).
|
|
9096
|
-
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
9097
|
-
* `device-manager.listAll`.
|
|
9098
|
-
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
9099
|
-
* to register on the device's capability surface.
|
|
9128
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
9100
9129
|
*
|
|
9101
|
-
*
|
|
9102
|
-
*
|
|
9103
|
-
* accessory reconciliation). Consumers read via:
|
|
9104
|
-
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
9130
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
9131
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
9105
9132
|
*
|
|
9106
|
-
*
|
|
9107
|
-
*
|
|
9108
|
-
*
|
|
9133
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
9134
|
+
* `notification-center` module), hooked on the durable persistence
|
|
9135
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
9136
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
9137
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
9138
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
9139
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
9140
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
9141
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
9142
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
9143
|
+
* target kind's own caps/degrade engine).
|
|
9109
9144
|
*
|
|
9110
|
-
*
|
|
9111
|
-
*
|
|
9112
|
-
*
|
|
9113
|
-
*
|
|
9145
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
9146
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
9147
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
9148
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
9149
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
9150
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
9151
|
+
* P2+ (see spec §7).
|
|
9152
|
+
*
|
|
9153
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
9154
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
9155
|
+
* schema/interface drift is explicitly not repeated).
|
|
9114
9156
|
*/
|
|
9115
|
-
|
|
9157
|
+
/**
|
|
9158
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
9159
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
9160
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
9161
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
9162
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
9163
|
+
* change of a LINKED device, one row per linked camera)
|
|
9164
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
9165
|
+
* delivery / pick-up)
|
|
9166
|
+
*
|
|
9167
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
9168
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
9169
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
9170
|
+
* one trigger.
|
|
9171
|
+
*/
|
|
9172
|
+
var NcDeliverySchema = _enum([
|
|
9173
|
+
"immediate",
|
|
9174
|
+
"track-end",
|
|
9175
|
+
"device-event",
|
|
9176
|
+
"package-event"
|
|
9177
|
+
]);
|
|
9178
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
9179
|
+
var NcScheduleSchema = object({
|
|
9180
|
+
windows: array(object({
|
|
9181
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
9182
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
9183
|
+
startMinute: number().int().min(0).max(1439),
|
|
9184
|
+
endMinute: number().int().min(0).max(1439)
|
|
9185
|
+
})).min(1),
|
|
9186
|
+
/** IANA timezone; default = hub host timezone. */
|
|
9187
|
+
timezone: string().optional(),
|
|
9188
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
9189
|
+
invert: boolean().optional()
|
|
9190
|
+
});
|
|
9191
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
9192
|
+
var NcPlateMatcherSchema = object({
|
|
9193
|
+
values: array(string().min(1)).min(1),
|
|
9194
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9195
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9196
|
+
});
|
|
9197
|
+
/**
|
|
9198
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9199
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9200
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9201
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9202
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9203
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9204
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9205
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9206
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9207
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9208
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9209
|
+
*/
|
|
9210
|
+
var NcOccupancyConditionSchema = object({
|
|
9211
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9212
|
+
zoneId: string().optional(),
|
|
9213
|
+
/** Object class to count; absent = any class. */
|
|
9214
|
+
className: string().optional(),
|
|
9215
|
+
op: _enum([
|
|
9216
|
+
"became-occupied",
|
|
9217
|
+
"became-free",
|
|
9218
|
+
">=",
|
|
9219
|
+
"<="
|
|
9220
|
+
]).default("became-occupied"),
|
|
9221
|
+
count: number().int().min(0).default(1),
|
|
9222
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9223
|
+
});
|
|
9224
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9225
|
+
var NcZoneConditionSchema = object({
|
|
9226
|
+
ids: array(string().min(1)).min(1),
|
|
9227
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9228
|
+
match: _enum(["any", "all"]).default("any")
|
|
9229
|
+
});
|
|
9230
|
+
/**
|
|
9231
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9232
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9233
|
+
*/
|
|
9234
|
+
var NcConditionsSchema = object({
|
|
9235
|
+
/** Device scope — absent = all devices. */
|
|
9236
|
+
devices: array(number()).optional(),
|
|
9237
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9238
|
+
classes: array(string().min(1)).optional(),
|
|
9239
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9240
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9241
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9242
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9243
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9244
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9245
|
+
/** Veto zones — any hit fails the rule. */
|
|
9246
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
9116
9247
|
/**
|
|
9117
|
-
*
|
|
9118
|
-
*
|
|
9119
|
-
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
9120
|
-
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
9121
|
-
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9248
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9249
|
+
* (identity name / plate text / subclass).
|
|
9122
9250
|
*/
|
|
9123
|
-
|
|
9251
|
+
labelEquals: array(string().min(1)).optional(),
|
|
9124
9252
|
/**
|
|
9125
|
-
*
|
|
9126
|
-
*
|
|
9127
|
-
*
|
|
9253
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9254
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9255
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
9128
9256
|
*/
|
|
9129
|
-
|
|
9130
|
-
/**
|
|
9131
|
-
|
|
9132
|
-
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
9133
|
-
channelCount: number().nullable(),
|
|
9257
|
+
identities: array(string().min(1)).optional(),
|
|
9258
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9259
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
9134
9260
|
/**
|
|
9135
|
-
*
|
|
9136
|
-
*
|
|
9137
|
-
*
|
|
9138
|
-
*
|
|
9261
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9262
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9263
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9264
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
9139
9265
|
*/
|
|
9140
|
-
|
|
9266
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
9141
9267
|
/**
|
|
9142
|
-
*
|
|
9143
|
-
*
|
|
9144
|
-
*
|
|
9145
|
-
|
|
9268
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9269
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9270
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9271
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9272
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9273
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9274
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9275
|
+
*/
|
|
9276
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9277
|
+
/**
|
|
9278
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9279
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9280
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9281
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9282
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9283
|
+
*/
|
|
9284
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9285
|
+
/**
|
|
9286
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9287
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9288
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9289
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9290
|
+
* tracks carry `sensor`.
|
|
9291
|
+
*/
|
|
9292
|
+
source: _enum([
|
|
9293
|
+
"pipeline",
|
|
9294
|
+
"onboard",
|
|
9295
|
+
"sensor",
|
|
9296
|
+
"any"
|
|
9297
|
+
]).optional(),
|
|
9298
|
+
/**
|
|
9299
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9300
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9301
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9302
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9303
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9304
|
+
*
|
|
9305
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9306
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9307
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9308
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9309
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9310
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9311
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9312
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9313
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9314
|
+
* closed for it (an un-recognized subject).
|
|
9315
|
+
*/
|
|
9316
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9317
|
+
/**
|
|
9318
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9319
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9320
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9321
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9322
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9323
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9324
|
+
*/
|
|
9325
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9326
|
+
/**
|
|
9327
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9328
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9329
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9330
|
+
*/
|
|
9331
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9332
|
+
/**
|
|
9333
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9334
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9335
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9336
|
+
* on the package-event trigger).
|
|
9337
|
+
*/
|
|
9338
|
+
packagePhase: _enum([
|
|
9339
|
+
"delivered",
|
|
9340
|
+
"picked-up",
|
|
9341
|
+
"both"
|
|
9342
|
+
]).optional(),
|
|
9343
|
+
/**
|
|
9344
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9345
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9346
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9347
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9348
|
+
*/
|
|
9349
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9350
|
+
/**
|
|
9351
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9352
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9353
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9354
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9355
|
+
*/
|
|
9356
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9357
|
+
});
|
|
9358
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9359
|
+
var NcRuleTargetSchema = object({
|
|
9360
|
+
/** `notification-output` Target id. */
|
|
9361
|
+
targetId: string().min(1),
|
|
9362
|
+
/**
|
|
9363
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9364
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9365
|
+
* degrade engine drops what the backend can't render.
|
|
9366
|
+
*/
|
|
9367
|
+
params: record(string(), unknown()).optional()
|
|
9368
|
+
});
|
|
9369
|
+
/**
|
|
9370
|
+
* Media attachment policy (P1 still-image subset).
|
|
9371
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9372
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9373
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9374
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9375
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9376
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9377
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9378
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9379
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9380
|
+
* - `none` — no attachment.
|
|
9381
|
+
*/
|
|
9382
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9383
|
+
"best",
|
|
9384
|
+
"best-matching",
|
|
9385
|
+
"keyFrame",
|
|
9386
|
+
"none"
|
|
9387
|
+
]).default("best") });
|
|
9388
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9389
|
+
var NcThrottleSchema = object({
|
|
9390
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9391
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9392
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9393
|
+
});
|
|
9394
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9395
|
+
var NcRuleInputSchema = object({
|
|
9396
|
+
name: string().min(1).max(200),
|
|
9397
|
+
enabled: boolean().default(true),
|
|
9398
|
+
delivery: NcDeliverySchema,
|
|
9399
|
+
conditions: NcConditionsSchema.default({}),
|
|
9400
|
+
schedule: NcScheduleSchema.optional(),
|
|
9401
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9402
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9403
|
+
throttle: NcThrottleSchema.default({
|
|
9404
|
+
cooldownSec: 60,
|
|
9405
|
+
scope: "rule-device"
|
|
9406
|
+
}),
|
|
9407
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9408
|
+
template: object({
|
|
9409
|
+
title: string().max(500).optional(),
|
|
9410
|
+
body: string().max(2e3).optional()
|
|
9411
|
+
}).optional(),
|
|
9412
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9413
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9414
|
+
/**
|
|
9415
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9416
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9417
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9418
|
+
*/
|
|
9419
|
+
ownerUserId: string().optional()
|
|
9420
|
+
});
|
|
9421
|
+
/**
|
|
9422
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9423
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9424
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9425
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9426
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9427
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9428
|
+
* `updateRule` patch.
|
|
9429
|
+
*/
|
|
9430
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9431
|
+
/** A persisted rule. */
|
|
9432
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9433
|
+
id: string(),
|
|
9434
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9435
|
+
createdBy: string(),
|
|
9436
|
+
createdAt: number(),
|
|
9437
|
+
updatedAt: number(),
|
|
9438
|
+
/**
|
|
9439
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9440
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9441
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9442
|
+
*/
|
|
9443
|
+
disabledTargetIds: array(string()).default([])
|
|
9444
|
+
});
|
|
9445
|
+
var NcTestResultSchema = object({
|
|
9446
|
+
recordId: string(),
|
|
9447
|
+
recordKind: _enum([
|
|
9448
|
+
"object-event",
|
|
9449
|
+
"track",
|
|
9450
|
+
"device-event",
|
|
9451
|
+
"package-event"
|
|
9452
|
+
]),
|
|
9453
|
+
deviceId: number(),
|
|
9454
|
+
timestamp: number(),
|
|
9455
|
+
wouldFire: boolean(),
|
|
9456
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9457
|
+
failedCondition: string().optional(),
|
|
9458
|
+
className: string().optional(),
|
|
9459
|
+
label: string().optional()
|
|
9460
|
+
});
|
|
9461
|
+
var NcConditionDescriptorSchema = object({
|
|
9462
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9463
|
+
id: string(),
|
|
9464
|
+
group: _enum([
|
|
9465
|
+
"scope",
|
|
9466
|
+
"class",
|
|
9467
|
+
"zones",
|
|
9468
|
+
"quality",
|
|
9469
|
+
"label",
|
|
9470
|
+
"schedule",
|
|
9471
|
+
"device",
|
|
9472
|
+
"package",
|
|
9473
|
+
"occupancy"
|
|
9474
|
+
]),
|
|
9475
|
+
label: string(),
|
|
9476
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9477
|
+
valueType: _enum([
|
|
9478
|
+
"deviceIdList",
|
|
9479
|
+
"stringList",
|
|
9480
|
+
"number01",
|
|
9481
|
+
"number",
|
|
9482
|
+
"sourceSelect",
|
|
9483
|
+
"zoneSelection",
|
|
9484
|
+
"zoneIdList",
|
|
9485
|
+
"schedule",
|
|
9486
|
+
"plateMatcher",
|
|
9487
|
+
"packagePhase",
|
|
9488
|
+
"polygonDraw",
|
|
9489
|
+
"occupancy"
|
|
9490
|
+
]),
|
|
9491
|
+
operator: _enum([
|
|
9492
|
+
"in",
|
|
9493
|
+
"notIn",
|
|
9494
|
+
"anyOf",
|
|
9495
|
+
"allOf",
|
|
9496
|
+
"gte",
|
|
9497
|
+
"fuzzyIn",
|
|
9498
|
+
"withinSchedule"
|
|
9499
|
+
]),
|
|
9500
|
+
/** Which delivery kinds the condition applies to. */
|
|
9501
|
+
appliesTo: array(NcDeliverySchema),
|
|
9502
|
+
phase: string(),
|
|
9503
|
+
description: string().optional()
|
|
9504
|
+
});
|
|
9505
|
+
/**
|
|
9506
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9507
|
+
* durable outbox row's own status (single source of truth):
|
|
9508
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9509
|
+
* - `sent` — delivered (terminal)
|
|
9510
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9511
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9512
|
+
* the failure `error`)
|
|
9513
|
+
*
|
|
9514
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9515
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9516
|
+
*/
|
|
9517
|
+
var NcHistoryStatusSchema = _enum([
|
|
9518
|
+
"pending",
|
|
9519
|
+
"sent",
|
|
9520
|
+
"dead"
|
|
9521
|
+
]);
|
|
9522
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9523
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9524
|
+
"object-event",
|
|
9525
|
+
"track-end",
|
|
9526
|
+
"device-event",
|
|
9527
|
+
"package-event"
|
|
9528
|
+
]);
|
|
9529
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9530
|
+
var NcHistorySubjectSchema = object({
|
|
9531
|
+
className: string(),
|
|
9532
|
+
label: string().optional(),
|
|
9533
|
+
confidence: number().optional(),
|
|
9534
|
+
zones: array(string()),
|
|
9535
|
+
timestamp: number()
|
|
9536
|
+
});
|
|
9537
|
+
/**
|
|
9538
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9539
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9540
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9541
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9542
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9543
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9544
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9545
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9546
|
+
* P1 (admin scope only).
|
|
9547
|
+
*/
|
|
9548
|
+
var NcHistoryEntrySchema = object({
|
|
9549
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9550
|
+
id: string(),
|
|
9551
|
+
ruleId: string(),
|
|
9552
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9553
|
+
ruleName: string(),
|
|
9554
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9555
|
+
delivery: NcDeliverySchema,
|
|
9556
|
+
targetId: string(),
|
|
9557
|
+
deviceId: number(),
|
|
9558
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9559
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9560
|
+
recordId: string(),
|
|
9561
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9562
|
+
trackId: string().optional(),
|
|
9563
|
+
status: NcHistoryStatusSchema,
|
|
9564
|
+
/** Delivery attempts made so far. */
|
|
9565
|
+
attempts: number().int(),
|
|
9566
|
+
/** Fire time (outbox enqueue). */
|
|
9567
|
+
createdAt: number(),
|
|
9568
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9569
|
+
updatedAt: number(),
|
|
9570
|
+
/** Failure detail — present on a `dead` row. */
|
|
9571
|
+
error: string().optional(),
|
|
9572
|
+
subject: NcHistorySubjectSchema
|
|
9573
|
+
});
|
|
9574
|
+
/**
|
|
9575
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9576
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9577
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9578
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9579
|
+
*/
|
|
9580
|
+
var NcHistoryFilterSchema = object({
|
|
9581
|
+
ruleId: string().optional(),
|
|
9582
|
+
deviceId: number().optional(),
|
|
9583
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9584
|
+
since: number().optional(),
|
|
9585
|
+
until: number().optional(),
|
|
9586
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9587
|
+
});
|
|
9588
|
+
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 }), {
|
|
9589
|
+
kind: "mutation",
|
|
9590
|
+
auth: "admin",
|
|
9591
|
+
caller: "required"
|
|
9592
|
+
}), method(object({
|
|
9593
|
+
ruleId: string(),
|
|
9594
|
+
patch: NcRulePatchSchema
|
|
9595
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9596
|
+
kind: "mutation",
|
|
9597
|
+
auth: "admin",
|
|
9598
|
+
caller: "required"
|
|
9599
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9600
|
+
kind: "mutation",
|
|
9601
|
+
auth: "admin"
|
|
9602
|
+
}), method(object({
|
|
9603
|
+
ruleId: string(),
|
|
9604
|
+
enabled: boolean()
|
|
9605
|
+
}), object({ success: literal(true) }), {
|
|
9606
|
+
kind: "mutation",
|
|
9607
|
+
auth: "admin"
|
|
9608
|
+
}), method(object({
|
|
9609
|
+
rule: NcRuleInputSchema,
|
|
9610
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9611
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9612
|
+
kind: "mutation",
|
|
9613
|
+
auth: "admin"
|
|
9614
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9615
|
+
/**
|
|
9616
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9617
|
+
*
|
|
9618
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
9619
|
+
* §3.2/§3.3.
|
|
9620
|
+
*
|
|
9621
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
9622
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
9623
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
9624
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
9625
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
9626
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
9627
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
9628
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
9629
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
9630
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
9631
|
+
*
|
|
9632
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
9633
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
9634
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
9635
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
9636
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
9637
|
+
*/
|
|
9638
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
9639
|
+
var TimelapseTemplateSchema = object({
|
|
9640
|
+
title: string().max(500).optional(),
|
|
9641
|
+
body: string().max(2e3).optional()
|
|
9642
|
+
});
|
|
9643
|
+
var NameField = string().min(1).max(200);
|
|
9644
|
+
var DeviceIdsField = array(number()).min(1);
|
|
9645
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
9646
|
+
var FramerateField = number().int().min(1).max(60);
|
|
9647
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
9648
|
+
var PriorityField = number().int().min(1).max(5);
|
|
9649
|
+
/**
|
|
9650
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
9651
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
9652
|
+
* here (see the ownership note above).
|
|
9653
|
+
*/
|
|
9654
|
+
var TimelapseRuleInputSchema = object({
|
|
9655
|
+
name: NameField,
|
|
9656
|
+
enabled: boolean().default(true),
|
|
9657
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
9658
|
+
deviceIds: DeviceIdsField,
|
|
9659
|
+
/**
|
|
9660
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
9661
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
9662
|
+
* open clears the scratch, close assembles and delivers.
|
|
9663
|
+
*/
|
|
9664
|
+
schedule: NcScheduleSchema,
|
|
9665
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
9666
|
+
cadenceSec: CadenceSecField.default(15),
|
|
9667
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
9668
|
+
framerate: FramerateField.default(10),
|
|
9669
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
9670
|
+
targets: TargetsField,
|
|
9671
|
+
template: TimelapseTemplateSchema.optional(),
|
|
9672
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9673
|
+
priority: PriorityField.default(3)
|
|
9674
|
+
});
|
|
9675
|
+
object({
|
|
9676
|
+
name: NameField.optional(),
|
|
9677
|
+
enabled: boolean().optional(),
|
|
9678
|
+
deviceIds: DeviceIdsField.optional(),
|
|
9679
|
+
schedule: NcScheduleSchema.optional(),
|
|
9680
|
+
cadenceSec: CadenceSecField.optional(),
|
|
9681
|
+
framerate: FramerateField.optional(),
|
|
9682
|
+
targets: TargetsField.optional(),
|
|
9683
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
9684
|
+
priority: PriorityField.optional()
|
|
9685
|
+
});
|
|
9686
|
+
TimelapseRuleInputSchema.extend({
|
|
9687
|
+
id: string(),
|
|
9688
|
+
/**
|
|
9689
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
9690
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
9691
|
+
* resolved caller; never trusted from a client payload.
|
|
9692
|
+
*/
|
|
9693
|
+
ownerUserId: string().optional(),
|
|
9694
|
+
/**
|
|
9695
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
9696
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
9697
|
+
*/
|
|
9698
|
+
lastGeneratedAt: number().optional(),
|
|
9699
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
9700
|
+
createdBy: string(),
|
|
9701
|
+
createdAt: number(),
|
|
9702
|
+
updatedAt: number()
|
|
9703
|
+
});
|
|
9704
|
+
/**
|
|
9705
|
+
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
9706
|
+
* for every device, regardless of provider — the kernel needs a uniform
|
|
9707
|
+
* cap-keyed slice for the basic device flags every consumer expects to
|
|
9708
|
+
* read across processes (the `online` flag in particular). Driver-specific
|
|
9709
|
+
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
9710
|
+
* their own slices.
|
|
9711
|
+
*
|
|
9712
|
+
* Pattern is identical to `battery`: schema-bearing `runtimeState`,
|
|
9713
|
+
* empty `methods`, single change event. Reads land at
|
|
9714
|
+
* `runtimeState.getCapState('device-status')`; writes at
|
|
9715
|
+
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
9716
|
+
* consumers reach the same data via the `device-state` cap router
|
|
9717
|
+
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
9718
|
+
*/
|
|
9719
|
+
var DeviceStatusSchema = object({
|
|
9720
|
+
/**
|
|
9721
|
+
* Device-level liveness. Drivers flip via `markOnline(boolean)` on
|
|
9722
|
+
* `BaseDevice`. Provider semantics vary — RTSP aggregates broker
|
|
9723
|
+
* stream-health, Reolink reads firmware push events, ONVIF tracks
|
|
9724
|
+
* ping responses. This cap intentionally does NOT prescribe which
|
|
9725
|
+
* signal drives the flag.
|
|
9726
|
+
*/
|
|
9727
|
+
online: boolean(),
|
|
9728
|
+
/** Ms epoch of the last `online` transition. Lets consumers tell
|
|
9729
|
+
* apart "just came online" from "still online". */
|
|
9730
|
+
lastChangedAt: number()
|
|
9731
|
+
});
|
|
9732
|
+
object({
|
|
9733
|
+
deviceId: number(),
|
|
9734
|
+
status: DeviceStatusSchema
|
|
9735
|
+
});
|
|
9736
|
+
/**
|
|
9737
|
+
* Per-device feature/identity probe slice. Holds the runtime-resolved
|
|
9738
|
+
* truth about what a device CAN do — which the kernel uses to:
|
|
9739
|
+
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
9740
|
+
* based on what the firmware actually advertises).
|
|
9741
|
+
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
9742
|
+
* `device-manager.listAll`.
|
|
9743
|
+
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
9744
|
+
* to register on the device's capability surface.
|
|
9745
|
+
*
|
|
9746
|
+
* Auto-registered by `BaseDevice` for every device. Drivers populate the
|
|
9747
|
+
* slice from `onProbe()` (kernel calls it once after register, before
|
|
9748
|
+
* accessory reconciliation). Consumers read via:
|
|
9749
|
+
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
9750
|
+
*
|
|
9751
|
+
* `flags` is an open record so each driver carries its own keys without
|
|
9752
|
+
* a centralized schema bottleneck — Reolink writes `hasPtz/hasIntercom`,
|
|
9753
|
+
* Hikvision writes `hasSupplementalLight/hasAlarmIo`, etc.
|
|
9754
|
+
*
|
|
9755
|
+
* Replaces the older driver-local `deviceCache.has*` blob: the per-device
|
|
9756
|
+
* config is for operator-edited overrides + UI snapshots; runtime probe
|
|
9757
|
+
* results belong in runtime-state where the kernel handles persistence,
|
|
9758
|
+
* cross-process mirroring, and reactive updates.
|
|
9759
|
+
*/
|
|
9760
|
+
var FeatureProbeStatusSchema = object({
|
|
9761
|
+
/**
|
|
9762
|
+
* Driver-specific flag bag. Each driver picks its own key names — the
|
|
9763
|
+
* cap deliberately does NOT enforce a closed enum here. Reolink keys:
|
|
9764
|
+
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
9765
|
+
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
9766
|
+
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9767
|
+
*/
|
|
9768
|
+
flags: record(string(), unknown()),
|
|
9769
|
+
/**
|
|
9770
|
+
* Coarse driver-classification — lets cross-process consumers tell apart
|
|
9771
|
+
* cameras / battery-cams / NVRs without re-running the probe. `null`
|
|
9772
|
+
* before the first probe completes.
|
|
9773
|
+
*/
|
|
9774
|
+
deviceType: string().nullable(),
|
|
9775
|
+
/** Camera/firmware model string. `null` when the firmware doesn't expose it. */
|
|
9776
|
+
model: string().nullable(),
|
|
9777
|
+
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
9778
|
+
channelCount: number().nullable(),
|
|
9779
|
+
/**
|
|
9780
|
+
* Ms epoch of the last SUCCESSFUL probe. `0` before the first probe
|
|
9781
|
+
* completes — drivers' `getAccessoryChildren()` should treat zero as
|
|
9782
|
+
* "probe not done yet, return empty" so accessories aren't spawned
|
|
9783
|
+
* before the firmware is queried.
|
|
9784
|
+
*/
|
|
9785
|
+
lastProbedAt: number(),
|
|
9786
|
+
/**
|
|
9787
|
+
* Framework convention: every runtime-state slice carries this for the
|
|
9788
|
+
* createRuntimeStateBridge stale-check helper. We keep it in sync with
|
|
9789
|
+
* `lastProbedAt` on every write.
|
|
9790
|
+
*/
|
|
9146
9791
|
lastFetchedAt: number()
|
|
9147
9792
|
});
|
|
9148
9793
|
object({
|
|
@@ -12000,101 +12645,40 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
12000
12645
|
}), object({ details: array(DetailResultSchema) }).nullable(), { kind: "mutation" });
|
|
12001
12646
|
object({
|
|
12002
12647
|
detected: boolean(),
|
|
12003
|
-
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
12004
|
-
lastDetectedAt: number().nullable(),
|
|
12005
|
-
/**
|
|
12006
|
-
* Ms after which `detected` auto-reverts to false if no fresh push
|
|
12007
|
-
* arrives. Null means the provider leaves detected state until a
|
|
12008
|
-
* native "clear" event.
|
|
12009
|
-
*/
|
|
12010
|
-
autoClearAfterMs: number().nullable()
|
|
12011
|
-
});
|
|
12012
|
-
object({
|
|
12013
|
-
deviceId: number(),
|
|
12014
|
-
detected: boolean(),
|
|
12015
|
-
timestamp: number(),
|
|
12016
|
-
source: MotionSourceEnum,
|
|
12017
|
-
regions: array(MotionRegionSchema).readonly().optional()
|
|
12018
|
-
});
|
|
12019
|
-
DeviceType.Camera, DeviceType.Sensor, method(object({ deviceId: number() }), boolean());
|
|
12020
|
-
object({
|
|
12021
|
-
enabled: boolean(),
|
|
12022
|
-
/** Ms epoch of the last operator-driven change. */
|
|
12023
|
-
lastChangedAt: number()
|
|
12024
|
-
}).extend({
|
|
12025
|
-
/** Ms epoch of the last successful camera fetch (0 = never). */
|
|
12026
|
-
lastFetchedAt: number() });
|
|
12027
|
-
DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
12028
|
-
deviceId: number().int().nonnegative(),
|
|
12029
|
-
enabled: boolean()
|
|
12030
|
-
}), _void(), {
|
|
12031
|
-
kind: "mutation",
|
|
12032
|
-
auth: "admin"
|
|
12033
|
-
}), object({
|
|
12034
|
-
deviceId: number(),
|
|
12035
|
-
enabled: boolean(),
|
|
12036
|
-
lastChangedAt: number()
|
|
12037
|
-
});
|
|
12038
|
-
/**
|
|
12039
|
-
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
12040
|
-
* motion-zones, and the detection zones/lines editor all speak this one
|
|
12041
|
-
* language so a single drawing-plane editor and the providers stay
|
|
12042
|
-
* decoupled from each cap's storage.
|
|
12043
|
-
*
|
|
12044
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
12045
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
12046
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
12047
|
-
*/
|
|
12048
|
-
/** A normalized 0..1 point (top-left origin). */
|
|
12049
|
-
var MaskPointSchema = object({
|
|
12050
|
-
x: number(),
|
|
12051
|
-
y: number()
|
|
12052
|
-
});
|
|
12053
|
-
/** Axis-aligned rectangle (normalized 0..1). */
|
|
12054
|
-
var MaskRectShapeSchema = object({
|
|
12055
|
-
kind: literal("rect"),
|
|
12056
|
-
x: number(),
|
|
12057
|
-
y: number(),
|
|
12058
|
-
width: number(),
|
|
12059
|
-
height: number()
|
|
12060
|
-
});
|
|
12061
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
12062
|
-
var MaskPolygonShapeSchema = object({
|
|
12063
|
-
kind: literal("polygon"),
|
|
12064
|
-
points: array(MaskPointSchema)
|
|
12065
|
-
});
|
|
12066
|
-
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
12067
|
-
var MaskGridShapeSchema = object({
|
|
12068
|
-
kind: literal("grid"),
|
|
12069
|
-
gridWidth: number(),
|
|
12070
|
-
gridHeight: number(),
|
|
12071
|
-
cells: array(boolean())
|
|
12072
|
-
});
|
|
12073
|
-
discriminatedUnion("kind", [
|
|
12074
|
-
MaskRectShapeSchema,
|
|
12075
|
-
MaskPolygonShapeSchema,
|
|
12076
|
-
MaskGridShapeSchema,
|
|
12077
|
-
object({
|
|
12078
|
-
kind: literal("line"),
|
|
12079
|
-
points: array(MaskPointSchema)
|
|
12080
|
-
})
|
|
12081
|
-
]);
|
|
12082
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
12083
|
-
var MaskShapeKindSchema = _enum([
|
|
12084
|
-
"rect",
|
|
12085
|
-
"polygon",
|
|
12086
|
-
"grid",
|
|
12087
|
-
"line"
|
|
12088
|
-
]);
|
|
12089
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
12090
|
-
var MaskPolygonVerticesSchema = object({
|
|
12091
|
-
min: number(),
|
|
12092
|
-
max: number()
|
|
12648
|
+
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
12649
|
+
lastDetectedAt: number().nullable(),
|
|
12650
|
+
/**
|
|
12651
|
+
* Ms after which `detected` auto-reverts to false if no fresh push
|
|
12652
|
+
* arrives. Null means the provider leaves detected state until a
|
|
12653
|
+
* native "clear" event.
|
|
12654
|
+
*/
|
|
12655
|
+
autoClearAfterMs: number().nullable()
|
|
12093
12656
|
});
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12657
|
+
object({
|
|
12658
|
+
deviceId: number(),
|
|
12659
|
+
detected: boolean(),
|
|
12660
|
+
timestamp: number(),
|
|
12661
|
+
source: MotionSourceEnum,
|
|
12662
|
+
regions: array(MotionRegionSchema).readonly().optional()
|
|
12663
|
+
});
|
|
12664
|
+
DeviceType.Camera, DeviceType.Sensor, method(object({ deviceId: number() }), boolean());
|
|
12665
|
+
object({
|
|
12666
|
+
enabled: boolean(),
|
|
12667
|
+
/** Ms epoch of the last operator-driven change. */
|
|
12668
|
+
lastChangedAt: number()
|
|
12669
|
+
}).extend({
|
|
12670
|
+
/** Ms epoch of the last successful camera fetch (0 = never). */
|
|
12671
|
+
lastFetchedAt: number() });
|
|
12672
|
+
DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
12673
|
+
deviceId: number().int().nonnegative(),
|
|
12674
|
+
enabled: boolean()
|
|
12675
|
+
}), _void(), {
|
|
12676
|
+
kind: "mutation",
|
|
12677
|
+
auth: "admin"
|
|
12678
|
+
}), object({
|
|
12679
|
+
deviceId: number(),
|
|
12680
|
+
enabled: boolean(),
|
|
12681
|
+
lastChangedAt: number()
|
|
12098
12682
|
});
|
|
12099
12683
|
/**
|
|
12100
12684
|
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
@@ -13984,6 +14568,55 @@ method(object({
|
|
|
13984
14568
|
password: string()
|
|
13985
14569
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
13986
14570
|
/**
|
|
14571
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
14572
|
+
* NOT flow through the capability — they use the addon data plane
|
|
14573
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
14574
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
14575
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
14576
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
14577
|
+
*/
|
|
14578
|
+
var TerminalSessionInfoSchema = object({
|
|
14579
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
14580
|
+
sessionId: string(),
|
|
14581
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
14582
|
+
profileId: string(),
|
|
14583
|
+
/** Human-readable profile label for the UI session list. */
|
|
14584
|
+
label: string(),
|
|
14585
|
+
cols: number().int().positive(),
|
|
14586
|
+
rows: number().int().positive(),
|
|
14587
|
+
/** ms-epoch the session's pty was spawned. */
|
|
14588
|
+
startedAt: number()
|
|
14589
|
+
});
|
|
14590
|
+
/**
|
|
14591
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
14592
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
14593
|
+
* command string would be remote code execution as the server's user, so it is
|
|
14594
|
+
* deliberately not part of the contract.
|
|
14595
|
+
*/
|
|
14596
|
+
var TerminalProfileInfoSchema = object({
|
|
14597
|
+
profileId: string(),
|
|
14598
|
+
label: string(),
|
|
14599
|
+
description: string().optional()
|
|
14600
|
+
});
|
|
14601
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
14602
|
+
profileId: string(),
|
|
14603
|
+
cols: number().int().positive(),
|
|
14604
|
+
rows: number().int().positive()
|
|
14605
|
+
}), TerminalSessionInfoSchema, {
|
|
14606
|
+
kind: "mutation",
|
|
14607
|
+
auth: "admin"
|
|
14608
|
+
}), method(object({
|
|
14609
|
+
sessionId: string(),
|
|
14610
|
+
cols: number().int().positive(),
|
|
14611
|
+
rows: number().int().positive()
|
|
14612
|
+
}), _void(), {
|
|
14613
|
+
kind: "mutation",
|
|
14614
|
+
auth: "admin"
|
|
14615
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
14616
|
+
kind: "mutation",
|
|
14617
|
+
auth: "admin"
|
|
14618
|
+
});
|
|
14619
|
+
/**
|
|
13987
14620
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
13988
14621
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
13989
14622
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -14084,11 +14717,53 @@ var LocationStatSchema = object({
|
|
|
14084
14717
|
fileCount: number(),
|
|
14085
14718
|
present: boolean()
|
|
14086
14719
|
});
|
|
14720
|
+
/**
|
|
14721
|
+
* A backup schedule — the N:M "entry" that binds one cron cadence to a
|
|
14722
|
+
* SET of destination locations. Supersedes the per-location cron on
|
|
14723
|
+
* `BackupDestinationPolicy`: an operator creates a schedule, picks the
|
|
14724
|
+
* `backups` locations it should write to, and the orchestrator fans a
|
|
14725
|
+
* single archive out to all of them when the cron fires.
|
|
14726
|
+
*
|
|
14727
|
+
* `retentionCount` is per-schedule (D-decision 2026-07-28): every
|
|
14728
|
+
* location targeted by this schedule keeps this many archives from
|
|
14729
|
+
* this schedule's runs.
|
|
14730
|
+
*
|
|
14731
|
+
* `dataSources` optionally narrows which top-level state locations
|
|
14732
|
+
* (db, addons, tls, …) are archived; omitted = the orchestrator's
|
|
14733
|
+
* default full set.
|
|
14734
|
+
*/
|
|
14735
|
+
var BackupScheduleSchema = object({
|
|
14736
|
+
/** Stable id. Generated by the orchestrator on first upsert if absent. */
|
|
14737
|
+
id: string(),
|
|
14738
|
+
/** Operator-facing display name. */
|
|
14739
|
+
label: string(),
|
|
14740
|
+
/** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
|
|
14741
|
+
cron: string(),
|
|
14742
|
+
/** Master on/off toggle for the whole schedule. */
|
|
14743
|
+
enabled: boolean(),
|
|
14744
|
+
/** `backups`-location ids this schedule writes to (fan-out set). */
|
|
14745
|
+
locationIds: array(string()).readonly(),
|
|
14746
|
+
/** Archives kept per targeted location for this schedule. */
|
|
14747
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14748
|
+
/** Optional subset of source locations to include; omitted = all. */
|
|
14749
|
+
dataSources: array(string()).readonly().optional(),
|
|
14750
|
+
/** ms-epoch of last successful run. */
|
|
14751
|
+
lastRunAt: number().optional(),
|
|
14752
|
+
/** ms-epoch of next computed firing (read-only, filled on list). */
|
|
14753
|
+
nextRunAt: number().optional()
|
|
14754
|
+
});
|
|
14087
14755
|
method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
14088
14756
|
/** Subset of registered `backup-destination` addon ids to write to. */
|
|
14089
14757
|
destinations: array(string()).optional(),
|
|
14090
14758
|
locations: array(string()).optional(),
|
|
14091
|
-
label: string().optional()
|
|
14759
|
+
label: string().optional(),
|
|
14760
|
+
/**
|
|
14761
|
+
* Per-run retention override applied to every targeted
|
|
14762
|
+
* destination. Used by schedule-driven runs (per-entry
|
|
14763
|
+
* retention). Omitted = each destination's own policy
|
|
14764
|
+
* retention (manual runs).
|
|
14765
|
+
*/
|
|
14766
|
+
retentionCount: number().int().min(1).max(1e3).optional()
|
|
14092
14767
|
}).optional(), array(BackupEntrySchema).readonly(), {
|
|
14093
14768
|
kind: "mutation",
|
|
14094
14769
|
auth: "admin"
|
|
@@ -14137,7 +14812,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
14137
14812
|
ok: boolean(),
|
|
14138
14813
|
error: string().optional(),
|
|
14139
14814
|
nextRuns: array(number()).readonly()
|
|
14140
|
-
}))
|
|
14815
|
+
})), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
|
|
14816
|
+
id: string().optional(),
|
|
14817
|
+
label: string(),
|
|
14818
|
+
cron: string(),
|
|
14819
|
+
enabled: boolean(),
|
|
14820
|
+
locationIds: array(string()).readonly(),
|
|
14821
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14822
|
+
dataSources: array(string()).readonly().optional()
|
|
14823
|
+
}), BackupScheduleSchema, {
|
|
14824
|
+
kind: "mutation",
|
|
14825
|
+
auth: "admin"
|
|
14826
|
+
}), method(object({ id: string() }), _void(), {
|
|
14827
|
+
kind: "mutation",
|
|
14828
|
+
auth: "admin"
|
|
14829
|
+
});
|
|
14141
14830
|
/**
|
|
14142
14831
|
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
14143
14832
|
*
|
|
@@ -15200,1596 +15889,1108 @@ method(object({
|
|
|
15200
15889
|
active: boolean()
|
|
15201
15890
|
}), _void(), {
|
|
15202
15891
|
kind: "mutation",
|
|
15203
|
-
auth: "admin"
|
|
15204
|
-
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
15205
|
-
capName: string(),
|
|
15206
|
-
wrappers: array(string())
|
|
15207
|
-
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
15208
|
-
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
15209
|
-
live: SettingsSchemaWithValuesSchema.nullable()
|
|
15210
|
-
})), method(object({
|
|
15211
|
-
deviceId: number().int().nonnegative(),
|
|
15212
|
-
action: string().min(1),
|
|
15213
|
-
input: unknown()
|
|
15214
|
-
}), unknown(), { kind: "mutation" }), method(object({
|
|
15215
|
-
deviceId: number(),
|
|
15216
|
-
writerCapName: string(),
|
|
15217
|
-
writerAddonId: string(),
|
|
15218
|
-
key: string(),
|
|
15219
|
-
value: unknown()
|
|
15220
|
-
}), object({ success: literal(true) }), {
|
|
15221
|
-
kind: "mutation",
|
|
15222
|
-
auth: "admin"
|
|
15223
|
-
}), method(object({
|
|
15224
|
-
deviceId: number(),
|
|
15225
|
-
changes: array(object({
|
|
15226
|
-
writerCapName: string(),
|
|
15227
|
-
writerAddonId: string(),
|
|
15228
|
-
key: string(),
|
|
15229
|
-
value: unknown()
|
|
15230
|
-
}))
|
|
15231
|
-
}), object({
|
|
15232
|
-
success: literal(true),
|
|
15233
|
-
failures: array(object({
|
|
15234
|
-
writerCapName: string(),
|
|
15235
|
-
writerAddonId: string(),
|
|
15236
|
-
error: string()
|
|
15237
|
-
}))
|
|
15238
|
-
}), {
|
|
15239
|
-
kind: "mutation",
|
|
15240
|
-
auth: "admin"
|
|
15241
|
-
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
15242
|
-
kind: "mutation",
|
|
15243
|
-
auth: "admin"
|
|
15244
|
-
}), method(object({
|
|
15245
|
-
addonId: string(),
|
|
15246
|
-
candidate: DiscoveryCandidateSchema,
|
|
15247
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
15248
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15249
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15250
|
-
integrationId: string().optional()
|
|
15251
|
-
}), DeviceSummarySchema, {
|
|
15252
|
-
kind: "mutation",
|
|
15253
|
-
auth: "admin"
|
|
15254
|
-
}), method(object({
|
|
15255
|
-
addonId: string(),
|
|
15256
|
-
type: _enum(DeviceType)
|
|
15257
|
-
}), unknown().nullable()), method(object({
|
|
15258
|
-
addonId: string(),
|
|
15259
|
-
type: _enum(DeviceType),
|
|
15260
|
-
config: record(string(), unknown()),
|
|
15261
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
15262
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15263
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15264
|
-
integrationId: string().optional()
|
|
15265
|
-
}), DeviceSummarySchema, {
|
|
15266
|
-
kind: "mutation",
|
|
15267
|
-
auth: "admin"
|
|
15268
|
-
}), method(object({
|
|
15269
|
-
addonId: string(),
|
|
15270
|
-
type: _enum(DeviceType),
|
|
15271
|
-
key: string(),
|
|
15272
|
-
value: unknown(),
|
|
15273
|
-
formValues: record(string(), unknown()).optional()
|
|
15274
|
-
}), FieldProbeResultSchema, {
|
|
15275
|
-
kind: "mutation",
|
|
15276
|
-
auth: "admin"
|
|
15277
|
-
}), method(object({
|
|
15278
|
-
addonId: string(),
|
|
15279
|
-
integrationId: string()
|
|
15280
|
-
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
15281
|
-
addonId: string(),
|
|
15282
|
-
integrationId: string()
|
|
15283
|
-
}), AdoptionStatusSchema, {
|
|
15284
|
-
kind: "mutation",
|
|
15285
|
-
auth: "admin"
|
|
15286
|
-
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
15287
|
-
kind: "mutation",
|
|
15288
|
-
auth: "admin"
|
|
15289
|
-
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
15290
|
-
kind: "mutation",
|
|
15291
|
-
auth: "admin"
|
|
15292
|
-
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
15293
|
-
kind: "mutation",
|
|
15294
|
-
auth: "admin"
|
|
15295
|
-
}), method(object({}), object({ providers: array(object({
|
|
15296
|
-
addonId: string(),
|
|
15297
|
-
label: string()
|
|
15298
|
-
})).readonly() }), { auth: "admin" }), method(object({}), object({ groups: array(object({
|
|
15299
|
-
addonId: string(),
|
|
15300
|
-
label: string(),
|
|
15301
|
-
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
15302
|
-
error: string().nullable()
|
|
15303
|
-
})).readonly() }), {
|
|
15304
|
-
kind: "mutation",
|
|
15305
|
-
auth: "admin"
|
|
15306
|
-
}), method(object({
|
|
15307
|
-
addonId: string(),
|
|
15308
|
-
params: record(string(), unknown()).optional()
|
|
15309
|
-
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
15310
|
-
kind: "mutation",
|
|
15311
|
-
auth: "admin"
|
|
15312
|
-
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
15313
|
-
deviceId: number(),
|
|
15314
|
-
key: string(),
|
|
15315
|
-
value: unknown()
|
|
15316
|
-
}), FieldProbeResultSchema, {
|
|
15317
|
-
kind: "mutation",
|
|
15318
|
-
auth: "admin"
|
|
15319
|
-
}), method(object({
|
|
15320
|
-
deviceId: number(),
|
|
15321
|
-
caps: array(string()).readonly().optional()
|
|
15322
|
-
}), record(string(), unknown().nullable()));
|
|
15323
|
-
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
15324
|
-
deviceId: number(),
|
|
15325
|
-
capName: string()
|
|
15326
|
-
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
15327
|
-
deviceId: number(),
|
|
15328
|
-
capName: string(),
|
|
15329
|
-
slice: record(string(), unknown())
|
|
15330
|
-
}), _void(), { kind: "mutation" }), object({
|
|
15331
|
-
deviceId: number(),
|
|
15332
|
-
capName: string(),
|
|
15333
|
-
slice: record(string(), unknown())
|
|
15334
|
-
});
|
|
15335
|
-
/**
|
|
15336
|
-
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
15337
|
-
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
15338
|
-
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
15339
|
-
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
15340
|
-
* post-analysis enrichment-engine.
|
|
15341
|
-
*/
|
|
15342
|
-
var EmbeddingResultSchema = object({
|
|
15343
|
-
embedding: array(number()),
|
|
15344
|
-
inferenceMs: number()
|
|
15345
|
-
});
|
|
15346
|
-
var EmbeddingInfoSchema = object({
|
|
15347
|
-
modelId: string(),
|
|
15348
|
-
embeddingDim: number(),
|
|
15349
|
-
ready: boolean()
|
|
15350
|
-
});
|
|
15351
|
-
method(object({
|
|
15352
|
-
crop: _instanceof(Uint8Array),
|
|
15353
|
-
width: number(),
|
|
15354
|
-
height: number()
|
|
15355
|
-
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
15356
|
-
/**
|
|
15357
|
-
* filesystem-browse — per-node capability for browsing the node's local
|
|
15358
|
-
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
15359
|
-
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
15360
|
-
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
15361
|
-
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
15362
|
-
*/
|
|
15363
|
-
var DirEntrySchema = object({
|
|
15364
|
-
name: string(),
|
|
15365
|
-
path: string()
|
|
15366
|
-
});
|
|
15367
|
-
var BrowseResultSchema = object({
|
|
15368
|
-
path: string(),
|
|
15369
|
-
entries: array(DirEntrySchema).readonly(),
|
|
15370
|
-
freeBytes: number(),
|
|
15371
|
-
totalBytes: number()
|
|
15372
|
-
});
|
|
15373
|
-
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
15892
|
+
auth: "admin"
|
|
15893
|
+
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
15894
|
+
capName: string(),
|
|
15895
|
+
wrappers: array(string())
|
|
15896
|
+
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
15897
|
+
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
15898
|
+
live: SettingsSchemaWithValuesSchema.nullable()
|
|
15899
|
+
})), method(object({
|
|
15900
|
+
deviceId: number().int().nonnegative(),
|
|
15901
|
+
action: string().min(1),
|
|
15902
|
+
input: unknown()
|
|
15903
|
+
}), unknown(), { kind: "mutation" }), method(object({
|
|
15904
|
+
deviceId: number(),
|
|
15905
|
+
writerCapName: string(),
|
|
15906
|
+
writerAddonId: string(),
|
|
15907
|
+
key: string(),
|
|
15908
|
+
value: unknown()
|
|
15909
|
+
}), object({ success: literal(true) }), {
|
|
15374
15910
|
kind: "mutation",
|
|
15375
15911
|
auth: "admin"
|
|
15376
|
-
})
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15385
|
-
*/
|
|
15386
|
-
var LlmUsageSchema = object({
|
|
15387
|
-
inputTokens: number(),
|
|
15388
|
-
outputTokens: number()
|
|
15389
|
-
});
|
|
15390
|
-
var LlmErrorCodeSchema = _enum([
|
|
15391
|
-
"timeout",
|
|
15392
|
-
"rate-limited",
|
|
15393
|
-
"auth",
|
|
15394
|
-
"refusal",
|
|
15395
|
-
"bad-request",
|
|
15396
|
-
"unavailable",
|
|
15397
|
-
"no-profile",
|
|
15398
|
-
"budget-exceeded",
|
|
15399
|
-
"adapter-error"
|
|
15400
|
-
]);
|
|
15401
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15402
|
-
ok: literal(true),
|
|
15403
|
-
text: string(),
|
|
15404
|
-
model: string(),
|
|
15405
|
-
usage: LlmUsageSchema,
|
|
15406
|
-
truncated: boolean(),
|
|
15407
|
-
latencyMs: number()
|
|
15912
|
+
}), method(object({
|
|
15913
|
+
deviceId: number(),
|
|
15914
|
+
changes: array(object({
|
|
15915
|
+
writerCapName: string(),
|
|
15916
|
+
writerAddonId: string(),
|
|
15917
|
+
key: string(),
|
|
15918
|
+
value: unknown()
|
|
15919
|
+
}))
|
|
15408
15920
|
}), object({
|
|
15409
|
-
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
|
|
15416
|
-
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15417
|
-
* notification-output.cap.ts:27-31 precedents).
|
|
15418
|
-
*/
|
|
15419
|
-
var LlmImageSchema = object({
|
|
15420
|
-
bytes: _instanceof(Uint8Array),
|
|
15421
|
-
mimeType: string()
|
|
15422
|
-
});
|
|
15423
|
-
var LlmGenerateBaseInputSchema = object({
|
|
15424
|
-
/** Collection routing (the notification-output posture). */
|
|
15425
|
-
addonId: string().optional(),
|
|
15426
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15427
|
-
profileId: string().optional(),
|
|
15428
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15429
|
-
consumer: string(),
|
|
15430
|
-
system: string().optional(),
|
|
15431
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15432
|
-
prompt: string(),
|
|
15433
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15434
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
15435
|
-
/** Per-call override of the profile default. */
|
|
15436
|
-
maxTokens: number().int().positive().optional(),
|
|
15437
|
-
temperature: number().optional()
|
|
15438
|
-
});
|
|
15439
|
-
/**
|
|
15440
|
-
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15441
|
-
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15442
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15443
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15444
|
-
* this only through the `llm` cap's methods.
|
|
15445
|
-
*
|
|
15446
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15447
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15448
|
-
* watchdog — operator decision #3).
|
|
15449
|
-
*/
|
|
15450
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15451
|
-
object({
|
|
15452
|
-
kind: literal("catalog"),
|
|
15453
|
-
catalogId: string()
|
|
15454
|
-
}),
|
|
15455
|
-
object({
|
|
15456
|
-
kind: literal("url"),
|
|
15457
|
-
url: string(),
|
|
15458
|
-
sha256: string().optional()
|
|
15459
|
-
}),
|
|
15460
|
-
object({
|
|
15461
|
-
kind: literal("path"),
|
|
15462
|
-
path: string()
|
|
15463
|
-
})
|
|
15464
|
-
]);
|
|
15465
|
-
var ManagedRuntimeConfigSchema = object({
|
|
15466
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
15467
|
-
nodeId: string(),
|
|
15468
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15469
|
-
engine: _enum(["llama-cpp"]),
|
|
15470
|
-
model: ManagedModelRefSchema,
|
|
15471
|
-
contextSize: number().int().default(4096),
|
|
15472
|
-
/** 0 = CPU-only. */
|
|
15473
|
-
gpuLayers: number().int().default(0),
|
|
15474
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15475
|
-
threads: number().int().optional(),
|
|
15476
|
-
/** Concurrent slots. */
|
|
15477
|
-
parallel: number().int().default(1),
|
|
15478
|
-
/** Else lazy: first generate boots it. */
|
|
15479
|
-
autoStart: boolean().default(false),
|
|
15480
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
15481
|
-
idleStopMinutes: number().int().default(30)
|
|
15482
|
-
});
|
|
15483
|
-
var LlmRuntimeStatusSchema = object({
|
|
15484
|
-
/** Status is ALWAYS node-qualified. */
|
|
15485
|
-
nodeId: string(),
|
|
15486
|
-
state: _enum([
|
|
15487
|
-
"stopped",
|
|
15488
|
-
"downloading",
|
|
15489
|
-
"starting",
|
|
15490
|
-
"ready",
|
|
15491
|
-
"crashed",
|
|
15492
|
-
"failed"
|
|
15493
|
-
]),
|
|
15494
|
-
pid: number().optional(),
|
|
15495
|
-
port: number().optional(),
|
|
15496
|
-
modelPath: string().optional(),
|
|
15497
|
-
modelId: string().optional(),
|
|
15498
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
15499
|
-
lastError: string().optional(),
|
|
15500
|
-
crashesInWindow: number(),
|
|
15501
|
-
/** Child RSS (sampled best-effort). */
|
|
15502
|
-
memoryBytes: number().optional(),
|
|
15503
|
-
vramBytes: number().optional()
|
|
15504
|
-
});
|
|
15505
|
-
var LlmNodeModelSchema = object({
|
|
15506
|
-
file: string(),
|
|
15507
|
-
sizeBytes: number(),
|
|
15508
|
-
catalogId: string().optional(),
|
|
15509
|
-
installedAt: number().optional()
|
|
15510
|
-
});
|
|
15511
|
-
var LlmRuntimeDiskUsageSchema = object({
|
|
15512
|
-
nodeId: string(),
|
|
15513
|
-
modelsBytes: number(),
|
|
15514
|
-
freeBytes: number().optional()
|
|
15515
|
-
});
|
|
15516
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
15517
|
-
images: array(LlmImageSchema).optional(),
|
|
15518
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
15519
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15520
|
-
timeoutMs: number().int().positive().optional()
|
|
15521
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15921
|
+
success: literal(true),
|
|
15922
|
+
failures: array(object({
|
|
15923
|
+
writerCapName: string(),
|
|
15924
|
+
writerAddonId: string(),
|
|
15925
|
+
error: string()
|
|
15926
|
+
}))
|
|
15927
|
+
}), {
|
|
15522
15928
|
kind: "mutation",
|
|
15523
15929
|
auth: "admin"
|
|
15524
|
-
}), method(object({}),
|
|
15930
|
+
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
15525
15931
|
kind: "mutation",
|
|
15526
15932
|
auth: "admin"
|
|
15527
|
-
}), method(object({
|
|
15933
|
+
}), method(object({
|
|
15934
|
+
addonId: string(),
|
|
15935
|
+
candidate: DiscoveryCandidateSchema,
|
|
15936
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
15937
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15938
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15939
|
+
integrationId: string().optional()
|
|
15940
|
+
}), DeviceSummarySchema, {
|
|
15528
15941
|
kind: "mutation",
|
|
15529
15942
|
auth: "admin"
|
|
15530
|
-
}), method(object({
|
|
15943
|
+
}), method(object({
|
|
15944
|
+
addonId: string(),
|
|
15945
|
+
type: _enum(DeviceType)
|
|
15946
|
+
}), unknown().nullable()), method(object({
|
|
15947
|
+
addonId: string(),
|
|
15948
|
+
type: _enum(DeviceType),
|
|
15949
|
+
config: record(string(), unknown()),
|
|
15950
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
15951
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15952
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15953
|
+
integrationId: string().optional()
|
|
15954
|
+
}), DeviceSummarySchema, {
|
|
15531
15955
|
kind: "mutation",
|
|
15532
15956
|
auth: "admin"
|
|
15533
|
-
}), method(object({
|
|
15534
|
-
/**
|
|
15535
|
-
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
15536
|
-
* methods concat-fan across providers; single-row methods route to ONE
|
|
15537
|
-
* provider by the `addonId` in the call input (the notification-output
|
|
15538
|
-
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15539
|
-
* (hub-placed); the cap stays open for future providers.
|
|
15540
|
-
*
|
|
15541
|
-
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15542
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15543
|
-
* write; a stored key NEVER round-trips to a client.
|
|
15544
|
-
*/
|
|
15545
|
-
var LlmProfileKindSchema = _enum([
|
|
15546
|
-
"openai-compatible",
|
|
15547
|
-
"openai",
|
|
15548
|
-
"anthropic",
|
|
15549
|
-
"google",
|
|
15550
|
-
"managed-local"
|
|
15551
|
-
]);
|
|
15552
|
-
var LlmProfileSchema = object({
|
|
15553
|
-
id: string(),
|
|
15554
|
-
name: string(),
|
|
15555
|
-
kind: LlmProfileKindSchema,
|
|
15556
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
15957
|
+
}), method(object({
|
|
15557
15958
|
addonId: string(),
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
temperature: number().min(0).max(2).optional(),
|
|
15567
|
-
maxTokens: number().int().positive().optional(),
|
|
15568
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
15569
|
-
extraHeaders: record(string(), string()).optional(),
|
|
15570
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
15571
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15572
|
-
});
|
|
15573
|
-
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
15574
|
-
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
15575
|
-
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
15576
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
15577
|
-
var LlmProfileKindDescriptorSchema = object({
|
|
15578
|
-
kind: LlmProfileKindSchema,
|
|
15579
|
-
label: string(),
|
|
15580
|
-
icon: string(),
|
|
15581
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15959
|
+
type: _enum(DeviceType),
|
|
15960
|
+
key: string(),
|
|
15961
|
+
value: unknown(),
|
|
15962
|
+
formValues: record(string(), unknown()).optional()
|
|
15963
|
+
}), FieldProbeResultSchema, {
|
|
15964
|
+
kind: "mutation",
|
|
15965
|
+
auth: "admin"
|
|
15966
|
+
}), method(object({
|
|
15582
15967
|
addonId: string(),
|
|
15583
|
-
|
|
15584
|
-
})
|
|
15585
|
-
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
15586
|
-
var LlmDefaultSchema = object({
|
|
15587
|
-
selector: LlmDefaultSelectorSchema,
|
|
15588
|
-
profileId: string()
|
|
15589
|
-
});
|
|
15590
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
15591
|
-
var LlmUsageRollupSchema = object({
|
|
15592
|
-
day: string(),
|
|
15593
|
-
consumer: string(),
|
|
15594
|
-
profileId: string(),
|
|
15595
|
-
calls: number(),
|
|
15596
|
-
okCalls: number(),
|
|
15597
|
-
errorCalls: number(),
|
|
15598
|
-
inputTokens: number(),
|
|
15599
|
-
outputTokens: number(),
|
|
15600
|
-
avgLatencyMs: number()
|
|
15601
|
-
});
|
|
15602
|
-
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
15603
|
-
var ManagedModelCatalogEntrySchema = object({
|
|
15604
|
-
id: string(),
|
|
15605
|
-
label: string(),
|
|
15606
|
-
family: string(),
|
|
15607
|
-
purpose: _enum(["text", "vision"]),
|
|
15608
|
-
url: string(),
|
|
15609
|
-
sha256: string(),
|
|
15610
|
-
sizeBytes: number(),
|
|
15611
|
-
quantization: string(),
|
|
15612
|
-
/** Load-time guidance shown in the picker. */
|
|
15613
|
-
minRamBytes: number(),
|
|
15614
|
-
contextSizeDefault: number().int(),
|
|
15615
|
-
/** Vision models: companion projector file. */
|
|
15616
|
-
mmprojUrl: string().optional()
|
|
15617
|
-
});
|
|
15618
|
-
var LlmRuntimeNodeSchema = object({
|
|
15619
|
-
nodeId: string(),
|
|
15620
|
-
reachable: boolean(),
|
|
15621
|
-
status: LlmRuntimeStatusSchema.optional(),
|
|
15622
|
-
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15623
|
-
error: string().optional()
|
|
15624
|
-
});
|
|
15625
|
-
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
15626
|
-
var ProfileRefInputSchema = object({
|
|
15968
|
+
integrationId: string()
|
|
15969
|
+
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
15627
15970
|
addonId: string(),
|
|
15628
|
-
|
|
15629
|
-
})
|
|
15630
|
-
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
15971
|
+
integrationId: string()
|
|
15972
|
+
}), AdoptionStatusSchema, {
|
|
15631
15973
|
kind: "mutation",
|
|
15632
15974
|
auth: "admin"
|
|
15633
|
-
}), method(
|
|
15975
|
+
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
15634
15976
|
kind: "mutation",
|
|
15635
15977
|
auth: "admin"
|
|
15636
|
-
}), method(
|
|
15978
|
+
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
15637
15979
|
kind: "mutation",
|
|
15638
15980
|
auth: "admin"
|
|
15639
|
-
}), method(
|
|
15640
|
-
selector: LlmDefaultSelectorSchema,
|
|
15641
|
-
profileId: string().nullable()
|
|
15642
|
-
}), _void(), {
|
|
15981
|
+
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
15643
15982
|
kind: "mutation",
|
|
15644
15983
|
auth: "admin"
|
|
15645
|
-
}), method(object({
|
|
15646
|
-
|
|
15647
|
-
|
|
15648
|
-
|
|
15649
|
-
|
|
15650
|
-
|
|
15651
|
-
|
|
15652
|
-
|
|
15653
|
-
})
|
|
15984
|
+
}), method(object({}), object({ providers: array(object({
|
|
15985
|
+
addonId: string(),
|
|
15986
|
+
label: string()
|
|
15987
|
+
})).readonly() }), { auth: "admin" }), method(object({}), object({ groups: array(object({
|
|
15988
|
+
addonId: string(),
|
|
15989
|
+
label: string(),
|
|
15990
|
+
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
15991
|
+
error: string().nullable()
|
|
15992
|
+
})).readonly() }), {
|
|
15654
15993
|
kind: "mutation",
|
|
15655
15994
|
auth: "admin"
|
|
15656
15995
|
}), method(object({
|
|
15657
|
-
|
|
15658
|
-
|
|
15659
|
-
}),
|
|
15996
|
+
addonId: string(),
|
|
15997
|
+
params: record(string(), unknown()).optional()
|
|
15998
|
+
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
15660
15999
|
kind: "mutation",
|
|
15661
16000
|
auth: "admin"
|
|
15662
|
-
}), method(
|
|
16001
|
+
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
16002
|
+
deviceId: number(),
|
|
16003
|
+
key: string(),
|
|
16004
|
+
value: unknown()
|
|
16005
|
+
}), FieldProbeResultSchema, {
|
|
15663
16006
|
kind: "mutation",
|
|
15664
16007
|
auth: "admin"
|
|
15665
|
-
}), method(
|
|
16008
|
+
}), method(object({
|
|
16009
|
+
deviceId: number(),
|
|
16010
|
+
caps: array(string()).readonly().optional()
|
|
16011
|
+
}), record(string(), unknown().nullable()));
|
|
16012
|
+
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
16013
|
+
deviceId: number(),
|
|
16014
|
+
capName: string()
|
|
16015
|
+
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
16016
|
+
deviceId: number(),
|
|
16017
|
+
capName: string(),
|
|
16018
|
+
slice: record(string(), unknown())
|
|
16019
|
+
}), _void(), { kind: "mutation" }), object({
|
|
16020
|
+
deviceId: number(),
|
|
16021
|
+
capName: string(),
|
|
16022
|
+
slice: record(string(), unknown())
|
|
16023
|
+
});
|
|
16024
|
+
/**
|
|
16025
|
+
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
16026
|
+
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
16027
|
+
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
16028
|
+
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
16029
|
+
* post-analysis enrichment-engine.
|
|
16030
|
+
*/
|
|
16031
|
+
var EmbeddingResultSchema = object({
|
|
16032
|
+
embedding: array(number()),
|
|
16033
|
+
inferenceMs: number()
|
|
16034
|
+
});
|
|
16035
|
+
var EmbeddingInfoSchema = object({
|
|
16036
|
+
modelId: string(),
|
|
16037
|
+
embeddingDim: number(),
|
|
16038
|
+
ready: boolean()
|
|
16039
|
+
});
|
|
16040
|
+
method(object({
|
|
16041
|
+
crop: _instanceof(Uint8Array),
|
|
16042
|
+
width: number(),
|
|
16043
|
+
height: number()
|
|
16044
|
+
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
16045
|
+
/**
|
|
16046
|
+
* filesystem-browse — per-node capability for browsing the node's local
|
|
16047
|
+
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
16048
|
+
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
16049
|
+
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
16050
|
+
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
16051
|
+
*/
|
|
16052
|
+
var DirEntrySchema = object({
|
|
16053
|
+
name: string(),
|
|
16054
|
+
path: string()
|
|
16055
|
+
});
|
|
16056
|
+
var BrowseResultSchema = object({
|
|
16057
|
+
path: string(),
|
|
16058
|
+
entries: array(DirEntrySchema).readonly(),
|
|
16059
|
+
freeBytes: number(),
|
|
16060
|
+
totalBytes: number()
|
|
16061
|
+
});
|
|
16062
|
+
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
15666
16063
|
kind: "mutation",
|
|
15667
16064
|
auth: "admin"
|
|
15668
16065
|
});
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
|
|
16066
|
+
/**
|
|
16067
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
16068
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
16069
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
16070
|
+
*
|
|
16071
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
16072
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
16073
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
16074
|
+
*/
|
|
16075
|
+
var LlmUsageSchema = object({
|
|
16076
|
+
inputTokens: number(),
|
|
16077
|
+
outputTokens: number()
|
|
16078
|
+
});
|
|
16079
|
+
var LlmErrorCodeSchema = _enum([
|
|
16080
|
+
"timeout",
|
|
16081
|
+
"rate-limited",
|
|
16082
|
+
"auth",
|
|
16083
|
+
"refusal",
|
|
16084
|
+
"bad-request",
|
|
16085
|
+
"unavailable",
|
|
16086
|
+
"no-profile",
|
|
16087
|
+
"budget-exceeded",
|
|
16088
|
+
"adapter-error"
|
|
15674
16089
|
]);
|
|
15675
|
-
var
|
|
15676
|
-
|
|
15677
|
-
|
|
15678
|
-
|
|
16090
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
16091
|
+
ok: literal(true),
|
|
16092
|
+
text: string(),
|
|
16093
|
+
model: string(),
|
|
16094
|
+
usage: LlmUsageSchema,
|
|
16095
|
+
truncated: boolean(),
|
|
16096
|
+
latencyMs: number()
|
|
16097
|
+
}), object({
|
|
16098
|
+
ok: literal(false),
|
|
16099
|
+
code: LlmErrorCodeSchema,
|
|
15679
16100
|
message: string(),
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
});
|
|
15683
|
-
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
15684
|
-
scope: array(string()).optional(),
|
|
15685
|
-
level: LogLevelSchema.optional(),
|
|
15686
|
-
since: date().optional(),
|
|
15687
|
-
until: date().optional(),
|
|
15688
|
-
limit: number().optional(),
|
|
15689
|
-
tags: record(string(), string()).optional()
|
|
15690
|
-
}), array(LogEntrySchema).readonly());
|
|
16101
|
+
retryAfterMs: number().optional()
|
|
16102
|
+
})]);
|
|
15691
16103
|
/**
|
|
15692
|
-
* `
|
|
15693
|
-
*
|
|
15694
|
-
*
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15700
|
-
|
|
15701
|
-
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
*
|
|
15718
|
-
*
|
|
15719
|
-
*
|
|
15720
|
-
*
|
|
15721
|
-
*
|
|
15722
|
-
* Every contribution carries a `stage`:
|
|
15723
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
15724
|
-
* magic-link buttons; a future usernameless passkey).
|
|
15725
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
15726
|
-
* returned `factors` (passkey-as-2FA today).
|
|
16104
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
16105
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
16106
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
16107
|
+
*/
|
|
16108
|
+
var LlmImageSchema = object({
|
|
16109
|
+
bytes: _instanceof(Uint8Array),
|
|
16110
|
+
mimeType: string()
|
|
16111
|
+
});
|
|
16112
|
+
var LlmGenerateBaseInputSchema = object({
|
|
16113
|
+
/** Collection routing (the notification-output posture). */
|
|
16114
|
+
addonId: string().optional(),
|
|
16115
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
16116
|
+
profileId: string().optional(),
|
|
16117
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
16118
|
+
consumer: string(),
|
|
16119
|
+
system: string().optional(),
|
|
16120
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
16121
|
+
prompt: string(),
|
|
16122
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
16123
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
16124
|
+
/** Per-call override of the profile default. */
|
|
16125
|
+
maxTokens: number().int().positive().optional(),
|
|
16126
|
+
temperature: number().optional()
|
|
16127
|
+
});
|
|
16128
|
+
/**
|
|
16129
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
16130
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
16131
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
16132
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
16133
|
+
* this only through the `llm` cap's methods.
|
|
15727
16134
|
*
|
|
15728
|
-
*
|
|
15729
|
-
*
|
|
15730
|
-
*
|
|
16135
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
16136
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
16137
|
+
* watchdog — operator decision #3).
|
|
15731
16138
|
*/
|
|
15732
|
-
|
|
15733
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
15734
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
15735
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
16139
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15736
16140
|
object({
|
|
15737
|
-
kind: literal("
|
|
15738
|
-
|
|
15739
|
-
id: string(),
|
|
15740
|
-
/** Operator-facing button label. */
|
|
15741
|
-
label: string(),
|
|
15742
|
-
/** lucide-react icon name. */
|
|
15743
|
-
icon: string().optional(),
|
|
15744
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
15745
|
-
startUrl: string(),
|
|
15746
|
-
stage: LoginStageEnum
|
|
16141
|
+
kind: literal("catalog"),
|
|
16142
|
+
catalogId: string()
|
|
15747
16143
|
}),
|
|
15748
16144
|
object({
|
|
15749
|
-
kind: literal("
|
|
15750
|
-
|
|
15751
|
-
|
|
15752
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
15753
|
-
addonId: string(),
|
|
15754
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
15755
|
-
bundle: string(),
|
|
15756
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
15757
|
-
remote: WidgetRemoteSchema,
|
|
15758
|
-
stage: LoginStageEnum
|
|
16145
|
+
kind: literal("url"),
|
|
16146
|
+
url: string(),
|
|
16147
|
+
sha256: string().optional()
|
|
15759
16148
|
}),
|
|
15760
16149
|
object({
|
|
15761
|
-
kind: literal("
|
|
15762
|
-
|
|
15763
|
-
id: string(),
|
|
15764
|
-
/** Operator-facing button label. */
|
|
15765
|
-
label: string(),
|
|
15766
|
-
stage: LoginStageEnum,
|
|
15767
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
15768
|
-
rpId: string(),
|
|
15769
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
15770
|
-
origin: string().nullable()
|
|
16150
|
+
kind: literal("path"),
|
|
16151
|
+
path: string()
|
|
15771
16152
|
})
|
|
15772
16153
|
]);
|
|
15773
|
-
|
|
15774
|
-
|
|
15775
|
-
|
|
15776
|
-
|
|
15777
|
-
|
|
15778
|
-
|
|
15779
|
-
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
|
|
15786
|
-
|
|
15787
|
-
|
|
15788
|
-
|
|
15789
|
-
|
|
15790
|
-
usedBytes: number(),
|
|
15791
|
-
availableBytes: number(),
|
|
15792
|
-
swapUsedBytes: number(),
|
|
15793
|
-
swapTotalBytes: number()
|
|
15794
|
-
});
|
|
15795
|
-
var DiskIoSnapshotSchema = object({
|
|
15796
|
-
readBytes: number(),
|
|
15797
|
-
writeBytes: number(),
|
|
15798
|
-
readOps: number(),
|
|
15799
|
-
writeOps: number(),
|
|
15800
|
-
timestampMs: number()
|
|
15801
|
-
});
|
|
15802
|
-
var NetworkIoSnapshotSchema = object({
|
|
15803
|
-
rxBytes: number(),
|
|
15804
|
-
txBytes: number(),
|
|
15805
|
-
rxPackets: number(),
|
|
15806
|
-
txPackets: number(),
|
|
15807
|
-
rxErrors: number(),
|
|
15808
|
-
txErrors: number(),
|
|
15809
|
-
timestampMs: number()
|
|
15810
|
-
});
|
|
15811
|
-
var MetricsGpuInfoSchema = object({
|
|
15812
|
-
utilization: number(),
|
|
15813
|
-
model: string(),
|
|
15814
|
-
memoryUsedBytes: number(),
|
|
15815
|
-
memoryTotalBytes: number(),
|
|
15816
|
-
temperature: number().nullable()
|
|
15817
|
-
});
|
|
15818
|
-
var ProcessResourceInfoSchema = object({
|
|
15819
|
-
openFds: number(),
|
|
15820
|
-
threadCount: number(),
|
|
15821
|
-
activeHandles: number(),
|
|
15822
|
-
activeRequests: number()
|
|
15823
|
-
});
|
|
15824
|
-
var PressureAvgsSchema = object({
|
|
15825
|
-
avg10: number(),
|
|
15826
|
-
avg60: number(),
|
|
15827
|
-
avg300: number()
|
|
15828
|
-
});
|
|
15829
|
-
var PressureInfoSchema = object({
|
|
15830
|
-
some: PressureAvgsSchema,
|
|
15831
|
-
full: PressureAvgsSchema.nullable()
|
|
15832
|
-
});
|
|
15833
|
-
var SystemResourceSnapshotSchema = object({
|
|
15834
|
-
cpu: CpuBreakdownSchema,
|
|
15835
|
-
memory: MemoryInfoSchema,
|
|
15836
|
-
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15837
|
-
network: NetworkIoSnapshotSchema,
|
|
15838
|
-
disk: DiskIoSnapshotSchema,
|
|
15839
|
-
pressure: object({
|
|
15840
|
-
cpu: PressureInfoSchema.nullable(),
|
|
15841
|
-
memory: PressureInfoSchema.nullable(),
|
|
15842
|
-
io: PressureInfoSchema.nullable()
|
|
15843
|
-
}),
|
|
15844
|
-
process: ProcessResourceInfoSchema,
|
|
15845
|
-
cpuTemperature: number().nullable(),
|
|
15846
|
-
timestampMs: number()
|
|
15847
|
-
});
|
|
15848
|
-
var DiskSpaceInfoSchema = object({
|
|
15849
|
-
path: string(),
|
|
15850
|
-
totalBytes: number(),
|
|
15851
|
-
usedBytes: number(),
|
|
15852
|
-
availableBytes: number(),
|
|
15853
|
-
percent: number()
|
|
15854
|
-
});
|
|
15855
|
-
var PidResourceStatsSchema = object({
|
|
15856
|
-
pid: number(),
|
|
15857
|
-
cpu: number(),
|
|
15858
|
-
memory: number(),
|
|
15859
|
-
/**
|
|
15860
|
-
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
15861
|
-
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
15862
|
-
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
15863
|
-
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
15864
|
-
* Undefined where /proc is unavailable (e.g. macOS).
|
|
15865
|
-
*/
|
|
15866
|
-
privateBytes: number().optional(),
|
|
15867
|
-
/**
|
|
15868
|
-
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
15869
|
-
* code shared copy-on-write across runners. Undefined on macOS.
|
|
15870
|
-
*/
|
|
15871
|
-
sharedBytes: number().optional()
|
|
16154
|
+
var ManagedRuntimeConfigSchema = object({
|
|
16155
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
16156
|
+
nodeId: string(),
|
|
16157
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
16158
|
+
engine: _enum(["llama-cpp"]),
|
|
16159
|
+
model: ManagedModelRefSchema,
|
|
16160
|
+
contextSize: number().int().default(4096),
|
|
16161
|
+
/** 0 = CPU-only. */
|
|
16162
|
+
gpuLayers: number().int().default(0),
|
|
16163
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
16164
|
+
threads: number().int().optional(),
|
|
16165
|
+
/** Concurrent slots. */
|
|
16166
|
+
parallel: number().int().default(1),
|
|
16167
|
+
/** Else lazy: first generate boots it. */
|
|
16168
|
+
autoStart: boolean().default(false),
|
|
16169
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
16170
|
+
idleStopMinutes: number().int().default(30)
|
|
15872
16171
|
});
|
|
15873
|
-
var
|
|
15874
|
-
|
|
16172
|
+
var LlmRuntimeStatusSchema = object({
|
|
16173
|
+
/** Status is ALWAYS node-qualified. */
|
|
15875
16174
|
nodeId: string(),
|
|
15876
|
-
role: _enum(["hub", "worker"]),
|
|
15877
|
-
pid: number(),
|
|
15878
16175
|
state: _enum([
|
|
15879
|
-
"starting",
|
|
15880
|
-
"running",
|
|
15881
|
-
"stopping",
|
|
15882
16176
|
"stopped",
|
|
15883
|
-
"
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
pid: number(),
|
|
15889
|
-
ppid: number(),
|
|
15890
|
-
pgid: number(),
|
|
15891
|
-
classification: _enum([
|
|
15892
|
-
"root",
|
|
15893
|
-
"managed",
|
|
15894
|
-
"system",
|
|
15895
|
-
"ghost"
|
|
16177
|
+
"downloading",
|
|
16178
|
+
"starting",
|
|
16179
|
+
"ready",
|
|
16180
|
+
"crashed",
|
|
16181
|
+
"failed"
|
|
15896
16182
|
]),
|
|
15897
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
15898
|
-
addonId: string().nullable(),
|
|
15899
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15900
|
-
nodeId: string().nullable(),
|
|
15901
|
-
/** Truncated command line. */
|
|
15902
|
-
command: string(),
|
|
15903
|
-
cpuPercent: number(),
|
|
15904
|
-
memoryRssBytes: number(),
|
|
15905
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15906
|
-
uptimeSec: number(),
|
|
15907
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15908
|
-
orphaned: boolean()
|
|
15909
|
-
});
|
|
15910
|
-
var KillProcessInputSchema = object({
|
|
15911
|
-
pid: number(),
|
|
15912
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15913
|
-
force: boolean().optional()
|
|
15914
|
-
});
|
|
15915
|
-
var KillProcessResultSchema = object({
|
|
15916
|
-
success: boolean(),
|
|
15917
|
-
reason: string().optional(),
|
|
15918
|
-
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15919
|
-
});
|
|
15920
|
-
var DumpHeapSnapshotInputSchema = object({
|
|
15921
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
15922
|
-
addonId: string() });
|
|
15923
|
-
var DumpHeapSnapshotResultSchema = object({
|
|
15924
|
-
success: boolean(),
|
|
15925
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15926
|
-
path: string().optional(),
|
|
15927
|
-
/** Process pid that was signalled. */
|
|
15928
16183
|
pid: number().optional(),
|
|
15929
|
-
|
|
16184
|
+
port: number().optional(),
|
|
16185
|
+
modelPath: string().optional(),
|
|
16186
|
+
modelId: string().optional(),
|
|
16187
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
16188
|
+
lastError: string().optional(),
|
|
16189
|
+
crashesInWindow: number(),
|
|
16190
|
+
/** Child RSS (sampled best-effort). */
|
|
16191
|
+
memoryBytes: number().optional(),
|
|
16192
|
+
vramBytes: number().optional()
|
|
15930
16193
|
});
|
|
15931
|
-
var
|
|
15932
|
-
|
|
15933
|
-
|
|
15934
|
-
|
|
15935
|
-
|
|
15936
|
-
diskPercent: number().optional(),
|
|
15937
|
-
temperature: number().optional(),
|
|
15938
|
-
gpuPercent: number().optional(),
|
|
15939
|
-
gpuMemoryPercent: number().optional()
|
|
16194
|
+
var LlmNodeModelSchema = object({
|
|
16195
|
+
file: string(),
|
|
16196
|
+
sizeBytes: number(),
|
|
16197
|
+
catalogId: string().optional(),
|
|
16198
|
+
installedAt: number().optional()
|
|
15940
16199
|
});
|
|
15941
|
-
|
|
16200
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
16201
|
+
nodeId: string(),
|
|
16202
|
+
modelsBytes: number(),
|
|
16203
|
+
freeBytes: number().optional()
|
|
16204
|
+
});
|
|
16205
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
16206
|
+
images: array(LlmImageSchema).optional(),
|
|
16207
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
16208
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
16209
|
+
timeoutMs: number().int().positive().optional()
|
|
16210
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15942
16211
|
kind: "mutation",
|
|
15943
16212
|
auth: "admin"
|
|
15944
|
-
}), method(
|
|
16213
|
+
}), method(object({}), _void(), {
|
|
15945
16214
|
kind: "mutation",
|
|
15946
16215
|
auth: "admin"
|
|
15947
|
-
})
|
|
15948
|
-
method(object({
|
|
15949
|
-
sourceUrl: string(),
|
|
15950
|
-
metadata: ModelConvertMetadataSchema,
|
|
15951
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15952
|
-
calibrationRef: string().optional(),
|
|
15953
|
-
sessionId: string().optional()
|
|
15954
|
-
}), ConvertResultSchema, {
|
|
16216
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15955
16217
|
kind: "mutation",
|
|
15956
|
-
auth: "admin"
|
|
15957
|
-
|
|
15958
|
-
});
|
|
15959
|
-
method(object({
|
|
15960
|
-
nodeId: string(),
|
|
15961
|
-
modelId: string(),
|
|
15962
|
-
format: _enum(MODEL_FORMATS),
|
|
15963
|
-
entry: ModelCatalogEntrySchema
|
|
15964
|
-
}), object({
|
|
15965
|
-
ok: boolean(),
|
|
15966
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15967
|
-
sha256: string(),
|
|
15968
|
-
bytes: number(),
|
|
15969
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15970
|
-
path: string()
|
|
15971
|
-
}), {
|
|
16218
|
+
auth: "admin"
|
|
16219
|
+
}), method(object({ file: string() }), _void(), {
|
|
15972
16220
|
kind: "mutation",
|
|
15973
16221
|
auth: "admin"
|
|
15974
|
-
});
|
|
15975
|
-
/**
|
|
15976
|
-
* `mqtt-broker` — broker-registry cap.
|
|
15977
|
-
*
|
|
15978
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15979
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15980
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
15981
|
-
* its OWN `mqtt.js` client.
|
|
15982
|
-
*
|
|
15983
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15984
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15985
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
15986
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15987
|
-
* features anyway — give it the connection config, get out of the way.
|
|
15988
|
-
*
|
|
15989
|
-
* Consumer flow:
|
|
15990
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
15991
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
15992
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
15993
|
-
*
|
|
15994
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
15995
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
15996
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
15997
|
-
* spawned it.
|
|
15998
|
-
*/
|
|
15999
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
16222
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
16000
16223
|
/**
|
|
16001
|
-
*
|
|
16224
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
16225
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
16226
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
16227
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
16228
|
+
* (hub-placed); the cap stays open for future providers.
|
|
16002
16229
|
*
|
|
16003
|
-
*
|
|
16004
|
-
*
|
|
16005
|
-
*
|
|
16006
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
16007
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16230
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
16231
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
16232
|
+
* write; a stored key NEVER round-trips to a client.
|
|
16008
16233
|
*/
|
|
16009
|
-
var
|
|
16010
|
-
"
|
|
16011
|
-
"
|
|
16012
|
-
"
|
|
16013
|
-
"
|
|
16014
|
-
"
|
|
16234
|
+
var LlmProfileKindSchema = _enum([
|
|
16235
|
+
"openai-compatible",
|
|
16236
|
+
"openai",
|
|
16237
|
+
"anthropic",
|
|
16238
|
+
"google",
|
|
16239
|
+
"managed-local"
|
|
16015
16240
|
]);
|
|
16016
|
-
var
|
|
16241
|
+
var LlmProfileSchema = object({
|
|
16017
16242
|
id: string(),
|
|
16018
16243
|
name: string(),
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
|
|
16022
|
-
|
|
16023
|
-
|
|
16024
|
-
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
-
|
|
16244
|
+
kind: LlmProfileKindSchema,
|
|
16245
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
16246
|
+
addonId: string(),
|
|
16247
|
+
enabled: boolean(),
|
|
16248
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
16249
|
+
model: string(),
|
|
16250
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
16251
|
+
baseUrl: string().optional(),
|
|
16252
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
16253
|
+
apiKey: string().optional(),
|
|
16254
|
+
supportsVision: boolean(),
|
|
16255
|
+
temperature: number().min(0).max(2).optional(),
|
|
16256
|
+
maxTokens: number().int().positive().optional(),
|
|
16257
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
16258
|
+
extraHeaders: record(string(), string()).optional(),
|
|
16259
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
16260
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
16028
16261
|
});
|
|
16029
|
-
/**
|
|
16030
|
-
*
|
|
16031
|
-
*
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
|
|
16036
|
-
|
|
16037
|
-
|
|
16038
|
-
|
|
16039
|
-
|
|
16040
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
16041
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
16042
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
16043
|
-
* broker).
|
|
16044
|
-
*/
|
|
16045
|
-
clientIdPrefix: string().optional()
|
|
16262
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
16263
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
16264
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
16265
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
16266
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
16267
|
+
kind: LlmProfileKindSchema,
|
|
16268
|
+
label: string(),
|
|
16269
|
+
icon: string(),
|
|
16270
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16271
|
+
addonId: string(),
|
|
16272
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
16046
16273
|
});
|
|
16047
|
-
var
|
|
16048
|
-
|
|
16049
|
-
|
|
16050
|
-
|
|
16051
|
-
password: string().optional(),
|
|
16052
|
-
clientIdPrefix: string().optional()
|
|
16274
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
16275
|
+
var LlmDefaultSchema = object({
|
|
16276
|
+
selector: LlmDefaultSelectorSchema,
|
|
16277
|
+
profileId: string()
|
|
16053
16278
|
});
|
|
16054
|
-
|
|
16055
|
-
var
|
|
16056
|
-
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
|
|
16065
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
16066
|
-
allowAnonymous: boolean().default(false),
|
|
16067
|
-
/** Optional shared username/password for clients. */
|
|
16068
|
-
username: string().optional(),
|
|
16069
|
-
password: string().optional()
|
|
16279
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
16280
|
+
var LlmUsageRollupSchema = object({
|
|
16281
|
+
day: string(),
|
|
16282
|
+
consumer: string(),
|
|
16283
|
+
profileId: string(),
|
|
16284
|
+
calls: number(),
|
|
16285
|
+
okCalls: number(),
|
|
16286
|
+
errorCalls: number(),
|
|
16287
|
+
inputTokens: number(),
|
|
16288
|
+
outputTokens: number(),
|
|
16289
|
+
avgLatencyMs: number()
|
|
16070
16290
|
});
|
|
16071
|
-
|
|
16291
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
16292
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
16072
16293
|
id: string(),
|
|
16073
|
-
|
|
16074
|
-
|
|
16075
|
-
|
|
16076
|
-
brokerCount: number(),
|
|
16077
|
-
embeddedRunning: boolean()
|
|
16078
|
-
});
|
|
16079
|
-
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);
|
|
16080
|
-
var NetworkEndpointSchema = object({
|
|
16294
|
+
label: string(),
|
|
16295
|
+
family: string(),
|
|
16296
|
+
purpose: _enum(["text", "vision"]),
|
|
16081
16297
|
url: string(),
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
-
|
|
16298
|
+
sha256: string(),
|
|
16299
|
+
sizeBytes: number(),
|
|
16300
|
+
quantization: string(),
|
|
16301
|
+
/** Load-time guidance shown in the picker. */
|
|
16302
|
+
minRamBytes: number(),
|
|
16303
|
+
contextSizeDefault: number().int(),
|
|
16304
|
+
/** Vision models: companion projector file. */
|
|
16305
|
+
mmprojUrl: string().optional()
|
|
16085
16306
|
});
|
|
16086
|
-
var
|
|
16087
|
-
|
|
16088
|
-
|
|
16307
|
+
var LlmRuntimeNodeSchema = object({
|
|
16308
|
+
nodeId: string(),
|
|
16309
|
+
reachable: boolean(),
|
|
16310
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
16311
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
16089
16312
|
error: string().optional()
|
|
16090
16313
|
});
|
|
16091
|
-
|
|
16092
|
-
|
|
16093
|
-
|
|
16094
|
-
|
|
16095
|
-
|
|
16096
|
-
|
|
16097
|
-
|
|
16098
|
-
|
|
16099
|
-
|
|
16100
|
-
|
|
16101
|
-
|
|
16102
|
-
|
|
16103
|
-
|
|
16104
|
-
|
|
16105
|
-
|
|
16106
|
-
|
|
16107
|
-
|
|
16108
|
-
|
|
16109
|
-
|
|
16110
|
-
|
|
16314
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
16315
|
+
var ProfileRefInputSchema = object({
|
|
16316
|
+
addonId: string(),
|
|
16317
|
+
profileId: string()
|
|
16318
|
+
});
|
|
16319
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
16320
|
+
kind: "mutation",
|
|
16321
|
+
auth: "admin"
|
|
16322
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16323
|
+
kind: "mutation",
|
|
16324
|
+
auth: "admin"
|
|
16325
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
16326
|
+
kind: "mutation",
|
|
16327
|
+
auth: "admin"
|
|
16328
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
16329
|
+
selector: LlmDefaultSelectorSchema,
|
|
16330
|
+
profileId: string().nullable()
|
|
16331
|
+
}), _void(), {
|
|
16332
|
+
kind: "mutation",
|
|
16333
|
+
auth: "admin"
|
|
16334
|
+
}), method(object({
|
|
16335
|
+
since: number().optional(),
|
|
16336
|
+
until: number().optional(),
|
|
16337
|
+
consumer: string().optional(),
|
|
16338
|
+
profileId: string().optional()
|
|
16339
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16340
|
+
nodeId: string(),
|
|
16341
|
+
model: ManagedModelRefSchema
|
|
16342
|
+
}), _void(), {
|
|
16343
|
+
kind: "mutation",
|
|
16344
|
+
auth: "admin"
|
|
16345
|
+
}), method(object({
|
|
16346
|
+
nodeId: string(),
|
|
16347
|
+
file: string()
|
|
16348
|
+
}), _void(), {
|
|
16349
|
+
kind: "mutation",
|
|
16350
|
+
auth: "admin"
|
|
16351
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16352
|
+
kind: "mutation",
|
|
16353
|
+
auth: "admin"
|
|
16354
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16355
|
+
kind: "mutation",
|
|
16356
|
+
auth: "admin"
|
|
16357
|
+
});
|
|
16358
|
+
var LogLevelSchema = _enum([
|
|
16359
|
+
"debug",
|
|
16360
|
+
"info",
|
|
16361
|
+
"warn",
|
|
16362
|
+
"error"
|
|
16363
|
+
]);
|
|
16364
|
+
var LogEntrySchema = object({
|
|
16365
|
+
timestamp: date(),
|
|
16366
|
+
level: LogLevelSchema,
|
|
16367
|
+
scope: array(string()),
|
|
16368
|
+
message: string(),
|
|
16369
|
+
meta: record(string(), unknown()).optional(),
|
|
16370
|
+
tags: record(string(), string()).optional()
|
|
16111
16371
|
});
|
|
16112
|
-
method(
|
|
16372
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
16373
|
+
scope: array(string()).optional(),
|
|
16374
|
+
level: LogLevelSchema.optional(),
|
|
16375
|
+
since: date().optional(),
|
|
16376
|
+
until: date().optional(),
|
|
16377
|
+
limit: number().optional(),
|
|
16378
|
+
tags: record(string(), string()).optional()
|
|
16379
|
+
}), array(LogEntrySchema).readonly());
|
|
16113
16380
|
/**
|
|
16114
|
-
*
|
|
16381
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
16382
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
16383
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
16384
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
16385
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
16386
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
16115
16387
|
*
|
|
16116
|
-
*
|
|
16117
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
16118
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
16119
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16120
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
16121
|
-
* message to what the kind supports — callers never special-case a service.
|
|
16388
|
+
* A contribution is a discriminated union on `kind`:
|
|
16122
16389
|
*
|
|
16123
|
-
*
|
|
16124
|
-
*
|
|
16125
|
-
* `
|
|
16126
|
-
*
|
|
16127
|
-
*
|
|
16128
|
-
* alternative would fork the UI per addon and cannot host the
|
|
16129
|
-
* discovery→adopt flow.
|
|
16130
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
16131
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
16132
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
16133
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
16134
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
16135
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
16136
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
16137
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
16138
|
-
* base64 fallback needed.
|
|
16390
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
16391
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16392
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
16393
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16394
|
+
* login page needs NO change.
|
|
16139
16395
|
*
|
|
16140
|
-
*
|
|
16141
|
-
*
|
|
16142
|
-
*
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
*
|
|
16146
|
-
*
|
|
16147
|
-
|
|
16148
|
-
|
|
16149
|
-
|
|
16150
|
-
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16155
|
-
|
|
16156
|
-
*
|
|
16157
|
-
*
|
|
16158
|
-
*
|
|
16159
|
-
*
|
|
16396
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
16397
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
16398
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
16399
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
16400
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
16401
|
+
*
|
|
16402
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
16403
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
16404
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
16405
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
16406
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
16407
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
16408
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
16409
|
+
* decision.
|
|
16410
|
+
*
|
|
16411
|
+
* Every contribution carries a `stage`:
|
|
16412
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
16413
|
+
* magic-link buttons; a future usernameless passkey).
|
|
16414
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16415
|
+
* returned `factors` (passkey-as-2FA today).
|
|
16416
|
+
*
|
|
16417
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
16418
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
16419
|
+
* tRPC router.
|
|
16160
16420
|
*/
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
16166
|
-
|
|
16167
|
-
|
|
16168
|
-
|
|
16169
|
-
|
|
16170
|
-
|
|
16171
|
-
|
|
16421
|
+
/** When a login method renders in the two-phase login flow. */
|
|
16422
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
16423
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
16424
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
16425
|
+
object({
|
|
16426
|
+
kind: literal("redirect"),
|
|
16427
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
16428
|
+
id: string(),
|
|
16429
|
+
/** Operator-facing button label. */
|
|
16430
|
+
label: string(),
|
|
16431
|
+
/** lucide-react icon name. */
|
|
16432
|
+
icon: string().optional(),
|
|
16433
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
16434
|
+
startUrl: string(),
|
|
16435
|
+
stage: LoginStageEnum
|
|
16436
|
+
}),
|
|
16437
|
+
object({
|
|
16438
|
+
kind: literal("widget"),
|
|
16439
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
16440
|
+
id: string(),
|
|
16441
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
16442
|
+
addonId: string(),
|
|
16443
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
16444
|
+
bundle: string(),
|
|
16445
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
16446
|
+
remote: WidgetRemoteSchema,
|
|
16447
|
+
stage: LoginStageEnum
|
|
16448
|
+
}),
|
|
16449
|
+
object({
|
|
16450
|
+
kind: literal("passkey"),
|
|
16451
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
16452
|
+
id: string(),
|
|
16453
|
+
/** Operator-facing button label. */
|
|
16454
|
+
label: string(),
|
|
16455
|
+
stage: LoginStageEnum,
|
|
16456
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
16457
|
+
rpId: string(),
|
|
16458
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
16459
|
+
origin: string().nullable()
|
|
16460
|
+
})
|
|
16172
16461
|
]);
|
|
16173
|
-
|
|
16174
|
-
var
|
|
16175
|
-
|
|
16176
|
-
|
|
16177
|
-
|
|
16462
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
16463
|
+
var CpuBreakdownSchema = object({
|
|
16464
|
+
total: number(),
|
|
16465
|
+
user: number(),
|
|
16466
|
+
system: number(),
|
|
16467
|
+
irq: number(),
|
|
16468
|
+
nice: number(),
|
|
16469
|
+
loadAvg: tuple([
|
|
16470
|
+
number(),
|
|
16471
|
+
number(),
|
|
16472
|
+
number()
|
|
16473
|
+
]),
|
|
16474
|
+
cores: number()
|
|
16178
16475
|
});
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
var
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
|
|
16197
|
-
|
|
16198
|
-
|
|
16199
|
-
|
|
16200
|
-
|
|
16201
|
-
|
|
16476
|
+
var MemoryInfoSchema = object({
|
|
16477
|
+
percent: number(),
|
|
16478
|
+
totalBytes: number(),
|
|
16479
|
+
usedBytes: number(),
|
|
16480
|
+
availableBytes: number(),
|
|
16481
|
+
swapUsedBytes: number(),
|
|
16482
|
+
swapTotalBytes: number()
|
|
16483
|
+
});
|
|
16484
|
+
var DiskIoSnapshotSchema = object({
|
|
16485
|
+
readBytes: number(),
|
|
16486
|
+
writeBytes: number(),
|
|
16487
|
+
readOps: number(),
|
|
16488
|
+
writeOps: number(),
|
|
16489
|
+
timestampMs: number()
|
|
16490
|
+
});
|
|
16491
|
+
var NetworkIoSnapshotSchema = object({
|
|
16492
|
+
rxBytes: number(),
|
|
16493
|
+
txBytes: number(),
|
|
16494
|
+
rxPackets: number(),
|
|
16495
|
+
txPackets: number(),
|
|
16496
|
+
rxErrors: number(),
|
|
16497
|
+
txErrors: number(),
|
|
16498
|
+
timestampMs: number()
|
|
16499
|
+
});
|
|
16500
|
+
var MetricsGpuInfoSchema = object({
|
|
16501
|
+
utilization: number(),
|
|
16502
|
+
model: string(),
|
|
16503
|
+
memoryUsedBytes: number(),
|
|
16504
|
+
memoryTotalBytes: number(),
|
|
16505
|
+
temperature: number().nullable()
|
|
16506
|
+
});
|
|
16507
|
+
var ProcessResourceInfoSchema = object({
|
|
16508
|
+
openFds: number(),
|
|
16509
|
+
threadCount: number(),
|
|
16510
|
+
activeHandles: number(),
|
|
16511
|
+
activeRequests: number()
|
|
16202
16512
|
});
|
|
16203
|
-
|
|
16204
|
-
|
|
16205
|
-
|
|
16206
|
-
|
|
16207
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
16208
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
16209
|
-
flags: object({
|
|
16210
|
-
critical: boolean().optional(),
|
|
16211
|
-
silent: boolean().optional(),
|
|
16212
|
-
noPush: boolean().optional()
|
|
16213
|
-
}).optional(),
|
|
16214
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
16215
|
-
requires: array(string()).optional(),
|
|
16216
|
-
description: string().optional()
|
|
16513
|
+
var PressureAvgsSchema = object({
|
|
16514
|
+
avg10: number(),
|
|
16515
|
+
avg60: number(),
|
|
16516
|
+
avg300: number()
|
|
16217
16517
|
});
|
|
16218
|
-
|
|
16219
|
-
|
|
16220
|
-
|
|
16221
|
-
|
|
16222
|
-
|
|
16223
|
-
|
|
16224
|
-
|
|
16225
|
-
|
|
16226
|
-
|
|
16227
|
-
|
|
16228
|
-
|
|
16518
|
+
var PressureInfoSchema = object({
|
|
16519
|
+
some: PressureAvgsSchema,
|
|
16520
|
+
full: PressureAvgsSchema.nullable()
|
|
16521
|
+
});
|
|
16522
|
+
var SystemResourceSnapshotSchema = object({
|
|
16523
|
+
cpu: CpuBreakdownSchema,
|
|
16524
|
+
memory: MemoryInfoSchema,
|
|
16525
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
16526
|
+
network: NetworkIoSnapshotSchema,
|
|
16527
|
+
disk: DiskIoSnapshotSchema,
|
|
16528
|
+
pressure: object({
|
|
16529
|
+
cpu: PressureInfoSchema.nullable(),
|
|
16530
|
+
memory: PressureInfoSchema.nullable(),
|
|
16531
|
+
io: PressureInfoSchema.nullable()
|
|
16229
16532
|
}),
|
|
16230
|
-
|
|
16231
|
-
|
|
16232
|
-
|
|
16233
|
-
format: array(NotificationFormatSchema),
|
|
16234
|
-
clickUrl: boolean(),
|
|
16235
|
-
sound: boolean(),
|
|
16236
|
-
ttl: boolean(),
|
|
16237
|
-
bodyMaxLen: number().int().positive()
|
|
16533
|
+
process: ProcessResourceInfoSchema,
|
|
16534
|
+
cpuTemperature: number().nullable(),
|
|
16535
|
+
timestampMs: number()
|
|
16238
16536
|
});
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
*/
|
|
16246
|
-
var ConfigSchemaPassthrough = unknown();
|
|
16247
|
-
var TargetKindSchema = object({
|
|
16248
|
-
kind: string(),
|
|
16249
|
-
label: string(),
|
|
16250
|
-
icon: string(),
|
|
16251
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16252
|
-
addonId: string(),
|
|
16253
|
-
configSchema: ConfigSchemaPassthrough,
|
|
16254
|
-
supportsDiscovery: boolean(),
|
|
16255
|
-
caps: TargetKindCapsSchema
|
|
16537
|
+
var DiskSpaceInfoSchema = object({
|
|
16538
|
+
path: string(),
|
|
16539
|
+
totalBytes: number(),
|
|
16540
|
+
usedBytes: number(),
|
|
16541
|
+
availableBytes: number(),
|
|
16542
|
+
percent: number()
|
|
16256
16543
|
});
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
|
|
16260
|
-
|
|
16261
|
-
|
|
16262
|
-
|
|
16263
|
-
|
|
16264
|
-
|
|
16265
|
-
|
|
16544
|
+
var PidResourceStatsSchema = object({
|
|
16545
|
+
pid: number(),
|
|
16546
|
+
cpu: number(),
|
|
16547
|
+
memory: number(),
|
|
16548
|
+
/**
|
|
16549
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
16550
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
16551
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
16552
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
16553
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
16554
|
+
*/
|
|
16555
|
+
privateBytes: number().optional(),
|
|
16556
|
+
/**
|
|
16557
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
16558
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
16559
|
+
*/
|
|
16560
|
+
sharedBytes: number().optional()
|
|
16561
|
+
});
|
|
16562
|
+
var AddonInstanceSchema = object({
|
|
16266
16563
|
addonId: string(),
|
|
16267
|
-
|
|
16268
|
-
|
|
16564
|
+
nodeId: string(),
|
|
16565
|
+
role: _enum(["hub", "worker"]),
|
|
16566
|
+
pid: number(),
|
|
16567
|
+
state: _enum([
|
|
16568
|
+
"starting",
|
|
16569
|
+
"running",
|
|
16570
|
+
"stopping",
|
|
16571
|
+
"stopped",
|
|
16572
|
+
"crashed"
|
|
16573
|
+
]),
|
|
16574
|
+
uptimeSec: number()
|
|
16269
16575
|
});
|
|
16270
|
-
|
|
16271
|
-
|
|
16272
|
-
|
|
16273
|
-
|
|
16274
|
-
|
|
16576
|
+
var NodeProcessSchema = object({
|
|
16577
|
+
pid: number(),
|
|
16578
|
+
ppid: number(),
|
|
16579
|
+
pgid: number(),
|
|
16580
|
+
classification: _enum([
|
|
16581
|
+
"root",
|
|
16582
|
+
"managed",
|
|
16583
|
+
"system",
|
|
16584
|
+
"ghost"
|
|
16585
|
+
]),
|
|
16586
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
16587
|
+
addonId: string().nullable(),
|
|
16588
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
16589
|
+
nodeId: string().nullable(),
|
|
16590
|
+
/** Truncated command line. */
|
|
16591
|
+
command: string(),
|
|
16592
|
+
cpuPercent: number(),
|
|
16593
|
+
memoryRssBytes: number(),
|
|
16594
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
16595
|
+
uptimeSec: number(),
|
|
16596
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
16597
|
+
orphaned: boolean()
|
|
16275
16598
|
});
|
|
16276
|
-
|
|
16277
|
-
|
|
16278
|
-
|
|
16279
|
-
|
|
16280
|
-
attachmentsSent: number().int().nonnegative(),
|
|
16281
|
-
actionsSent: number().int().nonnegative(),
|
|
16282
|
-
truncated: boolean(),
|
|
16283
|
-
dropped: array(string())
|
|
16599
|
+
var KillProcessInputSchema = object({
|
|
16600
|
+
pid: number(),
|
|
16601
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
16602
|
+
force: boolean().optional()
|
|
16284
16603
|
});
|
|
16285
|
-
var
|
|
16604
|
+
var KillProcessResultSchema = object({
|
|
16286
16605
|
success: boolean(),
|
|
16287
|
-
|
|
16288
|
-
|
|
16606
|
+
reason: string().optional(),
|
|
16607
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
16608
|
+
});
|
|
16609
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
16610
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
16611
|
+
addonId: string() });
|
|
16612
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
16613
|
+
success: boolean(),
|
|
16614
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
16615
|
+
path: string().optional(),
|
|
16616
|
+
/** Process pid that was signalled. */
|
|
16617
|
+
pid: number().optional(),
|
|
16618
|
+
reason: string().optional()
|
|
16619
|
+
});
|
|
16620
|
+
var SystemMetricsSchema = object({
|
|
16621
|
+
cpuPercent: number(),
|
|
16622
|
+
memoryPercent: number(),
|
|
16623
|
+
memoryUsedMB: number(),
|
|
16624
|
+
memoryTotalMB: number(),
|
|
16625
|
+
diskPercent: number().optional(),
|
|
16626
|
+
temperature: number().optional(),
|
|
16627
|
+
gpuPercent: number().optional(),
|
|
16628
|
+
gpuMemoryPercent: number().optional()
|
|
16629
|
+
});
|
|
16630
|
+
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, {
|
|
16631
|
+
kind: "mutation",
|
|
16632
|
+
auth: "admin"
|
|
16633
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
16634
|
+
kind: "mutation",
|
|
16635
|
+
auth: "admin"
|
|
16636
|
+
});
|
|
16637
|
+
method(object({
|
|
16638
|
+
sourceUrl: string(),
|
|
16639
|
+
metadata: ModelConvertMetadataSchema,
|
|
16640
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
16641
|
+
calibrationRef: string().optional(),
|
|
16642
|
+
sessionId: string().optional()
|
|
16643
|
+
}), ConvertResultSchema, {
|
|
16644
|
+
kind: "mutation",
|
|
16645
|
+
auth: "admin",
|
|
16646
|
+
timeoutMs: 6e5
|
|
16647
|
+
});
|
|
16648
|
+
method(object({
|
|
16649
|
+
nodeId: string(),
|
|
16650
|
+
modelId: string(),
|
|
16651
|
+
format: _enum(MODEL_FORMATS),
|
|
16652
|
+
entry: ModelCatalogEntrySchema
|
|
16653
|
+
}), object({
|
|
16654
|
+
ok: boolean(),
|
|
16655
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
16656
|
+
sha256: string(),
|
|
16657
|
+
bytes: number(),
|
|
16658
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
16659
|
+
path: string()
|
|
16660
|
+
}), {
|
|
16661
|
+
kind: "mutation",
|
|
16662
|
+
auth: "admin"
|
|
16289
16663
|
});
|
|
16290
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
16291
|
-
var TestResultSchema = SendResultSchema;
|
|
16292
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
16293
|
-
kind: string(),
|
|
16294
|
-
config: record(string(), unknown()).optional()
|
|
16295
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
16296
|
-
targetId: string(),
|
|
16297
|
-
notification: NotificationSchema
|
|
16298
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
16299
|
-
targetId: string(),
|
|
16300
|
-
sample: NotificationSchema.optional()
|
|
16301
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16302
|
-
targetId: string(),
|
|
16303
|
-
enabled: boolean()
|
|
16304
|
-
}), _void(), { kind: "mutation" });
|
|
16305
16664
|
/**
|
|
16306
|
-
*
|
|
16307
|
-
*
|
|
16308
|
-
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
16309
|
-
* (operator decisions D-1/D-2/D-3 are binding):
|
|
16665
|
+
* `mqtt-broker` — broker-registry cap.
|
|
16310
16666
|
*
|
|
16311
|
-
*
|
|
16312
|
-
*
|
|
16313
|
-
*
|
|
16314
|
-
*
|
|
16315
|
-
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
16316
|
-
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
16317
|
-
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
16318
|
-
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
16319
|
-
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
16320
|
-
* by id; per-backend params are a passthrough blob capped by the
|
|
16321
|
-
* target kind's own caps/degrade engine).
|
|
16667
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
16668
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
16669
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
16670
|
+
* its OWN `mqtt.js` client.
|
|
16322
16671
|
*
|
|
16323
|
-
*
|
|
16324
|
-
*
|
|
16325
|
-
*
|
|
16326
|
-
*
|
|
16327
|
-
*
|
|
16328
|
-
* private zones, per-recipient fan-out and the wider condition table are
|
|
16329
|
-
* P2+ (see spec §7).
|
|
16672
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
16673
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
16674
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
16675
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
16676
|
+
* features anyway — give it the connection config, get out of the way.
|
|
16330
16677
|
*
|
|
16331
|
-
*
|
|
16332
|
-
*
|
|
16333
|
-
*
|
|
16678
|
+
* Consumer flow:
|
|
16679
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
16680
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
16681
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
16682
|
+
*
|
|
16683
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
16684
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
16685
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
16686
|
+
* spawned it.
|
|
16334
16687
|
*/
|
|
16688
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
16335
16689
|
/**
|
|
16336
|
-
*
|
|
16337
|
-
* The value maps 1:1 onto the evaluated record kind:
|
|
16338
|
-
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
16339
|
-
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
16340
|
-
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
16341
|
-
* change of a LINKED device, one row per linked camera)
|
|
16342
|
-
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
16343
|
-
* delivery / pick-up)
|
|
16690
|
+
* Broker live-probe status.
|
|
16344
16691
|
*
|
|
16345
|
-
*
|
|
16346
|
-
*
|
|
16347
|
-
*
|
|
16348
|
-
*
|
|
16692
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
16693
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
16694
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
16695
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
16696
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16349
16697
|
*/
|
|
16350
|
-
var
|
|
16351
|
-
"
|
|
16352
|
-
"
|
|
16353
|
-
"
|
|
16354
|
-
"
|
|
16698
|
+
var BrokerStatusSchema$1 = _enum([
|
|
16699
|
+
"connected",
|
|
16700
|
+
"disconnected",
|
|
16701
|
+
"auth-failed",
|
|
16702
|
+
"unreachable",
|
|
16703
|
+
"tls-error"
|
|
16355
16704
|
]);
|
|
16356
|
-
|
|
16357
|
-
|
|
16358
|
-
|
|
16359
|
-
|
|
16360
|
-
|
|
16361
|
-
|
|
16362
|
-
|
|
16363
|
-
|
|
16364
|
-
/**
|
|
16365
|
-
|
|
16366
|
-
/**
|
|
16367
|
-
|
|
16368
|
-
});
|
|
16369
|
-
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
16370
|
-
var NcPlateMatcherSchema = object({
|
|
16371
|
-
values: array(string().min(1)).min(1),
|
|
16372
|
-
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
16373
|
-
maxDistance: number().int().min(0).max(3).default(1)
|
|
16374
|
-
});
|
|
16375
|
-
/**
|
|
16376
|
-
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
16377
|
-
* occupancy edge for a device — optionally narrowed to a single admin
|
|
16378
|
-
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
16379
|
-
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
16380
|
-
* - `became-free` — count crossed ≥ `count` → below it
|
|
16381
|
-
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
16382
|
-
* `sustainSeconds` requires the condition hold continuously that long
|
|
16383
|
-
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
16384
|
-
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
16385
|
-
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
16386
|
-
* (declared SQLite collection, reseeded on boot).
|
|
16387
|
-
*/
|
|
16388
|
-
var NcOccupancyConditionSchema = object({
|
|
16389
|
-
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
16390
|
-
zoneId: string().optional(),
|
|
16391
|
-
/** Object class to count; absent = any class. */
|
|
16392
|
-
className: string().optional(),
|
|
16393
|
-
op: _enum([
|
|
16394
|
-
"became-occupied",
|
|
16395
|
-
"became-free",
|
|
16396
|
-
">=",
|
|
16397
|
-
"<="
|
|
16398
|
-
]).default("became-occupied"),
|
|
16399
|
-
count: number().int().min(0).default(1),
|
|
16400
|
-
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
16401
|
-
});
|
|
16402
|
-
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
16403
|
-
var NcZoneConditionSchema = object({
|
|
16404
|
-
ids: array(string().min(1)).min(1),
|
|
16405
|
-
/** Quantifier over `ids` — at least one / every one visited. */
|
|
16406
|
-
match: _enum(["any", "all"]).default("any")
|
|
16407
|
-
});
|
|
16408
|
-
/**
|
|
16409
|
-
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
16410
|
-
* membership lists are OR within the list (spec §2.3).
|
|
16411
|
-
*/
|
|
16412
|
-
var NcConditionsSchema = object({
|
|
16413
|
-
/** Device scope — absent = all devices. */
|
|
16414
|
-
devices: array(number()).optional(),
|
|
16415
|
-
/** Detector class names (any overlap with the record's class set). */
|
|
16416
|
-
classes: array(string().min(1)).optional(),
|
|
16417
|
-
/** Veto classes — any overlap fails the rule. */
|
|
16418
|
-
classesExclude: array(string().min(1)).optional(),
|
|
16419
|
-
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
16420
|
-
minConfidence: number().min(0).max(1).optional(),
|
|
16421
|
-
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
16422
|
-
zones: NcZoneConditionSchema.optional(),
|
|
16423
|
-
/** Veto zones — any hit fails the rule. */
|
|
16424
|
-
zonesExclude: array(string().min(1)).optional(),
|
|
16425
|
-
/**
|
|
16426
|
-
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
16427
|
-
* (identity name / plate text / subclass).
|
|
16428
|
-
*/
|
|
16429
|
-
labelEquals: array(string().min(1)).optional(),
|
|
16430
|
-
/**
|
|
16431
|
-
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
16432
|
-
* `label` (the identity display name propagated by the face pipeline) —
|
|
16433
|
-
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
16434
|
-
*/
|
|
16435
|
-
identities: array(string().min(1)).optional(),
|
|
16436
|
-
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
16437
|
-
plates: NcPlateMatcherSchema.optional(),
|
|
16438
|
-
/**
|
|
16439
|
-
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
16440
|
-
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
16441
|
-
* identity display name). A record with NO label passes (nothing to
|
|
16442
|
-
* exclude), unlike the include variant which fails on an absent label.
|
|
16443
|
-
*/
|
|
16444
|
-
identitiesExclude: array(string().min(1)).optional(),
|
|
16445
|
-
/**
|
|
16446
|
-
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
16447
|
-
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
16448
|
-
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
16449
|
-
* close the value is threaded via the close-time info (the `Track` clone is
|
|
16450
|
-
* captured before the DB row is updated, so it would otherwise read stale).
|
|
16451
|
-
* Fails when the record carries no importance (never guess quality — the
|
|
16452
|
-
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
16453
|
-
*/
|
|
16454
|
-
minImportance: number().min(0).max(1).optional(),
|
|
16455
|
-
/**
|
|
16456
|
-
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
16457
|
-
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
16458
|
-
* lifespan, so a dwell condition never matches immediate delivery
|
|
16459
|
-
* (documented choice — the object-event record carries no `firstSeen`,
|
|
16460
|
-
* so dwell cannot be computed from what the subject actually carries).
|
|
16461
|
-
*/
|
|
16462
|
-
minDwellSeconds: number().min(0).optional(),
|
|
16463
|
-
/**
|
|
16464
|
-
* Detection provenance filter. `any` (default / absent) matches every
|
|
16465
|
-
* source; otherwise the subject's source must equal it. Legacy records
|
|
16466
|
-
* with no stamped source are treated as `pipeline`. The union spans both
|
|
16467
|
-
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
16468
|
-
* tracks carry `sensor`.
|
|
16469
|
-
*/
|
|
16470
|
-
source: _enum([
|
|
16471
|
-
"pipeline",
|
|
16472
|
-
"onboard",
|
|
16473
|
-
"sensor",
|
|
16474
|
-
"any"
|
|
16475
|
-
]).optional(),
|
|
16476
|
-
/**
|
|
16477
|
-
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
16478
|
-
* detector `minConfidence` (that gates the object-detection score; this
|
|
16479
|
-
* gates the recognition/OCR match score). Fails when the subject carries
|
|
16480
|
-
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
16481
|
-
* lives on the recognition result and reaches the subject at track close.
|
|
16482
|
-
*
|
|
16483
|
-
* What it measures precisely (plumbed at track close — the closer threads
|
|
16484
|
-
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
16485
|
-
* `importance`): the BEST recognition match confidence observed for the
|
|
16486
|
-
* label the track carries at close — for a face, the peak cosine similarity
|
|
16487
|
-
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
16488
|
-
* for a plate, the peak OCR read score of the best-held plate
|
|
16489
|
-
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
16490
|
-
* one track the higher of the two is used. A track that ended with no
|
|
16491
|
-
* confident identity/plate match carries no value, so the condition fails
|
|
16492
|
-
* closed for it (an un-recognized subject).
|
|
16493
|
-
*/
|
|
16494
|
-
minLabelConfidence: number().min(0).max(1).optional(),
|
|
16495
|
-
/**
|
|
16496
|
-
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
16497
|
-
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
16498
|
-
* against the token carried on the device-event subject (extracted from the
|
|
16499
|
-
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
16500
|
-
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
16501
|
-
* eventType, so gate those with {@link sensorKinds} instead.
|
|
16502
|
-
*/
|
|
16503
|
-
eventTypeTokens: array(string().min(1)).optional(),
|
|
16504
|
-
/**
|
|
16505
|
-
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
16506
|
-
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
16507
|
-
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
16508
|
-
*/
|
|
16509
|
-
sensorKinds: array(string().min(1)).optional(),
|
|
16510
|
-
/**
|
|
16511
|
-
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
16512
|
-
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
16513
|
-
* when the subject's phase does not match (a subject always carries a phase
|
|
16514
|
-
* on the package-event trigger).
|
|
16515
|
-
*/
|
|
16516
|
-
packagePhase: _enum([
|
|
16517
|
-
"delivered",
|
|
16518
|
-
"picked-up",
|
|
16519
|
-
"both"
|
|
16520
|
-
]).optional(),
|
|
16521
|
-
/**
|
|
16522
|
-
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
16523
|
-
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
16524
|
-
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
16525
|
-
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
16526
|
-
*/
|
|
16527
|
-
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
16528
|
-
/**
|
|
16529
|
-
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
16530
|
-
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
16531
|
-
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
16532
|
-
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
16533
|
-
*/
|
|
16534
|
-
occupancy: NcOccupancyConditionSchema.optional()
|
|
16535
|
-
});
|
|
16536
|
-
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
16537
|
-
var NcRuleTargetSchema = object({
|
|
16538
|
-
/** `notification-output` Target id. */
|
|
16539
|
-
targetId: string().min(1),
|
|
16540
|
-
/**
|
|
16541
|
-
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
16542
|
-
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
16543
|
-
* degrade engine drops what the backend can't render.
|
|
16544
|
-
*/
|
|
16545
|
-
params: record(string(), unknown()).optional()
|
|
16705
|
+
var BrokerInfoSchema = object({
|
|
16706
|
+
id: string(),
|
|
16707
|
+
name: string(),
|
|
16708
|
+
url: string(),
|
|
16709
|
+
kind: BrokerKindSchema,
|
|
16710
|
+
status: BrokerStatusSchema$1,
|
|
16711
|
+
latencyMs: number().nullable(),
|
|
16712
|
+
error: string().optional(),
|
|
16713
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
16714
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
16715
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
16716
|
+
lastCheckedAt: number().optional()
|
|
16546
16717
|
});
|
|
16547
16718
|
/**
|
|
16548
|
-
*
|
|
16549
|
-
*
|
|
16550
|
-
*
|
|
16551
|
-
*
|
|
16552
|
-
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
16553
|
-
* (or when the specific crop is missing) degrades to `best`, then
|
|
16554
|
-
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
16555
|
-
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
16556
|
-
* name), so the choice never drifts from the record that fired it.
|
|
16557
|
-
* - `keyFrame` — the clean scene frame (no subject box).
|
|
16558
|
-
* - `none` — no attachment.
|
|
16719
|
+
* Connection details — what a consumer needs to call
|
|
16720
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
16721
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
16722
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
16559
16723
|
*/
|
|
16560
|
-
var
|
|
16561
|
-
|
|
16562
|
-
|
|
16563
|
-
|
|
16564
|
-
"none"
|
|
16565
|
-
]).default("best") });
|
|
16566
|
-
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
16567
|
-
var NcThrottleSchema = object({
|
|
16568
|
-
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
16569
|
-
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
16570
|
-
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
16571
|
-
});
|
|
16572
|
-
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
16573
|
-
var NcRuleInputSchema = object({
|
|
16574
|
-
name: string().min(1).max(200),
|
|
16575
|
-
enabled: boolean().default(true),
|
|
16576
|
-
delivery: NcDeliverySchema,
|
|
16577
|
-
conditions: NcConditionsSchema.default({}),
|
|
16578
|
-
schedule: NcScheduleSchema.optional(),
|
|
16579
|
-
targets: array(NcRuleTargetSchema).min(1),
|
|
16580
|
-
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
16581
|
-
throttle: NcThrottleSchema.default({
|
|
16582
|
-
cooldownSec: 60,
|
|
16583
|
-
scope: "rule-device"
|
|
16584
|
-
}),
|
|
16585
|
-
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
16586
|
-
template: object({
|
|
16587
|
-
title: string().max(500).optional(),
|
|
16588
|
-
body: string().max(2e3).optional()
|
|
16589
|
-
}).optional(),
|
|
16590
|
-
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
16591
|
-
priority: number().int().min(1).max(5).default(3),
|
|
16724
|
+
var BrokerConnectionDetailsSchema = object({
|
|
16725
|
+
url: string(),
|
|
16726
|
+
username: string().optional(),
|
|
16727
|
+
password: string().optional(),
|
|
16592
16728
|
/**
|
|
16593
|
-
*
|
|
16594
|
-
*
|
|
16595
|
-
*
|
|
16729
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
16730
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
16731
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
16732
|
+
* broker).
|
|
16596
16733
|
*/
|
|
16597
|
-
|
|
16734
|
+
clientIdPrefix: string().optional()
|
|
16735
|
+
});
|
|
16736
|
+
var AddBrokerInputSchema = object({
|
|
16737
|
+
name: string().min(1),
|
|
16738
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
16739
|
+
username: string().optional(),
|
|
16740
|
+
password: string().optional(),
|
|
16741
|
+
clientIdPrefix: string().optional()
|
|
16742
|
+
});
|
|
16743
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
16744
|
+
var IdInputSchema = object({ id: string() });
|
|
16745
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
16746
|
+
ok: literal(true),
|
|
16747
|
+
latencyMs: number()
|
|
16748
|
+
}), object({
|
|
16749
|
+
ok: literal(false),
|
|
16750
|
+
error: string()
|
|
16751
|
+
})]);
|
|
16752
|
+
var StartEmbeddedInputSchema = object({
|
|
16753
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
16754
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
16755
|
+
allowAnonymous: boolean().default(false),
|
|
16756
|
+
/** Optional shared username/password for clients. */
|
|
16757
|
+
username: string().optional(),
|
|
16758
|
+
password: string().optional()
|
|
16759
|
+
});
|
|
16760
|
+
var StartEmbeddedResultSchema = object({
|
|
16761
|
+
id: string(),
|
|
16762
|
+
url: string()
|
|
16763
|
+
});
|
|
16764
|
+
var StatusSchema = object({
|
|
16765
|
+
brokerCount: number(),
|
|
16766
|
+
embeddedRunning: boolean()
|
|
16767
|
+
});
|
|
16768
|
+
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);
|
|
16769
|
+
var NetworkEndpointSchema = object({
|
|
16770
|
+
url: string(),
|
|
16771
|
+
hostname: string(),
|
|
16772
|
+
port: number(),
|
|
16773
|
+
protocol: _enum(["http", "https"])
|
|
16774
|
+
});
|
|
16775
|
+
var NetworkAccessStatusSchema = object({
|
|
16776
|
+
connected: boolean(),
|
|
16777
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
16778
|
+
error: string().optional()
|
|
16598
16779
|
});
|
|
16599
16780
|
/**
|
|
16600
|
-
*
|
|
16601
|
-
*
|
|
16602
|
-
*
|
|
16603
|
-
*
|
|
16604
|
-
*
|
|
16605
|
-
*
|
|
16606
|
-
* `updateRule` patch.
|
|
16781
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
16782
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
16783
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
16784
|
+
* the originating provider config (mode + sourcePort) so the
|
|
16785
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
16786
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
16607
16787
|
*/
|
|
16608
|
-
var
|
|
16609
|
-
/** A persisted rule. */
|
|
16610
|
-
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
16611
|
-
id: string(),
|
|
16612
|
-
/** userId of the admin who created the rule (server-stamped caller). */
|
|
16613
|
-
createdBy: string(),
|
|
16614
|
-
createdAt: number(),
|
|
16615
|
-
updatedAt: number(),
|
|
16788
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
16616
16789
|
/**
|
|
16617
|
-
*
|
|
16618
|
-
*
|
|
16619
|
-
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
16790
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
16791
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
16620
16792
|
*/
|
|
16621
|
-
|
|
16622
|
-
|
|
16623
|
-
|
|
16624
|
-
|
|
16625
|
-
|
|
16626
|
-
|
|
16627
|
-
|
|
16628
|
-
"device-event",
|
|
16629
|
-
"package-event"
|
|
16630
|
-
]),
|
|
16631
|
-
deviceId: number(),
|
|
16632
|
-
timestamp: number(),
|
|
16633
|
-
wouldFire: boolean(),
|
|
16634
|
-
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
16635
|
-
failedCondition: string().optional(),
|
|
16636
|
-
className: string().optional(),
|
|
16637
|
-
label: string().optional()
|
|
16793
|
+
id: string(),
|
|
16794
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
16795
|
+
label: string(),
|
|
16796
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
16797
|
+
mode: string().optional(),
|
|
16798
|
+
/** Originating local port the ingress fronts (informational). */
|
|
16799
|
+
sourcePort: number().optional()
|
|
16638
16800
|
});
|
|
16639
|
-
|
|
16640
|
-
|
|
16801
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
16802
|
+
/**
|
|
16803
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
16804
|
+
*
|
|
16805
|
+
* Apprise-derived model (see
|
|
16806
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
16807
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
16808
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16809
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
16810
|
+
* message to what the kind supports — callers never special-case a service.
|
|
16811
|
+
*
|
|
16812
|
+
* DESIGN DECISIONS (locked):
|
|
16813
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
16814
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
16815
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
16816
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
16817
|
+
* alternative would fork the UI per addon and cannot host the
|
|
16818
|
+
* discovery→adopt flow.
|
|
16819
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
16820
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
16821
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
16822
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
16823
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
16824
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
16825
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
16826
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
16827
|
+
* base64 fallback needed.
|
|
16828
|
+
*
|
|
16829
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
16830
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
16831
|
+
* admin "Integrations" page.
|
|
16832
|
+
*/
|
|
16833
|
+
/**
|
|
16834
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
16835
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
16836
|
+
*/
|
|
16837
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
16838
|
+
"image",
|
|
16839
|
+
"video",
|
|
16840
|
+
"gif",
|
|
16841
|
+
"audio",
|
|
16842
|
+
"icon"
|
|
16843
|
+
]);
|
|
16844
|
+
/**
|
|
16845
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
16846
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
16847
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
16848
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
16849
|
+
*/
|
|
16850
|
+
var AttachmentSchema = object({
|
|
16851
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
16852
|
+
url: string().optional(),
|
|
16853
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
16854
|
+
mime: string().optional(),
|
|
16855
|
+
name: string().optional()
|
|
16856
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
16857
|
+
var NotificationFormatSchema = _enum([
|
|
16858
|
+
"text",
|
|
16859
|
+
"markdown",
|
|
16860
|
+
"html"
|
|
16861
|
+
]);
|
|
16862
|
+
/** A single tap-through action button. */
|
|
16863
|
+
var NotificationActionSchema = object({
|
|
16864
|
+
id: string(),
|
|
16865
|
+
label: string(),
|
|
16866
|
+
url: string().optional()
|
|
16867
|
+
});
|
|
16868
|
+
/**
|
|
16869
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
16870
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
16871
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
16872
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
16873
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
16874
|
+
* `priority` for that one target.
|
|
16875
|
+
*/
|
|
16876
|
+
var NotificationSchema = object({
|
|
16877
|
+
body: string(),
|
|
16878
|
+
title: string().optional(),
|
|
16879
|
+
format: NotificationFormatSchema.default("text"),
|
|
16880
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16881
|
+
level: string().optional(),
|
|
16882
|
+
attachments: array(AttachmentSchema).optional(),
|
|
16883
|
+
clickUrl: string().optional(),
|
|
16884
|
+
actions: array(NotificationActionSchema).optional(),
|
|
16885
|
+
sound: string().optional(),
|
|
16886
|
+
ttl: number().optional(),
|
|
16887
|
+
tag: string().optional(),
|
|
16888
|
+
deviceId: number().optional(),
|
|
16889
|
+
eventId: string().optional(),
|
|
16890
|
+
metadata: record(string(), unknown()).optional()
|
|
16891
|
+
});
|
|
16892
|
+
/** One declared native severity/priority level for a kind. */
|
|
16893
|
+
var TargetKindLevelSchema = object({
|
|
16641
16894
|
id: string(),
|
|
16642
|
-
group: _enum([
|
|
16643
|
-
"scope",
|
|
16644
|
-
"class",
|
|
16645
|
-
"zones",
|
|
16646
|
-
"quality",
|
|
16647
|
-
"label",
|
|
16648
|
-
"schedule",
|
|
16649
|
-
"device",
|
|
16650
|
-
"package",
|
|
16651
|
-
"occupancy"
|
|
16652
|
-
]),
|
|
16653
16895
|
label: string(),
|
|
16654
|
-
/**
|
|
16655
|
-
|
|
16656
|
-
|
|
16657
|
-
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
16661
|
-
|
|
16662
|
-
|
|
16663
|
-
"schedule",
|
|
16664
|
-
"plateMatcher",
|
|
16665
|
-
"packagePhase",
|
|
16666
|
-
"polygonDraw",
|
|
16667
|
-
"occupancy"
|
|
16668
|
-
]),
|
|
16669
|
-
operator: _enum([
|
|
16670
|
-
"in",
|
|
16671
|
-
"notIn",
|
|
16672
|
-
"anyOf",
|
|
16673
|
-
"allOf",
|
|
16674
|
-
"gte",
|
|
16675
|
-
"fuzzyIn",
|
|
16676
|
-
"withinSchedule"
|
|
16677
|
-
]),
|
|
16678
|
-
/** Which delivery kinds the condition applies to. */
|
|
16679
|
-
appliesTo: array(NcDeliverySchema),
|
|
16680
|
-
phase: string(),
|
|
16896
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
16897
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
16898
|
+
flags: object({
|
|
16899
|
+
critical: boolean().optional(),
|
|
16900
|
+
silent: boolean().optional(),
|
|
16901
|
+
noPush: boolean().optional()
|
|
16902
|
+
}).optional(),
|
|
16903
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
16904
|
+
requires: array(string()).optional(),
|
|
16681
16905
|
description: string().optional()
|
|
16682
16906
|
});
|
|
16907
|
+
/** The full capability block consulted before dispatch. */
|
|
16908
|
+
var TargetKindCapsSchema = object({
|
|
16909
|
+
attachments: object({
|
|
16910
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
16911
|
+
mode: _enum([
|
|
16912
|
+
"url",
|
|
16913
|
+
"bytes",
|
|
16914
|
+
"both"
|
|
16915
|
+
]),
|
|
16916
|
+
max: number().int().nonnegative(),
|
|
16917
|
+
maxBytes: number().int().positive().optional()
|
|
16918
|
+
}),
|
|
16919
|
+
/** Max action buttons (0 = none). */
|
|
16920
|
+
actions: number().int().nonnegative(),
|
|
16921
|
+
levels: array(TargetKindLevelSchema),
|
|
16922
|
+
format: array(NotificationFormatSchema),
|
|
16923
|
+
clickUrl: boolean(),
|
|
16924
|
+
sound: boolean(),
|
|
16925
|
+
ttl: boolean(),
|
|
16926
|
+
bodyMaxLen: number().int().positive()
|
|
16927
|
+
});
|
|
16683
16928
|
/**
|
|
16684
|
-
*
|
|
16685
|
-
*
|
|
16686
|
-
*
|
|
16687
|
-
*
|
|
16688
|
-
*
|
|
16689
|
-
* backend rejection / a deleted target (terminal; carries
|
|
16690
|
-
* the failure `error`)
|
|
16691
|
-
*
|
|
16692
|
-
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
16693
|
-
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
16929
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
16930
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
16931
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
16932
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
16933
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
16694
16934
|
*/
|
|
16695
|
-
var
|
|
16696
|
-
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
/**
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
|
|
16704
|
-
|
|
16705
|
-
"package-event"
|
|
16706
|
-
]);
|
|
16707
|
-
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
16708
|
-
var NcHistorySubjectSchema = object({
|
|
16709
|
-
className: string(),
|
|
16710
|
-
label: string().optional(),
|
|
16711
|
-
confidence: number().optional(),
|
|
16712
|
-
zones: array(string()),
|
|
16713
|
-
timestamp: number()
|
|
16935
|
+
var ConfigSchemaPassthrough = unknown();
|
|
16936
|
+
var TargetKindSchema = object({
|
|
16937
|
+
kind: string(),
|
|
16938
|
+
label: string(),
|
|
16939
|
+
icon: string(),
|
|
16940
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16941
|
+
addonId: string(),
|
|
16942
|
+
configSchema: ConfigSchemaPassthrough,
|
|
16943
|
+
supportsDiscovery: boolean(),
|
|
16944
|
+
caps: TargetKindCapsSchema
|
|
16714
16945
|
});
|
|
16715
16946
|
/**
|
|
16716
|
-
*
|
|
16717
|
-
*
|
|
16718
|
-
*
|
|
16719
|
-
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
16720
|
-
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
16721
|
-
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
16722
|
-
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
16723
|
-
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
16724
|
-
* P1 (admin scope only).
|
|
16947
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
16948
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
16949
|
+
* round-trip a stored secret to the UI.
|
|
16725
16950
|
*/
|
|
16726
|
-
var
|
|
16727
|
-
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
16951
|
+
var TargetSchema = object({
|
|
16728
16952
|
id: string(),
|
|
16729
|
-
|
|
16730
|
-
|
|
16731
|
-
|
|
16732
|
-
|
|
16733
|
-
|
|
16734
|
-
targetId: string(),
|
|
16735
|
-
deviceId: number(),
|
|
16736
|
-
recordKind: NcHistoryRecordKindSchema,
|
|
16737
|
-
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
16738
|
-
recordId: string(),
|
|
16739
|
-
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
16740
|
-
trackId: string().optional(),
|
|
16741
|
-
status: NcHistoryStatusSchema,
|
|
16742
|
-
/** Delivery attempts made so far. */
|
|
16743
|
-
attempts: number().int(),
|
|
16744
|
-
/** Fire time (outbox enqueue). */
|
|
16745
|
-
createdAt: number(),
|
|
16746
|
-
/** Last transition time (terminal for sent / dead). */
|
|
16747
|
-
updatedAt: number(),
|
|
16748
|
-
/** Failure detail — present on a `dead` row. */
|
|
16749
|
-
error: string().optional(),
|
|
16750
|
-
subject: NcHistorySubjectSchema
|
|
16953
|
+
name: string(),
|
|
16954
|
+
kind: string(),
|
|
16955
|
+
addonId: string(),
|
|
16956
|
+
enabled: boolean(),
|
|
16957
|
+
config: record(string(), unknown())
|
|
16751
16958
|
});
|
|
16752
|
-
/**
|
|
16753
|
-
|
|
16754
|
-
|
|
16755
|
-
|
|
16756
|
-
|
|
16757
|
-
*/
|
|
16758
|
-
var NcHistoryFilterSchema = object({
|
|
16759
|
-
ruleId: string().optional(),
|
|
16760
|
-
deviceId: number().optional(),
|
|
16761
|
-
status: NcHistoryStatusSchema.optional(),
|
|
16762
|
-
since: number().optional(),
|
|
16763
|
-
until: number().optional(),
|
|
16764
|
-
limit: number().int().min(1).max(500).default(100)
|
|
16959
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
16960
|
+
var DiscoveredTargetSchema = object({
|
|
16961
|
+
kind: string(),
|
|
16962
|
+
suggestedName: string(),
|
|
16963
|
+
config: record(string(), unknown())
|
|
16765
16964
|
});
|
|
16766
|
-
|
|
16767
|
-
|
|
16768
|
-
|
|
16769
|
-
|
|
16770
|
-
|
|
16771
|
-
|
|
16772
|
-
|
|
16773
|
-
|
|
16774
|
-
|
|
16775
|
-
|
|
16776
|
-
|
|
16777
|
-
|
|
16778
|
-
|
|
16779
|
-
|
|
16780
|
-
|
|
16781
|
-
|
|
16965
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
16966
|
+
var RenderedAsSchema = object({
|
|
16967
|
+
level: string(),
|
|
16968
|
+
format: NotificationFormatSchema,
|
|
16969
|
+
attachmentsSent: number().int().nonnegative(),
|
|
16970
|
+
actionsSent: number().int().nonnegative(),
|
|
16971
|
+
truncated: boolean(),
|
|
16972
|
+
dropped: array(string())
|
|
16973
|
+
});
|
|
16974
|
+
var SendResultSchema = object({
|
|
16975
|
+
success: boolean(),
|
|
16976
|
+
error: string().optional(),
|
|
16977
|
+
renderedAs: RenderedAsSchema.optional()
|
|
16978
|
+
});
|
|
16979
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
16980
|
+
var TestResultSchema = SendResultSchema;
|
|
16981
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
16982
|
+
kind: string(),
|
|
16983
|
+
config: record(string(), unknown()).optional()
|
|
16984
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
16985
|
+
targetId: string(),
|
|
16986
|
+
notification: NotificationSchema
|
|
16987
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
16988
|
+
targetId: string(),
|
|
16989
|
+
sample: NotificationSchema.optional()
|
|
16990
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16991
|
+
targetId: string(),
|
|
16782
16992
|
enabled: boolean()
|
|
16783
|
-
}),
|
|
16784
|
-
kind: "mutation",
|
|
16785
|
-
auth: "admin"
|
|
16786
|
-
}), method(object({
|
|
16787
|
-
rule: NcRuleInputSchema,
|
|
16788
|
-
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
16789
|
-
}), object({ results: array(NcTestResultSchema) }), {
|
|
16790
|
-
kind: "mutation",
|
|
16791
|
-
auth: "admin"
|
|
16792
|
-
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
16993
|
+
}), _void(), { kind: "mutation" });
|
|
16793
16994
|
/**
|
|
16794
16995
|
* Zod schemas for persisted record types.
|
|
16795
16996
|
*
|
|
@@ -21800,6 +22001,12 @@ Object.freeze({
|
|
|
21800
22001
|
addonId: null,
|
|
21801
22002
|
access: "delete"
|
|
21802
22003
|
},
|
|
22004
|
+
"backup.deleteSchedule": {
|
|
22005
|
+
capName: "backup",
|
|
22006
|
+
capScope: "system",
|
|
22007
|
+
addonId: null,
|
|
22008
|
+
access: "delete"
|
|
22009
|
+
},
|
|
21803
22010
|
"backup.getEntries": {
|
|
21804
22011
|
capName: "backup",
|
|
21805
22012
|
capScope: "system",
|
|
@@ -21830,6 +22037,12 @@ Object.freeze({
|
|
|
21830
22037
|
addonId: null,
|
|
21831
22038
|
access: "view"
|
|
21832
22039
|
},
|
|
22040
|
+
"backup.listSchedules": {
|
|
22041
|
+
capName: "backup",
|
|
22042
|
+
capScope: "system",
|
|
22043
|
+
addonId: null,
|
|
22044
|
+
access: "view"
|
|
22045
|
+
},
|
|
21833
22046
|
"backup.previewSchedule": {
|
|
21834
22047
|
capName: "backup",
|
|
21835
22048
|
capScope: "system",
|
|
@@ -21854,6 +22067,12 @@ Object.freeze({
|
|
|
21854
22067
|
addonId: null,
|
|
21855
22068
|
access: "create"
|
|
21856
22069
|
},
|
|
22070
|
+
"backup.upsertSchedule": {
|
|
22071
|
+
capName: "backup",
|
|
22072
|
+
capScope: "system",
|
|
22073
|
+
addonId: null,
|
|
22074
|
+
access: "create"
|
|
22075
|
+
},
|
|
21857
22076
|
"battery.wakeForStream": {
|
|
21858
22077
|
capName: "battery",
|
|
21859
22078
|
capScope: "device",
|
|
@@ -25688,6 +25907,36 @@ Object.freeze({
|
|
|
25688
25907
|
addonId: null,
|
|
25689
25908
|
access: "create"
|
|
25690
25909
|
},
|
|
25910
|
+
"terminalSession.close": {
|
|
25911
|
+
capName: "terminal-session",
|
|
25912
|
+
capScope: "system",
|
|
25913
|
+
addonId: null,
|
|
25914
|
+
access: "create"
|
|
25915
|
+
},
|
|
25916
|
+
"terminalSession.listProfiles": {
|
|
25917
|
+
capName: "terminal-session",
|
|
25918
|
+
capScope: "system",
|
|
25919
|
+
addonId: null,
|
|
25920
|
+
access: "view"
|
|
25921
|
+
},
|
|
25922
|
+
"terminalSession.listSessions": {
|
|
25923
|
+
capName: "terminal-session",
|
|
25924
|
+
capScope: "system",
|
|
25925
|
+
addonId: null,
|
|
25926
|
+
access: "view"
|
|
25927
|
+
},
|
|
25928
|
+
"terminalSession.openSession": {
|
|
25929
|
+
capName: "terminal-session",
|
|
25930
|
+
capScope: "system",
|
|
25931
|
+
addonId: null,
|
|
25932
|
+
access: "create"
|
|
25933
|
+
},
|
|
25934
|
+
"terminalSession.resize": {
|
|
25935
|
+
capName: "terminal-session",
|
|
25936
|
+
capScope: "system",
|
|
25937
|
+
addonId: null,
|
|
25938
|
+
access: "create"
|
|
25939
|
+
},
|
|
25691
25940
|
"toast.onToast": {
|
|
25692
25941
|
capName: "toast",
|
|
25693
25942
|
capScope: "system",
|