@camstack/addon-provider-hikvision 1.1.26 → 1.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -6,7 +6,7 @@ let node_http = require("node:http");
6
6
  let node_https = require("node:https");
7
7
  let node_crypto = require("node:crypto");
8
8
  let node_os = require("node:os");
9
- //#region ../types/dist/event-category-H4AVePnn.mjs
9
+ //#region ../types/dist/event-category-D4HJq7Mw.mjs
10
10
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
11
11
  EventCategory["SystemBoot"] = "system.boot";
12
12
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -159,6 +159,11 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
159
159
  /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
160
160
  * thumb is a scrub gap the recorder's keyframe backfill covers. */
161
161
  EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
162
+ /** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
163
+ * progress bar the client reconciles via `recordingExport.getExport`. */
164
+ EventCategory["RecordingExportProgress"] = "recording.export.progress";
165
+ EventCategory["RecordingExportCompleted"] = "recording.export.completed";
166
+ EventCategory["RecordingExportFailed"] = "recording.export.failed";
162
167
  EventCategory["DetectionEvent"] = "detection.event";
163
168
  EventCategory["SessionTrackNew"] = "session.track.new";
164
169
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -448,6 +453,25 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
448
453
  */
449
454
  EventCategory["PipelineAnalyticsStationaryChanged"] = "pipeline-analytics.stationary-changed";
450
455
  /**
456
+ * Fired by `addon-post-analysis` when a package-drop is confirmed inside
457
+ * a package zone — a newly-appeared stationary object of a package class
458
+ * that cleared the class / zone / dwell / size gates. Payload:
459
+ * `PipelineAnalyticsPackageDeliveredPayload` carrying `{ deviceId,
460
+ * entryId, className, zoneIds, keyFrameMediaKey?, bbox, timestamp }`.
461
+ * Telemetry (D8): the durable record is the `package-events` store row;
462
+ * this bus topic drives notifier rules + live UI. See
463
+ * docs/superpowers/specs/2026-07-17-package-zones-design.md §5.1.
464
+ */
465
+ EventCategory["PipelineAnalyticsPackageDelivered"] = "pipeline-analytics.package-delivered";
466
+ /**
467
+ * Fired by `addon-post-analysis` when a previously-delivered package
468
+ * leaves its zone (the stationary entry departed — moved or swept).
469
+ * Payload: `PipelineAnalyticsPackagePickedUpPayload` carrying
470
+ * `{ deviceId, entryId, deliveredEventId, className, timestamp }`.
471
+ * Telemetry (D8). See package-zones-design §5.2.
472
+ */
473
+ EventCategory["PipelineAnalyticsPackagePickedUp"] = "pipeline-analytics.package-picked-up";
474
+ /**
451
475
  * Fired by `addon-post-analysis` whenever a gallery face row changes:
452
476
  * `kind:'buffered'` a new detected face was persisted, `'assigned'` /
453
477
  * `'unassigned'` its identity link changed, `'deleted'` the row was
@@ -5186,6 +5210,25 @@ function _instanceof(cls, params = {}) {
5186
5210
  };
5187
5211
  return inst;
5188
5212
  }
5213
+ //#endregion
5214
+ //#region ../../node_modules/zod/v4/classic/compat.js
5215
+ /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
5216
+ var ZodIssueCode = {
5217
+ invalid_type: "invalid_type",
5218
+ too_big: "too_big",
5219
+ too_small: "too_small",
5220
+ invalid_format: "invalid_format",
5221
+ not_multiple_of: "not_multiple_of",
5222
+ unrecognized_keys: "unrecognized_keys",
5223
+ invalid_union: "invalid_union",
5224
+ invalid_key: "invalid_key",
5225
+ invalid_element: "invalid_element",
5226
+ invalid_value: "invalid_value",
5227
+ custom: "custom"
5228
+ };
5229
+ /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5230
+ var ZodFirstPartyTypeKind;
5231
+ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5189
5232
  Object.fromEntries([
5190
5233
  {
5191
5234
  id: "overview",
@@ -7471,6 +7514,62 @@ var RecordingConfigSchema = object({
7471
7514
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7472
7515
  });
7473
7516
  /**
7517
+ * Ops-log — the durable, append-only operations audit shared by the
7518
+ * recordings and events management surfaces.
7519
+ *
7520
+ * ONE row shape is reused for both domains so a single "Activity" view can
7521
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7522
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7523
+ * management operation, WHY it ran (reason), and its measurable effect
7524
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7525
+ * never fail the operation it records.
7526
+ */
7527
+ /** Which management domain the operation belongs to. */
7528
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7529
+ /** The kind of management operation performed. */
7530
+ var OpsLogOpSchema = _enum([
7531
+ "prune",
7532
+ "manual-delete",
7533
+ "rescan",
7534
+ "retention-run"
7535
+ ]);
7536
+ /** Why the operation ran. */
7537
+ var OpsLogReasonSchema = _enum([
7538
+ "retention",
7539
+ "quota",
7540
+ "manual",
7541
+ "operator"
7542
+ ]);
7543
+ /** One audit row, shared verbatim by both domains. */
7544
+ var OpsLogEntrySchema = object({
7545
+ /** Unique row id. */
7546
+ id: string(),
7547
+ /** Epoch ms the operation completed. */
7548
+ at: number(),
7549
+ domain: OpsLogDomainSchema,
7550
+ op: OpsLogOpSchema,
7551
+ reason: OpsLogReasonSchema,
7552
+ /** The camera the op targeted; null for a cluster/global op. */
7553
+ deviceId: number().nullable(),
7554
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7555
+ nodeId: string(),
7556
+ /** Buckets / rows deleted (op-specific unit). */
7557
+ itemsAffected: number(),
7558
+ /** Bytes reclaimed by the op (0 when not measurable). */
7559
+ bytesReclaimed: number(),
7560
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7561
+ detail: string().nullable(),
7562
+ /** Who/what triggered the op. */
7563
+ actor: string()
7564
+ });
7565
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7566
+ var OpsLogQueryInputSchema = object({
7567
+ /** Restrict to a single camera; omit for every row. */
7568
+ deviceId: number().optional(),
7569
+ /** Max rows returned, newest-first. */
7570
+ limit: number().int().min(1).max(1e3).optional()
7571
+ });
7572
+ /**
7474
7573
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7475
7574
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7476
7575
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -14931,7 +15030,11 @@ array(ZoneRuleSchema).readonly();
14931
15030
  * Extend the enum here when a new gating consumer comes online (audio
14932
15031
  * gating, alert filtering, …) — no other surface needs to change.
14933
15032
  */
