@camstack/system 1.1.48 → 1.1.49

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 (47) hide show
  1. package/dist/addon-runner.js +15 -3
  2. package/dist/addon-runner.mjs +15 -3
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +1 -1
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/device-manager/device-manager.addon.js +1 -1
  14. package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  15. package/dist/builtins/hub-forwarder/index.js +1 -1
  16. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  17. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  18. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  19. package/dist/builtins/local-network/local-network.addon.js +1 -1
  20. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  21. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  22. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  23. package/dist/builtins/platform-probe/index.js +1 -1
  24. package/dist/builtins/platform-probe/index.mjs +1 -1
  25. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  26. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  27. package/dist/builtins/snapshot/index.js +1 -1
  28. package/dist/builtins/snapshot/index.mjs +1 -1
  29. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  30. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  31. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
  32. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
  33. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  34. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  35. package/dist/builtins/system-config/system-config.addon.js +1 -1
  36. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  37. package/dist/builtins/winston-logging/index.js +1 -1
  38. package/dist/builtins/winston-logging/index.mjs +1 -1
  39. package/dist/{dist-BMN1IAl3.mjs → dist-8phgmJ6b.mjs} +1073 -39
  40. package/dist/{dist-CiveK-yv.js → dist-BDV1WKRg.js} +1078 -38
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js +3 -2
  43. package/dist/index.mjs +3 -3
  44. package/dist/kernel/moleculer/child-cap-dispatch.d.ts +12 -0
  45. package/dist/{manifest-python-deps-CWBvn2eF.mjs → manifest-python-deps-B09I9ems.mjs} +1 -1
  46. package/dist/{manifest-python-deps-DRE97YbS.js → manifest-python-deps-DAA0ULwT.js} +1 -1
  47. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- //#region ../types/dist/sleep-Baang_XW.mjs
2
+ //#region ../types/dist/sleep-DkhOVOjW.mjs
3
3
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4
4
  EventCategory["SystemBoot"] = "system.boot";
5
5
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -409,10 +409,43 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
409
409
  EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
410
410
  EventCategory["EnrichmentSceneStateChanged"] = "enrichment.scene.state-changed";
411
411
  EventCategory["EnrichmentActivitySummary"] = "enrichment.activity.summary";
412
+ /**
413
+ * Unified track-lifecycle event: ONE category carrying `phase:
414
+ * 'start' | 'update' | 'end'` with a rich, typed
415
+ * `PipelineAnalyticsTrackLifecyclePayload`. Supersedes the thin
416
+ * `PipelineAnalyticsTrackStarted` / `PipelineAnalyticsTrackEnded`
417
+ * pair — a consumer subscribes once and branches on `phase`.
418
+ */
419
+ EventCategory["PipelineAnalyticsTrackLifecycle"] = "pipeline-analytics.track-lifecycle";
420
+ /**
421
+ * @deprecated Superseded by {@link PipelineAnalyticsTrackLifecycle}
422
+ * (`phase:'start'`). Kept as a soft alias — no known subscribers.
423
+ */
412
424
  EventCategory["PipelineAnalyticsTrackStarted"] = "pipeline-analytics.track-started";
425
+ /**
426
+ * @deprecated Superseded by {@link PipelineAnalyticsTrackLifecycle}
427
+ * (`phase:'end'`). Kept as a soft alias — no known subscribers.
428
+ */
413
429
  EventCategory["PipelineAnalyticsTrackEnded"] = "pipeline-analytics.track-ended";
414
430
  EventCategory["PipelineAnalyticsDetectionEvent"] = "pipeline-analytics.detection-event";
415
431
  EventCategory["PipelineAnalyticsFrameTracked"] = "pipeline-analytics.frame-tracked";
432
+ /**
433
+ * Fired by `addon-post-analysis` whenever a gallery face row changes:
434
+ * `kind:'buffered'` a new detected face was persisted, `'assigned'` /
435
+ * `'unassigned'` its identity link changed, `'deleted'` the row was
436
+ * removed. Telemetry semantics (D8): a lost event only delays a refresh,
437
+ * never a correctness issue. Payload `PipelineAnalyticsFaceGalleryChangedPayload`.
438
+ */
439
+ EventCategory["PipelineAnalyticsFaceGalleryChanged"] = "pipeline-analytics.face-gallery-changed";
440
+ /**
441
+ * Fired by `addon-post-analysis` whenever a gallery plate row changes:
442
+ * `kind:'buffered'` a new read was persisted (`PlateRecognizer.onTrackEnd`),
443
+ * `'assigned'` / `'unassigned'` its vehicle link changed
444
+ * (`PlateGalleryProvider`), `'deleted'` the row was removed. Telemetry
445
+ * semantics (D8): a lost event only delays a refresh, never a correctness
446
+ * issue. Payload `PipelineAnalyticsPlateGalleryChangedPayload`.
447
+ */
448
+ EventCategory["PipelineAnalyticsPlateGalleryChanged"] = "pipeline-analytics.plate-gallery-changed";
416
449
  EventCategory["FrigateLiveEvent"] = "frigate.live-event";
417
450
  EventCategory["CameraStreamsProfileSlotsChanged"] = "camera-streams.onProfileSlotsChanged";
