@camstack/types 1.2.421 → 1.2.422

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 (39) hide show
  1. package/dist/addon.js +1 -1
  2. package/dist/addon.mjs +1 -1
  3. package/dist/capabilities/composer.cap.d.ts +129 -57
  4. package/dist/capabilities/core-blocks.cap.d.ts +936 -410
  5. package/dist/capabilities/index.d.ts +3 -1
  6. package/dist/capabilities/meter.cap.d.ts +53 -0
  7. package/dist/client.js +3 -0
  8. package/dist/client.mjs +3 -0
  9. package/dist/composition/composition-report.d.ts +45 -0
  10. package/dist/composition/composition.d.ts +196 -19
  11. package/dist/composition/helpers/compile-history.d.ts +13 -0
  12. package/dist/composition/helpers/compile.d.ts +2 -1
  13. package/dist/composition/helpers/energy.d.ts +8 -0
  14. package/dist/composition/helpers/history-math.d.ts +39 -0
  15. package/dist/composition/helpers/history-window.d.ts +71 -0
  16. package/dist/composition/helpers/index.d.ts +6 -2
  17. package/dist/composition/helpers/source-pick.d.ts +2 -0
  18. package/dist/composition/helpers/spec.d.ts +23 -10
  19. package/dist/{composition-B3Hkb6v7.js → composition-CPRAP41h.js} +792 -8
  20. package/dist/{composition-B2rw5L29.mjs → composition-CpETZ4HL.mjs} +595 -9
  21. package/dist/device/cap-vocabulary/entries/sensors.d.ts +1 -1
  22. package/dist/generated/addon-api.d.ts +14 -0
  23. package/dist/generated/addon-cap-facts.d.ts +1 -1
  24. package/dist/generated/cap-status-types.d.ts +3 -1
  25. package/dist/generated/capability-router-map.d.ts +5 -2
  26. package/dist/generated/device-local-state.d.ts +3 -0
  27. package/dist/generated/device-proxy.d.ts +3 -0
  28. package/dist/generated/device-scoped-caps.d.ts +1 -1
  29. package/dist/generated/history-catalog.d.ts +1 -1
  30. package/dist/generated/method-access-map.d.ts +1 -1
  31. package/dist/generated/method-device-selectors.d.ts +1 -1
  32. package/dist/generated/runtime-state-durability.d.ts +1 -1
  33. package/dist/index.js +747 -446
  34. package/dist/index.mjs +709 -447
  35. package/dist/node.js +1 -1
  36. package/dist/node.mjs +1 -1
  37. package/dist/{sleep-bykKrTgu.mjs → sleep-0sD_LHLI.mjs} +10 -1
  38. package/dist/{sleep-YJ6FVsUu.js → sleep-CEKGW7A5.js} +10 -1
  39. package/package.json +1 -1