14934
- var ZoneRuleStageEnum = _enum(["motion", "detection"]);
15033
+ var ZoneRuleStageEnum = _enum([
15034
+ "motion",
15035
+ "detection",
15036
+ "package"
15037
+ ]);
14935
15038
  /**
14936
15039
  * Runtime registry: cap-property-name → cap definition. `BaseDevice`'s
14937
15040
  * `state` getter looks up the cap definition here to construct a
@@ -15025,16 +15128,25 @@ var DEVICE_LOCAL_STATE_CAPS = {
15025
15128
  })
15026
15129
  },
15027
15130
  /**
15028
- * Runtime-state slice — both stages mirrored together so consumers
15131
+ * Runtime-state slice — every stage mirrored together so consumers
15029
15132
  * see one reactive handle (`device.state.zoneRules.value`) instead
15030
- * of two. Bulk-replace mutations on either stage write the full
15031
- * `{motion, detection}` shape, so subscribers always get the
15133
+ * of one per stage. Bulk-replace mutations on any stage write the full
15134
+ * `{motion, detection, package}` shape, so subscribers always get the
15032
15135
  * complete current set. Consumers that only care about one stage
15033
15136
  * just read the matching property.
15137
+ *
15138
+ * `package` backs the package-drop detector — a package zone is a
15139
+ * `ZoneRule` on the `'package'` stage referencing drawn polygons
15140
+ * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
15141
+ * The orchestrator provider writes this stage as a first-class slice
15142
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
15143
+ * package}` shape, so consumers read the current package rules directly
15144
+ * off `device.state.zoneRules.value.package`.
15034
15145
  */
15035
15146
  runtimeState: object({
15036
15147
  motion: array(ZoneRuleSchema).readonly(),
15037
- detection: array(ZoneRuleSchema).readonly()
15148
+ detection: array(ZoneRuleSchema).readonly(),
15149
+ package: array(ZoneRuleSchema).readonly()
15038
15150
  })
15039
15151
  },
15040
15152
  zones: zonesCapability
@@ -19008,6 +19120,7 @@ var EventKindIconSchema = _enum([
19008
19120
  "smoke",
19009
19121
  "water",
19010
19122
  "button",
19123
+ "package",
19011
19124
  "generic"
19012
19125
  ]);
