@camstack/types 1.1.48 → 1.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-BoTIF1d4.js");
3
- const require_event_category = require("./event-category-AkBNxg_X.js");
2
+ const require_sleep = require("./sleep-BfvNtyu8.js");
3
+ const require_event_category = require("./event-category-CGj9fI4L.js");
4
4
  const require_enums = require("./enums.js");
5
5
  const require_err_msg = require("./err-msg-COpsHMw2.js");
6
6
  let zod = require("zod");
@@ -2271,6 +2271,10 @@ var MACRO_LABELS = [
2271
2271
  {
2272
2272
  id: "animal",
2273
2273
  name: "Animal"
2274
+ },
2275
+ {
2276
+ id: "package",
2277
+ name: "Package"
2274
2278
  }
2275
2279
  ];
2276
2280
  var COCO_TO_MACRO = {
@@ -2293,7 +2297,10 @@ var COCO_TO_MACRO = {
2293
2297
  elephant: "animal",
2294
2298
  bear: "animal",
2295
2299
  zebra: "animal",
2296
- giraffe: "animal"
2300
+ giraffe: "animal",
2301
+ suitcase: "package",
2302
+ backpack: "package",
2303
+ handbag: "package"
2297
2304
  },
2298
2305
  preserveOriginal: false
2299
2306
  };
@@ -11001,7 +11008,11 @@ var ZoneRulesArraySchema = zod.z.array(ZoneRuleSchema).readonly();
11001
11008
  * Extend the enum here when a new gating consumer comes online (audio
11002
11009
  * gating, alert filtering, …) — no other surface needs to change.
11003
11010
  */
11004
- var ZoneRuleStageEnum = zod.z.enum(["motion", "detection"]);
11011
+ var ZoneRuleStageEnum = zod.z.enum([
11012
+ "motion",
11013
+ "detection",
11014
+ "package"
11015
+ ]);
11005
11016
  /**
11006
11017
  * Zone rules capability — per-camera CRUD over the {@link ZoneRule}
11007
11018
  * arrays that decide how each pipeline stage uses the polygon zones.
@@ -11045,16 +11056,24 @@ var zoneRulesCapability = {
11045
11056
  })
11046
11057
  },
11047
11058
  /**
11048
- * Runtime-state slice — both stages mirrored together so consumers
11059
+ * Runtime-state slice — every stage mirrored together so consumers
11049
11060
  * see one reactive handle (`device.state.zoneRules.value`) instead
11050
- * of two. Bulk-replace mutations on either stage write the full
11051
- * `{motion, detection}` shape, so subscribers always get the
11061
+ * of one per stage. Bulk-replace mutations on any stage write the full
11062
+ * `{motion, detection, package}` shape, so subscribers always get the
11052
11063
  * complete current set. Consumers that only care about one stage
11053
11064
  * just read the matching property.
11065
+ *
11066
+ * `package` backs the package-drop detector — a package zone is a
11067
+ * `ZoneRule` on the `'package'` stage referencing drawn polygons
11068
+ * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
11069
+ * The orchestrator provider that writes this stage lands in a later
11070
+ * slice; until then the mirror carries only `{motion, detection}` and
11071
+ * consumers read `package` as absent (treat as `[]`).
11054
11072
  */
11055
11073
  runtimeState: zod.z.object({
11056
11074
  motion: zod.z.array(ZoneRuleSchema).readonly(),
11057
- detection: zod.z.array(ZoneRuleSchema).readonly()
11075
+ detection: zod.z.array(ZoneRuleSchema).readonly(),
11076
+ package: zod.z.array(ZoneRuleSchema).readonly()
11058
11077
  })
11059
11078
  };
11060
11079
  //#endregion
@@ -13055,6 +13074,12 @@ function createSystemProxy(api) {
13055
13074
  unassignPlates: (input) => dispatch("plateGallery", "unassignPlates", "mutation", input)
13056
13075
  },
13057
13076
  recording: { getStorageUsage: (input) => dispatch("recording", "getStorageUsage", "query", input) },