@@ -198,6 +198,7 @@ export { type DeviceCodeSeverity, DeviceCodeSeveritySchema, type ILawnMowerContr
198
198
  export { type AdvertisedLocalPort, type ConnectionEndpoint, type HubAddressBook, type HubAddresses, HubAddressRoleSchema, type HubAddressRow, type HubAddressSnapshot, type ILocalNetworkProvider, type LocalInterface, localNetworkCapability, type NotificationEndpoint, } from './local-network.cap.js';
199
199
  export { type ILockControlProvider, type LockControlStatus, LockControlStatusSchema, type LockState, LockStateSchema, lockControlCapability, } from './lock-control.cap.js';
200
200
  export { type MaskGridDims, MaskGridDimsSchema, type MaskGridShape, MaskGridShapeSchema, type MaskLineShape, MaskLineShapeSchema, type MaskPoint, MaskPointSchema, type MaskPolygonShape, MaskPolygonShapeSchema, type MaskPolygonVertices, MaskPolygonVerticesSchema, type MaskRectShape, MaskRectShapeSchema, type MaskShape, type MaskShapeKind, MaskShapeKindSchema, MaskShapeSchema, } from './mask-shape.js';
201
+ export { type MeterStatus, MeterStatusSchema, meterCapability, type IMeterProvider, } from './meter.cap.js';
201
202
  export { type IMediaPlayerProvider, type MediaInfo, type MediaPlayerRepeat, MediaPlayerRepeatSchema, type MediaPlayerState, MediaPlayerStateSchema, type MediaPlayerStatus, MediaPlayerStatusSchema, mediaPlayerCapability, } from './media-player.cap.js';
202
203
  export { type IMeshNetworkProvider, type MeshEndpoint, type MeshPeer, MeshPeerSchema, type MeshStatus, MeshStatusSchema, meshNetworkCapability, } from './mesh-network.cap.js';
203
204
  export { type IMotionProvider, MOTION_CLOSE_AFTER_MS, MOTION_SPAN_TIMEOUT_MS, type MotionOnMotionChangedData, MotionOnMotionChangedDataSchema, type MotionStatus, MotionStatusSchema, motionCapability, } from './motion.cap.js';
@@ -357,6 +358,7 @@ import type { logChannelsCapability } from './log-channels.cap.js';
357
358
  import type { logDestinationCapability } from './log-destination.cap.js';
358
359
  import type { loginMethodCapability } from './login-method.cap.js';
359
360
  import type { mediaPlayerCapability } from './media-player.cap.js';
361
+ import type { meterCapability } from './meter.cap.js';
360
362
  import type { meshNetworkCapability } from './mesh-network.cap.js';
361
363
  import type { metricsProviderCapability } from './metrics-provider.cap.js';
362
364
  import type { modelConvertCapability } from './model-convert.cap.js';
@@ -441,6 +443,6 @@ import type { trainingProviderCapability } from './training-provider.cap.js';
441
443
  import type { zoneAnalyticsCapability } from './zone-analytics.cap.js';
442
444
  import type { zoneRulesCapability } from './zone-rules.cap.js';
443
445
  import type { zonesCapability } from './zones.cap.js';
444
- type AnyCapability = typeof streamSignalsCapability | typeof addonSettingsCapability | typeof alertsCapability | typeof storageCapability | typeof storageMigrationCapability | typeof storageProviderCapability | typeof storageEvictableCapability | typeof storageOccupancyCapability | typeof filesystemBrowseCapability | typeof backupCapability | typeof terminalSessionCapability | typeof settingsStoreCapability | typeof dataStoreProviderCapability | typeof databaseSnapshotCapability | typeof storageAdminCapability | typeof recordsCapability | typeof recordEntriesCapability | typeof deviceHistoryCapability | typeof keychainCapability | typeof keychainAdminCapability | typeof deviceCredentialsCapability | typeof nodeCertificatesCapability | typeof logChannelsCapability | typeof logDestinationCapability | typeof loadContributionCapability | typeof failureContributionCapability | typeof deviceRemovalHookCapability | typeof adminUiCapability | typeof viewerUiCapability | typeof ssoBridgeCapability | typeof userPasskeysCapability | typeof smtpProviderCapability | typeof mqttBrokerCapability | typeof brokerCapability | typeof deviceAdoptionCapability | typeof deviceAdminLinkCapability | typeof deviceExportCapability | typeof addonPagesCapability | typeof addonPagesSourceCapability | typeof addonWidgetsCapability | typeof addonWidgetsSourceCapability | typeof customModelRegistryCapability | typeof modelDistributorCapability | typeof modelConvertCapability | typeof addonRoutesCapability | typeof streamBrokerCapability | typeof decoderCapability | typeof webrtcSessionCapability | typeof cameraStreamsCapability | typeof calendarSourceCapability | typeof calendarsCapability | typeof motionDetectionCapability | typeof pipelineExecutorCapability | typeof detectionPipelineCapability | typeof cameraPipelineConfigCapability | typeof pipelineRunnerCapability | typeof pipelineOrchestratorCapability | typeof audioAnalyzerCapability | typeof audioAnalysisCapability | typeof audioCodecCapability | typeof embeddingEncoderCapability | typeof vectorStoreCapability | typeof deviceProviderCapability | typeof deviceManagerCapability | typeof deviceStateCapability | typeof authProviderCapability | typeof loginMethodCapability | typeof networkAccessCapability | typeof turnProviderCapability | typeof snapshotCapability | typeof llmCapability | typeof llmRuntimeCapability | typeof notificationOutputCapability | typeof composerCapability | typeof coreBlocksCapability | typeof notificationRulesCapability | typeof pipelineAnalyticsCapability | typeof metricsProviderCapability | typeof ptzCapability | typeof ptzAutotrackCapability | typeof navigationCapability | typeof consumablesCapability | typeof connectionTestCapability | typeof runningStateCapability | typeof rebootCapability | typeof deviceDiscoveryCapability | typeof brightnessCapability | typeof colorCapability | typeof climateControlCapability | typeof coverCapability | typeof valveCapability | typeof humidifierCapability | typeof waterHeaterCapability | typeof weatherCapability | typeof imageCapability | typeof lockControlCapability | typeof vacuumControlCapability | typeof petFeederCapability | typeof lawnMowerControlCapability | typeof fanControlCapability | typeof controlCapability | typeof notifierCapability | typeof mediaPlayerCapability | typeof alarmPanelCapability | typeof presenceCapability | typeof scriptRunnerCapability | typeof automationControlCapability | typeof motionTriggerCapability | typeof zonesCapability | typeof zoneRulesCapability | typeof trainingCapability | typeof trainingProviderCapability | typeof zoneAnalyticsCapability | typeof audioMetricsCapability | typeof motionCapability | typeof contactCapability | typeof floodCapability | typeof smokeCapability | typeof carbonMonoxideCapability | typeof gasCapability | typeof groupCommandsCapability | typeof groupStatusCapability | typeof tamperCapability | typeof vibrationCapability | typeof connectivityCapability | typeof binaryCapability | typeof temperatureSensorCapability | typeof heatingValveCapability | typeof humiditySensorCapability | typeof ambientLightSensorCapability | typeof pressureSensorCapability | typeof powerMeterCapability | typeof airQualitySensorCapability | typeof numericSensorCapability | typeof enumSensorCapability | typeof recordingCapability | typeof recordingArchiveCapability | typeof recordingExportCapability | typeof recordingSignalCapability | typeof deviceOpsCapability | typeof displayPaletteCapability | typeof platformProbeCapability | typeof localNetworkCapability | typeof meshNetworkCapability | typeof userManagementCapability | typeof systemCapability | typeof networkQualityCapability | typeof toastCapability | typeof nodesCapability | typeof serverManagementCapability | typeof integrationsCapability | typeof addonsCapability | typeof oauthIntegrationCapability | typeof oidcConnectionsCapability | typeof streamParamsCapability | typeof streamCatalogCapability | typeof motionZonesCapability | typeof cameraGridLayoutCapability | typeof sceneMonitorCapability | typeof privacyMaskCapability | typeof dayNightCapability | typeof recordingOnboardCapability | typeof imageSettingsCapability | typeof osdCapability | typeof osdManagerCapability | typeof accessoriesCapability | typeof batteryCapability | typeof networkLinkCapability | typeof buttonCapability | typeof cameraCredentialsCapability | typeof deviceStatusCapability | typeof doorbellCapability | typeof eventEmitterCapability | typeof faceGalleryCapability | typeof featureProbeCapability | typeof intercomCapability | typeof nativeObjectDetectionCapability | typeof plateGalleryCapability | typeof switchCapability | typeof updateCapability | typeof videoclipsCapability | typeof deviceExtensionCapability | typeof dishwasherCapability;
446
+ type AnyCapability = typeof streamSignalsCapability | typeof addonSettingsCapability | typeof alertsCapability | typeof storageCapability | typeof storageMigrationCapability | typeof storageProviderCapability | typeof storageEvictableCapability | typeof storageOccupancyCapability | typeof filesystemBrowseCapability | typeof backupCapability | typeof terminalSessionCapability | typeof settingsStoreCapability | typeof dataStoreProviderCapability | typeof databaseSnapshotCapability | typeof storageAdminCapability | typeof recordsCapability | typeof recordEntriesCapability | typeof deviceHistoryCapability | typeof keychainCapability | typeof keychainAdminCapability | typeof deviceCredentialsCapability | typeof nodeCertificatesCapability | typeof logChannelsCapability | typeof logDestinationCapability | typeof loadContributionCapability | typeof failureContributionCapability | typeof deviceRemovalHookCapability | typeof adminUiCapability | typeof viewerUiCapability | typeof ssoBridgeCapability | typeof userPasskeysCapability | typeof smtpProviderCapability | typeof mqttBrokerCapability | typeof brokerCapability | typeof deviceAdoptionCapability | typeof deviceAdminLinkCapability | typeof deviceExportCapability | typeof addonPagesCapability | typeof addonPagesSourceCapability | typeof addonWidgetsCapability | typeof addonWidgetsSourceCapability | typeof customModelRegistryCapability | typeof modelDistributorCapability | typeof modelConvertCapability | typeof addonRoutesCapability | typeof streamBrokerCapability | typeof decoderCapability | typeof webrtcSessionCapability | typeof cameraStreamsCapability | typeof calendarSourceCapability | typeof calendarsCapability | typeof motionDetectionCapability | typeof pipelineExecutorCapability | typeof detectionPipelineCapability | typeof cameraPipelineConfigCapability | typeof pipelineRunnerCapability | typeof pipelineOrchestratorCapability | typeof audioAnalyzerCapability | typeof audioAnalysisCapability | typeof audioCodecCapability | typeof embeddingEncoderCapability | typeof vectorStoreCapability | typeof deviceProviderCapability | typeof deviceManagerCapability | typeof deviceStateCapability | typeof authProviderCapability | typeof loginMethodCapability | typeof networkAccessCapability | typeof turnProviderCapability | typeof snapshotCapability | typeof llmCapability | typeof llmRuntimeCapability | typeof notificationOutputCapability | typeof composerCapability | typeof coreBlocksCapability | typeof notificationRulesCapability | typeof pipelineAnalyticsCapability | typeof metricsProviderCapability | typeof ptzCapability | typeof ptzAutotrackCapability | typeof navigationCapability | typeof consumablesCapability | typeof connectionTestCapability | typeof runningStateCapability | typeof rebootCapability | typeof deviceDiscoveryCapability | typeof brightnessCapability | typeof colorCapability | typeof climateControlCapability | typeof coverCapability | typeof valveCapability | typeof humidifierCapability | typeof waterHeaterCapability | typeof weatherCapability | typeof imageCapability | typeof lockControlCapability | typeof vacuumControlCapability | typeof petFeederCapability | typeof lawnMowerControlCapability | typeof fanControlCapability | typeof controlCapability | typeof notifierCapability | typeof mediaPlayerCapability | typeof meterCapability | typeof alarmPanelCapability | typeof presenceCapability | typeof scriptRunnerCapability | typeof automationControlCapability | typeof motionTriggerCapability | typeof zonesCapability | typeof zoneRulesCapability | typeof trainingCapability | typeof trainingProviderCapability | typeof zoneAnalyticsCapability | typeof audioMetricsCapability | typeof motionCapability | typeof contactCapability | typeof floodCapability | typeof smokeCapability | typeof carbonMonoxideCapability | typeof gasCapability | typeof groupCommandsCapability | typeof groupStatusCapability | typeof tamperCapability | typeof vibrationCapability | typeof connectivityCapability | typeof binaryCapability | typeof temperatureSensorCapability | typeof heatingValveCapability | typeof humiditySensorCapability | typeof ambientLightSensorCapability | typeof pressureSensorCapability | typeof powerMeterCapability | typeof airQualitySensorCapability | typeof numericSensorCapability | typeof enumSensorCapability | typeof recordingCapability | typeof recordingArchiveCapability | typeof recordingExportCapability | typeof recordingSignalCapability | typeof deviceOpsCapability | typeof displayPaletteCapability | typeof platformProbeCapability | typeof localNetworkCapability | typeof meshNetworkCapability | typeof userManagementCapability | typeof systemCapability | typeof networkQualityCapability | typeof toastCapability | typeof nodesCapability | typeof serverManagementCapability | typeof integrationsCapability | typeof addonsCapability | typeof oauthIntegrationCapability | typeof oidcConnectionsCapability | typeof streamParamsCapability | typeof streamCatalogCapability | typeof motionZonesCapability | typeof cameraGridLayoutCapability | typeof sceneMonitorCapability | typeof privacyMaskCapability | typeof dayNightCapability | typeof recordingOnboardCapability | typeof imageSettingsCapability | typeof osdCapability | typeof osdManagerCapability | typeof accessoriesCapability | typeof batteryCapability | typeof networkLinkCapability | typeof buttonCapability | typeof cameraCredentialsCapability | typeof deviceStatusCapability | typeof doorbellCapability | typeof eventEmitterCapability | typeof faceGalleryCapability | typeof featureProbeCapability | typeof intercomCapability | typeof nativeObjectDetectionCapability | typeof plateGalleryCapability | typeof switchCapability | typeof updateCapability | typeof videoclipsCapability | typeof deviceExtensionCapability | typeof dishwasherCapability;
445
447
  export type CapabilityName = AnyCapability['name'];
446
448
  export type ITypedReadinessRegistry = IReadinessRegistry<CapabilityName>;
@@ -0,0 +1,53 @@
1
+ import { z } from 'zod';
2
+ import { type InferProvider } from './capability-definition.js';
3
+ import { DeviceType } from '../device/device-type.js';
4
+ /**
5
+ * A monotonic total between resets (D944). Energy uses `power-meter.kwhTotal`
6
+ * so dashboards keep one series; every other instantaneous reading lands here.
7
+ * `value` is the time integral in the source quantity's accumulated base
8
+ * (base-unit seconds, or kWh on the power meter). `null` is a gap, never zero.
9
+ */
10
+ export declare const MeterStatusSchema: z.ZodObject<{
11
+ value: z.ZodNullable<z.ZodNumber>;
12
+ lastFetchedAt: z.ZodNumber;
13
+ }, z.core.$strip>;
14
+ export type MeterStatus = z.infer<typeof MeterStatusSchema>;
15
+ export declare const meterCapability: {
16
+ readonly name: 'meter';
17
+ readonly scope: 'device';
18
+ readonly deviceNative: true;
19
+ readonly mode: 'singleton';
20
+ readonly deviceTypes: readonly [DeviceType.Sensor];
21
+ readonly methods: {};
22
+ readonly status: {
23
+ readonly schema: z.ZodObject<{
24
+ value: z.ZodNullable<z.ZodNumber>;
25
+ lastFetchedAt: z.ZodNumber;
26
+ }, z.core.$strip>;
27
+ readonly kind: 'push';
28
+ };
29
+ readonly runtimeState: z.ZodObject<{
30
+ value: z.ZodNullable<z.ZodNumber>;
31
+ lastFetchedAt: z.ZodNumber;
32
+ }, z.core.$strip>;
33
+ /**
34
+ * Runtime-state durability: **restored** — the total is a cache of the
35
+ * history integral. A restart shows it only until the history pass
36
+ * recomputes the open period; it is not an in-memory buffer.
37
+ *
38
+ * See `RuntimeStateDurability`. Enforced by
39
+ * `scripts/check-runtime-state-durability.ts`.
40
+ */
41
+ readonly durability: 'restored';
42
+ readonly history: {
43
+ readonly fields: {
44
+ readonly value: {
45
+ readonly kind: 'counter';
46
+ readonly deadband: 0.001;
47
+ readonly minIntervalMs: 60000;
48
+ };
49
+ };
50
+ };
51
+ readonly volatileStateFields: readonly ["lastFetchedAt"];
52
+ };
53
+ export type IMeterProvider = InferProvider<typeof meterCapability>;
package/dist/client.js CHANGED
@@ -26886,6 +26886,7 @@ function createDeviceProxy(api, binding, opts) {
26886
26886
  playMedia: (input) => dispatch("media-player", "mediaPlayer", "playMedia", "mutation", input),
26887
26887
  getStatus: (input) => dispatch("media-player", "mediaPlayer", "getStatus", "query", input)
26888
26888
  };
26889
+ const meterInterface = { getStatus: (input) => dispatch("meter", "meter", "getStatus", "query", input) };
26889
26890
  const motionInterface = {
26890
26891
  isDetected: (input) => dispatch("motion", "motion", "isDetected", "query", input),
26891
26892
  getStatus: (input) => dispatch("motion", "motion", "getStatus", "query", input)
@@ -27401,6 +27402,7 @@ function createDeviceProxy(api, binding, opts) {
27401
27402
  lawnMowerControl: createSliceHandle(stateSource, binding.deviceId, "lawn-mower-control"),
27402
27403
  lockControl: createSliceHandle(stateSource, binding.deviceId, "lock-control"),
27403
27404
  mediaPlayer: createSliceHandle(stateSource, binding.deviceId, "media-player"),
27405
+ meter: createSliceHandle(stateSource, binding.deviceId, "meter"),
27404
27406
  motion: createSliceHandle(stateSource, binding.deviceId, "motion"),
27405
27407
  motionTrigger: createSliceHandle(stateSource, binding.deviceId, "motion-trigger"),
27406
27408
  motionZones: createSliceHandle(stateSource, binding.deviceId, "motion-zones"),
@@ -27486,6 +27488,7 @@ function createDeviceProxy(api, binding, opts) {
27486
27488
  ...bound("lawn-mower-control") ? { lawnMowerControl: lawnMowerControlInterface } : {},
27487
27489
  ...bound("lock-control") ? { lockControl: lockControlInterface } : {},
27488
27490
  ...bound("media-player") ? { mediaPlayer: mediaPlayerInterface } : {},
27491
+ ...bound("meter") ? { meter: meterInterface } : {},
27489
27492
  ...bound("motion") ? { motion: motionInterface } : {},
27490
27493
  ...bound("motion-detection") ? { motionDetection: motionDetectionInterface } : {},
27491
27494
  ...bound("motion-trigger") ? { motionTrigger: motionTriggerInterface } : {},
package/dist/client.mjs CHANGED
@@ -26885,6 +26885,7 @@ function createDeviceProxy(api, binding, opts) {
26885
26885
  playMedia: (input) => dispatch("media-player", "mediaPlayer", "playMedia", "mutation", input),
26886
26886
  getStatus: (input) => dispatch("media-player", "mediaPlayer", "getStatus", "query", input)
26887
26887
  };
26888
+ const meterInterface = { getStatus: (input) => dispatch("meter", "meter", "getStatus", "query", input) };
26888
26889
  const motionInterface = {
26889
26890
  isDetected: (input) => dispatch("motion", "motion", "isDetected", "query", input),
26890
26891
  getStatus: (input) => dispatch("motion", "motion", "getStatus", "query", input)
@@ -27400,6 +27401,7 @@ function createDeviceProxy(api, binding, opts) {
27400
27401
  lawnMowerControl: createSliceHandle(stateSource, binding.deviceId, "lawn-mower-control"),
27401
27402
  lockControl: createSliceHandle(stateSource, binding.deviceId, "lock-control"),
27402
27403
  mediaPlayer: createSliceHandle(stateSource, binding.deviceId, "media-player"),
27404
+ meter: createSliceHandle(stateSource, binding.deviceId, "meter"),
27403
27405
  motion: createSliceHandle(stateSource, binding.deviceId, "motion"),
27404
27406
  motionTrigger: createSliceHandle(stateSource, binding.deviceId, "motion-trigger"),
27405
27407
  motionZones: createSliceHandle(stateSource, binding.deviceId, "motion-zones"),
@@ -27485,6 +27487,7 @@ function createDeviceProxy(api, binding, opts) {
27485
27487
  ...bound("lawn-mower-control") ? { lawnMowerControl: lawnMowerControlInterface } : {},
27486
27488
  ...bound("lock-control") ? { lockControl: lockControlInterface } : {},
27487
27489
  ...bound("media-player") ? { mediaPlayer: mediaPlayerInterface } : {},
27490
+ ...bound("meter") ? { meter: meterInterface } : {},
27488
27491
  ...bound("motion") ? { motion: motionInterface } : {},
27489
27492
  ...bound("motion-detection") ? { motionDetection: motionDetectionInterface } : {},
27490
27493
  ...bound("motion-trigger") ? { motionTrigger: motionTriggerInterface } : {},
@@ -21,6 +21,7 @@ export declare const CompositionProblemCodeSchema: z.ZodEnum<{
21
21
  "not-item-array": "not-item-array";
22
22
  "not-replaceable": "not-replaceable";
23
23
  "reserved-variant": "reserved-variant";
24
+ retention: "retention";
24
25
  "source-capability-missing": "source-capability-missing";
25
26
  "source-field-unknown": "source-field-unknown";
26
27
  "source-missing": "source-missing";
@@ -52,6 +53,7 @@ export declare const CompositionProblemSchema: z.ZodObject<{
52
53
  "not-item-array": "not-item-array";
53
54
  "not-replaceable": "not-replaceable";
54
55
  "reserved-variant": "reserved-variant";
56
+ retention: "retention";
55
57
  "source-capability-missing": "source-capability-missing";
56
58
  "source-field-unknown": "source-field-unknown";
57
59
  "source-missing": "source-missing";
@@ -192,6 +194,27 @@ export declare const CompositionFieldPlanSchema: z.ZodObject<{
192
194
  offline: "offline";
193
195
  omit: "omit";
194
196
  }>;
197
+ }, z.core.$strip>, z.ZodObject<{
198
+ kind: z.ZodLiteral<"series">;
199
+ read: z.ZodObject<{
200
+ source: z.ZodObject<{
201
+ addonId: z.ZodString;
202
+ stableId: z.ZodString;
203
+ }, z.core.$strip>;
204
+ cap: z.ZodString;
205
+ fieldPath: z.ZodString;
206
+ }, z.core.$strip>;
207
+ publish: z.ZodEnum<{
208
+ excluded: "excluded";
209
+ included: "included";
210
+ total: "total";
211
+ value: "value";
212
+ }>;
213
+ empty: z.ZodEnum<{
214
+ null: "null";
215
+ offline: "offline";
216
+ omit: "omit";
217
+ }>;
195
218
  }, z.core.$strip>], "kind">;
196
219
  reads: z.ZodArray<z.ZodObject<{
197
220
  source: z.ZodObject<{
@@ -249,6 +272,7 @@ export declare const CompositionValidationSchema: z.ZodObject<{
249
272
  "not-item-array": "not-item-array";
250
273
  "not-replaceable": "not-replaceable";
251
274
  "reserved-variant": "reserved-variant";
275
+ retention: "retention";
252
276
  "source-capability-missing": "source-capability-missing";
253
277
  "source-field-unknown": "source-field-unknown";
254
278
  "source-missing": "source-missing";
@@ -348,6 +372,27 @@ export declare const CompositionValidationSchema: z.ZodObject<{
348
372
  offline: "offline";
349
373
  omit: "omit";
350
374
  }>;
375
+ }, z.core.$strip>, z.ZodObject<{
376
+ kind: z.ZodLiteral<"series">;
377
+ read: z.ZodObject<{
378
+ source: z.ZodObject<{
379
+ addonId: z.ZodString;
380
+ stableId: z.ZodString;
381
+ }, z.core.$strip>;
382
+ cap: z.ZodString;
383
+ fieldPath: z.ZodString;
384
+ }, z.core.$strip>;
385
+ publish: z.ZodEnum<{
386
+ excluded: "excluded";
387
+ included: "included";
388
+ total: "total";
389
+ value: "value";
390
+ }>;
391
+ empty: z.ZodEnum<{
392
+ null: "null";
393
+ offline: "offline";
394
+ omit: "omit";
395
+ }>;
351
396
  }, z.core.$strip>], "kind">;
352
397
  reads: z.ZodArray<z.ZodObject<{
353
398
  source: z.ZodObject<{
@@ -141,6 +141,33 @@ export declare const CompositionAggregateSourceSchema: z.ZodObject<{
141
141
  }>;
142
142
  }, z.core.$strip>;
143
143
  export type CompositionAggregateSource = z.infer<typeof CompositionAggregateSourceSchema>;
144
+ /**
145
+ * `series`: a statistics or integral field. The composer writes it from a
146
+ * history query. The live pass does not recompute it (D944).
147
+ */
148
+ export declare const CompositionSeriesSourceSchema: z.ZodObject<{
149
+ kind: z.ZodLiteral<"series">;
150
+ read: z.ZodObject<{
151
+ source: z.ZodObject<{
152
+ addonId: z.ZodString;
153
+ stableId: z.ZodString;
154
+ }, z.core.$strip>;
155
+ cap: z.ZodString;
156
+ fieldPath: z.ZodString;
157
+ }, z.core.$strip>;
158
+ publish: z.ZodEnum<{
159
+ excluded: "excluded";
160
+ included: "included";
161
+ total: "total";
162
+ value: "value";
163
+ }>;
164
+ empty: z.ZodEnum<{
165
+ null: "null";
166
+ offline: "offline";
167
+ omit: "omit";
168
+ }>;
169
+ }, z.core.$strip>;
170
+ export type CompositionSeriesSource = z.infer<typeof CompositionSeriesSourceSchema>;
144
171
  export declare const CompositionFieldSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
145
172
  source: z.ZodObject<{
146
173
  addonId: z.ZodString;
@@ -197,6 +224,27 @@ export declare const CompositionFieldSourceSchema: z.ZodDiscriminatedUnion<[z.Zo
197
224
  offline: "offline";
198
225
  omit: "omit";
199
226
  }>;
227
+ }, z.core.$strip>, z.ZodObject<{
228
+ kind: z.ZodLiteral<"series">;
229
+ read: z.ZodObject<{
230
+ source: z.ZodObject<{
231
+ addonId: z.ZodString;
232
+ stableId: z.ZodString;
233
+ }, z.core.$strip>;
234
+ cap: z.ZodString;
235
+ fieldPath: z.ZodString;
236
+ }, z.core.$strip>;
237
+ publish: z.ZodEnum<{
238
+ excluded: "excluded";
239
+ included: "included";
240
+ total: "total";
241
+ value: "value";
242
+ }>;
243
+ empty: z.ZodEnum<{
244
+ null: "null";
245
+ offline: "offline";
246
+ omit: "omit";
247
+ }>;
200
248
  }, z.core.$strip>], "kind">;
201
249
  export type CompositionFieldSource = z.infer<typeof CompositionFieldSourceSchema>;
202
250
  /** `forward`: RESERVED for slice 3. Argument mapping arrives there as an additive optional `args`. */
@@ -291,6 +339,27 @@ export declare const CompositionItemEntrySchema: z.ZodObject<{
291
339
  offline: "offline";
292
340
  omit: "omit";
293
341
  }>;
342
+ }, z.core.$strip>, z.ZodObject<{
343
+ kind: z.ZodLiteral<"series">;
344
+ read: z.ZodObject<{
345
+ source: z.ZodObject<{
346
+ addonId: z.ZodString;
347
+ stableId: z.ZodString;
348
+ }, z.core.$strip>;
349
+ cap: z.ZodString;
350
+ fieldPath: z.ZodString;
351
+ }, z.core.$strip>;
352
+ publish: z.ZodEnum<{
353
+ excluded: "excluded";
354
+ included: "included";
355
+ total: "total";
356
+ value: "value";
357
+ }>;
358
+ empty: z.ZodEnum<{
359
+ null: "null";
360
+ offline: "offline";
361
+ omit: "omit";
362
+ }>;
294
363
  }, z.core.$strip>], "kind">>;
295
364
  }, z.core.$strip>;
296
365
  export type CompositionItemEntry = z.infer<typeof CompositionItemEntrySchema>;
@@ -354,6 +423,27 @@ export declare const CompositionFieldsFeatureSchema: z.ZodObject<{
354
423
  offline: "offline";
355
424
  omit: "omit";
356
425
  }>;
426
+ }, z.core.$strip>, z.ZodObject<{
427
+ kind: z.ZodLiteral<"series">;
428
+ read: z.ZodObject<{
429
+ source: z.ZodObject<{
430
+ addonId: z.ZodString;
431
+ stableId: z.ZodString;
432
+ }, z.core.$strip>;
433
+ cap: z.ZodString;
434
+ fieldPath: z.ZodString;
435
+ }, z.core.$strip>;
436
+ publish: z.ZodEnum<{
437
+ excluded: "excluded";
438
+ included: "included";
439
+ total: "total";
440
+ value: "value";
441
+ }>;
442
+ empty: z.ZodEnum<{
443
+ null: "null";
444
+ offline: "offline";
445
+ omit: "omit";
446
+ }>;
357
447
  }, z.core.$strip>], "kind">>;
358
448
  items: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
359
449
  label: z.ZodString;
@@ -413,6 +503,27 @@ export declare const CompositionFieldsFeatureSchema: z.ZodObject<{
413
503
  offline: "offline";
414
504
  omit: "omit";
415
505
  }>;
506
+ }, z.core.$strip>, z.ZodObject<{
507
+ kind: z.ZodLiteral<"series">;
508
+ read: z.ZodObject<{
509
+ source: z.ZodObject<{
510
+ addonId: z.ZodString;
511
+ stableId: z.ZodString;
512
+ }, z.core.$strip>;
513
+ cap: z.ZodString;
514
+ fieldPath: z.ZodString;
515
+ }, z.core.$strip>;
516
+ publish: z.ZodEnum<{
517
+ excluded: "excluded";
518
+ included: "included";
519
+ total: "total";
520
+ value: "value";
521
+ }>;
522
+ empty: z.ZodEnum<{
523
+ null: "null";
524
+ offline: "offline";
525
+ omit: "omit";
526
+ }>;
416
527
  }, z.core.$strip>], "kind">>;
417
528
  }, z.core.$strip>>>;
