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