418
451
  /**
@@ -2860,7 +2893,8 @@ var MODEL_FORMATS = [
2860
2893
  "coreml",
2861
2894
  "openvino",
2862
2895
  "tflite",
2863
- "pt"
2896
+ "pt",
2897
+ "gguf"
2864
2898
  ];
2865
2899
  /**
2866
2900
  * Multi-file format payload.
@@ -2904,7 +2938,8 @@ var ModelFormatsSchema = z.object({
2904
2938
  coreml: ModelFormatEntrySchema.optional(),
2905
2939
  openvino: ModelFormatEntrySchema.optional(),
2906
2940
  tflite: ModelFormatEntrySchema.optional(),
2907
- pt: ModelFormatEntrySchema.optional()
2941
+ pt: ModelFormatEntrySchema.optional(),
2942
+ gguf: ModelFormatEntrySchema.optional()
2908
2943
  });
2909
2944
  /**
2910
2945
  * Variant-selector grouping axes. Shared by the full `ModelCatalogEntry` and by
@@ -7849,7 +7884,8 @@ var ModelFormatSchema$1 = z.enum([
7849
7884
  "coreml",
7850
7885
  "openvino",
7851
7886
  "tflite",
7852
- "pt"
7887
+ "pt",
7888
+ "gguf"
7853
7889
  ]);
7854
7890
  var PipelineSlotSchema = z.enum([
7855
7891
  "detector",
@@ -9860,6 +9896,167 @@ var ptzAutotrackCapability = {
9860
9896
  runtimeState: PtzAutotrackRuntimeStateSchema
9861
9897
  };
9862
9898
  /**
9899
+ * scene-monitor — device-scoped reference-region state cap. An operator marks
9900
+ * a rect ROI on a camera frame and names one or more states; the engine
9901
+ * (pipeline-analytics, designated post-processing node) reports which state is
9902
+ * active on an ongoing basis. Two operator-selectable check modes share every-
9903
+ * thing except the comparator: `similarity` (CLIP cosine at the same ROI coords
9904
+ * vs condition-tagged references) and `llm` (vision-LLM judgment over the crop).
9905
+ *
9906
+ * D14 device-config archetype (`deviceConfig.ui.kind:'widget'`) — the framework
9907
+ * derives the device-detail contribution; the provider carries NO hand-written
9908
+ * settings-contribution methods. `status.kind:'push'` — the engine pushes on
9909
+ * every hysteresis flip / availability change; consumers never poll.
9910
+ */
9911
+ /** Extensible condition tag. Seeded 'day' | 'night'; open by design so more can
9912
+ * be added without a wire break (matching falls back to any-condition refs). */
9913
+ var SceneConditionSchema = z.string();
9914
+ /** One captured reference — condition-tagged, model-version-gated. `embedding`
9915
+ * is `number[]` (Float32Array does NOT survive MsgPack/UDS). */
9916
+ var SceneReferenceSchema = z.object({
9917
+ embedding: z.array(z.number()),
9918
+ modelId: z.string(),
9919
+ condition: SceneConditionSchema,
9920
+ capturedAt: z.number(),
9921
+ thumbnailMediaId: z.string().optional()
9922
+ });
9923
+ var SceneMonitorStateSchema = z.object({
9924
+ id: z.string(),
9925
+ label: z.string(),
9926
+ references: z.array(SceneReferenceSchema),
9927
+ textPrompts: z.array(z.string()).optional(),
9928
+ referenceCount: z.number(),
9929
+ currentlyMatched: z.boolean()
9930
+ });
9931
+ /** Per-mode comparator params in a discriminated union so an `llm` scene never
9932
+ * carries similarity knobs and vice-versa. */
9933
+ var SceneCheckSchema = z.discriminatedUnion("mode", [z.object({
9934
+ mode: z.literal("similarity"),
9935
+ threshold: z.number().min(0).max(1),
9936
+ hysteresisCount: z.number().int().positive()
9937
+ }), z.object({
9938
+ mode: z.literal("llm"),
9939
+ prompt: z.string(),
9940
+ profileId: z.string().optional(),
9941
+ hysteresisCount: z.number().int().positive()
9942
+ })]);
9943
+ var SceneMonitorSchema = z.object({
9944
+ id: z.string(),
9945
+ label: z.string(),
9946
+ roi: MaskRectShapeSchema,
9947
+ enabled: z.boolean(),
9948
+ triggerMode: z.enum([
9949
+ "periodic",
9950
+ "on-motion",
9951
+ "both"
9952
+ ]),
9953
+ checkIntervalSec: z.number().optional(),
9954
+ check: SceneCheckSchema,
9955
+ states: z.array(SceneMonitorStateSchema),
9956
+ currentStateId: z.string().nullable(),
9957
+ lastCheckedAt: z.number().nullable(),
9958
+ lastConfidence: z.number().nullable(),
9959
+ currentCondition: SceneConditionSchema.nullable(),
9960
+ availability: z.enum(["ok", "unavailable"]),
9961
+ unavailableReason: z.string().nullable()
9962
+ });
9963
+ var SceneMonitorStatusSchema = z.object({
9964
+ monitors: z.array(SceneMonitorSchema),
9965
+ lastFetchedAt: z.number()
9966
+ });
9967
+ var sceneMonitorCapability = {
9968
+ name: "scene-monitor",
9969
+ scope: "device",
9970
+ mode: "singleton",
9971
+ kind: "wrapper",
9972
+ defaultActive: true,
9973
+ deviceTypes: [DeviceType.Camera],
9974
+ deviceConfig: { ui: {
9975
+ kind: "widget",
9976
+ widgetId: "host/scene-monitor-editor",
9977
+ tab: "scenes",
9978
+ label: "Scenes"
9979
+ } },
9980
+ methods: {
9981
+ listScenes: method(z.object({ deviceId: z.number() }), SceneMonitorStatusSchema),
9982
+ createScene: method(z.object({
9983
+ deviceId: z.number(),
9984
+ label: z.string(),
9985
+ roi: MaskRectShapeSchema,
9986
+ check: SceneCheckSchema,
9987
+ triggerMode: z.enum([
9988
+ "periodic",
9989
+ "on-motion",
9990
+ "both"
9991
+ ]).optional(),
9992
+ checkIntervalSec: z.number().optional()
9993
+ }), SceneMonitorSchema, {
9994
+ kind: "mutation",
9995
+ auth: "admin"
9996
+ }),
9997
+ updateScene: method(z.object({
9998
+ deviceId: z.number(),
9999
+ monitorId: z.string(),
10000
+ patch: z.object({
10001
+ label: z.string().optional(),
10002
+ roi: MaskRectShapeSchema.optional(),
10003
+ enabled: z.boolean().optional(),
10004
+ triggerMode: z.enum([
10005
+ "periodic",
10006
+ "on-motion",
10007
+ "both"
10008
+ ]).optional(),
10009
+ checkIntervalSec: z.number().optional(),
10010
+ check: SceneCheckSchema.optional()
10011
+ })
10012
+ }), z.void(), {
10013
+ kind: "mutation",
10014
+ auth: "admin"
10015
+ }),
10016
+ deleteScene: method(z.object({
10017
+ deviceId: z.number(),
10018
+ monitorId: z.string()
10019
+ }), z.void(), {
10020
+ kind: "mutation",
10021
+ auth: "admin"
10022
+ }),
10023
+ captureReference: method(z.object({
10024
+ deviceId: z.number(),
10025
+ monitorId: z.string(),
10026
+ stateId: z.string().optional(),
10027
+ label: z.string().optional(),
10028
+ condition: SceneConditionSchema.optional()
10029
+ }), z.object({
10030
+ stateId: z.string(),
10031
+ referenceCount: z.number()
10032
+ }), {
10033
+ kind: "mutation",
10034
+ auth: "admin"
10035
+ }),
10036
+ deleteReference: method(z.object({
10037
+ deviceId: z.number(),
10038
+ monitorId: z.string(),
10039
+ stateId: z.string(),
10040
+ index: z.number()
10041
+ }), z.void(), {
10042
+ kind: "mutation",
10043
+ auth: "admin"
10044
+ }),
10045
+ recheckNow: method(z.object({
10046
+ deviceId: z.number(),
10047
+ monitorId: z.string()
10048
+ }), z.void(), {
10049
+ kind: "mutation",
10050
+ auth: "admin"
10051
+ })
10052
+ },
10053
+ status: {
10054
+ schema: SceneMonitorStatusSchema,
10055
+ kind: "push"
10056
+ },
10057
+ runtimeState: SceneMonitorStatusSchema
10058
+ };
10059
+ /**
9863
10060
  * Script-runner cap. Models HA `script.*` entities on
9864
10061
  * `DeviceType.Script`. A Script is a pre-recorded action sequence
9865
10062
  * that can be invoked imperatively — optionally with a variables
@@ -11560,7 +11757,12 @@ var NotificationRuleConditionsSchema = z.object({
11560
11757
  clipDescription: z.object({
11561
11758
  text: z.string().min(1),
11562
11759
  minSimilarity: z.number().min(0).max(1)
11563
- }).optional()
11760
+ }).optional(),
11761
+ /** Match events whose recognized-entity label (face identity name or plate
11762
+ * vehicle name, propagated onto `event.data.label`) is one of these values.
11763
+ * Empty/absent → unaffected (back-compat). Enables "notify me when <named
11764
+ * vehicle/person> is seen". */
11765
+ labels: z.array(z.string()).readonly().optional()
11564
11766
  });