418
529
  commands: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -500,6 +611,27 @@ export declare const CompositionFeatureSchema: z.ZodDiscriminatedUnion<[z.ZodObj
500
611
  offline: "offline";
501
612
  omit: "omit";
502
613
  }>;
614
+ }, z.core.$strip>, z.ZodObject<{
615
+ kind: z.ZodLiteral<"series">;
616
+ read: z.ZodObject<{
617
+ source: z.ZodObject<{
618
+ addonId: z.ZodString;
619
+ stableId: z.ZodString;
620
+ }, z.core.$strip>;
621
+ cap: z.ZodString;
622
+ fieldPath: z.ZodString;
623
+ }, z.core.$strip>;
624
+ publish: z.ZodEnum<{
625
+ excluded: "excluded";
626
+ included: "included";
627
+ total: "total";
628
+ value: "value";
629
+ }>;
630
+ empty: z.ZodEnum<{
631
+ null: "null";
632
+ offline: "offline";
633
+ omit: "omit";
634
+ }>;
503
635
  }, z.core.$strip>], "kind">>;
504
636
  items: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
505
637
  label: z.ZodString;
@@ -559,6 +691,27 @@ export declare const CompositionFeatureSchema: z.ZodDiscriminatedUnion<[z.ZodObj
559
691
  offline: "offline";
560
692
  omit: "omit";
561
693
  }>;
