@camstack/addon-provider-tuya 0.1.10 → 0.1.12

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
@@ -3,7 +3,7 @@ let crypto$1 = require("crypto");
3
3
  let net = require("net");
4
4
  let events = require("events");
5
5
  let dgram = require("dgram");
6
- //#region ../types/dist/event-category-H4AVePnn.mjs
6
+ //#region ../types/dist/event-category-D4HJq7Mw.mjs
7
7
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
8
8
  EventCategory["SystemBoot"] = "system.boot";
9
9
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -156,6 +156,11 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
156
156
  /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
157
157
  * thumb is a scrub gap the recorder's keyframe backfill covers. */
158
158
  EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
159
+ /** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
160
+ * progress bar the client reconciles via `recordingExport.getExport`. */
161
+ EventCategory["RecordingExportProgress"] = "recording.export.progress";
162
+ EventCategory["RecordingExportCompleted"] = "recording.export.completed";
163
+ EventCategory["RecordingExportFailed"] = "recording.export.failed";
159
164
  EventCategory["DetectionEvent"] = "detection.event";
160
165
  EventCategory["SessionTrackNew"] = "session.track.new";
161
166
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -445,6 +450,25 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
445
450
  */
446
451
  EventCategory["PipelineAnalyticsStationaryChanged"] = "pipeline-analytics.stationary-changed";
447
452
  /**
453
+ * Fired by `addon-post-analysis` when a package-drop is confirmed inside
454
+ * a package zone — a newly-appeared stationary object of a package class
455
+ * that cleared the class / zone / dwell / size gates. Payload:
456
+ * `PipelineAnalyticsPackageDeliveredPayload` carrying `{ deviceId,
457
+ * entryId, className, zoneIds, keyFrameMediaKey?, bbox, timestamp }`.
458
+ * Telemetry (D8): the durable record is the `package-events` store row;
459
+ * this bus topic drives notifier rules + live UI. See
460
+ * docs/superpowers/specs/2026-07-17-package-zones-design.md §5.1.
461
+ */
462
+ EventCategory["PipelineAnalyticsPackageDelivered"] = "pipeline-analytics.package-delivered";
463
+ /**
464
+ * Fired by `addon-post-analysis` when a previously-delivered package
465
+ * leaves its zone (the stationary entry departed — moved or swept).
466
+ * Payload: `PipelineAnalyticsPackagePickedUpPayload` carrying
467
+ * `{ deviceId, entryId, deliveredEventId, className, timestamp }`.
468
+ * Telemetry (D8). See package-zones-design §5.2.
469
+ */
470
+ EventCategory["PipelineAnalyticsPackagePickedUp"] = "pipeline-analytics.package-picked-up";
471
+ /**
448
472
  * Fired by `addon-post-analysis` whenever a gallery face row changes:
449
473
  * `kind:'buffered'` a new detected face was persisted, `'assigned'` /
450
474
  * `'unassigned'` its identity link changed, `'deleted'` the row was
@@ -5197,6 +5221,25 @@ function preprocess(fn, schema) {
5197
5221
  out: schema
5198
5222
  });
5199
5223
  }
5224
+ //#endregion
5225
+ //#region ../../node_modules/zod/v4/classic/compat.js
5226
+ /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
5227
+ var ZodIssueCode = {
5228
+ invalid_type: "invalid_type",
5229
+ too_big: "too_big",
5230
+ too_small: "too_small",
5231
+ invalid_format: "invalid_format",
5232
+ not_multiple_of: "not_multiple_of",
5233
+ unrecognized_keys: "unrecognized_keys",
5234
+ invalid_union: "invalid_union",
5235
+ invalid_key: "invalid_key",
5236
+ invalid_element: "invalid_element",
5237
+ invalid_value: "invalid_value",
5238
+ custom: "custom"
5239
+ };
5240
+ /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5241
+ var ZodFirstPartyTypeKind;
5242
+ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5200
5243
  Object.fromEntries([
5201
5244
  {
5202
5245
  id: "overview",
@@ -7255,6 +7298,24 @@ var RecordingRetentionSchema = object({
7255
7298
  maxSizeGb: number().min(0).optional()
7256
7299
  });
7257
7300
  /**
7301
+ * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7302
+ * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7303
+ * previews at. Five graduated steps; absent on a config = `standard` (the
7304
+ * shipped default, matching `sheet-geometry`/`sheet-composer`).
7305
+ *
7306
+ * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7307
+ * Each window's index sidecar carries its own tile dims, so a camera whose
7308
+ * preset changed over time renders every historical window at the dims it was
7309
+ * written with.
7310
+ */
7311
+ var ScrubThumbnailPresetSchema = _enum([
7312
+ "minimal",
7313
+ "low",
7314
+ "standard",
7315
+ "high",
7316
+ "max"
7317
+ ]);
7318
+ /**
7258
7319
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7259
7320
  *
7260
7321
  * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
@@ -7291,7 +7352,14 @@ var RecordingConfigSchema = object({
7291
7352
  * derived into bands once via `migrateConfigToBands`.
7292
7353
  */
