@camstack/addon-decoder-nodeav 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/index.js +1911 -1110
- package/dist/index.mjs +1911 -1110
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
6
|
-
//#region ../types/dist/event-category-
|
|
6
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
7
7
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
8
8
|
EventCategory["SystemBoot"] = "system.boot";
|
|
9
9
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -153,9 +153,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
153
153
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
154
154
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
155
155
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
156
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
157
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
158
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
159
156
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
160
157
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
161
158
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -6820,7 +6817,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
|
6820
6817
|
patch: record(string(), unknown())
|
|
6821
6818
|
}), object({ success: literal(true) });
|
|
6822
6819
|
object({ deviceId: number() }), unknown().nullable();
|
|
6823
|
-
/** Shorthand to define a method schema */
|
|
6824
6820
|
function method(input, output, options) {
|
|
6825
6821
|
return {
|
|
6826
6822
|
input,
|
|
@@ -6828,6 +6824,7 @@ function method(input, output, options) {
|
|
|
6828
6824
|
kind: options?.kind ?? "query",
|
|
6829
6825
|
auth: options?.auth ?? "protected",
|
|
6830
6826
|
...options?.access !== void 0 ? { access: options.access } : {},
|
|
6827
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
6831
6828
|
timeoutMs: options?.timeoutMs
|
|
6832
6829
|
};
|
|
6833
6830
|
}
|
|
@@ -7521,16 +7518,23 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7521
7518
|
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7522
7519
|
* FRESH install:
|
|
7523
7520
|
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7524
|
-
* the appData volume. Right for small/durable data (
|
|
7521
|
+
* the appData volume. Right for small/durable data (logs, models).
|
|
7525
7522
|
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7526
7523
|
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7527
7524
|
* (recordings, event media) that should stay off the appData disk.
|
|
7525
|
+
* - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
|
|
7526
|
+
* `/backups` in the image) so archives live on their own mount rather than
|
|
7527
|
+
* filling the appData disk. Falls back to the data root when unset.
|
|
7528
7528
|
*
|
|
7529
7529
|
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7530
7530
|
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7531
7531
|
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7532
7532
|
*/
|
|
7533
|
-
defaultRoot: _enum([
|
|
7533
|
+
defaultRoot: _enum([
|
|
7534
|
+
"data",
|
|
7535
|
+
"media",
|
|
7536
|
+
"backup"
|
|
7537
|
+
]).optional()
|
|
7534
7538
|
});
|
|
7535
7539
|
var DecoderStatsSchema = object({
|
|
7536
7540
|
inputFps: number(),
|
|
@@ -8193,6 +8197,59 @@ for (const l of AUDIO_MACRO_LABELS) {
|
|
|
8193
8197
|
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8194
8198
|
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8195
8199
|
/**
|
|
8200
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8201
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8202
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8203
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8204
|
+
*
|
|
8205
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8206
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8207
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8208
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8209
|
+
* the same class picker, grouped under an Audio header.
|
|
8210
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8211
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8212
|
+
*
|
|
8213
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8214
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8215
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8216
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8217
|
+
*/
|
|
8218
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8219
|
+
var NcTaxonomyEntrySchema = object({
|
|
8220
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8221
|
+
kind: string(),
|
|
8222
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8223
|
+
label: string(),
|
|
8224
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8225
|
+
parentKind: string().nullable()
|
|
8226
|
+
});
|
|
8227
|
+
object({
|
|
8228
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8229
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8230
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8231
|
+
});
|
|
8232
|
+
function toEntry(kind, label, parentKind) {
|
|
8233
|
+
return {
|
|
8234
|
+
kind,
|
|
8235
|
+
label,
|
|
8236
|
+
parentKind
|
|
8237
|
+
};
|
|
8238
|
+
}
|
|
8239
|
+
/**
|
|
8240
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8241
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8242
|
+
*/
|
|
8243
|
+
function buildNcTaxonomy() {
|
|
8244
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8245
|
+
return {
|
|
8246
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8247
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8248
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8249
|
+
};
|
|
8250
|
+
}
|
|
8251
|
+
Object.freeze(buildNcTaxonomy());
|
|
8252
|
+
/**
|
|
8196
8253
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8197
8254
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8198
8255
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -8828,6 +8885,644 @@ var AccessoryKind = {
|
|
|
8828
8885
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
8829
8886
|
DeviceFeature.BatteryOperated;
|
|
8830
8887
|
/**
|
|
8888
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
8889
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
8890
|
+
* language so a single drawing-plane editor and the providers stay
|
|
8891
|
+
* decoupled from each cap's storage.
|
|
8892
|
+
*
|
|
8893
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
8894
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
8895
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
8896
|
+
*/
|
|
8897
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
8898
|
+
var MaskPointSchema = object({
|
|
8899
|
+
x: number(),
|
|
8900
|
+
y: number()
|
|
8901
|
+
});
|
|
8902
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
8903
|
+
var MaskRectShapeSchema = object({
|
|
8904
|
+
kind: literal("rect"),
|
|
8905
|
+
x: number(),
|
|
8906
|
+
y: number(),
|
|
8907
|
+
width: number(),
|
|
8908
|
+
height: number()
|
|
8909
|
+
});
|
|
8910
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
8911
|
+
var MaskPolygonShapeSchema = object({
|
|
8912
|
+
kind: literal("polygon"),
|
|
8913
|
+
points: array(MaskPointSchema)
|
|
8914
|
+
});
|
|
8915
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
8916
|
+
var MaskGridShapeSchema = object({
|
|
8917
|
+
kind: literal("grid"),
|
|
8918
|
+
gridWidth: number(),
|
|
8919
|
+
gridHeight: number(),
|
|
8920
|
+
cells: array(boolean())
|
|
8921
|
+
});
|
|
8922
|
+
discriminatedUnion("kind", [
|
|
8923
|
+
MaskRectShapeSchema,
|
|
8924
|
+
MaskPolygonShapeSchema,
|
|
8925
|
+
MaskGridShapeSchema,
|
|
8926
|
+
object({
|
|
8927
|
+
kind: literal("line"),
|
|
8928
|
+
points: array(MaskPointSchema)
|
|
8929
|
+
})
|
|
8930
|
+
]);
|
|
8931
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
8932
|
+
var MaskShapeKindSchema = _enum([
|
|
8933
|
+
"rect",
|
|
8934
|
+
"polygon",
|
|
8935
|
+
"grid",
|
|
8936
|
+
"line"
|
|
8937
|
+
]);
|
|
8938
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
8939
|
+
var MaskPolygonVerticesSchema = object({
|
|
8940
|
+
min: number(),
|
|
8941
|
+
max: number()
|
|
8942
|
+
});
|
|
8943
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
8944
|
+
var MaskGridDimsSchema = object({
|
|
8945
|
+
width: number(),
|
|
8946
|
+
height: number()
|
|
8947
|
+
});
|
|
8948
|
+
/**
|
|
8949
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
8950
|
+
*
|
|
8951
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
8952
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
8953
|
+
*
|
|
8954
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
8955
|
+
* `notification-center` module), hooked on the durable persistence
|
|
8956
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
8957
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
8958
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
8959
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
8960
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
8961
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
8962
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
8963
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
8964
|
+
* target kind's own caps/degrade engine).
|
|
8965
|
+
*
|
|
8966
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
8967
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
8968
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
8969
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
8970
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
8971
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
8972
|
+
* P2+ (see spec §7).
|
|
8973
|
+
*
|
|
8974
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
8975
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
8976
|
+
* schema/interface drift is explicitly not repeated).
|
|
8977
|
+
*/
|
|
8978
|
+
/**
|
|
8979
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
8980
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
8981
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
8982
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
8983
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
8984
|
+
* change of a LINKED device, one row per linked camera)
|
|
8985
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
8986
|
+
* delivery / pick-up)
|
|
8987
|
+
*
|
|
8988
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
8989
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
8990
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
8991
|
+
* one trigger.
|
|
8992
|
+
*/
|
|
8993
|
+
var NcDeliverySchema = _enum([
|
|
8994
|
+
"immediate",
|
|
8995
|
+
"track-end",
|
|
8996
|
+
"device-event",
|
|
8997
|
+
"package-event"
|
|
8998
|
+
]);
|
|
8999
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
9000
|
+
var NcScheduleSchema = object({
|
|
9001
|
+
windows: array(object({
|
|
9002
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
9003
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
9004
|
+
startMinute: number().int().min(0).max(1439),
|
|
9005
|
+
endMinute: number().int().min(0).max(1439)
|
|
9006
|
+
})).min(1),
|
|
9007
|
+
/** IANA timezone; default = hub host timezone. */
|
|
9008
|
+
timezone: string().optional(),
|
|
9009
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
9010
|
+
invert: boolean().optional()
|
|
9011
|
+
});
|
|
9012
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
9013
|
+
var NcPlateMatcherSchema = object({
|
|
9014
|
+
values: array(string().min(1)).min(1),
|
|
9015
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9016
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9017
|
+
});
|
|
9018
|
+
/**
|
|
9019
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9020
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9021
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9022
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9023
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9024
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9025
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9026
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9027
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9028
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9029
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9030
|
+
*/
|
|
9031
|
+
var NcOccupancyConditionSchema = object({
|
|
9032
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9033
|
+
zoneId: string().optional(),
|
|
9034
|
+
/** Object class to count; absent = any class. */
|
|
9035
|
+
className: string().optional(),
|
|
9036
|
+
op: _enum([
|
|
9037
|
+
"became-occupied",
|
|
9038
|
+
"became-free",
|
|
9039
|
+
">=",
|
|
9040
|
+
"<="
|
|
9041
|
+
]).default("became-occupied"),
|
|
9042
|
+
count: number().int().min(0).default(1),
|
|
9043
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9044
|
+
});
|
|
9045
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9046
|
+
var NcZoneConditionSchema = object({
|
|
9047
|
+
ids: array(string().min(1)).min(1),
|
|
9048
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9049
|
+
match: _enum(["any", "all"]).default("any")
|
|
9050
|
+
});
|
|
9051
|
+
/**
|
|
9052
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9053
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9054
|
+
*/
|
|
9055
|
+
var NcConditionsSchema = object({
|
|
9056
|
+
/** Device scope — absent = all devices. */
|
|
9057
|
+
devices: array(number()).optional(),
|
|
9058
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9059
|
+
classes: array(string().min(1)).optional(),
|
|
9060
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9061
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9062
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9063
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9064
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9065
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9066
|
+
/** Veto zones — any hit fails the rule. */
|
|
9067
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
9068
|
+
/**
|
|
9069
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9070
|
+
* (identity name / plate text / subclass).
|
|
9071
|
+
*/
|
|
9072
|
+
labelEquals: array(string().min(1)).optional(),
|
|
9073
|
+
/**
|
|
9074
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9075
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9076
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
9077
|
+
*/
|
|
9078
|
+
identities: array(string().min(1)).optional(),
|
|
9079
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9080
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
9081
|
+
/**
|
|
9082
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9083
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9084
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9085
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
9086
|
+
*/
|
|
9087
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
9088
|
+
/**
|
|
9089
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9090
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9091
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9092
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9093
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9094
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9095
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9096
|
+
*/
|
|
9097
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9098
|
+
/**
|
|
9099
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9100
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9101
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9102
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9103
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9104
|
+
*/
|
|
9105
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9106
|
+
/**
|
|
9107
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9108
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9109
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9110
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9111
|
+
* tracks carry `sensor`.
|
|
9112
|
+
*/
|
|
9113
|
+
source: _enum([
|
|
9114
|
+
"pipeline",
|
|
9115
|
+
"onboard",
|
|
9116
|
+
"sensor",
|
|
9117
|
+
"any"
|
|
9118
|
+
]).optional(),
|
|
9119
|
+
/**
|
|
9120
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9121
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9122
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9123
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9124
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9125
|
+
*
|
|
9126
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9127
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9128
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9129
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9130
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9131
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9132
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9133
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9134
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9135
|
+
* closed for it (an un-recognized subject).
|
|
9136
|
+
*/
|
|
9137
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9138
|
+
/**
|
|
9139
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9140
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9141
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9142
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9143
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9144
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9145
|
+
*/
|
|
9146
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9147
|
+
/**
|
|
9148
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9149
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9150
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9151
|
+
*/
|
|
9152
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9153
|
+
/**
|
|
9154
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9155
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9156
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9157
|
+
* on the package-event trigger).
|
|
9158
|
+
*/
|
|
9159
|
+
packagePhase: _enum([
|
|
9160
|
+
"delivered",
|
|
9161
|
+
"picked-up",
|
|
9162
|
+
"both"
|
|
9163
|
+
]).optional(),
|
|
9164
|
+
/**
|
|
9165
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9166
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9167
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9168
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9169
|
+
*/
|
|
9170
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9171
|
+
/**
|
|
9172
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9173
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9174
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9175
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9176
|
+
*/
|
|
9177
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9178
|
+
});
|
|
9179
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9180
|
+
var NcRuleTargetSchema = object({
|
|
9181
|
+
/** `notification-output` Target id. */
|
|
9182
|
+
targetId: string().min(1),
|
|
9183
|
+
/**
|
|
9184
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9185
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9186
|
+
* degrade engine drops what the backend can't render.
|
|
9187
|
+
*/
|
|
9188
|
+
params: record(string(), unknown()).optional()
|
|
9189
|
+
});
|
|
9190
|
+
/**
|
|
9191
|
+
* Media attachment policy (P1 still-image subset).
|
|
9192
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9193
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9194
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9195
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9196
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9197
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9198
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9199
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9200
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9201
|
+
* - `none` — no attachment.
|
|
9202
|
+
*/
|
|
9203
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9204
|
+
"best",
|
|
9205
|
+
"best-matching",
|
|
9206
|
+
"keyFrame",
|
|
9207
|
+
"none"
|
|
9208
|
+
]).default("best") });
|
|
9209
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9210
|
+
var NcThrottleSchema = object({
|
|
9211
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9212
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9213
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9214
|
+
});
|
|
9215
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9216
|
+
var NcRuleInputSchema = object({
|
|
9217
|
+
name: string().min(1).max(200),
|
|
9218
|
+
enabled: boolean().default(true),
|
|
9219
|
+
delivery: NcDeliverySchema,
|
|
9220
|
+
conditions: NcConditionsSchema.default({}),
|
|
9221
|
+
schedule: NcScheduleSchema.optional(),
|
|
9222
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9223
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9224
|
+
throttle: NcThrottleSchema.default({
|
|
9225
|
+
cooldownSec: 60,
|
|
9226
|
+
scope: "rule-device"
|
|
9227
|
+
}),
|
|
9228
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9229
|
+
template: object({
|
|
9230
|
+
title: string().max(500).optional(),
|
|
9231
|
+
body: string().max(2e3).optional()
|
|
9232
|
+
}).optional(),
|
|
9233
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9234
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9235
|
+
/**
|
|
9236
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9237
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9238
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9239
|
+
*/
|
|
9240
|
+
ownerUserId: string().optional()
|
|
9241
|
+
});
|
|
9242
|
+
/**
|
|
9243
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9244
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9245
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9246
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9247
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9248
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9249
|
+
* `updateRule` patch.
|
|
9250
|
+
*/
|
|
9251
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9252
|
+
/** A persisted rule. */
|
|
9253
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9254
|
+
id: string(),
|
|
9255
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9256
|
+
createdBy: string(),
|
|
9257
|
+
createdAt: number(),
|
|
9258
|
+
updatedAt: number(),
|
|
9259
|
+
/**
|
|
9260
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9261
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9262
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9263
|
+
*/
|
|
9264
|
+
disabledTargetIds: array(string()).default([])
|
|
9265
|
+
});
|
|
9266
|
+
var NcTestResultSchema = object({
|
|
9267
|
+
recordId: string(),
|
|
9268
|
+
recordKind: _enum([
|
|
9269
|
+
"object-event",
|
|
9270
|
+
"track",
|
|
9271
|
+
"device-event",
|
|
9272
|
+
"package-event"
|
|
9273
|
+
]),
|
|
9274
|
+
deviceId: number(),
|
|
9275
|
+
timestamp: number(),
|
|
9276
|
+
wouldFire: boolean(),
|
|
9277
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9278
|
+
failedCondition: string().optional(),
|
|
9279
|
+
className: string().optional(),
|
|
9280
|
+
label: string().optional()
|
|
9281
|
+
});
|
|
9282
|
+
var NcConditionDescriptorSchema = object({
|
|
9283
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9284
|
+
id: string(),
|
|
9285
|
+
group: _enum([
|
|
9286
|
+
"scope",
|
|
9287
|
+
"class",
|
|
9288
|
+
"zones",
|
|
9289
|
+
"quality",
|
|
9290
|
+
"label",
|
|
9291
|
+
"schedule",
|
|
9292
|
+
"device",
|
|
9293
|
+
"package",
|
|
9294
|
+
"occupancy"
|
|
9295
|
+
]),
|
|
9296
|
+
label: string(),
|
|
9297
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9298
|
+
valueType: _enum([
|
|
9299
|
+
"deviceIdList",
|
|
9300
|
+
"stringList",
|
|
9301
|
+
"number01",
|
|
9302
|
+
"number",
|
|
9303
|
+
"sourceSelect",
|
|
9304
|
+
"zoneSelection",
|
|
9305
|
+
"zoneIdList",
|
|
9306
|
+
"schedule",
|
|
9307
|
+
"plateMatcher",
|
|
9308
|
+
"packagePhase",
|
|
9309
|
+
"polygonDraw",
|
|
9310
|
+
"occupancy"
|
|
9311
|
+
]),
|
|
9312
|
+
operator: _enum([
|
|
9313
|
+
"in",
|
|
9314
|
+
"notIn",
|
|
9315
|
+
"anyOf",
|
|
9316
|
+
"allOf",
|
|
9317
|
+
"gte",
|
|
9318
|
+
"fuzzyIn",
|
|
9319
|
+
"withinSchedule"
|
|
9320
|
+
]),
|
|
9321
|
+
/** Which delivery kinds the condition applies to. */
|
|
9322
|
+
appliesTo: array(NcDeliverySchema),
|
|
9323
|
+
phase: string(),
|
|
9324
|
+
description: string().optional()
|
|
9325
|
+
});
|
|
9326
|
+
/**
|
|
9327
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9328
|
+
* durable outbox row's own status (single source of truth):
|
|
9329
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9330
|
+
* - `sent` — delivered (terminal)
|
|
9331
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9332
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9333
|
+
* the failure `error`)
|
|
9334
|
+
*
|
|
9335
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9336
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9337
|
+
*/
|
|
9338
|
+
var NcHistoryStatusSchema = _enum([
|
|
9339
|
+
"pending",
|
|
9340
|
+
"sent",
|
|
9341
|
+
"dead"
|
|
9342
|
+
]);
|
|
9343
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9344
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9345
|
+
"object-event",
|
|
9346
|
+
"track-end",
|
|
9347
|
+
"device-event",
|
|
9348
|
+
"package-event"
|
|
9349
|
+
]);
|
|
9350
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9351
|
+
var NcHistorySubjectSchema = object({
|
|
9352
|
+
className: string(),
|
|
9353
|
+
label: string().optional(),
|
|
9354
|
+
confidence: number().optional(),
|
|
9355
|
+
zones: array(string()),
|
|
9356
|
+
timestamp: number()
|
|
9357
|
+
});
|
|
9358
|
+
/**
|
|
9359
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9360
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9361
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9362
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9363
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9364
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9365
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9366
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9367
|
+
* P1 (admin scope only).
|
|
9368
|
+
*/
|
|
9369
|
+
var NcHistoryEntrySchema = object({
|
|
9370
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9371
|
+
id: string(),
|
|
9372
|
+
ruleId: string(),
|
|
9373
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9374
|
+
ruleName: string(),
|
|
9375
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9376
|
+
delivery: NcDeliverySchema,
|
|
9377
|
+
targetId: string(),
|
|
9378
|
+
deviceId: number(),
|
|
9379
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9380
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9381
|
+
recordId: string(),
|
|
9382
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9383
|
+
trackId: string().optional(),
|
|
9384
|
+
status: NcHistoryStatusSchema,
|
|
9385
|
+
/** Delivery attempts made so far. */
|
|
9386
|
+
attempts: number().int(),
|
|
9387
|
+
/** Fire time (outbox enqueue). */
|
|
9388
|
+
createdAt: number(),
|
|
9389
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9390
|
+
updatedAt: number(),
|
|
9391
|
+
/** Failure detail — present on a `dead` row. */
|
|
9392
|
+
error: string().optional(),
|
|
9393
|
+
subject: NcHistorySubjectSchema
|
|
9394
|
+
});
|
|
9395
|
+
/**
|
|
9396
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9397
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9398
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9399
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9400
|
+
*/
|
|
9401
|
+
var NcHistoryFilterSchema = object({
|
|
9402
|
+
ruleId: string().optional(),
|
|
9403
|
+
deviceId: number().optional(),
|
|
9404
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9405
|
+
since: number().optional(),
|
|
9406
|
+
until: number().optional(),
|
|
9407
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9408
|
+
});
|
|
9409
|
+
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 }), {
|
|
9410
|
+
kind: "mutation",
|
|
9411
|
+
auth: "admin",
|
|
9412
|
+
caller: "required"
|
|
9413
|
+
}), method(object({
|
|
9414
|
+
ruleId: string(),
|
|
9415
|
+
patch: NcRulePatchSchema
|
|
9416
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9417
|
+
kind: "mutation",
|
|
9418
|
+
auth: "admin",
|
|
9419
|
+
caller: "required"
|
|
9420
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9421
|
+
kind: "mutation",
|
|
9422
|
+
auth: "admin"
|
|
9423
|
+
}), method(object({
|
|
9424
|
+
ruleId: string(),
|
|
9425
|
+
enabled: boolean()
|
|
9426
|
+
}), object({ success: literal(true) }), {
|
|
9427
|
+
kind: "mutation",
|
|
9428
|
+
auth: "admin"
|
|
9429
|
+
}), method(object({
|
|
9430
|
+
rule: NcRuleInputSchema,
|
|
9431
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9432
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9433
|
+
kind: "mutation",
|
|
9434
|
+
auth: "admin"
|
|
9435
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9436
|
+
/**
|
|
9437
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9438
|
+
*
|
|
9439
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
9440
|
+
* §3.2/§3.3.
|
|
9441
|
+
*
|
|
9442
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
9443
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
9444
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
9445
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
9446
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
9447
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
9448
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
9449
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
9450
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
9451
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
9452
|
+
*
|
|
9453
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
9454
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
9455
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
9456
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
9457
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
9458
|
+
*/
|
|
9459
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
9460
|
+
var TimelapseTemplateSchema = object({
|
|
9461
|
+
title: string().max(500).optional(),
|
|
9462
|
+
body: string().max(2e3).optional()
|
|
9463
|
+
});
|
|
9464
|
+
var NameField = string().min(1).max(200);
|
|
9465
|
+
var DeviceIdsField = array(number()).min(1);
|
|
9466
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
9467
|
+
var FramerateField = number().int().min(1).max(60);
|
|
9468
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
9469
|
+
var PriorityField = number().int().min(1).max(5);
|
|
9470
|
+
/**
|
|
9471
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
9472
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
9473
|
+
* here (see the ownership note above).
|
|
9474
|
+
*/
|
|
9475
|
+
var TimelapseRuleInputSchema = object({
|
|
9476
|
+
name: NameField,
|
|
9477
|
+
enabled: boolean().default(true),
|
|
9478
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
9479
|
+
deviceIds: DeviceIdsField,
|
|
9480
|
+
/**
|
|
9481
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
9482
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
9483
|
+
* open clears the scratch, close assembles and delivers.
|
|
9484
|
+
*/
|
|
9485
|
+
schedule: NcScheduleSchema,
|
|
9486
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
9487
|
+
cadenceSec: CadenceSecField.default(15),
|
|
9488
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
9489
|
+
framerate: FramerateField.default(10),
|
|
9490
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
9491
|
+
targets: TargetsField,
|
|
9492
|
+
template: TimelapseTemplateSchema.optional(),
|
|
9493
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9494
|
+
priority: PriorityField.default(3)
|
|
9495
|
+
});
|
|
9496
|
+
object({
|
|
9497
|
+
name: NameField.optional(),
|
|
9498
|
+
enabled: boolean().optional(),
|
|
9499
|
+
deviceIds: DeviceIdsField.optional(),
|
|
9500
|
+
schedule: NcScheduleSchema.optional(),
|
|
9501
|
+
cadenceSec: CadenceSecField.optional(),
|
|
9502
|
+
framerate: FramerateField.optional(),
|
|
9503
|
+
targets: TargetsField.optional(),
|
|
9504
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
9505
|
+
priority: PriorityField.optional()
|
|
9506
|
+
});
|
|
9507
|
+
TimelapseRuleInputSchema.extend({
|
|
9508
|
+
id: string(),
|
|
9509
|
+
/**
|
|
9510
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
9511
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
9512
|
+
* resolved caller; never trusted from a client payload.
|
|
9513
|
+
*/
|
|
9514
|
+
ownerUserId: string().optional(),
|
|
9515
|
+
/**
|
|
9516
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
9517
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
9518
|
+
*/
|
|
9519
|
+
lastGeneratedAt: number().optional(),
|
|
9520
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
9521
|
+
createdBy: string(),
|
|
9522
|
+
createdAt: number(),
|
|
9523
|
+
updatedAt: number()
|
|
9524
|
+
});
|
|
9525
|
+
/**
|
|
8831
9526
|
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
8832
9527
|
* for every device, regardless of provider — the kernel needs a uniform
|
|
8833
9528
|
* cap-keyed slice for the basic device flags every consumer expects to
|
|
@@ -10901,6 +11596,22 @@ var CameraMetricsSchema = object({
|
|
|
10901
11596
|
])
|
|
10902
11597
|
});
|
|
10903
11598
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
11599
|
+
/**
|
|
11600
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
11601
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
11602
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
11603
|
+
*/
|
|
11604
|
+
var NativeCropRefSchema = object({
|
|
11605
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
11606
|
+
handle: FrameHandleSchema,
|
|
11607
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
11608
|
+
cropFrameSpace: object({
|
|
11609
|
+
x: number(),
|
|
11610
|
+
y: number(),
|
|
11611
|
+
w: number(),
|
|
11612
|
+
h: number()
|
|
11613
|
+
})
|
|
11614
|
+
});
|
|
10904
11615
|
var ModelFormatSchema$1 = _enum([
|
|
10905
11616
|
"onnx",
|
|
10906
11617
|
"coreml",
|
|
@@ -11176,7 +11887,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
11176
11887
|
* Omitted ⇒ the runner's default device (current single-engine
|
|
11177
11888
|
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
11178
11889
|
*/
|
|
11179
|
-
deviceKey: string().optional()
|
|
11890
|
+
deviceKey: string().optional(),
|
|
11891
|
+
/**
|
|
11892
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
11893
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
11894
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
11895
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
11896
|
+
* resolution from that surface — the SAME quality path faces already
|
|
11897
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
11898
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
11899
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
11900
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
11901
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
11902
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
11903
|
+
* (today's behaviour on the fallback path).
|
|
11904
|
+
*/
|
|
11905
|
+
nativeCropRef: NativeCropRefSchema.optional()
|
|
11180
11906
|
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
11181
11907
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
11182
11908
|
steps: array(PipelineStepInputSchema).min(1),
|
|
@@ -11392,7 +12118,11 @@ var DetailResultSchema = object({
|
|
|
11392
12118
|
bbox: NativeCropBboxSchema.optional(),
|
|
11393
12119
|
embedding: string().optional(),
|
|
11394
12120
|
label: string().optional(),
|
|
11395
|
-
alignedCropJpeg: string().optional()
|
|
12121
|
+
alignedCropJpeg: string().optional(),
|
|
12122
|
+
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
12123
|
+
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
12124
|
+
* consumers MUST prefer this when present (2026-07-22 native-gate fix). */
|
|
12125
|
+
nativeFaceShortSidePx: number().optional()
|
|
11396
12126
|
});
|
|
11397
12127
|
/**
|
|
11398
12128
|
* Per-camera tunable ranges + defaults. Single source of truth used
|
|
@@ -11406,6 +12136,12 @@ var motionCooldownMsField = {
|
|
|
11406
12136
|
default: 3e4,
|
|
11407
12137
|
step: 500
|
|
11408
12138
|
};
|
|
12139
|
+
var maxSessionHoldMsField = {
|
|
12140
|
+
min: 0,
|
|
12141
|
+
max: 6e5,
|
|
12142
|
+
default: 12e4,
|
|
12143
|
+
step: 5e3
|
|
12144
|
+
};
|
|
11409
12145
|
var motionFpsField = {
|
|
11410
12146
|
min: 1,
|
|
11411
12147
|
max: 30,
|
|
@@ -11553,6 +12289,19 @@ var RunnerCameraConfigSchema = object({
|
|
|
11553
12289
|
"on-motion"
|
|
11554
12290
|
]).default("always-on"),
|
|
11555
12291
|
motionCooldownMs: number().min(motionCooldownMsField.min).default(motionCooldownMsField.default),
|
|
12292
|
+
/**
|
|
12293
|
+
* Orchestrator-side on-motion session-hold cap (ms). While an on-motion
|
|
12294
|
+
* detection session is active and ≥1 confirmed non-stationary track is
|
|
12295
|
+
* still live, the orchestrator keeps the session open past
|
|
12296
|
+
* `motionCooldownMs` (a slowly-moving subject can stop re-triggering the
|
|
12297
|
+
* camera's VMD yet is still being tracked frame-to-frame) — up to this many
|
|
12298
|
+
* ms since the session opened, after which it closes regardless. `0`
|
|
12299
|
+
* disables the hold (legacy cooldown-only teardown). Not consumed by the
|
|
12300
|
+
* runner itself — carried here so it shares the per-camera device-settings
|
|
12301
|
+
* surface with `motionCooldownMs`; the orchestrator reads it off the
|
|
12302
|
+
* resolved `CameraDetectionConfig`.
|
|
12303
|
+
*/
|
|
12304
|
+
maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
|
|
11556
12305
|
motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
|
|
11557
12306
|
detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
|
|
11558
12307
|
motionStreamId: string(),
|
|
@@ -11642,7 +12391,7 @@ var RunnerCameraConfigSchema = object({
|
|
|
11642
12391
|
*/
|
|
11643
12392
|
inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
|
|
11644
12393
|
});
|
|
11645
|
-
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;
|
|
12394
|
+
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;
|
|
11646
12395
|
/**
|
|
11647
12396
|
* Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
|
|
11648
12397
|
* load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
|
|
@@ -11753,71 +12502,10 @@ DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
|
11753
12502
|
lastChangedAt: number()
|
|
11754
12503
|
});
|
|
11755
12504
|
/**
|
|
11756
|
-
*
|
|
11757
|
-
* motion-
|
|
11758
|
-
*
|
|
11759
|
-
*
|
|
11760
|
-
*
|
|
11761
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
11762
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
11763
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
11764
|
-
*/
|
|
11765
|
-
/** A normalized 0..1 point (top-left origin). */
|
|
11766
|
-
var MaskPointSchema = object({
|
|
11767
|
-
x: number(),
|
|
11768
|
-
y: number()
|
|
11769
|
-
});
|
|
11770
|
-
/** Axis-aligned rectangle (normalized 0..1). */
|
|
11771
|
-
var MaskRectShapeSchema = object({
|
|
11772
|
-
kind: literal("rect"),
|
|
11773
|
-
x: number(),
|
|
11774
|
-
y: number(),
|
|
11775
|
-
width: number(),
|
|
11776
|
-
height: number()
|
|
11777
|
-
});
|
|
11778
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
11779
|
-
var MaskPolygonShapeSchema = object({
|
|
11780
|
-
kind: literal("polygon"),
|
|
11781
|
-
points: array(MaskPointSchema)
|
|
11782
|
-
});
|
|
11783
|
-
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
11784
|
-
var MaskGridShapeSchema = object({
|
|
11785
|
-
kind: literal("grid"),
|
|
11786
|
-
gridWidth: number(),
|
|
11787
|
-
gridHeight: number(),
|
|
11788
|
-
cells: array(boolean())
|
|
11789
|
-
});
|
|
11790
|
-
discriminatedUnion("kind", [
|
|
11791
|
-
MaskRectShapeSchema,
|
|
11792
|
-
MaskPolygonShapeSchema,
|
|
11793
|
-
MaskGridShapeSchema,
|
|
11794
|
-
object({
|
|
11795
|
-
kind: literal("line"),
|
|
11796
|
-
points: array(MaskPointSchema)
|
|
11797
|
-
})
|
|
11798
|
-
]);
|
|
11799
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
11800
|
-
var MaskShapeKindSchema = _enum([
|
|
11801
|
-
"rect",
|
|
11802
|
-
"polygon",
|
|
11803
|
-
"grid",
|
|
11804
|
-
"line"
|
|
11805
|
-
]);
|
|
11806
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
11807
|
-
var MaskPolygonVerticesSchema = object({
|
|
11808
|
-
min: number(),
|
|
11809
|
-
max: number()
|
|
11810
|
-
});
|
|
11811
|
-
/** Grid dimensions when a cap supports 'grid'. */
|
|
11812
|
-
var MaskGridDimsSchema = object({
|
|
11813
|
-
width: number(),
|
|
11814
|
-
height: number()
|
|
11815
|
-
});
|
|
11816
|
-
/**
|
|
11817
|
-
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
11818
|
-
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
11819
|
-
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
11820
|
-
* a region keeps one drawing-plane model across all geometry caps.
|
|
12505
|
+
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
12506
|
+
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
12507
|
+
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
12508
|
+
* a region keeps one drawing-plane model across all geometry caps.
|
|
11821
12509
|
*/
|
|
11822
12510
|
/** A motion-zone region — exactly one boolean cell grid today. */
|
|
11823
12511
|
var MotionZoneRegionSchema = object({
|
|
@@ -13496,94 +14184,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
13496
14184
|
bundleUrl: string()
|
|
13497
14185
|
});
|
|
13498
14186
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
13499
|
-
var NotificationRuleConditionsSchema = object({
|
|
13500
|
-
deviceIds: array(number()).readonly().optional(),
|
|
13501
|
-
classNames: array(string()).readonly().optional(),
|
|
13502
|
-
zoneIds: array(string()).readonly().optional(),
|
|
13503
|
-
minConfidence: number().optional(),
|
|
13504
|
-
source: _enum([
|
|
13505
|
-
"pipeline",
|
|
13506
|
-
"onboard",
|
|
13507
|
-
"any"
|
|
13508
|
-
]).optional(),
|
|
13509
|
-
schedule: object({
|
|
13510
|
-
days: array(number()).readonly(),
|
|
13511
|
-
startHour: number(),
|
|
13512
|
-
endHour: number()
|
|
13513
|
-
}).optional(),
|
|
13514
|
-
cooldownSeconds: number().optional(),
|
|
13515
|
-
minDwellSeconds: number().optional(),
|
|
13516
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
13517
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
13518
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
13519
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
13520
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
13521
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
13522
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
13523
|
-
clipDescription: object({
|
|
13524
|
-
text: string().min(1),
|
|
13525
|
-
minSimilarity: number().min(0).max(1)
|
|
13526
|
-
}).optional(),
|
|
13527
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
13528
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
13529
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
13530
|
-
* vehicle/person> is seen". */
|
|
13531
|
-
labels: array(string()).readonly().optional()
|
|
13532
|
-
});
|
|
13533
|
-
var NotificationRuleTemplateSchema = object({
|
|
13534
|
-
title: string(),
|
|
13535
|
-
body: string(),
|
|
13536
|
-
imageMode: _enum([
|
|
13537
|
-
"crop",
|
|
13538
|
-
"annotated",
|
|
13539
|
-
"full",
|
|
13540
|
-
"none"
|
|
13541
|
-
])
|
|
13542
|
-
});
|
|
13543
|
-
var NotificationRuleSchema = object({
|
|
13544
|
-
id: string(),
|
|
13545
|
-
name: string(),
|
|
13546
|
-
enabled: boolean(),
|
|
13547
|
-
eventTypes: array(string()).readonly(),
|
|
13548
|
-
conditions: NotificationRuleConditionsSchema,
|
|
13549
|
-
outputs: array(string()).readonly(),
|
|
13550
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
13551
|
-
priority: _enum([
|
|
13552
|
-
"low",
|
|
13553
|
-
"normal",
|
|
13554
|
-
"high",
|
|
13555
|
-
"critical"
|
|
13556
|
-
])
|
|
13557
|
-
});
|
|
13558
|
-
var NotificationTestResultSchema = object({
|
|
13559
|
-
ruleId: string(),
|
|
13560
|
-
eventId: string(),
|
|
13561
|
-
timestamp: number(),
|
|
13562
|
-
wouldFire: boolean(),
|
|
13563
|
-
reason: string().optional()
|
|
13564
|
-
});
|
|
13565
|
-
var NotificationHistoryEntrySchema = object({
|
|
13566
|
-
id: string(),
|
|
13567
|
-
ruleId: string(),
|
|
13568
|
-
ruleName: string(),
|
|
13569
|
-
eventId: string(),
|
|
13570
|
-
timestamp: number(),
|
|
13571
|
-
outputs: array(string()).readonly(),
|
|
13572
|
-
success: boolean(),
|
|
13573
|
-
error: string().optional(),
|
|
13574
|
-
deviceId: number().optional()
|
|
13575
|
-
});
|
|
13576
|
-
var NotificationHistoryFilterSchema = object({
|
|
13577
|
-
ruleId: string().optional(),
|
|
13578
|
-
deviceId: number().optional(),
|
|
13579
|
-
from: number().optional(),
|
|
13580
|
-
to: number().optional(),
|
|
13581
|
-
limit: number().optional()
|
|
13582
|
-
});
|
|
13583
|
-
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({
|
|
13584
|
-
ruleId: string(),
|
|
13585
|
-
lookbackMinutes: number()
|
|
13586
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
13587
14187
|
/**
|
|
13588
14188
|
* Alerts capability — collection-based internal alert system.
|
|
13589
14189
|
*
|
|
@@ -13807,88 +14407,54 @@ method(object({
|
|
|
13807
14407
|
password: string()
|
|
13808
14408
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
13809
14409
|
/**
|
|
13810
|
-
*
|
|
13811
|
-
*
|
|
13812
|
-
*
|
|
13813
|
-
*
|
|
13814
|
-
*
|
|
13815
|
-
*
|
|
13816
|
-
*
|
|
13817
|
-
* A contribution is a discriminated union on `kind`:
|
|
13818
|
-
*
|
|
13819
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
13820
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
13821
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
13822
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
13823
|
-
* login page needs NO change.
|
|
13824
|
-
*
|
|
13825
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
13826
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
13827
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
13828
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
13829
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
13830
|
-
*
|
|
13831
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
13832
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
13833
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
13834
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
13835
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
13836
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
13837
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
13838
|
-
* decision.
|
|
13839
|
-
*
|
|
13840
|
-
* Every contribution carries a `stage`:
|
|
13841
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
13842
|
-
* magic-link buttons; a future usernameless passkey).
|
|
13843
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
13844
|
-
* returned `factors` (passkey-as-2FA today).
|
|
13845
|
-
*
|
|
13846
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
13847
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
13848
|
-
* tRPC router.
|
|
14410
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
14411
|
+
* NOT flow through the capability — they use the addon data plane
|
|
14412
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
14413
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
14414
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
14415
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
13849
14416
|
*/
|
|
13850
|
-
|
|
13851
|
-
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13878
|
-
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
14417
|
+
var TerminalSessionInfoSchema = object({
|
|
14418
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
14419
|
+
sessionId: string(),
|
|
14420
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
14421
|
+
profileId: string(),
|
|
14422
|
+
/** Human-readable profile label for the UI session list. */
|
|
14423
|
+
label: string(),
|
|
14424
|
+
cols: number().int().positive(),
|
|
14425
|
+
rows: number().int().positive(),
|
|
14426
|
+
/** ms-epoch the session's pty was spawned. */
|
|
14427
|
+
startedAt: number()
|
|
14428
|
+
});
|
|
14429
|
+
/**
|
|
14430
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
14431
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
14432
|
+
* command string would be remote code execution as the server's user, so it is
|
|
14433
|
+
* deliberately not part of the contract.
|
|
14434
|
+
*/
|
|
14435
|
+
var TerminalProfileInfoSchema = object({
|
|
14436
|
+
profileId: string(),
|
|
14437
|
+
label: string(),
|
|
14438
|
+
description: string().optional()
|
|
14439
|
+
});
|
|
14440
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
14441
|
+
profileId: string(),
|
|
14442
|
+
cols: number().int().positive(),
|
|
14443
|
+
rows: number().int().positive()
|
|
14444
|
+
}), TerminalSessionInfoSchema, {
|
|
14445
|
+
kind: "mutation",
|
|
14446
|
+
auth: "admin"
|
|
14447
|
+
}), method(object({
|
|
14448
|
+
sessionId: string(),
|
|
14449
|
+
cols: number().int().positive(),
|
|
14450
|
+
rows: number().int().positive()
|
|
14451
|
+
}), _void(), {
|
|
14452
|
+
kind: "mutation",
|
|
14453
|
+
auth: "admin"
|
|
14454
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
14455
|
+
kind: "mutation",
|
|
14456
|
+
auth: "admin"
|
|
14457
|
+
});
|
|
13892
14458
|
/**
|
|
13893
14459
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
13894
14460
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
@@ -13990,11 +14556,53 @@ var LocationStatSchema = object({
|
|
|
13990
14556
|
fileCount: number(),
|
|
13991
14557
|
present: boolean()
|
|
13992
14558
|
});
|
|
14559
|
+
/**
|
|
14560
|
+
* A backup schedule — the N:M "entry" that binds one cron cadence to a
|
|
14561
|
+
* SET of destination locations. Supersedes the per-location cron on
|
|
14562
|
+
* `BackupDestinationPolicy`: an operator creates a schedule, picks the
|
|
14563
|
+
* `backups` locations it should write to, and the orchestrator fans a
|
|
14564
|
+
* single archive out to all of them when the cron fires.
|
|
14565
|
+
*
|
|
14566
|
+
* `retentionCount` is per-schedule (D-decision 2026-07-28): every
|
|
14567
|
+
* location targeted by this schedule keeps this many archives from
|
|
14568
|
+
* this schedule's runs.
|
|
14569
|
+
*
|
|
14570
|
+
* `dataSources` optionally narrows which top-level state locations
|
|
14571
|
+
* (db, addons, tls, …) are archived; omitted = the orchestrator's
|
|
14572
|
+
* default full set.
|
|
14573
|
+
*/
|
|
14574
|
+
var BackupScheduleSchema = object({
|
|
14575
|
+
/** Stable id. Generated by the orchestrator on first upsert if absent. */
|
|
14576
|
+
id: string(),
|
|
14577
|
+
/** Operator-facing display name. */
|
|
14578
|
+
label: string(),
|
|
14579
|
+
/** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
|
|
14580
|
+
cron: string(),
|
|
14581
|
+
/** Master on/off toggle for the whole schedule. */
|
|
14582
|
+
enabled: boolean(),
|
|
14583
|
+
/** `backups`-location ids this schedule writes to (fan-out set). */
|
|
14584
|
+
locationIds: array(string()).readonly(),
|
|
14585
|
+
/** Archives kept per targeted location for this schedule. */
|
|
14586
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14587
|
+
/** Optional subset of source locations to include; omitted = all. */
|
|
14588
|
+
dataSources: array(string()).readonly().optional(),
|
|
14589
|
+
/** ms-epoch of last successful run. */
|
|
14590
|
+
lastRunAt: number().optional(),
|
|
14591
|
+
/** ms-epoch of next computed firing (read-only, filled on list). */
|
|
14592
|
+
nextRunAt: number().optional()
|
|
14593
|
+
});
|
|
13993
14594
|
method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
13994
14595
|
/** Subset of registered `backup-destination` addon ids to write to. */
|
|
13995
14596
|
destinations: array(string()).optional(),
|
|
13996
14597
|
locations: array(string()).optional(),
|
|
13997
|
-
label: string().optional()
|
|
14598
|
+
label: string().optional(),
|
|
14599
|
+
/**
|
|
14600
|
+
* Per-run retention override applied to every targeted
|
|
14601
|
+
* destination. Used by schedule-driven runs (per-entry
|
|
14602
|
+
* retention). Omitted = each destination's own policy
|
|
14603
|
+
* retention (manual runs).
|
|
14604
|
+
*/
|
|
14605
|
+
retentionCount: number().int().min(1).max(1e3).optional()
|
|
13998
14606
|
}).optional(), array(BackupEntrySchema).readonly(), {
|
|
13999
14607
|
kind: "mutation",
|
|
14000
14608
|
auth: "admin"
|
|
@@ -14043,7 +14651,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
14043
14651
|
ok: boolean(),
|
|
14044
14652
|
error: string().optional(),
|
|
14045
14653
|
nextRuns: array(number()).readonly()
|
|
14046
|
-
}))
|
|
14654
|
+
})), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
|
|
14655
|
+
id: string().optional(),
|
|
14656
|
+
label: string(),
|
|
14657
|
+
cron: string(),
|
|
14658
|
+
enabled: boolean(),
|
|
14659
|
+
locationIds: array(string()).readonly(),
|
|
14660
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14661
|
+
dataSources: array(string()).readonly().optional()
|
|
14662
|
+
}), BackupScheduleSchema, {
|
|
14663
|
+
kind: "mutation",
|
|
14664
|
+
auth: "admin"
|
|
14665
|
+
}), method(object({ id: string() }), _void(), {
|
|
14666
|
+
kind: "mutation",
|
|
14667
|
+
auth: "admin"
|
|
14668
|
+
});
|
|
14047
14669
|
/**
|
|
14048
14670
|
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
14049
14671
|
*
|
|
@@ -15326,851 +15948,934 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
15326
15948
|
kind: "mutation",
|
|
15327
15949
|
auth: "admin"
|
|
15328
15950
|
});
|
|
15329
|
-
|
|
15330
|
-
|
|
15331
|
-
|
|
15332
|
-
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
tags: record(string(), string()).optional()
|
|
15951
|
+
/**
|
|
15952
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15953
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15954
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
15955
|
+
*
|
|
15956
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15957
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
15958
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15959
|
+
*/
|
|
15960
|
+
var LlmUsageSchema = object({
|
|
15961
|
+
inputTokens: number(),
|
|
15962
|
+
outputTokens: number()
|
|
15342
15963
|
});
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
|
|
15351
|
-
|
|
15352
|
-
|
|
15353
|
-
|
|
15354
|
-
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
loadAvg: tuple([
|
|
15358
|
-
number(),
|
|
15359
|
-
number(),
|
|
15360
|
-
number()
|
|
15361
|
-
]),
|
|
15362
|
-
cores: number()
|
|
15363
|
-
});
|
|
15364
|
-
var MemoryInfoSchema = object({
|
|
15365
|
-
percent: number(),
|
|
15366
|
-
totalBytes: number(),
|
|
15367
|
-
usedBytes: number(),
|
|
15368
|
-
availableBytes: number(),
|
|
15369
|
-
swapUsedBytes: number(),
|
|
15370
|
-
swapTotalBytes: number()
|
|
15371
|
-
});
|
|
15372
|
-
var DiskIoSnapshotSchema = object({
|
|
15373
|
-
readBytes: number(),
|
|
15374
|
-
writeBytes: number(),
|
|
15375
|
-
readOps: number(),
|
|
15376
|
-
writeOps: number(),
|
|
15377
|
-
timestampMs: number()
|
|
15378
|
-
});
|
|
15379
|
-
var NetworkIoSnapshotSchema = object({
|
|
15380
|
-
rxBytes: number(),
|
|
15381
|
-
txBytes: number(),
|
|
15382
|
-
rxPackets: number(),
|
|
15383
|
-
txPackets: number(),
|
|
15384
|
-
rxErrors: number(),
|
|
15385
|
-
txErrors: number(),
|
|
15386
|
-
timestampMs: number()
|
|
15387
|
-
});
|
|
15388
|
-
var MetricsGpuInfoSchema = object({
|
|
15389
|
-
utilization: number(),
|
|
15964
|
+
var LlmErrorCodeSchema = _enum([
|
|
15965
|
+
"timeout",
|
|
15966
|
+
"rate-limited",
|
|
15967
|
+
"auth",
|
|
15968
|
+
"refusal",
|
|
15969
|
+
"bad-request",
|
|
15970
|
+
"unavailable",
|
|
15971
|
+
"no-profile",
|
|
15972
|
+
"budget-exceeded",
|
|
15973
|
+
"adapter-error"
|
|
15974
|
+
]);
|
|
15975
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15976
|
+
ok: literal(true),
|
|
15977
|
+
text: string(),
|
|
15390
15978
|
model: string(),
|
|
15391
|
-
|
|
15392
|
-
|
|
15393
|
-
|
|
15394
|
-
})
|
|
15395
|
-
|
|
15396
|
-
|
|
15397
|
-
|
|
15398
|
-
|
|
15399
|
-
|
|
15400
|
-
|
|
15401
|
-
|
|
15402
|
-
|
|
15403
|
-
|
|
15404
|
-
|
|
15979
|
+
usage: LlmUsageSchema,
|
|
15980
|
+
truncated: boolean(),
|
|
15981
|
+
latencyMs: number()
|
|
15982
|
+
}), object({
|
|
15983
|
+
ok: literal(false),
|
|
15984
|
+
code: LlmErrorCodeSchema,
|
|
15985
|
+
message: string(),
|
|
15986
|
+
retryAfterMs: number().optional()
|
|
15987
|
+
})]);
|
|
15988
|
+
/**
|
|
15989
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15990
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15991
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
15992
|
+
*/
|
|
15993
|
+
var LlmImageSchema = object({
|
|
15994
|
+
bytes: _instanceof(Uint8Array),
|
|
15995
|
+
mimeType: string()
|
|
15405
15996
|
});
|
|
15406
|
-
var
|
|
15407
|
-
|
|
15408
|
-
|
|
15997
|
+
var LlmGenerateBaseInputSchema = object({
|
|
15998
|
+
/** Collection routing (the notification-output posture). */
|
|
15999
|
+
addonId: string().optional(),
|
|
16000
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
16001
|
+
profileId: string().optional(),
|
|
16002
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
16003
|
+
consumer: string(),
|
|
16004
|
+
system: string().optional(),
|
|
16005
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
16006
|
+
prompt: string(),
|
|
16007
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
16008
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
16009
|
+
/** Per-call override of the profile default. */
|
|
16010
|
+
maxTokens: number().int().positive().optional(),
|
|
16011
|
+
temperature: number().optional()
|
|
15409
16012
|
});
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
|
|
15416
|
-
|
|
15417
|
-
|
|
15418
|
-
|
|
15419
|
-
|
|
16013
|
+
/**
|
|
16014
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
16015
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
16016
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
16017
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
16018
|
+
* this only through the `llm` cap's methods.
|
|
16019
|
+
*
|
|
16020
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
16021
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
16022
|
+
* watchdog — operator decision #3).
|
|
16023
|
+
*/
|
|
16024
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
16025
|
+
object({
|
|
16026
|
+
kind: literal("catalog"),
|
|
16027
|
+
catalogId: string()
|
|
15420
16028
|
}),
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
|
|
15430
|
-
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
*/
|
|
15443
|
-
|
|
15444
|
-
/**
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
sharedBytes: number().optional()
|
|
16029
|
+
object({
|
|
16030
|
+
kind: literal("url"),
|
|
16031
|
+
url: string(),
|
|
16032
|
+
sha256: string().optional()
|
|
16033
|
+
}),
|
|
16034
|
+
object({
|
|
16035
|
+
kind: literal("path"),
|
|
16036
|
+
path: string()
|
|
16037
|
+
})
|
|
16038
|
+
]);
|
|
16039
|
+
var ManagedRuntimeConfigSchema = object({
|
|
16040
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
16041
|
+
nodeId: string(),
|
|
16042
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
16043
|
+
engine: _enum(["llama-cpp"]),
|
|
16044
|
+
model: ManagedModelRefSchema,
|
|
16045
|
+
contextSize: number().int().default(4096),
|
|
16046
|
+
/** 0 = CPU-only. */
|
|
16047
|
+
gpuLayers: number().int().default(0),
|
|
16048
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
16049
|
+
threads: number().int().optional(),
|
|
16050
|
+
/** Concurrent slots. */
|
|
16051
|
+
parallel: number().int().default(1),
|
|
16052
|
+
/** Else lazy: first generate boots it. */
|
|
16053
|
+
autoStart: boolean().default(false),
|
|
16054
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
16055
|
+
idleStopMinutes: number().int().default(30)
|
|
15449
16056
|
});
|
|
15450
|
-
var
|
|
15451
|
-
|
|
16057
|
+
var LlmRuntimeStatusSchema = object({
|
|
16058
|
+
/** Status is ALWAYS node-qualified. */
|
|
15452
16059
|
nodeId: string(),
|
|
15453
|
-
role: _enum(["hub", "worker"]),
|
|
15454
|
-
pid: number(),
|
|
15455
16060
|
state: _enum([
|
|
15456
|
-
"starting",
|
|
15457
|
-
"running",
|
|
15458
|
-
"stopping",
|
|
15459
16061
|
"stopped",
|
|
15460
|
-
"
|
|
15461
|
-
|
|
15462
|
-
|
|
15463
|
-
|
|
15464
|
-
|
|
15465
|
-
pid: number(),
|
|
15466
|
-
ppid: number(),
|
|
15467
|
-
pgid: number(),
|
|
15468
|
-
classification: _enum([
|
|
15469
|
-
"root",
|
|
15470
|
-
"managed",
|
|
15471
|
-
"system",
|
|
15472
|
-
"ghost"
|
|
16062
|
+
"downloading",
|
|
16063
|
+
"starting",
|
|
16064
|
+
"ready",
|
|
16065
|
+
"crashed",
|
|
16066
|
+
"failed"
|
|
15473
16067
|
]),
|
|
15474
|
-
|
|
15475
|
-
|
|
15476
|
-
|
|
15477
|
-
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
|
|
15481
|
-
|
|
15482
|
-
|
|
15483
|
-
|
|
15484
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15485
|
-
orphaned: boolean()
|
|
15486
|
-
});
|
|
15487
|
-
var KillProcessInputSchema = object({
|
|
15488
|
-
pid: number(),
|
|
15489
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15490
|
-
force: boolean().optional()
|
|
16068
|
+
pid: number().optional(),
|
|
16069
|
+
port: number().optional(),
|
|
16070
|
+
modelPath: string().optional(),
|
|
16071
|
+
modelId: string().optional(),
|
|
16072
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
16073
|
+
lastError: string().optional(),
|
|
16074
|
+
crashesInWindow: number(),
|
|
16075
|
+
/** Child RSS (sampled best-effort). */
|
|
16076
|
+
memoryBytes: number().optional(),
|
|
16077
|
+
vramBytes: number().optional()
|
|
15491
16078
|
});
|
|
15492
|
-
var
|
|
15493
|
-
|
|
15494
|
-
|
|
15495
|
-
|
|
16079
|
+
var LlmNodeModelSchema = object({
|
|
16080
|
+
file: string(),
|
|
16081
|
+
sizeBytes: number(),
|
|
16082
|
+
catalogId: string().optional(),
|
|
16083
|
+
installedAt: number().optional()
|
|
15496
16084
|
});
|
|
15497
|
-
var
|
|
15498
|
-
|
|
15499
|
-
|
|
15500
|
-
|
|
15501
|
-
success: boolean(),
|
|
15502
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15503
|
-
path: string().optional(),
|
|
15504
|
-
/** Process pid that was signalled. */
|
|
15505
|
-
pid: number().optional(),
|
|
15506
|
-
reason: string().optional()
|
|
16085
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
16086
|
+
nodeId: string(),
|
|
16087
|
+
modelsBytes: number(),
|
|
16088
|
+
freeBytes: number().optional()
|
|
15507
16089
|
});
|
|
15508
|
-
|
|
15509
|
-
|
|
15510
|
-
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
|
|
15514
|
-
temperature: number().optional(),
|
|
15515
|
-
gpuPercent: number().optional(),
|
|
15516
|
-
gpuMemoryPercent: number().optional()
|
|
15517
|
-
});
|
|
15518
|
-
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, {
|
|
16090
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
16091
|
+
images: array(LlmImageSchema).optional(),
|
|
16092
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
16093
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
16094
|
+
timeoutMs: number().int().positive().optional()
|
|
16095
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15519
16096
|
kind: "mutation",
|
|
15520
16097
|
auth: "admin"
|
|
15521
|
-
}), method(
|
|
16098
|
+
}), method(object({}), _void(), {
|
|
15522
16099
|
kind: "mutation",
|
|
15523
16100
|
auth: "admin"
|
|
15524
|
-
})
|
|
15525
|
-
method(object({
|
|
15526
|
-
sourceUrl: string(),
|
|
15527
|
-
metadata: ModelConvertMetadataSchema,
|
|
15528
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15529
|
-
calibrationRef: string().optional(),
|
|
15530
|
-
sessionId: string().optional()
|
|
15531
|
-
}), ConvertResultSchema, {
|
|
16101
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15532
16102
|
kind: "mutation",
|
|
15533
|
-
auth: "admin"
|
|
15534
|
-
|
|
15535
|
-
});
|
|
15536
|
-
method(object({
|
|
15537
|
-
nodeId: string(),
|
|
15538
|
-
modelId: string(),
|
|
15539
|
-
format: _enum(MODEL_FORMATS),
|
|
15540
|
-
entry: ModelCatalogEntrySchema
|
|
15541
|
-
}), object({
|
|
15542
|
-
ok: boolean(),
|
|
15543
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15544
|
-
sha256: string(),
|
|
15545
|
-
bytes: number(),
|
|
15546
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15547
|
-
path: string()
|
|
15548
|
-
}), {
|
|
16103
|
+
auth: "admin"
|
|
16104
|
+
}), method(object({ file: string() }), _void(), {
|
|
15549
16105
|
kind: "mutation",
|
|
15550
16106
|
auth: "admin"
|
|
15551
|
-
});
|
|
15552
|
-
/**
|
|
15553
|
-
* `mqtt-broker` — broker-registry cap.
|
|
15554
|
-
*
|
|
15555
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15556
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15557
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
15558
|
-
* its OWN `mqtt.js` client.
|
|
15559
|
-
*
|
|
15560
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15561
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15562
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
15563
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15564
|
-
* features anyway — give it the connection config, get out of the way.
|
|
15565
|
-
*
|
|
15566
|
-
* Consumer flow:
|
|
15567
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
15568
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
15569
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
15570
|
-
*
|
|
15571
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
15572
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
15573
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
15574
|
-
* spawned it.
|
|
15575
|
-
*/
|
|
15576
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
16107
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15577
16108
|
/**
|
|
15578
|
-
*
|
|
16109
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
16110
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
16111
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
16112
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
16113
|
+
* (hub-placed); the cap stays open for future providers.
|
|
15579
16114
|
*
|
|
15580
|
-
*
|
|
15581
|
-
*
|
|
15582
|
-
*
|
|
15583
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
15584
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16115
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
16116
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
16117
|
+
* write; a stored key NEVER round-trips to a client.
|
|
15585
16118
|
*/
|
|
15586
|
-
var
|
|
15587
|
-
"
|
|
15588
|
-
"
|
|
15589
|
-
"
|
|
15590
|
-
"
|
|
15591
|
-
"
|
|
16119
|
+
var LlmProfileKindSchema = _enum([
|
|
16120
|
+
"openai-compatible",
|
|
16121
|
+
"openai",
|
|
16122
|
+
"anthropic",
|
|
16123
|
+
"google",
|
|
16124
|
+
"managed-local"
|
|
15592
16125
|
]);
|
|
15593
|
-
var
|
|
16126
|
+
var LlmProfileSchema = object({
|
|
15594
16127
|
id: string(),
|
|
15595
16128
|
name: string(),
|
|
15596
|
-
|
|
15597
|
-
|
|
15598
|
-
|
|
15599
|
-
|
|
15600
|
-
|
|
15601
|
-
|
|
15602
|
-
|
|
15603
|
-
|
|
15604
|
-
|
|
16129
|
+
kind: LlmProfileKindSchema,
|
|
16130
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
16131
|
+
addonId: string(),
|
|
16132
|
+
enabled: boolean(),
|
|
16133
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
16134
|
+
model: string(),
|
|
16135
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
16136
|
+
baseUrl: string().optional(),
|
|
16137
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
16138
|
+
apiKey: string().optional(),
|
|
16139
|
+
supportsVision: boolean(),
|
|
16140
|
+
temperature: number().min(0).max(2).optional(),
|
|
16141
|
+
maxTokens: number().int().positive().optional(),
|
|
16142
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
16143
|
+
extraHeaders: record(string(), string()).optional(),
|
|
16144
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
16145
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15605
16146
|
});
|
|
15606
|
-
/**
|
|
15607
|
-
*
|
|
15608
|
-
*
|
|
15609
|
-
|
|
15610
|
-
|
|
15611
|
-
|
|
15612
|
-
|
|
15613
|
-
|
|
15614
|
-
|
|
15615
|
-
|
|
15616
|
-
|
|
15617
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
15618
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
15619
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
15620
|
-
* broker).
|
|
15621
|
-
*/
|
|
15622
|
-
clientIdPrefix: string().optional()
|
|
16147
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
16148
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
16149
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
16150
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
16151
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
16152
|
+
kind: LlmProfileKindSchema,
|
|
16153
|
+
label: string(),
|
|
16154
|
+
icon: string(),
|
|
16155
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16156
|
+
addonId: string(),
|
|
16157
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
15623
16158
|
});
|
|
15624
|
-
var
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15628
|
-
password: string().optional(),
|
|
15629
|
-
clientIdPrefix: string().optional()
|
|
16159
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
16160
|
+
var LlmDefaultSchema = object({
|
|
16161
|
+
selector: LlmDefaultSelectorSchema,
|
|
16162
|
+
profileId: string()
|
|
15630
16163
|
});
|
|
15631
|
-
|
|
15632
|
-
var
|
|
15633
|
-
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
|
|
15639
|
-
|
|
15640
|
-
|
|
15641
|
-
|
|
15642
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
15643
|
-
allowAnonymous: boolean().default(false),
|
|
15644
|
-
/** Optional shared username/password for clients. */
|
|
15645
|
-
username: string().optional(),
|
|
15646
|
-
password: string().optional()
|
|
16164
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
16165
|
+
var LlmUsageRollupSchema = object({
|
|
16166
|
+
day: string(),
|
|
16167
|
+
consumer: string(),
|
|
16168
|
+
profileId: string(),
|
|
16169
|
+
calls: number(),
|
|
16170
|
+
okCalls: number(),
|
|
16171
|
+
errorCalls: number(),
|
|
16172
|
+
inputTokens: number(),
|
|
16173
|
+
outputTokens: number(),
|
|
16174
|
+
avgLatencyMs: number()
|
|
15647
16175
|
});
|
|
15648
|
-
|
|
16176
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
16177
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
15649
16178
|
id: string(),
|
|
15650
|
-
|
|
15651
|
-
|
|
15652
|
-
|
|
15653
|
-
brokerCount: number(),
|
|
15654
|
-
embeddedRunning: boolean()
|
|
15655
|
-
});
|
|
15656
|
-
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);
|
|
15657
|
-
var NetworkEndpointSchema = object({
|
|
16179
|
+
label: string(),
|
|
16180
|
+
family: string(),
|
|
16181
|
+
purpose: _enum(["text", "vision"]),
|
|
15658
16182
|
url: string(),
|
|
15659
|
-
|
|
15660
|
-
|
|
15661
|
-
|
|
16183
|
+
sha256: string(),
|
|
16184
|
+
sizeBytes: number(),
|
|
16185
|
+
quantization: string(),
|
|
16186
|
+
/** Load-time guidance shown in the picker. */
|
|
16187
|
+
minRamBytes: number(),
|
|
16188
|
+
contextSizeDefault: number().int(),
|
|
16189
|
+
/** Vision models: companion projector file. */
|
|
16190
|
+
mmprojUrl: string().optional()
|
|
15662
16191
|
});
|
|
15663
|
-
var
|
|
15664
|
-
|
|
15665
|
-
|
|
16192
|
+
var LlmRuntimeNodeSchema = object({
|
|
16193
|
+
nodeId: string(),
|
|
16194
|
+
reachable: boolean(),
|
|
16195
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
16196
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15666
16197
|
error: string().optional()
|
|
15667
16198
|
});
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
* the originating provider config (mode + sourcePort) so the
|
|
15673
|
-
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
15674
|
-
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
15675
|
-
*/
|
|
15676
|
-
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
15677
|
-
/**
|
|
15678
|
-
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
15679
|
-
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
15680
|
-
*/
|
|
15681
|
-
id: string(),
|
|
15682
|
-
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
15683
|
-
label: string(),
|
|
15684
|
-
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
15685
|
-
mode: string().optional(),
|
|
15686
|
-
/** Originating local port the ingress fronts (informational). */
|
|
15687
|
-
sourcePort: number().optional()
|
|
16199
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
16200
|
+
var ProfileRefInputSchema = object({
|
|
16201
|
+
addonId: string(),
|
|
16202
|
+
profileId: string()
|
|
15688
16203
|
});
|
|
15689
|
-
method(
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15700
|
-
|
|
15701
|
-
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
"
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
"
|
|
15730
|
-
"
|
|
16204
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
16205
|
+
kind: "mutation",
|
|
16206
|
+
auth: "admin"
|
|
16207
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16208
|
+
kind: "mutation",
|
|
16209
|
+
auth: "admin"
|
|
16210
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
16211
|
+
kind: "mutation",
|
|
16212
|
+
auth: "admin"
|
|
16213
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
16214
|
+
selector: LlmDefaultSelectorSchema,
|
|
16215
|
+
profileId: string().nullable()
|
|
16216
|
+
}), _void(), {
|
|
16217
|
+
kind: "mutation",
|
|
16218
|
+
auth: "admin"
|
|
16219
|
+
}), method(object({
|
|
16220
|
+
since: number().optional(),
|
|
16221
|
+
until: number().optional(),
|
|
16222
|
+
consumer: string().optional(),
|
|
16223
|
+
profileId: string().optional()
|
|
16224
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16225
|
+
nodeId: string(),
|
|
16226
|
+
model: ManagedModelRefSchema
|
|
16227
|
+
}), _void(), {
|
|
16228
|
+
kind: "mutation",
|
|
16229
|
+
auth: "admin"
|
|
16230
|
+
}), method(object({
|
|
16231
|
+
nodeId: string(),
|
|
16232
|
+
file: string()
|
|
16233
|
+
}), _void(), {
|
|
16234
|
+
kind: "mutation",
|
|
16235
|
+
auth: "admin"
|
|
16236
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16237
|
+
kind: "mutation",
|
|
16238
|
+
auth: "admin"
|
|
16239
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16240
|
+
kind: "mutation",
|
|
16241
|
+
auth: "admin"
|
|
16242
|
+
});
|
|
16243
|
+
var LogLevelSchema = _enum([
|
|
16244
|
+
"debug",
|
|
16245
|
+
"info",
|
|
16246
|
+
"warn",
|
|
16247
|
+
"error"
|
|
15731
16248
|
]);
|
|
16249
|
+
var LogEntrySchema = object({
|
|
16250
|
+
timestamp: date(),
|
|
16251
|
+
level: LogLevelSchema,
|
|
16252
|
+
scope: array(string()),
|
|
16253
|
+
message: string(),
|
|
16254
|
+
meta: record(string(), unknown()).optional(),
|
|
16255
|
+
tags: record(string(), string()).optional()
|
|
16256
|
+
});
|
|
16257
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
16258
|
+
scope: array(string()).optional(),
|
|
16259
|
+
level: LogLevelSchema.optional(),
|
|
16260
|
+
since: date().optional(),
|
|
16261
|
+
until: date().optional(),
|
|
16262
|
+
limit: number().optional(),
|
|
16263
|
+
tags: record(string(), string()).optional()
|
|
16264
|
+
}), array(LogEntrySchema).readonly());
|
|
15732
16265
|
/**
|
|
15733
|
-
*
|
|
15734
|
-
*
|
|
15735
|
-
*
|
|
15736
|
-
*
|
|
16266
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
16267
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
16268
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
16269
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
16270
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
16271
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
16272
|
+
*
|
|
16273
|
+
* A contribution is a discriminated union on `kind`:
|
|
16274
|
+
*
|
|
16275
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
16276
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16277
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
16278
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16279
|
+
* login page needs NO change.
|
|
16280
|
+
*
|
|
16281
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
16282
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
16283
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
16284
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
16285
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
16286
|
+
*
|
|
16287
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
16288
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
16289
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
16290
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
16291
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
16292
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
16293
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
16294
|
+
* decision.
|
|
16295
|
+
*
|
|
16296
|
+
* Every contribution carries a `stage`:
|
|
16297
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
16298
|
+
* magic-link buttons; a future usernameless passkey).
|
|
16299
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16300
|
+
* returned `factors` (passkey-as-2FA today).
|
|
16301
|
+
*
|
|
16302
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
16303
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
16304
|
+
* tRPC router.
|
|
15737
16305
|
*/
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
|
|
16306
|
+
/** When a login method renders in the two-phase login flow. */
|
|
16307
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
16308
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
16309
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
16310
|
+
object({
|
|
16311
|
+
kind: literal("redirect"),
|
|
16312
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
16313
|
+
id: string(),
|
|
16314
|
+
/** Operator-facing button label. */
|
|
16315
|
+
label: string(),
|
|
16316
|
+
/** lucide-react icon name. */
|
|
16317
|
+
icon: string().optional(),
|
|
16318
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
16319
|
+
startUrl: string(),
|
|
16320
|
+
stage: LoginStageEnum
|
|
16321
|
+
}),
|
|
16322
|
+
object({
|
|
16323
|
+
kind: literal("widget"),
|
|
16324
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
16325
|
+
id: string(),
|
|
16326
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
16327
|
+
addonId: string(),
|
|
16328
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
16329
|
+
bundle: string(),
|
|
16330
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
16331
|
+
remote: WidgetRemoteSchema,
|
|
16332
|
+
stage: LoginStageEnum
|
|
16333
|
+
}),
|
|
16334
|
+
object({
|
|
16335
|
+
kind: literal("passkey"),
|
|
16336
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
16337
|
+
id: string(),
|
|
16338
|
+
/** Operator-facing button label. */
|
|
16339
|
+
label: string(),
|
|
16340
|
+
stage: LoginStageEnum,
|
|
16341
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
16342
|
+
rpId: string(),
|
|
16343
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
16344
|
+
origin: string().nullable()
|
|
16345
|
+
})
|
|
15749
16346
|
]);
|
|
15750
|
-
|
|
15751
|
-
var
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
|
|
16347
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
16348
|
+
var CpuBreakdownSchema = object({
|
|
16349
|
+
total: number(),
|
|
16350
|
+
user: number(),
|
|
16351
|
+
system: number(),
|
|
16352
|
+
irq: number(),
|
|
16353
|
+
nice: number(),
|
|
16354
|
+
loadAvg: tuple([
|
|
16355
|
+
number(),
|
|
16356
|
+
number(),
|
|
16357
|
+
number()
|
|
16358
|
+
]),
|
|
16359
|
+
cores: number()
|
|
15755
16360
|
});
|
|
15756
|
-
|
|
15757
|
-
|
|
15758
|
-
|
|
15759
|
-
|
|
15760
|
-
|
|
15761
|
-
|
|
15762
|
-
|
|
15763
|
-
|
|
15764
|
-
var
|
|
15765
|
-
|
|
15766
|
-
|
|
15767
|
-
|
|
15768
|
-
|
|
15769
|
-
|
|
15770
|
-
|
|
15771
|
-
|
|
15772
|
-
|
|
15773
|
-
|
|
15774
|
-
|
|
15775
|
-
|
|
15776
|
-
|
|
15777
|
-
|
|
15778
|
-
|
|
16361
|
+
var MemoryInfoSchema = object({
|
|
16362
|
+
percent: number(),
|
|
16363
|
+
totalBytes: number(),
|
|
16364
|
+
usedBytes: number(),
|
|
16365
|
+
availableBytes: number(),
|
|
16366
|
+
swapUsedBytes: number(),
|
|
16367
|
+
swapTotalBytes: number()
|
|
16368
|
+
});
|
|
16369
|
+
var DiskIoSnapshotSchema = object({
|
|
16370
|
+
readBytes: number(),
|
|
16371
|
+
writeBytes: number(),
|
|
16372
|
+
readOps: number(),
|
|
16373
|
+
writeOps: number(),
|
|
16374
|
+
timestampMs: number()
|
|
16375
|
+
});
|
|
16376
|
+
var NetworkIoSnapshotSchema = object({
|
|
16377
|
+
rxBytes: number(),
|
|
16378
|
+
txBytes: number(),
|
|
16379
|
+
rxPackets: number(),
|
|
16380
|
+
txPackets: number(),
|
|
16381
|
+
rxErrors: number(),
|
|
16382
|
+
txErrors: number(),
|
|
16383
|
+
timestampMs: number()
|
|
16384
|
+
});
|
|
16385
|
+
var MetricsGpuInfoSchema = object({
|
|
16386
|
+
utilization: number(),
|
|
16387
|
+
model: string(),
|
|
16388
|
+
memoryUsedBytes: number(),
|
|
16389
|
+
memoryTotalBytes: number(),
|
|
16390
|
+
temperature: number().nullable()
|
|
16391
|
+
});
|
|
16392
|
+
var ProcessResourceInfoSchema = object({
|
|
16393
|
+
openFds: number(),
|
|
16394
|
+
threadCount: number(),
|
|
16395
|
+
activeHandles: number(),
|
|
16396
|
+
activeRequests: number()
|
|
15779
16397
|
});
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
|
|
15783
|
-
|
|
15784
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
15785
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
15786
|
-
flags: object({
|
|
15787
|
-
critical: boolean().optional(),
|
|
15788
|
-
silent: boolean().optional(),
|
|
15789
|
-
noPush: boolean().optional()
|
|
15790
|
-
}).optional(),
|
|
15791
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
15792
|
-
requires: array(string()).optional(),
|
|
15793
|
-
description: string().optional()
|
|
16398
|
+
var PressureAvgsSchema = object({
|
|
16399
|
+
avg10: number(),
|
|
16400
|
+
avg60: number(),
|
|
16401
|
+
avg300: number()
|
|
15794
16402
|
});
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
|
-
|
|
15805
|
-
|
|
16403
|
+
var PressureInfoSchema = object({
|
|
16404
|
+
some: PressureAvgsSchema,
|
|
16405
|
+
full: PressureAvgsSchema.nullable()
|
|
16406
|
+
});
|
|
16407
|
+
var SystemResourceSnapshotSchema = object({
|
|
16408
|
+
cpu: CpuBreakdownSchema,
|
|
16409
|
+
memory: MemoryInfoSchema,
|
|
16410
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
16411
|
+
network: NetworkIoSnapshotSchema,
|
|
16412
|
+
disk: DiskIoSnapshotSchema,
|
|
16413
|
+
pressure: object({
|
|
16414
|
+
cpu: PressureInfoSchema.nullable(),
|
|
16415
|
+
memory: PressureInfoSchema.nullable(),
|
|
16416
|
+
io: PressureInfoSchema.nullable()
|
|
15806
16417
|
}),
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
|
|
15810
|
-
format: array(NotificationFormatSchema),
|
|
15811
|
-
clickUrl: boolean(),
|
|
15812
|
-
sound: boolean(),
|
|
15813
|
-
ttl: boolean(),
|
|
15814
|
-
bodyMaxLen: number().int().positive()
|
|
16418
|
+
process: ProcessResourceInfoSchema,
|
|
16419
|
+
cpuTemperature: number().nullable(),
|
|
16420
|
+
timestampMs: number()
|
|
15815
16421
|
});
|
|
15816
|
-
|
|
15817
|
-
|
|
15818
|
-
|
|
15819
|
-
|
|
15820
|
-
|
|
15821
|
-
|
|
15822
|
-
*/
|
|
15823
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
15824
|
-
var TargetKindSchema = object({
|
|
15825
|
-
kind: string(),
|
|
15826
|
-
label: string(),
|
|
15827
|
-
icon: string(),
|
|
15828
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15829
|
-
addonId: string(),
|
|
15830
|
-
configSchema: ConfigSchemaPassthrough$1,
|
|
15831
|
-
supportsDiscovery: boolean(),
|
|
15832
|
-
caps: TargetKindCapsSchema
|
|
16422
|
+
var DiskSpaceInfoSchema = object({
|
|
16423
|
+
path: string(),
|
|
16424
|
+
totalBytes: number(),
|
|
16425
|
+
usedBytes: number(),
|
|
16426
|
+
availableBytes: number(),
|
|
16427
|
+
percent: number()
|
|
15833
16428
|
});
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
|
|
15842
|
-
|
|
16429
|
+
var PidResourceStatsSchema = object({
|
|
16430
|
+
pid: number(),
|
|
16431
|
+
cpu: number(),
|
|
16432
|
+
memory: number(),
|
|
16433
|
+
/**
|
|
16434
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
16435
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
16436
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
16437
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
16438
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
16439
|
+
*/
|
|
16440
|
+
privateBytes: number().optional(),
|
|
16441
|
+
/**
|
|
16442
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
16443
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
16444
|
+
*/
|
|
16445
|
+
sharedBytes: number().optional()
|
|
16446
|
+
});
|
|
16447
|
+
var AddonInstanceSchema = object({
|
|
15843
16448
|
addonId: string(),
|
|
15844
|
-
|
|
15845
|
-
|
|
16449
|
+
nodeId: string(),
|
|
16450
|
+
role: _enum(["hub", "worker"]),
|
|
16451
|
+
pid: number(),
|
|
16452
|
+
state: _enum([
|
|
16453
|
+
"starting",
|
|
16454
|
+
"running",
|
|
16455
|
+
"stopping",
|
|
16456
|
+
"stopped",
|
|
16457
|
+
"crashed"
|
|
16458
|
+
]),
|
|
16459
|
+
uptimeSec: number()
|
|
15846
16460
|
});
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
|
|
15850
|
-
|
|
15851
|
-
|
|
16461
|
+
var NodeProcessSchema = object({
|
|
16462
|
+
pid: number(),
|
|
16463
|
+
ppid: number(),
|
|
16464
|
+
pgid: number(),
|
|
16465
|
+
classification: _enum([
|
|
16466
|
+
"root",
|
|
16467
|
+
"managed",
|
|
16468
|
+
"system",
|
|
16469
|
+
"ghost"
|
|
16470
|
+
]),
|
|
16471
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
16472
|
+
addonId: string().nullable(),
|
|
16473
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
16474
|
+
nodeId: string().nullable(),
|
|
16475
|
+
/** Truncated command line. */
|
|
16476
|
+
command: string(),
|
|
16477
|
+
cpuPercent: number(),
|
|
16478
|
+
memoryRssBytes: number(),
|
|
16479
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
16480
|
+
uptimeSec: number(),
|
|
16481
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
16482
|
+
orphaned: boolean()
|
|
15852
16483
|
});
|
|
15853
|
-
|
|
15854
|
-
|
|
15855
|
-
|
|
15856
|
-
|
|
15857
|
-
attachmentsSent: number().int().nonnegative(),
|
|
15858
|
-
actionsSent: number().int().nonnegative(),
|
|
15859
|
-
truncated: boolean(),
|
|
15860
|
-
dropped: array(string())
|
|
16484
|
+
var KillProcessInputSchema = object({
|
|
16485
|
+
pid: number(),
|
|
16486
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
16487
|
+
force: boolean().optional()
|
|
15861
16488
|
});
|
|
15862
|
-
var
|
|
16489
|
+
var KillProcessResultSchema = object({
|
|
16490
|
+
success: boolean(),
|
|
16491
|
+
reason: string().optional(),
|
|
16492
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
16493
|
+
});
|
|
16494
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
16495
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
16496
|
+
addonId: string() });
|
|
16497
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
15863
16498
|
success: boolean(),
|
|
16499
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
16500
|
+
path: string().optional(),
|
|
16501
|
+
/** Process pid that was signalled. */
|
|
16502
|
+
pid: number().optional(),
|
|
16503
|
+
reason: string().optional()
|
|
16504
|
+
});
|
|
16505
|
+
var SystemMetricsSchema = object({
|
|
16506
|
+
cpuPercent: number(),
|
|
16507
|
+
memoryPercent: number(),
|
|
16508
|
+
memoryUsedMB: number(),
|
|
16509
|
+
memoryTotalMB: number(),
|
|
16510
|
+
diskPercent: number().optional(),
|
|
16511
|
+
temperature: number().optional(),
|
|
16512
|
+
gpuPercent: number().optional(),
|
|
16513
|
+
gpuMemoryPercent: number().optional()
|
|
16514
|
+
});
|
|
16515
|
+
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, {
|
|
16516
|
+
kind: "mutation",
|
|
16517
|
+
auth: "admin"
|
|
16518
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
16519
|
+
kind: "mutation",
|
|
16520
|
+
auth: "admin"
|
|
16521
|
+
});
|
|
16522
|
+
method(object({
|
|
16523
|
+
sourceUrl: string(),
|
|
16524
|
+
metadata: ModelConvertMetadataSchema,
|
|
16525
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
16526
|
+
calibrationRef: string().optional(),
|
|
16527
|
+
sessionId: string().optional()
|
|
16528
|
+
}), ConvertResultSchema, {
|
|
16529
|
+
kind: "mutation",
|
|
16530
|
+
auth: "admin",
|
|
16531
|
+
timeoutMs: 6e5
|
|
16532
|
+
});
|
|
16533
|
+
method(object({
|
|
16534
|
+
nodeId: string(),
|
|
16535
|
+
modelId: string(),
|
|
16536
|
+
format: _enum(MODEL_FORMATS),
|
|
16537
|
+
entry: ModelCatalogEntrySchema
|
|
16538
|
+
}), object({
|
|
16539
|
+
ok: boolean(),
|
|
16540
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
16541
|
+
sha256: string(),
|
|
16542
|
+
bytes: number(),
|
|
16543
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
16544
|
+
path: string()
|
|
16545
|
+
}), {
|
|
16546
|
+
kind: "mutation",
|
|
16547
|
+
auth: "admin"
|
|
16548
|
+
});
|
|
16549
|
+
/**
|
|
16550
|
+
* `mqtt-broker` — broker-registry cap.
|
|
16551
|
+
*
|
|
16552
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
16553
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
16554
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
16555
|
+
* its OWN `mqtt.js` client.
|
|
16556
|
+
*
|
|
16557
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
16558
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
16559
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
16560
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
16561
|
+
* features anyway — give it the connection config, get out of the way.
|
|
16562
|
+
*
|
|
16563
|
+
* Consumer flow:
|
|
16564
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
16565
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
16566
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
16567
|
+
*
|
|
16568
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
16569
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
16570
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
16571
|
+
* spawned it.
|
|
16572
|
+
*/
|
|
16573
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
16574
|
+
/**
|
|
16575
|
+
* Broker live-probe status.
|
|
16576
|
+
*
|
|
16577
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
16578
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
16579
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
16580
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
16581
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16582
|
+
*/
|
|
16583
|
+
var BrokerStatusSchema$1 = _enum([
|
|
16584
|
+
"connected",
|
|
16585
|
+
"disconnected",
|
|
16586
|
+
"auth-failed",
|
|
16587
|
+
"unreachable",
|
|
16588
|
+
"tls-error"
|
|
16589
|
+
]);
|
|
16590
|
+
var BrokerInfoSchema = object({
|
|
16591
|
+
id: string(),
|
|
16592
|
+
name: string(),
|
|
16593
|
+
url: string(),
|
|
16594
|
+
kind: BrokerKindSchema,
|
|
16595
|
+
status: BrokerStatusSchema$1,
|
|
16596
|
+
latencyMs: number().nullable(),
|
|
15864
16597
|
error: string().optional(),
|
|
15865
|
-
|
|
16598
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
16599
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
16600
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
16601
|
+
lastCheckedAt: number().optional()
|
|
15866
16602
|
});
|
|
15867
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
15868
|
-
var TestResultSchema = SendResultSchema;
|
|
15869
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
15870
|
-
kind: string(),
|
|
15871
|
-
config: record(string(), unknown()).optional()
|
|
15872
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
15873
|
-
targetId: string(),
|
|
15874
|
-
notification: NotificationSchema
|
|
15875
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
15876
|
-
targetId: string(),
|
|
15877
|
-
sample: NotificationSchema.optional()
|
|
15878
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
15879
|
-
targetId: string(),
|
|
15880
|
-
enabled: boolean()
|
|
15881
|
-
}), _void(), { kind: "mutation" });
|
|
15882
16603
|
/**
|
|
15883
|
-
*
|
|
15884
|
-
*
|
|
15885
|
-
*
|
|
15886
|
-
*
|
|
15887
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15888
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
15889
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
16604
|
+
* Connection details — what a consumer needs to call
|
|
16605
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
16606
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
16607
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
15890
16608
|
*/
|
|
15891
|
-
var
|
|
15892
|
-
|
|
15893
|
-
|
|
16609
|
+
var BrokerConnectionDetailsSchema = object({
|
|
16610
|
+
url: string(),
|
|
16611
|
+
username: string().optional(),
|
|
16612
|
+
password: string().optional(),
|
|
16613
|
+
/**
|
|
16614
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
16615
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
16616
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
16617
|
+
* broker).
|
|
16618
|
+
*/
|
|
16619
|
+
clientIdPrefix: string().optional()
|
|
15894
16620
|
});
|
|
15895
|
-
var
|
|
15896
|
-
|
|
15897
|
-
"
|
|
15898
|
-
|
|
15899
|
-
|
|
15900
|
-
|
|
15901
|
-
|
|
15902
|
-
|
|
15903
|
-
|
|
15904
|
-
|
|
15905
|
-
]);
|
|
15906
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
16621
|
+
var AddBrokerInputSchema = object({
|
|
16622
|
+
name: string().min(1),
|
|
16623
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
16624
|
+
username: string().optional(),
|
|
16625
|
+
password: string().optional(),
|
|
16626
|
+
clientIdPrefix: string().optional()
|
|
16627
|
+
});
|
|
16628
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
16629
|
+
var IdInputSchema = object({ id: string() });
|
|
16630
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
15907
16631
|
ok: literal(true),
|
|
15908
|
-
text: string(),
|
|
15909
|
-
model: string(),
|
|
15910
|
-
usage: LlmUsageSchema,
|
|
15911
|
-
truncated: boolean(),
|
|
15912
16632
|
latencyMs: number()
|
|
15913
16633
|
}), object({
|
|
15914
16634
|
ok: literal(false),
|
|
15915
|
-
|
|
15916
|
-
message: string(),
|
|
15917
|
-
retryAfterMs: number().optional()
|
|
16635
|
+
error: string()
|
|
15918
16636
|
})]);
|
|
15919
|
-
|
|
15920
|
-
|
|
15921
|
-
|
|
15922
|
-
|
|
15923
|
-
*/
|
|
15924
|
-
|
|
15925
|
-
|
|
15926
|
-
mimeType: string()
|
|
16637
|
+
var StartEmbeddedInputSchema = object({
|
|
16638
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
16639
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
16640
|
+
allowAnonymous: boolean().default(false),
|
|
16641
|
+
/** Optional shared username/password for clients. */
|
|
16642
|
+
username: string().optional(),
|
|
16643
|
+
password: string().optional()
|
|
15927
16644
|
});
|
|
15928
|
-
var
|
|
15929
|
-
|
|
15930
|
-
|
|
15931
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15932
|
-
profileId: string().optional(),
|
|
15933
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15934
|
-
consumer: string(),
|
|
15935
|
-
system: string().optional(),
|
|
15936
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15937
|
-
prompt: string(),
|
|
15938
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15939
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
15940
|
-
/** Per-call override of the profile default. */
|
|
15941
|
-
maxTokens: number().int().positive().optional(),
|
|
15942
|
-
temperature: number().optional()
|
|
16645
|
+
var StartEmbeddedResultSchema = object({
|
|
16646
|
+
id: string(),
|
|
16647
|
+
url: string()
|
|
15943
16648
|
});
|
|
15944
|
-
|
|
15945
|
-
|
|
15946
|
-
|
|
15947
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15948
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15949
|
-
* this only through the `llm` cap's methods.
|
|
15950
|
-
*
|
|
15951
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15952
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15953
|
-
* watchdog — operator decision #3).
|
|
15954
|
-
*/
|
|
15955
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15956
|
-
object({
|
|
15957
|
-
kind: literal("catalog"),
|
|
15958
|
-
catalogId: string()
|
|
15959
|
-
}),
|
|
15960
|
-
object({
|
|
15961
|
-
kind: literal("url"),
|
|
15962
|
-
url: string(),
|
|
15963
|
-
sha256: string().optional()
|
|
15964
|
-
}),
|
|
15965
|
-
object({
|
|
15966
|
-
kind: literal("path"),
|
|
15967
|
-
path: string()
|
|
15968
|
-
})
|
|
15969
|
-
]);
|
|
15970
|
-
var ManagedRuntimeConfigSchema = object({
|
|
15971
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
15972
|
-
nodeId: string(),
|
|
15973
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15974
|
-
engine: _enum(["llama-cpp"]),
|
|
15975
|
-
model: ManagedModelRefSchema,
|
|
15976
|
-
contextSize: number().int().default(4096),
|
|
15977
|
-
/** 0 = CPU-only. */
|
|
15978
|
-
gpuLayers: number().int().default(0),
|
|
15979
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15980
|
-
threads: number().int().optional(),
|
|
15981
|
-
/** Concurrent slots. */
|
|
15982
|
-
parallel: number().int().default(1),
|
|
15983
|
-
/** Else lazy: first generate boots it. */
|
|
15984
|
-
autoStart: boolean().default(false),
|
|
15985
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
15986
|
-
idleStopMinutes: number().int().default(30)
|
|
16649
|
+
var StatusSchema = object({
|
|
16650
|
+
brokerCount: number(),
|
|
16651
|
+
embeddedRunning: boolean()
|
|
15987
16652
|
});
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
"starting",
|
|
15995
|
-
"ready",
|
|
15996
|
-
"crashed",
|
|
15997
|
-
"failed"
|
|
15998
|
-
]),
|
|
15999
|
-
pid: number().optional(),
|
|
16000
|
-
port: number().optional(),
|
|
16001
|
-
modelPath: string().optional(),
|
|
16002
|
-
modelId: string().optional(),
|
|
16003
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
16004
|
-
lastError: string().optional(),
|
|
16005
|
-
crashesInWindow: number(),
|
|
16006
|
-
/** Child RSS (sampled best-effort). */
|
|
16007
|
-
memoryBytes: number().optional(),
|
|
16008
|
-
vramBytes: number().optional()
|
|
16653
|
+
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);
|
|
16654
|
+
var NetworkEndpointSchema = object({
|
|
16655
|
+
url: string(),
|
|
16656
|
+
hostname: string(),
|
|
16657
|
+
port: number(),
|
|
16658
|
+
protocol: _enum(["http", "https"])
|
|
16009
16659
|
});
|
|
16010
|
-
var
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
installedAt: number().optional()
|
|
16660
|
+
var NetworkAccessStatusSchema = object({
|
|
16661
|
+
connected: boolean(),
|
|
16662
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
16663
|
+
error: string().optional()
|
|
16015
16664
|
});
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16665
|
+
/**
|
|
16666
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
16667
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
16668
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
16669
|
+
* the originating provider config (mode + sourcePort) so the
|
|
16670
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
16671
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
16672
|
+
*/
|
|
16673
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
16674
|
+
/**
|
|
16675
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
16676
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
16677
|
+
*/
|
|
16678
|
+
id: string(),
|
|
16679
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
16680
|
+
label: string(),
|
|
16681
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
16682
|
+
mode: string().optional(),
|
|
16683
|
+
/** Originating local port the ingress fronts (informational). */
|
|
16684
|
+
sourcePort: number().optional()
|
|
16020
16685
|
});
|
|
16021
|
-
method(
|
|
16022
|
-
images: array(LlmImageSchema).optional(),
|
|
16023
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
16024
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
16025
|
-
timeoutMs: number().int().positive().optional()
|
|
16026
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
16027
|
-
kind: "mutation",
|
|
16028
|
-
auth: "admin"
|
|
16029
|
-
}), method(object({}), _void(), {
|
|
16030
|
-
kind: "mutation",
|
|
16031
|
-
auth: "admin"
|
|
16032
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
16033
|
-
kind: "mutation",
|
|
16034
|
-
auth: "admin"
|
|
16035
|
-
}), method(object({ file: string() }), _void(), {
|
|
16036
|
-
kind: "mutation",
|
|
16037
|
-
auth: "admin"
|
|
16038
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
16686
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
16039
16687
|
/**
|
|
16040
|
-
*
|
|
16041
|
-
*
|
|
16042
|
-
*
|
|
16043
|
-
*
|
|
16044
|
-
*
|
|
16688
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
16689
|
+
*
|
|
16690
|
+
* Apprise-derived model (see
|
|
16691
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
16692
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
16693
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16694
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
16695
|
+
* message to what the kind supports — callers never special-case a service.
|
|
16696
|
+
*
|
|
16697
|
+
* DESIGN DECISIONS (locked):
|
|
16698
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
16699
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
16700
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
16701
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
16702
|
+
* alternative would fork the UI per addon and cannot host the
|
|
16703
|
+
* discovery→adopt flow.
|
|
16704
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
16705
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
16706
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
16707
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
16708
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
16709
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
16710
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
16711
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
16712
|
+
* base64 fallback needed.
|
|
16045
16713
|
*
|
|
16046
|
-
*
|
|
16047
|
-
* `
|
|
16048
|
-
*
|
|
16714
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
16715
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
16716
|
+
* admin "Integrations" page.
|
|
16049
16717
|
*/
|
|
16050
|
-
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
|
|
16054
|
-
|
|
16055
|
-
"
|
|
16718
|
+
/**
|
|
16719
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
16720
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
16721
|
+
*/
|
|
16722
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
16723
|
+
"image",
|
|
16724
|
+
"video",
|
|
16725
|
+
"gif",
|
|
16726
|
+
"audio",
|
|
16727
|
+
"icon"
|
|
16056
16728
|
]);
|
|
16057
|
-
|
|
16729
|
+
/**
|
|
16730
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
16731
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
16732
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
16733
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
16734
|
+
*/
|
|
16735
|
+
var AttachmentSchema = object({
|
|
16736
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
16737
|
+
url: string().optional(),
|
|
16738
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
16739
|
+
mime: string().optional(),
|
|
16740
|
+
name: string().optional()
|
|
16741
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
16742
|
+
var NotificationFormatSchema = _enum([
|
|
16743
|
+
"text",
|
|
16744
|
+
"markdown",
|
|
16745
|
+
"html"
|
|
16746
|
+
]);
|
|
16747
|
+
/** A single tap-through action button. */
|
|
16748
|
+
var NotificationActionSchema = object({
|
|
16058
16749
|
id: string(),
|
|
16059
|
-
|
|
16060
|
-
|
|
16061
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
16062
|
-
addonId: string(),
|
|
16063
|
-
enabled: boolean(),
|
|
16064
|
-
/** Vendor model id, or the managed runtime's loaded model. */
|
|
16065
|
-
model: string(),
|
|
16066
|
-
/** Required for openai-compatible; override for cloud kinds. */
|
|
16067
|
-
baseUrl: string().optional(),
|
|
16068
|
-
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
16069
|
-
apiKey: string().optional(),
|
|
16070
|
-
supportsVision: boolean(),
|
|
16071
|
-
temperature: number().min(0).max(2).optional(),
|
|
16072
|
-
maxTokens: number().int().positive().optional(),
|
|
16073
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
16074
|
-
extraHeaders: record(string(), string()).optional(),
|
|
16075
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
16076
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
16750
|
+
label: string(),
|
|
16751
|
+
url: string().optional()
|
|
16077
16752
|
});
|
|
16078
|
-
/**
|
|
16079
|
-
*
|
|
16080
|
-
*
|
|
16753
|
+
/**
|
|
16754
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
16755
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
16756
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
16757
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
16758
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
16759
|
+
* `priority` for that one target.
|
|
16760
|
+
*/
|
|
16761
|
+
var NotificationSchema = object({
|
|
16762
|
+
body: string(),
|
|
16763
|
+
title: string().optional(),
|
|
16764
|
+
format: NotificationFormatSchema.default("text"),
|
|
16765
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16766
|
+
level: string().optional(),
|
|
16767
|
+
attachments: array(AttachmentSchema).optional(),
|
|
16768
|
+
clickUrl: string().optional(),
|
|
16769
|
+
actions: array(NotificationActionSchema).optional(),
|
|
16770
|
+
sound: string().optional(),
|
|
16771
|
+
ttl: number().optional(),
|
|
16772
|
+
tag: string().optional(),
|
|
16773
|
+
deviceId: number().optional(),
|
|
16774
|
+
eventId: string().optional(),
|
|
16775
|
+
metadata: record(string(), unknown()).optional()
|
|
16776
|
+
});
|
|
16777
|
+
/** One declared native severity/priority level for a kind. */
|
|
16778
|
+
var TargetKindLevelSchema = object({
|
|
16779
|
+
id: string(),
|
|
16780
|
+
label: string(),
|
|
16781
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
16782
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
16783
|
+
flags: object({
|
|
16784
|
+
critical: boolean().optional(),
|
|
16785
|
+
silent: boolean().optional(),
|
|
16786
|
+
noPush: boolean().optional()
|
|
16787
|
+
}).optional(),
|
|
16788
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
16789
|
+
requires: array(string()).optional(),
|
|
16790
|
+
description: string().optional()
|
|
16791
|
+
});
|
|
16792
|
+
/** The full capability block consulted before dispatch. */
|
|
16793
|
+
var TargetKindCapsSchema = object({
|
|
16794
|
+
attachments: object({
|
|
16795
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
16796
|
+
mode: _enum([
|
|
16797
|
+
"url",
|
|
16798
|
+
"bytes",
|
|
16799
|
+
"both"
|
|
16800
|
+
]),
|
|
16801
|
+
max: number().int().nonnegative(),
|
|
16802
|
+
maxBytes: number().int().positive().optional()
|
|
16803
|
+
}),
|
|
16804
|
+
/** Max action buttons (0 = none). */
|
|
16805
|
+
actions: number().int().nonnegative(),
|
|
16806
|
+
levels: array(TargetKindLevelSchema),
|
|
16807
|
+
format: array(NotificationFormatSchema),
|
|
16808
|
+
clickUrl: boolean(),
|
|
16809
|
+
sound: boolean(),
|
|
16810
|
+
ttl: boolean(),
|
|
16811
|
+
bodyMaxLen: number().int().positive()
|
|
16812
|
+
});
|
|
16813
|
+
/**
|
|
16814
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
16815
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
16816
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
16817
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
16818
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
16819
|
+
*/
|
|
16081
16820
|
var ConfigSchemaPassthrough = unknown();
|
|
16082
|
-
var
|
|
16083
|
-
kind:
|
|
16821
|
+
var TargetKindSchema = object({
|
|
16822
|
+
kind: string(),
|
|
16084
16823
|
label: string(),
|
|
16085
16824
|
icon: string(),
|
|
16086
16825
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16087
16826
|
addonId: string(),
|
|
16088
|
-
configSchema: ConfigSchemaPassthrough
|
|
16089
|
-
|
|
16090
|
-
|
|
16091
|
-
var LlmDefaultSchema = object({
|
|
16092
|
-
selector: LlmDefaultSelectorSchema,
|
|
16093
|
-
profileId: string()
|
|
16094
|
-
});
|
|
16095
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
16096
|
-
var LlmUsageRollupSchema = object({
|
|
16097
|
-
day: string(),
|
|
16098
|
-
consumer: string(),
|
|
16099
|
-
profileId: string(),
|
|
16100
|
-
calls: number(),
|
|
16101
|
-
okCalls: number(),
|
|
16102
|
-
errorCalls: number(),
|
|
16103
|
-
inputTokens: number(),
|
|
16104
|
-
outputTokens: number(),
|
|
16105
|
-
avgLatencyMs: number()
|
|
16827
|
+
configSchema: ConfigSchemaPassthrough,
|
|
16828
|
+
supportsDiscovery: boolean(),
|
|
16829
|
+
caps: TargetKindCapsSchema
|
|
16106
16830
|
});
|
|
16107
|
-
/**
|
|
16108
|
-
|
|
16831
|
+
/**
|
|
16832
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
16833
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
16834
|
+
* round-trip a stored secret to the UI.
|
|
16835
|
+
*/
|
|
16836
|
+
var TargetSchema = object({
|
|
16109
16837
|
id: string(),
|
|
16110
|
-
|
|
16111
|
-
|
|
16112
|
-
purpose: _enum(["text", "vision"]),
|
|
16113
|
-
url: string(),
|
|
16114
|
-
sha256: string(),
|
|
16115
|
-
sizeBytes: number(),
|
|
16116
|
-
quantization: string(),
|
|
16117
|
-
/** Load-time guidance shown in the picker. */
|
|
16118
|
-
minRamBytes: number(),
|
|
16119
|
-
contextSizeDefault: number().int(),
|
|
16120
|
-
/** Vision models: companion projector file. */
|
|
16121
|
-
mmprojUrl: string().optional()
|
|
16122
|
-
});
|
|
16123
|
-
var LlmRuntimeNodeSchema = object({
|
|
16124
|
-
nodeId: string(),
|
|
16125
|
-
reachable: boolean(),
|
|
16126
|
-
status: LlmRuntimeStatusSchema.optional(),
|
|
16127
|
-
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
16128
|
-
error: string().optional()
|
|
16129
|
-
});
|
|
16130
|
-
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
16131
|
-
var ProfileRefInputSchema = object({
|
|
16838
|
+
name: string(),
|
|
16839
|
+
kind: string(),
|
|
16132
16840
|
addonId: string(),
|
|
16133
|
-
|
|
16841
|
+
enabled: boolean(),
|
|
16842
|
+
config: record(string(), unknown())
|
|
16134
16843
|
});
|
|
16135
|
-
|
|
16136
|
-
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
|
|
16140
|
-
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
|
|
16148
|
-
|
|
16149
|
-
|
|
16150
|
-
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
profileId: string().optional()
|
|
16155
|
-
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16156
|
-
nodeId: string(),
|
|
16157
|
-
model: ManagedModelRefSchema
|
|
16158
|
-
}), _void(), {
|
|
16159
|
-
kind: "mutation",
|
|
16160
|
-
auth: "admin"
|
|
16161
|
-
}), method(object({
|
|
16162
|
-
nodeId: string(),
|
|
16163
|
-
file: string()
|
|
16164
|
-
}), _void(), {
|
|
16165
|
-
kind: "mutation",
|
|
16166
|
-
auth: "admin"
|
|
16167
|
-
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16168
|
-
kind: "mutation",
|
|
16169
|
-
auth: "admin"
|
|
16170
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
16171
|
-
kind: "mutation",
|
|
16172
|
-
auth: "admin"
|
|
16844
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
16845
|
+
var DiscoveredTargetSchema = object({
|
|
16846
|
+
kind: string(),
|
|
16847
|
+
suggestedName: string(),
|
|
16848
|
+
config: record(string(), unknown())
|
|
16849
|
+
});
|
|
16850
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
16851
|
+
var RenderedAsSchema = object({
|
|
16852
|
+
level: string(),
|
|
16853
|
+
format: NotificationFormatSchema,
|
|
16854
|
+
attachmentsSent: number().int().nonnegative(),
|
|
16855
|
+
actionsSent: number().int().nonnegative(),
|
|
16856
|
+
truncated: boolean(),
|
|
16857
|
+
dropped: array(string())
|
|
16858
|
+
});
|
|
16859
|
+
var SendResultSchema = object({
|
|
16860
|
+
success: boolean(),
|
|
16861
|
+
error: string().optional(),
|
|
16862
|
+
renderedAs: RenderedAsSchema.optional()
|
|
16173
16863
|
});
|
|
16864
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
16865
|
+
var TestResultSchema = SendResultSchema;
|
|
16866
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
16867
|
+
kind: string(),
|
|
16868
|
+
config: record(string(), unknown()).optional()
|
|
16869
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
16870
|
+
targetId: string(),
|
|
16871
|
+
notification: NotificationSchema
|
|
16872
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
16873
|
+
targetId: string(),
|
|
16874
|
+
sample: NotificationSchema.optional()
|
|
16875
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16876
|
+
targetId: string(),
|
|
16877
|
+
enabled: boolean()
|
|
16878
|
+
}), _void(), { kind: "mutation" });
|
|
16174
16879
|
/**
|
|
16175
16880
|
* Zod schemas for persisted record types.
|
|
16176
16881
|
*
|
|
@@ -16856,7 +17561,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16856
17561
|
}), method(object({
|
|
16857
17562
|
eventId: string(),
|
|
16858
17563
|
kind: MediaFileKindEnum.optional()
|
|
16859
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
17564
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
17565
|
+
trackId: string(),
|
|
17566
|
+
kinds: array(MediaFileKindEnum).optional()
|
|
17567
|
+
}), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
|
|
16860
17568
|
deviceId: number(),
|
|
16861
17569
|
timestamp: number(),
|
|
16862
17570
|
frameWidth: number(),
|
|
@@ -16877,76 +17585,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16877
17585
|
eventId: string(),
|
|
16878
17586
|
timestamp: number()
|
|
16879
17587
|
});
|
|
16880
|
-
/**
|
|
16881
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
16882
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
16883
|
-
* caps into per-camera event-kind descriptors.
|
|
16884
|
-
*
|
|
16885
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
16886
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
16887
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
16888
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
16889
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
16890
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
16891
|
-
* eventful cap is missing.
|
|
16892
|
-
*/
|
|
16893
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
16894
|
-
var LEGACY_ICON = {
|
|
16895
|
-
motion: "motion",
|
|
16896
|
-
audio: "audio",
|
|
16897
|
-
person: "person",
|
|
16898
|
-
vehicle: "vehicle",
|
|
16899
|
-
animal: "animal",
|
|
16900
|
-
package: "package",
|
|
16901
|
-
door: "door",
|
|
16902
|
-
pir: "pir",
|
|
16903
|
-
smoke: "smoke",
|
|
16904
|
-
water: "water",
|
|
16905
|
-
button: "button",
|
|
16906
|
-
generic: "generic",
|
|
16907
|
-
gas: "smoke",
|
|
16908
|
-
vibration: "generic",
|
|
16909
|
-
tamper: "generic",
|
|
16910
|
-
presence: "person",
|
|
16911
|
-
lock: "generic",
|
|
16912
|
-
siren: "generic",
|
|
16913
|
-
switch: "generic",
|
|
16914
|
-
doorbell: "button"
|
|
16915
|
-
};
|
|
16916
|
-
function legacyIcon(iconId) {
|
|
16917
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
16918
|
-
}
|
|
16919
|
-
/**
|
|
16920
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
16921
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
16922
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
16923
|
-
*/
|
|
16924
|
-
var CAP_TO_KIND = {
|
|
16925
|
-
contact: "contact",
|
|
16926
|
-
motion: "motion-sensor",
|
|
16927
|
-
smoke: "smoke",
|
|
16928
|
-
flood: "flood",
|
|
16929
|
-
gas: "gas",
|
|
16930
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
16931
|
-
vibration: "vibration",
|
|
16932
|
-
tamper: "tamper",
|
|
16933
|
-
presence: "presence",
|
|
16934
|
-
"enum-sensor": "enum-sensor",
|
|
16935
|
-
"event-emitter": "device-event",
|
|
16936
|
-
"lock-control": "lock",
|
|
16937
|
-
switch: "switch",
|
|
16938
|
-
button: "button",
|
|
16939
|
-
doorbell: "doorbell"
|
|
16940
|
-
};
|
|
16941
|
-
function buildDescriptor(capName, kind) {
|
|
16942
|
-
const t = EVENT_TAXONOMY[kind];
|
|
16943
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
16944
|
-
return {
|
|
16945
|
-
...t,
|
|
16946
|
-
icon: legacyIcon(t.iconId)
|
|
16947
|
-
};
|
|
16948
|
-
}
|
|
16949
|
-
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
16950
17588
|
var CameraPipelineConfigSchema = object({
|
|
16951
17589
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
16952
17590
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -17432,6 +18070,76 @@ method(object({
|
|
|
17432
18070
|
auth: "admin"
|
|
17433
18071
|
});
|
|
17434
18072
|
/**
|
|
18073
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
18074
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
18075
|
+
* caps into per-camera event-kind descriptors.
|
|
18076
|
+
*
|
|
18077
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
18078
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
18079
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
18080
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
18081
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
18082
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
18083
|
+
* eventful cap is missing.
|
|
18084
|
+
*/
|
|
18085
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
18086
|
+
var LEGACY_ICON = {
|
|
18087
|
+
motion: "motion",
|
|
18088
|
+
audio: "audio",
|
|
18089
|
+
person: "person",
|
|
18090
|
+
vehicle: "vehicle",
|
|
18091
|
+
animal: "animal",
|
|
18092
|
+
package: "package",
|
|
18093
|
+
door: "door",
|
|
18094
|
+
pir: "pir",
|
|
18095
|
+
smoke: "smoke",
|
|
18096
|
+
water: "water",
|
|
18097
|
+
button: "button",
|
|
18098
|
+
generic: "generic",
|
|
18099
|
+
gas: "smoke",
|
|
18100
|
+
vibration: "generic",
|
|
18101
|
+
tamper: "generic",
|
|
18102
|
+
presence: "person",
|
|
18103
|
+
lock: "generic",
|
|
18104
|
+
siren: "generic",
|
|
18105
|
+
switch: "generic",
|
|
18106
|
+
doorbell: "button"
|
|
18107
|
+
};
|
|
18108
|
+
function legacyIcon(iconId) {
|
|
18109
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
18110
|
+
}
|
|
18111
|
+
/**
|
|
18112
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
18113
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
18114
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
18115
|
+
*/
|
|
18116
|
+
var CAP_TO_KIND = {
|
|
18117
|
+
contact: "contact",
|
|
18118
|
+
motion: "motion-sensor",
|
|
18119
|
+
smoke: "smoke",
|
|
18120
|
+
flood: "flood",
|
|
18121
|
+
gas: "gas",
|
|
18122
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
18123
|
+
vibration: "vibration",
|
|
18124
|
+
tamper: "tamper",
|
|
18125
|
+
presence: "presence",
|
|
18126
|
+
"enum-sensor": "enum-sensor",
|
|
18127
|
+
"event-emitter": "device-event",
|
|
18128
|
+
"lock-control": "lock",
|
|
18129
|
+
switch: "switch",
|
|
18130
|
+
button: "button",
|
|
18131
|
+
doorbell: "doorbell"
|
|
18132
|
+
};
|
|
18133
|
+
function buildDescriptor(capName, kind) {
|
|
18134
|
+
const t = EVENT_TAXONOMY[kind];
|
|
18135
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
18136
|
+
return {
|
|
18137
|
+
...t,
|
|
18138
|
+
icon: legacyIcon(t.iconId)
|
|
18139
|
+
};
|
|
18140
|
+
}
|
|
18141
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
18142
|
+
/**
|
|
17435
18143
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
17436
18144
|
* package lifecycle (runtime-updatable node packages).
|
|
17437
18145
|
*
|
|
@@ -18886,7 +19594,28 @@ var FaceInfoSchema = object({
|
|
|
18886
19594
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
18887
19595
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
18888
19596
|
* back to the inline `base64` face crop. */
|
|
18889
|
-
keyFrameMediaKey: string().optional()
|
|
19597
|
+
keyFrameMediaKey: string().optional(),
|
|
19598
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
19599
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
19600
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
19601
|
+
* faces that were never auto-recognized. */
|
|
19602
|
+
bestMatchScore: number().optional(),
|
|
19603
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
19604
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
19605
|
+
* legacy rows / runners that reported no native measure. */
|
|
19606
|
+
nativeFaceShortSidePx: number().optional(),
|
|
19607
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
19608
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
19609
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
19610
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
19611
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
19612
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
19613
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
19614
|
+
suggestedIdentityId: string().optional(),
|
|
19615
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
19616
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
19617
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
19618
|
+
suggestedMatchScore: number().optional()
|
|
18890
19619
|
});
|
|
18891
19620
|
var FaceFilterEnum = _enum([
|
|
18892
19621
|
"unassigned",
|
|
@@ -20929,36 +21658,6 @@ Object.freeze({
|
|
|
20929
21658
|
addonId: null,
|
|
20930
21659
|
access: "view"
|
|
20931
21660
|
},
|
|
20932
|
-
"advancedNotifier.deleteRule": {
|
|
20933
|
-
capName: "advanced-notifier",
|
|
20934
|
-
capScope: "system",
|
|
20935
|
-
addonId: null,
|
|
20936
|
-
access: "delete"
|
|
20937
|
-
},
|
|
20938
|
-
"advancedNotifier.getHistory": {
|
|
20939
|
-
capName: "advanced-notifier",
|
|
20940
|
-
capScope: "system",
|
|
20941
|
-
addonId: null,
|
|
20942
|
-
access: "view"
|
|
20943
|
-
},
|
|
20944
|
-
"advancedNotifier.getRules": {
|
|
20945
|
-
capName: "advanced-notifier",
|
|
20946
|
-
capScope: "system",
|
|
20947
|
-
addonId: null,
|
|
20948
|
-
access: "view"
|
|
20949
|
-
},
|
|
20950
|
-
"advancedNotifier.testRule": {
|
|
20951
|
-
capName: "advanced-notifier",
|
|
20952
|
-
capScope: "system",
|
|
20953
|
-
addonId: null,
|
|
20954
|
-
access: "create"
|
|
20955
|
-
},
|
|
20956
|
-
"advancedNotifier.upsertRule": {
|
|
20957
|
-
capName: "advanced-notifier",
|
|
20958
|
-
capScope: "system",
|
|
20959
|
-
addonId: null,
|
|
20960
|
-
access: "create"
|
|
20961
|
-
},
|
|
20962
21661
|
"alarmPanel.arm": {
|
|
20963
21662
|
capName: "alarm-panel",
|
|
20964
21663
|
capScope: "device",
|
|
@@ -21181,6 +21880,12 @@ Object.freeze({
|
|
|
21181
21880
|
addonId: null,
|
|
21182
21881
|
access: "delete"
|
|
21183
21882
|
},
|
|
21883
|
+
"backup.deleteSchedule": {
|
|
21884
|
+
capName: "backup",
|
|
21885
|
+
capScope: "system",
|
|
21886
|
+
addonId: null,
|
|
21887
|
+
access: "delete"
|
|
21888
|
+
},
|
|
21184
21889
|
"backup.getEntries": {
|
|
21185
21890
|
capName: "backup",
|
|
21186
21891
|
capScope: "system",
|
|
@@ -21211,6 +21916,12 @@ Object.freeze({
|
|
|
21211
21916
|
addonId: null,
|
|
21212
21917
|
access: "view"
|
|
21213
21918
|
},
|
|
21919
|
+
"backup.listSchedules": {
|
|
21920
|
+
capName: "backup",
|
|
21921
|
+
capScope: "system",
|
|
21922
|
+
addonId: null,
|
|
21923
|
+
access: "view"
|
|
21924
|
+
},
|
|
21214
21925
|
"backup.previewSchedule": {
|
|
21215
21926
|
capName: "backup",
|
|
21216
21927
|
capScope: "system",
|
|
@@ -21235,6 +21946,12 @@ Object.freeze({
|
|
|
21235
21946
|
addonId: null,
|
|
21236
21947
|
access: "create"
|
|
21237
21948
|
},
|
|
21949
|
+
"backup.upsertSchedule": {
|
|
21950
|
+
capName: "backup",
|
|
21951
|
+
capScope: "system",
|
|
21952
|
+
addonId: null,
|
|
21953
|
+
access: "create"
|
|
21954
|
+
},
|
|
21238
21955
|
"battery.wakeForStream": {
|
|
21239
21956
|
capName: "battery",
|
|
21240
21957
|
capScope: "device",
|
|
@@ -23263,6 +23980,60 @@ Object.freeze({
|
|
|
23263
23980
|
addonId: null,
|
|
23264
23981
|
access: "create"
|
|
23265
23982
|
},
|
|
23983
|
+
"notificationRules.createRule": {
|
|
23984
|
+
capName: "notification-rules",
|
|
23985
|
+
capScope: "system",
|
|
23986
|
+
addonId: null,
|
|
23987
|
+
access: "create"
|
|
23988
|
+
},
|
|
23989
|
+
"notificationRules.deleteRule": {
|
|
23990
|
+
capName: "notification-rules",
|
|
23991
|
+
capScope: "system",
|
|
23992
|
+
addonId: null,
|
|
23993
|
+
access: "delete"
|
|
23994
|
+
},
|
|
23995
|
+
"notificationRules.getConditionCatalog": {
|
|
23996
|
+
capName: "notification-rules",
|
|
23997
|
+
capScope: "system",
|
|
23998
|
+
addonId: null,
|
|
23999
|
+
access: "view"
|
|
24000
|
+
},
|
|
24001
|
+
"notificationRules.getHistory": {
|
|
24002
|
+
capName: "notification-rules",
|
|
24003
|
+
capScope: "system",
|
|
24004
|
+
addonId: null,
|
|
24005
|
+
access: "view"
|
|
24006
|
+
},
|
|
24007
|
+
"notificationRules.getRule": {
|
|
24008
|
+
capName: "notification-rules",
|
|
24009
|
+
capScope: "system",
|
|
24010
|
+
addonId: null,
|
|
24011
|
+
access: "view"
|
|
24012
|
+
},
|
|
24013
|
+
"notificationRules.listRules": {
|
|
24014
|
+
capName: "notification-rules",
|
|
24015
|
+
capScope: "system",
|
|
24016
|
+
addonId: null,
|
|
24017
|
+
access: "view"
|
|
24018
|
+
},
|
|
24019
|
+
"notificationRules.setRuleEnabled": {
|
|
24020
|
+
capName: "notification-rules",
|
|
24021
|
+
capScope: "system",
|
|
24022
|
+
addonId: null,
|
|
24023
|
+
access: "create"
|
|
24024
|
+
},
|
|
24025
|
+
"notificationRules.testRule": {
|
|
24026
|
+
capName: "notification-rules",
|
|
24027
|
+
capScope: "system",
|
|
24028
|
+
addonId: null,
|
|
24029
|
+
access: "create"
|
|
24030
|
+
},
|
|
24031
|
+
"notificationRules.updateRule": {
|
|
24032
|
+
capName: "notification-rules",
|
|
24033
|
+
capScope: "system",
|
|
24034
|
+
addonId: null,
|
|
24035
|
+
access: "create"
|
|
24036
|
+
},
|
|
23266
24037
|
"notifier.cancel": {
|
|
23267
24038
|
capName: "notifier",
|
|
23268
24039
|
capScope: "device",
|
|
@@ -25015,6 +25786,36 @@ Object.freeze({
|
|
|
25015
25786
|
addonId: null,
|
|
25016
25787
|
access: "create"
|
|
25017
25788
|
},
|
|
25789
|
+
"terminalSession.close": {
|
|
25790
|
+
capName: "terminal-session",
|
|
25791
|
+
capScope: "system",
|
|
25792
|
+
addonId: null,
|
|
25793
|
+
access: "create"
|
|
25794
|
+
},
|
|
25795
|
+
"terminalSession.listProfiles": {
|
|
25796
|
+
capName: "terminal-session",
|
|
25797
|
+
capScope: "system",
|
|
25798
|
+
addonId: null,
|
|
25799
|
+
access: "view"
|
|
25800
|
+
},
|
|
25801
|
+
"terminalSession.listSessions": {
|
|
25802
|
+
capName: "terminal-session",
|
|
25803
|
+
capScope: "system",
|
|
25804
|
+
addonId: null,
|
|
25805
|
+
access: "view"
|
|
25806
|
+
},
|
|
25807
|
+
"terminalSession.openSession": {
|
|
25808
|
+
capName: "terminal-session",
|
|
25809
|
+
capScope: "system",
|
|
25810
|
+
addonId: null,
|
|
25811
|
+
access: "create"
|
|
25812
|
+
},
|
|
25813
|
+
"terminalSession.resize": {
|
|
25814
|
+
capName: "terminal-session",
|
|
25815
|
+
capScope: "system",
|
|
25816
|
+
addonId: null,
|
|
25817
|
+
access: "create"
|
|
25818
|
+
},
|
|
25018
25819
|
"toast.onToast": {
|
|
25019
25820
|
capName: "toast",
|
|
25020
25821
|
capScope: "system",
|