694
+ }, z.core.$strip>, z.ZodObject<{
695
+ kind: z.ZodLiteral<"series">;
696
+ read: z.ZodObject<{
697
+ source: z.ZodObject<{
698
+ addonId: z.ZodString;
699
+ stableId: z.ZodString;
700
+ }, z.core.$strip>;
701
+ cap: z.ZodString;
702
+ fieldPath: z.ZodString;
703
+ }, z.core.$strip>;
704
+ publish: z.ZodEnum<{
705
+ excluded: "excluded";
706
+ included: "included";
707
+ total: "total";
708
+ value: "value";
709
+ }>;
710
+ empty: z.ZodEnum<{
711
+ null: "null";
712
+ offline: "offline";
713
+ omit: "omit";
714
+ }>;
562
715
  }, z.core.$strip>], "kind">>;
563
716
  }, z.core.$strip>>>;
564
717
  commands: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -688,6 +841,27 @@ export declare const CompositionSchema: z.ZodObject<{
688
841
  offline: "offline";
689
842
  omit: "omit";
690
843
  }>;
844
+ }, z.core.$strip>, z.ZodObject<{
845
+ kind: z.ZodLiteral<"series">;
846
+ read: z.ZodObject<{
847
+ source: z.ZodObject<{
848
+ addonId: z.ZodString;
849
+ stableId: z.ZodString;
850
+ }, z.core.$strip>;
851
+ cap: z.ZodString;
852
+ fieldPath: z.ZodString;
853
+ }, z.core.$strip>;
854
+ publish: z.ZodEnum<{
855
+ excluded: "excluded";
856
+ included: "included";
857
+ total: "total";
858
+ value: "value";
859
+ }>;
860
+ empty: z.ZodEnum<{
861
+ null: "null";
862
+ offline: "offline";
863
+ omit: "omit";
864
+ }>;
691
865
  }, z.core.$strip>], "kind">>;