7293
7354
  bands: array(RecordingBandSchema).optional(),
7294
- retention: RecordingRetentionSchema.optional()
7355
+ retention: RecordingRetentionSchema.optional(),
7356
+ /**
7357
+ * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7358
+ * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7359
+ * windows only — existing sheets are immutable, and each window's index
7360
+ * carries its own tile dims so mixed-preset history renders correctly.
7361
+ */
7362
+ scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7295
7363
  });
7296
7364
  /**
7297
7365
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -14649,7 +14717,11 @@ array(ZoneRuleSchema).readonly();
14649
14717
  * Extend the enum here when a new gating consumer comes online (audio
14650
14718
  * gating, alert filtering, …) — no other surface needs to change.
14651
14719
  */
14652
- var ZoneRuleStageEnum = _enum(["motion", "detection"]);
14720
+ var ZoneRuleStageEnum = _enum([
14721
+ "motion",
14722
+ "detection",
14723
+ "package"
14724
+ ]);
14653
14725
  /**
14654
14726
  * Runtime registry: cap-property-name → cap definition. `BaseDevice`'s
14655
14727
  * `state` getter looks up the cap definition here to construct a
@@ -14743,16 +14815,24 @@ var DEVICE_LOCAL_STATE_CAPS = {
14743
14815
  })
14744
14816
  },
14745
14817
  /**
14746
- * Runtime-state slice — both stages mirrored together so consumers
14818
+ * Runtime-state slice — every stage mirrored together so consumers
14747
14819
  * see one reactive handle (`device.state.zoneRules.value`) instead
14748
- * of two. Bulk-replace mutations on either stage write the full
14749
- * `{motion, detection}` shape, so subscribers always get the
14820
+ * of one per stage. Bulk-replace mutations on any stage write the full
14821
+ * `{motion, detection, package}` shape, so subscribers always get the
14750
14822
  * complete current set. Consumers that only care about one stage
14751
14823
  * just read the matching property.
14824
+ *
14825
+ * `package` backs the package-drop detector — a package zone is a
14826
+ * `ZoneRule` on the `'package'` stage referencing drawn polygons
14827
+ * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14828
+ * The orchestrator provider that writes this stage lands in a later
14829
+ * slice; until then the mirror carries only `{motion, detection}` and
14830
+ * consumers read `package` as absent (treat as `[]`).
14752
14831
  */
14753
14832
  runtimeState: object({
14754
14833
  motion: array(ZoneRuleSchema).readonly(),
14755
- detection: array(ZoneRuleSchema).readonly()
14834
+ detection: array(ZoneRuleSchema).readonly(),
14835
+ package: array(ZoneRuleSchema).readonly()
14756
14836
  })
14757
14837
  },
14758
14838
  zones: zonesCapability
@@ -18731,6 +18811,7 @@ var EventKindIconSchema = _enum([
18731
18811
  "smoke",
18732
18812
  "water",
18733
18813
  "button",
18814
+ "package",
18734
18815
  "generic"
18735
18816
  ]);
