@camstack/types 1.2.7 → 1.2.9

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.
Files changed (34) hide show
  1. package/dist/addon.js +2 -2
  2. package/dist/addon.mjs +2 -2
  3. package/dist/capabilities/capability-definition.d.ts +74 -3
  4. package/dist/capabilities/custom-actions.d.ts +19 -0
  5. package/dist/capabilities/day-night.cap.d.ts +8 -8
  6. package/dist/capabilities/face-gallery.cap.d.ts +12 -0
  7. package/dist/capabilities/index.d.ts +29 -30
  8. package/dist/capabilities/notification-rules.cap.d.ts +1601 -0
  9. package/dist/capabilities/notifier.cap.d.ts +3 -3
  10. package/dist/capabilities/pipeline-analytics.cap.d.ts +8 -8
  11. package/dist/capabilities/recording.cap.d.ts +2 -2
  12. package/dist/capabilities/toast.cap.d.ts +2 -2
  13. package/dist/catalogs/nc-taxonomy.d.ts +53 -0
  14. package/dist/enums/event-category.d.ts +0 -3
  15. package/dist/enums.js +1 -1
  16. package/dist/enums.mjs +1 -1
  17. package/dist/{event-category-D4HJq7Mw.mjs → event-category-BLcNejAE.mjs} +0 -3
  18. package/dist/{event-category-CGj9fI4L.js → event-category-Cdyife4p.js} +0 -3
  19. package/dist/generated/addon-api.d.ts +1437 -367
  20. package/dist/generated/capability-router-map.d.ts +4 -4
  21. package/dist/generated/method-access-map.d.ts +1 -1
  22. package/dist/generated/system-proxy.d.ts +2 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +2154 -1343
  25. package/dist/index.mjs +2125 -1341
  26. package/dist/interfaces/addon.d.ts +2 -2
  27. package/dist/interfaces/capability.d.ts +0 -1
  28. package/dist/interfaces/event-bus.d.ts +0 -16
  29. package/dist/interfaces/ops-log.d.ts +2 -2
  30. package/dist/{sleep-eVjOy4ev.js → sleep-BG8hQTA8.js} +2 -2
  31. package/dist/{sleep-BQ60XlE9.mjs → sleep-DiOnzenz.mjs} +2 -2
  32. package/package.json +1 -1
  33. package/dist/capabilities/advanced-notifier.cap.d.ts +0 -256
  34. package/dist/interfaces/advanced-notifier.d.ts +0 -73
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as StreamSourceSchema, A as parseJsonUnknown, B as CamProfileSchema, C as asBoolean, D as asString, E as asNumber, F as readinessKey, G as DecodedFrameSchema, H as CamStreamResolutionSchema, I as scopeKey, J as FrameHandleSchema, K as EncodedPacketSchema, L as BrokerStatsSchema, M as ReadinessRegistry, N as ReadinessTimeoutError, O as parseJsonArray, P as emitDownForOwnedCaps, Q as StreamSourceEntrySchema, R as BrokerStatusSchema, S as DeviceType, T as asJsonObject, U as CameraStreamSchema, V as CamStreamKindSchema, W as DecodedAudioChunkSchema, X as ProfileSlotSchema, Y as ProfileRtspEntrySchema, Z as ProfileSlotStatusSchema, _ as resolveCapMount, _t as collectHydratedFieldValues, a as viewerUiCapability, at as makeSourceBrokerId, b as DeviceFeature, bt as DisposerChain, c as createLazyTrpcSource, ct as BaseAddon, d as DEVICE_SETTINGS_CONTRIBUTION_METHODS, dt as createEvent, et as SubscribeAudioChunksInputSchema, f as DEVICE_STATUS_METHOD, ft as emitReadiness, g as method, gt as collectHydratedFieldEntries, h as isDeviceConfigCap, ht as WELL_KNOWN_TAB_MAP, i as deviceOpsCapability, it as makeProfileBrokerId, j as DATAPLANE_SECRET_HEADER, k as parseJsonObject, l as createMirrorSource, lt as normalizeAddonInitResult, m as expandCapMethods, mt as WELL_KNOWN_TABS, n as sleepCancellable, nt as SubscribeFramesInputSchema, o as adminUiCapability, ot as parseProfileBrokerId, p as event, pt as isEvent, q as FrameHandleFormatSchema, r as RawStateResultSchema, rt as SubscribeFramesResultSchema, s as createDeviceProxy, st as selectAssignedProfileSlots, t as sleep, tt as SubscribeAudioChunksResultSchema, u as createSliceHandle, ut as createDurableState, v as systemMethod, vt as hydrateSchema, w as asJsonArray, x as DeviceRole, y as ChargingStatus, yt as resolveHydratedFieldValue, z as CAM_PROFILE_ORDER } from "./sleep-BQ60XlE9.mjs";
2
- import { t as EventCategory } from "./event-category-D4HJq7Mw.mjs";
1
+ import { $ as StreamSourceSchema, A as parseJsonUnknown, B as CamProfileSchema, C as asBoolean, D as asString, E as asNumber, F as readinessKey, G as DecodedFrameSchema, H as CamStreamResolutionSchema, I as scopeKey, J as FrameHandleSchema, K as EncodedPacketSchema, L as BrokerStatsSchema, M as ReadinessRegistry, N as ReadinessTimeoutError, O as parseJsonArray, P as emitDownForOwnedCaps, Q as StreamSourceEntrySchema, R as BrokerStatusSchema, S as DeviceType, T as asJsonObject, U as CameraStreamSchema, V as CamStreamKindSchema, W as DecodedAudioChunkSchema, X as ProfileSlotSchema, Y as ProfileRtspEntrySchema, Z as ProfileSlotStatusSchema, _ as resolveCapMount, _t as collectHydratedFieldValues, a as viewerUiCapability, at as makeSourceBrokerId, b as DeviceFeature, bt as DisposerChain, c as createLazyTrpcSource, ct as BaseAddon, d as DEVICE_SETTINGS_CONTRIBUTION_METHODS, dt as createEvent, et as SubscribeAudioChunksInputSchema, f as DEVICE_STATUS_METHOD, ft as emitReadiness, g as method, gt as collectHydratedFieldEntries, h as isDeviceConfigCap, ht as WELL_KNOWN_TAB_MAP, i as deviceOpsCapability, it as makeProfileBrokerId, j as DATAPLANE_SECRET_HEADER, k as parseJsonObject, l as createMirrorSource, lt as normalizeAddonInitResult, m as expandCapMethods, mt as WELL_KNOWN_TABS, n as sleepCancellable, nt as SubscribeFramesInputSchema, o as adminUiCapability, ot as parseProfileBrokerId, p as event, pt as isEvent, q as FrameHandleFormatSchema, r as RawStateResultSchema, rt as SubscribeFramesResultSchema, s as createDeviceProxy, st as selectAssignedProfileSlots, t as sleep, tt as SubscribeAudioChunksResultSchema, u as createSliceHandle, ut as createDurableState, v as systemMethod, vt as hydrateSchema, w as asJsonArray, x as DeviceRole, y as ChargingStatus, yt as resolveHydratedFieldValue, z as CAM_PROFILE_ORDER } from "./sleep-DiOnzenz.mjs";
2
+ import { t as EventCategory } from "./event-category-BLcNejAE.mjs";
3
3
  import { EventSourceType } from "./enums.mjs";
4
4
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
5
5
  import { z } from "zod";
@@ -2944,6 +2944,63 @@ function subKindsOf(macro) {
2944
2944
  return out;
2945
2945
  }
2946
2946
  //#endregion
