@camstack/addon-post-analysis 1.2.601 → 1.2.602

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.
Files changed (15) hide show
  1. package/dist/{clip-model-registry-DAZ9ie-f.js → clip-model-registry-D0-VNIW5.js} +381 -8
  2. package/dist/{clip-model-registry-BuM8eXlN.mjs → clip-model-registry-lQ7QWjLf.mjs} +376 -9
  3. package/dist/embedding-encoder/index.js +1 -1
  4. package/dist/embedding-encoder/index.mjs +1 -1
  5. package/dist/pipeline-analytics/_stub.js +2 -2
  6. package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-DAs_96VP.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-BPA0T5-F.mjs} +2 -2
  7. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-1AlitJg2.mjs +26 -0
  8. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Cfj8Mv5X.mjs +26 -0
  9. package/dist/pipeline-analytics/{hostInit-C3wjY7W8.mjs → hostInit-DIjMiIYW.mjs} +2 -2
  10. package/dist/pipeline-analytics/index.js +281 -503
  11. package/dist/pipeline-analytics/index.mjs +281 -503
  12. package/dist/pipeline-analytics/remoteEntry.js +1 -1
  13. package/package.json +1 -1
  14. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CElkWYPg.mjs +0 -26
  15. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-SRvLcL_J.mjs +0 -26
