@camstack/addon-smtp-nodemailer 1.2.5 → 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/smtp.addon.js +1881 -1632
- package/dist/smtp.addon.mjs +1881 -1632
- package/package.json +1 -1
package/dist/smtp.addon.js
CHANGED
|
@@ -7539,16 +7539,23 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7539
7539
|
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7540
7540
|
* FRESH install:
|
|
7541
7541
|
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7542
|
-
* the appData volume. Right for small/durable data (
|
|
7542
|
+
* the appData volume. Right for small/durable data (logs, models).
|
|
7543
7543
|
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7544
7544
|
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7545
7545
|
* (recordings, event media) that should stay off the appData disk.
|
|
7546
|
+
* - `'backup'` — the dedicated backup volume (`CAMSTACK_BACKUP_ROOT`, default
|
|
7547
|
+
* `/backups` in the image) so archives live on their own mount rather than
|
|
7548
|
+
* filling the appData disk. Falls back to the data root when unset.
|
|
7546
7549
|
*
|
|
7547
7550
|
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7548
7551
|
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7549
7552
|
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7550
7553
|
*/
|
|
7551
|
-
defaultRoot: _enum([
|
|
7554
|
+
defaultRoot: _enum([
|
|
7555
|
+
"data",
|
|
7556
|
+
"media",
|
|
7557
|
+
"backup"
|
|
7558
|
+
]).optional()
|
|
7552
7559
|
});
|
|
7553
7560
|
var DecoderStatsSchema = object({
|
|
7554
7561
|
inputFps: number(),
|
|
@@ -8899,92 +8906,730 @@ var AccessoryKind = {
|
|
|
8899
8906
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
8900
8907
|
DeviceFeature.BatteryOperated;
|
|
8901
8908
|
/**
|
|
8902
|
-
*
|
|
8903
|
-
*
|
|
8904
|
-
*
|
|
8905
|
-
*
|
|
8906
|
-
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
8907
|
-
* their own slices.
|
|
8909
|
+
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
8910
|
+
* motion-zones, and the detection zones/lines editor all speak this one
|
|
8911
|
+
* language so a single drawing-plane editor and the providers stay
|
|
8912
|
+
* decoupled from each cap's storage.
|
|
8908
8913
|
*
|
|
8909
|
-
*
|
|
8910
|
-
*
|
|
8911
|
-
* `
|
|
8912
|
-
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
8913
|
-
* consumers reach the same data via the `device-state` cap router
|
|
8914
|
-
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
8914
|
+
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
8915
|
+
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
8916
|
+
* advertises it via `supportedShapes` in its `getOptions`.
|
|
8915
8917
|
*/
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
* stream-health, Reolink reads firmware push events, ONVIF tracks
|
|
8921
|
-
* ping responses. This cap intentionally does NOT prescribe which
|
|
8922
|
-
* signal drives the flag.
|
|
8923
|
-
*/
|
|
8924
|
-
online: boolean(),
|
|
8925
|
-
/** Ms epoch of the last `online` transition. Lets consumers tell
|
|
8926
|
-
* apart "just came online" from "still online". */
|
|
8927
|
-
lastChangedAt: number()
|
|
8918
|
+
/** A normalized 0..1 point (top-left origin). */
|
|
8919
|
+
var MaskPointSchema = object({
|
|
8920
|
+
x: number(),
|
|
8921
|
+
y: number()
|
|
8928
8922
|
});
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8923
|
+
/** Axis-aligned rectangle (normalized 0..1). */
|
|
8924
|
+
var MaskRectShapeSchema = object({
|
|
8925
|
+
kind: literal("rect"),
|
|
8926
|
+
x: number(),
|
|
8927
|
+
y: number(),
|
|
8928
|
+
width: number(),
|
|
8929
|
+
height: number()
|
|
8930
|
+
});
|
|
8931
|
+
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
8932
|
+
var MaskPolygonShapeSchema = object({
|
|
8933
|
+
kind: literal("polygon"),
|
|
8934
|
+
points: array(MaskPointSchema)
|
|
8935
|
+
});
|
|
8936
|
+
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
8937
|
+
var MaskGridShapeSchema = object({
|
|
8938
|
+
kind: literal("grid"),
|
|
8939
|
+
gridWidth: number(),
|
|
8940
|
+
gridHeight: number(),
|
|
8941
|
+
cells: array(boolean())
|
|
8942
|
+
});
|
|
8943
|
+
discriminatedUnion("kind", [
|
|
8944
|
+
MaskRectShapeSchema,
|
|
8945
|
+
MaskPolygonShapeSchema,
|
|
8946
|
+
MaskGridShapeSchema,
|
|
8947
|
+
object({
|
|
8948
|
+
kind: literal("line"),
|
|
8949
|
+
points: array(MaskPointSchema)
|
|
8950
|
+
})
|
|
8951
|
+
]);
|
|
8952
|
+
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
8953
|
+
var MaskShapeKindSchema = _enum([
|
|
8954
|
+
"rect",
|
|
8955
|
+
"polygon",
|
|
8956
|
+
"grid",
|
|
8957
|
+
"line"
|
|
8958
|
+
]);
|
|
8959
|
+
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
8960
|
+
var MaskPolygonVerticesSchema = object({
|
|
8961
|
+
min: number(),
|
|
8962
|
+
max: number()
|
|
8963
|
+
});
|
|
8964
|
+
/** Grid dimensions when a cap supports 'grid'. */
|
|
8965
|
+
var MaskGridDimsSchema = object({
|
|
8966
|
+
width: number(),
|
|
8967
|
+
height: number()
|
|
8932
8968
|
});
|
|
8933
8969
|
/**
|
|
8934
|
-
*
|
|
8935
|
-
* truth about what a device CAN do — which the kernel uses to:
|
|
8936
|
-
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
8937
|
-
* based on what the firmware actually advertises).
|
|
8938
|
-
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
8939
|
-
* `device-manager.listAll`.
|
|
8940
|
-
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
8941
|
-
* to register on the device's capability surface.
|
|
8970
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
8942
8971
|
*
|
|
8943
|
-
*
|
|
8944
|
-
*
|
|
8945
|
-
* accessory reconciliation). Consumers read via:
|
|
8946
|
-
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
8972
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
8973
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
8947
8974
|
*
|
|
8948
|
-
*
|
|
8949
|
-
*
|
|
8950
|
-
*
|
|
8975
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
8976
|
+
* `notification-center` module), hooked on the durable persistence
|
|
8977
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
8978
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
8979
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
8980
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
8981
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
8982
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
8983
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
8984
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
8985
|
+
* target kind's own caps/degrade engine).
|
|
8951
8986
|
*
|
|
8952
|
-
*
|
|
8953
|
-
*
|
|
8954
|
-
*
|
|
8955
|
-
*
|
|
8987
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
8988
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
8989
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
8990
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
8991
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
8992
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
8993
|
+
* P2+ (see spec §7).
|
|
8994
|
+
*
|
|
8995
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
8996
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
8997
|
+
* schema/interface drift is explicitly not repeated).
|
|
8956
8998
|
*/
|
|
8957
|
-
|
|
8999
|
+
/**
|
|
9000
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
9001
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
9002
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
9003
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
9004
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
9005
|
+
* change of a LINKED device, one row per linked camera)
|
|
9006
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
9007
|
+
* delivery / pick-up)
|
|
9008
|
+
*
|
|
9009
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
9010
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
9011
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
9012
|
+
* one trigger.
|
|
9013
|
+
*/
|
|
9014
|
+
var NcDeliverySchema = _enum([
|
|
9015
|
+
"immediate",
|
|
9016
|
+
"track-end",
|
|
9017
|
+
"device-event",
|
|
9018
|
+
"package-event"
|
|
9019
|
+
]);
|
|
9020
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
9021
|
+
var NcScheduleSchema = object({
|
|
9022
|
+
windows: array(object({
|
|
9023
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
9024
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
9025
|
+
startMinute: number().int().min(0).max(1439),
|
|
9026
|
+
endMinute: number().int().min(0).max(1439)
|
|
9027
|
+
})).min(1),
|
|
9028
|
+
/** IANA timezone; default = hub host timezone. */
|
|
9029
|
+
timezone: string().optional(),
|
|
9030
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
9031
|
+
invert: boolean().optional()
|
|
9032
|
+
});
|
|
9033
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
9034
|
+
var NcPlateMatcherSchema = object({
|
|
9035
|
+
values: array(string().min(1)).min(1),
|
|
9036
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
9037
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
9038
|
+
});
|
|
9039
|
+
/**
|
|
9040
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
9041
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
9042
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
9043
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
9044
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
9045
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
9046
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
9047
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
9048
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
9049
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
9050
|
+
* (declared SQLite collection, reseeded on boot).
|
|
9051
|
+
*/
|
|
9052
|
+
var NcOccupancyConditionSchema = object({
|
|
9053
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
9054
|
+
zoneId: string().optional(),
|
|
9055
|
+
/** Object class to count; absent = any class. */
|
|
9056
|
+
className: string().optional(),
|
|
9057
|
+
op: _enum([
|
|
9058
|
+
"became-occupied",
|
|
9059
|
+
"became-free",
|
|
9060
|
+
">=",
|
|
9061
|
+
"<="
|
|
9062
|
+
]).default("became-occupied"),
|
|
9063
|
+
count: number().int().min(0).default(1),
|
|
9064
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
9065
|
+
});
|
|
9066
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
9067
|
+
var NcZoneConditionSchema = object({
|
|
9068
|
+
ids: array(string().min(1)).min(1),
|
|
9069
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
9070
|
+
match: _enum(["any", "all"]).default("any")
|
|
9071
|
+
});
|
|
9072
|
+
/**
|
|
9073
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
9074
|
+
* membership lists are OR within the list (spec §2.3).
|
|
9075
|
+
*/
|
|
9076
|
+
var NcConditionsSchema = object({
|
|
9077
|
+
/** Device scope — absent = all devices. */
|
|
9078
|
+
devices: array(number()).optional(),
|
|
9079
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
9080
|
+
classes: array(string().min(1)).optional(),
|
|
9081
|
+
/** Veto classes — any overlap fails the rule. */
|
|
9082
|
+
classesExclude: array(string().min(1)).optional(),
|
|
9083
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
9084
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
9085
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
9086
|
+
zones: NcZoneConditionSchema.optional(),
|
|
9087
|
+
/** Veto zones — any hit fails the rule. */
|
|
9088
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
8958
9089
|
/**
|
|
8959
|
-
*
|
|
8960
|
-
*
|
|
8961
|
-
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
8962
|
-
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
8963
|
-
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9090
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
9091
|
+
* (identity name / plate text / subclass).
|
|
8964
9092
|
*/
|
|
8965
|
-
|
|
9093
|
+
labelEquals: array(string().min(1)).optional(),
|
|
8966
9094
|
/**
|
|
8967
|
-
*
|
|
8968
|
-
*
|
|
8969
|
-
*
|
|
9095
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
9096
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
9097
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
8970
9098
|
*/
|
|
8971
|
-
|
|
8972
|
-
/**
|
|
8973
|
-
|
|
8974
|
-
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
8975
|
-
channelCount: number().nullable(),
|
|
9099
|
+
identities: array(string().min(1)).optional(),
|
|
9100
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
9101
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
8976
9102
|
/**
|
|
8977
|
-
*
|
|
8978
|
-
*
|
|
8979
|
-
*
|
|
8980
|
-
*
|
|
9103
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
9104
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
9105
|
+
* identity display name). A record with NO label passes (nothing to
|
|
9106
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
8981
9107
|
*/
|
|
8982
|
-
|
|
9108
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
8983
9109
|
/**
|
|
8984
|
-
*
|
|
8985
|
-
*
|
|
8986
|
-
*
|
|
8987
|
-
|
|
9110
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
9111
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
9112
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
9113
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
9114
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
9115
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
9116
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
9117
|
+
*/
|
|
9118
|
+
minImportance: number().min(0).max(1).optional(),
|
|
9119
|
+
/**
|
|
9120
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
9121
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
9122
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
9123
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
9124
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
9125
|
+
*/
|
|
9126
|
+
minDwellSeconds: number().min(0).optional(),
|
|
9127
|
+
/**
|
|
9128
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
9129
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
9130
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
9131
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
9132
|
+
* tracks carry `sensor`.
|
|
9133
|
+
*/
|
|
9134
|
+
source: _enum([
|
|
9135
|
+
"pipeline",
|
|
9136
|
+
"onboard",
|
|
9137
|
+
"sensor",
|
|
9138
|
+
"any"
|
|
9139
|
+
]).optional(),
|
|
9140
|
+
/**
|
|
9141
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
9142
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
9143
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
9144
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
9145
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
9146
|
+
*
|
|
9147
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
9148
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
9149
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
9150
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
9151
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
9152
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
9153
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
9154
|
+
* one track the higher of the two is used. A track that ended with no
|
|
9155
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
9156
|
+
* closed for it (an un-recognized subject).
|
|
9157
|
+
*/
|
|
9158
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
9159
|
+
/**
|
|
9160
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
9161
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
9162
|
+
* against the token carried on the device-event subject (extracted from the
|
|
9163
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
9164
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
9165
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
9166
|
+
*/
|
|
9167
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
9168
|
+
/**
|
|
9169
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
9170
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
9171
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
9172
|
+
*/
|
|
9173
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
9174
|
+
/**
|
|
9175
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
9176
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
9177
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
9178
|
+
* on the package-event trigger).
|
|
9179
|
+
*/
|
|
9180
|
+
packagePhase: _enum([
|
|
9181
|
+
"delivered",
|
|
9182
|
+
"picked-up",
|
|
9183
|
+
"both"
|
|
9184
|
+
]).optional(),
|
|
9185
|
+
/**
|
|
9186
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
9187
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
9188
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
9189
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
9190
|
+
*/
|
|
9191
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
9192
|
+
/**
|
|
9193
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
9194
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
9195
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
9196
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
9197
|
+
*/
|
|
9198
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
9199
|
+
});
|
|
9200
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
9201
|
+
var NcRuleTargetSchema = object({
|
|
9202
|
+
/** `notification-output` Target id. */
|
|
9203
|
+
targetId: string().min(1),
|
|
9204
|
+
/**
|
|
9205
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
9206
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
9207
|
+
* degrade engine drops what the backend can't render.
|
|
9208
|
+
*/
|
|
9209
|
+
params: record(string(), unknown()).optional()
|
|
9210
|
+
});
|
|
9211
|
+
/**
|
|
9212
|
+
* Media attachment policy (P1 still-image subset).
|
|
9213
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
9214
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
9215
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
9216
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
9217
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
9218
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
9219
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
9220
|
+
* name), so the choice never drifts from the record that fired it.
|
|
9221
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
9222
|
+
* - `none` — no attachment.
|
|
9223
|
+
*/
|
|
9224
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
9225
|
+
"best",
|
|
9226
|
+
"best-matching",
|
|
9227
|
+
"keyFrame",
|
|
9228
|
+
"none"
|
|
9229
|
+
]).default("best") });
|
|
9230
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
9231
|
+
var NcThrottleSchema = object({
|
|
9232
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
9233
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
9234
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
9235
|
+
});
|
|
9236
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
9237
|
+
var NcRuleInputSchema = object({
|
|
9238
|
+
name: string().min(1).max(200),
|
|
9239
|
+
enabled: boolean().default(true),
|
|
9240
|
+
delivery: NcDeliverySchema,
|
|
9241
|
+
conditions: NcConditionsSchema.default({}),
|
|
9242
|
+
schedule: NcScheduleSchema.optional(),
|
|
9243
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
9244
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
9245
|
+
throttle: NcThrottleSchema.default({
|
|
9246
|
+
cooldownSec: 60,
|
|
9247
|
+
scope: "rule-device"
|
|
9248
|
+
}),
|
|
9249
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
9250
|
+
template: object({
|
|
9251
|
+
title: string().max(500).optional(),
|
|
9252
|
+
body: string().max(2e3).optional()
|
|
9253
|
+
}).optional(),
|
|
9254
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9255
|
+
priority: number().int().min(1).max(5).default(3),
|
|
9256
|
+
/**
|
|
9257
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
9258
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
9259
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
9260
|
+
*/
|
|
9261
|
+
ownerUserId: string().optional()
|
|
9262
|
+
});
|
|
9263
|
+
/**
|
|
9264
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
9265
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
9266
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
9267
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
9268
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
9269
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
9270
|
+
* `updateRule` patch.
|
|
9271
|
+
*/
|
|
9272
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
9273
|
+
/** A persisted rule. */
|
|
9274
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
9275
|
+
id: string(),
|
|
9276
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
9277
|
+
createdBy: string(),
|
|
9278
|
+
createdAt: number(),
|
|
9279
|
+
updatedAt: number(),
|
|
9280
|
+
/**
|
|
9281
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
9282
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
9283
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
9284
|
+
*/
|
|
9285
|
+
disabledTargetIds: array(string()).default([])
|
|
9286
|
+
});
|
|
9287
|
+
var NcTestResultSchema = object({
|
|
9288
|
+
recordId: string(),
|
|
9289
|
+
recordKind: _enum([
|
|
9290
|
+
"object-event",
|
|
9291
|
+
"track",
|
|
9292
|
+
"device-event",
|
|
9293
|
+
"package-event"
|
|
9294
|
+
]),
|
|
9295
|
+
deviceId: number(),
|
|
9296
|
+
timestamp: number(),
|
|
9297
|
+
wouldFire: boolean(),
|
|
9298
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
9299
|
+
failedCondition: string().optional(),
|
|
9300
|
+
className: string().optional(),
|
|
9301
|
+
label: string().optional()
|
|
9302
|
+
});
|
|
9303
|
+
var NcConditionDescriptorSchema = object({
|
|
9304
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
9305
|
+
id: string(),
|
|
9306
|
+
group: _enum([
|
|
9307
|
+
"scope",
|
|
9308
|
+
"class",
|
|
9309
|
+
"zones",
|
|
9310
|
+
"quality",
|
|
9311
|
+
"label",
|
|
9312
|
+
"schedule",
|
|
9313
|
+
"device",
|
|
9314
|
+
"package",
|
|
9315
|
+
"occupancy"
|
|
9316
|
+
]),
|
|
9317
|
+
label: string(),
|
|
9318
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
9319
|
+
valueType: _enum([
|
|
9320
|
+
"deviceIdList",
|
|
9321
|
+
"stringList",
|
|
9322
|
+
"number01",
|
|
9323
|
+
"number",
|
|
9324
|
+
"sourceSelect",
|
|
9325
|
+
"zoneSelection",
|
|
9326
|
+
"zoneIdList",
|
|
9327
|
+
"schedule",
|
|
9328
|
+
"plateMatcher",
|
|
9329
|
+
"packagePhase",
|
|
9330
|
+
"polygonDraw",
|
|
9331
|
+
"occupancy"
|
|
9332
|
+
]),
|
|
9333
|
+
operator: _enum([
|
|
9334
|
+
"in",
|
|
9335
|
+
"notIn",
|
|
9336
|
+
"anyOf",
|
|
9337
|
+
"allOf",
|
|
9338
|
+
"gte",
|
|
9339
|
+
"fuzzyIn",
|
|
9340
|
+
"withinSchedule"
|
|
9341
|
+
]),
|
|
9342
|
+
/** Which delivery kinds the condition applies to. */
|
|
9343
|
+
appliesTo: array(NcDeliverySchema),
|
|
9344
|
+
phase: string(),
|
|
9345
|
+
description: string().optional()
|
|
9346
|
+
});
|
|
9347
|
+
/**
|
|
9348
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
9349
|
+
* durable outbox row's own status (single source of truth):
|
|
9350
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
9351
|
+
* - `sent` — delivered (terminal)
|
|
9352
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
9353
|
+
* backend rejection / a deleted target (terminal; carries
|
|
9354
|
+
* the failure `error`)
|
|
9355
|
+
*
|
|
9356
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
9357
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
9358
|
+
*/
|
|
9359
|
+
var NcHistoryStatusSchema = _enum([
|
|
9360
|
+
"pending",
|
|
9361
|
+
"sent",
|
|
9362
|
+
"dead"
|
|
9363
|
+
]);
|
|
9364
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
9365
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
9366
|
+
"object-event",
|
|
9367
|
+
"track-end",
|
|
9368
|
+
"device-event",
|
|
9369
|
+
"package-event"
|
|
9370
|
+
]);
|
|
9371
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
9372
|
+
var NcHistorySubjectSchema = object({
|
|
9373
|
+
className: string(),
|
|
9374
|
+
label: string().optional(),
|
|
9375
|
+
confidence: number().optional(),
|
|
9376
|
+
zones: array(string()),
|
|
9377
|
+
timestamp: number()
|
|
9378
|
+
});
|
|
9379
|
+
/**
|
|
9380
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
9381
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
9382
|
+
* NO second write path, so history can never drift from delivery state).
|
|
9383
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
9384
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
9385
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
9386
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
9387
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
9388
|
+
* P1 (admin scope only).
|
|
9389
|
+
*/
|
|
9390
|
+
var NcHistoryEntrySchema = object({
|
|
9391
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
9392
|
+
id: string(),
|
|
9393
|
+
ruleId: string(),
|
|
9394
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
9395
|
+
ruleName: string(),
|
|
9396
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
9397
|
+
delivery: NcDeliverySchema,
|
|
9398
|
+
targetId: string(),
|
|
9399
|
+
deviceId: number(),
|
|
9400
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
9401
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
9402
|
+
recordId: string(),
|
|
9403
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
9404
|
+
trackId: string().optional(),
|
|
9405
|
+
status: NcHistoryStatusSchema,
|
|
9406
|
+
/** Delivery attempts made so far. */
|
|
9407
|
+
attempts: number().int(),
|
|
9408
|
+
/** Fire time (outbox enqueue). */
|
|
9409
|
+
createdAt: number(),
|
|
9410
|
+
/** Last transition time (terminal for sent / dead). */
|
|
9411
|
+
updatedAt: number(),
|
|
9412
|
+
/** Failure detail — present on a `dead` row. */
|
|
9413
|
+
error: string().optional(),
|
|
9414
|
+
subject: NcHistorySubjectSchema
|
|
9415
|
+
});
|
|
9416
|
+
/**
|
|
9417
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
9418
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
9419
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
9420
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
9421
|
+
*/
|
|
9422
|
+
var NcHistoryFilterSchema = object({
|
|
9423
|
+
ruleId: string().optional(),
|
|
9424
|
+
deviceId: number().optional(),
|
|
9425
|
+
status: NcHistoryStatusSchema.optional(),
|
|
9426
|
+
since: number().optional(),
|
|
9427
|
+
until: number().optional(),
|
|
9428
|
+
limit: number().int().min(1).max(500).default(100)
|
|
9429
|
+
});
|
|
9430
|
+
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 }), {
|
|
9431
|
+
kind: "mutation",
|
|
9432
|
+
auth: "admin",
|
|
9433
|
+
caller: "required"
|
|
9434
|
+
}), method(object({
|
|
9435
|
+
ruleId: string(),
|
|
9436
|
+
patch: NcRulePatchSchema
|
|
9437
|
+
}), object({ rule: NcRuleSchema }), {
|
|
9438
|
+
kind: "mutation",
|
|
9439
|
+
auth: "admin",
|
|
9440
|
+
caller: "required"
|
|
9441
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
9442
|
+
kind: "mutation",
|
|
9443
|
+
auth: "admin"
|
|
9444
|
+
}), method(object({
|
|
9445
|
+
ruleId: string(),
|
|
9446
|
+
enabled: boolean()
|
|
9447
|
+
}), object({ success: literal(true) }), {
|
|
9448
|
+
kind: "mutation",
|
|
9449
|
+
auth: "admin"
|
|
9450
|
+
}), method(object({
|
|
9451
|
+
rule: NcRuleInputSchema,
|
|
9452
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
9453
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
9454
|
+
kind: "mutation",
|
|
9455
|
+
auth: "admin"
|
|
9456
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
9457
|
+
/**
|
|
9458
|
+
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
9459
|
+
*
|
|
9460
|
+
* Spec: `docs/superpowers/specs/2026-07-24-nc-occupancy-timelapse-design.md`
|
|
9461
|
+
* §3.2/§3.3.
|
|
9462
|
+
*
|
|
9463
|
+
* Deliberately NOT a capability definition and NOT an `NcRule`:
|
|
9464
|
+
* - Every `NcDelivery` member is a *persisted-pipeline-record* trigger. A
|
|
9465
|
+
* timelapse fires on a SCHEDULE WINDOW BOUNDARY, evaluates no pipeline
|
|
9466
|
+
* record, and produces a video it assembled itself — so it rides no
|
|
9467
|
+
* delivery-enum member (the enum is frozen) and no cap method. This file is
|
|
9468
|
+
* a plain typed schema; it does NOT go through `npm run codegen`.
|
|
9469
|
+
* - It shares only the delivery leg (`notification-output.send`) and the
|
|
9470
|
+
* persistence/ownership patterns with the Notification Center, reusing
|
|
9471
|
+
* {@link NcScheduleSchema} (weekly windows, midnight-crossing, invertible)
|
|
9472
|
+
* and {@link NcRuleTargetSchema} (target ref + passthrough params).
|
|
9473
|
+
*
|
|
9474
|
+
* Ownership is SERVER-DERIVED. `ownerUserId` / `createdBy` / `createdAt` /
|
|
9475
|
+
* `updatedAt` / `id` / `lastGeneratedAt` live on the PERSISTED rule only —
|
|
9476
|
+
* {@link TimelapseRuleInputSchema} and {@link TimelapseRulePatchSchema} do not
|
|
9477
|
+
* carry them, so a forged client payload can never claim or re-own a rule
|
|
9478
|
+
* (Zod strips unknown keys). The store stamps them from the resolved caller.
|
|
9479
|
+
*/
|
|
9480
|
+
/** `{{var}}` templating over camera/rule/time — same vocabulary as `NcRule`. */
|
|
9481
|
+
var TimelapseTemplateSchema = object({
|
|
9482
|
+
title: string().max(500).optional(),
|
|
9483
|
+
body: string().max(2e3).optional()
|
|
9484
|
+
});
|
|
9485
|
+
var NameField = string().min(1).max(200);
|
|
9486
|
+
var DeviceIdsField = array(number()).min(1);
|
|
9487
|
+
var CadenceSecField = number().int().min(2).max(3600);
|
|
9488
|
+
var FramerateField = number().int().min(1).max(60);
|
|
9489
|
+
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
9490
|
+
var PriorityField = number().int().min(1).max(5);
|
|
9491
|
+
/**
|
|
9492
|
+
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
9493
|
+
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
9494
|
+
* here (see the ownership note above).
|
|
9495
|
+
*/
|
|
9496
|
+
var TimelapseRuleInputSchema = object({
|
|
9497
|
+
name: NameField,
|
|
9498
|
+
enabled: boolean().default(true),
|
|
9499
|
+
/** Cameras sampled by this rule — one scratch dir + one artifact per device. */
|
|
9500
|
+
deviceIds: DeviceIdsField,
|
|
9501
|
+
/**
|
|
9502
|
+
* Activation window(s). REQUIRED (unlike `NcRule`, where an absent schedule
|
|
9503
|
+
* means "always active"): a timelapse is defined by its window boundaries —
|
|
9504
|
+
* open clears the scratch, close assembles and delivers.
|
|
9505
|
+
*/
|
|
9506
|
+
schedule: NcScheduleSchema,
|
|
9507
|
+
/** Force-snapshot cadence inside the window, seconds (predecessor parity). */
|
|
9508
|
+
cadenceSec: CadenceSecField.default(15),
|
|
9509
|
+
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
9510
|
+
framerate: FramerateField.default(10),
|
|
9511
|
+
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
9512
|
+
targets: TargetsField,
|
|
9513
|
+
template: TimelapseTemplateSchema.optional(),
|
|
9514
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
9515
|
+
priority: PriorityField.default(3)
|
|
9516
|
+
});
|
|
9517
|
+
object({
|
|
9518
|
+
name: NameField.optional(),
|
|
9519
|
+
enabled: boolean().optional(),
|
|
9520
|
+
deviceIds: DeviceIdsField.optional(),
|
|
9521
|
+
schedule: NcScheduleSchema.optional(),
|
|
9522
|
+
cadenceSec: CadenceSecField.optional(),
|
|
9523
|
+
framerate: FramerateField.optional(),
|
|
9524
|
+
targets: TargetsField.optional(),
|
|
9525
|
+
template: TimelapseTemplateSchema.nullable().optional(),
|
|
9526
|
+
priority: PriorityField.optional()
|
|
9527
|
+
});
|
|
9528
|
+
TimelapseRuleInputSchema.extend({
|
|
9529
|
+
id: string(),
|
|
9530
|
+
/**
|
|
9531
|
+
* Ownership/visibility key. Absent = admin/global rule (visible to all).
|
|
9532
|
+
* Present = personal rule owned by this userId. Server-stamped from the
|
|
9533
|
+
* resolved caller; never trusted from a client payload.
|
|
9534
|
+
*/
|
|
9535
|
+
ownerUserId: string().optional(),
|
|
9536
|
+
/**
|
|
9537
|
+
* Epoch-ms of the last successful generation — the 1-hour re-generation
|
|
9538
|
+
* guard's durable state (predecessor parity). Absent = never generated.
|
|
9539
|
+
*/
|
|
9540
|
+
lastGeneratedAt: number().optional(),
|
|
9541
|
+
/** userId of the caller who created the rule (server-stamped). */
|
|
9542
|
+
createdBy: string(),
|
|
9543
|
+
createdAt: number(),
|
|
9544
|
+
updatedAt: number()
|
|
9545
|
+
});
|
|
9546
|
+
/**
|
|
9547
|
+
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
9548
|
+
* for every device, regardless of provider — the kernel needs a uniform
|
|
9549
|
+
* cap-keyed slice for the basic device flags every consumer expects to
|
|
9550
|
+
* read across processes (the `online` flag in particular). Driver-specific
|
|
9551
|
+
* caps (`battery`, `doorbell`, …) carry their domain-specific state on
|
|
9552
|
+
* their own slices.
|
|
9553
|
+
*
|
|
9554
|
+
* Pattern is identical to `battery`: schema-bearing `runtimeState`,
|
|
9555
|
+
* empty `methods`, single change event. Reads land at
|
|
9556
|
+
* `runtimeState.getCapState('device-status')`; writes at
|
|
9557
|
+
* `runtimeState.setCapState('device-status', …)`. Cross-process
|
|
9558
|
+
* consumers reach the same data via the `device-state` cap router
|
|
9559
|
+
* (`getCapSlice({deviceId, capName: 'device-status'})`).
|
|
9560
|
+
*/
|
|
9561
|
+
var DeviceStatusSchema = object({
|
|
9562
|
+
/**
|
|
9563
|
+
* Device-level liveness. Drivers flip via `markOnline(boolean)` on
|
|
9564
|
+
* `BaseDevice`. Provider semantics vary — RTSP aggregates broker
|
|
9565
|
+
* stream-health, Reolink reads firmware push events, ONVIF tracks
|
|
9566
|
+
* ping responses. This cap intentionally does NOT prescribe which
|
|
9567
|
+
* signal drives the flag.
|
|
9568
|
+
*/
|
|
9569
|
+
online: boolean(),
|
|
9570
|
+
/** Ms epoch of the last `online` transition. Lets consumers tell
|
|
9571
|
+
* apart "just came online" from "still online". */
|
|
9572
|
+
lastChangedAt: number()
|
|
9573
|
+
});
|
|
9574
|
+
object({
|
|
9575
|
+
deviceId: number(),
|
|
9576
|
+
status: DeviceStatusSchema
|
|
9577
|
+
});
|
|
9578
|
+
/**
|
|
9579
|
+
* Per-device feature/identity probe slice. Holds the runtime-resolved
|
|
9580
|
+
* truth about what a device CAN do — which the kernel uses to:
|
|
9581
|
+
* 1. Reconcile accessory children (hub-children spawn siren/floodlight/PIR
|
|
9582
|
+
* based on what the firmware actually advertises).
|
|
9583
|
+
* 2. Compute the public `features: DeviceFeature[]` array surfaced via
|
|
9584
|
+
* `device-manager.listAll`.
|
|
9585
|
+
* 3. Decide which optional caps (PTZ, intercom, doorbell, battery, …)
|
|
9586
|
+
* to register on the device's capability surface.
|
|
9587
|
+
*
|
|
9588
|
+
* Auto-registered by `BaseDevice` for every device. Drivers populate the
|
|
9589
|
+
* slice from `onProbe()` (kernel calls it once after register, before
|
|
9590
|
+
* accessory reconciliation). Consumers read via:
|
|
9591
|
+
* `runtimeState.getCapState<FeatureProbeStatus>('feature-probe')`
|
|
9592
|
+
*
|
|
9593
|
+
* `flags` is an open record so each driver carries its own keys without
|
|
9594
|
+
* a centralized schema bottleneck — Reolink writes `hasPtz/hasIntercom`,
|
|
9595
|
+
* Hikvision writes `hasSupplementalLight/hasAlarmIo`, etc.
|
|
9596
|
+
*
|
|
9597
|
+
* Replaces the older driver-local `deviceCache.has*` blob: the per-device
|
|
9598
|
+
* config is for operator-edited overrides + UI snapshots; runtime probe
|
|
9599
|
+
* results belong in runtime-state where the kernel handles persistence,
|
|
9600
|
+
* cross-process mirroring, and reactive updates.
|
|
9601
|
+
*/
|
|
9602
|
+
var FeatureProbeStatusSchema = object({
|
|
9603
|
+
/**
|
|
9604
|
+
* Driver-specific flag bag. Each driver picks its own key names — the
|
|
9605
|
+
* cap deliberately does NOT enforce a closed enum here. Reolink keys:
|
|
9606
|
+
* `hasPtz`, `hasIntercom`, `hasDoorbell`, `hasFloodlight`, `hasSiren`,
|
|
9607
|
+
* `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
|
|
9608
|
+
* `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
|
|
9609
|
+
*/
|
|
9610
|
+
flags: record(string(), unknown()),
|
|
9611
|
+
/**
|
|
9612
|
+
* Coarse driver-classification — lets cross-process consumers tell apart
|
|
9613
|
+
* cameras / battery-cams / NVRs without re-running the probe. `null`
|
|
9614
|
+
* before the first probe completes.
|
|
9615
|
+
*/
|
|
9616
|
+
deviceType: string().nullable(),
|
|
9617
|
+
/** Camera/firmware model string. `null` when the firmware doesn't expose it. */
|
|
9618
|
+
model: string().nullable(),
|
|
9619
|
+
/** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
|
|
9620
|
+
channelCount: number().nullable(),
|
|
9621
|
+
/**
|
|
9622
|
+
* Ms epoch of the last SUCCESSFUL probe. `0` before the first probe
|
|
9623
|
+
* completes — drivers' `getAccessoryChildren()` should treat zero as
|
|
9624
|
+
* "probe not done yet, return empty" so accessories aren't spawned
|
|
9625
|
+
* before the firmware is queried.
|
|
9626
|
+
*/
|
|
9627
|
+
lastProbedAt: number(),
|
|
9628
|
+
/**
|
|
9629
|
+
* Framework convention: every runtime-state slice carries this for the
|
|
9630
|
+
* createRuntimeStateBridge stale-check helper. We keep it in sync with
|
|
9631
|
+
* `lastProbedAt` on every write.
|
|
9632
|
+
*/
|
|
8988
9633
|
lastFetchedAt: number()
|
|
8989
9634
|
});
|
|
8990
9635
|
object({
|
|
@@ -11842,101 +12487,40 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
11842
12487
|
}), object({ details: array(DetailResultSchema) }).nullable(), { kind: "mutation" });
|
|
11843
12488
|
object({
|
|
11844
12489
|
detected: boolean(),
|
|
11845
|
-
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
11846
|
-
lastDetectedAt: number().nullable(),
|
|
11847
|
-
/**
|
|
11848
|
-
* Ms after which `detected` auto-reverts to false if no fresh push
|
|
11849
|
-
* arrives. Null means the provider leaves detected state until a
|
|
11850
|
-
* native "clear" event.
|
|
11851
|
-
*/
|
|
11852
|
-
autoClearAfterMs: number().nullable()
|
|
11853
|
-
});
|
|
11854
|
-
object({
|
|
11855
|
-
deviceId: number(),
|
|
11856
|
-
detected: boolean(),
|
|
11857
|
-
timestamp: number(),
|
|
11858
|
-
source: MotionSourceEnum,
|
|
11859
|
-
regions: array(MotionRegionSchema).readonly().optional()
|
|
11860
|
-
});
|
|
11861
|
-
DeviceType.Camera, DeviceType.Sensor, method(object({ deviceId: number() }), boolean());
|
|
11862
|
-
object({
|
|
11863
|
-
enabled: boolean(),
|
|
11864
|
-
/** Ms epoch of the last operator-driven change. */
|
|
11865
|
-
lastChangedAt: number()
|
|
11866
|
-
}).extend({
|
|
11867
|
-
/** Ms epoch of the last successful camera fetch (0 = never). */
|
|
11868
|
-
lastFetchedAt: number() });
|
|
11869
|
-
DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
11870
|
-
deviceId: number().int().nonnegative(),
|
|
11871
|
-
enabled: boolean()
|
|
11872
|
-
}), _void(), {
|
|
11873
|
-
kind: "mutation",
|
|
11874
|
-
auth: "admin"
|
|
11875
|
-
}), object({
|
|
11876
|
-
deviceId: number(),
|
|
11877
|
-
enabled: boolean(),
|
|
11878
|
-
lastChangedAt: number()
|
|
11879
|
-
});
|
|
11880
|
-
/**
|
|
11881
|
-
* Shared geometry vocabulary for on-frame shape caps — privacy-mask,
|
|
11882
|
-
* motion-zones, and the detection zones/lines editor all speak this one
|
|
11883
|
-
* language so a single drawing-plane editor and the providers stay
|
|
11884
|
-
* decoupled from each cap's storage.
|
|
11885
|
-
*
|
|
11886
|
-
* All coordinates are normalized 0..1 of the camera frame (top-left
|
|
11887
|
-
* origin). Each cap composes the SUBSET of shape kinds it supports and
|
|
11888
|
-
* advertises it via `supportedShapes` in its `getOptions`.
|
|
11889
|
-
*/
|
|
11890
|
-
/** A normalized 0..1 point (top-left origin). */
|
|
11891
|
-
var MaskPointSchema = object({
|
|
11892
|
-
x: number(),
|
|
11893
|
-
y: number()
|
|
11894
|
-
});
|
|
11895
|
-
/** Axis-aligned rectangle (normalized 0..1). */
|
|
11896
|
-
var MaskRectShapeSchema = object({
|
|
11897
|
-
kind: literal("rect"),
|
|
11898
|
-
x: number(),
|
|
11899
|
-
y: number(),
|
|
11900
|
-
width: number(),
|
|
11901
|
-
height: number()
|
|
11902
|
-
});
|
|
11903
|
-
/** Free polygon — an ordered list of normalized vertices (≥3). */
|
|
11904
|
-
var MaskPolygonShapeSchema = object({
|
|
11905
|
-
kind: literal("polygon"),
|
|
11906
|
-
points: array(MaskPointSchema)
|
|
11907
|
-
});
|
|
11908
|
-
/** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
|
|
11909
|
-
var MaskGridShapeSchema = object({
|
|
11910
|
-
kind: literal("grid"),
|
|
11911
|
-
gridWidth: number(),
|
|
11912
|
-
gridHeight: number(),
|
|
11913
|
-
cells: array(boolean())
|
|
11914
|
-
});
|
|
11915
|
-
discriminatedUnion("kind", [
|
|
11916
|
-
MaskRectShapeSchema,
|
|
11917
|
-
MaskPolygonShapeSchema,
|
|
11918
|
-
MaskGridShapeSchema,
|
|
11919
|
-
object({
|
|
11920
|
-
kind: literal("line"),
|
|
11921
|
-
points: array(MaskPointSchema)
|
|
11922
|
-
})
|
|
11923
|
-
]);
|
|
11924
|
-
/** Every shape-kind discriminant, for `supportedShapes` advertisement. */
|
|
11925
|
-
var MaskShapeKindSchema = _enum([
|
|
11926
|
-
"rect",
|
|
11927
|
-
"polygon",
|
|
11928
|
-
"grid",
|
|
11929
|
-
"line"
|
|
11930
|
-
]);
|
|
11931
|
-
/** Polygon vertex bounds when a cap supports 'polygon' (e.g. Hikvision {min:4,max:4}). */
|
|
11932
|
-
var MaskPolygonVerticesSchema = object({
|
|
11933
|
-
min: number(),
|
|
11934
|
-
max: number()
|
|
12490
|
+
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
12491
|
+
lastDetectedAt: number().nullable(),
|
|
12492
|
+
/**
|
|
12493
|
+
* Ms after which `detected` auto-reverts to false if no fresh push
|
|
12494
|
+
* arrives. Null means the provider leaves detected state until a
|
|
12495
|
+
* native "clear" event.
|
|
12496
|
+
*/
|
|
12497
|
+
autoClearAfterMs: number().nullable()
|
|
11935
12498
|
});
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
12499
|
+
object({
|
|
12500
|
+
deviceId: number(),
|
|
12501
|
+
detected: boolean(),
|
|
12502
|
+
timestamp: number(),
|
|
12503
|
+
source: MotionSourceEnum,
|
|
12504
|
+
regions: array(MotionRegionSchema).readonly().optional()
|
|
12505
|
+
});
|
|
12506
|
+
DeviceType.Camera, DeviceType.Sensor, method(object({ deviceId: number() }), boolean());
|
|
12507
|
+
object({
|
|
12508
|
+
enabled: boolean(),
|
|
12509
|
+
/** Ms epoch of the last operator-driven change. */
|
|
12510
|
+
lastChangedAt: number()
|
|
12511
|
+
}).extend({
|
|
12512
|
+
/** Ms epoch of the last successful camera fetch (0 = never). */
|
|
12513
|
+
lastFetchedAt: number() });
|
|
12514
|
+
DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
12515
|
+
deviceId: number().int().nonnegative(),
|
|
12516
|
+
enabled: boolean()
|
|
12517
|
+
}), _void(), {
|
|
12518
|
+
kind: "mutation",
|
|
12519
|
+
auth: "admin"
|
|
12520
|
+
}), object({
|
|
12521
|
+
deviceId: number(),
|
|
12522
|
+
enabled: boolean(),
|
|
12523
|
+
lastChangedAt: number()
|
|
11940
12524
|
});
|
|
11941
12525
|
/**
|
|
11942
12526
|
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
@@ -13807,6 +14391,55 @@ method(object({
|
|
|
13807
14391
|
password: string()
|
|
13808
14392
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
13809
14393
|
/**
|
|
14394
|
+
* A live terminal session hosted by the provider addon. Output and input do
|
|
14395
|
+
* NOT flow through the capability — they use the addon data plane
|
|
14396
|
+
* (`GET /addon/terminal/<id>/out` SSE, `POST /addon/terminal/<id>/in`) because
|
|
14397
|
+
* terminal output must be ordered and lossless. The event bus is telemetry and
|
|
14398
|
+
* may drop chunks ([D8]), and a dropped chunk desynchronises the vt parser
|
|
14399
|
+
* permanently until a full repaint. The capability owns only lifecycle.
|
|
14400
|
+
*/
|
|
14401
|
+
var TerminalSessionInfoSchema = object({
|
|
14402
|
+
/** Opaque session id minted by the provider on `openSession`. */
|
|
14403
|
+
sessionId: string(),
|
|
14404
|
+
/** The pre-declared profile this session runs (never a free-form command). */
|
|
14405
|
+
profileId: string(),
|
|
14406
|
+
/** Human-readable profile label for the UI session list. */
|
|
14407
|
+
label: string(),
|
|
14408
|
+
cols: number().int().positive(),
|
|
14409
|
+
rows: number().int().positive(),
|
|
14410
|
+
/** ms-epoch the session's pty was spawned. */
|
|
14411
|
+
startedAt: number()
|
|
14412
|
+
});
|
|
14413
|
+
/**
|
|
14414
|
+
* A profile the operator may open — a pre-declared, allowlisted program
|
|
14415
|
+
* (`monitor` → `btm`). The capability accepts only these ids; a free-form
|
|
14416
|
+
* command string would be remote code execution as the server's user, so it is
|
|
14417
|
+
* deliberately not part of the contract.
|
|
14418
|
+
*/
|
|
14419
|
+
var TerminalProfileInfoSchema = object({
|
|
14420
|
+
profileId: string(),
|
|
14421
|
+
label: string(),
|
|
14422
|
+
description: string().optional()
|
|
14423
|
+
});
|
|
14424
|
+
method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
14425
|
+
profileId: string(),
|
|
14426
|
+
cols: number().int().positive(),
|
|
14427
|
+
rows: number().int().positive()
|
|
14428
|
+
}), TerminalSessionInfoSchema, {
|
|
14429
|
+
kind: "mutation",
|
|
14430
|
+
auth: "admin"
|
|
14431
|
+
}), method(object({
|
|
14432
|
+
sessionId: string(),
|
|
14433
|
+
cols: number().int().positive(),
|
|
14434
|
+
rows: number().int().positive()
|
|
14435
|
+
}), _void(), {
|
|
14436
|
+
kind: "mutation",
|
|
14437
|
+
auth: "admin"
|
|
14438
|
+
}), method(object({ sessionId: string() }), _void(), {
|
|
14439
|
+
kind: "mutation",
|
|
14440
|
+
auth: "admin"
|
|
14441
|
+
});
|
|
14442
|
+
/**
|
|
13810
14443
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
13811
14444
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
13812
14445
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -13907,11 +14540,53 @@ var LocationStatSchema = object({
|
|
|
13907
14540
|
fileCount: number(),
|
|
13908
14541
|
present: boolean()
|
|
13909
14542
|
});
|
|
14543
|
+
/**
|
|
14544
|
+
* A backup schedule — the N:M "entry" that binds one cron cadence to a
|
|
14545
|
+
* SET of destination locations. Supersedes the per-location cron on
|
|
14546
|
+
* `BackupDestinationPolicy`: an operator creates a schedule, picks the
|
|
14547
|
+
* `backups` locations it should write to, and the orchestrator fans a
|
|
14548
|
+
* single archive out to all of them when the cron fires.
|
|
14549
|
+
*
|
|
14550
|
+
* `retentionCount` is per-schedule (D-decision 2026-07-28): every
|
|
14551
|
+
* location targeted by this schedule keeps this many archives from
|
|
14552
|
+
* this schedule's runs.
|
|
14553
|
+
*
|
|
14554
|
+
* `dataSources` optionally narrows which top-level state locations
|
|
14555
|
+
* (db, addons, tls, …) are archived; omitted = the orchestrator's
|
|
14556
|
+
* default full set.
|
|
14557
|
+
*/
|
|
14558
|
+
var BackupScheduleSchema = object({
|
|
14559
|
+
/** Stable id. Generated by the orchestrator on first upsert if absent. */
|
|
14560
|
+
id: string(),
|
|
14561
|
+
/** Operator-facing display name. */
|
|
14562
|
+
label: string(),
|
|
14563
|
+
/** 5-field POSIX cron. Empty = disabled cadence (kept for editing). */
|
|
14564
|
+
cron: string(),
|
|
14565
|
+
/** Master on/off toggle for the whole schedule. */
|
|
14566
|
+
enabled: boolean(),
|
|
14567
|
+
/** `backups`-location ids this schedule writes to (fan-out set). */
|
|
14568
|
+
locationIds: array(string()).readonly(),
|
|
14569
|
+
/** Archives kept per targeted location for this schedule. */
|
|
14570
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14571
|
+
/** Optional subset of source locations to include; omitted = all. */
|
|
14572
|
+
dataSources: array(string()).readonly().optional(),
|
|
14573
|
+
/** ms-epoch of last successful run. */
|
|
14574
|
+
lastRunAt: number().optional(),
|
|
14575
|
+
/** ms-epoch of next computed firing (read-only, filled on list). */
|
|
14576
|
+
nextRunAt: number().optional()
|
|
14577
|
+
});
|
|
13910
14578
|
method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }), method(object({
|
|
13911
14579
|
/** Subset of registered `backup-destination` addon ids to write to. */
|
|
13912
14580
|
destinations: array(string()).optional(),
|
|
13913
14581
|
locations: array(string()).optional(),
|
|
13914
|
-
label: string().optional()
|
|
14582
|
+
label: string().optional(),
|
|
14583
|
+
/**
|
|
14584
|
+
* Per-run retention override applied to every targeted
|
|
14585
|
+
* destination. Used by schedule-driven runs (per-entry
|
|
14586
|
+
* retention). Omitted = each destination's own policy
|
|
14587
|
+
* retention (manual runs).
|
|
14588
|
+
*/
|
|
14589
|
+
retentionCount: number().int().min(1).max(1e3).optional()
|
|
13915
14590
|
}).optional(), array(BackupEntrySchema).readonly(), {
|
|
13916
14591
|
kind: "mutation",
|
|
13917
14592
|
auth: "admin"
|
|
@@ -13960,7 +14635,21 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
13960
14635
|
ok: boolean(),
|
|
13961
14636
|
error: string().optional(),
|
|
13962
14637
|
nextRuns: array(number()).readonly()
|
|
13963
|
-
}))
|
|
14638
|
+
})), method(_void(), array(BackupScheduleSchema).readonly(), { auth: "admin" }), method(object({
|
|
14639
|
+
id: string().optional(),
|
|
14640
|
+
label: string(),
|
|
14641
|
+
cron: string(),
|
|
14642
|
+
enabled: boolean(),
|
|
14643
|
+
locationIds: array(string()).readonly(),
|
|
14644
|
+
retentionCount: number().int().min(1).max(1e3),
|
|
14645
|
+
dataSources: array(string()).readonly().optional()
|
|
14646
|
+
}), BackupScheduleSchema, {
|
|
14647
|
+
kind: "mutation",
|
|
14648
|
+
auth: "admin"
|
|
14649
|
+
}), method(object({ id: string() }), _void(), {
|
|
14650
|
+
kind: "mutation",
|
|
14651
|
+
auth: "admin"
|
|
14652
|
+
});
|
|
13964
14653
|
/**
|
|
13965
14654
|
* `broker` — unified pub/sub broker registry, system-scoped collection.
|
|
13966
14655
|
*
|
|
@@ -14976,1596 +15665,1108 @@ method(object({
|
|
|
14976
15665
|
active: boolean()
|
|
14977
15666
|
}), _void(), {
|
|
14978
15667
|
kind: "mutation",
|
|
14979
|
-
auth: "admin"
|
|
14980
|
-
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
14981
|
-
capName: string(),
|
|
14982
|
-
wrappers: array(string())
|
|
14983
|
-
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
14984
|
-
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
14985
|
-
live: SettingsSchemaWithValuesSchema.nullable()
|
|
14986
|
-
})), method(object({
|
|
14987
|
-
deviceId: number().int().nonnegative(),
|
|
14988
|
-
action: string().min(1),
|
|
14989
|
-
input: unknown()
|
|
14990
|
-
}), unknown(), { kind: "mutation" }), method(object({
|
|
14991
|
-
deviceId: number(),
|
|
14992
|
-
writerCapName: string(),
|
|
14993
|
-
writerAddonId: string(),
|
|
14994
|
-
key: string(),
|
|
14995
|
-
value: unknown()
|
|
14996
|
-
}), object({ success: literal(true) }), {
|
|
14997
|
-
kind: "mutation",
|
|
14998
|
-
auth: "admin"
|
|
14999
|
-
}), method(object({
|
|
15000
|
-
deviceId: number(),
|
|
15001
|
-
changes: array(object({
|
|
15002
|
-
writerCapName: string(),
|
|
15003
|
-
writerAddonId: string(),
|
|
15004
|
-
key: string(),
|
|
15005
|
-
value: unknown()
|
|
15006
|
-
}))
|
|
15007
|
-
}), object({
|
|
15008
|
-
success: literal(true),
|
|
15009
|
-
failures: array(object({
|
|
15010
|
-
writerCapName: string(),
|
|
15011
|
-
writerAddonId: string(),
|
|
15012
|
-
error: string()
|
|
15013
|
-
}))
|
|
15014
|
-
}), {
|
|
15015
|
-
kind: "mutation",
|
|
15016
|
-
auth: "admin"
|
|
15017
|
-
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
15018
|
-
kind: "mutation",
|
|
15019
|
-
auth: "admin"
|
|
15020
|
-
}), method(object({
|
|
15021
|
-
addonId: string(),
|
|
15022
|
-
candidate: DiscoveryCandidateSchema,
|
|
15023
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
15024
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15025
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15026
|
-
integrationId: string().optional()
|
|
15027
|
-
}), DeviceSummarySchema, {
|
|
15028
|
-
kind: "mutation",
|
|
15029
|
-
auth: "admin"
|
|
15030
|
-
}), method(object({
|
|
15031
|
-
addonId: string(),
|
|
15032
|
-
type: _enum(DeviceType)
|
|
15033
|
-
}), unknown().nullable()), method(object({
|
|
15034
|
-
addonId: string(),
|
|
15035
|
-
type: _enum(DeviceType),
|
|
15036
|
-
config: record(string(), unknown()),
|
|
15037
|
-
/** Owning integration id, stamped onto the new device's meta by the
|
|
15038
|
-
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15039
|
-
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15040
|
-
integrationId: string().optional()
|
|
15041
|
-
}), DeviceSummarySchema, {
|
|
15042
|
-
kind: "mutation",
|
|
15043
|
-
auth: "admin"
|
|
15044
|
-
}), method(object({
|
|
15045
|
-
addonId: string(),
|
|
15046
|
-
type: _enum(DeviceType),
|
|
15047
|
-
key: string(),
|
|
15048
|
-
value: unknown(),
|
|
15049
|
-
formValues: record(string(), unknown()).optional()
|
|
15050
|
-
}), FieldProbeResultSchema, {
|
|
15051
|
-
kind: "mutation",
|
|
15052
|
-
auth: "admin"
|
|
15053
|
-
}), method(object({
|
|
15054
|
-
addonId: string(),
|
|
15055
|
-
integrationId: string()
|
|
15056
|
-
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
15057
|
-
addonId: string(),
|
|
15058
|
-
integrationId: string()
|
|
15059
|
-
}), AdoptionStatusSchema, {
|
|
15060
|
-
kind: "mutation",
|
|
15061
|
-
auth: "admin"
|
|
15062
|
-
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
15063
|
-
kind: "mutation",
|
|
15064
|
-
auth: "admin"
|
|
15065
|
-
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
15066
|
-
kind: "mutation",
|
|
15067
|
-
auth: "admin"
|
|
15068
|
-
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
15069
|
-
kind: "mutation",
|
|
15070
|
-
auth: "admin"
|
|
15071
|
-
}), method(object({}), object({ providers: array(object({
|
|
15072
|
-
addonId: string(),
|
|
15073
|
-
label: string()
|
|
15074
|
-
})).readonly() }), { auth: "admin" }), method(object({}), object({ groups: array(object({
|
|
15075
|
-
addonId: string(),
|
|
15076
|
-
label: string(),
|
|
15077
|
-
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
15078
|
-
error: string().nullable()
|
|
15079
|
-
})).readonly() }), {
|
|
15080
|
-
kind: "mutation",
|
|
15081
|
-
auth: "admin"
|
|
15082
|
-
}), method(object({
|
|
15083
|
-
addonId: string(),
|
|
15084
|
-
params: record(string(), unknown()).optional()
|
|
15085
|
-
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
15086
|
-
kind: "mutation",
|
|
15087
|
-
auth: "admin"
|
|
15088
|
-
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
15089
|
-
deviceId: number(),
|
|
15090
|
-
key: string(),
|
|
15091
|
-
value: unknown()
|
|
15092
|
-
}), FieldProbeResultSchema, {
|
|
15093
|
-
kind: "mutation",
|
|
15094
|
-
auth: "admin"
|
|
15095
|
-
}), method(object({
|
|
15096
|
-
deviceId: number(),
|
|
15097
|
-
caps: array(string()).readonly().optional()
|
|
15098
|
-
}), record(string(), unknown().nullable()));
|
|
15099
|
-
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
15100
|
-
deviceId: number(),
|
|
15101
|
-
capName: string()
|
|
15102
|
-
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
15103
|
-
deviceId: number(),
|
|
15104
|
-
capName: string(),
|
|
15105
|
-
slice: record(string(), unknown())
|
|
15106
|
-
}), _void(), { kind: "mutation" }), object({
|
|
15107
|
-
deviceId: number(),
|
|
15108
|
-
capName: string(),
|
|
15109
|
-
slice: record(string(), unknown())
|
|
15110
|
-
});
|
|
15111
|
-
/**
|
|
15112
|
-
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
15113
|
-
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
15114
|
-
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
15115
|
-
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
15116
|
-
* post-analysis enrichment-engine.
|
|
15117
|
-
*/
|
|
15118
|
-
var EmbeddingResultSchema = object({
|
|
15119
|
-
embedding: array(number()),
|
|
15120
|
-
inferenceMs: number()
|
|
15121
|
-
});
|
|
15122
|
-
var EmbeddingInfoSchema = object({
|
|
15123
|
-
modelId: string(),
|
|
15124
|
-
embeddingDim: number(),
|
|
15125
|
-
ready: boolean()
|
|
15126
|
-
});
|
|
15127
|
-
method(object({
|
|
15128
|
-
crop: _instanceof(Uint8Array),
|
|
15129
|
-
width: number(),
|
|
15130
|
-
height: number()
|
|
15131
|
-
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
15132
|
-
/**
|
|
15133
|
-
* filesystem-browse — per-node capability for browsing the node's local
|
|
15134
|
-
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
15135
|
-
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
15136
|
-
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
15137
|
-
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
15138
|
-
*/
|
|
15139
|
-
var DirEntrySchema = object({
|
|
15140
|
-
name: string(),
|
|
15141
|
-
path: string()
|
|
15142
|
-
});
|
|
15143
|
-
var BrowseResultSchema = object({
|
|
15144
|
-
path: string(),
|
|
15145
|
-
entries: array(DirEntrySchema).readonly(),
|
|
15146
|
-
freeBytes: number(),
|
|
15147
|
-
totalBytes: number()
|
|
15148
|
-
});
|
|
15149
|
-
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
15668
|
+
auth: "admin"
|
|
15669
|
+
}), method(object({ capName: string() }), array(string())), method(object({ deviceType: string() }), array(object({
|
|
15670
|
+
capName: string(),
|
|
15671
|
+
wrappers: array(string())
|
|
15672
|
+
}))), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), SettingsSchemaWithValuesSchema.nullable()), method(object({ deviceId: number() }), object({
|
|
15673
|
+
settings: SettingsSchemaWithValuesSchema.nullable(),
|
|
15674
|
+
live: SettingsSchemaWithValuesSchema.nullable()
|
|
15675
|
+
})), method(object({
|
|
15676
|
+
deviceId: number().int().nonnegative(),
|
|
15677
|
+
action: string().min(1),
|
|
15678
|
+
input: unknown()
|
|
15679
|
+
}), unknown(), { kind: "mutation" }), method(object({
|
|
15680
|
+
deviceId: number(),
|
|
15681
|
+
writerCapName: string(),
|
|
15682
|
+
writerAddonId: string(),
|
|
15683
|
+
key: string(),
|
|
15684
|
+
value: unknown()
|
|
15685
|
+
}), object({ success: literal(true) }), {
|
|
15150
15686
|
kind: "mutation",
|
|
15151
15687
|
auth: "admin"
|
|
15152
|
-
})
|
|
15153
|
-
|
|
15154
|
-
|
|
15155
|
-
|
|
15156
|
-
|
|
15157
|
-
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15161
|
-
*/
|
|
15162
|
-
var LlmUsageSchema = object({
|
|
15163
|
-
inputTokens: number(),
|
|
15164
|
-
outputTokens: number()
|
|
15165
|
-
});
|
|
15166
|
-
var LlmErrorCodeSchema = _enum([
|
|
15167
|
-
"timeout",
|
|
15168
|
-
"rate-limited",
|
|
15169
|
-
"auth",
|
|
15170
|
-
"refusal",
|
|
15171
|
-
"bad-request",
|
|
15172
|
-
"unavailable",
|
|
15173
|
-
"no-profile",
|
|
15174
|
-
"budget-exceeded",
|
|
15175
|
-
"adapter-error"
|
|
15176
|
-
]);
|
|
15177
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15178
|
-
ok: literal(true),
|
|
15179
|
-
text: string(),
|
|
15180
|
-
model: string(),
|
|
15181
|
-
usage: LlmUsageSchema,
|
|
15182
|
-
truncated: boolean(),
|
|
15183
|
-
latencyMs: number()
|
|
15688
|
+
}), method(object({
|
|
15689
|
+
deviceId: number(),
|
|
15690
|
+
changes: array(object({
|
|
15691
|
+
writerCapName: string(),
|
|
15692
|
+
writerAddonId: string(),
|
|
15693
|
+
key: string(),
|
|
15694
|
+
value: unknown()
|
|
15695
|
+
}))
|
|
15184
15696
|
}), object({
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15193
|
-
* notification-output.cap.ts:27-31 precedents).
|
|
15194
|
-
*/
|
|
15195
|
-
var LlmImageSchema = object({
|
|
15196
|
-
bytes: _instanceof(Uint8Array),
|
|
15197
|
-
mimeType: string()
|
|
15198
|
-
});
|
|
15199
|
-
var LlmGenerateBaseInputSchema = object({
|
|
15200
|
-
/** Collection routing (the notification-output posture). */
|
|
15201
|
-
addonId: string().optional(),
|
|
15202
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15203
|
-
profileId: string().optional(),
|
|
15204
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15205
|
-
consumer: string(),
|
|
15206
|
-
system: string().optional(),
|
|
15207
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15208
|
-
prompt: string(),
|
|
15209
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15210
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
15211
|
-
/** Per-call override of the profile default. */
|
|
15212
|
-
maxTokens: number().int().positive().optional(),
|
|
15213
|
-
temperature: number().optional()
|
|
15214
|
-
});
|
|
15215
|
-
/**
|
|
15216
|
-
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15217
|
-
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15218
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15219
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15220
|
-
* this only through the `llm` cap's methods.
|
|
15221
|
-
*
|
|
15222
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15223
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15224
|
-
* watchdog — operator decision #3).
|
|
15225
|
-
*/
|
|
15226
|
-
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15227
|
-
object({
|
|
15228
|
-
kind: literal("catalog"),
|
|
15229
|
-
catalogId: string()
|
|
15230
|
-
}),
|
|
15231
|
-
object({
|
|
15232
|
-
kind: literal("url"),
|
|
15233
|
-
url: string(),
|
|
15234
|
-
sha256: string().optional()
|
|
15235
|
-
}),
|
|
15236
|
-
object({
|
|
15237
|
-
kind: literal("path"),
|
|
15238
|
-
path: string()
|
|
15239
|
-
})
|
|
15240
|
-
]);
|
|
15241
|
-
var ManagedRuntimeConfigSchema = object({
|
|
15242
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
15243
|
-
nodeId: string(),
|
|
15244
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15245
|
-
engine: _enum(["llama-cpp"]),
|
|
15246
|
-
model: ManagedModelRefSchema,
|
|
15247
|
-
contextSize: number().int().default(4096),
|
|
15248
|
-
/** 0 = CPU-only. */
|
|
15249
|
-
gpuLayers: number().int().default(0),
|
|
15250
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15251
|
-
threads: number().int().optional(),
|
|
15252
|
-
/** Concurrent slots. */
|
|
15253
|
-
parallel: number().int().default(1),
|
|
15254
|
-
/** Else lazy: first generate boots it. */
|
|
15255
|
-
autoStart: boolean().default(false),
|
|
15256
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
15257
|
-
idleStopMinutes: number().int().default(30)
|
|
15258
|
-
});
|
|
15259
|
-
var LlmRuntimeStatusSchema = object({
|
|
15260
|
-
/** Status is ALWAYS node-qualified. */
|
|
15261
|
-
nodeId: string(),
|
|
15262
|
-
state: _enum([
|
|
15263
|
-
"stopped",
|
|
15264
|
-
"downloading",
|
|
15265
|
-
"starting",
|
|
15266
|
-
"ready",
|
|
15267
|
-
"crashed",
|
|
15268
|
-
"failed"
|
|
15269
|
-
]),
|
|
15270
|
-
pid: number().optional(),
|
|
15271
|
-
port: number().optional(),
|
|
15272
|
-
modelPath: string().optional(),
|
|
15273
|
-
modelId: string().optional(),
|
|
15274
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
15275
|
-
lastError: string().optional(),
|
|
15276
|
-
crashesInWindow: number(),
|
|
15277
|
-
/** Child RSS (sampled best-effort). */
|
|
15278
|
-
memoryBytes: number().optional(),
|
|
15279
|
-
vramBytes: number().optional()
|
|
15280
|
-
});
|
|
15281
|
-
var LlmNodeModelSchema = object({
|
|
15282
|
-
file: string(),
|
|
15283
|
-
sizeBytes: number(),
|
|
15284
|
-
catalogId: string().optional(),
|
|
15285
|
-
installedAt: number().optional()
|
|
15286
|
-
});
|
|
15287
|
-
var LlmRuntimeDiskUsageSchema = object({
|
|
15288
|
-
nodeId: string(),
|
|
15289
|
-
modelsBytes: number(),
|
|
15290
|
-
freeBytes: number().optional()
|
|
15291
|
-
});
|
|
15292
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
15293
|
-
images: array(LlmImageSchema).optional(),
|
|
15294
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
15295
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15296
|
-
timeoutMs: number().int().positive().optional()
|
|
15297
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15697
|
+
success: literal(true),
|
|
15698
|
+
failures: array(object({
|
|
15699
|
+
writerCapName: string(),
|
|
15700
|
+
writerAddonId: string(),
|
|
15701
|
+
error: string()
|
|
15702
|
+
}))
|
|
15703
|
+
}), {
|
|
15298
15704
|
kind: "mutation",
|
|
15299
15705
|
auth: "admin"
|
|
15300
|
-
}), method(object({}),
|
|
15706
|
+
}), method(object({ addonId: string() }), array(DiscoveryCandidateSchema), {
|
|
15301
15707
|
kind: "mutation",
|
|
15302
15708
|
auth: "admin"
|
|
15303
|
-
}), method(object({
|
|
15709
|
+
}), method(object({
|
|
15710
|
+
addonId: string(),
|
|
15711
|
+
candidate: DiscoveryCandidateSchema,
|
|
15712
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
15713
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15714
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15715
|
+
integrationId: string().optional()
|
|
15716
|
+
}), DeviceSummarySchema, {
|
|
15304
15717
|
kind: "mutation",
|
|
15305
15718
|
auth: "admin"
|
|
15306
|
-
}), method(object({
|
|
15719
|
+
}), method(object({
|
|
15720
|
+
addonId: string(),
|
|
15721
|
+
type: _enum(DeviceType)
|
|
15722
|
+
}), unknown().nullable()), method(object({
|
|
15723
|
+
addonId: string(),
|
|
15724
|
+
type: _enum(DeviceType),
|
|
15725
|
+
config: record(string(), unknown()),
|
|
15726
|
+
/** Owning integration id, stamped onto the new device's meta by the
|
|
15727
|
+
* device-manager forwarder so `removeByIntegration` can cascade it.
|
|
15728
|
+
* Optional for back-compat (omitted = no stamp = pre-existing behavior). */
|
|
15729
|
+
integrationId: string().optional()
|
|
15730
|
+
}), DeviceSummarySchema, {
|
|
15307
15731
|
kind: "mutation",
|
|
15308
15732
|
auth: "admin"
|
|
15309
|
-
}), method(object({
|
|
15310
|
-
/**
|
|
15311
|
-
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
15312
|
-
* methods concat-fan across providers; single-row methods route to ONE
|
|
15313
|
-
* provider by the `addonId` in the call input (the notification-output
|
|
15314
|
-
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15315
|
-
* (hub-placed); the cap stays open for future providers.
|
|
15316
|
-
*
|
|
15317
|
-
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15318
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15319
|
-
* write; a stored key NEVER round-trips to a client.
|
|
15320
|
-
*/
|
|
15321
|
-
var LlmProfileKindSchema = _enum([
|
|
15322
|
-
"openai-compatible",
|
|
15323
|
-
"openai",
|
|
15324
|
-
"anthropic",
|
|
15325
|
-
"google",
|
|
15326
|
-
"managed-local"
|
|
15327
|
-
]);
|
|
15328
|
-
var LlmProfileSchema = object({
|
|
15329
|
-
id: string(),
|
|
15330
|
-
name: string(),
|
|
15331
|
-
kind: LlmProfileKindSchema,
|
|
15332
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
15733
|
+
}), method(object({
|
|
15333
15734
|
addonId: string(),
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
temperature: number().min(0).max(2).optional(),
|
|
15343
|
-
maxTokens: number().int().positive().optional(),
|
|
15344
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
15345
|
-
extraHeaders: record(string(), string()).optional(),
|
|
15346
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
15347
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15348
|
-
});
|
|
15349
|
-
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
15350
|
-
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
15351
|
-
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
15352
|
-
var ConfigSchemaPassthrough$1 = unknown();
|
|
15353
|
-
var LlmProfileKindDescriptorSchema = object({
|
|
15354
|
-
kind: LlmProfileKindSchema,
|
|
15355
|
-
label: string(),
|
|
15356
|
-
icon: string(),
|
|
15357
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15735
|
+
type: _enum(DeviceType),
|
|
15736
|
+
key: string(),
|
|
15737
|
+
value: unknown(),
|
|
15738
|
+
formValues: record(string(), unknown()).optional()
|
|
15739
|
+
}), FieldProbeResultSchema, {
|
|
15740
|
+
kind: "mutation",
|
|
15741
|
+
auth: "admin"
|
|
15742
|
+
}), method(object({
|
|
15358
15743
|
addonId: string(),
|
|
15359
|
-
|
|
15360
|
-
})
|
|
15361
|
-
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
15362
|
-
var LlmDefaultSchema = object({
|
|
15363
|
-
selector: LlmDefaultSelectorSchema,
|
|
15364
|
-
profileId: string()
|
|
15365
|
-
});
|
|
15366
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
15367
|
-
var LlmUsageRollupSchema = object({
|
|
15368
|
-
day: string(),
|
|
15369
|
-
consumer: string(),
|
|
15370
|
-
profileId: string(),
|
|
15371
|
-
calls: number(),
|
|
15372
|
-
okCalls: number(),
|
|
15373
|
-
errorCalls: number(),
|
|
15374
|
-
inputTokens: number(),
|
|
15375
|
-
outputTokens: number(),
|
|
15376
|
-
avgLatencyMs: number()
|
|
15377
|
-
});
|
|
15378
|
-
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
15379
|
-
var ManagedModelCatalogEntrySchema = object({
|
|
15380
|
-
id: string(),
|
|
15381
|
-
label: string(),
|
|
15382
|
-
family: string(),
|
|
15383
|
-
purpose: _enum(["text", "vision"]),
|
|
15384
|
-
url: string(),
|
|
15385
|
-
sha256: string(),
|
|
15386
|
-
sizeBytes: number(),
|
|
15387
|
-
quantization: string(),
|
|
15388
|
-
/** Load-time guidance shown in the picker. */
|
|
15389
|
-
minRamBytes: number(),
|
|
15390
|
-
contextSizeDefault: number().int(),
|
|
15391
|
-
/** Vision models: companion projector file. */
|
|
15392
|
-
mmprojUrl: string().optional()
|
|
15393
|
-
});
|
|
15394
|
-
var LlmRuntimeNodeSchema = object({
|
|
15395
|
-
nodeId: string(),
|
|
15396
|
-
reachable: boolean(),
|
|
15397
|
-
status: LlmRuntimeStatusSchema.optional(),
|
|
15398
|
-
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15399
|
-
error: string().optional()
|
|
15400
|
-
});
|
|
15401
|
-
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
15402
|
-
var ProfileRefInputSchema = object({
|
|
15744
|
+
integrationId: string()
|
|
15745
|
+
}), object({ filters: array(AdoptionFilterSchema) }), { auth: "admin" }), method(ListCandidatesInputSchema.extend({ addonId: string() }), ListCandidatesOutputSchema, { auth: "admin" }), method(object({
|
|
15403
15746
|
addonId: string(),
|
|
15404
|
-
|
|
15405
|
-
})
|
|
15406
|
-
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
15747
|
+
integrationId: string()
|
|
15748
|
+
}), AdoptionStatusSchema, {
|
|
15407
15749
|
kind: "mutation",
|
|
15408
15750
|
auth: "admin"
|
|
15409
|
-
}), method(
|
|
15751
|
+
}), method(AdoptInputSchema.extend({ addonId: string() }), AdoptResultSchema, {
|
|
15410
15752
|
kind: "mutation",
|
|
15411
15753
|
auth: "admin"
|
|
15412
|
-
}), method(
|
|
15754
|
+
}), method(ReleaseInputSchema.extend({ addonId: string() }), _void(), {
|
|
15413
15755
|
kind: "mutation",
|
|
15414
15756
|
auth: "admin"
|
|
15415
|
-
}), method(
|
|
15416
|
-
selector: LlmDefaultSelectorSchema,
|
|
15417
|
-
profileId: string().nullable()
|
|
15418
|
-
}), _void(), {
|
|
15757
|
+
}), method(ResyncInputSchema, ResyncResultSchema, {
|
|
15419
15758
|
kind: "mutation",
|
|
15420
15759
|
auth: "admin"
|
|
15421
|
-
}), method(object({
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
})
|
|
15760
|
+
}), method(object({}), object({ providers: array(object({
|
|
15761
|
+
addonId: string(),
|
|
15762
|
+
label: string()
|
|
15763
|
+
})).readonly() }), { auth: "admin" }), method(object({}), object({ groups: array(object({
|
|
15764
|
+
addonId: string(),
|
|
15765
|
+
label: string(),
|
|
15766
|
+
candidates: array(DiscoveryCandidateSchema).readonly(),
|
|
15767
|
+
error: string().nullable()
|
|
15768
|
+
})).readonly() }), {
|
|
15430
15769
|
kind: "mutation",
|
|
15431
15770
|
auth: "admin"
|
|
15432
15771
|
}), method(object({
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
}),
|
|
15772
|
+
addonId: string(),
|
|
15773
|
+
params: record(string(), unknown()).optional()
|
|
15774
|
+
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
15436
15775
|
kind: "mutation",
|
|
15437
15776
|
auth: "admin"
|
|
15438
|
-
}), method(
|
|
15777
|
+
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
15778
|
+
deviceId: number(),
|
|
15779
|
+
key: string(),
|
|
15780
|
+
value: unknown()
|
|
15781
|
+
}), FieldProbeResultSchema, {
|
|
15439
15782
|
kind: "mutation",
|
|
15440
15783
|
auth: "admin"
|
|
15441
|
-
}), method(
|
|
15784
|
+
}), method(object({
|
|
15785
|
+
deviceId: number(),
|
|
15786
|
+
caps: array(string()).readonly().optional()
|
|
15787
|
+
}), record(string(), unknown().nullable()));
|
|
15788
|
+
method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
|
|
15789
|
+
deviceId: number(),
|
|
15790
|
+
capName: string()
|
|
15791
|
+
}), record(string(), unknown()).nullable()), method(object({}), record(string(), record(string(), record(string(), unknown())))), method(object({
|
|
15792
|
+
deviceId: number(),
|
|
15793
|
+
capName: string(),
|
|
15794
|
+
slice: record(string(), unknown())
|
|
15795
|
+
}), _void(), { kind: "mutation" }), object({
|
|
15796
|
+
deviceId: number(),
|
|
15797
|
+
capName: string(),
|
|
15798
|
+
slice: record(string(), unknown())
|
|
15799
|
+
});
|
|
15800
|
+
/**
|
|
15801
|
+
* Embedding output. `embedding` is wire-encoded as `number[]` so the
|
|
15802
|
+
* Zod-validated tRPC surface round-trips cleanly; consumers that need a
|
|
15803
|
+
* `Float32Array` can wrap it on the way out (in-process, no marshalling
|
|
15804
|
+
* is involved). `inferenceMs` mirrors the runtime field used by the
|
|
15805
|
+
* post-analysis enrichment-engine.
|
|
15806
|
+
*/
|
|
15807
|
+
var EmbeddingResultSchema = object({
|
|
15808
|
+
embedding: array(number()),
|
|
15809
|
+
inferenceMs: number()
|
|
15810
|
+
});
|
|
15811
|
+
var EmbeddingInfoSchema = object({
|
|
15812
|
+
modelId: string(),
|
|
15813
|
+
embeddingDim: number(),
|
|
15814
|
+
ready: boolean()
|
|
15815
|
+
});
|
|
15816
|
+
method(object({
|
|
15817
|
+
crop: _instanceof(Uint8Array),
|
|
15818
|
+
width: number(),
|
|
15819
|
+
height: number()
|
|
15820
|
+
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
15821
|
+
/**
|
|
15822
|
+
* filesystem-browse — per-node capability for browsing the node's local
|
|
15823
|
+
* filesystem, sandboxed to operator-configured allowed roots. Used by the
|
|
15824
|
+
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
15825
|
+
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
15826
|
+
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
15827
|
+
*/
|
|
15828
|
+
var DirEntrySchema = object({
|
|
15829
|
+
name: string(),
|
|
15830
|
+
path: string()
|
|
15831
|
+
});
|
|
15832
|
+
var BrowseResultSchema = object({
|
|
15833
|
+
path: string(),
|
|
15834
|
+
entries: array(DirEntrySchema).readonly(),
|
|
15835
|
+
freeBytes: number(),
|
|
15836
|
+
totalBytes: number()
|
|
15837
|
+
});
|
|
15838
|
+
method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }), method(object({ path: string() }), object({ path: string() }), {
|
|
15442
15839
|
kind: "mutation",
|
|
15443
15840
|
auth: "admin"
|
|
15444
15841
|
});
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
|
|
15449
|
-
|
|
15842
|
+
/**
|
|
15843
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15844
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15845
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
15846
|
+
*
|
|
15847
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15848
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
15849
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15850
|
+
*/
|
|
15851
|
+
var LlmUsageSchema = object({
|
|
15852
|
+
inputTokens: number(),
|
|
15853
|
+
outputTokens: number()
|
|
15854
|
+
});
|
|
15855
|
+
var LlmErrorCodeSchema = _enum([
|
|
15856
|
+
"timeout",
|
|
15857
|
+
"rate-limited",
|
|
15858
|
+
"auth",
|
|
15859
|
+
"refusal",
|
|
15860
|
+
"bad-request",
|
|
15861
|
+
"unavailable",
|
|
15862
|
+
"no-profile",
|
|
15863
|
+
"budget-exceeded",
|
|
15864
|
+
"adapter-error"
|
|
15450
15865
|
]);
|
|
15451
|
-
var
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15866
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15867
|
+
ok: literal(true),
|
|
15868
|
+
text: string(),
|
|
15869
|
+
model: string(),
|
|
15870
|
+
usage: LlmUsageSchema,
|
|
15871
|
+
truncated: boolean(),
|
|
15872
|
+
latencyMs: number()
|
|
15873
|
+
}), object({
|
|
15874
|
+
ok: literal(false),
|
|
15875
|
+
code: LlmErrorCodeSchema,
|
|
15455
15876
|
message: string(),
|
|
15456
|
-
|
|
15457
|
-
|
|
15458
|
-
});
|
|
15459
|
-
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
15460
|
-
scope: array(string()).optional(),
|
|
15461
|
-
level: LogLevelSchema.optional(),
|
|
15462
|
-
since: date().optional(),
|
|
15463
|
-
until: date().optional(),
|
|
15464
|
-
limit: number().optional(),
|
|
15465
|
-
tags: record(string(), string()).optional()
|
|
15466
|
-
}), array(LogEntrySchema).readonly());
|
|
15877
|
+
retryAfterMs: number().optional()
|
|
15878
|
+
})]);
|
|
15467
15879
|
/**
|
|
15468
|
-
* `
|
|
15469
|
-
*
|
|
15470
|
-
*
|
|
15471
|
-
|
|
15472
|
-
|
|
15473
|
-
|
|
15474
|
-
|
|
15475
|
-
|
|
15476
|
-
|
|
15477
|
-
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
|
|
15481
|
-
|
|
15482
|
-
|
|
15483
|
-
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
*
|
|
15494
|
-
*
|
|
15495
|
-
*
|
|
15496
|
-
*
|
|
15497
|
-
*
|
|
15498
|
-
* Every contribution carries a `stage`:
|
|
15499
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
15500
|
-
* magic-link buttons; a future usernameless passkey).
|
|
15501
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
15502
|
-
* returned `factors` (passkey-as-2FA today).
|
|
15880
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15881
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15882
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
15883
|
+
*/
|
|
15884
|
+
var LlmImageSchema = object({
|
|
15885
|
+
bytes: _instanceof(Uint8Array),
|
|
15886
|
+
mimeType: string()
|
|
15887
|
+
});
|
|
15888
|
+
var LlmGenerateBaseInputSchema = object({
|
|
15889
|
+
/** Collection routing (the notification-output posture). */
|
|
15890
|
+
addonId: string().optional(),
|
|
15891
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15892
|
+
profileId: string().optional(),
|
|
15893
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15894
|
+
consumer: string(),
|
|
15895
|
+
system: string().optional(),
|
|
15896
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15897
|
+
prompt: string(),
|
|
15898
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15899
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
15900
|
+
/** Per-call override of the profile default. */
|
|
15901
|
+
maxTokens: number().int().positive().optional(),
|
|
15902
|
+
temperature: number().optional()
|
|
15903
|
+
});
|
|
15904
|
+
/**
|
|
15905
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15906
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15907
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15908
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15909
|
+
* this only through the `llm` cap's methods.
|
|
15503
15910
|
*
|
|
15504
|
-
*
|
|
15505
|
-
*
|
|
15506
|
-
*
|
|
15911
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15912
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15913
|
+
* watchdog — operator decision #3).
|
|
15507
15914
|
*/
|
|
15508
|
-
|
|
15509
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
15510
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
15511
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
15915
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15512
15916
|
object({
|
|
15513
|
-
kind: literal("
|
|
15514
|
-
|
|
15515
|
-
id: string(),
|
|
15516
|
-
/** Operator-facing button label. */
|
|
15517
|
-
label: string(),
|
|
15518
|
-
/** lucide-react icon name. */
|
|
15519
|
-
icon: string().optional(),
|
|
15520
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
15521
|
-
startUrl: string(),
|
|
15522
|
-
stage: LoginStageEnum
|
|
15917
|
+
kind: literal("catalog"),
|
|
15918
|
+
catalogId: string()
|
|
15523
15919
|
}),
|
|
15524
15920
|
object({
|
|
15525
|
-
kind: literal("
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
15529
|
-
addonId: string(),
|
|
15530
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
15531
|
-
bundle: string(),
|
|
15532
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
15533
|
-
remote: WidgetRemoteSchema,
|
|
15534
|
-
stage: LoginStageEnum
|
|
15921
|
+
kind: literal("url"),
|
|
15922
|
+
url: string(),
|
|
15923
|
+
sha256: string().optional()
|
|
15535
15924
|
}),
|
|
15536
15925
|
object({
|
|
15537
|
-
kind: literal("
|
|
15538
|
-
|
|
15539
|
-
id: string(),
|
|
15540
|
-
/** Operator-facing button label. */
|
|
15541
|
-
label: string(),
|
|
15542
|
-
stage: LoginStageEnum,
|
|
15543
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
15544
|
-
rpId: string(),
|
|
15545
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
15546
|
-
origin: string().nullable()
|
|
15926
|
+
kind: literal("path"),
|
|
15927
|
+
path: string()
|
|
15547
15928
|
})
|
|
15548
15929
|
]);
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
usedBytes: number(),
|
|
15567
|
-
availableBytes: number(),
|
|
15568
|
-
swapUsedBytes: number(),
|
|
15569
|
-
swapTotalBytes: number()
|
|
15570
|
-
});
|
|
15571
|
-
var DiskIoSnapshotSchema = object({
|
|
15572
|
-
readBytes: number(),
|
|
15573
|
-
writeBytes: number(),
|
|
15574
|
-
readOps: number(),
|
|
15575
|
-
writeOps: number(),
|
|
15576
|
-
timestampMs: number()
|
|
15577
|
-
});
|
|
15578
|
-
var NetworkIoSnapshotSchema = object({
|
|
15579
|
-
rxBytes: number(),
|
|
15580
|
-
txBytes: number(),
|
|
15581
|
-
rxPackets: number(),
|
|
15582
|
-
txPackets: number(),
|
|
15583
|
-
rxErrors: number(),
|
|
15584
|
-
txErrors: number(),
|
|
15585
|
-
timestampMs: number()
|
|
15586
|
-
});
|
|
15587
|
-
var MetricsGpuInfoSchema = object({
|
|
15588
|
-
utilization: number(),
|
|
15589
|
-
model: string(),
|
|
15590
|
-
memoryUsedBytes: number(),
|
|
15591
|
-
memoryTotalBytes: number(),
|
|
15592
|
-
temperature: number().nullable()
|
|
15593
|
-
});
|
|
15594
|
-
var ProcessResourceInfoSchema = object({
|
|
15595
|
-
openFds: number(),
|
|
15596
|
-
threadCount: number(),
|
|
15597
|
-
activeHandles: number(),
|
|
15598
|
-
activeRequests: number()
|
|
15599
|
-
});
|
|
15600
|
-
var PressureAvgsSchema = object({
|
|
15601
|
-
avg10: number(),
|
|
15602
|
-
avg60: number(),
|
|
15603
|
-
avg300: number()
|
|
15604
|
-
});
|
|
15605
|
-
var PressureInfoSchema = object({
|
|
15606
|
-
some: PressureAvgsSchema,
|
|
15607
|
-
full: PressureAvgsSchema.nullable()
|
|
15608
|
-
});
|
|
15609
|
-
var SystemResourceSnapshotSchema = object({
|
|
15610
|
-
cpu: CpuBreakdownSchema,
|
|
15611
|
-
memory: MemoryInfoSchema,
|
|
15612
|
-
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15613
|
-
network: NetworkIoSnapshotSchema,
|
|
15614
|
-
disk: DiskIoSnapshotSchema,
|
|
15615
|
-
pressure: object({
|
|
15616
|
-
cpu: PressureInfoSchema.nullable(),
|
|
15617
|
-
memory: PressureInfoSchema.nullable(),
|
|
15618
|
-
io: PressureInfoSchema.nullable()
|
|
15619
|
-
}),
|
|
15620
|
-
process: ProcessResourceInfoSchema,
|
|
15621
|
-
cpuTemperature: number().nullable(),
|
|
15622
|
-
timestampMs: number()
|
|
15623
|
-
});
|
|
15624
|
-
var DiskSpaceInfoSchema = object({
|
|
15625
|
-
path: string(),
|
|
15626
|
-
totalBytes: number(),
|
|
15627
|
-
usedBytes: number(),
|
|
15628
|
-
availableBytes: number(),
|
|
15629
|
-
percent: number()
|
|
15630
|
-
});
|
|
15631
|
-
var PidResourceStatsSchema = object({
|
|
15632
|
-
pid: number(),
|
|
15633
|
-
cpu: number(),
|
|
15634
|
-
memory: number(),
|
|
15635
|
-
/**
|
|
15636
|
-
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
15637
|
-
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
15638
|
-
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
15639
|
-
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
15640
|
-
* Undefined where /proc is unavailable (e.g. macOS).
|
|
15641
|
-
*/
|
|
15642
|
-
privateBytes: number().optional(),
|
|
15643
|
-
/**
|
|
15644
|
-
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
15645
|
-
* code shared copy-on-write across runners. Undefined on macOS.
|
|
15646
|
-
*/
|
|
15647
|
-
sharedBytes: number().optional()
|
|
15930
|
+
var ManagedRuntimeConfigSchema = object({
|
|
15931
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
15932
|
+
nodeId: string(),
|
|
15933
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15934
|
+
engine: _enum(["llama-cpp"]),
|
|
15935
|
+
model: ManagedModelRefSchema,
|
|
15936
|
+
contextSize: number().int().default(4096),
|
|
15937
|
+
/** 0 = CPU-only. */
|
|
15938
|
+
gpuLayers: number().int().default(0),
|
|
15939
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15940
|
+
threads: number().int().optional(),
|
|
15941
|
+
/** Concurrent slots. */
|
|
15942
|
+
parallel: number().int().default(1),
|
|
15943
|
+
/** Else lazy: first generate boots it. */
|
|
15944
|
+
autoStart: boolean().default(false),
|
|
15945
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
15946
|
+
idleStopMinutes: number().int().default(30)
|
|
15648
15947
|
});
|
|
15649
|
-
var
|
|
15650
|
-
|
|
15948
|
+
var LlmRuntimeStatusSchema = object({
|
|
15949
|
+
/** Status is ALWAYS node-qualified. */
|
|
15651
15950
|
nodeId: string(),
|
|
15652
|
-
role: _enum(["hub", "worker"]),
|
|
15653
|
-
pid: number(),
|
|
15654
15951
|
state: _enum([
|
|
15655
|
-
"starting",
|
|
15656
|
-
"running",
|
|
15657
|
-
"stopping",
|
|
15658
15952
|
"stopped",
|
|
15659
|
-
"
|
|
15660
|
-
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
pid: number(),
|
|
15665
|
-
ppid: number(),
|
|
15666
|
-
pgid: number(),
|
|
15667
|
-
classification: _enum([
|
|
15668
|
-
"root",
|
|
15669
|
-
"managed",
|
|
15670
|
-
"system",
|
|
15671
|
-
"ghost"
|
|
15953
|
+
"downloading",
|
|
15954
|
+
"starting",
|
|
15955
|
+
"ready",
|
|
15956
|
+
"crashed",
|
|
15957
|
+
"failed"
|
|
15672
15958
|
]),
|
|
15673
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
15674
|
-
addonId: string().nullable(),
|
|
15675
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15676
|
-
nodeId: string().nullable(),
|
|
15677
|
-
/** Truncated command line. */
|
|
15678
|
-
command: string(),
|
|
15679
|
-
cpuPercent: number(),
|
|
15680
|
-
memoryRssBytes: number(),
|
|
15681
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15682
|
-
uptimeSec: number(),
|
|
15683
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15684
|
-
orphaned: boolean()
|
|
15685
|
-
});
|
|
15686
|
-
var KillProcessInputSchema = object({
|
|
15687
|
-
pid: number(),
|
|
15688
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15689
|
-
force: boolean().optional()
|
|
15690
|
-
});
|
|
15691
|
-
var KillProcessResultSchema = object({
|
|
15692
|
-
success: boolean(),
|
|
15693
|
-
reason: string().optional(),
|
|
15694
|
-
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15695
|
-
});
|
|
15696
|
-
var DumpHeapSnapshotInputSchema = object({
|
|
15697
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
15698
|
-
addonId: string() });
|
|
15699
|
-
var DumpHeapSnapshotResultSchema = object({
|
|
15700
|
-
success: boolean(),
|
|
15701
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15702
|
-
path: string().optional(),
|
|
15703
|
-
/** Process pid that was signalled. */
|
|
15704
15959
|
pid: number().optional(),
|
|
15705
|
-
|
|
15960
|
+
port: number().optional(),
|
|
15961
|
+
modelPath: string().optional(),
|
|
15962
|
+
modelId: string().optional(),
|
|
15963
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
15964
|
+
lastError: string().optional(),
|
|
15965
|
+
crashesInWindow: number(),
|
|
15966
|
+
/** Child RSS (sampled best-effort). */
|
|
15967
|
+
memoryBytes: number().optional(),
|
|
15968
|
+
vramBytes: number().optional()
|
|
15706
15969
|
});
|
|
15707
|
-
var
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
|
|
15712
|
-
diskPercent: number().optional(),
|
|
15713
|
-
temperature: number().optional(),
|
|
15714
|
-
gpuPercent: number().optional(),
|
|
15715
|
-
gpuMemoryPercent: number().optional()
|
|
15970
|
+
var LlmNodeModelSchema = object({
|
|
15971
|
+
file: string(),
|
|
15972
|
+
sizeBytes: number(),
|
|
15973
|
+
catalogId: string().optional(),
|
|
15974
|
+
installedAt: number().optional()
|
|
15716
15975
|
});
|
|
15717
|
-
|
|
15976
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
15977
|
+
nodeId: string(),
|
|
15978
|
+
modelsBytes: number(),
|
|
15979
|
+
freeBytes: number().optional()
|
|
15980
|
+
});
|
|
15981
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
15982
|
+
images: array(LlmImageSchema).optional(),
|
|
15983
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
15984
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15985
|
+
timeoutMs: number().int().positive().optional()
|
|
15986
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15718
15987
|
kind: "mutation",
|
|
15719
15988
|
auth: "admin"
|
|
15720
|
-
}), method(
|
|
15989
|
+
}), method(object({}), _void(), {
|
|
15721
15990
|
kind: "mutation",
|
|
15722
15991
|
auth: "admin"
|
|
15723
|
-
})
|
|
15724
|
-
method(object({
|
|
15725
|
-
sourceUrl: string(),
|
|
15726
|
-
metadata: ModelConvertMetadataSchema,
|
|
15727
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15728
|
-
calibrationRef: string().optional(),
|
|
15729
|
-
sessionId: string().optional()
|
|
15730
|
-
}), ConvertResultSchema, {
|
|
15992
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15731
15993
|
kind: "mutation",
|
|
15732
|
-
auth: "admin"
|
|
15733
|
-
|
|
15734
|
-
});
|
|
15735
|
-
method(object({
|
|
15736
|
-
nodeId: string(),
|
|
15737
|
-
modelId: string(),
|
|
15738
|
-
format: _enum(MODEL_FORMATS),
|
|
15739
|
-
entry: ModelCatalogEntrySchema
|
|
15740
|
-
}), object({
|
|
15741
|
-
ok: boolean(),
|
|
15742
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15743
|
-
sha256: string(),
|
|
15744
|
-
bytes: number(),
|
|
15745
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15746
|
-
path: string()
|
|
15747
|
-
}), {
|
|
15994
|
+
auth: "admin"
|
|
15995
|
+
}), method(object({ file: string() }), _void(), {
|
|
15748
15996
|
kind: "mutation",
|
|
15749
15997
|
auth: "admin"
|
|
15750
|
-
});
|
|
15751
|
-
/**
|
|
15752
|
-
* `mqtt-broker` — broker-registry cap.
|
|
15753
|
-
*
|
|
15754
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15755
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15756
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
15757
|
-
* its OWN `mqtt.js` client.
|
|
15758
|
-
*
|
|
15759
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15760
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15761
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
15762
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15763
|
-
* features anyway — give it the connection config, get out of the way.
|
|
15764
|
-
*
|
|
15765
|
-
* Consumer flow:
|
|
15766
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
15767
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
15768
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
15769
|
-
*
|
|
15770
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
15771
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
15772
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
15773
|
-
* spawned it.
|
|
15774
|
-
*/
|
|
15775
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
15998
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15776
15999
|
/**
|
|
15777
|
-
*
|
|
16000
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
16001
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
16002
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
16003
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
16004
|
+
* (hub-placed); the cap stays open for future providers.
|
|
15778
16005
|
*
|
|
15779
|
-
*
|
|
15780
|
-
*
|
|
15781
|
-
*
|
|
15782
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
15783
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16006
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
16007
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
16008
|
+
* write; a stored key NEVER round-trips to a client.
|
|
15784
16009
|
*/
|
|
15785
|
-
var
|
|
15786
|
-
"
|
|
15787
|
-
"
|
|
15788
|
-
"
|
|
15789
|
-
"
|
|
15790
|
-
"
|
|
16010
|
+
var LlmProfileKindSchema = _enum([
|
|
16011
|
+
"openai-compatible",
|
|
16012
|
+
"openai",
|
|
16013
|
+
"anthropic",
|
|
16014
|
+
"google",
|
|
16015
|
+
"managed-local"
|
|
15791
16016
|
]);
|
|
15792
|
-
var
|
|
16017
|
+
var LlmProfileSchema = object({
|
|
15793
16018
|
id: string(),
|
|
15794
16019
|
name: string(),
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
|
|
16020
|
+
kind: LlmProfileKindSchema,
|
|
16021
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
16022
|
+
addonId: string(),
|
|
16023
|
+
enabled: boolean(),
|
|
16024
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
16025
|
+
model: string(),
|
|
16026
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
16027
|
+
baseUrl: string().optional(),
|
|
16028
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
16029
|
+
apiKey: string().optional(),
|
|
16030
|
+
supportsVision: boolean(),
|
|
16031
|
+
temperature: number().min(0).max(2).optional(),
|
|
16032
|
+
maxTokens: number().int().positive().optional(),
|
|
16033
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
16034
|
+
extraHeaders: record(string(), string()).optional(),
|
|
16035
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
16036
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15804
16037
|
});
|
|
15805
|
-
/**
|
|
15806
|
-
*
|
|
15807
|
-
*
|
|
15808
|
-
|
|
15809
|
-
|
|
15810
|
-
|
|
15811
|
-
|
|
15812
|
-
|
|
15813
|
-
|
|
15814
|
-
|
|
15815
|
-
|
|
15816
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
15817
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
15818
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
15819
|
-
* broker).
|
|
15820
|
-
*/
|
|
15821
|
-
clientIdPrefix: string().optional()
|
|
16038
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
16039
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
16040
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
16041
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
16042
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
16043
|
+
kind: LlmProfileKindSchema,
|
|
16044
|
+
label: string(),
|
|
16045
|
+
icon: string(),
|
|
16046
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16047
|
+
addonId: string(),
|
|
16048
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
15822
16049
|
});
|
|
15823
|
-
var
|
|
15824
|
-
|
|
15825
|
-
|
|
15826
|
-
|
|
15827
|
-
password: string().optional(),
|
|
15828
|
-
clientIdPrefix: string().optional()
|
|
16050
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
16051
|
+
var LlmDefaultSchema = object({
|
|
16052
|
+
selector: LlmDefaultSelectorSchema,
|
|
16053
|
+
profileId: string()
|
|
15829
16054
|
});
|
|
15830
|
-
|
|
15831
|
-
var
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
15842
|
-
allowAnonymous: boolean().default(false),
|
|
15843
|
-
/** Optional shared username/password for clients. */
|
|
15844
|
-
username: string().optional(),
|
|
15845
|
-
password: string().optional()
|
|
16055
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
16056
|
+
var LlmUsageRollupSchema = object({
|
|
16057
|
+
day: string(),
|
|
16058
|
+
consumer: string(),
|
|
16059
|
+
profileId: string(),
|
|
16060
|
+
calls: number(),
|
|
16061
|
+
okCalls: number(),
|
|
16062
|
+
errorCalls: number(),
|
|
16063
|
+
inputTokens: number(),
|
|
16064
|
+
outputTokens: number(),
|
|
16065
|
+
avgLatencyMs: number()
|
|
15846
16066
|
});
|
|
15847
|
-
|
|
16067
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
16068
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
15848
16069
|
id: string(),
|
|
15849
|
-
|
|
15850
|
-
|
|
15851
|
-
|
|
15852
|
-
brokerCount: number(),
|
|
15853
|
-
embeddedRunning: boolean()
|
|
15854
|
-
});
|
|
15855
|
-
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);
|
|
15856
|
-
var NetworkEndpointSchema = object({
|
|
16070
|
+
label: string(),
|
|
16071
|
+
family: string(),
|
|
16072
|
+
purpose: _enum(["text", "vision"]),
|
|
15857
16073
|
url: string(),
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
16074
|
+
sha256: string(),
|
|
16075
|
+
sizeBytes: number(),
|
|
16076
|
+
quantization: string(),
|
|
16077
|
+
/** Load-time guidance shown in the picker. */
|
|
16078
|
+
minRamBytes: number(),
|
|
16079
|
+
contextSizeDefault: number().int(),
|
|
16080
|
+
/** Vision models: companion projector file. */
|
|
16081
|
+
mmprojUrl: string().optional()
|
|
15861
16082
|
});
|
|
15862
|
-
var
|
|
15863
|
-
|
|
15864
|
-
|
|
16083
|
+
var LlmRuntimeNodeSchema = object({
|
|
16084
|
+
nodeId: string(),
|
|
16085
|
+
reachable: boolean(),
|
|
16086
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
16087
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15865
16088
|
error: string().optional()
|
|
15866
16089
|
});
|
|
15867
|
-
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
15874
|
-
|
|
15875
|
-
|
|
15876
|
-
|
|
15877
|
-
|
|
15878
|
-
|
|
15879
|
-
|
|
15880
|
-
|
|
15881
|
-
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
|
|
16090
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
16091
|
+
var ProfileRefInputSchema = object({
|
|
16092
|
+
addonId: string(),
|
|
16093
|
+
profileId: string()
|
|
16094
|
+
});
|
|
16095
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
16096
|
+
kind: "mutation",
|
|
16097
|
+
auth: "admin"
|
|
16098
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16099
|
+
kind: "mutation",
|
|
16100
|
+
auth: "admin"
|
|
16101
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
16102
|
+
kind: "mutation",
|
|
16103
|
+
auth: "admin"
|
|
16104
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
16105
|
+
selector: LlmDefaultSelectorSchema,
|
|
16106
|
+
profileId: string().nullable()
|
|
16107
|
+
}), _void(), {
|
|
16108
|
+
kind: "mutation",
|
|
16109
|
+
auth: "admin"
|
|
16110
|
+
}), method(object({
|
|
16111
|
+
since: number().optional(),
|
|
16112
|
+
until: number().optional(),
|
|
16113
|
+
consumer: string().optional(),
|
|
16114
|
+
profileId: string().optional()
|
|
16115
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16116
|
+
nodeId: string(),
|
|
16117
|
+
model: ManagedModelRefSchema
|
|
16118
|
+
}), _void(), {
|
|
16119
|
+
kind: "mutation",
|
|
16120
|
+
auth: "admin"
|
|
16121
|
+
}), method(object({
|
|
16122
|
+
nodeId: string(),
|
|
16123
|
+
file: string()
|
|
16124
|
+
}), _void(), {
|
|
16125
|
+
kind: "mutation",
|
|
16126
|
+
auth: "admin"
|
|
16127
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16128
|
+
kind: "mutation",
|
|
16129
|
+
auth: "admin"
|
|
16130
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
16131
|
+
kind: "mutation",
|
|
16132
|
+
auth: "admin"
|
|
16133
|
+
});
|
|
16134
|
+
var LogLevelSchema = _enum([
|
|
16135
|
+
"debug",
|
|
16136
|
+
"info",
|
|
16137
|
+
"warn",
|
|
16138
|
+
"error"
|
|
16139
|
+
]);
|
|
16140
|
+
var LogEntrySchema = object({
|
|
16141
|
+
timestamp: date(),
|
|
16142
|
+
level: LogLevelSchema,
|
|
16143
|
+
scope: array(string()),
|
|
16144
|
+
message: string(),
|
|
16145
|
+
meta: record(string(), unknown()).optional(),
|
|
16146
|
+
tags: record(string(), string()).optional()
|
|
15887
16147
|
});
|
|
15888
|
-
method(
|
|
16148
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
16149
|
+
scope: array(string()).optional(),
|
|
16150
|
+
level: LogLevelSchema.optional(),
|
|
16151
|
+
since: date().optional(),
|
|
16152
|
+
until: date().optional(),
|
|
16153
|
+
limit: number().optional(),
|
|
16154
|
+
tags: record(string(), string()).optional()
|
|
16155
|
+
}), array(LogEntrySchema).readonly());
|
|
15889
16156
|
/**
|
|
15890
|
-
*
|
|
16157
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
16158
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
16159
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
16160
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
16161
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
16162
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
15891
16163
|
*
|
|
15892
|
-
*
|
|
15893
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
15894
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
15895
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
15896
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
15897
|
-
* message to what the kind supports — callers never special-case a service.
|
|
16164
|
+
* A contribution is a discriminated union on `kind`:
|
|
15898
16165
|
*
|
|
15899
|
-
*
|
|
15900
|
-
*
|
|
15901
|
-
* `
|
|
15902
|
-
*
|
|
15903
|
-
*
|
|
15904
|
-
* alternative would fork the UI per addon and cannot host the
|
|
15905
|
-
* discovery→adopt flow.
|
|
15906
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
15907
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
15908
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
15909
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
15910
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
15911
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
15912
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
15913
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
15914
|
-
* base64 fallback needed.
|
|
16166
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
16167
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16168
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
16169
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16170
|
+
* login page needs NO change.
|
|
15915
16171
|
*
|
|
15916
|
-
*
|
|
15917
|
-
*
|
|
15918
|
-
*
|
|
15919
|
-
|
|
15920
|
-
|
|
15921
|
-
*
|
|
15922
|
-
*
|
|
15923
|
-
|
|
15924
|
-
|
|
15925
|
-
|
|
15926
|
-
|
|
15927
|
-
|
|
15928
|
-
|
|
15929
|
-
|
|
15930
|
-
|
|
15931
|
-
|
|
15932
|
-
*
|
|
15933
|
-
*
|
|
15934
|
-
*
|
|
15935
|
-
*
|
|
16172
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
16173
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
16174
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
16175
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
16176
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
16177
|
+
*
|
|
16178
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
16179
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
16180
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
16181
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
16182
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
16183
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
16184
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
16185
|
+
* decision.
|
|
16186
|
+
*
|
|
16187
|
+
* Every contribution carries a `stage`:
|
|
16188
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
16189
|
+
* magic-link buttons; a future usernameless passkey).
|
|
16190
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16191
|
+
* returned `factors` (passkey-as-2FA today).
|
|
16192
|
+
*
|
|
16193
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
16194
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
16195
|
+
* tRPC router.
|
|
15936
16196
|
*/
|
|
15937
|
-
|
|
15938
|
-
|
|
15939
|
-
|
|
15940
|
-
|
|
15941
|
-
|
|
15942
|
-
|
|
15943
|
-
|
|
15944
|
-
|
|
15945
|
-
|
|
15946
|
-
|
|
15947
|
-
|
|
16197
|
+
/** When a login method renders in the two-phase login flow. */
|
|
16198
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
16199
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
16200
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
16201
|
+
object({
|
|
16202
|
+
kind: literal("redirect"),
|
|
16203
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
16204
|
+
id: string(),
|
|
16205
|
+
/** Operator-facing button label. */
|
|
16206
|
+
label: string(),
|
|
16207
|
+
/** lucide-react icon name. */
|
|
16208
|
+
icon: string().optional(),
|
|
16209
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
16210
|
+
startUrl: string(),
|
|
16211
|
+
stage: LoginStageEnum
|
|
16212
|
+
}),
|
|
16213
|
+
object({
|
|
16214
|
+
kind: literal("widget"),
|
|
16215
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
16216
|
+
id: string(),
|
|
16217
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
16218
|
+
addonId: string(),
|
|
16219
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
16220
|
+
bundle: string(),
|
|
16221
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
16222
|
+
remote: WidgetRemoteSchema,
|
|
16223
|
+
stage: LoginStageEnum
|
|
16224
|
+
}),
|
|
16225
|
+
object({
|
|
16226
|
+
kind: literal("passkey"),
|
|
16227
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
16228
|
+
id: string(),
|
|
16229
|
+
/** Operator-facing button label. */
|
|
16230
|
+
label: string(),
|
|
16231
|
+
stage: LoginStageEnum,
|
|
16232
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
16233
|
+
rpId: string(),
|
|
16234
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
16235
|
+
origin: string().nullable()
|
|
16236
|
+
})
|
|
15948
16237
|
]);
|
|
15949
|
-
|
|
15950
|
-
var
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
16238
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
16239
|
+
var CpuBreakdownSchema = object({
|
|
16240
|
+
total: number(),
|
|
16241
|
+
user: number(),
|
|
16242
|
+
system: number(),
|
|
16243
|
+
irq: number(),
|
|
16244
|
+
nice: number(),
|
|
16245
|
+
loadAvg: tuple([
|
|
16246
|
+
number(),
|
|
16247
|
+
number(),
|
|
16248
|
+
number()
|
|
16249
|
+
]),
|
|
16250
|
+
cores: number()
|
|
15954
16251
|
});
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
var
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
|
|
15977
|
-
|
|
16252
|
+
var MemoryInfoSchema = object({
|
|
16253
|
+
percent: number(),
|
|
16254
|
+
totalBytes: number(),
|
|
16255
|
+
usedBytes: number(),
|
|
16256
|
+
availableBytes: number(),
|
|
16257
|
+
swapUsedBytes: number(),
|
|
16258
|
+
swapTotalBytes: number()
|
|
16259
|
+
});
|
|
16260
|
+
var DiskIoSnapshotSchema = object({
|
|
16261
|
+
readBytes: number(),
|
|
16262
|
+
writeBytes: number(),
|
|
16263
|
+
readOps: number(),
|
|
16264
|
+
writeOps: number(),
|
|
16265
|
+
timestampMs: number()
|
|
16266
|
+
});
|
|
16267
|
+
var NetworkIoSnapshotSchema = object({
|
|
16268
|
+
rxBytes: number(),
|
|
16269
|
+
txBytes: number(),
|
|
16270
|
+
rxPackets: number(),
|
|
16271
|
+
txPackets: number(),
|
|
16272
|
+
rxErrors: number(),
|
|
16273
|
+
txErrors: number(),
|
|
16274
|
+
timestampMs: number()
|
|
16275
|
+
});
|
|
16276
|
+
var MetricsGpuInfoSchema = object({
|
|
16277
|
+
utilization: number(),
|
|
16278
|
+
model: string(),
|
|
16279
|
+
memoryUsedBytes: number(),
|
|
16280
|
+
memoryTotalBytes: number(),
|
|
16281
|
+
temperature: number().nullable()
|
|
16282
|
+
});
|
|
16283
|
+
var ProcessResourceInfoSchema = object({
|
|
16284
|
+
openFds: number(),
|
|
16285
|
+
threadCount: number(),
|
|
16286
|
+
activeHandles: number(),
|
|
16287
|
+
activeRequests: number()
|
|
15978
16288
|
});
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
15984
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
15985
|
-
flags: object({
|
|
15986
|
-
critical: boolean().optional(),
|
|
15987
|
-
silent: boolean().optional(),
|
|
15988
|
-
noPush: boolean().optional()
|
|
15989
|
-
}).optional(),
|
|
15990
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
15991
|
-
requires: array(string()).optional(),
|
|
15992
|
-
description: string().optional()
|
|
16289
|
+
var PressureAvgsSchema = object({
|
|
16290
|
+
avg10: number(),
|
|
16291
|
+
avg60: number(),
|
|
16292
|
+
avg300: number()
|
|
15993
16293
|
});
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16294
|
+
var PressureInfoSchema = object({
|
|
16295
|
+
some: PressureAvgsSchema,
|
|
16296
|
+
full: PressureAvgsSchema.nullable()
|
|
16297
|
+
});
|
|
16298
|
+
var SystemResourceSnapshotSchema = object({
|
|
16299
|
+
cpu: CpuBreakdownSchema,
|
|
16300
|
+
memory: MemoryInfoSchema,
|
|
16301
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
16302
|
+
network: NetworkIoSnapshotSchema,
|
|
16303
|
+
disk: DiskIoSnapshotSchema,
|
|
16304
|
+
pressure: object({
|
|
16305
|
+
cpu: PressureInfoSchema.nullable(),
|
|
16306
|
+
memory: PressureInfoSchema.nullable(),
|
|
16307
|
+
io: PressureInfoSchema.nullable()
|
|
16005
16308
|
}),
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
format: array(NotificationFormatSchema),
|
|
16010
|
-
clickUrl: boolean(),
|
|
16011
|
-
sound: boolean(),
|
|
16012
|
-
ttl: boolean(),
|
|
16013
|
-
bodyMaxLen: number().int().positive()
|
|
16309
|
+
process: ProcessResourceInfoSchema,
|
|
16310
|
+
cpuTemperature: number().nullable(),
|
|
16311
|
+
timestampMs: number()
|
|
16014
16312
|
});
|
|
16015
|
-
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
*/
|
|
16022
|
-
var ConfigSchemaPassthrough = unknown();
|
|
16023
|
-
var TargetKindSchema = object({
|
|
16024
|
-
kind: string(),
|
|
16025
|
-
label: string(),
|
|
16026
|
-
icon: string(),
|
|
16027
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16028
|
-
addonId: string(),
|
|
16029
|
-
configSchema: ConfigSchemaPassthrough,
|
|
16030
|
-
supportsDiscovery: boolean(),
|
|
16031
|
-
caps: TargetKindCapsSchema
|
|
16313
|
+
var DiskSpaceInfoSchema = object({
|
|
16314
|
+
path: string(),
|
|
16315
|
+
totalBytes: number(),
|
|
16316
|
+
usedBytes: number(),
|
|
16317
|
+
availableBytes: number(),
|
|
16318
|
+
percent: number()
|
|
16032
16319
|
});
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
|
|
16036
|
-
|
|
16037
|
-
|
|
16038
|
-
|
|
16039
|
-
|
|
16040
|
-
|
|
16041
|
-
|
|
16320
|
+
var PidResourceStatsSchema = object({
|
|
16321
|
+
pid: number(),
|
|
16322
|
+
cpu: number(),
|
|
16323
|
+
memory: number(),
|
|
16324
|
+
/**
|
|
16325
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
16326
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
16327
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
16328
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
16329
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
16330
|
+
*/
|
|
16331
|
+
privateBytes: number().optional(),
|
|
16332
|
+
/**
|
|
16333
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
16334
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
16335
|
+
*/
|
|
16336
|
+
sharedBytes: number().optional()
|
|
16337
|
+
});
|
|
16338
|
+
var AddonInstanceSchema = object({
|
|
16042
16339
|
addonId: string(),
|
|
16043
|
-
|
|
16044
|
-
|
|
16340
|
+
nodeId: string(),
|
|
16341
|
+
role: _enum(["hub", "worker"]),
|
|
16342
|
+
pid: number(),
|
|
16343
|
+
state: _enum([
|
|
16344
|
+
"starting",
|
|
16345
|
+
"running",
|
|
16346
|
+
"stopping",
|
|
16347
|
+
"stopped",
|
|
16348
|
+
"crashed"
|
|
16349
|
+
]),
|
|
16350
|
+
uptimeSec: number()
|
|
16045
16351
|
});
|
|
16046
|
-
|
|
16047
|
-
|
|
16048
|
-
|
|
16049
|
-
|
|
16050
|
-
|
|
16352
|
+
var NodeProcessSchema = object({
|
|
16353
|
+
pid: number(),
|
|
16354
|
+
ppid: number(),
|
|
16355
|
+
pgid: number(),
|
|
16356
|
+
classification: _enum([
|
|
16357
|
+
"root",
|
|
16358
|
+
"managed",
|
|
16359
|
+
"system",
|
|
16360
|
+
"ghost"
|
|
16361
|
+
]),
|
|
16362
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
16363
|
+
addonId: string().nullable(),
|
|
16364
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
16365
|
+
nodeId: string().nullable(),
|
|
16366
|
+
/** Truncated command line. */
|
|
16367
|
+
command: string(),
|
|
16368
|
+
cpuPercent: number(),
|
|
16369
|
+
memoryRssBytes: number(),
|
|
16370
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
16371
|
+
uptimeSec: number(),
|
|
16372
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
16373
|
+
orphaned: boolean()
|
|
16051
16374
|
});
|
|
16052
|
-
|
|
16053
|
-
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
attachmentsSent: number().int().nonnegative(),
|
|
16057
|
-
actionsSent: number().int().nonnegative(),
|
|
16058
|
-
truncated: boolean(),
|
|
16059
|
-
dropped: array(string())
|
|
16375
|
+
var KillProcessInputSchema = object({
|
|
16376
|
+
pid: number(),
|
|
16377
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
16378
|
+
force: boolean().optional()
|
|
16060
16379
|
});
|
|
16061
|
-
var
|
|
16380
|
+
var KillProcessResultSchema = object({
|
|
16062
16381
|
success: boolean(),
|
|
16063
|
-
|
|
16064
|
-
|
|
16382
|
+
reason: string().optional(),
|
|
16383
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
16384
|
+
});
|
|
16385
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
16386
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
16387
|
+
addonId: string() });
|
|
16388
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
16389
|
+
success: boolean(),
|
|
16390
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
16391
|
+
path: string().optional(),
|
|
16392
|
+
/** Process pid that was signalled. */
|
|
16393
|
+
pid: number().optional(),
|
|
16394
|
+
reason: string().optional()
|
|
16395
|
+
});
|
|
16396
|
+
var SystemMetricsSchema = object({
|
|
16397
|
+
cpuPercent: number(),
|
|
16398
|
+
memoryPercent: number(),
|
|
16399
|
+
memoryUsedMB: number(),
|
|
16400
|
+
memoryTotalMB: number(),
|
|
16401
|
+
diskPercent: number().optional(),
|
|
16402
|
+
temperature: number().optional(),
|
|
16403
|
+
gpuPercent: number().optional(),
|
|
16404
|
+
gpuMemoryPercent: number().optional()
|
|
16405
|
+
});
|
|
16406
|
+
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, {
|
|
16407
|
+
kind: "mutation",
|
|
16408
|
+
auth: "admin"
|
|
16409
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
16410
|
+
kind: "mutation",
|
|
16411
|
+
auth: "admin"
|
|
16412
|
+
});
|
|
16413
|
+
method(object({
|
|
16414
|
+
sourceUrl: string(),
|
|
16415
|
+
metadata: ModelConvertMetadataSchema,
|
|
16416
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
16417
|
+
calibrationRef: string().optional(),
|
|
16418
|
+
sessionId: string().optional()
|
|
16419
|
+
}), ConvertResultSchema, {
|
|
16420
|
+
kind: "mutation",
|
|
16421
|
+
auth: "admin",
|
|
16422
|
+
timeoutMs: 6e5
|
|
16423
|
+
});
|
|
16424
|
+
method(object({
|
|
16425
|
+
nodeId: string(),
|
|
16426
|
+
modelId: string(),
|
|
16427
|
+
format: _enum(MODEL_FORMATS),
|
|
16428
|
+
entry: ModelCatalogEntrySchema
|
|
16429
|
+
}), object({
|
|
16430
|
+
ok: boolean(),
|
|
16431
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
16432
|
+
sha256: string(),
|
|
16433
|
+
bytes: number(),
|
|
16434
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
16435
|
+
path: string()
|
|
16436
|
+
}), {
|
|
16437
|
+
kind: "mutation",
|
|
16438
|
+
auth: "admin"
|
|
16065
16439
|
});
|
|
16066
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
16067
|
-
var TestResultSchema = SendResultSchema;
|
|
16068
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
16069
|
-
kind: string(),
|
|
16070
|
-
config: record(string(), unknown()).optional()
|
|
16071
|
-
}), array(DiscoveredTargetSchema)), method(object({
|
|
16072
|
-
targetId: string(),
|
|
16073
|
-
notification: NotificationSchema
|
|
16074
|
-
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
16075
|
-
targetId: string(),
|
|
16076
|
-
sample: NotificationSchema.optional()
|
|
16077
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16078
|
-
targetId: string(),
|
|
16079
|
-
enabled: boolean()
|
|
16080
|
-
}), _void(), { kind: "mutation" });
|
|
16081
16440
|
/**
|
|
16082
|
-
*
|
|
16083
|
-
*
|
|
16084
|
-
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
16085
|
-
* (operator decisions D-1/D-2/D-3 are binding):
|
|
16441
|
+
* `mqtt-broker` — broker-registry cap.
|
|
16086
16442
|
*
|
|
16087
|
-
*
|
|
16088
|
-
*
|
|
16089
|
-
*
|
|
16090
|
-
*
|
|
16091
|
-
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
16092
|
-
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
16093
|
-
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
16094
|
-
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
16095
|
-
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
16096
|
-
* by id; per-backend params are a passthrough blob capped by the
|
|
16097
|
-
* target kind's own caps/degrade engine).
|
|
16443
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
16444
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
16445
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
16446
|
+
* its OWN `mqtt.js` client.
|
|
16098
16447
|
*
|
|
16099
|
-
*
|
|
16100
|
-
*
|
|
16101
|
-
*
|
|
16102
|
-
*
|
|
16103
|
-
*
|
|
16104
|
-
* private zones, per-recipient fan-out and the wider condition table are
|
|
16105
|
-
* P2+ (see spec §7).
|
|
16448
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
16449
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
16450
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
16451
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
16452
|
+
* features anyway — give it the connection config, get out of the way.
|
|
16106
16453
|
*
|
|
16107
|
-
*
|
|
16108
|
-
*
|
|
16109
|
-
*
|
|
16454
|
+
* Consumer flow:
|
|
16455
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
16456
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
16457
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
16458
|
+
*
|
|
16459
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
16460
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
16461
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
16462
|
+
* spawned it.
|
|
16110
16463
|
*/
|
|
16464
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
16111
16465
|
/**
|
|
16112
|
-
*
|
|
16113
|
-
* The value maps 1:1 onto the evaluated record kind:
|
|
16114
|
-
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
16115
|
-
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
16116
|
-
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
16117
|
-
* change of a LINKED device, one row per linked camera)
|
|
16118
|
-
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
16119
|
-
* delivery / pick-up)
|
|
16466
|
+
* Broker live-probe status.
|
|
16120
16467
|
*
|
|
16121
|
-
*
|
|
16122
|
-
*
|
|
16123
|
-
*
|
|
16124
|
-
*
|
|
16468
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
16469
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
16470
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
16471
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
16472
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
16125
16473
|
*/
|
|
16126
|
-
var
|
|
16127
|
-
"
|
|
16128
|
-
"
|
|
16129
|
-
"
|
|
16130
|
-
"
|
|
16474
|
+
var BrokerStatusSchema$1 = _enum([
|
|
16475
|
+
"connected",
|
|
16476
|
+
"disconnected",
|
|
16477
|
+
"auth-failed",
|
|
16478
|
+
"unreachable",
|
|
16479
|
+
"tls-error"
|
|
16131
16480
|
]);
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
|
|
16140
|
-
/**
|
|
16141
|
-
|
|
16142
|
-
/**
|
|
16143
|
-
|
|
16144
|
-
});
|
|
16145
|
-
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
16146
|
-
var NcPlateMatcherSchema = object({
|
|
16147
|
-
values: array(string().min(1)).min(1),
|
|
16148
|
-
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
16149
|
-
maxDistance: number().int().min(0).max(3).default(1)
|
|
16150
|
-
});
|
|
16151
|
-
/**
|
|
16152
|
-
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
16153
|
-
* occupancy edge for a device — optionally narrowed to a single admin
|
|
16154
|
-
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
16155
|
-
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
16156
|
-
* - `became-free` — count crossed ≥ `count` → below it
|
|
16157
|
-
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
16158
|
-
* `sustainSeconds` requires the condition hold continuously that long
|
|
16159
|
-
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
16160
|
-
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
16161
|
-
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
16162
|
-
* (declared SQLite collection, reseeded on boot).
|
|
16163
|
-
*/
|
|
16164
|
-
var NcOccupancyConditionSchema = object({
|
|
16165
|
-
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
16166
|
-
zoneId: string().optional(),
|
|
16167
|
-
/** Object class to count; absent = any class. */
|
|
16168
|
-
className: string().optional(),
|
|
16169
|
-
op: _enum([
|
|
16170
|
-
"became-occupied",
|
|
16171
|
-
"became-free",
|
|
16172
|
-
">=",
|
|
16173
|
-
"<="
|
|
16174
|
-
]).default("became-occupied"),
|
|
16175
|
-
count: number().int().min(0).default(1),
|
|
16176
|
-
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
16177
|
-
});
|
|
16178
|
-
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
16179
|
-
var NcZoneConditionSchema = object({
|
|
16180
|
-
ids: array(string().min(1)).min(1),
|
|
16181
|
-
/** Quantifier over `ids` — at least one / every one visited. */
|
|
16182
|
-
match: _enum(["any", "all"]).default("any")
|
|
16183
|
-
});
|
|
16184
|
-
/**
|
|
16185
|
-
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
16186
|
-
* membership lists are OR within the list (spec §2.3).
|
|
16187
|
-
*/
|
|
16188
|
-
var NcConditionsSchema = object({
|
|
16189
|
-
/** Device scope — absent = all devices. */
|
|
16190
|
-
devices: array(number()).optional(),
|
|
16191
|
-
/** Detector class names (any overlap with the record's class set). */
|
|
16192
|
-
classes: array(string().min(1)).optional(),
|
|
16193
|
-
/** Veto classes — any overlap fails the rule. */
|
|
16194
|
-
classesExclude: array(string().min(1)).optional(),
|
|
16195
|
-
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
16196
|
-
minConfidence: number().min(0).max(1).optional(),
|
|
16197
|
-
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
16198
|
-
zones: NcZoneConditionSchema.optional(),
|
|
16199
|
-
/** Veto zones — any hit fails the rule. */
|
|
16200
|
-
zonesExclude: array(string().min(1)).optional(),
|
|
16201
|
-
/**
|
|
16202
|
-
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
16203
|
-
* (identity name / plate text / subclass).
|
|
16204
|
-
*/
|
|
16205
|
-
labelEquals: array(string().min(1)).optional(),
|
|
16206
|
-
/**
|
|
16207
|
-
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
16208
|
-
* `label` (the identity display name propagated by the face pipeline) —
|
|
16209
|
-
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
16210
|
-
*/
|
|
16211
|
-
identities: array(string().min(1)).optional(),
|
|
16212
|
-
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
16213
|
-
plates: NcPlateMatcherSchema.optional(),
|
|
16214
|
-
/**
|
|
16215
|
-
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
16216
|
-
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
16217
|
-
* identity display name). A record with NO label passes (nothing to
|
|
16218
|
-
* exclude), unlike the include variant which fails on an absent label.
|
|
16219
|
-
*/
|
|
16220
|
-
identitiesExclude: array(string().min(1)).optional(),
|
|
16221
|
-
/**
|
|
16222
|
-
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
16223
|
-
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
16224
|
-
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
16225
|
-
* close the value is threaded via the close-time info (the `Track` clone is
|
|
16226
|
-
* captured before the DB row is updated, so it would otherwise read stale).
|
|
16227
|
-
* Fails when the record carries no importance (never guess quality — the
|
|
16228
|
-
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
16229
|
-
*/
|
|
16230
|
-
minImportance: number().min(0).max(1).optional(),
|
|
16231
|
-
/**
|
|
16232
|
-
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
16233
|
-
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
16234
|
-
* lifespan, so a dwell condition never matches immediate delivery
|
|
16235
|
-
* (documented choice — the object-event record carries no `firstSeen`,
|
|
16236
|
-
* so dwell cannot be computed from what the subject actually carries).
|
|
16237
|
-
*/
|
|
16238
|
-
minDwellSeconds: number().min(0).optional(),
|
|
16239
|
-
/**
|
|
16240
|
-
* Detection provenance filter. `any` (default / absent) matches every
|
|
16241
|
-
* source; otherwise the subject's source must equal it. Legacy records
|
|
16242
|
-
* with no stamped source are treated as `pipeline`. The union spans both
|
|
16243
|
-
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
16244
|
-
* tracks carry `sensor`.
|
|
16245
|
-
*/
|
|
16246
|
-
source: _enum([
|
|
16247
|
-
"pipeline",
|
|
16248
|
-
"onboard",
|
|
16249
|
-
"sensor",
|
|
16250
|
-
"any"
|
|
16251
|
-
]).optional(),
|
|
16252
|
-
/**
|
|
16253
|
-
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
16254
|
-
* detector `minConfidence` (that gates the object-detection score; this
|
|
16255
|
-
* gates the recognition/OCR match score). Fails when the subject carries
|
|
16256
|
-
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
16257
|
-
* lives on the recognition result and reaches the subject at track close.
|
|
16258
|
-
*
|
|
16259
|
-
* What it measures precisely (plumbed at track close — the closer threads
|
|
16260
|
-
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
16261
|
-
* `importance`): the BEST recognition match confidence observed for the
|
|
16262
|
-
* label the track carries at close — for a face, the peak cosine similarity
|
|
16263
|
-
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
16264
|
-
* for a plate, the peak OCR read score of the best-held plate
|
|
16265
|
-
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
16266
|
-
* one track the higher of the two is used. A track that ended with no
|
|
16267
|
-
* confident identity/plate match carries no value, so the condition fails
|
|
16268
|
-
* closed for it (an un-recognized subject).
|
|
16269
|
-
*/
|
|
16270
|
-
minLabelConfidence: number().min(0).max(1).optional(),
|
|
16271
|
-
/**
|
|
16272
|
-
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
16273
|
-
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
16274
|
-
* against the token carried on the device-event subject (extracted from the
|
|
16275
|
-
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
16276
|
-
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
16277
|
-
* eventType, so gate those with {@link sensorKinds} instead.
|
|
16278
|
-
*/
|
|
16279
|
-
eventTypeTokens: array(string().min(1)).optional(),
|
|
16280
|
-
/**
|
|
16281
|
-
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
16282
|
-
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
16283
|
-
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
16284
|
-
*/
|
|
16285
|
-
sensorKinds: array(string().min(1)).optional(),
|
|
16286
|
-
/**
|
|
16287
|
-
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
16288
|
-
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
16289
|
-
* when the subject's phase does not match (a subject always carries a phase
|
|
16290
|
-
* on the package-event trigger).
|
|
16291
|
-
*/
|
|
16292
|
-
packagePhase: _enum([
|
|
16293
|
-
"delivered",
|
|
16294
|
-
"picked-up",
|
|
16295
|
-
"both"
|
|
16296
|
-
]).optional(),
|
|
16297
|
-
/**
|
|
16298
|
-
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
16299
|
-
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
16300
|
-
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
16301
|
-
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
16302
|
-
*/
|
|
16303
|
-
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
16304
|
-
/**
|
|
16305
|
-
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
16306
|
-
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
16307
|
-
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
16308
|
-
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
16309
|
-
*/
|
|
16310
|
-
occupancy: NcOccupancyConditionSchema.optional()
|
|
16311
|
-
});
|
|
16312
|
-
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
16313
|
-
var NcRuleTargetSchema = object({
|
|
16314
|
-
/** `notification-output` Target id. */
|
|
16315
|
-
targetId: string().min(1),
|
|
16316
|
-
/**
|
|
16317
|
-
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
16318
|
-
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
16319
|
-
* degrade engine drops what the backend can't render.
|
|
16320
|
-
*/
|
|
16321
|
-
params: record(string(), unknown()).optional()
|
|
16481
|
+
var BrokerInfoSchema = object({
|
|
16482
|
+
id: string(),
|
|
16483
|
+
name: string(),
|
|
16484
|
+
url: string(),
|
|
16485
|
+
kind: BrokerKindSchema,
|
|
16486
|
+
status: BrokerStatusSchema$1,
|
|
16487
|
+
latencyMs: number().nullable(),
|
|
16488
|
+
error: string().optional(),
|
|
16489
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
16490
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
16491
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
16492
|
+
lastCheckedAt: number().optional()
|
|
16322
16493
|
});
|
|
16323
16494
|
/**
|
|
16324
|
-
*
|
|
16325
|
-
*
|
|
16326
|
-
*
|
|
16327
|
-
*
|
|
16328
|
-
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
16329
|
-
* (or when the specific crop is missing) degrades to `best`, then
|
|
16330
|
-
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
16331
|
-
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
16332
|
-
* name), so the choice never drifts from the record that fired it.
|
|
16333
|
-
* - `keyFrame` — the clean scene frame (no subject box).
|
|
16334
|
-
* - `none` — no attachment.
|
|
16495
|
+
* Connection details — what a consumer needs to call
|
|
16496
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
16497
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
16498
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
16335
16499
|
*/
|
|
16336
|
-
var
|
|
16337
|
-
|
|
16338
|
-
|
|
16339
|
-
|
|
16340
|
-
"none"
|
|
16341
|
-
]).default("best") });
|
|
16342
|
-
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
16343
|
-
var NcThrottleSchema = object({
|
|
16344
|
-
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
16345
|
-
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
16346
|
-
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
16347
|
-
});
|
|
16348
|
-
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
16349
|
-
var NcRuleInputSchema = object({
|
|
16350
|
-
name: string().min(1).max(200),
|
|
16351
|
-
enabled: boolean().default(true),
|
|
16352
|
-
delivery: NcDeliverySchema,
|
|
16353
|
-
conditions: NcConditionsSchema.default({}),
|
|
16354
|
-
schedule: NcScheduleSchema.optional(),
|
|
16355
|
-
targets: array(NcRuleTargetSchema).min(1),
|
|
16356
|
-
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
16357
|
-
throttle: NcThrottleSchema.default({
|
|
16358
|
-
cooldownSec: 60,
|
|
16359
|
-
scope: "rule-device"
|
|
16360
|
-
}),
|
|
16361
|
-
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
16362
|
-
template: object({
|
|
16363
|
-
title: string().max(500).optional(),
|
|
16364
|
-
body: string().max(2e3).optional()
|
|
16365
|
-
}).optional(),
|
|
16366
|
-
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
16367
|
-
priority: number().int().min(1).max(5).default(3),
|
|
16500
|
+
var BrokerConnectionDetailsSchema = object({
|
|
16501
|
+
url: string(),
|
|
16502
|
+
username: string().optional(),
|
|
16503
|
+
password: string().optional(),
|
|
16368
16504
|
/**
|
|
16369
|
-
*
|
|
16370
|
-
*
|
|
16371
|
-
*
|
|
16505
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
16506
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
16507
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
16508
|
+
* broker).
|
|
16372
16509
|
*/
|
|
16373
|
-
|
|
16510
|
+
clientIdPrefix: string().optional()
|
|
16511
|
+
});
|
|
16512
|
+
var AddBrokerInputSchema = object({
|
|
16513
|
+
name: string().min(1),
|
|
16514
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
16515
|
+
username: string().optional(),
|
|
16516
|
+
password: string().optional(),
|
|
16517
|
+
clientIdPrefix: string().optional()
|
|
16518
|
+
});
|
|
16519
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
16520
|
+
var IdInputSchema = object({ id: string() });
|
|
16521
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
16522
|
+
ok: literal(true),
|
|
16523
|
+
latencyMs: number()
|
|
16524
|
+
}), object({
|
|
16525
|
+
ok: literal(false),
|
|
16526
|
+
error: string()
|
|
16527
|
+
})]);
|
|
16528
|
+
var StartEmbeddedInputSchema = object({
|
|
16529
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
16530
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
16531
|
+
allowAnonymous: boolean().default(false),
|
|
16532
|
+
/** Optional shared username/password for clients. */
|
|
16533
|
+
username: string().optional(),
|
|
16534
|
+
password: string().optional()
|
|
16535
|
+
});
|
|
16536
|
+
var StartEmbeddedResultSchema = object({
|
|
16537
|
+
id: string(),
|
|
16538
|
+
url: string()
|
|
16539
|
+
});
|
|
16540
|
+
var StatusSchema = object({
|
|
16541
|
+
brokerCount: number(),
|
|
16542
|
+
embeddedRunning: boolean()
|
|
16543
|
+
});
|
|
16544
|
+
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);
|
|
16545
|
+
var NetworkEndpointSchema = object({
|
|
16546
|
+
url: string(),
|
|
16547
|
+
hostname: string(),
|
|
16548
|
+
port: number(),
|
|
16549
|
+
protocol: _enum(["http", "https"])
|
|
16550
|
+
});
|
|
16551
|
+
var NetworkAccessStatusSchema = object({
|
|
16552
|
+
connected: boolean(),
|
|
16553
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
16554
|
+
error: string().optional()
|
|
16374
16555
|
});
|
|
16375
16556
|
/**
|
|
16376
|
-
*
|
|
16377
|
-
*
|
|
16378
|
-
*
|
|
16379
|
-
*
|
|
16380
|
-
*
|
|
16381
|
-
*
|
|
16382
|
-
* `updateRule` patch.
|
|
16557
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
16558
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
16559
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
16560
|
+
* the originating provider config (mode + sourcePort) so the
|
|
16561
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
16562
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
16383
16563
|
*/
|
|
16384
|
-
var
|
|
16385
|
-
/** A persisted rule. */
|
|
16386
|
-
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
16387
|
-
id: string(),
|
|
16388
|
-
/** userId of the admin who created the rule (server-stamped caller). */
|
|
16389
|
-
createdBy: string(),
|
|
16390
|
-
createdAt: number(),
|
|
16391
|
-
updatedAt: number(),
|
|
16564
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
16392
16565
|
/**
|
|
16393
|
-
*
|
|
16394
|
-
*
|
|
16395
|
-
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
16566
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
16567
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
16396
16568
|
*/
|
|
16397
|
-
|
|
16398
|
-
|
|
16399
|
-
|
|
16400
|
-
|
|
16401
|
-
|
|
16402
|
-
|
|
16403
|
-
|
|
16404
|
-
"device-event",
|
|
16405
|
-
"package-event"
|
|
16406
|
-
]),
|
|
16407
|
-
deviceId: number(),
|
|
16408
|
-
timestamp: number(),
|
|
16409
|
-
wouldFire: boolean(),
|
|
16410
|
-
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
16411
|
-
failedCondition: string().optional(),
|
|
16412
|
-
className: string().optional(),
|
|
16413
|
-
label: string().optional()
|
|
16569
|
+
id: string(),
|
|
16570
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
16571
|
+
label: string(),
|
|
16572
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
16573
|
+
mode: string().optional(),
|
|
16574
|
+
/** Originating local port the ingress fronts (informational). */
|
|
16575
|
+
sourcePort: number().optional()
|
|
16414
16576
|
});
|
|
16415
|
-
|
|
16416
|
-
|
|
16577
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
16578
|
+
/**
|
|
16579
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
16580
|
+
*
|
|
16581
|
+
* Apprise-derived model (see
|
|
16582
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
16583
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
16584
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16585
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
16586
|
+
* message to what the kind supports — callers never special-case a service.
|
|
16587
|
+
*
|
|
16588
|
+
* DESIGN DECISIONS (locked):
|
|
16589
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
16590
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
16591
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
16592
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
16593
|
+
* alternative would fork the UI per addon and cannot host the
|
|
16594
|
+
* discovery→adopt flow.
|
|
16595
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
16596
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
16597
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
16598
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
16599
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
16600
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
16601
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
16602
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
16603
|
+
* base64 fallback needed.
|
|
16604
|
+
*
|
|
16605
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
16606
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
16607
|
+
* admin "Integrations" page.
|
|
16608
|
+
*/
|
|
16609
|
+
/**
|
|
16610
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
16611
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
16612
|
+
*/
|
|
16613
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
16614
|
+
"image",
|
|
16615
|
+
"video",
|
|
16616
|
+
"gif",
|
|
16617
|
+
"audio",
|
|
16618
|
+
"icon"
|
|
16619
|
+
]);
|
|
16620
|
+
/**
|
|
16621
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
16622
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
16623
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
16624
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
16625
|
+
*/
|
|
16626
|
+
var AttachmentSchema = object({
|
|
16627
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
16628
|
+
url: string().optional(),
|
|
16629
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
16630
|
+
mime: string().optional(),
|
|
16631
|
+
name: string().optional()
|
|
16632
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
16633
|
+
var NotificationFormatSchema = _enum([
|
|
16634
|
+
"text",
|
|
16635
|
+
"markdown",
|
|
16636
|
+
"html"
|
|
16637
|
+
]);
|
|
16638
|
+
/** A single tap-through action button. */
|
|
16639
|
+
var NotificationActionSchema = object({
|
|
16640
|
+
id: string(),
|
|
16641
|
+
label: string(),
|
|
16642
|
+
url: string().optional()
|
|
16643
|
+
});
|
|
16644
|
+
/**
|
|
16645
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
16646
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
16647
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
16648
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
16649
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
16650
|
+
* `priority` for that one target.
|
|
16651
|
+
*/
|
|
16652
|
+
var NotificationSchema = object({
|
|
16653
|
+
body: string(),
|
|
16654
|
+
title: string().optional(),
|
|
16655
|
+
format: NotificationFormatSchema.default("text"),
|
|
16656
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16657
|
+
level: string().optional(),
|
|
16658
|
+
attachments: array(AttachmentSchema).optional(),
|
|
16659
|
+
clickUrl: string().optional(),
|
|
16660
|
+
actions: array(NotificationActionSchema).optional(),
|
|
16661
|
+
sound: string().optional(),
|
|
16662
|
+
ttl: number().optional(),
|
|
16663
|
+
tag: string().optional(),
|
|
16664
|
+
deviceId: number().optional(),
|
|
16665
|
+
eventId: string().optional(),
|
|
16666
|
+
metadata: record(string(), unknown()).optional()
|
|
16667
|
+
});
|
|
16668
|
+
/** One declared native severity/priority level for a kind. */
|
|
16669
|
+
var TargetKindLevelSchema = object({
|
|
16417
16670
|
id: string(),
|
|
16418
|
-
group: _enum([
|
|
16419
|
-
"scope",
|
|
16420
|
-
"class",
|
|
16421
|
-
"zones",
|
|
16422
|
-
"quality",
|
|
16423
|
-
"label",
|
|
16424
|
-
"schedule",
|
|
16425
|
-
"device",
|
|
16426
|
-
"package",
|
|
16427
|
-
"occupancy"
|
|
16428
|
-
]),
|
|
16429
16671
|
label: string(),
|
|
16430
|
-
/**
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16436
|
-
|
|
16437
|
-
|
|
16438
|
-
|
|
16439
|
-
"schedule",
|
|
16440
|
-
"plateMatcher",
|
|
16441
|
-
"packagePhase",
|
|
16442
|
-
"polygonDraw",
|
|
16443
|
-
"occupancy"
|
|
16444
|
-
]),
|
|
16445
|
-
operator: _enum([
|
|
16446
|
-
"in",
|
|
16447
|
-
"notIn",
|
|
16448
|
-
"anyOf",
|
|
16449
|
-
"allOf",
|
|
16450
|
-
"gte",
|
|
16451
|
-
"fuzzyIn",
|
|
16452
|
-
"withinSchedule"
|
|
16453
|
-
]),
|
|
16454
|
-
/** Which delivery kinds the condition applies to. */
|
|
16455
|
-
appliesTo: array(NcDeliverySchema),
|
|
16456
|
-
phase: string(),
|
|
16672
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
16673
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
16674
|
+
flags: object({
|
|
16675
|
+
critical: boolean().optional(),
|
|
16676
|
+
silent: boolean().optional(),
|
|
16677
|
+
noPush: boolean().optional()
|
|
16678
|
+
}).optional(),
|
|
16679
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
16680
|
+
requires: array(string()).optional(),
|
|
16457
16681
|
description: string().optional()
|
|
16458
16682
|
});
|
|
16683
|
+
/** The full capability block consulted before dispatch. */
|
|
16684
|
+
var TargetKindCapsSchema = object({
|
|
16685
|
+
attachments: object({
|
|
16686
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
16687
|
+
mode: _enum([
|
|
16688
|
+
"url",
|
|
16689
|
+
"bytes",
|
|
16690
|
+
"both"
|
|
16691
|
+
]),
|
|
16692
|
+
max: number().int().nonnegative(),
|
|
16693
|
+
maxBytes: number().int().positive().optional()
|
|
16694
|
+
}),
|
|
16695
|
+
/** Max action buttons (0 = none). */
|
|
16696
|
+
actions: number().int().nonnegative(),
|
|
16697
|
+
levels: array(TargetKindLevelSchema),
|
|
16698
|
+
format: array(NotificationFormatSchema),
|
|
16699
|
+
clickUrl: boolean(),
|
|
16700
|
+
sound: boolean(),
|
|
16701
|
+
ttl: boolean(),
|
|
16702
|
+
bodyMaxLen: number().int().positive()
|
|
16703
|
+
});
|
|
16459
16704
|
/**
|
|
16460
|
-
*
|
|
16461
|
-
*
|
|
16462
|
-
*
|
|
16463
|
-
*
|
|
16464
|
-
*
|
|
16465
|
-
* backend rejection / a deleted target (terminal; carries
|
|
16466
|
-
* the failure `error`)
|
|
16467
|
-
*
|
|
16468
|
-
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
16469
|
-
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
16705
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
16706
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
16707
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
16708
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
16709
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
16470
16710
|
*/
|
|
16471
|
-
var
|
|
16472
|
-
|
|
16473
|
-
|
|
16474
|
-
|
|
16475
|
-
|
|
16476
|
-
/**
|
|
16477
|
-
|
|
16478
|
-
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
"package-event"
|
|
16482
|
-
]);
|
|
16483
|
-
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
16484
|
-
var NcHistorySubjectSchema = object({
|
|
16485
|
-
className: string(),
|
|
16486
|
-
label: string().optional(),
|
|
16487
|
-
confidence: number().optional(),
|
|
16488
|
-
zones: array(string()),
|
|
16489
|
-
timestamp: number()
|
|
16711
|
+
var ConfigSchemaPassthrough = unknown();
|
|
16712
|
+
var TargetKindSchema = object({
|
|
16713
|
+
kind: string(),
|
|
16714
|
+
label: string(),
|
|
16715
|
+
icon: string(),
|
|
16716
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16717
|
+
addonId: string(),
|
|
16718
|
+
configSchema: ConfigSchemaPassthrough,
|
|
16719
|
+
supportsDiscovery: boolean(),
|
|
16720
|
+
caps: TargetKindCapsSchema
|
|
16490
16721
|
});
|
|
16491
16722
|
/**
|
|
16492
|
-
*
|
|
16493
|
-
*
|
|
16494
|
-
*
|
|
16495
|
-
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
16496
|
-
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
16497
|
-
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
16498
|
-
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
16499
|
-
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
16500
|
-
* P1 (admin scope only).
|
|
16723
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
16724
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
16725
|
+
* round-trip a stored secret to the UI.
|
|
16501
16726
|
*/
|
|
16502
|
-
var
|
|
16503
|
-
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
16727
|
+
var TargetSchema = object({
|
|
16504
16728
|
id: string(),
|
|
16505
|
-
|
|
16506
|
-
|
|
16507
|
-
|
|
16508
|
-
|
|
16509
|
-
|
|
16510
|
-
targetId: string(),
|
|
16511
|
-
deviceId: number(),
|
|
16512
|
-
recordKind: NcHistoryRecordKindSchema,
|
|
16513
|
-
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
16514
|
-
recordId: string(),
|
|
16515
|
-
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
16516
|
-
trackId: string().optional(),
|
|
16517
|
-
status: NcHistoryStatusSchema,
|
|
16518
|
-
/** Delivery attempts made so far. */
|
|
16519
|
-
attempts: number().int(),
|
|
16520
|
-
/** Fire time (outbox enqueue). */
|
|
16521
|
-
createdAt: number(),
|
|
16522
|
-
/** Last transition time (terminal for sent / dead). */
|
|
16523
|
-
updatedAt: number(),
|
|
16524
|
-
/** Failure detail — present on a `dead` row. */
|
|
16525
|
-
error: string().optional(),
|
|
16526
|
-
subject: NcHistorySubjectSchema
|
|
16729
|
+
name: string(),
|
|
16730
|
+
kind: string(),
|
|
16731
|
+
addonId: string(),
|
|
16732
|
+
enabled: boolean(),
|
|
16733
|
+
config: record(string(), unknown())
|
|
16527
16734
|
});
|
|
16528
|
-
/**
|
|
16529
|
-
|
|
16530
|
-
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
*/
|
|
16534
|
-
var NcHistoryFilterSchema = object({
|
|
16535
|
-
ruleId: string().optional(),
|
|
16536
|
-
deviceId: number().optional(),
|
|
16537
|
-
status: NcHistoryStatusSchema.optional(),
|
|
16538
|
-
since: number().optional(),
|
|
16539
|
-
until: number().optional(),
|
|
16540
|
-
limit: number().int().min(1).max(500).default(100)
|
|
16735
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
16736
|
+
var DiscoveredTargetSchema = object({
|
|
16737
|
+
kind: string(),
|
|
16738
|
+
suggestedName: string(),
|
|
16739
|
+
config: record(string(), unknown())
|
|
16541
16740
|
});
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
|
|
16550
|
-
|
|
16551
|
-
|
|
16552
|
-
|
|
16553
|
-
|
|
16554
|
-
|
|
16555
|
-
|
|
16556
|
-
|
|
16557
|
-
|
|
16741
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
16742
|
+
var RenderedAsSchema = object({
|
|
16743
|
+
level: string(),
|
|
16744
|
+
format: NotificationFormatSchema,
|
|
16745
|
+
attachmentsSent: number().int().nonnegative(),
|
|
16746
|
+
actionsSent: number().int().nonnegative(),
|
|
16747
|
+
truncated: boolean(),
|
|
16748
|
+
dropped: array(string())
|
|
16749
|
+
});
|
|
16750
|
+
var SendResultSchema = object({
|
|
16751
|
+
success: boolean(),
|
|
16752
|
+
error: string().optional(),
|
|
16753
|
+
renderedAs: RenderedAsSchema.optional()
|
|
16754
|
+
});
|
|
16755
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
16756
|
+
var TestResultSchema = SendResultSchema;
|
|
16757
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
16758
|
+
kind: string(),
|
|
16759
|
+
config: record(string(), unknown()).optional()
|
|
16760
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
16761
|
+
targetId: string(),
|
|
16762
|
+
notification: NotificationSchema
|
|
16763
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
16764
|
+
targetId: string(),
|
|
16765
|
+
sample: NotificationSchema.optional()
|
|
16766
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16767
|
+
targetId: string(),
|
|
16558
16768
|
enabled: boolean()
|
|
16559
|
-
}),
|
|
16560
|
-
kind: "mutation",
|
|
16561
|
-
auth: "admin"
|
|
16562
|
-
}), method(object({
|
|
16563
|
-
rule: NcRuleInputSchema,
|
|
16564
|
-
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
16565
|
-
}), object({ results: array(NcTestResultSchema) }), {
|
|
16566
|
-
kind: "mutation",
|
|
16567
|
-
auth: "admin"
|
|
16568
|
-
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
16769
|
+
}), _void(), { kind: "mutation" });
|
|
16569
16770
|
/**
|
|
16570
16771
|
* Zod schemas for persisted record types.
|
|
16571
16772
|
*
|
|
@@ -21583,6 +21784,12 @@ Object.freeze({
|
|
|
21583
21784
|
addonId: null,
|
|
21584
21785
|
access: "delete"
|
|
21585
21786
|
},
|
|
21787
|
+
"backup.deleteSchedule": {
|
|
21788
|
+
capName: "backup",
|
|
21789
|
+
capScope: "system",
|
|
21790
|
+
addonId: null,
|
|
21791
|
+
access: "delete"
|
|
21792
|
+
},
|
|
21586
21793
|
"backup.getEntries": {
|
|
21587
21794
|
capName: "backup",
|
|
21588
21795
|
capScope: "system",
|
|
@@ -21613,6 +21820,12 @@ Object.freeze({
|
|
|
21613
21820
|
addonId: null,
|
|
21614
21821
|
access: "view"
|
|
21615
21822
|
},
|
|
21823
|
+
"backup.listSchedules": {
|
|
21824
|
+
capName: "backup",
|
|
21825
|
+
capScope: "system",
|
|
21826
|
+
addonId: null,
|
|
21827
|
+
access: "view"
|
|
21828
|
+
},
|
|
21616
21829
|
"backup.previewSchedule": {
|
|
21617
21830
|
capName: "backup",
|
|
21618
21831
|
capScope: "system",
|
|
@@ -21637,6 +21850,12 @@ Object.freeze({
|
|
|
21637
21850
|
addonId: null,
|
|
21638
21851
|
access: "create"
|
|
21639
21852
|
},
|
|
21853
|
+
"backup.upsertSchedule": {
|
|
21854
|
+
capName: "backup",
|
|
21855
|
+
capScope: "system",
|
|
21856
|
+
addonId: null,
|
|
21857
|
+
access: "create"
|
|
21858
|
+
},
|
|
21640
21859
|
"battery.wakeForStream": {
|
|
21641
21860
|
capName: "battery",
|
|
21642
21861
|
capScope: "device",
|
|
@@ -25471,6 +25690,36 @@ Object.freeze({
|
|
|
25471
25690
|
addonId: null,
|
|
25472
25691
|
access: "create"
|
|
25473
25692
|
},
|
|
25693
|
+
"terminalSession.close": {
|
|
25694
|
+
capName: "terminal-session",
|
|
25695
|
+
capScope: "system",
|
|
25696
|
+
addonId: null,
|
|
25697
|
+
access: "create"
|
|
25698
|
+
},
|
|
25699
|
+
"terminalSession.listProfiles": {
|
|
25700
|
+
capName: "terminal-session",
|
|
25701
|
+
capScope: "system",
|
|
25702
|
+
addonId: null,
|
|
25703
|
+
access: "view"
|
|
25704
|
+
},
|
|
25705
|
+
"terminalSession.listSessions": {
|
|
25706
|
+
capName: "terminal-session",
|
|
25707
|
+
capScope: "system",
|
|
25708
|
+
addonId: null,
|
|
25709
|
+
access: "view"
|
|
25710
|
+
},
|
|
25711
|
+
"terminalSession.openSession": {
|
|
25712
|
+
capName: "terminal-session",
|
|
25713
|
+
capScope: "system",
|
|
25714
|
+
addonId: null,
|
|
25715
|
+
access: "create"
|
|
25716
|
+
},
|
|
25717
|
+
"terminalSession.resize": {
|
|
25718
|
+
capName: "terminal-session",
|
|
25719
|
+
capScope: "system",
|
|
25720
|
+
addonId: null,
|
|
25721
|
+
access: "create"
|
|
25722
|
+
},
|
|
25474
25723
|
"toast.onToast": {
|
|
25475
25724
|
capName: "toast",
|
|
25476
25725
|
capScope: "system",
|