@camstack/addon-static-turn 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/static-turn.addon.js +1907 -1106
- package/dist/static-turn.addon.mjs +1907 -1106
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
//#region ../types/dist/event-category-
|
|
2
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
3
3
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4
4
|
EventCategory["SystemBoot"] = "system.boot";
|
|
5
5
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -149,9 +149,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
149
149
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
150
150
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
151
151
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
152
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
153
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
154
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
155
152
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
156
153
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
157
154
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -6816,7 +6813,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
|
6816
6813
|
patch: record(string(), unknown())
|
|
6817
6814
|
}), object({ success: literal(true) });
|
|
6818
6815
|
object({ deviceId: number() }), unknown().nullable();
|
|
6819
|
-
/** Shorthand to define a method schema */
|
|
6820
6816
|
function method(input, output, options) {
|
|
6821
6817
|
return {
|
|
6822
6818
|
input,
|
|
@@ -6824,6 +6820,7 @@ function method(input, output, options) {
|
|
|
6824
6820
|
kind: options?.kind ?? "query",
|
|
6825
6821
|
auth: options?.auth ?? "protected",
|
|
6826
6822
|
...options?.access !== void 0 ? { access: options.access } : {},
|
|
6823
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
6827
6824
|
timeoutMs: options?.timeoutMs
|
|
6828
6825
|
};
|
|
6829
6826
|
}
|
|
@@ -7505,16 +7502,23 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7505
7502
|
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7506
7503
|
* FRESH install:
|
|
7507
7504
|
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7508
|
-
* the appData volume. Right for small/durable data (
|
|
7505
|
+
* the appData volume. Right for small/durable data (logs, models).
|
|
7509
7506
|
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7510
7507
|
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7511
7508
|
* (recordings, event media) that should stay off the appData disk.
|
|
7509
|
+
* - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
|
|
7510
|
+
* `/backups` in the image) so archives live on their own mount rather than
|
|
7511
|
+
* filling the appData disk. Falls back to the data root when unset.
|
|
7512
7512
|
*
|
|
7513
7513
|
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7514
7514
|
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7515
7515
|
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7516
7516
|
*/
|
|
7517
|
-
defaultRoot: _enum([
|
|
7517
|
+
defaultRoot: _enum([
|
|
7518
|
+
"data",
|
|
7519
|
+
"media",
|
|
7520
|
+
"backup"
|
|
7521
|
+
]).optional()
|
|
7518
7522
|
});
|
|
7519
7523
|
var DecoderStatsSchema = object({
|
|
7520
7524
|
inputFps: number(),
|
|
@@ -8177,6 +8181,59 @@ for (const l of AUDIO_MACRO_LABELS) {
|
|
|
8177
8181
|
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8178
8182
|
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8179
8183
|
/**
|
|
8184
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8185
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8186
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8187
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8188
|
+
*
|
|
8189
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8190
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8191
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8192
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8193
|
+
* the same class picker, grouped under an Audio header.
|
|
8194
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8195
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8196
|
+
*
|
|
8197
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8198
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8199
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8200
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8201
|
+
*/
|
|
8202
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8203
|
+
var NcTaxonomyEntrySchema = object({
|
|
8204
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8205
|
+
kind: string(),
|
|
8206
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8207
|
+
label: string(),
|
|
8208
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8209
|
+
parentKind: string().nullable()
|
|
8210
|
+
});
|
|
8211
|
+
object({
|
|
8212
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8213
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8214
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8215
|
+
});
|
|
8216
|
+
function toEntry(kind, label, parentKind) {
|
|
8217
|
+
return {
|
|
8218
|
+
kind,
|
|
8219
|
+
label,
|
|
8220
|
+
parentKind
|
|
8221
|
+
};
|
|
8222
|
+
}
|
|
8223
|
+
/**
|
|
8224
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8225
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8226
|
+
*/
|
|
8227
|
+
function buildNcTaxonomy() {
|
|
8228
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8229
|
+
return {
|
|
8230
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8231
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8232
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8233
|
+
};
|
|
8234
|
+
}
|
|
8235
|
+
Object.freeze(buildNcTaxonomy());
|
|
8236
|
+
/**
|
|
8180
8237
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8181
8238
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8182
8239
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -8812,6 +8869,644 @@ var AccessoryKind = {
|
|
|
8812
8869
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
8813
8870
|
DeviceFeature.BatteryOperated;
|
|
8814
8871
|
/**
|
|
8872
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
8873
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
8874
|
+
* language so a single drawing-plane editor and the providers stay
|
|
8875
|
+
* decoupled from each cap's storage.
|
|
8876
|
+
*
|
|
8877
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
8878
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
8879
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
8880
|
+
*/
|
|
8881
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
8882
|
+
var MaskPointSchema = object({
|
|
8883
|
+
x: number(),
|
|
8884
|
+
y: number()
|
|
8885
|
+
});
|
|
8886
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
8887
|
+
var MaskRectShapeSchema = object({
|
|
8888
|
+
kind: literal("rect"),
|
|
8889
|
+
x: number(),
|
|
8890
|
+
y: number(),
|
|
8891
|
+
width: number(),
|
|
8892
|
+
height: number()
|
|
8893
|
+
});
|
|
8894
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
8895
|
+
var MaskPolygonShapeSchema = object({
|
|
8896
|
+
kind: literal("polygon"),
|
|
8897
|
+
points: array(MaskPointSchema)
|
|
8898
|
+
});
|
|
8899
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
8900
|
+
var MaskGridShapeSchema = object({
|
|
8901
|
+
kind: literal("grid"),
|
|
8902
|
+
gridWidth: number(),
|
|
8903
|
+
gridHeight: number(),
|
|
8904
|
+
cells: array(boolean())
|
|
8905
|
+
});
|
|
8906
|
+
discriminatedUnion("kind", [
|
|
8907
|
+
MaskRectShapeSchema,
|
|
8908
|
+
MaskPolygonShapeSchema,
|
|
8909
|
+
MaskGridShapeSchema,
|
|
8910
|
+
object({
|
|
8911
|
+
kind: literal("line"),
|
|
8912
|
+
points: array(MaskPointSchema)
|
|
8913
|
+
})
|
|
8914
|
+
]);
|
|
8915
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
8916
|
+
var MaskShapeKindSchema = _enum([
|
|
8917
|
+
"rect",
|
|
8918
|
+
"polygon",
|
|
8919
|
+
"grid",
|
|
8920
|
+
"line"
|
|
8921
|
+
]);
|
|
8922
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
8923
|
+
var MaskPolygonVerticesSchema = object({
|
|
8924
|
+
min: number(),
|
|
8925
|
+
max: number()
|
|
8926
|
+
});
|
|
8927
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
8928
|
+
var MaskGridDimsSchema = object({
|
|
8929
|
+
width: number(),
|
|
8930
|
+
height: number()
|
|
8931
|
+
});
|
|
8932
|
+
/**
|
|
8933
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
8934
|
+
*
|
|
8935
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
8936
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
8937
|
+
*
|
|
8938
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
8939
|
+
* `notification-center` module), hooked on the durable persistence
|
|
8940
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
8941
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
8942
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
8943
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
8944
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
8945
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
8946
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
8947
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
8948
|
+
* target kind's own caps/degrade engine).
|
|
8949
|
+
*
|
|
8950
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
8951
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
8952
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
8953
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
8954
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
8955
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
8956
|
+
* P2+ (see spec §7).
|
|
8957
|
+
*
|
|
8958
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
8959
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
8960
|
+
* schema/interface drift is explicitly not repeated).
|
|
8961
|
+
*/
|
|
8962
|
+
/**
|
|
8963
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
8964
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
8965
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
8966
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
8967
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
8968
|
+
* change of a LINKED device, one row per linked camera)
|
|
8969
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
8970
|
+
* delivery / pick-up)
|
|
8971
|
+
*
|
|
8972
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
8973
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
8974
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
8975
|
+
* one trigger.
|
|
8976
|
+
*/
|
|
8977
|
+
var NcDeliverySchema = _enum([
|
|
8978
|
+
"immediate",
|
|
8979
|
+
"track-end",
|
|
8980
|
+
"device-event",
|
|
8981
|
+
"package-event"
|
|
8982
|
+
]);
|
|
8983
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
8984
|
+
var NcScheduleSchema = object({
|
|
8985
|
+
windows: array(object({
|
|
8986
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
8987
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
8988
|
+
startMinute: number().int().min(0).max(1439),
|
|
8989
|
+
endMinute: number().int().min(0).max(1439)
|
|
8990
|
+
})).min(1),
|
|
8991
|
+
/** IANA timezone; default = hub host timezone. */
|
|
8992
|
+
timezone: string().optional(),
|
|
8993
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
8994
|
+
invert: boolean().optional()
|
|
8995
|
+
});
|
|
8996
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
8997
|
+
var NcPlateMatcherSchema = object({
|
|
8998
|
+
values: array(string().min(1)).min(1),
|
|
8999
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9000
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9001
|
+
});
|
|
9002
|
+
/**
|
|
9003
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9004
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9005
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9006
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9007
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9008
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9009
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9010
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9011
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9012
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9013
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9014
|
+
*/
|
|
9015
|
+
var NcOccupancyConditionSchema = object({
|
|
9016
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9017
|
+
zoneId: string().optional(),
|
|
9018
|
+
/** Object class to count; absent = any class. */
|
|
9019
|
+
className: string().optional(),
|
|
9020
|
+
op: _enum([
|
|
9021
|
+
"became-occupied",
|
|
9022
|
+
"became-free",
|
|
9023
|
+
">=",
|
|
9024
|
+
"<="
|
|
9025
|
+
]).default("became-occupied"),
|
|
9026
|
+
count: number().int().min(0).default(1),
|
|
9027
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9028
|
+
});
|
|
9029
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9030
|
+
var NcZoneConditionSchema = object({
|
|
9031
|
+
ids: array(string().min(1)).min(1),
|
|
9032
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9033
|
+
match: _enum(["any", "all"]).default("any")
|
|
9034
|
+
});
|
|
9035
|
+
/**
|
|
9036
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9037
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9038
|
+
*/
|
|
9039
|
+
var NcConditionsSchema = object({
|
|
9040
|
+
/** Device scope — absent = all devices. */
|
|
9041
|
+
devices: array(number()).optional(),
|
|
9042
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9043
|
+
classes: array(string().min(1)).optional(),
|
|
9044
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9045
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9046
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9047
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9048
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9049
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9050
|
+
/** Veto zones — any hit fails the rule. */
|
|
9051
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
9052
|
+
/**
|
|
9053
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9054
|
+
* (identity name / plate text / subclass).
|
|
9055
|
+
*/
|
|
9056
|
+
labelEquals: array(string().min(1)).optional(),
|
|
9057
|
+
/**
|
|
9058
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9059
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9060
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
9061
|
+
*/
|
|
9062
|
+
identities: array(string().min(1)).optional(),
|
|
9063
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9064
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
9065
|
+
/**
|
|
9066
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9067
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9068
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9069
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
9070
|
+
*/
|
|
9071
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
9072
|
+
/**
|
|
9073
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9074
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9075
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9076
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9077
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9078
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9079
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9080
|
+
*/
|
|
9081
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9082
|
+
/**
|
|
9083
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9084
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9085
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9086
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9087
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9088
|
+
*/
|
|
9089
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9090
|
+
/**
|
|
9091
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9092
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9093
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9094
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9095
|
+
* tracks carry `sensor`.
|
|
9096
|
+
*/
|
|
9097
|
+
source: _enum([
|
|
9098
|
+
"pipeline",
|
|
9099
|
+
"onboard",
|
|
9100
|
+
"sensor",
|
|
9101
|
+
"any"
|
|
9102
|
+
]).optional(),
|
|
9103
|
+
/**
|
|
9104
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9105
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9106
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9107
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9108
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9109
|
+
*
|
|
9110
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9111
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9112
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9113
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9114
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9115
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9116
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9117
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9118
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9119
|
+
* closed for it (an un-recognized subject).
|
|
9120
|
+
*/
|
|
9121
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9122
|
+
/**
|
|
9123
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9124
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9125
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9126
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9127
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9128
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9129
|
+
*/
|
|
9130
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9131
|
+
/**
|
|
9132
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9133
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9134
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9135
|
+
*/
|
|
9136
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9137
|
+
/**
|
|
9138
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9139
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9140
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9141
|
+
* on the package-event trigger).
|
|
9142
|
+
*/
|
|
9143
|
+
packagePhase: _enum([
|
|
9144
|
+
"delivered",
|
|
9145
|
+
"picked-up",
|
|
9146
|
+
"both"
|
|
9147
|
+
]).optional(),
|
|
9148
|
+
/**
|
|
9149
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9150
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9151
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9152
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9153
|
+
*/
|
|
9154
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9155
|
+
/**
|
|
9156
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9157
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9158
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9159
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9160
|
+
*/
|
|
9161
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9162
|
+
});
|
|
9163
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9164
|
+
var NcRuleTargetSchema = object({
|
|
9165
|
+
/** `notification-output` Target id. */
|
|
9166
|
+
targetId: string().min(1),
|
|
9167
|
+
/**
|
|
9168
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9169
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9170
|
+
* degrade engine drops what the backend can't render.
|
|
9171
|
+
*/
|
|
9172
|
+
params: record(string(), unknown()).optional()
|
|
9173
|
+
});
|
|
9174
|
+
/**
|
|
9175
|
+
* Media attachment policy (P1 still-image subset).
|
|
9176
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9177
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9178
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9179
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9180
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9181
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9182
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9183
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9184
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9185
|
+
* - `none` — no attachment.
|
|
9186
|
+
*/
|
|
9187
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9188
|
+
"best",
|
|
9189
|
+
"best-matching",
|
|
9190
|
+
"keyFrame",
|
|
9191
|
+
"none"
|
|
9192
|
+
]).default("best") });
|
|
9193
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9194
|
+
var NcThrottleSchema = object({
|
|
9195
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9196
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9197
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9198
|
+
});
|
|
9199
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9200
|
+
var NcRuleInputSchema = object({
|
|
9201
|
+
name: string().min(1).max(200),
|
|
9202
|
+
enabled: boolean().default(true),
|
|
9203
|
+
delivery: NcDeliverySchema,
|
|
9204
|
+
conditions: NcConditionsSchema.default({}),
|
|
9205
|
+
schedule: NcScheduleSchema.optional(),
|
|
9206
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9207
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9208
|
+
throttle: NcThrottleSchema.default({
|
|
9209
|
+
cooldownSec: 60,
|
|
9210
|
+
scope: "rule-device"
|
|
9211
|
+
}),
|
|
9212
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9213
|
+
template: object({
|
|
9214
|
+
title: string().max(500).optional(),
|
|
9215
|
+
body: string().max(2e3).optional()
|
|
9216
|
+
}).optional(),
|
|
9217
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9218
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9219
|
+
/**
|
|
9220
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9221
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9222
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9223
|
+
*/
|
|
9224
|
+
ownerUserId: string().optional()
|
|
9225
|
+
});
|
|
9226
|
+
/**
|
|
9227
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9228
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9229
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9230
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9231
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9232
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9233
|
+
* `updateRule` patch.
|
|
9234
|
+
*/
|
|
9235
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9236
|
+
/** A persisted rule. */
|
|
9237
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9238
|
+
id: string(),
|
|
9239
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9240
|
+
createdBy: string(),
|
|
9241
|
+
createdAt: number(),
|
|
9242
|
+
updatedAt: number(),
|
|
9243
|
+
/**
|
|
9244
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9245
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9246
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9247
|
+
*/
|
|
9248
|
+
disabledTargetIds: array(string()).default([])
|
|
9249
|
+
});
|
|
9250
|
+
var NcTestResultSchema = object({
|
|
9251
|
+
recordId: string(),
|
|
9252
|
+
recordKind: _enum([
|
|
9253
|
+
"object-event",
|
|
9254
|
+
"track",
|
|
9255
|
+
"device-event",
|
|
9256
|
+
"package-event"
|
|
9257
|
+
]),
|
|
9258
|
+
deviceId: number(),
|
|
9259
|
+
timestamp: number(),
|
|
9260
|
+
wouldFire: boolean(),
|
|
9261
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9262
|
+
failedCondition: string().optional(),
|
|
9263
|
+
className: string().optional(),
|
|
9264
|
+
label: string().optional()
|
|
9265
|
+
});
|
|
9266
|
+
var NcConditionDescriptorSchema = object({
|
|
9267
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9268
|
+
id: string(),
|
|
9269
|
+
group: _enum([
|
|
9270
|
+
"scope",
|
|
9271
|
+
"class",
|
|
9272
|
+
"zones",
|
|
9273
|
+
"quality",
|
|
9274
|
+
"label",
|
|
9275
|
+
"schedule",
|
|
9276
|
+
"device",
|
|
9277
|
+
"package",
|
|
9278
|
+
"occupancy"
|
|
9279
|
+
]),
|
|
9280
|
+
label: string(),
|
|
9281
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9282
|
+
valueType: _enum([
|
|
9283
|
+
"deviceIdList",
|
|
9284
|
+
"stringList",
|
|
9285
|
+
"number01",
|
|
9286
|
+
"number",
|
|
9287
|
+
"sourceSelect",
|
|
9288
|
+
"zoneSelection",
|
|
9289
|
+
"zoneIdList",
|
|
9290
|
+
"schedule",
|
|
9291
|
+
"plateMatcher",
|
|
9292
|
+
"packagePhase",
|
|
9293
|
+
"polygonDraw",
|
|
9294
|
+
"occupancy"
|
|
9295
|
+
]),
|
|
9296
|
+
operator: _enum([
|
|
9297
|
+
"in",
|
|
9298
|
+
"notIn",
|
|
9299
|
+
"anyOf",
|
|
9300
|
+
"allOf",
|
|
9301
|
+
"gte",
|
|
9302
|
+
"fuzzyIn",
|
|
9303
|
+
"withinSchedule"
|
|
9304
|
+
]),
|
|
9305
|
+
/** Which delivery kinds the condition applies to. */
|
|
9306
|
+
appliesTo: array(NcDeliverySchema),
|
|
9307
|
+
phase: string(),
|
|
9308
|
+
description: string().optional()
|
|
9309
|
+
});
|
|
9310
|
+
/**
|
|
9311
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9312
|
+
* durable outbox row's own status (single source of truth):
|
|
9313
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9314
|
+
* - `sent` — delivered (terminal)
|
|
9315
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9316
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9317
|
+
* the failure `error`)
|
|
9318
|
+
*
|
|
9319
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9320
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9321
|
+
*/
|
|
9322
|
+
var NcHistoryStatusSchema = _enum([
|
|
9323
|
+
"pending",
|
|
9324
|
+
"sent",
|
|
9325
|
+
"dead"
|
|
9326
|
+
]);
|
|
9327
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9328
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9329
|
+
"object-event",
|
|
9330
|
+
"track-end",
|
|
9331
|
+
"device-event",
|
|
9332
|
+
"package-event"
|
|
9333
|
+
]);
|
|
9334
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9335
|
+
var NcHistorySubjectSchema = object({
|
|
9336
|
+
className: string(),
|
|
9337
|
+
label: string().optional(),
|
|
9338
|
+
confidence: number().optional(),
|
|
9339
|
+
zones: array(string()),
|
|
9340
|
+
timestamp: number()
|
|
9341
|
+
});
|
|
9342
|
+
/**
|
|
9343
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9344
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9345
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9346
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9347
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9348
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9349
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9350
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9351
|
+
* P1 (admin scope only).
|
|
9352
|
+
*/
|
|
9353
|
+
var NcHistoryEntrySchema = object({
|
|
9354
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9355
|
+
id: string(),
|
|
9356
|
+
ruleId: string(),
|
|
9357
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9358
|
+
ruleName: string(),
|
|
9359
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9360
|
+
delivery: NcDeliverySchema,
|
|
9361
|
+
targetId: string(),
|
|
9362
|
+
deviceId: number(),
|
|
9363
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9364
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9365
|
+
recordId: string(),
|
|
9366
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9367
|
+
trackId: string().optional(),
|
|
9368
|
+
status: NcHistoryStatusSchema,
|
|
9369
|
+
/** Delivery attempts made so far. */
|
|
9370
|
+
attempts: number().int(),
|
|
9371
|
+
/** Fire time (outbox enqueue). */
|
|
9372
|
+
createdAt: number(),
|
|
9373
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9374
|
+
updatedAt: number(),
|
|
9375
|
+
/** Failure detail — present on a `dead` row. */
|
|
9376
|
+
error: string().optional(),
|
|
9377
|
+
subject: NcHistorySubjectSchema
|
|
9378
|
+
});
|
|
9379
|
+
/**
|
|
9380
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9381
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9382
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9383
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9384
|
+
*/
|
|
9385
|
+
var NcHistoryFilterSchema = object({
|
|
9386
|
+
ruleId: string().optional(),
|
|
9387
|
+
deviceId: number().optional(),
|
|
9388
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9389
|
+
since: number().optional(),
|
|
9390
|
+
until: number().optional(),
|
|
9391
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9392
|
+
});
|
|
9393
|
+
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 }), {
|
|
9394
|
+
kind: "mutation",
|
|
9395
|
+
auth: "admin",
|
|
9396
|
+
caller: "required"
|
|
9397
|
+
}), method(object({
|
|
9398
|
+
ruleId: string(),
|
|
9399
|
+
patch: NcRulePatchSchema
|
|
9400
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9401
|
+
kind: "mutation",
|
|
9402
|
+
auth: "admin",
|
|
9403
|
+
caller: "required"
|
|
9404
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9405
|
+
kind: "mutation",
|
|
9406
|
+
auth: "admin"
|
|
9407
|
+
}), method(object({
|
|
9408
|
+
ruleId: string(),
|
|
9409
|
+
enabled: boolean()
|
|
9410
|
+
}), object({ success: literal(true) }), {
|
|
9411
|
+
kind: "mutation",
|
|
9412
|
+
auth: "admin"
|
|
9413
|
+
}), method(object({
|
|
9414
|
+
rule: NcRuleInputSchema,
|
|
9415
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9416
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9417
|
+
kind: "mutation",
|
|
9418
|
+
auth: "admin"
|
|
9419
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9420
|
+
/**
|
|
9421
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9422
|
+
*
|
|
9423
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
9424
|
+
* §3.2/§3.3.
|
|
9425
|
+
*
|
|
9426
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
9427
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
9428
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
9429
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
9430
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
9431
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
9432
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
9433
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
9434
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
9435
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
9436
|
+
*
|
|
9437
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
9438
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
9439
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
9440
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
9441
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
9442
|
+
*/
|
|
9443
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
9444
|
+
var TimelapseTemplateSchema = object({
|
|
9445
|
+
title: string().max(500).optional(),
|
|
9446
|
+
body: string().max(2e3).optional()
|
|
9447
|
+
});
|
|
9448
|
+
var NameField = string().min(1).max(200);
|
|
9449
|
+
var DeviceIdsField = array(number()).min(1);
|
|
9450
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
9451
|
+
var FramerateField = number().int().min(1).max(60);
|
|
9452
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
9453
|
+
var PriorityField = number().int().min(1).max(5);
|
|
9454
|
+
/**
|
|
9455
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
9456
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
9457
|
+
* here (see the ownership note above).
|
|
9458
|
+
*/
|
|
9459
|
+
var TimelapseRuleInputSchema = object({
|
|
9460
|
+
name: NameField,
|
|
9461
|
+
enabled: boolean().default(true),
|
|
9462
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
9463
|
+
deviceIds: DeviceIdsField,
|
|
9464
|
+
/**
|
|
9465
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
9466
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
9467
|
+
* open clears the scratch, close assembles and delivers.
|
|
9468
|
+
*/
|
|
9469
|
+
schedule: NcScheduleSchema,
|
|
9470
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
9471
|
+
cadenceSec: CadenceSecField.default(15),
|
|
9472
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
9473
|
+
framerate: FramerateField.default(10),
|
|
9474
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
9475
|
+
targets: TargetsField,
|
|
9476
|
+
template: TimelapseTemplateSchema.optional(),
|
|
9477
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9478
|
+
priority: PriorityField.default(3)
|
|
9479
|
+
});
|
|
9480
|
+
object({
|
|
9481
|
+
name: NameField.optional(),
|
|
9482
|
+
enabled: boolean().optional(),
|
|
9483
|
+
deviceIds: DeviceIdsField.optional(),
|
|
9484
|
+
schedule: NcScheduleSchema.optional(),
|
|
9485
|
+
cadenceSec: CadenceSecField.optional(),
|
|
9486
|
+
framerate: FramerateField.optional(),
|
|
9487
|
+
targets: TargetsField.optional(),
|
|
9488
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
9489
|
+
priority: PriorityField.optional()
|
|
9490
|
+
});
|
|
9491
|
+
TimelapseRuleInputSchema.extend({
|
|
9492
|
+
id: string(),
|
|
9493
|
+
/**
|
|
9494
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
9495
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
9496
|
+
* resolved caller; never trusted from a client payload.
|
|
9497
|
+
*/
|
|
9498
|
+
ownerUserId: string().optional(),
|
|
9499
|
+
/**
|
|
9500
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
9501
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
9502
|
+
*/
|
|
9503
|
+
lastGeneratedAt: number().optional(),
|
|
9504
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
9505
|
+
createdBy: string(),
|
|
9506
|
+
createdAt: number(),
|
|
9507
|
+
updatedAt: number()
|
|
9508
|
+
});
|
|
9509
|
+
/**
|
|
8815
9510
|
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
8816
9511
|
* for every device, regardless of provider — the kernel needs a uniform
|
|
8817
9512
|
* cap-keyed slice for the basic device flags every consumer expects to
|
|
@@ -10885,6 +11580,22 @@ var CameraMetricsSchema = object({
|
|
|
10885
11580
|
])
|
|
10886
11581
|
});
|
|
10887
11582
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
11583
|
+
/**
|
|
11584
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
11585
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
11586
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
11587
|
+
*/
|
|
11588
|
+
var NativeCropRefSchema = object({
|
|
11589
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
11590
|
+
handle: FrameHandleSchema,
|
|
11591
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
11592
|
+
cropFrameSpace: object({
|
|
11593
|
+
x: number(),
|
|
11594
|
+
y: number(),
|
|
11595
|
+
w: number(),
|
|
11596
|
+
h: number()
|
|
11597
|
+
})
|
|
11598
|
+
});
|
|
10888
11599
|
var ModelFormatSchema$1 = _enum([
|
|
10889
11600
|
"onnx",
|
|
10890
11601
|
"coreml",
|
|
@@ -11160,7 +11871,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
11160
11871
|
* Omitted ⇒ the runner's default device (current single-engine
|
|
11161
11872
|
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
11162
11873
|
*/
|
|
11163
|
-
deviceKey: string().optional()
|
|
11874
|
+
deviceKey: string().optional(),
|
|
11875
|
+
/**
|
|
11876
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
11877
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
11878
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
11879
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
11880
|
+
* resolution from that surface — the SAME quality path faces already
|
|
11881
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
11882
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
11883
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
11884
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
11885
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
11886
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
11887
|
+
* (today's behaviour on the fallback path).
|
|
11888
|
+
*/
|
|
11889
|
+
nativeCropRef: NativeCropRefSchema.optional()
|
|
11164
11890
|
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
11165
11891
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
11166
11892
|
steps: array(PipelineStepInputSchema).min(1),
|
|
@@ -11376,7 +12102,11 @@ var DetailResultSchema = object({
|
|
|
11376
12102
|
bbox: NativeCropBboxSchema.optional(),
|
|
11377
12103
|
embedding: string().optional(),
|
|
11378
12104
|
label: string().optional(),
|
|
11379
|
-
alignedCropJpeg: string().optional()
|
|
12105
|
+
alignedCropJpeg: string().optional(),
|
|
12106
|
+
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
12107
|
+
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
12108
|
+
* consumers MUST prefer this when present (2026-07-22 native-gate fix). */
|
|
12109
|
+
nativeFaceShortSidePx: number().optional()
|
|
11380
12110
|
});
|
|
11381
12111
|
/**
|
|
11382
12112
|
* Per-camera tunable ranges + defaults. Single source of truth used
|
|
@@ -11390,6 +12120,12 @@ var motionCooldownMsField = {
|
|
|
11390
12120
|
default: 3e4,
|
|
11391
12121
|
step: 500
|
|
11392
12122
|
};
|
|
12123
|
+
var maxSessionHoldMsField = {
|
|
12124
|
+
min: 0,
|
|
12125
|
+
max: 6e5,
|
|
12126
|
+
default: 12e4,
|
|
12127
|
+
step: 5e3
|
|
12128
|
+
};
|
|
11393
12129
|
var motionFpsField = {
|
|
11394
12130
|
min: 1,
|
|
11395
12131
|
max: 30,
|
|
@@ -11537,6 +12273,19 @@ var RunnerCameraConfigSchema = object({
|
|
|
11537
12273
|
"on-motion"
|
|
11538
12274
|
]).default("always-on"),
|
|
11539
12275
|
motionCooldownMs: number().min(motionCooldownMsField.min).default(motionCooldownMsField.default),
|
|
12276
|
+
/**
|
|
12277
|
+
* Orchestrator-side on-motion session-hold cap (ms). While an on-motion
|
|
12278
|
+
* detection session is active and ≥1 confirmed non-stationary track is
|
|
12279
|
+
* still live, the orchestrator keeps the session open past
|
|
12280
|
+
* `motionCooldownMs` (a slowly-moving subject can stop re-triggering the
|
|
12281
|
+
* camera's VMD yet is still being tracked frame-to-frame) — up to this many
|
|
12282
|
+
* ms since the session opened, after which it closes regardless. `0`
|
|
12283
|
+
* disables the hold (legacy cooldown-only teardown). Not consumed by the
|
|
12284
|
+
* runner itself — carried here so it shares the per-camera device-settings
|
|
12285
|
+
* surface with `motionCooldownMs`; the orchestrator reads it off the
|
|
12286
|
+
* resolved `CameraDetectionConfig`.
|
|
12287
|
+
*/
|
|
12288
|
+
maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
|
|
11540
12289
|
motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
|
|
11541
12290
|
detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
|
|
11542
12291
|
motionStreamId: string(),
|
|
@@ -11626,7 +12375,7 @@ var RunnerCameraConfigSchema = object({
|
|
|
11626
12375
|
*/
|
|
11627
12376
|
inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
|
|
11628
12377
|
});
|
|
11629
|
-
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;
|
|
12378
|
+
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;
|
|
11630
12379
|
/**
|
|
11631
12380
|
* Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
|
|
11632
12381
|
* load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
|
|
@@ -11737,67 +12486,6 @@ DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
|
11737
12486
|
lastChangedAt: number()
|
|
11738
12487
|
});
|
|
11739
12488
|
/**
|
|
11740
|
-
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
11741
|
-
* motion-zones, and the detection zones/lines editor all speak this one
|
|
11742
|
-
* language so a single drawing-plane editor and the providers stay
|
|
11743
|
-
* decoupled from each cap's storage.
|
|
11744
|
-
*
|
|
11745
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
11746
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
11747
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
11748
|
-
*/
|
|
11749
|
-
/** A normalized 0..1 point (top-left origin). */
|
|
11750
|
-
var MaskPointSchema = object({
|
|
11751
|
-
x: number(),
|
|
11752
|
-
y: number()
|
|
11753
|
-
});
|
|
11754
|
-
/** Axis-aligned rectangle (normalized 0..1). */
|
|
11755
|
-
var MaskRectShapeSchema = object({
|
|
11756
|
-
kind: literal("rect"),
|
|
11757
|
-
x: number(),
|
|
11758
|
-
y: number(),
|
|
11759
|
-
width: number(),
|
|
11760
|
-
height: number()
|
|
11761
|
-
});
|
|
11762
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
11763
|
-
var MaskPolygonShapeSchema = object({
|
|
11764
|
-
kind: literal("polygon"),
|
|
11765
|
-
points: array(MaskPointSchema)
|
|
11766
|
-
});
|
|
11767
|
-
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
11768
|
-
var MaskGridShapeSchema = object({
|
|
11769
|
-
kind: literal("grid"),
|
|
11770
|
-
gridWidth: number(),
|
|
11771
|
-
gridHeight: number(),
|
|
11772
|
-
cells: array(boolean())
|
|
11773
|
-
});
|
|
11774
|
-
discriminatedUnion("kind", [
|
|
11775
|
-
MaskRectShapeSchema,
|
|
11776
|
-
MaskPolygonShapeSchema,
|
|
11777
|
-
MaskGridShapeSchema,
|
|
11778
|
-
object({
|
|
11779
|
-
kind: literal("line"),
|
|
11780
|
-
points: array(MaskPointSchema)
|
|
11781
|
-
})
|
|
11782
|
-
]);
|
|
11783
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
11784
|
-
var MaskShapeKindSchema = _enum([
|
|
11785
|
-
"rect",
|
|
11786
|
-
"polygon",
|
|
11787
|
-
"grid",
|
|
11788
|
-
"line"
|
|
11789
|
-
]);
|
|
11790
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
11791
|
-
var MaskPolygonVerticesSchema = object({
|
|
11792
|
-
min: number(),
|
|
11793
|
-
max: number()
|
|
11794
|
-
});
|
|
11795
|
-
/** Grid dimensions when a cap supports 'grid'. */
|
|
11796
|
-
var MaskGridDimsSchema = object({
|
|
11797
|
-
width: number(),
|
|
11798
|
-
height: number()
|
|
11799
|
-
});
|
|
11800
|
-
/**
|
|
11801
12489
|
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
11802
12490
|
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
11803
12491
|
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
@@ -13480,94 +14168,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
13480
14168
|
bundleUrl: string()
|
|
13481
14169
|
});
|
|
13482
14170
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
13483
|
-
var NotificationRuleConditionsSchema = object({
|
|
13484
|
-
deviceIds: array(number()).readonly().optional(),
|
|
13485
|
-
classNames: array(string()).readonly().optional(),
|
|
13486
|
-
zoneIds: array(string()).readonly().optional(),
|
|
13487
|
-
minConfidence: number().optional(),
|
|
13488
|
-
source: _enum([
|
|
13489
|
-
"pipeline",
|
|
13490
|
-
"onboard",
|
|
13491
|
-
"any"
|
|
13492
|
-
]).optional(),
|
|
13493
|
-
schedule: object({
|
|
13494
|
-
days: array(number()).readonly(),
|
|
13495
|
-
startHour: number(),
|
|
13496
|
-
endHour: number()
|
|
13497
|
-
}).optional(),
|
|
13498
|
-
cooldownSeconds: number().optional(),
|
|
13499
|
-
minDwellSeconds: number().optional(),
|
|
13500
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
13501
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
13502
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
13503
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
13504
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
13505
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
13506
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
13507
|
-
clipDescription: object({
|
|
13508
|
-
text: string().min(1),
|
|
13509
|
-
minSimilarity: number().min(0).max(1)
|
|
13510
|
-
}).optional(),
|
|
13511
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
13512
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
13513
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
13514
|
-
* vehicle/person> is seen". */
|
|
13515
|
-
labels: array(string()).readonly().optional()
|
|
13516
|
-
});
|
|
13517
|
-
var NotificationRuleTemplateSchema = object({
|
|
13518
|
-
title: string(),
|
|
13519
|
-
body: string(),
|
|
13520
|
-
imageMode: _enum([
|
|
13521
|
-
"crop",
|
|
13522
|
-
"annotated",
|
|
13523
|
-
"full",
|
|
13524
|
-
"none"
|
|
13525
|
-
])
|
|
13526
|
-
});
|
|
13527
|
-
var NotificationRuleSchema = object({
|
|
13528
|
-
id: string(),
|
|
13529
|
-
name: string(),
|
|
13530
|
-
enabled: boolean(),
|
|
13531
|
-
eventTypes: array(string()).readonly(),
|
|
13532
|
-
conditions: NotificationRuleConditionsSchema,
|
|
13533
|
-
outputs: array(string()).readonly(),
|
|
13534
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
13535
|
-
priority: _enum([
|
|
13536
|
-
"low",
|
|
13537
|
-
"normal",
|
|
13538
|
-
"high",
|
|
13539
|
-
"critical"
|
|
13540
|
-
])
|
|
13541
|
-
});
|
|
13542
|
-
var NotificationTestResultSchema = object({
|
|
13543
|
-
ruleId: string(),
|
|
13544
|
-
eventId: string(),
|
|
13545
|
-
timestamp: number(),
|
|
13546
|
-
wouldFire: boolean(),
|
|
13547
|
-
reason: string().optional()
|
|
13548
|
-
});
|
|
13549
|
-
var NotificationHistoryEntrySchema = object({
|
|
13550
|
-
id: string(),
|
|
13551
|
-
ruleId: string(),
|
|
13552
|
-
ruleName: string(),
|
|
13553
|
-
eventId: string(),
|
|
13554
|
-
timestamp: number(),
|
|
13555
|
-
outputs: array(string()).readonly(),
|
|
13556
|
-
success: boolean(),
|
|
13557
|
-
error: string().optional(),
|
|
13558
|
-
deviceId: number().optional()
|
|
13559
|
-
});
|
|
13560
|
-
var NotificationHistoryFilterSchema = object({
|
|
13561
|
-
ruleId: string().optional(),
|
|
13562
|
-
deviceId: number().optional(),
|
|
13563
|
-
from: number().optional(),
|
|
13564
|
-
to: number().optional(),
|
|
13565
|
-
limit: number().optional()
|
|
13566
|
-
});
|
|
13567
|
-
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({
|
|
13568
|
-
ruleId: string(),
|
|
13569
|
-
lookbackMinutes: number()
|
|
13570
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
13571
14171
|
/**
|
|
13572
14172
|
* Alerts capability — collection-based internal alert system.
|
|
13573
14173
|
*
|
|
@@ -13754,88 +14354,54 @@ method(object({
|
|
|
13754
14354
|
password: string()
|
|
13755
14355
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
13756
14356
|
/**
|
|
13757
|
-
*
|
|
13758
|
-
*
|
|
13759
|
-
*
|
|
13760
|
-
*
|
|
13761
|
-
*
|
|
13762
|
-
*
|
|
13763
|
-
*
|
|
13764
|
-
* A contribution is a discriminated union on `kind`:
|
|
13765
|
-
*
|
|
13766
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
13767
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
13768
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
13769
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
13770
|
-
* login page needs NO change.
|
|
13771
|
-
*
|
|
13772
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
13773
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
13774
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
13775
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
13776
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
13777
|
-
*
|
|
13778
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
13779
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
13780
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
13781
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
13782
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
13783
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
13784
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
13785
|
-
* decision.
|
|
13786
|
-
*
|
|
13787
|
-
* Every contribution carries a `stage`:
|
|
13788
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
13789
|
-
* magic-link buttons; a future usernameless passkey).
|
|
13790
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
13791
|
-
* returned `factors` (passkey-as-2FA today).
|
|
13792
|
-
*
|
|
13793
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
13794
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
13795
|
-
* tRPC router.
|
|
14357
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
14358
|
+
* NOT flow through the capability — they use the addon data plane
|
|
14359
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
14360
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
14361
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
14362
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
13796
14363
|
*/
|
|
13797
|
-
|
|
13798
|
-
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
|
|
13805
|
-
|
|
13806
|
-
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
|
|
13810
|
-
|
|
13811
|
-
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
|
|
13829
|
-
|
|
13830
|
-
|
|
13831
|
-
|
|
13832
|
-
|
|
13833
|
-
|
|
13834
|
-
|
|
13835
|
-
|
|
13836
|
-
|
|
13837
|
-
|
|
13838
|
-
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
14364
|
+
var TerminalSessionInfoSchema = object({
|
|
14365
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
14366
|
+
sessionId: string(),
|
|
14367
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
14368
|
+
profileId: string(),
|
|
14369
|
+
/** Human-readable profile label for the UI session list. */
|
|
14370
|
+
label: string(),
|
|
14371
|
+
cols: number().int().positive(),
|
|
14372
|
+
rows: number().int().positive(),
|
|
14373
|
+
/** ms-epoch the session's pty was spawned. */
|
|
14374
|
+
startedAt: number()
|
|
14375
|
+
});
|
|
14376
|
+
/**
|
|
14377
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
14378
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
14379
|
+
* command string would be remote code execution as the server's user, so it is
|
|
14380
|
+
* deliberately not part of the contract.
|
|
14381
|
+
*/
|
|
14382
|
+
var TerminalProfileInfoSchema = object({
|
|
14383
|
+
profileId: string(),
|
|
14384
|
+
label: string(),
|
|
14385
|
+
description: string().optional()
|
|
14386
|
+
});
|
|
14387
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
14388
|
+
profileId: string(),
|
|
14389
|
+
cols: number().int().positive(),
|
|
14390
|
+
rows: number().int().positive()
|
|
14391
|
+
}), TerminalSessionInfoSchema, {
|
|
14392
|
+
kind: "mutation",
|
|
14393
|
+
auth: "admin"
|
|
14394
|
+
}), method(object({
|
|
14395
|
+
sessionId: string(),
|
|
14396
|
+
cols: number().int().positive(),
|
|
14397
|
+
rows: number().int().positive()
|
|
14398
|
+
}), _void(), {
|
|
14399
|
+
kind: "mutation",
|
|
14400
|
+
auth: "admin"
|
|
14401
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
14402
|
+
kind: "mutation",
|
|
14403
|
+
auth: "admin"
|
|
14404
|
+
});
|
|
13839
14405
|
/**
|
|
13840
14406
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
13841
14407
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
@@ -13937,11 +14503,53 @@ var LocationStatSchema = object({
|
|
|
13937
14503
|
fileCount: number(),
|
|
13938
14504
|
present: boolean()
|
|
13939
14505
|
});
|
|
14506
|
+
/**
|
|
14507
|
+
* A backup schedule — the N:M "entry" that binds one cron cadence to a
|
|
14508
|
+
* SET of destination locations. Supersedes the per-location cron on
|
|
14509
|
+
* `BackupDestinationPolicy`: an operator creates a schedule, picks the
|
|
14510
|
+
* `backups` locations it should write to, and the orchestrator fans a
|
|
14511
|
+
* single archive out to all of them when the cron fires.
|
|
14512
|
+
*
|
|
14513
|
+
* `retentionCount` is per-schedule (D-decision 2026-07-28): every
|
|
14514
|
+
* location targeted by this schedule keeps this many archives from
|
|
14515
|
+
* this schedule's runs.
|
|
14516
|
+
*
|
|
14517
|
+
* `dataSources` optionally narrows which top-level state locations
|
|
14518
|
+
* (db, addons, tls, …) are archived; omitted = the orchestrator's
|
|
14519
|
+
* default full set.
|
|
14520
|
+
*/
|
|
14521
|
+
var BackupScheduleSchema = object({
|
|
14522
|
+
/** Stable id. Generated by the orchestrator on first upsert if absent. */
|
|
14523
|
+
id: string(),
|
|
14524
|
+
/** Operator-facing display name. */
|
|
14525
|
+
label: string(),
|
|
14526
|
+
/** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
|
|
14527
|
+
cron: string(),
|
|
14528
|
+
/** Master on/off toggle for the whole schedule. */
|
|
14529
|
+
enabled: boolean(),
|
|
14530
|
+
/** `backups`-location ids this schedule writes to (fan-out set). */
|
|
14531
|
+
locationIds: array(string()).readonly(),
|
|
14532
|
+
/** Archives kept per targeted location for this schedule. */
|
|
14533
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14534
|
+
/** Optional subset of source locations to include; omitted = all. */
|
|
14535
|
+
dataSources: array(string()).readonly().optional(),
|
|
14536
|
+
/** ms-epoch of last successful run. */
|
|
14537
|
+
lastRunAt: number().optional(),
|
|
14538
|
+
/** ms-epoch of next computed firing (read-only, filled on list). */
|
|
14539
|
+
nextRunAt: number().optional()
|
|
14540
|
+
});
|
|
13940
14541
|
method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
13941
14542
|
/** Subset of registered `backup-destination` addon ids to write to. */
|
|
13942
14543
|
destinations: array(string()).optional(),
|
|
13943
14544
|
locations: array(string()).optional(),
|
|
13944
|
-
label: string().optional()
|
|
14545
|
+
label: string().optional(),
|
|
14546
|
+
/**
|
|
14547
|
+
* Per-run retention override applied to every targeted
|
|
14548
|
+
* destination. Used by schedule-driven runs (per-entry
|
|
14549
|
+
* retention). Omitted = each destination's own policy
|
|
14550
|
+
* retention (manual runs).
|
|
14551
|
+
*/
|
|
14552
|
+
retentionCount: number().int().min(1).max(1e3).optional()
|
|
13945
14553
|
}).optional(), array(BackupEntrySchema).readonly(), {
|
|
13946
14554
|
kind: "mutation",
|
|
13947
14555
|
auth: "admin"
|
|
@@ -13990,7 +14598,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
13990
14598
|
ok: boolean(),
|
|
13991
14599
|
error: string().optional(),
|
|
13992
14600
|
nextRuns: array(number()).readonly()
|
|
13993
|
-
}))
|
|
14601
|
+
})), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
|
|
14602
|
+
id: string().optional(),
|
|
14603
|
+
label: string(),
|
|
14604
|
+
cron: string(),
|
|
14605
|
+
enabled: boolean(),
|
|
14606
|
+
locationIds: array(string()).readonly(),
|
|
14607
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14608
|
+
dataSources: array(string()).readonly().optional()
|
|
14609
|
+
}), BackupScheduleSchema, {
|
|
14610
|
+
kind: "mutation",
|
|
14611
|
+
auth: "admin"
|
|
14612
|
+
}), method(object({ id: string() }), _void(), {
|
|
14613
|
+
kind: "mutation",
|
|
14614
|
+
auth: "admin"
|
|
14615
|
+
});
|
|
13994
14616
|
/**
|
|
13995
14617
|
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
13996
14618
|
*
|
|
@@ -15180,851 +15802,934 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
15180
15802
|
kind: "mutation",
|
|
15181
15803
|
auth: "admin"
|
|
15182
15804
|
});
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15195
|
-
tags: record(string(), string()).optional()
|
|
15805
|
+
/**
|
|
15806
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15807
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15808
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
15809
|
+
*
|
|
15810
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15811
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
15812
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15813
|
+
*/
|
|
15814
|
+
var LlmUsageSchema = object({
|
|
15815
|
+
inputTokens: number(),
|
|
15816
|
+
outputTokens: number()
|
|
15196
15817
|
});
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
|
|
15200
|
-
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
-
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
loadAvg: tuple([
|
|
15212
|
-
number(),
|
|
15213
|
-
number(),
|
|
15214
|
-
number()
|
|
15215
|
-
]),
|
|
15216
|
-
cores: number()
|
|
15217
|
-
});
|
|
15218
|
-
var MemoryInfoSchema = object({
|
|
15219
|
-
percent: number(),
|
|
15220
|
-
totalBytes: number(),
|
|
15221
|
-
usedBytes: number(),
|
|
15222
|
-
availableBytes: number(),
|
|
15223
|
-
swapUsedBytes: number(),
|
|
15224
|
-
swapTotalBytes: number()
|
|
15225
|
-
});
|
|
15226
|
-
var DiskIoSnapshotSchema = object({
|
|
15227
|
-
readBytes: number(),
|
|
15228
|
-
writeBytes: number(),
|
|
15229
|
-
readOps: number(),
|
|
15230
|
-
writeOps: number(),
|
|
15231
|
-
timestampMs: number()
|
|
15232
|
-
});
|
|
15233
|
-
var NetworkIoSnapshotSchema = object({
|
|
15234
|
-
rxBytes: number(),
|
|
15235
|
-
txBytes: number(),
|
|
15236
|
-
rxPackets: number(),
|
|
15237
|
-
txPackets: number(),
|
|
15238
|
-
rxErrors: number(),
|
|
15239
|
-
txErrors: number(),
|
|
15240
|
-
timestampMs: number()
|
|
15241
|
-
});
|
|
15242
|
-
var MetricsGpuInfoSchema = object({
|
|
15243
|
-
utilization: number(),
|
|
15818
|
+
var LlmErrorCodeSchema = _enum([
|
|
15819
|
+
"timeout",
|
|
15820
|
+
"rate-limited",
|
|
15821
|
+
"auth",
|
|
15822
|
+
"refusal",
|
|
15823
|
+
"bad-request",
|
|
15824
|
+
"unavailable",
|
|
15825
|
+
"no-profile",
|
|
15826
|
+
"budget-exceeded",
|
|
15827
|
+
"adapter-error"
|
|
15828
|
+
]);
|
|
15829
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15830
|
+
ok: literal(true),
|
|
15831
|
+
text: string(),
|
|
15244
15832
|
model: string(),
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
})
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
|
|
15258
|
-
|
|
15833
|
+
usage: LlmUsageSchema,
|
|
15834
|
+
truncated: boolean(),
|
|
15835
|
+
latencyMs: number()
|
|
15836
|
+
}), object({
|
|
15837
|
+
ok: literal(false),
|
|
15838
|
+
code: LlmErrorCodeSchema,
|
|
15839
|
+
message: string(),
|
|
15840
|
+
retryAfterMs: number().optional()
|
|
15841
|
+
})]);
|
|
15842
|
+
/**
|
|
15843
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15844
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15845
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
15846
|
+
*/
|
|
15847
|
+
var LlmImageSchema = object({
|
|
15848
|
+
bytes: _instanceof(Uint8Array),
|
|
15849
|
+
mimeType: string()
|
|
15259
15850
|
});
|
|
15260
|
-
var
|
|
15261
|
-
|
|
15262
|
-
|
|
15851
|
+
var LlmGenerateBaseInputSchema = object({
|
|
15852
|
+
/** Collection routing (the notification-output posture). */
|
|
15853
|
+
addonId: string().optional(),
|
|
15854
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15855
|
+
profileId: string().optional(),
|
|
15856
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15857
|
+
consumer: string(),
|
|
15858
|
+
system: string().optional(),
|
|
15859
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15860
|
+
prompt: string(),
|
|
15861
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15862
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
15863
|
+
/** Per-call override of the profile default. */
|
|
15864
|
+
maxTokens: number().int().positive().optional(),
|
|
15865
|
+
temperature: number().optional()
|
|
15263
15866
|
});
|
|
15264
|
-
|
|
15265
|
-
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
|
|
15269
|
-
|
|
15270
|
-
|
|
15271
|
-
|
|
15272
|
-
|
|
15273
|
-
|
|
15867
|
+
/**
|
|
15868
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15869
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15870
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15871
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15872
|
+
* this only through the `llm` cap's methods.
|
|
15873
|
+
*
|
|
15874
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15875
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15876
|
+
* watchdog — operator decision #3).
|
|
15877
|
+
*/
|
|
15878
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15879
|
+
object({
|
|
15880
|
+
kind: literal("catalog"),
|
|
15881
|
+
catalogId: string()
|
|
15274
15882
|
}),
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
|
|
15295
|
-
|
|
15296
|
-
*/
|
|
15297
|
-
|
|
15298
|
-
/**
|
|
15299
|
-
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
sharedBytes: number().optional()
|
|
15883
|
+
object({
|
|
15884
|
+
kind: literal("url"),
|
|
15885
|
+
url: string(),
|
|
15886
|
+
sha256: string().optional()
|
|
15887
|
+
}),
|
|
15888
|
+
object({
|
|
15889
|
+
kind: literal("path"),
|
|
15890
|
+
path: string()
|
|
15891
|
+
})
|
|
15892
|
+
]);
|
|
15893
|
+
var ManagedRuntimeConfigSchema = object({
|
|
15894
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
15895
|
+
nodeId: string(),
|
|
15896
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15897
|
+
engine: _enum(["llama-cpp"]),
|
|
15898
|
+
model: ManagedModelRefSchema,
|
|
15899
|
+
contextSize: number().int().default(4096),
|
|
15900
|
+
/** 0 = CPU-only. */
|
|
15901
|
+
gpuLayers: number().int().default(0),
|
|
15902
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15903
|
+
threads: number().int().optional(),
|
|
15904
|
+
/** Concurrent slots. */
|
|
15905
|
+
parallel: number().int().default(1),
|
|
15906
|
+
/** Else lazy: first generate boots it. */
|
|
15907
|
+
autoStart: boolean().default(false),
|
|
15908
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
15909
|
+
idleStopMinutes: number().int().default(30)
|
|
15303
15910
|
});
|
|
15304
|
-
var
|
|
15305
|
-
|
|
15911
|
+
var LlmRuntimeStatusSchema = object({
|
|
15912
|
+
/** Status is ALWAYS node-qualified. */
|
|
15306
15913
|
nodeId: string(),
|
|
15307
|
-
role: _enum(["hub", "worker"]),
|
|
15308
|
-
pid: number(),
|
|
15309
15914
|
state: _enum([
|
|
15310
|
-
"starting",
|
|
15311
|
-
"running",
|
|
15312
|
-
"stopping",
|
|
15313
15915
|
"stopped",
|
|
15314
|
-
"
|
|
15315
|
-
|
|
15316
|
-
|
|
15317
|
-
|
|
15318
|
-
|
|
15319
|
-
pid: number(),
|
|
15320
|
-
ppid: number(),
|
|
15321
|
-
pgid: number(),
|
|
15322
|
-
classification: _enum([
|
|
15323
|
-
"root",
|
|
15324
|
-
"managed",
|
|
15325
|
-
"system",
|
|
15326
|
-
"ghost"
|
|
15916
|
+
"downloading",
|
|
15917
|
+
"starting",
|
|
15918
|
+
"ready",
|
|
15919
|
+
"crashed",
|
|
15920
|
+
"failed"
|
|
15327
15921
|
]),
|
|
15328
|
-
|
|
15329
|
-
|
|
15330
|
-
|
|
15331
|
-
|
|
15332
|
-
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15339
|
-
orphaned: boolean()
|
|
15922
|
+
pid: number().optional(),
|
|
15923
|
+
port: number().optional(),
|
|
15924
|
+
modelPath: string().optional(),
|
|
15925
|
+
modelId: string().optional(),
|
|
15926
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
15927
|
+
lastError: string().optional(),
|
|
15928
|
+
crashesInWindow: number(),
|
|
15929
|
+
/** Child RSS (sampled best-effort). */
|
|
15930
|
+
memoryBytes: number().optional(),
|
|
15931
|
+
vramBytes: number().optional()
|
|
15340
15932
|
});
|
|
15341
|
-
var
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15933
|
+
var LlmNodeModelSchema = object({
|
|
15934
|
+
file: string(),
|
|
15935
|
+
sizeBytes: number(),
|
|
15936
|
+
catalogId: string().optional(),
|
|
15937
|
+
installedAt: number().optional()
|
|
15345
15938
|
});
|
|
15346
|
-
var
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15939
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
15940
|
+
nodeId: string(),
|
|
15941
|
+
modelsBytes: number(),
|
|
15942
|
+
freeBytes: number().optional()
|
|
15350
15943
|
});
|
|
15351
|
-
|
|
15352
|
-
|
|
15353
|
-
|
|
15354
|
-
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
path: string().optional(),
|
|
15358
|
-
/** Process pid that was signalled. */
|
|
15359
|
-
pid: number().optional(),
|
|
15360
|
-
reason: string().optional()
|
|
15361
|
-
});
|
|
15362
|
-
var SystemMetricsSchema = object({
|
|
15363
|
-
cpuPercent: number(),
|
|
15364
|
-
memoryPercent: number(),
|
|
15365
|
-
memoryUsedMB: number(),
|
|
15366
|
-
memoryTotalMB: number(),
|
|
15367
|
-
diskPercent: number().optional(),
|
|
15368
|
-
temperature: number().optional(),
|
|
15369
|
-
gpuPercent: number().optional(),
|
|
15370
|
-
gpuMemoryPercent: number().optional()
|
|
15371
|
-
});
|
|
15372
|
-
method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string() }), DiskSpaceInfoSchema), method(_void(), MetricsGpuInfoSchema.nullable()), method(_void(), number().nullable()), method(object({ pids: array(number()) }), array(PidResourceStatsSchema)), method(_void(), array(AddonInstanceSchema).readonly()), method(object({ addonId: string() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(KillProcessInputSchema, KillProcessResultSchema, {
|
|
15944
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
15945
|
+
images: array(LlmImageSchema).optional(),
|
|
15946
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
15947
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15948
|
+
timeoutMs: number().int().positive().optional()
|
|
15949
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15373
15950
|
kind: "mutation",
|
|
15374
15951
|
auth: "admin"
|
|
15375
|
-
}), method(
|
|
15952
|
+
}), method(object({}), _void(), {
|
|
15376
15953
|
kind: "mutation",
|
|
15377
15954
|
auth: "admin"
|
|
15378
|
-
})
|
|
15379
|
-
method(object({
|
|
15380
|
-
sourceUrl: string(),
|
|
15381
|
-
metadata: ModelConvertMetadataSchema,
|
|
15382
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15383
|
-
calibrationRef: string().optional(),
|
|
15384
|
-
sessionId: string().optional()
|
|
15385
|
-
}), ConvertResultSchema, {
|
|
15955
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15386
15956
|
kind: "mutation",
|
|
15387
|
-
auth: "admin"
|
|
15388
|
-
|
|
15389
|
-
});
|
|
15390
|
-
method(object({
|
|
15391
|
-
nodeId: string(),
|
|
15392
|
-
modelId: string(),
|
|
15393
|
-
format: _enum(MODEL_FORMATS),
|
|
15394
|
-
entry: ModelCatalogEntrySchema
|
|
15395
|
-
}), object({
|
|
15396
|
-
ok: boolean(),
|
|
15397
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15398
|
-
sha256: string(),
|
|
15399
|
-
bytes: number(),
|
|
15400
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15401
|
-
path: string()
|
|
15402
|
-
}), {
|
|
15957
|
+
auth: "admin"
|
|
15958
|
+
}), method(object({ file: string() }), _void(), {
|
|
15403
15959
|
kind: "mutation",
|
|
15404
15960
|
auth: "admin"
|
|
15405
|
-
});
|
|
15406
|
-
/**
|
|
15407
|
-
* `mqtt-broker` — broker-registry cap.
|
|
15408
|
-
*
|
|
15409
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15410
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15411
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
15412
|
-
* its OWN `mqtt.js` client.
|
|
15413
|
-
*
|
|
15414
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15415
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15416
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
15417
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15418
|
-
* features anyway — give it the connection config, get out of the way.
|
|
15419
|
-
*
|
|
15420
|
-
* Consumer flow:
|
|
15421
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
15422
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
15423
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
15424
|
-
*
|
|
15425
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
15426
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
15427
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
15428
|
-
* spawned it.
|
|
15429
|
-
*/
|
|
15430
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
15961
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15431
15962
|
/**
|
|
15432
|
-
*
|
|
15963
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
15964
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
15965
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
15966
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15967
|
+
* (hub-placed); the cap stays open for future providers.
|
|
15433
15968
|
*
|
|
15434
|
-
*
|
|
15435
|
-
*
|
|
15436
|
-
*
|
|
15437
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
15438
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
15969
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15970
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15971
|
+
* write; a stored key NEVER round-trips to a client.
|
|
15439
15972
|
*/
|
|
15440
|
-
var
|
|
15441
|
-
"
|
|
15442
|
-
"
|
|
15443
|
-
"
|
|
15444
|
-
"
|
|
15445
|
-
"
|
|
15973
|
+
var LlmProfileKindSchema = _enum([
|
|
15974
|
+
"openai-compatible",
|
|
15975
|
+
"openai",
|
|
15976
|
+
"anthropic",
|
|
15977
|
+
"google",
|
|
15978
|
+
"managed-local"
|
|
15446
15979
|
]);
|
|
15447
|
-
var
|
|
15980
|
+
var LlmProfileSchema = object({
|
|
15448
15981
|
id: string(),
|
|
15449
15982
|
name: string(),
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
|
|
15456
|
-
|
|
15457
|
-
|
|
15458
|
-
|
|
15983
|
+
kind: LlmProfileKindSchema,
|
|
15984
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
15985
|
+
addonId: string(),
|
|
15986
|
+
enabled: boolean(),
|
|
15987
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
15988
|
+
model: string(),
|
|
15989
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
15990
|
+
baseUrl: string().optional(),
|
|
15991
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
15992
|
+
apiKey: string().optional(),
|
|
15993
|
+
supportsVision: boolean(),
|
|
15994
|
+
temperature: number().min(0).max(2).optional(),
|
|
15995
|
+
maxTokens: number().int().positive().optional(),
|
|
15996
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
15997
|
+
extraHeaders: record(string(), string()).optional(),
|
|
15998
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
15999
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15459
16000
|
});
|
|
15460
|
-
/**
|
|
15461
|
-
*
|
|
15462
|
-
*
|
|
15463
|
-
|
|
15464
|
-
|
|
15465
|
-
|
|
15466
|
-
|
|
15467
|
-
|
|
15468
|
-
|
|
15469
|
-
|
|
15470
|
-
|
|
15471
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
15472
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
15473
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
15474
|
-
* broker).
|
|
15475
|
-
*/
|
|
15476
|
-
clientIdPrefix: string().optional()
|
|
16001
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
16002
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
16003
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
16004
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
16005
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
16006
|
+
kind: LlmProfileKindSchema,
|
|
16007
|
+
label: string(),
|
|
16008
|
+
icon: string(),
|
|
16009
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16010
|
+
addonId: string(),
|
|
16011
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
15477
16012
|
});
|
|
15478
|
-
var
|
|
15479
|
-
|
|
15480
|
-
|
|
15481
|
-
|
|
15482
|
-
password: string().optional(),
|
|
15483
|
-
clientIdPrefix: string().optional()
|
|
16013
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
16014
|
+
var LlmDefaultSchema = object({
|
|
16015
|
+
selector: LlmDefaultSelectorSchema,
|
|
16016
|
+
profileId: string()
|
|
15484
16017
|
});
|
|
15485
|
-
|
|
15486
|
-
var
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
|
|
15495
|
-
|
|
15496
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
15497
|
-
allowAnonymous: boolean().default(false),
|
|
15498
|
-
/** Optional shared username/password for clients. */
|
|
15499
|
-
username: string().optional(),
|
|
15500
|
-
password: string().optional()
|
|
16018
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
16019
|
+
var LlmUsageRollupSchema = object({
|
|
16020
|
+
day: string(),
|
|
16021
|
+
consumer: string(),
|
|
16022
|
+
profileId: string(),
|
|
16023
|
+
calls: number(),
|
|
16024
|
+
okCalls: number(),
|
|
16025
|
+
errorCalls: number(),
|
|
16026
|
+
inputTokens: number(),
|
|
16027
|
+
outputTokens: number(),
|
|
16028
|
+
avgLatencyMs: number()
|
|
15501
16029
|
});
|
|
15502
|
-
|
|
16030
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
16031
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
15503
16032
|
id: string(),
|
|
15504
|
-
|
|
15505
|
-
|
|
15506
|
-
|
|
15507
|
-
brokerCount: number(),
|
|
15508
|
-
embeddedRunning: boolean()
|
|
15509
|
-
});
|
|
15510
|
-
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
|
|
15511
|
-
var NetworkEndpointSchema = object({
|
|
16033
|
+
label: string(),
|
|
16034
|
+
family: string(),
|
|
16035
|
+
purpose: _enum(["text", "vision"]),
|
|
15512
16036
|
url: string(),
|
|
15513
|
-
|
|
15514
|
-
|
|
15515
|
-
|
|
16037
|
+
sha256: string(),
|
|
16038
|
+
sizeBytes: number(),
|
|
16039
|
+
quantization: string(),
|
|
16040
|
+
/** Load-time guidance shown in the picker. */
|
|
16041
|
+
minRamBytes: number(),
|
|
16042
|
+
contextSizeDefault: number().int(),
|
|
16043
|
+
/** Vision models: companion projector file. */
|
|
16044
|
+
mmprojUrl: string().optional()
|
|
15516
16045
|
});
|
|
15517
|
-
var
|
|
15518
|
-
|
|
15519
|
-
|
|
16046
|
+
var LlmRuntimeNodeSchema = object({
|
|
16047
|
+
nodeId: string(),
|
|
16048
|
+
reachable: boolean(),
|
|
16049
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
16050
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15520
16051
|
error: string().optional()
|
|
15521
16052
|
});
|
|
15522
|
-
|
|
15523
|
-
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
})
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
16053
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
16054
|
+
var ProfileRefInputSchema = object({
|
|
16055
|
+
addonId: string(),
|
|
16056
|
+
profileId: string()
|
|
16057
|
+
});
|
|
16058
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
16059
|
+
kind: "mutation",
|
|
16060
|
+
auth: "admin"
|
|
16061
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16062
|
+
kind: "mutation",
|
|
16063
|
+
auth: "admin"
|
|
16064
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
16065
|
+
kind: "mutation",
|
|
16066
|
+
auth: "admin"
|
|
16067
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
16068
|
+
selector: LlmDefaultSelectorSchema,
|
|
16069
|
+
profileId: string().nullable()
|
|
16070
|
+
}), _void(), {
|
|
16071
|
+
kind: "mutation",
|
|
16072
|
+
auth: "admin"
|
|
16073
|
+
}), method(object({
|
|
16074
|
+
since: number().optional(),
|
|
16075
|
+
until: number().optional(),
|
|
16076
|
+
consumer: string().optional(),
|
|
16077
|
+
profileId: string().optional()
|
|
16078
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16079
|
+
nodeId: string(),
|
|
16080
|
+
model: ManagedModelRefSchema
|
|
16081
|
+
}), _void(), {
|
|
16082
|
+
kind: "mutation",
|
|
16083
|
+
auth: "admin"
|
|
16084
|
+
}), method(object({
|
|
16085
|
+
nodeId: string(),
|
|
16086
|
+
file: string()
|
|
16087
|
+
}), _void(), {
|
|
16088
|
+
kind: "mutation",
|
|
16089
|
+
auth: "admin"
|
|
16090
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16091
|
+
kind: "mutation",
|
|
16092
|
+
auth: "admin"
|
|
16093
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16094
|
+
kind: "mutation",
|
|
16095
|
+
auth: "admin"
|
|
16096
|
+
});
|
|
16097
|
+
var LogLevelSchema = _enum([
|
|
16098
|
+
"debug",
|
|
16099
|
+
"info",
|
|
16100
|
+
"warn",
|
|
16101
|
+
"error"
|
|
16102
|
+
]);
|
|
16103
|
+
var LogEntrySchema = object({
|
|
16104
|
+
timestamp: date(),
|
|
16105
|
+
level: LogLevelSchema,
|
|
16106
|
+
scope: array(string()),
|
|
16107
|
+
message: string(),
|
|
16108
|
+
meta: record(string(), unknown()).optional(),
|
|
16109
|
+
tags: record(string(), string()).optional()
|
|
16110
|
+
});
|
|
16111
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
16112
|
+
scope: array(string()).optional(),
|
|
16113
|
+
level: LogLevelSchema.optional(),
|
|
16114
|
+
since: date().optional(),
|
|
16115
|
+
until: date().optional(),
|
|
16116
|
+
limit: number().optional(),
|
|
16117
|
+
tags: record(string(), string()).optional()
|
|
16118
|
+
}), array(LogEntrySchema).readonly());
|
|
16119
|
+
/**
|
|
16120
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
16121
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
16122
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
16123
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
16124
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
16125
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
15546
16126
|
*
|
|
15547
|
-
*
|
|
15548
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
15549
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
15550
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
15551
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
15552
|
-
* message to what the kind supports — callers never special-case a service.
|
|
16127
|
+
* A contribution is a discriminated union on `kind`:
|
|
15553
16128
|
*
|
|
15554
|
-
*
|
|
15555
|
-
*
|
|
15556
|
-
* `
|
|
15557
|
-
*
|
|
15558
|
-
*
|
|
15559
|
-
* alternative would fork the UI per addon and cannot host the
|
|
15560
|
-
* discovery→adopt flow.
|
|
15561
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
15562
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
15563
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
15564
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
15565
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
15566
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
15567
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
15568
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
15569
|
-
* base64 fallback needed.
|
|
16129
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
16130
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16131
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
16132
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16133
|
+
* login page needs NO change.
|
|
15570
16134
|
*
|
|
15571
|
-
*
|
|
15572
|
-
*
|
|
15573
|
-
*
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
*
|
|
15577
|
-
*
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
|
|
15585
|
-
|
|
15586
|
-
|
|
15587
|
-
*
|
|
15588
|
-
*
|
|
15589
|
-
*
|
|
15590
|
-
*
|
|
16135
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
16136
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
16137
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
16138
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
16139
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
16140
|
+
*
|
|
16141
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
16142
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
16143
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
16144
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
16145
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
16146
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
16147
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
16148
|
+
* decision.
|
|
16149
|
+
*
|
|
16150
|
+
* Every contribution carries a `stage`:
|
|
16151
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
16152
|
+
* magic-link buttons; a future usernameless passkey).
|
|
16153
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16154
|
+
* returned `factors` (passkey-as-2FA today).
|
|
16155
|
+
*
|
|
16156
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
16157
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
16158
|
+
* tRPC router.
|
|
15591
16159
|
*/
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
|
|
15596
|
-
|
|
15597
|
-
|
|
15598
|
-
|
|
15599
|
-
|
|
15600
|
-
|
|
15601
|
-
|
|
15602
|
-
|
|
16160
|
+
/** When a login method renders in the two-phase login flow. */
|
|
16161
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
16162
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
16163
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
16164
|
+
object({
|
|
16165
|
+
kind: literal("redirect"),
|
|
16166
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
16167
|
+
id: string(),
|
|
16168
|
+
/** Operator-facing button label. */
|
|
16169
|
+
label: string(),
|
|
16170
|
+
/** lucide-react icon name. */
|
|
16171
|
+
icon: string().optional(),
|
|
16172
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
16173
|
+
startUrl: string(),
|
|
16174
|
+
stage: LoginStageEnum
|
|
16175
|
+
}),
|
|
16176
|
+
object({
|
|
16177
|
+
kind: literal("widget"),
|
|
16178
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
16179
|
+
id: string(),
|
|
16180
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
16181
|
+
addonId: string(),
|
|
16182
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
16183
|
+
bundle: string(),
|
|
16184
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
16185
|
+
remote: WidgetRemoteSchema,
|
|
16186
|
+
stage: LoginStageEnum
|
|
16187
|
+
}),
|
|
16188
|
+
object({
|
|
16189
|
+
kind: literal("passkey"),
|
|
16190
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
16191
|
+
id: string(),
|
|
16192
|
+
/** Operator-facing button label. */
|
|
16193
|
+
label: string(),
|
|
16194
|
+
stage: LoginStageEnum,
|
|
16195
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
16196
|
+
rpId: string(),
|
|
16197
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
16198
|
+
origin: string().nullable()
|
|
16199
|
+
})
|
|
15603
16200
|
]);
|
|
15604
|
-
|
|
15605
|
-
var
|
|
15606
|
-
|
|
15607
|
-
|
|
15608
|
-
|
|
16201
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
16202
|
+
var CpuBreakdownSchema = object({
|
|
16203
|
+
total: number(),
|
|
16204
|
+
user: number(),
|
|
16205
|
+
system: number(),
|
|
16206
|
+
irq: number(),
|
|
16207
|
+
nice: number(),
|
|
16208
|
+
loadAvg: tuple([
|
|
16209
|
+
number(),
|
|
16210
|
+
number(),
|
|
16211
|
+
number()
|
|
16212
|
+
]),
|
|
16213
|
+
cores: number()
|
|
15609
16214
|
});
|
|
15610
|
-
|
|
15611
|
-
|
|
15612
|
-
|
|
15613
|
-
|
|
15614
|
-
|
|
15615
|
-
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
var
|
|
15619
|
-
|
|
15620
|
-
|
|
15621
|
-
|
|
15622
|
-
|
|
15623
|
-
|
|
15624
|
-
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15628
|
-
|
|
15629
|
-
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
16215
|
+
var MemoryInfoSchema = object({
|
|
16216
|
+
percent: number(),
|
|
16217
|
+
totalBytes: number(),
|
|
16218
|
+
usedBytes: number(),
|
|
16219
|
+
availableBytes: number(),
|
|
16220
|
+
swapUsedBytes: number(),
|
|
16221
|
+
swapTotalBytes: number()
|
|
16222
|
+
});
|
|
16223
|
+
var DiskIoSnapshotSchema = object({
|
|
16224
|
+
readBytes: number(),
|
|
16225
|
+
writeBytes: number(),
|
|
16226
|
+
readOps: number(),
|
|
16227
|
+
writeOps: number(),
|
|
16228
|
+
timestampMs: number()
|
|
16229
|
+
});
|
|
16230
|
+
var NetworkIoSnapshotSchema = object({
|
|
16231
|
+
rxBytes: number(),
|
|
16232
|
+
txBytes: number(),
|
|
16233
|
+
rxPackets: number(),
|
|
16234
|
+
txPackets: number(),
|
|
16235
|
+
rxErrors: number(),
|
|
16236
|
+
txErrors: number(),
|
|
16237
|
+
timestampMs: number()
|
|
16238
|
+
});
|
|
16239
|
+
var MetricsGpuInfoSchema = object({
|
|
16240
|
+
utilization: number(),
|
|
16241
|
+
model: string(),
|
|
16242
|
+
memoryUsedBytes: number(),
|
|
16243
|
+
memoryTotalBytes: number(),
|
|
16244
|
+
temperature: number().nullable()
|
|
16245
|
+
});
|
|
16246
|
+
var ProcessResourceInfoSchema = object({
|
|
16247
|
+
openFds: number(),
|
|
16248
|
+
threadCount: number(),
|
|
16249
|
+
activeHandles: number(),
|
|
16250
|
+
activeRequests: number()
|
|
15633
16251
|
});
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
15639
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
15640
|
-
flags: object({
|
|
15641
|
-
critical: boolean().optional(),
|
|
15642
|
-
silent: boolean().optional(),
|
|
15643
|
-
noPush: boolean().optional()
|
|
15644
|
-
}).optional(),
|
|
15645
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
15646
|
-
requires: array(string()).optional(),
|
|
15647
|
-
description: string().optional()
|
|
16252
|
+
var PressureAvgsSchema = object({
|
|
16253
|
+
avg10: number(),
|
|
16254
|
+
avg60: number(),
|
|
16255
|
+
avg300: number()
|
|
15648
16256
|
});
|
|
15649
|
-
|
|
15650
|
-
|
|
15651
|
-
|
|
15652
|
-
|
|
15653
|
-
|
|
15654
|
-
|
|
15655
|
-
|
|
15656
|
-
|
|
15657
|
-
|
|
15658
|
-
|
|
15659
|
-
|
|
16257
|
+
var PressureInfoSchema = object({
|
|
16258
|
+
some: PressureAvgsSchema,
|
|
16259
|
+
full: PressureAvgsSchema.nullable()
|
|
16260
|
+
});
|
|
16261
|
+
var SystemResourceSnapshotSchema = object({
|
|
16262
|
+
cpu: CpuBreakdownSchema,
|
|
16263
|
+
memory: MemoryInfoSchema,
|
|
16264
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
16265
|
+
network: NetworkIoSnapshotSchema,
|
|
16266
|
+
disk: DiskIoSnapshotSchema,
|
|
16267
|
+
pressure: object({
|
|
16268
|
+
cpu: PressureInfoSchema.nullable(),
|
|
16269
|
+
memory: PressureInfoSchema.nullable(),
|
|
16270
|
+
io: PressureInfoSchema.nullable()
|
|
15660
16271
|
}),
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
format: array(NotificationFormatSchema),
|
|
15665
|
-
clickUrl: boolean(),
|
|
15666
|
-
sound: boolean(),
|
|
15667
|
-
ttl: boolean(),
|
|
15668
|
-
bodyMaxLen: number().int().positive()
|
|
16272
|
+
process: ProcessResourceInfoSchema,
|
|
16273
|
+
cpuTemperature: number().nullable(),
|
|
16274
|
+
timestampMs: number()
|
|
15669
16275
|
});
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
|
|
15674
|
-
|
|
15675
|
-
|
|
15676
|
-
*/
|
|
15677
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
15678
|
-
var TargetKindSchema = object({
|
|
15679
|
-
kind: string(),
|
|
15680
|
-
label: string(),
|
|
15681
|
-
icon: string(),
|
|
15682
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15683
|
-
addonId: string(),
|
|
15684
|
-
configSchema: ConfigSchemaPassthrough$1,
|
|
15685
|
-
supportsDiscovery: boolean(),
|
|
15686
|
-
caps: TargetKindCapsSchema
|
|
16276
|
+
var DiskSpaceInfoSchema = object({
|
|
16277
|
+
path: string(),
|
|
16278
|
+
totalBytes: number(),
|
|
16279
|
+
usedBytes: number(),
|
|
16280
|
+
availableBytes: number(),
|
|
16281
|
+
percent: number()
|
|
15687
16282
|
});
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
|
|
15696
|
-
|
|
16283
|
+
var PidResourceStatsSchema = object({
|
|
16284
|
+
pid: number(),
|
|
16285
|
+
cpu: number(),
|
|
16286
|
+
memory: number(),
|
|
16287
|
+
/**
|
|
16288
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
16289
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
16290
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
16291
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
16292
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
16293
|
+
*/
|
|
16294
|
+
privateBytes: number().optional(),
|
|
16295
|
+
/**
|
|
16296
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
16297
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
16298
|
+
*/
|
|
16299
|
+
sharedBytes: number().optional()
|
|
16300
|
+
});
|
|
16301
|
+
var AddonInstanceSchema = object({
|
|
15697
16302
|
addonId: string(),
|
|
15698
|
-
|
|
15699
|
-
|
|
16303
|
+
nodeId: string(),
|
|
16304
|
+
role: _enum(["hub", "worker"]),
|
|
16305
|
+
pid: number(),
|
|
16306
|
+
state: _enum([
|
|
16307
|
+
"starting",
|
|
16308
|
+
"running",
|
|
16309
|
+
"stopping",
|
|
16310
|
+
"stopped",
|
|
16311
|
+
"crashed"
|
|
16312
|
+
]),
|
|
16313
|
+
uptimeSec: number()
|
|
15700
16314
|
});
|
|
15701
|
-
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
16315
|
+
var NodeProcessSchema = object({
|
|
16316
|
+
pid: number(),
|
|
16317
|
+
ppid: number(),
|
|
16318
|
+
pgid: number(),
|
|
16319
|
+
classification: _enum([
|
|
16320
|
+
"root",
|
|
16321
|
+
"managed",
|
|
16322
|
+
"system",
|
|
16323
|
+
"ghost"
|
|
16324
|
+
]),
|
|
16325
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
16326
|
+
addonId: string().nullable(),
|
|
16327
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
16328
|
+
nodeId: string().nullable(),
|
|
16329
|
+
/** Truncated command line. */
|
|
16330
|
+
command: string(),
|
|
16331
|
+
cpuPercent: number(),
|
|
16332
|
+
memoryRssBytes: number(),
|
|
16333
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
16334
|
+
uptimeSec: number(),
|
|
16335
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
16336
|
+
orphaned: boolean()
|
|
15706
16337
|
});
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
attachmentsSent: number().int().nonnegative(),
|
|
15712
|
-
actionsSent: number().int().nonnegative(),
|
|
15713
|
-
truncated: boolean(),
|
|
15714
|
-
dropped: array(string())
|
|
16338
|
+
var KillProcessInputSchema = object({
|
|
16339
|
+
pid: number(),
|
|
16340
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
16341
|
+
force: boolean().optional()
|
|
15715
16342
|
});
|
|
15716
|
-
var
|
|
16343
|
+
var KillProcessResultSchema = object({
|
|
16344
|
+
success: boolean(),
|
|
16345
|
+
reason: string().optional(),
|
|
16346
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
16347
|
+
});
|
|
16348
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
16349
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
16350
|
+
addonId: string() });
|
|
16351
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
15717
16352
|
success: boolean(),
|
|
16353
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
16354
|
+
path: string().optional(),
|
|
16355
|
+
/** Process pid that was signalled. */
|
|
16356
|
+
pid: number().optional(),
|
|
16357
|
+
reason: string().optional()
|
|
16358
|
+
});
|
|
16359
|
+
var SystemMetricsSchema = object({
|
|
16360
|
+
cpuPercent: number(),
|
|
16361
|
+
memoryPercent: number(),
|
|
16362
|
+
memoryUsedMB: number(),
|
|
16363
|
+
memoryTotalMB: number(),
|
|
16364
|
+
diskPercent: number().optional(),
|
|
16365
|
+
temperature: number().optional(),
|
|
16366
|
+
gpuPercent: number().optional(),
|
|
16367
|
+
gpuMemoryPercent: number().optional()
|
|
16368
|
+
});
|
|
16369
|
+
method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string() }), DiskSpaceInfoSchema), method(_void(), MetricsGpuInfoSchema.nullable()), method(_void(), number().nullable()), method(object({ pids: array(number()) }), array(PidResourceStatsSchema)), method(_void(), array(AddonInstanceSchema).readonly()), method(object({ addonId: string() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(KillProcessInputSchema, KillProcessResultSchema, {
|
|
16370
|
+
kind: "mutation",
|
|
16371
|
+
auth: "admin"
|
|
16372
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
16373
|
+
kind: "mutation",
|
|
16374
|
+
auth: "admin"
|
|
16375
|
+
});
|
|
16376
|
+
method(object({
|
|
16377
|
+
sourceUrl: string(),
|
|
16378
|
+
metadata: ModelConvertMetadataSchema,
|
|
16379
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
16380
|
+
calibrationRef: string().optional(),
|
|
16381
|
+
sessionId: string().optional()
|
|
16382
|
+
}), ConvertResultSchema, {
|
|
16383
|
+
kind: "mutation",
|
|
16384
|
+
auth: "admin",
|
|
16385
|
+
timeoutMs: 6e5
|
|
16386
|
+
});
|
|
16387
|
+
method(object({
|
|
16388
|
+
nodeId: string(),
|
|
16389
|
+
modelId: string(),
|
|
16390
|
+
format: _enum(MODEL_FORMATS),
|
|
16391
|
+
entry: ModelCatalogEntrySchema
|
|
16392
|
+
}), object({
|
|
16393
|
+
ok: boolean(),
|
|
16394
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
16395
|
+
sha256: string(),
|
|
16396
|
+
bytes: number(),
|
|
16397
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
16398
|
+
path: string()
|
|
16399
|
+
}), {
|
|
16400
|
+
kind: "mutation",
|
|
16401
|
+
auth: "admin"
|
|
16402
|
+
});
|
|
16403
|
+
/**
|
|
16404
|
+
* `mqtt-broker` — broker-registry cap.
|
|
16405
|
+
*
|
|
16406
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
16407
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
16408
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
16409
|
+
* its OWN `mqtt.js` client.
|
|
16410
|
+
*
|
|
16411
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
16412
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
16413
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
16414
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
16415
|
+
* features anyway — give it the connection config, get out of the way.
|
|
16416
|
+
*
|
|
16417
|
+
* Consumer flow:
|
|
16418
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
16419
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
16420
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
16421
|
+
*
|
|
16422
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
16423
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
16424
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
16425
|
+
* spawned it.
|
|
16426
|
+
*/
|
|
16427
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
16428
|
+
/**
|
|
16429
|
+
* Broker live-probe status.
|
|
16430
|
+
*
|
|
16431
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
16432
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
16433
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
16434
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
16435
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16436
|
+
*/
|
|
16437
|
+
var BrokerStatusSchema$1 = _enum([
|
|
16438
|
+
"connected",
|
|
16439
|
+
"disconnected",
|
|
16440
|
+
"auth-failed",
|
|
16441
|
+
"unreachable",
|
|
16442
|
+
"tls-error"
|
|
16443
|
+
]);
|
|
16444
|
+
var BrokerInfoSchema = object({
|
|
16445
|
+
id: string(),
|
|
16446
|
+
name: string(),
|
|
16447
|
+
url: string(),
|
|
16448
|
+
kind: BrokerKindSchema,
|
|
16449
|
+
status: BrokerStatusSchema$1,
|
|
16450
|
+
latencyMs: number().nullable(),
|
|
15718
16451
|
error: string().optional(),
|
|
15719
|
-
|
|
16452
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
16453
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
16454
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
16455
|
+
lastCheckedAt: number().optional()
|
|
15720
16456
|
});
|
|
15721
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
15722
|
-
var TestResultSchema = SendResultSchema;
|
|
15723
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
15724
|
-
kind: string(),
|
|
15725
|
-
config: record(string(), unknown()).optional()
|
|
15726
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
15727
|
-
targetId: string(),
|
|
15728
|
-
notification: NotificationSchema
|
|
15729
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
15730
|
-
targetId: string(),
|
|
15731
|
-
sample: NotificationSchema.optional()
|
|
15732
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
15733
|
-
targetId: string(),
|
|
15734
|
-
enabled: boolean()
|
|
15735
|
-
}), _void(), { kind: "mutation" });
|
|
15736
16457
|
/**
|
|
15737
|
-
*
|
|
15738
|
-
*
|
|
15739
|
-
*
|
|
15740
|
-
*
|
|
15741
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15742
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
15743
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
16458
|
+
* Connection details — what a consumer needs to call
|
|
16459
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
16460
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
16461
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
15744
16462
|
*/
|
|
15745
|
-
var
|
|
15746
|
-
|
|
15747
|
-
|
|
16463
|
+
var BrokerConnectionDetailsSchema = object({
|
|
16464
|
+
url: string(),
|
|
16465
|
+
username: string().optional(),
|
|
16466
|
+
password: string().optional(),
|
|
16467
|
+
/**
|
|
16468
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
16469
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
16470
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
16471
|
+
* broker).
|
|
16472
|
+
*/
|
|
16473
|
+
clientIdPrefix: string().optional()
|
|
15748
16474
|
});
|
|
15749
|
-
var
|
|
15750
|
-
|
|
15751
|
-
"
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
|
|
15756
|
-
|
|
15757
|
-
|
|
15758
|
-
|
|
15759
|
-
]);
|
|
15760
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
16475
|
+
var AddBrokerInputSchema = object({
|
|
16476
|
+
name: string().min(1),
|
|
16477
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
16478
|
+
username: string().optional(),
|
|
16479
|
+
password: string().optional(),
|
|
16480
|
+
clientIdPrefix: string().optional()
|
|
16481
|
+
});
|
|
16482
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
16483
|
+
var IdInputSchema = object({ id: string() });
|
|
16484
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
15761
16485
|
ok: literal(true),
|
|
15762
|
-
text: string(),
|
|
15763
|
-
model: string(),
|
|
15764
|
-
usage: LlmUsageSchema,
|
|
15765
|
-
truncated: boolean(),
|
|
15766
16486
|
latencyMs: number()
|
|
15767
16487
|
}), object({
|
|
15768
16488
|
ok: literal(false),
|
|
15769
|
-
|
|
15770
|
-
message: string(),
|
|
15771
|
-
retryAfterMs: number().optional()
|
|
16489
|
+
error: string()
|
|
15772
16490
|
})]);
|
|
15773
|
-
|
|
15774
|
-
|
|
15775
|
-
|
|
15776
|
-
|
|
15777
|
-
*/
|
|
15778
|
-
|
|
15779
|
-
|
|
15780
|
-
mimeType: string()
|
|
16491
|
+
var StartEmbeddedInputSchema = object({
|
|
16492
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
16493
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
16494
|
+
allowAnonymous: boolean().default(false),
|
|
16495
|
+
/** Optional shared username/password for clients. */
|
|
16496
|
+
username: string().optional(),
|
|
16497
|
+
password: string().optional()
|
|
15781
16498
|
});
|
|
15782
|
-
var
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15786
|
-
profileId: string().optional(),
|
|
15787
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15788
|
-
consumer: string(),
|
|
15789
|
-
system: string().optional(),
|
|
15790
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15791
|
-
prompt: string(),
|
|
15792
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15793
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
15794
|
-
/** Per-call override of the profile default. */
|
|
15795
|
-
maxTokens: number().int().positive().optional(),
|
|
15796
|
-
temperature: number().optional()
|
|
16499
|
+
var StartEmbeddedResultSchema = object({
|
|
16500
|
+
id: string(),
|
|
16501
|
+
url: string()
|
|
15797
16502
|
});
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15802
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15803
|
-
* this only through the `llm` cap's methods.
|
|
15804
|
-
*
|
|
15805
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15806
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15807
|
-
* watchdog — operator decision #3).
|
|
15808
|
-
*/
|
|
15809
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15810
|
-
object({
|
|
15811
|
-
kind: literal("catalog"),
|
|
15812
|
-
catalogId: string()
|
|
15813
|
-
}),
|
|
15814
|
-
object({
|
|
15815
|
-
kind: literal("url"),
|
|
15816
|
-
url: string(),
|
|
15817
|
-
sha256: string().optional()
|
|
15818
|
-
}),
|
|
15819
|
-
object({
|
|
15820
|
-
kind: literal("path"),
|
|
15821
|
-
path: string()
|
|
15822
|
-
})
|
|
15823
|
-
]);
|
|
15824
|
-
var ManagedRuntimeConfigSchema = object({
|
|
15825
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
15826
|
-
nodeId: string(),
|
|
15827
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15828
|
-
engine: _enum(["llama-cpp"]),
|
|
15829
|
-
model: ManagedModelRefSchema,
|
|
15830
|
-
contextSize: number().int().default(4096),
|
|
15831
|
-
/** 0 = CPU-only. */
|
|
15832
|
-
gpuLayers: number().int().default(0),
|
|
15833
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15834
|
-
threads: number().int().optional(),
|
|
15835
|
-
/** Concurrent slots. */
|
|
15836
|
-
parallel: number().int().default(1),
|
|
15837
|
-
/** Else lazy: first generate boots it. */
|
|
15838
|
-
autoStart: boolean().default(false),
|
|
15839
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
15840
|
-
idleStopMinutes: number().int().default(30)
|
|
16503
|
+
var StatusSchema = object({
|
|
16504
|
+
brokerCount: number(),
|
|
16505
|
+
embeddedRunning: boolean()
|
|
15841
16506
|
});
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
"starting",
|
|
15849
|
-
"ready",
|
|
15850
|
-
"crashed",
|
|
15851
|
-
"failed"
|
|
15852
|
-
]),
|
|
15853
|
-
pid: number().optional(),
|
|
15854
|
-
port: number().optional(),
|
|
15855
|
-
modelPath: string().optional(),
|
|
15856
|
-
modelId: string().optional(),
|
|
15857
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
15858
|
-
lastError: string().optional(),
|
|
15859
|
-
crashesInWindow: number(),
|
|
15860
|
-
/** Child RSS (sampled best-effort). */
|
|
15861
|
-
memoryBytes: number().optional(),
|
|
15862
|
-
vramBytes: number().optional()
|
|
16507
|
+
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
|
|
16508
|
+
var NetworkEndpointSchema = object({
|
|
16509
|
+
url: string(),
|
|
16510
|
+
hostname: string(),
|
|
16511
|
+
port: number(),
|
|
16512
|
+
protocol: _enum(["http", "https"])
|
|
15863
16513
|
});
|
|
15864
|
-
var
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
installedAt: number().optional()
|
|
16514
|
+
var NetworkAccessStatusSchema = object({
|
|
16515
|
+
connected: boolean(),
|
|
16516
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
16517
|
+
error: string().optional()
|
|
15869
16518
|
});
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
16519
|
+
/**
|
|
16520
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
16521
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
16522
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
16523
|
+
* the originating provider config (mode + sourcePort) so the
|
|
16524
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
16525
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
16526
|
+
*/
|
|
16527
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
16528
|
+
/**
|
|
16529
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
16530
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
16531
|
+
*/
|
|
16532
|
+
id: string(),
|
|
16533
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
16534
|
+
label: string(),
|
|
16535
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
16536
|
+
mode: string().optional(),
|
|
16537
|
+
/** Originating local port the ingress fronts (informational). */
|
|
16538
|
+
sourcePort: number().optional()
|
|
15874
16539
|
});
|
|
15875
|
-
method(
|
|
15876
|
-
images: array(LlmImageSchema).optional(),
|
|
15877
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
15878
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15879
|
-
timeoutMs: number().int().positive().optional()
|
|
15880
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15881
|
-
kind: "mutation",
|
|
15882
|
-
auth: "admin"
|
|
15883
|
-
}), method(object({}), _void(), {
|
|
15884
|
-
kind: "mutation",
|
|
15885
|
-
auth: "admin"
|
|
15886
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15887
|
-
kind: "mutation",
|
|
15888
|
-
auth: "admin"
|
|
15889
|
-
}), method(object({ file: string() }), _void(), {
|
|
15890
|
-
kind: "mutation",
|
|
15891
|
-
auth: "admin"
|
|
15892
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
16540
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
15893
16541
|
/**
|
|
15894
|
-
*
|
|
15895
|
-
*
|
|
15896
|
-
*
|
|
15897
|
-
*
|
|
15898
|
-
*
|
|
16542
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
16543
|
+
*
|
|
16544
|
+
* Apprise-derived model (see
|
|
16545
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
16546
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
16547
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16548
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
16549
|
+
* message to what the kind supports — callers never special-case a service.
|
|
16550
|
+
*
|
|
16551
|
+
* DESIGN DECISIONS (locked):
|
|
16552
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
16553
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
16554
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
16555
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
16556
|
+
* alternative would fork the UI per addon and cannot host the
|
|
16557
|
+
* discovery→adopt flow.
|
|
16558
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
16559
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
16560
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
16561
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
16562
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
16563
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
16564
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
16565
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
16566
|
+
* base64 fallback needed.
|
|
15899
16567
|
*
|
|
15900
|
-
*
|
|
15901
|
-
* `
|
|
15902
|
-
*
|
|
16568
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
16569
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
16570
|
+
* admin "Integrations" page.
|
|
15903
16571
|
*/
|
|
15904
|
-
|
|
15905
|
-
|
|
15906
|
-
|
|
15907
|
-
|
|
15908
|
-
|
|
15909
|
-
"
|
|
16572
|
+
/**
|
|
16573
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
16574
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
16575
|
+
*/
|
|
16576
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
16577
|
+
"image",
|
|
16578
|
+
"video",
|
|
16579
|
+
"gif",
|
|
16580
|
+
"audio",
|
|
16581
|
+
"icon"
|
|
15910
16582
|
]);
|
|
15911
|
-
|
|
16583
|
+
/**
|
|
16584
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
16585
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
16586
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
16587
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
16588
|
+
*/
|
|
16589
|
+
var AttachmentSchema = object({
|
|
16590
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
16591
|
+
url: string().optional(),
|
|
16592
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
16593
|
+
mime: string().optional(),
|
|
16594
|
+
name: string().optional()
|
|
16595
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
16596
|
+
var NotificationFormatSchema = _enum([
|
|
16597
|
+
"text",
|
|
16598
|
+
"markdown",
|
|
16599
|
+
"html"
|
|
16600
|
+
]);
|
|
16601
|
+
/** A single tap-through action button. */
|
|
16602
|
+
var NotificationActionSchema = object({
|
|
15912
16603
|
id: string(),
|
|
15913
|
-
|
|
15914
|
-
|
|
15915
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
15916
|
-
addonId: string(),
|
|
15917
|
-
enabled: boolean(),
|
|
15918
|
-
/** Vendor model id, or the managed runtime's loaded model. */
|
|
15919
|
-
model: string(),
|
|
15920
|
-
/** Required for openai-compatible; override for cloud kinds. */
|
|
15921
|
-
baseUrl: string().optional(),
|
|
15922
|
-
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
15923
|
-
apiKey: string().optional(),
|
|
15924
|
-
supportsVision: boolean(),
|
|
15925
|
-
temperature: number().min(0).max(2).optional(),
|
|
15926
|
-
maxTokens: number().int().positive().optional(),
|
|
15927
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
15928
|
-
extraHeaders: record(string(), string()).optional(),
|
|
15929
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
15930
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
16604
|
+
label: string(),
|
|
16605
|
+
url: string().optional()
|
|
15931
16606
|
});
|
|
15932
|
-
/**
|
|
15933
|
-
*
|
|
15934
|
-
*
|
|
16607
|
+
/**
|
|
16608
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
16609
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
16610
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
16611
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
16612
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
16613
|
+
* `priority` for that one target.
|
|
16614
|
+
*/
|
|
16615
|
+
var NotificationSchema = object({
|
|
16616
|
+
body: string(),
|
|
16617
|
+
title: string().optional(),
|
|
16618
|
+
format: NotificationFormatSchema.default("text"),
|
|
16619
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16620
|
+
level: string().optional(),
|
|
16621
|
+
attachments: array(AttachmentSchema).optional(),
|
|
16622
|
+
clickUrl: string().optional(),
|
|
16623
|
+
actions: array(NotificationActionSchema).optional(),
|
|
16624
|
+
sound: string().optional(),
|
|
16625
|
+
ttl: number().optional(),
|
|
16626
|
+
tag: string().optional(),
|
|
16627
|
+
deviceId: number().optional(),
|
|
16628
|
+
eventId: string().optional(),
|
|
16629
|
+
metadata: record(string(), unknown()).optional()
|
|
16630
|
+
});
|
|
16631
|
+
/** One declared native severity/priority level for a kind. */
|
|
16632
|
+
var TargetKindLevelSchema = object({
|
|
16633
|
+
id: string(),
|
|
16634
|
+
label: string(),
|
|
16635
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
16636
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
16637
|
+
flags: object({
|
|
16638
|
+
critical: boolean().optional(),
|
|
16639
|
+
silent: boolean().optional(),
|
|
16640
|
+
noPush: boolean().optional()
|
|
16641
|
+
}).optional(),
|
|
16642
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
16643
|
+
requires: array(string()).optional(),
|
|
16644
|
+
description: string().optional()
|
|
16645
|
+
});
|
|
16646
|
+
/** The full capability block consulted before dispatch. */
|
|
16647
|
+
var TargetKindCapsSchema = object({
|
|
16648
|
+
attachments: object({
|
|
16649
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
16650
|
+
mode: _enum([
|
|
16651
|
+
"url",
|
|
16652
|
+
"bytes",
|
|
16653
|
+
"both"
|
|
16654
|
+
]),
|
|
16655
|
+
max: number().int().nonnegative(),
|
|
16656
|
+
maxBytes: number().int().positive().optional()
|
|
16657
|
+
}),
|
|
16658
|
+
/** Max action buttons (0 = none). */
|
|
16659
|
+
actions: number().int().nonnegative(),
|
|
16660
|
+
levels: array(TargetKindLevelSchema),
|
|
16661
|
+
format: array(NotificationFormatSchema),
|
|
16662
|
+
clickUrl: boolean(),
|
|
16663
|
+
sound: boolean(),
|
|
16664
|
+
ttl: boolean(),
|
|
16665
|
+
bodyMaxLen: number().int().positive()
|
|
16666
|
+
});
|
|
16667
|
+
/**
|
|
16668
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
16669
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
16670
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
16671
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
16672
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
16673
|
+
*/
|
|
15935
16674
|
var ConfigSchemaPassthrough = unknown();
|
|
15936
|
-
var
|
|
15937
|
-
kind:
|
|
16675
|
+
var TargetKindSchema = object({
|
|
16676
|
+
kind: string(),
|
|
15938
16677
|
label: string(),
|
|
15939
16678
|
icon: string(),
|
|
15940
16679
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15941
16680
|
addonId: string(),
|
|
15942
|
-
configSchema: ConfigSchemaPassthrough
|
|
15943
|
-
|
|
15944
|
-
|
|
15945
|
-
var LlmDefaultSchema = object({
|
|
15946
|
-
selector: LlmDefaultSelectorSchema,
|
|
15947
|
-
profileId: string()
|
|
15948
|
-
});
|
|
15949
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
15950
|
-
var LlmUsageRollupSchema = object({
|
|
15951
|
-
day: string(),
|
|
15952
|
-
consumer: string(),
|
|
15953
|
-
profileId: string(),
|
|
15954
|
-
calls: number(),
|
|
15955
|
-
okCalls: number(),
|
|
15956
|
-
errorCalls: number(),
|
|
15957
|
-
inputTokens: number(),
|
|
15958
|
-
outputTokens: number(),
|
|
15959
|
-
avgLatencyMs: number()
|
|
16681
|
+
configSchema: ConfigSchemaPassthrough,
|
|
16682
|
+
supportsDiscovery: boolean(),
|
|
16683
|
+
caps: TargetKindCapsSchema
|
|
15960
16684
|
});
|
|
15961
|
-
/**
|
|
15962
|
-
|
|
16685
|
+
/**
|
|
16686
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
16687
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
16688
|
+
* round-trip a stored secret to the UI.
|
|
16689
|
+
*/
|
|
16690
|
+
var TargetSchema = object({
|
|
15963
16691
|
id: string(),
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
purpose: _enum(["text", "vision"]),
|
|
15967
|
-
url: string(),
|
|
15968
|
-
sha256: string(),
|
|
15969
|
-
sizeBytes: number(),
|
|
15970
|
-
quantization: string(),
|
|
15971
|
-
/** Load-time guidance shown in the picker. */
|
|
15972
|
-
minRamBytes: number(),
|
|
15973
|
-
contextSizeDefault: number().int(),
|
|
15974
|
-
/** Vision models: companion projector file. */
|
|
15975
|
-
mmprojUrl: string().optional()
|
|
15976
|
-
});
|
|
15977
|
-
var LlmRuntimeNodeSchema = object({
|
|
15978
|
-
nodeId: string(),
|
|
15979
|
-
reachable: boolean(),
|
|
15980
|
-
status: LlmRuntimeStatusSchema.optional(),
|
|
15981
|
-
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15982
|
-
error: string().optional()
|
|
15983
|
-
});
|
|
15984
|
-
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
15985
|
-
var ProfileRefInputSchema = object({
|
|
16692
|
+
name: string(),
|
|
16693
|
+
kind: string(),
|
|
15986
16694
|
addonId: string(),
|
|
15987
|
-
|
|
16695
|
+
enabled: boolean(),
|
|
16696
|
+
config: record(string(), unknown())
|
|
15988
16697
|
});
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
profileId: string().optional()
|
|
16009
|
-
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16010
|
-
nodeId: string(),
|
|
16011
|
-
model: ManagedModelRefSchema
|
|
16012
|
-
}), _void(), {
|
|
16013
|
-
kind: "mutation",
|
|
16014
|
-
auth: "admin"
|
|
16015
|
-
}), method(object({
|
|
16016
|
-
nodeId: string(),
|
|
16017
|
-
file: string()
|
|
16018
|
-
}), _void(), {
|
|
16019
|
-
kind: "mutation",
|
|
16020
|
-
auth: "admin"
|
|
16021
|
-
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16022
|
-
kind: "mutation",
|
|
16023
|
-
auth: "admin"
|
|
16024
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
16025
|
-
kind: "mutation",
|
|
16026
|
-
auth: "admin"
|
|
16698
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
16699
|
+
var DiscoveredTargetSchema = object({
|
|
16700
|
+
kind: string(),
|
|
16701
|
+
suggestedName: string(),
|
|
16702
|
+
config: record(string(), unknown())
|
|
16703
|
+
});
|
|
16704
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
16705
|
+
var RenderedAsSchema = object({
|
|
16706
|
+
level: string(),
|
|
16707
|
+
format: NotificationFormatSchema,
|
|
16708
|
+
attachmentsSent: number().int().nonnegative(),
|
|
16709
|
+
actionsSent: number().int().nonnegative(),
|
|
16710
|
+
truncated: boolean(),
|
|
16711
|
+
dropped: array(string())
|
|
16712
|
+
});
|
|
16713
|
+
var SendResultSchema = object({
|
|
16714
|
+
success: boolean(),
|
|
16715
|
+
error: string().optional(),
|
|
16716
|
+
renderedAs: RenderedAsSchema.optional()
|
|
16027
16717
|
});
|
|
16718
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
16719
|
+
var TestResultSchema = SendResultSchema;
|
|
16720
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
16721
|
+
kind: string(),
|
|
16722
|
+
config: record(string(), unknown()).optional()
|
|
16723
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
16724
|
+
targetId: string(),
|
|
16725
|
+
notification: NotificationSchema
|
|
16726
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
16727
|
+
targetId: string(),
|
|
16728
|
+
sample: NotificationSchema.optional()
|
|
16729
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16730
|
+
targetId: string(),
|
|
16731
|
+
enabled: boolean()
|
|
16732
|
+
}), _void(), { kind: "mutation" });
|
|
16028
16733
|
/**
|
|
16029
16734
|
* Zod schemas for persisted record types.
|
|
16030
16735
|
*
|
|
@@ -16710,7 +17415,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16710
17415
|
}), method(object({
|
|
16711
17416
|
eventId: string(),
|
|
16712
17417
|
kind: MediaFileKindEnum.optional()
|
|
16713
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
17418
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
17419
|
+
trackId: string(),
|
|
17420
|
+
kinds: array(MediaFileKindEnum).optional()
|
|
17421
|
+
}), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
|
|
16714
17422
|
deviceId: number(),
|
|
16715
17423
|
timestamp: number(),
|
|
16716
17424
|
frameWidth: number(),
|
|
@@ -16731,76 +17439,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16731
17439
|
eventId: string(),
|
|
16732
17440
|
timestamp: number()
|
|
16733
17441
|
});
|
|
16734
|
-
/**
|
|
16735
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
16736
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
16737
|
-
* caps into per-camera event-kind descriptors.
|
|
16738
|
-
*
|
|
16739
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
16740
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
16741
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
16742
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
16743
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
16744
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
16745
|
-
* eventful cap is missing.
|
|
16746
|
-
*/
|
|
16747
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
16748
|
-
var LEGACY_ICON = {
|
|
16749
|
-
motion: "motion",
|
|
16750
|
-
audio: "audio",
|
|
16751
|
-
person: "person",
|
|
16752
|
-
vehicle: "vehicle",
|
|
16753
|
-
animal: "animal",
|
|
16754
|
-
package: "package",
|
|
16755
|
-
door: "door",
|
|
16756
|
-
pir: "pir",
|
|
16757
|
-
smoke: "smoke",
|
|
16758
|
-
water: "water",
|
|
16759
|
-
button: "button",
|
|
16760
|
-
generic: "generic",
|
|
16761
|
-
gas: "smoke",
|
|
16762
|
-
vibration: "generic",
|
|
16763
|
-
tamper: "generic",
|
|
16764
|
-
presence: "person",
|
|
16765
|
-
lock: "generic",
|
|
16766
|
-
siren: "generic",
|
|
16767
|
-
switch: "generic",
|
|
16768
|
-
doorbell: "button"
|
|
16769
|
-
};
|
|
16770
|
-
function legacyIcon(iconId) {
|
|
16771
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
16772
|
-
}
|
|
16773
|
-
/**
|
|
16774
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
16775
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
16776
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
16777
|
-
*/
|
|
16778
|
-
var CAP_TO_KIND = {
|
|
16779
|
-
contact: "contact",
|
|
16780
|
-
motion: "motion-sensor",
|
|
16781
|
-
smoke: "smoke",
|
|
16782
|
-
flood: "flood",
|
|
16783
|
-
gas: "gas",
|
|
16784
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
16785
|
-
vibration: "vibration",
|
|
16786
|
-
tamper: "tamper",
|
|
16787
|
-
presence: "presence",
|
|
16788
|
-
"enum-sensor": "enum-sensor",
|
|
16789
|
-
"event-emitter": "device-event",
|
|
16790
|
-
"lock-control": "lock",
|
|
16791
|
-
switch: "switch",
|
|
16792
|
-
button: "button",
|
|
16793
|
-
doorbell: "doorbell"
|
|
16794
|
-
};
|
|
16795
|
-
function buildDescriptor(capName, kind) {
|
|
16796
|
-
const t = EVENT_TAXONOMY[kind];
|
|
16797
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
16798
|
-
return {
|
|
16799
|
-
...t,
|
|
16800
|
-
icon: legacyIcon(t.iconId)
|
|
16801
|
-
};
|
|
16802
|
-
}
|
|
16803
|
-
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
16804
17442
|
var CameraPipelineConfigSchema = object({
|
|
16805
17443
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
16806
17444
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -17286,6 +17924,76 @@ method(object({
|
|
|
17286
17924
|
auth: "admin"
|
|
17287
17925
|
});
|
|
17288
17926
|
/**
|
|
17927
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
17928
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
17929
|
+
* caps into per-camera event-kind descriptors.
|
|
17930
|
+
*
|
|
17931
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
17932
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
17933
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
17934
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
17935
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
17936
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
17937
|
+
* eventful cap is missing.
|
|
17938
|
+
*/
|
|
17939
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
17940
|
+
var LEGACY_ICON = {
|
|
17941
|
+
motion: "motion",
|
|
17942
|
+
audio: "audio",
|
|
17943
|
+
person: "person",
|
|
17944
|
+
vehicle: "vehicle",
|
|
17945
|
+
animal: "animal",
|
|
17946
|
+
package: "package",
|
|
17947
|
+
door: "door",
|
|
17948
|
+
pir: "pir",
|
|
17949
|
+
smoke: "smoke",
|
|
17950
|
+
water: "water",
|
|
17951
|
+
button: "button",
|
|
17952
|
+
generic: "generic",
|
|
17953
|
+
gas: "smoke",
|
|
17954
|
+
vibration: "generic",
|
|
17955
|
+
tamper: "generic",
|
|
17956
|
+
presence: "person",
|
|
17957
|
+
lock: "generic",
|
|
17958
|
+
siren: "generic",
|
|
17959
|
+
switch: "generic",
|
|
17960
|
+
doorbell: "button"
|
|
17961
|
+
};
|
|
17962
|
+
function legacyIcon(iconId) {
|
|
17963
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
17964
|
+
}
|
|
17965
|
+
/**
|
|
17966
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
17967
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
17968
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
17969
|
+
*/
|
|
17970
|
+
var CAP_TO_KIND = {
|
|
17971
|
+
contact: "contact",
|
|
17972
|
+
motion: "motion-sensor",
|
|
17973
|
+
smoke: "smoke",
|
|
17974
|
+
flood: "flood",
|
|
17975
|
+
gas: "gas",
|
|
17976
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
17977
|
+
vibration: "vibration",
|
|
17978
|
+
tamper: "tamper",
|
|
17979
|
+
presence: "presence",
|
|
17980
|
+
"enum-sensor": "enum-sensor",
|
|
17981
|
+
"event-emitter": "device-event",
|
|
17982
|
+
"lock-control": "lock",
|
|
17983
|
+
switch: "switch",
|
|
17984
|
+
button: "button",
|
|
17985
|
+
doorbell: "doorbell"
|
|
17986
|
+
};
|
|
17987
|
+
function buildDescriptor(capName, kind) {
|
|
17988
|
+
const t = EVENT_TAXONOMY[kind];
|
|
17989
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
17990
|
+
return {
|
|
17991
|
+
...t,
|
|
17992
|
+
icon: legacyIcon(t.iconId)
|
|
17993
|
+
};
|
|
17994
|
+
}
|
|
17995
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
17996
|
+
/**
|
|
17289
17997
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
17290
17998
|
* package lifecycle (runtime-updatable node packages).
|
|
17291
17999
|
*
|
|
@@ -18763,7 +19471,28 @@ var FaceInfoSchema = object({
|
|
|
18763
19471
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
18764
19472
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
18765
19473
|
* back to the inline `base64` face crop. */
|
|
18766
|
-
keyFrameMediaKey: string().optional()
|
|
19474
|
+
keyFrameMediaKey: string().optional(),
|
|
19475
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
19476
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
19477
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
19478
|
+
* faces that were never auto-recognized. */
|
|
19479
|
+
bestMatchScore: number().optional(),
|
|
19480
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
19481
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
19482
|
+
* legacy rows / runners that reported no native measure. */
|
|
19483
|
+
nativeFaceShortSidePx: number().optional(),
|
|
19484
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
19485
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
19486
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
19487
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
19488
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
19489
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
19490
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
19491
|
+
suggestedIdentityId: string().optional(),
|
|
19492
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
19493
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
19494
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
19495
|
+
suggestedMatchScore: number().optional()
|
|
18767
19496
|
});
|
|
18768
19497
|
var FaceFilterEnum = _enum([
|
|
18769
19498
|
"unassigned",
|
|
@@ -20806,36 +21535,6 @@ Object.freeze({
|
|
|
20806
21535
|
addonId: null,
|
|
20807
21536
|
access: "view"
|
|
20808
21537
|
},
|
|
20809
|
-
"advancedNotifier.deleteRule": {
|
|
20810
|
-
capName: "advanced-notifier",
|
|
20811
|
-
capScope: "system",
|
|
20812
|
-
addonId: null,
|
|
20813
|
-
access: "delete"
|
|
20814
|
-
},
|
|
20815
|
-
"advancedNotifier.getHistory": {
|
|
20816
|
-
capName: "advanced-notifier",
|
|
20817
|
-
capScope: "system",
|
|
20818
|
-
addonId: null,
|
|
20819
|
-
access: "view"
|
|
20820
|
-
},
|
|
20821
|
-
"advancedNotifier.getRules": {
|
|
20822
|
-
capName: "advanced-notifier",
|
|
20823
|
-
capScope: "system",
|
|
20824
|
-
addonId: null,
|
|
20825
|
-
access: "view"
|
|
20826
|
-
},
|
|
20827
|
-
"advancedNotifier.testRule": {
|
|
20828
|
-
capName: "advanced-notifier",
|
|
20829
|
-
capScope: "system",
|
|
20830
|
-
addonId: null,
|
|
20831
|
-
access: "create"
|
|
20832
|
-
},
|
|
20833
|
-
"advancedNotifier.upsertRule": {
|
|
20834
|
-
capName: "advanced-notifier",
|
|
20835
|
-
capScope: "system",
|
|
20836
|
-
addonId: null,
|
|
20837
|
-
access: "create"
|
|
20838
|
-
},
|
|
20839
21538
|
"alarmPanel.arm": {
|
|
20840
21539
|
capName: "alarm-panel",
|
|
20841
21540
|
capScope: "device",
|
|
@@ -21058,6 +21757,12 @@ Object.freeze({
|
|
|
21058
21757
|
addonId: null,
|
|
21059
21758
|
access: "delete"
|
|
21060
21759
|
},
|
|
21760
|
+
"backup.deleteSchedule": {
|
|
21761
|
+
capName: "backup",
|
|
21762
|
+
capScope: "system",
|
|
21763
|
+
addonId: null,
|
|
21764
|
+
access: "delete"
|
|
21765
|
+
},
|
|
21061
21766
|
"backup.getEntries": {
|
|
21062
21767
|
capName: "backup",
|
|
21063
21768
|
capScope: "system",
|
|
@@ -21088,6 +21793,12 @@ Object.freeze({
|
|
|
21088
21793
|
addonId: null,
|
|
21089
21794
|
access: "view"
|
|
21090
21795
|
},
|
|
21796
|
+
"backup.listSchedules": {
|
|
21797
|
+
capName: "backup",
|
|
21798
|
+
capScope: "system",
|
|
21799
|
+
addonId: null,
|
|
21800
|
+
access: "view"
|
|
21801
|
+
},
|
|
21091
21802
|
"backup.previewSchedule": {
|
|
21092
21803
|
capName: "backup",
|
|
21093
21804
|
capScope: "system",
|
|
@@ -21112,6 +21823,12 @@ Object.freeze({
|
|
|
21112
21823
|
addonId: null,
|
|
21113
21824
|
access: "create"
|
|
21114
21825
|
},
|
|
21826
|
+
"backup.upsertSchedule": {
|
|
21827
|
+
capName: "backup",
|
|
21828
|
+
capScope: "system",
|
|
21829
|
+
addonId: null,
|
|
21830
|
+
access: "create"
|
|
21831
|
+
},
|
|
21115
21832
|
"battery.wakeForStream": {
|
|
21116
21833
|
capName: "battery",
|
|
21117
21834
|
capScope: "device",
|
|
@@ -23140,6 +23857,60 @@ Object.freeze({
|
|
|
23140
23857
|
addonId: null,
|
|
23141
23858
|
access: "create"
|
|
23142
23859
|
},
|
|
23860
|
+
"notificationRules.createRule": {
|
|
23861
|
+
capName: "notification-rules",
|
|
23862
|
+
capScope: "system",
|
|
23863
|
+
addonId: null,
|
|
23864
|
+
access: "create"
|
|
23865
|
+
},
|
|
23866
|
+
"notificationRules.deleteRule": {
|
|
23867
|
+
capName: "notification-rules",
|
|
23868
|
+
capScope: "system",
|
|
23869
|
+
addonId: null,
|
|
23870
|
+
access: "delete"
|
|
23871
|
+
},
|
|
23872
|
+
"notificationRules.getConditionCatalog": {
|
|
23873
|
+
capName: "notification-rules",
|
|
23874
|
+
capScope: "system",
|
|
23875
|
+
addonId: null,
|
|
23876
|
+
access: "view"
|
|
23877
|
+
},
|
|
23878
|
+
"notificationRules.getHistory": {
|
|
23879
|
+
capName: "notification-rules",
|
|
23880
|
+
capScope: "system",
|
|
23881
|
+
addonId: null,
|
|
23882
|
+
access: "view"
|
|
23883
|
+
},
|
|
23884
|
+
"notificationRules.getRule": {
|
|
23885
|
+
capName: "notification-rules",
|
|
23886
|
+
capScope: "system",
|
|
23887
|
+
addonId: null,
|
|
23888
|
+
access: "view"
|
|
23889
|
+
},
|
|
23890
|
+
"notificationRules.listRules": {
|
|
23891
|
+
capName: "notification-rules",
|
|
23892
|
+
capScope: "system",
|
|
23893
|
+
addonId: null,
|
|
23894
|
+
access: "view"
|
|
23895
|
+
},
|
|
23896
|
+
"notificationRules.setRuleEnabled": {
|
|
23897
|
+
capName: "notification-rules",
|
|
23898
|
+
capScope: "system",
|
|
23899
|
+
addonId: null,
|
|
23900
|
+
access: "create"
|
|
23901
|
+
},
|
|
23902
|
+
"notificationRules.testRule": {
|
|
23903
|
+
capName: "notification-rules",
|
|
23904
|
+
capScope: "system",
|
|
23905
|
+
addonId: null,
|
|
23906
|
+
access: "create"
|
|
23907
|
+
},
|
|
23908
|
+
"notificationRules.updateRule": {
|
|
23909
|
+
capName: "notification-rules",
|
|
23910
|
+
capScope: "system",
|
|
23911
|
+
addonId: null,
|
|
23912
|
+
access: "create"
|
|
23913
|
+
},
|
|
23143
23914
|
"notifier.cancel": {
|
|
23144
23915
|
capName: "notifier",
|
|
23145
23916
|
capScope: "device",
|
|
@@ -24892,6 +25663,36 @@ Object.freeze({
|
|
|
24892
25663
|
addonId: null,
|
|
24893
25664
|
access: "create"
|
|
24894
25665
|
},
|
|
25666
|
+
"terminalSession.close": {
|
|
25667
|
+
capName: "terminal-session",
|
|
25668
|
+
capScope: "system",
|
|
25669
|
+
addonId: null,
|
|
25670
|
+
access: "create"
|
|
25671
|
+
},
|
|
25672
|
+
"terminalSession.listProfiles": {
|
|
25673
|
+
capName: "terminal-session",
|
|
25674
|
+
capScope: "system",
|
|
25675
|
+
addonId: null,
|
|
25676
|
+
access: "view"
|
|
25677
|
+
},
|
|
25678
|
+
"terminalSession.listSessions": {
|
|
25679
|
+
capName: "terminal-session",
|
|
25680
|
+
capScope: "system",
|
|
25681
|
+
addonId: null,
|
|
25682
|
+
access: "view"
|
|
25683
|
+
},
|
|
25684
|
+
"terminalSession.openSession": {
|
|
25685
|
+
capName: "terminal-session",
|
|
25686
|
+
capScope: "system",
|
|
25687
|
+
addonId: null,
|
|
25688
|
+
access: "create"
|
|
25689
|
+
},
|
|
25690
|
+
"terminalSession.resize": {
|
|
25691
|
+
capName: "terminal-session",
|
|
25692
|
+
capScope: "system",
|
|
25693
|
+
addonId: null,
|
|
25694
|
+
access: "create"
|
|
25695
|
+
},
|
|
24895
25696
|
"toast.onToast": {
|
|
24896
25697
|
capName: "toast",
|
|
24897
25698
|
capScope: "system",
|