692
866
  items: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
693
867
  label: z.ZodString;
@@ -747,6 +921,27 @@ export declare const CompositionSchema: z.ZodObject<{
747
921
  offline: "offline";
748
922
  omit: "omit";
749
923
  }>;
924
+ }, z.core.$strip>, z.ZodObject<{
925
+ kind: z.ZodLiteral<"series">;
926
+ read: z.ZodObject<{
927
+ source: z.ZodObject<{
928
+ addonId: z.ZodString;
929
+ stableId: z.ZodString;
930
+ }, z.core.$strip>;
931
+ cap: z.ZodString;
932
+ fieldPath: z.ZodString;
933
+ }, z.core.$strip>;
934
+ publish: z.ZodEnum<{
935
+ excluded: "excluded";
936
+ included: "included";
937
+ total: "total";
938
+ value: "value";
939
+ }>;
940
+ empty: z.ZodEnum<{
941
+ null: "null";
942
+ offline: "offline";
943
+ omit: "omit";
944
+ }>;
750
945
  }, z.core.$strip>], "kind">>;
751
946
  }, z.core.$strip>>>;
752
947
  commands: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -770,25 +965,7 @@ export declare const CompositionSchema: z.ZodObject<{
770
965
  stableId: z.ZodString;
771
966
  }, z.core.$strip>;
