@camstack/types 1.2.387 → 1.2.388

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 (33) hide show
  1. package/dist/addon.js +24 -14
  2. package/dist/addon.mjs +24 -14
  3. package/dist/capabilities/alarm-panel.cap.d.ts +10 -2
  4. package/dist/capabilities/capability-definition.d.ts +21 -3
  5. package/dist/capabilities/connectivity.cap.d.ts +10 -2
  6. package/dist/capabilities/device-history.cap.d.ts +195 -3
  7. package/dist/capabilities/dishwasher.cap.d.ts +17 -0
  8. package/dist/capabilities/enum-sensor.cap.d.ts +12 -2
  9. package/dist/capabilities/index.d.ts +4 -3
  10. package/dist/capabilities/lock-control.cap.d.ts +9 -2
  11. package/dist/capabilities/log-destination.cap.d.ts +148 -19
  12. package/dist/capabilities/media-player.cap.d.ts +15 -2
  13. package/dist/capabilities/notification-rules.cap.d.ts +213 -13
  14. package/dist/capabilities/stream-params.cap.d.ts +24 -2
  15. package/dist/client.js +75 -6
  16. package/dist/client.mjs +75 -6
  17. package/dist/device/base-device.d.ts +34 -1
  18. package/dist/device/index.d.ts +2 -2
  19. package/dist/generated/addon-api.d.ts +89 -12
  20. package/dist/generated/cap-input-defaults.d.ts +1 -1
  21. package/dist/generated/collection-array-methods.d.ts +2 -2
  22. package/dist/generated/history-catalog.d.ts +1 -1
  23. package/dist/generated/method-access-map.d.ts +1 -1
  24. package/dist/generated/method-device-selectors.d.ts +2 -2
  25. package/dist/generated/system-proxy.d.ts +1 -1
  26. package/dist/index.d.ts +3 -2
  27. package/dist/index.js +584 -53
  28. package/dist/index.mjs +568 -54
  29. package/dist/interfaces/logging.d.ts +16 -1
  30. package/dist/notification/media-image.d.ts +67 -0
  31. package/dist/{sleep-yKL5gfrH.mjs → sleep-BSuCCFjf.mjs} +3 -1
  32. package/dist/{sleep-6sOPE0EV.js → sleep-DKtoyk6X.js} +3 -1
  33. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-6sOPE0EV.js");
2
+ const require_sleep = require("./sleep-DKtoyk6X.js");
3
3
  const require_event_category = require("./event-category-eSqkye-K.js");
4
4
  const require_err_msg = require("./err-msg-BhVbr0NX.js");
5
5
  //#region src/generated/cap-input-defaults.ts
@@ -16,7 +16,7 @@ const require_err_msg = require("./err-msg-BhVbr0NX.js");
16
16
  * Plain data, zero Zod: a forked runner must not import the schema barrel
17
17
  * (~144MB RSS per runner — D28).
18
18
  *
19
- * Coverage: 29 caps, 71 methods with defaults.
19
+ * Coverage: 29 caps, 72 methods with defaults.
20
20
  */
