@camstack/addon-provider-amcrest 0.1.12 → 0.1.14

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
@@ -4,7 +4,7 @@ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).expor
4
4
  //#endregion
5
5
  let node_crypto = require("node:crypto");
6
6
  let node_os = require("node:os");
7
- //#region ../types/dist/event-category-H4AVePnn.mjs
7
+ //#region ../types/dist/event-category-D4HJq7Mw.mjs
8
8
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
9
9
  EventCategory["SystemBoot"] = "system.boot";
10
10
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -157,6 +157,11 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
157
157
  /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
158
158
  * thumb is a scrub gap the recorder's keyframe backfill covers. */
159
159
  EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
160
+ /** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
161
+ * progress bar the client reconciles via `recordingExport.getExport`. */
162
+ EventCategory["RecordingExportProgress"] = "recording.export.progress";
163
+ EventCategory["RecordingExportCompleted"] = "recording.export.completed";
164
+ EventCategory["RecordingExportFailed"] = "recording.export.failed";
160
165
  EventCategory["DetectionEvent"] = "detection.event";
161
166
  EventCategory["SessionTrackNew"] = "session.track.new";
162
167
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -446,6 +451,25 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
446
451
  */
447
452
  EventCategory["PipelineAnalyticsStationaryChanged"] = "pipeline-analytics.stationary-changed";
448
453
  /**
454
+ * Fired by `addon-post-analysis` when a package-drop is confirmed inside
455
+ * a package zone — a newly-appeared stationary object of a package class
456
+ * that cleared the class / zone / dwell / size gates. Payload:
457
+ * `PipelineAnalyticsPackageDeliveredPayload` carrying `{ deviceId,
458
+ * entryId, className, zoneIds, keyFrameMediaKey?, bbox, timestamp }`.
459
+ * Telemetry (D8): the durable record is the `package-events` store row;
460
+ * this bus topic drives notifier rules + live UI. See
461
+ * docs/superpowers/specs/2026-07-17-package-zones-design.md §5.1.
462
+ */
463
+ EventCategory["PipelineAnalyticsPackageDelivered"] = "pipeline-analytics.package-delivered";
464
+ /**
465
+ * Fired by `addon-post-analysis` when a previously-delivered package
466
+ * leaves its zone (the stationary entry departed — moved or swept).
467
+ * Payload: `PipelineAnalyticsPackagePickedUpPayload` carrying
468
+ * `{ deviceId, entryId, deliveredEventId, className, timestamp }`.
469
+ * Telemetry (D8). See package-zones-design §5.2.
470
+ */
471
+ EventCategory["PipelineAnalyticsPackagePickedUp"] = "pipeline-analytics.package-picked-up";
472
+ /**
449
473
  * Fired by `addon-post-analysis` whenever a gallery face row changes:
450
474
  * `kind:'buffered'` a new detected face was persisted, `'assigned'` /
451
475
  * `'unassigned'` its identity link changed, `'deleted'` the row was
@@ -5184,6 +5208,25 @@ function _instanceof(cls, params = {}) {
5184
5208
  };
5185
5209
  return inst;
5186
5210
  }
5211
+ //#endregion
5212
+ //#region ../../node_modules/zod/v4/classic/compat.js
5213
+ /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
5214
+ var ZodIssueCode = {
5215
+ invalid_type: "invalid_type",
5216
+ too_big: "too_big",
5217
+ too_small: "too_small",
5218
+ invalid_format: "invalid_format",
5219
+ not_multiple_of: "not_multiple_of",
5220
+ unrecognized_keys: "unrecognized_keys",
5221
+ invalid_union: "invalid_union",
5222
+ invalid_key: "invalid_key",
5223
+ invalid_element: "invalid_element",
5224
+ invalid_value: "invalid_value",
5225
+ custom: "custom"
5226
+ };
5227
+ /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5228
+ var ZodFirstPartyTypeKind;
5229
+ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5187
5230
  Object.fromEntries([
5188
5231
  {
5189
5232
  id: "overview",
@@ -7294,6 +7337,62 @@ var RecordingConfigSchema = object({
7294
7337
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7295
7338
  });
7296
7339
  /**
7340
+ * Ops-log — the durable, append-only operations audit shared by the
7341
+ * recordings and events management surfaces.
7342
+ *
7343
+ * ONE row shape is reused for both domains so a single "Activity" view can
7344
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7345
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7346
+ * management operation, WHY it ran (reason), and its measurable effect
7347
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7348
+ * never fail the operation it records.
7349
+ */
7350
+ /** Which management domain the operation belongs to. */
7351
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7352
+ /** The kind of management operation performed. */
7353
+ var OpsLogOpSchema = _enum([
7354
+ "prune",
7355
+ "manual-delete",
7356
+ "rescan",
7357
+ "retention-run"
7358
+ ]);
7359
+ /** Why the operation ran. */
7360
+ var OpsLogReasonSchema = _enum([
7361
+ "retention",
7362
+ "quota",
7363
+ "manual",
7364
+ "operator"
7365
+ ]);
7366
+ /** One audit row, shared verbatim by both domains. */
7367
+ var OpsLogEntrySchema = object({
7368
+ /** Unique row id. */
7369
+ id: string(),
7370
+ /** Epoch ms the operation completed. */
7371
+ at: number(),
7372
+ domain: OpsLogDomainSchema,
7373
+ op: OpsLogOpSchema,
7374
+ reason: OpsLogReasonSchema,
7375
+ /** The camera the op targeted; null for a cluster/global op. */
7376
+ deviceId: number().nullable(),
7377
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7378
+ nodeId: string(),
7379
+ /** Buckets / rows deleted (op-specific unit). */
7380
+ itemsAffected: number(),
7381
+ /** Bytes reclaimed by the op (0 when not measurable). */
7382
+ bytesReclaimed: number(),
7383
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7384
+ detail: string().nullable(),
7385
+ /** Who/what triggered the op. */
7386
+ actor: string()
7387
+ });
7388
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7389
+ var OpsLogQueryInputSchema = object({
7390
+ /** Restrict to a single camera; omit for every row. */
7391
+ deviceId: number().optional(),
7392
+ /** Max rows returned, newest-first. */
7393
+ limit: number().int().min(1).max(1e3).optional()
7394
+ });
7395
+ /**
7297
7396
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7298
7397
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7299
7398
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -14739,7 +14838,11 @@ array(ZoneRuleSchema).readonly();
14739
14838
  * Extend the enum here when a new gating consumer comes online (audio
14740
14839
  * gating, alert filtering, …) — no other surface needs to change.
14741
14840
  */
