@camstack/types 1.2.529 → 1.2.531

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 (40) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/addon.js +1 -1
  3. package/dist/addon.mjs +1 -1
  4. package/dist/capabilities/capability-definition.d.ts +15 -0
  5. package/dist/capabilities/climate-control.cap.d.ts +26 -1
  6. package/dist/capabilities/enum-sensor.cap.d.ts +1 -1
  7. package/dist/capabilities/hero-layout.cap.d.ts +158 -17
  8. package/dist/capabilities/index.d.ts +1 -1
  9. package/dist/capabilities/integration-instances.cap.d.ts +3 -0
  10. package/dist/capabilities/integrations.cap.d.ts +3 -28
  11. package/dist/capabilities/water-heater.cap.d.ts +5 -1
  12. package/dist/client.js +0 -1
  13. package/dist/client.mjs +0 -1
  14. package/dist/device/hero/climate-view.d.ts +45 -0
  15. package/dist/device/hero/hero-contribution-kit.d.ts +27 -0
  16. package/dist/device/hero/hero-contributions-access.d.ts +2 -0
  17. package/dist/device/hero/hero-contributions-actuators.d.ts +2 -0
  18. package/dist/device/hero/hero-contributions-climate.d.ts +3 -0
  19. package/dist/device/hero/hero-contributions-devices.d.ts +2 -0
  20. package/dist/device/hero/hero-contributions-groups.d.ts +2 -0
  21. package/dist/device/hero/hero-contributions-sensors.d.ts +2 -0
  22. package/dist/device/hero/hero-contributions.d.ts +2 -5
  23. package/dist/device/hero/hero-fragment.d.ts +11 -1
  24. package/dist/device/hero/hero-look.d.ts +80 -14
  25. package/dist/device/hero/hero-model.d.ts +224 -34
  26. package/dist/device/hero/hero-row.d.ts +30 -5
  27. package/dist/device/hero/media-player-view.d.ts +6 -0
  28. package/dist/generated/addon-api.d.ts +0 -7
  29. package/dist/generated/addon-cap-facts.d.ts +1 -1
  30. package/dist/generated/method-access-map.d.ts +1 -1
  31. package/dist/generated/runtime-state-durability.d.ts +6 -1
  32. package/dist/generated/system-proxy.d.ts +1 -1
  33. package/dist/index.d.ts +2 -2
  34. package/dist/index.js +2499 -255
  35. package/dist/index.mjs +2500 -254
  36. package/dist/interfaces/addon.d.ts +1 -1
  37. package/dist/interfaces/storage-location.d.ts +0 -15
  38. package/dist/{sleep-CqvzKIq2.mjs → sleep-CS5Xp1iQ.mjs} +18 -1
  39. package/dist/{sleep-DX_umr22.js → sleep-ComzlWyT.js} +18 -1
  40. package/package.json +1 -1