19013
19126
  var EventKindCategorySchema = _enum([
@@ -19015,7 +19128,8 @@ var EventKindCategorySchema = _enum([
19015
19128
  "audio",
19016
19129
  "detection",
19017
19130
  "sensor",
19018
- "custom"
19131
+ "custom",
19132
+ "package"
19019
19133
  ]);
19020
19134
  var EventKindDescriptorSchema = object({
19021
19135
  /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
@@ -19356,6 +19470,26 @@ var TrackCascadeCountsSchema = object({
19356
19470
  /** Per-track CLIP search vectors removed (best-effort). */
19357
19471
  embeddings: number().int()
19358
19472
  });
19473
+ /** Event-store footprint for one camera. */
19474
+ var EventStoreDeviceFootprintSchema = object({
19475
+ deviceId: number(),
19476
+ /** Persisted event rows (motion + object + audio) for the camera. */
19477
+ rows: number().int(),
19478
+ /** Event-owned media bytes on disk for the camera. */
19479
+ bytes: number().int()
19480
+ });
19481
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19482
+ var EventStoreFootprintSchema = object({
19483
+ totalRows: number().int(),
19484
+ totalBytes: number().int(),
19485
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19486
+ });
19487
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19488
+ var EventPruneCountsSchema = object({
19489
+ motion: number().int(),
19490
+ object: number().int(),
19491
+ audio: number().int()
19492
+ });
19359
19493
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19360
19494
  deviceId: number(),
19361
19495
  trackId: string()
@@ -19419,6 +19553,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19419
19553
  }), {
19420
19554
  kind: "mutation",
19421
19555
  auth: "admin"
19556
+ }), method(object({}), EventStoreFootprintSchema, {
19557
+ kind: "query",
19558
+ auth: "admin"
19559
+ }), method(object({
19560
+ olderThanMs: number(),
19561
+ reason: OpsLogReasonSchema.optional()
19562
+ }), EventPruneCountsSchema, {
19563
+ kind: "mutation",
19564
+ auth: "admin"
19565
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19566
+ kind: "mutation",
19567
+ auth: "admin"
19568
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19569
+ kind: "query",
19570
+ auth: "admin"
19422
19571
  }), method(object({
19423
19572
  eventId: string(),
19424
19573
  kind: MediaFileKindEnum.optional()
@@ -22867,13 +23016,131 @@ method(object({
22867
23016
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22868
23017
  kind: "mutation",
22869
23018
  auth: "admin"
22870
- }), method(object({ deviceId: number() }), object({
23019
+ }), method(object({
23020
+ deviceId: number(),
23021
+ reason: OpsLogReasonSchema.optional()
23022
+ }), object({
22871
23023
  floorMs: number().nullable(),
22872
23024
  deletedBuckets: number().int(),
22873
23025
  reclaimedBytes: number().int()
22874
23026
  }), {
22875
23027
  kind: "mutation",
22876
23028
  auth: "admin"
23029
+ }), method(object({
23030
+ deviceId: number(),
23031
+ fromMs: number().optional(),
23032
+ toMs: number().optional()
23033
+ }), object({
23034
+ deletedBuckets: number().int(),
23035
+ reclaimedBytes: number().int()
23036
+ }), {
23037
+ kind: "mutation",
23038
+ auth: "admin"
23039
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
23040
+ kind: "query",
23041
+ auth: "admin"
23042
+ });
23043
+ /**
23044
+ * `recordingExport` cap — render a footage time range into a single downloadable
23045
+ * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
23046
+ * bounded lifetime with a durable history, auto-expiry, and optional
23047
+ * delete-after-download.
23048
+ *
23049
+ * Like `recording` this is a `scope:'system', mode:'singleton'` cap: the
23050
+ * recorder self-gates so exactly ONE node (the designated `recordingNodeId`,
23051
+ * default `hub`) registers it. Device-scoped methods carry `deviceId` in their
23052
+ * input and dispatch to that single provider; the render runs on the node that
23053
+ * owns the footage (no cross-node segment transfer). Download rides the
23054
+ * framework addon data-plane. State persists in a DurableState blob (NOT
23055
+ * SQLite); history rows survive file deletion for audit.
23056
+ */
23057
+ /** Playback-speed multiplier for the render (1 = realtime). */
23058
+ var ExportSpeedSchema = number().min(.25).max(32);
23059
+ /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
23060
+ var ExportTimelapseSchema = object({
23061
+ everyMs: number().int().positive(),
23062
+ outputFps: number().int().min(1).max(60).optional()
23063
+ });
23064
+ /**
23065
+ * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
23066
+ * is honoured only for a realtime-ish speed (0.5–2×); timelapse is always
23067
+ * silent. `maxLifeMs` bounds how long the finished file is kept;
23068
+ * `deleteAfterDownload` removes it shortly after the first complete download.
23069
+ */
23070
+ var ExportOptionsSchema = object({
23071
+ speed: ExportSpeedSchema.optional(),
23072
+ timelapse: ExportTimelapseSchema.optional(),
23073
+ includeAudio: boolean(),
23074
+ maxLifeMs: number().int().positive(),
23075
+ deleteAfterDownload: boolean(),
23076
+ title: string().max(200).optional()
23077
+ }).superRefine((v, ctx) => {
23078
+ if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
23079
+ code: ZodIssueCode.custom,
23080
+ message: "speed and timelapse are mutually exclusive",
23081
+ path: ["timelapse"]
23082
+ });
23083
+ });
23084
+ var ExportStateSchema = _enum([
23085
+ "queued",
23086
+ "rendering",
23087
+ "ready",
23088
+ "failed",
23089
+ "expired",
23090
+ "deleted"
23091
+ ]);
23092
+ /** One export job / history row. */
23093
+ var ExportRecordSchema = object({
23094
+ id: string(),
23095
+ deviceId: number(),
23096
+ profile: string(),
23097
+ fromMs: number(),
23098
+ toMs: number(),
23099
+ options: ExportOptionsSchema,
23100
+ state: ExportStateSchema,
23101
+ /** 0–100 while rendering; null otherwise. */
23102
+ progressPct: number().nullable(),
23103
+ /** File size once ready; null before. */
23104
+ fileBytes: number().nullable(),
23105
+ expiresAt: number(),
23106
+ deleteAfterDownload: boolean(),
23107
+ /** Epoch of the first complete download; null until then. */
23108
+ downloadedAt: number().nullable(),
23109
+ createdAt: number(),
23110
+ /** User id/name that requested the export. */
23111
+ createdBy: string(),
23112
+ /** Failure reason when state is 'failed'; null otherwise. */
23113
+ error: string().nullable()
23114
+ });
23115
+ /** Candidate download URLs (LAN first, then operator extra hosts). */
23116
+ var ExportDownloadSchema = object({
23117
+ url: string(),
23118
+ endpoints: array(string())
23119
+ });
23120
+ method(object({
23121
+ deviceId: number(),
23122
+ profile: string(),
23123
+ fromMs: number(),
23124
+ toMs: number(),
23125
+ options: ExportOptionsSchema
23126
+ }), ExportRecordSchema, {
23127
+ kind: "mutation",
23128
+ auth: "protected"
23129
+ }), method(object({ deviceId: number().optional() }), array(ExportRecordSchema), {
23130
+ kind: "query",
23131
+ auth: "protected"
23132
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
23133
+ kind: "query",
23134
+ auth: "protected"
23135
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
23136
+ kind: "mutation",
23137
+ auth: "protected"
23138
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
23139
+ kind: "mutation",
23140
+ auth: "protected"
23141
+ }), method(object({ exportId: string() }), ExportDownloadSchema, {
23142
+ kind: "query",
23143
+ auth: "protected"
22877
23144
  });
22878
23145
  /**
22879
23146
  * One publishable camera stream as its OWNING PROVIDER describes it — the same
@@ -26104,6 +26371,12 @@ Object.freeze({
26104
26371
  addonId: null,
26105
26372
  access: "delete"
26106
26373
  },
26374
+ "pipelineAnalytics.deleteDeviceEvents": {
26375
+ capName: "pipeline-analytics",
26376
+ capScope: "device",
26377
+ addonId: null,
26378
+ access: "delete"
26379
+ },
26107
26380
  "pipelineAnalytics.deleteTracks": {
26108
26381
  capName: "pipeline-analytics",
26109
26382
  capScope: "device",
@@ -26134,6 +26407,12 @@ Object.freeze({
26134
26407
  addonId: null,
26135
26408
  access: "view"
26136
26409
  },
26410
+ "pipelineAnalytics.getEventStoreFootprint": {
26411
+ capName: "pipeline-analytics",
26412
+ capScope: "device",
26413
+ addonId: null,
26414
+ access: "view"
26415
+ },
26137
26416
  "pipelineAnalytics.getKeyEvents": {
26138
26417
  capName: "pipeline-analytics",
26139
26418
  capScope: "device",
@@ -26176,6 +26455,12 @@ Object.freeze({
26176
26455
  addonId: null,
26177
26456
  access: "view"
26178
26457
  },
26458
+ "pipelineAnalytics.listOpsLog": {
26459
+ capName: "pipeline-analytics",
26460
+ capScope: "device",
26461
+ addonId: null,
26462
+ access: "view"
26463
+ },
26179
26464
  "pipelineAnalytics.listRecentTracks": {
26180
26465
  capName: "pipeline-analytics",
26181
26466
  capScope: "device",
@@ -26188,6 +26473,12 @@ Object.freeze({
26188
26473
  addonId: null,
26189
26474
  access: "view"
26190
26475
  },
26476
+ "pipelineAnalytics.pruneEvents": {
26477
+ capName: "pipeline-analytics",
26478
+ capScope: "device",
26479
+ addonId: null,
26480
+ access: "create"
26481
+ },
26191
26482
  "pipelineAnalytics.pruneEventsBefore": {
26192
26483
  capName: "pipeline-analytics",
26193
26484
  capScope: "device",
@@ -26950,6 +27241,12 @@ Object.freeze({
26950
27241
  addonId: null,
26951
27242
  access: "create"
26952
27243
  },
27244
+ "recording.deleteFootprint": {
27245
+ capName: "recording",
27246
+ capScope: "system",
27247
+ addonId: null,
27248
+ access: "delete"
27249
+ },
26953
27250
  "recording.getAvailability": {
26954
27251
  capName: "recording",
26955
27252
  capScope: "system",
@@ -26980,6 +27277,12 @@ Object.freeze({
26980
27277
  addonId: null,
26981
27278
  access: "view"
26982
27279
  },
27280
+ "recording.listOpsLog": {
27281
+ capName: "recording",
27282
+ capScope: "system",
27283
+ addonId: null,
27284
+ access: "view"
27285
+ },
26983
27286
  "recording.locateSegment": {
26984
27287
  capName: "recording",
26985
27288
  capScope: "system",
@@ -27010,6 +27313,42 @@ Object.freeze({
27010
27313
  addonId: null,
27011
27314
  access: "create"
27012
27315
  },
27316
+ "recordingExport.cancelExport": {
27317
+ capName: "recordingExport",
27318
+ capScope: "system",
27319
+ addonId: null,
27320
+ access: "create"
27321
+ },
27322
+ "recordingExport.createExport": {
27323
+ capName: "recordingExport",
27324
+ capScope: "system",
27325
+ addonId: null,
27326
+ access: "create"
27327
+ },
27328
+ "recordingExport.deleteExport": {
27329
+ capName: "recordingExport",
27330
+ capScope: "system",
27331
+ addonId: null,
27332
+ access: "delete"
27333
+ },
27334
+ "recordingExport.getDownloadUrl": {
27335
+ capName: "recordingExport",
27336
+ capScope: "system",
27337
+ addonId: null,
27338
+ access: "view"
27339
+ },
27340
+ "recordingExport.getExport": {
27341
+ capName: "recordingExport",
27342
+ capScope: "system",
27343
+ addonId: null,
27344
+ access: "view"
27345
+ },
27346
+ "recordingExport.listExports": {
27347
+ capName: "recordingExport",
27348
+ capScope: "system",
27349
+ addonId: null,
27350
+ access: "view"
27351
+ },
27013
27352
  "sceneMonitor.captureReference": {
27014
27353
  capName: "scene-monitor",
27015
27354
  capScope: "device",
package/dist/addon.mjs CHANGED
@@ -7,7 +7,7 @@ import { networkInterfaces } from "node:os";
7
7
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
8
8
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
9
9
  //#endregion
10
- //#region ../types/dist/event-category-H4AVePnn.mjs
10
+ //#region ../types/dist/event-category-D4HJq7Mw.mjs
11
11
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
12
12
  EventCategory["SystemBoot"] = "system.boot";
13
13
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -160,6 +160,11 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
160
160
  /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
161
161
  * thumb is a scrub gap the recorder's keyframe backfill covers. */
162
162
  EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
163
+ /** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
164
+ * progress bar the client reconciles via `recordingExport.getExport`. */
165
+ EventCategory["RecordingExportProgress"] = "recording.export.progress";
166
+ EventCategory["RecordingExportCompleted"] = "recording.export.completed";
167
+ EventCategory["RecordingExportFailed"] = "recording.export.failed";
163
168
  EventCategory["DetectionEvent"] = "detection.event";
164
169
  EventCategory["SessionTrackNew"] = "session.track.new";
165
170
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -449,6 +454,25 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
449
454
  */
450
455
  EventCategory["PipelineAnalyticsStationaryChanged"] = "pipeline-analytics.stationary-changed";
451
456
  /**
457
+ * Fired by `addon-post-analysis` when a package-drop is confirmed inside
458
+ * a package zone — a newly-appeared stationary object of a package class
459
+ * that cleared the class / zone / dwell / size gates. Payload:
460
+ * `PipelineAnalyticsPackageDeliveredPayload` carrying `{ deviceId,
461
+ * entryId, className, zoneIds, keyFrameMediaKey?, bbox, timestamp }`.
462
+ * Telemetry (D8): the durable record is the `package-events` store row;
463
+ * this bus topic drives notifier rules + live UI. See
464
+ * docs/superpowers/specs/2026-07-17-package-zones-design.md §5.1.
465
+ */
466
+ EventCategory["PipelineAnalyticsPackageDelivered"] = "pipeline-analytics.package-delivered";
467
+ /**
468
+ * Fired by `addon-post-analysis` when a previously-delivered package
469
+ * leaves its zone (the stationary entry departed — moved or swept).
470
+ * Payload: `PipelineAnalyticsPackagePickedUpPayload` carrying
471
+ * `{ deviceId, entryId, deliveredEventId, className, timestamp }`.
472
+ * Telemetry (D8). See package-zones-design §5.2.
473
+ */
474
+ EventCategory["PipelineAnalyticsPackagePickedUp"] = "pipeline-analytics.package-picked-up";
475
+ /**
452
476
  * Fired by `addon-post-analysis` whenever a gallery face row changes:
453
477
  * `kind:'buffered'` a new detected face was persisted, `'assigned'` /
454
478
  * `'unassigned'` its identity link changed, `'deleted'` the row was
@@ -5187,6 +5211,25 @@ function _instanceof(cls, params = {}) {
5187
5211
  };
5188
5212
  return inst;
5189
5213
  }
5214
+ //#endregion
5215
+ //#region ../../node_modules/zod/v4/classic/compat.js
5216
+ /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
5217
+ var ZodIssueCode = {
5218
+ invalid_type: "invalid_type",
5219
+ too_big: "too_big",
5220
+ too_small: "too_small",
5221
+ invalid_format: "invalid_format",
5222
+ not_multiple_of: "not_multiple_of",
5223
+ unrecognized_keys: "unrecognized_keys",
5224
+ invalid_union: "invalid_union",
5225
+ invalid_key: "invalid_key",
5226
+ invalid_element: "invalid_element",
5227
+ invalid_value: "invalid_value",
5228
+ custom: "custom"
5229
+ };
5230
+ /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5231
+ var ZodFirstPartyTypeKind;
5232
+ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5190
5233
  Object.fromEntries([
5191
5234
  {
5192
5235
  id: "overview",
@@ -7472,6 +7515,62 @@ var RecordingConfigSchema = object({
7472
7515
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7473
7516
  });
7474
7517
  /**
7518
+ * Ops-log — the durable, append-only operations audit shared by the
7519
+ * recordings and events management surfaces.
7520
+ *
7521
+ * ONE row shape is reused for both domains so a single "Activity" view can
7522
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7523
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7524
+ * management operation, WHY it ran (reason), and its measurable effect
7525
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7526
+ * never fail the operation it records.
7527
+ */
7528
+ /** Which management domain the operation belongs to. */
7529
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7530
+ /** The kind of management operation performed. */
7531
+ var OpsLogOpSchema = _enum([
7532
+ "prune",
7533
+ "manual-delete",
7534
+ "rescan",
7535
+ "retention-run"
7536
+ ]);
7537
+ /** Why the operation ran. */
7538
+ var OpsLogReasonSchema = _enum([
7539
+ "retention",
7540
+ "quota",
7541
+ "manual",
7542
+ "operator"
7543
+ ]);
7544
+ /** One audit row, shared verbatim by both domains. */
7545
+ var OpsLogEntrySchema = object({
7546
+ /** Unique row id. */
7547
+ id: string(),
7548
+ /** Epoch ms the operation completed. */
7549
+ at: number(),
7550
+ domain: OpsLogDomainSchema,
7551
+ op: OpsLogOpSchema,
7552
+ reason: OpsLogReasonSchema,
7553
+ /** The camera the op targeted; null for a cluster/global op. */
7554
+ deviceId: number().nullable(),
7555
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7556
+ nodeId: string(),
7557
+ /** Buckets / rows deleted (op-specific unit). */
7558
+ itemsAffected: number(),
7559
+ /** Bytes reclaimed by the op (0 when not measurable). */
7560
+ bytesReclaimed: number(),
7561
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7562
+ detail: string().nullable(),
7563
+ /** Who/what triggered the op. */
7564
+ actor: string()
7565
+ });
7566
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7567
+ var OpsLogQueryInputSchema = object({
7568
+ /** Restrict to a single camera; omit for every row. */
7569
+ deviceId: number().optional(),
7570
+ /** Max rows returned, newest-first. */
7571
+ limit: number().int().min(1).max(1e3).optional()
7572
+ });
7573
+ /**
7475
7574
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7476
7575
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7477
7576
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -14932,7 +15031,11 @@ array(ZoneRuleSchema).readonly();
14932
15031
  * Extend the enum here when a new gating consumer comes online (audio
14933
15032
  * gating, alert filtering, …) — no other surface needs to change.
14934
15033
  */
14935
- var ZoneRuleStageEnum = _enum(["motion", "detection"]);
15034
+ var ZoneRuleStageEnum = _enum([
15035
+ "motion",
15036
+ "detection",
15037
+ "package"
15038
+ ]);
14936
15039
  /**
14937
15040
  * Runtime registry: cap-property-name → cap definition. `BaseDevice`'s
14938
15041
  * `state` getter looks up the cap definition here to construct a
@@ -15026,16 +15129,25 @@ var DEVICE_LOCAL_STATE_CAPS = {
15026
15129
  })
15027
15130
  },
15028
15131
  /**
15029
- * Runtime-state slice — both stages mirrored together so consumers
15132
+ * Runtime-state slice — every stage mirrored together so consumers
15030
15133
  * see one reactive handle (`device.state.zoneRules.value`) instead
15031
- * of two. Bulk-replace mutations on either stage write the full
15032
- * `{motion, detection}` shape, so subscribers always get the
15134
+ * of one per stage. Bulk-replace mutations on any stage write the full
15135
+ * `{motion, detection, package}` shape, so subscribers always get the
15033
15136
  * complete current set. Consumers that only care about one stage
15034
15137
  * just read the matching property.
15138
+ *
15139
+ * `package` backs the package-drop detector — a package zone is a
15140
+ * `ZoneRule` on the `'package'` stage referencing drawn polygons
15141
+ * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
15142
+ * The orchestrator provider writes this stage as a first-class slice
15143
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
15144
+ * package}` shape, so consumers read the current package rules directly
15145
+ * off `device.state.zoneRules.value.package`.
15035
15146
  */
15036
15147
  runtimeState: object({
15037
15148
  motion: array(ZoneRuleSchema).readonly(),
15038
- detection: array(ZoneRuleSchema).readonly()
15149
+ detection: array(ZoneRuleSchema).readonly(),
15150
+ package: array(ZoneRuleSchema).readonly()
15039
15151
  })
15040
15152
  },
15041
15153
  zones: zonesCapability
@@ -19009,6 +19121,7 @@ var EventKindIconSchema = _enum([
19009
19121
  "smoke",
19010
19122
  "water",
19011
19123
  "button",
19124
+ "package",
19012
19125
  "generic"
19013
19126
  ]);
19014
19127
  var EventKindCategorySchema = _enum([
@@ -19016,7 +19129,8 @@ var EventKindCategorySchema = _enum([
19016
19129
  "audio",
19017
19130
  "detection",
19018
19131
  "sensor",
19019
- "custom"
19132
+ "custom",
19133
+ "package"
19020
19134
  ]);
19021
19135
  var EventKindDescriptorSchema = object({
19022
19136
  /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
@@ -19357,6 +19471,26 @@ var TrackCascadeCountsSchema = object({
19357
19471
  /** Per-track CLIP search vectors removed (best-effort). */
19358
19472
  embeddings: number().int()
19359
19473
  });
19474
+ /** Event-store footprint for one camera. */
19475
+ var EventStoreDeviceFootprintSchema = object({
19476
+ deviceId: number(),
19477
+ /** Persisted event rows (motion + object + audio) for the camera. */
19478
+ rows: number().int(),
19479
+ /** Event-owned media bytes on disk for the camera. */
19480
+ bytes: number().int()
19481
+ });
19482
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19483
+ var EventStoreFootprintSchema = object({
19484
+ totalRows: number().int(),
19485
+ totalBytes: number().int(),
19486
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19487
+ });
19488
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19489
+ var EventPruneCountsSchema = object({
19490
+ motion: number().int(),
19491
+ object: number().int(),
19492
+ audio: number().int()
19493
+ });
19360
19494
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19361
19495
  deviceId: number(),
19362
19496
  trackId: string()
@@ -19420,6 +19554,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19420
19554
  }), {
19421
19555
  kind: "mutation",
19422
19556
  auth: "admin"
19557
+ }), method(object({}), EventStoreFootprintSchema, {
19558
+ kind: "query",
19559
+ auth: "admin"
19560
+ }), method(object({
19561
+ olderThanMs: number(),
19562
+ reason: OpsLogReasonSchema.optional()
19563
+ }), EventPruneCountsSchema, {
19564
+ kind: "mutation",
19565
+ auth: "admin"
19566
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19567
+ kind: "mutation",
19568
+ auth: "admin"
19569
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19570
+ kind: "query",
19571
+ auth: "admin"
19423
19572
  }), method(object({
19424
19573
  eventId: string(),
19425
19574
  kind: MediaFileKindEnum.optional()
@@ -22868,13 +23017,131 @@ method(object({
22868
23017
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22869
23018
  kind: "mutation",
22870
23019
  auth: "admin"
22871
- }), method(object({ deviceId: number() }), object({
23020
+ }), method(object({
23021
+ deviceId: number(),
23022
+ reason: OpsLogReasonSchema.optional()
23023
+ }), object({
22872
23024
  floorMs: number().nullable(),
22873
23025
  deletedBuckets: number().int(),
22874
23026
  reclaimedBytes: number().int()
22875
23027
  }), {
22876
23028
  kind: "mutation",
22877
23029
  auth: "admin"
23030
+ }), method(object({
23031
+ deviceId: number(),
23032
+ fromMs: number().optional(),
23033
+ toMs: number().optional()
23034
+ }), object({
23035
+ deletedBuckets: number().int(),
23036
+ reclaimedBytes: number().int()
23037
+ }), {
23038
+ kind: "mutation",
23039
+ auth: "admin"
23040
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
23041
+ kind: "query",
23042
+ auth: "admin"
23043
+ });
23044
+ /**
23045
+ * `recordingExport` cap — render a footage time range into a single downloadable
23046
+ * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
23047
+ * bounded lifetime with a durable history, auto-expiry, and optional
23048
+ * delete-after-download.
23049
+ *
23050
+ * Like `recording` this is a `scope:'system', mode:'singleton'` cap: the
23051
+ * recorder self-gates so exactly ONE node (the designated `recordingNodeId`,
23052
+ * default `hub`) registers it. Device-scoped methods carry `deviceId` in their
23053
+ * input and dispatch to that single provider; the render runs on the node that
23054
+ * owns the footage (no cross-node segment transfer). Download rides the
23055
+ * framework addon data-plane. State persists in a DurableState blob (NOT
23056
+ * SQLite); history rows survive file deletion for audit.
23057
+ */
23058
+ /** Playback-speed multiplier for the render (1 = realtime). */
23059
+ var ExportSpeedSchema = number().min(.25).max(32);
23060
+ /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
23061
+ var ExportTimelapseSchema = object({
23062
+ everyMs: number().int().positive(),
23063
+ outputFps: number().int().min(1).max(60).optional()
23064
+ });
23065
+ /**
23066
+ * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
23067
+ * is honoured only for a realtime-ish speed (0.5–2×); timelapse is always
23068
+ * silent. `maxLifeMs` bounds how long the finished file is kept;
23069
+ * `deleteAfterDownload` removes it shortly after the first complete download.
23070
+ */
23071
+ var ExportOptionsSchema = object({
23072
+ speed: ExportSpeedSchema.optional(),
23073
+ timelapse: ExportTimelapseSchema.optional(),
23074
+ includeAudio: boolean(),
23075
+ maxLifeMs: number().int().positive(),
23076
+ deleteAfterDownload: boolean(),
23077
+ title: string().max(200).optional()
23078
+ }).superRefine((v, ctx) => {
23079
+ if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
23080
+ code: ZodIssueCode.custom,
23081
+ message: "speed and timelapse are mutually exclusive",
23082
+ path: ["timelapse"]
23083
+ });
23084
+ });
23085
+ var ExportStateSchema = _enum([
23086
+ "queued",
23087
+ "rendering",
23088
+ "ready",
23089
+ "failed",
23090
+ "expired",
23091
+ "deleted"
23092
+ ]);
23093
+ /** One export job / history row. */
23094
+ var ExportRecordSchema = object({
23095
+ id: string(),
23096
+ deviceId: number(),
23097
+ profile: string(),
23098
+ fromMs: number(),
23099
+ toMs: number(),
23100
+ options: ExportOptionsSchema,
23101
+ state: ExportStateSchema,
23102
+ /** 0–100 while rendering; null otherwise. */
23103
+ progressPct: number().nullable(),
23104
+ /** File size once ready; null before. */
23105
+ fileBytes: number().nullable(),
23106
+ expiresAt: number(),
23107
+ deleteAfterDownload: boolean(),
23108
+ /** Epoch of the first complete download; null until then. */
23109
+ downloadedAt: number().nullable(),
23110
+ createdAt: number(),
23111
+ /** User id/name that requested the export. */
23112
+ createdBy: string(),
23113
+ /** Failure reason when state is 'failed'; null otherwise. */
23114
+ error: string().nullable()
23115
+ });
23116
+ /** Candidate download URLs (LAN first, then operator extra hosts). */
23117
+ var ExportDownloadSchema = object({
23118
+ url: string(),
23119
+ endpoints: array(string())
23120
+ });
23121
+ method(object({
23122
+ deviceId: number(),
23123
+ profile: string(),
23124
+ fromMs: number(),
23125
+ toMs: number(),
23126
+ options: ExportOptionsSchema
23127
+ }), ExportRecordSchema, {
23128
+ kind: "mutation",
23129
+ auth: "protected"
23130
+ }), method(object({ deviceId: number().optional() }), array(ExportRecordSchema), {
23131
+ kind: "query",
23132
+ auth: "protected"
23133
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
23134
+ kind: "query",
23135
+ auth: "protected"
23136
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
23137
+ kind: "mutation",
23138
+ auth: "protected"
23139
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
23140
+ kind: "mutation",
23141
+ auth: "protected"
23142
+ }), method(object({ exportId: string() }), ExportDownloadSchema, {
23143
+ kind: "query",
23144
+ auth: "protected"
22878
23145
  });
22879
23146
  /**
22880
23147
  * One publishable camera stream as its OWNING PROVIDER describes it — the same
@@ -26105,6 +26372,12 @@ Object.freeze({
26105
26372
  addonId: null,
26106
26373
  access: "delete"
26107
26374
  },
26375
+ "pipelineAnalytics.deleteDeviceEvents": {
26376
+ capName: "pipeline-analytics",
26377
+ capScope: "device",
26378
+ addonId: null,
26379
+ access: "delete"
26380
+ },
26108
26381
  "pipelineAnalytics.deleteTracks": {
26109
26382
  capName: "pipeline-analytics",
26110
26383
  capScope: "device",
@@ -26135,6 +26408,12 @@ Object.freeze({
26135
26408
  addonId: null,
26136
26409
  access: "view"
26137
26410
  },
26411
+ "pipelineAnalytics.getEventStoreFootprint": {
26412
+ capName: "pipeline-analytics",
26413
+ capScope: "device",
26414
+ addonId: null,
26415
+ access: "view"
26416
+ },
26138
26417
  "pipelineAnalytics.getKeyEvents": {
26139
26418
  capName: "pipeline-analytics",
26140
26419
  capScope: "device",
@@ -26177,6 +26456,12 @@ Object.freeze({
26177
26456
  addonId: null,
26178
26457
  access: "view"
26179
26458
  },
26459
+ "pipelineAnalytics.listOpsLog": {
26460
+ capName: "pipeline-analytics",
26461
+ capScope: "device",
26462
+ addonId: null,
26463
+ access: "view"
26464
+ },
26180
26465
  "pipelineAnalytics.listRecentTracks": {
26181
26466
  capName: "pipeline-analytics",
26182
26467
  capScope: "device",
@@ -26189,6 +26474,12 @@ Object.freeze({
26189
26474
  addonId: null,
26190
26475
  access: "view"
26191
26476
  },
26477
+ "pipelineAnalytics.pruneEvents": {
26478
+ capName: "pipeline-analytics",
26479
+ capScope: "device",
26480
+ addonId: null,
26481
+ access: "create"
26482
+ },
26192
26483
  "pipelineAnalytics.pruneEventsBefore": {
26193
26484
  capName: "pipeline-analytics",
26194
26485
  capScope: "device",
@@ -26951,6 +27242,12 @@ Object.freeze({
26951
27242
  addonId: null,
26952
27243
  access: "create"
26953
27244
  },
27245
+ "recording.deleteFootprint": {
27246
+ capName: "recording",
27247
+ capScope: "system",
27248
+ addonId: null,
27249
+ access: "delete"
27250
+ },
26954
27251
  "recording.getAvailability": {
26955
27252
  capName: "recording",
26956
27253
  capScope: "system",
@@ -26981,6 +27278,12 @@ Object.freeze({
26981
27278
  addonId: null,
26982
27279
  access: "view"
26983
27280
  },
27281
+ "recording.listOpsLog": {
27282
+ capName: "recording",
27283
+ capScope: "system",
27284
+ addonId: null,
27285
+ access: "view"
27286
+ },
26984
27287
  "recording.locateSegment": {
26985
27288
  capName: "recording",
26986
27289
  capScope: "system",
@@ -27011,6 +27314,42 @@ Object.freeze({
27011
27314
  addonId: null,
27012
27315
  access: "create"
27013
27316
  },
27317
+ "recordingExport.cancelExport": {
27318
+ capName: "recordingExport",
27319
+ capScope: "system",
27320
+ addonId: null,
27321
+ access: "create"
27322
+ },
27323
+ "recordingExport.createExport": {
27324
+ capName: "recordingExport",
27325
+ capScope: "system",
27326
+ addonId: null,
27327
+ access: "create"
27328
+ },
27329
+ "recordingExport.deleteExport": {
27330
+ capName: "recordingExport",
27331
+ capScope: "system",
27332
+ addonId: null,
27333
+ access: "delete"
27334
+ },
27335
+ "recordingExport.getDownloadUrl": {
27336
+ capName: "recordingExport",
27337
+ capScope: "system",
27338
+ addonId: null,
27339
+ access: "view"
27340
+ },
27341
+ "recordingExport.getExport": {
27342
+ capName: "recordingExport",
27343
+ capScope: "system",
27344
+ addonId: null,
27345
+ access: "view"
27346
+ },
27347
+ "recordingExport.listExports": {
27348
+ capName: "recordingExport",
27349
+ capScope: "system",
27350
+ addonId: null,
27351
+ access: "view"
27352
+ },
27014
27353
  "sceneMonitor.captureReference": {
27015
27354
  capName: "scene-monitor",
27016
27355
  capScope: "device",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-hikvision",
3
- "version": "1.1.26",
3
+ "version": "1.1.28",
4
4
  "description": "Hikvision camera device provider addon for CamStack — ISAPI over HTTP(S) with digest auth (snapshot, alarm stream, RTSP discovery)",
5
5
  "keywords": [
6
6
  "camstack",