@camstack/addon-provider-dreo 0.2.130 → 0.2.131

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
@@ -5450,7 +5450,7 @@ var ZodIssueCode = {
5450
5450
  var ZodFirstPartyTypeKind;
5451
5451
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5452
5452
  //#endregion
5453
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5453
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5454
5454
  /**
5455
5455
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5456
5456
  * window to float samples (D455).
@@ -7833,9 +7833,9 @@ function normalizeAddonInitResult(result) {
7833
7833
  return result;
7834
7834
  }
7835
7835
  /**
7836
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7837
- * and validates them (`share-token.service.ts` builds its enum from this
7838
- * list); a data plane names the kinds it ACCEPTS in `share`.
7836
+ * The share-view scope kinds a share-link token can carry. The hub mints
7837
+ * and validates them (`ShareViewGrantSchema` builds its
7838
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7839
7839
  */
7840
7840
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7841
7841
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12525,7 +12525,7 @@ var ConvertResultSchema = object({
12525
12525
  * `super_admin` — collapsed onto the single boolean because every
12526
12526
  * non-admin caller is governed by the same scope-check rules; the
12527
12527
  * distinction was only ever used to route role-specific procedures
12528
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12528
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12529
12529
  * with `isAdmin: false` + an explicit scope list.
12530
12530
  */
12531
12531
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -12714,10 +12714,12 @@ var AddonRoutesScopeSchema = object({
12714
12714
  type: literal("addon-routes"),
12715
12715
  access: array(MethodAccessSchema).min(1)
12716
12716
  });
12717
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
12717
12718
  var CredentialScopeSchema = union([
12718
12719
  literal("*"),
12719
12720
  ShareViewScopeSchema,
12720
12721
  AddonRoutesScopeSchema,
12722
+ PreferencesSelfScopeSchema,
12721
12723
  TokenScopeSchema
12722
12724
  ]);
12723
12725
  object({
@@ -12726,6 +12728,55 @@ object({
12726
12728
  jti: string().min(16),
12727
12729
  scopes: array(CredentialScopeSchema).min(1)
12728
12730
  });
12731
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
12732
+ /** A namespace's value: a JSON object, opaque to the hub. */
12733
+ var PreferenceValueSchema = record(string(), unknown());
12734
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
12735
+ /** A stored row, as the owner reads it. */
12736
+ var PreferenceRowSchema = object({
12737
+ namespace: PreferenceNamespaceSchema,
12738
+ value: PreferenceValueSchema,
12739
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
12740
+ revision: number().int().positive(),
12741
+ updatedAt: number().int(),
12742
+ /** The client id the last writer sent; `null` when it sent none. */
12743
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
12744
+ });
12745
+ object({
12746
+ /** Absent: every namespace the caller holds. */
12747
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
12748
+ object({ rows: array(PreferenceRowSchema) });
12749
+ object({
12750
+ namespace: PreferenceNamespaceSchema,
12751
+ value: PreferenceValueSchema,
12752
+ /**
12753
+ * The revision the edit was based on. Absent: last write wins. `0`: the
12754
+ * namespace must not exist yet. Any other value that is not the current
12755
+ * revision answers `conflict` and writes nothing.
12756
+ */
12757
+ baseRevision: number().int().nonnegative().optional(),
12758
+ deviceId: PreferenceDeviceIdSchema.optional()
12759
+ });
12760
+ discriminatedUnion("status", [object({
12761
+ status: literal("saved"),
12762
+ row: PreferenceRowSchema
12763
+ }), object({
12764
+ status: literal("conflict"),
12765
+ current: PreferenceRowSchema.nullable()
12766
+ })]);
12767
+ object({ namespace: PreferenceNamespaceSchema });
12768
+ object({
12769
+ /** `false` when the namespace did not exist. */
12770
+ deleted: boolean() });
12771
+ object({
12772
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
12773
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
12774
+ object({
12775
+ /** Every row whose revision differs from the client's, and every row it did not list. */
12776
+ rows: array(PreferenceRowSchema),
12777
+ /** Namespaces the client listed that no longer exist. */
12778
+ deleted: array(PreferenceNamespaceSchema)
12779
+ });
12729
12780
  _enum(["new-session", "step-up"]);
12730
12781
  /** The languages the hub's app landing pages are written in (D858). */
12731
12782
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -39919,38 +39970,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
39919
39970
  auth: "admin",
39920
39971
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39921
39972
  });
39973
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
39974
+ /** What a model (or, by default, every model of a kind) can do. */
39975
+ var LlmModelFeaturesSchema = object({
39976
+ vision: boolean(),
39977
+ tools: boolean(),
39978
+ streaming: boolean()
39979
+ });
39980
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
39981
+ var LlmModelInfoSchema = object({
39982
+ id: string(),
39983
+ label: string().optional(),
39984
+ contextLength: number().int().positive().optional(),
39985
+ features: LlmModelFeaturesSchema.partial().optional()
39986
+ });
39922
39987
  /**
39923
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
39924
- * methods concat-fan across providers; single-row methods route to ONE
39925
- * provider by the `addonId` in the call input (the notification-output
39926
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
39927
- * (hub-placed); the cap stays open for future providers.
39928
- *
39929
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
39930
- * `apiKey` is a password field — providers REDACT it on read and merge on
39931
- * write; a stored key NEVER round-trips to a client.
39988
+ * The provider-specific part of a profile, validated by the provider that owns
39989
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
39990
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
39991
+ * keychain, never in the row, and reads back as the redaction marker.
39932
39992
  */
39933
- var LlmProfileKindSchema = _enum([
39934
- "openai-compatible",
39935
- "openai",
39936
- "anthropic",
39937
- "google",
39938
- "managed-local",
39939
- "apple-foundation"
39940
- ]);
39993
+ var LlmProviderConfigSchema = record(string(), unknown());
39941
39994
  var LlmProfileSchema = object({
39942
39995
  id: string(),
39943
39996
  name: string(),
39997
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
39944
39998
  kind: LlmProfileKindSchema,
39945
39999
  /** Stamped by the provider — keeps the fanned catalog routable. */
39946
40000
  addonId: string(),
39947
40001
  enabled: boolean(),
39948
40002
  /** Vendor model id, or the managed runtime's loaded model. */
39949
40003
  model: string(),
39950
- /** Required for openai-compatible; override for cloud kinds. */
39951
- baseUrl: string().optional(),
39952
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
39953
- apiKey: string().optional(),
39954
40004
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
39955
40005
  * degraded to text — that shipped once and produced a confident answer to a
39956
40006
  * question about a picture nobody sent. */
@@ -39958,15 +40008,11 @@ var LlmProfileSchema = object({
39958
40008
  temperature: number().min(0).max(2).optional(),
39959
40009
  /** Nucleus sampling. Every wire we speak has it. */
39960
40010
  topP: number().min(0).max(1).optional(),
39961
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
39962
- * wire does, and the client drops it there (measured: the request body gets
39963
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
39964
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40011
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40012
+ * field in its editor only when its descriptor lists it in `profileFields`. */
39965
40013
  topK: number().int().positive().optional(),
39966
40014
  maxTokens: number().int().positive().optional(),
39967
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
39968
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
39969
- * the model with, so it is the one field that changes a PROCESS. */
40015
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
39970
40016
  contextLength: number().int().positive().optional(),
39971
40017
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
39972
40018
  * two system prompts fighting is worse than either alone). */
@@ -39992,16 +40038,37 @@ var LlmProfileSchema = object({
39992
40038
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
39993
40039
  * `true` here buys the wiring, not behaviour, until tools are registered. */
39994
40040
  toolsEnabled: boolean().default(false),
39995
- extraHeaders: record(string(), string()).optional(),
39996
- /** kind === 'managed-local' only (spec §4). */
39997
- runtime: ManagedRuntimeConfigSchema.optional(),
39998
- /**
39999
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40000
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40001
- * `supportsVision` on such a row is stamped by the provider from the node's
40002
- * reported `imageInput`, never taken from the operator (D62).
40003
- */
40004
- appleFoundation: object({ nodeId: string() }).optional()
40041
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40042
+ providerConfig: LlmProviderConfigSchema.default({})
40043
+ });
40044
+ /**
40045
+ * The common profile fields a kind's editor offers. The editor owns how each
40046
+ * one is drawn; the provider says which of them mean something on its wire.
40047
+ */
40048
+ var LlmProfileFieldSchema = _enum([
40049
+ "temperature",
40050
+ "topP",
40051
+ "topK",
40052
+ "maxTokens",
40053
+ "contextLength",
40054
+ "systemPrompt",
40055
+ "timeoutMs",
40056
+ "connectTimeoutMs",
40057
+ "firstTokenTimeoutMs",
40058
+ "idleTimeoutMs",
40059
+ "retry",
40060
+ "toolsEnabled"
40061
+ ]);
40062
+ /**
40063
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40064
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40065
+ * picker: that widget owns the model choice.
40066
+ */
40067
+ var LlmProviderWidgetSchema = object({
40068
+ id: string(),
40069
+ placement: _enum(["connection", "model"]),
40070
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40071
+ requires: array(string()).optional()
40005
40072
  });
40006
40073
  /** ConfigUISchema tree passed through untyped on the wire (the
40007
40074
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40010,11 +40077,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40010
40077
  var LlmProfileKindDescriptorSchema = object({
40011
40078
  kind: LlmProfileKindSchema,
40012
40079
  label: string(),
40080
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40013
40081
  icon: string(),
40014
40082
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40015
40083
  addonId: string(),
40016
- configSchema: ConfigSchemaPassthrough$3
40084
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40085
+ connectionSchema: ConfigSchemaPassthrough$3,
40086
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40087
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40088
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40089
+ features: LlmModelFeaturesSchema,
40090
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40091
+ visionEditable: boolean(),
40092
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40093
+ modelCatalog: _enum([
40094
+ "fetch",
40095
+ "static",
40096
+ "none"
40097
+ ]),
40098
+ staticModels: array(LlmModelInfoSchema).optional(),
40099
+ /** The common fields that mean something on this kind's wire. */
40100
+ profileFields: array(LlmProfileFieldSchema),
40101
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40017
40102
  });
40103
+ /**
40104
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40105
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40106
+ * untouched (absent or the redaction marker) is resolved server-side from the
40107
+ * stored profile — the browser never receives it.
40108
+ */
40109
+ var LlmListModelsInputSchema = object({
40110
+ addonId: string(),
40111
+ kind: LlmProfileKindSchema,
40112
+ profileId: string().optional(),
40113
+ connection: LlmProviderConfigSchema.optional()
40114
+ });
40115
+ var LlmListModelsErrorCodeSchema = _enum([
40116
+ "auth",
40117
+ "network",
40118
+ "unsupported",
40119
+ "invalid"
40120
+ ]);
40121
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40122
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40123
+ ok: literal(true),
40124
+ models: array(LlmModelInfoSchema)
40125
+ }), object({
40126
+ ok: literal(false),
40127
+ code: LlmListModelsErrorCodeSchema,
40128
+ message: string()
40129
+ })]);
40018
40130
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40019
40131
  var LlmDefaultSchema = object({
40020
40132
  selector: LlmDefaultSelectorSchema,
@@ -40114,7 +40226,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40114
40226
  kind: "mutation",
40115
40227
  auth: "admin",
40116
40228
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40117
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40229
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40230
+ kind: "mutation",
40231
+ auth: "admin"
40232
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40118
40233
  selector: LlmDefaultSelectorSchema,
40119
40234
  profileId: string().nullable()
40120
40235
  }), _void(), {
@@ -64010,26 +64125,6 @@ var ApiKeySummarySchema = object({
64010
64125
  createdAt: number(),
64011
64126
  lastUsedAt: number().optional()
64012
64127
  });
64013
- var ScopedTokenSummarySchema = object({
64014
- id: string(),
64015
- userId: string(),
64016
- name: string(),
64017
- tokenPrefix: string(),
64018
- scopes: array(TokenScopeSchema),
64019
- expiresAt: number().nullish(),
64020
- lastUsedAt: number().nullish(),
64021
- createdAt: number()
64022
- });
64023
- var CreateScopedTokenInputSchema = object({
64024
- userId: string(),
64025
- name: string(),
64026
- scopes: array(TokenScopeSchema),
64027
- expiresAt: number().optional()
64028
- });
64029
- var CreateScopedTokenResultSchema = object({
64030
- token: string(),
64031
- record: ScopedTokenSummarySchema
64032
- });
64033
64128
  var OauthSessionSummarySchema = object({
64034
64129
  id: string(),
64035
64130
  userId: string(),
@@ -64051,11 +64146,11 @@ var TotpStatusSchema = object({
64051
64146
  confirmedAt: number().nullable()
64052
64147
  });
64053
64148
  /**
64054
- * user-management — singleton capability for user accounts, API keys,
64055
- * and scoped tokens.
64149
+ * user-management — singleton capability for user accounts and the
64150
+ * legacy API-key rows.
64056
64151
  *
64057
64152
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
64058
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
64153
+ * — the subset check on `setUserScopes` is moot
64059
64154
  * because non-admins never reach these. If/when we open non-admin
64060
64155
  * delegation, structural caller-scope subset check goes inside the
64061
64156
  * provider.
@@ -64112,15 +64207,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64112
64207
  kind: "mutation",
64113
64208
  auth: "admin",
64114
64209
  access: "delete"
64115
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
64116
- kind: "mutation",
64117
- auth: "admin",
64118
- access: "create"
64119
- }), method(object({ id: string() }), object({ success: literal(true) }), {
64120
- kind: "mutation",
64121
- auth: "admin",
64122
- access: "delete"
64123
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
64210
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
64124
64211
  kind: "mutation",
64125
64212
  auth: "admin",
64126
64213
  access: "create"
@@ -70210,7 +70297,7 @@ Object.freeze({
70210
70297
  capName: "llm",
70211
70298
  capScope: "system",
70212
70299
  addonId: null,
70213
- access: "view"
70300
+ access: "create"
70214
70301
  },
70215
70302
  "llm.listNodeModels": {
70216
70303
  capName: "llm",
@@ -74874,12 +74961,6 @@ Object.freeze({
74874
74961
  addonId: null,
74875
74962
  access: "create"
74876
74963
  },
74877
- "userManagement.createScopedToken": {
74878
- capName: "user-management",
74879
- capScope: "system",
74880
- addonId: null,
74881
- access: "create"
74882
- },
74883
74964
  "userManagement.createUser": {
74884
74965
  capName: "user-management",
74885
74966
  capScope: "system",
@@ -74928,12 +75009,6 @@ Object.freeze({
74928
75009
  addonId: null,
74929
75010
  access: "view"
74930
75011
  },
74931
- "userManagement.listScopedTokens": {
74932
- capName: "user-management",
74933
- capScope: "system",
74934
- addonId: null,
74935
- access: "view"
74936
- },
74937
75012
  "userManagement.listUsers": {
74938
75013
  capName: "user-management",
74939
75014
  capScope: "system",
@@ -74988,12 +75063,6 @@ Object.freeze({
74988
75063
  addonId: null,
74989
75064
  access: "delete"
74990
75065
  },
74991
- "userManagement.revokeScopedToken": {
74992
- capName: "user-management",
74993
- capScope: "system",
74994
- addonId: null,
74995
- access: "delete"
74996
- },
74997
75066
  "userManagement.setupTotp": {
74998
75067
  capName: "user-management",
74999
75068
  capScope: "system",
@@ -75024,12 +75093,6 @@ Object.freeze({
75024
75093
  addonId: null,
75025
75094
  access: "view"
75026
75095
  },
75027
- "userManagement.validateScopedToken": {
75028
- capName: "user-management",
75029
- capScope: "system",
75030
- addonId: null,
75031
- access: "view"
75032
- },
75033
75096
  "userManagement.verifyTotp": {
75034
75097
  capName: "user-management",
75035
75098
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -5451,7 +5451,7 @@ var ZodIssueCode = {
5451
5451
  var ZodFirstPartyTypeKind;
5452
5452
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5453
5453
  //#endregion
5454
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5454
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5455
5455
  /**
5456
5456
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5457
5457
  * window to float samples (D455).
@@ -7834,9 +7834,9 @@ function normalizeAddonInitResult(result) {
7834
7834
  return result;
7835
7835
  }
7836
7836
  /**
7837
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7838
- * and validates them (`share-token.service.ts` builds its enum from this
7839
- * list); a data plane names the kinds it ACCEPTS in `share`.
7837
+ * The share-view scope kinds a share-link token can carry. The hub mints
7838
+ * and validates them (`ShareViewGrantSchema` builds its
7839
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7840
7840
  */
7841
7841
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7842
7842
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12526,7 +12526,7 @@ var ConvertResultSchema = object({
12526
12526
  * `super_admin` — collapsed onto the single boolean because every
12527
12527
  * non-admin caller is governed by the same scope-check rules; the
12528
12528
  * distinction was only ever used to route role-specific procedures
12529
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12529
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12530
12530
  * with `isAdmin: false` + an explicit scope list.
12531
12531
  */
12532
12532
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -12715,10 +12715,12 @@ var AddonRoutesScopeSchema = object({
12715
12715
  type: literal("addon-routes"),
12716
12716
  access: array(MethodAccessSchema).min(1)
12717
12717
  });
12718
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
12718
12719
  var CredentialScopeSchema = union([
12719
12720
  literal("*"),
12720
12721
  ShareViewScopeSchema,
12721
12722
  AddonRoutesScopeSchema,
12723
+ PreferencesSelfScopeSchema,
12722
12724
  TokenScopeSchema
12723
12725
  ]);
12724
12726
  object({
@@ -12727,6 +12729,55 @@ object({
12727
12729
  jti: string().min(16),
12728
12730
  scopes: array(CredentialScopeSchema).min(1)
12729
12731
  });
12732
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
12733
+ /** A namespace's value: a JSON object, opaque to the hub. */
12734
+ var PreferenceValueSchema = record(string(), unknown());
12735
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
12736
+ /** A stored row, as the owner reads it. */
12737
+ var PreferenceRowSchema = object({
12738
+ namespace: PreferenceNamespaceSchema,
12739
+ value: PreferenceValueSchema,
12740
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
12741
+ revision: number().int().positive(),
12742
+ updatedAt: number().int(),
12743
+ /** The client id the last writer sent; `null` when it sent none. */
12744
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
12745
+ });
12746
+ object({
12747
+ /** Absent: every namespace the caller holds. */
12748
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
12749
+ object({ rows: array(PreferenceRowSchema) });
12750
+ object({
12751
+ namespace: PreferenceNamespaceSchema,
12752
+ value: PreferenceValueSchema,
12753
+ /**
12754
+ * The revision the edit was based on. Absent: last write wins. `0`: the
12755
+ * namespace must not exist yet. Any other value that is not the current
12756
+ * revision answers `conflict` and writes nothing.
12757
+ */
12758
+ baseRevision: number().int().nonnegative().optional(),
12759
+ deviceId: PreferenceDeviceIdSchema.optional()
12760
+ });
12761
+ discriminatedUnion("status", [object({
12762
+ status: literal("saved"),
12763
+ row: PreferenceRowSchema
12764
+ }), object({
12765
+ status: literal("conflict"),
12766
+ current: PreferenceRowSchema.nullable()
12767
+ })]);
12768
+ object({ namespace: PreferenceNamespaceSchema });
12769
+ object({
12770
+ /** `false` when the namespace did not exist. */
12771
+ deleted: boolean() });
12772
+ object({
12773
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
12774
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
12775
+ object({
12776
+ /** Every row whose revision differs from the client's, and every row it did not list. */
12777
+ rows: array(PreferenceRowSchema),
12778
+ /** Namespaces the client listed that no longer exist. */
12779
+ deleted: array(PreferenceNamespaceSchema)
12780
+ });
12730
12781
  _enum(["new-session", "step-up"]);
12731
12782
  /** The languages the hub's app landing pages are written in (D858). */
12732
12783
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -39920,38 +39971,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
39920
39971
  auth: "admin",
39921
39972
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39922
39973
  });
39974
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
39975
+ /** What a model (or, by default, every model of a kind) can do. */
39976
+ var LlmModelFeaturesSchema = object({
39977
+ vision: boolean(),
39978
+ tools: boolean(),
39979
+ streaming: boolean()
39980
+ });
39981
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
39982
+ var LlmModelInfoSchema = object({
39983
+ id: string(),
39984
+ label: string().optional(),
39985
+ contextLength: number().int().positive().optional(),
39986
+ features: LlmModelFeaturesSchema.partial().optional()
39987
+ });
39923
39988
  /**
39924
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
39925
- * methods concat-fan across providers; single-row methods route to ONE
39926
- * provider by the `addonId` in the call input (the notification-output
39927
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
39928
- * (hub-placed); the cap stays open for future providers.
39929
- *
39930
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
39931
- * `apiKey` is a password field — providers REDACT it on read and merge on
39932
- * write; a stored key NEVER round-trips to a client.
39989
+ * The provider-specific part of a profile, validated by the provider that owns
39990
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
39991
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
39992
+ * keychain, never in the row, and reads back as the redaction marker.
39933
39993
  */
39934
- var LlmProfileKindSchema = _enum([
39935
- "openai-compatible",
39936
- "openai",
39937
- "anthropic",
39938
- "google",
39939
- "managed-local",
39940
- "apple-foundation"
39941
- ]);
39994
+ var LlmProviderConfigSchema = record(string(), unknown());
39942
39995
  var LlmProfileSchema = object({
39943
39996
  id: string(),
39944
39997
  name: string(),
39998
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
39945
39999
  kind: LlmProfileKindSchema,
39946
40000
  /** Stamped by the provider — keeps the fanned catalog routable. */
39947
40001
  addonId: string(),
39948
40002
  enabled: boolean(),
39949
40003
  /** Vendor model id, or the managed runtime's loaded model. */
39950
40004
  model: string(),
39951
- /** Required for openai-compatible; override for cloud kinds. */
39952
- baseUrl: string().optional(),
39953
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
39954
- apiKey: string().optional(),
39955
40005
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
39956
40006
  * degraded to text — that shipped once and produced a confident answer to a
39957
40007
  * question about a picture nobody sent. */
@@ -39959,15 +40009,11 @@ var LlmProfileSchema = object({
39959
40009
  temperature: number().min(0).max(2).optional(),
39960
40010
  /** Nucleus sampling. Every wire we speak has it. */
39961
40011
  topP: number().min(0).max(1).optional(),
39962
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
39963
- * wire does, and the client drops it there (measured: the request body gets
39964
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
39965
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40012
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40013
+ * field in its editor only when its descriptor lists it in `profileFields`. */
39966
40014
  topK: number().int().positive().optional(),
39967
40015
  maxTokens: number().int().positive().optional(),
39968
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
39969
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
39970
- * the model with, so it is the one field that changes a PROCESS. */
40016
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
39971
40017
  contextLength: number().int().positive().optional(),
39972
40018
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
39973
40019
  * two system prompts fighting is worse than either alone). */
@@ -39993,16 +40039,37 @@ var LlmProfileSchema = object({
39993
40039
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
39994
40040
  * `true` here buys the wiring, not behaviour, until tools are registered. */
39995
40041
  toolsEnabled: boolean().default(false),
39996
- extraHeaders: record(string(), string()).optional(),
39997
- /** kind === 'managed-local' only (spec §4). */
39998
- runtime: ManagedRuntimeConfigSchema.optional(),
39999
- /**
40000
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40001
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40002
- * `supportsVision` on such a row is stamped by the provider from the node's
40003
- * reported `imageInput`, never taken from the operator (D62).
40004
- */
40005
- appleFoundation: object({ nodeId: string() }).optional()
40042
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40043
+ providerConfig: LlmProviderConfigSchema.default({})
40044
+ });
40045
+ /**
40046
+ * The common profile fields a kind's editor offers. The editor owns how each
40047
+ * one is drawn; the provider says which of them mean something on its wire.
40048
+ */
40049
+ var LlmProfileFieldSchema = _enum([
40050
+ "temperature",
40051
+ "topP",
40052
+ "topK",
40053
+ "maxTokens",
40054
+ "contextLength",
40055
+ "systemPrompt",
40056
+ "timeoutMs",
40057
+ "connectTimeoutMs",
40058
+ "firstTokenTimeoutMs",
40059
+ "idleTimeoutMs",
40060
+ "retry",
40061
+ "toolsEnabled"
40062
+ ]);
40063
+ /**
40064
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40065
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40066
+ * picker: that widget owns the model choice.
40067
+ */
40068
+ var LlmProviderWidgetSchema = object({
40069
+ id: string(),
40070
+ placement: _enum(["connection", "model"]),
40071
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40072
+ requires: array(string()).optional()
40006
40073
  });
40007
40074
  /** ConfigUISchema tree passed through untyped on the wire (the
40008
40075
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40011,11 +40078,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40011
40078
  var LlmProfileKindDescriptorSchema = object({
40012
40079
  kind: LlmProfileKindSchema,
40013
40080
  label: string(),
40081
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40014
40082
  icon: string(),
40015
40083
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40016
40084
  addonId: string(),
40017
- configSchema: ConfigSchemaPassthrough$3
40085
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40086
+ connectionSchema: ConfigSchemaPassthrough$3,
40087
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40088
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40089
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40090
+ features: LlmModelFeaturesSchema,
40091
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40092
+ visionEditable: boolean(),
40093
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40094
+ modelCatalog: _enum([
40095
+ "fetch",
40096
+ "static",
40097
+ "none"
40098
+ ]),
40099
+ staticModels: array(LlmModelInfoSchema).optional(),
40100
+ /** The common fields that mean something on this kind's wire. */
40101
+ profileFields: array(LlmProfileFieldSchema),
40102
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40018
40103
  });
40104
+ /**
40105
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40106
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40107
+ * untouched (absent or the redaction marker) is resolved server-side from the
40108
+ * stored profile — the browser never receives it.
40109
+ */
40110
+ var LlmListModelsInputSchema = object({
40111
+ addonId: string(),
40112
+ kind: LlmProfileKindSchema,
40113
+ profileId: string().optional(),
40114
+ connection: LlmProviderConfigSchema.optional()
40115
+ });
40116
+ var LlmListModelsErrorCodeSchema = _enum([
40117
+ "auth",
40118
+ "network",
40119
+ "unsupported",
40120
+ "invalid"
40121
+ ]);
40122
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40123
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40124
+ ok: literal(true),
40125
+ models: array(LlmModelInfoSchema)
40126
+ }), object({
40127
+ ok: literal(false),
40128
+ code: LlmListModelsErrorCodeSchema,
40129
+ message: string()
40130
+ })]);
40019
40131
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40020
40132
  var LlmDefaultSchema = object({
40021
40133
  selector: LlmDefaultSelectorSchema,
@@ -40115,7 +40227,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40115
40227
  kind: "mutation",
40116
40228
  auth: "admin",
40117
40229
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40118
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40230
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40231
+ kind: "mutation",
40232
+ auth: "admin"
40233
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40119
40234
  selector: LlmDefaultSelectorSchema,
40120
40235
  profileId: string().nullable()
40121
40236
  }), _void(), {
@@ -64011,26 +64126,6 @@ var ApiKeySummarySchema = object({
64011
64126
  createdAt: number(),
64012
64127
  lastUsedAt: number().optional()
64013
64128
  });
64014
- var ScopedTokenSummarySchema = object({
64015
- id: string(),
64016
- userId: string(),
64017
- name: string(),
64018
- tokenPrefix: string(),
64019
- scopes: array(TokenScopeSchema),
64020
- expiresAt: number().nullish(),
64021
- lastUsedAt: number().nullish(),
64022
- createdAt: number()
64023
- });
64024
- var CreateScopedTokenInputSchema = object({
64025
- userId: string(),
64026
- name: string(),
64027
- scopes: array(TokenScopeSchema),
64028
- expiresAt: number().optional()
64029
- });
64030
- var CreateScopedTokenResultSchema = object({
64031
- token: string(),
64032
- record: ScopedTokenSummarySchema
64033
- });
64034
64129
  var OauthSessionSummarySchema = object({
64035
64130
  id: string(),
64036
64131
  userId: string(),
@@ -64052,11 +64147,11 @@ var TotpStatusSchema = object({
64052
64147
  confirmedAt: number().nullable()
64053
64148
  });
64054
64149
  /**
64055
- * user-management — singleton capability for user accounts, API keys,
64056
- * and scoped tokens.
64150
+ * user-management — singleton capability for user accounts and the
64151
+ * legacy API-key rows.
64057
64152
  *
64058
64153
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
64059
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
64154
+ * — the subset check on `setUserScopes` is moot
64060
64155
  * because non-admins never reach these. If/when we open non-admin
64061
64156
  * delegation, structural caller-scope subset check goes inside the
64062
64157
  * provider.
@@ -64113,15 +64208,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64113
64208
  kind: "mutation",
64114
64209
  auth: "admin",
64115
64210
  access: "delete"
64116
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
64117
- kind: "mutation",
64118
- auth: "admin",
64119
- access: "create"
64120
- }), method(object({ id: string() }), object({ success: literal(true) }), {
64121
- kind: "mutation",
64122
- auth: "admin",
64123
- access: "delete"
64124
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
64211
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
64125
64212
  kind: "mutation",
64126
64213
  auth: "admin",
64127
64214
  access: "create"
@@ -70211,7 +70298,7 @@ Object.freeze({
70211
70298
  capName: "llm",
70212
70299
  capScope: "system",
70213
70300
  addonId: null,
70214
- access: "view"
70301
+ access: "create"
70215
70302
  },
70216
70303
  "llm.listNodeModels": {
70217
70304
  capName: "llm",
@@ -74875,12 +74962,6 @@ Object.freeze({
74875
74962
  addonId: null,
74876
74963
  access: "create"
74877
74964
  },
74878
- "userManagement.createScopedToken": {
74879
- capName: "user-management",
74880
- capScope: "system",
74881
- addonId: null,
74882
- access: "create"
74883
- },
74884
74965
  "userManagement.createUser": {
74885
74966
  capName: "user-management",
74886
74967
  capScope: "system",
@@ -74929,12 +75010,6 @@ Object.freeze({
74929
75010
  addonId: null,
74930
75011
  access: "view"
74931
75012
  },
74932
- "userManagement.listScopedTokens": {
74933
- capName: "user-management",
74934
- capScope: "system",
74935
- addonId: null,
74936
- access: "view"
74937
- },
74938
75013
  "userManagement.listUsers": {
74939
75014
  capName: "user-management",
74940
75015
  capScope: "system",
@@ -74989,12 +75064,6 @@ Object.freeze({
74989
75064
  addonId: null,
74990
75065
  access: "delete"
74991
75066
  },
74992
- "userManagement.revokeScopedToken": {
74993
- capName: "user-management",
74994
- capScope: "system",
74995
- addonId: null,
74996
- access: "delete"
74997
- },
74998
75067
  "userManagement.setupTotp": {
74999
75068
  capName: "user-management",
75000
75069
  capScope: "system",
@@ -75025,12 +75094,6 @@ Object.freeze({
75025
75094
  addonId: null,
75026
75095
  access: "view"
75027
75096
  },
75028
- "userManagement.validateScopedToken": {
75029
- capName: "user-management",
75030
- capScope: "system",
75031
- addonId: null,
75032
- access: "view"
75033
- },
75034
75097
  "userManagement.verifyTotp": {
75035
75098
  capName: "user-management",
75036
75099
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreo",
3
- "version": "0.2.130",
3
+ "version": "0.2.131",
4
4
  "description": "Dreo smart-device (fan / air-circulator / purifier / heater / humidifier) device-provider addon for CamStack — wraps the @apocaliss92/nodedreo Dreo cloud client (REST + WebSocket)",
5
5
  "keywords": [
6
6
  "camstack",