@camstack/addon-provider-homematic 1.2.140 → 1.2.141

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 (3) hide show
  1. package/dist/addon.js +165 -102
  2. package/dist/addon.mjs +165 -102
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -5556,7 +5556,7 @@ var ZodIssueCode = {
5556
5556
  var ZodFirstPartyTypeKind;
5557
5557
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5558
5558
  //#endregion
5559
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5559
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5560
5560
  /**
5561
5561
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5562
5562
  * window to float samples (D455).
@@ -7939,9 +7939,9 @@ function normalizeAddonInitResult(result) {
7939
7939
  return result;
7940
7940
  }
7941
7941
  /**
7942
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7943
- * and validates them (`share-token.service.ts` builds its enum from this
7944
- * list); a data plane names the kinds it ACCEPTS in `share`.
7942
+ * The share-view scope kinds a share-link token can carry. The hub mints
7943
+ * and validates them (`ShareViewGrantSchema` builds its
7944
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7945
7945
  */
7946
7946
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7947
7947
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12831,7 +12831,7 @@ var ConvertResultSchema = object({
12831
12831
  * `super_admin` — collapsed onto the single boolean because every
12832
12832
  * non-admin caller is governed by the same scope-check rules; the
12833
12833
  * distinction was only ever used to route role-specific procedures
12834
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12834
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12835
12835
  * with `isAdmin: false` + an explicit scope list.
12836
12836
  */
12837
12837
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13020,10 +13020,12 @@ var AddonRoutesScopeSchema = object({
13020
13020
  type: literal("addon-routes"),
13021
13021
  access: array(MethodAccessSchema).min(1)
13022
13022
  });
13023
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13023
13024
  var CredentialScopeSchema = union([
13024
13025
  literal("*"),
13025
13026
  ShareViewScopeSchema,
13026
13027
  AddonRoutesScopeSchema,
13028
+ PreferencesSelfScopeSchema,
13027
13029
  TokenScopeSchema
13028
13030
  ]);
13029
13031
  object({
@@ -13032,6 +13034,55 @@ object({
13032
13034
  jti: string().min(16),
13033
13035
  scopes: array(CredentialScopeSchema).min(1)
13034
13036
  });
13037
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13038
+ /** A namespace's value: a JSON object, opaque to the hub. */
13039
+ var PreferenceValueSchema = record(string(), unknown());
13040
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13041
+ /** A stored row, as the owner reads it. */
13042
+ var PreferenceRowSchema = object({
13043
+ namespace: PreferenceNamespaceSchema,
13044
+ value: PreferenceValueSchema,
13045
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13046
+ revision: number().int().positive(),
13047
+ updatedAt: number().int(),
13048
+ /** The client id the last writer sent; `null` when it sent none. */
13049
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13050
+ });
13051
+ object({
13052
+ /** Absent: every namespace the caller holds. */
13053
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13054
+ object({ rows: array(PreferenceRowSchema) });
13055
+ object({
13056
+ namespace: PreferenceNamespaceSchema,
13057
+ value: PreferenceValueSchema,
13058
+ /**
13059
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13060
+ * namespace must not exist yet. Any other value that is not the current
13061
+ * revision answers `conflict` and writes nothing.
13062
+ */
13063
+ baseRevision: number().int().nonnegative().optional(),
13064
+ deviceId: PreferenceDeviceIdSchema.optional()
13065
+ });
13066
+ discriminatedUnion("status", [object({
13067
+ status: literal("saved"),
13068
+ row: PreferenceRowSchema
13069
+ }), object({
13070
+ status: literal("conflict"),
13071
+ current: PreferenceRowSchema.nullable()
13072
+ })]);
13073
+ object({ namespace: PreferenceNamespaceSchema });
13074
+ object({
13075
+ /** `false` when the namespace did not exist. */
13076
+ deleted: boolean() });
13077
+ object({
13078
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13079
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13080
+ object({
13081
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13082
+ rows: array(PreferenceRowSchema),
13083
+ /** Namespaces the client listed that no longer exist. */
13084
+ deleted: array(PreferenceNamespaceSchema)
13085
+ });
13035
13086
  _enum(["new-session", "step-up"]);
13036
13087
  /** The languages the hub's app landing pages are written in (D858). */
13037
13088
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40387,38 +40438,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40387
40438
  auth: "admin",
40388
40439
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40389
40440
  });
40441
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40442
+ /** What a model (or, by default, every model of a kind) can do. */
40443
+ var LlmModelFeaturesSchema = object({
40444
+ vision: boolean(),
40445
+ tools: boolean(),
40446
+ streaming: boolean()
40447
+ });
40448
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40449
+ var LlmModelInfoSchema = object({
40450
+ id: string(),
40451
+ label: string().optional(),
40452
+ contextLength: number().int().positive().optional(),
40453
+ features: LlmModelFeaturesSchema.partial().optional()
40454
+ });
40390
40455
  /**
40391
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40392
- * methods concat-fan across providers; single-row methods route to ONE
40393
- * provider by the `addonId` in the call input (the notification-output
40394
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40395
- * (hub-placed); the cap stays open for future providers.
40396
- *
40397
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40398
- * `apiKey` is a password field — providers REDACT it on read and merge on
40399
- * write; a stored key NEVER round-trips to a client.
40456
+ * The provider-specific part of a profile, validated by the provider that owns
40457
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40458
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40459
+ * keychain, never in the row, and reads back as the redaction marker.
40400
40460
  */
40401
- var LlmProfileKindSchema = _enum([
40402
- "openai-compatible",
40403
- "openai",
40404
- "anthropic",
40405
- "google",
40406
- "managed-local",
40407
- "apple-foundation"
40408
- ]);
40461
+ var LlmProviderConfigSchema = record(string(), unknown());
40409
40462
  var LlmProfileSchema = object({
40410
40463
  id: string(),
40411
40464
  name: string(),
40465
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40412
40466
  kind: LlmProfileKindSchema,
40413
40467
  /** Stamped by the provider — keeps the fanned catalog routable. */
40414
40468
  addonId: string(),
40415
40469
  enabled: boolean(),
40416
40470
  /** Vendor model id, or the managed runtime's loaded model. */
40417
40471
  model: string(),
40418
- /** Required for openai-compatible; override for cloud kinds. */
40419
- baseUrl: string().optional(),
40420
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40421
- apiKey: string().optional(),
40422
40472
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40423
40473
  * degraded to text — that shipped once and produced a confident answer to a
40424
40474
  * question about a picture nobody sent. */
@@ -40426,15 +40476,11 @@ var LlmProfileSchema = object({
40426
40476
  temperature: number().min(0).max(2).optional(),
40427
40477
  /** Nucleus sampling. Every wire we speak has it. */
40428
40478
  topP: number().min(0).max(1).optional(),
40429
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40430
- * wire does, and the client drops it there (measured: the request body gets
40431
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40432
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40479
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40480
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40433
40481
  topK: number().int().positive().optional(),
40434
40482
  maxTokens: number().int().positive().optional(),
40435
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40436
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40437
- * the model with, so it is the one field that changes a PROCESS. */
40483
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40438
40484
  contextLength: number().int().positive().optional(),
40439
40485
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40440
40486
  * two system prompts fighting is worse than either alone). */
@@ -40460,16 +40506,37 @@ var LlmProfileSchema = object({
40460
40506
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40461
40507
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40462
40508
  toolsEnabled: boolean().default(false),
40463
- extraHeaders: record(string(), string()).optional(),
40464
- /** kind === 'managed-local' only (spec §4). */
40465
- runtime: ManagedRuntimeConfigSchema.optional(),
40466
- /**
40467
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40468
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40469
- * `supportsVision` on such a row is stamped by the provider from the node's
40470
- * reported `imageInput`, never taken from the operator (D62).
40471
- */
40472
- appleFoundation: object({ nodeId: string() }).optional()
40509
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40510
+ providerConfig: LlmProviderConfigSchema.default({})
40511
+ });
40512
+ /**
40513
+ * The common profile fields a kind's editor offers. The editor owns how each
40514
+ * one is drawn; the provider says which of them mean something on its wire.
40515
+ */
40516
+ var LlmProfileFieldSchema = _enum([
40517
+ "temperature",
40518
+ "topP",
40519
+ "topK",
40520
+ "maxTokens",
40521
+ "contextLength",
40522
+ "systemPrompt",
40523
+ "timeoutMs",
40524
+ "connectTimeoutMs",
40525
+ "firstTokenTimeoutMs",
40526
+ "idleTimeoutMs",
40527
+ "retry",
40528
+ "toolsEnabled"
40529
+ ]);
40530
+ /**
40531
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40532
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40533
+ * picker: that widget owns the model choice.
40534
+ */
40535
+ var LlmProviderWidgetSchema = object({
40536
+ id: string(),
40537
+ placement: _enum(["connection", "model"]),
40538
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40539
+ requires: array(string()).optional()
40473
40540
  });
40474
40541
  /** ConfigUISchema tree passed through untyped on the wire (the
40475
40542
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40478,11 +40545,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40478
40545
  var LlmProfileKindDescriptorSchema = object({
40479
40546
  kind: LlmProfileKindSchema,
40480
40547
  label: string(),
40548
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40481
40549
  icon: string(),
40482
40550
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40483
40551
  addonId: string(),
40484
- configSchema: ConfigSchemaPassthrough$3
40552
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40553
+ connectionSchema: ConfigSchemaPassthrough$3,
40554
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40555
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40556
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40557
+ features: LlmModelFeaturesSchema,
40558
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40559
+ visionEditable: boolean(),
40560
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40561
+ modelCatalog: _enum([
40562
+ "fetch",
40563
+ "static",
40564
+ "none"
40565
+ ]),
40566
+ staticModels: array(LlmModelInfoSchema).optional(),
40567
+ /** The common fields that mean something on this kind's wire. */
40568
+ profileFields: array(LlmProfileFieldSchema),
40569
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40485
40570
  });
40571
+ /**
40572
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40573
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40574
+ * untouched (absent or the redaction marker) is resolved server-side from the
40575
+ * stored profile — the browser never receives it.
40576
+ */
40577
+ var LlmListModelsInputSchema = object({
40578
+ addonId: string(),
40579
+ kind: LlmProfileKindSchema,
40580
+ profileId: string().optional(),
40581
+ connection: LlmProviderConfigSchema.optional()
40582
+ });
40583
+ var LlmListModelsErrorCodeSchema = _enum([
40584
+ "auth",
40585
+ "network",
40586
+ "unsupported",
40587
+ "invalid"
40588
+ ]);
40589
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40590
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40591
+ ok: literal(true),
40592
+ models: array(LlmModelInfoSchema)
40593
+ }), object({
40594
+ ok: literal(false),
40595
+ code: LlmListModelsErrorCodeSchema,
40596
+ message: string()
40597
+ })]);
40486
40598
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40487
40599
  var LlmDefaultSchema = object({
40488
40600
  selector: LlmDefaultSelectorSchema,
@@ -40582,7 +40694,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40582
40694
  kind: "mutation",
40583
40695
  auth: "admin",
40584
40696
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40585
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40697
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40698
+ kind: "mutation",
40699
+ auth: "admin"
40700
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40586
40701
  selector: LlmDefaultSelectorSchema,
40587
40702
  profileId: string().nullable()
40588
40703
  }), _void(), {
@@ -64470,26 +64585,6 @@ var ApiKeySummarySchema = object({
64470
64585
  createdAt: number(),
64471
64586
  lastUsedAt: number().optional()
64472
64587
  });
64473
- var ScopedTokenSummarySchema = object({
64474
- id: string(),
64475
- userId: string(),
64476
- name: string(),
64477
- tokenPrefix: string(),
64478
- scopes: array(TokenScopeSchema),
64479
- expiresAt: number().nullish(),
64480
- lastUsedAt: number().nullish(),
64481
- createdAt: number()
64482
- });
64483
- var CreateScopedTokenInputSchema = object({
64484
- userId: string(),
64485
- name: string(),
64486
- scopes: array(TokenScopeSchema),
64487
- expiresAt: number().optional()
64488
- });
64489
- var CreateScopedTokenResultSchema = object({
64490
- token: string(),
64491
- record: ScopedTokenSummarySchema
64492
- });
64493
64588
  var OauthSessionSummarySchema = object({
64494
64589
  id: string(),
64495
64590
  userId: string(),
@@ -64511,11 +64606,11 @@ var TotpStatusSchema = object({
64511
64606
  confirmedAt: number().nullable()
64512
64607
  });
64513
64608
  /**
64514
- * user-management — singleton capability for user accounts, API keys,
64515
- * and scoped tokens.
64609
+ * user-management — singleton capability for user accounts and the
64610
+ * legacy API-key rows.
64516
64611
  *
64517
64612
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
64518
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
64613
+ * — the subset check on `setUserScopes` is moot
64519
64614
  * because non-admins never reach these. If/when we open non-admin
64520
64615
  * delegation, structural caller-scope subset check goes inside the
64521
64616
  * provider.
@@ -64572,15 +64667,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64572
64667
  kind: "mutation",
64573
64668
  auth: "admin",
64574
64669
  access: "delete"
64575
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
64576
- kind: "mutation",
64577
- auth: "admin",
64578
- access: "create"
64579
- }), method(object({ id: string() }), object({ success: literal(true) }), {
64580
- kind: "mutation",
64581
- auth: "admin",
64582
- access: "delete"
64583
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
64670
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
64584
64671
  kind: "mutation",
64585
64672
  auth: "admin",
64586
64673
  access: "create"
@@ -70670,7 +70757,7 @@ Object.freeze({
70670
70757
  capName: "llm",
70671
70758
  capScope: "system",
70672
70759
  addonId: null,
70673
- access: "view"
70760
+ access: "create"
70674
70761
  },
70675
70762
  "llm.listNodeModels": {
70676
70763
  capName: "llm",
@@ -75334,12 +75421,6 @@ Object.freeze({
75334
75421
  addonId: null,
75335
75422
  access: "create"
75336
75423
  },
75337
- "userManagement.createScopedToken": {
75338
- capName: "user-management",
75339
- capScope: "system",
75340
- addonId: null,
75341
- access: "create"
75342
- },
75343
75424
  "userManagement.createUser": {
75344
75425
  capName: "user-management",
75345
75426
  capScope: "system",
@@ -75388,12 +75469,6 @@ Object.freeze({
75388
75469
  addonId: null,
75389
75470
  access: "view"
75390
75471
  },
75391
- "userManagement.listScopedTokens": {
75392
- capName: "user-management",
75393
- capScope: "system",
75394
- addonId: null,
75395
- access: "view"
75396
- },
75397
75472
  "userManagement.listUsers": {
75398
75473
  capName: "user-management",
75399
75474
  capScope: "system",
@@ -75448,12 +75523,6 @@ Object.freeze({
75448
75523
  addonId: null,
75449
75524
  access: "delete"
75450
75525
  },
75451
- "userManagement.revokeScopedToken": {
75452
- capName: "user-management",
75453
- capScope: "system",
75454
- addonId: null,
75455
- access: "delete"
75456
- },
75457
75526
  "userManagement.setupTotp": {
75458
75527
  capName: "user-management",
75459
75528
  capScope: "system",
@@ -75484,12 +75553,6 @@ Object.freeze({
75484
75553
  addonId: null,
75485
75554
  access: "view"
75486
75555
  },
75487
- "userManagement.validateScopedToken": {
75488
- capName: "user-management",
75489
- capScope: "system",
75490
- addonId: null,
75491
- access: "view"
75492
- },
75493
75556
  "userManagement.verifyTotp": {
75494
75557
  capName: "user-management",
75495
75558
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -5557,7 +5557,7 @@ var ZodIssueCode = {
5557
5557
  var ZodFirstPartyTypeKind;
5558
5558
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5559
5559
  //#endregion
5560
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5560
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5561
5561
  /**
5562
5562
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5563
5563
  * window to float samples (D455).
@@ -7940,9 +7940,9 @@ function normalizeAddonInitResult(result) {
7940
7940
  return result;
7941
7941
  }
7942
7942
  /**
7943
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7944
- * and validates them (`share-token.service.ts` builds its enum from this
7945
- * list); a data plane names the kinds it ACCEPTS in `share`.
7943
+ * The share-view scope kinds a share-link token can carry. The hub mints
7944
+ * and validates them (`ShareViewGrantSchema` builds its
7945
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7946
7946
  */
7947
7947
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7948
7948
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12832,7 +12832,7 @@ var ConvertResultSchema = object({
12832
12832
  * `super_admin` — collapsed onto the single boolean because every
12833
12833
  * non-admin caller is governed by the same scope-check rules; the
12834
12834
  * distinction was only ever used to route role-specific procedures
12835
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12835
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12836
12836
  * with `isAdmin: false` + an explicit scope list.
12837
12837
  */
12838
12838
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13021,10 +13021,12 @@ var AddonRoutesScopeSchema = object({
13021
13021
  type: literal("addon-routes"),
13022
13022
  access: array(MethodAccessSchema).min(1)
13023
13023
  });
13024
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13024
13025
  var CredentialScopeSchema = union([
13025
13026
  literal("*"),
13026
13027
  ShareViewScopeSchema,
13027
13028
  AddonRoutesScopeSchema,
13029
+ PreferencesSelfScopeSchema,
13028
13030
  TokenScopeSchema
13029
13031
  ]);
13030
13032
  object({
@@ -13033,6 +13035,55 @@ object({
13033
13035
  jti: string().min(16),
13034
13036
  scopes: array(CredentialScopeSchema).min(1)
13035
13037
  });
13038
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13039
+ /** A namespace's value: a JSON object, opaque to the hub. */
13040
+ var PreferenceValueSchema = record(string(), unknown());
13041
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13042
+ /** A stored row, as the owner reads it. */
13043
+ var PreferenceRowSchema = object({
13044
+ namespace: PreferenceNamespaceSchema,
13045
+ value: PreferenceValueSchema,
13046
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13047
+ revision: number().int().positive(),
13048
+ updatedAt: number().int(),
13049
+ /** The client id the last writer sent; `null` when it sent none. */
13050
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13051
+ });
13052
+ object({
13053
+ /** Absent: every namespace the caller holds. */
13054
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13055
+ object({ rows: array(PreferenceRowSchema) });
13056
+ object({
13057
+ namespace: PreferenceNamespaceSchema,
13058
+ value: PreferenceValueSchema,
13059
+ /**
13060
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13061
+ * namespace must not exist yet. Any other value that is not the current
13062
+ * revision answers `conflict` and writes nothing.
13063
+ */
13064
+ baseRevision: number().int().nonnegative().optional(),
13065
+ deviceId: PreferenceDeviceIdSchema.optional()
13066
+ });
13067
+ discriminatedUnion("status", [object({
13068
+ status: literal("saved"),
13069
+ row: PreferenceRowSchema
13070
+ }), object({
13071
+ status: literal("conflict"),
13072
+ current: PreferenceRowSchema.nullable()
13073
+ })]);
13074
+ object({ namespace: PreferenceNamespaceSchema });
13075
+ object({
13076
+ /** `false` when the namespace did not exist. */
13077
+ deleted: boolean() });
13078
+ object({
13079
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13080
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13081
+ object({
13082
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13083
+ rows: array(PreferenceRowSchema),
13084
+ /** Namespaces the client listed that no longer exist. */
13085
+ deleted: array(PreferenceNamespaceSchema)
13086
+ });
13036
13087
  _enum(["new-session", "step-up"]);
13037
13088
  /** The languages the hub's app landing pages are written in (D858). */
13038
13089
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40388,38 +40439,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40388
40439
  auth: "admin",
40389
40440
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40390
40441
  });
40442
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40443
+ /** What a model (or, by default, every model of a kind) can do. */
40444
+ var LlmModelFeaturesSchema = object({
40445
+ vision: boolean(),
40446
+ tools: boolean(),
40447
+ streaming: boolean()
40448
+ });
40449
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40450
+ var LlmModelInfoSchema = object({
40451
+ id: string(),
40452
+ label: string().optional(),
40453
+ contextLength: number().int().positive().optional(),
40454
+ features: LlmModelFeaturesSchema.partial().optional()
40455
+ });
40391
40456
  /**
40392
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40393
- * methods concat-fan across providers; single-row methods route to ONE
40394
- * provider by the `addonId` in the call input (the notification-output
40395
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40396
- * (hub-placed); the cap stays open for future providers.
40397
- *
40398
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40399
- * `apiKey` is a password field — providers REDACT it on read and merge on
40400
- * write; a stored key NEVER round-trips to a client.
40457
+ * The provider-specific part of a profile, validated by the provider that owns
40458
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40459
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40460
+ * keychain, never in the row, and reads back as the redaction marker.
40401
40461
  */
40402
- var LlmProfileKindSchema = _enum([
40403
- "openai-compatible",
40404
- "openai",
40405
- "anthropic",
40406
- "google",
40407
- "managed-local",
40408
- "apple-foundation"
40409
- ]);
40462
+ var LlmProviderConfigSchema = record(string(), unknown());
40410
40463
  var LlmProfileSchema = object({
40411
40464
  id: string(),
40412
40465
  name: string(),
40466
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40413
40467
  kind: LlmProfileKindSchema,
40414
40468
  /** Stamped by the provider — keeps the fanned catalog routable. */
40415
40469
  addonId: string(),
40416
40470
  enabled: boolean(),
40417
40471
  /** Vendor model id, or the managed runtime's loaded model. */
40418
40472
  model: string(),
40419
- /** Required for openai-compatible; override for cloud kinds. */
40420
- baseUrl: string().optional(),
40421
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40422
- apiKey: string().optional(),
40423
40473
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40424
40474
  * degraded to text — that shipped once and produced a confident answer to a
40425
40475
  * question about a picture nobody sent. */
@@ -40427,15 +40477,11 @@ var LlmProfileSchema = object({
40427
40477
  temperature: number().min(0).max(2).optional(),
40428
40478
  /** Nucleus sampling. Every wire we speak has it. */
40429
40479
  topP: number().min(0).max(1).optional(),
40430
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40431
- * wire does, and the client drops it there (measured: the request body gets
40432
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40433
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40480
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40481
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40434
40482
  topK: number().int().positive().optional(),
40435
40483
  maxTokens: number().int().positive().optional(),
40436
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40437
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40438
- * the model with, so it is the one field that changes a PROCESS. */
40484
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40439
40485
  contextLength: number().int().positive().optional(),
40440
40486
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40441
40487
  * two system prompts fighting is worse than either alone). */
@@ -40461,16 +40507,37 @@ var LlmProfileSchema = object({
40461
40507
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40462
40508
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40463
40509
  toolsEnabled: boolean().default(false),
40464
- extraHeaders: record(string(), string()).optional(),
40465
- /** kind === 'managed-local' only (spec §4). */
40466
- runtime: ManagedRuntimeConfigSchema.optional(),
40467
- /**
40468
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40469
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40470
- * `supportsVision` on such a row is stamped by the provider from the node's
40471
- * reported `imageInput`, never taken from the operator (D62).
40472
- */
40473
- appleFoundation: object({ nodeId: string() }).optional()
40510
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40511
+ providerConfig: LlmProviderConfigSchema.default({})
40512
+ });
40513
+ /**
40514
+ * The common profile fields a kind's editor offers. The editor owns how each
40515
+ * one is drawn; the provider says which of them mean something on its wire.
40516
+ */
40517
+ var LlmProfileFieldSchema = _enum([
40518
+ "temperature",
40519
+ "topP",
40520
+ "topK",
40521
+ "maxTokens",
40522
+ "contextLength",
40523
+ "systemPrompt",
40524
+ "timeoutMs",
40525
+ "connectTimeoutMs",
40526
+ "firstTokenTimeoutMs",
40527
+ "idleTimeoutMs",
40528
+ "retry",
40529
+ "toolsEnabled"
40530
+ ]);
40531
+ /**
40532
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40533
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40534
+ * picker: that widget owns the model choice.
40535
+ */
40536
+ var LlmProviderWidgetSchema = object({
40537
+ id: string(),
40538
+ placement: _enum(["connection", "model"]),
40539
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40540
+ requires: array(string()).optional()
40474
40541
  });
40475
40542
  /** ConfigUISchema tree passed through untyped on the wire (the
40476
40543
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40479,11 +40546,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40479
40546
  var LlmProfileKindDescriptorSchema = object({
40480
40547
  kind: LlmProfileKindSchema,
40481
40548
  label: string(),
40549
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40482
40550
  icon: string(),
40483
40551
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40484
40552
  addonId: string(),
40485
- configSchema: ConfigSchemaPassthrough$3
40553
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40554
+ connectionSchema: ConfigSchemaPassthrough$3,
40555
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40556
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40557
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40558
+ features: LlmModelFeaturesSchema,
40559
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40560
+ visionEditable: boolean(),
40561
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40562
+ modelCatalog: _enum([
40563
+ "fetch",
40564
+ "static",
40565
+ "none"
40566
+ ]),
40567
+ staticModels: array(LlmModelInfoSchema).optional(),
40568
+ /** The common fields that mean something on this kind's wire. */
40569
+ profileFields: array(LlmProfileFieldSchema),
40570
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40486
40571
  });
40572
+ /**
40573
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40574
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40575
+ * untouched (absent or the redaction marker) is resolved server-side from the
40576
+ * stored profile — the browser never receives it.
40577
+ */
40578
+ var LlmListModelsInputSchema = object({
40579
+ addonId: string(),
40580
+ kind: LlmProfileKindSchema,
40581
+ profileId: string().optional(),
40582
+ connection: LlmProviderConfigSchema.optional()
40583
+ });
40584
+ var LlmListModelsErrorCodeSchema = _enum([
40585
+ "auth",
40586
+ "network",
40587
+ "unsupported",
40588
+ "invalid"
40589
+ ]);
40590
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40591
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40592
+ ok: literal(true),
40593
+ models: array(LlmModelInfoSchema)
40594
+ }), object({
40595
+ ok: literal(false),
40596
+ code: LlmListModelsErrorCodeSchema,
40597
+ message: string()
40598
+ })]);
40487
40599
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40488
40600
  var LlmDefaultSchema = object({
40489
40601
  selector: LlmDefaultSelectorSchema,
@@ -40583,7 +40695,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40583
40695
  kind: "mutation",
40584
40696
  auth: "admin",
40585
40697
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40586
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40698
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40699
+ kind: "mutation",
40700
+ auth: "admin"
40701
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40587
40702
  selector: LlmDefaultSelectorSchema,
40588
40703
  profileId: string().nullable()
40589
40704
  }), _void(), {
@@ -64471,26 +64586,6 @@ var ApiKeySummarySchema = object({
64471
64586
  createdAt: number(),
64472
64587
  lastUsedAt: number().optional()
64473
64588
  });
64474
- var ScopedTokenSummarySchema = object({
64475
- id: string(),
64476
- userId: string(),
64477
- name: string(),
64478
- tokenPrefix: string(),
64479
- scopes: array(TokenScopeSchema),
64480
- expiresAt: number().nullish(),
64481
- lastUsedAt: number().nullish(),
64482
- createdAt: number()
64483
- });
64484
- var CreateScopedTokenInputSchema = object({
64485
- userId: string(),
64486
- name: string(),
64487
- scopes: array(TokenScopeSchema),
64488
- expiresAt: number().optional()
64489
- });
64490
- var CreateScopedTokenResultSchema = object({
64491
- token: string(),
64492
- record: ScopedTokenSummarySchema
64493
- });
64494
64589
  var OauthSessionSummarySchema = object({
64495
64590
  id: string(),
64496
64591
  userId: string(),
@@ -64512,11 +64607,11 @@ var TotpStatusSchema = object({
64512
64607
  confirmedAt: number().nullable()
64513
64608
  });
64514
64609
  /**
64515
- * user-management — singleton capability for user accounts, API keys,
64516
- * and scoped tokens.
64610
+ * user-management — singleton capability for user accounts and the
64611
+ * legacy API-key rows.
64517
64612
  *
64518
64613
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
64519
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
64614
+ * — the subset check on `setUserScopes` is moot
64520
64615
  * because non-admins never reach these. If/when we open non-admin
64521
64616
  * delegation, structural caller-scope subset check goes inside the
64522
64617
  * provider.
@@ -64573,15 +64668,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64573
64668
  kind: "mutation",
64574
64669
  auth: "admin",
64575
64670
  access: "delete"
64576
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
64577
- kind: "mutation",
64578
- auth: "admin",
64579
- access: "create"
64580
- }), method(object({ id: string() }), object({ success: literal(true) }), {
64581
- kind: "mutation",
64582
- auth: "admin",
64583
- access: "delete"
64584
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
64671
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
64585
64672
  kind: "mutation",
64586
64673
  auth: "admin",
64587
64674
  access: "create"
@@ -70671,7 +70758,7 @@ Object.freeze({
70671
70758
  capName: "llm",
70672
70759
  capScope: "system",
70673
70760
  addonId: null,
70674
- access: "view"
70761
+ access: "create"
70675
70762
  },
70676
70763
  "llm.listNodeModels": {
70677
70764
  capName: "llm",
@@ -75335,12 +75422,6 @@ Object.freeze({
75335
75422
  addonId: null,
75336
75423
  access: "create"
75337
75424
  },
75338
- "userManagement.createScopedToken": {
75339
- capName: "user-management",
75340
- capScope: "system",
75341
- addonId: null,
75342
- access: "create"
75343
- },
75344
75425
  "userManagement.createUser": {
75345
75426
  capName: "user-management",
75346
75427
  capScope: "system",
@@ -75389,12 +75470,6 @@ Object.freeze({
75389
75470
  addonId: null,
75390
75471
  access: "view"
75391
75472
  },
75392
- "userManagement.listScopedTokens": {
75393
- capName: "user-management",
75394
- capScope: "system",
75395
- addonId: null,
75396
- access: "view"
75397
- },
75398
75473
  "userManagement.listUsers": {
75399
75474
  capName: "user-management",
75400
75475
  capScope: "system",
@@ -75449,12 +75524,6 @@ Object.freeze({
75449
75524
  addonId: null,
75450
75525
  access: "delete"
75451
75526
  },
75452
- "userManagement.revokeScopedToken": {
75453
- capName: "user-management",
75454
- capScope: "system",
75455
- addonId: null,
75456
- access: "delete"
75457
- },
75458
75527
  "userManagement.setupTotp": {
75459
75528
  capName: "user-management",
75460
75529
  capScope: "system",
@@ -75485,12 +75554,6 @@ Object.freeze({
75485
75554
  addonId: null,
75486
75555
  access: "view"
75487
75556
  },
75488
- "userManagement.validateScopedToken": {
75489
- capName: "user-management",
75490
- capScope: "system",
75491
- addonId: null,
75492
- access: "view"
75493
- },
75494
75557
  "userManagement.verifyTotp": {
75495
75558
  capName: "user-management",
75496
75559
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-homematic",
3
- "version": "1.2.140",
3
+ "version": "1.2.141",
4
4
  "description": "Homematic / HomematicIP (CCU3 / RaspberryMatic) device-provider addon for CamStack — wraps the nodehomematic library",
5
5
  "keywords": [
6
6
  "camstack",