@camstack/addon-provider-dreame 0.2.137 → 0.2.138

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
@@ -5459,7 +5459,7 @@ var ZodIssueCode$1 = {
5459
5459
  var ZodFirstPartyTypeKind$1;
5460
5460
  ZodFirstPartyTypeKind$1 || (ZodFirstPartyTypeKind$1 = {});
5461
5461
  //#endregion
5462
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5462
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5463
5463
  /**
5464
5464
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5465
5465
  * window to float samples (D455).
@@ -7842,9 +7842,9 @@ function normalizeAddonInitResult(result) {
7842
7842
  return result;
7843
7843
  }
7844
7844
  /**
7845
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7846
- * and validates them (`share-token.service.ts` builds its enum from this
7847
- * list); a data plane names the kinds it ACCEPTS in `share`.
7845
+ * The share-view scope kinds a share-link token can carry. The hub mints
7846
+ * and validates them (`ShareViewGrantSchema` builds its
7847
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7848
7848
  */
7849
7849
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7850
7850
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12548,7 +12548,7 @@ var ConvertResultSchema = object({
12548
12548
  * `super_admin` — collapsed onto the single boolean because every
12549
12549
  * non-admin caller is governed by the same scope-check rules; the
12550
12550
  * distinction was only ever used to route role-specific procedures
12551
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12551
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12552
12552
  * with `isAdmin: false` + an explicit scope list.
12553
12553
  */
12554
12554
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -12737,10 +12737,12 @@ var AddonRoutesScopeSchema = object({
12737
12737
  type: literal("addon-routes"),
12738
12738
  access: array(MethodAccessSchema).min(1)
12739
12739
  });
12740
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
12740
12741
  var CredentialScopeSchema = union([
12741
12742
  literal("*"),
12742
12743
  ShareViewScopeSchema,
12743
12744
  AddonRoutesScopeSchema,
12745
+ PreferencesSelfScopeSchema,
12744
12746
  TokenScopeSchema
12745
12747
  ]);
12746
12748
  object({
@@ -12749,6 +12751,55 @@ object({
12749
12751
  jti: string().min(16),
12750
12752
  scopes: array(CredentialScopeSchema).min(1)
12751
12753
  });
12754
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
12755
+ /** A namespace's value: a JSON object, opaque to the hub. */
12756
+ var PreferenceValueSchema = record(string(), unknown());
12757
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
12758
+ /** A stored row, as the owner reads it. */
12759
+ var PreferenceRowSchema = object({
12760
+ namespace: PreferenceNamespaceSchema,
12761
+ value: PreferenceValueSchema,
12762
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
12763
+ revision: number().int().positive(),
12764
+ updatedAt: number().int(),
12765
+ /** The client id the last writer sent; `null` when it sent none. */
12766
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
12767
+ });
12768
+ object({
12769
+ /** Absent: every namespace the caller holds. */
12770
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
12771
+ object({ rows: array(PreferenceRowSchema) });
12772
+ object({
12773
+ namespace: PreferenceNamespaceSchema,
12774
+ value: PreferenceValueSchema,
12775
+ /**
12776
+ * The revision the edit was based on. Absent: last write wins. `0`: the
12777
+ * namespace must not exist yet. Any other value that is not the current
12778
+ * revision answers `conflict` and writes nothing.
12779
+ */
12780
+ baseRevision: number().int().nonnegative().optional(),
12781
+ deviceId: PreferenceDeviceIdSchema.optional()
12782
+ });
12783
+ discriminatedUnion("status", [object({
12784
+ status: literal("saved"),
12785
+ row: PreferenceRowSchema
12786
+ }), object({
12787
+ status: literal("conflict"),
12788
+ current: PreferenceRowSchema.nullable()
12789
+ })]);
12790
+ object({ namespace: PreferenceNamespaceSchema });
12791
+ object({
12792
+ /** `false` when the namespace did not exist. */
12793
+ deleted: boolean() });
12794
+ object({
12795
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
12796
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
12797
+ object({
12798
+ /** Every row whose revision differs from the client's, and every row it did not list. */
12799
+ rows: array(PreferenceRowSchema),
12800
+ /** Namespaces the client listed that no longer exist. */
12801
+ deleted: array(PreferenceNamespaceSchema)
12802
+ });
12752
12803
  _enum(["new-session", "step-up"]);
12753
12804
  /** The languages the hub's app landing pages are written in (D858). */
12754
12805
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -39954,38 +40005,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
39954
40005
  auth: "admin",
39955
40006
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39956
40007
  });
40008
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40009
+ /** What a model (or, by default, every model of a kind) can do. */
40010
+ var LlmModelFeaturesSchema = object({
40011
+ vision: boolean(),
40012
+ tools: boolean(),
40013
+ streaming: boolean()
40014
+ });
40015
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40016
+ var LlmModelInfoSchema = object({
40017
+ id: string(),
40018
+ label: string().optional(),
40019
+ contextLength: number().int().positive().optional(),
40020
+ features: LlmModelFeaturesSchema.partial().optional()
40021
+ });
39957
40022
  /**
39958
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
39959
- * methods concat-fan across providers; single-row methods route to ONE
39960
- * provider by the `addonId` in the call input (the notification-output
39961
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
39962
- * (hub-placed); the cap stays open for future providers.
39963
- *
39964
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
39965
- * `apiKey` is a password field — providers REDACT it on read and merge on
39966
- * write; a stored key NEVER round-trips to a client.
40023
+ * The provider-specific part of a profile, validated by the provider that owns
40024
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40025
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40026
+ * keychain, never in the row, and reads back as the redaction marker.
39967
40027
  */
39968
- var LlmProfileKindSchema = _enum([
39969
- "openai-compatible",
39970
- "openai",
39971
- "anthropic",
39972
- "google",
39973
- "managed-local",
39974
- "apple-foundation"
39975
- ]);
40028
+ var LlmProviderConfigSchema = record(string(), unknown());
39976
40029
  var LlmProfileSchema = object({
39977
40030
  id: string(),
39978
40031
  name: string(),
40032
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
39979
40033
  kind: LlmProfileKindSchema,
39980
40034
  /** Stamped by the provider — keeps the fanned catalog routable. */
39981
40035
  addonId: string(),
39982
40036
  enabled: boolean(),
39983
40037
  /** Vendor model id, or the managed runtime's loaded model. */
39984
40038
  model: string(),
39985
- /** Required for openai-compatible; override for cloud kinds. */
39986
- baseUrl: string().optional(),
39987
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
39988
- apiKey: string().optional(),
39989
40039
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
39990
40040
  * degraded to text — that shipped once and produced a confident answer to a
39991
40041
  * question about a picture nobody sent. */
@@ -39993,15 +40043,11 @@ var LlmProfileSchema = object({
39993
40043
  temperature: number().min(0).max(2).optional(),
39994
40044
  /** Nucleus sampling. Every wire we speak has it. */
39995
40045
  topP: number().min(0).max(1).optional(),
39996
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
39997
- * wire does, and the client drops it there (measured: the request body gets
39998
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
39999
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40046
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40047
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40000
40048
  topK: number().int().positive().optional(),
40001
40049
  maxTokens: number().int().positive().optional(),
40002
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40003
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40004
- * the model with, so it is the one field that changes a PROCESS. */
40050
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40005
40051
  contextLength: number().int().positive().optional(),
40006
40052
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40007
40053
  * two system prompts fighting is worse than either alone). */
@@ -40027,16 +40073,37 @@ var LlmProfileSchema = object({
40027
40073
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40028
40074
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40029
40075
  toolsEnabled: boolean().default(false),
40030
- extraHeaders: record(string(), string()).optional(),
40031
- /** kind === 'managed-local' only (spec §4). */
40032
- runtime: ManagedRuntimeConfigSchema.optional(),
40033
- /**
40034
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40035
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40036
- * `supportsVision` on such a row is stamped by the provider from the node's
40037
- * reported `imageInput`, never taken from the operator (D62).
40038
- */
40039
- appleFoundation: object({ nodeId: string() }).optional()
40076
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40077
+ providerConfig: LlmProviderConfigSchema.default({})
40078
+ });
40079
+ /**
40080
+ * The common profile fields a kind's editor offers. The editor owns how each
40081
+ * one is drawn; the provider says which of them mean something on its wire.
40082
+ */
40083
+ var LlmProfileFieldSchema = _enum([
40084
+ "temperature",
40085
+ "topP",
40086
+ "topK",
40087
+ "maxTokens",
40088
+ "contextLength",
40089
+ "systemPrompt",
40090
+ "timeoutMs",
40091
+ "connectTimeoutMs",
40092
+ "firstTokenTimeoutMs",
40093
+ "idleTimeoutMs",
40094
+ "retry",
40095
+ "toolsEnabled"
40096
+ ]);
40097
+ /**
40098
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40099
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40100
+ * picker: that widget owns the model choice.
40101
+ */
40102
+ var LlmProviderWidgetSchema = object({
40103
+ id: string(),
40104
+ placement: _enum(["connection", "model"]),
40105
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40106
+ requires: array(string()).optional()
40040
40107
  });
40041
40108
  /** ConfigUISchema tree passed through untyped on the wire (the
40042
40109
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40045,11 +40112,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40045
40112
  var LlmProfileKindDescriptorSchema = object({
40046
40113
  kind: LlmProfileKindSchema,
40047
40114
  label: string(),
40115
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40048
40116
  icon: string(),
40049
40117
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40050
40118
  addonId: string(),
40051
- configSchema: ConfigSchemaPassthrough$3
40119
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40120
+ connectionSchema: ConfigSchemaPassthrough$3,
40121
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40122
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40123
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40124
+ features: LlmModelFeaturesSchema,
40125
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40126
+ visionEditable: boolean(),
40127
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40128
+ modelCatalog: _enum([
40129
+ "fetch",
40130
+ "static",
40131
+ "none"
40132
+ ]),
40133
+ staticModels: array(LlmModelInfoSchema).optional(),
40134
+ /** The common fields that mean something on this kind's wire. */
40135
+ profileFields: array(LlmProfileFieldSchema),
40136
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40052
40137
  });
40138
+ /**
40139
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40140
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40141
+ * untouched (absent or the redaction marker) is resolved server-side from the
40142
+ * stored profile — the browser never receives it.
40143
+ */
40144
+ var LlmListModelsInputSchema = object({
40145
+ addonId: string(),
40146
+ kind: LlmProfileKindSchema,
40147
+ profileId: string().optional(),
40148
+ connection: LlmProviderConfigSchema.optional()
40149
+ });
40150
+ var LlmListModelsErrorCodeSchema = _enum([
40151
+ "auth",
40152
+ "network",
40153
+ "unsupported",
40154
+ "invalid"
40155
+ ]);
40156
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40157
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40158
+ ok: literal(true),
40159
+ models: array(LlmModelInfoSchema)
40160
+ }), object({
40161
+ ok: literal(false),
40162
+ code: LlmListModelsErrorCodeSchema,
40163
+ message: string()
40164
+ })]);
40053
40165
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40054
40166
  var LlmDefaultSchema = object({
40055
40167
  selector: LlmDefaultSelectorSchema,
@@ -40149,7 +40261,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40149
40261
  kind: "mutation",
40150
40262
  auth: "admin",
40151
40263
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40152
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40264
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40265
+ kind: "mutation",
40266
+ auth: "admin"
40267
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40153
40268
  selector: LlmDefaultSelectorSchema,
40154
40269
  profileId: string().nullable()
40155
40270
  }), _void(), {
@@ -64210,26 +64325,6 @@ var ApiKeySummarySchema = object({
64210
64325
  createdAt: number(),
64211
64326
  lastUsedAt: number().optional()
64212
64327
  });
64213
- var ScopedTokenSummarySchema = object({
64214
- id: string(),
64215
- userId: string(),
64216
- name: string(),
64217
- tokenPrefix: string(),
64218
- scopes: array(TokenScopeSchema),
64219
- expiresAt: number().nullish(),
64220
- lastUsedAt: number().nullish(),
64221
- createdAt: number()
64222
- });
64223
- var CreateScopedTokenInputSchema = object({
64224
- userId: string(),
64225
- name: string(),
64226
- scopes: array(TokenScopeSchema),
64227
- expiresAt: number().optional()
64228
- });
64229
- var CreateScopedTokenResultSchema = object({
64230
- token: string(),
64231
- record: ScopedTokenSummarySchema
64232
- });
64233
64328
  var OauthSessionSummarySchema = object({
64234
64329
  id: string(),
64235
64330
  userId: string(),
@@ -64251,11 +64346,11 @@ var TotpStatusSchema = object({
64251
64346
  confirmedAt: number().nullable()
64252
64347
  });
64253
64348
  /**
64254
- * user-management — singleton capability for user accounts, API keys,
64255
- * and scoped tokens.
64349
+ * user-management — singleton capability for user accounts and the
64350
+ * legacy API-key rows.
64256
64351
  *
64257
64352
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
64258
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
64353
+ * — the subset check on `setUserScopes` is moot
64259
64354
  * because non-admins never reach these. If/when we open non-admin
64260
64355
  * delegation, structural caller-scope subset check goes inside the
64261
64356
  * provider.
@@ -64312,15 +64407,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64312
64407
  kind: "mutation",
64313
64408
  auth: "admin",
64314
64409
  access: "delete"
64315
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
64316
- kind: "mutation",
64317
- auth: "admin",
64318
- access: "create"
64319
- }), method(object({ id: string() }), object({ success: literal(true) }), {
64320
- kind: "mutation",
64321
- auth: "admin",
64322
- access: "delete"
64323
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
64410
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
64324
64411
  kind: "mutation",
64325
64412
  auth: "admin",
64326
64413
  access: "create"
@@ -70410,7 +70497,7 @@ Object.freeze({
70410
70497
  capName: "llm",
70411
70498
  capScope: "system",
70412
70499
  addonId: null,
70413
- access: "view"
70500
+ access: "create"
70414
70501
  },
70415
70502
  "llm.listNodeModels": {
70416
70503
  capName: "llm",
@@ -75074,12 +75161,6 @@ Object.freeze({
75074
75161
  addonId: null,
75075
75162
  access: "create"
75076
75163
  },
75077
- "userManagement.createScopedToken": {
75078
- capName: "user-management",
75079
- capScope: "system",
75080
- addonId: null,
75081
- access: "create"
75082
- },
75083
75164
  "userManagement.createUser": {
75084
75165
  capName: "user-management",
75085
75166
  capScope: "system",
@@ -75128,12 +75209,6 @@ Object.freeze({
75128
75209
  addonId: null,
75129
75210
  access: "view"
75130
75211
  },
75131
- "userManagement.listScopedTokens": {
75132
- capName: "user-management",
75133
- capScope: "system",
75134
- addonId: null,
75135
- access: "view"
75136
- },
75137
75212
  "userManagement.listUsers": {
75138
75213
  capName: "user-management",
75139
75214
  capScope: "system",
@@ -75188,12 +75263,6 @@ Object.freeze({
75188
75263
  addonId: null,
75189
75264
  access: "delete"
75190
75265
  },
75191
- "userManagement.revokeScopedToken": {
75192
- capName: "user-management",
75193
- capScope: "system",
75194
- addonId: null,
75195
- access: "delete"
75196
- },
75197
75266
  "userManagement.setupTotp": {
75198
75267
  capName: "user-management",
75199
75268
  capScope: "system",
@@ -75224,12 +75293,6 @@ Object.freeze({
75224
75293
  addonId: null,
75225
75294
  access: "view"
75226
75295
  },
75227
- "userManagement.validateScopedToken": {
75228
- capName: "user-management",
75229
- capScope: "system",
75230
- addonId: null,
75231
- access: "view"
75232
- },
75233
75296
  "userManagement.verifyTotp": {
75234
75297
  capName: "user-management",
75235
75298
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -5456,7 +5456,7 @@ var ZodIssueCode$1 = {
5456
5456
  var ZodFirstPartyTypeKind$1;
5457
5457
  ZodFirstPartyTypeKind$1 || (ZodFirstPartyTypeKind$1 = {});
5458
5458
  //#endregion
5459
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5459
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5460
5460
  /**
5461
5461
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5462
5462
  * window to float samples (D455).
@@ -7839,9 +7839,9 @@ function normalizeAddonInitResult(result) {
7839
7839
  return result;
7840
7840
  }
7841
7841
  /**
7842
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7843
- * and validates them (`share-token.service.ts` builds its enum from this
7844
- * list); a data plane names the kinds it ACCEPTS in `share`.
7842
+ * The share-view scope kinds a share-link token can carry. The hub mints
7843
+ * and validates them (`ShareViewGrantSchema` builds its
7844
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7845
7845
  */
7846
7846
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7847
7847
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12545,7 +12545,7 @@ var ConvertResultSchema = object({
12545
12545
  * `super_admin` — collapsed onto the single boolean because every
12546
12546
  * non-admin caller is governed by the same scope-check rules; the
12547
12547
  * distinction was only ever used to route role-specific procedures
12548
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12548
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12549
12549
  * with `isAdmin: false` + an explicit scope list.
12550
12550
  */
12551
12551
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -12734,10 +12734,12 @@ var AddonRoutesScopeSchema = object({
12734
12734
  type: literal("addon-routes"),
12735
12735
  access: array(MethodAccessSchema).min(1)
12736
12736
  });
12737
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
12737
12738
  var CredentialScopeSchema = union([
12738
12739
  literal("*"),
12739
12740
  ShareViewScopeSchema,
12740
12741
  AddonRoutesScopeSchema,
12742
+ PreferencesSelfScopeSchema,
12741
12743
  TokenScopeSchema
12742
12744
  ]);
12743
12745
  object({
@@ -12746,6 +12748,55 @@ object({
12746
12748
  jti: string().min(16),
12747
12749
  scopes: array(CredentialScopeSchema).min(1)
12748
12750
  });
12751
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
12752
+ /** A namespace's value: a JSON object, opaque to the hub. */
12753
+ var PreferenceValueSchema = record(string(), unknown());
12754
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
12755
+ /** A stored row, as the owner reads it. */
12756
+ var PreferenceRowSchema = object({
12757
+ namespace: PreferenceNamespaceSchema,
12758
+ value: PreferenceValueSchema,
12759
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
12760
+ revision: number().int().positive(),
12761
+ updatedAt: number().int(),
12762
+ /** The client id the last writer sent; `null` when it sent none. */
12763
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
12764
+ });
12765
+ object({
12766
+ /** Absent: every namespace the caller holds. */
12767
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
12768
+ object({ rows: array(PreferenceRowSchema) });
12769
+ object({
12770
+ namespace: PreferenceNamespaceSchema,
12771
+ value: PreferenceValueSchema,
12772
+ /**
12773
+ * The revision the edit was based on. Absent: last write wins. `0`: the
12774
+ * namespace must not exist yet. Any other value that is not the current
12775
+ * revision answers `conflict` and writes nothing.
12776
+ */
12777
+ baseRevision: number().int().nonnegative().optional(),
12778
+ deviceId: PreferenceDeviceIdSchema.optional()
12779
+ });
12780
+ discriminatedUnion("status", [object({
12781
+ status: literal("saved"),
12782
+ row: PreferenceRowSchema
12783
+ }), object({
12784
+ status: literal("conflict"),
12785
+ current: PreferenceRowSchema.nullable()
12786
+ })]);
12787
+ object({ namespace: PreferenceNamespaceSchema });
12788
+ object({
12789
+ /** `false` when the namespace did not exist. */
12790
+ deleted: boolean() });
12791
+ object({
12792
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
12793
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
12794
+ object({
12795
+ /** Every row whose revision differs from the client's, and every row it did not list. */
12796
+ rows: array(PreferenceRowSchema),
12797
+ /** Namespaces the client listed that no longer exist. */
12798
+ deleted: array(PreferenceNamespaceSchema)
12799
+ });
12749
12800
  _enum(["new-session", "step-up"]);
12750
12801
  /** The languages the hub's app landing pages are written in (D858). */
12751
12802
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -39951,38 +40002,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
39951
40002
  auth: "admin",
39952
40003
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39953
40004
  });
40005
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40006
+ /** What a model (or, by default, every model of a kind) can do. */
40007
+ var LlmModelFeaturesSchema = object({
40008
+ vision: boolean(),
40009
+ tools: boolean(),
40010
+ streaming: boolean()
40011
+ });
40012
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40013
+ var LlmModelInfoSchema = object({
40014
+ id: string(),
40015
+ label: string().optional(),
40016
+ contextLength: number().int().positive().optional(),
40017
+ features: LlmModelFeaturesSchema.partial().optional()
40018
+ });
39954
40019
  /**
39955
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
39956
- * methods concat-fan across providers; single-row methods route to ONE
39957
- * provider by the `addonId` in the call input (the notification-output
39958
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
39959
- * (hub-placed); the cap stays open for future providers.
39960
- *
39961
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
39962
- * `apiKey` is a password field — providers REDACT it on read and merge on
39963
- * write; a stored key NEVER round-trips to a client.
40020
+ * The provider-specific part of a profile, validated by the provider that owns
40021
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40022
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40023
+ * keychain, never in the row, and reads back as the redaction marker.
39964
40024
  */
39965
- var LlmProfileKindSchema = _enum([
39966
- "openai-compatible",
39967
- "openai",
39968
- "anthropic",
39969
- "google",
39970
- "managed-local",
39971
- "apple-foundation"
39972
- ]);
40025
+ var LlmProviderConfigSchema = record(string(), unknown());
39973
40026
  var LlmProfileSchema = object({
39974
40027
  id: string(),
39975
40028
  name: string(),
40029
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
39976
40030
  kind: LlmProfileKindSchema,
39977
40031
  /** Stamped by the provider — keeps the fanned catalog routable. */
39978
40032
  addonId: string(),
39979
40033
  enabled: boolean(),
39980
40034
  /** Vendor model id, or the managed runtime's loaded model. */
39981
40035
  model: string(),
39982
- /** Required for openai-compatible; override for cloud kinds. */
39983
- baseUrl: string().optional(),
39984
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
39985
- apiKey: string().optional(),
39986
40036
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
39987
40037
  * degraded to text — that shipped once and produced a confident answer to a
39988
40038
  * question about a picture nobody sent. */
@@ -39990,15 +40040,11 @@ var LlmProfileSchema = object({
39990
40040
  temperature: number().min(0).max(2).optional(),
39991
40041
  /** Nucleus sampling. Every wire we speak has it. */
39992
40042
  topP: number().min(0).max(1).optional(),
39993
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
39994
- * wire does, and the client drops it there (measured: the request body gets
39995
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
39996
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40043
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40044
+ * field in its editor only when its descriptor lists it in `profileFields`. */
39997
40045
  topK: number().int().positive().optional(),
39998
40046
  maxTokens: number().int().positive().optional(),
39999
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40000
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40001
- * the model with, so it is the one field that changes a PROCESS. */
40047
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40002
40048
  contextLength: number().int().positive().optional(),
40003
40049
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40004
40050
  * two system prompts fighting is worse than either alone). */
@@ -40024,16 +40070,37 @@ var LlmProfileSchema = object({
40024
40070
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40025
40071
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40026
40072
  toolsEnabled: boolean().default(false),
40027
- extraHeaders: record(string(), string()).optional(),
40028
- /** kind === 'managed-local' only (spec §4). */
40029
- runtime: ManagedRuntimeConfigSchema.optional(),
40030
- /**
40031
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40032
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40033
- * `supportsVision` on such a row is stamped by the provider from the node's
40034
- * reported `imageInput`, never taken from the operator (D62).
40035
- */
40036
- appleFoundation: object({ nodeId: string() }).optional()
40073
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40074
+ providerConfig: LlmProviderConfigSchema.default({})
40075
+ });
40076
+ /**
40077
+ * The common profile fields a kind's editor offers. The editor owns how each
40078
+ * one is drawn; the provider says which of them mean something on its wire.
40079
+ */
40080
+ var LlmProfileFieldSchema = _enum([
40081
+ "temperature",
40082
+ "topP",
40083
+ "topK",
40084
+ "maxTokens",
40085
+ "contextLength",
40086
+ "systemPrompt",
40087
+ "timeoutMs",
40088
+ "connectTimeoutMs",
40089
+ "firstTokenTimeoutMs",
40090
+ "idleTimeoutMs",
40091
+ "retry",
40092
+ "toolsEnabled"
40093
+ ]);
40094
+ /**
40095
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40096
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40097
+ * picker: that widget owns the model choice.
40098
+ */
40099
+ var LlmProviderWidgetSchema = object({
40100
+ id: string(),
40101
+ placement: _enum(["connection", "model"]),
40102
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40103
+ requires: array(string()).optional()
40037
40104
  });
40038
40105
  /** ConfigUISchema tree passed through untyped on the wire (the
40039
40106
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40042,11 +40109,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40042
40109
  var LlmProfileKindDescriptorSchema = object({
40043
40110
  kind: LlmProfileKindSchema,
40044
40111
  label: string(),
40112
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40045
40113
  icon: string(),
40046
40114
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40047
40115
  addonId: string(),
40048
- configSchema: ConfigSchemaPassthrough$3
40116
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40117
+ connectionSchema: ConfigSchemaPassthrough$3,
40118
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40119
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40120
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40121
+ features: LlmModelFeaturesSchema,
40122
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40123
+ visionEditable: boolean(),
40124
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40125
+ modelCatalog: _enum([
40126
+ "fetch",
40127
+ "static",
40128
+ "none"
40129
+ ]),
40130
+ staticModels: array(LlmModelInfoSchema).optional(),
40131
+ /** The common fields that mean something on this kind's wire. */
40132
+ profileFields: array(LlmProfileFieldSchema),
40133
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40049
40134
  });
40135
+ /**
40136
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40137
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40138
+ * untouched (absent or the redaction marker) is resolved server-side from the
40139
+ * stored profile — the browser never receives it.
40140
+ */
40141
+ var LlmListModelsInputSchema = object({
40142
+ addonId: string(),
40143
+ kind: LlmProfileKindSchema,
40144
+ profileId: string().optional(),
40145
+ connection: LlmProviderConfigSchema.optional()
40146
+ });
40147
+ var LlmListModelsErrorCodeSchema = _enum([
40148
+ "auth",
40149
+ "network",
40150
+ "unsupported",
40151
+ "invalid"
40152
+ ]);
40153
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40154
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40155
+ ok: literal(true),
40156
+ models: array(LlmModelInfoSchema)
40157
+ }), object({
40158
+ ok: literal(false),
40159
+ code: LlmListModelsErrorCodeSchema,
40160
+ message: string()
40161
+ })]);
40050
40162
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40051
40163
  var LlmDefaultSchema = object({
40052
40164
  selector: LlmDefaultSelectorSchema,
@@ -40146,7 +40258,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40146
40258
  kind: "mutation",
40147
40259
  auth: "admin",
40148
40260
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40149
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40261
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40262
+ kind: "mutation",
40263
+ auth: "admin"
40264
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40150
40265
  selector: LlmDefaultSelectorSchema,
40151
40266
  profileId: string().nullable()
40152
40267
  }), _void(), {
@@ -64207,26 +64322,6 @@ var ApiKeySummarySchema = object({
64207
64322
  createdAt: number(),
64208
64323
  lastUsedAt: number().optional()
64209
64324
  });
64210
- var ScopedTokenSummarySchema = object({
64211
- id: string(),
64212
- userId: string(),
64213
- name: string(),
64214
- tokenPrefix: string(),
64215
- scopes: array(TokenScopeSchema),
64216
- expiresAt: number().nullish(),
64217
- lastUsedAt: number().nullish(),
64218
- createdAt: number()
64219
- });
64220
- var CreateScopedTokenInputSchema = object({
64221
- userId: string(),
64222
- name: string(),
64223
- scopes: array(TokenScopeSchema),
64224
- expiresAt: number().optional()
64225
- });
64226
- var CreateScopedTokenResultSchema = object({
64227
- token: string(),
64228
- record: ScopedTokenSummarySchema
64229
- });
64230
64325
  var OauthSessionSummarySchema = object({
64231
64326
  id: string(),
64232
64327
  userId: string(),
@@ -64248,11 +64343,11 @@ var TotpStatusSchema = object({
64248
64343
  confirmedAt: number().nullable()
64249
64344
  });
64250
64345
  /**
64251
- * user-management — singleton capability for user accounts, API keys,
64252
- * and scoped tokens.
64346
+ * user-management — singleton capability for user accounts and the
64347
+ * legacy API-key rows.
64253
64348
  *
64254
64349
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
64255
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
64350
+ * — the subset check on `setUserScopes` is moot
64256
64351
  * because non-admins never reach these. If/when we open non-admin
64257
64352
  * delegation, structural caller-scope subset check goes inside the
64258
64353
  * provider.
@@ -64309,15 +64404,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64309
64404
  kind: "mutation",
64310
64405
  auth: "admin",
64311
64406
  access: "delete"
64312
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
64313
- kind: "mutation",
64314
- auth: "admin",
64315
- access: "create"
64316
- }), method(object({ id: string() }), object({ success: literal(true) }), {
64317
- kind: "mutation",
64318
- auth: "admin",
64319
- access: "delete"
64320
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
64407
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
64321
64408
  kind: "mutation",
64322
64409
  auth: "admin",
64323
64410
  access: "create"
@@ -70407,7 +70494,7 @@ Object.freeze({
70407
70494
  capName: "llm",
70408
70495
  capScope: "system",
70409
70496
  addonId: null,
70410
- access: "view"
70497
+ access: "create"
70411
70498
  },
70412
70499
  "llm.listNodeModels": {
70413
70500
  capName: "llm",
@@ -75071,12 +75158,6 @@ Object.freeze({
75071
75158
  addonId: null,
75072
75159
  access: "create"
75073
75160
  },
75074
- "userManagement.createScopedToken": {
75075
- capName: "user-management",
75076
- capScope: "system",
75077
- addonId: null,
75078
- access: "create"
75079
- },
75080
75161
  "userManagement.createUser": {
75081
75162
  capName: "user-management",
75082
75163
  capScope: "system",
@@ -75125,12 +75206,6 @@ Object.freeze({
75125
75206
  addonId: null,
75126
75207
  access: "view"
75127
75208
  },
75128
- "userManagement.listScopedTokens": {
75129
- capName: "user-management",
75130
- capScope: "system",
75131
- addonId: null,
75132
- access: "view"
75133
- },
75134
75209
  "userManagement.listUsers": {
75135
75210
  capName: "user-management",
75136
75211
  capScope: "system",
@@ -75185,12 +75260,6 @@ Object.freeze({
75185
75260
  addonId: null,
75186
75261
  access: "delete"
75187
75262
  },
75188
- "userManagement.revokeScopedToken": {
75189
- capName: "user-management",
75190
- capScope: "system",
75191
- addonId: null,
75192
- access: "delete"
75193
- },
75194
75263
  "userManagement.setupTotp": {
75195
75264
  capName: "user-management",
75196
75265
  capScope: "system",
@@ -75221,12 +75290,6 @@ Object.freeze({
75221
75290
  addonId: null,
75222
75291
  access: "view"
75223
75292
  },
75224
- "userManagement.validateScopedToken": {
75225
- capName: "user-management",
75226
- capScope: "system",
75227
- addonId: null,
75228
- access: "view"
75229
- },
75230
75293
  "userManagement.verifyTotp": {
75231
75294
  capName: "user-management",
75232
75295
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreame",
3
- "version": "0.2.137",
3
+ "version": "0.2.138",
4
4
  "description": "Dreame robot-vacuum / lawn-mower device-provider addon for CamStack — wraps the @apocaliss92/nodedreame Dreamehome cloud client",
5
5
  "keywords": [
6
6
  "camstack",