21
21
  var CAP_INPUT_DEFAULTS = Object.freeze({
22
22
  "addons": { "getLogs": { "limit": 100 } },
@@ -45,6 +45,10 @@ var CAP_INPUT_DEFAULTS = Object.freeze({
45
45
  "resolution": "auto",
46
46
  "maxPoints": 1e3
47
47
  },
48
+ "queryMany": {
49
+ "resolution": "auto",
50
+ "maxPoints": 1e3
51
+ },
48
52
  "queryNode": {
49
53
  "resolution": "auto",
50
54
  "maxPoints": 1e3
@@ -103,7 +107,7 @@ var CAP_INPUT_DEFAULTS = Object.freeze({
103
107
  "createRule": { "rule": { "__nested__": {
104
108
  "enabled": true,
105
109
  "conditions": {},
106
- "media": { "attach": "best" },
110
+ "media": {},
107
111
  "throttle": {
108
112
  "cooldownSec": 60,
109
113
  "scope": "rule-device"
@@ -114,7 +118,7 @@ var CAP_INPUT_DEFAULTS = Object.freeze({
114
118
  "previewStateSummary": { "rule": { "__nested__": {
115
119
  "enabled": true,
116
120
  "conditions": {},
117
- "media": { "attach": "best" },
121
+ "media": {},
118
122
  "throttle": {
119
123
  "cooldownSec": 60,
120
124
  "scope": "rule-device"
@@ -125,7 +129,7 @@ var CAP_INPUT_DEFAULTS = Object.freeze({
125
129
  "rule": { "__nested__": {
126
130
  "enabled": true,
127
131
  "conditions": {},
128
- "media": { "attach": "best" },
132
+ "media": {},
129
133
  "throttle": {
130
134
  "cooldownSec": 60,
131
135
  "scope": "rule-device"
@@ -358,7 +362,7 @@ function materialise(defaults) {
358
362
  * barrel (`ALL_CAPABILITY_DEFINITIONS`), which would cost ~144MB RSS per
359
363
  * forked runner. See docs/decisions/adr-0028.md.
360
364
  *
361
- * Coverage: 27 collection caps, 45 array methods.
365
+ * Coverage: 26 collection caps, 44 array methods.
362
366
  */
363
367
  var COLLECTION_ARRAY_METHODS = Object.freeze({
364
368
  "addon-pages-source": ["listPages"],
@@ -384,7 +388,6 @@ var COLLECTION_ARRAY_METHODS = Object.freeze({
384
388
  ],
385
389
  "load-contribution": ["list"],
386
390
  "log-channels": ["list"],
387
- "log-destination": ["query"],
388
391
  "login-method": ["getLoginMethods"],
389
392
  "mqtt-broker": ["listBrokers"],
390
393
  "network-access": ["listEndpoints"],
@@ -419,14 +422,21 @@ function isCollectionArrayMethodName(capName, method) {
419
422
  * Per capability, the methods declared `optionalMethod` — the ones whose
420
423
  * ABSENCE on a provider is a fact about that provider, not a bug.
421
424
  *
422
- * Coverage: 1 caps, 4 methods.
425
+ * Coverage: 2 caps, 7 methods.
423
426
  */
424
- var PROVIDER_OPTIONAL_METHODS = Object.freeze({ "videoclips": [
425
- "dialClipStream",
426
- "getPlaybackOptions",
427
- "offerClipBytes",
428
- "readClipBytes"
429
- ] });
427
+ var PROVIDER_OPTIONAL_METHODS = Object.freeze({
428
+ "log-destination": [
429
+ "cancelRead",
430
+ "describeRead",
431
+ "read"
432
+ ],
433
+ "videoclips": [
434
+ "dialClipStream",
435
+ "getPlaybackOptions",
436
+ "offerClipBytes",
437
+ "readClipBytes"
438
+ ]
439
+ });
430
440
  /**
431
441
  * True when `method` on cap `capName` is declared `optionalMethod`.
432
442
  *
package/dist/addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $n as PEER_BYTES_CHUNK_BYTES, $t as REMOVE_LEAF, A as HF_REPO, An as RECORD_BATCH_MAX_BYTES, Ar as emitReadiness, B as describeCustomActions, Bn as RECORD_SECRET_COLLECTION_PREFIX, Br as SECRET_CLEAR, Bt as settingsBrokersAdoptsFrom, C as addonSliceHandleApi, Cn as RecordsError, Cr as globalSecretScope, Dn as asRecordsError, En as UnknownRecordKindError, Er as parseSecretRef, F as DEVICE_CHILDREN_BATCH_MAX, Fn as RECORD_ID_MAX_LENGTH, Ft as SETTINGS_ARRAY_ADOPTS_PREFIX, Gn as createSecretsAccess, Gr as isSecretMarkerLike, Gt as RecordFieldPathSchema, H as adminUiCapability, Hn as RECORD_SWEEP_INTERVAL_MS, Hr as isSecretClear, Ht as entryBody, I as CALLER_STAMPED_CAPABILITIES, In as RECORD_MAX_DATA_BYTES, It as parseSettingsArrayAdoptsFrom, Jn as forgetKnownSecret, Jt as RecordKindNameSchema, Kn as MIN_SCRUBBED_LENGTH, Kr as makeSecretMarker, Kt as RecordIndexSchema, L as withoutCallerStamp, Ln as RECORD_MAX_INDEXES, Lt as settingsArrayAdoptsFrom, Mn as RECORD_DATABASES, N as deviceOpsCapability, Nn as RECORD_DEFAULT_MAX_DATA_BYTES, On as recordsErrorFromMessage, P as viewerUiCapability, Pn as RECORD_DELETE_BATCH, Pt as makeInMemoryRecords, Qn as shortSecretRefHash, Qt as defineRecordKinds, Rn as RECORD_MAX_INDEX_FIELDS, Rt as SETTINGS_BROKERS_ADOPTS_PREFIX, Sn as RecordUniqueViolationError, Sr as formatSecretScope, Tn as UnindexedFilterError, Tr as normalizeSecretOwner, Un as resolveSecretViewsIn, Ur as isSecretFieldView, Ut as createRecordsAccess, Vn as RECORD_SETTINGS_MAX_ROWS, Vr as classifySecretWrite, Vt as defineEntryKind, Wn as REVALIDATE_AFTER_MS, Wr as isSecretMarker, Wt as EntryDescriptorSchema, X as expandCapMethods, Xn as registerKnownSecret, Xt as assertValidDeclaration, Yn as knownSecretCount, Yt as RecordRetentionSchema, Zn as scrubKnownSecrets, Zt as declarationsOf, _ as readErrorI18n, _n as PlaintextSecretError, an as recordSecretRef, b as isDeviceScopedCap, bn as RecordSecretUnavailableError, br as arrayItemFieldPath, c as asString, cn as collectZodSecretPaths, ct as ReadinessTimeoutError, d as parseJsonUnknown, dn as BatchTooLargeError, dt as scopeKey, en as collectSecretLeaves, er as PEER_BYTES_MAX_OUTSTANDING, f as hfModelUrl, fn as DeclarationRefusedError, g as ErrorI18nPayloadSchema, gn as NoCallerError, hn as InvalidRecordError, in as recordSecretCollection, ir as DATAPLANE_SECRET_HEADER, it as readNodePin, jn as RECORD_CLASSES, kn as RECORD_BATCH_MAX, kr as createEvent, ln as isZodSecret, lr as normalizeAddonInitResult, mn as ForeignSecretMarkerError, nn as parseSecretPath, nr as PEER_BYTES_TICKET_TTL_MS, o as asJsonObject, on as secretArrayPrefixes, or as DisposerChain, ot as MODEL_FORMATS, p as BOOT_RECOVERY_BACKOFF_MS, pn as FilterRequiredError, qn as clearKnownSecrets, qr as toSecretFieldView, qt as RecordKindDeclarationSchema, r as maskUrlCredentials, rn as recordArrayItemPath, rt as nodePin, sr as BaseAddon, st as ReadinessRegistry, t as sleep, tn as mapSecretLeaves, tr as PEER_BYTES_STALL_MS, un as AdoptionPendingError, vn as RECORDS_ERROR_CODES, w as createEventBusSliceSource, wn as RevConflictError, wr as isSecretRef, x as createDeviceProxy, xn as RecordTooLargeError, xr as buildSecretRef, y as DEVICE_SCOPED_CAPS, yn as RecordNotFoundError, yr as SECRET_REF_SCHEME, zn as RECORD_QUERY_MAX, zt as parseSettingsBrokersAdoptsFrom } from "./sleep-yKL5gfrH.mjs";
1
+ import { $n as PEER_BYTES_CHUNK_BYTES, $t as REMOVE_LEAF, A as HF_REPO, An as RECORD_BATCH_MAX_BYTES, Ar as emitReadiness, B as describeCustomActions, Bn as RECORD_SECRET_COLLECTION_PREFIX, Br as SECRET_CLEAR, Bt as settingsBrokersAdoptsFrom, C as addonSliceHandleApi, Cn as RecordsError, Cr as globalSecretScope, Dn as asRecordsError, En as UnknownRecordKindError, Er as parseSecretRef, F as DEVICE_CHILDREN_BATCH_MAX, Fn as RECORD_ID_MAX_LENGTH, Ft as SETTINGS_ARRAY_ADOPTS_PREFIX, Gn as createSecretsAccess, Gr as isSecretMarkerLike, Gt as RecordFieldPathSchema, H as adminUiCapability, Hn as RECORD_SWEEP_INTERVAL_MS, Hr as isSecretClear, Ht as entryBody, I as CALLER_STAMPED_CAPABILITIES, In as RECORD_MAX_DATA_BYTES, It as parseSettingsArrayAdoptsFrom, Jn as forgetKnownSecret, Jt as RecordKindNameSchema, Kn as MIN_SCRUBBED_LENGTH, Kr as makeSecretMarker, Kt as RecordIndexSchema, L as withoutCallerStamp, Ln as RECORD_MAX_INDEXES, Lt as settingsArrayAdoptsFrom, Mn as RECORD_DATABASES, N as deviceOpsCapability, Nn as RECORD_DEFAULT_MAX_DATA_BYTES, On as recordsErrorFromMessage, P as viewerUiCapability, Pn as RECORD_DELETE_BATCH, Pt as makeInMemoryRecords, Qn as shortSecretRefHash, Qt as defineRecordKinds, Rn as RECORD_MAX_INDEX_FIELDS, Rt as SETTINGS_BROKERS_ADOPTS_PREFIX, Sn as RecordUniqueViolationError, Sr as formatSecretScope, Tn as UnindexedFilterError, Tr as normalizeSecretOwner, Un as resolveSecretViewsIn, Ur as isSecretFieldView, Ut as createRecordsAccess, Vn as RECORD_SETTINGS_MAX_ROWS, Vr as classifySecretWrite, Vt as defineEntryKind, Wn as REVALIDATE_AFTER_MS, Wr as isSecretMarker, Wt as EntryDescriptorSchema, X as expandCapMethods, Xn as registerKnownSecret, Xt as assertValidDeclaration, Yn as knownSecretCount, Yt as RecordRetentionSchema, Zn as scrubKnownSecrets, Zt as declarationsOf, _ as readErrorI18n, _n as PlaintextSecretError, an as recordSecretRef, b as isDeviceScopedCap, bn as RecordSecretUnavailableError, br as arrayItemFieldPath, c as asString, cn as collectZodSecretPaths, ct as ReadinessTimeoutError, d as parseJsonUnknown, dn as BatchTooLargeError, dt as scopeKey, en as collectSecretLeaves, er as PEER_BYTES_MAX_OUTSTANDING, f as hfModelUrl, fn as DeclarationRefusedError, g as ErrorI18nPayloadSchema, gn as NoCallerError, hn as InvalidRecordError, in as recordSecretCollection, ir as DATAPLANE_SECRET_HEADER, it as readNodePin, jn as RECORD_CLASSES, kn as RECORD_BATCH_MAX, kr as createEvent, ln as isZodSecret, lr as normalizeAddonInitResult, mn as ForeignSecretMarkerError, nn as parseSecretPath, nr as PEER_BYTES_TICKET_TTL_MS, o as asJsonObject, on as secretArrayPrefixes, or as DisposerChain, ot as MODEL_FORMATS, p as BOOT_RECOVERY_BACKOFF_MS, pn as FilterRequiredError, qn as clearKnownSecrets, qr as toSecretFieldView, qt as RecordKindDeclarationSchema, r as maskUrlCredentials, rn as recordArrayItemPath, rt as nodePin, sr as BaseAddon, st as ReadinessRegistry, t as sleep, tn as mapSecretLeaves, tr as PEER_BYTES_STALL_MS, un as AdoptionPendingError, vn as RECORDS_ERROR_CODES, w as createEventBusSliceSource, wn as RevConflictError, wr as isSecretRef, x as createDeviceProxy, xn as RecordTooLargeError, xr as buildSecretRef, y as DEVICE_SCOPED_CAPS, yn as RecordNotFoundError, yr as SECRET_REF_SCHEME, zn as RECORD_QUERY_MAX, zt as parseSettingsBrokersAdoptsFrom } from "./sleep-BSuCCFjf.mjs";
2
2
  import { t as EventCategory } from "./event-category-DOl51-Ij.mjs";
3
3
  import { a as DeviceType, t as errMsg } from "./err-msg-BXKzRBwg.mjs";
4
4
  //#region src/generated/cap-input-defaults.ts
@@ -15,7 +15,7 @@ import { a as DeviceType, t as errMsg } from "./err-msg-BXKzRBwg.mjs";
15
15
  * Plain data, zero Zod: a forked runner must not import the schema barrel
16
16
  * (~144MB RSS per runner — D28).
17
17
  *
18
- * Coverage: 29 caps, 71 methods with defaults.
18
+ * Coverage: 29 caps, 72 methods with defaults.
19
19
  */
20
20
  var CAP_INPUT_DEFAULTS = Object.freeze({
21
21
  "addons": { "getLogs": { "limit": 100 } },
@@ -44,6 +44,10 @@ var CAP_INPUT_DEFAULTS = Object.freeze({
44
44
  "resolution": "auto",
45
45
  "maxPoints": 1e3
46
46
  },
47
+ "queryMany": {
48
+ "resolution": "auto",
49
+ "maxPoints": 1e3
50
+ },
47
51
  "queryNode": {
48
52
  "resolution": "auto",
49
53
  "maxPoints": 1e3
@@ -102,7 +106,7 @@ var CAP_INPUT_DEFAULTS = Object.freeze({
102
106
  "createRule": { "rule": { "__nested__": {
103
107
  "enabled": true,
104
108
  "conditions": {},
105
- "media": { "attach": "best" },
109
+ "media": {},
106
110
  "throttle": {
107
111
  "cooldownSec": 60,
108
112
  "scope": "rule-device"
@@ -113,7 +117,7 @@ var CAP_INPUT_DEFAULTS = Object.freeze({
113
117
  "previewStateSummary": { "rule": { "__nested__": {
114
118
  "enabled": true,
115
119
  "conditions": {},
116
- "media": { "attach": "best" },
120
+ "media": {},
117
121
  "throttle": {
118
122
  "cooldownSec": 60,
119
123
  "scope": "rule-device"
@@ -124,7 +128,7 @@ var CAP_INPUT_DEFAULTS = Object.freeze({
124
128
  "rule": { "__nested__": {
125
129
  "enabled": true,
126
130
  "conditions": {},
127
- "media": { "attach": "best" },
131
+ "media": {},
128
132
  "throttle": {
129
133
  "cooldownSec": 60,
130
134
  "scope": "rule-device"
@@ -357,7 +361,7 @@ function materialise(defaults) {
357
361
  * barrel (`ALL_CAPABILITY_DEFINITIONS`), which would cost ~144MB RSS per
358
362
  * forked runner. See docs/decisions/adr-0028.md.
359
363
  *
360
- * Coverage: 27 collection caps, 45 array methods.
364
+ * Coverage: 26 collection caps, 44 array methods.
361
365
  */
362
366
  var COLLECTION_ARRAY_METHODS = Object.freeze({
363
367
  "addon-pages-source": ["listPages"],
@@ -383,7 +387,6 @@ var COLLECTION_ARRAY_METHODS = Object.freeze({
383
387
  ],
384
388
  "load-contribution": ["list"],
385
389
  "log-channels": ["list"],
386
- "log-destination": ["query"],
387
390
  "login-method": ["getLoginMethods"],
388
391
  "mqtt-broker": ["listBrokers"],
389
392
  "network-access": ["listEndpoints"],
@@ -418,14 +421,21 @@ function isCollectionArrayMethodName(capName, method) {
418
421
  * Per capability, the methods declared `optionalMethod` — the ones whose
419
422
  * ABSENCE on a provider is a fact about that provider, not a bug.
420
423
  *
421
- * Coverage: 1 caps, 4 methods.
424
+ * Coverage: 2 caps, 7 methods.
422
425
  */
423
- var PROVIDER_OPTIONAL_METHODS = Object.freeze({ "videoclips": [
424
- "dialClipStream",
425
- "getPlaybackOptions",
426
- "offerClipBytes",
427
- "readClipBytes"
428
- ] });
426
+ var PROVIDER_OPTIONAL_METHODS = Object.freeze({
427
+ "log-destination": [
428
+ "cancelRead",
429
+ "describeRead",
430
+ "read"
431
+ ],
432
+ "videoclips": [
433
+ "dialClipStream",
434
+ "getPlaybackOptions",
435
+ "offerClipBytes",
436
+ "readClipBytes"
437
+ ]
438
+ });
429
439
  /**
430
440
  * True when `method` on cap `capName` is declared `optionalMethod`.
431
441
  *
@@ -178,9 +178,17 @@ export declare const alarmPanelCapability: {
178
178
  */
179
179
  readonly durability: 'restored';
180
180
  /**
181
- * History (D850): none — enum state; arm/disarm history belongs in the events ledger.
181
+ * History (D850): the panel's lifecycle state as an `enum` series —
182
+ * change-only, no floor, so an `arming -> pending -> triggered` sequence of a
183
+ * few seconds keeps every step. Who armed it stays in the events ledger.
182
184
  */
183
- readonly history: 'none';
185
+ readonly history: {
186
+ readonly fields: {
187
+ readonly state: {
188
+ readonly kind: 'enum';
189
+ };
190
+ };
191
+ };
184
192
  /** Clock fields: written, but excluded from the compare that decides
185
193
  * whether persisting is worth a SQLite commit. */
186
194
  readonly volatileStateFields: readonly ["lastChangedAt"];
@@ -384,7 +384,7 @@ export declare const DEFAULT_RUNTIME_STATE_DURABILITY: RuntimeStateDurability;
384
384
  * through {@link HISTORY_UNIT_LABELS}. A series whose unit is a per-device fact
385
385
  * names a sibling field with {@link CapabilityHistoryField.unitFrom} instead.
386
386
  */
387
- export type HistoryUnit = '%' | 'dBFS' | 'dBm' | '°C' | 'W' | 'kWh' | 'V' | 'A' | 'VA' | 'lx' | 'ppm' | 'ppb' | 'ug/m3' | 'hPa' | 'count' | 'ratio' | 'ms' | 's' | 'days' | 'bytes';
387
+ export type HistoryUnit = '%' | 'dBFS' | 'dBm' | '°C' | 'W' | 'kWh' | 'V' | 'A' | 'VA' | 'lx' | 'ppm' | 'ppb' | 'ug/m3' | 'hPa' | 'count' | 'ratio' | 'ms' | 's' | 'days' | 'bytes' | 'kbps' | 'fps';
388
388
  /** Display label per {@link HistoryUnit} (only `'ug/m3'` differs from its id). */
389
389
  export declare const HISTORY_UNIT_LABELS: Readonly<Record<HistoryUnit, string>>;
390
390
  /** One `runtimeState` field recorded as a history series. */
@@ -394,8 +394,26 @@ export interface CapabilityHistoryField {
394
394
  * meter only (`kwhTotal`); a drop is a reset, never a negative reading. A
395
395
  * counter that restarts with the addon (`pressCountSinceStart`) is not one.
396
396
  * `boolean` — stored 0/1; a rollup gives the fraction of time true.
397
+ * `enum` — a STATE (a `z.enum`, or a `z.string` whose values are learned):
398
+ * stored as the ordinal of its value in the series' append-only value list,
399
+ * change-only; a rollup keeps the time spent in each state.
397
400
  */
398
- readonly kind: 'gauge' | 'counter' | 'boolean';
401
+ readonly kind: 'gauge' | 'counter' | 'boolean' | 'enum';
402
+ /**
403
+ * `enum` over a `z.enum` field: its values, in declaration order. WRITTEN BY
404
+ * CODEGEN from the field's schema (`scripts/generate-history-catalog.ts`) —
405
+ * never by hand, so the list cannot drift from the schema. Absent for a
406
+ * `z.string` enum field, whose values are learned as they are first seen.
407
+ * Ordinals are append-only in the store: reordering the `z.enum` later never
408
+ * changes what a stored ordinal means.
409
+ */
410
+ readonly values?: readonly string[];
411
+ /**
412
+ * Path of a SIBLING field: while it is set (not `undefined`, not `null`), the
413
+ * slice is not a reading of this field and nothing is captured. An
414
+ * `enum-sensor` with a `format` carries a timestamp, not a state.
415
+ */
416
+ readonly skipWhenSet?: string;
399
417
  /** Fixed unit of the series. Mutually exclusive with {@link unitFrom}. */
400
418
  readonly unit?: HistoryUnit;
401
419
  /**
@@ -416,7 +434,7 @@ export interface CapabilityHistoryField {
416
434
  readonly deadbandPct?: number;
417
435
  /**
418
436
  * At most one raw point per this many ms per series. Absent means the capture
419
- * floor of the kind: 10 000 for `gauge` and `counter`, none for `boolean`
437
+ * floor of the kind: 10 000 for `gauge` and `counter`, none for `boolean` and `enum`
420
438
  * (change-only). Set it ABOVE the floor to be sparser; the floor is not
421
439
  * lowered by a smaller value except `0`, which a field may state to opt out
422
440
  * of the floor (a flapping state that must not lose an edge).
@@ -40,9 +40,17 @@ export declare const connectivityCapability: {
40
40
  */
41
41
  readonly durability: 'restored';
42
42
  /**
43
- * History (D850): none — duplicates device-status.online (one authority for availability).
43
+ * History (D850): `connected` as a boolean series — change-only, no floor. It
44
+ * is the upstream entity's own link (a HA connectivity sensor), not the
45
+ * device's reachability, which stays `device-status.online`.
44
46
  */
45
- readonly history: 'none';
47
+ readonly history: {
48
+ readonly fields: {
49
+ readonly connected: {
50
+ readonly kind: 'boolean';
51
+ };
52
+ };
53
+ };
46
54
  /** Clock fields: written, but excluded from the compare that decides
47
55
  * whether persisting is worth a SQLite commit. */
48
56
  readonly volatileStateFields: readonly ["lastChangedAt"];
@@ -25,12 +25,32 @@ export declare const DeviceHistorySubjectSchema: z.ZodDiscriminatedUnion<[z.ZodO
25
25
  nodeId: z.ZodString;
26
26
  }, z.core.$strip>], "kind">;
27
27
  export type DeviceHistorySubject = z.infer<typeof DeviceHistorySubjectSchema>;
28
+ /**
29
+ * `enum` stores a STATE as the ordinal of its value in the series' value list
30
+ * (`DeviceHistorySeriesInfo.values`, append-only, so an ordinal never changes
31
+ * meaning); a rollup keeps the time spent in each state (`states`).
32
+ */
28
33
  export declare const DeviceHistoryKindSchema: z.ZodEnum<{
29
34
  boolean: "boolean";
30
35
  counter: "counter";
36
+ enum: "enum";
31
37
  gauge: "gauge";
32
38
  }>;
33
39
  export type DeviceHistoryKind = z.infer<typeof DeviceHistoryKindSchema>;
40
+ /** What a PRODUCER may declare. `enum` is cap-only: its value list is the cap field's. */
41
+ export declare const DeviceHistoryProducerKindSchema: z.ZodEnum<{
42
+ boolean: "boolean";
43
+ counter: "counter";
44
+ gauge: "gauge";
45
+ }>;
46
+ export type DeviceHistoryProducerKind = z.infer<typeof DeviceHistoryProducerKindSchema>;
47
+ /**
48
+ * A key computed at READ time from stored series of the same device, never
49
+ * stored itself. Energy (kWh per bucket) comes from the power meter's
50
+ * `kwhTotal` counter when the device has one, else from integrating its
51
+ * `watts` gauge over time.
52
+ */
53
+ export declare const DEVICE_HISTORY_ENERGY_KEY = "derived:energy.kwh";
34
54
  export declare const DeviceHistoryResolutionSchema: z.ZodEnum<{
35
55
  "1d": "1d";
36
56
  "1h": "1h";
@@ -72,6 +92,7 @@ declare const SeriesInfoSchema: z.ZodObject<{
72
92
  kind: z.ZodEnum<{
73
93
  boolean: "boolean";
74
94
  counter: "counter";
95
+ enum: "enum";
75
96
  gauge: "gauge";
76
97
  }>;
77
98
  unit: z.ZodNullable<z.ZodString>;
@@ -79,7 +100,9 @@ declare const SeriesInfoSchema: z.ZodObject<{
79
100
  source: z.ZodEnum<{
80
101
  addon: "addon";
81
102
  cap: "cap";
103
+ derived: "derived";
82
104
  }>;
105
+ values: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
83
106
  firstTs: z.ZodNumber;
84
107
  lastTs: z.ZodNumber;
85
108
  }, z.core.$strip>;
@@ -92,8 +115,92 @@ declare const QueryPointSchema: z.ZodObject<{
92
115
  min: z.ZodNumber;
93
116
  max: z.ZodNumber;
94
117
  last: z.ZodNullable<z.ZodNumber>;
118
+ delta: z.ZodNullable<z.ZodNumber>;
119
+ state: z.ZodNullable<z.ZodString>;
120
+ states: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNumber>>;
95
121
  }, z.core.$strip>;
96
122
  export type DeviceHistoryQueryPoint = z.infer<typeof QueryPointSchema>;
123
+ declare const QueryResultSchema: z.ZodObject<{
124
+ resolution: z.ZodEnum<{
125
+ "1d": "1d";
126
+ "1h": "1h";
127
+ "5m": "5m";
128
+ raw: "raw";
129
+ }>;
130
+ series: z.ZodReadonly<z.ZodArray<z.ZodObject<{
131
+ scope: z.ZodString;
132
+ before: z.ZodNullable<z.ZodObject<{
133
+ t: z.ZodNumber;
134
+ value: z.ZodNullable<z.ZodNumber>;
135
+ state: z.ZodNullable<z.ZodString>;
136
+ }, z.core.$strip>>;
137
+ points: z.ZodReadonly<z.ZodArray<z.ZodObject<{
138
+ t: z.ZodNumber;
139
+ samples: z.ZodNumber;
140
+ mean: z.ZodNullable<z.ZodNumber>;
141
+ twMean: z.ZodNullable<z.ZodNumber>;
142
+ min: z.ZodNumber;
143
+ max: z.ZodNumber;
144
+ last: z.ZodNullable<z.ZodNumber>;
145
+ delta: z.ZodNullable<z.ZodNumber>;
146
+ state: z.ZodNullable<z.ZodString>;
147
+ states: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNumber>>;
148
+ }, z.core.$strip>>>;
149
+ derivedFrom: z.ZodNullable<z.ZodString>;
150
+ }, z.core.$strip>>>;
151
+ truncated: z.ZodBoolean;
152
+ }, z.core.$strip>;
153
+ export type DeviceHistoryQueryResult = z.infer<typeof QueryResultSchema>;
154
+ /** Items one `queryMany` may carry: a dashboard's worth, not a scan. */
155
+ export declare const DEVICE_HISTORY_QUERY_MANY_MAX_ITEMS = 24;
156
+ /** One read of a batch: a device's key or a node's key (exactly one subject). */
157
+ declare const QueryManyItemSchema: z.ZodUnion<readonly [z.ZodObject<{
158
+ deviceId: z.ZodNumber;
159
+ key: z.ZodString;
160
+ scope: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strip>, z.ZodObject<{
162
+ forNodeId: z.ZodString;
163
+ key: z.ZodString;
164
+ scope: z.ZodOptional<z.ZodString>;
165
+ }, z.core.$strip>]>;
166
+ export type DeviceHistoryQueryManyItem = z.infer<typeof QueryManyItemSchema>;
167
+ declare const QueryManyEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
168
+ ok: z.ZodLiteral<true>;
169
+ result: z.ZodObject<{
170
+ resolution: z.ZodEnum<{
171
+ "1d": "1d";
172
+ "1h": "1h";
173
+ "5m": "5m";
174
+ raw: "raw";
175
+ }>;
176
+ series: z.ZodReadonly<z.ZodArray<z.ZodObject<{
177
+ scope: z.ZodString;
178
+ before: z.ZodNullable<z.ZodObject<{
179
+ t: z.ZodNumber;
180
+ value: z.ZodNullable<z.ZodNumber>;
181
+ state: z.ZodNullable<z.ZodString>;
182
+ }, z.core.$strip>>;
183
+ points: z.ZodReadonly<z.ZodArray<z.ZodObject<{
184
+ t: z.ZodNumber;
185
+ samples: z.ZodNumber;
186
+ mean: z.ZodNullable<z.ZodNumber>;
187
+ twMean: z.ZodNullable<z.ZodNumber>;
188
+ min: z.ZodNumber;
189
+ max: z.ZodNumber;
190
+ last: z.ZodNullable<z.ZodNumber>;
191
+ delta: z.ZodNullable<z.ZodNumber>;
192
+ state: z.ZodNullable<z.ZodString>;
193
+ states: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNumber>>;
194
+ }, z.core.$strip>>>;
195
+ derivedFrom: z.ZodNullable<z.ZodString>;
196
+ }, z.core.$strip>>>;
197
+ truncated: z.ZodBoolean;
198
+ }, z.core.$strip>;
199
+ }, z.core.$strip>, z.ZodObject<{
200
+ ok: z.ZodLiteral<false>;
201
+ error: z.ZodString;
202
+ }, z.core.$strip>], "ok">;
203
+ export type DeviceHistoryQueryManyEntry = z.infer<typeof QueryManyEntrySchema>;
97
204
  /** Operator/diagnostic view: rows per tier, last runs, refusals and drops since boot. */
98
205
  export declare const DeviceHistoryStatusSchema: z.ZodObject<{
99
206
  startedAt: z.ZodNumber;
@@ -171,6 +278,7 @@ export declare const deviceHistoryCapability: {
171
278
  kind: z.ZodEnum<{
172
279
  boolean: "boolean";
173
280
  counter: "counter";
281
+ enum: "enum";
174
282
  gauge: "gauge";
175
283
  }>;
176
284
  unit: z.ZodNullable<z.ZodString>;
@@ -178,18 +286,26 @@ export declare const deviceHistoryCapability: {
178
286
  source: z.ZodEnum<{
179
287
  addon: "addon";
180
288
  cap: "cap";
289
+ derived: "derived";
181
290
  }>;
291
+ values: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
182
292
  firstTs: z.ZodNumber;
183
293
  lastTs: z.ZodNumber;
184
294
  }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
295
+ /**
296
+ * A NODE's series. The subject is `forNodeId`, never `nodeId`: a top-level
297
+ * `nodeId` is the cap ROUTING key, and `nodeId: 'little-unraid'` sent the
298
+ * read to that agent, which hosts no device-history.
299
+ */
185
300
  readonly listNodeSeries: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
186
- nodeId: z.ZodString;
301
+ forNodeId: z.ZodString;
187
302
  }, z.core.$strip>, z.ZodReadonly<z.ZodArray<z.ZodObject<{
188
303
  key: z.ZodString;
189
304
  scope: z.ZodString;
190
305
  kind: z.ZodEnum<{
191
306
  boolean: "boolean";
192
307
  counter: "counter";
308
+ enum: "enum";
193
309
  gauge: "gauge";
194
310
  }>;
195
311
  unit: z.ZodNullable<z.ZodString>;
@@ -197,7 +313,9 @@ export declare const deviceHistoryCapability: {
197
313
  source: z.ZodEnum<{
198
314
  addon: "addon";
199
315
  cap: "cap";
316
+ derived: "derived";
200
317
  }>;
318
+ values: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
201
319
  firstTs: z.ZodNumber;
202
320
  lastTs: z.ZodNumber;
203
321
  }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
@@ -205,7 +323,9 @@ export declare const deviceHistoryCapability: {
205
323
  * One series (or every scope of it) at one resolution. `auto` picks the
206
324
  * finest tier whose retention covers `from` and whose point count fits
207
325
  * `maxPoints`; when even the coarsest tier does not fit, the newest
208
- * `maxPoints` points are returned and `truncated` is true.
326
+ * `maxPoints` points are returned and `truncated` is true. A series fed by
327
+ * closed buckets has no raw rows, so `auto` never answers it from raw; nor
328
+ * {@link DEVICE_HISTORY_ENERGY_KEY}, which is computed from rollups.
209
329
  */
210
330
  readonly query: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
211
331
  key: z.ZodString;
@@ -232,6 +352,7 @@ export declare const deviceHistoryCapability: {
232
352
  before: z.ZodNullable<z.ZodObject<{
233
353
  t: z.ZodNumber;
234
354
  value: z.ZodNullable<z.ZodNumber>;
355
+ state: z.ZodNullable<z.ZodString>;
235
356
  }, z.core.$strip>>;
236
357
  points: z.ZodReadonly<z.ZodArray<z.ZodObject<{
237
358
  t: z.ZodNumber;
@@ -241,7 +362,11 @@ export declare const deviceHistoryCapability: {
241
362
  min: z.ZodNumber;
242
363
  max: z.ZodNumber;
243
364
  last: z.ZodNullable<z.ZodNumber>;
365
+ delta: z.ZodNullable<z.ZodNumber>;
366
+ state: z.ZodNullable<z.ZodString>;
367
+ states: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNumber>>;
244
368
  }, z.core.$strip>>>;
369
+ derivedFrom: z.ZodNullable<z.ZodString>;
245
370
  }, z.core.$strip>>>;
246
371
  truncated: z.ZodBoolean;
247
372
  }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
@@ -257,7 +382,7 @@ export declare const deviceHistoryCapability: {
257
382
  raw: "raw";
258
383
  }>, z.ZodLiteral<"auto">]>>;
259
384
  maxPoints: z.ZodDefault<z.ZodNumber>;
260
- nodeId: z.ZodString;
385
+ forNodeId: z.ZodString;
261
386
  }, z.core.$strip>, z.ZodObject<{
262
387
  resolution: z.ZodEnum<{
263
388
  "1d": "1d";
@@ -270,6 +395,7 @@ export declare const deviceHistoryCapability: {
270
395
  before: z.ZodNullable<z.ZodObject<{
271
396
  t: z.ZodNumber;
272
397
  value: z.ZodNullable<z.ZodNumber>;
398
+ state: z.ZodNullable<z.ZodString>;
273
399
  }, z.core.$strip>>;
274
400
  points: z.ZodReadonly<z.ZodArray<z.ZodObject<{
275
401
  t: z.ZodNumber;
@@ -279,10 +405,76 @@ export declare const deviceHistoryCapability: {
279
405
  min: z.ZodNumber;
280
406
  max: z.ZodNumber;
281
407
  last: z.ZodNullable<z.ZodNumber>;
408
+ delta: z.ZodNullable<z.ZodNumber>;
409
+ state: z.ZodNullable<z.ZodString>;
410
+ states: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNumber>>;
282
411
  }, z.core.$strip>>>;
412
+ derivedFrom: z.ZodNullable<z.ZodString>;
283
413
  }, z.core.$strip>>>;
284
414
  truncated: z.ZodBoolean;
285
415
  }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
416
+ /**
417
+ * Several reads over ONE window, answered in order (one entry per item).
418
+ * Admin-only: its subjects are nested in `items`, where the device scope
419
+ * gate cannot see them — a principal limited to one device uses `query`.
420
+ */
421
+ readonly queryMany: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
422
+ items: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
423
+ deviceId: z.ZodNumber;
424
+ key: z.ZodString;
425
+ scope: z.ZodOptional<z.ZodString>;
426
+ }, z.core.$strip>, z.ZodObject<{
427
+ forNodeId: z.ZodString;
428
+ key: z.ZodString;
429
+ scope: z.ZodOptional<z.ZodString>;
430
+ }, z.core.$strip>]>>;
431
+ from: z.ZodNumber;
432
+ to: z.ZodNumber;
433
+ resolution: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
434
+ "1d": "1d";
435
+ "1h": "1h";
436
+ "5m": "5m";
437
+ raw: "raw";
438
+ }>, z.ZodLiteral<"auto">]>>;
439
+ maxPoints: z.ZodDefault<z.ZodNumber>;
440
+ }, z.core.$strip>, z.ZodObject<{
441
+ results: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
442
+ ok: z.ZodLiteral<true>;
443
+ result: z.ZodObject<{
444
+ resolution: z.ZodEnum<{
445
+ "1d": "1d";
446
+ "1h": "1h";
447
+ "5m": "5m";
448
+ raw: "raw";
449
+ }>;
450
+ series: z.ZodReadonly<z.ZodArray<z.ZodObject<{
451
+ scope: z.ZodString;
452
+ before: z.ZodNullable<z.ZodObject<{
453
+ t: z.ZodNumber;
454
+ value: z.ZodNullable<z.ZodNumber>;
455
+ state: z.ZodNullable<z.ZodString>;
456
+ }, z.core.$strip>>;
457
+ points: z.ZodReadonly<z.ZodArray<z.ZodObject<{
458
+ t: z.ZodNumber;
459
+ samples: z.ZodNumber;
460
+ mean: z.ZodNullable<z.ZodNumber>;
461
+ twMean: z.ZodNullable<z.ZodNumber>;
462
+ min: z.ZodNumber;
463
+ max: z.ZodNumber;
464
+ last: z.ZodNullable<z.ZodNumber>;
465
+ delta: z.ZodNullable<z.ZodNumber>;
466
+ state: z.ZodNullable<z.ZodString>;
467
+ states: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNumber>>;
468
+ }, z.core.$strip>>>;
469
+ derivedFrom: z.ZodNullable<z.ZodString>;
470
+ }, z.core.$strip>>>;
471
+ truncated: z.ZodBoolean;
472
+ }, z.core.$strip>;
473
+ }, z.core.$strip>, z.ZodObject<{
474
+ ok: z.ZodLiteral<false>;
475
+ error: z.ZodString;
476
+ }, z.core.$strip>], "ok">>>;
477
+ }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
286
478
  /** Producer: declare (idempotent) a series key this addon owns: `addon:<callerAddonId>/<name>`. */
287
479
  readonly declareSeries: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
288
480
  name: z.ZodString;
@@ -522,6 +522,23 @@ export declare const dishwasherCapability: {
522
522
  readonly unit: '%';
523
523
  readonly deadband: 2;
524
524
  };
525
+ readonly state: {
526
+ readonly kind: 'enum';
527
+ };
528
+ readonly operationState: {
529
+ readonly kind: 'enum';
530
+ };
531
+ readonly remainingSeconds: {
532
+ readonly kind: 'gauge';
533
+ readonly unit: 's';
534
+ readonly minIntervalMs: 60000;
535
+ };
536
+ readonly doorOpen: {
537
+ readonly kind: 'boolean';
538
+ };
539
+ readonly powerOn: {
540
+ readonly kind: 'boolean';
541
+ };
525
542
  };
526
543
  };
527
544
  };
@@ -63,9 +63,19 @@ export declare const enumSensorCapability: {
63
63
  */
64
64
  readonly durability: 'restored';
65
65
  /**
66
- * History (D850): none — text/enum state has no history (non-goal).
66
+ * History (D850): the value as an `enum` series (an appliance's program or
67
+ * operation state, an HVAC action). The option set is per device, so the
68
+ * value list is LEARNED as values are first seen (bounded). A sensor with a
69
+ * `format` carries a timestamp, not a state, and is not recorded.
67
70
  */
68
- readonly history: 'none';
71
+ readonly history: {
72
+ readonly fields: {
73
+ readonly value: {
74
+ readonly kind: 'enum';
75
+ readonly skipWhenSet: 'format';
76
+ };
77
+ };
78
+ };
69
79
  /** Clock fields: written, but excluded from the compare that decides
70
80
  * whether persisting is worth a SQLite commit. */
71
81
  readonly volatileStateFields: readonly ["lastFetchedAt"];