14742
- var ZoneRuleStageEnum = _enum(["motion", "detection"]);
14841
+ var ZoneRuleStageEnum = _enum([
14842
+ "motion",
14843
+ "detection",
14844
+ "package"
14845
+ ]);
14743
14846
  /**
14744
14847
  * Runtime registry: cap-property-name → cap definition. `BaseDevice`'s
14745
14848
  * `state` getter looks up the cap definition here to construct a
@@ -14833,16 +14936,25 @@ var DEVICE_LOCAL_STATE_CAPS = {
14833
14936
  })
14834
14937
  },
14835
14938
  /**
14836
- * Runtime-state slice — both stages mirrored together so consumers
14939
+ * Runtime-state slice — every stage mirrored together so consumers
14837
14940
  * see one reactive handle (`device.state.zoneRules.value`) instead
14838
- * of two. Bulk-replace mutations on either stage write the full
14839
- * `{motion, detection}` shape, so subscribers always get the
14941
+ * of one per stage. Bulk-replace mutations on any stage write the full
14942
+ * `{motion, detection, package}` shape, so subscribers always get the
14840
14943
  * complete current set. Consumers that only care about one stage
14841
14944
  * just read the matching property.
14945
+ *
14946
+ * `package` backs the package-drop detector — a package zone is a
14947
+ * `ZoneRule` on the `'package'` stage referencing drawn polygons
14948
+ * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14949
+ * The orchestrator provider writes this stage as a first-class slice
14950
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
14951
+ * package}` shape, so consumers read the current package rules directly
14952
+ * off `device.state.zoneRules.value.package`.
14842
14953
  */
14843
14954
  runtimeState: object({
14844
14955
  motion: array(ZoneRuleSchema).readonly(),
14845
- detection: array(ZoneRuleSchema).readonly()
14956
+ detection: array(ZoneRuleSchema).readonly(),
14957
+ package: array(ZoneRuleSchema).readonly()
14846
14958
  })
14847
14959
  },
14848
14960
  zones: zonesCapability
@@ -18804,6 +18916,7 @@ var EventKindIconSchema = _enum([
18804
18916
  "smoke",
18805
18917
  "water",
18806
18918
  "button",
18919
+ "package",
18807
18920
  "generic"
18808
18921
  ]);
