@camstack/addon-post-analysis 1.2.6 → 1.2.8
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/{dist-DGkWhfba.mjs → dist-Bezh0l-m.js} +1870 -813
- package/dist/{dist-BvEJmXbR.js → dist-Dm1I_IVp.mjs} +1740 -1151
- package/dist/embedding-encoder/index.js +1 -1
- package/dist/embedding-encoder/index.mjs +1 -1
- package/dist/{node-CgyUW8_U.js → node-DsYWuKgE.js} +1 -1
- package/dist/pipeline-analytics/_stub.js +1 -1
- package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-BNg3APbG.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-DX9SlV1u.mjs} +2 -2
- package/dist/pipeline-analytics/{_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CDgDsFf_.mjs → _virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CbYZbG3H.mjs} +1 -1
- package/dist/pipeline-analytics/{hostInit-CZvb3wMv.mjs → hostInit-DQ6-5P8q.mjs} +2 -2
- package/dist/pipeline-analytics/index.js +11503 -7514
- package/dist/pipeline-analytics/index.mjs +11501 -7514
- package/dist/pipeline-analytics/remoteEntry.js +1 -1
- package/package.json +4 -1
|
@@ -1,4 +1,26 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
2
24
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
3
25
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4
26
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -148,9 +170,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
148
170
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
149
171
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
150
172
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
151
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
152
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
153
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
154
173
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
155
174
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
156
175
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -6815,7 +6834,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
|
6815
6834
|
patch: record(string(), unknown())
|
|
6816
6835
|
}), object({ success: literal(true) });
|
|
6817
6836
|
object({ deviceId: number() }), unknown().nullable();
|
|
6818
|
-
/** Shorthand to define a method schema */
|
|
6819
6837
|
function method(input, output, options) {
|
|
6820
6838
|
return {
|
|
6821
6839
|
input,
|
|
@@ -6823,6 +6841,7 @@ function method(input, output, options) {
|
|
|
6823
6841
|
kind: options?.kind ?? "query",
|
|
6824
6842
|
auth: options?.auth ?? "protected",
|
|
6825
6843
|
...options?.access !== void 0 ? { access: options.access } : {},
|
|
6844
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
6826
6845
|
timeoutMs: options?.timeoutMs
|
|
6827
6846
|
};
|
|
6828
6847
|
}
|
|
@@ -8280,6 +8299,61 @@ function subKindsOf(macro) {
|
|
|
8280
8299
|
return out;
|
|
8281
8300
|
}
|
|
8282
8301
|
/**
|
|
8302
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8303
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8304
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8305
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8306
|
+
*
|
|
8307
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8308
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8309
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8310
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8311
|
+
* the same class picker, grouped under an Audio header.
|
|
8312
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8313
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8314
|
+
*
|
|
8315
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8316
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8317
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8318
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8319
|
+
*/
|
|
8320
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8321
|
+
var NcTaxonomyEntrySchema = object({
|
|
8322
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8323
|
+
kind: string(),
|
|
8324
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8325
|
+
label: string(),
|
|
8326
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8327
|
+
parentKind: string().nullable()
|
|
8328
|
+
});
|
|
8329
|
+
/** The complete NC picker taxonomy — three grouped buckets. */
|
|
8330
|
+
var NcTaxonomySchema = object({
|
|
8331
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8332
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8333
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8334
|
+
});
|
|
8335
|
+
function toEntry(kind, label, parentKind) {
|
|
8336
|
+
return {
|
|
8337
|
+
kind,
|
|
8338
|
+
label,
|
|
8339
|
+
parentKind
|
|
8340
|
+
};
|
|
8341
|
+
}
|
|
8342
|
+
/**
|
|
8343
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8344
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8345
|
+
*/
|
|
8346
|
+
function buildNcTaxonomy() {
|
|
8347
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8348
|
+
return {
|
|
8349
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8350
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8351
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8352
|
+
};
|
|
8353
|
+
}
|
|
8354
|
+
/** The frozen NC taxonomy, derived once from the taxonomy dictionary. */
|
|
8355
|
+
var NC_TAXONOMY = Object.freeze(buildNcTaxonomy());
|
|
8356
|
+
/**
|
|
8283
8357
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8284
8358
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8285
8359
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -13721,94 +13795,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
13721
13795
|
bundleUrl: string()
|
|
13722
13796
|
});
|
|
13723
13797
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
13724
|
-
var NotificationRuleConditionsSchema = object({
|
|
13725
|
-
deviceIds: array(number()).readonly().optional(),
|
|
13726
|
-
classNames: array(string()).readonly().optional(),
|
|
13727
|
-
zoneIds: array(string()).readonly().optional(),
|
|
13728
|
-
minConfidence: number().optional(),
|
|
13729
|
-
source: _enum([
|
|
13730
|
-
"pipeline",
|
|
13731
|
-
"onboard",
|
|
13732
|
-
"any"
|
|
13733
|
-
]).optional(),
|
|
13734
|
-
schedule: object({
|
|
13735
|
-
days: array(number()).readonly(),
|
|
13736
|
-
startHour: number(),
|
|
13737
|
-
endHour: number()
|
|
13738
|
-
}).optional(),
|
|
13739
|
-
cooldownSeconds: number().optional(),
|
|
13740
|
-
minDwellSeconds: number().optional(),
|
|
13741
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
13742
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
13743
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
13744
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
13745
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
13746
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
13747
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
13748
|
-
clipDescription: object({
|
|
13749
|
-
text: string().min(1),
|
|
13750
|
-
minSimilarity: number().min(0).max(1)
|
|
13751
|
-
}).optional(),
|
|
13752
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
13753
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
13754
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
13755
|
-
* vehicle/person> is seen". */
|
|
13756
|
-
labels: array(string()).readonly().optional()
|
|
13757
|
-
});
|
|
13758
|
-
var NotificationRuleTemplateSchema = object({
|
|
13759
|
-
title: string(),
|
|
13760
|
-
body: string(),
|
|
13761
|
-
imageMode: _enum([
|
|
13762
|
-
"crop",
|
|
13763
|
-
"annotated",
|
|
13764
|
-
"full",
|
|
13765
|
-
"none"
|
|
13766
|
-
])
|
|
13767
|
-
});
|
|
13768
|
-
var NotificationRuleSchema = object({
|
|
13769
|
-
id: string(),
|
|
13770
|
-
name: string(),
|
|
13771
|
-
enabled: boolean(),
|
|
13772
|
-
eventTypes: array(string()).readonly(),
|
|
13773
|
-
conditions: NotificationRuleConditionsSchema,
|
|
13774
|
-
outputs: array(string()).readonly(),
|
|
13775
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
13776
|
-
priority: _enum([
|
|
13777
|
-
"low",
|
|
13778
|
-
"normal",
|
|
13779
|
-
"high",
|
|
13780
|
-
"critical"
|
|
13781
|
-
])
|
|
13782
|
-
});
|
|
13783
|
-
var NotificationTestResultSchema = object({
|
|
13784
|
-
ruleId: string(),
|
|
13785
|
-
eventId: string(),
|
|
13786
|
-
timestamp: number(),
|
|
13787
|
-
wouldFire: boolean(),
|
|
13788
|
-
reason: string().optional()
|
|
13789
|
-
});
|
|
13790
|
-
var NotificationHistoryEntrySchema = object({
|
|
13791
|
-
id: string(),
|
|
13792
|
-
ruleId: string(),
|
|
13793
|
-
ruleName: string(),
|
|
13794
|
-
eventId: string(),
|
|
13795
|
-
timestamp: number(),
|
|
13796
|
-
outputs: array(string()).readonly(),
|
|
13797
|
-
success: boolean(),
|
|
13798
|
-
error: string().optional(),
|
|
13799
|
-
deviceId: number().optional()
|
|
13800
|
-
});
|
|
13801
|
-
var NotificationHistoryFilterSchema = object({
|
|
13802
|
-
ruleId: string().optional(),
|
|
13803
|
-
deviceId: number().optional(),
|
|
13804
|
-
from: number().optional(),
|
|
13805
|
-
to: number().optional(),
|
|
13806
|
-
limit: number().optional()
|
|
13807
|
-
});
|
|
13808
|
-
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({
|
|
13809
|
-
ruleId: string(),
|
|
13810
|
-
lookbackMinutes: number()
|
|
13811
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
13812
13798
|
/**
|
|
13813
13799
|
* Alerts capability — collection-based internal alert system.
|
|
13814
13800
|
*
|
|
@@ -13995,89 +13981,6 @@ method(object({
|
|
|
13995
13981
|
password: string()
|
|
13996
13982
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
13997
13983
|
/**
|
|
13998
|
-
* `login-method` — collection cap through which auth addons contribute
|
|
13999
|
-
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
14000
|
-
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
14001
|
-
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
14002
|
-
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
14003
|
-
* procedure aggregates them for the unauthenticated login page.
|
|
14004
|
-
*
|
|
14005
|
-
* A contribution is a discriminated union on `kind`:
|
|
14006
|
-
*
|
|
14007
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
14008
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
14009
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
14010
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
14011
|
-
* login page needs NO change.
|
|
14012
|
-
*
|
|
14013
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
14014
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
14015
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
14016
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
14017
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
14018
|
-
*
|
|
14019
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
14020
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
14021
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
14022
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
14023
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
14024
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
14025
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
14026
|
-
* decision.
|
|
14027
|
-
*
|
|
14028
|
-
* Every contribution carries a `stage`:
|
|
14029
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
14030
|
-
* magic-link buttons; a future usernameless passkey).
|
|
14031
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
14032
|
-
* returned `factors` (passkey-as-2FA today).
|
|
14033
|
-
*
|
|
14034
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
14035
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
14036
|
-
* tRPC router.
|
|
14037
|
-
*/
|
|
14038
|
-
/** When a login method renders in the two-phase login flow. */
|
|
14039
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
14040
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
14041
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
14042
|
-
object({
|
|
14043
|
-
kind: literal("redirect"),
|
|
14044
|
-
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
14045
|
-
id: string(),
|
|
14046
|
-
/** Operator-facing button label. */
|
|
14047
|
-
label: string(),
|
|
14048
|
-
/** lucide-react icon name. */
|
|
14049
|
-
icon: string().optional(),
|
|
14050
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
14051
|
-
startUrl: string(),
|
|
14052
|
-
stage: LoginStageEnum
|
|
14053
|
-
}),
|
|
14054
|
-
object({
|
|
14055
|
-
kind: literal("widget"),
|
|
14056
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
14057
|
-
id: string(),
|
|
14058
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
14059
|
-
addonId: string(),
|
|
14060
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
14061
|
-
bundle: string(),
|
|
14062
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
14063
|
-
remote: WidgetRemoteSchema,
|
|
14064
|
-
stage: LoginStageEnum
|
|
14065
|
-
}),
|
|
14066
|
-
object({
|
|
14067
|
-
kind: literal("passkey"),
|
|
14068
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
14069
|
-
id: string(),
|
|
14070
|
-
/** Operator-facing button label. */
|
|
14071
|
-
label: string(),
|
|
14072
|
-
stage: LoginStageEnum,
|
|
14073
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
14074
|
-
rpId: string(),
|
|
14075
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
14076
|
-
origin: string().nullable()
|
|
14077
|
-
})
|
|
14078
|
-
]);
|
|
14079
|
-
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
14080
|
-
/**
|
|
14081
13984
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
14082
13985
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
14083
13986
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -14434,6 +14337,28 @@ method(ListInputSchema, array(BrokerInfoSchema$1)), method(GetInputSchema, Broke
|
|
|
14434
14337
|
}), method(GetStateInputSchema, unknown().nullable()), method(_void(), RegistryStatusSchema);
|
|
14435
14338
|
DeviceType.Camera;
|
|
14436
14339
|
/**
|
|
14340
|
+
* Identity — preserves literal types for downstream inference.
|
|
14341
|
+
*
|
|
14342
|
+
* The constraint is `Record<string, unknown>` (not `CustomActionsSpec`) so
|
|
14343
|
+
* TypeScript does not widen each entry's literal `kind`/`auth` fields to
|
|
14344
|
+
* the broader unions declared on `CustomActionSpec`'s default generics.
|
|
14345
|
+
* Shape validity is enforced separately by the `customAction(...)` helper
|
|
14346
|
+
* whose return type is already a `CustomActionSpec<...>`.
|
|
14347
|
+
*/
|
|
14348
|
+
function defineCustomActions(spec) {
|
|
14349
|
+
return spec;
|
|
14350
|
+
}
|
|
14351
|
+
function customAction(input, output, options) {
|
|
14352
|
+
return {
|
|
14353
|
+
input,
|
|
14354
|
+
output,
|
|
14355
|
+
kind: options?.kind ?? "query",
|
|
14356
|
+
auth: options?.auth ?? "protected",
|
|
14357
|
+
scope: options?.scope ?? { kind: "system" },
|
|
14358
|
+
...options?.caller ? { caller: "required" } : {}
|
|
14359
|
+
};
|
|
14360
|
+
}
|
|
14361
|
+
/**
|
|
14437
14362
|
* `custom-model-registry` — collection cap exposing operator-registered
|
|
14438
14363
|
* custom detection models. Each provider (today: `addon-model-studio`)
|
|
14439
14364
|
* contributes a list of `CustomModelDescriptor`s; the hub auto-concatenates
|
|
@@ -15431,242 +15356,617 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
15431
15356
|
kind: "mutation",
|
|
15432
15357
|
auth: "admin"
|
|
15433
15358
|
});
|
|
15434
|
-
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
|
|
15438
|
-
|
|
15359
|
+
/**
|
|
15360
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15361
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15362
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
15363
|
+
*
|
|
15364
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15365
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
15366
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15367
|
+
*/
|
|
15368
|
+
var LlmUsageSchema = object({
|
|
15369
|
+
inputTokens: number(),
|
|
15370
|
+
outputTokens: number()
|
|
15371
|
+
});
|
|
15372
|
+
var LlmErrorCodeSchema = _enum([
|
|
15373
|
+
"timeout",
|
|
15374
|
+
"rate-limited",
|
|
15375
|
+
"auth",
|
|
15376
|
+
"refusal",
|
|
15377
|
+
"bad-request",
|
|
15378
|
+
"unavailable",
|
|
15379
|
+
"no-profile",
|
|
15380
|
+
"budget-exceeded",
|
|
15381
|
+
"adapter-error"
|
|
15439
15382
|
]);
|
|
15440
|
-
var
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15383
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15384
|
+
ok: literal(true),
|
|
15385
|
+
text: string(),
|
|
15386
|
+
model: string(),
|
|
15387
|
+
usage: LlmUsageSchema,
|
|
15388
|
+
truncated: boolean(),
|
|
15389
|
+
latencyMs: number()
|
|
15390
|
+
}), object({
|
|
15391
|
+
ok: literal(false),
|
|
15392
|
+
code: LlmErrorCodeSchema,
|
|
15444
15393
|
message: string(),
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
}), array(LogEntrySchema).readonly());
|
|
15456
|
-
var CpuBreakdownSchema = object({
|
|
15457
|
-
total: number(),
|
|
15458
|
-
user: number(),
|
|
15459
|
-
system: number(),
|
|
15460
|
-
irq: number(),
|
|
15461
|
-
nice: number(),
|
|
15462
|
-
loadAvg: tuple([
|
|
15463
|
-
number(),
|
|
15464
|
-
number(),
|
|
15465
|
-
number()
|
|
15466
|
-
]),
|
|
15467
|
-
cores: number()
|
|
15394
|
+
retryAfterMs: number().optional()
|
|
15395
|
+
})]);
|
|
15396
|
+
/**
|
|
15397
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15398
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15399
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
15400
|
+
*/
|
|
15401
|
+
var LlmImageSchema = object({
|
|
15402
|
+
bytes: _instanceof(Uint8Array),
|
|
15403
|
+
mimeType: string()
|
|
15468
15404
|
});
|
|
15469
|
-
var
|
|
15470
|
-
|
|
15471
|
-
|
|
15472
|
-
|
|
15473
|
-
|
|
15474
|
-
|
|
15475
|
-
|
|
15405
|
+
var LlmGenerateBaseInputSchema = object({
|
|
15406
|
+
/** Collection routing (the notification-output posture). */
|
|
15407
|
+
addonId: string().optional(),
|
|
15408
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15409
|
+
profileId: string().optional(),
|
|
15410
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15411
|
+
consumer: string(),
|
|
15412
|
+
system: string().optional(),
|
|
15413
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15414
|
+
prompt: string(),
|
|
15415
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15416
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
15417
|
+
/** Per-call override of the profile default. */
|
|
15418
|
+
maxTokens: number().int().positive().optional(),
|
|
15419
|
+
temperature: number().optional()
|
|
15476
15420
|
});
|
|
15477
|
-
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
|
|
15481
|
-
|
|
15482
|
-
|
|
15483
|
-
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
});
|
|
15493
|
-
var MetricsGpuInfoSchema = object({
|
|
15494
|
-
utilization: number(),
|
|
15495
|
-
model: string(),
|
|
15496
|
-
memoryUsedBytes: number(),
|
|
15497
|
-
memoryTotalBytes: number(),
|
|
15498
|
-
temperature: number().nullable()
|
|
15499
|
-
});
|
|
15500
|
-
var ProcessResourceInfoSchema = object({
|
|
15501
|
-
openFds: number(),
|
|
15502
|
-
threadCount: number(),
|
|
15503
|
-
activeHandles: number(),
|
|
15504
|
-
activeRequests: number()
|
|
15505
|
-
});
|
|
15506
|
-
var PressureAvgsSchema = object({
|
|
15507
|
-
avg10: number(),
|
|
15508
|
-
avg60: number(),
|
|
15509
|
-
avg300: number()
|
|
15510
|
-
});
|
|
15511
|
-
var PressureInfoSchema = object({
|
|
15512
|
-
some: PressureAvgsSchema,
|
|
15513
|
-
full: PressureAvgsSchema.nullable()
|
|
15514
|
-
});
|
|
15515
|
-
var SystemResourceSnapshotSchema = object({
|
|
15516
|
-
cpu: CpuBreakdownSchema,
|
|
15517
|
-
memory: MemoryInfoSchema,
|
|
15518
|
-
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15519
|
-
network: NetworkIoSnapshotSchema,
|
|
15520
|
-
disk: DiskIoSnapshotSchema,
|
|
15521
|
-
pressure: object({
|
|
15522
|
-
cpu: PressureInfoSchema.nullable(),
|
|
15523
|
-
memory: PressureInfoSchema.nullable(),
|
|
15524
|
-
io: PressureInfoSchema.nullable()
|
|
15421
|
+
/**
|
|
15422
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15423
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15424
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15425
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15426
|
+
* this only through the `llm` cap's methods.
|
|
15427
|
+
*
|
|
15428
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15429
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15430
|
+
* watchdog — operator decision #3).
|
|
15431
|
+
*/
|
|
15432
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15433
|
+
object({
|
|
15434
|
+
kind: literal("catalog"),
|
|
15435
|
+
catalogId: string()
|
|
15525
15436
|
}),
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
*/
|
|
15548
|
-
|
|
15549
|
-
/**
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
sharedBytes: number().optional()
|
|
15437
|
+
object({
|
|
15438
|
+
kind: literal("url"),
|
|
15439
|
+
url: string(),
|
|
15440
|
+
sha256: string().optional()
|
|
15441
|
+
}),
|
|
15442
|
+
object({
|
|
15443
|
+
kind: literal("path"),
|
|
15444
|
+
path: string()
|
|
15445
|
+
})
|
|
15446
|
+
]);
|
|
15447
|
+
var ManagedRuntimeConfigSchema = object({
|
|
15448
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
15449
|
+
nodeId: string(),
|
|
15450
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15451
|
+
engine: _enum(["llama-cpp"]),
|
|
15452
|
+
model: ManagedModelRefSchema,
|
|
15453
|
+
contextSize: number().int().default(4096),
|
|
15454
|
+
/** 0 = CPU-only. */
|
|
15455
|
+
gpuLayers: number().int().default(0),
|
|
15456
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15457
|
+
threads: number().int().optional(),
|
|
15458
|
+
/** Concurrent slots. */
|
|
15459
|
+
parallel: number().int().default(1),
|
|
15460
|
+
/** Else lazy: first generate boots it. */
|
|
15461
|
+
autoStart: boolean().default(false),
|
|
15462
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
15463
|
+
idleStopMinutes: number().int().default(30)
|
|
15554
15464
|
});
|
|
15555
|
-
var
|
|
15556
|
-
|
|
15465
|
+
var LlmRuntimeStatusSchema = object({
|
|
15466
|
+
/** Status is ALWAYS node-qualified. */
|
|
15557
15467
|
nodeId: string(),
|
|
15558
|
-
role: _enum(["hub", "worker"]),
|
|
15559
|
-
pid: number(),
|
|
15560
15468
|
state: _enum([
|
|
15561
|
-
"starting",
|
|
15562
|
-
"running",
|
|
15563
|
-
"stopping",
|
|
15564
15469
|
"stopped",
|
|
15565
|
-
"
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
pid: number(),
|
|
15571
|
-
ppid: number(),
|
|
15572
|
-
pgid: number(),
|
|
15573
|
-
classification: _enum([
|
|
15574
|
-
"root",
|
|
15575
|
-
"managed",
|
|
15576
|
-
"system",
|
|
15577
|
-
"ghost"
|
|
15470
|
+
"downloading",
|
|
15471
|
+
"starting",
|
|
15472
|
+
"ready",
|
|
15473
|
+
"crashed",
|
|
15474
|
+
"failed"
|
|
15578
15475
|
]),
|
|
15579
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
15580
|
-
addonId: string().nullable(),
|
|
15581
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15582
|
-
nodeId: string().nullable(),
|
|
15583
|
-
/** Truncated command line. */
|
|
15584
|
-
command: string(),
|
|
15585
|
-
cpuPercent: number(),
|
|
15586
|
-
memoryRssBytes: number(),
|
|
15587
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15588
|
-
uptimeSec: number(),
|
|
15589
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15590
|
-
orphaned: boolean()
|
|
15591
|
-
});
|
|
15592
|
-
var KillProcessInputSchema = object({
|
|
15593
|
-
pid: number(),
|
|
15594
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15595
|
-
force: boolean().optional()
|
|
15596
|
-
});
|
|
15597
|
-
var KillProcessResultSchema = object({
|
|
15598
|
-
success: boolean(),
|
|
15599
|
-
reason: string().optional(),
|
|
15600
|
-
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15601
|
-
});
|
|
15602
|
-
var DumpHeapSnapshotInputSchema = object({
|
|
15603
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
15604
|
-
addonId: string() });
|
|
15605
|
-
var DumpHeapSnapshotResultSchema = object({
|
|
15606
|
-
success: boolean(),
|
|
15607
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15608
|
-
path: string().optional(),
|
|
15609
|
-
/** Process pid that was signalled. */
|
|
15610
15476
|
pid: number().optional(),
|
|
15611
|
-
|
|
15477
|
+
port: number().optional(),
|
|
15478
|
+
modelPath: string().optional(),
|
|
15479
|
+
modelId: string().optional(),
|
|
15480
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
15481
|
+
lastError: string().optional(),
|
|
15482
|
+
crashesInWindow: number(),
|
|
15483
|
+
/** Child RSS (sampled best-effort). */
|
|
15484
|
+
memoryBytes: number().optional(),
|
|
15485
|
+
vramBytes: number().optional()
|
|
15612
15486
|
});
|
|
15613
|
-
var
|
|
15614
|
-
|
|
15615
|
-
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
diskPercent: number().optional(),
|
|
15619
|
-
temperature: number().optional(),
|
|
15620
|
-
gpuPercent: number().optional(),
|
|
15621
|
-
gpuMemoryPercent: number().optional()
|
|
15487
|
+
var LlmNodeModelSchema = object({
|
|
15488
|
+
file: string(),
|
|
15489
|
+
sizeBytes: number(),
|
|
15490
|
+
catalogId: string().optional(),
|
|
15491
|
+
installedAt: number().optional()
|
|
15622
15492
|
});
|
|
15623
|
-
|
|
15493
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
15494
|
+
nodeId: string(),
|
|
15495
|
+
modelsBytes: number(),
|
|
15496
|
+
freeBytes: number().optional()
|
|
15497
|
+
});
|
|
15498
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
15499
|
+
images: array(LlmImageSchema).optional(),
|
|
15500
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
15501
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15502
|
+
timeoutMs: number().int().positive().optional()
|
|
15503
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15624
15504
|
kind: "mutation",
|
|
15625
15505
|
auth: "admin"
|
|
15626
|
-
}), method(
|
|
15506
|
+
}), method(object({}), _void(), {
|
|
15627
15507
|
kind: "mutation",
|
|
15628
15508
|
auth: "admin"
|
|
15629
|
-
})
|
|
15630
|
-
method(object({
|
|
15631
|
-
sourceUrl: string(),
|
|
15632
|
-
metadata: ModelConvertMetadataSchema,
|
|
15633
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15634
|
-
calibrationRef: string().optional(),
|
|
15635
|
-
sessionId: string().optional()
|
|
15636
|
-
}), ConvertResultSchema, {
|
|
15509
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15637
15510
|
kind: "mutation",
|
|
15638
|
-
auth: "admin"
|
|
15639
|
-
|
|
15640
|
-
});
|
|
15641
|
-
method(object({
|
|
15642
|
-
nodeId: string(),
|
|
15643
|
-
modelId: string(),
|
|
15644
|
-
format: _enum(MODEL_FORMATS),
|
|
15645
|
-
entry: ModelCatalogEntrySchema
|
|
15646
|
-
}), object({
|
|
15647
|
-
ok: boolean(),
|
|
15648
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15649
|
-
sha256: string(),
|
|
15650
|
-
bytes: number(),
|
|
15651
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15652
|
-
path: string()
|
|
15653
|
-
}), {
|
|
15511
|
+
auth: "admin"
|
|
15512
|
+
}), method(object({ file: string() }), _void(), {
|
|
15654
15513
|
kind: "mutation",
|
|
15655
15514
|
auth: "admin"
|
|
15656
|
-
});
|
|
15515
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15657
15516
|
/**
|
|
15658
|
-
* `
|
|
15659
|
-
*
|
|
15660
|
-
*
|
|
15661
|
-
*
|
|
15662
|
-
*
|
|
15663
|
-
* its OWN `mqtt.js` client.
|
|
15517
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
15518
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
15519
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
15520
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15521
|
+
* (hub-placed); the cap stays open for future providers.
|
|
15664
15522
|
*
|
|
15665
|
-
*
|
|
15666
|
-
*
|
|
15667
|
-
*
|
|
15668
|
-
|
|
15669
|
-
|
|
15523
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15524
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15525
|
+
* write; a stored key NEVER round-trips to a client.
|
|
15526
|
+
*/
|
|
15527
|
+
var LlmProfileKindSchema = _enum([
|
|
15528
|
+
"openai-compatible",
|
|
15529
|
+
"openai",
|
|
15530
|
+
"anthropic",
|
|
15531
|
+
"google",
|
|
15532
|
+
"managed-local"
|
|
15533
|
+
]);
|
|
15534
|
+
var LlmProfileSchema = object({
|
|
15535
|
+
id: string(),
|
|
15536
|
+
name: string(),
|
|
15537
|
+
kind: LlmProfileKindSchema,
|
|
15538
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
15539
|
+
addonId: string(),
|
|
15540
|
+
enabled: boolean(),
|
|
15541
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
15542
|
+
model: string(),
|
|
15543
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
15544
|
+
baseUrl: string().optional(),
|
|
15545
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
15546
|
+
apiKey: string().optional(),
|
|
15547
|
+
supportsVision: boolean(),
|
|
15548
|
+
temperature: number().min(0).max(2).optional(),
|
|
15549
|
+
maxTokens: number().int().positive().optional(),
|
|
15550
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
15551
|
+
extraHeaders: record(string(), string()).optional(),
|
|
15552
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
15553
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15554
|
+
});
|
|
15555
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
15556
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
15557
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
15558
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
15559
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
15560
|
+
kind: LlmProfileKindSchema,
|
|
15561
|
+
label: string(),
|
|
15562
|
+
icon: string(),
|
|
15563
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15564
|
+
addonId: string(),
|
|
15565
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
15566
|
+
});
|
|
15567
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
15568
|
+
var LlmDefaultSchema = object({
|
|
15569
|
+
selector: LlmDefaultSelectorSchema,
|
|
15570
|
+
profileId: string()
|
|
15571
|
+
});
|
|
15572
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
15573
|
+
var LlmUsageRollupSchema = object({
|
|
15574
|
+
day: string(),
|
|
15575
|
+
consumer: string(),
|
|
15576
|
+
profileId: string(),
|
|
15577
|
+
calls: number(),
|
|
15578
|
+
okCalls: number(),
|
|
15579
|
+
errorCalls: number(),
|
|
15580
|
+
inputTokens: number(),
|
|
15581
|
+
outputTokens: number(),
|
|
15582
|
+
avgLatencyMs: number()
|
|
15583
|
+
});
|
|
15584
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
15585
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
15586
|
+
id: string(),
|
|
15587
|
+
label: string(),
|
|
15588
|
+
family: string(),
|
|
15589
|
+
purpose: _enum(["text", "vision"]),
|
|
15590
|
+
url: string(),
|
|
15591
|
+
sha256: string(),
|
|
15592
|
+
sizeBytes: number(),
|
|
15593
|
+
quantization: string(),
|
|
15594
|
+
/** Load-time guidance shown in the picker. */
|
|
15595
|
+
minRamBytes: number(),
|
|
15596
|
+
contextSizeDefault: number().int(),
|
|
15597
|
+
/** Vision models: companion projector file. */
|
|
15598
|
+
mmprojUrl: string().optional()
|
|
15599
|
+
});
|
|
15600
|
+
var LlmRuntimeNodeSchema = object({
|
|
15601
|
+
nodeId: string(),
|
|
15602
|
+
reachable: boolean(),
|
|
15603
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
15604
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15605
|
+
error: string().optional()
|
|
15606
|
+
});
|
|
15607
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
15608
|
+
var ProfileRefInputSchema = object({
|
|
15609
|
+
addonId: string(),
|
|
15610
|
+
profileId: string()
|
|
15611
|
+
});
|
|
15612
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
15613
|
+
kind: "mutation",
|
|
15614
|
+
auth: "admin"
|
|
15615
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
15616
|
+
kind: "mutation",
|
|
15617
|
+
auth: "admin"
|
|
15618
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
15619
|
+
kind: "mutation",
|
|
15620
|
+
auth: "admin"
|
|
15621
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
15622
|
+
selector: LlmDefaultSelectorSchema,
|
|
15623
|
+
profileId: string().nullable()
|
|
15624
|
+
}), _void(), {
|
|
15625
|
+
kind: "mutation",
|
|
15626
|
+
auth: "admin"
|
|
15627
|
+
}), method(object({
|
|
15628
|
+
since: number().optional(),
|
|
15629
|
+
until: number().optional(),
|
|
15630
|
+
consumer: string().optional(),
|
|
15631
|
+
profileId: string().optional()
|
|
15632
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
15633
|
+
nodeId: string(),
|
|
15634
|
+
model: ManagedModelRefSchema
|
|
15635
|
+
}), _void(), {
|
|
15636
|
+
kind: "mutation",
|
|
15637
|
+
auth: "admin"
|
|
15638
|
+
}), method(object({
|
|
15639
|
+
nodeId: string(),
|
|
15640
|
+
file: string()
|
|
15641
|
+
}), _void(), {
|
|
15642
|
+
kind: "mutation",
|
|
15643
|
+
auth: "admin"
|
|
15644
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
15645
|
+
kind: "mutation",
|
|
15646
|
+
auth: "admin"
|
|
15647
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
15648
|
+
kind: "mutation",
|
|
15649
|
+
auth: "admin"
|
|
15650
|
+
});
|
|
15651
|
+
var LogLevelSchema = _enum([
|
|
15652
|
+
"debug",
|
|
15653
|
+
"info",
|
|
15654
|
+
"warn",
|
|
15655
|
+
"error"
|
|
15656
|
+
]);
|
|
15657
|
+
var LogEntrySchema = object({
|
|
15658
|
+
timestamp: date(),
|
|
15659
|
+
level: LogLevelSchema,
|
|
15660
|
+
scope: array(string()),
|
|
15661
|
+
message: string(),
|
|
15662
|
+
meta: record(string(), unknown()).optional(),
|
|
15663
|
+
tags: record(string(), string()).optional()
|
|
15664
|
+
});
|
|
15665
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
15666
|
+
scope: array(string()).optional(),
|
|
15667
|
+
level: LogLevelSchema.optional(),
|
|
15668
|
+
since: date().optional(),
|
|
15669
|
+
until: date().optional(),
|
|
15670
|
+
limit: number().optional(),
|
|
15671
|
+
tags: record(string(), string()).optional()
|
|
15672
|
+
}), array(LogEntrySchema).readonly());
|
|
15673
|
+
/**
|
|
15674
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
15675
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
15676
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
15677
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
15678
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
15679
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
15680
|
+
*
|
|
15681
|
+
* A contribution is a discriminated union on `kind`:
|
|
15682
|
+
*
|
|
15683
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
15684
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
15685
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
15686
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
15687
|
+
* login page needs NO change.
|
|
15688
|
+
*
|
|
15689
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
15690
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
15691
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
15692
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
15693
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
15694
|
+
*
|
|
15695
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
15696
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
15697
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
15698
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
15699
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
15700
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
15701
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
15702
|
+
* decision.
|
|
15703
|
+
*
|
|
15704
|
+
* Every contribution carries a `stage`:
|
|
15705
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
15706
|
+
* magic-link buttons; a future usernameless passkey).
|
|
15707
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
15708
|
+
* returned `factors` (passkey-as-2FA today).
|
|
15709
|
+
*
|
|
15710
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
15711
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
15712
|
+
* tRPC router.
|
|
15713
|
+
*/
|
|
15714
|
+
/** When a login method renders in the two-phase login flow. */
|
|
15715
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
15716
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
15717
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
15718
|
+
object({
|
|
15719
|
+
kind: literal("redirect"),
|
|
15720
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
15721
|
+
id: string(),
|
|
15722
|
+
/** Operator-facing button label. */
|
|
15723
|
+
label: string(),
|
|
15724
|
+
/** lucide-react icon name. */
|
|
15725
|
+
icon: string().optional(),
|
|
15726
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
15727
|
+
startUrl: string(),
|
|
15728
|
+
stage: LoginStageEnum
|
|
15729
|
+
}),
|
|
15730
|
+
object({
|
|
15731
|
+
kind: literal("widget"),
|
|
15732
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
15733
|
+
id: string(),
|
|
15734
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
15735
|
+
addonId: string(),
|
|
15736
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
15737
|
+
bundle: string(),
|
|
15738
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
15739
|
+
remote: WidgetRemoteSchema,
|
|
15740
|
+
stage: LoginStageEnum
|
|
15741
|
+
}),
|
|
15742
|
+
object({
|
|
15743
|
+
kind: literal("passkey"),
|
|
15744
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
15745
|
+
id: string(),
|
|
15746
|
+
/** Operator-facing button label. */
|
|
15747
|
+
label: string(),
|
|
15748
|
+
stage: LoginStageEnum,
|
|
15749
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
15750
|
+
rpId: string(),
|
|
15751
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
15752
|
+
origin: string().nullable()
|
|
15753
|
+
})
|
|
15754
|
+
]);
|
|
15755
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
15756
|
+
var CpuBreakdownSchema = object({
|
|
15757
|
+
total: number(),
|
|
15758
|
+
user: number(),
|
|
15759
|
+
system: number(),
|
|
15760
|
+
irq: number(),
|
|
15761
|
+
nice: number(),
|
|
15762
|
+
loadAvg: tuple([
|
|
15763
|
+
number(),
|
|
15764
|
+
number(),
|
|
15765
|
+
number()
|
|
15766
|
+
]),
|
|
15767
|
+
cores: number()
|
|
15768
|
+
});
|
|
15769
|
+
var MemoryInfoSchema = object({
|
|
15770
|
+
percent: number(),
|
|
15771
|
+
totalBytes: number(),
|
|
15772
|
+
usedBytes: number(),
|
|
15773
|
+
availableBytes: number(),
|
|
15774
|
+
swapUsedBytes: number(),
|
|
15775
|
+
swapTotalBytes: number()
|
|
15776
|
+
});
|
|
15777
|
+
var DiskIoSnapshotSchema = object({
|
|
15778
|
+
readBytes: number(),
|
|
15779
|
+
writeBytes: number(),
|
|
15780
|
+
readOps: number(),
|
|
15781
|
+
writeOps: number(),
|
|
15782
|
+
timestampMs: number()
|
|
15783
|
+
});
|
|
15784
|
+
var NetworkIoSnapshotSchema = object({
|
|
15785
|
+
rxBytes: number(),
|
|
15786
|
+
txBytes: number(),
|
|
15787
|
+
rxPackets: number(),
|
|
15788
|
+
txPackets: number(),
|
|
15789
|
+
rxErrors: number(),
|
|
15790
|
+
txErrors: number(),
|
|
15791
|
+
timestampMs: number()
|
|
15792
|
+
});
|
|
15793
|
+
var MetricsGpuInfoSchema = object({
|
|
15794
|
+
utilization: number(),
|
|
15795
|
+
model: string(),
|
|
15796
|
+
memoryUsedBytes: number(),
|
|
15797
|
+
memoryTotalBytes: number(),
|
|
15798
|
+
temperature: number().nullable()
|
|
15799
|
+
});
|
|
15800
|
+
var ProcessResourceInfoSchema = object({
|
|
15801
|
+
openFds: number(),
|
|
15802
|
+
threadCount: number(),
|
|
15803
|
+
activeHandles: number(),
|
|
15804
|
+
activeRequests: number()
|
|
15805
|
+
});
|
|
15806
|
+
var PressureAvgsSchema = object({
|
|
15807
|
+
avg10: number(),
|
|
15808
|
+
avg60: number(),
|
|
15809
|
+
avg300: number()
|
|
15810
|
+
});
|
|
15811
|
+
var PressureInfoSchema = object({
|
|
15812
|
+
some: PressureAvgsSchema,
|
|
15813
|
+
full: PressureAvgsSchema.nullable()
|
|
15814
|
+
});
|
|
15815
|
+
var SystemResourceSnapshotSchema = object({
|
|
15816
|
+
cpu: CpuBreakdownSchema,
|
|
15817
|
+
memory: MemoryInfoSchema,
|
|
15818
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15819
|
+
network: NetworkIoSnapshotSchema,
|
|
15820
|
+
disk: DiskIoSnapshotSchema,
|
|
15821
|
+
pressure: object({
|
|
15822
|
+
cpu: PressureInfoSchema.nullable(),
|
|
15823
|
+
memory: PressureInfoSchema.nullable(),
|
|
15824
|
+
io: PressureInfoSchema.nullable()
|
|
15825
|
+
}),
|
|
15826
|
+
process: ProcessResourceInfoSchema,
|
|
15827
|
+
cpuTemperature: number().nullable(),
|
|
15828
|
+
timestampMs: number()
|
|
15829
|
+
});
|
|
15830
|
+
var DiskSpaceInfoSchema = object({
|
|
15831
|
+
path: string(),
|
|
15832
|
+
totalBytes: number(),
|
|
15833
|
+
usedBytes: number(),
|
|
15834
|
+
availableBytes: number(),
|
|
15835
|
+
percent: number()
|
|
15836
|
+
});
|
|
15837
|
+
var PidResourceStatsSchema = object({
|
|
15838
|
+
pid: number(),
|
|
15839
|
+
cpu: number(),
|
|
15840
|
+
memory: number(),
|
|
15841
|
+
/**
|
|
15842
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
15843
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
15844
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
15845
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
15846
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
15847
|
+
*/
|
|
15848
|
+
privateBytes: number().optional(),
|
|
15849
|
+
/**
|
|
15850
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
15851
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
15852
|
+
*/
|
|
15853
|
+
sharedBytes: number().optional()
|
|
15854
|
+
});
|
|
15855
|
+
var AddonInstanceSchema = object({
|
|
15856
|
+
addonId: string(),
|
|
15857
|
+
nodeId: string(),
|
|
15858
|
+
role: _enum(["hub", "worker"]),
|
|
15859
|
+
pid: number(),
|
|
15860
|
+
state: _enum([
|
|
15861
|
+
"starting",
|
|
15862
|
+
"running",
|
|
15863
|
+
"stopping",
|
|
15864
|
+
"stopped",
|
|
15865
|
+
"crashed"
|
|
15866
|
+
]),
|
|
15867
|
+
uptimeSec: number()
|
|
15868
|
+
});
|
|
15869
|
+
var NodeProcessSchema = object({
|
|
15870
|
+
pid: number(),
|
|
15871
|
+
ppid: number(),
|
|
15872
|
+
pgid: number(),
|
|
15873
|
+
classification: _enum([
|
|
15874
|
+
"root",
|
|
15875
|
+
"managed",
|
|
15876
|
+
"system",
|
|
15877
|
+
"ghost"
|
|
15878
|
+
]),
|
|
15879
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
15880
|
+
addonId: string().nullable(),
|
|
15881
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15882
|
+
nodeId: string().nullable(),
|
|
15883
|
+
/** Truncated command line. */
|
|
15884
|
+
command: string(),
|
|
15885
|
+
cpuPercent: number(),
|
|
15886
|
+
memoryRssBytes: number(),
|
|
15887
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15888
|
+
uptimeSec: number(),
|
|
15889
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15890
|
+
orphaned: boolean()
|
|
15891
|
+
});
|
|
15892
|
+
var KillProcessInputSchema = object({
|
|
15893
|
+
pid: number(),
|
|
15894
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15895
|
+
force: boolean().optional()
|
|
15896
|
+
});
|
|
15897
|
+
var KillProcessResultSchema = object({
|
|
15898
|
+
success: boolean(),
|
|
15899
|
+
reason: string().optional(),
|
|
15900
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15901
|
+
});
|
|
15902
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
15903
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
15904
|
+
addonId: string() });
|
|
15905
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
15906
|
+
success: boolean(),
|
|
15907
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15908
|
+
path: string().optional(),
|
|
15909
|
+
/** Process pid that was signalled. */
|
|
15910
|
+
pid: number().optional(),
|
|
15911
|
+
reason: string().optional()
|
|
15912
|
+
});
|
|
15913
|
+
var SystemMetricsSchema = object({
|
|
15914
|
+
cpuPercent: number(),
|
|
15915
|
+
memoryPercent: number(),
|
|
15916
|
+
memoryUsedMB: number(),
|
|
15917
|
+
memoryTotalMB: number(),
|
|
15918
|
+
diskPercent: number().optional(),
|
|
15919
|
+
temperature: number().optional(),
|
|
15920
|
+
gpuPercent: number().optional(),
|
|
15921
|
+
gpuMemoryPercent: number().optional()
|
|
15922
|
+
});
|
|
15923
|
+
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, {
|
|
15924
|
+
kind: "mutation",
|
|
15925
|
+
auth: "admin"
|
|
15926
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
15927
|
+
kind: "mutation",
|
|
15928
|
+
auth: "admin"
|
|
15929
|
+
});
|
|
15930
|
+
method(object({
|
|
15931
|
+
sourceUrl: string(),
|
|
15932
|
+
metadata: ModelConvertMetadataSchema,
|
|
15933
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15934
|
+
calibrationRef: string().optional(),
|
|
15935
|
+
sessionId: string().optional()
|
|
15936
|
+
}), ConvertResultSchema, {
|
|
15937
|
+
kind: "mutation",
|
|
15938
|
+
auth: "admin",
|
|
15939
|
+
timeoutMs: 6e5
|
|
15940
|
+
});
|
|
15941
|
+
method(object({
|
|
15942
|
+
nodeId: string(),
|
|
15943
|
+
modelId: string(),
|
|
15944
|
+
format: _enum(MODEL_FORMATS),
|
|
15945
|
+
entry: ModelCatalogEntrySchema
|
|
15946
|
+
}), object({
|
|
15947
|
+
ok: boolean(),
|
|
15948
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15949
|
+
sha256: string(),
|
|
15950
|
+
bytes: number(),
|
|
15951
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
15952
|
+
path: string()
|
|
15953
|
+
}), {
|
|
15954
|
+
kind: "mutation",
|
|
15955
|
+
auth: "admin"
|
|
15956
|
+
});
|
|
15957
|
+
/**
|
|
15958
|
+
* `mqtt-broker` — broker-registry cap.
|
|
15959
|
+
*
|
|
15960
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15961
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15962
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
15963
|
+
* its OWN `mqtt.js` client.
|
|
15964
|
+
*
|
|
15965
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15966
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15967
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
15968
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15969
|
+
* features anyway — give it the connection config, get out of the way.
|
|
15670
15970
|
*
|
|
15671
15971
|
* Consumer flow:
|
|
15672
15972
|
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
@@ -15925,14 +16225,14 @@ var TargetKindCapsSchema = object({
|
|
|
15925
16225
|
* the union is large and not meant for runtime validation here; the exported
|
|
15926
16226
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
15927
16227
|
*/
|
|
15928
|
-
var ConfigSchemaPassthrough
|
|
16228
|
+
var ConfigSchemaPassthrough = unknown();
|
|
15929
16229
|
var TargetKindSchema = object({
|
|
15930
16230
|
kind: string(),
|
|
15931
16231
|
label: string(),
|
|
15932
16232
|
icon: string(),
|
|
15933
16233
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15934
16234
|
addonId: string(),
|
|
15935
|
-
configSchema: ConfigSchemaPassthrough
|
|
16235
|
+
configSchema: ConfigSchemaPassthrough,
|
|
15936
16236
|
supportsDiscovery: boolean(),
|
|
15937
16237
|
caps: TargetKindCapsSchema
|
|
15938
16238
|
});
|
|
@@ -15980,302 +16280,769 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
15980
16280
|
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
15981
16281
|
targetId: string(),
|
|
15982
16282
|
sample: NotificationSchema.optional()
|
|
15983
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
15984
|
-
targetId: string(),
|
|
15985
|
-
enabled: boolean()
|
|
15986
|
-
}), _void(), { kind: "mutation" });
|
|
15987
|
-
/**
|
|
15988
|
-
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15989
|
-
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15990
|
-
* caps stay wire-compatible without a circular cap→cap import.
|
|
15991
|
-
*
|
|
15992
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15993
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
15994
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15995
|
-
*/
|
|
15996
|
-
var LlmUsageSchema = object({
|
|
15997
|
-
inputTokens: number(),
|
|
15998
|
-
outputTokens: number()
|
|
15999
|
-
});
|
|
16000
|
-
var LlmErrorCodeSchema = _enum([
|
|
16001
|
-
"timeout",
|
|
16002
|
-
"rate-limited",
|
|
16003
|
-
"auth",
|
|
16004
|
-
"refusal",
|
|
16005
|
-
"bad-request",
|
|
16006
|
-
"unavailable",
|
|
16007
|
-
"no-profile",
|
|
16008
|
-
"budget-exceeded",
|
|
16009
|
-
"adapter-error"
|
|
16010
|
-
]);
|
|
16011
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
16012
|
-
ok: literal(true),
|
|
16013
|
-
text: string(),
|
|
16014
|
-
model: string(),
|
|
16015
|
-
usage: LlmUsageSchema,
|
|
16016
|
-
truncated: boolean(),
|
|
16017
|
-
latencyMs: number()
|
|
16018
|
-
}), object({
|
|
16019
|
-
ok: literal(false),
|
|
16020
|
-
code: LlmErrorCodeSchema,
|
|
16021
|
-
message: string(),
|
|
16022
|
-
retryAfterMs: number().optional()
|
|
16023
|
-
})]);
|
|
16283
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16284
|
+
targetId: string(),
|
|
16285
|
+
enabled: boolean()
|
|
16286
|
+
}), _void(), { kind: "mutation" });
|
|
16024
16287
|
/**
|
|
16025
|
-
*
|
|
16026
|
-
*
|
|
16027
|
-
* notification-
|
|
16288
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
16289
|
+
*
|
|
16290
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
16291
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
16292
|
+
*
|
|
16293
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
16294
|
+
* `notification-center` module), hooked on the durable persistence
|
|
16295
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
16296
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
16297
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
16298
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
16299
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
16300
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
16301
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
16302
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
16303
|
+
* target kind's own caps/degrade engine).
|
|
16304
|
+
*
|
|
16305
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
16306
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
16307
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
16308
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
16309
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
16310
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
16311
|
+
* P2+ (see spec §7).
|
|
16312
|
+
*
|
|
16313
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
16314
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
16315
|
+
* schema/interface drift is explicitly not repeated).
|
|
16028
16316
|
*/
|
|
16029
|
-
var LlmImageSchema = object({
|
|
16030
|
-
bytes: _instanceof(Uint8Array),
|
|
16031
|
-
mimeType: string()
|
|
16032
|
-
});
|
|
16033
|
-
var LlmGenerateBaseInputSchema = object({
|
|
16034
|
-
/** Collection routing (the notification-output posture). */
|
|
16035
|
-
addonId: string().optional(),
|
|
16036
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
16037
|
-
profileId: string().optional(),
|
|
16038
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
16039
|
-
consumer: string(),
|
|
16040
|
-
system: string().optional(),
|
|
16041
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
16042
|
-
prompt: string(),
|
|
16043
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
16044
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
16045
|
-
/** Per-call override of the profile default. */
|
|
16046
|
-
maxTokens: number().int().positive().optional(),
|
|
16047
|
-
temperature: number().optional()
|
|
16048
|
-
});
|
|
16049
16317
|
/**
|
|
16050
|
-
*
|
|
16051
|
-
*
|
|
16052
|
-
*
|
|
16053
|
-
*
|
|
16054
|
-
*
|
|
16318
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
16319
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
16320
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
16321
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
16322
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
16323
|
+
* change of a LINKED device, one row per linked camera)
|
|
16324
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
16325
|
+
* delivery / pick-up)
|
|
16055
16326
|
*
|
|
16056
|
-
*
|
|
16057
|
-
*
|
|
16058
|
-
*
|
|
16327
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
16328
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
16329
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
16330
|
+
* one trigger.
|
|
16059
16331
|
*/
|
|
16060
|
-
var
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
|
|
16065
|
-
object({
|
|
16066
|
-
kind: literal("url"),
|
|
16067
|
-
url: string(),
|
|
16068
|
-
sha256: string().optional()
|
|
16069
|
-
}),
|
|
16070
|
-
object({
|
|
16071
|
-
kind: literal("path"),
|
|
16072
|
-
path: string()
|
|
16073
|
-
})
|
|
16332
|
+
var NcDeliverySchema = _enum([
|
|
16333
|
+
"immediate",
|
|
16334
|
+
"track-end",
|
|
16335
|
+
"device-event",
|
|
16336
|
+
"package-event"
|
|
16074
16337
|
]);
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
|
|
16078
|
-
|
|
16079
|
-
|
|
16080
|
-
|
|
16081
|
-
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
|
|
16087
|
-
parallel: number().int().default(1),
|
|
16088
|
-
/** Else lazy: first generate boots it. */
|
|
16089
|
-
autoStart: boolean().default(false),
|
|
16090
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
16091
|
-
idleStopMinutes: number().int().default(30)
|
|
16092
|
-
});
|
|
16093
|
-
var LlmRuntimeStatusSchema = object({
|
|
16094
|
-
/** Status is ALWAYS node-qualified. */
|
|
16095
|
-
nodeId: string(),
|
|
16096
|
-
state: _enum([
|
|
16097
|
-
"stopped",
|
|
16098
|
-
"downloading",
|
|
16099
|
-
"starting",
|
|
16100
|
-
"ready",
|
|
16101
|
-
"crashed",
|
|
16102
|
-
"failed"
|
|
16103
|
-
]),
|
|
16104
|
-
pid: number().optional(),
|
|
16105
|
-
port: number().optional(),
|
|
16106
|
-
modelPath: string().optional(),
|
|
16107
|
-
modelId: string().optional(),
|
|
16108
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
16109
|
-
lastError: string().optional(),
|
|
16110
|
-
crashesInWindow: number(),
|
|
16111
|
-
/** Child RSS (sampled best-effort). */
|
|
16112
|
-
memoryBytes: number().optional(),
|
|
16113
|
-
vramBytes: number().optional()
|
|
16338
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
16339
|
+
var NcScheduleSchema = object({
|
|
16340
|
+
windows: array(object({
|
|
16341
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
16342
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
16343
|
+
startMinute: number().int().min(0).max(1439),
|
|
16344
|
+
endMinute: number().int().min(0).max(1439)
|
|
16345
|
+
})).min(1),
|
|
16346
|
+
/** IANA timezone; default = hub host timezone. */
|
|
16347
|
+
timezone: string().optional(),
|
|
16348
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
16349
|
+
invert: boolean().optional()
|
|
16114
16350
|
});
|
|
16115
|
-
|
|
16116
|
-
|
|
16117
|
-
|
|
16118
|
-
|
|
16119
|
-
|
|
16351
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
16352
|
+
var NcPlateMatcherSchema = object({
|
|
16353
|
+
values: array(string().min(1)).min(1),
|
|
16354
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
16355
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
16120
16356
|
});
|
|
16121
|
-
|
|
16122
|
-
|
|
16123
|
-
|
|
16124
|
-
|
|
16357
|
+
/**
|
|
16358
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
16359
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
16360
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
16361
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
16362
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
16363
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
16364
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
16365
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
16366
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
16367
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
16368
|
+
* (declared SQLite collection, reseeded on boot).
|
|
16369
|
+
*/
|
|
16370
|
+
var NcOccupancyConditionSchema = object({
|
|
16371
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
16372
|
+
zoneId: string().optional(),
|
|
16373
|
+
/** Object class to count; absent = any class. */
|
|
16374
|
+
className: string().optional(),
|
|
16375
|
+
op: _enum([
|
|
16376
|
+
"became-occupied",
|
|
16377
|
+
"became-free",
|
|
16378
|
+
">=",
|
|
16379
|
+
"<="
|
|
16380
|
+
]).default("became-occupied"),
|
|
16381
|
+
count: number().int().min(0).default(1),
|
|
16382
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
16383
|
+
});
|
|
16384
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
16385
|
+
var NcZoneConditionSchema = object({
|
|
16386
|
+
ids: array(string().min(1)).min(1),
|
|
16387
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
16388
|
+
match: _enum(["any", "all"]).default("any")
|
|
16125
16389
|
});
|
|
16126
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
16127
|
-
images: array(LlmImageSchema).optional(),
|
|
16128
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
16129
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
16130
|
-
timeoutMs: number().int().positive().optional()
|
|
16131
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
16132
|
-
kind: "mutation",
|
|
16133
|
-
auth: "admin"
|
|
16134
|
-
}), method(object({}), _void(), {
|
|
16135
|
-
kind: "mutation",
|
|
16136
|
-
auth: "admin"
|
|
16137
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
16138
|
-
kind: "mutation",
|
|
16139
|
-
auth: "admin"
|
|
16140
|
-
}), method(object({ file: string() }), _void(), {
|
|
16141
|
-
kind: "mutation",
|
|
16142
|
-
auth: "admin"
|
|
16143
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
16144
16390
|
/**
|
|
16145
|
-
*
|
|
16146
|
-
*
|
|
16147
|
-
* provider by the `addonId` in the call input (the notification-output
|
|
16148
|
-
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
16149
|
-
* (hub-placed); the cap stays open for future providers.
|
|
16150
|
-
*
|
|
16151
|
-
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
16152
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
16153
|
-
* write; a stored key NEVER round-trips to a client.
|
|
16391
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
16392
|
+
* membership lists are OR within the list (spec §2.3).
|
|
16154
16393
|
*/
|
|
16155
|
-
var
|
|
16156
|
-
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
16166
|
-
/**
|
|
16167
|
-
|
|
16168
|
-
|
|
16169
|
-
|
|
16170
|
-
|
|
16171
|
-
|
|
16172
|
-
|
|
16173
|
-
/**
|
|
16174
|
-
|
|
16175
|
-
|
|
16176
|
-
|
|
16177
|
-
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16394
|
+
var NcConditionsSchema = object({
|
|
16395
|
+
/** Device scope — absent = all devices. */
|
|
16396
|
+
devices: array(number()).optional(),
|
|
16397
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
16398
|
+
classes: array(string().min(1)).optional(),
|
|
16399
|
+
/** Veto classes — any overlap fails the rule. */
|
|
16400
|
+
classesExclude: array(string().min(1)).optional(),
|
|
16401
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
16402
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
16403
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
16404
|
+
zones: NcZoneConditionSchema.optional(),
|
|
16405
|
+
/** Veto zones — any hit fails the rule. */
|
|
16406
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
16407
|
+
/**
|
|
16408
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
16409
|
+
* (identity name / plate text / subclass).
|
|
16410
|
+
*/
|
|
16411
|
+
labelEquals: array(string().min(1)).optional(),
|
|
16412
|
+
/**
|
|
16413
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
16414
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
16415
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
16416
|
+
*/
|
|
16417
|
+
identities: array(string().min(1)).optional(),
|
|
16418
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
16419
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
16420
|
+
/**
|
|
16421
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
16422
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
16423
|
+
* identity display name). A record with NO label passes (nothing to
|
|
16424
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
16425
|
+
*/
|
|
16426
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
16427
|
+
/**
|
|
16428
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
16429
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
16430
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
16431
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
16432
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
16433
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
16434
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
16435
|
+
*/
|
|
16436
|
+
minImportance: number().min(0).max(1).optional(),
|
|
16437
|
+
/**
|
|
16438
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
16439
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
16440
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
16441
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
16442
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
16443
|
+
*/
|
|
16444
|
+
minDwellSeconds: number().min(0).optional(),
|
|
16445
|
+
/**
|
|
16446
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
16447
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
16448
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
16449
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
16450
|
+
* tracks carry `sensor`.
|
|
16451
|
+
*/
|
|
16452
|
+
source: _enum([
|
|
16453
|
+
"pipeline",
|
|
16454
|
+
"onboard",
|
|
16455
|
+
"sensor",
|
|
16456
|
+
"any"
|
|
16457
|
+
]).optional(),
|
|
16458
|
+
/**
|
|
16459
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
16460
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
16461
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
16462
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
16463
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
16464
|
+
*
|
|
16465
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
16466
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
16467
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
16468
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
16469
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
16470
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
16471
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
16472
|
+
* one track the higher of the two is used. A track that ended with no
|
|
16473
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
16474
|
+
* closed for it (an un-recognized subject).
|
|
16475
|
+
*/
|
|
16476
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
16477
|
+
/**
|
|
16478
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
16479
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
16480
|
+
* against the token carried on the device-event subject (extracted from the
|
|
16481
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
16482
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
16483
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
16484
|
+
*/
|
|
16485
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
16486
|
+
/**
|
|
16487
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
16488
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
16489
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
16490
|
+
*/
|
|
16491
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
16492
|
+
/**
|
|
16493
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
16494
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
16495
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
16496
|
+
* on the package-event trigger).
|
|
16497
|
+
*/
|
|
16498
|
+
packagePhase: _enum([
|
|
16499
|
+
"delivered",
|
|
16500
|
+
"picked-up",
|
|
16501
|
+
"both"
|
|
16502
|
+
]).optional(),
|
|
16503
|
+
/**
|
|
16504
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
16505
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
16506
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
16507
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
16508
|
+
*/
|
|
16509
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
16510
|
+
/**
|
|
16511
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
16512
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
16513
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
16514
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
16515
|
+
*/
|
|
16516
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
16182
16517
|
});
|
|
16183
|
-
/**
|
|
16184
|
-
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
configSchema: ConfigSchemaPassthrough
|
|
16518
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
16519
|
+
var NcRuleTargetSchema = object({
|
|
16520
|
+
/** `notification-output` Target id. */
|
|
16521
|
+
targetId: string().min(1),
|
|
16522
|
+
/**
|
|
16523
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
16524
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
16525
|
+
* degrade engine drops what the backend can't render.
|
|
16526
|
+
*/
|
|
16527
|
+
params: record(string(), unknown()).optional()
|
|
16194
16528
|
});
|
|
16195
|
-
|
|
16196
|
-
|
|
16197
|
-
|
|
16198
|
-
|
|
16529
|
+
/**
|
|
16530
|
+
* Media attachment policy (P1 still-image subset).
|
|
16531
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
16532
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
16533
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
16534
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
16535
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
16536
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
16537
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
16538
|
+
* name), so the choice never drifts from the record that fired it.
|
|
16539
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
16540
|
+
* - `none` — no attachment.
|
|
16541
|
+
*/
|
|
16542
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
16543
|
+
"best",
|
|
16544
|
+
"best-matching",
|
|
16545
|
+
"keyFrame",
|
|
16546
|
+
"none"
|
|
16547
|
+
]).default("best") });
|
|
16548
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
16549
|
+
var NcThrottleSchema = object({
|
|
16550
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
16551
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
16552
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
16553
|
+
});
|
|
16554
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
16555
|
+
var NcRuleInputSchema = object({
|
|
16556
|
+
name: string().min(1).max(200),
|
|
16557
|
+
enabled: boolean().default(true),
|
|
16558
|
+
delivery: NcDeliverySchema,
|
|
16559
|
+
conditions: NcConditionsSchema.default({}),
|
|
16560
|
+
schedule: NcScheduleSchema.optional(),
|
|
16561
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
16562
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
16563
|
+
throttle: NcThrottleSchema.default({
|
|
16564
|
+
cooldownSec: 60,
|
|
16565
|
+
scope: "rule-device"
|
|
16566
|
+
}),
|
|
16567
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
16568
|
+
template: object({
|
|
16569
|
+
title: string().max(500).optional(),
|
|
16570
|
+
body: string().max(2e3).optional()
|
|
16571
|
+
}).optional(),
|
|
16572
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
16573
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16574
|
+
/**
|
|
16575
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
16576
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
16577
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
16578
|
+
*/
|
|
16579
|
+
ownerUserId: string().optional()
|
|
16199
16580
|
});
|
|
16200
|
-
/**
|
|
16201
|
-
|
|
16202
|
-
|
|
16203
|
-
|
|
16204
|
-
|
|
16205
|
-
|
|
16206
|
-
|
|
16207
|
-
|
|
16208
|
-
|
|
16209
|
-
|
|
16210
|
-
|
|
16581
|
+
/**
|
|
16582
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
16583
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
16584
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
16585
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
16586
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
16587
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
16588
|
+
* `updateRule` patch.
|
|
16589
|
+
*/
|
|
16590
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
16591
|
+
/** A persisted rule. */
|
|
16592
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
16593
|
+
id: string(),
|
|
16594
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
16595
|
+
createdBy: string(),
|
|
16596
|
+
createdAt: number(),
|
|
16597
|
+
updatedAt: number(),
|
|
16598
|
+
/**
|
|
16599
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
16600
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
16601
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
16602
|
+
*/
|
|
16603
|
+
disabledTargetIds: array(string()).default([])
|
|
16604
|
+
});
|
|
16605
|
+
var NcTestResultSchema = object({
|
|
16606
|
+
recordId: string(),
|
|
16607
|
+
recordKind: _enum([
|
|
16608
|
+
"object-event",
|
|
16609
|
+
"track",
|
|
16610
|
+
"device-event",
|
|
16611
|
+
"package-event"
|
|
16612
|
+
]),
|
|
16613
|
+
deviceId: number(),
|
|
16614
|
+
timestamp: number(),
|
|
16615
|
+
wouldFire: boolean(),
|
|
16616
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
16617
|
+
failedCondition: string().optional(),
|
|
16618
|
+
className: string().optional(),
|
|
16619
|
+
label: string().optional()
|
|
16211
16620
|
});
|
|
16212
|
-
|
|
16213
|
-
|
|
16621
|
+
var NcConditionDescriptorSchema = object({
|
|
16622
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
16214
16623
|
id: string(),
|
|
16624
|
+
group: _enum([
|
|
16625
|
+
"scope",
|
|
16626
|
+
"class",
|
|
16627
|
+
"zones",
|
|
16628
|
+
"quality",
|
|
16629
|
+
"label",
|
|
16630
|
+
"schedule",
|
|
16631
|
+
"device",
|
|
16632
|
+
"package",
|
|
16633
|
+
"occupancy"
|
|
16634
|
+
]),
|
|
16215
16635
|
label: string(),
|
|
16216
|
-
|
|
16217
|
-
|
|
16218
|
-
|
|
16219
|
-
|
|
16220
|
-
|
|
16221
|
-
|
|
16222
|
-
|
|
16223
|
-
|
|
16224
|
-
|
|
16225
|
-
|
|
16226
|
-
|
|
16636
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
16637
|
+
valueType: _enum([
|
|
16638
|
+
"deviceIdList",
|
|
16639
|
+
"stringList",
|
|
16640
|
+
"number01",
|
|
16641
|
+
"number",
|
|
16642
|
+
"sourceSelect",
|
|
16643
|
+
"zoneSelection",
|
|
16644
|
+
"zoneIdList",
|
|
16645
|
+
"schedule",
|
|
16646
|
+
"plateMatcher",
|
|
16647
|
+
"packagePhase",
|
|
16648
|
+
"polygonDraw",
|
|
16649
|
+
"occupancy"
|
|
16650
|
+
]),
|
|
16651
|
+
operator: _enum([
|
|
16652
|
+
"in",
|
|
16653
|
+
"notIn",
|
|
16654
|
+
"anyOf",
|
|
16655
|
+
"allOf",
|
|
16656
|
+
"gte",
|
|
16657
|
+
"fuzzyIn",
|
|
16658
|
+
"withinSchedule"
|
|
16659
|
+
]),
|
|
16660
|
+
/** Which delivery kinds the condition applies to. */
|
|
16661
|
+
appliesTo: array(NcDeliverySchema),
|
|
16662
|
+
phase: string(),
|
|
16663
|
+
description: string().optional()
|
|
16227
16664
|
});
|
|
16228
|
-
|
|
16229
|
-
|
|
16230
|
-
|
|
16231
|
-
|
|
16232
|
-
|
|
16233
|
-
|
|
16665
|
+
/**
|
|
16666
|
+
* The P1 condition surface as data — served by `getConditionCatalog` so
|
|
16667
|
+
* rule editors render from the catalog, not hardcoded forms (spec §4.2).
|
|
16668
|
+
*/
|
|
16669
|
+
var NC_CONDITION_CATALOG = [
|
|
16670
|
+
{
|
|
16671
|
+
id: "devices",
|
|
16672
|
+
group: "scope",
|
|
16673
|
+
label: "Cameras",
|
|
16674
|
+
valueType: "deviceIdList",
|
|
16675
|
+
operator: "in",
|
|
16676
|
+
appliesTo: [
|
|
16677
|
+
"immediate",
|
|
16678
|
+
"track-end",
|
|
16679
|
+
"device-event",
|
|
16680
|
+
"package-event"
|
|
16681
|
+
],
|
|
16682
|
+
phase: "P1",
|
|
16683
|
+
description: "Restrict the rule to these devices; absent = all devices."
|
|
16684
|
+
},
|
|
16685
|
+
{
|
|
16686
|
+
id: "classes",
|
|
16687
|
+
group: "class",
|
|
16688
|
+
label: "Object classes",
|
|
16689
|
+
valueType: "stringList",
|
|
16690
|
+
operator: "in",
|
|
16691
|
+
appliesTo: [
|
|
16692
|
+
"immediate",
|
|
16693
|
+
"track-end",
|
|
16694
|
+
"package-event"
|
|
16695
|
+
],
|
|
16696
|
+
phase: "P1",
|
|
16697
|
+
description: "Any overlap with the detection class set passes."
|
|
16698
|
+
},
|
|
16699
|
+
{
|
|
16700
|
+
id: "classesExclude",
|
|
16701
|
+
group: "class",
|
|
16702
|
+
label: "Excluded classes",
|
|
16703
|
+
valueType: "stringList",
|
|
16704
|
+
operator: "notIn",
|
|
16705
|
+
appliesTo: [
|
|
16706
|
+
"immediate",
|
|
16707
|
+
"track-end",
|
|
16708
|
+
"package-event"
|
|
16709
|
+
],
|
|
16710
|
+
phase: "P1"
|
|
16711
|
+
},
|
|
16712
|
+
{
|
|
16713
|
+
id: "minConfidence",
|
|
16714
|
+
group: "quality",
|
|
16715
|
+
label: "Minimum confidence",
|
|
16716
|
+
valueType: "number01",
|
|
16717
|
+
operator: "gte",
|
|
16718
|
+
appliesTo: [
|
|
16719
|
+
"immediate",
|
|
16720
|
+
"track-end",
|
|
16721
|
+
"package-event"
|
|
16722
|
+
],
|
|
16723
|
+
phase: "P1"
|
|
16724
|
+
},
|
|
16725
|
+
{
|
|
16726
|
+
id: "zones",
|
|
16727
|
+
group: "zones",
|
|
16728
|
+
label: "Zones",
|
|
16729
|
+
valueType: "zoneSelection",
|
|
16730
|
+
operator: "anyOf",
|
|
16731
|
+
appliesTo: [
|
|
16732
|
+
"immediate",
|
|
16733
|
+
"track-end",
|
|
16734
|
+
"package-event"
|
|
16735
|
+
],
|
|
16736
|
+
phase: "P1",
|
|
16737
|
+
description: "Admin zone ids; quantifier any/all over the visited set."
|
|
16738
|
+
},
|
|
16739
|
+
{
|
|
16740
|
+
id: "zonesExclude",
|
|
16741
|
+
group: "zones",
|
|
16742
|
+
label: "Excluded zones",
|
|
16743
|
+
valueType: "zoneIdList",
|
|
16744
|
+
operator: "notIn",
|
|
16745
|
+
appliesTo: [
|
|
16746
|
+
"immediate",
|
|
16747
|
+
"track-end",
|
|
16748
|
+
"package-event"
|
|
16749
|
+
],
|
|
16750
|
+
phase: "P1"
|
|
16751
|
+
},
|
|
16752
|
+
{
|
|
16753
|
+
id: "labelEquals",
|
|
16754
|
+
group: "label",
|
|
16755
|
+
label: "Label equals",
|
|
16756
|
+
valueType: "stringList",
|
|
16757
|
+
operator: "in",
|
|
16758
|
+
appliesTo: ["immediate", "track-end"],
|
|
16759
|
+
phase: "P1",
|
|
16760
|
+
description: "Exact match on the collapsed label (identity / plate / subclass)."
|
|
16761
|
+
},
|
|
16762
|
+
{
|
|
16763
|
+
id: "identities",
|
|
16764
|
+
group: "label",
|
|
16765
|
+
label: "Identities",
|
|
16766
|
+
valueType: "stringList",
|
|
16767
|
+
operator: "in",
|
|
16768
|
+
appliesTo: ["immediate", "track-end"],
|
|
16769
|
+
phase: "P1",
|
|
16770
|
+
description: "P1: matched against the identity display name on the record label."
|
|
16771
|
+
},
|
|
16772
|
+
{
|
|
16773
|
+
id: "plates",
|
|
16774
|
+
group: "label",
|
|
16775
|
+
label: "License plates",
|
|
16776
|
+
valueType: "plateMatcher",
|
|
16777
|
+
operator: "fuzzyIn",
|
|
16778
|
+
appliesTo: ["immediate", "track-end"],
|
|
16779
|
+
phase: "P1",
|
|
16780
|
+
description: "Levenshtein-tolerant match against the plate text."
|
|
16781
|
+
},
|
|
16782
|
+
{
|
|
16783
|
+
id: "identitiesExclude",
|
|
16784
|
+
group: "label",
|
|
16785
|
+
label: "Excluded identities",
|
|
16786
|
+
valueType: "stringList",
|
|
16787
|
+
operator: "notIn",
|
|
16788
|
+
appliesTo: ["immediate", "track-end"],
|
|
16789
|
+
phase: "P1",
|
|
16790
|
+
description: "Veto by identity display name (mirror of Identities; absent label passes)."
|
|
16791
|
+
},
|
|
16792
|
+
{
|
|
16793
|
+
id: "minLabelConfidence",
|
|
16794
|
+
group: "label",
|
|
16795
|
+
label: "Minimum label confidence",
|
|
16796
|
+
valueType: "number01",
|
|
16797
|
+
operator: "gte",
|
|
16798
|
+
appliesTo: ["track-end"],
|
|
16799
|
+
phase: "P1",
|
|
16800
|
+
description: "Best identity/plate recognition match confidence [0,1] for the label the track carries at close (peak assigned-identity cosine / peak plate OCR score; the higher of the two when both were read). Distinct from detection confidence. Fails closed for a track that ended un-recognized."
|
|
16801
|
+
},
|
|
16802
|
+
{
|
|
16803
|
+
id: "minImportance",
|
|
16804
|
+
group: "quality",
|
|
16805
|
+
label: "Minimum importance",
|
|
16806
|
+
valueType: "number01",
|
|
16807
|
+
operator: "gte",
|
|
16808
|
+
appliesTo: ["track-end"],
|
|
16809
|
+
phase: "P1",
|
|
16810
|
+
description: "Server-computed key-event importance [0,1]; track-end rules only (importance is scored at close). Fails when the record has none."
|
|
16811
|
+
},
|
|
16812
|
+
{
|
|
16813
|
+
id: "minDwellSeconds",
|
|
16814
|
+
group: "quality",
|
|
16815
|
+
label: "Minimum dwell (seconds)",
|
|
16816
|
+
valueType: "number",
|
|
16817
|
+
operator: "gte",
|
|
16818
|
+
appliesTo: ["track-end"],
|
|
16819
|
+
phase: "P1",
|
|
16820
|
+
description: "Track lifespan in seconds (lastSeen − firstSeen); track-end rules only."
|
|
16821
|
+
},
|
|
16822
|
+
{
|
|
16823
|
+
id: "source",
|
|
16824
|
+
group: "scope",
|
|
16825
|
+
label: "Detection source",
|
|
16826
|
+
valueType: "sourceSelect",
|
|
16827
|
+
operator: "in",
|
|
16828
|
+
appliesTo: [
|
|
16829
|
+
"immediate",
|
|
16830
|
+
"track-end",
|
|
16831
|
+
"device-event",
|
|
16832
|
+
"package-event"
|
|
16833
|
+
],
|
|
16834
|
+
phase: "P1",
|
|
16835
|
+
description: "pipeline / onboard / sensor; a record with no stamped source counts as pipeline."
|
|
16836
|
+
},
|
|
16837
|
+
{
|
|
16838
|
+
id: "sensorKinds",
|
|
16839
|
+
group: "device",
|
|
16840
|
+
label: "Sensor kinds",
|
|
16841
|
+
valueType: "stringList",
|
|
16842
|
+
operator: "in",
|
|
16843
|
+
appliesTo: ["device-event"],
|
|
16844
|
+
phase: "P1",
|
|
16845
|
+
description: "Sensor/control taxonomy kinds (doorbell / contact / button / …) matched against the persisted device event."
|
|
16846
|
+
},
|
|
16847
|
+
{
|
|
16848
|
+
id: "eventTypeTokens",
|
|
16849
|
+
group: "device",
|
|
16850
|
+
label: "Event-type tokens",
|
|
16851
|
+
valueType: "stringList",
|
|
16852
|
+
operator: "in",
|
|
16853
|
+
appliesTo: ["device-event"],
|
|
16854
|
+
phase: "P1",
|
|
16855
|
+
description: "Raw device event-type tokens (e.g. doorbell press / press_long) from the event-emitter slice; absent on doorbell-pulse / passive sensors."
|
|
16856
|
+
},
|
|
16857
|
+
{
|
|
16858
|
+
id: "packagePhase",
|
|
16859
|
+
group: "package",
|
|
16860
|
+
label: "Package phase",
|
|
16861
|
+
valueType: "packagePhase",
|
|
16862
|
+
operator: "in",
|
|
16863
|
+
appliesTo: ["package-event"],
|
|
16864
|
+
phase: "P1",
|
|
16865
|
+
description: "Delivered / picked-up / both."
|
|
16866
|
+
},
|
|
16867
|
+
{
|
|
16868
|
+
id: "occupancy",
|
|
16869
|
+
group: "occupancy",
|
|
16870
|
+
label: "Occupancy",
|
|
16871
|
+
valueType: "occupancy",
|
|
16872
|
+
operator: "anyOf",
|
|
16873
|
+
appliesTo: ["device-event"],
|
|
16874
|
+
phase: "P1",
|
|
16875
|
+
description: "ZoneAnalytics occupancy edge (optionally zone/class-scoped): count crosses the threshold and holds for sustainSeconds. Fail-closed on a missing snapshot."
|
|
16876
|
+
},
|
|
16877
|
+
{
|
|
16878
|
+
id: "customZones",
|
|
16879
|
+
group: "zones",
|
|
16880
|
+
label: "Custom zones",
|
|
16881
|
+
valueType: "polygonDraw",
|
|
16882
|
+
operator: "anyOf",
|
|
16883
|
+
appliesTo: [
|
|
16884
|
+
"immediate",
|
|
16885
|
+
"track-end",
|
|
16886
|
+
"package-event"
|
|
16887
|
+
],
|
|
16888
|
+
phase: "P1",
|
|
16889
|
+
description: "User-drawn polygons; a detection whose bbox overlaps any polygon matches."
|
|
16890
|
+
},
|
|
16891
|
+
{
|
|
16892
|
+
id: "schedule",
|
|
16893
|
+
group: "schedule",
|
|
16894
|
+
label: "Schedule",
|
|
16895
|
+
valueType: "schedule",
|
|
16896
|
+
operator: "withinSchedule",
|
|
16897
|
+
appliesTo: [
|
|
16898
|
+
"immediate",
|
|
16899
|
+
"track-end",
|
|
16900
|
+
"device-event",
|
|
16901
|
+
"package-event"
|
|
16902
|
+
],
|
|
16903
|
+
phase: "P1",
|
|
16904
|
+
description: "Weekly activation windows (invertible); absent = always active."
|
|
16905
|
+
}
|
|
16906
|
+
];
|
|
16907
|
+
/**
|
|
16908
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
16909
|
+
* durable outbox row's own status (single source of truth):
|
|
16910
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
16911
|
+
* - `sent` — delivered (terminal)
|
|
16912
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
16913
|
+
* backend rejection / a deleted target (terminal; carries
|
|
16914
|
+
* the failure `error`)
|
|
16915
|
+
*
|
|
16916
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
16917
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
16918
|
+
*/
|
|
16919
|
+
var NcHistoryStatusSchema = _enum([
|
|
16920
|
+
"pending",
|
|
16921
|
+
"sent",
|
|
16922
|
+
"dead"
|
|
16923
|
+
]);
|
|
16924
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
16925
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
16926
|
+
"object-event",
|
|
16927
|
+
"track-end",
|
|
16928
|
+
"device-event",
|
|
16929
|
+
"package-event"
|
|
16930
|
+
]);
|
|
16931
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
16932
|
+
var NcHistorySubjectSchema = object({
|
|
16933
|
+
className: string(),
|
|
16934
|
+
label: string().optional(),
|
|
16935
|
+
confidence: number().optional(),
|
|
16936
|
+
zones: array(string()),
|
|
16937
|
+
timestamp: number()
|
|
16234
16938
|
});
|
|
16235
|
-
|
|
16236
|
-
|
|
16237
|
-
|
|
16238
|
-
|
|
16939
|
+
/**
|
|
16940
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
16941
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
16942
|
+
* NO second write path, so history can never drift from delivery state).
|
|
16943
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
16944
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
16945
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
16946
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
16947
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
16948
|
+
* P1 (admin scope only).
|
|
16949
|
+
*/
|
|
16950
|
+
var NcHistoryEntrySchema = object({
|
|
16951
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
16952
|
+
id: string(),
|
|
16953
|
+
ruleId: string(),
|
|
16954
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
16955
|
+
ruleName: string(),
|
|
16956
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
16957
|
+
delivery: NcDeliverySchema,
|
|
16958
|
+
targetId: string(),
|
|
16959
|
+
deviceId: number(),
|
|
16960
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
16961
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
16962
|
+
recordId: string(),
|
|
16963
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
16964
|
+
trackId: string().optional(),
|
|
16965
|
+
status: NcHistoryStatusSchema,
|
|
16966
|
+
/** Delivery attempts made so far. */
|
|
16967
|
+
attempts: number().int(),
|
|
16968
|
+
/** Fire time (outbox enqueue). */
|
|
16969
|
+
createdAt: number(),
|
|
16970
|
+
/** Last transition time (terminal for sent / dead). */
|
|
16971
|
+
updatedAt: number(),
|
|
16972
|
+
/** Failure detail — present on a `dead` row. */
|
|
16973
|
+
error: string().optional(),
|
|
16974
|
+
subject: NcHistorySubjectSchema
|
|
16239
16975
|
});
|
|
16240
|
-
|
|
16241
|
-
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
|
|
16249
|
-
|
|
16250
|
-
selector: LlmDefaultSelectorSchema,
|
|
16251
|
-
profileId: string().nullable()
|
|
16252
|
-
}), _void(), {
|
|
16253
|
-
kind: "mutation",
|
|
16254
|
-
auth: "admin"
|
|
16255
|
-
}), method(object({
|
|
16976
|
+
/**
|
|
16977
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
16978
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
16979
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
16980
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
16981
|
+
*/
|
|
16982
|
+
var NcHistoryFilterSchema = object({
|
|
16983
|
+
ruleId: string().optional(),
|
|
16984
|
+
deviceId: number().optional(),
|
|
16985
|
+
status: NcHistoryStatusSchema.optional(),
|
|
16256
16986
|
since: number().optional(),
|
|
16257
16987
|
until: number().optional(),
|
|
16258
|
-
|
|
16259
|
-
profileId: string().optional()
|
|
16260
|
-
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16261
|
-
nodeId: string(),
|
|
16262
|
-
model: ManagedModelRefSchema
|
|
16263
|
-
}), _void(), {
|
|
16264
|
-
kind: "mutation",
|
|
16265
|
-
auth: "admin"
|
|
16266
|
-
}), method(object({
|
|
16267
|
-
nodeId: string(),
|
|
16268
|
-
file: string()
|
|
16269
|
-
}), _void(), {
|
|
16270
|
-
kind: "mutation",
|
|
16271
|
-
auth: "admin"
|
|
16272
|
-
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16273
|
-
kind: "mutation",
|
|
16274
|
-
auth: "admin"
|
|
16275
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
16276
|
-
kind: "mutation",
|
|
16277
|
-
auth: "admin"
|
|
16988
|
+
limit: number().int().min(1).max(500).default(100)
|
|
16278
16989
|
});
|
|
16990
|
+
var notificationRulesCapability = {
|
|
16991
|
+
name: "notification-rules",
|
|
16992
|
+
scope: "system",
|
|
16993
|
+
mode: "singleton",
|
|
16994
|
+
methods: {
|
|
16995
|
+
listRules: method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }),
|
|
16996
|
+
getRule: method(object({ ruleId: string() }), object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }),
|
|
16997
|
+
createRule: method(object({ rule: NcRuleInputSchema }), object({ rule: NcRuleSchema }), {
|
|
16998
|
+
kind: "mutation",
|
|
16999
|
+
auth: "admin",
|
|
17000
|
+
caller: "required"
|
|
17001
|
+
}),
|
|
17002
|
+
updateRule: method(object({
|
|
17003
|
+
ruleId: string(),
|
|
17004
|
+
patch: NcRulePatchSchema
|
|
17005
|
+
}), object({ rule: NcRuleSchema }), {
|
|
17006
|
+
kind: "mutation",
|
|
17007
|
+
auth: "admin",
|
|
17008
|
+
caller: "required"
|
|
17009
|
+
}),
|
|
17010
|
+
deleteRule: method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
17011
|
+
kind: "mutation",
|
|
17012
|
+
auth: "admin"
|
|
17013
|
+
}),
|
|
17014
|
+
setRuleEnabled: method(object({
|
|
17015
|
+
ruleId: string(),
|
|
17016
|
+
enabled: boolean()
|
|
17017
|
+
}), object({ success: literal(true) }), {
|
|
17018
|
+
kind: "mutation",
|
|
17019
|
+
auth: "admin"
|
|
17020
|
+
}),
|
|
17021
|
+
/**
|
|
17022
|
+
* Dry-run a rule against recently persisted records (object events for
|
|
17023
|
+
* `immediate`, closed tracks for `track-end`). Mutation kind only to
|
|
17024
|
+
* carry the full rule object safely; no side effects.
|
|
17025
|
+
*/
|
|
17026
|
+
testRule: method(object({
|
|
17027
|
+
rule: NcRuleInputSchema,
|
|
17028
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
17029
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
17030
|
+
kind: "mutation",
|
|
17031
|
+
auth: "admin"
|
|
17032
|
+
}),
|
|
17033
|
+
getConditionCatalog: method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })),
|
|
17034
|
+
/**
|
|
17035
|
+
* Queryable delivery history — a read-only view over the durable outbox
|
|
17036
|
+
* (fired rule, subject summary, target, status, timestamps, error on a
|
|
17037
|
+
* dead row). Newest-first, bounded by `filter.limit`. Retention follows
|
|
17038
|
+
* the outbox's own terminal-row prune horizon (no separate history
|
|
17039
|
+
* horizon — single collection, single source of truth). Admin-only in
|
|
17040
|
+
* P1 (no user dimension); the P2 viewer History screen adds per-caller
|
|
17041
|
+
* scoping on the same method.
|
|
17042
|
+
*/
|
|
17043
|
+
getHistory: method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" })
|
|
17044
|
+
}
|
|
17045
|
+
};
|
|
16279
17046
|
/**
|
|
16280
17047
|
* Zod schemas for persisted record types.
|
|
16281
17048
|
*
|
|
@@ -17124,122 +17891,22 @@ var pipelineAnalyticsCapability = {
|
|
|
17124
17891
|
trackId: string(),
|
|
17125
17892
|
className: string()
|
|
17126
17893
|
}) },
|
|
17127
|
-
/** Track expired (TTL reached after last detection). */
|
|
17128
|
-
onTrackEnded: { data: object({
|
|
17129
|
-
deviceId: number(),
|
|
17130
|
-
trackId: string(),
|
|
17131
|
-
className: string(),
|
|
17132
|
-
durationMs: number()
|
|
17133
|
-
}) },
|
|
17134
|
-
/** Canonical "something happened at device X" event, per-kind. */
|
|
17135
|
-
onDetectionEvent: { data: object({
|
|
17136
|
-
deviceId: number(),
|
|
17137
|
-
kind: EventKindSchema,
|
|
17138
|
-
eventId: string(),
|
|
17139
|
-
timestamp: number()
|
|
17140
|
-
}) }
|
|
17141
|
-
}
|
|
17142
|
-
};
|
|
17143
|
-
/**
|
|
17144
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
17145
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
17146
|
-
* caps into per-camera event-kind descriptors.
|
|
17147
|
-
*
|
|
17148
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
17149
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
17150
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
17151
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
17152
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
17153
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
17154
|
-
* eventful cap is missing.
|
|
17155
|
-
*/
|
|
17156
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
17157
|
-
var LEGACY_ICON = {
|
|
17158
|
-
motion: "motion",
|
|
17159
|
-
audio: "audio",
|
|
17160
|
-
person: "person",
|
|
17161
|
-
vehicle: "vehicle",
|
|
17162
|
-
animal: "animal",
|
|
17163
|
-
package: "package",
|
|
17164
|
-
door: "door",
|
|
17165
|
-
pir: "pir",
|
|
17166
|
-
smoke: "smoke",
|
|
17167
|
-
water: "water",
|
|
17168
|
-
button: "button",
|
|
17169
|
-
generic: "generic",
|
|
17170
|
-
gas: "smoke",
|
|
17171
|
-
vibration: "generic",
|
|
17172
|
-
tamper: "generic",
|
|
17173
|
-
presence: "person",
|
|
17174
|
-
lock: "generic",
|
|
17175
|
-
siren: "generic",
|
|
17176
|
-
switch: "generic",
|
|
17177
|
-
doorbell: "button"
|
|
17178
|
-
};
|
|
17179
|
-
function legacyIcon(iconId) {
|
|
17180
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
17181
|
-
}
|
|
17182
|
-
/**
|
|
17183
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
17184
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
17185
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
17186
|
-
*/
|
|
17187
|
-
var CAP_TO_KIND = {
|
|
17188
|
-
contact: "contact",
|
|
17189
|
-
motion: "motion-sensor",
|
|
17190
|
-
smoke: "smoke",
|
|
17191
|
-
flood: "flood",
|
|
17192
|
-
gas: "gas",
|
|
17193
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
17194
|
-
vibration: "vibration",
|
|
17195
|
-
tamper: "tamper",
|
|
17196
|
-
presence: "presence",
|
|
17197
|
-
"enum-sensor": "enum-sensor",
|
|
17198
|
-
"event-emitter": "device-event",
|
|
17199
|
-
"lock-control": "lock",
|
|
17200
|
-
switch: "switch",
|
|
17201
|
-
button: "button",
|
|
17202
|
-
doorbell: "doorbell"
|
|
17203
|
-
};
|
|
17204
|
-
function buildDescriptor(capName, kind) {
|
|
17205
|
-
const t = EVENT_TAXONOMY[kind];
|
|
17206
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
17207
|
-
return {
|
|
17208
|
-
...t,
|
|
17209
|
-
icon: legacyIcon(t.iconId)
|
|
17210
|
-
};
|
|
17211
|
-
}
|
|
17212
|
-
/**
|
|
17213
|
-
* Sensor / control cap name → static event-kind descriptor. A linked device
|
|
17214
|
-
* contributes one entry per bound cap present in this map.
|
|
17215
|
-
*/
|
|
17216
|
-
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
17217
|
-
/**
|
|
17218
|
-
* Build a full `EventKindDescriptor` for a taxonomy `kind`, stamping the
|
|
17219
|
-
* per-device `source`. Returns null when `kind` is not in the taxonomy.
|
|
17220
|
-
* This is THE bridge from the serializable taxonomy dictionary to the cap
|
|
17221
|
-
* wire shape — every event-kind descriptor the server emits goes through it,
|
|
17222
|
-
* so color/iconId/labelKey are never re-declared at a call site.
|
|
17223
|
-
*/
|
|
17224
|
-
function buildEventKindDescriptor(kind, source) {
|
|
17225
|
-
const t = EVENT_TAXONOMY[kind];
|
|
17226
|
-
if (t === void 0) return null;
|
|
17227
|
-
return {
|
|
17228
|
-
kind: t.kind,
|
|
17229
|
-
labelKey: t.labelKey,
|
|
17230
|
-
label: t.label,
|
|
17231
|
-
color: t.color,
|
|
17232
|
-
iconId: t.iconId,
|
|
17233
|
-
icon: legacyIcon(t.iconId),
|
|
17234
|
-
category: t.category,
|
|
17235
|
-
parentKind: t.parentKind,
|
|
17236
|
-
level: t.level,
|
|
17237
|
-
source: {
|
|
17238
|
-
capName: source.capName,
|
|
17239
|
-
deviceId: source.deviceId
|
|
17240
|
-
}
|
|
17241
|
-
};
|
|
17242
|
-
}
|
|
17894
|
+
/** Track expired (TTL reached after last detection). */
|
|
17895
|
+
onTrackEnded: { data: object({
|
|
17896
|
+
deviceId: number(),
|
|
17897
|
+
trackId: string(),
|
|
17898
|
+
className: string(),
|
|
17899
|
+
durationMs: number()
|
|
17900
|
+
}) },
|
|
17901
|
+
/** Canonical "something happened at device X" event, per-kind. */
|
|
17902
|
+
onDetectionEvent: { data: object({
|
|
17903
|
+
deviceId: number(),
|
|
17904
|
+
kind: EventKindSchema,
|
|
17905
|
+
eventId: string(),
|
|
17906
|
+
timestamp: number()
|
|
17907
|
+
}) }
|
|
17908
|
+
}
|
|
17909
|
+
};
|
|
17243
17910
|
var CameraPipelineConfigSchema = object({
|
|
17244
17911
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
17245
17912
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -17725,6 +18392,106 @@ method(object({
|
|
|
17725
18392
|
auth: "admin"
|
|
17726
18393
|
});
|
|
17727
18394
|
/**
|
|
18395
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
18396
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
18397
|
+
* caps into per-camera event-kind descriptors.
|
|
18398
|
+
*
|
|
18399
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
18400
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
18401
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
18402
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
18403
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
18404
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
18405
|
+
* eventful cap is missing.
|
|
18406
|
+
*/
|
|
18407
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
18408
|
+
var LEGACY_ICON = {
|
|
18409
|
+
motion: "motion",
|
|
18410
|
+
audio: "audio",
|
|
18411
|
+
person: "person",
|
|
18412
|
+
vehicle: "vehicle",
|
|
18413
|
+
animal: "animal",
|
|
18414
|
+
package: "package",
|
|
18415
|
+
door: "door",
|
|
18416
|
+
pir: "pir",
|
|
18417
|
+
smoke: "smoke",
|
|
18418
|
+
water: "water",
|
|
18419
|
+
button: "button",
|
|
18420
|
+
generic: "generic",
|
|
18421
|
+
gas: "smoke",
|
|
18422
|
+
vibration: "generic",
|
|
18423
|
+
tamper: "generic",
|
|
18424
|
+
presence: "person",
|
|
18425
|
+
lock: "generic",
|
|
18426
|
+
siren: "generic",
|
|
18427
|
+
switch: "generic",
|
|
18428
|
+
doorbell: "button"
|
|
18429
|
+
};
|
|
18430
|
+
function legacyIcon(iconId) {
|
|
18431
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
18432
|
+
}
|
|
18433
|
+
/**
|
|
18434
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
18435
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
18436
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
18437
|
+
*/
|
|
18438
|
+
var CAP_TO_KIND = {
|
|
18439
|
+
contact: "contact",
|
|
18440
|
+
motion: "motion-sensor",
|
|
18441
|
+
smoke: "smoke",
|
|
18442
|
+
flood: "flood",
|
|
18443
|
+
gas: "gas",
|
|
18444
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
18445
|
+
vibration: "vibration",
|
|
18446
|
+
tamper: "tamper",
|
|
18447
|
+
presence: "presence",
|
|
18448
|
+
"enum-sensor": "enum-sensor",
|
|
18449
|
+
"event-emitter": "device-event",
|
|
18450
|
+
"lock-control": "lock",
|
|
18451
|
+
switch: "switch",
|
|
18452
|
+
button: "button",
|
|
18453
|
+
doorbell: "doorbell"
|
|
18454
|
+
};
|
|
18455
|
+
function buildDescriptor(capName, kind) {
|
|
18456
|
+
const t = EVENT_TAXONOMY[kind];
|
|
18457
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
18458
|
+
return {
|
|
18459
|
+
...t,
|
|
18460
|
+
icon: legacyIcon(t.iconId)
|
|
18461
|
+
};
|
|
18462
|
+
}
|
|
18463
|
+
/**
|
|
18464
|
+
* Sensor / control cap name → static event-kind descriptor. A linked device
|
|
18465
|
+
* contributes one entry per bound cap present in this map.
|
|
18466
|
+
*/
|
|
18467
|
+
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
18468
|
+
/**
|
|
18469
|
+
* Build a full `EventKindDescriptor` for a taxonomy `kind`, stamping the
|
|
18470
|
+
* per-device `source`. Returns null when `kind` is not in the taxonomy.
|
|
18471
|
+
* This is THE bridge from the serializable taxonomy dictionary to the cap
|
|
18472
|
+
* wire shape — every event-kind descriptor the server emits goes through it,
|
|
18473
|
+
* so color/iconId/labelKey are never re-declared at a call site.
|
|
18474
|
+
*/
|
|
18475
|
+
function buildEventKindDescriptor(kind, source) {
|
|
18476
|
+
const t = EVENT_TAXONOMY[kind];
|
|
18477
|
+
if (t === void 0) return null;
|
|
18478
|
+
return {
|
|
18479
|
+
kind: t.kind,
|
|
18480
|
+
labelKey: t.labelKey,
|
|
18481
|
+
label: t.label,
|
|
18482
|
+
color: t.color,
|
|
18483
|
+
iconId: t.iconId,
|
|
18484
|
+
icon: legacyIcon(t.iconId),
|
|
18485
|
+
category: t.category,
|
|
18486
|
+
parentKind: t.parentKind,
|
|
18487
|
+
level: t.level,
|
|
18488
|
+
source: {
|
|
18489
|
+
capName: source.capName,
|
|
18490
|
+
deviceId: source.deviceId
|
|
18491
|
+
}
|
|
18492
|
+
};
|
|
18493
|
+
}
|
|
18494
|
+
/**
|
|
17728
18495
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
17729
18496
|
* package lifecycle (runtime-updatable node packages).
|
|
17730
18497
|
*
|
|
@@ -19189,7 +19956,28 @@ var FaceInfoSchema = object({
|
|
|
19189
19956
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
19190
19957
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
19191
19958
|
* back to the inline `base64` face crop. */
|
|
19192
|
-
keyFrameMediaKey: string().optional()
|
|
19959
|
+
keyFrameMediaKey: string().optional(),
|
|
19960
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
19961
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
19962
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
19963
|
+
* faces that were never auto-recognized. */
|
|
19964
|
+
bestMatchScore: number().optional(),
|
|
19965
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
19966
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
19967
|
+
* legacy rows / runners that reported no native measure. */
|
|
19968
|
+
nativeFaceShortSidePx: number().optional(),
|
|
19969
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
19970
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
19971
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
19972
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
19973
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
19974
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
19975
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
19976
|
+
suggestedIdentityId: string().optional(),
|
|
19977
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
19978
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
19979
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
19980
|
+
suggestedMatchScore: number().optional()
|
|
19193
19981
|
});
|
|
19194
19982
|
var FaceFilterEnum = _enum([
|
|
19195
19983
|
"unassigned",
|
|
@@ -21292,36 +22080,6 @@ Object.freeze({
|
|
|
21292
22080
|
addonId: null,
|
|
21293
22081
|
access: "view"
|
|
21294
22082
|
},
|
|
21295
|
-
"advancedNotifier.deleteRule": {
|
|
21296
|
-
capName: "advanced-notifier",
|
|
21297
|
-
capScope: "system",
|
|
21298
|
-
addonId: null,
|
|
21299
|
-
access: "delete"
|
|
21300
|
-
},
|
|
21301
|
-
"advancedNotifier.getHistory": {
|
|
21302
|
-
capName: "advanced-notifier",
|
|
21303
|
-
capScope: "system",
|
|
21304
|
-
addonId: null,
|
|
21305
|
-
access: "view"
|
|
21306
|
-
},
|
|
21307
|
-
"advancedNotifier.getRules": {
|
|
21308
|
-
capName: "advanced-notifier",
|
|
21309
|
-
capScope: "system",
|
|
21310
|
-
addonId: null,
|
|
21311
|
-
access: "view"
|
|
21312
|
-
},
|
|
21313
|
-
"advancedNotifier.testRule": {
|
|
21314
|
-
capName: "advanced-notifier",
|
|
21315
|
-
capScope: "system",
|
|
21316
|
-
addonId: null,
|
|
21317
|
-
access: "create"
|
|
21318
|
-
},
|
|
21319
|
-
"advancedNotifier.upsertRule": {
|
|
21320
|
-
capName: "advanced-notifier",
|
|
21321
|
-
capScope: "system",
|
|
21322
|
-
addonId: null,
|
|
21323
|
-
access: "create"
|
|
21324
|
-
},
|
|
21325
22083
|
"alarmPanel.arm": {
|
|
21326
22084
|
capName: "alarm-panel",
|
|
21327
22085
|
capScope: "device",
|
|
@@ -23626,6 +24384,60 @@ Object.freeze({
|
|
|
23626
24384
|
addonId: null,
|
|
23627
24385
|
access: "create"
|
|
23628
24386
|
},
|
|
24387
|
+
"notificationRules.createRule": {
|
|
24388
|
+
capName: "notification-rules",
|
|
24389
|
+
capScope: "system",
|
|
24390
|
+
addonId: null,
|
|
24391
|
+
access: "create"
|
|
24392
|
+
},
|
|
24393
|
+
"notificationRules.deleteRule": {
|
|
24394
|
+
capName: "notification-rules",
|
|
24395
|
+
capScope: "system",
|
|
24396
|
+
addonId: null,
|
|
24397
|
+
access: "delete"
|
|
24398
|
+
},
|
|
24399
|
+
"notificationRules.getConditionCatalog": {
|
|
24400
|
+
capName: "notification-rules",
|
|
24401
|
+
capScope: "system",
|
|
24402
|
+
addonId: null,
|
|
24403
|
+
access: "view"
|
|
24404
|
+
},
|
|
24405
|
+
"notificationRules.getHistory": {
|
|
24406
|
+
capName: "notification-rules",
|
|
24407
|
+
capScope: "system",
|
|
24408
|
+
addonId: null,
|
|
24409
|
+
access: "view"
|
|
24410
|
+
},
|
|
24411
|
+
"notificationRules.getRule": {
|
|
24412
|
+
capName: "notification-rules",
|
|
24413
|
+
capScope: "system",
|
|
24414
|
+
addonId: null,
|
|
24415
|
+
access: "view"
|
|
24416
|
+
},
|
|
24417
|
+
"notificationRules.listRules": {
|
|
24418
|
+
capName: "notification-rules",
|
|
24419
|
+
capScope: "system",
|
|
24420
|
+
addonId: null,
|
|
24421
|
+
access: "view"
|
|
24422
|
+
},
|
|
24423
|
+
"notificationRules.setRuleEnabled": {
|
|
24424
|
+
capName: "notification-rules",
|
|
24425
|
+
capScope: "system",
|
|
24426
|
+
addonId: null,
|
|
24427
|
+
access: "create"
|
|
24428
|
+
},
|
|
24429
|
+
"notificationRules.testRule": {
|
|
24430
|
+
capName: "notification-rules",
|
|
24431
|
+
capScope: "system",
|
|
24432
|
+
addonId: null,
|
|
24433
|
+
access: "create"
|
|
24434
|
+
},
|
|
24435
|
+
"notificationRules.updateRule": {
|
|
24436
|
+
capName: "notification-rules",
|
|
24437
|
+
capScope: "system",
|
|
24438
|
+
addonId: null,
|
|
24439
|
+
access: "create"
|
|
24440
|
+
},
|
|
23629
24441
|
"notifier.cancel": {
|
|
23630
24442
|
capName: "notifier",
|
|
23631
24443
|
capScope: "device",
|
|
@@ -25839,4 +26651,249 @@ Object.freeze({
|
|
|
25839
26651
|
"smtp-provider": "email"
|
|
25840
26652
|
});
|
|
25841
26653
|
//#endregion
|
|
25842
|
-
|
|
26654
|
+
Object.defineProperty(exports, "BaseAddon", {
|
|
26655
|
+
enumerable: true,
|
|
26656
|
+
get: function() {
|
|
26657
|
+
return BaseAddon;
|
|
26658
|
+
}
|
|
26659
|
+
});
|
|
26660
|
+
Object.defineProperty(exports, "DEFAULT_EVENT_COLOR", {
|
|
26661
|
+
enumerable: true,
|
|
26662
|
+
get: function() {
|
|
26663
|
+
return DEFAULT_EVENT_COLOR;
|
|
26664
|
+
}
|
|
26665
|
+
});
|
|
26666
|
+
Object.defineProperty(exports, "DeviceType", {
|
|
26667
|
+
enumerable: true,
|
|
26668
|
+
get: function() {
|
|
26669
|
+
return DeviceType;
|
|
26670
|
+
}
|
|
26671
|
+
});
|
|
26672
|
+
Object.defineProperty(exports, "EVENT_KIND_BY_CAP", {
|
|
26673
|
+
enumerable: true,
|
|
26674
|
+
get: function() {
|
|
26675
|
+
return EVENT_KIND_BY_CAP;
|
|
26676
|
+
}
|
|
26677
|
+
});
|
|
26678
|
+
Object.defineProperty(exports, "EVENT_PAD_MS", {
|
|
26679
|
+
enumerable: true,
|
|
26680
|
+
get: function() {
|
|
26681
|
+
return EVENT_PAD_MS;
|
|
26682
|
+
}
|
|
26683
|
+
});
|
|
26684
|
+
Object.defineProperty(exports, "EventCategory", {
|
|
26685
|
+
enumerable: true,
|
|
26686
|
+
get: function() {
|
|
26687
|
+
return EventCategory;
|
|
26688
|
+
}
|
|
26689
|
+
});
|
|
26690
|
+
Object.defineProperty(exports, "MACRO_LABELS", {
|
|
26691
|
+
enumerable: true,
|
|
26692
|
+
get: function() {
|
|
26693
|
+
return MACRO_LABELS;
|
|
26694
|
+
}
|
|
26695
|
+
});
|
|
26696
|
+
Object.defineProperty(exports, "NC_CONDITION_CATALOG", {
|
|
26697
|
+
enumerable: true,
|
|
26698
|
+
get: function() {
|
|
26699
|
+
return NC_CONDITION_CATALOG;
|
|
26700
|
+
}
|
|
26701
|
+
});
|
|
26702
|
+
Object.defineProperty(exports, "NC_TAXONOMY", {
|
|
26703
|
+
enumerable: true,
|
|
26704
|
+
get: function() {
|
|
26705
|
+
return NC_TAXONOMY;
|
|
26706
|
+
}
|
|
26707
|
+
});
|
|
26708
|
+
Object.defineProperty(exports, "NcConditionDescriptorSchema", {
|
|
26709
|
+
enumerable: true,
|
|
26710
|
+
get: function() {
|
|
26711
|
+
return NcConditionDescriptorSchema;
|
|
26712
|
+
}
|
|
26713
|
+
});
|
|
26714
|
+
Object.defineProperty(exports, "NcRuleInputSchema", {
|
|
26715
|
+
enumerable: true,
|
|
26716
|
+
get: function() {
|
|
26717
|
+
return NcRuleInputSchema;
|
|
26718
|
+
}
|
|
26719
|
+
});
|
|
26720
|
+
Object.defineProperty(exports, "NcRulePatchSchema", {
|
|
26721
|
+
enumerable: true,
|
|
26722
|
+
get: function() {
|
|
26723
|
+
return NcRulePatchSchema;
|
|
26724
|
+
}
|
|
26725
|
+
});
|
|
26726
|
+
Object.defineProperty(exports, "NcRuleSchema", {
|
|
26727
|
+
enumerable: true,
|
|
26728
|
+
get: function() {
|
|
26729
|
+
return NcRuleSchema;
|
|
26730
|
+
}
|
|
26731
|
+
});
|
|
26732
|
+
Object.defineProperty(exports, "NcTaxonomySchema", {
|
|
26733
|
+
enumerable: true,
|
|
26734
|
+
get: function() {
|
|
26735
|
+
return NcTaxonomySchema;
|
|
26736
|
+
}
|
|
26737
|
+
});
|
|
26738
|
+
Object.defineProperty(exports, "OpsLogEntrySchema", {
|
|
26739
|
+
enumerable: true,
|
|
26740
|
+
get: function() {
|
|
26741
|
+
return OpsLogEntrySchema;
|
|
26742
|
+
}
|
|
26743
|
+
});
|
|
26744
|
+
Object.defineProperty(exports, "__toESM", {
|
|
26745
|
+
enumerable: true,
|
|
26746
|
+
get: function() {
|
|
26747
|
+
return __toESM;
|
|
26748
|
+
}
|
|
26749
|
+
});
|
|
26750
|
+
Object.defineProperty(exports, "addonWidgetsSourceCapability", {
|
|
26751
|
+
enumerable: true,
|
|
26752
|
+
get: function() {
|
|
26753
|
+
return addonWidgetsSourceCapability;
|
|
26754
|
+
}
|
|
26755
|
+
});
|
|
26756
|
+
Object.defineProperty(exports, "array", {
|
|
26757
|
+
enumerable: true,
|
|
26758
|
+
get: function() {
|
|
26759
|
+
return array;
|
|
26760
|
+
}
|
|
26761
|
+
});
|
|
26762
|
+
Object.defineProperty(exports, "audioMetricsCapability", {
|
|
26763
|
+
enumerable: true,
|
|
26764
|
+
get: function() {
|
|
26765
|
+
return audioMetricsCapability;
|
|
26766
|
+
}
|
|
26767
|
+
});
|
|
26768
|
+
Object.defineProperty(exports, "boolean", {
|
|
26769
|
+
enumerable: true,
|
|
26770
|
+
get: function() {
|
|
26771
|
+
return boolean;
|
|
26772
|
+
}
|
|
26773
|
+
});
|
|
26774
|
+
Object.defineProperty(exports, "buildEventKindDescriptor", {
|
|
26775
|
+
enumerable: true,
|
|
26776
|
+
get: function() {
|
|
26777
|
+
return buildEventKindDescriptor;
|
|
26778
|
+
}
|
|
26779
|
+
});
|
|
26780
|
+
Object.defineProperty(exports, "cosineSimilarity", {
|
|
26781
|
+
enumerable: true,
|
|
26782
|
+
get: function() {
|
|
26783
|
+
return cosineSimilarity;
|
|
26784
|
+
}
|
|
26785
|
+
});
|
|
26786
|
+
Object.defineProperty(exports, "createEvent", {
|
|
26787
|
+
enumerable: true,
|
|
26788
|
+
get: function() {
|
|
26789
|
+
return createEvent;
|
|
26790
|
+
}
|
|
26791
|
+
});
|
|
26792
|
+
Object.defineProperty(exports, "customAction", {
|
|
26793
|
+
enumerable: true,
|
|
26794
|
+
get: function() {
|
|
26795
|
+
return customAction;
|
|
26796
|
+
}
|
|
26797
|
+
});
|
|
26798
|
+
Object.defineProperty(exports, "defineCustomActions", {
|
|
26799
|
+
enumerable: true,
|
|
26800
|
+
get: function() {
|
|
26801
|
+
return defineCustomActions;
|
|
26802
|
+
}
|
|
26803
|
+
});
|
|
26804
|
+
Object.defineProperty(exports, "embeddingEncoderCapability", {
|
|
26805
|
+
enumerable: true,
|
|
26806
|
+
get: function() {
|
|
26807
|
+
return embeddingEncoderCapability;
|
|
26808
|
+
}
|
|
26809
|
+
});
|
|
26810
|
+
Object.defineProperty(exports, "errMsg", {
|
|
26811
|
+
enumerable: true,
|
|
26812
|
+
get: function() {
|
|
26813
|
+
return errMsg;
|
|
26814
|
+
}
|
|
26815
|
+
});
|
|
26816
|
+
Object.defineProperty(exports, "faceGalleryCapability", {
|
|
26817
|
+
enumerable: true,
|
|
26818
|
+
get: function() {
|
|
26819
|
+
return faceGalleryCapability;
|
|
26820
|
+
}
|
|
26821
|
+
});
|
|
26822
|
+
Object.defineProperty(exports, "hfModelUrl", {
|
|
26823
|
+
enumerable: true,
|
|
26824
|
+
get: function() {
|
|
26825
|
+
return hfModelUrl;
|
|
26826
|
+
}
|
|
26827
|
+
});
|
|
26828
|
+
Object.defineProperty(exports, "hydrateSchema", {
|
|
26829
|
+
enumerable: true,
|
|
26830
|
+
get: function() {
|
|
26831
|
+
return hydrateSchema;
|
|
26832
|
+
}
|
|
26833
|
+
});
|
|
26834
|
+
Object.defineProperty(exports, "literal", {
|
|
26835
|
+
enumerable: true,
|
|
26836
|
+
get: function() {
|
|
26837
|
+
return literal;
|
|
26838
|
+
}
|
|
26839
|
+
});
|
|
26840
|
+
Object.defineProperty(exports, "nodePin", {
|
|
26841
|
+
enumerable: true,
|
|
26842
|
+
get: function() {
|
|
26843
|
+
return nodePin;
|
|
26844
|
+
}
|
|
26845
|
+
});
|
|
26846
|
+
Object.defineProperty(exports, "notificationRulesCapability", {
|
|
26847
|
+
enumerable: true,
|
|
26848
|
+
get: function() {
|
|
26849
|
+
return notificationRulesCapability;
|
|
26850
|
+
}
|
|
26851
|
+
});
|
|
26852
|
+
Object.defineProperty(exports, "number", {
|
|
26853
|
+
enumerable: true,
|
|
26854
|
+
get: function() {
|
|
26855
|
+
return number;
|
|
26856
|
+
}
|
|
26857
|
+
});
|
|
26858
|
+
Object.defineProperty(exports, "object", {
|
|
26859
|
+
enumerable: true,
|
|
26860
|
+
get: function() {
|
|
26861
|
+
return object;
|
|
26862
|
+
}
|
|
26863
|
+
});
|
|
26864
|
+
Object.defineProperty(exports, "pipelineAnalyticsCapability", {
|
|
26865
|
+
enumerable: true,
|
|
26866
|
+
get: function() {
|
|
26867
|
+
return pipelineAnalyticsCapability;
|
|
26868
|
+
}
|
|
26869
|
+
});
|
|
26870
|
+
Object.defineProperty(exports, "plateGalleryCapability", {
|
|
26871
|
+
enumerable: true,
|
|
26872
|
+
get: function() {
|
|
26873
|
+
return plateGalleryCapability;
|
|
26874
|
+
}
|
|
26875
|
+
});
|
|
26876
|
+
Object.defineProperty(exports, "string", {
|
|
26877
|
+
enumerable: true,
|
|
26878
|
+
get: function() {
|
|
26879
|
+
return string;
|
|
26880
|
+
}
|
|
26881
|
+
});
|
|
26882
|
+
Object.defineProperty(exports, "subKindsOf", {
|
|
26883
|
+
enumerable: true,
|
|
26884
|
+
get: function() {
|
|
26885
|
+
return subKindsOf;
|
|
26886
|
+
}
|
|
26887
|
+
});
|
|
26888
|
+
Object.defineProperty(exports, "videoclipsCapability", {
|
|
26889
|
+
enumerable: true,
|
|
26890
|
+
get: function() {
|
|
26891
|
+
return videoclipsCapability;
|
|
26892
|
+
}
|
|
26893
|
+
});
|
|
26894
|
+
Object.defineProperty(exports, "zoneAnalyticsCapability", {
|
|
26895
|
+
enumerable: true,
|
|
26896
|
+
get: function() {
|
|
26897
|
+
return zoneAnalyticsCapability;
|
|
26898
|
+
}
|
|
26899
|
+
});
|