@camstack/addon-provider-petkit 0.1.11 → 0.1.13

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
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let crypto$1 = require("crypto");
3
3
  let events = require("events");
4
- //#region ../types/dist/event-category-H4AVePnn.mjs
4
+ //#region ../types/dist/event-category-D4HJq7Mw.mjs
5
5
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
6
6
  EventCategory["SystemBoot"] = "system.boot";
7
7
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -154,6 +154,11 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
154
154
  /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
155
155
  * thumb is a scrub gap the recorder's keyframe backfill covers. */
156
156
  EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
157
+ /** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
158
+ * progress bar the client reconciles via `recordingExport.getExport`. */
159
+ EventCategory["RecordingExportProgress"] = "recording.export.progress";
160
+ EventCategory["RecordingExportCompleted"] = "recording.export.completed";
161
+ EventCategory["RecordingExportFailed"] = "recording.export.failed";
157
162
  EventCategory["DetectionEvent"] = "detection.event";
158
163
  EventCategory["SessionTrackNew"] = "session.track.new";
159
164
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -443,6 +448,25 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
443
448
  */
444
449
  EventCategory["PipelineAnalyticsStationaryChanged"] = "pipeline-analytics.stationary-changed";
445
450
  /**
451
+ * Fired by `addon-post-analysis` when a package-drop is confirmed inside
452
+ * a package zone — a newly-appeared stationary object of a package class
453
+ * that cleared the class / zone / dwell / size gates. Payload:
454
+ * `PipelineAnalyticsPackageDeliveredPayload` carrying `{ deviceId,
455
+ * entryId, className, zoneIds, keyFrameMediaKey?, bbox, timestamp }`.
456
+ * Telemetry (D8): the durable record is the `package-events` store row;
457
+ * this bus topic drives notifier rules + live UI. See
458
+ * docs/superpowers/specs/2026-07-17-package-zones-design.md §5.1.
459
+ */
460
+ EventCategory["PipelineAnalyticsPackageDelivered"] = "pipeline-analytics.package-delivered";
461
+ /**
462
+ * Fired by `addon-post-analysis` when a previously-delivered package
463
+ * leaves its zone (the stationary entry departed — moved or swept).
464
+ * Payload: `PipelineAnalyticsPackagePickedUpPayload` carrying
465
+ * `{ deviceId, entryId, deliveredEventId, className, timestamp }`.
466
+ * Telemetry (D8). See package-zones-design §5.2.
467
+ */
468
+ EventCategory["PipelineAnalyticsPackagePickedUp"] = "pipeline-analytics.package-picked-up";
469
+ /**
446
470
  * Fired by `addon-post-analysis` whenever a gallery face row changes:
447
471
  * `kind:'buffered'` a new detected face was persisted, `'assigned'` /
448
472
  * `'unassigned'` its identity link changed, `'deleted'` the row was
@@ -5195,6 +5219,25 @@ function preprocess(fn, schema) {
5195
5219
  out: schema
5196
5220
  });
5197
5221
  }
5222
+ //#endregion
5223
+ //#region ../../node_modules/zod/v4/classic/compat.js
5224
+ /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
5225
+ var ZodIssueCode = {
5226
+ invalid_type: "invalid_type",
5227
+ too_big: "too_big",
5228
+ too_small: "too_small",
5229
+ invalid_format: "invalid_format",
5230
+ not_multiple_of: "not_multiple_of",
5231
+ unrecognized_keys: "unrecognized_keys",
5232
+ invalid_union: "invalid_union",
5233
+ invalid_key: "invalid_key",
5234
+ invalid_element: "invalid_element",
5235
+ invalid_value: "invalid_value",
5236
+ custom: "custom"
5237
+ };
5238
+ /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5239
+ var ZodFirstPartyTypeKind;
5240
+ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5198
5241
  Object.fromEntries([
5199
5242
  {
5200
5243
  id: "overview",
@@ -7317,6 +7360,62 @@ var RecordingConfigSchema = object({
7317
7360
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7318
7361
  });
7319
7362
  /**
7363
+ * Ops-log — the durable, append-only operations audit shared by the
7364
+ * recordings and events management surfaces.
7365
+ *
7366
+ * ONE row shape is reused for both domains so a single "Activity" view can
7367
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7368
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7369
+ * management operation, WHY it ran (reason), and its measurable effect
7370
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7371
+ * never fail the operation it records.
7372
+ */
7373
+ /** Which management domain the operation belongs to. */
7374
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7375
+ /** The kind of management operation performed. */
7376
+ var OpsLogOpSchema = _enum([
7377
+ "prune",
7378
+ "manual-delete",
7379
+ "rescan",
7380
+ "retention-run"
7381
+ ]);
7382
+ /** Why the operation ran. */
7383
+ var OpsLogReasonSchema = _enum([
7384
+ "retention",
7385
+ "quota",
7386
+ "manual",
7387
+ "operator"
7388
+ ]);
7389
+ /** One audit row, shared verbatim by both domains. */
7390
+ var OpsLogEntrySchema = object({
7391
+ /** Unique row id. */
7392
+ id: string(),
7393
+ /** Epoch ms the operation completed. */
7394
+ at: number(),
7395
+ domain: OpsLogDomainSchema,
7396
+ op: OpsLogOpSchema,
7397
+ reason: OpsLogReasonSchema,
7398
+ /** The camera the op targeted; null for a cluster/global op. */
7399
+ deviceId: number().nullable(),
7400
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7401
+ nodeId: string(),
7402
+ /** Buckets / rows deleted (op-specific unit). */
7403
+ itemsAffected: number(),
7404
+ /** Bytes reclaimed by the op (0 when not measurable). */
7405
+ bytesReclaimed: number(),
7406
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7407
+ detail: string().nullable(),
7408
+ /** Who/what triggered the op. */
7409
+ actor: string()
7410
+ });
7411
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7412
+ var OpsLogQueryInputSchema = object({
7413
+ /** Restrict to a single camera; omit for every row. */
7414
+ deviceId: number().optional(),
7415
+ /** Max rows returned, newest-first. */
7416
+ limit: number().int().min(1).max(1e3).optional()
7417
+ });
7418
+ /**
7320
7419
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7321
7420
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7322
7421
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -14672,7 +14771,11 @@ array(ZoneRuleSchema).readonly();
14672
14771
  * Extend the enum here when a new gating consumer comes online (audio
14673
14772
  * gating, alert filtering, …) — no other surface needs to change.
14674
14773
  */