18809
18922
  var EventKindCategorySchema = _enum([
@@ -18811,7 +18924,8 @@ var EventKindCategorySchema = _enum([
18811
18924
  "audio",
18812
18925
  "detection",
18813
18926
  "sensor",
18814
- "custom"
18927
+ "custom",
18928
+ "package"
18815
18929
  ]);
18816
18930
  var EventKindDescriptorSchema = object({
18817
18931
  /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
@@ -19152,6 +19266,26 @@ var TrackCascadeCountsSchema = object({
19152
19266
  /** Per-track CLIP search vectors removed (best-effort). */
19153
19267
  embeddings: number().int()
19154
19268
  });
19269
+ /** Event-store footprint for one camera. */
19270
+ var EventStoreDeviceFootprintSchema = object({
19271
+ deviceId: number(),
19272
+ /** Persisted event rows (motion + object + audio) for the camera. */
19273
+ rows: number().int(),
19274
+ /** Event-owned media bytes on disk for the camera. */
19275
+ bytes: number().int()
19276
+ });
19277
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19278
+ var EventStoreFootprintSchema = object({
19279
+ totalRows: number().int(),
19280
+ totalBytes: number().int(),
19281
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19282
+ });
19283
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19284
+ var EventPruneCountsSchema = object({
19285
+ motion: number().int(),
19286
+ object: number().int(),
19287
+ audio: number().int()
19288
+ });
19155
19289
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19156
19290
  deviceId: number(),
19157
19291
  trackId: string()
@@ -19215,6 +19349,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19215
19349
  }), {
19216
19350
  kind: "mutation",
19217
19351
  auth: "admin"
19352
+ }), method(object({}), EventStoreFootprintSchema, {
19353
+ kind: "query",
19354
+ auth: "admin"
19355
+ }), method(object({
19356
+ olderThanMs: number(),
19357
+ reason: OpsLogReasonSchema.optional()
19358
+ }), EventPruneCountsSchema, {
19359
+ kind: "mutation",
19360
+ auth: "admin"
19361
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19362
+ kind: "mutation",
19363
+ auth: "admin"
19364
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19365
+ kind: "query",
19366
+ auth: "admin"
19218
19367
  }), method(object({
19219
19368
  eventId: string(),
19220
19369
  kind: MediaFileKindEnum.optional()
@@ -22587,13 +22736,131 @@ method(object({
22587
22736
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22588
22737
  kind: "mutation",
22589
22738
  auth: "admin"
22590
- }), method(object({ deviceId: number() }), object({
22739
+ }), method(object({
22740
+ deviceId: number(),
22741
+ reason: OpsLogReasonSchema.optional()
22742
+ }), object({
22591
22743
  floorMs: number().nullable(),
22592
22744
  deletedBuckets: number().int(),
22593
22745
  reclaimedBytes: number().int()
22594
22746
  }), {
22595
22747
  kind: "mutation",
22596
22748
  auth: "admin"
22749
+ }), method(object({
22750
+ deviceId: number(),
22751
+ fromMs: number().optional(),
22752
+ toMs: number().optional()
22753
+ }), object({
22754
+ deletedBuckets: number().int(),
22755
+ reclaimedBytes: number().int()
22756
+ }), {
22757
+ kind: "mutation",
22758
+ auth: "admin"
22759
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
22760
+ kind: "query",
22761
+ auth: "admin"
22762
+ });
22763
+ /**
22764
+ * `recordingExport` cap — render a footage time range into a single downloadable
22765
+ * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
22766
+ * bounded lifetime with a durable history, auto-expiry, and optional
22767
+ * delete-after-download.
22768
+ *
22769
+ * Like `recording` this is a `scope:'system', mode:'singleton'` cap: the
22770
+ * recorder self-gates so exactly ONE node (the designated `recordingNodeId`,
22771
+ * default `hub`) registers it. Device-scoped methods carry `deviceId` in their
22772
+ * input and dispatch to that single provider; the render runs on the node that
22773
+ * owns the footage (no cross-node segment transfer). Download rides the
22774
+ * framework addon data-plane. State persists in a DurableState blob (NOT
22775
+ * SQLite); history rows survive file deletion for audit.
22776
+ */
22777
+ /** Playback-speed multiplier for the render (1 = realtime). */
22778
+ var ExportSpeedSchema = number().min(.25).max(32);
22779
+ /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
22780
+ var ExportTimelapseSchema = object({
22781
+ everyMs: number().int().positive(),
22782
+ outputFps: number().int().min(1).max(60).optional()
22783
+ });
22784
+ /**
22785
+ * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
22786
+ * is honoured only for a realtime-ish speed (0.5–2×); timelapse is always
22787
+ * silent. `maxLifeMs` bounds how long the finished file is kept;
22788
+ * `deleteAfterDownload` removes it shortly after the first complete download.
22789
+ */
22790
+ var ExportOptionsSchema = object({
22791
+ speed: ExportSpeedSchema.optional(),
22792
+ timelapse: ExportTimelapseSchema.optional(),
22793
+ includeAudio: boolean(),
22794
+ maxLifeMs: number().int().positive(),
22795
+ deleteAfterDownload: boolean(),
22796
+ title: string().max(200).optional()
22797
+ }).superRefine((v, ctx) => {
22798
+ if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
22799
+ code: ZodIssueCode.custom,
22800
+ message: "speed and timelapse are mutually exclusive",
22801
+ path: ["timelapse"]
22802
+ });
22803
+ });
22804
+ var ExportStateSchema = _enum([
22805
+ "queued",
22806
+ "rendering",
22807
+ "ready",
22808
+ "failed",
22809
+ "expired",
22810
+ "deleted"
22811
+ ]);
22812
+ /** One export job / history row. */
22813
+ var ExportRecordSchema = object({
22814
+ id: string(),
22815
+ deviceId: number(),
22816
+ profile: string(),
22817
+ fromMs: number(),
22818
+ toMs: number(),
22819
+ options: ExportOptionsSchema,
22820
+ state: ExportStateSchema,
22821
+ /** 0–100 while rendering; null otherwise. */
22822
+ progressPct: number().nullable(),
22823
+ /** File size once ready; null before. */
22824
+ fileBytes: number().nullable(),
22825
+ expiresAt: number(),
22826
+ deleteAfterDownload: boolean(),
22827
+ /** Epoch of the first complete download; null until then. */
22828
+ downloadedAt: number().nullable(),
22829
+ createdAt: number(),
22830
+ /** User id/name that requested the export. */
22831
+ createdBy: string(),
22832
+ /** Failure reason when state is 'failed'; null otherwise. */
22833
+ error: string().nullable()
22834
+ });
22835
+ /** Candidate download URLs (LAN first, then operator extra hosts). */
22836
+ var ExportDownloadSchema = object({
22837
+ url: string(),
22838
+ endpoints: array(string())
22839
+ });
22840
+ method(object({
22841
+ deviceId: number(),
22842
+ profile: string(),
22843
+ fromMs: number(),
22844
+ toMs: number(),
22845
+ options: ExportOptionsSchema
22846
+ }), ExportRecordSchema, {
22847
+ kind: "mutation",
22848
+ auth: "protected"
22849
+ }), method(object({ deviceId: number().optional() }), array(ExportRecordSchema), {
22850
+ kind: "query",
22851
+ auth: "protected"
22852
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22853
+ kind: "query",
22854
+ auth: "protected"
22855
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22856
+ kind: "mutation",
22857
+ auth: "protected"
22858
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22859
+ kind: "mutation",
22860
+ auth: "protected"
22861
+ }), method(object({ exportId: string() }), ExportDownloadSchema, {
22862
+ kind: "query",
22863
+ auth: "protected"
22597
22864
  });
22598
22865
  /**
22599
22866
  * One publishable camera stream as its OWNING PROVIDER describes it — the same
@@ -25824,6 +26091,12 @@ Object.freeze({
25824
26091
  addonId: null,
25825
26092
  access: "delete"
25826
26093
  },
26094
+ "pipelineAnalytics.deleteDeviceEvents": {
26095
+ capName: "pipeline-analytics",
26096
+ capScope: "device",
26097
+ addonId: null,
26098
+ access: "delete"
26099
+ },
25827
26100
  "pipelineAnalytics.deleteTracks": {
25828
26101
  capName: "pipeline-analytics",
25829
26102
  capScope: "device",
@@ -25854,6 +26127,12 @@ Object.freeze({
25854
26127
  addonId: null,
25855
26128
  access: "view"
25856
26129
  },
26130
+ "pipelineAnalytics.getEventStoreFootprint": {
26131
+ capName: "pipeline-analytics",
26132
+ capScope: "device",
26133
+ addonId: null,
26134
+ access: "view"
26135
+ },
25857
26136
  "pipelineAnalytics.getKeyEvents": {
25858
26137
  capName: "pipeline-analytics",
25859
26138
  capScope: "device",
@@ -25896,6 +26175,12 @@ Object.freeze({
25896
26175
  addonId: null,
25897
26176
  access: "view"
25898
26177
  },
26178
+ "pipelineAnalytics.listOpsLog": {
26179
+ capName: "pipeline-analytics",
26180
+ capScope: "device",
26181
+ addonId: null,
26182
+ access: "view"
26183
+ },
25899
26184
  "pipelineAnalytics.listRecentTracks": {
25900
26185
  capName: "pipeline-analytics",
25901
26186
  capScope: "device",
@@ -25908,6 +26193,12 @@ Object.freeze({
25908
26193
  addonId: null,
25909
26194
  access: "view"
25910
26195
  },
26196
+ "pipelineAnalytics.pruneEvents": {
26197
+ capName: "pipeline-analytics",
26198
+ capScope: "device",
26199
+ addonId: null,
26200
+ access: "create"
26201
+ },
25911
26202
  "pipelineAnalytics.pruneEventsBefore": {
25912
26203
  capName: "pipeline-analytics",
25913
26204
  capScope: "device",
@@ -26670,6 +26961,12 @@ Object.freeze({
26670
26961
  addonId: null,
26671
26962
  access: "create"
26672
26963
  },
26964
+ "recording.deleteFootprint": {
26965
+ capName: "recording",
26966
+ capScope: "system",
26967
+ addonId: null,
26968
+ access: "delete"
26969
+ },
26673
26970
  "recording.getAvailability": {
26674
26971
  capName: "recording",
26675
26972
  capScope: "system",
@@ -26700,6 +26997,12 @@ Object.freeze({
26700
26997
  addonId: null,
26701
26998
  access: "view"
26702
26999
  },
27000
+ "recording.listOpsLog": {
27001
+ capName: "recording",
27002
+ capScope: "system",
27003
+ addonId: null,
27004
+ access: "view"
27005
+ },
26703
27006
  "recording.locateSegment": {
26704
27007
  capName: "recording",
26705
27008
  capScope: "system",
@@ -26730,6 +27033,42 @@ Object.freeze({
26730
27033
  addonId: null,
26731
27034
  access: "create"
26732
27035
  },
27036
+ "recordingExport.cancelExport": {
27037
+ capName: "recordingExport",
27038
+ capScope: "system",
27039
+ addonId: null,
27040
+ access: "create"
27041
+ },
27042
+ "recordingExport.createExport": {
27043
+ capName: "recordingExport",
27044
+ capScope: "system",
27045
+ addonId: null,
27046
+ access: "create"
27047
+ },
27048
+ "recordingExport.deleteExport": {
27049
+ capName: "recordingExport",
27050
+ capScope: "system",
27051
+ addonId: null,
27052
+ access: "delete"
27053
+ },
27054
+ "recordingExport.getDownloadUrl": {
27055
+ capName: "recordingExport",
27056
+ capScope: "system",
27057
+ addonId: null,
27058
+ access: "view"
27059
+ },
27060
+ "recordingExport.getExport": {
27061
+ capName: "recordingExport",
27062
+ capScope: "system",
27063
+ addonId: null,
27064
+ access: "view"
27065
+ },
27066
+ "recordingExport.listExports": {
27067
+ capName: "recordingExport",
27068
+ capScope: "system",
27069
+ addonId: null,
27070
+ access: "view"
27071
+ },
26733
27072
  "sceneMonitor.captureReference": {
26734
27073
  capName: "scene-monitor",
26735
27074
  capScope: "device",
package/dist/addon.mjs CHANGED
@@ -5,7 +5,7 @@ import { networkInterfaces } from "node:os";
5
5
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
6
6
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
7
7
  //#endregion
8
- //#region ../types/dist/event-category-H4AVePnn.mjs
8
+ //#region ../types/dist/event-category-D4HJq7Mw.mjs
9
9
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
10
10
  EventCategory["SystemBoot"] = "system.boot";
11
11
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -158,6 +158,11 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
158
158
  /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
159
159
  * thumb is a scrub gap the recorder's keyframe backfill covers. */
160
160
  EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
161
+ /** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
162
+ * progress bar the client reconciles via `recordingExport.getExport`. */
163
+ EventCategory["RecordingExportProgress"] = "recording.export.progress";
164
+ EventCategory["RecordingExportCompleted"] = "recording.export.completed";
165
+ EventCategory["RecordingExportFailed"] = "recording.export.failed";
161
166
  EventCategory["DetectionEvent"] = "detection.event";
162
167
  EventCategory["SessionTrackNew"] = "session.track.new";
163
168
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -447,6 +452,25 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
447
452
  */
448
453
  EventCategory["PipelineAnalyticsStationaryChanged"] = "pipeline-analytics.stationary-changed";
449
454
  /**
455
+ * Fired by `addon-post-analysis` when a package-drop is confirmed inside
456
+ * a package zone — a newly-appeared stationary object of a package class
457
+ * that cleared the class / zone / dwell / size gates. Payload:
458
+ * `PipelineAnalyticsPackageDeliveredPayload` carrying `{ deviceId,
459
+ * entryId, className, zoneIds, keyFrameMediaKey?, bbox, timestamp }`.
460
+ * Telemetry (D8): the durable record is the `package-events` store row;
461
+ * this bus topic drives notifier rules + live UI. See
462
+ * docs/superpowers/specs/2026-07-17-package-zones-design.md §5.1.
463
+ */
464
+ EventCategory["PipelineAnalyticsPackageDelivered"] = "pipeline-analytics.package-delivered";
465
+ /**
466
+ * Fired by `addon-post-analysis` when a previously-delivered package
467
+ * leaves its zone (the stationary entry departed — moved or swept).
468
+ * Payload: `PipelineAnalyticsPackagePickedUpPayload` carrying
469
+ * `{ deviceId, entryId, deliveredEventId, className, timestamp }`.
470
+ * Telemetry (D8). See package-zones-design §5.2.
471
+ */
472
+ EventCategory["PipelineAnalyticsPackagePickedUp"] = "pipeline-analytics.package-picked-up";
473
+ /**
450
474
  * Fired by `addon-post-analysis` whenever a gallery face row changes:
451
475
  * `kind:'buffered'` a new detected face was persisted, `'assigned'` /
452
476
  * `'unassigned'` its identity link changed, `'deleted'` the row was
@@ -5185,6 +5209,25 @@ function _instanceof(cls, params = {}) {
5185
5209
  };
5186
5210
  return inst;
5187
5211
  }
5212
+ //#endregion
5213
+ //#region ../../node_modules/zod/v4/classic/compat.js
5214
+ /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
5215
+ var ZodIssueCode = {
5216
+ invalid_type: "invalid_type",
5217
+ too_big: "too_big",
5218
+ too_small: "too_small",
5219
+ invalid_format: "invalid_format",
5220
+ not_multiple_of: "not_multiple_of",
5221
+ unrecognized_keys: "unrecognized_keys",
5222
+ invalid_union: "invalid_union",
5223
+ invalid_key: "invalid_key",
5224
+ invalid_element: "invalid_element",
5225
+ invalid_value: "invalid_value",
5226
+ custom: "custom"
5227
+ };
5228
+ /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5229
+ var ZodFirstPartyTypeKind;
5230
+ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5188
5231
  Object.fromEntries([
5189
5232
  {
5190
5233
  id: "overview",
@@ -7295,6 +7338,62 @@ var RecordingConfigSchema = object({
7295
7338
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7296
7339
  });
7297
7340
  /**
7341
+ * Ops-log — the durable, append-only operations audit shared by the
7342
+ * recordings and events management surfaces.
7343
+ *
7344
+ * ONE row shape is reused for both domains so a single "Activity" view can
7345
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7346
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7347
+ * management operation, WHY it ran (reason), and its measurable effect
7348
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7349
+ * never fail the operation it records.
7350
+ */
7351
+ /** Which management domain the operation belongs to. */
7352
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7353
+ /** The kind of management operation performed. */
7354
+ var OpsLogOpSchema = _enum([
7355
+ "prune",
7356
+ "manual-delete",
7357
+ "rescan",
7358
+ "retention-run"
7359
+ ]);
7360
+ /** Why the operation ran. */
7361
+ var OpsLogReasonSchema = _enum([
7362
+ "retention",
7363
+ "quota",
7364
+ "manual",
7365
+ "operator"
7366
+ ]);
7367
+ /** One audit row, shared verbatim by both domains. */
7368
+ var OpsLogEntrySchema = object({
7369
+ /** Unique row id. */
7370
+ id: string(),
7371
+ /** Epoch ms the operation completed. */
7372
+ at: number(),
7373
+ domain: OpsLogDomainSchema,
7374
+ op: OpsLogOpSchema,
7375
+ reason: OpsLogReasonSchema,
7376
+ /** The camera the op targeted; null for a cluster/global op. */
7377
+ deviceId: number().nullable(),
7378
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7379
+ nodeId: string(),
7380
+ /** Buckets / rows deleted (op-specific unit). */
7381
+ itemsAffected: number(),
7382
+ /** Bytes reclaimed by the op (0 when not measurable). */
7383
+ bytesReclaimed: number(),
7384
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7385
+ detail: string().nullable(),
7386
+ /** Who/what triggered the op. */
7387
+ actor: string()
7388
+ });
7389
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7390
+ var OpsLogQueryInputSchema = object({
7391
+ /** Restrict to a single camera; omit for every row. */
7392
+ deviceId: number().optional(),
7393
+ /** Max rows returned, newest-first. */
7394
+ limit: number().int().min(1).max(1e3).optional()
7395
+ });
7396
+ /**
7298
7397
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7299
7398
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7300
7399
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -14740,7 +14839,11 @@ array(ZoneRuleSchema).readonly();
14740
14839
  * Extend the enum here when a new gating consumer comes online (audio
14741
14840
  * gating, alert filtering, …) — no other surface needs to change.
14742
14841
  */
14743
- var ZoneRuleStageEnum = _enum(["motion", "detection"]);
14842
+ var ZoneRuleStageEnum = _enum([
14843
+ "motion",
14844
+ "detection",
14845
+ "package"
14846
+ ]);
14744
14847
  /**
14745
14848
  * Runtime registry: cap-property-name → cap definition. `BaseDevice`'s
14746
14849
  * `state` getter looks up the cap definition here to construct a
@@ -14834,16 +14937,25 @@ var DEVICE_LOCAL_STATE_CAPS = {
14834
14937
  })
14835
14938
  },
14836
14939
  /**
14837
- * Runtime-state slice — both stages mirrored together so consumers
14940
+ * Runtime-state slice — every stage mirrored together so consumers
14838
14941
  * see one reactive handle (`device.state.zoneRules.value`) instead
14839
- * of two. Bulk-replace mutations on either stage write the full
14840
- * `{motion, detection}` shape, so subscribers always get the
14942
+ * of one per stage. Bulk-replace mutations on any stage write the full
14943
+ * `{motion, detection, package}` shape, so subscribers always get the
14841
14944
  * complete current set. Consumers that only care about one stage
14842
14945
  * just read the matching property.
14946
+ *
14947
+ * `package` backs the package-drop detector — a package zone is a
14948
+ * `ZoneRule` on the `'package'` stage referencing drawn polygons
14949
+ * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14950
+ * The orchestrator provider writes this stage as a first-class slice
14951
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
14952
+ * package}` shape, so consumers read the current package rules directly
14953
+ * off `device.state.zoneRules.value.package`.
14843
14954
  */
14844
14955
  runtimeState: object({
14845
14956
  motion: array(ZoneRuleSchema).readonly(),
14846
- detection: array(ZoneRuleSchema).readonly()
14957
+ detection: array(ZoneRuleSchema).readonly(),
14958
+ package: array(ZoneRuleSchema).readonly()
14847
14959
  })
14848
14960
  },
14849
14961
  zones: zonesCapability
@@ -18805,6 +18917,7 @@ var EventKindIconSchema = _enum([
18805
18917
  "smoke",
18806
18918
  "water",
18807
18919
  "button",
18920
+ "package",
18808
18921
  "generic"
18809
18922
  ]);
18810
18923
  var EventKindCategorySchema = _enum([
@@ -18812,7 +18925,8 @@ var EventKindCategorySchema = _enum([
18812
18925
  "audio",
18813
18926
  "detection",
18814
18927
  "sensor",
18815
- "custom"
18928
+ "custom",
18929
+ "package"
18816
18930
  ]);
18817
18931
  var EventKindDescriptorSchema = object({
18818
18932
  /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
@@ -19153,6 +19267,26 @@ var TrackCascadeCountsSchema = object({
19153
19267
  /** Per-track CLIP search vectors removed (best-effort). */
19154
19268
  embeddings: number().int()
19155
19269
  });
19270
+ /** Event-store footprint for one camera. */
19271
+ var EventStoreDeviceFootprintSchema = object({
19272
+ deviceId: number(),
19273
+ /** Persisted event rows (motion + object + audio) for the camera. */
19274
+ rows: number().int(),
19275
+ /** Event-owned media bytes on disk for the camera. */
19276
+ bytes: number().int()
19277
+ });
19278
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19279
+ var EventStoreFootprintSchema = object({
19280
+ totalRows: number().int(),
19281
+ totalBytes: number().int(),
19282
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19283
+ });
19284
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19285
+ var EventPruneCountsSchema = object({
19286
+ motion: number().int(),
19287
+ object: number().int(),
19288
+ audio: number().int()
19289
+ });
19156
19290
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19157
19291
  deviceId: number(),
19158
19292
  trackId: string()
@@ -19216,6 +19350,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19216
19350
  }), {
19217
19351
  kind: "mutation",
19218
19352
  auth: "admin"
19353
+ }), method(object({}), EventStoreFootprintSchema, {
19354
+ kind: "query",
19355
+ auth: "admin"
19356
+ }), method(object({
19357
+ olderThanMs: number(),
19358
+ reason: OpsLogReasonSchema.optional()
19359
+ }), EventPruneCountsSchema, {
19360
+ kind: "mutation",
19361
+ auth: "admin"
19362
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19363
+ kind: "mutation",
19364
+ auth: "admin"
19365
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19366
+ kind: "query",
19367
+ auth: "admin"
19219
19368
  }), method(object({
19220
19369
  eventId: string(),
19221
19370
  kind: MediaFileKindEnum.optional()
@@ -22588,13 +22737,131 @@ method(object({
22588
22737
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22589
22738
  kind: "mutation",
22590
22739
  auth: "admin"
22591
- }), method(object({ deviceId: number() }), object({
22740
+ }), method(object({
22741
+ deviceId: number(),
22742
+ reason: OpsLogReasonSchema.optional()
22743
+ }), object({
22592
22744
  floorMs: number().nullable(),
22593
22745
  deletedBuckets: number().int(),
22594
22746
  reclaimedBytes: number().int()
22595
22747
  }), {
22596
22748
  kind: "mutation",
22597
22749
  auth: "admin"
22750
+ }), method(object({
22751
+ deviceId: number(),
22752
+ fromMs: number().optional(),
22753
+ toMs: number().optional()
22754
+ }), object({
22755
+ deletedBuckets: number().int(),
22756
+ reclaimedBytes: number().int()
22757
+ }), {
22758
+ kind: "mutation",
22759
+ auth: "admin"
22760
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
22761
+ kind: "query",
22762
+ auth: "admin"
22763
+ });
22764
+ /**
22765
+ * `recordingExport` cap — render a footage time range into a single downloadable
22766
+ * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
22767
+ * bounded lifetime with a durable history, auto-expiry, and optional
22768
+ * delete-after-download.
22769
+ *
22770
+ * Like `recording` this is a `scope:'system', mode:'singleton'` cap: the
22771
+ * recorder self-gates so exactly ONE node (the designated `recordingNodeId`,
22772
+ * default `hub`) registers it. Device-scoped methods carry `deviceId` in their
22773
+ * input and dispatch to that single provider; the render runs on the node that
22774
+ * owns the footage (no cross-node segment transfer). Download rides the
22775
+ * framework addon data-plane. State persists in a DurableState blob (NOT
22776
+ * SQLite); history rows survive file deletion for audit.
22777
+ */
22778
+ /** Playback-speed multiplier for the render (1 = realtime). */
22779
+ var ExportSpeedSchema = number().min(.25).max(32);
22780
+ /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
22781
+ var ExportTimelapseSchema = object({
22782
+ everyMs: number().int().positive(),
22783
+ outputFps: number().int().min(1).max(60).optional()
22784
+ });
22785
+ /**
22786
+ * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
22787
+ * is honoured only for a realtime-ish speed (0.5–2×); timelapse is always
22788
+ * silent. `maxLifeMs` bounds how long the finished file is kept;
22789
+ * `deleteAfterDownload` removes it shortly after the first complete download.
22790
+ */
22791
+ var ExportOptionsSchema = object({
22792
+ speed: ExportSpeedSchema.optional(),
22793
+ timelapse: ExportTimelapseSchema.optional(),
22794
+ includeAudio: boolean(),
22795
+ maxLifeMs: number().int().positive(),
22796
+ deleteAfterDownload: boolean(),
22797
+ title: string().max(200).optional()
22798
+ }).superRefine((v, ctx) => {
22799
+ if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
22800
+ code: ZodIssueCode.custom,
22801
+ message: "speed and timelapse are mutually exclusive",
22802
+ path: ["timelapse"]
22803
+ });
22804
+ });
22805
+ var ExportStateSchema = _enum([
22806
+ "queued",
22807
+ "rendering",
22808
+ "ready",
22809
+ "failed",
22810
+ "expired",
22811
+ "deleted"
22812
+ ]);
22813
+ /** One export job / history row. */
22814
+ var ExportRecordSchema = object({
22815
+ id: string(),
22816
+ deviceId: number(),
22817
+ profile: string(),
22818
+ fromMs: number(),
22819
+ toMs: number(),
22820
+ options: ExportOptionsSchema,
22821
+ state: ExportStateSchema,
22822
+ /** 0–100 while rendering; null otherwise. */
22823
+ progressPct: number().nullable(),
22824
+ /** File size once ready; null before. */
22825
+ fileBytes: number().nullable(),
22826
+ expiresAt: number(),
22827
+ deleteAfterDownload: boolean(),
22828
+ /** Epoch of the first complete download; null until then. */
22829
+ downloadedAt: number().nullable(),
22830
+ createdAt: number(),
22831
+ /** User id/name that requested the export. */
22832
+ createdBy: string(),
22833
+ /** Failure reason when state is 'failed'; null otherwise. */
22834
+ error: string().nullable()
22835
+ });
22836
+ /** Candidate download URLs (LAN first, then operator extra hosts). */
22837
+ var ExportDownloadSchema = object({
22838
+ url: string(),
22839
+ endpoints: array(string())
22840
+ });
22841
+ method(object({
22842
+ deviceId: number(),
22843
+ profile: string(),
22844
+ fromMs: number(),
22845
+ toMs: number(),
22846
+ options: ExportOptionsSchema
22847
+ }), ExportRecordSchema, {
22848
+ kind: "mutation",
22849
+ auth: "protected"
22850
+ }), method(object({ deviceId: number().optional() }), array(ExportRecordSchema), {
22851
+ kind: "query",
22852
+ auth: "protected"
22853
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22854
+ kind: "query",
22855
+ auth: "protected"
22856
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22857
+ kind: "mutation",
22858
+ auth: "protected"
22859
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22860
+ kind: "mutation",
22861
+ auth: "protected"
22862
+ }), method(object({ exportId: string() }), ExportDownloadSchema, {
22863
+ kind: "query",
22864
+ auth: "protected"
22598
22865
  });
22599
22866
  /**
22600
22867
  * One publishable camera stream as its OWNING PROVIDER describes it — the same
@@ -25825,6 +26092,12 @@ Object.freeze({
25825
26092
  addonId: null,
25826
26093
  access: "delete"
25827
26094
  },
26095
+ "pipelineAnalytics.deleteDeviceEvents": {
26096
+ capName: "pipeline-analytics",
26097
+ capScope: "device",
26098
+ addonId: null,
26099
+ access: "delete"
26100
+ },
25828
26101
  "pipelineAnalytics.deleteTracks": {
25829
26102
  capName: "pipeline-analytics",
25830
26103
  capScope: "device",
@@ -25855,6 +26128,12 @@ Object.freeze({
25855
26128
  addonId: null,
25856
26129
  access: "view"
25857
26130
  },
26131
+ "pipelineAnalytics.getEventStoreFootprint": {
26132
+ capName: "pipeline-analytics",
26133
+ capScope: "device",
26134
+ addonId: null,
26135
+ access: "view"
26136
+ },
25858
26137
  "pipelineAnalytics.getKeyEvents": {
25859
26138
  capName: "pipeline-analytics",
25860
26139
  capScope: "device",
@@ -25897,6 +26176,12 @@ Object.freeze({
25897
26176
  addonId: null,
25898
26177
  access: "view"
25899
26178
  },
26179
+ "pipelineAnalytics.listOpsLog": {
26180
+ capName: "pipeline-analytics",
26181
+ capScope: "device",
26182
+ addonId: null,
26183
+ access: "view"
26184
+ },
25900
26185
  "pipelineAnalytics.listRecentTracks": {
25901
26186
  capName: "pipeline-analytics",
25902
26187
  capScope: "device",
@@ -25909,6 +26194,12 @@ Object.freeze({
25909
26194
  addonId: null,
25910
26195
  access: "view"
25911
26196
  },
26197
+ "pipelineAnalytics.pruneEvents": {
26198
+ capName: "pipeline-analytics",
26199
+ capScope: "device",
26200
+ addonId: null,
26201
+ access: "create"
26202
+ },
25912
26203
  "pipelineAnalytics.pruneEventsBefore": {
25913
26204
  capName: "pipeline-analytics",
25914
26205
  capScope: "device",
@@ -26671,6 +26962,12 @@ Object.freeze({
26671
26962
  addonId: null,
26672
26963
  access: "create"
26673
26964
  },
26965
+ "recording.deleteFootprint": {
26966
+ capName: "recording",
26967
+ capScope: "system",
26968
+ addonId: null,
26969
+ access: "delete"
26970
+ },
26674
26971
  "recording.getAvailability": {
26675
26972
  capName: "recording",
26676
26973
  capScope: "system",
@@ -26701,6 +26998,12 @@ Object.freeze({
26701
26998
  addonId: null,
26702
26999
  access: "view"
26703
27000
  },
27001
+ "recording.listOpsLog": {
27002
+ capName: "recording",
27003
+ capScope: "system",
27004
+ addonId: null,
27005
+ access: "view"
27006
+ },
26704
27007
  "recording.locateSegment": {
26705
27008
  capName: "recording",
26706
27009
  capScope: "system",
@@ -26731,6 +27034,42 @@ Object.freeze({
26731
27034
  addonId: null,
26732
27035
  access: "create"
26733
27036
  },
27037
+ "recordingExport.cancelExport": {
27038
+ capName: "recordingExport",
27039
+ capScope: "system",
27040
+ addonId: null,
27041
+ access: "create"
27042
+ },
27043
+ "recordingExport.createExport": {
27044
+ capName: "recordingExport",
27045
+ capScope: "system",
27046
+ addonId: null,
27047
+ access: "create"
27048
+ },
27049
+ "recordingExport.deleteExport": {
27050
+ capName: "recordingExport",
27051
+ capScope: "system",
27052
+ addonId: null,
27053
+ access: "delete"
27054
+ },
27055
+ "recordingExport.getDownloadUrl": {
27056
+ capName: "recordingExport",
27057
+ capScope: "system",
27058
+ addonId: null,
27059
+ access: "view"
27060
+ },
27061
+ "recordingExport.getExport": {
27062
+ capName: "recordingExport",
27063
+ capScope: "system",
27064
+ addonId: null,
27065
+ access: "view"
27066
+ },
27067
+ "recordingExport.listExports": {
27068
+ capName: "recordingExport",
27069
+ capScope: "system",
27070
+ addonId: null,
27071
+ access: "view"
27072
+ },
26734
27073
  "sceneMonitor.captureReference": {
26735
27074
  capName: "scene-monitor",
26736
27075
  capScope: "device",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-amcrest",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Amcrest/Dahua camera device provider addon for CamStack — Dahua CGI over HTTP(S) with digest auth (snapshot, RTSP catalog, PTZ, image/day-night config)",
5
5
  "keywords": [
6
6
  "camstack",