@camstack/addon-admin-ui 1.2.6 → 1.2.7
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/assets/{AddLocationWizard-EQfBerh6.js → AddLocationWizard-CyKRLLsk.js} +1 -1
- package/dist/assets/{AddonCollectionPage-DULW5cZ3.js → AddonCollectionPage-CXk6wckg.js} +1 -1
- package/dist/assets/{Addons-B3DP5tRM.js → Addons-DxWqyv8n.js} +1 -1
- package/dist/assets/{AdminTabs-B4tsypGK.js → AdminTabs-WUZUR1_6.js} +1 -1
- package/dist/assets/{AiProfiles-BCyCuA57.js → AiProfiles-BMqEeLB9.js} +1 -1
- package/dist/assets/{BrokerForm-De3Iwxlh.js → BrokerForm-B4reF7bk.js} +1 -1
- package/dist/assets/{Capabilities-Dnw_Fl5A.js → Capabilities-CGdYm2VO.js} +1 -1
- package/dist/assets/{CapabilityBadges-BG2fH0DU.js → CapabilityBadges-DupibTp6.js} +1 -1
- package/dist/assets/Cluster-Bg86E_Ph.js +1 -0
- package/dist/assets/{ClusterRecordingTab-B3ux__O1.js → ClusterRecordingTab-tAD7jTdA.js} +1 -1
- package/dist/assets/{Dashboard-BBsLQGfW.js → Dashboard-D_-AvUFa.js} +1 -1
- package/dist/assets/{Data-DgR-nCIw.js → Data-Df1IWyzV.js} +1 -1
- package/dist/assets/{DetectionIntelligence-CA9CerKH.js → DetectionIntelligence-BI5eb6VF.js} +1 -1
- package/dist/assets/{DeviceDetail-BFkCUHjM.js → DeviceDetail-Dy53krDA.js} +2 -2
- package/dist/assets/{Devices-2sOMm4Z3.js → Devices-BeGicFJ4.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-myZ504-w.js → EmbedPlayerPage-Bz16DLEQ.js} +1 -1
- package/dist/assets/Events-C1HeFo1b.js +1 -0
- package/dist/assets/{FormBuilder-RfZE3uEJ.js → FormBuilder-Dcrl2dAa.js} +1 -1
- package/dist/assets/Identity-DN84XYQh.js +1 -0
- package/dist/assets/{IntegrationDetail-eyBgthFS.js → IntegrationDetail-UDrWOj_z.js} +1 -1
- package/dist/assets/{Integrations-OooxdXTt.js → Integrations-BGeF0z1-.js} +1 -1
- package/dist/assets/{Integrations-COMfE3Fi.js → Integrations-CyJ8TvXg.js} +1 -1
- package/dist/assets/{Logs-DmBxt8yx.js → Logs-CHI7r5Ye.js} +1 -1
- package/dist/assets/{MotionZonesSettings-D6KN4zvp.js → MotionZonesSettings-WsP8vtl5.js} +1 -1
- package/dist/assets/{MyAccess-CSLqgoOR.js → MyAccess-bfp4HXqC.js} +1 -1
- package/dist/assets/Network-BspWeG-0.js +1 -0
- package/dist/assets/{NodeAddonsSettingsPanel-BFFloAuk.js → NodeAddonsSettingsPanel-rffEhcPI.js} +1 -1
- package/dist/assets/{NodeInferenceDevices-CHEAdiG1.js → NodeInferenceDevices-BXQmztNN.js} +1 -1
- package/dist/assets/Notifications-Dgc1okWT.js +1 -0
- package/dist/assets/Pipeline--FjxVr2W.js +1 -0
- package/dist/assets/{Plates-CblU2DMo.js → Plates-DbBtLzJC.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-CixY6Cwe.js → PrivacyMaskSettings-ql8SIBIL.js} +1 -1
- package/dist/assets/{ProviderIcon-J2-hlNmu.js → ProviderIcon-CdU30uOa.js} +1 -1
- package/dist/assets/{Recordings-fPuPc-OU.js → Recordings-BjBRfyKe.js} +1 -1
- package/dist/assets/{ScanNetworkModal-BUfKHATN.js → ScanNetworkModal-4wyR27nx.js} +1 -1
- package/dist/assets/{Settings-4ZY027uK.js → Settings-4vAsvFH0.js} +1 -1
- package/dist/assets/{Showroom-D5piXffc.js → Showroom-CxLSIOyr.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BfUxp5nc.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DAIzy1TU.js} +1 -1
- package/dist/assets/{build-cluster-graph-BH4yKfdg.js → build-cluster-graph-Du7k1coC.js} +1 -1
- package/dist/assets/circle-check-big--QL2GpFx.js +1 -0
- package/dist/assets/clock-CyOcMtqv.js +1 -0
- package/dist/assets/{copy-DmdM3wEU.js → copy-P5fXgdqY.js} +1 -1
- package/dist/assets/{debounced-invalidate-D__X_AAz.js → debounced-invalidate-ByBXa--a.js} +1 -1
- package/dist/assets/{dist-36zhpE3X.js → dist-6bufrn_9.js} +1 -1
- package/dist/assets/dist-D5Idz-si.js +7 -0
- package/dist/assets/{download-BxlCQ1_R.js → download-CUh_sBGh.js} +1 -1
- package/dist/assets/{face-bbox-DUL58Rsf.js → face-bbox-CmPaZHSA.js} +1 -1
- package/dist/assets/history-Ccgj8IlI.js +1 -0
- package/dist/assets/{hostInit-Qpz1K2M9.js → hostInit-DI1uaYRB.js} +1 -1
- package/dist/assets/index-BRI5wMdK.js +4 -0
- package/dist/assets/index-BTiaHVM4.css +2 -0
- package/dist/assets/{key-round-C0B7hV3u.js → key-round-CiLCQeTs.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-bbcce2df.js → mf-entry-bootstrap-0-971ffca4.js} +2 -2
- package/dist/assets/{pencil-CkuaFJis.js → pencil-Dn4Tq-6q.js} +1 -1
- package/dist/assets/{player-overlays-BUEqEqaL.js → player-overlays-BlOdAA3b.js} +1 -1
- package/dist/assets/plus-aicZUT2N.js +1 -0
- package/dist/assets/{radio-CT33fKey.js → radio-BHc_j2JR.js} +1 -1
- package/dist/assets/{refresh-cw-DZAB0JuF.js → refresh-cw-BOEcKgeL.js} +1 -1
- package/dist/assets/remoteEntry-DtMf1Sjf.js +1 -0
- package/dist/assets/{rotate-ccw-BsVOOlvm.js → rotate-ccw-BY7N75CC.js} +1 -1
- package/dist/assets/rotate-cw-EWhrkzd5.js +1 -0
- package/dist/assets/search-De5It8ha.js +1 -0
- package/dist/assets/{send-C9E6gIVU.js → send-B-LV5moh.js} +1 -1
- package/dist/assets/{server-BGfq1DMy.js → server-CLJXfmXf.js} +1 -1
- package/dist/assets/square-LbSm0MOQ.js +1 -0
- package/dist/assets/{square-check-big-C_5pAcZk.js → square-check-big-BVXCHO2K.js} +1 -1
- package/dist/assets/{src-CBUFBhQs.js → src--IMzqbG0.js} +10 -10
- package/dist/assets/src-GxiMH1Sc.js +7 -0
- package/dist/assets/{upload-BnZt396k.js → upload-Bg8i0i0l.js} +1 -1
- package/dist/assets/{useEventInvalidation-B1H1s0pw.js → useEventInvalidation-C2Xytz1c.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-pkB5RcG9.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Xdd8H1t3.js} +2 -2
- package/dist/assets/{wifi-B_qoHnYl.js → wifi-DZshyJ4Y.js} +1 -1
- package/dist/assets/{zap-RpM6rAnv.js → zap-DUonLa5R.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/server/addon.js +1385 -890
- package/package.json +1 -1
- package/dist/assets/Cluster-BSSc7Zsu.js +0 -1
- package/dist/assets/Events-R-IvRKr1.js +0 -1
- package/dist/assets/Identity-HEVxedLA.js +0 -1
- package/dist/assets/Network-Zoyc7mWr.js +0 -1
- package/dist/assets/NotificationTargets-vr9QgP0A.js +0 -1
- package/dist/assets/Pipeline-CdJSmNto.js +0 -1
- package/dist/assets/circle-check-big-C8-7HmH_.js +0 -1
- package/dist/assets/clock-PeR4eBHx.js +0 -1
- package/dist/assets/dist-CdjHNRwY.js +0 -7
- package/dist/assets/index-C-ZEPJCU.css +0 -2
- package/dist/assets/index-DdNXL04K.js +0 -4
- package/dist/assets/plus-DXtZevee.js +0 -1
- package/dist/assets/remoteEntry-Dvr0F_Y-.js +0 -1
- package/dist/assets/rotate-cw-vnfGyppg.js +0 -1
- package/dist/assets/search-DW0Hs-NC.js +0 -1
- package/dist/assets/square-BELgWOxZ.js +0 -1
- package/dist/assets/src-DNEnYGfh.js +0 -7
package/dist/server/addon.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
//#region ../types/dist/event-category-
|
|
3
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
4
4
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
5
5
|
EventCategory["SystemBoot"] = "system.boot";
|
|
6
6
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -150,9 +150,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
150
150
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
151
151
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
152
152
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
153
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
154
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
155
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
156
153
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
157
154
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
158
155
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -6817,7 +6814,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
|
6817
6814
|
patch: record(string(), unknown())
|
|
6818
6815
|
}), object({ success: literal(true) });
|
|
6819
6816
|
object({ deviceId: number() }), unknown().nullable();
|
|
6820
|
-
/** Shorthand to define a method schema */
|
|
6821
6817
|
function method(input, output, options) {
|
|
6822
6818
|
return {
|
|
6823
6819
|
input,
|
|
@@ -6825,6 +6821,7 @@ function method(input, output, options) {
|
|
|
6825
6821
|
kind: options?.kind ?? "query",
|
|
6826
6822
|
auth: options?.auth ?? "protected",
|
|
6827
6823
|
...options?.access !== void 0 ? { access: options.access } : {},
|
|
6824
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
6828
6825
|
timeoutMs: options?.timeoutMs
|
|
6829
6826
|
};
|
|
6830
6827
|
}
|
|
@@ -8187,6 +8184,59 @@ for (const l of AUDIO_MACRO_LABELS) {
|
|
|
8187
8184
|
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8188
8185
|
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8189
8186
|
/**
|
|
8187
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8188
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8189
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8190
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8191
|
+
*
|
|
8192
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8193
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8194
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8195
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8196
|
+
* the same class picker, grouped under an Audio header.
|
|
8197
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8198
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8199
|
+
*
|
|
8200
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8201
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8202
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8203
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8204
|
+
*/
|
|
8205
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8206
|
+
var NcTaxonomyEntrySchema = object({
|
|
8207
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8208
|
+
kind: string(),
|
|
8209
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8210
|
+
label: string(),
|
|
8211
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8212
|
+
parentKind: string().nullable()
|
|
8213
|
+
});
|
|
8214
|
+
object({
|
|
8215
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8216
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8217
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8218
|
+
});
|
|
8219
|
+
function toEntry(kind, label, parentKind) {
|
|
8220
|
+
return {
|
|
8221
|
+
kind,
|
|
8222
|
+
label,
|
|
8223
|
+
parentKind
|
|
8224
|
+
};
|
|
8225
|
+
}
|
|
8226
|
+
/**
|
|
8227
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8228
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8229
|
+
*/
|
|
8230
|
+
function buildNcTaxonomy() {
|
|
8231
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8232
|
+
return {
|
|
8233
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8234
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8235
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8236
|
+
};
|
|
8237
|
+
}
|
|
8238
|
+
Object.freeze(buildNcTaxonomy());
|
|
8239
|
+
/**
|
|
8190
8240
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8191
8241
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8192
8242
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -13544,94 +13594,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
13544
13594
|
bundleUrl: string()
|
|
13545
13595
|
});
|
|
13546
13596
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
13547
|
-
var NotificationRuleConditionsSchema = object({
|
|
13548
|
-
deviceIds: array(number()).readonly().optional(),
|
|
13549
|
-
classNames: array(string()).readonly().optional(),
|
|
13550
|
-
zoneIds: array(string()).readonly().optional(),
|
|
13551
|
-
minConfidence: number().optional(),
|
|
13552
|
-
source: _enum([
|
|
13553
|
-
"pipeline",
|
|
13554
|
-
"onboard",
|
|
13555
|
-
"any"
|
|
13556
|
-
]).optional(),
|
|
13557
|
-
schedule: object({
|
|
13558
|
-
days: array(number()).readonly(),
|
|
13559
|
-
startHour: number(),
|
|
13560
|
-
endHour: number()
|
|
13561
|
-
}).optional(),
|
|
13562
|
-
cooldownSeconds: number().optional(),
|
|
13563
|
-
minDwellSeconds: number().optional(),
|
|
13564
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
13565
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
13566
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
13567
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
13568
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
13569
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
13570
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
13571
|
-
clipDescription: object({
|
|
13572
|
-
text: string().min(1),
|
|
13573
|
-
minSimilarity: number().min(0).max(1)
|
|
13574
|
-
}).optional(),
|
|
13575
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
13576
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
13577
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
13578
|
-
* vehicle/person> is seen". */
|
|
13579
|
-
labels: array(string()).readonly().optional()
|
|
13580
|
-
});
|
|
13581
|
-
var NotificationRuleTemplateSchema = object({
|
|
13582
|
-
title: string(),
|
|
13583
|
-
body: string(),
|
|
13584
|
-
imageMode: _enum([
|
|
13585
|
-
"crop",
|
|
13586
|
-
"annotated",
|
|
13587
|
-
"full",
|
|
13588
|
-
"none"
|
|
13589
|
-
])
|
|
13590
|
-
});
|
|
13591
|
-
var NotificationRuleSchema = object({
|
|
13592
|
-
id: string(),
|
|
13593
|
-
name: string(),
|
|
13594
|
-
enabled: boolean(),
|
|
13595
|
-
eventTypes: array(string()).readonly(),
|
|
13596
|
-
conditions: NotificationRuleConditionsSchema,
|
|
13597
|
-
outputs: array(string()).readonly(),
|
|
13598
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
13599
|
-
priority: _enum([
|
|
13600
|
-
"low",
|
|
13601
|
-
"normal",
|
|
13602
|
-
"high",
|
|
13603
|
-
"critical"
|
|
13604
|
-
])
|
|
13605
|
-
});
|
|
13606
|
-
var NotificationTestResultSchema = object({
|
|
13607
|
-
ruleId: string(),
|
|
13608
|
-
eventId: string(),
|
|
13609
|
-
timestamp: number(),
|
|
13610
|
-
wouldFire: boolean(),
|
|
13611
|
-
reason: string().optional()
|
|
13612
|
-
});
|
|
13613
|
-
var NotificationHistoryEntrySchema = object({
|
|
13614
|
-
id: string(),
|
|
13615
|
-
ruleId: string(),
|
|
13616
|
-
ruleName: string(),
|
|
13617
|
-
eventId: string(),
|
|
13618
|
-
timestamp: number(),
|
|
13619
|
-
outputs: array(string()).readonly(),
|
|
13620
|
-
success: boolean(),
|
|
13621
|
-
error: string().optional(),
|
|
13622
|
-
deviceId: number().optional()
|
|
13623
|
-
});
|
|
13624
|
-
var NotificationHistoryFilterSchema = object({
|
|
13625
|
-
ruleId: string().optional(),
|
|
13626
|
-
deviceId: number().optional(),
|
|
13627
|
-
from: number().optional(),
|
|
13628
|
-
to: number().optional(),
|
|
13629
|
-
limit: number().optional()
|
|
13630
|
-
});
|
|
13631
|
-
method(_void(), object({ rules: array(NotificationRuleSchema).readonly() })), method(object({ rule: NotificationRuleSchema }), object({ success: literal(true) }), { kind: "mutation" }), method(object({ ruleId: string() }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
|
|
13632
|
-
ruleId: string(),
|
|
13633
|
-
lookbackMinutes: number()
|
|
13634
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
13635
13597
|
/**
|
|
13636
13598
|
* Alerts capability — collection-based internal alert system.
|
|
13637
13599
|
*
|
|
@@ -13818,89 +13780,6 @@ method(object({
|
|
|
13818
13780
|
password: string()
|
|
13819
13781
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
13820
13782
|
/**
|
|
13821
|
-
* `login-method` — collection cap through which auth addons contribute
|
|
13822
|
-
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
13823
|
-
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
13824
|
-
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
13825
|
-
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
13826
|
-
* procedure aggregates them for the unauthenticated login page.
|
|
13827
|
-
*
|
|
13828
|
-
* A contribution is a discriminated union on `kind`:
|
|
13829
|
-
*
|
|
13830
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
13831
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
13832
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
13833
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
13834
|
-
* login page needs NO change.
|
|
13835
|
-
*
|
|
13836
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
13837
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
13838
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
13839
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
13840
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
13841
|
-
*
|
|
13842
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
13843
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
13844
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
13845
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
13846
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
13847
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
13848
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
13849
|
-
* decision.
|
|
13850
|
-
*
|
|
13851
|
-
* Every contribution carries a `stage`:
|
|
13852
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
13853
|
-
* magic-link buttons; a future usernameless passkey).
|
|
13854
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
13855
|
-
* returned `factors` (passkey-as-2FA today).
|
|
13856
|
-
*
|
|
13857
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
13858
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
13859
|
-
* tRPC router.
|
|
13860
|
-
*/
|
|
13861
|
-
/** When a login method renders in the two-phase login flow. */
|
|
13862
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
13863
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
13864
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
13865
|
-
object({
|
|
13866
|
-
kind: literal("redirect"),
|
|
13867
|
-
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
13868
|
-
id: string(),
|
|
13869
|
-
/** Operator-facing button label. */
|
|
13870
|
-
label: string(),
|
|
13871
|
-
/** lucide-react icon name. */
|
|
13872
|
-
icon: string().optional(),
|
|
13873
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
13874
|
-
startUrl: string(),
|
|
13875
|
-
stage: LoginStageEnum
|
|
13876
|
-
}),
|
|
13877
|
-
object({
|
|
13878
|
-
kind: literal("widget"),
|
|
13879
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
13880
|
-
id: string(),
|
|
13881
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
13882
|
-
addonId: string(),
|
|
13883
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
13884
|
-
bundle: string(),
|
|
13885
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
13886
|
-
remote: WidgetRemoteSchema,
|
|
13887
|
-
stage: LoginStageEnum
|
|
13888
|
-
}),
|
|
13889
|
-
object({
|
|
13890
|
-
kind: literal("passkey"),
|
|
13891
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
13892
|
-
id: string(),
|
|
13893
|
-
/** Operator-facing button label. */
|
|
13894
|
-
label: string(),
|
|
13895
|
-
stage: LoginStageEnum,
|
|
13896
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
13897
|
-
rpId: string(),
|
|
13898
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
13899
|
-
origin: string().nullable()
|
|
13900
|
-
})
|
|
13901
|
-
]);
|
|
13902
|
-
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
13903
|
-
/**
|
|
13904
13783
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
13905
13784
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
13906
13785
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -15244,385 +15123,760 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
15244
15123
|
kind: "mutation",
|
|
15245
15124
|
auth: "admin"
|
|
15246
15125
|
});
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15126
|
+
/**
|
|
15127
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15128
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15129
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
15130
|
+
*
|
|
15131
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15132
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
15133
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15134
|
+
*/
|
|
15135
|
+
var LlmUsageSchema = object({
|
|
15136
|
+
inputTokens: number(),
|
|
15137
|
+
outputTokens: number()
|
|
15138
|
+
});
|
|
15139
|
+
var LlmErrorCodeSchema = _enum([
|
|
15140
|
+
"timeout",
|
|
15141
|
+
"rate-limited",
|
|
15142
|
+
"auth",
|
|
15143
|
+
"refusal",
|
|
15144
|
+
"bad-request",
|
|
15145
|
+
"unavailable",
|
|
15146
|
+
"no-profile",
|
|
15147
|
+
"budget-exceeded",
|
|
15148
|
+
"adapter-error"
|
|
15252
15149
|
]);
|
|
15253
|
-
var
|
|
15254
|
-
|
|
15255
|
-
|
|
15256
|
-
|
|
15150
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15151
|
+
ok: literal(true),
|
|
15152
|
+
text: string(),
|
|
15153
|
+
model: string(),
|
|
15154
|
+
usage: LlmUsageSchema,
|
|
15155
|
+
truncated: boolean(),
|
|
15156
|
+
latencyMs: number()
|
|
15157
|
+
}), object({
|
|
15158
|
+
ok: literal(false),
|
|
15159
|
+
code: LlmErrorCodeSchema,
|
|
15257
15160
|
message: string(),
|
|
15258
|
-
|
|
15259
|
-
|
|
15260
|
-
|
|
15261
|
-
|
|
15262
|
-
|
|
15263
|
-
|
|
15264
|
-
|
|
15265
|
-
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
}), array(LogEntrySchema).readonly());
|
|
15269
|
-
var CpuBreakdownSchema = object({
|
|
15270
|
-
total: number(),
|
|
15271
|
-
user: number(),
|
|
15272
|
-
system: number(),
|
|
15273
|
-
irq: number(),
|
|
15274
|
-
nice: number(),
|
|
15275
|
-
loadAvg: tuple([
|
|
15276
|
-
number(),
|
|
15277
|
-
number(),
|
|
15278
|
-
number()
|
|
15279
|
-
]),
|
|
15280
|
-
cores: number()
|
|
15281
|
-
});
|
|
15282
|
-
var MemoryInfoSchema = object({
|
|
15283
|
-
percent: number(),
|
|
15284
|
-
totalBytes: number(),
|
|
15285
|
-
usedBytes: number(),
|
|
15286
|
-
availableBytes: number(),
|
|
15287
|
-
swapUsedBytes: number(),
|
|
15288
|
-
swapTotalBytes: number()
|
|
15161
|
+
retryAfterMs: number().optional()
|
|
15162
|
+
})]);
|
|
15163
|
+
/**
|
|
15164
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15165
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15166
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
15167
|
+
*/
|
|
15168
|
+
var LlmImageSchema = object({
|
|
15169
|
+
bytes: _instanceof(Uint8Array),
|
|
15170
|
+
mimeType: string()
|
|
15289
15171
|
});
|
|
15290
|
-
var
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
|
|
15295
|
-
|
|
15172
|
+
var LlmGenerateBaseInputSchema = object({
|
|
15173
|
+
/** Collection routing (the notification-output posture). */
|
|
15174
|
+
addonId: string().optional(),
|
|
15175
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15176
|
+
profileId: string().optional(),
|
|
15177
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15178
|
+
consumer: string(),
|
|
15179
|
+
system: string().optional(),
|
|
15180
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15181
|
+
prompt: string(),
|
|
15182
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15183
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
15184
|
+
/** Per-call override of the profile default. */
|
|
15185
|
+
maxTokens: number().int().positive().optional(),
|
|
15186
|
+
temperature: number().optional()
|
|
15296
15187
|
});
|
|
15297
|
-
|
|
15298
|
-
|
|
15299
|
-
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
|
|
15304
|
-
|
|
15305
|
-
|
|
15306
|
-
|
|
15307
|
-
|
|
15308
|
-
|
|
15309
|
-
|
|
15310
|
-
|
|
15311
|
-
|
|
15312
|
-
});
|
|
15313
|
-
var ProcessResourceInfoSchema = object({
|
|
15314
|
-
openFds: number(),
|
|
15315
|
-
threadCount: number(),
|
|
15316
|
-
activeHandles: number(),
|
|
15317
|
-
activeRequests: number()
|
|
15318
|
-
});
|
|
15319
|
-
var PressureAvgsSchema = object({
|
|
15320
|
-
avg10: number(),
|
|
15321
|
-
avg60: number(),
|
|
15322
|
-
avg300: number()
|
|
15323
|
-
});
|
|
15324
|
-
var PressureInfoSchema = object({
|
|
15325
|
-
some: PressureAvgsSchema,
|
|
15326
|
-
full: PressureAvgsSchema.nullable()
|
|
15327
|
-
});
|
|
15328
|
-
var SystemResourceSnapshotSchema = object({
|
|
15329
|
-
cpu: CpuBreakdownSchema,
|
|
15330
|
-
memory: MemoryInfoSchema,
|
|
15331
|
-
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15332
|
-
network: NetworkIoSnapshotSchema,
|
|
15333
|
-
disk: DiskIoSnapshotSchema,
|
|
15334
|
-
pressure: object({
|
|
15335
|
-
cpu: PressureInfoSchema.nullable(),
|
|
15336
|
-
memory: PressureInfoSchema.nullable(),
|
|
15337
|
-
io: PressureInfoSchema.nullable()
|
|
15188
|
+
/**
|
|
15189
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15190
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15191
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15192
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15193
|
+
* this only through the `llm` cap's methods.
|
|
15194
|
+
*
|
|
15195
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15196
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15197
|
+
* watchdog — operator decision #3).
|
|
15198
|
+
*/
|
|
15199
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15200
|
+
object({
|
|
15201
|
+
kind: literal("catalog"),
|
|
15202
|
+
catalogId: string()
|
|
15338
15203
|
}),
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
|
|
15351
|
-
|
|
15352
|
-
|
|
15353
|
-
|
|
15354
|
-
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
|
|
15358
|
-
|
|
15359
|
-
|
|
15360
|
-
*/
|
|
15361
|
-
|
|
15362
|
-
/**
|
|
15363
|
-
|
|
15364
|
-
|
|
15365
|
-
|
|
15366
|
-
sharedBytes: number().optional()
|
|
15204
|
+
object({
|
|
15205
|
+
kind: literal("url"),
|
|
15206
|
+
url: string(),
|
|
15207
|
+
sha256: string().optional()
|
|
15208
|
+
}),
|
|
15209
|
+
object({
|
|
15210
|
+
kind: literal("path"),
|
|
15211
|
+
path: string()
|
|
15212
|
+
})
|
|
15213
|
+
]);
|
|
15214
|
+
var ManagedRuntimeConfigSchema = object({
|
|
15215
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
15216
|
+
nodeId: string(),
|
|
15217
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15218
|
+
engine: _enum(["llama-cpp"]),
|
|
15219
|
+
model: ManagedModelRefSchema,
|
|
15220
|
+
contextSize: number().int().default(4096),
|
|
15221
|
+
/** 0 = CPU-only. */
|
|
15222
|
+
gpuLayers: number().int().default(0),
|
|
15223
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15224
|
+
threads: number().int().optional(),
|
|
15225
|
+
/** Concurrent slots. */
|
|
15226
|
+
parallel: number().int().default(1),
|
|
15227
|
+
/** Else lazy: first generate boots it. */
|
|
15228
|
+
autoStart: boolean().default(false),
|
|
15229
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
15230
|
+
idleStopMinutes: number().int().default(30)
|
|
15367
15231
|
});
|
|
15368
|
-
var
|
|
15369
|
-
|
|
15232
|
+
var LlmRuntimeStatusSchema = object({
|
|
15233
|
+
/** Status is ALWAYS node-qualified. */
|
|
15370
15234
|
nodeId: string(),
|
|
15371
|
-
role: _enum(["hub", "worker"]),
|
|
15372
|
-
pid: number(),
|
|
15373
15235
|
state: _enum([
|
|
15374
|
-
"starting",
|
|
15375
|
-
"running",
|
|
15376
|
-
"stopping",
|
|
15377
15236
|
"stopped",
|
|
15378
|
-
"
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
pid: number(),
|
|
15384
|
-
ppid: number(),
|
|
15385
|
-
pgid: number(),
|
|
15386
|
-
classification: _enum([
|
|
15387
|
-
"root",
|
|
15388
|
-
"managed",
|
|
15389
|
-
"system",
|
|
15390
|
-
"ghost"
|
|
15237
|
+
"downloading",
|
|
15238
|
+
"starting",
|
|
15239
|
+
"ready",
|
|
15240
|
+
"crashed",
|
|
15241
|
+
"failed"
|
|
15391
15242
|
]),
|
|
15392
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
15393
|
-
addonId: string().nullable(),
|
|
15394
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15395
|
-
nodeId: string().nullable(),
|
|
15396
|
-
/** Truncated command line. */
|
|
15397
|
-
command: string(),
|
|
15398
|
-
cpuPercent: number(),
|
|
15399
|
-
memoryRssBytes: number(),
|
|
15400
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15401
|
-
uptimeSec: number(),
|
|
15402
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15403
|
-
orphaned: boolean()
|
|
15404
|
-
});
|
|
15405
|
-
var KillProcessInputSchema = object({
|
|
15406
|
-
pid: number(),
|
|
15407
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15408
|
-
force: boolean().optional()
|
|
15409
|
-
});
|
|
15410
|
-
var KillProcessResultSchema = object({
|
|
15411
|
-
success: boolean(),
|
|
15412
|
-
reason: string().optional(),
|
|
15413
|
-
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15414
|
-
});
|
|
15415
|
-
var DumpHeapSnapshotInputSchema = object({
|
|
15416
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
15417
|
-
addonId: string() });
|
|
15418
|
-
var DumpHeapSnapshotResultSchema = object({
|
|
15419
|
-
success: boolean(),
|
|
15420
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15421
|
-
path: string().optional(),
|
|
15422
|
-
/** Process pid that was signalled. */
|
|
15423
15243
|
pid: number().optional(),
|
|
15424
|
-
|
|
15244
|
+
port: number().optional(),
|
|
15245
|
+
modelPath: string().optional(),
|
|
15246
|
+
modelId: string().optional(),
|
|
15247
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
15248
|
+
lastError: string().optional(),
|
|
15249
|
+
crashesInWindow: number(),
|
|
15250
|
+
/** Child RSS (sampled best-effort). */
|
|
15251
|
+
memoryBytes: number().optional(),
|
|
15252
|
+
vramBytes: number().optional()
|
|
15425
15253
|
});
|
|
15426
|
-
var
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
|
|
15430
|
-
|
|
15431
|
-
diskPercent: number().optional(),
|
|
15432
|
-
temperature: number().optional(),
|
|
15433
|
-
gpuPercent: number().optional(),
|
|
15434
|
-
gpuMemoryPercent: number().optional()
|
|
15254
|
+
var LlmNodeModelSchema = object({
|
|
15255
|
+
file: string(),
|
|
15256
|
+
sizeBytes: number(),
|
|
15257
|
+
catalogId: string().optional(),
|
|
15258
|
+
installedAt: number().optional()
|
|
15435
15259
|
});
|
|
15436
|
-
|
|
15260
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
15261
|
+
nodeId: string(),
|
|
15262
|
+
modelsBytes: number(),
|
|
15263
|
+
freeBytes: number().optional()
|
|
15264
|
+
});
|
|
15265
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
15266
|
+
images: array(LlmImageSchema).optional(),
|
|
15267
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
15268
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15269
|
+
timeoutMs: number().int().positive().optional()
|
|
15270
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15437
15271
|
kind: "mutation",
|
|
15438
15272
|
auth: "admin"
|
|
15439
|
-
}), method(
|
|
15273
|
+
}), method(object({}), _void(), {
|
|
15440
15274
|
kind: "mutation",
|
|
15441
15275
|
auth: "admin"
|
|
15442
|
-
})
|
|
15443
|
-
method(object({
|
|
15444
|
-
sourceUrl: string(),
|
|
15445
|
-
metadata: ModelConvertMetadataSchema,
|
|
15446
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15447
|
-
calibrationRef: string().optional(),
|
|
15448
|
-
sessionId: string().optional()
|
|
15449
|
-
}), ConvertResultSchema, {
|
|
15276
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15450
15277
|
kind: "mutation",
|
|
15451
|
-
auth: "admin"
|
|
15452
|
-
|
|
15453
|
-
});
|
|
15454
|
-
method(object({
|
|
15455
|
-
nodeId: string(),
|
|
15456
|
-
modelId: string(),
|
|
15457
|
-
format: _enum(MODEL_FORMATS),
|
|
15458
|
-
entry: ModelCatalogEntrySchema
|
|
15459
|
-
}), object({
|
|
15460
|
-
ok: boolean(),
|
|
15461
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15462
|
-
sha256: string(),
|
|
15463
|
-
bytes: number(),
|
|
15464
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15465
|
-
path: string()
|
|
15466
|
-
}), {
|
|
15278
|
+
auth: "admin"
|
|
15279
|
+
}), method(object({ file: string() }), _void(), {
|
|
15467
15280
|
kind: "mutation",
|
|
15468
15281
|
auth: "admin"
|
|
15469
|
-
});
|
|
15282
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15470
15283
|
/**
|
|
15471
|
-
* `
|
|
15472
|
-
*
|
|
15473
|
-
*
|
|
15474
|
-
*
|
|
15475
|
-
*
|
|
15476
|
-
* its OWN `mqtt.js` client.
|
|
15477
|
-
*
|
|
15478
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15479
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15480
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
15481
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15482
|
-
* features anyway — give it the connection config, get out of the way.
|
|
15483
|
-
*
|
|
15484
|
-
* Consumer flow:
|
|
15485
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
15486
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
15487
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
15284
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
15285
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
15286
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
15287
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15288
|
+
* (hub-placed); the cap stays open for future providers.
|
|
15488
15289
|
*
|
|
15489
|
-
*
|
|
15490
|
-
*
|
|
15491
|
-
*
|
|
15492
|
-
* spawned it.
|
|
15493
|
-
*/
|
|
15494
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
15495
|
-
/**
|
|
15496
|
-
* Broker live-probe status.
|
|
15497
|
-
*
|
|
15498
|
-
* - `connected` — last probe completed a clean CONNACK
|
|
15499
|
-
* - `disconnected` — no probe has run yet (cold cache)
|
|
15500
|
-
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
15501
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
15502
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
15290
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15291
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15292
|
+
* write; a stored key NEVER round-trips to a client.
|
|
15503
15293
|
*/
|
|
15504
|
-
var
|
|
15505
|
-
"
|
|
15506
|
-
"
|
|
15507
|
-
"
|
|
15508
|
-
"
|
|
15509
|
-
"
|
|
15294
|
+
var LlmProfileKindSchema = _enum([
|
|
15295
|
+
"openai-compatible",
|
|
15296
|
+
"openai",
|
|
15297
|
+
"anthropic",
|
|
15298
|
+
"google",
|
|
15299
|
+
"managed-local"
|
|
15510
15300
|
]);
|
|
15511
|
-
var
|
|
15301
|
+
var LlmProfileSchema = object({
|
|
15512
15302
|
id: string(),
|
|
15513
15303
|
name: string(),
|
|
15514
|
-
|
|
15515
|
-
|
|
15516
|
-
|
|
15517
|
-
|
|
15518
|
-
|
|
15519
|
-
|
|
15520
|
-
|
|
15521
|
-
|
|
15522
|
-
|
|
15304
|
+
kind: LlmProfileKindSchema,
|
|
15305
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
15306
|
+
addonId: string(),
|
|
15307
|
+
enabled: boolean(),
|
|
15308
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
15309
|
+
model: string(),
|
|
15310
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
15311
|
+
baseUrl: string().optional(),
|
|
15312
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
15313
|
+
apiKey: string().optional(),
|
|
15314
|
+
supportsVision: boolean(),
|
|
15315
|
+
temperature: number().min(0).max(2).optional(),
|
|
15316
|
+
maxTokens: number().int().positive().optional(),
|
|
15317
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
15318
|
+
extraHeaders: record(string(), string()).optional(),
|
|
15319
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
15320
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15523
15321
|
});
|
|
15524
|
-
/**
|
|
15525
|
-
*
|
|
15526
|
-
*
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
15536
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
15537
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
15538
|
-
* broker).
|
|
15539
|
-
*/
|
|
15540
|
-
clientIdPrefix: string().optional()
|
|
15322
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
15323
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
15324
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
15325
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
15326
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
15327
|
+
kind: LlmProfileKindSchema,
|
|
15328
|
+
label: string(),
|
|
15329
|
+
icon: string(),
|
|
15330
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15331
|
+
addonId: string(),
|
|
15332
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
15541
15333
|
});
|
|
15542
|
-
var
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
password: string().optional(),
|
|
15547
|
-
clientIdPrefix: string().optional()
|
|
15334
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
15335
|
+
var LlmDefaultSchema = object({
|
|
15336
|
+
selector: LlmDefaultSelectorSchema,
|
|
15337
|
+
profileId: string()
|
|
15548
15338
|
});
|
|
15549
|
-
|
|
15550
|
-
var
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
15561
|
-
allowAnonymous: boolean().default(false),
|
|
15562
|
-
/** Optional shared username/password for clients. */
|
|
15563
|
-
username: string().optional(),
|
|
15564
|
-
password: string().optional()
|
|
15339
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
15340
|
+
var LlmUsageRollupSchema = object({
|
|
15341
|
+
day: string(),
|
|
15342
|
+
consumer: string(),
|
|
15343
|
+
profileId: string(),
|
|
15344
|
+
calls: number(),
|
|
15345
|
+
okCalls: number(),
|
|
15346
|
+
errorCalls: number(),
|
|
15347
|
+
inputTokens: number(),
|
|
15348
|
+
outputTokens: number(),
|
|
15349
|
+
avgLatencyMs: number()
|
|
15565
15350
|
});
|
|
15566
|
-
|
|
15351
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
15352
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
15567
15353
|
id: string(),
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
brokerCount: number(),
|
|
15572
|
-
embeddedRunning: boolean()
|
|
15573
|
-
});
|
|
15574
|
-
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);
|
|
15575
|
-
var NetworkEndpointSchema = object({
|
|
15354
|
+
label: string(),
|
|
15355
|
+
family: string(),
|
|
15356
|
+
purpose: _enum(["text", "vision"]),
|
|
15576
15357
|
url: string(),
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
|
|
15358
|
+
sha256: string(),
|
|
15359
|
+
sizeBytes: number(),
|
|
15360
|
+
quantization: string(),
|
|
15361
|
+
/** Load-time guidance shown in the picker. */
|
|
15362
|
+
minRamBytes: number(),
|
|
15363
|
+
contextSizeDefault: number().int(),
|
|
15364
|
+
/** Vision models: companion projector file. */
|
|
15365
|
+
mmprojUrl: string().optional()
|
|
15580
15366
|
});
|
|
15581
|
-
var
|
|
15582
|
-
|
|
15583
|
-
|
|
15367
|
+
var LlmRuntimeNodeSchema = object({
|
|
15368
|
+
nodeId: string(),
|
|
15369
|
+
reachable: boolean(),
|
|
15370
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
15371
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15584
15372
|
error: string().optional()
|
|
15585
15373
|
});
|
|
15586
|
-
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
* the originating provider config (mode + sourcePort) so the
|
|
15591
|
-
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
15592
|
-
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
15593
|
-
*/
|
|
15594
|
-
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
15595
|
-
/**
|
|
15596
|
-
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
15597
|
-
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
15598
|
-
*/
|
|
15599
|
-
id: string(),
|
|
15600
|
-
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
15601
|
-
label: string(),
|
|
15602
|
-
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
15603
|
-
mode: string().optional(),
|
|
15604
|
-
/** Originating local port the ingress fronts (informational). */
|
|
15605
|
-
sourcePort: number().optional()
|
|
15374
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
15375
|
+
var ProfileRefInputSchema = object({
|
|
15376
|
+
addonId: string(),
|
|
15377
|
+
profileId: string()
|
|
15606
15378
|
});
|
|
15607
|
-
method(
|
|
15379
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
15380
|
+
kind: "mutation",
|
|
15381
|
+
auth: "admin"
|
|
15382
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
15383
|
+
kind: "mutation",
|
|
15384
|
+
auth: "admin"
|
|
15385
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
15386
|
+
kind: "mutation",
|
|
15387
|
+
auth: "admin"
|
|
15388
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
15389
|
+
selector: LlmDefaultSelectorSchema,
|
|
15390
|
+
profileId: string().nullable()
|
|
15391
|
+
}), _void(), {
|
|
15392
|
+
kind: "mutation",
|
|
15393
|
+
auth: "admin"
|
|
15394
|
+
}), method(object({
|
|
15395
|
+
since: number().optional(),
|
|
15396
|
+
until: number().optional(),
|
|
15397
|
+
consumer: string().optional(),
|
|
15398
|
+
profileId: string().optional()
|
|
15399
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
15400
|
+
nodeId: string(),
|
|
15401
|
+
model: ManagedModelRefSchema
|
|
15402
|
+
}), _void(), {
|
|
15403
|
+
kind: "mutation",
|
|
15404
|
+
auth: "admin"
|
|
15405
|
+
}), method(object({
|
|
15406
|
+
nodeId: string(),
|
|
15407
|
+
file: string()
|
|
15408
|
+
}), _void(), {
|
|
15409
|
+
kind: "mutation",
|
|
15410
|
+
auth: "admin"
|
|
15411
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
15412
|
+
kind: "mutation",
|
|
15413
|
+
auth: "admin"
|
|
15414
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
15415
|
+
kind: "mutation",
|
|
15416
|
+
auth: "admin"
|
|
15417
|
+
});
|
|
15418
|
+
var LogLevelSchema = _enum([
|
|
15419
|
+
"debug",
|
|
15420
|
+
"info",
|
|
15421
|
+
"warn",
|
|
15422
|
+
"error"
|
|
15423
|
+
]);
|
|
15424
|
+
var LogEntrySchema = object({
|
|
15425
|
+
timestamp: date(),
|
|
15426
|
+
level: LogLevelSchema,
|
|
15427
|
+
scope: array(string()),
|
|
15428
|
+
message: string(),
|
|
15429
|
+
meta: record(string(), unknown()).optional(),
|
|
15430
|
+
tags: record(string(), string()).optional()
|
|
15431
|
+
});
|
|
15432
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
15433
|
+
scope: array(string()).optional(),
|
|
15434
|
+
level: LogLevelSchema.optional(),
|
|
15435
|
+
since: date().optional(),
|
|
15436
|
+
until: date().optional(),
|
|
15437
|
+
limit: number().optional(),
|
|
15438
|
+
tags: record(string(), string()).optional()
|
|
15439
|
+
}), array(LogEntrySchema).readonly());
|
|
15608
15440
|
/**
|
|
15609
|
-
*
|
|
15441
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
15442
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
15443
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
15444
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
15445
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
15446
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
15610
15447
|
*
|
|
15611
|
-
*
|
|
15612
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
15613
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
15614
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
15615
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
15616
|
-
* message to what the kind supports — callers never special-case a service.
|
|
15448
|
+
* A contribution is a discriminated union on `kind`:
|
|
15617
15449
|
*
|
|
15618
|
-
*
|
|
15619
|
-
*
|
|
15620
|
-
* `
|
|
15621
|
-
*
|
|
15622
|
-
*
|
|
15623
|
-
*
|
|
15624
|
-
*
|
|
15625
|
-
*
|
|
15450
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
15451
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
15452
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
15453
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
15454
|
+
* login page needs NO change.
|
|
15455
|
+
*
|
|
15456
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
15457
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
15458
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
15459
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
15460
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
15461
|
+
*
|
|
15462
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
15463
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
15464
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
15465
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
15466
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
15467
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
15468
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
15469
|
+
* decision.
|
|
15470
|
+
*
|
|
15471
|
+
* Every contribution carries a `stage`:
|
|
15472
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
15473
|
+
* magic-link buttons; a future usernameless passkey).
|
|
15474
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
15475
|
+
* returned `factors` (passkey-as-2FA today).
|
|
15476
|
+
*
|
|
15477
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
15478
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
15479
|
+
* tRPC router.
|
|
15480
|
+
*/
|
|
15481
|
+
/** When a login method renders in the two-phase login flow. */
|
|
15482
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
15483
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
15484
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
15485
|
+
object({
|
|
15486
|
+
kind: literal("redirect"),
|
|
15487
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
15488
|
+
id: string(),
|
|
15489
|
+
/** Operator-facing button label. */
|
|
15490
|
+
label: string(),
|
|
15491
|
+
/** lucide-react icon name. */
|
|
15492
|
+
icon: string().optional(),
|
|
15493
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
15494
|
+
startUrl: string(),
|
|
15495
|
+
stage: LoginStageEnum
|
|
15496
|
+
}),
|
|
15497
|
+
object({
|
|
15498
|
+
kind: literal("widget"),
|
|
15499
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
15500
|
+
id: string(),
|
|
15501
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
15502
|
+
addonId: string(),
|
|
15503
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
15504
|
+
bundle: string(),
|
|
15505
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
15506
|
+
remote: WidgetRemoteSchema,
|
|
15507
|
+
stage: LoginStageEnum
|
|
15508
|
+
}),
|
|
15509
|
+
object({
|
|
15510
|
+
kind: literal("passkey"),
|
|
15511
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
15512
|
+
id: string(),
|
|
15513
|
+
/** Operator-facing button label. */
|
|
15514
|
+
label: string(),
|
|
15515
|
+
stage: LoginStageEnum,
|
|
15516
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
15517
|
+
rpId: string(),
|
|
15518
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
15519
|
+
origin: string().nullable()
|
|
15520
|
+
})
|
|
15521
|
+
]);
|
|
15522
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
15523
|
+
var CpuBreakdownSchema = object({
|
|
15524
|
+
total: number(),
|
|
15525
|
+
user: number(),
|
|
15526
|
+
system: number(),
|
|
15527
|
+
irq: number(),
|
|
15528
|
+
nice: number(),
|
|
15529
|
+
loadAvg: tuple([
|
|
15530
|
+
number(),
|
|
15531
|
+
number(),
|
|
15532
|
+
number()
|
|
15533
|
+
]),
|
|
15534
|
+
cores: number()
|
|
15535
|
+
});
|
|
15536
|
+
var MemoryInfoSchema = object({
|
|
15537
|
+
percent: number(),
|
|
15538
|
+
totalBytes: number(),
|
|
15539
|
+
usedBytes: number(),
|
|
15540
|
+
availableBytes: number(),
|
|
15541
|
+
swapUsedBytes: number(),
|
|
15542
|
+
swapTotalBytes: number()
|
|
15543
|
+
});
|
|
15544
|
+
var DiskIoSnapshotSchema = object({
|
|
15545
|
+
readBytes: number(),
|
|
15546
|
+
writeBytes: number(),
|
|
15547
|
+
readOps: number(),
|
|
15548
|
+
writeOps: number(),
|
|
15549
|
+
timestampMs: number()
|
|
15550
|
+
});
|
|
15551
|
+
var NetworkIoSnapshotSchema = object({
|
|
15552
|
+
rxBytes: number(),
|
|
15553
|
+
txBytes: number(),
|
|
15554
|
+
rxPackets: number(),
|
|
15555
|
+
txPackets: number(),
|
|
15556
|
+
rxErrors: number(),
|
|
15557
|
+
txErrors: number(),
|
|
15558
|
+
timestampMs: number()
|
|
15559
|
+
});
|
|
15560
|
+
var MetricsGpuInfoSchema = object({
|
|
15561
|
+
utilization: number(),
|
|
15562
|
+
model: string(),
|
|
15563
|
+
memoryUsedBytes: number(),
|
|
15564
|
+
memoryTotalBytes: number(),
|
|
15565
|
+
temperature: number().nullable()
|
|
15566
|
+
});
|
|
15567
|
+
var ProcessResourceInfoSchema = object({
|
|
15568
|
+
openFds: number(),
|
|
15569
|
+
threadCount: number(),
|
|
15570
|
+
activeHandles: number(),
|
|
15571
|
+
activeRequests: number()
|
|
15572
|
+
});
|
|
15573
|
+
var PressureAvgsSchema = object({
|
|
15574
|
+
avg10: number(),
|
|
15575
|
+
avg60: number(),
|
|
15576
|
+
avg300: number()
|
|
15577
|
+
});
|
|
15578
|
+
var PressureInfoSchema = object({
|
|
15579
|
+
some: PressureAvgsSchema,
|
|
15580
|
+
full: PressureAvgsSchema.nullable()
|
|
15581
|
+
});
|
|
15582
|
+
var SystemResourceSnapshotSchema = object({
|
|
15583
|
+
cpu: CpuBreakdownSchema,
|
|
15584
|
+
memory: MemoryInfoSchema,
|
|
15585
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15586
|
+
network: NetworkIoSnapshotSchema,
|
|
15587
|
+
disk: DiskIoSnapshotSchema,
|
|
15588
|
+
pressure: object({
|
|
15589
|
+
cpu: PressureInfoSchema.nullable(),
|
|
15590
|
+
memory: PressureInfoSchema.nullable(),
|
|
15591
|
+
io: PressureInfoSchema.nullable()
|
|
15592
|
+
}),
|
|
15593
|
+
process: ProcessResourceInfoSchema,
|
|
15594
|
+
cpuTemperature: number().nullable(),
|
|
15595
|
+
timestampMs: number()
|
|
15596
|
+
});
|
|
15597
|
+
var DiskSpaceInfoSchema = object({
|
|
15598
|
+
path: string(),
|
|
15599
|
+
totalBytes: number(),
|
|
15600
|
+
usedBytes: number(),
|
|
15601
|
+
availableBytes: number(),
|
|
15602
|
+
percent: number()
|
|
15603
|
+
});
|
|
15604
|
+
var PidResourceStatsSchema = object({
|
|
15605
|
+
pid: number(),
|
|
15606
|
+
cpu: number(),
|
|
15607
|
+
memory: number(),
|
|
15608
|
+
/**
|
|
15609
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
15610
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
15611
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
15612
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
15613
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
15614
|
+
*/
|
|
15615
|
+
privateBytes: number().optional(),
|
|
15616
|
+
/**
|
|
15617
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
15618
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
15619
|
+
*/
|
|
15620
|
+
sharedBytes: number().optional()
|
|
15621
|
+
});
|
|
15622
|
+
var AddonInstanceSchema = object({
|
|
15623
|
+
addonId: string(),
|
|
15624
|
+
nodeId: string(),
|
|
15625
|
+
role: _enum(["hub", "worker"]),
|
|
15626
|
+
pid: number(),
|
|
15627
|
+
state: _enum([
|
|
15628
|
+
"starting",
|
|
15629
|
+
"running",
|
|
15630
|
+
"stopping",
|
|
15631
|
+
"stopped",
|
|
15632
|
+
"crashed"
|
|
15633
|
+
]),
|
|
15634
|
+
uptimeSec: number()
|
|
15635
|
+
});
|
|
15636
|
+
var NodeProcessSchema = object({
|
|
15637
|
+
pid: number(),
|
|
15638
|
+
ppid: number(),
|
|
15639
|
+
pgid: number(),
|
|
15640
|
+
classification: _enum([
|
|
15641
|
+
"root",
|
|
15642
|
+
"managed",
|
|
15643
|
+
"system",
|
|
15644
|
+
"ghost"
|
|
15645
|
+
]),
|
|
15646
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
15647
|
+
addonId: string().nullable(),
|
|
15648
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15649
|
+
nodeId: string().nullable(),
|
|
15650
|
+
/** Truncated command line. */
|
|
15651
|
+
command: string(),
|
|
15652
|
+
cpuPercent: number(),
|
|
15653
|
+
memoryRssBytes: number(),
|
|
15654
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15655
|
+
uptimeSec: number(),
|
|
15656
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15657
|
+
orphaned: boolean()
|
|
15658
|
+
});
|
|
15659
|
+
var KillProcessInputSchema = object({
|
|
15660
|
+
pid: number(),
|
|
15661
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15662
|
+
force: boolean().optional()
|
|
15663
|
+
});
|
|
15664
|
+
var KillProcessResultSchema = object({
|
|
15665
|
+
success: boolean(),
|
|
15666
|
+
reason: string().optional(),
|
|
15667
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15668
|
+
});
|
|
15669
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
15670
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
15671
|
+
addonId: string() });
|
|
15672
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
15673
|
+
success: boolean(),
|
|
15674
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15675
|
+
path: string().optional(),
|
|
15676
|
+
/** Process pid that was signalled. */
|
|
15677
|
+
pid: number().optional(),
|
|
15678
|
+
reason: string().optional()
|
|
15679
|
+
});
|
|
15680
|
+
var SystemMetricsSchema = object({
|
|
15681
|
+
cpuPercent: number(),
|
|
15682
|
+
memoryPercent: number(),
|
|
15683
|
+
memoryUsedMB: number(),
|
|
15684
|
+
memoryTotalMB: number(),
|
|
15685
|
+
diskPercent: number().optional(),
|
|
15686
|
+
temperature: number().optional(),
|
|
15687
|
+
gpuPercent: number().optional(),
|
|
15688
|
+
gpuMemoryPercent: number().optional()
|
|
15689
|
+
});
|
|
15690
|
+
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, {
|
|
15691
|
+
kind: "mutation",
|
|
15692
|
+
auth: "admin"
|
|
15693
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
15694
|
+
kind: "mutation",
|
|
15695
|
+
auth: "admin"
|
|
15696
|
+
});
|
|
15697
|
+
method(object({
|
|
15698
|
+
sourceUrl: string(),
|
|
15699
|
+
metadata: ModelConvertMetadataSchema,
|
|
15700
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15701
|
+
calibrationRef: string().optional(),
|
|
15702
|
+
sessionId: string().optional()
|
|
15703
|
+
}), ConvertResultSchema, {
|
|
15704
|
+
kind: "mutation",
|
|
15705
|
+
auth: "admin",
|
|
15706
|
+
timeoutMs: 6e5
|
|
15707
|
+
});
|
|
15708
|
+
method(object({
|
|
15709
|
+
nodeId: string(),
|
|
15710
|
+
modelId: string(),
|
|
15711
|
+
format: _enum(MODEL_FORMATS),
|
|
15712
|
+
entry: ModelCatalogEntrySchema
|
|
15713
|
+
}), object({
|
|
15714
|
+
ok: boolean(),
|
|
15715
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15716
|
+
sha256: string(),
|
|
15717
|
+
bytes: number(),
|
|
15718
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
15719
|
+
path: string()
|
|
15720
|
+
}), {
|
|
15721
|
+
kind: "mutation",
|
|
15722
|
+
auth: "admin"
|
|
15723
|
+
});
|
|
15724
|
+
/**
|
|
15725
|
+
* `mqtt-broker` — broker-registry cap.
|
|
15726
|
+
*
|
|
15727
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15728
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15729
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
15730
|
+
* its OWN `mqtt.js` client.
|
|
15731
|
+
*
|
|
15732
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15733
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15734
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
15735
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15736
|
+
* features anyway — give it the connection config, get out of the way.
|
|
15737
|
+
*
|
|
15738
|
+
* Consumer flow:
|
|
15739
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
15740
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
15741
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
15742
|
+
*
|
|
15743
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
15744
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
15745
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
15746
|
+
* spawned it.
|
|
15747
|
+
*/
|
|
15748
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
15749
|
+
/**
|
|
15750
|
+
* Broker live-probe status.
|
|
15751
|
+
*
|
|
15752
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
15753
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
15754
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
15755
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
15756
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
15757
|
+
*/
|
|
15758
|
+
var BrokerStatusSchema$1 = _enum([
|
|
15759
|
+
"connected",
|
|
15760
|
+
"disconnected",
|
|
15761
|
+
"auth-failed",
|
|
15762
|
+
"unreachable",
|
|
15763
|
+
"tls-error"
|
|
15764
|
+
]);
|
|
15765
|
+
var BrokerInfoSchema = object({
|
|
15766
|
+
id: string(),
|
|
15767
|
+
name: string(),
|
|
15768
|
+
url: string(),
|
|
15769
|
+
kind: BrokerKindSchema,
|
|
15770
|
+
status: BrokerStatusSchema$1,
|
|
15771
|
+
latencyMs: number().nullable(),
|
|
15772
|
+
error: string().optional(),
|
|
15773
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
15774
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
15775
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
15776
|
+
lastCheckedAt: number().optional()
|
|
15777
|
+
});
|
|
15778
|
+
/**
|
|
15779
|
+
* Connection details — what a consumer needs to call
|
|
15780
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
15781
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
15782
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
15783
|
+
*/
|
|
15784
|
+
var BrokerConnectionDetailsSchema = object({
|
|
15785
|
+
url: string(),
|
|
15786
|
+
username: string().optional(),
|
|
15787
|
+
password: string().optional(),
|
|
15788
|
+
/**
|
|
15789
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
15790
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
15791
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
15792
|
+
* broker).
|
|
15793
|
+
*/
|
|
15794
|
+
clientIdPrefix: string().optional()
|
|
15795
|
+
});
|
|
15796
|
+
var AddBrokerInputSchema = object({
|
|
15797
|
+
name: string().min(1),
|
|
15798
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
15799
|
+
username: string().optional(),
|
|
15800
|
+
password: string().optional(),
|
|
15801
|
+
clientIdPrefix: string().optional()
|
|
15802
|
+
});
|
|
15803
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
15804
|
+
var IdInputSchema = object({ id: string() });
|
|
15805
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
15806
|
+
ok: literal(true),
|
|
15807
|
+
latencyMs: number()
|
|
15808
|
+
}), object({
|
|
15809
|
+
ok: literal(false),
|
|
15810
|
+
error: string()
|
|
15811
|
+
})]);
|
|
15812
|
+
var StartEmbeddedInputSchema = object({
|
|
15813
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
15814
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
15815
|
+
allowAnonymous: boolean().default(false),
|
|
15816
|
+
/** Optional shared username/password for clients. */
|
|
15817
|
+
username: string().optional(),
|
|
15818
|
+
password: string().optional()
|
|
15819
|
+
});
|
|
15820
|
+
var StartEmbeddedResultSchema = object({
|
|
15821
|
+
id: string(),
|
|
15822
|
+
url: string()
|
|
15823
|
+
});
|
|
15824
|
+
var StatusSchema = object({
|
|
15825
|
+
brokerCount: number(),
|
|
15826
|
+
embeddedRunning: boolean()
|
|
15827
|
+
});
|
|
15828
|
+
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);
|
|
15829
|
+
var NetworkEndpointSchema = object({
|
|
15830
|
+
url: string(),
|
|
15831
|
+
hostname: string(),
|
|
15832
|
+
port: number(),
|
|
15833
|
+
protocol: _enum(["http", "https"])
|
|
15834
|
+
});
|
|
15835
|
+
var NetworkAccessStatusSchema = object({
|
|
15836
|
+
connected: boolean(),
|
|
15837
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
15838
|
+
error: string().optional()
|
|
15839
|
+
});
|
|
15840
|
+
/**
|
|
15841
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
15842
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
15843
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
15844
|
+
* the originating provider config (mode + sourcePort) so the
|
|
15845
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
15846
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
15847
|
+
*/
|
|
15848
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
15849
|
+
/**
|
|
15850
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
15851
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
15852
|
+
*/
|
|
15853
|
+
id: string(),
|
|
15854
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
15855
|
+
label: string(),
|
|
15856
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
15857
|
+
mode: string().optional(),
|
|
15858
|
+
/** Originating local port the ingress fronts (informational). */
|
|
15859
|
+
sourcePort: number().optional()
|
|
15860
|
+
});
|
|
15861
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
15862
|
+
/**
|
|
15863
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
15864
|
+
*
|
|
15865
|
+
* Apprise-derived model (see
|
|
15866
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
15867
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
15868
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
15869
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
15870
|
+
* message to what the kind supports — callers never special-case a service.
|
|
15871
|
+
*
|
|
15872
|
+
* DESIGN DECISIONS (locked):
|
|
15873
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
15874
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
15875
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
15876
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
15877
|
+
* alternative would fork the UI per addon and cannot host the
|
|
15878
|
+
* discovery→adopt flow.
|
|
15879
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
15626
15880
|
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
15627
15881
|
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
15628
15882
|
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
@@ -15738,14 +15992,14 @@ var TargetKindCapsSchema = object({
|
|
|
15738
15992
|
* the union is large and not meant for runtime validation here; the exported
|
|
15739
15993
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
15740
15994
|
*/
|
|
15741
|
-
var ConfigSchemaPassthrough
|
|
15995
|
+
var ConfigSchemaPassthrough = unknown();
|
|
15742
15996
|
var TargetKindSchema = object({
|
|
15743
15997
|
kind: string(),
|
|
15744
15998
|
label: string(),
|
|
15745
15999
|
icon: string(),
|
|
15746
16000
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15747
16001
|
addonId: string(),
|
|
15748
|
-
configSchema: ConfigSchemaPassthrough
|
|
16002
|
+
configSchema: ConfigSchemaPassthrough,
|
|
15749
16003
|
supportsDiscovery: boolean(),
|
|
15750
16004
|
caps: TargetKindCapsSchema
|
|
15751
16005
|
});
|
|
@@ -15791,304 +16045,500 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
15791
16045
|
targetId: string(),
|
|
15792
16046
|
notification: NotificationSchema
|
|
15793
16047
|
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
15794
|
-
targetId: string(),
|
|
15795
|
-
sample: NotificationSchema.optional()
|
|
15796
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
15797
|
-
targetId: string(),
|
|
15798
|
-
enabled: boolean()
|
|
15799
|
-
}), _void(), { kind: "mutation" });
|
|
15800
|
-
/**
|
|
15801
|
-
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15802
|
-
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15803
|
-
* caps stay wire-compatible without a circular cap→cap import.
|
|
15804
|
-
*
|
|
15805
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15806
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
15807
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15808
|
-
*/
|
|
15809
|
-
var LlmUsageSchema = object({
|
|
15810
|
-
inputTokens: number(),
|
|
15811
|
-
outputTokens: number()
|
|
15812
|
-
});
|
|
15813
|
-
var LlmErrorCodeSchema = _enum([
|
|
15814
|
-
"timeout",
|
|
15815
|
-
"rate-limited",
|
|
15816
|
-
"auth",
|
|
15817
|
-
"refusal",
|
|
15818
|
-
"bad-request",
|
|
15819
|
-
"unavailable",
|
|
15820
|
-
"no-profile",
|
|
15821
|
-
"budget-exceeded",
|
|
15822
|
-
"adapter-error"
|
|
15823
|
-
]);
|
|
15824
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15825
|
-
ok: literal(true),
|
|
15826
|
-
text: string(),
|
|
15827
|
-
model: string(),
|
|
15828
|
-
usage: LlmUsageSchema,
|
|
15829
|
-
truncated: boolean(),
|
|
15830
|
-
latencyMs: number()
|
|
15831
|
-
}), object({
|
|
15832
|
-
ok: literal(false),
|
|
15833
|
-
code: LlmErrorCodeSchema,
|
|
15834
|
-
message: string(),
|
|
15835
|
-
retryAfterMs: number().optional()
|
|
15836
|
-
})]);
|
|
15837
|
-
/**
|
|
15838
|
-
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15839
|
-
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15840
|
-
* notification-output.cap.ts:27-31 precedents).
|
|
15841
|
-
*/
|
|
15842
|
-
var LlmImageSchema = object({
|
|
15843
|
-
bytes: _instanceof(Uint8Array),
|
|
15844
|
-
mimeType: string()
|
|
15845
|
-
});
|
|
15846
|
-
var LlmGenerateBaseInputSchema = object({
|
|
15847
|
-
/** Collection routing (the notification-output posture). */
|
|
15848
|
-
addonId: string().optional(),
|
|
15849
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15850
|
-
profileId: string().optional(),
|
|
15851
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15852
|
-
consumer: string(),
|
|
15853
|
-
system: string().optional(),
|
|
15854
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15855
|
-
prompt: string(),
|
|
15856
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15857
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
15858
|
-
/** Per-call override of the profile default. */
|
|
15859
|
-
maxTokens: number().int().positive().optional(),
|
|
15860
|
-
temperature: number().optional()
|
|
15861
|
-
});
|
|
16048
|
+
targetId: string(),
|
|
16049
|
+
sample: NotificationSchema.optional()
|
|
16050
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16051
|
+
targetId: string(),
|
|
16052
|
+
enabled: boolean()
|
|
16053
|
+
}), _void(), { kind: "mutation" });
|
|
15862
16054
|
/**
|
|
15863
|
-
*
|
|
15864
|
-
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15865
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15866
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15867
|
-
* this only through the `llm` cap's methods.
|
|
16055
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
15868
16056
|
*
|
|
15869
|
-
*
|
|
15870
|
-
*
|
|
15871
|
-
*
|
|
16057
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
16058
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
16059
|
+
*
|
|
16060
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
16061
|
+
* `notification-center` module), hooked on the durable persistence
|
|
16062
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
16063
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
16064
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
16065
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
16066
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
16067
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
16068
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
16069
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
16070
|
+
* target kind's own caps/degrade engine).
|
|
16071
|
+
*
|
|
16072
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
16073
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
16074
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
16075
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
16076
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
16077
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
16078
|
+
* P2+ (see spec §7).
|
|
16079
|
+
*
|
|
16080
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
16081
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
16082
|
+
* schema/interface drift is explicitly not repeated).
|
|
15872
16083
|
*/
|
|
15873
|
-
|
|
15874
|
-
|
|
15875
|
-
|
|
15876
|
-
|
|
15877
|
-
|
|
15878
|
-
|
|
15879
|
-
|
|
15880
|
-
|
|
15881
|
-
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
|
|
16084
|
+
/**
|
|
16085
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
16086
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
16087
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
16088
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
16089
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
16090
|
+
* change of a LINKED device, one row per linked camera)
|
|
16091
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
16092
|
+
* delivery / pick-up)
|
|
16093
|
+
*
|
|
16094
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
16095
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
16096
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
16097
|
+
* one trigger.
|
|
16098
|
+
*/
|
|
16099
|
+
var NcDeliverySchema = _enum([
|
|
16100
|
+
"immediate",
|
|
16101
|
+
"track-end",
|
|
16102
|
+
"device-event",
|
|
16103
|
+
"package-event"
|
|
15887
16104
|
]);
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15898
|
-
|
|
15899
|
-
|
|
15900
|
-
parallel: number().int().default(1),
|
|
15901
|
-
/** Else lazy: first generate boots it. */
|
|
15902
|
-
autoStart: boolean().default(false),
|
|
15903
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
15904
|
-
idleStopMinutes: number().int().default(30)
|
|
15905
|
-
});
|
|
15906
|
-
var LlmRuntimeStatusSchema = object({
|
|
15907
|
-
/** Status is ALWAYS node-qualified. */
|
|
15908
|
-
nodeId: string(),
|
|
15909
|
-
state: _enum([
|
|
15910
|
-
"stopped",
|
|
15911
|
-
"downloading",
|
|
15912
|
-
"starting",
|
|
15913
|
-
"ready",
|
|
15914
|
-
"crashed",
|
|
15915
|
-
"failed"
|
|
15916
|
-
]),
|
|
15917
|
-
pid: number().optional(),
|
|
15918
|
-
port: number().optional(),
|
|
15919
|
-
modelPath: string().optional(),
|
|
15920
|
-
modelId: string().optional(),
|
|
15921
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
15922
|
-
lastError: string().optional(),
|
|
15923
|
-
crashesInWindow: number(),
|
|
15924
|
-
/** Child RSS (sampled best-effort). */
|
|
15925
|
-
memoryBytes: number().optional(),
|
|
15926
|
-
vramBytes: number().optional()
|
|
16105
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
16106
|
+
var NcScheduleSchema = object({
|
|
16107
|
+
windows: array(object({
|
|
16108
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
16109
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
16110
|
+
startMinute: number().int().min(0).max(1439),
|
|
16111
|
+
endMinute: number().int().min(0).max(1439)
|
|
16112
|
+
})).min(1),
|
|
16113
|
+
/** IANA timezone; default = hub host timezone. */
|
|
16114
|
+
timezone: string().optional(),
|
|
16115
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
16116
|
+
invert: boolean().optional()
|
|
15927
16117
|
});
|
|
15928
|
-
|
|
15929
|
-
|
|
15930
|
-
|
|
15931
|
-
|
|
15932
|
-
|
|
16118
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
16119
|
+
var NcPlateMatcherSchema = object({
|
|
16120
|
+
values: array(string().min(1)).min(1),
|
|
16121
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
16122
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
15933
16123
|
});
|
|
15934
|
-
|
|
15935
|
-
|
|
15936
|
-
|
|
15937
|
-
|
|
16124
|
+
/**
|
|
16125
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
16126
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
16127
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
16128
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
16129
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
16130
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
16131
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
16132
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
16133
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
16134
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
16135
|
+
* (declared SQLite collection, reseeded on boot).
|
|
16136
|
+
*/
|
|
16137
|
+
var NcOccupancyConditionSchema = object({
|
|
16138
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
16139
|
+
zoneId: string().optional(),
|
|
16140
|
+
/** Object class to count; absent = any class. */
|
|
16141
|
+
className: string().optional(),
|
|
16142
|
+
op: _enum([
|
|
16143
|
+
"became-occupied",
|
|
16144
|
+
"became-free",
|
|
16145
|
+
">=",
|
|
16146
|
+
"<="
|
|
16147
|
+
]).default("became-occupied"),
|
|
16148
|
+
count: number().int().min(0).default(1),
|
|
16149
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
16150
|
+
});
|
|
16151
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
16152
|
+
var NcZoneConditionSchema = object({
|
|
16153
|
+
ids: array(string().min(1)).min(1),
|
|
16154
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
16155
|
+
match: _enum(["any", "all"]).default("any")
|
|
15938
16156
|
});
|
|
15939
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
15940
|
-
images: array(LlmImageSchema).optional(),
|
|
15941
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
15942
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15943
|
-
timeoutMs: number().int().positive().optional()
|
|
15944
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15945
|
-
kind: "mutation",
|
|
15946
|
-
auth: "admin"
|
|
15947
|
-
}), method(object({}), _void(), {
|
|
15948
|
-
kind: "mutation",
|
|
15949
|
-
auth: "admin"
|
|
15950
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15951
|
-
kind: "mutation",
|
|
15952
|
-
auth: "admin"
|
|
15953
|
-
}), method(object({ file: string() }), _void(), {
|
|
15954
|
-
kind: "mutation",
|
|
15955
|
-
auth: "admin"
|
|
15956
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15957
16157
|
/**
|
|
15958
|
-
*
|
|
15959
|
-
*
|
|
15960
|
-
* provider by the `addonId` in the call input (the notification-output
|
|
15961
|
-
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15962
|
-
* (hub-placed); the cap stays open for future providers.
|
|
15963
|
-
*
|
|
15964
|
-
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15965
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15966
|
-
* write; a stored key NEVER round-trips to a client.
|
|
16158
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
16159
|
+
* membership lists are OR within the list (spec §2.3).
|
|
15967
16160
|
*/
|
|
15968
|
-
var
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
|
|
15979
|
-
/**
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
/**
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
|
|
16161
|
+
var NcConditionsSchema = object({
|
|
16162
|
+
/** Device scope — absent = all devices. */
|
|
16163
|
+
devices: array(number()).optional(),
|
|
16164
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
16165
|
+
classes: array(string().min(1)).optional(),
|
|
16166
|
+
/** Veto classes — any overlap fails the rule. */
|
|
16167
|
+
classesExclude: array(string().min(1)).optional(),
|
|
16168
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
16169
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
16170
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
16171
|
+
zones: NcZoneConditionSchema.optional(),
|
|
16172
|
+
/** Veto zones — any hit fails the rule. */
|
|
16173
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
16174
|
+
/**
|
|
16175
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
16176
|
+
* (identity name / plate text / subclass).
|
|
16177
|
+
*/
|
|
16178
|
+
labelEquals: array(string().min(1)).optional(),
|
|
16179
|
+
/**
|
|
16180
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
16181
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
16182
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
16183
|
+
*/
|
|
16184
|
+
identities: array(string().min(1)).optional(),
|
|
16185
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
16186
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
16187
|
+
/**
|
|
16188
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
16189
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
16190
|
+
* identity display name). A record with NO label passes (nothing to
|
|
16191
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
16192
|
+
*/
|
|
16193
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
16194
|
+
/**
|
|
16195
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
16196
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
16197
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
16198
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
16199
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
16200
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
16201
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
16202
|
+
*/
|
|
16203
|
+
minImportance: number().min(0).max(1).optional(),
|
|
16204
|
+
/**
|
|
16205
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
16206
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
16207
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
16208
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
16209
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
16210
|
+
*/
|
|
16211
|
+
minDwellSeconds: number().min(0).optional(),
|
|
16212
|
+
/**
|
|
16213
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
16214
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
16215
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
16216
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
16217
|
+
* tracks carry `sensor`.
|
|
16218
|
+
*/
|
|
16219
|
+
source: _enum([
|
|
16220
|
+
"pipeline",
|
|
16221
|
+
"onboard",
|
|
16222
|
+
"sensor",
|
|
16223
|
+
"any"
|
|
16224
|
+
]).optional(),
|
|
16225
|
+
/**
|
|
16226
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
16227
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
16228
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
16229
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
16230
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
16231
|
+
*
|
|
16232
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
16233
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
16234
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
16235
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
16236
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
16237
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
16238
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
16239
|
+
* one track the higher of the two is used. A track that ended with no
|
|
16240
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
16241
|
+
* closed for it (an un-recognized subject).
|
|
16242
|
+
*/
|
|
16243
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
16244
|
+
/**
|
|
16245
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
16246
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
16247
|
+
* against the token carried on the device-event subject (extracted from the
|
|
16248
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
16249
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
16250
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
16251
|
+
*/
|
|
16252
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
16253
|
+
/**
|
|
16254
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
16255
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
16256
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
16257
|
+
*/
|
|
16258
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
16259
|
+
/**
|
|
16260
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
16261
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
16262
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
16263
|
+
* on the package-event trigger).
|
|
16264
|
+
*/
|
|
16265
|
+
packagePhase: _enum([
|
|
16266
|
+
"delivered",
|
|
16267
|
+
"picked-up",
|
|
16268
|
+
"both"
|
|
16269
|
+
]).optional(),
|
|
16270
|
+
/**
|
|
16271
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
16272
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
16273
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
16274
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
16275
|
+
*/
|
|
16276
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
16277
|
+
/**
|
|
16278
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
16279
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
16280
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
16281
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
16282
|
+
*/
|
|
16283
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
15995
16284
|
});
|
|
15996
|
-
/**
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
configSchema: ConfigSchemaPassthrough
|
|
16285
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
16286
|
+
var NcRuleTargetSchema = object({
|
|
16287
|
+
/** `notification-output` Target id. */
|
|
16288
|
+
targetId: string().min(1),
|
|
16289
|
+
/**
|
|
16290
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
16291
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
16292
|
+
* degrade engine drops what the backend can't render.
|
|
16293
|
+
*/
|
|
16294
|
+
params: record(string(), unknown()).optional()
|
|
16007
16295
|
});
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
|
|
16296
|
+
/**
|
|
16297
|
+
* Media attachment policy (P1 still-image subset).
|
|
16298
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
16299
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
16300
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
16301
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
16302
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
16303
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
16304
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
16305
|
+
* name), so the choice never drifts from the record that fired it.
|
|
16306
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
16307
|
+
* - `none` — no attachment.
|
|
16308
|
+
*/
|
|
16309
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
16310
|
+
"best",
|
|
16311
|
+
"best-matching",
|
|
16312
|
+
"keyFrame",
|
|
16313
|
+
"none"
|
|
16314
|
+
]).default("best") });
|
|
16315
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
16316
|
+
var NcThrottleSchema = object({
|
|
16317
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
16318
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
16319
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
16320
|
+
});
|
|
16321
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
16322
|
+
var NcRuleInputSchema = object({
|
|
16323
|
+
name: string().min(1).max(200),
|
|
16324
|
+
enabled: boolean().default(true),
|
|
16325
|
+
delivery: NcDeliverySchema,
|
|
16326
|
+
conditions: NcConditionsSchema.default({}),
|
|
16327
|
+
schedule: NcScheduleSchema.optional(),
|
|
16328
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
16329
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
16330
|
+
throttle: NcThrottleSchema.default({
|
|
16331
|
+
cooldownSec: 60,
|
|
16332
|
+
scope: "rule-device"
|
|
16333
|
+
}),
|
|
16334
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
16335
|
+
template: object({
|
|
16336
|
+
title: string().max(500).optional(),
|
|
16337
|
+
body: string().max(2e3).optional()
|
|
16338
|
+
}).optional(),
|
|
16339
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
16340
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16341
|
+
/**
|
|
16342
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
16343
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
16344
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
16345
|
+
*/
|
|
16346
|
+
ownerUserId: string().optional()
|
|
16012
16347
|
});
|
|
16013
|
-
/**
|
|
16014
|
-
|
|
16015
|
-
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
|
|
16022
|
-
|
|
16023
|
-
|
|
16348
|
+
/**
|
|
16349
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
16350
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
16351
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
16352
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
16353
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
16354
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
16355
|
+
* `updateRule` patch.
|
|
16356
|
+
*/
|
|
16357
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
16358
|
+
/** A persisted rule. */
|
|
16359
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
16360
|
+
id: string(),
|
|
16361
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
16362
|
+
createdBy: string(),
|
|
16363
|
+
createdAt: number(),
|
|
16364
|
+
updatedAt: number(),
|
|
16365
|
+
/**
|
|
16366
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
16367
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
16368
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
16369
|
+
*/
|
|
16370
|
+
disabledTargetIds: array(string()).default([])
|
|
16371
|
+
});
|
|
16372
|
+
var NcTestResultSchema = object({
|
|
16373
|
+
recordId: string(),
|
|
16374
|
+
recordKind: _enum([
|
|
16375
|
+
"object-event",
|
|
16376
|
+
"track",
|
|
16377
|
+
"device-event",
|
|
16378
|
+
"package-event"
|
|
16379
|
+
]),
|
|
16380
|
+
deviceId: number(),
|
|
16381
|
+
timestamp: number(),
|
|
16382
|
+
wouldFire: boolean(),
|
|
16383
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
16384
|
+
failedCondition: string().optional(),
|
|
16385
|
+
className: string().optional(),
|
|
16386
|
+
label: string().optional()
|
|
16024
16387
|
});
|
|
16025
|
-
|
|
16026
|
-
|
|
16388
|
+
var NcConditionDescriptorSchema = object({
|
|
16389
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
16027
16390
|
id: string(),
|
|
16391
|
+
group: _enum([
|
|
16392
|
+
"scope",
|
|
16393
|
+
"class",
|
|
16394
|
+
"zones",
|
|
16395
|
+
"quality",
|
|
16396
|
+
"label",
|
|
16397
|
+
"schedule",
|
|
16398
|
+
"device",
|
|
16399
|
+
"package",
|
|
16400
|
+
"occupancy"
|
|
16401
|
+
]),
|
|
16028
16402
|
label: string(),
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
|
|
16036
|
-
|
|
16037
|
-
|
|
16038
|
-
|
|
16039
|
-
|
|
16403
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
16404
|
+
valueType: _enum([
|
|
16405
|
+
"deviceIdList",
|
|
16406
|
+
"stringList",
|
|
16407
|
+
"number01",
|
|
16408
|
+
"number",
|
|
16409
|
+
"sourceSelect",
|
|
16410
|
+
"zoneSelection",
|
|
16411
|
+
"zoneIdList",
|
|
16412
|
+
"schedule",
|
|
16413
|
+
"plateMatcher",
|
|
16414
|
+
"packagePhase",
|
|
16415
|
+
"polygonDraw",
|
|
16416
|
+
"occupancy"
|
|
16417
|
+
]),
|
|
16418
|
+
operator: _enum([
|
|
16419
|
+
"in",
|
|
16420
|
+
"notIn",
|
|
16421
|
+
"anyOf",
|
|
16422
|
+
"allOf",
|
|
16423
|
+
"gte",
|
|
16424
|
+
"fuzzyIn",
|
|
16425
|
+
"withinSchedule"
|
|
16426
|
+
]),
|
|
16427
|
+
/** Which delivery kinds the condition applies to. */
|
|
16428
|
+
appliesTo: array(NcDeliverySchema),
|
|
16429
|
+
phase: string(),
|
|
16430
|
+
description: string().optional()
|
|
16040
16431
|
});
|
|
16041
|
-
|
|
16042
|
-
|
|
16043
|
-
|
|
16044
|
-
|
|
16045
|
-
|
|
16046
|
-
|
|
16432
|
+
/**
|
|
16433
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
16434
|
+
* durable outbox row's own status (single source of truth):
|
|
16435
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
16436
|
+
* - `sent` — delivered (terminal)
|
|
16437
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
16438
|
+
* backend rejection / a deleted target (terminal; carries
|
|
16439
|
+
* the failure `error`)
|
|
16440
|
+
*
|
|
16441
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
16442
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
16443
|
+
*/
|
|
16444
|
+
var NcHistoryStatusSchema = _enum([
|
|
16445
|
+
"pending",
|
|
16446
|
+
"sent",
|
|
16447
|
+
"dead"
|
|
16448
|
+
]);
|
|
16449
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
16450
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
16451
|
+
"object-event",
|
|
16452
|
+
"track-end",
|
|
16453
|
+
"device-event",
|
|
16454
|
+
"package-event"
|
|
16455
|
+
]);
|
|
16456
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
16457
|
+
var NcHistorySubjectSchema = object({
|
|
16458
|
+
className: string(),
|
|
16459
|
+
label: string().optional(),
|
|
16460
|
+
confidence: number().optional(),
|
|
16461
|
+
zones: array(string()),
|
|
16462
|
+
timestamp: number()
|
|
16047
16463
|
});
|
|
16048
|
-
|
|
16049
|
-
|
|
16050
|
-
|
|
16051
|
-
|
|
16464
|
+
/**
|
|
16465
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
16466
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
16467
|
+
* NO second write path, so history can never drift from delivery state).
|
|
16468
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
16469
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
16470
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
16471
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
16472
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
16473
|
+
* P1 (admin scope only).
|
|
16474
|
+
*/
|
|
16475
|
+
var NcHistoryEntrySchema = object({
|
|
16476
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
16477
|
+
id: string(),
|
|
16478
|
+
ruleId: string(),
|
|
16479
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
16480
|
+
ruleName: string(),
|
|
16481
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
16482
|
+
delivery: NcDeliverySchema,
|
|
16483
|
+
targetId: string(),
|
|
16484
|
+
deviceId: number(),
|
|
16485
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
16486
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
16487
|
+
recordId: string(),
|
|
16488
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
16489
|
+
trackId: string().optional(),
|
|
16490
|
+
status: NcHistoryStatusSchema,
|
|
16491
|
+
/** Delivery attempts made so far. */
|
|
16492
|
+
attempts: number().int(),
|
|
16493
|
+
/** Fire time (outbox enqueue). */
|
|
16494
|
+
createdAt: number(),
|
|
16495
|
+
/** Last transition time (terminal for sent / dead). */
|
|
16496
|
+
updatedAt: number(),
|
|
16497
|
+
/** Failure detail — present on a `dead` row. */
|
|
16498
|
+
error: string().optional(),
|
|
16499
|
+
subject: NcHistorySubjectSchema
|
|
16052
16500
|
});
|
|
16053
|
-
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
selector: LlmDefaultSelectorSchema,
|
|
16064
|
-
profileId: string().nullable()
|
|
16065
|
-
}), _void(), {
|
|
16066
|
-
kind: "mutation",
|
|
16067
|
-
auth: "admin"
|
|
16068
|
-
}), method(object({
|
|
16501
|
+
/**
|
|
16502
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
16503
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
16504
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
16505
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
16506
|
+
*/
|
|
16507
|
+
var NcHistoryFilterSchema = object({
|
|
16508
|
+
ruleId: string().optional(),
|
|
16509
|
+
deviceId: number().optional(),
|
|
16510
|
+
status: NcHistoryStatusSchema.optional(),
|
|
16069
16511
|
since: number().optional(),
|
|
16070
16512
|
until: number().optional(),
|
|
16071
|
-
|
|
16072
|
-
|
|
16073
|
-
}), array(
|
|
16074
|
-
nodeId: string(),
|
|
16075
|
-
model: ManagedModelRefSchema
|
|
16076
|
-
}), _void(), {
|
|
16513
|
+
limit: number().int().min(1).max(500).default(100)
|
|
16514
|
+
});
|
|
16515
|
+
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 }), {
|
|
16077
16516
|
kind: "mutation",
|
|
16078
|
-
auth: "admin"
|
|
16517
|
+
auth: "admin",
|
|
16518
|
+
caller: "required"
|
|
16079
16519
|
}), method(object({
|
|
16080
|
-
|
|
16081
|
-
|
|
16082
|
-
}),
|
|
16520
|
+
ruleId: string(),
|
|
16521
|
+
patch: NcRulePatchSchema
|
|
16522
|
+
}), object({ rule: NcRuleSchema }), {
|
|
16523
|
+
kind: "mutation",
|
|
16524
|
+
auth: "admin",
|
|
16525
|
+
caller: "required"
|
|
16526
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
16083
16527
|
kind: "mutation",
|
|
16084
16528
|
auth: "admin"
|
|
16085
|
-
}), method(
|
|
16529
|
+
}), method(object({
|
|
16530
|
+
ruleId: string(),
|
|
16531
|
+
enabled: boolean()
|
|
16532
|
+
}), object({ success: literal(true) }), {
|
|
16086
16533
|
kind: "mutation",
|
|
16087
16534
|
auth: "admin"
|
|
16088
|
-
}), method(
|
|
16535
|
+
}), method(object({
|
|
16536
|
+
rule: NcRuleInputSchema,
|
|
16537
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
16538
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
16089
16539
|
kind: "mutation",
|
|
16090
16540
|
auth: "admin"
|
|
16091
|
-
});
|
|
16541
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
16092
16542
|
/**
|
|
16093
16543
|
* Zod schemas for persisted record types.
|
|
16094
16544
|
*
|
|
@@ -16798,76 +17248,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16798
17248
|
eventId: string(),
|
|
16799
17249
|
timestamp: number()
|
|
16800
17250
|
});
|
|
16801
|
-
/**
|
|
16802
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
16803
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
16804
|
-
* caps into per-camera event-kind descriptors.
|
|
16805
|
-
*
|
|
16806
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
16807
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
16808
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
16809
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
16810
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
16811
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
16812
|
-
* eventful cap is missing.
|
|
16813
|
-
*/
|
|
16814
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
16815
|
-
var LEGACY_ICON = {
|
|
16816
|
-
motion: "motion",
|
|
16817
|
-
audio: "audio",
|
|
16818
|
-
person: "person",
|
|
16819
|
-
vehicle: "vehicle",
|
|
16820
|
-
animal: "animal",
|
|
16821
|
-
package: "package",
|
|
16822
|
-
door: "door",
|
|
16823
|
-
pir: "pir",
|
|
16824
|
-
smoke: "smoke",
|
|
16825
|
-
water: "water",
|
|
16826
|
-
button: "button",
|
|
16827
|
-
generic: "generic",
|
|
16828
|
-
gas: "smoke",
|
|
16829
|
-
vibration: "generic",
|
|
16830
|
-
tamper: "generic",
|
|
16831
|
-
presence: "person",
|
|
16832
|
-
lock: "generic",
|
|
16833
|
-
siren: "generic",
|
|
16834
|
-
switch: "generic",
|
|
16835
|
-
doorbell: "button"
|
|
16836
|
-
};
|
|
16837
|
-
function legacyIcon(iconId) {
|
|
16838
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
16839
|
-
}
|
|
16840
|
-
/**
|
|
16841
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
16842
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
16843
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
16844
|
-
*/
|
|
16845
|
-
var CAP_TO_KIND = {
|
|
16846
|
-
contact: "contact",
|
|
16847
|
-
motion: "motion-sensor",
|
|
16848
|
-
smoke: "smoke",
|
|
16849
|
-
flood: "flood",
|
|
16850
|
-
gas: "gas",
|
|
16851
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
16852
|
-
vibration: "vibration",
|
|
16853
|
-
tamper: "tamper",
|
|
16854
|
-
presence: "presence",
|
|
16855
|
-
"enum-sensor": "enum-sensor",
|
|
16856
|
-
"event-emitter": "device-event",
|
|
16857
|
-
"lock-control": "lock",
|
|
16858
|
-
switch: "switch",
|
|
16859
|
-
button: "button",
|
|
16860
|
-
doorbell: "doorbell"
|
|
16861
|
-
};
|
|
16862
|
-
function buildDescriptor(capName, kind) {
|
|
16863
|
-
const t = EVENT_TAXONOMY[kind];
|
|
16864
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
16865
|
-
return {
|
|
16866
|
-
...t,
|
|
16867
|
-
icon: legacyIcon(t.iconId)
|
|
16868
|
-
};
|
|
16869
|
-
}
|
|
16870
|
-
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
16871
17251
|
var CameraPipelineConfigSchema = object({
|
|
16872
17252
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
16873
17253
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -17353,6 +17733,76 @@ method(object({
|
|
|
17353
17733
|
auth: "admin"
|
|
17354
17734
|
});
|
|
17355
17735
|
/**
|
|
17736
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
17737
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
17738
|
+
* caps into per-camera event-kind descriptors.
|
|
17739
|
+
*
|
|
17740
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
17741
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
17742
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
17743
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
17744
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
17745
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
17746
|
+
* eventful cap is missing.
|
|
17747
|
+
*/
|
|
17748
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
17749
|
+
var LEGACY_ICON = {
|
|
17750
|
+
motion: "motion",
|
|
17751
|
+
audio: "audio",
|
|
17752
|
+
person: "person",
|
|
17753
|
+
vehicle: "vehicle",
|
|
17754
|
+
animal: "animal",
|
|
17755
|
+
package: "package",
|
|
17756
|
+
door: "door",
|
|
17757
|
+
pir: "pir",
|
|
17758
|
+
smoke: "smoke",
|
|
17759
|
+
water: "water",
|
|
17760
|
+
button: "button",
|
|
17761
|
+
generic: "generic",
|
|
17762
|
+
gas: "smoke",
|
|
17763
|
+
vibration: "generic",
|
|
17764
|
+
tamper: "generic",
|
|
17765
|
+
presence: "person",
|
|
17766
|
+
lock: "generic",
|
|
17767
|
+
siren: "generic",
|
|
17768
|
+
switch: "generic",
|
|
17769
|
+
doorbell: "button"
|
|
17770
|
+
};
|
|
17771
|
+
function legacyIcon(iconId) {
|
|
17772
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
17773
|
+
}
|
|
17774
|
+
/**
|
|
17775
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
17776
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
17777
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
17778
|
+
*/
|
|
17779
|
+
var CAP_TO_KIND = {
|
|
17780
|
+
contact: "contact",
|
|
17781
|
+
motion: "motion-sensor",
|
|
17782
|
+
smoke: "smoke",
|
|
17783
|
+
flood: "flood",
|
|
17784
|
+
gas: "gas",
|
|
17785
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
17786
|
+
vibration: "vibration",
|
|
17787
|
+
tamper: "tamper",
|
|
17788
|
+
presence: "presence",
|
|
17789
|
+
"enum-sensor": "enum-sensor",
|
|
17790
|
+
"event-emitter": "device-event",
|
|
17791
|
+
"lock-control": "lock",
|
|
17792
|
+
switch: "switch",
|
|
17793
|
+
button: "button",
|
|
17794
|
+
doorbell: "doorbell"
|
|
17795
|
+
};
|
|
17796
|
+
function buildDescriptor(capName, kind) {
|
|
17797
|
+
const t = EVENT_TAXONOMY[kind];
|
|
17798
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
17799
|
+
return {
|
|
17800
|
+
...t,
|
|
17801
|
+
icon: legacyIcon(t.iconId)
|
|
17802
|
+
};
|
|
17803
|
+
}
|
|
17804
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
17805
|
+
/**
|
|
17356
17806
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
17357
17807
|
* package lifecycle (runtime-updatable node packages).
|
|
17358
17808
|
*
|
|
@@ -18807,7 +19257,28 @@ var FaceInfoSchema = object({
|
|
|
18807
19257
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
18808
19258
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
18809
19259
|
* back to the inline `base64` face crop. */
|
|
18810
|
-
keyFrameMediaKey: string().optional()
|
|
19260
|
+
keyFrameMediaKey: string().optional(),
|
|
19261
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
19262
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
19263
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
19264
|
+
* faces that were never auto-recognized. */
|
|
19265
|
+
bestMatchScore: number().optional(),
|
|
19266
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
19267
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
19268
|
+
* legacy rows / runners that reported no native measure. */
|
|
19269
|
+
nativeFaceShortSidePx: number().optional(),
|
|
19270
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
19271
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
19272
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
19273
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
19274
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
19275
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
19276
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
19277
|
+
suggestedIdentityId: string().optional(),
|
|
19278
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
19279
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
19280
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
19281
|
+
suggestedMatchScore: number().optional()
|
|
18811
19282
|
});
|
|
18812
19283
|
var FaceFilterEnum = _enum([
|
|
18813
19284
|
"unassigned",
|
|
@@ -20850,36 +21321,6 @@ Object.freeze({
|
|
|
20850
21321
|
addonId: null,
|
|
20851
21322
|
access: "view"
|
|
20852
21323
|
},
|
|
20853
|
-
"advancedNotifier.deleteRule": {
|
|
20854
|
-
capName: "advanced-notifier",
|
|
20855
|
-
capScope: "system",
|
|
20856
|
-
addonId: null,
|
|
20857
|
-
access: "delete"
|
|
20858
|
-
},
|
|
20859
|
-
"advancedNotifier.getHistory": {
|
|
20860
|
-
capName: "advanced-notifier",
|
|
20861
|
-
capScope: "system",
|
|
20862
|
-
addonId: null,
|
|
20863
|
-
access: "view"
|
|
20864
|
-
},
|
|
20865
|
-
"advancedNotifier.getRules": {
|
|
20866
|
-
capName: "advanced-notifier",
|
|
20867
|
-
capScope: "system",
|
|
20868
|
-
addonId: null,
|
|
20869
|
-
access: "view"
|
|
20870
|
-
},
|
|
20871
|
-
"advancedNotifier.testRule": {
|
|
20872
|
-
capName: "advanced-notifier",
|
|
20873
|
-
capScope: "system",
|
|
20874
|
-
addonId: null,
|
|
20875
|
-
access: "create"
|
|
20876
|
-
},
|
|
20877
|
-
"advancedNotifier.upsertRule": {
|
|
20878
|
-
capName: "advanced-notifier",
|
|
20879
|
-
capScope: "system",
|
|
20880
|
-
addonId: null,
|
|
20881
|
-
access: "create"
|
|
20882
|
-
},
|
|
20883
21324
|
"alarmPanel.arm": {
|
|
20884
21325
|
capName: "alarm-panel",
|
|
20885
21326
|
capScope: "device",
|
|
@@ -23184,6 +23625,60 @@ Object.freeze({
|
|
|
23184
23625
|
addonId: null,
|
|
23185
23626
|
access: "create"
|
|
23186
23627
|
},
|
|
23628
|
+
"notificationRules.createRule": {
|
|
23629
|
+
capName: "notification-rules",
|
|
23630
|
+
capScope: "system",
|
|
23631
|
+
addonId: null,
|
|
23632
|
+
access: "create"
|
|
23633
|
+
},
|
|
23634
|
+
"notificationRules.deleteRule": {
|
|
23635
|
+
capName: "notification-rules",
|
|
23636
|
+
capScope: "system",
|
|
23637
|
+
addonId: null,
|
|
23638
|
+
access: "delete"
|
|
23639
|
+
},
|
|
23640
|
+
"notificationRules.getConditionCatalog": {
|
|
23641
|
+
capName: "notification-rules",
|
|
23642
|
+
capScope: "system",
|
|
23643
|
+
addonId: null,
|
|
23644
|
+
access: "view"
|
|
23645
|
+
},
|
|
23646
|
+
"notificationRules.getHistory": {
|
|
23647
|
+
capName: "notification-rules",
|
|
23648
|
+
capScope: "system",
|
|
23649
|
+
addonId: null,
|
|
23650
|
+
access: "view"
|
|
23651
|
+
},
|
|
23652
|
+
"notificationRules.getRule": {
|
|
23653
|
+
capName: "notification-rules",
|
|
23654
|
+
capScope: "system",
|
|
23655
|
+
addonId: null,
|
|
23656
|
+
access: "view"
|
|
23657
|
+
},
|
|
23658
|
+
"notificationRules.listRules": {
|
|
23659
|
+
capName: "notification-rules",
|
|
23660
|
+
capScope: "system",
|
|
23661
|
+
addonId: null,
|
|
23662
|
+
access: "view"
|
|
23663
|
+
},
|
|
23664
|
+
"notificationRules.setRuleEnabled": {
|
|
23665
|
+
capName: "notification-rules",
|
|
23666
|
+
capScope: "system",
|
|
23667
|
+
addonId: null,
|
|
23668
|
+
access: "create"
|
|
23669
|
+
},
|
|
23670
|
+
"notificationRules.testRule": {
|
|
23671
|
+
capName: "notification-rules",
|
|
23672
|
+
capScope: "system",
|
|
23673
|
+
addonId: null,
|
|
23674
|
+
access: "create"
|
|
23675
|
+
},
|
|
23676
|
+
"notificationRules.updateRule": {
|
|
23677
|
+
capName: "notification-rules",
|
|
23678
|
+
capScope: "system",
|
|
23679
|
+
addonId: null,
|
|
23680
|
+
access: "create"
|
|
23681
|
+
},
|
|
23187
23682
|
"notifier.cancel": {
|
|
23188
23683
|
capName: "notifier",
|
|
23189
23684
|
capScope: "device",
|
|
@@ -25415,7 +25910,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
25415
25910
|
capability: adminUiCapability,
|
|
25416
25911
|
provider: {
|
|
25417
25912
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
25418
|
-
getVersion: async () => ({ version: "1.2.
|
|
25913
|
+
getVersion: async () => ({ version: "1.2.7" })
|
|
25419
25914
|
}
|
|
25420
25915
|
}];
|
|
25421
25916
|
}
|