@camstack/addon-import-alexa 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
|
@@ -38,7 +38,7 @@ let node_crypto = require("node:crypto");
|
|
|
38
38
|
let node_fs = require("node:fs");
|
|
39
39
|
let node_path = require("node:path");
|
|
40
40
|
node_path = __toESM(node_path);
|
|
41
|
-
//#region ../types/dist/event-category-
|
|
41
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
42
42
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
43
43
|
EventCategory["SystemBoot"] = "system.boot";
|
|
44
44
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -188,9 +188,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
188
188
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
189
189
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
190
190
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
191
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
192
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
193
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
194
191
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
195
192
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
196
193
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -6869,7 +6866,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
|
6869
6866
|
patch: record(string(), unknown())
|
|
6870
6867
|
}), object({ success: literal(true) });
|
|
6871
6868
|
object({ deviceId: number() }), unknown().nullable();
|
|
6872
|
-
/** Shorthand to define a method schema */
|
|
6873
6869
|
function method(input, output, options) {
|
|
6874
6870
|
return {
|
|
6875
6871
|
input,
|
|
@@ -6877,6 +6873,7 @@ function method(input, output, options) {
|
|
|
6877
6873
|
kind: options?.kind ?? "query",
|
|
6878
6874
|
auth: options?.auth ?? "protected",
|
|
6879
6875
|
...options?.access !== void 0 ? { access: options.access } : {},
|
|
6876
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
6880
6877
|
timeoutMs: options?.timeoutMs
|
|
6881
6878
|
};
|
|
6882
6879
|
}
|
|
@@ -7691,16 +7688,23 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7691
7688
|
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7692
7689
|
* FRESH install:
|
|
7693
7690
|
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7694
|
-
* the appData volume. Right for small/durable data (
|
|
7691
|
+
* the appData volume. Right for small/durable data (logs, models).
|
|
7695
7692
|
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7696
7693
|
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7697
7694
|
* (recordings, event media) that should stay off the appData disk.
|
|
7695
|
+
* - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
|
|
7696
|
+
* `/backups` in the image) so archives live on their own mount rather than
|
|
7697
|
+
* filling the appData disk. Falls back to the data root when unset.
|
|
7698
7698
|
*
|
|
7699
7699
|
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7700
7700
|
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7701
7701
|
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7702
7702
|
*/
|
|
7703
|
-
defaultRoot: _enum([
|
|
7703
|
+
defaultRoot: _enum([
|
|
7704
|
+
"data",
|
|
7705
|
+
"media",
|
|
7706
|
+
"backup"
|
|
7707
|
+
]).optional()
|
|
7704
7708
|
});
|
|
7705
7709
|
var DecoderStatsSchema = object({
|
|
7706
7710
|
inputFps: number(),
|
|
@@ -8363,6 +8367,59 @@ for (const l of AUDIO_MACRO_LABELS) {
|
|
|
8363
8367
|
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8364
8368
|
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8365
8369
|
/**
|
|
8370
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8371
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8372
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8373
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8374
|
+
*
|
|
8375
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8376
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8377
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8378
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8379
|
+
* the same class picker, grouped under an Audio header.
|
|
8380
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8381
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8382
|
+
*
|
|
8383
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8384
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8385
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8386
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8387
|
+
*/
|
|
8388
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8389
|
+
var NcTaxonomyEntrySchema = object({
|
|
8390
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8391
|
+
kind: string(),
|
|
8392
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8393
|
+
label: string(),
|
|
8394
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8395
|
+
parentKind: string().nullable()
|
|
8396
|
+
});
|
|
8397
|
+
object({
|
|
8398
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8399
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8400
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8401
|
+
});
|
|
8402
|
+
function toEntry(kind, label, parentKind) {
|
|
8403
|
+
return {
|
|
8404
|
+
kind,
|
|
8405
|
+
label,
|
|
8406
|
+
parentKind
|
|
8407
|
+
};
|
|
8408
|
+
}
|
|
8409
|
+
/**
|
|
8410
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8411
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8412
|
+
*/
|
|
8413
|
+
function buildNcTaxonomy() {
|
|
8414
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8415
|
+
return {
|
|
8416
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8417
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8418
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8419
|
+
};
|
|
8420
|
+
}
|
|
8421
|
+
Object.freeze(buildNcTaxonomy());
|
|
8422
|
+
/**
|
|
8366
8423
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8367
8424
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8368
8425
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -9241,6 +9298,644 @@ function shallowEqual(a, b) {
|
|
|
9241
9298
|
return true;
|
|
9242
9299
|
}
|
|
9243
9300
|
/**
|
|
9301
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
9302
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
9303
|
+
* language so a single drawing-plane editor and the providers stay
|
|
9304
|
+
* decoupled from each cap's storage.
|
|
9305
|
+
*
|
|
9306
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
9307
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
9308
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
9309
|
+
*/
|
|
9310
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
9311
|
+
var MaskPointSchema = object({
|
|
9312
|
+
x: number(),
|
|
9313
|
+
y: number()
|
|
9314
|
+
});
|
|
9315
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
9316
|
+
var MaskRectShapeSchema = object({
|
|
9317
|
+
kind: literal("rect"),
|
|
9318
|
+
x: number(),
|
|
9319
|
+
y: number(),
|
|
9320
|
+
width: number(),
|
|
9321
|
+
height: number()
|
|
9322
|
+
});
|
|
9323
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
9324
|
+
var MaskPolygonShapeSchema = object({
|
|
9325
|
+
kind: literal("polygon"),
|
|
9326
|
+
points: array(MaskPointSchema)
|
|
9327
|
+
});
|
|
9328
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
9329
|
+
var MaskGridShapeSchema = object({
|
|
9330
|
+
kind: literal("grid"),
|
|
9331
|
+
gridWidth: number(),
|
|
9332
|
+
gridHeight: number(),
|
|
9333
|
+
cells: array(boolean())
|
|
9334
|
+
});
|
|
9335
|
+
discriminatedUnion("kind", [
|
|
9336
|
+
MaskRectShapeSchema,
|
|
9337
|
+
MaskPolygonShapeSchema,
|
|
9338
|
+
MaskGridShapeSchema,
|
|
9339
|
+
object({
|
|
9340
|
+
kind: literal("line"),
|
|
9341
|
+
points: array(MaskPointSchema)
|
|
9342
|
+
})
|
|
9343
|
+
]);
|
|
9344
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
9345
|
+
var MaskShapeKindSchema = _enum([
|
|
9346
|
+
"rect",
|
|
9347
|
+
"polygon",
|
|
9348
|
+
"grid",
|
|
9349
|
+
"line"
|
|
9350
|
+
]);
|
|
9351
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
9352
|
+
var MaskPolygonVerticesSchema = object({
|
|
9353
|
+
min: number(),
|
|
9354
|
+
max: number()
|
|
9355
|
+
});
|
|
9356
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
9357
|
+
var MaskGridDimsSchema = object({
|
|
9358
|
+
width: number(),
|
|
9359
|
+
height: number()
|
|
9360
|
+
});
|
|
9361
|
+
/**
|
|
9362
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
9363
|
+
*
|
|
9364
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
9365
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
9366
|
+
*
|
|
9367
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
9368
|
+
* `notification-center` module), hooked on the durable persistence
|
|
9369
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
9370
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
9371
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
9372
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
9373
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
9374
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
9375
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
9376
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
9377
|
+
* target kind's own caps/degrade engine).
|
|
9378
|
+
*
|
|
9379
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
9380
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
9381
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
9382
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
9383
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
9384
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
9385
|
+
* P2+ (see spec §7).
|
|
9386
|
+
*
|
|
9387
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
9388
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
9389
|
+
* schema/interface drift is explicitly not repeated).
|
|
9390
|
+
*/
|
|
9391
|
+
/**
|
|
9392
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
9393
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
9394
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
9395
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
9396
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
9397
|
+
* change of a LINKED device, one row per linked camera)
|
|
9398
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
9399
|
+
* delivery / pick-up)
|
|
9400
|
+
*
|
|
9401
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
9402
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
9403
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
9404
|
+
* one trigger.
|
|
9405
|
+
*/
|
|
9406
|
+
var NcDeliverySchema = _enum([
|
|
9407
|
+
"immediate",
|
|
9408
|
+
"track-end",
|
|
9409
|
+
"device-event",
|
|
9410
|
+
"package-event"
|
|
9411
|
+
]);
|
|
9412
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
9413
|
+
var NcScheduleSchema = object({
|
|
9414
|
+
windows: array(object({
|
|
9415
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
9416
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
9417
|
+
startMinute: number().int().min(0).max(1439),
|
|
9418
|
+
endMinute: number().int().min(0).max(1439)
|
|
9419
|
+
})).min(1),
|
|
9420
|
+
/** IANA timezone; default = hub host timezone. */
|
|
9421
|
+
timezone: string().optional(),
|
|
9422
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
9423
|
+
invert: boolean().optional()
|
|
9424
|
+
});
|
|
9425
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
9426
|
+
var NcPlateMatcherSchema = object({
|
|
9427
|
+
values: array(string().min(1)).min(1),
|
|
9428
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9429
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9430
|
+
});
|
|
9431
|
+
/**
|
|
9432
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9433
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9434
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9435
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9436
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9437
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9438
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9439
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9440
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9441
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9442
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9443
|
+
*/
|
|
9444
|
+
var NcOccupancyConditionSchema = object({
|
|
9445
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9446
|
+
zoneId: string().optional(),
|
|
9447
|
+
/** Object class to count; absent = any class. */
|
|
9448
|
+
className: string().optional(),
|
|
9449
|
+
op: _enum([
|
|
9450
|
+
"became-occupied",
|
|
9451
|
+
"became-free",
|
|
9452
|
+
">=",
|
|
9453
|
+
"<="
|
|
9454
|
+
]).default("became-occupied"),
|
|
9455
|
+
count: number().int().min(0).default(1),
|
|
9456
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9457
|
+
});
|
|
9458
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9459
|
+
var NcZoneConditionSchema = object({
|
|
9460
|
+
ids: array(string().min(1)).min(1),
|
|
9461
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9462
|
+
match: _enum(["any", "all"]).default("any")
|
|
9463
|
+
});
|
|
9464
|
+
/**
|
|
9465
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9466
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9467
|
+
*/
|
|
9468
|
+
var NcConditionsSchema = object({
|
|
9469
|
+
/** Device scope — absent = all devices. */
|
|
9470
|
+
devices: array(number()).optional(),
|
|
9471
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9472
|
+
classes: array(string().min(1)).optional(),
|
|
9473
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9474
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9475
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9476
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9477
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9478
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9479
|
+
/** Veto zones — any hit fails the rule. */
|
|
9480
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
9481
|
+
/**
|
|
9482
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9483
|
+
* (identity name / plate text / subclass).
|
|
9484
|
+
*/
|
|
9485
|
+
labelEquals: array(string().min(1)).optional(),
|
|
9486
|
+
/**
|
|
9487
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9488
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9489
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
9490
|
+
*/
|
|
9491
|
+
identities: array(string().min(1)).optional(),
|
|
9492
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9493
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
9494
|
+
/**
|
|
9495
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9496
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9497
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9498
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
9499
|
+
*/
|
|
9500
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
9501
|
+
/**
|
|
9502
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9503
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9504
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9505
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9506
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9507
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9508
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9509
|
+
*/
|
|
9510
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9511
|
+
/**
|
|
9512
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9513
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9514
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9515
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9516
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9517
|
+
*/
|
|
9518
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9519
|
+
/**
|
|
9520
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9521
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9522
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9523
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9524
|
+
* tracks carry `sensor`.
|
|
9525
|
+
*/
|
|
9526
|
+
source: _enum([
|
|
9527
|
+
"pipeline",
|
|
9528
|
+
"onboard",
|
|
9529
|
+
"sensor",
|
|
9530
|
+
"any"
|
|
9531
|
+
]).optional(),
|
|
9532
|
+
/**
|
|
9533
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9534
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9535
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9536
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9537
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9538
|
+
*
|
|
9539
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9540
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9541
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9542
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9543
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9544
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9545
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9546
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9547
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9548
|
+
* closed for it (an un-recognized subject).
|
|
9549
|
+
*/
|
|
9550
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9551
|
+
/**
|
|
9552
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9553
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9554
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9555
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9556
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9557
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9558
|
+
*/
|
|
9559
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9560
|
+
/**
|
|
9561
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9562
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9563
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9564
|
+
*/
|
|
9565
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9566
|
+
/**
|
|
9567
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9568
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9569
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9570
|
+
* on the package-event trigger).
|
|
9571
|
+
*/
|
|
9572
|
+
packagePhase: _enum([
|
|
9573
|
+
"delivered",
|
|
9574
|
+
"picked-up",
|
|
9575
|
+
"both"
|
|
9576
|
+
]).optional(),
|
|
9577
|
+
/**
|
|
9578
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9579
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9580
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9581
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9582
|
+
*/
|
|
9583
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9584
|
+
/**
|
|
9585
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9586
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9587
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9588
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9589
|
+
*/
|
|
9590
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9591
|
+
});
|
|
9592
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9593
|
+
var NcRuleTargetSchema = object({
|
|
9594
|
+
/** `notification-output` Target id. */
|
|
9595
|
+
targetId: string().min(1),
|
|
9596
|
+
/**
|
|
9597
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9598
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9599
|
+
* degrade engine drops what the backend can't render.
|
|
9600
|
+
*/
|
|
9601
|
+
params: record(string(), unknown()).optional()
|
|
9602
|
+
});
|
|
9603
|
+
/**
|
|
9604
|
+
* Media attachment policy (P1 still-image subset).
|
|
9605
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9606
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9607
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9608
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9609
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9610
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9611
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9612
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9613
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9614
|
+
* - `none` — no attachment.
|
|
9615
|
+
*/
|
|
9616
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9617
|
+
"best",
|
|
9618
|
+
"best-matching",
|
|
9619
|
+
"keyFrame",
|
|
9620
|
+
"none"
|
|
9621
|
+
]).default("best") });
|
|
9622
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9623
|
+
var NcThrottleSchema = object({
|
|
9624
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9625
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9626
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9627
|
+
});
|
|
9628
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9629
|
+
var NcRuleInputSchema = object({
|
|
9630
|
+
name: string().min(1).max(200),
|
|
9631
|
+
enabled: boolean().default(true),
|
|
9632
|
+
delivery: NcDeliverySchema,
|
|
9633
|
+
conditions: NcConditionsSchema.default({}),
|
|
9634
|
+
schedule: NcScheduleSchema.optional(),
|
|
9635
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9636
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9637
|
+
throttle: NcThrottleSchema.default({
|
|
9638
|
+
cooldownSec: 60,
|
|
9639
|
+
scope: "rule-device"
|
|
9640
|
+
}),
|
|
9641
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9642
|
+
template: object({
|
|
9643
|
+
title: string().max(500).optional(),
|
|
9644
|
+
body: string().max(2e3).optional()
|
|
9645
|
+
}).optional(),
|
|
9646
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9647
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9648
|
+
/**
|
|
9649
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9650
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9651
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9652
|
+
*/
|
|
9653
|
+
ownerUserId: string().optional()
|
|
9654
|
+
});
|
|
9655
|
+
/**
|
|
9656
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9657
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9658
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9659
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9660
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9661
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9662
|
+
* `updateRule` patch.
|
|
9663
|
+
*/
|
|
9664
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9665
|
+
/** A persisted rule. */
|
|
9666
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9667
|
+
id: string(),
|
|
9668
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9669
|
+
createdBy: string(),
|
|
9670
|
+
createdAt: number(),
|
|
9671
|
+
updatedAt: number(),
|
|
9672
|
+
/**
|
|
9673
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9674
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9675
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9676
|
+
*/
|
|
9677
|
+
disabledTargetIds: array(string()).default([])
|
|
9678
|
+
});
|
|
9679
|
+
var NcTestResultSchema = object({
|
|
9680
|
+
recordId: string(),
|
|
9681
|
+
recordKind: _enum([
|
|
9682
|
+
"object-event",
|
|
9683
|
+
"track",
|
|
9684
|
+
"device-event",
|
|
9685
|
+
"package-event"
|
|
9686
|
+
]),
|
|
9687
|
+
deviceId: number(),
|
|
9688
|
+
timestamp: number(),
|
|
9689
|
+
wouldFire: boolean(),
|
|
9690
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9691
|
+
failedCondition: string().optional(),
|
|
9692
|
+
className: string().optional(),
|
|
9693
|
+
label: string().optional()
|
|
9694
|
+
});
|
|
9695
|
+
var NcConditionDescriptorSchema = object({
|
|
9696
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9697
|
+
id: string(),
|
|
9698
|
+
group: _enum([
|
|
9699
|
+
"scope",
|
|
9700
|
+
"class",
|
|
9701
|
+
"zones",
|
|
9702
|
+
"quality",
|
|
9703
|
+
"label",
|
|
9704
|
+
"schedule",
|
|
9705
|
+
"device",
|
|
9706
|
+
"package",
|
|
9707
|
+
"occupancy"
|
|
9708
|
+
]),
|
|
9709
|
+
label: string(),
|
|
9710
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9711
|
+
valueType: _enum([
|
|
9712
|
+
"deviceIdList",
|
|
9713
|
+
"stringList",
|
|
9714
|
+
"number01",
|
|
9715
|
+
"number",
|
|
9716
|
+
"sourceSelect",
|
|
9717
|
+
"zoneSelection",
|
|
9718
|
+
"zoneIdList",
|
|
9719
|
+
"schedule",
|
|
9720
|
+
"plateMatcher",
|
|
9721
|
+
"packagePhase",
|
|
9722
|
+
"polygonDraw",
|
|
9723
|
+
"occupancy"
|
|
9724
|
+
]),
|
|
9725
|
+
operator: _enum([
|
|
9726
|
+
"in",
|
|
9727
|
+
"notIn",
|
|
9728
|
+
"anyOf",
|
|
9729
|
+
"allOf",
|
|
9730
|
+
"gte",
|
|
9731
|
+
"fuzzyIn",
|
|
9732
|
+
"withinSchedule"
|
|
9733
|
+
]),
|
|
9734
|
+
/** Which delivery kinds the condition applies to. */
|
|
9735
|
+
appliesTo: array(NcDeliverySchema),
|
|
9736
|
+
phase: string(),
|
|
9737
|
+
description: string().optional()
|
|
9738
|
+
});
|
|
9739
|
+
/**
|
|
9740
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9741
|
+
* durable outbox row's own status (single source of truth):
|
|
9742
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9743
|
+
* - `sent` — delivered (terminal)
|
|
9744
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9745
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9746
|
+
* the failure `error`)
|
|
9747
|
+
*
|
|
9748
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9749
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9750
|
+
*/
|
|
9751
|
+
var NcHistoryStatusSchema = _enum([
|
|
9752
|
+
"pending",
|
|
9753
|
+
"sent",
|
|
9754
|
+
"dead"
|
|
9755
|
+
]);
|
|
9756
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9757
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9758
|
+
"object-event",
|
|
9759
|
+
"track-end",
|
|
9760
|
+
"device-event",
|
|
9761
|
+
"package-event"
|
|
9762
|
+
]);
|
|
9763
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9764
|
+
var NcHistorySubjectSchema = object({
|
|
9765
|
+
className: string(),
|
|
9766
|
+
label: string().optional(),
|
|
9767
|
+
confidence: number().optional(),
|
|
9768
|
+
zones: array(string()),
|
|
9769
|
+
timestamp: number()
|
|
9770
|
+
});
|
|
9771
|
+
/**
|
|
9772
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9773
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9774
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9775
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9776
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9777
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9778
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9779
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9780
|
+
* P1 (admin scope only).
|
|
9781
|
+
*/
|
|
9782
|
+
var NcHistoryEntrySchema = object({
|
|
9783
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9784
|
+
id: string(),
|
|
9785
|
+
ruleId: string(),
|
|
9786
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9787
|
+
ruleName: string(),
|
|
9788
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9789
|
+
delivery: NcDeliverySchema,
|
|
9790
|
+
targetId: string(),
|
|
9791
|
+
deviceId: number(),
|
|
9792
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9793
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9794
|
+
recordId: string(),
|
|
9795
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9796
|
+
trackId: string().optional(),
|
|
9797
|
+
status: NcHistoryStatusSchema,
|
|
9798
|
+
/** Delivery attempts made so far. */
|
|
9799
|
+
attempts: number().int(),
|
|
9800
|
+
/** Fire time (outbox enqueue). */
|
|
9801
|
+
createdAt: number(),
|
|
9802
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9803
|
+
updatedAt: number(),
|
|
9804
|
+
/** Failure detail — present on a `dead` row. */
|
|
9805
|
+
error: string().optional(),
|
|
9806
|
+
subject: NcHistorySubjectSchema
|
|
9807
|
+
});
|
|
9808
|
+
/**
|
|
9809
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9810
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9811
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9812
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9813
|
+
*/
|
|
9814
|
+
var NcHistoryFilterSchema = object({
|
|
9815
|
+
ruleId: string().optional(),
|
|
9816
|
+
deviceId: number().optional(),
|
|
9817
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9818
|
+
since: number().optional(),
|
|
9819
|
+
until: number().optional(),
|
|
9820
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9821
|
+
});
|
|
9822
|
+
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 }), {
|
|
9823
|
+
kind: "mutation",
|
|
9824
|
+
auth: "admin",
|
|
9825
|
+
caller: "required"
|
|
9826
|
+
}), method(object({
|
|
9827
|
+
ruleId: string(),
|
|
9828
|
+
patch: NcRulePatchSchema
|
|
9829
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9830
|
+
kind: "mutation",
|
|
9831
|
+
auth: "admin",
|
|
9832
|
+
caller: "required"
|
|
9833
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9834
|
+
kind: "mutation",
|
|
9835
|
+
auth: "admin"
|
|
9836
|
+
}), method(object({
|
|
9837
|
+
ruleId: string(),
|
|
9838
|
+
enabled: boolean()
|
|
9839
|
+
}), object({ success: literal(true) }), {
|
|
9840
|
+
kind: "mutation",
|
|
9841
|
+
auth: "admin"
|
|
9842
|
+
}), method(object({
|
|
9843
|
+
rule: NcRuleInputSchema,
|
|
9844
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9845
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9846
|
+
kind: "mutation",
|
|
9847
|
+
auth: "admin"
|
|
9848
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9849
|
+
/**
|
|
9850
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9851
|
+
*
|
|
9852
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
9853
|
+
* §3.2/§3.3.
|
|
9854
|
+
*
|
|
9855
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
9856
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
9857
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
9858
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
9859
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
9860
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
9861
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
9862
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
9863
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
9864
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
9865
|
+
*
|
|
9866
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
9867
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
9868
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
9869
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
9870
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
9871
|
+
*/
|
|
9872
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
9873
|
+
var TimelapseTemplateSchema = object({
|
|
9874
|
+
title: string().max(500).optional(),
|
|
9875
|
+
body: string().max(2e3).optional()
|
|
9876
|
+
});
|
|
9877
|
+
var NameField = string().min(1).max(200);
|
|
9878
|
+
var DeviceIdsField = array(number()).min(1);
|
|
9879
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
9880
|
+
var FramerateField = number().int().min(1).max(60);
|
|
9881
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
9882
|
+
var PriorityField = number().int().min(1).max(5);
|
|
9883
|
+
/**
|
|
9884
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
9885
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
9886
|
+
* here (see the ownership note above).
|
|
9887
|
+
*/
|
|
9888
|
+
var TimelapseRuleInputSchema = object({
|
|
9889
|
+
name: NameField,
|
|
9890
|
+
enabled: boolean().default(true),
|
|
9891
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
9892
|
+
deviceIds: DeviceIdsField,
|
|
9893
|
+
/**
|
|
9894
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
9895
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
9896
|
+
* open clears the scratch, close assembles and delivers.
|
|
9897
|
+
*/
|
|
9898
|
+
schedule: NcScheduleSchema,
|
|
9899
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
9900
|
+
cadenceSec: CadenceSecField.default(15),
|
|
9901
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
9902
|
+
framerate: FramerateField.default(10),
|
|
9903
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
9904
|
+
targets: TargetsField,
|
|
9905
|
+
template: TimelapseTemplateSchema.optional(),
|
|
9906
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9907
|
+
priority: PriorityField.default(3)
|
|
9908
|
+
});
|
|
9909
|
+
object({
|
|
9910
|
+
name: NameField.optional(),
|
|
9911
|
+
enabled: boolean().optional(),
|
|
9912
|
+
deviceIds: DeviceIdsField.optional(),
|
|
9913
|
+
schedule: NcScheduleSchema.optional(),
|
|
9914
|
+
cadenceSec: CadenceSecField.optional(),
|
|
9915
|
+
framerate: FramerateField.optional(),
|
|
9916
|
+
targets: TargetsField.optional(),
|
|
9917
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
9918
|
+
priority: PriorityField.optional()
|
|
9919
|
+
});
|
|
9920
|
+
TimelapseRuleInputSchema.extend({
|
|
9921
|
+
id: string(),
|
|
9922
|
+
/**
|
|
9923
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
9924
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
9925
|
+
* resolved caller; never trusted from a client payload.
|
|
9926
|
+
*/
|
|
9927
|
+
ownerUserId: string().optional(),
|
|
9928
|
+
/**
|
|
9929
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
9930
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
9931
|
+
*/
|
|
9932
|
+
lastGeneratedAt: number().optional(),
|
|
9933
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
9934
|
+
createdBy: string(),
|
|
9935
|
+
createdAt: number(),
|
|
9936
|
+
updatedAt: number()
|
|
9937
|
+
});
|
|
9938
|
+
/**
|
|
9244
9939
|
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
9245
9940
|
* for every device, regardless of provider — the kernel needs a uniform
|
|
9246
9941
|
* cap-keyed slice for the basic device flags every consumer expects to
|
|
@@ -12348,6 +13043,22 @@ var CameraMetricsSchema = object({
|
|
|
12348
13043
|
])
|
|
12349
13044
|
});
|
|
12350
13045
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
13046
|
+
/**
|
|
13047
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
13048
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
13049
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
13050
|
+
*/
|
|
13051
|
+
var NativeCropRefSchema = object({
|
|
13052
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
13053
|
+
handle: FrameHandleSchema,
|
|
13054
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
13055
|
+
cropFrameSpace: object({
|
|
13056
|
+
x: number(),
|
|
13057
|
+
y: number(),
|
|
13058
|
+
w: number(),
|
|
13059
|
+
h: number()
|
|
13060
|
+
})
|
|
13061
|
+
});
|
|
12351
13062
|
var ModelFormatSchema$1 = _enum([
|
|
12352
13063
|
"onnx",
|
|
12353
13064
|
"coreml",
|
|
@@ -12623,7 +13334,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
12623
13334
|
* Omitted ⇒ the runner's default device (current single-engine
|
|
12624
13335
|
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
12625
13336
|
*/
|
|
12626
|
-
deviceKey: string().optional()
|
|
13337
|
+
deviceKey: string().optional(),
|
|
13338
|
+
/**
|
|
13339
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
13340
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
13341
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
13342
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
13343
|
+
* resolution from that surface — the SAME quality path faces already
|
|
13344
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
13345
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
13346
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
13347
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
13348
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
13349
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
13350
|
+
* (today's behaviour on the fallback path).
|
|
13351
|
+
*/
|
|
13352
|
+
nativeCropRef: NativeCropRefSchema.optional()
|
|
12627
13353
|
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
12628
13354
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
12629
13355
|
steps: array(PipelineStepInputSchema).min(1),
|
|
@@ -12872,7 +13598,11 @@ var DetailResultSchema = object({
|
|
|
12872
13598
|
bbox: NativeCropBboxSchema.optional(),
|
|
12873
13599
|
embedding: string().optional(),
|
|
12874
13600
|
label: string().optional(),
|
|
12875
|
-
alignedCropJpeg: string().optional()
|
|
13601
|
+
alignedCropJpeg: string().optional(),
|
|
13602
|
+
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
13603
|
+
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
13604
|
+
* consumers MUST prefer this when present (2026-07-22 native-gate fix). */
|
|
13605
|
+
nativeFaceShortSidePx: number().optional()
|
|
12876
13606
|
});
|
|
12877
13607
|
/**
|
|
12878
13608
|
* Per-camera tunable ranges + defaults. Single source of truth used
|
|
@@ -12886,6 +13616,12 @@ var motionCooldownMsField = {
|
|
|
12886
13616
|
default: 3e4,
|
|
12887
13617
|
step: 500
|
|
12888
13618
|
};
|
|
13619
|
+
var maxSessionHoldMsField = {
|
|
13620
|
+
min: 0,
|
|
13621
|
+
max: 6e5,
|
|
13622
|
+
default: 12e4,
|
|
13623
|
+
step: 5e3
|
|
13624
|
+
};
|
|
12889
13625
|
var motionFpsField = {
|
|
12890
13626
|
min: 1,
|
|
12891
13627
|
max: 30,
|
|
@@ -13033,6 +13769,19 @@ var RunnerCameraConfigSchema = object({
|
|
|
13033
13769
|
"on-motion"
|
|
13034
13770
|
]).default("always-on"),
|
|
13035
13771
|
motionCooldownMs: number().min(motionCooldownMsField.min).default(motionCooldownMsField.default),
|
|
13772
|
+
/**
|
|
13773
|
+
* Orchestrator-side on-motion session-hold cap (ms). While an on-motion
|
|
13774
|
+
* detection session is active and ≥1 confirmed non-stationary track is
|
|
13775
|
+
* still live, the orchestrator keeps the session open past
|
|
13776
|
+
* `motionCooldownMs` (a slowly-moving subject can stop re-triggering the
|
|
13777
|
+
* camera's VMD yet is still being tracked frame-to-frame) — up to this many
|
|
13778
|
+
* ms since the session opened, after which it closes regardless. `0`
|
|
13779
|
+
* disables the hold (legacy cooldown-only teardown). Not consumed by the
|
|
13780
|
+
* runner itself — carried here so it shares the per-camera device-settings
|
|
13781
|
+
* surface with `motionCooldownMs`; the orchestrator reads it off the
|
|
13782
|
+
* resolved `CameraDetectionConfig`.
|
|
13783
|
+
*/
|
|
13784
|
+
maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
|
|
13036
13785
|
motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
|
|
13037
13786
|
detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
|
|
13038
13787
|
motionStreamId: string(),
|
|
@@ -13122,7 +13871,7 @@ var RunnerCameraConfigSchema = object({
|
|
|
13122
13871
|
*/
|
|
13123
13872
|
inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
|
|
13124
13873
|
});
|
|
13125
|
-
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;
|
|
13874
|
+
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;
|
|
13126
13875
|
/**
|
|
13127
13876
|
* Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
|
|
13128
13877
|
* load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
|
|
@@ -13338,71 +14087,10 @@ var motionTriggerCapability = {
|
|
|
13338
14087
|
runtimeState: MotionTriggerRuntimeStateSchema
|
|
13339
14088
|
};
|
|
13340
14089
|
/**
|
|
13341
|
-
*
|
|
13342
|
-
* motion-
|
|
13343
|
-
*
|
|
13344
|
-
*
|
|
13345
|
-
*
|
|
13346
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
13347
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
13348
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
13349
|
-
*/
|
|
13350
|
-
/** A normalized 0..1 point (top-left origin). */
|
|
13351
|
-
var MaskPointSchema = object({
|
|
13352
|
-
x: number(),
|
|
13353
|
-
y: number()
|
|
13354
|
-
});
|
|
13355
|
-
/** Axis-aligned rectangle (normalized 0..1). */
|
|
13356
|
-
var MaskRectShapeSchema = object({
|
|
13357
|
-
kind: literal("rect"),
|
|
13358
|
-
x: number(),
|
|
13359
|
-
y: number(),
|
|
13360
|
-
width: number(),
|
|
13361
|
-
height: number()
|
|
13362
|
-
});
|
|
13363
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
13364
|
-
var MaskPolygonShapeSchema = object({
|
|
13365
|
-
kind: literal("polygon"),
|
|
13366
|
-
points: array(MaskPointSchema)
|
|
13367
|
-
});
|
|
13368
|
-
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
13369
|
-
var MaskGridShapeSchema = object({
|
|
13370
|
-
kind: literal("grid"),
|
|
13371
|
-
gridWidth: number(),
|
|
13372
|
-
gridHeight: number(),
|
|
13373
|
-
cells: array(boolean())
|
|
13374
|
-
});
|
|
13375
|
-
discriminatedUnion("kind", [
|
|
13376
|
-
MaskRectShapeSchema,
|
|
13377
|
-
MaskPolygonShapeSchema,
|
|
13378
|
-
MaskGridShapeSchema,
|
|
13379
|
-
object({
|
|
13380
|
-
kind: literal("line"),
|
|
13381
|
-
points: array(MaskPointSchema)
|
|
13382
|
-
})
|
|
13383
|
-
]);
|
|
13384
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
13385
|
-
var MaskShapeKindSchema = _enum([
|
|
13386
|
-
"rect",
|
|
13387
|
-
"polygon",
|
|
13388
|
-
"grid",
|
|
13389
|
-
"line"
|
|
13390
|
-
]);
|
|
13391
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
13392
|
-
var MaskPolygonVerticesSchema = object({
|
|
13393
|
-
min: number(),
|
|
13394
|
-
max: number()
|
|
13395
|
-
});
|
|
13396
|
-
/** Grid dimensions when a cap supports 'grid'. */
|
|
13397
|
-
var MaskGridDimsSchema = object({
|
|
13398
|
-
width: number(),
|
|
13399
|
-
height: number()
|
|
13400
|
-
});
|
|
13401
|
-
/**
|
|
13402
|
-
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
13403
|
-
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
13404
|
-
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
13405
|
-
* a region keeps one drawing-plane model across all geometry caps.
|
|
14090
|
+
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
14091
|
+
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
14092
|
+
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
14093
|
+
* a region keeps one drawing-plane model across all geometry caps.
|
|
13406
14094
|
*/
|
|
13407
14095
|
/** A motion-zone region — exactly one boolean cell grid today. */
|
|
13408
14096
|
var MotionZoneRegionSchema = object({
|
|
@@ -16668,94 +17356,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
16668
17356
|
bundleUrl: string()
|
|
16669
17357
|
});
|
|
16670
17358
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
16671
|
-
var NotificationRuleConditionsSchema = object({
|
|
16672
|
-
deviceIds: array(number()).readonly().optional(),
|
|
16673
|
-
classNames: array(string()).readonly().optional(),
|
|
16674
|
-
zoneIds: array(string()).readonly().optional(),
|
|
16675
|
-
minConfidence: number().optional(),
|
|
16676
|
-
source: _enum([
|
|
16677
|
-
"pipeline",
|
|
16678
|
-
"onboard",
|
|
16679
|
-
"any"
|
|
16680
|
-
]).optional(),
|
|
16681
|
-
schedule: object({
|
|
16682
|
-
days: array(number()).readonly(),
|
|
16683
|
-
startHour: number(),
|
|
16684
|
-
endHour: number()
|
|
16685
|
-
}).optional(),
|
|
16686
|
-
cooldownSeconds: number().optional(),
|
|
16687
|
-
minDwellSeconds: number().optional(),
|
|
16688
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
16689
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
16690
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
16691
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
16692
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
16693
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
16694
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
16695
|
-
clipDescription: object({
|
|
16696
|
-
text: string().min(1),
|
|
16697
|
-
minSimilarity: number().min(0).max(1)
|
|
16698
|
-
}).optional(),
|
|
16699
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
16700
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
16701
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
16702
|
-
* vehicle/person> is seen". */
|
|
16703
|
-
labels: array(string()).readonly().optional()
|
|
16704
|
-
});
|
|
16705
|
-
var NotificationRuleTemplateSchema = object({
|
|
16706
|
-
title: string(),
|
|
16707
|
-
body: string(),
|
|
16708
|
-
imageMode: _enum([
|
|
16709
|
-
"crop",
|
|
16710
|
-
"annotated",
|
|
16711
|
-
"full",
|
|
16712
|
-
"none"
|
|
16713
|
-
])
|
|
16714
|
-
});
|
|
16715
|
-
var NotificationRuleSchema = object({
|
|
16716
|
-
id: string(),
|
|
16717
|
-
name: string(),
|
|
16718
|
-
enabled: boolean(),
|
|
16719
|
-
eventTypes: array(string()).readonly(),
|
|
16720
|
-
conditions: NotificationRuleConditionsSchema,
|
|
16721
|
-
outputs: array(string()).readonly(),
|
|
16722
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
16723
|
-
priority: _enum([
|
|
16724
|
-
"low",
|
|
16725
|
-
"normal",
|
|
16726
|
-
"high",
|
|
16727
|
-
"critical"
|
|
16728
|
-
])
|
|
16729
|
-
});
|
|
16730
|
-
var NotificationTestResultSchema = object({
|
|
16731
|
-
ruleId: string(),
|
|
16732
|
-
eventId: string(),
|
|
16733
|
-
timestamp: number(),
|
|
16734
|
-
wouldFire: boolean(),
|
|
16735
|
-
reason: string().optional()
|
|
16736
|
-
});
|
|
16737
|
-
var NotificationHistoryEntrySchema = object({
|
|
16738
|
-
id: string(),
|
|
16739
|
-
ruleId: string(),
|
|
16740
|
-
ruleName: string(),
|
|
16741
|
-
eventId: string(),
|
|
16742
|
-
timestamp: number(),
|
|
16743
|
-
outputs: array(string()).readonly(),
|
|
16744
|
-
success: boolean(),
|
|
16745
|
-
error: string().optional(),
|
|
16746
|
-
deviceId: number().optional()
|
|
16747
|
-
});
|
|
16748
|
-
var NotificationHistoryFilterSchema = object({
|
|
16749
|
-
ruleId: string().optional(),
|
|
16750
|
-
deviceId: number().optional(),
|
|
16751
|
-
from: number().optional(),
|
|
16752
|
-
to: number().optional(),
|
|
16753
|
-
limit: number().optional()
|
|
16754
|
-
});
|
|
16755
|
-
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({
|
|
16756
|
-
ruleId: string(),
|
|
16757
|
-
lookbackMinutes: number()
|
|
16758
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
16759
17359
|
/**
|
|
16760
17360
|
* Alerts capability — collection-based internal alert system.
|
|
16761
17361
|
*
|
|
@@ -16942,88 +17542,54 @@ method(object({
|
|
|
16942
17542
|
password: string()
|
|
16943
17543
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
16944
17544
|
/**
|
|
16945
|
-
*
|
|
16946
|
-
*
|
|
16947
|
-
*
|
|
16948
|
-
*
|
|
16949
|
-
*
|
|
16950
|
-
*
|
|
16951
|
-
*
|
|
16952
|
-
* A contribution is a discriminated union on `kind`:
|
|
16953
|
-
*
|
|
16954
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
16955
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16956
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
16957
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16958
|
-
* login page needs NO change.
|
|
16959
|
-
*
|
|
16960
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
16961
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
16962
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
16963
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
16964
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
16965
|
-
*
|
|
16966
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
16967
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
16968
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
16969
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
16970
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
16971
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
16972
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
16973
|
-
* decision.
|
|
16974
|
-
*
|
|
16975
|
-
* Every contribution carries a `stage`:
|
|
16976
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
16977
|
-
* magic-link buttons; a future usernameless passkey).
|
|
16978
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16979
|
-
* returned `factors` (passkey-as-2FA today).
|
|
16980
|
-
*
|
|
16981
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
16982
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
16983
|
-
* tRPC router.
|
|
17545
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
17546
|
+
* NOT flow through the capability — they use the addon data plane
|
|
17547
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
17548
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
17549
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
17550
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
16984
17551
|
*/
|
|
16985
|
-
|
|
16986
|
-
|
|
16987
|
-
|
|
16988
|
-
|
|
16989
|
-
|
|
16990
|
-
|
|
16991
|
-
|
|
16992
|
-
|
|
16993
|
-
|
|
16994
|
-
|
|
16995
|
-
|
|
16996
|
-
|
|
16997
|
-
|
|
16998
|
-
|
|
16999
|
-
|
|
17000
|
-
|
|
17001
|
-
|
|
17002
|
-
|
|
17003
|
-
|
|
17004
|
-
|
|
17005
|
-
|
|
17006
|
-
|
|
17007
|
-
|
|
17008
|
-
|
|
17009
|
-
|
|
17010
|
-
|
|
17011
|
-
|
|
17012
|
-
|
|
17013
|
-
|
|
17014
|
-
|
|
17015
|
-
|
|
17016
|
-
|
|
17017
|
-
|
|
17018
|
-
|
|
17019
|
-
|
|
17020
|
-
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
|
|
17024
|
-
|
|
17025
|
-
|
|
17026
|
-
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
17552
|
+
var TerminalSessionInfoSchema = object({
|
|
17553
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
17554
|
+
sessionId: string(),
|
|
17555
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
17556
|
+
profileId: string(),
|
|
17557
|
+
/** Human-readable profile label for the UI session list. */
|
|
17558
|
+
label: string(),
|
|
17559
|
+
cols: number().int().positive(),
|
|
17560
|
+
rows: number().int().positive(),
|
|
17561
|
+
/** ms-epoch the session's pty was spawned. */
|
|
17562
|
+
startedAt: number()
|
|
17563
|
+
});
|
|
17564
|
+
/**
|
|
17565
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
17566
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
17567
|
+
* command string would be remote code execution as the server's user, so it is
|
|
17568
|
+
* deliberately not part of the contract.
|
|
17569
|
+
*/
|
|
17570
|
+
var TerminalProfileInfoSchema = object({
|
|
17571
|
+
profileId: string(),
|
|
17572
|
+
label: string(),
|
|
17573
|
+
description: string().optional()
|
|
17574
|
+
});
|
|
17575
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
17576
|
+
profileId: string(),
|
|
17577
|
+
cols: number().int().positive(),
|
|
17578
|
+
rows: number().int().positive()
|
|
17579
|
+
}), TerminalSessionInfoSchema, {
|
|
17580
|
+
kind: "mutation",
|
|
17581
|
+
auth: "admin"
|
|
17582
|
+
}), method(object({
|
|
17583
|
+
sessionId: string(),
|
|
17584
|
+
cols: number().int().positive(),
|
|
17585
|
+
rows: number().int().positive()
|
|
17586
|
+
}), _void(), {
|
|
17587
|
+
kind: "mutation",
|
|
17588
|
+
auth: "admin"
|
|
17589
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
17590
|
+
kind: "mutation",
|
|
17591
|
+
auth: "admin"
|
|
17592
|
+
});
|
|
17027
17593
|
/**
|
|
17028
17594
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
17029
17595
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
@@ -17125,11 +17691,53 @@ var LocationStatSchema = object({
|
|
|
17125
17691
|
fileCount: number(),
|
|
17126
17692
|
present: boolean()
|
|
17127
17693
|
});
|
|
17694
|
+
/**
|
|
17695
|
+
* A backup schedule — the N:M "entry" that binds one cron cadence to a
|
|
17696
|
+
* SET of destination locations. Supersedes the per-location cron on
|
|
17697
|
+
* `BackupDestinationPolicy`: an operator creates a schedule, picks the
|
|
17698
|
+
* `backups` locations it should write to, and the orchestrator fans a
|
|
17699
|
+
* single archive out to all of them when the cron fires.
|
|
17700
|
+
*
|
|
17701
|
+
* `retentionCount` is per-schedule (D-decision 2026-07-28): every
|
|
17702
|
+
* location targeted by this schedule keeps this many archives from
|
|
17703
|
+
* this schedule's runs.
|
|
17704
|
+
*
|
|
17705
|
+
* `dataSources` optionally narrows which top-level state locations
|
|
17706
|
+
* (db, addons, tls, …) are archived; omitted = the orchestrator's
|
|
17707
|
+
* default full set.
|
|
17708
|
+
*/
|
|
17709
|
+
var BackupScheduleSchema = object({
|
|
17710
|
+
/** Stable id. Generated by the orchestrator on first upsert if absent. */
|
|
17711
|
+
id: string(),
|
|
17712
|
+
/** Operator-facing display name. */
|
|
17713
|
+
label: string(),
|
|
17714
|
+
/** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
|
|
17715
|
+
cron: string(),
|
|
17716
|
+
/** Master on/off toggle for the whole schedule. */
|
|
17717
|
+
enabled: boolean(),
|
|
17718
|
+
/** `backups`-location ids this schedule writes to (fan-out set). */
|
|
17719
|
+
locationIds: array(string()).readonly(),
|
|
17720
|
+
/** Archives kept per targeted location for this schedule. */
|
|
17721
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
17722
|
+
/** Optional subset of source locations to include; omitted = all. */
|
|
17723
|
+
dataSources: array(string()).readonly().optional(),
|
|
17724
|
+
/** ms-epoch of last successful run. */
|
|
17725
|
+
lastRunAt: number().optional(),
|
|
17726
|
+
/** ms-epoch of next computed firing (read-only, filled on list). */
|
|
17727
|
+
nextRunAt: number().optional()
|
|
17728
|
+
});
|
|
17128
17729
|
method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
17129
17730
|
/** Subset of registered `backup-destination` addon ids to write to. */
|
|
17130
17731
|
destinations: array(string()).optional(),
|
|
17131
17732
|
locations: array(string()).optional(),
|
|
17132
|
-
label: string().optional()
|
|
17733
|
+
label: string().optional(),
|
|
17734
|
+
/**
|
|
17735
|
+
* Per-run retention override applied to every targeted
|
|
17736
|
+
* destination. Used by schedule-driven runs (per-entry
|
|
17737
|
+
* retention). Omitted = each destination's own policy
|
|
17738
|
+
* retention (manual runs).
|
|
17739
|
+
*/
|
|
17740
|
+
retentionCount: number().int().min(1).max(1e3).optional()
|
|
17133
17741
|
}).optional(), array(BackupEntrySchema).readonly(), {
|
|
17134
17742
|
kind: "mutation",
|
|
17135
17743
|
auth: "admin"
|
|
@@ -17178,7 +17786,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
17178
17786
|
ok: boolean(),
|
|
17179
17787
|
error: string().optional(),
|
|
17180
17788
|
nextRuns: array(number()).readonly()
|
|
17181
|
-
}))
|
|
17789
|
+
})), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
|
|
17790
|
+
id: string().optional(),
|
|
17791
|
+
label: string(),
|
|
17792
|
+
cron: string(),
|
|
17793
|
+
enabled: boolean(),
|
|
17794
|
+
locationIds: array(string()).readonly(),
|
|
17795
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
17796
|
+
dataSources: array(string()).readonly().optional()
|
|
17797
|
+
}), BackupScheduleSchema, {
|
|
17798
|
+
kind: "mutation",
|
|
17799
|
+
auth: "admin"
|
|
17800
|
+
}), method(object({ id: string() }), _void(), {
|
|
17801
|
+
kind: "mutation",
|
|
17802
|
+
auth: "admin"
|
|
17803
|
+
});
|
|
17182
17804
|
/**
|
|
17183
17805
|
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
17184
17806
|
*
|
|
@@ -18434,851 +19056,934 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
18434
19056
|
kind: "mutation",
|
|
18435
19057
|
auth: "admin"
|
|
18436
19058
|
});
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18442
|
-
|
|
18443
|
-
|
|
18444
|
-
|
|
18445
|
-
|
|
18446
|
-
|
|
18447
|
-
|
|
18448
|
-
|
|
18449
|
-
tags: record(string(), string()).optional()
|
|
19059
|
+
/**
|
|
19060
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
19061
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
19062
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
19063
|
+
*
|
|
19064
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
19065
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
19066
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
19067
|
+
*/
|
|
19068
|
+
var LlmUsageSchema = object({
|
|
19069
|
+
inputTokens: number(),
|
|
19070
|
+
outputTokens: number()
|
|
18450
19071
|
});
|
|
18451
|
-
|
|
18452
|
-
|
|
18453
|
-
|
|
18454
|
-
|
|
18455
|
-
|
|
18456
|
-
|
|
18457
|
-
|
|
18458
|
-
|
|
18459
|
-
|
|
18460
|
-
|
|
18461
|
-
|
|
18462
|
-
|
|
18463
|
-
|
|
18464
|
-
|
|
18465
|
-
loadAvg: tuple([
|
|
18466
|
-
number(),
|
|
18467
|
-
number(),
|
|
18468
|
-
number()
|
|
18469
|
-
]),
|
|
18470
|
-
cores: number()
|
|
18471
|
-
});
|
|
18472
|
-
var MemoryInfoSchema = object({
|
|
18473
|
-
percent: number(),
|
|
18474
|
-
totalBytes: number(),
|
|
18475
|
-
usedBytes: number(),
|
|
18476
|
-
availableBytes: number(),
|
|
18477
|
-
swapUsedBytes: number(),
|
|
18478
|
-
swapTotalBytes: number()
|
|
18479
|
-
});
|
|
18480
|
-
var DiskIoSnapshotSchema = object({
|
|
18481
|
-
readBytes: number(),
|
|
18482
|
-
writeBytes: number(),
|
|
18483
|
-
readOps: number(),
|
|
18484
|
-
writeOps: number(),
|
|
18485
|
-
timestampMs: number()
|
|
18486
|
-
});
|
|
18487
|
-
var NetworkIoSnapshotSchema = object({
|
|
18488
|
-
rxBytes: number(),
|
|
18489
|
-
txBytes: number(),
|
|
18490
|
-
rxPackets: number(),
|
|
18491
|
-
txPackets: number(),
|
|
18492
|
-
rxErrors: number(),
|
|
18493
|
-
txErrors: number(),
|
|
18494
|
-
timestampMs: number()
|
|
18495
|
-
});
|
|
18496
|
-
var MetricsGpuInfoSchema = object({
|
|
18497
|
-
utilization: number(),
|
|
19072
|
+
var LlmErrorCodeSchema = _enum([
|
|
19073
|
+
"timeout",
|
|
19074
|
+
"rate-limited",
|
|
19075
|
+
"auth",
|
|
19076
|
+
"refusal",
|
|
19077
|
+
"bad-request",
|
|
19078
|
+
"unavailable",
|
|
19079
|
+
"no-profile",
|
|
19080
|
+
"budget-exceeded",
|
|
19081
|
+
"adapter-error"
|
|
19082
|
+
]);
|
|
19083
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
19084
|
+
ok: literal(true),
|
|
19085
|
+
text: string(),
|
|
18498
19086
|
model: string(),
|
|
18499
|
-
|
|
18500
|
-
|
|
18501
|
-
|
|
18502
|
-
})
|
|
18503
|
-
|
|
18504
|
-
|
|
18505
|
-
|
|
18506
|
-
|
|
18507
|
-
|
|
18508
|
-
|
|
18509
|
-
|
|
18510
|
-
|
|
18511
|
-
|
|
18512
|
-
|
|
19087
|
+
usage: LlmUsageSchema,
|
|
19088
|
+
truncated: boolean(),
|
|
19089
|
+
latencyMs: number()
|
|
19090
|
+
}), object({
|
|
19091
|
+
ok: literal(false),
|
|
19092
|
+
code: LlmErrorCodeSchema,
|
|
19093
|
+
message: string(),
|
|
19094
|
+
retryAfterMs: number().optional()
|
|
19095
|
+
})]);
|
|
19096
|
+
/**
|
|
19097
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
19098
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
19099
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
19100
|
+
*/
|
|
19101
|
+
var LlmImageSchema = object({
|
|
19102
|
+
bytes: _instanceof(Uint8Array),
|
|
19103
|
+
mimeType: string()
|
|
18513
19104
|
});
|
|
18514
|
-
var
|
|
18515
|
-
|
|
18516
|
-
|
|
19105
|
+
var LlmGenerateBaseInputSchema = object({
|
|
19106
|
+
/** Collection routing (the notification-output posture). */
|
|
19107
|
+
addonId: string().optional(),
|
|
19108
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
19109
|
+
profileId: string().optional(),
|
|
19110
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
19111
|
+
consumer: string(),
|
|
19112
|
+
system: string().optional(),
|
|
19113
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
19114
|
+
prompt: string(),
|
|
19115
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
19116
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
19117
|
+
/** Per-call override of the profile default. */
|
|
19118
|
+
maxTokens: number().int().positive().optional(),
|
|
19119
|
+
temperature: number().optional()
|
|
18517
19120
|
});
|
|
18518
|
-
|
|
18519
|
-
|
|
18520
|
-
|
|
18521
|
-
|
|
18522
|
-
|
|
18523
|
-
|
|
18524
|
-
|
|
18525
|
-
|
|
18526
|
-
|
|
18527
|
-
|
|
19121
|
+
/**
|
|
19122
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
19123
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
19124
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
19125
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
19126
|
+
* this only through the `llm` cap's methods.
|
|
19127
|
+
*
|
|
19128
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
19129
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
19130
|
+
* watchdog — operator decision #3).
|
|
19131
|
+
*/
|
|
19132
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
19133
|
+
object({
|
|
19134
|
+
kind: literal("catalog"),
|
|
19135
|
+
catalogId: string()
|
|
18528
19136
|
}),
|
|
18529
|
-
|
|
18530
|
-
|
|
18531
|
-
|
|
18532
|
-
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
|
|
18536
|
-
|
|
18537
|
-
|
|
18538
|
-
|
|
18539
|
-
|
|
18540
|
-
|
|
18541
|
-
|
|
18542
|
-
|
|
18543
|
-
|
|
18544
|
-
|
|
18545
|
-
|
|
18546
|
-
|
|
18547
|
-
|
|
18548
|
-
|
|
18549
|
-
|
|
18550
|
-
*/
|
|
18551
|
-
|
|
18552
|
-
/**
|
|
18553
|
-
|
|
18554
|
-
|
|
18555
|
-
|
|
18556
|
-
sharedBytes: number().optional()
|
|
19137
|
+
object({
|
|
19138
|
+
kind: literal("url"),
|
|
19139
|
+
url: string(),
|
|
19140
|
+
sha256: string().optional()
|
|
19141
|
+
}),
|
|
19142
|
+
object({
|
|
19143
|
+
kind: literal("path"),
|
|
19144
|
+
path: string()
|
|
19145
|
+
})
|
|
19146
|
+
]);
|
|
19147
|
+
var ManagedRuntimeConfigSchema = object({
|
|
19148
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
19149
|
+
nodeId: string(),
|
|
19150
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
19151
|
+
engine: _enum(["llama-cpp"]),
|
|
19152
|
+
model: ManagedModelRefSchema,
|
|
19153
|
+
contextSize: number().int().default(4096),
|
|
19154
|
+
/** 0 = CPU-only. */
|
|
19155
|
+
gpuLayers: number().int().default(0),
|
|
19156
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
19157
|
+
threads: number().int().optional(),
|
|
19158
|
+
/** Concurrent slots. */
|
|
19159
|
+
parallel: number().int().default(1),
|
|
19160
|
+
/** Else lazy: first generate boots it. */
|
|
19161
|
+
autoStart: boolean().default(false),
|
|
19162
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
19163
|
+
idleStopMinutes: number().int().default(30)
|
|
18557
19164
|
});
|
|
18558
|
-
var
|
|
18559
|
-
|
|
19165
|
+
var LlmRuntimeStatusSchema = object({
|
|
19166
|
+
/** Status is ALWAYS node-qualified. */
|
|
18560
19167
|
nodeId: string(),
|
|
18561
|
-
role: _enum(["hub", "worker"]),
|
|
18562
|
-
pid: number(),
|
|
18563
19168
|
state: _enum([
|
|
18564
|
-
"starting",
|
|
18565
|
-
"running",
|
|
18566
|
-
"stopping",
|
|
18567
19169
|
"stopped",
|
|
18568
|
-
"
|
|
18569
|
-
|
|
18570
|
-
|
|
18571
|
-
|
|
18572
|
-
|
|
18573
|
-
pid: number(),
|
|
18574
|
-
ppid: number(),
|
|
18575
|
-
pgid: number(),
|
|
18576
|
-
classification: _enum([
|
|
18577
|
-
"root",
|
|
18578
|
-
"managed",
|
|
18579
|
-
"system",
|
|
18580
|
-
"ghost"
|
|
19170
|
+
"downloading",
|
|
19171
|
+
"starting",
|
|
19172
|
+
"ready",
|
|
19173
|
+
"crashed",
|
|
19174
|
+
"failed"
|
|
18581
19175
|
]),
|
|
18582
|
-
|
|
18583
|
-
|
|
18584
|
-
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
|
|
18588
|
-
|
|
18589
|
-
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
18593
|
-
orphaned: boolean()
|
|
18594
|
-
});
|
|
18595
|
-
var KillProcessInputSchema = object({
|
|
18596
|
-
pid: number(),
|
|
18597
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
18598
|
-
force: boolean().optional()
|
|
19176
|
+
pid: number().optional(),
|
|
19177
|
+
port: number().optional(),
|
|
19178
|
+
modelPath: string().optional(),
|
|
19179
|
+
modelId: string().optional(),
|
|
19180
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
19181
|
+
lastError: string().optional(),
|
|
19182
|
+
crashesInWindow: number(),
|
|
19183
|
+
/** Child RSS (sampled best-effort). */
|
|
19184
|
+
memoryBytes: number().optional(),
|
|
19185
|
+
vramBytes: number().optional()
|
|
18599
19186
|
});
|
|
18600
|
-
var
|
|
18601
|
-
|
|
18602
|
-
|
|
18603
|
-
|
|
19187
|
+
var LlmNodeModelSchema = object({
|
|
19188
|
+
file: string(),
|
|
19189
|
+
sizeBytes: number(),
|
|
19190
|
+
catalogId: string().optional(),
|
|
19191
|
+
installedAt: number().optional()
|
|
18604
19192
|
});
|
|
18605
|
-
var
|
|
18606
|
-
|
|
18607
|
-
|
|
18608
|
-
|
|
18609
|
-
success: boolean(),
|
|
18610
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
18611
|
-
path: string().optional(),
|
|
18612
|
-
/** Process pid that was signalled. */
|
|
18613
|
-
pid: number().optional(),
|
|
18614
|
-
reason: string().optional()
|
|
19193
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
19194
|
+
nodeId: string(),
|
|
19195
|
+
modelsBytes: number(),
|
|
19196
|
+
freeBytes: number().optional()
|
|
18615
19197
|
});
|
|
18616
|
-
|
|
18617
|
-
|
|
18618
|
-
|
|
18619
|
-
|
|
18620
|
-
|
|
18621
|
-
|
|
18622
|
-
temperature: number().optional(),
|
|
18623
|
-
gpuPercent: number().optional(),
|
|
18624
|
-
gpuMemoryPercent: number().optional()
|
|
18625
|
-
});
|
|
18626
|
-
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, {
|
|
19198
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
19199
|
+
images: array(LlmImageSchema).optional(),
|
|
19200
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
19201
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
19202
|
+
timeoutMs: number().int().positive().optional()
|
|
19203
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
18627
19204
|
kind: "mutation",
|
|
18628
19205
|
auth: "admin"
|
|
18629
|
-
}), method(
|
|
19206
|
+
}), method(object({}), _void(), {
|
|
18630
19207
|
kind: "mutation",
|
|
18631
19208
|
auth: "admin"
|
|
18632
|
-
})
|
|
18633
|
-
method(object({
|
|
18634
|
-
sourceUrl: string(),
|
|
18635
|
-
metadata: ModelConvertMetadataSchema,
|
|
18636
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
18637
|
-
calibrationRef: string().optional(),
|
|
18638
|
-
sessionId: string().optional()
|
|
18639
|
-
}), ConvertResultSchema, {
|
|
19209
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
18640
19210
|
kind: "mutation",
|
|
18641
|
-
auth: "admin"
|
|
18642
|
-
|
|
18643
|
-
});
|
|
18644
|
-
method(object({
|
|
18645
|
-
nodeId: string(),
|
|
18646
|
-
modelId: string(),
|
|
18647
|
-
format: _enum(MODEL_FORMATS),
|
|
18648
|
-
entry: ModelCatalogEntrySchema
|
|
18649
|
-
}), object({
|
|
18650
|
-
ok: boolean(),
|
|
18651
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
18652
|
-
sha256: string(),
|
|
18653
|
-
bytes: number(),
|
|
18654
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
18655
|
-
path: string()
|
|
18656
|
-
}), {
|
|
19211
|
+
auth: "admin"
|
|
19212
|
+
}), method(object({ file: string() }), _void(), {
|
|
18657
19213
|
kind: "mutation",
|
|
18658
19214
|
auth: "admin"
|
|
18659
|
-
});
|
|
18660
|
-
/**
|
|
18661
|
-
* `mqtt-broker` — broker-registry cap.
|
|
18662
|
-
*
|
|
18663
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
18664
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
18665
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
18666
|
-
* its OWN `mqtt.js` client.
|
|
18667
|
-
*
|
|
18668
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
18669
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
18670
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
18671
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
18672
|
-
* features anyway — give it the connection config, get out of the way.
|
|
18673
|
-
*
|
|
18674
|
-
* Consumer flow:
|
|
18675
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
18676
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
18677
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
18678
|
-
*
|
|
18679
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
18680
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
18681
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
18682
|
-
* spawned it.
|
|
18683
|
-
*/
|
|
18684
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
19215
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
18685
19216
|
/**
|
|
18686
|
-
*
|
|
19217
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
19218
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
19219
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
19220
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
19221
|
+
* (hub-placed); the cap stays open for future providers.
|
|
18687
19222
|
*
|
|
18688
|
-
*
|
|
18689
|
-
*
|
|
18690
|
-
*
|
|
18691
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
18692
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
19223
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
19224
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
19225
|
+
* write; a stored key NEVER round-trips to a client.
|
|
18693
19226
|
*/
|
|
18694
|
-
var
|
|
18695
|
-
"
|
|
18696
|
-
"
|
|
18697
|
-
"
|
|
18698
|
-
"
|
|
18699
|
-
"
|
|
19227
|
+
var LlmProfileKindSchema = _enum([
|
|
19228
|
+
"openai-compatible",
|
|
19229
|
+
"openai",
|
|
19230
|
+
"anthropic",
|
|
19231
|
+
"google",
|
|
19232
|
+
"managed-local"
|
|
18700
19233
|
]);
|
|
18701
|
-
var
|
|
19234
|
+
var LlmProfileSchema = object({
|
|
18702
19235
|
id: string(),
|
|
18703
19236
|
name: string(),
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
|
|
18707
|
-
|
|
18708
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
|
|
19237
|
+
kind: LlmProfileKindSchema,
|
|
19238
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
19239
|
+
addonId: string(),
|
|
19240
|
+
enabled: boolean(),
|
|
19241
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
19242
|
+
model: string(),
|
|
19243
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
19244
|
+
baseUrl: string().optional(),
|
|
19245
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
19246
|
+
apiKey: string().optional(),
|
|
19247
|
+
supportsVision: boolean(),
|
|
19248
|
+
temperature: number().min(0).max(2).optional(),
|
|
19249
|
+
maxTokens: number().int().positive().optional(),
|
|
19250
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
19251
|
+
extraHeaders: record(string(), string()).optional(),
|
|
19252
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
19253
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
18713
19254
|
});
|
|
18714
|
-
/**
|
|
18715
|
-
*
|
|
18716
|
-
*
|
|
18717
|
-
|
|
18718
|
-
|
|
18719
|
-
|
|
18720
|
-
|
|
18721
|
-
|
|
18722
|
-
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
18726
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
18727
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
18728
|
-
* broker).
|
|
18729
|
-
*/
|
|
18730
|
-
clientIdPrefix: string().optional()
|
|
19255
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
19256
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
19257
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
19258
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
19259
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
19260
|
+
kind: LlmProfileKindSchema,
|
|
19261
|
+
label: string(),
|
|
19262
|
+
icon: string(),
|
|
19263
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
19264
|
+
addonId: string(),
|
|
19265
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
18731
19266
|
});
|
|
18732
|
-
var
|
|
18733
|
-
|
|
18734
|
-
|
|
18735
|
-
|
|
18736
|
-
password: string().optional(),
|
|
18737
|
-
clientIdPrefix: string().optional()
|
|
19267
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
19268
|
+
var LlmDefaultSchema = object({
|
|
19269
|
+
selector: LlmDefaultSelectorSchema,
|
|
19270
|
+
profileId: string()
|
|
18738
19271
|
});
|
|
18739
|
-
|
|
18740
|
-
var
|
|
18741
|
-
|
|
18742
|
-
|
|
18743
|
-
|
|
18744
|
-
|
|
18745
|
-
|
|
18746
|
-
|
|
18747
|
-
|
|
18748
|
-
|
|
18749
|
-
|
|
18750
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
18751
|
-
allowAnonymous: boolean().default(false),
|
|
18752
|
-
/** Optional shared username/password for clients. */
|
|
18753
|
-
username: string().optional(),
|
|
18754
|
-
password: string().optional()
|
|
19272
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
19273
|
+
var LlmUsageRollupSchema = object({
|
|
19274
|
+
day: string(),
|
|
19275
|
+
consumer: string(),
|
|
19276
|
+
profileId: string(),
|
|
19277
|
+
calls: number(),
|
|
19278
|
+
okCalls: number(),
|
|
19279
|
+
errorCalls: number(),
|
|
19280
|
+
inputTokens: number(),
|
|
19281
|
+
outputTokens: number(),
|
|
19282
|
+
avgLatencyMs: number()
|
|
18755
19283
|
});
|
|
18756
|
-
|
|
19284
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
19285
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
18757
19286
|
id: string(),
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
|
|
18761
|
-
brokerCount: number(),
|
|
18762
|
-
embeddedRunning: boolean()
|
|
18763
|
-
});
|
|
18764
|
-
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);
|
|
18765
|
-
var NetworkEndpointSchema = object({
|
|
19287
|
+
label: string(),
|
|
19288
|
+
family: string(),
|
|
19289
|
+
purpose: _enum(["text", "vision"]),
|
|
18766
19290
|
url: string(),
|
|
18767
|
-
|
|
18768
|
-
|
|
18769
|
-
|
|
19291
|
+
sha256: string(),
|
|
19292
|
+
sizeBytes: number(),
|
|
19293
|
+
quantization: string(),
|
|
19294
|
+
/** Load-time guidance shown in the picker. */
|
|
19295
|
+
minRamBytes: number(),
|
|
19296
|
+
contextSizeDefault: number().int(),
|
|
19297
|
+
/** Vision models: companion projector file. */
|
|
19298
|
+
mmprojUrl: string().optional()
|
|
18770
19299
|
});
|
|
18771
|
-
var
|
|
18772
|
-
|
|
18773
|
-
|
|
19300
|
+
var LlmRuntimeNodeSchema = object({
|
|
19301
|
+
nodeId: string(),
|
|
19302
|
+
reachable: boolean(),
|
|
19303
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
19304
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
18774
19305
|
error: string().optional()
|
|
18775
19306
|
});
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18780
|
-
* the originating provider config (mode + sourcePort) so the
|
|
18781
|
-
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
18782
|
-
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
18783
|
-
*/
|
|
18784
|
-
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
18785
|
-
/**
|
|
18786
|
-
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
18787
|
-
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
18788
|
-
*/
|
|
18789
|
-
id: string(),
|
|
18790
|
-
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
18791
|
-
label: string(),
|
|
18792
|
-
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
18793
|
-
mode: string().optional(),
|
|
18794
|
-
/** Originating local port the ingress fronts (informational). */
|
|
18795
|
-
sourcePort: number().optional()
|
|
19307
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
19308
|
+
var ProfileRefInputSchema = object({
|
|
19309
|
+
addonId: string(),
|
|
19310
|
+
profileId: string()
|
|
18796
19311
|
});
|
|
18797
|
-
method(
|
|
18798
|
-
|
|
18799
|
-
|
|
18800
|
-
|
|
18801
|
-
|
|
18802
|
-
|
|
18803
|
-
|
|
18804
|
-
|
|
18805
|
-
|
|
18806
|
-
|
|
18807
|
-
|
|
18808
|
-
|
|
18809
|
-
|
|
18810
|
-
|
|
18811
|
-
|
|
18812
|
-
|
|
18813
|
-
|
|
18814
|
-
|
|
18815
|
-
|
|
18816
|
-
|
|
18817
|
-
|
|
18818
|
-
|
|
18819
|
-
|
|
18820
|
-
|
|
18821
|
-
|
|
18822
|
-
|
|
18823
|
-
|
|
18824
|
-
|
|
18825
|
-
|
|
18826
|
-
|
|
18827
|
-
|
|
18828
|
-
|
|
18829
|
-
|
|
18830
|
-
|
|
18831
|
-
|
|
18832
|
-
|
|
18833
|
-
|
|
18834
|
-
"
|
|
18835
|
-
|
|
18836
|
-
|
|
18837
|
-
"
|
|
18838
|
-
"
|
|
19312
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
19313
|
+
kind: "mutation",
|
|
19314
|
+
auth: "admin"
|
|
19315
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
19316
|
+
kind: "mutation",
|
|
19317
|
+
auth: "admin"
|
|
19318
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
19319
|
+
kind: "mutation",
|
|
19320
|
+
auth: "admin"
|
|
19321
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
19322
|
+
selector: LlmDefaultSelectorSchema,
|
|
19323
|
+
profileId: string().nullable()
|
|
19324
|
+
}), _void(), {
|
|
19325
|
+
kind: "mutation",
|
|
19326
|
+
auth: "admin"
|
|
19327
|
+
}), method(object({
|
|
19328
|
+
since: number().optional(),
|
|
19329
|
+
until: number().optional(),
|
|
19330
|
+
consumer: string().optional(),
|
|
19331
|
+
profileId: string().optional()
|
|
19332
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
19333
|
+
nodeId: string(),
|
|
19334
|
+
model: ManagedModelRefSchema
|
|
19335
|
+
}), _void(), {
|
|
19336
|
+
kind: "mutation",
|
|
19337
|
+
auth: "admin"
|
|
19338
|
+
}), method(object({
|
|
19339
|
+
nodeId: string(),
|
|
19340
|
+
file: string()
|
|
19341
|
+
}), _void(), {
|
|
19342
|
+
kind: "mutation",
|
|
19343
|
+
auth: "admin"
|
|
19344
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
19345
|
+
kind: "mutation",
|
|
19346
|
+
auth: "admin"
|
|
19347
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
19348
|
+
kind: "mutation",
|
|
19349
|
+
auth: "admin"
|
|
19350
|
+
});
|
|
19351
|
+
var LogLevelSchema = _enum([
|
|
19352
|
+
"debug",
|
|
19353
|
+
"info",
|
|
19354
|
+
"warn",
|
|
19355
|
+
"error"
|
|
18839
19356
|
]);
|
|
19357
|
+
var LogEntrySchema = object({
|
|
19358
|
+
timestamp: date(),
|
|
19359
|
+
level: LogLevelSchema,
|
|
19360
|
+
scope: array(string()),
|
|
19361
|
+
message: string(),
|
|
19362
|
+
meta: record(string(), unknown()).optional(),
|
|
19363
|
+
tags: record(string(), string()).optional()
|
|
19364
|
+
});
|
|
19365
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
19366
|
+
scope: array(string()).optional(),
|
|
19367
|
+
level: LogLevelSchema.optional(),
|
|
19368
|
+
since: date().optional(),
|
|
19369
|
+
until: date().optional(),
|
|
19370
|
+
limit: number().optional(),
|
|
19371
|
+
tags: record(string(), string()).optional()
|
|
19372
|
+
}), array(LogEntrySchema).readonly());
|
|
18840
19373
|
/**
|
|
18841
|
-
*
|
|
18842
|
-
*
|
|
18843
|
-
*
|
|
18844
|
-
*
|
|
19374
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
19375
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
19376
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
19377
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
19378
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
19379
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
19380
|
+
*
|
|
19381
|
+
* A contribution is a discriminated union on `kind`:
|
|
19382
|
+
*
|
|
19383
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
19384
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
19385
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
19386
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19387
|
+
* login page needs NO change.
|
|
19388
|
+
*
|
|
19389
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
19390
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
19391
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
19392
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
19393
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
19394
|
+
*
|
|
19395
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
19396
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
19397
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
19398
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
19399
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
19400
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
19401
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
19402
|
+
* decision.
|
|
19403
|
+
*
|
|
19404
|
+
* Every contribution carries a `stage`:
|
|
19405
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
19406
|
+
* magic-link buttons; a future usernameless passkey).
|
|
19407
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
19408
|
+
* returned `factors` (passkey-as-2FA today).
|
|
19409
|
+
*
|
|
19410
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
19411
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
19412
|
+
* tRPC router.
|
|
18845
19413
|
*/
|
|
18846
|
-
|
|
18847
|
-
|
|
18848
|
-
|
|
18849
|
-
|
|
18850
|
-
|
|
18851
|
-
|
|
18852
|
-
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
|
|
18856
|
-
|
|
19414
|
+
/** When a login method renders in the two-phase login flow. */
|
|
19415
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
19416
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
19417
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
19418
|
+
object({
|
|
19419
|
+
kind: literal("redirect"),
|
|
19420
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
19421
|
+
id: string(),
|
|
19422
|
+
/** Operator-facing button label. */
|
|
19423
|
+
label: string(),
|
|
19424
|
+
/** lucide-react icon name. */
|
|
19425
|
+
icon: string().optional(),
|
|
19426
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
19427
|
+
startUrl: string(),
|
|
19428
|
+
stage: LoginStageEnum
|
|
19429
|
+
}),
|
|
19430
|
+
object({
|
|
19431
|
+
kind: literal("widget"),
|
|
19432
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
19433
|
+
id: string(),
|
|
19434
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
19435
|
+
addonId: string(),
|
|
19436
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
19437
|
+
bundle: string(),
|
|
19438
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
19439
|
+
remote: WidgetRemoteSchema,
|
|
19440
|
+
stage: LoginStageEnum
|
|
19441
|
+
}),
|
|
19442
|
+
object({
|
|
19443
|
+
kind: literal("passkey"),
|
|
19444
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
19445
|
+
id: string(),
|
|
19446
|
+
/** Operator-facing button label. */
|
|
19447
|
+
label: string(),
|
|
19448
|
+
stage: LoginStageEnum,
|
|
19449
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
19450
|
+
rpId: string(),
|
|
19451
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
19452
|
+
origin: string().nullable()
|
|
19453
|
+
})
|
|
18857
19454
|
]);
|
|
18858
|
-
|
|
18859
|
-
var
|
|
18860
|
-
|
|
18861
|
-
|
|
18862
|
-
|
|
19455
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
19456
|
+
var CpuBreakdownSchema = object({
|
|
19457
|
+
total: number(),
|
|
19458
|
+
user: number(),
|
|
19459
|
+
system: number(),
|
|
19460
|
+
irq: number(),
|
|
19461
|
+
nice: number(),
|
|
19462
|
+
loadAvg: tuple([
|
|
19463
|
+
number(),
|
|
19464
|
+
number(),
|
|
19465
|
+
number()
|
|
19466
|
+
]),
|
|
19467
|
+
cores: number()
|
|
18863
19468
|
});
|
|
18864
|
-
|
|
18865
|
-
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
18872
|
-
var
|
|
18873
|
-
|
|
18874
|
-
|
|
18875
|
-
|
|
18876
|
-
|
|
18877
|
-
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
18881
|
-
|
|
18882
|
-
|
|
18883
|
-
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
|
|
19469
|
+
var MemoryInfoSchema = object({
|
|
19470
|
+
percent: number(),
|
|
19471
|
+
totalBytes: number(),
|
|
19472
|
+
usedBytes: number(),
|
|
19473
|
+
availableBytes: number(),
|
|
19474
|
+
swapUsedBytes: number(),
|
|
19475
|
+
swapTotalBytes: number()
|
|
19476
|
+
});
|
|
19477
|
+
var DiskIoSnapshotSchema = object({
|
|
19478
|
+
readBytes: number(),
|
|
19479
|
+
writeBytes: number(),
|
|
19480
|
+
readOps: number(),
|
|
19481
|
+
writeOps: number(),
|
|
19482
|
+
timestampMs: number()
|
|
19483
|
+
});
|
|
19484
|
+
var NetworkIoSnapshotSchema = object({
|
|
19485
|
+
rxBytes: number(),
|
|
19486
|
+
txBytes: number(),
|
|
19487
|
+
rxPackets: number(),
|
|
19488
|
+
txPackets: number(),
|
|
19489
|
+
rxErrors: number(),
|
|
19490
|
+
txErrors: number(),
|
|
19491
|
+
timestampMs: number()
|
|
19492
|
+
});
|
|
19493
|
+
var MetricsGpuInfoSchema = object({
|
|
19494
|
+
utilization: number(),
|
|
19495
|
+
model: string(),
|
|
19496
|
+
memoryUsedBytes: number(),
|
|
19497
|
+
memoryTotalBytes: number(),
|
|
19498
|
+
temperature: number().nullable()
|
|
19499
|
+
});
|
|
19500
|
+
var ProcessResourceInfoSchema = object({
|
|
19501
|
+
openFds: number(),
|
|
19502
|
+
threadCount: number(),
|
|
19503
|
+
activeHandles: number(),
|
|
19504
|
+
activeRequests: number()
|
|
18887
19505
|
});
|
|
18888
|
-
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
|
|
18892
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
18893
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
18894
|
-
flags: object({
|
|
18895
|
-
critical: boolean().optional(),
|
|
18896
|
-
silent: boolean().optional(),
|
|
18897
|
-
noPush: boolean().optional()
|
|
18898
|
-
}).optional(),
|
|
18899
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
18900
|
-
requires: array(string()).optional(),
|
|
18901
|
-
description: string().optional()
|
|
19506
|
+
var PressureAvgsSchema = object({
|
|
19507
|
+
avg10: number(),
|
|
19508
|
+
avg60: number(),
|
|
19509
|
+
avg300: number()
|
|
18902
19510
|
});
|
|
18903
|
-
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
19511
|
+
var PressureInfoSchema = object({
|
|
19512
|
+
some: PressureAvgsSchema,
|
|
19513
|
+
full: PressureAvgsSchema.nullable()
|
|
19514
|
+
});
|
|
19515
|
+
var SystemResourceSnapshotSchema = object({
|
|
19516
|
+
cpu: CpuBreakdownSchema,
|
|
19517
|
+
memory: MemoryInfoSchema,
|
|
19518
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
19519
|
+
network: NetworkIoSnapshotSchema,
|
|
19520
|
+
disk: DiskIoSnapshotSchema,
|
|
19521
|
+
pressure: object({
|
|
19522
|
+
cpu: PressureInfoSchema.nullable(),
|
|
19523
|
+
memory: PressureInfoSchema.nullable(),
|
|
19524
|
+
io: PressureInfoSchema.nullable()
|
|
18914
19525
|
}),
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
format: array(NotificationFormatSchema),
|
|
18919
|
-
clickUrl: boolean(),
|
|
18920
|
-
sound: boolean(),
|
|
18921
|
-
ttl: boolean(),
|
|
18922
|
-
bodyMaxLen: number().int().positive()
|
|
19526
|
+
process: ProcessResourceInfoSchema,
|
|
19527
|
+
cpuTemperature: number().nullable(),
|
|
19528
|
+
timestampMs: number()
|
|
18923
19529
|
});
|
|
18924
|
-
|
|
18925
|
-
|
|
18926
|
-
|
|
18927
|
-
|
|
18928
|
-
|
|
18929
|
-
|
|
18930
|
-
*/
|
|
18931
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
18932
|
-
var TargetKindSchema = object({
|
|
18933
|
-
kind: string(),
|
|
18934
|
-
label: string(),
|
|
18935
|
-
icon: string(),
|
|
18936
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
18937
|
-
addonId: string(),
|
|
18938
|
-
configSchema: ConfigSchemaPassthrough$1,
|
|
18939
|
-
supportsDiscovery: boolean(),
|
|
18940
|
-
caps: TargetKindCapsSchema
|
|
19530
|
+
var DiskSpaceInfoSchema = object({
|
|
19531
|
+
path: string(),
|
|
19532
|
+
totalBytes: number(),
|
|
19533
|
+
usedBytes: number(),
|
|
19534
|
+
availableBytes: number(),
|
|
19535
|
+
percent: number()
|
|
18941
19536
|
});
|
|
18942
|
-
|
|
18943
|
-
|
|
18944
|
-
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
|
|
18949
|
-
|
|
18950
|
-
|
|
19537
|
+
var PidResourceStatsSchema = object({
|
|
19538
|
+
pid: number(),
|
|
19539
|
+
cpu: number(),
|
|
19540
|
+
memory: number(),
|
|
19541
|
+
/**
|
|
19542
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
19543
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
19544
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
19545
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
19546
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
19547
|
+
*/
|
|
19548
|
+
privateBytes: number().optional(),
|
|
19549
|
+
/**
|
|
19550
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
19551
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
19552
|
+
*/
|
|
19553
|
+
sharedBytes: number().optional()
|
|
19554
|
+
});
|
|
19555
|
+
var AddonInstanceSchema = object({
|
|
18951
19556
|
addonId: string(),
|
|
18952
|
-
|
|
18953
|
-
|
|
19557
|
+
nodeId: string(),
|
|
19558
|
+
role: _enum(["hub", "worker"]),
|
|
19559
|
+
pid: number(),
|
|
19560
|
+
state: _enum([
|
|
19561
|
+
"starting",
|
|
19562
|
+
"running",
|
|
19563
|
+
"stopping",
|
|
19564
|
+
"stopped",
|
|
19565
|
+
"crashed"
|
|
19566
|
+
]),
|
|
19567
|
+
uptimeSec: number()
|
|
18954
19568
|
});
|
|
18955
|
-
|
|
18956
|
-
|
|
18957
|
-
|
|
18958
|
-
|
|
18959
|
-
|
|
19569
|
+
var NodeProcessSchema = object({
|
|
19570
|
+
pid: number(),
|
|
19571
|
+
ppid: number(),
|
|
19572
|
+
pgid: number(),
|
|
19573
|
+
classification: _enum([
|
|
19574
|
+
"root",
|
|
19575
|
+
"managed",
|
|
19576
|
+
"system",
|
|
19577
|
+
"ghost"
|
|
19578
|
+
]),
|
|
19579
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
19580
|
+
addonId: string().nullable(),
|
|
19581
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
19582
|
+
nodeId: string().nullable(),
|
|
19583
|
+
/** Truncated command line. */
|
|
19584
|
+
command: string(),
|
|
19585
|
+
cpuPercent: number(),
|
|
19586
|
+
memoryRssBytes: number(),
|
|
19587
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
19588
|
+
uptimeSec: number(),
|
|
19589
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
19590
|
+
orphaned: boolean()
|
|
18960
19591
|
});
|
|
18961
|
-
|
|
18962
|
-
|
|
18963
|
-
|
|
18964
|
-
|
|
18965
|
-
attachmentsSent: number().int().nonnegative(),
|
|
18966
|
-
actionsSent: number().int().nonnegative(),
|
|
18967
|
-
truncated: boolean(),
|
|
18968
|
-
dropped: array(string())
|
|
19592
|
+
var KillProcessInputSchema = object({
|
|
19593
|
+
pid: number(),
|
|
19594
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
19595
|
+
force: boolean().optional()
|
|
18969
19596
|
});
|
|
18970
|
-
var
|
|
19597
|
+
var KillProcessResultSchema = object({
|
|
19598
|
+
success: boolean(),
|
|
19599
|
+
reason: string().optional(),
|
|
19600
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
19601
|
+
});
|
|
19602
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
19603
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
19604
|
+
addonId: string() });
|
|
19605
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
18971
19606
|
success: boolean(),
|
|
19607
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
19608
|
+
path: string().optional(),
|
|
19609
|
+
/** Process pid that was signalled. */
|
|
19610
|
+
pid: number().optional(),
|
|
19611
|
+
reason: string().optional()
|
|
19612
|
+
});
|
|
19613
|
+
var SystemMetricsSchema = object({
|
|
19614
|
+
cpuPercent: number(),
|
|
19615
|
+
memoryPercent: number(),
|
|
19616
|
+
memoryUsedMB: number(),
|
|
19617
|
+
memoryTotalMB: number(),
|
|
19618
|
+
diskPercent: number().optional(),
|
|
19619
|
+
temperature: number().optional(),
|
|
19620
|
+
gpuPercent: number().optional(),
|
|
19621
|
+
gpuMemoryPercent: number().optional()
|
|
19622
|
+
});
|
|
19623
|
+
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, {
|
|
19624
|
+
kind: "mutation",
|
|
19625
|
+
auth: "admin"
|
|
19626
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
19627
|
+
kind: "mutation",
|
|
19628
|
+
auth: "admin"
|
|
19629
|
+
});
|
|
19630
|
+
method(object({
|
|
19631
|
+
sourceUrl: string(),
|
|
19632
|
+
metadata: ModelConvertMetadataSchema,
|
|
19633
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
19634
|
+
calibrationRef: string().optional(),
|
|
19635
|
+
sessionId: string().optional()
|
|
19636
|
+
}), ConvertResultSchema, {
|
|
19637
|
+
kind: "mutation",
|
|
19638
|
+
auth: "admin",
|
|
19639
|
+
timeoutMs: 6e5
|
|
19640
|
+
});
|
|
19641
|
+
method(object({
|
|
19642
|
+
nodeId: string(),
|
|
19643
|
+
modelId: string(),
|
|
19644
|
+
format: _enum(MODEL_FORMATS),
|
|
19645
|
+
entry: ModelCatalogEntrySchema
|
|
19646
|
+
}), object({
|
|
19647
|
+
ok: boolean(),
|
|
19648
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
19649
|
+
sha256: string(),
|
|
19650
|
+
bytes: number(),
|
|
19651
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
19652
|
+
path: string()
|
|
19653
|
+
}), {
|
|
19654
|
+
kind: "mutation",
|
|
19655
|
+
auth: "admin"
|
|
19656
|
+
});
|
|
19657
|
+
/**
|
|
19658
|
+
* `mqtt-broker` — broker-registry cap.
|
|
19659
|
+
*
|
|
19660
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
19661
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
19662
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
19663
|
+
* its OWN `mqtt.js` client.
|
|
19664
|
+
*
|
|
19665
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
19666
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
19667
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
19668
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
19669
|
+
* features anyway — give it the connection config, get out of the way.
|
|
19670
|
+
*
|
|
19671
|
+
* Consumer flow:
|
|
19672
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
19673
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
19674
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
19675
|
+
*
|
|
19676
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
19677
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
19678
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
19679
|
+
* spawned it.
|
|
19680
|
+
*/
|
|
19681
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
19682
|
+
/**
|
|
19683
|
+
* Broker live-probe status.
|
|
19684
|
+
*
|
|
19685
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
19686
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
19687
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
19688
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
19689
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
19690
|
+
*/
|
|
19691
|
+
var BrokerStatusSchema$1 = _enum([
|
|
19692
|
+
"connected",
|
|
19693
|
+
"disconnected",
|
|
19694
|
+
"auth-failed",
|
|
19695
|
+
"unreachable",
|
|
19696
|
+
"tls-error"
|
|
19697
|
+
]);
|
|
19698
|
+
var BrokerInfoSchema = object({
|
|
19699
|
+
id: string(),
|
|
19700
|
+
name: string(),
|
|
19701
|
+
url: string(),
|
|
19702
|
+
kind: BrokerKindSchema,
|
|
19703
|
+
status: BrokerStatusSchema$1,
|
|
19704
|
+
latencyMs: number().nullable(),
|
|
18972
19705
|
error: string().optional(),
|
|
18973
|
-
|
|
19706
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
19707
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
19708
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
19709
|
+
lastCheckedAt: number().optional()
|
|
18974
19710
|
});
|
|
18975
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
18976
|
-
var TestResultSchema = SendResultSchema;
|
|
18977
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
18978
|
-
kind: string(),
|
|
18979
|
-
config: record(string(), unknown()).optional()
|
|
18980
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
18981
|
-
targetId: string(),
|
|
18982
|
-
notification: NotificationSchema
|
|
18983
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
18984
|
-
targetId: string(),
|
|
18985
|
-
sample: NotificationSchema.optional()
|
|
18986
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
18987
|
-
targetId: string(),
|
|
18988
|
-
enabled: boolean()
|
|
18989
|
-
}), _void(), { kind: "mutation" });
|
|
18990
19711
|
/**
|
|
18991
|
-
*
|
|
18992
|
-
*
|
|
18993
|
-
*
|
|
18994
|
-
*
|
|
18995
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
18996
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
18997
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
19712
|
+
* Connection details — what a consumer needs to call
|
|
19713
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
19714
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
19715
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
18998
19716
|
*/
|
|
18999
|
-
var
|
|
19000
|
-
|
|
19001
|
-
|
|
19717
|
+
var BrokerConnectionDetailsSchema = object({
|
|
19718
|
+
url: string(),
|
|
19719
|
+
username: string().optional(),
|
|
19720
|
+
password: string().optional(),
|
|
19721
|
+
/**
|
|
19722
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
19723
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
19724
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
19725
|
+
* broker).
|
|
19726
|
+
*/
|
|
19727
|
+
clientIdPrefix: string().optional()
|
|
19002
19728
|
});
|
|
19003
|
-
var
|
|
19004
|
-
|
|
19005
|
-
"
|
|
19006
|
-
|
|
19007
|
-
|
|
19008
|
-
|
|
19009
|
-
|
|
19010
|
-
|
|
19011
|
-
|
|
19012
|
-
|
|
19013
|
-
]);
|
|
19014
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
19729
|
+
var AddBrokerInputSchema = object({
|
|
19730
|
+
name: string().min(1),
|
|
19731
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
19732
|
+
username: string().optional(),
|
|
19733
|
+
password: string().optional(),
|
|
19734
|
+
clientIdPrefix: string().optional()
|
|
19735
|
+
});
|
|
19736
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
19737
|
+
var IdInputSchema = object({ id: string() });
|
|
19738
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
19015
19739
|
ok: literal(true),
|
|
19016
|
-
text: string(),
|
|
19017
|
-
model: string(),
|
|
19018
|
-
usage: LlmUsageSchema,
|
|
19019
|
-
truncated: boolean(),
|
|
19020
19740
|
latencyMs: number()
|
|
19021
19741
|
}), object({
|
|
19022
19742
|
ok: literal(false),
|
|
19023
|
-
|
|
19024
|
-
message: string(),
|
|
19025
|
-
retryAfterMs: number().optional()
|
|
19743
|
+
error: string()
|
|
19026
19744
|
})]);
|
|
19027
|
-
|
|
19028
|
-
|
|
19029
|
-
|
|
19030
|
-
|
|
19031
|
-
*/
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
mimeType: string()
|
|
19745
|
+
var StartEmbeddedInputSchema = object({
|
|
19746
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
19747
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
19748
|
+
allowAnonymous: boolean().default(false),
|
|
19749
|
+
/** Optional shared username/password for clients. */
|
|
19750
|
+
username: string().optional(),
|
|
19751
|
+
password: string().optional()
|
|
19035
19752
|
});
|
|
19036
|
-
var
|
|
19037
|
-
|
|
19038
|
-
|
|
19039
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
19040
|
-
profileId: string().optional(),
|
|
19041
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
19042
|
-
consumer: string(),
|
|
19043
|
-
system: string().optional(),
|
|
19044
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
19045
|
-
prompt: string(),
|
|
19046
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
19047
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
19048
|
-
/** Per-call override of the profile default. */
|
|
19049
|
-
maxTokens: number().int().positive().optional(),
|
|
19050
|
-
temperature: number().optional()
|
|
19753
|
+
var StartEmbeddedResultSchema = object({
|
|
19754
|
+
id: string(),
|
|
19755
|
+
url: string()
|
|
19051
19756
|
});
|
|
19052
|
-
|
|
19053
|
-
|
|
19054
|
-
|
|
19055
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
19056
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
19057
|
-
* this only through the `llm` cap's methods.
|
|
19058
|
-
*
|
|
19059
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
19060
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
19061
|
-
* watchdog — operator decision #3).
|
|
19062
|
-
*/
|
|
19063
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
19064
|
-
object({
|
|
19065
|
-
kind: literal("catalog"),
|
|
19066
|
-
catalogId: string()
|
|
19067
|
-
}),
|
|
19068
|
-
object({
|
|
19069
|
-
kind: literal("url"),
|
|
19070
|
-
url: string(),
|
|
19071
|
-
sha256: string().optional()
|
|
19072
|
-
}),
|
|
19073
|
-
object({
|
|
19074
|
-
kind: literal("path"),
|
|
19075
|
-
path: string()
|
|
19076
|
-
})
|
|
19077
|
-
]);
|
|
19078
|
-
var ManagedRuntimeConfigSchema = object({
|
|
19079
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
19080
|
-
nodeId: string(),
|
|
19081
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
19082
|
-
engine: _enum(["llama-cpp"]),
|
|
19083
|
-
model: ManagedModelRefSchema,
|
|
19084
|
-
contextSize: number().int().default(4096),
|
|
19085
|
-
/** 0 = CPU-only. */
|
|
19086
|
-
gpuLayers: number().int().default(0),
|
|
19087
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
19088
|
-
threads: number().int().optional(),
|
|
19089
|
-
/** Concurrent slots. */
|
|
19090
|
-
parallel: number().int().default(1),
|
|
19091
|
-
/** Else lazy: first generate boots it. */
|
|
19092
|
-
autoStart: boolean().default(false),
|
|
19093
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
19094
|
-
idleStopMinutes: number().int().default(30)
|
|
19757
|
+
var StatusSchema = object({
|
|
19758
|
+
brokerCount: number(),
|
|
19759
|
+
embeddedRunning: boolean()
|
|
19095
19760
|
});
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
"starting",
|
|
19103
|
-
"ready",
|
|
19104
|
-
"crashed",
|
|
19105
|
-
"failed"
|
|
19106
|
-
]),
|
|
19107
|
-
pid: number().optional(),
|
|
19108
|
-
port: number().optional(),
|
|
19109
|
-
modelPath: string().optional(),
|
|
19110
|
-
modelId: string().optional(),
|
|
19111
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
19112
|
-
lastError: string().optional(),
|
|
19113
|
-
crashesInWindow: number(),
|
|
19114
|
-
/** Child RSS (sampled best-effort). */
|
|
19115
|
-
memoryBytes: number().optional(),
|
|
19116
|
-
vramBytes: number().optional()
|
|
19761
|
+
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);
|
|
19762
|
+
var NetworkEndpointSchema = object({
|
|
19763
|
+
url: string(),
|
|
19764
|
+
hostname: string(),
|
|
19765
|
+
port: number(),
|
|
19766
|
+
protocol: _enum(["http", "https"])
|
|
19117
19767
|
});
|
|
19118
|
-
var
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
installedAt: number().optional()
|
|
19768
|
+
var NetworkAccessStatusSchema = object({
|
|
19769
|
+
connected: boolean(),
|
|
19770
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
19771
|
+
error: string().optional()
|
|
19123
19772
|
});
|
|
19124
|
-
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19773
|
+
/**
|
|
19774
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
19775
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
19776
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
19777
|
+
* the originating provider config (mode + sourcePort) so the
|
|
19778
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
19779
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
19780
|
+
*/
|
|
19781
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
19782
|
+
/**
|
|
19783
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
19784
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
19785
|
+
*/
|
|
19786
|
+
id: string(),
|
|
19787
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
19788
|
+
label: string(),
|
|
19789
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
19790
|
+
mode: string().optional(),
|
|
19791
|
+
/** Originating local port the ingress fronts (informational). */
|
|
19792
|
+
sourcePort: number().optional()
|
|
19128
19793
|
});
|
|
19129
|
-
method(
|
|
19130
|
-
images: array(LlmImageSchema).optional(),
|
|
19131
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
19132
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
19133
|
-
timeoutMs: number().int().positive().optional()
|
|
19134
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
19135
|
-
kind: "mutation",
|
|
19136
|
-
auth: "admin"
|
|
19137
|
-
}), method(object({}), _void(), {
|
|
19138
|
-
kind: "mutation",
|
|
19139
|
-
auth: "admin"
|
|
19140
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
19141
|
-
kind: "mutation",
|
|
19142
|
-
auth: "admin"
|
|
19143
|
-
}), method(object({ file: string() }), _void(), {
|
|
19144
|
-
kind: "mutation",
|
|
19145
|
-
auth: "admin"
|
|
19146
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
19794
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
19147
19795
|
/**
|
|
19148
|
-
*
|
|
19149
|
-
*
|
|
19150
|
-
*
|
|
19151
|
-
*
|
|
19152
|
-
*
|
|
19796
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
19797
|
+
*
|
|
19798
|
+
* Apprise-derived model (see
|
|
19799
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
19800
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
19801
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
19802
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
19803
|
+
* message to what the kind supports — callers never special-case a service.
|
|
19804
|
+
*
|
|
19805
|
+
* DESIGN DECISIONS (locked):
|
|
19806
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
19807
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
19808
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
19809
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
19810
|
+
* alternative would fork the UI per addon and cannot host the
|
|
19811
|
+
* discovery→adopt flow.
|
|
19812
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
19813
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
19814
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
19815
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
19816
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
19817
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
19818
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
19819
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
19820
|
+
* base64 fallback needed.
|
|
19153
19821
|
*
|
|
19154
|
-
*
|
|
19155
|
-
* `
|
|
19156
|
-
*
|
|
19822
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
19823
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
19824
|
+
* admin "Integrations" page.
|
|
19157
19825
|
*/
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
"
|
|
19826
|
+
/**
|
|
19827
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
19828
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
19829
|
+
*/
|
|
19830
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
19831
|
+
"image",
|
|
19832
|
+
"video",
|
|
19833
|
+
"gif",
|
|
19834
|
+
"audio",
|
|
19835
|
+
"icon"
|
|
19164
19836
|
]);
|
|
19165
|
-
|
|
19837
|
+
/**
|
|
19838
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
19839
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
19840
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
19841
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
19842
|
+
*/
|
|
19843
|
+
var AttachmentSchema = object({
|
|
19844
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
19845
|
+
url: string().optional(),
|
|
19846
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
19847
|
+
mime: string().optional(),
|
|
19848
|
+
name: string().optional()
|
|
19849
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
19850
|
+
var NotificationFormatSchema = _enum([
|
|
19851
|
+
"text",
|
|
19852
|
+
"markdown",
|
|
19853
|
+
"html"
|
|
19854
|
+
]);
|
|
19855
|
+
/** A single tap-through action button. */
|
|
19856
|
+
var NotificationActionSchema = object({
|
|
19166
19857
|
id: string(),
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
19170
|
-
addonId: string(),
|
|
19171
|
-
enabled: boolean(),
|
|
19172
|
-
/** Vendor model id, or the managed runtime's loaded model. */
|
|
19173
|
-
model: string(),
|
|
19174
|
-
/** Required for openai-compatible; override for cloud kinds. */
|
|
19175
|
-
baseUrl: string().optional(),
|
|
19176
|
-
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
19177
|
-
apiKey: string().optional(),
|
|
19178
|
-
supportsVision: boolean(),
|
|
19179
|
-
temperature: number().min(0).max(2).optional(),
|
|
19180
|
-
maxTokens: number().int().positive().optional(),
|
|
19181
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
19182
|
-
extraHeaders: record(string(), string()).optional(),
|
|
19183
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
19184
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
19858
|
+
label: string(),
|
|
19859
|
+
url: string().optional()
|
|
19185
19860
|
});
|
|
19186
|
-
/**
|
|
19187
|
-
*
|
|
19188
|
-
*
|
|
19861
|
+
/**
|
|
19862
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
19863
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
19864
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
19865
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
19866
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
19867
|
+
* `priority` for that one target.
|
|
19868
|
+
*/
|
|
19869
|
+
var NotificationSchema = object({
|
|
19870
|
+
body: string(),
|
|
19871
|
+
title: string().optional(),
|
|
19872
|
+
format: NotificationFormatSchema.default("text"),
|
|
19873
|
+
priority: number().int().min(1).max(5).default(3),
|
|
19874
|
+
level: string().optional(),
|
|
19875
|
+
attachments: array(AttachmentSchema).optional(),
|
|
19876
|
+
clickUrl: string().optional(),
|
|
19877
|
+
actions: array(NotificationActionSchema).optional(),
|
|
19878
|
+
sound: string().optional(),
|
|
19879
|
+
ttl: number().optional(),
|
|
19880
|
+
tag: string().optional(),
|
|
19881
|
+
deviceId: number().optional(),
|
|
19882
|
+
eventId: string().optional(),
|
|
19883
|
+
metadata: record(string(), unknown()).optional()
|
|
19884
|
+
});
|
|
19885
|
+
/** One declared native severity/priority level for a kind. */
|
|
19886
|
+
var TargetKindLevelSchema = object({
|
|
19887
|
+
id: string(),
|
|
19888
|
+
label: string(),
|
|
19889
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
19890
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
19891
|
+
flags: object({
|
|
19892
|
+
critical: boolean().optional(),
|
|
19893
|
+
silent: boolean().optional(),
|
|
19894
|
+
noPush: boolean().optional()
|
|
19895
|
+
}).optional(),
|
|
19896
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
19897
|
+
requires: array(string()).optional(),
|
|
19898
|
+
description: string().optional()
|
|
19899
|
+
});
|
|
19900
|
+
/** The full capability block consulted before dispatch. */
|
|
19901
|
+
var TargetKindCapsSchema = object({
|
|
19902
|
+
attachments: object({
|
|
19903
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
19904
|
+
mode: _enum([
|
|
19905
|
+
"url",
|
|
19906
|
+
"bytes",
|
|
19907
|
+
"both"
|
|
19908
|
+
]),
|
|
19909
|
+
max: number().int().nonnegative(),
|
|
19910
|
+
maxBytes: number().int().positive().optional()
|
|
19911
|
+
}),
|
|
19912
|
+
/** Max action buttons (0 = none). */
|
|
19913
|
+
actions: number().int().nonnegative(),
|
|
19914
|
+
levels: array(TargetKindLevelSchema),
|
|
19915
|
+
format: array(NotificationFormatSchema),
|
|
19916
|
+
clickUrl: boolean(),
|
|
19917
|
+
sound: boolean(),
|
|
19918
|
+
ttl: boolean(),
|
|
19919
|
+
bodyMaxLen: number().int().positive()
|
|
19920
|
+
});
|
|
19921
|
+
/**
|
|
19922
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
19923
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
19924
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
19925
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
19926
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
19927
|
+
*/
|
|
19189
19928
|
var ConfigSchemaPassthrough = unknown();
|
|
19190
|
-
var
|
|
19191
|
-
kind:
|
|
19929
|
+
var TargetKindSchema = object({
|
|
19930
|
+
kind: string(),
|
|
19192
19931
|
label: string(),
|
|
19193
19932
|
icon: string(),
|
|
19194
19933
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
19195
19934
|
addonId: string(),
|
|
19196
|
-
configSchema: ConfigSchemaPassthrough
|
|
19197
|
-
|
|
19198
|
-
|
|
19199
|
-
var LlmDefaultSchema = object({
|
|
19200
|
-
selector: LlmDefaultSelectorSchema,
|
|
19201
|
-
profileId: string()
|
|
19202
|
-
});
|
|
19203
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
19204
|
-
var LlmUsageRollupSchema = object({
|
|
19205
|
-
day: string(),
|
|
19206
|
-
consumer: string(),
|
|
19207
|
-
profileId: string(),
|
|
19208
|
-
calls: number(),
|
|
19209
|
-
okCalls: number(),
|
|
19210
|
-
errorCalls: number(),
|
|
19211
|
-
inputTokens: number(),
|
|
19212
|
-
outputTokens: number(),
|
|
19213
|
-
avgLatencyMs: number()
|
|
19935
|
+
configSchema: ConfigSchemaPassthrough,
|
|
19936
|
+
supportsDiscovery: boolean(),
|
|
19937
|
+
caps: TargetKindCapsSchema
|
|
19214
19938
|
});
|
|
19215
|
-
/**
|
|
19216
|
-
|
|
19939
|
+
/**
|
|
19940
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
19941
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
19942
|
+
* round-trip a stored secret to the UI.
|
|
19943
|
+
*/
|
|
19944
|
+
var TargetSchema = object({
|
|
19217
19945
|
id: string(),
|
|
19218
|
-
|
|
19219
|
-
|
|
19220
|
-
purpose: _enum(["text", "vision"]),
|
|
19221
|
-
url: string(),
|
|
19222
|
-
sha256: string(),
|
|
19223
|
-
sizeBytes: number(),
|
|
19224
|
-
quantization: string(),
|
|
19225
|
-
/** Load-time guidance shown in the picker. */
|
|
19226
|
-
minRamBytes: number(),
|
|
19227
|
-
contextSizeDefault: number().int(),
|
|
19228
|
-
/** Vision models: companion projector file. */
|
|
19229
|
-
mmprojUrl: string().optional()
|
|
19230
|
-
});
|
|
19231
|
-
var LlmRuntimeNodeSchema = object({
|
|
19232
|
-
nodeId: string(),
|
|
19233
|
-
reachable: boolean(),
|
|
19234
|
-
status: LlmRuntimeStatusSchema.optional(),
|
|
19235
|
-
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
19236
|
-
error: string().optional()
|
|
19237
|
-
});
|
|
19238
|
-
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
19239
|
-
var ProfileRefInputSchema = object({
|
|
19946
|
+
name: string(),
|
|
19947
|
+
kind: string(),
|
|
19240
19948
|
addonId: string(),
|
|
19241
|
-
|
|
19949
|
+
enabled: boolean(),
|
|
19950
|
+
config: record(string(), unknown())
|
|
19242
19951
|
});
|
|
19243
|
-
|
|
19244
|
-
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
|
|
19248
|
-
|
|
19249
|
-
|
|
19250
|
-
|
|
19251
|
-
|
|
19252
|
-
|
|
19253
|
-
|
|
19254
|
-
|
|
19255
|
-
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
profileId: string().optional()
|
|
19263
|
-
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
19264
|
-
nodeId: string(),
|
|
19265
|
-
model: ManagedModelRefSchema
|
|
19266
|
-
}), _void(), {
|
|
19267
|
-
kind: "mutation",
|
|
19268
|
-
auth: "admin"
|
|
19269
|
-
}), method(object({
|
|
19270
|
-
nodeId: string(),
|
|
19271
|
-
file: string()
|
|
19272
|
-
}), _void(), {
|
|
19273
|
-
kind: "mutation",
|
|
19274
|
-
auth: "admin"
|
|
19275
|
-
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
19276
|
-
kind: "mutation",
|
|
19277
|
-
auth: "admin"
|
|
19278
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
19279
|
-
kind: "mutation",
|
|
19280
|
-
auth: "admin"
|
|
19952
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
19953
|
+
var DiscoveredTargetSchema = object({
|
|
19954
|
+
kind: string(),
|
|
19955
|
+
suggestedName: string(),
|
|
19956
|
+
config: record(string(), unknown())
|
|
19957
|
+
});
|
|
19958
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
19959
|
+
var RenderedAsSchema = object({
|
|
19960
|
+
level: string(),
|
|
19961
|
+
format: NotificationFormatSchema,
|
|
19962
|
+
attachmentsSent: number().int().nonnegative(),
|
|
19963
|
+
actionsSent: number().int().nonnegative(),
|
|
19964
|
+
truncated: boolean(),
|
|
19965
|
+
dropped: array(string())
|
|
19966
|
+
});
|
|
19967
|
+
var SendResultSchema = object({
|
|
19968
|
+
success: boolean(),
|
|
19969
|
+
error: string().optional(),
|
|
19970
|
+
renderedAs: RenderedAsSchema.optional()
|
|
19281
19971
|
});
|
|
19972
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
19973
|
+
var TestResultSchema = SendResultSchema;
|
|
19974
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
19975
|
+
kind: string(),
|
|
19976
|
+
config: record(string(), unknown()).optional()
|
|
19977
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
19978
|
+
targetId: string(),
|
|
19979
|
+
notification: NotificationSchema
|
|
19980
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
19981
|
+
targetId: string(),
|
|
19982
|
+
sample: NotificationSchema.optional()
|
|
19983
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
19984
|
+
targetId: string(),
|
|
19985
|
+
enabled: boolean()
|
|
19986
|
+
}), _void(), { kind: "mutation" });
|
|
19282
19987
|
/**
|
|
19283
19988
|
* Zod schemas for persisted record types.
|
|
19284
19989
|
*
|
|
@@ -19964,7 +20669,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
19964
20669
|
}), method(object({
|
|
19965
20670
|
eventId: string(),
|
|
19966
20671
|
kind: MediaFileKindEnum.optional()
|
|
19967
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
20672
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
20673
|
+
trackId: string(),
|
|
20674
|
+
kinds: array(MediaFileKindEnum).optional()
|
|
20675
|
+
}), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
|
|
19968
20676
|
deviceId: number(),
|
|
19969
20677
|
timestamp: number(),
|
|
19970
20678
|
frameWidth: number(),
|
|
@@ -19985,76 +20693,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
19985
20693
|
eventId: string(),
|
|
19986
20694
|
timestamp: number()
|
|
19987
20695
|
});
|
|
19988
|
-
/**
|
|
19989
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
19990
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
19991
|
-
* caps into per-camera event-kind descriptors.
|
|
19992
|
-
*
|
|
19993
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
19994
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
19995
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
19996
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
19997
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
19998
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
19999
|
-
* eventful cap is missing.
|
|
20000
|
-
*/
|
|
20001
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
20002
|
-
var LEGACY_ICON = {
|
|
20003
|
-
motion: "motion",
|
|
20004
|
-
audio: "audio",
|
|
20005
|
-
person: "person",
|
|
20006
|
-
vehicle: "vehicle",
|
|
20007
|
-
animal: "animal",
|
|
20008
|
-
package: "package",
|
|
20009
|
-
door: "door",
|
|
20010
|
-
pir: "pir",
|
|
20011
|
-
smoke: "smoke",
|
|
20012
|
-
water: "water",
|
|
20013
|
-
button: "button",
|
|
20014
|
-
generic: "generic",
|
|
20015
|
-
gas: "smoke",
|
|
20016
|
-
vibration: "generic",
|
|
20017
|
-
tamper: "generic",
|
|
20018
|
-
presence: "person",
|
|
20019
|
-
lock: "generic",
|
|
20020
|
-
siren: "generic",
|
|
20021
|
-
switch: "generic",
|
|
20022
|
-
doorbell: "button"
|
|
20023
|
-
};
|
|
20024
|
-
function legacyIcon(iconId) {
|
|
20025
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
20026
|
-
}
|
|
20027
|
-
/**
|
|
20028
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
20029
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
20030
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
20031
|
-
*/
|
|
20032
|
-
var CAP_TO_KIND = {
|
|
20033
|
-
contact: "contact",
|
|
20034
|
-
motion: "motion-sensor",
|
|
20035
|
-
smoke: "smoke",
|
|
20036
|
-
flood: "flood",
|
|
20037
|
-
gas: "gas",
|
|
20038
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
20039
|
-
vibration: "vibration",
|
|
20040
|
-
tamper: "tamper",
|
|
20041
|
-
presence: "presence",
|
|
20042
|
-
"enum-sensor": "enum-sensor",
|
|
20043
|
-
"event-emitter": "device-event",
|
|
20044
|
-
"lock-control": "lock",
|
|
20045
|
-
switch: "switch",
|
|
20046
|
-
button: "button",
|
|
20047
|
-
doorbell: "doorbell"
|
|
20048
|
-
};
|
|
20049
|
-
function buildDescriptor(capName, kind) {
|
|
20050
|
-
const t = EVENT_TAXONOMY[kind];
|
|
20051
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
20052
|
-
return {
|
|
20053
|
-
...t,
|
|
20054
|
-
icon: legacyIcon(t.iconId)
|
|
20055
|
-
};
|
|
20056
|
-
}
|
|
20057
|
-
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
20058
20696
|
var CameraPipelineConfigSchema = object({
|
|
20059
20697
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
20060
20698
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -20540,6 +21178,76 @@ method(object({
|
|
|
20540
21178
|
auth: "admin"
|
|
20541
21179
|
});
|
|
20542
21180
|
/**
|
|
21181
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
21182
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
21183
|
+
* caps into per-camera event-kind descriptors.
|
|
21184
|
+
*
|
|
21185
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
21186
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
21187
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
21188
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
21189
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
21190
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
21191
|
+
* eventful cap is missing.
|
|
21192
|
+
*/
|
|
21193
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
21194
|
+
var LEGACY_ICON = {
|
|
21195
|
+
motion: "motion",
|
|
21196
|
+
audio: "audio",
|
|
21197
|
+
person: "person",
|
|
21198
|
+
vehicle: "vehicle",
|
|
21199
|
+
animal: "animal",
|
|
21200
|
+
package: "package",
|
|
21201
|
+
door: "door",
|
|
21202
|
+
pir: "pir",
|
|
21203
|
+
smoke: "smoke",
|
|
21204
|
+
water: "water",
|
|
21205
|
+
button: "button",
|
|
21206
|
+
generic: "generic",
|
|
21207
|
+
gas: "smoke",
|
|
21208
|
+
vibration: "generic",
|
|
21209
|
+
tamper: "generic",
|
|
21210
|
+
presence: "person",
|
|
21211
|
+
lock: "generic",
|
|
21212
|
+
siren: "generic",
|
|
21213
|
+
switch: "generic",
|
|
21214
|
+
doorbell: "button"
|
|
21215
|
+
};
|
|
21216
|
+
function legacyIcon(iconId) {
|
|
21217
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
21218
|
+
}
|
|
21219
|
+
/**
|
|
21220
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
21221
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
21222
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
21223
|
+
*/
|
|
21224
|
+
var CAP_TO_KIND = {
|
|
21225
|
+
contact: "contact",
|
|
21226
|
+
motion: "motion-sensor",
|
|
21227
|
+
smoke: "smoke",
|
|
21228
|
+
flood: "flood",
|
|
21229
|
+
gas: "gas",
|
|
21230
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
21231
|
+
vibration: "vibration",
|
|
21232
|
+
tamper: "tamper",
|
|
21233
|
+
presence: "presence",
|
|
21234
|
+
"enum-sensor": "enum-sensor",
|
|
21235
|
+
"event-emitter": "device-event",
|
|
21236
|
+
"lock-control": "lock",
|
|
21237
|
+
switch: "switch",
|
|
21238
|
+
button: "button",
|
|
21239
|
+
doorbell: "doorbell"
|
|
21240
|
+
};
|
|
21241
|
+
function buildDescriptor(capName, kind) {
|
|
21242
|
+
const t = EVENT_TAXONOMY[kind];
|
|
21243
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
21244
|
+
return {
|
|
21245
|
+
...t,
|
|
21246
|
+
icon: legacyIcon(t.iconId)
|
|
21247
|
+
};
|
|
21248
|
+
}
|
|
21249
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
21250
|
+
/**
|
|
20543
21251
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
20544
21252
|
* package lifecycle (runtime-updatable node packages).
|
|
20545
21253
|
*
|
|
@@ -22011,7 +22719,28 @@ var FaceInfoSchema = object({
|
|
|
22011
22719
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
22012
22720
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
22013
22721
|
* back to the inline `base64` face crop. */
|
|
22014
|
-
keyFrameMediaKey: string().optional()
|
|
22722
|
+
keyFrameMediaKey: string().optional(),
|
|
22723
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
22724
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
22725
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
22726
|
+
* faces that were never auto-recognized. */
|
|
22727
|
+
bestMatchScore: number().optional(),
|
|
22728
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
22729
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
22730
|
+
* legacy rows / runners that reported no native measure. */
|
|
22731
|
+
nativeFaceShortSidePx: number().optional(),
|
|
22732
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
22733
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
22734
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
22735
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
22736
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
22737
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
22738
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
22739
|
+
suggestedIdentityId: string().optional(),
|
|
22740
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
22741
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
22742
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
22743
|
+
suggestedMatchScore: number().optional()
|
|
22015
22744
|
});
|
|
22016
22745
|
var FaceFilterEnum = _enum([
|
|
22017
22746
|
"unassigned",
|
|
@@ -24054,36 +24783,6 @@ Object.freeze({
|
|
|
24054
24783
|
addonId: null,
|
|
24055
24784
|
access: "view"
|
|
24056
24785
|
},
|
|
24057
|
-
"advancedNotifier.deleteRule": {
|
|
24058
|
-
capName: "advanced-notifier",
|
|
24059
|
-
capScope: "system",
|
|
24060
|
-
addonId: null,
|
|
24061
|
-
access: "delete"
|
|
24062
|
-
},
|
|
24063
|
-
"advancedNotifier.getHistory": {
|
|
24064
|
-
capName: "advanced-notifier",
|
|
24065
|
-
capScope: "system",
|
|
24066
|
-
addonId: null,
|
|
24067
|
-
access: "view"
|
|
24068
|
-
},
|
|
24069
|
-
"advancedNotifier.getRules": {
|
|
24070
|
-
capName: "advanced-notifier",
|
|
24071
|
-
capScope: "system",
|
|
24072
|
-
addonId: null,
|
|
24073
|
-
access: "view"
|
|
24074
|
-
},
|
|
24075
|
-
"advancedNotifier.testRule": {
|
|
24076
|
-
capName: "advanced-notifier",
|
|
24077
|
-
capScope: "system",
|
|
24078
|
-
addonId: null,
|
|
24079
|
-
access: "create"
|
|
24080
|
-
},
|
|
24081
|
-
"advancedNotifier.upsertRule": {
|
|
24082
|
-
capName: "advanced-notifier",
|
|
24083
|
-
capScope: "system",
|
|
24084
|
-
addonId: null,
|
|
24085
|
-
access: "create"
|
|
24086
|
-
},
|
|
24087
24786
|
"alarmPanel.arm": {
|
|
24088
24787
|
capName: "alarm-panel",
|
|
24089
24788
|
capScope: "device",
|
|
@@ -24306,6 +25005,12 @@ Object.freeze({
|
|
|
24306
25005
|
addonId: null,
|
|
24307
25006
|
access: "delete"
|
|
24308
25007
|
},
|
|
25008
|
+
"backup.deleteSchedule": {
|
|
25009
|
+
capName: "backup",
|
|
25010
|
+
capScope: "system",
|
|
25011
|
+
addonId: null,
|
|
25012
|
+
access: "delete"
|
|
25013
|
+
},
|
|
24309
25014
|
"backup.getEntries": {
|
|
24310
25015
|
capName: "backup",
|
|
24311
25016
|
capScope: "system",
|
|
@@ -24336,6 +25041,12 @@ Object.freeze({
|
|
|
24336
25041
|
addonId: null,
|
|
24337
25042
|
access: "view"
|
|
24338
25043
|
},
|
|
25044
|
+
"backup.listSchedules": {
|
|
25045
|
+
capName: "backup",
|
|
25046
|
+
capScope: "system",
|
|
25047
|
+
addonId: null,
|
|
25048
|
+
access: "view"
|
|
25049
|
+
},
|
|
24339
25050
|
"backup.previewSchedule": {
|
|
24340
25051
|
capName: "backup",
|
|
24341
25052
|
capScope: "system",
|
|
@@ -24360,6 +25071,12 @@ Object.freeze({
|
|
|
24360
25071
|
addonId: null,
|
|
24361
25072
|
access: "create"
|
|
24362
25073
|
},
|
|
25074
|
+
"backup.upsertSchedule": {
|
|
25075
|
+
capName: "backup",
|
|
25076
|
+
capScope: "system",
|
|
25077
|
+
addonId: null,
|
|
25078
|
+
access: "create"
|
|
25079
|
+
},
|
|
24363
25080
|
"battery.wakeForStream": {
|
|
24364
25081
|
capName: "battery",
|
|
24365
25082
|
capScope: "device",
|
|
@@ -26388,6 +27105,60 @@ Object.freeze({
|
|
|
26388
27105
|
addonId: null,
|
|
26389
27106
|
access: "create"
|
|
26390
27107
|
},
|
|
27108
|
+
"notificationRules.createRule": {
|
|
27109
|
+
capName: "notification-rules",
|
|
27110
|
+
capScope: "system",
|
|
27111
|
+
addonId: null,
|
|
27112
|
+
access: "create"
|
|
27113
|
+
},
|
|
27114
|
+
"notificationRules.deleteRule": {
|
|
27115
|
+
capName: "notification-rules",
|
|
27116
|
+
capScope: "system",
|
|
27117
|
+
addonId: null,
|
|
27118
|
+
access: "delete"
|
|
27119
|
+
},
|
|
27120
|
+
"notificationRules.getConditionCatalog": {
|
|
27121
|
+
capName: "notification-rules",
|
|
27122
|
+
capScope: "system",
|
|
27123
|
+
addonId: null,
|
|
27124
|
+
access: "view"
|
|
27125
|
+
},
|
|
27126
|
+
"notificationRules.getHistory": {
|
|
27127
|
+
capName: "notification-rules",
|
|
27128
|
+
capScope: "system",
|
|
27129
|
+
addonId: null,
|
|
27130
|
+
access: "view"
|
|
27131
|
+
},
|
|
27132
|
+
"notificationRules.getRule": {
|
|
27133
|
+
capName: "notification-rules",
|
|
27134
|
+
capScope: "system",
|
|
27135
|
+
addonId: null,
|
|
27136
|
+
access: "view"
|
|
27137
|
+
},
|
|
27138
|
+
"notificationRules.listRules": {
|
|
27139
|
+
capName: "notification-rules",
|
|
27140
|
+
capScope: "system",
|
|
27141
|
+
addonId: null,
|
|
27142
|
+
access: "view"
|
|
27143
|
+
},
|
|
27144
|
+
"notificationRules.setRuleEnabled": {
|
|
27145
|
+
capName: "notification-rules",
|
|
27146
|
+
capScope: "system",
|
|
27147
|
+
addonId: null,
|
|
27148
|
+
access: "create"
|
|
27149
|
+
},
|
|
27150
|
+
"notificationRules.testRule": {
|
|
27151
|
+
capName: "notification-rules",
|
|
27152
|
+
capScope: "system",
|
|
27153
|
+
addonId: null,
|
|
27154
|
+
access: "create"
|
|
27155
|
+
},
|
|
27156
|
+
"notificationRules.updateRule": {
|
|
27157
|
+
capName: "notification-rules",
|
|
27158
|
+
capScope: "system",
|
|
27159
|
+
addonId: null,
|
|
27160
|
+
access: "create"
|
|
27161
|
+
},
|
|
26391
27162
|
"notifier.cancel": {
|
|
26392
27163
|
capName: "notifier",
|
|
26393
27164
|
capScope: "device",
|
|
@@ -28140,6 +28911,36 @@ Object.freeze({
|
|
|
28140
28911
|
addonId: null,
|
|
28141
28912
|
access: "create"
|
|
28142
28913
|
},
|
|
28914
|
+
"terminalSession.close": {
|
|
28915
|
+
capName: "terminal-session",
|
|
28916
|
+
capScope: "system",
|
|
28917
|
+
addonId: null,
|
|
28918
|
+
access: "create"
|
|
28919
|
+
},
|
|
28920
|
+
"terminalSession.listProfiles": {
|
|
28921
|
+
capName: "terminal-session",
|
|
28922
|
+
capScope: "system",
|
|
28923
|
+
addonId: null,
|
|
28924
|
+
access: "view"
|
|
28925
|
+
},
|
|
28926
|
+
"terminalSession.listSessions": {
|
|
28927
|
+
capName: "terminal-session",
|
|
28928
|
+
capScope: "system",
|
|
28929
|
+
addonId: null,
|
|
28930
|
+
access: "view"
|
|
28931
|
+
},
|
|
28932
|
+
"terminalSession.openSession": {
|
|
28933
|
+
capName: "terminal-session",
|
|
28934
|
+
capScope: "system",
|
|
28935
|
+
addonId: null,
|
|
28936
|
+
access: "create"
|
|
28937
|
+
},
|
|
28938
|
+
"terminalSession.resize": {
|
|
28939
|
+
capName: "terminal-session",
|
|
28940
|
+
capScope: "system",
|
|
28941
|
+
addonId: null,
|
|
28942
|
+
access: "create"
|
|
28943
|
+
},
|
|
28143
28944
|
"toast.onToast": {
|
|
28144
28945
|
capName: "toast",
|
|
28145
28946
|
capScope: "system",
|