@@ -5634,7 +5634,7 @@ var ZodIssueCode = {
5634
5634
  var ZodFirstPartyTypeKind;
5635
5635
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5636
5636
  //#endregion
5637
- //#region ../types/dist/sleep-bZIhUvjd.mjs
5637
+ //#region ../types/dist/sleep-BOjuyoPC.mjs
5638
5638
  /**
5639
5639
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5640
5640
  * window to float samples (D455).
@@ -8883,7 +8883,7 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8883
8883
  * can answer "may a rule actuate this?" without importing the schema barrel
8884
8884
  * (~144MB RSS per runner, D28).
8885
8885
  *
8886
- * Coverage: 88 device-scoped capabilities.
8886
+ * Coverage: 90 device-scoped capabilities.
8887
8887
  */
8888
8888
  var DEVICE_SCOPED_CAPS = new Set([
8889
8889
  "accessories",
@@ -8916,6 +8916,7 @@ var DEVICE_SCOPED_CAPS = new Set([
8916
8916
  "device-extension",
8917
8917
  "device-ops",
8918
8918
  "device-status",
8919
+ "dishwasher",
8919
8920
  "doorbell",
8920
8921
  "enum-sensor",
8921
8922
  "event-emitter",
@@ -8923,6 +8924,7 @@ var DEVICE_SCOPED_CAPS = new Set([
8923
8924
  "feature-probe",
8924
8925
  "flood",
8925
8926
  "gas",
8927
+ "heating-valve",
8926
8928
  "humidifier",
8927
8929
  "humidity-sensor",
8928
8930
  "image",
@@ -9019,7 +9021,7 @@ function sleep(ms) {
9019
9021
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
9020
9022
  }
9021
9023
  //#endregion
9022
- //#region ../types/dist/err-msg--2RrYiLO.mjs
9024
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
9023
9025
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
9024
9026
  DeviceType["Camera"] = "camera";
9025
9027
  DeviceType["Hub"] = "hub";
@@ -9111,6 +9113,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
9111
9113
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
9112
9114
  * integrations sharing the same food/desiccant/hopper surface. */
9113
9115
  DeviceType["PetFeeder"] = "pet-feeder";
9116
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
9117
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
9118
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
9119
+ DeviceType["Dishwasher"] = "dishwasher";
9114
9120
  return DeviceType;
9115
9121
  }({});
9116
9122
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -9368,7 +9374,7 @@ function errMsg(err) {
9368
9374
  return String(err);
9369
9375
  }
9370
9376
  //#endregion
9371
- //#region ../types/dist/composition-DOwQB_Ua.mjs
9377
+ //#region ../types/dist/composition-CB6PMT9p.mjs
9372
9378
  /**
9373
9379
  * Deterministic SHA-256 hash of an arbitrary serialisable value. The
9374
9380
  * canonical form sorts object keys alphabetically at every depth so two
@@ -14658,8 +14664,13 @@ var AlertSeveritySchema = _enum([
14658
14664
  "info",
14659
14665
  "success",
14660
14666
  "warning",
14661
- "error"
14667
+ "error",
14668
+ "critical"
14662
14669
  ]);
14670
+ var AlertActionSchema = object({
14671
+ label: string(),
14672
+ href: string().optional()
14673
+ });
14663
14674
  var AlertStatusSchema = _enum([
14664
14675
  "active",
14665
14676
  "in-progress",
@@ -14677,6 +14688,7 @@ var AlertSchema = object({
14677
14688
  severity: AlertSeveritySchema,
14678
14689
  title: string(),
14679
14690
  message: string(),
14691
+ action: AlertActionSchema.optional(),
14680
14692
  status: AlertStatusSchema,
14681
14693
  progress: number().optional(),
14682
14694
  read: boolean(),
@@ -57202,7 +57214,8 @@ var batteryCapability = {
57202
57214
  DeviceType.Button,
57203
57215
  DeviceType.Switch,
57204
57216
  DeviceType.PetFeeder,
57205
- DeviceType.Container
57217
+ DeviceType.Container,
57218
+ DeviceType.Thermostat
57206
57219
  ],
57207
57220
  methods: {
57208
57221
  /**
@@ -58724,6 +58737,125 @@ onStatusChanged: { data: object({
58724
58737
  * whether persisting is worth a SQLite commit. */
58725
58738
  volatileStateFields: ["lastChangedAt"]
58726
58739
  };
58740
+ /**
58741
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
58742
+ * consumable levels (salt, rinse aid) and common program options.
58743
+ *
58744
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
58745
+ * by any integration that exposes the same program / option surface.
58746
+ *
58747
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
58748
+ * provider refreshes the slice on an interval and eagerly after commands.
58749
+ */
58750
+ var DishwasherStateSchema = _enum([
58751
+ "idle",
58752
+ "running",
58753
+ "paused",
58754
+ "finished",
58755
+ "error",
58756
+ "unavailable"
58757
+ ]);
58758
+ var DishwasherConsumableLevelSchema = _enum([
58759
+ "ok",
58760
+ "low",
58761
+ "empty"
58762
+ ]);
58763
+ var DishwasherStatusSchema = object({
58764
+ state: DishwasherStateSchema,
58765
+ /** Active program id/name, or null when none selected / unknown. */
58766
+ program: string().nullable(),
58767
+ /** Program tokens the hardware accepts — drives the UI selector. */
58768
+ availablePrograms: array(string()),
58769
+ /** Minutes remaining on the active cycle, or null when not running. */
58770
+ remainingMinutes: number().int().nonnegative().nullable(),
58771
+ /** Cycle completion 0..100, or null when not applicable. */
58772
+ progressPercent: number().min(0).max(100).nullable(),
58773
+ /** True when the door is reported open. */
58774
+ doorOpen: boolean(),
58775
+ /** True when remote start is allowed (door closed, power on, etc.). */
58776
+ remoteStartAllowed: boolean(),
58777
+ /** Main power / switched-on state. */
58778
+ powerOn: boolean(),
58779
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
58780
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
58781
+ halfLoad: boolean(),
58782
+ hygienePlus: boolean(),
58783
+ errorCode: number().nullable(),
58784
+ errorLabel: string().nullable(),
58785
+ lastFetchedAt: number()
58786
+ });
58787
+ var dishwasherCapability = {
58788
+ name: "dishwasher",
58789
+ scope: "device",
58790
+ deviceNative: true,
58791
+ mode: "singleton",
58792
+ deviceTypes: [DeviceType.Dishwasher],
58793
+ methods: {
58794
+ start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
58795
+ kind: "mutation",
58796
+ auth: "protected"
58797
+ }),
58798
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
58799
+ kind: "mutation",
58800
+ auth: "protected"
58801
+ }),
58802
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
58803
+ kind: "mutation",
58804
+ auth: "protected"
58805
+ }),
58806
+ setProgram: method(object({
58807
+ deviceId: number().int().nonnegative(),
58808
+ program: string().min(1)
58809
+ }), _void(), {
58810
+ kind: "mutation",
58811
+ auth: "protected"
58812
+ }),
58813
+ setPower: method(object({
58814
+ deviceId: number().int().nonnegative(),
58815
+ on: boolean()
58816
+ }), _void(), {
58817
+ kind: "mutation",
58818
+ auth: "protected"
58819
+ }),
58820
+ setHalfLoad: method(object({
58821
+ deviceId: number().int().nonnegative(),
58822
+ on: boolean()
58823
+ }), _void(), {
58824
+ kind: "mutation",
58825
+ auth: "protected"
58826
+ }),
58827
+ setHygienePlus: method(object({
58828
+ deviceId: number().int().nonnegative(),
58829
+ on: boolean()
58830
+ }), _void(), {
58831
+ kind: "mutation",
58832
+ auth: "protected"
58833
+ }),
58834
+ setOption: method(object({
58835
+ deviceId: number().int().nonnegative(),
58836
+ key: string().min(1),
58837
+ value: union([
58838
+ boolean(),
58839
+ string(),
58840
+ number()
58841
+ ])
58842
+ }), _void(), {
58843
+ kind: "mutation",
58844
+ auth: "protected"
58845
+ })
58846
+ },
58847
+ status: {
58848
+ schema: DishwasherStatusSchema,
58849
+ kind: "poll"
58850
+ },
58851
+ runtimeState: DishwasherStatusSchema,
58852
+ durability: "session",
58853
+ history: { fields: { progressPercent: {
58854
+ kind: "gauge",
58855
+ unit: "%",
58856
+ deadband: 2
58857
+ } } }
58858
+ };
58727
58859
  var DoorbellStatusSchema = object({
58728
58860
  /** Ms epoch of the last press. null = never observed since this provider started. */
58729
58861
  lastPressedAt: number().nullable(),
@@ -59565,6 +59697,32 @@ var gasCapability = {
59565
59697
  * whether persisting is worth a SQLite commit. */
59566
59698
  volatileStateFields: ["lastChangedAt"]
59567
59699
  };
59700
+ var HeatingValveStatusSchema = object({
59701
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
59702
+ position: number().min(0).max(100).nullable(),
59703
+ /** Ms epoch when the slice was last updated (push or poll). */
59704
+ lastFetchedAt: number()
59705
+ });
59706
+ var heatingValveCapability = {
59707
+ name: "heating-valve",
59708
+ scope: "device",
59709
+ deviceNative: true,
59710
+ mode: "singleton",
59711
+ deviceTypes: [DeviceType.Thermostat],
59712
+ methods: {},
59713
+ status: {
59714
+ schema: HeatingValveStatusSchema,
59715
+ kind: "push"
59716
+ },
59717
+ runtimeState: HeatingValveStatusSchema,
59718
+ durability: "session",
59719
+ history: { fields: { position: {
59720
+ kind: "gauge",
59721
+ unit: "%",
59722
+ deadband: 1
59723
+ } } },
59724
+ volatileStateFields: ["lastFetchedAt"]
59725
+ };
59568
59726
  /**
59569
59727
  * Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
59570
59728
  * an on/off actuator with an optional target-humidity setpoint and an
@@ -69168,6 +69326,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
69168
69326
  dayNight: dayNightCapability,
69169
69327
  deviceDiscovery: deviceDiscoveryCapability,
69170
69328
  deviceStatus: deviceStatusCapability,
69329
+ dishwasher: dishwasherCapability,
69171
69330
  doorbell: doorbellCapability,
69172
69331
  enumSensor: enumSensorCapability,
69173
69332
  eventEmitter: eventEmitterCapability,
@@ -69175,6 +69334,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
69175
69334
  featureProbe: featureProbeCapability,
69176
69335
  flood: floodCapability,
69177
69336
  gas: gasCapability,
69337
+ heatingValve: heatingValveCapability,
69178
69338
  humidifier: humidifierCapability,
69179
69339
  humiditySensor: humiditySensorCapability,
69180
69340
  image: imageCapability,
@@ -69949,7 +70109,7 @@ var DeclaredDevices = class {
69949
70109
  return removed;
69950
70110
  }
69951
70111
  };
69952
- DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
70112
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher;
69953
70113
  new Set(Object.values(DeviceType));
69954
70114
  Object.freeze({
69955
70115
  "accessories.getStatus": {
@@ -72370,6 +72530,60 @@ Object.freeze({
72370
72530
  addonId: null,
72371
72531
  access: "view"
72372
72532
  },
72533
+ "dishwasher.getStatus": {
72534
+ capName: "dishwasher",
72535
+ capScope: "device",
72536
+ addonId: null,
72537
+ access: "view"
72538
+ },
72539
+ "dishwasher.pause": {
72540
+ capName: "dishwasher",
72541
+ capScope: "device",
72542
+ addonId: null,
72543
+ access: "create"
72544
+ },
72545
+ "dishwasher.setHalfLoad": {
72546
+ capName: "dishwasher",
72547
+ capScope: "device",
72548
+ addonId: null,
72549
+ access: "create"
72550
+ },
72551
+ "dishwasher.setHygienePlus": {
72552
+ capName: "dishwasher",
72553
+ capScope: "device",
72554
+ addonId: null,
72555
+ access: "create"
72556
+ },
72557
+ "dishwasher.setOption": {
72558
+ capName: "dishwasher",
72559
+ capScope: "device",
72560
+ addonId: null,
72561
+ access: "create"
72562
+ },
72563
+ "dishwasher.setPower": {
72564
+ capName: "dishwasher",
72565
+ capScope: "device",
72566
+ addonId: null,
72567
+ access: "create"
72568
+ },
72569
+ "dishwasher.setProgram": {
72570
+ capName: "dishwasher",
72571
+ capScope: "device",
72572
+ addonId: null,
72573
+ access: "create"
72574
+ },
72575
+ "dishwasher.start": {
72576
+ capName: "dishwasher",
72577
+ capScope: "device",
72578
+ addonId: null,
72579
+ access: "create"
72580
+ },
72581
+ "dishwasher.stop": {
72582
+ capName: "dishwasher",
72583
+ capScope: "device",
72584
+ addonId: null,
72585
+ access: "create"
72586
+ },
72373
72587
  "doorbell.getStatus": {
72374
72588
  capName: "doorbell",
72375
72589
  capScope: "device",
@@ -72580,6 +72794,12 @@ Object.freeze({
72580
72794
  addonId: null,
72581
72795
  access: "view"
72582
72796
  },
72797
+ "heatingValve.getStatus": {
72798
+ capName: "heating-valve",
72799
+ capScope: "device",
72800
+ addonId: null,
72801
+ access: "view"
72802
+ },
72583
72803
  "humidifier.getStatus": {
72584
72804
  capName: "humidifier",
72585
72805
  capScope: "device",
@@ -78167,7 +78387,7 @@ Object.freeze({
78167
78387
  access: "create"
78168
78388
  }
78169
78389
  });
78170
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
78390
+ DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher;
78171
78391
  DeviceFeature.BatteryOperated;
78172
78392
  Object.freeze({
78173
78393
  "accessories.getStatus": [{
@@ -78991,6 +79211,51 @@ Object.freeze({
78991
79211
  form: "single",
78992
79212
  optional: false
78993
79213
  }],
79214
+ "dishwasher.getStatus": [{
79215
+ name: "deviceId",
79216
+ form: "single",
79217
+ optional: false
79218
+ }],
79219
+ "dishwasher.pause": [{
79220
+ name: "deviceId",
79221
+ form: "single",
79222
+ optional: false
79223
+ }],
79224
+ "dishwasher.setHalfLoad": [{
79225
+ name: "deviceId",
79226
+ form: "single",
79227
+ optional: false
79228
+ }],
79229
+ "dishwasher.setHygienePlus": [{
79230
+ name: "deviceId",
79231
+ form: "single",
79232
+ optional: false
79233
+ }],
79234
+ "dishwasher.setOption": [{
79235
+ name: "deviceId",
79236
+ form: "single",
79237
+ optional: false
79238
+ }],
79239
+ "dishwasher.setPower": [{
79240
+ name: "deviceId",
79241
+ form: "single",
79242
+ optional: false
79243
+ }],
79244
+ "dishwasher.setProgram": [{
79245
+ name: "deviceId",
79246
+ form: "single",
79247
+ optional: false
79248
+ }],
79249
+ "dishwasher.start": [{
79250
+ name: "deviceId",
79251
+ form: "single",
79252
+ optional: false
79253
+ }],
79254
+ "dishwasher.stop": [{
79255
+ name: "deviceId",
79256
+ form: "single",
79257
+ optional: false
79258
+ }],
78994
79259
  "doorbell.getStatus": [{
78995
79260
  name: "deviceId",
78996
79261
  form: "single",
@@ -79060,6 +79325,11 @@ Object.freeze({
79060
79325
  form: "single",
79061
79326
  optional: false
79062
79327
  }],
79328
+ "heatingValve.getStatus": [{
79329
+ name: "deviceId",
79330
+ form: "single",
79331
+ optional: false
79332
+ }],
79063
79333
  "humidifier.getStatus": [{
79064
79334
  name: "deviceId",
79065
79335
  form: "single",
@@ -80883,6 +81153,103 @@ Object.freeze({
80883
81153
  "network-access": "ingress",
80884
81154
  "smtp-provider": "email"
80885
81155
  });
81156
+ /** Width of a bucket the history store accepts. */
81157
+ var HISTORY_BUCKET_MS = 5 * 6e4;
81158
+ function bucketStartOf(at) {
81159
+ return Math.floor(at / HISTORY_BUCKET_MS) * HISTORY_BUCKET_MS;
81160
+ }
81161
+ function subjectId(subject) {
81162
+ return subject.kind === "device" ? `d:${subject.deviceId}` : `n:${subject.nodeId}`;
81163
+ }
81164
+ function seriesIdentity(key, subject, scope) {
81165
+ return `${key}\u0000${subjectId(subject)}\u0000${scope}`;
81166
+ }
81167
+ function toClosed(b) {
81168
+ return {
81169
+ key: b.key,
81170
+ subject: b.subject,
81171
+ scope: b.scope,
81172
+ bucketStart: b.bucketStart,
81173
+ samples: b.samples,
81174
+ sum: b.sum,
81175
+ min: b.min,
81176
+ max: b.max,
81177
+ last: b.last,
81178
+ lastTs: b.lastTs
81179
+ };
81180
+ }
81181
+ var BucketAccumulator = class {
81182
+ open = /* @__PURE__ */ new Map();
81183
+ requeued = /* @__PURE__ */ new Map();
81184
+ /** Add one observation. A non-finite value or timestamp is ignored (never counted as 0). */
81185
+ note(key, subject, scope, value, at) {
81186
+ if (!Number.isFinite(value) || !Number.isFinite(at)) return;
81187
+ const bucketStart = bucketStartOf(at);
81188
+ const id = `${seriesIdentity(key, subject, scope)}\u0000${bucketStart}`;
81189
+ const existing = this.open.get(id);
81190
+ if (existing === void 0) {
81191
+ this.open.set(id, {
81192
+ key,
81193
+ subject,
81194
+ scope,
81195
+ bucketStart,
81196
+ samples: 1,
81197
+ sum: value,
81198
+ min: value,
81199
+ max: value,
81200
+ last: value,
81201
+ lastTs: at
81202
+ });
81203
+ return;
81204
+ }
81205
+ existing.samples += 1;
81206
+ existing.sum += value;
81207
+ if (value < existing.min) existing.min = value;
81208
+ if (value > existing.max) existing.max = value;
81209
+ if (at >= existing.lastTs) {
81210
+ existing.last = value;
81211
+ existing.lastTs = at;
81212
+ }
81213
+ }
81214
+ /**
81215
+ * Buckets whose window ended at or before `now`, oldest first, requeued ones
81216
+ * included. They leave the accumulator: delivery is the caller's.
81217
+ */
81218
+ takeClosed(now) {
81219
+ const out = [];
81220
+ for (const [id, bucket] of this.open) if (bucket.bucketStart + 3e5 <= now) {
81221
+ out.push(toClosed(bucket));
81222
+ this.open.delete(id);
81223
+ }
81224
+ for (const list of this.requeued.values()) out.push(...list);
81225
+ this.requeued.clear();
81226
+ return out.toSorted((a, b) => a.bucketStart - b.bucketStart);
81227
+ }
81228
+ /**
81229
+ * Put undelivered buckets back for the next `takeClosed`. Keeps the newest
81230
+ * {@link MAX_REQUEUED_BUCKETS_PER_SERIES} per series and returns the buckets
81231
+ * it dropped (empty when none).
81232
+ */
81233
+ requeue(buckets) {
81234
+ const dropped = [];
81235
+ for (const bucket of buckets) {
81236
+ const id = seriesIdentity(bucket.key, bucket.subject, bucket.scope);
81237
+ const list = [...this.requeued.get(id) ?? [], bucket].toSorted((a, b) => a.bucketStart - b.bucketStart);
81238
+ while (list.length > 12) {
81239
+ const oldest = list.shift();
81240
+ if (oldest !== void 0) dropped.push(oldest);
81241
+ }
81242
+ this.requeued.set(id, list);
81243
+ }
81244
+ return dropped;
81245
+ }
81246
+ /** Buckets currently held (open plus requeued) — for a gauge in the producer's own status. */
81247
+ pendingBucketCount() {
81248
+ let n = this.open.size;
81249
+ for (const list of this.requeued.values()) n += list.length;
81250
+ return n;
81251
+ }
81252
+ };
80886
81253
  DeviceType.Camera;
80887
81254
  var G711_SCALE_CORRECTION_DB = {
80888
81255
  PCMU: 20 * Math.log10(4),
@@ -85046,6 +85413,12 @@ Object.defineProperty(exports, "BirthDecisionRecordSchema", {
85046
85413
  return BirthDecisionRecordSchema;
85047
85414
  }
85048
85415
  });
85416
+ Object.defineProperty(exports, "BucketAccumulator", {
85417
+ enumerable: true,
85418
+ get: function() {
85419
+ return BucketAccumulator;
85420
+ }
85421
+ });
85049
85422
  Object.defineProperty(exports, "CLIP_EMBEDDING_STEP_ID", {
85050
85423
  enumerable: true,
85051
85424
  get: function() {