@camstack/addon-decoder-nodeav 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1134 -582
- package/dist/index.mjs +1134 -582
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
6
|
-
//#region ../types/dist/event-category-
|
|
6
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
7
7
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
8
8
|
EventCategory["SystemBoot"] = "system.boot";
|
|
9
9
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -153,9 +153,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
153
153
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
154
154
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
155
155
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
156
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
157
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
158
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
159
156
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
160
157
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
161
158
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -6820,7 +6817,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
|
6820
6817
|
patch: record(string(), unknown())
|
|
6821
6818
|
}), object({ success: literal(true) });
|
|
6822
6819
|
object({ deviceId: number() }), unknown().nullable();
|
|
6823
|
-
/** Shorthand to define a method schema */
|
|
6824
6820
|
function method(input, output, options) {
|
|
6825
6821
|
return {
|
|
6826
6822
|
input,
|
|
@@ -6828,6 +6824,7 @@ function method(input, output, options) {
|
|
|
6828
6824
|
kind: options?.kind ?? "query",
|
|
6829
6825
|
auth: options?.auth ?? "protected",
|
|
6830
6826
|
...options?.access !== void 0 ? { access: options.access } : {},
|
|
6827
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
6831
6828
|
timeoutMs: options?.timeoutMs
|
|
6832
6829
|
};
|
|
6833
6830
|
}
|
|
@@ -8193,6 +8190,59 @@ for (const l of AUDIO_MACRO_LABELS) {
|
|
|
8193
8190
|
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8194
8191
|
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8195
8192
|
/**
|
|
8193
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8194
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8195
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8196
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8197
|
+
*
|
|
8198
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8199
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8200
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8201
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8202
|
+
* the same class picker, grouped under an Audio header.
|
|
8203
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8204
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8205
|
+
*
|
|
8206
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8207
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8208
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8209
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8210
|
+
*/
|
|
8211
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8212
|
+
var NcTaxonomyEntrySchema = object({
|
|
8213
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8214
|
+
kind: string(),
|
|
8215
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8216
|
+
label: string(),
|
|
8217
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8218
|
+
parentKind: string().nullable()
|
|
8219
|
+
});
|
|
8220
|
+
object({
|
|
8221
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8222
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8223
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8224
|
+
});
|
|
8225
|
+
function toEntry(kind, label, parentKind) {
|
|
8226
|
+
return {
|
|
8227
|
+
kind,
|
|
8228
|
+
label,
|
|
8229
|
+
parentKind
|
|
8230
|
+
};
|
|
8231
|
+
}
|
|
8232
|
+
/**
|
|
8233
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8234
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8235
|
+
*/
|
|
8236
|
+
function buildNcTaxonomy() {
|
|
8237
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8238
|
+
return {
|
|
8239
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8240
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8241
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8242
|
+
};
|
|
8243
|
+
}
|
|
8244
|
+
Object.freeze(buildNcTaxonomy());
|
|
8245
|
+
/**
|
|
8196
8246
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8197
8247
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8198
8248
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -10901,6 +10951,22 @@ var CameraMetricsSchema = object({
|
|
|
10901
10951
|
])
|
|
10902
10952
|
});
|
|
10903
10953
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
10954
|
+
/**
|
|
10955
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
10956
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
10957
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
10958
|
+
*/
|
|
10959
|
+
var NativeCropRefSchema = object({
|
|
10960
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
10961
|
+
handle: FrameHandleSchema,
|
|
10962
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
10963
|
+
cropFrameSpace: object({
|
|
10964
|
+
x: number(),
|
|
10965
|
+
y: number(),
|
|
10966
|
+
w: number(),
|
|
10967
|
+
h: number()
|
|
10968
|
+
})
|
|
10969
|
+
});
|
|
10904
10970
|
var ModelFormatSchema$1 = _enum([
|
|
10905
10971
|
"onnx",
|
|
10906
10972
|
"coreml",
|
|
@@ -11176,7 +11242,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
11176
11242
|
* Omitted ⇒ the runner's default device (current single-engine
|
|
11177
11243
|
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
11178
11244
|
*/
|
|
11179
|
-
deviceKey: string().optional()
|
|
11245
|
+
deviceKey: string().optional(),
|
|
11246
|
+
/**
|
|
11247
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
11248
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
11249
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
11250
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
11251
|
+
* resolution from that surface — the SAME quality path faces already
|
|
11252
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
11253
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
11254
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
11255
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
11256
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
11257
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
11258
|
+
* (today's behaviour on the fallback path).
|
|
11259
|
+
*/
|
|
11260
|
+
nativeCropRef: NativeCropRefSchema.optional()
|
|
11180
11261
|
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
11181
11262
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
11182
11263
|
steps: array(PipelineStepInputSchema).min(1),
|
|
@@ -11392,7 +11473,11 @@ var DetailResultSchema = object({
|
|
|
11392
11473
|
bbox: NativeCropBboxSchema.optional(),
|
|
11393
11474
|
embedding: string().optional(),
|
|
11394
11475
|
label: string().optional(),
|
|
11395
|
-
alignedCropJpeg: string().optional()
|
|
11476
|
+
alignedCropJpeg: string().optional(),
|
|
11477
|
+
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
11478
|
+
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
11479
|
+
* consumers MUST prefer this when present (2026-07-22 native-gate fix). */
|
|
11480
|
+
nativeFaceShortSidePx: number().optional()
|
|
11396
11481
|
});
|
|
11397
11482
|
/**
|
|
11398
11483
|
* Per-camera tunable ranges + defaults. Single source of truth used
|
|
@@ -11406,6 +11491,12 @@ var motionCooldownMsField = {
|
|
|
11406
11491
|
default: 3e4,
|
|
11407
11492
|
step: 500
|
|
11408
11493
|
};
|
|
11494
|
+
var maxSessionHoldMsField = {
|
|
11495
|
+
min: 0,
|
|
11496
|
+
max: 6e5,
|
|
11497
|
+
default: 12e4,
|
|
11498
|
+
step: 5e3
|
|
11499
|
+
};
|
|
11409
11500
|
var motionFpsField = {
|
|
11410
11501
|
min: 1,
|
|
11411
11502
|
max: 30,
|
|
@@ -11553,6 +11644,19 @@ var RunnerCameraConfigSchema = object({
|
|
|
11553
11644
|
"on-motion"
|
|
11554
11645
|
]).default("always-on"),
|
|
11555
11646
|
motionCooldownMs: number().min(motionCooldownMsField.min).default(motionCooldownMsField.default),
|
|
11647
|
+
/**
|
|
11648
|
+
* Orchestrator-side on-motion session-hold cap (ms). While an on-motion
|
|
11649
|
+
* detection session is active and ≥1 confirmed non-stationary track is
|
|
11650
|
+
* still live, the orchestrator keeps the session open past
|
|
11651
|
+
* `motionCooldownMs` (a slowly-moving subject can stop re-triggering the
|
|
11652
|
+
* camera's VMD yet is still being tracked frame-to-frame) — up to this many
|
|
11653
|
+
* ms since the session opened, after which it closes regardless. `0`
|
|
11654
|
+
* disables the hold (legacy cooldown-only teardown). Not consumed by the
|
|
11655
|
+
* runner itself — carried here so it shares the per-camera device-settings
|
|
11656
|
+
* surface with `motionCooldownMs`; the orchestrator reads it off the
|
|
11657
|
+
* resolved `CameraDetectionConfig`.
|
|
11658
|
+
*/
|
|
11659
|
+
maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
|
|
11556
11660
|
motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
|
|
11557
11661
|
detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
|
|
11558
11662
|
motionStreamId: string(),
|
|
@@ -11642,7 +11746,7 @@ var RunnerCameraConfigSchema = object({
|
|
|
11642
11746
|
*/
|
|
11643
11747
|
inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
|
|
11644
11748
|
});
|
|
11645
|
-
motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
|
|
11749
|
+
motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
|
|
11646
11750
|
/**
|
|
11647
11751
|
* Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
|
|
11648
11752
|
* load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
|
|
@@ -13496,94 +13600,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
13496
13600
|
bundleUrl: string()
|
|
13497
13601
|
});
|
|
13498
13602
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
13499
|
-
var NotificationRuleConditionsSchema = object({
|
|
13500
|
-
deviceIds: array(number()).readonly().optional(),
|
|
13501
|
-
classNames: array(string()).readonly().optional(),
|
|
13502
|
-
zoneIds: array(string()).readonly().optional(),
|
|
13503
|
-
minConfidence: number().optional(),
|
|
13504
|
-
source: _enum([
|
|
13505
|
-
"pipeline",
|
|
13506
|
-
"onboard",
|
|
13507
|
-
"any"
|
|
13508
|
-
]).optional(),
|
|
13509
|
-
schedule: object({
|
|
13510
|
-
days: array(number()).readonly(),
|
|
13511
|
-
startHour: number(),
|
|
13512
|
-
endHour: number()
|
|
13513
|
-
}).optional(),
|
|
13514
|
-
cooldownSeconds: number().optional(),
|
|
13515
|
-
minDwellSeconds: number().optional(),
|
|
13516
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
13517
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
13518
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
13519
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
13520
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
13521
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
13522
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
13523
|
-
clipDescription: object({
|
|
13524
|
-
text: string().min(1),
|
|
13525
|
-
minSimilarity: number().min(0).max(1)
|
|
13526
|
-
}).optional(),
|
|
13527
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
13528
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
13529
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
13530
|
-
* vehicle/person> is seen". */
|
|
13531
|
-
labels: array(string()).readonly().optional()
|
|
13532
|
-
});
|
|
13533
|
-
var NotificationRuleTemplateSchema = object({
|
|
13534
|
-
title: string(),
|
|
13535
|
-
body: string(),
|
|
13536
|
-
imageMode: _enum([
|
|
13537
|
-
"crop",
|
|
13538
|
-
"annotated",
|
|
13539
|
-
"full",
|
|
13540
|
-
"none"
|
|
13541
|
-
])
|
|
13542
|
-
});
|
|
13543
|
-
var NotificationRuleSchema = object({
|
|
13544
|
-
id: string(),
|
|
13545
|
-
name: string(),
|
|
13546
|
-
enabled: boolean(),
|
|
13547
|
-
eventTypes: array(string()).readonly(),
|
|
13548
|
-
conditions: NotificationRuleConditionsSchema,
|
|
13549
|
-
outputs: array(string()).readonly(),
|
|
13550
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
13551
|
-
priority: _enum([
|
|
13552
|
-
"low",
|
|
13553
|
-
"normal",
|
|
13554
|
-
"high",
|
|
13555
|
-
"critical"
|
|
13556
|
-
])
|
|
13557
|
-
});
|
|
13558
|
-
var NotificationTestResultSchema = object({
|
|
13559
|
-
ruleId: string(),
|
|
13560
|
-
eventId: string(),
|
|
13561
|
-
timestamp: number(),
|
|
13562
|
-
wouldFire: boolean(),
|
|
13563
|
-
reason: string().optional()
|
|
13564
|
-
});
|
|
13565
|
-
var NotificationHistoryEntrySchema = object({
|
|
13566
|
-
id: string(),
|
|
13567
|
-
ruleId: string(),
|
|
13568
|
-
ruleName: string(),
|
|
13569
|
-
eventId: string(),
|
|
13570
|
-
timestamp: number(),
|
|
13571
|
-
outputs: array(string()).readonly(),
|
|
13572
|
-
success: boolean(),
|
|
13573
|
-
error: string().optional(),
|
|
13574
|
-
deviceId: number().optional()
|
|
13575
|
-
});
|
|
13576
|
-
var NotificationHistoryFilterSchema = object({
|
|
13577
|
-
ruleId: string().optional(),
|
|
13578
|
-
deviceId: number().optional(),
|
|
13579
|
-
from: number().optional(),
|
|
13580
|
-
to: number().optional(),
|
|
13581
|
-
limit: number().optional()
|
|
13582
|
-
});
|
|
13583
|
-
method(_void(), object({ rules: array(NotificationRuleSchema).readonly() })), method(object({ rule: NotificationRuleSchema }), object({ success: literal(true) }), { kind: "mutation" }), method(object({ ruleId: string() }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
|
|
13584
|
-
ruleId: string(),
|
|
13585
|
-
lookbackMinutes: number()
|
|
13586
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
13587
13603
|
/**
|
|
13588
13604
|
* Alerts capability — collection-based internal alert system.
|
|
13589
13605
|
*
|
|
@@ -13807,89 +13823,6 @@ method(object({
|
|
|
13807
13823
|
password: string()
|
|
13808
13824
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
13809
13825
|
/**
|
|
13810
|
-
* `login-method` — collection cap through which auth addons contribute
|
|
13811
|
-
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
13812
|
-
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
13813
|
-
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
13814
|
-
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
13815
|
-
* procedure aggregates them for the unauthenticated login page.
|
|
13816
|
-
*
|
|
13817
|
-
* A contribution is a discriminated union on `kind`:
|
|
13818
|
-
*
|
|
13819
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
13820
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
13821
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
13822
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
13823
|
-
* login page needs NO change.
|
|
13824
|
-
*
|
|
13825
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
13826
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
13827
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
13828
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
13829
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
13830
|
-
*
|
|
13831
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
13832
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
13833
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
13834
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
13835
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
13836
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
13837
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
13838
|
-
* decision.
|
|
13839
|
-
*
|
|
13840
|
-
* Every contribution carries a `stage`:
|
|
13841
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
13842
|
-
* magic-link buttons; a future usernameless passkey).
|
|
13843
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
13844
|
-
* returned `factors` (passkey-as-2FA today).
|
|
13845
|
-
*
|
|
13846
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
13847
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
13848
|
-
* tRPC router.
|
|
13849
|
-
*/
|
|
13850
|
-
/** When a login method renders in the two-phase login flow. */
|
|
13851
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
13852
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
13853
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
13854
|
-
object({
|
|
13855
|
-
kind: literal("redirect"),
|
|
13856
|
-
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
13857
|
-
id: string(),
|
|
13858
|
-
/** Operator-facing button label. */
|
|
13859
|
-
label: string(),
|
|
13860
|
-
/** lucide-react icon name. */
|
|
13861
|
-
icon: string().optional(),
|
|
13862
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
13863
|
-
startUrl: string(),
|
|
13864
|
-
stage: LoginStageEnum
|
|
13865
|
-
}),
|
|
13866
|
-
object({
|
|
13867
|
-
kind: literal("widget"),
|
|
13868
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
13869
|
-
id: string(),
|
|
13870
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
13871
|
-
addonId: string(),
|
|
13872
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
13873
|
-
bundle: string(),
|
|
13874
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
13875
|
-
remote: WidgetRemoteSchema,
|
|
13876
|
-
stage: LoginStageEnum
|
|
13877
|
-
}),
|
|
13878
|
-
object({
|
|
13879
|
-
kind: literal("passkey"),
|
|
13880
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
13881
|
-
id: string(),
|
|
13882
|
-
/** Operator-facing button label. */
|
|
13883
|
-
label: string(),
|
|
13884
|
-
stage: LoginStageEnum,
|
|
13885
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
13886
|
-
rpId: string(),
|
|
13887
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
13888
|
-
origin: string().nullable()
|
|
13889
|
-
})
|
|
13890
|
-
]);
|
|
13891
|
-
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
13892
|
-
/**
|
|
13893
13826
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
13894
13827
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
13895
13828
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -15326,48 +15259,423 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
15326
15259
|
kind: "mutation",
|
|
15327
15260
|
auth: "admin"
|
|
15328
15261
|
});
|
|
15329
|
-
|
|
15330
|
-
|
|
15331
|
-
|
|
15332
|
-
|
|
15333
|
-
|
|
15262
|
+
/**
|
|
15263
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15264
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15265
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
15266
|
+
*
|
|
15267
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15268
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
15269
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15270
|
+
*/
|
|
15271
|
+
var LlmUsageSchema = object({
|
|
15272
|
+
inputTokens: number(),
|
|
15273
|
+
outputTokens: number()
|
|
15274
|
+
});
|
|
15275
|
+
var LlmErrorCodeSchema = _enum([
|
|
15276
|
+
"timeout",
|
|
15277
|
+
"rate-limited",
|
|
15278
|
+
"auth",
|
|
15279
|
+
"refusal",
|
|
15280
|
+
"bad-request",
|
|
15281
|
+
"unavailable",
|
|
15282
|
+
"no-profile",
|
|
15283
|
+
"budget-exceeded",
|
|
15284
|
+
"adapter-error"
|
|
15334
15285
|
]);
|
|
15335
|
-
var
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
|
|
15286
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15287
|
+
ok: literal(true),
|
|
15288
|
+
text: string(),
|
|
15289
|
+
model: string(),
|
|
15290
|
+
usage: LlmUsageSchema,
|
|
15291
|
+
truncated: boolean(),
|
|
15292
|
+
latencyMs: number()
|
|
15293
|
+
}), object({
|
|
15294
|
+
ok: literal(false),
|
|
15295
|
+
code: LlmErrorCodeSchema,
|
|
15339
15296
|
message: string(),
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
}), array(LogEntrySchema).readonly());
|
|
15351
|
-
var CpuBreakdownSchema = object({
|
|
15352
|
-
total: number(),
|
|
15353
|
-
user: number(),
|
|
15354
|
-
system: number(),
|
|
15355
|
-
irq: number(),
|
|
15356
|
-
nice: number(),
|
|
15357
|
-
loadAvg: tuple([
|
|
15358
|
-
number(),
|
|
15359
|
-
number(),
|
|
15360
|
-
number()
|
|
15361
|
-
]),
|
|
15362
|
-
cores: number()
|
|
15297
|
+
retryAfterMs: number().optional()
|
|
15298
|
+
})]);
|
|
15299
|
+
/**
|
|
15300
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15301
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15302
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
15303
|
+
*/
|
|
15304
|
+
var LlmImageSchema = object({
|
|
15305
|
+
bytes: _instanceof(Uint8Array),
|
|
15306
|
+
mimeType: string()
|
|
15363
15307
|
});
|
|
15364
|
-
var
|
|
15365
|
-
|
|
15366
|
-
|
|
15367
|
-
|
|
15368
|
-
|
|
15369
|
-
|
|
15370
|
-
|
|
15308
|
+
var LlmGenerateBaseInputSchema = object({
|
|
15309
|
+
/** Collection routing (the notification-output posture). */
|
|
15310
|
+
addonId: string().optional(),
|
|
15311
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15312
|
+
profileId: string().optional(),
|
|
15313
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15314
|
+
consumer: string(),
|
|
15315
|
+
system: string().optional(),
|
|
15316
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15317
|
+
prompt: string(),
|
|
15318
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15319
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
15320
|
+
/** Per-call override of the profile default. */
|
|
15321
|
+
maxTokens: number().int().positive().optional(),
|
|
15322
|
+
temperature: number().optional()
|
|
15323
|
+
});
|
|
15324
|
+
/**
|
|
15325
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15326
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15327
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15328
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15329
|
+
* this only through the `llm` cap's methods.
|
|
15330
|
+
*
|
|
15331
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15332
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15333
|
+
* watchdog — operator decision #3).
|
|
15334
|
+
*/
|
|
15335
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15336
|
+
object({
|
|
15337
|
+
kind: literal("catalog"),
|
|
15338
|
+
catalogId: string()
|
|
15339
|
+
}),
|
|
15340
|
+
object({
|
|
15341
|
+
kind: literal("url"),
|
|
15342
|
+
url: string(),
|
|
15343
|
+
sha256: string().optional()
|
|
15344
|
+
}),
|
|
15345
|
+
object({
|
|
15346
|
+
kind: literal("path"),
|
|
15347
|
+
path: string()
|
|
15348
|
+
})
|
|
15349
|
+
]);
|
|
15350
|
+
var ManagedRuntimeConfigSchema = object({
|
|
15351
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
15352
|
+
nodeId: string(),
|
|
15353
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15354
|
+
engine: _enum(["llama-cpp"]),
|
|
15355
|
+
model: ManagedModelRefSchema,
|
|
15356
|
+
contextSize: number().int().default(4096),
|
|
15357
|
+
/** 0 = CPU-only. */
|
|
15358
|
+
gpuLayers: number().int().default(0),
|
|
15359
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15360
|
+
threads: number().int().optional(),
|
|
15361
|
+
/** Concurrent slots. */
|
|
15362
|
+
parallel: number().int().default(1),
|
|
15363
|
+
/** Else lazy: first generate boots it. */
|
|
15364
|
+
autoStart: boolean().default(false),
|
|
15365
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
15366
|
+
idleStopMinutes: number().int().default(30)
|
|
15367
|
+
});
|
|
15368
|
+
var LlmRuntimeStatusSchema = object({
|
|
15369
|
+
/** Status is ALWAYS node-qualified. */
|
|
15370
|
+
nodeId: string(),
|
|
15371
|
+
state: _enum([
|
|
15372
|
+
"stopped",
|
|
15373
|
+
"downloading",
|
|
15374
|
+
"starting",
|
|
15375
|
+
"ready",
|
|
15376
|
+
"crashed",
|
|
15377
|
+
"failed"
|
|
15378
|
+
]),
|
|
15379
|
+
pid: number().optional(),
|
|
15380
|
+
port: number().optional(),
|
|
15381
|
+
modelPath: string().optional(),
|
|
15382
|
+
modelId: string().optional(),
|
|
15383
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
15384
|
+
lastError: string().optional(),
|
|
15385
|
+
crashesInWindow: number(),
|
|
15386
|
+
/** Child RSS (sampled best-effort). */
|
|
15387
|
+
memoryBytes: number().optional(),
|
|
15388
|
+
vramBytes: number().optional()
|
|
15389
|
+
});
|
|
15390
|
+
var LlmNodeModelSchema = object({
|
|
15391
|
+
file: string(),
|
|
15392
|
+
sizeBytes: number(),
|
|
15393
|
+
catalogId: string().optional(),
|
|
15394
|
+
installedAt: number().optional()
|
|
15395
|
+
});
|
|
15396
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
15397
|
+
nodeId: string(),
|
|
15398
|
+
modelsBytes: number(),
|
|
15399
|
+
freeBytes: number().optional()
|
|
15400
|
+
});
|
|
15401
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
15402
|
+
images: array(LlmImageSchema).optional(),
|
|
15403
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
15404
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15405
|
+
timeoutMs: number().int().positive().optional()
|
|
15406
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15407
|
+
kind: "mutation",
|
|
15408
|
+
auth: "admin"
|
|
15409
|
+
}), method(object({}), _void(), {
|
|
15410
|
+
kind: "mutation",
|
|
15411
|
+
auth: "admin"
|
|
15412
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15413
|
+
kind: "mutation",
|
|
15414
|
+
auth: "admin"
|
|
15415
|
+
}), method(object({ file: string() }), _void(), {
|
|
15416
|
+
kind: "mutation",
|
|
15417
|
+
auth: "admin"
|
|
15418
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15419
|
+
/**
|
|
15420
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
15421
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
15422
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
15423
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15424
|
+
* (hub-placed); the cap stays open for future providers.
|
|
15425
|
+
*
|
|
15426
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15427
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15428
|
+
* write; a stored key NEVER round-trips to a client.
|
|
15429
|
+
*/
|
|
15430
|
+
var LlmProfileKindSchema = _enum([
|
|
15431
|
+
"openai-compatible",
|
|
15432
|
+
"openai",
|
|
15433
|
+
"anthropic",
|
|
15434
|
+
"google",
|
|
15435
|
+
"managed-local"
|
|
15436
|
+
]);
|
|
15437
|
+
var LlmProfileSchema = object({
|
|
15438
|
+
id: string(),
|
|
15439
|
+
name: string(),
|
|
15440
|
+
kind: LlmProfileKindSchema,
|
|
15441
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
15442
|
+
addonId: string(),
|
|
15443
|
+
enabled: boolean(),
|
|
15444
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
15445
|
+
model: string(),
|
|
15446
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
15447
|
+
baseUrl: string().optional(),
|
|
15448
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
15449
|
+
apiKey: string().optional(),
|
|
15450
|
+
supportsVision: boolean(),
|
|
15451
|
+
temperature: number().min(0).max(2).optional(),
|
|
15452
|
+
maxTokens: number().int().positive().optional(),
|
|
15453
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
15454
|
+
extraHeaders: record(string(), string()).optional(),
|
|
15455
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
15456
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15457
|
+
});
|
|
15458
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
15459
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
15460
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
15461
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
15462
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
15463
|
+
kind: LlmProfileKindSchema,
|
|
15464
|
+
label: string(),
|
|
15465
|
+
icon: string(),
|
|
15466
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15467
|
+
addonId: string(),
|
|
15468
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
15469
|
+
});
|
|
15470
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
15471
|
+
var LlmDefaultSchema = object({
|
|
15472
|
+
selector: LlmDefaultSelectorSchema,
|
|
15473
|
+
profileId: string()
|
|
15474
|
+
});
|
|
15475
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
15476
|
+
var LlmUsageRollupSchema = object({
|
|
15477
|
+
day: string(),
|
|
15478
|
+
consumer: string(),
|
|
15479
|
+
profileId: string(),
|
|
15480
|
+
calls: number(),
|
|
15481
|
+
okCalls: number(),
|
|
15482
|
+
errorCalls: number(),
|
|
15483
|
+
inputTokens: number(),
|
|
15484
|
+
outputTokens: number(),
|
|
15485
|
+
avgLatencyMs: number()
|
|
15486
|
+
});
|
|
15487
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
15488
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
15489
|
+
id: string(),
|
|
15490
|
+
label: string(),
|
|
15491
|
+
family: string(),
|
|
15492
|
+
purpose: _enum(["text", "vision"]),
|
|
15493
|
+
url: string(),
|
|
15494
|
+
sha256: string(),
|
|
15495
|
+
sizeBytes: number(),
|
|
15496
|
+
quantization: string(),
|
|
15497
|
+
/** Load-time guidance shown in the picker. */
|
|
15498
|
+
minRamBytes: number(),
|
|
15499
|
+
contextSizeDefault: number().int(),
|
|
15500
|
+
/** Vision models: companion projector file. */
|
|
15501
|
+
mmprojUrl: string().optional()
|
|
15502
|
+
});
|
|
15503
|
+
var LlmRuntimeNodeSchema = object({
|
|
15504
|
+
nodeId: string(),
|
|
15505
|
+
reachable: boolean(),
|
|
15506
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
15507
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15508
|
+
error: string().optional()
|
|
15509
|
+
});
|
|
15510
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
15511
|
+
var ProfileRefInputSchema = object({
|
|
15512
|
+
addonId: string(),
|
|
15513
|
+
profileId: string()
|
|
15514
|
+
});
|
|
15515
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
15516
|
+
kind: "mutation",
|
|
15517
|
+
auth: "admin"
|
|
15518
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
15519
|
+
kind: "mutation",
|
|
15520
|
+
auth: "admin"
|
|
15521
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
15522
|
+
kind: "mutation",
|
|
15523
|
+
auth: "admin"
|
|
15524
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
15525
|
+
selector: LlmDefaultSelectorSchema,
|
|
15526
|
+
profileId: string().nullable()
|
|
15527
|
+
}), _void(), {
|
|
15528
|
+
kind: "mutation",
|
|
15529
|
+
auth: "admin"
|
|
15530
|
+
}), method(object({
|
|
15531
|
+
since: number().optional(),
|
|
15532
|
+
until: number().optional(),
|
|
15533
|
+
consumer: string().optional(),
|
|
15534
|
+
profileId: string().optional()
|
|
15535
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
15536
|
+
nodeId: string(),
|
|
15537
|
+
model: ManagedModelRefSchema
|
|
15538
|
+
}), _void(), {
|
|
15539
|
+
kind: "mutation",
|
|
15540
|
+
auth: "admin"
|
|
15541
|
+
}), method(object({
|
|
15542
|
+
nodeId: string(),
|
|
15543
|
+
file: string()
|
|
15544
|
+
}), _void(), {
|
|
15545
|
+
kind: "mutation",
|
|
15546
|
+
auth: "admin"
|
|
15547
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
15548
|
+
kind: "mutation",
|
|
15549
|
+
auth: "admin"
|
|
15550
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
15551
|
+
kind: "mutation",
|
|
15552
|
+
auth: "admin"
|
|
15553
|
+
});
|
|
15554
|
+
var LogLevelSchema = _enum([
|
|
15555
|
+
"debug",
|
|
15556
|
+
"info",
|
|
15557
|
+
"warn",
|
|
15558
|
+
"error"
|
|
15559
|
+
]);
|
|
15560
|
+
var LogEntrySchema = object({
|
|
15561
|
+
timestamp: date(),
|
|
15562
|
+
level: LogLevelSchema,
|
|
15563
|
+
scope: array(string()),
|
|
15564
|
+
message: string(),
|
|
15565
|
+
meta: record(string(), unknown()).optional(),
|
|
15566
|
+
tags: record(string(), string()).optional()
|
|
15567
|
+
});
|
|
15568
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
15569
|
+
scope: array(string()).optional(),
|
|
15570
|
+
level: LogLevelSchema.optional(),
|
|
15571
|
+
since: date().optional(),
|
|
15572
|
+
until: date().optional(),
|
|
15573
|
+
limit: number().optional(),
|
|
15574
|
+
tags: record(string(), string()).optional()
|
|
15575
|
+
}), array(LogEntrySchema).readonly());
|
|
15576
|
+
/**
|
|
15577
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
15578
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
15579
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
15580
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
15581
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
15582
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
15583
|
+
*
|
|
15584
|
+
* A contribution is a discriminated union on `kind`:
|
|
15585
|
+
*
|
|
15586
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
15587
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
15588
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
15589
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
15590
|
+
* login page needs NO change.
|
|
15591
|
+
*
|
|
15592
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
15593
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
15594
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
15595
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
15596
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
15597
|
+
*
|
|
15598
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
15599
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
15600
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
15601
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
15602
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
15603
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
15604
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
15605
|
+
* decision.
|
|
15606
|
+
*
|
|
15607
|
+
* Every contribution carries a `stage`:
|
|
15608
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
15609
|
+
* magic-link buttons; a future usernameless passkey).
|
|
15610
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
15611
|
+
* returned `factors` (passkey-as-2FA today).
|
|
15612
|
+
*
|
|
15613
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
15614
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
15615
|
+
* tRPC router.
|
|
15616
|
+
*/
|
|
15617
|
+
/** When a login method renders in the two-phase login flow. */
|
|
15618
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
15619
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
15620
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
15621
|
+
object({
|
|
15622
|
+
kind: literal("redirect"),
|
|
15623
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
15624
|
+
id: string(),
|
|
15625
|
+
/** Operator-facing button label. */
|
|
15626
|
+
label: string(),
|
|
15627
|
+
/** lucide-react icon name. */
|
|
15628
|
+
icon: string().optional(),
|
|
15629
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
15630
|
+
startUrl: string(),
|
|
15631
|
+
stage: LoginStageEnum
|
|
15632
|
+
}),
|
|
15633
|
+
object({
|
|
15634
|
+
kind: literal("widget"),
|
|
15635
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
15636
|
+
id: string(),
|
|
15637
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
15638
|
+
addonId: string(),
|
|
15639
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
15640
|
+
bundle: string(),
|
|
15641
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
15642
|
+
remote: WidgetRemoteSchema,
|
|
15643
|
+
stage: LoginStageEnum
|
|
15644
|
+
}),
|
|
15645
|
+
object({
|
|
15646
|
+
kind: literal("passkey"),
|
|
15647
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
15648
|
+
id: string(),
|
|
15649
|
+
/** Operator-facing button label. */
|
|
15650
|
+
label: string(),
|
|
15651
|
+
stage: LoginStageEnum,
|
|
15652
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
15653
|
+
rpId: string(),
|
|
15654
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
15655
|
+
origin: string().nullable()
|
|
15656
|
+
})
|
|
15657
|
+
]);
|
|
15658
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
15659
|
+
var CpuBreakdownSchema = object({
|
|
15660
|
+
total: number(),
|
|
15661
|
+
user: number(),
|
|
15662
|
+
system: number(),
|
|
15663
|
+
irq: number(),
|
|
15664
|
+
nice: number(),
|
|
15665
|
+
loadAvg: tuple([
|
|
15666
|
+
number(),
|
|
15667
|
+
number(),
|
|
15668
|
+
number()
|
|
15669
|
+
]),
|
|
15670
|
+
cores: number()
|
|
15671
|
+
});
|
|
15672
|
+
var MemoryInfoSchema = object({
|
|
15673
|
+
percent: number(),
|
|
15674
|
+
totalBytes: number(),
|
|
15675
|
+
usedBytes: number(),
|
|
15676
|
+
availableBytes: number(),
|
|
15677
|
+
swapUsedBytes: number(),
|
|
15678
|
+
swapTotalBytes: number()
|
|
15371
15679
|
});
|
|
15372
15680
|
var DiskIoSnapshotSchema = object({
|
|
15373
15681
|
readBytes: number(),
|
|
@@ -15820,14 +16128,14 @@ var TargetKindCapsSchema = object({
|
|
|
15820
16128
|
* the union is large and not meant for runtime validation here; the exported
|
|
15821
16129
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
15822
16130
|
*/
|
|
15823
|
-
var ConfigSchemaPassthrough
|
|
16131
|
+
var ConfigSchemaPassthrough = unknown();
|
|
15824
16132
|
var TargetKindSchema = object({
|
|
15825
16133
|
kind: string(),
|
|
15826
16134
|
label: string(),
|
|
15827
16135
|
icon: string(),
|
|
15828
16136
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15829
16137
|
addonId: string(),
|
|
15830
|
-
configSchema: ConfigSchemaPassthrough
|
|
16138
|
+
configSchema: ConfigSchemaPassthrough,
|
|
15831
16139
|
supportsDiscovery: boolean(),
|
|
15832
16140
|
caps: TargetKindCapsSchema
|
|
15833
16141
|
});
|
|
@@ -15880,297 +16188,493 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
15880
16188
|
enabled: boolean()
|
|
15881
16189
|
}), _void(), { kind: "mutation" });
|
|
15882
16190
|
/**
|
|
15883
|
-
*
|
|
15884
|
-
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15885
|
-
* caps stay wire-compatible without a circular cap→cap import.
|
|
16191
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
15886
16192
|
*
|
|
15887
|
-
*
|
|
15888
|
-
*
|
|
15889
|
-
*
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15898
|
-
|
|
15899
|
-
|
|
15900
|
-
|
|
15901
|
-
|
|
15902
|
-
|
|
15903
|
-
|
|
15904
|
-
|
|
15905
|
-
|
|
15906
|
-
|
|
15907
|
-
|
|
15908
|
-
|
|
15909
|
-
|
|
15910
|
-
|
|
15911
|
-
|
|
15912
|
-
|
|
15913
|
-
|
|
15914
|
-
ok: literal(false),
|
|
15915
|
-
code: LlmErrorCodeSchema,
|
|
15916
|
-
message: string(),
|
|
15917
|
-
retryAfterMs: number().optional()
|
|
15918
|
-
})]);
|
|
16193
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
16194
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
16195
|
+
*
|
|
16196
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
16197
|
+
* `notification-center` module), hooked on the durable persistence
|
|
16198
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
16199
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
16200
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
16201
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
16202
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
16203
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
16204
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
16205
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
16206
|
+
* target kind's own caps/degrade engine).
|
|
16207
|
+
*
|
|
16208
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
16209
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
16210
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
16211
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
16212
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
16213
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
16214
|
+
* P2+ (see spec §7).
|
|
16215
|
+
*
|
|
16216
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
16217
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
16218
|
+
* schema/interface drift is explicitly not repeated).
|
|
16219
|
+
*/
|
|
15919
16220
|
/**
|
|
15920
|
-
*
|
|
15921
|
-
*
|
|
15922
|
-
*
|
|
16221
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
16222
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
16223
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
16224
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
16225
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
16226
|
+
* change of a LINKED device, one row per linked camera)
|
|
16227
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
16228
|
+
* delivery / pick-up)
|
|
16229
|
+
*
|
|
16230
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
16231
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
16232
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
16233
|
+
* one trigger.
|
|
15923
16234
|
*/
|
|
15924
|
-
var
|
|
15925
|
-
|
|
15926
|
-
|
|
16235
|
+
var NcDeliverySchema = _enum([
|
|
16236
|
+
"immediate",
|
|
16237
|
+
"track-end",
|
|
16238
|
+
"device-event",
|
|
16239
|
+
"package-event"
|
|
16240
|
+
]);
|
|
16241
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
16242
|
+
var NcScheduleSchema = object({
|
|
16243
|
+
windows: array(object({
|
|
16244
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
16245
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
16246
|
+
startMinute: number().int().min(0).max(1439),
|
|
16247
|
+
endMinute: number().int().min(0).max(1439)
|
|
16248
|
+
})).min(1),
|
|
16249
|
+
/** IANA timezone; default = hub host timezone. */
|
|
16250
|
+
timezone: string().optional(),
|
|
16251
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
16252
|
+
invert: boolean().optional()
|
|
15927
16253
|
});
|
|
15928
|
-
|
|
15929
|
-
|
|
15930
|
-
|
|
15931
|
-
/**
|
|
15932
|
-
|
|
15933
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15934
|
-
consumer: string(),
|
|
15935
|
-
system: string().optional(),
|
|
15936
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15937
|
-
prompt: string(),
|
|
15938
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15939
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
15940
|
-
/** Per-call override of the profile default. */
|
|
15941
|
-
maxTokens: number().int().positive().optional(),
|
|
15942
|
-
temperature: number().optional()
|
|
16254
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
16255
|
+
var NcPlateMatcherSchema = object({
|
|
16256
|
+
values: array(string().min(1)).min(1),
|
|
16257
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
16258
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
15943
16259
|
});
|
|
15944
16260
|
/**
|
|
15945
|
-
*
|
|
15946
|
-
*
|
|
15947
|
-
*
|
|
15948
|
-
*
|
|
15949
|
-
*
|
|
15950
|
-
*
|
|
15951
|
-
*
|
|
15952
|
-
*
|
|
15953
|
-
*
|
|
16261
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
16262
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
16263
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
16264
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
16265
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
16266
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
16267
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
16268
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
16269
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
16270
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
16271
|
+
* (declared SQLite collection, reseeded on boot).
|
|
15954
16272
|
*/
|
|
15955
|
-
var
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
var
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
engine: _enum(["llama-cpp"]),
|
|
15975
|
-
model: ManagedModelRefSchema,
|
|
15976
|
-
contextSize: number().int().default(4096),
|
|
15977
|
-
/** 0 = CPU-only. */
|
|
15978
|
-
gpuLayers: number().int().default(0),
|
|
15979
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15980
|
-
threads: number().int().optional(),
|
|
15981
|
-
/** Concurrent slots. */
|
|
15982
|
-
parallel: number().int().default(1),
|
|
15983
|
-
/** Else lazy: first generate boots it. */
|
|
15984
|
-
autoStart: boolean().default(false),
|
|
15985
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
15986
|
-
idleStopMinutes: number().int().default(30)
|
|
16273
|
+
var NcOccupancyConditionSchema = object({
|
|
16274
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
16275
|
+
zoneId: string().optional(),
|
|
16276
|
+
/** Object class to count; absent = any class. */
|
|
16277
|
+
className: string().optional(),
|
|
16278
|
+
op: _enum([
|
|
16279
|
+
"became-occupied",
|
|
16280
|
+
"became-free",
|
|
16281
|
+
">=",
|
|
16282
|
+
"<="
|
|
16283
|
+
]).default("became-occupied"),
|
|
16284
|
+
count: number().int().min(0).default(1),
|
|
16285
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
16286
|
+
});
|
|
16287
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
16288
|
+
var NcZoneConditionSchema = object({
|
|
16289
|
+
ids: array(string().min(1)).min(1),
|
|
16290
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
16291
|
+
match: _enum(["any", "all"]).default("any")
|
|
15987
16292
|
});
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16293
|
+
/**
|
|
16294
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
16295
|
+
* membership lists are OR within the list (spec §2.3).
|
|
16296
|
+
*/
|
|
16297
|
+
var NcConditionsSchema = object({
|
|
16298
|
+
/** Device scope — absent = all devices. */
|
|
16299
|
+
devices: array(number()).optional(),
|
|
16300
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
16301
|
+
classes: array(string().min(1)).optional(),
|
|
16302
|
+
/** Veto classes — any overlap fails the rule. */
|
|
16303
|
+
classesExclude: array(string().min(1)).optional(),
|
|
16304
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
16305
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
16306
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
16307
|
+
zones: NcZoneConditionSchema.optional(),
|
|
16308
|
+
/** Veto zones — any hit fails the rule. */
|
|
16309
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
16310
|
+
/**
|
|
16311
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
16312
|
+
* (identity name / plate text / subclass).
|
|
16313
|
+
*/
|
|
16314
|
+
labelEquals: array(string().min(1)).optional(),
|
|
16315
|
+
/**
|
|
16316
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
16317
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
16318
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
16319
|
+
*/
|
|
16320
|
+
identities: array(string().min(1)).optional(),
|
|
16321
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
16322
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
16323
|
+
/**
|
|
16324
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
16325
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
16326
|
+
* identity display name). A record with NO label passes (nothing to
|
|
16327
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
16328
|
+
*/
|
|
16329
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
16330
|
+
/**
|
|
16331
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
16332
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
16333
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
16334
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
16335
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
16336
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
16337
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
16338
|
+
*/
|
|
16339
|
+
minImportance: number().min(0).max(1).optional(),
|
|
16340
|
+
/**
|
|
16341
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
16342
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
16343
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
16344
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
16345
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
16346
|
+
*/
|
|
16347
|
+
minDwellSeconds: number().min(0).optional(),
|
|
16348
|
+
/**
|
|
16349
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
16350
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
16351
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
16352
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
16353
|
+
* tracks carry `sensor`.
|
|
16354
|
+
*/
|
|
16355
|
+
source: _enum([
|
|
16356
|
+
"pipeline",
|
|
16357
|
+
"onboard",
|
|
16358
|
+
"sensor",
|
|
16359
|
+
"any"
|
|
16360
|
+
]).optional(),
|
|
16361
|
+
/**
|
|
16362
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
16363
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
16364
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
16365
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
16366
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
16367
|
+
*
|
|
16368
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
16369
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
16370
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
16371
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
16372
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
16373
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
16374
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
16375
|
+
* one track the higher of the two is used. A track that ended with no
|
|
16376
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
16377
|
+
* closed for it (an un-recognized subject).
|
|
16378
|
+
*/
|
|
16379
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
16380
|
+
/**
|
|
16381
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
16382
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
16383
|
+
* against the token carried on the device-event subject (extracted from the
|
|
16384
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
16385
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
16386
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
16387
|
+
*/
|
|
16388
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
16389
|
+
/**
|
|
16390
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
16391
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
16392
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
16393
|
+
*/
|
|
16394
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
16395
|
+
/**
|
|
16396
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
16397
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
16398
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
16399
|
+
* on the package-event trigger).
|
|
16400
|
+
*/
|
|
16401
|
+
packagePhase: _enum([
|
|
16402
|
+
"delivered",
|
|
16403
|
+
"picked-up",
|
|
16404
|
+
"both"
|
|
16405
|
+
]).optional(),
|
|
16406
|
+
/**
|
|
16407
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
16408
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
16409
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
16410
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
16411
|
+
*/
|
|
16412
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
16413
|
+
/**
|
|
16414
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
16415
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
16416
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
16417
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
16418
|
+
*/
|
|
16419
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
16009
16420
|
});
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
|
|
16421
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
16422
|
+
var NcRuleTargetSchema = object({
|
|
16423
|
+
/** `notification-output` Target id. */
|
|
16424
|
+
targetId: string().min(1),
|
|
16425
|
+
/**
|
|
16426
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
16427
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
16428
|
+
* degrade engine drops what the backend can't render.
|
|
16429
|
+
*/
|
|
16430
|
+
params: record(string(), unknown()).optional()
|
|
16015
16431
|
});
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16432
|
+
/**
|
|
16433
|
+
* Media attachment policy (P1 still-image subset).
|
|
16434
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
16435
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
16436
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
16437
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
16438
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
16439
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
16440
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
16441
|
+
* name), so the choice never drifts from the record that fired it.
|
|
16442
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
16443
|
+
* - `none` — no attachment.
|
|
16444
|
+
*/
|
|
16445
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
16446
|
+
"best",
|
|
16447
|
+
"best-matching",
|
|
16448
|
+
"keyFrame",
|
|
16449
|
+
"none"
|
|
16450
|
+
]).default("best") });
|
|
16451
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
16452
|
+
var NcThrottleSchema = object({
|
|
16453
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
16454
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
16455
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
16456
|
+
});
|
|
16457
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
16458
|
+
var NcRuleInputSchema = object({
|
|
16459
|
+
name: string().min(1).max(200),
|
|
16460
|
+
enabled: boolean().default(true),
|
|
16461
|
+
delivery: NcDeliverySchema,
|
|
16462
|
+
conditions: NcConditionsSchema.default({}),
|
|
16463
|
+
schedule: NcScheduleSchema.optional(),
|
|
16464
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
16465
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
16466
|
+
throttle: NcThrottleSchema.default({
|
|
16467
|
+
cooldownSec: 60,
|
|
16468
|
+
scope: "rule-device"
|
|
16469
|
+
}),
|
|
16470
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
16471
|
+
template: object({
|
|
16472
|
+
title: string().max(500).optional(),
|
|
16473
|
+
body: string().max(2e3).optional()
|
|
16474
|
+
}).optional(),
|
|
16475
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
16476
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16477
|
+
/**
|
|
16478
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
16479
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
16480
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
16481
|
+
*/
|
|
16482
|
+
ownerUserId: string().optional()
|
|
16020
16483
|
});
|
|
16021
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
16022
|
-
images: array(LlmImageSchema).optional(),
|
|
16023
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
16024
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
16025
|
-
timeoutMs: number().int().positive().optional()
|
|
16026
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
16027
|
-
kind: "mutation",
|
|
16028
|
-
auth: "admin"
|
|
16029
|
-
}), method(object({}), _void(), {
|
|
16030
|
-
kind: "mutation",
|
|
16031
|
-
auth: "admin"
|
|
16032
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
16033
|
-
kind: "mutation",
|
|
16034
|
-
auth: "admin"
|
|
16035
|
-
}), method(object({ file: string() }), _void(), {
|
|
16036
|
-
kind: "mutation",
|
|
16037
|
-
auth: "admin"
|
|
16038
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
16039
16484
|
/**
|
|
16040
|
-
* `
|
|
16041
|
-
*
|
|
16042
|
-
*
|
|
16043
|
-
*
|
|
16044
|
-
*
|
|
16045
|
-
*
|
|
16046
|
-
*
|
|
16047
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
16048
|
-
* write; a stored key NEVER round-trips to a client.
|
|
16485
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
16486
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
16487
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
16488
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
16489
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
16490
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
16491
|
+
* `updateRule` patch.
|
|
16049
16492
|
*/
|
|
16050
|
-
var
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
"anthropic",
|
|
16054
|
-
"google",
|
|
16055
|
-
"managed-local"
|
|
16056
|
-
]);
|
|
16057
|
-
var LlmProfileSchema = object({
|
|
16493
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
16494
|
+
/** A persisted rule. */
|
|
16495
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
16058
16496
|
id: string(),
|
|
16059
|
-
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
|
|
16065
|
-
|
|
16066
|
-
|
|
16067
|
-
|
|
16068
|
-
|
|
16069
|
-
apiKey: string().optional(),
|
|
16070
|
-
supportsVision: boolean(),
|
|
16071
|
-
temperature: number().min(0).max(2).optional(),
|
|
16072
|
-
maxTokens: number().int().positive().optional(),
|
|
16073
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
16074
|
-
extraHeaders: record(string(), string()).optional(),
|
|
16075
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
16076
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
16077
|
-
});
|
|
16078
|
-
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
16079
|
-
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
16080
|
-
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
16081
|
-
var ConfigSchemaPassthrough = unknown();
|
|
16082
|
-
var LlmProfileKindDescriptorSchema = object({
|
|
16083
|
-
kind: LlmProfileKindSchema,
|
|
16084
|
-
label: string(),
|
|
16085
|
-
icon: string(),
|
|
16086
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16087
|
-
addonId: string(),
|
|
16088
|
-
configSchema: ConfigSchemaPassthrough
|
|
16089
|
-
});
|
|
16090
|
-
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
16091
|
-
var LlmDefaultSchema = object({
|
|
16092
|
-
selector: LlmDefaultSelectorSchema,
|
|
16093
|
-
profileId: string()
|
|
16497
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
16498
|
+
createdBy: string(),
|
|
16499
|
+
createdAt: number(),
|
|
16500
|
+
updatedAt: number(),
|
|
16501
|
+
/**
|
|
16502
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
16503
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
16504
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
16505
|
+
*/
|
|
16506
|
+
disabledTargetIds: array(string()).default([])
|
|
16094
16507
|
});
|
|
16095
|
-
|
|
16096
|
-
|
|
16097
|
-
|
|
16098
|
-
|
|
16099
|
-
|
|
16100
|
-
|
|
16101
|
-
|
|
16102
|
-
|
|
16103
|
-
|
|
16104
|
-
|
|
16105
|
-
|
|
16508
|
+
var NcTestResultSchema = object({
|
|
16509
|
+
recordId: string(),
|
|
16510
|
+
recordKind: _enum([
|
|
16511
|
+
"object-event",
|
|
16512
|
+
"track",
|
|
16513
|
+
"device-event",
|
|
16514
|
+
"package-event"
|
|
16515
|
+
]),
|
|
16516
|
+
deviceId: number(),
|
|
16517
|
+
timestamp: number(),
|
|
16518
|
+
wouldFire: boolean(),
|
|
16519
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
16520
|
+
failedCondition: string().optional(),
|
|
16521
|
+
className: string().optional(),
|
|
16522
|
+
label: string().optional()
|
|
16106
16523
|
});
|
|
16107
|
-
|
|
16108
|
-
|
|
16524
|
+
var NcConditionDescriptorSchema = object({
|
|
16525
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
16109
16526
|
id: string(),
|
|
16527
|
+
group: _enum([
|
|
16528
|
+
"scope",
|
|
16529
|
+
"class",
|
|
16530
|
+
"zones",
|
|
16531
|
+
"quality",
|
|
16532
|
+
"label",
|
|
16533
|
+
"schedule",
|
|
16534
|
+
"device",
|
|
16535
|
+
"package",
|
|
16536
|
+
"occupancy"
|
|
16537
|
+
]),
|
|
16110
16538
|
label: string(),
|
|
16111
|
-
|
|
16112
|
-
|
|
16113
|
-
|
|
16114
|
-
|
|
16115
|
-
|
|
16116
|
-
|
|
16117
|
-
|
|
16118
|
-
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
|
|
16539
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
16540
|
+
valueType: _enum([
|
|
16541
|
+
"deviceIdList",
|
|
16542
|
+
"stringList",
|
|
16543
|
+
"number01",
|
|
16544
|
+
"number",
|
|
16545
|
+
"sourceSelect",
|
|
16546
|
+
"zoneSelection",
|
|
16547
|
+
"zoneIdList",
|
|
16548
|
+
"schedule",
|
|
16549
|
+
"plateMatcher",
|
|
16550
|
+
"packagePhase",
|
|
16551
|
+
"polygonDraw",
|
|
16552
|
+
"occupancy"
|
|
16553
|
+
]),
|
|
16554
|
+
operator: _enum([
|
|
16555
|
+
"in",
|
|
16556
|
+
"notIn",
|
|
16557
|
+
"anyOf",
|
|
16558
|
+
"allOf",
|
|
16559
|
+
"gte",
|
|
16560
|
+
"fuzzyIn",
|
|
16561
|
+
"withinSchedule"
|
|
16562
|
+
]),
|
|
16563
|
+
/** Which delivery kinds the condition applies to. */
|
|
16564
|
+
appliesTo: array(NcDeliverySchema),
|
|
16565
|
+
phase: string(),
|
|
16566
|
+
description: string().optional()
|
|
16122
16567
|
});
|
|
16123
|
-
|
|
16124
|
-
|
|
16125
|
-
|
|
16126
|
-
|
|
16127
|
-
|
|
16128
|
-
|
|
16568
|
+
/**
|
|
16569
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
16570
|
+
* durable outbox row's own status (single source of truth):
|
|
16571
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
16572
|
+
* - `sent` — delivered (terminal)
|
|
16573
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
16574
|
+
* backend rejection / a deleted target (terminal; carries
|
|
16575
|
+
* the failure `error`)
|
|
16576
|
+
*
|
|
16577
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
16578
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
16579
|
+
*/
|
|
16580
|
+
var NcHistoryStatusSchema = _enum([
|
|
16581
|
+
"pending",
|
|
16582
|
+
"sent",
|
|
16583
|
+
"dead"
|
|
16584
|
+
]);
|
|
16585
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
16586
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
16587
|
+
"object-event",
|
|
16588
|
+
"track-end",
|
|
16589
|
+
"device-event",
|
|
16590
|
+
"package-event"
|
|
16591
|
+
]);
|
|
16592
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
16593
|
+
var NcHistorySubjectSchema = object({
|
|
16594
|
+
className: string(),
|
|
16595
|
+
label: string().optional(),
|
|
16596
|
+
confidence: number().optional(),
|
|
16597
|
+
zones: array(string()),
|
|
16598
|
+
timestamp: number()
|
|
16599
|
+
});
|
|
16600
|
+
/**
|
|
16601
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
16602
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
16603
|
+
* NO second write path, so history can never drift from delivery state).
|
|
16604
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
16605
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
16606
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
16607
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
16608
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
16609
|
+
* P1 (admin scope only).
|
|
16610
|
+
*/
|
|
16611
|
+
var NcHistoryEntrySchema = object({
|
|
16612
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
16613
|
+
id: string(),
|
|
16614
|
+
ruleId: string(),
|
|
16615
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
16616
|
+
ruleName: string(),
|
|
16617
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
16618
|
+
delivery: NcDeliverySchema,
|
|
16619
|
+
targetId: string(),
|
|
16620
|
+
deviceId: number(),
|
|
16621
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
16622
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
16623
|
+
recordId: string(),
|
|
16624
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
16625
|
+
trackId: string().optional(),
|
|
16626
|
+
status: NcHistoryStatusSchema,
|
|
16627
|
+
/** Delivery attempts made so far. */
|
|
16628
|
+
attempts: number().int(),
|
|
16629
|
+
/** Fire time (outbox enqueue). */
|
|
16630
|
+
createdAt: number(),
|
|
16631
|
+
/** Last transition time (terminal for sent / dead). */
|
|
16632
|
+
updatedAt: number(),
|
|
16633
|
+
/** Failure detail — present on a `dead` row. */
|
|
16634
|
+
error: string().optional(),
|
|
16635
|
+
subject: NcHistorySubjectSchema
|
|
16129
16636
|
});
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16637
|
+
/**
|
|
16638
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
16639
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
16640
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
16641
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
16642
|
+
*/
|
|
16643
|
+
var NcHistoryFilterSchema = object({
|
|
16644
|
+
ruleId: string().optional(),
|
|
16645
|
+
deviceId: number().optional(),
|
|
16646
|
+
status: NcHistoryStatusSchema.optional(),
|
|
16647
|
+
since: number().optional(),
|
|
16648
|
+
until: number().optional(),
|
|
16649
|
+
limit: number().int().min(1).max(500).default(100)
|
|
16134
16650
|
});
|
|
16135
|
-
method(
|
|
16136
|
-
kind: "mutation",
|
|
16137
|
-
auth: "admin"
|
|
16138
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
16651
|
+
method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), method(object({ ruleId: string() }), object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }), method(object({ rule: NcRuleInputSchema }), object({ rule: NcRuleSchema }), {
|
|
16139
16652
|
kind: "mutation",
|
|
16140
|
-
auth: "admin"
|
|
16141
|
-
|
|
16653
|
+
auth: "admin",
|
|
16654
|
+
caller: "required"
|
|
16655
|
+
}), method(object({
|
|
16656
|
+
ruleId: string(),
|
|
16657
|
+
patch: NcRulePatchSchema
|
|
16658
|
+
}), object({ rule: NcRuleSchema }), {
|
|
16142
16659
|
kind: "mutation",
|
|
16143
|
-
auth: "admin"
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
profileId: string().nullable()
|
|
16147
|
-
}), _void(), {
|
|
16660
|
+
auth: "admin",
|
|
16661
|
+
caller: "required"
|
|
16662
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
16148
16663
|
kind: "mutation",
|
|
16149
16664
|
auth: "admin"
|
|
16150
16665
|
}), method(object({
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
profileId: string().optional()
|
|
16155
|
-
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16156
|
-
nodeId: string(),
|
|
16157
|
-
model: ManagedModelRefSchema
|
|
16158
|
-
}), _void(), {
|
|
16666
|
+
ruleId: string(),
|
|
16667
|
+
enabled: boolean()
|
|
16668
|
+
}), object({ success: literal(true) }), {
|
|
16159
16669
|
kind: "mutation",
|
|
16160
16670
|
auth: "admin"
|
|
16161
16671
|
}), method(object({
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
}),
|
|
16165
|
-
kind: "mutation",
|
|
16166
|
-
auth: "admin"
|
|
16167
|
-
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16168
|
-
kind: "mutation",
|
|
16169
|
-
auth: "admin"
|
|
16170
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
16672
|
+
rule: NcRuleInputSchema,
|
|
16673
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
16674
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
16171
16675
|
kind: "mutation",
|
|
16172
16676
|
auth: "admin"
|
|
16173
|
-
});
|
|
16677
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
16174
16678
|
/**
|
|
16175
16679
|
* Zod schemas for persisted record types.
|
|
16176
16680
|
*
|
|
@@ -16856,7 +17360,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16856
17360
|
}), method(object({
|
|
16857
17361
|
eventId: string(),
|
|
16858
17362
|
kind: MediaFileKindEnum.optional()
|
|
16859
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
17363
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
17364
|
+
trackId: string(),
|
|
17365
|
+
kinds: array(MediaFileKindEnum).optional()
|
|
17366
|
+
}), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
|
|
16860
17367
|
deviceId: number(),
|
|
16861
17368
|
timestamp: number(),
|
|
16862
17369
|
frameWidth: number(),
|
|
@@ -16877,76 +17384,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16877
17384
|
eventId: string(),
|
|
16878
17385
|
timestamp: number()
|
|
16879
17386
|
});
|
|
16880
|
-
/**
|
|
16881
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
16882
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
16883
|
-
* caps into per-camera event-kind descriptors.
|
|
16884
|
-
*
|
|
16885
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
16886
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
16887
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
16888
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
16889
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
16890
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
16891
|
-
* eventful cap is missing.
|
|
16892
|
-
*/
|
|
16893
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
16894
|
-
var LEGACY_ICON = {
|
|
16895
|
-
motion: "motion",
|
|
16896
|
-
audio: "audio",
|
|
16897
|
-
person: "person",
|
|
16898
|
-
vehicle: "vehicle",
|
|
16899
|
-
animal: "animal",
|
|
16900
|
-
package: "package",
|
|
16901
|
-
door: "door",
|
|
16902
|
-
pir: "pir",
|
|
16903
|
-
smoke: "smoke",
|
|
16904
|
-
water: "water",
|
|
16905
|
-
button: "button",
|
|
16906
|
-
generic: "generic",
|
|
16907
|
-
gas: "smoke",
|
|
16908
|
-
vibration: "generic",
|
|
16909
|
-
tamper: "generic",
|
|
16910
|
-
presence: "person",
|
|
16911
|
-
lock: "generic",
|
|
16912
|
-
siren: "generic",
|
|
16913
|
-
switch: "generic",
|
|
16914
|
-
doorbell: "button"
|
|
16915
|
-
};
|
|
16916
|
-
function legacyIcon(iconId) {
|
|
16917
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
16918
|
-
}
|
|
16919
|
-
/**
|
|
16920
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
16921
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
16922
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
16923
|
-
*/
|
|
16924
|
-
var CAP_TO_KIND = {
|
|
16925
|
-
contact: "contact",
|
|
16926
|
-
motion: "motion-sensor",
|
|
16927
|
-
smoke: "smoke",
|
|
16928
|
-
flood: "flood",
|
|
16929
|
-
gas: "gas",
|
|
16930
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
16931
|
-
vibration: "vibration",
|
|
16932
|
-
tamper: "tamper",
|
|
16933
|
-
presence: "presence",
|
|
16934
|
-
"enum-sensor": "enum-sensor",
|
|
16935
|
-
"event-emitter": "device-event",
|
|
16936
|
-
"lock-control": "lock",
|
|
16937
|
-
switch: "switch",
|
|
16938
|
-
button: "button",
|
|
16939
|
-
doorbell: "doorbell"
|
|
16940
|
-
};
|
|
16941
|
-
function buildDescriptor(capName, kind) {
|
|
16942
|
-
const t = EVENT_TAXONOMY[kind];
|
|
16943
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
16944
|
-
return {
|
|
16945
|
-
...t,
|
|
16946
|
-
icon: legacyIcon(t.iconId)
|
|
16947
|
-
};
|
|
16948
|
-
}
|
|
16949
|
-
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
16950
17387
|
var CameraPipelineConfigSchema = object({
|
|
16951
17388
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
16952
17389
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -17432,6 +17869,76 @@ method(object({
|
|
|
17432
17869
|
auth: "admin"
|
|
17433
17870
|
});
|
|
17434
17871
|
/**
|
|
17872
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
17873
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
17874
|
+
* caps into per-camera event-kind descriptors.
|
|
17875
|
+
*
|
|
17876
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
17877
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
17878
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
17879
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
17880
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
17881
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
17882
|
+
* eventful cap is missing.
|
|
17883
|
+
*/
|
|
17884
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
17885
|
+
var LEGACY_ICON = {
|
|
17886
|
+
motion: "motion",
|
|
17887
|
+
audio: "audio",
|
|
17888
|
+
person: "person",
|
|
17889
|
+
vehicle: "vehicle",
|
|
17890
|
+
animal: "animal",
|
|
17891
|
+
package: "package",
|
|
17892
|
+
door: "door",
|
|
17893
|
+
pir: "pir",
|
|
17894
|
+
smoke: "smoke",
|
|
17895
|
+
water: "water",
|
|
17896
|
+
button: "button",
|
|
17897
|
+
generic: "generic",
|
|
17898
|
+
gas: "smoke",
|
|
17899
|
+
vibration: "generic",
|
|
17900
|
+
tamper: "generic",
|
|
17901
|
+
presence: "person",
|
|
17902
|
+
lock: "generic",
|
|
17903
|
+
siren: "generic",
|
|
17904
|
+
switch: "generic",
|
|
17905
|
+
doorbell: "button"
|
|
17906
|
+
};
|
|
17907
|
+
function legacyIcon(iconId) {
|
|
17908
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
17909
|
+
}
|
|
17910
|
+
/**
|
|
17911
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
17912
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
17913
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
17914
|
+
*/
|
|
17915
|
+
var CAP_TO_KIND = {
|
|
17916
|
+
contact: "contact",
|
|
17917
|
+
motion: "motion-sensor",
|
|
17918
|
+
smoke: "smoke",
|
|
17919
|
+
flood: "flood",
|
|
17920
|
+
gas: "gas",
|
|
17921
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
17922
|
+
vibration: "vibration",
|
|
17923
|
+
tamper: "tamper",
|
|
17924
|
+
presence: "presence",
|
|
17925
|
+
"enum-sensor": "enum-sensor",
|
|
17926
|
+
"event-emitter": "device-event",
|
|
17927
|
+
"lock-control": "lock",
|
|
17928
|
+
switch: "switch",
|
|
17929
|
+
button: "button",
|
|
17930
|
+
doorbell: "doorbell"
|
|
17931
|
+
};
|
|
17932
|
+
function buildDescriptor(capName, kind) {
|
|
17933
|
+
const t = EVENT_TAXONOMY[kind];
|
|
17934
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
17935
|
+
return {
|
|
17936
|
+
...t,
|
|
17937
|
+
icon: legacyIcon(t.iconId)
|
|
17938
|
+
};
|
|
17939
|
+
}
|
|
17940
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
17941
|
+
/**
|
|
17435
17942
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
17436
17943
|
* package lifecycle (runtime-updatable node packages).
|
|
17437
17944
|
*
|
|
@@ -18886,7 +19393,28 @@ var FaceInfoSchema = object({
|
|
|
18886
19393
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
18887
19394
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
18888
19395
|
* back to the inline `base64` face crop. */
|
|
18889
|
-
keyFrameMediaKey: string().optional()
|
|
19396
|
+
keyFrameMediaKey: string().optional(),
|
|
19397
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
19398
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
19399
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
19400
|
+
* faces that were never auto-recognized. */
|
|
19401
|
+
bestMatchScore: number().optional(),
|
|
19402
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
19403
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
19404
|
+
* legacy rows / runners that reported no native measure. */
|
|
19405
|
+
nativeFaceShortSidePx: number().optional(),
|
|
19406
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
19407
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
19408
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
19409
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
19410
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
19411
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
19412
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
19413
|
+
suggestedIdentityId: string().optional(),
|
|
19414
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
19415
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
19416
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
19417
|
+
suggestedMatchScore: number().optional()
|
|
18890
19418
|
});
|
|
18891
19419
|
var FaceFilterEnum = _enum([
|
|
18892
19420
|
"unassigned",
|
|
@@ -20929,36 +21457,6 @@ Object.freeze({
|
|
|
20929
21457
|
addonId: null,
|
|
20930
21458
|
access: "view"
|
|
20931
21459
|
},
|
|
20932
|
-
"advancedNotifier.deleteRule": {
|
|
20933
|
-
capName: "advanced-notifier",
|
|
20934
|
-
capScope: "system",
|
|
20935
|
-
addonId: null,
|
|
20936
|
-
access: "delete"
|
|
20937
|
-
},
|
|
20938
|
-
"advancedNotifier.getHistory": {
|
|
20939
|
-
capName: "advanced-notifier",
|
|
20940
|
-
capScope: "system",
|
|
20941
|
-
addonId: null,
|
|
20942
|
-
access: "view"
|
|
20943
|
-
},
|
|
20944
|
-
"advancedNotifier.getRules": {
|
|
20945
|
-
capName: "advanced-notifier",
|
|
20946
|
-
capScope: "system",
|
|
20947
|
-
addonId: null,
|
|
20948
|
-
access: "view"
|
|
20949
|
-
},
|
|
20950
|
-
"advancedNotifier.testRule": {
|
|
20951
|
-
capName: "advanced-notifier",
|
|
20952
|
-
capScope: "system",
|
|
20953
|
-
addonId: null,
|
|
20954
|
-
access: "create"
|
|
20955
|
-
},
|
|
20956
|
-
"advancedNotifier.upsertRule": {
|
|
20957
|
-
capName: "advanced-notifier",
|
|
20958
|
-
capScope: "system",
|
|
20959
|
-
addonId: null,
|
|
20960
|
-
access: "create"
|
|
20961
|
-
},
|
|
20962
21460
|
"alarmPanel.arm": {
|
|
20963
21461
|
capName: "alarm-panel",
|
|
20964
21462
|
capScope: "device",
|
|
@@ -23263,6 +23761,60 @@ Object.freeze({
|
|
|
23263
23761
|
addonId: null,
|
|
23264
23762
|
access: "create"
|
|
23265
23763
|
},
|
|
23764
|
+
"notificationRules.createRule": {
|
|
23765
|
+
capName: "notification-rules",
|
|
23766
|
+
capScope: "system",
|
|
23767
|
+
addonId: null,
|
|
23768
|
+
access: "create"
|
|
23769
|
+
},
|
|
23770
|
+
"notificationRules.deleteRule": {
|
|
23771
|
+
capName: "notification-rules",
|
|
23772
|
+
capScope: "system",
|
|
23773
|
+
addonId: null,
|
|
23774
|
+
access: "delete"
|
|
23775
|
+
},
|
|
23776
|
+
"notificationRules.getConditionCatalog": {
|
|
23777
|
+
capName: "notification-rules",
|
|
23778
|
+
capScope: "system",
|
|
23779
|
+
addonId: null,
|
|
23780
|
+
access: "view"
|
|
23781
|
+
},
|
|
23782
|
+
"notificationRules.getHistory": {
|
|
23783
|
+
capName: "notification-rules",
|
|
23784
|
+
capScope: "system",
|
|
23785
|
+
addonId: null,
|
|
23786
|
+
access: "view"
|
|
23787
|
+
},
|
|
23788
|
+
"notificationRules.getRule": {
|
|
23789
|
+
capName: "notification-rules",
|
|
23790
|
+
capScope: "system",
|
|
23791
|
+
addonId: null,
|
|
23792
|
+
access: "view"
|
|
23793
|
+
},
|
|
23794
|
+
"notificationRules.listRules": {
|
|
23795
|
+
capName: "notification-rules",
|
|
23796
|
+
capScope: "system",
|
|
23797
|
+
addonId: null,
|
|
23798
|
+
access: "view"
|
|
23799
|
+
},
|
|
23800
|
+
"notificationRules.setRuleEnabled": {
|
|
23801
|
+
capName: "notification-rules",
|
|
23802
|
+
capScope: "system",
|
|
23803
|
+
addonId: null,
|
|
23804
|
+
access: "create"
|
|
23805
|
+
},
|
|
23806
|
+
"notificationRules.testRule": {
|
|
23807
|
+
capName: "notification-rules",
|
|
23808
|
+
capScope: "system",
|
|
23809
|
+
addonId: null,
|
|
23810
|
+
access: "create"
|
|
23811
|
+
},
|
|
23812
|
+
"notificationRules.updateRule": {
|
|
23813
|
+
capName: "notification-rules",
|
|
23814
|
+
capScope: "system",
|
|
23815
|
+
addonId: null,
|
|
23816
|
+
access: "create"
|
|
23817
|
+
},
|
|
23266
23818
|
"notifier.cancel": {
|
|
23267
23819
|
capName: "notifier",
|
|
23268
23820
|
capScope: "device",
|