772
967
  }, z.core.$strip>], "kind">>;
773
- helper: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
774
- kind: z.ZodLiteral<'group'>;
775
- templateId: typeof import("./index.js").GroupTemplateIdSchema;
776
- aggregate: typeof import("./index.js").AggregateReducerSchema;
777
- members: z.ZodArray<typeof import("./index.js").HelperMemberSchema>;
778
- active: z.ZodOptional<typeof import("./index.js").ActiveCriterionSchema>;
779
- }, z.core.$strip>, z.ZodObject<{
780
- kind: z.ZodLiteral<'appliance'>;
781
- templateId: z.ZodLiteral<typeof import("./index.js").APPLIANCE_TEMPLATE_ID>;
782
- appliance: z.ZodEnum<{
783
- washer: 'washer';
784
- dryer: 'dryer';
785
- dishwasher: 'dishwasher';
786
- }>;
787
- thresholdWatts: z.ZodNumber;
788
- startDwellMs: z.ZodNumber;
789
- stopDwellMs: z.ZodNumber;
790
- member: typeof import("./index.js").HelperMemberSchema;
791
- }, z.core.$strip>], "kind">>;
968
+ helper: z.ZodOptional<z.ZodType<import("./index.js").HelperSpec, unknown, z.core.$ZodTypeInternals<import("./index.js").HelperSpec, unknown>>>;
792
969
  }, z.core.$strip>;