11565
11767
  var NotificationRuleTemplateSchema = z.object({
11566
11768
  title: z.string(),
@@ -11944,11 +12146,19 @@ var authProviderCapability = {
11944
12146
  * login page needs NO change.
11945
12147
  *
11946
12148
  * - `widget` — a Module-Federation widget the login page mounts (via
11947
- * `loadRemoteBundle`) for an in-page ceremony. Covers the passkey
11948
- * login ceremony, which must run `@simplewebauthn/browser` INSIDE the
11949
- * addon bundle. The referenced widget also declares `preAuth: true` in
11950
- * its `addon-widgets-source` catalog entry. `auth.listLoginMethods`
11951
- * stamps a public `bundleUrl` from `addonId` + `bundle`.
12149
+ * `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
12150
+ * stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
12151
+ * mechanism kept for future use; no shipped addon uses it on the login
12152
+ * page (the passkey ceremony below runs natively in the shell instead).
12153
+ *
12154
+ * - `passkey` — a declarative WebAuthn ceremony the shell renders
12155
+ * natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
12156
+ * a remotely-loaded bundle). Carries the addon's effective `rpId` /
12157
+ * `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
12158
+ * can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
12159
+ * fetching any remote code pre-auth. Contribution stays unconditional —
12160
+ * enrollment state is never leaked pre-auth; visibility is a shell
12161
+ * decision.
11952
12162
  *
11953
12163
  * Every contribution carries a `stage`:
11954
12164
  * - `primary` — shown on the first credentials screen (OIDC /
@@ -11997,8 +12207,30 @@ var WidgetLoginMethodSchema = z.object({
11997
12207
  remote: WidgetRemoteSchema,
11998
12208
  stage: LoginStageEnum
11999
12209
  });
12000
- /** One login-method contribution — redirect button OR pre-auth widget. */
12001
- var LoginMethodContributionSchema = z.discriminatedUnion("kind", [RedirectLoginMethodSchema, WidgetLoginMethodSchema]);
12210
+ /**
12211
+ * A declarative WebAuthn ceremony the shell renders natively (no remote
12212
+ * code). Carries the addon's EFFECTIVE `rpId`/`origin` so the shell can
12213
+ * gate visibility (IP-literal origin, hostname/rpId mismatch) before ever
12214
+ * showing the button — the contribution itself stays unconditional.
12215
+ */
12216
+ var PasskeyLoginMethodSchema = z.object({
12217
+ kind: z.literal("passkey"),
12218
+ /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
12219
+ id: z.string(),
12220
+ /** Operator-facing button label. */
12221
+ label: z.string(),
12222
+ stage: LoginStageEnum,
12223
+ /** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
12224
+ rpId: z.string(),
12225
+ /** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
12226
+ origin: z.string().nullable()
12227
+ });
12228
+ /** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
12229
+ var LoginMethodContributionSchema = z.discriminatedUnion("kind", [
12230
+ RedirectLoginMethodSchema,
12231
+ WidgetLoginMethodSchema,
12232
+ PasskeyLoginMethodSchema
12233
+ ]);
12002
12234
  var loginMethodCapability = {
12003
12235
  name: "login-method",
12004
12236
  scope: "system",
@@ -12514,18 +12746,6 @@ var cameraPipelineConfigCapability = {
12514
12746
  exposesDeviceSettings: true,
12515
12747
  methods: {}
12516
12748
  };
12517
- /**
12518
- * Shared cap-router predicates — the SINGLE source for the structural Zod-shape
12519
- * checks + naming used by BOTH the runtime cap-router builder
12520
- * (`@camstack/system` `cap-router-builder.ts` + the server's
12521
- * `cap-router-runtime.ts`) AND the codegen scripts (`scripts/generate-cap-*.ts`).
12522
- *
12523
- * These used to be independently reimplemented on each side, held in sync only
12524
- * by "must stay byte-identical" comments — a live drift risk. Consolidating them
12525
- * here (next to `resolveCapMount` / `expandCapMethods`, the other shared model)
12526
- * makes the two paths provably agree. Each predicate accepts both Zod 4
12527
- * (`_def.type`) and legacy Zod 3 (`_def.typeName` / `constructor.name`) shapes.
12528
- */
12529
12749
  /** `z.void()` — input carries no data. */
12530
12750
  function isVoidInput(schema) {
12531
12751
  const def = schema._def;
@@ -12553,6 +12773,26 @@ function isArrayOutputSchema(schema) {
12553
12773
  return false;
12554
12774
  }
12555
12775
  /**
12776
+ * True when `method` on cap `def` is a COLLECTION cap's array-returning
12777
+ * (non-subscription) method — the methods whose contract is "union the result
12778
+ * across every registered provider" (`listTargets`, `listTargetKinds`,
12779
+ * `discoverTargets`, `listEndpoints`, …).
12780
+ *
12781
+ * Such a method is aggregated at the hub via `concatCollection` / the runtime
12782
+ * `concatArrayMethod`, both of which SKIP a provider that doesn't implement it
12783
+ * (contributes `[]`). That local skip is invisible across the UDS boundary — a
12784
+ * hub-side per-provider proxy fabricates a callable for every property, so the
12785
+ * call reaches the child's real (possibly partial) provider. This predicate lets
12786
+ * the child-side dispatcher reproduce the same graceful skip: a missing method
12787
+ * here yields `[]`, not a "method not found" error. Singleton caps and non-array
12788
+ * methods return `false` so a genuinely missing method still surfaces as a bug.
12789
+ */
12790
+ function isCollectionArrayMethod(def, method) {
12791
+ if (def === void 0 || def.mode !== "collection") return false;
12792
+ const m = expandCapMethods(def)[method];
12793
+ return m !== void 0 && m.kind !== "subscription" && isArrayOutputSchema(m.output);
12794
+ }
12795
+ /**
12556
12796
  * Apply `.loose()` to an object input schema when available (Zod 4) so the
12557
12797
  * router accepts the out-of-band `nodeId`/`addonId` selector keys without
12558
12798
  * stripping them. Falls back to the schema unchanged when `.loose()` is absent.
@@ -14671,14 +14911,14 @@ var TargetKindCapsSchema = z.object({
14671
14911
  * the union is large and not meant for runtime validation here; the exported
14672
14912
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14673
14913
  */
14674
- var ConfigSchemaPassthrough = z.unknown();
14914
+ var ConfigSchemaPassthrough$1 = z.unknown();
14675
14915
  var TargetKindSchema = z.object({
14676
14916
  kind: z.string(),
14677
14917
  label: z.string(),
14678
14918
  icon: z.string(),
14679
14919
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
14680
14920
  addonId: z.string(),
14681
- configSchema: ConfigSchemaPassthrough,
14921
+ configSchema: ConfigSchemaPassthrough$1,
14682
14922
  supportsDiscovery: z.boolean(),
14683
14923
  caps: TargetKindCapsSchema
14684
14924
  });
@@ -14745,6 +14985,345 @@ var notificationOutputCapability = {
14745
14985
  }
14746
14986
  };
14747
14987
  /**
14988
+ * Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
14989
+ * surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
14990
+ * caps stay wire-compatible without a circular cap→cap import.
14991
+ *
14992
+ * Errors are a discriminated-union RESULT, never thrown: the shape survives
14993
+ * every transport tier structurally, and failed calls still write usage rows.
14994
+ * Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
14995
+ */
14996
+ var LlmUsageSchema = z.object({
14997
+ inputTokens: z.number(),
14998
+ outputTokens: z.number()
14999
+ });
15000
+ var LlmErrorCodeSchema = z.enum([
15001
+ "timeout",
15002
+ "rate-limited",
15003
+ "auth",
15004
+ "refusal",
15005
+ "bad-request",
15006
+ "unavailable",
15007
+ "no-profile",
15008
+ "budget-exceeded",
15009
+ "adapter-error"
15010
+ ]);
15011
+ var LlmGenerateOkSchema = z.object({
15012
+ ok: z.literal(true),
15013
+ text: z.string(),
15014
+ model: z.string(),
15015
+ usage: LlmUsageSchema,
15016
+ truncated: z.boolean(),
15017
+ latencyMs: z.number()
15018
+ });
15019
+ var LlmGenerateErrSchema = z.object({
15020
+ ok: z.literal(false),
15021
+ code: LlmErrorCodeSchema,
15022
+ message: z.string(),
15023
+ retryAfterMs: z.number().optional()
15024
+ });
15025
+ var LlmGenerateResultSchema = z.discriminatedUnion("ok", [LlmGenerateOkSchema, LlmGenerateErrSchema]);
15026
+ /**
15027
+ * `Uint8Array` is the sanctioned binary convention — superjson + the UDS
15028
+ * MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
15029
+ * notification-output.cap.ts:27-31 precedents).
15030
+ */
15031
+ var LlmImageSchema = z.object({
15032
+ bytes: z.instanceof(Uint8Array),
15033
+ mimeType: z.string()
15034
+ });
15035
+ var LlmGenerateBaseInputSchema = z.object({
15036
+ /** Collection routing (the notification-output posture). */
15037
+ addonId: z.string().optional(),
15038
+ /** Explicit profile; else the resolution chain (spec §3). */
15039
+ profileId: z.string().optional(),
15040
+ /** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
15041
+ consumer: z.string(),
15042
+ system: z.string().optional(),
15043
+ /** v1: single-turn. `messages[]` is a v2 additive field. */
15044
+ prompt: z.string(),
15045
+ /** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
15046
+ jsonSchema: z.record(z.string(), z.unknown()).optional(),
15047
+ /** Per-call override of the profile default. */
15048
+ maxTokens: z.number().int().positive().optional(),
15049
+ temperature: z.number().optional()
15050
+ });
15051
+ /**
15052
+ * `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
15053
+ * on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
15054
+ * a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
15055
+ * cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
15056
+ * this only through the `llm` cap's methods.
15057
+ *
15058
+ * One running llama-server child per node in v1 (models are RAM-heavy).
15059
+ * Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
15060
+ * watchdog — operator decision #3).
15061
+ */
15062
+ var ManagedModelRefSchema = z.discriminatedUnion("kind", [
15063
+ z.object({
15064
+ kind: z.literal("catalog"),
15065
+ catalogId: z.string()
15066
+ }),
15067
+ z.object({
15068
+ kind: z.literal("url"),
15069
+ url: z.string(),
15070
+ sha256: z.string().optional()
15071
+ }),
15072
+ z.object({
15073
+ kind: z.literal("path"),
15074
+ path: z.string()
15075
+ })
15076
+ ]);
15077
+ var ManagedRuntimeConfigSchema = z.object({
15078
+ /** WHERE the runtime lives — hub or any agent. */
15079
+ nodeId: z.string(),
15080
+ /** Closed for v1; 'ollama' is a v2 candidate. */
15081
+ engine: z.enum(["llama-cpp"]),
15082
+ model: ManagedModelRefSchema,
15083
+ contextSize: z.number().int().default(4096),
15084
+ /** 0 = CPU-only. */
15085
+ gpuLayers: z.number().int().default(0),
15086
+ /** Default: cpus-2, clamped ≥1 (resolved node-side). */
15087
+ threads: z.number().int().optional(),
15088
+ /** Concurrent slots. */
15089
+ parallel: z.number().int().default(1),
15090
+ /** Else lazy: first generate boots it. */
15091
+ autoStart: z.boolean().default(false),
15092
+ /** 0 = never; frees RAM after quiet periods. */
15093
+ idleStopMinutes: z.number().int().default(30)
15094
+ });
15095
+ var LlmRuntimeStatusSchema = z.object({
15096
+ /** Status is ALWAYS node-qualified. */
15097
+ nodeId: z.string(),
15098
+ state: z.enum([
15099
+ "stopped",
15100
+ "downloading",
15101
+ "starting",
15102
+ "ready",
15103
+ "crashed",
15104
+ "failed"
15105
+ ]),
15106
+ pid: z.number().optional(),
15107
+ port: z.number().optional(),
15108
+ modelPath: z.string().optional(),
15109
+ modelId: z.string().optional(),
15110
+ downloadProgress: z.number().min(0).max(1).optional(),
15111
+ lastError: z.string().optional(),
15112
+ crashesInWindow: z.number(),
15113
+ /** Child RSS (sampled best-effort). */
15114
+ memoryBytes: z.number().optional(),
15115
+ vramBytes: z.number().optional()
15116
+ });
15117
+ var LlmNodeModelSchema = z.object({
15118
+ file: z.string(),
15119
+ sizeBytes: z.number(),
15120
+ catalogId: z.string().optional(),
15121
+ installedAt: z.number().optional()
15122
+ });
15123
+ var LlmRuntimeDiskUsageSchema = z.object({
15124
+ nodeId: z.string(),
15125
+ modelsBytes: z.number(),
15126
+ freeBytes: z.number().optional()
15127
+ });
15128
+ var llmRuntimeCapability = {
15129
+ name: "llm-runtime",
15130
+ scope: "system",
15131
+ mode: "singleton",
15132
+ internal: true,
15133
+ methods: {
15134
+ complete: method(LlmGenerateBaseInputSchema.extend({
15135
+ images: z.array(LlmImageSchema).optional(),
15136
+ runtime: ManagedRuntimeConfigSchema,
15137
+ /** The managed profile's timeout, threaded by the hub provider. */
15138
+ timeoutMs: z.number().int().positive().optional()
15139
+ }), LlmGenerateResultSchema, { kind: "mutation" }),
15140
+ ensureStarted: method(z.object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
15141
+ kind: "mutation",
15142
+ auth: "admin"
15143
+ }),
15144
+ stop: method(z.object({}), z.void(), {
15145
+ kind: "mutation",
15146
+ auth: "admin"
15147
+ }),
15148
+ status: method(z.object({}), LlmRuntimeStatusSchema),
15149
+ installModel: method(z.object({ model: ManagedModelRefSchema }), z.void(), {
15150
+ kind: "mutation",
15151
+ auth: "admin"
15152
+ }),
15153
+ deleteModel: method(z.object({ file: z.string() }), z.void(), {
15154
+ kind: "mutation",
15155
+ auth: "admin"
15156
+ }),
15157
+ listLocalModels: method(z.object({}), z.array(LlmNodeModelSchema)),
15158
+ getDiskUsage: method(z.object({}), LlmRuntimeDiskUsageSchema)
15159
+ }
15160
+ };
15161
+ /**
15162
+ * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
15163
+ * methods concat-fan across providers; single-row methods route to ONE
15164
+ * provider by the `addonId` in the call input (the notification-output
15165
+ * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
15166
+ * (hub-placed); the cap stays open for future providers.
15167
+ *
15168
+ * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
15169
+ * `apiKey` is a password field — providers REDACT it on read and merge on
15170
+ * write; a stored key NEVER round-trips to a client.
15171
+ */
15172
+ var LlmProfileKindSchema = z.enum([
15173
+ "openai-compatible",
15174
+ "openai",
15175
+ "anthropic",
15176
+ "google",
15177
+ "managed-local"
15178
+ ]);
15179
+ var LlmProfileSchema = z.object({
15180
+ id: z.string(),
15181
+ name: z.string(),
15182
+ kind: LlmProfileKindSchema,
15183
+ /** Stamped by the provider — keeps the fanned catalog routable. */
15184
+ addonId: z.string(),
15185
+ enabled: z.boolean(),
15186
+ /** Vendor model id, or the managed runtime's loaded model. */
15187
+ model: z.string(),
15188
+ /** Required for openai-compatible; override for cloud kinds. */
15189
+ baseUrl: z.string().optional(),
15190
+ /** ConfigUISchema type:'password' — never round-trips (spec §5). */
15191
+ apiKey: z.string().optional(),
15192
+ supportsVision: z.boolean(),
15193
+ temperature: z.number().min(0).max(2).optional(),
15194
+ maxTokens: z.number().int().positive().optional(),
15195
+ timeoutMs: z.number().int().positive().default(6e4),
15196
+ extraHeaders: z.record(z.string(), z.string()).optional(),
15197
+ /** kind === 'managed-local' only (spec §4). */
15198
+ runtime: ManagedRuntimeConfigSchema.optional()
15199
+ });
15200
+ /** ConfigUISchema tree passed through untyped on the wire (the
15201
+ * notification-output `ConfigSchemaPassthrough` precedent at
15202
+ * notification-output.cap.ts:151); the exported TS type re-tightens it. */
15203
+ var ConfigSchemaPassthrough = z.unknown();
15204
+ var LlmProfileKindDescriptorSchema = z.object({
15205
+ kind: LlmProfileKindSchema,
15206
+ label: z.string(),
15207
+ icon: z.string(),
15208
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
15209
+ addonId: z.string(),
15210
+ configSchema: ConfigSchemaPassthrough
15211
+ });
15212
+ var LlmDefaultSelectorSchema = z.union([z.object({ consumer: z.string() }), z.object({ purpose: z.enum(["text", "vision"]) })]);
15213
+ var LlmDefaultSchema = z.object({
15214
+ selector: LlmDefaultSelectorSchema,
15215
+ profileId: z.string()
15216
+ });
15217
+ /** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
15218
+ var LlmUsageRollupSchema = z.object({
15219
+ day: z.string(),
15220
+ consumer: z.string(),
15221
+ profileId: z.string(),
15222
+ calls: z.number(),
15223
+ okCalls: z.number(),
15224
+ errorCalls: z.number(),
15225
+ inputTokens: z.number(),
15226
+ outputTokens: z.number(),
15227
+ avgLatencyMs: z.number()
15228
+ });
15229
+ /** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
15230
+ var ManagedModelCatalogEntrySchema = z.object({
15231
+ id: z.string(),
15232
+ label: z.string(),
15233
+ family: z.string(),
15234
+ purpose: z.enum(["text", "vision"]),
15235
+ url: z.string(),
15236
+ sha256: z.string(),
15237
+ sizeBytes: z.number(),
15238
+ quantization: z.string(),
15239
+ /** Load-time guidance shown in the picker. */
15240
+ minRamBytes: z.number(),
15241
+ contextSizeDefault: z.number().int(),
15242
+ /** Vision models: companion projector file. */
15243
+ mmprojUrl: z.string().optional()
15244
+ });
15245
+ var LlmRuntimeNodeSchema = z.object({
15246
+ nodeId: z.string(),
15247
+ reachable: z.boolean(),
15248
+ status: LlmRuntimeStatusSchema.optional(),
15249
+ disk: LlmRuntimeDiskUsageSchema.optional(),
15250
+ error: z.string().optional()
15251
+ });
15252
+ var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: z.array(LlmImageSchema).min(1) });
15253
+ var ProfileRefInputSchema = z.object({
15254
+ addonId: z.string(),
15255
+ profileId: z.string()
15256
+ });
15257
+ var llmCapability = {
15258
+ name: "llm",
15259
+ scope: "system",
15260
+ mode: "collection",
15261
+ internal: false,
15262
+ providerKind: "ai",
15263
+ /** `nodeId` inputs below are DATA (the hub provider pins itself), never routing. */
15264
+ nodeIdMode: "data",
15265
+ methods: {
15266
+ generate: method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
15267
+ generateVision: method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
15268
+ listProfileKinds: method(z.object({}), z.array(LlmProfileKindDescriptorSchema)),
15269
+ listProfiles: method(z.object({}), z.array(LlmProfileSchema)),
15270
+ upsertProfile: method(z.object({ profile: LlmProfileSchema }), LlmProfileSchema, {
15271
+ kind: "mutation",
15272
+ auth: "admin"
15273
+ }),
15274
+ deleteProfile: method(ProfileRefInputSchema, z.void(), {
15275
+ kind: "mutation",
15276
+ auth: "admin"
15277
+ }),
15278
+ testProfile: method(ProfileRefInputSchema, LlmGenerateResultSchema, {
15279
+ kind: "mutation",
15280
+ auth: "admin"
15281
+ }),
15282
+ /** Live vendor enumeration (GET /models etc.). */
15283
+ listModels: method(ProfileRefInputSchema, z.array(z.string())),
15284
+ getDefaults: method(z.object({}), z.array(LlmDefaultSchema)),
15285
+ setDefault: method(z.object({
15286
+ selector: LlmDefaultSelectorSchema,
15287
+ profileId: z.string().nullable()
15288
+ }), z.void(), {
15289
+ kind: "mutation",
15290
+ auth: "admin"
15291
+ }),
15292
+ getUsage: method(z.object({
15293
+ since: z.number().optional(),
15294
+ until: z.number().optional(),
15295
+ consumer: z.string().optional(),
15296
+ profileId: z.string().optional()
15297
+ }), z.array(LlmUsageRollupSchema)),
15298
+ listModelCatalog: method(z.object({}), z.array(ManagedModelCatalogEntrySchema)),
15299
+ listRuntimeNodes: method(z.object({}), z.array(LlmRuntimeNodeSchema)),
15300
+ listNodeModels: method(z.object({ nodeId: z.string() }), z.array(LlmNodeModelSchema)),
15301
+ installModel: method(z.object({
15302
+ nodeId: z.string(),
15303
+ model: ManagedModelRefSchema
15304
+ }), z.void(), {
15305
+ kind: "mutation",
15306
+ auth: "admin"
15307
+ }),
15308
+ deleteModel: method(z.object({
15309
+ nodeId: z.string(),
15310
+ file: z.string()
15311
+ }), z.void(), {
15312
+ kind: "mutation",
15313
+ auth: "admin"
15314
+ }),
15315
+ getRuntimeStatus: method(ProfileRefInputSchema, LlmRuntimeStatusSchema),
15316
+ startRuntime: method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
15317
+ kind: "mutation",
15318
+ auth: "admin"
15319
+ }),
15320
+ stopRuntime: method(ProfileRefInputSchema, z.void(), {
15321
+ kind: "mutation",
15322
+ auth: "admin"
15323
+ })
15324
+ }
15325
+ };
15326
+ /**
14748
15327
  * Zod schemas for persisted record types.
14749
15328
  *
14750
15329
  * These schemas serve as the single source of truth for types that are
@@ -14966,6 +15545,10 @@ var TrackSchema = z.object({
14966
15545
  snapshots: z.array(TrackSnapshotSchema).readonly(),
14967
15546
  /** Deduplicated zones the track has entered at least once. */
