@camstack/addon-provider-dreame 0.2.4 → 0.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 +1911 -1110
- package/dist/addon.mjs +1911 -1110
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -37,7 +37,7 @@ let crypto$1 = require("crypto");
|
|
|
37
37
|
let events = require("events");
|
|
38
38
|
let zlib = require("zlib");
|
|
39
39
|
zlib = __toESM(zlib, 1);
|
|
40
|
-
//#region ../types/dist/event-category-
|
|
40
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
41
41
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
42
42
|
EventCategory["SystemBoot"] = "system.boot";
|
|
43
43
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -187,9 +187,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
187
187
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
188
188
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
189
189
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
190
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
191
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
192
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
193
190
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
194
191
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
195
192
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -6868,7 +6865,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
|
6868
6865
|
patch: record(string(), unknown())
|
|
6869
6866
|
}), object({ success: literal(true) });
|
|
6870
6867
|
object({ deviceId: number() }), unknown().nullable();
|
|
6871
|
-
/** Shorthand to define a method schema */
|
|
6872
6868
|
function method(input, output, options) {
|
|
6873
6869
|
return {
|
|
6874
6870
|
input,
|
|
@@ -6876,6 +6872,7 @@ function method(input, output, options) {
|
|
|
6876
6872
|
kind: options?.kind ?? "query",
|
|
6877
6873
|
auth: options?.auth ?? "protected",
|
|
6878
6874
|
...options?.access !== void 0 ? { access: options.access } : {},
|
|
6875
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
6879
6876
|
timeoutMs: options?.timeoutMs
|
|
6880
6877
|
};
|
|
6881
6878
|
}
|
|
@@ -7573,16 +7570,23 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7573
7570
|
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7574
7571
|
* FRESH install:
|
|
7575
7572
|
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7576
|
-
* the appData volume. Right for small/durable data (
|
|
7573
|
+
* the appData volume. Right for small/durable data (logs, models).
|
|
7577
7574
|
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7578
7575
|
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7579
7576
|
* (recordings, event media) that should stay off the appData disk.
|
|
7577
|
+
* - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
|
|
7578
|
+
* `/backups` in the image) so archives live on their own mount rather than
|
|
7579
|
+
* filling the appData disk. Falls back to the data root when unset.
|
|
7580
7580
|
*
|
|
7581
7581
|
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7582
7582
|
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7583
7583
|
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7584
7584
|
*/
|
|
7585
|
-
defaultRoot: _enum([
|
|
7585
|
+
defaultRoot: _enum([
|
|
7586
|
+
"data",
|
|
7587
|
+
"media",
|
|
7588
|
+
"backup"
|
|
7589
|
+
]).optional()
|
|
7586
7590
|
});
|
|
7587
7591
|
var DecoderStatsSchema = object({
|
|
7588
7592
|
inputFps: number(),
|
|
@@ -8245,6 +8249,59 @@ for (const l of AUDIO_MACRO_LABELS) {
|
|
|
8245
8249
|
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8246
8250
|
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8247
8251
|
/**
|
|
8252
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8253
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8254
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8255
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8256
|
+
*
|
|
8257
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8258
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8259
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8260
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8261
|
+
* the same class picker, grouped under an Audio header.
|
|
8262
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8263
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8264
|
+
*
|
|
8265
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8266
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8267
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8268
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8269
|
+
*/
|
|
8270
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8271
|
+
var NcTaxonomyEntrySchema = object({
|
|
8272
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8273
|
+
kind: string(),
|
|
8274
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8275
|
+
label: string(),
|
|
8276
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8277
|
+
parentKind: string().nullable()
|
|
8278
|
+
});
|
|
8279
|
+
object({
|
|
8280
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8281
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8282
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8283
|
+
});
|
|
8284
|
+
function toEntry(kind, label, parentKind) {
|
|
8285
|
+
return {
|
|
8286
|
+
kind,
|
|
8287
|
+
label,
|
|
8288
|
+
parentKind
|
|
8289
|
+
};
|
|
8290
|
+
}
|
|
8291
|
+
/**
|
|
8292
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8293
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8294
|
+
*/
|
|
8295
|
+
function buildNcTaxonomy() {
|
|
8296
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8297
|
+
return {
|
|
8298
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8299
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8300
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8301
|
+
};
|
|
8302
|
+
}
|
|
8303
|
+
Object.freeze(buildNcTaxonomy());
|
|
8304
|
+
/**
|
|
8248
8305
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8249
8306
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8250
8307
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -9123,6 +9180,644 @@ function shallowEqual(a, b) {
|
|
|
9123
9180
|
return true;
|
|
9124
9181
|
}
|
|
9125
9182
|
/**
|
|
9183
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
9184
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
9185
|
+
* language so a single drawing-plane editor and the providers stay
|
|
9186
|
+
* decoupled from each cap's storage.
|
|
9187
|
+
*
|
|
9188
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
9189
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
9190
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
9191
|
+
*/
|
|
9192
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
9193
|
+
var MaskPointSchema = object({
|
|
9194
|
+
x: number(),
|
|
9195
|
+
y: number()
|
|
9196
|
+
});
|
|
9197
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
9198
|
+
var MaskRectShapeSchema = object({
|
|
9199
|
+
kind: literal("rect"),
|
|
9200
|
+
x: number(),
|
|
9201
|
+
y: number(),
|
|
9202
|
+
width: number(),
|
|
9203
|
+
height: number()
|
|
9204
|
+
});
|
|
9205
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
9206
|
+
var MaskPolygonShapeSchema = object({
|
|
9207
|
+
kind: literal("polygon"),
|
|
9208
|
+
points: array(MaskPointSchema)
|
|
9209
|
+
});
|
|
9210
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
9211
|
+
var MaskGridShapeSchema = object({
|
|
9212
|
+
kind: literal("grid"),
|
|
9213
|
+
gridWidth: number(),
|
|
9214
|
+
gridHeight: number(),
|
|
9215
|
+
cells: array(boolean())
|
|
9216
|
+
});
|
|
9217
|
+
discriminatedUnion("kind", [
|
|
9218
|
+
MaskRectShapeSchema,
|
|
9219
|
+
MaskPolygonShapeSchema,
|
|
9220
|
+
MaskGridShapeSchema,
|
|
9221
|
+
object({
|
|
9222
|
+
kind: literal("line"),
|
|
9223
|
+
points: array(MaskPointSchema)
|
|
9224
|
+
})
|
|
9225
|
+
]);
|
|
9226
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
9227
|
+
var MaskShapeKindSchema = _enum([
|
|
9228
|
+
"rect",
|
|
9229
|
+
"polygon",
|
|
9230
|
+
"grid",
|
|
9231
|
+
"line"
|
|
9232
|
+
]);
|
|
9233
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
9234
|
+
var MaskPolygonVerticesSchema = object({
|
|
9235
|
+
min: number(),
|
|
9236
|
+
max: number()
|
|
9237
|
+
});
|
|
9238
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
9239
|
+
var MaskGridDimsSchema = object({
|
|
9240
|
+
width: number(),
|
|
9241
|
+
height: number()
|
|
9242
|
+
});
|
|
9243
|
+
/**
|
|
9244
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
9245
|
+
*
|
|
9246
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
9247
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
9248
|
+
*
|
|
9249
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
9250
|
+
* `notification-center` module), hooked on the durable persistence
|
|
9251
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
9252
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
9253
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
9254
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
9255
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
9256
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
9257
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
9258
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
9259
|
+
* target kind's own caps/degrade engine).
|
|
9260
|
+
*
|
|
9261
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
9262
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
9263
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
9264
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
9265
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
9266
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
9267
|
+
* P2+ (see spec §7).
|
|
9268
|
+
*
|
|
9269
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
9270
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
9271
|
+
* schema/interface drift is explicitly not repeated).
|
|
9272
|
+
*/
|
|
9273
|
+
/**
|
|
9274
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
9275
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
9276
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
9277
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
9278
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
9279
|
+
* change of a LINKED device, one row per linked camera)
|
|
9280
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
9281
|
+
* delivery / pick-up)
|
|
9282
|
+
*
|
|
9283
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
9284
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
9285
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
9286
|
+
* one trigger.
|
|
9287
|
+
*/
|
|
9288
|
+
var NcDeliverySchema = _enum([
|
|
9289
|
+
"immediate",
|
|
9290
|
+
"track-end",
|
|
9291
|
+
"device-event",
|
|
9292
|
+
"package-event"
|
|
9293
|
+
]);
|
|
9294
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
9295
|
+
var NcScheduleSchema = object({
|
|
9296
|
+
windows: array(object({
|
|
9297
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
9298
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
9299
|
+
startMinute: number().int().min(0).max(1439),
|
|
9300
|
+
endMinute: number().int().min(0).max(1439)
|
|
9301
|
+
})).min(1),
|
|
9302
|
+
/** IANA timezone; default = hub host timezone. */
|
|
9303
|
+
timezone: string().optional(),
|
|
9304
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
9305
|
+
invert: boolean().optional()
|
|
9306
|
+
});
|
|
9307
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
9308
|
+
var NcPlateMatcherSchema = object({
|
|
9309
|
+
values: array(string().min(1)).min(1),
|
|
9310
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9311
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9312
|
+
});
|
|
9313
|
+
/**
|
|
9314
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9315
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9316
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9317
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9318
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9319
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9320
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9321
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9322
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9323
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9324
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9325
|
+
*/
|
|
9326
|
+
var NcOccupancyConditionSchema = object({
|
|
9327
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9328
|
+
zoneId: string().optional(),
|
|
9329
|
+
/** Object class to count; absent = any class. */
|
|
9330
|
+
className: string().optional(),
|
|
9331
|
+
op: _enum([
|
|
9332
|
+
"became-occupied",
|
|
9333
|
+
"became-free",
|
|
9334
|
+
">=",
|
|
9335
|
+
"<="
|
|
9336
|
+
]).default("became-occupied"),
|
|
9337
|
+
count: number().int().min(0).default(1),
|
|
9338
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9339
|
+
});
|
|
9340
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9341
|
+
var NcZoneConditionSchema = object({
|
|
9342
|
+
ids: array(string().min(1)).min(1),
|
|
9343
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9344
|
+
match: _enum(["any", "all"]).default("any")
|
|
9345
|
+
});
|
|
9346
|
+
/**
|
|
9347
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9348
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9349
|
+
*/
|
|
9350
|
+
var NcConditionsSchema = object({
|
|
9351
|
+
/** Device scope — absent = all devices. */
|
|
9352
|
+
devices: array(number()).optional(),
|
|
9353
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9354
|
+
classes: array(string().min(1)).optional(),
|
|
9355
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9356
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9357
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9358
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9359
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9360
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9361
|
+
/** Veto zones — any hit fails the rule. */
|
|
9362
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
9363
|
+
/**
|
|
9364
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9365
|
+
* (identity name / plate text / subclass).
|
|
9366
|
+
*/
|
|
9367
|
+
labelEquals: array(string().min(1)).optional(),
|
|
9368
|
+
/**
|
|
9369
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9370
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9371
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
9372
|
+
*/
|
|
9373
|
+
identities: array(string().min(1)).optional(),
|
|
9374
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9375
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
9376
|
+
/**
|
|
9377
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9378
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9379
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9380
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
9381
|
+
*/
|
|
9382
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
9383
|
+
/**
|
|
9384
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9385
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9386
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9387
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9388
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9389
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9390
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9391
|
+
*/
|
|
9392
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9393
|
+
/**
|
|
9394
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9395
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9396
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9397
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9398
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9399
|
+
*/
|
|
9400
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9401
|
+
/**
|
|
9402
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9403
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9404
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9405
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9406
|
+
* tracks carry `sensor`.
|
|
9407
|
+
*/
|
|
9408
|
+
source: _enum([
|
|
9409
|
+
"pipeline",
|
|
9410
|
+
"onboard",
|
|
9411
|
+
"sensor",
|
|
9412
|
+
"any"
|
|
9413
|
+
]).optional(),
|
|
9414
|
+
/**
|
|
9415
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9416
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9417
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9418
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9419
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9420
|
+
*
|
|
9421
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9422
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9423
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9424
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9425
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9426
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9427
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9428
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9429
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9430
|
+
* closed for it (an un-recognized subject).
|
|
9431
|
+
*/
|
|
9432
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9433
|
+
/**
|
|
9434
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9435
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9436
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9437
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9438
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9439
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9440
|
+
*/
|
|
9441
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9442
|
+
/**
|
|
9443
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9444
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9445
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9446
|
+
*/
|
|
9447
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9448
|
+
/**
|
|
9449
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9450
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9451
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9452
|
+
* on the package-event trigger).
|
|
9453
|
+
*/
|
|
9454
|
+
packagePhase: _enum([
|
|
9455
|
+
"delivered",
|
|
9456
|
+
"picked-up",
|
|
9457
|
+
"both"
|
|
9458
|
+
]).optional(),
|
|
9459
|
+
/**
|
|
9460
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9461
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9462
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9463
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9464
|
+
*/
|
|
9465
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9466
|
+
/**
|
|
9467
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9468
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9469
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9470
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9471
|
+
*/
|
|
9472
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9473
|
+
});
|
|
9474
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9475
|
+
var NcRuleTargetSchema = object({
|
|
9476
|
+
/** `notification-output` Target id. */
|
|
9477
|
+
targetId: string().min(1),
|
|
9478
|
+
/**
|
|
9479
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9480
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9481
|
+
* degrade engine drops what the backend can't render.
|
|
9482
|
+
*/
|
|
9483
|
+
params: record(string(), unknown()).optional()
|
|
9484
|
+
});
|
|
9485
|
+
/**
|
|
9486
|
+
* Media attachment policy (P1 still-image subset).
|
|
9487
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9488
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9489
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9490
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9491
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9492
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9493
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9494
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9495
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9496
|
+
* - `none` — no attachment.
|
|
9497
|
+
*/
|
|
9498
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9499
|
+
"best",
|
|
9500
|
+
"best-matching",
|
|
9501
|
+
"keyFrame",
|
|
9502
|
+
"none"
|
|
9503
|
+
]).default("best") });
|
|
9504
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9505
|
+
var NcThrottleSchema = object({
|
|
9506
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9507
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9508
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9509
|
+
});
|
|
9510
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9511
|
+
var NcRuleInputSchema = object({
|
|
9512
|
+
name: string().min(1).max(200),
|
|
9513
|
+
enabled: boolean().default(true),
|
|
9514
|
+
delivery: NcDeliverySchema,
|
|
9515
|
+
conditions: NcConditionsSchema.default({}),
|
|
9516
|
+
schedule: NcScheduleSchema.optional(),
|
|
9517
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9518
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9519
|
+
throttle: NcThrottleSchema.default({
|
|
9520
|
+
cooldownSec: 60,
|
|
9521
|
+
scope: "rule-device"
|
|
9522
|
+
}),
|
|
9523
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9524
|
+
template: object({
|
|
9525
|
+
title: string().max(500).optional(),
|
|
9526
|
+
body: string().max(2e3).optional()
|
|
9527
|
+
}).optional(),
|
|
9528
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9529
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9530
|
+
/**
|
|
9531
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9532
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9533
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9534
|
+
*/
|
|
9535
|
+
ownerUserId: string().optional()
|
|
9536
|
+
});
|
|
9537
|
+
/**
|
|
9538
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9539
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9540
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9541
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9542
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9543
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9544
|
+
* `updateRule` patch.
|
|
9545
|
+
*/
|
|
9546
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9547
|
+
/** A persisted rule. */
|
|
9548
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9549
|
+
id: string(),
|
|
9550
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9551
|
+
createdBy: string(),
|
|
9552
|
+
createdAt: number(),
|
|
9553
|
+
updatedAt: number(),
|
|
9554
|
+
/**
|
|
9555
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9556
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9557
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9558
|
+
*/
|
|
9559
|
+
disabledTargetIds: array(string()).default([])
|
|
9560
|
+
});
|
|
9561
|
+
var NcTestResultSchema = object({
|
|
9562
|
+
recordId: string(),
|
|
9563
|
+
recordKind: _enum([
|
|
9564
|
+
"object-event",
|
|
9565
|
+
"track",
|
|
9566
|
+
"device-event",
|
|
9567
|
+
"package-event"
|
|
9568
|
+
]),
|
|
9569
|
+
deviceId: number(),
|
|
9570
|
+
timestamp: number(),
|
|
9571
|
+
wouldFire: boolean(),
|
|
9572
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9573
|
+
failedCondition: string().optional(),
|
|
9574
|
+
className: string().optional(),
|
|
9575
|
+
label: string().optional()
|
|
9576
|
+
});
|
|
9577
|
+
var NcConditionDescriptorSchema = object({
|
|
9578
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9579
|
+
id: string(),
|
|
9580
|
+
group: _enum([
|
|
9581
|
+
"scope",
|
|
9582
|
+
"class",
|
|
9583
|
+
"zones",
|
|
9584
|
+
"quality",
|
|
9585
|
+
"label",
|
|
9586
|
+
"schedule",
|
|
9587
|
+
"device",
|
|
9588
|
+
"package",
|
|
9589
|
+
"occupancy"
|
|
9590
|
+
]),
|
|
9591
|
+
label: string(),
|
|
9592
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9593
|
+
valueType: _enum([
|
|
9594
|
+
"deviceIdList",
|
|
9595
|
+
"stringList",
|
|
9596
|
+
"number01",
|
|
9597
|
+
"number",
|
|
9598
|
+
"sourceSelect",
|
|
9599
|
+
"zoneSelection",
|
|
9600
|
+
"zoneIdList",
|
|
9601
|
+
"schedule",
|
|
9602
|
+
"plateMatcher",
|
|
9603
|
+
"packagePhase",
|
|
9604
|
+
"polygonDraw",
|
|
9605
|
+
"occupancy"
|
|
9606
|
+
]),
|
|
9607
|
+
operator: _enum([
|
|
9608
|
+
"in",
|
|
9609
|
+
"notIn",
|
|
9610
|
+
"anyOf",
|
|
9611
|
+
"allOf",
|
|
9612
|
+
"gte",
|
|
9613
|
+
"fuzzyIn",
|
|
9614
|
+
"withinSchedule"
|
|
9615
|
+
]),
|
|
9616
|
+
/** Which delivery kinds the condition applies to. */
|
|
9617
|
+
appliesTo: array(NcDeliverySchema),
|
|
9618
|
+
phase: string(),
|
|
9619
|
+
description: string().optional()
|
|
9620
|
+
});
|
|
9621
|
+
/**
|
|
9622
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9623
|
+
* durable outbox row's own status (single source of truth):
|
|
9624
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9625
|
+
* - `sent` — delivered (terminal)
|
|
9626
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9627
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9628
|
+
* the failure `error`)
|
|
9629
|
+
*
|
|
9630
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9631
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9632
|
+
*/
|
|
9633
|
+
var NcHistoryStatusSchema = _enum([
|
|
9634
|
+
"pending",
|
|
9635
|
+
"sent",
|
|
9636
|
+
"dead"
|
|
9637
|
+
]);
|
|
9638
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9639
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9640
|
+
"object-event",
|
|
9641
|
+
"track-end",
|
|
9642
|
+
"device-event",
|
|
9643
|
+
"package-event"
|
|
9644
|
+
]);
|
|
9645
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9646
|
+
var NcHistorySubjectSchema = object({
|
|
9647
|
+
className: string(),
|
|
9648
|
+
label: string().optional(),
|
|
9649
|
+
confidence: number().optional(),
|
|
9650
|
+
zones: array(string()),
|
|
9651
|
+
timestamp: number()
|
|
9652
|
+
});
|
|
9653
|
+
/**
|
|
9654
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9655
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9656
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9657
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9658
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9659
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9660
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9661
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9662
|
+
* P1 (admin scope only).
|
|
9663
|
+
*/
|
|
9664
|
+
var NcHistoryEntrySchema = object({
|
|
9665
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9666
|
+
id: string(),
|
|
9667
|
+
ruleId: string(),
|
|
9668
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9669
|
+
ruleName: string(),
|
|
9670
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9671
|
+
delivery: NcDeliverySchema,
|
|
9672
|
+
targetId: string(),
|
|
9673
|
+
deviceId: number(),
|
|
9674
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9675
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9676
|
+
recordId: string(),
|
|
9677
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9678
|
+
trackId: string().optional(),
|
|
9679
|
+
status: NcHistoryStatusSchema,
|
|
9680
|
+
/** Delivery attempts made so far. */
|
|
9681
|
+
attempts: number().int(),
|
|
9682
|
+
/** Fire time (outbox enqueue). */
|
|
9683
|
+
createdAt: number(),
|
|
9684
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9685
|
+
updatedAt: number(),
|
|
9686
|
+
/** Failure detail — present on a `dead` row. */
|
|
9687
|
+
error: string().optional(),
|
|
9688
|
+
subject: NcHistorySubjectSchema
|
|
9689
|
+
});
|
|
9690
|
+
/**
|
|
9691
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9692
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9693
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9694
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9695
|
+
*/
|
|
9696
|
+
var NcHistoryFilterSchema = object({
|
|
9697
|
+
ruleId: string().optional(),
|
|
9698
|
+
deviceId: number().optional(),
|
|
9699
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9700
|
+
since: number().optional(),
|
|
9701
|
+
until: number().optional(),
|
|
9702
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9703
|
+
});
|
|
9704
|
+
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 }), {
|
|
9705
|
+
kind: "mutation",
|
|
9706
|
+
auth: "admin",
|
|
9707
|
+
caller: "required"
|
|
9708
|
+
}), method(object({
|
|
9709
|
+
ruleId: string(),
|
|
9710
|
+
patch: NcRulePatchSchema
|
|
9711
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9712
|
+
kind: "mutation",
|
|
9713
|
+
auth: "admin",
|
|
9714
|
+
caller: "required"
|
|
9715
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9716
|
+
kind: "mutation",
|
|
9717
|
+
auth: "admin"
|
|
9718
|
+
}), method(object({
|
|
9719
|
+
ruleId: string(),
|
|
9720
|
+
enabled: boolean()
|
|
9721
|
+
}), object({ success: literal(true) }), {
|
|
9722
|
+
kind: "mutation",
|
|
9723
|
+
auth: "admin"
|
|
9724
|
+
}), method(object({
|
|
9725
|
+
rule: NcRuleInputSchema,
|
|
9726
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9727
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9728
|
+
kind: "mutation",
|
|
9729
|
+
auth: "admin"
|
|
9730
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9731
|
+
/**
|
|
9732
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9733
|
+
*
|
|
9734
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
9735
|
+
* §3.2/§3.3.
|
|
9736
|
+
*
|
|
9737
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
9738
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
9739
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
9740
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
9741
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
9742
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
9743
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
9744
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
9745
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
9746
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
9747
|
+
*
|
|
9748
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
9749
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
9750
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
9751
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
9752
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
9753
|
+
*/
|
|
9754
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
9755
|
+
var TimelapseTemplateSchema = object({
|
|
9756
|
+
title: string().max(500).optional(),
|
|
9757
|
+
body: string().max(2e3).optional()
|
|
9758
|
+
});
|
|
9759
|
+
var NameField = string().min(1).max(200);
|
|
9760
|
+
var DeviceIdsField = array(number()).min(1);
|
|
9761
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
9762
|
+
var FramerateField = number().int().min(1).max(60);
|
|
9763
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
9764
|
+
var PriorityField = number().int().min(1).max(5);
|
|
9765
|
+
/**
|
|
9766
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
9767
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
9768
|
+
* here (see the ownership note above).
|
|
9769
|
+
*/
|
|
9770
|
+
var TimelapseRuleInputSchema = object({
|
|
9771
|
+
name: NameField,
|
|
9772
|
+
enabled: boolean().default(true),
|
|
9773
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
9774
|
+
deviceIds: DeviceIdsField,
|
|
9775
|
+
/**
|
|
9776
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
9777
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
9778
|
+
* open clears the scratch, close assembles and delivers.
|
|
9779
|
+
*/
|
|
9780
|
+
schedule: NcScheduleSchema,
|
|
9781
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
9782
|
+
cadenceSec: CadenceSecField.default(15),
|
|
9783
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
9784
|
+
framerate: FramerateField.default(10),
|
|
9785
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
9786
|
+
targets: TargetsField,
|
|
9787
|
+
template: TimelapseTemplateSchema.optional(),
|
|
9788
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9789
|
+
priority: PriorityField.default(3)
|
|
9790
|
+
});
|
|
9791
|
+
object({
|
|
9792
|
+
name: NameField.optional(),
|
|
9793
|
+
enabled: boolean().optional(),
|
|
9794
|
+
deviceIds: DeviceIdsField.optional(),
|
|
9795
|
+
schedule: NcScheduleSchema.optional(),
|
|
9796
|
+
cadenceSec: CadenceSecField.optional(),
|
|
9797
|
+
framerate: FramerateField.optional(),
|
|
9798
|
+
targets: TargetsField.optional(),
|
|
9799
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
9800
|
+
priority: PriorityField.optional()
|
|
9801
|
+
});
|
|
9802
|
+
TimelapseRuleInputSchema.extend({
|
|
9803
|
+
id: string(),
|
|
9804
|
+
/**
|
|
9805
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
9806
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
9807
|
+
* resolved caller; never trusted from a client payload.
|
|
9808
|
+
*/
|
|
9809
|
+
ownerUserId: string().optional(),
|
|
9810
|
+
/**
|
|
9811
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
9812
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
9813
|
+
*/
|
|
9814
|
+
lastGeneratedAt: number().optional(),
|
|
9815
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
9816
|
+
createdBy: string(),
|
|
9817
|
+
createdAt: number(),
|
|
9818
|
+
updatedAt: number()
|
|
9819
|
+
});
|
|
9820
|
+
/**
|
|
9126
9821
|
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
9127
9822
|
* for every device, regardless of provider — the kernel needs a uniform
|
|
9128
9823
|
* cap-keyed slice for the basic device flags every consumer expects to
|
|
@@ -12230,6 +12925,22 @@ var CameraMetricsSchema = object({
|
|
|
12230
12925
|
])
|
|
12231
12926
|
});
|
|
12232
12927
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
12928
|
+
/**
|
|
12929
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
12930
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
12931
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
12932
|
+
*/
|
|
12933
|
+
var NativeCropRefSchema = object({
|
|
12934
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
12935
|
+
handle: FrameHandleSchema,
|
|
12936
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
12937
|
+
cropFrameSpace: object({
|
|
12938
|
+
x: number(),
|
|
12939
|
+
y: number(),
|
|
12940
|
+
w: number(),
|
|
12941
|
+
h: number()
|
|
12942
|
+
})
|
|
12943
|
+
});
|
|
12233
12944
|
var ModelFormatSchema$1 = _enum([
|
|
12234
12945
|
"onnx",
|
|
12235
12946
|
"coreml",
|
|
@@ -12505,7 +13216,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
12505
13216
|
* Omitted ⇒ the runner's default device (current single-engine
|
|
12506
13217
|
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
12507
13218
|
*/
|
|
12508
|
-
deviceKey: string().optional()
|
|
13219
|
+
deviceKey: string().optional(),
|
|
13220
|
+
/**
|
|
13221
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
13222
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
13223
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
13224
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
13225
|
+
* resolution from that surface — the SAME quality path faces already
|
|
13226
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
13227
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
13228
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
13229
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
13230
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
13231
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
13232
|
+
* (today's behaviour on the fallback path).
|
|
13233
|
+
*/
|
|
13234
|
+
nativeCropRef: NativeCropRefSchema.optional()
|
|
12509
13235
|
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
12510
13236
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
12511
13237
|
steps: array(PipelineStepInputSchema).min(1),
|
|
@@ -12754,7 +13480,11 @@ var DetailResultSchema = object({
|
|
|
12754
13480
|
bbox: NativeCropBboxSchema.optional(),
|
|
12755
13481
|
embedding: string().optional(),
|
|
12756
13482
|
label: string().optional(),
|
|
12757
|
-
alignedCropJpeg: string().optional()
|
|
13483
|
+
alignedCropJpeg: string().optional(),
|
|
13484
|
+
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
13485
|
+
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
13486
|
+
* consumers MUST prefer this when present (2026-07-22 native-gate fix). */
|
|
13487
|
+
nativeFaceShortSidePx: number().optional()
|
|
12758
13488
|
});
|
|
12759
13489
|
/**
|
|
12760
13490
|
* Per-camera tunable ranges + defaults. Single source of truth used
|
|
@@ -12768,6 +13498,12 @@ var motionCooldownMsField = {
|
|
|
12768
13498
|
default: 3e4,
|
|
12769
13499
|
step: 500
|
|
12770
13500
|
};
|
|
13501
|
+
var maxSessionHoldMsField = {
|
|
13502
|
+
min: 0,
|
|
13503
|
+
max: 6e5,
|
|
13504
|
+
default: 12e4,
|
|
13505
|
+
step: 5e3
|
|
13506
|
+
};
|
|
12771
13507
|
var motionFpsField = {
|
|
12772
13508
|
min: 1,
|
|
12773
13509
|
max: 30,
|
|
@@ -12915,6 +13651,19 @@ var RunnerCameraConfigSchema = object({
|
|
|
12915
13651
|
"on-motion"
|
|
12916
13652
|
]).default("always-on"),
|
|
12917
13653
|
motionCooldownMs: number().min(motionCooldownMsField.min).default(motionCooldownMsField.default),
|
|
13654
|
+
/**
|
|
13655
|
+
* Orchestrator-side on-motion session-hold cap (ms). While an on-motion
|
|
13656
|
+
* detection session is active and ≥1 confirmed non-stationary track is
|
|
13657
|
+
* still live, the orchestrator keeps the session open past
|
|
13658
|
+
* `motionCooldownMs` (a slowly-moving subject can stop re-triggering the
|
|
13659
|
+
* camera's VMD yet is still being tracked frame-to-frame) — up to this many
|
|
13660
|
+
* ms since the session opened, after which it closes regardless. `0`
|
|
13661
|
+
* disables the hold (legacy cooldown-only teardown). Not consumed by the
|
|
13662
|
+
* runner itself — carried here so it shares the per-camera device-settings
|
|
13663
|
+
* surface with `motionCooldownMs`; the orchestrator reads it off the
|
|
13664
|
+
* resolved `CameraDetectionConfig`.
|
|
13665
|
+
*/
|
|
13666
|
+
maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
|
|
12918
13667
|
motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
|
|
12919
13668
|
detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
|
|
12920
13669
|
motionStreamId: string(),
|
|
@@ -13004,7 +13753,7 @@ var RunnerCameraConfigSchema = object({
|
|
|
13004
13753
|
*/
|
|
13005
13754
|
inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
|
|
13006
13755
|
});
|
|
13007
|
-
motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
|
|
13756
|
+
motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
|
|
13008
13757
|
/**
|
|
13009
13758
|
* Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
|
|
13010
13759
|
* load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
|
|
@@ -13220,71 +13969,10 @@ var motionTriggerCapability = {
|
|
|
13220
13969
|
runtimeState: MotionTriggerRuntimeStateSchema
|
|
13221
13970
|
};
|
|
13222
13971
|
/**
|
|
13223
|
-
*
|
|
13224
|
-
* motion-
|
|
13225
|
-
*
|
|
13226
|
-
*
|
|
13227
|
-
*
|
|
13228
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
13229
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
13230
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
13231
|
-
*/
|
|
13232
|
-
/** A normalized 0..1 point (top-left origin). */
|
|
13233
|
-
var MaskPointSchema = object({
|
|
13234
|
-
x: number(),
|
|
13235
|
-
y: number()
|
|
13236
|
-
});
|
|
13237
|
-
/** Axis-aligned rectangle (normalized 0..1). */
|
|
13238
|
-
var MaskRectShapeSchema = object({
|
|
13239
|
-
kind: literal("rect"),
|
|
13240
|
-
x: number(),
|
|
13241
|
-
y: number(),
|
|
13242
|
-
width: number(),
|
|
13243
|
-
height: number()
|
|
13244
|
-
});
|
|
13245
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
13246
|
-
var MaskPolygonShapeSchema = object({
|
|
13247
|
-
kind: literal("polygon"),
|
|
13248
|
-
points: array(MaskPointSchema)
|
|
13249
|
-
});
|
|
13250
|
-
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
13251
|
-
var MaskGridShapeSchema = object({
|
|
13252
|
-
kind: literal("grid"),
|
|
13253
|
-
gridWidth: number(),
|
|
13254
|
-
gridHeight: number(),
|
|
13255
|
-
cells: array(boolean())
|
|
13256
|
-
});
|
|
13257
|
-
discriminatedUnion("kind", [
|
|
13258
|
-
MaskRectShapeSchema,
|
|
13259
|
-
MaskPolygonShapeSchema,
|
|
13260
|
-
MaskGridShapeSchema,
|
|
13261
|
-
object({
|
|
13262
|
-
kind: literal("line"),
|
|
13263
|
-
points: array(MaskPointSchema)
|
|
13264
|
-
})
|
|
13265
|
-
]);
|
|
13266
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
13267
|
-
var MaskShapeKindSchema = _enum([
|
|
13268
|
-
"rect",
|
|
13269
|
-
"polygon",
|
|
13270
|
-
"grid",
|
|
13271
|
-
"line"
|
|
13272
|
-
]);
|
|
13273
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
13274
|
-
var MaskPolygonVerticesSchema = object({
|
|
13275
|
-
min: number(),
|
|
13276
|
-
max: number()
|
|
13277
|
-
});
|
|
13278
|
-
/** Grid dimensions when a cap supports 'grid'. */
|
|
13279
|
-
var MaskGridDimsSchema = object({
|
|
13280
|
-
width: number(),
|
|
13281
|
-
height: number()
|
|
13282
|
-
});
|
|
13283
|
-
/**
|
|
13284
|
-
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
13285
|
-
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
13286
|
-
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
13287
|
-
* a region keeps one drawing-plane model across all geometry caps.
|
|
13972
|
+
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
13973
|
+
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
13974
|
+
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
13975
|
+
* a region keeps one drawing-plane model across all geometry caps.
|
|
13288
13976
|
*/
|
|
13289
13977
|
/** A motion-zone region — exactly one boolean cell grid today. */
|
|
13290
13978
|
var MotionZoneRegionSchema = object({
|
|
@@ -16531,94 +17219,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
16531
17219
|
bundleUrl: string()
|
|
16532
17220
|
});
|
|
16533
17221
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
16534
|
-
var NotificationRuleConditionsSchema = object({
|
|
16535
|
-
deviceIds: array(number()).readonly().optional(),
|
|
16536
|
-
classNames: array(string()).readonly().optional(),
|
|
16537
|
-
zoneIds: array(string()).readonly().optional(),
|
|
16538
|
-
minConfidence: number().optional(),
|
|
16539
|
-
source: _enum([
|
|
16540
|
-
"pipeline",
|
|
16541
|
-
"onboard",
|
|
16542
|
-
"any"
|
|
16543
|
-
]).optional(),
|
|
16544
|
-
schedule: object({
|
|
16545
|
-
days: array(number()).readonly(),
|
|
16546
|
-
startHour: number(),
|
|
16547
|
-
endHour: number()
|
|
16548
|
-
}).optional(),
|
|
16549
|
-
cooldownSeconds: number().optional(),
|
|
16550
|
-
minDwellSeconds: number().optional(),
|
|
16551
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
16552
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
16553
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
16554
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
16555
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
16556
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
16557
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
16558
|
-
clipDescription: object({
|
|
16559
|
-
text: string().min(1),
|
|
16560
|
-
minSimilarity: number().min(0).max(1)
|
|
16561
|
-
}).optional(),
|
|
16562
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
16563
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
16564
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
16565
|
-
* vehicle/person> is seen". */
|
|
16566
|
-
labels: array(string()).readonly().optional()
|
|
16567
|
-
});
|
|
16568
|
-
var NotificationRuleTemplateSchema = object({
|
|
16569
|
-
title: string(),
|
|
16570
|
-
body: string(),
|
|
16571
|
-
imageMode: _enum([
|
|
16572
|
-
"crop",
|
|
16573
|
-
"annotated",
|
|
16574
|
-
"full",
|
|
16575
|
-
"none"
|
|
16576
|
-
])
|
|
16577
|
-
});
|
|
16578
|
-
var NotificationRuleSchema = object({
|
|
16579
|
-
id: string(),
|
|
16580
|
-
name: string(),
|
|
16581
|
-
enabled: boolean(),
|
|
16582
|
-
eventTypes: array(string()).readonly(),
|
|
16583
|
-
conditions: NotificationRuleConditionsSchema,
|
|
16584
|
-
outputs: array(string()).readonly(),
|
|
16585
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
16586
|
-
priority: _enum([
|
|
16587
|
-
"low",
|
|
16588
|
-
"normal",
|
|
16589
|
-
"high",
|
|
16590
|
-
"critical"
|
|
16591
|
-
])
|
|
16592
|
-
});
|
|
16593
|
-
var NotificationTestResultSchema = object({
|
|
16594
|
-
ruleId: string(),
|
|
16595
|
-
eventId: string(),
|
|
16596
|
-
timestamp: number(),
|
|
16597
|
-
wouldFire: boolean(),
|
|
16598
|
-
reason: string().optional()
|
|
16599
|
-
});
|
|
16600
|
-
var NotificationHistoryEntrySchema = object({
|
|
16601
|
-
id: string(),
|
|
16602
|
-
ruleId: string(),
|
|
16603
|
-
ruleName: string(),
|
|
16604
|
-
eventId: string(),
|
|
16605
|
-
timestamp: number(),
|
|
16606
|
-
outputs: array(string()).readonly(),
|
|
16607
|
-
success: boolean(),
|
|
16608
|
-
error: string().optional(),
|
|
16609
|
-
deviceId: number().optional()
|
|
16610
|
-
});
|
|
16611
|
-
var NotificationHistoryFilterSchema = object({
|
|
16612
|
-
ruleId: string().optional(),
|
|
16613
|
-
deviceId: number().optional(),
|
|
16614
|
-
from: number().optional(),
|
|
16615
|
-
to: number().optional(),
|
|
16616
|
-
limit: number().optional()
|
|
16617
|
-
});
|
|
16618
|
-
method(_void(), object({ rules: array(NotificationRuleSchema).readonly() })), method(object({ rule: NotificationRuleSchema }), object({ success: literal(true) }), { kind: "mutation" }), method(object({ ruleId: string() }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
|
|
16619
|
-
ruleId: string(),
|
|
16620
|
-
lookbackMinutes: number()
|
|
16621
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
16622
17222
|
/**
|
|
16623
17223
|
* Alerts capability — collection-based internal alert system.
|
|
16624
17224
|
*
|
|
@@ -16805,88 +17405,54 @@ method(object({
|
|
|
16805
17405
|
password: string()
|
|
16806
17406
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
16807
17407
|
/**
|
|
16808
|
-
*
|
|
16809
|
-
*
|
|
16810
|
-
*
|
|
16811
|
-
*
|
|
16812
|
-
*
|
|
16813
|
-
*
|
|
16814
|
-
*
|
|
16815
|
-
* A contribution is a discriminated union on `kind`:
|
|
16816
|
-
*
|
|
16817
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
16818
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16819
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
16820
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16821
|
-
* login page needs NO change.
|
|
16822
|
-
*
|
|
16823
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
16824
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
16825
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
16826
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
16827
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
16828
|
-
*
|
|
16829
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
16830
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
16831
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
16832
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
16833
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
16834
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
16835
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
16836
|
-
* decision.
|
|
16837
|
-
*
|
|
16838
|
-
* Every contribution carries a `stage`:
|
|
16839
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
16840
|
-
* magic-link buttons; a future usernameless passkey).
|
|
16841
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16842
|
-
* returned `factors` (passkey-as-2FA today).
|
|
16843
|
-
*
|
|
16844
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
16845
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
16846
|
-
* tRPC router.
|
|
17408
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
17409
|
+
* NOT flow through the capability — they use the addon data plane
|
|
17410
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
17411
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
17412
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
17413
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
16847
17414
|
*/
|
|
16848
|
-
|
|
16849
|
-
|
|
16850
|
-
|
|
16851
|
-
|
|
16852
|
-
|
|
16853
|
-
|
|
16854
|
-
|
|
16855
|
-
|
|
16856
|
-
|
|
16857
|
-
|
|
16858
|
-
|
|
16859
|
-
|
|
16860
|
-
|
|
16861
|
-
|
|
16862
|
-
|
|
16863
|
-
|
|
16864
|
-
|
|
16865
|
-
|
|
16866
|
-
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
16872
|
-
|
|
16873
|
-
|
|
16874
|
-
|
|
16875
|
-
|
|
16876
|
-
|
|
16877
|
-
|
|
16878
|
-
|
|
16879
|
-
|
|
16880
|
-
|
|
16881
|
-
|
|
16882
|
-
|
|
16883
|
-
|
|
16884
|
-
|
|
16885
|
-
|
|
16886
|
-
|
|
16887
|
-
|
|
16888
|
-
|
|
16889
|
-
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
17415
|
+
var TerminalSessionInfoSchema = object({
|
|
17416
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
17417
|
+
sessionId: string(),
|
|
17418
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
17419
|
+
profileId: string(),
|
|
17420
|
+
/** Human-readable profile label for the UI session list. */
|
|
17421
|
+
label: string(),
|
|
17422
|
+
cols: number().int().positive(),
|
|
17423
|
+
rows: number().int().positive(),
|
|
17424
|
+
/** ms-epoch the session's pty was spawned. */
|
|
17425
|
+
startedAt: number()
|
|
17426
|
+
});
|
|
17427
|
+
/**
|
|
17428
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
17429
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
17430
|
+
* command string would be remote code execution as the server's user, so it is
|
|
17431
|
+
* deliberately not part of the contract.
|
|
17432
|
+
*/
|
|
17433
|
+
var TerminalProfileInfoSchema = object({
|
|
17434
|
+
profileId: string(),
|
|
17435
|
+
label: string(),
|
|
17436
|
+
description: string().optional()
|
|
17437
|
+
});
|
|
17438
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
17439
|
+
profileId: string(),
|
|
17440
|
+
cols: number().int().positive(),
|
|
17441
|
+
rows: number().int().positive()
|
|
17442
|
+
}), TerminalSessionInfoSchema, {
|
|
17443
|
+
kind: "mutation",
|
|
17444
|
+
auth: "admin"
|
|
17445
|
+
}), method(object({
|
|
17446
|
+
sessionId: string(),
|
|
17447
|
+
cols: number().int().positive(),
|
|
17448
|
+
rows: number().int().positive()
|
|
17449
|
+
}), _void(), {
|
|
17450
|
+
kind: "mutation",
|
|
17451
|
+
auth: "admin"
|
|
17452
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
17453
|
+
kind: "mutation",
|
|
17454
|
+
auth: "admin"
|
|
17455
|
+
});
|
|
16890
17456
|
/**
|
|
16891
17457
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
16892
17458
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
@@ -16988,11 +17554,53 @@ var LocationStatSchema = object({
|
|
|
16988
17554
|
fileCount: number(),
|
|
16989
17555
|
present: boolean()
|
|
16990
17556
|
});
|
|
17557
|
+
/**
|
|
17558
|
+
* A backup schedule — the N:M "entry" that binds one cron cadence to a
|
|
17559
|
+
* SET of destination locations. Supersedes the per-location cron on
|
|
17560
|
+
* `BackupDestinationPolicy`: an operator creates a schedule, picks the
|
|
17561
|
+
* `backups` locations it should write to, and the orchestrator fans a
|
|
17562
|
+
* single archive out to all of them when the cron fires.
|
|
17563
|
+
*
|
|
17564
|
+
* `retentionCount` is per-schedule (D-decision 2026-07-28): every
|
|
17565
|
+
* location targeted by this schedule keeps this many archives from
|
|
17566
|
+
* this schedule's runs.
|
|
17567
|
+
*
|
|
17568
|
+
* `dataSources` optionally narrows which top-level state locations
|
|
17569
|
+
* (db, addons, tls, …) are archived; omitted = the orchestrator's
|
|
17570
|
+
* default full set.
|
|
17571
|
+
*/
|
|
17572
|
+
var BackupScheduleSchema = object({
|
|
17573
|
+
/** Stable id. Generated by the orchestrator on first upsert if absent. */
|
|
17574
|
+
id: string(),
|
|
17575
|
+
/** Operator-facing display name. */
|
|
17576
|
+
label: string(),
|
|
17577
|
+
/** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
|
|
17578
|
+
cron: string(),
|
|
17579
|
+
/** Master on/off toggle for the whole schedule. */
|
|
17580
|
+
enabled: boolean(),
|
|
17581
|
+
/** `backups`-location ids this schedule writes to (fan-out set). */
|
|
17582
|
+
locationIds: array(string()).readonly(),
|
|
17583
|
+
/** Archives kept per targeted location for this schedule. */
|
|
17584
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
17585
|
+
/** Optional subset of source locations to include; omitted = all. */
|
|
17586
|
+
dataSources: array(string()).readonly().optional(),
|
|
17587
|
+
/** ms-epoch of last successful run. */
|
|
17588
|
+
lastRunAt: number().optional(),
|
|
17589
|
+
/** ms-epoch of next computed firing (read-only, filled on list). */
|
|
17590
|
+
nextRunAt: number().optional()
|
|
17591
|
+
});
|
|
16991
17592
|
method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
16992
17593
|
/** Subset of registered `backup-destination` addon ids to write to. */
|
|
16993
17594
|
destinations: array(string()).optional(),
|
|
16994
17595
|
locations: array(string()).optional(),
|
|
16995
|
-
label: string().optional()
|
|
17596
|
+
label: string().optional(),
|
|
17597
|
+
/**
|
|
17598
|
+
* Per-run retention override applied to every targeted
|
|
17599
|
+
* destination. Used by schedule-driven runs (per-entry
|
|
17600
|
+
* retention). Omitted = each destination's own policy
|
|
17601
|
+
* retention (manual runs).
|
|
17602
|
+
*/
|
|
17603
|
+
retentionCount: number().int().min(1).max(1e3).optional()
|
|
16996
17604
|
}).optional(), array(BackupEntrySchema).readonly(), {
|
|
16997
17605
|
kind: "mutation",
|
|
16998
17606
|
auth: "admin"
|
|
@@ -17041,7 +17649,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
17041
17649
|
ok: boolean(),
|
|
17042
17650
|
error: string().optional(),
|
|
17043
17651
|
nextRuns: array(number()).readonly()
|
|
17044
|
-
}))
|
|
17652
|
+
})), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
|
|
17653
|
+
id: string().optional(),
|
|
17654
|
+
label: string(),
|
|
17655
|
+
cron: string(),
|
|
17656
|
+
enabled: boolean(),
|
|
17657
|
+
locationIds: array(string()).readonly(),
|
|
17658
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
17659
|
+
dataSources: array(string()).readonly().optional()
|
|
17660
|
+
}), BackupScheduleSchema, {
|
|
17661
|
+
kind: "mutation",
|
|
17662
|
+
auth: "admin"
|
|
17663
|
+
}), method(object({ id: string() }), _void(), {
|
|
17664
|
+
kind: "mutation",
|
|
17665
|
+
auth: "admin"
|
|
17666
|
+
});
|
|
17045
17667
|
/**
|
|
17046
17668
|
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
17047
17669
|
*
|
|
@@ -18248,851 +18870,934 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
18248
18870
|
kind: "mutation",
|
|
18249
18871
|
auth: "admin"
|
|
18250
18872
|
});
|
|
18251
|
-
|
|
18252
|
-
|
|
18253
|
-
|
|
18254
|
-
|
|
18255
|
-
|
|
18256
|
-
|
|
18257
|
-
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
tags: record(string(), string()).optional()
|
|
18873
|
+
/**
|
|
18874
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
18875
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
18876
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
18877
|
+
*
|
|
18878
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
18879
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
18880
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
18881
|
+
*/
|
|
18882
|
+
var LlmUsageSchema = object({
|
|
18883
|
+
inputTokens: number(),
|
|
18884
|
+
outputTokens: number()
|
|
18264
18885
|
});
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
loadAvg: tuple([
|
|
18280
|
-
number(),
|
|
18281
|
-
number(),
|
|
18282
|
-
number()
|
|
18283
|
-
]),
|
|
18284
|
-
cores: number()
|
|
18285
|
-
});
|
|
18286
|
-
var MemoryInfoSchema = object({
|
|
18287
|
-
percent: number(),
|
|
18288
|
-
totalBytes: number(),
|
|
18289
|
-
usedBytes: number(),
|
|
18290
|
-
availableBytes: number(),
|
|
18291
|
-
swapUsedBytes: number(),
|
|
18292
|
-
swapTotalBytes: number()
|
|
18293
|
-
});
|
|
18294
|
-
var DiskIoSnapshotSchema = object({
|
|
18295
|
-
readBytes: number(),
|
|
18296
|
-
writeBytes: number(),
|
|
18297
|
-
readOps: number(),
|
|
18298
|
-
writeOps: number(),
|
|
18299
|
-
timestampMs: number()
|
|
18300
|
-
});
|
|
18301
|
-
var NetworkIoSnapshotSchema = object({
|
|
18302
|
-
rxBytes: number(),
|
|
18303
|
-
txBytes: number(),
|
|
18304
|
-
rxPackets: number(),
|
|
18305
|
-
txPackets: number(),
|
|
18306
|
-
rxErrors: number(),
|
|
18307
|
-
txErrors: number(),
|
|
18308
|
-
timestampMs: number()
|
|
18309
|
-
});
|
|
18310
|
-
var MetricsGpuInfoSchema = object({
|
|
18311
|
-
utilization: number(),
|
|
18886
|
+
var LlmErrorCodeSchema = _enum([
|
|
18887
|
+
"timeout",
|
|
18888
|
+
"rate-limited",
|
|
18889
|
+
"auth",
|
|
18890
|
+
"refusal",
|
|
18891
|
+
"bad-request",
|
|
18892
|
+
"unavailable",
|
|
18893
|
+
"no-profile",
|
|
18894
|
+
"budget-exceeded",
|
|
18895
|
+
"adapter-error"
|
|
18896
|
+
]);
|
|
18897
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
18898
|
+
ok: literal(true),
|
|
18899
|
+
text: string(),
|
|
18312
18900
|
model: string(),
|
|
18313
|
-
|
|
18314
|
-
|
|
18315
|
-
|
|
18316
|
-
})
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
18323
|
-
|
|
18324
|
-
|
|
18325
|
-
|
|
18326
|
-
|
|
18901
|
+
usage: LlmUsageSchema,
|
|
18902
|
+
truncated: boolean(),
|
|
18903
|
+
latencyMs: number()
|
|
18904
|
+
}), object({
|
|
18905
|
+
ok: literal(false),
|
|
18906
|
+
code: LlmErrorCodeSchema,
|
|
18907
|
+
message: string(),
|
|
18908
|
+
retryAfterMs: number().optional()
|
|
18909
|
+
})]);
|
|
18910
|
+
/**
|
|
18911
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
18912
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
18913
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
18914
|
+
*/
|
|
18915
|
+
var LlmImageSchema = object({
|
|
18916
|
+
bytes: _instanceof(Uint8Array),
|
|
18917
|
+
mimeType: string()
|
|
18327
18918
|
});
|
|
18328
|
-
var
|
|
18329
|
-
|
|
18330
|
-
|
|
18919
|
+
var LlmGenerateBaseInputSchema = object({
|
|
18920
|
+
/** Collection routing (the notification-output posture). */
|
|
18921
|
+
addonId: string().optional(),
|
|
18922
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
18923
|
+
profileId: string().optional(),
|
|
18924
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
18925
|
+
consumer: string(),
|
|
18926
|
+
system: string().optional(),
|
|
18927
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
18928
|
+
prompt: string(),
|
|
18929
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
18930
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
18931
|
+
/** Per-call override of the profile default. */
|
|
18932
|
+
maxTokens: number().int().positive().optional(),
|
|
18933
|
+
temperature: number().optional()
|
|
18331
18934
|
});
|
|
18332
|
-
|
|
18333
|
-
|
|
18334
|
-
|
|
18335
|
-
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
|
|
18339
|
-
|
|
18340
|
-
|
|
18341
|
-
|
|
18935
|
+
/**
|
|
18936
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
18937
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
18938
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
18939
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
18940
|
+
* this only through the `llm` cap's methods.
|
|
18941
|
+
*
|
|
18942
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
18943
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
18944
|
+
* watchdog — operator decision #3).
|
|
18945
|
+
*/
|
|
18946
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
18947
|
+
object({
|
|
18948
|
+
kind: literal("catalog"),
|
|
18949
|
+
catalogId: string()
|
|
18342
18950
|
}),
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
|
|
18346
|
-
|
|
18347
|
-
|
|
18348
|
-
|
|
18349
|
-
|
|
18350
|
-
|
|
18351
|
-
|
|
18352
|
-
|
|
18353
|
-
|
|
18354
|
-
|
|
18355
|
-
|
|
18356
|
-
|
|
18357
|
-
|
|
18358
|
-
|
|
18359
|
-
|
|
18360
|
-
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18364
|
-
*/
|
|
18365
|
-
|
|
18366
|
-
/**
|
|
18367
|
-
|
|
18368
|
-
|
|
18369
|
-
|
|
18370
|
-
sharedBytes: number().optional()
|
|
18951
|
+
object({
|
|
18952
|
+
kind: literal("url"),
|
|
18953
|
+
url: string(),
|
|
18954
|
+
sha256: string().optional()
|
|
18955
|
+
}),
|
|
18956
|
+
object({
|
|
18957
|
+
kind: literal("path"),
|
|
18958
|
+
path: string()
|
|
18959
|
+
})
|
|
18960
|
+
]);
|
|
18961
|
+
var ManagedRuntimeConfigSchema = object({
|
|
18962
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
18963
|
+
nodeId: string(),
|
|
18964
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
18965
|
+
engine: _enum(["llama-cpp"]),
|
|
18966
|
+
model: ManagedModelRefSchema,
|
|
18967
|
+
contextSize: number().int().default(4096),
|
|
18968
|
+
/** 0 = CPU-only. */
|
|
18969
|
+
gpuLayers: number().int().default(0),
|
|
18970
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
18971
|
+
threads: number().int().optional(),
|
|
18972
|
+
/** Concurrent slots. */
|
|
18973
|
+
parallel: number().int().default(1),
|
|
18974
|
+
/** Else lazy: first generate boots it. */
|
|
18975
|
+
autoStart: boolean().default(false),
|
|
18976
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
18977
|
+
idleStopMinutes: number().int().default(30)
|
|
18371
18978
|
});
|
|
18372
|
-
var
|
|
18373
|
-
|
|
18979
|
+
var LlmRuntimeStatusSchema = object({
|
|
18980
|
+
/** Status is ALWAYS node-qualified. */
|
|
18374
18981
|
nodeId: string(),
|
|
18375
|
-
role: _enum(["hub", "worker"]),
|
|
18376
|
-
pid: number(),
|
|
18377
18982
|
state: _enum([
|
|
18378
|
-
"starting",
|
|
18379
|
-
"running",
|
|
18380
|
-
"stopping",
|
|
18381
18983
|
"stopped",
|
|
18382
|
-
"
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18387
|
-
pid: number(),
|
|
18388
|
-
ppid: number(),
|
|
18389
|
-
pgid: number(),
|
|
18390
|
-
classification: _enum([
|
|
18391
|
-
"root",
|
|
18392
|
-
"managed",
|
|
18393
|
-
"system",
|
|
18394
|
-
"ghost"
|
|
18984
|
+
"downloading",
|
|
18985
|
+
"starting",
|
|
18986
|
+
"ready",
|
|
18987
|
+
"crashed",
|
|
18988
|
+
"failed"
|
|
18395
18989
|
]),
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
18407
|
-
orphaned: boolean()
|
|
18990
|
+
pid: number().optional(),
|
|
18991
|
+
port: number().optional(),
|
|
18992
|
+
modelPath: string().optional(),
|
|
18993
|
+
modelId: string().optional(),
|
|
18994
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
18995
|
+
lastError: string().optional(),
|
|
18996
|
+
crashesInWindow: number(),
|
|
18997
|
+
/** Child RSS (sampled best-effort). */
|
|
18998
|
+
memoryBytes: number().optional(),
|
|
18999
|
+
vramBytes: number().optional()
|
|
18408
19000
|
});
|
|
18409
|
-
var
|
|
18410
|
-
|
|
18411
|
-
|
|
18412
|
-
|
|
19001
|
+
var LlmNodeModelSchema = object({
|
|
19002
|
+
file: string(),
|
|
19003
|
+
sizeBytes: number(),
|
|
19004
|
+
catalogId: string().optional(),
|
|
19005
|
+
installedAt: number().optional()
|
|
18413
19006
|
});
|
|
18414
|
-
var
|
|
18415
|
-
|
|
18416
|
-
|
|
18417
|
-
|
|
19007
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
19008
|
+
nodeId: string(),
|
|
19009
|
+
modelsBytes: number(),
|
|
19010
|
+
freeBytes: number().optional()
|
|
18418
19011
|
});
|
|
18419
|
-
|
|
18420
|
-
|
|
18421
|
-
|
|
18422
|
-
|
|
18423
|
-
|
|
18424
|
-
|
|
18425
|
-
path: string().optional(),
|
|
18426
|
-
/** Process pid that was signalled. */
|
|
18427
|
-
pid: number().optional(),
|
|
18428
|
-
reason: string().optional()
|
|
18429
|
-
});
|
|
18430
|
-
var SystemMetricsSchema = object({
|
|
18431
|
-
cpuPercent: number(),
|
|
18432
|
-
memoryPercent: number(),
|
|
18433
|
-
memoryUsedMB: number(),
|
|
18434
|
-
memoryTotalMB: number(),
|
|
18435
|
-
diskPercent: number().optional(),
|
|
18436
|
-
temperature: number().optional(),
|
|
18437
|
-
gpuPercent: number().optional(),
|
|
18438
|
-
gpuMemoryPercent: number().optional()
|
|
18439
|
-
});
|
|
18440
|
-
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, {
|
|
19012
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
19013
|
+
images: array(LlmImageSchema).optional(),
|
|
19014
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
19015
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
19016
|
+
timeoutMs: number().int().positive().optional()
|
|
19017
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
18441
19018
|
kind: "mutation",
|
|
18442
19019
|
auth: "admin"
|
|
18443
|
-
}), method(
|
|
19020
|
+
}), method(object({}), _void(), {
|
|
18444
19021
|
kind: "mutation",
|
|
18445
19022
|
auth: "admin"
|
|
18446
|
-
})
|
|
18447
|
-
method(object({
|
|
18448
|
-
sourceUrl: string(),
|
|
18449
|
-
metadata: ModelConvertMetadataSchema,
|
|
18450
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
18451
|
-
calibrationRef: string().optional(),
|
|
18452
|
-
sessionId: string().optional()
|
|
18453
|
-
}), ConvertResultSchema, {
|
|
19023
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
18454
19024
|
kind: "mutation",
|
|
18455
|
-
auth: "admin"
|
|
18456
|
-
|
|
18457
|
-
});
|
|
18458
|
-
method(object({
|
|
18459
|
-
nodeId: string(),
|
|
18460
|
-
modelId: string(),
|
|
18461
|
-
format: _enum(MODEL_FORMATS),
|
|
18462
|
-
entry: ModelCatalogEntrySchema
|
|
18463
|
-
}), object({
|
|
18464
|
-
ok: boolean(),
|
|
18465
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
18466
|
-
sha256: string(),
|
|
18467
|
-
bytes: number(),
|
|
18468
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
18469
|
-
path: string()
|
|
18470
|
-
}), {
|
|
19025
|
+
auth: "admin"
|
|
19026
|
+
}), method(object({ file: string() }), _void(), {
|
|
18471
19027
|
kind: "mutation",
|
|
18472
19028
|
auth: "admin"
|
|
18473
|
-
});
|
|
18474
|
-
/**
|
|
18475
|
-
* `mqtt-broker` — broker-registry cap.
|
|
18476
|
-
*
|
|
18477
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
18478
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
18479
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
18480
|
-
* its OWN `mqtt.js` client.
|
|
18481
|
-
*
|
|
18482
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
18483
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
18484
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
18485
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
18486
|
-
* features anyway — give it the connection config, get out of the way.
|
|
18487
|
-
*
|
|
18488
|
-
* Consumer flow:
|
|
18489
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
18490
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
18491
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
18492
|
-
*
|
|
18493
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
18494
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
18495
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
18496
|
-
* spawned it.
|
|
18497
|
-
*/
|
|
18498
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
19029
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
18499
19030
|
/**
|
|
18500
|
-
*
|
|
19031
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
19032
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
19033
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
19034
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
19035
|
+
* (hub-placed); the cap stays open for future providers.
|
|
18501
19036
|
*
|
|
18502
|
-
*
|
|
18503
|
-
*
|
|
18504
|
-
*
|
|
18505
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
18506
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
19037
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
19038
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
19039
|
+
* write; a stored key NEVER round-trips to a client.
|
|
18507
19040
|
*/
|
|
18508
|
-
var
|
|
18509
|
-
"
|
|
18510
|
-
"
|
|
18511
|
-
"
|
|
18512
|
-
"
|
|
18513
|
-
"
|
|
19041
|
+
var LlmProfileKindSchema = _enum([
|
|
19042
|
+
"openai-compatible",
|
|
19043
|
+
"openai",
|
|
19044
|
+
"anthropic",
|
|
19045
|
+
"google",
|
|
19046
|
+
"managed-local"
|
|
18514
19047
|
]);
|
|
18515
|
-
var
|
|
19048
|
+
var LlmProfileSchema = object({
|
|
18516
19049
|
id: string(),
|
|
18517
19050
|
name: string(),
|
|
18518
|
-
|
|
18519
|
-
|
|
18520
|
-
|
|
18521
|
-
|
|
18522
|
-
|
|
18523
|
-
|
|
18524
|
-
|
|
18525
|
-
|
|
18526
|
-
|
|
19051
|
+
kind: LlmProfileKindSchema,
|
|
19052
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
19053
|
+
addonId: string(),
|
|
19054
|
+
enabled: boolean(),
|
|
19055
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
19056
|
+
model: string(),
|
|
19057
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
19058
|
+
baseUrl: string().optional(),
|
|
19059
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
19060
|
+
apiKey: string().optional(),
|
|
19061
|
+
supportsVision: boolean(),
|
|
19062
|
+
temperature: number().min(0).max(2).optional(),
|
|
19063
|
+
maxTokens: number().int().positive().optional(),
|
|
19064
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
19065
|
+
extraHeaders: record(string(), string()).optional(),
|
|
19066
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
19067
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
18527
19068
|
});
|
|
18528
|
-
/**
|
|
18529
|
-
*
|
|
18530
|
-
*
|
|
18531
|
-
|
|
18532
|
-
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
|
|
18536
|
-
|
|
18537
|
-
|
|
18538
|
-
|
|
18539
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
18540
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
18541
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
18542
|
-
* broker).
|
|
18543
|
-
*/
|
|
18544
|
-
clientIdPrefix: string().optional()
|
|
19069
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
19070
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
19071
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
19072
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
19073
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
19074
|
+
kind: LlmProfileKindSchema,
|
|
19075
|
+
label: string(),
|
|
19076
|
+
icon: string(),
|
|
19077
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
19078
|
+
addonId: string(),
|
|
19079
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
18545
19080
|
});
|
|
18546
|
-
var
|
|
18547
|
-
|
|
18548
|
-
|
|
18549
|
-
|
|
18550
|
-
password: string().optional(),
|
|
18551
|
-
clientIdPrefix: string().optional()
|
|
19081
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
19082
|
+
var LlmDefaultSchema = object({
|
|
19083
|
+
selector: LlmDefaultSelectorSchema,
|
|
19084
|
+
profileId: string()
|
|
18552
19085
|
});
|
|
18553
|
-
|
|
18554
|
-
var
|
|
18555
|
-
|
|
18556
|
-
|
|
18557
|
-
|
|
18558
|
-
|
|
18559
|
-
|
|
18560
|
-
|
|
18561
|
-
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
18565
|
-
allowAnonymous: boolean().default(false),
|
|
18566
|
-
/** Optional shared username/password for clients. */
|
|
18567
|
-
username: string().optional(),
|
|
18568
|
-
password: string().optional()
|
|
19086
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
19087
|
+
var LlmUsageRollupSchema = object({
|
|
19088
|
+
day: string(),
|
|
19089
|
+
consumer: string(),
|
|
19090
|
+
profileId: string(),
|
|
19091
|
+
calls: number(),
|
|
19092
|
+
okCalls: number(),
|
|
19093
|
+
errorCalls: number(),
|
|
19094
|
+
inputTokens: number(),
|
|
19095
|
+
outputTokens: number(),
|
|
19096
|
+
avgLatencyMs: number()
|
|
18569
19097
|
});
|
|
18570
|
-
|
|
19098
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
19099
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
18571
19100
|
id: string(),
|
|
18572
|
-
|
|
18573
|
-
|
|
18574
|
-
|
|
18575
|
-
brokerCount: number(),
|
|
18576
|
-
embeddedRunning: boolean()
|
|
18577
|
-
});
|
|
18578
|
-
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);
|
|
18579
|
-
var NetworkEndpointSchema = object({
|
|
19101
|
+
label: string(),
|
|
19102
|
+
family: string(),
|
|
19103
|
+
purpose: _enum(["text", "vision"]),
|
|
18580
19104
|
url: string(),
|
|
18581
|
-
|
|
18582
|
-
|
|
18583
|
-
|
|
19105
|
+
sha256: string(),
|
|
19106
|
+
sizeBytes: number(),
|
|
19107
|
+
quantization: string(),
|
|
19108
|
+
/** Load-time guidance shown in the picker. */
|
|
19109
|
+
minRamBytes: number(),
|
|
19110
|
+
contextSizeDefault: number().int(),
|
|
19111
|
+
/** Vision models: companion projector file. */
|
|
19112
|
+
mmprojUrl: string().optional()
|
|
18584
19113
|
});
|
|
18585
|
-
var
|
|
18586
|
-
|
|
18587
|
-
|
|
19114
|
+
var LlmRuntimeNodeSchema = object({
|
|
19115
|
+
nodeId: string(),
|
|
19116
|
+
reachable: boolean(),
|
|
19117
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
19118
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
18588
19119
|
error: string().optional()
|
|
18589
19120
|
});
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
* the originating provider config (mode + sourcePort) so the
|
|
18595
|
-
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
18596
|
-
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
18597
|
-
*/
|
|
18598
|
-
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
18599
|
-
/**
|
|
18600
|
-
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
18601
|
-
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
18602
|
-
*/
|
|
18603
|
-
id: string(),
|
|
18604
|
-
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
18605
|
-
label: string(),
|
|
18606
|
-
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
18607
|
-
mode: string().optional(),
|
|
18608
|
-
/** Originating local port the ingress fronts (informational). */
|
|
18609
|
-
sourcePort: number().optional()
|
|
19121
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
19122
|
+
var ProfileRefInputSchema = object({
|
|
19123
|
+
addonId: string(),
|
|
19124
|
+
profileId: string()
|
|
18610
19125
|
});
|
|
18611
|
-
method(
|
|
18612
|
-
|
|
18613
|
-
|
|
18614
|
-
|
|
18615
|
-
|
|
18616
|
-
|
|
18617
|
-
|
|
18618
|
-
|
|
18619
|
-
|
|
18620
|
-
|
|
18621
|
-
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
|
|
18627
|
-
|
|
18628
|
-
|
|
18629
|
-
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
|
|
18633
|
-
|
|
18634
|
-
|
|
18635
|
-
|
|
18636
|
-
|
|
18637
|
-
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
|
|
18643
|
-
|
|
18644
|
-
|
|
18645
|
-
|
|
18646
|
-
|
|
18647
|
-
|
|
18648
|
-
"
|
|
18649
|
-
|
|
18650
|
-
|
|
18651
|
-
"
|
|
18652
|
-
"
|
|
19126
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
19127
|
+
kind: "mutation",
|
|
19128
|
+
auth: "admin"
|
|
19129
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
19130
|
+
kind: "mutation",
|
|
19131
|
+
auth: "admin"
|
|
19132
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
19133
|
+
kind: "mutation",
|
|
19134
|
+
auth: "admin"
|
|
19135
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
19136
|
+
selector: LlmDefaultSelectorSchema,
|
|
19137
|
+
profileId: string().nullable()
|
|
19138
|
+
}), _void(), {
|
|
19139
|
+
kind: "mutation",
|
|
19140
|
+
auth: "admin"
|
|
19141
|
+
}), method(object({
|
|
19142
|
+
since: number().optional(),
|
|
19143
|
+
until: number().optional(),
|
|
19144
|
+
consumer: string().optional(),
|
|
19145
|
+
profileId: string().optional()
|
|
19146
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
19147
|
+
nodeId: string(),
|
|
19148
|
+
model: ManagedModelRefSchema
|
|
19149
|
+
}), _void(), {
|
|
19150
|
+
kind: "mutation",
|
|
19151
|
+
auth: "admin"
|
|
19152
|
+
}), method(object({
|
|
19153
|
+
nodeId: string(),
|
|
19154
|
+
file: string()
|
|
19155
|
+
}), _void(), {
|
|
19156
|
+
kind: "mutation",
|
|
19157
|
+
auth: "admin"
|
|
19158
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
19159
|
+
kind: "mutation",
|
|
19160
|
+
auth: "admin"
|
|
19161
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
19162
|
+
kind: "mutation",
|
|
19163
|
+
auth: "admin"
|
|
19164
|
+
});
|
|
19165
|
+
var LogLevelSchema = _enum([
|
|
19166
|
+
"debug",
|
|
19167
|
+
"info",
|
|
19168
|
+
"warn",
|
|
19169
|
+
"error"
|
|
18653
19170
|
]);
|
|
19171
|
+
var LogEntrySchema = object({
|
|
19172
|
+
timestamp: date(),
|
|
19173
|
+
level: LogLevelSchema,
|
|
19174
|
+
scope: array(string()),
|
|
19175
|
+
message: string(),
|
|
19176
|
+
meta: record(string(), unknown()).optional(),
|
|
19177
|
+
tags: record(string(), string()).optional()
|
|
19178
|
+
});
|
|
19179
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
19180
|
+
scope: array(string()).optional(),
|
|
19181
|
+
level: LogLevelSchema.optional(),
|
|
19182
|
+
since: date().optional(),
|
|
19183
|
+
until: date().optional(),
|
|
19184
|
+
limit: number().optional(),
|
|
19185
|
+
tags: record(string(), string()).optional()
|
|
19186
|
+
}), array(LogEntrySchema).readonly());
|
|
18654
19187
|
/**
|
|
18655
|
-
*
|
|
18656
|
-
*
|
|
18657
|
-
*
|
|
18658
|
-
*
|
|
19188
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
19189
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
19190
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
19191
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
19192
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
19193
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
19194
|
+
*
|
|
19195
|
+
* A contribution is a discriminated union on `kind`:
|
|
19196
|
+
*
|
|
19197
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
19198
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
19199
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
19200
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19201
|
+
* login page needs NO change.
|
|
19202
|
+
*
|
|
19203
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
19204
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
19205
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
19206
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
19207
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
19208
|
+
*
|
|
19209
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
19210
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
19211
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
19212
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
19213
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
19214
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
19215
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
19216
|
+
* decision.
|
|
19217
|
+
*
|
|
19218
|
+
* Every contribution carries a `stage`:
|
|
19219
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
19220
|
+
* magic-link buttons; a future usernameless passkey).
|
|
19221
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
19222
|
+
* returned `factors` (passkey-as-2FA today).
|
|
19223
|
+
*
|
|
19224
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
19225
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
19226
|
+
* tRPC router.
|
|
18659
19227
|
*/
|
|
18660
|
-
|
|
18661
|
-
|
|
18662
|
-
|
|
18663
|
-
|
|
18664
|
-
|
|
18665
|
-
|
|
18666
|
-
|
|
18667
|
-
|
|
18668
|
-
|
|
18669
|
-
|
|
18670
|
-
|
|
19228
|
+
/** When a login method renders in the two-phase login flow. */
|
|
19229
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
19230
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
19231
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
19232
|
+
object({
|
|
19233
|
+
kind: literal("redirect"),
|
|
19234
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
19235
|
+
id: string(),
|
|
19236
|
+
/** Operator-facing button label. */
|
|
19237
|
+
label: string(),
|
|
19238
|
+
/** lucide-react icon name. */
|
|
19239
|
+
icon: string().optional(),
|
|
19240
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
19241
|
+
startUrl: string(),
|
|
19242
|
+
stage: LoginStageEnum
|
|
19243
|
+
}),
|
|
19244
|
+
object({
|
|
19245
|
+
kind: literal("widget"),
|
|
19246
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
19247
|
+
id: string(),
|
|
19248
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
19249
|
+
addonId: string(),
|
|
19250
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
19251
|
+
bundle: string(),
|
|
19252
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
19253
|
+
remote: WidgetRemoteSchema,
|
|
19254
|
+
stage: LoginStageEnum
|
|
19255
|
+
}),
|
|
19256
|
+
object({
|
|
19257
|
+
kind: literal("passkey"),
|
|
19258
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
19259
|
+
id: string(),
|
|
19260
|
+
/** Operator-facing button label. */
|
|
19261
|
+
label: string(),
|
|
19262
|
+
stage: LoginStageEnum,
|
|
19263
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
19264
|
+
rpId: string(),
|
|
19265
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
19266
|
+
origin: string().nullable()
|
|
19267
|
+
})
|
|
18671
19268
|
]);
|
|
18672
|
-
|
|
18673
|
-
var
|
|
18674
|
-
|
|
18675
|
-
|
|
18676
|
-
|
|
19269
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
19270
|
+
var CpuBreakdownSchema = object({
|
|
19271
|
+
total: number(),
|
|
19272
|
+
user: number(),
|
|
19273
|
+
system: number(),
|
|
19274
|
+
irq: number(),
|
|
19275
|
+
nice: number(),
|
|
19276
|
+
loadAvg: tuple([
|
|
19277
|
+
number(),
|
|
19278
|
+
number(),
|
|
19279
|
+
number()
|
|
19280
|
+
]),
|
|
19281
|
+
cores: number()
|
|
18677
19282
|
});
|
|
18678
|
-
|
|
18679
|
-
|
|
18680
|
-
|
|
18681
|
-
|
|
18682
|
-
|
|
18683
|
-
|
|
18684
|
-
|
|
18685
|
-
|
|
18686
|
-
var
|
|
18687
|
-
|
|
18688
|
-
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
|
|
18692
|
-
|
|
18693
|
-
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
|
|
18700
|
-
|
|
19283
|
+
var MemoryInfoSchema = object({
|
|
19284
|
+
percent: number(),
|
|
19285
|
+
totalBytes: number(),
|
|
19286
|
+
usedBytes: number(),
|
|
19287
|
+
availableBytes: number(),
|
|
19288
|
+
swapUsedBytes: number(),
|
|
19289
|
+
swapTotalBytes: number()
|
|
19290
|
+
});
|
|
19291
|
+
var DiskIoSnapshotSchema = object({
|
|
19292
|
+
readBytes: number(),
|
|
19293
|
+
writeBytes: number(),
|
|
19294
|
+
readOps: number(),
|
|
19295
|
+
writeOps: number(),
|
|
19296
|
+
timestampMs: number()
|
|
19297
|
+
});
|
|
19298
|
+
var NetworkIoSnapshotSchema = object({
|
|
19299
|
+
rxBytes: number(),
|
|
19300
|
+
txBytes: number(),
|
|
19301
|
+
rxPackets: number(),
|
|
19302
|
+
txPackets: number(),
|
|
19303
|
+
rxErrors: number(),
|
|
19304
|
+
txErrors: number(),
|
|
19305
|
+
timestampMs: number()
|
|
19306
|
+
});
|
|
19307
|
+
var MetricsGpuInfoSchema = object({
|
|
19308
|
+
utilization: number(),
|
|
19309
|
+
model: string(),
|
|
19310
|
+
memoryUsedBytes: number(),
|
|
19311
|
+
memoryTotalBytes: number(),
|
|
19312
|
+
temperature: number().nullable()
|
|
19313
|
+
});
|
|
19314
|
+
var ProcessResourceInfoSchema = object({
|
|
19315
|
+
openFds: number(),
|
|
19316
|
+
threadCount: number(),
|
|
19317
|
+
activeHandles: number(),
|
|
19318
|
+
activeRequests: number()
|
|
18701
19319
|
});
|
|
18702
|
-
|
|
18703
|
-
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
18707
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
18708
|
-
flags: object({
|
|
18709
|
-
critical: boolean().optional(),
|
|
18710
|
-
silent: boolean().optional(),
|
|
18711
|
-
noPush: boolean().optional()
|
|
18712
|
-
}).optional(),
|
|
18713
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
18714
|
-
requires: array(string()).optional(),
|
|
18715
|
-
description: string().optional()
|
|
19320
|
+
var PressureAvgsSchema = object({
|
|
19321
|
+
avg10: number(),
|
|
19322
|
+
avg60: number(),
|
|
19323
|
+
avg300: number()
|
|
18716
19324
|
});
|
|
18717
|
-
|
|
18718
|
-
|
|
18719
|
-
|
|
18720
|
-
|
|
18721
|
-
|
|
18722
|
-
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
|
|
18726
|
-
|
|
18727
|
-
|
|
19325
|
+
var PressureInfoSchema = object({
|
|
19326
|
+
some: PressureAvgsSchema,
|
|
19327
|
+
full: PressureAvgsSchema.nullable()
|
|
19328
|
+
});
|
|
19329
|
+
var SystemResourceSnapshotSchema = object({
|
|
19330
|
+
cpu: CpuBreakdownSchema,
|
|
19331
|
+
memory: MemoryInfoSchema,
|
|
19332
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
19333
|
+
network: NetworkIoSnapshotSchema,
|
|
19334
|
+
disk: DiskIoSnapshotSchema,
|
|
19335
|
+
pressure: object({
|
|
19336
|
+
cpu: PressureInfoSchema.nullable(),
|
|
19337
|
+
memory: PressureInfoSchema.nullable(),
|
|
19338
|
+
io: PressureInfoSchema.nullable()
|
|
18728
19339
|
}),
|
|
18729
|
-
|
|
18730
|
-
|
|
18731
|
-
|
|
18732
|
-
format: array(NotificationFormatSchema),
|
|
18733
|
-
clickUrl: boolean(),
|
|
18734
|
-
sound: boolean(),
|
|
18735
|
-
ttl: boolean(),
|
|
18736
|
-
bodyMaxLen: number().int().positive()
|
|
19340
|
+
process: ProcessResourceInfoSchema,
|
|
19341
|
+
cpuTemperature: number().nullable(),
|
|
19342
|
+
timestampMs: number()
|
|
18737
19343
|
});
|
|
18738
|
-
|
|
18739
|
-
|
|
18740
|
-
|
|
18741
|
-
|
|
18742
|
-
|
|
18743
|
-
|
|
18744
|
-
*/
|
|
18745
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
18746
|
-
var TargetKindSchema = object({
|
|
18747
|
-
kind: string(),
|
|
18748
|
-
label: string(),
|
|
18749
|
-
icon: string(),
|
|
18750
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
18751
|
-
addonId: string(),
|
|
18752
|
-
configSchema: ConfigSchemaPassthrough$1,
|
|
18753
|
-
supportsDiscovery: boolean(),
|
|
18754
|
-
caps: TargetKindCapsSchema
|
|
19344
|
+
var DiskSpaceInfoSchema = object({
|
|
19345
|
+
path: string(),
|
|
19346
|
+
totalBytes: number(),
|
|
19347
|
+
usedBytes: number(),
|
|
19348
|
+
availableBytes: number(),
|
|
19349
|
+
percent: number()
|
|
18755
19350
|
});
|
|
18756
|
-
|
|
18757
|
-
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
|
|
18761
|
-
|
|
18762
|
-
|
|
18763
|
-
|
|
18764
|
-
|
|
19351
|
+
var PidResourceStatsSchema = object({
|
|
19352
|
+
pid: number(),
|
|
19353
|
+
cpu: number(),
|
|
19354
|
+
memory: number(),
|
|
19355
|
+
/**
|
|
19356
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
19357
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
19358
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
19359
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
19360
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
19361
|
+
*/
|
|
19362
|
+
privateBytes: number().optional(),
|
|
19363
|
+
/**
|
|
19364
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
19365
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
19366
|
+
*/
|
|
19367
|
+
sharedBytes: number().optional()
|
|
19368
|
+
});
|
|
19369
|
+
var AddonInstanceSchema = object({
|
|
18765
19370
|
addonId: string(),
|
|
18766
|
-
|
|
18767
|
-
|
|
19371
|
+
nodeId: string(),
|
|
19372
|
+
role: _enum(["hub", "worker"]),
|
|
19373
|
+
pid: number(),
|
|
19374
|
+
state: _enum([
|
|
19375
|
+
"starting",
|
|
19376
|
+
"running",
|
|
19377
|
+
"stopping",
|
|
19378
|
+
"stopped",
|
|
19379
|
+
"crashed"
|
|
19380
|
+
]),
|
|
19381
|
+
uptimeSec: number()
|
|
18768
19382
|
});
|
|
18769
|
-
|
|
18770
|
-
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
19383
|
+
var NodeProcessSchema = object({
|
|
19384
|
+
pid: number(),
|
|
19385
|
+
ppid: number(),
|
|
19386
|
+
pgid: number(),
|
|
19387
|
+
classification: _enum([
|
|
19388
|
+
"root",
|
|
19389
|
+
"managed",
|
|
19390
|
+
"system",
|
|
19391
|
+
"ghost"
|
|
19392
|
+
]),
|
|
19393
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
19394
|
+
addonId: string().nullable(),
|
|
19395
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
19396
|
+
nodeId: string().nullable(),
|
|
19397
|
+
/** Truncated command line. */
|
|
19398
|
+
command: string(),
|
|
19399
|
+
cpuPercent: number(),
|
|
19400
|
+
memoryRssBytes: number(),
|
|
19401
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
19402
|
+
uptimeSec: number(),
|
|
19403
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
19404
|
+
orphaned: boolean()
|
|
18774
19405
|
});
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
attachmentsSent: number().int().nonnegative(),
|
|
18780
|
-
actionsSent: number().int().nonnegative(),
|
|
18781
|
-
truncated: boolean(),
|
|
18782
|
-
dropped: array(string())
|
|
19406
|
+
var KillProcessInputSchema = object({
|
|
19407
|
+
pid: number(),
|
|
19408
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
19409
|
+
force: boolean().optional()
|
|
18783
19410
|
});
|
|
18784
|
-
var
|
|
19411
|
+
var KillProcessResultSchema = object({
|
|
19412
|
+
success: boolean(),
|
|
19413
|
+
reason: string().optional(),
|
|
19414
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
19415
|
+
});
|
|
19416
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
19417
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
19418
|
+
addonId: string() });
|
|
19419
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
18785
19420
|
success: boolean(),
|
|
19421
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
19422
|
+
path: string().optional(),
|
|
19423
|
+
/** Process pid that was signalled. */
|
|
19424
|
+
pid: number().optional(),
|
|
19425
|
+
reason: string().optional()
|
|
19426
|
+
});
|
|
19427
|
+
var SystemMetricsSchema = object({
|
|
19428
|
+
cpuPercent: number(),
|
|
19429
|
+
memoryPercent: number(),
|
|
19430
|
+
memoryUsedMB: number(),
|
|
19431
|
+
memoryTotalMB: number(),
|
|
19432
|
+
diskPercent: number().optional(),
|
|
19433
|
+
temperature: number().optional(),
|
|
19434
|
+
gpuPercent: number().optional(),
|
|
19435
|
+
gpuMemoryPercent: number().optional()
|
|
19436
|
+
});
|
|
19437
|
+
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, {
|
|
19438
|
+
kind: "mutation",
|
|
19439
|
+
auth: "admin"
|
|
19440
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
19441
|
+
kind: "mutation",
|
|
19442
|
+
auth: "admin"
|
|
19443
|
+
});
|
|
19444
|
+
method(object({
|
|
19445
|
+
sourceUrl: string(),
|
|
19446
|
+
metadata: ModelConvertMetadataSchema,
|
|
19447
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
19448
|
+
calibrationRef: string().optional(),
|
|
19449
|
+
sessionId: string().optional()
|
|
19450
|
+
}), ConvertResultSchema, {
|
|
19451
|
+
kind: "mutation",
|
|
19452
|
+
auth: "admin",
|
|
19453
|
+
timeoutMs: 6e5
|
|
19454
|
+
});
|
|
19455
|
+
method(object({
|
|
19456
|
+
nodeId: string(),
|
|
19457
|
+
modelId: string(),
|
|
19458
|
+
format: _enum(MODEL_FORMATS),
|
|
19459
|
+
entry: ModelCatalogEntrySchema
|
|
19460
|
+
}), object({
|
|
19461
|
+
ok: boolean(),
|
|
19462
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
19463
|
+
sha256: string(),
|
|
19464
|
+
bytes: number(),
|
|
19465
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
19466
|
+
path: string()
|
|
19467
|
+
}), {
|
|
19468
|
+
kind: "mutation",
|
|
19469
|
+
auth: "admin"
|
|
19470
|
+
});
|
|
19471
|
+
/**
|
|
19472
|
+
* `mqtt-broker` — broker-registry cap.
|
|
19473
|
+
*
|
|
19474
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
19475
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
19476
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
19477
|
+
* its OWN `mqtt.js` client.
|
|
19478
|
+
*
|
|
19479
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
19480
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
19481
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
19482
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
19483
|
+
* features anyway — give it the connection config, get out of the way.
|
|
19484
|
+
*
|
|
19485
|
+
* Consumer flow:
|
|
19486
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
19487
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
19488
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
19489
|
+
*
|
|
19490
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
19491
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
19492
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
19493
|
+
* spawned it.
|
|
19494
|
+
*/
|
|
19495
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
19496
|
+
/**
|
|
19497
|
+
* Broker live-probe status.
|
|
19498
|
+
*
|
|
19499
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
19500
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
19501
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
19502
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
19503
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
19504
|
+
*/
|
|
19505
|
+
var BrokerStatusSchema$1 = _enum([
|
|
19506
|
+
"connected",
|
|
19507
|
+
"disconnected",
|
|
19508
|
+
"auth-failed",
|
|
19509
|
+
"unreachable",
|
|
19510
|
+
"tls-error"
|
|
19511
|
+
]);
|
|
19512
|
+
var BrokerInfoSchema = object({
|
|
19513
|
+
id: string(),
|
|
19514
|
+
name: string(),
|
|
19515
|
+
url: string(),
|
|
19516
|
+
kind: BrokerKindSchema,
|
|
19517
|
+
status: BrokerStatusSchema$1,
|
|
19518
|
+
latencyMs: number().nullable(),
|
|
18786
19519
|
error: string().optional(),
|
|
18787
|
-
|
|
19520
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
19521
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
19522
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
19523
|
+
lastCheckedAt: number().optional()
|
|
18788
19524
|
});
|
|
18789
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
18790
|
-
var TestResultSchema = SendResultSchema;
|
|
18791
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
18792
|
-
kind: string(),
|
|
18793
|
-
config: record(string(), unknown()).optional()
|
|
18794
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
18795
|
-
targetId: string(),
|
|
18796
|
-
notification: NotificationSchema
|
|
18797
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
18798
|
-
targetId: string(),
|
|
18799
|
-
sample: NotificationSchema.optional()
|
|
18800
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
18801
|
-
targetId: string(),
|
|
18802
|
-
enabled: boolean()
|
|
18803
|
-
}), _void(), { kind: "mutation" });
|
|
18804
19525
|
/**
|
|
18805
|
-
*
|
|
18806
|
-
*
|
|
18807
|
-
*
|
|
18808
|
-
*
|
|
18809
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
18810
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
18811
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
19526
|
+
* Connection details — what a consumer needs to call
|
|
19527
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
19528
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
19529
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
18812
19530
|
*/
|
|
18813
|
-
var
|
|
18814
|
-
|
|
18815
|
-
|
|
19531
|
+
var BrokerConnectionDetailsSchema = object({
|
|
19532
|
+
url: string(),
|
|
19533
|
+
username: string().optional(),
|
|
19534
|
+
password: string().optional(),
|
|
19535
|
+
/**
|
|
19536
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
19537
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
19538
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
19539
|
+
* broker).
|
|
19540
|
+
*/
|
|
19541
|
+
clientIdPrefix: string().optional()
|
|
18816
19542
|
});
|
|
18817
|
-
var
|
|
18818
|
-
|
|
18819
|
-
"
|
|
18820
|
-
|
|
18821
|
-
|
|
18822
|
-
|
|
18823
|
-
|
|
18824
|
-
|
|
18825
|
-
|
|
18826
|
-
|
|
18827
|
-
]);
|
|
18828
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
19543
|
+
var AddBrokerInputSchema = object({
|
|
19544
|
+
name: string().min(1),
|
|
19545
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
19546
|
+
username: string().optional(),
|
|
19547
|
+
password: string().optional(),
|
|
19548
|
+
clientIdPrefix: string().optional()
|
|
19549
|
+
});
|
|
19550
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
19551
|
+
var IdInputSchema = object({ id: string() });
|
|
19552
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
18829
19553
|
ok: literal(true),
|
|
18830
|
-
text: string(),
|
|
18831
|
-
model: string(),
|
|
18832
|
-
usage: LlmUsageSchema,
|
|
18833
|
-
truncated: boolean(),
|
|
18834
19554
|
latencyMs: number()
|
|
18835
19555
|
}), object({
|
|
18836
19556
|
ok: literal(false),
|
|
18837
|
-
|
|
18838
|
-
message: string(),
|
|
18839
|
-
retryAfterMs: number().optional()
|
|
19557
|
+
error: string()
|
|
18840
19558
|
})]);
|
|
18841
|
-
|
|
18842
|
-
|
|
18843
|
-
|
|
18844
|
-
|
|
18845
|
-
*/
|
|
18846
|
-
|
|
18847
|
-
|
|
18848
|
-
mimeType: string()
|
|
19559
|
+
var StartEmbeddedInputSchema = object({
|
|
19560
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
19561
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
19562
|
+
allowAnonymous: boolean().default(false),
|
|
19563
|
+
/** Optional shared username/password for clients. */
|
|
19564
|
+
username: string().optional(),
|
|
19565
|
+
password: string().optional()
|
|
18849
19566
|
});
|
|
18850
|
-
var
|
|
18851
|
-
|
|
18852
|
-
|
|
18853
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
18854
|
-
profileId: string().optional(),
|
|
18855
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
18856
|
-
consumer: string(),
|
|
18857
|
-
system: string().optional(),
|
|
18858
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
18859
|
-
prompt: string(),
|
|
18860
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
18861
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
18862
|
-
/** Per-call override of the profile default. */
|
|
18863
|
-
maxTokens: number().int().positive().optional(),
|
|
18864
|
-
temperature: number().optional()
|
|
19567
|
+
var StartEmbeddedResultSchema = object({
|
|
19568
|
+
id: string(),
|
|
19569
|
+
url: string()
|
|
18865
19570
|
});
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
18870
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
18871
|
-
* this only through the `llm` cap's methods.
|
|
18872
|
-
*
|
|
18873
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
18874
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
18875
|
-
* watchdog — operator decision #3).
|
|
18876
|
-
*/
|
|
18877
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
18878
|
-
object({
|
|
18879
|
-
kind: literal("catalog"),
|
|
18880
|
-
catalogId: string()
|
|
18881
|
-
}),
|
|
18882
|
-
object({
|
|
18883
|
-
kind: literal("url"),
|
|
18884
|
-
url: string(),
|
|
18885
|
-
sha256: string().optional()
|
|
18886
|
-
}),
|
|
18887
|
-
object({
|
|
18888
|
-
kind: literal("path"),
|
|
18889
|
-
path: string()
|
|
18890
|
-
})
|
|
18891
|
-
]);
|
|
18892
|
-
var ManagedRuntimeConfigSchema = object({
|
|
18893
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
18894
|
-
nodeId: string(),
|
|
18895
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
18896
|
-
engine: _enum(["llama-cpp"]),
|
|
18897
|
-
model: ManagedModelRefSchema,
|
|
18898
|
-
contextSize: number().int().default(4096),
|
|
18899
|
-
/** 0 = CPU-only. */
|
|
18900
|
-
gpuLayers: number().int().default(0),
|
|
18901
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
18902
|
-
threads: number().int().optional(),
|
|
18903
|
-
/** Concurrent slots. */
|
|
18904
|
-
parallel: number().int().default(1),
|
|
18905
|
-
/** Else lazy: first generate boots it. */
|
|
18906
|
-
autoStart: boolean().default(false),
|
|
18907
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
18908
|
-
idleStopMinutes: number().int().default(30)
|
|
19571
|
+
var StatusSchema = object({
|
|
19572
|
+
brokerCount: number(),
|
|
19573
|
+
embeddedRunning: boolean()
|
|
18909
19574
|
});
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
"starting",
|
|
18917
|
-
"ready",
|
|
18918
|
-
"crashed",
|
|
18919
|
-
"failed"
|
|
18920
|
-
]),
|
|
18921
|
-
pid: number().optional(),
|
|
18922
|
-
port: number().optional(),
|
|
18923
|
-
modelPath: string().optional(),
|
|
18924
|
-
modelId: string().optional(),
|
|
18925
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
18926
|
-
lastError: string().optional(),
|
|
18927
|
-
crashesInWindow: number(),
|
|
18928
|
-
/** Child RSS (sampled best-effort). */
|
|
18929
|
-
memoryBytes: number().optional(),
|
|
18930
|
-
vramBytes: number().optional()
|
|
19575
|
+
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);
|
|
19576
|
+
var NetworkEndpointSchema = object({
|
|
19577
|
+
url: string(),
|
|
19578
|
+
hostname: string(),
|
|
19579
|
+
port: number(),
|
|
19580
|
+
protocol: _enum(["http", "https"])
|
|
18931
19581
|
});
|
|
18932
|
-
var
|
|
18933
|
-
|
|
18934
|
-
|
|
18935
|
-
|
|
18936
|
-
installedAt: number().optional()
|
|
19582
|
+
var NetworkAccessStatusSchema = object({
|
|
19583
|
+
connected: boolean(),
|
|
19584
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
19585
|
+
error: string().optional()
|
|
18937
19586
|
});
|
|
18938
|
-
|
|
18939
|
-
|
|
18940
|
-
|
|
18941
|
-
|
|
19587
|
+
/**
|
|
19588
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
19589
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
19590
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
19591
|
+
* the originating provider config (mode + sourcePort) so the
|
|
19592
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
19593
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
19594
|
+
*/
|
|
19595
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
19596
|
+
/**
|
|
19597
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
19598
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
19599
|
+
*/
|
|
19600
|
+
id: string(),
|
|
19601
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
19602
|
+
label: string(),
|
|
19603
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
19604
|
+
mode: string().optional(),
|
|
19605
|
+
/** Originating local port the ingress fronts (informational). */
|
|
19606
|
+
sourcePort: number().optional()
|
|
18942
19607
|
});
|
|
18943
|
-
method(
|
|
18944
|
-
images: array(LlmImageSchema).optional(),
|
|
18945
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
18946
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
18947
|
-
timeoutMs: number().int().positive().optional()
|
|
18948
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
18949
|
-
kind: "mutation",
|
|
18950
|
-
auth: "admin"
|
|
18951
|
-
}), method(object({}), _void(), {
|
|
18952
|
-
kind: "mutation",
|
|
18953
|
-
auth: "admin"
|
|
18954
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
18955
|
-
kind: "mutation",
|
|
18956
|
-
auth: "admin"
|
|
18957
|
-
}), method(object({ file: string() }), _void(), {
|
|
18958
|
-
kind: "mutation",
|
|
18959
|
-
auth: "admin"
|
|
18960
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
19608
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
18961
19609
|
/**
|
|
18962
|
-
*
|
|
18963
|
-
*
|
|
18964
|
-
*
|
|
18965
|
-
*
|
|
18966
|
-
*
|
|
19610
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
19611
|
+
*
|
|
19612
|
+
* Apprise-derived model (see
|
|
19613
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
19614
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
19615
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
19616
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
19617
|
+
* message to what the kind supports — callers never special-case a service.
|
|
19618
|
+
*
|
|
19619
|
+
* DESIGN DECISIONS (locked):
|
|
19620
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
19621
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
19622
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
19623
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
19624
|
+
* alternative would fork the UI per addon and cannot host the
|
|
19625
|
+
* discovery→adopt flow.
|
|
19626
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
19627
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
19628
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
19629
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
19630
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
19631
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
19632
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
19633
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
19634
|
+
* base64 fallback needed.
|
|
18967
19635
|
*
|
|
18968
|
-
*
|
|
18969
|
-
* `
|
|
18970
|
-
*
|
|
19636
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
19637
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
19638
|
+
* admin "Integrations" page.
|
|
18971
19639
|
*/
|
|
18972
|
-
|
|
18973
|
-
|
|
18974
|
-
|
|
18975
|
-
|
|
18976
|
-
|
|
18977
|
-
"
|
|
19640
|
+
/**
|
|
19641
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
19642
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
19643
|
+
*/
|
|
19644
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
19645
|
+
"image",
|
|
19646
|
+
"video",
|
|
19647
|
+
"gif",
|
|
19648
|
+
"audio",
|
|
19649
|
+
"icon"
|
|
18978
19650
|
]);
|
|
18979
|
-
|
|
19651
|
+
/**
|
|
19652
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
19653
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
19654
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
19655
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
19656
|
+
*/
|
|
19657
|
+
var AttachmentSchema = object({
|
|
19658
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
19659
|
+
url: string().optional(),
|
|
19660
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
19661
|
+
mime: string().optional(),
|
|
19662
|
+
name: string().optional()
|
|
19663
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
19664
|
+
var NotificationFormatSchema = _enum([
|
|
19665
|
+
"text",
|
|
19666
|
+
"markdown",
|
|
19667
|
+
"html"
|
|
19668
|
+
]);
|
|
19669
|
+
/** A single tap-through action button. */
|
|
19670
|
+
var NotificationActionSchema = object({
|
|
18980
19671
|
id: string(),
|
|
18981
|
-
|
|
18982
|
-
|
|
18983
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
18984
|
-
addonId: string(),
|
|
18985
|
-
enabled: boolean(),
|
|
18986
|
-
/** Vendor model id, or the managed runtime's loaded model. */
|
|
18987
|
-
model: string(),
|
|
18988
|
-
/** Required for openai-compatible; override for cloud kinds. */
|
|
18989
|
-
baseUrl: string().optional(),
|
|
18990
|
-
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
18991
|
-
apiKey: string().optional(),
|
|
18992
|
-
supportsVision: boolean(),
|
|
18993
|
-
temperature: number().min(0).max(2).optional(),
|
|
18994
|
-
maxTokens: number().int().positive().optional(),
|
|
18995
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
18996
|
-
extraHeaders: record(string(), string()).optional(),
|
|
18997
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
18998
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
19672
|
+
label: string(),
|
|
19673
|
+
url: string().optional()
|
|
18999
19674
|
});
|
|
19000
|
-
/**
|
|
19001
|
-
*
|
|
19002
|
-
*
|
|
19675
|
+
/**
|
|
19676
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
19677
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
19678
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
19679
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
19680
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
19681
|
+
* `priority` for that one target.
|
|
19682
|
+
*/
|
|
19683
|
+
var NotificationSchema = object({
|
|
19684
|
+
body: string(),
|
|
19685
|
+
title: string().optional(),
|
|
19686
|
+
format: NotificationFormatSchema.default("text"),
|
|
19687
|
+
priority: number().int().min(1).max(5).default(3),
|
|
19688
|
+
level: string().optional(),
|
|
19689
|
+
attachments: array(AttachmentSchema).optional(),
|
|
19690
|
+
clickUrl: string().optional(),
|
|
19691
|
+
actions: array(NotificationActionSchema).optional(),
|
|
19692
|
+
sound: string().optional(),
|
|
19693
|
+
ttl: number().optional(),
|
|
19694
|
+
tag: string().optional(),
|
|
19695
|
+
deviceId: number().optional(),
|
|
19696
|
+
eventId: string().optional(),
|
|
19697
|
+
metadata: record(string(), unknown()).optional()
|
|
19698
|
+
});
|
|
19699
|
+
/** One declared native severity/priority level for a kind. */
|
|
19700
|
+
var TargetKindLevelSchema = object({
|
|
19701
|
+
id: string(),
|
|
19702
|
+
label: string(),
|
|
19703
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
19704
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
19705
|
+
flags: object({
|
|
19706
|
+
critical: boolean().optional(),
|
|
19707
|
+
silent: boolean().optional(),
|
|
19708
|
+
noPush: boolean().optional()
|
|
19709
|
+
}).optional(),
|
|
19710
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
19711
|
+
requires: array(string()).optional(),
|
|
19712
|
+
description: string().optional()
|
|
19713
|
+
});
|
|
19714
|
+
/** The full capability block consulted before dispatch. */
|
|
19715
|
+
var TargetKindCapsSchema = object({
|
|
19716
|
+
attachments: object({
|
|
19717
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
19718
|
+
mode: _enum([
|
|
19719
|
+
"url",
|
|
19720
|
+
"bytes",
|
|
19721
|
+
"both"
|
|
19722
|
+
]),
|
|
19723
|
+
max: number().int().nonnegative(),
|
|
19724
|
+
maxBytes: number().int().positive().optional()
|
|
19725
|
+
}),
|
|
19726
|
+
/** Max action buttons (0 = none). */
|
|
19727
|
+
actions: number().int().nonnegative(),
|
|
19728
|
+
levels: array(TargetKindLevelSchema),
|
|
19729
|
+
format: array(NotificationFormatSchema),
|
|
19730
|
+
clickUrl: boolean(),
|
|
19731
|
+
sound: boolean(),
|
|
19732
|
+
ttl: boolean(),
|
|
19733
|
+
bodyMaxLen: number().int().positive()
|
|
19734
|
+
});
|
|
19735
|
+
/**
|
|
19736
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
19737
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
19738
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
19739
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
19740
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
19741
|
+
*/
|
|
19003
19742
|
var ConfigSchemaPassthrough = unknown();
|
|
19004
|
-
var
|
|
19005
|
-
kind:
|
|
19743
|
+
var TargetKindSchema = object({
|
|
19744
|
+
kind: string(),
|
|
19006
19745
|
label: string(),
|
|
19007
19746
|
icon: string(),
|
|
19008
19747
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
19009
19748
|
addonId: string(),
|
|
19010
|
-
configSchema: ConfigSchemaPassthrough
|
|
19011
|
-
|
|
19012
|
-
|
|
19013
|
-
var LlmDefaultSchema = object({
|
|
19014
|
-
selector: LlmDefaultSelectorSchema,
|
|
19015
|
-
profileId: string()
|
|
19016
|
-
});
|
|
19017
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
19018
|
-
var LlmUsageRollupSchema = object({
|
|
19019
|
-
day: string(),
|
|
19020
|
-
consumer: string(),
|
|
19021
|
-
profileId: string(),
|
|
19022
|
-
calls: number(),
|
|
19023
|
-
okCalls: number(),
|
|
19024
|
-
errorCalls: number(),
|
|
19025
|
-
inputTokens: number(),
|
|
19026
|
-
outputTokens: number(),
|
|
19027
|
-
avgLatencyMs: number()
|
|
19749
|
+
configSchema: ConfigSchemaPassthrough,
|
|
19750
|
+
supportsDiscovery: boolean(),
|
|
19751
|
+
caps: TargetKindCapsSchema
|
|
19028
19752
|
});
|
|
19029
|
-
/**
|
|
19030
|
-
|
|
19753
|
+
/**
|
|
19754
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
19755
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
19756
|
+
* round-trip a stored secret to the UI.
|
|
19757
|
+
*/
|
|
19758
|
+
var TargetSchema = object({
|
|
19031
19759
|
id: string(),
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
purpose: _enum(["text", "vision"]),
|
|
19035
|
-
url: string(),
|
|
19036
|
-
sha256: string(),
|
|
19037
|
-
sizeBytes: number(),
|
|
19038
|
-
quantization: string(),
|
|
19039
|
-
/** Load-time guidance shown in the picker. */
|
|
19040
|
-
minRamBytes: number(),
|
|
19041
|
-
contextSizeDefault: number().int(),
|
|
19042
|
-
/** Vision models: companion projector file. */
|
|
19043
|
-
mmprojUrl: string().optional()
|
|
19044
|
-
});
|
|
19045
|
-
var LlmRuntimeNodeSchema = object({
|
|
19046
|
-
nodeId: string(),
|
|
19047
|
-
reachable: boolean(),
|
|
19048
|
-
status: LlmRuntimeStatusSchema.optional(),
|
|
19049
|
-
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
19050
|
-
error: string().optional()
|
|
19051
|
-
});
|
|
19052
|
-
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
19053
|
-
var ProfileRefInputSchema = object({
|
|
19760
|
+
name: string(),
|
|
19761
|
+
kind: string(),
|
|
19054
19762
|
addonId: string(),
|
|
19055
|
-
|
|
19763
|
+
enabled: boolean(),
|
|
19764
|
+
config: record(string(), unknown())
|
|
19056
19765
|
});
|
|
19057
|
-
|
|
19058
|
-
|
|
19059
|
-
|
|
19060
|
-
|
|
19061
|
-
|
|
19062
|
-
|
|
19063
|
-
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
|
|
19075
|
-
|
|
19076
|
-
profileId: string().optional()
|
|
19077
|
-
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
19078
|
-
nodeId: string(),
|
|
19079
|
-
model: ManagedModelRefSchema
|
|
19080
|
-
}), _void(), {
|
|
19081
|
-
kind: "mutation",
|
|
19082
|
-
auth: "admin"
|
|
19083
|
-
}), method(object({
|
|
19084
|
-
nodeId: string(),
|
|
19085
|
-
file: string()
|
|
19086
|
-
}), _void(), {
|
|
19087
|
-
kind: "mutation",
|
|
19088
|
-
auth: "admin"
|
|
19089
|
-
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
19090
|
-
kind: "mutation",
|
|
19091
|
-
auth: "admin"
|
|
19092
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
19093
|
-
kind: "mutation",
|
|
19094
|
-
auth: "admin"
|
|
19766
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
19767
|
+
var DiscoveredTargetSchema = object({
|
|
19768
|
+
kind: string(),
|
|
19769
|
+
suggestedName: string(),
|
|
19770
|
+
config: record(string(), unknown())
|
|
19771
|
+
});
|
|
19772
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
19773
|
+
var RenderedAsSchema = object({
|
|
19774
|
+
level: string(),
|
|
19775
|
+
format: NotificationFormatSchema,
|
|
19776
|
+
attachmentsSent: number().int().nonnegative(),
|
|
19777
|
+
actionsSent: number().int().nonnegative(),
|
|
19778
|
+
truncated: boolean(),
|
|
19779
|
+
dropped: array(string())
|
|
19780
|
+
});
|
|
19781
|
+
var SendResultSchema = object({
|
|
19782
|
+
success: boolean(),
|
|
19783
|
+
error: string().optional(),
|
|
19784
|
+
renderedAs: RenderedAsSchema.optional()
|
|
19095
19785
|
});
|
|
19786
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
19787
|
+
var TestResultSchema = SendResultSchema;
|
|
19788
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
19789
|
+
kind: string(),
|
|
19790
|
+
config: record(string(), unknown()).optional()
|
|
19791
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
19792
|
+
targetId: string(),
|
|
19793
|
+
notification: NotificationSchema
|
|
19794
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
19795
|
+
targetId: string(),
|
|
19796
|
+
sample: NotificationSchema.optional()
|
|
19797
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
19798
|
+
targetId: string(),
|
|
19799
|
+
enabled: boolean()
|
|
19800
|
+
}), _void(), { kind: "mutation" });
|
|
19096
19801
|
/**
|
|
19097
19802
|
* Zod schemas for persisted record types.
|
|
19098
19803
|
*
|
|
@@ -19778,7 +20483,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
19778
20483
|
}), method(object({
|
|
19779
20484
|
eventId: string(),
|
|
19780
20485
|
kind: MediaFileKindEnum.optional()
|
|
19781
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
20486
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
20487
|
+
trackId: string(),
|
|
20488
|
+
kinds: array(MediaFileKindEnum).optional()
|
|
20489
|
+
}), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
|
|
19782
20490
|
deviceId: number(),
|
|
19783
20491
|
timestamp: number(),
|
|
19784
20492
|
frameWidth: number(),
|
|
@@ -19799,76 +20507,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
19799
20507
|
eventId: string(),
|
|
19800
20508
|
timestamp: number()
|
|
19801
20509
|
});
|
|
19802
|
-
/**
|
|
19803
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
19804
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
19805
|
-
* caps into per-camera event-kind descriptors.
|
|
19806
|
-
*
|
|
19807
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
19808
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
19809
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
19810
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
19811
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
19812
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
19813
|
-
* eventful cap is missing.
|
|
19814
|
-
*/
|
|
19815
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
19816
|
-
var LEGACY_ICON = {
|
|
19817
|
-
motion: "motion",
|
|
19818
|
-
audio: "audio",
|
|
19819
|
-
person: "person",
|
|
19820
|
-
vehicle: "vehicle",
|
|
19821
|
-
animal: "animal",
|
|
19822
|
-
package: "package",
|
|
19823
|
-
door: "door",
|
|
19824
|
-
pir: "pir",
|
|
19825
|
-
smoke: "smoke",
|
|
19826
|
-
water: "water",
|
|
19827
|
-
button: "button",
|
|
19828
|
-
generic: "generic",
|
|
19829
|
-
gas: "smoke",
|
|
19830
|
-
vibration: "generic",
|
|
19831
|
-
tamper: "generic",
|
|
19832
|
-
presence: "person",
|
|
19833
|
-
lock: "generic",
|
|
19834
|
-
siren: "generic",
|
|
19835
|
-
switch: "generic",
|
|
19836
|
-
doorbell: "button"
|
|
19837
|
-
};
|
|
19838
|
-
function legacyIcon(iconId) {
|
|
19839
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
19840
|
-
}
|
|
19841
|
-
/**
|
|
19842
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
19843
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
19844
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
19845
|
-
*/
|
|
19846
|
-
var CAP_TO_KIND = {
|
|
19847
|
-
contact: "contact",
|
|
19848
|
-
motion: "motion-sensor",
|
|
19849
|
-
smoke: "smoke",
|
|
19850
|
-
flood: "flood",
|
|
19851
|
-
gas: "gas",
|
|
19852
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
19853
|
-
vibration: "vibration",
|
|
19854
|
-
tamper: "tamper",
|
|
19855
|
-
presence: "presence",
|
|
19856
|
-
"enum-sensor": "enum-sensor",
|
|
19857
|
-
"event-emitter": "device-event",
|
|
19858
|
-
"lock-control": "lock",
|
|
19859
|
-
switch: "switch",
|
|
19860
|
-
button: "button",
|
|
19861
|
-
doorbell: "doorbell"
|
|
19862
|
-
};
|
|
19863
|
-
function buildDescriptor(capName, kind) {
|
|
19864
|
-
const t = EVENT_TAXONOMY[kind];
|
|
19865
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
19866
|
-
return {
|
|
19867
|
-
...t,
|
|
19868
|
-
icon: legacyIcon(t.iconId)
|
|
19869
|
-
};
|
|
19870
|
-
}
|
|
19871
|
-
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
19872
20510
|
var CameraPipelineConfigSchema = object({
|
|
19873
20511
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
19874
20512
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -20354,6 +20992,76 @@ method(object({
|
|
|
20354
20992
|
auth: "admin"
|
|
20355
20993
|
});
|
|
20356
20994
|
/**
|
|
20995
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
20996
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
20997
|
+
* caps into per-camera event-kind descriptors.
|
|
20998
|
+
*
|
|
20999
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
21000
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
21001
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
21002
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
21003
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
21004
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
21005
|
+
* eventful cap is missing.
|
|
21006
|
+
*/
|
|
21007
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
21008
|
+
var LEGACY_ICON = {
|
|
21009
|
+
motion: "motion",
|
|
21010
|
+
audio: "audio",
|
|
21011
|
+
person: "person",
|
|
21012
|
+
vehicle: "vehicle",
|
|
21013
|
+
animal: "animal",
|
|
21014
|
+
package: "package",
|
|
21015
|
+
door: "door",
|
|
21016
|
+
pir: "pir",
|
|
21017
|
+
smoke: "smoke",
|
|
21018
|
+
water: "water",
|
|
21019
|
+
button: "button",
|
|
21020
|
+
generic: "generic",
|
|
21021
|
+
gas: "smoke",
|
|
21022
|
+
vibration: "generic",
|
|
21023
|
+
tamper: "generic",
|
|
21024
|
+
presence: "person",
|
|
21025
|
+
lock: "generic",
|
|
21026
|
+
siren: "generic",
|
|
21027
|
+
switch: "generic",
|
|
21028
|
+
doorbell: "button"
|
|
21029
|
+
};
|
|
21030
|
+
function legacyIcon(iconId) {
|
|
21031
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
21032
|
+
}
|
|
21033
|
+
/**
|
|
21034
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
21035
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
21036
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
21037
|
+
*/
|
|
21038
|
+
var CAP_TO_KIND = {
|
|
21039
|
+
contact: "contact",
|
|
21040
|
+
motion: "motion-sensor",
|
|
21041
|
+
smoke: "smoke",
|
|
21042
|
+
flood: "flood",
|
|
21043
|
+
gas: "gas",
|
|
21044
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
21045
|
+
vibration: "vibration",
|
|
21046
|
+
tamper: "tamper",
|
|
21047
|
+
presence: "presence",
|
|
21048
|
+
"enum-sensor": "enum-sensor",
|
|
21049
|
+
"event-emitter": "device-event",
|
|
21050
|
+
"lock-control": "lock",
|
|
21051
|
+
switch: "switch",
|
|
21052
|
+
button: "button",
|
|
21053
|
+
doorbell: "doorbell"
|
|
21054
|
+
};
|
|
21055
|
+
function buildDescriptor(capName, kind) {
|
|
21056
|
+
const t = EVENT_TAXONOMY[kind];
|
|
21057
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
21058
|
+
return {
|
|
21059
|
+
...t,
|
|
21060
|
+
icon: legacyIcon(t.iconId)
|
|
21061
|
+
};
|
|
21062
|
+
}
|
|
21063
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
21064
|
+
/**
|
|
20357
21065
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
20358
21066
|
* package lifecycle (runtime-updatable node packages).
|
|
20359
21067
|
*
|
|
@@ -21825,7 +22533,28 @@ var FaceInfoSchema = object({
|
|
|
21825
22533
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
21826
22534
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
21827
22535
|
* back to the inline `base64` face crop. */
|
|
21828
|
-
keyFrameMediaKey: string().optional()
|
|
22536
|
+
keyFrameMediaKey: string().optional(),
|
|
22537
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
22538
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
22539
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
22540
|
+
* faces that were never auto-recognized. */
|
|
22541
|
+
bestMatchScore: number().optional(),
|
|
22542
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
22543
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
22544
|
+
* legacy rows / runners that reported no native measure. */
|
|
22545
|
+
nativeFaceShortSidePx: number().optional(),
|
|
22546
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
22547
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
22548
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
22549
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
22550
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
22551
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
22552
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
22553
|
+
suggestedIdentityId: string().optional(),
|
|
22554
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
22555
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
22556
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
22557
|
+
suggestedMatchScore: number().optional()
|
|
21829
22558
|
});
|
|
21830
22559
|
var FaceFilterEnum = _enum([
|
|
21831
22560
|
"unassigned",
|
|
@@ -23868,36 +24597,6 @@ Object.freeze({
|
|
|
23868
24597
|
addonId: null,
|
|
23869
24598
|
access: "view"
|
|
23870
24599
|
},
|
|
23871
|
-
"advancedNotifier.deleteRule": {
|
|
23872
|
-
capName: "advanced-notifier",
|
|
23873
|
-
capScope: "system",
|
|
23874
|
-
addonId: null,
|
|
23875
|
-
access: "delete"
|
|
23876
|
-
},
|
|
23877
|
-
"advancedNotifier.getHistory": {
|
|
23878
|
-
capName: "advanced-notifier",
|
|
23879
|
-
capScope: "system",
|
|
23880
|
-
addonId: null,
|
|
23881
|
-
access: "view"
|
|
23882
|
-
},
|
|
23883
|
-
"advancedNotifier.getRules": {
|
|
23884
|
-
capName: "advanced-notifier",
|
|
23885
|
-
capScope: "system",
|
|
23886
|
-
addonId: null,
|
|
23887
|
-
access: "view"
|
|
23888
|
-
},
|
|
23889
|
-
"advancedNotifier.testRule": {
|
|
23890
|
-
capName: "advanced-notifier",
|
|
23891
|
-
capScope: "system",
|
|
23892
|
-
addonId: null,
|
|
23893
|
-
access: "create"
|
|
23894
|
-
},
|
|
23895
|
-
"advancedNotifier.upsertRule": {
|
|
23896
|
-
capName: "advanced-notifier",
|
|
23897
|
-
capScope: "system",
|
|
23898
|
-
addonId: null,
|
|
23899
|
-
access: "create"
|
|
23900
|
-
},
|
|
23901
24600
|
"alarmPanel.arm": {
|
|
23902
24601
|
capName: "alarm-panel",
|
|
23903
24602
|
capScope: "device",
|
|
@@ -24120,6 +24819,12 @@ Object.freeze({
|
|
|
24120
24819
|
addonId: null,
|
|
24121
24820
|
access: "delete"
|
|
24122
24821
|
},
|
|
24822
|
+
"backup.deleteSchedule": {
|
|
24823
|
+
capName: "backup",
|
|
24824
|
+
capScope: "system",
|
|
24825
|
+
addonId: null,
|
|
24826
|
+
access: "delete"
|
|
24827
|
+
},
|
|
24123
24828
|
"backup.getEntries": {
|
|
24124
24829
|
capName: "backup",
|
|
24125
24830
|
capScope: "system",
|
|
@@ -24150,6 +24855,12 @@ Object.freeze({
|
|
|
24150
24855
|
addonId: null,
|
|
24151
24856
|
access: "view"
|
|
24152
24857
|
},
|
|
24858
|
+
"backup.listSchedules": {
|
|
24859
|
+
capName: "backup",
|
|
24860
|
+
capScope: "system",
|
|
24861
|
+
addonId: null,
|
|
24862
|
+
access: "view"
|
|
24863
|
+
},
|
|
24153
24864
|
"backup.previewSchedule": {
|
|
24154
24865
|
capName: "backup",
|
|
24155
24866
|
capScope: "system",
|
|
@@ -24174,6 +24885,12 @@ Object.freeze({
|
|
|
24174
24885
|
addonId: null,
|
|
24175
24886
|
access: "create"
|
|
24176
24887
|
},
|
|
24888
|
+
"backup.upsertSchedule": {
|
|
24889
|
+
capName: "backup",
|
|
24890
|
+
capScope: "system",
|
|
24891
|
+
addonId: null,
|
|
24892
|
+
access: "create"
|
|
24893
|
+
},
|
|
24177
24894
|
"battery.wakeForStream": {
|
|
24178
24895
|
capName: "battery",
|
|
24179
24896
|
capScope: "device",
|
|
@@ -26202,6 +26919,60 @@ Object.freeze({
|
|
|
26202
26919
|
addonId: null,
|
|
26203
26920
|
access: "create"
|
|
26204
26921
|
},
|
|
26922
|
+
"notificationRules.createRule": {
|
|
26923
|
+
capName: "notification-rules",
|
|
26924
|
+
capScope: "system",
|
|
26925
|
+
addonId: null,
|
|
26926
|
+
access: "create"
|
|
26927
|
+
},
|
|
26928
|
+
"notificationRules.deleteRule": {
|
|
26929
|
+
capName: "notification-rules",
|
|
26930
|
+
capScope: "system",
|
|
26931
|
+
addonId: null,
|
|
26932
|
+
access: "delete"
|
|
26933
|
+
},
|
|
26934
|
+
"notificationRules.getConditionCatalog": {
|
|
26935
|
+
capName: "notification-rules",
|
|
26936
|
+
capScope: "system",
|
|
26937
|
+
addonId: null,
|
|
26938
|
+
access: "view"
|
|
26939
|
+
},
|
|
26940
|
+
"notificationRules.getHistory": {
|
|
26941
|
+
capName: "notification-rules",
|
|
26942
|
+
capScope: "system",
|
|
26943
|
+
addonId: null,
|
|
26944
|
+
access: "view"
|
|
26945
|
+
},
|
|
26946
|
+
"notificationRules.getRule": {
|
|
26947
|
+
capName: "notification-rules",
|
|
26948
|
+
capScope: "system",
|
|
26949
|
+
addonId: null,
|
|
26950
|
+
access: "view"
|
|
26951
|
+
},
|
|
26952
|
+
"notificationRules.listRules": {
|
|
26953
|
+
capName: "notification-rules",
|
|
26954
|
+
capScope: "system",
|
|
26955
|
+
addonId: null,
|
|
26956
|
+
access: "view"
|
|
26957
|
+
},
|
|
26958
|
+
"notificationRules.setRuleEnabled": {
|
|
26959
|
+
capName: "notification-rules",
|
|
26960
|
+
capScope: "system",
|
|
26961
|
+
addonId: null,
|
|
26962
|
+
access: "create"
|
|
26963
|
+
},
|
|
26964
|
+
"notificationRules.testRule": {
|
|
26965
|
+
capName: "notification-rules",
|
|
26966
|
+
capScope: "system",
|
|
26967
|
+
addonId: null,
|
|
26968
|
+
access: "create"
|
|
26969
|
+
},
|
|
26970
|
+
"notificationRules.updateRule": {
|
|
26971
|
+
capName: "notification-rules",
|
|
26972
|
+
capScope: "system",
|
|
26973
|
+
addonId: null,
|
|
26974
|
+
access: "create"
|
|
26975
|
+
},
|
|
26205
26976
|
"notifier.cancel": {
|
|
26206
26977
|
capName: "notifier",
|
|
26207
26978
|
capScope: "device",
|
|
@@ -27954,6 +28725,36 @@ Object.freeze({
|
|
|
27954
28725
|
addonId: null,
|
|
27955
28726
|
access: "create"
|
|
27956
28727
|
},
|
|
28728
|
+
"terminalSession.close": {
|
|
28729
|
+
capName: "terminal-session",
|
|
28730
|
+
capScope: "system",
|
|
28731
|
+
addonId: null,
|
|
28732
|
+
access: "create"
|
|
28733
|
+
},
|
|
28734
|
+
"terminalSession.listProfiles": {
|
|
28735
|
+
capName: "terminal-session",
|
|
28736
|
+
capScope: "system",
|
|
28737
|
+
addonId: null,
|
|
28738
|
+
access: "view"
|
|
28739
|
+
},
|
|
28740
|
+
"terminalSession.listSessions": {
|
|
28741
|
+
capName: "terminal-session",
|
|
28742
|
+
capScope: "system",
|
|
28743
|
+
addonId: null,
|
|
28744
|
+
access: "view"
|
|
28745
|
+
},
|
|
28746
|
+
"terminalSession.openSession": {
|
|
28747
|
+
capName: "terminal-session",
|
|
28748
|
+
capScope: "system",
|
|
28749
|
+
addonId: null,
|
|
28750
|
+
access: "create"
|
|
28751
|
+
},
|
|
28752
|
+
"terminalSession.resize": {
|
|
28753
|
+
capName: "terminal-session",
|
|
28754
|
+
capScope: "system",
|
|
28755
|
+
addonId: null,
|
|
28756
|
+
access: "create"
|
|
28757
|
+
},
|
|
27957
28758
|
"toast.onToast": {
|
|
27958
28759
|
capName: "toast",
|
|
27959
28760
|
capScope: "system",
|