14675
- var ZoneRuleStageEnum = _enum(["motion", "detection"]);
14774
+ var ZoneRuleStageEnum = _enum([
14775
+ "motion",
14776
+ "detection",
14777
+ "package"
14778
+ ]);
14676
14779
  /**
14677
14780
  * Runtime registry: cap-property-name → cap definition. `BaseDevice`'s
14678
14781
  * `state` getter looks up the cap definition here to construct a
@@ -14766,16 +14869,25 @@ var DEVICE_LOCAL_STATE_CAPS = {
14766
14869
  })
14767
14870
  },
14768
14871
  /**
14769
- * Runtime-state slice — both stages mirrored together so consumers
14872
+ * Runtime-state slice — every stage mirrored together so consumers
14770
14873
  * see one reactive handle (`device.state.zoneRules.value`) instead
14771
- * of two. Bulk-replace mutations on either stage write the full
14772
- * `{motion, detection}` shape, so subscribers always get the
14874
+ * of one per stage. Bulk-replace mutations on any stage write the full
14875
+ * `{motion, detection, package}` shape, so subscribers always get the
14773
14876
  * complete current set. Consumers that only care about one stage
14774
14877
  * just read the matching property.
14878
+ *
14879
+ * `package` backs the package-drop detector — a package zone is a
14880
+ * `ZoneRule` on the `'package'` stage referencing drawn polygons
14881
+ * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14882
+ * The orchestrator provider writes this stage as a first-class slice
14883
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
14884
+ * package}` shape, so consumers read the current package rules directly
14885
+ * off `device.state.zoneRules.value.package`.
14775
14886
  */
14776
14887
  runtimeState: object({
14777
14888
  motion: array(ZoneRuleSchema).readonly(),
14778
- detection: array(ZoneRuleSchema).readonly()
14889
+ detection: array(ZoneRuleSchema).readonly(),
14890
+ package: array(ZoneRuleSchema).readonly()
14779
14891
  })
14780
14892
  },
14781
14893
  zones: zonesCapability
@@ -18754,6 +18866,7 @@ var EventKindIconSchema = _enum([
18754
18866
  "smoke",
18755
18867
  "water",
18756
18868
  "button",
18869
+ "package",
18757
18870
  "generic"
18758
18871
  ]);