14968
15547
  zonesVisited: z.array(z.string()).readonly(),
15548
+ /** Deduplicated set of detector classes observed for this track over its
15549
+ * life (a track may be reclassified, e.g. person→vehicle). Absent on
15550
+ * legacy rows written before class accumulation shipped. */
15551
+ classes: z.array(z.string()).readonly().optional(),
14969
15552
  /** Cumulative normalized distance travelled (0..1 units = full frame width). */
14970
15553
  totalDistance: z.number(),
14971
15554
  state: TrackStateSchema,
@@ -15127,7 +15710,7 @@ var KeyEventSchema = z.object({
15127
15710
  /** Track lifetime in ms (lastSeen - firstSeen). */
15128
15711
  windowMs: z.number().optional()
15129
15712
  });
15130
- var TrackedDetectionSchema = z.object({
15713
+ z.object({
15131
15714
  trackId: z.string(),
15132
15715
  className: z.string(),
15133
15716
  confidence: z.number(),
@@ -15135,6 +15718,23 @@ var TrackedDetectionSchema = z.object({
15135
15718
  zones: z.array(z.string()).readonly(),
15136
15719
  state: TrackStateSchema
15137
15720
  });
15721
+ var OverlayDetectionSchema = z.looseObject({
15722
+ id: z.string(),
15723
+ kind: z.enum(["first-level", "detail"]),
15724
+ macroClass: z.string(),
15725
+ score: z.number(),
15726
+ bbox: z.object({
15727
+ x: z.number(),
15728
+ y: z.number(),
15729
+ width: z.number(),
15730
+ height: z.number()
15731
+ }),
15732
+ labels: z.array(z.looseObject({
15733
+ label: z.string(),
15734
+ score: z.number()
15735
+ })).readonly(),
15736
+ parentId: z.string().optional()
15737
+ });
15138
15738
  var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: z.number() });
15139
15739
  var SearchObjectEventsInput = z.object({
15140
15740
  text: z.string(),
@@ -15145,6 +15745,20 @@ var SearchObjectEventsInput = z.object({
15145
15745
  limit: z.number().default(50),
15146
15746
  minScore: z.number().min(0).max(1).default(.2)
15147
15747
  });
15748
+ var TrackCascadeCountsSchema = z.object({
15749
+ /** Persisted track roots deleted (authoritative). */
15750
+ tracks: z.number().int(),
15751
+ /** Object events removed with their tracks (best-effort; see note above). */
15752
+ events: z.number().int(),
15753
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
15754
+ media: z.number().int(),
15755
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
15756
+ faces: z.number().int(),
15757
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
15758
+ plates: z.number().int(),
15759
+ /** Per-track CLIP search vectors removed (best-effort). */
15760
+ embeddings: z.number().int()
15761
+ });
15148
15762
  var pipelineAnalyticsCapability = {
15149
15763
  name: "pipeline-analytics",
15150
15764
  scope: "device",
@@ -15198,12 +15812,14 @@ var pipelineAnalyticsCapability = {
15198
15812
  audio: z.number().int()
15199
15813
  })).readonly()),
15200
15814
  /**
15201
- * Delete all events (motion + object + audio) for the given device
15202
- * that are older than `cutoffMs` (exclusive), and delete their
15203
- * thumbnails in lockstep. Returns per-kind deleted counts.
15204
- *
15205
- * Called by Phase B3 recorder orchestration to keep event history
15206
- * aligned with available footage.
15815
+ * @deprecated Prefer `pruneTracksBefore` the track is the ROOT of the
15816
+ * analytics model and retention must cascade from it (design §5.1). This
15817
+ * event-only prune leaves orphaned tracks/faces/plates/embeddings behind.
15818
+ * Retained as a compat shim for the Phase-B3 recorder orchestration caller,
15819
+ * which prunes events to keep history aligned with available footage and
15820
+ * reads the per-kind counts. Delete all events (motion + object + audio)
15821
+ * for the given device older than `cutoffMs` (exclusive) + their thumbnails
15822
+ * in lockstep; returns per-kind deleted counts.
15207
15823
  */
15208
15824
  pruneEventsBefore: method(z.object({
15209
15825
  deviceId: z.number(),
@@ -15216,6 +15832,55 @@ var pipelineAnalyticsCapability = {
15216
15832
  kind: "mutation",
15217
15833
  auth: "admin"
15218
15834
  }),
15835
+ /**
15836
+ * Track-centric retention entry point (design §5.1). Selects every
15837
+ * persisted track for the device whose `lastSeen < cutoffMs` (paged) and
15838
+ * runs the extensible whole-track deletion cascade (design §3): object
15839
+ * events + their media, track/face/plate-owned media, unassigned face
15840
+ * reads, per-track CLIP embeddings, then the track root LAST. ENROLLED
15841
+ * (assigned) faces/plates and `ownerKind:'identity'` media are exempt —
15842
+ * the durable matching gallery always persists. Fires the per-track
15843
+ * live-state cleanup so a pruned track can't linger in dispatch/overlay
15844
+ * state. Returns per-family deleted counts (`tracks` authoritative).
15845
+ *
15846
+ * Replaces `pruneEventsBefore` as the correct time-based retention prune.
15847
+ */
15848
+ pruneTracksBefore: method(z.object({
15849
+ deviceId: z.number(),
15850
+ cutoffMs: z.number()
15851
+ }), TrackCascadeCountsSchema, {
15852
+ kind: "mutation",
15853
+ auth: "admin"
15854
+ }),
15855
+ /**
15856
+ * Operator "clean slate" for a device (design §5.3): prune EVERY track for
15857
+ * the device via the same cascade as `pruneTracksBefore` with `cutoffMs =
15858
+ * now`. One call per device — no client-side track enumeration. Enrolled
15859
+ * gallery + identity media are exempt (design §4). Returns per-family
15860
+ * deleted counts.
15861
+ */
15862
+ wipeAllAnalytics: method(z.object({ deviceId: z.number() }), TrackCascadeCountsSchema, {
15863
+ kind: "mutation",
15864
+ auth: "admin"
15865
+ }),
15866
+ /**
15867
+ * Delete whole tracks (object events) by id for the given device,
15868
+ * cascading their media in lockstep. Returns the number of tracks
15869
+ * actually deleted plus the ids that could not be removed.
15870
+ *
15871
+ * Operator-driven from the DI Events page (batch delete). Routes through
15872
+ * the same widened track-deletion cascade (design §5.2).
15873
+ */
15874
+ deleteTracks: method(z.object({
15875
+ deviceId: z.number(),
15876
+ trackIds: z.array(z.string()).min(1)
15877
+ }), z.object({
15878
+ deleted: z.number().int(),
15879
+ failed: z.array(z.string()).readonly()
15880
+ }), {
15881
+ kind: "mutation",
15882
+ auth: "admin"
15883
+ }),
15219
15884
  getEventMedia: method(z.object({
15220
15885
  eventId: z.string(),
15221
15886
  kind: MediaFileKindEnum.optional()
@@ -15233,17 +15898,19 @@ var pipelineAnalyticsCapability = {
15233
15898
  },
15234
15899
  events: {
15235
15900
  /**
15236
- * Enriched frame emitted after refinement. Carries lightweight
15237
- * tracked-detection metadata (track id, class, zones, state) so
15238
- * downstream consumers (stream overlays, notifications) can
15239
- * annotate without querying full Track state.
15901
+ * Enriched frame emitted after refinement the live-overlay source of
15902
+ * truth (two-plane re-injection). Carries the frame's detections in the
15903
+ * `ObjectDetection` wire shape: first-level roots (with track info +
15904
+ * enrichment labels) plus synthesized `kind:'detail'` face/plate entries
15905
+ * re-projected from per-track detail state, so stream overlays render
15906
+ * boxes + recognized names without querying full Track state.
15240
15907
  */
15241
15908
  onFrameTracked: { data: z.object({
15242
15909
  deviceId: z.number(),
15243
15910
  timestamp: z.number(),
15244
15911
  frameWidth: z.number(),
15245
15912
  frameHeight: z.number(),
15246
- detections: z.array(TrackedDetectionSchema).readonly()
15913
+ detections: z.array(OverlayDetectionSchema).readonly()
15247
15914
  }) },
15248
15915
  /** Track entered active state (first-seen). */
15249
15916
  onTrackStarted: { data: z.object({
@@ -19239,6 +19906,24 @@ setOverlay: method(z.object({
19239
19906
  }
19240
19907
  }] }
19241
19908
  };
19909
+ var VehicleSchema = z.object({
19910
+ id: z.string(),
19911
+ name: z.string(),
19912
+ sampleCount: z.number().int().nonnegative(),
19913
+ coverMediaKey: z.string().optional(),
19914
+ /** Inline base64 of the cover sample's plate crop, resolved from `coverMediaKey`. */
19915
+ coverBase64: z.string().optional()
19916
+ });
19917
+ var VehicleSampleInfoSchema = z.object({
19918
+ id: z.string(),
19919
+ /** The plate text this sample enrolled (self-labeling — no embedding). */
19920
+ text: z.string(),
19921
+ /** OCR confidence of the enrolled read (0..1). */
19922
+ score: z.number(),
19923
+ addedAt: z.number().int(),
19924
+ deviceId: z.number().int().optional(),
19925
+ base64: z.string().optional()
19926
+ });
19242
19927
  var PlateInfoSchema = z.object({
19243
19928
  plateId: z.string(),
19244
19929
  deviceId: z.number().int(),
@@ -19250,6 +19935,16 @@ var PlateInfoSchema = z.object({
19250
19935
  score: z.number(),
19251
19936
  /** True when the text was manually corrected (exempt from retention). */
19252
19937
  corrected: z.boolean(),
19938
+ /** Recognized vehicle id when a matcher lookup named this read (SQL NULL → absent). */
19939
+ recognizedVehicleId: z.string().optional(),
19940
+ /** Resolved vehicle name for `recognizedVehicleId` (UI convenience). */
19941
+ vehicleName: z.string().optional(),
19942
+ /** True once the read was assigned to a vehicle (enrolled as a sample). */
19943
+ assigned: z.boolean(),
19944
+ /** keyFrame parity: the plate bbox (pixel space) on the native key frame. */
19945
+ plateBbox: BoundingBoxSchema.optional(),
19946
+ /** keyFrame parity: MediaStore key of the track's native-resolution key frame. */
19947
+ keyFrameMediaKey: z.string().optional(),
19253
19948
  base64: z.string().optional()
19254
19949
  });
19255
19950
  var MediaFileLiteSchema = z.object({
@@ -19311,6 +20006,58 @@ var plateGalleryCapability = {
19311
20006
  deletePlate: method(z.object({ plateId: z.string() }), z.void(), {
19312
20007
  kind: "mutation",
19313
20008
  auth: "admin"
20009
+ }),
20010
+ listVehicles: method(z.void(), z.array(VehicleSchema).readonly()),
20011
+ createVehicle: method(z.object({ name: z.string().min(1) }), VehicleSchema, {
20012
+ kind: "mutation",
20013
+ auth: "admin"
20014
+ }),
20015
+ renameVehicle: method(z.object({
20016
+ id: z.string(),
20017
+ name: z.string().min(1)
20018
+ }), z.void(), {
20019
+ kind: "mutation",
20020
+ auth: "admin"
20021
+ }),
20022
+ deleteVehicle: method(z.object({ id: z.string() }), z.void(), {
20023
+ kind: "mutation",
20024
+ auth: "admin"
20025
+ }),
20026
+ listVehicleSamples: method(z.object({ vehicleId: z.string() }), z.array(VehicleSampleInfoSchema).readonly()),
20027
+ removeVehicleSample: method(z.object({
20028
+ vehicleId: z.string(),
20029
+ sampleId: z.string()
20030
+ }), z.void(), {
20031
+ kind: "mutation",
20032
+ auth: "admin"
20033
+ }),
20034
+ assignPlate: method(z.object({
20035
+ plateId: z.string(),
20036
+ vehicleId: z.string()
20037
+ }), z.void(), {
20038
+ kind: "mutation",
20039
+ auth: "admin"
20040
+ }),
20041
+ unassignPlate: method(z.object({ plateId: z.string() }), z.void(), {
20042
+ kind: "mutation",
20043
+ auth: "admin"
20044
+ }),
20045
+ assignPlates: method(z.object({
20046
+ plateIds: z.array(z.string()).min(1),
20047
+ vehicleId: z.string()
20048
+ }), z.object({
20049
+ assigned: z.number().int(),
20050
+ failed: z.array(z.string()).readonly()
20051
+ }), {
20052
+ kind: "mutation",
20053
+ auth: "admin"
20054
+ }),
20055
+ unassignPlates: method(z.object({ plateIds: z.array(z.string()).min(1) }), z.object({
20056
+ unassigned: z.number().int(),
20057
+ failed: z.array(z.string()).readonly()
20058
+ }), {
20059
+ kind: "mutation",
20060
+ auth: "admin"
19314
20061
  })
19315
20062
  }
19316
20063
  };
@@ -20471,6 +21218,8 @@ var ALL_CAPABILITY_DEFINITIONS = [
20471
21218
  integrationsCapability,
20472
21219
  intercomCapability,
20473
21220
  lawnMowerControlCapability,
21221
+ llmCapability,
21222
+ llmRuntimeCapability,
20474
21223
  localNetworkCapability,
20475
21224
  lockControlCapability,
20476
21225
  logDestinationCapability,
@@ -20509,6 +21258,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
20509
21258
  ptzAutotrackCapability,
20510
21259
  rebootCapability,
20511
21260
  recordingCapability,
21261
+ sceneMonitorCapability,
20512
21262
  scriptRunnerCapability,
20513
21263
  serverManagementCapability,
20514
21264
  settingsStoreCapability,
@@ -20603,6 +21353,7 @@ var CAP_NAMES_WITH_STATUS = [
20603
21353
  "ptz",
20604
21354
  "ptz-autotrack",
20605
21355
  "recording",
21356
+ "scene-monitor",
20606
21357
  "script-runner",
20607
21358
  "smoke",
20608
21359
  "snapshot",
@@ -22526,6 +23277,168 @@ var METHOD_ACCESS_MAP = Object.freeze({
22526
23277
  addonId: null,
22527
23278
  access: "create"
22528
23279
  },
23280
+ "llm.deleteModel": {
23281
+ capName: "llm",
23282
+ capScope: "system",
23283
+ addonId: null,
23284
+ access: "delete"
23285
+ },
23286
+ "llm.deleteProfile": {
23287
+ capName: "llm",
23288
+ capScope: "system",
23289
+ addonId: null,
23290
+ access: "delete"
23291
+ },
23292
+ "llm.generate": {
23293
+ capName: "llm",
23294
+ capScope: "system",
23295
+ addonId: null,
23296
+ access: "create"
23297
+ },
23298
+ "llm.generateVision": {
23299
+ capName: "llm",
23300
+ capScope: "system",
23301
+ addonId: null,
23302
+ access: "create"
23303
+ },
23304
+ "llm.getDefaults": {
23305
+ capName: "llm",
23306
+ capScope: "system",
23307
+ addonId: null,
23308
+ access: "view"
23309
+ },
23310
+ "llm.getRuntimeStatus": {
23311
+ capName: "llm",
23312
+ capScope: "system",
23313
+ addonId: null,
23314
+ access: "view"
23315
+ },
23316
+ "llm.getUsage": {
23317
+ capName: "llm",
23318
+ capScope: "system",
23319
+ addonId: null,
23320
+ access: "view"
23321
+ },
23322
+ "llm.installModel": {
23323
+ capName: "llm",
23324
+ capScope: "system",
23325
+ addonId: null,
23326
+ access: "create"
23327
+ },
23328
+ "llm.listModelCatalog": {
23329
+ capName: "llm",
23330
+ capScope: "system",
23331
+ addonId: null,
23332
+ access: "view"
23333
+ },
23334
+ "llm.listModels": {
23335
+ capName: "llm",
23336
+ capScope: "system",
23337
+ addonId: null,
23338
+ access: "view"
23339
+ },
23340
+ "llm.listNodeModels": {
23341
+ capName: "llm",
23342
+ capScope: "system",
23343
+ addonId: null,
23344
+ access: "view"
23345
+ },
23346
+ "llm.listProfileKinds": {
23347
+ capName: "llm",
23348
+ capScope: "system",
23349
+ addonId: null,
23350
+ access: "view"
23351
+ },
23352
+ "llm.listProfiles": {
23353
+ capName: "llm",
23354
+ capScope: "system",
23355
+ addonId: null,
23356
+ access: "view"
23357
+ },
23358
+ "llm.listRuntimeNodes": {
23359
+ capName: "llm",
23360
+ capScope: "system",
23361
+ addonId: null,
23362
+ access: "view"
23363
+ },
23364
+ "llm.setDefault": {
23365
+ capName: "llm",
23366
+ capScope: "system",
23367
+ addonId: null,
23368
+ access: "create"
23369
+ },
23370
+ "llm.startRuntime": {
23371
+ capName: "llm",
23372
+ capScope: "system",
23373
+ addonId: null,
23374
+ access: "create"
23375
+ },
23376
+ "llm.stopRuntime": {
23377
+ capName: "llm",
23378
+ capScope: "system",
23379
+ addonId: null,
23380
+ access: "create"
23381
+ },
23382
+ "llm.testProfile": {
23383
+ capName: "llm",
23384
+ capScope: "system",
23385
+ addonId: null,
23386
+ access: "create"
23387
+ },
23388
+ "llm.upsertProfile": {
23389
+ capName: "llm",
23390
+ capScope: "system",
23391
+ addonId: null,
23392
+ access: "create"
23393
+ },
23394
+ "llmRuntime.complete": {
23395
+ capName: "llm-runtime",
23396
+ capScope: "system",
23397
+ addonId: null,
23398
+ access: "create"
23399
+ },
23400
+ "llmRuntime.deleteModel": {
23401
+ capName: "llm-runtime",
23402
+ capScope: "system",
23403
+ addonId: null,
23404
+ access: "delete"
23405
+ },
23406
+ "llmRuntime.ensureStarted": {
23407
+ capName: "llm-runtime",
23408
+ capScope: "system",
23409
+ addonId: null,
23410
+ access: "create"
23411
+ },
23412
+ "llmRuntime.getDiskUsage": {
23413
+ capName: "llm-runtime",
23414
+ capScope: "system",
23415
+ addonId: null,
23416
+ access: "view"
23417
+ },
23418
+ "llmRuntime.installModel": {
23419
+ capName: "llm-runtime",
23420
+ capScope: "system",
23421
+ addonId: null,
23422
+ access: "create"
23423
+ },
23424
+ "llmRuntime.listLocalModels": {
23425
+ capName: "llm-runtime",
23426
+ capScope: "system",
23427
+ addonId: null,
23428
+ access: "view"
23429
+ },
23430
+ "llmRuntime.status": {
23431
+ capName: "llm-runtime",
23432
+ capScope: "system",
23433
+ addonId: null,
23434
+ access: "view"
23435
+ },
23436
+ "llmRuntime.stop": {
23437
+ capName: "llm-runtime",
23438
+ capScope: "system",
23439
+ addonId: null,
23440
+ access: "create"
23441
+ },
22529
23442
  "localNetwork.getAllowedAddresses": {
22530
23443
  capName: "local-network",
22531
23444
  capScope: "system",
@@ -23156,6 +24069,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
23156
24069
  addonId: null,
23157
24070
  access: "delete"
23158
24071
  },
24072
+ "pipelineAnalytics.deleteTracks": {
24073
+ capName: "pipeline-analytics",
24074
+ capScope: "device",
24075
+ addonId: null,
24076
+ access: "delete"
24077
+ },
23159
24078
  "pipelineAnalytics.getActiveTracks": {
23160
24079
  capName: "pipeline-analytics",
23161
24080
  capScope: "device",
@@ -23222,12 +24141,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
23222
24141
  addonId: null,
23223
24142
  access: "create"
23224
24143
  },
24144
+ "pipelineAnalytics.pruneTracksBefore": {
24145
+ capName: "pipeline-analytics",
24146
+ capScope: "device",
24147
+ addonId: null,
24148
+ access: "create"
24149
+ },
23225
24150
  "pipelineAnalytics.searchObjectEvents": {
23226
24151
  capName: "pipeline-analytics",
23227
24152
  capScope: "device",
23228
24153
  addonId: null,
23229
24154
  access: "view"
23230
24155
  },
24156
+ "pipelineAnalytics.wipeAllAnalytics": {
24157
+ capName: "pipeline-analytics",
24158
+ capScope: "device",
24159
+ addonId: null,
24160
+ access: "delete"
24161
+ },
23231
24162
  "pipelineExecutor.cacheFrameInPool": {
23232
24163
  capName: "pipeline-executor",
23233
24164
  capScope: "system",
@@ -23732,18 +24663,42 @@ var METHOD_ACCESS_MAP = Object.freeze({
23732
24663
  addonId: null,
23733
24664
  access: "create"
23734
24665
  },
24666
+ "plateGallery.assignPlate": {
24667
+ capName: "plate-gallery",
24668
+ capScope: "system",
24669
+ addonId: null,
24670
+ access: "create"
24671
+ },
24672
+ "plateGallery.assignPlates": {
24673
+ capName: "plate-gallery",
24674
+ capScope: "system",
24675
+ addonId: null,
24676
+ access: "create"
24677
+ },
23735
24678
  "plateGallery.correctPlateText": {
23736
24679
  capName: "plate-gallery",
23737
24680
  capScope: "system",
23738
24681
  addonId: null,
23739
24682
  access: "create"
23740
24683
  },
24684
+ "plateGallery.createVehicle": {
24685
+ capName: "plate-gallery",
24686
+ capScope: "system",
24687
+ addonId: null,
24688
+ access: "create"
24689
+ },
23741
24690
  "plateGallery.deletePlate": {
23742
24691
  capName: "plate-gallery",
23743
24692
  capScope: "system",
23744
24693
  addonId: null,
23745
24694
  access: "delete"
23746
24695
  },
24696
+ "plateGallery.deleteVehicle": {
24697
+ capName: "plate-gallery",
24698
+ capScope: "system",
24699
+ addonId: null,
24700
+ access: "delete"
24701
+ },
23747
24702
  "plateGallery.getPlateByTrack": {
23748
24703
  capName: "plate-gallery",
23749
24704
  capScope: "system",
@@ -23762,6 +24717,30 @@ var METHOD_ACCESS_MAP = Object.freeze({
23762
24717
  addonId: null,
23763
24718
  access: "view"
23764
24719
  },
24720
+ "plateGallery.listVehicles": {
24721
+ capName: "plate-gallery",
24722
+ capScope: "system",
24723
+ addonId: null,
24724
+ access: "view"
24725
+ },
24726
+ "plateGallery.listVehicleSamples": {
24727
+ capName: "plate-gallery",
24728
+ capScope: "system",
24729
+ addonId: null,
24730
+ access: "view"
24731
+ },
24732
+ "plateGallery.removeVehicleSample": {
24733
+ capName: "plate-gallery",
24734
+ capScope: "system",
24735
+ addonId: null,
24736
+ access: "delete"
24737
+ },
24738
+ "plateGallery.renameVehicle": {
24739
+ capName: "plate-gallery",
24740
+ capScope: "system",
24741
+ addonId: null,
24742
+ access: "create"
24743
+ },
23765
24744
  "plateGallery.searchPlates": {
23766
24745
  capName: "plate-gallery",
23767
24746
  capScope: "system",
@@ -23774,6 +24753,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
23774
24753
  addonId: null,
23775
24754
  access: "view"
23776
24755
  },
24756
+ "plateGallery.unassignPlate": {
24757
+ capName: "plate-gallery",
24758
+ capScope: "system",
24759
+ addonId: null,
24760
+ access: "create"
24761
+ },
24762
+ "plateGallery.unassignPlates": {
24763
+ capName: "plate-gallery",
24764
+ capScope: "system",
24765
+ addonId: null,
24766
+ access: "create"
24767
+ },
23777
24768
  "platformProbe.getCapabilities": {
23778
24769
  capName: "platform-probe",
23779
24770
  capScope: "system",
@@ -23966,6 +24957,48 @@ var METHOD_ACCESS_MAP = Object.freeze({
23966
24957
  addonId: null,
23967
24958
  access: "create"
23968
24959
  },
24960
+ "sceneMonitor.captureReference": {
24961
+ capName: "scene-monitor",
24962
+ capScope: "device",
24963
+ addonId: null,
24964
+ access: "create"
24965
+ },
24966
+ "sceneMonitor.createScene": {
24967
+ capName: "scene-monitor",
24968
+ capScope: "device",
24969
+ addonId: null,
24970
+ access: "create"
24971
+ },
24972
+ "sceneMonitor.deleteReference": {
24973
+ capName: "scene-monitor",
24974
+ capScope: "device",
24975
+ addonId: null,
24976
+ access: "delete"
24977
+ },
24978
+ "sceneMonitor.deleteScene": {
24979
+ capName: "scene-monitor",
24980
+ capScope: "device",
24981
+ addonId: null,
24982
+ access: "delete"
24983
+ },
24984
+ "sceneMonitor.listScenes": {
24985
+ capName: "scene-monitor",
24986
+ capScope: "device",
24987
+ addonId: null,
24988
+ access: "view"
24989
+ },
24990
+ "sceneMonitor.recheckNow": {
24991
+ capName: "scene-monitor",
24992
+ capScope: "device",
24993
+ addonId: null,
24994
+ access: "create"
24995
+ },
24996
+ "sceneMonitor.updateScene": {
24997
+ capName: "scene-monitor",
24998
+ capScope: "device",
24999
+ addonId: null,
25000
+ access: "create"
25001
+ },
23969
25002
  "scriptRunner.run": {
23970
25003
  capName: "script-runner",
23971
25004
  capScope: "device",
@@ -25050,6 +26083,7 @@ var METHOD_ACCESS_MAP = Object.freeze({
25050
26083
  Object.freeze({
25051
26084
  "broker": "broker",
25052
26085
  "device-export": "device-export",
26086
+ "llm": "ai",
25053
26087
  "mesh-network": "mesh",
25054
26088
  "mqtt-broker": "broker",
25055
26089
  "network-access": "ingress",
@@ -25138,4 +26172,4 @@ function scoreRuntimes(hw) {
25138
26172
  };
25139
26173
  }
25140
26174
  //#endregion
25141
- export { errMsg as $, isVoidInput as A, platformProbeCapability as B, enumerateItemArrayFields as C, resolveCapMount as Ct, getByPath as D, filesystemBrowseCapability as E, looseSchema as F, settingsStoreCapability as G, readNodePin as H, metricsProviderCapability as I, storageProviderCapability as J, snapshotCapability as K, nodePin as L, lifecycleJobSchema as M, localNetworkCapability as N, isArrayOutputSchema as O, logDestinationCapability as P, validateExpressionSource as Q, normalizeUnit as R, deviceStatusCapability as S, readinessKey as St, evaluateLinkExpression as T, sleep as Tt, scoreRuntimes as U, procedureAuthKey as V, setByPath as W, toExpressionValue as X, streamQualityLabel as Y, userManagementCapability as Z, authProviderCapability as _, expandCapMethods as _t, DeviceStatusSchema as a, DeviceRole as at, deviceManagerCapability as b, parseJsonObject as bt, STREAM_PROFILE_META as c, ReadinessRegistry as ct, UserRecordSchema as d, asJsonObject as dt, BaseAddon as et, addonPagesCapability as f, asNumber as ft, applyTransform as g, emitReadiness as gt, alertsCapability as h, emitDownForOwnedCaps as ht, CAP_NAMES_WITH_STATUS as i, DeviceFeature as it, kebabToCamel as j, isObjectInput as k, ScopedTokenSchema as l, ReadinessTimeoutError as lt, addonWidgetsCapability as m, createEvent as mt, AlertSchema as n, DEVICE_SETTINGS_CONTRIBUTION_METHODS as nt, METHOD_ACCESS_MAP as o, DeviceType as ot, addonSettingsCapability as p, asString as pt, storageCapability as q, ApiKeyRecordSchema as r, DEVICE_STATUS_METHOD as rt, RUNTIME_DEFAULTS as s, EventCategory as st, ALL_CAPABILITY_DEFINITIONS as t, DATAPLANE_SECRET_HEADER as tt, StorageLocationTypeSchema as u, WELL_KNOWN_TAB_MAP as ut, backupCapability as v, hydrateSchema as vt, enumerateSchemaFields as w, scopeKey as wt, deviceStateCapability as x, parseJsonUnknown as xt, buildStreamParamsConfigSchema as y, isDeviceConfigCap as yt, parseStreamParamsFormPatch as z };
26175
+ export { validateExpressionSource as $, isObjectInput as A, parseStreamParamsFormPatch as B, enumerateItemArrayFields as C, readinessKey as Ct, getByPath as D, filesystemBrowseCapability as E, sleep as Et, logDestinationCapability as F, setByPath as G, procedureAuthKey as H, looseSchema as I, storageCapability as J, settingsStoreCapability as K, metricsProviderCapability as L, kebabToCamel as M, lifecycleJobSchema as N, isArrayOutputSchema as O, localNetworkCapability as P, userManagementCapability as Q, nodePin as R, deviceStatusCapability as S, parseJsonUnknown as St, evaluateLinkExpression as T, scopeKey as Tt, readNodePin as U, platformProbeCapability as V, scoreRuntimes as W, streamQualityLabel as X, storageProviderCapability as Y, toExpressionValue as Z, authProviderCapability as _, emitReadiness as _t, DeviceStatusSchema as a, DeviceFeature as at, deviceManagerCapability as b, isDeviceConfigCap as bt, STREAM_PROFILE_META as c, EventCategory as ct, UserRecordSchema as d, WELL_KNOWN_TAB_MAP as dt, errMsg as et, addonPagesCapability as f, asJsonObject as ft, applyTransform as g, emitDownForOwnedCaps as gt, alertsCapability as h, createEvent as ht, CAP_NAMES_WITH_STATUS as i, DEVICE_STATUS_METHOD as it, isVoidInput as j, isCollectionArrayMethod as k, ScopedTokenSchema as l, ReadinessRegistry as lt, addonWidgetsCapability as m, asString as mt, AlertSchema as n, DATAPLANE_SECRET_HEADER as nt, METHOD_ACCESS_MAP as o, DeviceRole as ot, addonSettingsCapability as p, asNumber as pt, snapshotCapability as q, ApiKeyRecordSchema as r, DEVICE_SETTINGS_CONTRIBUTION_METHODS as rt, RUNTIME_DEFAULTS as s, DeviceType as st, ALL_CAPABILITY_DEFINITIONS as t, BaseAddon as tt, StorageLocationTypeSchema as u, ReadinessTimeoutError as ut, backupCapability as v, expandCapMethods as vt, enumerateSchemaFields as w, resolveCapMount as wt, deviceStateCapability as x, parseJsonObject as xt, buildStreamParamsConfigSchema as y, hydrateSchema as yt, normalizeUnit as z };