793
970
  export type Composition = z.infer<typeof CompositionSchema>;
794
971
  export declare function compositionSourceKey(ref: CompositionSourceRef): string;
@@ -0,0 +1,13 @@
1
+ import type { CompositionProblem } from '../composition-report.js';
2
+ import type { SeriesKind } from './history-math.js';
3
+ import { type HistoryRetention } from './history-window.js';
4
+ import type { HelperMember, IntegralHelperSpec, StatisticHelperSpec } from './spec.js';
5
+ export declare function declaredSeriesKind(member: HelperMember): SeriesKind | 'enum' | null;
6
+ export declare function statisticDraft(spec: StatisticHelperSpec, retention?: HistoryRetention): {
7
+ readonly draft: unknown;
8
+ readonly problems: readonly CompositionProblem[];
9
+ };
10
+ export declare function integralDraft(spec: IntegralHelperSpec, retention?: HistoryRetention): {
11
+ readonly draft: unknown;
12
+ readonly problems: readonly CompositionProblem[];
13
+ };
@@ -5,6 +5,7 @@
5
5
  import { DeviceType } from '../../device/device-type.js';
6
6
  import { type Composition } from '../composition.js';
7
7
  import type { CompositionProblem } from '../composition-report.js';
8
+ import { type HistoryRetention } from './history-window.js';
8
9
  import { type HelperSpec } from './spec.js';
