@camstack/types 1.2.533 → 1.2.535

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 (56) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/addon/base-addon.d.ts +1 -20
  3. package/dist/addon/notification-targets.d.ts +34 -9
  4. package/dist/addon.js +2 -2
  5. package/dist/addon.mjs +2 -2
  6. package/dist/capabilities/addon-settings.cap.d.ts +0 -41
  7. package/dist/capabilities/capability-definition.d.ts +26 -2
  8. package/dist/capabilities/heat-pump-control.cap.d.ts +83 -0
  9. package/dist/capabilities/heat-pump-status.cap.d.ts +517 -0
  10. package/dist/capabilities/hero-layout.cap.d.ts +46 -0
  11. package/dist/capabilities/index.d.ts +5 -1
  12. package/dist/capabilities/integration-instances.cap.d.ts +22 -7
  13. package/dist/capabilities/integrations.cap.d.ts +13 -0
  14. package/dist/capabilities/smtp-provider.cap.d.ts +2 -10
  15. package/dist/client.js +24 -7
  16. package/dist/client.mjs +24 -7
  17. package/dist/{composition-BjHGoicU.js → composition-BxalDSTt.js} +1 -1
  18. package/dist/{composition-CXCX78IR.mjs → composition-C6TZGqUb.mjs} +1 -1
  19. package/dist/device/cap-vocabulary/entries/heat-pump.d.ts +4 -0
  20. package/dist/device/device-type.d.ts +5 -1
  21. package/dist/device/hero/build-hero-model.d.ts +2 -0
  22. package/dist/device/hero/climate-view.d.ts +4 -0
  23. package/dist/device/hero/hero-contributions-heat-pump.d.ts +2 -0
  24. package/dist/device/hero/hero-fragment.d.ts +4 -0
  25. package/dist/device/hero/hero-layout.d.ts +1 -0
  26. package/dist/device/hero/hero-look.d.ts +6 -0
  27. package/dist/device/hero/hero-model.d.ts +80 -1
  28. package/dist/device/hero/hero-row.d.ts +5 -0
  29. package/dist/device/hero/hero-scene.d.ts +4 -1
  30. package/dist/device/hero/index.d.ts +1 -1
  31. package/dist/{device-type-BaYa0UGS.js → device-type-BfvqqzRp.js} +4 -0
  32. package/dist/{device-type-CbDhVwFP.mjs → device-type-DTTZKB2I.mjs} +4 -0
  33. package/dist/generated/addon-api.d.ts +122 -17
  34. package/dist/generated/addon-cap-facts.d.ts +1 -1
  35. package/dist/generated/cap-status-types.d.ts +3 -1
  36. package/dist/generated/capability-router-map.d.ts +8 -2
  37. package/dist/generated/customize-catalog.d.ts +1 -1
  38. package/dist/generated/device-local-state.d.ts +3 -0
  39. package/dist/generated/device-proxy.d.ts +5 -0
  40. package/dist/generated/device-scoped-caps.d.ts +1 -1
  41. package/dist/generated/history-catalog.d.ts +2 -2
  42. package/dist/generated/method-access-map.d.ts +1 -1
  43. package/dist/generated/method-device-selectors.d.ts +1 -1
  44. package/dist/generated/runtime-state-durability.d.ts +1 -1
  45. package/dist/generated/system-proxy.d.ts +1 -1
  46. package/dist/i18n/camstack-error.d.ts +8 -0
  47. package/dist/index.d.ts +1 -3
  48. package/dist/index.js +1580 -208
  49. package/dist/index.mjs +1560 -208
  50. package/dist/interfaces/addon.d.ts +0 -6
  51. package/dist/node.js +2 -2
  52. package/dist/node.mjs +2 -2
  53. package/dist/{sleep-ComzlWyT.js → sleep-CCAQ_PEp.js} +278 -99
  54. package/dist/{sleep-CS5Xp1iQ.mjs → sleep-DnVqHJc4.mjs} +267 -100
  55. package/package.json +1 -1
  56. package/dist/addon/integration-instance-ref.d.ts +0 -21
