@camstack/addon-provider-petkit 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
@@ -6516,7 +6516,7 @@ var ZodIssueCode = {
6516
6516
  var ZodFirstPartyTypeKind;
6517
6517
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6518
6518
  //#endregion
6519
- //#region ../types/dist/sleep-BxjU_fJM.mjs
6519
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
6520
6520
  /**
6521
6521
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6522
6522
  * window to float samples (D455).
@@ -8899,9 +8899,9 @@ function normalizeAddonInitResult(result) {
8899
8899
  return result;
8900
8900
  }
8901
8901
  /**
8902
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
8903
- * and validates them (`share-token.service.ts` builds its enum from this
8904
- * list); a data plane names the kinds it ACCEPTS in `share`.
8902
+ * The share-view scope kinds a share-link token can carry. The hub mints
8903
+ * and validates them (`ShareViewGrantSchema` builds its
8904
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
8905
8905
  */
8906
8906
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
8907
8907
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -13591,7 +13591,7 @@ var ConvertResultSchema = object({
13591
13591
  * `super_admin` — collapsed onto the single boolean because every
13592
13592
  * non-admin caller is governed by the same scope-check rules; the
13593
13593
  * distinction was only ever used to route role-specific procedures
13594
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
13594
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
13595
13595
  * with `isAdmin: false` + an explicit scope list.
13596
13596
  */
13597
13597
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13780,10 +13780,12 @@ var AddonRoutesScopeSchema = object({
13780
13780
  type: literal("addon-routes"),
13781
13781
  access: array(MethodAccessSchema).min(1)
13782
13782
  });
13783
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13783
13784
  var CredentialScopeSchema = union([
13784
13785
  literal("*"),
13785
13786
  ShareViewScopeSchema,
13786
13787
  AddonRoutesScopeSchema,
13788
+ PreferencesSelfScopeSchema,
13787
13789
  TokenScopeSchema
13788
13790
  ]);
13789
13791
  object({
@@ -13792,6 +13794,55 @@ object({
13792
13794
  jti: string().min(16),
13793
13795
  scopes: array(CredentialScopeSchema).min(1)
13794
13796
  });
13797
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13798
+ /** A namespace's value: a JSON object, opaque to the hub. */
13799
+ var PreferenceValueSchema = record(string(), unknown());
13800
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13801
+ /** A stored row, as the owner reads it. */
13802
+ var PreferenceRowSchema = object({
13803
+ namespace: PreferenceNamespaceSchema,
13804
+ value: PreferenceValueSchema,
13805
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13806
+ revision: number().int().positive(),
13807
+ updatedAt: number().int(),
13808
+ /** The client id the last writer sent; `null` when it sent none. */
13809
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13810
+ });
13811
+ object({
13812
+ /** Absent: every namespace the caller holds. */
13813
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13814
+ object({ rows: array(PreferenceRowSchema) });
13815
+ object({
13816
+ namespace: PreferenceNamespaceSchema,
13817
+ value: PreferenceValueSchema,
13818
+ /**
13819
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13820
+ * namespace must not exist yet. Any other value that is not the current
13821
+ * revision answers `conflict` and writes nothing.
13822
+ */
13823
+ baseRevision: number().int().nonnegative().optional(),
13824
+ deviceId: PreferenceDeviceIdSchema.optional()
13825
+ });
13826
+ discriminatedUnion("status", [object({
13827
+ status: literal("saved"),
13828
+ row: PreferenceRowSchema
13829
+ }), object({
13830
+ status: literal("conflict"),
13831
+ current: PreferenceRowSchema.nullable()
13832
+ })]);
13833
+ object({ namespace: PreferenceNamespaceSchema });
13834
+ object({
13835
+ /** `false` when the namespace did not exist. */
13836
+ deleted: boolean() });
13837
+ object({
13838
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13839
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13840
+ object({
13841
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13842
+ rows: array(PreferenceRowSchema),
13843
+ /** Namespaces the client listed that no longer exist. */
13844
+ deleted: array(PreferenceNamespaceSchema)
13845
+ });
13795
13846
  _enum(["new-session", "step-up"]);
13796
13847
  /** The languages the hub's app landing pages are written in (D858). */
13797
13848
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40985,38 +41036,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40985
41036
  auth: "admin",
40986
41037
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40987
41038
  });
41039
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
41040
+ /** What a model (or, by default, every model of a kind) can do. */
41041
+ var LlmModelFeaturesSchema = object({
41042
+ vision: boolean(),
41043
+ tools: boolean(),
41044
+ streaming: boolean()
41045
+ });
41046
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
41047
+ var LlmModelInfoSchema = object({
41048
+ id: string(),
41049
+ label: string().optional(),
41050
+ contextLength: number().int().positive().optional(),
41051
+ features: LlmModelFeaturesSchema.partial().optional()
41052
+ });
40988
41053
  /**
40989
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40990
- * methods concat-fan across providers; single-row methods route to ONE
40991
- * provider by the `addonId` in the call input (the notification-output
40992
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40993
- * (hub-placed); the cap stays open for future providers.
40994
- *
40995
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40996
- * `apiKey` is a password field — providers REDACT it on read and merge on
40997
- * write; a stored key NEVER round-trips to a client.
41054
+ * The provider-specific part of a profile, validated by the provider that owns
41055
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
41056
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
41057
+ * keychain, never in the row, and reads back as the redaction marker.
40998
41058
  */
40999
- var LlmProfileKindSchema = _enum([
41000
- "openai-compatible",
41001
- "openai",
41002
- "anthropic",
41003
- "google",
41004
- "managed-local",
41005
- "apple-foundation"
41006
- ]);
41059
+ var LlmProviderConfigSchema = record(string(), unknown());
41007
41060
  var LlmProfileSchema = object({
41008
41061
  id: string(),
41009
41062
  name: string(),
41063
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
41010
41064
  kind: LlmProfileKindSchema,
41011
41065
  /** Stamped by the provider — keeps the fanned catalog routable. */
41012
41066
  addonId: string(),
41013
41067
  enabled: boolean(),
41014
41068
  /** Vendor model id, or the managed runtime's loaded model. */
41015
41069
  model: string(),
41016
- /** Required for openai-compatible; override for cloud kinds. */
41017
- baseUrl: string().optional(),
41018
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
41019
- apiKey: string().optional(),
41020
41070
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
41021
41071
  * degraded to text — that shipped once and produced a confident answer to a
41022
41072
  * question about a picture nobody sent. */
@@ -41024,15 +41074,11 @@ var LlmProfileSchema = object({
41024
41074
  temperature: number().min(0).max(2).optional(),
41025
41075
  /** Nucleus sampling. Every wire we speak has it. */
41026
41076
  topP: number().min(0).max(1).optional(),
41027
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
41028
- * wire does, and the client drops it there (measured: the request body gets
41029
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
41030
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
41077
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
41078
+ * field in its editor only when its descriptor lists it in `profileFields`. */
41031
41079
  topK: number().int().positive().optional(),
41032
41080
  maxTokens: number().int().positive().optional(),
41033
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
41034
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
41035
- * the model with, so it is the one field that changes a PROCESS. */
41081
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
41036
41082
  contextLength: number().int().positive().optional(),
41037
41083
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
41038
41084
  * two system prompts fighting is worse than either alone). */
@@ -41058,16 +41104,37 @@ var LlmProfileSchema = object({
41058
41104
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
41059
41105
  * `true` here buys the wiring, not behaviour, until tools are registered. */
41060
41106
  toolsEnabled: boolean().default(false),
41061
- extraHeaders: record(string(), string()).optional(),
41062
- /** kind === 'managed-local' only (spec §4). */
41063
- runtime: ManagedRuntimeConfigSchema.optional(),
41064
- /**
41065
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
41066
- * to configure (no key, no URL, no download; `model` is `apple-system`).
41067
- * `supportsVision` on such a row is stamped by the provider from the node's
41068
- * reported `imageInput`, never taken from the operator (D62).
41069
- */
41070
- appleFoundation: object({ nodeId: string() }).optional()
41107
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
41108
+ providerConfig: LlmProviderConfigSchema.default({})
41109
+ });
41110
+ /**
41111
+ * The common profile fields a kind's editor offers. The editor owns how each
41112
+ * one is drawn; the provider says which of them mean something on its wire.
41113
+ */
41114
+ var LlmProfileFieldSchema = _enum([
41115
+ "temperature",
41116
+ "topP",
41117
+ "topK",
41118
+ "maxTokens",
41119
+ "contextLength",
41120
+ "systemPrompt",
41121
+ "timeoutMs",
41122
+ "connectTimeoutMs",
41123
+ "firstTokenTimeoutMs",
41124
+ "idleTimeoutMs",
41125
+ "retry",
41126
+ "toolsEnabled"
41127
+ ]);
41128
+ /**
41129
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
41130
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
41131
+ * picker: that widget owns the model choice.
41132
+ */
41133
+ var LlmProviderWidgetSchema = object({
41134
+ id: string(),
41135
+ placement: _enum(["connection", "model"]),
41136
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
41137
+ requires: array(string()).optional()
41071
41138
  });
41072
41139
  /** ConfigUISchema tree passed through untyped on the wire (the
41073
41140
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -41076,11 +41143,56 @@ var ConfigSchemaPassthrough$3 = unknown();
41076
41143
  var LlmProfileKindDescriptorSchema = object({
41077
41144
  kind: LlmProfileKindSchema,
41078
41145
  label: string(),
41146
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
41079
41147
  icon: string(),
41080
41148
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
41081
41149
  addonId: string(),
41082
- configSchema: ConfigSchemaPassthrough$3
41150
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
41151
+ connectionSchema: ConfigSchemaPassthrough$3,
41152
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
41153
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
41154
+ /** The kind's defaults; a model from `listModels` may override any of them. */
41155
+ features: LlmModelFeaturesSchema,
41156
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
41157
+ visionEditable: boolean(),
41158
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
41159
+ modelCatalog: _enum([
41160
+ "fetch",
41161
+ "static",
41162
+ "none"
41163
+ ]),
41164
+ staticModels: array(LlmModelInfoSchema).optional(),
41165
+ /** The common fields that mean something on this kind's wire. */
41166
+ profileFields: array(LlmProfileFieldSchema),
41167
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
41083
41168
  });
41169
+ /**
41170
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
41171
+ * (the editor's form); with `profileId` too, a secret the draft leaves
41172
+ * untouched (absent or the redaction marker) is resolved server-side from the
41173
+ * stored profile — the browser never receives it.
41174
+ */
41175
+ var LlmListModelsInputSchema = object({
41176
+ addonId: string(),
41177
+ kind: LlmProfileKindSchema,
41178
+ profileId: string().optional(),
41179
+ connection: LlmProviderConfigSchema.optional()
41180
+ });
41181
+ var LlmListModelsErrorCodeSchema = _enum([
41182
+ "auth",
41183
+ "network",
41184
+ "unsupported",
41185
+ "invalid"
41186
+ ]);
41187
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
41188
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
41189
+ ok: literal(true),
41190
+ models: array(LlmModelInfoSchema)
41191
+ }), object({
41192
+ ok: literal(false),
41193
+ code: LlmListModelsErrorCodeSchema,
41194
+ message: string()
41195
+ })]);
41084
41196
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
41085
41197
  var LlmDefaultSchema = object({
41086
41198
  selector: LlmDefaultSelectorSchema,
@@ -41180,7 +41292,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
41180
41292
  kind: "mutation",
41181
41293
  auth: "admin",
41182
41294
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
41183
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
41295
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
41296
+ kind: "mutation",
41297
+ auth: "admin"
41298
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
41184
41299
  selector: LlmDefaultSelectorSchema,
41185
41300
  profileId: string().nullable()
41186
41301
  }), _void(), {
@@ -65076,26 +65191,6 @@ var ApiKeySummarySchema = object({
65076
65191
  createdAt: number(),
65077
65192
  lastUsedAt: number().optional()
65078
65193
  });
65079
- var ScopedTokenSummarySchema = object({
65080
- id: string(),
65081
- userId: string(),
65082
- name: string(),
65083
- tokenPrefix: string(),
65084
- scopes: array(TokenScopeSchema),
65085
- expiresAt: number().nullish(),
65086
- lastUsedAt: number().nullish(),
65087
- createdAt: number()
65088
- });
65089
- var CreateScopedTokenInputSchema = object({
65090
- userId: string(),
65091
- name: string(),
65092
- scopes: array(TokenScopeSchema),
65093
- expiresAt: number().optional()
65094
- });
65095
- var CreateScopedTokenResultSchema = object({
65096
- token: string(),
65097
- record: ScopedTokenSummarySchema
65098
- });
65099
65194
  var OauthSessionSummarySchema = object({
65100
65195
  id: string(),
65101
65196
  userId: string(),
@@ -65117,11 +65212,11 @@ var TotpStatusSchema = object({
65117
65212
  confirmedAt: number().nullable()
65118
65213
  });
65119
65214
  /**
65120
- * user-management — singleton capability for user accounts, API keys,
65121
- * and scoped tokens.
65215
+ * user-management — singleton capability for user accounts and the
65216
+ * legacy API-key rows.
65122
65217
  *
65123
65218
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
65124
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
65219
+ * — the subset check on `setUserScopes` is moot
65125
65220
  * because non-admins never reach these. If/when we open non-admin
65126
65221
  * delegation, structural caller-scope subset check goes inside the
65127
65222
  * provider.
@@ -65178,15 +65273,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
65178
65273
  kind: "mutation",
65179
65274
  auth: "admin",
65180
65275
  access: "delete"
65181
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
65182
- kind: "mutation",
65183
- auth: "admin",
65184
- access: "create"
65185
- }), method(object({ id: string() }), object({ success: literal(true) }), {
65186
- kind: "mutation",
65187
- auth: "admin",
65188
- access: "delete"
65189
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
65276
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
65190
65277
  kind: "mutation",
65191
65278
  auth: "admin",
65192
65279
  access: "create"
@@ -71276,7 +71363,7 @@ Object.freeze({
71276
71363
  capName: "llm",
71277
71364
  capScope: "system",
71278
71365
  addonId: null,
71279
- access: "view"
71366
+ access: "create"
71280
71367
  },
71281
71368
  "llm.listNodeModels": {
71282
71369
  capName: "llm",
@@ -75940,12 +76027,6 @@ Object.freeze({
75940
76027
  addonId: null,
75941
76028
  access: "create"
75942
76029
  },
75943
- "userManagement.createScopedToken": {
75944
- capName: "user-management",
75945
- capScope: "system",
75946
- addonId: null,
75947
- access: "create"
75948
- },
75949
76030
  "userManagement.createUser": {
75950
76031
  capName: "user-management",
75951
76032
  capScope: "system",
@@ -75994,12 +76075,6 @@ Object.freeze({
75994
76075
  addonId: null,
75995
76076
  access: "view"
75996
76077
  },
75997
- "userManagement.listScopedTokens": {
75998
- capName: "user-management",
75999
- capScope: "system",
76000
- addonId: null,
76001
- access: "view"
76002
- },
76003
76078
  "userManagement.listUsers": {
76004
76079
  capName: "user-management",
76005
76080
  capScope: "system",
@@ -76054,12 +76129,6 @@ Object.freeze({
76054
76129
  addonId: null,
76055
76130
  access: "delete"
76056
76131
  },
76057
- "userManagement.revokeScopedToken": {
76058
- capName: "user-management",
76059
- capScope: "system",
76060
- addonId: null,
76061
- access: "delete"
76062
- },
76063
76132
  "userManagement.setupTotp": {
76064
76133
  capName: "user-management",
76065
76134
  capScope: "system",
@@ -76090,12 +76159,6 @@ Object.freeze({
76090
76159
  addonId: null,
76091
76160
  access: "view"
76092
76161
  },
76093
- "userManagement.validateScopedToken": {
76094
- capName: "user-management",
76095
- capScope: "system",
76096
- addonId: null,
76097
- access: "view"
76098
- },
76099
76162
  "userManagement.verifyTotp": {
76100
76163
  capName: "user-management",
76101
76164
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -6515,7 +6515,7 @@ var ZodIssueCode = {
6515
6515
  var ZodFirstPartyTypeKind;
6516
6516
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6517
6517
  //#endregion
6518
- //#region ../types/dist/sleep-BxjU_fJM.mjs
6518
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
6519
6519
  /**
6520
6520
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6521
6521
  * window to float samples (D455).
@@ -8898,9 +8898,9 @@ function normalizeAddonInitResult(result) {
8898
8898
  return result;
8899
8899
  }
8900
8900
  /**
8901
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
8902
- * and validates them (`share-token.service.ts` builds its enum from this
8903
- * list); a data plane names the kinds it ACCEPTS in `share`.
8901
+ * The share-view scope kinds a share-link token can carry. The hub mints
8902
+ * and validates them (`ShareViewGrantSchema` builds its
8903
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
8904
8904
  */
8905
8905
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
8906
8906
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -13590,7 +13590,7 @@ var ConvertResultSchema = object({
13590
13590
  * `super_admin` — collapsed onto the single boolean because every
13591
13591
  * non-admin caller is governed by the same scope-check rules; the
13592
13592
  * distinction was only ever used to route role-specific procedures
13593
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
13593
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
13594
13594
  * with `isAdmin: false` + an explicit scope list.
13595
13595
  */
13596
13596
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13779,10 +13779,12 @@ var AddonRoutesScopeSchema = object({
13779
13779
  type: literal("addon-routes"),
13780
13780
  access: array(MethodAccessSchema).min(1)
13781
13781
  });
13782
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13782
13783
  var CredentialScopeSchema = union([
13783
13784
  literal("*"),
13784
13785
  ShareViewScopeSchema,
13785
13786
  AddonRoutesScopeSchema,
13787
+ PreferencesSelfScopeSchema,
13786
13788
  TokenScopeSchema
13787
13789
  ]);
13788
13790
  object({
@@ -13791,6 +13793,55 @@ object({
13791
13793
  jti: string().min(16),
13792
13794
  scopes: array(CredentialScopeSchema).min(1)
13793
13795
  });
13796
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13797
+ /** A namespace's value: a JSON object, opaque to the hub. */
13798
+ var PreferenceValueSchema = record(string(), unknown());
13799
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13800
+ /** A stored row, as the owner reads it. */
13801
+ var PreferenceRowSchema = object({
13802
+ namespace: PreferenceNamespaceSchema,
13803
+ value: PreferenceValueSchema,
13804
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13805
+ revision: number().int().positive(),
13806
+ updatedAt: number().int(),
13807
+ /** The client id the last writer sent; `null` when it sent none. */
13808
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13809
+ });
13810
+ object({
13811
+ /** Absent: every namespace the caller holds. */
13812
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13813
+ object({ rows: array(PreferenceRowSchema) });
13814
+ object({
13815
+ namespace: PreferenceNamespaceSchema,
13816
+ value: PreferenceValueSchema,
13817
+ /**
13818
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13819
+ * namespace must not exist yet. Any other value that is not the current
13820
+ * revision answers `conflict` and writes nothing.
13821
+ */
13822
+ baseRevision: number().int().nonnegative().optional(),
13823
+ deviceId: PreferenceDeviceIdSchema.optional()
13824
+ });
13825
+ discriminatedUnion("status", [object({
13826
+ status: literal("saved"),
13827
+ row: PreferenceRowSchema
13828
+ }), object({
13829
+ status: literal("conflict"),
13830
+ current: PreferenceRowSchema.nullable()
13831
+ })]);
13832
+ object({ namespace: PreferenceNamespaceSchema });
13833
+ object({
13834
+ /** `false` when the namespace did not exist. */
13835
+ deleted: boolean() });
13836
+ object({
13837
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13838
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13839
+ object({
13840
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13841
+ rows: array(PreferenceRowSchema),
13842
+ /** Namespaces the client listed that no longer exist. */
13843
+ deleted: array(PreferenceNamespaceSchema)
13844
+ });
13794
13845
  _enum(["new-session", "step-up"]);
13795
13846
  /** The languages the hub's app landing pages are written in (D858). */
13796
13847
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40984,38 +41035,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40984
41035
  auth: "admin",
40985
41036
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40986
41037
  });
41038
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
41039
+ /** What a model (or, by default, every model of a kind) can do. */
41040
+ var LlmModelFeaturesSchema = object({
41041
+ vision: boolean(),
41042
+ tools: boolean(),
41043
+ streaming: boolean()
41044
+ });
41045
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
41046
+ var LlmModelInfoSchema = object({
41047
+ id: string(),
41048
+ label: string().optional(),
41049
+ contextLength: number().int().positive().optional(),
41050
+ features: LlmModelFeaturesSchema.partial().optional()
41051
+ });
40987
41052
  /**
40988
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40989
- * methods concat-fan across providers; single-row methods route to ONE
40990
- * provider by the `addonId` in the call input (the notification-output
40991
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40992
- * (hub-placed); the cap stays open for future providers.
40993
- *
40994
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40995
- * `apiKey` is a password field — providers REDACT it on read and merge on
40996
- * write; a stored key NEVER round-trips to a client.
41053
+ * The provider-specific part of a profile, validated by the provider that owns
41054
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
41055
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
41056
+ * keychain, never in the row, and reads back as the redaction marker.
40997
41057
  */
40998
- var LlmProfileKindSchema = _enum([
40999
- "openai-compatible",
41000
- "openai",
41001
- "anthropic",
41002
- "google",
41003
- "managed-local",
41004
- "apple-foundation"
41005
- ]);
41058
+ var LlmProviderConfigSchema = record(string(), unknown());
41006
41059
  var LlmProfileSchema = object({
41007
41060
  id: string(),
41008
41061
  name: string(),
41062
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
41009
41063
  kind: LlmProfileKindSchema,
41010
41064
  /** Stamped by the provider — keeps the fanned catalog routable. */
41011
41065
  addonId: string(),
41012
41066
  enabled: boolean(),
41013
41067
  /** Vendor model id, or the managed runtime's loaded model. */
41014
41068
  model: string(),
41015
- /** Required for openai-compatible; override for cloud kinds. */
41016
- baseUrl: string().optional(),
41017
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
41018
- apiKey: string().optional(),
41019
41069
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
41020
41070
  * degraded to text — that shipped once and produced a confident answer to a
41021
41071
  * question about a picture nobody sent. */
@@ -41023,15 +41073,11 @@ var LlmProfileSchema = object({
41023
41073
  temperature: number().min(0).max(2).optional(),
41024
41074
  /** Nucleus sampling. Every wire we speak has it. */
41025
41075
  topP: number().min(0).max(1).optional(),
41026
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
41027
- * wire does, and the client drops it there (measured: the request body gets
41028
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
41029
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
41076
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
41077
+ * field in its editor only when its descriptor lists it in `profileFields`. */
41030
41078
  topK: number().int().positive().optional(),
41031
41079
  maxTokens: number().int().positive().optional(),
41032
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
41033
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
41034
- * the model with, so it is the one field that changes a PROCESS. */
41080
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
41035
41081
  contextLength: number().int().positive().optional(),
41036
41082
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
41037
41083
  * two system prompts fighting is worse than either alone). */
@@ -41057,16 +41103,37 @@ var LlmProfileSchema = object({
41057
41103
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
41058
41104
  * `true` here buys the wiring, not behaviour, until tools are registered. */
41059
41105
  toolsEnabled: boolean().default(false),
41060
- extraHeaders: record(string(), string()).optional(),
41061
- /** kind === 'managed-local' only (spec §4). */
41062
- runtime: ManagedRuntimeConfigSchema.optional(),
41063
- /**
41064
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
41065
- * to configure (no key, no URL, no download; `model` is `apple-system`).
41066
- * `supportsVision` on such a row is stamped by the provider from the node's
41067
- * reported `imageInput`, never taken from the operator (D62).
41068
- */
41069
- appleFoundation: object({ nodeId: string() }).optional()
41106
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
41107
+ providerConfig: LlmProviderConfigSchema.default({})
41108
+ });
41109
+ /**
41110
+ * The common profile fields a kind's editor offers. The editor owns how each
41111
+ * one is drawn; the provider says which of them mean something on its wire.
41112
+ */
41113
+ var LlmProfileFieldSchema = _enum([
41114
+ "temperature",
41115
+ "topP",
41116
+ "topK",
41117
+ "maxTokens",
41118
+ "contextLength",
41119
+ "systemPrompt",
41120
+ "timeoutMs",
41121
+ "connectTimeoutMs",
41122
+ "firstTokenTimeoutMs",
41123
+ "idleTimeoutMs",
41124
+ "retry",
41125
+ "toolsEnabled"
41126
+ ]);
41127
+ /**
41128
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
41129
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
41130
+ * picker: that widget owns the model choice.
41131
+ */
41132
+ var LlmProviderWidgetSchema = object({
41133
+ id: string(),
41134
+ placement: _enum(["connection", "model"]),
41135
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
41136
+ requires: array(string()).optional()
41070
41137
  });
41071
41138
  /** ConfigUISchema tree passed through untyped on the wire (the
41072
41139
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -41075,11 +41142,56 @@ var ConfigSchemaPassthrough$3 = unknown();
41075
41142
  var LlmProfileKindDescriptorSchema = object({
41076
41143
  kind: LlmProfileKindSchema,
41077
41144
  label: string(),
41145
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
41078
41146
  icon: string(),
41079
41147
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
41080
41148
  addonId: string(),
41081
- configSchema: ConfigSchemaPassthrough$3
41149
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
41150
+ connectionSchema: ConfigSchemaPassthrough$3,
41151
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
41152
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
41153
+ /** The kind's defaults; a model from `listModels` may override any of them. */
41154
+ features: LlmModelFeaturesSchema,
41155
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
41156
+ visionEditable: boolean(),
41157
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
41158
+ modelCatalog: _enum([
41159
+ "fetch",
41160
+ "static",
41161
+ "none"
41162
+ ]),
41163
+ staticModels: array(LlmModelInfoSchema).optional(),
41164
+ /** The common fields that mean something on this kind's wire. */
41165
+ profileFields: array(LlmProfileFieldSchema),
41166
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
41082
41167
  });
41168
+ /**
41169
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
41170
+ * (the editor's form); with `profileId` too, a secret the draft leaves
41171
+ * untouched (absent or the redaction marker) is resolved server-side from the
41172
+ * stored profile — the browser never receives it.
41173
+ */
41174
+ var LlmListModelsInputSchema = object({
41175
+ addonId: string(),
41176
+ kind: LlmProfileKindSchema,
41177
+ profileId: string().optional(),
41178
+ connection: LlmProviderConfigSchema.optional()
41179
+ });
41180
+ var LlmListModelsErrorCodeSchema = _enum([
41181
+ "auth",
41182
+ "network",
41183
+ "unsupported",
41184
+ "invalid"
41185
+ ]);
41186
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
41187
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
41188
+ ok: literal(true),
41189
+ models: array(LlmModelInfoSchema)
41190
+ }), object({
41191
+ ok: literal(false),
41192
+ code: LlmListModelsErrorCodeSchema,
41193
+ message: string()
41194
+ })]);
41083
41195
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
41084
41196
  var LlmDefaultSchema = object({
41085
41197
  selector: LlmDefaultSelectorSchema,
@@ -41179,7 +41291,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
41179
41291
  kind: "mutation",
41180
41292
  auth: "admin",
41181
41293
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
41182
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
41294
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
41295
+ kind: "mutation",
41296
+ auth: "admin"
41297
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
41183
41298
  selector: LlmDefaultSelectorSchema,
41184
41299
  profileId: string().nullable()
41185
41300
  }), _void(), {
@@ -65075,26 +65190,6 @@ var ApiKeySummarySchema = object({
65075
65190
  createdAt: number(),
65076
65191
  lastUsedAt: number().optional()
65077
65192
  });
65078
- var ScopedTokenSummarySchema = object({
65079
- id: string(),
65080
- userId: string(),
65081
- name: string(),
65082
- tokenPrefix: string(),
65083
- scopes: array(TokenScopeSchema),
65084
- expiresAt: number().nullish(),
65085
- lastUsedAt: number().nullish(),
65086
- createdAt: number()
65087
- });
65088
- var CreateScopedTokenInputSchema = object({
65089
- userId: string(),
65090
- name: string(),
65091
- scopes: array(TokenScopeSchema),
65092
- expiresAt: number().optional()
65093
- });
65094
- var CreateScopedTokenResultSchema = object({
65095
- token: string(),
65096
- record: ScopedTokenSummarySchema
65097
- });
65098
65193
  var OauthSessionSummarySchema = object({
65099
65194
  id: string(),
65100
65195
  userId: string(),
@@ -65116,11 +65211,11 @@ var TotpStatusSchema = object({
65116
65211
  confirmedAt: number().nullable()
65117
65212
  });
65118
65213
  /**
65119
- * user-management — singleton capability for user accounts, API keys,
65120
- * and scoped tokens.
65214
+ * user-management — singleton capability for user accounts and the
65215
+ * legacy API-key rows.
65121
65216
  *
65122
65217
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
65123
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
65218
+ * — the subset check on `setUserScopes` is moot
65124
65219
  * because non-admins never reach these. If/when we open non-admin
65125
65220
  * delegation, structural caller-scope subset check goes inside the
65126
65221
  * provider.
@@ -65177,15 +65272,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
65177
65272
  kind: "mutation",
65178
65273
  auth: "admin",
65179
65274
  access: "delete"
65180
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
65181
- kind: "mutation",
65182
- auth: "admin",
65183
- access: "create"
65184
- }), method(object({ id: string() }), object({ success: literal(true) }), {
65185
- kind: "mutation",
65186
- auth: "admin",
65187
- access: "delete"
65188
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
65275
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
65189
65276
  kind: "mutation",
65190
65277
  auth: "admin",
65191
65278
  access: "create"
@@ -71275,7 +71362,7 @@ Object.freeze({
71275
71362
  capName: "llm",
71276
71363
  capScope: "system",
71277
71364
  addonId: null,
71278
- access: "view"
71365
+ access: "create"
71279
71366
  },
71280
71367
  "llm.listNodeModels": {
71281
71368
  capName: "llm",
@@ -75939,12 +76026,6 @@ Object.freeze({
75939
76026
  addonId: null,
75940
76027
  access: "create"
75941
76028
  },
75942
- "userManagement.createScopedToken": {
75943
- capName: "user-management",
75944
- capScope: "system",
75945
- addonId: null,
75946
- access: "create"
75947
- },
75948
76029
  "userManagement.createUser": {
75949
76030
  capName: "user-management",
75950
76031
  capScope: "system",
@@ -75993,12 +76074,6 @@ Object.freeze({
75993
76074
  addonId: null,
75994
76075
  access: "view"
75995
76076
  },
75996
- "userManagement.listScopedTokens": {
75997
- capName: "user-management",
75998
- capScope: "system",
75999
- addonId: null,
76000
- access: "view"
76001
- },
76002
76077
  "userManagement.listUsers": {
76003
76078
  capName: "user-management",
76004
76079
  capScope: "system",
@@ -76053,12 +76128,6 @@ Object.freeze({
76053
76128
  addonId: null,
76054
76129
  access: "delete"
76055
76130
  },
76056
- "userManagement.revokeScopedToken": {
76057
- capName: "user-management",
76058
- capScope: "system",
76059
- addonId: null,
76060
- access: "delete"
76061
- },
76062
76131
  "userManagement.setupTotp": {
76063
76132
  capName: "user-management",
76064
76133
  capScope: "system",
@@ -76089,12 +76158,6 @@ Object.freeze({
76089
76158
  addonId: null,
76090
76159
  access: "view"
76091
76160
  },
76092
- "userManagement.validateScopedToken": {
76093
- capName: "user-management",
76094
- capScope: "system",
76095
- addonId: null,
76096
- access: "view"
76097
- },
76098
76161
  "userManagement.verifyTotp": {
76099
76162
  capName: "user-management",
76100
76163
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-petkit",
3
- "version": "0.2.130",
3
+ "version": "0.2.131",
4
4
  "description": "PetKit smart-feeder device-provider addon for CamStack — wraps the @apocaliss92/nodepetkit PetKit cloud client",
5
5
  "keywords": [
6
6
  "camstack",