@camstack/addon-matter-broker 0.2.131 → 0.2.132

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
@@ -5561,7 +5561,7 @@ var ZodIssueCode = {
5561
5561
  var ZodFirstPartyTypeKind;
5562
5562
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5563
5563
  //#endregion
5564
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5564
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5565
5565
  /**
5566
5566
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5567
5567
  * window to float samples (D455).
@@ -7944,9 +7944,9 @@ function normalizeAddonInitResult(result) {
7944
7944
  return result;
7945
7945
  }
7946
7946
  /**
7947
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7948
- * and validates them (`share-token.service.ts` builds its enum from this
7949
- * list); a data plane names the kinds it ACCEPTS in `share`.
7947
+ * The share-view scope kinds a share-link token can carry. The hub mints
7948
+ * and validates them (`ShareViewGrantSchema` builds its
7949
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7950
7950
  */
7951
7951
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7952
7952
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12836,7 +12836,7 @@ var ConvertResultSchema = object({
12836
12836
  * `super_admin` — collapsed onto the single boolean because every
12837
12837
  * non-admin caller is governed by the same scope-check rules; the
12838
12838
  * distinction was only ever used to route role-specific procedures
12839
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12839
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12840
12840
  * with `isAdmin: false` + an explicit scope list.
12841
12841
  */
12842
12842
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13025,10 +13025,12 @@ var AddonRoutesScopeSchema = object({
13025
13025
  type: literal("addon-routes"),
13026
13026
  access: array(MethodAccessSchema).min(1)
13027
13027
  });
13028
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13028
13029
  var CredentialScopeSchema = union([
13029
13030
  literal("*"),
13030
13031
  ShareViewScopeSchema,
13031
13032
  AddonRoutesScopeSchema,
13033
+ PreferencesSelfScopeSchema,
13032
13034
  TokenScopeSchema
13033
13035
  ]);
13034
13036
  object({
@@ -13037,6 +13039,55 @@ object({
13037
13039
  jti: string$2().min(16),
13038
13040
  scopes: array(CredentialScopeSchema).min(1)
13039
13041
  });
13042
+ var PreferenceNamespaceSchema = string$2().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13043
+ /** A namespace's value: a JSON object, opaque to the hub. */
13044
+ var PreferenceValueSchema = record(string$2(), unknown());
13045
+ var PreferenceDeviceIdSchema = string$2().min(1).max(64);
13046
+ /** A stored row, as the owner reads it. */
13047
+ var PreferenceRowSchema = object({
13048
+ namespace: PreferenceNamespaceSchema,
13049
+ value: PreferenceValueSchema,
13050
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13051
+ revision: number().int().positive(),
13052
+ updatedAt: number().int(),
13053
+ /** The client id the last writer sent; `null` when it sent none. */
13054
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13055
+ });
13056
+ object({
13057
+ /** Absent: every namespace the caller holds. */
13058
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13059
+ object({ rows: array(PreferenceRowSchema) });
13060
+ object({
13061
+ namespace: PreferenceNamespaceSchema,
13062
+ value: PreferenceValueSchema,
13063
+ /**
13064
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13065
+ * namespace must not exist yet. Any other value that is not the current
13066
+ * revision answers `conflict` and writes nothing.
13067
+ */
13068
+ baseRevision: number().int().nonnegative().optional(),
13069
+ deviceId: PreferenceDeviceIdSchema.optional()
13070
+ });
13071
+ discriminatedUnion("status", [object({
13072
+ status: literal("saved"),
13073
+ row: PreferenceRowSchema
13074
+ }), object({
13075
+ status: literal("conflict"),
13076
+ current: PreferenceRowSchema.nullable()
13077
+ })]);
13078
+ object({ namespace: PreferenceNamespaceSchema });
13079
+ object({
13080
+ /** `false` when the namespace did not exist. */
13081
+ deleted: boolean() });
13082
+ object({
13083
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13084
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13085
+ object({
13086
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13087
+ rows: array(PreferenceRowSchema),
13088
+ /** Namespaces the client listed that no longer exist. */
13089
+ deleted: array(PreferenceNamespaceSchema)
13090
+ });
13040
13091
  _enum(["new-session", "step-up"]);
13041
13092
  /** The languages the hub's app landing pages are written in (D858). */
13042
13093
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40279,38 +40330,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40279
40330
  auth: "admin",
40280
40331
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40281
40332
  });
40333
+ var LlmProfileKindSchema = string$2().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40334
+ /** What a model (or, by default, every model of a kind) can do. */
40335
+ var LlmModelFeaturesSchema = object({
40336
+ vision: boolean(),
40337
+ tools: boolean(),
40338
+ streaming: boolean()
40339
+ });
40340
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40341
+ var LlmModelInfoSchema = object({
40342
+ id: string$2(),
40343
+ label: string$2().optional(),
40344
+ contextLength: number().int().positive().optional(),
40345
+ features: LlmModelFeaturesSchema.partial().optional()
40346
+ });
40282
40347
  /**
40283
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40284
- * methods concat-fan across providers; single-row methods route to ONE
40285
- * provider by the `addonId` in the call input (the notification-output
40286
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40287
- * (hub-placed); the cap stays open for future providers.
40288
- *
40289
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40290
- * `apiKey` is a password field — providers REDACT it on read and merge on
40291
- * write; a stored key NEVER round-trips to a client.
40348
+ * The provider-specific part of a profile, validated by the provider that owns
40349
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40350
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40351
+ * keychain, never in the row, and reads back as the redaction marker.
40292
40352
  */
40293
- var LlmProfileKindSchema = _enum([
40294
- "openai-compatible",
40295
- "openai",
40296
- "anthropic",
40297
- "google",
40298
- "managed-local",
40299
- "apple-foundation"
40300
- ]);
40353
+ var LlmProviderConfigSchema = record(string$2(), unknown());
40301
40354
  var LlmProfileSchema = object({
40302
40355
  id: string$2(),
40303
40356
  name: string$2(),
40357
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40304
40358
  kind: LlmProfileKindSchema,
40305
40359
  /** Stamped by the provider — keeps the fanned catalog routable. */
40306
40360
  addonId: string$2(),
40307
40361
  enabled: boolean(),
40308
40362
  /** Vendor model id, or the managed runtime's loaded model. */
40309
40363
  model: string$2(),
40310
- /** Required for openai-compatible; override for cloud kinds. */
40311
- baseUrl: string$2().optional(),
40312
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40313
- apiKey: string$2().optional(),
40314
40364
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40315
40365
  * degraded to text — that shipped once and produced a confident answer to a
40316
40366
  * question about a picture nobody sent. */
@@ -40318,15 +40368,11 @@ var LlmProfileSchema = object({
40318
40368
  temperature: number().min(0).max(2).optional(),
40319
40369
  /** Nucleus sampling. Every wire we speak has it. */
40320
40370
  topP: number().min(0).max(1).optional(),
40321
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40322
- * wire does, and the client drops it there (measured: the request body gets
40323
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40324
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40371
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40372
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40325
40373
  topK: number().int().positive().optional(),
40326
40374
  maxTokens: number().int().positive().optional(),
40327
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40328
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40329
- * the model with, so it is the one field that changes a PROCESS. */
40375
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40330
40376
  contextLength: number().int().positive().optional(),
40331
40377
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40332
40378
  * two system prompts fighting is worse than either alone). */
@@ -40352,16 +40398,37 @@ var LlmProfileSchema = object({
40352
40398
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40353
40399
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40354
40400
  toolsEnabled: boolean().default(false),
40355
- extraHeaders: record(string$2(), string$2()).optional(),
40356
- /** kind === 'managed-local' only (spec §4). */
40357
- runtime: ManagedRuntimeConfigSchema.optional(),
40358
- /**
40359
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40360
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40361
- * `supportsVision` on such a row is stamped by the provider from the node's
40362
- * reported `imageInput`, never taken from the operator (D62).
40363
- */
40364
- appleFoundation: object({ nodeId: string$2() }).optional()
40401
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40402
+ providerConfig: LlmProviderConfigSchema.default({})
40403
+ });
40404
+ /**
40405
+ * The common profile fields a kind's editor offers. The editor owns how each
40406
+ * one is drawn; the provider says which of them mean something on its wire.
40407
+ */
40408
+ var LlmProfileFieldSchema = _enum([
40409
+ "temperature",
40410
+ "topP",
40411
+ "topK",
40412
+ "maxTokens",
40413
+ "contextLength",
40414
+ "systemPrompt",
40415
+ "timeoutMs",
40416
+ "connectTimeoutMs",
40417
+ "firstTokenTimeoutMs",
40418
+ "idleTimeoutMs",
40419
+ "retry",
40420
+ "toolsEnabled"
40421
+ ]);
40422
+ /**
40423
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40424
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40425
+ * picker: that widget owns the model choice.
40426
+ */
40427
+ var LlmProviderWidgetSchema = object({
40428
+ id: string$2(),
40429
+ placement: _enum(["connection", "model"]),
40430
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40431
+ requires: array(string$2()).optional()
40365
40432
  });
40366
40433
  /** ConfigUISchema tree passed through untyped on the wire (the
40367
40434
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40370,11 +40437,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40370
40437
  var LlmProfileKindDescriptorSchema = object({
40371
40438
  kind: LlmProfileKindSchema,
40372
40439
  label: string$2(),
40440
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40373
40441
  icon: string$2(),
40374
40442
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40375
40443
  addonId: string$2(),
40376
- configSchema: ConfigSchemaPassthrough$3
40444
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40445
+ connectionSchema: ConfigSchemaPassthrough$3,
40446
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40447
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40448
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40449
+ features: LlmModelFeaturesSchema,
40450
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40451
+ visionEditable: boolean(),
40452
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40453
+ modelCatalog: _enum([
40454
+ "fetch",
40455
+ "static",
40456
+ "none"
40457
+ ]),
40458
+ staticModels: array(LlmModelInfoSchema).optional(),
40459
+ /** The common fields that mean something on this kind's wire. */
40460
+ profileFields: array(LlmProfileFieldSchema),
40461
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40377
40462
  });
40463
+ /**
40464
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40465
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40466
+ * untouched (absent or the redaction marker) is resolved server-side from the
40467
+ * stored profile — the browser never receives it.
40468
+ */
40469
+ var LlmListModelsInputSchema = object({
40470
+ addonId: string$2(),
40471
+ kind: LlmProfileKindSchema,
40472
+ profileId: string$2().optional(),
40473
+ connection: LlmProviderConfigSchema.optional()
40474
+ });
40475
+ var LlmListModelsErrorCodeSchema = _enum([
40476
+ "auth",
40477
+ "network",
40478
+ "unsupported",
40479
+ "invalid"
40480
+ ]);
40481
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40482
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40483
+ ok: literal(true),
40484
+ models: array(LlmModelInfoSchema)
40485
+ }), object({
40486
+ ok: literal(false),
40487
+ code: LlmListModelsErrorCodeSchema,
40488
+ message: string$2()
40489
+ })]);
40378
40490
  var LlmDefaultSelectorSchema = union([object({ consumer: string$2() }), object({ purpose: _enum(["text", "vision"]) })]);
40379
40491
  var LlmDefaultSchema = object({
40380
40492
  selector: LlmDefaultSelectorSchema,
@@ -40474,7 +40586,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40474
40586
  kind: "mutation",
40475
40587
  auth: "admin",
40476
40588
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40477
- }), method(ProfileRefInputSchema, array(string$2())), method(object({}), array(LlmDefaultSchema)), method(object({
40589
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40590
+ kind: "mutation",
40591
+ auth: "admin"
40592
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40478
40593
  selector: LlmDefaultSelectorSchema,
40479
40594
  profileId: string$2().nullable()
40480
40595
  }), _void(), {
@@ -64379,26 +64494,6 @@ var ApiKeySummarySchema = object({
64379
64494
  createdAt: number(),
64380
64495
  lastUsedAt: number().optional()
64381
64496
  });
64382
- var ScopedTokenSummarySchema = object({
64383
- id: string$2(),
64384
- userId: string$2(),
64385
- name: string$2(),
64386
- tokenPrefix: string$2(),
64387
- scopes: array(TokenScopeSchema),
64388
- expiresAt: number().nullish(),
64389
- lastUsedAt: number().nullish(),
64390
- createdAt: number()
64391
- });
64392
- var CreateScopedTokenInputSchema = object({
64393
- userId: string$2(),
64394
- name: string$2(),
64395
- scopes: array(TokenScopeSchema),
64396
- expiresAt: number().optional()
64397
- });
64398
- var CreateScopedTokenResultSchema = object({
64399
- token: string$2(),
64400
- record: ScopedTokenSummarySchema
64401
- });
64402
64497
  var OauthSessionSummarySchema = object({
64403
64498
  id: string$2(),
64404
64499
  userId: string$2(),
@@ -64420,11 +64515,11 @@ var TotpStatusSchema = object({
64420
64515
  confirmedAt: number().nullable()
64421
64516
  });
64422
64517
  /**
64423
- * user-management — singleton capability for user accounts, API keys,
64424
- * and scoped tokens.
64518
+ * user-management — singleton capability for user accounts and the
64519
+ * legacy API-key rows.
64425
64520
  *
64426
64521
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
64427
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
64522
+ * — the subset check on `setUserScopes` is moot
64428
64523
  * because non-admins never reach these. If/when we open non-admin
64429
64524
  * delegation, structural caller-scope subset check goes inside the
64430
64525
  * provider.
@@ -64481,15 +64576,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64481
64576
  kind: "mutation",
64482
64577
  auth: "admin",
64483
64578
  access: "delete"
64484
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
64485
- kind: "mutation",
64486
- auth: "admin",
64487
- access: "create"
64488
- }), method(object({ id: string$2() }), object({ success: literal(true) }), {
64489
- kind: "mutation",
64490
- auth: "admin",
64491
- access: "delete"
64492
- }), method(object({ token: string$2() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string$2() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string$2() }), TotpSetupResultSchema, {
64579
+ }), method(object({ userId: string$2() }), TotpSetupResultSchema, {
64493
64580
  kind: "mutation",
64494
64581
  auth: "admin",
64495
64582
  access: "create"
@@ -70579,7 +70666,7 @@ Object.freeze({
70579
70666
  capName: "llm",
70580
70667
  capScope: "system",
70581
70668
  addonId: null,
70582
- access: "view"
70669
+ access: "create"
70583
70670
  },
70584
70671
  "llm.listNodeModels": {
70585
70672
  capName: "llm",
@@ -75243,12 +75330,6 @@ Object.freeze({
75243
75330
  addonId: null,
75244
75331
  access: "create"
75245
75332
  },
75246
- "userManagement.createScopedToken": {
75247
- capName: "user-management",
75248
- capScope: "system",
75249
- addonId: null,
75250
- access: "create"
75251
- },
75252
75333
  "userManagement.createUser": {
75253
75334
  capName: "user-management",
75254
75335
  capScope: "system",
@@ -75297,12 +75378,6 @@ Object.freeze({
75297
75378
  addonId: null,
75298
75379
  access: "view"
75299
75380
  },
75300
- "userManagement.listScopedTokens": {
75301
- capName: "user-management",
75302
- capScope: "system",
75303
- addonId: null,
75304
- access: "view"
75305
- },
75306
75381
  "userManagement.listUsers": {
75307
75382
  capName: "user-management",
75308
75383
  capScope: "system",
@@ -75357,12 +75432,6 @@ Object.freeze({
75357
75432
  addonId: null,
75358
75433
  access: "delete"
75359
75434
  },
75360
- "userManagement.revokeScopedToken": {
75361
- capName: "user-management",
75362
- capScope: "system",
75363
- addonId: null,
75364
- access: "delete"
75365
- },
75366
75435
  "userManagement.setupTotp": {
75367
75436
  capName: "user-management",
75368
75437
  capScope: "system",
@@ -75393,12 +75462,6 @@ Object.freeze({
75393
75462
  addonId: null,
75394
75463
  access: "view"
75395
75464
  },
75396
- "userManagement.validateScopedToken": {
75397
- capName: "user-management",
75398
- capScope: "system",
75399
- addonId: null,
75400
- access: "view"
75401
- },
75402
75465
  "userManagement.verifyTotp": {
75403
75466
  capName: "user-management",
75404
75467
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -5559,7 +5559,7 @@ var ZodIssueCode = {
5559
5559
  var ZodFirstPartyTypeKind;
5560
5560
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5561
5561
  //#endregion
5562
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5562
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5563
5563
  /**
5564
5564
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5565
5565
  * window to float samples (D455).
@@ -7942,9 +7942,9 @@ function normalizeAddonInitResult(result) {
7942
7942
  return result;
7943
7943
  }
7944
7944
  /**
7945
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7946
- * and validates them (`share-token.service.ts` builds its enum from this
7947
- * list); a data plane names the kinds it ACCEPTS in `share`.
7945
+ * The share-view scope kinds a share-link token can carry. The hub mints
7946
+ * and validates them (`ShareViewGrantSchema` builds its
7947
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7948
7948
  */
7949
7949
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7950
7950
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12834,7 +12834,7 @@ var ConvertResultSchema = object({
12834
12834
  * `super_admin` — collapsed onto the single boolean because every
12835
12835
  * non-admin caller is governed by the same scope-check rules; the
12836
12836
  * distinction was only ever used to route role-specific procedures
12837
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12837
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12838
12838
  * with `isAdmin: false` + an explicit scope list.
12839
12839
  */
12840
12840
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13023,10 +13023,12 @@ var AddonRoutesScopeSchema = object({
13023
13023
  type: literal("addon-routes"),
13024
13024
  access: array(MethodAccessSchema).min(1)
13025
13025
  });
13026
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13026
13027
  var CredentialScopeSchema = union([
13027
13028
  literal("*"),
13028
13029
  ShareViewScopeSchema,
13029
13030
  AddonRoutesScopeSchema,
13031
+ PreferencesSelfScopeSchema,
13030
13032
  TokenScopeSchema
13031
13033
  ]);
13032
13034
  object({
@@ -13035,6 +13037,55 @@ object({
13035
13037
  jti: string$2().min(16),
13036
13038
  scopes: array(CredentialScopeSchema).min(1)
13037
13039
  });
13040
+ var PreferenceNamespaceSchema = string$2().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13041
+ /** A namespace's value: a JSON object, opaque to the hub. */
13042
+ var PreferenceValueSchema = record(string$2(), unknown());
13043
+ var PreferenceDeviceIdSchema = string$2().min(1).max(64);
13044
+ /** A stored row, as the owner reads it. */
13045
+ var PreferenceRowSchema = object({
13046
+ namespace: PreferenceNamespaceSchema,
13047
+ value: PreferenceValueSchema,
13048
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13049
+ revision: number().int().positive(),
13050
+ updatedAt: number().int(),
13051
+ /** The client id the last writer sent; `null` when it sent none. */
13052
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13053
+ });
13054
+ object({
13055
+ /** Absent: every namespace the caller holds. */
13056
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13057
+ object({ rows: array(PreferenceRowSchema) });
13058
+ object({
13059
+ namespace: PreferenceNamespaceSchema,
13060
+ value: PreferenceValueSchema,
13061
+ /**
13062
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13063
+ * namespace must not exist yet. Any other value that is not the current
13064
+ * revision answers `conflict` and writes nothing.
13065
+ */
13066
+ baseRevision: number().int().nonnegative().optional(),
13067
+ deviceId: PreferenceDeviceIdSchema.optional()
13068
+ });
13069
+ discriminatedUnion("status", [object({
13070
+ status: literal("saved"),
13071
+ row: PreferenceRowSchema
13072
+ }), object({
13073
+ status: literal("conflict"),
13074
+ current: PreferenceRowSchema.nullable()
13075
+ })]);
13076
+ object({ namespace: PreferenceNamespaceSchema });
13077
+ object({
13078
+ /** `false` when the namespace did not exist. */
13079
+ deleted: boolean() });
13080
+ object({
13081
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13082
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13083
+ object({
13084
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13085
+ rows: array(PreferenceRowSchema),
13086
+ /** Namespaces the client listed that no longer exist. */
13087
+ deleted: array(PreferenceNamespaceSchema)
13088
+ });
13038
13089
  _enum(["new-session", "step-up"]);
13039
13090
  /** The languages the hub's app landing pages are written in (D858). */
13040
13091
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40277,38 +40328,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40277
40328
  auth: "admin",
40278
40329
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40279
40330
  });
40331
+ var LlmProfileKindSchema = string$2().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40332
+ /** What a model (or, by default, every model of a kind) can do. */
40333
+ var LlmModelFeaturesSchema = object({
40334
+ vision: boolean(),
40335
+ tools: boolean(),
40336
+ streaming: boolean()
40337
+ });
40338
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40339
+ var LlmModelInfoSchema = object({
40340
+ id: string$2(),
40341
+ label: string$2().optional(),
40342
+ contextLength: number().int().positive().optional(),
40343
+ features: LlmModelFeaturesSchema.partial().optional()
40344
+ });
40280
40345
  /**
40281
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40282
- * methods concat-fan across providers; single-row methods route to ONE
40283
- * provider by the `addonId` in the call input (the notification-output
40284
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40285
- * (hub-placed); the cap stays open for future providers.
40286
- *
40287
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40288
- * `apiKey` is a password field — providers REDACT it on read and merge on
40289
- * write; a stored key NEVER round-trips to a client.
40346
+ * The provider-specific part of a profile, validated by the provider that owns
40347
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40348
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40349
+ * keychain, never in the row, and reads back as the redaction marker.
40290
40350
  */
40291
- var LlmProfileKindSchema = _enum([
40292
- "openai-compatible",
40293
- "openai",
40294
- "anthropic",
40295
- "google",
40296
- "managed-local",
40297
- "apple-foundation"
40298
- ]);
40351
+ var LlmProviderConfigSchema = record(string$2(), unknown());
40299
40352
  var LlmProfileSchema = object({
40300
40353
  id: string$2(),
40301
40354
  name: string$2(),
40355
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40302
40356
  kind: LlmProfileKindSchema,
40303
40357
  /** Stamped by the provider — keeps the fanned catalog routable. */
40304
40358
  addonId: string$2(),
40305
40359
  enabled: boolean(),
40306
40360
  /** Vendor model id, or the managed runtime's loaded model. */
40307
40361
  model: string$2(),
40308
- /** Required for openai-compatible; override for cloud kinds. */
40309
- baseUrl: string$2().optional(),
40310
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40311
- apiKey: string$2().optional(),
40312
40362
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40313
40363
  * degraded to text — that shipped once and produced a confident answer to a
40314
40364
  * question about a picture nobody sent. */
@@ -40316,15 +40366,11 @@ var LlmProfileSchema = object({
40316
40366
  temperature: number().min(0).max(2).optional(),
40317
40367
  /** Nucleus sampling. Every wire we speak has it. */
40318
40368
  topP: number().min(0).max(1).optional(),
40319
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40320
- * wire does, and the client drops it there (measured: the request body gets
40321
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40322
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40369
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40370
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40323
40371
  topK: number().int().positive().optional(),
40324
40372
  maxTokens: number().int().positive().optional(),
40325
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40326
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40327
- * the model with, so it is the one field that changes a PROCESS. */
40373
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40328
40374
  contextLength: number().int().positive().optional(),
40329
40375
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40330
40376
  * two system prompts fighting is worse than either alone). */
@@ -40350,16 +40396,37 @@ var LlmProfileSchema = object({
40350
40396
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40351
40397
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40352
40398
  toolsEnabled: boolean().default(false),
40353
- extraHeaders: record(string$2(), string$2()).optional(),
40354
- /** kind === 'managed-local' only (spec §4). */
40355
- runtime: ManagedRuntimeConfigSchema.optional(),
40356
- /**
40357
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40358
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40359
- * `supportsVision` on such a row is stamped by the provider from the node's
40360
- * reported `imageInput`, never taken from the operator (D62).
40361
- */
40362
- appleFoundation: object({ nodeId: string$2() }).optional()
40399
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40400
+ providerConfig: LlmProviderConfigSchema.default({})
40401
+ });
40402
+ /**
40403
+ * The common profile fields a kind's editor offers. The editor owns how each
40404
+ * one is drawn; the provider says which of them mean something on its wire.
40405
+ */
40406
+ var LlmProfileFieldSchema = _enum([
40407
+ "temperature",
40408
+ "topP",
40409
+ "topK",
40410
+ "maxTokens",
40411
+ "contextLength",
40412
+ "systemPrompt",
40413
+ "timeoutMs",
40414
+ "connectTimeoutMs",
40415
+ "firstTokenTimeoutMs",
40416
+ "idleTimeoutMs",
40417
+ "retry",
40418
+ "toolsEnabled"
40419
+ ]);
40420
+ /**
40421
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40422
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40423
+ * picker: that widget owns the model choice.
40424
+ */
40425
+ var LlmProviderWidgetSchema = object({
40426
+ id: string$2(),
40427
+ placement: _enum(["connection", "model"]),
40428
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40429
+ requires: array(string$2()).optional()
40363
40430
  });
40364
40431
  /** ConfigUISchema tree passed through untyped on the wire (the
40365
40432
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40368,11 +40435,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40368
40435
  var LlmProfileKindDescriptorSchema = object({
40369
40436
  kind: LlmProfileKindSchema,
40370
40437
  label: string$2(),
40438
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40371
40439
  icon: string$2(),
40372
40440
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40373
40441
  addonId: string$2(),
40374
- configSchema: ConfigSchemaPassthrough$3
40442
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40443
+ connectionSchema: ConfigSchemaPassthrough$3,
40444
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40445
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40446
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40447
+ features: LlmModelFeaturesSchema,
40448
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40449
+ visionEditable: boolean(),
40450
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40451
+ modelCatalog: _enum([
40452
+ "fetch",
40453
+ "static",
40454
+ "none"
40455
+ ]),
40456
+ staticModels: array(LlmModelInfoSchema).optional(),
40457
+ /** The common fields that mean something on this kind's wire. */
40458
+ profileFields: array(LlmProfileFieldSchema),
40459
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40375
40460
  });
40461
+ /**
40462
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40463
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40464
+ * untouched (absent or the redaction marker) is resolved server-side from the
40465
+ * stored profile — the browser never receives it.
40466
+ */
40467
+ var LlmListModelsInputSchema = object({
40468
+ addonId: string$2(),
40469
+ kind: LlmProfileKindSchema,
40470
+ profileId: string$2().optional(),
40471
+ connection: LlmProviderConfigSchema.optional()
40472
+ });
40473
+ var LlmListModelsErrorCodeSchema = _enum([
40474
+ "auth",
40475
+ "network",
40476
+ "unsupported",
40477
+ "invalid"
40478
+ ]);
40479
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40480
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40481
+ ok: literal(true),
40482
+ models: array(LlmModelInfoSchema)
40483
+ }), object({
40484
+ ok: literal(false),
40485
+ code: LlmListModelsErrorCodeSchema,
40486
+ message: string$2()
40487
+ })]);
40376
40488
  var LlmDefaultSelectorSchema = union([object({ consumer: string$2() }), object({ purpose: _enum(["text", "vision"]) })]);
40377
40489
  var LlmDefaultSchema = object({
40378
40490
  selector: LlmDefaultSelectorSchema,
@@ -40472,7 +40584,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40472
40584
  kind: "mutation",
40473
40585
  auth: "admin",
40474
40586
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40475
- }), method(ProfileRefInputSchema, array(string$2())), method(object({}), array(LlmDefaultSchema)), method(object({
40587
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40588
+ kind: "mutation",
40589
+ auth: "admin"
40590
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40476
40591
  selector: LlmDefaultSelectorSchema,
40477
40592
  profileId: string$2().nullable()
40478
40593
  }), _void(), {
@@ -64377,26 +64492,6 @@ var ApiKeySummarySchema = object({
64377
64492
  createdAt: number(),
64378
64493
  lastUsedAt: number().optional()
64379
64494
  });
64380
- var ScopedTokenSummarySchema = object({
64381
- id: string$2(),
64382
- userId: string$2(),
64383
- name: string$2(),
64384
- tokenPrefix: string$2(),
64385
- scopes: array(TokenScopeSchema),
64386
- expiresAt: number().nullish(),
64387
- lastUsedAt: number().nullish(),
64388
- createdAt: number()
64389
- });
64390
- var CreateScopedTokenInputSchema = object({
64391
- userId: string$2(),
64392
- name: string$2(),
64393
- scopes: array(TokenScopeSchema),
64394
- expiresAt: number().optional()
64395
- });
64396
- var CreateScopedTokenResultSchema = object({
64397
- token: string$2(),
64398
- record: ScopedTokenSummarySchema
64399
- });
64400
64495
  var OauthSessionSummarySchema = object({
64401
64496
  id: string$2(),
64402
64497
  userId: string$2(),
@@ -64418,11 +64513,11 @@ var TotpStatusSchema = object({
64418
64513
  confirmedAt: number().nullable()
64419
64514
  });
64420
64515
  /**
64421
- * user-management — singleton capability for user accounts, API keys,
64422
- * and scoped tokens.
64516
+ * user-management — singleton capability for user accounts and the
64517
+ * legacy API-key rows.
64423
64518
  *
64424
64519
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
64425
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
64520
+ * — the subset check on `setUserScopes` is moot
64426
64521
  * because non-admins never reach these. If/when we open non-admin
64427
64522
  * delegation, structural caller-scope subset check goes inside the
64428
64523
  * provider.
@@ -64479,15 +64574,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64479
64574
  kind: "mutation",
64480
64575
  auth: "admin",
64481
64576
  access: "delete"
64482
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
64483
- kind: "mutation",
64484
- auth: "admin",
64485
- access: "create"
64486
- }), method(object({ id: string$2() }), object({ success: literal(true) }), {
64487
- kind: "mutation",
64488
- auth: "admin",
64489
- access: "delete"
64490
- }), method(object({ token: string$2() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string$2() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string$2() }), TotpSetupResultSchema, {
64577
+ }), method(object({ userId: string$2() }), TotpSetupResultSchema, {
64491
64578
  kind: "mutation",
64492
64579
  auth: "admin",
64493
64580
  access: "create"
@@ -70577,7 +70664,7 @@ Object.freeze({
70577
70664
  capName: "llm",
70578
70665
  capScope: "system",
70579
70666
  addonId: null,
70580
- access: "view"
70667
+ access: "create"
70581
70668
  },
70582
70669
  "llm.listNodeModels": {
70583
70670
  capName: "llm",
@@ -75241,12 +75328,6 @@ Object.freeze({
75241
75328
  addonId: null,
75242
75329
  access: "create"
75243
75330
  },
75244
- "userManagement.createScopedToken": {
75245
- capName: "user-management",
75246
- capScope: "system",
75247
- addonId: null,
75248
- access: "create"
75249
- },
75250
75331
  "userManagement.createUser": {
75251
75332
  capName: "user-management",
75252
75333
  capScope: "system",
@@ -75295,12 +75376,6 @@ Object.freeze({
75295
75376
  addonId: null,
75296
75377
  access: "view"
75297
75378
  },
75298
- "userManagement.listScopedTokens": {
75299
- capName: "user-management",
75300
- capScope: "system",
75301
- addonId: null,
75302
- access: "view"
75303
- },
75304
75379
  "userManagement.listUsers": {
75305
75380
  capName: "user-management",
75306
75381
  capScope: "system",
@@ -75355,12 +75430,6 @@ Object.freeze({
75355
75430
  addonId: null,
75356
75431
  access: "delete"
75357
75432
  },
75358
- "userManagement.revokeScopedToken": {
75359
- capName: "user-management",
75360
- capScope: "system",
75361
- addonId: null,
75362
- access: "delete"
75363
- },
75364
75433
  "userManagement.setupTotp": {
75365
75434
  capName: "user-management",
75366
75435
  capScope: "system",
@@ -75391,12 +75460,6 @@ Object.freeze({
75391
75460
  addonId: null,
75392
75461
  access: "view"
75393
75462
  },
75394
- "userManagement.validateScopedToken": {
75395
- capName: "user-management",
75396
- capScope: "system",
75397
- addonId: null,
75398
- access: "view"
75399
- },
75400
75463
  "userManagement.verifyTotp": {
75401
75464
  capName: "user-management",
75402
75465
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-matter-broker",
3
- "version": "0.2.131",
3
+ "version": "0.2.132",
4
4
  "description": "Matter broker addon for CamStack — owns a Matter fabric (commissioning + the long-lived controller) via the matter.js controller and brokers commissioned Matter nodes into CamStack",
5
5
  "keywords": [
6
6
  "camstack",