@@ -211,7 +211,7 @@ export { type HumidifierStatus, HumidifierStatusSchema, humidifierCapability, ty
211
211
  export { type HumiditySensorStatus, HumiditySensorStatusSchema, humiditySensorCapability, type IHumiditySensorProvider, } from './humidity-sensor.cap.js';
212
212
  export { type IImageProvider, type ImageStatus, ImageStatusSchema, imageCapability, } from './image.cap.js';
213
213
  export { type BacklightMode, BacklightModeSchema, type ExposureMode, ExposureModeSchema, type IImageSettingsProvider, type ImageRotate, ImageRotateSchema, type ImageSettingsOptions, ImageSettingsOptionsSchema, type ImageSettingsPatch, ImageSettingsPatchSchema, type ImageSettingsStatus, ImageSettingsStatusSchema, imageSettingsCapability, type WhiteBalanceMode, WhiteBalanceModeSchema, } from './image-settings.cap.js';
214
- export { AvailableIntegrationTypeSchema, CreateIntegrationInputSchema, DeleteIntegrationResultSchema, type IIntegrationsProvider, IntegrationLiteSchema, type IntegrationTestConnectionResult, type IntegrationTestConnectionStatus, IntegrationWithStateSchema, integrationsCapability, TestConnectionResultSchema, TestConnectionStatusEnum, UpdateIntegrationInputSchema, } from './integrations.cap.js';
214
+ export { AvailableIntegrationTypeSchema, DeleteIntegrationResultSchema, type IIntegrationsProvider, IntegrationLiteSchema, type IntegrationTestConnectionResult, type IntegrationTestConnectionStatus, IntegrationWithStateSchema, integrationsCapability, TestConnectionResultSchema, TestConnectionStatusEnum, UpdateIntegrationInputSchema, } from './integrations.cap.js';
215
215
  export { type IIntercomProvider, type IntercomAbility, IntercomAbilitySchema, type IntercomStatus, IntercomStatusSchema, intercomCapability, } from './intercom.cap.js';
216
216
  export { type DeviceCodeSeverity, DeviceCodeSeveritySchema, type ILawnMowerControlProvider, type LawnMowerActivity, LawnMowerActivitySchema, type LawnMowerControlStatus, LawnMowerControlStatusSchema, lawnMowerControlCapability, } from './lawn-mower-control.cap.js';
217
217
  export { type AdvertisedLocalPort, type ConnectionEndpoint, type HubAddressBook, type HubAddresses, HubAddressRoleSchema, type HubAddressRow, type HubAddressSnapshot, type ILocalNetworkProvider, type LocalInterface, localNetworkCapability, type NotificationEndpoint, type ScanNetworkResult, type ScanRequest, type ScanStats, } from './local-network.cap.js';
@@ -306,6 +306,9 @@ export declare const integrationInstancesCapability: {
306
306
  kind: z.ZodOptional<z.ZodString>;
307
307
  values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
308
308
  originStableId: z.ZodOptional<z.ZodString>;
309
+ seed: z.ZodOptional<z.ZodObject<{
310
+ info: z.ZodRecord<z.ZodString, z.ZodUnknown>;
311
+ }, z.core.$strip>>;
309
312
  }, z.core.$strip>, z.ZodObject<{
310
313
  id: z.ZodString;
311
314
  }, z.core.$strip>, "mutation">;
@@ -13,7 +13,7 @@ import { type InferProvider } from './capability-definition.js';
13
13
  *
14
14
  * Phase E of the API consolidation: previously a hand-written core
15
15
  * router. Cap conversion lets `useIntegrationsList`,
16
- * `useIntegrationsCreate`, `useIntegrationsTestConnection` and
16
+ * `useIntegrationsTestConnection` and
17
17
  * friends flow through the same codegen pipeline as every other cap.
18
18
  */
19
19
  declare const IntegrationWithStateSchema: z.ZodObject<{
@@ -72,7 +72,7 @@ declare const AvailableIntegrationTypeSchema: z.ZodObject<{
72
72
  *
73
73
  * - `validated` — a provider-declared test ran and the remote ACCEPTED.
74
74
  * - `rejected` — a provider-declared test ran and the remote REFUSED.
75
- * The only status that blocks `integrations.create`.
75
+ * The only status that blocks `integrationInstances.createInstance`.
76
76
  * - `inconclusive` — a test IS declared but could not complete (timeout,
77
77
  * DNS, 5xx). Nothing was observed; not a failure.
78
78
  * - `unsupported` — this integration declares NO test. Nothing was
@@ -101,14 +101,6 @@ declare const TestConnectionResultSchema: z.ZodObject<{
101
101
  latencyMs: z.ZodOptional<z.ZodNumber>;
102
102
  detail: z.ZodOptional<z.ZodString>;
103
103
  }, z.core.$strip>;
104
- declare const CreateIntegrationInputSchema: z.ZodObject<{
105
- addonId: z.ZodString;
106
- name: z.ZodString;
107
- info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
108
- originStableId: z.ZodOptional<z.ZodString>;
109
- settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
110
- kind: z.ZodOptional<z.ZodString>;
111
- }, z.core.$strip>;
112
104
  declare const UpdateIntegrationInputSchema: z.ZodObject<{
113
105
  id: z.ZodString;
114
106
  name: z.ZodOptional<z.ZodString>;
@@ -160,23 +152,6 @@ export declare const integrationsCapability: {
160
152
  createdAt: z.ZodNumber;
161
153
  updatedAt: z.ZodNumber;
162
154
  }, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
163
- readonly create: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
164
- addonId: z.ZodString;
165
- name: z.ZodString;
166
- info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
167
- originStableId: z.ZodOptional<z.ZodString>;
168
- settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
169
- kind: z.ZodOptional<z.ZodString>;
170
- }, z.core.$strip>, z.ZodObject<{
171
- id: z.ZodString;
172
- addonId: z.ZodString;
173
- name: z.ZodString;
174
- enabled: z.ZodBoolean;
175
- info: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
176
- originStableId: z.ZodOptional<z.ZodString>;
177
- createdAt: z.ZodNumber;
178
- updatedAt: z.ZodNumber;
179
- }, z.core.$strip>, "mutation">;
180
155
  readonly update: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
181
156
  id: z.ZodString;
182
157
  name: z.ZodOptional<z.ZodString>;
@@ -233,4 +208,4 @@ export declare const integrationsCapability: {
233
208
  export type IIntegrationsProvider = InferProvider<typeof integrationsCapability>;
234
209
  export type IntegrationTestConnectionStatus = z.infer<typeof TestConnectionStatusEnum>;
235
210
  export type IntegrationTestConnectionResult = z.infer<typeof TestConnectionResultSchema>;
236
- export { AvailableIntegrationTypeSchema, CreateIntegrationInputSchema, DeleteIntegrationResultSchema, IntegrationLiteSchema, IntegrationWithStateSchema, TestConnectionResultSchema, TestConnectionStatusEnum, UpdateIntegrationInputSchema, };
211
+ export { AvailableIntegrationTypeSchema, DeleteIntegrationResultSchema, IntegrationLiteSchema, IntegrationWithStateSchema, TestConnectionResultSchema, TestConnectionStatusEnum, UpdateIntegrationInputSchema, };
@@ -23,6 +23,7 @@ export declare const WaterHeaterStatusSchema: z.ZodObject<{
23
23
  away: z.ZodNullable<z.ZodBoolean>;
24
24
  minTemp: z.ZodNullable<z.ZodNumber>;
25
25
  maxTemp: z.ZodNullable<z.ZodNumber>;
26
+ lastActiveMode: z.ZodOptional<z.ZodString>;
26
27
  lastChangedAt: z.ZodNumber;
27
28
  }, z.core.$strip>;
28
29
  export type WaterHeaterStatus = z.infer<typeof WaterHeaterStatusSchema>;
@@ -55,6 +56,7 @@ export declare const waterHeaterCapability: {
55
56
  away: z.ZodNullable<z.ZodBoolean>;
56
57
  minTemp: z.ZodNullable<z.ZodNumber>;
57
58
  maxTemp: z.ZodNullable<z.ZodNumber>;
59
+ lastActiveMode: z.ZodOptional<z.ZodString>;
58
60
  lastChangedAt: z.ZodNumber;
59
61
  }, z.core.$strip>;
60
62
  readonly kind: 'push';
@@ -71,6 +73,7 @@ export declare const waterHeaterCapability: {
71
73
  away: z.ZodNullable<z.ZodBoolean>;
72
74
  minTemp: z.ZodNullable<z.ZodNumber>;
73
75
  maxTemp: z.ZodNullable<z.ZodNumber>;
76
+ lastActiveMode: z.ZodOptional<z.ZodString>;
74
77
  lastChangedAt: z.ZodNumber;
75
78
  }, z.core.$strip>;
76
79
  /**
@@ -79,7 +82,8 @@ export declare const waterHeaterCapability: {
79
82
  * See `RuntimeStateDurability`. Enforced by
80
83
  * `scripts/check-runtime-state-durability.ts`.
81
84
  */
82
- readonly durability: 'session';
85
+ readonly durability: 'restored';
86
+ readonly restoredStateFields: readonly ["lastActiveMode"];
83
87
  /**
84
88
  * History (D850): recorded series. The schema carries no unit; providers publish Celsius. Setpoint keeps every change.
85
89
  */
package/dist/client.js CHANGED
@@ -29849,7 +29849,6 @@ function createSystemProxy(api) {
29849
29849
  list: (input) => dispatch("integrations", "list", "query", input),
29850
29850
  get: (input) => dispatch("integrations", "get", "query", input),
29851
29851
  getByAddonId: (input) => dispatch("integrations", "getByAddonId", "query", input),
29852
- create: (input) => dispatch("integrations", "create", "mutation", input),
29853
29852
  update: (input) => dispatch("integrations", "update", "mutation", input),
29854
29853
  delete: (input) => dispatch("integrations", "delete", "mutation", input),
29855
29854
  getAvailableTypes: (input) => dispatch("integrations", "getAvailableTypes", "query", input)
package/dist/client.mjs CHANGED
@@ -29848,7 +29848,6 @@ function createSystemProxy(api) {
29848
29848
  list: (input) => dispatch("integrations", "list", "query", input),
29849
29849
  get: (input) => dispatch("integrations", "get", "query", input),
29850
29850
  getByAddonId: (input) => dispatch("integrations", "getByAddonId", "query", input),
29851
- create: (input) => dispatch("integrations", "create", "mutation", input),
29852
29851
  update: (input) => dispatch("integrations", "update", "mutation", input),
29853
29852
  delete: (input) => dispatch("integrations", "delete", "mutation", input),
29854
29853
  getAvailableTypes: (input) => dispatch("integrations", "getAvailableTypes", "query", input)
@@ -0,0 +1,45 @@
1
+ /**
2
+ * What a climate-control slice means for a hero (D1023): one pure derivation,
3
+ * so the contribution only maps it to model parts. Nothing here guesses: a
4
+ * slice that did not answer is `null`, a missing bound is a missing bound.
5
+ */
6
+ import type { ClimateControlStatus, HvacMode } from '../../capabilities/climate-control.cap.js';
7
+ import type { HeroSceneMode } from './hero-scene.js';
8
+ import { type HeroText } from './hero-text.js';
9
+ export interface ClimateSetpointRange {
10
+ readonly min: number;
11
+ readonly max: number;
12
+ readonly step: number;
13
+ }
14
+ export interface ClimateView {
15
+ readonly mode: HvacMode;
16
+ readonly isOff: boolean;
17
+ readonly modeLabel: HeroText;
18
+ readonly target: number | null;
19
+ readonly measured: number | null;
20
+ /** The dual setpoint of a range mode (`heat_cool`); both ends or neither. */
21
+ readonly targetRange: {
22
+ readonly low: number;
23
+ readonly high: number;
24
+ } | null;
25
+ readonly targetHumidity: number | null;
26
+ readonly humidity: number | null;
27
+ /** The bounds the device reported; `null` when it did not (the stepper is then not offered). */
28
+ readonly range: ClimateSetpointRange | null;
29
+ readonly availableModes: readonly HvacMode[];
30
+ readonly sceneMode: HeroSceneMode | null;
31
+ /** The setpoint inside its range, 0..1; `null` without a setpoint or a range. */
32
+ readonly level: number | null;
33
+ /** The mode that "turn on" selects; `null` when the device lists none. */
34
+ readonly onMode: HvacMode | null;
35
+ }
36
+ export declare function modeLabelOf(mode: HvacMode): HeroText;
37
+ /** 22 -> "22", 22.3 -> "22.3": a trailing zero is noise on a thermostat. */
38
+ export declare function formatDegrees(value: number): string;
39
+ export declare function deriveClimateView(slice: ClimateControlStatus): ClimateView;
40
+ /** "22° (22.3°)": the setpoint and, in brackets, what is measured. The mode is the headline, not repeated here. */
41
+ export declare function thermalStatusText(target: number | string | null, measured: number | null): HeroText | null;
42
+ export declare function climateStatusText(view: ClimateView): HeroText | null;
43
+ /** The setpoint inside its range, 0..1. */
44
+ export declare function levelWithin(value: number | null, range: ClimateSetpointRange | null): number | null;
45
+ export declare function rangeFrom(min: number | null | undefined, max: number | null | undefined, step: number | null | undefined): ClimateSetpointRange | null;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The pieces every cap contribution is written with (D1023): the contribution
3
+ * shape, the boundary parse, and the builders of an action, a reading and a
4
+ * fact. Shared by `hero-contributions.ts` and the per-theme contribution files,
5
+ * so a contribution reads the same wherever it lives.
6
+ */
7
+ import type { z } from 'zod';
8
+ import type { VocabIcon } from './cap-vocabulary-icon.js';
9
+ import type { HeroContext, HeroFragment, StateReading } from './hero-fragment.js';
10
+ import type { HeroAction, HeroArgs, HeroConfirm, HeroControl, HeroFact, HeroRow } from './hero-model.js';
11
+ import type { HeroState } from './hero-state.js';
12
+ import { type HeroText } from './hero-text.js';
13
+ export interface HeroContribution {
14
+ readonly cap: string;
15
+ readonly contribute: (slice: unknown, ctx: HeroContext) => HeroFragment;
16
+ }
17
+ /** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
18
+ export declare function contribution<S>(cap: string, schema: z.ZodType<S>, build: (slice: S | undefined, ctx: HeroContext) => HeroFragment): HeroContribution;
19
+ export declare function action(id: string, label: HeroText, icon: VocabIcon, cap: string, method: string, args?: HeroArgs, emphasis?: 'primary' | 'normal', confirm?: HeroConfirm | null): HeroAction;
20
+ export declare const asAction: (a: HeroAction) => HeroControl;
21
+ export declare function reading(source: StateReading['source'], state: HeroState, assumed?: boolean, title?: HeroText): StateReading;
22
+ export declare function fact(id: HeroFact['id'], icon: HeroFact['icon'], text: HeroText, tone?: HeroFact['tone']): HeroFact;
23
+ export declare function row(id: HeroRow['id'], icon: HeroRow['icon'], status: HeroText | null, controls?: readonly HeroControl[]): HeroRow;
24
+ /** "5 min" / "3 h" / "2 d" since `at`; `null` when the moment is unknown (0) or in the future. */
25
+ export declare function elapsedText(at: number, now: number): HeroText | null;
26
+ /** Joins words with " · ", skipping what is not there. */
27
+ export declare function joinText(parts: readonly (HeroText | null)[]): HeroText | null;
@@ -0,0 +1,2 @@
1
+ import { type HeroContribution } from './hero-contribution-kit.js';
2
+ export declare const ACCESS_FAMILY_CONTRIBUTIONS: Readonly<Record<string, HeroContribution>>;
@@ -0,0 +1,2 @@
1
+ import { type HeroContribution } from './hero-contribution-kit.js';
2
+ export declare const ACTUATORS_FAMILY_CONTRIBUTIONS: Readonly<Record<string, HeroContribution>>;
@@ -0,0 +1,3 @@
1
+ import { type HeroContribution } from './hero-contribution-kit.js';
2
+ /** The climate family, in the order their fragments are merged (a valve's level outranks a setpoint's). */
3
+ export declare const CLIMATE_FAMILY_CONTRIBUTIONS: Readonly<Record<string, HeroContribution>>;
@@ -0,0 +1,2 @@
1
+ import { type HeroContribution } from './hero-contribution-kit.js';
2
+ export declare const DEVICES_FAMILY_CONTRIBUTIONS: Readonly<Record<string, HeroContribution>>;
@@ -0,0 +1,2 @@
1
+ import { type HeroContribution } from './hero-contribution-kit.js';
2
+ export declare const GROUPS_FAMILY_CONTRIBUTIONS: Readonly<Record<string, HeroContribution>>;
@@ -0,0 +1,2 @@
1
+ import { type HeroContribution } from './hero-contribution-kit.js';
2
+ export declare const SENSORS_FAMILY_CONTRIBUTIONS: Readonly<Record<string, HeroContribution>>;
@@ -1,7 +1,4 @@
1
- import type { HeroContext, HeroFragment } from './hero-fragment.js';
2
- export interface HeroContribution {
3
- readonly cap: string;
4
- readonly contribute: (slice: unknown, ctx: HeroContext) => HeroFragment;
5
- }
1
+ import { type HeroContribution } from './hero-contribution-kit.js';
2
+ export type { HeroContribution } from './hero-contribution-kit.js';
6
3
  /** Every contributing cap, in the order their fragments are merged. */
7
4
  export declare const HERO_CAP_CONTRIBUTIONS: readonly HeroContribution[];
@@ -5,13 +5,19 @@
5
5
  import type { HeroBadge, HeroConsumablesSlot, HeroConsumptionSlot, HeroFact, HeroOwnPowerSlot, HeroPowerSupplySlot, HeroRemoteSlot, HeroRow, HeroSideTile, HeroTimedRunSlot } from './hero-model.js';
6
6
  import type { HeroSceneMode } from './hero-scene.js';
7
7
  import type { HeroState } from './hero-state.js';
8
+ import type { HeroText } from './hero-text.js';
8
9
  /** Which cap a state reading comes from; `STATE_SOURCE_ORDER` ranks them. */
9
- export type StateSource = 'media-player' | 'dishwasher' | 'running-state' | 'switch' | 'contact';
10
+ export type StateSource = 'media-player' | 'dishwasher' | 'lock-control' | 'alarm-panel' | 'vacuum-control' | 'lawn-mower-control' | 'fan-control' | 'pet-feeder' | 'pet-fountain' | 'automation-control' | 'script-runner' | 'event-emitter' | 'running-state' | 'switch' | 'contact' | 'group-active' | 'cover' | 'valve' | 'humidifier' | 'brightness' | 'smoke' | 'flood' | 'gas' | 'tamper' | 'vibration' | 'doorbell' | 'motion' | 'presence' | 'update' | 'weather' | 'image' | 'control' | 'meter' | 'binary' | 'button' | 'climate-control' | 'sensor';
10
11
  export interface StateReading {
11
12
  readonly source: StateSource;
12
13
  readonly state: HeroState;
13
14
  /** The state is the driver's own bookkeeping, not a reading. */
14
15
  readonly assumed: boolean;
16
+ /**
17
+ * The words for the state when the generic ones ("On", "Off") would mislead:
18
+ * a lock is "Locked", an alarm "Armed away". Absent = the state's own words.
19
+ */
20
+ readonly title?: HeroText;
15
21
  }
16
22
  export interface HeroContext {
17
23
  readonly deviceId: number;
@@ -22,6 +28,8 @@ export interface HeroContext {
22
28
  readonly running: boolean | null | undefined;
23
29
  /** Saved remote commands; `null` = not known. */
24
30
  readonly remoteCommands: number | null;
31
+ /** The caps the device is bound to: a contribution that overlaps another cap's fact yields to it. */
32
+ readonly caps: readonly string[];
25
33
  }
26
34
  export interface HeroFragment {
27
35
  readonly reading?: StateReading;
@@ -47,6 +55,8 @@ export interface HeroFragment {
47
55
  readonly right?: readonly HeroSideTile[];
48
56
  };
49
57
  /** What the scene is doing, when this cap knows. The first fragment that names a field wins. */
58
+ /** What the hero's headline says instead of the state word (a mode, a reading). The first fragment that names one wins; offline and unknown are never overridden. */
59
+ readonly title?: HeroText;
50
60
  readonly scene?: {
51
61
  readonly mode?: HeroSceneMode;
52
62
  readonly level?: number;