package/CHANGELOG.md CHANGED
@@ -7,11 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.535] - 2026-11-09
11
+
12
+ ### Changed
13
+
14
+ - Device hero: the integration name is a chip, climate modes and fan speeds carry readable labels, and the scene caption names the mode and the fan
15
+ - The device hero model gains an end clock time, a timer tile, fan oscillation and mode, tank and volume tiles, and a valve caption
16
+ - Device hero: the vacuum gets a Suction row and tile, media, lock, alarm, cover and light carry their own tiles, and the climate mode picker ends with Off
17
+ - Device hero model: media-player shuffle/repeat/next/previous and progress, washing and dishwasher cycle rows, phase and started tiles, hero args with a dotted value path, update cap read-only
18
+ - A heat pump is a device type of its own, with a heat-pump-status reading of every circuit and typed heat-pump-control setters
19
+
20
+ ## [1.2.534] - 2026-11-09
21
+
22
+ ### Changed
23
+
24
+ - A user's writes to their own notification targets are audit-logged
25
+ - A user's own notification targets are now integration instances scoped to the signed-in user; capability methods can declare caller-scoped access
26
+ - Integrations: update accepts enabled only for a fixed builtin (the hub's own switch, which works while its addon is down); any other row is switched through setInstanceEnabled, and a row whose addon did not answer is marked switchUnknown
27
+ - SMTP: the duplicate smtp-provider verify call is removed; test a relay from its instance (Test connection)
28
+ - integrations.delete is back: it deletes an integration from the hub side, so an addon that is installed but not running can still be removed.
29
+ - smtp-provider getStatus adds an optional verified flag (true, false, or absent while the relay has not sent).
30
+ - A provider's refusal of a caller (a user touching a target that is not theirs) answers FORBIDDEN instead of a server error.
31
+
32
+ ### Removed
33
+
34
+ - addonSettings.getIntegrationFormSchema, BaseAddon.integrationFormSchema and IntegrationInstanceRef are removed; an instance form is integrationInstances.instanceFormSchema
35
+
10
36
  ## [1.2.533] - 2026-11-09
11
37
 
12
38
  ### Changed
13
39
 
14
40
  - Removed the unused claimAction from the account-sign-in config field.
41
+ ### Changed
42
+
15
43
 
16
44
  ## [1.2.532] - 2026-11-09
17
45
 
@@ -19,6 +47,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
47
 
20
48
  - A calendar names the integration-instances record that owns it (calendar-source CalendarInfo.instanceId, passed through the calendars listing)
21
49
  - Remote: an infrared source may leave its emitter out (the remote's default one is used), the power mode setting is gone, and the colour keys have one set of roles
50
+ ### Changed
51
+
52
+
53
+ ### Removed
54
+
22
55
 
23
56
  ## [1.2.531] - 2026-11-08
24
57
 
@@ -5,7 +5,6 @@ import { type AddonMigration, type AddonMigrationRunOptions, type AddonMigration
5
5
  import type { MigrationApiV1 } from '../migrations/api/migration-api.v1.js';
6
6
  import type { DefinedRecordKind } from '../records/record-kind.js';
7
7
  import { type DurableState } from './durable-state.js';
8
- import type { IntegrationInstanceRef } from './integration-instance-ref.js';
9
8
  import { type ScopedSettings, type ScopedSettingsDeclaration, type ScopedSettingsScope } from './scoped-settings.js';
10
9
  import { type UnresolvedSecret } from './secret-settings-view.js';
11
10
  export interface DeclaredSettingsKeys {
@@ -294,14 +293,6 @@ export declare abstract class BaseAddon<TConfig extends object = Record<string,
294
293
  protected scopedSettingsCapabilities(): readonly string[];
295
294
  /** Override to provide device-level settings UI schema. */
296
295
  protected deviceSettingsSchema(): ConfigUISchema | null;
297
- /**
298
- * The form schema of ONE integration instance, or `null` to use the scoped form.
299
- *
300
- * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
301
- * needs its connection fields, the default integration the addon's own sections. It is the
302
- * SHAPE of the form only — the values live on the instance record.
303
- */
304
- protected integrationFormSchema(_instance: IntegrationInstanceRef): Promise<ConfigUISchema | null>;
305
296
  /**
306
297
  * D986 scoped settings: the form shape of the CLUSTER-wide settings one capability this addon
307
298
  * provides owns, or `null` when it has none. `cap` is a capability name the addon's manifest
@@ -324,8 +315,7 @@ export declare abstract class BaseAddon<TConfig extends object = Record<string,
324
315
  protected deviceDefaultsSchema(_cap: string): Promise<ConfigUISchema | null>;
325
316
  /**
326
317
  * The host's read of the scoped declarations: the schema one capability declares for `scope`,
327
- * or `null`. Beside {@link getIntegrationFormSchema}, the same shape: the hook is protected, the
328
- * host asks this method.
318
+ * or `null`. The hook is protected, the host asks this method.
329
319
  */
330
320
  getScopedSettingsSchema(scope: ScopedSettingsScope, cap: string): Promise<ConfigUISchema | null>;
331
321
  /**
@@ -387,13 +377,6 @@ export declare abstract class BaseAddon<TConfig extends object = Record<string,
387
377
  * its value. `null` when the capability declares nothing for the scope.
388
378
  */
389
379
  readScopedValues(scope: ScopedSettingsScope, cap: string, nodeId?: string): Promise<Record<string, unknown> | null>;
390
- /**
391
- * What the create wizard and the integration edit page render for one instance: the addon's
392
- * per-instance schema when it declares one, else its global schema (what they always showed).
393
- */
394
- getIntegrationFormSchema(instance: IntegrationInstanceRef, nodeId?: string): Promise<ConfigUISchemaWithValues | null>;
395
- /** The form of the scoped schemas this addon declared, hydrated from its store. */
396
- private scopedForm;
397
380
  /**
398
381
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
399
382
  * every `perNode: true` field carries THAT node's scoped value on its bare
@@ -464,8 +447,6 @@ export declare abstract class BaseAddon<TConfig extends object = Record<string,
464
447
  * derived from the previous set. Idempotent.
465
448
  */
466
449
  private loadScopedSchemas;
467
- /** The form of an addon's scoped schemas: their sections, each shown once. */
468
- private scopedFormSchema;
469
450
  /** Every loaded scoped schema of `cap`, or of every loaded capability. */
470
451
  private loadedScopedSchemas;
471
452
  /**
@@ -49,9 +49,10 @@ export declare function targetBody(target: Pick<Target, 'id' | 'name' | 'enabled
49
49
  /** The `Target` a record of a kind is; null when the row is not a target. */
50
50
  export declare function targetOfRecord(addonId: string, kind: string, id: string, data: InstanceBody): Target | null;
51
51
  /**
52
- * Where a target that could not be moved still lives (its legacy source). The facade serves such a row
53
- * as long as the new records do not hold its id, so a row the migration skipped never goes dark, and a
54
- * write of that id moves it (the legacy row is dropped last).
52
+ * Where a target that could not be moved still lives (its legacy source). A store handed one serves
53
+ * such a row as long as the new records do not hold its id, so a row a migration skipped never goes
54
+ * dark, and a write of that id moves it (the legacy row is dropped last). A migration also reads and
55
+ * empties it; the store of an addon whose source holds no rows never takes one.
55
56
  */
56
57
  export interface LegacyTargets {
57
58
  list(): Promise<readonly OldTargetRow[]>;
@@ -122,8 +123,23 @@ export interface NotificationTargetInstancesSpec {
122
123
  export declare function probeToTestResult(probed: ProbeTargetConfigResult): IntegrationTestConnectionResult;
123
124
  /** The instance kinds of a notification provider, one per target kind: a part a composition can take. */
124
125
  export declare function notificationTargetParts(records: Pick<RecordsAccess, 'kind' | 'owner'>, spec: NotificationTargetInstancesSpec): readonly InstanceKindPart[];
126
+ /** The body key that names the user a PERSONAL target belongs to (the open blob, no schema change). */
127
+ export declare const TARGET_OWNER_KEY = "ownerUserId";
128
+ /**
129
+ * The authorisation of a target as the instance door sees it. An admin (and an in-process caller
130
+ * that holds no session) keeps the admin door: every target, any change. A user sees and changes
131
+ * only the targets whose `ownerUserId` is theirs, and a target with no owner (a global target the
132
+ * operator made) is nobody's. Nothing a client sends moves the owner of a user's target: the
133
+ * server stamps it from the caller.
134
+ */
135
+ export declare function scopeInstancesToCaller(inner: IIntegrationInstancesProvider, logger: IScopedLogger): IIntegrationInstancesProvider;
125
136
  /** The `integration-instances` provider of a notification provider: one kind per target kind. */
126
137
  export declare function buildNotificationTargetInstances(records: Pick<RecordsAccess, 'kind' | 'owner'>, spec: NotificationTargetInstancesSpec): IIntegrationInstancesProvider;
138
+ /**
139
+ * The same provider, for a notification provider whose targets belong to users (the notifiers
140
+ * addon): `describe().userScoped`, and every row filtered on the caller.
141
+ */
142
+ export declare function buildUserScopedNotificationTargetInstances(records: Pick<RecordsAccess, 'kind' | 'owner'>, spec: NotificationTargetInstancesSpec, logger: IScopedLogger): IIntegrationInstancesProvider;
127
143
  /** One old row: the record of the single `notification-targets` kind, its secrets resolved. */
128
144
  export interface OldTargetRow {
129
145
  readonly id: string;
@@ -146,7 +162,7 @@ export interface TargetRowPorts {
146
162
  dropNew(kind: string, id: string): Promise<void>;
147
163
  /** Drop the old row, last. */
148
164
  dropOld(id: string): Promise<void>;
149
- /** A row left where it was (its legacy source keeps serving it), with the reason. */
165
+ /** A row left in the retired kind, with the reason; nothing serves it. */
150
166
  skipped(row: {
151
167
  readonly id: string;
152
168
  readonly kind: string;
@@ -158,11 +174,14 @@ export declare function secretKeysOf(descriptor: TargetKind): readonly string[];
158
174
  /**
159
175
  * Move every old row to the record of its kind under the SAME id: the config flat beside the name and
160
176
  * the switch, each secret written to the keychain by the door and READ BACK before the old row goes.
161
- * One bad row never aborts the others: a row whose write or read-back fails (or disagrees) is undone,
162
- * reported through `skipped` with its id and reason, and its old row stays where it was, still served
163
- * by the facade. A row of a kind this provider does not serve is left alone the same way. Idempotent:
164
- * no old rows is `already-done`, and a row the new kind already holds equal is only dropped from the
165
- * old kind.
177
+ * One bad row never aborts the others: a row whose write or read-back fails (or disagrees) is undone
178
+ * and its old row stays where it was, still served by the store through its legacy source. A row of a
179
+ * kind this provider does not serve is left alone the same way (`skipped`, nothing to retry).
180
+ * Idempotent: a row the new kind already holds equal is only dropped from the old kind.
181
+ *
182
+ * A row that FAILED makes the run throw, after every other row was tried: the ledger then records
183
+ * `failed`, not `applied`, and the migration runs again on the next boot until each row has moved.
184
+ * Reporting `done` over a row that merely failed once would leave it in the retired kind for good.
166
185
  */
167
186
  export declare function moveTargetRows(ports: TargetRowPorts, secretKeysByKind: (kind: string) => readonly string[]): Promise<MigrationProcedureResult>;
168
187
  /** The body of a row of the retired single kind (`{ name, kind, addonId, enabled, config }`, no id). */
@@ -175,6 +194,12 @@ export declare const OldTargetBodySchema: z.ZodObject<{
175
194
  }, z.core.$strip>;
176
195
  /** The legacy source that is the retired single kind: its valid rows, an invalid one named and left. */
177
196
  export declare function legacyTargetsOver(oldKind: RecordKindHandle<z.infer<typeof OldTargetBodySchema>>, logger: IScopedLogger): LegacyTargets;
197
+ /**
198
+ * The retired kind as a lazy legacy source: it is declared on the store's first list (or delete),
199
+ * on every boot, not only while the migration runs, so a row the migration could not move stays
200
+ * visible through `legacy` and readable.
201
+ */
202
+ export declare function retiredTargetsOver(records: Pick<RecordsAccess, 'declare' | 'kind'>, retired: DefinedRecordKind<typeof OldTargetBodySchema>, logger: IScopedLogger): LegacyTargets;
178
203
  /** The ports over the records: the retired kind in, the per-kind records out. */
179
204
  export declare function targetRowPortsOver(deps: {
180
205
  readonly legacy: LegacyTargets;
package/dist/addon.js CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-ComzlWyT.js");
2
+ const require_sleep = require("./sleep-CCAQ_PEp.js");
3
3
  const require_event_category = require("./event-category-BC4RRerT.js");
4
- const require_device_type = require("./device-type-BaYa0UGS.js");
4
+ const require_device_type = require("./device-type-BfvqqzRp.js");
5
5
  //#region src/generated/cap-input-defaults.ts
6
6
  /**
7
7
  * AUTO-GENERATED by scripts/generate-cap-input-defaults.ts — DO NOT EDIT.
package/dist/addon.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as PipelineRunResultBridge, $r as RECORD_MAX_DATA_BYTES, A as isCommand, Ai as RevConflictError, An as PEER_BYTES_STALL_MS, B as withoutCallerStamp, Bn as RecordFieldPathSchema, Br as mapSecretLeaves, C as addonSliceHandleApi, Ci as PlaintextSecretError, Cn as forgetKnownSecret, Di as RecordTooLargeError, Dn as shortSecretRefHash, Dr as resolveDeviceSettings, Ei as RecordSecretUnavailableError, En as scrubKnownSecrets, Er as nodeIdOfScopedKey, F as CAP_ADVANCE_FIELDS, Fi as recordsErrorFromMessage, Gi as createEvent, Gn as StoredRecordKindDeclarationSchema, Gr as secretArrayPrefixes, H as defineCustomActions, Hn as RecordKindDeclarationSchema, Hr as recordArrayItemPath, I as CAP_METHOD_TIMEOUTS_MS, In as DisposerChain, J as nodePin, Jn as defineRecordKinds, Jr as RECORD_CLASSES, Ki as emitReadiness, Kn as assertValidDeclaration, Kr as RECORD_BATCH_MAX, Ln as defineEntryKind, Lr as secretViewsOf, Mi as UnindexedFilterError, N as HF_REPO, Ni as UnknownRecordKindError, Nn as CALLER_USERNAME_HEADER, Oi as RecordUniqueViolationError, On as PEER_BYTES_CHUNK_BYTES, Or as resolvedValues, Ot as createDebugEmitter, Pi as asRecordsError, Pn as DATAPLANE_SECRET_HEADER, Q as viewerUiCapability, Qr as RECORD_ID_MAX_LENGTH, R as CAP_STATE_LEAVES, Rn as entryBody, Rr as REMOVE_LEAF, Si as NoCallerError, Sn as clearKnownSecrets, Ti as RecordNotFoundError, Tn as registerKnownSecret, Tr as SCOPED_SETTINGS_SCOPES, U as describeCustomActions, Un as RecordKindNameSchema, Ur as recordSecretCollection, V as customAction, Vn as RecordIndexSchema, Vr as parseSecretPath, Wn as RecordRetentionSchema, Wr as recordSecretRef, X as readNodePin, Xn as collectZodSecretPaths, Xr as RECORD_DEFAULT_MAX_DATA_BYTES, Y as readCommandOrigin, Yr as RECORD_DATABASES, Zn as isZodSecret, Zr as RECORD_DELETE_BATCH, _ as readErrorI18n, _a as AddonMigrationsBlockedError, _i as BatchTooLargeError, _n as assertTransactScope, _t as ReadinessTimeoutError, aa as isSecretFieldView, ai as RECORD_SWEEP_INTERVAL_MS, ar as expandCapMethods, at as adminUiCapability, b as isDeviceScopedCap, bi as ForeignSecretMarkerError, bn as createSecretsAccess, bt as scopeKey, c as asString, ca as makeSecretMarker, ci as buildSecretRef, d as parseJsonUnknown, di as isSecretRef, ei as RECORD_MAX_INDEXES, et as PipelineStepInputSchema, f as hfModelUrl, fi as normalizeSecretOwner, fr as BaseAddon, g as ErrorI18nPayloadSchema, gn as createRecordsAccess, gt as ReadinessRegistry, hn as makeInMemoryRecords, hr as normalizeAddonInitResult, ht as MODEL_FORMATS, ia as isSecretClear, ii as RECORD_SETTINGS_MAX_ROWS, it as DEVICE_CHILDREN_BATCH_MAX, ji as TransactRefusedError, jn as PEER_BYTES_TICKET_TTL_MS, ki as RecordsError, kn as PEER_BYTES_MAX_OUTSTANDING, la as toSecretFieldView, li as formatSecretScope, mn as CommandOriginClaimSchema, na as SECRET_CLEAR, ni as RECORD_QUERY_MAX, o as asJsonObject, oa as isSecretMarker, oi as SECRET_REF_SCHEME, p as BOOT_RECOVERY_BACKOFF_MS, pi as parseSecretRef, q as commandOrigin, qn as declarationsOf, qr as RECORD_BATCH_MAX_BYTES, r as maskUrlCredentials, ra as classifySecretWrite, ri as RECORD_SECRET_COLLECTION_PREFIX, rt as deviceOpsCapability, sa as isSecretMarkerLike, si as arrayItemFieldPath, st as addonPagesSourceCapability, t as sleep, ti as RECORD_MAX_INDEX_FIELDS, tt as MIGRATION_API_VERSION, ui as globalSecretScope, va as findMigrationsBlocked, vi as DeclarationRefusedError, vn as resolveSecretViewsIn, w as createEventBusSliceSource, wi as RECORDS_ERROR_CODES, wn as knownSecretCount, x as createDeviceProxy, xi as InvalidRecordError, xn as MIN_SCRUBBED_LENGTH, y as DEVICE_SCOPED_CAPS, yi as FilterRequiredError, yn as REVALIDATE_AFTER_MS, z as CALLER_STAMPED_CAPABILITIES, zn as EntryDescriptorSchema, zr as collectSecretLeaves } from "./sleep-CS5Xp1iQ.mjs";
1
+ import { $ as DEVICE_CHILDREN_BATCH_MAX, $r as RECORD_DELETE_BATCH, A as CAP_ADVANCE_FIELDS, Ai as RecordUniqueViolationError, Ar as resolvedValues, Bn as StoredRecordKindDeclarationSchema, Br as REMOVE_LEAF, Ci as InvalidRecordError, Cn as PEER_BYTES_CHUNK_BYTES, Ct as createDebugEmitter, Di as RecordNotFoundError, Dr as SCOPED_SETTINGS_SCOPES, Ei as RECORDS_ERROR_CODES, En as PEER_BYTES_TICKET_TTL_MS, F as withoutCallerStamp, Fi as UnknownRecordKindError, Fn as RecordFieldPathSchema, G as readNodePin, Gn as collectZodSecretPaths, Gr as recordSecretCollection, H as commandOrigin, Hn as declarationsOf, Hr as mapSecretLeaves, I as customAction, Ii as asRecordsError, In as RecordIndexSchema, J as PipelineRunResultBridge, Ji as emitReadiness, Jr as RECORD_BATCH_MAX, Kn as isZodSecret, Kr as recordSecretRef, L as defineCustomActions, Li as recordsErrorFromMessage, Ln as RecordKindDeclarationSchema, Mi as RevConflictError, Mn as defineEntryKind, N as CAP_STATE_LEAVES, Ni as TransactRefusedError, Nn as entryBody, O as HF_REPO, Oi as RecordSecretUnavailableError, On as CALLER_USERNAME_HEADER, Or as nodeIdOfScopedKey, P as CALLER_STAMPED_CAPABILITIES, Pi as UnindexedFilterError, Pn as EntryDescriptorSchema, Q as deviceOpsCapability, Qr as RECORD_DEFAULT_MAX_DATA_BYTES, R as describeCustomActions, Rn as RecordKindNameSchema, Si as ForeignSecretMarkerError, Sn as shortSecretRefHash, T as isCommand, Ti as PlaintextSecretError, Tn as PEER_BYTES_STALL_MS, U as nodePin, Un as defineRecordKinds, Ur as parseSecretPath, Vn as assertValidDeclaration, Vr as collectSecretLeaves, W as readCommandOrigin, Wr as recordArrayItemPath, X as MIGRATION_API_VERSION, Xr as RECORD_CLASSES, Y as PipelineStepInputSchema, Yr as RECORD_BATCH_MAX_BYTES, Zr as RECORD_DATABASES, _n as clearKnownSecrets, _r as normalizeAddonInitResult, aa as classifySecretWrite, ai as RECORD_SECRET_COLLECTION_PREFIX, ba as findMigrationsBlocked, bi as DeclarationRefusedError, bn as registerKnownSecret, c as asString, ca as isSecretMarker, ci as SECRET_REF_SCHEME, d as parseJsonUnknown, da as toSecretFieldView, di as formatSecretScope, dn as createRecordsAccess, dt as ReadinessRegistry, ei as RECORD_ID_MAX_LENGTH, er as expandCapMethods, et as adminUiCapability, f as hfModelUrl, fi as globalSecretScope, fn as assertTransactScope, fr as readErrorI18n, ft as ReadinessTimeoutError, g as createDeviceProxy, gn as MIN_SCRUBBED_LENGTH, h as isDeviceScopedCap, hi as parseSecretRef, hn as createSecretsAccess, ht as scopeKey, ia as SECRET_CLEAR, ii as RECORD_QUERY_MAX, j as CAP_METHOD_TIMEOUTS_MS, ji as RecordsError, jn as DisposerChain, ki as RecordTooLargeError, kn as DATAPLANE_SECRET_HEADER, kr as resolveDeviceSettings, la as isSecretMarkerLike, li as arrayItemFieldPath, ln as CommandOriginClaimSchema, lr as ErrorI18nPayloadSchema, m as DEVICE_SCOPED_CAPS, mi as normalizeSecretOwner, mn as REVALIDATE_AFTER_MS, mr as BaseAddon, ni as RECORD_MAX_INDEXES, nt as addonPagesSourceCapability, o as asJsonObject, oa as isSecretClear, oi as RECORD_SETTINGS_MAX_ROWS, p as BOOT_RECOVERY_BACKOFF_MS, pi as isSecretRef, pn as resolveSecretViewsIn, q as viewerUiCapability, qi as createEvent, qr as secretArrayPrefixes, r as maskUrlCredentials, ri as RECORD_MAX_INDEX_FIELDS, sa as isSecretFieldView, si as RECORD_SWEEP_INTERVAL_MS, t as sleep, ti as RECORD_MAX_DATA_BYTES, ua as makeSecretMarker, ui as buildSecretRef, un as makeInMemoryRecords, ut as MODEL_FORMATS, v as addonSliceHandleApi, vn as forgetKnownSecret, wi as NoCallerError, wn as PEER_BYTES_MAX_OUTSTANDING, xi as FilterRequiredError, xn as scrubKnownSecrets, y as createEventBusSliceSource, ya as AddonMigrationsBlockedError, yi as BatchTooLargeError, yn as knownSecretCount, zn as RecordRetentionSchema, zr as secretViewsOf } from "./sleep-DnVqHJc4.mjs";
2
2
  import { t as EventCategory } from "./event-category-78tcBemo.mjs";
3
- import { i as DeviceType, o as errMsg } from "./device-type-CbDhVwFP.mjs";
3
+ import { i as DeviceType, o as errMsg } from "./device-type-DTTZKB2I.mjs";
4
4
  //#region src/generated/cap-input-defaults.ts
5
5
  /**
6
6
  * AUTO-GENERATED by scripts/generate-cap-input-defaults.ts — DO NOT EDIT.
@@ -167,47 +167,6 @@ export declare const addonSettingsCapability: {
167
167
  }>;
168
168
  nodeId: z.ZodOptional<z.ZodString>;
169
169
  }, z.core.$strip>, z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>, import("./capability-definition.js").CapabilityMethodKind>;
170
- readonly getIntegrationFormSchema: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
171
- addonId: z.ZodString;
172
- nodeId: z.ZodOptional<z.ZodString>;
173
- instance: z.ZodObject<{
174
- integrationId: z.ZodNullable<z.ZodString>;
175
- mode: z.ZodEnum<{
176
- account: "account";
177
- broker: "broker";
178
- standalone: "standalone";
179
- }>;
180
- candidateStableId: z.ZodOptional<z.ZodString>;
181
- }, z.core.$strip>;
182
- }, z.core.$strip>, z.ZodNullable<z.ZodObject<{
183
- tabs: z.ZodOptional<z.ZodArray<z.ZodObject<{
184
- id: z.ZodString;
185
- label: z.ZodString;
186
- icon: z.ZodString;
187
- order: z.ZodOptional<z.ZodNumber>;
188
- }, z.core.$strip>>>;
189
- sections: z.ZodArray<z.ZodObject<{
190
- id: z.ZodString;
191
- title: z.ZodString;
192
- titleKey: z.ZodOptional<z.ZodString>;
193
- description: z.ZodOptional<z.ZodString>;
194
- descriptionKey: z.ZodOptional<z.ZodString>;
195
- style: z.ZodOptional<z.ZodEnum<{
196
- accordion: "accordion";
197
- card: "card";
198
- }>>;
199
- defaultCollapsed: z.ZodOptional<z.ZodBoolean>;
200
- columns: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>]>>;
201
- tab: z.ZodOptional<z.ZodString>;
202
- location: z.ZodOptional<z.ZodEnum<{
203
- hero: "hero";
204
- settings: "settings";
205
- "top-tab": "top-tab";
206
- }>>;
207
- order: z.ZodOptional<z.ZodNumber>;
208
- fields: z.ZodArray<z.ZodAny>;
209
- }, z.core.$strip>>;
210
- }, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
211
170
  readonly getDeclaredSettingsKeys: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
212
171
  addonId: z.ZodString;
213
172
  nodeId: z.ZodOptional<z.ZodString>;
@@ -53,8 +53,15 @@ export interface CapCaller {
53
53
  * methods with an OBJECT input schema (the injected field needs an
54
54
  * object to live on); the runtime builder rejects other shapes at
55
55
  * router-build time.
56
+ *
57
+ * `'scoped'` — the method is open to ANY authenticated session and the provider decides per
58
+ * caller (a user sees and changes only their own rows; epic #440). The router injects the same
59
+ * {@link CapCaller} (provider input: `caller?: CapCaller`, absent for an in-process caller that
60
+ * holds no session), and it default-denies: a NON-admin caller is admitted only on a call pinned
61
+ * to ONE addon (`addonId`) whose provider declares itself user-scoped
62
+ * (`isUserScopedProvider`). Every other provider keeps the admin-only door it always had.
56
63
  */
57
- export type CapabilityMethodCaller = 'required';
64
+ export type CapabilityMethodCaller = 'required' | 'scoped';
58
65
  /**
59
66
  * Optional semantic role used by the admin UI's unified "Integrations"
60
67
  * page to group caps by what kind of external system they integrate
@@ -1049,9 +1056,15 @@ type ProviderMethodInput<M, TIn extends z.ZodType> = M extends {
1049
1056
  readonly caller: 'required';
1050
1057
  } ? z.infer<TIn> & {
1051
1058
  readonly caller: CapCaller;
1059
+ } : M extends {
1060
+ readonly caller: 'scoped';
1061
+ } ? z.infer<TIn> & {
1062
+ readonly caller?: CapCaller;
1052
1063
  } : z.infer<TIn>;
1053
1064
  /** One provider method's callable shape, subscription arm included. */
1054
- type ProviderMethodFn<M> = M extends CapabilityMethodSchema<infer TIn, infer TOut> ? M['kind'] extends 'subscription' ? (input: z.infer<TIn>, push: (value: z.infer<TOut>) => void) => (() => void) | void : (input: ProviderMethodInput<M, TIn>) => Promise<z.infer<TOut>> : never;
1065
+ type ProviderMethodFn<M> = M extends CapabilityMethodSchema<infer TIn, infer TOut> ? M['kind'] extends 'subscription' ? (input: z.infer<TIn>, push: (value: z.infer<TOut>) => void) => (() => void) | void : M extends {
1066
+ readonly caller: 'scoped';
1067
+ } ? Record<string, never> extends ProviderMethodInput<M, TIn> ? (input?: ProviderMethodInput<M, TIn>) => Promise<z.infer<TOut>> : (input: ProviderMethodInput<M, TIn>) => Promise<z.infer<TOut>> : (input: ProviderMethodInput<M, TIn>) => Promise<z.infer<TOut>> : never;
1055
1068
  export type InferProvider<T extends CapabilityDefinition> = {
1056
1069
  readonly [K in keyof T['methods'] as T['methods'][K] extends {
1057
1070
  providerOptional: true;
@@ -1181,6 +1194,11 @@ export declare function method<TIn extends z.ZodType, TOut extends z.ZodType, TK
1181
1194
  }): CapabilityMethodSchema<TIn, TOut, TKind> & {
1182
1195
  readonly caller: 'required';
1183
1196
  };
1197
+ export declare function method<TIn extends z.ZodType, TOut extends z.ZodType, TKind extends CapabilityMethodKind = 'query'>(input: TIn, output: TOut, options: CapabilityMethodOptions<TKind> & {
1198
+ readonly caller: 'scoped';
1199
+ }): CapabilityMethodSchema<TIn, TOut, TKind> & {
1200
+ readonly caller: 'scoped';
1201
+ };
1184
1202
  export declare function method<TIn extends z.ZodType, TOut extends z.ZodType, TKind extends CapabilityMethodKind = 'query'>(input: TIn, output: TOut, options?: CapabilityMethodOptions<TKind>): CapabilityMethodSchema<TIn, TOut, TKind>;
1185
1203
  /**
1186
1204
  * A wrapper/system-only method: served exclusively by the cap's system-level
@@ -1197,6 +1215,12 @@ export declare function systemMethod<TIn extends z.ZodType, TOut extends z.ZodTy
1197
1215
  * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
1198
1216
  * for when this is the honest answer and when it is a soft stub.
1199
1217
  */
1218
+ export declare function optionalMethod<TIn extends z.ZodType, TOut extends z.ZodType, TKind extends CapabilityMethodKind = 'query'>(input: TIn, output: TOut, options: CapabilityMethodOptions<TKind> & {
1219
+ readonly caller: 'scoped';
1220
+ }): CapabilityMethodSchema<TIn, TOut, TKind> & {
1221
+ readonly providerOptional: true;
1222
+ readonly caller: 'scoped';
1223
+ };
1200
1224
  export declare function optionalMethod<TIn extends z.ZodType, TOut extends z.ZodType, TKind extends CapabilityMethodKind = 'query'>(input: TIn, output: TOut, options?: CapabilityMethodOptions<TKind>): CapabilityMethodSchema<TIn, TOut, TKind> & {
1201
1225
  readonly providerOptional: true;
1202
1226
  };
@@ -0,0 +1,83 @@
1
+ import { z } from 'zod';
2
+ import { type InferProvider } from './capability-definition.js';
3
+ import { DeviceType } from '../device/device-type.js';
4
+ export declare const heatPumpControlCapability: {
5
+ readonly name: 'heat-pump-control';
6
+ readonly scope: 'device';
7
+ readonly deviceNative: true;
8
+ readonly mode: 'singleton';
9
+ readonly deviceTypes: readonly [DeviceType.HeatPump];
10
+ readonly methods: {
11
+ /** off / auto / on. */
12
+ readonly setSilentMode: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
13
+ deviceId: z.ZodNumber;
14
+ mode: z.ZodString;
15
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
16
+ /** off / on. */
17
+ readonly setAwayMode: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
18
+ deviceId: z.ZodNumber;
19
+ mode: z.ZodString;
20
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
21
+ /** off / manual / auto. */
22
+ readonly setAdditionalHeaterMode: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
23
+ deviceId: z.ZodNumber;
24
+ mode: z.ZodString;
25
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
26
+ /** off / hm1 .. hm8 (the programmes the gateway lists). */
27
+ readonly setHolidayMode: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
28
+ deviceId: z.ZodNumber;
29
+ mode: z.ZodString;
30
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
31
+ readonly setCircuitOperationMode: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
32
+ deviceId: z.ZodNumber;
33
+ circuitId: z.ZodString;
34
+ mode: z.ZodString;
35
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
36
+ readonly setCircuitHeatCoolMode: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
37
+ deviceId: z.ZodNumber;
38
+ circuitId: z.ZodString;
39
+ mode: z.ZodString;
40
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
41
+ readonly setCircuitSummerWinter: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
42
+ deviceId: z.ZodNumber;
43
+ circuitId: z.ZodString;
44
+ mode: z.ZodString;
45
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
46
+ readonly setCircuitComfortSetpoint: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
47
+ deviceId: z.ZodNumber;
48
+ circuitId: z.ZodString;
49
+ temp: z.ZodNumber;
50
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
51
+ readonly setCircuitEcoSetpoint: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
52
+ deviceId: z.ZodNumber;
53
+ circuitId: z.ZodString;
54
+ temp: z.ZodNumber;
55
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
56
+ readonly setCircuitMaxFlowTemp: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
57
+ deviceId: z.ZodNumber;
58
+ circuitId: z.ZodString;
59
+ temp: z.ZodNumber;
60
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
61
+ readonly setDhwOperationMode: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
62
+ deviceId: z.ZodNumber;
63
+ circuitId: z.ZodString;
64
+ mode: z.ZodString;
65
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
66
+ readonly setDhwTemperatureLevel: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
67
+ deviceId: z.ZodNumber;
68
+ circuitId: z.ZodString;
69
+ level: z.ZodString;
70
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
71
+ readonly setDhwChargeDuration: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
72
+ deviceId: z.ZodNumber;
73
+ circuitId: z.ZodString;
74
+ minutes: z.ZodNumber;
75
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
76
+ /** Start an extra-hot-water charge now: an action, not a stored mode. */
77
+ readonly startExtraHotWater: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
78
+ deviceId: z.ZodNumber;
79
+ circuitId: z.ZodString;
80
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
81
+ };
82
+ };
83
+ export type IHeatPumpControlProvider = InferProvider<typeof heatPumpControlCapability>;