@camstack/addon-provider-rademacher 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
@@ -6399,7 +6399,7 @@ var ZodIssueCode = {
6399
6399
  var ZodFirstPartyTypeKind;
6400
6400
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6401
6401
  //#endregion
6402
- //#region ../types/dist/sleep-BxjU_fJM.mjs
6402
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
6403
6403
  /**
6404
6404
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6405
6405
  * window to float samples (D455).
@@ -8782,9 +8782,9 @@ function normalizeAddonInitResult(result) {
8782
8782
  return result;
8783
8783
  }
8784
8784
  /**
8785
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
8786
- * and validates them (`share-token.service.ts` builds its enum from this
8787
- * list); a data plane names the kinds it ACCEPTS in `share`.
8785
+ * The share-view scope kinds a share-link token can carry. The hub mints
8786
+ * and validates them (`ShareViewGrantSchema` builds its
8787
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
8788
8788
  */
8789
8789
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
8790
8790
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -13474,7 +13474,7 @@ var ConvertResultSchema = object({
13474
13474
  * `super_admin` — collapsed onto the single boolean because every
13475
13475
  * non-admin caller is governed by the same scope-check rules; the
13476
13476
  * distinction was only ever used to route role-specific procedures
13477
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
13477
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
13478
13478
  * with `isAdmin: false` + an explicit scope list.
13479
13479
  */
13480
13480
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13663,10 +13663,12 @@ var AddonRoutesScopeSchema = object({
13663
13663
  type: literal("addon-routes"),
13664
13664
  access: array(MethodAccessSchema).min(1)
13665
13665
  });
13666
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13666
13667
  var CredentialScopeSchema = union([
13667
13668
  literal("*"),
13668
13669
  ShareViewScopeSchema,
13669
13670
  AddonRoutesScopeSchema,
13671
+ PreferencesSelfScopeSchema,
13670
13672
  TokenScopeSchema
13671
13673
  ]);
13672
13674
  object({
@@ -13675,6 +13677,55 @@ object({
13675
13677
  jti: string().min(16),
13676
13678
  scopes: array(CredentialScopeSchema).min(1)
13677
13679
  });
13680
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13681
+ /** A namespace's value: a JSON object, opaque to the hub. */
13682
+ var PreferenceValueSchema = record(string(), unknown());
13683
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13684
+ /** A stored row, as the owner reads it. */
13685
+ var PreferenceRowSchema = object({
13686
+ namespace: PreferenceNamespaceSchema,
13687
+ value: PreferenceValueSchema,
13688
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13689
+ revision: number().int().positive(),
13690
+ updatedAt: number().int(),
13691
+ /** The client id the last writer sent; `null` when it sent none. */
13692
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13693
+ });
13694
+ object({
13695
+ /** Absent: every namespace the caller holds. */
13696
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13697
+ object({ rows: array(PreferenceRowSchema) });
13698
+ object({
13699
+ namespace: PreferenceNamespaceSchema,
13700
+ value: PreferenceValueSchema,
13701
+ /**
13702
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13703
+ * namespace must not exist yet. Any other value that is not the current
13704
+ * revision answers `conflict` and writes nothing.
13705
+ */
13706
+ baseRevision: number().int().nonnegative().optional(),
13707
+ deviceId: PreferenceDeviceIdSchema.optional()
13708
+ });
13709
+ discriminatedUnion("status", [object({
13710
+ status: literal("saved"),
13711
+ row: PreferenceRowSchema
13712
+ }), object({
13713
+ status: literal("conflict"),
13714
+ current: PreferenceRowSchema.nullable()
13715
+ })]);
13716
+ object({ namespace: PreferenceNamespaceSchema });
13717
+ object({
13718
+ /** `false` when the namespace did not exist. */
13719
+ deleted: boolean() });
13720
+ object({
13721
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13722
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13723
+ object({
13724
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13725
+ rows: array(PreferenceRowSchema),
13726
+ /** Namespaces the client listed that no longer exist. */
13727
+ deleted: array(PreferenceNamespaceSchema)
13728
+ });
13678
13729
  _enum(["new-session", "step-up"]);
13679
13730
  /** The languages the hub's app landing pages are written in (D858). */
13680
13731
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40964,38 +41015,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40964
41015
  auth: "admin",
40965
41016
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40966
41017
  });
41018
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
41019
+ /** What a model (or, by default, every model of a kind) can do. */
41020
+ var LlmModelFeaturesSchema = object({
41021
+ vision: boolean(),
41022
+ tools: boolean(),
41023
+ streaming: boolean()
41024
+ });
41025
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
41026
+ var LlmModelInfoSchema = object({
41027
+ id: string(),
41028
+ label: string().optional(),
41029
+ contextLength: number().int().positive().optional(),
41030
+ features: LlmModelFeaturesSchema.partial().optional()
41031
+ });
40967
41032
  /**
40968
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40969
- * methods concat-fan across providers; single-row methods route to ONE
40970
- * provider by the `addonId` in the call input (the notification-output
40971
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40972
- * (hub-placed); the cap stays open for future providers.
40973
- *
40974
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40975
- * `apiKey` is a password field — providers REDACT it on read and merge on
40976
- * write; a stored key NEVER round-trips to a client.
41033
+ * The provider-specific part of a profile, validated by the provider that owns
41034
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
41035
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
41036
+ * keychain, never in the row, and reads back as the redaction marker.
40977
41037
  */
40978
- var LlmProfileKindSchema = _enum([
40979
- "openai-compatible",
40980
- "openai",
40981
- "anthropic",
40982
- "google",
40983
- "managed-local",
40984
- "apple-foundation"
40985
- ]);
41038
+ var LlmProviderConfigSchema = record(string(), unknown());
40986
41039
  var LlmProfileSchema = object({
40987
41040
  id: string(),
40988
41041
  name: string(),
41042
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40989
41043
  kind: LlmProfileKindSchema,
40990
41044
  /** Stamped by the provider — keeps the fanned catalog routable. */
40991
41045
  addonId: string(),
40992
41046
  enabled: boolean(),
40993
41047
  /** Vendor model id, or the managed runtime's loaded model. */
40994
41048
  model: string(),
40995
- /** Required for openai-compatible; override for cloud kinds. */
40996
- baseUrl: string().optional(),
40997
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40998
- apiKey: string().optional(),
40999
41049
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
41000
41050
  * degraded to text — that shipped once and produced a confident answer to a
41001
41051
  * question about a picture nobody sent. */
@@ -41003,15 +41053,11 @@ var LlmProfileSchema = object({
41003
41053
  temperature: number().min(0).max(2).optional(),
41004
41054
  /** Nucleus sampling. Every wire we speak has it. */
41005
41055
  topP: number().min(0).max(1).optional(),
41006
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
41007
- * wire does, and the client drops it there (measured: the request body gets
41008
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
41009
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
41056
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
41057
+ * field in its editor only when its descriptor lists it in `profileFields`. */
41010
41058
  topK: number().int().positive().optional(),
41011
41059
  maxTokens: number().int().positive().optional(),
41012
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
41013
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
41014
- * the model with, so it is the one field that changes a PROCESS. */
41060
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
41015
41061
  contextLength: number().int().positive().optional(),
41016
41062
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
41017
41063
  * two system prompts fighting is worse than either alone). */
@@ -41037,16 +41083,37 @@ var LlmProfileSchema = object({
41037
41083
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
41038
41084
  * `true` here buys the wiring, not behaviour, until tools are registered. */
41039
41085
  toolsEnabled: boolean().default(false),
41040
- extraHeaders: record(string(), string()).optional(),
41041
- /** kind === 'managed-local' only (spec §4). */
41042
- runtime: ManagedRuntimeConfigSchema.optional(),
41043
- /**
41044
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
41045
- * to configure (no key, no URL, no download; `model` is `apple-system`).
41046
- * `supportsVision` on such a row is stamped by the provider from the node's
41047
- * reported `imageInput`, never taken from the operator (D62).
41048
- */
41049
- appleFoundation: object({ nodeId: string() }).optional()
41086
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
41087
+ providerConfig: LlmProviderConfigSchema.default({})
41088
+ });
41089
+ /**
41090
+ * The common profile fields a kind's editor offers. The editor owns how each
41091
+ * one is drawn; the provider says which of them mean something on its wire.
41092
+ */
41093
+ var LlmProfileFieldSchema = _enum([
41094
+ "temperature",
41095
+ "topP",
41096
+ "topK",
41097
+ "maxTokens",
41098
+ "contextLength",
41099
+ "systemPrompt",
41100
+ "timeoutMs",
41101
+ "connectTimeoutMs",
41102
+ "firstTokenTimeoutMs",
41103
+ "idleTimeoutMs",
41104
+ "retry",
41105
+ "toolsEnabled"
41106
+ ]);
41107
+ /**
41108
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
41109
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
41110
+ * picker: that widget owns the model choice.
41111
+ */
41112
+ var LlmProviderWidgetSchema = object({
41113
+ id: string(),
41114
+ placement: _enum(["connection", "model"]),
41115
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
41116
+ requires: array(string()).optional()
41050
41117
  });
41051
41118
  /** ConfigUISchema tree passed through untyped on the wire (the
41052
41119
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -41055,11 +41122,56 @@ var ConfigSchemaPassthrough$3 = unknown();
41055
41122
  var LlmProfileKindDescriptorSchema = object({
41056
41123
  kind: LlmProfileKindSchema,
41057
41124
  label: string(),
41125
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
41058
41126
  icon: string(),
41059
41127
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
41060
41128
  addonId: string(),
41061
- configSchema: ConfigSchemaPassthrough$3
41129
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
41130
+ connectionSchema: ConfigSchemaPassthrough$3,
41131
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
41132
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
41133
+ /** The kind's defaults; a model from `listModels` may override any of them. */
41134
+ features: LlmModelFeaturesSchema,
41135
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
41136
+ visionEditable: boolean(),
41137
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
41138
+ modelCatalog: _enum([
41139
+ "fetch",
41140
+ "static",
41141
+ "none"
41142
+ ]),
41143
+ staticModels: array(LlmModelInfoSchema).optional(),
41144
+ /** The common fields that mean something on this kind's wire. */
41145
+ profileFields: array(LlmProfileFieldSchema),
41146
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
41062
41147
  });
41148
+ /**
41149
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
41150
+ * (the editor's form); with `profileId` too, a secret the draft leaves
41151
+ * untouched (absent or the redaction marker) is resolved server-side from the
41152
+ * stored profile — the browser never receives it.
41153
+ */
41154
+ var LlmListModelsInputSchema = object({
41155
+ addonId: string(),
41156
+ kind: LlmProfileKindSchema,
41157
+ profileId: string().optional(),
41158
+ connection: LlmProviderConfigSchema.optional()
41159
+ });
41160
+ var LlmListModelsErrorCodeSchema = _enum([
41161
+ "auth",
41162
+ "network",
41163
+ "unsupported",
41164
+ "invalid"
41165
+ ]);
41166
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
41167
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
41168
+ ok: literal(true),
41169
+ models: array(LlmModelInfoSchema)
41170
+ }), object({
41171
+ ok: literal(false),
41172
+ code: LlmListModelsErrorCodeSchema,
41173
+ message: string()
41174
+ })]);
41063
41175
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
41064
41176
  var LlmDefaultSchema = object({
41065
41177
  selector: LlmDefaultSelectorSchema,
@@ -41159,7 +41271,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
41159
41271
  kind: "mutation",
41160
41272
  auth: "admin",
41161
41273
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
41162
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
41274
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
41275
+ kind: "mutation",
41276
+ auth: "admin"
41277
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
41163
41278
  selector: LlmDefaultSelectorSchema,
41164
41279
  profileId: string().nullable()
41165
41280
  }), _void(), {
@@ -65047,26 +65162,6 @@ var ApiKeySummarySchema = object({
65047
65162
  createdAt: number(),
65048
65163
  lastUsedAt: number().optional()
65049
65164
  });
65050
- var ScopedTokenSummarySchema = object({
65051
- id: string(),
65052
- userId: string(),
65053
- name: string(),
65054
- tokenPrefix: string(),
65055
- scopes: array(TokenScopeSchema),
65056
- expiresAt: number().nullish(),
65057
- lastUsedAt: number().nullish(),
65058
- createdAt: number()
65059
- });
65060
- var CreateScopedTokenInputSchema = object({
65061
- userId: string(),
65062
- name: string(),
65063
- scopes: array(TokenScopeSchema),
65064
- expiresAt: number().optional()
65065
- });
65066
- var CreateScopedTokenResultSchema = object({
65067
- token: string(),
65068
- record: ScopedTokenSummarySchema
65069
- });
65070
65165
  var OauthSessionSummarySchema = object({
65071
65166
  id: string(),
65072
65167
  userId: string(),
@@ -65088,11 +65183,11 @@ var TotpStatusSchema = object({
65088
65183
  confirmedAt: number().nullable()
65089
65184
  });
65090
65185
  /**
65091
- * user-management — singleton capability for user accounts, API keys,
65092
- * and scoped tokens.
65186
+ * user-management — singleton capability for user accounts and the
65187
+ * legacy API-key rows.
65093
65188
  *
65094
65189
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
65095
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
65190
+ * — the subset check on `setUserScopes` is moot
65096
65191
  * because non-admins never reach these. If/when we open non-admin
65097
65192
  * delegation, structural caller-scope subset check goes inside the
65098
65193
  * provider.
@@ -65149,15 +65244,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
65149
65244
  kind: "mutation",
65150
65245
  auth: "admin",
65151
65246
  access: "delete"
65152
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
65153
- kind: "mutation",
65154
- auth: "admin",
65155
- access: "create"
65156
- }), method(object({ id: string() }), object({ success: literal(true) }), {
65157
- kind: "mutation",
65158
- auth: "admin",
65159
- access: "delete"
65160
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
65247
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
65161
65248
  kind: "mutation",
65162
65249
  auth: "admin",
65163
65250
  access: "create"
@@ -71247,7 +71334,7 @@ Object.freeze({
71247
71334
  capName: "llm",
71248
71335
  capScope: "system",
71249
71336
  addonId: null,
71250
- access: "view"
71337
+ access: "create"
71251
71338
  },
71252
71339
  "llm.listNodeModels": {
71253
71340
  capName: "llm",
@@ -75911,12 +75998,6 @@ Object.freeze({
75911
75998
  addonId: null,
75912
75999
  access: "create"
75913
76000
  },
75914
- "userManagement.createScopedToken": {
75915
- capName: "user-management",
75916
- capScope: "system",
75917
- addonId: null,
75918
- access: "create"
75919
- },
75920
76001
  "userManagement.createUser": {
75921
76002
  capName: "user-management",
75922
76003
  capScope: "system",
@@ -75965,12 +76046,6 @@ Object.freeze({
75965
76046
  addonId: null,
75966
76047
  access: "view"
75967
76048
  },
75968
- "userManagement.listScopedTokens": {
75969
- capName: "user-management",
75970
- capScope: "system",
75971
- addonId: null,
75972
- access: "view"
75973
- },
75974
76049
  "userManagement.listUsers": {
75975
76050
  capName: "user-management",
75976
76051
  capScope: "system",
@@ -76025,12 +76100,6 @@ Object.freeze({
76025
76100
  addonId: null,
76026
76101
  access: "delete"
76027
76102
  },
76028
- "userManagement.revokeScopedToken": {
76029
- capName: "user-management",
76030
- capScope: "system",
76031
- addonId: null,
76032
- access: "delete"
76033
- },
76034
76103
  "userManagement.setupTotp": {
76035
76104
  capName: "user-management",
76036
76105
  capScope: "system",
@@ -76061,12 +76130,6 @@ Object.freeze({
76061
76130
  addonId: null,
76062
76131
  access: "view"
76063
76132
  },
76064
- "userManagement.validateScopedToken": {
76065
- capName: "user-management",
76066
- capScope: "system",
76067
- addonId: null,
76068
- access: "view"
76069
- },
76070
76133
  "userManagement.verifyTotp": {
76071
76134
  capName: "user-management",
76072
76135
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -6398,7 +6398,7 @@ var ZodIssueCode = {
6398
6398
  var ZodFirstPartyTypeKind;
6399
6399
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6400
6400
  //#endregion
6401
- //#region ../types/dist/sleep-BxjU_fJM.mjs
6401
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
6402
6402
  /**
6403
6403
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6404
6404
  * window to float samples (D455).
@@ -8781,9 +8781,9 @@ function normalizeAddonInitResult(result) {
8781
8781
  return result;
8782
8782
  }
8783
8783
  /**
8784
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
8785
- * and validates them (`share-token.service.ts` builds its enum from this
8786
- * list); a data plane names the kinds it ACCEPTS in `share`.
8784
+ * The share-view scope kinds a share-link token can carry. The hub mints
8785
+ * and validates them (`ShareViewGrantSchema` builds its
8786
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
8787
8787
  */
8788
8788
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
8789
8789
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -13473,7 +13473,7 @@ var ConvertResultSchema = object({
13473
13473
  * `super_admin` — collapsed onto the single boolean because every
13474
13474
  * non-admin caller is governed by the same scope-check rules; the
13475
13475
  * distinction was only ever used to route role-specific procedures
13476
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
13476
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
13477
13477
  * with `isAdmin: false` + an explicit scope list.
13478
13478
  */
13479
13479
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13662,10 +13662,12 @@ var AddonRoutesScopeSchema = object({
13662
13662
  type: literal("addon-routes"),
13663
13663
  access: array(MethodAccessSchema).min(1)
13664
13664
  });
13665
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13665
13666
  var CredentialScopeSchema = union([
13666
13667
  literal("*"),
13667
13668
  ShareViewScopeSchema,
13668
13669
  AddonRoutesScopeSchema,
13670
+ PreferencesSelfScopeSchema,
13669
13671
  TokenScopeSchema
13670
13672
  ]);
13671
13673
  object({
@@ -13674,6 +13676,55 @@ object({
13674
13676
  jti: string().min(16),
13675
13677
  scopes: array(CredentialScopeSchema).min(1)
13676
13678
  });
13679
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13680
+ /** A namespace's value: a JSON object, opaque to the hub. */
13681
+ var PreferenceValueSchema = record(string(), unknown());
13682
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13683
+ /** A stored row, as the owner reads it. */
13684
+ var PreferenceRowSchema = object({
13685
+ namespace: PreferenceNamespaceSchema,
13686
+ value: PreferenceValueSchema,
13687
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13688
+ revision: number().int().positive(),
13689
+ updatedAt: number().int(),
13690
+ /** The client id the last writer sent; `null` when it sent none. */
13691
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13692
+ });
13693
+ object({
13694
+ /** Absent: every namespace the caller holds. */
13695
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13696
+ object({ rows: array(PreferenceRowSchema) });
13697
+ object({
13698
+ namespace: PreferenceNamespaceSchema,
13699
+ value: PreferenceValueSchema,
13700
+ /**
13701
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13702
+ * namespace must not exist yet. Any other value that is not the current
13703
+ * revision answers `conflict` and writes nothing.
13704
+ */
13705
+ baseRevision: number().int().nonnegative().optional(),
13706
+ deviceId: PreferenceDeviceIdSchema.optional()
13707
+ });
13708
+ discriminatedUnion("status", [object({
13709
+ status: literal("saved"),
13710
+ row: PreferenceRowSchema
13711
+ }), object({
13712
+ status: literal("conflict"),
13713
+ current: PreferenceRowSchema.nullable()
13714
+ })]);
13715
+ object({ namespace: PreferenceNamespaceSchema });
13716
+ object({
13717
+ /** `false` when the namespace did not exist. */
13718
+ deleted: boolean() });
13719
+ object({
13720
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13721
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13722
+ object({
13723
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13724
+ rows: array(PreferenceRowSchema),
13725
+ /** Namespaces the client listed that no longer exist. */
13726
+ deleted: array(PreferenceNamespaceSchema)
13727
+ });
13677
13728
  _enum(["new-session", "step-up"]);
13678
13729
  /** The languages the hub's app landing pages are written in (D858). */
13679
13730
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40963,38 +41014,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40963
41014
  auth: "admin",
40964
41015
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40965
41016
  });
41017
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
41018
+ /** What a model (or, by default, every model of a kind) can do. */
41019
+ var LlmModelFeaturesSchema = object({
41020
+ vision: boolean(),
41021
+ tools: boolean(),
41022
+ streaming: boolean()
41023
+ });
41024
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
41025
+ var LlmModelInfoSchema = object({
41026
+ id: string(),
41027
+ label: string().optional(),
41028
+ contextLength: number().int().positive().optional(),
41029
+ features: LlmModelFeaturesSchema.partial().optional()
41030
+ });
40966
41031
  /**
40967
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40968
- * methods concat-fan across providers; single-row methods route to ONE
40969
- * provider by the `addonId` in the call input (the notification-output
40970
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40971
- * (hub-placed); the cap stays open for future providers.
40972
- *
40973
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40974
- * `apiKey` is a password field — providers REDACT it on read and merge on
40975
- * write; a stored key NEVER round-trips to a client.
41032
+ * The provider-specific part of a profile, validated by the provider that owns
41033
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
41034
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
41035
+ * keychain, never in the row, and reads back as the redaction marker.
40976
41036
  */
40977
- var LlmProfileKindSchema = _enum([
40978
- "openai-compatible",
40979
- "openai",
40980
- "anthropic",
40981
- "google",
40982
- "managed-local",
40983
- "apple-foundation"
40984
- ]);
41037
+ var LlmProviderConfigSchema = record(string(), unknown());
40985
41038
  var LlmProfileSchema = object({
40986
41039
  id: string(),
40987
41040
  name: string(),
41041
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40988
41042
  kind: LlmProfileKindSchema,
40989
41043
  /** Stamped by the provider — keeps the fanned catalog routable. */
40990
41044
  addonId: string(),
40991
41045
  enabled: boolean(),
40992
41046
  /** Vendor model id, or the managed runtime's loaded model. */
40993
41047
  model: string(),
40994
- /** Required for openai-compatible; override for cloud kinds. */
40995
- baseUrl: string().optional(),
40996
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40997
- apiKey: string().optional(),
40998
41048
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40999
41049
  * degraded to text — that shipped once and produced a confident answer to a
41000
41050
  * question about a picture nobody sent. */
@@ -41002,15 +41052,11 @@ var LlmProfileSchema = object({
41002
41052
  temperature: number().min(0).max(2).optional(),
41003
41053
  /** Nucleus sampling. Every wire we speak has it. */
41004
41054
  topP: number().min(0).max(1).optional(),
41005
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
41006
- * wire does, and the client drops it there (measured: the request body gets
41007
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
41008
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
41055
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
41056
+ * field in its editor only when its descriptor lists it in `profileFields`. */
41009
41057
  topK: number().int().positive().optional(),
41010
41058
  maxTokens: number().int().positive().optional(),
41011
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
41012
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
41013
- * the model with, so it is the one field that changes a PROCESS. */
41059
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
41014
41060
  contextLength: number().int().positive().optional(),
41015
41061
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
41016
41062
  * two system prompts fighting is worse than either alone). */
@@ -41036,16 +41082,37 @@ var LlmProfileSchema = object({
41036
41082
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
41037
41083
  * `true` here buys the wiring, not behaviour, until tools are registered. */
41038
41084
  toolsEnabled: boolean().default(false),
41039
- extraHeaders: record(string(), string()).optional(),
41040
- /** kind === 'managed-local' only (spec §4). */
41041
- runtime: ManagedRuntimeConfigSchema.optional(),
41042
- /**
41043
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
41044
- * to configure (no key, no URL, no download; `model` is `apple-system`).
41045
- * `supportsVision` on such a row is stamped by the provider from the node's
41046
- * reported `imageInput`, never taken from the operator (D62).
41047
- */
41048
- appleFoundation: object({ nodeId: string() }).optional()
41085
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
41086
+ providerConfig: LlmProviderConfigSchema.default({})
41087
+ });
41088
+ /**
41089
+ * The common profile fields a kind's editor offers. The editor owns how each
41090
+ * one is drawn; the provider says which of them mean something on its wire.
41091
+ */
41092
+ var LlmProfileFieldSchema = _enum([
41093
+ "temperature",
41094
+ "topP",
41095
+ "topK",
41096
+ "maxTokens",
41097
+ "contextLength",
41098
+ "systemPrompt",
41099
+ "timeoutMs",
41100
+ "connectTimeoutMs",
41101
+ "firstTokenTimeoutMs",
41102
+ "idleTimeoutMs",
41103
+ "retry",
41104
+ "toolsEnabled"
41105
+ ]);
41106
+ /**
41107
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
41108
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
41109
+ * picker: that widget owns the model choice.
41110
+ */
41111
+ var LlmProviderWidgetSchema = object({
41112
+ id: string(),
41113
+ placement: _enum(["connection", "model"]),
41114
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
41115
+ requires: array(string()).optional()
41049
41116
  });
41050
41117
  /** ConfigUISchema tree passed through untyped on the wire (the
41051
41118
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -41054,11 +41121,56 @@ var ConfigSchemaPassthrough$3 = unknown();
41054
41121
  var LlmProfileKindDescriptorSchema = object({
41055
41122
  kind: LlmProfileKindSchema,
41056
41123
  label: string(),
41124
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
41057
41125
  icon: string(),
41058
41126
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
41059
41127
  addonId: string(),
41060
- configSchema: ConfigSchemaPassthrough$3
41128
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
41129
+ connectionSchema: ConfigSchemaPassthrough$3,
41130
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
41131
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
41132
+ /** The kind's defaults; a model from `listModels` may override any of them. */
41133
+ features: LlmModelFeaturesSchema,
41134
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
41135
+ visionEditable: boolean(),
41136
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
41137
+ modelCatalog: _enum([
41138
+ "fetch",
41139
+ "static",
41140
+ "none"
41141
+ ]),
41142
+ staticModels: array(LlmModelInfoSchema).optional(),
41143
+ /** The common fields that mean something on this kind's wire. */
41144
+ profileFields: array(LlmProfileFieldSchema),
41145
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
41061
41146
  });
41147
+ /**
41148
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
41149
+ * (the editor's form); with `profileId` too, a secret the draft leaves
41150
+ * untouched (absent or the redaction marker) is resolved server-side from the
41151
+ * stored profile — the browser never receives it.
41152
+ */
41153
+ var LlmListModelsInputSchema = object({
41154
+ addonId: string(),
41155
+ kind: LlmProfileKindSchema,
41156
+ profileId: string().optional(),
41157
+ connection: LlmProviderConfigSchema.optional()
41158
+ });
41159
+ var LlmListModelsErrorCodeSchema = _enum([
41160
+ "auth",
41161
+ "network",
41162
+ "unsupported",
41163
+ "invalid"
41164
+ ]);
41165
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
41166
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
41167
+ ok: literal(true),
41168
+ models: array(LlmModelInfoSchema)
41169
+ }), object({
41170
+ ok: literal(false),
41171
+ code: LlmListModelsErrorCodeSchema,
41172
+ message: string()
41173
+ })]);
41062
41174
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
41063
41175
  var LlmDefaultSchema = object({
41064
41176
  selector: LlmDefaultSelectorSchema,
@@ -41158,7 +41270,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
41158
41270
  kind: "mutation",
41159
41271
  auth: "admin",
41160
41272
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
41161
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
41273
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
41274
+ kind: "mutation",
41275
+ auth: "admin"
41276
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
41162
41277
  selector: LlmDefaultSelectorSchema,
41163
41278
  profileId: string().nullable()
41164
41279
  }), _void(), {
@@ -65046,26 +65161,6 @@ var ApiKeySummarySchema = object({
65046
65161
  createdAt: number(),
65047
65162
  lastUsedAt: number().optional()
65048
65163
  });
65049
- var ScopedTokenSummarySchema = object({
65050
- id: string(),
65051
- userId: string(),
65052
- name: string(),
65053
- tokenPrefix: string(),
65054
- scopes: array(TokenScopeSchema),
65055
- expiresAt: number().nullish(),
65056
- lastUsedAt: number().nullish(),
65057
- createdAt: number()
65058
- });
65059
- var CreateScopedTokenInputSchema = object({
65060
- userId: string(),
65061
- name: string(),
65062
- scopes: array(TokenScopeSchema),
65063
- expiresAt: number().optional()
65064
- });
65065
- var CreateScopedTokenResultSchema = object({
65066
- token: string(),
65067
- record: ScopedTokenSummarySchema
65068
- });
65069
65164
  var OauthSessionSummarySchema = object({
65070
65165
  id: string(),
65071
65166
  userId: string(),
@@ -65087,11 +65182,11 @@ var TotpStatusSchema = object({
65087
65182
  confirmedAt: number().nullable()
65088
65183
  });
65089
65184
  /**
65090
- * user-management — singleton capability for user accounts, API keys,
65091
- * and scoped tokens.
65185
+ * user-management — singleton capability for user accounts and the
65186
+ * legacy API-key rows.
65092
65187
  *
65093
65188
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
65094
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
65189
+ * — the subset check on `setUserScopes` is moot
65095
65190
  * because non-admins never reach these. If/when we open non-admin
65096
65191
  * delegation, structural caller-scope subset check goes inside the
65097
65192
  * provider.
@@ -65148,15 +65243,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
65148
65243
  kind: "mutation",
65149
65244
  auth: "admin",
65150
65245
  access: "delete"
65151
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
65152
- kind: "mutation",
65153
- auth: "admin",
65154
- access: "create"
65155
- }), method(object({ id: string() }), object({ success: literal(true) }), {
65156
- kind: "mutation",
65157
- auth: "admin",
65158
- access: "delete"
65159
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
65246
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
65160
65247
  kind: "mutation",
65161
65248
  auth: "admin",
65162
65249
  access: "create"
@@ -71246,7 +71333,7 @@ Object.freeze({
71246
71333
  capName: "llm",
71247
71334
  capScope: "system",
71248
71335
  addonId: null,
71249
- access: "view"
71336
+ access: "create"
71250
71337
  },
71251
71338
  "llm.listNodeModels": {
71252
71339
  capName: "llm",
@@ -75910,12 +75997,6 @@ Object.freeze({
75910
75997
  addonId: null,
75911
75998
  access: "create"
75912
75999
  },
75913
- "userManagement.createScopedToken": {
75914
- capName: "user-management",
75915
- capScope: "system",
75916
- addonId: null,
75917
- access: "create"
75918
- },
75919
76000
  "userManagement.createUser": {
75920
76001
  capName: "user-management",
75921
76002
  capScope: "system",
@@ -75964,12 +76045,6 @@ Object.freeze({
75964
76045
  addonId: null,
75965
76046
  access: "view"
75966
76047
  },
75967
- "userManagement.listScopedTokens": {
75968
- capName: "user-management",
75969
- capScope: "system",
75970
- addonId: null,
75971
- access: "view"
75972
- },
75973
76048
  "userManagement.listUsers": {
75974
76049
  capName: "user-management",
75975
76050
  capScope: "system",
@@ -76024,12 +76099,6 @@ Object.freeze({
76024
76099
  addonId: null,
76025
76100
  access: "delete"
76026
76101
  },
76027
- "userManagement.revokeScopedToken": {
76028
- capName: "user-management",
76029
- capScope: "system",
76030
- addonId: null,
76031
- access: "delete"
76032
- },
76033
76102
  "userManagement.setupTotp": {
76034
76103
  capName: "user-management",
76035
76104
  capScope: "system",
@@ -76060,12 +76129,6 @@ Object.freeze({
76060
76129
  addonId: null,
76061
76130
  access: "view"
76062
76131
  },
76063
- "userManagement.validateScopedToken": {
76064
- capName: "user-management",
76065
- capScope: "system",
76066
- addonId: null,
76067
- access: "view"
76068
- },
76069
76132
  "userManagement.verifyTotp": {
76070
76133
  capName: "user-management",
76071
76134
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-rademacher",
3
- "version": "0.2.130",
3
+ "version": "0.2.131",
4
4
  "description": "Rademacher HomePilot device-provider addon for CamStack — wraps the @apocaliss92/noderademacher local-hub client (roller shutters over the cover cap)",
5
5
  "keywords": [
6
6
  "camstack",