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