18736
18817
  var EventKindCategorySchema = _enum([
@@ -18738,7 +18819,8 @@ var EventKindCategorySchema = _enum([
18738
18819
  "audio",
18739
18820
  "detection",
18740
18821
  "sensor",
18741
- "custom"
18822
+ "custom",
18823
+ "package"
18742
18824
  ]);
18743
18825
  var EventKindDescriptorSchema = object({
18744
18826
  /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
@@ -22384,6 +22466,108 @@ method(object({
22384
22466
  auth: "admin"
22385
22467
  });
22386
22468
  /**
22469
+ * `recordingExport` cap — render a footage time range into a single downloadable
22470
+ * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
22471
+ * bounded lifetime with a durable history, auto-expiry, and optional
22472
+ * delete-after-download.
22473
+ *
22474
+ * Like `recording` this is a `scope:'system', mode:'singleton'` cap: the
22475
+ * recorder self-gates so exactly ONE node (the designated `recordingNodeId`,
22476
+ * default `hub`) registers it. Device-scoped methods carry `deviceId` in their
22477
+ * input and dispatch to that single provider; the render runs on the node that
22478
+ * owns the footage (no cross-node segment transfer). Download rides the
22479
+ * framework addon data-plane. State persists in a DurableState blob (NOT
22480
+ * SQLite); history rows survive file deletion for audit.
22481
+ */
22482
+ /** Playback-speed multiplier for the render (1 = realtime). */
22483
+ var ExportSpeedSchema = number().min(.25).max(32);
22484
+ /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
22485
+ var ExportTimelapseSchema = object({
22486
+ everyMs: number().int().positive(),
22487
+ outputFps: number().int().min(1).max(60).optional()
22488
+ });
22489
+ /**
22490
+ * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
22491
+ * is honoured only for a realtime-ish speed (0.5–2×); timelapse is always
22492
+ * silent. `maxLifeMs` bounds how long the finished file is kept;
22493
+ * `deleteAfterDownload` removes it shortly after the first complete download.
22494
+ */
22495
+ var ExportOptionsSchema = object({
22496
+ speed: ExportSpeedSchema.optional(),
22497
+ timelapse: ExportTimelapseSchema.optional(),
22498
+ includeAudio: boolean(),
22499
+ maxLifeMs: number().int().positive(),
22500
+ deleteAfterDownload: boolean(),
22501
+ title: string().max(200).optional()
22502
+ }).superRefine((v, ctx) => {
22503
+ if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
22504
+ code: ZodIssueCode.custom,
22505
+ message: "speed and timelapse are mutually exclusive",
22506
+ path: ["timelapse"]
22507
+ });
22508
+ });
22509
+ var ExportStateSchema = _enum([
22510
+ "queued",
22511
+ "rendering",
22512
+ "ready",
22513
+ "failed",
22514
+ "expired",
22515
+ "deleted"
22516
+ ]);
22517
+ /** One export job / history row. */
22518
+ var ExportRecordSchema = object({
22519
+ id: string(),
22520
+ deviceId: number(),
22521
+ profile: string(),
22522
+ fromMs: number(),
22523
+ toMs: number(),
22524
+ options: ExportOptionsSchema,
22525
+ state: ExportStateSchema,
22526
+ /** 0–100 while rendering; null otherwise. */
22527
+ progressPct: number().nullable(),
22528
+ /** File size once ready; null before. */
22529
+ fileBytes: number().nullable(),
22530
+ expiresAt: number(),
22531
+ deleteAfterDownload: boolean(),
22532
+ /** Epoch of the first complete download; null until then. */
22533
+ downloadedAt: number().nullable(),
22534
+ createdAt: number(),
22535
+ /** User id/name that requested the export. */
22536
+ createdBy: string(),
22537
+ /** Failure reason when state is 'failed'; null otherwise. */
22538
+ error: string().nullable()
22539
+ });
22540
+ /** Candidate download URLs (LAN first, then operator extra hosts). */
22541
+ var ExportDownloadSchema = object({
22542
+ url: string(),
22543
+ endpoints: array(string())
22544
+ });
22545
+ method(object({
22546
+ deviceId: number(),
22547
+ profile: string(),
22548
+ fromMs: number(),
22549
+ toMs: number(),
22550
+ options: ExportOptionsSchema
22551
+ }), ExportRecordSchema, {
22552
+ kind: "mutation",
22553
+ auth: "protected"
22554
+ }), method(object({ deviceId: number().optional() }), array(ExportRecordSchema), {
22555
+ kind: "query",
22556
+ auth: "protected"
22557
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22558
+ kind: "query",
22559
+ auth: "protected"
22560
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22561
+ kind: "mutation",
22562
+ auth: "protected"
22563
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22564
+ kind: "mutation",
22565
+ auth: "protected"
22566
+ }), method(object({ exportId: string() }), ExportDownloadSchema, {
22567
+ kind: "query",
22568
+ auth: "protected"
22569
+ });
22570
+ /**
22387
22571
  * One publishable camera stream as its OWNING PROVIDER describes it — the same
22388
22572
  * payload the (legacy) push `streamBroker.publishCameraStream` carried, minus
22389
22573
  * `deviceId`.
@@ -26307,6 +26491,42 @@ Object.freeze({
26307
26491
  addonId: null,
26308
26492
  access: "create"
26309
26493
  },
26494
+ "recordingExport.cancelExport": {
26495
+ capName: "recordingExport",
26496
+ capScope: "system",
26497
+ addonId: null,
26498
+ access: "create"
26499
+ },
26500
+ "recordingExport.createExport": {
26501
+ capName: "recordingExport",
26502
+ capScope: "system",
26503
+ addonId: null,
26504
+ access: "create"
26505
+ },
26506
+ "recordingExport.deleteExport": {
26507
+ capName: "recordingExport",
26508
+ capScope: "system",
26509
+ addonId: null,
26510
+ access: "delete"
26511
+ },
26512
+ "recordingExport.getDownloadUrl": {
26513
+ capName: "recordingExport",
26514
+ capScope: "system",
26515
+ addonId: null,
26516
+ access: "view"
26517
+ },
26518
+ "recordingExport.getExport": {
26519
+ capName: "recordingExport",
26520
+ capScope: "system",
26521
+ addonId: null,
26522
+ access: "view"
26523
+ },
26524
+ "recordingExport.listExports": {
26525
+ capName: "recordingExport",
26526
+ capScope: "system",
26527
+ addonId: null,
26528
+ access: "view"
26529
+ },
26310
26530
  "sceneMonitor.captureReference": {
26311
26531
  capName: "scene-monitor",
26312
26532
  capScope: "device",
package/dist/addon.mjs CHANGED
@@ -2,7 +2,7 @@ import { createCipheriv, createDecipheriv, createHash, createHmac } from "crypto
2
2
  import { Socket } from "net";
3
3
  import { EventEmitter } from "events";
4
4
  import { createSocket } from "dgram";
5
- //#region ../types/dist/event-category-H4AVePnn.mjs
5
+ //#region ../types/dist/event-category-D4HJq7Mw.mjs
6
6
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
7
7
  EventCategory["SystemBoot"] = "system.boot";
8
8
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -155,6 +155,11 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
155
155
  /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
156
156
  * thumb is a scrub gap the recorder's keyframe backfill covers. */
157
157
  EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
158
+ /** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
159
+ * progress bar the client reconciles via `recordingExport.getExport`. */
160
+ EventCategory["RecordingExportProgress"] = "recording.export.progress";
161
+ EventCategory["RecordingExportCompleted"] = "recording.export.completed";
162
+ EventCategory["RecordingExportFailed"] = "recording.export.failed";
158
163
  EventCategory["DetectionEvent"] = "detection.event";
159
164
  EventCategory["SessionTrackNew"] = "session.track.new";
160
165
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -444,6 +449,25 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
444
449
  */
445
450
  EventCategory["PipelineAnalyticsStationaryChanged"] = "pipeline-analytics.stationary-changed";
446
451
  /**
452
+ * Fired by `addon-post-analysis` when a package-drop is confirmed inside
453
+ * a package zone — a newly-appeared stationary object of a package class
454
+ * that cleared the class / zone / dwell / size gates. Payload:
455
+ * `PipelineAnalyticsPackageDeliveredPayload` carrying `{ deviceId,
456
+ * entryId, className, zoneIds, keyFrameMediaKey?, bbox, timestamp }`.
457
+ * Telemetry (D8): the durable record is the `package-events` store row;
458
+ * this bus topic drives notifier rules + live UI. See
459
+ * docs/superpowers/specs/2026-07-17-package-zones-design.md §5.1.
460
+ */
461
+ EventCategory["PipelineAnalyticsPackageDelivered"] = "pipeline-analytics.package-delivered";
462
+ /**
463
+ * Fired by `addon-post-analysis` when a previously-delivered package
464
+ * leaves its zone (the stationary entry departed — moved or swept).
465
+ * Payload: `PipelineAnalyticsPackagePickedUpPayload` carrying
466
+ * `{ deviceId, entryId, deliveredEventId, className, timestamp }`.
467
+ * Telemetry (D8). See package-zones-design §5.2.
468
+ */
469
+ EventCategory["PipelineAnalyticsPackagePickedUp"] = "pipeline-analytics.package-picked-up";
470
+ /**
447
471
  * Fired by `addon-post-analysis` whenever a gallery face row changes:
448
472
  * `kind:'buffered'` a new detected face was persisted, `'assigned'` /
449
473
  * `'unassigned'` its identity link changed, `'deleted'` the row was
@@ -5196,6 +5220,25 @@ function preprocess(fn, schema) {
5196
5220
  out: schema
5197
5221
  });
5198
5222
  }
5223
+ //#endregion
5224
+ //#region ../../node_modules/zod/v4/classic/compat.js
5225
+ /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
5226
+ var ZodIssueCode = {
5227
+ invalid_type: "invalid_type",
5228
+ too_big: "too_big",
5229
+ too_small: "too_small",
5230
+ invalid_format: "invalid_format",
5231
+ not_multiple_of: "not_multiple_of",
5232
+ unrecognized_keys: "unrecognized_keys",
5233
+ invalid_union: "invalid_union",
5234
+ invalid_key: "invalid_key",
5235
+ invalid_element: "invalid_element",
5236
+ invalid_value: "invalid_value",
5237
+ custom: "custom"
5238
+ };
5239
+ /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5240
+ var ZodFirstPartyTypeKind;
5241
+ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5199
5242
  Object.fromEntries([
5200
5243
  {
5201
5244
  id: "overview",
@@ -7254,6 +7297,24 @@ var RecordingRetentionSchema = object({
7254
7297
  maxSizeGb: number().min(0).optional()
7255
7298
  });
7256
7299
  /**
7300
+ * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7301
+ * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7302
+ * previews at. Five graduated steps; absent on a config = `standard` (the
7303
+ * shipped default, matching `sheet-geometry`/`sheet-composer`).
7304
+ *
7305
+ * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7306
+ * Each window's index sidecar carries its own tile dims, so a camera whose
7307
+ * preset changed over time renders every historical window at the dims it was
7308
+ * written with.
7309
+ */
7310
+ var ScrubThumbnailPresetSchema = _enum([
7311
+ "minimal",
7312
+ "low",
7313
+ "standard",
7314
+ "high",
7315
+ "max"
7316
+ ]);
7317
+ /**
7257
7318
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7258
7319
  *
7259
7320
  * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
@@ -7290,7 +7351,14 @@ var RecordingConfigSchema = object({
7290
7351
  * derived into bands once via `migrateConfigToBands`.
7291
7352
  */
7292
7353
  bands: array(RecordingBandSchema).optional(),
7293
- retention: RecordingRetentionSchema.optional()
7354
+ retention: RecordingRetentionSchema.optional(),
7355
+ /**
7356
+ * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7357
+ * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7358
+ * windows only — existing sheets are immutable, and each window's index
7359
+ * carries its own tile dims so mixed-preset history renders correctly.
7360
+ */
7361
+ scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7294
7362
  });
7295
7363
  /**
7296
7364
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -14648,7 +14716,11 @@ array(ZoneRuleSchema).readonly();
14648
14716
  * Extend the enum here when a new gating consumer comes online (audio
14649
14717
  * gating, alert filtering, …) — no other surface needs to change.
14650
14718
  */
14651
- var ZoneRuleStageEnum = _enum(["motion", "detection"]);
14719
+ var ZoneRuleStageEnum = _enum([
14720
+ "motion",
14721
+ "detection",
14722
+ "package"
14723
+ ]);
14652
14724
  /**
14653
14725
  * Runtime registry: cap-property-name → cap definition. `BaseDevice`'s
14654
14726
  * `state` getter looks up the cap definition here to construct a
@@ -14742,16 +14814,24 @@ var DEVICE_LOCAL_STATE_CAPS = {
14742
14814
  })
14743
14815
  },
14744
14816
  /**
14745
- * Runtime-state slice — both stages mirrored together so consumers
14817
+ * Runtime-state slice — every stage mirrored together so consumers
14746
14818
  * see one reactive handle (`device.state.zoneRules.value`) instead
14747
- * of two. Bulk-replace mutations on either stage write the full
14748
- * `{motion, detection}` shape, so subscribers always get the
14819
+ * of one per stage. Bulk-replace mutations on any stage write the full
14820
+ * `{motion, detection, package}` shape, so subscribers always get the
14749
14821
  * complete current set. Consumers that only care about one stage
14750
14822
  * just read the matching property.
14823
+ *
14824
+ * `package` backs the package-drop detector — a package zone is a
14825
+ * `ZoneRule` on the `'package'` stage referencing drawn polygons
14826
+ * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14827
+ * The orchestrator provider that writes this stage lands in a later
14828
+ * slice; until then the mirror carries only `{motion, detection}` and
14829
+ * consumers read `package` as absent (treat as `[]`).
14751
14830
  */
14752
14831
  runtimeState: object({
14753
14832
  motion: array(ZoneRuleSchema).readonly(),
14754
- detection: array(ZoneRuleSchema).readonly()
14833
+ detection: array(ZoneRuleSchema).readonly(),
14834
+ package: array(ZoneRuleSchema).readonly()
14755
14835
  })
14756
14836
  },
