@camstack/addon-static-turn 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/static-turn.addon.js +1313 -761
- package/dist/static-turn.addon.mjs +1313 -761
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
//#region ../types/dist/event-category-
|
|
2
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
3
3
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4
4
|
EventCategory["SystemBoot"] = "system.boot";
|
|
5
5
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -149,9 +149,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
149
149
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
150
150
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
151
151
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
152
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
153
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
154
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
155
152
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
156
153
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
157
154
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -6816,7 +6813,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
|
6816
6813
|
patch: record(string(), unknown())
|
|
6817
6814
|
}), object({ success: literal(true) });
|
|
6818
6815
|
object({ deviceId: number() }), unknown().nullable();
|
|
6819
|
-
/** Shorthand to define a method schema */
|
|
6820
6816
|
function method(input, output, options) {
|
|
6821
6817
|
return {
|
|
6822
6818
|
input,
|
|
@@ -6824,6 +6820,7 @@ function method(input, output, options) {
|
|
|
6824
6820
|
kind: options?.kind ?? "query",
|
|
6825
6821
|
auth: options?.auth ?? "protected",
|
|
6826
6822
|
...options?.access !== void 0 ? { access: options.access } : {},
|
|
6823
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
6827
6824
|
timeoutMs: options?.timeoutMs
|
|
6828
6825
|
};
|
|
6829
6826
|
}
|
|
@@ -8177,6 +8174,59 @@ for (const l of AUDIO_MACRO_LABELS) {
|
|
|
8177
8174
|
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8178
8175
|
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8179
8176
|
/**
|
|
8177
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8178
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8179
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8180
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8181
|
+
*
|
|
8182
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8183
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8184
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8185
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8186
|
+
* the same class picker, grouped under an Audio header.
|
|
8187
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8188
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8189
|
+
*
|
|
8190
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8191
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8192
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8193
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8194
|
+
*/
|
|
8195
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8196
|
+
var NcTaxonomyEntrySchema = object({
|
|
8197
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8198
|
+
kind: string(),
|
|
8199
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8200
|
+
label: string(),
|
|
8201
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8202
|
+
parentKind: string().nullable()
|
|
8203
|
+
});
|
|
8204
|
+
object({
|
|
8205
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8206
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8207
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8208
|
+
});
|
|
8209
|
+
function toEntry(kind, label, parentKind) {
|
|
8210
|
+
return {
|
|
8211
|
+
kind,
|
|
8212
|
+
label,
|
|
8213
|
+
parentKind
|
|
8214
|
+
};
|
|
8215
|
+
}
|
|
8216
|
+
/**
|
|
8217
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8218
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8219
|
+
*/
|
|
8220
|
+
function buildNcTaxonomy() {
|
|
8221
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8222
|
+
return {
|
|
8223
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8224
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8225
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8226
|
+
};
|
|
8227
|
+
}
|
|
8228
|
+
Object.freeze(buildNcTaxonomy());
|
|
8229
|
+
/**
|
|
8180
8230
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8181
8231
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8182
8232
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -10885,6 +10935,22 @@ var CameraMetricsSchema = object({
|
|
|
10885
10935
|
])
|
|
10886
10936
|
});
|
|
10887
10937
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
10938
|
+
/**
|
|
10939
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
10940
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
10941
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
10942
|
+
*/
|
|
10943
|
+
var NativeCropRefSchema = object({
|
|
10944
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
10945
|
+
handle: FrameHandleSchema,
|
|
10946
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
10947
|
+
cropFrameSpace: object({
|
|
10948
|
+
x: number(),
|
|
10949
|
+
y: number(),
|
|
10950
|
+
w: number(),
|
|
10951
|
+
h: number()
|
|
10952
|
+
})
|
|
10953
|
+
});
|
|
10888
10954
|
var ModelFormatSchema$1 = _enum([
|
|
10889
10955
|
"onnx",
|
|
10890
10956
|
"coreml",
|
|
@@ -11160,7 +11226,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
11160
11226
|
* Omitted ⇒ the runner's default device (current single-engine
|
|
11161
11227
|
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
11162
11228
|
*/
|
|
11163
|
-
deviceKey: string().optional()
|
|
11229
|
+
deviceKey: string().optional(),
|
|
11230
|
+
/**
|
|
11231
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
11232
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
11233
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
11234
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
11235
|
+
* resolution from that surface — the SAME quality path faces already
|
|
11236
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
11237
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
11238
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
11239
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
11240
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
11241
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
11242
|
+
* (today's behaviour on the fallback path).
|
|
11243
|
+
*/
|
|
11244
|
+
nativeCropRef: NativeCropRefSchema.optional()
|
|
11164
11245
|
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
11165
11246
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
11166
11247
|
steps: array(PipelineStepInputSchema).min(1),
|
|
@@ -11376,7 +11457,11 @@ var DetailResultSchema = object({
|
|
|
11376
11457
|
bbox: NativeCropBboxSchema.optional(),
|
|
11377
11458
|
embedding: string().optional(),
|
|
11378
11459
|
label: string().optional(),
|
|
11379
|
-
alignedCropJpeg: string().optional()
|
|
11460
|
+
alignedCropJpeg: string().optional(),
|
|
11461
|
+
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
11462
|
+
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
11463
|
+
* consumers MUST prefer this when present (2026-07-22 native-gate fix). */
|
|
11464
|
+
nativeFaceShortSidePx: number().optional()
|
|
11380
11465
|
});
|
|
11381
11466
|
/**
|
|
11382
11467
|
* Per-camera tunable ranges + defaults. Single source of truth used
|
|
@@ -11390,6 +11475,12 @@ var motionCooldownMsField = {
|
|
|
11390
11475
|
default: 3e4,
|
|
11391
11476
|
step: 500
|
|
11392
11477
|
};
|
|
11478
|
+
var maxSessionHoldMsField = {
|
|
11479
|
+
min: 0,
|
|
11480
|
+
max: 6e5,
|
|
11481
|
+
default: 12e4,
|
|
11482
|
+
step: 5e3
|
|
11483
|
+
};
|
|
11393
11484
|
var motionFpsField = {
|
|
11394
11485
|
min: 1,
|
|
11395
11486
|
max: 30,
|
|
@@ -11537,6 +11628,19 @@ var RunnerCameraConfigSchema = object({
|
|
|
11537
11628
|
"on-motion"
|
|
11538
11629
|
]).default("always-on"),
|
|
11539
11630
|
motionCooldownMs: number().min(motionCooldownMsField.min).default(motionCooldownMsField.default),
|
|
11631
|
+
/**
|
|
11632
|
+
* Orchestrator-side on-motion session-hold cap (ms). While an on-motion
|
|
11633
|
+
* detection session is active and ≥1 confirmed non-stationary track is
|
|
11634
|
+
* still live, the orchestrator keeps the session open past
|
|
11635
|
+
* `motionCooldownMs` (a slowly-moving subject can stop re-triggering the
|
|
11636
|
+
* camera's VMD yet is still being tracked frame-to-frame) — up to this many
|
|
11637
|
+
* ms since the session opened, after which it closes regardless. `0`
|
|
11638
|
+
* disables the hold (legacy cooldown-only teardown). Not consumed by the
|
|
11639
|
+
* runner itself — carried here so it shares the per-camera device-settings
|
|
11640
|
+
* surface with `motionCooldownMs`; the orchestrator reads it off the
|
|
11641
|
+
* resolved `CameraDetectionConfig`.
|
|
11642
|
+
*/
|
|
11643
|
+
maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
|
|
11540
11644
|
motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
|
|
11541
11645
|
detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
|
|
11542
11646
|
motionStreamId: string(),
|
|
@@ -11626,7 +11730,7 @@ var RunnerCameraConfigSchema = object({
|
|
|
11626
11730
|
*/
|
|
11627
11731
|
inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
|
|
11628
11732
|
});
|
|
11629
|
-
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;
|
|
11733
|
+
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;
|
|
11630
11734
|
/**
|
|
11631
11735
|
* Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
|
|
11632
11736
|
* load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
|
|
@@ -13480,94 +13584,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
13480
13584
|
bundleUrl: string()
|
|
13481
13585
|
});
|
|
13482
13586
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
13483
|
-
var NotificationRuleConditionsSchema = object({
|
|
13484
|
-
deviceIds: array(number()).readonly().optional(),
|
|
13485
|
-
classNames: array(string()).readonly().optional(),
|
|
13486
|
-
zoneIds: array(string()).readonly().optional(),
|
|
13487
|
-
minConfidence: number().optional(),
|
|
13488
|
-
source: _enum([
|
|
13489
|
-
"pipeline",
|
|
13490
|
-
"onboard",
|
|
13491
|
-
"any"
|
|
13492
|
-
]).optional(),
|
|
13493
|
-
schedule: object({
|
|
13494
|
-
days: array(number()).readonly(),
|
|
13495
|
-
startHour: number(),
|
|
13496
|
-
endHour: number()
|
|
13497
|
-
}).optional(),
|
|
13498
|
-
cooldownSeconds: number().optional(),
|
|
13499
|
-
minDwellSeconds: number().optional(),
|
|
13500
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
13501
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
13502
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
13503
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
13504
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
13505
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
13506
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
13507
|
-
clipDescription: object({
|
|
13508
|
-
text: string().min(1),
|
|
13509
|
-
minSimilarity: number().min(0).max(1)
|
|
13510
|
-
}).optional(),
|
|
13511
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
13512
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
13513
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
13514
|
-
* vehicle/person> is seen". */
|
|
13515
|
-
labels: array(string()).readonly().optional()
|
|
13516
|
-
});
|
|
13517
|
-
var NotificationRuleTemplateSchema = object({
|
|
13518
|
-
title: string(),
|
|
13519
|
-
body: string(),
|
|
13520
|
-
imageMode: _enum([
|
|
13521
|
-
"crop",
|
|
13522
|
-
"annotated",
|
|
13523
|
-
"full",
|
|
13524
|
-
"none"
|
|
13525
|
-
])
|
|
13526
|
-
});
|
|
13527
|
-
var NotificationRuleSchema = object({
|
|
13528
|
-
id: string(),
|
|
13529
|
-
name: string(),
|
|
13530
|
-
enabled: boolean(),
|
|
13531
|
-
eventTypes: array(string()).readonly(),
|
|
13532
|
-
conditions: NotificationRuleConditionsSchema,
|
|
13533
|
-
outputs: array(string()).readonly(),
|
|
13534
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
13535
|
-
priority: _enum([
|
|
13536
|
-
"low",
|
|
13537
|
-
"normal",
|
|
13538
|
-
"high",
|
|
13539
|
-
"critical"
|
|
13540
|
-
])
|
|
13541
|
-
});
|
|
13542
|
-
var NotificationTestResultSchema = object({
|
|
13543
|
-
ruleId: string(),
|
|
13544
|
-
eventId: string(),
|
|
13545
|
-
timestamp: number(),
|
|
13546
|
-
wouldFire: boolean(),
|
|
13547
|
-
reason: string().optional()
|
|
13548
|
-
});
|
|
13549
|
-
var NotificationHistoryEntrySchema = object({
|
|
13550
|
-
id: string(),
|
|
13551
|
-
ruleId: string(),
|
|
13552
|
-
ruleName: string(),
|
|
13553
|
-
eventId: string(),
|
|
13554
|
-
timestamp: number(),
|
|
13555
|
-
outputs: array(string()).readonly(),
|
|
13556
|
-
success: boolean(),
|
|
13557
|
-
error: string().optional(),
|
|
13558
|
-
deviceId: number().optional()
|
|
13559
|
-
});
|
|
13560
|
-
var NotificationHistoryFilterSchema = object({
|
|
13561
|
-
ruleId: string().optional(),
|
|
13562
|
-
deviceId: number().optional(),
|
|
13563
|
-
from: number().optional(),
|
|
13564
|
-
to: number().optional(),
|
|
13565
|
-
limit: number().optional()
|
|
13566
|
-
});
|
|
13567
|
-
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({
|
|
13568
|
-
ruleId: string(),
|
|
13569
|
-
lookbackMinutes: number()
|
|
13570
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
13571
13587
|
/**
|
|
13572
13588
|
* Alerts capability — collection-based internal alert system.
|
|
13573
13589
|
*
|
|
@@ -13754,89 +13770,6 @@ method(object({
|
|
|
13754
13770
|
password: string()
|
|
13755
13771
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
13756
13772
|
/**
|
|
13757
|
-
* `login-method` — collection cap through which auth addons contribute
|
|
13758
|
-
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
13759
|
-
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
13760
|
-
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
13761
|
-
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
13762
|
-
* procedure aggregates them for the unauthenticated login page.
|
|
13763
|
-
*
|
|
13764
|
-
* A contribution is a discriminated union on `kind`:
|
|
13765
|
-
*
|
|
13766
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
13767
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
13768
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
13769
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
13770
|
-
* login page needs NO change.
|
|
13771
|
-
*
|
|
13772
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
13773
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
13774
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
13775
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
13776
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
13777
|
-
*
|
|
13778
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
13779
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
13780
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
13781
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
13782
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
13783
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
13784
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
13785
|
-
* decision.
|
|
13786
|
-
*
|
|
13787
|
-
* Every contribution carries a `stage`:
|
|
13788
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
13789
|
-
* magic-link buttons; a future usernameless passkey).
|
|
13790
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
13791
|
-
* returned `factors` (passkey-as-2FA today).
|
|
13792
|
-
*
|
|
13793
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
13794
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
13795
|
-
* tRPC router.
|
|
13796
|
-
*/
|
|
13797
|
-
/** When a login method renders in the two-phase login flow. */
|
|
13798
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
13799
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
13800
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
13801
|
-
object({
|
|
13802
|
-
kind: literal("redirect"),
|
|
13803
|
-
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
13804
|
-
id: string(),
|
|
13805
|
-
/** Operator-facing button label. */
|
|
13806
|
-
label: string(),
|
|
13807
|
-
/** lucide-react icon name. */
|
|
13808
|
-
icon: string().optional(),
|
|
13809
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
13810
|
-
startUrl: string(),
|
|
13811
|
-
stage: LoginStageEnum
|
|
13812
|
-
}),
|
|
13813
|
-
object({
|
|
13814
|
-
kind: literal("widget"),
|
|
13815
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
13816
|
-
id: string(),
|
|
13817
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
13818
|
-
addonId: string(),
|
|
13819
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
13820
|
-
bundle: string(),
|
|
13821
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
13822
|
-
remote: WidgetRemoteSchema,
|
|
13823
|
-
stage: LoginStageEnum
|
|
13824
|
-
}),
|
|
13825
|
-
object({
|
|
13826
|
-
kind: literal("passkey"),
|
|
13827
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
13828
|
-
id: string(),
|
|
13829
|
-
/** Operator-facing button label. */
|
|
13830
|
-
label: string(),
|
|
13831
|
-
stage: LoginStageEnum,
|
|
13832
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
13833
|
-
rpId: string(),
|
|
13834
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
13835
|
-
origin: string().nullable()
|
|
13836
|
-
})
|
|
13837
|
-
]);
|
|
13838
|
-
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
13839
|
-
/**
|
|
13840
13773
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
13841
13774
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
13842
13775
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -15180,236 +15113,611 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
15180
15113
|
kind: "mutation",
|
|
15181
15114
|
auth: "admin"
|
|
15182
15115
|
});
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15116
|
+
/**
|
|
15117
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15118
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15119
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
15120
|
+
*
|
|
15121
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15122
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
15123
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15124
|
+
*/
|
|
15125
|
+
var LlmUsageSchema = object({
|
|
15126
|
+
inputTokens: number(),
|
|
15127
|
+
outputTokens: number()
|
|
15128
|
+
});
|
|
15129
|
+
var LlmErrorCodeSchema = _enum([
|
|
15130
|
+
"timeout",
|
|
15131
|
+
"rate-limited",
|
|
15132
|
+
"auth",
|
|
15133
|
+
"refusal",
|
|
15134
|
+
"bad-request",
|
|
15135
|
+
"unavailable",
|
|
15136
|
+
"no-profile",
|
|
15137
|
+
"budget-exceeded",
|
|
15138
|
+
"adapter-error"
|
|
15188
15139
|
]);
|
|
15189
|
-
var
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15140
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15141
|
+
ok: literal(true),
|
|
15142
|
+
text: string(),
|
|
15143
|
+
model: string(),
|
|
15144
|
+
usage: LlmUsageSchema,
|
|
15145
|
+
truncated: boolean(),
|
|
15146
|
+
latencyMs: number()
|
|
15147
|
+
}), object({
|
|
15148
|
+
ok: literal(false),
|
|
15149
|
+
code: LlmErrorCodeSchema,
|
|
15193
15150
|
message: string(),
|
|
15194
|
-
|
|
15195
|
-
|
|
15151
|
+
retryAfterMs: number().optional()
|
|
15152
|
+
})]);
|
|
15153
|
+
/**
|
|
15154
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15155
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15156
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
15157
|
+
*/
|
|
15158
|
+
var LlmImageSchema = object({
|
|
15159
|
+
bytes: _instanceof(Uint8Array),
|
|
15160
|
+
mimeType: string()
|
|
15196
15161
|
});
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
|
|
15200
|
-
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
-
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
|
|
15212
|
-
number(),
|
|
15213
|
-
number(),
|
|
15214
|
-
number()
|
|
15215
|
-
]),
|
|
15216
|
-
cores: number()
|
|
15162
|
+
var LlmGenerateBaseInputSchema = object({
|
|
15163
|
+
/** Collection routing (the notification-output posture). */
|
|
15164
|
+
addonId: string().optional(),
|
|
15165
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15166
|
+
profileId: string().optional(),
|
|
15167
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15168
|
+
consumer: string(),
|
|
15169
|
+
system: string().optional(),
|
|
15170
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15171
|
+
prompt: string(),
|
|
15172
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15173
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
15174
|
+
/** Per-call override of the profile default. */
|
|
15175
|
+
maxTokens: number().int().positive().optional(),
|
|
15176
|
+
temperature: number().optional()
|
|
15217
15177
|
});
|
|
15218
|
-
|
|
15219
|
-
|
|
15220
|
-
|
|
15221
|
-
|
|
15222
|
-
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
|
|
15227
|
-
|
|
15228
|
-
|
|
15229
|
-
|
|
15230
|
-
|
|
15231
|
-
|
|
15232
|
-
|
|
15233
|
-
var NetworkIoSnapshotSchema = object({
|
|
15234
|
-
rxBytes: number(),
|
|
15235
|
-
txBytes: number(),
|
|
15236
|
-
rxPackets: number(),
|
|
15237
|
-
txPackets: number(),
|
|
15238
|
-
rxErrors: number(),
|
|
15239
|
-
txErrors: number(),
|
|
15240
|
-
timestampMs: number()
|
|
15241
|
-
});
|
|
15242
|
-
var MetricsGpuInfoSchema = object({
|
|
15243
|
-
utilization: number(),
|
|
15244
|
-
model: string(),
|
|
15245
|
-
memoryUsedBytes: number(),
|
|
15246
|
-
memoryTotalBytes: number(),
|
|
15247
|
-
temperature: number().nullable()
|
|
15248
|
-
});
|
|
15249
|
-
var ProcessResourceInfoSchema = object({
|
|
15250
|
-
openFds: number(),
|
|
15251
|
-
threadCount: number(),
|
|
15252
|
-
activeHandles: number(),
|
|
15253
|
-
activeRequests: number()
|
|
15254
|
-
});
|
|
15255
|
-
var PressureAvgsSchema = object({
|
|
15256
|
-
avg10: number(),
|
|
15257
|
-
avg60: number(),
|
|
15258
|
-
avg300: number()
|
|
15259
|
-
});
|
|
15260
|
-
var PressureInfoSchema = object({
|
|
15261
|
-
some: PressureAvgsSchema,
|
|
15262
|
-
full: PressureAvgsSchema.nullable()
|
|
15263
|
-
});
|
|
15264
|
-
var SystemResourceSnapshotSchema = object({
|
|
15265
|
-
cpu: CpuBreakdownSchema,
|
|
15266
|
-
memory: MemoryInfoSchema,
|
|
15267
|
-
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15268
|
-
network: NetworkIoSnapshotSchema,
|
|
15269
|
-
disk: DiskIoSnapshotSchema,
|
|
15270
|
-
pressure: object({
|
|
15271
|
-
cpu: PressureInfoSchema.nullable(),
|
|
15272
|
-
memory: PressureInfoSchema.nullable(),
|
|
15273
|
-
io: PressureInfoSchema.nullable()
|
|
15178
|
+
/**
|
|
15179
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15180
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15181
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15182
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15183
|
+
* this only through the `llm` cap's methods.
|
|
15184
|
+
*
|
|
15185
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15186
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15187
|
+
* watchdog — operator decision #3).
|
|
15188
|
+
*/
|
|
15189
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15190
|
+
object({
|
|
15191
|
+
kind: literal("catalog"),
|
|
15192
|
+
catalogId: string()
|
|
15274
15193
|
}),
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
|
|
15295
|
-
|
|
15296
|
-
*/
|
|
15297
|
-
|
|
15298
|
-
/**
|
|
15299
|
-
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
sharedBytes: number().optional()
|
|
15194
|
+
object({
|
|
15195
|
+
kind: literal("url"),
|
|
15196
|
+
url: string(),
|
|
15197
|
+
sha256: string().optional()
|
|
15198
|
+
}),
|
|
15199
|
+
object({
|
|
15200
|
+
kind: literal("path"),
|
|
15201
|
+
path: string()
|
|
15202
|
+
})
|
|
15203
|
+
]);
|
|
15204
|
+
var ManagedRuntimeConfigSchema = object({
|
|
15205
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
15206
|
+
nodeId: string(),
|
|
15207
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15208
|
+
engine: _enum(["llama-cpp"]),
|
|
15209
|
+
model: ManagedModelRefSchema,
|
|
15210
|
+
contextSize: number().int().default(4096),
|
|
15211
|
+
/** 0 = CPU-only. */
|
|
15212
|
+
gpuLayers: number().int().default(0),
|
|
15213
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15214
|
+
threads: number().int().optional(),
|
|
15215
|
+
/** Concurrent slots. */
|
|
15216
|
+
parallel: number().int().default(1),
|
|
15217
|
+
/** Else lazy: first generate boots it. */
|
|
15218
|
+
autoStart: boolean().default(false),
|
|
15219
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
15220
|
+
idleStopMinutes: number().int().default(30)
|
|
15303
15221
|
});
|
|
15304
|
-
var
|
|
15305
|
-
|
|
15222
|
+
var LlmRuntimeStatusSchema = object({
|
|
15223
|
+
/** Status is ALWAYS node-qualified. */
|
|
15306
15224
|
nodeId: string(),
|
|
15307
|
-
role: _enum(["hub", "worker"]),
|
|
15308
|
-
pid: number(),
|
|
15309
15225
|
state: _enum([
|
|
15310
|
-
"starting",
|
|
15311
|
-
"running",
|
|
15312
|
-
"stopping",
|
|
15313
15226
|
"stopped",
|
|
15314
|
-
"
|
|
15315
|
-
|
|
15316
|
-
|
|
15317
|
-
|
|
15318
|
-
|
|
15319
|
-
pid: number(),
|
|
15320
|
-
ppid: number(),
|
|
15321
|
-
pgid: number(),
|
|
15322
|
-
classification: _enum([
|
|
15323
|
-
"root",
|
|
15324
|
-
"managed",
|
|
15325
|
-
"system",
|
|
15326
|
-
"ghost"
|
|
15227
|
+
"downloading",
|
|
15228
|
+
"starting",
|
|
15229
|
+
"ready",
|
|
15230
|
+
"crashed",
|
|
15231
|
+
"failed"
|
|
15327
15232
|
]),
|
|
15328
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
15329
|
-
addonId: string().nullable(),
|
|
15330
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15331
|
-
nodeId: string().nullable(),
|
|
15332
|
-
/** Truncated command line. */
|
|
15333
|
-
command: string(),
|
|
15334
|
-
cpuPercent: number(),
|
|
15335
|
-
memoryRssBytes: number(),
|
|
15336
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15337
|
-
uptimeSec: number(),
|
|
15338
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15339
|
-
orphaned: boolean()
|
|
15340
|
-
});
|
|
15341
|
-
var KillProcessInputSchema = object({
|
|
15342
|
-
pid: number(),
|
|
15343
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15344
|
-
force: boolean().optional()
|
|
15345
|
-
});
|
|
15346
|
-
var KillProcessResultSchema = object({
|
|
15347
|
-
success: boolean(),
|
|
15348
|
-
reason: string().optional(),
|
|
15349
|
-
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15350
|
-
});
|
|
15351
|
-
var DumpHeapSnapshotInputSchema = object({
|
|
15352
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
15353
|
-
addonId: string() });
|
|
15354
|
-
var DumpHeapSnapshotResultSchema = object({
|
|
15355
|
-
success: boolean(),
|
|
15356
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15357
|
-
path: string().optional(),
|
|
15358
|
-
/** Process pid that was signalled. */
|
|
15359
15233
|
pid: number().optional(),
|
|
15360
|
-
|
|
15234
|
+
port: number().optional(),
|
|
15235
|
+
modelPath: string().optional(),
|
|
15236
|
+
modelId: string().optional(),
|
|
15237
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
15238
|
+
lastError: string().optional(),
|
|
15239
|
+
crashesInWindow: number(),
|
|
15240
|
+
/** Child RSS (sampled best-effort). */
|
|
15241
|
+
memoryBytes: number().optional(),
|
|
15242
|
+
vramBytes: number().optional()
|
|
15361
15243
|
});
|
|
15362
|
-
var
|
|
15363
|
-
|
|
15364
|
-
|
|
15365
|
-
|
|
15366
|
-
|
|
15367
|
-
diskPercent: number().optional(),
|
|
15368
|
-
temperature: number().optional(),
|
|
15369
|
-
gpuPercent: number().optional(),
|
|
15370
|
-
gpuMemoryPercent: number().optional()
|
|
15244
|
+
var LlmNodeModelSchema = object({
|
|
15245
|
+
file: string(),
|
|
15246
|
+
sizeBytes: number(),
|
|
15247
|
+
catalogId: string().optional(),
|
|
15248
|
+
installedAt: number().optional()
|
|
15371
15249
|
});
|
|
15372
|
-
|
|
15250
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
15251
|
+
nodeId: string(),
|
|
15252
|
+
modelsBytes: number(),
|
|
15253
|
+
freeBytes: number().optional()
|
|
15254
|
+
});
|
|
15255
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
15256
|
+
images: array(LlmImageSchema).optional(),
|
|
15257
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
15258
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15259
|
+
timeoutMs: number().int().positive().optional()
|
|
15260
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15373
15261
|
kind: "mutation",
|
|
15374
15262
|
auth: "admin"
|
|
15375
|
-
}), method(
|
|
15263
|
+
}), method(object({}), _void(), {
|
|
15376
15264
|
kind: "mutation",
|
|
15377
15265
|
auth: "admin"
|
|
15378
|
-
})
|
|
15379
|
-
method(object({
|
|
15380
|
-
sourceUrl: string(),
|
|
15381
|
-
metadata: ModelConvertMetadataSchema,
|
|
15382
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15383
|
-
calibrationRef: string().optional(),
|
|
15384
|
-
sessionId: string().optional()
|
|
15385
|
-
}), ConvertResultSchema, {
|
|
15266
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15386
15267
|
kind: "mutation",
|
|
15387
|
-
auth: "admin"
|
|
15388
|
-
|
|
15389
|
-
});
|
|
15390
|
-
method(object({
|
|
15391
|
-
nodeId: string(),
|
|
15392
|
-
modelId: string(),
|
|
15393
|
-
format: _enum(MODEL_FORMATS),
|
|
15394
|
-
entry: ModelCatalogEntrySchema
|
|
15395
|
-
}), object({
|
|
15396
|
-
ok: boolean(),
|
|
15397
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15398
|
-
sha256: string(),
|
|
15399
|
-
bytes: number(),
|
|
15400
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15401
|
-
path: string()
|
|
15402
|
-
}), {
|
|
15268
|
+
auth: "admin"
|
|
15269
|
+
}), method(object({ file: string() }), _void(), {
|
|
15403
15270
|
kind: "mutation",
|
|
15404
15271
|
auth: "admin"
|
|
15405
|
-
});
|
|
15272
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15406
15273
|
/**
|
|
15407
|
-
* `
|
|
15408
|
-
*
|
|
15409
|
-
*
|
|
15410
|
-
*
|
|
15411
|
-
*
|
|
15412
|
-
*
|
|
15274
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
15275
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
15276
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
15277
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15278
|
+
* (hub-placed); the cap stays open for future providers.
|
|
15279
|
+
*
|
|
15280
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15281
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15282
|
+
* write; a stored key NEVER round-trips to a client.
|
|
15283
|
+
*/
|
|
15284
|
+
var LlmProfileKindSchema = _enum([
|
|
15285
|
+
"openai-compatible",
|
|
15286
|
+
"openai",
|
|
15287
|
+
"anthropic",
|
|
15288
|
+
"google",
|
|
15289
|
+
"managed-local"
|
|
15290
|
+
]);
|
|
15291
|
+
var LlmProfileSchema = object({
|
|
15292
|
+
id: string(),
|
|
15293
|
+
name: string(),
|
|
15294
|
+
kind: LlmProfileKindSchema,
|
|
15295
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
15296
|
+
addonId: string(),
|
|
15297
|
+
enabled: boolean(),
|
|
15298
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
15299
|
+
model: string(),
|
|
15300
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
15301
|
+
baseUrl: string().optional(),
|
|
15302
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
15303
|
+
apiKey: string().optional(),
|
|
15304
|
+
supportsVision: boolean(),
|
|
15305
|
+
temperature: number().min(0).max(2).optional(),
|
|
15306
|
+
maxTokens: number().int().positive().optional(),
|
|
15307
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
15308
|
+
extraHeaders: record(string(), string()).optional(),
|
|
15309
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
15310
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15311
|
+
});
|
|
15312
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
15313
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
15314
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
15315
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
15316
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
15317
|
+
kind: LlmProfileKindSchema,
|
|
15318
|
+
label: string(),
|
|
15319
|
+
icon: string(),
|
|
15320
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15321
|
+
addonId: string(),
|
|
15322
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
15323
|
+
});
|
|
15324
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
15325
|
+
var LlmDefaultSchema = object({
|
|
15326
|
+
selector: LlmDefaultSelectorSchema,
|
|
15327
|
+
profileId: string()
|
|
15328
|
+
});
|
|
15329
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
15330
|
+
var LlmUsageRollupSchema = object({
|
|
15331
|
+
day: string(),
|
|
15332
|
+
consumer: string(),
|
|
15333
|
+
profileId: string(),
|
|
15334
|
+
calls: number(),
|
|
15335
|
+
okCalls: number(),
|
|
15336
|
+
errorCalls: number(),
|
|
15337
|
+
inputTokens: number(),
|
|
15338
|
+
outputTokens: number(),
|
|
15339
|
+
avgLatencyMs: number()
|
|
15340
|
+
});
|
|
15341
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
15342
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
15343
|
+
id: string(),
|
|
15344
|
+
label: string(),
|
|
15345
|
+
family: string(),
|
|
15346
|
+
purpose: _enum(["text", "vision"]),
|
|
15347
|
+
url: string(),
|
|
15348
|
+
sha256: string(),
|
|
15349
|
+
sizeBytes: number(),
|
|
15350
|
+
quantization: string(),
|
|
15351
|
+
/** Load-time guidance shown in the picker. */
|
|
15352
|
+
minRamBytes: number(),
|
|
15353
|
+
contextSizeDefault: number().int(),
|
|
15354
|
+
/** Vision models: companion projector file. */
|
|
15355
|
+
mmprojUrl: string().optional()
|
|
15356
|
+
});
|
|
15357
|
+
var LlmRuntimeNodeSchema = object({
|
|
15358
|
+
nodeId: string(),
|
|
15359
|
+
reachable: boolean(),
|
|
15360
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
15361
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15362
|
+
error: string().optional()
|
|
15363
|
+
});
|
|
15364
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
15365
|
+
var ProfileRefInputSchema = object({
|
|
15366
|
+
addonId: string(),
|
|
15367
|
+
profileId: string()
|
|
15368
|
+
});
|
|
15369
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
15370
|
+
kind: "mutation",
|
|
15371
|
+
auth: "admin"
|
|
15372
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
15373
|
+
kind: "mutation",
|
|
15374
|
+
auth: "admin"
|
|
15375
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
15376
|
+
kind: "mutation",
|
|
15377
|
+
auth: "admin"
|
|
15378
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
15379
|
+
selector: LlmDefaultSelectorSchema,
|
|
15380
|
+
profileId: string().nullable()
|
|
15381
|
+
}), _void(), {
|
|
15382
|
+
kind: "mutation",
|
|
15383
|
+
auth: "admin"
|
|
15384
|
+
}), method(object({
|
|
15385
|
+
since: number().optional(),
|
|
15386
|
+
until: number().optional(),
|
|
15387
|
+
consumer: string().optional(),
|
|
15388
|
+
profileId: string().optional()
|
|
15389
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
15390
|
+
nodeId: string(),
|
|
15391
|
+
model: ManagedModelRefSchema
|
|
15392
|
+
}), _void(), {
|
|
15393
|
+
kind: "mutation",
|
|
15394
|
+
auth: "admin"
|
|
15395
|
+
}), method(object({
|
|
15396
|
+
nodeId: string(),
|
|
15397
|
+
file: string()
|
|
15398
|
+
}), _void(), {
|
|
15399
|
+
kind: "mutation",
|
|
15400
|
+
auth: "admin"
|
|
15401
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
15402
|
+
kind: "mutation",
|
|
15403
|
+
auth: "admin"
|
|
15404
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
15405
|
+
kind: "mutation",
|
|
15406
|
+
auth: "admin"
|
|
15407
|
+
});
|
|
15408
|
+
var LogLevelSchema = _enum([
|
|
15409
|
+
"debug",
|
|
15410
|
+
"info",
|
|
15411
|
+
"warn",
|
|
15412
|
+
"error"
|
|
15413
|
+
]);
|
|
15414
|
+
var LogEntrySchema = object({
|
|
15415
|
+
timestamp: date(),
|
|
15416
|
+
level: LogLevelSchema,
|
|
15417
|
+
scope: array(string()),
|
|
15418
|
+
message: string(),
|
|
15419
|
+
meta: record(string(), unknown()).optional(),
|
|
15420
|
+
tags: record(string(), string()).optional()
|
|
15421
|
+
});
|
|
15422
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
15423
|
+
scope: array(string()).optional(),
|
|
15424
|
+
level: LogLevelSchema.optional(),
|
|
15425
|
+
since: date().optional(),
|
|
15426
|
+
until: date().optional(),
|
|
15427
|
+
limit: number().optional(),
|
|
15428
|
+
tags: record(string(), string()).optional()
|
|
15429
|
+
}), array(LogEntrySchema).readonly());
|
|
15430
|
+
/**
|
|
15431
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
15432
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
15433
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
15434
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
15435
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
15436
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
15437
|
+
*
|
|
15438
|
+
* A contribution is a discriminated union on `kind`:
|
|
15439
|
+
*
|
|
15440
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
15441
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
15442
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
15443
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
15444
|
+
* login page needs NO change.
|
|
15445
|
+
*
|
|
15446
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
15447
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
15448
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
15449
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
15450
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
15451
|
+
*
|
|
15452
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
15453
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
15454
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
15455
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
15456
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
15457
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
15458
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
15459
|
+
* decision.
|
|
15460
|
+
*
|
|
15461
|
+
* Every contribution carries a `stage`:
|
|
15462
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
15463
|
+
* magic-link buttons; a future usernameless passkey).
|
|
15464
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
15465
|
+
* returned `factors` (passkey-as-2FA today).
|
|
15466
|
+
*
|
|
15467
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
15468
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
15469
|
+
* tRPC router.
|
|
15470
|
+
*/
|
|
15471
|
+
/** When a login method renders in the two-phase login flow. */
|
|
15472
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
15473
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
15474
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
15475
|
+
object({
|
|
15476
|
+
kind: literal("redirect"),
|
|
15477
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
15478
|
+
id: string(),
|
|
15479
|
+
/** Operator-facing button label. */
|
|
15480
|
+
label: string(),
|
|
15481
|
+
/** lucide-react icon name. */
|
|
15482
|
+
icon: string().optional(),
|
|
15483
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
15484
|
+
startUrl: string(),
|
|
15485
|
+
stage: LoginStageEnum
|
|
15486
|
+
}),
|
|
15487
|
+
object({
|
|
15488
|
+
kind: literal("widget"),
|
|
15489
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
15490
|
+
id: string(),
|
|
15491
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
15492
|
+
addonId: string(),
|
|
15493
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
15494
|
+
bundle: string(),
|
|
15495
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
15496
|
+
remote: WidgetRemoteSchema,
|
|
15497
|
+
stage: LoginStageEnum
|
|
15498
|
+
}),
|
|
15499
|
+
object({
|
|
15500
|
+
kind: literal("passkey"),
|
|
15501
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
15502
|
+
id: string(),
|
|
15503
|
+
/** Operator-facing button label. */
|
|
15504
|
+
label: string(),
|
|
15505
|
+
stage: LoginStageEnum,
|
|
15506
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
15507
|
+
rpId: string(),
|
|
15508
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
15509
|
+
origin: string().nullable()
|
|
15510
|
+
})
|
|
15511
|
+
]);
|
|
15512
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
15513
|
+
var CpuBreakdownSchema = object({
|
|
15514
|
+
total: number(),
|
|
15515
|
+
user: number(),
|
|
15516
|
+
system: number(),
|
|
15517
|
+
irq: number(),
|
|
15518
|
+
nice: number(),
|
|
15519
|
+
loadAvg: tuple([
|
|
15520
|
+
number(),
|
|
15521
|
+
number(),
|
|
15522
|
+
number()
|
|
15523
|
+
]),
|
|
15524
|
+
cores: number()
|
|
15525
|
+
});
|
|
15526
|
+
var MemoryInfoSchema = object({
|
|
15527
|
+
percent: number(),
|
|
15528
|
+
totalBytes: number(),
|
|
15529
|
+
usedBytes: number(),
|
|
15530
|
+
availableBytes: number(),
|
|
15531
|
+
swapUsedBytes: number(),
|
|
15532
|
+
swapTotalBytes: number()
|
|
15533
|
+
});
|
|
15534
|
+
var DiskIoSnapshotSchema = object({
|
|
15535
|
+
readBytes: number(),
|
|
15536
|
+
writeBytes: number(),
|
|
15537
|
+
readOps: number(),
|
|
15538
|
+
writeOps: number(),
|
|
15539
|
+
timestampMs: number()
|
|
15540
|
+
});
|
|
15541
|
+
var NetworkIoSnapshotSchema = object({
|
|
15542
|
+
rxBytes: number(),
|
|
15543
|
+
txBytes: number(),
|
|
15544
|
+
rxPackets: number(),
|
|
15545
|
+
txPackets: number(),
|
|
15546
|
+
rxErrors: number(),
|
|
15547
|
+
txErrors: number(),
|
|
15548
|
+
timestampMs: number()
|
|
15549
|
+
});
|
|
15550
|
+
var MetricsGpuInfoSchema = object({
|
|
15551
|
+
utilization: number(),
|
|
15552
|
+
model: string(),
|
|
15553
|
+
memoryUsedBytes: number(),
|
|
15554
|
+
memoryTotalBytes: number(),
|
|
15555
|
+
temperature: number().nullable()
|
|
15556
|
+
});
|
|
15557
|
+
var ProcessResourceInfoSchema = object({
|
|
15558
|
+
openFds: number(),
|
|
15559
|
+
threadCount: number(),
|
|
15560
|
+
activeHandles: number(),
|
|
15561
|
+
activeRequests: number()
|
|
15562
|
+
});
|
|
15563
|
+
var PressureAvgsSchema = object({
|
|
15564
|
+
avg10: number(),
|
|
15565
|
+
avg60: number(),
|
|
15566
|
+
avg300: number()
|
|
15567
|
+
});
|
|
15568
|
+
var PressureInfoSchema = object({
|
|
15569
|
+
some: PressureAvgsSchema,
|
|
15570
|
+
full: PressureAvgsSchema.nullable()
|
|
15571
|
+
});
|
|
15572
|
+
var SystemResourceSnapshotSchema = object({
|
|
15573
|
+
cpu: CpuBreakdownSchema,
|
|
15574
|
+
memory: MemoryInfoSchema,
|
|
15575
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15576
|
+
network: NetworkIoSnapshotSchema,
|
|
15577
|
+
disk: DiskIoSnapshotSchema,
|
|
15578
|
+
pressure: object({
|
|
15579
|
+
cpu: PressureInfoSchema.nullable(),
|
|
15580
|
+
memory: PressureInfoSchema.nullable(),
|
|
15581
|
+
io: PressureInfoSchema.nullable()
|
|
15582
|
+
}),
|
|
15583
|
+
process: ProcessResourceInfoSchema,
|
|
15584
|
+
cpuTemperature: number().nullable(),
|
|
15585
|
+
timestampMs: number()
|
|
15586
|
+
});
|
|
15587
|
+
var DiskSpaceInfoSchema = object({
|
|
15588
|
+
path: string(),
|
|
15589
|
+
totalBytes: number(),
|
|
15590
|
+
usedBytes: number(),
|
|
15591
|
+
availableBytes: number(),
|
|
15592
|
+
percent: number()
|
|
15593
|
+
});
|
|
15594
|
+
var PidResourceStatsSchema = object({
|
|
15595
|
+
pid: number(),
|
|
15596
|
+
cpu: number(),
|
|
15597
|
+
memory: number(),
|
|
15598
|
+
/**
|
|
15599
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
15600
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
15601
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
15602
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
15603
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
15604
|
+
*/
|
|
15605
|
+
privateBytes: number().optional(),
|
|
15606
|
+
/**
|
|
15607
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
15608
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
15609
|
+
*/
|
|
15610
|
+
sharedBytes: number().optional()
|
|
15611
|
+
});
|
|
15612
|
+
var AddonInstanceSchema = object({
|
|
15613
|
+
addonId: string(),
|
|
15614
|
+
nodeId: string(),
|
|
15615
|
+
role: _enum(["hub", "worker"]),
|
|
15616
|
+
pid: number(),
|
|
15617
|
+
state: _enum([
|
|
15618
|
+
"starting",
|
|
15619
|
+
"running",
|
|
15620
|
+
"stopping",
|
|
15621
|
+
"stopped",
|
|
15622
|
+
"crashed"
|
|
15623
|
+
]),
|
|
15624
|
+
uptimeSec: number()
|
|
15625
|
+
});
|
|
15626
|
+
var NodeProcessSchema = object({
|
|
15627
|
+
pid: number(),
|
|
15628
|
+
ppid: number(),
|
|
15629
|
+
pgid: number(),
|
|
15630
|
+
classification: _enum([
|
|
15631
|
+
"root",
|
|
15632
|
+
"managed",
|
|
15633
|
+
"system",
|
|
15634
|
+
"ghost"
|
|
15635
|
+
]),
|
|
15636
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
15637
|
+
addonId: string().nullable(),
|
|
15638
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15639
|
+
nodeId: string().nullable(),
|
|
15640
|
+
/** Truncated command line. */
|
|
15641
|
+
command: string(),
|
|
15642
|
+
cpuPercent: number(),
|
|
15643
|
+
memoryRssBytes: number(),
|
|
15644
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15645
|
+
uptimeSec: number(),
|
|
15646
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15647
|
+
orphaned: boolean()
|
|
15648
|
+
});
|
|
15649
|
+
var KillProcessInputSchema = object({
|
|
15650
|
+
pid: number(),
|
|
15651
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15652
|
+
force: boolean().optional()
|
|
15653
|
+
});
|
|
15654
|
+
var KillProcessResultSchema = object({
|
|
15655
|
+
success: boolean(),
|
|
15656
|
+
reason: string().optional(),
|
|
15657
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15658
|
+
});
|
|
15659
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
15660
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
15661
|
+
addonId: string() });
|
|
15662
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
15663
|
+
success: boolean(),
|
|
15664
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15665
|
+
path: string().optional(),
|
|
15666
|
+
/** Process pid that was signalled. */
|
|
15667
|
+
pid: number().optional(),
|
|
15668
|
+
reason: string().optional()
|
|
15669
|
+
});
|
|
15670
|
+
var SystemMetricsSchema = object({
|
|
15671
|
+
cpuPercent: number(),
|
|
15672
|
+
memoryPercent: number(),
|
|
15673
|
+
memoryUsedMB: number(),
|
|
15674
|
+
memoryTotalMB: number(),
|
|
15675
|
+
diskPercent: number().optional(),
|
|
15676
|
+
temperature: number().optional(),
|
|
15677
|
+
gpuPercent: number().optional(),
|
|
15678
|
+
gpuMemoryPercent: number().optional()
|
|
15679
|
+
});
|
|
15680
|
+
method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string() }), DiskSpaceInfoSchema), method(_void(), MetricsGpuInfoSchema.nullable()), method(_void(), number().nullable()), method(object({ pids: array(number()) }), array(PidResourceStatsSchema)), method(_void(), array(AddonInstanceSchema).readonly()), method(object({ addonId: string() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(KillProcessInputSchema, KillProcessResultSchema, {
|
|
15681
|
+
kind: "mutation",
|
|
15682
|
+
auth: "admin"
|
|
15683
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
15684
|
+
kind: "mutation",
|
|
15685
|
+
auth: "admin"
|
|
15686
|
+
});
|
|
15687
|
+
method(object({
|
|
15688
|
+
sourceUrl: string(),
|
|
15689
|
+
metadata: ModelConvertMetadataSchema,
|
|
15690
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15691
|
+
calibrationRef: string().optional(),
|
|
15692
|
+
sessionId: string().optional()
|
|
15693
|
+
}), ConvertResultSchema, {
|
|
15694
|
+
kind: "mutation",
|
|
15695
|
+
auth: "admin",
|
|
15696
|
+
timeoutMs: 6e5
|
|
15697
|
+
});
|
|
15698
|
+
method(object({
|
|
15699
|
+
nodeId: string(),
|
|
15700
|
+
modelId: string(),
|
|
15701
|
+
format: _enum(MODEL_FORMATS),
|
|
15702
|
+
entry: ModelCatalogEntrySchema
|
|
15703
|
+
}), object({
|
|
15704
|
+
ok: boolean(),
|
|
15705
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15706
|
+
sha256: string(),
|
|
15707
|
+
bytes: number(),
|
|
15708
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
15709
|
+
path: string()
|
|
15710
|
+
}), {
|
|
15711
|
+
kind: "mutation",
|
|
15712
|
+
auth: "admin"
|
|
15713
|
+
});
|
|
15714
|
+
/**
|
|
15715
|
+
* `mqtt-broker` — broker-registry cap.
|
|
15716
|
+
*
|
|
15717
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15718
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15719
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
15720
|
+
* its OWN `mqtt.js` client.
|
|
15413
15721
|
*
|
|
15414
15722
|
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15415
15723
|
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
@@ -15674,14 +15982,14 @@ var TargetKindCapsSchema = object({
|
|
|
15674
15982
|
* the union is large and not meant for runtime validation here; the exported
|
|
15675
15983
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
15676
15984
|
*/
|
|
15677
|
-
var ConfigSchemaPassthrough
|
|
15985
|
+
var ConfigSchemaPassthrough = unknown();
|
|
15678
15986
|
var TargetKindSchema = object({
|
|
15679
15987
|
kind: string(),
|
|
15680
15988
|
label: string(),
|
|
15681
15989
|
icon: string(),
|
|
15682
15990
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15683
15991
|
addonId: string(),
|
|
15684
|
-
configSchema: ConfigSchemaPassthrough
|
|
15992
|
+
configSchema: ConfigSchemaPassthrough,
|
|
15685
15993
|
supportsDiscovery: boolean(),
|
|
15686
15994
|
caps: TargetKindCapsSchema
|
|
15687
15995
|
});
|
|
@@ -15728,303 +16036,499 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
15728
16036
|
notification: NotificationSchema
|
|
15729
16037
|
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
15730
16038
|
targetId: string(),
|
|
15731
|
-
sample: NotificationSchema.optional()
|
|
15732
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
15733
|
-
targetId: string(),
|
|
15734
|
-
enabled: boolean()
|
|
15735
|
-
}), _void(), { kind: "mutation" });
|
|
15736
|
-
/**
|
|
15737
|
-
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15738
|
-
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15739
|
-
* caps stay wire-compatible without a circular cap→cap import.
|
|
15740
|
-
*
|
|
15741
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15742
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
15743
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15744
|
-
*/
|
|
15745
|
-
var LlmUsageSchema = object({
|
|
15746
|
-
inputTokens: number(),
|
|
15747
|
-
outputTokens: number()
|
|
15748
|
-
});
|
|
15749
|
-
var LlmErrorCodeSchema = _enum([
|
|
15750
|
-
"timeout",
|
|
15751
|
-
"rate-limited",
|
|
15752
|
-
"auth",
|
|
15753
|
-
"refusal",
|
|
15754
|
-
"bad-request",
|
|
15755
|
-
"unavailable",
|
|
15756
|
-
"no-profile",
|
|
15757
|
-
"budget-exceeded",
|
|
15758
|
-
"adapter-error"
|
|
15759
|
-
]);
|
|
15760
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15761
|
-
ok: literal(true),
|
|
15762
|
-
text: string(),
|
|
15763
|
-
model: string(),
|
|
15764
|
-
usage: LlmUsageSchema,
|
|
15765
|
-
truncated: boolean(),
|
|
15766
|
-
latencyMs: number()
|
|
15767
|
-
}), object({
|
|
15768
|
-
ok: literal(false),
|
|
15769
|
-
code: LlmErrorCodeSchema,
|
|
15770
|
-
message: string(),
|
|
15771
|
-
retryAfterMs: number().optional()
|
|
15772
|
-
})]);
|
|
15773
|
-
/**
|
|
15774
|
-
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15775
|
-
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15776
|
-
* notification-output.cap.ts:27-31 precedents).
|
|
15777
|
-
*/
|
|
15778
|
-
var LlmImageSchema = object({
|
|
15779
|
-
bytes: _instanceof(Uint8Array),
|
|
15780
|
-
mimeType: string()
|
|
15781
|
-
});
|
|
15782
|
-
var LlmGenerateBaseInputSchema = object({
|
|
15783
|
-
/** Collection routing (the notification-output posture). */
|
|
15784
|
-
addonId: string().optional(),
|
|
15785
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15786
|
-
profileId: string().optional(),
|
|
15787
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15788
|
-
consumer: string(),
|
|
15789
|
-
system: string().optional(),
|
|
15790
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15791
|
-
prompt: string(),
|
|
15792
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15793
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
15794
|
-
/** Per-call override of the profile default. */
|
|
15795
|
-
maxTokens: number().int().positive().optional(),
|
|
15796
|
-
temperature: number().optional()
|
|
15797
|
-
});
|
|
16039
|
+
sample: NotificationSchema.optional()
|
|
16040
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16041
|
+
targetId: string(),
|
|
16042
|
+
enabled: boolean()
|
|
16043
|
+
}), _void(), { kind: "mutation" });
|
|
15798
16044
|
/**
|
|
15799
|
-
*
|
|
15800
|
-
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15801
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15802
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15803
|
-
* this only through the `llm` cap's methods.
|
|
16045
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
15804
16046
|
*
|
|
15805
|
-
*
|
|
15806
|
-
*
|
|
15807
|
-
*
|
|
16047
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
16048
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
16049
|
+
*
|
|
16050
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
16051
|
+
* `notification-center` module), hooked on the durable persistence
|
|
16052
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
16053
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
16054
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
16055
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
16056
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
16057
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
16058
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
16059
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
16060
|
+
* target kind's own caps/degrade engine).
|
|
16061
|
+
*
|
|
16062
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
16063
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
16064
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
16065
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
16066
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
16067
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
16068
|
+
* P2+ (see spec §7).
|
|
16069
|
+
*
|
|
16070
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
16071
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
16072
|
+
* schema/interface drift is explicitly not repeated).
|
|
15808
16073
|
*/
|
|
15809
|
-
|
|
15810
|
-
|
|
15811
|
-
|
|
15812
|
-
|
|
15813
|
-
|
|
15814
|
-
|
|
15815
|
-
|
|
15816
|
-
|
|
15817
|
-
|
|
15818
|
-
|
|
15819
|
-
|
|
15820
|
-
|
|
15821
|
-
|
|
15822
|
-
|
|
16074
|
+
/**
|
|
16075
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
16076
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
16077
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
16078
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
16079
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
16080
|
+
* change of a LINKED device, one row per linked camera)
|
|
16081
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
16082
|
+
* delivery / pick-up)
|
|
16083
|
+
*
|
|
16084
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
16085
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
16086
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
16087
|
+
* one trigger.
|
|
16088
|
+
*/
|
|
16089
|
+
var NcDeliverySchema = _enum([
|
|
16090
|
+
"immediate",
|
|
16091
|
+
"track-end",
|
|
16092
|
+
"device-event",
|
|
16093
|
+
"package-event"
|
|
15823
16094
|
]);
|
|
15824
|
-
|
|
15825
|
-
|
|
15826
|
-
|
|
15827
|
-
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
parallel: number().int().default(1),
|
|
15837
|
-
/** Else lazy: first generate boots it. */
|
|
15838
|
-
autoStart: boolean().default(false),
|
|
15839
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
15840
|
-
idleStopMinutes: number().int().default(30)
|
|
15841
|
-
});
|
|
15842
|
-
var LlmRuntimeStatusSchema = object({
|
|
15843
|
-
/** Status is ALWAYS node-qualified. */
|
|
15844
|
-
nodeId: string(),
|
|
15845
|
-
state: _enum([
|
|
15846
|
-
"stopped",
|
|
15847
|
-
"downloading",
|
|
15848
|
-
"starting",
|
|
15849
|
-
"ready",
|
|
15850
|
-
"crashed",
|
|
15851
|
-
"failed"
|
|
15852
|
-
]),
|
|
15853
|
-
pid: number().optional(),
|
|
15854
|
-
port: number().optional(),
|
|
15855
|
-
modelPath: string().optional(),
|
|
15856
|
-
modelId: string().optional(),
|
|
15857
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
15858
|
-
lastError: string().optional(),
|
|
15859
|
-
crashesInWindow: number(),
|
|
15860
|
-
/** Child RSS (sampled best-effort). */
|
|
15861
|
-
memoryBytes: number().optional(),
|
|
15862
|
-
vramBytes: number().optional()
|
|
16095
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
16096
|
+
var NcScheduleSchema = object({
|
|
16097
|
+
windows: array(object({
|
|
16098
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
16099
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
16100
|
+
startMinute: number().int().min(0).max(1439),
|
|
16101
|
+
endMinute: number().int().min(0).max(1439)
|
|
16102
|
+
})).min(1),
|
|
16103
|
+
/** IANA timezone; default = hub host timezone. */
|
|
16104
|
+
timezone: string().optional(),
|
|
16105
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
16106
|
+
invert: boolean().optional()
|
|
15863
16107
|
});
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
|
|
16108
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
16109
|
+
var NcPlateMatcherSchema = object({
|
|
16110
|
+
values: array(string().min(1)).min(1),
|
|
16111
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
16112
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
15869
16113
|
});
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
16114
|
+
/**
|
|
16115
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
16116
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
16117
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
16118
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
16119
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
16120
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
16121
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
16122
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
16123
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
16124
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
16125
|
+
* (declared SQLite collection, reseeded on boot).
|
|
16126
|
+
*/
|
|
16127
|
+
var NcOccupancyConditionSchema = object({
|
|
16128
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
16129
|
+
zoneId: string().optional(),
|
|
16130
|
+
/** Object class to count; absent = any class. */
|
|
16131
|
+
className: string().optional(),
|
|
16132
|
+
op: _enum([
|
|
16133
|
+
"became-occupied",
|
|
16134
|
+
"became-free",
|
|
16135
|
+
">=",
|
|
16136
|
+
"<="
|
|
16137
|
+
]).default("became-occupied"),
|
|
16138
|
+
count: number().int().min(0).default(1),
|
|
16139
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
16140
|
+
});
|
|
16141
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
16142
|
+
var NcZoneConditionSchema = object({
|
|
16143
|
+
ids: array(string().min(1)).min(1),
|
|
16144
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
16145
|
+
match: _enum(["any", "all"]).default("any")
|
|
15874
16146
|
});
|
|
15875
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
15876
|
-
images: array(LlmImageSchema).optional(),
|
|
15877
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
15878
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15879
|
-
timeoutMs: number().int().positive().optional()
|
|
15880
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15881
|
-
kind: "mutation",
|
|
15882
|
-
auth: "admin"
|
|
15883
|
-
}), method(object({}), _void(), {
|
|
15884
|
-
kind: "mutation",
|
|
15885
|
-
auth: "admin"
|
|
15886
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15887
|
-
kind: "mutation",
|
|
15888
|
-
auth: "admin"
|
|
15889
|
-
}), method(object({ file: string() }), _void(), {
|
|
15890
|
-
kind: "mutation",
|
|
15891
|
-
auth: "admin"
|
|
15892
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15893
16147
|
/**
|
|
15894
|
-
*
|
|
15895
|
-
*
|
|
15896
|
-
* provider by the `addonId` in the call input (the notification-output
|
|
15897
|
-
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15898
|
-
* (hub-placed); the cap stays open for future providers.
|
|
15899
|
-
*
|
|
15900
|
-
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15901
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15902
|
-
* write; a stored key NEVER round-trips to a client.
|
|
16148
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
16149
|
+
* membership lists are OR within the list (spec §2.3).
|
|
15903
16150
|
*/
|
|
15904
|
-
var
|
|
15905
|
-
|
|
15906
|
-
|
|
15907
|
-
|
|
15908
|
-
|
|
15909
|
-
|
|
15910
|
-
|
|
15911
|
-
|
|
15912
|
-
|
|
15913
|
-
|
|
15914
|
-
|
|
15915
|
-
/**
|
|
15916
|
-
|
|
15917
|
-
|
|
15918
|
-
|
|
15919
|
-
|
|
15920
|
-
|
|
15921
|
-
|
|
15922
|
-
/**
|
|
15923
|
-
|
|
15924
|
-
|
|
15925
|
-
|
|
15926
|
-
|
|
15927
|
-
|
|
15928
|
-
|
|
15929
|
-
|
|
15930
|
-
|
|
16151
|
+
var NcConditionsSchema = object({
|
|
16152
|
+
/** Device scope — absent = all devices. */
|
|
16153
|
+
devices: array(number()).optional(),
|
|
16154
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
16155
|
+
classes: array(string().min(1)).optional(),
|
|
16156
|
+
/** Veto classes — any overlap fails the rule. */
|
|
16157
|
+
classesExclude: array(string().min(1)).optional(),
|
|
16158
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
16159
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
16160
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
16161
|
+
zones: NcZoneConditionSchema.optional(),
|
|
16162
|
+
/** Veto zones — any hit fails the rule. */
|
|
16163
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
16164
|
+
/**
|
|
16165
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
16166
|
+
* (identity name / plate text / subclass).
|
|
16167
|
+
*/
|
|
16168
|
+
labelEquals: array(string().min(1)).optional(),
|
|
16169
|
+
/**
|
|
16170
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
16171
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
16172
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
16173
|
+
*/
|
|
16174
|
+
identities: array(string().min(1)).optional(),
|
|
16175
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
16176
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
16177
|
+
/**
|
|
16178
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
16179
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
16180
|
+
* identity display name). A record with NO label passes (nothing to
|
|
16181
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
16182
|
+
*/
|
|
16183
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
16184
|
+
/**
|
|
16185
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
16186
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
16187
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
16188
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
16189
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
16190
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
16191
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
16192
|
+
*/
|
|
16193
|
+
minImportance: number().min(0).max(1).optional(),
|
|
16194
|
+
/**
|
|
16195
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
16196
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
16197
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
16198
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
16199
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
16200
|
+
*/
|
|
16201
|
+
minDwellSeconds: number().min(0).optional(),
|
|
16202
|
+
/**
|
|
16203
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
16204
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
16205
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
16206
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
16207
|
+
* tracks carry `sensor`.
|
|
16208
|
+
*/
|
|
16209
|
+
source: _enum([
|
|
16210
|
+
"pipeline",
|
|
16211
|
+
"onboard",
|
|
16212
|
+
"sensor",
|
|
16213
|
+
"any"
|
|
16214
|
+
]).optional(),
|
|
16215
|
+
/**
|
|
16216
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
16217
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
16218
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
16219
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
16220
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
16221
|
+
*
|
|
16222
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
16223
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
16224
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
16225
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
16226
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
16227
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
16228
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
16229
|
+
* one track the higher of the two is used. A track that ended with no
|
|
16230
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
16231
|
+
* closed for it (an un-recognized subject).
|
|
16232
|
+
*/
|
|
16233
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
16234
|
+
/**
|
|
16235
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
16236
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
16237
|
+
* against the token carried on the device-event subject (extracted from the
|
|
16238
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
16239
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
16240
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
16241
|
+
*/
|
|
16242
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
16243
|
+
/**
|
|
16244
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
16245
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
16246
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
16247
|
+
*/
|
|
16248
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
16249
|
+
/**
|
|
16250
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
16251
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
16252
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
16253
|
+
* on the package-event trigger).
|
|
16254
|
+
*/
|
|
16255
|
+
packagePhase: _enum([
|
|
16256
|
+
"delivered",
|
|
16257
|
+
"picked-up",
|
|
16258
|
+
"both"
|
|
16259
|
+
]).optional(),
|
|
16260
|
+
/**
|
|
16261
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
16262
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
16263
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
16264
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
16265
|
+
*/
|
|
16266
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
16267
|
+
/**
|
|
16268
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
16269
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
16270
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
16271
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
16272
|
+
*/
|
|
16273
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
15931
16274
|
});
|
|
15932
|
-
/**
|
|
15933
|
-
|
|
15934
|
-
|
|
15935
|
-
|
|
15936
|
-
|
|
15937
|
-
|
|
15938
|
-
|
|
15939
|
-
|
|
15940
|
-
|
|
15941
|
-
|
|
15942
|
-
configSchema: ConfigSchemaPassthrough
|
|
16275
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
16276
|
+
var NcRuleTargetSchema = object({
|
|
16277
|
+
/** `notification-output` Target id. */
|
|
16278
|
+
targetId: string().min(1),
|
|
16279
|
+
/**
|
|
16280
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
16281
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
16282
|
+
* degrade engine drops what the backend can't render.
|
|
16283
|
+
*/
|
|
16284
|
+
params: record(string(), unknown()).optional()
|
|
15943
16285
|
});
|
|
15944
|
-
|
|
15945
|
-
|
|
15946
|
-
|
|
15947
|
-
|
|
16286
|
+
/**
|
|
16287
|
+
* Media attachment policy (P1 still-image subset).
|
|
16288
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
16289
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
16290
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
16291
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
16292
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
16293
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
16294
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
16295
|
+
* name), so the choice never drifts from the record that fired it.
|
|
16296
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
16297
|
+
* - `none` — no attachment.
|
|
16298
|
+
*/
|
|
16299
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
16300
|
+
"best",
|
|
16301
|
+
"best-matching",
|
|
16302
|
+
"keyFrame",
|
|
16303
|
+
"none"
|
|
16304
|
+
]).default("best") });
|
|
16305
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
16306
|
+
var NcThrottleSchema = object({
|
|
16307
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
16308
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
16309
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
16310
|
+
});
|
|
16311
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
16312
|
+
var NcRuleInputSchema = object({
|
|
16313
|
+
name: string().min(1).max(200),
|
|
16314
|
+
enabled: boolean().default(true),
|
|
16315
|
+
delivery: NcDeliverySchema,
|
|
16316
|
+
conditions: NcConditionsSchema.default({}),
|
|
16317
|
+
schedule: NcScheduleSchema.optional(),
|
|
16318
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
16319
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
16320
|
+
throttle: NcThrottleSchema.default({
|
|
16321
|
+
cooldownSec: 60,
|
|
16322
|
+
scope: "rule-device"
|
|
16323
|
+
}),
|
|
16324
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
16325
|
+
template: object({
|
|
16326
|
+
title: string().max(500).optional(),
|
|
16327
|
+
body: string().max(2e3).optional()
|
|
16328
|
+
}).optional(),
|
|
16329
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
16330
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16331
|
+
/**
|
|
16332
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
16333
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
16334
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
16335
|
+
*/
|
|
16336
|
+
ownerUserId: string().optional()
|
|
15948
16337
|
});
|
|
15949
|
-
/**
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
|
|
16338
|
+
/**
|
|
16339
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
16340
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
16341
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
16342
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
16343
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
16344
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
16345
|
+
* `updateRule` patch.
|
|
16346
|
+
*/
|
|
16347
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
16348
|
+
/** A persisted rule. */
|
|
16349
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
16350
|
+
id: string(),
|
|
16351
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
16352
|
+
createdBy: string(),
|
|
16353
|
+
createdAt: number(),
|
|
16354
|
+
updatedAt: number(),
|
|
16355
|
+
/**
|
|
16356
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
16357
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
16358
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
16359
|
+
*/
|
|
16360
|
+
disabledTargetIds: array(string()).default([])
|
|
16361
|
+
});
|
|
16362
|
+
var NcTestResultSchema = object({
|
|
16363
|
+
recordId: string(),
|
|
16364
|
+
recordKind: _enum([
|
|
16365
|
+
"object-event",
|
|
16366
|
+
"track",
|
|
16367
|
+
"device-event",
|
|
16368
|
+
"package-event"
|
|
16369
|
+
]),
|
|
16370
|
+
deviceId: number(),
|
|
16371
|
+
timestamp: number(),
|
|
16372
|
+
wouldFire: boolean(),
|
|
16373
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
16374
|
+
failedCondition: string().optional(),
|
|
16375
|
+
className: string().optional(),
|
|
16376
|
+
label: string().optional()
|
|
15960
16377
|
});
|
|
15961
|
-
|
|
15962
|
-
|
|
16378
|
+
var NcConditionDescriptorSchema = object({
|
|
16379
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
15963
16380
|
id: string(),
|
|
16381
|
+
group: _enum([
|
|
16382
|
+
"scope",
|
|
16383
|
+
"class",
|
|
16384
|
+
"zones",
|
|
16385
|
+
"quality",
|
|
16386
|
+
"label",
|
|
16387
|
+
"schedule",
|
|
16388
|
+
"device",
|
|
16389
|
+
"package",
|
|
16390
|
+
"occupancy"
|
|
16391
|
+
]),
|
|
15964
16392
|
label: string(),
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
16393
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
16394
|
+
valueType: _enum([
|
|
16395
|
+
"deviceIdList",
|
|
16396
|
+
"stringList",
|
|
16397
|
+
"number01",
|
|
16398
|
+
"number",
|
|
16399
|
+
"sourceSelect",
|
|
16400
|
+
"zoneSelection",
|
|
16401
|
+
"zoneIdList",
|
|
16402
|
+
"schedule",
|
|
16403
|
+
"plateMatcher",
|
|
16404
|
+
"packagePhase",
|
|
16405
|
+
"polygonDraw",
|
|
16406
|
+
"occupancy"
|
|
16407
|
+
]),
|
|
16408
|
+
operator: _enum([
|
|
16409
|
+
"in",
|
|
16410
|
+
"notIn",
|
|
16411
|
+
"anyOf",
|
|
16412
|
+
"allOf",
|
|
16413
|
+
"gte",
|
|
16414
|
+
"fuzzyIn",
|
|
16415
|
+
"withinSchedule"
|
|
16416
|
+
]),
|
|
16417
|
+
/** Which delivery kinds the condition applies to. */
|
|
16418
|
+
appliesTo: array(NcDeliverySchema),
|
|
16419
|
+
phase: string(),
|
|
16420
|
+
description: string().optional()
|
|
15976
16421
|
});
|
|
15977
|
-
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
16422
|
+
/**
|
|
16423
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
16424
|
+
* durable outbox row's own status (single source of truth):
|
|
16425
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
16426
|
+
* - `sent` — delivered (terminal)
|
|
16427
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
16428
|
+
* backend rejection / a deleted target (terminal; carries
|
|
16429
|
+
* the failure `error`)
|
|
16430
|
+
*
|
|
16431
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
16432
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
16433
|
+
*/
|
|
16434
|
+
var NcHistoryStatusSchema = _enum([
|
|
16435
|
+
"pending",
|
|
16436
|
+
"sent",
|
|
16437
|
+
"dead"
|
|
16438
|
+
]);
|
|
16439
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
16440
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
16441
|
+
"object-event",
|
|
16442
|
+
"track-end",
|
|
16443
|
+
"device-event",
|
|
16444
|
+
"package-event"
|
|
16445
|
+
]);
|
|
16446
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
16447
|
+
var NcHistorySubjectSchema = object({
|
|
16448
|
+
className: string(),
|
|
16449
|
+
label: string().optional(),
|
|
16450
|
+
confidence: number().optional(),
|
|
16451
|
+
zones: array(string()),
|
|
16452
|
+
timestamp: number()
|
|
16453
|
+
});
|
|
16454
|
+
/**
|
|
16455
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
16456
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
16457
|
+
* NO second write path, so history can never drift from delivery state).
|
|
16458
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
16459
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
16460
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
16461
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
16462
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
16463
|
+
* P1 (admin scope only).
|
|
16464
|
+
*/
|
|
16465
|
+
var NcHistoryEntrySchema = object({
|
|
16466
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
16467
|
+
id: string(),
|
|
16468
|
+
ruleId: string(),
|
|
16469
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
16470
|
+
ruleName: string(),
|
|
16471
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
16472
|
+
delivery: NcDeliverySchema,
|
|
16473
|
+
targetId: string(),
|
|
16474
|
+
deviceId: number(),
|
|
16475
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
16476
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
16477
|
+
recordId: string(),
|
|
16478
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
16479
|
+
trackId: string().optional(),
|
|
16480
|
+
status: NcHistoryStatusSchema,
|
|
16481
|
+
/** Delivery attempts made so far. */
|
|
16482
|
+
attempts: number().int(),
|
|
16483
|
+
/** Fire time (outbox enqueue). */
|
|
16484
|
+
createdAt: number(),
|
|
16485
|
+
/** Last transition time (terminal for sent / dead). */
|
|
16486
|
+
updatedAt: number(),
|
|
16487
|
+
/** Failure detail — present on a `dead` row. */
|
|
16488
|
+
error: string().optional(),
|
|
16489
|
+
subject: NcHistorySubjectSchema
|
|
15983
16490
|
});
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
|
|
16491
|
+
/**
|
|
16492
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
16493
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
16494
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
16495
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
16496
|
+
*/
|
|
16497
|
+
var NcHistoryFilterSchema = object({
|
|
16498
|
+
ruleId: string().optional(),
|
|
16499
|
+
deviceId: number().optional(),
|
|
16500
|
+
status: NcHistoryStatusSchema.optional(),
|
|
16501
|
+
since: number().optional(),
|
|
16502
|
+
until: number().optional(),
|
|
16503
|
+
limit: number().int().min(1).max(500).default(100)
|
|
15988
16504
|
});
|
|
15989
|
-
method(
|
|
15990
|
-
kind: "mutation",
|
|
15991
|
-
auth: "admin"
|
|
15992
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
16505
|
+
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 }), {
|
|
15993
16506
|
kind: "mutation",
|
|
15994
|
-
auth: "admin"
|
|
15995
|
-
|
|
16507
|
+
auth: "admin",
|
|
16508
|
+
caller: "required"
|
|
16509
|
+
}), method(object({
|
|
16510
|
+
ruleId: string(),
|
|
16511
|
+
patch: NcRulePatchSchema
|
|
16512
|
+
}), object({ rule: NcRuleSchema }), {
|
|
15996
16513
|
kind: "mutation",
|
|
15997
|
-
auth: "admin"
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
profileId: string().nullable()
|
|
16001
|
-
}), _void(), {
|
|
16514
|
+
auth: "admin",
|
|
16515
|
+
caller: "required"
|
|
16516
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
16002
16517
|
kind: "mutation",
|
|
16003
16518
|
auth: "admin"
|
|
16004
16519
|
}), method(object({
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
profileId: string().optional()
|
|
16009
|
-
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16010
|
-
nodeId: string(),
|
|
16011
|
-
model: ManagedModelRefSchema
|
|
16012
|
-
}), _void(), {
|
|
16520
|
+
ruleId: string(),
|
|
16521
|
+
enabled: boolean()
|
|
16522
|
+
}), object({ success: literal(true) }), {
|
|
16013
16523
|
kind: "mutation",
|
|
16014
16524
|
auth: "admin"
|
|
16015
16525
|
}), method(object({
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
}),
|
|
16019
|
-
kind: "mutation",
|
|
16020
|
-
auth: "admin"
|
|
16021
|
-
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16022
|
-
kind: "mutation",
|
|
16023
|
-
auth: "admin"
|
|
16024
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
16526
|
+
rule: NcRuleInputSchema,
|
|
16527
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
16528
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
16025
16529
|
kind: "mutation",
|
|
16026
16530
|
auth: "admin"
|
|
16027
|
-
});
|
|
16531
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
16028
16532
|
/**
|
|
16029
16533
|
* Zod schemas for persisted record types.
|
|
16030
16534
|
*
|
|
@@ -16710,7 +17214,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16710
17214
|
}), method(object({
|
|
16711
17215
|
eventId: string(),
|
|
16712
17216
|
kind: MediaFileKindEnum.optional()
|
|
16713
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
17217
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
17218
|
+
trackId: string(),
|
|
17219
|
+
kinds: array(MediaFileKindEnum).optional()
|
|
17220
|
+
}), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
|
|
16714
17221
|
deviceId: number(),
|
|
16715
17222
|
timestamp: number(),
|
|
16716
17223
|
frameWidth: number(),
|
|
@@ -16731,76 +17238,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16731
17238
|
eventId: string(),
|
|
16732
17239
|
timestamp: number()
|
|
16733
17240
|
});
|
|
16734
|
-
/**
|
|
16735
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
16736
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
16737
|
-
* caps into per-camera event-kind descriptors.
|
|
16738
|
-
*
|
|
16739
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
16740
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
16741
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
16742
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
16743
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
16744
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
16745
|
-
* eventful cap is missing.
|
|
16746
|
-
*/
|
|
16747
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
16748
|
-
var LEGACY_ICON = {
|
|
16749
|
-
motion: "motion",
|
|
16750
|
-
audio: "audio",
|
|
16751
|
-
person: "person",
|
|
16752
|
-
vehicle: "vehicle",
|
|
16753
|
-
animal: "animal",
|
|
16754
|
-
package: "package",
|
|
16755
|
-
door: "door",
|
|
16756
|
-
pir: "pir",
|
|
16757
|
-
smoke: "smoke",
|
|
16758
|
-
water: "water",
|
|
16759
|
-
button: "button",
|
|
16760
|
-
generic: "generic",
|
|
16761
|
-
gas: "smoke",
|
|
16762
|
-
vibration: "generic",
|
|
16763
|
-
tamper: "generic",
|
|
16764
|
-
presence: "person",
|
|
16765
|
-
lock: "generic",
|
|
16766
|
-
siren: "generic",
|
|
16767
|
-
switch: "generic",
|
|
16768
|
-
doorbell: "button"
|
|
16769
|
-
};
|
|
16770
|
-
function legacyIcon(iconId) {
|
|
16771
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
16772
|
-
}
|
|
16773
|
-
/**
|
|
16774
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
16775
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
16776
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
16777
|
-
*/
|
|
16778
|
-
var CAP_TO_KIND = {
|
|
16779
|
-
contact: "contact",
|
|
16780
|
-
motion: "motion-sensor",
|
|
16781
|
-
smoke: "smoke",
|
|
16782
|
-
flood: "flood",
|
|
16783
|
-
gas: "gas",
|
|
16784
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
16785
|
-
vibration: "vibration",
|
|
16786
|
-
tamper: "tamper",
|
|
16787
|
-
presence: "presence",
|
|
16788
|
-
"enum-sensor": "enum-sensor",
|
|
16789
|
-
"event-emitter": "device-event",
|
|
16790
|
-
"lock-control": "lock",
|
|
16791
|
-
switch: "switch",
|
|
16792
|
-
button: "button",
|
|
16793
|
-
doorbell: "doorbell"
|
|
16794
|
-
};
|
|
16795
|
-
function buildDescriptor(capName, kind) {
|
|
16796
|
-
const t = EVENT_TAXONOMY[kind];
|
|
16797
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
16798
|
-
return {
|
|
16799
|
-
...t,
|
|
16800
|
-
icon: legacyIcon(t.iconId)
|
|
16801
|
-
};
|
|
16802
|
-
}
|
|
16803
|
-
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
16804
17241
|
var CameraPipelineConfigSchema = object({
|
|
16805
17242
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
16806
17243
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -17286,6 +17723,76 @@ method(object({
|
|
|
17286
17723
|
auth: "admin"
|
|
17287
17724
|
});
|
|
17288
17725
|
/**
|
|
17726
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
17727
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
17728
|
+
* caps into per-camera event-kind descriptors.
|
|
17729
|
+
*
|
|
17730
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
17731
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
17732
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
17733
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
17734
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
17735
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
17736
|
+
* eventful cap is missing.
|
|
17737
|
+
*/
|
|
17738
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
17739
|
+
var LEGACY_ICON = {
|
|
17740
|
+
motion: "motion",
|
|
17741
|
+
audio: "audio",
|
|
17742
|
+
person: "person",
|
|
17743
|
+
vehicle: "vehicle",
|
|
17744
|
+
animal: "animal",
|
|
17745
|
+
package: "package",
|
|
17746
|
+
door: "door",
|
|
17747
|
+
pir: "pir",
|
|
17748
|
+
smoke: "smoke",
|
|
17749
|
+
water: "water",
|
|
17750
|
+
button: "button",
|
|
17751
|
+
generic: "generic",
|
|
17752
|
+
gas: "smoke",
|
|
17753
|
+
vibration: "generic",
|
|
17754
|
+
tamper: "generic",
|
|
17755
|
+
presence: "person",
|
|
17756
|
+
lock: "generic",
|
|
17757
|
+
siren: "generic",
|
|
17758
|
+
switch: "generic",
|
|
17759
|
+
doorbell: "button"
|
|
17760
|
+
};
|
|
17761
|
+
function legacyIcon(iconId) {
|
|
17762
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
17763
|
+
}
|
|
17764
|
+
/**
|
|
17765
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
17766
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
17767
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
17768
|
+
*/
|
|
17769
|
+
var CAP_TO_KIND = {
|
|
17770
|
+
contact: "contact",
|
|
17771
|
+
motion: "motion-sensor",
|
|
17772
|
+
smoke: "smoke",
|
|
17773
|
+
flood: "flood",
|
|
17774
|
+
gas: "gas",
|
|
17775
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
17776
|
+
vibration: "vibration",
|
|
17777
|
+
tamper: "tamper",
|
|
17778
|
+
presence: "presence",
|
|
17779
|
+
"enum-sensor": "enum-sensor",
|
|
17780
|
+
"event-emitter": "device-event",
|
|
17781
|
+
"lock-control": "lock",
|
|
17782
|
+
switch: "switch",
|
|
17783
|
+
button: "button",
|
|
17784
|
+
doorbell: "doorbell"
|
|
17785
|
+
};
|
|
17786
|
+
function buildDescriptor(capName, kind) {
|
|
17787
|
+
const t = EVENT_TAXONOMY[kind];
|
|
17788
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
17789
|
+
return {
|
|
17790
|
+
...t,
|
|
17791
|
+
icon: legacyIcon(t.iconId)
|
|
17792
|
+
};
|
|
17793
|
+
}
|
|
17794
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
17795
|
+
/**
|
|
17289
17796
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
17290
17797
|
* package lifecycle (runtime-updatable node packages).
|
|
17291
17798
|
*
|
|
@@ -18763,7 +19270,28 @@ var FaceInfoSchema = object({
|
|
|
18763
19270
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
18764
19271
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
18765
19272
|
* back to the inline `base64` face crop. */
|
|
18766
|
-
keyFrameMediaKey: string().optional()
|
|
19273
|
+
keyFrameMediaKey: string().optional(),
|
|
19274
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
19275
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
19276
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
19277
|
+
* faces that were never auto-recognized. */
|
|
19278
|
+
bestMatchScore: number().optional(),
|
|
19279
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
19280
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
19281
|
+
* legacy rows / runners that reported no native measure. */
|
|
19282
|
+
nativeFaceShortSidePx: number().optional(),
|
|
19283
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
19284
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
19285
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
19286
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
19287
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
19288
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
19289
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
19290
|
+
suggestedIdentityId: string().optional(),
|
|
19291
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
19292
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
19293
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
19294
|
+
suggestedMatchScore: number().optional()
|
|
18767
19295
|
});
|
|
18768
19296
|
var FaceFilterEnum = _enum([
|
|
18769
19297
|
"unassigned",
|
|
@@ -20806,36 +21334,6 @@ Object.freeze({
|
|
|
20806
21334
|
addonId: null,
|
|
20807
21335
|
access: "view"
|
|
20808
21336
|
},
|
|
20809
|
-
"advancedNotifier.deleteRule": {
|
|
20810
|
-
capName: "advanced-notifier",
|
|
20811
|
-
capScope: "system",
|
|
20812
|
-
addonId: null,
|
|
20813
|
-
access: "delete"
|
|
20814
|
-
},
|
|
20815
|
-
"advancedNotifier.getHistory": {
|
|
20816
|
-
capName: "advanced-notifier",
|
|
20817
|
-
capScope: "system",
|
|
20818
|
-
addonId: null,
|
|
20819
|
-
access: "view"
|
|
20820
|
-
},
|
|
20821
|
-
"advancedNotifier.getRules": {
|
|
20822
|
-
capName: "advanced-notifier",
|
|
20823
|
-
capScope: "system",
|
|
20824
|
-
addonId: null,
|
|
20825
|
-
access: "view"
|
|
20826
|
-
},
|
|
20827
|
-
"advancedNotifier.testRule": {
|
|
20828
|
-
capName: "advanced-notifier",
|
|
20829
|
-
capScope: "system",
|
|
20830
|
-
addonId: null,
|
|
20831
|
-
access: "create"
|
|
20832
|
-
},
|
|
20833
|
-
"advancedNotifier.upsertRule": {
|
|
20834
|
-
capName: "advanced-notifier",
|
|
20835
|
-
capScope: "system",
|
|
20836
|
-
addonId: null,
|
|
20837
|
-
access: "create"
|
|
20838
|
-
},
|
|
20839
21337
|
"alarmPanel.arm": {
|
|
20840
21338
|
capName: "alarm-panel",
|
|
20841
21339
|
capScope: "device",
|
|
@@ -23140,6 +23638,60 @@ Object.freeze({
|
|
|
23140
23638
|
addonId: null,
|
|
23141
23639
|
access: "create"
|
|
23142
23640
|
},
|
|
23641
|
+
"notificationRules.createRule": {
|
|
23642
|
+
capName: "notification-rules",
|
|
23643
|
+
capScope: "system",
|
|
23644
|
+
addonId: null,
|
|
23645
|
+
access: "create"
|
|
23646
|
+
},
|
|
23647
|
+
"notificationRules.deleteRule": {
|
|
23648
|
+
capName: "notification-rules",
|
|
23649
|
+
capScope: "system",
|
|
23650
|
+
addonId: null,
|
|
23651
|
+
access: "delete"
|
|
23652
|
+
},
|
|
23653
|
+
"notificationRules.getConditionCatalog": {
|
|
23654
|
+
capName: "notification-rules",
|
|
23655
|
+
capScope: "system",
|
|
23656
|
+
addonId: null,
|
|
23657
|
+
access: "view"
|
|
23658
|
+
},
|
|
23659
|
+
"notificationRules.getHistory": {
|
|
23660
|
+
capName: "notification-rules",
|
|
23661
|
+
capScope: "system",
|
|
23662
|
+
addonId: null,
|
|
23663
|
+
access: "view"
|
|
23664
|
+
},
|
|
23665
|
+
"notificationRules.getRule": {
|
|
23666
|
+
capName: "notification-rules",
|
|
23667
|
+
capScope: "system",
|
|
23668
|
+
addonId: null,
|
|
23669
|
+
access: "view"
|
|
23670
|
+
},
|
|
23671
|
+
"notificationRules.listRules": {
|
|
23672
|
+
capName: "notification-rules",
|
|
23673
|
+
capScope: "system",
|
|
23674
|
+
addonId: null,
|
|
23675
|
+
access: "view"
|
|
23676
|
+
},
|
|
23677
|
+
"notificationRules.setRuleEnabled": {
|
|
23678
|
+
capName: "notification-rules",
|
|
23679
|
+
capScope: "system",
|
|
23680
|
+
addonId: null,
|
|
23681
|
+
access: "create"
|
|
23682
|
+
},
|
|
23683
|
+
"notificationRules.testRule": {
|
|
23684
|
+
capName: "notification-rules",
|
|
23685
|
+
capScope: "system",
|
|
23686
|
+
addonId: null,
|
|
23687
|
+
access: "create"
|
|
23688
|
+
},
|
|
23689
|
+
"notificationRules.updateRule": {
|
|
23690
|
+
capName: "notification-rules",
|
|
23691
|
+
capScope: "system",
|
|
23692
|
+
addonId: null,
|
|
23693
|
+
access: "create"
|
|
23694
|
+
},
|
|
23143
23695
|
"notifier.cancel": {
|
|
23144
23696
|
capName: "notifier",
|
|
23145
23697
|
capScope: "device",
|