@camstack/addon-import-alexa 0.2.3 → 0.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/addon.js +1134 -582
- package/dist/addon.mjs +1134 -582
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -38,7 +38,7 @@ let node_crypto = require("node:crypto");
|
|
|
38
38
|
let node_fs = require("node:fs");
|
|
39
39
|
let node_path = require("node:path");
|
|
40
40
|
node_path = __toESM(node_path);
|
|
41
|
-
//#region ../types/dist/event-category-
|
|
41
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
42
42
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
43
43
|
EventCategory["SystemBoot"] = "system.boot";
|
|
44
44
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -188,9 +188,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
188
188
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
189
189
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
190
190
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
191
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
192
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
193
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
194
191
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
195
192
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
196
193
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -6869,7 +6866,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
|
6869
6866
|
patch: record(string(), unknown())
|
|
6870
6867
|
}), object({ success: literal(true) });
|
|
6871
6868
|
object({ deviceId: number() }), unknown().nullable();
|
|
6872
|
-
/** Shorthand to define a method schema */
|
|
6873
6869
|
function method(input, output, options) {
|
|
6874
6870
|
return {
|
|
6875
6871
|
input,
|
|
@@ -6877,6 +6873,7 @@ function method(input, output, options) {
|
|
|
6877
6873
|
kind: options?.kind ?? "query",
|
|
6878
6874
|
auth: options?.auth ?? "protected",
|
|
6879
6875
|
...options?.access !== void 0 ? { access: options.access } : {},
|
|
6876
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
6880
6877
|
timeoutMs: options?.timeoutMs
|
|
6881
6878
|
};
|
|
6882
6879
|
}
|
|
@@ -8363,6 +8360,59 @@ for (const l of AUDIO_MACRO_LABELS) {
|
|
|
8363
8360
|
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8364
8361
|
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8365
8362
|
/**
|
|
8363
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8364
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8365
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8366
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8367
|
+
*
|
|
8368
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8369
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8370
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8371
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8372
|
+
* the same class picker, grouped under an Audio header.
|
|
8373
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8374
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8375
|
+
*
|
|
8376
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8377
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8378
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8379
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8380
|
+
*/
|
|
8381
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8382
|
+
var NcTaxonomyEntrySchema = object({
|
|
8383
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8384
|
+
kind: string(),
|
|
8385
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8386
|
+
label: string(),
|
|
8387
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8388
|
+
parentKind: string().nullable()
|
|
8389
|
+
});
|
|
8390
|
+
object({
|
|
8391
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8392
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8393
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8394
|
+
});
|
|
8395
|
+
function toEntry(kind, label, parentKind) {
|
|
8396
|
+
return {
|
|
8397
|
+
kind,
|
|
8398
|
+
label,
|
|
8399
|
+
parentKind
|
|
8400
|
+
};
|
|
8401
|
+
}
|
|
8402
|
+
/**
|
|
8403
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8404
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8405
|
+
*/
|
|
8406
|
+
function buildNcTaxonomy() {
|
|
8407
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8408
|
+
return {
|
|
8409
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8410
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8411
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8412
|
+
};
|
|
8413
|
+
}
|
|
8414
|
+
Object.freeze(buildNcTaxonomy());
|
|
8415
|
+
/**
|
|
8366
8416
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8367
8417
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8368
8418
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -12348,6 +12398,22 @@ var CameraMetricsSchema = object({
|
|
|
12348
12398
|
])
|
|
12349
12399
|
});
|
|
12350
12400
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
12401
|
+
/**
|
|
12402
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
12403
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
12404
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
12405
|
+
*/
|
|
12406
|
+
var NativeCropRefSchema = object({
|
|
12407
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
12408
|
+
handle: FrameHandleSchema,
|
|
12409
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
12410
|
+
cropFrameSpace: object({
|
|
12411
|
+
x: number(),
|
|
12412
|
+
y: number(),
|
|
12413
|
+
w: number(),
|
|
12414
|
+
h: number()
|
|
12415
|
+
})
|
|
12416
|
+
});
|
|
12351
12417
|
var ModelFormatSchema$1 = _enum([
|
|
12352
12418
|
"onnx",
|
|
12353
12419
|
"coreml",
|
|
@@ -12623,7 +12689,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
12623
12689
|
* Omitted ⇒ the runner's default device (current single-engine
|
|
12624
12690
|
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
12625
12691
|
*/
|
|
12626
|
-
deviceKey: string().optional()
|
|
12692
|
+
deviceKey: string().optional(),
|
|
12693
|
+
/**
|
|
12694
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
12695
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
12696
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
12697
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
12698
|
+
* resolution from that surface — the SAME quality path faces already
|
|
12699
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
12700
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
12701
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
12702
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
12703
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
12704
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
12705
|
+
* (today's behaviour on the fallback path).
|
|
12706
|
+
*/
|
|
12707
|
+
nativeCropRef: NativeCropRefSchema.optional()
|
|
12627
12708
|
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
12628
12709
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
12629
12710
|
steps: array(PipelineStepInputSchema).min(1),
|
|
@@ -12872,7 +12953,11 @@ var DetailResultSchema = object({
|
|
|
12872
12953
|
bbox: NativeCropBboxSchema.optional(),
|
|
12873
12954
|
embedding: string().optional(),
|
|
12874
12955
|
label: string().optional(),
|
|
12875
|
-
alignedCropJpeg: string().optional()
|
|
12956
|
+
alignedCropJpeg: string().optional(),
|
|
12957
|
+
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
12958
|
+
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
12959
|
+
* consumers MUST prefer this when present (2026-07-22 native-gate fix). */
|
|
12960
|
+
nativeFaceShortSidePx: number().optional()
|
|
12876
12961
|
});
|
|
12877
12962
|
/**
|
|
12878
12963
|
* Per-camera tunable ranges + defaults. Single source of truth used
|
|
@@ -12886,6 +12971,12 @@ var motionCooldownMsField = {
|
|
|
12886
12971
|
default: 3e4,
|
|
12887
12972
|
step: 500
|
|
12888
12973
|
};
|
|
12974
|
+
var maxSessionHoldMsField = {
|
|
12975
|
+
min: 0,
|
|
12976
|
+
max: 6e5,
|
|
12977
|
+
default: 12e4,
|
|
12978
|
+
step: 5e3
|
|
12979
|
+
};
|
|
12889
12980
|
var motionFpsField = {
|
|
12890
12981
|
min: 1,
|
|
12891
12982
|
max: 30,
|
|
@@ -13033,6 +13124,19 @@ var RunnerCameraConfigSchema = object({
|
|
|
13033
13124
|
"on-motion"
|
|
13034
13125
|
]).default("always-on"),
|
|
13035
13126
|
motionCooldownMs: number().min(motionCooldownMsField.min).default(motionCooldownMsField.default),
|
|
13127
|
+
/**
|
|
13128
|
+
* Orchestrator-side on-motion session-hold cap (ms). While an on-motion
|
|
13129
|
+
* detection session is active and ≥1 confirmed non-stationary track is
|
|
13130
|
+
* still live, the orchestrator keeps the session open past
|
|
13131
|
+
* `motionCooldownMs` (a slowly-moving subject can stop re-triggering the
|
|
13132
|
+
* camera's VMD yet is still being tracked frame-to-frame) — up to this many
|
|
13133
|
+
* ms since the session opened, after which it closes regardless. `0`
|
|
13134
|
+
* disables the hold (legacy cooldown-only teardown). Not consumed by the
|
|
13135
|
+
* runner itself — carried here so it shares the per-camera device-settings
|
|
13136
|
+
* surface with `motionCooldownMs`; the orchestrator reads it off the
|
|
13137
|
+
* resolved `CameraDetectionConfig`.
|
|
13138
|
+
*/
|
|
13139
|
+
maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
|
|
13036
13140
|
motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
|
|
13037
13141
|
detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
|
|
13038
13142
|
motionStreamId: string(),
|
|
@@ -13122,7 +13226,7 @@ var RunnerCameraConfigSchema = object({
|
|
|
13122
13226
|
*/
|
|
13123
13227
|
inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
|
|
13124
13228
|
});
|
|
13125
|
-
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;
|
|
13229
|
+
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;
|
|
13126
13230
|
/**
|
|
13127
13231
|
* Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
|
|
13128
13232
|
* load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
|
|
@@ -16668,94 +16772,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
16668
16772
|
bundleUrl: string()
|
|
16669
16773
|
});
|
|
16670
16774
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
16671
|
-
var NotificationRuleConditionsSchema = object({
|
|
16672
|
-
deviceIds: array(number()).readonly().optional(),
|
|
16673
|
-
classNames: array(string()).readonly().optional(),
|
|
16674
|
-
zoneIds: array(string()).readonly().optional(),
|
|
16675
|
-
minConfidence: number().optional(),
|
|
16676
|
-
source: _enum([
|
|
16677
|
-
"pipeline",
|
|
16678
|
-
"onboard",
|
|
16679
|
-
"any"
|
|
16680
|
-
]).optional(),
|
|
16681
|
-
schedule: object({
|
|
16682
|
-
days: array(number()).readonly(),
|
|
16683
|
-
startHour: number(),
|
|
16684
|
-
endHour: number()
|
|
16685
|
-
}).optional(),
|
|
16686
|
-
cooldownSeconds: number().optional(),
|
|
16687
|
-
minDwellSeconds: number().optional(),
|
|
16688
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
16689
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
16690
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
16691
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
16692
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
16693
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
16694
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
16695
|
-
clipDescription: object({
|
|
16696
|
-
text: string().min(1),
|
|
16697
|
-
minSimilarity: number().min(0).max(1)
|
|
16698
|
-
}).optional(),
|
|
16699
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
16700
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
16701
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
16702
|
-
* vehicle/person> is seen". */
|
|
16703
|
-
labels: array(string()).readonly().optional()
|
|
16704
|
-
});
|
|
16705
|
-
var NotificationRuleTemplateSchema = object({
|
|
16706
|
-
title: string(),
|
|
16707
|
-
body: string(),
|
|
16708
|
-
imageMode: _enum([
|
|
16709
|
-
"crop",
|
|
16710
|
-
"annotated",
|
|
16711
|
-
"full",
|
|
16712
|
-
"none"
|
|
16713
|
-
])
|
|
16714
|
-
});
|
|
16715
|
-
var NotificationRuleSchema = object({
|
|
16716
|
-
id: string(),
|
|
16717
|
-
name: string(),
|
|
16718
|
-
enabled: boolean(),
|
|
16719
|
-
eventTypes: array(string()).readonly(),
|
|
16720
|
-
conditions: NotificationRuleConditionsSchema,
|
|
16721
|
-
outputs: array(string()).readonly(),
|
|
16722
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
16723
|
-
priority: _enum([
|
|
16724
|
-
"low",
|
|
16725
|
-
"normal",
|
|
16726
|
-
"high",
|
|
16727
|
-
"critical"
|
|
16728
|
-
])
|
|
16729
|
-
});
|
|
16730
|
-
var NotificationTestResultSchema = object({
|
|
16731
|
-
ruleId: string(),
|
|
16732
|
-
eventId: string(),
|
|
16733
|
-
timestamp: number(),
|
|
16734
|
-
wouldFire: boolean(),
|
|
16735
|
-
reason: string().optional()
|
|
16736
|
-
});
|
|
16737
|
-
var NotificationHistoryEntrySchema = object({
|
|
16738
|
-
id: string(),
|
|
16739
|
-
ruleId: string(),
|
|
16740
|
-
ruleName: string(),
|
|
16741
|
-
eventId: string(),
|
|
16742
|
-
timestamp: number(),
|
|
16743
|
-
outputs: array(string()).readonly(),
|
|
16744
|
-
success: boolean(),
|
|
16745
|
-
error: string().optional(),
|
|
16746
|
-
deviceId: number().optional()
|
|
16747
|
-
});
|
|
16748
|
-
var NotificationHistoryFilterSchema = object({
|
|
16749
|
-
ruleId: string().optional(),
|
|
16750
|
-
deviceId: number().optional(),
|
|
16751
|
-
from: number().optional(),
|
|
16752
|
-
to: number().optional(),
|
|
16753
|
-
limit: number().optional()
|
|
16754
|
-
});
|
|
16755
|
-
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({
|
|
16756
|
-
ruleId: string(),
|
|
16757
|
-
lookbackMinutes: number()
|
|
16758
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
16759
16775
|
/**
|
|
16760
16776
|
* Alerts capability — collection-based internal alert system.
|
|
16761
16777
|
*
|
|
@@ -16942,89 +16958,6 @@ method(object({
|
|
|
16942
16958
|
password: string()
|
|
16943
16959
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
16944
16960
|
/**
|
|
16945
|
-
* `login-method` — collection cap through which auth addons contribute
|
|
16946
|
-
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
16947
|
-
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
16948
|
-
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
16949
|
-
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
16950
|
-
* procedure aggregates them for the unauthenticated login page.
|
|
16951
|
-
*
|
|
16952
|
-
* A contribution is a discriminated union on `kind`:
|
|
16953
|
-
*
|
|
16954
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
16955
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
16956
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
16957
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
16958
|
-
* login page needs NO change.
|
|
16959
|
-
*
|
|
16960
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
16961
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
16962
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
16963
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
16964
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
16965
|
-
*
|
|
16966
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
16967
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
16968
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
16969
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
16970
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
16971
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
16972
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
16973
|
-
* decision.
|
|
16974
|
-
*
|
|
16975
|
-
* Every contribution carries a `stage`:
|
|
16976
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
16977
|
-
* magic-link buttons; a future usernameless passkey).
|
|
16978
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
16979
|
-
* returned `factors` (passkey-as-2FA today).
|
|
16980
|
-
*
|
|
16981
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
16982
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
16983
|
-
* tRPC router.
|
|
16984
|
-
*/
|
|
16985
|
-
/** When a login method renders in the two-phase login flow. */
|
|
16986
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
16987
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
16988
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
16989
|
-
object({
|
|
16990
|
-
kind: literal("redirect"),
|
|
16991
|
-
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
16992
|
-
id: string(),
|
|
16993
|
-
/** Operator-facing button label. */
|
|
16994
|
-
label: string(),
|
|
16995
|
-
/** lucide-react icon name. */
|
|
16996
|
-
icon: string().optional(),
|
|
16997
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
16998
|
-
startUrl: string(),
|
|
16999
|
-
stage: LoginStageEnum
|
|
17000
|
-
}),
|
|
17001
|
-
object({
|
|
17002
|
-
kind: literal("widget"),
|
|
17003
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
17004
|
-
id: string(),
|
|
17005
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
17006
|
-
addonId: string(),
|
|
17007
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
17008
|
-
bundle: string(),
|
|
17009
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
17010
|
-
remote: WidgetRemoteSchema,
|
|
17011
|
-
stage: LoginStageEnum
|
|
17012
|
-
}),
|
|
17013
|
-
object({
|
|
17014
|
-
kind: literal("passkey"),
|
|
17015
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
17016
|
-
id: string(),
|
|
17017
|
-
/** Operator-facing button label. */
|
|
17018
|
-
label: string(),
|
|
17019
|
-
stage: LoginStageEnum,
|
|
17020
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
17021
|
-
rpId: string(),
|
|
17022
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
17023
|
-
origin: string().nullable()
|
|
17024
|
-
})
|
|
17025
|
-
]);
|
|
17026
|
-
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
17027
|
-
/**
|
|
17028
16961
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
17029
16962
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
17030
16963
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -18434,48 +18367,423 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
18434
18367
|
kind: "mutation",
|
|
18435
18368
|
auth: "admin"
|
|
18436
18369
|
});
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18370
|
+
/**
|
|
18371
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
18372
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
18373
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
18374
|
+
*
|
|
18375
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
18376
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
18377
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
18378
|
+
*/
|
|
18379
|
+
var LlmUsageSchema = object({
|
|
18380
|
+
inputTokens: number(),
|
|
18381
|
+
outputTokens: number()
|
|
18382
|
+
});
|
|
18383
|
+
var LlmErrorCodeSchema = _enum([
|
|
18384
|
+
"timeout",
|
|
18385
|
+
"rate-limited",
|
|
18386
|
+
"auth",
|
|
18387
|
+
"refusal",
|
|
18388
|
+
"bad-request",
|
|
18389
|
+
"unavailable",
|
|
18390
|
+
"no-profile",
|
|
18391
|
+
"budget-exceeded",
|
|
18392
|
+
"adapter-error"
|
|
18442
18393
|
]);
|
|
18443
|
-
var
|
|
18444
|
-
|
|
18445
|
-
|
|
18446
|
-
|
|
18394
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
18395
|
+
ok: literal(true),
|
|
18396
|
+
text: string(),
|
|
18397
|
+
model: string(),
|
|
18398
|
+
usage: LlmUsageSchema,
|
|
18399
|
+
truncated: boolean(),
|
|
18400
|
+
latencyMs: number()
|
|
18401
|
+
}), object({
|
|
18402
|
+
ok: literal(false),
|
|
18403
|
+
code: LlmErrorCodeSchema,
|
|
18447
18404
|
message: string(),
|
|
18448
|
-
|
|
18449
|
-
|
|
18450
|
-
|
|
18451
|
-
|
|
18452
|
-
|
|
18453
|
-
|
|
18454
|
-
|
|
18455
|
-
|
|
18456
|
-
|
|
18457
|
-
|
|
18458
|
-
}), array(LogEntrySchema).readonly());
|
|
18459
|
-
var CpuBreakdownSchema = object({
|
|
18460
|
-
total: number(),
|
|
18461
|
-
user: number(),
|
|
18462
|
-
system: number(),
|
|
18463
|
-
irq: number(),
|
|
18464
|
-
nice: number(),
|
|
18465
|
-
loadAvg: tuple([
|
|
18466
|
-
number(),
|
|
18467
|
-
number(),
|
|
18468
|
-
number()
|
|
18469
|
-
]),
|
|
18470
|
-
cores: number()
|
|
18405
|
+
retryAfterMs: number().optional()
|
|
18406
|
+
})]);
|
|
18407
|
+
/**
|
|
18408
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
18409
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
18410
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
18411
|
+
*/
|
|
18412
|
+
var LlmImageSchema = object({
|
|
18413
|
+
bytes: _instanceof(Uint8Array),
|
|
18414
|
+
mimeType: string()
|
|
18471
18415
|
});
|
|
18472
|
-
var
|
|
18473
|
-
|
|
18474
|
-
|
|
18475
|
-
|
|
18476
|
-
|
|
18477
|
-
|
|
18478
|
-
|
|
18416
|
+
var LlmGenerateBaseInputSchema = object({
|
|
18417
|
+
/** Collection routing (the notification-output posture). */
|
|
18418
|
+
addonId: string().optional(),
|
|
18419
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
18420
|
+
profileId: string().optional(),
|
|
18421
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
18422
|
+
consumer: string(),
|
|
18423
|
+
system: string().optional(),
|
|
18424
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
18425
|
+
prompt: string(),
|
|
18426
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
18427
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
18428
|
+
/** Per-call override of the profile default. */
|
|
18429
|
+
maxTokens: number().int().positive().optional(),
|
|
18430
|
+
temperature: number().optional()
|
|
18431
|
+
});
|
|
18432
|
+
/**
|
|
18433
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
18434
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
18435
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
18436
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
18437
|
+
* this only through the `llm` cap's methods.
|
|
18438
|
+
*
|
|
18439
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
18440
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
18441
|
+
* watchdog — operator decision #3).
|
|
18442
|
+
*/
|
|
18443
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
18444
|
+
object({
|
|
18445
|
+
kind: literal("catalog"),
|
|
18446
|
+
catalogId: string()
|
|
18447
|
+
}),
|
|
18448
|
+
object({
|
|
18449
|
+
kind: literal("url"),
|
|
18450
|
+
url: string(),
|
|
18451
|
+
sha256: string().optional()
|
|
18452
|
+
}),
|
|
18453
|
+
object({
|
|
18454
|
+
kind: literal("path"),
|
|
18455
|
+
path: string()
|
|
18456
|
+
})
|
|
18457
|
+
]);
|
|
18458
|
+
var ManagedRuntimeConfigSchema = object({
|
|
18459
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
18460
|
+
nodeId: string(),
|
|
18461
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
18462
|
+
engine: _enum(["llama-cpp"]),
|
|
18463
|
+
model: ManagedModelRefSchema,
|
|
18464
|
+
contextSize: number().int().default(4096),
|
|
18465
|
+
/** 0 = CPU-only. */
|
|
18466
|
+
gpuLayers: number().int().default(0),
|
|
18467
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
18468
|
+
threads: number().int().optional(),
|
|
18469
|
+
/** Concurrent slots. */
|
|
18470
|
+
parallel: number().int().default(1),
|
|
18471
|
+
/** Else lazy: first generate boots it. */
|
|
18472
|
+
autoStart: boolean().default(false),
|
|
18473
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
18474
|
+
idleStopMinutes: number().int().default(30)
|
|
18475
|
+
});
|
|
18476
|
+
var LlmRuntimeStatusSchema = object({
|
|
18477
|
+
/** Status is ALWAYS node-qualified. */
|
|
18478
|
+
nodeId: string(),
|
|
18479
|
+
state: _enum([
|
|
18480
|
+
"stopped",
|
|
18481
|
+
"downloading",
|
|
18482
|
+
"starting",
|
|
18483
|
+
"ready",
|
|
18484
|
+
"crashed",
|
|
18485
|
+
"failed"
|
|
18486
|
+
]),
|
|
18487
|
+
pid: number().optional(),
|
|
18488
|
+
port: number().optional(),
|
|
18489
|
+
modelPath: string().optional(),
|
|
18490
|
+
modelId: string().optional(),
|
|
18491
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
18492
|
+
lastError: string().optional(),
|
|
18493
|
+
crashesInWindow: number(),
|
|
18494
|
+
/** Child RSS (sampled best-effort). */
|
|
18495
|
+
memoryBytes: number().optional(),
|
|
18496
|
+
vramBytes: number().optional()
|
|
18497
|
+
});
|
|
18498
|
+
var LlmNodeModelSchema = object({
|
|
18499
|
+
file: string(),
|
|
18500
|
+
sizeBytes: number(),
|
|
18501
|
+
catalogId: string().optional(),
|
|
18502
|
+
installedAt: number().optional()
|
|
18503
|
+
});
|
|
18504
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
18505
|
+
nodeId: string(),
|
|
18506
|
+
modelsBytes: number(),
|
|
18507
|
+
freeBytes: number().optional()
|
|
18508
|
+
});
|
|
18509
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
18510
|
+
images: array(LlmImageSchema).optional(),
|
|
18511
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
18512
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
18513
|
+
timeoutMs: number().int().positive().optional()
|
|
18514
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
18515
|
+
kind: "mutation",
|
|
18516
|
+
auth: "admin"
|
|
18517
|
+
}), method(object({}), _void(), {
|
|
18518
|
+
kind: "mutation",
|
|
18519
|
+
auth: "admin"
|
|
18520
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
18521
|
+
kind: "mutation",
|
|
18522
|
+
auth: "admin"
|
|
18523
|
+
}), method(object({ file: string() }), _void(), {
|
|
18524
|
+
kind: "mutation",
|
|
18525
|
+
auth: "admin"
|
|
18526
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
18527
|
+
/**
|
|
18528
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
18529
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
18530
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
18531
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
18532
|
+
* (hub-placed); the cap stays open for future providers.
|
|
18533
|
+
*
|
|
18534
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
18535
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
18536
|
+
* write; a stored key NEVER round-trips to a client.
|
|
18537
|
+
*/
|
|
18538
|
+
var LlmProfileKindSchema = _enum([
|
|
18539
|
+
"openai-compatible",
|
|
18540
|
+
"openai",
|
|
18541
|
+
"anthropic",
|
|
18542
|
+
"google",
|
|
18543
|
+
"managed-local"
|
|
18544
|
+
]);
|
|
18545
|
+
var LlmProfileSchema = object({
|
|
18546
|
+
id: string(),
|
|
18547
|
+
name: string(),
|
|
18548
|
+
kind: LlmProfileKindSchema,
|
|
18549
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
18550
|
+
addonId: string(),
|
|
18551
|
+
enabled: boolean(),
|
|
18552
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
18553
|
+
model: string(),
|
|
18554
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
18555
|
+
baseUrl: string().optional(),
|
|
18556
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
18557
|
+
apiKey: string().optional(),
|
|
18558
|
+
supportsVision: boolean(),
|
|
18559
|
+
temperature: number().min(0).max(2).optional(),
|
|
18560
|
+
maxTokens: number().int().positive().optional(),
|
|
18561
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
18562
|
+
extraHeaders: record(string(), string()).optional(),
|
|
18563
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
18564
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
18565
|
+
});
|
|
18566
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
18567
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
18568
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
18569
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
18570
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
18571
|
+
kind: LlmProfileKindSchema,
|
|
18572
|
+
label: string(),
|
|
18573
|
+
icon: string(),
|
|
18574
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
18575
|
+
addonId: string(),
|
|
18576
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
18577
|
+
});
|
|
18578
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
18579
|
+
var LlmDefaultSchema = object({
|
|
18580
|
+
selector: LlmDefaultSelectorSchema,
|
|
18581
|
+
profileId: string()
|
|
18582
|
+
});
|
|
18583
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
18584
|
+
var LlmUsageRollupSchema = object({
|
|
18585
|
+
day: string(),
|
|
18586
|
+
consumer: string(),
|
|
18587
|
+
profileId: string(),
|
|
18588
|
+
calls: number(),
|
|
18589
|
+
okCalls: number(),
|
|
18590
|
+
errorCalls: number(),
|
|
18591
|
+
inputTokens: number(),
|
|
18592
|
+
outputTokens: number(),
|
|
18593
|
+
avgLatencyMs: number()
|
|
18594
|
+
});
|
|
18595
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
18596
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
18597
|
+
id: string(),
|
|
18598
|
+
label: string(),
|
|
18599
|
+
family: string(),
|
|
18600
|
+
purpose: _enum(["text", "vision"]),
|
|
18601
|
+
url: string(),
|
|
18602
|
+
sha256: string(),
|
|
18603
|
+
sizeBytes: number(),
|
|
18604
|
+
quantization: string(),
|
|
18605
|
+
/** Load-time guidance shown in the picker. */
|
|
18606
|
+
minRamBytes: number(),
|
|
18607
|
+
contextSizeDefault: number().int(),
|
|
18608
|
+
/** Vision models: companion projector file. */
|
|
18609
|
+
mmprojUrl: string().optional()
|
|
18610
|
+
});
|
|
18611
|
+
var LlmRuntimeNodeSchema = object({
|
|
18612
|
+
nodeId: string(),
|
|
18613
|
+
reachable: boolean(),
|
|
18614
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
18615
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
18616
|
+
error: string().optional()
|
|
18617
|
+
});
|
|
18618
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
18619
|
+
var ProfileRefInputSchema = object({
|
|
18620
|
+
addonId: string(),
|
|
18621
|
+
profileId: string()
|
|
18622
|
+
});
|
|
18623
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
18624
|
+
kind: "mutation",
|
|
18625
|
+
auth: "admin"
|
|
18626
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
18627
|
+
kind: "mutation",
|
|
18628
|
+
auth: "admin"
|
|
18629
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
18630
|
+
kind: "mutation",
|
|
18631
|
+
auth: "admin"
|
|
18632
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
18633
|
+
selector: LlmDefaultSelectorSchema,
|
|
18634
|
+
profileId: string().nullable()
|
|
18635
|
+
}), _void(), {
|
|
18636
|
+
kind: "mutation",
|
|
18637
|
+
auth: "admin"
|
|
18638
|
+
}), method(object({
|
|
18639
|
+
since: number().optional(),
|
|
18640
|
+
until: number().optional(),
|
|
18641
|
+
consumer: string().optional(),
|
|
18642
|
+
profileId: string().optional()
|
|
18643
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
18644
|
+
nodeId: string(),
|
|
18645
|
+
model: ManagedModelRefSchema
|
|
18646
|
+
}), _void(), {
|
|
18647
|
+
kind: "mutation",
|
|
18648
|
+
auth: "admin"
|
|
18649
|
+
}), method(object({
|
|
18650
|
+
nodeId: string(),
|
|
18651
|
+
file: string()
|
|
18652
|
+
}), _void(), {
|
|
18653
|
+
kind: "mutation",
|
|
18654
|
+
auth: "admin"
|
|
18655
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
18656
|
+
kind: "mutation",
|
|
18657
|
+
auth: "admin"
|
|
18658
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
18659
|
+
kind: "mutation",
|
|
18660
|
+
auth: "admin"
|
|
18661
|
+
});
|
|
18662
|
+
var LogLevelSchema = _enum([
|
|
18663
|
+
"debug",
|
|
18664
|
+
"info",
|
|
18665
|
+
"warn",
|
|
18666
|
+
"error"
|
|
18667
|
+
]);
|
|
18668
|
+
var LogEntrySchema = object({
|
|
18669
|
+
timestamp: date(),
|
|
18670
|
+
level: LogLevelSchema,
|
|
18671
|
+
scope: array(string()),
|
|
18672
|
+
message: string(),
|
|
18673
|
+
meta: record(string(), unknown()).optional(),
|
|
18674
|
+
tags: record(string(), string()).optional()
|
|
18675
|
+
});
|
|
18676
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
18677
|
+
scope: array(string()).optional(),
|
|
18678
|
+
level: LogLevelSchema.optional(),
|
|
18679
|
+
since: date().optional(),
|
|
18680
|
+
until: date().optional(),
|
|
18681
|
+
limit: number().optional(),
|
|
18682
|
+
tags: record(string(), string()).optional()
|
|
18683
|
+
}), array(LogEntrySchema).readonly());
|
|
18684
|
+
/**
|
|
18685
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
18686
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
18687
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
18688
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
18689
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
18690
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
18691
|
+
*
|
|
18692
|
+
* A contribution is a discriminated union on `kind`:
|
|
18693
|
+
*
|
|
18694
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
18695
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
18696
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
18697
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18698
|
+
* login page needs NO change.
|
|
18699
|
+
*
|
|
18700
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
18701
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
18702
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
18703
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
18704
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
18705
|
+
*
|
|
18706
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
18707
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
18708
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
18709
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
18710
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
18711
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
18712
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
18713
|
+
* decision.
|
|
18714
|
+
*
|
|
18715
|
+
* Every contribution carries a `stage`:
|
|
18716
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
18717
|
+
* magic-link buttons; a future usernameless passkey).
|
|
18718
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18719
|
+
* returned `factors` (passkey-as-2FA today).
|
|
18720
|
+
*
|
|
18721
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
18722
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
18723
|
+
* tRPC router.
|
|
18724
|
+
*/
|
|
18725
|
+
/** When a login method renders in the two-phase login flow. */
|
|
18726
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
18727
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
18728
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
18729
|
+
object({
|
|
18730
|
+
kind: literal("redirect"),
|
|
18731
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
18732
|
+
id: string(),
|
|
18733
|
+
/** Operator-facing button label. */
|
|
18734
|
+
label: string(),
|
|
18735
|
+
/** lucide-react icon name. */
|
|
18736
|
+
icon: string().optional(),
|
|
18737
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
18738
|
+
startUrl: string(),
|
|
18739
|
+
stage: LoginStageEnum
|
|
18740
|
+
}),
|
|
18741
|
+
object({
|
|
18742
|
+
kind: literal("widget"),
|
|
18743
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
18744
|
+
id: string(),
|
|
18745
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
18746
|
+
addonId: string(),
|
|
18747
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
18748
|
+
bundle: string(),
|
|
18749
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
18750
|
+
remote: WidgetRemoteSchema,
|
|
18751
|
+
stage: LoginStageEnum
|
|
18752
|
+
}),
|
|
18753
|
+
object({
|
|
18754
|
+
kind: literal("passkey"),
|
|
18755
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
18756
|
+
id: string(),
|
|
18757
|
+
/** Operator-facing button label. */
|
|
18758
|
+
label: string(),
|
|
18759
|
+
stage: LoginStageEnum,
|
|
18760
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
18761
|
+
rpId: string(),
|
|
18762
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
18763
|
+
origin: string().nullable()
|
|
18764
|
+
})
|
|
18765
|
+
]);
|
|
18766
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
18767
|
+
var CpuBreakdownSchema = object({
|
|
18768
|
+
total: number(),
|
|
18769
|
+
user: number(),
|
|
18770
|
+
system: number(),
|
|
18771
|
+
irq: number(),
|
|
18772
|
+
nice: number(),
|
|
18773
|
+
loadAvg: tuple([
|
|
18774
|
+
number(),
|
|
18775
|
+
number(),
|
|
18776
|
+
number()
|
|
18777
|
+
]),
|
|
18778
|
+
cores: number()
|
|
18779
|
+
});
|
|
18780
|
+
var MemoryInfoSchema = object({
|
|
18781
|
+
percent: number(),
|
|
18782
|
+
totalBytes: number(),
|
|
18783
|
+
usedBytes: number(),
|
|
18784
|
+
availableBytes: number(),
|
|
18785
|
+
swapUsedBytes: number(),
|
|
18786
|
+
swapTotalBytes: number()
|
|
18479
18787
|
});
|
|
18480
18788
|
var DiskIoSnapshotSchema = object({
|
|
18481
18789
|
readBytes: number(),
|
|
@@ -18928,14 +19236,14 @@ var TargetKindCapsSchema = object({
|
|
|
18928
19236
|
* the union is large and not meant for runtime validation here; the exported
|
|
18929
19237
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
18930
19238
|
*/
|
|
18931
|
-
var ConfigSchemaPassthrough
|
|
19239
|
+
var ConfigSchemaPassthrough = unknown();
|
|
18932
19240
|
var TargetKindSchema = object({
|
|
18933
19241
|
kind: string(),
|
|
18934
19242
|
label: string(),
|
|
18935
19243
|
icon: string(),
|
|
18936
19244
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
18937
19245
|
addonId: string(),
|
|
18938
|
-
configSchema: ConfigSchemaPassthrough
|
|
19246
|
+
configSchema: ConfigSchemaPassthrough,
|
|
18939
19247
|
supportsDiscovery: boolean(),
|
|
18940
19248
|
caps: TargetKindCapsSchema
|
|
18941
19249
|
});
|
|
@@ -18988,297 +19296,493 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
18988
19296
|
enabled: boolean()
|
|
18989
19297
|
}), _void(), { kind: "mutation" });
|
|
18990
19298
|
/**
|
|
18991
|
-
*
|
|
18992
|
-
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
18993
|
-
* caps stay wire-compatible without a circular cap→cap import.
|
|
19299
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
18994
19300
|
*
|
|
18995
|
-
*
|
|
18996
|
-
*
|
|
18997
|
-
*
|
|
18998
|
-
|
|
18999
|
-
|
|
19000
|
-
|
|
19001
|
-
|
|
19002
|
-
|
|
19003
|
-
|
|
19004
|
-
|
|
19005
|
-
|
|
19006
|
-
|
|
19007
|
-
|
|
19008
|
-
|
|
19009
|
-
|
|
19010
|
-
|
|
19011
|
-
|
|
19012
|
-
|
|
19013
|
-
|
|
19014
|
-
|
|
19015
|
-
|
|
19016
|
-
|
|
19017
|
-
|
|
19018
|
-
|
|
19019
|
-
|
|
19020
|
-
|
|
19021
|
-
|
|
19022
|
-
ok: literal(false),
|
|
19023
|
-
code: LlmErrorCodeSchema,
|
|
19024
|
-
message: string(),
|
|
19025
|
-
retryAfterMs: number().optional()
|
|
19026
|
-
})]);
|
|
19301
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
19302
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
19303
|
+
*
|
|
19304
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
19305
|
+
* `notification-center` module), hooked on the durable persistence
|
|
19306
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
19307
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
19308
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
19309
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
19310
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
19311
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
19312
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
19313
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
19314
|
+
* target kind's own caps/degrade engine).
|
|
19315
|
+
*
|
|
19316
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
19317
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
19318
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
19319
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
19320
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
19321
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
19322
|
+
* P2+ (see spec §7).
|
|
19323
|
+
*
|
|
19324
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
19325
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
19326
|
+
* schema/interface drift is explicitly not repeated).
|
|
19327
|
+
*/
|
|
19027
19328
|
/**
|
|
19028
|
-
*
|
|
19029
|
-
*
|
|
19030
|
-
*
|
|
19329
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
19330
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
19331
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
19332
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
19333
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
19334
|
+
* change of a LINKED device, one row per linked camera)
|
|
19335
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
19336
|
+
* delivery / pick-up)
|
|
19337
|
+
*
|
|
19338
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
19339
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
19340
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
19341
|
+
* one trigger.
|
|
19031
19342
|
*/
|
|
19032
|
-
var
|
|
19033
|
-
|
|
19034
|
-
|
|
19343
|
+
var NcDeliverySchema = _enum([
|
|
19344
|
+
"immediate",
|
|
19345
|
+
"track-end",
|
|
19346
|
+
"device-event",
|
|
19347
|
+
"package-event"
|
|
19348
|
+
]);
|
|
19349
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
19350
|
+
var NcScheduleSchema = object({
|
|
19351
|
+
windows: array(object({
|
|
19352
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
19353
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
19354
|
+
startMinute: number().int().min(0).max(1439),
|
|
19355
|
+
endMinute: number().int().min(0).max(1439)
|
|
19356
|
+
})).min(1),
|
|
19357
|
+
/** IANA timezone; default = hub host timezone. */
|
|
19358
|
+
timezone: string().optional(),
|
|
19359
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
19360
|
+
invert: boolean().optional()
|
|
19035
19361
|
});
|
|
19036
|
-
|
|
19037
|
-
|
|
19038
|
-
|
|
19039
|
-
/**
|
|
19040
|
-
|
|
19041
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
19042
|
-
consumer: string(),
|
|
19043
|
-
system: string().optional(),
|
|
19044
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
19045
|
-
prompt: string(),
|
|
19046
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
19047
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
19048
|
-
/** Per-call override of the profile default. */
|
|
19049
|
-
maxTokens: number().int().positive().optional(),
|
|
19050
|
-
temperature: number().optional()
|
|
19362
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
19363
|
+
var NcPlateMatcherSchema = object({
|
|
19364
|
+
values: array(string().min(1)).min(1),
|
|
19365
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
19366
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
19051
19367
|
});
|
|
19052
19368
|
/**
|
|
19053
|
-
*
|
|
19054
|
-
*
|
|
19055
|
-
*
|
|
19056
|
-
*
|
|
19057
|
-
*
|
|
19058
|
-
*
|
|
19059
|
-
*
|
|
19060
|
-
*
|
|
19061
|
-
*
|
|
19369
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
19370
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
19371
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
19372
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
19373
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
19374
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
19375
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
19376
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
19377
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
19378
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
19379
|
+
* (declared SQLite collection, reseeded on boot).
|
|
19062
19380
|
*/
|
|
19063
|
-
var
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
|
|
19075
|
-
|
|
19076
|
-
|
|
19077
|
-
|
|
19078
|
-
var
|
|
19079
|
-
|
|
19080
|
-
|
|
19081
|
-
|
|
19082
|
-
engine: _enum(["llama-cpp"]),
|
|
19083
|
-
model: ManagedModelRefSchema,
|
|
19084
|
-
contextSize: number().int().default(4096),
|
|
19085
|
-
/** 0 = CPU-only. */
|
|
19086
|
-
gpuLayers: number().int().default(0),
|
|
19087
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
19088
|
-
threads: number().int().optional(),
|
|
19089
|
-
/** Concurrent slots. */
|
|
19090
|
-
parallel: number().int().default(1),
|
|
19091
|
-
/** Else lazy: first generate boots it. */
|
|
19092
|
-
autoStart: boolean().default(false),
|
|
19093
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
19094
|
-
idleStopMinutes: number().int().default(30)
|
|
19381
|
+
var NcOccupancyConditionSchema = object({
|
|
19382
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
19383
|
+
zoneId: string().optional(),
|
|
19384
|
+
/** Object class to count; absent = any class. */
|
|
19385
|
+
className: string().optional(),
|
|
19386
|
+
op: _enum([
|
|
19387
|
+
"became-occupied",
|
|
19388
|
+
"became-free",
|
|
19389
|
+
">=",
|
|
19390
|
+
"<="
|
|
19391
|
+
]).default("became-occupied"),
|
|
19392
|
+
count: number().int().min(0).default(1),
|
|
19393
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
19394
|
+
});
|
|
19395
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
19396
|
+
var NcZoneConditionSchema = object({
|
|
19397
|
+
ids: array(string().min(1)).min(1),
|
|
19398
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
19399
|
+
match: _enum(["any", "all"]).default("any")
|
|
19095
19400
|
});
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
|
|
19107
|
-
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
|
|
19116
|
-
|
|
19401
|
+
/**
|
|
19402
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
19403
|
+
* membership lists are OR within the list (spec §2.3).
|
|
19404
|
+
*/
|
|
19405
|
+
var NcConditionsSchema = object({
|
|
19406
|
+
/** Device scope — absent = all devices. */
|
|
19407
|
+
devices: array(number()).optional(),
|
|
19408
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
19409
|
+
classes: array(string().min(1)).optional(),
|
|
19410
|
+
/** Veto classes — any overlap fails the rule. */
|
|
19411
|
+
classesExclude: array(string().min(1)).optional(),
|
|
19412
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
19413
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
19414
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
19415
|
+
zones: NcZoneConditionSchema.optional(),
|
|
19416
|
+
/** Veto zones — any hit fails the rule. */
|
|
19417
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
19418
|
+
/**
|
|
19419
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
19420
|
+
* (identity name / plate text / subclass).
|
|
19421
|
+
*/
|
|
19422
|
+
labelEquals: array(string().min(1)).optional(),
|
|
19423
|
+
/**
|
|
19424
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
19425
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
19426
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
19427
|
+
*/
|
|
19428
|
+
identities: array(string().min(1)).optional(),
|
|
19429
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
19430
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
19431
|
+
/**
|
|
19432
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
19433
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
19434
|
+
* identity display name). A record with NO label passes (nothing to
|
|
19435
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
19436
|
+
*/
|
|
19437
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
19438
|
+
/**
|
|
19439
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
19440
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
19441
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
19442
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
19443
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
19444
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
19445
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
19446
|
+
*/
|
|
19447
|
+
minImportance: number().min(0).max(1).optional(),
|
|
19448
|
+
/**
|
|
19449
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
19450
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
19451
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
19452
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
19453
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
19454
|
+
*/
|
|
19455
|
+
minDwellSeconds: number().min(0).optional(),
|
|
19456
|
+
/**
|
|
19457
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
19458
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
19459
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
19460
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
19461
|
+
* tracks carry `sensor`.
|
|
19462
|
+
*/
|
|
19463
|
+
source: _enum([
|
|
19464
|
+
"pipeline",
|
|
19465
|
+
"onboard",
|
|
19466
|
+
"sensor",
|
|
19467
|
+
"any"
|
|
19468
|
+
]).optional(),
|
|
19469
|
+
/**
|
|
19470
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
19471
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
19472
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
19473
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
19474
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
19475
|
+
*
|
|
19476
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
19477
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
19478
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
19479
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
19480
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
19481
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
19482
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
19483
|
+
* one track the higher of the two is used. A track that ended with no
|
|
19484
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
19485
|
+
* closed for it (an un-recognized subject).
|
|
19486
|
+
*/
|
|
19487
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
19488
|
+
/**
|
|
19489
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
19490
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
19491
|
+
* against the token carried on the device-event subject (extracted from the
|
|
19492
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
19493
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
19494
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
19495
|
+
*/
|
|
19496
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
19497
|
+
/**
|
|
19498
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
19499
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
19500
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
19501
|
+
*/
|
|
19502
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
19503
|
+
/**
|
|
19504
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
19505
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
19506
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
19507
|
+
* on the package-event trigger).
|
|
19508
|
+
*/
|
|
19509
|
+
packagePhase: _enum([
|
|
19510
|
+
"delivered",
|
|
19511
|
+
"picked-up",
|
|
19512
|
+
"both"
|
|
19513
|
+
]).optional(),
|
|
19514
|
+
/**
|
|
19515
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
19516
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
19517
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
19518
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
19519
|
+
*/
|
|
19520
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
19521
|
+
/**
|
|
19522
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
19523
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
19524
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
19525
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
19526
|
+
*/
|
|
19527
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
19117
19528
|
});
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
|
|
19529
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
19530
|
+
var NcRuleTargetSchema = object({
|
|
19531
|
+
/** `notification-output` Target id. */
|
|
19532
|
+
targetId: string().min(1),
|
|
19533
|
+
/**
|
|
19534
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
19535
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
19536
|
+
* degrade engine drops what the backend can't render.
|
|
19537
|
+
*/
|
|
19538
|
+
params: record(string(), unknown()).optional()
|
|
19123
19539
|
});
|
|
19124
|
-
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19540
|
+
/**
|
|
19541
|
+
* Media attachment policy (P1 still-image subset).
|
|
19542
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
19543
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
19544
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
19545
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
19546
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
19547
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
19548
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
19549
|
+
* name), so the choice never drifts from the record that fired it.
|
|
19550
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
19551
|
+
* - `none` — no attachment.
|
|
19552
|
+
*/
|
|
19553
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
19554
|
+
"best",
|
|
19555
|
+
"best-matching",
|
|
19556
|
+
"keyFrame",
|
|
19557
|
+
"none"
|
|
19558
|
+
]).default("best") });
|
|
19559
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
19560
|
+
var NcThrottleSchema = object({
|
|
19561
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
19562
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
19563
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
19564
|
+
});
|
|
19565
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
19566
|
+
var NcRuleInputSchema = object({
|
|
19567
|
+
name: string().min(1).max(200),
|
|
19568
|
+
enabled: boolean().default(true),
|
|
19569
|
+
delivery: NcDeliverySchema,
|
|
19570
|
+
conditions: NcConditionsSchema.default({}),
|
|
19571
|
+
schedule: NcScheduleSchema.optional(),
|
|
19572
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
19573
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
19574
|
+
throttle: NcThrottleSchema.default({
|
|
19575
|
+
cooldownSec: 60,
|
|
19576
|
+
scope: "rule-device"
|
|
19577
|
+
}),
|
|
19578
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
19579
|
+
template: object({
|
|
19580
|
+
title: string().max(500).optional(),
|
|
19581
|
+
body: string().max(2e3).optional()
|
|
19582
|
+
}).optional(),
|
|
19583
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
19584
|
+
priority: number().int().min(1).max(5).default(3),
|
|
19585
|
+
/**
|
|
19586
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
19587
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
19588
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
19589
|
+
*/
|
|
19590
|
+
ownerUserId: string().optional()
|
|
19128
19591
|
});
|
|
19129
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
19130
|
-
images: array(LlmImageSchema).optional(),
|
|
19131
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
19132
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
19133
|
-
timeoutMs: number().int().positive().optional()
|
|
19134
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
19135
|
-
kind: "mutation",
|
|
19136
|
-
auth: "admin"
|
|
19137
|
-
}), method(object({}), _void(), {
|
|
19138
|
-
kind: "mutation",
|
|
19139
|
-
auth: "admin"
|
|
19140
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
19141
|
-
kind: "mutation",
|
|
19142
|
-
auth: "admin"
|
|
19143
|
-
}), method(object({ file: string() }), _void(), {
|
|
19144
|
-
kind: "mutation",
|
|
19145
|
-
auth: "admin"
|
|
19146
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
19147
19592
|
/**
|
|
19148
|
-
* `
|
|
19149
|
-
*
|
|
19150
|
-
*
|
|
19151
|
-
*
|
|
19152
|
-
*
|
|
19153
|
-
*
|
|
19154
|
-
*
|
|
19155
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
19156
|
-
* write; a stored key NEVER round-trips to a client.
|
|
19593
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
19594
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
19595
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
19596
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
19597
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
19598
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
19599
|
+
* `updateRule` patch.
|
|
19157
19600
|
*/
|
|
19158
|
-
var
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
"anthropic",
|
|
19162
|
-
"google",
|
|
19163
|
-
"managed-local"
|
|
19164
|
-
]);
|
|
19165
|
-
var LlmProfileSchema = object({
|
|
19601
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
19602
|
+
/** A persisted rule. */
|
|
19603
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
19166
19604
|
id: string(),
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
|
|
19177
|
-
apiKey: string().optional(),
|
|
19178
|
-
supportsVision: boolean(),
|
|
19179
|
-
temperature: number().min(0).max(2).optional(),
|
|
19180
|
-
maxTokens: number().int().positive().optional(),
|
|
19181
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
19182
|
-
extraHeaders: record(string(), string()).optional(),
|
|
19183
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
19184
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
19185
|
-
});
|
|
19186
|
-
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
19187
|
-
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
19188
|
-
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
19189
|
-
var ConfigSchemaPassthrough = unknown();
|
|
19190
|
-
var LlmProfileKindDescriptorSchema = object({
|
|
19191
|
-
kind: LlmProfileKindSchema,
|
|
19192
|
-
label: string(),
|
|
19193
|
-
icon: string(),
|
|
19194
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
19195
|
-
addonId: string(),
|
|
19196
|
-
configSchema: ConfigSchemaPassthrough
|
|
19197
|
-
});
|
|
19198
|
-
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
19199
|
-
var LlmDefaultSchema = object({
|
|
19200
|
-
selector: LlmDefaultSelectorSchema,
|
|
19201
|
-
profileId: string()
|
|
19605
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
19606
|
+
createdBy: string(),
|
|
19607
|
+
createdAt: number(),
|
|
19608
|
+
updatedAt: number(),
|
|
19609
|
+
/**
|
|
19610
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
19611
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
19612
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
19613
|
+
*/
|
|
19614
|
+
disabledTargetIds: array(string()).default([])
|
|
19202
19615
|
});
|
|
19203
|
-
|
|
19204
|
-
|
|
19205
|
-
|
|
19206
|
-
|
|
19207
|
-
|
|
19208
|
-
|
|
19209
|
-
|
|
19210
|
-
|
|
19211
|
-
|
|
19212
|
-
|
|
19213
|
-
|
|
19616
|
+
var NcTestResultSchema = object({
|
|
19617
|
+
recordId: string(),
|
|
19618
|
+
recordKind: _enum([
|
|
19619
|
+
"object-event",
|
|
19620
|
+
"track",
|
|
19621
|
+
"device-event",
|
|
19622
|
+
"package-event"
|
|
19623
|
+
]),
|
|
19624
|
+
deviceId: number(),
|
|
19625
|
+
timestamp: number(),
|
|
19626
|
+
wouldFire: boolean(),
|
|
19627
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
19628
|
+
failedCondition: string().optional(),
|
|
19629
|
+
className: string().optional(),
|
|
19630
|
+
label: string().optional()
|
|
19214
19631
|
});
|
|
19215
|
-
|
|
19216
|
-
|
|
19632
|
+
var NcConditionDescriptorSchema = object({
|
|
19633
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
19217
19634
|
id: string(),
|
|
19635
|
+
group: _enum([
|
|
19636
|
+
"scope",
|
|
19637
|
+
"class",
|
|
19638
|
+
"zones",
|
|
19639
|
+
"quality",
|
|
19640
|
+
"label",
|
|
19641
|
+
"schedule",
|
|
19642
|
+
"device",
|
|
19643
|
+
"package",
|
|
19644
|
+
"occupancy"
|
|
19645
|
+
]),
|
|
19218
19646
|
label: string(),
|
|
19219
|
-
|
|
19220
|
-
|
|
19221
|
-
|
|
19222
|
-
|
|
19223
|
-
|
|
19224
|
-
|
|
19225
|
-
|
|
19226
|
-
|
|
19227
|
-
|
|
19228
|
-
|
|
19229
|
-
|
|
19647
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
19648
|
+
valueType: _enum([
|
|
19649
|
+
"deviceIdList",
|
|
19650
|
+
"stringList",
|
|
19651
|
+
"number01",
|
|
19652
|
+
"number",
|
|
19653
|
+
"sourceSelect",
|
|
19654
|
+
"zoneSelection",
|
|
19655
|
+
"zoneIdList",
|
|
19656
|
+
"schedule",
|
|
19657
|
+
"plateMatcher",
|
|
19658
|
+
"packagePhase",
|
|
19659
|
+
"polygonDraw",
|
|
19660
|
+
"occupancy"
|
|
19661
|
+
]),
|
|
19662
|
+
operator: _enum([
|
|
19663
|
+
"in",
|
|
19664
|
+
"notIn",
|
|
19665
|
+
"anyOf",
|
|
19666
|
+
"allOf",
|
|
19667
|
+
"gte",
|
|
19668
|
+
"fuzzyIn",
|
|
19669
|
+
"withinSchedule"
|
|
19670
|
+
]),
|
|
19671
|
+
/** Which delivery kinds the condition applies to. */
|
|
19672
|
+
appliesTo: array(NcDeliverySchema),
|
|
19673
|
+
phase: string(),
|
|
19674
|
+
description: string().optional()
|
|
19230
19675
|
});
|
|
19231
|
-
|
|
19232
|
-
|
|
19233
|
-
|
|
19234
|
-
|
|
19235
|
-
|
|
19236
|
-
|
|
19676
|
+
/**
|
|
19677
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
19678
|
+
* durable outbox row's own status (single source of truth):
|
|
19679
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
19680
|
+
* - `sent` — delivered (terminal)
|
|
19681
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
19682
|
+
* backend rejection / a deleted target (terminal; carries
|
|
19683
|
+
* the failure `error`)
|
|
19684
|
+
*
|
|
19685
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
19686
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
19687
|
+
*/
|
|
19688
|
+
var NcHistoryStatusSchema = _enum([
|
|
19689
|
+
"pending",
|
|
19690
|
+
"sent",
|
|
19691
|
+
"dead"
|
|
19692
|
+
]);
|
|
19693
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
19694
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
19695
|
+
"object-event",
|
|
19696
|
+
"track-end",
|
|
19697
|
+
"device-event",
|
|
19698
|
+
"package-event"
|
|
19699
|
+
]);
|
|
19700
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
19701
|
+
var NcHistorySubjectSchema = object({
|
|
19702
|
+
className: string(),
|
|
19703
|
+
label: string().optional(),
|
|
19704
|
+
confidence: number().optional(),
|
|
19705
|
+
zones: array(string()),
|
|
19706
|
+
timestamp: number()
|
|
19707
|
+
});
|
|
19708
|
+
/**
|
|
19709
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
19710
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
19711
|
+
* NO second write path, so history can never drift from delivery state).
|
|
19712
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
19713
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
19714
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
19715
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
19716
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
19717
|
+
* P1 (admin scope only).
|
|
19718
|
+
*/
|
|
19719
|
+
var NcHistoryEntrySchema = object({
|
|
19720
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
19721
|
+
id: string(),
|
|
19722
|
+
ruleId: string(),
|
|
19723
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
19724
|
+
ruleName: string(),
|
|
19725
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
19726
|
+
delivery: NcDeliverySchema,
|
|
19727
|
+
targetId: string(),
|
|
19728
|
+
deviceId: number(),
|
|
19729
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
19730
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
19731
|
+
recordId: string(),
|
|
19732
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
19733
|
+
trackId: string().optional(),
|
|
19734
|
+
status: NcHistoryStatusSchema,
|
|
19735
|
+
/** Delivery attempts made so far. */
|
|
19736
|
+
attempts: number().int(),
|
|
19737
|
+
/** Fire time (outbox enqueue). */
|
|
19738
|
+
createdAt: number(),
|
|
19739
|
+
/** Last transition time (terminal for sent / dead). */
|
|
19740
|
+
updatedAt: number(),
|
|
19741
|
+
/** Failure detail — present on a `dead` row. */
|
|
19742
|
+
error: string().optional(),
|
|
19743
|
+
subject: NcHistorySubjectSchema
|
|
19237
19744
|
});
|
|
19238
|
-
|
|
19239
|
-
|
|
19240
|
-
|
|
19241
|
-
|
|
19745
|
+
/**
|
|
19746
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
19747
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
19748
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
19749
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
19750
|
+
*/
|
|
19751
|
+
var NcHistoryFilterSchema = object({
|
|
19752
|
+
ruleId: string().optional(),
|
|
19753
|
+
deviceId: number().optional(),
|
|
19754
|
+
status: NcHistoryStatusSchema.optional(),
|
|
19755
|
+
since: number().optional(),
|
|
19756
|
+
until: number().optional(),
|
|
19757
|
+
limit: number().int().min(1).max(500).default(100)
|
|
19242
19758
|
});
|
|
19243
|
-
method(
|
|
19244
|
-
kind: "mutation",
|
|
19245
|
-
auth: "admin"
|
|
19246
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
19759
|
+
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 }), {
|
|
19247
19760
|
kind: "mutation",
|
|
19248
|
-
auth: "admin"
|
|
19249
|
-
|
|
19761
|
+
auth: "admin",
|
|
19762
|
+
caller: "required"
|
|
19763
|
+
}), method(object({
|
|
19764
|
+
ruleId: string(),
|
|
19765
|
+
patch: NcRulePatchSchema
|
|
19766
|
+
}), object({ rule: NcRuleSchema }), {
|
|
19250
19767
|
kind: "mutation",
|
|
19251
|
-
auth: "admin"
|
|
19252
|
-
|
|
19253
|
-
|
|
19254
|
-
profileId: string().nullable()
|
|
19255
|
-
}), _void(), {
|
|
19768
|
+
auth: "admin",
|
|
19769
|
+
caller: "required"
|
|
19770
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
19256
19771
|
kind: "mutation",
|
|
19257
19772
|
auth: "admin"
|
|
19258
19773
|
}), method(object({
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
profileId: string().optional()
|
|
19263
|
-
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
19264
|
-
nodeId: string(),
|
|
19265
|
-
model: ManagedModelRefSchema
|
|
19266
|
-
}), _void(), {
|
|
19774
|
+
ruleId: string(),
|
|
19775
|
+
enabled: boolean()
|
|
19776
|
+
}), object({ success: literal(true) }), {
|
|
19267
19777
|
kind: "mutation",
|
|
19268
19778
|
auth: "admin"
|
|
19269
19779
|
}), method(object({
|
|
19270
|
-
|
|
19271
|
-
|
|
19272
|
-
}),
|
|
19273
|
-
kind: "mutation",
|
|
19274
|
-
auth: "admin"
|
|
19275
|
-
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
19276
|
-
kind: "mutation",
|
|
19277
|
-
auth: "admin"
|
|
19278
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
19780
|
+
rule: NcRuleInputSchema,
|
|
19781
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
19782
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
19279
19783
|
kind: "mutation",
|
|
19280
19784
|
auth: "admin"
|
|
19281
|
-
});
|
|
19785
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
19282
19786
|
/**
|
|
19283
19787
|
* Zod schemas for persisted record types.
|
|
19284
19788
|
*
|
|
@@ -19964,7 +20468,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
19964
20468
|
}), method(object({
|
|
19965
20469
|
eventId: string(),
|
|
19966
20470
|
kind: MediaFileKindEnum.optional()
|
|
19967
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
20471
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
20472
|
+
trackId: string(),
|
|
20473
|
+
kinds: array(MediaFileKindEnum).optional()
|
|
20474
|
+
}), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
|
|
19968
20475
|
deviceId: number(),
|
|
19969
20476
|
timestamp: number(),
|
|
19970
20477
|
frameWidth: number(),
|
|
@@ -19985,76 +20492,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
19985
20492
|
eventId: string(),
|
|
19986
20493
|
timestamp: number()
|
|
19987
20494
|
});
|
|
19988
|
-
/**
|
|
19989
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
19990
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
19991
|
-
* caps into per-camera event-kind descriptors.
|
|
19992
|
-
*
|
|
19993
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
19994
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
19995
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
19996
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
19997
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
19998
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
19999
|
-
* eventful cap is missing.
|
|
20000
|
-
*/
|
|
20001
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
20002
|
-
var LEGACY_ICON = {
|
|
20003
|
-
motion: "motion",
|
|
20004
|
-
audio: "audio",
|
|
20005
|
-
person: "person",
|
|
20006
|
-
vehicle: "vehicle",
|
|
20007
|
-
animal: "animal",
|
|
20008
|
-
package: "package",
|
|
20009
|
-
door: "door",
|
|
20010
|
-
pir: "pir",
|
|
20011
|
-
smoke: "smoke",
|
|
20012
|
-
water: "water",
|
|
20013
|
-
button: "button",
|
|
20014
|
-
generic: "generic",
|
|
20015
|
-
gas: "smoke",
|
|
20016
|
-
vibration: "generic",
|
|
20017
|
-
tamper: "generic",
|
|
20018
|
-
presence: "person",
|
|
20019
|
-
lock: "generic",
|
|
20020
|
-
siren: "generic",
|
|
20021
|
-
switch: "generic",
|
|
20022
|
-
doorbell: "button"
|
|
20023
|
-
};
|
|
20024
|
-
function legacyIcon(iconId) {
|
|
20025
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
20026
|
-
}
|
|
20027
|
-
/**
|
|
20028
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
20029
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
20030
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
20031
|
-
*/
|
|
20032
|
-
var CAP_TO_KIND = {
|
|
20033
|
-
contact: "contact",
|
|
20034
|
-
motion: "motion-sensor",
|
|
20035
|
-
smoke: "smoke",
|
|
20036
|
-
flood: "flood",
|
|
20037
|
-
gas: "gas",
|
|
20038
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
20039
|
-
vibration: "vibration",
|
|
20040
|
-
tamper: "tamper",
|
|
20041
|
-
presence: "presence",
|
|
20042
|
-
"enum-sensor": "enum-sensor",
|
|
20043
|
-
"event-emitter": "device-event",
|
|
20044
|
-
"lock-control": "lock",
|
|
20045
|
-
switch: "switch",
|
|
20046
|
-
button: "button",
|
|
20047
|
-
doorbell: "doorbell"
|
|
20048
|
-
};
|
|
20049
|
-
function buildDescriptor(capName, kind) {
|
|
20050
|
-
const t = EVENT_TAXONOMY[kind];
|
|
20051
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
20052
|
-
return {
|
|
20053
|
-
...t,
|
|
20054
|
-
icon: legacyIcon(t.iconId)
|
|
20055
|
-
};
|
|
20056
|
-
}
|
|
20057
|
-
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
20058
20495
|
var CameraPipelineConfigSchema = object({
|
|
20059
20496
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
20060
20497
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -20540,6 +20977,76 @@ method(object({
|
|
|
20540
20977
|
auth: "admin"
|
|
20541
20978
|
});
|
|
20542
20979
|
/**
|
|
20980
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
20981
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
20982
|
+
* caps into per-camera event-kind descriptors.
|
|
20983
|
+
*
|
|
20984
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
20985
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
20986
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
20987
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
20988
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
20989
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
20990
|
+
* eventful cap is missing.
|
|
20991
|
+
*/
|
|
20992
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
20993
|
+
var LEGACY_ICON = {
|
|
20994
|
+
motion: "motion",
|
|
20995
|
+
audio: "audio",
|
|
20996
|
+
person: "person",
|
|
20997
|
+
vehicle: "vehicle",
|
|
20998
|
+
animal: "animal",
|
|
20999
|
+
package: "package",
|
|
21000
|
+
door: "door",
|
|
21001
|
+
pir: "pir",
|
|
21002
|
+
smoke: "smoke",
|
|
21003
|
+
water: "water",
|
|
21004
|
+
button: "button",
|
|
21005
|
+
generic: "generic",
|
|
21006
|
+
gas: "smoke",
|
|
21007
|
+
vibration: "generic",
|
|
21008
|
+
tamper: "generic",
|
|
21009
|
+
presence: "person",
|
|
21010
|
+
lock: "generic",
|
|
21011
|
+
siren: "generic",
|
|
21012
|
+
switch: "generic",
|
|
21013
|
+
doorbell: "button"
|
|
21014
|
+
};
|
|
21015
|
+
function legacyIcon(iconId) {
|
|
21016
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
21017
|
+
}
|
|
21018
|
+
/**
|
|
21019
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
21020
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
21021
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
21022
|
+
*/
|
|
21023
|
+
var CAP_TO_KIND = {
|
|
21024
|
+
contact: "contact",
|
|
21025
|
+
motion: "motion-sensor",
|
|
21026
|
+
smoke: "smoke",
|
|
21027
|
+
flood: "flood",
|
|
21028
|
+
gas: "gas",
|
|
21029
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
21030
|
+
vibration: "vibration",
|
|
21031
|
+
tamper: "tamper",
|
|
21032
|
+
presence: "presence",
|
|
21033
|
+
"enum-sensor": "enum-sensor",
|
|
21034
|
+
"event-emitter": "device-event",
|
|
21035
|
+
"lock-control": "lock",
|
|
21036
|
+
switch: "switch",
|
|
21037
|
+
button: "button",
|
|
21038
|
+
doorbell: "doorbell"
|
|
21039
|
+
};
|
|
21040
|
+
function buildDescriptor(capName, kind) {
|
|
21041
|
+
const t = EVENT_TAXONOMY[kind];
|
|
21042
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
21043
|
+
return {
|
|
21044
|
+
...t,
|
|
21045
|
+
icon: legacyIcon(t.iconId)
|
|
21046
|
+
};
|
|
21047
|
+
}
|
|
21048
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
21049
|
+
/**
|
|
20543
21050
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
20544
21051
|
* package lifecycle (runtime-updatable node packages).
|
|
20545
21052
|
*
|
|
@@ -22011,7 +22518,28 @@ var FaceInfoSchema = object({
|
|
|
22011
22518
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
22012
22519
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
22013
22520
|
* back to the inline `base64` face crop. */
|
|
22014
|
-
keyFrameMediaKey: string().optional()
|
|
22521
|
+
keyFrameMediaKey: string().optional(),
|
|
22522
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
22523
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
22524
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
22525
|
+
* faces that were never auto-recognized. */
|
|
22526
|
+
bestMatchScore: number().optional(),
|
|
22527
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
22528
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
22529
|
+
* legacy rows / runners that reported no native measure. */
|
|
22530
|
+
nativeFaceShortSidePx: number().optional(),
|
|
22531
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
22532
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
22533
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
22534
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
22535
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
22536
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
22537
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
22538
|
+
suggestedIdentityId: string().optional(),
|
|
22539
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
22540
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
22541
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
22542
|
+
suggestedMatchScore: number().optional()
|
|
22015
22543
|
});
|
|
22016
22544
|
var FaceFilterEnum = _enum([
|
|
22017
22545
|
"unassigned",
|
|
@@ -24054,36 +24582,6 @@ Object.freeze({
|
|
|
24054
24582
|
addonId: null,
|
|
24055
24583
|
access: "view"
|
|
24056
24584
|
},
|
|
24057
|
-
"advancedNotifier.deleteRule": {
|
|
24058
|
-
capName: "advanced-notifier",
|
|
24059
|
-
capScope: "system",
|
|
24060
|
-
addonId: null,
|
|
24061
|
-
access: "delete"
|
|
24062
|
-
},
|
|
24063
|
-
"advancedNotifier.getHistory": {
|
|
24064
|
-
capName: "advanced-notifier",
|
|
24065
|
-
capScope: "system",
|
|
24066
|
-
addonId: null,
|
|
24067
|
-
access: "view"
|
|
24068
|
-
},
|
|
24069
|
-
"advancedNotifier.getRules": {
|
|
24070
|
-
capName: "advanced-notifier",
|
|
24071
|
-
capScope: "system",
|
|
24072
|
-
addonId: null,
|
|
24073
|
-
access: "view"
|
|
24074
|
-
},
|
|
24075
|
-
"advancedNotifier.testRule": {
|
|
24076
|
-
capName: "advanced-notifier",
|
|
24077
|
-
capScope: "system",
|
|
24078
|
-
addonId: null,
|
|
24079
|
-
access: "create"
|
|
24080
|
-
},
|
|
24081
|
-
"advancedNotifier.upsertRule": {
|
|
24082
|
-
capName: "advanced-notifier",
|
|
24083
|
-
capScope: "system",
|
|
24084
|
-
addonId: null,
|
|
24085
|
-
access: "create"
|
|
24086
|
-
},
|
|
24087
24585
|
"alarmPanel.arm": {
|
|
24088
24586
|
capName: "alarm-panel",
|
|
24089
24587
|
capScope: "device",
|
|
@@ -26388,6 +26886,60 @@ Object.freeze({
|
|
|
26388
26886
|
addonId: null,
|
|
26389
26887
|
access: "create"
|
|
26390
26888
|
},
|
|
26889
|
+
"notificationRules.createRule": {
|
|
26890
|
+
capName: "notification-rules",
|
|
26891
|
+
capScope: "system",
|
|
26892
|
+
addonId: null,
|
|
26893
|
+
access: "create"
|
|
26894
|
+
},
|
|
26895
|
+
"notificationRules.deleteRule": {
|
|
26896
|
+
capName: "notification-rules",
|
|
26897
|
+
capScope: "system",
|
|
26898
|
+
addonId: null,
|
|
26899
|
+
access: "delete"
|
|
26900
|
+
},
|
|
26901
|
+
"notificationRules.getConditionCatalog": {
|
|
26902
|
+
capName: "notification-rules",
|
|
26903
|
+
capScope: "system",
|
|
26904
|
+
addonId: null,
|
|
26905
|
+
access: "view"
|
|
26906
|
+
},
|
|
26907
|
+
"notificationRules.getHistory": {
|
|
26908
|
+
capName: "notification-rules",
|
|
26909
|
+
capScope: "system",
|
|
26910
|
+
addonId: null,
|
|
26911
|
+
access: "view"
|
|
26912
|
+
},
|
|
26913
|
+
"notificationRules.getRule": {
|
|
26914
|
+
capName: "notification-rules",
|
|
26915
|
+
capScope: "system",
|
|
26916
|
+
addonId: null,
|
|
26917
|
+
access: "view"
|
|
26918
|
+
},
|
|
26919
|
+
"notificationRules.listRules": {
|
|
26920
|
+
capName: "notification-rules",
|
|
26921
|
+
capScope: "system",
|
|
26922
|
+
addonId: null,
|
|
26923
|
+
access: "view"
|
|
26924
|
+
},
|
|
26925
|
+
"notificationRules.setRuleEnabled": {
|
|
26926
|
+
capName: "notification-rules",
|
|
26927
|
+
capScope: "system",
|
|
26928
|
+
addonId: null,
|
|
26929
|
+
access: "create"
|
|
26930
|
+
},
|
|
26931
|
+
"notificationRules.testRule": {
|
|
26932
|
+
capName: "notification-rules",
|
|
26933
|
+
capScope: "system",
|
|
26934
|
+
addonId: null,
|
|
26935
|
+
access: "create"
|
|
26936
|
+
},
|
|
26937
|
+
"notificationRules.updateRule": {
|
|
26938
|
+
capName: "notification-rules",
|
|
26939
|
+
capScope: "system",
|
|
26940
|
+
addonId: null,
|
|
26941
|
+
access: "create"
|
|
26942
|
+
},
|
|
26391
26943
|
"notifier.cancel": {
|
|
26392
26944
|
capName: "notifier",
|
|
26393
26945
|
capScope: "device",
|