14757
14837
  zones: zonesCapability
@@ -18730,6 +18810,7 @@ var EventKindIconSchema = _enum([
18730
18810
  "smoke",
18731
18811
  "water",
18732
18812
  "button",
18813
+ "package",
18733
18814
  "generic"
18734
18815
  ]);
18735
18816
  var EventKindCategorySchema = _enum([
@@ -18737,7 +18818,8 @@ var EventKindCategorySchema = _enum([
18737
18818
  "audio",
18738
18819
  "detection",
18739
18820
  "sensor",
18740
- "custom"
18821
+ "custom",
18822
+ "package"
18741
18823
  ]);
18742
18824
  var EventKindDescriptorSchema = object({
18743
18825
  /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
@@ -22383,6 +22465,108 @@ method(object({
22383
22465
  auth: "admin"
22384
22466
  });
22385
22467
  /**
22468
+ * `recordingExport` cap — render a footage time range into a single downloadable
22469
+ * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
22470
+ * bounded lifetime with a durable history, auto-expiry, and optional
22471
+ * delete-after-download.
22472
+ *
22473
+ * Like `recording` this is a `scope:'system', mode:'singleton'` cap: the
22474
+ * recorder self-gates so exactly ONE node (the designated `recordingNodeId`,
22475
+ * default `hub`) registers it. Device-scoped methods carry `deviceId` in their
22476
+ * input and dispatch to that single provider; the render runs on the node that
22477
+ * owns the footage (no cross-node segment transfer). Download rides the
22478
+ * framework addon data-plane. State persists in a DurableState blob (NOT
22479
+ * SQLite); history rows survive file deletion for audit.
22480
+ */
22481
+ /** Playback-speed multiplier for the render (1 = realtime). */
22482
+ var ExportSpeedSchema = number().min(.25).max(32);
22483
+ /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
22484
+ var ExportTimelapseSchema = object({
22485
+ everyMs: number().int().positive(),
22486
+ outputFps: number().int().min(1).max(60).optional()
22487
+ });
22488
+ /**
22489
+ * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
22490
+ * is honoured only for a realtime-ish speed (0.5–2×); timelapse is always
22491
+ * silent. `maxLifeMs` bounds how long the finished file is kept;
22492
+ * `deleteAfterDownload` removes it shortly after the first complete download.
22493
+ */
22494
+ var ExportOptionsSchema = object({
22495
+ speed: ExportSpeedSchema.optional(),
22496
+ timelapse: ExportTimelapseSchema.optional(),
22497
+ includeAudio: boolean(),
22498
+ maxLifeMs: number().int().positive(),
22499
+ deleteAfterDownload: boolean(),
22500
+ title: string().max(200).optional()
22501
+ }).superRefine((v, ctx) => {
22502
+ if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
22503
+ code: ZodIssueCode.custom,
22504
+ message: "speed and timelapse are mutually exclusive",
22505
+ path: ["timelapse"]
22506
+ });
22507
+ });
22508
+ var ExportStateSchema = _enum([
22509
+ "queued",
22510
+ "rendering",
22511
+ "ready",
22512
+ "failed",
22513
+ "expired",
22514
+ "deleted"
22515
+ ]);
22516
+ /** One export job / history row. */
22517
+ var ExportRecordSchema = object({
22518
+ id: string(),
22519
+ deviceId: number(),
22520
+ profile: string(),
22521
+ fromMs: number(),
22522
+ toMs: number(),
22523
+ options: ExportOptionsSchema,
22524
+ state: ExportStateSchema,
22525
+ /** 0–100 while rendering; null otherwise. */
22526
+ progressPct: number().nullable(),
22527
+ /** File size once ready; null before. */
22528
+ fileBytes: number().nullable(),
22529
+ expiresAt: number(),
22530
+ deleteAfterDownload: boolean(),
22531
+ /** Epoch of the first complete download; null until then. */
22532
+ downloadedAt: number().nullable(),
22533
+ createdAt: number(),
22534
+ /** User id/name that requested the export. */
22535
+ createdBy: string(),
22536
+ /** Failure reason when state is 'failed'; null otherwise. */
22537
+ error: string().nullable()
22538
+ });
22539
+ /** Candidate download URLs (LAN first, then operator extra hosts). */
22540
+ var ExportDownloadSchema = object({
22541
+ url: string(),
22542
+ endpoints: array(string())
22543
+ });
22544
+ method(object({
22545
+ deviceId: number(),
22546
+ profile: string(),
22547
+ fromMs: number(),
22548
+ toMs: number(),
22549
+ options: ExportOptionsSchema
22550
+ }), ExportRecordSchema, {
22551
+ kind: "mutation",
22552
+ auth: "protected"
22553
+ }), method(object({ deviceId: number().optional() }), array(ExportRecordSchema), {
22554
+ kind: "query",
22555
+ auth: "protected"
22556
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22557
+ kind: "query",
22558
+ auth: "protected"
22559
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22560
+ kind: "mutation",
22561
+ auth: "protected"
22562
+ }), method(object({ exportId: string() }), ExportRecordSchema, {
22563
+ kind: "mutation",
22564
+ auth: "protected"
22565
+ }), method(object({ exportId: string() }), ExportDownloadSchema, {
22566
+ kind: "query",
22567
+ auth: "protected"
22568
+ });
22569
+ /**
22386
22570
  * One publishable camera stream as its OWNING PROVIDER describes it — the same
22387
22571
  * payload the (legacy) push `streamBroker.publishCameraStream` carried, minus
22388
22572
  * `deviceId`.
@@ -26306,6 +26490,42 @@ Object.freeze({
26306
26490
  addonId: null,
26307
26491
  access: "create"
26308
26492
  },
26493
+ "recordingExport.cancelExport": {
26494
+ capName: "recordingExport",
26495
+ capScope: "system",
26496
+ addonId: null,
26497
+ access: "create"
26498
+ },
26499
+ "recordingExport.createExport": {
26500
+ capName: "recordingExport",
26501
+ capScope: "system",
26502
+ addonId: null,
26503
+ access: "create"
26504
+ },
26505
+ "recordingExport.deleteExport": {
26506
+ capName: "recordingExport",
26507
+ capScope: "system",
26508
+ addonId: null,
26509
+ access: "delete"
26510
+ },
26511
+ "recordingExport.getDownloadUrl": {
26512
+ capName: "recordingExport",
26513
+ capScope: "system",
26514
+ addonId: null,
26515
+ access: "view"
26516
+ },
26517
+ "recordingExport.getExport": {
26518
+ capName: "recordingExport",
26519
+ capScope: "system",
26520
+ addonId: null,
26521
+ access: "view"
26522
+ },
26523
+ "recordingExport.listExports": {
26524
+ capName: "recordingExport",
26525
+ capScope: "system",
26526
+ addonId: null,
26527
+ access: "view"
26528
+ },
26309
26529
  "sceneMonitor.captureReference": {
26310
26530
  capName: "scene-monitor",
26311
26531
  capScope: "device",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-tuya",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Tuya / Smart Life device-provider addon for CamStack — account-onboarded (Tuya IoT cloud fetch of device localKeys) + LOCAL DP control via the @apocaliss92/nodetuya encrypted-LAN client, exposing switch / water-heater-family kettle entities",
5
5
  "keywords": [
6
6
  "camstack",