@camstack/addon-post-analysis 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{dist-BW-IoQDL.js → dist-Bezh0l-m.js} +1905 -1457
- package/dist/{dist-D5fcvkof.mjs → dist-Dm1I_IVp.mjs} +1388 -988
- package/dist/embedding-encoder/index.js +1 -1
- package/dist/embedding-encoder/index.mjs +1 -1
- package/dist/{node-AdCpDGpz.js → node-DsYWuKgE.js} +1 -1
- package/dist/pipeline-analytics/_stub.js +1 -1
- package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-6_8G5GUI.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-DX9SlV1u.mjs} +2 -2
- package/dist/pipeline-analytics/{_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CDgDsFf_.mjs → _virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CbYZbG3H.mjs} +1 -1
- package/dist/pipeline-analytics/{hostInit-DAKHmSht.mjs → hostInit-DQ6-5P8q.mjs} +2 -2
- package/dist/pipeline-analytics/index.js +2475 -712
- package/dist/pipeline-analytics/index.mjs +2473 -712
- package/dist/pipeline-analytics/remoteEntry.js +1 -1
- package/package.json +1 -1
|
@@ -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";
|
|
@@ -8280,6 +8277,61 @@ function subKindsOf(macro) {
|
|
|
8280
8277
|
return out;
|
|
8281
8278
|
}
|
|
8282
8279
|
/**
|
|
8280
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
8281
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
8282
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
8283
|
+
* taxonomy surface (timeline, filters, event page).
|
|
8284
|
+
*
|
|
8285
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
8286
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
8287
|
+
* for the `classes` / `classesExclude` conditions.
|
|
8288
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
8289
|
+
* the same class picker, grouped under an Audio header.
|
|
8290
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
8291
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
8292
|
+
*
|
|
8293
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
8294
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
8295
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
8296
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
8297
|
+
*/
|
|
8298
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
8299
|
+
var NcTaxonomyEntrySchema = object({
|
|
8300
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
8301
|
+
kind: string(),
|
|
8302
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
8303
|
+
label: string(),
|
|
8304
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
8305
|
+
parentKind: string().nullable()
|
|
8306
|
+
});
|
|
8307
|
+
/** The complete NC picker taxonomy — three grouped buckets. */
|
|
8308
|
+
var NcTaxonomySchema = object({
|
|
8309
|
+
videoClasses: array(NcTaxonomyEntrySchema),
|
|
8310
|
+
audioKinds: array(NcTaxonomyEntrySchema),
|
|
8311
|
+
labels: array(NcTaxonomyEntrySchema)
|
|
8312
|
+
});
|
|
8313
|
+
function toEntry(kind, label, parentKind) {
|
|
8314
|
+
return {
|
|
8315
|
+
kind,
|
|
8316
|
+
label,
|
|
8317
|
+
parentKind
|
|
8318
|
+
};
|
|
8319
|
+
}
|
|
8320
|
+
/**
|
|
8321
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
8322
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
8323
|
+
*/
|
|
8324
|
+
function buildNcTaxonomy() {
|
|
8325
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
8326
|
+
return {
|
|
8327
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8328
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
8329
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
8330
|
+
};
|
|
8331
|
+
}
|
|
8332
|
+
/** The frozen NC taxonomy, derived once from the taxonomy dictionary. */
|
|
8333
|
+
var NC_TAXONOMY = Object.freeze(buildNcTaxonomy());
|
|
8334
|
+
/**
|
|
8283
8335
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
8284
8336
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
8285
8337
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -13721,94 +13773,6 @@ var EnrichedWidgetMetadataSchema = WidgetMetadataSchema.extend({
|
|
|
13721
13773
|
bundleUrl: string()
|
|
13722
13774
|
});
|
|
13723
13775
|
method(_void(), array(EnrichedWidgetMetadataSchema).readonly());
|
|
13724
|
-
var NotificationRuleConditionsSchema = object({
|
|
13725
|
-
deviceIds: array(number()).readonly().optional(),
|
|
13726
|
-
classNames: array(string()).readonly().optional(),
|
|
13727
|
-
zoneIds: array(string()).readonly().optional(),
|
|
13728
|
-
minConfidence: number().optional(),
|
|
13729
|
-
source: _enum([
|
|
13730
|
-
"pipeline",
|
|
13731
|
-
"onboard",
|
|
13732
|
-
"any"
|
|
13733
|
-
]).optional(),
|
|
13734
|
-
schedule: object({
|
|
13735
|
-
days: array(number()).readonly(),
|
|
13736
|
-
startHour: number(),
|
|
13737
|
-
endHour: number()
|
|
13738
|
-
}).optional(),
|
|
13739
|
-
cooldownSeconds: number().optional(),
|
|
13740
|
-
minDwellSeconds: number().optional(),
|
|
13741
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
13742
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
13743
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
13744
|
-
eventTypeTokens: array(string()).readonly().optional(),
|
|
13745
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
13746
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
13747
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
13748
|
-
clipDescription: object({
|
|
13749
|
-
text: string().min(1),
|
|
13750
|
-
minSimilarity: number().min(0).max(1)
|
|
13751
|
-
}).optional(),
|
|
13752
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
13753
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
13754
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
13755
|
-
* vehicle/person> is seen". */
|
|
13756
|
-
labels: array(string()).readonly().optional()
|
|
13757
|
-
});
|
|
13758
|
-
var NotificationRuleTemplateSchema = object({
|
|
13759
|
-
title: string(),
|
|
13760
|
-
body: string(),
|
|
13761
|
-
imageMode: _enum([
|
|
13762
|
-
"crop",
|
|
13763
|
-
"annotated",
|
|
13764
|
-
"full",
|
|
13765
|
-
"none"
|
|
13766
|
-
])
|
|
13767
|
-
});
|
|
13768
|
-
var NotificationRuleSchema = object({
|
|
13769
|
-
id: string(),
|
|
13770
|
-
name: string(),
|
|
13771
|
-
enabled: boolean(),
|
|
13772
|
-
eventTypes: array(string()).readonly(),
|
|
13773
|
-
conditions: NotificationRuleConditionsSchema,
|
|
13774
|
-
outputs: array(string()).readonly(),
|
|
13775
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
13776
|
-
priority: _enum([
|
|
13777
|
-
"low",
|
|
13778
|
-
"normal",
|
|
13779
|
-
"high",
|
|
13780
|
-
"critical"
|
|
13781
|
-
])
|
|
13782
|
-
});
|
|
13783
|
-
var NotificationTestResultSchema = object({
|
|
13784
|
-
ruleId: string(),
|
|
13785
|
-
eventId: string(),
|
|
13786
|
-
timestamp: number(),
|
|
13787
|
-
wouldFire: boolean(),
|
|
13788
|
-
reason: string().optional()
|
|
13789
|
-
});
|
|
13790
|
-
var NotificationHistoryEntrySchema = object({
|
|
13791
|
-
id: string(),
|
|
13792
|
-
ruleId: string(),
|
|
13793
|
-
ruleName: string(),
|
|
13794
|
-
eventId: string(),
|
|
13795
|
-
timestamp: number(),
|
|
13796
|
-
outputs: array(string()).readonly(),
|
|
13797
|
-
success: boolean(),
|
|
13798
|
-
error: string().optional(),
|
|
13799
|
-
deviceId: number().optional()
|
|
13800
|
-
});
|
|
13801
|
-
var NotificationHistoryFilterSchema = object({
|
|
13802
|
-
ruleId: string().optional(),
|
|
13803
|
-
deviceId: number().optional(),
|
|
13804
|
-
from: number().optional(),
|
|
13805
|
-
to: number().optional(),
|
|
13806
|
-
limit: number().optional()
|
|
13807
|
-
});
|
|
13808
|
-
method(_void(), object({ rules: array(NotificationRuleSchema).readonly() })), method(object({ rule: NotificationRuleSchema }), object({ success: literal(true) }), { kind: "mutation" }), method(object({ ruleId: string() }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
|
|
13809
|
-
ruleId: string(),
|
|
13810
|
-
lookbackMinutes: number()
|
|
13811
|
-
}), object({ results: array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(object({ filter: NotificationHistoryFilterSchema.optional() }), object({ entries: array(NotificationHistoryEntrySchema).readonly() }));
|
|
13812
13776
|
/**
|
|
13813
13777
|
* Alerts capability — collection-based internal alert system.
|
|
13814
13778
|
*
|
|
@@ -13995,89 +13959,6 @@ method(object({
|
|
|
13995
13959
|
password: string()
|
|
13996
13960
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
13997
13961
|
/**
|
|
13998
|
-
* `login-method` — collection cap through which auth addons contribute
|
|
13999
|
-
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
14000
|
-
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
14001
|
-
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
14002
|
-
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
14003
|
-
* procedure aggregates them for the unauthenticated login page.
|
|
14004
|
-
*
|
|
14005
|
-
* A contribution is a discriminated union on `kind`:
|
|
14006
|
-
*
|
|
14007
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
14008
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
14009
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
14010
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
14011
|
-
* login page needs NO change.
|
|
14012
|
-
*
|
|
14013
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
14014
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
14015
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
14016
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
14017
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
14018
|
-
*
|
|
14019
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
14020
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
14021
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
14022
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
14023
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
14024
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
14025
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
14026
|
-
* decision.
|
|
14027
|
-
*
|
|
14028
|
-
* Every contribution carries a `stage`:
|
|
14029
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
14030
|
-
* magic-link buttons; a future usernameless passkey).
|
|
14031
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
14032
|
-
* returned `factors` (passkey-as-2FA today).
|
|
14033
|
-
*
|
|
14034
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
14035
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
14036
|
-
* tRPC router.
|
|
14037
|
-
*/
|
|
14038
|
-
/** When a login method renders in the two-phase login flow. */
|
|
14039
|
-
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
14040
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
14041
|
-
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
14042
|
-
object({
|
|
14043
|
-
kind: literal("redirect"),
|
|
14044
|
-
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
14045
|
-
id: string(),
|
|
14046
|
-
/** Operator-facing button label. */
|
|
14047
|
-
label: string(),
|
|
14048
|
-
/** lucide-react icon name. */
|
|
14049
|
-
icon: string().optional(),
|
|
14050
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
14051
|
-
startUrl: string(),
|
|
14052
|
-
stage: LoginStageEnum
|
|
14053
|
-
}),
|
|
14054
|
-
object({
|
|
14055
|
-
kind: literal("widget"),
|
|
14056
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
14057
|
-
id: string(),
|
|
14058
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
14059
|
-
addonId: string(),
|
|
14060
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
14061
|
-
bundle: string(),
|
|
14062
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
14063
|
-
remote: WidgetRemoteSchema,
|
|
14064
|
-
stage: LoginStageEnum
|
|
14065
|
-
}),
|
|
14066
|
-
object({
|
|
14067
|
-
kind: literal("passkey"),
|
|
14068
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
14069
|
-
id: string(),
|
|
14070
|
-
/** Operator-facing button label. */
|
|
14071
|
-
label: string(),
|
|
14072
|
-
stage: LoginStageEnum,
|
|
14073
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
14074
|
-
rpId: string(),
|
|
14075
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
14076
|
-
origin: string().nullable()
|
|
14077
|
-
})
|
|
14078
|
-
]);
|
|
14079
|
-
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
14080
|
-
/**
|
|
14081
13962
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
14082
13963
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
14083
13964
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -14434,6 +14315,28 @@ method(ListInputSchema, array(BrokerInfoSchema$1)), method(GetInputSchema, Broke
|
|
|
14434
14315
|
}), method(GetStateInputSchema, unknown().nullable()), method(_void(), RegistryStatusSchema);
|
|
14435
14316
|
DeviceType.Camera;
|
|
14436
14317
|
/**
|
|
14318
|
+
* Identity — preserves literal types for downstream inference.
|
|
14319
|
+
*
|
|
14320
|
+
* The constraint is `Record<string, unknown>` (not `CustomActionsSpec`) so
|
|
14321
|
+
* TypeScript does not widen each entry's literal `kind`/`auth` fields to
|
|
14322
|
+
* the broader unions declared on `CustomActionSpec`'s default generics.
|
|
14323
|
+
* Shape validity is enforced separately by the `customAction(...)` helper
|
|
14324
|
+
* whose return type is already a `CustomActionSpec<...>`.
|
|
14325
|
+
*/
|
|
14326
|
+
function defineCustomActions(spec) {
|
|
14327
|
+
return spec;
|
|
14328
|
+
}
|
|
14329
|
+
function customAction(input, output, options) {
|
|
14330
|
+
return {
|
|
14331
|
+
input,
|
|
14332
|
+
output,
|
|
14333
|
+
kind: options?.kind ?? "query",
|
|
14334
|
+
auth: options?.auth ?? "protected",
|
|
14335
|
+
scope: options?.scope ?? { kind: "system" },
|
|
14336
|
+
...options?.caller ? { caller: "required" } : {}
|
|
14337
|
+
};
|
|
14338
|
+
}
|
|
14339
|
+
/**
|
|
14437
14340
|
* `custom-model-registry` — collection cap exposing operator-registered
|
|
14438
14341
|
* custom detection models. Each provider (today: `addon-model-studio`)
|
|
14439
14342
|
* contributes a list of `CustomModelDescriptor`s; the hub auto-concatenates
|
|
@@ -15431,376 +15334,751 @@ method(_void(), array(string()).readonly(), { auth: "admin" }), method(object({
|
|
|
15431
15334
|
kind: "mutation",
|
|
15432
15335
|
auth: "admin"
|
|
15433
15336
|
});
|
|
15434
|
-
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
|
|
15438
|
-
|
|
15337
|
+
/**
|
|
15338
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
15339
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
15340
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
15341
|
+
*
|
|
15342
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
15343
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
15344
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
15345
|
+
*/
|
|
15346
|
+
var LlmUsageSchema = object({
|
|
15347
|
+
inputTokens: number(),
|
|
15348
|
+
outputTokens: number()
|
|
15349
|
+
});
|
|
15350
|
+
var LlmErrorCodeSchema = _enum([
|
|
15351
|
+
"timeout",
|
|
15352
|
+
"rate-limited",
|
|
15353
|
+
"auth",
|
|
15354
|
+
"refusal",
|
|
15355
|
+
"bad-request",
|
|
15356
|
+
"unavailable",
|
|
15357
|
+
"no-profile",
|
|
15358
|
+
"budget-exceeded",
|
|
15359
|
+
"adapter-error"
|
|
15439
15360
|
]);
|
|
15440
|
-
var
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15361
|
+
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
15362
|
+
ok: literal(true),
|
|
15363
|
+
text: string(),
|
|
15364
|
+
model: string(),
|
|
15365
|
+
usage: LlmUsageSchema,
|
|
15366
|
+
truncated: boolean(),
|
|
15367
|
+
latencyMs: number()
|
|
15368
|
+
}), object({
|
|
15369
|
+
ok: literal(false),
|
|
15370
|
+
code: LlmErrorCodeSchema,
|
|
15444
15371
|
message: string(),
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
}), array(LogEntrySchema).readonly());
|
|
15456
|
-
var CpuBreakdownSchema = object({
|
|
15457
|
-
total: number(),
|
|
15458
|
-
user: number(),
|
|
15459
|
-
system: number(),
|
|
15460
|
-
irq: number(),
|
|
15461
|
-
nice: number(),
|
|
15462
|
-
loadAvg: tuple([
|
|
15463
|
-
number(),
|
|
15464
|
-
number(),
|
|
15465
|
-
number()
|
|
15466
|
-
]),
|
|
15467
|
-
cores: number()
|
|
15468
|
-
});
|
|
15469
|
-
var MemoryInfoSchema = object({
|
|
15470
|
-
percent: number(),
|
|
15471
|
-
totalBytes: number(),
|
|
15472
|
-
usedBytes: number(),
|
|
15473
|
-
availableBytes: number(),
|
|
15474
|
-
swapUsedBytes: number(),
|
|
15475
|
-
swapTotalBytes: number()
|
|
15372
|
+
retryAfterMs: number().optional()
|
|
15373
|
+
})]);
|
|
15374
|
+
/**
|
|
15375
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
15376
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
15377
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
15378
|
+
*/
|
|
15379
|
+
var LlmImageSchema = object({
|
|
15380
|
+
bytes: _instanceof(Uint8Array),
|
|
15381
|
+
mimeType: string()
|
|
15476
15382
|
});
|
|
15477
|
-
var
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
|
|
15481
|
-
|
|
15482
|
-
|
|
15383
|
+
var LlmGenerateBaseInputSchema = object({
|
|
15384
|
+
/** Collection routing (the notification-output posture). */
|
|
15385
|
+
addonId: string().optional(),
|
|
15386
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
15387
|
+
profileId: string().optional(),
|
|
15388
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
15389
|
+
consumer: string(),
|
|
15390
|
+
system: string().optional(),
|
|
15391
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
15392
|
+
prompt: string(),
|
|
15393
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
15394
|
+
jsonSchema: record(string(), unknown()).optional(),
|
|
15395
|
+
/** Per-call override of the profile default. */
|
|
15396
|
+
maxTokens: number().int().positive().optional(),
|
|
15397
|
+
temperature: number().optional()
|
|
15483
15398
|
});
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
|
|
15495
|
-
|
|
15496
|
-
|
|
15497
|
-
|
|
15498
|
-
|
|
15499
|
-
});
|
|
15500
|
-
var ProcessResourceInfoSchema = object({
|
|
15501
|
-
openFds: number(),
|
|
15502
|
-
threadCount: number(),
|
|
15503
|
-
activeHandles: number(),
|
|
15504
|
-
activeRequests: number()
|
|
15505
|
-
});
|
|
15506
|
-
var PressureAvgsSchema = object({
|
|
15507
|
-
avg10: number(),
|
|
15508
|
-
avg60: number(),
|
|
15509
|
-
avg300: number()
|
|
15510
|
-
});
|
|
15511
|
-
var PressureInfoSchema = object({
|
|
15512
|
-
some: PressureAvgsSchema,
|
|
15513
|
-
full: PressureAvgsSchema.nullable()
|
|
15514
|
-
});
|
|
15515
|
-
var SystemResourceSnapshotSchema = object({
|
|
15516
|
-
cpu: CpuBreakdownSchema,
|
|
15517
|
-
memory: MemoryInfoSchema,
|
|
15518
|
-
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15519
|
-
network: NetworkIoSnapshotSchema,
|
|
15520
|
-
disk: DiskIoSnapshotSchema,
|
|
15521
|
-
pressure: object({
|
|
15522
|
-
cpu: PressureInfoSchema.nullable(),
|
|
15523
|
-
memory: PressureInfoSchema.nullable(),
|
|
15524
|
-
io: PressureInfoSchema.nullable()
|
|
15399
|
+
/**
|
|
15400
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
15401
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
15402
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
15403
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
15404
|
+
* this only through the `llm` cap's methods.
|
|
15405
|
+
*
|
|
15406
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
15407
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
15408
|
+
* watchdog — operator decision #3).
|
|
15409
|
+
*/
|
|
15410
|
+
var ManagedModelRefSchema = discriminatedUnion("kind", [
|
|
15411
|
+
object({
|
|
15412
|
+
kind: literal("catalog"),
|
|
15413
|
+
catalogId: string()
|
|
15525
15414
|
}),
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
*/
|
|
15548
|
-
|
|
15549
|
-
/**
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
sharedBytes: number().optional()
|
|
15415
|
+
object({
|
|
15416
|
+
kind: literal("url"),
|
|
15417
|
+
url: string(),
|
|
15418
|
+
sha256: string().optional()
|
|
15419
|
+
}),
|
|
15420
|
+
object({
|
|
15421
|
+
kind: literal("path"),
|
|
15422
|
+
path: string()
|
|
15423
|
+
})
|
|
15424
|
+
]);
|
|
15425
|
+
var ManagedRuntimeConfigSchema = object({
|
|
15426
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
15427
|
+
nodeId: string(),
|
|
15428
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15429
|
+
engine: _enum(["llama-cpp"]),
|
|
15430
|
+
model: ManagedModelRefSchema,
|
|
15431
|
+
contextSize: number().int().default(4096),
|
|
15432
|
+
/** 0 = CPU-only. */
|
|
15433
|
+
gpuLayers: number().int().default(0),
|
|
15434
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15435
|
+
threads: number().int().optional(),
|
|
15436
|
+
/** Concurrent slots. */
|
|
15437
|
+
parallel: number().int().default(1),
|
|
15438
|
+
/** Else lazy: first generate boots it. */
|
|
15439
|
+
autoStart: boolean().default(false),
|
|
15440
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
15441
|
+
idleStopMinutes: number().int().default(30)
|
|
15554
15442
|
});
|
|
15555
|
-
var
|
|
15556
|
-
|
|
15443
|
+
var LlmRuntimeStatusSchema = object({
|
|
15444
|
+
/** Status is ALWAYS node-qualified. */
|
|
15557
15445
|
nodeId: string(),
|
|
15558
|
-
role: _enum(["hub", "worker"]),
|
|
15559
|
-
pid: number(),
|
|
15560
15446
|
state: _enum([
|
|
15561
|
-
"starting",
|
|
15562
|
-
"running",
|
|
15563
|
-
"stopping",
|
|
15564
15447
|
"stopped",
|
|
15565
|
-
"
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
pid: number(),
|
|
15571
|
-
ppid: number(),
|
|
15572
|
-
pgid: number(),
|
|
15573
|
-
classification: _enum([
|
|
15574
|
-
"root",
|
|
15575
|
-
"managed",
|
|
15576
|
-
"system",
|
|
15577
|
-
"ghost"
|
|
15448
|
+
"downloading",
|
|
15449
|
+
"starting",
|
|
15450
|
+
"ready",
|
|
15451
|
+
"crashed",
|
|
15452
|
+
"failed"
|
|
15578
15453
|
]),
|
|
15579
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
15580
|
-
addonId: string().nullable(),
|
|
15581
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15582
|
-
nodeId: string().nullable(),
|
|
15583
|
-
/** Truncated command line. */
|
|
15584
|
-
command: string(),
|
|
15585
|
-
cpuPercent: number(),
|
|
15586
|
-
memoryRssBytes: number(),
|
|
15587
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15588
|
-
uptimeSec: number(),
|
|
15589
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15590
|
-
orphaned: boolean()
|
|
15591
|
-
});
|
|
15592
|
-
var KillProcessInputSchema = object({
|
|
15593
|
-
pid: number(),
|
|
15594
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15595
|
-
force: boolean().optional()
|
|
15596
|
-
});
|
|
15597
|
-
var KillProcessResultSchema = object({
|
|
15598
|
-
success: boolean(),
|
|
15599
|
-
reason: string().optional(),
|
|
15600
|
-
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15601
|
-
});
|
|
15602
|
-
var DumpHeapSnapshotInputSchema = object({
|
|
15603
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
15604
|
-
addonId: string() });
|
|
15605
|
-
var DumpHeapSnapshotResultSchema = object({
|
|
15606
|
-
success: boolean(),
|
|
15607
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15608
|
-
path: string().optional(),
|
|
15609
|
-
/** Process pid that was signalled. */
|
|
15610
15454
|
pid: number().optional(),
|
|
15611
|
-
|
|
15455
|
+
port: number().optional(),
|
|
15456
|
+
modelPath: string().optional(),
|
|
15457
|
+
modelId: string().optional(),
|
|
15458
|
+
downloadProgress: number().min(0).max(1).optional(),
|
|
15459
|
+
lastError: string().optional(),
|
|
15460
|
+
crashesInWindow: number(),
|
|
15461
|
+
/** Child RSS (sampled best-effort). */
|
|
15462
|
+
memoryBytes: number().optional(),
|
|
15463
|
+
vramBytes: number().optional()
|
|
15612
15464
|
});
|
|
15613
|
-
var
|
|
15614
|
-
|
|
15615
|
-
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
diskPercent: number().optional(),
|
|
15619
|
-
temperature: number().optional(),
|
|
15620
|
-
gpuPercent: number().optional(),
|
|
15621
|
-
gpuMemoryPercent: number().optional()
|
|
15465
|
+
var LlmNodeModelSchema = object({
|
|
15466
|
+
file: string(),
|
|
15467
|
+
sizeBytes: number(),
|
|
15468
|
+
catalogId: string().optional(),
|
|
15469
|
+
installedAt: number().optional()
|
|
15622
15470
|
});
|
|
15623
|
-
|
|
15471
|
+
var LlmRuntimeDiskUsageSchema = object({
|
|
15472
|
+
nodeId: string(),
|
|
15473
|
+
modelsBytes: number(),
|
|
15474
|
+
freeBytes: number().optional()
|
|
15475
|
+
});
|
|
15476
|
+
method(LlmGenerateBaseInputSchema.extend({
|
|
15477
|
+
images: array(LlmImageSchema).optional(),
|
|
15478
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
15479
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15480
|
+
timeoutMs: number().int().positive().optional()
|
|
15481
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15624
15482
|
kind: "mutation",
|
|
15625
15483
|
auth: "admin"
|
|
15626
|
-
}), method(
|
|
15484
|
+
}), method(object({}), _void(), {
|
|
15627
15485
|
kind: "mutation",
|
|
15628
15486
|
auth: "admin"
|
|
15629
|
-
})
|
|
15630
|
-
method(object({
|
|
15631
|
-
sourceUrl: string(),
|
|
15632
|
-
metadata: ModelConvertMetadataSchema,
|
|
15633
|
-
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15634
|
-
calibrationRef: string().optional(),
|
|
15635
|
-
sessionId: string().optional()
|
|
15636
|
-
}), ConvertResultSchema, {
|
|
15487
|
+
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
15637
15488
|
kind: "mutation",
|
|
15638
|
-
auth: "admin"
|
|
15639
|
-
|
|
15640
|
-
});
|
|
15641
|
-
method(object({
|
|
15642
|
-
nodeId: string(),
|
|
15643
|
-
modelId: string(),
|
|
15644
|
-
format: _enum(MODEL_FORMATS),
|
|
15645
|
-
entry: ModelCatalogEntrySchema
|
|
15646
|
-
}), object({
|
|
15647
|
-
ok: boolean(),
|
|
15648
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15649
|
-
sha256: string(),
|
|
15650
|
-
bytes: number(),
|
|
15651
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15652
|
-
path: string()
|
|
15653
|
-
}), {
|
|
15489
|
+
auth: "admin"
|
|
15490
|
+
}), method(object({ file: string() }), _void(), {
|
|
15654
15491
|
kind: "mutation",
|
|
15655
15492
|
auth: "admin"
|
|
15656
|
-
});
|
|
15493
|
+
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
15657
15494
|
/**
|
|
15658
|
-
* `
|
|
15659
|
-
*
|
|
15660
|
-
*
|
|
15661
|
-
*
|
|
15662
|
-
*
|
|
15663
|
-
* its OWN `mqtt.js` client.
|
|
15664
|
-
*
|
|
15665
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15666
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15667
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
15668
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15669
|
-
* features anyway — give it the connection config, get out of the way.
|
|
15495
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
15496
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
15497
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
15498
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15499
|
+
* (hub-placed); the cap stays open for future providers.
|
|
15670
15500
|
*
|
|
15671
|
-
*
|
|
15672
|
-
*
|
|
15673
|
-
*
|
|
15674
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
15675
|
-
*
|
|
15676
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
15677
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
15678
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
15679
|
-
* spawned it.
|
|
15680
|
-
*/
|
|
15681
|
-
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
15682
|
-
/**
|
|
15683
|
-
* Broker live-probe status.
|
|
15684
|
-
*
|
|
15685
|
-
* - `connected` — last probe completed a clean CONNACK
|
|
15686
|
-
* - `disconnected` — no probe has run yet (cold cache)
|
|
15687
|
-
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
15688
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
15689
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
15501
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15502
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15503
|
+
* write; a stored key NEVER round-trips to a client.
|
|
15690
15504
|
*/
|
|
15691
|
-
var
|
|
15692
|
-
"
|
|
15693
|
-
"
|
|
15694
|
-
"
|
|
15695
|
-
"
|
|
15696
|
-
"
|
|
15505
|
+
var LlmProfileKindSchema = _enum([
|
|
15506
|
+
"openai-compatible",
|
|
15507
|
+
"openai",
|
|
15508
|
+
"anthropic",
|
|
15509
|
+
"google",
|
|
15510
|
+
"managed-local"
|
|
15697
15511
|
]);
|
|
15698
|
-
var
|
|
15512
|
+
var LlmProfileSchema = object({
|
|
15699
15513
|
id: string(),
|
|
15700
15514
|
name: string(),
|
|
15701
|
-
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15515
|
+
kind: LlmProfileKindSchema,
|
|
15516
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
15517
|
+
addonId: string(),
|
|
15518
|
+
enabled: boolean(),
|
|
15519
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
15520
|
+
model: string(),
|
|
15521
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
15522
|
+
baseUrl: string().optional(),
|
|
15523
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
15524
|
+
apiKey: string().optional(),
|
|
15525
|
+
supportsVision: boolean(),
|
|
15526
|
+
temperature: number().min(0).max(2).optional(),
|
|
15527
|
+
maxTokens: number().int().positive().optional(),
|
|
15528
|
+
timeoutMs: number().int().positive().default(6e4),
|
|
15529
|
+
extraHeaders: record(string(), string()).optional(),
|
|
15530
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
15531
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15710
15532
|
});
|
|
15711
|
-
/**
|
|
15712
|
-
*
|
|
15713
|
-
*
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
15723
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
15724
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
15725
|
-
* broker).
|
|
15726
|
-
*/
|
|
15727
|
-
clientIdPrefix: string().optional()
|
|
15533
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
15534
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
15535
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
15536
|
+
var ConfigSchemaPassthrough$1 = unknown();
|
|
15537
|
+
var LlmProfileKindDescriptorSchema = object({
|
|
15538
|
+
kind: LlmProfileKindSchema,
|
|
15539
|
+
label: string(),
|
|
15540
|
+
icon: string(),
|
|
15541
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15542
|
+
addonId: string(),
|
|
15543
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
15728
15544
|
});
|
|
15729
|
-
var
|
|
15730
|
-
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
password: string().optional(),
|
|
15734
|
-
clientIdPrefix: string().optional()
|
|
15545
|
+
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
15546
|
+
var LlmDefaultSchema = object({
|
|
15547
|
+
selector: LlmDefaultSelectorSchema,
|
|
15548
|
+
profileId: string()
|
|
15735
15549
|
});
|
|
15736
|
-
|
|
15737
|
-
var
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
15748
|
-
allowAnonymous: boolean().default(false),
|
|
15749
|
-
/** Optional shared username/password for clients. */
|
|
15750
|
-
username: string().optional(),
|
|
15751
|
-
password: string().optional()
|
|
15550
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
15551
|
+
var LlmUsageRollupSchema = object({
|
|
15552
|
+
day: string(),
|
|
15553
|
+
consumer: string(),
|
|
15554
|
+
profileId: string(),
|
|
15555
|
+
calls: number(),
|
|
15556
|
+
okCalls: number(),
|
|
15557
|
+
errorCalls: number(),
|
|
15558
|
+
inputTokens: number(),
|
|
15559
|
+
outputTokens: number(),
|
|
15560
|
+
avgLatencyMs: number()
|
|
15752
15561
|
});
|
|
15753
|
-
|
|
15562
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
15563
|
+
var ManagedModelCatalogEntrySchema = object({
|
|
15754
15564
|
id: string(),
|
|
15755
|
-
|
|
15756
|
-
|
|
15757
|
-
|
|
15758
|
-
brokerCount: number(),
|
|
15759
|
-
embeddedRunning: boolean()
|
|
15760
|
-
});
|
|
15761
|
-
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
|
|
15762
|
-
var NetworkEndpointSchema = object({
|
|
15565
|
+
label: string(),
|
|
15566
|
+
family: string(),
|
|
15567
|
+
purpose: _enum(["text", "vision"]),
|
|
15763
15568
|
url: string(),
|
|
15764
|
-
|
|
15765
|
-
|
|
15766
|
-
|
|
15569
|
+
sha256: string(),
|
|
15570
|
+
sizeBytes: number(),
|
|
15571
|
+
quantization: string(),
|
|
15572
|
+
/** Load-time guidance shown in the picker. */
|
|
15573
|
+
minRamBytes: number(),
|
|
15574
|
+
contextSizeDefault: number().int(),
|
|
15575
|
+
/** Vision models: companion projector file. */
|
|
15576
|
+
mmprojUrl: string().optional()
|
|
15767
15577
|
});
|
|
15768
|
-
var
|
|
15769
|
-
|
|
15770
|
-
|
|
15578
|
+
var LlmRuntimeNodeSchema = object({
|
|
15579
|
+
nodeId: string(),
|
|
15580
|
+
reachable: boolean(),
|
|
15581
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
15582
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15771
15583
|
error: string().optional()
|
|
15772
15584
|
});
|
|
15773
|
-
|
|
15774
|
-
|
|
15775
|
-
|
|
15776
|
-
|
|
15777
|
-
* the originating provider config (mode + sourcePort) so the
|
|
15778
|
-
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
15779
|
-
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
15780
|
-
*/
|
|
15781
|
-
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
15782
|
-
/**
|
|
15783
|
-
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
15784
|
-
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
15785
|
-
*/
|
|
15786
|
-
id: string(),
|
|
15787
|
-
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
15788
|
-
label: string(),
|
|
15789
|
-
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
15790
|
-
mode: string().optional(),
|
|
15791
|
-
/** Originating local port the ingress fronts (informational). */
|
|
15792
|
-
sourcePort: number().optional()
|
|
15585
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: array(LlmImageSchema).min(1) });
|
|
15586
|
+
var ProfileRefInputSchema = object({
|
|
15587
|
+
addonId: string(),
|
|
15588
|
+
profileId: string()
|
|
15793
15589
|
});
|
|
15794
|
-
method(
|
|
15590
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
15591
|
+
kind: "mutation",
|
|
15592
|
+
auth: "admin"
|
|
15593
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
15594
|
+
kind: "mutation",
|
|
15595
|
+
auth: "admin"
|
|
15596
|
+
}), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
15597
|
+
kind: "mutation",
|
|
15598
|
+
auth: "admin"
|
|
15599
|
+
}), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
15600
|
+
selector: LlmDefaultSelectorSchema,
|
|
15601
|
+
profileId: string().nullable()
|
|
15602
|
+
}), _void(), {
|
|
15603
|
+
kind: "mutation",
|
|
15604
|
+
auth: "admin"
|
|
15605
|
+
}), method(object({
|
|
15606
|
+
since: number().optional(),
|
|
15607
|
+
until: number().optional(),
|
|
15608
|
+
consumer: string().optional(),
|
|
15609
|
+
profileId: string().optional()
|
|
15610
|
+
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
15611
|
+
nodeId: string(),
|
|
15612
|
+
model: ManagedModelRefSchema
|
|
15613
|
+
}), _void(), {
|
|
15614
|
+
kind: "mutation",
|
|
15615
|
+
auth: "admin"
|
|
15616
|
+
}), method(object({
|
|
15617
|
+
nodeId: string(),
|
|
15618
|
+
file: string()
|
|
15619
|
+
}), _void(), {
|
|
15620
|
+
kind: "mutation",
|
|
15621
|
+
auth: "admin"
|
|
15622
|
+
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
15623
|
+
kind: "mutation",
|
|
15624
|
+
auth: "admin"
|
|
15625
|
+
}), method(ProfileRefInputSchema, _void(), {
|
|
15626
|
+
kind: "mutation",
|
|
15627
|
+
auth: "admin"
|
|
15628
|
+
});
|
|
15629
|
+
var LogLevelSchema = _enum([
|
|
15630
|
+
"debug",
|
|
15631
|
+
"info",
|
|
15632
|
+
"warn",
|
|
15633
|
+
"error"
|
|
15634
|
+
]);
|
|
15635
|
+
var LogEntrySchema = object({
|
|
15636
|
+
timestamp: date(),
|
|
15637
|
+
level: LogLevelSchema,
|
|
15638
|
+
scope: array(string()),
|
|
15639
|
+
message: string(),
|
|
15640
|
+
meta: record(string(), unknown()).optional(),
|
|
15641
|
+
tags: record(string(), string()).optional()
|
|
15642
|
+
});
|
|
15643
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
15644
|
+
scope: array(string()).optional(),
|
|
15645
|
+
level: LogLevelSchema.optional(),
|
|
15646
|
+
since: date().optional(),
|
|
15647
|
+
until: date().optional(),
|
|
15648
|
+
limit: number().optional(),
|
|
15649
|
+
tags: record(string(), string()).optional()
|
|
15650
|
+
}), array(LogEntrySchema).readonly());
|
|
15795
15651
|
/**
|
|
15796
|
-
*
|
|
15652
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
15653
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
15654
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
15655
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
15656
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
15657
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
15797
15658
|
*
|
|
15798
|
-
*
|
|
15799
|
-
*
|
|
15800
|
-
*
|
|
15801
|
-
*
|
|
15802
|
-
*
|
|
15803
|
-
*
|
|
15659
|
+
* A contribution is a discriminated union on `kind`:
|
|
15660
|
+
*
|
|
15661
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
15662
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
15663
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
15664
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
15665
|
+
* login page needs NO change.
|
|
15666
|
+
*
|
|
15667
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
15668
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
15669
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
15670
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
15671
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
15672
|
+
*
|
|
15673
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
15674
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
15675
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
15676
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
15677
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
15678
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
15679
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
15680
|
+
* decision.
|
|
15681
|
+
*
|
|
15682
|
+
* Every contribution carries a `stage`:
|
|
15683
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
15684
|
+
* magic-link buttons; a future usernameless passkey).
|
|
15685
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
15686
|
+
* returned `factors` (passkey-as-2FA today).
|
|
15687
|
+
*
|
|
15688
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
15689
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
15690
|
+
* tRPC router.
|
|
15691
|
+
*/
|
|
15692
|
+
/** When a login method renders in the two-phase login flow. */
|
|
15693
|
+
var LoginStageEnum = _enum(["primary", "second-factor"]);
|
|
15694
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
15695
|
+
var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
15696
|
+
object({
|
|
15697
|
+
kind: literal("redirect"),
|
|
15698
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
15699
|
+
id: string(),
|
|
15700
|
+
/** Operator-facing button label. */
|
|
15701
|
+
label: string(),
|
|
15702
|
+
/** lucide-react icon name. */
|
|
15703
|
+
icon: string().optional(),
|
|
15704
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
15705
|
+
startUrl: string(),
|
|
15706
|
+
stage: LoginStageEnum
|
|
15707
|
+
}),
|
|
15708
|
+
object({
|
|
15709
|
+
kind: literal("widget"),
|
|
15710
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
15711
|
+
id: string(),
|
|
15712
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
15713
|
+
addonId: string(),
|
|
15714
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
15715
|
+
bundle: string(),
|
|
15716
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
15717
|
+
remote: WidgetRemoteSchema,
|
|
15718
|
+
stage: LoginStageEnum
|
|
15719
|
+
}),
|
|
15720
|
+
object({
|
|
15721
|
+
kind: literal("passkey"),
|
|
15722
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
15723
|
+
id: string(),
|
|
15724
|
+
/** Operator-facing button label. */
|
|
15725
|
+
label: string(),
|
|
15726
|
+
stage: LoginStageEnum,
|
|
15727
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
15728
|
+
rpId: string(),
|
|
15729
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
15730
|
+
origin: string().nullable()
|
|
15731
|
+
})
|
|
15732
|
+
]);
|
|
15733
|
+
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
15734
|
+
var CpuBreakdownSchema = object({
|
|
15735
|
+
total: number(),
|
|
15736
|
+
user: number(),
|
|
15737
|
+
system: number(),
|
|
15738
|
+
irq: number(),
|
|
15739
|
+
nice: number(),
|
|
15740
|
+
loadAvg: tuple([
|
|
15741
|
+
number(),
|
|
15742
|
+
number(),
|
|
15743
|
+
number()
|
|
15744
|
+
]),
|
|
15745
|
+
cores: number()
|
|
15746
|
+
});
|
|
15747
|
+
var MemoryInfoSchema = object({
|
|
15748
|
+
percent: number(),
|
|
15749
|
+
totalBytes: number(),
|
|
15750
|
+
usedBytes: number(),
|
|
15751
|
+
availableBytes: number(),
|
|
15752
|
+
swapUsedBytes: number(),
|
|
15753
|
+
swapTotalBytes: number()
|
|
15754
|
+
});
|
|
15755
|
+
var DiskIoSnapshotSchema = object({
|
|
15756
|
+
readBytes: number(),
|
|
15757
|
+
writeBytes: number(),
|
|
15758
|
+
readOps: number(),
|
|
15759
|
+
writeOps: number(),
|
|
15760
|
+
timestampMs: number()
|
|
15761
|
+
});
|
|
15762
|
+
var NetworkIoSnapshotSchema = object({
|
|
15763
|
+
rxBytes: number(),
|
|
15764
|
+
txBytes: number(),
|
|
15765
|
+
rxPackets: number(),
|
|
15766
|
+
txPackets: number(),
|
|
15767
|
+
rxErrors: number(),
|
|
15768
|
+
txErrors: number(),
|
|
15769
|
+
timestampMs: number()
|
|
15770
|
+
});
|
|
15771
|
+
var MetricsGpuInfoSchema = object({
|
|
15772
|
+
utilization: number(),
|
|
15773
|
+
model: string(),
|
|
15774
|
+
memoryUsedBytes: number(),
|
|
15775
|
+
memoryTotalBytes: number(),
|
|
15776
|
+
temperature: number().nullable()
|
|
15777
|
+
});
|
|
15778
|
+
var ProcessResourceInfoSchema = object({
|
|
15779
|
+
openFds: number(),
|
|
15780
|
+
threadCount: number(),
|
|
15781
|
+
activeHandles: number(),
|
|
15782
|
+
activeRequests: number()
|
|
15783
|
+
});
|
|
15784
|
+
var PressureAvgsSchema = object({
|
|
15785
|
+
avg10: number(),
|
|
15786
|
+
avg60: number(),
|
|
15787
|
+
avg300: number()
|
|
15788
|
+
});
|
|
15789
|
+
var PressureInfoSchema = object({
|
|
15790
|
+
some: PressureAvgsSchema,
|
|
15791
|
+
full: PressureAvgsSchema.nullable()
|
|
15792
|
+
});
|
|
15793
|
+
var SystemResourceSnapshotSchema = object({
|
|
15794
|
+
cpu: CpuBreakdownSchema,
|
|
15795
|
+
memory: MemoryInfoSchema,
|
|
15796
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15797
|
+
network: NetworkIoSnapshotSchema,
|
|
15798
|
+
disk: DiskIoSnapshotSchema,
|
|
15799
|
+
pressure: object({
|
|
15800
|
+
cpu: PressureInfoSchema.nullable(),
|
|
15801
|
+
memory: PressureInfoSchema.nullable(),
|
|
15802
|
+
io: PressureInfoSchema.nullable()
|
|
15803
|
+
}),
|
|
15804
|
+
process: ProcessResourceInfoSchema,
|
|
15805
|
+
cpuTemperature: number().nullable(),
|
|
15806
|
+
timestampMs: number()
|
|
15807
|
+
});
|
|
15808
|
+
var DiskSpaceInfoSchema = object({
|
|
15809
|
+
path: string(),
|
|
15810
|
+
totalBytes: number(),
|
|
15811
|
+
usedBytes: number(),
|
|
15812
|
+
availableBytes: number(),
|
|
15813
|
+
percent: number()
|
|
15814
|
+
});
|
|
15815
|
+
var PidResourceStatsSchema = object({
|
|
15816
|
+
pid: number(),
|
|
15817
|
+
cpu: number(),
|
|
15818
|
+
memory: number(),
|
|
15819
|
+
/**
|
|
15820
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
15821
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
15822
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
15823
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
15824
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
15825
|
+
*/
|
|
15826
|
+
privateBytes: number().optional(),
|
|
15827
|
+
/**
|
|
15828
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
15829
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
15830
|
+
*/
|
|
15831
|
+
sharedBytes: number().optional()
|
|
15832
|
+
});
|
|
15833
|
+
var AddonInstanceSchema = object({
|
|
15834
|
+
addonId: string(),
|
|
15835
|
+
nodeId: string(),
|
|
15836
|
+
role: _enum(["hub", "worker"]),
|
|
15837
|
+
pid: number(),
|
|
15838
|
+
state: _enum([
|
|
15839
|
+
"starting",
|
|
15840
|
+
"running",
|
|
15841
|
+
"stopping",
|
|
15842
|
+
"stopped",
|
|
15843
|
+
"crashed"
|
|
15844
|
+
]),
|
|
15845
|
+
uptimeSec: number()
|
|
15846
|
+
});
|
|
15847
|
+
var NodeProcessSchema = object({
|
|
15848
|
+
pid: number(),
|
|
15849
|
+
ppid: number(),
|
|
15850
|
+
pgid: number(),
|
|
15851
|
+
classification: _enum([
|
|
15852
|
+
"root",
|
|
15853
|
+
"managed",
|
|
15854
|
+
"system",
|
|
15855
|
+
"ghost"
|
|
15856
|
+
]),
|
|
15857
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
15858
|
+
addonId: string().nullable(),
|
|
15859
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15860
|
+
nodeId: string().nullable(),
|
|
15861
|
+
/** Truncated command line. */
|
|
15862
|
+
command: string(),
|
|
15863
|
+
cpuPercent: number(),
|
|
15864
|
+
memoryRssBytes: number(),
|
|
15865
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15866
|
+
uptimeSec: number(),
|
|
15867
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15868
|
+
orphaned: boolean()
|
|
15869
|
+
});
|
|
15870
|
+
var KillProcessInputSchema = object({
|
|
15871
|
+
pid: number(),
|
|
15872
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15873
|
+
force: boolean().optional()
|
|
15874
|
+
});
|
|
15875
|
+
var KillProcessResultSchema = object({
|
|
15876
|
+
success: boolean(),
|
|
15877
|
+
reason: string().optional(),
|
|
15878
|
+
signal: _enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15879
|
+
});
|
|
15880
|
+
var DumpHeapSnapshotInputSchema = object({
|
|
15881
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
15882
|
+
addonId: string() });
|
|
15883
|
+
var DumpHeapSnapshotResultSchema = object({
|
|
15884
|
+
success: boolean(),
|
|
15885
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15886
|
+
path: string().optional(),
|
|
15887
|
+
/** Process pid that was signalled. */
|
|
15888
|
+
pid: number().optional(),
|
|
15889
|
+
reason: string().optional()
|
|
15890
|
+
});
|
|
15891
|
+
var SystemMetricsSchema = object({
|
|
15892
|
+
cpuPercent: number(),
|
|
15893
|
+
memoryPercent: number(),
|
|
15894
|
+
memoryUsedMB: number(),
|
|
15895
|
+
memoryTotalMB: number(),
|
|
15896
|
+
diskPercent: number().optional(),
|
|
15897
|
+
temperature: number().optional(),
|
|
15898
|
+
gpuPercent: number().optional(),
|
|
15899
|
+
gpuMemoryPercent: number().optional()
|
|
15900
|
+
});
|
|
15901
|
+
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, {
|
|
15902
|
+
kind: "mutation",
|
|
15903
|
+
auth: "admin"
|
|
15904
|
+
}), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
15905
|
+
kind: "mutation",
|
|
15906
|
+
auth: "admin"
|
|
15907
|
+
});
|
|
15908
|
+
method(object({
|
|
15909
|
+
sourceUrl: string(),
|
|
15910
|
+
metadata: ModelConvertMetadataSchema,
|
|
15911
|
+
targets: array(ConvertTargetSchema).min(1).readonly(),
|
|
15912
|
+
calibrationRef: string().optional(),
|
|
15913
|
+
sessionId: string().optional()
|
|
15914
|
+
}), ConvertResultSchema, {
|
|
15915
|
+
kind: "mutation",
|
|
15916
|
+
auth: "admin",
|
|
15917
|
+
timeoutMs: 6e5
|
|
15918
|
+
});
|
|
15919
|
+
method(object({
|
|
15920
|
+
nodeId: string(),
|
|
15921
|
+
modelId: string(),
|
|
15922
|
+
format: _enum(MODEL_FORMATS),
|
|
15923
|
+
entry: ModelCatalogEntrySchema
|
|
15924
|
+
}), object({
|
|
15925
|
+
ok: boolean(),
|
|
15926
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15927
|
+
sha256: string(),
|
|
15928
|
+
bytes: number(),
|
|
15929
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
15930
|
+
path: string()
|
|
15931
|
+
}), {
|
|
15932
|
+
kind: "mutation",
|
|
15933
|
+
auth: "admin"
|
|
15934
|
+
});
|
|
15935
|
+
/**
|
|
15936
|
+
* `mqtt-broker` — broker-registry cap.
|
|
15937
|
+
*
|
|
15938
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15939
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15940
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
15941
|
+
* its OWN `mqtt.js` client.
|
|
15942
|
+
*
|
|
15943
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15944
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15945
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
15946
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15947
|
+
* features anyway — give it the connection config, get out of the way.
|
|
15948
|
+
*
|
|
15949
|
+
* Consumer flow:
|
|
15950
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
15951
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
15952
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
15953
|
+
*
|
|
15954
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
15955
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
15956
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
15957
|
+
* spawned it.
|
|
15958
|
+
*/
|
|
15959
|
+
var BrokerKindSchema = _enum(["external", "embedded"]);
|
|
15960
|
+
/**
|
|
15961
|
+
* Broker live-probe status.
|
|
15962
|
+
*
|
|
15963
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
15964
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
15965
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
15966
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
15967
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
15968
|
+
*/
|
|
15969
|
+
var BrokerStatusSchema$1 = _enum([
|
|
15970
|
+
"connected",
|
|
15971
|
+
"disconnected",
|
|
15972
|
+
"auth-failed",
|
|
15973
|
+
"unreachable",
|
|
15974
|
+
"tls-error"
|
|
15975
|
+
]);
|
|
15976
|
+
var BrokerInfoSchema = object({
|
|
15977
|
+
id: string(),
|
|
15978
|
+
name: string(),
|
|
15979
|
+
url: string(),
|
|
15980
|
+
kind: BrokerKindSchema,
|
|
15981
|
+
status: BrokerStatusSchema$1,
|
|
15982
|
+
latencyMs: number().nullable(),
|
|
15983
|
+
error: string().optional(),
|
|
15984
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
15985
|
+
connectedClients: number().int().nonnegative().optional(),
|
|
15986
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
15987
|
+
lastCheckedAt: number().optional()
|
|
15988
|
+
});
|
|
15989
|
+
/**
|
|
15990
|
+
* Connection details — what a consumer needs to call
|
|
15991
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
15992
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
15993
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
15994
|
+
*/
|
|
15995
|
+
var BrokerConnectionDetailsSchema = object({
|
|
15996
|
+
url: string(),
|
|
15997
|
+
username: string().optional(),
|
|
15998
|
+
password: string().optional(),
|
|
15999
|
+
/**
|
|
16000
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
16001
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
16002
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
16003
|
+
* broker).
|
|
16004
|
+
*/
|
|
16005
|
+
clientIdPrefix: string().optional()
|
|
16006
|
+
});
|
|
16007
|
+
var AddBrokerInputSchema = object({
|
|
16008
|
+
name: string().min(1),
|
|
16009
|
+
url: string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
16010
|
+
username: string().optional(),
|
|
16011
|
+
password: string().optional(),
|
|
16012
|
+
clientIdPrefix: string().optional()
|
|
16013
|
+
});
|
|
16014
|
+
var AddBrokerResultSchema = object({ id: string() });
|
|
16015
|
+
var IdInputSchema = object({ id: string() });
|
|
16016
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
16017
|
+
ok: literal(true),
|
|
16018
|
+
latencyMs: number()
|
|
16019
|
+
}), object({
|
|
16020
|
+
ok: literal(false),
|
|
16021
|
+
error: string()
|
|
16022
|
+
})]);
|
|
16023
|
+
var StartEmbeddedInputSchema = object({
|
|
16024
|
+
port: number().int().min(1).max(65535).default(1883),
|
|
16025
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
16026
|
+
allowAnonymous: boolean().default(false),
|
|
16027
|
+
/** Optional shared username/password for clients. */
|
|
16028
|
+
username: string().optional(),
|
|
16029
|
+
password: string().optional()
|
|
16030
|
+
});
|
|
16031
|
+
var StartEmbeddedResultSchema = object({
|
|
16032
|
+
id: string(),
|
|
16033
|
+
url: string()
|
|
16034
|
+
});
|
|
16035
|
+
var StatusSchema = object({
|
|
16036
|
+
brokerCount: number(),
|
|
16037
|
+
embeddedRunning: boolean()
|
|
16038
|
+
});
|
|
16039
|
+
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
|
|
16040
|
+
var NetworkEndpointSchema = object({
|
|
16041
|
+
url: string(),
|
|
16042
|
+
hostname: string(),
|
|
16043
|
+
port: number(),
|
|
16044
|
+
protocol: _enum(["http", "https"])
|
|
16045
|
+
});
|
|
16046
|
+
var NetworkAccessStatusSchema = object({
|
|
16047
|
+
connected: boolean(),
|
|
16048
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
16049
|
+
error: string().optional()
|
|
16050
|
+
});
|
|
16051
|
+
/**
|
|
16052
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
16053
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
16054
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
16055
|
+
* the originating provider config (mode + sourcePort) so the
|
|
16056
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
16057
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
16058
|
+
*/
|
|
16059
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
16060
|
+
/**
|
|
16061
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
16062
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
16063
|
+
*/
|
|
16064
|
+
id: string(),
|
|
16065
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
16066
|
+
label: string(),
|
|
16067
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
16068
|
+
mode: string().optional(),
|
|
16069
|
+
/** Originating local port the ingress fronts (informational). */
|
|
16070
|
+
sourcePort: number().optional()
|
|
16071
|
+
});
|
|
16072
|
+
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
16073
|
+
/**
|
|
16074
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
16075
|
+
*
|
|
16076
|
+
* Apprise-derived model (see
|
|
16077
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
16078
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
16079
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16080
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
16081
|
+
* message to what the kind supports — callers never special-case a service.
|
|
15804
16082
|
*
|
|
15805
16083
|
* DESIGN DECISIONS (locked):
|
|
15806
16084
|
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
@@ -15925,14 +16203,14 @@ var TargetKindCapsSchema = object({
|
|
|
15925
16203
|
* the union is large and not meant for runtime validation here; the exported
|
|
15926
16204
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
15927
16205
|
*/
|
|
15928
|
-
var ConfigSchemaPassthrough
|
|
16206
|
+
var ConfigSchemaPassthrough = unknown();
|
|
15929
16207
|
var TargetKindSchema = object({
|
|
15930
16208
|
kind: string(),
|
|
15931
16209
|
label: string(),
|
|
15932
16210
|
icon: string(),
|
|
15933
16211
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15934
16212
|
addonId: string(),
|
|
15935
|
-
configSchema: ConfigSchemaPassthrough
|
|
16213
|
+
configSchema: ConfigSchemaPassthrough,
|
|
15936
16214
|
supportsDiscovery: boolean(),
|
|
15937
16215
|
caps: TargetKindCapsSchema
|
|
15938
16216
|
});
|
|
@@ -16014,8 +16292,27 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
|
|
|
16014
16292
|
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
16015
16293
|
* schema/interface drift is explicitly not repeated).
|
|
16016
16294
|
*/
|
|
16017
|
-
/**
|
|
16018
|
-
|
|
16295
|
+
/**
|
|
16296
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
16297
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
16298
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
16299
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
16300
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
16301
|
+
* change of a LINKED device, one row per linked camera)
|
|
16302
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
16303
|
+
* delivery / pick-up)
|
|
16304
|
+
*
|
|
16305
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
16306
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
16307
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
16308
|
+
* one trigger.
|
|
16309
|
+
*/
|
|
16310
|
+
var NcDeliverySchema = _enum([
|
|
16311
|
+
"immediate",
|
|
16312
|
+
"track-end",
|
|
16313
|
+
"device-event",
|
|
16314
|
+
"package-event"
|
|
16315
|
+
]);
|
|
16019
16316
|
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
16020
16317
|
var NcScheduleSchema = object({
|
|
16021
16318
|
windows: array(object({
|
|
@@ -16035,6 +16332,33 @@ var NcPlateMatcherSchema = object({
|
|
|
16035
16332
|
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
16036
16333
|
maxDistance: number().int().min(0).max(3).default(1)
|
|
16037
16334
|
});
|
|
16335
|
+
/**
|
|
16336
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
16337
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
16338
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
16339
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
16340
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
16341
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
16342
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
16343
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
16344
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
16345
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
16346
|
+
* (declared SQLite collection, reseeded on boot).
|
|
16347
|
+
*/
|
|
16348
|
+
var NcOccupancyConditionSchema = object({
|
|
16349
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
16350
|
+
zoneId: string().optional(),
|
|
16351
|
+
/** Object class to count; absent = any class. */
|
|
16352
|
+
className: string().optional(),
|
|
16353
|
+
op: _enum([
|
|
16354
|
+
"became-occupied",
|
|
16355
|
+
"became-free",
|
|
16356
|
+
">=",
|
|
16357
|
+
"<="
|
|
16358
|
+
]).default("became-occupied"),
|
|
16359
|
+
count: number().int().min(0).default(1),
|
|
16360
|
+
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
16361
|
+
});
|
|
16038
16362
|
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
16039
16363
|
var NcZoneConditionSchema = object({
|
|
16040
16364
|
ids: array(string().min(1)).min(1),
|
|
@@ -16070,7 +16394,104 @@ var NcConditionsSchema = object({
|
|
|
16070
16394
|
*/
|
|
16071
16395
|
identities: array(string().min(1)).optional(),
|
|
16072
16396
|
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
16073
|
-
plates: NcPlateMatcherSchema.optional()
|
|
16397
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
16398
|
+
/**
|
|
16399
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
16400
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
16401
|
+
* identity display name). A record with NO label passes (nothing to
|
|
16402
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
16403
|
+
*/
|
|
16404
|
+
identitiesExclude: array(string().min(1)).optional(),
|
|
16405
|
+
/**
|
|
16406
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
16407
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
16408
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
16409
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
16410
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
16411
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
16412
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
16413
|
+
*/
|
|
16414
|
+
minImportance: number().min(0).max(1).optional(),
|
|
16415
|
+
/**
|
|
16416
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
16417
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
16418
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
16419
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
16420
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
16421
|
+
*/
|
|
16422
|
+
minDwellSeconds: number().min(0).optional(),
|
|
16423
|
+
/**
|
|
16424
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
16425
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
16426
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
16427
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
16428
|
+
* tracks carry `sensor`.
|
|
16429
|
+
*/
|
|
16430
|
+
source: _enum([
|
|
16431
|
+
"pipeline",
|
|
16432
|
+
"onboard",
|
|
16433
|
+
"sensor",
|
|
16434
|
+
"any"
|
|
16435
|
+
]).optional(),
|
|
16436
|
+
/**
|
|
16437
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
16438
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
16439
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
16440
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
16441
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
16442
|
+
*
|
|
16443
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
16444
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
16445
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
16446
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
16447
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
16448
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
16449
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
16450
|
+
* one track the higher of the two is used. A track that ended with no
|
|
16451
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
16452
|
+
* closed for it (an un-recognized subject).
|
|
16453
|
+
*/
|
|
16454
|
+
minLabelConfidence: number().min(0).max(1).optional(),
|
|
16455
|
+
/**
|
|
16456
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
16457
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
16458
|
+
* against the token carried on the device-event subject (extracted from the
|
|
16459
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
16460
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
16461
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
16462
|
+
*/
|
|
16463
|
+
eventTypeTokens: array(string().min(1)).optional(),
|
|
16464
|
+
/**
|
|
16465
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
16466
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
16467
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
16468
|
+
*/
|
|
16469
|
+
sensorKinds: array(string().min(1)).optional(),
|
|
16470
|
+
/**
|
|
16471
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
16472
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
16473
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
16474
|
+
* on the package-event trigger).
|
|
16475
|
+
*/
|
|
16476
|
+
packagePhase: _enum([
|
|
16477
|
+
"delivered",
|
|
16478
|
+
"picked-up",
|
|
16479
|
+
"both"
|
|
16480
|
+
]).optional(),
|
|
16481
|
+
/**
|
|
16482
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
16483
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
16484
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
16485
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
16486
|
+
*/
|
|
16487
|
+
customZones: array(MaskPolygonShapeSchema).optional(),
|
|
16488
|
+
/**
|
|
16489
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
16490
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
16491
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
16492
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
16493
|
+
*/
|
|
16494
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
16074
16495
|
});
|
|
16075
16496
|
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
16076
16497
|
var NcRuleTargetSchema = object({
|
|
@@ -16084,12 +16505,21 @@ var NcRuleTargetSchema = object({
|
|
|
16084
16505
|
params: record(string(), unknown()).optional()
|
|
16085
16506
|
});
|
|
16086
16507
|
/**
|
|
16087
|
-
* Media attachment policy (P1 still-image subset).
|
|
16088
|
-
* AVAILABLE
|
|
16089
|
-
*
|
|
16508
|
+
* Media attachment policy (P1 still-image subset).
|
|
16509
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
16510
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
16511
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
16512
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
16513
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
16514
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
16515
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
16516
|
+
* name), so the choice never drifts from the record that fired it.
|
|
16517
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
16518
|
+
* - `none` — no attachment.
|
|
16090
16519
|
*/
|
|
16091
16520
|
var NcMediaPolicySchema = object({ attach: _enum([
|
|
16092
16521
|
"best",
|
|
16522
|
+
"best-matching",
|
|
16093
16523
|
"keyFrame",
|
|
16094
16524
|
"none"
|
|
16095
16525
|
]).default("best") });
|
|
@@ -16118,21 +16548,46 @@ var NcRuleInputSchema = object({
|
|
|
16118
16548
|
body: string().max(2e3).optional()
|
|
16119
16549
|
}).optional(),
|
|
16120
16550
|
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
16121
|
-
priority: number().int().min(1).max(5).default(3)
|
|
16551
|
+
priority: number().int().min(1).max(5).default(3),
|
|
16552
|
+
/**
|
|
16553
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
16554
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
16555
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
16556
|
+
*/
|
|
16557
|
+
ownerUserId: string().optional()
|
|
16122
16558
|
});
|
|
16123
|
-
/**
|
|
16124
|
-
|
|
16559
|
+
/**
|
|
16560
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
16561
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
16562
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
16563
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
16564
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
16565
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
16566
|
+
* `updateRule` patch.
|
|
16567
|
+
*/
|
|
16568
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
|
|
16125
16569
|
/** A persisted rule. */
|
|
16126
16570
|
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
16127
16571
|
id: string(),
|
|
16128
16572
|
/** userId of the admin who created the rule (server-stamped caller). */
|
|
16129
16573
|
createdBy: string(),
|
|
16130
16574
|
createdAt: number(),
|
|
16131
|
-
updatedAt: number()
|
|
16575
|
+
updatedAt: number(),
|
|
16576
|
+
/**
|
|
16577
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
16578
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
16579
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
16580
|
+
*/
|
|
16581
|
+
disabledTargetIds: array(string()).default([])
|
|
16132
16582
|
});
|
|
16133
16583
|
var NcTestResultSchema = object({
|
|
16134
16584
|
recordId: string(),
|
|
16135
|
-
recordKind: _enum([
|
|
16585
|
+
recordKind: _enum([
|
|
16586
|
+
"object-event",
|
|
16587
|
+
"track",
|
|
16588
|
+
"device-event",
|
|
16589
|
+
"package-event"
|
|
16590
|
+
]),
|
|
16136
16591
|
deviceId: number(),
|
|
16137
16592
|
timestamp: number(),
|
|
16138
16593
|
wouldFire: boolean(),
|
|
@@ -16150,7 +16605,10 @@ var NcConditionDescriptorSchema = object({
|
|
|
16150
16605
|
"zones",
|
|
16151
16606
|
"quality",
|
|
16152
16607
|
"label",
|
|
16153
|
-
"schedule"
|
|
16608
|
+
"schedule",
|
|
16609
|
+
"device",
|
|
16610
|
+
"package",
|
|
16611
|
+
"occupancy"
|
|
16154
16612
|
]),
|
|
16155
16613
|
label: string(),
|
|
16156
16614
|
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
@@ -16158,10 +16616,15 @@ var NcConditionDescriptorSchema = object({
|
|
|
16158
16616
|
"deviceIdList",
|
|
16159
16617
|
"stringList",
|
|
16160
16618
|
"number01",
|
|
16619
|
+
"number",
|
|
16620
|
+
"sourceSelect",
|
|
16161
16621
|
"zoneSelection",
|
|
16162
16622
|
"zoneIdList",
|
|
16163
16623
|
"schedule",
|
|
16164
|
-
"plateMatcher"
|
|
16624
|
+
"plateMatcher",
|
|
16625
|
+
"packagePhase",
|
|
16626
|
+
"polygonDraw",
|
|
16627
|
+
"occupancy"
|
|
16165
16628
|
]),
|
|
16166
16629
|
operator: _enum([
|
|
16167
16630
|
"in",
|
|
@@ -16188,7 +16651,12 @@ var NC_CONDITION_CATALOG = [
|
|
|
16188
16651
|
label: "Cameras",
|
|
16189
16652
|
valueType: "deviceIdList",
|
|
16190
16653
|
operator: "in",
|
|
16191
|
-
appliesTo: [
|
|
16654
|
+
appliesTo: [
|
|
16655
|
+
"immediate",
|
|
16656
|
+
"track-end",
|
|
16657
|
+
"device-event",
|
|
16658
|
+
"package-event"
|
|
16659
|
+
],
|
|
16192
16660
|
phase: "P1",
|
|
16193
16661
|
description: "Restrict the rule to these devices; absent = all devices."
|
|
16194
16662
|
},
|
|
@@ -16198,7 +16666,11 @@ var NC_CONDITION_CATALOG = [
|
|
|
16198
16666
|
label: "Object classes",
|
|
16199
16667
|
valueType: "stringList",
|
|
16200
16668
|
operator: "in",
|
|
16201
|
-
appliesTo: [
|
|
16669
|
+
appliesTo: [
|
|
16670
|
+
"immediate",
|
|
16671
|
+
"track-end",
|
|
16672
|
+
"package-event"
|
|
16673
|
+
],
|
|
16202
16674
|
phase: "P1",
|
|
16203
16675
|
description: "Any overlap with the detection class set passes."
|
|
16204
16676
|
},
|
|
@@ -16208,7 +16680,11 @@ var NC_CONDITION_CATALOG = [
|
|
|
16208
16680
|
label: "Excluded classes",
|
|
16209
16681
|
valueType: "stringList",
|
|
16210
16682
|
operator: "notIn",
|
|
16211
|
-
appliesTo: [
|
|
16683
|
+
appliesTo: [
|
|
16684
|
+
"immediate",
|
|
16685
|
+
"track-end",
|
|
16686
|
+
"package-event"
|
|
16687
|
+
],
|
|
16212
16688
|
phase: "P1"
|
|
16213
16689
|
},
|
|
16214
16690
|
{
|
|
@@ -16217,7 +16693,11 @@ var NC_CONDITION_CATALOG = [
|
|
|
16217
16693
|
label: "Minimum confidence",
|
|
16218
16694
|
valueType: "number01",
|
|
16219
16695
|
operator: "gte",
|
|
16220
|
-
appliesTo: [
|
|
16696
|
+
appliesTo: [
|
|
16697
|
+
"immediate",
|
|
16698
|
+
"track-end",
|
|
16699
|
+
"package-event"
|
|
16700
|
+
],
|
|
16221
16701
|
phase: "P1"
|
|
16222
16702
|
},
|
|
16223
16703
|
{
|
|
@@ -16226,7 +16706,11 @@ var NC_CONDITION_CATALOG = [
|
|
|
16226
16706
|
label: "Zones",
|
|
16227
16707
|
valueType: "zoneSelection",
|
|
16228
16708
|
operator: "anyOf",
|
|
16229
|
-
appliesTo: [
|
|
16709
|
+
appliesTo: [
|
|
16710
|
+
"immediate",
|
|
16711
|
+
"track-end",
|
|
16712
|
+
"package-event"
|
|
16713
|
+
],
|
|
16230
16714
|
phase: "P1",
|
|
16231
16715
|
description: "Admin zone ids; quantifier any/all over the visited set."
|
|
16232
16716
|
},
|
|
@@ -16236,7 +16720,11 @@ var NC_CONDITION_CATALOG = [
|
|
|
16236
16720
|
label: "Excluded zones",
|
|
16237
16721
|
valueType: "zoneIdList",
|
|
16238
16722
|
operator: "notIn",
|
|
16239
|
-
appliesTo: [
|
|
16723
|
+
appliesTo: [
|
|
16724
|
+
"immediate",
|
|
16725
|
+
"track-end",
|
|
16726
|
+
"package-event"
|
|
16727
|
+
],
|
|
16240
16728
|
phase: "P1"
|
|
16241
16729
|
},
|
|
16242
16730
|
{
|
|
@@ -16269,355 +16757,270 @@ var NC_CONDITION_CATALOG = [
|
|
|
16269
16757
|
phase: "P1",
|
|
16270
16758
|
description: "Levenshtein-tolerant match against the plate text."
|
|
16271
16759
|
},
|
|
16760
|
+
{
|
|
16761
|
+
id: "identitiesExclude",
|
|
16762
|
+
group: "label",
|
|
16763
|
+
label: "Excluded identities",
|
|
16764
|
+
valueType: "stringList",
|
|
16765
|
+
operator: "notIn",
|
|
16766
|
+
appliesTo: ["immediate", "track-end"],
|
|
16767
|
+
phase: "P1",
|
|
16768
|
+
description: "Veto by identity display name (mirror of Identities; absent label passes)."
|
|
16769
|
+
},
|
|
16770
|
+
{
|
|
16771
|
+
id: "minLabelConfidence",
|
|
16772
|
+
group: "label",
|
|
16773
|
+
label: "Minimum label confidence",
|
|
16774
|
+
valueType: "number01",
|
|
16775
|
+
operator: "gte",
|
|
16776
|
+
appliesTo: ["track-end"],
|
|
16777
|
+
phase: "P1",
|
|
16778
|
+
description: "Best identity/plate recognition match confidence [0,1] for the label the track carries at close (peak assigned-identity cosine / peak plate OCR score; the higher of the two when both were read). Distinct from detection confidence. Fails closed for a track that ended un-recognized."
|
|
16779
|
+
},
|
|
16780
|
+
{
|
|
16781
|
+
id: "minImportance",
|
|
16782
|
+
group: "quality",
|
|
16783
|
+
label: "Minimum importance",
|
|
16784
|
+
valueType: "number01",
|
|
16785
|
+
operator: "gte",
|
|
16786
|
+
appliesTo: ["track-end"],
|
|
16787
|
+
phase: "P1",
|
|
16788
|
+
description: "Server-computed key-event importance [0,1]; track-end rules only (importance is scored at close). Fails when the record has none."
|
|
16789
|
+
},
|
|
16790
|
+
{
|
|
16791
|
+
id: "minDwellSeconds",
|
|
16792
|
+
group: "quality",
|
|
16793
|
+
label: "Minimum dwell (seconds)",
|
|
16794
|
+
valueType: "number",
|
|
16795
|
+
operator: "gte",
|
|
16796
|
+
appliesTo: ["track-end"],
|
|
16797
|
+
phase: "P1",
|
|
16798
|
+
description: "Track lifespan in seconds (lastSeen − firstSeen); track-end rules only."
|
|
16799
|
+
},
|
|
16800
|
+
{
|
|
16801
|
+
id: "source",
|
|
16802
|
+
group: "scope",
|
|
16803
|
+
label: "Detection source",
|
|
16804
|
+
valueType: "sourceSelect",
|
|
16805
|
+
operator: "in",
|
|
16806
|
+
appliesTo: [
|
|
16807
|
+
"immediate",
|
|
16808
|
+
"track-end",
|
|
16809
|
+
"device-event",
|
|
16810
|
+
"package-event"
|
|
16811
|
+
],
|
|
16812
|
+
phase: "P1",
|
|
16813
|
+
description: "pipeline / onboard / sensor; a record with no stamped source counts as pipeline."
|
|
16814
|
+
},
|
|
16815
|
+
{
|
|
16816
|
+
id: "sensorKinds",
|
|
16817
|
+
group: "device",
|
|
16818
|
+
label: "Sensor kinds",
|
|
16819
|
+
valueType: "stringList",
|
|
16820
|
+
operator: "in",
|
|
16821
|
+
appliesTo: ["device-event"],
|
|
16822
|
+
phase: "P1",
|
|
16823
|
+
description: "Sensor/control taxonomy kinds (doorbell / contact / button / …) matched against the persisted device event."
|
|
16824
|
+
},
|
|
16825
|
+
{
|
|
16826
|
+
id: "eventTypeTokens",
|
|
16827
|
+
group: "device",
|
|
16828
|
+
label: "Event-type tokens",
|
|
16829
|
+
valueType: "stringList",
|
|
16830
|
+
operator: "in",
|
|
16831
|
+
appliesTo: ["device-event"],
|
|
16832
|
+
phase: "P1",
|
|
16833
|
+
description: "Raw device event-type tokens (e.g. doorbell press / press_long) from the event-emitter slice; absent on doorbell-pulse / passive sensors."
|
|
16834
|
+
},
|
|
16835
|
+
{
|
|
16836
|
+
id: "packagePhase",
|
|
16837
|
+
group: "package",
|
|
16838
|
+
label: "Package phase",
|
|
16839
|
+
valueType: "packagePhase",
|
|
16840
|
+
operator: "in",
|
|
16841
|
+
appliesTo: ["package-event"],
|
|
16842
|
+
phase: "P1",
|
|
16843
|
+
description: "Delivered / picked-up / both."
|
|
16844
|
+
},
|
|
16845
|
+
{
|
|
16846
|
+
id: "occupancy",
|
|
16847
|
+
group: "occupancy",
|
|
16848
|
+
label: "Occupancy",
|
|
16849
|
+
valueType: "occupancy",
|
|
16850
|
+
operator: "anyOf",
|
|
16851
|
+
appliesTo: ["device-event"],
|
|
16852
|
+
phase: "P1",
|
|
16853
|
+
description: "ZoneAnalytics occupancy edge (optionally zone/class-scoped): count crosses the threshold and holds for sustainSeconds. Fail-closed on a missing snapshot."
|
|
16854
|
+
},
|
|
16855
|
+
{
|
|
16856
|
+
id: "customZones",
|
|
16857
|
+
group: "zones",
|
|
16858
|
+
label: "Custom zones",
|
|
16859
|
+
valueType: "polygonDraw",
|
|
16860
|
+
operator: "anyOf",
|
|
16861
|
+
appliesTo: [
|
|
16862
|
+
"immediate",
|
|
16863
|
+
"track-end",
|
|
16864
|
+
"package-event"
|
|
16865
|
+
],
|
|
16866
|
+
phase: "P1",
|
|
16867
|
+
description: "User-drawn polygons; a detection whose bbox overlaps any polygon matches."
|
|
16868
|
+
},
|
|
16272
16869
|
{
|
|
16273
16870
|
id: "schedule",
|
|
16274
16871
|
group: "schedule",
|
|
16275
16872
|
label: "Schedule",
|
|
16276
16873
|
valueType: "schedule",
|
|
16277
16874
|
operator: "withinSchedule",
|
|
16278
|
-
appliesTo: [
|
|
16875
|
+
appliesTo: [
|
|
16876
|
+
"immediate",
|
|
16877
|
+
"track-end",
|
|
16878
|
+
"device-event",
|
|
16879
|
+
"package-event"
|
|
16880
|
+
],
|
|
16279
16881
|
phase: "P1",
|
|
16280
16882
|
description: "Weekly activation windows (invertible); absent = always active."
|
|
16281
16883
|
}
|
|
16282
|
-
];
|
|
16283
|
-
var notificationRulesCapability = {
|
|
16284
|
-
name: "notification-rules",
|
|
16285
|
-
scope: "system",
|
|
16286
|
-
mode: "singleton",
|
|
16287
|
-
methods: {
|
|
16288
|
-
listRules: method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }),
|
|
16289
|
-
getRule: method(object({ ruleId: string() }), object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }),
|
|
16290
|
-
createRule: method(object({ rule: NcRuleInputSchema }), object({ rule: NcRuleSchema }), {
|
|
16291
|
-
kind: "mutation",
|
|
16292
|
-
auth: "admin",
|
|
16293
|
-
caller: "required"
|
|
16294
|
-
}),
|
|
16295
|
-
updateRule: method(object({
|
|
16296
|
-
ruleId: string(),
|
|
16297
|
-
patch: NcRulePatchSchema
|
|
16298
|
-
}), object({ rule: NcRuleSchema }), {
|
|
16299
|
-
kind: "mutation",
|
|
16300
|
-
auth: "admin",
|
|
16301
|
-
caller: "required"
|
|
16302
|
-
}),
|
|
16303
|
-
deleteRule: method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
16304
|
-
kind: "mutation",
|
|
16305
|
-
auth: "admin"
|
|
16306
|
-
}),
|
|
16307
|
-
setRuleEnabled: method(object({
|
|
16308
|
-
ruleId: string(),
|
|
16309
|
-
enabled: boolean()
|
|
16310
|
-
}), object({ success: literal(true) }), {
|
|
16311
|
-
kind: "mutation",
|
|
16312
|
-
auth: "admin"
|
|
16313
|
-
}),
|
|
16314
|
-
/**
|
|
16315
|
-
* Dry-run a rule against recently persisted records (object events for
|
|
16316
|
-
* `immediate`, closed tracks for `track-end`). Mutation kind only to
|
|
16317
|
-
* carry the full rule object safely; no side effects.
|
|
16318
|
-
*/
|
|
16319
|
-
testRule: method(object({
|
|
16320
|
-
rule: NcRuleInputSchema,
|
|
16321
|
-
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
16322
|
-
}), object({ results: array(NcTestResultSchema) }), {
|
|
16323
|
-
kind: "mutation",
|
|
16324
|
-
auth: "admin"
|
|
16325
|
-
}),
|
|
16326
|
-
getConditionCatalog: method(object({}), object({ catalog: array(NcConditionDescriptorSchema) }))
|
|
16327
|
-
}
|
|
16328
|
-
};
|
|
16329
|
-
/**
|
|
16330
|
-
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
16331
|
-
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
16332
|
-
* caps stay wire-compatible without a circular cap→cap import.
|
|
16333
|
-
*
|
|
16334
|
-
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
16335
|
-
* every transport tier structurally, and failed calls still write usage rows.
|
|
16336
|
-
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
16337
|
-
*/
|
|
16338
|
-
var LlmUsageSchema = object({
|
|
16339
|
-
inputTokens: number(),
|
|
16340
|
-
outputTokens: number()
|
|
16341
|
-
});
|
|
16342
|
-
var LlmErrorCodeSchema = _enum([
|
|
16343
|
-
"timeout",
|
|
16344
|
-
"rate-limited",
|
|
16345
|
-
"auth",
|
|
16346
|
-
"refusal",
|
|
16347
|
-
"bad-request",
|
|
16348
|
-
"unavailable",
|
|
16349
|
-
"no-profile",
|
|
16350
|
-
"budget-exceeded",
|
|
16351
|
-
"adapter-error"
|
|
16352
|
-
]);
|
|
16353
|
-
var LlmGenerateResultSchema = discriminatedUnion("ok", [object({
|
|
16354
|
-
ok: literal(true),
|
|
16355
|
-
text: string(),
|
|
16356
|
-
model: string(),
|
|
16357
|
-
usage: LlmUsageSchema,
|
|
16358
|
-
truncated: boolean(),
|
|
16359
|
-
latencyMs: number()
|
|
16360
|
-
}), object({
|
|
16361
|
-
ok: literal(false),
|
|
16362
|
-
code: LlmErrorCodeSchema,
|
|
16363
|
-
message: string(),
|
|
16364
|
-
retryAfterMs: number().optional()
|
|
16365
|
-
})]);
|
|
16366
|
-
/**
|
|
16367
|
-
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
16368
|
-
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
16369
|
-
* notification-output.cap.ts:27-31 precedents).
|
|
16370
|
-
*/
|
|
16371
|
-
var LlmImageSchema = object({
|
|
16372
|
-
bytes: _instanceof(Uint8Array),
|
|
16373
|
-
mimeType: string()
|
|
16374
|
-
});
|
|
16375
|
-
var LlmGenerateBaseInputSchema = object({
|
|
16376
|
-
/** Collection routing (the notification-output posture). */
|
|
16377
|
-
addonId: string().optional(),
|
|
16378
|
-
/** Explicit profile; else the resolution chain (spec §3). */
|
|
16379
|
-
profileId: string().optional(),
|
|
16380
|
-
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
16381
|
-
consumer: string(),
|
|
16382
|
-
system: string().optional(),
|
|
16383
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
16384
|
-
prompt: string(),
|
|
16385
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
16386
|
-
jsonSchema: record(string(), unknown()).optional(),
|
|
16387
|
-
/** Per-call override of the profile default. */
|
|
16388
|
-
maxTokens: number().int().positive().optional(),
|
|
16389
|
-
temperature: number().optional()
|
|
16390
|
-
});
|
|
16884
|
+
];
|
|
16391
16885
|
/**
|
|
16392
|
-
*
|
|
16393
|
-
*
|
|
16394
|
-
*
|
|
16395
|
-
*
|
|
16396
|
-
*
|
|
16886
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
16887
|
+
* durable outbox row's own status (single source of truth):
|
|
16888
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
16889
|
+
* - `sent` — delivered (terminal)
|
|
16890
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
16891
|
+
* backend rejection / a deleted target (terminal; carries
|
|
16892
|
+
* the failure `error`)
|
|
16397
16893
|
*
|
|
16398
|
-
*
|
|
16399
|
-
*
|
|
16400
|
-
* watchdog — operator decision #3).
|
|
16894
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
16895
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
16401
16896
|
*/
|
|
16402
|
-
var
|
|
16403
|
-
|
|
16404
|
-
|
|
16405
|
-
|
|
16406
|
-
}),
|
|
16407
|
-
object({
|
|
16408
|
-
kind: literal("url"),
|
|
16409
|
-
url: string(),
|
|
16410
|
-
sha256: string().optional()
|
|
16411
|
-
}),
|
|
16412
|
-
object({
|
|
16413
|
-
kind: literal("path"),
|
|
16414
|
-
path: string()
|
|
16415
|
-
})
|
|
16897
|
+
var NcHistoryStatusSchema = _enum([
|
|
16898
|
+
"pending",
|
|
16899
|
+
"sent",
|
|
16900
|
+
"dead"
|
|
16416
16901
|
]);
|
|
16417
|
-
|
|
16418
|
-
|
|
16419
|
-
|
|
16420
|
-
|
|
16421
|
-
|
|
16422
|
-
|
|
16423
|
-
|
|
16424
|
-
|
|
16425
|
-
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
|
|
16429
|
-
|
|
16430
|
-
|
|
16431
|
-
autoStart: boolean().default(false),
|
|
16432
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
16433
|
-
idleStopMinutes: number().int().default(30)
|
|
16434
|
-
});
|
|
16435
|
-
var LlmRuntimeStatusSchema = object({
|
|
16436
|
-
/** Status is ALWAYS node-qualified. */
|
|
16437
|
-
nodeId: string(),
|
|
16438
|
-
state: _enum([
|
|
16439
|
-
"stopped",
|
|
16440
|
-
"downloading",
|
|
16441
|
-
"starting",
|
|
16442
|
-
"ready",
|
|
16443
|
-
"crashed",
|
|
16444
|
-
"failed"
|
|
16445
|
-
]),
|
|
16446
|
-
pid: number().optional(),
|
|
16447
|
-
port: number().optional(),
|
|
16448
|
-
modelPath: string().optional(),
|
|
16449
|
-
modelId: string().optional(),
|
|
16450
|
-
downloadProgress: number().min(0).max(1).optional(),
|
|
16451
|
-
lastError: string().optional(),
|
|
16452
|
-
crashesInWindow: number(),
|
|
16453
|
-
/** Child RSS (sampled best-effort). */
|
|
16454
|
-
memoryBytes: number().optional(),
|
|
16455
|
-
vramBytes: number().optional()
|
|
16456
|
-
});
|
|
16457
|
-
var LlmNodeModelSchema = object({
|
|
16458
|
-
file: string(),
|
|
16459
|
-
sizeBytes: number(),
|
|
16460
|
-
catalogId: string().optional(),
|
|
16461
|
-
installedAt: number().optional()
|
|
16462
|
-
});
|
|
16463
|
-
var LlmRuntimeDiskUsageSchema = object({
|
|
16464
|
-
nodeId: string(),
|
|
16465
|
-
modelsBytes: number(),
|
|
16466
|
-
freeBytes: number().optional()
|
|
16902
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
16903
|
+
var NcHistoryRecordKindSchema = _enum([
|
|
16904
|
+
"object-event",
|
|
16905
|
+
"track-end",
|
|
16906
|
+
"device-event",
|
|
16907
|
+
"package-event"
|
|
16908
|
+
]);
|
|
16909
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
16910
|
+
var NcHistorySubjectSchema = object({
|
|
16911
|
+
className: string(),
|
|
16912
|
+
label: string().optional(),
|
|
16913
|
+
confidence: number().optional(),
|
|
16914
|
+
zones: array(string()),
|
|
16915
|
+
timestamp: number()
|
|
16467
16916
|
});
|
|
16468
|
-
method(LlmGenerateBaseInputSchema.extend({
|
|
16469
|
-
images: array(LlmImageSchema).optional(),
|
|
16470
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
16471
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
16472
|
-
timeoutMs: number().int().positive().optional()
|
|
16473
|
-
}), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
16474
|
-
kind: "mutation",
|
|
16475
|
-
auth: "admin"
|
|
16476
|
-
}), method(object({}), _void(), {
|
|
16477
|
-
kind: "mutation",
|
|
16478
|
-
auth: "admin"
|
|
16479
|
-
}), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
|
|
16480
|
-
kind: "mutation",
|
|
16481
|
-
auth: "admin"
|
|
16482
|
-
}), method(object({ file: string() }), _void(), {
|
|
16483
|
-
kind: "mutation",
|
|
16484
|
-
auth: "admin"
|
|
16485
|
-
}), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
|
|
16486
16917
|
/**
|
|
16487
|
-
*
|
|
16488
|
-
*
|
|
16489
|
-
*
|
|
16490
|
-
*
|
|
16491
|
-
*
|
|
16492
|
-
*
|
|
16493
|
-
*
|
|
16494
|
-
* `
|
|
16495
|
-
*
|
|
16918
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
16919
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
16920
|
+
* NO second write path, so history can never drift from delivery state).
|
|
16921
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
16922
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
16923
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
16924
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
16925
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
16926
|
+
* P1 (admin scope only).
|
|
16496
16927
|
*/
|
|
16497
|
-
var
|
|
16498
|
-
|
|
16499
|
-
"openai",
|
|
16500
|
-
"anthropic",
|
|
16501
|
-
"google",
|
|
16502
|
-
"managed-local"
|
|
16503
|
-
]);
|
|
16504
|
-
var LlmProfileSchema = object({
|
|
16505
|
-
id: string(),
|
|
16506
|
-
name: string(),
|
|
16507
|
-
kind: LlmProfileKindSchema,
|
|
16508
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
16509
|
-
addonId: string(),
|
|
16510
|
-
enabled: boolean(),
|
|
16511
|
-
/** Vendor model id, or the managed runtime's loaded model. */
|
|
16512
|
-
model: string(),
|
|
16513
|
-
/** Required for openai-compatible; override for cloud kinds. */
|
|
16514
|
-
baseUrl: string().optional(),
|
|
16515
|
-
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
16516
|
-
apiKey: string().optional(),
|
|
16517
|
-
supportsVision: boolean(),
|
|
16518
|
-
temperature: number().min(0).max(2).optional(),
|
|
16519
|
-
maxTokens: number().int().positive().optional(),
|
|
16520
|
-
timeoutMs: number().int().positive().default(6e4),
|
|
16521
|
-
extraHeaders: record(string(), string()).optional(),
|
|
16522
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
16523
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
16524
|
-
});
|
|
16525
|
-
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
16526
|
-
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
16527
|
-
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
16528
|
-
var ConfigSchemaPassthrough = unknown();
|
|
16529
|
-
var LlmProfileKindDescriptorSchema = object({
|
|
16530
|
-
kind: LlmProfileKindSchema,
|
|
16531
|
-
label: string(),
|
|
16532
|
-
icon: string(),
|
|
16533
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16534
|
-
addonId: string(),
|
|
16535
|
-
configSchema: ConfigSchemaPassthrough
|
|
16536
|
-
});
|
|
16537
|
-
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
16538
|
-
var LlmDefaultSchema = object({
|
|
16539
|
-
selector: LlmDefaultSelectorSchema,
|
|
16540
|
-
profileId: string()
|
|
16541
|
-
});
|
|
16542
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
16543
|
-
var LlmUsageRollupSchema = object({
|
|
16544
|
-
day: string(),
|
|
16545
|
-
consumer: string(),
|
|
16546
|
-
profileId: string(),
|
|
16547
|
-
calls: number(),
|
|
16548
|
-
okCalls: number(),
|
|
16549
|
-
errorCalls: number(),
|
|
16550
|
-
inputTokens: number(),
|
|
16551
|
-
outputTokens: number(),
|
|
16552
|
-
avgLatencyMs: number()
|
|
16553
|
-
});
|
|
16554
|
-
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
16555
|
-
var ManagedModelCatalogEntrySchema = object({
|
|
16928
|
+
var NcHistoryEntrySchema = object({
|
|
16929
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
16556
16930
|
id: string(),
|
|
16557
|
-
|
|
16558
|
-
|
|
16559
|
-
|
|
16560
|
-
|
|
16561
|
-
|
|
16562
|
-
|
|
16563
|
-
|
|
16564
|
-
|
|
16565
|
-
|
|
16566
|
-
|
|
16567
|
-
/**
|
|
16568
|
-
|
|
16569
|
-
|
|
16570
|
-
|
|
16571
|
-
|
|
16572
|
-
|
|
16573
|
-
|
|
16574
|
-
|
|
16575
|
-
|
|
16576
|
-
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
addonId: string(),
|
|
16580
|
-
profileId: string()
|
|
16931
|
+
ruleId: string(),
|
|
16932
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
16933
|
+
ruleName: string(),
|
|
16934
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
16935
|
+
delivery: NcDeliverySchema,
|
|
16936
|
+
targetId: string(),
|
|
16937
|
+
deviceId: number(),
|
|
16938
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
16939
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
16940
|
+
recordId: string(),
|
|
16941
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
16942
|
+
trackId: string().optional(),
|
|
16943
|
+
status: NcHistoryStatusSchema,
|
|
16944
|
+
/** Delivery attempts made so far. */
|
|
16945
|
+
attempts: number().int(),
|
|
16946
|
+
/** Fire time (outbox enqueue). */
|
|
16947
|
+
createdAt: number(),
|
|
16948
|
+
/** Last transition time (terminal for sent / dead). */
|
|
16949
|
+
updatedAt: number(),
|
|
16950
|
+
/** Failure detail — present on a `dead` row. */
|
|
16951
|
+
error: string().optional(),
|
|
16952
|
+
subject: NcHistorySubjectSchema
|
|
16581
16953
|
});
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
selector: LlmDefaultSelectorSchema,
|
|
16593
|
-
profileId: string().nullable()
|
|
16594
|
-
}), _void(), {
|
|
16595
|
-
kind: "mutation",
|
|
16596
|
-
auth: "admin"
|
|
16597
|
-
}), method(object({
|
|
16954
|
+
/**
|
|
16955
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
16956
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
16957
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
16958
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
16959
|
+
*/
|
|
16960
|
+
var NcHistoryFilterSchema = object({
|
|
16961
|
+
ruleId: string().optional(),
|
|
16962
|
+
deviceId: number().optional(),
|
|
16963
|
+
status: NcHistoryStatusSchema.optional(),
|
|
16598
16964
|
since: number().optional(),
|
|
16599
16965
|
until: number().optional(),
|
|
16600
|
-
|
|
16601
|
-
profileId: string().optional()
|
|
16602
|
-
}), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
|
|
16603
|
-
nodeId: string(),
|
|
16604
|
-
model: ManagedModelRefSchema
|
|
16605
|
-
}), _void(), {
|
|
16606
|
-
kind: "mutation",
|
|
16607
|
-
auth: "admin"
|
|
16608
|
-
}), method(object({
|
|
16609
|
-
nodeId: string(),
|
|
16610
|
-
file: string()
|
|
16611
|
-
}), _void(), {
|
|
16612
|
-
kind: "mutation",
|
|
16613
|
-
auth: "admin"
|
|
16614
|
-
}), method(ProfileRefInputSchema, LlmRuntimeStatusSchema), method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
16615
|
-
kind: "mutation",
|
|
16616
|
-
auth: "admin"
|
|
16617
|
-
}), method(ProfileRefInputSchema, _void(), {
|
|
16618
|
-
kind: "mutation",
|
|
16619
|
-
auth: "admin"
|
|
16966
|
+
limit: number().int().min(1).max(500).default(100)
|
|
16620
16967
|
});
|
|
16968
|
+
var notificationRulesCapability = {
|
|
16969
|
+
name: "notification-rules",
|
|
16970
|
+
scope: "system",
|
|
16971
|
+
mode: "singleton",
|
|
16972
|
+
methods: {
|
|
16973
|
+
listRules: method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }),
|
|
16974
|
+
getRule: method(object({ ruleId: string() }), object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }),
|
|
16975
|
+
createRule: method(object({ rule: NcRuleInputSchema }), object({ rule: NcRuleSchema }), {
|
|
16976
|
+
kind: "mutation",
|
|
16977
|
+
auth: "admin",
|
|
16978
|
+
caller: "required"
|
|
16979
|
+
}),
|
|
16980
|
+
updateRule: method(object({
|
|
16981
|
+
ruleId: string(),
|
|
16982
|
+
patch: NcRulePatchSchema
|
|
16983
|
+
}), object({ rule: NcRuleSchema }), {
|
|
16984
|
+
kind: "mutation",
|
|
16985
|
+
auth: "admin",
|
|
16986
|
+
caller: "required"
|
|
16987
|
+
}),
|
|
16988
|
+
deleteRule: method(object({ ruleId: string() }), object({ success: literal(true) }), {
|
|
16989
|
+
kind: "mutation",
|
|
16990
|
+
auth: "admin"
|
|
16991
|
+
}),
|
|
16992
|
+
setRuleEnabled: method(object({
|
|
16993
|
+
ruleId: string(),
|
|
16994
|
+
enabled: boolean()
|
|
16995
|
+
}), object({ success: literal(true) }), {
|
|
16996
|
+
kind: "mutation",
|
|
16997
|
+
auth: "admin"
|
|
16998
|
+
}),
|
|
16999
|
+
/**
|
|
17000
|
+
* Dry-run a rule against recently persisted records (object events for
|
|
17001
|
+
* `immediate`, closed tracks for `track-end`). Mutation kind only to
|
|
17002
|
+
* carry the full rule object safely; no side effects.
|
|
17003
|
+
*/
|
|
17004
|
+
testRule: method(object({
|
|
17005
|
+
rule: NcRuleInputSchema,
|
|
17006
|
+
lookbackMinutes: number().int().min(1).max(1440).default(60)
|
|
17007
|
+
}), object({ results: array(NcTestResultSchema) }), {
|
|
17008
|
+
kind: "mutation",
|
|
17009
|
+
auth: "admin"
|
|
17010
|
+
}),
|
|
17011
|
+
getConditionCatalog: method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })),
|
|
17012
|
+
/**
|
|
17013
|
+
* Queryable delivery history — a read-only view over the durable outbox
|
|
17014
|
+
* (fired rule, subject summary, target, status, timestamps, error on a
|
|
17015
|
+
* dead row). Newest-first, bounded by `filter.limit`. Retention follows
|
|
17016
|
+
* the outbox's own terminal-row prune horizon (no separate history
|
|
17017
|
+
* horizon — single collection, single source of truth). Admin-only in
|
|
17018
|
+
* P1 (no user dimension); the P2 viewer History screen adds per-caller
|
|
17019
|
+
* scoping on the same method.
|
|
17020
|
+
*/
|
|
17021
|
+
getHistory: method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" })
|
|
17022
|
+
}
|
|
17023
|
+
};
|
|
16621
17024
|
/**
|
|
16622
17025
|
* Zod schemas for persisted record types.
|
|
16623
17026
|
*
|
|
@@ -17482,106 +17885,6 @@ var pipelineAnalyticsCapability = {
|
|
|
17482
17885
|
}) }
|
|
17483
17886
|
}
|
|
17484
17887
|
};
|
|
17485
|
-
/**
|
|
17486
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
17487
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
17488
|
-
* caps into per-camera event-kind descriptors.
|
|
17489
|
-
*
|
|
17490
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
17491
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
17492
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
17493
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
17494
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
17495
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
17496
|
-
* eventful cap is missing.
|
|
17497
|
-
*/
|
|
17498
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
17499
|
-
var LEGACY_ICON = {
|
|
17500
|
-
motion: "motion",
|
|
17501
|
-
audio: "audio",
|
|
17502
|
-
person: "person",
|
|
17503
|
-
vehicle: "vehicle",
|
|
17504
|
-
animal: "animal",
|
|
17505
|
-
package: "package",
|
|
17506
|
-
door: "door",
|
|
17507
|
-
pir: "pir",
|
|
17508
|
-
smoke: "smoke",
|
|
17509
|
-
water: "water",
|
|
17510
|
-
button: "button",
|
|
17511
|
-
generic: "generic",
|
|
17512
|
-
gas: "smoke",
|
|
17513
|
-
vibration: "generic",
|
|
17514
|
-
tamper: "generic",
|
|
17515
|
-
presence: "person",
|
|
17516
|
-
lock: "generic",
|
|
17517
|
-
siren: "generic",
|
|
17518
|
-
switch: "generic",
|
|
17519
|
-
doorbell: "button"
|
|
17520
|
-
};
|
|
17521
|
-
function legacyIcon(iconId) {
|
|
17522
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
17523
|
-
}
|
|
17524
|
-
/**
|
|
17525
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
17526
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
17527
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
17528
|
-
*/
|
|
17529
|
-
var CAP_TO_KIND = {
|
|
17530
|
-
contact: "contact",
|
|
17531
|
-
motion: "motion-sensor",
|
|
17532
|
-
smoke: "smoke",
|
|
17533
|
-
flood: "flood",
|
|
17534
|
-
gas: "gas",
|
|
17535
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
17536
|
-
vibration: "vibration",
|
|
17537
|
-
tamper: "tamper",
|
|
17538
|
-
presence: "presence",
|
|
17539
|
-
"enum-sensor": "enum-sensor",
|
|
17540
|
-
"event-emitter": "device-event",
|
|
17541
|
-
"lock-control": "lock",
|
|
17542
|
-
switch: "switch",
|
|
17543
|
-
button: "button",
|
|
17544
|
-
doorbell: "doorbell"
|
|
17545
|
-
};
|
|
17546
|
-
function buildDescriptor(capName, kind) {
|
|
17547
|
-
const t = EVENT_TAXONOMY[kind];
|
|
17548
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
17549
|
-
return {
|
|
17550
|
-
...t,
|
|
17551
|
-
icon: legacyIcon(t.iconId)
|
|
17552
|
-
};
|
|
17553
|
-
}
|
|
17554
|
-
/**
|
|
17555
|
-
* Sensor / control cap name → static event-kind descriptor. A linked device
|
|
17556
|
-
* contributes one entry per bound cap present in this map.
|
|
17557
|
-
*/
|
|
17558
|
-
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
17559
|
-
/**
|
|
17560
|
-
* Build a full `EventKindDescriptor` for a taxonomy `kind`, stamping the
|
|
17561
|
-
* per-device `source`. Returns null when `kind` is not in the taxonomy.
|
|
17562
|
-
* This is THE bridge from the serializable taxonomy dictionary to the cap
|
|
17563
|
-
* wire shape — every event-kind descriptor the server emits goes through it,
|
|
17564
|
-
* so color/iconId/labelKey are never re-declared at a call site.
|
|
17565
|
-
*/
|
|
17566
|
-
function buildEventKindDescriptor(kind, source) {
|
|
17567
|
-
const t = EVENT_TAXONOMY[kind];
|
|
17568
|
-
if (t === void 0) return null;
|
|
17569
|
-
return {
|
|
17570
|
-
kind: t.kind,
|
|
17571
|
-
labelKey: t.labelKey,
|
|
17572
|
-
label: t.label,
|
|
17573
|
-
color: t.color,
|
|
17574
|
-
iconId: t.iconId,
|
|
17575
|
-
icon: legacyIcon(t.iconId),
|
|
17576
|
-
category: t.category,
|
|
17577
|
-
parentKind: t.parentKind,
|
|
17578
|
-
level: t.level,
|
|
17579
|
-
source: {
|
|
17580
|
-
capName: source.capName,
|
|
17581
|
-
deviceId: source.deviceId
|
|
17582
|
-
}
|
|
17583
|
-
};
|
|
17584
|
-
}
|
|
17585
17888
|
var CameraPipelineConfigSchema = object({
|
|
17586
17889
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
17587
17890
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -18067,6 +18370,106 @@ method(object({
|
|
|
18067
18370
|
auth: "admin"
|
|
18068
18371
|
});
|
|
18069
18372
|
/**
|
|
18373
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
18374
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
18375
|
+
* caps into per-camera event-kind descriptors.
|
|
18376
|
+
*
|
|
18377
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
18378
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
18379
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
18380
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
18381
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
18382
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
18383
|
+
* eventful cap is missing.
|
|
18384
|
+
*/
|
|
18385
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
18386
|
+
var LEGACY_ICON = {
|
|
18387
|
+
motion: "motion",
|
|
18388
|
+
audio: "audio",
|
|
18389
|
+
person: "person",
|
|
18390
|
+
vehicle: "vehicle",
|
|
18391
|
+
animal: "animal",
|
|
18392
|
+
package: "package",
|
|
18393
|
+
door: "door",
|
|
18394
|
+
pir: "pir",
|
|
18395
|
+
smoke: "smoke",
|
|
18396
|
+
water: "water",
|
|
18397
|
+
button: "button",
|
|
18398
|
+
generic: "generic",
|
|
18399
|
+
gas: "smoke",
|
|
18400
|
+
vibration: "generic",
|
|
18401
|
+
tamper: "generic",
|
|
18402
|
+
presence: "person",
|
|
18403
|
+
lock: "generic",
|
|
18404
|
+
siren: "generic",
|
|
18405
|
+
switch: "generic",
|
|
18406
|
+
doorbell: "button"
|
|
18407
|
+
};
|
|
18408
|
+
function legacyIcon(iconId) {
|
|
18409
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
18410
|
+
}
|
|
18411
|
+
/**
|
|
18412
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
18413
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
18414
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
18415
|
+
*/
|
|
18416
|
+
var CAP_TO_KIND = {
|
|
18417
|
+
contact: "contact",
|
|
18418
|
+
motion: "motion-sensor",
|
|
18419
|
+
smoke: "smoke",
|
|
18420
|
+
flood: "flood",
|
|
18421
|
+
gas: "gas",
|
|
18422
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
18423
|
+
vibration: "vibration",
|
|
18424
|
+
tamper: "tamper",
|
|
18425
|
+
presence: "presence",
|
|
18426
|
+
"enum-sensor": "enum-sensor",
|
|
18427
|
+
"event-emitter": "device-event",
|
|
18428
|
+
"lock-control": "lock",
|
|
18429
|
+
switch: "switch",
|
|
18430
|
+
button: "button",
|
|
18431
|
+
doorbell: "doorbell"
|
|
18432
|
+
};
|
|
18433
|
+
function buildDescriptor(capName, kind) {
|
|
18434
|
+
const t = EVENT_TAXONOMY[kind];
|
|
18435
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
18436
|
+
return {
|
|
18437
|
+
...t,
|
|
18438
|
+
icon: legacyIcon(t.iconId)
|
|
18439
|
+
};
|
|
18440
|
+
}
|
|
18441
|
+
/**
|
|
18442
|
+
* Sensor / control cap name → static event-kind descriptor. A linked device
|
|
18443
|
+
* contributes one entry per bound cap present in this map.
|
|
18444
|
+
*/
|
|
18445
|
+
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
18446
|
+
/**
|
|
18447
|
+
* Build a full `EventKindDescriptor` for a taxonomy `kind`, stamping the
|
|
18448
|
+
* per-device `source`. Returns null when `kind` is not in the taxonomy.
|
|
18449
|
+
* This is THE bridge from the serializable taxonomy dictionary to the cap
|
|
18450
|
+
* wire shape — every event-kind descriptor the server emits goes through it,
|
|
18451
|
+
* so color/iconId/labelKey are never re-declared at a call site.
|
|
18452
|
+
*/
|
|
18453
|
+
function buildEventKindDescriptor(kind, source) {
|
|
18454
|
+
const t = EVENT_TAXONOMY[kind];
|
|
18455
|
+
if (t === void 0) return null;
|
|
18456
|
+
return {
|
|
18457
|
+
kind: t.kind,
|
|
18458
|
+
labelKey: t.labelKey,
|
|
18459
|
+
label: t.label,
|
|
18460
|
+
color: t.color,
|
|
18461
|
+
iconId: t.iconId,
|
|
18462
|
+
icon: legacyIcon(t.iconId),
|
|
18463
|
+
category: t.category,
|
|
18464
|
+
parentKind: t.parentKind,
|
|
18465
|
+
level: t.level,
|
|
18466
|
+
source: {
|
|
18467
|
+
capName: source.capName,
|
|
18468
|
+
deviceId: source.deviceId
|
|
18469
|
+
}
|
|
18470
|
+
};
|
|
18471
|
+
}
|
|
18472
|
+
/**
|
|
18070
18473
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
18071
18474
|
* package lifecycle (runtime-updatable node packages).
|
|
18072
18475
|
*
|
|
@@ -19531,7 +19934,28 @@ var FaceInfoSchema = object({
|
|
|
19531
19934
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
19532
19935
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
19533
19936
|
* back to the inline `base64` face crop. */
|
|
19534
|
-
keyFrameMediaKey: string().optional()
|
|
19937
|
+
keyFrameMediaKey: string().optional(),
|
|
19938
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
19939
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
19940
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
19941
|
+
* faces that were never auto-recognized. */
|
|
19942
|
+
bestMatchScore: number().optional(),
|
|
19943
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
19944
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
19945
|
+
* legacy rows / runners that reported no native measure. */
|
|
19946
|
+
nativeFaceShortSidePx: number().optional(),
|
|
19947
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
19948
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
19949
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
19950
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
19951
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
19952
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
19953
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
19954
|
+
suggestedIdentityId: string().optional(),
|
|
19955
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
19956
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
19957
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
19958
|
+
suggestedMatchScore: number().optional()
|
|
19535
19959
|
});
|
|
19536
19960
|
var FaceFilterEnum = _enum([
|
|
19537
19961
|
"unassigned",
|
|
@@ -21634,36 +22058,6 @@ Object.freeze({
|
|
|
21634
22058
|
addonId: null,
|
|
21635
22059
|
access: "view"
|
|
21636
22060
|
},
|
|
21637
|
-
"advancedNotifier.deleteRule": {
|
|
21638
|
-
capName: "advanced-notifier",
|
|
21639
|
-
capScope: "system",
|
|
21640
|
-
addonId: null,
|
|
21641
|
-
access: "delete"
|
|
21642
|
-
},
|
|
21643
|
-
"advancedNotifier.getHistory": {
|
|
21644
|
-
capName: "advanced-notifier",
|
|
21645
|
-
capScope: "system",
|
|
21646
|
-
addonId: null,
|
|
21647
|
-
access: "view"
|
|
21648
|
-
},
|
|
21649
|
-
"advancedNotifier.getRules": {
|
|
21650
|
-
capName: "advanced-notifier",
|
|
21651
|
-
capScope: "system",
|
|
21652
|
-
addonId: null,
|
|
21653
|
-
access: "view"
|
|
21654
|
-
},
|
|
21655
|
-
"advancedNotifier.testRule": {
|
|
21656
|
-
capName: "advanced-notifier",
|
|
21657
|
-
capScope: "system",
|
|
21658
|
-
addonId: null,
|
|
21659
|
-
access: "create"
|
|
21660
|
-
},
|
|
21661
|
-
"advancedNotifier.upsertRule": {
|
|
21662
|
-
capName: "advanced-notifier",
|
|
21663
|
-
capScope: "system",
|
|
21664
|
-
addonId: null,
|
|
21665
|
-
access: "create"
|
|
21666
|
-
},
|
|
21667
22061
|
"alarmPanel.arm": {
|
|
21668
22062
|
capName: "alarm-panel",
|
|
21669
22063
|
capScope: "device",
|
|
@@ -23986,6 +24380,12 @@ Object.freeze({
|
|
|
23986
24380
|
addonId: null,
|
|
23987
24381
|
access: "view"
|
|
23988
24382
|
},
|
|
24383
|
+
"notificationRules.getHistory": {
|
|
24384
|
+
capName: "notification-rules",
|
|
24385
|
+
capScope: "system",
|
|
24386
|
+
addonId: null,
|
|
24387
|
+
access: "view"
|
|
24388
|
+
},
|
|
23989
24389
|
"notificationRules.getRule": {
|
|
23990
24390
|
capName: "notification-rules",
|
|
23991
24391
|
capScope: "system",
|
|
@@ -26229,4 +26629,4 @@ Object.freeze({
|
|
|
26229
26629
|
"smtp-provider": "email"
|
|
26230
26630
|
});
|
|
26231
26631
|
//#endregion
|
|
26232
|
-
export {
|
|
26632
|
+
export { BaseAddon as A, EventCategory as B, notificationRulesCapability as C, videoclipsCapability as D, subKindsOf as E, boolean as F, literal as I, number as L, createEvent as M, hydrateSchema as N, zoneAnalyticsCapability as O, array as P, object as R, nodePin as S, plateGalleryCapability as T, customAction as _, NC_CONDITION_CATALOG as a, faceGalleryCapability as b, NcRuleInputSchema as c, NcTaxonomySchema as d, OpsLogEntrySchema as f, cosineSimilarity as g, buildEventKindDescriptor as h, MACRO_LABELS as i, DeviceType as j, errMsg as k, NcRulePatchSchema as l, audioMetricsCapability as m, EVENT_KIND_BY_CAP as n, NC_TAXONOMY as o, addonWidgetsSourceCapability as p, EVENT_PAD_MS as r, NcConditionDescriptorSchema as s, DEFAULT_EVENT_COLOR as t, NcRuleSchema as u, defineCustomActions as v, pipelineAnalyticsCapability as w, hfModelUrl as x, embeddingEncoderCapability as y, string as z };
|