@camstack/addon-provider-tuya 0.2.129 → 0.2.130

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
@@ -6234,7 +6234,7 @@ var ZodIssueCode = {
6234
6234
  var ZodFirstPartyTypeKind;
6235
6235
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6236
6236
  //#endregion
6237
- //#region ../types/dist/sleep-BxjU_fJM.mjs
6237
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
6238
6238
  /**
6239
6239
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6240
6240
  * window to float samples (D455).
@@ -8617,9 +8617,9 @@ function normalizeAddonInitResult(result) {
8617
8617
  return result;
8618
8618
  }
8619
8619
  /**
8620
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
8621
- * and validates them (`share-token.service.ts` builds its enum from this
8622
- * list); a data plane names the kinds it ACCEPTS in `share`.
8620
+ * The share-view scope kinds a share-link token can carry. The hub mints
8621
+ * and validates them (`ShareViewGrantSchema` builds its
8622
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
8623
8623
  */
8624
8624
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
8625
8625
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -13309,7 +13309,7 @@ var ConvertResultSchema = object({
13309
13309
  * `super_admin` — collapsed onto the single boolean because every
13310
13310
  * non-admin caller is governed by the same scope-check rules; the
13311
13311
  * distinction was only ever used to route role-specific procedures
13312
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
13312
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
13313
13313
  * with `isAdmin: false` + an explicit scope list.
13314
13314
  */
13315
13315
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13498,10 +13498,12 @@ var AddonRoutesScopeSchema = object({
13498
13498
  type: literal("addon-routes"),
13499
13499
  access: array(MethodAccessSchema).min(1)
13500
13500
  });
13501
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13501
13502
  var CredentialScopeSchema = union([
13502
13503
  literal("*"),
13503
13504
  ShareViewScopeSchema,
13504
13505
  AddonRoutesScopeSchema,
13506
+ PreferencesSelfScopeSchema,
13505
13507
  TokenScopeSchema
13506
13508
  ]);
13507
13509
  object({
@@ -13510,6 +13512,55 @@ object({
13510
13512
  jti: string().min(16),
13511
13513
  scopes: array(CredentialScopeSchema).min(1)
13512
13514
  });
13515
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13516
+ /** A namespace's value: a JSON object, opaque to the hub. */
13517
+ var PreferenceValueSchema = record(string(), unknown());
13518
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13519
+ /** A stored row, as the owner reads it. */
13520
+ var PreferenceRowSchema = object({
13521
+ namespace: PreferenceNamespaceSchema,
13522
+ value: PreferenceValueSchema,
13523
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13524
+ revision: number().int().positive(),
13525
+ updatedAt: number().int(),
13526
+ /** The client id the last writer sent; `null` when it sent none. */
13527
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13528
+ });
13529
+ object({
13530
+ /** Absent: every namespace the caller holds. */
13531
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13532
+ object({ rows: array(PreferenceRowSchema) });
13533
+ object({
13534
+ namespace: PreferenceNamespaceSchema,
13535
+ value: PreferenceValueSchema,
13536
+ /**
13537
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13538
+ * namespace must not exist yet. Any other value that is not the current
13539
+ * revision answers `conflict` and writes nothing.
13540
+ */
13541
+ baseRevision: number().int().nonnegative().optional(),
13542
+ deviceId: PreferenceDeviceIdSchema.optional()
13543
+ });
13544
+ discriminatedUnion("status", [object({
13545
+ status: literal("saved"),
13546
+ row: PreferenceRowSchema
13547
+ }), object({
13548
+ status: literal("conflict"),
13549
+ current: PreferenceRowSchema.nullable()
13550
+ })]);
13551
+ object({ namespace: PreferenceNamespaceSchema });
13552
+ object({
13553
+ /** `false` when the namespace did not exist. */
13554
+ deleted: boolean() });
13555
+ object({
13556
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13557
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13558
+ object({
13559
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13560
+ rows: array(PreferenceRowSchema),
13561
+ /** Namespaces the client listed that no longer exist. */
13562
+ deleted: array(PreferenceNamespaceSchema)
13563
+ });
13513
13564
  _enum(["new-session", "step-up"]);
13514
13565
  /** The languages the hub's app landing pages are written in (D858). */
13515
13566
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40703,38 +40754,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40703
40754
  auth: "admin",
40704
40755
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40705
40756
  });
40757
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40758
+ /** What a model (or, by default, every model of a kind) can do. */
40759
+ var LlmModelFeaturesSchema = object({
40760
+ vision: boolean(),
40761
+ tools: boolean(),
40762
+ streaming: boolean()
40763
+ });
40764
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40765
+ var LlmModelInfoSchema = object({
40766
+ id: string(),
40767
+ label: string().optional(),
40768
+ contextLength: number().int().positive().optional(),
40769
+ features: LlmModelFeaturesSchema.partial().optional()
40770
+ });
40706
40771
  /**
40707
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40708
- * methods concat-fan across providers; single-row methods route to ONE
40709
- * provider by the `addonId` in the call input (the notification-output
40710
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40711
- * (hub-placed); the cap stays open for future providers.
40712
- *
40713
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40714
- * `apiKey` is a password field — providers REDACT it on read and merge on
40715
- * write; a stored key NEVER round-trips to a client.
40772
+ * The provider-specific part of a profile, validated by the provider that owns
40773
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40774
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40775
+ * keychain, never in the row, and reads back as the redaction marker.
40716
40776
  */
40717
- var LlmProfileKindSchema = _enum([
40718
- "openai-compatible",
40719
- "openai",
40720
- "anthropic",
40721
- "google",
40722
- "managed-local",
40723
- "apple-foundation"
40724
- ]);
40777
+ var LlmProviderConfigSchema = record(string(), unknown());
40725
40778
  var LlmProfileSchema = object({
40726
40779
  id: string(),
40727
40780
  name: string(),
40781
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40728
40782
  kind: LlmProfileKindSchema,
40729
40783
  /** Stamped by the provider — keeps the fanned catalog routable. */
40730
40784
  addonId: string(),
40731
40785
  enabled: boolean(),
40732
40786
  /** Vendor model id, or the managed runtime's loaded model. */
40733
40787
  model: string(),
40734
- /** Required for openai-compatible; override for cloud kinds. */
40735
- baseUrl: string().optional(),
40736
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40737
- apiKey: string().optional(),
40738
40788
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40739
40789
  * degraded to text — that shipped once and produced a confident answer to a
40740
40790
  * question about a picture nobody sent. */
@@ -40742,15 +40792,11 @@ var LlmProfileSchema = object({
40742
40792
  temperature: number().min(0).max(2).optional(),
40743
40793
  /** Nucleus sampling. Every wire we speak has it. */
40744
40794
  topP: number().min(0).max(1).optional(),
40745
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40746
- * wire does, and the client drops it there (measured: the request body gets
40747
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40748
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40795
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40796
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40749
40797
  topK: number().int().positive().optional(),
40750
40798
  maxTokens: number().int().positive().optional(),
40751
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40752
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40753
- * the model with, so it is the one field that changes a PROCESS. */
40799
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40754
40800
  contextLength: number().int().positive().optional(),
40755
40801
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40756
40802
  * two system prompts fighting is worse than either alone). */
@@ -40776,16 +40822,37 @@ var LlmProfileSchema = object({
40776
40822
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40777
40823
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40778
40824
  toolsEnabled: boolean().default(false),
40779
- extraHeaders: record(string(), string()).optional(),
40780
- /** kind === 'managed-local' only (spec §4). */
40781
- runtime: ManagedRuntimeConfigSchema.optional(),
40782
- /**
40783
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40784
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40785
- * `supportsVision` on such a row is stamped by the provider from the node's
40786
- * reported `imageInput`, never taken from the operator (D62).
40787
- */
40788
- appleFoundation: object({ nodeId: string() }).optional()
40825
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40826
+ providerConfig: LlmProviderConfigSchema.default({})
40827
+ });
40828
+ /**
40829
+ * The common profile fields a kind's editor offers. The editor owns how each
40830
+ * one is drawn; the provider says which of them mean something on its wire.
40831
+ */
40832
+ var LlmProfileFieldSchema = _enum([
40833
+ "temperature",
40834
+ "topP",
40835
+ "topK",
40836
+ "maxTokens",
40837
+ "contextLength",
40838
+ "systemPrompt",
40839
+ "timeoutMs",
40840
+ "connectTimeoutMs",
40841
+ "firstTokenTimeoutMs",
40842
+ "idleTimeoutMs",
40843
+ "retry",
40844
+ "toolsEnabled"
40845
+ ]);
40846
+ /**
40847
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40848
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40849
+ * picker: that widget owns the model choice.
40850
+ */
40851
+ var LlmProviderWidgetSchema = object({
40852
+ id: string(),
40853
+ placement: _enum(["connection", "model"]),
40854
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40855
+ requires: array(string()).optional()
40789
40856
  });
40790
40857
  /** ConfigUISchema tree passed through untyped on the wire (the
40791
40858
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40794,11 +40861,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40794
40861
  var LlmProfileKindDescriptorSchema = object({
40795
40862
  kind: LlmProfileKindSchema,
40796
40863
  label: string(),
40864
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40797
40865
  icon: string(),
40798
40866
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40799
40867
  addonId: string(),
40800
- configSchema: ConfigSchemaPassthrough$3
40868
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40869
+ connectionSchema: ConfigSchemaPassthrough$3,
40870
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40871
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40872
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40873
+ features: LlmModelFeaturesSchema,
40874
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40875
+ visionEditable: boolean(),
40876
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40877
+ modelCatalog: _enum([
40878
+ "fetch",
40879
+ "static",
40880
+ "none"
40881
+ ]),
40882
+ staticModels: array(LlmModelInfoSchema).optional(),
40883
+ /** The common fields that mean something on this kind's wire. */
40884
+ profileFields: array(LlmProfileFieldSchema),
40885
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40801
40886
  });
40887
+ /**
40888
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40889
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40890
+ * untouched (absent or the redaction marker) is resolved server-side from the
40891
+ * stored profile — the browser never receives it.
40892
+ */
40893
+ var LlmListModelsInputSchema = object({
40894
+ addonId: string(),
40895
+ kind: LlmProfileKindSchema,
40896
+ profileId: string().optional(),
40897
+ connection: LlmProviderConfigSchema.optional()
40898
+ });
40899
+ var LlmListModelsErrorCodeSchema = _enum([
40900
+ "auth",
40901
+ "network",
40902
+ "unsupported",
40903
+ "invalid"
40904
+ ]);
40905
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40906
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40907
+ ok: literal(true),
40908
+ models: array(LlmModelInfoSchema)
40909
+ }), object({
40910
+ ok: literal(false),
40911
+ code: LlmListModelsErrorCodeSchema,
40912
+ message: string()
40913
+ })]);
40802
40914
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40803
40915
  var LlmDefaultSchema = object({
40804
40916
  selector: LlmDefaultSelectorSchema,
@@ -40898,7 +41010,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40898
41010
  kind: "mutation",
40899
41011
  auth: "admin",
40900
41012
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40901
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
41013
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
41014
+ kind: "mutation",
41015
+ auth: "admin"
41016
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40902
41017
  selector: LlmDefaultSelectorSchema,
40903
41018
  profileId: string().nullable()
40904
41019
  }), _void(), {
@@ -64794,26 +64909,6 @@ var ApiKeySummarySchema = object({
64794
64909
  createdAt: number(),
64795
64910
  lastUsedAt: number().optional()
64796
64911
  });
64797
- var ScopedTokenSummarySchema = object({
64798
- id: string(),
64799
- userId: string(),
64800
- name: string(),
64801
- tokenPrefix: string(),
64802
- scopes: array(TokenScopeSchema),
64803
- expiresAt: number().nullish(),
64804
- lastUsedAt: number().nullish(),
64805
- createdAt: number()
64806
- });
64807
- var CreateScopedTokenInputSchema = object({
64808
- userId: string(),
64809
- name: string(),
64810
- scopes: array(TokenScopeSchema),
64811
- expiresAt: number().optional()
64812
- });
64813
- var CreateScopedTokenResultSchema = object({
64814
- token: string(),
64815
- record: ScopedTokenSummarySchema
64816
- });
64817
64912
  var OauthSessionSummarySchema = object({
64818
64913
  id: string(),
64819
64914
  userId: string(),
@@ -64835,11 +64930,11 @@ var TotpStatusSchema = object({
64835
64930
  confirmedAt: number().nullable()
64836
64931
  });
64837
64932
  /**
64838
- * user-management — singleton capability for user accounts, API keys,
64839
- * and scoped tokens.
64933
+ * user-management — singleton capability for user accounts and the
64934
+ * legacy API-key rows.
64840
64935
  *
64841
64936
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
64842
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
64937
+ * — the subset check on `setUserScopes` is moot
64843
64938
  * because non-admins never reach these. If/when we open non-admin
64844
64939
  * delegation, structural caller-scope subset check goes inside the
64845
64940
  * provider.
@@ -64896,15 +64991,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64896
64991
  kind: "mutation",
64897
64992
  auth: "admin",
64898
64993
  access: "delete"
64899
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
64900
- kind: "mutation",
64901
- auth: "admin",
64902
- access: "create"
64903
- }), method(object({ id: string() }), object({ success: literal(true) }), {
64904
- kind: "mutation",
64905
- auth: "admin",
64906
- access: "delete"
64907
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
64994
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
64908
64995
  kind: "mutation",
64909
64996
  auth: "admin",
64910
64997
  access: "create"
@@ -70994,7 +71081,7 @@ Object.freeze({
70994
71081
  capName: "llm",
70995
71082
  capScope: "system",
70996
71083
  addonId: null,
70997
- access: "view"
71084
+ access: "create"
70998
71085
  },
70999
71086
  "llm.listNodeModels": {
71000
71087
  capName: "llm",
@@ -75658,12 +75745,6 @@ Object.freeze({
75658
75745
  addonId: null,
75659
75746
  access: "create"
75660
75747
  },
75661
- "userManagement.createScopedToken": {
75662
- capName: "user-management",
75663
- capScope: "system",
75664
- addonId: null,
75665
- access: "create"
75666
- },
75667
75748
  "userManagement.createUser": {
75668
75749
  capName: "user-management",
75669
75750
  capScope: "system",
@@ -75712,12 +75793,6 @@ Object.freeze({
75712
75793
  addonId: null,
75713
75794
  access: "view"
75714
75795
  },
75715
- "userManagement.listScopedTokens": {
75716
- capName: "user-management",
75717
- capScope: "system",
75718
- addonId: null,
75719
- access: "view"
75720
- },
75721
75796
  "userManagement.listUsers": {
75722
75797
  capName: "user-management",
75723
75798
  capScope: "system",
@@ -75772,12 +75847,6 @@ Object.freeze({
75772
75847
  addonId: null,
75773
75848
  access: "delete"
75774
75849
  },
75775
- "userManagement.revokeScopedToken": {
75776
- capName: "user-management",
75777
- capScope: "system",
75778
- addonId: null,
75779
- access: "delete"
75780
- },
75781
75850
  "userManagement.setupTotp": {
75782
75851
  capName: "user-management",
75783
75852
  capScope: "system",
@@ -75808,12 +75877,6 @@ Object.freeze({
75808
75877
  addonId: null,
75809
75878
  access: "view"
75810
75879
  },
75811
- "userManagement.validateScopedToken": {
75812
- capName: "user-management",
75813
- capScope: "system",
75814
- addonId: null,
75815
- access: "view"
75816
- },
75817
75880
  "userManagement.verifyTotp": {
75818
75881
  capName: "user-management",
75819
75882
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -6233,7 +6233,7 @@ var ZodIssueCode = {
6233
6233
  var ZodFirstPartyTypeKind;
6234
6234
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6235
6235
  //#endregion
6236
- //#region ../types/dist/sleep-BxjU_fJM.mjs
6236
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
6237
6237
  /**
6238
6238
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6239
6239
  * window to float samples (D455).
@@ -8616,9 +8616,9 @@ function normalizeAddonInitResult(result) {
8616
8616
  return result;
8617
8617
  }
8618
8618
  /**
8619
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
8620
- * and validates them (`share-token.service.ts` builds its enum from this
8621
- * list); a data plane names the kinds it ACCEPTS in `share`.
8619
+ * The share-view scope kinds a share-link token can carry. The hub mints
8620
+ * and validates them (`ShareViewGrantSchema` builds its
8621
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
8622
8622
  */
8623
8623
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
8624
8624
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -13308,7 +13308,7 @@ var ConvertResultSchema = object({
13308
13308
  * `super_admin` — collapsed onto the single boolean because every
13309
13309
  * non-admin caller is governed by the same scope-check rules; the
13310
13310
  * distinction was only ever used to route role-specific procedures
13311
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
13311
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
13312
13312
  * with `isAdmin: false` + an explicit scope list.
13313
13313
  */
13314
13314
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13497,10 +13497,12 @@ var AddonRoutesScopeSchema = object({
13497
13497
  type: literal("addon-routes"),
13498
13498
  access: array(MethodAccessSchema).min(1)
13499
13499
  });
13500
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13500
13501
  var CredentialScopeSchema = union([
13501
13502
  literal("*"),
13502
13503
  ShareViewScopeSchema,
13503
13504
  AddonRoutesScopeSchema,
13505
+ PreferencesSelfScopeSchema,
13504
13506
  TokenScopeSchema
13505
13507
  ]);
13506
13508
  object({
@@ -13509,6 +13511,55 @@ object({
13509
13511
  jti: string().min(16),
13510
13512
  scopes: array(CredentialScopeSchema).min(1)
13511
13513
  });
13514
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13515
+ /** A namespace's value: a JSON object, opaque to the hub. */
13516
+ var PreferenceValueSchema = record(string(), unknown());
13517
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13518
+ /** A stored row, as the owner reads it. */
13519
+ var PreferenceRowSchema = object({
13520
+ namespace: PreferenceNamespaceSchema,
13521
+ value: PreferenceValueSchema,
13522
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13523
+ revision: number().int().positive(),
13524
+ updatedAt: number().int(),
13525
+ /** The client id the last writer sent; `null` when it sent none. */
13526
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13527
+ });
13528
+ object({
13529
+ /** Absent: every namespace the caller holds. */
13530
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13531
+ object({ rows: array(PreferenceRowSchema) });
13532
+ object({
13533
+ namespace: PreferenceNamespaceSchema,
13534
+ value: PreferenceValueSchema,
13535
+ /**
13536
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13537
+ * namespace must not exist yet. Any other value that is not the current
13538
+ * revision answers `conflict` and writes nothing.
13539
+ */
13540
+ baseRevision: number().int().nonnegative().optional(),
13541
+ deviceId: PreferenceDeviceIdSchema.optional()
13542
+ });
13543
+ discriminatedUnion("status", [object({
13544
+ status: literal("saved"),
13545
+ row: PreferenceRowSchema
13546
+ }), object({
13547
+ status: literal("conflict"),
13548
+ current: PreferenceRowSchema.nullable()
13549
+ })]);
13550
+ object({ namespace: PreferenceNamespaceSchema });
13551
+ object({
13552
+ /** `false` when the namespace did not exist. */
13553
+ deleted: boolean() });
13554
+ object({
13555
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13556
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13557
+ object({
13558
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13559
+ rows: array(PreferenceRowSchema),
13560
+ /** Namespaces the client listed that no longer exist. */
13561
+ deleted: array(PreferenceNamespaceSchema)
13562
+ });
13512
13563
  _enum(["new-session", "step-up"]);
13513
13564
  /** The languages the hub's app landing pages are written in (D858). */
13514
13565
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40702,38 +40753,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40702
40753
  auth: "admin",
40703
40754
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40704
40755
  });
40756
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40757
+ /** What a model (or, by default, every model of a kind) can do. */
40758
+ var LlmModelFeaturesSchema = object({
40759
+ vision: boolean(),
40760
+ tools: boolean(),
40761
+ streaming: boolean()
40762
+ });
40763
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40764
+ var LlmModelInfoSchema = object({
40765
+ id: string(),
40766
+ label: string().optional(),
40767
+ contextLength: number().int().positive().optional(),
40768
+ features: LlmModelFeaturesSchema.partial().optional()
40769
+ });
40705
40770
  /**
40706
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40707
- * methods concat-fan across providers; single-row methods route to ONE
40708
- * provider by the `addonId` in the call input (the notification-output
40709
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40710
- * (hub-placed); the cap stays open for future providers.
40711
- *
40712
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40713
- * `apiKey` is a password field — providers REDACT it on read and merge on
40714
- * write; a stored key NEVER round-trips to a client.
40771
+ * The provider-specific part of a profile, validated by the provider that owns
40772
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40773
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40774
+ * keychain, never in the row, and reads back as the redaction marker.
40715
40775
  */
40716
- var LlmProfileKindSchema = _enum([
40717
- "openai-compatible",
40718
- "openai",
40719
- "anthropic",
40720
- "google",
40721
- "managed-local",
40722
- "apple-foundation"
40723
- ]);
40776
+ var LlmProviderConfigSchema = record(string(), unknown());
40724
40777
  var LlmProfileSchema = object({
40725
40778
  id: string(),
40726
40779
  name: string(),
40780
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40727
40781
  kind: LlmProfileKindSchema,
40728
40782
  /** Stamped by the provider — keeps the fanned catalog routable. */
40729
40783
  addonId: string(),
40730
40784
  enabled: boolean(),
40731
40785
  /** Vendor model id, or the managed runtime's loaded model. */
40732
40786
  model: string(),
40733
- /** Required for openai-compatible; override for cloud kinds. */
40734
- baseUrl: string().optional(),
40735
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40736
- apiKey: string().optional(),
40737
40787
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40738
40788
  * degraded to text — that shipped once and produced a confident answer to a
40739
40789
  * question about a picture nobody sent. */
@@ -40741,15 +40791,11 @@ var LlmProfileSchema = object({
40741
40791
  temperature: number().min(0).max(2).optional(),
40742
40792
  /** Nucleus sampling. Every wire we speak has it. */
40743
40793
  topP: number().min(0).max(1).optional(),
40744
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40745
- * wire does, and the client drops it there (measured: the request body gets
40746
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40747
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40794
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40795
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40748
40796
  topK: number().int().positive().optional(),
40749
40797
  maxTokens: number().int().positive().optional(),
40750
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40751
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40752
- * the model with, so it is the one field that changes a PROCESS. */
40798
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40753
40799
  contextLength: number().int().positive().optional(),
40754
40800
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40755
40801
  * two system prompts fighting is worse than either alone). */
@@ -40775,16 +40821,37 @@ var LlmProfileSchema = object({
40775
40821
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40776
40822
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40777
40823
  toolsEnabled: boolean().default(false),
40778
- extraHeaders: record(string(), string()).optional(),
40779
- /** kind === 'managed-local' only (spec §4). */
40780
- runtime: ManagedRuntimeConfigSchema.optional(),
40781
- /**
40782
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40783
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40784
- * `supportsVision` on such a row is stamped by the provider from the node's
40785
- * reported `imageInput`, never taken from the operator (D62).
40786
- */
40787
- appleFoundation: object({ nodeId: string() }).optional()
40824
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40825
+ providerConfig: LlmProviderConfigSchema.default({})
40826
+ });
40827
+ /**
40828
+ * The common profile fields a kind's editor offers. The editor owns how each
40829
+ * one is drawn; the provider says which of them mean something on its wire.
40830
+ */
40831
+ var LlmProfileFieldSchema = _enum([
40832
+ "temperature",
40833
+ "topP",
40834
+ "topK",
40835
+ "maxTokens",
40836
+ "contextLength",
40837
+ "systemPrompt",
40838
+ "timeoutMs",
40839
+ "connectTimeoutMs",
40840
+ "firstTokenTimeoutMs",
40841
+ "idleTimeoutMs",
40842
+ "retry",
40843
+ "toolsEnabled"
40844
+ ]);
40845
+ /**
40846
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40847
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40848
+ * picker: that widget owns the model choice.
40849
+ */
40850
+ var LlmProviderWidgetSchema = object({
40851
+ id: string(),
40852
+ placement: _enum(["connection", "model"]),
40853
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40854
+ requires: array(string()).optional()
40788
40855
  });
40789
40856
  /** ConfigUISchema tree passed through untyped on the wire (the
40790
40857
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40793,11 +40860,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40793
40860
  var LlmProfileKindDescriptorSchema = object({
40794
40861
  kind: LlmProfileKindSchema,
40795
40862
  label: string(),
40863
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40796
40864
  icon: string(),
40797
40865
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40798
40866
  addonId: string(),
40799
- configSchema: ConfigSchemaPassthrough$3
40867
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40868
+ connectionSchema: ConfigSchemaPassthrough$3,
40869
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40870
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40871
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40872
+ features: LlmModelFeaturesSchema,
40873
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40874
+ visionEditable: boolean(),
40875
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40876
+ modelCatalog: _enum([
40877
+ "fetch",
40878
+ "static",
40879
+ "none"
40880
+ ]),
40881
+ staticModels: array(LlmModelInfoSchema).optional(),
40882
+ /** The common fields that mean something on this kind's wire. */
40883
+ profileFields: array(LlmProfileFieldSchema),
40884
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40800
40885
  });
40886
+ /**
40887
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40888
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40889
+ * untouched (absent or the redaction marker) is resolved server-side from the
40890
+ * stored profile — the browser never receives it.
40891
+ */
40892
+ var LlmListModelsInputSchema = object({
40893
+ addonId: string(),
40894
+ kind: LlmProfileKindSchema,
40895
+ profileId: string().optional(),
40896
+ connection: LlmProviderConfigSchema.optional()
40897
+ });
40898
+ var LlmListModelsErrorCodeSchema = _enum([
40899
+ "auth",
40900
+ "network",
40901
+ "unsupported",
40902
+ "invalid"
40903
+ ]);
40904
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40905
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40906
+ ok: literal(true),
40907
+ models: array(LlmModelInfoSchema)
40908
+ }), object({
40909
+ ok: literal(false),
40910
+ code: LlmListModelsErrorCodeSchema,
40911
+ message: string()
40912
+ })]);
40801
40913
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40802
40914
  var LlmDefaultSchema = object({
40803
40915
  selector: LlmDefaultSelectorSchema,
@@ -40897,7 +41009,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40897
41009
  kind: "mutation",
40898
41010
  auth: "admin",
40899
41011
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40900
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
41012
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
41013
+ kind: "mutation",
41014
+ auth: "admin"
41015
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40901
41016
  selector: LlmDefaultSelectorSchema,
40902
41017
  profileId: string().nullable()
40903
41018
  }), _void(), {
@@ -64793,26 +64908,6 @@ var ApiKeySummarySchema = object({
64793
64908
  createdAt: number(),
64794
64909
  lastUsedAt: number().optional()
64795
64910
  });
64796
- var ScopedTokenSummarySchema = object({
64797
- id: string(),
64798
- userId: string(),
64799
- name: string(),
64800
- tokenPrefix: string(),
64801
- scopes: array(TokenScopeSchema),
64802
- expiresAt: number().nullish(),
64803
- lastUsedAt: number().nullish(),
64804
- createdAt: number()
64805
- });
64806
- var CreateScopedTokenInputSchema = object({
64807
- userId: string(),
64808
- name: string(),
64809
- scopes: array(TokenScopeSchema),
64810
- expiresAt: number().optional()
64811
- });
64812
- var CreateScopedTokenResultSchema = object({
64813
- token: string(),
64814
- record: ScopedTokenSummarySchema
64815
- });
64816
64911
  var OauthSessionSummarySchema = object({
64817
64912
  id: string(),
64818
64913
  userId: string(),
@@ -64834,11 +64929,11 @@ var TotpStatusSchema = object({
64834
64929
  confirmedAt: number().nullable()
64835
64930
  });
64836
64931
  /**
64837
- * user-management — singleton capability for user accounts, API keys,
64838
- * and scoped tokens.
64932
+ * user-management — singleton capability for user accounts and the
64933
+ * legacy API-key rows.
64839
64934
  *
64840
64935
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
64841
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
64936
+ * — the subset check on `setUserScopes` is moot
64842
64937
  * because non-admins never reach these. If/when we open non-admin
64843
64938
  * delegation, structural caller-scope subset check goes inside the
64844
64939
  * provider.
@@ -64895,15 +64990,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64895
64990
  kind: "mutation",
64896
64991
  auth: "admin",
64897
64992
  access: "delete"
64898
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
64899
- kind: "mutation",
64900
- auth: "admin",
64901
- access: "create"
64902
- }), method(object({ id: string() }), object({ success: literal(true) }), {
64903
- kind: "mutation",
64904
- auth: "admin",
64905
- access: "delete"
64906
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
64993
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
64907
64994
  kind: "mutation",
64908
64995
  auth: "admin",
64909
64996
  access: "create"
@@ -70993,7 +71080,7 @@ Object.freeze({
70993
71080
  capName: "llm",
70994
71081
  capScope: "system",
70995
71082
  addonId: null,
70996
- access: "view"
71083
+ access: "create"
70997
71084
  },
70998
71085
  "llm.listNodeModels": {
70999
71086
  capName: "llm",
@@ -75657,12 +75744,6 @@ Object.freeze({
75657
75744
  addonId: null,
75658
75745
  access: "create"
75659
75746
  },
75660
- "userManagement.createScopedToken": {
75661
- capName: "user-management",
75662
- capScope: "system",
75663
- addonId: null,
75664
- access: "create"
75665
- },
75666
75747
  "userManagement.createUser": {
75667
75748
  capName: "user-management",
75668
75749
  capScope: "system",
@@ -75711,12 +75792,6 @@ Object.freeze({
75711
75792
  addonId: null,
75712
75793
  access: "view"
75713
75794
  },
75714
- "userManagement.listScopedTokens": {
75715
- capName: "user-management",
75716
- capScope: "system",
75717
- addonId: null,
75718
- access: "view"
75719
- },
75720
75795
  "userManagement.listUsers": {
75721
75796
  capName: "user-management",
75722
75797
  capScope: "system",
@@ -75771,12 +75846,6 @@ Object.freeze({
75771
75846
  addonId: null,
75772
75847
  access: "delete"
75773
75848
  },
75774
- "userManagement.revokeScopedToken": {
75775
- capName: "user-management",
75776
- capScope: "system",
75777
- addonId: null,
75778
- access: "delete"
75779
- },
75780
75849
  "userManagement.setupTotp": {
75781
75850
  capName: "user-management",
75782
75851
  capScope: "system",
@@ -75807,12 +75876,6 @@ Object.freeze({
75807
75876
  addonId: null,
75808
75877
  access: "view"
75809
75878
  },
75810
- "userManagement.validateScopedToken": {
75811
- capName: "user-management",
75812
- capScope: "system",
75813
- addonId: null,
75814
- access: "view"
75815
- },
75816
75879
  "userManagement.verifyTotp": {
75817
75880
  capName: "user-management",
75818
75881
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-tuya",
3
- "version": "0.2.129",
3
+ "version": "0.2.130",
4
4
  "description": "Tuya / Smart Life device-provider addon for CamStack — account-onboarded (Tuya IoT cloud fetch of device localKeys) + LOCAL DP control via the @apocaliss92/nodetuya encrypted-LAN client, exposing switch / water-heater-family kettle entities",
5
5
  "keywords": [
6
6
  "camstack",