@camstack/addon-export-hap 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/export-hap.addon.js +1911 -1110
- package/dist/export-hap.addon.mjs +1911 -1110
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ import { networkInterfaces } from "node:os";
|
|
|
10
10
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
11
11
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
12
12
|
//#endregion
|
|
13
|
-
//#region ../types/dist/event-category-
|
|
13
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
14
14
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
15
15
|
EventCategory["SystemBoot"] = "system.boot";
|
|
16
16
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -160,9 +160,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
160
160
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
161
161
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
162
162
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
163
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
164
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
165
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
166
163
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
167
164
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
168
165
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -6827,7 +6824,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
|
6827
6824
|
patch: record(string(), unknown())
|
|
6828
6825
|
}), object({ success: literal(true) });
|
|
6829
6826
|
object({ deviceId: number() }), unknown().nullable();
|
|
6830
|
-
/** Shorthand to define a method schema */
|
|
6831
6827
|
function method(input, output, options) {
|
|
6832
6828
|
return {
|
|
6833
6829
|
input,
|
|
@@ -6835,6 +6831,7 @@ function method(input, output, options) {
|
|
|
6835
6831
|
kind: options?.kind ?? "query",
|
|
6836
6832
|
auth: options?.auth ?? "protected",
|
|
6837
6833
|
...options?.access !== void 0 ? { access: options.access } : {},
|
|
6834
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
6838
6835
|
timeoutMs: options?.timeoutMs
|
|
6839
6836
|
};
|
|
6840
6837
|
}
|
|
@@ -7516,16 +7513,23 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7516
7513
|
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7517
7514
|
* FRESH install:
|
|
7518
7515
|
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7519
|
-
* the appData volume. Right for small/durable data (
|
|
7516
|
+
* the appData volume. Right for small/durable data (logs, models).
|
|
7520
7517
|
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7521
7518
|
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7522
7519
|
* (recordings, event media) that should stay off the appData disk.
|
|
7520
|
+
* - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
|
|
7521
|
+
* `/backups` in the image) so archives live on their own mount rather than
|
|
7522
|
+
* filling the appData disk. Falls back to the data root when unset.
|
|
7523
7523
|
*
|
|
7524
7524
|
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7525
7525
|
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7526
7526
|
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7527
7527
|
*/
|
|
7528
|
-
defaultRoot: _enum([
|
|
7528
|
+
defaultRoot: _enum([
|
|
7529
|
+
"data",
|
|
7530
|
+
"media",
|
|
7531
|
+
"backup"
|
|
7532
|
+
]).optional()
|
|
7529
7533
|
});
|
|
7530
7534
|
var DecoderStatsSchema = object({
|
|
7531
7535
|
inputFps: number(),
|
|
@@ -8242,6 +8246,59 @@ for (const l of AUDIO_MACRO_LABELS) {
|
|
|
8242
8246
|
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8243
8247
|
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8244
8248
|
/**
|
|
8249
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8250
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8251
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8252
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8253
|
+
*
|
|
8254
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8255
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8256
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8257
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8258
|
+
* the same class picker, grouped under an Audio header.
|
|
8259
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8260
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8261
|
+
*
|
|
8262
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8263
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8264
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8265
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8266
|
+
*/
|
|
8267
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8268
|
+
var NcTaxonomyEntrySchema = object({
|
|
8269
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8270
|
+
kind: string(),
|
|
8271
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8272
|
+
label: string(),
|
|
8273
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8274
|
+
parentKind: string().nullable()
|
|
8275
|
+
});
|
|
8276
|
+
object({
|
|
8277
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8278
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8279
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8280
|
+
});
|
|
8281
|
+
function toEntry(kind, label, parentKind) {
|
|
8282
|
+
return {
|
|
8283
|
+
kind,
|
|
8284
|
+
label,
|
|
8285
|
+
parentKind
|
|
8286
|
+
};
|
|
8287
|
+
}
|
|
8288
|
+
/**
|
|
8289
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8290
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8291
|
+
*/
|
|
8292
|
+
function buildNcTaxonomy() {
|
|
8293
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8294
|
+
return {
|
|
8295
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8296
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8297
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8298
|
+
};
|
|
8299
|
+
}
|
|
8300
|
+
Object.freeze(buildNcTaxonomy());
|
|
8301
|
+
/**
|
|
8245
8302
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8246
8303
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8247
8304
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -8877,6 +8934,644 @@ var AccessoryKind = {
|
|
|
8877
8934
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
8878
8935
|
DeviceFeature.BatteryOperated;
|
|
8879
8936
|
/**
|
|
8937
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
8938
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
8939
|
+
* language so a single drawing-plane editor and the providers stay
|
|
8940
|
+
* decoupled from each cap's storage.
|
|
8941
|
+
*
|
|
8942
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
8943
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
8944
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
8945
|
+
*/
|
|
8946
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
8947
|
+
var MaskPointSchema = object({
|
|
8948
|
+
x: number(),
|
|
8949
|
+
y: number()
|
|
8950
|
+
});
|
|
8951
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
8952
|
+
var MaskRectShapeSchema = object({
|
|
8953
|
+
kind: literal("rect"),
|
|
8954
|
+
x: number(),
|
|
8955
|
+
y: number(),
|
|
8956
|
+
width: number(),
|
|
8957
|
+
height: number()
|
|
8958
|
+
});
|
|
8959
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
8960
|
+
var MaskPolygonShapeSchema = object({
|
|
8961
|
+
kind: literal("polygon"),
|
|
8962
|
+
points: array(MaskPointSchema)
|
|
8963
|
+
});
|
|
8964
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
8965
|
+
var MaskGridShapeSchema = object({
|
|
8966
|
+
kind: literal("grid"),
|
|
8967
|
+
gridWidth: number(),
|
|
8968
|
+
gridHeight: number(),
|
|
8969
|
+
cells: array(boolean())
|
|
8970
|
+
});
|
|
8971
|
+
discriminatedUnion("kind", [
|
|
8972
|
+
MaskRectShapeSchema,
|
|
8973
|
+
MaskPolygonShapeSchema,
|
|
8974
|
+
MaskGridShapeSchema,
|
|
8975
|
+
object({
|
|
8976
|
+
kind: literal("line"),
|
|
8977
|
+
points: array(MaskPointSchema)
|
|
8978
|
+
})
|
|
8979
|
+
]);
|
|
8980
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
8981
|
+
var MaskShapeKindSchema = _enum([
|
|
8982
|
+
"rect",
|
|
8983
|
+
"polygon",
|
|
8984
|
+
"grid",
|
|
8985
|
+
"line"
|
|
8986
|
+
]);
|
|
8987
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
8988
|
+
var MaskPolygonVerticesSchema = object({
|
|
8989
|
+
min: number(),
|
|
8990
|
+
max: number()
|
|
8991
|
+
});
|
|
8992
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
8993
|
+
var MaskGridDimsSchema = object({
|
|
8994
|
+
width: number(),
|
|
8995
|
+
height: number()
|
|
8996
|
+
});
|
|
8997
|
+
/**
|
|
8998
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
8999
|
+
*
|
|
9000
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
9001
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
9002
|
+
*
|
|
9003
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
9004
|
+
* `notification-center` module), hooked on the durable persistence
|
|
9005
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
9006
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
9007
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
9008
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
9009
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
9010
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
9011
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
9012
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
9013
|
+
* target kind's own caps/degrade engine).
|
|
9014
|
+
*
|
|
9015
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
9016
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
9017
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
9018
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
9019
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
9020
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
9021
|
+
* P2+ (see spec §7).
|
|
9022
|
+
*
|
|
9023
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
9024
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
9025
|
+
* schema/interface drift is explicitly not repeated).
|
|
9026
|
+
*/
|
|
9027
|
+
/**
|
|
9028
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
9029
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
9030
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
9031
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
9032
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
9033
|
+
* change of a LINKED device, one row per linked camera)
|
|
9034
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
9035
|
+
* delivery / pick-up)
|
|
9036
|
+
*
|
|
9037
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
9038
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
9039
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
9040
|
+
* one trigger.
|
|
9041
|
+
*/
|
|
9042
|
+
var NcDeliverySchema = _enum([
|
|
9043
|
+
"immediate",
|
|
9044
|
+
"track-end",
|
|
9045
|
+
"device-event",
|
|
9046
|
+
"package-event"
|
|
9047
|
+
]);
|
|
9048
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
9049
|
+
var NcScheduleSchema = object({
|
|
9050
|
+
windows: array(object({
|
|
9051
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
9052
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
9053
|
+
startMinute: number().int().min(0).max(1439),
|
|
9054
|
+
endMinute: number().int().min(0).max(1439)
|
|
9055
|
+
})).min(1),
|
|
9056
|
+
/** IANA timezone; default = hub host timezone. */
|
|
9057
|
+
timezone: string().optional(),
|
|
9058
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
9059
|
+
invert: boolean().optional()
|
|
9060
|
+
});
|
|
9061
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
9062
|
+
var NcPlateMatcherSchema = object({
|
|
9063
|
+
values: array(string().min(1)).min(1),
|
|
9064
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9065
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9066
|
+
});
|
|
9067
|
+
/**
|
|
9068
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9069
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9070
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9071
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9072
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9073
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9074
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9075
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9076
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9077
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9078
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9079
|
+
*/
|
|
9080
|
+
var NcOccupancyConditionSchema = object({
|
|
9081
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9082
|
+
zoneId: string().optional(),
|
|
9083
|
+
/** Object class to count; absent = any class. */
|
|
9084
|
+
className: string().optional(),
|
|
9085
|
+
op: _enum([
|
|
9086
|
+
"became-occupied",
|
|
9087
|
+
"became-free",
|
|
9088
|
+
">=",
|
|
9089
|
+
"<="
|
|
9090
|
+
]).default("became-occupied"),
|
|
9091
|
+
count: number().int().min(0).default(1),
|
|
9092
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9093
|
+
});
|
|
9094
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9095
|
+
var NcZoneConditionSchema = object({
|
|
9096
|
+
ids: array(string().min(1)).min(1),
|
|
9097
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9098
|
+
match: _enum(["any", "all"]).default("any")
|
|
9099
|
+
});
|
|
9100
|
+
/**
|
|
9101
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9102
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9103
|
+
*/
|
|
9104
|
+
var NcConditionsSchema = object({
|
|
9105
|
+
/** Device scope — absent = all devices. */
|
|
9106
|
+
devices: array(number()).optional(),
|
|
9107
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9108
|
+
classes: array(string().min(1)).optional(),
|
|
9109
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9110
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9111
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9112
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9113
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9114
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9115
|
+
/** Veto zones — any hit fails the rule. */
|
|
9116
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
9117
|
+
/**
|
|
9118
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9119
|
+
* (identity name / plate text / subclass).
|
|
9120
|
+
*/
|
|
9121
|
+
labelEquals: array(string().min(1)).optional(),
|
|
9122
|
+
/**
|
|
9123
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9124
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9125
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
9126
|
+
*/
|
|
9127
|
+
identities: array(string().min(1)).optional(),
|
|
9128
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9129
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
9130
|
+
/**
|
|
9131
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9132
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9133
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9134
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
9135
|
+
*/
|
|
9136
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
9137
|
+
/**
|
|
9138
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9139
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9140
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9141
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9142
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9143
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9144
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9145
|
+
*/
|
|
9146
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9147
|
+
/**
|
|
9148
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9149
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9150
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9151
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9152
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9153
|
+
*/
|
|
9154
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9155
|
+
/**
|
|
9156
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9157
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9158
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9159
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9160
|
+
* tracks carry `sensor`.
|
|
9161
|
+
*/
|
|
9162
|
+
source: _enum([
|
|
9163
|
+
"pipeline",
|
|
9164
|
+
"onboard",
|
|
9165
|
+
"sensor",
|
|
9166
|
+
"any"
|
|
9167
|
+
]).optional(),
|
|
9168
|
+
/**
|
|
9169
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9170
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9171
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9172
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9173
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9174
|
+
*
|
|
9175
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9176
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9177
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9178
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9179
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9180
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9181
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9182
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9183
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9184
|
+
* closed for it (an un-recognized subject).
|
|
9185
|
+
*/
|
|
9186
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9187
|
+
/**
|
|
9188
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9189
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9190
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9191
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9192
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9193
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9194
|
+
*/
|
|
9195
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9196
|
+
/**
|
|
9197
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9198
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9199
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9200
|
+
*/
|
|
9201
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9202
|
+
/**
|
|
9203
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9204
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9205
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9206
|
+
* on the package-event trigger).
|
|
9207
|
+
*/
|
|
9208
|
+
packagePhase: _enum([
|
|
9209
|
+
"delivered",
|
|
9210
|
+
"picked-up",
|
|
9211
|
+
"both"
|
|
9212
|
+
]).optional(),
|
|
9213
|
+
/**
|
|
9214
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9215
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9216
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9217
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9218
|
+
*/
|
|
9219
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9220
|
+
/**
|
|
9221
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9222
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9223
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9224
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9225
|
+
*/
|
|
9226
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9227
|
+
});
|
|
9228
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9229
|
+
var NcRuleTargetSchema = object({
|
|
9230
|
+
/** `notification-output` Target id. */
|
|
9231
|
+
targetId: string().min(1),
|
|
9232
|
+
/**
|
|
9233
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9234
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9235
|
+
* degrade engine drops what the backend can't render.
|
|
9236
|
+
*/
|
|
9237
|
+
params: record(string(), unknown()).optional()
|
|
9238
|
+
});
|
|
9239
|
+
/**
|
|
9240
|
+
* Media attachment policy (P1 still-image subset).
|
|
9241
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9242
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9243
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9244
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9245
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9246
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9247
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9248
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9249
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9250
|
+
* - `none` — no attachment.
|
|
9251
|
+
*/
|
|
9252
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9253
|
+
"best",
|
|
9254
|
+
"best-matching",
|
|
9255
|
+
"keyFrame",
|
|
9256
|
+
"none"
|
|
9257
|
+
]).default("best") });
|
|
9258
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9259
|
+
var NcThrottleSchema = object({
|
|
9260
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9261
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9262
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9263
|
+
});
|
|
9264
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9265
|
+
var NcRuleInputSchema = object({
|
|
9266
|
+
name: string().min(1).max(200),
|
|
9267
|
+
enabled: boolean().default(true),
|
|
9268
|
+
delivery: NcDeliverySchema,
|
|
9269
|
+
conditions: NcConditionsSchema.default({}),
|
|
9270
|
+
schedule: NcScheduleSchema.optional(),
|
|
9271
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9272
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9273
|
+
throttle: NcThrottleSchema.default({
|
|
9274
|
+
cooldownSec: 60,
|
|
9275
|
+
scope: "rule-device"
|
|
9276
|
+
}),
|
|
9277
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9278
|
+
template: object({
|
|
9279
|
+
title: string().max(500).optional(),
|
|
9280
|
+
body: string().max(2e3).optional()
|
|
9281
|
+
}).optional(),
|
|
9282
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9283
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9284
|
+
/**
|
|
9285
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9286
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9287
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9288
|
+
*/
|
|
9289
|
+
ownerUserId: string().optional()
|
|
9290
|
+
});
|
|
9291
|
+
/**
|
|
9292
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9293
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9294
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9295
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9296
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9297
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9298
|
+
* `updateRule` patch.
|
|
9299
|
+
*/
|
|
9300
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9301
|
+
/** A persisted rule. */
|
|
9302
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9303
|
+
id: string(),
|
|
9304
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9305
|
+
createdBy: string(),
|
|
9306
|
+
createdAt: number(),
|
|
9307
|
+
updatedAt: number(),
|
|
9308
|
+
/**
|
|
9309
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9310
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9311
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9312
|
+
*/
|
|
9313
|
+
disabledTargetIds: array(string()).default([])
|
|
9314
|
+
});
|
|
9315
|
+
var NcTestResultSchema = object({
|
|
9316
|
+
recordId: string(),
|
|
9317
|
+
recordKind: _enum([
|
|
9318
|
+
"object-event",
|
|
9319
|
+
"track",
|
|
9320
|
+
"device-event",
|
|
9321
|
+
"package-event"
|
|
9322
|
+
]),
|
|
9323
|
+
deviceId: number(),
|
|
9324
|
+
timestamp: number(),
|
|
9325
|
+
wouldFire: boolean(),
|
|
9326
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9327
|
+
failedCondition: string().optional(),
|
|
9328
|
+
className: string().optional(),
|
|
9329
|
+
label: string().optional()
|
|
9330
|
+
});
|
|
9331
|
+
var NcConditionDescriptorSchema = object({
|
|
9332
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9333
|
+
id: string(),
|
|
9334
|
+
group: _enum([
|
|
9335
|
+
"scope",
|
|
9336
|
+
"class",
|
|
9337
|
+
"zones",
|
|
9338
|
+
"quality",
|
|
9339
|
+
"label",
|
|
9340
|
+
"schedule",
|
|
9341
|
+
"device",
|
|
9342
|
+
"package",
|
|
9343
|
+
"occupancy"
|
|
9344
|
+
]),
|
|
9345
|
+
label: string(),
|
|
9346
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9347
|
+
valueType: _enum([
|
|
9348
|
+
"deviceIdList",
|
|
9349
|
+
"stringList",
|
|
9350
|
+
"number01",
|
|
9351
|
+
"number",
|
|
9352
|
+
"sourceSelect",
|
|
9353
|
+
"zoneSelection",
|
|
9354
|
+
"zoneIdList",
|
|
9355
|
+
"schedule",
|
|
9356
|
+
"plateMatcher",
|
|
9357
|
+
"packagePhase",
|
|
9358
|
+
"polygonDraw",
|
|
9359
|
+
"occupancy"
|
|
9360
|
+
]),
|
|
9361
|
+
operator: _enum([
|
|
9362
|
+
"in",
|
|
9363
|
+
"notIn",
|
|
9364
|
+
"anyOf",
|
|
9365
|
+
"allOf",
|
|
9366
|
+
"gte",
|
|
9367
|
+
"fuzzyIn",
|
|
9368
|
+
"withinSchedule"
|
|
9369
|
+
]),
|
|
9370
|
+
/** Which delivery kinds the condition applies to. */
|
|
9371
|
+
appliesTo: array(NcDeliverySchema),
|
|
9372
|
+
phase: string(),
|
|
9373
|
+
description: string().optional()
|
|
9374
|
+
});
|
|
9375
|
+
/**
|
|
9376
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9377
|
+
* durable outbox row's own status (single source of truth):
|
|
9378
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9379
|
+
* - `sent` — delivered (terminal)
|
|
9380
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9381
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9382
|
+
* the failure `error`)
|
|
9383
|
+
*
|
|
9384
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9385
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9386
|
+
*/
|
|
9387
|
+
var NcHistoryStatusSchema = _enum([
|
|
9388
|
+
"pending",
|
|
9389
|
+
"sent",
|
|
9390
|
+
"dead"
|
|
9391
|
+
]);
|
|
9392
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9393
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9394
|
+
"object-event",
|
|
9395
|
+
"track-end",
|
|
9396
|
+
"device-event",
|
|
9397
|
+
"package-event"
|
|
9398
|
+
]);
|
|
9399
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9400
|
+
var NcHistorySubjectSchema = object({
|
|
9401
|
+
className: string(),
|
|
9402
|
+
label: string().optional(),
|
|
9403
|
+
confidence: number().optional(),
|
|
9404
|
+
zones: array(string()),
|
|
9405
|
+
timestamp: number()
|
|
9406
|
+
});
|
|
9407
|
+
/**
|
|
9408
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9409
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9410
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9411
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9412
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9413
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9414
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9415
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9416
|
+
* P1 (admin scope only).
|
|
9417
|
+
*/
|
|
9418
|
+
var NcHistoryEntrySchema = object({
|
|
9419
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9420
|
+
id: string(),
|
|
9421
|
+
ruleId: string(),
|
|
9422
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9423
|
+
ruleName: string(),
|
|
9424
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9425
|
+
delivery: NcDeliverySchema,
|
|
9426
|
+
targetId: string(),
|
|
9427
|
+
deviceId: number(),
|
|
9428
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9429
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9430
|
+
recordId: string(),
|
|
9431
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9432
|
+
trackId: string().optional(),
|
|
9433
|
+
status: NcHistoryStatusSchema,
|
|
9434
|
+
/** Delivery attempts made so far. */
|
|
9435
|
+
attempts: number().int(),
|
|
9436
|
+
/** Fire time (outbox enqueue). */
|
|
9437
|
+
createdAt: number(),
|
|
9438
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9439
|
+
updatedAt: number(),
|
|
9440
|
+
/** Failure detail — present on a `dead` row. */
|
|
9441
|
+
error: string().optional(),
|
|
9442
|
+
subject: NcHistorySubjectSchema
|
|
9443
|
+
});
|
|
9444
|
+
/**
|
|
9445
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9446
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9447
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9448
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9449
|
+
*/
|
|
9450
|
+
var NcHistoryFilterSchema = object({
|
|
9451
|
+
ruleId: string().optional(),
|
|
9452
|
+
deviceId: number().optional(),
|
|
9453
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9454
|
+
since: number().optional(),
|
|
9455
|
+
until: number().optional(),
|
|
9456
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9457
|
+
});
|
|
9458
|
+
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 }), {
|
|
9459
|
+
kind: "mutation",
|
|
9460
|
+
auth: "admin",
|
|
9461
|
+
caller: "required"
|
|
9462
|
+
}), method(object({
|
|
9463
|
+
ruleId: string(),
|
|
9464
|
+
patch: NcRulePatchSchema
|
|
9465
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9466
|
+
kind: "mutation",
|
|
9467
|
+
auth: "admin",
|
|
9468
|
+
caller: "required"
|
|
9469
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9470
|
+
kind: "mutation",
|
|
9471
|
+
auth: "admin"
|
|
9472
|
+
}), method(object({
|
|
9473
|
+
ruleId: string(),
|
|
9474
|
+
enabled: boolean()
|
|
9475
|
+
}), object({ success: literal(true) }), {
|
|
9476
|
+
kind: "mutation",
|
|
9477
|
+
auth: "admin"
|
|
9478
|
+
}), method(object({
|
|
9479
|
+
rule: NcRuleInputSchema,
|
|
9480
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9481
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9482
|
+
kind: "mutation",
|
|
9483
|
+
auth: "admin"
|
|
9484
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9485
|
+
/**
|
|
9486
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9487
|
+
*
|
|
9488
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
9489
|
+
* §3.2/§3.3.
|
|
9490
|
+
*
|
|
9491
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
9492
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
9493
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
9494
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
9495
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
9496
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
9497
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
9498
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
9499
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
9500
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
9501
|
+
*
|
|
9502
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
9503
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
9504
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
9505
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
9506
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
9507
|
+
*/
|
|
9508
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
9509
|
+
var TimelapseTemplateSchema = object({
|
|
9510
|
+
title: string().max(500).optional(),
|
|
9511
|
+
body: string().max(2e3).optional()
|
|
9512
|
+
});
|
|
9513
|
+
var NameField = string().min(1).max(200);
|
|
9514
|
+
var DeviceIdsField = array(number()).min(1);
|
|
9515
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
9516
|
+
var FramerateField = number().int().min(1).max(60);
|
|
9517
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
9518
|
+
var PriorityField = number().int().min(1).max(5);
|
|
9519
|
+
/**
|
|
9520
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
9521
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
9522
|
+
* here (see the ownership note above).
|
|
9523
|
+
*/
|
|
9524
|
+
var TimelapseRuleInputSchema = object({
|
|
9525
|
+
name: NameField,
|
|
9526
|
+
enabled: boolean().default(true),
|
|
9527
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
9528
|
+
deviceIds: DeviceIdsField,
|
|
9529
|
+
/**
|
|
9530
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
9531
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
9532
|
+
* open clears the scratch, close assembles and delivers.
|
|
9533
|
+
*/
|
|
9534
|
+
schedule: NcScheduleSchema,
|
|
9535
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
9536
|
+
cadenceSec: CadenceSecField.default(15),
|
|
9537
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
9538
|
+
framerate: FramerateField.default(10),
|
|
9539
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
9540
|
+
targets: TargetsField,
|
|
9541
|
+
template: TimelapseTemplateSchema.optional(),
|
|
9542
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9543
|
+
priority: PriorityField.default(3)
|
|
9544
|
+
});
|
|
9545
|
+
object({
|
|
9546
|
+
name: NameField.optional(),
|
|
9547
|
+
enabled: boolean().optional(),
|
|
9548
|
+
deviceIds: DeviceIdsField.optional(),
|
|
9549
|
+
schedule: NcScheduleSchema.optional(),
|
|
9550
|
+
cadenceSec: CadenceSecField.optional(),
|
|
9551
|
+
framerate: FramerateField.optional(),
|
|
9552
|
+
targets: TargetsField.optional(),
|
|
9553
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
9554
|
+
priority: PriorityField.optional()
|
|
9555
|
+
});
|
|
9556
|
+
TimelapseRuleInputSchema.extend({
|
|
9557
|
+
id: string(),
|
|
9558
|
+
/**
|
|
9559
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
9560
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
9561
|
+
* resolved caller; never trusted from a client payload.
|
|
9562
|
+
*/
|
|
9563
|
+
ownerUserId: string().optional(),
|
|
9564
|
+
/**
|
|
9565
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
9566
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
9567
|
+
*/
|
|
9568
|
+
lastGeneratedAt: number().optional(),
|
|
9569
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
9570
|
+
createdBy: string(),
|
|
9571
|
+
createdAt: number(),
|
|
9572
|
+
updatedAt: number()
|
|
9573
|
+
});
|
|
9574
|
+
/**
|
|
8880
9575
|
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
8881
9576
|
* for every device, regardless of provider — the kernel needs a uniform
|
|
8882
9577
|
* cap-keyed slice for the basic device flags every consumer expects to
|
|
@@ -10950,6 +11645,22 @@ var CameraMetricsSchema = object({
|
|
|
10950
11645
|
])
|
|
10951
11646
|
});
|
|
10952
11647
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
11648
|
+
/**
|
|
11649
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
11650
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
11651
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
11652
|
+
*/
|
|
11653
|
+
var NativeCropRefSchema = object({
|
|
11654
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
11655
|
+
handle: FrameHandleSchema,
|
|
11656
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
11657
|
+
cropFrameSpace: object({
|
|
11658
|
+
x: number(),
|
|
11659
|
+
y: number(),
|
|
11660
|
+
w: number(),
|
|
11661
|
+
h: number()
|
|
11662
|
+
})
|
|
11663
|
+
});
|
|
10953
11664
|
var ModelFormatSchema$1 = _enum([
|
|
10954
11665
|
"onnx",
|
|
10955
11666
|
"coreml",
|
|
@@ -11225,7 +11936,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
11225
11936
|
* Omitted ⇒ the runner's default device (current single-engine
|
|
11226
11937
|
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
11227
11938
|
*/
|
|
11228
|
-
deviceKey: string().optional()
|
|
11939
|
+
deviceKey: string().optional(),
|
|
11940
|
+
/**
|
|
11941
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
11942
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
11943
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
11944
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
11945
|
+
* resolution from that surface — the SAME quality path faces already
|
|
11946
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
11947
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
11948
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
11949
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
11950
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
11951
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
11952
|
+
* (today's behaviour on the fallback path).
|
|
11953
|
+
*/
|
|
11954
|
+
nativeCropRef: NativeCropRefSchema.optional()
|
|
11229
11955
|
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
11230
11956
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
11231
11957
|
steps: array(PipelineStepInputSchema).min(1),
|
|
@@ -11441,7 +12167,11 @@ var DetailResultSchema = object({
|
|
|
11441
12167
|
bbox: NativeCropBboxSchema.optional(),
|
|
11442
12168
|
embedding: string().optional(),
|
|
11443
12169
|
label: string().optional(),
|
|
11444
|
-
alignedCropJpeg: string().optional()
|
|
12170
|
+
alignedCropJpeg: string().optional(),
|
|
12171
|
+
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
12172
|
+
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
12173
|
+
* consumers MUST prefer this when present (2026-07-22 native-gate fix). */
|
|
12174
|
+
nativeFaceShortSidePx: number().optional()
|
|
11445
12175
|
});
|
|
11446
12176
|
/**
|
|
11447
12177
|
* Per-camera tunable ranges + defaults. Single source of truth used
|
|
@@ -11455,6 +12185,12 @@ var motionCooldownMsField = {
|
|
|
11455
12185
|
default: 3e4,
|
|
11456
12186
|
step: 500
|
|
11457
12187
|
};
|
|
12188
|
+
var maxSessionHoldMsField = {
|
|
12189
|
+
min: 0,
|
|
12190
|
+
max: 6e5,
|
|
12191
|
+
default: 12e4,
|
|
12192
|
+
step: 5e3
|
|
12193
|
+
};
|
|
11458
12194
|
var motionFpsField = {
|
|
11459
12195
|
min: 1,
|
|
11460
12196
|
max: 30,
|
|
@@ -11602,6 +12338,19 @@ var RunnerCameraConfigSchema = object({
|
|
|
11602
12338
|
"on-motion"
|
|
11603
12339
|
]).default("always-on"),
|
|
11604
12340
|
motionCooldownMs: number().min(motionCooldownMsField.min).default(motionCooldownMsField.default),
|
|
12341
|
+
/**
|
|
12342
|
+
* Orchestrator-side on-motion session-hold cap (ms). While an on-motion
|
|
12343
|
+
* detection session is active and ≥1 confirmed non-stationary track is
|
|
12344
|
+
* still live, the orchestrator keeps the session open past
|
|
12345
|
+
* `motionCooldownMs` (a slowly-moving subject can stop re-triggering the
|
|
12346
|
+
* camera's VMD yet is still being tracked frame-to-frame) — up to this many
|
|
12347
|
+
* ms since the session opened, after which it closes regardless. `0`
|
|
12348
|
+
* disables the hold (legacy cooldown-only teardown). Not consumed by the
|
|
12349
|
+
* runner itself — carried here so it shares the per-camera device-settings
|
|
12350
|
+
* surface with `motionCooldownMs`; the orchestrator reads it off the
|
|
12351
|
+
* resolved `CameraDetectionConfig`.
|
|
12352
|
+
*/
|
|
12353
|
+
maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
|
|
11605
12354
|
motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
|
|
11606
12355
|
detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
|
|
11607
12356
|
motionStreamId: string(),
|
|
@@ -11691,7 +12440,7 @@ var RunnerCameraConfigSchema = object({
|
|
|
11691
12440
|
*/
|
|
11692
12441
|
inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
|
|
11693
12442
|
});
|
|
11694
|
-
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;
|
|
12443
|
+
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;
|
|
11695
12444
|
/**
|
|
11696
12445
|
* Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
|
|
11697
12446
|
* load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
|
|
@@ -11802,71 +12551,10 @@ DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
|
11802
12551
|
lastChangedAt: number()
|
|
11803
12552
|
});
|
|
11804
12553
|
/**
|
|
11805
|
-
*
|
|
11806
|
-
* motion-
|
|
11807
|
-
*
|
|
11808
|
-
*
|
|
11809
|
-
*
|
|
11810
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
11811
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
11812
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
11813
|
-
*/
|
|
11814
|
-
/** A normalized 0..1 point (top-left origin). */
|
|
11815
|
-
var MaskPointSchema = object({
|
|
11816
|
-
x: number(),
|
|
11817
|
-
y: number()
|
|
11818
|
-
});
|
|
11819
|
-
/** Axis-aligned rectangle (normalized 0..1). */
|
|
11820
|
-
var MaskRectShapeSchema = object({
|
|
11821
|
-
kind: literal("rect"),
|
|
11822
|
-
x: number(),
|
|
11823
|
-
y: number(),
|
|
11824
|
-
width: number(),
|
|
11825
|
-
height: number()
|
|
11826
|
-
});
|
|
11827
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
11828
|
-
var MaskPolygonShapeSchema = object({
|
|
11829
|
-
kind: literal("polygon"),
|
|
11830
|
-
points: array(MaskPointSchema)
|
|
11831
|
-
});
|
|
11832
|
-
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
11833
|
-
var MaskGridShapeSchema = object({
|
|
11834
|
-
kind: literal("grid"),
|
|
11835
|
-
gridWidth: number(),
|
|
11836
|
-
gridHeight: number(),
|
|
11837
|
-
cells: array(boolean())
|
|
11838
|
-
});
|
|
11839
|
-
discriminatedUnion("kind", [
|
|
11840
|
-
MaskRectShapeSchema,
|
|
11841
|
-
MaskPolygonShapeSchema,
|
|
11842
|
-
MaskGridShapeSchema,
|
|
11843
|
-
object({
|
|
11844
|
-
kind: literal("line"),
|
|
11845
|
-
points: array(MaskPointSchema)
|
|
11846
|
-
})
|
|
11847
|
-
]);
|
|
11848
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
11849
|
-
var MaskShapeKindSchema = _enum([
|
|
11850
|
-
"rect",
|
|
11851
|
-
"polygon",
|
|
11852
|
-
"grid",
|
|
11853
|
-
"line"
|
|
11854
|
-
]);
|
|
11855
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
11856
|
-
var MaskPolygonVerticesSchema = object({
|
|
11857
|
-
min: number(),
|
|
11858
|
-
max: number()
|
|
11859
|
-
});
|
|
11860
|
-
/** Grid dimensions when a cap supports 'grid'. */
|
|
11861
|
-
var MaskGridDimsSchema = object({
|
|
11862
|
-
width: number(),
|
|
11863
|
-
height: number()
|
|
11864
|
-
});
|
|
11865
|
-
/**
|
|
11866
|
-
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
11867
|
-
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
11868
|
-
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
11869
|
-
* a region keeps one drawing-plane model across all geometry caps.
|
|
12554
|
+
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
12555
|
+
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
12556
|
+
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
12557
|
+
* a region keeps one drawing-plane model across all geometry caps.
|
|
11870
12558
|
*/
|
|
11871
12559
|
/** A motion-zone region — exactly one boolean cell grid today. */
|
|
11872
12560
|
var MotionZoneRegionSchema = object({
|
|
@@ -13545,94 +14233,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
13545
14233
|
bundleUrl: string()
|
|
13546
14234
|
});
|
|
13547
14235
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
13548
|
-
var NotificationRuleConditionsSchema = object({
|
|
13549
|
-
deviceIds: array(number()).readonly().optional(),
|
|
13550
|
-
classNames: array(string()).readonly().optional(),
|
|
13551
|
-
zoneIds: array(string()).readonly().optional(),
|
|
13552
|
-
minConfidence: number().optional(),
|
|
13553
|
-
source: _enum([
|
|
13554
|
-
"pipeline",
|
|
13555
|
-
"onboard",
|
|
13556
|
-
"any"
|
|
13557
|
-
]).optional(),
|
|
13558
|
-
schedule: object({
|
|
13559
|
-
days: array(number()).readonly(),
|
|
13560
|
-
startHour: number(),
|
|
13561
|
-
endHour: number()
|
|
13562
|
-
}).optional(),
|
|
13563
|
-
cooldownSeconds: number().optional(),
|
|
13564
|
-
minDwellSeconds: number().optional(),
|
|
13565
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
13566
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
13567
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
13568
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
13569
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
13570
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
13571
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
13572
|
-
clipDescription: object({
|
|
13573
|
-
text: string().min(1),
|
|
13574
|
-
minSimilarity: number().min(0).max(1)
|
|
13575
|
-
}).optional(),
|
|
13576
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
13577
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
13578
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
13579
|
-
* vehicle/person> is seen". */
|
|
13580
|
-
labels: array(string()).readonly().optional()
|
|
13581
|
-
});
|
|
13582
|
-
var NotificationRuleTemplateSchema = object({
|
|
13583
|
-
title: string(),
|
|
13584
|
-
body: string(),
|
|
13585
|
-
imageMode: _enum([
|
|
13586
|
-
"crop",
|
|
13587
|
-
"annotated",
|
|
13588
|
-
"full",
|
|
13589
|
-
"none"
|
|
13590
|
-
])
|
|
13591
|
-
});
|
|
13592
|
-
var NotificationRuleSchema = object({
|
|
13593
|
-
id: string(),
|
|
13594
|
-
name: string(),
|
|
13595
|
-
enabled: boolean(),
|
|
13596
|
-
eventTypes: array(string()).readonly(),
|
|
13597
|
-
conditions: NotificationRuleConditionsSchema,
|
|
13598
|
-
outputs: array(string()).readonly(),
|
|
13599
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
13600
|
-
priority: _enum([
|
|
13601
|
-
"low",
|
|
13602
|
-
"normal",
|
|
13603
|
-
"high",
|
|
13604
|
-
"critical"
|
|
13605
|
-
])
|
|
13606
|
-
});
|
|
13607
|
-
var NotificationTestResultSchema = object({
|
|
13608
|
-
ruleId: string(),
|
|
13609
|
-
eventId: string(),
|
|
13610
|
-
timestamp: number(),
|
|
13611
|
-
wouldFire: boolean(),
|
|
13612
|
-
reason: string().optional()
|
|
13613
|
-
});
|
|
13614
|
-
var NotificationHistoryEntrySchema = object({
|
|
13615
|
-
id: string(),
|
|
13616
|
-
ruleId: string(),
|
|
13617
|
-
ruleName: string(),
|
|
13618
|
-
eventId: string(),
|
|
13619
|
-
timestamp: number(),
|
|
13620
|
-
outputs: array(string()).readonly(),
|
|
13621
|
-
success: boolean(),
|
|
13622
|
-
error: string().optional(),
|
|
13623
|
-
deviceId: number().optional()
|
|
13624
|
-
});
|
|
13625
|
-
var NotificationHistoryFilterSchema = object({
|
|
13626
|
-
ruleId: string().optional(),
|
|
13627
|
-
deviceId: number().optional(),
|
|
13628
|
-
from: number().optional(),
|
|
13629
|
-
to: number().optional(),
|
|
13630
|
-
limit: number().optional()
|
|
13631
|
-
});
|
|
13632
|
-
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({
|
|
13633
|
-
ruleId: string(),
|
|
13634
|
-
lookbackMinutes: number()
|
|
13635
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
13636
14236
|
/**
|
|
13637
14237
|
* Alerts capability — collection-based internal alert system.
|
|
13638
14238
|
*
|
|
@@ -13819,88 +14419,54 @@ method(object({
|
|
|
13819
14419
|
password: string()
|
|
13820
14420
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
13821
14421
|
/**
|
|
13822
|
-
*
|
|
13823
|
-
*
|
|
13824
|
-
*
|
|
13825
|
-
*
|
|
13826
|
-
*
|
|
13827
|
-
*
|
|
13828
|
-
*
|
|
13829
|
-
* A contribution is a discriminated union on `kind`:
|
|
13830
|
-
*
|
|
13831
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
13832
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
13833
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
13834
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
13835
|
-
* login page needs NO change.
|
|
13836
|
-
*
|
|
13837
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
13838
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
13839
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
13840
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
13841
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
13842
|
-
*
|
|
13843
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
13844
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
13845
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
13846
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
13847
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
13848
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
13849
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
13850
|
-
* decision.
|
|
13851
|
-
*
|
|
13852
|
-
* Every contribution carries a `stage`:
|
|
13853
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
13854
|
-
* magic-link buttons; a future usernameless passkey).
|
|
13855
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
13856
|
-
* returned `factors` (passkey-as-2FA today).
|
|
13857
|
-
*
|
|
13858
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
13859
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
13860
|
-
* tRPC router.
|
|
14422
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
14423
|
+
* NOT flow through the capability — they use the addon data plane
|
|
14424
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
14425
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
14426
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
14427
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
13861
14428
|
*/
|
|
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
|
-
|
|
13892
|
-
|
|
13893
|
-
|
|
13894
|
-
|
|
13895
|
-
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
14429
|
+
var TerminalSessionInfoSchema = object({
|
|
14430
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
14431
|
+
sessionId: string(),
|
|
14432
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
14433
|
+
profileId: string(),
|
|
14434
|
+
/** Human-readable profile label for the UI session list. */
|
|
14435
|
+
label: string(),
|
|
14436
|
+
cols: number().int().positive(),
|
|
14437
|
+
rows: number().int().positive(),
|
|
14438
|
+
/** ms-epoch the session's pty was spawned. */
|
|
14439
|
+
startedAt: number()
|
|
14440
|
+
});
|
|
14441
|
+
/**
|
|
14442
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
14443
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
14444
|
+
* command string would be remote code execution as the server's user, so it is
|
|
14445
|
+
* deliberately not part of the contract.
|
|
14446
|
+
*/
|
|
14447
|
+
var TerminalProfileInfoSchema = object({
|
|
14448
|
+
profileId: string(),
|
|
14449
|
+
label: string(),
|
|
14450
|
+
description: string().optional()
|
|
14451
|
+
});
|
|
14452
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
14453
|
+
profileId: string(),
|
|
14454
|
+
cols: number().int().positive(),
|
|
14455
|
+
rows: number().int().positive()
|
|
14456
|
+
}), TerminalSessionInfoSchema, {
|
|
14457
|
+
kind: "mutation",
|
|
14458
|
+
auth: "admin"
|
|
14459
|
+
}), method(object({
|
|
14460
|
+
sessionId: string(),
|
|
14461
|
+
cols: number().int().positive(),
|
|
14462
|
+
rows: number().int().positive()
|
|
14463
|
+
}), _void(), {
|
|
14464
|
+
kind: "mutation",
|
|
14465
|
+
auth: "admin"
|
|
14466
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
14467
|
+
kind: "mutation",
|
|
14468
|
+
auth: "admin"
|
|
14469
|
+
});
|
|
13904
14470
|
/**
|
|
13905
14471
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
13906
14472
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
@@ -14002,11 +14568,53 @@ var LocationStatSchema = object({
|
|
|
14002
14568
|
fileCount: number(),
|
|
14003
14569
|
present: boolean()
|
|
14004
14570
|
});
|
|
14571
|
+
/**
|
|
14572
|
+
* A backup schedule — the N:M "entry" that binds one cron cadence to a
|
|
14573
|
+
* SET of destination locations. Supersedes the per-location cron on
|
|
14574
|
+
* `BackupDestinationPolicy`: an operator creates a schedule, picks the
|
|
14575
|
+
* `backups` locations it should write to, and the orchestrator fans a
|
|
14576
|
+
* single archive out to all of them when the cron fires.
|
|
14577
|
+
*
|
|
14578
|
+
* `retentionCount` is per-schedule (D-decision 2026-07-28): every
|
|
14579
|
+
* location targeted by this schedule keeps this many archives from
|
|
14580
|
+
* this schedule's runs.
|
|
14581
|
+
*
|
|
14582
|
+
* `dataSources` optionally narrows which top-level state locations
|
|
14583
|
+
* (db, addons, tls, …) are archived; omitted = the orchestrator's
|
|
14584
|
+
* default full set.
|
|
14585
|
+
*/
|
|
14586
|
+
var BackupScheduleSchema = object({
|
|
14587
|
+
/** Stable id. Generated by the orchestrator on first upsert if absent. */
|
|
14588
|
+
id: string(),
|
|
14589
|
+
/** Operator-facing display name. */
|
|
14590
|
+
label: string(),
|
|
14591
|
+
/** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
|
|
14592
|
+
cron: string(),
|
|
14593
|
+
/** Master on/off toggle for the whole schedule. */
|
|
14594
|
+
enabled: boolean(),
|
|
14595
|
+
/** `backups`-location ids this schedule writes to (fan-out set). */
|
|
14596
|
+
locationIds: array(string()).readonly(),
|
|
14597
|
+
/** Archives kept per targeted location for this schedule. */
|
|
14598
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14599
|
+
/** Optional subset of source locations to include; omitted = all. */
|
|
14600
|
+
dataSources: array(string()).readonly().optional(),
|
|
14601
|
+
/** ms-epoch of last successful run. */
|
|
14602
|
+
lastRunAt: number().optional(),
|
|
14603
|
+
/** ms-epoch of next computed firing (read-only, filled on list). */
|
|
14604
|
+
nextRunAt: number().optional()
|
|
14605
|
+
});
|
|
14005
14606
|
method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
14006
14607
|
/** Subset of registered `backup-destination` addon ids to write to. */
|
|
14007
14608
|
destinations: array(string()).optional(),
|
|
14008
14609
|
locations: array(string()).optional(),
|
|
14009
|
-
label: string().optional()
|
|
14610
|
+
label: string().optional(),
|
|
14611
|
+
/**
|
|
14612
|
+
* Per-run retention override applied to every targeted
|
|
14613
|
+
* destination. Used by schedule-driven runs (per-entry
|
|
14614
|
+
* retention). Omitted = each destination's own policy
|
|
14615
|
+
* retention (manual runs).
|
|
14616
|
+
*/
|
|
14617
|
+
retentionCount: number().int().min(1).max(1e3).optional()
|
|
14010
14618
|
}).optional(), array(BackupEntrySchema).readonly(), {
|
|
14011
14619
|
kind: "mutation",
|
|
14012
14620
|
auth: "admin"
|
|
@@ -14055,7 +14663,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
14055
14663
|
ok: boolean(),
|
|
14056
14664
|
error: string().optional(),
|
|
14057
14665
|
nextRuns: array(number()).readonly()
|
|
14058
|
-
}))
|
|
14666
|
+
})), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
|
|
14667
|
+
id: string().optional(),
|
|
14668
|
+
label: string(),
|
|
14669
|
+
cron: string(),
|
|
14670
|
+
enabled: boolean(),
|
|
14671
|
+
locationIds: array(string()).readonly(),
|
|
14672
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14673
|
+
dataSources: array(string()).readonly().optional()
|
|
14674
|
+
}), BackupScheduleSchema, {
|
|
14675
|
+
kind: "mutation",
|
|
14676
|
+
auth: "admin"
|
|
14677
|
+
}), method(object({ id: string() }), _void(), {
|
|
14678
|
+
kind: "mutation",
|
|
14679
|
+
auth: "admin"
|
|
14680
|
+
});
|
|
14059
14681
|
/**
|
|
14060
14682
|
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
14061
14683
|
*
|
|
@@ -15270,851 +15892,934 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
15270
15892
|
kind: "mutation",
|
|
15271
15893
|
auth: "admin"
|
|
15272
15894
|
});
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
tags: record(string(), string()).optional()
|
|
15895
|
+
/**
|
|
15896
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15897
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15898
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
15899
|
+
*
|
|
15900
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15901
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
15902
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15903
|
+
*/
|
|
15904
|
+
var LlmUsageSchema = object({
|
|
15905
|
+
inputTokens: number(),
|
|
15906
|
+
outputTokens: number()
|
|
15286
15907
|
});
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
|
|
15295
|
-
|
|
15296
|
-
|
|
15297
|
-
|
|
15298
|
-
|
|
15299
|
-
|
|
15300
|
-
|
|
15301
|
-
loadAvg: tuple([
|
|
15302
|
-
number(),
|
|
15303
|
-
number(),
|
|
15304
|
-
number()
|
|
15305
|
-
]),
|
|
15306
|
-
cores: number()
|
|
15307
|
-
});
|
|
15308
|
-
var MemoryInfoSchema = object({
|
|
15309
|
-
percent: number(),
|
|
15310
|
-
totalBytes: number(),
|
|
15311
|
-
usedBytes: number(),
|
|
15312
|
-
availableBytes: number(),
|
|
15313
|
-
swapUsedBytes: number(),
|
|
15314
|
-
swapTotalBytes: number()
|
|
15315
|
-
});
|
|
15316
|
-
var DiskIoSnapshotSchema = object({
|
|
15317
|
-
readBytes: number(),
|
|
15318
|
-
writeBytes: number(),
|
|
15319
|
-
readOps: number(),
|
|
15320
|
-
writeOps: number(),
|
|
15321
|
-
timestampMs: number()
|
|
15322
|
-
});
|
|
15323
|
-
var NetworkIoSnapshotSchema = object({
|
|
15324
|
-
rxBytes: number(),
|
|
15325
|
-
txBytes: number(),
|
|
15326
|
-
rxPackets: number(),
|
|
15327
|
-
txPackets: number(),
|
|
15328
|
-
rxErrors: number(),
|
|
15329
|
-
txErrors: number(),
|
|
15330
|
-
timestampMs: number()
|
|
15331
|
-
});
|
|
15332
|
-
var MetricsGpuInfoSchema = object({
|
|
15333
|
-
utilization: number(),
|
|
15908
|
+
var LlmErrorCodeSchema = _enum([
|
|
15909
|
+
"timeout",
|
|
15910
|
+
"rate-limited",
|
|
15911
|
+
"auth",
|
|
15912
|
+
"refusal",
|
|
15913
|
+
"bad-request",
|
|
15914
|
+
"unavailable",
|
|
15915
|
+
"no-profile",
|
|
15916
|
+
"budget-exceeded",
|
|
15917
|
+
"adapter-error"
|
|
15918
|
+
]);
|
|
15919
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15920
|
+
ok: literal(true),
|
|
15921
|
+
text: string(),
|
|
15334
15922
|
model: string(),
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
})
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15923
|
+
usage: LlmUsageSchema,
|
|
15924
|
+
truncated: boolean(),
|
|
15925
|
+
latencyMs: number()
|
|
15926
|
+
}), object({
|
|
15927
|
+
ok: literal(false),
|
|
15928
|
+
code: LlmErrorCodeSchema,
|
|
15929
|
+
message: string(),
|
|
15930
|
+
retryAfterMs: number().optional()
|
|
15931
|
+
})]);
|
|
15932
|
+
/**
|
|
15933
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15934
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15935
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
15936
|
+
*/
|
|
15937
|
+
var LlmImageSchema = object({
|
|
15938
|
+
bytes: _instanceof(Uint8Array),
|
|
15939
|
+
mimeType: string()
|
|
15349
15940
|
});
|
|
15350
|
-
var
|
|
15351
|
-
|
|
15352
|
-
|
|
15941
|
+
var LlmGenerateBaseInputSchema = object({
|
|
15942
|
+
/** Collection routing (the notification-output posture). */
|
|
15943
|
+
addonId: string().optional(),
|
|
15944
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15945
|
+
profileId: string().optional(),
|
|
15946
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15947
|
+
consumer: string(),
|
|
15948
|
+
system: string().optional(),
|
|
15949
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15950
|
+
prompt: string(),
|
|
15951
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15952
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
15953
|
+
/** Per-call override of the profile default. */
|
|
15954
|
+
maxTokens: number().int().positive().optional(),
|
|
15955
|
+
temperature: number().optional()
|
|
15353
15956
|
});
|
|
15354
|
-
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
|
|
15358
|
-
|
|
15359
|
-
|
|
15360
|
-
|
|
15361
|
-
|
|
15362
|
-
|
|
15363
|
-
|
|
15957
|
+
/**
|
|
15958
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15959
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15960
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15961
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15962
|
+
* this only through the `llm` cap's methods.
|
|
15963
|
+
*
|
|
15964
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15965
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15966
|
+
* watchdog — operator decision #3).
|
|
15967
|
+
*/
|
|
15968
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15969
|
+
object({
|
|
15970
|
+
kind: literal("catalog"),
|
|
15971
|
+
catalogId: string()
|
|
15364
15972
|
}),
|
|
15365
|
-
|
|
15366
|
-
|
|
15367
|
-
|
|
15368
|
-
|
|
15369
|
-
|
|
15370
|
-
|
|
15371
|
-
|
|
15372
|
-
|
|
15373
|
-
|
|
15374
|
-
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
|
|
15385
|
-
|
|
15386
|
-
*/
|
|
15387
|
-
|
|
15388
|
-
/**
|
|
15389
|
-
|
|
15390
|
-
|
|
15391
|
-
|
|
15392
|
-
sharedBytes: number().optional()
|
|
15973
|
+
object({
|
|
15974
|
+
kind: literal("url"),
|
|
15975
|
+
url: string(),
|
|
15976
|
+
sha256: string().optional()
|
|
15977
|
+
}),
|
|
15978
|
+
object({
|
|
15979
|
+
kind: literal("path"),
|
|
15980
|
+
path: string()
|
|
15981
|
+
})
|
|
15982
|
+
]);
|
|
15983
|
+
var ManagedRuntimeConfigSchema = object({
|
|
15984
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
15985
|
+
nodeId: string(),
|
|
15986
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15987
|
+
engine: _enum(["llama-cpp"]),
|
|
15988
|
+
model: ManagedModelRefSchema,
|
|
15989
|
+
contextSize: number().int().default(4096),
|
|
15990
|
+
/** 0 = CPU-only. */
|
|
15991
|
+
gpuLayers: number().int().default(0),
|
|
15992
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15993
|
+
threads: number().int().optional(),
|
|
15994
|
+
/** Concurrent slots. */
|
|
15995
|
+
parallel: number().int().default(1),
|
|
15996
|
+
/** Else lazy: first generate boots it. */
|
|
15997
|
+
autoStart: boolean().default(false),
|
|
15998
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
15999
|
+
idleStopMinutes: number().int().default(30)
|
|
15393
16000
|
});
|
|
15394
|
-
var
|
|
15395
|
-
|
|
16001
|
+
var LlmRuntimeStatusSchema = object({
|
|
16002
|
+
/** Status is ALWAYS node-qualified. */
|
|
15396
16003
|
nodeId: string(),
|
|
15397
|
-
role: _enum(["hub", "worker"]),
|
|
15398
|
-
pid: number(),
|
|
15399
16004
|
state: _enum([
|
|
15400
|
-
"starting",
|
|
15401
|
-
"running",
|
|
15402
|
-
"stopping",
|
|
15403
16005
|
"stopped",
|
|
15404
|
-
"
|
|
15405
|
-
|
|
15406
|
-
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
pid: number(),
|
|
15410
|
-
ppid: number(),
|
|
15411
|
-
pgid: number(),
|
|
15412
|
-
classification: _enum([
|
|
15413
|
-
"root",
|
|
15414
|
-
"managed",
|
|
15415
|
-
"system",
|
|
15416
|
-
"ghost"
|
|
16006
|
+
"downloading",
|
|
16007
|
+
"starting",
|
|
16008
|
+
"ready",
|
|
16009
|
+
"crashed",
|
|
16010
|
+
"failed"
|
|
15417
16011
|
]),
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15429
|
-
orphaned: boolean()
|
|
15430
|
-
});
|
|
15431
|
-
var KillProcessInputSchema = object({
|
|
15432
|
-
pid: number(),
|
|
15433
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15434
|
-
force: boolean().optional()
|
|
16012
|
+
pid: number().optional(),
|
|
16013
|
+
port: number().optional(),
|
|
16014
|
+
modelPath: string().optional(),
|
|
16015
|
+
modelId: string().optional(),
|
|
16016
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
16017
|
+
lastError: string().optional(),
|
|
16018
|
+
crashesInWindow: number(),
|
|
16019
|
+
/** Child RSS (sampled best-effort). */
|
|
16020
|
+
memoryBytes: number().optional(),
|
|
16021
|
+
vramBytes: number().optional()
|
|
15435
16022
|
});
|
|
15436
|
-
var
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
16023
|
+
var LlmNodeModelSchema = object({
|
|
16024
|
+
file: string(),
|
|
16025
|
+
sizeBytes: number(),
|
|
16026
|
+
catalogId: string().optional(),
|
|
16027
|
+
installedAt: number().optional()
|
|
15440
16028
|
});
|
|
15441
|
-
var
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
success: boolean(),
|
|
15446
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15447
|
-
path: string().optional(),
|
|
15448
|
-
/** Process pid that was signalled. */
|
|
15449
|
-
pid: number().optional(),
|
|
15450
|
-
reason: string().optional()
|
|
16029
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
16030
|
+
nodeId: string(),
|
|
16031
|
+
modelsBytes: number(),
|
|
16032
|
+
freeBytes: number().optional()
|
|
15451
16033
|
});
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
|
|
15456
|
-
|
|
15457
|
-
|
|
15458
|
-
temperature: number().optional(),
|
|
15459
|
-
gpuPercent: number().optional(),
|
|
15460
|
-
gpuMemoryPercent: number().optional()
|
|
15461
|
-
});
|
|
15462
|
-
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, {
|
|
16034
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
16035
|
+
images: array(LlmImageSchema).optional(),
|
|
16036
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
16037
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
16038
|
+
timeoutMs: number().int().positive().optional()
|
|
16039
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15463
16040
|
kind: "mutation",
|
|
15464
16041
|
auth: "admin"
|
|
15465
|
-
}), method(
|
|
16042
|
+
}), method(object({}), _void(), {
|
|
15466
16043
|
kind: "mutation",
|
|
15467
16044
|
auth: "admin"
|
|
15468
|
-
})
|
|
15469
|
-
method(object({
|
|
15470
|
-
sourceUrl: string(),
|
|
15471
|
-
metadata: ModelConvertMetadataSchema,
|
|
15472
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15473
|
-
calibrationRef: string().optional(),
|
|
15474
|
-
sessionId: string().optional()
|
|
15475
|
-
}), ConvertResultSchema, {
|
|
16045
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15476
16046
|
kind: "mutation",
|
|
15477
|
-
auth: "admin"
|
|
15478
|
-
|
|
15479
|
-
});
|
|
15480
|
-
method(object({
|
|
15481
|
-
nodeId: string(),
|
|
15482
|
-
modelId: string(),
|
|
15483
|
-
format: _enum(MODEL_FORMATS),
|
|
15484
|
-
entry: ModelCatalogEntrySchema
|
|
15485
|
-
}), object({
|
|
15486
|
-
ok: boolean(),
|
|
15487
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15488
|
-
sha256: string(),
|
|
15489
|
-
bytes: number(),
|
|
15490
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15491
|
-
path: string()
|
|
15492
|
-
}), {
|
|
16047
|
+
auth: "admin"
|
|
16048
|
+
}), method(object({ file: string() }), _void(), {
|
|
15493
16049
|
kind: "mutation",
|
|
15494
16050
|
auth: "admin"
|
|
15495
|
-
});
|
|
15496
|
-
/**
|
|
15497
|
-
* `mqtt-broker` — broker-registry cap.
|
|
15498
|
-
*
|
|
15499
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15500
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15501
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
15502
|
-
* its OWN `mqtt.js` client.
|
|
15503
|
-
*
|
|
15504
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15505
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15506
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
15507
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15508
|
-
* features anyway — give it the connection config, get out of the way.
|
|
15509
|
-
*
|
|
15510
|
-
* Consumer flow:
|
|
15511
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
15512
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
15513
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
15514
|
-
*
|
|
15515
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
15516
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
15517
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
15518
|
-
* spawned it.
|
|
15519
|
-
*/
|
|
15520
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
16051
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15521
16052
|
/**
|
|
15522
|
-
*
|
|
16053
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
16054
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
16055
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
16056
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
16057
|
+
* (hub-placed); the cap stays open for future providers.
|
|
15523
16058
|
*
|
|
15524
|
-
*
|
|
15525
|
-
*
|
|
15526
|
-
*
|
|
15527
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
15528
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16059
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
16060
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
16061
|
+
* write; a stored key NEVER round-trips to a client.
|
|
15529
16062
|
*/
|
|
15530
|
-
var
|
|
15531
|
-
"
|
|
15532
|
-
"
|
|
15533
|
-
"
|
|
15534
|
-
"
|
|
15535
|
-
"
|
|
16063
|
+
var LlmProfileKindSchema = _enum([
|
|
16064
|
+
"openai-compatible",
|
|
16065
|
+
"openai",
|
|
16066
|
+
"anthropic",
|
|
16067
|
+
"google",
|
|
16068
|
+
"managed-local"
|
|
15536
16069
|
]);
|
|
15537
|
-
var
|
|
16070
|
+
var LlmProfileSchema = object({
|
|
15538
16071
|
id: string(),
|
|
15539
16072
|
name: string(),
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
16073
|
+
kind: LlmProfileKindSchema,
|
|
16074
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
16075
|
+
addonId: string(),
|
|
16076
|
+
enabled: boolean(),
|
|
16077
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
16078
|
+
model: string(),
|
|
16079
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
16080
|
+
baseUrl: string().optional(),
|
|
16081
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
16082
|
+
apiKey: string().optional(),
|
|
16083
|
+
supportsVision: boolean(),
|
|
16084
|
+
temperature: number().min(0).max(2).optional(),
|
|
16085
|
+
maxTokens: number().int().positive().optional(),
|
|
16086
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
16087
|
+
extraHeaders: record(string(), string()).optional(),
|
|
16088
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
16089
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15549
16090
|
});
|
|
15550
|
-
/**
|
|
15551
|
-
*
|
|
15552
|
-
*
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
15562
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
15563
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
15564
|
-
* broker).
|
|
15565
|
-
*/
|
|
15566
|
-
clientIdPrefix: string().optional()
|
|
16091
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
16092
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
16093
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
16094
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
16095
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
16096
|
+
kind: LlmProfileKindSchema,
|
|
16097
|
+
label: string(),
|
|
16098
|
+
icon: string(),
|
|
16099
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16100
|
+
addonId: string(),
|
|
16101
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
15567
16102
|
});
|
|
15568
|
-
var
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15572
|
-
password: string().optional(),
|
|
15573
|
-
clientIdPrefix: string().optional()
|
|
16103
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
16104
|
+
var LlmDefaultSchema = object({
|
|
16105
|
+
selector: LlmDefaultSelectorSchema,
|
|
16106
|
+
profileId: string()
|
|
15574
16107
|
});
|
|
15575
|
-
|
|
15576
|
-
var
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
|
|
15585
|
-
|
|
15586
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
15587
|
-
allowAnonymous: boolean().default(false),
|
|
15588
|
-
/** Optional shared username/password for clients. */
|
|
15589
|
-
username: string().optional(),
|
|
15590
|
-
password: string().optional()
|
|
16108
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
16109
|
+
var LlmUsageRollupSchema = object({
|
|
16110
|
+
day: string(),
|
|
16111
|
+
consumer: string(),
|
|
16112
|
+
profileId: string(),
|
|
16113
|
+
calls: number(),
|
|
16114
|
+
okCalls: number(),
|
|
16115
|
+
errorCalls: number(),
|
|
16116
|
+
inputTokens: number(),
|
|
16117
|
+
outputTokens: number(),
|
|
16118
|
+
avgLatencyMs: number()
|
|
15591
16119
|
});
|
|
15592
|
-
|
|
16120
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
16121
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
15593
16122
|
id: string(),
|
|
15594
|
-
|
|
15595
|
-
|
|
15596
|
-
|
|
15597
|
-
brokerCount: number(),
|
|
15598
|
-
embeddedRunning: boolean()
|
|
15599
|
-
});
|
|
15600
|
-
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);
|
|
15601
|
-
var NetworkEndpointSchema = object({
|
|
16123
|
+
label: string(),
|
|
16124
|
+
family: string(),
|
|
16125
|
+
purpose: _enum(["text", "vision"]),
|
|
15602
16126
|
url: string(),
|
|
15603
|
-
|
|
15604
|
-
|
|
15605
|
-
|
|
16127
|
+
sha256: string(),
|
|
16128
|
+
sizeBytes: number(),
|
|
16129
|
+
quantization: string(),
|
|
16130
|
+
/** Load-time guidance shown in the picker. */
|
|
16131
|
+
minRamBytes: number(),
|
|
16132
|
+
contextSizeDefault: number().int(),
|
|
16133
|
+
/** Vision models: companion projector file. */
|
|
16134
|
+
mmprojUrl: string().optional()
|
|
15606
16135
|
});
|
|
15607
|
-
var
|
|
15608
|
-
|
|
15609
|
-
|
|
16136
|
+
var LlmRuntimeNodeSchema = object({
|
|
16137
|
+
nodeId: string(),
|
|
16138
|
+
reachable: boolean(),
|
|
16139
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
16140
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15610
16141
|
error: string().optional()
|
|
15611
16142
|
});
|
|
15612
|
-
|
|
15613
|
-
|
|
15614
|
-
|
|
15615
|
-
|
|
15616
|
-
* the originating provider config (mode + sourcePort) so the
|
|
15617
|
-
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
15618
|
-
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
15619
|
-
*/
|
|
15620
|
-
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
15621
|
-
/**
|
|
15622
|
-
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
15623
|
-
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
15624
|
-
*/
|
|
15625
|
-
id: string(),
|
|
15626
|
-
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
15627
|
-
label: string(),
|
|
15628
|
-
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
15629
|
-
mode: string().optional(),
|
|
15630
|
-
/** Originating local port the ingress fronts (informational). */
|
|
15631
|
-
sourcePort: number().optional()
|
|
16143
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
16144
|
+
var ProfileRefInputSchema = object({
|
|
16145
|
+
addonId: string(),
|
|
16146
|
+
profileId: string()
|
|
15632
16147
|
});
|
|
15633
|
-
method(
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
|
|
15639
|
-
|
|
15640
|
-
|
|
15641
|
-
|
|
15642
|
-
|
|
15643
|
-
|
|
15644
|
-
|
|
15645
|
-
|
|
15646
|
-
|
|
15647
|
-
|
|
15648
|
-
|
|
15649
|
-
|
|
15650
|
-
|
|
15651
|
-
|
|
15652
|
-
|
|
15653
|
-
|
|
15654
|
-
|
|
15655
|
-
|
|
15656
|
-
|
|
15657
|
-
|
|
15658
|
-
|
|
15659
|
-
|
|
15660
|
-
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
"
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
"
|
|
15674
|
-
"
|
|
16148
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
16149
|
+
kind: "mutation",
|
|
16150
|
+
auth: "admin"
|
|
16151
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16152
|
+
kind: "mutation",
|
|
16153
|
+
auth: "admin"
|
|
16154
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
16155
|
+
kind: "mutation",
|
|
16156
|
+
auth: "admin"
|
|
16157
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
16158
|
+
selector: LlmDefaultSelectorSchema,
|
|
16159
|
+
profileId: string().nullable()
|
|
16160
|
+
}), _void(), {
|
|
16161
|
+
kind: "mutation",
|
|
16162
|
+
auth: "admin"
|
|
16163
|
+
}), method(object({
|
|
16164
|
+
since: number().optional(),
|
|
16165
|
+
until: number().optional(),
|
|
16166
|
+
consumer: string().optional(),
|
|
16167
|
+
profileId: string().optional()
|
|
16168
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16169
|
+
nodeId: string(),
|
|
16170
|
+
model: ManagedModelRefSchema
|
|
16171
|
+
}), _void(), {
|
|
16172
|
+
kind: "mutation",
|
|
16173
|
+
auth: "admin"
|
|
16174
|
+
}), method(object({
|
|
16175
|
+
nodeId: string(),
|
|
16176
|
+
file: string()
|
|
16177
|
+
}), _void(), {
|
|
16178
|
+
kind: "mutation",
|
|
16179
|
+
auth: "admin"
|
|
16180
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16181
|
+
kind: "mutation",
|
|
16182
|
+
auth: "admin"
|
|
16183
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16184
|
+
kind: "mutation",
|
|
16185
|
+
auth: "admin"
|
|
16186
|
+
});
|
|
16187
|
+
var LogLevelSchema = _enum([
|
|
16188
|
+
"debug",
|
|
16189
|
+
"info",
|
|
16190
|
+
"warn",
|
|
16191
|
+
"error"
|
|
15675
16192
|
]);
|
|
16193
|
+
var LogEntrySchema = object({
|
|
16194
|
+
timestamp: date(),
|
|
16195
|
+
level: LogLevelSchema,
|
|
16196
|
+
scope: array(string()),
|
|
16197
|
+
message: string(),
|
|
16198
|
+
meta: record(string(), unknown()).optional(),
|
|
16199
|
+
tags: record(string(), string()).optional()
|
|
16200
|
+
});
|
|
16201
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
16202
|
+
scope: array(string()).optional(),
|
|
16203
|
+
level: LogLevelSchema.optional(),
|
|
16204
|
+
since: date().optional(),
|
|
16205
|
+
until: date().optional(),
|
|
16206
|
+
limit: number().optional(),
|
|
16207
|
+
tags: record(string(), string()).optional()
|
|
16208
|
+
}), array(LogEntrySchema).readonly());
|
|
15676
16209
|
/**
|
|
15677
|
-
*
|
|
15678
|
-
*
|
|
15679
|
-
*
|
|
15680
|
-
*
|
|
16210
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
16211
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
16212
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
16213
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
16214
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
16215
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
16216
|
+
*
|
|
16217
|
+
* A contribution is a discriminated union on `kind`:
|
|
16218
|
+
*
|
|
16219
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
16220
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16221
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
16222
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16223
|
+
* login page needs NO change.
|
|
16224
|
+
*
|
|
16225
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
16226
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
16227
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
16228
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
16229
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
16230
|
+
*
|
|
16231
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
16232
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
16233
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
16234
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
16235
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
16236
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
16237
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
16238
|
+
* decision.
|
|
16239
|
+
*
|
|
16240
|
+
* Every contribution carries a `stage`:
|
|
16241
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
16242
|
+
* magic-link buttons; a future usernameless passkey).
|
|
16243
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16244
|
+
* returned `factors` (passkey-as-2FA today).
|
|
16245
|
+
*
|
|
16246
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
16247
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
16248
|
+
* tRPC router.
|
|
15681
16249
|
*/
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
|
|
15686
|
-
|
|
15687
|
-
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
16250
|
+
/** When a login method renders in the two-phase login flow. */
|
|
16251
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
16252
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
16253
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
16254
|
+
object({
|
|
16255
|
+
kind: literal("redirect"),
|
|
16256
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
16257
|
+
id: string(),
|
|
16258
|
+
/** Operator-facing button label. */
|
|
16259
|
+
label: string(),
|
|
16260
|
+
/** lucide-react icon name. */
|
|
16261
|
+
icon: string().optional(),
|
|
16262
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
16263
|
+
startUrl: string(),
|
|
16264
|
+
stage: LoginStageEnum
|
|
16265
|
+
}),
|
|
16266
|
+
object({
|
|
16267
|
+
kind: literal("widget"),
|
|
16268
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
16269
|
+
id: string(),
|
|
16270
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
16271
|
+
addonId: string(),
|
|
16272
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
16273
|
+
bundle: string(),
|
|
16274
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
16275
|
+
remote: WidgetRemoteSchema,
|
|
16276
|
+
stage: LoginStageEnum
|
|
16277
|
+
}),
|
|
16278
|
+
object({
|
|
16279
|
+
kind: literal("passkey"),
|
|
16280
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
16281
|
+
id: string(),
|
|
16282
|
+
/** Operator-facing button label. */
|
|
16283
|
+
label: string(),
|
|
16284
|
+
stage: LoginStageEnum,
|
|
16285
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
16286
|
+
rpId: string(),
|
|
16287
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
16288
|
+
origin: string().nullable()
|
|
16289
|
+
})
|
|
15693
16290
|
]);
|
|
15694
|
-
|
|
15695
|
-
var
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
16291
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
16292
|
+
var CpuBreakdownSchema = object({
|
|
16293
|
+
total: number(),
|
|
16294
|
+
user: number(),
|
|
16295
|
+
system: number(),
|
|
16296
|
+
irq: number(),
|
|
16297
|
+
nice: number(),
|
|
16298
|
+
loadAvg: tuple([
|
|
16299
|
+
number(),
|
|
16300
|
+
number(),
|
|
16301
|
+
number()
|
|
16302
|
+
]),
|
|
16303
|
+
cores: number()
|
|
15699
16304
|
});
|
|
15700
|
-
|
|
15701
|
-
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
var
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
16305
|
+
var MemoryInfoSchema = object({
|
|
16306
|
+
percent: number(),
|
|
16307
|
+
totalBytes: number(),
|
|
16308
|
+
usedBytes: number(),
|
|
16309
|
+
availableBytes: number(),
|
|
16310
|
+
swapUsedBytes: number(),
|
|
16311
|
+
swapTotalBytes: number()
|
|
16312
|
+
});
|
|
16313
|
+
var DiskIoSnapshotSchema = object({
|
|
16314
|
+
readBytes: number(),
|
|
16315
|
+
writeBytes: number(),
|
|
16316
|
+
readOps: number(),
|
|
16317
|
+
writeOps: number(),
|
|
16318
|
+
timestampMs: number()
|
|
16319
|
+
});
|
|
16320
|
+
var NetworkIoSnapshotSchema = object({
|
|
16321
|
+
rxBytes: number(),
|
|
16322
|
+
txBytes: number(),
|
|
16323
|
+
rxPackets: number(),
|
|
16324
|
+
txPackets: number(),
|
|
16325
|
+
rxErrors: number(),
|
|
16326
|
+
txErrors: number(),
|
|
16327
|
+
timestampMs: number()
|
|
16328
|
+
});
|
|
16329
|
+
var MetricsGpuInfoSchema = object({
|
|
16330
|
+
utilization: number(),
|
|
16331
|
+
model: string(),
|
|
16332
|
+
memoryUsedBytes: number(),
|
|
16333
|
+
memoryTotalBytes: number(),
|
|
16334
|
+
temperature: number().nullable()
|
|
16335
|
+
});
|
|
16336
|
+
var ProcessResourceInfoSchema = object({
|
|
16337
|
+
openFds: number(),
|
|
16338
|
+
threadCount: number(),
|
|
16339
|
+
activeHandles: number(),
|
|
16340
|
+
activeRequests: number()
|
|
15723
16341
|
});
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
15729
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
15730
|
-
flags: object({
|
|
15731
|
-
critical: boolean().optional(),
|
|
15732
|
-
silent: boolean().optional(),
|
|
15733
|
-
noPush: boolean().optional()
|
|
15734
|
-
}).optional(),
|
|
15735
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
15736
|
-
requires: array(string()).optional(),
|
|
15737
|
-
description: string().optional()
|
|
16342
|
+
var PressureAvgsSchema = object({
|
|
16343
|
+
avg10: number(),
|
|
16344
|
+
avg60: number(),
|
|
16345
|
+
avg300: number()
|
|
15738
16346
|
});
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
|
|
15749
|
-
|
|
16347
|
+
var PressureInfoSchema = object({
|
|
16348
|
+
some: PressureAvgsSchema,
|
|
16349
|
+
full: PressureAvgsSchema.nullable()
|
|
16350
|
+
});
|
|
16351
|
+
var SystemResourceSnapshotSchema = object({
|
|
16352
|
+
cpu: CpuBreakdownSchema,
|
|
16353
|
+
memory: MemoryInfoSchema,
|
|
16354
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
16355
|
+
network: NetworkIoSnapshotSchema,
|
|
16356
|
+
disk: DiskIoSnapshotSchema,
|
|
16357
|
+
pressure: object({
|
|
16358
|
+
cpu: PressureInfoSchema.nullable(),
|
|
16359
|
+
memory: PressureInfoSchema.nullable(),
|
|
16360
|
+
io: PressureInfoSchema.nullable()
|
|
15750
16361
|
}),
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
format: array(NotificationFormatSchema),
|
|
15755
|
-
clickUrl: boolean(),
|
|
15756
|
-
sound: boolean(),
|
|
15757
|
-
ttl: boolean(),
|
|
15758
|
-
bodyMaxLen: number().int().positive()
|
|
16362
|
+
process: ProcessResourceInfoSchema,
|
|
16363
|
+
cpuTemperature: number().nullable(),
|
|
16364
|
+
timestampMs: number()
|
|
15759
16365
|
});
|
|
15760
|
-
|
|
15761
|
-
|
|
15762
|
-
|
|
15763
|
-
|
|
15764
|
-
|
|
15765
|
-
|
|
15766
|
-
*/
|
|
15767
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
15768
|
-
var TargetKindSchema = object({
|
|
15769
|
-
kind: string(),
|
|
15770
|
-
label: string(),
|
|
15771
|
-
icon: string(),
|
|
15772
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15773
|
-
addonId: string(),
|
|
15774
|
-
configSchema: ConfigSchemaPassthrough$1,
|
|
15775
|
-
supportsDiscovery: boolean(),
|
|
15776
|
-
caps: TargetKindCapsSchema
|
|
16366
|
+
var DiskSpaceInfoSchema = object({
|
|
16367
|
+
path: string(),
|
|
16368
|
+
totalBytes: number(),
|
|
16369
|
+
usedBytes: number(),
|
|
16370
|
+
availableBytes: number(),
|
|
16371
|
+
percent: number()
|
|
15777
16372
|
});
|
|
15778
|
-
|
|
15779
|
-
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
|
|
15786
|
-
|
|
16373
|
+
var PidResourceStatsSchema = object({
|
|
16374
|
+
pid: number(),
|
|
16375
|
+
cpu: number(),
|
|
16376
|
+
memory: number(),
|
|
16377
|
+
/**
|
|
16378
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
16379
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
16380
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
16381
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
16382
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
16383
|
+
*/
|
|
16384
|
+
privateBytes: number().optional(),
|
|
16385
|
+
/**
|
|
16386
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
16387
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
16388
|
+
*/
|
|
16389
|
+
sharedBytes: number().optional()
|
|
16390
|
+
});
|
|
16391
|
+
var AddonInstanceSchema = object({
|
|
15787
16392
|
addonId: string(),
|
|
15788
|
-
|
|
15789
|
-
|
|
16393
|
+
nodeId: string(),
|
|
16394
|
+
role: _enum(["hub", "worker"]),
|
|
16395
|
+
pid: number(),
|
|
16396
|
+
state: _enum([
|
|
16397
|
+
"starting",
|
|
16398
|
+
"running",
|
|
16399
|
+
"stopping",
|
|
16400
|
+
"stopped",
|
|
16401
|
+
"crashed"
|
|
16402
|
+
]),
|
|
16403
|
+
uptimeSec: number()
|
|
15790
16404
|
});
|
|
15791
|
-
|
|
15792
|
-
|
|
15793
|
-
|
|
15794
|
-
|
|
15795
|
-
|
|
16405
|
+
var NodeProcessSchema = object({
|
|
16406
|
+
pid: number(),
|
|
16407
|
+
ppid: number(),
|
|
16408
|
+
pgid: number(),
|
|
16409
|
+
classification: _enum([
|
|
16410
|
+
"root",
|
|
16411
|
+
"managed",
|
|
16412
|
+
"system",
|
|
16413
|
+
"ghost"
|
|
16414
|
+
]),
|
|
16415
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
16416
|
+
addonId: string().nullable(),
|
|
16417
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
16418
|
+
nodeId: string().nullable(),
|
|
16419
|
+
/** Truncated command line. */
|
|
16420
|
+
command: string(),
|
|
16421
|
+
cpuPercent: number(),
|
|
16422
|
+
memoryRssBytes: number(),
|
|
16423
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
16424
|
+
uptimeSec: number(),
|
|
16425
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
16426
|
+
orphaned: boolean()
|
|
15796
16427
|
});
|
|
15797
|
-
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
attachmentsSent: number().int().nonnegative(),
|
|
15802
|
-
actionsSent: number().int().nonnegative(),
|
|
15803
|
-
truncated: boolean(),
|
|
15804
|
-
dropped: array(string())
|
|
16428
|
+
var KillProcessInputSchema = object({
|
|
16429
|
+
pid: number(),
|
|
16430
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
16431
|
+
force: boolean().optional()
|
|
15805
16432
|
});
|
|
15806
|
-
var
|
|
16433
|
+
var KillProcessResultSchema = object({
|
|
16434
|
+
success: boolean(),
|
|
16435
|
+
reason: string().optional(),
|
|
16436
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
16437
|
+
});
|
|
16438
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
16439
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
16440
|
+
addonId: string() });
|
|
16441
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
15807
16442
|
success: boolean(),
|
|
16443
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
16444
|
+
path: string().optional(),
|
|
16445
|
+
/** Process pid that was signalled. */
|
|
16446
|
+
pid: number().optional(),
|
|
16447
|
+
reason: string().optional()
|
|
16448
|
+
});
|
|
16449
|
+
var SystemMetricsSchema = object({
|
|
16450
|
+
cpuPercent: number(),
|
|
16451
|
+
memoryPercent: number(),
|
|
16452
|
+
memoryUsedMB: number(),
|
|
16453
|
+
memoryTotalMB: number(),
|
|
16454
|
+
diskPercent: number().optional(),
|
|
16455
|
+
temperature: number().optional(),
|
|
16456
|
+
gpuPercent: number().optional(),
|
|
16457
|
+
gpuMemoryPercent: number().optional()
|
|
16458
|
+
});
|
|
16459
|
+
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, {
|
|
16460
|
+
kind: "mutation",
|
|
16461
|
+
auth: "admin"
|
|
16462
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
16463
|
+
kind: "mutation",
|
|
16464
|
+
auth: "admin"
|
|
16465
|
+
});
|
|
16466
|
+
method(object({
|
|
16467
|
+
sourceUrl: string(),
|
|
16468
|
+
metadata: ModelConvertMetadataSchema,
|
|
16469
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
16470
|
+
calibrationRef: string().optional(),
|
|
16471
|
+
sessionId: string().optional()
|
|
16472
|
+
}), ConvertResultSchema, {
|
|
16473
|
+
kind: "mutation",
|
|
16474
|
+
auth: "admin",
|
|
16475
|
+
timeoutMs: 6e5
|
|
16476
|
+
});
|
|
16477
|
+
method(object({
|
|
16478
|
+
nodeId: string(),
|
|
16479
|
+
modelId: string(),
|
|
16480
|
+
format: _enum(MODEL_FORMATS),
|
|
16481
|
+
entry: ModelCatalogEntrySchema
|
|
16482
|
+
}), object({
|
|
16483
|
+
ok: boolean(),
|
|
16484
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
16485
|
+
sha256: string(),
|
|
16486
|
+
bytes: number(),
|
|
16487
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
16488
|
+
path: string()
|
|
16489
|
+
}), {
|
|
16490
|
+
kind: "mutation",
|
|
16491
|
+
auth: "admin"
|
|
16492
|
+
});
|
|
16493
|
+
/**
|
|
16494
|
+
* `mqtt-broker` — broker-registry cap.
|
|
16495
|
+
*
|
|
16496
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
16497
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
16498
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
16499
|
+
* its OWN `mqtt.js` client.
|
|
16500
|
+
*
|
|
16501
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
16502
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
16503
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
16504
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
16505
|
+
* features anyway — give it the connection config, get out of the way.
|
|
16506
|
+
*
|
|
16507
|
+
* Consumer flow:
|
|
16508
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
16509
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
16510
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
16511
|
+
*
|
|
16512
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
16513
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
16514
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
16515
|
+
* spawned it.
|
|
16516
|
+
*/
|
|
16517
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
16518
|
+
/**
|
|
16519
|
+
* Broker live-probe status.
|
|
16520
|
+
*
|
|
16521
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
16522
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
16523
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
16524
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
16525
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16526
|
+
*/
|
|
16527
|
+
var BrokerStatusSchema$1 = _enum([
|
|
16528
|
+
"connected",
|
|
16529
|
+
"disconnected",
|
|
16530
|
+
"auth-failed",
|
|
16531
|
+
"unreachable",
|
|
16532
|
+
"tls-error"
|
|
16533
|
+
]);
|
|
16534
|
+
var BrokerInfoSchema = object({
|
|
16535
|
+
id: string(),
|
|
16536
|
+
name: string(),
|
|
16537
|
+
url: string(),
|
|
16538
|
+
kind: BrokerKindSchema,
|
|
16539
|
+
status: BrokerStatusSchema$1,
|
|
16540
|
+
latencyMs: number().nullable(),
|
|
15808
16541
|
error: string().optional(),
|
|
15809
|
-
|
|
16542
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
16543
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
16544
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
16545
|
+
lastCheckedAt: number().optional()
|
|
15810
16546
|
});
|
|
15811
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
15812
|
-
var TestResultSchema = SendResultSchema;
|
|
15813
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
15814
|
-
kind: string(),
|
|
15815
|
-
config: record(string(), unknown()).optional()
|
|
15816
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
15817
|
-
targetId: string(),
|
|
15818
|
-
notification: NotificationSchema
|
|
15819
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
15820
|
-
targetId: string(),
|
|
15821
|
-
sample: NotificationSchema.optional()
|
|
15822
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
15823
|
-
targetId: string(),
|
|
15824
|
-
enabled: boolean()
|
|
15825
|
-
}), _void(), { kind: "mutation" });
|
|
15826
16547
|
/**
|
|
15827
|
-
*
|
|
15828
|
-
*
|
|
15829
|
-
*
|
|
15830
|
-
*
|
|
15831
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15832
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
15833
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
16548
|
+
* Connection details — what a consumer needs to call
|
|
16549
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
16550
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
16551
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
15834
16552
|
*/
|
|
15835
|
-
var
|
|
15836
|
-
|
|
15837
|
-
|
|
16553
|
+
var BrokerConnectionDetailsSchema = object({
|
|
16554
|
+
url: string(),
|
|
16555
|
+
username: string().optional(),
|
|
16556
|
+
password: string().optional(),
|
|
16557
|
+
/**
|
|
16558
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
16559
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
16560
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
16561
|
+
* broker).
|
|
16562
|
+
*/
|
|
16563
|
+
clientIdPrefix: string().optional()
|
|
15838
16564
|
});
|
|
15839
|
-
var
|
|
15840
|
-
|
|
15841
|
-
"
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
]);
|
|
15850
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
16565
|
+
var AddBrokerInputSchema = object({
|
|
16566
|
+
name: string().min(1),
|
|
16567
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
16568
|
+
username: string().optional(),
|
|
16569
|
+
password: string().optional(),
|
|
16570
|
+
clientIdPrefix: string().optional()
|
|
16571
|
+
});
|
|
16572
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
16573
|
+
var IdInputSchema = object({ id: string() });
|
|
16574
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
15851
16575
|
ok: literal(true),
|
|
15852
|
-
text: string(),
|
|
15853
|
-
model: string(),
|
|
15854
|
-
usage: LlmUsageSchema,
|
|
15855
|
-
truncated: boolean(),
|
|
15856
16576
|
latencyMs: number()
|
|
15857
16577
|
}), object({
|
|
15858
16578
|
ok: literal(false),
|
|
15859
|
-
|
|
15860
|
-
message: string(),
|
|
15861
|
-
retryAfterMs: number().optional()
|
|
16579
|
+
error: string()
|
|
15862
16580
|
})]);
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
*/
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
mimeType: string()
|
|
16581
|
+
var StartEmbeddedInputSchema = object({
|
|
16582
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
16583
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
16584
|
+
allowAnonymous: boolean().default(false),
|
|
16585
|
+
/** Optional shared username/password for clients. */
|
|
16586
|
+
username: string().optional(),
|
|
16587
|
+
password: string().optional()
|
|
15871
16588
|
});
|
|
15872
|
-
var
|
|
15873
|
-
|
|
15874
|
-
|
|
15875
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15876
|
-
profileId: string().optional(),
|
|
15877
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15878
|
-
consumer: string(),
|
|
15879
|
-
system: string().optional(),
|
|
15880
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15881
|
-
prompt: string(),
|
|
15882
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15883
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
15884
|
-
/** Per-call override of the profile default. */
|
|
15885
|
-
maxTokens: number().int().positive().optional(),
|
|
15886
|
-
temperature: number().optional()
|
|
16589
|
+
var StartEmbeddedResultSchema = object({
|
|
16590
|
+
id: string(),
|
|
16591
|
+
url: string()
|
|
15887
16592
|
});
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15892
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15893
|
-
* this only through the `llm` cap's methods.
|
|
15894
|
-
*
|
|
15895
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15896
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15897
|
-
* watchdog — operator decision #3).
|
|
15898
|
-
*/
|
|
15899
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15900
|
-
object({
|
|
15901
|
-
kind: literal("catalog"),
|
|
15902
|
-
catalogId: string()
|
|
15903
|
-
}),
|
|
15904
|
-
object({
|
|
15905
|
-
kind: literal("url"),
|
|
15906
|
-
url: string(),
|
|
15907
|
-
sha256: string().optional()
|
|
15908
|
-
}),
|
|
15909
|
-
object({
|
|
15910
|
-
kind: literal("path"),
|
|
15911
|
-
path: string()
|
|
15912
|
-
})
|
|
15913
|
-
]);
|
|
15914
|
-
var ManagedRuntimeConfigSchema = object({
|
|
15915
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
15916
|
-
nodeId: string(),
|
|
15917
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15918
|
-
engine: _enum(["llama-cpp"]),
|
|
15919
|
-
model: ManagedModelRefSchema,
|
|
15920
|
-
contextSize: number().int().default(4096),
|
|
15921
|
-
/** 0 = CPU-only. */
|
|
15922
|
-
gpuLayers: number().int().default(0),
|
|
15923
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15924
|
-
threads: number().int().optional(),
|
|
15925
|
-
/** Concurrent slots. */
|
|
15926
|
-
parallel: number().int().default(1),
|
|
15927
|
-
/** Else lazy: first generate boots it. */
|
|
15928
|
-
autoStart: boolean().default(false),
|
|
15929
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
15930
|
-
idleStopMinutes: number().int().default(30)
|
|
16593
|
+
var StatusSchema = object({
|
|
16594
|
+
brokerCount: number(),
|
|
16595
|
+
embeddedRunning: boolean()
|
|
15931
16596
|
});
|
|
15932
|
-
|
|
15933
|
-
|
|
15934
|
-
|
|
15935
|
-
|
|
15936
|
-
|
|
15937
|
-
|
|
15938
|
-
"starting",
|
|
15939
|
-
"ready",
|
|
15940
|
-
"crashed",
|
|
15941
|
-
"failed"
|
|
15942
|
-
]),
|
|
15943
|
-
pid: number().optional(),
|
|
15944
|
-
port: number().optional(),
|
|
15945
|
-
modelPath: string().optional(),
|
|
15946
|
-
modelId: string().optional(),
|
|
15947
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
15948
|
-
lastError: string().optional(),
|
|
15949
|
-
crashesInWindow: number(),
|
|
15950
|
-
/** Child RSS (sampled best-effort). */
|
|
15951
|
-
memoryBytes: number().optional(),
|
|
15952
|
-
vramBytes: number().optional()
|
|
16597
|
+
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);
|
|
16598
|
+
var NetworkEndpointSchema = object({
|
|
16599
|
+
url: string(),
|
|
16600
|
+
hostname: string(),
|
|
16601
|
+
port: number(),
|
|
16602
|
+
protocol: _enum(["http", "https"])
|
|
15953
16603
|
});
|
|
15954
|
-
var
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
installedAt: number().optional()
|
|
16604
|
+
var NetworkAccessStatusSchema = object({
|
|
16605
|
+
connected: boolean(),
|
|
16606
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
16607
|
+
error: string().optional()
|
|
15959
16608
|
});
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
16609
|
+
/**
|
|
16610
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
16611
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
16612
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
16613
|
+
* the originating provider config (mode + sourcePort) so the
|
|
16614
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
16615
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
16616
|
+
*/
|
|
16617
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
16618
|
+
/**
|
|
16619
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
16620
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
16621
|
+
*/
|
|
16622
|
+
id: string(),
|
|
16623
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
16624
|
+
label: string(),
|
|
16625
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
16626
|
+
mode: string().optional(),
|
|
16627
|
+
/** Originating local port the ingress fronts (informational). */
|
|
16628
|
+
sourcePort: number().optional()
|
|
15964
16629
|
});
|
|
15965
|
-
method(
|
|
15966
|
-
images: array(LlmImageSchema).optional(),
|
|
15967
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
15968
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15969
|
-
timeoutMs: number().int().positive().optional()
|
|
15970
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15971
|
-
kind: "mutation",
|
|
15972
|
-
auth: "admin"
|
|
15973
|
-
}), method(object({}), _void(), {
|
|
15974
|
-
kind: "mutation",
|
|
15975
|
-
auth: "admin"
|
|
15976
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15977
|
-
kind: "mutation",
|
|
15978
|
-
auth: "admin"
|
|
15979
|
-
}), method(object({ file: string() }), _void(), {
|
|
15980
|
-
kind: "mutation",
|
|
15981
|
-
auth: "admin"
|
|
15982
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
16630
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
15983
16631
|
/**
|
|
15984
|
-
*
|
|
15985
|
-
*
|
|
15986
|
-
*
|
|
15987
|
-
*
|
|
15988
|
-
*
|
|
16632
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
16633
|
+
*
|
|
16634
|
+
* Apprise-derived model (see
|
|
16635
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
16636
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
16637
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16638
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
16639
|
+
* message to what the kind supports — callers never special-case a service.
|
|
16640
|
+
*
|
|
16641
|
+
* DESIGN DECISIONS (locked):
|
|
16642
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
16643
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
16644
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
16645
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
16646
|
+
* alternative would fork the UI per addon and cannot host the
|
|
16647
|
+
* discovery→adopt flow.
|
|
16648
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
16649
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
16650
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
16651
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
16652
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
16653
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
16654
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
16655
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
16656
|
+
* base64 fallback needed.
|
|
15989
16657
|
*
|
|
15990
|
-
*
|
|
15991
|
-
* `
|
|
15992
|
-
*
|
|
16658
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
16659
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
16660
|
+
* admin "Integrations" page.
|
|
15993
16661
|
*/
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
"
|
|
16662
|
+
/**
|
|
16663
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
16664
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
16665
|
+
*/
|
|
16666
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
16667
|
+
"image",
|
|
16668
|
+
"video",
|
|
16669
|
+
"gif",
|
|
16670
|
+
"audio",
|
|
16671
|
+
"icon"
|
|
16000
16672
|
]);
|
|
16001
|
-
|
|
16673
|
+
/**
|
|
16674
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
16675
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
16676
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
16677
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
16678
|
+
*/
|
|
16679
|
+
var AttachmentSchema = object({
|
|
16680
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
16681
|
+
url: string().optional(),
|
|
16682
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
16683
|
+
mime: string().optional(),
|
|
16684
|
+
name: string().optional()
|
|
16685
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
16686
|
+
var NotificationFormatSchema = _enum([
|
|
16687
|
+
"text",
|
|
16688
|
+
"markdown",
|
|
16689
|
+
"html"
|
|
16690
|
+
]);
|
|
16691
|
+
/** A single tap-through action button. */
|
|
16692
|
+
var NotificationActionSchema = object({
|
|
16002
16693
|
id: string(),
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
16006
|
-
addonId: string(),
|
|
16007
|
-
enabled: boolean(),
|
|
16008
|
-
/** Vendor model id, or the managed runtime's loaded model. */
|
|
16009
|
-
model: string(),
|
|
16010
|
-
/** Required for openai-compatible; override for cloud kinds. */
|
|
16011
|
-
baseUrl: string().optional(),
|
|
16012
|
-
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
16013
|
-
apiKey: string().optional(),
|
|
16014
|
-
supportsVision: boolean(),
|
|
16015
|
-
temperature: number().min(0).max(2).optional(),
|
|
16016
|
-
maxTokens: number().int().positive().optional(),
|
|
16017
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
16018
|
-
extraHeaders: record(string(), string()).optional(),
|
|
16019
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
16020
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
16694
|
+
label: string(),
|
|
16695
|
+
url: string().optional()
|
|
16021
16696
|
});
|
|
16022
|
-
/**
|
|
16023
|
-
*
|
|
16024
|
-
*
|
|
16697
|
+
/**
|
|
16698
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
16699
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
16700
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
16701
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
16702
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
16703
|
+
* `priority` for that one target.
|
|
16704
|
+
*/
|
|
16705
|
+
var NotificationSchema = object({
|
|
16706
|
+
body: string(),
|
|
16707
|
+
title: string().optional(),
|
|
16708
|
+
format: NotificationFormatSchema.default("text"),
|
|
16709
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16710
|
+
level: string().optional(),
|
|
16711
|
+
attachments: array(AttachmentSchema).optional(),
|
|
16712
|
+
clickUrl: string().optional(),
|
|
16713
|
+
actions: array(NotificationActionSchema).optional(),
|
|
16714
|
+
sound: string().optional(),
|
|
16715
|
+
ttl: number().optional(),
|
|
16716
|
+
tag: string().optional(),
|
|
16717
|
+
deviceId: number().optional(),
|
|
16718
|
+
eventId: string().optional(),
|
|
16719
|
+
metadata: record(string(), unknown()).optional()
|
|
16720
|
+
});
|
|
16721
|
+
/** One declared native severity/priority level for a kind. */
|
|
16722
|
+
var TargetKindLevelSchema = object({
|
|
16723
|
+
id: string(),
|
|
16724
|
+
label: string(),
|
|
16725
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
16726
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
16727
|
+
flags: object({
|
|
16728
|
+
critical: boolean().optional(),
|
|
16729
|
+
silent: boolean().optional(),
|
|
16730
|
+
noPush: boolean().optional()
|
|
16731
|
+
}).optional(),
|
|
16732
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
16733
|
+
requires: array(string()).optional(),
|
|
16734
|
+
description: string().optional()
|
|
16735
|
+
});
|
|
16736
|
+
/** The full capability block consulted before dispatch. */
|
|
16737
|
+
var TargetKindCapsSchema = object({
|
|
16738
|
+
attachments: object({
|
|
16739
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
16740
|
+
mode: _enum([
|
|
16741
|
+
"url",
|
|
16742
|
+
"bytes",
|
|
16743
|
+
"both"
|
|
16744
|
+
]),
|
|
16745
|
+
max: number().int().nonnegative(),
|
|
16746
|
+
maxBytes: number().int().positive().optional()
|
|
16747
|
+
}),
|
|
16748
|
+
/** Max action buttons (0 = none). */
|
|
16749
|
+
actions: number().int().nonnegative(),
|
|
16750
|
+
levels: array(TargetKindLevelSchema),
|
|
16751
|
+
format: array(NotificationFormatSchema),
|
|
16752
|
+
clickUrl: boolean(),
|
|
16753
|
+
sound: boolean(),
|
|
16754
|
+
ttl: boolean(),
|
|
16755
|
+
bodyMaxLen: number().int().positive()
|
|
16756
|
+
});
|
|
16757
|
+
/**
|
|
16758
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
16759
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
16760
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
16761
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
16762
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
16763
|
+
*/
|
|
16025
16764
|
var ConfigSchemaPassthrough = unknown();
|
|
16026
|
-
var
|
|
16027
|
-
kind:
|
|
16765
|
+
var TargetKindSchema = object({
|
|
16766
|
+
kind: string(),
|
|
16028
16767
|
label: string(),
|
|
16029
16768
|
icon: string(),
|
|
16030
16769
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16031
16770
|
addonId: string(),
|
|
16032
|
-
configSchema: ConfigSchemaPassthrough
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
var LlmDefaultSchema = object({
|
|
16036
|
-
selector: LlmDefaultSelectorSchema,
|
|
16037
|
-
profileId: string()
|
|
16038
|
-
});
|
|
16039
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
16040
|
-
var LlmUsageRollupSchema = object({
|
|
16041
|
-
day: string(),
|
|
16042
|
-
consumer: string(),
|
|
16043
|
-
profileId: string(),
|
|
16044
|
-
calls: number(),
|
|
16045
|
-
okCalls: number(),
|
|
16046
|
-
errorCalls: number(),
|
|
16047
|
-
inputTokens: number(),
|
|
16048
|
-
outputTokens: number(),
|
|
16049
|
-
avgLatencyMs: number()
|
|
16771
|
+
configSchema: ConfigSchemaPassthrough,
|
|
16772
|
+
supportsDiscovery: boolean(),
|
|
16773
|
+
caps: TargetKindCapsSchema
|
|
16050
16774
|
});
|
|
16051
|
-
/**
|
|
16052
|
-
|
|
16775
|
+
/**
|
|
16776
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
16777
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
16778
|
+
* round-trip a stored secret to the UI.
|
|
16779
|
+
*/
|
|
16780
|
+
var TargetSchema = object({
|
|
16053
16781
|
id: string(),
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
purpose: _enum(["text", "vision"]),
|
|
16057
|
-
url: string(),
|
|
16058
|
-
sha256: string(),
|
|
16059
|
-
sizeBytes: number(),
|
|
16060
|
-
quantization: string(),
|
|
16061
|
-
/** Load-time guidance shown in the picker. */
|
|
16062
|
-
minRamBytes: number(),
|
|
16063
|
-
contextSizeDefault: number().int(),
|
|
16064
|
-
/** Vision models: companion projector file. */
|
|
16065
|
-
mmprojUrl: string().optional()
|
|
16066
|
-
});
|
|
16067
|
-
var LlmRuntimeNodeSchema = object({
|
|
16068
|
-
nodeId: string(),
|
|
16069
|
-
reachable: boolean(),
|
|
16070
|
-
status: LlmRuntimeStatusSchema.optional(),
|
|
16071
|
-
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
16072
|
-
error: string().optional()
|
|
16073
|
-
});
|
|
16074
|
-
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
16075
|
-
var ProfileRefInputSchema = object({
|
|
16782
|
+
name: string(),
|
|
16783
|
+
kind: string(),
|
|
16076
16784
|
addonId: string(),
|
|
16077
|
-
|
|
16785
|
+
enabled: boolean(),
|
|
16786
|
+
config: record(string(), unknown())
|
|
16078
16787
|
});
|
|
16079
|
-
|
|
16080
|
-
|
|
16081
|
-
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
|
|
16087
|
-
|
|
16088
|
-
|
|
16089
|
-
|
|
16090
|
-
|
|
16091
|
-
|
|
16092
|
-
|
|
16093
|
-
|
|
16094
|
-
|
|
16095
|
-
|
|
16096
|
-
|
|
16097
|
-
|
|
16098
|
-
profileId: string().optional()
|
|
16099
|
-
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16100
|
-
nodeId: string(),
|
|
16101
|
-
model: ManagedModelRefSchema
|
|
16102
|
-
}), _void(), {
|
|
16103
|
-
kind: "mutation",
|
|
16104
|
-
auth: "admin"
|
|
16105
|
-
}), method(object({
|
|
16106
|
-
nodeId: string(),
|
|
16107
|
-
file: string()
|
|
16108
|
-
}), _void(), {
|
|
16109
|
-
kind: "mutation",
|
|
16110
|
-
auth: "admin"
|
|
16111
|
-
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16112
|
-
kind: "mutation",
|
|
16113
|
-
auth: "admin"
|
|
16114
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
16115
|
-
kind: "mutation",
|
|
16116
|
-
auth: "admin"
|
|
16788
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
16789
|
+
var DiscoveredTargetSchema = object({
|
|
16790
|
+
kind: string(),
|
|
16791
|
+
suggestedName: string(),
|
|
16792
|
+
config: record(string(), unknown())
|
|
16793
|
+
});
|
|
16794
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
16795
|
+
var RenderedAsSchema = object({
|
|
16796
|
+
level: string(),
|
|
16797
|
+
format: NotificationFormatSchema,
|
|
16798
|
+
attachmentsSent: number().int().nonnegative(),
|
|
16799
|
+
actionsSent: number().int().nonnegative(),
|
|
16800
|
+
truncated: boolean(),
|
|
16801
|
+
dropped: array(string())
|
|
16802
|
+
});
|
|
16803
|
+
var SendResultSchema = object({
|
|
16804
|
+
success: boolean(),
|
|
16805
|
+
error: string().optional(),
|
|
16806
|
+
renderedAs: RenderedAsSchema.optional()
|
|
16117
16807
|
});
|
|
16808
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
16809
|
+
var TestResultSchema = SendResultSchema;
|
|
16810
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
16811
|
+
kind: string(),
|
|
16812
|
+
config: record(string(), unknown()).optional()
|
|
16813
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
16814
|
+
targetId: string(),
|
|
16815
|
+
notification: NotificationSchema
|
|
16816
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
16817
|
+
targetId: string(),
|
|
16818
|
+
sample: NotificationSchema.optional()
|
|
16819
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16820
|
+
targetId: string(),
|
|
16821
|
+
enabled: boolean()
|
|
16822
|
+
}), _void(), { kind: "mutation" });
|
|
16118
16823
|
/**
|
|
16119
16824
|
* Zod schemas for persisted record types.
|
|
16120
16825
|
*
|
|
@@ -16800,7 +17505,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16800
17505
|
}), method(object({
|
|
16801
17506
|
eventId: string(),
|
|
16802
17507
|
kind: MediaFileKindEnum.optional()
|
|
16803
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
17508
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
17509
|
+
trackId: string(),
|
|
17510
|
+
kinds: array(MediaFileKindEnum).optional()
|
|
17511
|
+
}), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
|
|
16804
17512
|
deviceId: number(),
|
|
16805
17513
|
timestamp: number(),
|
|
16806
17514
|
frameWidth: number(),
|
|
@@ -16821,76 +17529,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16821
17529
|
eventId: string(),
|
|
16822
17530
|
timestamp: number()
|
|
16823
17531
|
});
|
|
16824
|
-
/**
|
|
16825
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
16826
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
16827
|
-
* caps into per-camera event-kind descriptors.
|
|
16828
|
-
*
|
|
16829
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
16830
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
16831
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
16832
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
16833
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
16834
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
16835
|
-
* eventful cap is missing.
|
|
16836
|
-
*/
|
|
16837
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
16838
|
-
var LEGACY_ICON = {
|
|
16839
|
-
motion: "motion",
|
|
16840
|
-
audio: "audio",
|
|
16841
|
-
person: "person",
|
|
16842
|
-
vehicle: "vehicle",
|
|
16843
|
-
animal: "animal",
|
|
16844
|
-
package: "package",
|
|
16845
|
-
door: "door",
|
|
16846
|
-
pir: "pir",
|
|
16847
|
-
smoke: "smoke",
|
|
16848
|
-
water: "water",
|
|
16849
|
-
button: "button",
|
|
16850
|
-
generic: "generic",
|
|
16851
|
-
gas: "smoke",
|
|
16852
|
-
vibration: "generic",
|
|
16853
|
-
tamper: "generic",
|
|
16854
|
-
presence: "person",
|
|
16855
|
-
lock: "generic",
|
|
16856
|
-
siren: "generic",
|
|
16857
|
-
switch: "generic",
|
|
16858
|
-
doorbell: "button"
|
|
16859
|
-
};
|
|
16860
|
-
function legacyIcon(iconId) {
|
|
16861
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
16862
|
-
}
|
|
16863
|
-
/**
|
|
16864
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
16865
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
16866
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
16867
|
-
*/
|
|
16868
|
-
var CAP_TO_KIND = {
|
|
16869
|
-
contact: "contact",
|
|
16870
|
-
motion: "motion-sensor",
|
|
16871
|
-
smoke: "smoke",
|
|
16872
|
-
flood: "flood",
|
|
16873
|
-
gas: "gas",
|
|
16874
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
16875
|
-
vibration: "vibration",
|
|
16876
|
-
tamper: "tamper",
|
|
16877
|
-
presence: "presence",
|
|
16878
|
-
"enum-sensor": "enum-sensor",
|
|
16879
|
-
"event-emitter": "device-event",
|
|
16880
|
-
"lock-control": "lock",
|
|
16881
|
-
switch: "switch",
|
|
16882
|
-
button: "button",
|
|
16883
|
-
doorbell: "doorbell"
|
|
16884
|
-
};
|
|
16885
|
-
function buildDescriptor(capName, kind) {
|
|
16886
|
-
const t = EVENT_TAXONOMY[kind];
|
|
16887
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
16888
|
-
return {
|
|
16889
|
-
...t,
|
|
16890
|
-
icon: legacyIcon(t.iconId)
|
|
16891
|
-
};
|
|
16892
|
-
}
|
|
16893
|
-
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
16894
17532
|
var CameraPipelineConfigSchema = object({
|
|
16895
17533
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
16896
17534
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -17376,6 +18014,76 @@ method(object({
|
|
|
17376
18014
|
auth: "admin"
|
|
17377
18015
|
});
|
|
17378
18016
|
/**
|
|
18017
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
18018
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
18019
|
+
* caps into per-camera event-kind descriptors.
|
|
18020
|
+
*
|
|
18021
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
18022
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
18023
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
18024
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
18025
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
18026
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
18027
|
+
* eventful cap is missing.
|
|
18028
|
+
*/
|
|
18029
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
18030
|
+
var LEGACY_ICON = {
|
|
18031
|
+
motion: "motion",
|
|
18032
|
+
audio: "audio",
|
|
18033
|
+
person: "person",
|
|
18034
|
+
vehicle: "vehicle",
|
|
18035
|
+
animal: "animal",
|
|
18036
|
+
package: "package",
|
|
18037
|
+
door: "door",
|
|
18038
|
+
pir: "pir",
|
|
18039
|
+
smoke: "smoke",
|
|
18040
|
+
water: "water",
|
|
18041
|
+
button: "button",
|
|
18042
|
+
generic: "generic",
|
|
18043
|
+
gas: "smoke",
|
|
18044
|
+
vibration: "generic",
|
|
18045
|
+
tamper: "generic",
|
|
18046
|
+
presence: "person",
|
|
18047
|
+
lock: "generic",
|
|
18048
|
+
siren: "generic",
|
|
18049
|
+
switch: "generic",
|
|
18050
|
+
doorbell: "button"
|
|
18051
|
+
};
|
|
18052
|
+
function legacyIcon(iconId) {
|
|
18053
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
18054
|
+
}
|
|
18055
|
+
/**
|
|
18056
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
18057
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
18058
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
18059
|
+
*/
|
|
18060
|
+
var CAP_TO_KIND = {
|
|
18061
|
+
contact: "contact",
|
|
18062
|
+
motion: "motion-sensor",
|
|
18063
|
+
smoke: "smoke",
|
|
18064
|
+
flood: "flood",
|
|
18065
|
+
gas: "gas",
|
|
18066
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
18067
|
+
vibration: "vibration",
|
|
18068
|
+
tamper: "tamper",
|
|
18069
|
+
presence: "presence",
|
|
18070
|
+
"enum-sensor": "enum-sensor",
|
|
18071
|
+
"event-emitter": "device-event",
|
|
18072
|
+
"lock-control": "lock",
|
|
18073
|
+
switch: "switch",
|
|
18074
|
+
button: "button",
|
|
18075
|
+
doorbell: "doorbell"
|
|
18076
|
+
};
|
|
18077
|
+
function buildDescriptor(capName, kind) {
|
|
18078
|
+
const t = EVENT_TAXONOMY[kind];
|
|
18079
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
18080
|
+
return {
|
|
18081
|
+
...t,
|
|
18082
|
+
icon: legacyIcon(t.iconId)
|
|
18083
|
+
};
|
|
18084
|
+
}
|
|
18085
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
18086
|
+
/**
|
|
17379
18087
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
17380
18088
|
* package lifecycle (runtime-updatable node packages).
|
|
17381
18089
|
*
|
|
@@ -18830,7 +19538,28 @@ var FaceInfoSchema = object({
|
|
|
18830
19538
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
18831
19539
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
18832
19540
|
* back to the inline `base64` face crop. */
|
|
18833
|
-
keyFrameMediaKey: string().optional()
|
|
19541
|
+
keyFrameMediaKey: string().optional(),
|
|
19542
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
19543
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
19544
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
19545
|
+
* faces that were never auto-recognized. */
|
|
19546
|
+
bestMatchScore: number().optional(),
|
|
19547
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
19548
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
19549
|
+
* legacy rows / runners that reported no native measure. */
|
|
19550
|
+
nativeFaceShortSidePx: number().optional(),
|
|
19551
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
19552
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
19553
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
19554
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
19555
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
19556
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
19557
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
19558
|
+
suggestedIdentityId: string().optional(),
|
|
19559
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
19560
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
19561
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
19562
|
+
suggestedMatchScore: number().optional()
|
|
18834
19563
|
});
|
|
18835
19564
|
var FaceFilterEnum = _enum([
|
|
18836
19565
|
"unassigned",
|
|
@@ -20873,36 +21602,6 @@ Object.freeze({
|
|
|
20873
21602
|
addonId: null,
|
|
20874
21603
|
access: "view"
|
|
20875
21604
|
},
|
|
20876
|
-
"advancedNotifier.deleteRule": {
|
|
20877
|
-
capName: "advanced-notifier",
|
|
20878
|
-
capScope: "system",
|
|
20879
|
-
addonId: null,
|
|
20880
|
-
access: "delete"
|
|
20881
|
-
},
|
|
20882
|
-
"advancedNotifier.getHistory": {
|
|
20883
|
-
capName: "advanced-notifier",
|
|
20884
|
-
capScope: "system",
|
|
20885
|
-
addonId: null,
|
|
20886
|
-
access: "view"
|
|
20887
|
-
},
|
|
20888
|
-
"advancedNotifier.getRules": {
|
|
20889
|
-
capName: "advanced-notifier",
|
|
20890
|
-
capScope: "system",
|
|
20891
|
-
addonId: null,
|
|
20892
|
-
access: "view"
|
|
20893
|
-
},
|
|
20894
|
-
"advancedNotifier.testRule": {
|
|
20895
|
-
capName: "advanced-notifier",
|
|
20896
|
-
capScope: "system",
|
|
20897
|
-
addonId: null,
|
|
20898
|
-
access: "create"
|
|
20899
|
-
},
|
|
20900
|
-
"advancedNotifier.upsertRule": {
|
|
20901
|
-
capName: "advanced-notifier",
|
|
20902
|
-
capScope: "system",
|
|
20903
|
-
addonId: null,
|
|
20904
|
-
access: "create"
|
|
20905
|
-
},
|
|
20906
21605
|
"alarmPanel.arm": {
|
|
20907
21606
|
capName: "alarm-panel",
|
|
20908
21607
|
capScope: "device",
|
|
@@ -21125,6 +21824,12 @@ Object.freeze({
|
|
|
21125
21824
|
addonId: null,
|
|
21126
21825
|
access: "delete"
|
|
21127
21826
|
},
|
|
21827
|
+
"backup.deleteSchedule": {
|
|
21828
|
+
capName: "backup",
|
|
21829
|
+
capScope: "system",
|
|
21830
|
+
addonId: null,
|
|
21831
|
+
access: "delete"
|
|
21832
|
+
},
|
|
21128
21833
|
"backup.getEntries": {
|
|
21129
21834
|
capName: "backup",
|
|
21130
21835
|
capScope: "system",
|
|
@@ -21155,6 +21860,12 @@ Object.freeze({
|
|
|
21155
21860
|
addonId: null,
|
|
21156
21861
|
access: "view"
|
|
21157
21862
|
},
|
|
21863
|
+
"backup.listSchedules": {
|
|
21864
|
+
capName: "backup",
|
|
21865
|
+
capScope: "system",
|
|
21866
|
+
addonId: null,
|
|
21867
|
+
access: "view"
|
|
21868
|
+
},
|
|
21158
21869
|
"backup.previewSchedule": {
|
|
21159
21870
|
capName: "backup",
|
|
21160
21871
|
capScope: "system",
|
|
@@ -21179,6 +21890,12 @@ Object.freeze({
|
|
|
21179
21890
|
addonId: null,
|
|
21180
21891
|
access: "create"
|
|
21181
21892
|
},
|
|
21893
|
+
"backup.upsertSchedule": {
|
|
21894
|
+
capName: "backup",
|
|
21895
|
+
capScope: "system",
|
|
21896
|
+
addonId: null,
|
|
21897
|
+
access: "create"
|
|
21898
|
+
},
|
|
21182
21899
|
"battery.wakeForStream": {
|
|
21183
21900
|
capName: "battery",
|
|
21184
21901
|
capScope: "device",
|
|
@@ -23207,6 +23924,60 @@ Object.freeze({
|
|
|
23207
23924
|
addonId: null,
|
|
23208
23925
|
access: "create"
|
|
23209
23926
|
},
|
|
23927
|
+
"notificationRules.createRule": {
|
|
23928
|
+
capName: "notification-rules",
|
|
23929
|
+
capScope: "system",
|
|
23930
|
+
addonId: null,
|
|
23931
|
+
access: "create"
|
|
23932
|
+
},
|
|
23933
|
+
"notificationRules.deleteRule": {
|
|
23934
|
+
capName: "notification-rules",
|
|
23935
|
+
capScope: "system",
|
|
23936
|
+
addonId: null,
|
|
23937
|
+
access: "delete"
|
|
23938
|
+
},
|
|
23939
|
+
"notificationRules.getConditionCatalog": {
|
|
23940
|
+
capName: "notification-rules",
|
|
23941
|
+
capScope: "system",
|
|
23942
|
+
addonId: null,
|
|
23943
|
+
access: "view"
|
|
23944
|
+
},
|
|
23945
|
+
"notificationRules.getHistory": {
|
|
23946
|
+
capName: "notification-rules",
|
|
23947
|
+
capScope: "system",
|
|
23948
|
+
addonId: null,
|
|
23949
|
+
access: "view"
|
|
23950
|
+
},
|
|
23951
|
+
"notificationRules.getRule": {
|
|
23952
|
+
capName: "notification-rules",
|
|
23953
|
+
capScope: "system",
|
|
23954
|
+
addonId: null,
|
|
23955
|
+
access: "view"
|
|
23956
|
+
},
|
|
23957
|
+
"notificationRules.listRules": {
|
|
23958
|
+
capName: "notification-rules",
|
|
23959
|
+
capScope: "system",
|
|
23960
|
+
addonId: null,
|
|
23961
|
+
access: "view"
|
|
23962
|
+
},
|
|
23963
|
+
"notificationRules.setRuleEnabled": {
|
|
23964
|
+
capName: "notification-rules",
|
|
23965
|
+
capScope: "system",
|
|
23966
|
+
addonId: null,
|
|
23967
|
+
access: "create"
|
|
23968
|
+
},
|
|
23969
|
+
"notificationRules.testRule": {
|
|
23970
|
+
capName: "notification-rules",
|
|
23971
|
+
capScope: "system",
|
|
23972
|
+
addonId: null,
|
|
23973
|
+
access: "create"
|
|
23974
|
+
},
|
|
23975
|
+
"notificationRules.updateRule": {
|
|
23976
|
+
capName: "notification-rules",
|
|
23977
|
+
capScope: "system",
|
|
23978
|
+
addonId: null,
|
|
23979
|
+
access: "create"
|
|
23980
|
+
},
|
|
23210
23981
|
"notifier.cancel": {
|
|
23211
23982
|
capName: "notifier",
|
|
23212
23983
|
capScope: "device",
|
|
@@ -24959,6 +25730,36 @@ Object.freeze({
|
|
|
24959
25730
|
addonId: null,
|
|
24960
25731
|
access: "create"
|
|
24961
25732
|
},
|
|
25733
|
+
"terminalSession.close": {
|
|
25734
|
+
capName: "terminal-session",
|
|
25735
|
+
capScope: "system",
|
|
25736
|
+
addonId: null,
|
|
25737
|
+
access: "create"
|
|
25738
|
+
},
|
|
25739
|
+
"terminalSession.listProfiles": {
|
|
25740
|
+
capName: "terminal-session",
|
|
25741
|
+
capScope: "system",
|
|
25742
|
+
addonId: null,
|
|
25743
|
+
access: "view"
|
|
25744
|
+
},
|
|
25745
|
+
"terminalSession.listSessions": {
|
|
25746
|
+
capName: "terminal-session",
|
|
25747
|
+
capScope: "system",
|
|
25748
|
+
addonId: null,
|
|
25749
|
+
access: "view"
|
|
25750
|
+
},
|
|
25751
|
+
"terminalSession.openSession": {
|
|
25752
|
+
capName: "terminal-session",
|
|
25753
|
+
capScope: "system",
|
|
25754
|
+
addonId: null,
|
|
25755
|
+
access: "create"
|
|
25756
|
+
},
|
|
25757
|
+
"terminalSession.resize": {
|
|
25758
|
+
capName: "terminal-session",
|
|
25759
|
+
capScope: "system",
|
|
25760
|
+
addonId: null,
|
|
25761
|
+
access: "create"
|
|
25762
|
+
},
|
|
24962
25763
|
"toast.onToast": {
|
|
24963
25764
|
capName: "toast",
|
|
24964
25765
|
capScope: "system",
|