9
10
  export interface HelperCompiled {
10
11
  readonly ok: true;
@@ -16,7 +17,7 @@ export interface HelperRefused {
16
17
  }
17
18
  export type HelperCompileResult = HelperCompiled | HelperRefused;
18
19
  /** Compile a helper template to a new-device composition. Refusals are named. */
19
- export declare function compileHelper(spec: HelperSpec): HelperCompileResult;
20
+ export declare function compileHelper(spec: HelperSpec, retention?: HistoryRetention): HelperCompileResult;
20
21
  /** The built body, ignoring `helper`, so a save can demand one writer. */
21
22
  export declare function sameHelperBody(stored: Composition, compiled: Composition): boolean;
22
23
  export declare function templateDeviceType(spec: HelperSpec): DeviceType | null;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Watts integrated over time, in kWh (D944).
3
+ *
4
+ * 1 kWh = 1 000 W × 3 600 000 ms. The history energy series uses the same
5
+ * factor (`tw_sum / 3.6e9`), so a chart and an integral helper cannot diverge.
6
+ */
7
+ export declare const KWH_PER_WATT_MS: number;
8
+ export declare function wattMillisecondsToKwh(wattMilliseconds: number): number;
@@ -0,0 +1,39 @@
1
+ import type { HistoryTier } from './history-window.js';
2
+ export declare const STATISTIC_STATS: readonly ['min', 'max', 'mean', 'sum', 'count', 'change'];
3
+ export type StatisticStat = (typeof STATISTIC_STATS)[number];
4
+ export declare const SERIES_KINDS: readonly ['gauge', 'counter', 'boolean'];
5
+ export type SeriesKind = (typeof SERIES_KINDS)[number];
6
+ export interface SeriesPoint {
7
+ readonly t: number;
8
+ readonly value: number | null;
9
+ readonly twMean: number | null;
10
+ readonly twMs: number | null;
11
+ readonly min: number | null;
12
+ readonly max: number | null;
13
+ readonly last: number | null;
14
+ readonly delta: number | null;
15
+ }
16
+ export interface SeriesBefore {
17
+ readonly t: number;
18
+ readonly value: number | null;
19
+ }
20
+ export interface SeriesRead {
21
+ readonly kind: SeriesKind;
22
+ readonly tier: HistoryTier;
23
+ readonly from: number;
24
+ readonly to: number;
25
+ readonly before: SeriesBefore | null;
26
+ readonly points: readonly SeriesPoint[];
27
+ readonly truncated: boolean;
28
+ }
29
+ export interface HistoryValue {
30
+ /** `hold` keeps the last published number. `null` is a known gap (D393). */
31
+ readonly write: 'number' | 'null' | 'hold';
32
+ readonly value: number | null;
33
+ readonly included: number;
34
+ readonly excluded: number;
35
+ readonly reason: string | null;
36
+ }
37
+ export declare function evaluateStatistic(stat: StatisticStat, read: SeriesRead): HistoryValue;
38
+ export type IntegralScale = 'energy-kwh' | 'per-second';
39
+ export declare function integrateReading(read: SeriesRead, scale: IntegralScale): HistoryValue;