@camstack/addon-mqtt-broker 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mqtt-broker.addon.js +1802 -1001
- package/dist/mqtt-broker.addon.mjs +1802 -1001
- package/package.json +1 -1
|
@@ -39,7 +39,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
39
39
|
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
40
40
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
41
41
|
//#endregion
|
|
42
|
-
//#region ../types/dist/event-category-
|
|
42
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
43
43
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
44
44
|
EventCategory["SystemBoot"] = "system.boot";
|
|
45
45
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -189,9 +189,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
189
189
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
190
190
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
191
191
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
192
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
193
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
194
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
195
192
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
196
193
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
197
194
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -6856,7 +6853,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
|
6856
6853
|
patch: record(string(), unknown())
|
|
6857
6854
|
}), object({ success: literal(true) });
|
|
6858
6855
|
object({ deviceId: number() }), unknown().nullable();
|
|
6859
|
-
/** Shorthand to define a method schema */
|
|
6860
6856
|
function method(input, output, options) {
|
|
6861
6857
|
return {
|
|
6862
6858
|
input,
|
|
@@ -6864,6 +6860,7 @@ function method(input, output, options) {
|
|
|
6864
6860
|
kind: options?.kind ?? "query",
|
|
6865
6861
|
auth: options?.auth ?? "protected",
|
|
6866
6862
|
...options?.access !== void 0 ? { access: options.access } : {},
|
|
6863
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
6867
6864
|
timeoutMs: options?.timeoutMs
|
|
6868
6865
|
};
|
|
6869
6866
|
}
|
|
@@ -7545,16 +7542,23 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7545
7542
|
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7546
7543
|
* FRESH install:
|
|
7547
7544
|
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7548
|
-
* the appData volume. Right for small/durable data (
|
|
7545
|
+
* the appData volume. Right for small/durable data (logs, models).
|
|
7549
7546
|
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7550
7547
|
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7551
7548
|
* (recordings, event media) that should stay off the appData disk.
|
|
7549
|
+
* - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
|
|
7550
|
+
* `/backups` in the image) so archives live on their own mount rather than
|
|
7551
|
+
* filling the appData disk. Falls back to the data root when unset.
|
|
7552
7552
|
*
|
|
7553
7553
|
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7554
7554
|
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7555
7555
|
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7556
7556
|
*/
|
|
7557
|
-
defaultRoot: _enum([
|
|
7557
|
+
defaultRoot: _enum([
|
|
7558
|
+
"data",
|
|
7559
|
+
"media",
|
|
7560
|
+
"backup"
|
|
7561
|
+
]).optional()
|
|
7558
7562
|
});
|
|
7559
7563
|
var DecoderStatsSchema = object({
|
|
7560
7564
|
inputFps: number(),
|
|
@@ -8217,6 +8221,59 @@ for (const l of AUDIO_MACRO_LABELS) {
|
|
|
8217
8221
|
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8218
8222
|
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8219
8223
|
/**
|
|
8224
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8225
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8226
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8227
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8228
|
+
*
|
|
8229
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8230
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8231
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8232
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8233
|
+
* the same class picker, grouped under an Audio header.
|
|
8234
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8235
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8236
|
+
*
|
|
8237
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8238
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8239
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8240
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8241
|
+
*/
|
|
8242
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8243
|
+
var NcTaxonomyEntrySchema = object({
|
|
8244
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8245
|
+
kind: string(),
|
|
8246
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8247
|
+
label: string(),
|
|
8248
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8249
|
+
parentKind: string().nullable()
|
|
8250
|
+
});
|
|
8251
|
+
object({
|
|
8252
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8253
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8254
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8255
|
+
});
|
|
8256
|
+
function toEntry(kind, label, parentKind) {
|
|
8257
|
+
return {
|
|
8258
|
+
kind,
|
|
8259
|
+
label,
|
|
8260
|
+
parentKind
|
|
8261
|
+
};
|
|
8262
|
+
}
|
|
8263
|
+
/**
|
|
8264
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8265
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8266
|
+
*/
|
|
8267
|
+
function buildNcTaxonomy() {
|
|
8268
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8269
|
+
return {
|
|
8270
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8271
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8272
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8273
|
+
};
|
|
8274
|
+
}
|
|
8275
|
+
Object.freeze(buildNcTaxonomy());
|
|
8276
|
+
/**
|
|
8220
8277
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8221
8278
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8222
8279
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -8852,6 +8909,644 @@ var AccessoryKind = {
|
|
|
8852
8909
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
8853
8910
|
DeviceFeature.BatteryOperated;
|
|
8854
8911
|
/**
|
|
8912
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
8913
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
8914
|
+
* language so a single drawing-plane editor and the providers stay
|
|
8915
|
+
* decoupled from each cap's storage.
|
|
8916
|
+
*
|
|
8917
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
8918
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
8919
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
8920
|
+
*/
|
|
8921
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
8922
|
+
var MaskPointSchema = object({
|
|
8923
|
+
x: number(),
|
|
8924
|
+
y: number()
|
|
8925
|
+
});
|
|
8926
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
8927
|
+
var MaskRectShapeSchema = object({
|
|
8928
|
+
kind: literal("rect"),
|
|
8929
|
+
x: number(),
|
|
8930
|
+
y: number(),
|
|
8931
|
+
width: number(),
|
|
8932
|
+
height: number()
|
|
8933
|
+
});
|
|
8934
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
8935
|
+
var MaskPolygonShapeSchema = object({
|
|
8936
|
+
kind: literal("polygon"),
|
|
8937
|
+
points: array(MaskPointSchema)
|
|
8938
|
+
});
|
|
8939
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
8940
|
+
var MaskGridShapeSchema = object({
|
|
8941
|
+
kind: literal("grid"),
|
|
8942
|
+
gridWidth: number(),
|
|
8943
|
+
gridHeight: number(),
|
|
8944
|
+
cells: array(boolean())
|
|
8945
|
+
});
|
|
8946
|
+
discriminatedUnion("kind", [
|
|
8947
|
+
MaskRectShapeSchema,
|
|
8948
|
+
MaskPolygonShapeSchema,
|
|
8949
|
+
MaskGridShapeSchema,
|
|
8950
|
+
object({
|
|
8951
|
+
kind: literal("line"),
|
|
8952
|
+
points: array(MaskPointSchema)
|
|
8953
|
+
})
|
|
8954
|
+
]);
|
|
8955
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
8956
|
+
var MaskShapeKindSchema = _enum([
|
|
8957
|
+
"rect",
|
|
8958
|
+
"polygon",
|
|
8959
|
+
"grid",
|
|
8960
|
+
"line"
|
|
8961
|
+
]);
|
|
8962
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
8963
|
+
var MaskPolygonVerticesSchema = object({
|
|
8964
|
+
min: number(),
|
|
8965
|
+
max: number()
|
|
8966
|
+
});
|
|
8967
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
8968
|
+
var MaskGridDimsSchema = object({
|
|
8969
|
+
width: number(),
|
|
8970
|
+
height: number()
|
|
8971
|
+
});
|
|
8972
|
+
/**
|
|
8973
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
8974
|
+
*
|
|
8975
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
8976
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
8977
|
+
*
|
|
8978
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
8979
|
+
* `notification-center` module), hooked on the durable persistence
|
|
8980
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
8981
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
8982
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
8983
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
8984
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
8985
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
8986
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
8987
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
8988
|
+
* target kind's own caps/degrade engine).
|
|
8989
|
+
*
|
|
8990
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
8991
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
8992
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
8993
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
8994
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
8995
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
8996
|
+
* P2+ (see spec §7).
|
|
8997
|
+
*
|
|
8998
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
8999
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
9000
|
+
* schema/interface drift is explicitly not repeated).
|
|
9001
|
+
*/
|
|
9002
|
+
/**
|
|
9003
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
9004
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
9005
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
9006
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
9007
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
9008
|
+
* change of a LINKED device, one row per linked camera)
|
|
9009
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
9010
|
+
* delivery / pick-up)
|
|
9011
|
+
*
|
|
9012
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
9013
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
9014
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
9015
|
+
* one trigger.
|
|
9016
|
+
*/
|
|
9017
|
+
var NcDeliverySchema = _enum([
|
|
9018
|
+
"immediate",
|
|
9019
|
+
"track-end",
|
|
9020
|
+
"device-event",
|
|
9021
|
+
"package-event"
|
|
9022
|
+
]);
|
|
9023
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
9024
|
+
var NcScheduleSchema = object({
|
|
9025
|
+
windows: array(object({
|
|
9026
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
9027
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
9028
|
+
startMinute: number().int().min(0).max(1439),
|
|
9029
|
+
endMinute: number().int().min(0).max(1439)
|
|
9030
|
+
})).min(1),
|
|
9031
|
+
/** IANA timezone; default = hub host timezone. */
|
|
9032
|
+
timezone: string().optional(),
|
|
9033
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
9034
|
+
invert: boolean().optional()
|
|
9035
|
+
});
|
|
9036
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
9037
|
+
var NcPlateMatcherSchema = object({
|
|
9038
|
+
values: array(string().min(1)).min(1),
|
|
9039
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9040
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9041
|
+
});
|
|
9042
|
+
/**
|
|
9043
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9044
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9045
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9046
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9047
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9048
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9049
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9050
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9051
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9052
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9053
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9054
|
+
*/
|
|
9055
|
+
var NcOccupancyConditionSchema = object({
|
|
9056
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9057
|
+
zoneId: string().optional(),
|
|
9058
|
+
/** Object class to count; absent = any class. */
|
|
9059
|
+
className: string().optional(),
|
|
9060
|
+
op: _enum([
|
|
9061
|
+
"became-occupied",
|
|
9062
|
+
"became-free",
|
|
9063
|
+
">=",
|
|
9064
|
+
"<="
|
|
9065
|
+
]).default("became-occupied"),
|
|
9066
|
+
count: number().int().min(0).default(1),
|
|
9067
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9068
|
+
});
|
|
9069
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9070
|
+
var NcZoneConditionSchema = object({
|
|
9071
|
+
ids: array(string().min(1)).min(1),
|
|
9072
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9073
|
+
match: _enum(["any", "all"]).default("any")
|
|
9074
|
+
});
|
|
9075
|
+
/**
|
|
9076
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9077
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9078
|
+
*/
|
|
9079
|
+
var NcConditionsSchema = object({
|
|
9080
|
+
/** Device scope — absent = all devices. */
|
|
9081
|
+
devices: array(number()).optional(),
|
|
9082
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9083
|
+
classes: array(string().min(1)).optional(),
|
|
9084
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9085
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9086
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9087
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9088
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9089
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9090
|
+
/** Veto zones — any hit fails the rule. */
|
|
9091
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
9092
|
+
/**
|
|
9093
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9094
|
+
* (identity name / plate text / subclass).
|
|
9095
|
+
*/
|
|
9096
|
+
labelEquals: array(string().min(1)).optional(),
|
|
9097
|
+
/**
|
|
9098
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9099
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9100
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
9101
|
+
*/
|
|
9102
|
+
identities: array(string().min(1)).optional(),
|
|
9103
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9104
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
9105
|
+
/**
|
|
9106
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9107
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9108
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9109
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
9110
|
+
*/
|
|
9111
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
9112
|
+
/**
|
|
9113
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9114
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9115
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9116
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9117
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9118
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9119
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9120
|
+
*/
|
|
9121
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9122
|
+
/**
|
|
9123
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9124
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9125
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9126
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9127
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9128
|
+
*/
|
|
9129
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9130
|
+
/**
|
|
9131
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9132
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9133
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9134
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9135
|
+
* tracks carry `sensor`.
|
|
9136
|
+
*/
|
|
9137
|
+
source: _enum([
|
|
9138
|
+
"pipeline",
|
|
9139
|
+
"onboard",
|
|
9140
|
+
"sensor",
|
|
9141
|
+
"any"
|
|
9142
|
+
]).optional(),
|
|
9143
|
+
/**
|
|
9144
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9145
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9146
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9147
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9148
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9149
|
+
*
|
|
9150
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9151
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9152
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9153
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9154
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9155
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9156
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9157
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9158
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9159
|
+
* closed for it (an un-recognized subject).
|
|
9160
|
+
*/
|
|
9161
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9162
|
+
/**
|
|
9163
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9164
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9165
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9166
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9167
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9168
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9169
|
+
*/
|
|
9170
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9171
|
+
/**
|
|
9172
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9173
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9174
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9175
|
+
*/
|
|
9176
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9177
|
+
/**
|
|
9178
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9179
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9180
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9181
|
+
* on the package-event trigger).
|
|
9182
|
+
*/
|
|
9183
|
+
packagePhase: _enum([
|
|
9184
|
+
"delivered",
|
|
9185
|
+
"picked-up",
|
|
9186
|
+
"both"
|
|
9187
|
+
]).optional(),
|
|
9188
|
+
/**
|
|
9189
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9190
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9191
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9192
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9193
|
+
*/
|
|
9194
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9195
|
+
/**
|
|
9196
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9197
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9198
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9199
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9200
|
+
*/
|
|
9201
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9202
|
+
});
|
|
9203
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9204
|
+
var NcRuleTargetSchema = object({
|
|
9205
|
+
/** `notification-output` Target id. */
|
|
9206
|
+
targetId: string().min(1),
|
|
9207
|
+
/**
|
|
9208
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9209
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9210
|
+
* degrade engine drops what the backend can't render.
|
|
9211
|
+
*/
|
|
9212
|
+
params: record(string(), unknown()).optional()
|
|
9213
|
+
});
|
|
9214
|
+
/**
|
|
9215
|
+
* Media attachment policy (P1 still-image subset).
|
|
9216
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9217
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9218
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9219
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9220
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9221
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9222
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9223
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9224
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9225
|
+
* - `none` — no attachment.
|
|
9226
|
+
*/
|
|
9227
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9228
|
+
"best",
|
|
9229
|
+
"best-matching",
|
|
9230
|
+
"keyFrame",
|
|
9231
|
+
"none"
|
|
9232
|
+
]).default("best") });
|
|
9233
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9234
|
+
var NcThrottleSchema = object({
|
|
9235
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9236
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9237
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9238
|
+
});
|
|
9239
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9240
|
+
var NcRuleInputSchema = object({
|
|
9241
|
+
name: string().min(1).max(200),
|
|
9242
|
+
enabled: boolean().default(true),
|
|
9243
|
+
delivery: NcDeliverySchema,
|
|
9244
|
+
conditions: NcConditionsSchema.default({}),
|
|
9245
|
+
schedule: NcScheduleSchema.optional(),
|
|
9246
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9247
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9248
|
+
throttle: NcThrottleSchema.default({
|
|
9249
|
+
cooldownSec: 60,
|
|
9250
|
+
scope: "rule-device"
|
|
9251
|
+
}),
|
|
9252
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9253
|
+
template: object({
|
|
9254
|
+
title: string().max(500).optional(),
|
|
9255
|
+
body: string().max(2e3).optional()
|
|
9256
|
+
}).optional(),
|
|
9257
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9258
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9259
|
+
/**
|
|
9260
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9261
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9262
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9263
|
+
*/
|
|
9264
|
+
ownerUserId: string().optional()
|
|
9265
|
+
});
|
|
9266
|
+
/**
|
|
9267
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9268
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9269
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9270
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9271
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9272
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9273
|
+
* `updateRule` patch.
|
|
9274
|
+
*/
|
|
9275
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9276
|
+
/** A persisted rule. */
|
|
9277
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9278
|
+
id: string(),
|
|
9279
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9280
|
+
createdBy: string(),
|
|
9281
|
+
createdAt: number(),
|
|
9282
|
+
updatedAt: number(),
|
|
9283
|
+
/**
|
|
9284
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9285
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9286
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9287
|
+
*/
|
|
9288
|
+
disabledTargetIds: array(string()).default([])
|
|
9289
|
+
});
|
|
9290
|
+
var NcTestResultSchema = object({
|
|
9291
|
+
recordId: string(),
|
|
9292
|
+
recordKind: _enum([
|
|
9293
|
+
"object-event",
|
|
9294
|
+
"track",
|
|
9295
|
+
"device-event",
|
|
9296
|
+
"package-event"
|
|
9297
|
+
]),
|
|
9298
|
+
deviceId: number(),
|
|
9299
|
+
timestamp: number(),
|
|
9300
|
+
wouldFire: boolean(),
|
|
9301
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9302
|
+
failedCondition: string().optional(),
|
|
9303
|
+
className: string().optional(),
|
|
9304
|
+
label: string().optional()
|
|
9305
|
+
});
|
|
9306
|
+
var NcConditionDescriptorSchema = object({
|
|
9307
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9308
|
+
id: string(),
|
|
9309
|
+
group: _enum([
|
|
9310
|
+
"scope",
|
|
9311
|
+
"class",
|
|
9312
|
+
"zones",
|
|
9313
|
+
"quality",
|
|
9314
|
+
"label",
|
|
9315
|
+
"schedule",
|
|
9316
|
+
"device",
|
|
9317
|
+
"package",
|
|
9318
|
+
"occupancy"
|
|
9319
|
+
]),
|
|
9320
|
+
label: string(),
|
|
9321
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9322
|
+
valueType: _enum([
|
|
9323
|
+
"deviceIdList",
|
|
9324
|
+
"stringList",
|
|
9325
|
+
"number01",
|
|
9326
|
+
"number",
|
|
9327
|
+
"sourceSelect",
|
|
9328
|
+
"zoneSelection",
|
|
9329
|
+
"zoneIdList",
|
|
9330
|
+
"schedule",
|
|
9331
|
+
"plateMatcher",
|
|
9332
|
+
"packagePhase",
|
|
9333
|
+
"polygonDraw",
|
|
9334
|
+
"occupancy"
|
|
9335
|
+
]),
|
|
9336
|
+
operator: _enum([
|
|
9337
|
+
"in",
|
|
9338
|
+
"notIn",
|
|
9339
|
+
"anyOf",
|
|
9340
|
+
"allOf",
|
|
9341
|
+
"gte",
|
|
9342
|
+
"fuzzyIn",
|
|
9343
|
+
"withinSchedule"
|
|
9344
|
+
]),
|
|
9345
|
+
/** Which delivery kinds the condition applies to. */
|
|
9346
|
+
appliesTo: array(NcDeliverySchema),
|
|
9347
|
+
phase: string(),
|
|
9348
|
+
description: string().optional()
|
|
9349
|
+
});
|
|
9350
|
+
/**
|
|
9351
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9352
|
+
* durable outbox row's own status (single source of truth):
|
|
9353
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9354
|
+
* - `sent` — delivered (terminal)
|
|
9355
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9356
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9357
|
+
* the failure `error`)
|
|
9358
|
+
*
|
|
9359
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9360
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9361
|
+
*/
|
|
9362
|
+
var NcHistoryStatusSchema = _enum([
|
|
9363
|
+
"pending",
|
|
9364
|
+
"sent",
|
|
9365
|
+
"dead"
|
|
9366
|
+
]);
|
|
9367
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9368
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9369
|
+
"object-event",
|
|
9370
|
+
"track-end",
|
|
9371
|
+
"device-event",
|
|
9372
|
+
"package-event"
|
|
9373
|
+
]);
|
|
9374
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9375
|
+
var NcHistorySubjectSchema = object({
|
|
9376
|
+
className: string(),
|
|
9377
|
+
label: string().optional(),
|
|
9378
|
+
confidence: number().optional(),
|
|
9379
|
+
zones: array(string()),
|
|
9380
|
+
timestamp: number()
|
|
9381
|
+
});
|
|
9382
|
+
/**
|
|
9383
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9384
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9385
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9386
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9387
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9388
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9389
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9390
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9391
|
+
* P1 (admin scope only).
|
|
9392
|
+
*/
|
|
9393
|
+
var NcHistoryEntrySchema = object({
|
|
9394
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9395
|
+
id: string(),
|
|
9396
|
+
ruleId: string(),
|
|
9397
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9398
|
+
ruleName: string(),
|
|
9399
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9400
|
+
delivery: NcDeliverySchema,
|
|
9401
|
+
targetId: string(),
|
|
9402
|
+
deviceId: number(),
|
|
9403
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9404
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9405
|
+
recordId: string(),
|
|
9406
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9407
|
+
trackId: string().optional(),
|
|
9408
|
+
status: NcHistoryStatusSchema,
|
|
9409
|
+
/** Delivery attempts made so far. */
|
|
9410
|
+
attempts: number().int(),
|
|
9411
|
+
/** Fire time (outbox enqueue). */
|
|
9412
|
+
createdAt: number(),
|
|
9413
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9414
|
+
updatedAt: number(),
|
|
9415
|
+
/** Failure detail — present on a `dead` row. */
|
|
9416
|
+
error: string().optional(),
|
|
9417
|
+
subject: NcHistorySubjectSchema
|
|
9418
|
+
});
|
|
9419
|
+
/**
|
|
9420
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9421
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9422
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9423
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9424
|
+
*/
|
|
9425
|
+
var NcHistoryFilterSchema = object({
|
|
9426
|
+
ruleId: string().optional(),
|
|
9427
|
+
deviceId: number().optional(),
|
|
9428
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9429
|
+
since: number().optional(),
|
|
9430
|
+
until: number().optional(),
|
|
9431
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9432
|
+
});
|
|
9433
|
+
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 }), {
|
|
9434
|
+
kind: "mutation",
|
|
9435
|
+
auth: "admin",
|
|
9436
|
+
caller: "required"
|
|
9437
|
+
}), method(object({
|
|
9438
|
+
ruleId: string(),
|
|
9439
|
+
patch: NcRulePatchSchema
|
|
9440
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9441
|
+
kind: "mutation",
|
|
9442
|
+
auth: "admin",
|
|
9443
|
+
caller: "required"
|
|
9444
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9445
|
+
kind: "mutation",
|
|
9446
|
+
auth: "admin"
|
|
9447
|
+
}), method(object({
|
|
9448
|
+
ruleId: string(),
|
|
9449
|
+
enabled: boolean()
|
|
9450
|
+
}), object({ success: literal(true) }), {
|
|
9451
|
+
kind: "mutation",
|
|
9452
|
+
auth: "admin"
|
|
9453
|
+
}), method(object({
|
|
9454
|
+
rule: NcRuleInputSchema,
|
|
9455
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9456
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9457
|
+
kind: "mutation",
|
|
9458
|
+
auth: "admin"
|
|
9459
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9460
|
+
/**
|
|
9461
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9462
|
+
*
|
|
9463
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
9464
|
+
* §3.2/§3.3.
|
|
9465
|
+
*
|
|
9466
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
9467
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
9468
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
9469
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
9470
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
9471
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
9472
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
9473
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
9474
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
9475
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
9476
|
+
*
|
|
9477
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
9478
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
9479
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
9480
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
9481
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
9482
|
+
*/
|
|
9483
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
9484
|
+
var TimelapseTemplateSchema = object({
|
|
9485
|
+
title: string().max(500).optional(),
|
|
9486
|
+
body: string().max(2e3).optional()
|
|
9487
|
+
});
|
|
9488
|
+
var NameField = string().min(1).max(200);
|
|
9489
|
+
var DeviceIdsField = array(number()).min(1);
|
|
9490
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
9491
|
+
var FramerateField = number().int().min(1).max(60);
|
|
9492
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
9493
|
+
var PriorityField = number().int().min(1).max(5);
|
|
9494
|
+
/**
|
|
9495
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
9496
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
9497
|
+
* here (see the ownership note above).
|
|
9498
|
+
*/
|
|
9499
|
+
var TimelapseRuleInputSchema = object({
|
|
9500
|
+
name: NameField,
|
|
9501
|
+
enabled: boolean().default(true),
|
|
9502
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
9503
|
+
deviceIds: DeviceIdsField,
|
|
9504
|
+
/**
|
|
9505
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
9506
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
9507
|
+
* open clears the scratch, close assembles and delivers.
|
|
9508
|
+
*/
|
|
9509
|
+
schedule: NcScheduleSchema,
|
|
9510
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
9511
|
+
cadenceSec: CadenceSecField.default(15),
|
|
9512
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
9513
|
+
framerate: FramerateField.default(10),
|
|
9514
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
9515
|
+
targets: TargetsField,
|
|
9516
|
+
template: TimelapseTemplateSchema.optional(),
|
|
9517
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9518
|
+
priority: PriorityField.default(3)
|
|
9519
|
+
});
|
|
9520
|
+
object({
|
|
9521
|
+
name: NameField.optional(),
|
|
9522
|
+
enabled: boolean().optional(),
|
|
9523
|
+
deviceIds: DeviceIdsField.optional(),
|
|
9524
|
+
schedule: NcScheduleSchema.optional(),
|
|
9525
|
+
cadenceSec: CadenceSecField.optional(),
|
|
9526
|
+
framerate: FramerateField.optional(),
|
|
9527
|
+
targets: TargetsField.optional(),
|
|
9528
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
9529
|
+
priority: PriorityField.optional()
|
|
9530
|
+
});
|
|
9531
|
+
TimelapseRuleInputSchema.extend({
|
|
9532
|
+
id: string(),
|
|
9533
|
+
/**
|
|
9534
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
9535
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
9536
|
+
* resolved caller; never trusted from a client payload.
|
|
9537
|
+
*/
|
|
9538
|
+
ownerUserId: string().optional(),
|
|
9539
|
+
/**
|
|
9540
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
9541
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
9542
|
+
*/
|
|
9543
|
+
lastGeneratedAt: number().optional(),
|
|
9544
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
9545
|
+
createdBy: string(),
|
|
9546
|
+
createdAt: number(),
|
|
9547
|
+
updatedAt: number()
|
|
9548
|
+
});
|
|
9549
|
+
/**
|
|
8855
9550
|
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
8856
9551
|
* for every device, regardless of provider — the kernel needs a uniform
|
|
8857
9552
|
* cap-keyed slice for the basic device flags every consumer expects to
|
|
@@ -10925,6 +11620,22 @@ var CameraMetricsSchema = object({
|
|
|
10925
11620
|
])
|
|
10926
11621
|
});
|
|
10927
11622
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
11623
|
+
/**
|
|
11624
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
11625
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
11626
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
11627
|
+
*/
|
|
11628
|
+
var NativeCropRefSchema = object({
|
|
11629
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
11630
|
+
handle: FrameHandleSchema,
|
|
11631
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
11632
|
+
cropFrameSpace: object({
|
|
11633
|
+
x: number(),
|
|
11634
|
+
y: number(),
|
|
11635
|
+
w: number(),
|
|
11636
|
+
h: number()
|
|
11637
|
+
})
|
|
11638
|
+
});
|
|
10928
11639
|
var ModelFormatSchema$1 = _enum([
|
|
10929
11640
|
"onnx",
|
|
10930
11641
|
"coreml",
|
|
@@ -11200,7 +11911,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
11200
11911
|
* Omitted ⇒ the runner's default device (current single-engine
|
|
11201
11912
|
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
11202
11913
|
*/
|
|
11203
|
-
deviceKey: string().optional()
|
|
11914
|
+
deviceKey: string().optional(),
|
|
11915
|
+
/**
|
|
11916
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
11917
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
11918
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
11919
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
11920
|
+
* resolution from that surface — the SAME quality path faces already
|
|
11921
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
11922
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
11923
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
11924
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
11925
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
11926
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
11927
|
+
* (today's behaviour on the fallback path).
|
|
11928
|
+
*/
|
|
11929
|
+
nativeCropRef: NativeCropRefSchema.optional()
|
|
11204
11930
|
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
11205
11931
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
11206
11932
|
steps: array(PipelineStepInputSchema).min(1),
|
|
@@ -11416,7 +12142,11 @@ var DetailResultSchema = object({
|
|
|
11416
12142
|
bbox: NativeCropBboxSchema.optional(),
|
|
11417
12143
|
embedding: string().optional(),
|
|
11418
12144
|
label: string().optional(),
|
|
11419
|
-
alignedCropJpeg: string().optional()
|
|
12145
|
+
alignedCropJpeg: string().optional(),
|
|
12146
|
+
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
12147
|
+
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
12148
|
+
* consumers MUST prefer this when present (2026-07-22 native-gate fix). */
|
|
12149
|
+
nativeFaceShortSidePx: number().optional()
|
|
11420
12150
|
});
|
|
11421
12151
|
/**
|
|
11422
12152
|
* Per-camera tunable ranges + defaults. Single source of truth used
|
|
@@ -11430,6 +12160,12 @@ var motionCooldownMsField = {
|
|
|
11430
12160
|
default: 3e4,
|
|
11431
12161
|
step: 500
|
|
11432
12162
|
};
|
|
12163
|
+
var maxSessionHoldMsField = {
|
|
12164
|
+
min: 0,
|
|
12165
|
+
max: 6e5,
|
|
12166
|
+
default: 12e4,
|
|
12167
|
+
step: 5e3
|
|
12168
|
+
};
|
|
11433
12169
|
var motionFpsField = {
|
|
11434
12170
|
min: 1,
|
|
11435
12171
|
max: 30,
|
|
@@ -11577,6 +12313,19 @@ var RunnerCameraConfigSchema = object({
|
|
|
11577
12313
|
"on-motion"
|
|
11578
12314
|
]).default("always-on"),
|
|
11579
12315
|
motionCooldownMs: number().min(motionCooldownMsField.min).default(motionCooldownMsField.default),
|
|
12316
|
+
/**
|
|
12317
|
+
* Orchestrator-side on-motion session-hold cap (ms). While an on-motion
|
|
12318
|
+
* detection session is active and ≥1 confirmed non-stationary track is
|
|
12319
|
+
* still live, the orchestrator keeps the session open past
|
|
12320
|
+
* `motionCooldownMs` (a slowly-moving subject can stop re-triggering the
|
|
12321
|
+
* camera's VMD yet is still being tracked frame-to-frame) — up to this many
|
|
12322
|
+
* ms since the session opened, after which it closes regardless. `0`
|
|
12323
|
+
* disables the hold (legacy cooldown-only teardown). Not consumed by the
|
|
12324
|
+
* runner itself — carried here so it shares the per-camera device-settings
|
|
12325
|
+
* surface with `motionCooldownMs`; the orchestrator reads it off the
|
|
12326
|
+
* resolved `CameraDetectionConfig`.
|
|
12327
|
+
*/
|
|
12328
|
+
maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
|
|
11580
12329
|
motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
|
|
11581
12330
|
detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
|
|
11582
12331
|
motionStreamId: string(),
|
|
@@ -11666,7 +12415,7 @@ var RunnerCameraConfigSchema = object({
|
|
|
11666
12415
|
*/
|
|
11667
12416
|
inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
|
|
11668
12417
|
});
|
|
11669
|
-
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;
|
|
12418
|
+
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;
|
|
11670
12419
|
/**
|
|
11671
12420
|
* Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
|
|
11672
12421
|
* load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
|
|
@@ -11777,77 +12526,16 @@ DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
|
11777
12526
|
lastChangedAt: number()
|
|
11778
12527
|
});
|
|
11779
12528
|
/**
|
|
11780
|
-
*
|
|
11781
|
-
* motion-
|
|
11782
|
-
*
|
|
11783
|
-
*
|
|
11784
|
-
*
|
|
11785
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
11786
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
11787
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
12529
|
+
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
12530
|
+
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
12531
|
+
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
12532
|
+
* a region keeps one drawing-plane model across all geometry caps.
|
|
11788
12533
|
*/
|
|
11789
|
-
/** A
|
|
11790
|
-
var
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
/** Axis-aligned rectangle (normalized 0..1). */
|
|
11795
|
-
var MaskRectShapeSchema = object({
|
|
11796
|
-
kind: literal("rect"),
|
|
11797
|
-
x: number(),
|
|
11798
|
-
y: number(),
|
|
11799
|
-
width: number(),
|
|
11800
|
-
height: number()
|
|
11801
|
-
});
|
|
11802
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
11803
|
-
var MaskPolygonShapeSchema = object({
|
|
11804
|
-
kind: literal("polygon"),
|
|
11805
|
-
points: array(MaskPointSchema)
|
|
11806
|
-
});
|
|
11807
|
-
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
11808
|
-
var MaskGridShapeSchema = object({
|
|
11809
|
-
kind: literal("grid"),
|
|
11810
|
-
gridWidth: number(),
|
|
11811
|
-
gridHeight: number(),
|
|
11812
|
-
cells: array(boolean())
|
|
11813
|
-
});
|
|
11814
|
-
discriminatedUnion("kind", [
|
|
11815
|
-
MaskRectShapeSchema,
|
|
11816
|
-
MaskPolygonShapeSchema,
|
|
11817
|
-
MaskGridShapeSchema,
|
|
11818
|
-
object({
|
|
11819
|
-
kind: literal("line"),
|
|
11820
|
-
points: array(MaskPointSchema)
|
|
11821
|
-
})
|
|
11822
|
-
]);
|
|
11823
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
11824
|
-
var MaskShapeKindSchema = _enum([
|
|
11825
|
-
"rect",
|
|
11826
|
-
"polygon",
|
|
11827
|
-
"grid",
|
|
11828
|
-
"line"
|
|
11829
|
-
]);
|
|
11830
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
11831
|
-
var MaskPolygonVerticesSchema = object({
|
|
11832
|
-
min: number(),
|
|
11833
|
-
max: number()
|
|
11834
|
-
});
|
|
11835
|
-
/** Grid dimensions when a cap supports 'grid'. */
|
|
11836
|
-
var MaskGridDimsSchema = object({
|
|
11837
|
-
width: number(),
|
|
11838
|
-
height: number()
|
|
11839
|
-
});
|
|
11840
|
-
/**
|
|
11841
|
-
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
11842
|
-
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
11843
|
-
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
11844
|
-
* a region keeps one drawing-plane model across all geometry caps.
|
|
11845
|
-
*/
|
|
11846
|
-
/** A motion-zone region — exactly one boolean cell grid today. */
|
|
11847
|
-
var MotionZoneRegionSchema = object({
|
|
11848
|
-
id: number(),
|
|
11849
|
-
enabled: boolean(),
|
|
11850
|
-
shape: MaskGridShapeSchema
|
|
12534
|
+
/** A motion-zone region — exactly one boolean cell grid today. */
|
|
12535
|
+
var MotionZoneRegionSchema = object({
|
|
12536
|
+
id: number(),
|
|
12537
|
+
enabled: boolean(),
|
|
12538
|
+
shape: MaskGridShapeSchema
|
|
11851
12539
|
});
|
|
11852
12540
|
object({
|
|
11853
12541
|
enabled: boolean(),
|
|
@@ -13520,94 +14208,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
13520
14208
|
bundleUrl: string()
|
|
13521
14209
|
});
|
|
13522
14210
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
13523
|
-
var NotificationRuleConditionsSchema = object({
|
|
13524
|
-
deviceIds: array(number()).readonly().optional(),
|
|
13525
|
-
classNames: array(string()).readonly().optional(),
|
|
13526
|
-
zoneIds: array(string()).readonly().optional(),
|
|
13527
|
-
minConfidence: number().optional(),
|
|
13528
|
-
source: _enum([
|
|
13529
|
-
"pipeline",
|
|
13530
|
-
"onboard",
|
|
13531
|
-
"any"
|
|
13532
|
-
]).optional(),
|
|
13533
|
-
schedule: object({
|
|
13534
|
-
days: array(number()).readonly(),
|
|
13535
|
-
startHour: number(),
|
|
13536
|
-
endHour: number()
|
|
13537
|
-
}).optional(),
|
|
13538
|
-
cooldownSeconds: number().optional(),
|
|
13539
|
-
minDwellSeconds: number().optional(),
|
|
13540
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
13541
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
13542
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
13543
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
13544
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
13545
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
13546
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
13547
|
-
clipDescription: object({
|
|
13548
|
-
text: string().min(1),
|
|
13549
|
-
minSimilarity: number().min(0).max(1)
|
|
13550
|
-
}).optional(),
|
|
13551
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
13552
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
13553
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
13554
|
-
* vehicle/person> is seen". */
|
|
13555
|
-
labels: array(string()).readonly().optional()
|
|
13556
|
-
});
|
|
13557
|
-
var NotificationRuleTemplateSchema = object({
|
|
13558
|
-
title: string(),
|
|
13559
|
-
body: string(),
|
|
13560
|
-
imageMode: _enum([
|
|
13561
|
-
"crop",
|
|
13562
|
-
"annotated",
|
|
13563
|
-
"full",
|
|
13564
|
-
"none"
|
|
13565
|
-
])
|
|
13566
|
-
});
|
|
13567
|
-
var NotificationRuleSchema = object({
|
|
13568
|
-
id: string(),
|
|
13569
|
-
name: string(),
|
|
13570
|
-
enabled: boolean(),
|
|
13571
|
-
eventTypes: array(string()).readonly(),
|
|
13572
|
-
conditions: NotificationRuleConditionsSchema,
|
|
13573
|
-
outputs: array(string()).readonly(),
|
|
13574
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
13575
|
-
priority: _enum([
|
|
13576
|
-
"low",
|
|
13577
|
-
"normal",
|
|
13578
|
-
"high",
|
|
13579
|
-
"critical"
|
|
13580
|
-
])
|
|
13581
|
-
});
|
|
13582
|
-
var NotificationTestResultSchema = object({
|
|
13583
|
-
ruleId: string(),
|
|
13584
|
-
eventId: string(),
|
|
13585
|
-
timestamp: number(),
|
|
13586
|
-
wouldFire: boolean(),
|
|
13587
|
-
reason: string().optional()
|
|
13588
|
-
});
|
|
13589
|
-
var NotificationHistoryEntrySchema = object({
|
|
13590
|
-
id: string(),
|
|
13591
|
-
ruleId: string(),
|
|
13592
|
-
ruleName: string(),
|
|
13593
|
-
eventId: string(),
|
|
13594
|
-
timestamp: number(),
|
|
13595
|
-
outputs: array(string()).readonly(),
|
|
13596
|
-
success: boolean(),
|
|
13597
|
-
error: string().optional(),
|
|
13598
|
-
deviceId: number().optional()
|
|
13599
|
-
});
|
|
13600
|
-
var NotificationHistoryFilterSchema = object({
|
|
13601
|
-
ruleId: string().optional(),
|
|
13602
|
-
deviceId: number().optional(),
|
|
13603
|
-
from: number().optional(),
|
|
13604
|
-
to: number().optional(),
|
|
13605
|
-
limit: number().optional()
|
|
13606
|
-
});
|
|
13607
|
-
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({
|
|
13608
|
-
ruleId: string(),
|
|
13609
|
-
lookbackMinutes: number()
|
|
13610
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
13611
14211
|
/**
|
|
13612
14212
|
* Alerts capability — collection-based internal alert system.
|
|
13613
14213
|
*
|
|
@@ -13794,88 +14394,54 @@ method(object({
|
|
|
13794
14394
|
password: string()
|
|
13795
14395
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
13796
14396
|
/**
|
|
13797
|
-
*
|
|
13798
|
-
*
|
|
13799
|
-
*
|
|
13800
|
-
*
|
|
13801
|
-
*
|
|
13802
|
-
*
|
|
13803
|
-
*
|
|
13804
|
-
* A contribution is a discriminated union on `kind`:
|
|
13805
|
-
*
|
|
13806
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
13807
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
13808
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
13809
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
13810
|
-
* login page needs NO change.
|
|
13811
|
-
*
|
|
13812
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
13813
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
13814
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
13815
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
13816
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
13817
|
-
*
|
|
13818
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
13819
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
13820
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
13821
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
13822
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
13823
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
13824
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
13825
|
-
* decision.
|
|
13826
|
-
*
|
|
13827
|
-
* Every contribution carries a `stage`:
|
|
13828
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
13829
|
-
* magic-link buttons; a future usernameless passkey).
|
|
13830
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
13831
|
-
* returned `factors` (passkey-as-2FA today).
|
|
13832
|
-
*
|
|
13833
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
13834
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
13835
|
-
* tRPC router.
|
|
14397
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
14398
|
+
* NOT flow through the capability — they use the addon data plane
|
|
14399
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
14400
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
14401
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
14402
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
13836
14403
|
*/
|
|
13837
|
-
|
|
13838
|
-
|
|
13839
|
-
|
|
13840
|
-
|
|
13841
|
-
|
|
13842
|
-
|
|
13843
|
-
|
|
13844
|
-
|
|
13845
|
-
|
|
13846
|
-
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
|
|
13851
|
-
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13878
|
-
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
14404
|
+
var TerminalSessionInfoSchema = object({
|
|
14405
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
14406
|
+
sessionId: string(),
|
|
14407
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
14408
|
+
profileId: string(),
|
|
14409
|
+
/** Human-readable profile label for the UI session list. */
|
|
14410
|
+
label: string(),
|
|
14411
|
+
cols: number().int().positive(),
|
|
14412
|
+
rows: number().int().positive(),
|
|
14413
|
+
/** ms-epoch the session's pty was spawned. */
|
|
14414
|
+
startedAt: number()
|
|
14415
|
+
});
|
|
14416
|
+
/**
|
|
14417
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
14418
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
14419
|
+
* command string would be remote code execution as the server's user, so it is
|
|
14420
|
+
* deliberately not part of the contract.
|
|
14421
|
+
*/
|
|
14422
|
+
var TerminalProfileInfoSchema = object({
|
|
14423
|
+
profileId: string(),
|
|
14424
|
+
label: string(),
|
|
14425
|
+
description: string().optional()
|
|
14426
|
+
});
|
|
14427
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
14428
|
+
profileId: string(),
|
|
14429
|
+
cols: number().int().positive(),
|
|
14430
|
+
rows: number().int().positive()
|
|
14431
|
+
}), TerminalSessionInfoSchema, {
|
|
14432
|
+
kind: "mutation",
|
|
14433
|
+
auth: "admin"
|
|
14434
|
+
}), method(object({
|
|
14435
|
+
sessionId: string(),
|
|
14436
|
+
cols: number().int().positive(),
|
|
14437
|
+
rows: number().int().positive()
|
|
14438
|
+
}), _void(), {
|
|
14439
|
+
kind: "mutation",
|
|
14440
|
+
auth: "admin"
|
|
14441
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
14442
|
+
kind: "mutation",
|
|
14443
|
+
auth: "admin"
|
|
14444
|
+
});
|
|
13879
14445
|
/**
|
|
13880
14446
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
13881
14447
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
@@ -13977,11 +14543,53 @@ var LocationStatSchema = object({
|
|
|
13977
14543
|
fileCount: number(),
|
|
13978
14544
|
present: boolean()
|
|
13979
14545
|
});
|
|
14546
|
+
/**
|
|
14547
|
+
* A backup schedule — the N:M "entry" that binds one cron cadence to a
|
|
14548
|
+
* SET of destination locations. Supersedes the per-location cron on
|
|
14549
|
+
* `BackupDestinationPolicy`: an operator creates a schedule, picks the
|
|
14550
|
+
* `backups` locations it should write to, and the orchestrator fans a
|
|
14551
|
+
* single archive out to all of them when the cron fires.
|
|
14552
|
+
*
|
|
14553
|
+
* `retentionCount` is per-schedule (D-decision 2026-07-28): every
|
|
14554
|
+
* location targeted by this schedule keeps this many archives from
|
|
14555
|
+
* this schedule's runs.
|
|
14556
|
+
*
|
|
14557
|
+
* `dataSources` optionally narrows which top-level state locations
|
|
14558
|
+
* (db, addons, tls, …) are archived; omitted = the orchestrator's
|
|
14559
|
+
* default full set.
|
|
14560
|
+
*/
|
|
14561
|
+
var BackupScheduleSchema = object({
|
|
14562
|
+
/** Stable id. Generated by the orchestrator on first upsert if absent. */
|
|
14563
|
+
id: string(),
|
|
14564
|
+
/** Operator-facing display name. */
|
|
14565
|
+
label: string(),
|
|
14566
|
+
/** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
|
|
14567
|
+
cron: string(),
|
|
14568
|
+
/** Master on/off toggle for the whole schedule. */
|
|
14569
|
+
enabled: boolean(),
|
|
14570
|
+
/** `backups`-location ids this schedule writes to (fan-out set). */
|
|
14571
|
+
locationIds: array(string()).readonly(),
|
|
14572
|
+
/** Archives kept per targeted location for this schedule. */
|
|
14573
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14574
|
+
/** Optional subset of source locations to include; omitted = all. */
|
|
14575
|
+
dataSources: array(string()).readonly().optional(),
|
|
14576
|
+
/** ms-epoch of last successful run. */
|
|
14577
|
+
lastRunAt: number().optional(),
|
|
14578
|
+
/** ms-epoch of next computed firing (read-only, filled on list). */
|
|
14579
|
+
nextRunAt: number().optional()
|
|
14580
|
+
});
|
|
13980
14581
|
method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
13981
14582
|
/** Subset of registered `backup-destination` addon ids to write to. */
|
|
13982
14583
|
destinations: array(string()).optional(),
|
|
13983
14584
|
locations: array(string()).optional(),
|
|
13984
|
-
label: string().optional()
|
|
14585
|
+
label: string().optional(),
|
|
14586
|
+
/**
|
|
14587
|
+
* Per-run retention override applied to every targeted
|
|
14588
|
+
* destination. Used by schedule-driven runs (per-entry
|
|
14589
|
+
* retention). Omitted = each destination's own policy
|
|
14590
|
+
* retention (manual runs).
|
|
14591
|
+
*/
|
|
14592
|
+
retentionCount: number().int().min(1).max(1e3).optional()
|
|
13985
14593
|
}).optional(), array(BackupEntrySchema).readonly(), {
|
|
13986
14594
|
kind: "mutation",
|
|
13987
14595
|
auth: "admin"
|
|
@@ -14030,7 +14638,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
14030
14638
|
ok: boolean(),
|
|
14031
14639
|
error: string().optional(),
|
|
14032
14640
|
nextRuns: array(number()).readonly()
|
|
14033
|
-
}))
|
|
14641
|
+
})), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
|
|
14642
|
+
id: string().optional(),
|
|
14643
|
+
label: string(),
|
|
14644
|
+
cron: string(),
|
|
14645
|
+
enabled: boolean(),
|
|
14646
|
+
locationIds: array(string()).readonly(),
|
|
14647
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14648
|
+
dataSources: array(string()).readonly().optional()
|
|
14649
|
+
}), BackupScheduleSchema, {
|
|
14650
|
+
kind: "mutation",
|
|
14651
|
+
auth: "admin"
|
|
14652
|
+
}), method(object({ id: string() }), _void(), {
|
|
14653
|
+
kind: "mutation",
|
|
14654
|
+
auth: "admin"
|
|
14655
|
+
});
|
|
14034
14656
|
/**
|
|
14035
14657
|
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
14036
14658
|
*
|
|
@@ -15269,35 +15891,410 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
15269
15891
|
kind: "mutation",
|
|
15270
15892
|
auth: "admin"
|
|
15271
15893
|
});
|
|
15272
|
-
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
tags: record(string(), string()).optional()
|
|
15894
|
+
/**
|
|
15895
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15896
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15897
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
15898
|
+
*
|
|
15899
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15900
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
15901
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15902
|
+
*/
|
|
15903
|
+
var LlmUsageSchema = object({
|
|
15904
|
+
inputTokens: number(),
|
|
15905
|
+
outputTokens: number()
|
|
15285
15906
|
});
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
|
|
15295
|
-
|
|
15296
|
-
|
|
15297
|
-
|
|
15298
|
-
|
|
15299
|
-
|
|
15300
|
-
|
|
15907
|
+
var LlmErrorCodeSchema = _enum([
|
|
15908
|
+
"timeout",
|
|
15909
|
+
"rate-limited",
|
|
15910
|
+
"auth",
|
|
15911
|
+
"refusal",
|
|
15912
|
+
"bad-request",
|
|
15913
|
+
"unavailable",
|
|
15914
|
+
"no-profile",
|
|
15915
|
+
"budget-exceeded",
|
|
15916
|
+
"adapter-error"
|
|
15917
|
+
]);
|
|
15918
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15919
|
+
ok: literal(true),
|
|
15920
|
+
text: string(),
|
|
15921
|
+
model: string(),
|
|
15922
|
+
usage: LlmUsageSchema,
|
|
15923
|
+
truncated: boolean(),
|
|
15924
|
+
latencyMs: number()
|
|
15925
|
+
}), object({
|
|
15926
|
+
ok: literal(false),
|
|
15927
|
+
code: LlmErrorCodeSchema,
|
|
15928
|
+
message: string(),
|
|
15929
|
+
retryAfterMs: number().optional()
|
|
15930
|
+
})]);
|
|
15931
|
+
/**
|
|
15932
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15933
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15934
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
15935
|
+
*/
|
|
15936
|
+
var LlmImageSchema = object({
|
|
15937
|
+
bytes: _instanceof(Uint8Array),
|
|
15938
|
+
mimeType: string()
|
|
15939
|
+
});
|
|
15940
|
+
var LlmGenerateBaseInputSchema = object({
|
|
15941
|
+
/** Collection routing (the notification-output posture). */
|
|
15942
|
+
addonId: string().optional(),
|
|
15943
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15944
|
+
profileId: string().optional(),
|
|
15945
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15946
|
+
consumer: string(),
|
|
15947
|
+
system: string().optional(),
|
|
15948
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15949
|
+
prompt: string(),
|
|
15950
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15951
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
15952
|
+
/** Per-call override of the profile default. */
|
|
15953
|
+
maxTokens: number().int().positive().optional(),
|
|
15954
|
+
temperature: number().optional()
|
|
15955
|
+
});
|
|
15956
|
+
/**
|
|
15957
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15958
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15959
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15960
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15961
|
+
* this only through the `llm` cap's methods.
|
|
15962
|
+
*
|
|
15963
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15964
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15965
|
+
* watchdog — operator decision #3).
|
|
15966
|
+
*/
|
|
15967
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15968
|
+
object({
|
|
15969
|
+
kind: literal("catalog"),
|
|
15970
|
+
catalogId: string()
|
|
15971
|
+
}),
|
|
15972
|
+
object({
|
|
15973
|
+
kind: literal("url"),
|
|
15974
|
+
url: string(),
|
|
15975
|
+
sha256: string().optional()
|
|
15976
|
+
}),
|
|
15977
|
+
object({
|
|
15978
|
+
kind: literal("path"),
|
|
15979
|
+
path: string()
|
|
15980
|
+
})
|
|
15981
|
+
]);
|
|
15982
|
+
var ManagedRuntimeConfigSchema = object({
|
|
15983
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
15984
|
+
nodeId: string(),
|
|
15985
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15986
|
+
engine: _enum(["llama-cpp"]),
|
|
15987
|
+
model: ManagedModelRefSchema,
|
|
15988
|
+
contextSize: number().int().default(4096),
|
|
15989
|
+
/** 0 = CPU-only. */
|
|
15990
|
+
gpuLayers: number().int().default(0),
|
|
15991
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15992
|
+
threads: number().int().optional(),
|
|
15993
|
+
/** Concurrent slots. */
|
|
15994
|
+
parallel: number().int().default(1),
|
|
15995
|
+
/** Else lazy: first generate boots it. */
|
|
15996
|
+
autoStart: boolean().default(false),
|
|
15997
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
15998
|
+
idleStopMinutes: number().int().default(30)
|
|
15999
|
+
});
|
|
16000
|
+
var LlmRuntimeStatusSchema = object({
|
|
16001
|
+
/** Status is ALWAYS node-qualified. */
|
|
16002
|
+
nodeId: string(),
|
|
16003
|
+
state: _enum([
|
|
16004
|
+
"stopped",
|
|
16005
|
+
"downloading",
|
|
16006
|
+
"starting",
|
|
16007
|
+
"ready",
|
|
16008
|
+
"crashed",
|
|
16009
|
+
"failed"
|
|
16010
|
+
]),
|
|
16011
|
+
pid: number().optional(),
|
|
16012
|
+
port: number().optional(),
|
|
16013
|
+
modelPath: string().optional(),
|
|
16014
|
+
modelId: string().optional(),
|
|
16015
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
16016
|
+
lastError: string().optional(),
|
|
16017
|
+
crashesInWindow: number(),
|
|
16018
|
+
/** Child RSS (sampled best-effort). */
|
|
16019
|
+
memoryBytes: number().optional(),
|
|
16020
|
+
vramBytes: number().optional()
|
|
16021
|
+
});
|
|
16022
|
+
var LlmNodeModelSchema = object({
|
|
16023
|
+
file: string(),
|
|
16024
|
+
sizeBytes: number(),
|
|
16025
|
+
catalogId: string().optional(),
|
|
16026
|
+
installedAt: number().optional()
|
|
16027
|
+
});
|
|
16028
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
16029
|
+
nodeId: string(),
|
|
16030
|
+
modelsBytes: number(),
|
|
16031
|
+
freeBytes: number().optional()
|
|
16032
|
+
});
|
|
16033
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
16034
|
+
images: array(LlmImageSchema).optional(),
|
|
16035
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
16036
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
16037
|
+
timeoutMs: number().int().positive().optional()
|
|
16038
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
16039
|
+
kind: "mutation",
|
|
16040
|
+
auth: "admin"
|
|
16041
|
+
}), method(object({}), _void(), {
|
|
16042
|
+
kind: "mutation",
|
|
16043
|
+
auth: "admin"
|
|
16044
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
16045
|
+
kind: "mutation",
|
|
16046
|
+
auth: "admin"
|
|
16047
|
+
}), method(object({ file: string() }), _void(), {
|
|
16048
|
+
kind: "mutation",
|
|
16049
|
+
auth: "admin"
|
|
16050
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
16051
|
+
/**
|
|
16052
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
16053
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
16054
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
16055
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
16056
|
+
* (hub-placed); the cap stays open for future providers.
|
|
16057
|
+
*
|
|
16058
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
16059
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
16060
|
+
* write; a stored key NEVER round-trips to a client.
|
|
16061
|
+
*/
|
|
16062
|
+
var LlmProfileKindSchema = _enum([
|
|
16063
|
+
"openai-compatible",
|
|
16064
|
+
"openai",
|
|
16065
|
+
"anthropic",
|
|
16066
|
+
"google",
|
|
16067
|
+
"managed-local"
|
|
16068
|
+
]);
|
|
16069
|
+
var LlmProfileSchema = object({
|
|
16070
|
+
id: string(),
|
|
16071
|
+
name: string(),
|
|
16072
|
+
kind: LlmProfileKindSchema,
|
|
16073
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
16074
|
+
addonId: string(),
|
|
16075
|
+
enabled: boolean(),
|
|
16076
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
16077
|
+
model: string(),
|
|
16078
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
16079
|
+
baseUrl: string().optional(),
|
|
16080
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
16081
|
+
apiKey: string().optional(),
|
|
16082
|
+
supportsVision: boolean(),
|
|
16083
|
+
temperature: number().min(0).max(2).optional(),
|
|
16084
|
+
maxTokens: number().int().positive().optional(),
|
|
16085
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
16086
|
+
extraHeaders: record(string(), string()).optional(),
|
|
16087
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
16088
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
16089
|
+
});
|
|
16090
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
16091
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
16092
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
16093
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
16094
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
16095
|
+
kind: LlmProfileKindSchema,
|
|
16096
|
+
label: string(),
|
|
16097
|
+
icon: string(),
|
|
16098
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16099
|
+
addonId: string(),
|
|
16100
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
16101
|
+
});
|
|
16102
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
16103
|
+
var LlmDefaultSchema = object({
|
|
16104
|
+
selector: LlmDefaultSelectorSchema,
|
|
16105
|
+
profileId: string()
|
|
16106
|
+
});
|
|
16107
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
16108
|
+
var LlmUsageRollupSchema = object({
|
|
16109
|
+
day: string(),
|
|
16110
|
+
consumer: string(),
|
|
16111
|
+
profileId: string(),
|
|
16112
|
+
calls: number(),
|
|
16113
|
+
okCalls: number(),
|
|
16114
|
+
errorCalls: number(),
|
|
16115
|
+
inputTokens: number(),
|
|
16116
|
+
outputTokens: number(),
|
|
16117
|
+
avgLatencyMs: number()
|
|
16118
|
+
});
|
|
16119
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
16120
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
16121
|
+
id: string(),
|
|
16122
|
+
label: string(),
|
|
16123
|
+
family: string(),
|
|
16124
|
+
purpose: _enum(["text", "vision"]),
|
|
16125
|
+
url: string(),
|
|
16126
|
+
sha256: string(),
|
|
16127
|
+
sizeBytes: number(),
|
|
16128
|
+
quantization: string(),
|
|
16129
|
+
/** Load-time guidance shown in the picker. */
|
|
16130
|
+
minRamBytes: number(),
|
|
16131
|
+
contextSizeDefault: number().int(),
|
|
16132
|
+
/** Vision models: companion projector file. */
|
|
16133
|
+
mmprojUrl: string().optional()
|
|
16134
|
+
});
|
|
16135
|
+
var LlmRuntimeNodeSchema = object({
|
|
16136
|
+
nodeId: string(),
|
|
16137
|
+
reachable: boolean(),
|
|
16138
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
16139
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
16140
|
+
error: string().optional()
|
|
16141
|
+
});
|
|
16142
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
16143
|
+
var ProfileRefInputSchema = object({
|
|
16144
|
+
addonId: string(),
|
|
16145
|
+
profileId: string()
|
|
16146
|
+
});
|
|
16147
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
16148
|
+
kind: "mutation",
|
|
16149
|
+
auth: "admin"
|
|
16150
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16151
|
+
kind: "mutation",
|
|
16152
|
+
auth: "admin"
|
|
16153
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
16154
|
+
kind: "mutation",
|
|
16155
|
+
auth: "admin"
|
|
16156
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
16157
|
+
selector: LlmDefaultSelectorSchema,
|
|
16158
|
+
profileId: string().nullable()
|
|
16159
|
+
}), _void(), {
|
|
16160
|
+
kind: "mutation",
|
|
16161
|
+
auth: "admin"
|
|
16162
|
+
}), method(object({
|
|
16163
|
+
since: number().optional(),
|
|
16164
|
+
until: number().optional(),
|
|
16165
|
+
consumer: string().optional(),
|
|
16166
|
+
profileId: string().optional()
|
|
16167
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16168
|
+
nodeId: string(),
|
|
16169
|
+
model: ManagedModelRefSchema
|
|
16170
|
+
}), _void(), {
|
|
16171
|
+
kind: "mutation",
|
|
16172
|
+
auth: "admin"
|
|
16173
|
+
}), method(object({
|
|
16174
|
+
nodeId: string(),
|
|
16175
|
+
file: string()
|
|
16176
|
+
}), _void(), {
|
|
16177
|
+
kind: "mutation",
|
|
16178
|
+
auth: "admin"
|
|
16179
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16180
|
+
kind: "mutation",
|
|
16181
|
+
auth: "admin"
|
|
16182
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16183
|
+
kind: "mutation",
|
|
16184
|
+
auth: "admin"
|
|
16185
|
+
});
|
|
16186
|
+
var LogLevelSchema = _enum([
|
|
16187
|
+
"debug",
|
|
16188
|
+
"info",
|
|
16189
|
+
"warn",
|
|
16190
|
+
"error"
|
|
16191
|
+
]);
|
|
16192
|
+
var LogEntrySchema = object({
|
|
16193
|
+
timestamp: date(),
|
|
16194
|
+
level: LogLevelSchema,
|
|
16195
|
+
scope: array(string()),
|
|
16196
|
+
message: string(),
|
|
16197
|
+
meta: record(string(), unknown()).optional(),
|
|
16198
|
+
tags: record(string(), string()).optional()
|
|
16199
|
+
});
|
|
16200
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
16201
|
+
scope: array(string()).optional(),
|
|
16202
|
+
level: LogLevelSchema.optional(),
|
|
16203
|
+
since: date().optional(),
|
|
16204
|
+
until: date().optional(),
|
|
16205
|
+
limit: number().optional(),
|
|
16206
|
+
tags: record(string(), string()).optional()
|
|
16207
|
+
}), array(LogEntrySchema).readonly());
|
|
16208
|
+
/**
|
|
16209
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
16210
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
16211
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
16212
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
16213
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
16214
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
16215
|
+
*
|
|
16216
|
+
* A contribution is a discriminated union on `kind`:
|
|
16217
|
+
*
|
|
16218
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
16219
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16220
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
16221
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16222
|
+
* login page needs NO change.
|
|
16223
|
+
*
|
|
16224
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
16225
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
16226
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
16227
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
16228
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
16229
|
+
*
|
|
16230
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
16231
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
16232
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
16233
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
16234
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
16235
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
16236
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
16237
|
+
* decision.
|
|
16238
|
+
*
|
|
16239
|
+
* Every contribution carries a `stage`:
|
|
16240
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
16241
|
+
* magic-link buttons; a future usernameless passkey).
|
|
16242
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16243
|
+
* returned `factors` (passkey-as-2FA today).
|
|
16244
|
+
*
|
|
16245
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
16246
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
16247
|
+
* tRPC router.
|
|
16248
|
+
*/
|
|
16249
|
+
/** When a login method renders in the two-phase login flow. */
|
|
16250
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
16251
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
16252
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
16253
|
+
object({
|
|
16254
|
+
kind: literal("redirect"),
|
|
16255
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
16256
|
+
id: string(),
|
|
16257
|
+
/** Operator-facing button label. */
|
|
16258
|
+
label: string(),
|
|
16259
|
+
/** lucide-react icon name. */
|
|
16260
|
+
icon: string().optional(),
|
|
16261
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
16262
|
+
startUrl: string(),
|
|
16263
|
+
stage: LoginStageEnum
|
|
16264
|
+
}),
|
|
16265
|
+
object({
|
|
16266
|
+
kind: literal("widget"),
|
|
16267
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
16268
|
+
id: string(),
|
|
16269
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
16270
|
+
addonId: string(),
|
|
16271
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
16272
|
+
bundle: string(),
|
|
16273
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
16274
|
+
remote: WidgetRemoteSchema,
|
|
16275
|
+
stage: LoginStageEnum
|
|
16276
|
+
}),
|
|
16277
|
+
object({
|
|
16278
|
+
kind: literal("passkey"),
|
|
16279
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
16280
|
+
id: string(),
|
|
16281
|
+
/** Operator-facing button label. */
|
|
16282
|
+
label: string(),
|
|
16283
|
+
stage: LoginStageEnum,
|
|
16284
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
16285
|
+
rpId: string(),
|
|
16286
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
16287
|
+
origin: string().nullable()
|
|
16288
|
+
})
|
|
16289
|
+
]);
|
|
16290
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
16291
|
+
var CpuBreakdownSchema = object({
|
|
16292
|
+
total: number(),
|
|
16293
|
+
user: number(),
|
|
16294
|
+
system: number(),
|
|
16295
|
+
irq: number(),
|
|
16296
|
+
nice: number(),
|
|
16297
|
+
loadAvg: tuple([
|
|
15301
16298
|
number(),
|
|
15302
16299
|
number(),
|
|
15303
16300
|
number()
|
|
@@ -15471,668 +16468,376 @@ method(object({
|
|
|
15471
16468
|
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15472
16469
|
calibrationRef: string().optional(),
|
|
15473
16470
|
sessionId: string().optional()
|
|
15474
|
-
}), ConvertResultSchema, {
|
|
15475
|
-
kind: "mutation",
|
|
15476
|
-
auth: "admin",
|
|
15477
|
-
timeoutMs: 6e5
|
|
15478
|
-
});
|
|
15479
|
-
method(object({
|
|
15480
|
-
nodeId: string(),
|
|
15481
|
-
modelId: string(),
|
|
15482
|
-
format: _enum(MODEL_FORMATS),
|
|
15483
|
-
entry: ModelCatalogEntrySchema
|
|
15484
|
-
}), object({
|
|
15485
|
-
ok: boolean(),
|
|
15486
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15487
|
-
sha256: string(),
|
|
15488
|
-
bytes: number(),
|
|
15489
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15490
|
-
path: string()
|
|
15491
|
-
}), {
|
|
15492
|
-
kind: "mutation",
|
|
15493
|
-
auth: "admin"
|
|
15494
|
-
});
|
|
15495
|
-
/**
|
|
15496
|
-
* `mqtt-broker` — broker-registry cap.
|
|
15497
|
-
*
|
|
15498
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15499
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15500
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
15501
|
-
* its OWN `mqtt.js` client.
|
|
15502
|
-
*
|
|
15503
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15504
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15505
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
15506
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15507
|
-
* features anyway — give it the connection config, get out of the way.
|
|
15508
|
-
*
|
|
15509
|
-
* Consumer flow:
|
|
15510
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
15511
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
15512
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
15513
|
-
*
|
|
15514
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
15515
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
15516
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
15517
|
-
* spawned it.
|
|
15518
|
-
*/
|
|
15519
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
15520
|
-
/**
|
|
15521
|
-
* Broker live-probe status.
|
|
15522
|
-
*
|
|
15523
|
-
* - `connected` — last probe completed a clean CONNACK
|
|
15524
|
-
* - `disconnected` — no probe has run yet (cold cache)
|
|
15525
|
-
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
15526
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
15527
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
15528
|
-
*/
|
|
15529
|
-
var BrokerStatusSchema$1 = _enum([
|
|
15530
|
-
"connected",
|
|
15531
|
-
"disconnected",
|
|
15532
|
-
"auth-failed",
|
|
15533
|
-
"unreachable",
|
|
15534
|
-
"tls-error"
|
|
15535
|
-
]);
|
|
15536
|
-
var BrokerInfoSchema = object({
|
|
15537
|
-
id: string(),
|
|
15538
|
-
name: string(),
|
|
15539
|
-
url: string(),
|
|
15540
|
-
kind: BrokerKindSchema,
|
|
15541
|
-
status: BrokerStatusSchema$1,
|
|
15542
|
-
latencyMs: number().nullable(),
|
|
15543
|
-
error: string().optional(),
|
|
15544
|
-
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
15545
|
-
connectedClients: number().int().nonnegative().optional(),
|
|
15546
|
-
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
15547
|
-
lastCheckedAt: number().optional()
|
|
15548
|
-
});
|
|
15549
|
-
/**
|
|
15550
|
-
* Connection details — what a consumer needs to call
|
|
15551
|
-
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
15552
|
-
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
15553
|
-
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
15554
|
-
*/
|
|
15555
|
-
var BrokerConnectionDetailsSchema = object({
|
|
15556
|
-
url: string(),
|
|
15557
|
-
username: string().optional(),
|
|
15558
|
-
password: string().optional(),
|
|
15559
|
-
/**
|
|
15560
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
15561
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
15562
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
15563
|
-
* broker).
|
|
15564
|
-
*/
|
|
15565
|
-
clientIdPrefix: string().optional()
|
|
15566
|
-
});
|
|
15567
|
-
var AddBrokerInputSchema = object({
|
|
15568
|
-
name: string().min(1),
|
|
15569
|
-
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
15570
|
-
username: string().optional(),
|
|
15571
|
-
password: string().optional(),
|
|
15572
|
-
clientIdPrefix: string().optional()
|
|
15573
|
-
});
|
|
15574
|
-
var AddBrokerResultSchema = object({ id: string() });
|
|
15575
|
-
var IdInputSchema = object({ id: string() });
|
|
15576
|
-
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
15577
|
-
ok: literal(true),
|
|
15578
|
-
latencyMs: number()
|
|
15579
|
-
}), object({
|
|
15580
|
-
ok: literal(false),
|
|
15581
|
-
error: string()
|
|
15582
|
-
})]);
|
|
15583
|
-
var StartEmbeddedInputSchema = object({
|
|
15584
|
-
port: number().int().min(1).max(65535).default(1883),
|
|
15585
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
15586
|
-
allowAnonymous: boolean().default(false),
|
|
15587
|
-
/** Optional shared username/password for clients. */
|
|
15588
|
-
username: string().optional(),
|
|
15589
|
-
password: string().optional()
|
|
15590
|
-
});
|
|
15591
|
-
var StartEmbeddedResultSchema = object({
|
|
15592
|
-
id: string(),
|
|
15593
|
-
url: string()
|
|
15594
|
-
});
|
|
15595
|
-
var StatusSchema = object({
|
|
15596
|
-
brokerCount: number(),
|
|
15597
|
-
embeddedRunning: boolean()
|
|
15598
|
-
});
|
|
15599
|
-
var mqttBrokerCapability = {
|
|
15600
|
-
name: "mqtt-broker",
|
|
15601
|
-
scope: "system",
|
|
15602
|
-
mode: "collection",
|
|
15603
|
-
providerKind: "broker",
|
|
15604
|
-
status: {
|
|
15605
|
-
schema: StatusSchema,
|
|
15606
|
-
kind: "poll"
|
|
15607
|
-
},
|
|
15608
|
-
methods: {
|
|
15609
|
-
listBrokers: method(_void(), array(BrokerInfoSchema)),
|
|
15610
|
-
getBrokerConfig: method(IdInputSchema, BrokerConnectionDetailsSchema),
|
|
15611
|
-
addBroker: method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }),
|
|
15612
|
-
removeBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
|
|
15613
|
-
testConnection: method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }),
|
|
15614
|
-
startEmbeddedBroker: method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }),
|
|
15615
|
-
stopEmbeddedBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
|
|
15616
|
-
getStatus: method(_void(), StatusSchema)
|
|
15617
|
-
}
|
|
15618
|
-
};
|
|
15619
|
-
var NetworkEndpointSchema = object({
|
|
15620
|
-
url: string(),
|
|
15621
|
-
hostname: string(),
|
|
15622
|
-
port: number(),
|
|
15623
|
-
protocol: _enum(["http", "https"])
|
|
15624
|
-
});
|
|
15625
|
-
var NetworkAccessStatusSchema = object({
|
|
15626
|
-
connected: boolean(),
|
|
15627
|
-
endpoint: NetworkEndpointSchema.nullable(),
|
|
15628
|
-
error: string().optional()
|
|
16471
|
+
}), ConvertResultSchema, {
|
|
16472
|
+
kind: "mutation",
|
|
16473
|
+
auth: "admin",
|
|
16474
|
+
timeoutMs: 6e5
|
|
15629
16475
|
});
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
15637
|
-
*/
|
|
15638
|
-
|
|
15639
|
-
|
|
15640
|
-
|
|
15641
|
-
|
|
15642
|
-
|
|
15643
|
-
|
|
15644
|
-
|
|
15645
|
-
label: string(),
|
|
15646
|
-
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
15647
|
-
mode: string().optional(),
|
|
15648
|
-
/** Originating local port the ingress fronts (informational). */
|
|
15649
|
-
sourcePort: number().optional()
|
|
16476
|
+
method(object({
|
|
16477
|
+
nodeId: string(),
|
|
16478
|
+
modelId: string(),
|
|
16479
|
+
format: _enum(MODEL_FORMATS),
|
|
16480
|
+
entry: ModelCatalogEntrySchema
|
|
16481
|
+
}), object({
|
|
16482
|
+
ok: boolean(),
|
|
16483
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
16484
|
+
sha256: string(),
|
|
16485
|
+
bytes: number(),
|
|
16486
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
16487
|
+
path: string()
|
|
16488
|
+
}), {
|
|
16489
|
+
kind: "mutation",
|
|
16490
|
+
auth: "admin"
|
|
15650
16491
|
});
|
|
15651
|
-
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
15652
16492
|
/**
|
|
15653
|
-
*
|
|
16493
|
+
* `mqtt-broker` — broker-registry cap.
|
|
15654
16494
|
*
|
|
15655
|
-
*
|
|
15656
|
-
* `
|
|
15657
|
-
*
|
|
15658
|
-
*
|
|
15659
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
15660
|
-
* message to what the kind supports — callers never special-case a service.
|
|
16495
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
16496
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
16497
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
16498
|
+
* its OWN `mqtt.js` client.
|
|
15661
16499
|
*
|
|
15662
|
-
*
|
|
15663
|
-
*
|
|
15664
|
-
*
|
|
15665
|
-
*
|
|
15666
|
-
*
|
|
15667
|
-
* alternative would fork the UI per addon and cannot host the
|
|
15668
|
-
* discovery→adopt flow.
|
|
15669
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
15670
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
15671
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
15672
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
15673
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
15674
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
15675
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
15676
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
15677
|
-
* base64 fallback needed.
|
|
16500
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
16501
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
16502
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
16503
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
16504
|
+
* features anyway — give it the connection config, get out of the way.
|
|
15678
16505
|
*
|
|
15679
|
-
*
|
|
15680
|
-
*
|
|
15681
|
-
*
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
*
|
|
15685
|
-
*
|
|
16506
|
+
* Consumer flow:
|
|
16507
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
16508
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
16509
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
16510
|
+
*
|
|
16511
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
16512
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
16513
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
16514
|
+
* spawned it.
|
|
15686
16515
|
*/
|
|
15687
|
-
var
|
|
15688
|
-
"image",
|
|
15689
|
-
"video",
|
|
15690
|
-
"gif",
|
|
15691
|
-
"audio",
|
|
15692
|
-
"icon"
|
|
15693
|
-
]);
|
|
16516
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
15694
16517
|
/**
|
|
15695
|
-
*
|
|
15696
|
-
*
|
|
15697
|
-
*
|
|
15698
|
-
*
|
|
16518
|
+
* Broker live-probe status.
|
|
16519
|
+
*
|
|
16520
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
16521
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
16522
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
16523
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
16524
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
15699
16525
|
*/
|
|
15700
|
-
var
|
|
15701
|
-
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
15707
|
-
var NotificationFormatSchema = _enum([
|
|
15708
|
-
"text",
|
|
15709
|
-
"markdown",
|
|
15710
|
-
"html"
|
|
16526
|
+
var BrokerStatusSchema$1 = _enum([
|
|
16527
|
+
"connected",
|
|
16528
|
+
"disconnected",
|
|
16529
|
+
"auth-failed",
|
|
16530
|
+
"unreachable",
|
|
16531
|
+
"tls-error"
|
|
15711
16532
|
]);
|
|
15712
|
-
|
|
15713
|
-
var NotificationActionSchema = object({
|
|
15714
|
-
id: string(),
|
|
15715
|
-
label: string(),
|
|
15716
|
-
url: string().optional()
|
|
15717
|
-
});
|
|
15718
|
-
/**
|
|
15719
|
-
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
15720
|
-
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
15721
|
-
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
15722
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
15723
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
15724
|
-
* `priority` for that one target.
|
|
15725
|
-
*/
|
|
15726
|
-
var NotificationSchema = object({
|
|
15727
|
-
body: string(),
|
|
15728
|
-
title: string().optional(),
|
|
15729
|
-
format: NotificationFormatSchema.default("text"),
|
|
15730
|
-
priority: number().int().min(1).max(5).default(3),
|
|
15731
|
-
level: string().optional(),
|
|
15732
|
-
attachments: array(AttachmentSchema).optional(),
|
|
15733
|
-
clickUrl: string().optional(),
|
|
15734
|
-
actions: array(NotificationActionSchema).optional(),
|
|
15735
|
-
sound: string().optional(),
|
|
15736
|
-
ttl: number().optional(),
|
|
15737
|
-
tag: string().optional(),
|
|
15738
|
-
deviceId: number().optional(),
|
|
15739
|
-
eventId: string().optional(),
|
|
15740
|
-
metadata: record(string(), unknown()).optional()
|
|
15741
|
-
});
|
|
15742
|
-
/** One declared native severity/priority level for a kind. */
|
|
15743
|
-
var TargetKindLevelSchema = object({
|
|
15744
|
-
id: string(),
|
|
15745
|
-
label: string(),
|
|
15746
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
15747
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
15748
|
-
flags: object({
|
|
15749
|
-
critical: boolean().optional(),
|
|
15750
|
-
silent: boolean().optional(),
|
|
15751
|
-
noPush: boolean().optional()
|
|
15752
|
-
}).optional(),
|
|
15753
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
15754
|
-
requires: array(string()).optional(),
|
|
15755
|
-
description: string().optional()
|
|
15756
|
-
});
|
|
15757
|
-
/** The full capability block consulted before dispatch. */
|
|
15758
|
-
var TargetKindCapsSchema = object({
|
|
15759
|
-
attachments: object({
|
|
15760
|
-
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
15761
|
-
mode: _enum([
|
|
15762
|
-
"url",
|
|
15763
|
-
"bytes",
|
|
15764
|
-
"both"
|
|
15765
|
-
]),
|
|
15766
|
-
max: number().int().nonnegative(),
|
|
15767
|
-
maxBytes: number().int().positive().optional()
|
|
15768
|
-
}),
|
|
15769
|
-
/** Max action buttons (0 = none). */
|
|
15770
|
-
actions: number().int().nonnegative(),
|
|
15771
|
-
levels: array(TargetKindLevelSchema),
|
|
15772
|
-
format: array(NotificationFormatSchema),
|
|
15773
|
-
clickUrl: boolean(),
|
|
15774
|
-
sound: boolean(),
|
|
15775
|
-
ttl: boolean(),
|
|
15776
|
-
bodyMaxLen: number().int().positive()
|
|
15777
|
-
});
|
|
15778
|
-
/**
|
|
15779
|
-
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
15780
|
-
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
15781
|
-
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
15782
|
-
* the union is large and not meant for runtime validation here; the exported
|
|
15783
|
-
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
15784
|
-
*/
|
|
15785
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
15786
|
-
var TargetKindSchema = object({
|
|
15787
|
-
kind: string(),
|
|
15788
|
-
label: string(),
|
|
15789
|
-
icon: string(),
|
|
15790
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15791
|
-
addonId: string(),
|
|
15792
|
-
configSchema: ConfigSchemaPassthrough$1,
|
|
15793
|
-
supportsDiscovery: boolean(),
|
|
15794
|
-
caps: TargetKindCapsSchema
|
|
15795
|
-
});
|
|
15796
|
-
/**
|
|
15797
|
-
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
15798
|
-
* (return a presence marker only) when serving `listTargets` — never
|
|
15799
|
-
* round-trip a stored secret to the UI.
|
|
15800
|
-
*/
|
|
15801
|
-
var TargetSchema = object({
|
|
16533
|
+
var BrokerInfoSchema = object({
|
|
15802
16534
|
id: string(),
|
|
15803
16535
|
name: string(),
|
|
15804
|
-
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
/**
|
|
15810
|
-
|
|
15811
|
-
|
|
15812
|
-
|
|
15813
|
-
|
|
15814
|
-
});
|
|
15815
|
-
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
15816
|
-
var RenderedAsSchema = object({
|
|
15817
|
-
level: string(),
|
|
15818
|
-
format: NotificationFormatSchema,
|
|
15819
|
-
attachmentsSent: number().int().nonnegative(),
|
|
15820
|
-
actionsSent: number().int().nonnegative(),
|
|
15821
|
-
truncated: boolean(),
|
|
15822
|
-
dropped: array(string())
|
|
15823
|
-
});
|
|
15824
|
-
var SendResultSchema = object({
|
|
15825
|
-
success: boolean(),
|
|
15826
|
-
error: string().optional(),
|
|
15827
|
-
renderedAs: RenderedAsSchema.optional()
|
|
15828
|
-
});
|
|
15829
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
15830
|
-
var TestResultSchema = SendResultSchema;
|
|
15831
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
15832
|
-
kind: string(),
|
|
15833
|
-
config: record(string(), unknown()).optional()
|
|
15834
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
15835
|
-
targetId: string(),
|
|
15836
|
-
notification: NotificationSchema
|
|
15837
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
15838
|
-
targetId: string(),
|
|
15839
|
-
sample: NotificationSchema.optional()
|
|
15840
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
15841
|
-
targetId: string(),
|
|
15842
|
-
enabled: boolean()
|
|
15843
|
-
}), _void(), { kind: "mutation" });
|
|
16536
|
+
url: string(),
|
|
16537
|
+
kind: BrokerKindSchema,
|
|
16538
|
+
status: BrokerStatusSchema$1,
|
|
16539
|
+
latencyMs: number().nullable(),
|
|
16540
|
+
error: string().optional(),
|
|
16541
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
16542
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
16543
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
16544
|
+
lastCheckedAt: number().optional()
|
|
16545
|
+
});
|
|
15844
16546
|
/**
|
|
15845
|
-
*
|
|
15846
|
-
*
|
|
15847
|
-
*
|
|
15848
|
-
*
|
|
15849
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15850
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
15851
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
16547
|
+
* Connection details — what a consumer needs to call
|
|
16548
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
16549
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
16550
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
15852
16551
|
*/
|
|
15853
|
-
var
|
|
15854
|
-
|
|
15855
|
-
|
|
16552
|
+
var BrokerConnectionDetailsSchema = object({
|
|
16553
|
+
url: string(),
|
|
16554
|
+
username: string().optional(),
|
|
16555
|
+
password: string().optional(),
|
|
16556
|
+
/**
|
|
16557
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
16558
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
16559
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
16560
|
+
* broker).
|
|
16561
|
+
*/
|
|
16562
|
+
clientIdPrefix: string().optional()
|
|
15856
16563
|
});
|
|
15857
|
-
var
|
|
15858
|
-
|
|
15859
|
-
"
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
]);
|
|
15868
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
16564
|
+
var AddBrokerInputSchema = object({
|
|
16565
|
+
name: string().min(1),
|
|
16566
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
16567
|
+
username: string().optional(),
|
|
16568
|
+
password: string().optional(),
|
|
16569
|
+
clientIdPrefix: string().optional()
|
|
16570
|
+
});
|
|
16571
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
16572
|
+
var IdInputSchema = object({ id: string() });
|
|
16573
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
15869
16574
|
ok: literal(true),
|
|
15870
|
-
text: string(),
|
|
15871
|
-
model: string(),
|
|
15872
|
-
usage: LlmUsageSchema,
|
|
15873
|
-
truncated: boolean(),
|
|
15874
16575
|
latencyMs: number()
|
|
15875
16576
|
}), object({
|
|
15876
16577
|
ok: literal(false),
|
|
15877
|
-
|
|
15878
|
-
message: string(),
|
|
15879
|
-
retryAfterMs: number().optional()
|
|
16578
|
+
error: string()
|
|
15880
16579
|
})]);
|
|
15881
|
-
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
*/
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
mimeType: string()
|
|
16580
|
+
var StartEmbeddedInputSchema = object({
|
|
16581
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
16582
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
16583
|
+
allowAnonymous: boolean().default(false),
|
|
16584
|
+
/** Optional shared username/password for clients. */
|
|
16585
|
+
username: string().optional(),
|
|
16586
|
+
password: string().optional()
|
|
15889
16587
|
});
|
|
15890
|
-
var
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15894
|
-
profileId: string().optional(),
|
|
15895
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15896
|
-
consumer: string(),
|
|
15897
|
-
system: string().optional(),
|
|
15898
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15899
|
-
prompt: string(),
|
|
15900
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15901
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
15902
|
-
/** Per-call override of the profile default. */
|
|
15903
|
-
maxTokens: number().int().positive().optional(),
|
|
15904
|
-
temperature: number().optional()
|
|
16588
|
+
var StartEmbeddedResultSchema = object({
|
|
16589
|
+
id: string(),
|
|
16590
|
+
url: string()
|
|
15905
16591
|
});
|
|
15906
|
-
|
|
15907
|
-
|
|
15908
|
-
|
|
15909
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15910
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15911
|
-
* this only through the `llm` cap's methods.
|
|
15912
|
-
*
|
|
15913
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15914
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15915
|
-
* watchdog — operator decision #3).
|
|
15916
|
-
*/
|
|
15917
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15918
|
-
object({
|
|
15919
|
-
kind: literal("catalog"),
|
|
15920
|
-
catalogId: string()
|
|
15921
|
-
}),
|
|
15922
|
-
object({
|
|
15923
|
-
kind: literal("url"),
|
|
15924
|
-
url: string(),
|
|
15925
|
-
sha256: string().optional()
|
|
15926
|
-
}),
|
|
15927
|
-
object({
|
|
15928
|
-
kind: literal("path"),
|
|
15929
|
-
path: string()
|
|
15930
|
-
})
|
|
15931
|
-
]);
|
|
15932
|
-
var ManagedRuntimeConfigSchema = object({
|
|
15933
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
15934
|
-
nodeId: string(),
|
|
15935
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15936
|
-
engine: _enum(["llama-cpp"]),
|
|
15937
|
-
model: ManagedModelRefSchema,
|
|
15938
|
-
contextSize: number().int().default(4096),
|
|
15939
|
-
/** 0 = CPU-only. */
|
|
15940
|
-
gpuLayers: number().int().default(0),
|
|
15941
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15942
|
-
threads: number().int().optional(),
|
|
15943
|
-
/** Concurrent slots. */
|
|
15944
|
-
parallel: number().int().default(1),
|
|
15945
|
-
/** Else lazy: first generate boots it. */
|
|
15946
|
-
autoStart: boolean().default(false),
|
|
15947
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
15948
|
-
idleStopMinutes: number().int().default(30)
|
|
16592
|
+
var StatusSchema = object({
|
|
16593
|
+
brokerCount: number(),
|
|
16594
|
+
embeddedRunning: boolean()
|
|
15949
16595
|
});
|
|
15950
|
-
var
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
"
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
16596
|
+
var mqttBrokerCapability = {
|
|
16597
|
+
name: "mqtt-broker",
|
|
16598
|
+
scope: "system",
|
|
16599
|
+
mode: "collection",
|
|
16600
|
+
providerKind: "broker",
|
|
16601
|
+
status: {
|
|
16602
|
+
schema: StatusSchema,
|
|
16603
|
+
kind: "poll"
|
|
16604
|
+
},
|
|
16605
|
+
methods: {
|
|
16606
|
+
listBrokers: method(_void(), array(BrokerInfoSchema)),
|
|
16607
|
+
getBrokerConfig: method(IdInputSchema, BrokerConnectionDetailsSchema),
|
|
16608
|
+
addBroker: method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }),
|
|
16609
|
+
removeBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
|
|
16610
|
+
testConnection: method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }),
|
|
16611
|
+
startEmbeddedBroker: method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }),
|
|
16612
|
+
stopEmbeddedBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
|
|
16613
|
+
getStatus: method(_void(), StatusSchema)
|
|
16614
|
+
}
|
|
16615
|
+
};
|
|
16616
|
+
var NetworkEndpointSchema = object({
|
|
16617
|
+
url: string(),
|
|
16618
|
+
hostname: string(),
|
|
16619
|
+
port: number(),
|
|
16620
|
+
protocol: _enum(["http", "https"])
|
|
15971
16621
|
});
|
|
15972
|
-
var
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
installedAt: number().optional()
|
|
16622
|
+
var NetworkAccessStatusSchema = object({
|
|
16623
|
+
connected: boolean(),
|
|
16624
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
16625
|
+
error: string().optional()
|
|
15977
16626
|
});
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
16627
|
+
/**
|
|
16628
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
16629
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
16630
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
16631
|
+
* the originating provider config (mode + sourcePort) so the
|
|
16632
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
16633
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
16634
|
+
*/
|
|
16635
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
16636
|
+
/**
|
|
16637
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
16638
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
16639
|
+
*/
|
|
16640
|
+
id: string(),
|
|
16641
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
16642
|
+
label: string(),
|
|
16643
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
16644
|
+
mode: string().optional(),
|
|
16645
|
+
/** Originating local port the ingress fronts (informational). */
|
|
16646
|
+
sourcePort: number().optional()
|
|
15982
16647
|
});
|
|
15983
|
-
method(
|
|
15984
|
-
images: array(LlmImageSchema).optional(),
|
|
15985
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
15986
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15987
|
-
timeoutMs: number().int().positive().optional()
|
|
15988
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15989
|
-
kind: "mutation",
|
|
15990
|
-
auth: "admin"
|
|
15991
|
-
}), method(object({}), _void(), {
|
|
15992
|
-
kind: "mutation",
|
|
15993
|
-
auth: "admin"
|
|
15994
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15995
|
-
kind: "mutation",
|
|
15996
|
-
auth: "admin"
|
|
15997
|
-
}), method(object({ file: string() }), _void(), {
|
|
15998
|
-
kind: "mutation",
|
|
15999
|
-
auth: "admin"
|
|
16000
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
16648
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
16001
16649
|
/**
|
|
16002
|
-
*
|
|
16003
|
-
*
|
|
16004
|
-
*
|
|
16005
|
-
*
|
|
16006
|
-
*
|
|
16650
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
16651
|
+
*
|
|
16652
|
+
* Apprise-derived model (see
|
|
16653
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
16654
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
16655
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16656
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
16657
|
+
* message to what the kind supports — callers never special-case a service.
|
|
16658
|
+
*
|
|
16659
|
+
* DESIGN DECISIONS (locked):
|
|
16660
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
16661
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
16662
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
16663
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
16664
|
+
* alternative would fork the UI per addon and cannot host the
|
|
16665
|
+
* discovery→adopt flow.
|
|
16666
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
16667
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
16668
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
16669
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
16670
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
16671
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
16672
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
16673
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
16674
|
+
* base64 fallback needed.
|
|
16007
16675
|
*
|
|
16008
|
-
*
|
|
16009
|
-
* `
|
|
16010
|
-
*
|
|
16676
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
16677
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
16678
|
+
* admin "Integrations" page.
|
|
16011
16679
|
*/
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
|
|
16015
|
-
|
|
16016
|
-
|
|
16017
|
-
"
|
|
16680
|
+
/**
|
|
16681
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
16682
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
16683
|
+
*/
|
|
16684
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
16685
|
+
"image",
|
|
16686
|
+
"video",
|
|
16687
|
+
"gif",
|
|
16688
|
+
"audio",
|
|
16689
|
+
"icon"
|
|
16018
16690
|
]);
|
|
16019
|
-
|
|
16691
|
+
/**
|
|
16692
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
16693
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
16694
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
16695
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
16696
|
+
*/
|
|
16697
|
+
var AttachmentSchema = object({
|
|
16698
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
16699
|
+
url: string().optional(),
|
|
16700
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
16701
|
+
mime: string().optional(),
|
|
16702
|
+
name: string().optional()
|
|
16703
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
16704
|
+
var NotificationFormatSchema = _enum([
|
|
16705
|
+
"text",
|
|
16706
|
+
"markdown",
|
|
16707
|
+
"html"
|
|
16708
|
+
]);
|
|
16709
|
+
/** A single tap-through action button. */
|
|
16710
|
+
var NotificationActionSchema = object({
|
|
16020
16711
|
id: string(),
|
|
16021
|
-
|
|
16022
|
-
|
|
16023
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
16024
|
-
addonId: string(),
|
|
16025
|
-
enabled: boolean(),
|
|
16026
|
-
/** Vendor model id, or the managed runtime's loaded model. */
|
|
16027
|
-
model: string(),
|
|
16028
|
-
/** Required for openai-compatible; override for cloud kinds. */
|
|
16029
|
-
baseUrl: string().optional(),
|
|
16030
|
-
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
16031
|
-
apiKey: string().optional(),
|
|
16032
|
-
supportsVision: boolean(),
|
|
16033
|
-
temperature: number().min(0).max(2).optional(),
|
|
16034
|
-
maxTokens: number().int().positive().optional(),
|
|
16035
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
16036
|
-
extraHeaders: record(string(), string()).optional(),
|
|
16037
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
16038
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
16712
|
+
label: string(),
|
|
16713
|
+
url: string().optional()
|
|
16039
16714
|
});
|
|
16040
|
-
/**
|
|
16041
|
-
*
|
|
16042
|
-
*
|
|
16715
|
+
/**
|
|
16716
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
16717
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
16718
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
16719
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
16720
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
16721
|
+
* `priority` for that one target.
|
|
16722
|
+
*/
|
|
16723
|
+
var NotificationSchema = object({
|
|
16724
|
+
body: string(),
|
|
16725
|
+
title: string().optional(),
|
|
16726
|
+
format: NotificationFormatSchema.default("text"),
|
|
16727
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16728
|
+
level: string().optional(),
|
|
16729
|
+
attachments: array(AttachmentSchema).optional(),
|
|
16730
|
+
clickUrl: string().optional(),
|
|
16731
|
+
actions: array(NotificationActionSchema).optional(),
|
|
16732
|
+
sound: string().optional(),
|
|
16733
|
+
ttl: number().optional(),
|
|
16734
|
+
tag: string().optional(),
|
|
16735
|
+
deviceId: number().optional(),
|
|
16736
|
+
eventId: string().optional(),
|
|
16737
|
+
metadata: record(string(), unknown()).optional()
|
|
16738
|
+
});
|
|
16739
|
+
/** One declared native severity/priority level for a kind. */
|
|
16740
|
+
var TargetKindLevelSchema = object({
|
|
16741
|
+
id: string(),
|
|
16742
|
+
label: string(),
|
|
16743
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
16744
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
16745
|
+
flags: object({
|
|
16746
|
+
critical: boolean().optional(),
|
|
16747
|
+
silent: boolean().optional(),
|
|
16748
|
+
noPush: boolean().optional()
|
|
16749
|
+
}).optional(),
|
|
16750
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
16751
|
+
requires: array(string()).optional(),
|
|
16752
|
+
description: string().optional()
|
|
16753
|
+
});
|
|
16754
|
+
/** The full capability block consulted before dispatch. */
|
|
16755
|
+
var TargetKindCapsSchema = object({
|
|
16756
|
+
attachments: object({
|
|
16757
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
16758
|
+
mode: _enum([
|
|
16759
|
+
"url",
|
|
16760
|
+
"bytes",
|
|
16761
|
+
"both"
|
|
16762
|
+
]),
|
|
16763
|
+
max: number().int().nonnegative(),
|
|
16764
|
+
maxBytes: number().int().positive().optional()
|
|
16765
|
+
}),
|
|
16766
|
+
/** Max action buttons (0 = none). */
|
|
16767
|
+
actions: number().int().nonnegative(),
|
|
16768
|
+
levels: array(TargetKindLevelSchema),
|
|
16769
|
+
format: array(NotificationFormatSchema),
|
|
16770
|
+
clickUrl: boolean(),
|
|
16771
|
+
sound: boolean(),
|
|
16772
|
+
ttl: boolean(),
|
|
16773
|
+
bodyMaxLen: number().int().positive()
|
|
16774
|
+
});
|
|
16775
|
+
/**
|
|
16776
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
16777
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
16778
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
16779
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
16780
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
16781
|
+
*/
|
|
16043
16782
|
var ConfigSchemaPassthrough = unknown();
|
|
16044
|
-
var
|
|
16045
|
-
kind:
|
|
16783
|
+
var TargetKindSchema = object({
|
|
16784
|
+
kind: string(),
|
|
16046
16785
|
label: string(),
|
|
16047
16786
|
icon: string(),
|
|
16048
16787
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16049
16788
|
addonId: string(),
|
|
16050
|
-
configSchema: ConfigSchemaPassthrough
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
var LlmDefaultSchema = object({
|
|
16054
|
-
selector: LlmDefaultSelectorSchema,
|
|
16055
|
-
profileId: string()
|
|
16056
|
-
});
|
|
16057
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
16058
|
-
var LlmUsageRollupSchema = object({
|
|
16059
|
-
day: string(),
|
|
16060
|
-
consumer: string(),
|
|
16061
|
-
profileId: string(),
|
|
16062
|
-
calls: number(),
|
|
16063
|
-
okCalls: number(),
|
|
16064
|
-
errorCalls: number(),
|
|
16065
|
-
inputTokens: number(),
|
|
16066
|
-
outputTokens: number(),
|
|
16067
|
-
avgLatencyMs: number()
|
|
16789
|
+
configSchema: ConfigSchemaPassthrough,
|
|
16790
|
+
supportsDiscovery: boolean(),
|
|
16791
|
+
caps: TargetKindCapsSchema
|
|
16068
16792
|
});
|
|
16069
|
-
/**
|
|
16070
|
-
|
|
16793
|
+
/**
|
|
16794
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
16795
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
16796
|
+
* round-trip a stored secret to the UI.
|
|
16797
|
+
*/
|
|
16798
|
+
var TargetSchema = object({
|
|
16071
16799
|
id: string(),
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
purpose: _enum(["text", "vision"]),
|
|
16075
|
-
url: string(),
|
|
16076
|
-
sha256: string(),
|
|
16077
|
-
sizeBytes: number(),
|
|
16078
|
-
quantization: string(),
|
|
16079
|
-
/** Load-time guidance shown in the picker. */
|
|
16080
|
-
minRamBytes: number(),
|
|
16081
|
-
contextSizeDefault: number().int(),
|
|
16082
|
-
/** Vision models: companion projector file. */
|
|
16083
|
-
mmprojUrl: string().optional()
|
|
16084
|
-
});
|
|
16085
|
-
var LlmRuntimeNodeSchema = object({
|
|
16086
|
-
nodeId: string(),
|
|
16087
|
-
reachable: boolean(),
|
|
16088
|
-
status: LlmRuntimeStatusSchema.optional(),
|
|
16089
|
-
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
16090
|
-
error: string().optional()
|
|
16091
|
-
});
|
|
16092
|
-
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
16093
|
-
var ProfileRefInputSchema = object({
|
|
16800
|
+
name: string(),
|
|
16801
|
+
kind: string(),
|
|
16094
16802
|
addonId: string(),
|
|
16095
|
-
|
|
16803
|
+
enabled: boolean(),
|
|
16804
|
+
config: record(string(), unknown())
|
|
16096
16805
|
});
|
|
16097
|
-
|
|
16098
|
-
|
|
16099
|
-
|
|
16100
|
-
|
|
16101
|
-
|
|
16102
|
-
|
|
16103
|
-
|
|
16104
|
-
|
|
16105
|
-
|
|
16106
|
-
|
|
16107
|
-
|
|
16108
|
-
|
|
16109
|
-
|
|
16110
|
-
|
|
16111
|
-
|
|
16112
|
-
|
|
16113
|
-
|
|
16114
|
-
|
|
16115
|
-
|
|
16116
|
-
profileId: string().optional()
|
|
16117
|
-
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16118
|
-
nodeId: string(),
|
|
16119
|
-
model: ManagedModelRefSchema
|
|
16120
|
-
}), _void(), {
|
|
16121
|
-
kind: "mutation",
|
|
16122
|
-
auth: "admin"
|
|
16123
|
-
}), method(object({
|
|
16124
|
-
nodeId: string(),
|
|
16125
|
-
file: string()
|
|
16126
|
-
}), _void(), {
|
|
16127
|
-
kind: "mutation",
|
|
16128
|
-
auth: "admin"
|
|
16129
|
-
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16130
|
-
kind: "mutation",
|
|
16131
|
-
auth: "admin"
|
|
16132
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
16133
|
-
kind: "mutation",
|
|
16134
|
-
auth: "admin"
|
|
16806
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
16807
|
+
var DiscoveredTargetSchema = object({
|
|
16808
|
+
kind: string(),
|
|
16809
|
+
suggestedName: string(),
|
|
16810
|
+
config: record(string(), unknown())
|
|
16811
|
+
});
|
|
16812
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
16813
|
+
var RenderedAsSchema = object({
|
|
16814
|
+
level: string(),
|
|
16815
|
+
format: NotificationFormatSchema,
|
|
16816
|
+
attachmentsSent: number().int().nonnegative(),
|
|
16817
|
+
actionsSent: number().int().nonnegative(),
|
|
16818
|
+
truncated: boolean(),
|
|
16819
|
+
dropped: array(string())
|
|
16820
|
+
});
|
|
16821
|
+
var SendResultSchema = object({
|
|
16822
|
+
success: boolean(),
|
|
16823
|
+
error: string().optional(),
|
|
16824
|
+
renderedAs: RenderedAsSchema.optional()
|
|
16135
16825
|
});
|
|
16826
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
16827
|
+
var TestResultSchema = SendResultSchema;
|
|
16828
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
16829
|
+
kind: string(),
|
|
16830
|
+
config: record(string(), unknown()).optional()
|
|
16831
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
16832
|
+
targetId: string(),
|
|
16833
|
+
notification: NotificationSchema
|
|
16834
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
16835
|
+
targetId: string(),
|
|
16836
|
+
sample: NotificationSchema.optional()
|
|
16837
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16838
|
+
targetId: string(),
|
|
16839
|
+
enabled: boolean()
|
|
16840
|
+
}), _void(), { kind: "mutation" });
|
|
16136
16841
|
/**
|
|
16137
16842
|
* Zod schemas for persisted record types.
|
|
16138
16843
|
*
|
|
@@ -16818,7 +17523,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16818
17523
|
}), method(object({
|
|
16819
17524
|
eventId: string(),
|
|
16820
17525
|
kind: MediaFileKindEnum.optional()
|
|
16821
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
17526
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
17527
|
+
trackId: string(),
|
|
17528
|
+
kinds: array(MediaFileKindEnum).optional()
|
|
17529
|
+
}), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
|
|
16822
17530
|
deviceId: number(),
|
|
16823
17531
|
timestamp: number(),
|
|
16824
17532
|
frameWidth: number(),
|
|
@@ -16839,76 +17547,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16839
17547
|
eventId: string(),
|
|
16840
17548
|
timestamp: number()
|
|
16841
17549
|
});
|
|
16842
|
-
/**
|
|
16843
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
16844
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
16845
|
-
* caps into per-camera event-kind descriptors.
|
|
16846
|
-
*
|
|
16847
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
16848
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
16849
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
16850
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
16851
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
16852
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
16853
|
-
* eventful cap is missing.
|
|
16854
|
-
*/
|
|
16855
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
16856
|
-
var LEGACY_ICON = {
|
|
16857
|
-
motion: "motion",
|
|
16858
|
-
audio: "audio",
|
|
16859
|
-
person: "person",
|
|
16860
|
-
vehicle: "vehicle",
|
|
16861
|
-
animal: "animal",
|
|
16862
|
-
package: "package",
|
|
16863
|
-
door: "door",
|
|
16864
|
-
pir: "pir",
|
|
16865
|
-
smoke: "smoke",
|
|
16866
|
-
water: "water",
|
|
16867
|
-
button: "button",
|
|
16868
|
-
generic: "generic",
|
|
16869
|
-
gas: "smoke",
|
|
16870
|
-
vibration: "generic",
|
|
16871
|
-
tamper: "generic",
|
|
16872
|
-
presence: "person",
|
|
16873
|
-
lock: "generic",
|
|
16874
|
-
siren: "generic",
|
|
16875
|
-
switch: "generic",
|
|
16876
|
-
doorbell: "button"
|
|
16877
|
-
};
|
|
16878
|
-
function legacyIcon(iconId) {
|
|
16879
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
16880
|
-
}
|
|
16881
|
-
/**
|
|
16882
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
16883
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
16884
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
16885
|
-
*/
|
|
16886
|
-
var CAP_TO_KIND = {
|
|
16887
|
-
contact: "contact",
|
|
16888
|
-
motion: "motion-sensor",
|
|
16889
|
-
smoke: "smoke",
|
|
16890
|
-
flood: "flood",
|
|
16891
|
-
gas: "gas",
|
|
16892
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
16893
|
-
vibration: "vibration",
|
|
16894
|
-
tamper: "tamper",
|
|
16895
|
-
presence: "presence",
|
|
16896
|
-
"enum-sensor": "enum-sensor",
|
|
16897
|
-
"event-emitter": "device-event",
|
|
16898
|
-
"lock-control": "lock",
|
|
16899
|
-
switch: "switch",
|
|
16900
|
-
button: "button",
|
|
16901
|
-
doorbell: "doorbell"
|
|
16902
|
-
};
|
|
16903
|
-
function buildDescriptor(capName, kind) {
|
|
16904
|
-
const t = EVENT_TAXONOMY[kind];
|
|
16905
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
16906
|
-
return {
|
|
16907
|
-
...t,
|
|
16908
|
-
icon: legacyIcon(t.iconId)
|
|
16909
|
-
};
|
|
16910
|
-
}
|
|
16911
|
-
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
16912
17550
|
var CameraPipelineConfigSchema = object({
|
|
16913
17551
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
16914
17552
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -17394,6 +18032,76 @@ method(object({
|
|
|
17394
18032
|
auth: "admin"
|
|
17395
18033
|
});
|
|
17396
18034
|
/**
|
|
18035
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
18036
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
18037
|
+
* caps into per-camera event-kind descriptors.
|
|
18038
|
+
*
|
|
18039
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
18040
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
18041
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
18042
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
18043
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
18044
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
18045
|
+
* eventful cap is missing.
|
|
18046
|
+
*/
|
|
18047
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
18048
|
+
var LEGACY_ICON = {
|
|
18049
|
+
motion: "motion",
|
|
18050
|
+
audio: "audio",
|
|
18051
|
+
person: "person",
|
|
18052
|
+
vehicle: "vehicle",
|
|
18053
|
+
animal: "animal",
|
|
18054
|
+
package: "package",
|
|
18055
|
+
door: "door",
|
|
18056
|
+
pir: "pir",
|
|
18057
|
+
smoke: "smoke",
|
|
18058
|
+
water: "water",
|
|
18059
|
+
button: "button",
|
|
18060
|
+
generic: "generic",
|
|
18061
|
+
gas: "smoke",
|
|
18062
|
+
vibration: "generic",
|
|
18063
|
+
tamper: "generic",
|
|
18064
|
+
presence: "person",
|
|
18065
|
+
lock: "generic",
|
|
18066
|
+
siren: "generic",
|
|
18067
|
+
switch: "generic",
|
|
18068
|
+
doorbell: "button"
|
|
18069
|
+
};
|
|
18070
|
+
function legacyIcon(iconId) {
|
|
18071
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
18072
|
+
}
|
|
18073
|
+
/**
|
|
18074
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
18075
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
18076
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
18077
|
+
*/
|
|
18078
|
+
var CAP_TO_KIND = {
|
|
18079
|
+
contact: "contact",
|
|
18080
|
+
motion: "motion-sensor",
|
|
18081
|
+
smoke: "smoke",
|
|
18082
|
+
flood: "flood",
|
|
18083
|
+
gas: "gas",
|
|
18084
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
18085
|
+
vibration: "vibration",
|
|
18086
|
+
tamper: "tamper",
|
|
18087
|
+
presence: "presence",
|
|
18088
|
+
"enum-sensor": "enum-sensor",
|
|
18089
|
+
"event-emitter": "device-event",
|
|
18090
|
+
"lock-control": "lock",
|
|
18091
|
+
switch: "switch",
|
|
18092
|
+
button: "button",
|
|
18093
|
+
doorbell: "doorbell"
|
|
18094
|
+
};
|
|
18095
|
+
function buildDescriptor(capName, kind) {
|
|
18096
|
+
const t = EVENT_TAXONOMY[kind];
|
|
18097
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
18098
|
+
return {
|
|
18099
|
+
...t,
|
|
18100
|
+
icon: legacyIcon(t.iconId)
|
|
18101
|
+
};
|
|
18102
|
+
}
|
|
18103
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
18104
|
+
/**
|
|
17397
18105
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
17398
18106
|
* package lifecycle (runtime-updatable node packages).
|
|
17399
18107
|
*
|
|
@@ -18848,7 +19556,28 @@ var FaceInfoSchema = object({
|
|
|
18848
19556
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
18849
19557
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
18850
19558
|
* back to the inline `base64` face crop. */
|
|
18851
|
-
keyFrameMediaKey: string().optional()
|
|
19559
|
+
keyFrameMediaKey: string().optional(),
|
|
19560
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
19561
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
19562
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
19563
|
+
* faces that were never auto-recognized. */
|
|
19564
|
+
bestMatchScore: number().optional(),
|
|
19565
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
19566
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
19567
|
+
* legacy rows / runners that reported no native measure. */
|
|
19568
|
+
nativeFaceShortSidePx: number().optional(),
|
|
19569
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
19570
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
19571
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
19572
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
19573
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
19574
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
19575
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
19576
|
+
suggestedIdentityId: string().optional(),
|
|
19577
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
19578
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
19579
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
19580
|
+
suggestedMatchScore: number().optional()
|
|
18852
19581
|
});
|
|
18853
19582
|
var FaceFilterEnum = _enum([
|
|
18854
19583
|
"unassigned",
|
|
@@ -20891,36 +21620,6 @@ Object.freeze({
|
|
|
20891
21620
|
addonId: null,
|
|
20892
21621
|
access: "view"
|
|
20893
21622
|
},
|
|
20894
|
-
"advancedNotifier.deleteRule": {
|
|
20895
|
-
capName: "advanced-notifier",
|
|
20896
|
-
capScope: "system",
|
|
20897
|
-
addonId: null,
|
|
20898
|
-
access: "delete"
|
|
20899
|
-
},
|
|
20900
|
-
"advancedNotifier.getHistory": {
|
|
20901
|
-
capName: "advanced-notifier",
|
|
20902
|
-
capScope: "system",
|
|
20903
|
-
addonId: null,
|
|
20904
|
-
access: "view"
|
|
20905
|
-
},
|
|
20906
|
-
"advancedNotifier.getRules": {
|
|
20907
|
-
capName: "advanced-notifier",
|
|
20908
|
-
capScope: "system",
|
|
20909
|
-
addonId: null,
|
|
20910
|
-
access: "view"
|
|
20911
|
-
},
|
|
20912
|
-
"advancedNotifier.testRule": {
|
|
20913
|
-
capName: "advanced-notifier",
|
|
20914
|
-
capScope: "system",
|
|
20915
|
-
addonId: null,
|
|
20916
|
-
access: "create"
|
|
20917
|
-
},
|
|
20918
|
-
"advancedNotifier.upsertRule": {
|
|
20919
|
-
capName: "advanced-notifier",
|
|
20920
|
-
capScope: "system",
|
|
20921
|
-
addonId: null,
|
|
20922
|
-
access: "create"
|
|
20923
|
-
},
|
|
20924
21623
|
"alarmPanel.arm": {
|
|
20925
21624
|
capName: "alarm-panel",
|
|
20926
21625
|
capScope: "device",
|
|
@@ -21143,6 +21842,12 @@ Object.freeze({
|
|
|
21143
21842
|
addonId: null,
|
|
21144
21843
|
access: "delete"
|
|
21145
21844
|
},
|
|
21845
|
+
"backup.deleteSchedule": {
|
|
21846
|
+
capName: "backup",
|
|
21847
|
+
capScope: "system",
|
|
21848
|
+
addonId: null,
|
|
21849
|
+
access: "delete"
|
|
21850
|
+
},
|
|
21146
21851
|
"backup.getEntries": {
|
|
21147
21852
|
capName: "backup",
|
|
21148
21853
|
capScope: "system",
|
|
@@ -21173,6 +21878,12 @@ Object.freeze({
|
|
|
21173
21878
|
addonId: null,
|
|
21174
21879
|
access: "view"
|
|
21175
21880
|
},
|
|
21881
|
+
"backup.listSchedules": {
|
|
21882
|
+
capName: "backup",
|
|
21883
|
+
capScope: "system",
|
|
21884
|
+
addonId: null,
|
|
21885
|
+
access: "view"
|
|
21886
|
+
},
|
|
21176
21887
|
"backup.previewSchedule": {
|
|
21177
21888
|
capName: "backup",
|
|
21178
21889
|
capScope: "system",
|
|
@@ -21197,6 +21908,12 @@ Object.freeze({
|
|
|
21197
21908
|
addonId: null,
|
|
21198
21909
|
access: "create"
|
|
21199
21910
|
},
|
|
21911
|
+
"backup.upsertSchedule": {
|
|
21912
|
+
capName: "backup",
|
|
21913
|
+
capScope: "system",
|
|
21914
|
+
addonId: null,
|
|
21915
|
+
access: "create"
|
|
21916
|
+
},
|
|
21200
21917
|
"battery.wakeForStream": {
|
|
21201
21918
|
capName: "battery",
|
|
21202
21919
|
capScope: "device",
|
|
@@ -23225,6 +23942,60 @@ Object.freeze({
|
|
|
23225
23942
|
addonId: null,
|
|
23226
23943
|
access: "create"
|
|
23227
23944
|
},
|
|
23945
|
+
"notificationRules.createRule": {
|
|
23946
|
+
capName: "notification-rules",
|
|
23947
|
+
capScope: "system",
|
|
23948
|
+
addonId: null,
|
|
23949
|
+
access: "create"
|
|
23950
|
+
},
|
|
23951
|
+
"notificationRules.deleteRule": {
|
|
23952
|
+
capName: "notification-rules",
|
|
23953
|
+
capScope: "system",
|
|
23954
|
+
addonId: null,
|
|
23955
|
+
access: "delete"
|
|
23956
|
+
},
|
|
23957
|
+
"notificationRules.getConditionCatalog": {
|
|
23958
|
+
capName: "notification-rules",
|
|
23959
|
+
capScope: "system",
|
|
23960
|
+
addonId: null,
|
|
23961
|
+
access: "view"
|
|
23962
|
+
},
|
|
23963
|
+
"notificationRules.getHistory": {
|
|
23964
|
+
capName: "notification-rules",
|
|
23965
|
+
capScope: "system",
|
|
23966
|
+
addonId: null,
|
|
23967
|
+
access: "view"
|
|
23968
|
+
},
|
|
23969
|
+
"notificationRules.getRule": {
|
|
23970
|
+
capName: "notification-rules",
|
|
23971
|
+
capScope: "system",
|
|
23972
|
+
addonId: null,
|
|
23973
|
+
access: "view"
|
|
23974
|
+
},
|
|
23975
|
+
"notificationRules.listRules": {
|
|
23976
|
+
capName: "notification-rules",
|
|
23977
|
+
capScope: "system",
|
|
23978
|
+
addonId: null,
|
|
23979
|
+
access: "view"
|
|
23980
|
+
},
|
|
23981
|
+
"notificationRules.setRuleEnabled": {
|
|
23982
|
+
capName: "notification-rules",
|
|
23983
|
+
capScope: "system",
|
|
23984
|
+
addonId: null,
|
|
23985
|
+
access: "create"
|
|
23986
|
+
},
|
|
23987
|
+
"notificationRules.testRule": {
|
|
23988
|
+
capName: "notification-rules",
|
|
23989
|
+
capScope: "system",
|
|
23990
|
+
addonId: null,
|
|
23991
|
+
access: "create"
|
|
23992
|
+
},
|
|
23993
|
+
"notificationRules.updateRule": {
|
|
23994
|
+
capName: "notification-rules",
|
|
23995
|
+
capScope: "system",
|
|
23996
|
+
addonId: null,
|
|
23997
|
+
access: "create"
|
|
23998
|
+
},
|
|
23228
23999
|
"notifier.cancel": {
|
|
23229
24000
|
capName: "notifier",
|
|
23230
24001
|
capScope: "device",
|
|
@@ -24977,6 +25748,36 @@ Object.freeze({
|
|
|
24977
25748
|
addonId: null,
|
|
24978
25749
|
access: "create"
|
|
24979
25750
|
},
|
|
25751
|
+
"terminalSession.close": {
|
|
25752
|
+
capName: "terminal-session",
|
|
25753
|
+
capScope: "system",
|
|
25754
|
+
addonId: null,
|
|
25755
|
+
access: "create"
|
|
25756
|
+
},
|
|
25757
|
+
"terminalSession.listProfiles": {
|
|
25758
|
+
capName: "terminal-session",
|
|
25759
|
+
capScope: "system",
|
|
25760
|
+
addonId: null,
|
|
25761
|
+
access: "view"
|
|
25762
|
+
},
|
|
25763
|
+
"terminalSession.listSessions": {
|
|
25764
|
+
capName: "terminal-session",
|
|
25765
|
+
capScope: "system",
|
|
25766
|
+
addonId: null,
|
|
25767
|
+
access: "view"
|
|
25768
|
+
},
|
|
25769
|
+
"terminalSession.openSession": {
|
|
25770
|
+
capName: "terminal-session",
|
|
25771
|
+
capScope: "system",
|
|
25772
|
+
addonId: null,
|
|
25773
|
+
access: "create"
|
|
25774
|
+
},
|
|
25775
|
+
"terminalSession.resize": {
|
|
25776
|
+
capName: "terminal-session",
|
|
25777
|
+
capScope: "system",
|
|
25778
|
+
addonId: null,
|
|
25779
|
+
access: "create"
|
|
25780
|
+
},
|
|
24980
25781
|
"toast.onToast": {
|
|
24981
25782
|
capName: "toast",
|
|
24982
25783
|
capScope: "system",
|