13077
+ recordingExport: {
13078
+ getExport: (input) => dispatch("recordingExport", "getExport", "query", input),
13079
+ cancelExport: (input) => dispatch("recordingExport", "cancelExport", "mutation", input),
13080
+ deleteExport: (input) => dispatch("recordingExport", "deleteExport", "mutation", input),
13081
+ getDownloadUrl: (input) => dispatch("recordingExport", "getDownloadUrl", "query", input)
13082
+ },
13058
13083
  serverManagement: {
13059
13084
  getServerPackageStatus: (input) => dispatch("serverManagement", "getServerPackageStatus", "query", input),
13060
13085
  checkServerUpdate: (input) => dispatch("serverManagement", "checkServerUpdate", "mutation", input),
@@ -18319,6 +18344,7 @@ var EventKindIconSchema = zod.z.enum([
18319
18344
  "smoke",
18320
18345
  "water",
18321
18346
  "button",
18347
+ "package",
18322
18348
  "generic"
18323
18349
  ]);
18324
18350
  var EventKindCategorySchema = zod.z.enum([
@@ -18326,7 +18352,8 @@ var EventKindCategorySchema = zod.z.enum([
18326
18352
  "audio",
18327
18353
  "detection",
18328
18354
  "sensor",
18329
- "custom"
18355
+ "custom",
18356
+ "package"
18330
18357
  ]);
18331
18358
  var EventKindDescriptorSchema = zod.z.object({
18332
18359
  /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
@@ -23577,6 +23604,127 @@ var recordingCapability = {
23577
23604
  }
23578
23605
  };
23579
23606
  //#endregion
23607
+ //#region src/capabilities/recording-export.cap.ts
23608
+ /**
23609
+ * `recordingExport` cap — render a footage time range into a single downloadable
23610
+ * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
23611
+ * bounded lifetime with a durable history, auto-expiry, and optional
23612
+ * delete-after-download.
23613
+ *
23614
+ * Like `recording` this is a `scope:'system', mode:'singleton'` cap: the
23615
+ * recorder self-gates so exactly ONE node (the designated `recordingNodeId`,
23616
+ * default `hub`) registers it. Device-scoped methods carry `deviceId` in their
23617
+ * input and dispatch to that single provider; the render runs on the node that
23618
+ * owns the footage (no cross-node segment transfer). Download rides the
23619
+ * framework addon data-plane. State persists in a DurableState blob (NOT
23620
+ * SQLite); history rows survive file deletion for audit.
23621
+ */
23622
+ /** Playback-speed multiplier for the render (1 = realtime). */
23623
+ var ExportSpeedSchema = zod.z.number().min(.25).max(32);
23624
+ /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
23625
+ var ExportTimelapseSchema = zod.z.object({
23626
+ everyMs: zod.z.number().int().positive(),
23627
+ outputFps: zod.z.number().int().min(1).max(60).optional()
23628
+ });
23629
+ /**
23630
+ * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
23631
+ * is honoured only for a realtime-ish speed (0.5–2×); timelapse is always
23632
+ * silent. `maxLifeMs` bounds how long the finished file is kept;
23633
+ * `deleteAfterDownload` removes it shortly after the first complete download.
23634
+ */
23635
+ var ExportOptionsSchema = zod.z.object({
23636
+ speed: ExportSpeedSchema.optional(),
23637
+ timelapse: ExportTimelapseSchema.optional(),
23638
+ includeAudio: zod.z.boolean(),
23639
+ maxLifeMs: zod.z.number().int().positive(),
23640
+ deleteAfterDownload: zod.z.boolean(),
23641
+ title: zod.z.string().max(200).optional()
23642
+ }).superRefine((v, ctx) => {
23643
+ if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
23644
+ code: zod.z.ZodIssueCode.custom,
23645
+ message: "speed and timelapse are mutually exclusive",
23646
+ path: ["timelapse"]
23647
+ });
23648
+ });
23649
+ var ExportStateSchema = zod.z.enum([
23650
+ "queued",
23651
+ "rendering",
23652
+ "ready",
23653
+ "failed",
23654
+ "expired",
23655
+ "deleted"
23656
+ ]);
23657
+ /** One export job / history row. */
23658
+ var ExportRecordSchema = zod.z.object({
23659
+ id: zod.z.string(),
23660
+ deviceId: zod.z.number(),
23661
+ profile: zod.z.string(),
23662
+ fromMs: zod.z.number(),
23663
+ toMs: zod.z.number(),
23664
+ options: ExportOptionsSchema,
23665
+ state: ExportStateSchema,
23666
+ /** 0–100 while rendering; null otherwise. */
23667
+ progressPct: zod.z.number().nullable(),
23668
+ /** File size once ready; null before. */
23669
+ fileBytes: zod.z.number().nullable(),
23670
+ expiresAt: zod.z.number(),
23671
+ deleteAfterDownload: zod.z.boolean(),
23672
+ /** Epoch of the first complete download; null until then. */
23673
+ downloadedAt: zod.z.number().nullable(),
23674
+ createdAt: zod.z.number(),
23675
+ /** User id/name that requested the export. */
23676
+ createdBy: zod.z.string(),
23677
+ /** Failure reason when state is 'failed'; null otherwise. */
23678
+ error: zod.z.string().nullable()
23679
+ });
23680
+ /** Candidate download URLs (LAN first, then operator extra hosts). */
23681
+ var ExportDownloadSchema = zod.z.object({
23682
+ url: zod.z.string(),
23683
+ endpoints: zod.z.array(zod.z.string())
23684
+ });
23685
+ var recordingExportCapability = {
23686
+ name: "recordingExport",
23687
+ scope: "system",
23688
+ mode: "singleton",
23689
+ methods: {
23690
+ /** Queue a render of `[fromMs,toMs)` for `deviceId`/`profile`. Fails fast
23691
+ * when no footage covers the range. Returns the queued record. */
23692
+ createExport: require_sleep.method(zod.z.object({
23693
+ deviceId: zod.z.number(),
23694
+ profile: zod.z.string(),
23695
+ fromMs: zod.z.number(),
23696
+ toMs: zod.z.number(),
23697
+ options: ExportOptionsSchema
23698
+ }), ExportRecordSchema, {
23699
+ kind: "mutation",
23700
+ auth: "protected"
23701
+ }),
23702
+ /** All export rows (history included), optionally scoped to one device. */
23703
+ listExports: require_sleep.method(zod.z.object({ deviceId: zod.z.number().optional() }), zod.z.array(ExportRecordSchema), {
23704
+ kind: "query",
23705
+ auth: "protected"
23706
+ }),
23707
+ getExport: require_sleep.method(zod.z.object({ exportId: zod.z.string() }), ExportRecordSchema, {
23708
+ kind: "query",
23709
+ auth: "protected"
23710
+ }),
23711
+ /** Abort a queued/rendering export; the partial file is removed. */
23712
+ cancelExport: require_sleep.method(zod.z.object({ exportId: zod.z.string() }), ExportRecordSchema, {
23713
+ kind: "mutation",
23714
+ auth: "protected"
23715
+ }),
23716
+ /** Remove the file but keep the history row (state → 'deleted'). */
23717
+ deleteExport: require_sleep.method(zod.z.object({ exportId: zod.z.string() }), ExportRecordSchema, {
23718
+ kind: "mutation",
23719
+ auth: "protected"
23720
+ }),
23721
+ getDownloadUrl: require_sleep.method(zod.z.object({ exportId: zod.z.string() }), ExportDownloadSchema, {
23722
+ kind: "query",
23723
+ auth: "protected"
23724
+ })
23725
+ }
23726
+ };
23727
+ //#endregion
23580
23728
  //#region src/capabilities/stream-catalog.cap.ts
23581
23729
  /**
23582
23730
  * One publishable camera stream as its OWNING PROVIDER describes it — the same
@@ -24368,6 +24516,7 @@ var CAPABILITY_NAMES = {
24368
24516
  ptzAutotrack: "ptz-autotrack",
24369
24517
  reboot: "reboot",
24370
24518
  recording: "recording",
24519
+ recordingExport: "recordingExport",
24371
24520
  sceneMonitor: "scene-monitor",
24372
24521
  scriptRunner: "script-runner",
24373
24522
  serverManagement: "server-management",
@@ -24833,6 +24982,10 @@ var CAPABILITY_ROUTER_KEYS = [
24833
24982
  key: "recording",
24834
24983
  name: "recording"
24835
24984
  },
24985
+ {
24986
+ key: "recordingExport",
24987
+ name: "recordingExport"
24988
+ },
24836
24989
  {
24837
24990
  key: "sceneMonitor",
24838
24991
  name: "scene-monitor"
@@ -25087,6 +25240,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
25087
25240
  ptzAutotrackCapability,
25088
25241
  rebootCapability,
25089
25242
  recordingCapability,
25243
+ recordingExportCapability,
25090
25244
  sceneMonitorCapability,
25091
25245
  scriptRunnerCapability,
25092
25246
  serverManagementCapability,
@@ -28814,6 +28968,42 @@ var METHOD_ACCESS_MAP = Object.freeze({
28814
28968
  addonId: null,
28815
28969
  access: "create"
28816
28970
  },
28971
+ "recordingExport.cancelExport": {
28972
+ capName: "recordingExport",
28973
+ capScope: "system",
28974
+ addonId: null,
28975
+ access: "create"
28976
+ },
28977
+ "recordingExport.createExport": {
28978
+ capName: "recordingExport",
28979
+ capScope: "system",
28980
+ addonId: null,
28981
+ access: "create"
28982
+ },
28983
+ "recordingExport.deleteExport": {
28984
+ capName: "recordingExport",
28985
+ capScope: "system",
28986
+ addonId: null,
28987
+ access: "delete"
28988
+ },
28989
+ "recordingExport.getDownloadUrl": {
28990
+ capName: "recordingExport",
28991
+ capScope: "system",
28992
+ addonId: null,
28993
+ access: "view"
28994
+ },
28995
+ "recordingExport.getExport": {
28996
+ capName: "recordingExport",
28997
+ capScope: "system",
28998
+ addonId: null,
28999
+ access: "view"
29000
+ },
29001
+ "recordingExport.listExports": {
29002
+ capName: "recordingExport",
29003
+ capScope: "system",
29004
+ addonId: null,
29005
+ access: "view"
29006
+ },
28817
29007
  "sceneMonitor.captureReference": {
28818
29008
  capName: "scene-monitor",
28819
29009
  capScope: "device",
@@ -30025,6 +30215,7 @@ var KNOWN_CAP_NAMES = [
30025
30215
  "ptz-autotrack",
30026
30216
  "reboot",
30027
30217
  "recording",
30218
+ "recordingExport",
30028
30219
  "scene-monitor",
30029
30220
  "script-runner",
30030
30221
  "server-management",
@@ -30161,6 +30352,7 @@ var SYSTEM_CAP_NAMES = [
30161
30352
  "plate-gallery",
30162
30353
  "platform-probe",
30163
30354
  "recording",
30355
+ "recordingExport",
30164
30356
  "server-management",
30165
30357
  "settings-store",
30166
30358
  "smtp-provider",
@@ -30970,8 +31162,14 @@ exports.EventKindDescriptorSchema = EventKindDescriptorSchema;
30970
31162
  exports.EventKindIconSchema = EventKindIconSchema;
30971
31163
  exports.EventKindSchema = EventKindSchema;
30972
31164
  exports.EventSourceType = require_enums.EventSourceType$1;
31165
+ exports.ExportDownloadSchema = ExportDownloadSchema;
31166
+ exports.ExportOptionsSchema = ExportOptionsSchema;
31167
+ exports.ExportRecordSchema = ExportRecordSchema;
30973
31168
  exports.ExportSetupFieldSchema = ExportSetupFieldSchema;
30974
31169
  exports.ExportSetupSchema = ExportSetupSchema;
31170
+ exports.ExportSpeedSchema = ExportSpeedSchema;
31171
+ exports.ExportStateSchema = ExportStateSchema;
31172
+ exports.ExportTimelapseSchema = ExportTimelapseSchema;
30975
31173
  exports.ExposedDeviceSchema = ExposedDeviceSchema;
30976
31174
  exports.ExposureModeSchema = ExposureModeSchema;
30977
31175
  exports.ExpressionEvalError = ExpressionEvalError;
@@ -31549,6 +31747,7 @@ exports.readNodePin = readNodePin;
31549
31747
  exports.readinessKey = require_sleep.readinessKey;
31550
31748
  exports.rebootCapability = rebootCapability;
31551
31749
  exports.recordingCapability = recordingCapability;
31750
+ exports.recordingExportCapability = recordingExportCapability;
31552
31751
  exports.rectsToCells = rectsToCells;
31553
31752
  exports.requiresPython = requiresPython;
31554
31753
  exports.resolveAddonExecution = resolveAddonExecution;