18759
18872
  var EventKindCategorySchema = _enum([
@@ -18761,7 +18874,8 @@ var EventKindCategorySchema = _enum([
18761
18874
  "audio",
18762
18875
  "detection",
18763
18876
  "sensor",
18764
- "custom"
18877
+ "custom",
18878
+ "package"
18765
18879
  ]);
18766
18880
  var EventKindDescriptorSchema = object({
18767
18881
  /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
@@ -19102,6 +19216,26 @@ var TrackCascadeCountsSchema = object({
19102
19216
  /** Per-track CLIP search vectors removed (best-effort). */
19103
19217
  embeddings: number().int()
19104
19218
  });
19219
+ /** Event-store footprint for one camera. */
19220
+ var EventStoreDeviceFootprintSchema = object({
19221
+ deviceId: number(),
19222
+ /** Persisted event rows (motion + object + audio) for the camera. */
19223
+ rows: number().int(),
19224
+ /** Event-owned media bytes on disk for the camera. */
19225
+ bytes: number().int()
19226
+ });
19227
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19228
+ var EventStoreFootprintSchema = object({
19229
+ totalRows: number().int(),
19230
+ totalBytes: number().int(),
19231
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19232
+ });
19233
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19234
+ var EventPruneCountsSchema = object({
19235
+ motion: number().int(),
19236
+ object: number().int(),
19237
+ audio: number().int()
19238
+ });
19105
19239
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19106
19240
  deviceId: number(),
19107
19241
  trackId: string()
@@ -19165,6 +19299,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19165
19299
  }), {
19166
19300
  kind: "mutation",
19167
19301
  auth: "admin"
19302
+ }), method(object({}), EventStoreFootprintSchema, {
19303
+ kind: "query",
19304
+ auth: "admin"
19305
+ }), method(object({
19306
+ olderThanMs: number(),
19307
+ reason: OpsLogReasonSchema.optional()
19308
+ }), EventPruneCountsSchema, {
19309
+ kind: "mutation",
19310
+ auth: "admin"
19311
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19312
+ kind: "mutation",
19313
+ auth: "admin"
19314
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19315
+ kind: "query",
19316
+ auth: "admin"
19168
19317
  }), method(object({
19169
19318
  eventId: string(),
19170
19319
  kind: MediaFileKindEnum.optional()
@@ -22398,13 +22547,131 @@ method(object({
22398
22547
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22399
22548
  kind: "mutation",
22400
22549
  auth: "admin"
22401
- }), method(object({ deviceId: number() }), object({
22550
+ }), method(object({
22551
+ deviceId: number(),
22552
+ reason: OpsLogReasonSchema.optional()
22553
+ }), object({
22402
22554
  floorMs: number().nullable(),
22403
22555
  deletedBuckets: number().int(),
22404
22556
  reclaimedBytes: number().int()
22405
22557
  }), {
22406
22558
  kind: "mutation",
22407
22559
  auth: "admin"
22560
+ }), method(object({
22561
+ deviceId: number(),
22562
+ fromMs: number().optional(),
22563
+ toMs: number().optional()
22564
+ }), object({
22565
+ deletedBuckets: number().int(),
22566
+ reclaimedBytes: number().int()
22567
+ }), {
22568
+ kind: "mutation",
22569
+ auth: "admin"
22570
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
22571
+ kind: "query",
22572
+ auth: "admin"
22573
+ });
22574
+ /**
22575
+ * `recordingExport` cap — render a footage time range into a single downloadable
22576
+ * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
22577
+ * bounded lifetime with a durable history, auto-expiry, and optional
22578
+ * delete-after-download.
22579
+ *
22580
+ * Like `recording` this is a `scope:'system', mode:'singleton'` cap: the
22581
+ * recorder self-gates so exactly ONE node (the designated `recordingNodeId`,
22582
+ * default `hub`) registers it. Device-scoped methods carry `deviceId` in their
22583
+ * input and dispatch to that single provider; the render runs on the node that
22584
+ * owns the footage (no cross-node segment transfer). Download rides the
22585
+ * framework addon data-plane. State persists in a DurableState blob (NOT
22586
+ * SQLite); history rows survive file deletion for audit.
22587
+ */
22588
+ /** Playback-speed multiplier for the render (1 = realtime). */
22589
+ var ExportSpeedSchema = number().min(.25).max(32);
22590
+ /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
22591
+ var ExportTimelapseSchema = object({
22592
+ everyMs: number().int().positive(),
22593
+ outputFps: number().int().min(1).max(60).optional()
22594
+ });
22595
+ /**
22596
+ * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
22597
+ * is honoured only for a realtime-ish speed (0.5–2×); timelapse is always
22598
+ * silent. `maxLifeMs` bounds how long the finished file is kept;
22599
+ * `deleteAfterDownload` removes it shortly after the first complete download.
22600
+ */
22601
+ var ExportOptionsSchema = object({
22602
+ speed: ExportSpeedSchema.optional(),
22603
+ timelapse: ExportTimelapseSchema.optional(),
22604
+ includeAudio: boolean(),
22605
+ maxLifeMs: number().int().positive(),
22606
+ deleteAfterDownload: boolean(),
22607
+ title: string().max(200).optional()
22608
+ }).superRefine((v, ctx) => {
22609
+ if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
22610
+ code: ZodIssueCode.custom,
22611
+ message: "speed and timelapse are mutually exclusive",
22612
+ path: ["timelapse"]
22613
+ });
22614
+ });
22615
+ var ExportStateSchema = _enum([
22616
+ "queued",
22617
+ "rendering",
22618
+ "ready",
22619
+ "failed",
22620
+ "expired",
22621
+ "deleted"
22622
+ ]);
22623
+ /** One export job / history row. */
22624
+ var ExportRecordSchema = object({
22625
+ id: string(),
22626
+ deviceId: number(),
22627
+ profile: string(),
22628
+ fromMs: number(),
22629
+ toMs: number(),
22630
+ options: ExportOptionsSchema,
22631
+ state: ExportStateSchema,
22632
+ /** 0–100 while rendering; null otherwise. */
22633
+ progressPct: number().nullable(),
22634
+ /** File size once ready; null before. */
22635
+ fileBytes: number().nullable(),
22636
+ expiresAt: number(),
22637
+ deleteAfterDownload: boolean(),
22638
+ /** Epoch of the first complete download; null until then. */
22639
+ downloadedAt: number().nullable(),
22640
+ createdAt: number(),
22641
+ /** User id/name that requested the export. */
22642
+ createdBy: string(),
22643
+ /** Failure reason when state is 'failed'; null otherwise. */
22644
+ error: string().nullable()
22645
+ });
22646
+ /** Candidate download URLs (LAN first, then operator extra hosts). */
22647
+ var ExportDownloadSchema = object({
22648
+ url: string(),
22649
+ endpoints: array(string())
22650
+ });
22651
+ method(object({
22652
+ deviceId: number(),
22653
+ profile: string(),
22654
+ fromMs: number(),
22655
+ toMs: number(),
22656
+ options: ExportOptionsSchema
22657
+ }), ExportRecordSchema, {
22658
+ kind: "mutation",
22659
+ auth: "protected"
22660
+ }), method(object({ deviceId: number().optional() }), array(ExportRecordSchema), {
22661
+ kind: "query",
22662
+ auth: "protected"
22663
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22664
+ kind: "query",
22665
+ auth: "protected"
22666
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22667
+ kind: "mutation",
22668
+ auth: "protected"
22669
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22670
+ kind: "mutation",
22671
+ auth: "protected"
22672
+ }), method(object({ exportId: string() }), ExportDownloadSchema, {
22673
+ kind: "query",
22674
+ auth: "protected"
22408
22675
  });
22409
22676
  /**
22410
22677
  * One publishable camera stream as its OWNING PROVIDER describes it — the same
@@ -25424,6 +25691,12 @@ Object.freeze({
25424
25691
  addonId: null,
25425
25692
  access: "delete"
25426
25693
  },
25694
+ "pipelineAnalytics.deleteDeviceEvents": {
25695
+ capName: "pipeline-analytics",
25696
+ capScope: "device",
25697
+ addonId: null,
25698
+ access: "delete"
25699
+ },
25427
25700
  "pipelineAnalytics.deleteTracks": {
25428
25701
  capName: "pipeline-analytics",
25429
25702
  capScope: "device",
@@ -25454,6 +25727,12 @@ Object.freeze({
25454
25727
  addonId: null,
25455
25728
  access: "view"
25456
25729
  },
25730
+ "pipelineAnalytics.getEventStoreFootprint": {
25731
+ capName: "pipeline-analytics",
25732
+ capScope: "device",
25733
+ addonId: null,
25734
+ access: "view"
25735
+ },
25457
25736
  "pipelineAnalytics.getKeyEvents": {
25458
25737
  capName: "pipeline-analytics",
25459
25738
  capScope: "device",
@@ -25496,6 +25775,12 @@ Object.freeze({
25496
25775
  addonId: null,
25497
25776
  access: "view"
25498
25777
  },
25778
+ "pipelineAnalytics.listOpsLog": {
25779
+ capName: "pipeline-analytics",
25780
+ capScope: "device",
25781
+ addonId: null,
25782
+ access: "view"
25783
+ },
25499
25784
  "pipelineAnalytics.listRecentTracks": {
25500
25785
  capName: "pipeline-analytics",
25501
25786
  capScope: "device",
@@ -25508,6 +25793,12 @@ Object.freeze({
25508
25793
  addonId: null,
25509
25794
  access: "view"
25510
25795
  },
25796
+ "pipelineAnalytics.pruneEvents": {
25797
+ capName: "pipeline-analytics",
25798
+ capScope: "device",
25799
+ addonId: null,
25800
+ access: "create"
25801
+ },
25511
25802
  "pipelineAnalytics.pruneEventsBefore": {
25512
25803
  capName: "pipeline-analytics",
25513
25804
  capScope: "device",
@@ -26270,6 +26561,12 @@ Object.freeze({
26270
26561
  addonId: null,
26271
26562
  access: "create"
26272
26563
  },
26564
+ "recording.deleteFootprint": {
26565
+ capName: "recording",
26566
+ capScope: "system",
26567
+ addonId: null,
26568
+ access: "delete"
26569
+ },
26273
26570
  "recording.getAvailability": {
26274
26571
  capName: "recording",
26275
26572
  capScope: "system",
@@ -26300,6 +26597,12 @@ Object.freeze({
26300
26597
  addonId: null,
26301
26598
  access: "view"
26302
26599
  },
26600
+ "recording.listOpsLog": {
26601
+ capName: "recording",
26602
+ capScope: "system",
26603
+ addonId: null,
26604
+ access: "view"
26605
+ },
26303
26606
  "recording.locateSegment": {
26304
26607
  capName: "recording",
26305
26608
  capScope: "system",
@@ -26330,6 +26633,42 @@ Object.freeze({
26330
26633
  addonId: null,
26331
26634
  access: "create"
26332
26635
  },
26636
+ "recordingExport.cancelExport": {
26637
+ capName: "recordingExport",
26638
+ capScope: "system",
26639
+ addonId: null,
26640
+ access: "create"
26641
+ },
26642
+ "recordingExport.createExport": {
26643
+ capName: "recordingExport",
26644
+ capScope: "system",
26645
+ addonId: null,
26646
+ access: "create"
26647
+ },
26648
+ "recordingExport.deleteExport": {
26649
+ capName: "recordingExport",
26650
+ capScope: "system",
26651
+ addonId: null,
26652
+ access: "delete"
26653
+ },
26654
+ "recordingExport.getDownloadUrl": {
26655
+ capName: "recordingExport",
26656
+ capScope: "system",
26657
+ addonId: null,
26658
+ access: "view"
26659
+ },
26660
+ "recordingExport.getExport": {
26661
+ capName: "recordingExport",
26662
+ capScope: "system",
26663
+ addonId: null,
26664
+ access: "view"
26665
+ },
26666
+ "recordingExport.listExports": {
26667
+ capName: "recordingExport",
26668
+ capScope: "system",
26669
+ addonId: null,
26670
+ access: "view"
26671
+ },
26333
26672
  "sceneMonitor.captureReference": {
26334
26673
  capName: "scene-monitor",
26335
26674
  capScope: "device",
package/dist/addon.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createHash } from "crypto";
2
2
  import { EventEmitter } from "events";
3
- //#region ../types/dist/event-category-H4AVePnn.mjs
3
+ //#region ../types/dist/event-category-D4HJq7Mw.mjs
4
4
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
5
5
  EventCategory["SystemBoot"] = "system.boot";
6
6
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -153,6 +153,11 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
153
153
  /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
154
154
  * thumb is a scrub gap the recorder's keyframe backfill covers. */
155
155
  EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
156
+ /** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
157
+ * progress bar the client reconciles via `recordingExport.getExport`. */
158
+ EventCategory["RecordingExportProgress"] = "recording.export.progress";
159
+ EventCategory["RecordingExportCompleted"] = "recording.export.completed";
160
+ EventCategory["RecordingExportFailed"] = "recording.export.failed";
156
161
  EventCategory["DetectionEvent"] = "detection.event";
157
162
  EventCategory["SessionTrackNew"] = "session.track.new";
158
163
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -442,6 +447,25 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
442
447
  */
443
448
  EventCategory["PipelineAnalyticsStationaryChanged"] = "pipeline-analytics.stationary-changed";
444
449
  /**
450
+ * Fired by `addon-post-analysis` when a package-drop is confirmed inside
451
+ * a package zone — a newly-appeared stationary object of a package class
452
+ * that cleared the class / zone / dwell / size gates. Payload:
453
+ * `PipelineAnalyticsPackageDeliveredPayload` carrying `{ deviceId,
454
+ * entryId, className, zoneIds, keyFrameMediaKey?, bbox, timestamp }`.
455
+ * Telemetry (D8): the durable record is the `package-events` store row;
456
+ * this bus topic drives notifier rules + live UI. See
457
+ * docs/superpowers/specs/2026-07-17-package-zones-design.md §5.1.
458
+ */
459
+ EventCategory["PipelineAnalyticsPackageDelivered"] = "pipeline-analytics.package-delivered";
460
+ /**
461
+ * Fired by `addon-post-analysis` when a previously-delivered package
462
+ * leaves its zone (the stationary entry departed — moved or swept).
463
+ * Payload: `PipelineAnalyticsPackagePickedUpPayload` carrying
464
+ * `{ deviceId, entryId, deliveredEventId, className, timestamp }`.
465
+ * Telemetry (D8). See package-zones-design §5.2.
466
+ */
467
+ EventCategory["PipelineAnalyticsPackagePickedUp"] = "pipeline-analytics.package-picked-up";
468
+ /**
445
469
  * Fired by `addon-post-analysis` whenever a gallery face row changes:
446
470
  * `kind:'buffered'` a new detected face was persisted, `'assigned'` /
447
471
  * `'unassigned'` its identity link changed, `'deleted'` the row was
@@ -5194,6 +5218,25 @@ function preprocess(fn, schema) {
5194
5218
  out: schema
5195
5219
  });
5196
5220
  }
5221
+ //#endregion
5222
+ //#region ../../node_modules/zod/v4/classic/compat.js
5223
+ /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
5224
+ var ZodIssueCode = {
5225
+ invalid_type: "invalid_type",
5226
+ too_big: "too_big",
5227
+ too_small: "too_small",
5228
+ invalid_format: "invalid_format",
5229
+ not_multiple_of: "not_multiple_of",
5230
+ unrecognized_keys: "unrecognized_keys",
5231
+ invalid_union: "invalid_union",
5232
+ invalid_key: "invalid_key",
5233
+ invalid_element: "invalid_element",
5234
+ invalid_value: "invalid_value",
5235
+ custom: "custom"
5236
+ };
5237
+ /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5238
+ var ZodFirstPartyTypeKind;
5239
+ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5197
5240
  Object.fromEntries([
5198
5241
  {
5199
5242
  id: "overview",
@@ -7316,6 +7359,62 @@ var RecordingConfigSchema = object({
7316
7359
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7317
7360
  });
7318
7361
  /**
7362
+ * Ops-log — the durable, append-only operations audit shared by the
7363
+ * recordings and events management surfaces.
7364
+ *
7365
+ * ONE row shape is reused for both domains so a single "Activity" view can
7366
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7367
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7368
+ * management operation, WHY it ran (reason), and its measurable effect
7369
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7370
+ * never fail the operation it records.
7371
+ */
7372
+ /** Which management domain the operation belongs to. */
7373
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7374
+ /** The kind of management operation performed. */
7375
+ var OpsLogOpSchema = _enum([
7376
+ "prune",
7377
+ "manual-delete",
7378
+ "rescan",
7379
+ "retention-run"
7380
+ ]);
7381
+ /** Why the operation ran. */
7382
+ var OpsLogReasonSchema = _enum([
7383
+ "retention",
7384
+ "quota",
7385
+ "manual",
7386
+ "operator"
7387
+ ]);
7388
+ /** One audit row, shared verbatim by both domains. */
7389
+ var OpsLogEntrySchema = object({
7390
+ /** Unique row id. */
7391
+ id: string(),
7392
+ /** Epoch ms the operation completed. */
7393
+ at: number(),
7394
+ domain: OpsLogDomainSchema,
7395
+ op: OpsLogOpSchema,
7396
+ reason: OpsLogReasonSchema,
7397
+ /** The camera the op targeted; null for a cluster/global op. */
7398
+ deviceId: number().nullable(),
7399
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7400
+ nodeId: string(),
7401
+ /** Buckets / rows deleted (op-specific unit). */
7402
+ itemsAffected: number(),
7403
+ /** Bytes reclaimed by the op (0 when not measurable). */
7404
+ bytesReclaimed: number(),
7405
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7406
+ detail: string().nullable(),
7407
+ /** Who/what triggered the op. */
7408
+ actor: string()
7409
+ });
7410
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7411
+ var OpsLogQueryInputSchema = object({
7412
+ /** Restrict to a single camera; omit for every row. */
7413
+ deviceId: number().optional(),
7414
+ /** Max rows returned, newest-first. */
7415
+ limit: number().int().min(1).max(1e3).optional()
7416
+ });
7417
+ /**
7319
7418
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7320
7419
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7321
7420
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -14671,7 +14770,11 @@ array(ZoneRuleSchema).readonly();
14671
14770
  * Extend the enum here when a new gating consumer comes online (audio
14672
14771
  * gating, alert filtering, …) — no other surface needs to change.
14673
14772
  */
14674
- var ZoneRuleStageEnum = _enum(["motion", "detection"]);
14773
+ var ZoneRuleStageEnum = _enum([
14774
+ "motion",
14775
+ "detection",
14776
+ "package"
14777
+ ]);
14675
14778
  /**
14676
14779
  * Runtime registry: cap-property-name → cap definition. `BaseDevice`'s
14677
14780
  * `state` getter looks up the cap definition here to construct a
@@ -14765,16 +14868,25 @@ var DEVICE_LOCAL_STATE_CAPS = {
14765
14868
  })
14766
14869
  },
14767
14870
  /**
14768
- * Runtime-state slice — both stages mirrored together so consumers
14871
+ * Runtime-state slice — every stage mirrored together so consumers
14769
14872
  * see one reactive handle (`device.state.zoneRules.value`) instead
14770
- * of two. Bulk-replace mutations on either stage write the full
14771
- * `{motion, detection}` shape, so subscribers always get the
14873
+ * of one per stage. Bulk-replace mutations on any stage write the full
14874
+ * `{motion, detection, package}` shape, so subscribers always get the
14772
14875
  * complete current set. Consumers that only care about one stage
14773
14876
  * just read the matching property.
14877
+ *
14878
+ * `package` backs the package-drop detector — a package zone is a
14879
+ * `ZoneRule` on the `'package'` stage referencing drawn polygons
14880
+ * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14881
+ * The orchestrator provider writes this stage as a first-class slice
14882
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
14883
+ * package}` shape, so consumers read the current package rules directly
14884
+ * off `device.state.zoneRules.value.package`.
14774
14885
  */
14775
14886
  runtimeState: object({
14776
14887
  motion: array(ZoneRuleSchema).readonly(),
14777
- detection: array(ZoneRuleSchema).readonly()
14888
+ detection: array(ZoneRuleSchema).readonly(),
14889
+ package: array(ZoneRuleSchema).readonly()
14778
14890
  })
14779
14891
  },
14780
14892
  zones: zonesCapability
@@ -18753,6 +18865,7 @@ var EventKindIconSchema = _enum([
18753
18865
  "smoke",
18754
18866
  "water",
18755
18867
  "button",
18868
+ "package",
18756
18869
  "generic"
18757
18870
  ]);
18758
18871
  var EventKindCategorySchema = _enum([
@@ -18760,7 +18873,8 @@ var EventKindCategorySchema = _enum([
18760
18873
  "audio",
18761
18874
  "detection",
18762
18875
  "sensor",
18763
- "custom"
18876
+ "custom",
18877
+ "package"
18764
18878
  ]);
18765
18879
  var EventKindDescriptorSchema = object({
18766
18880
  /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
@@ -19101,6 +19215,26 @@ var TrackCascadeCountsSchema = object({
19101
19215
  /** Per-track CLIP search vectors removed (best-effort). */
19102
19216
  embeddings: number().int()
19103
19217
  });
19218
+ /** Event-store footprint for one camera. */
19219
+ var EventStoreDeviceFootprintSchema = object({
19220
+ deviceId: number(),
19221
+ /** Persisted event rows (motion + object + audio) for the camera. */
19222
+ rows: number().int(),
19223
+ /** Event-owned media bytes on disk for the camera. */
19224
+ bytes: number().int()
19225
+ });
19226
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19227
+ var EventStoreFootprintSchema = object({
19228
+ totalRows: number().int(),
19229
+ totalBytes: number().int(),
19230
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19231
+ });
19232
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19233
+ var EventPruneCountsSchema = object({
19234
+ motion: number().int(),
19235
+ object: number().int(),
19236
+ audio: number().int()
19237
+ });
19104
19238
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19105
19239
  deviceId: number(),
19106
19240
  trackId: string()
@@ -19164,6 +19298,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19164
19298
  }), {
19165
19299
  kind: "mutation",
19166
19300
  auth: "admin"
19301
+ }), method(object({}), EventStoreFootprintSchema, {
19302
+ kind: "query",
19303
+ auth: "admin"
19304
+ }), method(object({
19305
+ olderThanMs: number(),
19306
+ reason: OpsLogReasonSchema.optional()
19307
+ }), EventPruneCountsSchema, {
19308
+ kind: "mutation",
19309
+ auth: "admin"
19310
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19311
+ kind: "mutation",
19312
+ auth: "admin"
19313
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19314
+ kind: "query",
19315
+ auth: "admin"
19167
19316
  }), method(object({
19168
19317
  eventId: string(),
19169
19318
  kind: MediaFileKindEnum.optional()
@@ -22397,13 +22546,131 @@ method(object({
22397
22546
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22398
22547
  kind: "mutation",
22399
22548
  auth: "admin"
22400
- }), method(object({ deviceId: number() }), object({
22549
+ }), method(object({
22550
+ deviceId: number(),
22551
+ reason: OpsLogReasonSchema.optional()
22552
+ }), object({
22401
22553
  floorMs: number().nullable(),
22402
22554
  deletedBuckets: number().int(),
22403
22555
  reclaimedBytes: number().int()
22404
22556
  }), {
22405
22557
  kind: "mutation",
22406
22558
  auth: "admin"
22559
+ }), method(object({
22560
+ deviceId: number(),
22561
+ fromMs: number().optional(),
22562
+ toMs: number().optional()
22563
+ }), object({
22564
+ deletedBuckets: number().int(),
22565
+ reclaimedBytes: number().int()
22566
+ }), {
22567
+ kind: "mutation",
22568
+ auth: "admin"
22569
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
22570
+ kind: "query",
22571
+ auth: "admin"
22572
+ });
22573
+ /**
22574
+ * `recordingExport` cap — render a footage time range into a single downloadable
22575
+ * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
22576
+ * bounded lifetime with a durable history, auto-expiry, and optional
22577
+ * delete-after-download.
22578
+ *
22579
+ * Like `recording` this is a `scope:'system', mode:'singleton'` cap: the
22580
+ * recorder self-gates so exactly ONE node (the designated `recordingNodeId`,
22581
+ * default `hub`) registers it. Device-scoped methods carry `deviceId` in their
22582
+ * input and dispatch to that single provider; the render runs on the node that
22583
+ * owns the footage (no cross-node segment transfer). Download rides the
22584
+ * framework addon data-plane. State persists in a DurableState blob (NOT
22585
+ * SQLite); history rows survive file deletion for audit.
22586
+ */
22587
+ /** Playback-speed multiplier for the render (1 = realtime). */
22588
+ var ExportSpeedSchema = number().min(.25).max(32);
22589
+ /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
22590
+ var ExportTimelapseSchema = object({
22591
+ everyMs: number().int().positive(),
22592
+ outputFps: number().int().min(1).max(60).optional()
22593
+ });
22594
+ /**
22595
+ * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
22596
+ * is honoured only for a realtime-ish speed (0.5–2×); timelapse is always
22597
+ * silent. `maxLifeMs` bounds how long the finished file is kept;
22598
+ * `deleteAfterDownload` removes it shortly after the first complete download.
22599
+ */
22600
+ var ExportOptionsSchema = object({
22601
+ speed: ExportSpeedSchema.optional(),
22602
+ timelapse: ExportTimelapseSchema.optional(),
22603
+ includeAudio: boolean(),
22604
+ maxLifeMs: number().int().positive(),
22605
+ deleteAfterDownload: boolean(),
22606
+ title: string().max(200).optional()
22607
+ }).superRefine((v, ctx) => {
22608
+ if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
22609
+ code: ZodIssueCode.custom,
22610
+ message: "speed and timelapse are mutually exclusive",
22611
+ path: ["timelapse"]
22612
+ });
22613
+ });
22614
+ var ExportStateSchema = _enum([
22615
+ "queued",
22616
+ "rendering",
22617
+ "ready",
22618
+ "failed",
22619
+ "expired",
22620
+ "deleted"
22621
+ ]);
22622
+ /** One export job / history row. */
22623
+ var ExportRecordSchema = object({
22624
+ id: string(),
22625
+ deviceId: number(),
22626
+ profile: string(),
22627
+ fromMs: number(),
22628
+ toMs: number(),
22629
+ options: ExportOptionsSchema,
22630
+ state: ExportStateSchema,
22631
+ /** 0–100 while rendering; null otherwise. */
22632
+ progressPct: number().nullable(),
22633
+ /** File size once ready; null before. */
22634
+ fileBytes: number().nullable(),
22635
+ expiresAt: number(),
22636
+ deleteAfterDownload: boolean(),
22637
+ /** Epoch of the first complete download; null until then. */
22638
+ downloadedAt: number().nullable(),
22639
+ createdAt: number(),
22640
+ /** User id/name that requested the export. */
22641
+ createdBy: string(),
22642
+ /** Failure reason when state is 'failed'; null otherwise. */
22643
+ error: string().nullable()
22644
+ });
22645
+ /** Candidate download URLs (LAN first, then operator extra hosts). */
22646
+ var ExportDownloadSchema = object({
22647
+ url: string(),
22648
+ endpoints: array(string())
22649
+ });
22650
+ method(object({
22651
+ deviceId: number(),
22652
+ profile: string(),
22653
+ fromMs: number(),
22654
+ toMs: number(),
22655
+ options: ExportOptionsSchema
22656
+ }), ExportRecordSchema, {
22657
+ kind: "mutation",
22658
+ auth: "protected"
22659
+ }), method(object({ deviceId: number().optional() }), array(ExportRecordSchema), {
22660
+ kind: "query",
22661
+ auth: "protected"
22662
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22663
+ kind: "query",
22664
+ auth: "protected"
22665
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22666
+ kind: "mutation",
22667
+ auth: "protected"
22668
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22669
+ kind: "mutation",
22670
+ auth: "protected"
22671
+ }), method(object({ exportId: string() }), ExportDownloadSchema, {
22672
+ kind: "query",
22673
+ auth: "protected"
22407
22674
  });
22408
22675
  /**
22409
22676
  * One publishable camera stream as its OWNING PROVIDER describes it — the same
@@ -25423,6 +25690,12 @@ Object.freeze({
25423
25690
  addonId: null,
25424
25691
  access: "delete"
25425
25692
  },
25693
+ "pipelineAnalytics.deleteDeviceEvents": {
25694
+ capName: "pipeline-analytics",
25695
+ capScope: "device",
25696
+ addonId: null,
25697
+ access: "delete"
25698
+ },
25426
25699
  "pipelineAnalytics.deleteTracks": {
25427
25700
  capName: "pipeline-analytics",
25428
25701
  capScope: "device",
@@ -25453,6 +25726,12 @@ Object.freeze({
25453
25726
  addonId: null,
25454
25727
  access: "view"
25455
25728
  },
25729
+ "pipelineAnalytics.getEventStoreFootprint": {
25730
+ capName: "pipeline-analytics",
25731
+ capScope: "device",
25732
+ addonId: null,
25733
+ access: "view"
25734
+ },
25456
25735
  "pipelineAnalytics.getKeyEvents": {
25457
25736
  capName: "pipeline-analytics",
25458
25737
  capScope: "device",
@@ -25495,6 +25774,12 @@ Object.freeze({
25495
25774
  addonId: null,
25496
25775
  access: "view"
25497
25776
  },
25777
+ "pipelineAnalytics.listOpsLog": {
25778
+ capName: "pipeline-analytics",
25779
+ capScope: "device",
25780
+ addonId: null,
25781
+ access: "view"
25782
+ },
25498
25783
  "pipelineAnalytics.listRecentTracks": {
25499
25784
  capName: "pipeline-analytics",
25500
25785
  capScope: "device",
@@ -25507,6 +25792,12 @@ Object.freeze({
25507
25792
  addonId: null,
25508
25793
  access: "view"
25509
25794
  },
25795
+ "pipelineAnalytics.pruneEvents": {
25796
+ capName: "pipeline-analytics",
25797
+ capScope: "device",
25798
+ addonId: null,
25799
+ access: "create"
25800
+ },
25510
25801
  "pipelineAnalytics.pruneEventsBefore": {
25511
25802
  capName: "pipeline-analytics",
25512
25803
  capScope: "device",
@@ -26269,6 +26560,12 @@ Object.freeze({
26269
26560
  addonId: null,
26270
26561
  access: "create"
26271
26562
  },
26563
+ "recording.deleteFootprint": {
26564
+ capName: "recording",
26565
+ capScope: "system",
26566
+ addonId: null,
26567
+ access: "delete"
26568
+ },
26272
26569
  "recording.getAvailability": {
26273
26570
  capName: "recording",
26274
26571
  capScope: "system",
@@ -26299,6 +26596,12 @@ Object.freeze({
26299
26596
  addonId: null,
26300
26597
  access: "view"
26301
26598
  },
26599
+ "recording.listOpsLog": {
26600
+ capName: "recording",
26601
+ capScope: "system",
26602
+ addonId: null,
26603
+ access: "view"
26604
+ },
26302
26605
  "recording.locateSegment": {
26303
26606
  capName: "recording",
26304
26607
  capScope: "system",
@@ -26329,6 +26632,42 @@ Object.freeze({
26329
26632
  addonId: null,
26330
26633
  access: "create"
26331
26634
  },
26635
+ "recordingExport.cancelExport": {
26636
+ capName: "recordingExport",
26637
+ capScope: "system",
26638
+ addonId: null,
26639
+ access: "create"
26640
+ },
26641
+ "recordingExport.createExport": {
26642
+ capName: "recordingExport",
26643
+ capScope: "system",
26644
+ addonId: null,
26645
+ access: "create"
26646
+ },
26647
+ "recordingExport.deleteExport": {
26648
+ capName: "recordingExport",
26649
+ capScope: "system",
26650
+ addonId: null,
26651
+ access: "delete"
26652
+ },
26653
+ "recordingExport.getDownloadUrl": {
26654
+ capName: "recordingExport",
26655
+ capScope: "system",
26656
+ addonId: null,
26657
+ access: "view"
26658
+ },
26659
+ "recordingExport.getExport": {
26660
+ capName: "recordingExport",
26661
+ capScope: "system",
26662
+ addonId: null,
26663
+ access: "view"
26664
+ },
26665
+ "recordingExport.listExports": {
26666
+ capName: "recordingExport",
26667
+ capScope: "system",
26668
+ addonId: null,
26669
+ access: "view"
26670
+ },
26332
26671
  "sceneMonitor.captureReference": {
26333
26672
  capName: "scene-monitor",
26334
26673
  capScope: "device",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-petkit",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "PetKit smart-feeder device-provider addon for CamStack — wraps the @apocaliss92/nodepetkit PetKit cloud client",
5
5
  "keywords": [
6
6
  "camstack",