@camstack/addon-auth 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/{dist-Cqf9VbiT.mjs → dist-BMyVeNla.mjs} +1318 -766
- package/dist/{dist-kmLBjehf.js → dist-D1pCpeFq.js} +1318 -766
- package/dist/magic-link/auth-magic-link.addon.js +1 -1
- package/dist/magic-link/auth-magic-link.addon.mjs +1 -1
- package/dist/oidc/auth-oidc.addon.js +1 -1
- package/dist/oidc/auth-oidc.addon.mjs +1 -1
- package/dist/webauthn/_stub.js +1 -1
- package/dist/webauthn/{_virtual_mf-localSharedImportMap___mfe_internal__addon_auth_webauthn_widgets-Bc9HBsPT.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_auth_webauthn_widgets-Bsc2vpvj.mjs} +3 -3
- package/dist/webauthn/_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CJL0YiKn.mjs +26 -0
- package/dist/webauthn/auth-webauthn.addon.js +1 -1
- package/dist/webauthn/auth-webauthn.addon.mjs +1 -1
- package/dist/webauthn/{hostInit-BV01YYnn.mjs → hostInit-DZ3Vsvv5.mjs} +3 -3
- package/dist/webauthn/remoteEntry.js +1 -1
- package/package.json +1 -1
- package/dist/webauthn/_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DbD550tu.mjs +0 -26
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../types/dist/event-category-
|
|
1
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
2
2
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
3
3
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4
4
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -148,9 +148,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
148
148
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
149
149
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
150
150
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
151
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
152
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
153
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
154
151
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
155
152
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
156
153
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -6815,7 +6812,6 @@ object({ deviceId: number() }), object({ deviceId: number() }), object({
|
|
|
6815
6812
|
patch: record(string(), unknown())
|
|
6816
6813
|
}), object({ success: literal(true) });
|
|
6817
6814
|
object({ deviceId: number() }), unknown().nullable();
|
|
6818
|
-
/** Shorthand to define a method schema */
|
|
6819
6815
|
function method(input, output, options) {
|
|
6820
6816
|
return {
|
|
6821
6817
|
input,
|
|
@@ -6823,6 +6819,7 @@ function method(input, output, options) {
|
|
|
6823
6819
|
kind: options?.kind ?? "query",
|
|
6824
6820
|
auth: options?.auth ?? "protected",
|
|
6825
6821
|
...options?.access !== void 0 ? { access: options.access } : {},
|
|
6822
|
+
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
6826
6823
|
timeoutMs: options?.timeoutMs
|
|
6827
6824
|
};
|
|
6828
6825
|
}
|
|
@@ -8305,6 +8302,59 @@ for (const l of AUDIO_MACRO_LABELS) {
|
|
|
8305
8302
|
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8306
8303
|
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8307
8304
|
/**
|
|
8305
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8306
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8307
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8308
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8309
|
+
*
|
|
8310
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8311
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8312
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8313
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8314
|
+
* the same class picker, grouped under an Audio header.
|
|
8315
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8316
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8317
|
+
*
|
|
8318
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8319
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8320
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8321
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8322
|
+
*/
|
|
8323
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8324
|
+
var NcTaxonomyEntrySchema = object({
|
|
8325
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8326
|
+
kind: string(),
|
|
8327
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8328
|
+
label: string(),
|
|
8329
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8330
|
+
parentKind: string().nullable()
|
|
8331
|
+
});
|
|
8332
|
+
object({
|
|
8333
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8334
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8335
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8336
|
+
});
|
|
8337
|
+
function toEntry(kind, label, parentKind) {
|
|
8338
|
+
return {
|
|
8339
|
+
kind,
|
|
8340
|
+
label,
|
|
8341
|
+
parentKind
|
|
8342
|
+
};
|
|
8343
|
+
}
|
|
8344
|
+
/**
|
|
8345
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8346
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8347
|
+
*/
|
|
8348
|
+
function buildNcTaxonomy() {
|
|
8349
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8350
|
+
return {
|
|
8351
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8352
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8353
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8354
|
+
};
|
|
8355
|
+
}
|
|
8356
|
+
Object.freeze(buildNcTaxonomy());
|
|
8357
|
+
/**
|
|
8308
8358
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8309
8359
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8310
8360
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -11013,6 +11063,22 @@ var CameraMetricsSchema = object({
|
|
|
11013
11063
|
])
|
|
11014
11064
|
});
|
|
11015
11065
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
11066
|
+
/**
|
|
11067
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
11068
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
11069
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
11070
|
+
*/
|
|
11071
|
+
var NativeCropRefSchema = object({
|
|
11072
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
11073
|
+
handle: FrameHandleSchema,
|
|
11074
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
11075
|
+
cropFrameSpace: object({
|
|
11076
|
+
x: number(),
|
|
11077
|
+
y: number(),
|
|
11078
|
+
w: number(),
|
|
11079
|
+
h: number()
|
|
11080
|
+
})
|
|
11081
|
+
});
|
|
11016
11082
|
var ModelFormatSchema$1 = _enum([
|
|
11017
11083
|
"onnx",
|
|
11018
11084
|
"coreml",
|
|
@@ -11288,7 +11354,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
11288
11354
|
* Omitted ⇒ the runner's default device (current single-engine
|
|
11289
11355
|
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
11290
11356
|
*/
|
|
11291
|
-
deviceKey: string().optional()
|
|
11357
|
+
deviceKey: string().optional(),
|
|
11358
|
+
/**
|
|
11359
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
11360
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
11361
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
11362
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
11363
|
+
* resolution from that surface — the SAME quality path faces already
|
|
11364
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
11365
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
11366
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
11367
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
11368
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
11369
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
11370
|
+
* (today's behaviour on the fallback path).
|
|
11371
|
+
*/
|
|
11372
|
+
nativeCropRef: NativeCropRefSchema.optional()
|
|
11292
11373
|
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
11293
11374
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
11294
11375
|
steps: array(PipelineStepInputSchema).min(1),
|
|
@@ -11504,7 +11585,11 @@ var DetailResultSchema = object({
|
|
|
11504
11585
|
bbox: NativeCropBboxSchema.optional(),
|
|
11505
11586
|
embedding: string().optional(),
|
|
11506
11587
|
label: string().optional(),
|
|
11507
|
-
alignedCropJpeg: string().optional()
|
|
11588
|
+
alignedCropJpeg: string().optional(),
|
|
11589
|
+
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
11590
|
+
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
11591
|
+
* consumers MUST prefer this when present (2026-07-22 native-gate fix). */
|
|
11592
|
+
nativeFaceShortSidePx: number().optional()
|
|
11508
11593
|
});
|
|
11509
11594
|
/**
|
|
11510
11595
|
* Per-camera tunable ranges + defaults. Single source of truth used
|
|
@@ -11518,6 +11603,12 @@ var motionCooldownMsField = {
|
|
|
11518
11603
|
default: 3e4,
|
|
11519
11604
|
step: 500
|
|
11520
11605
|
};
|
|
11606
|
+
var maxSessionHoldMsField = {
|
|
11607
|
+
min: 0,
|
|
11608
|
+
max: 6e5,
|
|
11609
|
+
default: 12e4,
|
|
11610
|
+
step: 5e3
|
|
11611
|
+
};
|
|
11521
11612
|
var motionFpsField = {
|
|
11522
11613
|
min: 1,
|
|
11523
11614
|
max: 30,
|
|
@@ -11665,6 +11756,19 @@ var RunnerCameraConfigSchema = object({
|
|
|
11665
11756
|
"on-motion"
|
|
11666
11757
|
]).default("always-on"),
|
|
11667
11758
|
motionCooldownMs: number().min(motionCooldownMsField.min).default(motionCooldownMsField.default),
|
|
11759
|
+
/**
|
|
11760
|
+
* Orchestrator-side on-motion session-hold cap (ms). While an on-motion
|
|
11761
|
+
* detection session is active and ≥1 confirmed non-stationary track is
|
|
11762
|
+
* still live, the orchestrator keeps the session open past
|
|
11763
|
+
* `motionCooldownMs` (a slowly-moving subject can stop re-triggering the
|
|
11764
|
+
* camera's VMD yet is still being tracked frame-to-frame) — up to this many
|
|
11765
|
+
* ms since the session opened, after which it closes regardless. `0`
|
|
11766
|
+
* disables the hold (legacy cooldown-only teardown). Not consumed by the
|
|
11767
|
+
* runner itself — carried here so it shares the per-camera device-settings
|
|
11768
|
+
* surface with `motionCooldownMs`; the orchestrator reads it off the
|
|
11769
|
+
* resolved `CameraDetectionConfig`.
|
|
11770
|
+
*/
|
|
11771
|
+
maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
|
|
11668
11772
|
motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
|
|
11669
11773
|
detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
|
|
11670
11774
|
motionStreamId: string(),
|
|
@@ -11754,7 +11858,7 @@ var RunnerCameraConfigSchema = object({
|
|
|
11754
11858
|
*/
|
|
11755
11859
|
inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
|
|
11756
11860
|
});
|
|
11757
|
-
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;
|
|
11861
|
+
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;
|
|
11758
11862
|
/**
|
|
11759
11863
|
* Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
|
|
11760
11864
|
* load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
|
|
@@ -13633,94 +13737,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
13633
13737
|
bundleUrl: string()
|
|
13634
13738
|
});
|
|
13635
13739
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
13636
|
-
var NotificationRuleConditionsSchema = object({
|
|
13637
|
-
deviceIds: array(number()).readonly().optional(),
|
|
13638
|
-
classNames: array(string()).readonly().optional(),
|
|
13639
|
-
zoneIds: array(string()).readonly().optional(),
|
|
13640
|
-
minConfidence: number().optional(),
|
|
13641
|
-
source: _enum([
|
|
13642
|
-
"pipeline",
|
|
13643
|
-
"onboard",
|
|
13644
|
-
"any"
|
|
13645
|
-
]).optional(),
|
|
13646
|
-
schedule: object({
|
|
13647
|
-
days: array(number()).readonly(),
|
|
13648
|
-
startHour: number(),
|
|
13649
|
-
endHour: number()
|
|
13650
|
-
}).optional(),
|
|
13651
|
-
cooldownSeconds: number().optional(),
|
|
13652
|
-
minDwellSeconds: number().optional(),
|
|
13653
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
13654
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
13655
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
13656
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
13657
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
13658
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
13659
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
13660
|
-
clipDescription: object({
|
|
13661
|
-
text: string().min(1),
|
|
13662
|
-
minSimilarity: number().min(0).max(1)
|
|
13663
|
-
}).optional(),
|
|
13664
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
13665
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
13666
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
13667
|
-
* vehicle/person> is seen". */
|
|
13668
|
-
labels: array(string()).readonly().optional()
|
|
13669
|
-
});
|
|
13670
|
-
var NotificationRuleTemplateSchema = object({
|
|
13671
|
-
title: string(),
|
|
13672
|
-
body: string(),
|
|
13673
|
-
imageMode: _enum([
|
|
13674
|
-
"crop",
|
|
13675
|
-
"annotated",
|
|
13676
|
-
"full",
|
|
13677
|
-
"none"
|
|
13678
|
-
])
|
|
13679
|
-
});
|
|
13680
|
-
var NotificationRuleSchema = object({
|
|
13681
|
-
id: string(),
|
|
13682
|
-
name: string(),
|
|
13683
|
-
enabled: boolean(),
|
|
13684
|
-
eventTypes: array(string()).readonly(),
|
|
13685
|
-
conditions: NotificationRuleConditionsSchema,
|
|
13686
|
-
outputs: array(string()).readonly(),
|
|
13687
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
13688
|
-
priority: _enum([
|
|
13689
|
-
"low",
|
|
13690
|
-
"normal",
|
|
13691
|
-
"high",
|
|
13692
|
-
"critical"
|
|
13693
|
-
])
|
|
13694
|
-
});
|
|
13695
|
-
var NotificationTestResultSchema = object({
|
|
13696
|
-
ruleId: string(),
|
|
13697
|
-
eventId: string(),
|
|
13698
|
-
timestamp: number(),
|
|
13699
|
-
wouldFire: boolean(),
|
|
13700
|
-
reason: string().optional()
|
|
13701
|
-
});
|
|
13702
|
-
var NotificationHistoryEntrySchema = object({
|
|
13703
|
-
id: string(),
|
|
13704
|
-
ruleId: string(),
|
|
13705
|
-
ruleName: string(),
|
|
13706
|
-
eventId: string(),
|
|
13707
|
-
timestamp: number(),
|
|
13708
|
-
outputs: array(string()).readonly(),
|
|
13709
|
-
success: boolean(),
|
|
13710
|
-
error: string().optional(),
|
|
13711
|
-
deviceId: number().optional()
|
|
13712
|
-
});
|
|
13713
|
-
var NotificationHistoryFilterSchema = object({
|
|
13714
|
-
ruleId: string().optional(),
|
|
13715
|
-
deviceId: number().optional(),
|
|
13716
|
-
from: number().optional(),
|
|
13717
|
-
to: number().optional(),
|
|
13718
|
-
limit: number().optional()
|
|
13719
|
-
});
|
|
13720
|
-
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({
|
|
13721
|
-
ruleId: string(),
|
|
13722
|
-
lookbackMinutes: number()
|
|
13723
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
13724
13740
|
/**
|
|
13725
13741
|
* Alerts capability — collection-based internal alert system.
|
|
13726
13742
|
*
|
|
@@ -13920,97 +13936,6 @@ var authProviderCapability = {
|
|
|
13920
13936
|
mount: { kind: "skip" }
|
|
13921
13937
|
};
|
|
13922
13938
|
/**
|
|
13923
|
-
* `login-method` — collection cap through which auth addons contribute
|
|
13924
|
-
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
13925
|
-
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
13926
|
-
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
13927
|
-
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
13928
|
-
* procedure aggregates them for the unauthenticated login page.
|
|
13929
|
-
*
|
|
13930
|
-
* A contribution is a discriminated union on `kind`:
|
|
13931
|
-
*
|
|
13932
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
13933
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
13934
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
13935
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
13936
|
-
* login page needs NO change.
|
|
13937
|
-
*
|
|
13938
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
13939
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
13940
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
13941
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
13942
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
13943
|
-
*
|
|
13944
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
13945
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
13946
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
13947
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
13948
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
13949
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
13950
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
13951
|
-
* decision.
|
|
13952
|
-
*
|
|
13953
|
-
* Every contribution carries a `stage`:
|
|
13954
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
13955
|
-
* magic-link buttons; a future usernameless passkey).
|
|
13956
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
13957
|
-
* returned `factors` (passkey-as-2FA today).
|
|
13958
|
-
*
|
|
13959
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
13960
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
13961
|
-
* tRPC router.
|
|
13962
|
-
*/
|
|
13963
|
-
/** When a login method renders in the two-phase login flow. */
|
|
13964
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
13965
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
13966
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
13967
|
-
object({
|
|
13968
|
-
kind: literal("redirect"),
|
|
13969
|
-
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
13970
|
-
id: string(),
|
|
13971
|
-
/** Operator-facing button label. */
|
|
13972
|
-
label: string(),
|
|
13973
|
-
/** lucide-react icon name. */
|
|
13974
|
-
icon: string().optional(),
|
|
13975
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
13976
|
-
startUrl: string(),
|
|
13977
|
-
stage: LoginStageEnum
|
|
13978
|
-
}),
|
|
13979
|
-
object({
|
|
13980
|
-
kind: literal("widget"),
|
|
13981
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
13982
|
-
id: string(),
|
|
13983
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
13984
|
-
addonId: string(),
|
|
13985
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
13986
|
-
bundle: string(),
|
|
13987
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
13988
|
-
remote: WidgetRemoteSchema,
|
|
13989
|
-
stage: LoginStageEnum
|
|
13990
|
-
}),
|
|
13991
|
-
object({
|
|
13992
|
-
kind: literal("passkey"),
|
|
13993
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
13994
|
-
id: string(),
|
|
13995
|
-
/** Operator-facing button label. */
|
|
13996
|
-
label: string(),
|
|
13997
|
-
stage: LoginStageEnum,
|
|
13998
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
13999
|
-
rpId: string(),
|
|
14000
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
14001
|
-
origin: string().nullable()
|
|
14002
|
-
})
|
|
14003
|
-
]);
|
|
14004
|
-
var loginMethodCapability = {
|
|
14005
|
-
name: "login-method",
|
|
14006
|
-
scope: "system",
|
|
14007
|
-
mode: "collection",
|
|
14008
|
-
internal: true,
|
|
14009
|
-
methods: { getLoginMethods: method(_void(), array(LoginMethodContributionSchema).readonly()) },
|
|
14010
|
-
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
14011
|
-
mount: { kind: "skip" }
|
|
14012
|
-
};
|
|
14013
|
-
/**
|
|
14014
13939
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
14015
13940
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
14016
13941
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -15354,233 +15279,616 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
15354
15279
|
kind: "mutation",
|
|
15355
15280
|
auth: "admin"
|
|
15356
15281
|
});
|
|
15357
|
-
|
|
15358
|
-
|
|
15359
|
-
|
|
15360
|
-
|
|
15361
|
-
|
|
15282
|
+
/**
|
|
15283
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15284
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15285
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
15286
|
+
*
|
|
15287
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15288
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
15289
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15290
|
+
*/
|
|
15291
|
+
var LlmUsageSchema = object({
|
|
15292
|
+
inputTokens: number(),
|
|
15293
|
+
outputTokens: number()
|
|
15294
|
+
});
|
|
15295
|
+
var LlmErrorCodeSchema = _enum([
|
|
15296
|
+
"timeout",
|
|
15297
|
+
"rate-limited",
|
|
15298
|
+
"auth",
|
|
15299
|
+
"refusal",
|
|
15300
|
+
"bad-request",
|
|
15301
|
+
"unavailable",
|
|
15302
|
+
"no-profile",
|
|
15303
|
+
"budget-exceeded",
|
|
15304
|
+
"adapter-error"
|
|
15362
15305
|
]);
|
|
15363
|
-
var
|
|
15364
|
-
|
|
15365
|
-
|
|
15366
|
-
|
|
15306
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15307
|
+
ok: literal(true),
|
|
15308
|
+
text: string(),
|
|
15309
|
+
model: string(),
|
|
15310
|
+
usage: LlmUsageSchema,
|
|
15311
|
+
truncated: boolean(),
|
|
15312
|
+
latencyMs: number()
|
|
15313
|
+
}), object({
|
|
15314
|
+
ok: literal(false),
|
|
15315
|
+
code: LlmErrorCodeSchema,
|
|
15367
15316
|
message: string(),
|
|
15368
|
-
|
|
15369
|
-
|
|
15370
|
-
|
|
15371
|
-
|
|
15372
|
-
|
|
15373
|
-
|
|
15374
|
-
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
}), array(LogEntrySchema).readonly());
|
|
15379
|
-
var CpuBreakdownSchema = object({
|
|
15380
|
-
total: number(),
|
|
15381
|
-
user: number(),
|
|
15382
|
-
system: number(),
|
|
15383
|
-
irq: number(),
|
|
15384
|
-
nice: number(),
|
|
15385
|
-
loadAvg: tuple([
|
|
15386
|
-
number(),
|
|
15387
|
-
number(),
|
|
15388
|
-
number()
|
|
15389
|
-
]),
|
|
15390
|
-
cores: number()
|
|
15391
|
-
});
|
|
15392
|
-
var MemoryInfoSchema = object({
|
|
15393
|
-
percent: number(),
|
|
15394
|
-
totalBytes: number(),
|
|
15395
|
-
usedBytes: number(),
|
|
15396
|
-
availableBytes: number(),
|
|
15397
|
-
swapUsedBytes: number(),
|
|
15398
|
-
swapTotalBytes: number()
|
|
15317
|
+
retryAfterMs: number().optional()
|
|
15318
|
+
})]);
|
|
15319
|
+
/**
|
|
15320
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15321
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15322
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
15323
|
+
*/
|
|
15324
|
+
var LlmImageSchema = object({
|
|
15325
|
+
bytes: _instanceof(Uint8Array),
|
|
15326
|
+
mimeType: string()
|
|
15399
15327
|
});
|
|
15400
|
-
var
|
|
15401
|
-
|
|
15402
|
-
|
|
15403
|
-
|
|
15404
|
-
|
|
15405
|
-
|
|
15406
|
-
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
});
|
|
15416
|
-
var MetricsGpuInfoSchema = object({
|
|
15417
|
-
utilization: number(),
|
|
15418
|
-
model: string(),
|
|
15419
|
-
memoryUsedBytes: number(),
|
|
15420
|
-
memoryTotalBytes: number(),
|
|
15421
|
-
temperature: number().nullable()
|
|
15422
|
-
});
|
|
15423
|
-
var ProcessResourceInfoSchema = object({
|
|
15424
|
-
openFds: number(),
|
|
15425
|
-
threadCount: number(),
|
|
15426
|
-
activeHandles: number(),
|
|
15427
|
-
activeRequests: number()
|
|
15428
|
-
});
|
|
15429
|
-
var PressureAvgsSchema = object({
|
|
15430
|
-
avg10: number(),
|
|
15431
|
-
avg60: number(),
|
|
15432
|
-
avg300: number()
|
|
15433
|
-
});
|
|
15434
|
-
var PressureInfoSchema = object({
|
|
15435
|
-
some: PressureAvgsSchema,
|
|
15436
|
-
full: PressureAvgsSchema.nullable()
|
|
15328
|
+
var LlmGenerateBaseInputSchema = object({
|
|
15329
|
+
/** Collection routing (the notification-output posture). */
|
|
15330
|
+
addonId: string().optional(),
|
|
15331
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15332
|
+
profileId: string().optional(),
|
|
15333
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15334
|
+
consumer: string(),
|
|
15335
|
+
system: string().optional(),
|
|
15336
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15337
|
+
prompt: string(),
|
|
15338
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15339
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
15340
|
+
/** Per-call override of the profile default. */
|
|
15341
|
+
maxTokens: number().int().positive().optional(),
|
|
15342
|
+
temperature: number().optional()
|
|
15437
15343
|
});
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15344
|
+
/**
|
|
15345
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15346
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15347
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15348
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15349
|
+
* this only through the `llm` cap's methods.
|
|
15350
|
+
*
|
|
15351
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15352
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15353
|
+
* watchdog — operator decision #3).
|
|
15354
|
+
*/
|
|
15355
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15356
|
+
object({
|
|
15357
|
+
kind: literal("catalog"),
|
|
15358
|
+
catalogId: string()
|
|
15448
15359
|
}),
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
|
|
15456
|
-
|
|
15457
|
-
|
|
15458
|
-
|
|
15459
|
-
|
|
15460
|
-
|
|
15461
|
-
|
|
15462
|
-
|
|
15463
|
-
|
|
15464
|
-
|
|
15465
|
-
|
|
15466
|
-
|
|
15467
|
-
|
|
15468
|
-
|
|
15469
|
-
|
|
15470
|
-
*/
|
|
15471
|
-
|
|
15472
|
-
/**
|
|
15473
|
-
|
|
15474
|
-
|
|
15475
|
-
|
|
15476
|
-
sharedBytes: number().optional()
|
|
15360
|
+
object({
|
|
15361
|
+
kind: literal("url"),
|
|
15362
|
+
url: string(),
|
|
15363
|
+
sha256: string().optional()
|
|
15364
|
+
}),
|
|
15365
|
+
object({
|
|
15366
|
+
kind: literal("path"),
|
|
15367
|
+
path: string()
|
|
15368
|
+
})
|
|
15369
|
+
]);
|
|
15370
|
+
var ManagedRuntimeConfigSchema = object({
|
|
15371
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
15372
|
+
nodeId: string(),
|
|
15373
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15374
|
+
engine: _enum(["llama-cpp"]),
|
|
15375
|
+
model: ManagedModelRefSchema,
|
|
15376
|
+
contextSize: number().int().default(4096),
|
|
15377
|
+
/** 0 = CPU-only. */
|
|
15378
|
+
gpuLayers: number().int().default(0),
|
|
15379
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15380
|
+
threads: number().int().optional(),
|
|
15381
|
+
/** Concurrent slots. */
|
|
15382
|
+
parallel: number().int().default(1),
|
|
15383
|
+
/** Else lazy: first generate boots it. */
|
|
15384
|
+
autoStart: boolean().default(false),
|
|
15385
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
15386
|
+
idleStopMinutes: number().int().default(30)
|
|
15477
15387
|
});
|
|
15478
|
-
var
|
|
15479
|
-
|
|
15388
|
+
var LlmRuntimeStatusSchema = object({
|
|
15389
|
+
/** Status is ALWAYS node-qualified. */
|
|
15480
15390
|
nodeId: string(),
|
|
15481
|
-
role: _enum(["hub", "worker"]),
|
|
15482
|
-
pid: number(),
|
|
15483
15391
|
state: _enum([
|
|
15484
|
-
"starting",
|
|
15485
|
-
"running",
|
|
15486
|
-
"stopping",
|
|
15487
15392
|
"stopped",
|
|
15488
|
-
"
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
pid: number(),
|
|
15494
|
-
ppid: number(),
|
|
15495
|
-
pgid: number(),
|
|
15496
|
-
classification: _enum([
|
|
15497
|
-
"root",
|
|
15498
|
-
"managed",
|
|
15499
|
-
"system",
|
|
15500
|
-
"ghost"
|
|
15393
|
+
"downloading",
|
|
15394
|
+
"starting",
|
|
15395
|
+
"ready",
|
|
15396
|
+
"crashed",
|
|
15397
|
+
"failed"
|
|
15501
15398
|
]),
|
|
15502
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
15503
|
-
addonId: string().nullable(),
|
|
15504
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15505
|
-
nodeId: string().nullable(),
|
|
15506
|
-
/** Truncated command line. */
|
|
15507
|
-
command: string(),
|
|
15508
|
-
cpuPercent: number(),
|
|
15509
|
-
memoryRssBytes: number(),
|
|
15510
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15511
|
-
uptimeSec: number(),
|
|
15512
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15513
|
-
orphaned: boolean()
|
|
15514
|
-
});
|
|
15515
|
-
var KillProcessInputSchema = object({
|
|
15516
|
-
pid: number(),
|
|
15517
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15518
|
-
force: boolean().optional()
|
|
15519
|
-
});
|
|
15520
|
-
var KillProcessResultSchema = object({
|
|
15521
|
-
success: boolean(),
|
|
15522
|
-
reason: string().optional(),
|
|
15523
|
-
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15524
|
-
});
|
|
15525
|
-
var DumpHeapSnapshotInputSchema = object({
|
|
15526
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
15527
|
-
addonId: string() });
|
|
15528
|
-
var DumpHeapSnapshotResultSchema = object({
|
|
15529
|
-
success: boolean(),
|
|
15530
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15531
|
-
path: string().optional(),
|
|
15532
|
-
/** Process pid that was signalled. */
|
|
15533
15399
|
pid: number().optional(),
|
|
15534
|
-
|
|
15400
|
+
port: number().optional(),
|
|
15401
|
+
modelPath: string().optional(),
|
|
15402
|
+
modelId: string().optional(),
|
|
15403
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
15404
|
+
lastError: string().optional(),
|
|
15405
|
+
crashesInWindow: number(),
|
|
15406
|
+
/** Child RSS (sampled best-effort). */
|
|
15407
|
+
memoryBytes: number().optional(),
|
|
15408
|
+
vramBytes: number().optional()
|
|
15535
15409
|
});
|
|
15536
|
-
var
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
diskPercent: number().optional(),
|
|
15542
|
-
temperature: number().optional(),
|
|
15543
|
-
gpuPercent: number().optional(),
|
|
15544
|
-
gpuMemoryPercent: number().optional()
|
|
15410
|
+
var LlmNodeModelSchema = object({
|
|
15411
|
+
file: string(),
|
|
15412
|
+
sizeBytes: number(),
|
|
15413
|
+
catalogId: string().optional(),
|
|
15414
|
+
installedAt: number().optional()
|
|
15545
15415
|
});
|
|
15546
|
-
|
|
15416
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
15417
|
+
nodeId: string(),
|
|
15418
|
+
modelsBytes: number(),
|
|
15419
|
+
freeBytes: number().optional()
|
|
15420
|
+
});
|
|
15421
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
15422
|
+
images: array(LlmImageSchema).optional(),
|
|
15423
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
15424
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15425
|
+
timeoutMs: number().int().positive().optional()
|
|
15426
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15547
15427
|
kind: "mutation",
|
|
15548
15428
|
auth: "admin"
|
|
15549
|
-
}), method(
|
|
15429
|
+
}), method(object({}), _void(), {
|
|
15550
15430
|
kind: "mutation",
|
|
15551
15431
|
auth: "admin"
|
|
15552
|
-
})
|
|
15553
|
-
method(object({
|
|
15554
|
-
sourceUrl: string(),
|
|
15555
|
-
metadata: ModelConvertMetadataSchema,
|
|
15556
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15557
|
-
calibrationRef: string().optional(),
|
|
15558
|
-
sessionId: string().optional()
|
|
15559
|
-
}), ConvertResultSchema, {
|
|
15432
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15560
15433
|
kind: "mutation",
|
|
15561
|
-
auth: "admin"
|
|
15562
|
-
|
|
15563
|
-
});
|
|
15564
|
-
method(object({
|
|
15565
|
-
nodeId: string(),
|
|
15566
|
-
modelId: string(),
|
|
15567
|
-
format: _enum(MODEL_FORMATS),
|
|
15568
|
-
entry: ModelCatalogEntrySchema
|
|
15569
|
-
}), object({
|
|
15570
|
-
ok: boolean(),
|
|
15571
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15572
|
-
sha256: string(),
|
|
15573
|
-
bytes: number(),
|
|
15574
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15575
|
-
path: string()
|
|
15576
|
-
}), {
|
|
15434
|
+
auth: "admin"
|
|
15435
|
+
}), method(object({ file: string() }), _void(), {
|
|
15577
15436
|
kind: "mutation",
|
|
15578
15437
|
auth: "admin"
|
|
15579
|
-
});
|
|
15438
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15580
15439
|
/**
|
|
15581
|
-
* `
|
|
15582
|
-
*
|
|
15583
|
-
*
|
|
15440
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
15441
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
15442
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
15443
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15444
|
+
* (hub-placed); the cap stays open for future providers.
|
|
15445
|
+
*
|
|
15446
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15447
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15448
|
+
* write; a stored key NEVER round-trips to a client.
|
|
15449
|
+
*/
|
|
15450
|
+
var LlmProfileKindSchema = _enum([
|
|
15451
|
+
"openai-compatible",
|
|
15452
|
+
"openai",
|
|
15453
|
+
"anthropic",
|
|
15454
|
+
"google",
|
|
15455
|
+
"managed-local"
|
|
15456
|
+
]);
|
|
15457
|
+
var LlmProfileSchema = object({
|
|
15458
|
+
id: string(),
|
|
15459
|
+
name: string(),
|
|
15460
|
+
kind: LlmProfileKindSchema,
|
|
15461
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
15462
|
+
addonId: string(),
|
|
15463
|
+
enabled: boolean(),
|
|
15464
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
15465
|
+
model: string(),
|
|
15466
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
15467
|
+
baseUrl: string().optional(),
|
|
15468
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
15469
|
+
apiKey: string().optional(),
|
|
15470
|
+
supportsVision: boolean(),
|
|
15471
|
+
temperature: number().min(0).max(2).optional(),
|
|
15472
|
+
maxTokens: number().int().positive().optional(),
|
|
15473
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
15474
|
+
extraHeaders: record(string(), string()).optional(),
|
|
15475
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
15476
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15477
|
+
});
|
|
15478
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
15479
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
15480
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
15481
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
15482
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
15483
|
+
kind: LlmProfileKindSchema,
|
|
15484
|
+
label: string(),
|
|
15485
|
+
icon: string(),
|
|
15486
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15487
|
+
addonId: string(),
|
|
15488
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
15489
|
+
});
|
|
15490
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
15491
|
+
var LlmDefaultSchema = object({
|
|
15492
|
+
selector: LlmDefaultSelectorSchema,
|
|
15493
|
+
profileId: string()
|
|
15494
|
+
});
|
|
15495
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
15496
|
+
var LlmUsageRollupSchema = object({
|
|
15497
|
+
day: string(),
|
|
15498
|
+
consumer: string(),
|
|
15499
|
+
profileId: string(),
|
|
15500
|
+
calls: number(),
|
|
15501
|
+
okCalls: number(),
|
|
15502
|
+
errorCalls: number(),
|
|
15503
|
+
inputTokens: number(),
|
|
15504
|
+
outputTokens: number(),
|
|
15505
|
+
avgLatencyMs: number()
|
|
15506
|
+
});
|
|
15507
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
15508
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
15509
|
+
id: string(),
|
|
15510
|
+
label: string(),
|
|
15511
|
+
family: string(),
|
|
15512
|
+
purpose: _enum(["text", "vision"]),
|
|
15513
|
+
url: string(),
|
|
15514
|
+
sha256: string(),
|
|
15515
|
+
sizeBytes: number(),
|
|
15516
|
+
quantization: string(),
|
|
15517
|
+
/** Load-time guidance shown in the picker. */
|
|
15518
|
+
minRamBytes: number(),
|
|
15519
|
+
contextSizeDefault: number().int(),
|
|
15520
|
+
/** Vision models: companion projector file. */
|
|
15521
|
+
mmprojUrl: string().optional()
|
|
15522
|
+
});
|
|
15523
|
+
var LlmRuntimeNodeSchema = object({
|
|
15524
|
+
nodeId: string(),
|
|
15525
|
+
reachable: boolean(),
|
|
15526
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
15527
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15528
|
+
error: string().optional()
|
|
15529
|
+
});
|
|
15530
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
15531
|
+
var ProfileRefInputSchema = object({
|
|
15532
|
+
addonId: string(),
|
|
15533
|
+
profileId: string()
|
|
15534
|
+
});
|
|
15535
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
15536
|
+
kind: "mutation",
|
|
15537
|
+
auth: "admin"
|
|
15538
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
15539
|
+
kind: "mutation",
|
|
15540
|
+
auth: "admin"
|
|
15541
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
15542
|
+
kind: "mutation",
|
|
15543
|
+
auth: "admin"
|
|
15544
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
15545
|
+
selector: LlmDefaultSelectorSchema,
|
|
15546
|
+
profileId: string().nullable()
|
|
15547
|
+
}), _void(), {
|
|
15548
|
+
kind: "mutation",
|
|
15549
|
+
auth: "admin"
|
|
15550
|
+
}), method(object({
|
|
15551
|
+
since: number().optional(),
|
|
15552
|
+
until: number().optional(),
|
|
15553
|
+
consumer: string().optional(),
|
|
15554
|
+
profileId: string().optional()
|
|
15555
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
15556
|
+
nodeId: string(),
|
|
15557
|
+
model: ManagedModelRefSchema
|
|
15558
|
+
}), _void(), {
|
|
15559
|
+
kind: "mutation",
|
|
15560
|
+
auth: "admin"
|
|
15561
|
+
}), method(object({
|
|
15562
|
+
nodeId: string(),
|
|
15563
|
+
file: string()
|
|
15564
|
+
}), _void(), {
|
|
15565
|
+
kind: "mutation",
|
|
15566
|
+
auth: "admin"
|
|
15567
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
15568
|
+
kind: "mutation",
|
|
15569
|
+
auth: "admin"
|
|
15570
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
15571
|
+
kind: "mutation",
|
|
15572
|
+
auth: "admin"
|
|
15573
|
+
});
|
|
15574
|
+
var LogLevelSchema = _enum([
|
|
15575
|
+
"debug",
|
|
15576
|
+
"info",
|
|
15577
|
+
"warn",
|
|
15578
|
+
"error"
|
|
15579
|
+
]);
|
|
15580
|
+
var LogEntrySchema = object({
|
|
15581
|
+
timestamp: date(),
|
|
15582
|
+
level: LogLevelSchema,
|
|
15583
|
+
scope: array(string()),
|
|
15584
|
+
message: string(),
|
|
15585
|
+
meta: record(string(), unknown()).optional(),
|
|
15586
|
+
tags: record(string(), string()).optional()
|
|
15587
|
+
});
|
|
15588
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
15589
|
+
scope: array(string()).optional(),
|
|
15590
|
+
level: LogLevelSchema.optional(),
|
|
15591
|
+
since: date().optional(),
|
|
15592
|
+
until: date().optional(),
|
|
15593
|
+
limit: number().optional(),
|
|
15594
|
+
tags: record(string(), string()).optional()
|
|
15595
|
+
}), array(LogEntrySchema).readonly());
|
|
15596
|
+
/**
|
|
15597
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
15598
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
15599
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
15600
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
15601
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
15602
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
15603
|
+
*
|
|
15604
|
+
* A contribution is a discriminated union on `kind`:
|
|
15605
|
+
*
|
|
15606
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
15607
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
15608
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
15609
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
15610
|
+
* login page needs NO change.
|
|
15611
|
+
*
|
|
15612
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
15613
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
15614
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
15615
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
15616
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
15617
|
+
*
|
|
15618
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
15619
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
15620
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
15621
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
15622
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
15623
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
15624
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
15625
|
+
* decision.
|
|
15626
|
+
*
|
|
15627
|
+
* Every contribution carries a `stage`:
|
|
15628
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
15629
|
+
* magic-link buttons; a future usernameless passkey).
|
|
15630
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
15631
|
+
* returned `factors` (passkey-as-2FA today).
|
|
15632
|
+
*
|
|
15633
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
15634
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
15635
|
+
* tRPC router.
|
|
15636
|
+
*/
|
|
15637
|
+
/** When a login method renders in the two-phase login flow. */
|
|
15638
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
15639
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
15640
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
15641
|
+
object({
|
|
15642
|
+
kind: literal("redirect"),
|
|
15643
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
15644
|
+
id: string(),
|
|
15645
|
+
/** Operator-facing button label. */
|
|
15646
|
+
label: string(),
|
|
15647
|
+
/** lucide-react icon name. */
|
|
15648
|
+
icon: string().optional(),
|
|
15649
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
15650
|
+
startUrl: string(),
|
|
15651
|
+
stage: LoginStageEnum
|
|
15652
|
+
}),
|
|
15653
|
+
object({
|
|
15654
|
+
kind: literal("widget"),
|
|
15655
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
15656
|
+
id: string(),
|
|
15657
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
15658
|
+
addonId: string(),
|
|
15659
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
15660
|
+
bundle: string(),
|
|
15661
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
15662
|
+
remote: WidgetRemoteSchema,
|
|
15663
|
+
stage: LoginStageEnum
|
|
15664
|
+
}),
|
|
15665
|
+
object({
|
|
15666
|
+
kind: literal("passkey"),
|
|
15667
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
15668
|
+
id: string(),
|
|
15669
|
+
/** Operator-facing button label. */
|
|
15670
|
+
label: string(),
|
|
15671
|
+
stage: LoginStageEnum,
|
|
15672
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
15673
|
+
rpId: string(),
|
|
15674
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
15675
|
+
origin: string().nullable()
|
|
15676
|
+
})
|
|
15677
|
+
]);
|
|
15678
|
+
var loginMethodCapability = {
|
|
15679
|
+
name: "login-method",
|
|
15680
|
+
scope: "system",
|
|
15681
|
+
mode: "collection",
|
|
15682
|
+
internal: true,
|
|
15683
|
+
methods: { getLoginMethods: method(_void(), array(LoginMethodContributionSchema).readonly()) },
|
|
15684
|
+
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
15685
|
+
mount: { kind: "skip" }
|
|
15686
|
+
};
|
|
15687
|
+
var CpuBreakdownSchema = object({
|
|
15688
|
+
total: number(),
|
|
15689
|
+
user: number(),
|
|
15690
|
+
system: number(),
|
|
15691
|
+
irq: number(),
|
|
15692
|
+
nice: number(),
|
|
15693
|
+
loadAvg: tuple([
|
|
15694
|
+
number(),
|
|
15695
|
+
number(),
|
|
15696
|
+
number()
|
|
15697
|
+
]),
|
|
15698
|
+
cores: number()
|
|
15699
|
+
});
|
|
15700
|
+
var MemoryInfoSchema = object({
|
|
15701
|
+
percent: number(),
|
|
15702
|
+
totalBytes: number(),
|
|
15703
|
+
usedBytes: number(),
|
|
15704
|
+
availableBytes: number(),
|
|
15705
|
+
swapUsedBytes: number(),
|
|
15706
|
+
swapTotalBytes: number()
|
|
15707
|
+
});
|
|
15708
|
+
var DiskIoSnapshotSchema = object({
|
|
15709
|
+
readBytes: number(),
|
|
15710
|
+
writeBytes: number(),
|
|
15711
|
+
readOps: number(),
|
|
15712
|
+
writeOps: number(),
|
|
15713
|
+
timestampMs: number()
|
|
15714
|
+
});
|
|
15715
|
+
var NetworkIoSnapshotSchema = object({
|
|
15716
|
+
rxBytes: number(),
|
|
15717
|
+
txBytes: number(),
|
|
15718
|
+
rxPackets: number(),
|
|
15719
|
+
txPackets: number(),
|
|
15720
|
+
rxErrors: number(),
|
|
15721
|
+
txErrors: number(),
|
|
15722
|
+
timestampMs: number()
|
|
15723
|
+
});
|
|
15724
|
+
var MetricsGpuInfoSchema = object({
|
|
15725
|
+
utilization: number(),
|
|
15726
|
+
model: string(),
|
|
15727
|
+
memoryUsedBytes: number(),
|
|
15728
|
+
memoryTotalBytes: number(),
|
|
15729
|
+
temperature: number().nullable()
|
|
15730
|
+
});
|
|
15731
|
+
var ProcessResourceInfoSchema = object({
|
|
15732
|
+
openFds: number(),
|
|
15733
|
+
threadCount: number(),
|
|
15734
|
+
activeHandles: number(),
|
|
15735
|
+
activeRequests: number()
|
|
15736
|
+
});
|
|
15737
|
+
var PressureAvgsSchema = object({
|
|
15738
|
+
avg10: number(),
|
|
15739
|
+
avg60: number(),
|
|
15740
|
+
avg300: number()
|
|
15741
|
+
});
|
|
15742
|
+
var PressureInfoSchema = object({
|
|
15743
|
+
some: PressureAvgsSchema,
|
|
15744
|
+
full: PressureAvgsSchema.nullable()
|
|
15745
|
+
});
|
|
15746
|
+
var SystemResourceSnapshotSchema = object({
|
|
15747
|
+
cpu: CpuBreakdownSchema,
|
|
15748
|
+
memory: MemoryInfoSchema,
|
|
15749
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15750
|
+
network: NetworkIoSnapshotSchema,
|
|
15751
|
+
disk: DiskIoSnapshotSchema,
|
|
15752
|
+
pressure: object({
|
|
15753
|
+
cpu: PressureInfoSchema.nullable(),
|
|
15754
|
+
memory: PressureInfoSchema.nullable(),
|
|
15755
|
+
io: PressureInfoSchema.nullable()
|
|
15756
|
+
}),
|
|
15757
|
+
process: ProcessResourceInfoSchema,
|
|
15758
|
+
cpuTemperature: number().nullable(),
|
|
15759
|
+
timestampMs: number()
|
|
15760
|
+
});
|
|
15761
|
+
var DiskSpaceInfoSchema = object({
|
|
15762
|
+
path: string(),
|
|
15763
|
+
totalBytes: number(),
|
|
15764
|
+
usedBytes: number(),
|
|
15765
|
+
availableBytes: number(),
|
|
15766
|
+
percent: number()
|
|
15767
|
+
});
|
|
15768
|
+
var PidResourceStatsSchema = object({
|
|
15769
|
+
pid: number(),
|
|
15770
|
+
cpu: number(),
|
|
15771
|
+
memory: number(),
|
|
15772
|
+
/**
|
|
15773
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
15774
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
15775
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
15776
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
15777
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
15778
|
+
*/
|
|
15779
|
+
privateBytes: number().optional(),
|
|
15780
|
+
/**
|
|
15781
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
15782
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
15783
|
+
*/
|
|
15784
|
+
sharedBytes: number().optional()
|
|
15785
|
+
});
|
|
15786
|
+
var AddonInstanceSchema = object({
|
|
15787
|
+
addonId: string(),
|
|
15788
|
+
nodeId: string(),
|
|
15789
|
+
role: _enum(["hub", "worker"]),
|
|
15790
|
+
pid: number(),
|
|
15791
|
+
state: _enum([
|
|
15792
|
+
"starting",
|
|
15793
|
+
"running",
|
|
15794
|
+
"stopping",
|
|
15795
|
+
"stopped",
|
|
15796
|
+
"crashed"
|
|
15797
|
+
]),
|
|
15798
|
+
uptimeSec: number()
|
|
15799
|
+
});
|
|
15800
|
+
var NodeProcessSchema = object({
|
|
15801
|
+
pid: number(),
|
|
15802
|
+
ppid: number(),
|
|
15803
|
+
pgid: number(),
|
|
15804
|
+
classification: _enum([
|
|
15805
|
+
"root",
|
|
15806
|
+
"managed",
|
|
15807
|
+
"system",
|
|
15808
|
+
"ghost"
|
|
15809
|
+
]),
|
|
15810
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
15811
|
+
addonId: string().nullable(),
|
|
15812
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15813
|
+
nodeId: string().nullable(),
|
|
15814
|
+
/** Truncated command line. */
|
|
15815
|
+
command: string(),
|
|
15816
|
+
cpuPercent: number(),
|
|
15817
|
+
memoryRssBytes: number(),
|
|
15818
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15819
|
+
uptimeSec: number(),
|
|
15820
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15821
|
+
orphaned: boolean()
|
|
15822
|
+
});
|
|
15823
|
+
var KillProcessInputSchema = object({
|
|
15824
|
+
pid: number(),
|
|
15825
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15826
|
+
force: boolean().optional()
|
|
15827
|
+
});
|
|
15828
|
+
var KillProcessResultSchema = object({
|
|
15829
|
+
success: boolean(),
|
|
15830
|
+
reason: string().optional(),
|
|
15831
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15832
|
+
});
|
|
15833
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
15834
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
15835
|
+
addonId: string() });
|
|
15836
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
15837
|
+
success: boolean(),
|
|
15838
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15839
|
+
path: string().optional(),
|
|
15840
|
+
/** Process pid that was signalled. */
|
|
15841
|
+
pid: number().optional(),
|
|
15842
|
+
reason: string().optional()
|
|
15843
|
+
});
|
|
15844
|
+
var SystemMetricsSchema = object({
|
|
15845
|
+
cpuPercent: number(),
|
|
15846
|
+
memoryPercent: number(),
|
|
15847
|
+
memoryUsedMB: number(),
|
|
15848
|
+
memoryTotalMB: number(),
|
|
15849
|
+
diskPercent: number().optional(),
|
|
15850
|
+
temperature: number().optional(),
|
|
15851
|
+
gpuPercent: number().optional(),
|
|
15852
|
+
gpuMemoryPercent: number().optional()
|
|
15853
|
+
});
|
|
15854
|
+
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, {
|
|
15855
|
+
kind: "mutation",
|
|
15856
|
+
auth: "admin"
|
|
15857
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
15858
|
+
kind: "mutation",
|
|
15859
|
+
auth: "admin"
|
|
15860
|
+
});
|
|
15861
|
+
method(object({
|
|
15862
|
+
sourceUrl: string(),
|
|
15863
|
+
metadata: ModelConvertMetadataSchema,
|
|
15864
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15865
|
+
calibrationRef: string().optional(),
|
|
15866
|
+
sessionId: string().optional()
|
|
15867
|
+
}), ConvertResultSchema, {
|
|
15868
|
+
kind: "mutation",
|
|
15869
|
+
auth: "admin",
|
|
15870
|
+
timeoutMs: 6e5
|
|
15871
|
+
});
|
|
15872
|
+
method(object({
|
|
15873
|
+
nodeId: string(),
|
|
15874
|
+
modelId: string(),
|
|
15875
|
+
format: _enum(MODEL_FORMATS),
|
|
15876
|
+
entry: ModelCatalogEntrySchema
|
|
15877
|
+
}), object({
|
|
15878
|
+
ok: boolean(),
|
|
15879
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15880
|
+
sha256: string(),
|
|
15881
|
+
bytes: number(),
|
|
15882
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
15883
|
+
path: string()
|
|
15884
|
+
}), {
|
|
15885
|
+
kind: "mutation",
|
|
15886
|
+
auth: "admin"
|
|
15887
|
+
});
|
|
15888
|
+
/**
|
|
15889
|
+
* `mqtt-broker` — broker-registry cap.
|
|
15890
|
+
*
|
|
15891
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15584
15892
|
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15585
15893
|
* and (b) the connection details a consumer addon needs to spin up
|
|
15586
15894
|
* its OWN `mqtt.js` client.
|
|
@@ -15848,14 +16156,14 @@ var TargetKindCapsSchema = object({
|
|
|
15848
16156
|
* the union is large and not meant for runtime validation here; the exported
|
|
15849
16157
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
15850
16158
|
*/
|
|
15851
|
-
var ConfigSchemaPassthrough
|
|
16159
|
+
var ConfigSchemaPassthrough = unknown();
|
|
15852
16160
|
var TargetKindSchema = object({
|
|
15853
16161
|
kind: string(),
|
|
15854
16162
|
label: string(),
|
|
15855
16163
|
icon: string(),
|
|
15856
16164
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15857
16165
|
addonId: string(),
|
|
15858
|
-
configSchema: ConfigSchemaPassthrough
|
|
16166
|
+
configSchema: ConfigSchemaPassthrough,
|
|
15859
16167
|
supportsDiscovery: boolean(),
|
|
15860
16168
|
caps: TargetKindCapsSchema
|
|
15861
16169
|
});
|
|
@@ -15902,303 +16210,499 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
15902
16210
|
notification: NotificationSchema
|
|
15903
16211
|
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
15904
16212
|
targetId: string(),
|
|
15905
|
-
sample: NotificationSchema.optional()
|
|
15906
|
-
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
15907
|
-
targetId: string(),
|
|
15908
|
-
enabled: boolean()
|
|
15909
|
-
}), _void(), { kind: "mutation" });
|
|
15910
|
-
/**
|
|
15911
|
-
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15912
|
-
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15913
|
-
* caps stay wire-compatible without a circular cap→cap import.
|
|
15914
|
-
*
|
|
15915
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15916
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
15917
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15918
|
-
*/
|
|
15919
|
-
var LlmUsageSchema = object({
|
|
15920
|
-
inputTokens: number(),
|
|
15921
|
-
outputTokens: number()
|
|
15922
|
-
});
|
|
15923
|
-
var LlmErrorCodeSchema = _enum([
|
|
15924
|
-
"timeout",
|
|
15925
|
-
"rate-limited",
|
|
15926
|
-
"auth",
|
|
15927
|
-
"refusal",
|
|
15928
|
-
"bad-request",
|
|
15929
|
-
"unavailable",
|
|
15930
|
-
"no-profile",
|
|
15931
|
-
"budget-exceeded",
|
|
15932
|
-
"adapter-error"
|
|
15933
|
-
]);
|
|
15934
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15935
|
-
ok: literal(true),
|
|
15936
|
-
text: string(),
|
|
15937
|
-
model: string(),
|
|
15938
|
-
usage: LlmUsageSchema,
|
|
15939
|
-
truncated: boolean(),
|
|
15940
|
-
latencyMs: number()
|
|
15941
|
-
}), object({
|
|
15942
|
-
ok: literal(false),
|
|
15943
|
-
code: LlmErrorCodeSchema,
|
|
15944
|
-
message: string(),
|
|
15945
|
-
retryAfterMs: number().optional()
|
|
15946
|
-
})]);
|
|
15947
|
-
/**
|
|
15948
|
-
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15949
|
-
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15950
|
-
* notification-output.cap.ts:27-31 precedents).
|
|
15951
|
-
*/
|
|
15952
|
-
var LlmImageSchema = object({
|
|
15953
|
-
bytes: _instanceof(Uint8Array),
|
|
15954
|
-
mimeType: string()
|
|
15955
|
-
});
|
|
15956
|
-
var LlmGenerateBaseInputSchema = object({
|
|
15957
|
-
/** Collection routing (the notification-output posture). */
|
|
15958
|
-
addonId: string().optional(),
|
|
15959
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15960
|
-
profileId: string().optional(),
|
|
15961
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15962
|
-
consumer: string(),
|
|
15963
|
-
system: string().optional(),
|
|
15964
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15965
|
-
prompt: string(),
|
|
15966
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15967
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
15968
|
-
/** Per-call override of the profile default. */
|
|
15969
|
-
maxTokens: number().int().positive().optional(),
|
|
15970
|
-
temperature: number().optional()
|
|
15971
|
-
});
|
|
16213
|
+
sample: NotificationSchema.optional()
|
|
16214
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
16215
|
+
targetId: string(),
|
|
16216
|
+
enabled: boolean()
|
|
16217
|
+
}), _void(), { kind: "mutation" });
|
|
15972
16218
|
/**
|
|
15973
|
-
*
|
|
15974
|
-
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15975
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15976
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15977
|
-
* this only through the `llm` cap's methods.
|
|
16219
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
15978
16220
|
*
|
|
15979
|
-
*
|
|
15980
|
-
*
|
|
15981
|
-
*
|
|
16221
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
16222
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
16223
|
+
*
|
|
16224
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
16225
|
+
* `notification-center` module), hooked on the durable persistence
|
|
16226
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
16227
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
16228
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
16229
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
16230
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
16231
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
16232
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
16233
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
16234
|
+
* target kind's own caps/degrade engine).
|
|
16235
|
+
*
|
|
16236
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
16237
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
16238
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
16239
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
16240
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
16241
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
16242
|
+
* P2+ (see spec §7).
|
|
16243
|
+
*
|
|
16244
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
16245
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
16246
|
+
* schema/interface drift is explicitly not repeated).
|
|
15982
16247
|
*/
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
16248
|
+
/**
|
|
16249
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
16250
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
16251
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
16252
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
16253
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
16254
|
+
* change of a LINKED device, one row per linked camera)
|
|
16255
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
16256
|
+
* delivery / pick-up)
|
|
16257
|
+
*
|
|
16258
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
16259
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
16260
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
16261
|
+
* one trigger.
|
|
16262
|
+
*/
|
|
16263
|
+
var NcDeliverySchema = _enum([
|
|
16264
|
+
"immediate",
|
|
16265
|
+
"track-end",
|
|
16266
|
+
"device-event",
|
|
16267
|
+
"package-event"
|
|
15997
16268
|
]);
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
parallel: number().int().default(1),
|
|
16011
|
-
/** Else lazy: first generate boots it. */
|
|
16012
|
-
autoStart: boolean().default(false),
|
|
16013
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
16014
|
-
idleStopMinutes: number().int().default(30)
|
|
16015
|
-
});
|
|
16016
|
-
var LlmRuntimeStatusSchema = object({
|
|
16017
|
-
/** Status is ALWAYS node-qualified. */
|
|
16018
|
-
nodeId: string(),
|
|
16019
|
-
state: _enum([
|
|
16020
|
-
"stopped",
|
|
16021
|
-
"downloading",
|
|
16022
|
-
"starting",
|
|
16023
|
-
"ready",
|
|
16024
|
-
"crashed",
|
|
16025
|
-
"failed"
|
|
16026
|
-
]),
|
|
16027
|
-
pid: number().optional(),
|
|
16028
|
-
port: number().optional(),
|
|
16029
|
-
modelPath: string().optional(),
|
|
16030
|
-
modelId: string().optional(),
|
|
16031
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
16032
|
-
lastError: string().optional(),
|
|
16033
|
-
crashesInWindow: number(),
|
|
16034
|
-
/** Child RSS (sampled best-effort). */
|
|
16035
|
-
memoryBytes: number().optional(),
|
|
16036
|
-
vramBytes: number().optional()
|
|
16269
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
16270
|
+
var NcScheduleSchema = object({
|
|
16271
|
+
windows: array(object({
|
|
16272
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
16273
|
+
days: array(number().int().min(0).max(6)).min(1),
|
|
16274
|
+
startMinute: number().int().min(0).max(1439),
|
|
16275
|
+
endMinute: number().int().min(0).max(1439)
|
|
16276
|
+
})).min(1),
|
|
16277
|
+
/** IANA timezone; default = hub host timezone. */
|
|
16278
|
+
timezone: string().optional(),
|
|
16279
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
16280
|
+
invert: boolean().optional()
|
|
16037
16281
|
});
|
|
16038
|
-
|
|
16039
|
-
|
|
16040
|
-
|
|
16041
|
-
|
|
16042
|
-
|
|
16282
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
16283
|
+
var NcPlateMatcherSchema = object({
|
|
16284
|
+
values: array(string().min(1)).min(1),
|
|
16285
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
16286
|
+
maxDistance: number().int().min(0).max(3).default(1)
|
|
16043
16287
|
});
|
|
16044
|
-
|
|
16045
|
-
|
|
16046
|
-
|
|
16047
|
-
|
|
16288
|
+
/**
|
|
16289
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
16290
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
16291
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
16292
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
16293
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
16294
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
16295
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
16296
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
16297
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
16298
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
16299
|
+
* (declared SQLite collection, reseeded on boot).
|
|
16300
|
+
*/
|
|
16301
|
+
var NcOccupancyConditionSchema = object({
|
|
16302
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
16303
|
+
zoneId: string().optional(),
|
|
16304
|
+
/** Object class to count; absent = any class. */
|
|
16305
|
+
className: string().optional(),
|
|
16306
|
+
op: _enum([
|
|
16307
|
+
"became-occupied",
|
|
16308
|
+
"became-free",
|
|
16309
|
+
">=",
|
|
16310
|
+
"<="
|
|
16311
|
+
]).default("became-occupied"),
|
|
16312
|
+
count: number().int().min(0).default(1),
|
|
16313
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
16314
|
+
});
|
|
16315
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
16316
|
+
var NcZoneConditionSchema = object({
|
|
16317
|
+
ids: array(string().min(1)).min(1),
|
|
16318
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
16319
|
+
match: _enum(["any", "all"]).default("any")
|
|
16048
16320
|
});
|
|
16049
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
16050
|
-
images: array(LlmImageSchema).optional(),
|
|
16051
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
16052
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
16053
|
-
timeoutMs: number().int().positive().optional()
|
|
16054
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
16055
|
-
kind: "mutation",
|
|
16056
|
-
auth: "admin"
|
|
16057
|
-
}), method(object({}), _void(), {
|
|
16058
|
-
kind: "mutation",
|
|
16059
|
-
auth: "admin"
|
|
16060
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
16061
|
-
kind: "mutation",
|
|
16062
|
-
auth: "admin"
|
|
16063
|
-
}), method(object({ file: string() }), _void(), {
|
|
16064
|
-
kind: "mutation",
|
|
16065
|
-
auth: "admin"
|
|
16066
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
16067
16321
|
/**
|
|
16068
|
-
*
|
|
16069
|
-
*
|
|
16070
|
-
* provider by the `addonId` in the call input (the notification-output
|
|
16071
|
-
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
16072
|
-
* (hub-placed); the cap stays open for future providers.
|
|
16073
|
-
*
|
|
16074
|
-
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
16075
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
16076
|
-
* write; a stored key NEVER round-trips to a client.
|
|
16322
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
16323
|
+
* membership lists are OR within the list (spec §2.3).
|
|
16077
16324
|
*/
|
|
16078
|
-
var
|
|
16079
|
-
|
|
16080
|
-
|
|
16081
|
-
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
|
|
16087
|
-
|
|
16088
|
-
|
|
16089
|
-
/**
|
|
16090
|
-
|
|
16091
|
-
|
|
16092
|
-
|
|
16093
|
-
|
|
16094
|
-
|
|
16095
|
-
|
|
16096
|
-
/**
|
|
16097
|
-
|
|
16098
|
-
|
|
16099
|
-
|
|
16100
|
-
|
|
16101
|
-
|
|
16102
|
-
|
|
16103
|
-
|
|
16104
|
-
|
|
16325
|
+
var NcConditionsSchema = object({
|
|
16326
|
+
/** Device scope — absent = all devices. */
|
|
16327
|
+
devices: array(number()).optional(),
|
|
16328
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
16329
|
+
classes: array(string().min(1)).optional(),
|
|
16330
|
+
/** Veto classes — any overlap fails the rule. */
|
|
16331
|
+
classesExclude: array(string().min(1)).optional(),
|
|
16332
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
16333
|
+
minConfidence: number().min(0).max(1).optional(),
|
|
16334
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
16335
|
+
zones: NcZoneConditionSchema.optional(),
|
|
16336
|
+
/** Veto zones — any hit fails the rule. */
|
|
16337
|
+
zonesExclude: array(string().min(1)).optional(),
|
|
16338
|
+
/**
|
|
16339
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
16340
|
+
* (identity name / plate text / subclass).
|
|
16341
|
+
*/
|
|
16342
|
+
labelEquals: array(string().min(1)).optional(),
|
|
16343
|
+
/**
|
|
16344
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
16345
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
16346
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
16347
|
+
*/
|
|
16348
|
+
identities: array(string().min(1)).optional(),
|
|
16349
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
16350
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
16351
|
+
/**
|
|
16352
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
16353
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
16354
|
+
* identity display name). A record with NO label passes (nothing to
|
|
16355
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
16356
|
+
*/
|
|
16357
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
16358
|
+
/**
|
|
16359
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
16360
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
16361
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
16362
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
16363
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
16364
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
16365
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
16366
|
+
*/
|
|
16367
|
+
minImportance: number().min(0).max(1).optional(),
|
|
16368
|
+
/**
|
|
16369
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
16370
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
16371
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
16372
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
16373
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
16374
|
+
*/
|
|
16375
|
+
minDwellSeconds: number().min(0).optional(),
|
|
16376
|
+
/**
|
|
16377
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
16378
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
16379
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
16380
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
16381
|
+
* tracks carry `sensor`.
|
|
16382
|
+
*/
|
|
16383
|
+
source: _enum([
|
|
16384
|
+
"pipeline",
|
|
16385
|
+
"onboard",
|
|
16386
|
+
"sensor",
|
|
16387
|
+
"any"
|
|
16388
|
+
]).optional(),
|
|
16389
|
+
/**
|
|
16390
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
16391
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
16392
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
16393
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
16394
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
16395
|
+
*
|
|
16396
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
16397
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
16398
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
16399
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
16400
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
16401
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
16402
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
16403
|
+
* one track the higher of the two is used. A track that ended with no
|
|
16404
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
16405
|
+
* closed for it (an un-recognized subject).
|
|
16406
|
+
*/
|
|
16407
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
16408
|
+
/**
|
|
16409
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
16410
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
16411
|
+
* against the token carried on the device-event subject (extracted from the
|
|
16412
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
16413
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
16414
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
16415
|
+
*/
|
|
16416
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
16417
|
+
/**
|
|
16418
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
16419
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
16420
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
16421
|
+
*/
|
|
16422
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
16423
|
+
/**
|
|
16424
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
16425
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
16426
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
16427
|
+
* on the package-event trigger).
|
|
16428
|
+
*/
|
|
16429
|
+
packagePhase: _enum([
|
|
16430
|
+
"delivered",
|
|
16431
|
+
"picked-up",
|
|
16432
|
+
"both"
|
|
16433
|
+
]).optional(),
|
|
16434
|
+
/**
|
|
16435
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
16436
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
16437
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
16438
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
16439
|
+
*/
|
|
16440
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
16441
|
+
/**
|
|
16442
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
16443
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
16444
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
16445
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
16446
|
+
*/
|
|
16447
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
16105
16448
|
});
|
|
16106
|
-
/**
|
|
16107
|
-
|
|
16108
|
-
|
|
16109
|
-
|
|
16110
|
-
|
|
16111
|
-
|
|
16112
|
-
|
|
16113
|
-
|
|
16114
|
-
|
|
16115
|
-
|
|
16116
|
-
configSchema: ConfigSchemaPassthrough
|
|
16449
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
16450
|
+
var NcRuleTargetSchema = object({
|
|
16451
|
+
/** `notification-output` Target id. */
|
|
16452
|
+
targetId: string().min(1),
|
|
16453
|
+
/**
|
|
16454
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
16455
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
16456
|
+
* degrade engine drops what the backend can't render.
|
|
16457
|
+
*/
|
|
16458
|
+
params: record(string(), unknown()).optional()
|
|
16117
16459
|
});
|
|
16118
|
-
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
|
|
16460
|
+
/**
|
|
16461
|
+
* Media attachment policy (P1 still-image subset).
|
|
16462
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
16463
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
16464
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
16465
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
16466
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
16467
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
16468
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
16469
|
+
* name), so the choice never drifts from the record that fired it.
|
|
16470
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
16471
|
+
* - `none` — no attachment.
|
|
16472
|
+
*/
|
|
16473
|
+
var NcMediaPolicySchema = object({ attach: _enum([
|
|
16474
|
+
"best",
|
|
16475
|
+
"best-matching",
|
|
16476
|
+
"keyFrame",
|
|
16477
|
+
"none"
|
|
16478
|
+
]).default("best") });
|
|
16479
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
16480
|
+
var NcThrottleSchema = object({
|
|
16481
|
+
cooldownSec: number().int().min(0).max(86400).default(60),
|
|
16482
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
16483
|
+
scope: _enum(["rule", "rule-device"]).default("rule-device")
|
|
16484
|
+
});
|
|
16485
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
16486
|
+
var NcRuleInputSchema = object({
|
|
16487
|
+
name: string().min(1).max(200),
|
|
16488
|
+
enabled: boolean().default(true),
|
|
16489
|
+
delivery: NcDeliverySchema,
|
|
16490
|
+
conditions: NcConditionsSchema.default({}),
|
|
16491
|
+
schedule: NcScheduleSchema.optional(),
|
|
16492
|
+
targets: array(NcRuleTargetSchema).min(1),
|
|
16493
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
16494
|
+
throttle: NcThrottleSchema.default({
|
|
16495
|
+
cooldownSec: 60,
|
|
16496
|
+
scope: "rule-device"
|
|
16497
|
+
}),
|
|
16498
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
16499
|
+
template: object({
|
|
16500
|
+
title: string().max(500).optional(),
|
|
16501
|
+
body: string().max(2e3).optional()
|
|
16502
|
+
}).optional(),
|
|
16503
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
16504
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16505
|
+
/**
|
|
16506
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
16507
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
16508
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
16509
|
+
*/
|
|
16510
|
+
ownerUserId: string().optional()
|
|
16122
16511
|
});
|
|
16123
|
-
/**
|
|
16124
|
-
|
|
16125
|
-
|
|
16126
|
-
|
|
16127
|
-
|
|
16128
|
-
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16512
|
+
/**
|
|
16513
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
16514
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
16515
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
16516
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
16517
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
16518
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
16519
|
+
* `updateRule` patch.
|
|
16520
|
+
*/
|
|
16521
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
16522
|
+
/** A persisted rule. */
|
|
16523
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
16524
|
+
id: string(),
|
|
16525
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
16526
|
+
createdBy: string(),
|
|
16527
|
+
createdAt: number(),
|
|
16528
|
+
updatedAt: number(),
|
|
16529
|
+
/**
|
|
16530
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
16531
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
16532
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
16533
|
+
*/
|
|
16534
|
+
disabledTargetIds: array(string()).default([])
|
|
16535
|
+
});
|
|
16536
|
+
var NcTestResultSchema = object({
|
|
16537
|
+
recordId: string(),
|
|
16538
|
+
recordKind: _enum([
|
|
16539
|
+
"object-event",
|
|
16540
|
+
"track",
|
|
16541
|
+
"device-event",
|
|
16542
|
+
"package-event"
|
|
16543
|
+
]),
|
|
16544
|
+
deviceId: number(),
|
|
16545
|
+
timestamp: number(),
|
|
16546
|
+
wouldFire: boolean(),
|
|
16547
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
16548
|
+
failedCondition: string().optional(),
|
|
16549
|
+
className: string().optional(),
|
|
16550
|
+
label: string().optional()
|
|
16134
16551
|
});
|
|
16135
|
-
|
|
16136
|
-
|
|
16552
|
+
var NcConditionDescriptorSchema = object({
|
|
16553
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
16137
16554
|
id: string(),
|
|
16555
|
+
group: _enum([
|
|
16556
|
+
"scope",
|
|
16557
|
+
"class",
|
|
16558
|
+
"zones",
|
|
16559
|
+
"quality",
|
|
16560
|
+
"label",
|
|
16561
|
+
"schedule",
|
|
16562
|
+
"device",
|
|
16563
|
+
"package",
|
|
16564
|
+
"occupancy"
|
|
16565
|
+
]),
|
|
16138
16566
|
label: string(),
|
|
16139
|
-
|
|
16140
|
-
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
|
|
16148
|
-
|
|
16149
|
-
|
|
16567
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
16568
|
+
valueType: _enum([
|
|
16569
|
+
"deviceIdList",
|
|
16570
|
+
"stringList",
|
|
16571
|
+
"number01",
|
|
16572
|
+
"number",
|
|
16573
|
+
"sourceSelect",
|
|
16574
|
+
"zoneSelection",
|
|
16575
|
+
"zoneIdList",
|
|
16576
|
+
"schedule",
|
|
16577
|
+
"plateMatcher",
|
|
16578
|
+
"packagePhase",
|
|
16579
|
+
"polygonDraw",
|
|
16580
|
+
"occupancy"
|
|
16581
|
+
]),
|
|
16582
|
+
operator: _enum([
|
|
16583
|
+
"in",
|
|
16584
|
+
"notIn",
|
|
16585
|
+
"anyOf",
|
|
16586
|
+
"allOf",
|
|
16587
|
+
"gte",
|
|
16588
|
+
"fuzzyIn",
|
|
16589
|
+
"withinSchedule"
|
|
16590
|
+
]),
|
|
16591
|
+
/** Which delivery kinds the condition applies to. */
|
|
16592
|
+
appliesTo: array(NcDeliverySchema),
|
|
16593
|
+
phase: string(),
|
|
16594
|
+
description: string().optional()
|
|
16150
16595
|
});
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16155
|
-
|
|
16156
|
-
|
|
16596
|
+
/**
|
|
16597
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
16598
|
+
* durable outbox row's own status (single source of truth):
|
|
16599
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
16600
|
+
* - `sent` — delivered (terminal)
|
|
16601
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
16602
|
+
* backend rejection / a deleted target (terminal; carries
|
|
16603
|
+
* the failure `error`)
|
|
16604
|
+
*
|
|
16605
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
16606
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
16607
|
+
*/
|
|
16608
|
+
var NcHistoryStatusSchema = _enum([
|
|
16609
|
+
"pending",
|
|
16610
|
+
"sent",
|
|
16611
|
+
"dead"
|
|
16612
|
+
]);
|
|
16613
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
16614
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
16615
|
+
"object-event",
|
|
16616
|
+
"track-end",
|
|
16617
|
+
"device-event",
|
|
16618
|
+
"package-event"
|
|
16619
|
+
]);
|
|
16620
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
16621
|
+
var NcHistorySubjectSchema = object({
|
|
16622
|
+
className: string(),
|
|
16623
|
+
label: string().optional(),
|
|
16624
|
+
confidence: number().optional(),
|
|
16625
|
+
zones: array(string()),
|
|
16626
|
+
timestamp: number()
|
|
16627
|
+
});
|
|
16628
|
+
/**
|
|
16629
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
16630
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
16631
|
+
* NO second write path, so history can never drift from delivery state).
|
|
16632
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
16633
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
16634
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
16635
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
16636
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
16637
|
+
* P1 (admin scope only).
|
|
16638
|
+
*/
|
|
16639
|
+
var NcHistoryEntrySchema = object({
|
|
16640
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
16641
|
+
id: string(),
|
|
16642
|
+
ruleId: string(),
|
|
16643
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
16644
|
+
ruleName: string(),
|
|
16645
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
16646
|
+
delivery: NcDeliverySchema,
|
|
16647
|
+
targetId: string(),
|
|
16648
|
+
deviceId: number(),
|
|
16649
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
16650
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
16651
|
+
recordId: string(),
|
|
16652
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
16653
|
+
trackId: string().optional(),
|
|
16654
|
+
status: NcHistoryStatusSchema,
|
|
16655
|
+
/** Delivery attempts made so far. */
|
|
16656
|
+
attempts: number().int(),
|
|
16657
|
+
/** Fire time (outbox enqueue). */
|
|
16658
|
+
createdAt: number(),
|
|
16659
|
+
/** Last transition time (terminal for sent / dead). */
|
|
16660
|
+
updatedAt: number(),
|
|
16661
|
+
/** Failure detail — present on a `dead` row. */
|
|
16662
|
+
error: string().optional(),
|
|
16663
|
+
subject: NcHistorySubjectSchema
|
|
16157
16664
|
});
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
|
|
16665
|
+
/**
|
|
16666
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
16667
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
16668
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
16669
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
16670
|
+
*/
|
|
16671
|
+
var NcHistoryFilterSchema = object({
|
|
16672
|
+
ruleId: string().optional(),
|
|
16673
|
+
deviceId: number().optional(),
|
|
16674
|
+
status: NcHistoryStatusSchema.optional(),
|
|
16675
|
+
since: number().optional(),
|
|
16676
|
+
until: number().optional(),
|
|
16677
|
+
limit: number().int().min(1).max(500).default(100)
|
|
16162
16678
|
});
|
|
16163
|
-
method(
|
|
16164
|
-
kind: "mutation",
|
|
16165
|
-
auth: "admin"
|
|
16166
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
16679
|
+
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 }), {
|
|
16167
16680
|
kind: "mutation",
|
|
16168
|
-
auth: "admin"
|
|
16169
|
-
|
|
16681
|
+
auth: "admin",
|
|
16682
|
+
caller: "required"
|
|
16683
|
+
}), method(object({
|
|
16684
|
+
ruleId: string(),
|
|
16685
|
+
patch: NcRulePatchSchema
|
|
16686
|
+
}), object({ rule: NcRuleSchema }), {
|
|
16170
16687
|
kind: "mutation",
|
|
16171
|
-
auth: "admin"
|
|
16172
|
-
|
|
16173
|
-
|
|
16174
|
-
profileId: string().nullable()
|
|
16175
|
-
}), _void(), {
|
|
16688
|
+
auth: "admin",
|
|
16689
|
+
caller: "required"
|
|
16690
|
+
}), method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
16176
16691
|
kind: "mutation",
|
|
16177
16692
|
auth: "admin"
|
|
16178
16693
|
}), method(object({
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
profileId: string().optional()
|
|
16183
|
-
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16184
|
-
nodeId: string(),
|
|
16185
|
-
model: ManagedModelRefSchema
|
|
16186
|
-
}), _void(), {
|
|
16694
|
+
ruleId: string(),
|
|
16695
|
+
enabled: boolean()
|
|
16696
|
+
}), object({ success: literal(true) }), {
|
|
16187
16697
|
kind: "mutation",
|
|
16188
16698
|
auth: "admin"
|
|
16189
16699
|
}), method(object({
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
}),
|
|
16193
|
-
kind: "mutation",
|
|
16194
|
-
auth: "admin"
|
|
16195
|
-
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16196
|
-
kind: "mutation",
|
|
16197
|
-
auth: "admin"
|
|
16198
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
16700
|
+
rule: NcRuleInputSchema,
|
|
16701
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
16702
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
16199
16703
|
kind: "mutation",
|
|
16200
16704
|
auth: "admin"
|
|
16201
|
-
});
|
|
16705
|
+
}), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
|
|
16202
16706
|
/**
|
|
16203
16707
|
* Zod schemas for persisted record types.
|
|
16204
16708
|
*
|
|
@@ -16884,7 +17388,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16884
17388
|
}), method(object({
|
|
16885
17389
|
eventId: string(),
|
|
16886
17390
|
kind: MediaFileKindEnum.optional()
|
|
16887
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
17391
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
17392
|
+
trackId: string(),
|
|
17393
|
+
kinds: array(MediaFileKindEnum).optional()
|
|
17394
|
+
}), array(MediaFileSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), object({
|
|
16888
17395
|
deviceId: number(),
|
|
16889
17396
|
timestamp: number(),
|
|
16890
17397
|
frameWidth: number(),
|
|
@@ -16905,76 +17412,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16905
17412
|
eventId: string(),
|
|
16906
17413
|
timestamp: number()
|
|
16907
17414
|
});
|
|
16908
|
-
/**
|
|
16909
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
16910
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
16911
|
-
* caps into per-camera event-kind descriptors.
|
|
16912
|
-
*
|
|
16913
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
16914
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
16915
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
16916
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
16917
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
16918
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
16919
|
-
* eventful cap is missing.
|
|
16920
|
-
*/
|
|
16921
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
16922
|
-
var LEGACY_ICON = {
|
|
16923
|
-
motion: "motion",
|
|
16924
|
-
audio: "audio",
|
|
16925
|
-
person: "person",
|
|
16926
|
-
vehicle: "vehicle",
|
|
16927
|
-
animal: "animal",
|
|
16928
|
-
package: "package",
|
|
16929
|
-
door: "door",
|
|
16930
|
-
pir: "pir",
|
|
16931
|
-
smoke: "smoke",
|
|
16932
|
-
water: "water",
|
|
16933
|
-
button: "button",
|
|
16934
|
-
generic: "generic",
|
|
16935
|
-
gas: "smoke",
|
|
16936
|
-
vibration: "generic",
|
|
16937
|
-
tamper: "generic",
|
|
16938
|
-
presence: "person",
|
|
16939
|
-
lock: "generic",
|
|
16940
|
-
siren: "generic",
|
|
16941
|
-
switch: "generic",
|
|
16942
|
-
doorbell: "button"
|
|
16943
|
-
};
|
|
16944
|
-
function legacyIcon(iconId) {
|
|
16945
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
16946
|
-
}
|
|
16947
|
-
/**
|
|
16948
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
16949
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
16950
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
16951
|
-
*/
|
|
16952
|
-
var CAP_TO_KIND = {
|
|
16953
|
-
contact: "contact",
|
|
16954
|
-
motion: "motion-sensor",
|
|
16955
|
-
smoke: "smoke",
|
|
16956
|
-
flood: "flood",
|
|
16957
|
-
gas: "gas",
|
|
16958
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
16959
|
-
vibration: "vibration",
|
|
16960
|
-
tamper: "tamper",
|
|
16961
|
-
presence: "presence",
|
|
16962
|
-
"enum-sensor": "enum-sensor",
|
|
16963
|
-
"event-emitter": "device-event",
|
|
16964
|
-
"lock-control": "lock",
|
|
16965
|
-
switch: "switch",
|
|
16966
|
-
button: "button",
|
|
16967
|
-
doorbell: "doorbell"
|
|
16968
|
-
};
|
|
16969
|
-
function buildDescriptor(capName, kind) {
|
|
16970
|
-
const t = EVENT_TAXONOMY[kind];
|
|
16971
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
16972
|
-
return {
|
|
16973
|
-
...t,
|
|
16974
|
-
icon: legacyIcon(t.iconId)
|
|
16975
|
-
};
|
|
16976
|
-
}
|
|
16977
|
-
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
16978
17415
|
var CameraPipelineConfigSchema = object({
|
|
16979
17416
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
16980
17417
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -17460,6 +17897,76 @@ method(object({
|
|
|
17460
17897
|
auth: "admin"
|
|
17461
17898
|
});
|
|
17462
17899
|
/**
|
|
17900
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
17901
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
17902
|
+
* caps into per-camera event-kind descriptors.
|
|
17903
|
+
*
|
|
17904
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
17905
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
17906
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
17907
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
17908
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
17909
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
17910
|
+
* eventful cap is missing.
|
|
17911
|
+
*/
|
|
17912
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
17913
|
+
var LEGACY_ICON = {
|
|
17914
|
+
motion: "motion",
|
|
17915
|
+
audio: "audio",
|
|
17916
|
+
person: "person",
|
|
17917
|
+
vehicle: "vehicle",
|
|
17918
|
+
animal: "animal",
|
|
17919
|
+
package: "package",
|
|
17920
|
+
door: "door",
|
|
17921
|
+
pir: "pir",
|
|
17922
|
+
smoke: "smoke",
|
|
17923
|
+
water: "water",
|
|
17924
|
+
button: "button",
|
|
17925
|
+
generic: "generic",
|
|
17926
|
+
gas: "smoke",
|
|
17927
|
+
vibration: "generic",
|
|
17928
|
+
tamper: "generic",
|
|
17929
|
+
presence: "person",
|
|
17930
|
+
lock: "generic",
|
|
17931
|
+
siren: "generic",
|
|
17932
|
+
switch: "generic",
|
|
17933
|
+
doorbell: "button"
|
|
17934
|
+
};
|
|
17935
|
+
function legacyIcon(iconId) {
|
|
17936
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
17937
|
+
}
|
|
17938
|
+
/**
|
|
17939
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
17940
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
17941
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
17942
|
+
*/
|
|
17943
|
+
var CAP_TO_KIND = {
|
|
17944
|
+
contact: "contact",
|
|
17945
|
+
motion: "motion-sensor",
|
|
17946
|
+
smoke: "smoke",
|
|
17947
|
+
flood: "flood",
|
|
17948
|
+
gas: "gas",
|
|
17949
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
17950
|
+
vibration: "vibration",
|
|
17951
|
+
tamper: "tamper",
|
|
17952
|
+
presence: "presence",
|
|
17953
|
+
"enum-sensor": "enum-sensor",
|
|
17954
|
+
"event-emitter": "device-event",
|
|
17955
|
+
"lock-control": "lock",
|
|
17956
|
+
switch: "switch",
|
|
17957
|
+
button: "button",
|
|
17958
|
+
doorbell: "doorbell"
|
|
17959
|
+
};
|
|
17960
|
+
function buildDescriptor(capName, kind) {
|
|
17961
|
+
const t = EVENT_TAXONOMY[kind];
|
|
17962
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
17963
|
+
return {
|
|
17964
|
+
...t,
|
|
17965
|
+
icon: legacyIcon(t.iconId)
|
|
17966
|
+
};
|
|
17967
|
+
}
|
|
17968
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
17969
|
+
/**
|
|
17463
17970
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
17464
17971
|
* package lifecycle (runtime-updatable node packages).
|
|
17465
17972
|
*
|
|
@@ -18931,7 +19438,28 @@ var FaceInfoSchema = object({
|
|
|
18931
19438
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
18932
19439
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
18933
19440
|
* back to the inline `base64` face crop. */
|
|
18934
|
-
keyFrameMediaKey: string().optional()
|
|
19441
|
+
keyFrameMediaKey: string().optional(),
|
|
19442
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
19443
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
19444
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
19445
|
+
* faces that were never auto-recognized. */
|
|
19446
|
+
bestMatchScore: number().optional(),
|
|
19447
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
19448
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
19449
|
+
* legacy rows / runners that reported no native measure. */
|
|
19450
|
+
nativeFaceShortSidePx: number().optional(),
|
|
19451
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
19452
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
19453
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
19454
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
19455
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
19456
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
19457
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
19458
|
+
suggestedIdentityId: string().optional(),
|
|
19459
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
19460
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
19461
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
19462
|
+
suggestedMatchScore: number().optional()
|
|
18935
19463
|
});
|
|
18936
19464
|
var FaceFilterEnum = _enum([
|
|
18937
19465
|
"unassigned",
|
|
@@ -20974,36 +21502,6 @@ Object.freeze({
|
|
|
20974
21502
|
addonId: null,
|
|
20975
21503
|
access: "view"
|
|
20976
21504
|
},
|
|
20977
|
-
"advancedNotifier.deleteRule": {
|
|
20978
|
-
capName: "advanced-notifier",
|
|
20979
|
-
capScope: "system",
|
|
20980
|
-
addonId: null,
|
|
20981
|
-
access: "delete"
|
|
20982
|
-
},
|
|
20983
|
-
"advancedNotifier.getHistory": {
|
|
20984
|
-
capName: "advanced-notifier",
|
|
20985
|
-
capScope: "system",
|
|
20986
|
-
addonId: null,
|
|
20987
|
-
access: "view"
|
|
20988
|
-
},
|
|
20989
|
-
"advancedNotifier.getRules": {
|
|
20990
|
-
capName: "advanced-notifier",
|
|
20991
|
-
capScope: "system",
|
|
20992
|
-
addonId: null,
|
|
20993
|
-
access: "view"
|
|
20994
|
-
},
|
|
20995
|
-
"advancedNotifier.testRule": {
|
|
20996
|
-
capName: "advanced-notifier",
|
|
20997
|
-
capScope: "system",
|
|
20998
|
-
addonId: null,
|
|
20999
|
-
access: "create"
|
|
21000
|
-
},
|
|
21001
|
-
"advancedNotifier.upsertRule": {
|
|
21002
|
-
capName: "advanced-notifier",
|
|
21003
|
-
capScope: "system",
|
|
21004
|
-
addonId: null,
|
|
21005
|
-
access: "create"
|
|
21006
|
-
},
|
|
21007
21505
|
"alarmPanel.arm": {
|
|
21008
21506
|
capName: "alarm-panel",
|
|
21009
21507
|
capScope: "device",
|
|
@@ -23308,6 +23806,60 @@ Object.freeze({
|
|
|
23308
23806
|
addonId: null,
|
|
23309
23807
|
access: "create"
|
|
23310
23808
|
},
|
|
23809
|
+
"notificationRules.createRule": {
|
|
23810
|
+
capName: "notification-rules",
|
|
23811
|
+
capScope: "system",
|
|
23812
|
+
addonId: null,
|
|
23813
|
+
access: "create"
|
|
23814
|
+
},
|
|
23815
|
+
"notificationRules.deleteRule": {
|
|
23816
|
+
capName: "notification-rules",
|
|
23817
|
+
capScope: "system",
|
|
23818
|
+
addonId: null,
|
|
23819
|
+
access: "delete"
|
|
23820
|
+
},
|
|
23821
|
+
"notificationRules.getConditionCatalog": {
|
|
23822
|
+
capName: "notification-rules",
|
|
23823
|
+
capScope: "system",
|
|
23824
|
+
addonId: null,
|
|
23825
|
+
access: "view"
|
|
23826
|
+
},
|
|
23827
|
+
"notificationRules.getHistory": {
|
|
23828
|
+
capName: "notification-rules",
|
|
23829
|
+
capScope: "system",
|
|
23830
|
+
addonId: null,
|
|
23831
|
+
access: "view"
|
|
23832
|
+
},
|
|
23833
|
+
"notificationRules.getRule": {
|
|
23834
|
+
capName: "notification-rules",
|
|
23835
|
+
capScope: "system",
|
|
23836
|
+
addonId: null,
|
|
23837
|
+
access: "view"
|
|
23838
|
+
},
|
|
23839
|
+
"notificationRules.listRules": {
|
|
23840
|
+
capName: "notification-rules",
|
|
23841
|
+
capScope: "system",
|
|
23842
|
+
addonId: null,
|
|
23843
|
+
access: "view"
|
|
23844
|
+
},
|
|
23845
|
+
"notificationRules.setRuleEnabled": {
|
|
23846
|
+
capName: "notification-rules",
|
|
23847
|
+
capScope: "system",
|
|
23848
|
+
addonId: null,
|
|
23849
|
+
access: "create"
|
|
23850
|
+
},
|
|
23851
|
+
"notificationRules.testRule": {
|
|
23852
|
+
capName: "notification-rules",
|
|
23853
|
+
capScope: "system",
|
|
23854
|
+
addonId: null,
|
|
23855
|
+
access: "create"
|
|
23856
|
+
},
|
|
23857
|
+
"notificationRules.updateRule": {
|
|
23858
|
+
capName: "notification-rules",
|
|
23859
|
+
capScope: "system",
|
|
23860
|
+
addonId: null,
|
|
23861
|
+
access: "create"
|
|
23862
|
+
},
|
|
23311
23863
|
"notifier.cancel": {
|
|
23312
23864
|
capName: "notifier",
|
|
23313
23865
|
capScope: "device",
|