2947
+ //#region src/catalogs/nc-taxonomy.ts
2948
+ /**
2949
+ * Notification-Center taxonomy — the fixed vocabulary the NC rule editor
2950
+ * offers as pickers instead of free text. Derived (never hand-listed) from the
2951
+ * single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
2952
+ * taxonomy surface (timeline, filters, event page).
2953
+ *
2954
+ * Three buckets, mapped onto the rule editor's `stringList` conditions:
2955
+ * - `videoClasses` → detection classes (person / vehicle / animal + subs)
2956
+ * for the `classes` / `classesExclude` conditions.
2957
+ * - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
2958
+ * the same class picker, grouped under an Audio header.
2959
+ * - `labels` → sensor + control taxonomy kinds (doorbell / contact /
2960
+ * lock / …) for the `sensorKinds` device-event condition.
2961
+ *
2962
+ * Each entry carries `parentKind` so the client can group video subs under
2963
+ * their macro and sensor/control kinds under their category. This surface is
2964
+ * served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
2965
+ * method, no codegen — so it ships train-free with an addon deploy.
2966
+ */
2967
+ /** One selectable taxonomy value: a stable kind id + display label + parent. */
2968
+ var NcTaxonomyEntrySchema = z.object({
2969
+ /** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
2970
+ kind: z.string(),
2971
+ /** English fallback label (the UI translates via the event-kind i18n key). */
2972
+ label: z.string(),
2973
+ /** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
2974
+ parentKind: z.string().nullable()
2975
+ });
2976
+ /** The complete NC picker taxonomy — three grouped buckets. */
2977
+ var NcTaxonomySchema = z.object({
2978
+ videoClasses: z.array(NcTaxonomyEntrySchema),
2979
+ audioKinds: z.array(NcTaxonomyEntrySchema),
2980
+ labels: z.array(NcTaxonomyEntrySchema)
2981
+ });
2982
+ function toEntry(kind, label, parentKind) {
2983
+ return {
2984
+ kind,
2985
+ label,
2986
+ parentKind
2987
+ };
2988
+ }
2989
+ /**
2990
+ * Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
2991
+ * (macros before their subs), which the client relies on for stable grouping.
2992
+ */
2993
+ function buildNcTaxonomy() {
2994
+ const all = Object.values(EVENT_TAXONOMY);
2995
+ return {
2996
+ videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
2997
+ audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
2998
+ labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
2999
+ };
3000
+ }
3001
+ /** The frozen NC taxonomy, derived once from the taxonomy dictionary. */
3002
+ var NC_TAXONOMY = Object.freeze(buildNcTaxonomy());
3003
+ //#endregion
2947
3004
  //#region src/types/device-type.ts
2948
3005
  var DEVICE_TYPE_INFO = { ["camera"]: {
2949
3006
  type: "camera",
@@ -13574,6 +13631,17 @@ function createSystemProxy(api) {
13574
13631
  deleteTarget: (input) => dispatch("notificationOutput", "deleteTarget", "mutation", input),
13575
13632
  setTargetEnabled: (input) => dispatch("notificationOutput", "setTargetEnabled", "mutation", input)
13576
13633
  },
13634
+ notificationRules: {
13635
+ listRules: (input) => dispatch("notificationRules", "listRules", "query", input),
13636
+ getRule: (input) => dispatch("notificationRules", "getRule", "query", input),
13637
+ createRule: (input) => dispatch("notificationRules", "createRule", "mutation", input),
13638
+ updateRule: (input) => dispatch("notificationRules", "updateRule", "mutation", input),
13639
+ deleteRule: (input) => dispatch("notificationRules", "deleteRule", "mutation", input),
13640
+ setRuleEnabled: (input) => dispatch("notificationRules", "setRuleEnabled", "mutation", input),
13641
+ testRule: (input) => dispatch("notificationRules", "testRule", "mutation", input),
13642
+ getConditionCatalog: (input) => dispatch("notificationRules", "getConditionCatalog", "query", input),
13643
+ getHistory: (input) => dispatch("notificationRules", "getHistory", "query", input)
13644
+ },
13577
13645
  pipelineExecutor: {
13578
13646
  getAvailableEngines: (input) => dispatch("pipelineExecutor", "getAvailableEngines", "query", input),
13579
13647
  getSelectedEngine: (input) => dispatch("pipelineExecutor", "getSelectedEngine", "query", input),
@@ -14842,108 +14910,6 @@ var addonWidgetsCapability = {
14842
14910
  methods: { listWidgets: method(z.void(), z.array(EnrichedWidgetMetadataSchema).readonly()) }
14843
14911
  };
14844
14912
  //#endregion
14845
- //#region src/capabilities/advanced-notifier.cap.ts
14846
- var NotificationRuleConditionsSchema = z.object({
14847
- deviceIds: z.array(z.number()).readonly().optional(),
14848
- classNames: z.array(z.string()).readonly().optional(),
14849
- zoneIds: z.array(z.string()).readonly().optional(),
14850
- minConfidence: z.number().optional(),
14851
- source: z.enum([
14852
- "pipeline",
14853
- "onboard",
14854
- "any"
14855
- ]).optional(),
14856
- schedule: z.object({
14857
- days: z.array(z.number()).readonly(),
14858
- startHour: z.number(),
14859
- endHour: z.number()
14860
- }).optional(),
14861
- cooldownSeconds: z.number().optional(),
14862
- minDwellSeconds: z.number().optional(),
14863
- /** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
14864
- * carrying a matching `data.eventType` string pass this condition. Rules without this field are
14865
- * unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
14866
- eventTypeTokens: z.array(z.string()).readonly().optional(),
14867
- /** Match detections whose CLIP image embedding is semantically similar to this free-text
14868
- * description. Requires the embedding-encoder cap to have pre-warmed the text vector.
14869
- * `minSimilarity` is the cosine similarity threshold in [0, 1]. */
14870
- clipDescription: z.object({
14871
- text: z.string().min(1),
14872
- minSimilarity: z.number().min(0).max(1)
14873
- }).optional(),
14874
- /** Match events whose recognized-entity label (face identity name or plate
14875
- * vehicle name, propagated onto `event.data.label`) is one of these values.
14876
- * Empty/absent → unaffected (back-compat). Enables "notify me when <named
14877
- * vehicle/person> is seen". */
14878
- labels: z.array(z.string()).readonly().optional()
14879
- });
14880
- var NotificationRuleTemplateSchema = z.object({
14881
- title: z.string(),
14882
- body: z.string(),
14883
- imageMode: z.enum([
14884
- "crop",
14885
- "annotated",
14886
- "full",
14887
- "none"
14888
- ])
14889
- });
14890
- var NotificationRuleSchema = z.object({
14891
- id: z.string(),
14892
- name: z.string(),
14893
- enabled: z.boolean(),
14894
- eventTypes: z.array(z.string()).readonly(),
14895
- conditions: NotificationRuleConditionsSchema,
14896
- outputs: z.array(z.string()).readonly(),
14897
- template: NotificationRuleTemplateSchema.optional(),
14898
- priority: z.enum([
14899
- "low",
14900
- "normal",
14901
- "high",
14902
- "critical"
14903
- ])
14904
- });
14905
- var NotificationTestResultSchema = z.object({
14906
- ruleId: z.string(),
14907
- eventId: z.string(),
14908
- timestamp: z.number(),
14909
- wouldFire: z.boolean(),
14910
- reason: z.string().optional()
14911
- });
14912
- var NotificationHistoryEntrySchema = z.object({
14913
- id: z.string(),
14914
- ruleId: z.string(),
14915
- ruleName: z.string(),
14916
- eventId: z.string(),
14917
- timestamp: z.number(),
14918
- outputs: z.array(z.string()).readonly(),
14919
- success: z.boolean(),
14920
- error: z.string().optional(),
14921
- deviceId: z.number().optional()
14922
- });
14923
- var NotificationHistoryFilterSchema = z.object({
14924
- ruleId: z.string().optional(),
14925
- deviceId: z.number().optional(),
14926
- from: z.number().optional(),
14927
- to: z.number().optional(),
14928
- limit: z.number().optional()
14929
- });
14930
- var advancedNotifierCapability = {
14931
- name: "advanced-notifier",
14932
- scope: "system",
14933
- mode: "singleton",
14934
- internal: true,
14935
- methods: {
14936
- getRules: method(z.void(), z.object({ rules: z.array(NotificationRuleSchema).readonly() })),
14937
- upsertRule: method(z.object({ rule: NotificationRuleSchema }), z.object({ success: z.literal(true) }), { kind: "mutation" }),
14938
- deleteRule: method(z.object({ ruleId: z.string() }), z.object({ success: z.literal(true) }), { kind: "mutation" }),
14939
- testRule: method(z.object({
14940
- ruleId: z.string(),
14941
- lookbackMinutes: z.number()
14942
- }), z.object({ results: z.array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }),
14943
- getHistory: method(z.object({ filter: NotificationHistoryFilterSchema.optional() }), z.object({ entries: z.array(NotificationHistoryEntrySchema).readonly() }))
14944
- }
14945
- };
14946
- //#endregion
14947
14913
  //#region src/capabilities/alerts.cap.ts
14948
14914
  /**
14949
14915
  * Alerts capability — collection-based internal alert system.
@@ -15286,119 +15252,6 @@ var authProviderCapability = {
15286
15252
  /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
15287
15253
  mount: { kind: "skip" }
15288
15254
  };
15289
- //#endregion
15290
- //#region src/capabilities/login-method.cap.ts
15291
- /**
15292
- * `login-method` — collection cap through which auth addons contribute
15293
- * their pre-auth login surfaces to the login page. This is the SINGLE,
15294
- * generic mechanism that supersedes the dead `auth.listProviders` reader:
15295
- * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
15296
- * `login-method` provider and the PUBLIC `auth.listLoginMethods`
15297
- * procedure aggregates them for the unauthenticated login page.
15298
- *
15299
- * A contribution is a discriminated union on `kind`:
15300
- *
15301
- * - `redirect` — a declarative button. The login page renders a generic
15302
- * button that navigates to `startUrl` (an addon-owned HTTP route).
15303
- * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
15304
- * ZERO shell-side JS. A future SSO addon plugs in the same way — the
15305
- * login page needs NO change.
15306
- *
15307
- * - `widget` — a Module-Federation widget the login page mounts (via
15308
- * `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
15309
- * stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
15310
- * mechanism kept for future use; no shipped addon uses it on the login
15311
- * page (the passkey ceremony below runs natively in the shell instead).
15312
- *
15313
- * - `passkey` — a declarative WebAuthn ceremony the shell renders
15314
- * natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
15315
- * a remotely-loaded bundle). Carries the addon's effective `rpId` /
15316
- * `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
15317
- * can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
15318
- * fetching any remote code pre-auth. Contribution stays unconditional —
15319
- * enrollment state is never leaked pre-auth; visibility is a shell
15320
- * decision.
15321
- *
15322
- * Every contribution carries a `stage`:
15323
- * - `primary` — shown on the first credentials screen (OIDC /
15324
- * magic-link buttons; a future usernameless passkey).
15325
- * - `second-factor` — shown AFTER the password leg, gated on the
15326
- * returned `factors` (passkey-as-2FA today).
15327
- *
15328
- * `mount: skip` — the cap is read server-side by the core auth router
15329
- * (`registry.getCollection('login-method')`), never mounted as its own
15330
- * tRPC router.
15331
- */
15332
- /** When a login method renders in the two-phase login flow. */
15333
- var LoginStageEnum = z.enum(["primary", "second-factor"]);
15334
- /**
15335
- * A declarative redirect button — the login page navigates to `startUrl`.
15336
- * OIDC and magic-link contribute this; a future SSO addon does too.
15337
- */
15338
- var RedirectLoginMethodSchema = z.object({
15339
- kind: z.literal("redirect"),
15340
- /** Stable id within the login-method set (e.g. `auth-oidc/google`). */
15341
- id: z.string(),
15342
- /** Operator-facing button label. */
15343
- label: z.string(),
15344
- /** lucide-react icon name. */
15345
- icon: z.string().optional(),
15346
- /** Addon-owned HTTP route the button navigates to (GET). */
15347
- startUrl: z.string(),
15348
- stage: LoginStageEnum
15349
- });
15350
- /**
15351
- * A Module-Federation widget the login page mounts for an in-page
15352
- * ceremony. `bundle` + `addonId` let `auth.listLoginMethods` stamp a
15353
- * public `bundleUrl`; `remote` is the MF descriptor `loadRemoteBundle`
15354
- * consumes. No `bundleUrl` here — it is server-stamped on the public
15355
- * output so the addon never encodes the static-route scheme.
15356
- */
15357
- var WidgetLoginMethodSchema = z.object({
15358
- kind: z.literal("widget"),
15359
- /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
15360
- id: z.string(),
15361
- /** Owning addon id — drives the public bundle URL + the MF namespace. */
15362
- addonId: z.string(),
15363
- /** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
15364
- bundle: z.string(),
15365
- /** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
15366
- remote: WidgetRemoteSchema,
15367
- stage: LoginStageEnum
15368
- });
15369
- /**
15370
- * A declarative WebAuthn ceremony the shell renders natively (no remote
15371
- * code). Carries the addon's EFFECTIVE `rpId`/`origin` so the shell can
15372
- * gate visibility (IP-literal origin, hostname/rpId mismatch) before ever
15373
- * showing the button — the contribution itself stays unconditional.
15374
- */
15375
- var PasskeyLoginMethodSchema = z.object({
15376
- kind: z.literal("passkey"),
15377
- /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
15378
- id: z.string(),
15379
- /** Operator-facing button label. */
15380
- label: z.string(),
15381
- stage: LoginStageEnum,
15382
- /** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
15383
- rpId: z.string(),
15384
- /** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
15385
- origin: z.string().nullable()
15386
- });
15387
- /** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
15388
- var LoginMethodContributionSchema = z.discriminatedUnion("kind", [
15389
- RedirectLoginMethodSchema,
15390
- WidgetLoginMethodSchema,
15391
- PasskeyLoginMethodSchema
15392
- ]);
15393
- var loginMethodCapability = {
15394
- name: "login-method",
15395
- scope: "system",
15396
- mode: "collection",
15397
- internal: true,
15398
- methods: { getLoginMethods: method(z.void(), z.array(LoginMethodContributionSchema).readonly()) },
15399
- /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
15400
- mount: { kind: "skip" }
15401
- };
15402
15255
  /**
15403
15256
  * Orchestrator-side destination metadata. The orchestrator computes
15404
15257
  * `id = <addonId>:<subId>` from its provider lookup so consumers
@@ -16054,7 +15907,8 @@ function customAction(input, output, options) {
16054
15907
  output,
16055
15908
  kind: options?.kind ?? "query",
16056
15909
  auth: options?.auth ?? "protected",
16057
- scope: options?.scope ?? { kind: "system" }
15910
+ scope: options?.scope ?? { kind: "system" },
15911
+ ...options?.caller ? { caller: "required" } : {}
16058
15912
  };
16059
15913
  }
16060
15914
  function deviceCustomAction(input, output, options) {
@@ -17659,1061 +17513,1946 @@ var filesystemBrowseCapability = {
17659
17513
  }
17660
17514
  };
17661
17515
  //#endregion
17662
- //#region src/capabilities/log-destination.cap.ts
17663
- var LogLevelSchema = z.enum([
17664
- "debug",
17665
- "info",
17666
- "warn",
17667
- "error"
17516
+ //#region src/capabilities/llm-shared.ts
17517
+ /**
17518
+ * Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
17519
+ * surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
17520
+ * caps stay wire-compatible without a circular cap→cap import.
17521
+ *
17522
+ * Errors are a discriminated-union RESULT, never thrown: the shape survives
17523
+ * every transport tier structurally, and failed calls still write usage rows.
17524
+ * Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
17525
+ */
17526
+ var LlmUsageSchema = z.object({
17527
+ inputTokens: z.number(),
17528
+ outputTokens: z.number()
17529
+ });
17530
+ var LlmErrorCodeSchema = z.enum([
17531
+ "timeout",
17532
+ "rate-limited",
17533
+ "auth",
17534
+ "refusal",
17535
+ "bad-request",
17536
+ "unavailable",
17537
+ "no-profile",
17538
+ "budget-exceeded",
17539
+ "adapter-error"
17668
17540
  ]);
17669
- var LogEntrySchema = z.object({
17670
- timestamp: z.date(),
17671
- level: LogLevelSchema,
17672
- scope: z.array(z.string()),
17673
- message: z.string(),
17674
- meta: z.record(z.string(), z.unknown()).optional(),
17675
- tags: z.record(z.string(), z.string()).optional()
17541
+ var LlmGenerateOkSchema = z.object({
17542
+ ok: z.literal(true),
17543
+ text: z.string(),
17544
+ model: z.string(),
17545
+ usage: LlmUsageSchema,
17546
+ truncated: z.boolean(),
17547
+ latencyMs: z.number()
17676
17548
  });
17677
- var logDestinationCapability = {
17678
- name: "log-destination",
17679
- scope: "system",
17680
- mode: "collection",
17681
- internal: true,
17682
- methods: {
17683
- write: method(LogEntrySchema, z.void(), { kind: "mutation" }),
17684
- query: method(z.object({
17685
- scope: z.array(z.string()).optional(),
17686
- level: LogLevelSchema.optional(),
17687
- since: z.date().optional(),
17688
- until: z.date().optional(),
17689
- limit: z.number().optional(),
17690
- tags: z.record(z.string(), z.string()).optional()
17691
- }), z.array(LogEntrySchema).readonly())
17692
- },
17693
- /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
17694
- mount: { kind: "skip" }
17695
- };
17696
- //#endregion
17697
- //#region src/capabilities/metrics-provider.cap.ts
17698
- var CpuBreakdownSchema = z.object({
17699
- total: z.number(),
17700
- user: z.number(),
17701
- system: z.number(),
17702
- irq: z.number(),
17703
- nice: z.number(),
17704
- loadAvg: z.tuple([
17705
- z.number(),
17706
- z.number(),
17707
- z.number()
17708
- ]),
17709
- cores: z.number()
17549
+ var LlmGenerateErrSchema = z.object({
17550
+ ok: z.literal(false),
17551
+ code: LlmErrorCodeSchema,
17552
+ message: z.string(),
17553
+ retryAfterMs: z.number().optional()
17710
17554
  });
17711
- var MemoryInfoSchema = z.object({
17712
- percent: z.number(),
17713
- totalBytes: z.number(),
17714
- usedBytes: z.number(),
17715
- availableBytes: z.number(),
17716
- swapUsedBytes: z.number(),
17717
- swapTotalBytes: z.number()
17718
- });
17719
- var DiskIoSnapshotSchema = z.object({
17720
- readBytes: z.number(),
17721
- writeBytes: z.number(),
17722
- readOps: z.number(),
17723
- writeOps: z.number(),
17724
- timestampMs: z.number()
17725
- });
17726
- var NetworkIoSnapshotSchema = z.object({
17727
- rxBytes: z.number(),
17728
- txBytes: z.number(),
17729
- rxPackets: z.number(),
17730
- txPackets: z.number(),
17731
- rxErrors: z.number(),
17732
- txErrors: z.number(),
17733
- timestampMs: z.number()
17734
- });
17735
- var MetricsGpuInfoSchema = z.object({
17736
- utilization: z.number(),
17737
- model: z.string(),
17738
- memoryUsedBytes: z.number(),
17739
- memoryTotalBytes: z.number(),
17740
- temperature: z.number().nullable()
17741
- });
17742
- var ProcessResourceInfoSchema = z.object({
17743
- openFds: z.number(),
17744
- threadCount: z.number(),
17745
- activeHandles: z.number(),
17746
- activeRequests: z.number()
17747
- });
17748
- var PressureAvgsSchema = z.object({
17749
- avg10: z.number(),
17750
- avg60: z.number(),
17751
- avg300: z.number()
17555
+ var LlmGenerateResultSchema = z.discriminatedUnion("ok", [LlmGenerateOkSchema, LlmGenerateErrSchema]);
17556
+ /**
17557
+ * `Uint8Array` is the sanctioned binary convention — superjson + the UDS
17558
+ * MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
17559
+ * notification-output.cap.ts:27-31 precedents).
17560
+ */
17561
+ var LlmImageSchema = z.object({
17562
+ bytes: z.instanceof(Uint8Array),
17563
+ mimeType: z.string()
17752
17564
  });
17753
- var PressureInfoSchema = z.object({
17754
- some: PressureAvgsSchema,
17755
- full: PressureAvgsSchema.nullable()
17565
+ var LlmGenerateBaseInputSchema = z.object({
17566
+ /** Collection routing (the notification-output posture). */
17567
+ addonId: z.string().optional(),
17568
+ /** Explicit profile; else the resolution chain (spec §3). */
17569
+ profileId: z.string().optional(),
17570
+ /** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
17571
+ consumer: z.string(),
17572
+ system: z.string().optional(),
17573
+ /** v1: single-turn. `messages[]` is a v2 additive field. */
17574
+ prompt: z.string(),
17575
+ /** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
17576
+ jsonSchema: z.record(z.string(), z.unknown()).optional(),
17577
+ /** Per-call override of the profile default. */
17578
+ maxTokens: z.number().int().positive().optional(),
17579
+ temperature: z.number().optional()
17756
17580
  });
17757
- var SystemResourceSnapshotSchema = z.object({
17758
- cpu: CpuBreakdownSchema,
17759
- memory: MemoryInfoSchema,
17760
- gpu: MetricsGpuInfoSchema.nullable(),
17761
- network: NetworkIoSnapshotSchema,
17762
- disk: DiskIoSnapshotSchema,
17763
- pressure: z.object({
17764
- cpu: PressureInfoSchema.nullable(),
17765
- memory: PressureInfoSchema.nullable(),
17766
- io: PressureInfoSchema.nullable()
17581
+ //#endregion
17582
+ //#region src/capabilities/llm-runtime.cap.ts
17583
+ /**
17584
+ * `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
17585
+ * on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
17586
+ * a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
17587
+ * cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
17588
+ * this only through the `llm` cap's methods.
17589
+ *
17590
+ * One running llama-server child per node in v1 (models are RAM-heavy).
17591
+ * Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
17592
+ * watchdog — operator decision #3).
17593
+ */
17594
+ var ManagedModelRefSchema = z.discriminatedUnion("kind", [
17595
+ z.object({
17596
+ kind: z.literal("catalog"),
17597
+ catalogId: z.string()
17767
17598
  }),
17768
- process: ProcessResourceInfoSchema,
17769
- cpuTemperature: z.number().nullable(),
17770
- timestampMs: z.number()
17771
- });
17772
- var DiskSpaceInfoSchema = z.object({
17773
- path: z.string(),
17774
- totalBytes: z.number(),
17775
- usedBytes: z.number(),
17776
- availableBytes: z.number(),
17777
- percent: z.number()
17778
- });
17779
- var PidResourceStatsSchema = z.object({
17780
- pid: z.number(),
17781
- cpu: z.number(),
17782
- memory: z.number(),
17783
- /**
17784
- * Private (anonymous) resident bytes — the per-process V8 heap + native
17785
- * allocations NOT shared with other processes (Linux RssAnon). This is the
17786
- * "real" per-runner cost; summing it across runners is meaningful, unlike
17787
- * `memory` (RSS), which double-counts the shared mmap'd framework code.
17788
- * Undefined where /proc is unavailable (e.g. macOS).
17789
- */
17790
- privateBytes: z.number().optional(),
17791
- /**
17792
- * Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
17793
- * code shared copy-on-write across runners. Undefined on macOS.
17794
- */
17795
- sharedBytes: z.number().optional()
17599
+ z.object({
17600
+ kind: z.literal("url"),
17601
+ url: z.string(),
17602
+ sha256: z.string().optional()
17603
+ }),
17604
+ z.object({
17605
+ kind: z.literal("path"),
17606
+ path: z.string()
17607
+ })
17608
+ ]);
17609
+ var ManagedRuntimeConfigSchema = z.object({
17610
+ /** WHERE the runtime lives — hub or any agent. */
17611
+ nodeId: z.string(),
17612
+ /** Closed for v1; 'ollama' is a v2 candidate. */
17613
+ engine: z.enum(["llama-cpp"]),
17614
+ model: ManagedModelRefSchema,
17615
+ contextSize: z.number().int().default(4096),
17616
+ /** 0 = CPU-only. */
17617
+ gpuLayers: z.number().int().default(0),
17618
+ /** Default: cpus-2, clamped ≥1 (resolved node-side). */
17619
+ threads: z.number().int().optional(),
17620
+ /** Concurrent slots. */
17621
+ parallel: z.number().int().default(1),
17622
+ /** Else lazy: first generate boots it. */
17623
+ autoStart: z.boolean().default(false),
17624
+ /** 0 = never; frees RAM after quiet periods. */
17625
+ idleStopMinutes: z.number().int().default(30)
17796
17626
  });
17797
- var AddonInstanceSchema = z.object({
17798
- addonId: z.string(),
17627
+ var LlmRuntimeStatusSchema = z.object({
17628
+ /** Status is ALWAYS node-qualified. */
17799
17629
  nodeId: z.string(),
17800
- role: z.enum(["hub", "worker"]),
17801
- pid: z.number(),
17802
17630
  state: z.enum([
17803
- "starting",
17804
- "running",
17805
- "stopping",
17806
17631
  "stopped",
17807
- "crashed"
17808
- ]),
17809
- uptimeSec: z.number()
17810
- });
17811
- var NodeProcessSchema = z.object({
17812
- pid: z.number(),
17813
- ppid: z.number(),
17814
- pgid: z.number(),
17815
- classification: z.enum([
17816
- "root",
17817
- "managed",
17818
- "system",
17819
- "ghost"
17632
+ "downloading",
17633
+ "starting",
17634
+ "ready",
17635
+ "crashed",
17636
+ "failed"
17820
17637
  ]),
17821
- /** `$process` addon binding when `managed`, else null. */
17822
- addonId: z.string().nullable(),
17823
- /** Kernel-reported nodeId when the process is a known agent/worker. */
17824
- nodeId: z.string().nullable(),
17825
- /** Truncated command line. */
17826
- command: z.string(),
17827
- cpuPercent: z.number(),
17828
- memoryRssBytes: z.number(),
17829
- /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
17830
- uptimeSec: z.number(),
17831
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
17832
- orphaned: z.boolean()
17833
- });
17834
- var KillProcessInputSchema = z.object({
17835
- pid: z.number(),
17836
- /** Force = SIGKILL. Default is SIGTERM. */
17837
- force: z.boolean().optional()
17638
+ pid: z.number().optional(),
17639
+ port: z.number().optional(),
17640
+ modelPath: z.string().optional(),
17641
+ modelId: z.string().optional(),
17642
+ downloadProgress: z.number().min(0).max(1).optional(),
17643
+ lastError: z.string().optional(),
17644
+ crashesInWindow: z.number(),
17645
+ /** Child RSS (sampled best-effort). */
17646
+ memoryBytes: z.number().optional(),
17647
+ vramBytes: z.number().optional()
17838
17648
  });
17839
- var KillProcessResultSchema = z.object({
17840
- success: z.boolean(),
17841
- reason: z.string().optional(),
17842
- signal: z.enum(["SIGTERM", "SIGKILL"]).optional()
17649
+ var LlmNodeModelSchema = z.object({
17650
+ file: z.string(),
17651
+ sizeBytes: z.number(),
17652
+ catalogId: z.string().optional(),
17653
+ installedAt: z.number().optional()
17843
17654
  });
17844
- var DumpHeapSnapshotInputSchema = z.object({
17845
- /** The addon whose runner should dump a heap snapshot. */
17846
- addonId: z.string() });
17847
- var DumpHeapSnapshotResultSchema = z.object({
17848
- success: z.boolean(),
17849
- /** Path of the written .heapsnapshot inside the runner's container/host. */
17850
- path: z.string().optional(),
17851
- /** Process pid that was signalled. */
17852
- pid: z.number().optional(),
17853
- reason: z.string().optional()
17655
+ var LlmRuntimeDiskUsageSchema = z.object({
17656
+ nodeId: z.string(),
17657
+ modelsBytes: z.number(),
17658
+ freeBytes: z.number().optional()
17854
17659
  });
17855
- var SystemMetricsSchema = z.object({
17856
- cpuPercent: z.number(),
17857
- memoryPercent: z.number(),
17858
- memoryUsedMB: z.number(),
17859
- memoryTotalMB: z.number(),
17860
- diskPercent: z.number().optional(),
17861
- temperature: z.number().optional(),
17862
- gpuPercent: z.number().optional(),
17863
- gpuMemoryPercent: z.number().optional()
17660
+ var LlmRuntimeCompleteInputSchema = LlmGenerateBaseInputSchema.extend({
17661
+ images: z.array(LlmImageSchema).optional(),
17662
+ runtime: ManagedRuntimeConfigSchema,
17663
+ /** The managed profile's timeout, threaded by the hub provider. */
17664
+ timeoutMs: z.number().int().positive().optional()
17864
17665
  });
17865
- var metricsProviderCapability = {
17866
- name: "metrics-provider",
17666
+ var llmRuntimeCapability = {
17667
+ name: "llm-runtime",
17867
17668
  scope: "system",
17868
17669
  mode: "singleton",
17670
+ internal: true,
17869
17671
  methods: {
17870
- /** Fresh, full system snapshot (triggers OS-level collection). */
17871
- collectSnapshot: method(z.void(), SystemResourceSnapshotSchema),
17872
- /** Most recent cached snapshot from the background sampler, or null pre-first-sample. */
17873
- getCached: method(z.void(), SystemResourceSnapshotSchema.nullable()),
17874
- /** Light-weight cached summary for heartbeats and list views. */
17875
- getCurrent: method(z.void(), SystemMetricsSchema),
17876
- /** Disk space for the given mount/path. */
17877
- getDiskSpace: method(z.object({ dirPath: z.string() }), DiskSpaceInfoSchema),
17878
- /** GPU info (null if unavailable). */
17879
- getGpuInfo: method(z.void(), MetricsGpuInfoSchema.nullable()),
17880
- /** CPU temperature in °C (null if unavailable). */
17881
- getCpuTemperature: method(z.void(), z.number().nullable()),
17882
- /** Per-PID resource stats. Missing/dead PIDs are omitted from the result. */
17883
- getProcessStats: method(z.object({ pids: z.array(z.number()) }), z.array(PidResourceStatsSchema)),
17884
- /**
17885
- * List addon instances known to this node — one entry per forked worker
17886
- * plus a synthetic 'hub' entry representing the local hub process.
17887
- * Used by benchmarks/observability to detect whether a given addon runs
17888
- * in its own process (measurable independently) or inline with the hub.
17889
- */
17890
- listAddonInstances: method(z.void(), z.array(AddonInstanceSchema).readonly()),
17891
- /**
17892
- * Resource stats for the process hosting the given addon.
17893
- * Returns null when the addon runs in-process on the hub (can't measure
17894
- * independently — caller should detect via listAddonInstances). Returns
17895
- * hub process stats for addonId '$hub'.
17896
- */
17897
- getAddonStats: method(z.object({ addonId: z.string() }), PidResourceStatsSchema.nullable()),
17898
- /**
17899
- * Snapshot of every camstack-related process on this node with a
17900
- * ghost/managed/root classification. Powers the Cluster → Agent →
17901
- * Processes tab: cross-references `$process.list` against a `ps` scan
17902
- * so orphaned trees (PPID=1) or unknown children show up as `ghost`
17903
- * and can be killed from the UI.
17904
- */
17905
- listNodeProcesses: method(z.void(), z.array(NodeProcessSchema).readonly()),
17906
- /**
17907
- * Send SIGTERM (or SIGKILL when `force`) to a pid inside this node's
17908
- * process tree. The provider refuses pids that aren't in the live
17909
- * `listNodeProcesses()` snapshot — callers can't use this endpoint
17910
- * to kill arbitrary system processes.
17911
- */
17912
- killProcess: method(KillProcessInputSchema, KillProcessResultSchema, {
17672
+ complete: method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
17673
+ ensureStarted: method(z.object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
17913
17674
  kind: "mutation",
17914
17675
  auth: "admin"
17915
17676
  }),
17916
- /**
17917
- * Tell the addon's forked runner to write a V8 heap snapshot to disk (via
17918
- * SIGUSR2 — the runner's diagnostic handler). Also logs its
17919
- * `process.memoryUsage()` + heap-space breakdown. Refuses pids not in the
17920
- * live `listNodeProcesses()` snapshot. Use for deep per-addon memory
17921
- * attribution; copy the returned path off the node to analyze.
17922
- */
17923
- dumpHeapSnapshot: method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
17677
+ stop: method(z.object({}), z.void(), {
17924
17678
  kind: "mutation",
17925
17679
  auth: "admin"
17926
- })
17680
+ }),
17681
+ status: method(z.object({}), LlmRuntimeStatusSchema),
17682
+ installModel: method(z.object({ model: ManagedModelRefSchema }), z.void(), {
17683
+ kind: "mutation",
17684
+ auth: "admin"
17685
+ }),
17686
+ deleteModel: method(z.object({ file: z.string() }), z.void(), {
17687
+ kind: "mutation",
17688
+ auth: "admin"
17689
+ }),
17690
+ listLocalModels: method(z.object({}), z.array(LlmNodeModelSchema)),
17691
+ getDiskUsage: method(z.object({}), LlmRuntimeDiskUsageSchema)
17927
17692
  }
17928
17693
  };
17929
17694
  //#endregion
17930
- //#region src/capabilities/model-convert.cap.ts
17931
- var ModelConvertInputSchema = z.object({
17932
- sourceUrl: z.string(),
17933
- metadata: ModelConvertMetadataSchema,
17934
- targets: z.array(ConvertTargetSchema).min(1).readonly(),
17935
- calibrationRef: z.string().optional(),
17936
- sessionId: z.string().optional()
17937
- });
17938
- var modelConvertCapability = {
17939
- name: "model-convert",
17940
- scope: "system",
17941
- mode: "singleton",
17942
- internal: true,
17943
- methods: { convert: method(ModelConvertInputSchema, ConvertResultSchema, {
17944
- kind: "mutation",
17945
- auth: "admin",
17946
- timeoutMs: 6e5
17947
- }) }
17948
- };
17949
- //#endregion
17950
- //#region src/capabilities/model-distributor.cap.ts
17951
- /**
17952
- * `model-distributor` — singleton, hub-resident. Pushes a model FORMAT that is
17953
- * already present on the hub's `/data/models` to a target agent node's
17954
- * `/data/models`, sha256-verified, reusing the agent-pull machinery
17955
- * (DeployStageRegistry + the one-time-token bundle route + the agent's
17956
- * `fetchBundleFromHub`). Its provider is built in `server/backend` because it
17957
- * needs the Moleculer broker + the deploy-stage registry, which a forked addon
17958
- * can't reach. `addon-model-studio` drives it via `ctx.api` and owns the
17959
- * per-node availability map.
17960
- */
17961
- var ModelDistributeInputSchema = z.object({
17962
- nodeId: z.string(),
17963
- modelId: z.string(),
17964
- format: z.enum(MODEL_FORMATS),
17965
- entry: ModelCatalogEntrySchema
17966
- });
17967
- var ModelDistributeResultSchema = z.object({
17968
- ok: z.boolean(),
17969
- /** sha256 of the staged tarball (empty for a hub-local no-op). */
17970
- sha256: z.string(),
17971
- bytes: z.number(),
17972
- /** The target node's modelsDir the artifact landed in. */
17973
- path: z.string()
17974
- });
17975
- var modelDistributorCapability = {
17976
- name: "model-distributor",
17977
- scope: "system",
17978
- mode: "singleton",
17979
- internal: true,
17980
- methods: { distributeModel: method(ModelDistributeInputSchema, ModelDistributeResultSchema, {
17981
- kind: "mutation",
17982
- auth: "admin"
17983
- }) }
17984
- };
17985
- //#endregion
17986
- //#region src/capabilities/mqtt-broker.cap.ts
17987
- /**
17988
- * `mqtt-broker` — broker-registry cap.
17989
- *
17990
- * NOT a pub/sub proxy. The cap exposes (a) a registry of configured
17991
- * MQTT brokers (external + optionally an embedded `aedes`-backed one)
17992
- * and (b) the connection details a consumer addon needs to spin up
17993
- * its OWN `mqtt.js` client.
17994
- *
17995
- * Why: pub/sub routing over the system event-bus loses fidelity
17996
- * (callback shape, QoS guarantees, will/retain semantics) and adds
17997
- * refcount bookkeeping that addons would rather own themselves. The
17998
- * canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
17999
- * features anyway — give it the connection config, get out of the way.
18000
- *
18001
- * Consumer flow:
18002
- * const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
18003
- * const client = mqtt.connect(cfg.url, { username: cfg.username, … })
18004
- * client.subscribe('zigbee2mqtt/+')
18005
- *
18006
- * Collection mode: multiple brokers (e.g. one local mosquitto + one
18007
- * cloud bridge). The "embedded" entry (when present) is just another
18008
- * broker in the registry — its lifecycle is owned by the addon that
18009
- * spawned it.
18010
- */
18011
- var BrokerKindSchema = z.enum(["external", "embedded"]);
17695
+ //#region src/capabilities/llm.cap.ts
18012
17696
  /**
18013
- * Broker live-probe status.
17697
+ * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
17698
+ * methods concat-fan across providers; single-row methods route to ONE
17699
+ * provider by the `addonId` in the call input (the notification-output
17700
+ * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
17701
+ * (hub-placed); the cap stays open for future providers.
18014
17702
  *
18015
- * - `connected` last probe completed a clean CONNACK
18016
- * - `disconnected` — no probe has run yet (cold cache)
18017
- * - `auth-failed` CONNACK refused with auth error (RC 4 / 5)
18018
- * - `unreachable` — TCP connect timed out / refused
18019
- * - `tls-error` — TLS handshake failed (cert / SNI / cipher)
17703
+ * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
17704
+ * `apiKey` is a password field providers REDACT it on read and merge on
17705
+ * write; a stored key NEVER round-trips to a client.
18020
17706
  */
18021
- var BrokerStatusSchema$1 = z.enum([
18022
- "connected",
18023
- "disconnected",
18024
- "auth-failed",
18025
- "unreachable",
18026
- "tls-error"
17707
+ var LlmProfileKindSchema = z.enum([
17708
+ "openai-compatible",
17709
+ "openai",
17710
+ "anthropic",
17711
+ "google",
17712
+ "managed-local"
18027
17713
  ]);
18028
- var BrokerInfoSchema = z.object({
17714
+ var LlmProfileSchema = z.object({
18029
17715
  id: z.string(),
18030
17716
  name: z.string(),
18031
- url: z.string(),
18032
- kind: BrokerKindSchema,
18033
- status: BrokerStatusSchema$1,
18034
- latencyMs: z.number().nullable(),
18035
- error: z.string().optional(),
18036
- /** Embedded brokers only: number of MQTT clients currently connected. */
18037
- connectedClients: z.number().int().nonnegative().optional(),
18038
- /** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
18039
- lastCheckedAt: z.number().optional()
18040
- });
18041
- /**
18042
- * Connection details — what a consumer needs to call
18043
- * `mqtt.connect(url, options)`. We split URL + credentials so the
18044
- * consumer can pass them as `mqtt.connect(url, { username, password })`
18045
- * instead of stuffing creds into the URL (which leaks them into logs).
18046
- */
18047
- var BrokerConnectionDetailsSchema = z.object({
18048
- url: z.string(),
18049
- username: z.string().optional(),
18050
- password: z.string().optional(),
18051
- /**
18052
- * Suggested prefix for `clientId`. Each consumer should suffix this
18053
- * with its own discriminator (addon id, instance id) so reconnects
18054
- * don't kick each other off (MQTT spec: clientId must be unique per
18055
- * broker).
18056
- */
18057
- clientIdPrefix: z.string().optional()
18058
- });
18059
- var AddBrokerInputSchema = z.object({
18060
- name: z.string().min(1),
18061
- url: z.string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
18062
- username: z.string().optional(),
18063
- password: z.string().optional(),
18064
- clientIdPrefix: z.string().optional()
18065
- });
18066
- var AddBrokerResultSchema = z.object({ id: z.string() });
18067
- var IdInputSchema = z.object({ id: z.string() });
18068
- var TestResultSchema$1 = z.discriminatedUnion("ok", [z.object({
18069
- ok: z.literal(true),
18070
- latencyMs: z.number()
18071
- }), z.object({
18072
- ok: z.literal(false),
18073
- error: z.string()
18074
- })]);
18075
- var StartEmbeddedInputSchema = z.object({
18076
- port: z.number().int().min(1).max(65535).default(1883),
18077
- /** Allow anonymous connect (no username/password). Default: false. */
18078
- allowAnonymous: z.boolean().default(false),
18079
- /** Optional shared username/password for clients. */
18080
- username: z.string().optional(),
18081
- password: z.string().optional()
17717
+ kind: LlmProfileKindSchema,
17718
+ /** Stamped by the provider — keeps the fanned catalog routable. */
17719
+ addonId: z.string(),
17720
+ enabled: z.boolean(),
17721
+ /** Vendor model id, or the managed runtime's loaded model. */
17722
+ model: z.string(),
17723
+ /** Required for openai-compatible; override for cloud kinds. */
17724
+ baseUrl: z.string().optional(),
17725
+ /** ConfigUISchema type:'password' — never round-trips (spec §5). */
17726
+ apiKey: z.string().optional(),
17727
+ supportsVision: z.boolean(),
17728
+ temperature: z.number().min(0).max(2).optional(),
17729
+ maxTokens: z.number().int().positive().optional(),
17730
+ timeoutMs: z.number().int().positive().default(6e4),
17731
+ extraHeaders: z.record(z.string(), z.string()).optional(),
17732
+ /** kind === 'managed-local' only (spec §4). */
17733
+ runtime: ManagedRuntimeConfigSchema.optional()
18082
17734
  });
18083
- var StartEmbeddedResultSchema = z.object({
18084
- id: z.string(),
18085
- url: z.string()
17735
+ /** ConfigUISchema tree passed through untyped on the wire (the
17736
+ * notification-output `ConfigSchemaPassthrough` precedent at
17737
+ * notification-output.cap.ts:151); the exported TS type re-tightens it. */
17738
+ var ConfigSchemaPassthrough$1 = z.unknown();
17739
+ var LlmProfileKindDescriptorSchema = z.object({
17740
+ kind: LlmProfileKindSchema,
17741
+ label: z.string(),
17742
+ icon: z.string(),
17743
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
17744
+ addonId: z.string(),
17745
+ configSchema: ConfigSchemaPassthrough$1
18086
17746
  });
18087
- var StatusSchema = z.object({
18088
- brokerCount: z.number(),
18089
- embeddedRunning: z.boolean()
17747
+ var LlmDefaultSelectorSchema = z.union([z.object({ consumer: z.string() }), z.object({ purpose: z.enum(["text", "vision"]) })]);
17748
+ var LlmDefaultSchema = z.object({
17749
+ selector: LlmDefaultSelectorSchema,
17750
+ profileId: z.string()
18090
17751
  });
18091
- var mqttBrokerCapability = {
18092
- name: "mqtt-broker",
17752
+ /** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
17753
+ var LlmUsageRollupSchema = z.object({
17754
+ day: z.string(),
17755
+ consumer: z.string(),
17756
+ profileId: z.string(),
17757
+ calls: z.number(),
17758
+ okCalls: z.number(),
17759
+ errorCalls: z.number(),
17760
+ inputTokens: z.number(),
17761
+ outputTokens: z.number(),
17762
+ avgLatencyMs: z.number()
17763
+ });
17764
+ /** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
17765
+ var ManagedModelCatalogEntrySchema = z.object({
17766
+ id: z.string(),
17767
+ label: z.string(),
17768
+ family: z.string(),
17769
+ purpose: z.enum(["text", "vision"]),
17770
+ url: z.string(),
17771
+ sha256: z.string(),
17772
+ sizeBytes: z.number(),
17773
+ quantization: z.string(),
17774
+ /** Load-time guidance shown in the picker. */
17775
+ minRamBytes: z.number(),
17776
+ contextSizeDefault: z.number().int(),
17777
+ /** Vision models: companion projector file. */
17778
+ mmprojUrl: z.string().optional()
17779
+ });
17780
+ var LlmRuntimeNodeSchema = z.object({
17781
+ nodeId: z.string(),
17782
+ reachable: z.boolean(),
17783
+ status: LlmRuntimeStatusSchema.optional(),
17784
+ disk: LlmRuntimeDiskUsageSchema.optional(),
17785
+ error: z.string().optional()
17786
+ });
17787
+ var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: z.array(LlmImageSchema).min(1) });
17788
+ var ProfileRefInputSchema = z.object({
17789
+ addonId: z.string(),
17790
+ profileId: z.string()
17791
+ });
17792
+ var llmCapability = {
17793
+ name: "llm",
18093
17794
  scope: "system",
18094
17795
  mode: "collection",
18095
- providerKind: "broker",
18096
- status: {
18097
- schema: StatusSchema,
18098
- kind: "poll"
18099
- },
17796
+ internal: false,
17797
+ providerKind: "ai",
17798
+ /** `nodeId` inputs below are DATA (the hub provider pins itself), never routing. */
17799
+ nodeIdMode: "data",
18100
17800
  methods: {
18101
- listBrokers: method(z.void(), z.array(BrokerInfoSchema)),
18102
- getBrokerConfig: method(IdInputSchema, BrokerConnectionDetailsSchema),
18103
- addBroker: method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }),
18104
- removeBroker: method(IdInputSchema, z.void(), { kind: "mutation" }),
18105
- testConnection: method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }),
18106
- startEmbeddedBroker: method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }),
18107
- stopEmbeddedBroker: method(IdInputSchema, z.void(), { kind: "mutation" }),
18108
- getStatus: method(z.void(), StatusSchema)
17801
+ generate: method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
17802
+ generateVision: method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
17803
+ listProfileKinds: method(z.object({}), z.array(LlmProfileKindDescriptorSchema)),
17804
+ listProfiles: method(z.object({}), z.array(LlmProfileSchema)),
17805
+ upsertProfile: method(z.object({ profile: LlmProfileSchema }), LlmProfileSchema, {
17806
+ kind: "mutation",
17807
+ auth: "admin"
17808
+ }),
17809
+ deleteProfile: method(ProfileRefInputSchema, z.void(), {
17810
+ kind: "mutation",
17811
+ auth: "admin"
17812
+ }),
17813
+ testProfile: method(ProfileRefInputSchema, LlmGenerateResultSchema, {
17814
+ kind: "mutation",
17815
+ auth: "admin"
17816
+ }),
17817
+ /** Live vendor enumeration (GET /models etc.). */
17818
+ listModels: method(ProfileRefInputSchema, z.array(z.string())),
17819
+ getDefaults: method(z.object({}), z.array(LlmDefaultSchema)),
17820
+ setDefault: method(z.object({
17821
+ selector: LlmDefaultSelectorSchema,
17822
+ profileId: z.string().nullable()
17823
+ }), z.void(), {
17824
+ kind: "mutation",
17825
+ auth: "admin"
17826
+ }),
17827
+ getUsage: method(z.object({
17828
+ since: z.number().optional(),
17829
+ until: z.number().optional(),
17830
+ consumer: z.string().optional(),
17831
+ profileId: z.string().optional()
17832
+ }), z.array(LlmUsageRollupSchema)),
17833
+ listModelCatalog: method(z.object({}), z.array(ManagedModelCatalogEntrySchema)),
17834
+ listRuntimeNodes: method(z.object({}), z.array(LlmRuntimeNodeSchema)),
17835
+ listNodeModels: method(z.object({ nodeId: z.string() }), z.array(LlmNodeModelSchema)),
17836
+ installModel: method(z.object({
17837
+ nodeId: z.string(),
17838
+ model: ManagedModelRefSchema
17839
+ }), z.void(), {
17840
+ kind: "mutation",
17841
+ auth: "admin"
17842
+ }),
17843
+ deleteModel: method(z.object({
17844
+ nodeId: z.string(),
17845
+ file: z.string()
17846
+ }), z.void(), {
17847
+ kind: "mutation",
17848
+ auth: "admin"
17849
+ }),
17850
+ getRuntimeStatus: method(ProfileRefInputSchema, LlmRuntimeStatusSchema),
17851
+ startRuntime: method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
17852
+ kind: "mutation",
17853
+ auth: "admin"
17854
+ }),
17855
+ stopRuntime: method(ProfileRefInputSchema, z.void(), {
17856
+ kind: "mutation",
17857
+ auth: "admin"
17858
+ })
18109
17859
  }
18110
17860
  };
18111
17861
  //#endregion
18112
- //#region src/capabilities/network-access.cap.ts
18113
- var NetworkEndpointSchema = z.object({
18114
- url: z.string(),
18115
- hostname: z.string(),
18116
- port: z.number(),
18117
- protocol: z.enum(["http", "https"])
18118
- });
18119
- var NetworkAccessStatusSchema = z.object({
18120
- connected: z.boolean(),
18121
- endpoint: NetworkEndpointSchema.nullable(),
18122
- error: z.string().optional()
18123
- });
18124
- /**
18125
- * Optional, richer endpoint shape returned by providers that expose
18126
- * MORE than one ingress concurrently (Tailscale Ingress with mixed
18127
- * serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
18128
- * the originating provider config (mode + sourcePort) so the
18129
- * orchestrator UI can label rows distinctly. Providers that expose only
18130
- * one endpoint just omit `listEndpoints` from their provider impl.
18131
- */
18132
- var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
18133
- /**
18134
- * Stable id within the provider — typically `<mode>-<sourcePort>` so
18135
- * the orchestrator can dedupe across `listEndpoints` polls.
18136
- */
18137
- id: z.string(),
18138
- /** Operator-facing label (mirrors `MeshEndpoint.label`). */
18139
- label: z.string(),
18140
- /** Optional provider-specific mode tag, used for icon/colour in admin UI. */
18141
- mode: z.string().optional(),
18142
- /** Originating local port the ingress fronts (informational). */
18143
- sourcePort: z.number().optional()
17862
+ //#region src/capabilities/log-destination.cap.ts
17863
+ var LogLevelSchema = z.enum([
17864
+ "debug",
17865
+ "info",
17866
+ "warn",
17867
+ "error"
17868
+ ]);
17869
+ var LogEntrySchema = z.object({
17870
+ timestamp: z.date(),
17871
+ level: LogLevelSchema,
17872
+ scope: z.array(z.string()),
17873
+ message: z.string(),
17874
+ meta: z.record(z.string(), z.unknown()).optional(),
17875
+ tags: z.record(z.string(), z.string()).optional()
18144
17876
  });
18145
- var networkAccessCapability = {
18146
- name: "network-access",
17877
+ var logDestinationCapability = {
17878
+ name: "log-destination",
18147
17879
  scope: "system",
18148
17880
  mode: "collection",
18149
- providerKind: "ingress",
17881
+ internal: true,
18150
17882
  methods: {
18151
- start: method(z.void(), NetworkEndpointSchema, { kind: "mutation" }),
18152
- stop: method(z.void(), z.void(), { kind: "mutation" }),
18153
- getEndpoint: method(z.void(), NetworkEndpointSchema.nullable()),
18154
- getStatus: method(z.void(), NetworkAccessStatusSchema),
18155
- /**
18156
- * Enumerate every active ingress entry. Providers that expose only a
18157
- * single endpoint may omit this method; callers fall back to
18158
- * `getEndpoint()` in that case.
18159
- */
18160
- listEndpoints: method(z.void(), z.array(NetworkEndpointEntrySchema).readonly())
18161
- }
17883
+ write: method(LogEntrySchema, z.void(), { kind: "mutation" }),
17884
+ query: method(z.object({
17885
+ scope: z.array(z.string()).optional(),
17886
+ level: LogLevelSchema.optional(),
17887
+ since: z.date().optional(),
17888
+ until: z.date().optional(),
17889
+ limit: z.number().optional(),
17890
+ tags: z.record(z.string(), z.string()).optional()
17891
+ }), z.array(LogEntrySchema).readonly())
17892
+ },
17893
+ /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
17894
+ mount: { kind: "skip" }
18162
17895
  };
18163
17896
  //#endregion
18164
- //#region src/capabilities/notification-output.cap.ts
17897
+ //#region src/capabilities/login-method.cap.ts
18165
17898
  /**
18166
- * notification-outputcanonical, capability-gated notification delivery.
17899
+ * `login-method`collection cap through which auth addons contribute
17900
+ * their pre-auth login surfaces to the login page. This is the SINGLE,
17901
+ * generic mechanism that supersedes the dead `auth.listProviders` reader:
17902
+ * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
17903
+ * `login-method` provider and the PUBLIC `auth.listLoginMethods`
17904
+ * procedure aggregates them for the unauthenticated login page.
18167
17905
  *
18168
- * Apprise-derived model (see
18169
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
18170
- * callers emit ONE canonical `Notification`; each provider declares a
18171
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
18172
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
18173
- * message to what the kind supports — callers never special-case a service.
17906
+ * A contribution is a discriminated union on `kind`:
18174
17907
  *
18175
- * DESIGN DECISIONS (locked):
18176
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
18177
- * `setTargetEnabled`), each provider persisting via the `settings-store`
18178
- * cap. Rationale: the admin UI needs one uniform surface across the
18179
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
18180
- * alternative would fork the UI per addon and cannot host the
18181
- * discovery→adopt flow.
18182
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
18183
- * the generated cap-mount auto-`concatCollection`-fans them across every
18184
- * registered provider (notifiers addon + HA addon) so one catalog is
18185
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
18186
- * `addonId` the generated collection router extracts from the call input.
18187
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
18188
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
18189
- * `storage` / `storage-provider` / `recording` caps over the same path. No
18190
- * base64 fallback needed.
17908
+ * - `redirect` a declarative button. The login page renders a generic
17909
+ * button that navigates to `startUrl` (an addon-owned HTTP route).
17910
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
17911
+ * ZERO shell-side JS. A future SSO addon plugs in the same way the
17912
+ * login page needs NO change.
18191
17913
  *
18192
- * TODO (deferred, closed-set change separate decision): add
18193
- * `providerKind: 'notify'` so notification providers surface on the unified
18194
- * admin "Integrations" page.
18195
- */
18196
- /**
18197
- * Zentik-derived typed-media enum — the superset across every kind. Each
18198
- * adapter picks what it supports and the degrade engine filters the rest.
18199
- */
18200
- var AttachmentMediaTypeSchema = z.enum([
18201
- "image",
18202
- "video",
18203
- "gif",
18204
- "audio",
18205
- "icon"
18206
- ]);
18207
- /**
18208
- * A single attachment. Exactly one of `url` (remote source, most adapters
18209
- * prefer this) or `bytes` (inline source; required for Pushover-style
18210
- * bytes-only kinds) MUST be present the degrade engine expresses a
18211
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
18212
- */
18213
- var AttachmentSchema = z.object({
18214
- mediaType: AttachmentMediaTypeSchema,
18215
- url: z.string().optional(),
18216
- bytes: z.instanceof(Uint8Array).optional(),
18217
- mime: z.string().optional(),
18218
- name: z.string().optional()
18219
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
18220
- var NotificationFormatSchema = z.enum([
18221
- "text",
18222
- "markdown",
18223
- "html"
18224
- ]);
18225
- /** A single tap-through action button. */
18226
- var NotificationActionSchema = z.object({
18227
- id: z.string(),
18228
- label: z.string(),
18229
- url: z.string().optional()
18230
- });
17914
+ * - `widget` a Module-Federation widget the login page mounts (via
17915
+ * `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
17916
+ * stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
17917
+ * mechanism kept for future use; no shipped addon uses it on the login
17918
+ * page (the passkey ceremony below runs natively in the shell instead).
17919
+ *
17920
+ * - `passkey` a declarative WebAuthn ceremony the shell renders
17921
+ * natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
17922
+ * a remotely-loaded bundle). Carries the addon's effective `rpId` /
17923
+ * `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
17924
+ * can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
17925
+ * fetching any remote code pre-auth. Contribution stays unconditional —
17926
+ * enrollment state is never leaked pre-auth; visibility is a shell
17927
+ * decision.
17928
+ *
17929
+ * Every contribution carries a `stage`:
17930
+ * - `primary` — shown on the first credentials screen (OIDC /
17931
+ * magic-link buttons; a future usernameless passkey).
17932
+ * - `second-factor` — shown AFTER the password leg, gated on the
17933
+ * returned `factors` (passkey-as-2FA today).
17934
+ *
17935
+ * `mount: skip` — the cap is read server-side by the core auth router
17936
+ * (`registry.getCollection('login-method')`), never mounted as its own
17937
+ * tRPC router.
17938
+ */
17939
+ /** When a login method renders in the two-phase login flow. */
17940
+ var LoginStageEnum = z.enum(["primary", "second-factor"]);
18231
17941
  /**
18232
- * The canonical notification. `body` is the only hard field (Apprise model).
18233
- * `priority` is a 5-level ORDINAL (1=lowest 3=normal(default) 5=urgent),
18234
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
18235
- * the adapter maps this ordinal onto its native level. `level?` is an
18236
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
18237
- * `priority` for that one target.
17942
+ * A declarative redirect button the login page navigates to `startUrl`.
17943
+ * OIDC and magic-link contribute this; a future SSO addon does too.
18238
17944
  */
18239
- var NotificationSchema = z.object({
18240
- body: z.string(),
18241
- title: z.string().optional(),
18242
- format: NotificationFormatSchema.default("text"),
18243
- priority: z.number().int().min(1).max(5).default(3),
18244
- level: z.string().optional(),
18245
- attachments: z.array(AttachmentSchema).optional(),
18246
- clickUrl: z.string().optional(),
18247
- actions: z.array(NotificationActionSchema).optional(),
18248
- sound: z.string().optional(),
18249
- ttl: z.number().optional(),
18250
- tag: z.string().optional(),
18251
- deviceId: z.number().optional(),
18252
- eventId: z.string().optional(),
18253
- metadata: z.record(z.string(), z.unknown()).optional()
18254
- });
18255
- /** One declared native severity/priority level for a kind. */
18256
- var TargetKindLevelSchema = z.object({
17945
+ var RedirectLoginMethodSchema = z.object({
17946
+ kind: z.literal("redirect"),
17947
+ /** Stable id within the login-method set (e.g. `auth-oidc/google`). */
18257
17948
  id: z.string(),
17949
+ /** Operator-facing button label. */
18258
17950
  label: z.string(),
18259
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
18260
- ordinal: z.number().int().min(1).max(5).nullable(),
18261
- flags: z.object({
18262
- critical: z.boolean().optional(),
18263
- silent: z.boolean().optional(),
18264
- noPush: z.boolean().optional()
18265
- }).optional(),
18266
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
18267
- requires: z.array(z.string()).optional(),
18268
- description: z.string().optional()
18269
- });
18270
- /** Attachment capabilities for a kind (drives the degrade engine + test panel). */
18271
- var TargetKindAttachmentsCapsSchema = z.object({
18272
- mediaTypes: z.array(AttachmentMediaTypeSchema),
18273
- mode: z.enum([
18274
- "url",
18275
- "bytes",
18276
- "both"
18277
- ]),
18278
- max: z.number().int().nonnegative(),
18279
- maxBytes: z.number().int().positive().optional()
18280
- });
18281
- /** The full capability block consulted before dispatch. */
18282
- var TargetKindCapsSchema = z.object({
18283
- attachments: TargetKindAttachmentsCapsSchema,
18284
- /** Max action buttons (0 = none). */
18285
- actions: z.number().int().nonnegative(),
18286
- levels: z.array(TargetKindLevelSchema),
18287
- format: z.array(NotificationFormatSchema),
18288
- clickUrl: z.boolean(),
18289
- sound: z.boolean(),
18290
- ttl: z.boolean(),
18291
- bodyMaxLen: z.number().int().positive()
17951
+ /** lucide-react icon name. */
17952
+ icon: z.string().optional(),
17953
+ /** Addon-owned HTTP route the button navigates to (GET). */
17954
+ startUrl: z.string(),
17955
+ stage: LoginStageEnum
18292
17956
  });
18293
17957
  /**
18294
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
18295
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
18296
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
18297
- * the union is large and not meant for runtime validation here; the exported
18298
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
17958
+ * A Module-Federation widget the login page mounts for an in-page
17959
+ * ceremony. `bundle` + `addonId` let `auth.listLoginMethods` stamp a
17960
+ * public `bundleUrl`; `remote` is the MF descriptor `loadRemoteBundle`
17961
+ * consumes. No `bundleUrl` here it is server-stamped on the public
17962
+ * output so the addon never encodes the static-route scheme.
18299
17963
  */
18300
- var ConfigSchemaPassthrough$1 = z.unknown();
18301
- var TargetKindSchema = z.object({
18302
- kind: z.string(),
18303
- label: z.string(),
18304
- icon: z.string(),
18305
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
17964
+ var WidgetLoginMethodSchema = z.object({
17965
+ kind: z.literal("widget"),
17966
+ /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
17967
+ id: z.string(),
17968
+ /** Owning addon id — drives the public bundle URL + the MF namespace. */
18306
17969
  addonId: z.string(),
18307
- configSchema: ConfigSchemaPassthrough$1,
18308
- supportsDiscovery: z.boolean(),
18309
- caps: TargetKindCapsSchema
17970
+ /** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
17971
+ bundle: z.string(),
17972
+ /** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
17973
+ remote: WidgetRemoteSchema,
17974
+ stage: LoginStageEnum
18310
17975
  });
18311
17976
  /**
18312
- * A persisted target. `config` holds secrets; providers REDACT secret fields
18313
- * (return a presence marker only) when serving `listTargets` never
18314
- * round-trip a stored secret to the UI.
17977
+ * A declarative WebAuthn ceremony the shell renders natively (no remote
17978
+ * code). Carries the addon's EFFECTIVE `rpId`/`origin` so the shell can
17979
+ * gate visibility (IP-literal origin, hostname/rpId mismatch) before ever
17980
+ * showing the button — the contribution itself stays unconditional.
18315
17981
  */
18316
- var TargetSchema = z.object({
17982
+ var PasskeyLoginMethodSchema = z.object({
17983
+ kind: z.literal("passkey"),
17984
+ /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
18317
17985
  id: z.string(),
18318
- name: z.string(),
18319
- kind: z.string(),
18320
- addonId: z.string(),
18321
- enabled: z.boolean(),
18322
- config: z.record(z.string(), z.unknown())
18323
- });
18324
- /** A discovery-surfaced candidate (config is partial + non-secret). */
18325
- var DiscoveredTargetSchema = z.object({
18326
- kind: z.string(),
18327
- suggestedName: z.string(),
18328
- config: z.record(z.string(), z.unknown())
18329
- });
18330
- /** The degrade engine's report — what was resolved / dropped / degraded. */
18331
- var RenderedAsSchema = z.object({
18332
- level: z.string(),
18333
- format: NotificationFormatSchema,
18334
- attachmentsSent: z.number().int().nonnegative(),
18335
- actionsSent: z.number().int().nonnegative(),
18336
- truncated: z.boolean(),
18337
- dropped: z.array(z.string())
18338
- });
18339
- var SendResultSchema = z.object({
18340
- success: z.boolean(),
18341
- error: z.string().optional(),
18342
- renderedAs: RenderedAsSchema.optional()
17986
+ /** Operator-facing button label. */
17987
+ label: z.string(),
17988
+ stage: LoginStageEnum,
17989
+ /** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
17990
+ rpId: z.string(),
17991
+ /** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
17992
+ origin: z.string().nullable()
18343
17993
  });
18344
- /** Same shape as SendResult kept as a distinct name for the test panel. */
18345
- var TestResultSchema = SendResultSchema;
18346
- var notificationOutputCapability = {
18347
- name: "notification-output",
17994
+ /** One login-method contributionredirect button, pre-auth widget, or native passkey ceremony. */
17995
+ var LoginMethodContributionSchema = z.discriminatedUnion("kind", [
17996
+ RedirectLoginMethodSchema,
17997
+ WidgetLoginMethodSchema,
17998
+ PasskeyLoginMethodSchema
17999
+ ]);
18000
+ var loginMethodCapability = {
18001
+ name: "login-method",
18348
18002
  scope: "system",
18349
18003
  mode: "collection",
18350
- methods: {
18351
- listTargetKinds: method(z.object({}), z.array(TargetKindSchema)),
18352
- listTargets: method(z.object({}), z.array(TargetSchema)),
18353
- discoverTargets: method(z.object({
18354
- kind: z.string(),
18355
- config: z.record(z.string(), z.unknown()).optional()
18356
- }), z.array(DiscoveredTargetSchema)),
18357
- send: method(z.object({
18358
- targetId: z.string(),
18359
- notification: NotificationSchema
18360
- }), SendResultSchema, { kind: "mutation" }),
18361
- testTarget: method(z.object({
18362
- targetId: z.string(),
18363
- sample: NotificationSchema.optional()
18364
- }), TestResultSchema, { kind: "mutation" }),
18365
- upsertTarget: method(z.object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }),
18366
- deleteTarget: method(z.object({ targetId: z.string() }), z.void(), { kind: "mutation" }),
18367
- setTargetEnabled: method(z.object({
18368
- targetId: z.string(),
18369
- enabled: z.boolean()
18370
- }), z.void(), { kind: "mutation" })
18371
- }
18004
+ internal: true,
18005
+ methods: { getLoginMethods: method(z.void(), z.array(LoginMethodContributionSchema).readonly()) },
18006
+ /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
18007
+ mount: { kind: "skip" }
18372
18008
  };
18373
18009
  //#endregion
18374
- //#region src/capabilities/llm-shared.ts
18375
- /**
18376
- * Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
18377
- * surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
18378
- * caps stay wire-compatible without a circular cap→cap import.
18379
- *
18380
- * Errors are a discriminated-union RESULT, never thrown: the shape survives
18381
- * every transport tier structurally, and failed calls still write usage rows.
18382
- * Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
18383
- */
18384
- var LlmUsageSchema = z.object({
18385
- inputTokens: z.number(),
18386
- outputTokens: z.number()
18010
+ //#region src/capabilities/metrics-provider.cap.ts
18011
+ var CpuBreakdownSchema = z.object({
18012
+ total: z.number(),
18013
+ user: z.number(),
18014
+ system: z.number(),
18015
+ irq: z.number(),
18016
+ nice: z.number(),
18017
+ loadAvg: z.tuple([
18018
+ z.number(),
18019
+ z.number(),
18020
+ z.number()
18021
+ ]),
18022
+ cores: z.number()
18387
18023
  });
18388
- var LlmErrorCodeSchema = z.enum([
18389
- "timeout",
18390
- "rate-limited",
18391
- "auth",
18392
- "refusal",
18393
- "bad-request",
18394
- "unavailable",
18395
- "no-profile",
18396
- "budget-exceeded",
18397
- "adapter-error"
18398
- ]);
18399
- var LlmGenerateOkSchema = z.object({
18400
- ok: z.literal(true),
18401
- text: z.string(),
18024
+ var MemoryInfoSchema = z.object({
18025
+ percent: z.number(),
18026
+ totalBytes: z.number(),
18027
+ usedBytes: z.number(),
18028
+ availableBytes: z.number(),
18029
+ swapUsedBytes: z.number(),
18030
+ swapTotalBytes: z.number()
18031
+ });
18032
+ var DiskIoSnapshotSchema = z.object({
18033
+ readBytes: z.number(),
18034
+ writeBytes: z.number(),
18035
+ readOps: z.number(),
18036
+ writeOps: z.number(),
18037
+ timestampMs: z.number()
18038
+ });
18039
+ var NetworkIoSnapshotSchema = z.object({
18040
+ rxBytes: z.number(),
18041
+ txBytes: z.number(),
18042
+ rxPackets: z.number(),
18043
+ txPackets: z.number(),
18044
+ rxErrors: z.number(),
18045
+ txErrors: z.number(),
18046
+ timestampMs: z.number()
18047
+ });
18048
+ var MetricsGpuInfoSchema = z.object({
18049
+ utilization: z.number(),
18402
18050
  model: z.string(),
18403
- usage: LlmUsageSchema,
18404
- truncated: z.boolean(),
18405
- latencyMs: z.number()
18051
+ memoryUsedBytes: z.number(),
18052
+ memoryTotalBytes: z.number(),
18053
+ temperature: z.number().nullable()
18406
18054
  });
18407
- var LlmGenerateErrSchema = z.object({
18408
- ok: z.literal(false),
18409
- code: LlmErrorCodeSchema,
18410
- message: z.string(),
18411
- retryAfterMs: z.number().optional()
18055
+ var ProcessResourceInfoSchema = z.object({
18056
+ openFds: z.number(),
18057
+ threadCount: z.number(),
18058
+ activeHandles: z.number(),
18059
+ activeRequests: z.number()
18412
18060
  });
18413
- var LlmGenerateResultSchema = z.discriminatedUnion("ok", [LlmGenerateOkSchema, LlmGenerateErrSchema]);
18414
- /**
18415
- * `Uint8Array` is the sanctioned binary convention — superjson + the UDS
18416
- * MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
18417
- * notification-output.cap.ts:27-31 precedents).
18418
- */
18419
- var LlmImageSchema = z.object({
18420
- bytes: z.instanceof(Uint8Array),
18421
- mimeType: z.string()
18061
+ var PressureAvgsSchema = z.object({
18062
+ avg10: z.number(),
18063
+ avg60: z.number(),
18064
+ avg300: z.number()
18422
18065
  });
18423
- var LlmGenerateBaseInputSchema = z.object({
18424
- /** Collection routing (the notification-output posture). */
18425
- addonId: z.string().optional(),
18426
- /** Explicit profile; else the resolution chain (spec §3). */
18427
- profileId: z.string().optional(),
18428
- /** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
18429
- consumer: z.string(),
18430
- system: z.string().optional(),
18431
- /** v1: single-turn. `messages[]` is a v2 additive field. */
18432
- prompt: z.string(),
18433
- /** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
18434
- jsonSchema: z.record(z.string(), z.unknown()).optional(),
18435
- /** Per-call override of the profile default. */
18436
- maxTokens: z.number().int().positive().optional(),
18437
- temperature: z.number().optional()
18066
+ var PressureInfoSchema = z.object({
18067
+ some: PressureAvgsSchema,
18068
+ full: PressureAvgsSchema.nullable()
18438
18069
  });
18439
- //#endregion
18440
- //#region src/capabilities/llm-runtime.cap.ts
18441
- /**
18442
- * `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
18443
- * on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
18444
- * a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
18445
- * cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
18446
- * this only through the `llm` cap's methods.
18447
- *
18448
- * One running llama-server child per node in v1 (models are RAM-heavy).
18449
- * Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
18450
- * watchdog — operator decision #3).
18451
- */
18452
- var ManagedModelRefSchema = z.discriminatedUnion("kind", [
18453
- z.object({
18454
- kind: z.literal("catalog"),
18455
- catalogId: z.string()
18456
- }),
18457
- z.object({
18458
- kind: z.literal("url"),
18459
- url: z.string(),
18460
- sha256: z.string().optional()
18070
+ var SystemResourceSnapshotSchema = z.object({
18071
+ cpu: CpuBreakdownSchema,
18072
+ memory: MemoryInfoSchema,
18073
+ gpu: MetricsGpuInfoSchema.nullable(),
18074
+ network: NetworkIoSnapshotSchema,
18075
+ disk: DiskIoSnapshotSchema,
18076
+ pressure: z.object({
18077
+ cpu: PressureInfoSchema.nullable(),
18078
+ memory: PressureInfoSchema.nullable(),
18079
+ io: PressureInfoSchema.nullable()
18461
18080
  }),
18462
- z.object({
18463
- kind: z.literal("path"),
18464
- path: z.string()
18465
- })
18466
- ]);
18467
- var ManagedRuntimeConfigSchema = z.object({
18468
- /** WHERE the runtime lives — hub or any agent. */
18469
- nodeId: z.string(),
18470
- /** Closed for v1; 'ollama' is a v2 candidate. */
18471
- engine: z.enum(["llama-cpp"]),
18472
- model: ManagedModelRefSchema,
18473
- contextSize: z.number().int().default(4096),
18474
- /** 0 = CPU-only. */
18475
- gpuLayers: z.number().int().default(0),
18476
- /** Default: cpus-2, clamped ≥1 (resolved node-side). */
18477
- threads: z.number().int().optional(),
18478
- /** Concurrent slots. */
18479
- parallel: z.number().int().default(1),
18480
- /** Else lazy: first generate boots it. */
18481
- autoStart: z.boolean().default(false),
18482
- /** 0 = never; frees RAM after quiet periods. */
18483
- idleStopMinutes: z.number().int().default(30)
18081
+ process: ProcessResourceInfoSchema,
18082
+ cpuTemperature: z.number().nullable(),
18083
+ timestampMs: z.number()
18484
18084
  });
18485
- var LlmRuntimeStatusSchema = z.object({
18486
- /** Status is ALWAYS node-qualified. */
18085
+ var DiskSpaceInfoSchema = z.object({
18086
+ path: z.string(),
18087
+ totalBytes: z.number(),
18088
+ usedBytes: z.number(),
18089
+ availableBytes: z.number(),
18090
+ percent: z.number()
18091
+ });
18092
+ var PidResourceStatsSchema = z.object({
18093
+ pid: z.number(),
18094
+ cpu: z.number(),
18095
+ memory: z.number(),
18096
+ /**
18097
+ * Private (anonymous) resident bytes — the per-process V8 heap + native
18098
+ * allocations NOT shared with other processes (Linux RssAnon). This is the
18099
+ * "real" per-runner cost; summing it across runners is meaningful, unlike
18100
+ * `memory` (RSS), which double-counts the shared mmap'd framework code.
18101
+ * Undefined where /proc is unavailable (e.g. macOS).
18102
+ */
18103
+ privateBytes: z.number().optional(),
18104
+ /**
18105
+ * Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
18106
+ * code shared copy-on-write across runners. Undefined on macOS.
18107
+ */
18108
+ sharedBytes: z.number().optional()
18109
+ });
18110
+ var AddonInstanceSchema = z.object({
18111
+ addonId: z.string(),
18487
18112
  nodeId: z.string(),
18113
+ role: z.enum(["hub", "worker"]),
18114
+ pid: z.number(),
18488
18115
  state: z.enum([
18489
- "stopped",
18490
- "downloading",
18491
18116
  "starting",
18492
- "ready",
18493
- "crashed",
18494
- "failed"
18117
+ "running",
18118
+ "stopping",
18119
+ "stopped",
18120
+ "crashed"
18495
18121
  ]),
18496
- pid: z.number().optional(),
18497
- port: z.number().optional(),
18498
- modelPath: z.string().optional(),
18499
- modelId: z.string().optional(),
18500
- downloadProgress: z.number().min(0).max(1).optional(),
18501
- lastError: z.string().optional(),
18502
- crashesInWindow: z.number(),
18503
- /** Child RSS (sampled best-effort). */
18504
- memoryBytes: z.number().optional(),
18505
- vramBytes: z.number().optional()
18122
+ uptimeSec: z.number()
18506
18123
  });
18507
- var LlmNodeModelSchema = z.object({
18508
- file: z.string(),
18509
- sizeBytes: z.number(),
18510
- catalogId: z.string().optional(),
18511
- installedAt: z.number().optional()
18124
+ var NodeProcessSchema = z.object({
18125
+ pid: z.number(),
18126
+ ppid: z.number(),
18127
+ pgid: z.number(),
18128
+ classification: z.enum([
18129
+ "root",
18130
+ "managed",
18131
+ "system",
18132
+ "ghost"
18133
+ ]),
18134
+ /** `$process` addon binding when `managed`, else null. */
18135
+ addonId: z.string().nullable(),
18136
+ /** Kernel-reported nodeId when the process is a known agent/worker. */
18137
+ nodeId: z.string().nullable(),
18138
+ /** Truncated command line. */
18139
+ command: z.string(),
18140
+ cpuPercent: z.number(),
18141
+ memoryRssBytes: z.number(),
18142
+ /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
18143
+ uptimeSec: z.number(),
18144
+ /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
18145
+ orphaned: z.boolean()
18512
18146
  });
18513
- var LlmRuntimeDiskUsageSchema = z.object({
18514
- nodeId: z.string(),
18515
- modelsBytes: z.number(),
18516
- freeBytes: z.number().optional()
18147
+ var KillProcessInputSchema = z.object({
18148
+ pid: z.number(),
18149
+ /** Force = SIGKILL. Default is SIGTERM. */
18150
+ force: z.boolean().optional()
18517
18151
  });
18518
- var LlmRuntimeCompleteInputSchema = LlmGenerateBaseInputSchema.extend({
18519
- images: z.array(LlmImageSchema).optional(),
18520
- runtime: ManagedRuntimeConfigSchema,
18521
- /** The managed profile's timeout, threaded by the hub provider. */
18522
- timeoutMs: z.number().int().positive().optional()
18152
+ var KillProcessResultSchema = z.object({
18153
+ success: z.boolean(),
18154
+ reason: z.string().optional(),
18155
+ signal: z.enum(["SIGTERM", "SIGKILL"]).optional()
18523
18156
  });
18524
- var llmRuntimeCapability = {
18525
- name: "llm-runtime",
18157
+ var DumpHeapSnapshotInputSchema = z.object({
18158
+ /** The addon whose runner should dump a heap snapshot. */
18159
+ addonId: z.string() });
18160
+ var DumpHeapSnapshotResultSchema = z.object({
18161
+ success: z.boolean(),
18162
+ /** Path of the written .heapsnapshot inside the runner's container/host. */
18163
+ path: z.string().optional(),
18164
+ /** Process pid that was signalled. */
18165
+ pid: z.number().optional(),
18166
+ reason: z.string().optional()
18167
+ });
18168
+ var SystemMetricsSchema = z.object({
18169
+ cpuPercent: z.number(),
18170
+ memoryPercent: z.number(),
18171
+ memoryUsedMB: z.number(),
18172
+ memoryTotalMB: z.number(),
18173
+ diskPercent: z.number().optional(),
18174
+ temperature: z.number().optional(),
18175
+ gpuPercent: z.number().optional(),
18176
+ gpuMemoryPercent: z.number().optional()
18177
+ });
18178
+ var metricsProviderCapability = {
18179
+ name: "metrics-provider",
18526
18180
  scope: "system",
18527
18181
  mode: "singleton",
18528
- internal: true,
18529
18182
  methods: {
18530
- complete: method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
18531
- ensureStarted: method(z.object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
18532
- kind: "mutation",
18533
- auth: "admin"
18534
- }),
18535
- stop: method(z.object({}), z.void(), {
18536
- kind: "mutation",
18537
- auth: "admin"
18538
- }),
18539
- status: method(z.object({}), LlmRuntimeStatusSchema),
18540
- installModel: method(z.object({ model: ManagedModelRefSchema }), z.void(), {
18183
+ /** Fresh, full system snapshot (triggers OS-level collection). */
18184
+ collectSnapshot: method(z.void(), SystemResourceSnapshotSchema),
18185
+ /** Most recent cached snapshot from the background sampler, or null pre-first-sample. */
18186
+ getCached: method(z.void(), SystemResourceSnapshotSchema.nullable()),
18187
+ /** Light-weight cached summary for heartbeats and list views. */
18188
+ getCurrent: method(z.void(), SystemMetricsSchema),
18189
+ /** Disk space for the given mount/path. */
18190
+ getDiskSpace: method(z.object({ dirPath: z.string() }), DiskSpaceInfoSchema),
18191
+ /** GPU info (null if unavailable). */
18192
+ getGpuInfo: method(z.void(), MetricsGpuInfoSchema.nullable()),
18193
+ /** CPU temperature in °C (null if unavailable). */
18194
+ getCpuTemperature: method(z.void(), z.number().nullable()),
18195
+ /** Per-PID resource stats. Missing/dead PIDs are omitted from the result. */
18196
+ getProcessStats: method(z.object({ pids: z.array(z.number()) }), z.array(PidResourceStatsSchema)),
18197
+ /**
18198
+ * List addon instances known to this node — one entry per forked worker
18199
+ * plus a synthetic 'hub' entry representing the local hub process.
18200
+ * Used by benchmarks/observability to detect whether a given addon runs
18201
+ * in its own process (measurable independently) or inline with the hub.
18202
+ */
18203
+ listAddonInstances: method(z.void(), z.array(AddonInstanceSchema).readonly()),
18204
+ /**
18205
+ * Resource stats for the process hosting the given addon.
18206
+ * Returns null when the addon runs in-process on the hub (can't measure
18207
+ * independently — caller should detect via listAddonInstances). Returns
18208
+ * hub process stats for addonId '$hub'.
18209
+ */
18210
+ getAddonStats: method(z.object({ addonId: z.string() }), PidResourceStatsSchema.nullable()),
18211
+ /**
18212
+ * Snapshot of every camstack-related process on this node with a
18213
+ * ghost/managed/root classification. Powers the Cluster → Agent →
18214
+ * Processes tab: cross-references `$process.list` against a `ps` scan
18215
+ * so orphaned trees (PPID=1) or unknown children show up as `ghost`
18216
+ * and can be killed from the UI.
18217
+ */
18218
+ listNodeProcesses: method(z.void(), z.array(NodeProcessSchema).readonly()),
18219
+ /**
18220
+ * Send SIGTERM (or SIGKILL when `force`) to a pid inside this node's
18221
+ * process tree. The provider refuses pids that aren't in the live
18222
+ * `listNodeProcesses()` snapshot — callers can't use this endpoint
18223
+ * to kill arbitrary system processes.
18224
+ */
18225
+ killProcess: method(KillProcessInputSchema, KillProcessResultSchema, {
18541
18226
  kind: "mutation",
18542
18227
  auth: "admin"
18543
18228
  }),
18544
- deleteModel: method(z.object({ file: z.string() }), z.void(), {
18229
+ /**
18230
+ * Tell the addon's forked runner to write a V8 heap snapshot to disk (via
18231
+ * SIGUSR2 — the runner's diagnostic handler). Also logs its
18232
+ * `process.memoryUsage()` + heap-space breakdown. Refuses pids not in the
18233
+ * live `listNodeProcesses()` snapshot. Use for deep per-addon memory
18234
+ * attribution; copy the returned path off the node to analyze.
18235
+ */
18236
+ dumpHeapSnapshot: method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
18545
18237
  kind: "mutation",
18546
18238
  auth: "admin"
18547
- }),
18548
- listLocalModels: method(z.object({}), z.array(LlmNodeModelSchema)),
18549
- getDiskUsage: method(z.object({}), LlmRuntimeDiskUsageSchema)
18239
+ })
18550
18240
  }
18551
18241
  };
18552
18242
  //#endregion
18553
- //#region src/capabilities/llm.cap.ts
18243
+ //#region src/capabilities/model-convert.cap.ts
18244
+ var ModelConvertInputSchema = z.object({
18245
+ sourceUrl: z.string(),
18246
+ metadata: ModelConvertMetadataSchema,
18247
+ targets: z.array(ConvertTargetSchema).min(1).readonly(),
18248
+ calibrationRef: z.string().optional(),
18249
+ sessionId: z.string().optional()
18250
+ });
18251
+ var modelConvertCapability = {
18252
+ name: "model-convert",
18253
+ scope: "system",
18254
+ mode: "singleton",
18255
+ internal: true,
18256
+ methods: { convert: method(ModelConvertInputSchema, ConvertResultSchema, {
18257
+ kind: "mutation",
18258
+ auth: "admin",
18259
+ timeoutMs: 6e5
18260
+ }) }
18261
+ };
18262
+ //#endregion
18263
+ //#region src/capabilities/model-distributor.cap.ts
18554
18264
  /**
18555
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
18556
- * methods concat-fan across providers; single-row methods route to ONE
18557
- * provider by the `addonId` in the call input (the notification-output
18558
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
18559
- * (hub-placed); the cap stays open for future providers.
18265
+ * `model-distributor` — singleton, hub-resident. Pushes a model FORMAT that is
18266
+ * already present on the hub's `/data/models` to a target agent node's
18267
+ * `/data/models`, sha256-verified, reusing the agent-pull machinery
18268
+ * (DeployStageRegistry + the one-time-token bundle route + the agent's
18269
+ * `fetchBundleFromHub`). Its provider is built in `server/backend` because it
18270
+ * needs the Moleculer broker + the deploy-stage registry, which a forked addon
18271
+ * can't reach. `addon-model-studio` drives it via `ctx.api` and owns the
18272
+ * per-node availability map.
18273
+ */
18274
+ var ModelDistributeInputSchema = z.object({
18275
+ nodeId: z.string(),
18276
+ modelId: z.string(),
18277
+ format: z.enum(MODEL_FORMATS),
18278
+ entry: ModelCatalogEntrySchema
18279
+ });
18280
+ var ModelDistributeResultSchema = z.object({
18281
+ ok: z.boolean(),
18282
+ /** sha256 of the staged tarball (empty for a hub-local no-op). */
18283
+ sha256: z.string(),
18284
+ bytes: z.number(),
18285
+ /** The target node's modelsDir the artifact landed in. */
18286
+ path: z.string()
18287
+ });
18288
+ var modelDistributorCapability = {
18289
+ name: "model-distributor",
18290
+ scope: "system",
18291
+ mode: "singleton",
18292
+ internal: true,
18293
+ methods: { distributeModel: method(ModelDistributeInputSchema, ModelDistributeResultSchema, {
18294
+ kind: "mutation",
18295
+ auth: "admin"
18296
+ }) }
18297
+ };
18298
+ //#endregion
18299
+ //#region src/capabilities/mqtt-broker.cap.ts
18300
+ /**
18301
+ * `mqtt-broker` — broker-registry cap.
18560
18302
  *
18561
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
18562
- * `apiKey` is a password field providers REDACT it on read and merge on
18563
- * write; a stored key NEVER round-trips to a client.
18303
+ * NOT a pub/sub proxy. The cap exposes (a) a registry of configured
18304
+ * MQTT brokers (external + optionally an embedded `aedes`-backed one)
18305
+ * and (b) the connection details a consumer addon needs to spin up
18306
+ * its OWN `mqtt.js` client.
18307
+ *
18308
+ * Why: pub/sub routing over the system event-bus loses fidelity
18309
+ * (callback shape, QoS guarantees, will/retain semantics) and adds
18310
+ * refcount bookkeeping that addons would rather own themselves. The
18311
+ * canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
18312
+ * features anyway — give it the connection config, get out of the way.
18313
+ *
18314
+ * Consumer flow:
18315
+ * const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
18316
+ * const client = mqtt.connect(cfg.url, { username: cfg.username, … })
18317
+ * client.subscribe('zigbee2mqtt/+')
18318
+ *
18319
+ * Collection mode: multiple brokers (e.g. one local mosquitto + one
18320
+ * cloud bridge). The "embedded" entry (when present) is just another
18321
+ * broker in the registry — its lifecycle is owned by the addon that
18322
+ * spawned it.
18564
18323
  */
18565
- var LlmProfileKindSchema = z.enum([
18566
- "openai-compatible",
18567
- "openai",
18568
- "anthropic",
18569
- "google",
18570
- "managed-local"
18324
+ var BrokerKindSchema = z.enum(["external", "embedded"]);
18325
+ /**
18326
+ * Broker live-probe status.
18327
+ *
18328
+ * - `connected` — last probe completed a clean CONNACK
18329
+ * - `disconnected` — no probe has run yet (cold cache)
18330
+ * - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
18331
+ * - `unreachable` — TCP connect timed out / refused
18332
+ * - `tls-error` — TLS handshake failed (cert / SNI / cipher)
18333
+ */
18334
+ var BrokerStatusSchema$1 = z.enum([
18335
+ "connected",
18336
+ "disconnected",
18337
+ "auth-failed",
18338
+ "unreachable",
18339
+ "tls-error"
18571
18340
  ]);
18572
- var LlmProfileSchema = z.object({
18341
+ var BrokerInfoSchema = z.object({
18573
18342
  id: z.string(),
18574
18343
  name: z.string(),
18575
- kind: LlmProfileKindSchema,
18576
- /** Stamped by the provider — keeps the fanned catalog routable. */
18577
- addonId: z.string(),
18578
- enabled: z.boolean(),
18579
- /** Vendor model id, or the managed runtime's loaded model. */
18580
- model: z.string(),
18581
- /** Required for openai-compatible; override for cloud kinds. */
18582
- baseUrl: z.string().optional(),
18583
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
18584
- apiKey: z.string().optional(),
18585
- supportsVision: z.boolean(),
18586
- temperature: z.number().min(0).max(2).optional(),
18587
- maxTokens: z.number().int().positive().optional(),
18588
- timeoutMs: z.number().int().positive().default(6e4),
18589
- extraHeaders: z.record(z.string(), z.string()).optional(),
18590
- /** kind === 'managed-local' only (spec §4). */
18591
- runtime: ManagedRuntimeConfigSchema.optional()
18344
+ url: z.string(),
18345
+ kind: BrokerKindSchema,
18346
+ status: BrokerStatusSchema$1,
18347
+ latencyMs: z.number().nullable(),
18348
+ error: z.string().optional(),
18349
+ /** Embedded brokers only: number of MQTT clients currently connected. */
18350
+ connectedClients: z.number().int().nonnegative().optional(),
18351
+ /** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
18352
+ lastCheckedAt: z.number().optional()
18592
18353
  });
18593
- /** ConfigUISchema tree passed through untyped on the wire (the
18594
- * notification-output `ConfigSchemaPassthrough` precedent at
18595
- * notification-output.cap.ts:151); the exported TS type re-tightens it. */
18596
- var ConfigSchemaPassthrough = z.unknown();
18597
- var LlmProfileKindDescriptorSchema = z.object({
18598
- kind: LlmProfileKindSchema,
18599
- label: z.string(),
18600
- icon: z.string(),
18601
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
18602
- addonId: z.string(),
18603
- configSchema: ConfigSchemaPassthrough
18354
+ /**
18355
+ * Connection details — what a consumer needs to call
18356
+ * `mqtt.connect(url, options)`. We split URL + credentials so the
18357
+ * consumer can pass them as `mqtt.connect(url, { username, password })`
18358
+ * instead of stuffing creds into the URL (which leaks them into logs).
18359
+ */
18360
+ var BrokerConnectionDetailsSchema = z.object({
18361
+ url: z.string(),
18362
+ username: z.string().optional(),
18363
+ password: z.string().optional(),
18364
+ /**
18365
+ * Suggested prefix for `clientId`. Each consumer should suffix this
18366
+ * with its own discriminator (addon id, instance id) so reconnects
18367
+ * don't kick each other off (MQTT spec: clientId must be unique per
18368
+ * broker).
18369
+ */
18370
+ clientIdPrefix: z.string().optional()
18604
18371
  });
18605
- var LlmDefaultSelectorSchema = z.union([z.object({ consumer: z.string() }), z.object({ purpose: z.enum(["text", "vision"]) })]);
18606
- var LlmDefaultSchema = z.object({
18607
- selector: LlmDefaultSelectorSchema,
18608
- profileId: z.string()
18372
+ var AddBrokerInputSchema = z.object({
18373
+ name: z.string().min(1),
18374
+ url: z.string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
18375
+ username: z.string().optional(),
18376
+ password: z.string().optional(),
18377
+ clientIdPrefix: z.string().optional()
18609
18378
  });
18610
- /** Server-side rollup row getUsage never dumps raw call rows (spec §6). */
18611
- var LlmUsageRollupSchema = z.object({
18612
- day: z.string(),
18613
- consumer: z.string(),
18614
- profileId: z.string(),
18615
- calls: z.number(),
18616
- okCalls: z.number(),
18617
- errorCalls: z.number(),
18618
- inputTokens: z.number(),
18619
- outputTokens: z.number(),
18620
- avgLatencyMs: z.number()
18379
+ var AddBrokerResultSchema = z.object({ id: z.string() });
18380
+ var IdInputSchema = z.object({ id: z.string() });
18381
+ var TestResultSchema$1 = z.discriminatedUnion("ok", [z.object({
18382
+ ok: z.literal(true),
18383
+ latencyMs: z.number()
18384
+ }), z.object({
18385
+ ok: z.literal(false),
18386
+ error: z.string()
18387
+ })]);
18388
+ var StartEmbeddedInputSchema = z.object({
18389
+ port: z.number().int().min(1).max(65535).default(1883),
18390
+ /** Allow anonymous connect (no username/password). Default: false. */
18391
+ allowAnonymous: z.boolean().default(false),
18392
+ /** Optional shared username/password for clients. */
18393
+ username: z.string().optional(),
18394
+ password: z.string().optional()
18395
+ });
18396
+ var StartEmbeddedResultSchema = z.object({
18397
+ id: z.string(),
18398
+ url: z.string()
18399
+ });
18400
+ var StatusSchema = z.object({
18401
+ brokerCount: z.number(),
18402
+ embeddedRunning: z.boolean()
18403
+ });
18404
+ var mqttBrokerCapability = {
18405
+ name: "mqtt-broker",
18406
+ scope: "system",
18407
+ mode: "collection",
18408
+ providerKind: "broker",
18409
+ status: {
18410
+ schema: StatusSchema,
18411
+ kind: "poll"
18412
+ },
18413
+ methods: {
18414
+ listBrokers: method(z.void(), z.array(BrokerInfoSchema)),
18415
+ getBrokerConfig: method(IdInputSchema, BrokerConnectionDetailsSchema),
18416
+ addBroker: method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }),
18417
+ removeBroker: method(IdInputSchema, z.void(), { kind: "mutation" }),
18418
+ testConnection: method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }),
18419
+ startEmbeddedBroker: method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }),
18420
+ stopEmbeddedBroker: method(IdInputSchema, z.void(), { kind: "mutation" }),
18421
+ getStatus: method(z.void(), StatusSchema)
18422
+ }
18423
+ };
18424
+ //#endregion
18425
+ //#region src/capabilities/network-access.cap.ts
18426
+ var NetworkEndpointSchema = z.object({
18427
+ url: z.string(),
18428
+ hostname: z.string(),
18429
+ port: z.number(),
18430
+ protocol: z.enum(["http", "https"])
18431
+ });
18432
+ var NetworkAccessStatusSchema = z.object({
18433
+ connected: z.boolean(),
18434
+ endpoint: NetworkEndpointSchema.nullable(),
18435
+ error: z.string().optional()
18436
+ });
18437
+ /**
18438
+ * Optional, richer endpoint shape returned by providers that expose
18439
+ * MORE than one ingress concurrently (Tailscale Ingress with mixed
18440
+ * serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
18441
+ * the originating provider config (mode + sourcePort) so the
18442
+ * orchestrator UI can label rows distinctly. Providers that expose only
18443
+ * one endpoint just omit `listEndpoints` from their provider impl.
18444
+ */
18445
+ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
18446
+ /**
18447
+ * Stable id within the provider — typically `<mode>-<sourcePort>` so
18448
+ * the orchestrator can dedupe across `listEndpoints` polls.
18449
+ */
18450
+ id: z.string(),
18451
+ /** Operator-facing label (mirrors `MeshEndpoint.label`). */
18452
+ label: z.string(),
18453
+ /** Optional provider-specific mode tag, used for icon/colour in admin UI. */
18454
+ mode: z.string().optional(),
18455
+ /** Originating local port the ingress fronts (informational). */
18456
+ sourcePort: z.number().optional()
18457
+ });
18458
+ var networkAccessCapability = {
18459
+ name: "network-access",
18460
+ scope: "system",
18461
+ mode: "collection",
18462
+ providerKind: "ingress",
18463
+ methods: {
18464
+ start: method(z.void(), NetworkEndpointSchema, { kind: "mutation" }),
18465
+ stop: method(z.void(), z.void(), { kind: "mutation" }),
18466
+ getEndpoint: method(z.void(), NetworkEndpointSchema.nullable()),
18467
+ getStatus: method(z.void(), NetworkAccessStatusSchema),
18468
+ /**
18469
+ * Enumerate every active ingress entry. Providers that expose only a
18470
+ * single endpoint may omit this method; callers fall back to
18471
+ * `getEndpoint()` in that case.
18472
+ */
18473
+ listEndpoints: method(z.void(), z.array(NetworkEndpointEntrySchema).readonly())
18474
+ }
18475
+ };
18476
+ //#endregion
18477
+ //#region src/capabilities/notification-output.cap.ts
18478
+ /**
18479
+ * notification-output — canonical, capability-gated notification delivery.
18480
+ *
18481
+ * Apprise-derived model (see
18482
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
18483
+ * callers emit ONE canonical `Notification`; each provider declares a
18484
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
18485
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
18486
+ * message to what the kind supports — callers never special-case a service.
18487
+ *
18488
+ * DESIGN DECISIONS (locked):
18489
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
18490
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
18491
+ * cap. Rationale: the admin UI needs one uniform surface across the
18492
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
18493
+ * alternative would fork the UI per addon and cannot host the
18494
+ * discovery→adopt flow.
18495
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
18496
+ * the generated cap-mount auto-`concatCollection`-fans them across every
18497
+ * registered provider (notifiers addon + HA addon) so one catalog is
18498
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
18499
+ * `addonId` the generated collection router extracts from the call input.
18500
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
18501
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
18502
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
18503
+ * base64 fallback needed.
18504
+ *
18505
+ * TODO (deferred, closed-set change — separate decision): add
18506
+ * `providerKind: 'notify'` so notification providers surface on the unified
18507
+ * admin "Integrations" page.
18508
+ */
18509
+ /**
18510
+ * Zentik-derived typed-media enum — the superset across every kind. Each
18511
+ * adapter picks what it supports and the degrade engine filters the rest.
18512
+ */
18513
+ var AttachmentMediaTypeSchema = z.enum([
18514
+ "image",
18515
+ "video",
18516
+ "gif",
18517
+ "audio",
18518
+ "icon"
18519
+ ]);
18520
+ /**
18521
+ * A single attachment. Exactly one of `url` (remote source, most adapters
18522
+ * prefer this) or `bytes` (inline source; required for Pushover-style
18523
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
18524
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
18525
+ */
18526
+ var AttachmentSchema = z.object({
18527
+ mediaType: AttachmentMediaTypeSchema,
18528
+ url: z.string().optional(),
18529
+ bytes: z.instanceof(Uint8Array).optional(),
18530
+ mime: z.string().optional(),
18531
+ name: z.string().optional()
18532
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
18533
+ var NotificationFormatSchema = z.enum([
18534
+ "text",
18535
+ "markdown",
18536
+ "html"
18537
+ ]);
18538
+ /** A single tap-through action button. */
18539
+ var NotificationActionSchema = z.object({
18540
+ id: z.string(),
18541
+ label: z.string(),
18542
+ url: z.string().optional()
18543
+ });
18544
+ /**
18545
+ * The canonical notification. `body` is the only hard field (Apprise model).
18546
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
18547
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
18548
+ * the adapter maps this ordinal onto its native level. `level?` is an
18549
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
18550
+ * `priority` for that one target.
18551
+ */
18552
+ var NotificationSchema = z.object({
18553
+ body: z.string(),
18554
+ title: z.string().optional(),
18555
+ format: NotificationFormatSchema.default("text"),
18556
+ priority: z.number().int().min(1).max(5).default(3),
18557
+ level: z.string().optional(),
18558
+ attachments: z.array(AttachmentSchema).optional(),
18559
+ clickUrl: z.string().optional(),
18560
+ actions: z.array(NotificationActionSchema).optional(),
18561
+ sound: z.string().optional(),
18562
+ ttl: z.number().optional(),
18563
+ tag: z.string().optional(),
18564
+ deviceId: z.number().optional(),
18565
+ eventId: z.string().optional(),
18566
+ metadata: z.record(z.string(), z.unknown()).optional()
18567
+ });
18568
+ /** One declared native severity/priority level for a kind. */
18569
+ var TargetKindLevelSchema = z.object({
18570
+ id: z.string(),
18571
+ label: z.string(),
18572
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
18573
+ ordinal: z.number().int().min(1).max(5).nullable(),
18574
+ flags: z.object({
18575
+ critical: z.boolean().optional(),
18576
+ silent: z.boolean().optional(),
18577
+ noPush: z.boolean().optional()
18578
+ }).optional(),
18579
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
18580
+ requires: z.array(z.string()).optional(),
18581
+ description: z.string().optional()
18582
+ });
18583
+ /** Attachment capabilities for a kind (drives the degrade engine + test panel). */
18584
+ var TargetKindAttachmentsCapsSchema = z.object({
18585
+ mediaTypes: z.array(AttachmentMediaTypeSchema),
18586
+ mode: z.enum([
18587
+ "url",
18588
+ "bytes",
18589
+ "both"
18590
+ ]),
18591
+ max: z.number().int().nonnegative(),
18592
+ maxBytes: z.number().int().positive().optional()
18593
+ });
18594
+ /** The full capability block consulted before dispatch. */
18595
+ var TargetKindCapsSchema = z.object({
18596
+ attachments: TargetKindAttachmentsCapsSchema,
18597
+ /** Max action buttons (0 = none). */
18598
+ actions: z.number().int().nonnegative(),
18599
+ levels: z.array(TargetKindLevelSchema),
18600
+ format: z.array(NotificationFormatSchema),
18601
+ clickUrl: z.boolean(),
18602
+ sound: z.boolean(),
18603
+ ttl: z.boolean(),
18604
+ bodyMaxLen: z.number().int().positive()
18605
+ });
18606
+ /**
18607
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
18608
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
18609
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
18610
+ * the union is large and not meant for runtime validation here; the exported
18611
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
18612
+ */
18613
+ var ConfigSchemaPassthrough = z.unknown();
18614
+ var TargetKindSchema = z.object({
18615
+ kind: z.string(),
18616
+ label: z.string(),
18617
+ icon: z.string(),
18618
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
18619
+ addonId: z.string(),
18620
+ configSchema: ConfigSchemaPassthrough,
18621
+ supportsDiscovery: z.boolean(),
18622
+ caps: TargetKindCapsSchema
18623
+ });
18624
+ /**
18625
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
18626
+ * (return a presence marker only) when serving `listTargets` — never
18627
+ * round-trip a stored secret to the UI.
18628
+ */
18629
+ var TargetSchema = z.object({
18630
+ id: z.string(),
18631
+ name: z.string(),
18632
+ kind: z.string(),
18633
+ addonId: z.string(),
18634
+ enabled: z.boolean(),
18635
+ config: z.record(z.string(), z.unknown())
18636
+ });
18637
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
18638
+ var DiscoveredTargetSchema = z.object({
18639
+ kind: z.string(),
18640
+ suggestedName: z.string(),
18641
+ config: z.record(z.string(), z.unknown())
18642
+ });
18643
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
18644
+ var RenderedAsSchema = z.object({
18645
+ level: z.string(),
18646
+ format: NotificationFormatSchema,
18647
+ attachmentsSent: z.number().int().nonnegative(),
18648
+ actionsSent: z.number().int().nonnegative(),
18649
+ truncated: z.boolean(),
18650
+ dropped: z.array(z.string())
18651
+ });
18652
+ var SendResultSchema = z.object({
18653
+ success: z.boolean(),
18654
+ error: z.string().optional(),
18655
+ renderedAs: RenderedAsSchema.optional()
18656
+ });
18657
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
18658
+ var TestResultSchema = SendResultSchema;
18659
+ var notificationOutputCapability = {
18660
+ name: "notification-output",
18661
+ scope: "system",
18662
+ mode: "collection",
18663
+ methods: {
18664
+ listTargetKinds: method(z.object({}), z.array(TargetKindSchema)),
18665
+ listTargets: method(z.object({}), z.array(TargetSchema)),
18666
+ discoverTargets: method(z.object({
18667
+ kind: z.string(),
18668
+ config: z.record(z.string(), z.unknown()).optional()
18669
+ }), z.array(DiscoveredTargetSchema)),
18670
+ send: method(z.object({
18671
+ targetId: z.string(),
18672
+ notification: NotificationSchema
18673
+ }), SendResultSchema, { kind: "mutation" }),
18674
+ testTarget: method(z.object({
18675
+ targetId: z.string(),
18676
+ sample: NotificationSchema.optional()
18677
+ }), TestResultSchema, { kind: "mutation" }),
18678
+ upsertTarget: method(z.object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }),
18679
+ deleteTarget: method(z.object({ targetId: z.string() }), z.void(), { kind: "mutation" }),
18680
+ setTargetEnabled: method(z.object({
18681
+ targetId: z.string(),
18682
+ enabled: z.boolean()
18683
+ }), z.void(), { kind: "mutation" })
18684
+ }
18685
+ };
18686
+ //#endregion
18687
+ //#region src/capabilities/notification-rules.cap.ts
18688
+ /**
18689
+ * notification-rules — the Notification Center rule surface (P1 core).
18690
+ *
18691
+ * Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
18692
+ * (operator decisions D-1/D-2/D-3 are binding):
18693
+ *
18694
+ * - D-2: rule EVALUATION lives in `addon-post-analysis` (the
18695
+ * `notification-center` module), hooked on the durable persistence
18696
+ * moments (object-event insert, TrackCloser.closeExpired) with a
18697
+ * persisted outbox + retry — never the lossy telemetry bus (D8).
18698
+ * - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
18699
+ * FIRST persisted detection matching the conditions (per-track dedup,
18700
+ * `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
18701
+ * `delivery: 'track-end'` evaluates the finalized track record at close.
18702
+ * - DISPATCH stays behind `notification-output` (rules reference targets
18703
+ * by id; per-backend params are a passthrough blob capped by the
18704
+ * target kind's own caps/degrade engine).
18705
+ *
18706
+ * P1 scope: admin-authored rules only (`createdBy` stamped from the
18707
+ * server-injected caller identity — the first `caller: 'required'`
18708
+ * adopter). The P1 condition subset is: devices, classes(+exclude),
18709
+ * minConfidence, admin zones (any/all + exclude), weekly schedule
18710
+ * windows, and the optional label/identity/plate matchers. User rules,
18711
+ * private zones, per-recipient fan-out and the wider condition table are
18712
+ * P2+ (see spec §7).
18713
+ *
18714
+ * All schemas here are the single source of truth — `NcRule` etc. are
18715
+ * `z.infer` exports; no duplicate interfaces (the advanced-notifier
18716
+ * schema/interface drift is explicitly not repeated).
18717
+ */
18718
+ /**
18719
+ * D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
18720
+ * The value maps 1:1 onto the evaluated record kind:
18721
+ * - `immediate` ↔ object-event persist (lowest-latency detection burst)
18722
+ * - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
18723
+ * - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
18724
+ * change of a LINKED device, one row per linked camera)
18725
+ * - `package-event` ↔ PackageDropDetector object-event insert (a `package`
18726
+ * delivery / pick-up)
18727
+ *
18728
+ * `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
18729
+ * `package-event` are pure trigger kinds (no urgency dimension). Extending
18730
+ * this one field keeps the schema additive — a rule still declares exactly
18731
+ * one trigger.
18732
+ */
18733
+ var NcDeliverySchema = z.enum([
18734
+ "immediate",
18735
+ "track-end",
18736
+ "device-event",
18737
+ "package-event"
18738
+ ]);
18739
+ /**
18740
+ * `maxPerTrack` for `immediate` rules is FIXED at 1 (D-3): a single track
18741
+ * fires an immediate rule at most once, enforced durably by the outbox
18742
+ * unique key `(ruleId, trackId, targetId)`. Not a rule field in P1.
18743
+ */
18744
+ var NC_MAX_PER_TRACK_IMMEDIATE = 1;
18745
+ /** One weekly activation window. `startMinute > endMinute` crosses midnight. */
18746
+ var NcScheduleWindowSchema = z.object({
18747
+ /** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
18748
+ days: z.array(z.number().int().min(0).max(6)).min(1),
18749
+ startMinute: z.number().int().min(0).max(1439),
18750
+ endMinute: z.number().int().min(0).max(1439)
18751
+ });
18752
+ /** Weekly schedule — OR of windows; absence on the rule = always active. */
18753
+ var NcScheduleSchema = z.object({
18754
+ windows: z.array(NcScheduleWindowSchema).min(1),
18755
+ /** IANA timezone; default = hub host timezone. */
18756
+ timezone: z.string().optional(),
18757
+ /** Active OUTSIDE the windows (e.g. "only outside business hours"). */
18758
+ invert: z.boolean().optional()
18759
+ });
18760
+ /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
18761
+ var NcPlateMatcherSchema = z.object({
18762
+ values: z.array(z.string().min(1)).min(1),
18763
+ /** Max Levenshtein distance after normalization (uppercase alphanumeric). */
18764
+ maxDistance: z.number().int().min(0).max(3).default(1)
18765
+ });
18766
+ /**
18767
+ * Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
18768
+ * occupancy edge for a device — optionally narrowed to a single admin
18769
+ * `zoneId` and/or object `className`. `op` selects the edge/threshold:
18770
+ * - `became-occupied` (default) — count crossed 0 → ≥ `count`
18771
+ * - `became-free` — count crossed ≥ `count` → below it
18772
+ * - `>=` / `<=` — count is at/over or at/under `count`
18773
+ * `sustainSeconds` requires the condition hold continuously that long
18774
+ * before firing (debounces flicker; 0 = fire on the first matching edge).
18775
+ * Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
18776
+ * the condition never matches. Confirmed edge-state survives addon restarts
18777
+ * (declared SQLite collection, reseeded on boot).
18778
+ */
18779
+ var NcOccupancyConditionSchema = z.object({
18780
+ /** Admin zone id to scope the count to; absent = whole-frame occupancy. */
18781
+ zoneId: z.string().optional(),
18782
+ /** Object class to count; absent = any class. */
18783
+ className: z.string().optional(),
18784
+ op: z.enum([
18785
+ "became-occupied",
18786
+ "became-free",
18787
+ ">=",
18788
+ "<="
18789
+ ]).default("became-occupied"),
18790
+ count: z.number().int().min(0).default(1),
18791
+ sustainSeconds: z.number().int().min(0).max(3600).default(15)
18792
+ });
18793
+ /** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
18794
+ var NcZoneConditionSchema = z.object({
18795
+ ids: z.array(z.string().min(1)).min(1),
18796
+ /** Quantifier over `ids` — at least one / every one visited. */
18797
+ match: z.enum(["any", "all"]).default("any")
18798
+ });
18799
+ /**
18800
+ * The P1 condition set — a flat AND of groups; absent group = pass;
18801
+ * membership lists are OR within the list (spec §2.3).
18802
+ */
18803
+ var NcConditionsSchema = z.object({
18804
+ /** Device scope — absent = all devices. */
18805
+ devices: z.array(z.number()).optional(),
18806
+ /** Detector class names (any overlap with the record's class set). */
18807
+ classes: z.array(z.string().min(1)).optional(),
18808
+ /** Veto classes — any overlap fails the rule. */
18809
+ classesExclude: z.array(z.string().min(1)).optional(),
18810
+ /** Minimum detection confidence 0–1 (fails when the record has none). */
18811
+ minConfidence: z.number().min(0).max(1).optional(),
18812
+ /** Admin zone membership over event `zones` / track `zonesVisited`. */
18813
+ zones: NcZoneConditionSchema.optional(),
18814
+ /** Veto zones — any hit fails the rule. */
18815
+ zonesExclude: z.array(z.string().min(1)).optional(),
18816
+ /**
18817
+ * Exact (case-insensitive) match on the record's collapsed `label`
18818
+ * (identity name / plate text / subclass).
18819
+ */
18820
+ labelEquals: z.array(z.string().min(1)).optional(),
18821
+ /**
18822
+ * Identity matcher. P1 boundary: matched against the record's collapsed
18823
+ * `label` (the identity display name propagated by the face pipeline) —
18824
+ * identity-ID matching rides in P2 when identity ids reach the record.
18825
+ */
18826
+ identities: z.array(z.string().min(1)).optional(),
18827
+ /** Fuzzy plate matcher against the record's `label` (plate text). */
18828
+ plates: NcPlateMatcherSchema.optional(),
18829
+ /**
18830
+ * Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
18831
+ * Same P1 boundary: matched against the record's collapsed `label` (the
18832
+ * identity display name). A record with NO label passes (nothing to
18833
+ * exclude), unlike the include variant which fails on an absent label.
18834
+ */
18835
+ identitiesExclude: z.array(z.string().min(1)).optional(),
18836
+ /**
18837
+ * Minimum server-computed key-event importance in [0,1] (`Track.importance`).
18838
+ * TRACK-END only: importance is scored at track close, so it does not exist
18839
+ * at immediate / object-event evaluation time (see catalog `appliesTo`). At
18840
+ * close the value is threaded via the close-time info (the `Track` clone is
18841
+ * captured before the DB row is updated, so it would otherwise read stale).
18842
+ * Fails when the record carries no importance (never guess quality — the
18843
+ * `minConfidence` precedent). MVP cut: a single scalar threshold.
18844
+ */
18845
+ minImportance: z.number().min(0).max(1).optional(),
18846
+ /**
18847
+ * Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
18848
+ * TRACK-END only: an `immediate` / object-event subject has no closed
18849
+ * lifespan, so a dwell condition never matches immediate delivery
18850
+ * (documented choice — the object-event record carries no `firstSeen`,
18851
+ * so dwell cannot be computed from what the subject actually carries).
18852
+ */
18853
+ minDwellSeconds: z.number().min(0).optional(),
18854
+ /**
18855
+ * Detection provenance filter. `any` (default / absent) matches every
18856
+ * source; otherwise the subject's source must equal it. Legacy records
18857
+ * with no stamped source are treated as `pipeline`. The union spans both
18858
+ * record kinds — object events carry `pipeline` | `onboard`, synthetic
18859
+ * tracks carry `sensor`.
18860
+ */
18861
+ source: z.enum([
18862
+ "pipeline",
18863
+ "onboard",
18864
+ "sensor",
18865
+ "any"
18866
+ ]).optional(),
18867
+ /**
18868
+ * Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
18869
+ * detector `minConfidence` (that gates the object-detection score; this
18870
+ * gates the recognition/OCR match score). Fails when the subject carries
18871
+ * no label-match confidence (never guess). TRACK-END only: the confidence
18872
+ * lives on the recognition result and reaches the subject at track close.
18873
+ *
18874
+ * What it measures precisely (plumbed at track close — the closer threads
18875
+ * the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
18876
+ * `importance`): the BEST recognition match confidence observed for the
18877
+ * label the track carries at close — for a face, the peak cosine similarity
18878
+ * of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
18879
+ * for a plate, the peak OCR read score of the best-held plate
18880
+ * (`plateText.confidence`). When BOTH a face and a plate were recognized on
18881
+ * one track the higher of the two is used. A track that ended with no
18882
+ * confident identity/plate match carries no value, so the condition fails
18883
+ * closed for it (an un-recognized subject).
18884
+ */
18885
+ minLabelConfidence: z.number().min(0).max(1).optional(),
18886
+ /**
18887
+ * DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
18888
+ * e.g. a doorbell `press` / `press_long`) — matched case-insensitively
18889
+ * against the token carried on the device-event subject (extracted from the
18890
+ * event-emitter runtime slice's `lastEvent.eventType`). Fails when the
18891
+ * subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
18892
+ * eventType, so gate those with {@link sensorKinds} instead.
18893
+ */
18894
+ eventTypeTokens: z.array(z.string().min(1)).optional(),
18895
+ /**
18896
+ * DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
18897
+ * `contact`, `button`, `device-event`) — matched against the persisted
18898
+ * `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
18899
+ */
18900
+ sensorKinds: z.array(z.string().min(1)).optional(),
18901
+ /**
18902
+ * PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
18903
+ * (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
18904
+ * when the subject's phase does not match (a subject always carries a phase
18905
+ * on the package-event trigger).
18906
+ */
18907
+ packagePhase: z.enum([
18908
+ "delivered",
18909
+ "picked-up",
18910
+ "both"
18911
+ ]).optional(),
18912
+ /**
18913
+ * PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
18914
+ * (MaskShape vocabulary). A record passes when its bbox overlaps ANY
18915
+ * listed polygon (ZoneEngine membership semantics). Evaluated only when
18916
+ * the subject carries a bbox; absent bbox ⇒ the condition FAILS.
18917
+ */
18918
+ customZones: z.array(MaskPolygonShapeSchema).optional(),
18919
+ /**
18920
+ * DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
18921
+ * (optionally zone/class-scoped) occupancy count crosses the configured
18922
+ * threshold and holds for `sustainSeconds`. Fail-closed on missing
18923
+ * substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
18924
+ */
18925
+ occupancy: NcOccupancyConditionSchema.optional()
18926
+ });
18927
+ /** One delivery target: a `notification-output` Target ref + passthrough params. */
18928
+ var NcRuleTargetSchema = z.object({
18929
+ /** `notification-output` Target id. */
18930
+ targetId: z.string().min(1),
18931
+ /**
18932
+ * Per-backend passthrough. Recognized keys are mapped onto the canonical
18933
+ * Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
18934
+ * degrade engine drops what the backend can't render.
18935
+ */
18936
+ params: z.record(z.string(), z.unknown()).optional()
18937
+ });
18938
+ /**
18939
+ * Media attachment policy (P1 still-image subset).
18940
+ * - `best` — the best AVAILABLE subject image at dispatch time (D-3).
18941
+ * - `best-matching` — the media that explains WHY the rule fired: a rule
18942
+ * matched on identities attaches the subject's `faceCrop`, one matched on
18943
+ * plates attaches the `plateCrop`; a rule with no identity/plate condition
18944
+ * (or when the specific crop is missing) degrades to `best`, then
18945
+ * `keyFrame`, then no attachment — never delaying the send. The matched
18946
+ * condition summary is frozen on the outbox row at enqueue (like the rule
18947
+ * name), so the choice never drifts from the record that fired it.
18948
+ * - `keyFrame` — the clean scene frame (no subject box).
18949
+ * - `none` — no attachment.
18950
+ */
18951
+ var NcMediaPolicySchema = z.object({ attach: z.enum([
18952
+ "best",
18953
+ "best-matching",
18954
+ "keyFrame",
18955
+ "none"
18956
+ ]).default("best") });
18957
+ /** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
18958
+ var NcThrottleSchema = z.object({
18959
+ cooldownSec: z.number().int().min(0).max(86400).default(60),
18960
+ /** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
18961
+ scope: z.enum(["rule", "rule-device"]).default("rule-device")
18962
+ });
18963
+ /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
18964
+ var NcRuleInputSchema = z.object({
18965
+ name: z.string().min(1).max(200),
18966
+ enabled: z.boolean().default(true),
18967
+ delivery: NcDeliverySchema,
18968
+ conditions: NcConditionsSchema.default({}),
18969
+ schedule: NcScheduleSchema.optional(),
18970
+ targets: z.array(NcRuleTargetSchema).min(1),
18971
+ media: NcMediaPolicySchema.default({ attach: "best" }),
18972
+ throttle: NcThrottleSchema.default({
18973
+ cooldownSec: 60,
18974
+ scope: "rule-device"
18975
+ }),
18976
+ /** `{{var}}` templating over camera/class/label/zones/confidence/time. */
18977
+ template: z.object({
18978
+ title: z.string().max(500).optional(),
18979
+ body: z.string().max(2e3).optional()
18980
+ }).optional(),
18981
+ /** Canonical notification priority ordinal (1..5); per-target overridable. */
18982
+ priority: z.number().int().min(1).max(5).default(3),
18983
+ /**
18984
+ * Ownership/visibility key. Absent = admin/global rule (unchanged legacy
18985
+ * behaviour, visible to all, read-only in the viewer). Present = personal
18986
+ * rule owned by this userId. Server-stamped; never trusted from a client.
18987
+ */
18988
+ ownerUserId: z.string().optional()
18989
+ });
18990
+ /**
18991
+ * Partial patch for `updateRule` — any subset of the input fields, plus the
18992
+ * persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
18993
+ * NOT a client-authored input field (it lives on the persisted rule, not the
18994
+ * input), so it is added here explicitly to let the store's per-target opt-out
18995
+ * toggle round-trip through the shared `update` path. Viewer opt-out mutations
18996
+ * still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
18997
+ * `updateRule` patch.
18998
+ */
18999
+ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: z.array(z.string()).optional() });
19000
+ /** A persisted rule. */
19001
+ var NcRuleSchema = NcRuleInputSchema.extend({
19002
+ id: z.string(),
19003
+ /** userId of the admin who created the rule (server-stamped caller). */
19004
+ createdBy: z.string(),
19005
+ createdAt: z.number(),
19006
+ updatedAt: z.number(),
19007
+ /**
19008
+ * Per-target opt-out set. A targetId here is suppressed for THIS rule at
19009
+ * send time. Only a target's OWNER may add/remove its id (server-checked
19010
+ * in `nc.setRuleTargetEnabled`). Defaults to empty.
19011
+ */
19012
+ disabledTargetIds: z.array(z.string()).default([])
19013
+ });
19014
+ var NcTestResultSchema = z.object({
19015
+ recordId: z.string(),
19016
+ recordKind: z.enum([
19017
+ "object-event",
19018
+ "track",
19019
+ "device-event",
19020
+ "package-event"
19021
+ ]),
19022
+ deviceId: z.number(),
19023
+ timestamp: z.number(),
19024
+ wouldFire: z.boolean(),
19025
+ /** Condition id that failed (first failing group), when `wouldFire` is false. */
19026
+ failedCondition: z.string().optional(),
19027
+ className: z.string().optional(),
19028
+ label: z.string().optional()
18621
19029
  });
18622
- /** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
18623
- var ManagedModelCatalogEntrySchema = z.object({
19030
+ var NcConditionDescriptorSchema = z.object({
19031
+ /** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
18624
19032
  id: z.string(),
19033
+ group: z.enum([
19034
+ "scope",
19035
+ "class",
19036
+ "zones",
19037
+ "quality",
19038
+ "label",
19039
+ "schedule",
19040
+ "device",
19041
+ "package",
19042
+ "occupancy"
19043
+ ]),
18625
19044
  label: z.string(),
18626
- family: z.string(),
18627
- purpose: z.enum(["text", "vision"]),
18628
- url: z.string(),
18629
- sha256: z.string(),
18630
- sizeBytes: z.number(),
18631
- quantization: z.string(),
18632
- /** Load-time guidance shown in the picker. */
18633
- minRamBytes: z.number(),
18634
- contextSizeDefault: z.number().int(),
18635
- /** Vision models: companion projector file. */
18636
- mmprojUrl: z.string().optional()
19045
+ /** Editor widget the UI renders — never hardcode per-condition forms. */
19046
+ valueType: z.enum([
19047
+ "deviceIdList",
19048
+ "stringList",
19049
+ "number01",
19050
+ "number",
19051
+ "sourceSelect",
19052
+ "zoneSelection",
19053
+ "zoneIdList",
19054
+ "schedule",
19055
+ "plateMatcher",
19056
+ "packagePhase",
19057
+ "polygonDraw",
19058
+ "occupancy"
19059
+ ]),
19060
+ operator: z.enum([
19061
+ "in",
19062
+ "notIn",
19063
+ "anyOf",
19064
+ "allOf",
19065
+ "gte",
19066
+ "fuzzyIn",
19067
+ "withinSchedule"
19068
+ ]),
19069
+ /** Which delivery kinds the condition applies to. */
19070
+ appliesTo: z.array(NcDeliverySchema),
19071
+ phase: z.string(),
19072
+ description: z.string().optional()
18637
19073
  });
18638
- var LlmRuntimeNodeSchema = z.object({
18639
- nodeId: z.string(),
18640
- reachable: z.boolean(),
18641
- status: LlmRuntimeStatusSchema.optional(),
18642
- disk: LlmRuntimeDiskUsageSchema.optional(),
18643
- error: z.string().optional()
19074
+ /**
19075
+ * The P1 condition surface as data — served by `getConditionCatalog` so
19076
+ * rule editors render from the catalog, not hardcoded forms (spec §4.2).
19077
+ */
19078
+ var NC_CONDITION_CATALOG = [
19079
+ {
19080
+ id: "devices",
19081
+ group: "scope",
19082
+ label: "Cameras",
19083
+ valueType: "deviceIdList",
19084
+ operator: "in",
19085
+ appliesTo: [
19086
+ "immediate",
19087
+ "track-end",
19088
+ "device-event",
19089
+ "package-event"
19090
+ ],
19091
+ phase: "P1",
19092
+ description: "Restrict the rule to these devices; absent = all devices."
19093
+ },
19094
+ {
19095
+ id: "classes",
19096
+ group: "class",
19097
+ label: "Object classes",
19098
+ valueType: "stringList",
19099
+ operator: "in",
19100
+ appliesTo: [
19101
+ "immediate",
19102
+ "track-end",
19103
+ "package-event"
19104
+ ],
19105
+ phase: "P1",
19106
+ description: "Any overlap with the detection class set passes."
19107
+ },
19108
+ {
19109
+ id: "classesExclude",
19110
+ group: "class",
19111
+ label: "Excluded classes",
19112
+ valueType: "stringList",
19113
+ operator: "notIn",
19114
+ appliesTo: [
19115
+ "immediate",
19116
+ "track-end",
19117
+ "package-event"
19118
+ ],
19119
+ phase: "P1"
19120
+ },
19121
+ {
19122
+ id: "minConfidence",
19123
+ group: "quality",
19124
+ label: "Minimum confidence",
19125
+ valueType: "number01",
19126
+ operator: "gte",
19127
+ appliesTo: [
19128
+ "immediate",
19129
+ "track-end",
19130
+ "package-event"
19131
+ ],
19132
+ phase: "P1"
19133
+ },
19134
+ {
19135
+ id: "zones",
19136
+ group: "zones",
19137
+ label: "Zones",
19138
+ valueType: "zoneSelection",
19139
+ operator: "anyOf",
19140
+ appliesTo: [
19141
+ "immediate",
19142
+ "track-end",
19143
+ "package-event"
19144
+ ],
19145
+ phase: "P1",
19146
+ description: "Admin zone ids; quantifier any/all over the visited set."
19147
+ },
19148
+ {
19149
+ id: "zonesExclude",
19150
+ group: "zones",
19151
+ label: "Excluded zones",
19152
+ valueType: "zoneIdList",
19153
+ operator: "notIn",
19154
+ appliesTo: [
19155
+ "immediate",
19156
+ "track-end",
19157
+ "package-event"
19158
+ ],
19159
+ phase: "P1"
19160
+ },
19161
+ {
19162
+ id: "labelEquals",
19163
+ group: "label",
19164
+ label: "Label equals",
19165
+ valueType: "stringList",
19166
+ operator: "in",
19167
+ appliesTo: ["immediate", "track-end"],
19168
+ phase: "P1",
19169
+ description: "Exact match on the collapsed label (identity / plate / subclass)."
19170
+ },
19171
+ {
19172
+ id: "identities",
19173
+ group: "label",
19174
+ label: "Identities",
19175
+ valueType: "stringList",
19176
+ operator: "in",
19177
+ appliesTo: ["immediate", "track-end"],
19178
+ phase: "P1",
19179
+ description: "P1: matched against the identity display name on the record label."
19180
+ },
19181
+ {
19182
+ id: "plates",
19183
+ group: "label",
19184
+ label: "License plates",
19185
+ valueType: "plateMatcher",
19186
+ operator: "fuzzyIn",
19187
+ appliesTo: ["immediate", "track-end"],
19188
+ phase: "P1",
19189
+ description: "Levenshtein-tolerant match against the plate text."
19190
+ },
19191
+ {
19192
+ id: "identitiesExclude",
19193
+ group: "label",
19194
+ label: "Excluded identities",
19195
+ valueType: "stringList",
19196
+ operator: "notIn",
19197
+ appliesTo: ["immediate", "track-end"],
19198
+ phase: "P1",
19199
+ description: "Veto by identity display name (mirror of Identities; absent label passes)."
19200
+ },
19201
+ {
19202
+ id: "minLabelConfidence",
19203
+ group: "label",
19204
+ label: "Minimum label confidence",
19205
+ valueType: "number01",
19206
+ operator: "gte",
19207
+ appliesTo: ["track-end"],
19208
+ phase: "P1",
19209
+ 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."
19210
+ },
19211
+ {
19212
+ id: "minImportance",
19213
+ group: "quality",
19214
+ label: "Minimum importance",
19215
+ valueType: "number01",
19216
+ operator: "gte",
19217
+ appliesTo: ["track-end"],
19218
+ phase: "P1",
19219
+ description: "Server-computed key-event importance [0,1]; track-end rules only (importance is scored at close). Fails when the record has none."
19220
+ },
19221
+ {
19222
+ id: "minDwellSeconds",
19223
+ group: "quality",
19224
+ label: "Minimum dwell (seconds)",
19225
+ valueType: "number",
19226
+ operator: "gte",
19227
+ appliesTo: ["track-end"],
19228
+ phase: "P1",
19229
+ description: "Track lifespan in seconds (lastSeen − firstSeen); track-end rules only."
19230
+ },
19231
+ {
19232
+ id: "source",
19233
+ group: "scope",
19234
+ label: "Detection source",
19235
+ valueType: "sourceSelect",
19236
+ operator: "in",
19237
+ appliesTo: [
19238
+ "immediate",
19239
+ "track-end",
19240
+ "device-event",
19241
+ "package-event"
19242
+ ],
19243
+ phase: "P1",
19244
+ description: "pipeline / onboard / sensor; a record with no stamped source counts as pipeline."
19245
+ },
19246
+ {
19247
+ id: "sensorKinds",
19248
+ group: "device",
19249
+ label: "Sensor kinds",
19250
+ valueType: "stringList",
19251
+ operator: "in",
19252
+ appliesTo: ["device-event"],
19253
+ phase: "P1",
19254
+ description: "Sensor/control taxonomy kinds (doorbell / contact / button / …) matched against the persisted device event."
19255
+ },
19256
+ {
19257
+ id: "eventTypeTokens",
19258
+ group: "device",
19259
+ label: "Event-type tokens",
19260
+ valueType: "stringList",
19261
+ operator: "in",
19262
+ appliesTo: ["device-event"],
19263
+ phase: "P1",
19264
+ description: "Raw device event-type tokens (e.g. doorbell press / press_long) from the event-emitter slice; absent on doorbell-pulse / passive sensors."
19265
+ },
19266
+ {
19267
+ id: "packagePhase",
19268
+ group: "package",
19269
+ label: "Package phase",
19270
+ valueType: "packagePhase",
19271
+ operator: "in",
19272
+ appliesTo: ["package-event"],
19273
+ phase: "P1",
19274
+ description: "Delivered / picked-up / both."
19275
+ },
19276
+ {
19277
+ id: "occupancy",
19278
+ group: "occupancy",
19279
+ label: "Occupancy",
19280
+ valueType: "occupancy",
19281
+ operator: "anyOf",
19282
+ appliesTo: ["device-event"],
19283
+ phase: "P1",
19284
+ description: "ZoneAnalytics occupancy edge (optionally zone/class-scoped): count crosses the threshold and holds for sustainSeconds. Fail-closed on a missing snapshot."
19285
+ },
19286
+ {
19287
+ id: "customZones",
19288
+ group: "zones",
19289
+ label: "Custom zones",
19290
+ valueType: "polygonDraw",
19291
+ operator: "anyOf",
19292
+ appliesTo: [
19293
+ "immediate",
19294
+ "track-end",
19295
+ "package-event"
19296
+ ],
19297
+ phase: "P1",
19298
+ description: "User-drawn polygons; a detection whose bbox overlaps any polygon matches."
19299
+ },
19300
+ {
19301
+ id: "schedule",
19302
+ group: "schedule",
19303
+ label: "Schedule",
19304
+ valueType: "schedule",
19305
+ operator: "withinSchedule",
19306
+ appliesTo: [
19307
+ "immediate",
19308
+ "track-end",
19309
+ "device-event",
19310
+ "package-event"
19311
+ ],
19312
+ phase: "P1",
19313
+ description: "Weekly activation windows (invertible); absent = always active."
19314
+ }
19315
+ ];
19316
+ /**
19317
+ * The delivery lifecycle status of a history row — a straight read of the
19318
+ * durable outbox row's own status (single source of truth):
19319
+ * - `pending` — enqueued, in-flight or retrying with backoff
19320
+ * - `sent` — delivered (terminal)
19321
+ * - `dead` — dead-lettered after exhausting retries / a permanent
19322
+ * backend rejection / a deleted target (terminal; carries
19323
+ * the failure `error`)
19324
+ *
19325
+ * P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
19326
+ * user dimension (quiet hours / snooze) and are additive when they land.
19327
+ */
19328
+ var NcHistoryStatusSchema = z.enum([
19329
+ "pending",
19330
+ "sent",
19331
+ "dead"
19332
+ ]);
19333
+ /** The evaluated record kind a history row descends from (one per trigger). */
19334
+ var NcHistoryRecordKindSchema = z.enum([
19335
+ "object-event",
19336
+ "track-end",
19337
+ "device-event",
19338
+ "package-event"
19339
+ ]);
19340
+ /** Subject summary frozen on the row at fire time (survives rule/record edits). */
19341
+ var NcHistorySubjectSchema = z.object({
19342
+ className: z.string(),
19343
+ label: z.string().optional(),
19344
+ confidence: z.number().optional(),
19345
+ zones: z.array(z.string()),
19346
+ timestamp: z.number()
18644
19347
  });
18645
- var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: z.array(LlmImageSchema).min(1) });
18646
- var ProfileRefInputSchema = z.object({
18647
- addonId: z.string(),
18648
- profileId: z.string()
19348
+ /**
19349
+ * One delivery-history row. This is a read-only VIEW over the durable
19350
+ * outbox row (single source of truth — the same row the drain loop drives;
19351
+ * NO second write path, so history can never drift from delivery state).
19352
+ * The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
19353
+ * `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
19354
+ * (fire) / `updatedAt` (last transition), `status` + `error` are the
19355
+ * lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
19356
+ * enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
19357
+ * P1 (admin scope only).
19358
+ */
19359
+ var NcHistoryEntrySchema = z.object({
19360
+ /** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
19361
+ id: z.string(),
19362
+ ruleId: z.string(),
19363
+ /** Rule name frozen at fire time (outlives a later rename / delete). */
19364
+ ruleName: z.string(),
19365
+ /** The rule urgency/trigger that produced this delivery. */
19366
+ delivery: NcDeliverySchema,
19367
+ targetId: z.string(),
19368
+ deviceId: z.number(),
19369
+ recordKind: NcHistoryRecordKindSchema,
19370
+ /** Event / track ref of the evaluated record (§3.2 `eventRef`). */
19371
+ recordId: z.string(),
19372
+ /** Present for track-scoped deliveries (object-event / track-end). */
19373
+ trackId: z.string().optional(),
19374
+ status: NcHistoryStatusSchema,
19375
+ /** Delivery attempts made so far. */
19376
+ attempts: z.number().int(),
19377
+ /** Fire time (outbox enqueue). */
19378
+ createdAt: z.number(),
19379
+ /** Last transition time (terminal for sent / dead). */
19380
+ updatedAt: z.number(),
19381
+ /** Failure detail — present on a `dead` row. */
19382
+ error: z.string().optional(),
19383
+ subject: NcHistorySubjectSchema
18649
19384
  });
18650
- var llmCapability = {
18651
- name: "llm",
19385
+ /** `getHistory` default page size + hard ceiling (bounded output). */
19386
+ var NC_HISTORY_LIMIT_DEFAULT = 100;
19387
+ var NC_HISTORY_LIMIT_MAX = 500;
19388
+ /**
19389
+ * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
19390
+ * AND; absent = unbounded on that axis. `since`/`until` bound the fire time
19391
+ * (`createdAt`, epoch ms, inclusive). `limit` is clamped to
19392
+ * {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
19393
+ */
19394
+ var NcHistoryFilterSchema = z.object({
19395
+ ruleId: z.string().optional(),
19396
+ deviceId: z.number().optional(),
19397
+ status: NcHistoryStatusSchema.optional(),
19398
+ since: z.number().optional(),
19399
+ until: z.number().optional(),
19400
+ limit: z.number().int().min(1).max(500).default(100)
19401
+ });
19402
+ var notificationRulesCapability = {
19403
+ name: "notification-rules",
18652
19404
  scope: "system",
18653
- mode: "collection",
18654
- internal: false,
18655
- providerKind: "ai",
18656
- /** `nodeId` inputs below are DATA (the hub provider pins itself), never routing. */
18657
- nodeIdMode: "data",
19405
+ mode: "singleton",
18658
19406
  methods: {
18659
- generate: method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
18660
- generateVision: method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
18661
- listProfileKinds: method(z.object({}), z.array(LlmProfileKindDescriptorSchema)),
18662
- listProfiles: method(z.object({}), z.array(LlmProfileSchema)),
18663
- upsertProfile: method(z.object({ profile: LlmProfileSchema }), LlmProfileSchema, {
18664
- kind: "mutation",
18665
- auth: "admin"
18666
- }),
18667
- deleteProfile: method(ProfileRefInputSchema, z.void(), {
18668
- kind: "mutation",
18669
- auth: "admin"
18670
- }),
18671
- testProfile: method(ProfileRefInputSchema, LlmGenerateResultSchema, {
19407
+ listRules: method(z.object({}), z.object({ rules: z.array(NcRuleSchema) }), { auth: "admin" }),
19408
+ getRule: method(z.object({ ruleId: z.string() }), z.object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }),
19409
+ createRule: method(z.object({ rule: NcRuleInputSchema }), z.object({ rule: NcRuleSchema }), {
18672
19410
  kind: "mutation",
18673
- auth: "admin"
19411
+ auth: "admin",
19412
+ caller: "required"
18674
19413
  }),
18675
- /** Live vendor enumeration (GET /models etc.). */
18676
- listModels: method(ProfileRefInputSchema, z.array(z.string())),
18677
- getDefaults: method(z.object({}), z.array(LlmDefaultSchema)),
18678
- setDefault: method(z.object({
18679
- selector: LlmDefaultSelectorSchema,
18680
- profileId: z.string().nullable()
18681
- }), z.void(), {
19414
+ updateRule: method(z.object({
19415
+ ruleId: z.string(),
19416
+ patch: NcRulePatchSchema
19417
+ }), z.object({ rule: NcRuleSchema }), {
18682
19418
  kind: "mutation",
18683
- auth: "admin"
19419
+ auth: "admin",
19420
+ caller: "required"
18684
19421
  }),
18685
- getUsage: method(z.object({
18686
- since: z.number().optional(),
18687
- until: z.number().optional(),
18688
- consumer: z.string().optional(),
18689
- profileId: z.string().optional()
18690
- }), z.array(LlmUsageRollupSchema)),
18691
- listModelCatalog: method(z.object({}), z.array(ManagedModelCatalogEntrySchema)),
18692
- listRuntimeNodes: method(z.object({}), z.array(LlmRuntimeNodeSchema)),
18693
- listNodeModels: method(z.object({ nodeId: z.string() }), z.array(LlmNodeModelSchema)),
18694
- installModel: method(z.object({
18695
- nodeId: z.string(),
18696
- model: ManagedModelRefSchema
18697
- }), z.void(), {
19422
+ deleteRule: method(z.object({ ruleId: z.string() }), z.object({ success: z.literal(true) }), {
18698
19423
  kind: "mutation",
18699
19424
  auth: "admin"
18700
19425
  }),
18701
- deleteModel: method(z.object({
18702
- nodeId: z.string(),
18703
- file: z.string()
18704
- }), z.void(), {
19426
+ setRuleEnabled: method(z.object({
19427
+ ruleId: z.string(),
19428
+ enabled: z.boolean()
19429
+ }), z.object({ success: z.literal(true) }), {
18705
19430
  kind: "mutation",
18706
19431
  auth: "admin"
18707
19432
  }),
18708
- getRuntimeStatus: method(ProfileRefInputSchema, LlmRuntimeStatusSchema),
18709
- startRuntime: method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
19433
+ /**
19434
+ * Dry-run a rule against recently persisted records (object events for
19435
+ * `immediate`, closed tracks for `track-end`). Mutation kind only to
19436
+ * carry the full rule object safely; no side effects.
19437
+ */
19438
+ testRule: method(z.object({
19439
+ rule: NcRuleInputSchema,
19440
+ lookbackMinutes: z.number().int().min(1).max(1440).default(60)
19441
+ }), z.object({ results: z.array(NcTestResultSchema) }), {
18710
19442
  kind: "mutation",
18711
19443
  auth: "admin"
18712
19444
  }),
18713
- stopRuntime: method(ProfileRefInputSchema, z.void(), {
18714
- kind: "mutation",
18715
- auth: "admin"
18716
- })
19445
+ getConditionCatalog: method(z.object({}), z.object({ catalog: z.array(NcConditionDescriptorSchema) })),
19446
+ /**
19447
+ * Queryable delivery history — a read-only view over the durable outbox
19448
+ * (fired rule, subject summary, target, status, timestamps, error on a
19449
+ * dead row). Newest-first, bounded by `filter.limit`. Retention follows
19450
+ * the outbox's own terminal-row prune horizon (no separate history
19451
+ * horizon — single collection, single source of truth). Admin-only in
19452
+ * P1 (no user dimension); the P2 viewer History screen adds per-caller
19453
+ * scoping on the same method.
19454
+ */
19455
+ getHistory: method(z.object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), z.object({ entries: z.array(NcHistoryEntrySchema) }), { auth: "admin" })
18717
19456
  }
18718
19457
  };
18719
19458
  //#endregion
@@ -19542,160 +20281,56 @@ var pipelineAnalyticsCapability = {
19542
20281
  * Absent ⇒ every kind (back-compat). */
19543
20282
  getTrackMedia: method(z.object({
19544
20283
  trackId: z.string(),
19545
- kinds: z.array(MediaFileKindEnum).optional()
19546
- }), z.array(MediaFileSchema).readonly()),
19547
- /**
19548
- * Search object events by text query using CLIP cosine similarity.
19549
- * Encodes `text` via the `embedding-encoder` cap, queries the
19550
- * `ObjectEmbeddingStore` with optional prefilters, ranks all matching
19551
- * embeddings by cosine similarity, and joins winners to their
19552
- * ObjectEvents by trackId. Returns up to `limit` events scored ≥
19553
- * `minScore`, sorted descending by score.
19554
- */
19555
- searchObjectEvents: method(SearchObjectEventsInput, z.array(ScoredObjectEventSchema).readonly())
19556
- },
19557
- events: {
19558
- /**
19559
- * Enriched frame emitted after refinement — the live-overlay source of
19560
- * truth (two-plane re-injection). Carries the frame's detections in the
19561
- * `ObjectDetection` wire shape: first-level roots (with track info +
19562
- * enrichment labels) plus synthesized `kind:'detail'` face/plate entries
19563
- * re-projected from per-track detail state, so stream overlays render
19564
- * boxes + recognized names without querying full Track state.
19565
- */
19566
- onFrameTracked: { data: z.object({
19567
- deviceId: z.number(),
19568
- timestamp: z.number(),
19569
- frameWidth: z.number(),
19570
- frameHeight: z.number(),
19571
- detections: z.array(OverlayDetectionSchema).readonly()
19572
- }) },
19573
- /** Track entered active state (first-seen). */
19574
- onTrackStarted: { data: z.object({
19575
- deviceId: z.number(),
19576
- trackId: z.string(),
19577
- className: z.string()
19578
- }) },
19579
- /** Track expired (TTL reached after last detection). */
19580
- onTrackEnded: { data: z.object({
19581
- deviceId: z.number(),
19582
- trackId: z.string(),
19583
- className: z.string(),
19584
- durationMs: z.number()
19585
- }) },
19586
- /** Canonical "something happened at device X" event, per-kind. */
19587
- onDetectionEvent: { data: z.object({
19588
- deviceId: z.number(),
19589
- kind: EventKindSchema,
19590
- eventId: z.string(),
19591
- timestamp: z.number()
19592
- }) }
19593
- }
19594
- };
19595
- //#endregion
19596
- //#region src/capabilities/sensor-event-kinds.ts
19597
- /**
19598
- * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19599
- * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19600
- * caps into per-camera event-kind descriptors.
19601
- *
19602
- * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19603
- * is NOT duplicated here — every entry is derived from the single
19604
- * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19605
- * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19606
- * control cap means adding one line here (and a taxonomy entry); the anti-
19607
- * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19608
- * eventful cap is missing.
19609
- */
19610
- /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19611
- var LEGACY_ICON = {
19612
- motion: "motion",
19613
- audio: "audio",
19614
- person: "person",
19615
- vehicle: "vehicle",
19616
- animal: "animal",
19617
- package: "package",
19618
- door: "door",
19619
- pir: "pir",
19620
- smoke: "smoke",
19621
- water: "water",
19622
- button: "button",
19623
- generic: "generic",
19624
- gas: "smoke",
19625
- vibration: "generic",
19626
- tamper: "generic",
19627
- presence: "person",
19628
- lock: "generic",
19629
- siren: "generic",
19630
- switch: "generic",
19631
- doorbell: "button"
19632
- };
19633
- function legacyIcon(iconId) {
19634
- return LEGACY_ICON[iconId] ?? "generic";
19635
- }
19636
- /**
19637
- * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19638
- * The anti-drift guard cross-checks this against the eventful caps declared
19639
- * in `packages/types/src/capabilities/*.cap.ts`.
19640
- */
19641
- var CAP_TO_KIND = {
19642
- contact: "contact",
19643
- motion: "motion-sensor",
19644
- smoke: "smoke",
19645
- flood: "flood",
19646
- gas: "gas",
19647
- "carbon-monoxide": "carbon-monoxide",
19648
- vibration: "vibration",
19649
- tamper: "tamper",
19650
- presence: "presence",
19651
- "enum-sensor": "enum-sensor",
19652
- "event-emitter": "device-event",
19653
- "lock-control": "lock",
19654
- switch: "switch",
19655
- button: "button",
19656
- doorbell: "doorbell"
20284
+ kinds: z.array(MediaFileKindEnum).optional()
20285
+ }), z.array(MediaFileSchema).readonly()),
20286
+ /**
20287
+ * Search object events by text query using CLIP cosine similarity.
20288
+ * Encodes `text` via the `embedding-encoder` cap, queries the
20289
+ * `ObjectEmbeddingStore` with optional prefilters, ranks all matching
20290
+ * embeddings by cosine similarity, and joins winners to their
20291
+ * ObjectEvents by trackId. Returns up to `limit` events scored ≥
20292
+ * `minScore`, sorted descending by score.
20293
+ */
20294
+ searchObjectEvents: method(SearchObjectEventsInput, z.array(ScoredObjectEventSchema).readonly())
20295
+ },
20296
+ events: {
20297
+ /**
20298
+ * Enriched frame emitted after refinement — the live-overlay source of
20299
+ * truth (two-plane re-injection). Carries the frame's detections in the
20300
+ * `ObjectDetection` wire shape: first-level roots (with track info +
20301
+ * enrichment labels) plus synthesized `kind:'detail'` face/plate entries
20302
+ * re-projected from per-track detail state, so stream overlays render
20303
+ * boxes + recognized names without querying full Track state.
20304
+ */
20305
+ onFrameTracked: { data: z.object({
20306
+ deviceId: z.number(),
20307
+ timestamp: z.number(),
20308
+ frameWidth: z.number(),
20309
+ frameHeight: z.number(),
20310
+ detections: z.array(OverlayDetectionSchema).readonly()
20311
+ }) },
20312
+ /** Track entered active state (first-seen). */
20313
+ onTrackStarted: { data: z.object({
20314
+ deviceId: z.number(),
20315
+ trackId: z.string(),
20316
+ className: z.string()
20317
+ }) },
20318
+ /** Track expired (TTL reached after last detection). */
20319
+ onTrackEnded: { data: z.object({
20320
+ deviceId: z.number(),
20321
+ trackId: z.string(),
20322
+ className: z.string(),
20323
+ durationMs: z.number()
20324
+ }) },
20325
+ /** Canonical "something happened at device X" event, per-kind. */
20326
+ onDetectionEvent: { data: z.object({
20327
+ deviceId: z.number(),
20328
+ kind: EventKindSchema,
20329
+ eventId: z.string(),
20330
+ timestamp: z.number()
20331
+ }) }
20332
+ }
19657
20333
  };
19658
- function buildDescriptor(capName, kind) {
19659
- const t = EVENT_TAXONOMY[kind];
19660
- if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19661
- return {
19662
- ...t,
19663
- icon: legacyIcon(t.iconId)
19664
- };
19665
- }
19666
- /**
19667
- * Sensor / control cap name → static event-kind descriptor. A linked device
19668
- * contributes one entry per bound cap present in this map.
19669
- */
19670
- var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19671
- /** The cap names covered by the taxonomy (for the anti-drift guard). */
19672
- var EVENTFUL_CAP_NAMES = Object.keys(CAP_TO_KIND);
19673
- /**
19674
- * Build a full `EventKindDescriptor` for a taxonomy `kind`, stamping the
19675
- * per-device `source`. Returns null when `kind` is not in the taxonomy.
19676
- * This is THE bridge from the serializable taxonomy dictionary to the cap
19677
- * wire shape — every event-kind descriptor the server emits goes through it,
19678
- * so color/iconId/labelKey are never re-declared at a call site.
19679
- */
19680
- function buildEventKindDescriptor(kind, source) {
19681
- const t = EVENT_TAXONOMY[kind];
19682
- if (t === void 0) return null;
19683
- return {
19684
- kind: t.kind,
19685
- labelKey: t.labelKey,
19686
- label: t.label,
19687
- color: t.color,
19688
- iconId: t.iconId,
19689
- icon: legacyIcon(t.iconId),
19690
- category: t.category,
19691
- parentKind: t.parentKind,
19692
- level: t.level,
19693
- source: {
19694
- capName: source.capName,
19695
- deviceId: source.deviceId
19696
- }
19697
- };
19698
- }
19699
20334
  //#endregion
19700
20335
  //#region src/capabilities/pipeline-orchestrator.cap.ts
19701
20336
  var CameraPipelineConfigSchema = z.object({
@@ -20453,6 +21088,110 @@ var pipelineOrchestratorCapability = {
20453
21088
  }
20454
21089
  };
20455
21090
  //#endregion
21091
+ //#region src/capabilities/sensor-event-kinds.ts
21092
+ /**
21093
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
21094
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
21095
+ * caps into per-camera event-kind descriptors.
21096
+ *
21097
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
21098
+ * is NOT duplicated here — every entry is derived from the single
21099
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
21100
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
21101
+ * control cap means adding one line here (and a taxonomy entry); the anti-
21102
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
21103
+ * eventful cap is missing.
21104
+ */
21105
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
21106
+ var LEGACY_ICON = {
21107
+ motion: "motion",
21108
+ audio: "audio",
21109
+ person: "person",
21110
+ vehicle: "vehicle",
21111
+ animal: "animal",
21112
+ package: "package",
21113
+ door: "door",
21114
+ pir: "pir",
21115
+ smoke: "smoke",
21116
+ water: "water",
21117
+ button: "button",
21118
+ generic: "generic",
21119
+ gas: "smoke",
21120
+ vibration: "generic",
21121
+ tamper: "generic",
21122
+ presence: "person",
21123
+ lock: "generic",
21124
+ siren: "generic",
21125
+ switch: "generic",
21126
+ doorbell: "button"
21127
+ };
21128
+ function legacyIcon(iconId) {
21129
+ return LEGACY_ICON[iconId] ?? "generic";
21130
+ }
21131
+ /**
21132
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
21133
+ * The anti-drift guard cross-checks this against the eventful caps declared
21134
+ * in `packages/types/src/capabilities/*.cap.ts`.
21135
+ */
21136
+ var CAP_TO_KIND = {
21137
+ contact: "contact",
21138
+ motion: "motion-sensor",
21139
+ smoke: "smoke",
21140
+ flood: "flood",
21141
+ gas: "gas",
21142
+ "carbon-monoxide": "carbon-monoxide",
21143
+ vibration: "vibration",
21144
+ tamper: "tamper",
21145
+ presence: "presence",
21146
+ "enum-sensor": "enum-sensor",
21147
+ "event-emitter": "device-event",
21148
+ "lock-control": "lock",
21149
+ switch: "switch",
21150
+ button: "button",
21151
+ doorbell: "doorbell"
21152
+ };
21153
+ function buildDescriptor(capName, kind) {
21154
+ const t = EVENT_TAXONOMY[kind];
21155
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
21156
+ return {
21157
+ ...t,
21158
+ icon: legacyIcon(t.iconId)
21159
+ };
21160
+ }
21161
+ /**
21162
+ * Sensor / control cap name → static event-kind descriptor. A linked device
21163
+ * contributes one entry per bound cap present in this map.
21164
+ */
21165
+ var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
21166
+ /** The cap names covered by the taxonomy (for the anti-drift guard). */
21167
+ var EVENTFUL_CAP_NAMES = Object.keys(CAP_TO_KIND);
21168
+ /**
21169
+ * Build a full `EventKindDescriptor` for a taxonomy `kind`, stamping the
21170
+ * per-device `source`. Returns null when `kind` is not in the taxonomy.
21171
+ * This is THE bridge from the serializable taxonomy dictionary to the cap
21172
+ * wire shape — every event-kind descriptor the server emits goes through it,
21173
+ * so color/iconId/labelKey are never re-declared at a call site.
21174
+ */
21175
+ function buildEventKindDescriptor(kind, source) {
21176
+ const t = EVENT_TAXONOMY[kind];
21177
+ if (t === void 0) return null;
21178
+ return {
21179
+ kind: t.kind,
21180
+ labelKey: t.labelKey,
21181
+ label: t.label,
21182
+ color: t.color,
21183
+ iconId: t.iconId,
21184
+ icon: legacyIcon(t.iconId),
21185
+ category: t.category,
21186
+ parentKind: t.parentKind,
21187
+ level: t.level,
21188
+ source: {
21189
+ capName: source.capName,
21190
+ deviceId: source.deviceId
21191
+ }
21192
+ };
21193
+ }
21194
+ //#endregion
20456
21195
  //#region src/capabilities/server-management.cap.ts
20457
21196
  /**
20458
21197
  * server-management — per-NODE singleton capability for a node's ROOT
@@ -22618,7 +23357,28 @@ var FaceInfoSchema = z.object({
22618
23357
  * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
22619
23358
  * track produced no key frame (e.g. native/onboard source) — the UI falls
22620
23359
  * back to the inline `base64` face crop. */
22621
- keyFrameMediaKey: z.string().optional()
23360
+ keyFrameMediaKey: z.string().optional(),
23361
+ /** Winning identity-match cosine (0..1) for this face's track, when an
23362
+ * identity was auto-confirmed. Lets the UI surface WHY a face was assigned
23363
+ * (confidence badge / low-confidence audit). Absent on legacy rows and on
23364
+ * faces that were never auto-recognized. */
23365
+ bestMatchScore: z.number().optional(),
23366
+ /** Native-scale face short side (px) at recognition time, when the runner
23367
+ * measured it. Lets the UI flag low-resolution auto-assignments. Absent on
23368
+ * legacy rows / runners that reported no native measure. */
23369
+ nativeFaceShortSidePx: z.number().optional(),
23370
+ /** SUGGESTED identity for this face — a plausible-but-not-confident match that
23371
+ * MISSED auto-assignment (cosine in the suggestion band, or above threshold
23372
+ * but blocked only by the recognition size floor). Mutually exclusive with
23373
+ * `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
23374
+ * UNASSIGNED and everything else keeps treating it as unrecognized — the UI
23375
+ * merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
23376
+ * on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
23377
+ suggestedIdentityId: z.string().optional(),
23378
+ /** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
23379
+ * same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
23380
+ * badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
23381
+ suggestedMatchScore: z.number().optional()
22622
23382
  });
22623
23383
  var FaceFilterEnum = z.enum([
22624
23384
  "unassigned",
@@ -25280,7 +26040,6 @@ var CAPABILITY_NAMES = {
25280
26040
  addonWidgetsSource: "addon-widgets-source",
25281
26041
  addons: "addons",
25282
26042
  adminUi: "admin-ui",
25283
- advancedNotifier: "advanced-notifier",
25284
26043
  airQualitySensor: "air-quality-sensor",
25285
26044
  alarmPanel: "alarm-panel",
25286
26045
  alerts: "alerts",
@@ -25359,6 +26118,7 @@ var CAPABILITY_NAMES = {
25359
26118
  networkQuality: "network-quality",
25360
26119
  nodes: "nodes",
25361
26120
  notificationOutput: "notification-output",
26121
+ notificationRules: "notification-rules",
25362
26122
  notifier: "notifier",
25363
26123
  numericSensor: "numeric-sensor",
25364
26124
  oauthIntegration: "oauth-integration",
@@ -25452,10 +26212,6 @@ var CAPABILITY_ROUTER_KEYS = [
25452
26212
  key: "adminUi",
25453
26213
  name: "admin-ui"
25454
26214
  },
25455
- {
25456
- key: "advancedNotifier",
25457
- name: "advanced-notifier"
25458
- },
25459
26215
  {
25460
26216
  key: "airQualitySensor",
25461
26217
  name: "air-quality-sensor"
@@ -25768,6 +26524,10 @@ var CAPABILITY_ROUTER_KEYS = [
25768
26524
  key: "notificationOutput",
25769
26525
  name: "notification-output"
25770
26526
  },
26527
+ {
26528
+ key: "notificationRules",
26529
+ name: "notification-rules"
26530
+ },
25771
26531
  {
25772
26532
  key: "notifier",
25773
26533
  name: "notifier"
@@ -26004,7 +26764,6 @@ var ALL_CAPABILITY_DEFINITIONS = [
26004
26764
  addonWidgetsSourceCapability,
26005
26765
  addonsCapability,
26006
26766
  adminUiCapability,
26007
- advancedNotifierCapability,
26008
26767
  airQualitySensorCapability,
26009
26768
  alarmPanelCapability,
26010
26769
  alertsCapability,
@@ -26083,6 +26842,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
26083
26842
  networkQualityCapability,
26084
26843
  nodesCapability,
26085
26844
  notificationOutputCapability,
26845
+ notificationRulesCapability,
26086
26846
  notifierCapability,
26087
26847
  numericSensorCapability,
26088
26848
  oauthIntegrationCapability,
@@ -26494,36 +27254,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
26494
27254
  addonId: null,
26495
27255
  access: "view"
26496
27256
  },
26497
- "advancedNotifier.deleteRule": {
26498
- capName: "advanced-notifier",
26499
- capScope: "system",
26500
- addonId: null,
26501
- access: "delete"
26502
- },
26503
- "advancedNotifier.getHistory": {
26504
- capName: "advanced-notifier",
26505
- capScope: "system",
26506
- addonId: null,
26507
- access: "view"
26508
- },
26509
- "advancedNotifier.getRules": {
26510
- capName: "advanced-notifier",
26511
- capScope: "system",
26512
- addonId: null,
26513
- access: "view"
26514
- },
26515
- "advancedNotifier.testRule": {
26516
- capName: "advanced-notifier",
26517
- capScope: "system",
26518
- addonId: null,
26519
- access: "create"
26520
- },
26521
- "advancedNotifier.upsertRule": {
26522
- capName: "advanced-notifier",
26523
- capScope: "system",
26524
- addonId: null,
26525
- access: "create"
26526
- },
26527
27257
  "alarmPanel.arm": {
26528
27258
  capName: "alarm-panel",
26529
27259
  capScope: "device",
@@ -28828,6 +29558,60 @@ var METHOD_ACCESS_MAP = Object.freeze({
28828
29558
  addonId: null,
28829
29559
  access: "create"
28830
29560
  },
29561
+ "notificationRules.createRule": {
29562
+ capName: "notification-rules",
29563
+ capScope: "system",
29564
+ addonId: null,
29565
+ access: "create"
29566
+ },
29567
+ "notificationRules.deleteRule": {
29568
+ capName: "notification-rules",
29569
+ capScope: "system",
29570
+ addonId: null,
29571
+ access: "delete"
29572
+ },
29573
+ "notificationRules.getConditionCatalog": {
29574
+ capName: "notification-rules",
29575
+ capScope: "system",
29576
+ addonId: null,
29577
+ access: "view"
29578
+ },
29579
+ "notificationRules.getHistory": {
29580
+ capName: "notification-rules",
29581
+ capScope: "system",
29582
+ addonId: null,
29583
+ access: "view"
29584
+ },
29585
+ "notificationRules.getRule": {
29586
+ capName: "notification-rules",
29587
+ capScope: "system",
29588
+ addonId: null,
29589
+ access: "view"
29590
+ },
29591
+ "notificationRules.listRules": {
29592
+ capName: "notification-rules",
29593
+ capScope: "system",
29594
+ addonId: null,
29595
+ access: "view"
29596
+ },
29597
+ "notificationRules.setRuleEnabled": {
29598
+ capName: "notification-rules",
29599
+ capScope: "system",
29600
+ addonId: null,
29601
+ access: "create"
29602
+ },
29603
+ "notificationRules.testRule": {
29604
+ capName: "notification-rules",
29605
+ capScope: "system",
29606
+ addonId: null,
29607
+ access: "create"
29608
+ },
29609
+ "notificationRules.updateRule": {
29610
+ capName: "notification-rules",
29611
+ capScope: "system",
29612
+ addonId: null,
29613
+ access: "create"
29614
+ },
28831
29615
  "notifier.cancel": {
28832
29616
  capName: "notifier",
28833
29617
  capScope: "device",
@@ -31042,7 +31826,6 @@ var KNOWN_CAP_NAMES = [
31042
31826
  "addon-widgets-source",
31043
31827
  "addons",
31044
31828
  "admin-ui",
31045
- "advanced-notifier",
31046
31829
  "alarm-panel",
31047
31830
  "alerts",
31048
31831
  "audio-analysis",
@@ -31104,6 +31887,7 @@ var KNOWN_CAP_NAMES = [
31104
31887
  "network-quality",
31105
31888
  "nodes",
31106
31889
  "notification-output",
31890
+ "notification-rules",
31107
31891
  "notifier",
31108
31892
  "oauth-integration",
31109
31893
  "osd",
@@ -31217,7 +32001,6 @@ var SYSTEM_CAP_NAMES = [
31217
32001
  "addon-widgets-source",
31218
32002
  "addons",
31219
32003
  "admin-ui",
31220
- "advanced-notifier",
31221
32004
  "alerts",
31222
32005
  "audio-analyzer",
31223
32006
  "audio-codec",
@@ -31249,6 +32032,7 @@ var SYSTEM_CAP_NAMES = [
31249
32032
  "network-quality",
31250
32033
  "nodes",
31251
32034
  "notification-output",
32035
+ "notification-rules",
31252
32036
  "oauth-integration",
31253
32037
  "pipeline-executor",
31254
32038
  "pipeline-orchestrator",
@@ -31869,4 +32653,4 @@ function enumerateInferenceDevices(hw) {
31869
32653
  return out;
31870
32654
  }
31871
32655
  //#endregion
31872
- export { ACCESSORY_LABEL, ALL_CAPABILITY_DEFINITIONS, APPLE_SA_TO_MACRO, AUDIO_BACKEND_CHOICES, AUDIO_MACRO_LABELS, AccessoriesStatusSchema, AccessoryKind, AddBrokerInputSchema, AddonAutoUpdateSchema, AddonListItemSchema, AddonPageDeclarationSchema, AddonPageInfoSchema, AdoptInputSchema as AdoptionAdoptInputSchema, AdoptResultSchema as AdoptionAdoptResultSchema, AdoptionFilterSchema, GetCandidateInputSchema as AdoptionGetCandidateInputSchema, ListCandidatesInputSchema as AdoptionListCandidatesInputSchema, ListCandidatesOutputSchema as AdoptionListCandidatesOutputSchema, ReleaseInputSchema as AdoptionReleaseInputSchema, AdoptionStatusSchema, AgentLoadSummarySchema, AirQualitySensorStatusSchema, AlarmArmModeSchema, AlarmPanelStatusSchema, AlarmStateSchema, AlertSchema, AlertSeveritySchema, AlertSourceSchema, AlertStatusSchema, AmbientLightSensorStatusSchema, ApiKeyRecordSchema, ApiKeySummarySchema, ArchiveEntrySchema, ArchiveManifestSchema, AttachmentMediaTypeSchema, AttachmentSchema, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioChunkInputSchema, AudioClassSummarySchema, AudioClassificationLabelSchema, AudioClassificationResultSchema, AudioCodecInfoSchema, AudioDecodeSessionConfigSchema, AudioEncodeSchema, AudioEncodeSessionConfigSchema, AudioEncodedChunkSchema, AudioEventSchema, AudioLevelSchema, AudioMetricsHistoryPointSchema, AudioMetricsHistorySchema, AudioMetricsSnapshotSchema, AudioPcmChunkSchema, AuthResultSchema, AutoUpdateSettingsSchema, AutomationControlStatusSchema, AvailableIntegrationTypeSchema, BACKEND_TO_FORMAT, BATTERY_DEVICE_PROFILE, BacklightModeSchema, BackupDestinationInfoSchema, BackupEntrySchema, BaseAddon, BaseDevice, BaseDeviceProvider, BatteryStatusSchema, BinaryStatusSchema, BoundingBoxSchema, BrightnessStatusSchema, AddInputSchema as BrokerAddInputSchema, BrokerAudioClientSchema, BrokerClientsSchema, BrokerConnectionDetailsSchema, BrokerConsumerAttributionSchema, BrokerConsumerKindSchema, BrokerDecodedClientSchema, BrokerEncodedClientSchema, GetStateInputSchema as BrokerGetStateInputSchema, BrokerInfoSchema, BrokerProviderInfoSchema, PublishInputSchema as BrokerPublishInputSchema, RegistryStatusSchema as BrokerRegistryStatusSchema, BrokerRtspClientSchema, BrokerStatsSchema, BrokerStatusEnum, BrokerStatusSchema, SubscribeInputSchema as BrokerSubscribeInputSchema, SubscribeResultSchema as BrokerSubscribeResultSchema, TestConnectionResultSchema as BrokerTestConnectionResultSchema, UnsubscribeInputSchema as BrokerUnsubscribeInputSchema, CAM_PROFILE_ORDER, CAPABILITY_NAMES, CAPABILITY_ROUTER_KEYS, CAP_NAMES_WITH_STATUS, CAP_NODE_PIN_CONTEXT_KEY, CAP_PROVIDER_KIND_MAP, COCO_80_LABELS, COCO_TO_MACRO, CamProfileSchema, CamStreamDescriptorSchema, CamStreamKindSchema, CamStreamResolutionSchema, CameraAssignmentStatusSchema, CameraAudioStatusSchema, CameraBrokerProfileSchema, CameraBrokerStatusSchema, CameraCredentialsSchema, CameraCredentialsStatusSchema, CameraDecoderShmSchema, CameraDecoderStatusSchema, CameraDetectionPhaseSchema, CameraDetectionProvisioningSchema, CameraDetectionProvisioningStateSchema, CameraDetectionStatusSchema, CameraMetricsSchema, CameraMetricsWithDeviceIdSchema, CameraMotionStatusSchema, CameraRecordingModeSchema, CameraRecordingStatusSchema, CameraSourceStatusSchema, CameraSourceStreamSchema, CameraStatusSchema, CameraStreamSchema, CandidateQueryFilterSchema, CapScopeSchema, CapabilityBindingsSchema, CarbonMonoxideStatusSchema, ChargingStatus, ClientNetworkStatsSchema, ClimateControlStatusSchema, ClipPlaybackSchema, ClipSchema, ClusterAddonNodeDeploymentSchema, ClusterAddonStatusEntrySchema, CollectionColumnSchema, CollectionIndexSchema, ColorStatusSchema, ConfigEntrySchema, ConfigSectionWithValuesSchema, ConfigTabDeclarationSchema, ConnectivityStatusSchema, ConsumableItemSchema, ConsumablesStatusSchema, ContactStatusSchema, ControlKindSchema, ControlStatusSchema, ConvertArtifactSchema, ConvertResultSchema, ConvertTargetSchema, CoverStateSchema, CoverStatusSchema, CreateApiKeyInputSchema, CreateApiKeyResultSchema, CreateIntegrationInputSchema, CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, CreateUserInputSchema, CustomActionInputSchema, CustomModelDescriptorSchema, DATAPLANE_SECRET_HEADER, DEFAULT_ADDON_PLACEMENT, DEFAULT_AUDIO_ANALYZER_CONFIG, DEFAULT_DECODER_HWACCEL_CONFIG, DEFAULT_EVENT_COLOR, DEFAULT_FEATURES, DEFAULT_RETENTION, DEFAULT_SCRUB_THUMBNAIL_PRESET, DEVICE_BACKEND_TO_FORMAT, DEVICE_CAP_NAMES, DEVICE_PROFILES, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, DEVICE_TYPE_CONTROL_KIND, DEVICE_TYPE_INFO, DayNightModeSchema, DayNightOptionsSchema, DayNightSettingsPatchSchema, DayNightStatusSchema, DecodedAudioChunkSchema, DecodedFrameSchema, DecoderSessionConfigSchema, DecoderStatsSchema, DeleteIntegrationResultSchema, DetectionSourceSchema, DeviceCodeSeveritySchema, DeviceConfig, DeviceDiscoveryStatusSchema, ExposeInputSchema as DeviceExportExposeInputSchema, DeviceExportStatusSchema, UnexposeInputSchema as DeviceExportUnexposeInputSchema, DeviceFeature, DeviceInfoSchema, DeviceLinkModeSchema, DeviceNetworkStatsSchema, DeviceRole, DeviceRuntimeState, DeviceStatusSchema, DeviceType, DiscoveredChildDeviceSchema, DiscoveredChildStatusSchema, DiscoveredDeviceSchema, DiscoveredTargetSchema, DisposerChain, DoorbellPressEventSchema, DoorbellStatusSchema, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_PAD_MS, EVENT_TAXONOMY, EXPRESSION_BUILTINS, EXPRESSION_BUILTIN_NAMES, EXPRESSION_COMPILE_CACHE_CAPACITY, EXPRESSION_IDENTIFIER_RE, EXPRESSION_INJECTED_NOW, ElementConfigStore, EmbeddingInfoSchema, EmbeddingResultSchema, EncodeProfileSchema, EncodedPacketSchema, EnrichedWidgetMetadataSchema, EnumSensorDateTimeFormatSchema, EnumSensorStatusSchema, EventCategory, EventEmitterStatusSchema, EventFireSchema, EventItemSchema, EventKindCategorySchema, EventKindDescriptorSchema, EventKindIconSchema, EventKindSchema, EventSourceType, ExportDownloadSchema, ExportOptionsSchema, ExportRecordSchema, ExportSetupFieldSchema, ExportSetupSchema, ExportSpeedSchema, ExportStateSchema, ExportTimelapseSchema, ExposedDeviceSchema, ExposureModeSchema, ExpressionEvalError, ExpressionParseError, FanControlStatusSchema, FanDirectionSchema, FeatureManifestSchema, FeatureProbeStatusSchema, FloodStatusSchema, FrameHandleFormatSchema, FrameHandleSchema, FrameInputSchema, GasStatusSchema, GetStreamWithCodecInputSchema, GlobalMetricsSchema, HF_BASE_URL, HF_REPO, HWACCEL_OPTIONS, HealthStatusSchema, HistoryPointSchema, HistoryResolutionEnum, HumidifierStatusSchema, HumiditySensorStatusSchema, HvacModeSchema, ImageRotateSchema, ImageSettingsOptionsSchema, ImageSettingsPatchSchema, ImageSettingsStatusSchema, ImageStatusSchema, IngestOwnerSchema, InstalledPackageSchema, IntegrationLiteSchema, IntegrationWithStateSchema, IntercomAbilitySchema, IntercomStatusSchema, KNOWN_CAP_NAMES, KeyEventSchema, LabelDefinitionSchema, LawnMowerActivitySchema, LawnMowerControlStatusSchema, LinkedDeviceSchema, LlmDefaultSchema, LlmDefaultSelectorSchema, LlmErrorCodeSchema, LlmGenerateBaseInputSchema, LlmGenerateErrSchema, LlmGenerateOkSchema, LlmGenerateResultSchema, LlmImageSchema, LlmNodeModelSchema, LlmProfileKindDescriptorSchema, LlmProfileKindSchema, LlmProfileSchema, LlmRuntimeCompleteInputSchema, LlmRuntimeDiskUsageSchema, LlmRuntimeNodeSchema, LlmRuntimeStatusSchema, LlmUsageRollupSchema, LlmUsageSchema, LocateSegmentResultSchema, LocationStatSchema, LockControlStatusSchema, LockStateSchema, LogEntrySchema, LogLevelSchema, LogStreamEntrySchema, LoginMethodContributionSchema, LoginStageEnum, MACRO_LABELS, MAX_EXPRESSION_AST_NODES, MAX_EXPRESSION_BINDINGS, MAX_EXPRESSION_CALL_ARGS, MAX_EXPRESSION_EVAL_STEPS, MAX_EXPRESSION_SOURCE_LENGTH, METHOD_ACCESS_MAP, MODEL_FORMATS, MOTION_TRIGGER_FEATURE, ManagedModelCatalogEntrySchema, ManagedModelRefSchema, ManagedRuntimeConfigSchema, MaskGridDimsSchema, MaskGridShapeSchema, MaskLineShapeSchema, MaskPointSchema, MaskPolygonShapeSchema, MaskPolygonVerticesSchema, MaskRectShapeSchema, MaskShapeKindSchema, MaskShapeSchema, MediaFileSchema, MediaPlayerRepeatSchema, MediaPlayerStateSchema, MediaPlayerStatusSchema, MeshPeerSchema, MeshStatusSchema, MethodAccessSchema, ModelCatalogEntrySchema, ModelConvertInputSchema, ModelConvertMetadataSchema, ModelDistributeInputSchema, ModelDistributeResultSchema, ModelExtraFileSchema, ModelFormatEntrySchema, ModelFormatsSchema, ModelSubstitutionSchema, ModelVariantGroupSchema, MotionAnalysisResultSchema, MotionEventSchema, MotionOnMotionChangedDataSchema, MotionRegionSchema, MotionSourceEnum, MotionSourcesSchema, MotionStatusSchema, MotionTriggerRuntimeStateSchema, MotionTriggerStatusSchema, MotionZoneOptionsSchema, MotionZonePatchSchema, MotionZoneRegionSchema, MotionZoneStatusSchema, StatusSchema as MqttBrokerStatusSchema, NativeCropBboxSchema, NativeCropRefSchema, NativeCropResultSchema, NativeDetectionSchema, NativeObjectClassEnum, NativeObjectDetectionRuntimeStateSchema, NativeObjectDetectionStatusSchema, NetworkAccessStatusSchema, NetworkAddressSchema, NetworkEndpointSchema, NotificationActionSchema, NotificationFormatSchema, NotificationHistoryEntrySchema, NotificationRuleSchema, NotificationSchema, NotifierStatusSchema, NumericSensorStatusSchema, OPS_LOG_DEFAULT_LIMIT, OPS_LOG_RING_DEFAULT_MAX, OauthIntegrationDescriptorSchema, ObjectEventSchema, OpsLogDomainSchema, OpsLogEntrySchema, OpsLogOpSchema, OpsLogQueryInputSchema, OpsLogReasonSchema, OrchestratorMetricsSchema, OsdOverlayKindEnum, OsdOverlayPatchSchema, OsdOverlaySchema, OsdPositionEnum, OsdStatusSchema, PET_FEEDER_MANUAL_FEED_MAX, PET_FEEDER_MANUAL_FEED_MIN, PIPELINE_FLOW_CAPABILITY_NAMES, PIPELINE_OWNER_CAPABILITY_NAMES, PROVIDER_KIND_CAP_NAMES, PYTHON_SCRIPT, PackageUpdateSchema, PackageVersionInfoSchema, PasskeyLoginMethodSchema, PasskeySummarySchema, PcmSampleFormatSchema, PerScopeBreakdownSchema, PetFeederStatusSchema, PickStreamPreferencesSchema, PickStreamRequirementsSchema, PickedCamStreamSchema, PipelineAssignmentSchema, PipelineDefaultStepSchema, PipelineEngineChoiceSchema, PipelineRunResultBridge, PipelineStepInputSchema, PipelineValidationIssueSchema, PipelineValidationResultSchema, PlaceholderReasonSchema, PolygonPointSchema, PowerMeterStatusSchema, PresenceStatusSchema, PressureSensorStatusSchema, PrivacyMaskOptionsSchema, PrivacyMaskPatchSchema, PrivacyMaskRegionSchema, PrivacyMaskShapeSchema, PrivacyMaskStatusSchema, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, ProviderStatusSchema, PtzAutotrackRuntimeStateSchema, PtzAutotrackSettingsSchema, PtzAutotrackStatusSchema, PtzAutotrackTargetOptionSchema, PtzMoveCommandSchema, PtzPositionSchema, PtzPresetSchema, PtzStatusSchema, QueryFilterSchema, REACHABILITY_FAILURES_TO_OFFLINE, REACHABILITY_POLL_INTERVAL_MS, REACHABILITY_PROBE_TIMEOUT_MS, RECOGNITION_TYPES, RESERVED_BINDING_NAMES, RUNTIME_DEFAULTS, RUNTIME_TO_FORMAT, RawStateResultSchema, ReadSegmentBytesResultSchema, ReadinessRegistry, ReadinessTimeoutError, RecentTracksPageSchema, RecentTracksQueryInput, RecordingAvailabilitySchema, RecordingBandModeSchema, RecordingBandSchema, RecordingBandTriggersSchema, RecordingConfigSchema, RecordingDaysSchema, RecordingDeviceUsageSchema, RecordingLocationUsageSchema, RecordingManifestSchema, RecordingModeSchema, RecordingRangeSchema, RecordingRetentionSchema, RecordingRuleSchema, RecordingScheduleSchema, RecordingStatusSchema, RecordingStorageModeSchema, RecordingStorageUsageSchema, RecordingTriggersSchema, RecordingWeekdaySchema, RedirectLoginMethodSchema, RenderedAsSchema, ReportMotionInputSchema, RingBuffer, RtpSourceSchema, RtspRestreamEntrySchema, RunnerCameraConfigSchema, RunnerCameraDeviceUIFields, RunnerFrameSourceSchema, RunnerInferenceDeviceSchema, RunnerLocalLoadSchema, RunnerLocalMetricsSchema, SCOPE_PRESETS, SCRUB_THUMBNAIL_PRESETS, SCRUB_THUMBNAIL_PRESET_LABELS, SCRUB_THUMBNAIL_PRESET_ORDER, SENSOR_FEATURES, SENSOR_MAP, SOURCE_INFO_METADATA_KEY, STREAM_PROFILE_META, STREAM_QUALITY_LABELS, SUB_DETECTION_TYPES, SYSTEM_CAP_NAMES, SceneCheckSchema, SceneConditionSchema, SceneMonitorSchema, SceneMonitorStateSchema, SceneMonitorStatusSchema, SceneReferenceSchema, ScopedTokenSchema, ScopedTokenSummarySchema, ScoredObjectEventSchema, ScriptRunnerStatusSchema, ScrubThumbnailPresetSchema, SearchResultSchema, SendEmailInputSchema, SendEmailResultSchema, SendResultSchema, SensorEventSchema, ServerBootModeSchema, ServerPackageStatusSchema, ServerRollbackInfoSchema, ServerUpdateActionResultSchema, ServerUpdateCheckResultSchema, ServerUpdateStateSchema, SettingsPatchSchema, SettingsRecordSchema, SettingsSchemaWithValuesSchema, SettingsUpdateResultSchema, ShmRingStatsSchema, SmokeStatusSchema, SmtpStatusSchema, SnapshotImageSchema, SourceInfoSchema, SpatialDetectionSchema, SsoBridgeClaimsSchema, StartEmbeddedInputSchema, StationaryObjectSchema, AbortUploadInputSchema as StorageAbortUploadInputSchema, BeginDownloadInputSchema as StorageBeginDownloadInputSchema, BeginDownloadResultSchema as StorageBeginDownloadResultSchema, BeginUploadInputSchema as StorageBeginUploadInputSchema, BeginUploadResultSchema as StorageBeginUploadResultSchema, EndDownloadInputSchema as StorageEndDownloadInputSchema, FinalizeUploadInputSchema as StorageFinalizeUploadInputSchema, StorageLocationDeclarationSchema, StorageLocationRefSchema, StorageLocationSchema, StorageLocationTypeSchema, ProviderInfoSchema as StorageProviderInfoSchema, ReadChunkInputSchema as StorageReadChunkInputSchema, TestLocationResultSchema as StorageTestLocationResultSchema, WriteChunkInputSchema as StorageWriteChunkInputSchema, StreamCodecSchema, StreamFormatSchema, StreamNetworkStatsSchema, StreamParamsOptionsSchema, StreamParamsStatusSchema, StreamProfileConfigSchema, StreamProfileOptionsSchema, StreamProfilePatchSchema, StreamProfileSchema, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, SwitchStatusSchema, SystemMetricsSchema, SystemMirror, TAXONOMY_COLORS, TIMEZONES, TamperStatusSchema, TankStatusSchema, TargetKindCapsSchema, TargetKindLevelSchema, TargetKindSchema, TargetSchema, TemperatureSensorStatusSchema, TestConnectionResultSchema$1 as TestConnectionResultSchema, TestResultSchema, ToastSchema, TokenScopeSchema, TopologyNodeSchema, TopologyProcessSchema, TopologyServiceSchema, TrackCascadeCountsSchema, TrackEnvelopeSchema, TrackProjectionSchema, TrackSchema, TrackStateSchema, TrackZoneFilterSchema, TrackedDetectionSchema, TurnServerSchema, UNIT_TABLE, BrokerInfoSchema$1 as UnifiedBrokerInfoSchema, UnitConversionError, UpdateIntegrationInputSchema, UpdateStatusSchema, UpdateUserInputSchema, UserRecordSchema, UserSummarySchema, VacuumControlStatusSchema, VacuumStateSchema, ValveStateSchema, ValveStatusSchema, VibrationStatusSchema, VideoEncodeSchema, WELL_KNOWN_TABS, WELL_KNOWN_TAB_MAP, WaterHeaterStatusSchema, WeatherStatusSchema, WebrtcStreamChoiceSchema, WebrtcStreamTargetSchema, WhiteBalanceModeSchema, WidgetHostEnum, WidgetLoginMethodSchema, WidgetMetadataSchema, WidgetRemoteSchema, WidgetSizeEnum, YAMNET_TO_MACRO, ZoneKindEnum, ZoneRuleModeEnum, ZoneRuleSchema, ZoneRuleStageEnum, ZoneRulesArraySchema, ZoneSchema, ZoneScopeBreakdownSchema, accessoriesCapability, accessoryStableId, addonPagesCapability, addonPagesSourceCapability, addonRoutesCapability, addonSettingsCapability, addonWidgetsCapability, addonWidgetsSourceCapability, addonsCapability, adminUiCapability, advancedNotifierCapability, airQualitySensorCapability, alarmPanelCapability, alertsCapability, ambientLightSensorCapability, applyTransform, asBoolean, asJsonArray, asJsonObject, asNumber, asString, audioAnalysisCapability, audioAnalyzerCapability, audioCodecCapability, audioMetricsCapability, authProviderCapability, autoAssignProfiles, automationControlCapability, backupCapability, batteryCapability, bestLocationMatch, binaryCapability, bindAddonActions, brightnessCapability, brokerCapability, buildAddonRouteProvider, buildEventKindDescriptor, buildModelVariantGroups, buildStreamParamsConfigSchema, buttonCapability, cameraCredentialsCapability, cameraPipelineConfigCapability, cameraStreamsCapability, canConvertUnit, carbonMonoxideCapability, cellsToRects, classifyStream, classifyStreams, climateControlCapability, collectHydratedFieldEntries, collectHydratedFieldValues, colorCapability, colorForKind, compileExpression, compileExpressionSafe, connectivityCapability, consumablesCapability, contactCapability, controlCapability, convertUnit, cosineSimilarity, coverCapability, createDeviceProxy, createDurableState, createEvent, createExpressionScope, createLazyTrpcSource, createMirrorSource, createRuntimeStateBridge, createSliceHandle, createSystemProxy, customAction, customModelRegistryCapability, dayNightCapability, decoderCapability, defaultDeviceFor, defineCustomActions, describeModelVariant, detectionPipelineCapability, deviceAdoptionCapability, deviceBackendToFormat, deviceCustomAction, deviceDiscoveryCapability, deviceExportCapability, deviceManagerCapability, deviceMatchesProfile, deviceOpsCapability, deviceProviderCapability, deviceStateCapability, deviceStatusCapability, doorbellCapability, embeddingEncoderCapability, emitDownForOwnedCaps, emitReadiness, encodeProfileFromStreamShape, enumSensorCapability, enumerateInferenceDevices, enumerateItemArrayFields, enumerateSchemaFields, errMsg, evaluateAst, evaluateLinkExpression, evaluateZoneRules, event, eventEmitterCapability, eventsCapability, expandCapMethods, extractNestedAddonId, extractSourceInfoFromMetadata, faceGalleryCapability, fanControlCapability, featureProbeCapability, filesystemBrowseCapability, findTimezone, floodCapability, formatForBackend, formatForRuntime, gasCapability, getAudioMacroClassIds, getByPath, getCapsByProviderKind, getTaxonomyEntry, hasMotionTrigger, hfModelUrl, htmlToText, humidifierCapability, humiditySensorCapability, hydrateSchema, imageCapability, imageSettingsCapability, integrationsCapability, intercomCapability, isAgentOnlyPlacement, isArrayOutputSchema, isCollectionArrayMethod, isDeployableToAgent, isDeviceConfigCap, isEvent, isNode, isObjectInput, isVoidInput, jobKindSchema, kebabToCamel, lawnMowerControlCapability, lifecycleJobSchema, lifecycleJobScopeSchema, lifecycleJobStateSchema, lifecycleTaskSchema, llmCapability, llmRuntimeCapability, localNetworkCapability, locationSimilarity, lockControlCapability, logDestinationCapability, loginMethodCapability, looseSchema, makeProfileBrokerId, makeSourceBrokerId, mapAudioLabelToMacro, markdownToHtmlLite, markdownToText, maskUrlCredentials, mediaPlayerCapability, mergeSourceInfo, meshNetworkCapability, method, metricsProviderCapability, migrateConfigToBands, modelConvertCapability, modelDistributorCapability, modelFormatForRuntime, motionCapability, motionDetectionCapability, motionTriggerCapability, motionZonesCapability, mqttBrokerCapability, nativeObjectDetectionCapability, networkAccessCapability, networkQualityCapability, nodePin, nodesCapability, normalizeAddonInitResult, normalizeUnit, notificationOutputCapability, notifierCapability, numericSensorCapability, oauthIntegrationCapability, objectInputDeclaresAddonId, osdCapability, parseCameraStreamConfig, parseExpression, parseJsonArray, parseJsonObject, parseJsonUnknown, parseProfileBrokerId, parseStreamParamsFormPatch, petFeederCapability, pickAccessoryControl, pickPreferredRtspEntry, pipelineAnalyticsCapability, pipelineExecutorCapability, pipelineOrchestratorCapability, pipelineRunnerCapability, plateGalleryCapability, platformProbeCapability, powerMeterCapability, prepareNotification, presenceCapability, pressureSensorCapability, privacyMaskCapability, procedureAuthKey, ptzAutotrackCapability, ptzCapability, pythonScriptForBackend, readNodePin, readinessKey, rebootCapability, recordingCapability, recordingExportCapability, rectsToCells, requiresPython, resolveAddonExecution, resolveAddonGroup, resolveAddonPlacement, resolveAddonRuntime, resolveCapMount, resolveDetectionRuntime, resolveDeviceControlKind, resolveDeviceProfile, resolveFormat, resolveHydratedFieldValue, resolveModelFormat, resolveMutate, resolveRunnerId, resolveScrubThumbnailGeometry, resolveVariantModelId, runInferenceStep, runtimeDevices, sceneMonitorCapability, scopeKey, scoreRuntimes, scriptRunnerCapability, selectAssignedProfileSlots, serverManagementCapability, setByPath, settingsStoreCapability, sleep, sleepCancellable, smokeCapability, smtpProviderCapability, snapshotCapability, ssoBridgeCapability, startReachabilityPoll, storageCapability, storageEvictableCapability, storageProviderCapability, streamBrokerCapability, streamCatalogCapability, streamParamsCapability, streamPixels, streamQualityLabel, subKindsOf, supportedRuntimes, switchCapability, synthesizeSourceInfo, systemCapability, tamperCapability, taskLogEntrySchema, taskPhaseSchema, taskTargetSchema, temperatureSensorCapability, textToHtml, toDeviceSummary, toExpressionValue, toStreamSourceEntry, toastCapability, tokenize, transcodeBody, tryConvertUnit, turnProviderCapability, unitDimension, unitsForDimension, updateCapability, userManagementCapability, userPasskeysCapability, vacuumControlCapability, validateExpressionSource, valveCapability, vibrationCapability, videoclipsCapability, viewerUiCapability, waterHeaterCapability, weatherCapability, webrtcClientHintsSchema, webrtcSessionCapability, wiringAddonHealthSchema, wiringHealthSnapshotSchema, wiringNodeHealthSchema, wiringProbeKindSchema, wiringProbeResultSchema, zodEntriesToConfigUI, zoneAnalyticsCapability, zoneRulesCapability, zonesCapability };
32656
+ export { ACCESSORY_LABEL, ALL_CAPABILITY_DEFINITIONS, APPLE_SA_TO_MACRO, AUDIO_BACKEND_CHOICES, AUDIO_MACRO_LABELS, AccessoriesStatusSchema, AccessoryKind, AddBrokerInputSchema, AddonAutoUpdateSchema, AddonListItemSchema, AddonPageDeclarationSchema, AddonPageInfoSchema, AdoptInputSchema as AdoptionAdoptInputSchema, AdoptResultSchema as AdoptionAdoptResultSchema, AdoptionFilterSchema, GetCandidateInputSchema as AdoptionGetCandidateInputSchema, ListCandidatesInputSchema as AdoptionListCandidatesInputSchema, ListCandidatesOutputSchema as AdoptionListCandidatesOutputSchema, ReleaseInputSchema as AdoptionReleaseInputSchema, AdoptionStatusSchema, AgentLoadSummarySchema, AirQualitySensorStatusSchema, AlarmArmModeSchema, AlarmPanelStatusSchema, AlarmStateSchema, AlertSchema, AlertSeveritySchema, AlertSourceSchema, AlertStatusSchema, AmbientLightSensorStatusSchema, ApiKeyRecordSchema, ApiKeySummarySchema, ArchiveEntrySchema, ArchiveManifestSchema, AttachmentMediaTypeSchema, AttachmentSchema, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioChunkInputSchema, AudioClassSummarySchema, AudioClassificationLabelSchema, AudioClassificationResultSchema, AudioCodecInfoSchema, AudioDecodeSessionConfigSchema, AudioEncodeSchema, AudioEncodeSessionConfigSchema, AudioEncodedChunkSchema, AudioEventSchema, AudioLevelSchema, AudioMetricsHistoryPointSchema, AudioMetricsHistorySchema, AudioMetricsSnapshotSchema, AudioPcmChunkSchema, AuthResultSchema, AutoUpdateSettingsSchema, AutomationControlStatusSchema, AvailableIntegrationTypeSchema, BACKEND_TO_FORMAT, BATTERY_DEVICE_PROFILE, BacklightModeSchema, BackupDestinationInfoSchema, BackupEntrySchema, BaseAddon, BaseDevice, BaseDeviceProvider, BatteryStatusSchema, BinaryStatusSchema, BoundingBoxSchema, BrightnessStatusSchema, AddInputSchema as BrokerAddInputSchema, BrokerAudioClientSchema, BrokerClientsSchema, BrokerConnectionDetailsSchema, BrokerConsumerAttributionSchema, BrokerConsumerKindSchema, BrokerDecodedClientSchema, BrokerEncodedClientSchema, GetStateInputSchema as BrokerGetStateInputSchema, BrokerInfoSchema, BrokerProviderInfoSchema, PublishInputSchema as BrokerPublishInputSchema, RegistryStatusSchema as BrokerRegistryStatusSchema, BrokerRtspClientSchema, BrokerStatsSchema, BrokerStatusEnum, BrokerStatusSchema, SubscribeInputSchema as BrokerSubscribeInputSchema, SubscribeResultSchema as BrokerSubscribeResultSchema, TestConnectionResultSchema as BrokerTestConnectionResultSchema, UnsubscribeInputSchema as BrokerUnsubscribeInputSchema, CAM_PROFILE_ORDER, CAPABILITY_NAMES, CAPABILITY_ROUTER_KEYS, CAP_NAMES_WITH_STATUS, CAP_NODE_PIN_CONTEXT_KEY, CAP_PROVIDER_KIND_MAP, COCO_80_LABELS, COCO_TO_MACRO, CamProfileSchema, CamStreamDescriptorSchema, CamStreamKindSchema, CamStreamResolutionSchema, CameraAssignmentStatusSchema, CameraAudioStatusSchema, CameraBrokerProfileSchema, CameraBrokerStatusSchema, CameraCredentialsSchema, CameraCredentialsStatusSchema, CameraDecoderShmSchema, CameraDecoderStatusSchema, CameraDetectionPhaseSchema, CameraDetectionProvisioningSchema, CameraDetectionProvisioningStateSchema, CameraDetectionStatusSchema, CameraMetricsSchema, CameraMetricsWithDeviceIdSchema, CameraMotionStatusSchema, CameraRecordingModeSchema, CameraRecordingStatusSchema, CameraSourceStatusSchema, CameraSourceStreamSchema, CameraStatusSchema, CameraStreamSchema, CandidateQueryFilterSchema, CapScopeSchema, CapabilityBindingsSchema, CarbonMonoxideStatusSchema, ChargingStatus, ClientNetworkStatsSchema, ClimateControlStatusSchema, ClipPlaybackSchema, ClipSchema, ClusterAddonNodeDeploymentSchema, ClusterAddonStatusEntrySchema, CollectionColumnSchema, CollectionIndexSchema, ColorStatusSchema, ConfigEntrySchema, ConfigSectionWithValuesSchema, ConfigTabDeclarationSchema, ConnectivityStatusSchema, ConsumableItemSchema, ConsumablesStatusSchema, ContactStatusSchema, ControlKindSchema, ControlStatusSchema, ConvertArtifactSchema, ConvertResultSchema, ConvertTargetSchema, CoverStateSchema, CoverStatusSchema, CreateApiKeyInputSchema, CreateApiKeyResultSchema, CreateIntegrationInputSchema, CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, CreateUserInputSchema, CustomActionInputSchema, CustomModelDescriptorSchema, DATAPLANE_SECRET_HEADER, DEFAULT_ADDON_PLACEMENT, DEFAULT_AUDIO_ANALYZER_CONFIG, DEFAULT_DECODER_HWACCEL_CONFIG, DEFAULT_EVENT_COLOR, DEFAULT_FEATURES, DEFAULT_RETENTION, DEFAULT_SCRUB_THUMBNAIL_PRESET, DEVICE_BACKEND_TO_FORMAT, DEVICE_CAP_NAMES, DEVICE_PROFILES, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, DEVICE_TYPE_CONTROL_KIND, DEVICE_TYPE_INFO, DayNightModeSchema, DayNightOptionsSchema, DayNightSettingsPatchSchema, DayNightStatusSchema, DecodedAudioChunkSchema, DecodedFrameSchema, DecoderSessionConfigSchema, DecoderStatsSchema, DeleteIntegrationResultSchema, DetectionSourceSchema, DeviceCodeSeveritySchema, DeviceConfig, DeviceDiscoveryStatusSchema, ExposeInputSchema as DeviceExportExposeInputSchema, DeviceExportStatusSchema, UnexposeInputSchema as DeviceExportUnexposeInputSchema, DeviceFeature, DeviceInfoSchema, DeviceLinkModeSchema, DeviceNetworkStatsSchema, DeviceRole, DeviceRuntimeState, DeviceStatusSchema, DeviceType, DiscoveredChildDeviceSchema, DiscoveredChildStatusSchema, DiscoveredDeviceSchema, DiscoveredTargetSchema, DisposerChain, DoorbellPressEventSchema, DoorbellStatusSchema, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_PAD_MS, EVENT_TAXONOMY, EXPRESSION_BUILTINS, EXPRESSION_BUILTIN_NAMES, EXPRESSION_COMPILE_CACHE_CAPACITY, EXPRESSION_IDENTIFIER_RE, EXPRESSION_INJECTED_NOW, ElementConfigStore, EmbeddingInfoSchema, EmbeddingResultSchema, EncodeProfileSchema, EncodedPacketSchema, EnrichedWidgetMetadataSchema, EnumSensorDateTimeFormatSchema, EnumSensorStatusSchema, EventCategory, EventEmitterStatusSchema, EventFireSchema, EventItemSchema, EventKindCategorySchema, EventKindDescriptorSchema, EventKindIconSchema, EventKindSchema, EventSourceType, ExportDownloadSchema, ExportOptionsSchema, ExportRecordSchema, ExportSetupFieldSchema, ExportSetupSchema, ExportSpeedSchema, ExportStateSchema, ExportTimelapseSchema, ExposedDeviceSchema, ExposureModeSchema, ExpressionEvalError, ExpressionParseError, FanControlStatusSchema, FanDirectionSchema, FeatureManifestSchema, FeatureProbeStatusSchema, FloodStatusSchema, FrameHandleFormatSchema, FrameHandleSchema, FrameInputSchema, GasStatusSchema, GetStreamWithCodecInputSchema, GlobalMetricsSchema, HF_BASE_URL, HF_REPO, HWACCEL_OPTIONS, HealthStatusSchema, HistoryPointSchema, HistoryResolutionEnum, HumidifierStatusSchema, HumiditySensorStatusSchema, HvacModeSchema, ImageRotateSchema, ImageSettingsOptionsSchema, ImageSettingsPatchSchema, ImageSettingsStatusSchema, ImageStatusSchema, IngestOwnerSchema, InstalledPackageSchema, IntegrationLiteSchema, IntegrationWithStateSchema, IntercomAbilitySchema, IntercomStatusSchema, KNOWN_CAP_NAMES, KeyEventSchema, LabelDefinitionSchema, LawnMowerActivitySchema, LawnMowerControlStatusSchema, LinkedDeviceSchema, LlmDefaultSchema, LlmDefaultSelectorSchema, LlmErrorCodeSchema, LlmGenerateBaseInputSchema, LlmGenerateErrSchema, LlmGenerateOkSchema, LlmGenerateResultSchema, LlmImageSchema, LlmNodeModelSchema, LlmProfileKindDescriptorSchema, LlmProfileKindSchema, LlmProfileSchema, LlmRuntimeCompleteInputSchema, LlmRuntimeDiskUsageSchema, LlmRuntimeNodeSchema, LlmRuntimeStatusSchema, LlmUsageRollupSchema, LlmUsageSchema, LocateSegmentResultSchema, LocationStatSchema, LockControlStatusSchema, LockStateSchema, LogEntrySchema, LogLevelSchema, LogStreamEntrySchema, LoginMethodContributionSchema, LoginStageEnum, MACRO_LABELS, MAX_EXPRESSION_AST_NODES, MAX_EXPRESSION_BINDINGS, MAX_EXPRESSION_CALL_ARGS, MAX_EXPRESSION_EVAL_STEPS, MAX_EXPRESSION_SOURCE_LENGTH, METHOD_ACCESS_MAP, MODEL_FORMATS, MOTION_TRIGGER_FEATURE, ManagedModelCatalogEntrySchema, ManagedModelRefSchema, ManagedRuntimeConfigSchema, MaskGridDimsSchema, MaskGridShapeSchema, MaskLineShapeSchema, MaskPointSchema, MaskPolygonShapeSchema, MaskPolygonVerticesSchema, MaskRectShapeSchema, MaskShapeKindSchema, MaskShapeSchema, MediaFileSchema, MediaPlayerRepeatSchema, MediaPlayerStateSchema, MediaPlayerStatusSchema, MeshPeerSchema, MeshStatusSchema, MethodAccessSchema, ModelCatalogEntrySchema, ModelConvertInputSchema, ModelConvertMetadataSchema, ModelDistributeInputSchema, ModelDistributeResultSchema, ModelExtraFileSchema, ModelFormatEntrySchema, ModelFormatsSchema, ModelSubstitutionSchema, ModelVariantGroupSchema, MotionAnalysisResultSchema, MotionEventSchema, MotionOnMotionChangedDataSchema, MotionRegionSchema, MotionSourceEnum, MotionSourcesSchema, MotionStatusSchema, MotionTriggerRuntimeStateSchema, MotionTriggerStatusSchema, MotionZoneOptionsSchema, MotionZonePatchSchema, MotionZoneRegionSchema, MotionZoneStatusSchema, StatusSchema as MqttBrokerStatusSchema, NC_CONDITION_CATALOG, NC_HISTORY_LIMIT_DEFAULT, NC_HISTORY_LIMIT_MAX, NC_MAX_PER_TRACK_IMMEDIATE, NC_TAXONOMY, NativeCropBboxSchema, NativeCropRefSchema, NativeCropResultSchema, NativeDetectionSchema, NativeObjectClassEnum, NativeObjectDetectionRuntimeStateSchema, NativeObjectDetectionStatusSchema, NcConditionDescriptorSchema, NcConditionsSchema, NcDeliverySchema, NcHistoryEntrySchema, NcHistoryFilterSchema, NcHistoryRecordKindSchema, NcHistoryStatusSchema, NcHistorySubjectSchema, NcMediaPolicySchema, NcOccupancyConditionSchema, NcPlateMatcherSchema, NcRuleInputSchema, NcRulePatchSchema, NcRuleSchema, NcRuleTargetSchema, NcScheduleSchema, NcScheduleWindowSchema, NcTaxonomyEntrySchema, NcTaxonomySchema, NcTestResultSchema, NcThrottleSchema, NcZoneConditionSchema, NetworkAccessStatusSchema, NetworkAddressSchema, NetworkEndpointSchema, NotificationActionSchema, NotificationFormatSchema, NotificationSchema, NotifierStatusSchema, NumericSensorStatusSchema, OPS_LOG_DEFAULT_LIMIT, OPS_LOG_RING_DEFAULT_MAX, OauthIntegrationDescriptorSchema, ObjectEventSchema, OpsLogDomainSchema, OpsLogEntrySchema, OpsLogOpSchema, OpsLogQueryInputSchema, OpsLogReasonSchema, OrchestratorMetricsSchema, OsdOverlayKindEnum, OsdOverlayPatchSchema, OsdOverlaySchema, OsdPositionEnum, OsdStatusSchema, PET_FEEDER_MANUAL_FEED_MAX, PET_FEEDER_MANUAL_FEED_MIN, PIPELINE_FLOW_CAPABILITY_NAMES, PIPELINE_OWNER_CAPABILITY_NAMES, PROVIDER_KIND_CAP_NAMES, PYTHON_SCRIPT, PackageUpdateSchema, PackageVersionInfoSchema, PasskeyLoginMethodSchema, PasskeySummarySchema, PcmSampleFormatSchema, PerScopeBreakdownSchema, PetFeederStatusSchema, PickStreamPreferencesSchema, PickStreamRequirementsSchema, PickedCamStreamSchema, PipelineAssignmentSchema, PipelineDefaultStepSchema, PipelineEngineChoiceSchema, PipelineRunResultBridge, PipelineStepInputSchema, PipelineValidationIssueSchema, PipelineValidationResultSchema, PlaceholderReasonSchema, PolygonPointSchema, PowerMeterStatusSchema, PresenceStatusSchema, PressureSensorStatusSchema, PrivacyMaskOptionsSchema, PrivacyMaskPatchSchema, PrivacyMaskRegionSchema, PrivacyMaskShapeSchema, PrivacyMaskStatusSchema, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, ProviderStatusSchema, PtzAutotrackRuntimeStateSchema, PtzAutotrackSettingsSchema, PtzAutotrackStatusSchema, PtzAutotrackTargetOptionSchema, PtzMoveCommandSchema, PtzOptionsSchema, PtzPositionSchema, PtzPresetSchema, PtzStatusSchema, QueryFilterSchema, REACHABILITY_FAILURES_TO_OFFLINE, REACHABILITY_POLL_INTERVAL_MS, REACHABILITY_PROBE_TIMEOUT_MS, RECOGNITION_TYPES, RESERVED_BINDING_NAMES, RUNTIME_DEFAULTS, RUNTIME_TO_FORMAT, RawStateResultSchema, ReadSegmentBytesResultSchema, ReadinessRegistry, ReadinessTimeoutError, RecentTracksPageSchema, RecentTracksQueryInput, RecordingAvailabilitySchema, RecordingBandModeSchema, RecordingBandSchema, RecordingBandTriggersSchema, RecordingConfigSchema, RecordingDaysSchema, RecordingDeviceUsageSchema, RecordingLocationUsageSchema, RecordingManifestSchema, RecordingModeSchema, RecordingRangeSchema, RecordingRetentionSchema, RecordingRuleSchema, RecordingScheduleSchema, RecordingStatusSchema, RecordingStorageModeSchema, RecordingStorageUsageSchema, RecordingTriggersSchema, RecordingWeekdaySchema, RedirectLoginMethodSchema, RenderedAsSchema, ReportMotionInputSchema, RingBuffer, RtpSourceSchema, RtspRestreamEntrySchema, RunnerCameraConfigSchema, RunnerCameraDeviceUIFields, RunnerFrameSourceSchema, RunnerInferenceDeviceSchema, RunnerLocalLoadSchema, RunnerLocalMetricsSchema, SCOPE_PRESETS, SCRUB_THUMBNAIL_PRESETS, SCRUB_THUMBNAIL_PRESET_LABELS, SCRUB_THUMBNAIL_PRESET_ORDER, SENSOR_FEATURES, SENSOR_MAP, SOURCE_INFO_METADATA_KEY, STREAM_PROFILE_META, STREAM_QUALITY_LABELS, SUB_DETECTION_TYPES, SYSTEM_CAP_NAMES, SceneCheckSchema, SceneConditionSchema, SceneMonitorSchema, SceneMonitorStateSchema, SceneMonitorStatusSchema, SceneReferenceSchema, ScopedTokenSchema, ScopedTokenSummarySchema, ScoredObjectEventSchema, ScriptRunnerStatusSchema, ScrubThumbnailPresetSchema, SearchResultSchema, SendEmailInputSchema, SendEmailResultSchema, SendResultSchema, SensorEventSchema, ServerBootModeSchema, ServerPackageStatusSchema, ServerRollbackInfoSchema, ServerUpdateActionResultSchema, ServerUpdateCheckResultSchema, ServerUpdateStateSchema, SettingsPatchSchema, SettingsRecordSchema, SettingsSchemaWithValuesSchema, SettingsUpdateResultSchema, ShmRingStatsSchema, SmokeStatusSchema, SmtpStatusSchema, SnapshotImageSchema, SourceInfoSchema, SpatialDetectionSchema, SsoBridgeClaimsSchema, StartEmbeddedInputSchema, StationaryObjectSchema, AbortUploadInputSchema as StorageAbortUploadInputSchema, BeginDownloadInputSchema as StorageBeginDownloadInputSchema, BeginDownloadResultSchema as StorageBeginDownloadResultSchema, BeginUploadInputSchema as StorageBeginUploadInputSchema, BeginUploadResultSchema as StorageBeginUploadResultSchema, EndDownloadInputSchema as StorageEndDownloadInputSchema, FinalizeUploadInputSchema as StorageFinalizeUploadInputSchema, StorageLocationDeclarationSchema, StorageLocationRefSchema, StorageLocationSchema, StorageLocationTypeSchema, ProviderInfoSchema as StorageProviderInfoSchema, ReadChunkInputSchema as StorageReadChunkInputSchema, TestLocationResultSchema as StorageTestLocationResultSchema, WriteChunkInputSchema as StorageWriteChunkInputSchema, StreamCodecSchema, StreamFormatSchema, StreamNetworkStatsSchema, StreamParamsOptionsSchema, StreamParamsStatusSchema, StreamProfileConfigSchema, StreamProfileOptionsSchema, StreamProfilePatchSchema, StreamProfileSchema, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, SwitchStatusSchema, SystemMetricsSchema, SystemMirror, TAXONOMY_COLORS, TIMEZONES, TamperStatusSchema, TankStatusSchema, TargetKindCapsSchema, TargetKindLevelSchema, TargetKindSchema, TargetSchema, TemperatureSensorStatusSchema, TestConnectionResultSchema$1 as TestConnectionResultSchema, TestResultSchema, ToastSchema, TokenScopeSchema, TopologyNodeSchema, TopologyProcessSchema, TopologyServiceSchema, TrackCascadeCountsSchema, TrackEnvelopeSchema, TrackProjectionSchema, TrackSchema, TrackStateSchema, TrackZoneFilterSchema, TrackedDetectionSchema, TurnServerSchema, UNIT_TABLE, BrokerInfoSchema$1 as UnifiedBrokerInfoSchema, UnitConversionError, UpdateIntegrationInputSchema, UpdateStatusSchema, UpdateUserInputSchema, UserRecordSchema, UserSummarySchema, VacuumControlStatusSchema, VacuumStateSchema, ValveStateSchema, ValveStatusSchema, VibrationStatusSchema, VideoEncodeSchema, WELL_KNOWN_TABS, WELL_KNOWN_TAB_MAP, WaterHeaterStatusSchema, WeatherStatusSchema, WebrtcStreamChoiceSchema, WebrtcStreamTargetSchema, WhiteBalanceModeSchema, WidgetHostEnum, WidgetLoginMethodSchema, WidgetMetadataSchema, WidgetRemoteSchema, WidgetSizeEnum, YAMNET_TO_MACRO, ZoneKindEnum, ZoneRuleModeEnum, ZoneRuleSchema, ZoneRuleStageEnum, ZoneRulesArraySchema, ZoneSchema, ZoneScopeBreakdownSchema, accessoriesCapability, accessoryStableId, addonPagesCapability, addonPagesSourceCapability, addonRoutesCapability, addonSettingsCapability, addonWidgetsCapability, addonWidgetsSourceCapability, addonsCapability, adminUiCapability, airQualitySensorCapability, alarmPanelCapability, alertsCapability, ambientLightSensorCapability, applyTransform, asBoolean, asJsonArray, asJsonObject, asNumber, asString, audioAnalysisCapability, audioAnalyzerCapability, audioCodecCapability, audioMetricsCapability, authProviderCapability, autoAssignProfiles, automationControlCapability, backupCapability, batteryCapability, bestLocationMatch, binaryCapability, bindAddonActions, brightnessCapability, brokerCapability, buildAddonRouteProvider, buildEventKindDescriptor, buildModelVariantGroups, buildNcTaxonomy, buildStreamParamsConfigSchema, buttonCapability, cameraCredentialsCapability, cameraPipelineConfigCapability, cameraStreamsCapability, canConvertUnit, carbonMonoxideCapability, cellsToRects, classifyStream, classifyStreams, climateControlCapability, collectHydratedFieldEntries, collectHydratedFieldValues, colorCapability, colorForKind, compileExpression, compileExpressionSafe, connectivityCapability, consumablesCapability, contactCapability, controlCapability, convertUnit, cosineSimilarity, coverCapability, createDeviceProxy, createDurableState, createEvent, createExpressionScope, createLazyTrpcSource, createMirrorSource, createRuntimeStateBridge, createSliceHandle, createSystemProxy, customAction, customModelRegistryCapability, dayNightCapability, decoderCapability, defaultDeviceFor, defineCustomActions, describeModelVariant, detectionPipelineCapability, deviceAdoptionCapability, deviceBackendToFormat, deviceCustomAction, deviceDiscoveryCapability, deviceExportCapability, deviceManagerCapability, deviceMatchesProfile, deviceOpsCapability, deviceProviderCapability, deviceStateCapability, deviceStatusCapability, doorbellCapability, embeddingEncoderCapability, emitDownForOwnedCaps, emitReadiness, encodeProfileFromStreamShape, enumSensorCapability, enumerateInferenceDevices, enumerateItemArrayFields, enumerateSchemaFields, errMsg, evaluateAst, evaluateLinkExpression, evaluateZoneRules, event, eventEmitterCapability, eventsCapability, expandCapMethods, extractNestedAddonId, extractSourceInfoFromMetadata, faceGalleryCapability, fanControlCapability, featureProbeCapability, filesystemBrowseCapability, findTimezone, floodCapability, formatForBackend, formatForRuntime, gasCapability, getAudioMacroClassIds, getByPath, getCapsByProviderKind, getTaxonomyEntry, hasMotionTrigger, hfModelUrl, htmlToText, humidifierCapability, humiditySensorCapability, hydrateSchema, imageCapability, imageSettingsCapability, integrationsCapability, intercomCapability, isAgentOnlyPlacement, isArrayOutputSchema, isCollectionArrayMethod, isDeployableToAgent, isDeviceConfigCap, isEvent, isNode, isObjectInput, isVoidInput, jobKindSchema, kebabToCamel, lawnMowerControlCapability, lifecycleJobSchema, lifecycleJobScopeSchema, lifecycleJobStateSchema, lifecycleTaskSchema, llmCapability, llmRuntimeCapability, localNetworkCapability, locationSimilarity, lockControlCapability, logDestinationCapability, loginMethodCapability, looseSchema, makeProfileBrokerId, makeSourceBrokerId, mapAudioLabelToMacro, markdownToHtmlLite, markdownToText, maskUrlCredentials, mediaPlayerCapability, mergeSourceInfo, meshNetworkCapability, method, metricsProviderCapability, migrateConfigToBands, modelConvertCapability, modelDistributorCapability, modelFormatForRuntime, motionCapability, motionDetectionCapability, motionTriggerCapability, motionZonesCapability, mqttBrokerCapability, nativeObjectDetectionCapability, networkAccessCapability, networkQualityCapability, nodePin, nodesCapability, normalizeAddonInitResult, normalizeUnit, notificationOutputCapability, notificationRulesCapability, notifierCapability, numericSensorCapability, oauthIntegrationCapability, objectInputDeclaresAddonId, osdCapability, parseCameraStreamConfig, parseExpression, parseJsonArray, parseJsonObject, parseJsonUnknown, parseProfileBrokerId, parseStreamParamsFormPatch, petFeederCapability, pickAccessoryControl, pickPreferredRtspEntry, pipelineAnalyticsCapability, pipelineExecutorCapability, pipelineOrchestratorCapability, pipelineRunnerCapability, plateGalleryCapability, platformProbeCapability, powerMeterCapability, prepareNotification, presenceCapability, pressureSensorCapability, privacyMaskCapability, procedureAuthKey, ptzAutotrackCapability, ptzCapability, pythonScriptForBackend, readNodePin, readinessKey, rebootCapability, recordingCapability, recordingExportCapability, rectsToCells, requiresPython, resolveAddonExecution, resolveAddonGroup, resolveAddonPlacement, resolveAddonRuntime, resolveCapMount, resolveDetectionRuntime, resolveDeviceControlKind, resolveDeviceProfile, resolveFormat, resolveHydratedFieldValue, resolveModelFormat, resolveMutate, resolveRunnerId, resolveScrubThumbnailGeometry, resolveVariantModelId, runInferenceStep, runtimeDevices, sceneMonitorCapability, scopeKey, scoreRuntimes, scriptRunnerCapability, selectAssignedProfileSlots, serverManagementCapability, setByPath, settingsStoreCapability, sleep, sleepCancellable, smokeCapability, smtpProviderCapability, snapshotCapability, ssoBridgeCapability, startReachabilityPoll, storageCapability, storageEvictableCapability, storageProviderCapability, streamBrokerCapability, streamCatalogCapability, streamParamsCapability, streamPixels, streamQualityLabel, subKindsOf, supportedRuntimes, switchCapability, synthesizeSourceInfo, systemCapability, tamperCapability, taskLogEntrySchema, taskPhaseSchema, taskTargetSchema, temperatureSensorCapability, textToHtml, toDeviceSummary, toExpressionValue, toStreamSourceEntry, toastCapability, tokenize, transcodeBody, tryConvertUnit, turnProviderCapability, unitDimension, unitsForDimension, updateCapability, userManagementCapability, userPasskeysCapability, vacuumControlCapability, validateExpressionSource, valveCapability, vibrationCapability, videoclipsCapability, viewerUiCapability, waterHeaterCapability, weatherCapability, webrtcClientHintsSchema, webrtcSessionCapability, wiringAddonHealthSchema, wiringHealthSnapshotSchema, wiringNodeHealthSchema, wiringProbeKindSchema, wiringProbeResultSchema, zodEntriesToConfigUI, zoneAnalyticsCapability, zoneRulesCapability, zonesCapability };